### RAW ASSEMBLY INSTRUCTIONS:

glabel imgfx_mesh_make_wavy
/* D5568 8013EE68 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* D556C 8013EE6C 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* D5570 8013EE70 27BDFFB8 */  addiu     $sp, $sp, -0x48
/* D5574 8013EE74 AFB20018 */  sw        $s2, 0x18($sp)
/* D5578 8013EE78 0080902D */  daddu     $s2, $a0, $zero
/* D557C 8013EE7C AFBF002C */  sw        $ra, 0x2C($sp)
/* D5580 8013EE80 AFB60028 */  sw        $s6, 0x28($sp)
/* D5584 8013EE84 AFB50024 */  sw        $s5, 0x24($sp)
/* D5588 8013EE88 AFB40020 */  sw        $s4, 0x20($sp)
/* D558C 8013EE8C AFB3001C */  sw        $s3, 0x1C($sp)
/* D5590 8013EE90 AFB10014 */  sw        $s1, 0x14($sp)
/* D5594 8013EE94 AFB00010 */  sw        $s0, 0x10($sp)
/* D5598 8013EE98 F7B80040 */  sdc1      $f24, 0x40($sp)
/* D559C 8013EE9C F7B60038 */  sdc1      $f22, 0x38($sp)
/* D55A0 8013EEA0 F7B40030 */  sdc1      $f20, 0x30($sp)
/* D55A4 8013EEA4 94420134 */  lhu       $v0, 0x134($v0)
/* D55A8 8013EEA8 3C018015 */  lui       $at, %hi(D_80151100)
/* D55AC 8013EEAC D4221100 */  ldc1      $f2, %lo(D_80151100)($at)
/* D55B0 8013EEB0 44820000 */  mtc1      $v0, $f0
/* D55B4 8013EEB4 00000000 */  nop
/* D55B8 8013EEB8 46800020 */  cvt.s.w   $f0, $f0
/* D55BC 8013EEBC 46000021 */  cvt.d.s   $f0, $f0
/* D55C0 8013EEC0 46220003 */  div.d     $f0, $f0, $f2
/* D55C4 8013EEC4 3C018015 */  lui       $at, %hi(D_80151108)
/* D55C8 8013EEC8 D4221108 */  ldc1      $f2, %lo(D_80151108)($at)
/* D55CC 8013EECC 0804FBB6 */  j         .L8013EED8
/* D55D0 8013EED0 46200220 */   cvt.s.d  $f8, $f0
.L8013EED4:
/* D55D4 8013EED4 46200220 */  cvt.s.d   $f8, $f0
.L8013EED8:
/* D55D8 8013EED8 46004021 */  cvt.d.s   $f0, $f8
/* D55DC 8013EEDC 4620103C */  c.lt.d    $f2, $f0
/* D55E0 8013EEE0 00000000 */  nop
/* D55E4 8013EEE4 4503FFFB */  bc1tl     .L8013EED4
/* D55E8 8013EEE8 46220001 */   sub.d    $f0, $f0, $f2
/* D55EC 8013EEEC 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* D55F0 8013EEF0 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* D55F4 8013EEF4 94420134 */  lhu       $v0, 0x134($v0)
/* D55F8 8013EEF8 3C018015 */  lui       $at, %hi(D_80151110)
/* D55FC 8013EEFC D4221110 */  ldc1      $f2, %lo(D_80151110)($at)
/* D5600 8013EF00 24420028 */  addiu     $v0, $v0, 0x28
/* D5604 8013EF04 44820000 */  mtc1      $v0, $f0
/* D5608 8013EF08 00000000 */  nop
/* D560C 8013EF0C 46800020 */  cvt.s.w   $f0, $f0
/* D5610 8013EF10 46000021 */  cvt.d.s   $f0, $f0
/* D5614 8013EF14 46220003 */  div.d     $f0, $f0, $f2
/* D5618 8013EF18 3C018015 */  lui       $at, %hi(D_80151118)
/* D561C 8013EF1C D4221118 */  ldc1      $f2, %lo(D_80151118)($at)
/* D5620 8013EF20 0804FBCB */  j         .L8013EF2C
/* D5624 8013EF24 462001A0 */   cvt.s.d  $f6, $f0
.L8013EF28:
/* D5628 8013EF28 462001A0 */  cvt.s.d   $f6, $f0
.L8013EF2C:
/* D562C 8013EF2C 46003021 */  cvt.d.s   $f0, $f6
/* D5630 8013EF30 4620103C */  c.lt.d    $f2, $f0
/* D5634 8013EF34 00000000 */  nop
/* D5638 8013EF38 4503FFFB */  bc1tl     .L8013EF28
/* D563C 8013EF3C 46220001 */   sub.d    $f0, $f0, $f2
/* D5640 8013EF40 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* D5644 8013EF44 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* D5648 8013EF48 94420134 */  lhu       $v0, 0x134($v0)
/* D564C 8013EF4C 3C018015 */  lui       $at, %hi(D_80151120)
/* D5650 8013EF50 D4221120 */  ldc1      $f2, %lo(D_80151120)($at)
/* D5654 8013EF54 24420019 */  addiu     $v0, $v0, 0x19
/* D5658 8013EF58 44820000 */  mtc1      $v0, $f0
/* D565C 8013EF5C 00000000 */  nop
/* D5660 8013EF60 46800020 */  cvt.s.w   $f0, $f0
/* D5664 8013EF64 46000021 */  cvt.d.s   $f0, $f0
/* D5668 8013EF68 46220003 */  div.d     $f0, $f0, $f2
/* D566C 8013EF6C 3C018015 */  lui       $at, %hi(D_80151128)
/* D5670 8013EF70 D4221128 */  ldc1      $f2, %lo(D_80151128)($at)
/* D5674 8013EF74 0804FBE0 */  j         .L8013EF80
/* D5678 8013EF78 46200120 */   cvt.s.d  $f4, $f0
.L8013EF7C:
/* D567C 8013EF7C 46200120 */  cvt.s.d   $f4, $f0
.L8013EF80:
/* D5680 8013EF80 46002021 */  cvt.d.s   $f0, $f4
/* D5684 8013EF84 4620103C */  c.lt.d    $f2, $f0
/* D5688 8013EF88 00000000 */  nop
/* D568C 8013EF8C 4503FFFB */  bc1tl     .L8013EF7C
/* D5690 8013EF90 46220001 */   sub.d    $f0, $f0, $f2
/* D5694 8013EF94 E648003C */  swc1      $f8, 0x3C($s2)
/* D5698 8013EF98 46004006 */  mov.s     $f0, $f8
/* D569C 8013EF9C 3C018015 */  lui       $at, %hi(D_80151130)
/* D56A0 8013EFA0 D4221130 */  ldc1      $f2, %lo(D_80151130)($at)
/* D56A4 8013EFA4 46000021 */  cvt.d.s   $f0, $f0
/* D56A8 8013EFA8 E6460040 */  swc1      $f6, 0x40($s2)
/* D56AC 8013EFAC 4620103E */  c.le.d    $f2, $f0
/* D56B0 8013EFB0 00000000 */  nop
/* D56B4 8013EFB4 45000004 */  bc1f      .L8013EFC8
/* D56B8 8013EFB8 E6440044 */   swc1     $f4, 0x44($s2)
/* D56BC 8013EFBC 46220001 */  sub.d     $f0, $f0, $f2
/* D56C0 8013EFC0 46200020 */  cvt.s.d   $f0, $f0
/* D56C4 8013EFC4 E640003C */  swc1      $f0, 0x3C($s2)
.L8013EFC8:
/* D56C8 8013EFC8 C6400040 */  lwc1      $f0, 0x40($s2)
/* D56CC 8013EFCC 46000021 */  cvt.d.s   $f0, $f0
/* D56D0 8013EFD0 4620103E */  c.le.d    $f2, $f0
/* D56D4 8013EFD4 00000000 */  nop
/* D56D8 8013EFD8 45000004 */  bc1f      .L8013EFEC
/* D56DC 8013EFDC 00000000 */   nop
/* D56E0 8013EFE0 46220001 */  sub.d     $f0, $f0, $f2
/* D56E4 8013EFE4 46200020 */  cvt.s.d   $f0, $f0
/* D56E8 8013EFE8 E6400040 */  swc1      $f0, 0x40($s2)
.L8013EFEC:
/* D56EC 8013EFEC C6400044 */  lwc1      $f0, 0x44($s2)
/* D56F0 8013EFF0 46000021 */  cvt.d.s   $f0, $f0
/* D56F4 8013EFF4 4620103E */  c.le.d    $f2, $f0
/* D56F8 8013EFF8 00000000 */  nop
/* D56FC 8013EFFC 45000004 */  bc1f      .L8013F010
/* D5700 8013F000 0000A02D */   daddu    $s4, $zero, $zero
/* D5704 8013F004 46220001 */  sub.d     $f0, $f0, $f2
/* D5708 8013F008 46200020 */  cvt.s.d   $f0, $f0
/* D570C 8013F00C E6400044 */  swc1      $f0, 0x44($s2)
.L8013F010:
/* D5710 8013F010 9642000A */  lhu       $v0, 0xA($s2)
/* D5714 8013F014 96430008 */  lhu       $v1, 0x8($s2)
/* D5718 8013F018 92440003 */  lbu       $a0, 0x3($s2)
/* D571C 8013F01C 00431023 */  subu      $v0, $v0, $v1
/* D5720 8013F020 0044A823 */  subu      $s5, $v0, $a0
/* D5724 8013F024 1AA00067 */  blez      $s5, .L8013F1C4
/* D5728 8013F028 0280882D */   daddu    $s1, $s4, $zero
/* D572C 8013F02C 3C168015 */  lui       $s6, %hi(imgfx_vtxBuf)
/* D5730 8013F030 26D66950 */  addiu     $s6, $s6, %lo(imgfx_vtxBuf)
/* D5734 8013F034 0280982D */  daddu     $s3, $s4, $zero
.L8013F038:
/* D5738 8013F038 44931000 */  mtc1      $s3, $f2
/* D573C 8013F03C 00000000 */  nop
/* D5740 8013F040 468010A0 */  cvt.s.w   $f2, $f2
/* D5744 8013F044 00141040 */  sll       $v0, $s4, 1
/* D5748 8013F048 00541021 */  addu      $v0, $v0, $s4
/* D574C 8013F04C 00021900 */  sll       $v1, $v0, 4
/* D5750 8013F050 00621823 */  subu      $v1, $v1, $v0
/* D5754 8013F054 00031880 */  sll       $v1, $v1, 2
/* D5758 8013F058 C64C003C */  lwc1      $f12, 0x3C($s2)
/* D575C 8013F05C 44830000 */  mtc1      $v1, $f0
/* D5760 8013F060 00000000 */  nop
/* D5764 8013F064 46800020 */  cvt.s.w   $f0, $f0
/* D5768 8013F068 46026300 */  add.s     $f12, $f12, $f2
/* D576C 8013F06C C6560040 */  lwc1      $f22, 0x40($s2)
/* D5770 8013F070 96500008 */  lhu       $s0, 0x8($s2)
/* D5774 8013F074 4602B580 */  add.s     $f22, $f22, $f2
/* D5778 8013F078 C6580044 */  lwc1      $f24, 0x44($s2)
/* D577C 8013F07C 8EC20000 */  lw        $v0, 0x0($s6)
/* D5780 8013F080 4602C600 */  add.s     $f24, $f24, $f2
/* D5784 8013F084 02118021 */  addu      $s0, $s0, $s1
/* D5788 8013F088 00108100 */  sll       $s0, $s0, 4
/* D578C 8013F08C 46006300 */  add.s     $f12, $f12, $f0
/* D5790 8013F090 02028021 */  addu      $s0, $s0, $v0
/* D5794 8013F094 86020000 */  lh        $v0, 0x0($s0)
/* D5798 8013F098 4600B580 */  add.s     $f22, $f22, $f0
/* D579C 8013F09C 4482A000 */  mtc1      $v0, $f20
/* D57A0 8013F0A0 00000000 */  nop
/* D57A4 8013F0A4 4680A520 */  cvt.s.w   $f20, $f20
/* D57A8 8013F0A8 0C00A85B */  jal       sin_rad
/* D57AC 8013F0AC 4600C600 */   add.s    $f24, $f24, $f0
/* D57B0 8013F0B0 C642001C */  lwc1      $f2, 0x1C($s2)
/* D57B4 8013F0B4 468010A0 */  cvt.s.w   $f2, $f2
/* D57B8 8013F0B8 46020002 */  mul.s     $f0, $f0, $f2
/* D57BC 8013F0BC 00000000 */  nop
/* D57C0 8013F0C0 4600A500 */  add.s     $f20, $f20, $f0
/* D57C4 8013F0C4 4600A28D */  trunc.w.s $f10, $f20
/* D57C8 8013F0C8 44025000 */  mfc1      $v0, $f10
/* D57CC 8013F0CC 00000000 */  nop
/* D57D0 8013F0D0 A6020000 */  sh        $v0, 0x0($s0)
/* D57D4 8013F0D4 96500008 */  lhu       $s0, 0x8($s2)
/* D57D8 8013F0D8 8EC20000 */  lw        $v0, 0x0($s6)
/* D57DC 8013F0DC 02118021 */  addu      $s0, $s0, $s1
/* D57E0 8013F0E0 00108100 */  sll       $s0, $s0, 4
/* D57E4 8013F0E4 02028021 */  addu      $s0, $s0, $v0
/* D57E8 8013F0E8 86020002 */  lh        $v0, 0x2($s0)
/* D57EC 8013F0EC 4482A000 */  mtc1      $v0, $f20
/* D57F0 8013F0F0 00000000 */  nop
/* D57F4 8013F0F4 4680A520 */  cvt.s.w   $f20, $f20
/* D57F8 8013F0F8 0C00A85B */  jal       sin_rad
/* D57FC 8013F0FC 4600B306 */   mov.s    $f12, $f22
/* D5800 8013F100 C6420020 */  lwc1      $f2, 0x20($s2)
/* D5804 8013F104 468010A0 */  cvt.s.w   $f2, $f2
/* D5808 8013F108 46020002 */  mul.s     $f0, $f0, $f2
/* D580C 8013F10C 00000000 */  nop
/* D5810 8013F110 4600A500 */  add.s     $f20, $f20, $f0
/* D5814 8013F114 4600A28D */  trunc.w.s $f10, $f20
/* D5818 8013F118 44025000 */  mfc1      $v0, $f10
/* D581C 8013F11C 00000000 */  nop
/* D5820 8013F120 A6020002 */  sh        $v0, 0x2($s0)
/* D5824 8013F124 96500008 */  lhu       $s0, 0x8($s2)
/* D5828 8013F128 8EC20000 */  lw        $v0, 0x0($s6)
/* D582C 8013F12C 02118021 */  addu      $s0, $s0, $s1
/* D5830 8013F130 00108100 */  sll       $s0, $s0, 4
/* D5834 8013F134 02028021 */  addu      $s0, $s0, $v0
/* D5838 8013F138 86020004 */  lh        $v0, 0x4($s0)
/* D583C 8013F13C 4482A000 */  mtc1      $v0, $f20
/* D5840 8013F140 00000000 */  nop
/* D5844 8013F144 4680A520 */  cvt.s.w   $f20, $f20
/* D5848 8013F148 0C00A85B */  jal       sin_rad
/* D584C 8013F14C 4600C306 */   mov.s    $f12, $f24
/* D5850 8013F150 C6420024 */  lwc1      $f2, 0x24($s2)
/* D5854 8013F154 468010A0 */  cvt.s.w   $f2, $f2
/* D5858 8013F158 46020002 */  mul.s     $f0, $f0, $f2
/* D585C 8013F15C 00000000 */  nop
/* D5860 8013F160 4600A500 */  add.s     $f20, $f20, $f0
/* D5864 8013F164 4600A28D */  trunc.w.s $f10, $f20
/* D5868 8013F168 44025000 */  mfc1      $v0, $f10
/* D586C 8013F16C 00000000 */  nop
/* D5870 8013F170 A6020004 */  sh        $v0, 0x4($s0)
/* D5874 8013F174 92420003 */  lbu       $v0, 0x3($s2)
/* D5878 8013F178 24420001 */  addiu     $v0, $v0, 0x1
/* D587C 8013F17C 14400002 */  bnez      $v0, .L8013F188
/* D5880 8013F180 0222001A */   div      $zero, $s1, $v0
/* D5884 8013F184 0007000D */  break     7
.L8013F188:
/* D5888 8013F188 2401FFFF */  addiu     $at, $zero, -0x1
/* D588C 8013F18C 14410004 */  bne       $v0, $at, .L8013F1A0
/* D5890 8013F190 3C018000 */   lui      $at, (0x80000000 >> 16)
/* D5894 8013F194 16210002 */  bne       $s1, $at, .L8013F1A0
/* D5898 8013F198 00000000 */   nop
/* D589C 8013F19C 0006000D */  break     6
.L8013F1A0:
/* D58A0 8013F1A0 00001810 */  mfhi      $v1
/* D58A4 8013F1A4 14600003 */  bnez      $v1, .L8013F1B4
/* D58A8 8013F1A8 2673002D */   addiu    $s3, $s3, 0x2D
/* D58AC 8013F1AC 0000982D */  daddu     $s3, $zero, $zero
/* D58B0 8013F1B0 3A940001 */  xori      $s4, $s4, 0x1
.L8013F1B4:
/* D58B4 8013F1B4 26310001 */  addiu     $s1, $s1, 0x1
/* D58B8 8013F1B8 0235102A */  slt       $v0, $s1, $s5
/* D58BC 8013F1BC 1440FF9E */  bnez      $v0, .L8013F038
/* D58C0 8013F1C0 00000000 */   nop
.L8013F1C4:
/* D58C4 8013F1C4 8FBF002C */  lw        $ra, 0x2C($sp)
/* D58C8 8013F1C8 8FB60028 */  lw        $s6, 0x28($sp)
/* D58CC 8013F1CC 8FB50024 */  lw        $s5, 0x24($sp)
/* D58D0 8013F1D0 8FB40020 */  lw        $s4, 0x20($sp)
/* D58D4 8013F1D4 8FB3001C */  lw        $s3, 0x1C($sp)
/* D58D8 8013F1D8 8FB20018 */  lw        $s2, 0x18($sp)
/* D58DC 8013F1DC 8FB10014 */  lw        $s1, 0x14($sp)
/* D58E0 8013F1E0 8FB00010 */  lw        $s0, 0x10($sp)
/* D58E4 8013F1E4 D7B80040 */  ldc1      $f24, 0x40($sp)
/* D58E8 8013F1E8 D7B60038 */  ldc1      $f22, 0x38($sp)
/* D58EC 8013F1EC D7B40030 */  ldc1      $f20, 0x30($sp)
/* D58F0 8013F1F0 03E00008 */  jr        $ra
/* D58F4 8013F1F4 27BD0048 */   addiu    $sp, $sp, 0x48

