### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_802550BC
/* 18399C 802550BC 27BDFFB8 */  addiu     $sp, $sp, -0x48
/* 1839A0 802550C0 AFB50024 */  sw        $s5, 0x24($sp)
/* 1839A4 802550C4 00A0A82D */  daddu     $s5, $a1, $zero
/* 1839A8 802550C8 AFB40020 */  sw        $s4, 0x20($sp)
/* 1839AC 802550CC AFBF0030 */  sw        $ra, 0x30($sp)
/* 1839B0 802550D0 AFB7002C */  sw        $s7, 0x2C($sp)
/* 1839B4 802550D4 AFB60028 */  sw        $s6, 0x28($sp)
/* 1839B8 802550D8 AFB3001C */  sw        $s3, 0x1C($sp)
/* 1839BC 802550DC AFB20018 */  sw        $s2, 0x18($sp)
/* 1839C0 802550E0 AFB10014 */  sw        $s1, 0x14($sp)
/* 1839C4 802550E4 AFB00010 */  sw        $s0, 0x10($sp)
/* 1839C8 802550E8 F7B60040 */  sdc1      $f22, 0x40($sp)
/* 1839CC 802550EC F7B40038 */  sdc1      $f20, 0x38($sp)
/* 1839D0 802550F0 82B601F3 */  lb        $s6, 0x1F3($s5)
/* 1839D4 802550F4 8EB201F4 */  lw        $s2, 0x1F4($s5)
/* 1839D8 802550F8 1AC0006F */  blez      $s6, .L802552B8
/* 1839DC 802550FC 0000A02D */   daddu    $s4, $zero, $zero
/* 1839E0 80255100 3C178000 */  lui       $s7, (0x80000000 >> 16)
/* 1839E4 80255104 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* 1839E8 80255108 4481B000 */  mtc1      $at, $f22
/* 1839EC 8025510C 3C014F00 */  lui       $at, (0x4F000000 >> 16)
/* 1839F0 80255110 4481A000 */  mtc1      $at, $f20
.L80255114:
/* 1839F4 80255114 8E430000 */  lw        $v1, 0x0($s2)
/* 1839F8 80255118 30620001 */  andi      $v0, $v1, 0x1
/* 1839FC 8025511C 14400006 */  bnez      $v0, .L80255138
/* 183A00 80255120 00000000 */   nop
/* 183A04 80255124 8E420094 */  lw        $v0, 0x94($s2)
/* 183A08 80255128 10400003 */  beqz      $v0, .L80255138
/* 183A0C 8025512C 30620002 */   andi     $v0, $v1, 0x2
/* 183A10 80255130 10400004 */  beqz      $v0, .L80255144
/* 183A14 80255134 00000000 */   nop
.L80255138:
/* 183A18 80255138 8E52000C */  lw        $s2, 0xC($s2)
/* 183A1C 8025513C 080954AB */  j         .L802552AC
/* 183A20 80255140 26940001 */   addiu    $s4, $s4, 0x1
.L80255144:
/* 183A24 80255144 8E5300C0 */  lw        $s3, 0xC0($s2)
/* 183A28 80255148 C6400058 */  lwc1      $f0, 0x58($s2)
/* 183A2C 8025514C 827107D9 */  lb        $s1, 0x7D9($s3)
/* 183A30 80255150 4600008D */  trunc.w.s $f2, $f0
/* 183A34 80255154 44021000 */  mfc1      $v0, $f2
/* 183A38 80255158 00111840 */  sll       $v1, $s1, 1
/* 183A3C 8025515C 02631821 */  addu      $v1, $s3, $v1
D_80255160:
/* 183A40 80255160 A46207FC */  sh        $v0, 0x7FC($v1)
/* 183A44 80255164 C640005C */  lwc1      $f0, 0x5C($s2)
/* 183A48 80255168 4600008D */  trunc.w.s $f2, $f0
/* 183A4C 8025516C 44021000 */  mfc1      $v0, $f2
/* 183A50 80255170 00000000 */  nop
/* 183A54 80255174 A462081C */  sh        $v0, 0x81C($v1)
/* 183A58 80255178 C6400060 */  lwc1      $f0, 0x60($s2)
/* 183A5C 8025517C 4600008D */  trunc.w.s $f2, $f0
/* 183A60 80255180 44021000 */  mfc1      $v0, $f2
/* 183A64 80255184 00000000 */  nop
/* 183A68 80255188 A462083C */  sh        $v0, 0x83C($v1)
/* 183A6C 8025518C C6A0018C */  lwc1      $f0, 0x18C($s5)
D_80255190:
/* 183A70 80255190 4600008D */  trunc.w.s $f2, $f0
/* 183A74 80255194 44021000 */  mfc1      $v0, $f2
/* 183A78 80255198 00000000 */  nop
/* 183A7C 8025519C A46207DC */  sh        $v0, 0x7DC($v1)
/* 183A80 802551A0 92A20169 */  lbu       $v0, 0x169($s5)
/* 183A84 802551A4 02718021 */  addu      $s0, $s3, $s1
/* 183A88 802551A8 A202085C */  sb        $v0, 0x85C($s0)
/* 183A8C 802551AC 92A2016B */  lbu       $v0, 0x16B($s5)
/* 183A90 802551B0 A202086C */  sb        $v0, 0x86C($s0)
/* 183A94 802551B4 C6AC015C */  lwc1      $f12, 0x15C($s5)
/* 183A98 802551B8 0C00A6C9 */  jal       clamp_angle
/* 183A9C 802551BC 2610087C */   addiu    $s0, $s0, 0x87C
/* 183AA0 802551C0 46160002 */  mul.s     $f0, $f0, $f22
/* 183AA4 802551C4 00000000 */  nop
/* 183AA8 802551C8 4600A03E */  c.le.s    $f20, $f0
/* 183AAC 802551CC 00000000 */  nop
/* 183AB0 802551D0 45030005 */  bc1tl     .L802551E8
/* 183AB4 802551D4 46140001 */   sub.s    $f0, $f0, $f20
/* 183AB8 802551D8 4600008D */  trunc.w.s $f2, $f0
/* 183ABC 802551DC 44021000 */  mfc1      $v0, $f2
/* 183AC0 802551E0 0809547F */  j         .L802551FC
/* 183AC4 802551E4 A2020000 */   sb       $v0, 0x0($s0)
.L802551E8:
/* 183AC8 802551E8 4600008D */  trunc.w.s $f2, $f0
/* 183ACC 802551EC 44021000 */  mfc1      $v0, $f2
/* 183AD0 802551F0 00000000 */  nop
/* 183AD4 802551F4 00571025 */  or        $v0, $v0, $s7
/* 183AD8 802551F8 A2020000 */  sb        $v0, 0x0($s0)
.L802551FC:
/* 183ADC 802551FC 0C00A6C9 */  jal       clamp_angle
/* 183AE0 80255200 C6AC0160 */   lwc1     $f12, 0x160($s5)
/* 183AE4 80255204 46160002 */  mul.s     $f0, $f0, $f22
/* 183AE8 80255208 00000000 */  nop
/* 183AEC 8025520C 02711021 */  addu      $v0, $s3, $s1
/* 183AF0 80255210 4600A03E */  c.le.s    $f20, $f0
/* 183AF4 80255214 00000000 */  nop
/* 183AF8 80255218 45010005 */  bc1t      .L80255230
/* 183AFC 8025521C 2442088C */   addiu    $v0, $v0, 0x88C
/* 183B00 80255220 4600008D */  trunc.w.s $f2, $f0
/* 183B04 80255224 44031000 */  mfc1      $v1, $f2
/* 183B08 80255228 08095492 */  j         .L80255248
/* 183B0C 8025522C A0430000 */   sb       $v1, 0x0($v0)
.L80255230:
/* 183B10 80255230 46140001 */  sub.s     $f0, $f0, $f20
/* 183B14 80255234 4600008D */  trunc.w.s $f2, $f0
/* 183B18 80255238 44031000 */  mfc1      $v1, $f2
/* 183B1C 8025523C 00000000 */  nop
D_80255240:
/* 183B20 80255240 00771825 */  or        $v1, $v1, $s7
/* 183B24 80255244 A0430000 */  sb        $v1, 0x0($v0)
.L80255248:
/* 183B28 80255248 0C00A6C9 */  jal       clamp_angle
/* 183B2C 8025524C C6AC0164 */   lwc1     $f12, 0x164($s5)
/* 183B30 80255250 46160002 */  mul.s     $f0, $f0, $f22
/* 183B34 80255254 00000000 */  nop
/* 183B38 80255258 02711021 */  addu      $v0, $s3, $s1
/* 183B3C 8025525C 4600A03E */  c.le.s    $f20, $f0
/* 183B40 80255260 00000000 */  nop
/* 183B44 80255264 45010005 */  bc1t      .L8025527C
/* 183B48 80255268 2442089C */   addiu    $v0, $v0, 0x89C
/* 183B4C 8025526C 4600008D */  trunc.w.s $f2, $f0
/* 183B50 80255270 44031000 */  mfc1      $v1, $f2
/* 183B54 80255274 080954A5 */  j         .L80255294
/* 183B58 80255278 A0430000 */   sb       $v1, 0x0($v0)
.L8025527C:
/* 183B5C 8025527C 46140001 */  sub.s     $f0, $f0, $f20
D_80255280:
/* 183B60 80255280 4600008D */  trunc.w.s $f2, $f0
/* 183B64 80255284 44031000 */  mfc1      $v1, $f2
/* 183B68 80255288 00000000 */  nop
/* 183B6C 8025528C 00771825 */  or        $v1, $v1, $s7
/* 183B70 80255290 A0430000 */  sb        $v1, 0x0($v0)
.L80255294:
/* 183B74 80255294 26310001 */  addiu     $s1, $s1, 0x1
/* 183B78 80255298 2A220010 */  slti      $v0, $s1, 0x10
/* 183B7C 8025529C 50400001 */  beql      $v0, $zero, .L802552A4
/* 183B80 802552A0 0000882D */   daddu    $s1, $zero, $zero
.L802552A4:
/* 183B84 802552A4 A27107D9 */  sb        $s1, 0x7D9($s3)
/* 183B88 802552A8 26940001 */  addiu     $s4, $s4, 0x1
.L802552AC:
/* 183B8C 802552AC 0296102A */  slt       $v0, $s4, $s6
/* 183B90 802552B0 1440FF98 */  bnez      $v0, .L80255114
/* 183B94 802552B4 00000000 */   nop
.L802552B8:
/* 183B98 802552B8 8FBF0030 */  lw        $ra, 0x30($sp)
/* 183B9C 802552BC 8FB7002C */  lw        $s7, 0x2C($sp)
/* 183BA0 802552C0 8FB60028 */  lw        $s6, 0x28($sp)
/* 183BA4 802552C4 8FB50024 */  lw        $s5, 0x24($sp)
/* 183BA8 802552C8 8FB40020 */  lw        $s4, 0x20($sp)
/* 183BAC 802552CC 8FB3001C */  lw        $s3, 0x1C($sp)
/* 183BB0 802552D0 8FB20018 */  lw        $s2, 0x18($sp)
/* 183BB4 802552D4 8FB10014 */  lw        $s1, 0x14($sp)
/* 183BB8 802552D8 8FB00010 */  lw        $s0, 0x10($sp)
/* 183BBC 802552DC D7B60040 */  ldc1      $f22, 0x40($sp)
/* 183BC0 802552E0 D7B40038 */  ldc1      $f20, 0x38($sp)
/* 183BC4 802552E4 03E00008 */  jr        $ra
/* 183BC8 802552E8 27BD0048 */   addiu    $sp, $sp, 0x48

### DECOMPILED C INSTRUCTIONS:

