### RAW ASSEMBLY INSTRUCTIONS:

glabel green_impact_update
/* 3650B4 E00641A4 27BDFFB8 */  addiu     $sp, $sp, -0x48
/* 3650B8 E00641A8 AFB20018 */  sw        $s2, 0x18($sp)
/* 3650BC E00641AC 0080902D */  daddu     $s2, $a0, $zero
/* 3650C0 E00641B0 AFBF001C */  sw        $ra, 0x1C($sp)
/* 3650C4 E00641B4 AFB10014 */  sw        $s1, 0x14($sp)
/* 3650C8 E00641B8 AFB00010 */  sw        $s0, 0x10($sp)
/* 3650CC E00641BC F7BC0040 */  sdc1      $f28, 0x40($sp)
/* 3650D0 E00641C0 F7BA0038 */  sdc1      $f26, 0x38($sp)
/* 3650D4 E00641C4 F7B80030 */  sdc1      $f24, 0x30($sp)
/* 3650D8 E00641C8 F7B60028 */  sdc1      $f22, 0x28($sp)
/* 3650DC E00641CC F7B40020 */  sdc1      $f20, 0x20($sp)
/* 3650E0 E00641D0 8E44000C */  lw        $a0, 0xC($s2)
/* 3650E4 E00641D4 8C82002C */  lw        $v0, 0x2C($a0)
/* 3650E8 E00641D8 8C830028 */  lw        $v1, 0x28($a0)
/* 3650EC E00641DC 24420001 */  addiu     $v0, $v0, 0x1
/* 3650F0 E00641E0 2463FFFF */  addiu     $v1, $v1, -0x1
/* 3650F4 E00641E4 AC82002C */  sw        $v0, 0x2C($a0)
/* 3650F8 E00641E8 04610005 */  bgez      $v1, .LE0064200
/* 3650FC E00641EC AC830028 */   sw       $v1, 0x28($a0)
/* 365100 E00641F0 0C080128 */  jal       shim_remove_effect
/* 365104 E00641F4 0240202D */   daddu    $a0, $s2, $zero
/* 365108 E00641F8 080190EC */  j         .LE00643B0
/* 36510C E00641FC 00000000 */   nop
.LE0064200:
/* 365110 E0064200 8C82002C */  lw        $v0, 0x2C($a0)
/* 365114 E0064204 28420008 */  slti      $v0, $v0, 0x8
/* 365118 E0064208 14400009 */  bnez      $v0, .LE0064230
/* 36511C E006420C 00000000 */   nop
/* 365120 E0064210 3C01E006 */  lui       $at, (0xE0064A70 >> 16)
/* 365124 E0064214 D4224A70 */  ldc1      $f2, (0xE0064A70 & 0xFFFF)($at)
/* 365128 E0064218 C4800038 */  lwc1      $f0, 0x38($a0)
/* 36512C E006421C 46800021 */  cvt.d.w   $f0, $f0
/* 365130 E0064220 46220002 */  mul.d     $f0, $f0, $f2
/* 365134 E0064224 00000000 */  nop
/* 365138 E0064228 4620038D */  trunc.w.d $f14, $f0
/* 36513C E006422C E48E0038 */  swc1      $f14, 0x38($a0)
.LE0064230:
/* 365140 E0064230 8E420008 */  lw        $v0, 0x8($s2)
/* 365144 E0064234 24110001 */  addiu     $s1, $zero, 0x1
/* 365148 E0064238 0222102A */  slt       $v0, $s1, $v0
/* 36514C E006423C 1040005C */  beqz      $v0, .LE00643B0
/* 365150 E0064240 24840058 */   addiu    $a0, $a0, 0x58
/* 365154 E0064244 2490003C */  addiu     $s0, $a0, 0x3C
/* 365158 E0064248 3C013FE0 */  lui       $at, (0x3FE00000 >> 16)
/* 36515C E006424C 4481C800 */  mtc1      $at, $f25
/* 365160 E0064250 4480C000 */  mtc1      $zero, $f24
/* 365164 E0064254 3C014200 */  lui       $at, (0x42000000 >> 16)
/* 365168 E0064258 4481B000 */  mtc1      $at, $f22
/* 36516C E006425C 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* 365170 E0064260 4481E000 */  mtc1      $at, $f28
/* 365174 E0064264 3C01E006 */  lui       $at, (0xE0064A78 >> 16)
/* 365178 E0064268 D4344A78 */  ldc1      $f20, (0xE0064A78 & 0xFFFF)($at)
/* 36517C E006426C 3C014300 */  lui       $at, (0x43000000 >> 16)
/* 365180 E0064270 4481D000 */  mtc1      $at, $f26
.LE0064274:
/* 365184 E0064274 8E020010 */  lw        $v0, 0x10($s0)
/* 365188 E0064278 24420001 */  addiu     $v0, $v0, 0x1
/* 36518C E006427C 04400047 */  bltz      $v0, .LE006439C
/* 365190 E0064280 AE020010 */   sw       $v0, 0x10($s0)
/* 365194 E0064284 1440001D */  bnez      $v0, .LE00642FC
/* 365198 E0064288 00000000 */   nop
/* 36519C E006428C C60CFFF8 */  lwc1      $f12, -0x8($s0)
/* 3651A0 E0064290 AE00FFC8 */  sw        $zero, -0x38($s0)
/* 3651A4 E0064294 AE00FFCC */  sw        $zero, -0x34($s0)
/* 3651A8 E0064298 0C080140 */  jal       shim_sin_deg
/* 3651AC E006429C AE00FFD0 */   sw       $zero, -0x30($s0)
/* 3651B0 E00642A0 46000007 */  neg.s     $f0, $f0
/* 3651B4 E00642A4 46000021 */  cvt.d.s   $f0, $f0
/* 3651B8 E00642A8 46380002 */  mul.d     $f0, $f0, $f24
/* 3651BC E00642AC 00000000 */  nop
/* 3651C0 E00642B0 C60CFFF8 */  lwc1      $f12, -0x8($s0)
/* 3651C4 E00642B4 46200020 */  cvt.s.d   $f0, $f0
/* 3651C8 E00642B8 0C080144 */  jal       shim_cos_deg
/* 3651CC E00642BC E600FFD4 */   swc1     $f0, -0x2C($s0)
/* 3651D0 E00642C0 46000021 */  cvt.d.s   $f0, $f0
/* 3651D4 E00642C4 3C014120 */  lui       $at, (0x41200000 >> 16)
/* 3651D8 E00642C8 44811000 */  mtc1      $at, $f2
/* 3651DC E00642CC 46380002 */  mul.d     $f0, $f0, $f24
/* 3651E0 E00642D0 00000000 */  nop
/* 3651E4 E00642D4 AE00FFDC */  sw        $zero, -0x24($s0)
/* 3651E8 E00642D8 E6160000 */  swc1      $f22, 0x0($s0)
/* 3651EC E00642DC E6160004 */  swc1      $f22, 0x4($s0)
/* 3651F0 E00642E0 E616000C */  swc1      $f22, 0xC($s0)
/* 3651F4 E00642E4 E61CFFE0 */  swc1      $f28, -0x20($s0)
/* 3651F8 E00642E8 E61CFFE8 */  swc1      $f28, -0x18($s0)
/* 3651FC E00642EC E6160008 */  swc1      $f22, 0x8($s0)
/* 365200 E00642F0 E602FFE4 */  swc1      $f2, -0x1C($s0)
/* 365204 E00642F4 46200020 */  cvt.s.d   $f0, $f0
/* 365208 E00642F8 E600FFD8 */  swc1      $f0, -0x28($s0)
.LE00642FC:
/* 36520C E00642FC C6060004 */  lwc1      $f6, 0x4($s0)
/* 365210 E0064300 3C01E006 */  lui       $at, (0xE0064A80 >> 16)
/* 365214 E0064304 D4204A80 */  ldc1      $f0, (0xE0064A80 & 0xFFFF)($at)
/* 365218 E0064308 460031A1 */  cvt.d.s   $f6, $f6
/* 36521C E006430C 46203182 */  mul.d     $f6, $f6, $f0
/* 365220 E0064310 00000000 */  nop
/* 365224 E0064314 C604FFE4 */  lwc1      $f4, -0x1C($s0)
/* 365228 E0064318 3C01E006 */  lui       $at, (0xE0064A88 >> 16)
/* 36522C E006431C D42A4A88 */  ldc1      $f10, (0xE0064A88 & 0xFFFF)($at)
/* 365230 E0064320 46002121 */  cvt.d.s   $f4, $f4
/* 365234 E0064324 46245281 */  sub.d     $f10, $f10, $f4
/* 365238 E0064328 46345282 */  mul.d     $f10, $f10, $f20
/* 36523C E006432C 00000000 */  nop
/* 365240 E0064330 C6020004 */  lwc1      $f2, 0x4($s0)
/* 365244 E0064334 C6000000 */  lwc1      $f0, 0x0($s0)
/* 365248 E0064338 46020000 */  add.s     $f0, $f0, $f2
/* 36524C E006433C C602FFE0 */  lwc1      $f2, -0x20($s0)
/* 365250 E0064340 C6080008 */  lwc1      $f8, 0x8($s0)
/* 365254 E0064344 460010A1 */  cvt.d.s   $f2, $f2
/* 365258 E0064348 46341080 */  add.d     $f2, $f2, $f20
/* 36525C E006434C E6000000 */  swc1      $f0, 0x0($s0)
/* 365260 E0064350 C600000C */  lwc1      $f0, 0xC($s0)
/* 365264 E0064354 46004200 */  add.s     $f8, $f8, $f0
/* 365268 E0064358 C600FFE8 */  lwc1      $f0, -0x18($s0)
/* 36526C E006435C 462010A0 */  cvt.s.d   $f2, $f2
/* 365270 E0064360 46000021 */  cvt.d.s   $f0, $f0
/* 365274 E0064364 46340000 */  add.d     $f0, $f0, $f20
/* 365278 E0064368 E602FFE0 */  swc1      $f2, -0x20($s0)
/* 36527C E006436C E6080008 */  swc1      $f8, 0x8($s0)
/* 365280 E0064370 46200020 */  cvt.s.d   $f0, $f0
/* 365284 E0064374 E600FFE8 */  swc1      $f0, -0x18($s0)
/* 365288 E0064378 C6000000 */  lwc1      $f0, 0x0($s0)
/* 36528C E006437C 462A2100 */  add.d     $f4, $f4, $f10
/* 365290 E0064380 462031A0 */  cvt.s.d   $f6, $f6
/* 365294 E0064384 E6060004 */  swc1      $f6, 0x4($s0)
/* 365298 E0064388 4600D03C */  c.lt.s    $f26, $f0
/* 36529C E006438C 46202120 */  cvt.s.d   $f4, $f4
/* 3652A0 E0064390 45000002 */  bc1f      .LE006439C
/* 3652A4 E0064394 E604FFE4 */   swc1     $f4, -0x1C($s0)
/* 3652A8 E0064398 E61A0000 */  swc1      $f26, 0x0($s0)
.LE006439C:
/* 3652AC E006439C 26310001 */  addiu     $s1, $s1, 0x1
/* 3652B0 E00643A0 8E420008 */  lw        $v0, 0x8($s2)
/* 3652B4 E00643A4 0222102A */  slt       $v0, $s1, $v0
/* 3652B8 E00643A8 1440FFB2 */  bnez      $v0, .LE0064274
/* 3652BC E00643AC 26100058 */   addiu    $s0, $s0, 0x58
.LE00643B0:
/* 3652C0 E00643B0 8FBF001C */  lw        $ra, 0x1C($sp)
/* 3652C4 E00643B4 8FB20018 */  lw        $s2, 0x18($sp)
/* 3652C8 E00643B8 8FB10014 */  lw        $s1, 0x14($sp)
/* 3652CC E00643BC 8FB00010 */  lw        $s0, 0x10($sp)
/* 3652D0 E00643C0 D7BC0040 */  ldc1      $f28, 0x40($sp)
/* 3652D4 E00643C4 D7BA0038 */  ldc1      $f26, 0x38($sp)
/* 3652D8 E00643C8 D7B80030 */  ldc1      $f24, 0x30($sp)
/* 3652DC E00643CC D7B60028 */  ldc1      $f22, 0x28($sp)
/* 3652E0 E00643D0 D7B40020 */  ldc1      $f20, 0x20($sp)
/* 3652E4 E00643D4 03E00008 */  jr        $ra
/* 3652E8 E00643D8 27BD0048 */   addiu    $sp, $sp, 0x48

### DECOMPILED C INSTRUCTIONS:

void green_impact_update(EffectInstance* effect) {
    GreenImpactFXData* part = effect->data.greenImpact;
    s32 i;

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

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

    if (part->unk_2C >= 8) {
        part->unk_38 *= 0.8;
    }

    part++;
    for (i = 1; i < effect->numParts; i++, part++) {
        part->unk_4C++;
        if (part->unk_4C >= 0) {
            if (part->unk_4C == 0) {
                part->unk_04 = 0;
                part->unk_08 = 0;
                part->unk_0C = 0;
                part->unk_10 = -shim_sin_deg(part->unk_34) * 0.5;
                part->unk_14 = shim_cos_deg(part->unk_34) * 0.5;
                part->unk_18 = 0;
                part->unk_20 = 10.0f;
                part->unk_3C = 32.0f;
                part->unk_40 = 32.0f;
                part->unk_48 = 32.0f;
                part->unk_1C = 0.5f;
                part->unk_24 = 0.5f;
                part->unk_44 = 32.0f;
            }
            part->unk_3C += part->unk_40;
            part->unk_40 *= 0.9;
            part->unk_44 += part->unk_48;
            part->unk_1C += 0.2;
            part->unk_20 += (0.1 - part->unk_20) * 0.2;
            part->unk_24 += 0.2;
            if (part->unk_3C > 128.0f) {
                part->unk_3C = 128.0f;
            }
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel purple_ring_appendGfx
/* 352A78 E003E638 27BDFF50 */  addiu     $sp, $sp, -0xB0
/* 352A7C E003E63C 0080182D */  daddu     $v1, $a0, $zero
/* 352A80 E003E640 3C05DB06 */  lui       $a1, (0xDB060024 >> 16)
/* 352A84 E003E644 34A50024 */  ori       $a1, $a1, (0xDB060024 & 0xFFFF)
/* 352A88 E003E648 27A40010 */  addiu     $a0, $sp, 0x10
/* 352A8C E003E64C AFB500A4 */  sw        $s5, 0xA4($sp)
/* 352A90 E003E650 3C150001 */  lui       $s5, (0x11630 >> 16)
/* 352A94 E003E654 AFB20098 */  sw        $s2, 0x98($sp)
/* 352A98 E003E658 3C12800A */  lui       $s2, %hi(gMainGfxPos)
/* 352A9C E003E65C 2652A66C */  addiu     $s2, $s2, %lo(gMainGfxPos)
/* 352AA0 E003E660 AFB600A8 */  sw        $s6, 0xA8($sp)
/* 352AA4 E003E664 3C16E700 */  lui       $s6, (0xE7000000 >> 16)
/* 352AA8 E003E668 AFBF00AC */  sw        $ra, 0xAC($sp)
/* 352AAC E003E66C AFB400A0 */  sw        $s4, 0xA0($sp)
/* 352AB0 E003E670 AFB3009C */  sw        $s3, 0x9C($sp)
/* 352AB4 E003E674 AFB10094 */  sw        $s1, 0x94($sp)
/* 352AB8 E003E678 AFB00090 */  sw        $s0, 0x90($sp)
/* 352ABC E003E67C 8E460000 */  lw        $a2, 0x0($s2)
/* 352AC0 E003E680 8C70000C */  lw        $s0, 0xC($v1)
/* 352AC4 E003E684 00C0102D */  daddu     $v0, $a2, $zero
/* 352AC8 E003E688 24C60008 */  addiu     $a2, $a2, 0x8
/* 352ACC E003E68C AE460000 */  sw        $a2, 0x0($s2)
/* 352AD0 E003E690 C600005C */  lwc1      $f0, 0x5C($s0)
/* 352AD4 E003E694 3C14DE00 */  lui       $s4, (0xDE000000 >> 16)
/* 352AD8 E003E698 AC560000 */  sw        $s6, 0x0($v0)
/* 352ADC E003E69C AC400004 */  sw        $zero, 0x4($v0)
/* 352AE0 E003E6A0 24C20008 */  addiu     $v0, $a2, 0x8
/* 352AE4 E003E6A4 AE420000 */  sw        $v0, 0x0($s2)
/* 352AE8 E003E6A8 24C20010 */  addiu     $v0, $a2, 0x10
/* 352AEC E003E6AC ACC50000 */  sw        $a1, 0x0($a2)
/* 352AF0 E003E6B0 AE420000 */  sw        $v0, 0x0($s2)
/* 352AF4 E003E6B4 8C630010 */  lw        $v1, 0x10($v1)
/* 352AF8 E003E6B8 24C20018 */  addiu     $v0, $a2, 0x18
/* 352AFC E003E6BC AE420000 */  sw        $v0, 0x0($s2)
/* 352B00 E003E6C0 8C63001C */  lw        $v1, 0x1C($v1)
/* 352B04 E003E6C4 3C020900 */  lui       $v0, %hi(D_09000200_415260)
/* 352B08 E003E6C8 24420200 */  addiu     $v0, $v0, %lo(D_09000200_415260)
/* 352B0C E003E6CC ACC2000C */  sw        $v0, 0xC($a2)
/* 352B10 E003E6D0 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 352B14 E003E6D4 ACC20010 */  sw        $v0, 0x10($a2)
/* 352B18 E003E6D8 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 352B1C E003E6DC ACD40008 */  sw        $s4, 0x8($a2)
/* 352B20 E003E6E0 00621821 */  addu      $v1, $v1, $v0
/* 352B24 E003E6E4 ACC30004 */  sw        $v1, 0x4($a2)
/* 352B28 E003E6E8 92020074 */  lbu       $v0, 0x74($s0)
/* 352B2C E003E6EC 92030075 */  lbu       $v1, 0x75($s0)
/* 352B30 E003E6F0 92050076 */  lbu       $a1, 0x76($s0)
/* 352B34 E003E6F4 00021600 */  sll       $v0, $v0, 24
/* 352B38 E003E6F8 00031C00 */  sll       $v1, $v1, 16
/* 352B3C E003E6FC 00431025 */  or        $v0, $v0, $v1
/* 352B40 E003E700 00052A00 */  sll       $a1, $a1, 8
/* 352B44 E003E704 9203006B */  lbu       $v1, 0x6B($s0)
/* 352B48 E003E708 00451025 */  or        $v0, $v0, $a1
/* 352B4C E003E70C 00431025 */  or        $v0, $v0, $v1
/* 352B50 E003E710 ACC20014 */  sw        $v0, 0x14($a2)
/* 352B54 E003E714 8E050004 */  lw        $a1, 0x4($s0)
/* 352B58 E003E718 8E060008 */  lw        $a2, 0x8($s0)
/* 352B5C E003E71C 8E07000C */  lw        $a3, 0xC($s0)
/* 352B60 E003E720 4600008D */  trunc.w.s $f2, $f0
/* 352B64 E003E724 44111000 */  mfc1      $s1, $f2
/* 352B68 E003E728 0C080108 */  jal       shim_guTranslateF
/* 352B6C E003E72C 36B51630 */   ori      $s5, $s5, (0x11630 & 0xFFFF)
/* 352B70 E003E730 2604001C */  addiu     $a0, $s0, 0x1C
/* 352B74 E003E734 27A50010 */  addiu     $a1, $sp, 0x10
/* 352B78 E003E738 0C080114 */  jal       shim_guMtxCatF
/* 352B7C E003E73C 00A0302D */   daddu    $a2, $a1, $zero
/* 352B80 E003E740 8E050064 */  lw        $a1, 0x64($s0)
/* 352B84 E003E744 27B00050 */  addiu     $s0, $sp, 0x50
/* 352B88 E003E748 0200202D */  daddu     $a0, $s0, $zero
/* 352B8C E003E74C 00A0302D */  daddu     $a2, $a1, $zero
/* 352B90 E003E750 0C080110 */  jal       shim_guScaleF
/* 352B94 E003E754 00A0382D */   daddu    $a3, $a1, $zero
/* 352B98 E003E758 0200202D */  daddu     $a0, $s0, $zero
/* 352B9C E003E75C 27A50010 */  addiu     $a1, $sp, 0x10
/* 352BA0 E003E760 0C080114 */  jal       shim_guMtxCatF
/* 352BA4 E003E764 00A0302D */   daddu    $a2, $a1, $zero
/* 352BA8 E003E768 27A40010 */  addiu     $a0, $sp, 0x10
/* 352BAC E003E76C 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* 352BB0 E003E770 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* 352BB4 E003E774 3C13800A */  lui       $s3, %hi(gDisplayContext)
/* 352BB8 E003E778 2673A674 */  addiu     $s3, $s3, %lo(gDisplayContext)
/* 352BBC E003E77C 96050000 */  lhu       $a1, 0x0($s0)
/* 352BC0 E003E780 8E620000 */  lw        $v0, 0x0($s3)
/* 352BC4 E003E784 00052980 */  sll       $a1, $a1, 6
/* 352BC8 E003E788 00B52821 */  addu      $a1, $a1, $s5
/* 352BCC E003E78C 0C080118 */  jal       shim_guMtxF2L
/* 352BD0 E003E790 00452821 */   addu     $a1, $v0, $a1
/* 352BD4 E003E794 3C06D838 */  lui       $a2, (0xD8380002 >> 16)
/* 352BD8 E003E798 8E440000 */  lw        $a0, 0x0($s2)
/* 352BDC E003E79C 34C60002 */  ori       $a2, $a2, (0xD8380002 & 0xFFFF)
/* 352BE0 E003E7A0 0080282D */  daddu     $a1, $a0, $zero
/* 352BE4 E003E7A4 24840008 */  addiu     $a0, $a0, 0x8
/* 352BE8 E003E7A8 AE440000 */  sw        $a0, 0x0($s2)
/* 352BEC E003E7AC 96020000 */  lhu       $v0, 0x0($s0)
/* 352BF0 E003E7B0 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 352BF4 E003E7B4 ACA30000 */  sw        $v1, 0x0($a1)
/* 352BF8 E003E7B8 24430001 */  addiu     $v1, $v0, 0x1
/* 352BFC E003E7BC 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 352C00 E003E7C0 00021180 */  sll       $v0, $v0, 6
/* 352C04 E003E7C4 A6030000 */  sh        $v1, 0x0($s0)
/* 352C08 E003E7C8 8E630000 */  lw        $v1, 0x0($s3)
/* 352C0C E003E7CC 00551021 */  addu      $v0, $v0, $s5
/* 352C10 E003E7D0 00621821 */  addu      $v1, $v1, $v0
/* 352C14 E003E7D4 24820008 */  addiu     $v0, $a0, 0x8
/* 352C18 E003E7D8 ACA30004 */  sw        $v1, 0x4($a1)
/* 352C1C E003E7DC AE420000 */  sw        $v0, 0x0($s2)
/* 352C20 E003E7E0 32220FFF */  andi      $v0, $s1, 0xFFF
/* 352C24 E003E7E4 3C03F200 */  lui       $v1, (0xF2000000 >> 16)
/* 352C28 E003E7E8 00431025 */  or        $v0, $v0, $v1
/* 352C2C E003E7EC AC820000 */  sw        $v0, 0x0($a0)
/* 352C30 E003E7F0 3C020010 */  lui       $v0, (0x100000 >> 16)
/* 352C34 E003E7F4 26310040 */  addiu     $s1, $s1, 0x40
/* 352C38 E003E7F8 32310FFF */  andi      $s1, $s1, 0xFFF
/* 352C3C E003E7FC 02228825 */  or        $s1, $s1, $v0
/* 352C40 E003E800 24820010 */  addiu     $v0, $a0, 0x10
/* 352C44 E003E804 AC910004 */  sw        $s1, 0x4($a0)
/* 352C48 E003E808 AE420000 */  sw        $v0, 0x0($s2)
/* 352C4C E003E80C 3C020900 */  lui       $v0, %hi(D_090004E8_415548)
/* 352C50 E003E810 244204E8 */  addiu     $v0, $v0, %lo(D_090004E8_415548)
/* 352C54 E003E814 AC82000C */  sw        $v0, 0xC($a0)
/* 352C58 E003E818 24820018 */  addiu     $v0, $a0, 0x18
/* 352C5C E003E81C AC940008 */  sw        $s4, 0x8($a0)
/* 352C60 E003E820 AE420000 */  sw        $v0, 0x0($s2)
/* 352C64 E003E824 24020040 */  addiu     $v0, $zero, 0x40
/* 352C68 E003E828 AC820014 */  sw        $v0, 0x14($a0)
/* 352C6C E003E82C 24820020 */  addiu     $v0, $a0, 0x20
/* 352C70 E003E830 AC860010 */  sw        $a2, 0x10($a0)
/* 352C74 E003E834 AE420000 */  sw        $v0, 0x0($s2)
/* 352C78 E003E838 AC960018 */  sw        $s6, 0x18($a0)
/* 352C7C E003E83C AC80001C */  sw        $zero, 0x1C($a0)
/* 352C80 E003E840 8FBF00AC */  lw        $ra, 0xAC($sp)
/* 352C84 E003E844 8FB600A8 */  lw        $s6, 0xA8($sp)
/* 352C88 E003E848 8FB500A4 */  lw        $s5, 0xA4($sp)
/* 352C8C E003E84C 8FB400A0 */  lw        $s4, 0xA0($sp)
/* 352C90 E003E850 8FB3009C */  lw        $s3, 0x9C($sp)
/* 352C94 E003E854 8FB20098 */  lw        $s2, 0x98($sp)
/* 352C98 E003E858 8FB10094 */  lw        $s1, 0x94($sp)
/* 352C9C E003E85C 8FB00090 */  lw        $s0, 0x90($sp)
/* 352CA0 E003E860 03E00008 */  jr        $ra
/* 352CA4 E003E864 27BD00B0 */   addiu    $sp, $sp, 0xB0
/* 352CA8 E003E868 00000000 */  nop
/* 352CAC E003E86C 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void purple_ring_appendGfx(void* effect) {
    PurpleRingFXData* data = ((EffectInstance*)effect)->data.purpleRing;
    s32 unk_5C = data->unk_5C;
    s32 temp = 64;
    Matrix4f sp10;
    Matrix4f sp50;

    gDPPipeSync(gMainGfxPos++);
    gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
    gSPDisplayList(gMainGfxPos++, D_09000200_352EE0);
    gDPSetPrimColor(gMainGfxPos++, 0, 0, data->unk_74, data->unk_75, data->unk_76, data->unk_68);

    shim_guTranslateF(sp10, data->unk_04, data->unk_08, data->unk_0C);
    shim_guMtxCatF(data->unk_1C, sp10, sp10);
    shim_guScaleF(sp50, data->unk_64, data->unk_64, data->unk_64);
    shim_guMtxCatF(sp50, sp10, sp10);
    shim_guMtxF2L(sp10, &gDisplayContext->matrixStack[gMatrixListPos]);

    gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
    gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE, 0, unk_5C, temp * 4, unk_5C + temp);
    gSPDisplayList(gMainGfxPos++, D_090004E8_3531C8);
    gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    gDPPipeSync(gMainGfxPos++);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel au_bgm_player_init
/* 29558 8004E158 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* 2955C 8004E15C AFB20018 */  sw        $s2, 0x18($sp)
/* 29560 8004E160 0080902D */  daddu     $s2, $a0, $zero
/* 29564 8004E164 AFB00010 */  sw        $s0, 0x10($sp)
/* 29568 8004E168 00A0802D */  daddu     $s0, $a1, $zero
/* 2956C 8004E16C AFB10014 */  sw        $s1, 0x14($sp)
/* 29570 8004E170 00C0882D */  daddu     $s1, $a2, $zero
/* 29574 8004E174 3C050002 */  lui       $a1, (0x2625A >> 16)
/* 29578 8004E178 34A5625A */  ori       $a1, $a1, (0x2625A & 0xFFFF)
/* 2957C 8004E17C 24060030 */  addiu     $a2, $zero, 0x30
/* 29580 8004E180 AFBF001C */  sw        $ra, 0x1C($sp)
/* 29584 8004E184 0C013A20 */  jal       func_8004E880
/* 29588 8004E188 AE470000 */   sw       $a3, 0x0($s2)
/* 2958C 8004E18C 0000282D */  daddu     $a1, $zero, $zero
/* 29590 8004E190 2404007F */  addiu     $a0, $zero, 0x7F
/* 29594 8004E194 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 29598 8004E198 44810000 */  mtc1      $at, $f0
/* 2959C 8004E19C 34028000 */  ori       $v0, $zero, 0x8000
/* 295A0 8004E1A0 AE420048 */  sw        $v0, 0x48($s2)
/* 295A4 8004E1A4 24023CF0 */  addiu     $v0, $zero, 0x3CF0
/* 295A8 8004E1A8 AE4200B0 */  sw        $v0, 0xB0($s2)
/* 295AC 8004E1AC 3C027F00 */  lui       $v0, (0x7F000000 >> 16)
/* 295B0 8004E1B0 AE4200C0 */  sw        $v0, 0xC0($s2)
/* 295B4 8004E1B4 24020001 */  addiu     $v0, $zero, 0x1
/* 295B8 8004E1B8 A242022B */  sb        $v0, 0x22B($s2)
/* 295BC 8004E1BC 24020002 */  addiu     $v0, $zero, 0x2
/* 295C0 8004E1C0 AE400014 */  sw        $zero, 0x14($s2)
/* 295C4 8004E1C4 AE400018 */  sw        $zero, 0x18($s2)
/* 295C8 8004E1C8 AE40001C */  sw        $zero, 0x1C($s2)
/* 295CC 8004E1CC AE400020 */  sw        $zero, 0x20($s2)
/* 295D0 8004E1D0 A6400058 */  sh        $zero, 0x58($s2)
/* 295D4 8004E1D4 A640005A */  sh        $zero, 0x5A($s2)
/* 295D8 8004E1D8 AE400068 */  sw        $zero, 0x68($s2)
/* 295DC 8004E1DC AE40006C */  sw        $zero, 0x6C($s2)
/* 295E0 8004E1E0 AE400070 */  sw        $zero, 0x70($s2)
/* 295E4 8004E1E4 AE4000BC */  sw        $zero, 0xBC($s2)
/* 295E8 8004E1E8 AE4000B8 */  sw        $zero, 0xB8($s2)
/* 295EC 8004E1EC AE4000B4 */  sw        $zero, 0xB4($s2)
/* 295F0 8004E1F0 AE4000CC */  sw        $zero, 0xCC($s2)
/* 295F4 8004E1F4 AE4000C8 */  sw        $zero, 0xC8($s2)
/* 295F8 8004E1F8 AE4000C4 */  sw        $zero, 0xC4($s2)
/* 295FC 8004E1FC A640020C */  sh        $zero, 0x20C($s2)
/* 29600 8004E200 A640020E */  sh        $zero, 0x20E($s2)
/* 29604 8004E204 A2400220 */  sb        $zero, 0x220($s2)
/* 29608 8004E208 AE400204 */  sw        $zero, 0x204($s2)
/* 2960C 8004E20C A2400232 */  sb        $zero, 0x232($s2)
/* 29610 8004E210 A2400221 */  sb        $zero, 0x221($s2)
/* 29614 8004E214 A2500234 */  sb        $s0, 0x234($s2)
/* 29618 8004E218 A2510235 */  sb        $s1, 0x235($s2)
/* 2961C 8004E21C AE400168 */  sw        $zero, 0x168($s2)
/* 29620 8004E220 A2400222 */  sb        $zero, 0x222($s2)
/* 29624 8004E224 A2400223 */  sb        $zero, 0x223($s2)
/* 29628 8004E228 A240022A */  sb        $zero, 0x22A($s2)
/* 2962C 8004E22C A240022C */  sb        $zero, 0x22C($s2)
/* 29630 8004E230 E64000D0 */  swc1      $f0, 0xD0($s2)
/* 29634 8004E234 A240022D */  sb        $zero, 0x22D($s2)
/* 29638 8004E238 A242022F */  sb        $v0, 0x22F($s2)
/* 2963C 8004E23C 24020003 */  addiu     $v0, $zero, 0x3
/* 29640 8004E240 A2420230 */  sb        $v0, 0x230($s2)
/* 29644 8004E244 24020004 */  addiu     $v0, $zero, 0x4
/* 29648 8004E248 A240022E */  sb        $zero, 0x22E($s2)
/* 2964C 8004E24C A2420231 */  sb        $v0, 0x231($s2)
/* 29650 8004E250 00051400 */  sll       $v0, $a1, 16
.L8004E254:
/* 29654 8004E254 00021C03 */  sra       $v1, $v0, 16
/* 29658 8004E258 00031040 */  sll       $v0, $v1, 1
glabel func_8004E25C
/* 2965C 8004E25C 00431021 */  addu      $v0, $v0, $v1
/* 29660 8004E260 00021140 */  sll       $v0, $v0, 5
/* 29664 8004E264 2442025C */  addiu     $v0, $v0, 0x25C
/* 29668 8004E268 02421021 */  addu      $v0, $s2, $v0
/* 2966C 8004E26C AC400018 */  sw        $zero, 0x18($v0)
/* 29670 8004E270 AC400028 */  sw        $zero, 0x28($v0)
/* 29674 8004E274 A4400046 */  sh        $zero, 0x46($v0)
/* 29678 8004E278 A0400048 */  sb        $zero, 0x48($v0)
/* 2967C 8004E27C A040004A */  sb        $zero, 0x4A($v0)
/* 29680 8004E280 A040004B */  sb        $zero, 0x4B($v0)
/* 29684 8004E284 A4400044 */  sh        $zero, 0x44($v0)
/* 29688 8004E288 A0400058 */  sb        $zero, 0x58($v0)
/* 2968C 8004E28C A0440049 */  sb        $a0, 0x49($v0)
/* 29690 8004E290 A040004C */  sb        $zero, 0x4C($v0)
/* 29694 8004E294 28620008 */  slti      $v0, $v1, 0x8
/* 29698 8004E298 10400005 */  beqz      $v0, .L8004E2B0
/* 2969C 8004E29C 24A20001 */   addiu    $v0, $a1, 0x1
/* 296A0 8004E2A0 00031080 */  sll       $v0, $v1, 2
/* 296A4 8004E2A4 02421021 */  addu      $v0, $s2, $v0
/* 296A8 8004E2A8 AC400238 */  sw        $zero, 0x238($v0)
/* 296AC 8004E2AC 24A20001 */  addiu     $v0, $a1, 0x1
.L8004E2B0:
/* 296B0 8004E2B0 0040282D */  daddu     $a1, $v0, $zero
/* 296B4 8004E2B4 00021400 */  sll       $v0, $v0, 16
/* 296B8 8004E2B8 00021403 */  sra       $v0, $v0, 16
/* 296BC 8004E2BC 28420010 */  slti      $v0, $v0, 0x10
/* 296C0 8004E2C0 1440FFE4 */  bnez      $v0, .L8004E254
/* 296C4 8004E2C4 00051400 */   sll      $v0, $a1, 16
/* 296C8 8004E2C8 0000282D */  daddu     $a1, $zero, $zero
.L8004E2CC:
/* 296CC 8004E2CC 00051400 */  sll       $v0, $a1, 16
/* 296D0 8004E2D0 24A40001 */  addiu     $a0, $a1, 0x1
/* 296D4 8004E2D4 0080282D */  daddu     $a1, $a0, $zero
/* 296D8 8004E2D8 00021403 */  sra       $v0, $v0, 16
/* 296DC 8004E2DC 00021840 */  sll       $v1, $v0, 1
/* 296E0 8004E2E0 00621821 */  addu      $v1, $v1, $v0
/* 296E4 8004E2E4 000318C0 */  sll       $v1, $v1, 3
/* 296E8 8004E2E8 2463085C */  addiu     $v1, $v1, 0x85C
glabel func_8004E2EC
/* 296EC 8004E2EC 02431821 */  addu      $v1, $s2, $v1
/* 296F0 8004E2F0 00042400 */  sll       $a0, $a0, 16
/* 296F4 8004E2F4 00042403 */  sra       $a0, $a0, 16
/* 296F8 8004E2F8 28840018 */  slti      $a0, $a0, 0x18
/* 296FC 8004E2FC A4600008 */  sh        $zero, 0x8($v1)
/* 29700 8004E300 A460000A */  sh        $zero, 0xA($v1)
/* 29704 8004E304 AC60000C */  sw        $zero, 0xC($v1)
/* 29708 8004E308 A4600014 */  sh        $zero, 0x14($v1)
/* 2970C 8004E30C A0600016 */  sb        $zero, 0x16($v1)
/* 29710 8004E310 1480FFEE */  bnez      $a0, .L8004E2CC
/* 29714 8004E314 A0600017 */   sb       $zero, 0x17($v1)
/* 29718 8004E318 2644002C */  addiu     $a0, $s2, 0x2C
/* 2971C 8004E31C 0C014EBB */  jal       au_fade_set_vol_scale
/* 29720 8004E320 24057FFF */   addiu    $a1, $zero, 0x7FFF
/* 29724 8004E324 0C015444 */  jal       func_80055110
/* 29728 8004E328 0240202D */   daddu    $a0, $s2, $zero
/* 2972C 8004E32C 8FBF001C */  lw        $ra, 0x1C($sp)
/* 29730 8004E330 8FB20018 */  lw        $s2, 0x18($sp)
/* 29734 8004E334 8FB10014 */  lw        $s1, 0x14($sp)
/* 29738 8004E338 8FB00010 */  lw        $s0, 0x10($sp)
/* 2973C 8004E33C 03E00008 */  jr        $ra
/* 29740 8004E340 27BD0020 */   addiu    $sp, $sp, 0x20

### DECOMPILED C INSTRUCTIONS:

void au_bgm_player_init(BGMPlayer* player, s32 priority, s32 busId, AuGlobals* globals) {
    s16 i;

    player->globals = globals;
    func_8004E880(player, BGM_SAMPLE_RATE, 48);
    player->busVolume = 0x8000;
    player->masterTempo = BGM_DEFAULT_TEMPO;
    player->masterVolume = 0x7F000000;
    player->updateCounter = 0;
    player->songPlayingCounter = 0;
    player->songName = 0;
    player->fadeSongName = 0;
    player->unk_58 = 0;
    player->unk_5A = 0;
    player->segmentReadPos = NULL;
    player->segmentStartPos = NULL;
    player->subSegmentStartPos = 0;
    player->masterTempoTime = 0;
    player->masterTempoTarget = 0;
    player->masterTempoStep = 0;
    player->masterVolumeTime = 0;
    player->masterVolumeTarget = 0;
    player->masterVolumeStep = 0;
    player->masterPitchShift = 0;
    player->detune = 0;
    player->unk_220 = 0;
    player->trackVolsConfig = NULL;
    player->bFadeConfigSetsVolume = FALSE;
    player->masterState = BGM_PLAY_STATE_IDLE;
    player->priority = priority;
    player->busId = busId;
    *(s32*)player->segLoopCounters = 0;
    player->unk_222 = 0;
    player->unk_223 = 0;
    player->playbackRate = 1.0f;
    player->unk_22A[0] = 0;
    player->unk_22A[1] = 1;
    player->unk_22A[2] = 0;
    player->unk_22A[3] = 0;
    player->unk_22A[4] = 0;
    player->unk_22A[5] = 2;
    player->unk_22A[6] = 3;
    player->unk_22A[7] = 4;

    for (i = 0; i < ARRAY_COUNT(player->tracks); i++) {
        BGMPlayerTrack* temp = &player->tracks[i];

        temp->subTrackVolume = 0;
        temp->delayTime = 0;
        temp->subTrackCoarseTune = 0;
        temp->subTrackFineTune = 0;
        temp->subTrackPan = 0;
        temp->subTrackReverb = 0;
        temp->patch = 0;
        temp->isDrumTrack = FALSE;
        temp->segTrackVolume = 0x7F;
        temp->unk_4C = 0;

        if (i < ARRAY_COUNT(player->unk_238)) {
            player->unk_238[i] = 0;
        }
    }

    for (i = 0; i < ARRAY_COUNT(player->notes); i++) {
        SeqNote* note = &player->notes[i];

        note->volume = 0;
        note->adjustedPitch = 0;
        note->noteLength = 0;
        note->unk_14 = 0;
        note->noteVelocity = 0;
        note->unk_note_17 = 0;
    }

    au_fade_set_vol_scale(&player->fadeInfo, 0x7FFF);
    func_80055110(player);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel cloud_puff_update
/* 32E6F0 E0014260 27BDFFD0 */  addiu     $sp, $sp, -0x30
/* 32E6F4 E0014264 AFB40020 */  sw        $s4, 0x20($sp)
/* 32E6F8 E0014268 0080A02D */  daddu     $s4, $a0, $zero
/* 32E6FC E001426C AFB3001C */  sw        $s3, 0x1C($sp)
/* 32E700 E0014270 0000982D */  daddu     $s3, $zero, $zero
/* 32E704 E0014274 AFB20018 */  sw        $s2, 0x18($sp)
/* 32E708 E0014278 AFBF0024 */  sw        $ra, 0x24($sp)
/* 32E70C E001427C AFB10014 */  sw        $s1, 0x14($sp)
/* 32E710 E0014280 AFB00010 */  sw        $s0, 0x10($sp)
/* 32E714 E0014284 F7B40028 */  sdc1      $f20, 0x28($sp)
/* 32E718 E0014288 8E820008 */  lw        $v0, 0x8($s4)
/* 32E71C E001428C 8E91000C */  lw        $s1, 0xC($s4)
/* 32E720 E0014290 18400075 */  blez      $v0, .LE0014468
/* 32E724 E0014294 0260902D */   daddu    $s2, $s3, $zero
/* 32E728 E0014298 3C01E001 */  lui       $at, (0xE0014790 >> 16)
/* 32E72C E001429C D4344790 */  ldc1      $f20, (0xE0014790 & 0xFFFF)($at)
/* 32E730 E00142A0 26300008 */  addiu     $s0, $s1, 0x8
.LE00142A4:
/* 32E734 E00142A4 8E220000 */  lw        $v0, 0x0($s1)
/* 32E738 E00142A8 5040006A */  beql      $v0, $zero, .LE0014454
/* 32E73C E00142AC 26730001 */   addiu    $s3, $s3, 0x1
/* 32E740 E00142B0 9602FFFE */  lhu       $v0, -0x2($s0)
/* 32E744 E00142B4 2442FFFF */  addiu     $v0, $v0, -0x1
/* 32E748 E00142B8 A602FFFE */  sh        $v0, -0x2($s0)
/* 32E74C E00142BC 00021400 */  sll       $v0, $v0, 16
/* 32E750 E00142C0 1C400003 */  bgtz      $v0, .LE00142D0
/* 32E754 E00142C4 00000000 */   nop
/* 32E758 E00142C8 08005114 */  j         .LE0014450
/* 32E75C E00142CC AE200000 */   sw       $zero, 0x0($s1)
.LE00142D0:
/* 32E760 E00142D0 C6000024 */  lwc1      $f0, 0x24($s0)
/* 32E764 E00142D4 3C014140 */  lui       $at, (0x41400000 >> 16)
/* 32E768 E00142D8 44816000 */  mtc1      $at, $f12
/* 32E76C E00142DC 0C08013C */  jal       shim_clamp_angle
/* 32E770 E00142E0 460C0300 */   add.s    $f12, $f0, $f12
/* 32E774 E00142E4 46000306 */  mov.s     $f12, $f0
/* 32E778 E00142E8 0C080140 */  jal       shim_sin_deg
/* 32E77C E00142EC E60C0024 */   swc1     $f12, 0x24($s0)
/* 32E780 E00142F0 46000021 */  cvt.d.s   $f0, $f0
/* 32E784 E00142F4 46340002 */  mul.d     $f0, $f0, $f20
/* 32E788 E00142F8 00000000 */  nop
/* 32E78C E00142FC C602001C */  lwc1      $f2, 0x1C($s0)
/* 32E790 E0014300 460010A1 */  cvt.d.s   $f2, $f2
/* 32E794 E0014304 46201080 */  add.d     $f2, $f2, $f0
/* 32E798 E0014308 C60C0024 */  lwc1      $f12, 0x24($s0)
/* 32E79C E001430C 462010A0 */  cvt.s.d   $f2, $f2
/* 32E7A0 E0014310 0C080144 */  jal       shim_cos_deg
/* 32E7A4 E0014314 E6020010 */   swc1     $f2, 0x10($s0)
/* 32E7A8 E0014318 46000021 */  cvt.d.s   $f0, $f0
/* 32E7AC E001431C 46340002 */  mul.d     $f0, $f0, $f20
/* 32E7B0 E0014320 00000000 */  nop
/* 32E7B4 E0014324 C6040028 */  lwc1      $f4, 0x28($s0)
/* 32E7B8 E0014328 3C01E001 */  lui       $at, (0xE0014798 >> 16)
/* 32E7BC E001432C D4224798 */  ldc1      $f2, (0xE0014798 & 0xFFFF)($at)
/* 32E7C0 E0014330 46002121 */  cvt.d.s   $f4, $f4
/* 32E7C4 E0014334 46222102 */  mul.d     $f4, $f4, $f2
/* 32E7C8 E0014338 00000000 */  nop
/* 32E7CC E001433C C608001C */  lwc1      $f8, 0x1C($s0)
/* 32E7D0 E0014340 3C01401E */  lui       $at, (0x401E0000 >> 16)
/* 32E7D4 E0014344 44817800 */  mtc1      $at, $f15
/* 32E7D8 E0014348 44807000 */  mtc1      $zero, $f14
/* 32E7DC E001434C 46004221 */  cvt.d.s   $f8, $f8
/* 32E7E0 E0014350 46287381 */  sub.d     $f14, $f14, $f8
/* 32E7E4 E0014354 3C01E001 */  lui       $at, (0xE00147A0 >> 16)
/* 32E7E8 E0014358 D42247A0 */  ldc1      $f2, (0xE00147A0 & 0xFFFF)($at)
/* 32E7EC E001435C 46227382 */  mul.d     $f14, $f14, $f2
/* 32E7F0 E0014360 00000000 */  nop
/* 32E7F4 E0014364 C60C0020 */  lwc1      $f12, 0x20($s0)
/* 32E7F8 E0014368 3C01E001 */  lui       $at, (0xE00147A8 >> 16)
/* 32E7FC E001436C D42247A8 */  ldc1      $f2, (0xE00147A8 & 0xFFFF)($at)
/* 32E800 E0014370 46006321 */  cvt.d.s   $f12, $f12
/* 32E804 E0014374 46226302 */  mul.d     $f12, $f12, $f2
/* 32E808 E0014378 00000000 */  nop
/* 32E80C E001437C C612003C */  lwc1      $f18, 0x3C($s0)
/* 32E810 E0014380 46202120 */  cvt.s.d   $f4, $f4
/* 32E814 E0014384 46122482 */  mul.s     $f18, $f4, $f18
/* 32E818 E0014388 00000000 */  nop
/* 32E81C E001438C C6020040 */  lwc1      $f2, 0x40($s0)
/* 32E820 E0014390 24120001 */  addiu     $s2, $zero, 0x1
/* 32E824 E0014394 E6040028 */  swc1      $f4, 0x28($s0)
/* 32E828 E0014398 46002406 */  mov.s     $f16, $f4
/* 32E82C E001439C 46028402 */  mul.s     $f16, $f16, $f2
/* 32E830 E00143A0 00000000 */  nop
/* 32E834 E00143A4 C60A0030 */  lwc1      $f10, 0x30($s0)
/* 32E838 E00143A8 C606002C */  lwc1      $f6, 0x2C($s0)
/* 32E83C E00143AC C6020034 */  lwc1      $f2, 0x34($s0)
/* 32E840 E00143B0 8602FFFE */  lh        $v0, -0x2($s0)
/* 32E844 E00143B4 46025280 */  add.s     $f10, $f10, $f2
/* 32E848 E00143B8 C6020020 */  lwc1      $f2, 0x20($s0)
/* 32E84C E00143BC 2842000A */  slti      $v0, $v0, 0xA
/* 32E850 E00143C0 460010A1 */  cvt.d.s   $f2, $f2
/* 32E854 E00143C4 46201080 */  add.d     $f2, $f2, $f0
/* 32E858 E00143C8 C6040008 */  lwc1      $f4, 0x8($s0)
/* 32E85C E00143CC C600000C */  lwc1      $f0, 0xC($s0)
/* 32E860 E00143D0 462E4200 */  add.d     $f8, $f8, $f14
/* 32E864 E00143D4 46206320 */  cvt.s.d   $f12, $f12
/* 32E868 E00143D8 E60A0030 */  swc1      $f10, 0x30($s0)
/* 32E86C E00143DC E60C0020 */  swc1      $f12, 0x20($s0)
/* 32E870 E00143E0 460A3180 */  add.s     $f6, $f6, $f10
/* 32E874 E00143E4 462010A0 */  cvt.s.d   $f2, $f2
/* 32E878 E00143E8 46204220 */  cvt.s.d   $f8, $f8
/* 32E87C E00143EC 46100000 */  add.s     $f0, $f0, $f16
/* 32E880 E00143F0 E6020014 */  swc1      $f2, 0x14($s0)
/* 32E884 E00143F4 C6020004 */  lwc1      $f2, 0x4($s0)
/* 32E888 E00143F8 46062100 */  add.s     $f4, $f4, $f6
/* 32E88C E00143FC E608001C */  swc1      $f8, 0x1C($s0)
/* 32E890 E0014400 E606002C */  swc1      $f6, 0x2C($s0)
/* 32E894 E0014404 46121080 */  add.s     $f2, $f2, $f18
/* 32E898 E0014408 E600000C */  swc1      $f0, 0xC($s0)
/* 32E89C E001440C E6040008 */  swc1      $f4, 0x8($s0)
/* 32E8A0 E0014410 10400008 */  beqz      $v0, .LE0014434
/* 32E8A4 E0014414 E6020004 */   swc1     $f2, 0x4($s0)
/* 32E8A8 E0014418 3C01E001 */  lui       $at, (0xE00147B0 >> 16)
/* 32E8AC E001441C D42247B0 */  ldc1      $f2, (0xE00147B0 & 0xFFFF)($at)
/* 32E8B0 E0014420 46006021 */  cvt.d.s   $f0, $f12
/* 32E8B4 E0014424 46220002 */  mul.d     $f0, $f0, $f2
/* 32E8B8 E0014428 00000000 */  nop
/* 32E8BC E001442C 46200020 */  cvt.s.d   $f0, $f0
/* 32E8C0 E0014430 E6000020 */  swc1      $f0, 0x20($s0)
.LE0014434:
/* 32E8C4 E0014434 8602FFFE */  lh        $v0, -0x2($s0)
/* 32E8C8 E0014438 2842000F */  slti      $v0, $v0, 0xF
/* 32E8CC E001443C 50400005 */  beql      $v0, $zero, .LE0014454
/* 32E8D0 E0014440 26730001 */   addiu    $s3, $s3, 0x1
/* 32E8D4 E0014444 92020000 */  lbu       $v0, 0x0($s0)
/* 32E8D8 E0014448 2442FFF0 */  addiu     $v0, $v0, -0x10
/* 32E8DC E001444C A2020000 */  sb        $v0, 0x0($s0)
.LE0014450:
/* 32E8E0 E0014450 26730001 */  addiu     $s3, $s3, 0x1
.LE0014454:
/* 32E8E4 E0014454 2610004C */  addiu     $s0, $s0, 0x4C
/* 32E8E8 E0014458 8E820008 */  lw        $v0, 0x8($s4)
/* 32E8EC E001445C 0262102A */  slt       $v0, $s3, $v0
/* 32E8F0 E0014460 1440FF90 */  bnez      $v0, .LE00142A4
/* 32E8F4 E0014464 2631004C */   addiu    $s1, $s1, 0x4C
.LE0014468:
/* 32E8F8 E0014468 16400003 */  bnez      $s2, .LE0014478
/* 32E8FC E001446C 00000000 */   nop
/* 32E900 E0014470 0C080128 */  jal       shim_remove_effect
/* 32E904 E0014474 0280202D */   daddu    $a0, $s4, $zero
.LE0014478:
/* 32E908 E0014478 8FBF0024 */  lw        $ra, 0x24($sp)
/* 32E90C E001447C 8FB40020 */  lw        $s4, 0x20($sp)
/* 32E910 E0014480 8FB3001C */  lw        $s3, 0x1C($sp)
/* 32E914 E0014484 8FB20018 */  lw        $s2, 0x18($sp)
/* 32E918 E0014488 8FB10014 */  lw        $s1, 0x14($sp)
/* 32E91C E001448C 8FB00010 */  lw        $s0, 0x10($sp)
/* 32E920 E0014490 D7B40028 */  ldc1      $f20, 0x28($sp)
/* 32E924 E0014494 03E00008 */  jr        $ra
/* 32E928 E0014498 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

void cloud_puff_update(EffectInstance* effect) {
    CloudPuffFXData* part = effect->data.cloudPuff;
    s32 cond = FALSE;
    s32 i;

    for (i = 0; i < effect->numParts; i++, part++) {
        if (part->alive) {
            part->timeLeft--;
            if (part->timeLeft <= 0) {
                part->alive = FALSE;
            } else {
                cond = TRUE;
                part->unk_2C = shim_clamp_angle(part->unk_2C + 12.0f);
                part->unk_18 = part->unk_24 + shim_sin_deg(part->unk_2C) * 0.1;
                part->unk_1C = part->unk_28 + shim_cos_deg(part->unk_2C) * 0.1;
                part->unk_30 *= 0.83;
                part->unk_0C += part->unk_30 * part->unk_44;
                part->unk_14 += part->unk_30 * part->unk_48;
                part->unk_24 += (7.5 - part->unk_24) * 0.006;
                part->unk_38 += part->unk_3C;
                part->unk_34 += part->unk_38;
                part->unk_10 += part->unk_34;
                part->unk_28 *= 0.98;

                if (part->timeLeft < 10) {
                    part->unk_28 *= 0.9;
                }

                if (part->timeLeft < 15) {
                    part->alpha -= 16;
                }
            }
        }
    }

    if (!cond) {
        shim_remove_effect(effect);
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel get_defense
/* 194B9C 802662BC 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* 194BA0 802662C0 AFB10014 */  sw        $s1, 0x14($sp)
/* 194BA4 802662C4 00A0882D */  daddu     $s1, $a1, $zero
/* 194BA8 802662C8 AFB20018 */  sw        $s2, 0x18($sp)
/* 194BAC 802662CC 00C0902D */  daddu     $s2, $a2, $zero
/* 194BB0 802662D0 AFB00010 */  sw        $s0, 0x10($sp)
/* 194BB4 802662D4 241000FF */  addiu     $s0, $zero, 0xFF
/* 194BB8 802662D8 12200065 */  beqz      $s1, .L80266470
/* 194BBC 802662DC AFBF001C */   sw       $ra, 0x1C($sp)
/* 194BC0 802662E0 32420002 */  andi      $v0, $s2, 0x2
/* 194BC4 802662E4 10400007 */  beqz      $v0, .L80266304
/* 194BC8 802662E8 0220202D */   daddu    $a0, $s1, $zero
/* 194BCC 802662EC 0C099791 */  jal       lookup_defense
/* 194BD0 802662F0 24050002 */   addiu    $a1, $zero, 0x2
/* 194BD4 802662F4 0040182D */  daddu     $v1, $v0, $zero
/* 194BD8 802662F8 0070102A */  slt       $v0, $v1, $s0
/* 194BDC 802662FC 54400001 */  bnel      $v0, $zero, .L80266304
/* 194BE0 80266300 0060802D */   daddu    $s0, $v1, $zero
.L80266304:
/* 194BE4 80266304 32420004 */  andi      $v0, $s2, 0x4
/* 194BE8 80266308 10400007 */  beqz      $v0, .L80266328
/* 194BEC 8026630C 0220202D */   daddu    $a0, $s1, $zero
/* 194BF0 80266310 0C099791 */  jal       lookup_defense
/* 194BF4 80266314 24050003 */   addiu    $a1, $zero, 0x3
/* 194BF8 80266318 0040182D */  daddu     $v1, $v0, $zero
/* 194BFC 8026631C 0070102A */  slt       $v0, $v1, $s0
/* 194C00 80266320 54400001 */  bnel      $v0, $zero, .L80266328
/* 194C04 80266324 0060802D */   daddu    $s0, $v1, $zero
.L80266328:
/* 194C08 80266328 32420008 */  andi      $v0, $s2, 0x8
/* 194C0C 8026632C 10400007 */  beqz      $v0, .L8026634C
/* 194C10 80266330 0220202D */   daddu    $a0, $s1, $zero
/* 194C14 80266334 0C099791 */  jal       lookup_defense
/* 194C18 80266338 24050004 */   addiu    $a1, $zero, 0x4
/* 194C1C 8026633C 0040182D */  daddu     $v1, $v0, $zero
/* 194C20 80266340 0070102A */  slt       $v0, $v1, $s0
/* 194C24 80266344 54400001 */  bnel      $v0, $zero, .L8026634C
/* 194C28 80266348 0060802D */   daddu    $s0, $v1, $zero
.L8026634C:
/* 194C2C 8026634C 32420010 */  andi      $v0, $s2, 0x10
/* 194C30 80266350 10400007 */  beqz      $v0, .L80266370
/* 194C34 80266354 0220202D */   daddu    $a0, $s1, $zero
/* 194C38 80266358 0C099791 */  jal       lookup_defense
/* 194C3C 8026635C 24050007 */   addiu    $a1, $zero, 0x7
/* 194C40 80266360 0040182D */  daddu     $v1, $v0, $zero
/* 194C44 80266364 0070102A */  slt       $v0, $v1, $s0
/* 194C48 80266368 54400001 */  bnel      $v0, $zero, .L80266370
/* 194C4C 8026636C 0060802D */   daddu    $s0, $v1, $zero
.L80266370:
/* 194C50 80266370 32420040 */  andi      $v0, $s2, 0x40
/* 194C54 80266374 10400007 */  beqz      $v0, .L80266394
/* 194C58 80266378 0220202D */   daddu    $a0, $s1, $zero
/* 194C5C 8026637C 0C099791 */  jal       lookup_defense
/* 194C60 80266380 24050008 */   addiu    $a1, $zero, 0x8
/* 194C64 80266384 0040182D */  daddu     $v1, $v0, $zero
/* 194C68 80266388 0070102A */  slt       $v0, $v1, $s0
/* 194C6C 8026638C 54400001 */  bnel      $v0, $zero, .L80266394
/* 194C70 80266390 0060802D */   daddu    $s0, $v1, $zero
.L80266394:
/* 194C74 80266394 32420080 */  andi      $v0, $s2, 0x80
/* 194C78 80266398 10400007 */  beqz      $v0, .L802663B8
/* 194C7C 8026639C 0220202D */   daddu    $a0, $s1, $zero
/* 194C80 802663A0 0C099791 */  jal       lookup_defense
/* 194C84 802663A4 24050009 */   addiu    $a1, $zero, 0x9
/* 194C88 802663A8 0040182D */  daddu     $v1, $v0, $zero
/* 194C8C 802663AC 0070102A */  slt       $v0, $v1, $s0
/* 194C90 802663B0 54400001 */  bnel      $v0, $zero, .L802663B8
/* 194C94 802663B4 0060802D */   daddu    $s0, $v1, $zero
.L802663B8:
/* 194C98 802663B8 32420100 */  andi      $v0, $s2, 0x100
/* 194C9C 802663BC 10400007 */  beqz      $v0, .L802663DC
/* 194CA0 802663C0 0220202D */   daddu    $a0, $s1, $zero
/* 194CA4 802663C4 0C099791 */  jal       lookup_defense
/* 194CA8 802663C8 2405000A */   addiu    $a1, $zero, 0xA
/* 194CAC 802663CC 0040182D */  daddu     $v1, $v0, $zero
/* 194CB0 802663D0 0070102A */  slt       $v0, $v1, $s0
/* 194CB4 802663D4 54400001 */  bnel      $v0, $zero, .L802663DC
/* 194CB8 802663D8 0060802D */   daddu    $s0, $v1, $zero
.L802663DC:
/* 194CBC 802663DC 32420200 */  andi      $v0, $s2, 0x200
/* 194CC0 802663E0 10400007 */  beqz      $v0, .L80266400
/* 194CC4 802663E4 0220202D */   daddu    $a0, $s1, $zero
/* 194CC8 802663E8 0C099791 */  jal       lookup_defense
/* 194CCC 802663EC 2405000B */   addiu    $a1, $zero, 0xB
/* 194CD0 802663F0 0040182D */  daddu     $v1, $v0, $zero
/* 194CD4 802663F4 0070102A */  slt       $v0, $v1, $s0
/* 194CD8 802663F8 54400001 */  bnel      $v0, $zero, .L80266400
/* 194CDC 802663FC 0060802D */   daddu    $s0, $v1, $zero
.L80266400:
/* 194CE0 80266400 32420020 */  andi      $v0, $s2, 0x20
/* 194CE4 80266404 10400007 */  beqz      $v0, .L80266424
/* 194CE8 80266408 0220202D */   daddu    $a0, $s1, $zero
/* 194CEC 8026640C 0C099791 */  jal       lookup_defense
/* 194CF0 80266410 2405000C */   addiu    $a1, $zero, 0xC
/* 194CF4 80266414 0040182D */  daddu     $v1, $v0, $zero
/* 194CF8 80266418 0070102A */  slt       $v0, $v1, $s0
/* 194CFC 8026641C 54400001 */  bnel      $v0, $zero, .L80266424
/* 194D00 80266420 0060802D */   daddu    $s0, $v1, $zero
.L80266424:
/* 194D04 80266424 32420800 */  andi      $v0, $s2, 0x800
/* 194D08 80266428 10400007 */  beqz      $v0, .L80266448
/* 194D0C 8026642C 0220202D */   daddu    $a0, $s1, $zero
/* 194D10 80266430 0C099791 */  jal       lookup_defense
/* 194D14 80266434 2405000D */   addiu    $a1, $zero, 0xD
/* 194D18 80266438 0040182D */  daddu     $v1, $v0, $zero
/* 194D1C 8026643C 0070102A */  slt       $v0, $v1, $s0
/* 194D20 80266440 54400001 */  bnel      $v0, $zero, .L80266448
/* 194D24 80266444 0060802D */   daddu    $s0, $v1, $zero
.L80266448:
/* 194D28 80266448 3C020004 */  lui       $v0, (0x40000 >> 16)
/* 194D2C 8026644C 02421024 */  and       $v0, $s2, $v0
/* 194D30 80266450 10400007 */  beqz      $v0, .L80266470
/* 194D34 80266454 0220202D */   daddu    $a0, $s1, $zero
/* 194D38 80266458 0C099791 */  jal       lookup_defense
/* 194D3C 8026645C 2405000F */   addiu    $a1, $zero, 0xF
/* 194D40 80266460 0040182D */  daddu     $v1, $v0, $zero
/* 194D44 80266464 0070102A */  slt       $v0, $v1, $s0
/* 194D48 80266468 54400001 */  bnel      $v0, $zero, .L80266470
/* 194D4C 8026646C 0060802D */   daddu    $s0, $v1, $zero
.L80266470:
/* 194D50 80266470 240200FF */  addiu     $v0, $zero, 0xFF
/* 194D54 80266474 16020009 */  bne       $s0, $v0, .L8026649C
/* 194D58 80266478 3C020800 */   lui      $v0, (0x8000000 >> 16)
/* 194D5C 8026647C 0220202D */  daddu     $a0, $s1, $zero
/* 194D60 80266480 0C099791 */  jal       lookup_defense
/* 194D64 80266484 24050001 */   addiu    $a1, $zero, 0x1
/* 194D68 80266488 0040182D */  daddu     $v1, $v0, $zero
/* 194D6C 8026648C 286200FF */  slti      $v0, $v1, 0xFF
/* 194D70 80266490 54400001 */  bnel      $v0, $zero, .L80266498
/* 194D74 80266494 0060802D */   daddu    $s0, $v1, $zero
.L80266498:
/* 194D78 80266498 3C020800 */  lui       $v0, (0x8000000 >> 16)
.L8026649C:
/* 194D7C 8026649C 02421024 */  and       $v0, $s2, $v0
/* 194D80 802664A0 10400007 */  beqz      $v0, .L802664C0
/* 194D84 802664A4 24020063 */   addiu    $v0, $zero, 0x63
/* 194D88 802664A8 16020003 */  bne       $s0, $v0, .L802664B8
/* 194D8C 802664AC 00000000 */   nop
/* 194D90 802664B0 08099930 */  j         .L802664C0
/* 194D94 802664B4 241003E7 */   addiu    $s0, $zero, 0x3E7
.L802664B8:
/* 194D98 802664B8 5E000001 */  bgtzl     $s0, .L802664C0
/* 194D9C 802664BC 0000802D */   daddu    $s0, $zero, $zero
.L802664C0:
/* 194DA0 802664C0 0200102D */  daddu     $v0, $s0, $zero
/* 194DA4 802664C4 8FBF001C */  lw        $ra, 0x1C($sp)
/* 194DA8 802664C8 8FB20018 */  lw        $s2, 0x18($sp)
/* 194DAC 802664CC 8FB10014 */  lw        $s1, 0x14($sp)
/* 194DB0 802664D0 8FB00010 */  lw        $s0, 0x10($sp)
/* 194DB4 802664D4 03E00008 */  jr        $ra
/* 194DB8 802664D8 27BD0020 */   addiu    $sp, $sp, 0x20

### DECOMPILED C INSTRUCTIONS:

s32 get_defense(Actor* actor, s32* defenseTable, s32 elementFlags) {
    s32 defense;
    s32 minDefense = 255;

    if (defenseTable != NULL) {

        #define CHECK_DEFENSE(element) \
        if (elementFlags & DAMAGE_TYPE_##element) { \
            defense = lookup_defense(defenseTable, ELEMENT_##element); \
            if (defense < minDefense) { \
                minDefense = defense; \
            } \
        } \

        CHECK_DEFENSE(FIRE);
        CHECK_DEFENSE(WATER);
        CHECK_DEFENSE(ICE);
        CHECK_DEFENSE(MAGIC);
        CHECK_DEFENSE(SMASH);
        CHECK_DEFENSE(JUMP);
        CHECK_DEFENSE(COSMIC);
        CHECK_DEFENSE(BLAST);
        CHECK_DEFENSE(SHOCK);
        CHECK_DEFENSE(QUAKE);
        CHECK_DEFENSE(THROW);

        #undef CHECK_DEFENSE
    }

    // If no element flags were set, fall back to normal defense.
    if (minDefense == 255) {
        defense = lookup_defense(defenseTable, ELEMENT_NORMAL);
        if (defense < 255) {
            minDefense = defense;
        }
    }

    if (elementFlags & DAMAGE_TYPE_IGNORE_DEFENSE) {
        if (minDefense == 99) {
            // Immune
            minDefense = 999;
        } else if (minDefense > 0) {
            minDefense = 0;
        }
    }

    return minDefense;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel b_area_tik3_SpawnDrainHealthContinueFX
/* 52B8F0 80218250 27BDFD80 */  addiu     $sp, $sp, -0x280
glabel b_area_jan_jungle_fuzzy_SpawnDrainHealthContinueFX
/* 52B8F4 80218254 27A30018 */  addiu     $v1, $sp, 0x18
glabel func_80218258
/* 52B8F8 80218258 3C028023 */  lui       $v0, %hi(D_8022FC30)
glabel b_area_isk_part_2_chain_chomp_ChompChainUpdate
/* 52B8FC 8021825C 2442FC30 */  addiu     $v0, $v0, %lo(D_8022FC30)
.L80218260:
/* 52B900 80218260 24440250 */  addiu     $a0, $v0, 0x250
D_80218264:
/* 52B904 80218264 AFBF0278 */  sw        $ra, 0x278($sp)
/* 52B908 80218268 AFB10274 */  sw        $s1, 0x274($sp)
/* 52B90C 8021826C AFB00270 */  sw        $s0, 0x270($sp)
glabel func_80218270
/* 52B910 80218270 8C480000 */  lw        $t0, 0x0($v0)
/* 52B914 80218274 8C490004 */  lw        $t1, 0x4($v0)
glabel func_80218278
/* 52B918 80218278 8C4A0008 */  lw        $t2, 0x8($v0)
/* 52B91C 8021827C 8C4B000C */  lw        $t3, 0xC($v0)
glabel func_80218280_6609D0
/* 52B920 80218280 AC680000 */  sw        $t0, 0x0($v1)
.L80218284:
/* 52B924 80218284 AC690004 */  sw        $t1, 0x4($v1)
/* 52B928 80218288 AC6A0008 */  sw        $t2, 0x8($v1)
b_area_trd_part_3_eldstar_DefenseTable_8021828C:
/* 52B92C 8021828C AC6B000C */  sw        $t3, 0xC($v1)
.L80218290:
/* 52B930 80218290 24420010 */  addiu     $v0, $v0, 0x10
.L80218294:
/* 52B934 80218294 1444FFF6 */  bne       $v0, $a0, func_80218270
b_area_trd_part_3_eldstar_StatusTable_80218298:
/* 52B938 80218298 24630010 */   addiu    $v1, $v1, 0x10
/* 52B93C 8021829C 8C480000 */  lw        $t0, 0x0($v0)
.L802182A0:
/* 52B940 802182A0 8C490004 */  lw        $t1, 0x4($v0)
glabel func_802182A4_5CE934
/* 52B944 802182A4 AC680000 */  sw        $t0, 0x0($v1)
glabel b_area_kpa4_CosInterpMinMax
/* 52B948 802182A8 AC690004 */  sw        $t1, 0x4($v1)
.L802182AC:
/* 52B94C 802182AC 0000882D */  daddu     $s1, $zero, $zero
.L802182B0:
/* 52B950 802182B0 27B00018 */  addiu     $s0, $sp, 0x18
.L802182B4:
/* 52B954 802182B4 C6000010 */  lwc1      $f0, 0x10($s0)
b_area_iwa_Formation_03:
/* 52B958 802182B8 E7A00010 */  swc1      $f0, 0x10($sp)
/* 52B95C 802182BC 8E020014 */  lw        $v0, 0x14($s0)
.L802182C0:
/* 52B960 802182C0 AFA20014 */  sw        $v0, 0x14($sp)
/* 52B964 802182C4 8E040000 */  lw        $a0, 0x0($s0)
.L802182C8:
/* 52B968 802182C8 8E050004 */  lw        $a1, 0x4($s0)
/* 52B96C 802182CC 8E060008 */  lw        $a2, 0x8($s0)
.L802182D0:
/* 52B970 802182D0 8E07000C */  lw        $a3, 0xC($s0)
glabel b_area_hos_magikoopa_SetAbsoluteStatusOffsets
/* 52B974 802182D4 0C01C994 */  jal       fx_ice_shard
glabel func_802182D8
/* 52B978 802182D8 26310001 */   addiu    $s1, $s1, 0x1
.L802182DC:
/* 52B97C 802182DC 8C43000C */  lw        $v1, 0xC($v0)
glabel func_802182E0
/* 52B980 802182E0 C6000018 */  lwc1      $f0, 0x18($s0)
glabel func_802182E4_660A34
/* 52B984 802182E4 E460004C */  swc1      $f0, 0x4C($v1)
/* 52B988 802182E8 8C43000C */  lw        $v1, 0xC($v0)
glabel b_area_tik2_FadeBackgroundToBlack
/* 52B98C 802182EC C600001C */  lwc1      $f0, 0x1C($s0)
b_area_iwa_Formation_04:
/* 52B990 802182F0 E4600050 */  swc1      $f0, 0x50($v1)
.L802182F4:
/* 52B994 802182F4 8C43000C */  lw        $v1, 0xC($v0)
/* 52B998 802182F8 C6000020 */  lwc1      $f0, 0x20($s0)
.L802182FC:
/* 52B99C 802182FC E4600054 */  swc1      $f0, 0x54($v1)
glabel b_area_pra_ShrinkActor
/* 52B9A0 80218300 8C42000C */  lw        $v0, 0xC($v0)
/* 52B9A4 80218304 C6000024 */  lwc1      $f0, 0x24($s0)
glabel func_80218308
/* 52B9A8 80218308 E4400058 */  swc1      $f0, 0x58($v0)
glabel func_8021830C
/* 52B9AC 8021830C 2A22000F */  slti      $v0, $s1, 0xF
glabel dup2_b_area_dig_SetAbsoluteStatusOffsets
/* 52B9B0 80218310 1440FFE8 */  bnez      $v0, .L802182B4
glabel b_area_sam2_monstar_Dist3D
/* 52B9B4 80218314 26100028 */   addiu    $s0, $s0, 0x28
/* 52B9B8 80218318 8FBF0278 */  lw        $ra, 0x278($sp)
.L8021831C:
/* 52B9BC 8021831C 8FB10274 */  lw        $s1, 0x274($sp)
.L80218320:
/* 52B9C0 80218320 8FB00270 */  lw        $s0, 0x270($sp)
.L80218324:
/* 52B9C4 80218324 24020002 */  addiu     $v0, $zero, 0x2
.L80218328:
/* 52B9C8 80218328 03E00008 */  jr        $ra
.L8021832C:
/* 52B9CC 8021832C 27BD0280 */   addiu    $sp, $sp, 0x280

### DECOMPILED C INSTRUCTIONS:

API_CALLABLE(func_80218250_52B8F0) {
    s32 i;
    IceShardBlueprint bpArray[] = {
        {
            .unk_00 = 1,
            .unk_04 = 117.0f,
            .unk_08 = 102.0f,
            .unk_0C = 0.0f,
            .unk_10 = 0.2f,
            .unk_14 = 20,
            .unk_18 = 0.3f,
            .unk_1C = 0.7f,
            .unk_20 = 0.0f,
            .unk_24 = -0.3f,
        },
        {
            .unk_00 = 0,
            .unk_04 = 117.0f,
            .unk_08 = 82.0f,
            .unk_0C = 11.0f,
            .unk_10 = 0.5f,
            .unk_14 = 20,
            .unk_18 = 0.3f,
            .unk_1C = 0.9f,
            .unk_20 = 0.1f,
            .unk_24 = -0.3f,
        },
        {
            .unk_00 = 0,
            .unk_04 = 117.0f,
            .unk_08 = 92.0f,
            .unk_0C = 14.0f,
            .unk_10 = 0.4f,
            .unk_14 = 20,
            .unk_18 = 0.3f,
            .unk_1C = 0.8f,
            .unk_20 = 0.3f,
            .unk_24 = -0.3f,
        },
        {
            .unk_00 = 1,
            .unk_04 = 125.0f,
            .unk_08 = 82.0f,
            .unk_0C = 0.0f,
            .unk_10 = 0.2f,
            .unk_14 = 20,
            .unk_18 = 0.5f,
            .unk_1C = 0.9f,
            .unk_20 = 0.0f,
            .unk_24 = -0.3f,
        },
        {
            .unk_00 = 0,
            .unk_04 = 108.0f,
            .unk_08 = 82.0f,
            .unk_0C = 0.0f,
            .unk_10 = 0.3f,
            .unk_14 = 20,
            .unk_18 = -0.2f,
            .unk_1C = 0.9f,
            .unk_20 = 0.0f,
            .unk_24 = -0.3f,
        },
        {
            .unk_00 = 0,
            .unk_04 = 105.0f,
            .unk_08 = 92.0f,
            .unk_0C = 0.0f,
            .unk_10 = 0.4f,
            .unk_14 = 20,
            .unk_18 = -0.1f,
            .unk_1C = 0.8f,
            .unk_20 = 0.0f,
            .unk_24 = -0.3f,
        },
        {
            .unk_00 = 1,
            .unk_04 = 127.0f,
            .unk_08 = 92.0f,
            .unk_0C = 0.0f,
            .unk_10 = 0.2f,
            .unk_14 = 20,
            .unk_18 = 0.7f,
            .unk_1C = 0.8f,
            .unk_20 = 0.0f,
            .unk_24 = -0.3f,
        },
        {
            .unk_00 = 0,
            .unk_04 = 117.0f,
            .unk_08 = 97.0f,
            .unk_0C = 7.0f,
            .unk_10 = 0.1f,
            .unk_14 = 20,
            .unk_18 = 0.7f,
            .unk_1C = 0.8f,
            .unk_20 = 0.2f,
            .unk_24 = -0.3f,
        },
        {
            .unk_00 = 0,
            .unk_04 = 117.0f,
            .unk_08 = 87.0f,
            .unk_0C = 7.0f,
            .unk_10 = 0.3f,
            .unk_14 = 20,
            .unk_18 = 0.7f,
            .unk_1C = 0.8f,
            .unk_20 = 0.2f,
            .unk_24 = -0.3f,
        },
        {
            .unk_00 = 0,
            .unk_04 = 111.0f,
            .unk_08 = 97.0f,
            .unk_0C = 3.0f,
            .unk_10 = 0.2f,
            .unk_14 = 20,
            .unk_18 = 0.0f,
            .unk_1C = 1.0f,
            .unk_20 = 0.1f,
            .unk_24 = -0.3f,
        },
        {
            .unk_00 = 0,
            .unk_04 = 111.0f,
            .unk_08 = 92.0f,
            .unk_0C = 7.0f,
            .unk_10 = 0.1f,
            .unk_14 = 20,
            .unk_18 = 0.0f,
            .unk_1C = 1.0f,
            .unk_20 = 0.2f,
            .unk_24 = -0.3f,
        },
        {
            .unk_00 = 0,
            .unk_04 = 111.0f,
            .unk_08 = 87.0f,
            .unk_0C = 3.0f,
            .unk_10 = 0.5f,
            .unk_14 = 20,
            .unk_18 = 0.0f,
            .unk_1C = 1.0f,
            .unk_20 = 0.1f,
            .unk_24 = -0.3f,
        },
        {
            .unk_00 = 1,
            .unk_04 = 123.0f,
            .unk_08 = 97.0f,
            .unk_0C = 3.0f,
            .unk_10 = 0.2f,
            .unk_14 = 20,
            .unk_18 = 0.1f,
            .unk_1C = 1.0f,
            .unk_20 = 0.1f,
            .unk_24 = -0.3f,
        },
        {
            .unk_00 = 0,
            .unk_04 = 123.0f,
            .unk_08 = 92.0f,
            .unk_0C = 7.0f,
            .unk_10 = 0.4f,
            .unk_14 = 20,
            .unk_18 = 0.1f,
            .unk_1C = 1.0f,
            .unk_20 = 0.2f,
            .unk_24 = -0.3f,
        },
        {
            .unk_00 = 0,
            .unk_04 = 123.0f,
            .unk_08 = 87.0f,
            .unk_0C = 3.0f,
            .unk_10 = 0.3f,
            .unk_14 = 20,
            .unk_18 = 0.1f,
            .unk_1C = 1.0f,
            .unk_20 = 0.1f,
            .unk_24 = -0.3f,
        },
    };

    for (i = 0; i < ARRAY_COUNT(bpArray); i++) {
        EffectInstance* effect = fx_ice_shard(bpArray[i].unk_00, bpArray[i].unk_04, bpArray[i].unk_08,
                                              bpArray[i].unk_0C, bpArray[i].unk_10, bpArray[i].unk_14);
        effect->data.iceShard->vel.x = bpArray[i].unk_18;
        effect->data.iceShard->vel.y = bpArray[i].unk_1C;
        effect->data.iceShard->vel.z = bpArray[i].unk_20;
        effect->data.iceShard->gravAccel = bpArray[i].unk_24;
    }

    return ApiStatus_DONE2;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel imgfx_load_anim
/* D2920 8013C220 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* D2924 8013C224 AFB20018 */  sw        $s2, 0x18($sp)
/* D2928 8013C228 0080902D */  daddu     $s2, $a0, $zero
/* D292C 8013C22C AFBF0020 */  sw        $ra, 0x20($sp)
/* D2930 8013C230 AFB3001C */  sw        $s3, 0x1C($sp)
/* D2934 8013C234 AFB10014 */  sw        $s1, 0x14($sp)
/* D2938 8013C238 AFB00010 */  sw        $s0, 0x10($sp)
/* D293C 8013C23C 8E42001C */  lw        $v0, 0x1C($s2)
/* D2940 8013C240 3C100025 */  lui       $s0, %hi(D_24B7F0)
/* D2944 8013C244 2610B7F0 */  addiu     $s0, $s0, %lo(D_24B7F0)
/* D2948 8013C248 00021080 */  sll       $v0, $v0, 2
/* D294C 8013C24C 3C018015 */  lui       $at, %hi(ImgFXAnimOffsets)
/* D2950 8013C250 00220821 */  addu      $at, $at, $v0
/* D2954 8013C254 8C22EF64 */  lw        $v0, %lo(ImgFXAnimOffsets)($at)
/* D2958 8013C258 3C048015 */  lui       $a0, %hi(ImgFXAnimHeaders)
/* D295C 8013C25C 24846980 */  addiu     $a0, $a0, %lo(ImgFXAnimHeaders)
/* D2960 8013C260 00508821 */  addu      $s1, $v0, $s0
/* D2964 8013C264 92420000 */  lbu       $v0, 0x0($s2)
/* D2968 8013C268 8E430064 */  lw        $v1, 0x64($s2)
/* D296C 8013C26C 00021100 */  sll       $v0, $v0, 4
/* D2970 8013C270 10710057 */  beq       $v1, $s1, .L8013C3D0
/* D2974 8013C274 00449821 */   addu     $s3, $v0, $a0
/* D2978 8013C278 0220202D */  daddu     $a0, $s1, $zero
/* D297C 8013C27C 24850010 */  addiu     $a1, $a0, 0x10
/* D2980 8013C280 0260302D */  daddu     $a2, $s3, $zero
/* D2984 8013C284 0C00A5CF */  jal       dma_copy
/* D2988 8013C288 AE440064 */   sw       $a0, 0x64($s2)
/* D298C 8013C28C 8E440068 */  lw        $a0, 0x68($s2)
/* D2990 8013C290 10800004 */  beqz      $a0, .L8013C2A4
/* D2994 8013C294 00000000 */   nop
/* D2998 8013C298 0C04E984 */  jal       imgfx_add_to_cache
/* D299C 8013C29C 24050001 */   addiu    $a1, $zero, 0x1
/* D29A0 8013C2A0 AE400068 */  sw        $zero, 0x68($s2)
.L8013C2A4:
/* D29A4 8013C2A4 8E44006C */  lw        $a0, 0x6C($s2)
/* D29A8 8013C2A8 10800004 */  beqz      $a0, .L8013C2BC
/* D29AC 8013C2AC 00000000 */   nop
/* D29B0 8013C2B0 0C04E984 */  jal       imgfx_add_to_cache
/* D29B4 8013C2B4 24050001 */   addiu    $a1, $zero, 0x1
/* D29B8 8013C2B8 AE40006C */  sw        $zero, 0x6C($s2)
.L8013C2BC:
/* D29BC 8013C2BC 8E440070 */  lw        $a0, 0x70($s2)
/* D29C0 8013C2C0 10800004 */  beqz      $a0, .L8013C2D4
/* D29C4 8013C2C4 00000000 */   nop
/* D29C8 8013C2C8 0C04E984 */  jal       imgfx_add_to_cache
/* D29CC 8013C2CC 24050001 */   addiu    $a1, $zero, 0x1
/* D29D0 8013C2D0 AE400070 */  sw        $zero, 0x70($s2)
.L8013C2D4:
/* D29D4 8013C2D4 8E440074 */  lw        $a0, 0x74($s2)
/* D29D8 8013C2D8 10800004 */  beqz      $a0, .L8013C2EC
/* D29DC 8013C2DC 00000000 */   nop
/* D29E0 8013C2E0 0C04E984 */  jal       imgfx_add_to_cache
/* D29E4 8013C2E4 24050001 */   addiu    $a1, $zero, 0x1
/* D29E8 8013C2E8 AE400074 */  sw        $zero, 0x74($s2)
.L8013C2EC:
/* D29EC 8013C2EC 96640008 */  lhu       $a0, 0x8($s3)
/* D29F0 8013C2F0 0C00AB39 */  jal       heap_malloc
/* D29F4 8013C2F4 00042100 */   sll      $a0, $a0, 4
/* D29F8 8013C2F8 AE420068 */  sw        $v0, 0x68($s2)
/* D29FC 8013C2FC 96640008 */  lhu       $a0, 0x8($s3)
/* D2A00 8013C300 0C00AB39 */  jal       heap_malloc
/* D2A04 8013C304 00042100 */   sll      $a0, $a0, 4
/* D2A08 8013C308 AE42006C */  sw        $v0, 0x6C($s2)
/* D2A0C 8013C30C 9664000A */  lhu       $a0, 0xA($s3)
/* D2A10 8013C310 0C00AB39 */  jal       heap_malloc
/* D2A14 8013C314 000420C0 */   sll      $a0, $a0, 3
/* D2A18 8013C318 AE420070 */  sw        $v0, 0x70($s2)
/* D2A1C 8013C31C 9664000A */  lhu       $a0, 0xA($s3)
/* D2A20 8013C320 0C00AB39 */  jal       heap_malloc
/* D2A24 8013C324 000420C0 */   sll      $a0, $a0, 3
/* D2A28 8013C328 AE420074 */  sw        $v0, 0x74($s2)
/* D2A2C 8013C32C 8E620004 */  lw        $v0, 0x4($s3)
/* D2A30 8013C330 8E460070 */  lw        $a2, 0x70($s2)
/* D2A34 8013C334 00508821 */  addu      $s1, $v0, $s0
/* D2A38 8013C338 9662000A */  lhu       $v0, 0xA($s3)
/* D2A3C 8013C33C 0220202D */  daddu     $a0, $s1, $zero
/* D2A40 8013C340 000210C0 */  sll       $v0, $v0, 3
/* D2A44 8013C344 02228021 */  addu      $s0, $s1, $v0
/* D2A48 8013C348 0C00A5CF */  jal       dma_copy
/* D2A4C 8013C34C 0200282D */   daddu    $a1, $s0, $zero
/* D2A50 8013C350 0220202D */  daddu     $a0, $s1, $zero
/* D2A54 8013C354 8E460074 */  lw        $a2, 0x74($s2)
/* D2A58 8013C358 0C00A5CF */  jal       dma_copy
/* D2A5C 8013C35C 0200282D */   daddu    $a1, $s0, $zero
/* D2A60 8013C360 24090001 */  addiu     $t1, $zero, 0x1
/* D2A64 8013C364 3C075555 */  lui       $a3, (0x55555556 >> 16)
/* D2A68 8013C368 34E75556 */  ori       $a3, $a3, (0x55555556 & 0xFFFF)
/* D2A6C 8013C36C 240800DF */  addiu     $t0, $zero, 0xDF
/* D2A70 8013C370 0240202D */  daddu     $a0, $s2, $zero
/* D2A74 8013C374 248A0008 */  addiu     $t2, $a0, 0x8
.L8013C378:
/* D2A78 8013C378 8C850070 */  lw        $a1, 0x70($a0)
.L8013C37C:
/* D2A7C 8013C37C 8CA20000 */  lw        $v0, 0x0($a1)
/* D2A80 8013C380 00023602 */  srl       $a2, $v0, 24
/* D2A84 8013C384 14C9000C */  bne       $a2, $t1, .L8013C3B8
/* D2A88 8013C388 24A50008 */   addiu    $a1, $a1, 0x8
/* D2A8C 8013C38C 8CA2FFFC */  lw        $v0, -0x4($a1)
/* D2A90 8013C390 8E630000 */  lw        $v1, 0x0($s3)
/* D2A94 8013C394 00431023 */  subu      $v0, $v0, $v1
/* D2A98 8013C398 00470018 */  mult      $v0, $a3
/* D2A9C 8013C39C 000217C3 */  sra       $v0, $v0, 31
/* D2AA0 8013C3A0 8C830068 */  lw        $v1, 0x68($a0)
/* D2AA4 8013C3A4 00005810 */  mfhi      $t3
/* D2AA8 8013C3A8 01621023 */  subu      $v0, $t3, $v0
/* D2AAC 8013C3AC 00021080 */  sll       $v0, $v0, 2
/* D2AB0 8013C3B0 00431021 */  addu      $v0, $v0, $v1
/* D2AB4 8013C3B4 ACA2FFFC */  sw        $v0, -0x4($a1)
.L8013C3B8:
/* D2AB8 8013C3B8 14C8FFF0 */  bne       $a2, $t0, .L8013C37C
/* D2ABC 8013C3BC 00000000 */   nop
/* D2AC0 8013C3C0 24840004 */  addiu     $a0, $a0, 0x4
/* D2AC4 8013C3C4 008A102A */  slt       $v0, $a0, $t2
/* D2AC8 8013C3C8 1440FFEB */  bnez      $v0, .L8013C378
/* D2ACC 8013C3CC 00000000 */   nop
.L8013C3D0:
/* D2AD0 8013C3D0 0260102D */  daddu     $v0, $s3, $zero
/* D2AD4 8013C3D4 8FBF0020 */  lw        $ra, 0x20($sp)
/* D2AD8 8013C3D8 8FB3001C */  lw        $s3, 0x1C($sp)
/* D2ADC 8013C3DC 8FB20018 */  lw        $s2, 0x18($sp)
/* D2AE0 8013C3E0 8FB10014 */  lw        $s1, 0x14($sp)
/* D2AE4 8013C3E4 8FB00010 */  lw        $s0, 0x10($sp)
/* D2AE8 8013C3E8 03E00008 */  jr        $ra
/* D2AEC 8013C3EC 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

ImgFXAnimHeader* imgfx_load_anim(ImgFXState* state) {
    u8* romStart = (s32) ImgFXAnimOffsets[state->ints.anim.type] + imgfx_data_ROM_START;
    ImgFXAnimHeader* anim = &ImgFXAnimHeaders[state->arrayIdx];

    if (state->curAnimOffset != romStart) {
        u8* romEnd;
        s32 i;

        state->curAnimOffset = romStart;

        dma_copy(state->curAnimOffset, state->curAnimOffset + sizeof(*anim), anim);

        if (state->vtxBufs[0] != NULL) {
            imgfx_add_to_cache(state->vtxBufs[0], 1);
            state->vtxBufs[0] = NULL;
        }
        if (state->vtxBufs[1] != NULL) {
            imgfx_add_to_cache(state->vtxBufs[1], 1);
            state->vtxBufs[1] = NULL;
        }
        if (state->gfxBufs[0] != NULL) {
            imgfx_add_to_cache(state->gfxBufs[0], 1);
            state->gfxBufs[0] = NULL;
        }
        if (state->gfxBufs[1] != NULL) {
            // imgfx_add_to_cache(state->gfxBufs[1], 1);
            romEnd = (u8*) state->gfxBufs[1]; // required to match
            imgfx_add_to_cache(state->gfxBufs[1], 1);
            state->gfxBufs[1] = NULL;
        }
        state->vtxBufs[0] = heap_malloc(anim->vtxCount * sizeof(Vtx));
        state->vtxBufs[1] = heap_malloc(anim->vtxCount * sizeof(Vtx));
        state->gfxBufs[0] = heap_malloc(anim->gfxCount * sizeof(Gfx));
        state->gfxBufs[1] = heap_malloc(anim->gfxCount * sizeof(Gfx));

        romStart = imgfx_data_ROM_START + (s32)anim->gfxOffset;
        romEnd = romStart + anim->gfxCount * sizeof(Gfx);
        dma_copy(romStart, romEnd, state->gfxBufs[0]);
        dma_copy(romStart, romEnd, state->gfxBufs[1]);

        // Search through the state's displaylists for vertex commands
        // and adjust their addresses to point into the vertex buffers
        for (i = 0; i < ARRAY_COUNT(state->gfxBufs); i++) {
            Gfx* gfxBuffer = state->gfxBufs[i];
            s32 j = 0;
            u32 cmd;

            // Loop over the displaylist commands until we hit an ENDDL
            do {
                u32 w0 = gfxBuffer[j++].words.w0;
                cmd = w0 >> 0x18;

                // If this command is a vertex command, adjust the vertex buffer address
                if (cmd == G_VTX) {
                    // ImgFXVtx structs are 0xC bytes while Vtx are 0x10, so we need a (4/3) scaling factor
                    // to compute a new, equivalent Vtx[i] address for an existing ImgFXVtx[i] address.
                    // Unfortunately, using sizeof here does not match.
                    gfxBuffer[j-1].words.w1 = ((((s32) gfxBuffer[j-1].words.w1 - (s32) anim->keyframesOffset) / 3) * 4) +
                                              (s32) state->vtxBufs[i];
                }
            } while (cmd != G_ENDDL);
        }
    }

    return anim;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel state_step_startup
/* E968 80033568 27BDFFE8 */  addiu     $sp, $sp, -0x18
/* E96C 8003356C AFB00010 */  sw        $s0, 0x10($sp)
/* E970 80033570 3C108007 */  lui       $s0, %hi(gGameStatusPtr)
/* E974 80033574 2610419C */  addiu     $s0, $s0, %lo(gGameStatusPtr)
/* E978 80033578 AFBF0014 */  sw        $ra, 0x14($sp)
/* E97C 8003357C 8E040000 */  lw        $a0, 0x0($s0)
/* E980 80033580 808200AC */  lb        $v0, 0xAC($a0)
/* E984 80033584 908300AC */  lbu       $v1, 0xAC($a0)
/* E988 80033588 10400003 */  beqz      $v0, .L80033598
/* E98C 8003358C 2462FFFF */   addiu    $v0, $v1, -0x1
/* E990 80033590 0800CDDE */  j         .L80033778
/* E994 80033594 A08200AC */   sb       $v0, 0xAC($a0)
.L80033598:
/* E998 80033598 3C01800A */  lui       $at, %hi(gOverrideFlags)
/* E99C 8003359C AC20A650 */  sw        $zero, %lo(gOverrideFlags)($at)
/* E9A0 800335A0 A4800086 */  sh        $zero, 0x86($a0)
/* E9A4 800335A4 A0800070 */  sb        $zero, 0x70($a0)
/* E9A8 800335A8 8E020000 */  lw        $v0, 0x0($s0)
/* E9AC 800335AC 2403FFFF */  addiu     $v1, $zero, -0x1
/* E9B0 800335B0 A4830088 */  sh        $v1, 0x88($a0)
/* E9B4 800335B4 A480008C */  sh        $zero, 0x8C($a0)
/* E9B8 800335B8 A480008E */  sh        $zero, 0x8E($a0)
/* E9BC 800335BC A0400076 */  sb        $zero, 0x76($v0)
/* E9C0 800335C0 8E020000 */  lw        $v0, 0x0($s0)
/* E9C4 800335C4 A0400078 */  sb        $zero, 0x78($v0)
/* E9C8 800335C8 8E020000 */  lw        $v0, 0x0($s0)
/* E9CC 800335CC A040007D */  sb        $zero, 0x7D($v0)
/* E9D0 800335D0 8E020000 */  lw        $v0, 0x0($s0)
/* E9D4 800335D4 A04300A8 */  sb        $v1, 0xA8($v0)
/* E9D8 800335D8 8E020000 */  lw        $v0, 0x0($s0)
/* E9DC 800335DC A04000AA */  sb        $zero, 0xAA($v0)
/* E9E0 800335E0 8E020000 */  lw        $v0, 0x0($s0)
/* E9E4 800335E4 A04300A9 */  sb        $v1, 0xA9($v0)
/* E9E8 800335E8 8E020000 */  lw        $v0, 0x0($s0)
/* E9EC 800335EC 0C00AB00 */  jal       general_heap_create
/* E9F0 800335F0 A0400071 */   sb       $zero, 0x71($v0)
/* E9F4 800335F4 0C047624 */  jal       clear_render_tasks
/* E9F8 800335F8 00000000 */   nop
/* E9FC 800335FC 0C048C2E */  jal       clear_worker_list
/* EA00 80033600 00000000 */   nop
/* EA04 80033604 0C0B0C77 */  jal       clear_script_list
/* EA08 80033608 00000000 */   nop
/* EA0C 8003360C 0C00B7BD */  jal       create_cameras_a
/* EA10 80033610 00000000 */   nop
/* EA14 80033614 0C0B763E */  jal       spr_init_sprites
/* EA18 80033618 0000202D */   daddu    $a0, $zero, $zero
/* EA1C 8003361C 0C0482EC */  jal       clear_entity_models
/* EA20 80033620 00000000 */   nop
/* EA24 80033624 0C047889 */  jal       clear_animator_list
/* EA28 80033628 00000000 */   nop
/* EA2C 8003362C 0C045751 */  jal       clear_model_data
/* EA30 80033630 00000000 */   nop
/* EA34 80033634 0C052010 */  jal       clear_sprite_shading_data
/* EA38 80033638 00000000 */   nop
/* EA3C 8003363C 0C05177E */  jal       reset_background_settings
/* EA40 80033640 00000000 */   nop
/* EA44 80033644 0000202D */  daddu     $a0, $zero, $zero
/* EA48 80033648 0C0514BA */  jal       hud_element_set_aux_cache
/* EA4C 8003364C 0080282D */   daddu    $a1, $a0, $zero
/* EA50 80033650 0C050440 */  jal       hud_element_clear_cache
/* EA54 80033654 00000000 */   nop
/* EA58 80033658 0C0515A0 */  jal       clear_trigger_data
/* EA5C 8003365C 00000000 */   nop
/* EA60 80033660 0C048D9D */  jal       clear_printers
/* EA64 80033664 00000000 */   nop
/* EA68 80033668 0C04432E */  jal       clear_entity_data
/* EA6C 8003366C 0000202D */   daddu    $a0, $zero, $zero
/* EA70 80033670 0C04E042 */  jal       clear_screen_overlays
/* EA74 80033674 00000000 */   nop
/* EA78 80033678 0C037F14 */  jal       clear_player_status
/* EA7C 8003367C 00000000 */   nop
/* EA80 80033680 0C00E12F */  jal       clear_npcs
/* EA84 80033684 00000000 */   nop
/* EA88 80033688 0C039CE8 */  jal       clear_player_data
/* EA8C 8003368C 00000000 */   nop
/* EA90 80033690 0C01CACC */  jal       reset_battle_status
/* EA94 80033694 00000000 */   nop
/* EA98 80033698 0C00F8CE */  jal       init_encounter_status
/* EA9C 8003369C 00000000 */   nop
/* EAA0 800336A0 0C016727 */  jal       clear_effect_data
/* EAA4 800336A4 00000000 */   nop
/* EAA8 800336A8 0C04C3FC */  jal       clear_item_entity_data
/* EAAC 800336AC 00000000 */   nop
/* EAB0 800336B0 0C0514C8 */  jal       clear_saved_variables
/* EAB4 800336B4 00000000 */   nop
/* EAB8 800336B8 0C016BE5 */  jal       initialize_collision
/* EABC 800336BC 00000000 */   nop
/* EAC0 800336C0 0C052B02 */  jal       bgm_init_music_players
/* EAC4 800336C4 00000000 */   nop
/* EAC8 800336C8 0C051CFC */  jal       clear_windows
/* EACC 800336CC 00000000 */   nop
/* EAD0 800336D0 0C03AD60 */  jal       partner_initialize_data
/* EAD4 800336D4 00000000 */   nop
/* EAD8 800336D8 0C052586 */  jal       sfx_clear_sounds
/* EADC 800336DC 00000000 */   nop
/* EAE0 800336E0 0C05294B */  jal       bgm_reset_volume
/* EAE4 800336E4 00000000 */   nop
/* EAE8 800336E8 0C00AE90 */  jal       initialize_curtains
/* EAEC 800336EC 00000000 */   nop
/* EAF0 800336F0 0000202D */  daddu     $a0, $zero, $zero
/* EAF4 800336F4 24060004 */  addiu     $a2, $zero, 0x4
/* EAF8 800336F8 2405000F */  addiu     $a1, $zero, 0xF
/* EAFC 800336FC 8E030000 */  lw        $v1, 0x0($s0)
.L80033700:
/* EB00 80033700 A4660050 */  sh        $a2, 0x50($v1)
/* EB04 80033704 A4650048 */  sh        $a1, 0x48($v1)
/* EB08 80033708 24840001 */  addiu     $a0, $a0, 0x1
/* EB0C 8003370C 28820004 */  slti      $v0, $a0, 0x4
/* EB10 80033710 1440FFFB */  bnez      $v0, .L80033700
/* EB14 80033714 24630002 */   addiu    $v1, $v1, 0x2
/* EB18 80033718 0C00ABF6 */  jal       fio_has_valid_backup
/* EB1C 8003371C 00000000 */   nop
/* EB20 80033720 3C02800E */  lui       $v0, %hi(D_800D9620)
/* EB24 80033724 8C429620 */  lw        $v0, %lo(D_800D9620)($v0)
/* EB28 80033728 14400007 */  bnez      $v0, .L80033748
/* EB2C 8003372C 24020001 */   addiu    $v0, $zero, 0x1
/* EB30 80033730 3C038007 */  lui       $v1, %hi(gGameStatusPtr)
/* EB34 80033734 8C63419C */  lw        $v1, %lo(gGameStatusPtr)($v1)
/* EB38 80033738 0C015857 */  jal       audio_set_stereo
/* EB3C 8003373C A06200AB */   sb       $v0, 0xAB($v1)
/* EB40 80033740 0800CDD7 */  j         .L8003375C
/* EB44 80033744 24040001 */   addiu    $a0, $zero, 0x1
.L80033748:
/* EB48 80033748 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* EB4C 8003374C 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* EB50 80033750 0C015860 */  jal       audio_set_mono
/* EB54 80033754 A04000AB */   sb       $zero, 0xAB($v0)
/* EB58 80033758 24040001 */  addiu     $a0, $zero, 0x1
.L8003375C:
/* EB5C 8003375C 3C02800A */  lui       $v0, %hi(gOverrideFlags)
/* EB60 80033760 2442A650 */  addiu     $v0, $v0, %lo(gOverrideFlags)
/* EB64 80033764 8C430000 */  lw        $v1, 0x0($v0)
/* EB68 80033768 2405FFF7 */  addiu     $a1, $zero, -0x9
/* EB6C 8003376C 00651824 */  and       $v1, $v1, $a1
/* EB70 80033770 0C00CD3C */  jal       set_game_mode
/* EB74 80033774 AC430000 */   sw       $v1, 0x0($v0)
.L80033778:
/* EB78 80033778 8FBF0014 */  lw        $ra, 0x14($sp)
/* EB7C 8003377C 8FB00010 */  lw        $s0, 0x10($sp)
/* EB80 80033780 03E00008 */  jr        $ra
/* EB84 80033784 27BD0018 */   addiu    $sp, $sp, 0x18

### DECOMPILED C INSTRUCTIONS:

void state_step_startup(void) {
    GameStatus* gameStatus = gGameStatusPtr;
    s32 i;

    if (gameStatus->introState != INTRO_STATE_0) {
        gameStatus->introState--;
        return;
    }

    gOverrideFlags = 0;
    gGameStatusPtr->areaID = 0;
    gGameStatusPtr->isBattle = 0;
    gameStatus->prevArea = -1;
    gameStatus->mapID = 0;
    gameStatus->entryID = 0;
    gGameStatusPtr->unk_76 = 0;
    gGameStatusPtr->disableScripts = 0;
    gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE;
    gGameStatusPtr->creditsViewportMode = -1;
    gGameStatusPtr->demoFlags = 0;
    gGameStatusPtr->unk_A9 = -1;
    gGameStatusPtr->demoState = DEMO_STATE_NONE;

    general_heap_create();
    clear_render_tasks();
    clear_worker_list();
    clear_script_list();
    create_cameras_a();
    spr_init_sprites(PLAYER_SPRITES_MARIO_WORLD);
    clear_entity_models();
    clear_animator_list();
    clear_model_data();
    clear_sprite_shading_data();
    reset_background_settings();
    hud_element_set_aux_cache(0, 0);
    hud_element_clear_cache();
    clear_trigger_data();
    clear_printers();
    clear_entity_data(0);
    clear_screen_overlays();
    clear_player_status();
    clear_npcs();
    clear_player_data();
    reset_battle_status();
    init_encounter_status();
    clear_effect_data();
    clear_item_entity_data();
    clear_saved_variables();
    initialize_collision();
    bgm_init_music_players();
    clear_windows();
    partner_initialize_data();
    sfx_clear_sounds();
    bgm_reset_volume();
    initialize_curtains();

    for (i = 0; i < 4; i++) {
        gGameStatusPtr->unk_50[i] = 4;
        gGameStatusPtr->unk_48[i] = 0xF;
    }

    fio_has_valid_backup();

    if (D_800D95E8.saveSlot == 0) {
        gGameStatusPtr->soundOutputMode = SOUND_OUT_STEREO;
        audio_set_stereo();
    } else {
        gGameStatusPtr->soundOutputMode = SOUND_OUT_MONO;
        audio_set_mono();
    }

    gOverrideFlags &= ~GLOBAL_OVERRIDES_8;
    set_game_mode(GAME_MODE_LOGOS);
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_80242BA0
/* 163400 80242BA0 2882F581 */  slti      $v0, $a0, -0xA7F
/* 163404 80242BA4 8FA90014 */  lw        $t1, 0x14($sp)
glabel func_80242BA8
/* 163408 80242BA8 8FAA0018 */  lw        $t2, 0x18($sp)
glabel func_80242BAC
/* 16340C 80242BAC 8FAB001C */  lw        $t3, 0x1C($sp)
D_80242BB0:
/* 163410 80242BB0 8FAC0020 */  lw        $t4, 0x20($sp)
/* 163414 80242BB4 14400075 */  bnez      $v0, func_80242D8C
glabel func_80242BB8
/* 163418 80242BB8 28A2F581 */   slti     $v0, $a1, -0xA7F
glabel func_80242BBC
/* 16341C 80242BBC 14400073 */  bnez      $v0, func_80242D8C
glabel func_80242BC0
/* 163420 80242BC0 00000000 */   nop
glabel .L80242BC4
/* 163424 80242BC4 18C00071 */  blez      $a2, func_80242D8C
glabel .L80242BC8
/* 163428 80242BC8 00000000 */   nop
.L80242BCC:
/* 16342C 80242BCC 18E0006F */  blez      $a3, func_80242D8C
glabel func_80242BD0
/* 163430 80242BD0 28820500 */   slti     $v0, $a0, 0x500
.L80242BD4:
/* 163434 80242BD4 1040006D */  beqz      $v0, func_80242D8C
glabel dead_kzn_17_LetterDelivery_CalcLetterPos
/* 163438 80242BD8 28A203C0 */   slti     $v0, $a1, 0x3C0
.L80242BDC:
/* 16343C 80242BDC 1040006B */  beqz      $v0, func_80242D8C
D_80242BE0:
/* 163440 80242BE0 28C20A80 */   slti     $v0, $a2, 0xA80
.L80242BE4:
/* 163444 80242BE4 10400069 */  beqz      $v0, func_80242D8C
.L80242BE8:
/* 163448 80242BE8 28E20A80 */   slti     $v0, $a3, 0xA80
D_80242BEC:
/* 16344C 80242BEC 10400067 */  beqz      $v0, func_80242D8C
D_80242BF0:
/* 163450 80242BF0 00000000 */   nop
flo_14_pad_2BF4:
/* 163454 80242BF4 3C02800A */  lui       $v0, %hi(gMainGfxPos)
D_80242BF8:
/* 163458 80242BF8 2442A66C */  addiu     $v0, $v0, %lo(gMainGfxPos)
.L80242BFC:
/* 16345C 80242BFC 8C480000 */  lw        $t0, 0x0($v0)
D_80242C00:
/* 163460 80242C00 25030008 */  addiu     $v1, $t0, 0x8
.L80242C04:
/* 163464 80242C04 AC430000 */  sw        $v1, 0x0($v0)
D_80242C08:
/* 163468 80242C08 00061400 */  sll       $v0, $a2, 16
glabel func_80242C0C
/* 16346C 80242C0C 00021403 */  sra       $v0, $v0, 16
/* 163470 80242C10 18400005 */  blez      $v0, .L80242C28
glabel func_80242C14
/* 163474 80242C14 30420FFF */   andi     $v0, $v0, 0xFFF
.L80242C18:
/* 163478 80242C18 00021300 */  sll       $v0, $v0, 12
glabel func_80242C1C
/* 16347C 80242C1C 3C03E400 */  lui       $v1, (0xE4000000 >> 16)
glabel .L80242C20
/* 163480 80242C20 08090B0B */  j         .L80242C2C
glabel func_80242C24
/* 163484 80242C24 00431825 */   or       $v1, $v0, $v1
glabel .L80242C28
/* 163488 80242C28 3C03E400 */  lui       $v1, (0xE4000000 >> 16)
glabel .L80242C2C
/* 16348C 80242C2C 00071400 */  sll       $v0, $a3, 16
D_80242C30:
/* 163490 80242C30 00021403 */  sra       $v0, $v0, 16
.L80242C34:
/* 163494 80242C34 18400004 */  blez      $v0, D_80242C48
D_80242C38:
/* 163498 80242C38 AD030000 */   sw       $v1, 0x0($t0)
D_80242C3C:
/* 16349C 80242C3C 30420FFF */  andi      $v0, $v0, 0xFFF
D_80242C40:
/* 1634A0 80242C40 00621025 */  or        $v0, $v1, $v0
glabel func_80242C44
/* 1634A4 80242C44 AD020000 */  sw        $v0, 0x0($t0)
D_80242C48:
/* 1634A8 80242C48 8FA20010 */  lw        $v0, 0x10($sp)
.L80242C4C:
/* 1634AC 80242C4C 30420007 */  andi      $v0, $v0, 0x7
D_80242C50:
/* 1634B0 80242C50 00021E00 */  sll       $v1, $v0, 24
/* 1634B4 80242C54 00041400 */  sll       $v0, $a0, 16
D_80242C58:
/* 1634B8 80242C58 00023403 */  sra       $a2, $v0, 16
glabel func_80242C5C
/* 1634BC 80242C5C 18C00003 */  blez      $a2, D_80242C6C
D_80242C60:
/* 1634C0 80242C60 30C20FFF */   andi     $v0, $a2, 0xFFF
D_80242C64:
/* 1634C4 80242C64 00021300 */  sll       $v0, $v0, 12
glabel func_80242C68
/* 1634C8 80242C68 00621825 */  or        $v1, $v1, $v0
D_80242C6C:
/* 1634CC 80242C6C 00051400 */  sll       $v0, $a1, 16
D_80242C70:
/* 1634D0 80242C70 00021403 */  sra       $v0, $v0, 16
.L80242C74:
/* 1634D4 80242C74 18400004 */  blez      $v0, .L80242C88
glabel func_80242C78
/* 1634D8 80242C78 AD030004 */   sw       $v1, 0x4($t0)
/* 1634DC 80242C7C 30420FFF */  andi      $v0, $v0, 0xFFF
.L80242C80:
/* 1634E0 80242C80 00621025 */  or        $v0, $v1, $v0
glabel func_80242C84
/* 1634E4 80242C84 AD020004 */  sw        $v0, 0x4($t0)
.L80242C88:
/* 1634E8 80242C88 3C03800A */  lui       $v1, %hi(gMainGfxPos)
.L80242C8C:
/* 1634EC 80242C8C 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
.L80242C90:
/* 1634F0 80242C90 8C620000 */  lw        $v0, 0x0($v1)
glabel func_80242C94
/* 1634F4 80242C94 0040202D */  daddu     $a0, $v0, $zero
.L80242C98:
/* 1634F8 80242C98 24420008 */  addiu     $v0, $v0, 0x8
/* 1634FC 80242C9C AC620000 */  sw        $v0, 0x0($v1)
glabel func_80242CA0
/* 163500 80242CA0 3C02E100 */  lui       $v0, (0xE1000000 >> 16)
/* 163504 80242CA4 AC820000 */  sw        $v0, 0x0($a0)
/* 163508 80242CA8 04C10012 */  bgez      $a2, D_80242CF4
.L80242CAC:
/* 16350C 80242CAC 24840004 */   addiu    $a0, $a0, 0x4
.L80242CB0:
/* 163510 80242CB0 000B1400 */  sll       $v0, $t3, 16
.L80242CB4:
/* 163514 80242CB4 00021403 */  sra       $v0, $v0, 16
.L80242CB8:
/* 163518 80242CB8 04410007 */  bgez      $v0, D_80242CD8
.L80242CBC:
/* 16351C 80242CBC 00C20018 */   mult     $a2, $v0
.L80242CC0:
/* 163520 80242CC0 00006812 */  mflo      $t5
.L80242CC4:
/* 163524 80242CC4 000D11C3 */  sra       $v0, $t5, 7
glabel func_80242CC8
/* 163528 80242CC8 04410008 */  bgez      $v0, func_80242CEC
.L80242CCC:
/* 16352C 80242CCC 01221023 */   subu     $v0, $t1, $v0
glabel func_80242CD0
/* 163530 80242CD0 08090B3A */  j         D_80242CE8
.L80242CD4:
/* 163534 80242CD4 0000102D */   daddu    $v0, $zero, $zero
D_80242CD8:
/* 163538 80242CD8 00006812 */  mflo      $t5
.L80242CDC:
/* 16353C 80242CDC 000D11C3 */  sra       $v0, $t5, 7
D_80242CE0:
/* 163540 80242CE0 5C400001 */  bgtzl     $v0, D_80242CE8
glabel func_80242CE4
/* 163544 80242CE4 0000102D */   daddu    $v0, $zero, $zero
D_80242CE8:
/* 163548 80242CE8 01221023 */  subu      $v0, $t1, $v0
glabel func_80242CEC
/* 16354C 80242CEC 08090B3E */  j         func_80242CF8
glabel func_80242CF0
/* 163550 80242CF0 00023400 */   sll      $a2, $v0, 16
D_80242CF4:
/* 163554 80242CF4 00093400 */  sll       $a2, $t1, 16
glabel func_80242CF8
/* 163558 80242CF8 04A10016 */  bgez      $a1, .L80242D54
.L80242CFC:
/* 16355C 80242CFC 3142FFFF */   andi     $v0, $t2, 0xFFFF
glabel func_80242D00
/* 163560 80242D00 000C1400 */  sll       $v0, $t4, 16
glabel func_80242D04
/* 163564 80242D04 00021C03 */  sra       $v1, $v0, 16
.L80242D08:
/* 163568 80242D08 0461000A */  bgez      $v1, D_80242D34
glabel func_80242D0C
/* 16356C 80242D0C 00051400 */   sll      $v0, $a1, 16
/* 163570 80242D10 00021403 */  sra       $v0, $v0, 16
glabel func_80242D14
/* 163574 80242D14 00430018 */  mult      $v0, $v1
.L80242D18:
/* 163578 80242D18 00006812 */  mflo      $t5
glabel func_80242D1C
/* 16357C 80242D1C 000D11C3 */  sra       $v0, $t5, 7
glabel func_80242D20
/* 163580 80242D20 04420001 */  bltzl     $v0, func_80242D28
.L80242D24:
/* 163584 80242D24 0000102D */   daddu    $v0, $zero, $zero
glabel func_80242D28
/* 163588 80242D28 01421023 */  subu      $v0, $t2, $v0
glabel func_80242D2C
/* 16358C 80242D2C 08090B55 */  j         .L80242D54
.L80242D30:
/* 163590 80242D30 3042FFFF */   andi     $v0, $v0, 0xFFFF
D_80242D34:
/* 163594 80242D34 00021403 */  sra       $v0, $v0, 16
glabel func_80242D38
/* 163598 80242D38 00430018 */  mult      $v0, $v1
glabel func_80242D3C
/* 16359C 80242D3C 00006812 */  mflo      $t5
D_80242D40:
/* 1635A0 80242D40 000D11C3 */  sra       $v0, $t5, 7
.L80242D44:
/* 1635A4 80242D44 5C400001 */  bgtzl     $v0, func_80242D4C
glabel func_80242D48
/* 1635A8 80242D48 0000102D */   daddu    $v0, $zero, $zero
glabel func_80242D4C
/* 1635AC 80242D4C 01421023 */  subu      $v0, $t2, $v0
D_80242D50:
/* 1635B0 80242D50 3042FFFF */  andi      $v0, $v0, 0xFFFF
glabel .L80242D54
/* 1635B4 80242D54 00C21025 */  or        $v0, $a2, $v0
glabel func_80242D58
/* 1635B8 80242D58 AC820000 */  sw        $v0, 0x0($a0)
.L80242D5C:
/* 1635BC 80242D5C 3C03800A */  lui       $v1, %hi(gMainGfxPos)
D_80242D60:
/* 1635C0 80242D60 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
glabel func_80242D64
/* 1635C4 80242D64 8C620000 */  lw        $v0, 0x0($v1)
.L80242D68:
/* 1635C8 80242D68 0040202D */  daddu     $a0, $v0, $zero
.L80242D6C:
/* 1635CC 80242D6C 24420008 */  addiu     $v0, $v0, 0x8
D_80242D70:
/* 1635D0 80242D70 AC620000 */  sw        $v0, 0x0($v1)
.L80242D74:
/* 1635D4 80242D74 3C02F100 */  lui       $v0, (0xF1000000 >> 16)
.L80242D78:
/* 1635D8 80242D78 AC820000 */  sw        $v0, 0x0($a0)
.L80242D7C:
/* 1635DC 80242D7C 000B1400 */  sll       $v0, $t3, 16
D_80242D80:
/* 1635E0 80242D80 3183FFFF */  andi      $v1, $t4, 0xFFFF
.L80242D84:
/* 1635E4 80242D84 00431025 */  or        $v0, $v0, $v1
.L80242D88:
/* 1635E8 80242D88 AC820004 */  sw        $v0, 0x4($a0)
glabel func_80242D8C
/* 1635EC 80242D8C 03E00008 */  jr        $ra
glabel func_80242D90
/* 1635F0 80242D90 00000000 */   nop

### DECOMPILED C INSTRUCTIONS:

void filemenu_draw_rect(s32 ulx, s32 uly, s32 lrx, s32 lry, s32 tileDescriptor, s32 uls, s32 ult, s32 dsdx, s32 dtdy) {
    if (ulx <= -2688 || uly <= -2688 || lrx <= 0 || lry <= 0) {
        return;
    }
    if (ulx >= 1280 || uly >= 960 || lrx >= 2688 || lry >= 2688) {
        return;
    }
    gSPScisTextureRectangle(gMainGfxPos++, ulx, uly, lrx, lry, tileDescriptor, uls, ult, dsdx, dtdy);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel start_script
/* E7D90 802C33E0 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* E7D94 802C33E4 AFB10014 */  sw        $s1, 0x14($sp)
/* E7D98 802C33E8 0080882D */  daddu     $s1, $a0, $zero
/* E7D9C 802C33EC AFB40020 */  sw        $s4, 0x20($sp)
/* E7DA0 802C33F0 00A0A02D */  daddu     $s4, $a1, $zero
/* E7DA4 802C33F4 AFB3001C */  sw        $s3, 0x1C($sp)
/* E7DA8 802C33F8 00C0982D */  daddu     $s3, $a2, $zero
/* E7DAC 802C33FC 3C03802E */  lui       $v1, %hi(gCurrentScriptListPtr)
/* E7DB0 802C3400 8C63A890 */  lw        $v1, %lo(gCurrentScriptListPtr)($v1)
/* E7DB4 802C3404 0000282D */  daddu     $a1, $zero, $zero
/* E7DB8 802C3408 AFBF0024 */  sw        $ra, 0x24($sp)
/* E7DBC 802C340C AFB20018 */  sw        $s2, 0x18($sp)
/* E7DC0 802C3410 AFB00010 */  sw        $s0, 0x10($sp)
.L802C3414:
/* E7DC4 802C3414 8C620000 */  lw        $v0, 0x0($v1)
/* E7DC8 802C3418 10400006 */  beqz      $v0, .L802C3434
/* E7DCC 802C341C 28A20080 */   slti     $v0, $a1, 0x80
/* E7DD0 802C3420 24A50001 */  addiu     $a1, $a1, 0x1
/* E7DD4 802C3424 28A20080 */  slti      $v0, $a1, 0x80
/* E7DD8 802C3428 1440FFFA */  bnez      $v0, .L802C3414
/* E7DDC 802C342C 24630004 */   addiu    $v1, $v1, 0x4
/* E7DE0 802C3430 28A20080 */  slti      $v0, $a1, 0x80
.L802C3434:
/* E7DE4 802C3434 14400003 */  bnez      $v0, .L802C3444
/* E7DE8 802C3438 24040168 */   addiu    $a0, $zero, 0x168
.L802C343C:
/* E7DEC 802C343C 080B0D0F */  j         .L802C343C
/* E7DF0 802C3440 00000000 */   nop
.L802C3444:
/* E7DF4 802C3444 0C00AB39 */  jal       heap_malloc
/* E7DF8 802C3448 00A0902D */   daddu    $s2, $a1, $zero
/* E7DFC 802C344C 00122080 */  sll       $a0, $s2, 2
/* E7E00 802C3450 3C03802E */  lui       $v1, %hi(gCurrentScriptListPtr)
/* E7E04 802C3454 8C63A890 */  lw        $v1, %lo(gCurrentScriptListPtr)($v1)
/* E7E08 802C3458 3C05802E */  lui       $a1, %hi(gNumScripts)
/* E7E0C 802C345C 24A5A488 */  addiu     $a1, $a1, %lo(gNumScripts)
/* E7E10 802C3460 00832021 */  addu      $a0, $a0, $v1
/* E7E14 802C3464 8CA30000 */  lw        $v1, 0x0($a1)
/* E7E18 802C3468 0040802D */  daddu     $s0, $v0, $zero
/* E7E1C 802C346C AC900000 */  sw        $s0, 0x0($a0)
/* E7E20 802C3470 24630001 */  addiu     $v1, $v1, 0x1
/* E7E24 802C3474 16000003 */  bnez      $s0, .L802C3484
/* E7E28 802C3478 ACA30000 */   sw       $v1, 0x0($a1)
.L802C347C:
/* E7E2C 802C347C 080B0D1F */  j         .L802C347C
/* E7E30 802C3480 00000000 */   nop
.L802C3484:
/* E7E34 802C3484 36620001 */  ori       $v0, $s3, 0x1
/* E7E38 802C3488 3C03802E */  lui       $v1, %hi(gStaticScriptCounter)
/* E7E3C 802C348C 24639CA0 */  addiu     $v1, $v1, %lo(gStaticScriptCounter)
/* E7E40 802C3490 A2020000 */  sb        $v0, 0x0($s0)
/* E7E44 802C3494 A2000002 */  sb        $zero, 0x2($s0)
/* E7E48 802C3498 A2140003 */  sb        $s4, 0x3($s0)
/* E7E4C 802C349C 8C620000 */  lw        $v0, 0x0($v1)
/* E7E50 802C34A0 2405000F */  addiu     $a1, $zero, 0xF
/* E7E54 802C34A4 AE020144 */  sw        $v0, 0x144($s0)
/* E7E58 802C34A8 24420001 */  addiu     $v0, $v0, 0x1
/* E7E5C 802C34AC AC620000 */  sw        $v0, 0x0($v1)
/* E7E60 802C34B0 2403FFFF */  addiu     $v1, $zero, -0x1
/* E7E64 802C34B4 240200EF */  addiu     $v0, $zero, 0xEF
/* E7E68 802C34B8 A2030006 */  sb        $v1, 0x6($s0)
/* E7E6C 802C34BC A2030007 */  sb        $v1, 0x7($s0)
/* E7E70 802C34C0 A2020004 */  sb        $v0, 0x4($s0)
/* E7E74 802C34C4 3C01802E */  lui       $at, %hi(gGlobalTimeSpace)
/* E7E78 802C34C8 C4209CA8 */  lwc1      $f0, %lo(gGlobalTimeSpace)($at)
/* E7E7C 802C34CC 2602003C */  addiu     $v0, $s0, 0x3C
/* E7E80 802C34D0 AE110008 */  sw        $s1, 0x8($s0)
/* E7E84 802C34D4 AE11015C */  sw        $s1, 0x15C($s0)
/* E7E88 802C34D8 AE110164 */  sw        $s1, 0x164($s0)
/* E7E8C 802C34DC AE000060 */  sw        $zero, 0x60($s0)
/* E7E90 802C34E0 AE000064 */  sw        $zero, 0x64($s0)
/* E7E94 802C34E4 AE000068 */  sw        $zero, 0x68($s0)
/* E7E98 802C34E8 AE00006C */  sw        $zero, 0x6C($s0)
/* E7E9C 802C34EC AE030148 */  sw        $v1, 0x148($s0)
/* E7EA0 802C34F0 AE03014C */  sw        $v1, 0x14C($s0)
/* E7EA4 802C34F4 AE000160 */  sw        $zero, 0x160($s0)
/* E7EA8 802C34F8 AE000154 */  sw        $zero, 0x154($s0)
/* E7EAC 802C34FC AE000158 */  sw        $zero, 0x158($s0)
/* E7EB0 802C3500 E6000150 */  swc1      $f0, 0x150($s0)
.L802C3504:
/* E7EB4 802C3504 AC400084 */  sw        $zero, 0x84($v0)
/* E7EB8 802C3508 24A5FFFF */  addiu     $a1, $a1, -0x1
/* E7EBC 802C350C 04A1FFFD */  bgez      $a1, .L802C3504
/* E7EC0 802C3510 2442FFFC */   addiu    $v0, $v0, -0x4
/* E7EC4 802C3514 24050002 */  addiu     $a1, $zero, 0x2
/* E7EC8 802C3518 26020008 */  addiu     $v0, $s0, 0x8
.L802C351C:
/* E7ECC 802C351C AC4000C4 */  sw        $zero, 0xC4($v0)
/* E7ED0 802C3520 24A5FFFF */  addiu     $a1, $a1, -0x1
/* E7ED4 802C3524 04A1FFFD */  bgez      $a1, .L802C351C
/* E7ED8 802C3528 2442FFFC */   addiu    $v0, $v0, -0x4
/* E7EDC 802C352C 0C0B0C52 */  jal       find_script_labels
/* E7EE0 802C3530 0200202D */   daddu    $a0, $s0, $zero
/* E7EE4 802C3534 3C02802E */  lui       $v0, %hi(gIsUpdatingScripts)
/* E7EE8 802C3538 8C429CA4 */  lw        $v0, %lo(gIsUpdatingScripts)($v0)
/* E7EEC 802C353C 10400012 */  beqz      $v0, .L802C3588
/* E7EF0 802C3540 00000000 */   nop
/* E7EF4 802C3544 92020000 */  lbu       $v0, 0x0($s0)
/* E7EF8 802C3548 30420020 */  andi      $v0, $v0, 0x20
/* E7EFC 802C354C 1040000E */  beqz      $v0, .L802C3588
/* E7F00 802C3550 00000000 */   nop
/* E7F04 802C3554 3C05802E */  lui       $a1, %hi(gScriptListCount)
/* E7F08 802C3558 24A5AC98 */  addiu     $a1, $a1, %lo(gScriptListCount)
/* E7F0C 802C355C 8CA20000 */  lw        $v0, 0x0($a1)
/* E7F10 802C3560 00022080 */  sll       $a0, $v0, 2
/* E7F14 802C3564 3C01802E */  lui       $at, %hi(gScriptIndexList)
/* E7F18 802C3568 00240821 */  addu      $at, $at, $a0
/* E7F1C 802C356C AC32A898 */  sw        $s2, %lo(gScriptIndexList)($at)
/* E7F20 802C3570 8E030144 */  lw        $v1, 0x144($s0)
/* E7F24 802C3574 24420001 */  addiu     $v0, $v0, 0x1
/* E7F28 802C3578 ACA20000 */  sw        $v0, 0x0($a1)
/* E7F2C 802C357C 3C01802E */  lui       $at, %hi(gScriptIdList)
/* E7F30 802C3580 00240821 */  addu      $at, $at, $a0
/* E7F34 802C3584 AC23AA98 */  sw        $v1, %lo(gScriptIdList)($at)
.L802C3588:
/* E7F38 802C3588 0C0B0CE4 */  jal       suspend_frozen_scripts
/* E7F3C 802C358C 0200202D */   daddu    $a0, $s0, $zero
/* E7F40 802C3590 3C03802E */  lui       $v1, %hi(gStaticScriptCounter)
/* E7F44 802C3594 24639CA0 */  addiu     $v1, $v1, %lo(gStaticScriptCounter)
/* E7F48 802C3598 8C620000 */  lw        $v0, 0x0($v1)
/* E7F4C 802C359C 14400004 */  bnez      $v0, .L802C35B0
/* E7F50 802C35A0 0200102D */   daddu    $v0, $s0, $zero
/* E7F54 802C35A4 24020001 */  addiu     $v0, $zero, 0x1
/* E7F58 802C35A8 AC620000 */  sw        $v0, 0x0($v1)
/* E7F5C 802C35AC 0200102D */  daddu     $v0, $s0, $zero
.L802C35B0:
/* E7F60 802C35B0 8FBF0024 */  lw        $ra, 0x24($sp)
/* E7F64 802C35B4 8FB40020 */  lw        $s4, 0x20($sp)
/* E7F68 802C35B8 8FB3001C */  lw        $s3, 0x1C($sp)
/* E7F6C 802C35BC 8FB20018 */  lw        $s2, 0x18($sp)
/* E7F70 802C35C0 8FB10014 */  lw        $s1, 0x14($sp)
/* E7F74 802C35C4 8FB00010 */  lw        $s0, 0x10($sp)
/* E7F78 802C35C8 03E00008 */  jr        $ra
/* E7F7C 802C35CC 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

Evt* start_script(EvtScript* source, s32 priority, s32 flags) {
    Evt* newScript;
    s32 curScriptIndex;
    s32 scriptListCount;
    s32 i;

    for (i = 0; i < MAX_SCRIPTS; i++) {
        if ((*gCurrentScriptListPtr)[i] == NULL) {
            break;
        }
    }

    ASSERT(i < MAX_SCRIPTS);
    curScriptIndex = i;

    (*gCurrentScriptListPtr)[curScriptIndex] = newScript = heap_malloc(sizeof(*newScript));
    gNumScripts++;
    ASSERT(newScript != NULL);

    newScript->stateFlags = flags | EVT_FLAG_ACTIVE;
    newScript->currentOpcode = EVT_OP_INTERNAL_FETCH;
    newScript->priority = priority;
    newScript->ptrNextLine = (Bytecode*)source;
    newScript->ptrFirstLine = (Bytecode*)source;
    newScript->ptrCurrentLine = (Bytecode*)source;
    newScript->userData = NULL;
    newScript->blockingParent = NULL;
    newScript->childScript = NULL;
    newScript->parentScript = NULL;
    newScript->id = gStaticScriptCounter++;
    newScript->owner1.actorID = -1;
    newScript->owner2.npcID = -1;
    newScript->loopDepth = -1;
    newScript->switchDepth = -1;
    newScript->groupFlags = ~EVT_GROUP_10;
    newScript->ptrSavedPos = NULL;
    newScript->frameCounter = 0.0f;
    newScript->unk_158 = 0;
    newScript->timeScale = gGlobalTimeSpace;

    scriptListCount = 0;

    for (i = 0; i < ARRAY_COUNT(newScript->varTable); i++) {
        newScript->varTable[i] = 0;
    }

    for (i = 0; i < ARRAY_COUNT(newScript->varFlags); i++) {
        newScript->varFlags[i] = 0;
    }

    find_script_labels(newScript);

    if (gIsUpdatingScripts && (newScript->stateFlags & EVT_FLAG_RUN_IMMEDIATELY)) {
        scriptListCount = gScriptListCount++;
        gScriptIndexList[scriptListCount] = curScriptIndex;
        gScriptIdList[scriptListCount] = newScript->id;
    }

    suspend_frozen_scripts(newScript);

    if (gStaticScriptCounter == 0) {
        gStaticScriptCounter = 1;
    }

    return newScript;
}