### DECOMPILED C INSTRUCTIONS:

void imgfx_mesh_make_wavy(ImgFXState* state) {
    Vtx* v1;
    Vtx* v2;
    Vtx* v3;
    f32 vx;
    f32 vy;
    f32 vz;
    f32 angle1;
    f32 angle2;
    f32 angle3;
    f32 phase1;
    f32 phase2;
    f32 phase3;
    s32 angleInc;
    s32 amt;
    s32 sign;
    s32 i;

    phase1 = (f32) gGameStatusPtr->frameCounter / 10.3;
    while (phase1 > 360.0) {
        phase1 -= 360.0;
    }

    phase2 = (f32) (gGameStatusPtr->frameCounter + 40) / 11.2;
    while (phase2 > 360.0) {
        phase2 -= 360.0;
    }

    phase3 = (f32) (gGameStatusPtr->frameCounter + 25) / 10.8;
    while (phase3 > 360.0) {
        phase3 -= 360.0;
    }

    state->floats.wavy.phase1 = phase1;
    state->floats.wavy.phase2 = phase2;
    state->floats.wavy.phase3 = phase3;

    if (state->floats.wavy.phase1 >= 360.0) {
        state->floats.wavy.phase1-= 360.0;
    }

    if (state->floats.wavy.phase2 >= 360.0) {
        state->floats.wavy.phase2 -= 360.0;
    }

    if (state->floats.wavy.phase3 >= 360.0) {
        state->floats.wavy.phase3 -= 360.0;
    }

    sign = 0;
    angleInc = 0;
    amt = (state->lastVtxIdx - state->firstVtxIdx) - state->subdivX;

    for (i = 0; i < amt; i++) {
        angle1 = state->floats.wavy.phase1 + (angleInc * 45) + (sign * 180);
        angle2 = state->floats.wavy.phase2 + (angleInc * 45) + (sign * 180);
        angle3 = state->floats.wavy.phase3 + (angleInc * 45) + (sign * 180);

        //TODO find better match
        v1 = (Vtx*)((state->firstVtxIdx + i) * sizeof(Vtx) + (s32)imgfx_vtxBuf);
        vx = v1->v.ob[0];
        v1->v.ob[0] = (vx + (sin_rad(angle1) * state->ints.wavy.mag.x)); // @bug? should be sin_deg?

        v2 = (Vtx*)((state->firstVtxIdx + i) * sizeof(Vtx) + (s32)imgfx_vtxBuf);
        vy = v2->v.ob[1];
        v2->v.ob[1] = (vy + (sin_rad(angle2) * state->ints.wavy.mag.y));

        v3 = (Vtx*)((state->firstVtxIdx + i) * sizeof(Vtx) + (s32)imgfx_vtxBuf);
        vz = v3->v.ob[2];
        v3->v.ob[2] = (vz + (sin_rad(angle3) * state->ints.wavy.mag.z));

        angleInc++;
        if (i % (state->subdivX + 1) == 0) {
            angleInc = 0;
            sign = !sign;
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel basic_ai_check_player_dist
/* 244B4 800490B4 27BDFFA0 */  addiu     $sp, $sp, -0x60
/* 244B8 800490B8 F7B60050 */  sdc1      $f22, 0x50($sp)
/* 244BC 800490BC 4486B000 */  mtc1      $a2, $f22
/* 244C0 800490C0 F7B80058 */  sdc1      $f24, 0x58($sp)
/* 244C4 800490C4 4487C000 */  mtc1      $a3, $f24
/* 244C8 800490C8 AFB10034 */  sw        $s1, 0x34($sp)
/* 244CC 800490CC 0080882D */  daddu     $s1, $a0, $zero
/* 244D0 800490D0 AFB3003C */  sw        $s3, 0x3C($sp)
/* 244D4 800490D4 00A0982D */  daddu     $s3, $a1, $zero
/* 244D8 800490D8 AFBF0044 */  sw        $ra, 0x44($sp)
/* 244DC 800490DC AFB40040 */  sw        $s4, 0x40($sp)
/* 244E0 800490E0 AFB20038 */  sw        $s2, 0x38($sp)
/* 244E4 800490E4 AFB00030 */  sw        $s0, 0x30($sp)
/* 244E8 800490E8 F7B40048 */  sdc1      $f20, 0x48($sp)
/* 244EC 800490EC 86640008 */  lh        $a0, 0x8($s3)
/* 244F0 800490F0 0C00EABB */  jal       get_npc_unsafe
/* 244F4 800490F4 93B40073 */   lbu      $s4, 0x73($sp)
/* 244F8 800490F8 0040802D */  daddu     $s0, $v0, $zero
/* 244FC 800490FC 8E6200B0 */  lw        $v0, 0xB0($s3)
/* 24500 80049100 3C128011 */  lui       $s2, %hi(gPlayerStatus)
/* 24504 80049104 2652EFC8 */  addiu     $s2, $s2, %lo(gPlayerStatus)
/* 24508 80049108 30420002 */  andi      $v0, $v0, 0x2
/* 2450C 8004910C 144000AC */  bnez      $v0, .L800493C0
/* 24510 80049110 0000102D */   daddu    $v0, $zero, $zero
/* 24514 80049114 3C048011 */  lui       $a0, %hi(gPartnerStatus)
/* 24518 80049118 2484EBB0 */  addiu     $a0, $a0, %lo(gPartnerStatus)
/* 2451C 8004911C 80830003 */  lb        $v1, 0x3($a0)
/* 24520 80049120 24020009 */  addiu     $v0, $zero, 0x9
/* 24524 80049124 14620008 */  bne       $v1, $v0, .L80049148
/* 24528 80049128 24020007 */   addiu    $v0, $zero, 0x7
/* 2452C 8004912C 80820000 */  lb        $v0, 0x0($a0)
/* 24530 80049130 10400005 */  beqz      $v0, .L80049148
/* 24534 80049134 24020007 */   addiu    $v0, $zero, 0x7
/* 24538 80049138 9622001C */  lhu       $v0, 0x1C($s1)
/* 2453C 8004913C 30420001 */  andi      $v0, $v0, 0x1
/* 24540 80049140 1040009E */  beqz      $v0, .L800493BC
/* 24544 80049144 24020007 */   addiu    $v0, $zero, 0x7
.L80049148:
/* 24548 80049148 14620008 */  bne       $v1, $v0, .L8004916C
/* 2454C 8004914C 00000000 */   nop
/* 24550 80049150 80820000 */  lb        $v0, 0x0($a0)
/* 24554 80049154 10400005 */  beqz      $v0, .L8004916C
/* 24558 80049158 00000000 */   nop
/* 2455C 8004915C 9622001C */  lhu       $v0, 0x1C($s1)
/* 24560 80049160 30420001 */  andi      $v0, $v0, 0x1
/* 24564 80049164 10400096 */  beqz      $v0, .L800493C0
/* 24568 80049168 0000102D */   daddu    $v0, $zero, $zero
.L8004916C:
/* 2456C 8004916C 8E220000 */  lw        $v0, 0x0($s1)
/* 24570 80049170 04400093 */  bltz      $v0, .L800493C0
/* 24574 80049174 0000102D */   daddu    $v0, $zero, $zero
/* 24578 80049178 C600003C */  lwc1      $f0, 0x3C($s0)
/* 2457C 8004917C C642002C */  lwc1      $f2, 0x2C($s2)
/* 24580 80049180 46020001 */  sub.s     $f0, $f0, $f2
/* 24584 80049184 C6220018 */  lwc1      $f2, 0x18($s1)
/* 24588 80049188 46000005 */  abs.s     $f0, $f0
/* 2458C 8004918C 4600103E */  c.le.s    $f2, $f0
/* 24590 80049190 00000000 */  nop
/* 24594 80049194 45000005 */  bc1f      .L800491AC
/* 24598 80049198 00000000 */   nop
/* 2459C 8004919C 9622001C */  lhu       $v0, 0x1C($s1)
/* 245A0 800491A0 30420002 */  andi      $v0, $v0, 0x2
/* 245A4 800491A4 10400086 */  beqz      $v0, .L800493C0
/* 245A8 800491A8 0000102D */   daddu    $v0, $zero, $zero
.L800491AC:
/* 245AC 800491AC 8E220010 */  lw        $v0, 0x10($s1)
/* 245B0 800491B0 8E230014 */  lw        $v1, 0x14($s1)
/* 245B4 800491B4 00431025 */  or        $v0, $v0, $v1
/* 245B8 800491B8 10400014 */  beqz      $v0, .L8004920C
/* 245BC 800491BC 00000000 */   nop
/* 245C0 800491C0 C6200008 */  lwc1      $f0, 0x8($s1)
/* 245C4 800491C4 46800020 */  cvt.s.w   $f0, $f0
/* 245C8 800491C8 44050000 */  mfc1      $a1, $f0
/* 245CC 800491CC C620000C */  lwc1      $f0, 0xC($s1)
/* 245D0 800491D0 46800020 */  cvt.s.w   $f0, $f0
/* 245D4 800491D4 44060000 */  mfc1      $a2, $f0
/* 245D8 800491D8 C6400030 */  lwc1      $f0, 0x30($s2)
/* 245DC 800491DC 8E470028 */  lw        $a3, 0x28($s2)
/* 245E0 800491E0 E7A00010 */  swc1      $f0, 0x10($sp)
/* 245E4 800491E4 C6200010 */  lwc1      $f0, 0x10($s1)
/* 245E8 800491E8 46800020 */  cvt.s.w   $f0, $f0
/* 245EC 800491EC E7A00014 */  swc1      $f0, 0x14($sp)
/* 245F0 800491F0 C6200014 */  lwc1      $f0, 0x14($s1)
/* 245F4 800491F4 46800020 */  cvt.s.w   $f0, $f0
/* 245F8 800491F8 E7A00018 */  swc1      $f0, 0x18($sp)
/* 245FC 800491FC 0C0123F5 */  jal       is_point_within_region
/* 24600 80049200 8E240004 */   lw       $a0, 0x4($s1)
/* 24604 80049204 1440006E */  bnez      $v0, .L800493C0
/* 24608 80049208 0000102D */   daddu    $v0, $zero, $zero
.L8004920C:
/* 2460C 8004920C 824300B4 */  lb        $v1, 0xB4($s2)
/* 24610 80049210 2402001D */  addiu     $v0, $zero, 0x1D
/* 24614 80049214 1062006A */  beq       $v1, $v0, .L800493C0
/* 24618 80049218 0000102D */   daddu    $v0, $zero, $zero
/* 2461C 8004921C 926200AC */  lbu       $v0, 0xAC($s3)
/* 24620 80049220 30420001 */  andi      $v0, $v0, 0x1
/* 24624 80049224 1040002C */  beqz      $v0, .L800492D8
/* 24628 80049228 00000000 */   nop
/* 2462C 8004922C C60C0038 */  lwc1      $f12, 0x38($s0)
/* 24630 80049230 860200A8 */  lh        $v0, 0xA8($s0)
/* 24634 80049234 3C013FE0 */  lui       $at, (0x3FE00000 >> 16)
/* 24638 80049238 44810800 */  mtc1      $at, $f1
/* 2463C 8004923C 44800000 */  mtc1      $zero, $f0
/* 24640 80049240 44821000 */  mtc1      $v0, $f2
/* 24644 80049244 00000000 */  nop
/* 24648 80049248 468010A1 */  cvt.d.w   $f2, $f2
/* 2464C 8004924C 46201082 */  mul.d     $f2, $f2, $f0
/* 24650 80049250 00000000 */  nop
/* 24654 80049254 C60E0040 */  lwc1      $f14, 0x40($s0)
/* 24658 80049258 8E460028 */  lw        $a2, 0x28($s2)
/* 2465C 8004925C 8E470030 */  lw        $a3, 0x30($s2)
/* 24660 80049260 46006106 */  mov.s     $f4, $f12
/* 24664 80049264 C600003C */  lwc1      $f0, 0x3C($s0)
/* 24668 80049268 46007186 */  mov.s     $f6, $f14
/* 2466C 8004926C 46000021 */  cvt.d.s   $f0, $f0
/* 24670 80049270 46220000 */  add.d     $f0, $f0, $f2
/* 24674 80049274 E7A40020 */  swc1      $f4, 0x20($sp)
/* 24678 80049278 E7A60028 */  swc1      $f6, 0x28($sp)
/* 2467C 8004927C 46200020 */  cvt.s.d   $f0, $f0
/* 24680 80049280 0C00A7B5 */  jal       dist2D
/* 24684 80049284 E7A00024 */   swc1     $f0, 0x24($sp)
/* 24688 80049288 C60C0038 */  lwc1      $f12, 0x38($s0)
/* 2468C 8004928C C60E0040 */  lwc1      $f14, 0x40($s0)
/* 24690 80049290 8E460028 */  lw        $a2, 0x28($s2)
/* 24694 80049294 8E470030 */  lw        $a3, 0x30($s2)
/* 24698 80049298 0C00A720 */  jal       atan2
/* 2469C 8004929C 46000506 */   mov.s    $f20, $f0
/* 246A0 800492A0 3C040005 */  lui       $a0, (0x50000 >> 16)
/* 246A4 800492A4 27A50020 */  addiu     $a1, $sp, 0x20
/* 246A8 800492A8 27A60024 */  addiu     $a2, $sp, 0x24
/* 246AC 800492AC 3C013DCC */  lui       $at, (0x3DCCCCCD >> 16)
/* 246B0 800492B0 3421CCCD */  ori       $at, $at, (0x3DCCCCCD & 0xFFFF)
/* 246B4 800492B4 44811000 */  mtc1      $at, $f2
/* 246B8 800492B8 27A70028 */  addiu     $a3, $sp, 0x28
/* 246BC 800492BC E7B40010 */  swc1      $f20, 0x10($sp)
/* 246C0 800492C0 E7A00014 */  swc1      $f0, 0x14($sp)
/* 246C4 800492C4 E7A20018 */  swc1      $f2, 0x18($sp)
/* 246C8 800492C8 0C037711 */  jal       npc_test_move_simple_with_slipping
/* 246CC 800492CC E7A2001C */   swc1     $f2, 0x1C($sp)
/* 246D0 800492D0 1440003B */  bnez      $v0, .L800493C0
/* 246D4 800492D4 0000102D */   daddu    $v0, $zero, $zero
.L800492D8:
/* 246D8 800492D8 8E220000 */  lw        $v0, 0x0($s1)
/* 246DC 800492DC 14400003 */  bnez      $v0, .L800492EC
/* 246E0 800492E0 00000000 */   nop
/* 246E4 800492E4 080124BD */  j         .L800492F4
/* 246E8 800492E8 0000102D */   daddu    $v0, $zero, $zero
.L800492EC:
/* 246EC 800492EC 0C00A67F */  jal       rand_int
/* 246F0 800492F0 24440001 */   addiu    $a0, $v0, 0x1
.L800492F4:
/* 246F4 800492F4 14400032 */  bnez      $v0, .L800493C0
/* 246F8 800492F8 0000102D */   daddu    $v0, $zero, $zero
/* 246FC 800492FC 926200AC */  lbu       $v0, 0xAC($s3)
/* 24700 80049300 30420002 */  andi      $v0, $v0, 0x2
/* 24704 80049304 10400010 */  beqz      $v0, .L80049348
/* 24708 80049308 24020001 */   addiu    $v0, $zero, 0x1
/* 2470C 8004930C 824300B4 */  lb        $v1, 0xB4($s2)
/* 24710 80049310 14620005 */  bne       $v1, $v0, .L80049328
/* 24714 80049314 24020002 */   addiu    $v0, $zero, 0x2
/* 24718 80049318 3C01800A */  lui       $at, %hi(D_80098710)
/* 2471C 8004931C D4228710 */  ldc1      $f2, %lo(D_80098710)($at)
/* 24720 80049320 080124CF */  j         .L8004933C
/* 24724 80049324 4600B021 */   cvt.d.s  $f0, $f22
.L80049328:
/* 24728 80049328 14620007 */  bne       $v1, $v0, .L80049348
/* 2472C 8004932C 00000000 */   nop
/* 24730 80049330 3C01800A */  lui       $at, %hi(D_80098718)
/* 24734 80049334 D4228718 */  ldc1      $f2, %lo(D_80098718)($at)
/* 24738 80049338 4600B021 */  cvt.d.s   $f0, $f22
.L8004933C:
/* 2473C 8004933C 46220002 */  mul.d     $f0, $f0, $f2
/* 24740 80049340 00000000 */  nop
/* 24744 80049344 462005A0 */  cvt.s.d   $f22, $f0
.L80049348:
/* 24748 80049348 C6000038 */  lwc1      $f0, 0x38($s0)
/* 2474C 8004934C C6020040 */  lwc1      $f2, 0x40($s0)
/* 24750 80049350 328200FF */  andi      $v0, $s4, 0xFF
/* 24754 80049354 E7A00020 */  swc1      $f0, 0x20($sp)
/* 24758 80049358 10400005 */  beqz      $v0, .L80049370
/* 2475C 8004935C E7A20028 */   swc1     $f2, 0x28($sp)
/* 24760 80049360 4406C000 */  mfc1      $a2, $f24
/* 24764 80049364 8E07000C */  lw        $a3, 0xC($s0)
/* 24768 80049368 080124E4 */  j         .L80049390
/* 2476C 8004936C 27A40020 */   addiu    $a0, $sp, 0x20
.L80049370:
/* 24770 80049370 C6020034 */  lwc1      $f2, 0x34($s0)
/* 24774 80049374 3C014387 */  lui       $at, (0x43870000 >> 16)
/* 24778 80049378 44810000 */  mtc1      $at, $f0
/* 2477C 8004937C 00000000 */  nop
/* 24780 80049380 46020001 */  sub.s     $f0, $f0, $f2
/* 24784 80049384 27A40020 */  addiu     $a0, $sp, 0x20
/* 24788 80049388 4406C000 */  mfc1      $a2, $f24
/* 2478C 8004938C 44070000 */  mfc1      $a3, $f0
.L80049390:
/* 24790 80049390 0C00A7E7 */  jal       add_vec2D_polar
/* 24794 80049394 27A50028 */   addiu    $a1, $sp, 0x28
/* 24798 80049398 C7AC0020 */  lwc1      $f12, 0x20($sp)
/* 2479C 8004939C C7AE0028 */  lwc1      $f14, 0x28($sp)
/* 247A0 800493A0 8E460028 */  lw        $a2, 0x28($s2)
/* 247A4 800493A4 0C00A7B5 */  jal       dist2D
/* 247A8 800493A8 8E470030 */   lw       $a3, 0x30($s2)
/* 247AC 800493AC 4616003E */  c.le.s    $f0, $f22
/* 247B0 800493B0 00000000 */  nop
/* 247B4 800493B4 45010002 */  bc1t      .L800493C0
/* 247B8 800493B8 24020001 */   addiu    $v0, $zero, 0x1
.L800493BC:
/* 247BC 800493BC 0000102D */  daddu     $v0, $zero, $zero
.L800493C0:
/* 247C0 800493C0 8FBF0044 */  lw        $ra, 0x44($sp)
/* 247C4 800493C4 8FB40040 */  lw        $s4, 0x40($sp)
/* 247C8 800493C8 8FB3003C */  lw        $s3, 0x3C($sp)
/* 247CC 800493CC 8FB20038 */  lw        $s2, 0x38($sp)
/* 247D0 800493D0 8FB10034 */  lw        $s1, 0x34($sp)
/* 247D4 800493D4 8FB00030 */  lw        $s0, 0x30($sp)
/* 247D8 800493D8 D7B80058 */  ldc1      $f24, 0x58($sp)
/* 247DC 800493DC D7B60050 */  ldc1      $f22, 0x50($sp)
/* 247E0 800493E0 D7B40048 */  ldc1      $f20, 0x48($sp)
/* 247E4 800493E4 03E00008 */  jr        $ra
/* 247E8 800493E8 27BD0060 */   addiu    $sp, $sp, 0x60

### DECOMPILED C INSTRUCTIONS:

s32 basic_ai_check_player_dist(EnemyDetectVolume* territory, Enemy* enemy, f32 radius, f32 fwdPosOffset, s8 useWorldYaw) {
    Npc* npc = get_npc_unsafe(enemy->npcID);
    PlayerStatus* playerStatus = &gPlayerStatus;
    PartnerStatus* partnerStatus;
    f32 x, y, z;
    f32 dist;
    s32 skipCheckForPlayer;

    if (enemy->aiFlags & ENEMY_AI_FLAG_2) {
        return FALSE;
    }

    partnerStatus = &gPartnerStatus;
    if (partnerStatus->actingPartner == PARTNER_BOW && partnerStatus->partnerActionState
            && !(territory->detectFlags & AI_TERRITORY_IGNORE_HIDING)) {
        return FALSE;
    }

    if (partnerStatus->actingPartner == PARTNER_SUSHIE && partnerStatus->partnerActionState
            && !(territory->detectFlags & AI_TERRITORY_IGNORE_HIDING)) {
        return FALSE;
    }

    if (territory->skipPlayerDetectChance < 0) {
        return FALSE;
    }

    if (territory->halfHeight <= fabsf(npc->pos.y - playerStatus->position.y)
            && !(territory->detectFlags & AI_TERRITORY_IGNORE_ELEVATION)) {
        return FALSE;
    }

    if (territory->sizeX | territory->sizeZ && is_point_within_region(territory->shape,
            territory->pointX, territory->pointZ,
            playerStatus->position.x, playerStatus->position.z,
            territory->sizeX, territory->sizeZ)) {
        return FALSE;
    }

    if ((playerStatus->actionState == ACTION_STATE_USE_SPINNING_FLOWER)) {
        return FALSE;
    }

    // check for unbroken line of sight
    if (enemy->aiDetectFlags & AI_DETECT_SIGHT) {
        x = npc->pos.x;
        y = npc->pos.y + npc->collisionHeight * 0.5;
        z = npc->pos.z;
        dist = dist2D(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z);
        if (npc_test_move_simple_with_slipping(COLLISION_CHANNEL_10000 | COLLISION_IGNORE_ENTITIES,
                &x, &y, &z,
                dist, atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z),
                0.1f, 0.1f)) {
            return FALSE;
        }
    }

    if (territory->skipPlayerDetectChance == 0) {
        skipCheckForPlayer = 0;
    } else {
        skipCheckForPlayer = rand_int(territory->skipPlayerDetectChance + 1);
    }

    if (skipCheckForPlayer == 0) {
        if (enemy->aiDetectFlags & AI_DETECT_SENSITIVE_MOTION) {
            if (playerStatus->actionState == ACTION_STATE_WALK) {
                radius *= 1.15;
            } else if (playerStatus->actionState == ACTION_STATE_RUN) {
                radius *= 1.3;
            }
        }
        x = npc->pos.x;
        z = npc->pos.z;
        if (useWorldYaw & 0xFF) {
            add_vec2D_polar(&x, &z, fwdPosOffset, npc->yaw);
        } else {
            add_vec2D_polar(&x, &z, fwdPosOffset, 270.0f - npc->renderYaw);
        }
        if (dist2D(x, z, playerStatus->position.x, playerStatus->position.z) <= radius) {
            return TRUE;
        }
    }

    return FALSE;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel btl_draw_ui
/* 16D35C 8023EA7C 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* 16D360 8023EA80 AFB10014 */  sw        $s1, 0x14($sp)
/* 16D364 8023EA84 0000882D */  daddu     $s1, $zero, $zero
/* 16D368 8023EA88 AFBF0018 */  sw        $ra, 0x18($sp)
/* 16D36C 8023EA8C AFB00010 */  sw        $s0, 0x10($sp)
/* 16D370 8023EA90 3C10800E */  lui       $s0, %hi(gBattleState)
/* 16D374 8023EA94 8E10C068 */  lw        $s0, %lo(gBattleState)($s0)
/* 16D378 8023EA98 3C04800E */  lui       $a0, %hi(gLastDrawBattleState)
/* 16D37C 8023EA9C 2484C4D0 */  addiu     $a0, $a0, %lo(gLastDrawBattleState)
/* 16D380 8023EAA0 8C820000 */  lw        $v0, 0x0($a0)
/* 16D384 8023EAA4 12020005 */  beq       $s0, $v0, .L8023EABC
/* 16D388 8023EAA8 0200182D */   daddu    $v1, $s0, $zero
/* 16D38C 8023EAAC 0040802D */  daddu     $s0, $v0, $zero
/* 16D390 8023EAB0 AC830000 */  sw        $v1, 0x0($a0)
/* 16D394 8023EAB4 0808FABA */  j         .L8023EAE8
/* 16D398 8023EAB8 24110001 */   addiu    $s1, $zero, 0x1
.L8023EABC:
/* 16D39C 8023EABC 2402FFFF */  addiu     $v0, $zero, -0x1
/* 16D3A0 8023EAC0 16020007 */  bne       $s0, $v0, .L8023EAE0
/* 16D3A4 8023EAC4 00000000 */   nop
/* 16D3A8 8023EAC8 0C0900EF */  jal       func_802403BC
/* 16D3AC 8023EACC 00000000 */   nop
/* 16D3B0 8023EAD0 0C08FFE8 */  jal       btl_draw_enemy_health_bars
/* 16D3B4 8023EAD4 00000000 */   nop
/* 16D3B8 8023EAD8 0808FB50 */  j         .L8023ED40
/* 16D3BC 8023EADC 00000000 */   nop
.L8023EAE0:
/* 16D3C0 8023EAE0 12000099 */  beqz      $s0, .L8023ED48
/* 16D3C4 8023EAE4 00000000 */   nop
.L8023EAE8:
/* 16D3C8 8023EAE8 0C0900EF */  jal       func_802403BC
/* 16D3CC 8023EAEC 00000000 */   nop
/* 16D3D0 8023EAF0 0C08FFE8 */  jal       btl_draw_enemy_health_bars
/* 16D3D4 8023EAF4 00000000 */   nop
/* 16D3D8 8023EAF8 1620008F */  bnez      $s1, .L8023ED38
/* 16D3DC 8023EAFC 2603FFFF */   addiu    $v1, $s0, -0x1
/* 16D3E0 8023EB00 2C620023 */  sltiu     $v0, $v1, 0x23
/* 16D3E4 8023EB04 1040008C */  beqz      $v0, .L8023ED38
/* 16D3E8 8023EB08 00031080 */   sll      $v0, $v1, 2
/* 16D3EC 8023EB0C 3C01802A */  lui       $at, %hi(jtbl_8029C9F8)
/* 16D3F0 8023EB10 00220821 */  addu      $at, $at, $v0
/* 16D3F4 8023EB14 8C22C9F8 */  lw        $v0, %lo(jtbl_8029C9F8)($at)
/* 16D3F8 8023EB18 00400008 */  jr        $v0
/* 16D3FC 8023EB1C 00000000 */   nop
glabel .L8023EB20
/* 16D400 8023EB20 0C0906AE */  jal       flo_11_pad_1AB8
/* 16D404 8023EB24 00000000 */   nop
/* 16D408 8023EB28 0808FB4E */  j         .L8023ED38
/* 16D40C 8023EB2C 00000000 */   nop
glabel .L8023EB30
/* 16D410 8023EB30 0C090AB0 */  jal       func_80242AC0
/* 16D414 8023EB34 00000000 */   nop
/* 16D418 8023EB38 0808FB4E */  j         .L8023ED38
/* 16D41C 8023EB3C 00000000 */   nop
glabel .L8023EB40
/* 16D420 8023EB40 0C090BBE */  jal       func_80242EF8
/* 16D424 8023EB44 00000000 */   nop
/* 16D428 8023EB48 0808FB4E */  j         .L8023ED38
/* 16D42C 8023EB4C 00000000 */   nop
glabel .L8023EB50
/* 16D430 8023EB50 0C090E44 */  jal       func_80243910
/* 16D434 8023EB54 00000000 */   nop
/* 16D438 8023EB58 0808FB4E */  j         .L8023ED38
/* 16D43C 8023EB5C 00000000 */   nop
glabel .L8023EB60
/* 16D440 8023EB60 0C090807 */  jal       func_8024201C
/* 16D444 8023EB64 00000000 */   nop
/* 16D448 8023EB68 0808FB4E */  j         .L8023ED38
/* 16D44C 8023EB6C 00000000 */   nop
glabel .L8023EB70
/* 16D450 8023EB70 0C090FF5 */  jal       func_80243FD4
/* 16D454 8023EB74 00000000 */   nop
/* 16D458 8023EB78 0808FB4E */  j         .L8023ED38
/* 16D45C 8023EB7C 00000000 */   nop
glabel .L8023EB80
/* 16D460 8023EB80 0C090AEA */  jal       func_80242BA8
/* 16D464 8023EB84 00000000 */   nop
/* 16D468 8023EB88 0808FB4E */  j         .L8023ED38
/* 16D46C 8023EB8C 00000000 */   nop
glabel .L8023EB90
/* 16D470 8023EB90 0C090BF6 */  jal       func_80242FD8
/* 16D474 8023EB94 00000000 */   nop
/* 16D478 8023EB98 0808FB4E */  j         .L8023ED38
/* 16D47C 8023EB9C 00000000 */   nop
glabel .L8023EBA0
/* 16D480 8023EBA0 0C090E74 */  jal       func_802439D0
/* 16D484 8023EBA4 00000000 */   nop
/* 16D488 8023EBA8 0808FB4E */  j         .L8023ED38
/* 16D48C 8023EBAC 00000000 */   nop
glabel .L8023EBB0
/* 16D490 8023EBB0 0C0AA060 */  jal       func_802A8180_7AFB20
/* 16D494 8023EBB4 00000000 */   nop
/* 16D498 8023EBB8 0808FB4E */  j         .L8023ED38
/* 16D49C 8023EBBC 00000000 */   nop
glabel .L8023EBC0
/* 16D4A0 8023EBC0 0C0AA6BA */  jal       func_802A9AE8_7B1488
/* 16D4A4 8023EBC4 00000000 */   nop
/* 16D4A8 8023EBC8 0808FB4E */  j         .L8023ED38
/* 16D4AC 8023EBCC 00000000 */   nop
glabel .L8023EBD0
/* 16D4B0 8023EBD0 0C0AA990 */  jal       D_802AA640_7B1FE0
/* 16D4B4 8023EBD4 00000000 */   nop
/* 16D4B8 8023EBD8 0808FB4E */  j         .L8023ED38
/* 16D4BC 8023EBDC 00000000 */   nop
glabel .L8023EBE0
/* 16D4C0 8023EBE0 0C0AA817 */  jal       func_802AA05C_7B19FC
/* 16D4C4 8023EBE4 00000000 */   nop
/* 16D4C8 8023EBE8 0808FB4E */  j         .L8023ED38
/* 16D4CC 8023EBEC 00000000 */   nop
glabel .L8023EBF0
/* 16D4D0 8023EBF0 0C0AAB36 */  jal       func_802AACD8_7B2678
/* 16D4D4 8023EBF4 00000000 */   nop
/* 16D4D8 8023EBF8 0808FB4E */  j         .L8023ED38
/* 16D4DC 8023EBFC 00000000 */   nop
glabel .L8023EC00
/* 16D4E0 8023EC00 0C091912 */  jal       func_80246448
/* 16D4E4 8023EC04 00000000 */   nop
/* 16D4E8 8023EC08 0808FB4E */  j         .L8023ED38
/* 16D4EC 8023EC0C 00000000 */   nop
glabel .L8023EC10
/* 16D4F0 8023EC10 0C09203C */  jal       func_802480F0
/* 16D4F4 8023EC14 00000000 */   nop
/* 16D4F8 8023EC18 0808FB4E */  j         .L8023ED38
/* 16D4FC 8023EC1C 00000000 */   nop
glabel .L8023EC20
/* 16D500 8023EC20 0C091ACB */  jal       func_80246B2C
/* 16D504 8023EC24 00000000 */   nop
/* 16D508 8023EC28 0808FB4E */  j         .L8023ED38
/* 16D50C 8023EC2C 00000000 */   nop
glabel .L8023EC30
/* 16D510 8023EC30 0C091CA9 */  jal       func_802472A4
/* 16D514 8023EC34 00000000 */   nop
/* 16D518 8023EC38 0808FB4E */  j         .L8023ED38
/* 16D51C 8023EC3C 00000000 */   nop
glabel .L8023EC40
/* 16D520 8023EC40 0C09217F */  jal       func_802485FC
/* 16D524 8023EC44 00000000 */   nop
/* 16D528 8023EC48 0808FB4E */  j         .L8023ED38
/* 16D52C 8023EC4C 00000000 */   nop
glabel .L8023EC50
/* 16D530 8023EC50 0C091EBF */  jal       func_80247AFC
/* 16D534 8023EC54 00000000 */   nop
/* 16D538 8023EC58 0808FB4E */  j         .L8023ED38
/* 16D53C 8023EC5C 00000000 */   nop
glabel .L8023EC60
/* 16D540 8023EC60 0C091D5A */  jal       func_80247568
/* 16D544 8023EC64 00000000 */   nop
/* 16D548 8023EC68 0808FB4E */  j         .L8023ED38
/* 16D54C 8023EC6C 00000000 */   nop
glabel .L8023EC70
/* 16D550 8023EC70 0C091C85 */  jal       func_80247214
/* 16D554 8023EC74 00000000 */   nop
/* 16D558 8023EC78 0808FB4E */  j         .L8023ED38
/* 16D55C 8023EC7C 00000000 */   nop
glabel .L8023EC80
/* 16D560 8023EC80 0C0911C2 */  jal       func_80244708
/* 16D564 8023EC84 00000000 */   nop
/* 16D568 8023EC88 0808FB4E */  j         .L8023ED38
/* 16D56C 8023EC8C 00000000 */   nop
glabel .L8023EC90
/* 16D570 8023EC90 0C091364 */  jal       func_80244D90
/* 16D574 8023EC94 00000000 */   nop
/* 16D578 8023EC98 0808FB4E */  j         .L8023ED38
/* 16D57C 8023EC9C 00000000 */   nop
glabel .L8023ECA0
/* 16D580 8023ECA0 0C0916B2 */  jal       func_80245AC8
/* 16D584 8023ECA4 00000000 */   nop
/* 16D588 8023ECA8 0808FB4E */  j         .L8023ED38
/* 16D58C 8023ECAC 00000000 */   nop
glabel .L8023ECB0
/* 16D590 8023ECB0 0C09150E */  jal       D_80245438
/* 16D594 8023ECB4 00000000 */   nop
/* 16D598 8023ECB8 0808FB4E */  j         .L8023ED38
/* 16D59C 8023ECBC 00000000 */   nop
glabel .L8023ECC0
/* 16D5A0 8023ECC0 0C0913BE */  jal       func_80244EF8
/* 16D5A4 8023ECC4 00000000 */   nop
/* 16D5A8 8023ECC8 0808FB4E */  j         .L8023ED38
/* 16D5AC 8023ECCC 00000000 */   nop
glabel .L8023ECD0
/* 16D5B0 8023ECD0 0C0915AC */  jal       func_802456B0
/* 16D5B4 8023ECD4 00000000 */   nop
/* 16D5B8 8023ECD8 0808FB4E */  j         .L8023ED38
/* 16D5BC 8023ECDC 00000000 */   nop
glabel .L8023ECE0
/* 16D5C0 8023ECE0 0C091000 */  jal       D_80244000
/* 16D5C4 8023ECE4 00000000 */   nop
/* 16D5C8 8023ECE8 0808FB4E */  j         .L8023ED38
/* 16D5CC 8023ECEC 00000000 */   nop
glabel .L8023ECF0
/* 16D5D0 8023ECF0 0C091292 */  jal       func_80244A48
/* 16D5D4 8023ECF4 00000000 */   nop
/* 16D5D8 8023ECF8 0808FB4E */  j         .L8023ED38
/* 16D5DC 8023ECFC 00000000 */   nop
glabel .L8023ED00
/* 16D5E0 8023ED00 0C0922A9 */  jal       func_80248AA4
/* 16D5E4 8023ED04 00000000 */   nop
/* 16D5E8 8023ED08 0808FB4E */  j         .L8023ED38
/* 16D5EC 8023ED0C 00000000 */   nop
glabel .L8023ED10
/* 16D5F0 8023ED10 0C0AACCE */  jal       func_802AB338_7B2CD8
/* 16D5F4 8023ED14 00000000 */   nop
/* 16D5F8 8023ED18 0808FB4E */  j         .L8023ED38
/* 16D5FC 8023ED1C 00000000 */   nop
glabel .L8023ED20
/* 16D600 8023ED20 0C09806F */  jal       func_802601BC
/* 16D604 8023ED24 00000000 */   nop
/* 16D608 8023ED28 0808FB4E */  j         .L8023ED38
/* 16D60C 8023ED2C 00000000 */   nop
glabel .L8023ED30
/* 16D610 8023ED30 0C09235E */  jal       func_80248D78
/* 16D614 8023ED34 00000000 */   nop
glabel .L8023ED38
/* 16D618 8023ED38 0C093BC2 */  jal       func_8024EF08
/* 16D61C 8023ED3C 00000000 */   nop
.L8023ED40:
/* 16D620 8023ED40 0C03A5CF */  jal       draw_status_ui
/* 16D624 8023ED44 00000000 */   nop
.L8023ED48:
/* 16D628 8023ED48 8FBF0018 */  lw        $ra, 0x18($sp)
/* 16D62C 8023ED4C 8FB10014 */  lw        $s1, 0x14($sp)
/* 16D630 8023ED50 8FB00010 */  lw        $s0, 0x10($sp)
/* 16D634 8023ED54 03E00008 */  jr        $ra
/* 16D638 8023ED58 27BD0020 */   addiu    $sp, $sp, 0x20

### DECOMPILED C INSTRUCTIONS:

void btl_draw_ui(void) {
    s32 changed = FALSE;
    s32 state;

    do { } while (0); // TODO required to match (probably can be removed with some sort of control flow inversion)

    // do not draw UI during the frame of a state change
    state = gBattleState;
    if (gBattleState != gLastDrawBattleState) {
        state = gLastDrawBattleState;
        gLastDrawBattleState = gBattleState;
        changed = TRUE;
    } else {
        switch (state) {
            case BATTLE_STATE_NEGATIVE_1:
                btl_update_starpoints_display();
                btl_draw_enemy_health_bars();
                draw_status_ui();
                return;
            case BATTLE_STATE_0:
                return;
        }
    }

    btl_update_starpoints_display();
    btl_draw_enemy_health_bars();

    if (!changed) {
        switch (state) {
            case BATTLE_STATE_NORMAL_START:
                btl_state_draw_normal_start();
                break;
            case BATTLE_STATE_BEGIN_PLAYER_TURN:
                btl_state_draw_begin_player_turn();
                break;
            case BATTLE_STATE_BEGIN_PARTNER_TURN:
                btl_state_draw_begin_partner_turn();
                break;
            case BATTLE_STATE_9:
                btl_state_draw_9();
                break;
            case BATTLE_STATE_BEGIN_TURN:
                btl_state_draw_begin_turn();
                break;
            case BATTLE_STATE_END_TURN:
                btl_state_draw_end_turn();
                break;
            case BATTLE_STATE_SWITCH_TO_PLAYER:
                btl_state_draw_switch_to_player();
                break;
            case BATTLE_STATE_SWITCH_TO_PARTNER:
                btl_state_draw_switch_to_partner();
                break;
            case BATTLE_STATE_PREPARE_MENU:
                btl_state_draw_prepare_menu();
                break;
            case BATTLE_STATE_PLAYER_MENU:
                btl_state_draw_player_menu();
                break;
            case BATTLE_STATE_PARTNER_MENU:
                btl_state_draw_partner_menu();
                break;
            case BATTLE_STATE_TWINK_MENU:
                btl_state_draw_twink_menu();
                break;
            case BATTLE_STATE_PEACH_MENU:
                btl_state_draw_peach_menu();
                break;
            case BATTLE_STATE_SELECT_TARGET:
                btl_state_draw_select_target();
                break;
            case BATTLE_STATE_PLAYER_MOVE:
                btl_state_draw_player_move();
                break;
            case BATTLE_STATE_FIRST_STRIKE:
                btl_state_draw_first_stike();
                break;
            case BATTLE_STATE_END_PLAYER_TURN:
                btl_state_draw_end_player_turn();
                break;
            case BATTLE_STATE_END_PARTNER_TURN:
                btl_state_draw_end_partner_turn();
                break;
            case BATTLE_STATE_PARTNER_FIRST_STRIKE:
                btl_state_draw_partner_striking_first();
                break;
            case BATTLE_STATE_ENEMY_MOVE:
                btl_state_draw_enemy_move();
                break;
            case BATTLE_STATE_NEXT_ENEMY:
                btl_state_draw_next_enemy();
                break;
            case BATTLE_STATE_PARTNER_MOVE:
                btl_state_draw_partner_move();
                break;
            case BATTLE_STATE_VICTORY:
                btl_state_draw_victory();
                break;
            case BATTLE_STATE_END_BATTLE:
                btl_state_draw_end_battle();
                break;
            case BATTLE_STATE_CHANGE_PARTNER:
                btl_state_draw_change_partner();
                break;
            case BATTLE_STATE_RUN_AWAY:
                btl_state_draw_run_away();
                break;
            case BATTLE_STATE_DEFEND:
                btl_state_draw_defend();
                break;
            case BATTLE_STATE_DEFEAT:
                btl_state_draw_defeat();
                break;
            case BATTLE_STATE_28:
                btl_state_draw_1C();
                break;
            case BATTLE_STATE_END_TRAINING_BATTLE:
                btl_state_draw_end_training_battle();
                break;
            case BATTLE_STATE_ENEMY_FIRST_STRIKE:
                btl_state_draw_enemy_striking_first();
                break;
            case BATTLE_STATE_34:
                btl_state_draw_22();
                break;
            case BATTLE_STATE_CELEBRATION:
                btl_state_draw_celebration();
                break;
            case BATTLE_STATE_END_DEMO_BATTLE:
                btl_state_draw_end_demo_battle();
                break;
        }
    }
    btl_popup_messages_draw_ui();
    draw_status_ui();
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel dust_appendGfx
/* 33EC84 E002A3C4 27BDFEF8 */  addiu     $sp, $sp, -0x108
/* 33EC88 E002A3C8 3C02DB06 */  lui       $v0, (0xDB060024 >> 16)
/* 33EC8C E002A3CC 34420024 */  ori       $v0, $v0, (0xDB060024 & 0xFFFF)
/* 33EC90 E002A3D0 AFB200E8 */  sw        $s2, 0xE8($sp)
/* 33EC94 E002A3D4 3C12800A */  lui       $s2, %hi(gMainGfxPos)
/* 33EC98 E002A3D8 2652A66C */  addiu     $s2, $s2, %lo(gMainGfxPos)
/* 33EC9C E002A3DC AFBF0104 */  sw        $ra, 0x104($sp)
/* 33ECA0 E002A3E0 AFBE0100 */  sw        $fp, 0x100($sp)
/* 33ECA4 E002A3E4 AFB700FC */  sw        $s7, 0xFC($sp)
/* 33ECA8 E002A3E8 AFB600F8 */  sw        $s6, 0xF8($sp)
/* 33ECAC E002A3EC AFB500F4 */  sw        $s5, 0xF4($sp)
/* 33ECB0 E002A3F0 AFB400F0 */  sw        $s4, 0xF0($sp)
/* 33ECB4 E002A3F4 AFB300EC */  sw        $s3, 0xEC($sp)
/* 33ECB8 E002A3F8 AFB100E4 */  sw        $s1, 0xE4($sp)
/* 33ECBC E002A3FC AFB000E0 */  sw        $s0, 0xE0($sp)
/* 33ECC0 E002A400 AFA40108 */  sw        $a0, 0x108($sp)
/* 33ECC4 E002A404 8E490000 */  lw        $t1, 0x0($s2)
/* 33ECC8 E002A408 8C90000C */  lw        $s0, 0xC($a0)
/* 33ECCC E002A40C 0120202D */  daddu     $a0, $t1, $zero
/* 33ECD0 E002A410 AC820000 */  sw        $v0, 0x0($a0)
/* 33ECD4 E002A414 8FAB0108 */  lw        $t3, 0x108($sp)
/* 33ECD8 E002A418 3C050900 */  lui       $a1, %hi(D_09000D68_40DFF8)
/* 33ECDC E002A41C 24A50D68 */  addiu     $a1, $a1, %lo(D_09000D68_40DFF8)
/* 33ECE0 E002A420 8D620010 */  lw        $v0, 0x10($t3)
/* 33ECE4 E002A424 25290008 */  addiu     $t1, $t1, 0x8
/* 33ECE8 E002A428 AE490000 */  sw        $t1, 0x0($s2)
/* 33ECEC E002A42C 8C42001C */  lw        $v0, 0x1C($v0)
/* 33ECF0 E002A430 3C038000 */  lui       $v1, (0x80000000 >> 16)
/* 33ECF4 E002A434 00431021 */  addu      $v0, $v0, $v1
/* 33ECF8 E002A438 AC820004 */  sw        $v0, 0x4($a0)
/* 33ECFC E002A43C 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 33ED00 E002A440 AD220000 */  sw        $v0, 0x0($t1)
/* 33ED04 E002A444 8E020000 */  lw        $v0, 0x0($s0)
/* 33ED08 E002A448 252A0008 */  addiu     $t2, $t1, 0x8
/* 33ED0C E002A44C 14400003 */  bnez      $v0, .LE002A45C
/* 33ED10 E002A450 AE4A0000 */   sw       $t2, 0x0($s2)
/* 33ED14 E002A454 3C050900 */  lui       $a1, %hi(D_09000CC0_415D20)
/* 33ED18 E002A458 24A50CC0 */  addiu     $a1, $a1, %lo(D_09000CC0_415D20)
.LE002A45C:
/* 33ED1C E002A45C 25280010 */  addiu     $t0, $t1, 0x10
/* 33ED20 E002A460 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 33ED24 E002A464 AD250004 */  sw        $a1, 0x4($t1)
/* 33ED28 E002A468 AE480000 */  sw        $t0, 0x0($s2)
/* 33ED2C E002A46C AD220008 */  sw        $v0, 0x8($t1)
/* 33ED30 E002A470 92020033 */  lbu       $v0, 0x33($s0)
/* 33ED34 E002A474 92050037 */  lbu       $a1, 0x37($s0)
/* 33ED38 E002A478 9206003B */  lbu       $a2, 0x3B($s0)
/* 33ED3C E002A47C 9207001B */  lbu       $a3, 0x1B($s0)
/* 33ED40 E002A480 25230018 */  addiu     $v1, $t1, 0x18
/* 33ED44 E002A484 AE430000 */  sw        $v1, 0x0($s2)
/* 33ED48 E002A488 00021600 */  sll       $v0, $v0, 24
/* 33ED4C E002A48C 00052C00 */  sll       $a1, $a1, 16
/* 33ED50 E002A490 00451025 */  or        $v0, $v0, $a1
/* 33ED54 E002A494 00063200 */  sll       $a2, $a2, 8
/* 33ED58 E002A498 00461025 */  or        $v0, $v0, $a2
/* 33ED5C E002A49C 00471025 */  or        $v0, $v0, $a3
/* 33ED60 E002A4A0 AD420004 */  sw        $v0, 0x4($t2)
/* 33ED64 E002A4A4 3C02FB00 */  lui       $v0, (0xFB000000 >> 16)
/* 33ED68 E002A4A8 AD220010 */  sw        $v0, 0x10($t1)
/* 33ED6C E002A4AC 9202003F */  lbu       $v0, 0x3F($s0)
/* 33ED70 E002A4B0 92050043 */  lbu       $a1, 0x43($s0)
/* 33ED74 E002A4B4 92030047 */  lbu       $v1, 0x47($s0)
/* 33ED78 E002A4B8 00021600 */  sll       $v0, $v0, 24
/* 33ED7C E002A4BC 00052C00 */  sll       $a1, $a1, 16
/* 33ED80 E002A4C0 00451025 */  or        $v0, $v0, $a1
/* 33ED84 E002A4C4 00031A00 */  sll       $v1, $v1, 8
/* 33ED88 E002A4C8 00431025 */  or        $v0, $v0, $v1
/* 33ED8C E002A4CC AD020004 */  sw        $v0, 0x4($t0)
/* 33ED90 E002A4D0 8E050004 */  lw        $a1, 0x4($s0)
/* 33ED94 E002A4D4 8E060008 */  lw        $a2, 0x8($s0)
/* 33ED98 E002A4D8 8E07000C */  lw        $a3, 0xC($s0)
/* 33ED9C E002A4DC 0C080108 */  jal       shim_guTranslateF
/* 33EDA0 E002A4E0 27A40018 */   addiu    $a0, $sp, 0x18
/* 33EDA4 E002A4E4 27B10058 */  addiu     $s1, $sp, 0x58
/* 33EDA8 E002A4E8 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 33EDAC E002A4EC 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 33EDB0 E002A4F0 44800000 */  mtc1      $zero, $f0
/* 33EDB4 E002A4F4 00031080 */  sll       $v0, $v1, 2
/* 33EDB8 E002A4F8 00431021 */  addu      $v0, $v0, $v1
/* 33EDBC E002A4FC 00021080 */  sll       $v0, $v0, 2
/* 33EDC0 E002A500 00431023 */  subu      $v0, $v0, $v1
/* 33EDC4 E002A504 000218C0 */  sll       $v1, $v0, 3
/* 33EDC8 E002A508 00431021 */  addu      $v0, $v0, $v1
/* 33EDCC E002A50C 000210C0 */  sll       $v0, $v0, 3
/* 33EDD0 E002A510 44060000 */  mfc1      $a2, $f0
/* 33EDD4 E002A514 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 33EDD8 E002A518 00220821 */  addu      $at, $at, $v0
/* 33EDDC E002A51C C4201DEC */  lwc1      $f0, %lo(gCameras + 0x6C)($at)
/* 33EDE0 E002A520 3C073F80 */  lui       $a3, (0x3F800000 >> 16)
/* 33EDE4 E002A524 46000007 */  neg.s     $f0, $f0
/* 33EDE8 E002A528 44050000 */  mfc1      $a1, $f0
/* 33EDEC E002A52C 0220202D */  daddu     $a0, $s1, $zero
/* 33EDF0 E002A530 0C080104 */  jal       shim_guRotateF
/* 33EDF4 E002A534 AFA60010 */   sw       $a2, 0x10($sp)
/* 33EDF8 E002A538 0220202D */  daddu     $a0, $s1, $zero
/* 33EDFC E002A53C 27A50018 */  addiu     $a1, $sp, 0x18
/* 33EE00 E002A540 0C080114 */  jal       shim_guMtxCatF
/* 33EE04 E002A544 27A60098 */   addiu    $a2, $sp, 0x98
/* 33EE08 E002A548 8E0B0000 */  lw        $t3, 0x0($s0)
/* 33EE0C E002A54C AFAB00D8 */  sw        $t3, 0xD8($sp)
/* 33EE10 E002A550 8FAB0108 */  lw        $t3, 0x108($sp)
/* 33EE14 E002A554 24130001 */  addiu     $s3, $zero, 0x1
/* 33EE18 E002A558 8D620008 */  lw        $v0, 0x8($t3)
/* 33EE1C E002A55C 0262102A */  slt       $v0, $s3, $v0
/* 33EE20 E002A560 10400061 */  beqz      $v0, .LE002A6E8
/* 33EE24 E002A564 26100048 */   addiu    $s0, $s0, 0x48
/* 33EE28 E002A568 3C17800A */  lui       $s7, %hi(gDisplayContext)
/* 33EE2C E002A56C 26F7A674 */  addiu     $s7, $s7, %lo(gDisplayContext)
/* 33EE30 E002A570 3C148007 */  lui       $s4, %hi(gMatrixListPos)
/* 33EE34 E002A574 269441F0 */  addiu     $s4, $s4, %lo(gMatrixListPos)
/* 33EE38 E002A578 3C150001 */  lui       $s5, (0x11630 >> 16)
/* 33EE3C E002A57C 36B51630 */  ori       $s5, $s5, (0x11630 & 0xFFFF)
/* 33EE40 E002A580 0220B02D */  daddu     $s6, $s1, $zero
/* 33EE44 E002A584 3C1EDE00 */  lui       $fp, (0xDE000000 >> 16)
/* 33EE48 E002A588 2611000C */  addiu     $s1, $s0, 0xC
.LE002A58C:
/* 33EE4C E002A58C 27A40018 */  addiu     $a0, $sp, 0x18
/* 33EE50 E002A590 8E250014 */  lw        $a1, 0x14($s1)
/* 33EE54 E002A594 8E260010 */  lw        $a2, 0x10($s1)
/* 33EE58 E002A598 96820000 */  lhu       $v0, 0x0($s4)
/* 33EE5C E002A59C 00A0382D */  daddu     $a3, $a1, $zero
/* 33EE60 E002A5A0 24430001 */  addiu     $v1, $v0, 0x1
/* 33EE64 E002A5A4 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 33EE68 E002A5A8 00021180 */  sll       $v0, $v0, 6
/* 33EE6C E002A5AC A6830000 */  sh        $v1, 0x0($s4)
/* 33EE70 E002A5B0 8EF00000 */  lw        $s0, 0x0($s7)
/* 33EE74 E002A5B4 00551021 */  addu      $v0, $v0, $s5
/* 33EE78 E002A5B8 0C080110 */  jal       shim_guScaleF
/* 33EE7C E002A5BC 02028021 */   addu     $s0, $s0, $v0
/* 33EE80 E002A5C0 27A40018 */  addiu     $a0, $sp, 0x18
/* 33EE84 E002A5C4 0C080118 */  jal       shim_guMtxF2L
/* 33EE88 E002A5C8 0200282D */   daddu    $a1, $s0, $zero
/* 33EE8C E002A5CC 8E25FFF8 */  lw        $a1, -0x8($s1)
/* 33EE90 E002A5D0 8E26FFFC */  lw        $a2, -0x4($s1)
/* 33EE94 E002A5D4 8E270000 */  lw        $a3, 0x0($s1)
/* 33EE98 E002A5D8 0C080108 */  jal       shim_guTranslateF
/* 33EE9C E002A5DC 02C0202D */   daddu    $a0, $s6, $zero
/* 33EEA0 E002A5E0 02C0202D */  daddu     $a0, $s6, $zero
/* 33EEA4 E002A5E4 27A50098 */  addiu     $a1, $sp, 0x98
/* 33EEA8 E002A5E8 0C080114 */  jal       shim_guMtxCatF
/* 33EEAC E002A5EC 27A60018 */   addiu    $a2, $sp, 0x18
/* 33EEB0 E002A5F0 27A40018 */  addiu     $a0, $sp, 0x18
/* 33EEB4 E002A5F4 96850000 */  lhu       $a1, 0x0($s4)
/* 33EEB8 E002A5F8 8EE20000 */  lw        $v0, 0x0($s7)
/* 33EEBC E002A5FC 00052980 */  sll       $a1, $a1, 6
/* 33EEC0 E002A600 00B52821 */  addu      $a1, $a1, $s5
/* 33EEC4 E002A604 0C080118 */  jal       shim_guMtxF2L
/* 33EEC8 E002A608 00452821 */   addu     $a1, $v0, $a1
/* 33EECC E002A60C 3C05DA38 */  lui       $a1, (0xDA380001 >> 16)
/* 33EED0 E002A610 8E460000 */  lw        $a2, 0x0($s2)
/* 33EED4 E002A614 34A50001 */  ori       $a1, $a1, (0xDA380001 & 0xFFFF)
/* 33EED8 E002A618 00C0202D */  daddu     $a0, $a2, $zero
/* 33EEDC E002A61C 24C60008 */  addiu     $a2, $a2, 0x8
/* 33EEE0 E002A620 AE460000 */  sw        $a2, 0x0($s2)
/* 33EEE4 E002A624 96820000 */  lhu       $v0, 0x0($s4)
/* 33EEE8 E002A628 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 33EEEC E002A62C AC830000 */  sw        $v1, 0x0($a0)
/* 33EEF0 E002A630 24430001 */  addiu     $v1, $v0, 0x1
/* 33EEF4 E002A634 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 33EEF8 E002A638 00021180 */  sll       $v0, $v0, 6
/* 33EEFC E002A63C A6830000 */  sh        $v1, 0x0($s4)
/* 33EF00 E002A640 8EE30000 */  lw        $v1, 0x0($s7)
/* 33EF04 E002A644 00551021 */  addu      $v0, $v0, $s5
/* 33EF08 E002A648 00621821 */  addu      $v1, $v1, $v0
/* 33EF0C E002A64C 24C20008 */  addiu     $v0, $a2, 0x8
/* 33EF10 E002A650 AC830004 */  sw        $v1, 0x4($a0)
/* 33EF14 E002A654 AE420000 */  sw        $v0, 0x0($s2)
/* 33EF18 E002A658 ACC50000 */  sw        $a1, 0x0($a2)
/* 33EF1C E002A65C ACD00004 */  sw        $s0, 0x4($a2)
/* 33EF20 E002A660 8FAB00D8 */  lw        $t3, 0xD8($sp)
/* 33EF24 E002A664 29620002 */  slti      $v0, $t3, 0x2
/* 33EF28 E002A668 1040000B */  beqz      $v0, .LE002A698
/* 33EF2C E002A66C 24C20010 */   addiu    $v0, $a2, 0x10
/* 33EF30 E002A670 3C030900 */  lui       $v1, %hi(D_09000E38_40E0C8)
/* 33EF34 E002A674 24630E38 */  addiu     $v1, $v1, %lo(D_09000E38_40E0C8)
/* 33EF38 E002A678 AE420000 */  sw        $v0, 0x0($s2)
/* 33EF3C E002A67C 32620001 */  andi      $v0, $s3, 0x1
/* 33EF40 E002A680 10400003 */  beqz      $v0, .LE002A690
/* 33EF44 E002A684 ACDE0008 */   sw       $fp, 0x8($a2)
/* 33EF48 E002A688 3C030900 */  lui       $v1, %hi(D_09000E18_40E0A8)
/* 33EF4C E002A68C 24630E18 */  addiu     $v1, $v1, %lo(D_09000E18_40E0A8)
.LE002A690:
/* 33EF50 E002A690 0800A9AB */  j         .LE002A6AC
/* 33EF54 E002A694 ACC3000C */   sw       $v1, 0xC($a2)
.LE002A698:
/* 33EF58 E002A698 AE420000 */  sw        $v0, 0x0($s2)
/* 33EF5C E002A69C 3C020900 */  lui       $v0, %hi(D_09000E58_40E0E8)
/* 33EF60 E002A6A0 24420E58 */  addiu     $v0, $v0, %lo(D_09000E58_40E0E8)
/* 33EF64 E002A6A4 ACDE0008 */  sw        $fp, 0x8($a2)
/* 33EF68 E002A6A8 ACC2000C */  sw        $v0, 0xC($a2)
.LE002A6AC:
/* 33EF6C E002A6AC 3C02D838 */  lui       $v0, (0xD8380002 >> 16)
/* 33EF70 E002A6B0 34420002 */  ori       $v0, $v0, (0xD8380002 & 0xFFFF)
/* 33EF74 E002A6B4 8E440000 */  lw        $a0, 0x0($s2)
/* 33EF78 E002A6B8 26730001 */  addiu     $s3, $s3, 0x1
/* 33EF7C E002A6BC 0080182D */  daddu     $v1, $a0, $zero
/* 33EF80 E002A6C0 AC620000 */  sw        $v0, 0x0($v1)
/* 33EF84 E002A6C4 24020040 */  addiu     $v0, $zero, 0x40
/* 33EF88 E002A6C8 AC620004 */  sw        $v0, 0x4($v1)
/* 33EF8C E002A6CC 8FAB0108 */  lw        $t3, 0x108($sp)
/* 33EF90 E002A6D0 26310048 */  addiu     $s1, $s1, 0x48
/* 33EF94 E002A6D4 8D620008 */  lw        $v0, 0x8($t3)
/* 33EF98 E002A6D8 24840008 */  addiu     $a0, $a0, 0x8
/* 33EF9C E002A6DC 0262102A */  slt       $v0, $s3, $v0
/* 33EFA0 E002A6E0 1440FFAA */  bnez      $v0, .LE002A58C
/* 33EFA4 E002A6E4 AE440000 */   sw       $a0, 0x0($s2)
.LE002A6E8:
/* 33EFA8 E002A6E8 8FBF0104 */  lw        $ra, 0x104($sp)
/* 33EFAC E002A6EC 8FBE0100 */  lw        $fp, 0x100($sp)
/* 33EFB0 E002A6F0 8FB700FC */  lw        $s7, 0xFC($sp)
/* 33EFB4 E002A6F4 8FB600F8 */  lw        $s6, 0xF8($sp)
/* 33EFB8 E002A6F8 8FB500F4 */  lw        $s5, 0xF4($sp)
/* 33EFBC E002A6FC 8FB400F0 */  lw        $s4, 0xF0($sp)
/* 33EFC0 E002A700 8FB300EC */  lw        $s3, 0xEC($sp)
/* 33EFC4 E002A704 8FB200E8 */  lw        $s2, 0xE8($sp)
/* 33EFC8 E002A708 8FB100E4 */  lw        $s1, 0xE4($sp)
/* 33EFCC E002A70C 8FB000E0 */  lw        $s0, 0xE0($sp)
/* 33EFD0 E002A710 03E00008 */  jr        $ra
/* 33EFD4 E002A714 27BD0108 */   addiu    $sp, $sp, 0x108
/* 33EFD8 E002A718 00000000 */  nop
/* 33EFDC E002A71C 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void dust_appendGfx(void* effect) {
    DustFXData* part = ((EffectInstance*)effect)->data.dust;
    s32 unk_00;
    Matrix4f sp18;
    Matrix4f sp58;
    Matrix4f sp98;
    Mtx* matrix;
    s32 i;

    gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
    gSPDisplayList(gMainGfxPos++, part->unk_00 == 0 ? D_09000CC0_33FCC0 : D_09000D68_33FD68);
    gDPSetPrimColor(gMainGfxPos++, 0, 0, part->unk_30, part->unk_34, part->unk_38, part->unk_18);
    gDPSetEnvColor(gMainGfxPos++, part->unk_3C, part->unk_40, part->unk_44, 0);

    shim_guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C);
    shim_guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f);
    shim_guMtxCatF(sp58, sp18, sp98);

    unk_00 = part->unk_00;
    part++;
    for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) {
        matrix = &gDisplayContext->matrixStack[gMatrixListPos++];

        shim_guScaleF(sp18, part->unk_20, part->unk_1C, part->unk_20);
        shim_guMtxF2L(sp18, matrix);
        shim_guTranslateF(sp58, part->unk_04, part->unk_08, part->unk_0C);
        shim_guMtxCatF(sp58, sp98, sp18);
        shim_guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);

        gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
        gSPMatrix(gMainGfxPos++, matrix, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);

        if (unk_00 < 2) {
            gSPDisplayList(gMainGfxPos++, (i % 2) ? D_09000E18_33FE18 : D_09000E38_33FE38);
        } else {
            gSPDisplayList(gMainGfxPos++, D_09000E58_33FE58);
        }

        gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel static_status_update
/* 3E0AB4 E00E6184 27BDFFA0 */  addiu     $sp, $sp, -0x60
/* 3E0AB8 E00E6188 AFB20018 */  sw        $s2, 0x18($sp)
/* 3E0ABC E00E618C 0080902D */  daddu     $s2, $a0, $zero
/* 3E0AC0 E00E6190 AFBF0030 */  sw        $ra, 0x30($sp)
/* 3E0AC4 E00E6194 AFB7002C */  sw        $s7, 0x2C($sp)
/* 3E0AC8 E00E6198 AFB60028 */  sw        $s6, 0x28($sp)
/* 3E0ACC E00E619C AFB50024 */  sw        $s5, 0x24($sp)
/* 3E0AD0 E00E61A0 AFB40020 */  sw        $s4, 0x20($sp)
/* 3E0AD4 E00E61A4 AFB3001C */  sw        $s3, 0x1C($sp)
/* 3E0AD8 E00E61A8 AFB10014 */  sw        $s1, 0x14($sp)
/* 3E0ADC E00E61AC AFB00010 */  sw        $s0, 0x10($sp)
/* 3E0AE0 E00E61B0 F7BC0058 */  sdc1      $f28, 0x58($sp)
/* 3E0AE4 E00E61B4 F7BA0050 */  sdc1      $f26, 0x50($sp)
/* 3E0AE8 E00E61B8 F7B80048 */  sdc1      $f24, 0x48($sp)
/* 3E0AEC E00E61BC F7B60040 */  sdc1      $f22, 0x40($sp)
/* 3E0AF0 E00E61C0 F7B40038 */  sdc1      $f20, 0x38($sp)
/* 3E0AF4 E00E61C4 8E430000 */  lw        $v1, 0x0($s2)
/* 3E0AF8 E00E61C8 8E45000C */  lw        $a1, 0xC($s2)
/* 3E0AFC E00E61CC 30620010 */  andi      $v0, $v1, 0x10
/* 3E0B00 E00E61D0 8CB30000 */  lw        $s3, 0x0($a1)
/* 3E0B04 E00E61D4 10400005 */  beqz      $v0, .LE00E61EC
/* 3E0B08 E00E61D8 2402FFEF */   addiu    $v0, $zero, -0x11
/* 3E0B0C E00E61DC 00621024 */  and       $v0, $v1, $v0
/* 3E0B10 E00E61E0 AE420000 */  sw        $v0, 0x0($s2)
/* 3E0B14 E00E61E4 24020010 */  addiu     $v0, $zero, 0x10
/* 3E0B18 E00E61E8 ACA20028 */  sw        $v0, 0x28($a1)
.LE00E61EC:
/* 3E0B1C E00E61EC 8CA30028 */  lw        $v1, 0x28($a1)
/* 3E0B20 E00E61F0 286203E8 */  slti      $v0, $v1, 0x3E8
/* 3E0B24 E00E61F4 10400002 */  beqz      $v0, .LE00E6200
/* 3E0B28 E00E61F8 2462FFFF */   addiu    $v0, $v1, -0x1
/* 3E0B2C E00E61FC ACA20028 */  sw        $v0, 0x28($a1)
.LE00E6200:
/* 3E0B30 E00E6200 8CA2002C */  lw        $v0, 0x2C($a1)
/* 3E0B34 E00E6204 8CA40028 */  lw        $a0, 0x28($a1)
/* 3E0B38 E00E6208 24420001 */  addiu     $v0, $v0, 0x1
/* 3E0B3C E00E620C 04810005 */  bgez      $a0, .LE00E6224
/* 3E0B40 E00E6210 ACA2002C */   sw       $v0, 0x2C($a1)
/* 3E0B44 E00E6214 0C080128 */  jal       shim_remove_effect
/* 3E0B48 E00E6218 0240202D */   daddu    $a0, $s2, $zero
/* 3E0B4C E00E621C 08039925 */  j         .LE00E6494
/* 3E0B50 E00E6220 00000000 */   nop
.LE00E6224:
/* 3E0B54 E00E6224 0040A82D */  daddu     $s5, $v0, $zero
/* 3E0B58 E00E6228 28820010 */  slti      $v0, $a0, 0x10
/* 3E0B5C E00E622C 10400002 */  beqz      $v0, .LE00E6238
/* 3E0B60 E00E6230 00041100 */   sll      $v0, $a0, 4
/* 3E0B64 E00E6234 ACA20030 */  sw        $v0, 0x30($a1)
.LE00E6238:
/* 3E0B68 E00E6238 16600009 */  bnez      $s3, .LE00E6260
/* 3E0B6C E00E623C 24A50038 */   addiu    $a1, $a1, 0x38
/* 3E0B70 E00E6240 3C013DCC */  lui       $at, (0x3DCCCCCD >> 16)
/* 3E0B74 E00E6244 3421CCCD */  ori       $at, $at, (0x3DCCCCCD & 0xFFFF)
/* 3E0B78 E00E6248 4481C000 */  mtc1      $at, $f24
/* 3E0B7C E00E624C 3C013E4C */  lui       $at, (0x3E4CCCCD >> 16)
/* 3E0B80 E00E6250 3421CCCD */  ori       $at, $at, (0x3E4CCCCD & 0xFFFF)
/* 3E0B84 E00E6254 4481B000 */  mtc1      $at, $f22
/* 3E0B88 E00E6258 0803989D */  j         .LE00E6274
/* 3E0B8C E00E625C 00000000 */   nop
.LE00E6260:
/* 3E0B90 E00E6260 3C013E4C */  lui       $at, (0x3E4CCCCD >> 16)
/* 3E0B94 E00E6264 3421CCCD */  ori       $at, $at, (0x3E4CCCCD & 0xFFFF)
/* 3E0B98 E00E6268 4481B000 */  mtc1      $at, $f22
/* 3E0B9C E00E626C 00000000 */  nop
/* 3E0BA0 E00E6270 4600B606 */  mov.s     $f24, $f22
.LE00E6274:
/* 3E0BA4 E00E6274 8E420008 */  lw        $v0, 0x8($s2)
/* 3E0BA8 E00E6278 24110001 */  addiu     $s1, $zero, 0x1
/* 3E0BAC E00E627C 0222102A */  slt       $v0, $s1, $v0
/* 3E0BB0 E00E6280 10400084 */  beqz      $v0, .LE00E6494
/* 3E0BB4 E00E6284 00131080 */   sll      $v0, $s3, 2
/* 3E0BB8 E00E6288 3C03E00E */  lui       $v1, %hi(D_E00E6890)
/* 3E0BBC E00E628C 24636890 */  addiu     $v1, $v1, %lo(D_E00E6890)
/* 3E0BC0 E00E6290 0043A021 */  addu      $s4, $v0, $v1
/* 3E0BC4 E00E6294 3C17E00E */  lui       $s7, %hi(D_E00E6898)
/* 3E0BC8 E00E6298 26F76898 */  addiu     $s7, $s7, %lo(D_E00E6898)
/* 3E0BCC E00E629C 3C16E00E */  lui       $s6, %hi(D_E00E6910)
/* 3E0BD0 E00E62A0 26D66910 */  addiu     $s6, $s6, %lo(D_E00E6910)
/* 3E0BD4 E00E62A4 24B00014 */  addiu     $s0, $a1, 0x14
/* 3E0BD8 E00E62A8 3C014180 */  lui       $at, (0x41800000 >> 16)
/* 3E0BDC E00E62AC 4481E000 */  mtc1      $at, $f28
/* 3E0BE0 E00E62B0 3C01E00E */  lui       $at, (0xE00E6990 >> 16)
/* 3E0BE4 E00E62B4 D43A6990 */  ldc1      $f26, (0xE00E6990 & 0xFFFF)($at)
.LE00E62B8:
/* 3E0BE8 E00E62B8 8E02000C */  lw        $v0, 0xC($s0)
/* 3E0BEC E00E62BC 24420001 */  addiu     $v0, $v0, 0x1
/* 3E0BF0 E00E62C0 AE02000C */  sw        $v0, 0xC($s0)
/* 3E0BF4 E00E62C4 8E830000 */  lw        $v1, 0x0($s4)
/* 3E0BF8 E00E62C8 0043102A */  slt       $v0, $v0, $v1
/* 3E0BFC E00E62CC 50400001 */  beql      $v0, $zero, .LE00E62D4
/* 3E0C00 E00E62D0 AE00000C */   sw       $zero, 0xC($s0)
.LE00E62D4:
/* 3E0C04 E00E62D4 8E02000C */  lw        $v0, 0xC($s0)
/* 3E0C08 E00E62D8 0442006A */  bltzl     $v0, .LE00E6484
/* 3E0C0C E00E62DC 26310001 */   addiu    $s1, $s1, 0x1
/* 3E0C10 E00E62E0 1440002A */  bnez      $v0, .LE00E638C
/* 3E0C14 E00E62E4 00000000 */   nop
/* 3E0C18 E00E62E8 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
/* 3E0C1C E00E62EC 44810000 */  mtc1      $at, $f0
/* 3E0C20 E00E62F0 4491A000 */  mtc1      $s1, $f20
/* 3E0C24 E00E62F4 00000000 */  nop
/* 3E0C28 E00E62F8 4680A520 */  cvt.s.w   $f20, $f20
/* 3E0C2C E00E62FC 4600A502 */  mul.s     $f20, $f20, $f0
/* 3E0C30 E00E6300 00000000 */  nop
/* 3E0C34 E00E6304 8E420008 */  lw        $v0, 0x8($s2)
/* 3E0C38 E00E6308 2442FFFF */  addiu     $v0, $v0, -0x1
/* 3E0C3C E00E630C 44820000 */  mtc1      $v0, $f0
/* 3E0C40 E00E6310 00000000 */  nop
/* 3E0C44 E00E6314 46800020 */  cvt.s.w   $f0, $f0
/* 3E0C48 E00E6318 4600A503 */  div.s     $f20, $f20, $f0
/* 3E0C4C E00E631C 0C080140 */  jal       shim_sin_deg
/* 3E0C50 E00E6320 4600A306 */   mov.s    $f12, $f20
/* 3E0C54 E00E6324 461C0002 */  mul.s     $f0, $f0, $f28
/* 3E0C58 E00E6328 00000000 */  nop
/* 3E0C5C E00E632C 4600A306 */  mov.s     $f12, $f20
/* 3E0C60 E00E6330 0C080144 */  jal       shim_cos_deg
/* 3E0C64 E00E6334 E600FFF0 */   swc1     $f0, -0x10($s0)
/* 3E0C68 E00E6338 461C0002 */  mul.s     $f0, $f0, $f28
/* 3E0C6C E00E633C 00000000 */  nop
/* 3E0C70 E00E6340 C606FFF0 */  lwc1      $f6, -0x10($s0)
/* 3E0C74 E00E6344 46183182 */  mul.s     $f6, $f6, $f24
/* 3E0C78 E00E6348 00000000 */  nop
/* 3E0C7C E00E634C E600FFF4 */  swc1      $f0, -0xC($s0)
/* 3E0C80 E00E6350 46000106 */  mov.s     $f4, $f0
/* 3E0C84 E00E6354 46182102 */  mul.s     $f4, $f4, $f24
/* 3E0C88 E00E6358 00000000 */  nop
/* 3E0C8C E00E635C 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 3E0C90 E00E6360 44811000 */  mtc1      $at, $f2
/* 3E0C94 E00E6364 3C014234 */  lui       $at, (0x42340000 >> 16)
/* 3E0C98 E00E6368 44810000 */  mtc1      $at, $f0
/* 3E0C9C E00E636C 4600A507 */  neg.s     $f20, $f20
/* 3E0CA0 E00E6370 AE000004 */  sw        $zero, 0x4($s0)
/* 3E0CA4 E00E6374 AE000008 */  sw        $zero, 0x8($s0)
/* 3E0CA8 E00E6378 4600A501 */  sub.s     $f20, $f20, $f0
/* 3E0CAC E00E637C E6020020 */  swc1      $f2, 0x20($s0)
/* 3E0CB0 E00E6380 E606FFFC */  swc1      $f6, -0x4($s0)
/* 3E0CB4 E00E6384 E6140010 */  swc1      $f20, 0x10($s0)
/* 3E0CB8 E00E6388 E6040000 */  swc1      $f4, 0x0($s0)
.LE00E638C:
/* 3E0CBC E00E638C 16600008 */  bnez      $s3, .LE00E63B0
/* 3E0CC0 E00E6390 00000000 */   nop
/* 3E0CC4 E00E6394 8E02000C */  lw        $v0, 0xC($s0)
/* 3E0CC8 E00E6398 3C03E00E */  lui       $v1, (0xE00E68F8 >> 16)
/* 3E0CCC E00E639C 00621821 */  addu      $v1, $v1, $v0
/* 3E0CD0 E00E63A0 906368F8 */  lbu       $v1, (0xE00E68F8 & 0xFFFF)($v1)
/* 3E0CD4 E00E63A4 00021080 */  sll       $v0, $v0, 2
/* 3E0CD8 E00E63A8 080398F2 */  j         .LE00E63C8
/* 3E0CDC E00E63AC 00571021 */   addu     $v0, $v0, $s7
.LE00E63B0:
/* 3E0CE0 E00E63B0 8E02000C */  lw        $v0, 0xC($s0)
/* 3E0CE4 E00E63B4 3C03E00E */  lui       $v1, (0xE00E6970 >> 16)
/* 3E0CE8 E00E63B8 00621821 */  addu      $v1, $v1, $v0
/* 3E0CEC E00E63BC 90636970 */  lbu       $v1, (0xE00E6970 & 0xFFFF)($v1)
/* 3E0CF0 E00E63C0 00021080 */  sll       $v0, $v0, 2
/* 3E0CF4 E00E63C4 00561021 */  addu      $v0, $v0, $s6
.LE00E63C8:
/* 3E0CF8 E00E63C8 AE03001C */  sw        $v1, 0x1C($s0)
/* 3E0CFC E00E63CC C4400000 */  lwc1      $f0, 0x0($v0)
/* 3E0D00 E00E63D0 32A30001 */  andi      $v1, $s5, 0x1
/* 3E0D04 E00E63D4 32220001 */  andi      $v0, $s1, 0x1
/* 3E0D08 E00E63D8 14620009 */  bne       $v1, $v0, .LE00E6400
/* 3E0D0C E00E63DC E6000020 */   swc1     $f0, 0x20($s0)
/* 3E0D10 E00E63E0 C604FFF0 */  lwc1      $f4, -0x10($s0)
/* 3E0D14 E00E63E4 C600FFFC */  lwc1      $f0, -0x4($s0)
/* 3E0D18 E00E63E8 C602FFF4 */  lwc1      $f2, -0xC($s0)
/* 3E0D1C E00E63EC 46002100 */  add.s     $f4, $f4, $f0
/* 3E0D20 E00E63F0 C6000000 */  lwc1      $f0, 0x0($s0)
/* 3E0D24 E00E63F4 46001080 */  add.s     $f2, $f2, $f0
/* 3E0D28 E00E63F8 08039911 */  j         .LE00E6444
/* 3E0D2C E00E63FC E604FFF0 */   swc1     $f4, -0x10($s0)
.LE00E6400:
/* 3E0D30 E00E6400 C606FFFC */  lwc1      $f6, -0x4($s0)
/* 3E0D34 E00E6404 460031A1 */  cvt.d.s   $f6, $f6
/* 3E0D38 E00E6408 463A3182 */  mul.d     $f6, $f6, $f26
/* 3E0D3C E00E640C 00000000 */  nop
/* 3E0D40 E00E6410 C6040000 */  lwc1      $f4, 0x0($s0)
/* 3E0D44 E00E6414 46002121 */  cvt.d.s   $f4, $f4
/* 3E0D48 E00E6418 463A2102 */  mul.d     $f4, $f4, $f26
/* 3E0D4C E00E641C 00000000 */  nop
/* 3E0D50 E00E6420 C600FFF0 */  lwc1      $f0, -0x10($s0)
/* 3E0D54 E00E6424 C602FFF4 */  lwc1      $f2, -0xC($s0)
/* 3E0D58 E00E6428 46000021 */  cvt.d.s   $f0, $f0
/* 3E0D5C E00E642C 46260000 */  add.d     $f0, $f0, $f6
/* 3E0D60 E00E6430 460010A1 */  cvt.d.s   $f2, $f2
/* 3E0D64 E00E6434 46241080 */  add.d     $f2, $f2, $f4
/* 3E0D68 E00E6438 46200020 */  cvt.s.d   $f0, $f0
/* 3E0D6C E00E643C 462010A0 */  cvt.s.d   $f2, $f2
/* 3E0D70 E00E6440 E600FFF0 */  swc1      $f0, -0x10($s0)
.LE00E6444:
/* 3E0D74 E00E6444 E602FFF4 */  swc1      $f2, -0xC($s0)
/* 3E0D78 E00E6448 C6040004 */  lwc1      $f4, 0x4($s0)
/* 3E0D7C E00E644C C606FFFC */  lwc1      $f6, -0x4($s0)
/* 3E0D80 E00E6450 46062101 */  sub.s     $f4, $f4, $f6
/* 3E0D84 E00E6454 46162102 */  mul.s     $f4, $f4, $f22
/* 3E0D88 E00E6458 00000000 */  nop
/* 3E0D8C E00E645C C6000008 */  lwc1      $f0, 0x8($s0)
/* 3E0D90 E00E6460 C6020000 */  lwc1      $f2, 0x0($s0)
/* 3E0D94 E00E6464 46020001 */  sub.s     $f0, $f0, $f2
/* 3E0D98 E00E6468 46160002 */  mul.s     $f0, $f0, $f22
/* 3E0D9C E00E646C 00000000 */  nop
/* 3E0DA0 E00E6470 46043180 */  add.s     $f6, $f6, $f4
/* 3E0DA4 E00E6474 46001080 */  add.s     $f2, $f2, $f0
/* 3E0DA8 E00E6478 E606FFFC */  swc1      $f6, -0x4($s0)
/* 3E0DAC E00E647C E6020000 */  swc1      $f2, 0x0($s0)
/* 3E0DB0 E00E6480 26310001 */  addiu     $s1, $s1, 0x1
.LE00E6484:
/* 3E0DB4 E00E6484 8E420008 */  lw        $v0, 0x8($s2)
/* 3E0DB8 E00E6488 0222102A */  slt       $v0, $s1, $v0
/* 3E0DBC E00E648C 1440FF8A */  bnez      $v0, .LE00E62B8
/* 3E0DC0 E00E6490 26100038 */   addiu    $s0, $s0, 0x38
.LE00E6494:
/* 3E0DC4 E00E6494 8FBF0030 */  lw        $ra, 0x30($sp)
/* 3E0DC8 E00E6498 8FB7002C */  lw        $s7, 0x2C($sp)
/* 3E0DCC E00E649C 8FB60028 */  lw        $s6, 0x28($sp)
/* 3E0DD0 E00E64A0 8FB50024 */  lw        $s5, 0x24($sp)
/* 3E0DD4 E00E64A4 8FB40020 */  lw        $s4, 0x20($sp)
/* 3E0DD8 E00E64A8 8FB3001C */  lw        $s3, 0x1C($sp)
/* 3E0DDC E00E64AC 8FB20018 */  lw        $s2, 0x18($sp)
/* 3E0DE0 E00E64B0 8FB10014 */  lw        $s1, 0x14($sp)
/* 3E0DE4 E00E64B4 8FB00010 */  lw        $s0, 0x10($sp)
/* 3E0DE8 E00E64B8 D7BC0058 */  ldc1      $f28, 0x58($sp)
/* 3E0DEC E00E64BC D7BA0050 */  ldc1      $f26, 0x50($sp)
/* 3E0DF0 E00E64C0 D7B80048 */  ldc1      $f24, 0x48($sp)
/* 3E0DF4 E00E64C4 D7B60040 */  ldc1      $f22, 0x40($sp)
/* 3E0DF8 E00E64C8 D7B40038 */  ldc1      $f20, 0x38($sp)
/* 3E0DFC E00E64CC 03E00008 */  jr        $ra
/* 3E0E00 E00E64D0 27BD0060 */   addiu    $sp, $sp, 0x60

### DECOMPILED C INSTRUCTIONS:

void static_status_update(EffectInstance* effect) {
    StaticStatusFXData* part = effect->data.staticStatus;
    s32 type = part->type;
    s32 unk_28;
    s32 time;
    f32 interpAmt;
    f32 initialAmt;
    f32 angle;
    s32 i;

    if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
        effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
        part->timeLeft = 16;
    }

    if (part->timeLeft < 1000) {
        part->timeLeft--;
    }

    part->lifetime++;

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

    time = part->lifetime;

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

    if (type == 0) {
        initialAmt = 0.1f;
        interpAmt = 0.2f;
    } else {
        initialAmt = 0.2f;
        interpAmt = 0.2f;
    }

    part++;
    for (i = 1; i < effect->numParts; i++, part++) {
        part->frame++;
        if (part->frame >= StaticEffectFrameCount[type]) {
            part->frame = 0;
        }

        if (part->frame >= 0) {
            if (part->frame == 0) {
                angle = (i * 360.0f) / (effect->numParts - 1);
                part->pos.x = shim_sin_deg(angle) * 16.0f;
                part->pos.y = shim_cos_deg(angle) * 16.0f;
                part->unk_10 = part->pos.x * initialAmt;
                part->unk_14 = part->pos.y * initialAmt;
                part->unk_18 = 0.0f;
                part->unk_1C = 0.0f;
                part->scale = 1.0f;
                part->rotation = -angle - 45.0f;
            }

            if (type == 0) {
                part->alpha = StaticEffectAlphaVals0[part->frame];
                part->scale = StaticEffectScaleVals0[part->frame];
            } else {
                part->alpha = StaticEffectAlphaVals1[part->frame];
                part->scale = StaticEffectScaleVals1[part->frame];
            }

            if ((time & 1) == (i & 1)) {
                part->pos.x += part->unk_10;
                part->pos.y += part->unk_14;
            } else {
                part->pos.x += part->unk_10 * 0.2;
                part->pos.y += part->unk_14 * 0.2;
            }

            part->unk_10 += (part->unk_18 - part->unk_10) * interpAmt;
            part->unk_14 += (part->unk_1C - part->unk_14) * interpAmt;
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel state_step_language_select
/* 105C8 800351C8 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 105CC 800351CC AFB10014 */  sw        $s1, 0x14($sp)
/* 105D0 800351D0 3C11800A */  lui       $s1, %hi(D_800A0931)
/* 105D4 800351D4 26310931 */  addiu     $s1, $s1, %lo(D_800A0931)
/* 105D8 800351D8 AFBF0020 */  sw        $ra, 0x20($sp)
/* 105DC 800351DC AFB3001C */  sw        $s3, 0x1C($sp)
/* 105E0 800351E0 AFB20018 */  sw        $s2, 0x18($sp)
/* 105E4 800351E4 AFB00010 */  sw        $s0, 0x10($sp)
/* 105E8 800351E8 82230000 */  lb        $v1, 0x0($s1)
/* 105EC 800351EC 24120001 */  addiu     $s2, $zero, 0x1
/* 105F0 800351F0 10720030 */  beq       $v1, $s2, .L800352B4
/* 105F4 800351F4 28620002 */   slti     $v0, $v1, 0x2
/* 105F8 800351F8 10400005 */  beqz      $v0, .L80035210
/* 105FC 800351FC 24130002 */   addiu    $s3, $zero, 0x2
/* 10600 80035200 10600009 */  beqz      $v1, .L80035228
/* 10604 80035204 00000000 */   nop
/* 10608 80035208 0800D534 */  j         .L800354D0
/* 1060C 8003520C 00000000 */   nop
.L80035210:
/* 10610 80035210 10730033 */  beq       $v1, $s3, .L800352E0
/* 10614 80035214 24020003 */   addiu    $v0, $zero, 0x3
/* 10618 80035218 10620055 */  beq       $v1, $v0, .L80035370
/* 1061C 8003521C 00000000 */   nop
/* 10620 80035220 0800D534 */  j         .L800354D0
/* 10624 80035224 00000000 */   nop
.L80035228:
/* 10628 80035228 0C037DD0 */  jal       update_player
/* 1062C 8003522C 00000000 */   nop
/* 10630 80035230 0C00E64C */  jal       update_npcs
/* 10634 80035234 00000000 */   nop
/* 10638 80035238 0C00F949 */  jal       update_encounters
/* 1063C 8003523C 00000000 */   nop
/* 10640 80035240 0C016754 */  jal       update_effects
/* 10644 80035244 00000000 */   nop
/* 10648 80035248 3C10800A */  lui       $s0, %hi(D_800A0932)
/* 1064C 8003524C 26100932 */  addiu     $s0, $s0, %lo(D_800A0932)
/* 10650 80035250 86020000 */  lh        $v0, 0x0($s0)
/* 10654 80035254 96030000 */  lhu       $v1, 0x0($s0)
/* 10658 80035258 284200FF */  slti      $v0, $v0, 0xFF
/* 1065C 8003525C 10400013 */  beqz      $v0, .L800352AC
/* 10660 80035260 24620014 */   addiu    $v0, $v1, 0x14
/* 10664 80035264 A6020000 */  sh        $v0, 0x0($s0)
/* 10668 80035268 00021400 */  sll       $v0, $v0, 16
/* 1066C 8003526C 00021403 */  sra       $v0, $v0, 16
/* 10670 80035270 28420100 */  slti      $v0, $v0, 0x100
/* 10674 80035274 14400002 */  bnez      $v0, .L80035280
/* 10678 80035278 240200FF */   addiu    $v0, $zero, 0xFF
/* 1067C 8003527C A6020000 */  sh        $v0, 0x0($s0)
.L80035280:
/* 10680 80035280 86020000 */  lh        $v0, 0x0($s0)
/* 10684 80035284 44820000 */  mtc1      $v0, $f0
/* 10688 80035288 00000000 */  nop
/* 1068C 8003528C 46800020 */  cvt.s.w   $f0, $f0
/* 10690 80035290 44050000 */  mfc1      $a1, $f0
/* 10694 80035294 0C04DF62 */  jal       set_screen_overlay_params_front
/* 10698 80035298 0000202D */   daddu    $a0, $zero, $zero
/* 1069C 8003529C 86030000 */  lh        $v1, 0x0($s0)
/* 106A0 800352A0 240200FF */  addiu     $v0, $zero, 0xFF
/* 106A4 800352A4 1462008A */  bne       $v1, $v0, .L800354D0
/* 106A8 800352A8 00000000 */   nop
.L800352AC:
/* 106AC 800352AC 0800D534 */  j         .L800354D0
/* 106B0 800352B0 A2320000 */   sb       $s2, 0x0($s1)
.L800352B4:
/* 106B4 800352B4 24020005 */  addiu     $v0, $zero, 0x5
/* 106B8 800352B8 3C04800A */  lui       $a0, %hi(gOverrideFlags)
/* 106BC 800352BC 2484A650 */  addiu     $a0, $a0, %lo(gOverrideFlags)
/* 106C0 800352C0 3C01800A */  lui       $at, %hi(D_800A0930)
/* 106C4 800352C4 A0220930 */  sb        $v0, %lo(D_800A0930)($at)
/* 106C8 800352C8 8C820000 */  lw        $v0, 0x0($a0)
/* 106CC 800352CC 24030002 */  addiu     $v1, $zero, 0x2
/* 106D0 800352D0 A2230000 */  sb        $v1, 0x0($s1)
/* 106D4 800352D4 34420008 */  ori       $v0, $v0, 0x8
/* 106D8 800352D8 0800D534 */  j         .L800354D0
/* 106DC 800352DC AC820000 */   sw       $v0, 0x0($a0)
.L800352E0:
/* 106E0 800352E0 3C10800A */  lui       $s0, %hi(D_800A0930)
/* 106E4 800352E4 26100930 */  addiu     $s0, $s0, %lo(D_800A0930)
/* 106E8 800352E8 92020000 */  lbu       $v0, 0x0($s0)
/* 106EC 800352EC 2442FFFF */  addiu     $v0, $v0, -0x1
/* 106F0 800352F0 A2020000 */  sb        $v0, 0x0($s0)
/* 106F4 800352F4 00021600 */  sll       $v0, $v0, 24
/* 106F8 800352F8 14400075 */  bnez      $v0, .L800354D0
/* 106FC 800352FC 00000000 */   nop
/* 10700 80035300 3C048007 */  lui       $a0, %hi(fsFrameBuffers)
/* 10704 80035304 24847980 */  addiu     $a0, $a0, %lo(fsFrameBuffers)
/* 10708 80035308 0C017CBC */  jal       nuGfxSetCfb
/* 1070C 8003530C 24050002 */   addiu    $a1, $zero, 0x2
/* 10710 80035310 3C02800A */  lui       $v0, %hi(nuGfxCfb)
/* 10714 80035314 8C42A658 */  lw        $v0, %lo(nuGfxCfb)($v0)
/* 10718 80035318 8C430008 */  lw        $v1, 0x8($v0)
/* 1071C 8003531C 3C02800A */  lui       $v0, %hi(nuGfxCfb_ptr)
/* 10720 80035320 8C42A64C */  lw        $v0, %lo(nuGfxCfb_ptr)($v0)
/* 10724 80035324 14620008 */  bne       $v1, $v0, .L80035348
/* 10728 80035328 24040003 */   addiu    $a0, $zero, 0x3
/* 1072C 8003532C 3C02800A */  lui       $v0, %hi(gOverrideFlags)
/* 10730 80035330 2442A650 */  addiu     $v0, $v0, %lo(gOverrideFlags)
/* 10734 80035334 8C430000 */  lw        $v1, 0x0($v0)
/* 10738 80035338 2404FFF7 */  addiu     $a0, $zero, -0x9
/* 1073C 8003533C 00641824 */  and       $v1, $v1, $a0
/* 10740 80035340 0800D534 */  j         .L800354D0
/* 10744 80035344 AC430000 */   sw       $v1, 0x0($v0)
.L80035348:
/* 10748 80035348 3C02800A */  lui       $v0, %hi(gOverrideFlags)
/* 1074C 8003534C 2442A650 */  addiu     $v0, $v0, %lo(gOverrideFlags)
/* 10750 80035350 8C430000 */  lw        $v1, 0x0($v0)
/* 10754 80035354 34630008 */  ori       $v1, $v1, 0x8
/* 10758 80035358 0C051FB1 */  jal       set_windows_visible
/* 1075C 8003535C AC430000 */   sw       $v1, 0x0($v0)
/* 10760 80035360 24020003 */  addiu     $v0, $zero, 0x3
/* 10764 80035364 A2120000 */  sb        $s2, 0x0($s0)
/* 10768 80035368 0800D534 */  j         .L800354D0
/* 1076C 8003536C A2220000 */   sb       $v0, 0x0($s1)
.L80035370:
/* 10770 80035370 3C10800A */  lui       $s0, %hi(D_800A0930)
/* 10774 80035374 26100930 */  addiu     $s0, $s0, %lo(D_800A0930)
/* 10778 80035378 82020000 */  lb        $v0, 0x0($s0)
/* 1077C 8003537C 92030000 */  lbu       $v1, 0x0($s0)
/* 10780 80035380 04400042 */  bltz      $v0, .L8003548C
/* 10784 80035384 2462FFFF */   addiu    $v0, $v1, -0x1
/* 10788 80035388 A2020000 */  sb        $v0, 0x0($s0)
/* 1078C 8003538C 00021600 */  sll       $v0, $v0, 24
/* 10790 80035390 1440003B */  bnez      $v0, .L80035480
/* 10794 80035394 2402FFFF */   addiu    $v0, $zero, -0x1
/* 10798 80035398 0C05260E */  jal       sfx_stop_env_sounds
/* 1079C 8003539C A2020000 */   sb       $v0, 0x0($s0)
/* 107A0 800353A0 0C00EC6A */  jal       func_8003B1A8
/* 107A4 800353A4 00000000 */   nop
/* 107A8 800353A8 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 107AC 800353AC 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 107B0 800353B0 0C016BA8 */  jal       backup_map_collision_data
/* 107B4 800353B4 A0530070 */   sb       $s3, 0x70($v0)
/* 107B8 800353B8 0C00AB28 */  jal       battle_heap_create
/* 107BC 800353BC 00000000 */   nop
/* 107C0 800353C0 0C05259C */  jal       sfx_clear_env_sounds
/* 107C4 800353C4 0000202D */   daddu    $a0, $zero, $zero
/* 107C8 800353C8 0C0B763E */  jal       spr_init_sprites
/* 107CC 800353CC 0000202D */   daddu    $a0, $zero, $zero
/* 107D0 800353D0 0C045751 */  jal       clear_model_data
/* 107D4 800353D4 00000000 */   nop
/* 107D8 800353D8 0C052010 */  jal       clear_sprite_shading_data
/* 107DC 800353DC 00000000 */   nop
/* 107E0 800353E0 0C05177E */  jal       reset_background_settings
/* 107E4 800353E4 00000000 */   nop
/* 107E8 800353E8 0C0482EC */  jal       clear_entity_models
/* 107EC 800353EC 00000000 */   nop
/* 107F0 800353F0 0C047889 */  jal       clear_animator_list
/* 107F4 800353F4 00000000 */   nop
/* 107F8 800353F8 0C048C2E */  jal       clear_worker_list
/* 107FC 800353FC 00000000 */   nop
/* 10800 80035400 3C048020 */  lui       $a0, %hi(vtx_C20F40)
/* 10804 80035404 24840000 */  addiu     $a0, $a0, %lo(vtx_C20F40)
/* 10808 80035408 0C0514BA */  jal       hud_element_set_aux_cache
/* 1080C 8003540C 3C050002 */   lui      $a1, (0x20000 >> 16)
/* 10810 80035410 0C050440 */  jal       hud_element_clear_cache
/* 10814 80035414 00000000 */   nop
/* 10818 80035418 0C03A6EC */  jal       reset_status_bar
/* 1081C 8003541C 00000000 */   nop
/* 10820 80035420 0C04C3FC */  jal       clear_item_entity_data
/* 10824 80035424 00000000 */   nop
/* 10828 80035428 0C0B0C77 */  jal       clear_script_list
/* 1082C 8003542C 00000000 */   nop
/* 10830 80035430 0C00E12F */  jal       clear_npcs
/* 10834 80035434 00000000 */   nop
/* 10838 80035438 0C04432E */  jal       clear_entity_data
/* 1083C 8003543C 0000202D */   daddu    $a0, $zero, $zero
/* 10840 80035440 0C0515A0 */  jal       clear_trigger_data
/* 10844 80035444 00000000 */   nop
/* 10848 80035448 3C048007 */  lui       $a0, %hi(D_8007798C)
/* 1084C 8003544C 0C018038 */  jal       nuPiReadRomOverlay
/* 10850 80035450 2484798C */   addiu    $a0, $a0, %lo(D_8007798C)
/* 10854 80035454 0C091238 */  jal       func_802448E0
/* 10858 80035458 24040001 */   addiu    $a0, $zero, 0x1
/* 1085C 8003545C 240400FF */  addiu     $a0, $zero, 0xFF
/* 10860 80035460 3C06800A */  lui       $a2, %hi(gOverrideFlags)
/* 10864 80035464 24C6A650 */  addiu     $a2, $a2, %lo(gOverrideFlags)
/* 10868 80035468 2403FFF7 */  addiu     $v1, $zero, -0x9
/* 1086C 8003546C 8CC20000 */  lw        $v0, 0x0($a2)
/* 10870 80035470 3C05437F */  lui       $a1, (0x437F0000 >> 16)
/* 10874 80035474 00431024 */  and       $v0, $v0, $v1
/* 10878 80035478 0C04DF62 */  jal       set_screen_overlay_params_front
/* 1087C 8003547C ACC20000 */   sw       $v0, 0x0($a2)
.L80035480:
/* 10880 80035480 82020000 */  lb        $v0, 0x0($s0)
/* 10884 80035484 04410012 */  bgez      $v0, .L800354D0
/* 10888 80035488 00000000 */   nop
.L8003548C:
/* 1088C 8003548C 0C090C68 */  jal       func_802431A0
/* 10890 80035490 00000000 */   nop
/* 10894 80035494 3C03800A */  lui       $v1, %hi(D_800A0932)
/* 10898 80035498 24630932 */  addiu     $v1, $v1, %lo(D_800A0932)
/* 1089C 8003549C 94620000 */  lhu       $v0, 0x0($v1)
/* 108A0 800354A0 2442FFEC */  addiu     $v0, $v0, -0x14
/* 108A4 800354A4 A4620000 */  sh        $v0, 0x0($v1)
/* 108A8 800354A8 00021400 */  sll       $v0, $v0, 16
/* 108AC 800354AC 04420001 */  bltzl     $v0, .L800354B4
/* 108B0 800354B0 A4600000 */   sh       $zero, 0x0($v1)
.L800354B4:
/* 108B4 800354B4 84620000 */  lh        $v0, 0x0($v1)
/* 108B8 800354B8 44820000 */  mtc1      $v0, $f0
/* 108BC 800354BC 00000000 */  nop
/* 108C0 800354C0 46800020 */  cvt.s.w   $f0, $f0
/* 108C4 800354C4 44050000 */  mfc1      $a1, $f0
/* 108C8 800354C8 0C04DF62 */  jal       set_screen_overlay_params_front
/* 108CC 800354CC 0000202D */   daddu    $a0, $zero, $zero
.L800354D0:
/* 108D0 800354D0 8FBF0020 */  lw        $ra, 0x20($sp)
/* 108D4 800354D4 8FB3001C */  lw        $s3, 0x1C($sp)
/* 108D8 800354D8 8FB20018 */  lw        $s2, 0x18($sp)
/* 108DC 800354DC 8FB10014 */  lw        $s1, 0x14($sp)
/* 108E0 800354E0 8FB00010 */  lw        $s0, 0x10($sp)
/* 108E4 800354E4 03E00008 */  jr        $ra
/* 108E8 800354E8 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

void state_step_language_select(void) {
    switch (D_800A0931) {
        case 0:
            update_player();
            update_npcs();
            update_encounters();
            update_effects();

            if (D_800A0932[0] < 255) {
                D_800A0932[0] += 20;

                if (D_800A0932[0] > 255) {
                    D_800A0932[0] = 255;
                }
                set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, D_800A0932[0]);
                if (D_800A0932[0] == 255) {

                    D_800A0931 = 1;
                }
            } else {
                D_800A0931 = 1;
            }
            break;
        case 1:
            D_800A0930 = 5;
            D_800A0931 = 2;
            gOverrideFlags |= GLOBAL_OVERRIDES_8;
            break;
        case 2:
            D_800A0930--;
            if (D_800A0930 == 0) {
                nuGfxSetCfb(fsFrameBuffers, 2);
                if (nuGfxCfb[2] == nuGfxCfb_ptr) {
                    gOverrideFlags &= ~GLOBAL_OVERRIDES_8;
                } else {
                    gOverrideFlags |= GLOBAL_OVERRIDES_8;
                    set_windows_visible(WINDOW_GROUP_FILE_MENU);
                    D_800A0930 = 1;
                    D_800A0931 = 3;
                }
            }
            break;
        case 3:
            if (D_800A0930 >= 0) {
                D_800A0930--;
                if (D_800A0930 == 0) {
                    D_800A0930 = -1;
                    sfx_stop_env_sounds();
                    func_8003B1A8();
                    gGameStatusPtr->isBattle = 2;
                    backup_map_collision_data();
                    battle_heap_create();
                    sfx_clear_env_sounds(0);
                    spr_init_sprites(PLAYER_SPRITES_MARIO_WORLD);
                    clear_model_data();
                    clear_sprite_shading_data();
                    reset_background_settings();
                    clear_entity_models();
                    clear_animator_list();
                    clear_worker_list();
                    hud_element_set_aux_cache(&D_80200000, 0x20000);
                    hud_element_clear_cache();
                    reset_status_bar();
                    clear_item_entity_data();
                    clear_script_list();
                    clear_npcs();
                    clear_entity_data(0);
                    clear_trigger_data();
                    nuPiReadRomOverlay(&D_8007798C);
                    filemenu_init(TRUE);
                    gOverrideFlags &= ~GLOBAL_OVERRIDES_8;
                    set_screen_overlay_params_front(OVERLAY_NONE, 255.0f);
                }
                if (D_800A0930 >= 0) {
                    break;
                }
            }

            filemenu_update();
            D_800A0932[0] -= 20;
            if (D_800A0932[0] < 0) {
                D_800A0932[0] = 0;
            }
            set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, D_800A0932[0]);
            break;
    }
}