void func_802550BC(s32 arg0, Actor* actor) {
    s32 numParts = actor->numParts;
    ActorPart* partsTable = actor->partsTable;
    DecorationTable* decorationTable;
    s32 i, j;

    for (i = 0; i < numParts; i++) {
        if (partsTable->flags & ACTOR_PART_FLAG_INVISIBLE || partsTable->idleAnimations == NULL || partsTable->flags & ACTOR_PART_FLAG_2) {
            partsTable = partsTable->nextPart;
        } else {
            decorationTable = partsTable->decorationTable;
            j = decorationTable->unk_7D9;

            decorationTable->posX[j] = partsTable->currentPos.x;
            decorationTable->posY[j] = partsTable->currentPos.y;
            decorationTable->posZ[j] = partsTable->currentPos.z;
            decorationTable->yaw[j] = actor->yaw;

            decorationTable->rotationPivotOffsetX[j] = actor->rotationPivotOffset.x;
            decorationTable->rotationPivotOffsetY[j] = actor->rotationPivotOffset.y;

            decorationTable->rotX[j] = clamp_angle(actor->rotation.x) * 0.5f;
            decorationTable->rotY[j] = clamp_angle(actor->rotation.y) * 0.5f;
            decorationTable->rotZ[j] = clamp_angle(actor->rotation.z) * 0.5f;

            j++;
            if (j >= ARRAY_COUNT(decorationTable->posX)) {
                j = 0;
            }
            decorationTable->unk_7D9 = j;
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel ALT_clear_hud_element_cache
/* DB15C 80144A5C 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* DB160 80144A60 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* DB164 80144A64 27BDFFE8 */  addiu     $sp, $sp, -0x18
/* DB168 80144A68 AFBF0014 */  sw        $ra, 0x14($sp)
/* DB16C 80144A6C AFB00010 */  sw        $s0, 0x10($sp)
/* DB170 80144A70 80420070 */  lb        $v0, 0x70($v0)
/* DB174 80144A74 14400030 */  bnez      $v0, .L80144B38
/* DB178 80144A78 00000000 */   nop
/* DB17C 80144A7C 3C108015 */  lui       $s0, %hi(gHudElementCacheBuffer)
/* DB180 80144A80 26101314 */  addiu     $s0, $s0, %lo(gHudElementCacheBuffer)
/* DB184 80144A84 0C00AB4B */  jal       heap_free
/* DB188 80144A88 8E040000 */   lw       $a0, 0x0($s0)
/* DB18C 80144A8C 3C048015 */  lui       $a0, %hi(gHudElementCacheCapacity)
/* DB190 80144A90 0C00AB39 */  jal       heap_malloc
/* DB194 80144A94 8C84EFC4 */   lw       $a0, %lo(gHudElementCacheCapacity)($a0)
/* DB198 80144A98 14400003 */  bnez      $v0, .L80144AA8
/* DB19C 80144A9C AE020000 */   sw       $v0, 0x0($s0)
.L80144AA0:
/* DB1A0 80144AA0 080512A8 */  j         .L80144AA0
/* DB1A4 80144AA4 00000000 */   nop
.L80144AA8:
/* DB1A8 80144AA8 0000482D */  daddu     $t1, $zero, $zero
/* DB1AC 80144AAC 240AFFFF */  addiu     $t2, $zero, -0x1
/* DB1B0 80144AB0 3C028015 */  lui       $v0, %hi(gHudElementCacheTablePaletteWorld)
/* DB1B4 80144AB4 24427F70 */  addiu     $v0, $v0, %lo(gHudElementCacheTablePaletteWorld)
/* DB1B8 80144AB8 0040402D */  daddu     $t0, $v0, $zero
/* DB1BC 80144ABC 3C028015 */  lui       $v0, %hi(gHudElementCacheTableRasterWorld)
/* DB1C0 80144AC0 24427970 */  addiu     $v0, $v0, %lo(gHudElementCacheTableRasterWorld)
/* DB1C4 80144AC4 0040382D */  daddu     $a3, $v0, $zero
/* DB1C8 80144AC8 3C068015 */  lui       $a2, %hi(gHudElementCacheBuffer)
/* DB1CC 80144ACC 24C61314 */  addiu     $a2, $a2, %lo(gHudElementCacheBuffer)
/* DB1D0 80144AD0 3C058015 */  lui       $a1, %hi(gHudElementCacheSize)
/* DB1D4 80144AD4 24A5133C */  addiu     $a1, $a1, %lo(gHudElementCacheSize)
/* DB1D8 80144AD8 8CC30000 */  lw        $v1, 0x0($a2)
/* DB1DC 80144ADC 8CA40000 */  lw        $a0, 0x0($a1)
/* DB1E0 80144AE0 3C028015 */  lui       $v0, %hi(gHudElementCacheBufferWorld)
/* DB1E4 80144AE4 24427964 */  addiu     $v0, $v0, %lo(gHudElementCacheBufferWorld)
/* DB1E8 80144AE8 AC430000 */  sw        $v1, 0x0($v0)
/* DB1EC 80144AEC AC800000 */  sw        $zero, 0x0($a0)
/* DB1F0 80144AF0 8C430000 */  lw        $v1, 0x0($v0)
/* DB1F4 80144AF4 3C028015 */  lui       $v0, %hi(gHudElementCacheSizeWorld)
/* DB1F8 80144AF8 24427968 */  addiu     $v0, $v0, %lo(gHudElementCacheSizeWorld)
/* DB1FC 80144AFC ACA20000 */  sw        $v0, 0x0($a1)
/* DB200 80144B00 3C018015 */  lui       $at, %hi(gHudElementCacheTableRaster)
/* DB204 80144B04 AC2712C8 */  sw        $a3, %lo(gHudElementCacheTableRaster)($at)
/* DB208 80144B08 3C018015 */  lui       $at, %hi(gHudElementCacheTablePalette)
/* DB20C 80144B0C AC2812D0 */  sw        $t0, %lo(gHudElementCacheTablePalette)($at)
/* DB210 80144B10 ACC30000 */  sw        $v1, 0x0($a2)
.L80144B14:
/* DB214 80144B14 ACEA0000 */  sw        $t2, 0x0($a3)
/* DB218 80144B18 AD0A0000 */  sw        $t2, 0x0($t0)
/* DB21C 80144B1C 25080008 */  addiu     $t0, $t0, 0x8
/* DB220 80144B20 25290001 */  addiu     $t1, $t1, 0x1
/* DB224 80144B24 292200C0 */  slti      $v0, $t1, 0xC0
/* DB228 80144B28 1440FFFA */  bnez      $v0, .L80144B14
/* DB22C 80144B2C 24E70008 */   addiu    $a3, $a3, 0x8
/* DB230 80144B30 08051304 */  j         .L80144C10
/* DB234 80144B34 00000000 */   nop
.L80144B38:
/* DB238 80144B38 3C028015 */  lui       $v0, %hi(gHudElementAuxCache)
/* DB23C 80144B3C 8C42EFC0 */  lw        $v0, %lo(gHudElementAuxCache)($v0)
/* DB240 80144B40 1440000F */  bnez      $v0, .L80144B80
/* DB244 80144B44 00000000 */   nop
/* DB248 80144B48 3C108015 */  lui       $s0, %hi(gHudElementCacheBuffer)
/* DB24C 80144B4C 26101314 */  addiu     $s0, $s0, %lo(gHudElementCacheBuffer)
/* DB250 80144B50 0C00AB4B */  jal       heap_free
/* DB254 80144B54 8E040000 */   lw       $a0, 0x0($s0)
/* DB258 80144B58 3C048015 */  lui       $a0, %hi(gHudElementCacheCapacity)
/* DB25C 80144B5C 8C84EFC4 */  lw        $a0, %lo(gHudElementCacheCapacity)($a0)
/* DB260 80144B60 000417C2 */  srl       $v0, $a0, 31
/* DB264 80144B64 00822021 */  addu      $a0, $a0, $v0
/* DB268 80144B68 0C00AB39 */  jal       heap_malloc
/* DB26C 80144B6C 00042043 */   sra      $a0, $a0, 1
/* DB270 80144B70 14400005 */  bnez      $v0, .L80144B88
/* DB274 80144B74 AE020000 */   sw       $v0, 0x0($s0)
.L80144B78:
/* DB278 80144B78 080512DE */  j         .L80144B78
/* DB27C 80144B7C 00000000 */   nop
.L80144B80:
/* DB280 80144B80 3C018015 */  lui       $at, %hi(gHudElementCacheBuffer)
/* DB284 80144B84 AC221314 */  sw        $v0, %lo(gHudElementCacheBuffer)($at)
.L80144B88:
/* DB288 80144B88 0000482D */  daddu     $t1, $zero, $zero
/* DB28C 80144B8C 240AFFFF */  addiu     $t2, $zero, -0x1
/* DB290 80144B90 3C028016 */  lui       $v0, %hi(gHudElementCacheTablePaletteBattle)
/* DB294 80144B94 24428B80 */  addiu     $v0, $v0, %lo(gHudElementCacheTablePaletteBattle)
/* DB298 80144B98 0040402D */  daddu     $t0, $v0, $zero
/* DB29C 80144B9C 3C028016 */  lui       $v0, %hi(gHudElementCacheTableRasterBattle)
/* DB2A0 80144BA0 24428580 */  addiu     $v0, $v0, %lo(gHudElementCacheTableRasterBattle)
/* DB2A4 80144BA4 0040382D */  daddu     $a3, $v0, $zero
/* DB2A8 80144BA8 3C068015 */  lui       $a2, %hi(gHudElementCacheBuffer)
/* DB2AC 80144BAC 24C61314 */  addiu     $a2, $a2, %lo(gHudElementCacheBuffer)
/* DB2B0 80144BB0 3C058015 */  lui       $a1, %hi(gHudElementCacheSize)
/* DB2B4 80144BB4 24A5133C */  addiu     $a1, $a1, %lo(gHudElementCacheSize)
/* DB2B8 80144BB8 8CC30000 */  lw        $v1, 0x0($a2)
/* DB2BC 80144BBC 8CA40000 */  lw        $a0, 0x0($a1)
/* DB2C0 80144BC0 3C028016 */  lui       $v0, %hi(gHudElementCacheBufferBattle)
/* DB2C4 80144BC4 24428570 */  addiu     $v0, $v0, %lo(gHudElementCacheBufferBattle)
/* DB2C8 80144BC8 AC430000 */  sw        $v1, 0x0($v0)
/* DB2CC 80144BCC AC800000 */  sw        $zero, 0x0($a0)
/* DB2D0 80144BD0 8C430000 */  lw        $v1, 0x0($v0)
/* DB2D4 80144BD4 3C028016 */  lui       $v0, %hi(gHudElementCacheSizeBattle)
/* DB2D8 80144BD8 24428574 */  addiu     $v0, $v0, %lo(gHudElementCacheSizeBattle)
/* DB2DC 80144BDC ACA20000 */  sw        $v0, 0x0($a1)
/* DB2E0 80144BE0 3C018015 */  lui       $at, %hi(gHudElementCacheTableRaster)
/* DB2E4 80144BE4 AC2712C8 */  sw        $a3, %lo(gHudElementCacheTableRaster)($at)
/* DB2E8 80144BE8 3C018015 */  lui       $at, %hi(gHudElementCacheTablePalette)
/* DB2EC 80144BEC AC2812D0 */  sw        $t0, %lo(gHudElementCacheTablePalette)($at)
/* DB2F0 80144BF0 ACC30000 */  sw        $v1, 0x0($a2)
.L80144BF4:
/* DB2F4 80144BF4 ACEA0000 */  sw        $t2, 0x0($a3)
/* DB2F8 80144BF8 AD0A0000 */  sw        $t2, 0x0($t0)
/* DB2FC 80144BFC 25080008 */  addiu     $t0, $t0, 0x8
/* DB300 80144C00 25290001 */  addiu     $t1, $t1, 0x1
/* DB304 80144C04 292200C0 */  slti      $v0, $t1, 0xC0
/* DB308 80144C08 1440FFFA */  bnez      $v0, .L80144BF4
/* DB30C 80144C0C 24E70008 */   addiu    $a3, $a3, 0x8
.L80144C10:
/* DB310 80144C10 8FBF0014 */  lw        $ra, 0x14($sp)
/* DB314 80144C14 8FB00010 */  lw        $s0, 0x10($sp)
/* DB318 80144C18 03E00008 */  jr        $ra
/* DB31C 80144C1C 27BD0018 */   addiu    $sp, $sp, 0x18

### DECOMPILED C INSTRUCTIONS:

void ALT_clear_hud_element_cache(void) {
    s32 i;

    if (!gGameStatusPtr->isBattle) {
        heap_free(gHudElementCacheBuffer);
        gHudElementCacheBuffer = heap_malloc(gHudElementCacheCapacity);
        ASSERT(gHudElementCacheBuffer);
        gHudElementCacheBufferWorld = gHudElementCacheBuffer;
        *gHudElementCacheSize = 0;
        gHudElementCacheSize = &gHudElementCacheSizeWorld;
        gHudElementCacheTableRaster = gHudElementCacheTableRasterWorld;
        gHudElementCacheTablePalette = gHudElementCacheTablePaletteWorld;
        gHudElementCacheBuffer = gHudElementCacheBufferWorld;

        for (i = 0; i < MAX_HUD_CACHE_ENTRIES; i++) {
            gHudElementCacheTableRasterWorld[i].id = -1;
            gHudElementCacheTablePaletteWorld[i].id = -1;
        }
    } else {
        if (gHudElementAuxCache == NULL) {
            heap_free(gHudElementCacheBuffer);
            gHudElementCacheBuffer = heap_malloc(gHudElementCacheCapacity / 2);
            ASSERT(gHudElementCacheBuffer);
        } else {
            gHudElementCacheBuffer = gHudElementAuxCache;
        }
        gHudElementCacheBufferBattle = gHudElementCacheBuffer;
        *gHudElementCacheSize = 0;
        gHudElementCacheSize = &gHudElementCacheSizeBattle;
        gHudElementCacheTableRaster = gHudElementCacheTableRasterBattle;
        gHudElementCacheTablePalette = gHudElementCacheTablePaletteBattle;
        gHudElementCacheBuffer = gHudElementCacheBufferBattle;

        for (i = 0; i < MAX_HUD_CACHE_ENTRIES; i++) {
            gHudElementCacheTableRasterBattle[i].id = -1;
            gHudElementCacheTablePaletteBattle[i].id = -1;
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel ShowSweat
/* FC7B8 802D7E08 27BDFFA0 */  addiu     $sp, $sp, -0x60
/* FC7BC 802D7E0C AFB10024 */  sw        $s1, 0x24($sp)
/* FC7C0 802D7E10 0080882D */  daddu     $s1, $a0, $zero
/* FC7C4 802D7E14 AFBF0034 */  sw        $ra, 0x34($sp)
/* FC7C8 802D7E18 AFB40030 */  sw        $s4, 0x30($sp)
/* FC7CC 802D7E1C AFB3002C */  sw        $s3, 0x2C($sp)
/* FC7D0 802D7E20 AFB20028 */  sw        $s2, 0x28($sp)
/* FC7D4 802D7E24 AFB00020 */  sw        $s0, 0x20($sp)
/* FC7D8 802D7E28 F7BC0058 */  sdc1      $f28, 0x58($sp)
/* FC7DC 802D7E2C F7BA0050 */  sdc1      $f26, 0x50($sp)
/* FC7E0 802D7E30 F7B80048 */  sdc1      $f24, 0x48($sp)
/* FC7E4 802D7E34 F7B60040 */  sdc1      $f22, 0x40($sp)
/* FC7E8 802D7E38 F7B40038 */  sdc1      $f20, 0x38($sp)
/* FC7EC 802D7E3C 8E30000C */  lw        $s0, 0xC($s1)
/* FC7F0 802D7E40 8E050000 */  lw        $a1, 0x0($s0)
/* FC7F4 802D7E44 0C0B1EAF */  jal       evt_get_variable
/* FC7F8 802D7E48 26100004 */   addiu    $s0, $s0, 0x4
/* FC7FC 802D7E4C 8E050000 */  lw        $a1, 0x0($s0)
/* FC800 802D7E50 26100004 */  addiu     $s0, $s0, 0x4
/* FC804 802D7E54 0220202D */  daddu     $a0, $s1, $zero
/* FC808 802D7E58 0C0B1EAF */  jal       evt_get_variable
/* FC80C 802D7E5C 0040982D */   daddu    $s3, $v0, $zero
/* FC810 802D7E60 8E050000 */  lw        $a1, 0x0($s0)
/* FC814 802D7E64 26100004 */  addiu     $s0, $s0, 0x4
/* FC818 802D7E68 0220202D */  daddu     $a0, $s1, $zero
/* FC81C 802D7E6C 0C0B210B */  jal       evt_get_float_variable
/* FC820 802D7E70 0040A02D */   daddu    $s4, $v0, $zero
/* FC824 802D7E74 8E050000 */  lw        $a1, 0x0($s0)
/* FC828 802D7E78 26100004 */  addiu     $s0, $s0, 0x4
/* FC82C 802D7E7C 0220202D */  daddu     $a0, $s1, $zero
/* FC830 802D7E80 0C0B1EAF */  jal       evt_get_variable
/* FC834 802D7E84 46000706 */   mov.s    $f28, $f0
/* FC838 802D7E88 8E050000 */  lw        $a1, 0x0($s0)
/* FC83C 802D7E8C 26100004 */  addiu     $s0, $s0, 0x4
/* FC840 802D7E90 0220202D */  daddu     $a0, $s1, $zero
/* FC844 802D7E94 0C0B210B */  jal       evt_get_float_variable
/* FC848 802D7E98 0040902D */   daddu    $s2, $v0, $zero
/* FC84C 802D7E9C 8E050000 */  lw        $a1, 0x0($s0)
/* FC850 802D7EA0 26100004 */  addiu     $s0, $s0, 0x4
/* FC854 802D7EA4 0220202D */  daddu     $a0, $s1, $zero
/* FC858 802D7EA8 0C0B210B */  jal       evt_get_float_variable
/* FC85C 802D7EAC 46000686 */   mov.s    $f26, $f0
/* FC860 802D7EB0 8E050000 */  lw        $a1, 0x0($s0)
/* FC864 802D7EB4 26100004 */  addiu     $s0, $s0, 0x4
/* FC868 802D7EB8 0220202D */  daddu     $a0, $s1, $zero
/* FC86C 802D7EBC 0C0B210B */  jal       evt_get_float_variable
/* FC870 802D7EC0 46000606 */   mov.s    $f24, $f0
/* FC874 802D7EC4 8E050000 */  lw        $a1, 0x0($s0)
/* FC878 802D7EC8 26100004 */  addiu     $s0, $s0, 0x4
/* FC87C 802D7ECC 0220202D */  daddu     $a0, $s1, $zero
/* FC880 802D7ED0 0C0B210B */  jal       evt_get_float_variable
/* FC884 802D7ED4 46000586 */   mov.s    $f22, $f0
/* FC888 802D7ED8 0220202D */  daddu     $a0, $s1, $zero
/* FC88C 802D7EDC 8E050000 */  lw        $a1, 0x0($s0)
/* FC890 802D7EE0 0C0B1EAF */  jal       evt_get_variable
/* FC894 802D7EE4 46000506 */   mov.s    $f20, $f0
/* FC898 802D7EE8 12400006 */  beqz      $s2, .L802D7F04
/* FC89C 802D7EEC 0040802D */   daddu    $s0, $v0, $zero
/* FC8A0 802D7EF0 24020001 */  addiu     $v0, $zero, 0x1
/* FC8A4 802D7EF4 12420014 */  beq       $s2, $v0, .L802D7F48
/* FC8A8 802D7EF8 4600D206 */   mov.s    $f8, $f26
/* FC8AC 802D7EFC 080B5FF2 */  j         .L802D7FC8
/* FC8B0 802D7F00 4600C006 */   mov.s    $f0, $f24
.L802D7F04:
/* FC8B4 802D7F04 3C055555 */  lui       $a1, (0x55555556 >> 16)
/* FC8B8 802D7F08 3C048011 */  lui       $a0, %hi(gPlayerStatus)
/* FC8BC 802D7F0C 2484EFC8 */  addiu     $a0, $a0, %lo(gPlayerStatus)
/* FC8C0 802D7F10 948200B0 */  lhu       $v0, 0xB0($a0)
/* FC8C4 802D7F14 34A55556 */  ori       $a1, $a1, (0x55555556 & 0xFFFF)
/* FC8C8 802D7F18 00021400 */  sll       $v0, $v0, 16
/* FC8CC 802D7F1C 00021C03 */  sra       $v1, $v0, 16
/* FC8D0 802D7F20 00650018 */  mult      $v1, $a1
/* FC8D4 802D7F24 C4880028 */  lwc1      $f8, 0x28($a0)
/* FC8D8 802D7F28 C4860030 */  lwc1      $f6, 0x30($a0)
/* FC8DC 802D7F2C C482002C */  lwc1      $f2, 0x2C($a0)
/* FC8E0 802D7F30 00031840 */  sll       $v1, $v1, 1
/* FC8E4 802D7F34 00004010 */  mfhi      $t0
/* FC8E8 802D7F38 000217C3 */  sra       $v0, $v0, 31
/* FC8EC 802D7F3C 01021023 */  subu      $v0, $t0, $v0
/* FC8F0 802D7F40 080B5FE5 */  j         .L802D7F94
/* FC8F4 802D7F44 00650018 */   mult     $v1, $a1
.L802D7F48:
/* FC8F8 802D7F48 0220202D */  daddu     $a0, $s1, $zero
/* FC8FC 802D7F4C 0C0B36B0 */  jal       resolve_npc
/* FC900 802D7F50 0260282D */   daddu    $a1, $s3, $zero
/* FC904 802D7F54 0040282D */  daddu     $a1, $v0, $zero
/* FC908 802D7F58 10A00025 */  beqz      $a1, .L802D7FF0
/* FC90C 802D7F5C 3C045555 */   lui      $a0, (0x55555556 >> 16)
/* FC910 802D7F60 94A200A8 */  lhu       $v0, 0xA8($a1)
/* FC914 802D7F64 34845556 */  ori       $a0, $a0, (0x55555556 & 0xFFFF)
/* FC918 802D7F68 00021400 */  sll       $v0, $v0, 16
/* FC91C 802D7F6C 00021C03 */  sra       $v1, $v0, 16
/* FC920 802D7F70 00640018 */  mult      $v1, $a0
/* FC924 802D7F74 C4A80038 */  lwc1      $f8, 0x38($a1)
/* FC928 802D7F78 C4A60040 */  lwc1      $f6, 0x40($a1)
/* FC92C 802D7F7C C4A2003C */  lwc1      $f2, 0x3C($a1)
/* FC930 802D7F80 00031840 */  sll       $v1, $v1, 1
/* FC934 802D7F84 00004010 */  mfhi      $t0
/* FC938 802D7F88 000217C3 */  sra       $v0, $v0, 31
/* FC93C 802D7F8C 01021023 */  subu      $v0, $t0, $v0
/* FC940 802D7F90 00640018 */  mult      $v1, $a0
.L802D7F94:
/* FC944 802D7F94 00021400 */  sll       $v0, $v0, 16
/* FC948 802D7F98 00021403 */  sra       $v0, $v0, 16
/* FC94C 802D7F9C 44822000 */  mtc1      $v0, $f4
/* FC950 802D7FA0 00000000 */  nop
/* FC954 802D7FA4 46802120 */  cvt.s.w   $f4, $f4
/* FC958 802D7FA8 00031FC3 */  sra       $v1, $v1, 31
/* FC95C 802D7FAC 00004010 */  mfhi      $t0
/* FC960 802D7FB0 01031823 */  subu      $v1, $t0, $v1
/* FC964 802D7FB4 44830000 */  mtc1      $v1, $f0
/* FC968 802D7FB8 00000000 */  nop
/* FC96C 802D7FBC 46800020 */  cvt.s.w   $f0, $f0
/* FC970 802D7FC0 080B5FF4 */  j         .L802D7FD0
/* FC974 802D7FC4 46001000 */   add.s    $f0, $f2, $f0
.L802D7FC8:
/* FC978 802D7FC8 4600B186 */  mov.s     $f6, $f22
/* FC97C 802D7FCC 4600A106 */  mov.s     $f4, $f20
.L802D7FD0:
/* FC980 802D7FD0 44054000 */  mfc1      $a1, $f8
/* FC984 802D7FD4 44060000 */  mfc1      $a2, $f0
/* FC988 802D7FD8 44073000 */  mfc1      $a3, $f6
/* FC98C 802D7FDC 0280202D */  daddu     $a0, $s4, $zero
/* FC990 802D7FE0 E7A40010 */  swc1      $f4, 0x10($sp)
/* FC994 802D7FE4 E7BC0014 */  swc1      $f28, 0x14($sp)
/* FC998 802D7FE8 0C01C1E4 */  jal       fx_sweat
/* FC99C 802D7FEC AFB00018 */   sw       $s0, 0x18($sp)
.L802D7FF0:
/* FC9A0 802D7FF0 24020002 */  addiu     $v0, $zero, 0x2
/* FC9A4 802D7FF4 8FBF0034 */  lw        $ra, 0x34($sp)
/* FC9A8 802D7FF8 8FB40030 */  lw        $s4, 0x30($sp)
/* FC9AC 802D7FFC 8FB3002C */  lw        $s3, 0x2C($sp)
/* FC9B0 802D8000 8FB20028 */  lw        $s2, 0x28($sp)
/* FC9B4 802D8004 8FB10024 */  lw        $s1, 0x24($sp)
/* FC9B8 802D8008 8FB00020 */  lw        $s0, 0x20($sp)
/* FC9BC 802D800C D7BC0058 */  ldc1      $f28, 0x58($sp)
/* FC9C0 802D8010 D7BA0050 */  ldc1      $f26, 0x50($sp)
/* FC9C4 802D8014 D7B80048 */  ldc1      $f24, 0x48($sp)
/* FC9C8 802D8018 D7B60040 */  ldc1      $f22, 0x40($sp)
/* FC9CC 802D801C D7B40038 */  ldc1      $f20, 0x38($sp)
/* FC9D0 802D8020 03E00008 */  jr        $ra
/* FC9D4 802D8024 27BD0060 */   addiu    $sp, $sp, 0x60

### DECOMPILED C INSTRUCTIONS:

ApiStatus ShowSweat(Evt* script, s32 isInitialCall) {
    Bytecode* args = script->ptrReadPos;
    s32 npcID = evt_get_variable(script, *args++);
    s32 type = evt_get_variable(script, *args++);
    f32 pitch = evt_get_float_variable(script, *args++);
    s32 emoterType = evt_get_variable(script, *args++);
    f32 posX = evt_get_float_variable(script, *args++);
    f32 posY = evt_get_float_variable(script, *args++);
    f32 posZ = evt_get_float_variable(script, *args++);
    f32 radius = evt_get_float_variable(script, *args++);
    s32 duration = evt_get_variable(script, *args++);

    Npc* npc;
    f32 x, y, z, r;

    switch (emoterType) {
        case EMOTER_PLAYER:
            x = gPlayerStatus.position.x;
            y = gPlayerStatus.position.y + (gPlayerStatus.colliderHeight * 2) / 3;
            z = gPlayerStatus.position.z;
            r = gPlayerStatus.colliderHeight / 3;
            break;
        case EMOTER_NPC:
            npc = resolve_npc(script, npcID);
            if (npc == NULL) {
                return ApiStatus_DONE2;
            }
            x = npc->pos.x;
            y = npc->pos.y + (npc->collisionHeight * 2) / 3;
            z = npc->pos.z;
            r = npc->collisionHeight / 3;
            break;
        default:
            x = posX;
            y = posY;
            z = posZ;
            r = radius;
            break;
    }

    fx_sweat(type, x, y, z, r, pitch, duration);
    return ApiStatus_DONE2;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel flower_trail_appendGfx
/* 32E274 E0012564 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* 32E278 E0012568 0080602D */  daddu     $t4, $a0, $zero
/* 32E27C E001256C 3C05DB06 */  lui       $a1, (0xDB060024 >> 16)
/* 32E280 E0012570 34A50024 */  ori       $a1, $a1, (0xDB060024 & 0xFFFF)
/* 32E284 E0012574 3C06800A */  lui       $a2, %hi(gMainGfxPos)
/* 32E288 E0012578 24C6A66C */  addiu     $a2, $a2, %lo(gMainGfxPos)
/* 32E28C E001257C 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 32E290 E0012580 AFB7001C */  sw        $s7, 0x1C($sp)
/* 32E294 E0012584 AFB60018 */  sw        $s6, 0x18($sp)
/* 32E298 E0012588 AFB50014 */  sw        $s5, 0x14($sp)
/* 32E29C E001258C AFB40010 */  sw        $s4, 0x10($sp)
/* 32E2A0 E0012590 AFB3000C */  sw        $s3, 0xC($sp)
/* 32E2A4 E0012594 AFB20008 */  sw        $s2, 0x8($sp)
/* 32E2A8 E0012598 AFB10004 */  sw        $s1, 0x4($sp)
/* 32E2AC E001259C AFB00000 */  sw        $s0, 0x0($sp)
/* 32E2B0 E00125A0 8CC40000 */  lw        $a0, 0x0($a2)
/* 32E2B4 E00125A4 8D87000C */  lw        $a3, 0xC($t4)
/* 32E2B8 E00125A8 0080182D */  daddu     $v1, $a0, $zero
/* 32E2BC E00125AC 24840008 */  addiu     $a0, $a0, 0x8
/* 32E2C0 E00125B0 AC620000 */  sw        $v0, 0x0($v1)
/* 32E2C4 E00125B4 AC600004 */  sw        $zero, 0x4($v1)
/* 32E2C8 E00125B8 AC850000 */  sw        $a1, 0x0($a0)
/* 32E2CC E00125BC 8D820010 */  lw        $v0, 0x10($t4)
/* 32E2D0 E00125C0 0000482D */  daddu     $t1, $zero, $zero
/* 32E2D4 E00125C4 ACC40000 */  sw        $a0, 0x0($a2)
/* 32E2D8 E00125C8 8C42001C */  lw        $v0, 0x1C($v0)
/* 32E2DC E00125CC 3C038000 */  lui       $v1, (0x80000000 >> 16)
/* 32E2E0 E00125D0 00431021 */  addu      $v0, $v0, $v1
/* 32E2E4 E00125D4 AC820004 */  sw        $v0, 0x4($a0)
/* 32E2E8 E00125D8 8D820008 */  lw        $v0, 0x8($t4)
/* 32E2EC E00125DC 24840008 */  addiu     $a0, $a0, 0x8
/* 32E2F0 E00125E0 18400053 */  blez      $v0, .LE0012730
/* 32E2F4 E00125E4 ACC40000 */   sw       $a0, 0x0($a2)
/* 32E2F8 E00125E8 3C0E800A */  lui       $t6, %hi(gDisplayContext)
/* 32E2FC E00125EC 25CEA674 */  addiu     $t6, $t6, %lo(gDisplayContext)
/* 32E300 E00125F0 3C0D8007 */  lui       $t5, %hi(gMatrixListPos)
/* 32E304 E00125F4 25AD41F0 */  addiu     $t5, $t5, %lo(gMatrixListPos)
/* 32E308 E00125F8 3C0B0001 */  lui       $t3, (0x11630 >> 16)
/* 32E30C E00125FC 356B1630 */  ori       $t3, $t3, (0x11630 & 0xFFFF)
/* 32E310 E0012600 00C0502D */  daddu     $t2, $a2, $zero
/* 32E314 E0012604 3C13E700 */  lui       $s3, (0xE7000000 >> 16)
/* 32E318 E0012608 3C12FA00 */  lui       $s2, (0xFA000000 >> 16)
/* 32E31C E001260C 3C187060 */  lui       $t8, (0x70601800 >> 16)
/* 32E320 E0012610 37181800 */  ori       $t8, $t8, (0x70601800 & 0xFFFF)
/* 32E324 E0012614 3C11DA38 */  lui       $s1, (0xDA380000 >> 16)
/* 32E328 E0012618 3C10DE00 */  lui       $s0, (0xDE000000 >> 16)
/* 32E32C E001261C 3C0FD838 */  lui       $t7, (0xD8380002 >> 16)
/* 32E330 E0012620 35EF0002 */  ori       $t7, $t7, (0xD8380002 & 0xFFFF)
/* 32E334 E0012624 24190040 */  addiu     $t9, $zero, 0x40
/* 32E338 E0012628 24E60008 */  addiu     $a2, $a3, 0x8
.LE001262C:
/* 32E33C E001262C 8CE20000 */  lw        $v0, 0x0($a3)
/* 32E340 E0012630 5040003A */  beql      $v0, $zero, .LE001271C
/* 32E344 E0012634 25290001 */   addiu    $t1, $t1, 0x1
/* 32E348 E0012638 80C20001 */  lb        $v0, 0x1($a2)
/* 32E34C E001263C 3C080900 */  lui       $t0, %hi(D_09000E38_40E0C8)
/* 32E350 E0012640 25080E38 */  addiu     $t0, $t0, %lo(D_09000E38_40E0C8)
/* 32E354 E0012644 10400003 */  beqz      $v0, .LE0012654
/* 32E358 E0012648 24E40030 */   addiu    $a0, $a3, 0x30
/* 32E35C E001264C 3C080900 */  lui       $t0, %hi(D_09000E20_40E0B0)
/* 32E360 E0012650 25080E20 */  addiu     $t0, $t0, %lo(D_09000E20_40E0B0)
.LE0012654:
/* 32E364 E0012654 24E50070 */  addiu     $a1, $a3, 0x70
/* 32E368 E0012658 95A20000 */  lhu       $v0, 0x0($t5)
/* 32E36C E001265C 8DC30000 */  lw        $v1, 0x0($t6)
/* 32E370 E0012660 00021180 */  sll       $v0, $v0, 6
/* 32E374 E0012664 00621821 */  addu      $v1, $v1, $v0
/* 32E378 E0012668 006B1821 */  addu      $v1, $v1, $t3
.LE001266C:
/* 32E37C E001266C 8C940000 */  lw        $s4, 0x0($a0)
/* 32E380 E0012670 8C950004 */  lw        $s5, 0x4($a0)
/* 32E384 E0012674 8C960008 */  lw        $s6, 0x8($a0)
/* 32E388 E0012678 8C97000C */  lw        $s7, 0xC($a0)
/* 32E38C E001267C AC740000 */  sw        $s4, 0x0($v1)
/* 32E390 E0012680 AC750004 */  sw        $s5, 0x4($v1)
/* 32E394 E0012684 AC760008 */  sw        $s6, 0x8($v1)
/* 32E398 E0012688 AC77000C */  sw        $s7, 0xC($v1)
/* 32E39C E001268C 24840010 */  addiu     $a0, $a0, 0x10
/* 32E3A0 E0012690 1485FFF6 */  bne       $a0, $a1, .LE001266C
/* 32E3A4 E0012694 24630010 */   addiu    $v1, $v1, 0x10
/* 32E3A8 E0012698 8D440000 */  lw        $a0, 0x0($t2)
/* 32E3AC E001269C 0080102D */  daddu     $v0, $a0, $zero
/* 32E3B0 E00126A0 24840008 */  addiu     $a0, $a0, 0x8
/* 32E3B4 E00126A4 AD440000 */  sw        $a0, 0x0($t2)
/* 32E3B8 E00126A8 AC530000 */  sw        $s3, 0x0($v0)
/* 32E3BC E00126AC AC400004 */  sw        $zero, 0x4($v0)
/* 32E3C0 E00126B0 24820008 */  addiu     $v0, $a0, 0x8
/* 32E3C4 E00126B4 AD420000 */  sw        $v0, 0x0($t2)
/* 32E3C8 E00126B8 AC920000 */  sw        $s2, 0x0($a0)
/* 32E3CC E00126BC 90C50000 */  lbu       $a1, 0x0($a2)
/* 32E3D0 E00126C0 95A30000 */  lhu       $v1, 0x0($t5)
/* 32E3D4 E00126C4 24820010 */  addiu     $v0, $a0, 0x10
/* 32E3D8 E00126C8 AD420000 */  sw        $v0, 0x0($t2)
/* 32E3DC E00126CC AC910008 */  sw        $s1, 0x8($a0)
/* 32E3E0 E00126D0 24620001 */  addiu     $v0, $v1, 0x1
/* 32E3E4 E00126D4 3063FFFF */  andi      $v1, $v1, 0xFFFF
/* 32E3E8 E00126D8 00031980 */  sll       $v1, $v1, 6
/* 32E3EC E00126DC 006B1821 */  addu      $v1, $v1, $t3
/* 32E3F0 E00126E0 A5A20000 */  sh        $v0, 0x0($t5)
/* 32E3F4 E00126E4 8DC20000 */  lw        $v0, 0x0($t6)
/* 32E3F8 E00126E8 00B82825 */  or        $a1, $a1, $t8
/* 32E3FC E00126EC 00431021 */  addu      $v0, $v0, $v1
/* 32E400 E00126F0 AC82000C */  sw        $v0, 0xC($a0)
/* 32E404 E00126F4 24820018 */  addiu     $v0, $a0, 0x18
/* 32E408 E00126F8 AD420000 */  sw        $v0, 0x0($t2)
/* 32E40C E00126FC 24820020 */  addiu     $v0, $a0, 0x20
/* 32E410 E0012700 AC900010 */  sw        $s0, 0x10($a0)
/* 32E414 E0012704 AC880014 */  sw        $t0, 0x14($a0)
/* 32E418 E0012708 AD420000 */  sw        $v0, 0x0($t2)
/* 32E41C E001270C AC8F0018 */  sw        $t7, 0x18($a0)
/* 32E420 E0012710 AC99001C */  sw        $t9, 0x1C($a0)
/* 32E424 E0012714 AC850004 */  sw        $a1, 0x4($a0)
/* 32E428 E0012718 25290001 */  addiu     $t1, $t1, 0x1
.LE001271C:
/* 32E42C E001271C 24C60098 */  addiu     $a2, $a2, 0x98
/* 32E430 E0012720 8D820008 */  lw        $v0, 0x8($t4)
/* 32E434 E0012724 0122102A */  slt       $v0, $t1, $v0
/* 32E438 E0012728 1440FFC0 */  bnez      $v0, .LE001262C
/* 32E43C E001272C 24E70098 */   addiu    $a3, $a3, 0x98
.LE0012730:
/* 32E440 E0012730 3C03800A */  lui       $v1, %hi(gMainGfxPos)
/* 32E444 E0012734 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
/* 32E448 E0012738 8C620000 */  lw        $v0, 0x0($v1)
/* 32E44C E001273C 0040202D */  daddu     $a0, $v0, $zero
/* 32E450 E0012740 24420008 */  addiu     $v0, $v0, 0x8
/* 32E454 E0012744 AC620000 */  sw        $v0, 0x0($v1)
/* 32E458 E0012748 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 32E45C E001274C AC820000 */  sw        $v0, 0x0($a0)
/* 32E460 E0012750 AC800004 */  sw        $zero, 0x4($a0)
/* 32E464 E0012754 8FB7001C */  lw        $s7, 0x1C($sp)
/* 32E468 E0012758 8FB60018 */  lw        $s6, 0x18($sp)
/* 32E46C E001275C 8FB50014 */  lw        $s5, 0x14($sp)
/* 32E470 E0012760 8FB40010 */  lw        $s4, 0x10($sp)
/* 32E474 E0012764 8FB3000C */  lw        $s3, 0xC($sp)
/* 32E478 E0012768 8FB20008 */  lw        $s2, 0x8($sp)
/* 32E47C E001276C 8FB10004 */  lw        $s1, 0x4($sp)
/* 32E480 E0012770 8FB00000 */  lw        $s0, 0x0($sp)
/* 32E484 E0012774 03E00008 */  jr        $ra
/* 32E488 E0012778 27BD0020 */   addiu    $sp, $sp, 0x20
/* 32E48C E001277C 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void flower_trail_appendGfx(void* argEffect) {
    EffectInstance* effect = argEffect;
    FlowerFXData* part = effect->data.flowerTrail;
    Gfx* dlist;
    s32 i;

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

    for (i = 0; i < effect->numParts; i++, part++) {
        if (part->alive) {
            if (part->useAltColor) {
                dlist = D_09000E20_32DCE0;
            } else {
                dlist = D_09000E38_32DCF8;
            }

            gDisplayContext->matrixStack[gMatrixListPos] = part->transformMtx;

            gDPPipeSync(gMainGfxPos++);
            gDPSetPrimColor(gMainGfxPos++, 0, 0, 112, 96, 24, part->primAlpha);
            gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++],
                        G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
            gSPDisplayList(gMainGfxPos++, dlist);
            gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
        }
    }
    gDPPipeSync(gMainGfxPos++);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel PlayerFaceNpc
/* F64B4 802D1B04 27BDFFD0 */  addiu     $sp, $sp, -0x30
/* F64B8 802D1B08 AFB20018 */  sw        $s2, 0x18($sp)
/* F64BC 802D1B0C 0080902D */  daddu     $s2, $a0, $zero
/* F64C0 802D1B10 AFB60028 */  sw        $s6, 0x28($sp)
/* F64C4 802D1B14 3C168011 */  lui       $s6, %hi(gPlayerStatus)
/* F64C8 802D1B18 26D6EFC8 */  addiu     $s6, $s6, %lo(gPlayerStatus)
/* F64CC 802D1B1C AFB50024 */  sw        $s5, 0x24($sp)
/* F64D0 802D1B20 26550074 */  addiu     $s5, $s2, 0x74
/* F64D4 802D1B24 AFB10014 */  sw        $s1, 0x14($sp)
/* F64D8 802D1B28 26510078 */  addiu     $s1, $s2, 0x78
/* F64DC 802D1B2C AFB40020 */  sw        $s4, 0x20($sp)
/* F64E0 802D1B30 AFBF002C */  sw        $ra, 0x2C($sp)
/* F64E4 802D1B34 AFB3001C */  sw        $s3, 0x1C($sp)
/* F64E8 802D1B38 AFB00010 */  sw        $s0, 0x10($sp)
/* F64EC 802D1B3C 8E53000C */  lw        $s3, 0xC($s2)
/* F64F0 802D1B40 10A00043 */  beqz      $a1, .L802D1C50
/* F64F4 802D1B44 2654007C */   addiu    $s4, $s2, 0x7C
/* F64F8 802D1B48 8E650000 */  lw        $a1, 0x0($s3)
/* F64FC 802D1B4C 0C0B1EAF */  jal       evt_get_variable
/* F6500 802D1B50 26730004 */   addiu    $s3, $s3, 0x4
/* F6504 802D1B54 0040202D */  daddu     $a0, $v0, $zero
/* F6508 802D1B58 2402FFFF */  addiu     $v0, $zero, -0x1
/* F650C 802D1B5C 14820006 */  bne       $a0, $v0, .L802D1B78
/* F6510 802D1B60 3C02EFE8 */   lui      $v0, (0xEFE82080 >> 16)
/* F6514 802D1B64 8E44014C */  lw        $a0, 0x14C($s2)
/* F6518 802D1B68 0C00EAD2 */  jal       get_npc_safe
/* F651C 802D1B6C 00000000 */   nop
/* F6520 802D1B70 080B46E7 */  j         .L802D1B9C
/* F6524 802D1B74 0040202D */   daddu    $a0, $v0, $zero
.L802D1B78:
/* F6528 802D1B78 34422080 */  ori       $v0, $v0, (0xEFE82080 & 0xFFFF)
/* F652C 802D1B7C 0082102A */  slt       $v0, $a0, $v0
/* F6530 802D1B80 14400006 */  bnez      $v0, .L802D1B9C
/* F6534 802D1B84 00000000 */   nop
/* F6538 802D1B88 0C00EAD2 */  jal       get_npc_safe
/* F653C 802D1B8C 00000000 */   nop
/* F6540 802D1B90 0040202D */  daddu     $a0, $v0, $zero
/* F6544 802D1B94 1080005A */  beqz      $a0, .L802D1D00
/* F6548 802D1B98 24020002 */   addiu    $v0, $zero, 0x2
.L802D1B9C:
/* F654C 802D1B9C 3C10802E */  lui       $s0, %hi(playerNpc)
/* F6550 802D1BA0 26109D20 */  addiu     $s0, $s0, %lo(playerNpc)
/* F6554 802D1BA4 8E020000 */  lw        $v0, 0x0($s0)
/* F6558 802D1BA8 C6C00080 */  lwc1      $f0, 0x80($s6)
/* F655C 802D1BAC E440000C */  swc1      $f0, 0xC($v0)
/* F6560 802D1BB0 E6A00000 */  swc1      $f0, 0x0($s5)
/* F6564 802D1BB4 C6CC0028 */  lwc1      $f12, 0x28($s6)
/* F6568 802D1BB8 C6CE0030 */  lwc1      $f14, 0x30($s6)
/* F656C 802D1BBC 8C860038 */  lw        $a2, 0x38($a0)
/* F6570 802D1BC0 0C00A720 */  jal       atan2
/* F6574 802D1BC4 8C870040 */   lw       $a3, 0x40($a0)
/* F6578 802D1BC8 C6A20000 */  lwc1      $f2, 0x0($s5)
/* F657C 802D1BCC 46020001 */  sub.s     $f0, $f0, $f2
/* F6580 802D1BD0 E6200000 */  swc1      $f0, 0x0($s1)
/* F6584 802D1BD4 8E650000 */  lw        $a1, 0x0($s3)
/* F6588 802D1BD8 0C0B1EAF */  jal       evt_get_variable
/* F658C 802D1BDC 0240202D */   daddu    $a0, $s2, $zero
/* F6590 802D1BE0 AE820000 */  sw        $v0, 0x0($s4)
/* F6594 802D1BE4 8E020000 */  lw        $v0, 0x0($s0)
/* F6598 802D1BE8 3C01C334 */  lui       $at, (0xC3340000 >> 16)
/* F659C 802D1BEC 44810000 */  mtc1      $at, $f0
/* F65A0 802D1BF0 A440008E */  sh        $zero, 0x8E($v0)
/* F65A4 802D1BF4 C6220000 */  lwc1      $f2, 0x0($s1)
/* F65A8 802D1BF8 4600103C */  c.lt.s    $f2, $f0
/* F65AC 802D1BFC 00000000 */  nop
/* F65B0 802D1C00 45000007 */  bc1f      .L802D1C20
/* F65B4 802D1C04 00000000 */   nop
/* F65B8 802D1C08 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
/* F65BC 802D1C0C 44810000 */  mtc1      $at, $f0
/* F65C0 802D1C10 00000000 */  nop
/* F65C4 802D1C14 46001000 */  add.s     $f0, $f2, $f0
/* F65C8 802D1C18 E6200000 */  swc1      $f0, 0x0($s1)
/* F65CC 802D1C1C C6220000 */  lwc1      $f2, 0x0($s1)
.L802D1C20:
/* F65D0 802D1C20 3C014334 */  lui       $at, (0x43340000 >> 16)
/* F65D4 802D1C24 44810000 */  mtc1      $at, $f0
/* F65D8 802D1C28 00000000 */  nop
/* F65DC 802D1C2C 4602003C */  c.lt.s    $f0, $f2
/* F65E0 802D1C30 00000000 */  nop
/* F65E4 802D1C34 45000006 */  bc1f      .L802D1C50
/* F65E8 802D1C38 00000000 */   nop
/* F65EC 802D1C3C 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
/* F65F0 802D1C40 44810000 */  mtc1      $at, $f0
/* F65F4 802D1C44 00000000 */  nop
/* F65F8 802D1C48 46001001 */  sub.s     $f0, $f2, $f0
/* F65FC 802D1C4C E6200000 */  swc1      $f0, 0x0($s1)
.L802D1C50:
/* F6600 802D1C50 8E820000 */  lw        $v0, 0x0($s4)
/* F6604 802D1C54 1C40000E */  bgtz      $v0, .L802D1C90
/* F6608 802D1C58 00000000 */   nop
/* F660C 802D1C5C 3C10802E */  lui       $s0, %hi(playerNpc)
/* F6610 802D1C60 26109D20 */  addiu     $s0, $s0, %lo(playerNpc)
/* F6614 802D1C64 8E020000 */  lw        $v0, 0x0($s0)
/* F6618 802D1C68 C6200000 */  lwc1      $f0, 0x0($s1)
/* F661C 802D1C6C C44C000C */  lwc1      $f12, 0xC($v0)
/* F6620 802D1C70 46006300 */  add.s     $f12, $f12, $f0
/* F6624 802D1C74 0C00A6C9 */  jal       clamp_angle
/* F6628 802D1C78 E44C000C */   swc1     $f12, 0xC($v0)
/* F662C 802D1C7C 8E030000 */  lw        $v1, 0x0($s0)
/* F6630 802D1C80 24020002 */  addiu     $v0, $zero, 0x2
/* F6634 802D1C84 E460000C */  swc1      $f0, 0xC($v1)
/* F6638 802D1C88 080B4740 */  j         .L802D1D00
/* F663C 802D1C8C E6C00080 */   swc1     $f0, 0x80($s6)
.L802D1C90:
/* F6640 802D1C90 3C10802E */  lui       $s0, %hi(playerNpc)
/* F6644 802D1C94 26109D20 */  addiu     $s0, $s0, %lo(playerNpc)
/* F6648 802D1C98 8E030000 */  lw        $v1, 0x0($s0)
/* F664C 802D1C9C 9462008E */  lhu       $v0, 0x8E($v1)
/* F6650 802D1CA0 24420001 */  addiu     $v0, $v0, 0x1
/* F6654 802D1CA4 A462008E */  sh        $v0, 0x8E($v1)
/* F6658 802D1CA8 00021400 */  sll       $v0, $v0, 16
/* F665C 802D1CAC 00021403 */  sra       $v0, $v0, 16
/* F6660 802D1CB0 C6200000 */  lwc1      $f0, 0x0($s1)
/* F6664 802D1CB4 44821000 */  mtc1      $v0, $f2
/* F6668 802D1CB8 00000000 */  nop
/* F666C 802D1CBC 468010A0 */  cvt.s.w   $f2, $f2
/* F6670 802D1CC0 46020002 */  mul.s     $f0, $f0, $f2
/* F6674 802D1CC4 00000000 */  nop
/* F6678 802D1CC8 C6AC0000 */  lwc1      $f12, 0x0($s5)
/* F667C 802D1CCC C6820000 */  lwc1      $f2, 0x0($s4)
/* F6680 802D1CD0 468010A0 */  cvt.s.w   $f2, $f2
/* F6684 802D1CD4 46020003 */  div.s     $f0, $f0, $f2
/* F6688 802D1CD8 46006300 */  add.s     $f12, $f12, $f0
/* F668C 802D1CDC 0C00A6C9 */  jal       clamp_angle
/* F6690 802D1CE0 E46C000C */   swc1     $f12, 0xC($v1)
/* F6694 802D1CE4 8E020000 */  lw        $v0, 0x0($s0)
/* F6698 802D1CE8 E440000C */  swc1      $f0, 0xC($v0)
/* F669C 802D1CEC E6C00080 */  swc1      $f0, 0x80($s6)
/* F66A0 802D1CF0 8442008E */  lh        $v0, 0x8E($v0)
/* F66A4 802D1CF4 8E830000 */  lw        $v1, 0x0($s4)
/* F66A8 802D1CF8 0043102A */  slt       $v0, $v0, $v1
/* F66AC 802D1CFC 38420001 */  xori      $v0, $v0, 0x1
.L802D1D00:
/* F66B0 802D1D00 8FBF002C */  lw        $ra, 0x2C($sp)
/* F66B4 802D1D04 8FB60028 */  lw        $s6, 0x28($sp)
/* F66B8 802D1D08 8FB50024 */  lw        $s5, 0x24($sp)
/* F66BC 802D1D0C 8FB40020 */  lw        $s4, 0x20($sp)
/* F66C0 802D1D10 8FB3001C */  lw        $s3, 0x1C($sp)
/* F66C4 802D1D14 8FB20018 */  lw        $s2, 0x18($sp)
/* F66C8 802D1D18 8FB10014 */  lw        $s1, 0x14($sp)
/* F66CC 802D1D1C 8FB00010 */  lw        $s0, 0x10($sp)
/* F66D0 802D1D20 03E00008 */  jr        $ra
/* F66D4 802D1D24 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

ApiStatus PlayerFaceNpc(Evt* script, s32 isInitialCall) {
    PlayerStatus* playerStatus = &gPlayerStatus;
    s32* args = script->ptrReadPos;
    f32* playerTargetYaw = &script->functionTempF[1];
    f32* angle = &script->functionTempF[2];
    s32* ft3 = &script->functionTemp[3];

    if (isInitialCall) {
        s32 npcID = evt_get_variable(script, *args++);
        Npc* npc;

        if (npcID == NPC_SELF) {
            npc = get_npc_safe(script->owner2.npcID);
        } else if (npcID < EVT_LIMIT) {
            npc = (Npc*)npcID;
        } else {
            npc = get_npc_safe(npcID);
            if (npc == NULL) {
                return ApiStatus_DONE2;
            }
        }

        *playerTargetYaw = playerNpc->yaw = playerStatus->targetYaw;
        *angle = atan2(playerStatus->position.x, playerStatus->position.z, npc->pos.x, npc->pos.z) - *playerTargetYaw;
        *ft3 = evt_get_variable(script, *args++);

        playerNpc->duration = 0;

        if (*angle < -180.0f) {
            *angle += 360.0f;
        }
        if (*angle > 180.0f) {
            *angle -= 360.0f;
        }
    }

    if (*ft3 > 0) {
        playerNpc->duration++;
        playerNpc->yaw = *playerTargetYaw + ((*angle * playerNpc->duration) / *ft3);
        playerStatus->targetYaw = playerNpc->yaw = clamp_angle(playerNpc->yaw);
        return (playerNpc->duration >= *ft3) * ApiStatus_DONE1;
    }

    playerNpc->yaw += *angle;
    playerStatus->targetYaw = playerNpc->yaw = clamp_angle(playerNpc->yaw);

    return ApiStatus_DONE2;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel fio_serialize_state
/* 6A30 8002B630 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* 6A34 8002B634 AFB20018 */  sw        $s2, 0x18($sp)
/* 6A38 8002B638 3C12800E */  lui       $s2, %hi(gCurrentSaveFile)
/* 6A3C 8002B63C 2652ACC0 */  addiu     $s2, $s2, %lo(gCurrentSaveFile)
glabel func_8002B640
/* 6A40 8002B640 26440040 */  addiu     $a0, $s2, 0x40
/* 6A44 8002B644 3C028011 */  lui       $v0, %hi(gPlayerData)
/* 6A48 8002B648 2442F290 */  addiu     $v0, $v0, %lo(gPlayerData)
/* 6A4C 8002B64C 24430420 */  addiu     $v1, $v0, 0x420
/* 6A50 8002B650 AFBF001C */  sw        $ra, 0x1C($sp)
/* 6A54 8002B654 AFB10014 */  sw        $s1, 0x14($sp)
/* 6A58 8002B658 AFB00010 */  sw        $s0, 0x10($sp)
.L8002B65C:
/* 6A5C 8002B65C 8C480000 */  lw        $t0, 0x0($v0)
/* 6A60 8002B660 8C490004 */  lw        $t1, 0x4($v0)
/* 6A64 8002B664 8C4A0008 */  lw        $t2, 0x8($v0)
/* 6A68 8002B668 8C4B000C */  lw        $t3, 0xC($v0)
/* 6A6C 8002B66C AC880000 */  sw        $t0, 0x0($a0)
/* 6A70 8002B670 AC890004 */  sw        $t1, 0x4($a0)
/* 6A74 8002B674 AC8A0008 */  sw        $t2, 0x8($a0)
/* 6A78 8002B678 AC8B000C */  sw        $t3, 0xC($a0)
/* 6A7C 8002B67C 24420010 */  addiu     $v0, $v0, 0x10
/* 6A80 8002B680 1443FFF6 */  bne       $v0, $v1, .L8002B65C
/* 6A84 8002B684 24840010 */   addiu    $a0, $a0, 0x10
/* 6A88 8002B688 3C038007 */  lui       $v1, %hi(gGameStatusPtr)
/* 6A8C 8002B68C 8C63419C */  lw        $v1, %lo(gGameStatusPtr)($v1)
/* 6A90 8002B690 8C480000 */  lw        $t0, 0x0($v0)
/* 6A94 8002B694 8C490004 */  lw        $t1, 0x4($v0)
/* 6A98 8002B698 AC880000 */  sw        $t0, 0x0($a0)
/* 6A9C 8002B69C AC890004 */  sw        $t1, 0x4($a0)
/* 6AA0 8002B6A0 94620086 */  lhu       $v0, 0x86($v1)
glabel func_8002B6A4
/* 6AA4 8002B6A4 A6420468 */  sh        $v0, 0x468($s2)
/* 6AA8 8002B6A8 9462008C */  lhu       $v0, 0x8C($v1)
/* 6AAC 8002B6AC A642046A */  sh        $v0, 0x46A($s2)
/* 6AB0 8002B6B0 9462008E */  lhu       $v0, 0x8E($v1)
/* 6AB4 8002B6B4 A642046C */  sh        $v0, 0x46C($s2)
/* 6AB8 8002B6B8 94620160 */  lhu       $v0, 0x160($v1)
/* 6ABC 8002B6BC A64212E6 */  sh        $v0, 0x12E6($s2)
/* 6AC0 8002B6C0 94620162 */  lhu       $v0, 0x162($v1)
/* 6AC4 8002B6C4 0000302D */  daddu     $a2, $zero, $zero
/* 6AC8 8002B6C8 A64212E8 */  sh        $v0, 0x12E8($s2)
/* 6ACC 8002B6CC 94620164 */  lhu       $v0, 0x164($v1)
/* 6AD0 8002B6D0 3C07800B */  lui       $a3, %hi(gCurrentEncounter)
/* 6AD4 8002B6D4 24E70F10 */  addiu     $a3, $a3, %lo(gCurrentEncounter)
/* 6AD8 8002B6D8 A64212EA */  sh        $v0, 0x12EA($s2)
/* 6ADC 8002B6DC 0000282D */  daddu     $a1, $zero, $zero
.L8002B6E0:
/* 6AE0 8002B6E0 00062080 */  sll       $a0, $a2, 2
.L8002B6E4:
/* 6AE4 8002B6E4 02441821 */  addu      $v1, $s2, $a0
/* 6AE8 8002B6E8 00871021 */  addu      $v0, $a0, $a3
/* 6AEC 8002B6EC 8C4200B0 */  lw        $v0, 0xB0($v0)
/* 6AF0 8002B6F0 24A50001 */  addiu     $a1, $a1, 0x1
/* 6AF4 8002B6F4 AC620470 */  sw        $v0, 0x470($v1)
/* 6AF8 8002B6F8 28A2003C */  slti      $v0, $a1, 0x3C
/* 6AFC 8002B6FC 1440FFF9 */  bnez      $v0, .L8002B6E4
/* 6B00 8002B700 24840030 */   addiu    $a0, $a0, 0x30
/* 6B04 8002B704 24C60001 */  addiu     $a2, $a2, 0x1
/* 6B08 8002B708 28C2000C */  slti      $v0, $a2, 0xC
/* 6B0C 8002B70C 1440FFF4 */  bnez      $v0, .L8002B6E0
/* 6B10 8002B710 0000282D */   daddu    $a1, $zero, $zero
/* 6B14 8002B714 3C108007 */  lui       $s0, %hi(gGameStatusPtr)
/* 6B18 8002B718 2610419C */  addiu     $s0, $s0, %lo(gGameStatusPtr)
/* 6B1C 8002B71C 8E020000 */  lw        $v0, 0x0($s0)
/* 6B20 8002B720 8E030000 */  lw        $v1, 0x0($s0)
/* 6B24 8002B724 90420074 */  lbu       $v0, 0x74($v0)
/* 6B28 8002B728 A24212E0 */  sb        $v0, 0x12E0($s2)
/* 6B2C 8002B72C 90620076 */  lbu       $v0, 0x76($v1)
/* 6B30 8002B730 8E030000 */  lw        $v1, 0x0($s0)
/* 6B34 8002B734 A24212E1 */  sb        $v0, 0x12E1($s2)
/* 6B38 8002B738 90620077 */  lbu       $v0, 0x77($v1)
/* 6B3C 8002B73C 8E030000 */  lw        $v1, 0x0($s0)
/* 6B40 8002B740 A24212E2 */  sb        $v0, 0x12E2($s2)
/* 6B44 8002B744 9062007A */  lbu       $v0, 0x7A($v1)
/* 6B48 8002B748 8E030000 */  lw        $v1, 0x0($s0)
/* 6B4C 8002B74C A24212E3 */  sb        $v0, 0x12E3($s2)
/* 6B50 8002B750 90630166 */  lbu       $v1, 0x166($v1)
/* 6B54 8002B754 3C118011 */  lui       $s1, %hi(gPlayerData)
/* 6B58 8002B758 2631F290 */  addiu     $s1, $s1, %lo(gPlayerData)
/* 6B5C 8002B75C 00031040 */  sll       $v0, $v1, 1
/* 6B60 8002B760 00431021 */  addu      $v0, $v0, $v1
/* 6B64 8002B764 92230009 */  lbu       $v1, 0x9($s1)
/* 6B68 8002B768 000210C0 */  sll       $v0, $v0, 3
/* 6B6C 8002B76C 3C018007 */  lui       $at, %hi(D_800779CA)
/* 6B70 8002B770 00220821 */  addu      $at, $at, $v0
/* 6B74 8002B774 A02379CA */  sb        $v1, %lo(D_800779CA)($at)
/* 6B78 8002B778 0C00AB90 */  jal       get_spirits_rescued
/* 6B7C 8002B77C 00000000 */   nop
/* 6B80 8002B780 8E030000 */  lw        $v1, 0x0($s0)
/* 6B84 8002B784 90640166 */  lbu       $a0, 0x166($v1)
/* 6B88 8002B788 00041840 */  sll       $v1, $a0, 1
/* 6B8C 8002B78C 00641821 */  addu      $v1, $v1, $a0
/* 6B90 8002B790 000318C0 */  sll       $v1, $v1, 3
/* 6B94 8002B794 3C018007 */  lui       $at, %hi(D_800779C8)
/* 6B98 8002B798 00230821 */  addu      $at, $at, $v1
/* 6B9C 8002B79C A02279C8 */  sb        $v0, %lo(D_800779C8)($at)
/* 6BA0 8002B7A0 8E040000 */  lw        $a0, 0x0($s0)
/* 6BA4 8002B7A4 90830166 */  lbu       $v1, 0x166($a0)
/* 6BA8 8002B7A8 00031040 */  sll       $v0, $v1, 1
/* 6BAC 8002B7AC 00431021 */  addu      $v0, $v0, $v1
/* 6BB0 8002B7B0 8E2302BC */  lw        $v1, 0x2BC($s1)
/* 6BB4 8002B7B4 000210C0 */  sll       $v0, $v0, 3
/* 6BB8 8002B7B8 3C018007 */  lui       $at, %hi(gSaveSlotMetadata)
/* 6BBC 8002B7BC 00220821 */  addu      $at, $at, $v0
/* 6BC0 8002B7C0 AC2379C4 */  sw        $v1, %lo(gSaveSlotMetadata)($at)
/* 6BC4 8002B7C4 90830166 */  lbu       $v1, 0x166($a0)
/* 6BC8 8002B7C8 00031040 */  sll       $v0, $v1, 1
/* 6BCC 8002B7CC 00431021 */  addu      $v0, $v0, $v1
/* 6BD0 8002B7D0 000210C0 */  sll       $v0, $v0, 3
/* 6BD4 8002B7D4 3C088007 */  lui       $t0, %hi(gSaveSlotMetadata)
/* 6BD8 8002B7D8 01024021 */  addu      $t0, $t0, $v0
/* 6BDC 8002B7DC 8D0879C4 */  lw        $t0, %lo(gSaveSlotMetadata)($t0)
/* 6BE0 8002B7E0 3C098007 */  lui       $t1, %hi(D_800779C8)
/* 6BE4 8002B7E4 01224821 */  addu      $t1, $t1, $v0
/* 6BE8 8002B7E8 8D2979C8 */  lw        $t1, %lo(D_800779C8)($t1)
/* 6BEC 8002B7EC 3C0A8007 */  lui       $t2, %hi(D_800779CC)
/* 6BF0 8002B7F0 01425021 */  addu      $t2, $t2, $v0
/* 6BF4 8002B7F4 8D4A79CC */  lw        $t2, %lo(D_800779CC)($t2)
/* 6BF8 8002B7F8 3C0B8007 */  lui       $t3, %hi(D_800779D0)
/* 6BFC 8002B7FC 01625821 */  addu      $t3, $t3, $v0
/* 6C00 8002B800 8D6B79D0 */  lw        $t3, %lo(D_800779D0)($t3)
/* 6C04 8002B804 AE4812EC */  sw        $t0, 0x12EC($s2)
/* 6C08 8002B808 AE4912F0 */  sw        $t1, 0x12F0($s2)
/* 6C0C 8002B80C AE4A12F4 */  sw        $t2, 0x12F4($s2)
/* 6C10 8002B810 AE4B12F8 */  sw        $t3, 0x12F8($s2)
/* 6C14 8002B814 3C088007 */  lui       $t0, %hi(D_800779D4)
/* 6C18 8002B818 01024021 */  addu      $t0, $t0, $v0
/* 6C1C 8002B81C 8D0879D4 */  lw        $t0, %lo(D_800779D4)($t0)
/* 6C20 8002B820 3C098007 */  lui       $t1, %hi(D_800779D8)
/* 6C24 8002B824 01224821 */  addu      $t1, $t1, $v0
/* 6C28 8002B828 8D2979D8 */  lw        $t1, %lo(D_800779D8)($t1)
/* 6C2C 8002B82C AE4812FC */  sw        $t0, 0x12FC($s2)
/* 6C30 8002B830 AE491300 */  sw        $t1, 0x1300($s2)
/* 6C34 8002B834 8FBF001C */  lw        $ra, 0x1C($sp)
/* 6C38 8002B838 8FB20018 */  lw        $s2, 0x18($sp)
/* 6C3C 8002B83C 8FB10014 */  lw        $s1, 0x14($sp)
/* 6C40 8002B840 8FB00010 */  lw        $s0, 0x10($sp)
/* 6C44 8002B844 03E00008 */  jr        $ra
/* 6C48 8002B848 27BD0020 */   addiu    $sp, $sp, 0x20

### DECOMPILED C INSTRUCTIONS:

void fio_serialize_state(void) {
    SaveData* saveData = &gCurrentSaveFile;
    s32 i, j;

    saveData->player = gPlayerData;

    saveData->areaID = gGameStatusPtr->areaID;
    saveData->mapID = gGameStatusPtr->mapID;
    saveData->entryID = gGameStatusPtr->entryID;
    saveData->savePos.x = gGameStatusPtr->savedPos.x;
    saveData->savePos.y = gGameStatusPtr->savedPos.y;
    saveData->savePos.z = gGameStatusPtr->savedPos.z;

    for (i = 0; i < ARRAY_COUNT(gCurrentEncounter.defeatFlags[0]); i++) {
        for (j = 0; j < ARRAY_COUNT(gCurrentEncounter.defeatFlags); j++) {
            saveData->enemyDefeatFlags[j][i] = gCurrentEncounter.defeatFlags[j][i];
        }
    }

    saveData->debugEnemyContact = gGameStatusPtr->debugEnemyContact;
    saveData->unk_12E1 = gGameStatusPtr->unk_76;
    saveData->unk_12E2 = gGameStatusPtr->unk_77;
    saveData->musicEnabled = gGameStatusPtr->musicEnabled;

    gSaveSlotMetadata[gGameStatusPtr->saveSlot].level = gPlayerData.level;
    gSaveSlotMetadata[gGameStatusPtr->saveSlot].spiritsRescued = get_spirits_rescued();
    gSaveSlotMetadata[gGameStatusPtr->saveSlot].timePlayed = gPlayerData.frameCounter;

    saveData->unk_12EC = gSaveSlotMetadata[gGameStatusPtr->saveSlot];
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel spr_draw_npc_sprite
/* 1014C8 802DE3D8 27BDFFB8 */  addiu     $sp, $sp, -0x48
/* 1014CC 802DE3DC 308900FF */  andi      $t1, $a0, 0xFF
/* 1014D0 802DE3E0 3C02802E */  lui       $v0, %hi(SpriteInstances)
/* 1014D4 802DE3E4 2442FA48 */  addiu     $v0, $v0, %lo(SpriteInstances)
/* 1014D8 802DE3E8 00091880 */  sll       $v1, $t1, 2
/* 1014DC 802DE3EC 00691821 */  addu      $v1, $v1, $t1
/* 1014E0 802DE3F0 00031880 */  sll       $v1, $v1, 2
/* 1014E4 802DE3F4 00621821 */  addu      $v1, $v1, $v0
/* 1014E8 802DE3F8 2402FFFF */  addiu     $v0, $zero, -0x1
/* 1014EC 802DE3FC AFBF003C */  sw        $ra, 0x3C($sp)
/* 1014F0 802DE400 AFB60038 */  sw        $s6, 0x38($sp)
/* 1014F4 802DE404 AFB50034 */  sw        $s5, 0x34($sp)
/* 1014F8 802DE408 AFB40030 */  sw        $s4, 0x30($sp)
/* 1014FC 802DE40C AFB3002C */  sw        $s3, 0x2C($sp)
/* 101500 802DE410 AFB20028 */  sw        $s2, 0x28($sp)
/* 101504 802DE414 AFB10024 */  sw        $s1, 0x24($sp)
/* 101508 802DE418 AFB00020 */  sw        $s0, 0x20($sp)
/* 10150C 802DE41C F7B40040 */  sdc1      $f20, 0x40($sp)
/* 101510 802DE420 8C68000C */  lw        $t0, 0xC($v1)
/* 101514 802DE424 8FB60058 */  lw        $s6, 0x58($sp)
/* 101518 802DE428 1102005C */  beq       $t0, $v0, .L802DE59C
/* 10151C 802DE42C 0000102D */   daddu    $v0, $zero, $zero
/* 101520 802DE430 8C620008 */  lw        $v0, 0x8($v1)
/* 101524 802DE434 310300FF */  andi      $v1, $t0, 0xFF
/* 101528 802DE438 00031880 */  sll       $v1, $v1, 2
/* 10152C 802DE43C 8C550000 */  lw        $s5, 0x0($v0)
/* 101530 802DE440 24420004 */  addiu     $v0, $v0, 0x4
/* 101534 802DE444 8C540000 */  lw        $s4, 0x0($v0)
/* 101538 802DE448 00431021 */  addu      $v0, $v0, $v1
/* 10153C 802DE44C 8C51000C */  lw        $s1, 0xC($v0)
/* 101540 802DE450 3C02802E */  lui       $v0, %hi(D_802DFEA0)
/* 101544 802DE454 2442FEA0 */  addiu     $v0, $v0, %lo(D_802DFEA0)
/* 101548 802DE458 AC400000 */  sw        $zero, 0x0($v0)
/* 10154C 802DE45C AC450004 */  sw        $a1, 0x4($v0)
/* 101550 802DE460 AC400008 */  sw        $zero, 0x8($v0)
/* 101554 802DE464 3C024000 */  lui       $v0, (0x40000000 >> 16)
/* 101558 802DE468 00821024 */  and       $v0, $a0, $v0
/* 10155C 802DE46C 1440001B */  bnez      $v0, .L802DE4DC
/* 101560 802DE470 24A2FFA5 */   addiu    $v0, $a1, -0x5B
/* 101564 802DE474 3C03800A */  lui       $v1, %hi(gCurrentCamID)
/* 101568 802DE478 8463A634 */  lh        $v1, %lo(gCurrentCamID)($v1)
/* 10156C 802DE47C 00031080 */  sll       $v0, $v1, 2
/* 101570 802DE480 00431021 */  addu      $v0, $v0, $v1
/* 101574 802DE484 00021080 */  sll       $v0, $v0, 2
/* 101578 802DE488 00431023 */  subu      $v0, $v0, $v1
/* 10157C 802DE48C 000218C0 */  sll       $v1, $v0, 3
/* 101580 802DE490 00431021 */  addu      $v0, $v0, $v1
/* 101584 802DE494 000210C0 */  sll       $v0, $v0, 3
/* 101588 802DE498 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 10158C 802DE49C 00220821 */  addu      $at, $at, $v0
/* 101590 802DE4A0 C4221DEC */  lwc1      $f2, %lo(gCameras + 0x6C)($at)
/* 101594 802DE4A4 44850000 */  mtc1      $a1, $f0
/* 101598 802DE4A8 00000000 */  nop
/* 10159C 802DE4AC 46800020 */  cvt.s.w   $f0, $f0
/* 1015A0 802DE4B0 46020000 */  add.s     $f0, $f0, $f2
/* 1015A4 802DE4B4 4600010D */  trunc.w.s $f4, $f0
/* 1015A8 802DE4B8 44052000 */  mfc1      $a1, $f4
/* 1015AC 802DE4BC 00000000 */  nop
/* 1015B0 802DE4C0 28A20169 */  slti      $v0, $a1, 0x169
/* 1015B4 802DE4C4 50400001 */  beql      $v0, $zero, .L802DE4CC
/* 1015B8 802DE4C8 24A5FE98 */   addiu    $a1, $a1, -0x168
.L802DE4CC:
/* 1015BC 802DE4CC 28A2FE98 */  slti      $v0, $a1, -0x168
/* 1015C0 802DE4D0 54400001 */  bnel      $v0, $zero, .L802DE4D8
/* 1015C4 802DE4D4 24A50168 */   addiu    $a1, $a1, 0x168
.L802DE4D8:
/* 1015C8 802DE4D8 24A2FFA5 */  addiu     $v0, $a1, -0x5B
.L802DE4DC:
/* 1015CC 802DE4DC 2C4200B4 */  sltiu     $v0, $v0, 0xB4
/* 1015D0 802DE4E0 14400004 */  bnez      $v0, .L802DE4F4
/* 1015D4 802DE4E4 24A2010E */   addiu    $v0, $a1, 0x10E
/* 1015D8 802DE4E8 2C4200B4 */  sltiu     $v0, $v0, 0xB4
/* 1015DC 802DE4EC 10400005 */  beqz      $v0, .L802DE504
/* 1015E0 802DE4F0 00000000 */   nop
.L802DE4F4:
/* 1015E4 802DE4F4 3C01BFC0 */  lui       $at, (0xBFC00000 >> 16)
/* 1015E8 802DE4F8 4481A000 */  mtc1      $at, $f20
/* 1015EC 802DE4FC 080B7943 */  j         .L802DE50C
/* 1015F0 802DE500 00000000 */   nop
.L802DE504:
/* 1015F4 802DE504 3C013FC0 */  lui       $at, (0x3FC00000 >> 16)
/* 1015F8 802DE508 4481A000 */  mtc1      $at, $f20
.L802DE50C:
/* 1015FC 802DE50C 04810005 */  bgez      $a0, .L802DE524
/* 101600 802DE510 241300FF */   addiu    $s3, $zero, 0xFF
/* 101604 802DE514 14C00003 */  bnez      $a2, .L802DE524
/* 101608 802DE518 30D300FF */   andi     $s3, $a2, 0xFF
/* 10160C 802DE51C 080B7967 */  j         .L802DE59C
/* 101610 802DE520 0000102D */   daddu    $v0, $zero, $zero
.L802DE524:
/* 101614 802DE524 00091080 */  sll       $v0, $t1, 2
/* 101618 802DE528 00491021 */  addu      $v0, $v0, $t1
/* 10161C 802DE52C 00021080 */  sll       $v0, $v0, 2
/* 101620 802DE530 3C10802E */  lui       $s0, %hi(D_802DFA4C)
/* 101624 802DE534 02028021 */  addu      $s0, $s0, $v0
/* 101628 802DE538 8E10FA4C */  lw        $s0, %lo(D_802DFA4C)($s0)
/* 10162C 802DE53C 3C022000 */  lui       $v0, (0x20000000 >> 16)
/* 101630 802DE540 00821024 */  and       $v0, $a0, $v0
/* 101634 802DE544 54400001 */  bnel      $v0, $zero, .L802DE54C
/* 101638 802DE548 00E0A02D */   daddu    $s4, $a3, $zero
.L802DE54C:
/* 10163C 802DE54C 8E030000 */  lw        $v1, 0x0($s0)
/* 101640 802DE550 2402FFFF */  addiu     $v0, $zero, -0x1
/* 101644 802DE554 10620010 */  beq       $v1, $v0, .L802DE598
/* 101648 802DE558 0040902D */   daddu    $s2, $v0, $zero
.L802DE55C:
/* 10164C 802DE55C 8E050000 */  lw        $a1, 0x0($s0)
/* 101650 802DE560 0260202D */  daddu     $a0, $s3, $zero
/* 101654 802DE564 AFB40010 */  sw        $s4, 0x10($sp)
/* 101658 802DE568 E7B40014 */  swc1      $f20, 0x14($sp)
/* 10165C 802DE56C AFB60018 */  sw        $s6, 0x18($sp)
/* 101660 802DE570 8E260000 */  lw        $a2, 0x0($s1)
/* 101664 802DE574 0C0B73B7 */  jal       spr_draw_component
/* 101668 802DE578 02A0382D */   daddu    $a3, $s5, $zero
/* 10166C 802DE57C 8E220000 */  lw        $v0, 0x0($s1)
/* 101670 802DE580 10520002 */  beq       $v0, $s2, .L802DE58C
/* 101674 802DE584 26100004 */   addiu    $s0, $s0, 0x4
/* 101678 802DE588 26310004 */  addiu     $s1, $s1, 0x4
.L802DE58C:
/* 10167C 802DE58C 8E020000 */  lw        $v0, 0x0($s0)
/* 101680 802DE590 1452FFF2 */  bne       $v0, $s2, .L802DE55C
/* 101684 802DE594 00000000 */   nop
.L802DE598:
/* 101688 802DE598 24020001 */  addiu     $v0, $zero, 0x1
.L802DE59C:
/* 10168C 802DE59C 8FBF003C */  lw        $ra, 0x3C($sp)
/* 101690 802DE5A0 8FB60038 */  lw        $s6, 0x38($sp)
/* 101694 802DE5A4 8FB50034 */  lw        $s5, 0x34($sp)
/* 101698 802DE5A8 8FB40030 */  lw        $s4, 0x30($sp)
/* 10169C 802DE5AC 8FB3002C */  lw        $s3, 0x2C($sp)
/* 1016A0 802DE5B0 8FB20028 */  lw        $s2, 0x28($sp)
/* 1016A4 802DE5B4 8FB10024 */  lw        $s1, 0x24($sp)
/* 1016A8 802DE5B8 8FB00020 */  lw        $s0, 0x20($sp)
/* 1016AC 802DE5BC D7B40040 */  ldc1      $f20, 0x40($sp)
/* 1016B0 802DE5C0 03E00008 */  jr        $ra
/* 1016B4 802DE5C4 27BD0048 */   addiu    $sp, $sp, 0x48

### DECOMPILED C INSTRUCTIONS:

s32 spr_draw_npc_sprite(s32 spriteInstanceID, s32 yaw, s32 arg2, PAL_PTR* paletteList, Matrix4f mtx) {
    s32 i = spriteInstanceID & 0xFF;
    s32 animID = SpriteInstances[i].currentAnimID;
    SpriteRasterCacheEntry** rasters;
    PAL_PTR* palettes;
    SpriteAnimComponent** animComponents;
    SpriteComponent** components;
    f32 zscale;
    u32 alpha;
    u32* spriteData;

    if (animID == ANIM_LIST_END) {
        return FALSE;
    }

    spriteData = (u32*)SpriteInstances[i].spriteData;

    // TODO: fake match or not?
    rasters = (SpriteRasterCacheEntry**)*spriteData++;
    palettes = (PAL_PTR*)*spriteData++;
    spriteData++;
    spriteData++;
    animComponents = (SpriteAnimComponent**)spriteData[animID & 0xFF];

    D_802DFEA0[0] = 0;
    D_802DFEA0[1] = yaw;
    D_802DFEA0[2] = 0;

    if (!(spriteInstanceID & DRAW_SPRITE_OVERRIDE_YAW)) {
        yaw += gCameras[gCurrentCamID].currentYaw;
        if (yaw > 360) {
            yaw -= 360;
        }
        if (yaw < -360) {
            yaw += 360;
        }
    }

    if (yaw > 90 && yaw <= 270 || yaw >= -270 && yaw < -90) {
        zscale = -1.5f;
    } else {
        zscale = 1.5f;
    }

    if (spriteInstanceID & DRAW_SPRITE_OVERRIDE_ALPHA) {
        alpha = arg2 & 0xFF;
        if (arg2 == 0) {
            return FALSE;
        }
    } else {
        alpha = 255;
    }

    components = SpriteInstances[i].componentList;
    if (spriteInstanceID & DRAW_SPRITE_OVERRIDE_PALETTES) {
        palettes = paletteList;
    }

    while (*components != PTR_LIST_END) {
        spr_draw_component(alpha, *components++, *animComponents, rasters, palettes, zscale, mtx);
        if (*animComponents != PTR_LIST_END) {
            animComponents++;
        }
    }

    return TRUE;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel balloon_appendGfx
/* 39443C E00961BC 27BDFF40 */  addiu     $sp, $sp, -0xC0
/* 394440 E00961C0 0080182D */  daddu     $v1, $a0, $zero
/* 394444 E00961C4 3C05DB06 */  lui       $a1, (0xDB060024 >> 16)
/* 394448 E00961C8 34A50024 */  ori       $a1, $a1, (0xDB060024 & 0xFFFF)
/* 39444C E00961CC 27A40018 */  addiu     $a0, $sp, 0x18
/* 394450 E00961D0 AFB1009C */  sw        $s1, 0x9C($sp)
/* 394454 E00961D4 3C11800A */  lui       $s1, %hi(gMainGfxPos)
/* 394458 E00961D8 2631A66C */  addiu     $s1, $s1, %lo(gMainGfxPos)
/* 39445C E00961DC AFB400A8 */  sw        $s4, 0xA8($sp)
/* 394460 E00961E0 3C140001 */  lui       $s4, (0x11630 >> 16)
/* 394464 E00961E4 AFB500AC */  sw        $s5, 0xAC($sp)
/* 394468 E00961E8 3C15E700 */  lui       $s5, (0xE7000000 >> 16)
/* 39446C E00961EC AFBF00B0 */  sw        $ra, 0xB0($sp)
/* 394470 E00961F0 AFB300A4 */  sw        $s3, 0xA4($sp)
/* 394474 E00961F4 AFB200A0 */  sw        $s2, 0xA0($sp)
/* 394478 E00961F8 AFB00098 */  sw        $s0, 0x98($sp)
/* 39447C E00961FC F7B400B8 */  sdc1      $f20, 0xB8($sp)
/* 394480 E0096200 8E280000 */  lw        $t0, 0x0($s1)
/* 394484 E0096204 8C72000C */  lw        $s2, 0xC($v1)
/* 394488 E0096208 0100102D */  daddu     $v0, $t0, $zero
/* 39448C E009620C 8E530000 */  lw        $s3, 0x0($s2)
/* 394490 E0096210 25080008 */  addiu     $t0, $t0, 0x8
/* 394494 E0096214 AC550000 */  sw        $s5, 0x0($v0)
/* 394498 E0096218 AC400004 */  sw        $zero, 0x4($v0)
/* 39449C E009621C AD050000 */  sw        $a1, 0x0($t0)
/* 3944A0 E0096220 8C620010 */  lw        $v0, 0x10($v1)
/* 3944A4 E0096224 36941630 */  ori       $s4, $s4, (0x11630 & 0xFFFF)
/* 3944A8 E0096228 AE280000 */  sw        $t0, 0x0($s1)
/* 3944AC E009622C 8C42001C */  lw        $v0, 0x1C($v0)
/* 3944B0 E0096230 3C038000 */  lui       $v1, (0x80000000 >> 16)
/* 3944B4 E0096234 00431021 */  addu      $v0, $v0, $v1
/* 3944B8 E0096238 AD020004 */  sw        $v0, 0x4($t0)
/* 3944BC E009623C 8E450004 */  lw        $a1, 0x4($s2)
/* 3944C0 E0096240 8E460008 */  lw        $a2, 0x8($s2)
/* 3944C4 E0096244 8E47000C */  lw        $a3, 0xC($s2)
/* 3944C8 E0096248 25080008 */  addiu     $t0, $t0, 0x8
/* 3944CC E009624C 0C080108 */  jal       shim_guTranslateF
/* 3944D0 E0096250 AE280000 */   sw       $t0, 0x0($s1)
/* 3944D4 E0096254 27B00058 */  addiu     $s0, $sp, 0x58
/* 3944D8 E0096258 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 3944DC E009625C 4481A000 */  mtc1      $at, $f20
/* 3944E0 E0096260 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 3944E4 E0096264 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 3944E8 E0096268 44800000 */  mtc1      $zero, $f0
/* 3944EC E009626C 00031080 */  sll       $v0, $v1, 2
/* 3944F0 E0096270 00431021 */  addu      $v0, $v0, $v1
/* 3944F4 E0096274 00021080 */  sll       $v0, $v0, 2
/* 3944F8 E0096278 00431023 */  subu      $v0, $v0, $v1
/* 3944FC E009627C 000218C0 */  sll       $v1, $v0, 3
/* 394500 E0096280 00431021 */  addu      $v0, $v0, $v1
/* 394504 E0096284 000210C0 */  sll       $v0, $v0, 3
/* 394508 E0096288 44060000 */  mfc1      $a2, $f0
/* 39450C E009628C 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 394510 E0096290 00220821 */  addu      $at, $at, $v0
/* 394514 E0096294 C4201DEC */  lwc1      $f0, %lo(gCameras + 0x6C)($at)
/* 394518 E0096298 4407A000 */  mfc1      $a3, $f20
/* 39451C E009629C 46000007 */  neg.s     $f0, $f0
/* 394520 E00962A0 44050000 */  mfc1      $a1, $f0
/* 394524 E00962A4 0200202D */  daddu     $a0, $s0, $zero
/* 394528 E00962A8 0C080104 */  jal       shim_guRotateF
/* 39452C E00962AC AFA60010 */   sw       $a2, 0x10($sp)
/* 394530 E00962B0 0200202D */  daddu     $a0, $s0, $zero
/* 394534 E00962B4 27A50018 */  addiu     $a1, $sp, 0x18
/* 394538 E00962B8 0C080114 */  jal       shim_guMtxCatF
/* 39453C E00962BC 00A0302D */   daddu    $a2, $a1, $zero
/* 394540 E00962C0 0200202D */  daddu     $a0, $s0, $zero
/* 394544 E00962C4 8E450018 */  lw        $a1, 0x18($s2)
/* 394548 E00962C8 4407A000 */  mfc1      $a3, $f20
/* 39454C E00962CC 0C080110 */  jal       shim_guScaleF
/* 394550 E00962D0 00A0302D */   daddu    $a2, $a1, $zero
/* 394554 E00962D4 0200202D */  daddu     $a0, $s0, $zero
/* 394558 E00962D8 27A50018 */  addiu     $a1, $sp, 0x18
/* 39455C E00962DC 0C080114 */  jal       shim_guMtxCatF
/* 394560 E00962E0 00A0302D */   daddu    $a2, $a1, $zero
/* 394564 E00962E4 27A40018 */  addiu     $a0, $sp, 0x18
/* 394568 E00962E8 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* 39456C E00962EC 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* 394570 E00962F0 3C12800A */  lui       $s2, %hi(gDisplayContext)
/* 394574 E00962F4 2652A674 */  addiu     $s2, $s2, %lo(gDisplayContext)
/* 394578 E00962F8 96050000 */  lhu       $a1, 0x0($s0)
/* 39457C E00962FC 8E420000 */  lw        $v0, 0x0($s2)
/* 394580 E0096300 00052980 */  sll       $a1, $a1, 6
/* 394584 E0096304 00B42821 */  addu      $a1, $a1, $s4
/* 394588 E0096308 0C080118 */  jal       shim_guMtxF2L
/* 39458C E009630C 00452821 */   addu     $a1, $v0, $a1
/* 394590 E0096310 3C06D838 */  lui       $a2, (0xD8380002 >> 16)
/* 394594 E0096314 34C60002 */  ori       $a2, $a2, (0xD8380002 & 0xFFFF)
/* 394598 E0096318 8E240000 */  lw        $a0, 0x0($s1)
/* 39459C E009631C 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 3945A0 E0096320 0080282D */  daddu     $a1, $a0, $zero
/* 3945A4 E0096324 24840008 */  addiu     $a0, $a0, 0x8
/* 3945A8 E0096328 AE240000 */  sw        $a0, 0x0($s1)
/* 3945AC E009632C 96020000 */  lhu       $v0, 0x0($s0)
/* 3945B0 E0096330 00139880 */  sll       $s3, $s3, 2
/* 3945B4 E0096334 ACA30000 */  sw        $v1, 0x0($a1)
/* 3945B8 E0096338 24430001 */  addiu     $v1, $v0, 0x1
/* 3945BC E009633C 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 3945C0 E0096340 00021180 */  sll       $v0, $v0, 6
/* 3945C4 E0096344 A6030000 */  sh        $v1, 0x0($s0)
/* 3945C8 E0096348 8E430000 */  lw        $v1, 0x0($s2)
/* 3945CC E009634C 00541021 */  addu      $v0, $v0, $s4
/* 3945D0 E0096350 00621821 */  addu      $v1, $v1, $v0
/* 3945D4 E0096354 24820008 */  addiu     $v0, $a0, 0x8
/* 3945D8 E0096358 ACA30004 */  sw        $v1, 0x4($a1)
/* 3945DC E009635C 3C03DE00 */  lui       $v1, (0xDE000000 >> 16)
/* 3945E0 E0096360 AE220000 */  sw        $v0, 0x0($s1)
/* 3945E4 E0096364 AC830000 */  sw        $v1, 0x0($a0)
/* 3945E8 E0096368 3C05E009 */  lui       $a1, (0xE00963E0 >> 16)
/* 3945EC E009636C 00B32821 */  addu      $a1, $a1, $s3
/* 3945F0 E0096370 8CA563E0 */  lw        $a1, (0xE00963E0 & 0xFFFF)($a1)
/* 3945F4 E0096374 24820010 */  addiu     $v0, $a0, 0x10
/* 3945F8 E0096378 AE220000 */  sw        $v0, 0x0($s1)
/* 3945FC E009637C 3C020900 */  lui       $v0, %hi(D_09001508_40E798)
/* 394600 E0096380 24421508 */  addiu     $v0, $v0, %lo(D_09001508_40E798)
/* 394604 E0096384 AC82000C */  sw        $v0, 0xC($a0)
/* 394608 E0096388 24820018 */  addiu     $v0, $a0, 0x18
/* 39460C E009638C AC830008 */  sw        $v1, 0x8($a0)
/* 394610 E0096390 AE220000 */  sw        $v0, 0x0($s1)
/* 394614 E0096394 24020040 */  addiu     $v0, $zero, 0x40
/* 394618 E0096398 AC820014 */  sw        $v0, 0x14($a0)
/* 39461C E009639C 24820020 */  addiu     $v0, $a0, 0x20
/* 394620 E00963A0 AC860010 */  sw        $a2, 0x10($a0)
/* 394624 E00963A4 AE220000 */  sw        $v0, 0x0($s1)
/* 394628 E00963A8 AC950018 */  sw        $s5, 0x18($a0)
/* 39462C E00963AC AC80001C */  sw        $zero, 0x1C($a0)
/* 394630 E00963B0 AC850004 */  sw        $a1, 0x4($a0)
/* 394634 E00963B4 8FBF00B0 */  lw        $ra, 0xB0($sp)
/* 394638 E00963B8 8FB500AC */  lw        $s5, 0xAC($sp)
/* 39463C E00963BC 8FB400A8 */  lw        $s4, 0xA8($sp)
/* 394640 E00963C0 8FB300A4 */  lw        $s3, 0xA4($sp)
/* 394644 E00963C4 8FB200A0 */  lw        $s2, 0xA0($sp)
/* 394648 E00963C8 8FB1009C */  lw        $s1, 0x9C($sp)
/* 39464C E00963CC 8FB00098 */  lw        $s0, 0x98($sp)
/* 394650 E00963D0 D7B400B8 */  ldc1      $f20, 0xB8($sp)
/* 394654 E00963D4 03E00008 */  jr        $ra
/* 394658 E00963D8 27BD00C0 */   addiu    $sp, $sp, 0xC0
/* 39465C E00963DC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void balloon_appendGfx(void* effect) {
    Matrix4f sp18;
    Matrix4f sp58;
    BalloonFXData* data = ((EffectInstance*)effect)->data.balloon;
    s32 idx = data->unk_00;

    gDPPipeSync(gMainGfxPos++);
    gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));

    shim_guTranslateF(sp18, data->unk_04, data->unk_08, data->unk_0C);
    shim_guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f);
    shim_guMtxCatF(sp58, sp18, sp18);
    shim_guScaleF(sp58, data->unk_18, data->unk_18, 1.0f);
    shim_guMtxCatF(sp58, sp18, sp18);
    shim_guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);

    gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++],
              G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
    gSPDisplayList(gMainGfxPos++, D_E00963E0[idx]);
    gSPDisplayList(gMainGfxPos++, D_09001508_395B78);
    gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    gDPPipeSync(gMainGfxPos++);
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_802546D4
/* 182FB4 802546D4 27BDFFC0 */  addiu     $sp, $sp, -0x40
/* 182FB8 802546D8 AFB10014 */  sw        $s1, 0x14($sp)
/* 182FBC 802546DC 3C11800E */  lui       $s1, %hi(gBattleStatus + 0xD8)
/* 182FC0 802546E0 8E31C148 */  lw        $s1, %lo(gBattleStatus + 0xD8)($s1)
/* 182FC4 802546E4 AFB40020 */  sw        $s4, 0x20($sp)
/* 182FC8 802546E8 0000A02D */  daddu     $s4, $zero, $zero
/* 182FCC 802546EC AFB50024 */  sw        $s5, 0x24($sp)
/* 182FD0 802546F0 3C158000 */  lui       $s5, (0x80000000 >> 16)
/* 182FD4 802546F4 AFBF0028 */  sw        $ra, 0x28($sp)
/* 182FD8 802546F8 AFB3001C */  sw        $s3, 0x1C($sp)
/* 182FDC 802546FC AFB20018 */  sw        $s2, 0x18($sp)
/* 182FE0 80254700 AFB00010 */  sw        $s0, 0x10($sp)
/* 182FE4 80254704 F7B60038 */  sdc1      $f22, 0x38($sp)
/* 182FE8 80254708 F7B40030 */  sdc1      $f20, 0x30($sp)
/* 182FEC 8025470C 8E3301F4 */  lw        $s3, 0x1F4($s1)
/* 182FF0 80254710 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* 182FF4 80254714 4481B000 */  mtc1      $at, $f22
/* 182FF8 80254718 8E6200C0 */  lw        $v0, 0xC0($s3)
/* 182FFC 8025471C 3C014F00 */  lui       $at, (0x4F000000 >> 16)
/* 183000 80254720 4481A000 */  mtc1      $at, $f20
/* 183004 80254724 0040802D */  daddu     $s0, $v0, $zero
/* 183008 80254728 920207DB */  lbu       $v0, 0x7DB($s0)
/* 18300C 8025472C 3C031000 */  lui       $v1, (0x10000000 >> 16)
/* 183010 80254730 A20008AC */  sb        $zero, 0x8AC($s0)
/* 183014 80254734 24420001 */  addiu     $v0, $v0, 0x1
/* 183018 80254738 A20207DB */  sb        $v0, 0x7DB($s0)
/* 18301C 8025473C 8E220000 */  lw        $v0, 0x0($s1)
/* 183020 80254740 0200902D */  daddu     $s2, $s0, $zero
/* 183024 80254744 00431025 */  or        $v0, $v0, $v1
/* 183028 80254748 AE220000 */  sw        $v0, 0x0($s1)
/* 18302C 8025474C A20007D8 */  sb        $zero, 0x7D8($s0)
/* 183030 80254750 A20007D9 */  sb        $zero, 0x7D9($s0)
.L80254754:
/* 183034 80254754 C6600058 */  lwc1      $f0, 0x58($s3)
/* 183038 80254758 4600010D */  trunc.w.s $f4, $f0
/* 18303C 8025475C 44022000 */  mfc1      $v0, $f4
/* 183040 80254760 00000000 */  nop
/* 183044 80254764 A60207FC */  sh        $v0, 0x7FC($s0)
/* 183048 80254768 C660005C */  lwc1      $f0, 0x5C($s3)
/* 18304C 8025476C 4600010D */  trunc.w.s $f4, $f0
/* 183050 80254770 44022000 */  mfc1      $v0, $f4
/* 183054 80254774 00000000 */  nop
/* 183058 80254778 A602081C */  sh        $v0, 0x81C($s0)
/* 18305C 8025477C C6600060 */  lwc1      $f0, 0x60($s3)
/* 183060 80254780 4600010D */  trunc.w.s $f4, $f0
/* 183064 80254784 44022000 */  mfc1      $v0, $f4
/* 183068 80254788 00000000 */  nop
/* 18306C 8025478C A602083C */  sh        $v0, 0x83C($s0)
/* 183070 80254790 C620018C */  lwc1      $f0, 0x18C($s1)
/* 183074 80254794 4600010D */  trunc.w.s $f4, $f0
/* 183078 80254798 44022000 */  mfc1      $v0, $f4
/* 18307C 8025479C 00000000 */  nop
/* 183080 802547A0 A60207DC */  sh        $v0, 0x7DC($s0)
/* 183084 802547A4 86220168 */  lh        $v0, 0x168($s1)
/* 183088 802547A8 C6220188 */  lwc1      $f2, 0x188($s1)
/* 18308C 802547AC 44820000 */  mtc1      $v0, $f0
/* 183090 802547B0 00000000 */  nop
/* 183094 802547B4 46800020 */  cvt.s.w   $f0, $f0
/* 183098 802547B8 46020002 */  mul.s     $f0, $f0, $f2
/* 18309C 802547BC 00000000 */  nop
/* 1830A0 802547C0 4600010D */  trunc.w.s $f4, $f0
/* 1830A4 802547C4 44022000 */  mfc1      $v0, $f4
/* 1830A8 802547C8 00000000 */  nop
/* 1830AC 802547CC A242085C */  sb        $v0, 0x85C($s2)
nok_02_D_802547D0:
/* 1830B0 802547D0 8622016A */  lh        $v0, 0x16A($s1)
/* 1830B4 802547D4 C6220188 */  lwc1      $f2, 0x188($s1)
/* 1830B8 802547D8 44820000 */  mtc1      $v0, $f0
/* 1830BC 802547DC 00000000 */  nop
/* 1830C0 802547E0 46800020 */  cvt.s.w   $f0, $f0
/* 1830C4 802547E4 46020002 */  mul.s     $f0, $f0, $f2
/* 1830C8 802547E8 00000000 */  nop
/* 1830CC 802547EC 4600010D */  trunc.w.s $f4, $f0
/* 1830D0 802547F0 44022000 */  mfc1      $v0, $f4
/* 1830D4 802547F4 00000000 */  nop
/* 1830D8 802547F8 A242086C */  sb        $v0, 0x86C($s2)
/* 1830DC 802547FC 0C00A6C9 */  jal       clamp_angle
/* 1830E0 80254800 C62C015C */   lwc1     $f12, 0x15C($s1)
/* 1830E4 80254804 46160002 */  mul.s     $f0, $f0, $f22
/* 1830E8 80254808 00000000 */  nop
/* 1830EC 8025480C 4600A03E */  c.le.s    $f20, $f0
/* 1830F0 80254810 00000000 */  nop
/* 1830F4 80254814 45010005 */  bc1t      .L8025482C
/* 1830F8 80254818 2643087C */   addiu    $v1, $s2, 0x87C
/* 1830FC 8025481C 4600010D */  trunc.w.s $f4, $f0
/* 183100 80254820 44022000 */  mfc1      $v0, $f4
/* 183104 80254824 08095211 */  j         .L80254844
/* 183108 80254828 A0620000 */   sb       $v0, 0x0($v1)
.L8025482C:
/* 18310C 8025482C 46140001 */  sub.s     $f0, $f0, $f20
/* 183110 80254830 4600010D */  trunc.w.s $f4, $f0
/* 183114 80254834 44022000 */  mfc1      $v0, $f4
/* 183118 80254838 00000000 */  nop
/* 18311C 8025483C 00551025 */  or        $v0, $v0, $s5
/* 183120 80254840 A0620000 */  sb        $v0, 0x0($v1)
.L80254844:
/* 183124 80254844 0C00A6C9 */  jal       clamp_angle
/* 183128 80254848 C62C0160 */   lwc1     $f12, 0x160($s1)
/* 18312C 8025484C 46160002 */  mul.s     $f0, $f0, $f22
/* 183130 80254850 00000000 */  nop
/* 183134 80254854 4600A03E */  c.le.s    $f20, $f0
D_80254858:
/* 183138 80254858 00000000 */  nop
/* 18313C 8025485C 45010005 */  bc1t      .L80254874
D_80254860:
/* 183140 80254860 2643088C */   addiu    $v1, $s2, 0x88C
/* 183144 80254864 4600010D */  trunc.w.s $f4, $f0
/* 183148 80254868 44022000 */  mfc1      $v0, $f4
/* 18314C 8025486C 08095223 */  j         .L8025488C
/* 183150 80254870 A0620000 */   sb       $v0, 0x0($v1)
.L80254874:
/* 183154 80254874 46140001 */  sub.s     $f0, $f0, $f20
/* 183158 80254878 4600010D */  trunc.w.s $f4, $f0
/* 18315C 8025487C 44022000 */  mfc1      $v0, $f4
/* 183160 80254880 00000000 */  nop
/* 183164 80254884 00551025 */  or        $v0, $v0, $s5
/* 183168 80254888 A0620000 */  sb        $v0, 0x0($v1)
.L8025488C:
/* 18316C 8025488C 0C00A6C9 */  jal       clamp_angle
/* 183170 80254890 C62C0164 */   lwc1     $f12, 0x164($s1)
/* 183174 80254894 46160002 */  mul.s     $f0, $f0, $f22
/* 183178 80254898 00000000 */  nop
/* 18317C 8025489C 4600A03E */  c.le.s    $f20, $f0
/* 183180 802548A0 00000000 */  nop
/* 183184 802548A4 45010005 */  bc1t      .L802548BC
/* 183188 802548A8 2643089C */   addiu    $v1, $s2, 0x89C
/* 18318C 802548AC 4600010D */  trunc.w.s $f4, $f0
/* 183190 802548B0 44022000 */  mfc1      $v0, $f4
/* 183194 802548B4 08095235 */  j         .L802548D4
/* 183198 802548B8 A0620000 */   sb       $v0, 0x0($v1)
.L802548BC:
/* 18319C 802548BC 46140001 */  sub.s     $f0, $f0, $f20
/* 1831A0 802548C0 4600010D */  trunc.w.s $f4, $f0
/* 1831A4 802548C4 44022000 */  mfc1      $v0, $f4
/* 1831A8 802548C8 00000000 */  nop
/* 1831AC 802548CC 00551025 */  or        $v0, $v0, $s5
/* 1831B0 802548D0 A0620000 */  sb        $v0, 0x0($v1)
.L802548D4:
/* 1831B4 802548D4 26520001 */  addiu     $s2, $s2, 0x1
/* 1831B8 802548D8 26940001 */  addiu     $s4, $s4, 0x1
/* 1831BC 802548DC 2A820010 */  slti      $v0, $s4, 0x10
/* 1831C0 802548E0 1440FF9C */  bnez      $v0, .L80254754
/* 1831C4 802548E4 26100002 */   addiu    $s0, $s0, 0x2
/* 1831C8 802548E8 8FBF0028 */  lw        $ra, 0x28($sp)
/* 1831CC 802548EC 8FB50024 */  lw        $s5, 0x24($sp)
/* 1831D0 802548F0 8FB40020 */  lw        $s4, 0x20($sp)
/* 1831D4 802548F4 8FB3001C */  lw        $s3, 0x1C($sp)
/* 1831D8 802548F8 8FB20018 */  lw        $s2, 0x18($sp)
/* 1831DC 802548FC 8FB10014 */  lw        $s1, 0x14($sp)
/* 1831E0 80254900 8FB00010 */  lw        $s0, 0x10($sp)
/* 1831E4 80254904 D7B60038 */  ldc1      $f22, 0x38($sp)
/* 1831E8 80254908 D7B40030 */  ldc1      $f20, 0x30($sp)
/* 1831EC 8025490C 03E00008 */  jr        $ra
/* 1831F0 80254910 27BD0040 */   addiu    $sp, $sp, 0x40

### DECOMPILED C INSTRUCTIONS:

void enable_player_blur(void) {
    Actor* playerActor = gBattleStatus.playerActor;
    ActorPart* partsTable = playerActor->partsTable;
    DecorationTable* decorationTable = partsTable->decorationTable;
    s32 i;

    decorationTable->effectType = 0;
    decorationTable->unk_7DB++;
    playerActor->flags |= ACTOR_FLAG_BLUR_ENABLED;
    decorationTable->unk_7D8 = 0;
    decorationTable->unk_7D9 = 0;

    for (i = 0; i < ARRAY_COUNT(decorationTable->posX); i++) {
        decorationTable->posX[i] = partsTable->currentPos.x;
        decorationTable->posY[i] = partsTable->currentPos.y;
        decorationTable->posZ[i] = partsTable->currentPos.z;
        decorationTable->yaw[i] = playerActor->yaw;
        decorationTable->rotationPivotOffsetX[i] = playerActor->rotationPivotOffset.x * playerActor->scalingFactor;
        decorationTable->rotationPivotOffsetY[i] = playerActor->rotationPivotOffset.y * playerActor->scalingFactor;

        decorationTable->rotX[i] = clamp_angle(playerActor->rotation.x) * 0.5f;
        decorationTable->rotY[i] = clamp_angle(playerActor->rotation.y) * 0.5f;
        decorationTable->rotZ[i] = clamp_angle(playerActor->rotation.z) * 0.5f;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel update_camera_mode_5
/* B400 80030000 3C014190 */  lui       $at, (0x41900000 >> 16)
/* B404 80030004 44810000 */  mtc1      $at, $f0
/* B408 80030008 3C01442C */  lui       $at, (0x442C8000 >> 16)
/* B40C 8003000C 34218000 */  ori       $at, $at, (0x442C8000 & 0xFFFF)
/* B410 80030010 44811000 */  mtc1      $at, $f2
/* B414 80030014 3C01423C */  lui       $at, (0x423C0000 >> 16)
/* B418 80030018 44812000 */  mtc1      $at, $f4
/* B41C 8003001C 27BDFFC8 */  addiu     $sp, $sp, -0x38
/* B420 80030020 AFB00010 */  sw        $s0, 0x10($sp)
/* B424 80030024 0080802D */  daddu     $s0, $a0, $zero
/* B428 80030028 AFBF0014 */  sw        $ra, 0x14($sp)
/* B42C 8003002C F7BA0030 */  sdc1      $f26, 0x30($sp)
/* B430 80030030 F7B80028 */  sdc1      $f24, 0x28($sp)
/* B434 80030034 F7B60020 */  sdc1      $f22, 0x20($sp)
/* B438 80030038 F7B40018 */  sdc1      $f20, 0x18($sp)
/* B43C 8003003C 86020006 */  lh        $v0, 0x6($s0)
/* B440 80030040 E6000074 */  swc1      $f0, 0x74($s0)
/* B444 80030044 E6020078 */  swc1      $f2, 0x78($s0)
/* B448 80030048 10400013 */  beqz      $v0, .L80030098
/* B44C 8003004C E604007C */   swc1     $f4, 0x7C($s0)
/* B450 80030050 46002086 */  mov.s     $f2, $f4
/* B454 80030054 44800000 */  mtc1      $zero, $f0
/* B458 80030058 C6060060 */  lwc1      $f6, 0x60($s0)
/* B45C 8003005C C6040068 */  lwc1      $f4, 0x68($s0)
/* B460 80030060 44050000 */  mfc1      $a1, $f0
/* B464 80030064 E6000550 */  swc1      $f0, 0x550($s0)
/* B468 80030068 E6000070 */  swc1      $f0, 0x70($s0)
/* B46C 8003006C E6000084 */  swc1      $f0, 0x84($s0)
/* B470 80030070 C6000064 */  lwc1      $f0, 0x64($s0)
/* B474 80030074 0000382D */  daddu     $a3, $zero, $zero
/* B478 80030078 A6000006 */  sh        $zero, 0x6($s0)
/* B47C 8003007C A6000554 */  sh        $zero, 0x554($s0)
/* B480 80030080 E6060048 */  swc1      $f6, 0x48($s0)
/* B484 80030084 46020000 */  add.s     $f0, $f0, $f2
/* B488 80030088 E6040050 */  swc1      $f4, 0x50($s0)
/* B48C 8003008C 00A0302D */  daddu     $a2, $a1, $zero
/* B490 80030090 0800C04F */  j         .L8003013C
/* B494 80030094 E600004C */   swc1     $f0, 0x4C($s0)
.L80030098:
/* B498 80030098 3C028011 */  lui       $v0, %hi(gPlayerStatus)
/* B49C 8003009C 2442EFC8 */  addiu     $v0, $v0, %lo(gPlayerStatus)
/* B4A0 800300A0 C4480054 */  lwc1      $f8, 0x54($v0)
/* B4A4 800300A4 3C013FC0 */  lui       $at, (0x3FC00000 >> 16)
/* B4A8 800300A8 44813000 */  mtc1      $at, $f6
/* B4AC 800300AC 00000000 */  nop
/* B4B0 800300B0 46064182 */  mul.s     $f6, $f8, $f6
/* B4B4 800300B4 00000000 */  nop
/* B4B8 800300B8 3C013D4C */  lui       $at, (0x3D4CCCCD >> 16)
/* B4BC 800300BC 3421CCCD */  ori       $at, $at, (0x3D4CCCCD & 0xFFFF)
/* B4C0 800300C0 44816000 */  mtc1      $at, $f12
/* B4C4 800300C4 00000000 */  nop
/* B4C8 800300C8 460C4202 */  mul.s     $f8, $f8, $f12
/* B4CC 800300CC 00000000 */  nop
/* B4D0 800300D0 C6040060 */  lwc1      $f4, 0x60($s0)
/* B4D4 800300D4 C6000550 */  lwc1      $f0, 0x550($s0)
/* B4D8 800300D8 C6020064 */  lwc1      $f2, 0x64($s0)
/* B4DC 800300DC 46002100 */  add.s     $f4, $f4, $f0
/* B4E0 800300E0 C600007C */  lwc1      $f0, 0x7C($s0)
/* B4E4 800300E4 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* B4E8 800300E8 44815000 */  mtc1      $at, $f10
/* B4EC 800300EC 46001080 */  add.s     $f2, $f2, $f0
/* B4F0 800300F0 C6000068 */  lwc1      $f0, 0x68($s0)
/* B4F4 800300F4 0200202D */  daddu     $a0, $s0, $zero
/* B4F8 800300F8 E600005C */  swc1      $f0, 0x5C($s0)
/* B4FC 800300FC 460A3580 */  add.s     $f22, $f6, $f10
/* B500 80030100 E6040054 */  swc1      $f4, 0x54($s0)
/* B504 80030104 E6020058 */  swc1      $f2, 0x58($s0)
/* B508 80030108 0C00C0D3 */  jal       func_8003034C
/* B50C 8003010C 460C4500 */   add.s    $f20, $f8, $f12
/* B510 80030110 96020002 */  lhu       $v0, 0x2($s0)
/* B514 80030114 30420001 */  andi      $v0, $v0, 0x1
/* B518 80030118 14400005 */  bnez      $v0, .L80030130
/* B51C 8003011C 0200202D */   daddu    $a0, $s0, $zero
/* B520 80030120 4405A000 */  mfc1      $a1, $f20
/* B524 80030124 4406B000 */  mfc1      $a2, $f22
/* B528 80030128 0800C04F */  j         .L8003013C
/* B52C 8003012C 0000382D */   daddu    $a3, $zero, $zero
.L80030130:
/* B530 80030130 4405A000 */  mfc1      $a1, $f20
/* B534 80030134 4406B000 */  mfc1      $a2, $f22
/* B538 80030138 24070001 */  addiu     $a3, $zero, 0x1
.L8003013C:
/* B53C 8003013C 0C00C084 */  jal       cam_interp_lookat_pos
/* B540 80030140 00000000 */   nop
/* B544 80030144 C60C003C */  lwc1      $f12, 0x3C($s0)
/* B548 80030148 C60E0044 */  lwc1      $f14, 0x44($s0)
/* B54C 8003014C 8E060048 */  lw        $a2, 0x48($s0)
/* B550 80030150 8E070050 */  lw        $a3, 0x50($s0)
/* B554 80030154 4480C000 */  mtc1      $zero, $f24
/* B558 80030158 0C00A720 */  jal       atan2
/* B55C 8003015C 00000000 */   nop
/* B560 80030160 4600C306 */  mov.s     $f12, $f24
/* B564 80030164 4600C386 */  mov.s     $f14, $f24
/* B568 80030168 C6040048 */  lwc1      $f4, 0x48($s0)
/* B56C 8003016C C602003C */  lwc1      $f2, 0x3C($s0)
/* B570 80030170 C6140050 */  lwc1      $f20, 0x50($s0)
/* B574 80030174 46022581 */  sub.s     $f22, $f4, $f2
/* B578 80030178 C6020044 */  lwc1      $f2, 0x44($s0)
/* B57C 8003017C C604004C */  lwc1      $f4, 0x4C($s0)
/* B580 80030180 4602A501 */  sub.s     $f20, $f20, $f2
/* B584 80030184 C6020040 */  lwc1      $f2, 0x40($s0)
/* B588 80030188 4406B000 */  mfc1      $a2, $f22
/* B58C 8003018C 4407A000 */  mfc1      $a3, $f20
/* B590 80030190 46022681 */  sub.s     $f26, $f4, $f2
/* B594 80030194 0C00A720 */  jal       atan2
/* B598 80030198 E600006C */   swc1     $f0, 0x6C($s0)
/* B59C 8003019C 4616B082 */  mul.s     $f2, $f22, $f22
/* B5A0 800301A0 00000000 */  nop
/* B5A4 800301A4 4614A502 */  mul.s     $f20, $f20, $f20
/* B5A8 800301A8 00000000 */  nop
/* B5AC 800301AC 46141300 */  add.s     $f12, $f2, $f20
/* B5B0 800301B0 46000007 */  neg.s     $f0, $f0
/* B5B4 800301B4 E6000090 */  swc1      $f0, 0x90($s0)
/* B5B8 800301B8 46006004 */  sqrt.s    $f0, $f12
/* B5BC 800301BC 46000032 */  c.eq.s    $f0, $f0
/* B5C0 800301C0 00000000 */  nop
/* B5C4 800301C4 45030004 */  bc1tl     .L800301D8
/* B5C8 800301C8 4600C306 */   mov.s    $f12, $f24
/* B5CC 800301CC 0C0187BC */  jal       sqrtf
/* B5D0 800301D0 00000000 */   nop
/* B5D4 800301D4 4600C306 */  mov.s     $f12, $f24
.L800301D8:
/* B5D8 800301D8 46000007 */  neg.s     $f0, $f0
/* B5DC 800301DC 4406D000 */  mfc1      $a2, $f26
/* B5E0 800301E0 44070000 */  mfc1      $a3, $f0
/* B5E4 800301E4 0C00A720 */  jal       atan2
/* B5E8 800301E8 46006386 */   mov.s    $f14, $f12
/* B5EC 800301EC E6000094 */  swc1      $f0, 0x94($s0)
/* B5F0 800301F0 8FBF0014 */  lw        $ra, 0x14($sp)
/* B5F4 800301F4 8FB00010 */  lw        $s0, 0x10($sp)
/* B5F8 800301F8 D7BA0030 */  ldc1      $f26, 0x30($sp)
/* B5FC 800301FC D7B80028 */  ldc1      $f24, 0x28($sp)
/* B600 80030200 D7B60020 */  ldc1      $f22, 0x20($sp)
/* B604 80030204 D7B40018 */  ldc1      $f20, 0x18($sp)
/* B608 80030208 03E00008 */  jr        $ra
/* B60C 8003020C 27BD0038 */   addiu    $sp, $sp, 0x38

### DECOMPILED C INSTRUCTIONS:

void update_camera_mode_5(Camera* camera) {
    PlayerStatus* playerStatus = &gPlayerStatus;
    f32 lookXDelta, lookYDelta, lookZDelta;

    camera->currentBoomYaw = 18.0f;
    camera->currentBoomLength = 690.0f;
    camera->currentYOffset = 47.0f;

    if (camera->needsInit) {
        camera->unk_550 = 0.0f;
        camera->unk_70 = 0.0f;
        camera->trueRotation.x = 0.0f;
        camera->needsInit = FALSE;
        camera->unk_554 = 0;
        camera->lookAt_obj.x = camera->targetPos.x;
        camera->lookAt_obj.y = camera->targetPos.y + camera->currentYOffset;
        camera->lookAt_obj.z = camera->targetPos.z;
        cam_interp_lookat_pos(camera, 0.0f, 0.0f, FALSE);
    } else {
        f32 maxInterpSpeed = (playerStatus->currentSpeed * 1.5f) + 1.0f;
        f32 interpRate = (playerStatus->currentSpeed * 0.05f) + 0.05f;

        camera->lookAt_obj_target.x = camera->targetPos.x + camera->unk_550;
        camera->lookAt_obj_target.y = camera->targetPos.y + camera->currentYOffset;
        camera->lookAt_obj_target.z = camera->targetPos.z;
        func_8003034C(camera);
        if (!(camera->moveFlags & CAMERA_MOVE_IGNORE_PLAYER_Y)) {
            cam_interp_lookat_pos(camera, interpRate, maxInterpSpeed, FALSE);
        } else {
            lookXDelta = maxInterpSpeed; // needed to match

            cam_interp_lookat_pos(camera, interpRate, lookXDelta, TRUE);
        }
    }

    camera->currentYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z);
    lookXDelta = camera->lookAt_obj.x - camera->lookAt_eye.x;
    lookYDelta = camera->lookAt_obj.y - camera->lookAt_eye.y;
    lookZDelta = camera->lookAt_obj.z - camera->lookAt_eye.z;
    camera->currentBlendedYawNegated = -atan2(0.0f, 0.0f, lookXDelta, lookZDelta);
    camera->currentPitch = atan2(0.0f, 0.0f, lookYDelta, -sqrtf(SQ(lookXDelta) + SQ(lookZDelta)));
}