### RAW ASSEMBLY INSTRUCTIONS:

glabel gather_magic_update
/* 38F064 E008E204 27BDFFA8 */  addiu     $sp, $sp, -0x58
/* 38F068 E008E208 AFB3001C */  sw        $s3, 0x1C($sp)
/* 38F06C E008E20C 0080982D */  daddu     $s3, $a0, $zero
/* 38F070 E008E210 AFBF0020 */  sw        $ra, 0x20($sp)
/* 38F074 E008E214 AFB20018 */  sw        $s2, 0x18($sp)
/* 38F078 E008E218 AFB10014 */  sw        $s1, 0x14($sp)
/* 38F07C E008E21C AFB00010 */  sw        $s0, 0x10($sp)
/* 38F080 E008E220 F7BE0050 */  sdc1      $f30, 0x50($sp)
/* 38F084 E008E224 F7BC0048 */  sdc1      $f28, 0x48($sp)
/* 38F088 E008E228 F7BA0040 */  sdc1      $f26, 0x40($sp)
/* 38F08C E008E22C F7B80038 */  sdc1      $f24, 0x38($sp)
/* 38F090 E008E230 F7B60030 */  sdc1      $f22, 0x30($sp)
/* 38F094 E008E234 F7B40028 */  sdc1      $f20, 0x28($sp)
/* 38F098 E008E238 8E64000C */  lw        $a0, 0xC($s3)
/* 38F09C E008E23C 8C830018 */  lw        $v1, 0x18($a0)
/* 38F0A0 E008E240 28620064 */  slti      $v0, $v1, 0x64
/* 38F0A4 E008E244 10400002 */  beqz      $v0, .LE008E250
/* 38F0A8 E008E248 2462FFFF */   addiu    $v0, $v1, -0x1
/* 38F0AC E008E24C AC820018 */  sw        $v0, 0x18($a0)
.LE008E250:
/* 38F0B0 E008E250 8C82001C */  lw        $v0, 0x1C($a0)
/* 38F0B4 E008E254 8C830018 */  lw        $v1, 0x18($a0)
/* 38F0B8 E008E258 24420001 */  addiu     $v0, $v0, 0x1
/* 38F0BC E008E25C 04610005 */  bgez      $v1, .LE008E274
/* 38F0C0 E008E260 AC82001C */   sw       $v0, 0x1C($a0)
/* 38F0C4 E008E264 0C080128 */  jal       shim_remove_effect
/* 38F0C8 E008E268 0260202D */   daddu    $a0, $s3, $zero
/* 38F0CC E008E26C 08023919 */  j         .LE008E464
/* 38F0D0 E008E270 00000000 */   nop
.LE008E274:
/* 38F0D4 E008E274 0040182D */  daddu     $v1, $v0, $zero
/* 38F0D8 E008E278 28620015 */  slti      $v0, $v1, 0x15
/* 38F0DC E008E27C 10400004 */  beqz      $v0, .LE008E290
/* 38F0E0 E008E280 00031040 */   sll      $v0, $v1, 1
/* 38F0E4 E008E284 00431021 */  addu      $v0, $v0, $v1
/* 38F0E8 E008E288 080238A5 */  j         .LE008E294
/* 38F0EC E008E28C 00021080 */   sll      $v0, $v0, 2
.LE008E290:
/* 38F0F0 E008E290 240200FF */  addiu     $v0, $zero, 0xFF
.LE008E294:
/* 38F0F4 E008E294 AC820014 */  sw        $v0, 0x14($a0)
/* 38F0F8 E008E298 30620001 */  andi      $v0, $v1, 0x1
/* 38F0FC E008E29C 1040000A */  beqz      $v0, .LE008E2C8
/* 38F100 E008E2A0 00000000 */   nop
/* 38F104 E008E2A4 3C013FE0 */  lui       $at, (0x3FE00000 >> 16)
/* 38F108 E008E2A8 44811800 */  mtc1      $at, $f3
/* 38F10C E008E2AC 44801000 */  mtc1      $zero, $f2
/* 38F110 E008E2B0 C4800014 */  lwc1      $f0, 0x14($a0)
/* 38F114 E008E2B4 46800021 */  cvt.d.w   $f0, $f0
/* 38F118 E008E2B8 46220002 */  mul.d     $f0, $f0, $f2
/* 38F11C E008E2BC 00000000 */  nop
/* 38F120 E008E2C0 4620018D */  trunc.w.d $f6, $f0
/* 38F124 E008E2C4 E4860014 */  swc1      $f6, 0x14($a0)
.LE008E2C8:
/* 38F128 E008E2C8 8C83001C */  lw        $v1, 0x1C($a0)
/* 38F12C E008E2CC 8E620008 */  lw        $v0, 0x8($s3)
/* 38F130 E008E2D0 24110001 */  addiu     $s1, $zero, 0x1
/* 38F134 E008E2D4 0222102A */  slt       $v0, $s1, $v0
/* 38F138 E008E2D8 10400062 */  beqz      $v0, .LE008E464
/* 38F13C E008E2DC 24840048 */   addiu    $a0, $a0, 0x48
/* 38F140 E008E2E0 00719024 */  and       $s2, $v1, $s1
/* 38F144 E008E2E4 24900024 */  addiu     $s0, $a0, 0x24
/* 38F148 E008E2E8 4480E000 */  mtc1      $zero, $f28
/* 38F14C E008E2EC 3C014000 */  lui       $at, (0x40000000 >> 16)
/* 38F150 E008E2F0 4481F000 */  mtc1      $at, $f30
.LE008E2F4:
/* 38F154 E008E2F4 C614FFFC */  lwc1      $f20, -0x4($s0)
/* 38F158 E008E2F8 C6180008 */  lwc1      $f24, 0x8($s0)
/* 38F15C E008E2FC C61A0000 */  lwc1      $f26, 0x0($s0)
/* 38F160 E008E300 0C080140 */  jal       shim_sin_deg
/* 38F164 E008E304 4600A306 */   mov.s    $f12, $f20
/* 38F168 E008E308 4600A306 */  mov.s     $f12, $f20
/* 38F16C E008E30C 0C080144 */  jal       shim_cos_deg
/* 38F170 E008E310 46000586 */   mov.s    $f22, $f0
/* 38F174 E008E314 4600D306 */  mov.s     $f12, $f26
/* 38F178 E008E318 0C080140 */  jal       shim_sin_deg
/* 38F17C E008E31C 46000506 */   mov.s    $f20, $f0
/* 38F180 E008E320 4600D306 */  mov.s     $f12, $f26
/* 38F184 E008E324 0C080144 */  jal       shim_cos_deg
/* 38F188 E008E328 46000686 */   mov.s    $f26, $f0
/* 38F18C E008E32C 4616C582 */  mul.s     $f22, $f24, $f22
/* 38F190 E008E330 00000000 */  nop
/* 38F194 E008E334 4614C502 */  mul.s     $f20, $f24, $f20
/* 38F198 E008E338 00000000 */  nop
/* 38F19C E008E33C 461AC602 */  mul.s     $f24, $f24, $f26
/* 38F1A0 E008E340 00000000 */  nop
/* 38F1A4 E008E344 4600B582 */  mul.s     $f22, $f22, $f0
/* 38F1A8 E008E348 00000000 */  nop
/* 38F1AC E008E34C 4600A502 */  mul.s     $f20, $f20, $f0
/* 38F1B0 E008E350 00000000 */  nop
/* 38F1B4 E008E354 3C0142C8 */  lui       $at, (0x42C80000 >> 16)
/* 38F1B8 E008E358 44813000 */  mtc1      $at, $f6
/* 38F1BC E008E35C C6000008 */  lwc1      $f0, 0x8($s0)
/* 38F1C0 E008E360 46003001 */  sub.s     $f0, $f6, $f0
/* 38F1C4 E008E364 3C01437F */  lui       $at, (0x437F0000 >> 16)
/* 38F1C8 E008E368 44811000 */  mtc1      $at, $f2
/* 38F1CC E008E36C 00000000 */  nop
/* 38F1D0 E008E370 46020002 */  mul.s     $f0, $f0, $f2
/* 38F1D4 E008E374 00000000 */  nop
/* 38F1D8 E008E378 E618FFEC */  swc1      $f24, -0x14($s0)
/* 38F1DC E008E37C 46000000 */  add.s     $f0, $f0, $f0
/* 38F1E0 E008E380 E616FFE4 */  swc1      $f22, -0x1C($s0)
/* 38F1E4 E008E384 E614FFE8 */  swc1      $f20, -0x18($s0)
/* 38F1E8 E008E388 46060003 */  div.s     $f0, $f0, $f6
/* 38F1EC E008E38C 4600018D */  trunc.w.s $f6, $f0
/* 38F1F0 E008E390 44023000 */  mfc1      $v0, $f6
/* 38F1F4 E008E394 00000000 */  nop
/* 38F1F8 E008E398 AE02FFF0 */  sw        $v0, -0x10($s0)
/* 38F1FC E008E39C 28420100 */  slti      $v0, $v0, 0x100
/* 38F200 E008E3A0 14400004 */  bnez      $v0, .LE008E3B4
/* 38F204 E008E3A4 32220003 */   andi     $v0, $s1, 0x3
/* 38F208 E008E3A8 240200FF */  addiu     $v0, $zero, 0xFF
/* 38F20C E008E3AC AE02FFF0 */  sw        $v0, -0x10($s0)
/* 38F210 E008E3B0 32220003 */  andi      $v0, $s1, 0x3
.LE008E3B4:
/* 38F214 E008E3B4 00021040 */  sll       $v0, $v0, 1
/* 38F218 E008E3B8 C6000008 */  lwc1      $f0, 0x8($s0)
/* 38F21C E008E3BC 3C0142A0 */  lui       $at, (0x42A00000 >> 16)
/* 38F220 E008E3C0 44811000 */  mtc1      $at, $f2
/* 38F224 E008E3C4 24420002 */  addiu     $v0, $v0, 0x2
/* 38F228 E008E3C8 46020003 */  div.s     $f0, $f0, $f2
/* 38F22C E008E3CC 3C01E009 */  lui       $at, (0xE0090000 >> 16)
/* 38F230 E008E3D0 D422E8A0 */  ldc1      $f2, -0x1760($at)
/* 38F234 E008E3D4 46000021 */  cvt.d.s   $f0, $f0
/* 38F238 E008E3D8 46220000 */  add.d     $f0, $f0, $f2
/* 38F23C E008E3DC C6040008 */  lwc1      $f4, 0x8($s0)
/* 38F240 E008E3E0 44821000 */  mtc1      $v0, $f2
/* 38F244 E008E3E4 00000000 */  nop
/* 38F248 E008E3E8 468010A0 */  cvt.s.w   $f2, $f2
/* 38F24C E008E3EC 46022101 */  sub.s     $f4, $f4, $f2
/* 38F250 E008E3F0 46200020 */  cvt.s.d   $f0, $f0
/* 38F254 E008E3F4 461C203C */  c.lt.s    $f4, $f28
/* 38F258 E008E3F8 E6000004 */  swc1      $f0, 0x4($s0)
/* 38F25C E008E3FC 45000003 */  bc1f      .LE008E40C
/* 38F260 E008E400 E6040008 */   swc1     $f4, 0x8($s0)
/* 38F264 E008E404 E61C0008 */  swc1      $f28, 0x8($s0)
/* 38F268 E008E408 E61C0004 */  swc1      $f28, 0x4($s0)
.LE008E40C:
/* 38F26C E008E40C C600FFFC */  lwc1      $f0, -0x4($s0)
/* 38F270 E008E410 52400005 */  beql      $s2, $zero, .LE008E428
/* 38F274 E008E414 461E0000 */   add.s    $f0, $f0, $f30
/* 38F278 E008E418 3C0140A0 */  lui       $at, (0x40A00000 >> 16)
/* 38F27C E008E41C 44813000 */  mtc1      $at, $f6
/* 38F280 E008E420 00000000 */  nop
/* 38F284 E008E424 46060000 */  add.s     $f0, $f0, $f6
.LE008E428:
/* 38F288 E008E428 E600FFFC */  swc1      $f0, -0x4($s0)
/* 38F28C E008E42C 12400003 */  beqz      $s2, .LE008E43C
/* 38F290 E008E430 C6000000 */   lwc1     $f0, 0x0($s0)
/* 38F294 E008E434 08023913 */  j         .LE008E44C
/* 38F298 E008E438 461E0000 */   add.s    $f0, $f0, $f30
.LE008E43C:
/* 38F29C E008E43C 3C0140A0 */  lui       $at, (0x40A00000 >> 16)
/* 38F2A0 E008E440 44813000 */  mtc1      $at, $f6
/* 38F2A4 E008E444 00000000 */  nop
/* 38F2A8 E008E448 46060000 */  add.s     $f0, $f0, $f6
.LE008E44C:
/* 38F2AC E008E44C E6000000 */  swc1      $f0, 0x0($s0)
/* 38F2B0 E008E450 26310001 */  addiu     $s1, $s1, 0x1
/* 38F2B4 E008E454 8E620008 */  lw        $v0, 0x8($s3)
/* 38F2B8 E008E458 0222102A */  slt       $v0, $s1, $v0
/* 38F2BC E008E45C 1440FFA5 */  bnez      $v0, .LE008E2F4
/* 38F2C0 E008E460 26100048 */   addiu    $s0, $s0, 0x48
.LE008E464:
/* 38F2C4 E008E464 8FBF0020 */  lw        $ra, 0x20($sp)
/* 38F2C8 E008E468 8FB3001C */  lw        $s3, 0x1C($sp)
/* 38F2CC E008E46C 8FB20018 */  lw        $s2, 0x18($sp)
/* 38F2D0 E008E470 8FB10014 */  lw        $s1, 0x14($sp)
/* 38F2D4 E008E474 8FB00010 */  lw        $s0, 0x10($sp)
/* 38F2D8 E008E478 D7BE0050 */  ldc1      $f30, 0x50($sp)
/* 38F2DC E008E47C D7BC0048 */  ldc1      $f28, 0x48($sp)
/* 38F2E0 E008E480 D7BA0040 */  ldc1      $f26, 0x40($sp)
/* 38F2E4 E008E484 D7B80038 */  ldc1      $f24, 0x38($sp)
/* 38F2E8 E008E488 D7B60030 */  ldc1      $f22, 0x30($sp)
/* 38F2EC E008E48C D7B40028 */  ldc1      $f20, 0x28($sp)
/* 38F2F0 E008E490 03E00008 */  jr        $ra
/* 38F2F4 E008E494 27BD0058 */   addiu    $sp, $sp, 0x58

### DECOMPILED C INSTRUCTIONS:

void gather_magic_update(EffectInstance* effect) {
    GatherMagicFXData* part = effect->data.gatherMagic;
    s32 unk_1C;
    s32 i;

    if (part->unk_18 < 100) {
        part->unk_18--;
    }

    part->unk_1C++;

    if (part->unk_18 < 0) {
        shim_remove_effect(effect);
        return;
    }

    unk_1C = part->unk_1C;

    if (unk_1C < 21) {
        part->unk_14 = unk_1C * 12;
    } else {
        part->unk_14 = 255;
    }

    if (unk_1C % 2) {
        part->unk_14 *= 0.5;
    }

    unk_1C = part->unk_1C;

    part++;
    for (i = 1; i < effect->numParts; i++, part++) {
        f32 unk_20 = part->unk_20;
        f32 unk_2C = part->unk_2C;
        f32 unk_24 = part->unk_24;
        f32 sin_20 = shim_sin_deg(unk_20);
        f32 cos_20 = shim_cos_deg(unk_20);
        f32 sin_24 = shim_sin_deg(unk_24);
        f32 cos_24 = shim_cos_deg(unk_24);

        part->unk_08 = unk_2C * sin_20 * cos_24;
        part->unk_0C = unk_2C * cos_20 * cos_24;
        part->unk_10 = unk_2C * sin_24;

        part->unk_14 = ((100.0f - part->unk_2C) * 255.0f * 2.0f) / 100.0f;
        if (part->unk_14 >= 256) {
            part->unk_14 = 255;
        }

        part->unk_28 = part->unk_2C / 80.0f + 0.2;
        part->unk_2C -= (i & 3) * 2 + 2;

        if (part->unk_2C < 0.0f) {
            part->unk_2C = 0.0f;
            part->unk_28 = 0.0f;
        }

        part->unk_20 += (unk_1C % 2) ? 5.0f : 2.0f;
        part->unk_24 += (unk_1C % 2) ? 2.0f : 5.0f;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel hud_element_clear_cache
/* D7800 80141100 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* D7804 80141104 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* D7808 80141108 27BDFFE8 */  addiu     $sp, $sp, -0x18
/* D780C 8014110C AFBF0010 */  sw        $ra, 0x10($sp)
/* D7810 80141110 80420070 */  lb        $v0, 0x70($v0)
/* D7814 80141114 14400011 */  bnez      $v0, .L8014115C
/* D7818 80141118 00000000 */   nop
/* D781C 8014111C 3C028015 */  lui       $v0, %hi(gHudElementsWorld)
/* D7820 80141120 24426F60 */  addiu     $v0, $v0, %lo(gHudElementsWorld)
/* D7824 80141124 3C018015 */  lui       $at, %hi(gHudElements)
/* D7828 80141128 AC227960 */  sw        $v0, %lo(gHudElements)($at)
/* D782C 8014112C 3C028015 */  lui       $v0, %hi(gHudElementCacheSizeWorld)
/* D7830 80141130 24427968 */  addiu     $v0, $v0, %lo(gHudElementCacheSizeWorld)
/* D7834 80141134 3C018015 */  lui       $at, %hi(gHudElementCacheSize)
/* D7838 80141138 AC22133C */  sw        $v0, %lo(gHudElementCacheSize)($at)
/* D783C 8014113C 3C028015 */  lui       $v0, %hi(gHudElementCacheTableRasterWorld)
/* D7840 80141140 24427970 */  addiu     $v0, $v0, %lo(gHudElementCacheTableRasterWorld)
/* D7844 80141144 3C018015 */  lui       $at, %hi(gHudElementCacheTableRaster)
/* D7848 80141148 AC2212C8 */  sw        $v0, %lo(gHudElementCacheTableRaster)($at)
/* D784C 8014114C 3C028015 */  lui       $v0, %hi(gHudElementCacheTablePaletteWorld)
/* D7850 80141150 24427F70 */  addiu     $v0, $v0, %lo(gHudElementCacheTablePaletteWorld)
/* D7854 80141154 08050465 */  j         .L80141194
/* D7858 80141158 00000000 */   nop
.L8014115C:
/* D785C 8014115C 3C028015 */  lui       $v0, %hi(gHudElementsBattle)
/* D7860 80141160 24427460 */  addiu     $v0, $v0, %lo(gHudElementsBattle)
/* D7864 80141164 3C018015 */  lui       $at, %hi(gHudElements)
/* D7868 80141168 AC227960 */  sw        $v0, %lo(gHudElements)($at)
/* D786C 8014116C 3C028016 */  lui       $v0, %hi(gHudElementCacheSizeBattle)
/* D7870 80141170 24428574 */  addiu     $v0, $v0, %lo(gHudElementCacheSizeBattle)
/* D7874 80141174 3C018015 */  lui       $at, %hi(gHudElementCacheSize)
/* D7878 80141178 AC22133C */  sw        $v0, %lo(gHudElementCacheSize)($at)
/* D787C 8014117C 3C028016 */  lui       $v0, %hi(gHudElementCacheTableRasterBattle)
/* D7880 80141180 24428580 */  addiu     $v0, $v0, %lo(gHudElementCacheTableRasterBattle)
/* D7884 80141184 3C018015 */  lui       $at, %hi(gHudElementCacheTableRaster)
/* D7888 80141188 AC2212C8 */  sw        $v0, %lo(gHudElementCacheTableRaster)($at)
/* D788C 8014118C 3C028016 */  lui       $v0, %hi(gHudElementCacheTablePaletteBattle)
/* D7890 80141190 24428B80 */  addiu     $v0, $v0, %lo(gHudElementCacheTablePaletteBattle)
.L80141194:
/* D7894 80141194 3C018015 */  lui       $at, %hi(gHudElementCacheTablePalette)
/* D7898 80141198 AC2212D0 */  sw        $v0, %lo(gHudElementCacheTablePalette)($at)
/* D789C 8014119C 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* D78A0 801411A0 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* D78A4 801411A4 80420070 */  lb        $v0, 0x70($v0)
/* D78A8 801411A8 1440001F */  bnez      $v0, .L80141228
/* D78AC 801411AC 00000000 */   nop
/* D78B0 801411B0 3C048015 */  lui       $a0, %hi(gHudElementCacheCapacity)
/* D78B4 801411B4 0C00AB0A */  jal       general_heap_malloc
/* D78B8 801411B8 8C84EFC4 */   lw       $a0, %lo(gHudElementCacheCapacity)($a0)
/* D78BC 801411BC 3C018015 */  lui       $at, %hi(gHudElementCacheBuffer)
/* D78C0 801411C0 AC221314 */  sw        $v0, %lo(gHudElementCacheBuffer)($at)
/* D78C4 801411C4 14400003 */  bnez      $v0, .L801411D4
/* D78C8 801411C8 0000202D */   daddu    $a0, $zero, $zero
.L801411CC:
/* D78CC 801411CC 08050473 */  j         .L801411CC
/* D78D0 801411D0 00000000 */   nop
.L801411D4:
/* D78D4 801411D4 3C028015 */  lui       $v0, %hi(gHudElementCacheBuffer)
/* D78D8 801411D8 8C421314 */  lw        $v0, %lo(gHudElementCacheBuffer)($v0)
/* D78DC 801411DC 3C038015 */  lui       $v1, %hi(gHudElementCacheSize)
/* D78E0 801411E0 8C63133C */  lw        $v1, %lo(gHudElementCacheSize)($v1)
/* D78E4 801411E4 2406FFFF */  addiu     $a2, $zero, -0x1
/* D78E8 801411E8 3C018015 */  lui       $at, %hi(gHudElementCacheBufferWorld)
/* D78EC 801411EC AC227964 */  sw        $v0, %lo(gHudElementCacheBufferWorld)($at)
/* D78F0 801411F0 AC600000 */  sw        $zero, 0x0($v1)
/* D78F4 801411F4 3C058015 */  lui       $a1, %hi(gHudElementCacheTablePalette)
/* D78F8 801411F8 8CA512D0 */  lw        $a1, %lo(gHudElementCacheTablePalette)($a1)
/* D78FC 801411FC 3C038015 */  lui       $v1, %hi(gHudElementCacheTableRaster)
/* D7900 80141200 8C6312C8 */  lw        $v1, %lo(gHudElementCacheTableRaster)($v1)
.L80141204:
/* D7904 80141204 AC660000 */  sw        $a2, 0x0($v1)
/* D7908 80141208 ACA60000 */  sw        $a2, 0x0($a1)
/* D790C 8014120C 24A50008 */  addiu     $a1, $a1, 0x8
/* D7910 80141210 24840001 */  addiu     $a0, $a0, 0x1
/* D7914 80141214 288200C0 */  slti      $v0, $a0, 0xC0
/* D7918 80141218 1440FFFA */  bnez      $v0, .L80141204
/* D791C 8014121C 24630008 */   addiu    $v1, $v1, 0x8
/* D7920 80141220 080504AF */  j         .L801412BC
/* D7924 80141224 00000000 */   nop
.L80141228:
/* D7928 80141228 3C028015 */  lui       $v0, %hi(gHudElementAuxCache)
/* D792C 8014122C 8C42EFC0 */  lw        $v0, %lo(gHudElementAuxCache)($v0)
/* D7930 80141230 5440000D */  bnel      $v0, $zero, .L80141268
/* D7934 80141234 0000202D */   daddu    $a0, $zero, $zero
/* D7938 80141238 3C048015 */  lui       $a0, %hi(gHudElementCacheCapacity)
/* D793C 8014123C 8C84EFC4 */  lw        $a0, %lo(gHudElementCacheCapacity)($a0)
/* D7940 80141240 000417C2 */  srl       $v0, $a0, 31
/* D7944 80141244 00822021 */  addu      $a0, $a0, $v0
/* D7948 80141248 0C00AB0A */  jal       general_heap_malloc
/* D794C 8014124C 00042043 */   sra      $a0, $a0, 1
/* D7950 80141250 3C018015 */  lui       $at, %hi(gHudElementCacheBuffer)
/* D7954 80141254 AC221314 */  sw        $v0, %lo(gHudElementCacheBuffer)($at)
/* D7958 80141258 54400005 */  bnel      $v0, $zero, .L80141270
/* D795C 8014125C 0000202D */   daddu    $a0, $zero, $zero
.L80141260:
/* D7960 80141260 08050498 */  j         .L80141260
/* D7964 80141264 00000000 */   nop
.L80141268:
/* D7968 80141268 3C018015 */  lui       $at, %hi(gHudElementCacheBuffer)
/* D796C 8014126C AC221314 */  sw        $v0, %lo(gHudElementCacheBuffer)($at)
.L80141270:
/* D7970 80141270 3C028015 */  lui       $v0, %hi(gHudElementCacheBuffer)
/* D7974 80141274 8C421314 */  lw        $v0, %lo(gHudElementCacheBuffer)($v0)
/* D7978 80141278 3C038015 */  lui       $v1, %hi(gHudElementCacheSize)
/* D797C 8014127C 8C63133C */  lw        $v1, %lo(gHudElementCacheSize)($v1)
/* D7980 80141280 2406FFFF */  addiu     $a2, $zero, -0x1
/* D7984 80141284 3C018016 */  lui       $at, %hi(gHudElementCacheBufferBattle)
/* D7988 80141288 AC228570 */  sw        $v0, %lo(gHudElementCacheBufferBattle)($at)
/* D798C 8014128C AC600000 */  sw        $zero, 0x0($v1)
/* D7990 80141290 3C058015 */  lui       $a1, %hi(gHudElementCacheTablePalette)
/* D7994 80141294 8CA512D0 */  lw        $a1, %lo(gHudElementCacheTablePalette)($a1)
/* D7998 80141298 3C038015 */  lui       $v1, %hi(gHudElementCacheTableRaster)
/* D799C 8014129C 8C6312C8 */  lw        $v1, %lo(gHudElementCacheTableRaster)($v1)
.L801412A0:
/* D79A0 801412A0 AC660000 */  sw        $a2, 0x0($v1)
/* D79A4 801412A4 ACA60000 */  sw        $a2, 0x0($a1)
/* D79A8 801412A8 24A50008 */  addiu     $a1, $a1, 0x8
/* D79AC 801412AC 24840001 */  addiu     $a0, $a0, 0x1
/* D79B0 801412B0 288200C0 */  slti      $v0, $a0, 0xC0
/* D79B4 801412B4 1440FFFA */  bnez      $v0, .L801412A0
/* D79B8 801412B8 24630008 */   addiu    $v1, $v1, 0x8
.L801412BC:
/* D79BC 801412BC 3C028015 */  lui       $v0, %hi(gHudElements)
/* D79C0 801412C0 8C427960 */  lw        $v0, %lo(gHudElements)($v0)
/* D79C4 801412C4 2404013F */  addiu     $a0, $zero, 0x13F
/* D79C8 801412C8 244204FC */  addiu     $v0, $v0, 0x4FC
.L801412CC:
/* D79CC 801412CC AC400000 */  sw        $zero, 0x0($v0)
/* D79D0 801412D0 2484FFFF */  addiu     $a0, $a0, -0x1
/* D79D4 801412D4 0481FFFD */  bgez      $a0, .L801412CC
/* D79D8 801412D8 2442FFFC */   addiu    $v0, $v0, -0x4
/* D79DC 801412DC 3C018015 */  lui       $at, %hi(gHudElementsNumber)
/* D79E0 801412E0 AC2012B4 */  sw        $zero, %lo(gHudElementsNumber)($at)
/* D79E4 801412E4 3C018016 */  lui       $at, %hi(D_80159180)
/* D79E8 801412E8 AC209180 */  sw        $zero, %lo(D_80159180)($at)
/* D79EC 801412EC 0C0504FE */  jal       func_801413F8
/* D79F0 801412F0 00000000 */   nop
/* D79F4 801412F4 8FBF0010 */  lw        $ra, 0x10($sp)
/* D79F8 801412F8 03E00008 */  jr        $ra
/* D79FC 801412FC 27BD0018 */   addiu    $sp, $sp, 0x18

### DECOMPILED C INSTRUCTIONS:

void hud_element_clear_cache(void) {
    s32 i;
    HudCacheEntry* entryRaster;
    HudCacheEntry* entryPalette;

    if (!gGameStatusPtr->isBattle) {
        gHudElements = &gHudElementsWorld;
        gHudElementCacheSize = &gHudElementCacheSizeWorld;
        gHudElementCacheTableRaster = gHudElementCacheTableRasterWorld;
        gHudElementCacheTablePalette = gHudElementCacheTablePaletteWorld;
    } else {
        gHudElements = &gHudElementsBattle;
        gHudElementCacheSize = &gHudElementCacheSizeBattle;
        gHudElementCacheTableRaster = gHudElementCacheTableRasterBattle;
        gHudElementCacheTablePalette = gHudElementCacheTablePaletteBattle;
    }

    if (!gGameStatusPtr->isBattle) {
        gHudElementCacheBuffer = general_heap_malloc(gHudElementCacheCapacity);
        ASSERT(gHudElementCacheBuffer);
        gHudElementCacheBufferWorld = gHudElementCacheBuffer;
        *gHudElementCacheSize = 0;
        entryRaster = gHudElementCacheTableRaster;
        entryPalette = gHudElementCacheTablePalette;
        for (i = 0; i < MAX_HUD_CACHE_ENTRIES; i++) {
            entryRaster[i].id = -1;
            entryPalette[i].id = -1;
        }
    } else {
        if (gHudElementAuxCache == NULL) {
            gHudElementCacheBuffer = general_heap_malloc(gHudElementCacheCapacity / 2);
            ASSERT(gHudElementCacheBuffer);
        } else {
            gHudElementCacheBuffer = gHudElementAuxCache;
        }
        gHudElementCacheBufferBattle = gHudElementCacheBuffer;
        *gHudElementCacheSize = 0;
        entryRaster = gHudElementCacheTableRaster;
        entryPalette = gHudElementCacheTablePalette;
        for (i = 0; i < MAX_HUD_CACHE_ENTRIES; i++) {
            entryRaster[i].id = -1;
            entryPalette[i].id = -1;
        }
    }

    for (i = 0; i < ARRAY_COUNT(*gHudElements); i++) {
        (*gHudElements)[i] = NULL;
    }

    gHudElementsNumber = 0;
    D_80159180 = 0;
    func_801413F8();
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_80244550
/* A2E790 80244550 27BDFFB8 */  addiu     $sp, $sp, -0x48
/* A2E794 80244554 AFB60028 */  sw        $s6, 0x28($sp)
/* A2E798 80244558 0080B02D */  daddu     $s6, $a0, $zero
.L8024455C:
/* A2E79C 8024455C AFB00010 */  sw        $s0, 0x10($sp)
D_80244560:
/* A2E7A0 80244560 00A0802D */  daddu     $s0, $a1, $zero
/* A2E7A4 80244564 AFBF002C */  sw        $ra, 0x2C($sp)
/* A2E7A8 80244568 AFB50024 */  sw        $s5, 0x24($sp)
.L8024456C:
/* A2E7AC 8024456C AFB40020 */  sw        $s4, 0x20($sp)
/* A2E7B0 80244570 AFB3001C */  sw        $s3, 0x1C($sp)
/* A2E7B4 80244574 AFB20018 */  sw        $s2, 0x18($sp)
D_80244578:
/* A2E7B8 80244578 AFB10014 */  sw        $s1, 0x14($sp)
/* A2E7BC 8024457C F7B80040 */  sdc1      $f24, 0x40($sp)
/* A2E7C0 80244580 F7B60038 */  sdc1      $f22, 0x38($sp)
/* A2E7C4 80244584 F7B40030 */  sdc1      $f20, 0x30($sp)
/* A2E7C8 80244588 0C0B36B0 */  jal       resolve_npc
/* A2E7CC 8024458C 24050009 */   addiu    $a1, $zero, 0x9
D_80244590:
/* A2E7D0 80244590 02C0202D */  daddu     $a0, $s6, $zero
/* A2E7D4 80244594 3C05F4AC */  lui       $a1, (0xF4ACD480 >> 16)
/* A2E7D8 80244598 34A5D480 */  ori       $a1, $a1, (0xF4ACD480 & 0xFFFF)
D_8024459C:
/* A2E7DC 8024459C 0C0B1EAF */  jal       evt_get_variable
.L802445A0:
/* A2E7E0 802445A0 0040A02D */   daddu    $s4, $v0, $zero
D_802445A4:
/* A2E7E4 802445A4 1200002B */  beqz      $s0, D_80244654
D_802445A8:
/* A2E7E8 802445A8 0040A82D */   daddu    $s5, $v0, $zero
/* A2E7EC 802445AC 0000802D */  daddu     $s0, $zero, $zero
/* A2E7F0 802445B0 3C138025 */  lui       $s3, %hi(D_8024F358)
/* A2E7F4 802445B4 2673F358 */  addiu     $s3, $s3, %lo(D_8024F358)
/* A2E7F8 802445B8 3C128025 */  lui       $s2, %hi(D_8024F338)
/* A2E7FC 802445BC 2652F338 */  addiu     $s2, $s2, %lo(D_8024F338)
D_802445C0:
/* A2E800 802445C0 C6800038 */  lwc1      $f0, 0x38($s4)
.L802445C4:
/* A2E804 802445C4 C682003C */  lwc1      $f2, 0x3C($s4)
jtbl_802445C8:
/* A2E808 802445C8 C6840040 */  lwc1      $f4, 0x40($s4)
/* A2E80C 802445CC 3C118025 */  lui       $s1, %hi(D_8024F318)
D_802445D0:
/* A2E810 802445D0 2631F318 */  addiu     $s1, $s1, %lo(D_8024F318)
D_802445D4:
/* A2E814 802445D4 3C018025 */  lui       $at, %hi(D_8024F2FC)
.L802445D8:
/* A2E818 802445D8 E420F2FC */  swc1      $f0, %lo(D_8024F2FC)($at)
/* A2E81C 802445DC 3C018025 */  lui       $at, %hi(D_8024F300)
/* A2E820 802445E0 E422F300 */  swc1      $f2, %lo(D_8024F300)($at)
.L802445E4:
/* A2E824 802445E4 3C018025 */  lui       $at, %hi(D_8024F304)
/* A2E828 802445E8 E424F304 */  swc1      $f4, %lo(D_8024F304)($at)
.L802445EC:
/* A2E82C 802445EC 02C0202D */  daddu     $a0, $s6, $zero
D_802445F0:
/* A2E830 802445F0 0C0B36B0 */  jal       resolve_npc
/* A2E834 802445F4 0200282D */   daddu    $a1, $s0, $zero
D_802445F8:
/* A2E838 802445F8 C4400038 */  lwc1      $f0, 0x38($v0)
D_802445FC:
/* A2E83C 802445FC 26100001 */  addiu     $s0, $s0, 0x1
D_80244600:
/* A2E840 80244600 E6200000 */  swc1      $f0, 0x0($s1)
D_80244604:
/* A2E844 80244604 C440003C */  lwc1      $f0, 0x3C($v0)
/* A2E848 80244608 26310004 */  addiu     $s1, $s1, 0x4
/* A2E84C 8024460C E6400000 */  swc1      $f0, 0x0($s2)
D_80244610:
/* A2E850 80244610 26520004 */  addiu     $s2, $s2, 0x4
/* A2E854 80244614 C4400040 */  lwc1      $f0, 0x40($v0)
/* A2E858 80244618 2A020007 */  slti      $v0, $s0, 0x7
.L8024461C:
/* A2E85C 8024461C E6600000 */  swc1      $f0, 0x0($s3)
D_80244620:
/* A2E860 80244620 1440FFF2 */  bnez      $v0, .L802445EC
/* A2E864 80244624 26730004 */   addiu    $s3, $s3, 0x4
D_80244628:
/* A2E868 80244628 8EA2000C */  lw        $v0, 0xC($s5)
D_8024462C_EEABDC:
/* A2E86C 8024462C 0040182D */  daddu     $v1, $v0, $zero
D_80244630_EEABE0:
/* A2E870 80244630 C4440004 */  lwc1      $f4, 0x4($v0)
/* A2E874 80244634 C4400008 */  lwc1      $f0, 0x8($v0)
jtbl_80244638:
/* A2E878 80244638 C462000C */  lwc1      $f2, 0xC($v1)
/* A2E87C 8024463C 3C018025 */  lui       $at, %hi(D_8024F308)
.L80244640:
/* A2E880 80244640 E424F308 */  swc1      $f4, %lo(D_8024F308)($at)
D_80244644:
/* A2E884 80244644 3C018025 */  lui       $at, %hi(D_8024F30C)
/* A2E888 80244648 E420F30C */  swc1      $f0, %lo(D_8024F30C)($at)
/* A2E88C 8024464C 3C018025 */  lui       $at, %hi(D_8024F310)
/* A2E890 80244650 E422F310 */  swc1      $f2, %lo(D_8024F310)($at)
D_80244654:
/* A2E894 80244654 0000802D */  daddu     $s0, $zero, $zero
.L80244658:
/* A2E898 80244658 C6820038 */  lwc1      $f2, 0x38($s4)
D_8024465C:
/* A2E89C 8024465C 3C018025 */  lui       $at, %hi(D_8024F2FC)
/* A2E8A0 80244660 C420F2FC */  lwc1      $f0, %lo(D_8024F2FC)($at)
/* A2E8A4 80244664 3C138025 */  lui       $s3, %hi(D_8024F358)
/* A2E8A8 80244668 2673F358 */  addiu     $s3, $s3, %lo(D_8024F358)
/* A2E8AC 8024466C 46001501 */  sub.s     $f20, $f2, $f0
.L80244670:
/* A2E8B0 80244670 C682003C */  lwc1      $f2, 0x3C($s4)
.L80244674:
/* A2E8B4 80244674 3C018025 */  lui       $at, %hi(D_8024F300)
jtbl_80244678:
/* A2E8B8 80244678 C420F300 */  lwc1      $f0, %lo(D_8024F300)($at)
/* A2E8BC 8024467C 3C128025 */  lui       $s2, %hi(D_8024F338)
D_80244680:
/* A2E8C0 80244680 2652F338 */  addiu     $s2, $s2, %lo(D_8024F338)
/* A2E8C4 80244684 46001581 */  sub.s     $f22, $f2, $f0
D_80244688:
/* A2E8C8 80244688 C6820040 */  lwc1      $f2, 0x40($s4)
D_8024468C:
/* A2E8CC 8024468C 3C018025 */  lui       $at, %hi(D_8024F304)
/* A2E8D0 80244690 C420F304 */  lwc1      $f0, %lo(D_8024F304)($at)
/* A2E8D4 80244694 3C118025 */  lui       $s1, %hi(D_8024F318)
D_80244698:
/* A2E8D8 80244698 2631F318 */  addiu     $s1, $s1, %lo(D_8024F318)
/* A2E8DC 8024469C 46001601 */  sub.s     $f24, $f2, $f0
.L802446A0:
/* A2E8E0 802446A0 02C0202D */  daddu     $a0, $s6, $zero
.L802446A4:
/* A2E8E4 802446A4 0C0B36B0 */  jal       resolve_npc
/* A2E8E8 802446A8 0200282D */   daddu    $a1, $s0, $zero
D_802446AC:
/* A2E8EC 802446AC C6200000 */  lwc1      $f0, 0x0($s1)
.L802446B0:
/* A2E8F0 802446B0 46140000 */  add.s     $f0, $f0, $f20
/* A2E8F4 802446B4 E4400038 */  swc1      $f0, 0x38($v0)
/* A2E8F8 802446B8 C6400000 */  lwc1      $f0, 0x0($s2)
D_802446BC:
/* A2E8FC 802446BC 46160000 */  add.s     $f0, $f0, $f22
D_802446C0:
/* A2E900 802446C0 26100001 */  addiu     $s0, $s0, 0x1
/* A2E904 802446C4 E440003C */  swc1      $f0, 0x3C($v0)
.L802446C8:
/* A2E908 802446C8 C6600000 */  lwc1      $f0, 0x0($s3)
.L802446CC:
/* A2E90C 802446CC 26310004 */  addiu     $s1, $s1, 0x4
/* A2E910 802446D0 46180000 */  add.s     $f0, $f0, $f24
.L802446D4:
/* A2E914 802446D4 C442003C */  lwc1      $f2, 0x3C($v0)
D_802446D8:
/* A2E918 802446D8 26520004 */  addiu     $s2, $s2, 0x4
/* A2E91C 802446DC E4400040 */  swc1      $f0, 0x40($v0)
glabel func_802446E0
/* A2E920 802446E0 C4400038 */  lwc1      $f0, 0x38($v0)
/* A2E924 802446E4 C4440040 */  lwc1      $f4, 0x40($v0)
/* A2E928 802446E8 E4420070 */  swc1      $f2, 0x70($v0)
/* A2E92C 802446EC E440006C */  swc1      $f0, 0x6C($v0)
/* A2E930 802446F0 E4440074 */  swc1      $f4, 0x74($v0)
/* A2E934 802446F4 2A020007 */  slti      $v0, $s0, 0x7
/* A2E938 802446F8 1440FFE9 */  bnez      $v0, .L802446A0
/* A2E93C 802446FC 26730004 */   addiu    $s3, $s3, 0x4
jtbl_80244700:
/* A2E940 80244700 3C018025 */  lui       $at, %hi(D_8024F308)
D_80244704:
/* A2E944 80244704 C420F308 */  lwc1      $f0, %lo(D_8024F308)($at)
glabel func_80244708
/* A2E948 80244708 46140000 */  add.s     $f0, $f0, $f20
/* A2E94C 8024470C 3C018025 */  lui       $at, %hi(D_8024F30C)
glabel func_80244710
/* A2E950 80244710 C422F30C */  lwc1      $f2, %lo(D_8024F30C)($at)
/* A2E954 80244714 8EA2000C */  lw        $v0, 0xC($s5)
D_80244718:
/* A2E958 80244718 46161080 */  add.s     $f2, $f2, $f22
/* A2E95C 8024471C E4400004 */  swc1      $f0, 0x4($v0)
jtbl_80244720:
/* A2E960 80244720 3C018025 */  lui       $at, %hi(D_8024F310)
.L80244724:
/* A2E964 80244724 C420F310 */  lwc1      $f0, %lo(D_8024F310)($at)
/* A2E968 80244728 8EA2000C */  lw        $v0, 0xC($s5)
/* A2E96C 8024472C 46180000 */  add.s     $f0, $f0, $f24
/* A2E970 80244730 E4420008 */  swc1      $f2, 0x8($v0)
flo_25_pad_4734:
/* A2E974 80244734 8EA3000C */  lw        $v1, 0xC($s5)
D_80244738:
/* A2E978 80244738 E460000C */  swc1      $f0, 0xC($v1)
D_8024473C:
/* A2E97C 8024473C 8FBF002C */  lw        $ra, 0x2C($sp)
D_80244740:
/* A2E980 80244740 8FB60028 */  lw        $s6, 0x28($sp)
/* A2E984 80244744 8FB50024 */  lw        $s5, 0x24($sp)
/* A2E988 80244748 8FB40020 */  lw        $s4, 0x20($sp)
/* A2E98C 8024474C 8FB3001C */  lw        $s3, 0x1C($sp)
D_80244750:
/* A2E990 80244750 8FB20018 */  lw        $s2, 0x18($sp)
/* A2E994 80244754 8FB10014 */  lw        $s1, 0x14($sp)
D_80244758:
/* A2E998 80244758 8FB00010 */  lw        $s0, 0x10($sp)
.L8024475C:
/* A2E99C 8024475C D7B80040 */  ldc1      $f24, 0x40($sp)
/* A2E9A0 80244760 D7B60038 */  ldc1      $f22, 0x38($sp)
/* A2E9A4 80244764 D7B40030 */  ldc1      $f20, 0x30($sp)
/* A2E9A8 80244768 0000102D */  daddu     $v0, $zero, $zero
D_8024476C:
/* A2E9AC 8024476C 03E00008 */  jr        $ra
/* A2E9B0 80244770 27BD0048 */   addiu    $sp, $sp, 0x48

### DECOMPILED C INSTRUCTIONS:

API_CALLABLE(func_80244550_A2E790) {
    Npc* kammy = resolve_npc(script, NPC_Kammy);
    EffectInstance* effect = (EffectInstance*) evt_get_variable(script, ArrayVar(0));
    Npc* npc2;
    f32 x, y, z;
    f32* x2;
    f32* y2;
    f32* z2;
    s32 i;

    if (isInitialCall) {
        N(D_8024F2FC) = kammy->pos.x;
        N(D_8024F300) = kammy->pos.y;
        N(D_8024F304) = kammy->pos.z;

        for (i = NPC_Eldstar; i < ARRAY_COUNT(N(StarSpiritsPosX)); i++) {
            npc2 = resolve_npc(script, i);

            N(StarSpiritsPosX)[i] = npc2->pos.x;
            N(StarSpiritsPosY)[i] = npc2->pos.y;
            N(StarSpiritsPosZ)[i] = npc2->pos.z;
        }
        N(D_8024F308) = effect->data.somethingRotating->pos.x;
        N(D_8024F30C) = effect->data.somethingRotating->pos.y;
        N(D_8024F310) = effect->data.somethingRotating->pos.z;
    }

    x = kammy->pos.x - N(D_8024F2FC);
    y = kammy->pos.y - N(D_8024F300);
    z = kammy->pos.z - N(D_8024F304);

    i = 0;
    z2 = N(StarSpiritsPosZ);
    y2 = N(StarSpiritsPosY);
    x2 = N(StarSpiritsPosX);
    for (; i < ARRAY_COUNT(N(StarSpiritsPosX)); ) {
        npc2 = resolve_npc(script, i);
        i++;
        npc2->pos.x = *x2++ + x;
        npc2->pos.y = *y2++ + y;
        npc2->pos.z = *z2++ + z;

        npc2->colliderPos.x = npc2->pos.x;
        npc2->colliderPos.y = npc2->pos.y;
        npc2->colliderPos.z = npc2->pos.z;
    }

    effect->data.somethingRotating->pos.x = N(D_8024F308) + x;
    effect->data.somethingRotating->pos.y = N(D_8024F30C) + y;
    effect->data.somethingRotating->pos.z = N(D_8024F310) + z;
    return ApiStatus_BLOCK;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel load_model_transforms
/* B14C8 8011ADC8 27BDFF00 */  addiu     $sp, $sp, -0x100
/* B14CC 8011ADCC AFB100E4 */  sw        $s1, 0xE4($sp)
/* B14D0 8011ADD0 0080882D */  daddu     $s1, $a0, $zero
/* B14D4 8011ADD4 AFB500F4 */  sw        $s5, 0xF4($sp)
/* B14D8 8011ADD8 00A0A82D */  daddu     $s5, $a1, $zero
/* B14DC 8011ADDC AFB300EC */  sw        $s3, 0xEC($sp)
/* B14E0 8011ADE0 00C0982D */  daddu     $s3, $a2, $zero
/* B14E4 8011ADE4 AFB400F0 */  sw        $s4, 0xF0($sp)
/* B14E8 8011ADE8 00E0A02D */  daddu     $s4, $a3, $zero
/* B14EC 8011ADEC AFBF00F8 */  sw        $ra, 0xF8($sp)
/* B14F0 8011ADF0 AFB200E8 */  sw        $s2, 0xE8($sp)
/* B14F4 8011ADF4 AFB000E0 */  sw        $s0, 0xE0($sp)
/* B14F8 8011ADF8 8E250010 */  lw        $a1, 0x10($s1)
/* B14FC 8011ADFC 10A00041 */  beqz      $a1, .L8011AF04
/* B1500 8011AE00 27B20090 */   addiu    $s2, $sp, 0x90
/* B1504 8011AE04 8CA2000C */  lw        $v0, 0xC($a1)
/* B1508 8011AE08 5040003F */  beql      $v0, $zero, .L8011AF08
/* B150C 8011AE0C 0260202D */   daddu    $a0, $s3, $zero
/* B1510 8011AE10 8CA50000 */  lw        $a1, 0x0($a1)
/* B1514 8011AE14 10A00007 */  beqz      $a1, .L8011AE34
/* B1518 8011AE18 27B000A0 */   addiu    $s0, $sp, 0xA0
/* B151C 8011AE1C 0C019D60 */  jal       guMtxL2F
/* B1520 8011AE20 0200202D */   daddu    $a0, $s0, $zero
/* B1524 8011AE24 0200202D */  daddu     $a0, $s0, $zero
/* B1528 8011AE28 0260282D */  daddu     $a1, $s3, $zero
/* B152C 8011AE2C 0C019D80 */  jal       guMtxCatF
/* B1530 8011AE30 27A60010 */   addiu    $a2, $sp, 0x10
.L8011AE34:
/* B1534 8011AE34 0220202D */  daddu     $a0, $s1, $zero
/* B1538 8011AE38 0C0456C3 */  jal       get_model_property
/* B153C 8011AE3C 24050060 */   addiu    $a1, $zero, 0x60
/* B1540 8011AE40 10400002 */  beqz      $v0, .L8011AE4C
/* B1544 8011AE44 0000202D */   daddu    $a0, $zero, $zero
/* B1548 8011AE48 8C440008 */  lw        $a0, 0x8($v0)
.L8011AE4C:
/* B154C 8011AE4C 8E230000 */  lw        $v1, 0x0($s1)
/* B1550 8011AE50 24020005 */  addiu     $v0, $zero, 0x5
/* B1554 8011AE54 14620003 */  bne       $v1, $v0, .L8011AE64
/* B1558 8011AE58 00000000 */   nop
/* B155C 8011AE5C 1480002A */  bnez      $a0, .L8011AF08
/* B1560 8011AE60 0260202D */   daddu    $a0, $s3, $zero
.L8011AE64:
/* B1564 8011AE64 8E240010 */  lw        $a0, 0x10($s1)
/* B1568 8011AE68 8C82000C */  lw        $v0, 0xC($a0)
/* B156C 8011AE6C 18400012 */  blez      $v0, .L8011AEB8
/* B1570 8011AE70 0000802D */   daddu    $s0, $zero, $zero
/* B1574 8011AE74 0260302D */  daddu     $a2, $s3, $zero
.L8011AE78:
/* B1578 8011AE78 00101080 */  sll       $v0, $s0, 2
/* B157C 8011AE7C 8C830010 */  lw        $v1, 0x10($a0)
/* B1580 8011AE80 8C840000 */  lw        $a0, 0x0($a0)
/* B1584 8011AE84 10800002 */  beqz      $a0, .L8011AE90
/* B1588 8011AE88 00431021 */   addu     $v0, $v0, $v1
/* B158C 8011AE8C 27A60010 */  addiu     $a2, $sp, 0x10
.L8011AE90:
/* B1590 8011AE90 0220282D */  daddu     $a1, $s1, $zero
/* B1594 8011AE94 8C440000 */  lw        $a0, 0x0($v0)
/* B1598 8011AE98 0C046B72 */  jal       load_model_transforms
/* B159C 8011AE9C 26870001 */   addiu    $a3, $s4, 0x1
/* B15A0 8011AEA0 8E240010 */  lw        $a0, 0x10($s1)
/* B15A4 8011AEA4 8C82000C */  lw        $v0, 0xC($a0)
/* B15A8 8011AEA8 26100001 */  addiu     $s0, $s0, 0x1
/* B15AC 8011AEAC 0202102A */  slt       $v0, $s0, $v0
/* B15B0 8011AEB0 1440FFF1 */  bnez      $v0, .L8011AE78
/* B15B4 8011AEB4 0260302D */   daddu    $a2, $s3, $zero
.L8011AEB8:
/* B15B8 8011AEB8 3C048015 */  lui       $a0, %hi(mdl_treeIterPos)
/* B15BC 8011AEBC 24843224 */  addiu     $a0, $a0, %lo(mdl_treeIterPos)
/* B15C0 8011AEC0 3C05800A */  lui       $a1, %hi(mdl_currentModelTreeNodeInfo)
/* B15C4 8011AEC4 24A5A5F4 */  addiu     $a1, $a1, %lo(mdl_currentModelTreeNodeInfo)
/* B15C8 8011AEC8 8C820000 */  lw        $v0, 0x0($a0)
/* B15CC 8011AECC 8CA30000 */  lw        $v1, 0x0($a1)
/* B15D0 8011AED0 00021080 */  sll       $v0, $v0, 2
/* B15D4 8011AED4 00431021 */  addu      $v0, $v0, $v1
/* B15D8 8011AED8 240300FF */  addiu     $v1, $zero, 0xFF
/* B15DC 8011AEDC A0430000 */  sb        $v1, 0x0($v0)
/* B15E0 8011AEE0 8C820000 */  lw        $v0, 0x0($a0)
/* B15E4 8011AEE4 8CA30000 */  lw        $v1, 0x0($a1)
/* B15E8 8011AEE8 00021080 */  sll       $v0, $v0, 2
/* B15EC 8011AEEC 00431021 */  addu      $v0, $v0, $v1
/* B15F0 8011AEF0 A0540001 */  sb        $s4, 0x1($v0)
/* B15F4 8011AEF4 8C820000 */  lw        $v0, 0x0($a0)
/* B15F8 8011AEF8 24420001 */  addiu     $v0, $v0, 0x1
/* B15FC 8011AEFC 08046BFB */  j         .L8011AFEC
/* B1600 8011AF00 AC820000 */   sw       $v0, 0x0($a0)
.L8011AF04:
/* B1604 8011AF04 0260202D */  daddu     $a0, $s3, $zero
.L8011AF08:
/* B1608 8011AF08 27B00050 */  addiu     $s0, $sp, 0x50
/* B160C 8011AF0C 0C019D40 */  jal       guMtxF2L
/* B1610 8011AF10 0200282D */   daddu    $a1, $s0, $zero
/* B1614 8011AF14 A6400000 */  sh        $zero, 0x0($s2)
/* B1618 8011AF18 AE510004 */  sw        $s1, 0x4($s2)
/* B161C 8011AF1C 8EA20010 */  lw        $v0, 0x10($s5)
/* B1620 8011AF20 AE50000C */  sw        $s0, 0xC($s2)
/* B1624 8011AF24 AE420008 */  sw        $v0, 0x8($s2)
/* B1628 8011AF28 8E230000 */  lw        $v1, 0x0($s1)
/* B162C 8011AF2C 24020005 */  addiu     $v0, $zero, 0x5
/* B1630 8011AF30 14620021 */  bne       $v1, $v0, .L8011AFB8
/* B1634 8011AF34 0240202D */   daddu    $a0, $s2, $zero
/* B1638 8011AF38 0C04572A */  jal       mdl_get_child_count
/* B163C 8011AF3C 0220202D */   daddu    $a0, $s1, $zero
/* B1640 8011AF40 3C078015 */  lui       $a3, %hi(mdl_treeIterPos)
/* B1644 8011AF44 24E73224 */  addiu     $a3, $a3, %lo(mdl_treeIterPos)
/* B1648 8011AF48 8CF00000 */  lw        $s0, 0x0($a3)
/* B164C 8011AF4C 0040202D */  daddu     $a0, $v0, $zero
/* B1650 8011AF50 02041021 */  addu      $v0, $s0, $a0
/* B1654 8011AF54 0202102A */  slt       $v0, $s0, $v0
/* B1658 8011AF58 10400011 */  beqz      $v0, .L8011AFA0
/* B165C 8011AF5C 240800FF */   addiu    $t0, $zero, 0xFF
/* B1660 8011AF60 3C05800A */  lui       $a1, %hi(mdl_currentModelTreeNodeInfo)
/* B1664 8011AF64 24A5A5F4 */  addiu     $a1, $a1, %lo(mdl_currentModelTreeNodeInfo)
/* B1668 8011AF68 26860001 */  addiu     $a2, $s4, 0x1
.L8011AF6C:
/* B166C 8011AF6C 8CA20000 */  lw        $v0, 0x0($a1)
/* B1670 8011AF70 00101880 */  sll       $v1, $s0, 2
/* B1674 8011AF74 00621021 */  addu      $v0, $v1, $v0
/* B1678 8011AF78 A0480000 */  sb        $t0, 0x0($v0)
/* B167C 8011AF7C 8CA20000 */  lw        $v0, 0x0($a1)
/* B1680 8011AF80 00621821 */  addu      $v1, $v1, $v0
/* B1684 8011AF84 A0660001 */  sb        $a2, 0x1($v1)
/* B1688 8011AF88 8CE20000 */  lw        $v0, 0x0($a3)
/* B168C 8011AF8C 26100001 */  addiu     $s0, $s0, 0x1
/* B1690 8011AF90 00441021 */  addu      $v0, $v0, $a0
/* B1694 8011AF94 0202102A */  slt       $v0, $s0, $v0
/* B1698 8011AF98 1440FFF4 */  bnez      $v0, .L8011AF6C
/* B169C 8011AF9C 00000000 */   nop
.L8011AFA0:
/* B16A0 8011AFA0 3C038015 */  lui       $v1, %hi(mdl_treeIterPos)
/* B16A4 8011AFA4 24633224 */  addiu     $v1, $v1, %lo(mdl_treeIterPos)
/* B16A8 8011AFA8 8C620000 */  lw        $v0, 0x0($v1)
/* B16AC 8011AFAC 00441021 */  addu      $v0, $v0, $a0
/* B16B0 8011AFB0 AC620000 */  sw        $v0, 0x0($v1)
/* B16B4 8011AFB4 0240202D */  daddu     $a0, $s2, $zero
.L8011AFB8:
/* B16B8 8011AFB8 0C045883 */  jal       mdl_create_model
/* B16BC 8011AFBC 24050004 */   addiu    $a1, $zero, 0x4
/* B16C0 8011AFC0 3C038015 */  lui       $v1, %hi(mdl_treeIterPos)
/* B16C4 8011AFC4 24633224 */  addiu     $v1, $v1, %lo(mdl_treeIterPos)
/* B16C8 8011AFC8 8C620000 */  lw        $v0, 0x0($v1)
/* B16CC 8011AFCC 3C04800A */  lui       $a0, %hi(mdl_currentModelTreeNodeInfo)
/* B16D0 8011AFD0 8C84A5F4 */  lw        $a0, %lo(mdl_currentModelTreeNodeInfo)($a0)
/* B16D4 8011AFD4 00021080 */  sll       $v0, $v0, 2
/* B16D8 8011AFD8 00441021 */  addu      $v0, $v0, $a0
/* B16DC 8011AFDC A0540001 */  sb        $s4, 0x1($v0)
/* B16E0 8011AFE0 8C620000 */  lw        $v0, 0x0($v1)
/* B16E4 8011AFE4 24420001 */  addiu     $v0, $v0, 0x1
/* B16E8 8011AFE8 AC620000 */  sw        $v0, 0x0($v1)
.L8011AFEC:
/* B16EC 8011AFEC 8FBF00F8 */  lw        $ra, 0xF8($sp)
/* B16F0 8011AFF0 8FB500F4 */  lw        $s5, 0xF4($sp)
/* B16F4 8011AFF4 8FB400F0 */  lw        $s4, 0xF0($sp)
/* B16F8 8011AFF8 8FB300EC */  lw        $s3, 0xEC($sp)
/* B16FC 8011AFFC 8FB200E8 */  lw        $s2, 0xE8($sp)
/* B1700 8011B000 8FB100E4 */  lw        $s1, 0xE4($sp)
/* B1704 8011B004 8FB000E0 */  lw        $s0, 0xE0($sp)
/* B1708 8011B008 03E00008 */  jr        $ra
/* B170C 8011B00C 27BD0100 */   addiu    $sp, $sp, 0x100

### DECOMPILED C INSTRUCTIONS:

void load_model_transforms(ModelNode* model, ModelNode* parent, Matrix4f mdlTxMtx, s32 treeDepth) {
    Matrix4f sp10;
    Mtx sp50;
    ModelBlueprint modelBP;
    ModelBlueprint* modelBPptr = &modelBP;
    ModelNodeProperty* groupTypeProperty;
    ModelNode* modelTemp;
    s32 i;

    if (model->groupData != NULL && model->groupData->numChildren != 0) {
        s32 groupType;

        if (model->groupData->transformMatrix != NULL) {
            Matrix4f spA0;

            guMtxL2F(spA0, model->groupData->transformMatrix);
            guMtxCatF(spA0, mdlTxMtx, sp10);
        }
        groupTypeProperty = get_model_property(model, MODEL_PROP_KEY_GROUP_TYPE);

        if (groupTypeProperty == NULL) {
            groupType = 0;
        } else {
            groupType = groupTypeProperty->data.s;
        }

        if (model->type != SHAPE_TYPE_GROUP || groupType == 0) {
            for (i = 0; i < model->groupData->numChildren; i++) {
                load_model_transforms(model->groupData->childList[i], model,
                                      model->groupData->transformMatrix != NULL ? sp10 : mdlTxMtx, treeDepth + 1);
            }

            (*mdl_currentModelTreeNodeInfo)[mdl_treeIterPos].modelIndex = -1;
            (*mdl_currentModelTreeNodeInfo)[mdl_treeIterPos].treeDepth = treeDepth;
            mdl_treeIterPos += 1;
            return;
        }
    }

    guMtxF2L(mdlTxMtx, &sp50);
    modelBPptr->flags = 0;
    modelBPptr->mdlNode = model;
    modelBPptr->groupData = parent->groupData;
    modelBPptr->mtx = &sp50;

    if (model->type == SHAPE_TYPE_GROUP) {
        s32 childCount = mdl_get_child_count(model);

        for (i = mdl_treeIterPos; i < mdl_treeIterPos + childCount; i++) {
            (*mdl_currentModelTreeNodeInfo)[i].modelIndex = -1;
            (*mdl_currentModelTreeNodeInfo)[i].treeDepth = treeDepth + 1;
        }
        mdl_treeIterPos += childCount;
    }

    mdl_create_model(modelBPptr, 4);
    (*mdl_currentModelTreeNodeInfo)[mdl_treeIterPos].treeDepth = treeDepth;
    mdl_treeIterPos += 1;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel render_npcs
/* 15BF0 8003A7F0 27BDFF78 */  addiu     $sp, $sp, -0x88
/* 15BF4 8003A7F4 F7BA0080 */  sdc1      $f26, 0x80($sp)
/* 15BF8 8003A7F8 3C01459C */  lui       $at, (0x459C4000 >> 16)
/* 15BFC 8003A7FC 34214000 */  ori       $at, $at, (0x459C4000 & 0xFFFF)
/* 15C00 8003A800 4481D000 */  mtc1      $at, $f26
/* 15C04 8003A804 F7B80078 */  sdc1      $f24, 0x78($sp)
/* 15C08 8003A808 4480C000 */  mtc1      $zero, $f24
/* 15C0C 8003A80C AFB10054 */  sw        $s1, 0x54($sp)
/* 15C10 8003A810 27B10028 */  addiu     $s1, $sp, 0x28
/* 15C14 8003A814 AFB20058 */  sw        $s2, 0x58($sp)
/* 15C18 8003A818 0000902D */  daddu     $s2, $zero, $zero
/* 15C1C 8003A81C AFB3005C */  sw        $s3, 0x5C($sp)
/* 15C20 8003A820 241300FF */  addiu     $s3, $zero, 0xFF
/* 15C24 8003A824 F7B60070 */  sdc1      $f22, 0x70($sp)
/* 15C28 8003A828 3C01461C */  lui       $at, (0x461C4000 >> 16)
/* 15C2C 8003A82C 34214000 */  ori       $at, $at, (0x461C4000 & 0xFFFF)
/* 15C30 8003A830 4481B000 */  mtc1      $at, $f22
/* 15C34 8003A834 3C03800A */  lui       $v1, %hi(gCurrentCamID)
/* 15C38 8003A838 8463A634 */  lh        $v1, %lo(gCurrentCamID)($v1)
/* 15C3C 8003A83C 3C04800B */  lui       $a0, %hi(gCameras)
/* 15C40 8003A840 24841D80 */  addiu     $a0, $a0, %lo(gCameras)
/* 15C44 8003A844 AFBF0064 */  sw        $ra, 0x64($sp)
/* 15C48 8003A848 AFB40060 */  sw        $s4, 0x60($sp)
/* 15C4C 8003A84C AFB00050 */  sw        $s0, 0x50($sp)
/* 15C50 8003A850 F7B40068 */  sdc1      $f20, 0x68($sp)
/* 15C54 8003A854 00031080 */  sll       $v0, $v1, 2
/* 15C58 8003A858 00431021 */  addu      $v0, $v0, $v1
/* 15C5C 8003A85C 00021080 */  sll       $v0, $v0, 2
/* 15C60 8003A860 00431023 */  subu      $v0, $v0, $v1
/* 15C64 8003A864 000218C0 */  sll       $v1, $v0, 3
/* 15C68 8003A868 00431021 */  addu      $v0, $v0, $v1
/* 15C6C 8003A86C 000210C0 */  sll       $v0, $v0, 3
/* 15C70 8003A870 0044A021 */  addu      $s4, $v0, $a0
.L8003A874:
/* 15C74 8003A874 3C03800A */  lui       $v1, %hi(gCurrentNpcListPtr)
/* 15C78 8003A878 8C630B90 */  lw        $v1, %lo(gCurrentNpcListPtr)($v1)
/* 15C7C 8003A87C 00121080 */  sll       $v0, $s2, 2
/* 15C80 8003A880 00431021 */  addu      $v0, $v0, $v1
/* 15C84 8003A884 8C500000 */  lw        $s0, 0x0($v0)
/* 15C88 8003A888 52000063 */  beql      $s0, $zero, .L8003AA18
/* 15C8C 8003A88C 26520001 */   addiu    $s2, $s2, 0x1
/* 15C90 8003A890 8E030000 */  lw        $v1, 0x0($s0)
/* 15C94 8003A894 50600060 */  beql      $v1, $zero, .L8003AA18
/* 15C98 8003A898 26520001 */   addiu    $s2, $s2, 0x1
/* 15C9C 8003A89C 3C028100 */  lui       $v0, (0x81000006 >> 16)
/* 15CA0 8003A8A0 34420006 */  ori       $v0, $v0, (0x81000006 & 0xFFFF)
/* 15CA4 8003A8A4 00621024 */  and       $v0, $v1, $v0
/* 15CA8 8003A8A8 5440005B */  bnel      $v0, $zero, .L8003AA18
/* 15CAC 8003A8AC 26520001 */   addiu    $s2, $s2, 0x1
/* 15CB0 8003A8B0 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 15CB4 8003A8B4 44810000 */  mtc1      $at, $f0
/* 15CB8 8003A8B8 27A20038 */  addiu     $v0, $sp, 0x38
/* 15CBC 8003A8BC AFA20014 */  sw        $v0, 0x14($sp)
/* 15CC0 8003A8C0 27A2003C */  addiu     $v0, $sp, 0x3C
/* 15CC4 8003A8C4 AFA20018 */  sw        $v0, 0x18($sp)
/* 15CC8 8003A8C8 27A20040 */  addiu     $v0, $sp, 0x40
/* 15CCC 8003A8CC AFA2001C */  sw        $v0, 0x1C($sp)
/* 15CD0 8003A8D0 27A20044 */  addiu     $v0, $sp, 0x44
/* 15CD4 8003A8D4 AFA20020 */  sw        $v0, 0x20($sp)
/* 15CD8 8003A8D8 E7A00010 */  swc1      $f0, 0x10($sp)
/* 15CDC 8003A8DC 8E050038 */  lw        $a1, 0x38($s0)
/* 15CE0 8003A8E0 8E06003C */  lw        $a2, 0x3C($s0)
/* 15CE4 8003A8E4 8E070040 */  lw        $a3, 0x40($s0)
/* 15CE8 8003A8E8 0C00A588 */  jal       transform_point
/* 15CEC 8003A8EC 268400D4 */   addiu    $a0, $s4, 0xD4
/* 15CF0 8003A8F0 C7A40044 */  lwc1      $f4, 0x44($sp)
/* 15CF4 8003A8F4 3C01800A */  lui       $at, %hi(D_800984B0)
/* 15CF8 8003A8F8 D42084B0 */  ldc1      $f0, %lo(D_800984B0)($at)
/* 15CFC 8003A8FC 460020A1 */  cvt.d.s   $f2, $f4
/* 15D00 8003A900 4620103C */  c.lt.d    $f2, $f0
/* 15D04 8003A904 00000000 */  nop
/* 15D08 8003A908 45000007 */  bc1f      .L8003A928
/* 15D0C 8003A90C 00000000 */   nop
/* 15D10 8003A910 3C01800A */  lui       $at, %hi(D_800984B8)
/* 15D14 8003A914 D42084B8 */  ldc1      $f0, %lo(D_800984B8)($at)
/* 15D18 8003A918 4622003C */  c.lt.d    $f0, $f2
/* 15D1C 8003A91C 00000000 */  nop
/* 15D20 8003A920 4503003D */  bc1tl     .L8003AA18
/* 15D24 8003A924 26520001 */   addiu    $s2, $s2, 0x1
.L8003A928:
/* 15D28 8003A928 C7A00040 */  lwc1      $f0, 0x40($sp)
/* 15D2C 8003A92C 461A0002 */  mul.s     $f0, $f0, $f26
/* 15D30 8003A930 00000000 */  nop
/* 15D34 8003A934 46040003 */  div.s     $f0, $f0, $f4
/* 15D38 8003A938 461A0500 */  add.s     $f20, $f0, $f26
/* 15D3C 8003A93C 4618A03C */  c.lt.s    $f20, $f24
/* 15D40 8003A940 00000000 */  nop
/* 15D44 8003A944 45000003 */  bc1f      .L8003A954
/* 15D48 8003A948 00000000 */   nop
/* 15D4C 8003A94C 0800EA59 */  j         .L8003A964
/* 15D50 8003A950 4600C506 */   mov.s    $f20, $f24
.L8003A954:
/* 15D54 8003A954 4614B03C */  c.lt.s    $f22, $f20
/* 15D58 8003A958 00000000 */  nop
/* 15D5C 8003A95C 45030001 */  bc1tl     .L8003A964
/* 15D60 8003A960 4600B506 */   mov.s    $f20, $f22
.L8003A964:
/* 15D64 8003A964 4600A007 */  neg.s     $f0, $f20
/* 15D68 8003A968 4600018D */  trunc.w.s $f6, $f0
/* 15D6C 8003A96C E6260004 */  swc1      $f6, 0x4($s1)
/* 15D70 8003A970 3C028004 */  lui       $v0, %hi(appendGfx_npc)
/* 15D74 8003A974 24429FD0 */  addiu     $v0, $v0, %lo(appendGfx_npc)
/* 15D78 8003A978 AE300008 */  sw        $s0, 0x8($s1)
/* 15D7C 8003A97C AE22000C */  sw        $v0, 0xC($s1)
/* 15D80 8003A980 820200AA */  lb        $v0, 0xAA($s0)
/* 15D84 8003A984 AE220000 */  sw        $v0, 0x0($s1)
/* 15D88 8003A988 8E020000 */  lw        $v0, 0x0($s0)
/* 15D8C 8003A98C 3C030080 */  lui       $v1, (0x800000 >> 16)
/* 15D90 8003A990 00431024 */  and       $v0, $v0, $v1
/* 15D94 8003A994 10400009 */  beqz      $v0, .L8003A9BC
/* 15D98 8003A998 27A40048 */   addiu    $a0, $sp, 0x48
/* 15D9C 8003A99C 27A50049 */  addiu     $a1, $sp, 0x49
/* 15DA0 8003A9A0 27A6004A */  addiu     $a2, $sp, 0x4A
/* 15DA4 8003A9A4 0C046FA0 */  jal       get_background_color_blend
/* 15DA8 8003A9A8 27A7004B */   addiu    $a3, $sp, 0x4B
/* 15DAC 8003A9AC 93A2004B */  lbu       $v0, 0x4B($sp)
/* 15DB0 8003A9B0 02621023 */  subu      $v0, $s3, $v0
/* 15DB4 8003A9B4 0800EA70 */  j         .L8003A9C0
/* 15DB8 8003A9B8 A20200AD */   sb       $v0, 0xAD($s0)
.L8003A9BC:
/* 15DBC 8003A9BC A21300AD */  sb        $s3, 0xAD($s0)
.L8003A9C0:
/* 15DC0 8003A9C0 920200AD */  lbu       $v0, 0xAD($s0)
/* 15DC4 8003A9C4 10400003 */  beqz      $v0, .L8003A9D4
/* 15DC8 8003A9C8 00000000 */   nop
/* 15DCC 8003A9CC 0C047644 */  jal       queue_render_task
/* 15DD0 8003A9D0 0220202D */   daddu    $a0, $s1, $zero
.L8003A9D4:
/* 15DD4 8003A9D4 8E020000 */  lw        $v0, 0x0($s0)
/* 15DD8 8003A9D8 3C030010 */  lui       $v1, (0x100000 >> 16)
/* 15DDC 8003A9DC 00431024 */  and       $v0, $v0, $v1
/* 15DE0 8003A9E0 5040000D */  beql      $v0, $zero, .L8003AA18
/* 15DE4 8003A9E4 26520001 */   addiu    $s2, $s2, 0x1
/* 15DE8 8003A9E8 4600A007 */  neg.s     $f0, $f20
/* 15DEC 8003A9EC 4600018D */  trunc.w.s $f6, $f0
/* 15DF0 8003A9F0 E6260004 */  swc1      $f6, 0x4($s1)
/* 15DF4 8003A9F4 0220202D */  daddu     $a0, $s1, $zero
/* 15DF8 8003A9F8 3C028004 */  lui       $v0, %hi(appendGfx_npc_blur)
/* 15DFC 8003A9FC 2442AE38 */  addiu     $v0, $v0, %lo(appendGfx_npc_blur)
/* 15E00 8003AA00 AE22000C */  sw        $v0, 0xC($s1)
/* 15E04 8003AA04 24020011 */  addiu     $v0, $zero, 0x11
/* 15E08 8003AA08 AE300008 */  sw        $s0, 0x8($s1)
/* 15E0C 8003AA0C 0C047644 */  jal       queue_render_task
/* 15E10 8003AA10 AE220000 */   sw       $v0, 0x0($s1)
/* 15E14 8003AA14 26520001 */  addiu     $s2, $s2, 0x1
.L8003AA18:
/* 15E18 8003AA18 2A420040 */  slti      $v0, $s2, 0x40
/* 15E1C 8003AA1C 1440FF95 */  bnez      $v0, .L8003A874
/* 15E20 8003AA20 00000000 */   nop
/* 15E24 8003AA24 8FBF0064 */  lw        $ra, 0x64($sp)
/* 15E28 8003AA28 8FB40060 */  lw        $s4, 0x60($sp)
/* 15E2C 8003AA2C 8FB3005C */  lw        $s3, 0x5C($sp)
/* 15E30 8003AA30 8FB20058 */  lw        $s2, 0x58($sp)
/* 15E34 8003AA34 8FB10054 */  lw        $s1, 0x54($sp)
/* 15E38 8003AA38 8FB00050 */  lw        $s0, 0x50($sp)
/* 15E3C 8003AA3C D7BA0080 */  ldc1      $f26, 0x80($sp)
/* 15E40 8003AA40 D7B80078 */  ldc1      $f24, 0x78($sp)
/* 15E44 8003AA44 D7B60070 */  ldc1      $f22, 0x70($sp)
/* 15E48 8003AA48 D7B40068 */  ldc1      $f20, 0x68($sp)
/* 15E4C 8003AA4C 03E00008 */  jr        $ra
/* 15E50 8003AA50 27BD0088 */   addiu    $sp, $sp, 0x88

### DECOMPILED C INSTRUCTIONS:

void render_npcs(void) {
    Npc* npc;
    RenderTask renderTask;
    RenderTask* renderTaskPtr = &renderTask;
    Camera* cam = &gCameras[gCurrentCamID];
    f32 x, y, z, s;
    f32 renderDist;
    s32 i;

    for (i = 0; i < MAX_NPCS; i++) {
        Npc* npc = (*gCurrentNpcListPtr)[i];
        if ((npc != NULL)
            && (npc->flags != 0)
            && !(npc->flags & (NPC_FLAG_SUSPENDED | NPC_FLAG_HAS_NO_SPRITE | NPC_FLAG_INACTIVE | NPC_FLAG_INVISIBLE))
        ) {
            transform_point(cam->perspectiveMatrix, npc->pos.x, npc->pos.y, npc->pos.z, 1.0f, &x, &y, &z, &s);
            if (!(s < 0.01) || !(s > -0.01)) {
                renderDist = ((z * 5000.0f) / s) + 5000.0f;
                if (renderDist < 0.0f) {
                    renderDist = 0.0f;
                } else if (renderDist > 10000.0f) {
                    renderDist = 10000.0f;
                }

                renderTaskPtr->distance = -renderDist;
                renderTaskPtr->appendGfxArg = npc;
                renderTaskPtr->appendGfx = appendGfx_npc;
                renderTaskPtr->renderMode = npc->renderMode;

                if (npc->flags & NPC_FLAG_HIDING) {
                    u8 r, g, b, a;
                    get_background_color_blend(&r, &g, &b, &a);
                    npc->alpha2 = 255 - a;
                } else {
                    npc->alpha2 = 255;
                }

                if (npc->alpha2 != 0) {
                    queue_render_task(renderTaskPtr);
                }

                if (npc->flags & NPC_FLAG_MOTION_BLUR) {
                    renderTaskPtr->distance = -renderDist;
                    renderTaskPtr->appendGfx = appendGfx_npc_blur;
                    renderTaskPtr->appendGfxArg = npc;
                    renderTaskPtr->renderMode = RENDER_MODE_SURFACE_XLU_LAYER1;
                    queue_render_task(renderTaskPtr);
                }
            }
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel npc_raycast_down
/* 759B0 800DC500 27BDFF60 */  addiu     $sp, $sp, -0xA0
/* 759B4 800DC504 AFB00070 */  sw        $s0, 0x70($sp)
/* 759B8 800DC508 0080802D */  daddu     $s0, $a0, $zero
/* 759BC 800DC50C AFB20078 */  sw        $s2, 0x78($sp)
/* 759C0 800DC510 00A0902D */  daddu     $s2, $a1, $zero
/* 759C4 800DC514 AFB3007C */  sw        $s3, 0x7C($sp)
/* 759C8 800DC518 00C0982D */  daddu     $s3, $a2, $zero
/* 759CC 800DC51C AFB40080 */  sw        $s4, 0x80($sp)
/* 759D0 800DC520 00E0A02D */  daddu     $s4, $a3, $zero
/* 759D4 800DC524 AFB50084 */  sw        $s5, 0x84($sp)
/* 759D8 800DC528 8FB500B0 */  lw        $s5, 0xB0($sp)
/* 759DC 800DC52C 27A20038 */  addiu     $v0, $sp, 0x38
/* 759E0 800DC530 AFBF0088 */  sw        $ra, 0x88($sp)
/* 759E4 800DC534 AFB10074 */  sw        $s1, 0x74($sp)
/* 759E8 800DC538 F7B60098 */  sdc1      $f22, 0x98($sp)
/* 759EC 800DC53C F7B40090 */  sdc1      $f20, 0x90($sp)
/* 759F0 800DC540 C6A00000 */  lwc1      $f0, 0x0($s5)
/* 759F4 800DC544 3C01BF80 */  lui       $at, (0xBF800000 >> 16)
/* 759F8 800DC548 4481A000 */  mtc1      $at, $f20
/* 759FC 800DC54C 46000005 */  abs.s     $f0, $f0
/* 75A00 800DC550 E7A00044 */  swc1      $f0, 0x44($sp)
/* 75A04 800DC554 E7A00060 */  swc1      $f0, 0x60($sp)
/* 75A08 800DC558 C6440000 */  lwc1      $f4, 0x0($s2)
/* 75A0C 800DC55C C6600000 */  lwc1      $f0, 0x0($s3)
/* 75A10 800DC560 C6820000 */  lwc1      $f2, 0x0($s4)
/* 75A14 800DC564 AFA2001C */  sw        $v0, 0x1C($sp)
/* 75A18 800DC568 27A2003C */  addiu     $v0, $sp, 0x3C
/* 75A1C 800DC56C AFA20020 */  sw        $v0, 0x20($sp)
/* 75A20 800DC570 27A20040 */  addiu     $v0, $sp, 0x40
/* 75A24 800DC574 AFA20024 */  sw        $v0, 0x24($sp)
/* 75A28 800DC578 27A20044 */  addiu     $v0, $sp, 0x44
/* 75A2C 800DC57C AFA20028 */  sw        $v0, 0x28($sp)
/* 75A30 800DC580 27A20048 */  addiu     $v0, $sp, 0x48
/* 75A34 800DC584 AFA2002C */  sw        $v0, 0x2C($sp)
/* 75A38 800DC588 27A2004C */  addiu     $v0, $sp, 0x4C
/* 75A3C 800DC58C AFA20030 */  sw        $v0, 0x30($sp)
/* 75A40 800DC590 44060000 */  mfc1      $a2, $f0
/* 75A44 800DC594 44071000 */  mfc1      $a3, $f2
/* 75A48 800DC598 44052000 */  mfc1      $a1, $f4
/* 75A4C 800DC59C 27A20050 */  addiu     $v0, $sp, 0x50
/* 75A50 800DC5A0 AFA00010 */  sw        $zero, 0x10($sp)
/* 75A54 800DC5A4 E7B40014 */  swc1      $f20, 0x14($sp)
/* 75A58 800DC5A8 AFA00018 */  sw        $zero, 0x18($sp)
/* 75A5C 800DC5AC 0C017334 */  jal       test_ray_colliders
/* 75A60 800DC5B0 AFA20034 */   sw       $v0, 0x34($sp)
/* 75A64 800DC5B4 0040882D */  daddu     $s1, $v0, $zero
/* 75A68 800DC5B8 3C020004 */  lui       $v0, (0x40000 >> 16)
/* 75A6C 800DC5BC 02028024 */  and       $s0, $s0, $v0
/* 75A70 800DC5C0 1600002E */  bnez      $s0, .L800DC67C
/* 75A74 800DC5C4 27A20054 */   addiu    $v0, $sp, 0x54
/* 75A78 800DC5C8 44800000 */  mtc1      $zero, $f0
/* 75A7C 800DC5CC AFA20018 */  sw        $v0, 0x18($sp)
/* 75A80 800DC5D0 27A20058 */  addiu     $v0, $sp, 0x58
/* 75A84 800DC5D4 AFA2001C */  sw        $v0, 0x1C($sp)
/* 75A88 800DC5D8 27A2005C */  addiu     $v0, $sp, 0x5C
/* 75A8C 800DC5DC AFA20020 */  sw        $v0, 0x20($sp)
/* 75A90 800DC5E0 27A20060 */  addiu     $v0, $sp, 0x60
/* 75A94 800DC5E4 AFA20024 */  sw        $v0, 0x24($sp)
/* 75A98 800DC5E8 27A20064 */  addiu     $v0, $sp, 0x64
/* 75A9C 800DC5EC AFA20028 */  sw        $v0, 0x28($sp)
/* 75AA0 800DC5F0 27A20068 */  addiu     $v0, $sp, 0x68
/* 75AA4 800DC5F4 AFA2002C */  sw        $v0, 0x2C($sp)
/* 75AA8 800DC5F8 27A2006C */  addiu     $v0, $sp, 0x6C
/* 75AAC 800DC5FC E7B40010 */  swc1      $f20, 0x10($sp)
/* 75AB0 800DC600 AFA20030 */  sw        $v0, 0x30($sp)
/* 75AB4 800DC604 E7A00014 */  swc1      $f0, 0x14($sp)
/* 75AB8 800DC608 C64C0000 */  lwc1      $f12, 0x0($s2)
/* 75ABC 800DC60C C66E0000 */  lwc1      $f14, 0x0($s3)
/* 75AC0 800DC610 8E860000 */  lw        $a2, 0x0($s4)
/* 75AC4 800DC614 44070000 */  mfc1      $a3, $f0
/* 75AC8 800DC618 0C017512 */  jal       test_ray_entities
/* 75ACC 800DC61C 00000000 */   nop
/* 75AD0 800DC620 04400014 */  bltz      $v0, .L800DC674
/* 75AD4 800DC624 00000000 */   nop
/* 75AD8 800DC628 C7AC0060 */  lwc1      $f12, 0x60($sp)
/* 75ADC 800DC62C C7A00044 */  lwc1      $f0, 0x44($sp)
/* 75AE0 800DC630 4600603C */  c.lt.s    $f12, $f0
/* 75AE4 800DC634 00000000 */  nop
/* 75AE8 800DC638 4500000E */  bc1f      .L800DC674
/* 75AEC 800DC63C 34514000 */   ori      $s1, $v0, 0x4000
/* 75AF0 800DC640 C7A00054 */  lwc1      $f0, 0x54($sp)
/* 75AF4 800DC644 C7A20058 */  lwc1      $f2, 0x58($sp)
/* 75AF8 800DC648 C7A4005C */  lwc1      $f4, 0x5C($sp)
/* 75AFC 800DC64C C7A60064 */  lwc1      $f6, 0x64($sp)
/* 75B00 800DC650 C7A80068 */  lwc1      $f8, 0x68($sp)
/* 75B04 800DC654 C7AA006C */  lwc1      $f10, 0x6C($sp)
/* 75B08 800DC658 E7AC0044 */  swc1      $f12, 0x44($sp)
/* 75B0C 800DC65C E7A00038 */  swc1      $f0, 0x38($sp)
/* 75B10 800DC660 E7A2003C */  swc1      $f2, 0x3C($sp)
/* 75B14 800DC664 E7A40040 */  swc1      $f4, 0x40($sp)
/* 75B18 800DC668 E7A60048 */  swc1      $f6, 0x48($sp)
/* 75B1C 800DC66C E7A8004C */  swc1      $f8, 0x4C($sp)
/* 75B20 800DC670 E7AA0050 */  swc1      $f10, 0x50($sp)
.L800DC674:
/* 75B24 800DC674 06200035 */  bltz      $s1, .L800DC74C
/* 75B28 800DC678 0220102D */   daddu    $v0, $s1, $zero
.L800DC67C:
/* 75B2C 800DC67C C7A00044 */  lwc1      $f0, 0x44($sp)
/* 75B30 800DC680 E6A00000 */  swc1      $f0, 0x0($s5)
/* 75B34 800DC684 C7A00038 */  lwc1      $f0, 0x38($sp)
/* 75B38 800DC688 E6400000 */  swc1      $f0, 0x0($s2)
/* 75B3C 800DC68C C7A0003C */  lwc1      $f0, 0x3C($sp)
/* 75B40 800DC690 E6600000 */  swc1      $f0, 0x0($s3)
/* 75B44 800DC694 C7A00040 */  lwc1      $f0, 0x40($sp)
/* 75B48 800DC698 0620002B */  bltz      $s1, .L800DC748
/* 75B4C 800DC69C E6800000 */   swc1     $f0, 0x0($s4)
/* 75B50 800DC6A0 C7A40050 */  lwc1      $f4, 0x50($sp)
/* 75B54 800DC6A4 3C0142C8 */  lui       $at, (0x42C80000 >> 16)
/* 75B58 800DC6A8 4481A000 */  mtc1      $at, $f20
/* 75B5C 800DC6AC 00000000 */  nop
/* 75B60 800DC6B0 46142402 */  mul.s     $f16, $f4, $f20
/* 75B64 800DC6B4 00000000 */  nop
/* 75B68 800DC6B8 3C108007 */  lui       $s0, %hi(gGameStatusPtr)
/* 75B6C 800DC6BC 2610419C */  addiu     $s0, $s0, %lo(gGameStatusPtr)
/* 75B70 800DC6C0 C7A2004C */  lwc1      $f2, 0x4C($sp)
/* 75B74 800DC6C4 44068000 */  mfc1      $a2, $f16
/* 75B78 800DC6C8 46141402 */  mul.s     $f16, $f2, $f20
/* 75B7C 800DC6CC 00000000 */  nop
/* 75B80 800DC6D0 4480B000 */  mtc1      $zero, $f22
/* 75B84 800DC6D4 8E020000 */  lw        $v0, 0x0($s0)
/* 75B88 800DC6D8 C7A00048 */  lwc1      $f0, 0x48($sp)
/* 75B8C 800DC6DC 4600B306 */  mov.s     $f12, $f22
/* 75B90 800DC6E0 44078000 */  mfc1      $a3, $f16
/* 75B94 800DC6E4 4600B386 */  mov.s     $f14, $f22
/* 75B98 800DC6E8 E4400128 */  swc1      $f0, 0x128($v0)
/* 75B9C 800DC6EC E442012C */  swc1      $f2, 0x12C($v0)
/* 75BA0 800DC6F0 0C00A720 */  jal       atan2
/* 75BA4 800DC6F4 E4440130 */   swc1     $f4, 0x130($v0)
/* 75BA8 800DC6F8 C7A20048 */  lwc1      $f2, 0x48($sp)
/* 75BAC 800DC6FC 46141082 */  mul.s     $f2, $f2, $f20
/* 75BB0 800DC700 00000000 */  nop
/* 75BB4 800DC704 44061000 */  mfc1      $a2, $f2
/* 75BB8 800DC708 C7A2004C */  lwc1      $f2, 0x4C($sp)
/* 75BBC 800DC70C 46141082 */  mul.s     $f2, $f2, $f20
/* 75BC0 800DC710 00000000 */  nop
/* 75BC4 800DC714 4600B306 */  mov.s     $f12, $f22
/* 75BC8 800DC718 46006386 */  mov.s     $f14, $f12
/* 75BCC 800DC71C 8E020000 */  lw        $v0, 0x0($s0)
/* 75BD0 800DC720 44071000 */  mfc1      $a3, $f2
/* 75BD4 800DC724 46000007 */  neg.s     $f0, $f0
/* 75BD8 800DC728 E440011C */  swc1      $f0, 0x11C($v0)
/* 75BDC 800DC72C 0C00A720 */  jal       atan2
/* 75BE0 800DC730 E44C0120 */   swc1     $f12, 0x120($v0)
/* 75BE4 800DC734 0220102D */  daddu     $v0, $s1, $zero
/* 75BE8 800DC738 8E030000 */  lw        $v1, 0x0($s0)
/* 75BEC 800DC73C 46000007 */  neg.s     $f0, $f0
/* 75BF0 800DC740 080371D3 */  j         .L800DC74C
/* 75BF4 800DC744 E4600124 */   swc1     $f0, 0x124($v1)
.L800DC748:
/* 75BF8 800DC748 0220102D */  daddu     $v0, $s1, $zero
.L800DC74C:
/* 75BFC 800DC74C 8FBF0088 */  lw        $ra, 0x88($sp)
/* 75C00 800DC750 8FB50084 */  lw        $s5, 0x84($sp)
/* 75C04 800DC754 8FB40080 */  lw        $s4, 0x80($sp)
/* 75C08 800DC758 8FB3007C */  lw        $s3, 0x7C($sp)
/* 75C0C 800DC75C 8FB20078 */  lw        $s2, 0x78($sp)
/* 75C10 800DC760 8FB10074 */  lw        $s1, 0x74($sp)
/* 75C14 800DC764 8FB00070 */  lw        $s0, 0x70($sp)
/* 75C18 800DC768 D7B60098 */  ldc1      $f22, 0x98($sp)
/* 75C1C 800DC76C D7B40090 */  ldc1      $f20, 0x90($sp)
/* 75C20 800DC770 03E00008 */  jr        $ra
/* 75C24 800DC774 27BD00A0 */   addiu    $sp, $sp, 0xA0

### DECOMPILED C INSTRUCTIONS:

s32 npc_raycast_down(s32 ignoreFlags, f32* startX, f32* startY, f32* startZ, f32* hitDepth) {
    f32 cHitX;
    f32 cHitY;
    f32 cHitZ;
    f32 cHitDepth;
    f32 cHitNx;
    f32 cHitNy;
    f32 cHitNz;
    f32 eHitX;
    f32 eHitY;
    f32 eHitZ;
    f32 eHitDepth;
    f32 eHitNx;
    f32 eHitNy;
    f32 eHitNz;
    s32 entityID;
    s32 colliderID;
    f32 sx, sy, sz;

    eHitDepth = cHitDepth = fabsf(*hitDepth);
    sx = *startX;
    sy = *startY;
    sz = *startZ;
    colliderID = test_ray_colliders(ignoreFlags, sx, sy, sz, 0.0f, -1.0f, 0.0f, &cHitX, &cHitY, &cHitZ, &cHitDepth, &cHitNx, &cHitNy, &cHitNz);
    if ((ignoreFlags & COLLISION_IGNORE_ENTITIES) == 0)  {
        entityID = test_ray_entities(*startX, *startY, *startZ, 0.0f, -1.0f, 0.0f, &eHitX, &eHitY, &eHitZ, &eHitDepth, &eHitNx, &eHitNy, &eHitNz);
        if (entityID >= 0) {
            colliderID = entityID | COLLISION_WITH_ENTITY_BIT;
            if (eHitDepth < cHitDepth) {
                cHitDepth = eHitDepth;
                cHitX = eHitX;
                cHitY = eHitY;
                cHitZ = eHitZ;
                cHitNx = eHitNx;
                cHitNy = eHitNy;
                cHitNz = eHitNz;
            }
        }
        if (colliderID < 0) {
            return colliderID;
        }
    }

    *hitDepth = cHitDepth;
    *startX = cHitX;
    *startY = cHitY;
    *startZ = cHitZ;

    if (colliderID < 0) {
        return colliderID;
    }

    gGameStatusPtr->playerGroundTraceNormal.x = cHitNx;
    gGameStatusPtr->playerGroundTraceNormal.y = cHitNy;
    gGameStatusPtr->playerGroundTraceNormal.z = cHitNz;
    gGameStatusPtr->playerGroundTraceAngles.x = -atan2(0.0f, 0.0f, cHitNz * 100.0f, cHitNy * 100.0f);
    gGameStatusPtr->playerGroundTraceAngles.y = 0.0f;
    gGameStatusPtr->playerGroundTraceAngles.z = -atan2(0.0f, 0.0f, cHitNx * 100.0f, cHitNy * 100.0f);

    return colliderID;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel UseExitHeading
/* F6B1C 802D216C 27BDFF98 */  addiu     $sp, $sp, -0x68
/* F6B20 802D2170 AFB30024 */  sw        $s3, 0x24($sp)
/* F6B24 802D2174 0080982D */  daddu     $s3, $a0, $zero
/* F6B28 802D2178 AFBF0030 */  sw        $ra, 0x30($sp)
/* F6B2C 802D217C AFB5002C */  sw        $s5, 0x2C($sp)
/* F6B30 802D2180 AFB40028 */  sw        $s4, 0x28($sp)
/* F6B34 802D2184 AFB20020 */  sw        $s2, 0x20($sp)
/* F6B38 802D2188 AFB1001C */  sw        $s1, 0x1C($sp)
/* F6B3C 802D218C AFB00018 */  sw        $s0, 0x18($sp)
/* F6B40 802D2190 F7BE0060 */  sdc1      $f30, 0x60($sp)
/* F6B44 802D2194 F7BC0058 */  sdc1      $f28, 0x58($sp)
/* F6B48 802D2198 F7BA0050 */  sdc1      $f26, 0x50($sp)
/* F6B4C 802D219C F7B80048 */  sdc1      $f24, 0x48($sp)
/* F6B50 802D21A0 F7B60040 */  sdc1      $f22, 0x40($sp)
/* F6B54 802D21A4 F7B40038 */  sdc1      $f20, 0x38($sp)
/* F6B58 802D21A8 8E70000C */  lw        $s0, 0xC($s3)
/* F6B5C 802D21AC 0C016AFA */  jal       get_current_map_settings
/* F6B60 802D21B0 26750098 */   addiu    $s5, $s3, 0x98
/* F6B64 802D21B4 3C128011 */  lui       $s2, %hi(gPlayerStatus)
/* F6B68 802D21B8 2652EFC8 */  addiu     $s2, $s2, %lo(gPlayerStatus)
/* F6B6C 802D21BC 0C0389B1 */  jal       can_trigger_loading_zone
/* F6B70 802D21C0 0040A02D */   daddu    $s4, $v0, $zero
/* F6B74 802D21C4 1040007D */  beqz      $v0, .L802D23BC
/* F6B78 802D21C8 0000102D */   daddu    $v0, $zero, $zero
/* F6B7C 802D21CC 8E050000 */  lw        $a1, 0x0($s0)
/* F6B80 802D21D0 26100004 */  addiu     $s0, $s0, 0x4
/* F6B84 802D21D4 0C0B1EAF */  jal       evt_get_variable
/* F6B88 802D21D8 0260202D */   daddu    $a0, $s3, $zero
/* F6B8C 802D21DC 0040882D */  daddu     $s1, $v0, $zero
/* F6B90 802D21E0 8E050000 */  lw        $a1, 0x0($s0)
/* F6B94 802D21E4 0C0B1EAF */  jal       evt_get_variable
/* F6B98 802D21E8 0260202D */   daddu    $a0, $s3, $zero
/* F6B9C 802D21EC 0040802D */  daddu     $s0, $v0, $zero
/* F6BA0 802D21F0 00101100 */  sll       $v0, $s0, 4
/* F6BA4 802D21F4 4491C000 */  mtc1      $s1, $f24
/* F6BA8 802D21F8 00000000 */  nop
/* F6BAC 802D21FC 4680C620 */  cvt.s.w   $f24, $f24
/* F6BB0 802D2200 8E460028 */  lw        $a2, 0x28($s2)
/* F6BB4 802D2204 8E830014 */  lw        $v1, 0x14($s4)
/* F6BB8 802D2208 3C014120 */  lui       $at, (0x41200000 >> 16)
/* F6BBC 802D220C 44810000 */  mtc1      $at, $f0
/* F6BC0 802D2210 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* F6BC4 802D2214 4481D000 */  mtc1      $at, $f26
/* F6BC8 802D2218 8E470030 */  lw        $a3, 0x30($s2)
/* F6BCC 802D221C 4600C580 */  add.s     $f22, $f24, $f0
/* F6BD0 802D2220 00431021 */  addu      $v0, $v0, $v1
/* F6BD4 802D2224 C45C0000 */  lwc1      $f28, 0x0($v0)
/* F6BD8 802D2228 461AB502 */  mul.s     $f20, $f22, $f26
/* F6BDC 802D222C 00000000 */  nop
/* F6BE0 802D2230 C45E0008 */  lwc1      $f30, 0x8($v0)
/* F6BE4 802D2234 4600E306 */  mov.s     $f12, $f28
/* F6BE8 802D2238 0C00A7B5 */  jal       dist2D
/* F6BEC 802D223C 4600F386 */   mov.s    $f14, $f30
/* F6BF0 802D2240 46140081 */  sub.s     $f2, $f0, $f20
/* F6BF4 802D2244 44800000 */  mtc1      $zero, $f0
/* F6BF8 802D2248 00000000 */  nop
/* F6BFC 802D224C 4602003C */  c.lt.s    $f0, $f2
/* F6C00 802D2250 00000000 */  nop
/* F6C04 802D2254 4502000B */  bc1fl     .L802D2284
/* F6C08 802D2258 00108100 */   sll      $s0, $s0, 4
/* F6C0C 802D225C 4602B03C */  c.lt.s    $f22, $f2
/* F6C10 802D2260 00000000 */  nop
/* F6C14 802D2264 45030001 */  bc1tl     .L802D226C
/* F6C18 802D2268 4600B086 */   mov.s    $f2, $f22
.L802D226C:
/* F6C1C 802D226C 461A1002 */  mul.s     $f0, $f2, $f26
/* F6C20 802D2270 00000000 */  nop
/* F6C24 802D2274 4600C001 */  sub.s     $f0, $f24, $f0
/* F6C28 802D2278 4600040D */  trunc.w.s $f16, $f0
/* F6C2C 802D227C 44118000 */  mfc1      $s1, $f16
/* F6C30 802D2280 00108100 */  sll       $s0, $s0, 4
.L802D2284:
/* F6C34 802D2284 8E820014 */  lw        $v0, 0x14($s4)
/* F6C38 802D2288 3C014334 */  lui       $at, (0x43340000 >> 16)
/* F6C3C 802D228C 44816000 */  mtc1      $at, $f12
/* F6C40 802D2290 02021021 */  addu      $v0, $s0, $v0
/* F6C44 802D2294 C440000C */  lwc1      $f0, 0xC($v0)
/* F6C48 802D2298 0C00A6C9 */  jal       clamp_angle
/* F6C4C 802D229C 460C0300 */   add.s    $f12, $f0, $f12
/* F6C50 802D22A0 46000306 */  mov.s     $f12, $f0
/* F6C54 802D22A4 27A50010 */  addiu     $a1, $sp, 0x10
/* F6C58 802D22A8 0C00A88D */  jal       sin_cos_deg
/* F6C5C 802D22AC 27A60014 */   addiu    $a2, $sp, 0x14
/* F6C60 802D22B0 C7AA0010 */  lwc1      $f10, 0x10($sp)
/* F6C64 802D22B4 44913000 */  mtc1      $s1, $f6
/* F6C68 802D22B8 00000000 */  nop
/* F6C6C 802D22BC 468031A0 */  cvt.s.w   $f6, $f6
/* F6C70 802D22C0 460A3302 */  mul.s     $f12, $f6, $f10
/* F6C74 802D22C4 00000000 */  nop
/* F6C78 802D22C8 C7A80014 */  lwc1      $f8, 0x14($sp)
/* F6C7C 802D22CC 46083182 */  mul.s     $f6, $f6, $f8
/* F6C80 802D22D0 00000000 */  nop
/* F6C84 802D22D4 C6420028 */  lwc1      $f2, 0x28($s2)
/* F6C88 802D22D8 461C1081 */  sub.s     $f2, $f2, $f28
/* F6C8C 802D22DC 46024082 */  mul.s     $f2, $f8, $f2
/* F6C90 802D22E0 00000000 */  nop
/* F6C94 802D22E4 C6400030 */  lwc1      $f0, 0x30($s2)
/* F6C98 802D22E8 4600F001 */  sub.s     $f0, $f30, $f0
/* F6C9C 802D22EC 46005002 */  mul.s     $f0, $f10, $f0
/* F6CA0 802D22F0 00000000 */  nop
/* F6CA4 802D22F4 46001081 */  sub.s     $f2, $f2, $f0
/* F6CA8 802D22F8 3C013E99 */  lui       $at, (0x3E99999A >> 16)
/* F6CAC 802D22FC 3421999A */  ori       $at, $at, (0x3E99999A & 0xFFFF)
/* F6CB0 802D2300 44812000 */  mtc1      $at, $f4
/* F6CB4 802D2304 00000000 */  nop
/* F6CB8 802D2308 46041102 */  mul.s     $f4, $f2, $f4
/* F6CBC 802D230C 00000000 */  nop
/* F6CC0 802D2310 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* F6CC4 802D2314 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* F6CC8 802D2318 46082382 */  mul.s     $f14, $f4, $f8
/* F6CCC 802D231C 00000000 */  nop
/* F6CD0 802D2320 E4420094 */  swc1      $f2, 0x94($v0)
/* F6CD4 802D2324 C6400028 */  lwc1      $f0, 0x28($s2)
/* F6CD8 802D2328 460C0000 */  add.s     $f0, $f0, $f12
/* F6CDC 802D232C 460E0001 */  sub.s     $f0, $f0, $f14
/* F6CE0 802D2330 460A2102 */  mul.s     $f4, $f4, $f10
/* F6CE4 802D2334 00000000 */  nop
/* F6CE8 802D2338 4600040D */  trunc.w.s $f16, $f0
/* F6CEC 802D233C E6700088 */  swc1      $f16, 0x88($s3)
/* F6CF0 802D2340 C6400030 */  lwc1      $f0, 0x30($s2)
/* F6CF4 802D2344 46060001 */  sub.s     $f0, $f0, $f6
/* F6CF8 802D2348 3C038888 */  lui       $v1, (0x88888889 >> 16)
/* F6CFC 802D234C 46040001 */  sub.s     $f0, $f0, $f4
/* F6D00 802D2350 34638889 */  ori       $v1, $v1, (0x88888889 & 0xFFFF)
/* F6D04 802D2354 001127C3 */  sra       $a0, $s1, 31
/* F6D08 802D2358 4600040D */  trunc.w.s $f16, $f0
/* F6D0C 802D235C E6700090 */  swc1      $f16, 0x90($s3)
/* F6D10 802D2360 8E820014 */  lw        $v0, 0x14($s4)
/* F6D14 802D2364 02230018 */  mult      $s1, $v1
/* F6D18 802D2368 02028021 */  addu      $s0, $s0, $v0
/* F6D1C 802D236C C6000004 */  lwc1      $f0, 0x4($s0)
/* F6D20 802D2370 24020002 */  addiu     $v0, $zero, 0x2
/* F6D24 802D2374 4600040D */  trunc.w.s $f16, $f0
/* F6D28 802D2378 E670008C */  swc1      $f16, 0x8C($s3)
/* F6D2C 802D237C 00004010 */  mfhi      $t0
/* F6D30 802D2380 01111821 */  addu      $v1, $t0, $s1
/* F6D34 802D2384 000318C3 */  sra       $v1, $v1, 3
/* F6D38 802D2388 00641823 */  subu      $v1, $v1, $a0
/* F6D3C 802D238C 44830000 */  mtc1      $v1, $f0
/* F6D40 802D2390 00000000 */  nop
/* F6D44 802D2394 46800020 */  cvt.s.w   $f0, $f0
/* F6D48 802D2398 E6A00000 */  swc1      $f0, 0x0($s5)
/* F6D4C 802D239C 8E430004 */  lw        $v1, 0x4($s2)
/* F6D50 802D23A0 3C040010 */  lui       $a0, (0x100000 >> 16)
/* F6D54 802D23A4 00641825 */  or        $v1, $v1, $a0
/* F6D58 802D23A8 AE430004 */  sw        $v1, 0x4($s2)
/* F6D5C 802D23AC 8E430000 */  lw        $v1, 0x0($s2)
/* F6D60 802D23B0 3C040400 */  lui       $a0, (0x4000000 >> 16)
/* F6D64 802D23B4 00641825 */  or        $v1, $v1, $a0
/* F6D68 802D23B8 AE430000 */  sw        $v1, 0x0($s2)
.L802D23BC:
/* F6D6C 802D23BC 8FBF0030 */  lw        $ra, 0x30($sp)
/* F6D70 802D23C0 8FB5002C */  lw        $s5, 0x2C($sp)
/* F6D74 802D23C4 8FB40028 */  lw        $s4, 0x28($sp)
/* F6D78 802D23C8 8FB30024 */  lw        $s3, 0x24($sp)
/* F6D7C 802D23CC 8FB20020 */  lw        $s2, 0x20($sp)
/* F6D80 802D23D0 8FB1001C */  lw        $s1, 0x1C($sp)
/* F6D84 802D23D4 8FB00018 */  lw        $s0, 0x18($sp)
/* F6D88 802D23D8 D7BE0060 */  ldc1      $f30, 0x60($sp)
/* F6D8C 802D23DC D7BC0058 */  ldc1      $f28, 0x58($sp)
/* F6D90 802D23E0 D7BA0050 */  ldc1      $f26, 0x50($sp)
/* F6D94 802D23E4 D7B80048 */  ldc1      $f24, 0x48($sp)
/* F6D98 802D23E8 D7B60040 */  ldc1      $f22, 0x40($sp)
/* F6D9C 802D23EC D7B40038 */  ldc1      $f20, 0x38($sp)
/* F6DA0 802D23F0 03E00008 */  jr        $ra
/* F6DA4 802D23F4 27BD0068 */   addiu    $sp, $sp, 0x68

### DECOMPILED C INSTRUCTIONS:

ApiStatus UseExitHeading(Evt* script, s32 isInitialCall) {
    Bytecode* args = script->ptrReadPos;
    PlayerStatus* playerStatus = &gPlayerStatus;
    MapSettings* mapSettings = get_current_map_settings();
    f32* varTableVar5 = &script->varTableF[5];

    if (can_trigger_loading_zone()) {
        s32 var1 = evt_get_variable(script, *args++);
        s32 entryID = evt_get_variable(script, *args++);
        f32 entryX = (*mapSettings->entryList)[entryID].x;
        f32 entryZ = (*mapSettings->entryList)[entryID].z;
        f32 temp = (var1 + 10.0f) / 2;
        f32 temp_f2 = dist2D(entryX, entryZ, playerStatus->position.x, playerStatus->position.z) - temp;
        f32 sinTheta;
        f32 cosTheta;
        f32 exitTangentFrac;

        if (temp_f2 > 0.0f) {
            if (temp_f2 > var1 + 10.0f) {
                temp_f2 = var1 + 10.0f;
            }
            var1 -= temp_f2 / 2;
        }

        sin_cos_deg(clamp_angle((*mapSettings->entryList)[entryID].yaw + 180.0f), &sinTheta, &cosTheta);
        gGameStatusPtr->exitTangent = (cosTheta * (playerStatus->position.x - entryX)) - (sinTheta * (entryZ - playerStatus->position.z));
        exitTangentFrac = gGameStatusPtr->exitTangent * 0.3f;
        script->varTable[1] = (playerStatus->position.x + (var1 * sinTheta)) - (exitTangentFrac * cosTheta);
        script->varTable[3] = (playerStatus->position.z - (var1 * cosTheta)) - (exitTangentFrac * sinTheta);
        script->varTable[2] = (*mapSettings->entryList)[entryID].y;
        *varTableVar5 = var1 / 15;
        playerStatus->animFlags |= PA_FLAG_CHANGING_MAP;
        playerStatus->flags |= PS_FLAG_CAMERA_DOESNT_FOLLOW;
        return ApiStatus_DONE2;
    }

    return ApiStatus_BLOCK;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_E0082A84
/* 3860C4 E0082A84 27BDFFC8 */  addiu     $sp, $sp, -0x38
/* 3860C8 E0082A88 AFB60028 */  sw        $s6, 0x28($sp)
/* 3860CC E0082A8C 0080B02D */  daddu     $s6, $a0, $zero
/* 3860D0 E0082A90 3C06DB06 */  lui       $a2, (0xDB060024 >> 16)
/* 3860D4 E0082A94 34C60024 */  ori       $a2, $a2, (0xDB060024 & 0xFFFF)
/* 3860D8 E0082A98 AFB40020 */  sw        $s4, 0x20($sp)
/* 3860DC E0082A9C 24140001 */  addiu     $s4, $zero, 0x1
/* 3860E0 E0082AA0 AFB00010 */  sw        $s0, 0x10($sp)
/* 3860E4 E0082AA4 3C10800A */  lui       $s0, %hi(gMainGfxPos)
/* 3860E8 E0082AA8 2610A66C */  addiu     $s0, $s0, %lo(gMainGfxPos)
/* 3860EC E0082AAC 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 3860F0 E0082AB0 AFBF0034 */  sw        $ra, 0x34($sp)
/* 3860F4 E0082AB4 AFBE0030 */  sw        $fp, 0x30($sp)
/* 3860F8 E0082AB8 AFB7002C */  sw        $s7, 0x2C($sp)
/* 3860FC E0082ABC AFB50024 */  sw        $s5, 0x24($sp)
/* 386100 E0082AC0 AFB3001C */  sw        $s3, 0x1C($sp)
/* 386104 E0082AC4 AFB20018 */  sw        $s2, 0x18($sp)
/* 386108 E0082AC8 AFB10014 */  sw        $s1, 0x14($sp)
/* 38610C E0082ACC 8E050000 */  lw        $a1, 0x0($s0)
/* 386110 E0082AD0 8ED3000C */  lw        $s3, 0xC($s6)
/* 386114 E0082AD4 00A0182D */  daddu     $v1, $a1, $zero
/* 386118 E0082AD8 24A50008 */  addiu     $a1, $a1, 0x8
/* 38611C E0082ADC 0260202D */  daddu     $a0, $s3, $zero
/* 386120 E0082AE0 AE050000 */  sw        $a1, 0x0($s0)
/* 386124 E0082AE4 AC620000 */  sw        $v0, 0x0($v1)
/* 386128 E0082AE8 AC600004 */  sw        $zero, 0x4($v1)
/* 38612C E0082AEC ACA60000 */  sw        $a2, 0x0($a1)
/* 386130 E0082AF0 8EC30010 */  lw        $v1, 0x10($s6)
/* 386134 E0082AF4 24A20008 */  addiu     $v0, $a1, 0x8
/* 386138 E0082AF8 AE020000 */  sw        $v0, 0x0($s0)
/* 38613C E0082AFC 8C62001C */  lw        $v0, 0x1C($v1)
/* 386140 E0082B00 3C038000 */  lui       $v1, (0x80000000 >> 16)
/* 386144 E0082B04 00431021 */  addu      $v0, $v0, $v1
/* 386148 E0082B08 0C020960 */  jal       func_E0082580
/* 38614C E0082B0C ACA20004 */   sw       $v0, 0x4($a1)
/* 386150 E0082B10 8E720038 */  lw        $s2, 0x38($s3)
/* 386154 E0082B14 8EC20008 */  lw        $v0, 0x8($s6)
/* 386158 E0082B18 0282102A */  slt       $v0, $s4, $v0
/* 38615C E0082B1C 10400059 */  beqz      $v0, .LE0082C84
/* 386160 E0082B20 26730048 */   addiu    $s3, $s3, 0x48
/* 386164 E0082B24 3C026666 */  lui       $v0, (0x66666667 >> 16)
/* 386168 E0082B28 34426667 */  ori       $v0, $v0, (0x66666667 & 0xFFFF)
/* 38616C E0082B2C 02420018 */  mult      $s2, $v0
/* 386170 E0082B30 3C11DE00 */  lui       $s1, (0xDE000000 >> 16)
/* 386174 E0082B34 3C15E008 */  lui       $s5, %hi(D_E0082D00)
/* 386178 E0082B38 26B52D00 */  addiu     $s5, $s5, %lo(D_E0082D00)
/* 38617C E0082B3C 00121080 */  sll       $v0, $s2, 2
/* 386180 E0082B40 0055F021 */  addu      $fp, $v0, $s5
/* 386184 E0082B44 00003810 */  mfhi      $a3
/* 386188 E0082B48 0007B883 */  sra       $s7, $a3, 2
.LE0082B4C:
/* 38618C E0082B4C 0C0209B1 */  jal       func_E00826C4
/* 386190 E0082B50 0260202D */   daddu    $a0, $s3, $zero
/* 386194 E0082B54 1A40003E */  blez      $s2, .LE0082C50
/* 386198 E0082B58 3C02D838 */   lui      $v0, (0xD8380002 >> 16)
/* 38619C E0082B5C 8E050000 */  lw        $a1, 0x0($s0)
/* 3861A0 E0082B60 3C030900 */  lui       $v1, %hi(D_090022B0_40F540)
/* 3861A4 E0082B64 246322B0 */  addiu     $v1, $v1, %lo(D_090022B0_40F540)
/* 3861A8 E0082B68 00A0102D */  daddu     $v0, $a1, $zero
/* 3861AC E0082B6C 24A50008 */  addiu     $a1, $a1, 0x8
/* 3861B0 E0082B70 AE050000 */  sw        $a1, 0x0($s0)
/* 3861B4 E0082B74 AC510000 */  sw        $s1, 0x0($v0)
/* 3861B8 E0082B78 AC430004 */  sw        $v1, 0x4($v0)
/* 3861BC E0082B7C 2A42000A */  slti      $v0, $s2, 0xA
/* 3861C0 E0082B80 1040000C */  beqz      $v0, .LE0082BB4
/* 3861C4 E0082B84 24A20008 */   addiu    $v0, $a1, 0x8
/* 3861C8 E0082B88 AE020000 */  sw        $v0, 0x0($s0)
/* 3861CC E0082B8C ACB10000 */  sw        $s1, 0x0($a1)
/* 3861D0 E0082B90 8FC30000 */  lw        $v1, 0x0($fp)
/* 3861D4 E0082B94 24A20010 */  addiu     $v0, $a1, 0x10
/* 3861D8 E0082B98 AE020000 */  sw        $v0, 0x0($s0)
/* 3861DC E0082B9C 3C020900 */  lui       $v0, %hi(D_09002250_40F4E0)
/* 3861E0 E0082BA0 24422250 */  addiu     $v0, $v0, %lo(D_09002250_40F4E0)
/* 3861E4 E0082BA4 ACB10008 */  sw        $s1, 0x8($a1)
/* 3861E8 E0082BA8 ACA2000C */  sw        $v0, 0xC($a1)
/* 3861EC E0082BAC 08020B13 */  j         .LE0082C4C
/* 3861F0 E0082BB0 ACA30004 */   sw       $v1, 0x4($a1)
.LE0082BB4:
/* 3861F4 E0082BB4 001217C3 */  sra       $v0, $s2, 31
/* 3861F8 E0082BB8 02E22023 */  subu      $a0, $s7, $v0
/* 3861FC E0082BBC 0080182D */  daddu     $v1, $a0, $zero
/* 386200 E0082BC0 00031080 */  sll       $v0, $v1, 2
/* 386204 E0082BC4 00431021 */  addu      $v0, $v0, $v1
/* 386208 E0082BC8 00021040 */  sll       $v0, $v0, 1
/* 38620C E0082BCC 02422023 */  subu      $a0, $s2, $v0
/* 386210 E0082BD0 24A20008 */  addiu     $v0, $a1, 0x8
/* 386214 E0082BD4 AE020000 */  sw        $v0, 0x0($s0)
/* 386218 E0082BD8 00041080 */  sll       $v0, $a0, 2
/* 38621C E0082BDC 00551021 */  addu      $v0, $v0, $s5
/* 386220 E0082BE0 ACB10000 */  sw        $s1, 0x0($a1)
/* 386224 E0082BE4 8C440000 */  lw        $a0, 0x0($v0)
/* 386228 E0082BE8 24A20010 */  addiu     $v0, $a1, 0x10
/* 38622C E0082BEC AE020000 */  sw        $v0, 0x0($s0)
/* 386230 E0082BF0 24A20018 */  addiu     $v0, $a1, 0x18
/* 386234 E0082BF4 00031880 */  sll       $v1, $v1, 2
/* 386238 E0082BF8 00751821 */  addu      $v1, $v1, $s5
/* 38623C E0082BFC ACB10008 */  sw        $s1, 0x8($a1)
/* 386240 E0082C00 AE020000 */  sw        $v0, 0x0($s0)
/* 386244 E0082C04 ACA40004 */  sw        $a0, 0x4($a1)
/* 386248 E0082C08 8C640000 */  lw        $a0, 0x0($v1)
/* 38624C E0082C0C 24A20020 */  addiu     $v0, $a1, 0x20
/* 386250 E0082C10 AE020000 */  sw        $v0, 0x0($s0)
/* 386254 E0082C14 3C020900 */  lui       $v0, %hi(D_09002290_40F520)
/* 386258 E0082C18 24422290 */  addiu     $v0, $v0, %lo(D_09002290_40F520)
/* 38625C E0082C1C ACB10010 */  sw        $s1, 0x10($a1)
/* 386260 E0082C20 ACA20014 */  sw        $v0, 0x14($a1)
/* 386264 E0082C24 ACB10018 */  sw        $s1, 0x18($a1)
/* 386268 E0082C28 ACA4000C */  sw        $a0, 0xC($a1)
/* 38626C E0082C2C 8C630000 */  lw        $v1, 0x0($v1)
/* 386270 E0082C30 24A20028 */  addiu     $v0, $a1, 0x28
/* 386274 E0082C34 AE020000 */  sw        $v0, 0x0($s0)
/* 386278 E0082C38 3C020900 */  lui       $v0, %hi(D_09002270_40F500)
/* 38627C E0082C3C 24422270 */  addiu     $v0, $v0, %lo(D_09002270_40F500)
/* 386280 E0082C40 ACB10020 */  sw        $s1, 0x20($a1)
/* 386284 E0082C44 ACA20024 */  sw        $v0, 0x24($a1)
/* 386288 E0082C48 ACA3001C */  sw        $v1, 0x1C($a1)
.LE0082C4C:
/* 38628C E0082C4C 3C02D838 */  lui       $v0, (0xD8380002 >> 16)
.LE0082C50:
/* 386290 E0082C50 34420002 */  ori       $v0, $v0, (0xD8380002 & 0xFFFF)
/* 386294 E0082C54 26940001 */  addiu     $s4, $s4, 0x1
/* 386298 E0082C58 8E040000 */  lw        $a0, 0x0($s0)
/* 38629C E0082C5C 26730048 */  addiu     $s3, $s3, 0x48
/* 3862A0 E0082C60 0080182D */  daddu     $v1, $a0, $zero
/* 3862A4 E0082C64 AC620000 */  sw        $v0, 0x0($v1)
/* 3862A8 E0082C68 24020040 */  addiu     $v0, $zero, 0x40
/* 3862AC E0082C6C AC620004 */  sw        $v0, 0x4($v1)
/* 3862B0 E0082C70 8EC20008 */  lw        $v0, 0x8($s6)
/* 3862B4 E0082C74 24840008 */  addiu     $a0, $a0, 0x8
/* 3862B8 E0082C78 0282102A */  slt       $v0, $s4, $v0
/* 3862BC E0082C7C 1440FFB3 */  bnez      $v0, .LE0082B4C
/* 3862C0 E0082C80 AE040000 */   sw       $a0, 0x0($s0)
.LE0082C84:
/* 3862C4 E0082C84 3C03D838 */  lui       $v1, (0xD8380002 >> 16)
/* 3862C8 E0082C88 3C04800A */  lui       $a0, %hi(gMainGfxPos)
/* 3862CC E0082C8C 2484A66C */  addiu     $a0, $a0, %lo(gMainGfxPos)
/* 3862D0 E0082C90 8C820000 */  lw        $v0, 0x0($a0)
/* 3862D4 E0082C94 34630002 */  ori       $v1, $v1, (0xD8380002 & 0xFFFF)
/* 3862D8 E0082C98 0040282D */  daddu     $a1, $v0, $zero
/* 3862DC E0082C9C 24420008 */  addiu     $v0, $v0, 0x8
/* 3862E0 E0082CA0 AC820000 */  sw        $v0, 0x0($a0)
/* 3862E4 E0082CA4 ACA30000 */  sw        $v1, 0x0($a1)
/* 3862E8 E0082CA8 24030040 */  addiu     $v1, $zero, 0x40
/* 3862EC E0082CAC ACA30004 */  sw        $v1, 0x4($a1)
/* 3862F0 E0082CB0 24430008 */  addiu     $v1, $v0, 0x8
/* 3862F4 E0082CB4 AC830000 */  sw        $v1, 0x0($a0)
/* 3862F8 E0082CB8 3C03E700 */  lui       $v1, (0xE7000000 >> 16)
/* 3862FC E0082CBC AC430000 */  sw        $v1, 0x0($v0)
/* 386300 E0082CC0 AC400004 */  sw        $zero, 0x4($v0)
/* 386304 E0082CC4 8FBF0034 */  lw        $ra, 0x34($sp)
/* 386308 E0082CC8 8FBE0030 */  lw        $fp, 0x30($sp)
/* 38630C E0082CCC 8FB7002C */  lw        $s7, 0x2C($sp)
/* 386310 E0082CD0 8FB60028 */  lw        $s6, 0x28($sp)
/* 386314 E0082CD4 8FB50024 */  lw        $s5, 0x24($sp)
/* 386318 E0082CD8 8FB40020 */  lw        $s4, 0x20($sp)
/* 38631C E0082CDC 8FB3001C */  lw        $s3, 0x1C($sp)
/* 386320 E0082CE0 8FB20018 */  lw        $s2, 0x18($sp)
/* 386324 E0082CE4 8FB10014 */  lw        $s1, 0x14($sp)
/* 386328 E0082CE8 8FB00010 */  lw        $s0, 0x10($sp)
/* 38632C E0082CEC 03E00008 */  jr        $ra
/* 386330 E0082CF0 27BD0038 */   addiu    $sp, $sp, 0x38
/* 386334 E0082CF4 00000000 */  nop
/* 386338 E0082CF8 00000000 */  nop
/* 38633C E0082CFC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void func_E0082A84(EffectInstance* effect) {
    DisableXFXData* data = effect->data.disableX;
    s32 unk_38;
    s32 i;

    gDPPipeSync(gMainGfxPos++);
    gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->graphics->data));
    func_E0082580(data);
    unk_38 = data->unk_38;

    data++;
    for (i = 1; i < effect->numParts; i++, data++) {
        func_E00826C4(data);
        if (unk_38 > 0) {
            gSPDisplayList(gMainGfxPos++, D_090022B0_388660);
            if (unk_38 < 10) {
                gSPDisplayList(gMainGfxPos++, D_E0082D00[unk_38]);
                gSPDisplayList(gMainGfxPos++, D_09002250_388600);
            } else {
                s32 ones = unk_38 % 10;
                s32 tens = unk_38 / 10;

                gSPDisplayList(gMainGfxPos++, D_E0082D00[ones]);
                gSPDisplayList(gMainGfxPos++, D_E0082D00[tens]);
                gSPDisplayList(gMainGfxPos++, D_09002290_388640);
                gSPDisplayList(gMainGfxPos++, D_E0082D00[tens]);
                gSPDisplayList(gMainGfxPos++, D_09002270_388620);
            }
        }
        gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    }
    gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    gDPPipeSync(gMainGfxPos++);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel drop_leaves_update
/* 33D038 E0028248 27BDFFC8 */  addiu     $sp, $sp, -0x38
/* 33D03C E002824C AFB3001C */  sw        $s3, 0x1C($sp)
/* 33D040 E0028250 0080982D */  daddu     $s3, $a0, $zero
/* 33D044 E0028254 AFBF0024 */  sw        $ra, 0x24($sp)
/* 33D048 E0028258 AFB40020 */  sw        $s4, 0x20($sp)
/* 33D04C E002825C AFB20018 */  sw        $s2, 0x18($sp)
/* 33D050 E0028260 AFB10014 */  sw        $s1, 0x14($sp)
/* 33D054 E0028264 AFB00010 */  sw        $s0, 0x10($sp)
/* 33D058 E0028268 F7B60030 */  sdc1      $f22, 0x30($sp)
/* 33D05C E002826C F7B40028 */  sdc1      $f20, 0x28($sp)
/* 33D060 E0028270 8E64000C */  lw        $a0, 0xC($s3)
/* 33D064 E0028274 8C820028 */  lw        $v0, 0x28($a0)
/* 33D068 E0028278 8C85002C */  lw        $a1, 0x2C($a0)
/* 33D06C E002827C 2442FFFF */  addiu     $v0, $v0, -0x1
/* 33D070 E0028280 AC820028 */  sw        $v0, 0x28($a0)
/* 33D074 E0028284 0040302D */  daddu     $a2, $v0, $zero
/* 33D078 E0028288 24A20001 */  addiu     $v0, $a1, 0x1
/* 33D07C E002828C 04C10005 */  bgez      $a2, .LE00282A4
/* 33D080 E0028290 AC82002C */   sw       $v0, 0x2C($a0)
/* 33D084 E0028294 0C080128 */  jal       shim_remove_effect
/* 33D088 E0028298 0260202D */   daddu    $a0, $s3, $zero
/* 33D08C E002829C 0800A130 */  j         .LE00284C0
/* 33D090 E00282A0 00000000 */   nop
.LE00282A4:
/* 33D094 E00282A4 8C940000 */  lw        $s4, 0x0($a0)
/* 33D098 E00282A8 2842000A */  slti      $v0, $v0, 0xA
/* 33D09C E00282AC 10400010 */  beqz      $v0, .LE00282F0
/* 33D0A0 E00282B0 240200FF */   addiu    $v0, $zero, 0xFF
/* 33D0A4 E00282B4 8C830024 */  lw        $v1, 0x24($a0)
/* 33D0A8 E00282B8 3C01E003 */  lui       $at, (0xE0030000 >> 16)
/* 33D0AC E00282BC D42087E0 */  ldc1      $f0, -0x7820($at)
/* 33D0B0 E00282C0 00431023 */  subu      $v0, $v0, $v1
/* 33D0B4 E00282C4 44821000 */  mtc1      $v0, $f2
/* 33D0B8 E00282C8 00000000 */  nop
/* 33D0BC E00282CC 468010A1 */  cvt.d.w   $f2, $f2
/* 33D0C0 E00282D0 46201082 */  mul.d     $f2, $f2, $f0
/* 33D0C4 E00282D4 00000000 */  nop
/* 33D0C8 E00282D8 44830000 */  mtc1      $v1, $f0
/* 33D0CC E00282DC 00000000 */  nop
/* 33D0D0 E00282E0 46800021 */  cvt.d.w   $f0, $f0
/* 33D0D4 E00282E4 46220000 */  add.d     $f0, $f0, $f2
/* 33D0D8 E00282E8 4620020D */  trunc.w.d $f8, $f0
/* 33D0DC E00282EC E4880024 */  swc1      $f8, 0x24($a0)
.LE00282F0:
/* 33D0E0 E00282F0 28C2000A */  slti      $v0, $a2, 0xA
/* 33D0E4 E00282F4 10400009 */  beqz      $v0, .LE002831C
/* 33D0E8 E00282F8 00000000 */   nop
/* 33D0EC E00282FC 3C01E003 */  lui       $at, (0xE0030000 >> 16)
/* 33D0F0 E0028300 D42287E8 */  ldc1      $f2, -0x7818($at)
/* 33D0F4 E0028304 C4800024 */  lwc1      $f0, 0x24($a0)
/* 33D0F8 E0028308 46800021 */  cvt.d.w   $f0, $f0
/* 33D0FC E002830C 46220002 */  mul.d     $f0, $f0, $f2
/* 33D100 E0028310 00000000 */  nop
/* 33D104 E0028314 4620020D */  trunc.w.d $f8, $f0
/* 33D108 E0028318 E4880024 */  swc1      $f8, 0x24($a0)
.LE002831C:
/* 33D10C E002831C 8E620008 */  lw        $v0, 0x8($s3)
/* 33D110 E0028320 24110001 */  addiu     $s1, $zero, 0x1
/* 33D114 E0028324 0222102A */  slt       $v0, $s1, $v0
/* 33D118 E0028328 10400065 */  beqz      $v0, .LE00284C0
/* 33D11C E002832C 24840030 */   addiu    $a0, $a0, 0x30
/* 33D120 E0028330 24900008 */  addiu     $s0, $a0, 0x8
/* 33D124 E0028334 24B20015 */  addiu     $s2, $a1, 0x15
/* 33D128 E0028338 3C01BD4C */  lui       $at, (0xBD4CCCCD >> 16)
/* 33D12C E002833C 3421CCCD */  ori       $at, $at, (0xBD4CCCCD & 0xFFFF)
/* 33D130 E0028340 4481B000 */  mtc1      $at, $f22
/* 33D134 E0028344 3C014120 */  lui       $at, (0x41200000 >> 16)
/* 33D138 E0028348 4481A000 */  mtc1      $at, $f20
.LE002834C:
/* 33D13C E002834C C60C0010 */  lwc1      $f12, 0x10($s0)
/* 33D140 E0028350 0C080140 */  jal       shim_sin_deg
/* 33D144 E0028354 460C6300 */   add.s    $f12, $f12, $f12
/* 33D148 E0028358 3C01E003 */  lui       $at, (0xE0030000 >> 16)
/* 33D14C E002835C D42287F0 */  ldc1      $f2, -0x7810($at)
/* 33D150 E0028360 46000021 */  cvt.d.s   $f0, $f0
/* 33D154 E0028364 46220002 */  mul.d     $f0, $f0, $f2
/* 33D158 E0028368 00000000 */  nop
/* 33D15C E002836C C602000C */  lwc1      $f2, 0xC($s0)
/* 33D160 E0028370 46161080 */  add.s     $f2, $f2, $f22
/* 33D164 E0028374 C6040008 */  lwc1      $f4, 0x8($s0)
/* 33D168 E0028378 46200020 */  cvt.s.d   $f0, $f0
/* 33D16C E002837C 46002000 */  add.s     $f0, $f4, $f0
/* 33D170 E0028380 E602000C */  swc1      $f2, 0xC($s0)
/* 33D174 E0028384 16800019 */  bnez      $s4, .LE00283EC
/* 33D178 E0028388 E6000008 */   swc1     $f0, 0x8($s0)
/* 33D17C E002838C 3C01E003 */  lui       $at, (0xE0030000 >> 16)
/* 33D180 E0028390 D42287F8 */  ldc1      $f2, -0x7808($at)
/* 33D184 E0028394 46000021 */  cvt.d.s   $f0, $f0
/* 33D188 E0028398 46220002 */  mul.d     $f0, $f0, $f2
/* 33D18C E002839C 00000000 */  nop
/* 33D190 E00283A0 C60C0010 */  lwc1      $f12, 0x10($s0)
/* 33D194 E00283A4 46200020 */  cvt.s.d   $f0, $f0
/* 33D198 E00283A8 0C080140 */  jal       shim_sin_deg
/* 33D19C E00283AC E6000008 */   swc1     $f0, 0x8($s0)
/* 33D1A0 E00283B0 3C01E003 */  lui       $at, (0xE0030000 >> 16)
/* 33D1A4 E00283B4 D4228800 */  ldc1      $f2, -0x7800($at)
/* 33D1A8 E00283B8 46000021 */  cvt.d.s   $f0, $f0
/* 33D1AC E00283BC 46220002 */  mul.d     $f0, $f0, $f2
/* 33D1B0 E00283C0 00000000 */  nop
/* 33D1B4 E00283C4 3C01E003 */  lui       $at, (0xE0030000 >> 16)
/* 33D1B8 E00283C8 D4248808 */  ldc1      $f4, -0x77F8($at)
/* 33D1BC E00283CC C602000C */  lwc1      $f2, 0xC($s0)
/* 33D1C0 E00283D0 46240000 */  add.d     $f0, $f0, $f4
/* 33D1C4 E00283D4 460010A1 */  cvt.d.s   $f2, $f2
/* 33D1C8 E00283D8 46201082 */  mul.d     $f2, $f2, $f0
/* 33D1CC E00283DC 00000000 */  nop
/* 33D1D0 E00283E0 462010A0 */  cvt.s.d   $f2, $f2
/* 33D1D4 E00283E4 0800A106 */  j         .LE0028418
/* 33D1D8 E00283E8 E602000C */   swc1     $f2, 0xC($s0)
.LE00283EC:
/* 33D1DC E00283EC C6000008 */  lwc1      $f0, 0x8($s0)
/* 33D1E0 E00283F0 3C01E003 */  lui       $at, (0xE0030000 >> 16)
/* 33D1E4 E00283F4 D4228810 */  ldc1      $f2, -0x77F0($at)
/* 33D1E8 E00283F8 46000021 */  cvt.d.s   $f0, $f0
/* 33D1EC E00283FC 46220002 */  mul.d     $f0, $f0, $f2
/* 33D1F0 E0028400 00000000 */  nop
/* 33D1F4 E0028404 C602000C */  lwc1      $f2, 0xC($s0)
/* 33D1F8 E0028408 46161080 */  add.s     $f2, $f2, $f22
/* 33D1FC E002840C E602000C */  swc1      $f2, 0xC($s0)
/* 33D200 E0028410 46200020 */  cvt.s.d   $f0, $f0
/* 33D204 E0028414 E6000008 */  swc1      $f0, 0x8($s0)
.LE0028418:
/* 33D208 E0028418 24040032 */  addiu     $a0, $zero, 0x32
/* 33D20C E002841C 0C080011 */  jal       func_E0200044
/* 33D210 E0028420 0240282D */   daddu    $a1, $s2, $zero
/* 33D214 E0028424 2442FFE7 */  addiu     $v0, $v0, -0x19
/* 33D218 E0028428 C60C0014 */  lwc1      $f12, 0x14($s0)
/* 33D21C E002842C 44820000 */  mtc1      $v0, $f0
/* 33D220 E0028430 00000000 */  nop
/* 33D224 E0028434 46800020 */  cvt.s.w   $f0, $f0
/* 33D228 E0028438 46006300 */  add.s     $f12, $f12, $f0
/* 33D22C E002843C 0C080140 */  jal       shim_sin_deg
/* 33D230 E0028440 E60C0014 */   swc1     $f12, 0x14($s0)
/* 33D234 E0028444 46140002 */  mul.s     $f0, $f0, $f20
/* 33D238 E0028448 00000000 */  nop
/* 33D23C E002844C C6020014 */  lwc1      $f2, 0x14($s0)
/* 33D240 E0028450 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* 33D244 E0028454 44816000 */  mtc1      $at, $f12
/* 33D248 E0028458 00000000 */  nop
/* 33D24C E002845C 460C1302 */  mul.s     $f12, $f2, $f12
/* 33D250 E0028460 00000000 */  nop
/* 33D254 E0028464 C6020010 */  lwc1      $f2, 0x10($s0)
/* 33D258 E0028468 46001080 */  add.s     $f2, $f2, $f0
/* 33D25C E002846C 0C080144 */  jal       shim_cos_deg
/* 33D260 E0028470 E6020010 */   swc1     $f2, 0x10($s0)
/* 33D264 E0028474 46140002 */  mul.s     $f0, $f0, $f20
/* 33D268 E0028478 00000000 */  nop
/* 33D26C E002847C C606FFFC */  lwc1      $f6, -0x4($s0)
/* 33D270 E0028480 C6020008 */  lwc1      $f2, 0x8($s0)
/* 33D274 E0028484 C6040000 */  lwc1      $f4, 0x0($s0)
/* 33D278 E0028488 46023180 */  add.s     $f6, $f6, $f2
/* 33D27C E002848C C602000C */  lwc1      $f2, 0xC($s0)
/* 33D280 E0028490 26520014 */  addiu     $s2, $s2, 0x14
/* 33D284 E0028494 46022100 */  add.s     $f4, $f4, $f2
/* 33D288 E0028498 C6020018 */  lwc1      $f2, 0x18($s0)
/* 33D28C E002849C 26310001 */  addiu     $s1, $s1, 0x1
/* 33D290 E00284A0 46001080 */  add.s     $f2, $f2, $f0
/* 33D294 E00284A4 E606FFFC */  swc1      $f6, -0x4($s0)
/* 33D298 E00284A8 E6040000 */  swc1      $f4, 0x0($s0)
/* 33D29C E00284AC E6020018 */  swc1      $f2, 0x18($s0)
/* 33D2A0 E00284B0 8E620008 */  lw        $v0, 0x8($s3)
/* 33D2A4 E00284B4 0222102A */  slt       $v0, $s1, $v0
/* 33D2A8 E00284B8 1440FFA4 */  bnez      $v0, .LE002834C
/* 33D2AC E00284BC 26100030 */   addiu    $s0, $s0, 0x30
.LE00284C0:
/* 33D2B0 E00284C0 8FBF0024 */  lw        $ra, 0x24($sp)
/* 33D2B4 E00284C4 8FB40020 */  lw        $s4, 0x20($sp)
/* 33D2B8 E00284C8 8FB3001C */  lw        $s3, 0x1C($sp)
/* 33D2BC E00284CC 8FB20018 */  lw        $s2, 0x18($sp)
/* 33D2C0 E00284D0 8FB10014 */  lw        $s1, 0x14($sp)
/* 33D2C4 E00284D4 8FB00010 */  lw        $s0, 0x10($sp)
/* 33D2C8 E00284D8 D7B60030 */  ldc1      $f22, 0x30($sp)
/* 33D2CC E00284DC D7B40028 */  ldc1      $f20, 0x28($sp)
/* 33D2D0 E00284E0 03E00008 */  jr        $ra
/* 33D2D4 E00284E4 27BD0038 */   addiu    $sp, $sp, 0x38

### DECOMPILED C INSTRUCTIONS:

void drop_leaves_update(EffectInstance *effect) {
    DropLeavesFXData* part = effect->data.dropLeaves;
    s32 unk_00;
    s32 unk_28;
    s32 unk_2C;
    f32 temp;
    s32 i;

    part->unk_28--;
    part->unk_2C++;

    if (part->unk_28 < 0) {
        shim_remove_effect(effect);
        return;
    }

    unk_00 = part->unk_00;
    unk_28 = part->unk_28;
    unk_2C = part->unk_2C;

    if (unk_2C < 10) {
        part->unk_24 += (255 - part->unk_24) * 0.3;
    }
    if (unk_28 < 10) {
        part->unk_24 *= 0.8;
    }

    part++;
    for (i = 1; i < effect->numParts; i++, part++) {
        temp = shim_sin_deg(2.0f * part->unk_18) * 0.2;

        part->unk_14 += -0.05f;
        part->unk_10 += temp;

        if (unk_00 == 0) {
            part->unk_10 *= 0.94;
            part->unk_14 *= shim_sin_deg(part->unk_18) * 0.05 + 0.95;
        } else {
            part->unk_14 += -0.05f;
            part->unk_10 *= 0.92;
        }

        part->unk_1C += func_E0200044(50, unk_2C + i * 20) - 25;
        part->unk_18 += shim_sin_deg(part->unk_1C) * 10.0f;
        part->unk_20 += shim_cos_deg(part->unk_1C * 0.5f) * 10.0f;
        part->unk_04 += part->unk_10;
        part->unk_08 += part->unk_14;
    }
}