### RAW ASSEMBLY INSTRUCTIONS:

glabel render_animated_models
/* F14C8 802CCB18 27BDFDA8 */  addiu     $sp, $sp, -0x258
/* F14CC 802CCB1C F7B60250 */  sdc1      $f22, 0x250($sp)
/* F14D0 802CCB20 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* F14D4 802CCB24 4481B000 */  mtc1      $at, $f22
/* F14D8 802CCB28 AFB3022C */  sw        $s3, 0x22C($sp)
/* F14DC 802CCB2C 0000982D */  daddu     $s3, $zero, $zero
/* F14E0 802CCB30 F7B40248 */  sdc1      $f20, 0x248($sp)
/* F14E4 802CCB34 4480A000 */  mtc1      $zero, $f20
/* F14E8 802CCB38 27A80058 */  addiu     $t0, $sp, 0x58
/* F14EC 802CCB3C AFBE0240 */  sw        $fp, 0x240($sp)
/* F14F0 802CCB40 27BE0098 */  addiu     $fp, $sp, 0x98
/* F14F4 802CCB44 AFB7023C */  sw        $s7, 0x23C($sp)
/* F14F8 802CCB48 27B700D8 */  addiu     $s7, $sp, 0xD8
/* F14FC 802CCB4C AFB60238 */  sw        $s6, 0x238($sp)
/* F1500 802CCB50 27B601D8 */  addiu     $s6, $sp, 0x1D8
/* F1504 802CCB54 AFB20228 */  sw        $s2, 0x228($sp)
/* F1508 802CCB58 27B20158 */  addiu     $s2, $sp, 0x158
/* F150C 802CCB5C AFB50234 */  sw        $s5, 0x234($sp)
/* F1510 802CCB60 27B50118 */  addiu     $s5, $sp, 0x118
/* F1514 802CCB64 AFB40230 */  sw        $s4, 0x230($sp)
/* F1518 802CCB68 27B40198 */  addiu     $s4, $sp, 0x198
/* F151C 802CCB6C AFBF0244 */  sw        $ra, 0x244($sp)
/* F1520 802CCB70 AFB10224 */  sw        $s1, 0x224($sp)
/* F1524 802CCB74 AFB00220 */  sw        $s0, 0x220($sp)
/* F1528 802CCB78 AFA80218 */  sw        $t0, 0x218($sp)
.L802CCB7C:
/* F152C 802CCB7C 3C02802E */  lui       $v0, %hi(gCurrentMeshAnimationListPtr)
/* F1530 802CCB80 8C42AE30 */  lw        $v0, %lo(gCurrentMeshAnimationListPtr)($v0)
/* F1534 802CCB84 00131880 */  sll       $v1, $s3, 2
/* F1538 802CCB88 00621821 */  addu      $v1, $v1, $v0
/* F153C 802CCB8C 8C710000 */  lw        $s1, 0x0($v1)
/* F1540 802CCB90 8E220000 */  lw        $v0, 0x0($s1)
/* F1544 802CCB94 04420035 */  bltzl     $v0, .L802CCC6C
/* F1548 802CCB98 26730001 */   addiu    $s3, $s3, 0x1
/* F154C 802CCB9C 8E250004 */  lw        $a1, 0x4($s1)
/* F1550 802CCBA0 8E260008 */  lw        $a2, 0x8($s1)
/* F1554 802CCBA4 8E27000C */  lw        $a3, 0xC($s1)
/* F1558 802CCBA8 0C019E40 */  jal       guTranslateF
/* F155C 802CCBAC 27A40018 */   addiu    $a0, $sp, 0x18
/* F1560 802CCBB0 E7B40010 */  swc1      $f20, 0x10($sp)
/* F1564 802CCBB4 8E250010 */  lw        $a1, 0x10($s1)
/* F1568 802CCBB8 4406B000 */  mfc1      $a2, $f22
/* F156C 802CCBBC 4407A000 */  mfc1      $a3, $f20
/* F1570 802CCBC0 8FA40218 */  lw        $a0, 0x218($sp)
/* F1574 802CCBC4 0C019EC8 */  jal       guRotateF
/* F1578 802CCBC8 26300028 */   addiu    $s0, $s1, 0x28
/* F157C 802CCBCC E7B40010 */  swc1      $f20, 0x10($sp)
/* F1580 802CCBD0 8E250014 */  lw        $a1, 0x14($s1)
/* F1584 802CCBD4 4406A000 */  mfc1      $a2, $f20
/* F1588 802CCBD8 4407B000 */  mfc1      $a3, $f22
/* F158C 802CCBDC 0C019EC8 */  jal       guRotateF
/* F1590 802CCBE0 03C0202D */   daddu    $a0, $fp, $zero
/* F1594 802CCBE4 E7B60010 */  swc1      $f22, 0x10($sp)
/* F1598 802CCBE8 8E250018 */  lw        $a1, 0x18($s1)
/* F159C 802CCBEC 4406A000 */  mfc1      $a2, $f20
/* F15A0 802CCBF0 4407A000 */  mfc1      $a3, $f20
/* F15A4 802CCBF4 0C019EC8 */  jal       guRotateF
/* F15A8 802CCBF8 02E0202D */   daddu    $a0, $s7, $zero
/* F15AC 802CCBFC 8E25001C */  lw        $a1, 0x1C($s1)
/* F15B0 802CCC00 8E260020 */  lw        $a2, 0x20($s1)
/* F15B4 802CCC04 8E270024 */  lw        $a3, 0x24($s1)
/* F15B8 802CCC08 0C019DF0 */  jal       guScaleF
/* F15BC 802CCC0C 02C0202D */   daddu    $a0, $s6, $zero
/* F15C0 802CCC10 02E0202D */  daddu     $a0, $s7, $zero
/* F15C4 802CCC14 8FA50218 */  lw        $a1, 0x218($sp)
/* F15C8 802CCC18 0C019D80 */  jal       guMtxCatF
/* F15CC 802CCC1C 0240302D */   daddu    $a2, $s2, $zero
/* F15D0 802CCC20 0240202D */  daddu     $a0, $s2, $zero
/* F15D4 802CCC24 03C0282D */  daddu     $a1, $fp, $zero
/* F15D8 802CCC28 0C019D80 */  jal       guMtxCatF
/* F15DC 802CCC2C 02A0302D */   daddu    $a2, $s5, $zero
/* F15E0 802CCC30 02C0202D */  daddu     $a0, $s6, $zero
/* F15E4 802CCC34 02A0282D */  daddu     $a1, $s5, $zero
/* F15E8 802CCC38 0C019D80 */  jal       guMtxCatF
/* F15EC 802CCC3C 0240302D */   daddu    $a2, $s2, $zero
/* F15F0 802CCC40 0240202D */  daddu     $a0, $s2, $zero
/* F15F4 802CCC44 27A50018 */  addiu     $a1, $sp, 0x18
/* F15F8 802CCC48 0C019D80 */  jal       guMtxCatF
/* F15FC 802CCC4C 0280302D */   daddu    $a2, $s4, $zero
/* F1600 802CCC50 0280202D */  daddu     $a0, $s4, $zero
/* F1604 802CCC54 0C019D40 */  jal       guMtxF2L
/* F1608 802CCC58 0200282D */   daddu    $a1, $s0, $zero
/* F160C 802CCC5C 8E240000 */  lw        $a0, 0x0($s1)
/* F1610 802CCC60 0C047CC1 */  jal       render_animated_model
/* F1614 802CCC64 0200282D */   daddu    $a1, $s0, $zero
/* F1618 802CCC68 26730001 */  addiu     $s3, $s3, 0x1
.L802CCC6C:
/* F161C 802CCC6C 2A620010 */  slti      $v0, $s3, 0x10
/* F1620 802CCC70 1440FFC2 */  bnez      $v0, .L802CCB7C
/* F1624 802CCC74 00000000 */   nop
/* F1628 802CCC78 8FBF0244 */  lw        $ra, 0x244($sp)
/* F162C 802CCC7C 8FBE0240 */  lw        $fp, 0x240($sp)
/* F1630 802CCC80 8FB7023C */  lw        $s7, 0x23C($sp)
/* F1634 802CCC84 8FB60238 */  lw        $s6, 0x238($sp)
/* F1638 802CCC88 8FB50234 */  lw        $s5, 0x234($sp)
/* F163C 802CCC8C 8FB40230 */  lw        $s4, 0x230($sp)
/* F1640 802CCC90 8FB3022C */  lw        $s3, 0x22C($sp)
/* F1644 802CCC94 8FB20228 */  lw        $s2, 0x228($sp)
/* F1648 802CCC98 8FB10224 */  lw        $s1, 0x224($sp)
/* F164C 802CCC9C 8FB00220 */  lw        $s0, 0x220($sp)
/* F1650 802CCCA0 D7B60250 */  ldc1      $f22, 0x250($sp)
/* F1654 802CCCA4 D7B40248 */  ldc1      $f20, 0x248($sp)
/* F1658 802CCCA8 03E00008 */  jr        $ra
/* F165C 802CCCAC 27BD0258 */   addiu    $sp, $sp, 0x258

### DECOMPILED C INSTRUCTIONS:

void render_animated_models(void) {
    Matrix4f sp18;
    Matrix4f sp58;
    Matrix4f sp98;
    Matrix4f spD8;
    Matrix4f sp118;
    Matrix4f sp158;
    Matrix4f sp198;
    Matrix4f sp1D8;
    s32 i = 0;
    Matrix4f* sp218 = &sp58;

    for (; i < MAX_ANIMATED_MODELS; i++) {
        AnimatedModel* model = (*gCurrentMeshAnimationListPtr)[i];

        if (model->animModelID >= 0) {
            guTranslateF(sp18, model->pos.x, model->pos.y, model->pos.z);
            guRotateF(*sp218, model->rot.x, 1.0f, 0.0f, 0.0f);
            guRotateF(sp98, model->rot.y, 0.0f, 1.0f, 0.0f);
            guRotateF(spD8, model->rot.z, 0.0f, 0.0f, 1.0f);
            guScaleF(sp1D8, model->scale.x, model->scale.y, model->scale.z);
            guMtxCatF(spD8, *sp218, sp158);
            guMtxCatF(sp158, sp98, sp118);
            guMtxCatF(sp1D8, sp118, sp158);
            guMtxCatF(sp158, sp18, sp198);
            guMtxF2L(sp198, &model->mtx);
            render_animated_model(model->animModelID, &model->mtx);
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_E01166E8
/* 402D28 E01166E8 27BDFF48 */  addiu     $sp, $sp, -0xB8
/* 402D2C E01166EC AFB000A0 */  sw        $s0, 0xA0($sp)
/* 402D30 E01166F0 AFBF00AC */  sw        $ra, 0xAC($sp)
/* 402D34 E01166F4 AFB200A8 */  sw        $s2, 0xA8($sp)
/* 402D38 E01166F8 AFB100A4 */  sw        $s1, 0xA4($sp)
/* 402D3C E01166FC F7B400B0 */  sdc1      $f20, 0xB0($sp)
/* 402D40 E0116700 1480000F */  bnez      $a0, .LE0116740
/* 402D44 E0116704 00A0802D */   daddu    $s0, $a1, $zero
/* 402D48 E0116708 3C028007 */  lui       $v0, %hi(gCurrentCameraID)
/* 402D4C E011670C 8C427410 */  lw        $v0, %lo(gCurrentCameraID)($v0)
/* 402D50 E0116710 00021880 */  sll       $v1, $v0, 2
/* 402D54 E0116714 00621821 */  addu      $v1, $v1, $v0
/* 402D58 E0116718 00031880 */  sll       $v1, $v1, 2
/* 402D5C E011671C 00621823 */  subu      $v1, $v1, $v0
/* 402D60 E0116720 000310C0 */  sll       $v0, $v1, 3
/* 402D64 E0116724 00621821 */  addu      $v1, $v1, $v0
/* 402D68 E0116728 000318C0 */  sll       $v1, $v1, 3
/* 402D6C E011672C 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 402D70 E0116730 00230821 */  addu      $at, $at, $v1
/* 402D74 E0116734 C4261DEC */  lwc1      $f6, %lo(gCameras + 0x6C)($at)
/* 402D78 E0116738 080459D1 */  j         .LE0116744
/* 402D7C E011673C 00000000 */   nop
.LE0116740:
/* 402D80 E0116740 44803000 */  mtc1      $zero, $f6
.LE0116744:
/* 402D84 E0116744 C6000018 */  lwc1      $f0, 0x18($s0)
/* 402D88 E0116748 C6040020 */  lwc1      $f4, 0x20($s0)
/* 402D8C E011674C 3C014000 */  lui       $at, (0x40000000 >> 16)
/* 402D90 E0116750 44811000 */  mtc1      $at, $f2
/* 402D94 E0116754 E7A00010 */  swc1      $f0, 0x10($sp)
/* 402D98 E0116758 C6000004 */  lwc1      $f0, 0x4($s0)
/* 402D9C E011675C 4480A000 */  mtc1      $zero, $f20
/* 402DA0 E0116760 46020000 */  add.s     $f0, $f0, $f2
/* 402DA4 E0116764 4405A000 */  mfc1      $a1, $f20
/* 402DA8 E0116768 27A40020 */  addiu     $a0, $sp, 0x20
/* 402DAC E011676C E7A00014 */  swc1      $f0, 0x14($sp)
/* 402DB0 E0116770 C6000008 */  lwc1      $f0, 0x8($s0)
/* 402DB4 E0116774 46062101 */  sub.s     $f4, $f4, $f6
/* 402DB8 E0116778 E7A00018 */  swc1      $f0, 0x18($sp)
/* 402DBC E011677C C600000C */  lwc1      $f0, 0xC($s0)
/* 402DC0 E0116780 4407A000 */  mfc1      $a3, $f20
/* 402DC4 E0116784 46020000 */  add.s     $f0, $f0, $f2
/* 402DC8 E0116788 44062000 */  mfc1      $a2, $f4
/* 402DCC E011678C 3C120001 */  lui       $s2, (0x11630 >> 16)
/* 402DD0 E0116790 0C080180 */  jal       shim_guPositionF
/* 402DD4 E0116794 E7A0001C */   swc1     $f0, 0x1C($sp)
/* 402DD8 E0116798 4406A000 */  mfc1      $a2, $f20
/* 402DDC E011679C 4407A000 */  mfc1      $a3, $f20
/* 402DE0 E01167A0 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 402DE4 E01167A4 44810000 */  mtc1      $at, $f0
/* 402DE8 E01167A8 36521630 */  ori       $s2, $s2, (0x11630 & 0xFFFF)
/* 402DEC E01167AC E7A00010 */  swc1      $f0, 0x10($sp)
/* 402DF0 E01167B0 8E05001C */  lw        $a1, 0x1C($s0)
/* 402DF4 E01167B4 27B00060 */  addiu     $s0, $sp, 0x60
/* 402DF8 E01167B8 0C080104 */  jal       shim_guRotateF
/* 402DFC E01167BC 0200202D */   daddu    $a0, $s0, $zero
/* 402E00 E01167C0 0200202D */  daddu     $a0, $s0, $zero
/* 402E04 E01167C4 27A50020 */  addiu     $a1, $sp, 0x20
/* 402E08 E01167C8 0C080114 */  jal       shim_guMtxCatF
/* 402E0C E01167CC 00A0302D */   daddu    $a2, $a1, $zero
/* 402E10 E01167D0 0200202D */  daddu     $a0, $s0, $zero
/* 402E14 E01167D4 4405A000 */  mfc1      $a1, $f20
/* 402E18 E01167D8 3C07C000 */  lui       $a3, (0xC0000000 >> 16)
/* 402E1C E01167DC 0C080108 */  jal       shim_guTranslateF
/* 402E20 E01167E0 00A0302D */   daddu    $a2, $a1, $zero
/* 402E24 E01167E4 0200202D */  daddu     $a0, $s0, $zero
/* 402E28 E01167E8 27A50020 */  addiu     $a1, $sp, 0x20
/* 402E2C E01167EC 0C080114 */  jal       shim_guMtxCatF
/* 402E30 E01167F0 00A0302D */   daddu    $a2, $a1, $zero
/* 402E34 E01167F4 27A40020 */  addiu     $a0, $sp, 0x20
/* 402E38 E01167F8 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* 402E3C E01167FC 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* 402E40 E0116800 3C11800A */  lui       $s1, %hi(gDisplayContext)
/* 402E44 E0116804 2631A674 */  addiu     $s1, $s1, %lo(gDisplayContext)
/* 402E48 E0116808 96050000 */  lhu       $a1, 0x0($s0)
/* 402E4C E011680C 8E220000 */  lw        $v0, 0x0($s1)
/* 402E50 E0116810 00052980 */  sll       $a1, $a1, 6
/* 402E54 E0116814 00B22821 */  addu      $a1, $a1, $s2
/* 402E58 E0116818 0C080118 */  jal       shim_guMtxF2L
/* 402E5C E011681C 00452821 */   addu     $a1, $v0, $a1
/* 402E60 E0116820 3C05DA38 */  lui       $a1, (0xDA380002 >> 16)
/* 402E64 E0116824 3C04800A */  lui       $a0, %hi(gMainGfxPos)
/* 402E68 E0116828 2484A66C */  addiu     $a0, $a0, %lo(gMainGfxPos)
/* 402E6C E011682C 34A50002 */  ori       $a1, $a1, (0xDA380002 & 0xFFFF)
/* 402E70 E0116830 8C830000 */  lw        $v1, 0x0($a0)
/* 402E74 E0116834 96020000 */  lhu       $v0, 0x0($s0)
/* 402E78 E0116838 0060302D */  daddu     $a2, $v1, $zero
/* 402E7C E011683C 24630008 */  addiu     $v1, $v1, 0x8
/* 402E80 E0116840 AC830000 */  sw        $v1, 0x0($a0)
/* 402E84 E0116844 24430001 */  addiu     $v1, $v0, 0x1
/* 402E88 E0116848 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 402E8C E011684C 00021180 */  sll       $v0, $v0, 6
/* 402E90 E0116850 ACC50000 */  sw        $a1, 0x0($a2)
/* 402E94 E0116854 A6030000 */  sh        $v1, 0x0($s0)
/* 402E98 E0116858 8E230000 */  lw        $v1, 0x0($s1)
/* 402E9C E011685C 00521021 */  addu      $v0, $v0, $s2
/* 402EA0 E0116860 00621821 */  addu      $v1, $v1, $v0
/* 402EA4 E0116864 ACC30004 */  sw        $v1, 0x4($a2)
/* 402EA8 E0116868 8FBF00AC */  lw        $ra, 0xAC($sp)
/* 402EAC E011686C 8FB200A8 */  lw        $s2, 0xA8($sp)
/* 402EB0 E0116870 8FB100A4 */  lw        $s1, 0xA4($sp)
/* 402EB4 E0116874 8FB000A0 */  lw        $s0, 0xA0($sp)
/* 402EB8 E0116878 D7B400B0 */  ldc1      $f20, 0xB0($sp)
/* 402EBC E011687C 03E00008 */  jr        $ra
/* 402EC0 E0116880 27BD00B8 */   addiu    $sp, $sp, 0xB8

### DECOMPILED C INSTRUCTIONS:

void func_E01166E8(s32 arg0, SomethingRotatingFXData* part) {
    f32 temp;
    Matrix4f sp20;
    Matrix4f sp60;

    if (arg0 == 0) {
        temp = gCameras[gCurrentCameraID].currentYaw;
    } else {
        temp = 0.0f;
    }

    shim_guPositionF(sp20, 0.0f, part->unk_20 - temp, 0.0f, part->unk_18,
        part->pos.x + 2.0f,
        part->pos.y,
        part->pos.z + 2.0f
    );
    shim_guRotateF(sp60, part->unk_1C, 0.0f, 0.0f, 1.0f);
    shim_guMtxCatF(sp60, sp20, sp20);
    shim_guTranslateF(sp60, 0.0f, 0.0f, -2.0f);
    shim_guMtxCatF(sp60, sp20, sp20);
    shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);

    gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++],
              G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_8024E604
/* 141944 8024E604 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 141948 8024E608 AFB3001C */  sw        $s3, 0x1C($sp)
glabel func_8024E60C
/* 14194C 8024E60C 0080982D */  daddu     $s3, $a0, $zero
/* 141950 8024E610 AFB00010 */  sw        $s0, 0x10($sp)
/* 141954 8024E614 0000802D */  daddu     $s0, $zero, $zero
/* 141958 8024E618 AFB20018 */  sw        $s2, 0x18($sp)
glabel func_8024E61C
/* 14195C 8024E61C 3C128027 */  lui       $s2, %hi(gPauseMapIconIDs)
/* 141960 8024E620 26520700 */  addiu     $s2, $s2, %lo(gPauseMapIconIDs)
/* 141964 8024E624 AFB10014 */  sw        $s1, 0x14($sp)
/* 141968 8024E628 3C118025 */  lui       $s1, %hi(D_8024FA30)
/* 14196C 8024E62C 2631FA30 */  addiu     $s1, $s1, %lo(D_8024FA30)
/* 141970 8024E630 AFBF0020 */  sw        $ra, 0x20($sp)
.L8024E634:
/* 141974 8024E634 8E240000 */  lw        $a0, 0x0($s1)
/* 141978 8024E638 26310004 */  addiu     $s1, $s1, 0x4
/* 14197C 8024E63C 0C050529 */  jal       hud_element_create
/* 141980 8024E640 26100001 */   addiu    $s0, $s0, 0x1
/* 141984 8024E644 0040202D */  daddu     $a0, $v0, $zero
/* 141988 8024E648 24050080 */  addiu     $a1, $zero, 0x80
/* 14198C 8024E64C 0C051280 */  jal       hud_element_set_flags
/* 141990 8024E650 AE440000 */   sw       $a0, 0x0($s2)
/* 141994 8024E654 1A00FFF7 */  blez      $s0, .L8024E634
.L8024E658:
/* 141998 8024E658 26520004 */   addiu    $s2, $s2, 0x4
/* 14199C 8024E65C 24100006 */  addiu     $s0, $zero, 0x6
/* 1419A0 8024E660 3C028025 */  lui       $v0, %hi(D_80250668)
glabel func_8024E664
/* 1419A4 8024E664 24420668 */  addiu     $v0, $v0, %lo(D_80250668)
.L8024E668:
/* 1419A8 8024E668 AC530010 */  sw        $s3, 0x10($v0)
/* 1419AC 8024E66C 2610FFFF */  addiu     $s0, $s0, -0x1
/* 1419B0 8024E670 0601FFFD */  bgez      $s0, .L8024E668
/* 1419B4 8024E674 2442FFDC */   addiu    $v0, $v0, -0x24
/* 1419B8 8024E678 3C048025 */  lui       $a0, %hi(D_80250590)
/* 1419BC 8024E67C 24840590 */  addiu     $a0, $a0, %lo(D_80250590)
/* 1419C0 8024E680 0C051FCC */  jal       setup_pause_menu_tab
/* 1419C4 8024E684 24050007 */   addiu    $a1, $zero, 0x7
/* 1419C8 8024E688 0000202D */  daddu     $a0, $zero, $zero
/* 1419CC 8024E68C 3C05F5DE */  lui       $a1, (0xF5DE0329 >> 16)
/* 1419D0 8024E690 2402FFFF */  addiu     $v0, $zero, -0x1
/* 1419D4 8024E694 3C018027 */  lui       $at, %hi(gPauseMapCursorCurrentOption)
/* 1419D8 8024E698 AC22071C */  sw        $v0, %lo(gPauseMapCursorCurrentOption)($at)
/* 1419DC 8024E69C 3C018027 */  lui       $at, %hi(gPauseMapSpacesInSnapRange)
D_8024E6A0_C0BF20:
/* 1419E0 8024E6A0 AC200724 */  sw        $zero, %lo(gPauseMapSpacesInSnapRange)($at)
/* 1419E4 8024E6A4 3C018027 */  lui       $at, %hi(gPauseMapCursorCurrentOptionCopy)
.L8024E6A8:
/* 1419E8 8024E6A8 AC220720 */  sw        $v0, %lo(gPauseMapCursorCurrentOptionCopy)($at)
/* 1419EC 8024E6AC 0C0B1EAF */  jal       evt_get_variable
/* 1419F0 8024E6B0 34A50329 */   ori      $a1, $a1, (0xF5DE0329 & 0xFFFF)
glabel func_8024E6B4
/* 1419F4 8024E6B4 0040202D */  daddu     $a0, $v0, $zero
/* 1419F8 8024E6B8 0000802D */  daddu     $s0, $zero, $zero
/* 1419FC 8024E6BC 3C058025 */  lui       $a1, %hi(D_802502B8)
/* 141A00 8024E6C0 24A502B8 */  addiu     $a1, $a1, %lo(D_802502B8)
/* 141A04 8024E6C4 00A0182D */  daddu     $v1, $a1, $zero
.L8024E6C8:
/* 141A08 8024E6C8 8C620010 */  lw        $v0, 0x10($v1)
/* 141A0C 8024E6CC 10440006 */  beq       $v0, $a0, .L8024E6E8
/* 141A10 8024E6D0 2A020022 */   slti     $v0, $s0, 0x22
/* 141A14 8024E6D4 26100001 */  addiu     $s0, $s0, 0x1
D_8024E6D8_C0BF58:
/* 141A18 8024E6D8 2A020022 */  slti      $v0, $s0, 0x22
/* 141A1C 8024E6DC 1440FFFA */  bnez      $v0, .L8024E6C8
/* 141A20 8024E6E0 24630014 */   addiu    $v1, $v1, 0x14
.L8024E6E4:
/* 141A24 8024E6E4 2A020022 */  slti      $v0, $s0, 0x22
.L8024E6E8:
/* 141A28 8024E6E8 1040000C */  beqz      $v0, .L8024E71C
/* 141A2C 8024E6EC 00101080 */   sll      $v0, $s0, 2
/* 141A30 8024E6F0 00501021 */  addu      $v0, $v0, $s0
/* 141A34 8024E6F4 00021080 */  sll       $v0, $v0, 2
D_8024E6F8:
/* 141A38 8024E6F8 00451021 */  addu      $v0, $v0, $a1
/* 141A3C 8024E6FC 84430000 */  lh        $v1, 0x0($v0)
.L8024E700:
/* 141A40 8024E700 84420002 */  lh        $v0, 0x2($v0)
/* 141A44 8024E704 3C018027 */  lui       $at, %hi(gPauseMapMarioX)
/* 141A48 8024E708 AC23070C */  sw        $v1, %lo(gPauseMapMarioX)($at)
/* 141A4C 8024E70C 3C018027 */  lui       $at, %hi(gPauseMapMarioY)
/* 141A50 8024E710 AC220710 */  sw        $v0, %lo(gPauseMapMarioY)($at)
/* 141A54 8024E714 080939CB */  j         .L8024E72C
/* 141A58 8024E718 00000000 */   nop
.L8024E71C:
/* 141A5C 8024E71C 3C018027 */  lui       $at, %hi(gPauseMapMarioX)
.L8024E720:
/* 141A60 8024E720 AC20070C */  sw        $zero, %lo(gPauseMapMarioX)($at)
/* 141A64 8024E724 3C018027 */  lui       $at, %hi(gPauseMapMarioY)
/* 141A68 8024E728 AC200710 */  sw        $zero, %lo(gPauseMapMarioY)($at)
.L8024E72C:
/* 141A6C 8024E72C 3C018027 */  lui       $at, %hi(gPauseMapMarioX)
D_8024E730:
/* 141A70 8024E730 C422070C */  lwc1      $f2, %lo(gPauseMapMarioX)($at)
.L8024E734:
/* 141A74 8024E734 468010A0 */  cvt.s.w   $f2, $f2

### DECOMPILED C INSTRUCTIONS:

void pause_map_init(MenuPanel* tab) {
    s32 currentLocation;
    s32 i;

    for (i = 0; i < ARRAY_COUNT(gPauseMapIconScripts); i++) {
        gPauseMapIconIDs[i] = hud_element_create(gPauseMapIconScripts[i]);
        hud_element_set_flags(gPauseMapIconIDs[i], HUD_ELEMENT_FLAG_80);
    }

    for (i = 0; i < ARRAY_COUNT(gPauseMapWindowBPs); i++) {
        gPauseMapWindowBPs[i].tab = tab;
    }

    setup_pause_menu_tab(gPauseMapWindowBPs, ARRAY_COUNT(gPauseMapWindowBPs));
    gPauseMapCursorCurrentOption = -1;
    gPauseMapSpacesInSnapRange = 0;
    gPauseMapCursorCurrentOptionCopy = -1;
    currentLocation = evt_get_variable(0, GB_WorldLocation);

    for (i = 0; i < ARRAY_COUNT(gPauseMapSpaces); i++) {
        if (gPauseMapSpaces[i].id == currentLocation) {
            break;
        }
    }

    if (i < ARRAY_COUNT(gPauseMapSpaces)) {
        gPauseMapMarioX = gPauseMapSpaces[i].pos.x;
        gPauseMapMarioY = gPauseMapSpaces[i].pos.y;
    } else {
        gPauseMapMarioX = 0;
        gPauseMapMarioY = 0;
    }
    gPauseMapTargetX = gPauseMapMarioX;
    gPauseMapTargetY = gPauseMapMarioY;

    gPauseMapCameraX = 0.0f;
    gPauseMapCameraY = 0.0f;
    gPauseMapCameraX -= (s32)(gPauseMapTargetX + gPauseMapCameraX - 117.0);
    gPauseMapCameraY -= (s32)(gPauseMapTargetY + gPauseMapCameraY - 55.0);

    if (gPauseMapCameraX > 0)  {
        gPauseMapCameraX = 0;
    }
    if (gPauseMapCameraY > 0) {
        gPauseMapCameraY = 0;
    }

    if (gPauseMapCameraX <= -86.0f) {
        gPauseMapCameraX = -85.0f;
    }
    if (gPauseMapCameraY <= -210.0f) {
        gPauseMapCameraY = -209.0f;
    }

    tab->initialized = TRUE;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_802CA988
/* EF338 802CA988 27BDFFD0 */  addiu     $sp, $sp, -0x30
/* EF33C 802CA98C AFB20018 */  sw        $s2, 0x18($sp)
/* EF340 802CA990 0080902D */  daddu     $s2, $a0, $zero
/* EF344 802CA994 AFBF0028 */  sw        $ra, 0x28($sp)
/* EF348 802CA998 AFB50024 */  sw        $s5, 0x24($sp)
/* EF34C 802CA99C AFB40020 */  sw        $s4, 0x20($sp)
/* EF350 802CA9A0 AFB3001C */  sw        $s3, 0x1C($sp)
/* EF354 802CA9A4 AFB10014 */  sw        $s1, 0x14($sp)
/* EF358 802CA9A8 AFB00010 */  sw        $s0, 0x10($sp)
/* EF35C 802CA9AC 8E50000C */  lw        $s0, 0xC($s2)
/* EF360 802CA9B0 8E050000 */  lw        $a1, 0x0($s0)
/* EF364 802CA9B4 0C0B1EAF */  jal       evt_get_variable
/* EF368 802CA9B8 26100004 */   addiu    $s0, $s0, 0x4
/* EF36C 802CA9BC 8E140000 */  lw        $s4, 0x0($s0)
/* EF370 802CA9C0 26100004 */  addiu     $s0, $s0, 0x4
/* EF374 802CA9C4 8E150000 */  lw        $s5, 0x0($s0)
/* EF378 802CA9C8 26100004 */  addiu     $s0, $s0, 0x4
/* EF37C 802CA9CC 3C04800B */  lui       $a0, %hi(gCameras)
/* EF380 802CA9D0 24841D80 */  addiu     $a0, $a0, %lo(gCameras)
/* EF384 802CA9D4 00021880 */  sll       $v1, $v0, 2
/* EF388 802CA9D8 00621821 */  addu      $v1, $v1, $v0
/* EF38C 802CA9DC 00031880 */  sll       $v1, $v1, 2
/* EF390 802CA9E0 00621823 */  subu      $v1, $v1, $v0
/* EF394 802CA9E4 000310C0 */  sll       $v0, $v1, 3
/* EF398 802CA9E8 00621821 */  addu      $v1, $v1, $v0
/* EF39C 802CA9EC 000318C0 */  sll       $v1, $v1, 3
/* EF3A0 802CA9F0 00648821 */  addu      $s1, $v1, $a0
/* EF3A4 802CA9F4 C62C0094 */  lwc1      $f12, 0x94($s1)
/* EF3A8 802CA9F8 8E130000 */  lw        $s3, 0x0($s0)
/* EF3AC 802CA9FC 8E100004 */  lw        $s0, 0x4($s0)
/* EF3B0 802CAA00 24020002 */  addiu     $v0, $zero, 0x2
/* EF3B4 802CAA04 A6220004 */  sh        $v0, 0x4($s1)
/* EF3B8 802CAA08 0C00A6B1 */  jal       round
/* EF3BC 802CAA0C A6200006 */   sh       $zero, 0x6($s1)
/* EF3C0 802CAA10 C6220048 */  lwc1      $f2, 0x48($s1)
/* EF3C4 802CAA14 C620003C */  lwc1      $f0, 0x3C($s1)
/* EF3C8 802CAA18 46001081 */  sub.s     $f2, $f2, $f0
/* EF3CC 802CAA1C 46021082 */  mul.s     $f2, $f2, $f2
/* EF3D0 802CAA20 00000000 */  nop
/* EF3D4 802CAA24 C624004C */  lwc1      $f4, 0x4C($s1)
/* EF3D8 802CAA28 C6200040 */  lwc1      $f0, 0x40($s1)
/* EF3DC 802CAA2C 46002101 */  sub.s     $f4, $f4, $f0
/* EF3E0 802CAA30 46042102 */  mul.s     $f4, $f4, $f4
/* EF3E4 802CAA34 00000000 */  nop
/* EF3E8 802CAA38 C6260050 */  lwc1      $f6, 0x50($s1)
/* EF3EC 802CAA3C C6200044 */  lwc1      $f0, 0x44($s1)
/* EF3F0 802CAA40 46003181 */  sub.s     $f6, $f6, $f0
/* EF3F4 802CAA44 46063182 */  mul.s     $f6, $f6, $f6
/* EF3F8 802CAA48 00000000 */  nop
/* EF3FC 802CAA4C C6200090 */  lwc1      $f0, 0x90($s1)
/* EF400 802CAA50 46041080 */  add.s     $f2, $f2, $f4
/* EF404 802CAA54 00021023 */  negu      $v0, $v0
/* EF408 802CAA58 A622001C */  sh        $v0, 0x1C($s1)
/* EF40C 802CAA5C 46000007 */  neg.s     $f0, $f0
/* EF410 802CAA60 46061300 */  add.s     $f12, $f2, $f6
/* EF414 802CAA64 4600020D */  trunc.w.s $f8, $f0
/* EF418 802CAA68 44024000 */  mfc1      $v0, $f8
/* EF41C 802CAA6C 46006004 */  sqrt.s    $f0, $f12
/* EF420 802CAA70 46000032 */  c.eq.s    $f0, $f0
/* EF424 802CAA74 00000000 */  nop
/* EF428 802CAA78 45010003 */  bc1t      .L802CAA88
/* EF42C 802CAA7C A622001E */   sh       $v0, 0x1E($s1)
/* EF430 802CAA80 0C0187BC */  jal       sqrtf
/* EF434 802CAA84 00000000 */   nop
.L802CAA88:
/* EF438 802CAA88 0C00A6B1 */  jal       round
/* EF43C 802CAA8C 46000306 */   mov.s    $f12, $f0
/* EF440 802CAA90 0240202D */  daddu     $a0, $s2, $zero
/* EF444 802CAA94 8626001C */  lh        $a2, 0x1C($s1)
/* EF448 802CAA98 C6200048 */  lwc1      $f0, 0x48($s1)
/* EF44C 802CAA9C C622004C */  lwc1      $f2, 0x4C($s1)
/* EF450 802CAAA0 C6240050 */  lwc1      $f4, 0x50($s1)
/* EF454 802CAAA4 0280282D */  daddu     $a1, $s4, $zero
/* EF458 802CAAA8 A6220020 */  sh        $v0, 0x20($s1)
/* EF45C 802CAAAC A6200022 */  sh        $zero, 0x22($s1)
/* EF460 802CAAB0 E6200054 */  swc1      $f0, 0x54($s1)
/* EF464 802CAAB4 E6220058 */  swc1      $f2, 0x58($s1)
/* EF468 802CAAB8 0C0B2026 */  jal       evt_set_variable
/* EF46C 802CAABC E624005C */   swc1     $f4, 0x5C($s1)
/* EF470 802CAAC0 0240202D */  daddu     $a0, $s2, $zero
/* EF474 802CAAC4 8626001E */  lh        $a2, 0x1E($s1)
/* EF478 802CAAC8 0C0B2026 */  jal       evt_set_variable
/* EF47C 802CAACC 02A0282D */   daddu    $a1, $s5, $zero
/* EF480 802CAAD0 0240202D */  daddu     $a0, $s2, $zero
/* EF484 802CAAD4 86260020 */  lh        $a2, 0x20($s1)
/* EF488 802CAAD8 0C0B2026 */  jal       evt_set_variable
/* EF48C 802CAADC 0260282D */   daddu    $a1, $s3, $zero
/* EF490 802CAAE0 0240202D */  daddu     $a0, $s2, $zero
/* EF494 802CAAE4 86260022 */  lh        $a2, 0x22($s1)
/* EF498 802CAAE8 0C0B2026 */  jal       evt_set_variable
/* EF49C 802CAAEC 0200282D */   daddu    $a1, $s0, $zero
/* EF4A0 802CAAF0 8FBF0028 */  lw        $ra, 0x28($sp)
/* EF4A4 802CAAF4 8FB50024 */  lw        $s5, 0x24($sp)
/* EF4A8 802CAAF8 8FB40020 */  lw        $s4, 0x20($sp)
/* EF4AC 802CAAFC 8FB3001C */  lw        $s3, 0x1C($sp)
/* EF4B0 802CAB00 8FB20018 */  lw        $s2, 0x18($sp)
/* EF4B4 802CAB04 8FB10014 */  lw        $s1, 0x14($sp)
/* EF4B8 802CAB08 8FB00010 */  lw        $s0, 0x10($sp)
/* EF4BC 802CAB0C 24020002 */  addiu     $v0, $zero, 0x2
/* EF4C0 802CAB10 03E00008 */  jr        $ra
/* EF4C4 802CAB14 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

ApiStatus func_802CA988(Evt* script, s32 isInitialCall) {
    Bytecode* args = script->ptrReadPos;
    Bytecode id = evt_get_variable(script, *args++);
    Bytecode outVar1 = *args++;
    Bytecode outVar2 = *args++;
    Bytecode outVar3 = *args++;
    Bytecode outVar4 = *args++;
    f32 dx, dy, dz;

    gCameras[id].updateMode = CAM_UPDATE_MODE_2;
    gCameras[id].needsInit = FALSE;
    gCameras[id].auxPitch = -round(gCameras[id].currentPitch);
    gCameras[id].auxBoomLength = -gCameras[id].currentBlendedYawNegated;

    dx = gCameras[id].lookAt_obj.x - gCameras[id].lookAt_eye.x;
    dy = gCameras[id].lookAt_obj.y - gCameras[id].lookAt_eye.y;
    dz = gCameras[id].lookAt_obj.z - gCameras[id].lookAt_eye.z;

    gCameras[id].lookAt_dist = round(sqrtf(SQ(dx) + SQ(dy) + SQ(dz)));
    gCameras[id].auxBoomPitch = 0;
    gCameras[id].lookAt_obj_target.x = gCameras[id].lookAt_obj.x;
    gCameras[id].lookAt_obj_target.y = gCameras[id].lookAt_obj.y;
    gCameras[id].lookAt_obj_target.z = gCameras[id].lookAt_obj.z;

    evt_set_variable(script, outVar1, gCameras[id].auxPitch);
    evt_set_variable(script, outVar2, gCameras[id].auxBoomLength);
    evt_set_variable(script, outVar3, gCameras[id].lookAt_dist);
    evt_set_variable(script, outVar4, gCameras[id].auxBoomPitch);
    return ApiStatus_DONE2;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel au_bgm_load_subsegment
/* 29ED4 8004EAD4 0000402D */  daddu     $t0, $zero, $zero
/* 29ED8 8004EAD8 0100582D */  daddu     $t3, $t0, $zero
/* 29EDC 8004EADC 0100482D */  daddu     $t1, $t0, $zero
/* 29EE0 8004EAE0 240C0001 */  addiu     $t4, $zero, 0x1
/* 29EE4 8004EAE4 240A025C */  addiu     $t2, $zero, 0x25C
/* 29EE8 8004EAE8 30A5FFFF */  andi      $a1, $a1, 0xFFFF
/* 29EEC 8004EAEC 8C82006C */  lw        $v0, 0x6C($a0)
/* 29EF0 8004EAF0 00052880 */  sll       $a1, $a1, 2
/* 29EF4 8004EAF4 00A22821 */  addu      $a1, $a1, $v0
/* 29EF8 8004EAF8 AC850070 */  sw        $a1, 0x70($a0)
.L8004EAFC:
/* 29EFC 8004EAFC 8CA30000 */  lw        $v1, 0x0($a1)
/* 29F00 8004EB00 24A50004 */  addiu     $a1, $a1, 0x4
/* 29F04 8004EB04 008A3021 */  addu      $a2, $a0, $t2
/* 29F08 8004EB08 00031402 */  srl       $v0, $v1, 16
/* 29F0C 8004EB0C 10400034 */  beqz      $v0, .L8004EBE0
/* 29F10 8004EB10 ACC20000 */   sw       $v0, 0x0($a2)
/* 29F14 8004EB14 30620100 */  andi      $v0, $v1, 0x100
/* 29F18 8004EB18 54400031 */  bnel      $v0, $zero, .L8004EBE0
/* 29F1C 8004EB1C ACC00000 */   sw       $zero, 0x0($a2)
/* 29F20 8004EB20 3062E000 */  andi      $v0, $v1, 0xE000
/* 29F24 8004EB24 00021342 */  srl       $v0, $v0, 13
/* 29F28 8004EB28 A0C20054 */  sb        $v0, 0x54($a2)
/* 29F2C 8004EB2C 000311C2 */  srl       $v0, $v1, 7
/* 29F30 8004EB30 30420001 */  andi      $v0, $v0, 0x1
/* 29F34 8004EB34 A0C20058 */  sb        $v0, 0x58($a2)
/* 29F38 8004EB38 30621E00 */  andi      $v0, $v1, 0x1E00
/* 29F3C 8004EB3C 00023A42 */  srl       $a3, $v0, 9
/* 29F40 8004EB40 10E0001B */  beqz      $a3, .L8004EBB0
/* 29F44 8004EB44 A0C00059 */   sb       $zero, 0x59($a2)
/* 29F48 8004EB48 00071040 */  sll       $v0, $a3, 1
/* 29F4C 8004EB4C 00471021 */  addu      $v0, $v0, $a3
/* 29F50 8004EB50 00021140 */  sll       $v0, $v0, 5
/* 29F54 8004EB54 244201FC */  addiu     $v0, $v0, 0x1FC
/* 29F58 8004EB58 00821821 */  addu      $v1, $a0, $v0
/* 29F5C 8004EB5C 24E2FFFF */  addiu     $v0, $a3, -0x1
/* 29F60 8004EB60 0049102B */  sltu      $v0, $v0, $t1
/* 29F64 8004EB64 5040001E */  beql      $v0, $zero, .L8004EBE0
/* 29F68 8004EB68 ACC00000 */   sw       $zero, 0x0($a2)
/* 29F6C 8004EB6C 90620051 */  lbu       $v0, 0x51($v1)
/* 29F70 8004EB70 A0C20051 */  sb        $v0, 0x51($a2)
/* 29F74 8004EB74 90620052 */  lbu       $v0, 0x52($v1)
/* 29F78 8004EB78 A0C20052 */  sb        $v0, 0x52($a2)
/* 29F7C 8004EB7C 90620053 */  lbu       $v0, 0x53($v1)
/* 29F80 8004EB80 A0C20053 */  sb        $v0, 0x53($a2)
/* 29F84 8004EB84 8CC20000 */  lw        $v0, 0x0($a2)
/* 29F88 8004EB88 8C830070 */  lw        $v1, 0x70($a0)
glabel func_8004EB8C
/* 29F8C 8004EB8C ACCC0028 */  sw        $t4, 0x28($a2)
/* 29F90 8004EB90 A0C70059 */  sb        $a3, 0x59($a2)
/* 29F94 8004EB94 00431021 */  addu      $v0, $v0, $v1
/* 29F98 8004EB98 ACC20000 */  sw        $v0, 0x0($a2)
/* 29F9C 8004EB9C 90820233 */  lbu       $v0, 0x233($a0)
/* 29FA0 8004EBA0 54400001 */  bnel      $v0, $zero, .L8004EBA8
/* 29FA4 8004EBA4 A0CC005A */   sb       $t4, 0x5A($a2)
.L8004EBA8:
/* 29FA8 8004EBA8 08013AF8 */  j         .L8004EBE0
/* 29FAC 8004EBAC 240B0001 */   addiu    $t3, $zero, 0x1
.L8004EBB0:
/* 29FB0 8004EBB0 90C20054 */  lbu       $v0, 0x54($a2)
/* 29FB4 8004EBB4 00821021 */  addu      $v0, $a0, $v0
/* 29FB8 8004EBB8 9042022A */  lbu       $v0, 0x22A($v0)
/* 29FBC 8004EBBC A0C80052 */  sb        $t0, 0x52($a2)
/* 29FC0 8004EBC0 01024021 */  addu      $t0, $t0, $v0
/* 29FC4 8004EBC4 A0C20051 */  sb        $v0, 0x51($a2)
/* 29FC8 8004EBC8 8CC20000 */  lw        $v0, 0x0($a2)
/* 29FCC 8004EBCC A0C80053 */  sb        $t0, 0x53($a2)
/* 29FD0 8004EBD0 8C830070 */  lw        $v1, 0x70($a0)
/* 29FD4 8004EBD4 ACCC0028 */  sw        $t4, 0x28($a2)
/* 29FD8 8004EBD8 00431021 */  addu      $v0, $v0, $v1
/* 29FDC 8004EBDC ACC20000 */  sw        $v0, 0x0($a2)
.L8004EBE0:
/* 29FE0 8004EBE0 25290001 */  addiu     $t1, $t1, 0x1
/* 29FE4 8004EBE4 29220010 */  slti      $v0, $t1, 0x10
/* 29FE8 8004EBE8 1440FFC4 */  bnez      $v0, .L8004EAFC
/* 29FEC 8004EBEC 254A0060 */   addiu    $t2, $t2, 0x60
/* 29FF0 8004EBF0 11600002 */  beqz      $t3, .L8004EBFC
/* 29FF4 8004EBF4 A088021B */   sb       $t0, 0x21B($a0)
/* 29FF8 8004EBF8 A0800233 */  sb        $zero, 0x233($a0)
.L8004EBFC:
/* 29FFC 8004EBFC 03E00008 */  jr        $ra
/* 2A000 8004EC00 00000000 */   nop

### DECOMPILED C INSTRUCTIONS:

void au_bgm_load_subsegment(BGMPlayer* player, u32 cmd) {
    BGMPlayerTrack* track;
    u32 trackInfo;
    s32* trackList;
    u32 parentIdx;
    s32 count;
    s32 nextRelativePos;
    s32 bUsesPolyphony;
    s32 i;

    nextRelativePos = 0;
    bUsesPolyphony = FALSE;
    player->subSegmentStartPos = AU_FILE_RELATIVE(player->segmentStartPos, (cmd & 0xFFFF) << 2);
    trackList = player->subSegmentStartPos;
    for (i = 0; i < ARRAY_COUNT(player->tracks); i++) {
        track = &player->tracks[i];
        trackInfo = *trackList++;
        track->bgmReadPos = (AuFilePos) (trackInfo >> 0x10);
        if (track->bgmReadPos != NULL) {
            if ((trackInfo & 0x100) == 0) {
                track->polyphonicIdx = (trackInfo & (0x7 << 0xD)) >> 0xD;
                track->isDrumTrack = (trackInfo >> 7) & 1;
                parentIdx = (trackInfo & (0xF << 9)) >> 9;
                track->parentTrackIdx = 0;
                if (parentIdx != 0) {
                    BGMPlayerTrack* parentTrack = &player->tracks[parentIdx - 1];
                    if ((parentIdx - 1) < i) {
                        track->unk_51 = parentTrack->unk_51;
                        track->unk_52 = parentTrack->unk_52;
                        track->unk_53 = parentTrack->unk_53;

                        track->bgmReadPos = (track->bgmReadPos + (s32)player->subSegmentStartPos);
                        track->delayTime = 1;

                        track->parentTrackIdx = parentIdx;
                        if (player->unk_233 != 0) {
                            track->unk_5A = 1;
                        }
                        bUsesPolyphony = TRUE;
                    } else {
                        track->bgmReadPos = NULL;
                    }
                } else {
                    count = player->unk_22A[track->polyphonicIdx];
                    track->unk_51 = count;
                    track->unk_52 = nextRelativePos;
                    nextRelativePos += count;
                    track->unk_53 = nextRelativePos;

                    track->bgmReadPos = (track->bgmReadPos + (s32)player->subSegmentStartPos);
                    track->delayTime = 1;
                }
            } else {
                track->bgmReadPos = NULL;
            }
        }
    }
    player->unk_21B = nextRelativePos; // last Voice?
    if (bUsesPolyphony) {
        player->unk_233 = 0;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_80248024
/* 168884 80248024 3C028025 */  lui       $v0, %hi(D_8024C084)
/* 168888 80248028 8C42C084 */  lw        $v0, %lo(D_8024C084)($v0)
/* 16888C 8024802C 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* 168890 80248030 AFBF0018 */  sw        $ra, 0x18($sp)
.L80248034:
/* 168894 80248034 AFB10014 */  sw        $s1, 0x14($sp)
.L80248038:
/* 168898 80248038 3042C000 */  andi      $v0, $v0, 0xC000
D_8024803C:
/* 16889C 8024803C 10400043 */  beqz      $v0, .L8024814C
.L80248040:
/* 1688A0 80248040 AFB00010 */   sw       $s0, 0x10($sp)
/* 1688A4 80248044 3C118025 */  lui       $s1, %hi(D_80249B84)
.L80248048:
/* 1688A8 80248048 8E319B84 */  lw        $s1, %lo(D_80249B84)($s1)
/* 1688AC 8024804C 3C018025 */  lui       $at, %hi(D_8024C098_C09918)
.L80248050:
/* 1688B0 80248050 A020C098 */  sb        $zero, %lo(D_8024C098_C09918)($at)
D_80248054:
/* 1688B4 80248054 82230004 */  lb        $v1, 0x4($s1)
/* 1688B8 80248058 24020002 */  addiu     $v0, $zero, 0x2
/* 1688BC 8024805C 10620033 */  beq       $v1, $v0, .L8024812C
/* 1688C0 80248060 28620003 */   slti     $v0, $v1, 0x3
.L80248064:
/* 1688C4 80248064 10400005 */  beqz      $v0, .L8024807C
D_80248068:
/* 1688C8 80248068 24020001 */   addiu    $v0, $zero, 0x1
/* 1688CC 8024806C 10620008 */  beq       $v1, $v0, D_80248090
D_80248070:
/* 1688D0 80248070 2404002F */   addiu    $a0, $zero, 0x2F
D_80248074:
/* 1688D4 80248074 08092051 */  j         .L80248144
/* 1688D8 80248078 00000000 */   nop
.L8024807C:
/* 1688DC 8024807C 24020004 */  addiu     $v0, $zero, 0x4
D_80248080:
/* 1688E0 80248080 10620017 */  beq       $v1, $v0, D_802480E0
.L80248084:
/* 1688E4 80248084 2404002F */   addiu    $a0, $zero, 0x2F
D_80248088:
/* 1688E8 80248088 08092051 */  j         .L80248144
.L8024808C:
/* 1688EC 8024808C 00000000 */   nop
D_80248090:
/* 1688F0 80248090 A2200004 */  sb        $zero, 0x4($s1)
/* 1688F4 80248094 3C058024 */  lui       $a1, %hi(func_802433F4)
/* 1688F8 80248098 24A533F4 */  addiu     $a1, $a1, %lo(func_802433F4)
/* 1688FC 8024809C 0C051F9F */  jal       set_window_update
/* 168900 802480A0 24040033 */   addiu    $a0, $zero, 0x33
/* 168904 802480A4 3C058024 */  lui       $a1, %hi(func_80243468)
/* 168908 802480A8 24A53468 */  addiu     $a1, $a1, %lo(func_80243468)
D_802480AC:
/* 16890C 802480AC 0C051F9F */  jal       set_window_update
/* 168910 802480B0 24040034 */   addiu    $a0, $zero, 0x34
/* 168914 802480B4 24040035 */  addiu     $a0, $zero, 0x35
/* 168918 802480B8 3C108024 */  lui       $s0, %hi(D_802434DC)
.L802480BC:
/* 16891C 802480BC 261034DC */  addiu     $s0, $s0, %lo(D_802434DC)
D_802480C0:
/* 168920 802480C0 0C051F9F */  jal       set_window_update
/* 168924 802480C4 0200282D */   daddu    $a1, $s0, $zero
.L802480C8:
/* 168928 802480C8 24040037 */  addiu     $a0, $zero, 0x37
/* 16892C 802480CC 0C051F9F */  jal       set_window_update
/* 168930 802480D0 0200282D */   daddu    $a1, $s0, $zero
/* 168934 802480D4 0220202D */  daddu     $a0, $s1, $zero
/* 168938 802480D8 0809204E */  j         .L80248138
/* 16893C 802480DC 0000282D */   daddu    $a1, $zero, $zero
D_802480E0:
/* 168940 802480E0 A2200004 */  sb        $zero, 0x4($s1)
/* 168944 802480E4 3C058024 */  lui       $a1, %hi(func_802433F4)
/* 168948 802480E8 24A533F4 */  addiu     $a1, $a1, %lo(func_802433F4)
D_802480EC:
/* 16894C 802480EC 0C051F9F */  jal       set_window_update
glabel func_802480F0
/* 168950 802480F0 24040033 */   addiu    $a0, $zero, 0x33
/* 168954 802480F4 3C058024 */  lui       $a1, %hi(func_80243468)
/* 168958 802480F8 24A53468 */  addiu     $a1, $a1, %lo(func_80243468)
/* 16895C 802480FC 0C051F9F */  jal       set_window_update
/* 168960 80248100 24040034 */   addiu    $a0, $zero, 0x34
/* 168964 80248104 24040035 */  addiu     $a0, $zero, 0x35
.L80248108:
/* 168968 80248108 3C108024 */  lui       $s0, %hi(D_802434DC)
D_8024810C:
/* 16896C 8024810C 261034DC */  addiu     $s0, $s0, %lo(D_802434DC)
/* 168970 80248110 0C051F9F */  jal       set_window_update
/* 168974 80248114 0200282D */   daddu    $a1, $s0, $zero
/* 168978 80248118 24040037 */  addiu     $a0, $zero, 0x37
/* 16897C 8024811C 0C051F9F */  jal       set_window_update
/* 168980 80248120 0200282D */   daddu    $a1, $s0, $zero
.L80248124:
/* 168984 80248124 0809204D */  j         .L80248134
/* 168988 80248128 0220202D */   daddu    $a0, $s1, $zero
.L8024812C:
/* 16898C 8024812C A2230004 */  sb        $v1, 0x4($s1)
/* 168990 80248130 0220202D */  daddu     $a0, $s1, $zero
.L80248134:
/* 168994 80248134 24050001 */  addiu     $a1, $zero, 0x1
.L80248138:
/* 168998 80248138 0C090B65 */  jal       func_80242D94
/* 16899C 8024813C 24060002 */   addiu    $a2, $zero, 0x2
/* 1689A0 80248140 2404002F */  addiu     $a0, $zero, 0x2F
.L80248144:
/* 1689A4 80248144 0C051F9F */  jal       set_window_update
.L80248148:
/* 1689A8 80248148 24050002 */   addiu    $a1, $zero, 0x2
.L8024814C:
/* 1689AC 8024814C 8FBF0018 */  lw        $ra, 0x18($sp)
/* 1689B0 80248150 8FB10014 */  lw        $s1, 0x14($sp)
.L80248154:
/* 1689B4 80248154 8FB00010 */  lw        $s0, 0x10($sp)
/* 1689B8 80248158 03E00008 */  jr        $ra
/* 1689BC 8024815C 27BD0020 */   addiu    $sp, $sp, 0x20

### DECOMPILED C INSTRUCTIONS:

void filemenu_info_handle_input(MenuPanel* menu) {
    if (filemenu_pressedButtons & (BUTTON_A | BUTTON_B)) {
        MenuPanel* menu = filemenu_menus[0];

        filemenu_currentMenu = 0;

        switch (menu->page) {
            case PAGE_1:
                menu->page = PAGE_0;
                set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32)filemenu_update_show_options_left);
                set_window_update(WINDOW_ID_FILEMENU_MONO, (s32)filemenu_update_show_options_right);
                set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_show_options_bottom);
                set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom);
                filemenu_set_selected(menu, 0, 2);
                break;
            case PAGE_4:
                menu->page = PAGE_0;
                set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32)filemenu_update_show_options_left);
                set_window_update(WINDOW_ID_FILEMENU_MONO, (s32)filemenu_update_show_options_right);
                set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_show_options_bottom);
                set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom);
                filemenu_set_selected(menu, 1, 2);
                break;
#if !VERSION_PAL
            case PAGE_2:
                menu->page = 2;
                filemenu_set_selected(menu, 1, 2);
                break;
#endif
        }
        set_window_update(WINDOW_ID_FILEMENU_INFO, WINDOW_UPDATE_HIDE);
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_E0112330
/* 3FA180 E0112330 27BDFF48 */  addiu     $sp, $sp, -0xB8
/* 3FA184 E0112334 AFB000A0 */  sw        $s0, 0xA0($sp)
/* 3FA188 E0112338 AFBF00AC */  sw        $ra, 0xAC($sp)
/* 3FA18C E011233C AFB200A8 */  sw        $s2, 0xA8($sp)
/* 3FA190 E0112340 AFB100A4 */  sw        $s1, 0xA4($sp)
/* 3FA194 E0112344 F7B400B0 */  sdc1      $f20, 0xB0($sp)
/* 3FA198 E0112348 1480000F */  bnez      $a0, .LE0112388
/* 3FA19C E011234C 00A0802D */   daddu    $s0, $a1, $zero
/* 3FA1A0 E0112350 3C028007 */  lui       $v0, %hi(gCurrentCameraID)
/* 3FA1A4 E0112354 8C427410 */  lw        $v0, %lo(gCurrentCameraID)($v0)
/* 3FA1A8 E0112358 00021880 */  sll       $v1, $v0, 2
/* 3FA1AC E011235C 00621821 */  addu      $v1, $v1, $v0
/* 3FA1B0 E0112360 00031880 */  sll       $v1, $v1, 2
/* 3FA1B4 E0112364 00621823 */  subu      $v1, $v1, $v0
/* 3FA1B8 E0112368 000310C0 */  sll       $v0, $v1, 3
/* 3FA1BC E011236C 00621821 */  addu      $v1, $v1, $v0
/* 3FA1C0 E0112370 000318C0 */  sll       $v1, $v1, 3
/* 3FA1C4 E0112374 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 3FA1C8 E0112378 00230821 */  addu      $at, $at, $v1
/* 3FA1CC E011237C C4261DEC */  lwc1      $f6, %lo(gCameras + 0x6C)($at)
/* 3FA1D0 E0112380 080448E3 */  j         .LE011238C
/* 3FA1D4 E0112384 00000000 */   nop
.LE0112388:
/* 3FA1D8 E0112388 44803000 */  mtc1      $zero, $f6
.LE011238C:
/* 3FA1DC E011238C C6000018 */  lwc1      $f0, 0x18($s0)
/* 3FA1E0 E0112390 C6040024 */  lwc1      $f4, 0x24($s0)
/* 3FA1E4 E0112394 3C014000 */  lui       $at, (0x40000000 >> 16)
/* 3FA1E8 E0112398 44811000 */  mtc1      $at, $f2
/* 3FA1EC E011239C E7A00010 */  swc1      $f0, 0x10($sp)
/* 3FA1F0 E01123A0 C6000004 */  lwc1      $f0, 0x4($s0)
/* 3FA1F4 E01123A4 4480A000 */  mtc1      $zero, $f20
/* 3FA1F8 E01123A8 46020000 */  add.s     $f0, $f0, $f2
/* 3FA1FC E01123AC 4405A000 */  mfc1      $a1, $f20
/* 3FA200 E01123B0 27A40020 */  addiu     $a0, $sp, 0x20
/* 3FA204 E01123B4 E7A00014 */  swc1      $f0, 0x14($sp)
/* 3FA208 E01123B8 C6000008 */  lwc1      $f0, 0x8($s0)
/* 3FA20C E01123BC 46062101 */  sub.s     $f4, $f4, $f6
/* 3FA210 E01123C0 E7A00018 */  swc1      $f0, 0x18($sp)
/* 3FA214 E01123C4 C600000C */  lwc1      $f0, 0xC($s0)
/* 3FA218 E01123C8 4407A000 */  mfc1      $a3, $f20
/* 3FA21C E01123CC 46020000 */  add.s     $f0, $f0, $f2
/* 3FA220 E01123D0 44062000 */  mfc1      $a2, $f4
/* 3FA224 E01123D4 3C120001 */  lui       $s2, (0x11630 >> 16)
/* 3FA228 E01123D8 0C080180 */  jal       shim_guPositionF
/* 3FA22C E01123DC E7A0001C */   swc1     $f0, 0x1C($sp)
/* 3FA230 E01123E0 4406A000 */  mfc1      $a2, $f20
/* 3FA234 E01123E4 4407A000 */  mfc1      $a3, $f20
/* 3FA238 E01123E8 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 3FA23C E01123EC 44810000 */  mtc1      $at, $f0
/* 3FA240 E01123F0 36521630 */  ori       $s2, $s2, (0x11630 & 0xFFFF)
/* 3FA244 E01123F4 E7A00010 */  swc1      $f0, 0x10($sp)
/* 3FA248 E01123F8 8E050020 */  lw        $a1, 0x20($s0)
/* 3FA24C E01123FC 27B00060 */  addiu     $s0, $sp, 0x60
/* 3FA250 E0112400 0C080104 */  jal       shim_guRotateF
/* 3FA254 E0112404 0200202D */   daddu    $a0, $s0, $zero
/* 3FA258 E0112408 0200202D */  daddu     $a0, $s0, $zero
/* 3FA25C E011240C 27A50020 */  addiu     $a1, $sp, 0x20
/* 3FA260 E0112410 0C080114 */  jal       shim_guMtxCatF
/* 3FA264 E0112414 00A0302D */   daddu    $a2, $a1, $zero
/* 3FA268 E0112418 0200202D */  daddu     $a0, $s0, $zero
/* 3FA26C E011241C 4405A000 */  mfc1      $a1, $f20
/* 3FA270 E0112420 3C07C000 */  lui       $a3, (0xC0000000 >> 16)
/* 3FA274 E0112424 0C080108 */  jal       shim_guTranslateF
/* 3FA278 E0112428 00A0302D */   daddu    $a2, $a1, $zero
/* 3FA27C E011242C 0200202D */  daddu     $a0, $s0, $zero
/* 3FA280 E0112430 27A50020 */  addiu     $a1, $sp, 0x20
/* 3FA284 E0112434 0C080114 */  jal       shim_guMtxCatF
/* 3FA288 E0112438 00A0302D */   daddu    $a2, $a1, $zero
/* 3FA28C E011243C 27A40020 */  addiu     $a0, $sp, 0x20
/* 3FA290 E0112440 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* 3FA294 E0112444 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* 3FA298 E0112448 3C11800A */  lui       $s1, %hi(gDisplayContext)
/* 3FA29C E011244C 2631A674 */  addiu     $s1, $s1, %lo(gDisplayContext)
/* 3FA2A0 E0112450 96050000 */  lhu       $a1, 0x0($s0)
/* 3FA2A4 E0112454 8E220000 */  lw        $v0, 0x0($s1)
/* 3FA2A8 E0112458 00052980 */  sll       $a1, $a1, 6
/* 3FA2AC E011245C 00B22821 */  addu      $a1, $a1, $s2
/* 3FA2B0 E0112460 0C080118 */  jal       shim_guMtxF2L
/* 3FA2B4 E0112464 00452821 */   addu     $a1, $v0, $a1
/* 3FA2B8 E0112468 3C05DA38 */  lui       $a1, (0xDA380002 >> 16)
/* 3FA2BC E011246C 3C04800A */  lui       $a0, %hi(gMainGfxPos)
/* 3FA2C0 E0112470 2484A66C */  addiu     $a0, $a0, %lo(gMainGfxPos)
/* 3FA2C4 E0112474 34A50002 */  ori       $a1, $a1, (0xDA380002 & 0xFFFF)
/* 3FA2C8 E0112478 8C830000 */  lw        $v1, 0x0($a0)
/* 3FA2CC E011247C 96020000 */  lhu       $v0, 0x0($s0)
/* 3FA2D0 E0112480 0060302D */  daddu     $a2, $v1, $zero
/* 3FA2D4 E0112484 24630008 */  addiu     $v1, $v1, 0x8
/* 3FA2D8 E0112488 AC830000 */  sw        $v1, 0x0($a0)
/* 3FA2DC E011248C 24430001 */  addiu     $v1, $v0, 0x1
/* 3FA2E0 E0112490 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 3FA2E4 E0112494 00021180 */  sll       $v0, $v0, 6
/* 3FA2E8 E0112498 ACC50000 */  sw        $a1, 0x0($a2)
/* 3FA2EC E011249C A6030000 */  sh        $v1, 0x0($s0)
/* 3FA2F0 E01124A0 8E230000 */  lw        $v1, 0x0($s1)
/* 3FA2F4 E01124A4 00521021 */  addu      $v0, $v0, $s2
/* 3FA2F8 E01124A8 00621821 */  addu      $v1, $v1, $v0
/* 3FA2FC E01124AC ACC30004 */  sw        $v1, 0x4($a2)
/* 3FA300 E01124B0 8FBF00AC */  lw        $ra, 0xAC($sp)
/* 3FA304 E01124B4 8FB200A8 */  lw        $s2, 0xA8($sp)
/* 3FA308 E01124B8 8FB100A4 */  lw        $s1, 0xA4($sp)
/* 3FA30C E01124BC 8FB000A0 */  lw        $s0, 0xA0($sp)
/* 3FA310 E01124C0 D7B400B0 */  ldc1      $f20, 0xB0($sp)
/* 3FA314 E01124C4 03E00008 */  jr        $ra
/* 3FA318 E01124C8 27BD00B8 */   addiu    $sp, $sp, 0xB8

### DECOMPILED C INSTRUCTIONS:

void func_E0112330(s32 arg0, SpiritCardFXData* data) {
    f32 temp;
    Matrix4f sp20;
    Matrix4f sp60;

    if (arg0 == 0) {
        temp = gCameras[gCurrentCameraID].currentYaw;
    } else {
        temp = 0.0f;
    }

    shim_guPositionF(sp20, 0.0f, data->yaw - temp, 0.0f, data->unk_18, data->pos.x + 2.0f, data->pos.y, data->pos.z + 2.0f);
    shim_guRotateF(sp60, data->unk_20, 0.0f, 0.0f, 1.0f);
    shim_guMtxCatF(sp60, sp20, sp20);
    shim_guTranslateF(sp60, 0.0f, 0.0f, -2.0f);
    shim_guMtxCatF(sp60, sp20, sp20);
    shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);

    gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel kill_script
/* E88EC 802C3F3C 3C03802E */  lui       $v1, %hi(gCurrentScriptListPtr)
/* E88F0 802C3F40 8C63A890 */  lw        $v1, %lo(gCurrentScriptListPtr)($v1)
/* E88F4 802C3F44 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* E88F8 802C3F48 AFB20018 */  sw        $s2, 0x18($sp)
/* E88FC 802C3F4C 0080902D */  daddu     $s2, $a0, $zero
/* E8900 802C3F50 AFB00010 */  sw        $s0, 0x10($sp)
/* E8904 802C3F54 0000802D */  daddu     $s0, $zero, $zero
/* E8908 802C3F58 AFBF001C */  sw        $ra, 0x1C($sp)
/* E890C 802C3F5C AFB10014 */  sw        $s1, 0x14($sp)
.L802C3F60:
/* E8910 802C3F60 8C620000 */  lw        $v0, 0x0($v1)
/* E8914 802C3F64 10520006 */  beq       $v0, $s2, .L802C3F80
/* E8918 802C3F68 2A020080 */   slti     $v0, $s0, 0x80
/* E891C 802C3F6C 26100001 */  addiu     $s0, $s0, 0x1
/* E8920 802C3F70 2A020080 */  slti      $v0, $s0, 0x80
/* E8924 802C3F74 1440FFFA */  bnez      $v0, .L802C3F60
/* E8928 802C3F78 24630004 */   addiu    $v1, $v1, 0x4
/* E892C 802C3F7C 2A020080 */  slti      $v0, $s0, 0x80
.L802C3F80:
/* E8930 802C3F80 10400044 */  beqz      $v0, .L802C4094
/* E8934 802C3F84 00000000 */   nop
/* E8938 802C3F88 8E440068 */  lw        $a0, 0x68($s2)
/* E893C 802C3F8C 10800003 */  beqz      $a0, .L802C3F9C
/* E8940 802C3F90 0000882D */   daddu    $s1, $zero, $zero
/* E8944 802C3F94 0C0B0FCF */  jal       kill_script
/* E8948 802C3F98 00000000 */   nop
.L802C3F9C:
/* E894C 802C3F9C 3C03802E */  lui       $v1, %hi(gCurrentScriptListPtr)
/* E8950 802C3FA0 8C63A890 */  lw        $v1, %lo(gCurrentScriptListPtr)($v1)
/* E8954 802C3FA4 00111080 */  sll       $v0, $s1, 2
/* E8958 802C3FA8 00431021 */  addu      $v0, $v0, $v1
/* E895C 802C3FAC 8C440000 */  lw        $a0, 0x0($v0)
/* E8960 802C3FB0 10800006 */  beqz      $a0, .L802C3FCC
/* E8964 802C3FB4 26310001 */   addiu    $s1, $s1, 0x1
/* E8968 802C3FB8 8C82006C */  lw        $v0, 0x6C($a0)
/* E896C 802C3FBC 14520003 */  bne       $v0, $s2, .L802C3FCC
/* E8970 802C3FC0 00000000 */   nop
/* E8974 802C3FC4 0C0B0FCF */  jal       kill_script
/* E8978 802C3FC8 00000000 */   nop
.L802C3FCC:
/* E897C 802C3FCC 2A220080 */  slti      $v0, $s1, 0x80
/* E8980 802C3FD0 1440FFF2 */  bnez      $v0, .L802C3F9C
/* E8984 802C3FD4 00000000 */   nop
/* E8988 802C3FD8 8E450064 */  lw        $a1, 0x64($s2)
/* E898C 802C3FDC 10A00018 */  beqz      $a1, .L802C4040
/* E8990 802C3FE0 0000882D */   daddu    $s1, $zero, $zero
/* E8994 802C3FE4 0240202D */  daddu     $a0, $s2, $zero
/* E8998 802C3FE8 90A20000 */  lbu       $v0, 0x0($a1)
/* E899C 802C3FEC 00A0182D */  daddu     $v1, $a1, $zero
/* E89A0 802C3FF0 ACA00068 */  sw        $zero, 0x68($a1)
/* E89A4 802C3FF4 304200EF */  andi      $v0, $v0, 0xEF
/* E89A8 802C3FF8 A0A20000 */  sb        $v0, 0x0($a1)
.L802C3FFC:
/* E89AC 802C3FFC 8C820084 */  lw        $v0, 0x84($a0)
/* E89B0 802C4000 24840004 */  addiu     $a0, $a0, 0x4
/* E89B4 802C4004 26310001 */  addiu     $s1, $s1, 0x1
/* E89B8 802C4008 AC620084 */  sw        $v0, 0x84($v1)
/* E89BC 802C400C 2A220010 */  slti      $v0, $s1, 0x10
/* E89C0 802C4010 1440FFFA */  bnez      $v0, .L802C3FFC
/* E89C4 802C4014 24630004 */   addiu    $v1, $v1, 0x4
/* E89C8 802C4018 0000882D */  daddu     $s1, $zero, $zero
/* E89CC 802C401C 0240202D */  daddu     $a0, $s2, $zero
/* E89D0 802C4020 00A0182D */  daddu     $v1, $a1, $zero
.L802C4024:
/* E89D4 802C4024 8C8200C4 */  lw        $v0, 0xC4($a0)
/* E89D8 802C4028 24840004 */  addiu     $a0, $a0, 0x4
/* E89DC 802C402C 26310001 */  addiu     $s1, $s1, 0x1
/* E89E0 802C4030 AC6200C4 */  sw        $v0, 0xC4($v1)
/* E89E4 802C4034 2A220003 */  slti      $v0, $s1, 0x3
/* E89E8 802C4038 1440FFFA */  bnez      $v0, .L802C4024
/* E89EC 802C403C 24630004 */   addiu    $v1, $v1, 0x4
.L802C4040:
/* E89F0 802C4040 8E440060 */  lw        $a0, 0x60($s2)
/* E89F4 802C4044 10800004 */  beqz      $a0, .L802C4058
/* E89F8 802C4048 00000000 */   nop
/* E89FC 802C404C 0C00AB4B */  jal       heap_free
/* E8A00 802C4050 00000000 */   nop
/* E8A04 802C4054 AE400060 */  sw        $zero, 0x60($s2)
.L802C4058:
/* E8A08 802C4058 3C11802E */  lui       $s1, %hi(gCurrentScriptListPtr)
/* E8A0C 802C405C 2631A890 */  addiu     $s1, $s1, %lo(gCurrentScriptListPtr)
/* E8A10 802C4060 8E220000 */  lw        $v0, 0x0($s1)
/* E8A14 802C4064 00108080 */  sll       $s0, $s0, 2
/* E8A18 802C4068 02021021 */  addu      $v0, $s0, $v0
/* E8A1C 802C406C 0C00AB4B */  jal       heap_free
/* E8A20 802C4070 8C440000 */   lw       $a0, 0x0($v0)
/* E8A24 802C4074 3C04802E */  lui       $a0, %hi(gNumScripts)
/* E8A28 802C4078 2484A488 */  addiu     $a0, $a0, %lo(gNumScripts)
/* E8A2C 802C407C 8E230000 */  lw        $v1, 0x0($s1)
/* E8A30 802C4080 8C820000 */  lw        $v0, 0x0($a0)
/* E8A34 802C4084 02038021 */  addu      $s0, $s0, $v1
/* E8A38 802C4088 2442FFFF */  addiu     $v0, $v0, -0x1
/* E8A3C 802C408C AE000000 */  sw        $zero, 0x0($s0)
/* E8A40 802C4090 AC820000 */  sw        $v0, 0x0($a0)
.L802C4094:
/* E8A44 802C4094 8FBF001C */  lw        $ra, 0x1C($sp)
/* E8A48 802C4098 8FB20018 */  lw        $s2, 0x18($sp)
/* E8A4C 802C409C 8FB10014 */  lw        $s1, 0x14($sp)
/* E8A50 802C40A0 8FB00010 */  lw        $s0, 0x10($sp)
/* E8A54 802C40A4 03E00008 */  jr        $ra
/* E8A58 802C40A8 27BD0020 */   addiu    $sp, $sp, 0x20

### DECOMPILED C INSTRUCTIONS:

void kill_script(Evt* instanceToKill) {
    Evt* childScript;
    Evt* blockingParent;
    s32 j;
    s32 i;

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

    if (i >= MAX_SCRIPTS) {
        return;
    }

    childScript = instanceToKill->childScript;
    if (childScript != NULL) {
        kill_script(childScript);
    }

    for (j = 0; j < MAX_SCRIPTS; j++) {
        Evt* tempScriptInstance = (*gCurrentScriptListPtr)[j];
        if (tempScriptInstance != NULL) {
            if (tempScriptInstance->parentScript == instanceToKill) {
                kill_script(tempScriptInstance);
            }
        }
    }

    blockingParent = instanceToKill->blockingParent;
    if (blockingParent != NULL) {
        blockingParent->childScript = NULL;
        blockingParent->stateFlags &= ~EVT_FLAG_BLOCKED_BY_CHILD;

        for (j = 0; j < ARRAY_COUNT(blockingParent->varTable); j++) {
            blockingParent->varTable[j] = instanceToKill->varTable[j];
        }

        for (j = 0; j < ARRAY_COUNT(blockingParent->varFlags); j++) {
            blockingParent->varFlags[j] = instanceToKill->varFlags[j];
        }
    }

    if (instanceToKill->userData != NULL) {
        heap_free(instanceToKill->userData);
        instanceToKill->userData = NULL;
    }

    heap_free((*gCurrentScriptListPtr)[i]);
    (*gCurrentScriptListPtr)[i] = NULL;
    gNumScripts--;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel au_syn_set_volume_delta
/* 32AEC 800576EC 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 32AF0 800576F0 AFB3001C */  sw        $s3, 0x1C($sp)
/* 32AF4 800576F4 00C0982D */  daddu     $s3, $a2, $zero
/* 32AF8 800576F8 AFB20018 */  sw        $s2, 0x18($sp)
/* 32AFC 800576FC 00A0902D */  daddu     $s2, $a1, $zero
/* 32B00 80057700 308400FF */  andi      $a0, $a0, 0xFF
/* 32B04 80057704 00041140 */  sll       $v0, $a0, 5
/* 32B08 80057708 3C038008 */  lui       $v1, %hi(gSynDriverPtr)
/* 32B0C 8005770C 8C638E54 */  lw        $v1, %lo(gSynDriverPtr)($v1)
/* 32B10 80057710 00441023 */  subu      $v0, $v0, $a0
/* 32B14 80057714 AFBF0020 */  sw        $ra, 0x20($sp)
/* 32B18 80057718 AFB10014 */  sw        $s1, 0x14($sp)
/* 32B1C 8005771C AFB00010 */  sw        $s0, 0x10($sp)
/* 32B20 80057720 8C63001C */  lw        $v1, 0x1C($v1)
/* 32B24 80057724 00021080 */  sll       $v0, $v0, 2
/* 32B28 80057728 00628021 */  addu      $s0, $v1, $v0
/* 32B2C 8005772C 8E050064 */  lw        $a1, 0x64($s0)
/* 32B30 80057730 8E030068 */  lw        $v1, 0x68($s0)
/* 32B34 80057734 00A3102A */  slt       $v0, $a1, $v1
/* 32B38 80057738 14400029 */  bnez      $v0, .L800577E0
/* 32B3C 8005773C 26110048 */   addiu    $s1, $s0, 0x48
/* 32B40 80057740 3C028008 */  lui       $v0, %hi(AuSynUseStereo)
/* 32B44 80057744 24428181 */  addiu     $v0, $v0, %lo(AuSynUseStereo)
/* 32B48 80057748 90420000 */  lbu       $v0, 0x0($v0)
/* 32B4C 8005774C 1440000E */  bnez      $v0, .L80057788
/* 32B50 80057750 AE030064 */   sw       $v1, 0x64($s0)
/* 32B54 80057754 3C048008 */  lui       $a0, %hi(AlCosineBlend)
/* 32B58 80057758 24848E60 */  addiu     $a0, $a0, %lo(AlCosineBlend)
/* 32B5C 8005775C 8603004E */  lh        $v1, 0x4E($s0)
/* 32B60 80057760 84820080 */  lh        $v0, 0x80($a0)
/* 32B64 80057764 00620018 */  mult      $v1, $v0
/* 32B68 80057768 00004012 */  mflo      $t0
/* 32B6C 8005776C 000813C3 */  sra       $v0, $t0, 15
/* 32B70 80057770 A6020050 */  sh        $v0, 0x50($s0)
/* 32B74 80057774 84820080 */  lh        $v0, 0x80($a0)
/* 32B78 80057778 00620018 */  mult      $v1, $v0
/* 32B7C 8005777C 00004012 */  mflo      $t0
/* 32B80 80057780 08015E02 */  j         .L80057808
/* 32B84 80057784 000813C3 */   sra      $v0, $t0, 15
.L80057788:
/* 32B88 80057788 8602004C */  lh        $v0, 0x4C($s0)
/* 32B8C 8005778C 8603004E */  lh        $v1, 0x4E($s0)
/* 32B90 80057790 00021040 */  sll       $v0, $v0, 1
/* 32B94 80057794 3C018008 */  lui       $at, %hi(AlCosineBlend)
/* 32B98 80057798 00220821 */  addu      $at, $at, $v0
/* 32B9C 8005779C 84228E60 */  lh        $v0, %lo(AlCosineBlend)($at)
/* 32BA0 800577A0 00620018 */  mult      $v1, $v0
/* 32BA4 800577A4 8603004C */  lh        $v1, 0x4C($s0)
/* 32BA8 800577A8 00004012 */  mflo      $t0
/* 32BAC 800577AC 000813C3 */  sra       $v0, $t0, 15
/* 32BB0 800577B0 A6020050 */  sh        $v0, 0x50($s0)
/* 32BB4 800577B4 2402007F */  addiu     $v0, $zero, 0x7F
/* 32BB8 800577B8 00431023 */  subu      $v0, $v0, $v1
/* 32BBC 800577BC 00021040 */  sll       $v0, $v0, 1
/* 32BC0 800577C0 8603004E */  lh        $v1, 0x4E($s0)
/* 32BC4 800577C4 3C018008 */  lui       $at, %hi(AlCosineBlend)
/* 32BC8 800577C8 00220821 */  addu      $at, $at, $v0
/* 32BCC 800577CC 84228E60 */  lh        $v0, %lo(AlCosineBlend)($at)
/* 32BD0 800577D0 00620018 */  mult      $v1, $v0
/* 32BD4 800577D4 00004012 */  mflo      $t0
/* 32BD8 800577D8 08015E02 */  j         .L80057808
/* 32BDC 800577DC 000813C3 */   sra      $v0, $t0, 15
.L800577E0:
/* 32BE0 800577E0 86040050 */  lh        $a0, 0x50($s0)
/* 32BE4 800577E4 8606005A */  lh        $a2, 0x5A($s0)
/* 32BE8 800577E8 0C016001 */  jal       func_80058004
/* 32BEC 800577EC 96070058 */   lhu      $a3, 0x58($s0)
/* 32BF0 800577F0 86040052 */  lh        $a0, 0x52($s0)
/* 32BF4 800577F4 8E050064 */  lw        $a1, 0x64($s0)
/* 32BF8 800577F8 86060060 */  lh        $a2, 0x60($s0)
/* 32BFC 800577FC 9607005E */  lhu       $a3, 0x5E($s0)
/* 32C00 80057800 0C016001 */  jal       func_80058004
/* 32C04 80057804 A6020050 */   sh       $v0, 0x50($s0)
.L80057808:
/* 32C08 80057808 A6020052 */  sh        $v0, 0x52($s0)
/* 32C0C 8005780C 86220008 */  lh        $v0, 0x8($s1)
/* 32C10 80057810 14400002 */  bnez      $v0, .L8005781C
/* 32C14 80057814 24020001 */   addiu    $v0, $zero, 0x1
/* 32C18 80057818 A6220008 */  sh        $v0, 0x8($s1)
.L8005781C:
/* 32C1C 8005781C 8622000A */  lh        $v0, 0xA($s1)
/* 32C20 80057820 14400004 */  bnez      $v0, .L80057834
/* 32C24 80057824 00121400 */   sll      $v0, $s2, 16
/* 32C28 80057828 24020001 */  addiu     $v0, $zero, 0x1
/* 32C2C 8005782C A622000A */  sh        $v0, 0xA($s1)
/* 32C30 80057830 00121400 */  sll       $v0, $s2, 16
.L80057834:
/* 32C34 80057834 00021403 */  sra       $v0, $v0, 16
/* 32C38 80057838 00420018 */  mult      $v0, $v0
/* 32C3C 8005783C 24020001 */  addiu     $v0, $zero, 0x1
/* 32C40 80057840 AE20001C */  sw        $zero, 0x1C($s1)
/* 32C44 80057844 AE330020 */  sw        $s3, 0x20($s1)
/* 32C48 80057848 AE220024 */  sw        $v0, 0x24($s1)
/* 32C4C 8005784C 00004012 */  mflo      $t0
/* 32C50 80057850 000813C3 */  sra       $v0, $t0, 15
/* 32C54 80057854 A6220006 */  sh        $v0, 0x6($s1)
/* 32C58 80057858 8FBF0020 */  lw        $ra, 0x20($sp)
/* 32C5C 8005785C 8FB3001C */  lw        $s3, 0x1C($sp)
/* 32C60 80057860 8FB20018 */  lw        $s2, 0x18($sp)
/* 32C64 80057864 8FB10014 */  lw        $s1, 0x14($sp)
/* 32C68 80057868 8FB00010 */  lw        $s0, 0x10($sp)
/* 32C6C 8005786C 03E00008 */  jr        $ra
/* 32C70 80057870 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

void au_syn_set_volume_delta(u8 voiceIdx, s16 vol, s32 delta) {
    AuPVoice* pvoice = &gSynDriverPtr->pvoices[voiceIdx];
    AuEnvMixer* envMixer = &pvoice->envMixer;

    if (envMixer->delta >= envMixer->segEnd) {
        envMixer->delta = envMixer->segEnd;
        if (!AuSynUseStereo) {
            envMixer->cvolL = (envMixer->volume * AuEqPower[AU_EQPOW_MID_IDX]) >> 0xF;
            envMixer->cvolR = (envMixer->volume * AuEqPower[AU_EQPOW_MID_IDX]) >> 0xF;
        } else {
            envMixer->cvolL = (envMixer->volume * AuEqPower[envMixer->pan]) >> 0xF;
            envMixer->cvolR = (envMixer->volume * AuEqPower[AU_EQPOW_MAX_IDX - envMixer->pan]) >> 0xF;
        }
    } else {
        envMixer->cvolL = _getVol(envMixer->cvolL, envMixer->delta, envMixer->lratm, envMixer->lratl);
        envMixer->cvolR = _getVol(envMixer->cvolR, envMixer->delta, envMixer->rratm, envMixer->rratl);
    }
    if (envMixer->cvolL == 0) {
        envMixer->cvolL = 1;
    }
    if (envMixer->cvolR == 0) {
        envMixer->cvolR = 1;
    }

    envMixer->volume = SQ(vol) >> 0xF;
    envMixer->delta = 0;
    envMixer->segEnd = delta;
    envMixer->first = 1;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_80245808
/* 166068 80245808 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 16606C 8024580C AFB3001C */  sw        $s3, 0x1C($sp)
/* 166070 80245810 0080982D */  daddu     $s3, $a0, $zero
D_80245814:
/* 166074 80245814 AFB00010 */  sw        $s0, 0x10($sp)
/* 166078 80245818 0000802D */  daddu     $s0, $zero, $zero
/* 16607C 8024581C AFB20018 */  sw        $s2, 0x18($sp)
/* 166080 80245820 3C128025 */  lui       $s2, %hi(D_8024C0B0)
/* 166084 80245824 2652C0B0 */  addiu     $s2, $s2, %lo(D_8024C0B0)
glabel .L80245828
/* 166088 80245828 AFB10014 */  sw        $s1, 0x14($sp)
/* 16608C 8024582C 3C118025 */  lui       $s1, %hi(D_80249E20)
D_80245830:
/* 166090 80245830 26319E20 */  addiu     $s1, $s1, %lo(D_80249E20)
/* 166094 80245834 AFBF0020 */  sw        $ra, 0x20($sp)
D_80245838:
/* 166098 80245838 8E240000 */  lw        $a0, 0x0($s1)
/* 16609C 8024583C 26310004 */  addiu     $s1, $s1, 0x4
D_80245840:
/* 1660A0 80245840 0C050529 */  jal       hud_element_create
.L80245844:
/* 1660A4 80245844 26100001 */   addiu    $s0, $s0, 0x1
D_80245848:
/* 1660A8 80245848 0040202D */  daddu     $a0, $v0, $zero
/* 1660AC 8024584C 24050080 */  addiu     $a1, $zero, 0x80
D_80245850:
/* 1660B0 80245850 0C051280 */  jal       hud_element_set_flags
/* 1660B4 80245854 AE440000 */   sw       $a0, 0x0($s2)
D_80245858:
/* 1660B8 80245858 2A020014 */  slti      $v0, $s0, 0x14
/* 1660BC 8024585C 1440FFF6 */  bnez      $v0, D_80245838
D_80245860:
/* 1660C0 80245860 26520004 */   addiu    $s2, $s2, 0x4
/* 1660C4 80245864 2410000D */  addiu     $s0, $zero, 0xD
D_80245868:
/* 1660C8 80245868 3C028025 */  lui       $v0, %hi(D_8024A074)
.L8024586C:
/* 1660CC 8024586C 2442A074 */  addiu     $v0, $v0, %lo(D_8024A074)
.L80245870:
/* 1660D0 80245870 AC530010 */  sw        $s3, 0x10($v0)
/* 1660D4 80245874 2610FFFF */  addiu     $s0, $s0, -0x1
/* 1660D8 80245878 0601FFFD */  bgez      $s0, .L80245870
/* 1660DC 8024587C 2442FFDC */   addiu    $v0, $v0, -0x24
/* 1660E0 80245880 3C048025 */  lui       $a0, %hi(.L80249EA0)
/* 1660E4 80245884 24849EA0 */  addiu     $a0, $a0, %lo(.L80249EA0)
/* 1660E8 80245888 0C051FCC */  jal       setup_pause_menu_tab
/* 1660EC 8024588C 2405000E */   addiu    $a1, $zero, 0xE
/* 1660F0 80245890 82620004 */  lb        $v0, 0x4($s3)
/* 1660F4 80245894 82630005 */  lb        $v1, 0x5($s3)
/* 1660F8 80245898 00430018 */  mult      $v0, $v1
glabel .L8024589C
/* 1660FC 8024589C 00003012 */  mflo      $a2
/* 166100 802458A0 82620006 */  lb        $v0, 0x6($s3)
D_802458A4:
/* 166104 802458A4 00000000 */  nop
D_802458A8:
/* 166108 802458A8 00C20018 */  mult      $a2, $v0
D_802458AC:
/* 16610C 802458AC 00002012 */  mflo      $a0
jtbl_802458B0:
/* 166110 802458B0 82620002 */  lb        $v0, 0x2($s3)
D_802458B4:
/* 166114 802458B4 00000000 */  nop
/* 166118 802458B8 00620018 */  mult      $v1, $v0
/* 16611C 802458BC 00001812 */  mflo      $v1
jtbl_802458C0:
/* 166120 802458C0 00831821 */  addu      $v1, $a0, $v1
/* 166124 802458C4 82640001 */  lb        $a0, 0x1($s3)
D_802458C8:
/* 166128 802458C8 8E620008 */  lw        $v0, 0x8($s3)
/* 16612C 802458CC 00641821 */  addu      $v1, $v1, $a0
/* 166130 802458D0 00431021 */  addu      $v0, $v0, $v1
.L802458D4:
/* 166134 802458D4 90420000 */  lbu       $v0, 0x0($v0)
.L802458D8:
/* 166138 802458D8 82630004 */  lb        $v1, 0x4($s3)
/* 16613C 802458DC A2620003 */  sb        $v0, 0x3($s3)
/* 166140 802458E0 24020002 */  addiu     $v0, $zero, 0x2
/* 166144 802458E4 14620006 */  bne       $v1, $v0, .L80245900
.L802458E8:
/* 166148 802458E8 24020001 */   addiu    $v0, $zero, 0x1
/* 16614C 802458EC 3C038016 */  lui       $v1, %hi(gWindows)
D_802458F0:
/* 166150 802458F0 24639D50 */  addiu     $v1, $v1, %lo(gWindows)
/* 166154 802458F4 A46205AE */  sh        $v0, 0x5AE($v1)
/* 166158 802458F8 08091644 */  j         .L80245910
/* 16615C 802458FC 240200D3 */   addiu    $v0, $zero, 0xD3
.L80245900:
/* 166160 80245900 3C038016 */  lui       $v1, %hi(gWindows)
D_80245904:
/* 166164 80245904 24639D50 */  addiu     $v1, $v1, %lo(gWindows)
/* 166168 80245908 A46205AE */  sh        $v0, 0x5AE($v1)
/* 16616C 8024590C 240200A2 */  addiu     $v0, $zero, 0xA2
.L80245910:
/* 166170 80245910 A46205B0 */  sh        $v0, 0x5B0($v1)
D_80245914:
/* 166174 80245914 24020019 */  addiu     $v0, $zero, 0x19
D_80245918:
/* 166178 80245918 A46205B2 */  sh        $v0, 0x5B2($v1)
/* 16617C 8024591C 3C048016 */  lui       $a0, %hi(gWindows)
/* 166180 80245920 24849D50 */  addiu     $a0, $a0, %lo(gWindows)
.L80245924:
/* 166184 80245924 948205B0 */  lhu       $v0, 0x5B0($a0)
D_80245928:
/* 166188 80245928 00021400 */  sll       $v0, $v0, 16

### DECOMPILED C INSTRUCTIONS:

void filemenu_main_init(MenuPanel* menu) {
    s32 halfWidth;
    s32 halfWidth2;
    s16* posXPtr;
    s32 x;
    s32 i;

    for (i = 0; i < ARRAY_COUNT(filemenu_hudElemIDs); i++) {
        filemenu_hudElemIDs[i] = hud_element_create(filemenu_main_hudElemScripts[i]);
        hud_element_set_flags(filemenu_hudElemIDs[i], HUD_ELEMENT_FLAG_80);
    }

    for (i = 0; i < ARRAY_COUNT(filemenu_main_windowBPs); i++) {
        filemenu_main_windowBPs[i].tab = menu;
    }

    setup_pause_menu_tab(filemenu_main_windowBPs, ARRAY_COUNT(filemenu_main_windowBPs));
    menu->selected = MENU_PANEL_SELECTED_GRID_DATA(menu);

    if (menu->page == 2) {
        gWindows[WINDOW_ID_FILEMENU_TITLE].pos.y = 1;
        gWindows[WINDOW_ID_FILEMENU_TITLE].width = 211;
        gWindows[WINDOW_ID_FILEMENU_TITLE].height = 25;
    } else {
        gWindows[WINDOW_ID_FILEMENU_TITLE].pos.y = 1;
        gWindows[WINDOW_ID_FILEMENU_TITLE].width = 162;
        gWindows[WINDOW_ID_FILEMENU_TITLE].height = 25;
    }

    halfWidth = gWindows[WINDOW_ID_FILEMENU_TITLE].width / 2;
    posXPtr = &gWindows[WINDOW_ID_FILEMENU_TITLE].pos.x;
    if (gWindows[WINDOW_ID_FILEMENU_TITLE].parent != -1) {
        x = (gWindows[gWindows[WINDOW_ID_FILEMENU_TITLE].parent].width / 2) - halfWidth;
    } else {
        x = 160 - halfWidth;
    }
    *posXPtr = x;

    halfWidth2 = gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].width / 2;
    posXPtr = &gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].pos.x;
    if (gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].parent != -1) {
        x = (gWindows[gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].parent].width / 2) - halfWidth2;
    } else {
        x = 160 - halfWidth2;
    }
    *posXPtr = x;

    if (menu->page != 0) {
        set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, WINDOW_UPDATE_HIDE);
        set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, WINDOW_UPDATE_HIDE);
        set_window_update(WINDOW_ID_FILEMENU_STEREO, WINDOW_UPDATE_HIDE);
        set_window_update(WINDOW_ID_FILEMENU_MONO, WINDOW_UPDATE_HIDE);
    }
    menu->initialized = 1;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel entity_HiddenPanel_setupGfx
/* 107A30 802E61B0 27BDFF58 */  addiu     $sp, $sp, -0xA8
/* 107A34 802E61B4 AFBF00A4 */  sw        $ra, 0xA4($sp)
/* 107A38 802E61B8 AFB400A0 */  sw        $s4, 0xA0($sp)
/* 107A3C 802E61BC AFB3009C */  sw        $s3, 0x9C($sp)
/* 107A40 802E61C0 AFB20098 */  sw        $s2, 0x98($sp)
/* 107A44 802E61C4 AFB10094 */  sw        $s1, 0x94($sp)
/* 107A48 802E61C8 0C04417A */  jal       get_entity_by_index
/* 107A4C 802E61CC AFB00090 */   sw       $s0, 0x90($sp)
/* 107A50 802E61D0 0040982D */  daddu     $s3, $v0, $zero
/* 107A54 802E61D4 8E740040 */  lw        $s4, 0x40($s3)
/* 107A58 802E61D8 C662004C */  lwc1      $f2, 0x4C($s3)
/* 107A5C 802E61DC C6800024 */  lwc1      $f0, 0x24($s4)
/* 107A60 802E61E0 46001032 */  c.eq.s    $f2, $f0
/* 107A64 802E61E4 00000000 */  nop
/* 107A68 802E61E8 45010041 */  bc1t      .L802E62F0
/* 107A6C 802E61EC 00000000 */   nop
/* 107A70 802E61F0 0C019D28 */  jal       guMtxIdentF
/* 107A74 802E61F4 27A40010 */   addiu    $a0, $sp, 0x10
/* 107A78 802E61F8 27B00050 */  addiu     $s0, $sp, 0x50
/* 107A7C 802E61FC 0200202D */  daddu     $a0, $s0, $zero
/* 107A80 802E6200 C6820024 */  lwc1      $f2, 0x24($s4)
/* 107A84 802E6204 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 107A88 802E6208 44810000 */  mtc1      $at, $f0
/* 107A8C 802E620C 3C120001 */  lui       $s2, (0x11630 >> 16)
/* 107A90 802E6210 46001080 */  add.s     $f2, $f2, $f0
/* 107A94 802E6214 8E650048 */  lw        $a1, 0x48($s3)
/* 107A98 802E6218 8E670050 */  lw        $a3, 0x50($s3)
/* 107A9C 802E621C 44061000 */  mfc1      $a2, $f2
/* 107AA0 802E6220 0C019E40 */  jal       guTranslateF
/* 107AA4 802E6224 36521630 */   ori      $s2, $s2, (0x11630 & 0xFFFF)
/* 107AA8 802E6228 0200202D */  daddu     $a0, $s0, $zero
/* 107AAC 802E622C 27A50010 */  addiu     $a1, $sp, 0x10
/* 107AB0 802E6230 0C019D80 */  jal       guMtxCatF
/* 107AB4 802E6234 0200302D */   daddu    $a2, $s0, $zero
/* 107AB8 802E6238 0200202D */  daddu     $a0, $s0, $zero
/* 107ABC 802E623C 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* 107AC0 802E6240 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* 107AC4 802E6244 3C11800A */  lui       $s1, %hi(gDisplayContext)
/* 107AC8 802E6248 2631A674 */  addiu     $s1, $s1, %lo(gDisplayContext)
/* 107ACC 802E624C 96050000 */  lhu       $a1, 0x0($s0)
/* 107AD0 802E6250 8E220000 */  lw        $v0, 0x0($s1)
/* 107AD4 802E6254 00052980 */  sll       $a1, $a1, 6
/* 107AD8 802E6258 00B22821 */  addu      $a1, $a1, $s2
/* 107ADC 802E625C 0C019D40 */  jal       guMtxF2L
/* 107AE0 802E6260 00452821 */   addu     $a1, $v0, $a1
/* 107AE4 802E6264 3C03DA38 */  lui       $v1, (0xDA380002 >> 16)
/* 107AE8 802E6268 34630002 */  ori       $v1, $v1, (0xDA380002 & 0xFFFF)
/* 107AEC 802E626C 3C07D838 */  lui       $a3, (0xD8380002 >> 16)
/* 107AF0 802E6270 3C05800A */  lui       $a1, %hi(gMainGfxPos)
/* 107AF4 802E6274 24A5A66C */  addiu     $a1, $a1, %lo(gMainGfxPos)
/* 107AF8 802E6278 34E70002 */  ori       $a3, $a3, (0xD8380002 & 0xFFFF)
/* 107AFC 802E627C 8CA40000 */  lw        $a0, 0x0($a1)
/* 107B00 802E6280 96020000 */  lhu       $v0, 0x0($s0)
/* 107B04 802E6284 0080302D */  daddu     $a2, $a0, $zero
/* 107B08 802E6288 24840008 */  addiu     $a0, $a0, 0x8
/* 107B0C 802E628C ACA40000 */  sw        $a0, 0x0($a1)
/* 107B10 802E6290 ACC30000 */  sw        $v1, 0x0($a2)
/* 107B14 802E6294 24430001 */  addiu     $v1, $v0, 0x1
/* 107B18 802E6298 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 107B1C 802E629C 00021180 */  sll       $v0, $v0, 6
/* 107B20 802E62A0 A6030000 */  sh        $v1, 0x0($s0)
/* 107B24 802E62A4 8E230000 */  lw        $v1, 0x0($s1)
/* 107B28 802E62A8 00521021 */  addu      $v0, $v0, $s2
/* 107B2C 802E62AC 00621821 */  addu      $v1, $v1, $v0
/* 107B30 802E62B0 24820008 */  addiu     $v0, $a0, 0x8
/* 107B34 802E62B4 ACC30004 */  sw        $v1, 0x4($a2)
/* 107B38 802E62B8 ACA20000 */  sw        $v0, 0x0($a1)
/* 107B3C 802E62BC 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 107B40 802E62C0 AC820000 */  sw        $v0, 0x0($a0)
/* 107B44 802E62C4 8E630044 */  lw        $v1, 0x44($s3)
/* 107B48 802E62C8 24820010 */  addiu     $v0, $a0, 0x10
/* 107B4C 802E62CC ACA20000 */  sw        $v0, 0x0($a1)
/* 107B50 802E62D0 24020040 */  addiu     $v0, $zero, 0x40
/* 107B54 802E62D4 AC82000C */  sw        $v0, 0xC($a0)
/* 107B58 802E62D8 3C020A00 */  lui       $v0, %hi(D_0A000230_E9D880)
/* 107B5C 802E62DC 24420230 */  addiu     $v0, $v0, %lo(D_0A000230_E9D880)
/* 107B60 802E62E0 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 107B64 802E62E4 AC870008 */  sw        $a3, 0x8($a0)
/* 107B68 802E62E8 00621821 */  addu      $v1, $v1, $v0
/* 107B6C 802E62EC AC830004 */  sw        $v1, 0x4($a0)
.L802E62F0:
/* 107B70 802E62F0 96840074 */  lhu       $a0, 0x74($s4)
/* 107B74 802E62F4 8E850078 */  lw        $a1, 0x78($s4)
/* 107B78 802E62F8 8E670044 */  lw        $a3, 0x44($s3)
/* 107B7C 802E62FC 0C0470CB */  jal       mdl_project_tex_coords
/* 107B80 802E6300 26860034 */   addiu    $a2, $s4, 0x34
/* 107B84 802E6304 96850074 */  lhu       $a1, 0x74($s4)
/* 107B88 802E6308 3C04800A */  lui       $a0, %hi(gMainGfxPos)
/* 107B8C 802E630C 2484A66C */  addiu     $a0, $a0, %lo(gMainGfxPos)
/* 107B90 802E6310 0C0475CB */  jal       mdl_draw_hidden_panel_surface
/* 107B94 802E6314 00000000 */   nop
/* 107B98 802E6318 8FBF00A4 */  lw        $ra, 0xA4($sp)
/* 107B9C 802E631C 8FB400A0 */  lw        $s4, 0xA0($sp)
/* 107BA0 802E6320 8FB3009C */  lw        $s3, 0x9C($sp)
/* 107BA4 802E6324 8FB20098 */  lw        $s2, 0x98($sp)
/* 107BA8 802E6328 8FB10094 */  lw        $s1, 0x94($sp)
/* 107BAC 802E632C 8FB00090 */  lw        $s0, 0x90($sp)
/* 107BB0 802E6330 03E00008 */  jr        $ra
/* 107BB4 802E6334 27BD00A8 */   addiu    $sp, $sp, 0xA8

### DECOMPILED C INSTRUCTIONS:

void entity_HiddenPanel_setupGfx(s32 entityIndex) {
    Entity* entity = get_entity_by_index(entityIndex);
    HiddenPanelData* data = entity->dataBuf.hiddenPanel;
    Matrix4f rotMtx;
    Matrix4f tempMtx;

    if (entity->position.y != data->initialY) {
        guMtxIdentF(rotMtx);
        guTranslateF(tempMtx, entity->position.x, data->initialY + 1.0f, entity->position.z);
        guMtxCatF(tempMtx, rotMtx, tempMtx);
        guMtxF2L(tempMtx, &gDisplayContext->matrixStack[gMatrixListPos]);
        gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
        gSPDisplayList(gMainGfxPos++, ENTITY_ADDR(entity, Gfx*, Gfx_HiddenPanel_RenderHole));
        gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    }
    mdl_project_tex_coords(data->modelID, data->renderDList, data->entityMatrix, entity->gfxBaseAddr);
    mdl_draw_hidden_panel_surface(&gMainGfxPos, data->modelID);
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel D_8024ECB0_C0C530
/* 141FF0 8024ECB0 27BDFFB8 */  addiu     $sp, $sp, -0x48
/* 141FF4 8024ECB4 F7B40028 */  sdc1      $f20, 0x28($sp)
/* 141FF8 8024ECB8 3C01461C */  lui       $at, (0x461C4000 >> 16)
/* 141FFC 8024ECBC 34214000 */  ori       $at, $at, (0x461C4000 & 0xFFFF)
/* 142000 8024ECC0 4481A000 */  mtc1      $at, $f20
/* 142004 8024ECC4 AFB10014 */  sw        $s1, 0x14($sp)
/* 142008 8024ECC8 3C118025 */  lui       $s1, %hi(D_802502B8)
/* 14200C 8024ECCC 263102B8 */  addiu     $s1, $s1, %lo(D_802502B8)
/* 142010 8024ECD0 AFB00010 */  sw        $s0, 0x10($sp)
/* 142014 8024ECD4 0000802D */  daddu     $s0, $zero, $zero
/* 142018 8024ECD8 AFB3001C */  sw        $s3, 0x1C($sp)
/* 14201C 8024ECDC 3C13F840 */  lui       $s3, (0xF840632A >> 16)
/* 142020 8024ECE0 F7B60030 */  sdc1      $f22, 0x30($sp)
/* 142024 8024ECE4 3C01BF80 */  lui       $at, (0xBF800000 >> 16)
D_8024ECE8:
/* 142028 8024ECE8 4481B000 */  mtc1      $at, $f22
.L8024ECEC:
/* 14202C 8024ECEC 3673632A */  ori       $s3, $s3, (0xF840632A & 0xFFFF)
/* 142030 8024ECF0 F7BA0040 */  sdc1      $f26, 0x40($sp)
/* 142034 8024ECF4 3C0143C8 */  lui       $at, (0x43C80000 >> 16)
glabel func_8024ECF8
/* 142038 8024ECF8 4481D000 */  mtc1      $at, $f26
/* 14203C 8024ECFC 3C028027 */  lui       $v0, %hi(gPauseMapSpacesInSnapRange)
/* 142040 8024ED00 24420724 */  addiu     $v0, $v0, %lo(gPauseMapSpacesInSnapRange)
/* 142044 8024ED04 AFB20018 */  sw        $s2, 0x18($sp)
/* 142048 8024ED08 0040902D */  daddu     $s2, $v0, $zero
/* 14204C 8024ED0C F7B80038 */  sdc1      $f24, 0x38($sp)
/* 142050 8024ED10 3C014348 */  lui       $at, (0x43480000 >> 16)
/* 142054 8024ED14 4481C000 */  mtc1      $at, $f24
/* 142058 8024ED18 2402FFFF */  addiu     $v0, $zero, -0x1
/* 14205C 8024ED1C AFBF0020 */  sw        $ra, 0x20($sp)
/* 142060 8024ED20 3C018027 */  lui       $at, %hi(gPauseMapCursorCurrentOption)
/* 142064 8024ED24 AC22071C */  sw        $v0, %lo(gPauseMapCursorCurrentOption)($at)
/* 142068 8024ED28 AE400000 */  sw        $zero, 0x0($s2)
.L8024ED2C:
/* 14206C 8024ED2C 0000202D */  daddu     $a0, $zero, $zero
/* 142070 8024ED30 0C0B1EAF */  jal       evt_get_variable
/* 142074 8024ED34 02132821 */   addu     $a1, $s0, $s3
/* 142078 8024ED38 50400028 */  beql      $v0, $zero, .L8024EDDC
/* 14207C 8024ED3C 26100001 */   addiu    $s0, $s0, 0x1
/* 142080 8024ED40 86220000 */  lh        $v0, 0x0($s1)
/* 142084 8024ED44 3C018027 */  lui       $at, %hi(gPauseMapTargetX)
/* 142088 8024ED48 C4240714 */  lwc1      $f4, %lo(gPauseMapTargetX)($at)
D_8024ED4C:
/* 14208C 8024ED4C 44820000 */  mtc1      $v0, $f0
D_8024ED50:
/* 142090 8024ED50 00000000 */  nop
/* 142094 8024ED54 46800020 */  cvt.s.w   $f0, $f0
/* 142098 8024ED58 46002101 */  sub.s     $f4, $f4, $f0
/* 14209C 8024ED5C 46042102 */  mul.s     $f4, $f4, $f4
/* 1420A0 8024ED60 00000000 */  nop
.L8024ED64:
/* 1420A4 8024ED64 86220002 */  lh        $v0, 0x2($s1)
/* 1420A8 8024ED68 3C018027 */  lui       $at, %hi(gPauseMapTargetY)
/* 1420AC 8024ED6C C4200718 */  lwc1      $f0, %lo(gPauseMapTargetY)($at)
/* 1420B0 8024ED70 44821000 */  mtc1      $v0, $f2
/* 1420B4 8024ED74 00000000 */  nop
glabel func_8024ED78
/* 1420B8 8024ED78 468010A0 */  cvt.s.w   $f2, $f2
/* 1420BC 8024ED7C 46020001 */  sub.s     $f0, $f0, $f2
/* 1420C0 8024ED80 46000002 */  mul.s     $f0, $f0, $f0
/* 1420C4 8024ED84 00000000 */  nop
/* 1420C8 8024ED88 46002100 */  add.s     $f4, $f4, $f0
/* 1420CC 8024ED8C 461A203C */  c.lt.s    $f4, $f26
/* 1420D0 8024ED90 00000000 */  nop
/* 1420D4 8024ED94 45000004 */  bc1f      .L8024EDA8
/* 1420D8 8024ED98 00000000 */   nop
/* 1420DC 8024ED9C 8E420000 */  lw        $v0, 0x0($s2)
/* 1420E0 8024EDA0 24420001 */  addiu     $v0, $v0, 0x1
glabel func_8024EDA4
/* 1420E4 8024EDA4 AE420000 */  sw        $v0, 0x0($s2)
.L8024EDA8:
/* 1420E8 8024EDA8 4614203C */  c.lt.s    $f4, $f20
/* 1420EC 8024EDAC 00000000 */  nop
/* 1420F0 8024EDB0 4502000A */  bc1fl     .L8024EDDC
/* 1420F4 8024EDB4 26100001 */   addiu    $s0, $s0, 0x1
/* 1420F8 8024EDB8 4618203C */  c.lt.s    $f4, $f24
/* 1420FC 8024EDBC 00000000 */  nop
glabel func_8024EDC0
/* 142100 8024EDC0 45020006 */  bc1fl     .L8024EDDC
/* 142104 8024EDC4 26100001 */   addiu    $s0, $s0, 0x1
/* 142108 8024EDC8 46002506 */  mov.s     $f20, $f4
.L8024EDCC:
/* 14210C 8024EDCC 4490B000 */  mtc1      $s0, $f22
/* 142110 8024EDD0 00000000 */  nop
/* 142114 8024EDD4 4680B5A0 */  cvt.s.w   $f22, $f22
/* 142118 8024EDD8 26100001 */  addiu     $s0, $s0, 0x1
.L8024EDDC:
/* 14211C 8024EDDC 2A020022 */  slti      $v0, $s0, 0x22
/* 142120 8024EDE0 1440FFD2 */  bnez      $v0, .L8024ED2C
/* 142124 8024EDE4 26310014 */   addiu    $s1, $s1, 0x14
/* 142128 8024EDE8 4600B18D */  trunc.w.s $f6, $f22
glabel func_8024EDEC
/* 14212C 8024EDEC 44023000 */  mfc1      $v0, $f6
/* 142130 8024EDF0 8FBF0020 */  lw        $ra, 0x20($sp)
/* 142134 8024EDF4 8FB3001C */  lw        $s3, 0x1C($sp)
/* 142138 8024EDF8 8FB20018 */  lw        $s2, 0x18($sp)
/* 14213C 8024EDFC 8FB10014 */  lw        $s1, 0x14($sp)
/* 142140 8024EE00 8FB00010 */  lw        $s0, 0x10($sp)
/* 142144 8024EE04 D7BA0040 */  ldc1      $f26, 0x40($sp)
.L8024EE08:
/* 142148 8024EE08 D7B80038 */  ldc1      $f24, 0x38($sp)
/* 14214C 8024EE0C D7B60030 */  ldc1      $f22, 0x30($sp)
/* 142150 8024EE10 D7B40028 */  ldc1      $f20, 0x28($sp)
/* 142154 8024EE14 3C018027 */  lui       $at, %hi(gPauseMapCursorCurrentOption)
D_8024EE18_C0C698:
/* 142158 8024EE18 AC22071C */  sw        $v0, %lo(gPauseMapCursorCurrentOption)($at)
/* 14215C 8024EE1C 3C018027 */  lui       $at, %hi(gPauseMapCursorCurrentOptionCopy)
/* 142160 8024EE20 AC220720 */  sw        $v0, %lo(gPauseMapCursorCurrentOptionCopy)($at)
.L8024EE24:
/* 142164 8024EE24 03E00008 */  jr        $ra
/* 142168 8024EE28 27BD0048 */   addiu    $sp, $sp, 0x48

### DECOMPILED C INSTRUCTIONS:

void pause_map_update(MenuPanel* tab) {
    PauseMapSpace* mapSpace = &gPauseMapSpaces[0];
    f32 lowestSqSum = 10000.0f;
    f32 cursorOption = -1.0f;
    s32 i;

    gPauseMapCursorCurrentOption = -1;
    gPauseMapSpacesInSnapRange = 0;

    for (i = 0; i < ARRAY_COUNT(gPauseMapSpaces); i++, mapSpace++) {
        if (evt_get_variable(0, GF_MAP_ToadTown + i) != 0) {
            f32 deltaX = gPauseMapTargetX - mapSpace->pos.x;
            f32 deltaY = gPauseMapTargetY - mapSpace->pos.y;
            f32 sqSum = SQ(deltaX) + SQ(deltaY);

            if (sqSum < 400.0f) {
                gPauseMapSpacesInSnapRange++;
            }

            if (sqSum < lowestSqSum && sqSum < 200.0f) {
                lowestSqSum = sqSum;
                cursorOption = i;
            }
        }
    }

    gPauseMapCursorCurrentOption = cursorOption;
    gPauseMapCursorCurrentOptionCopy = cursorOption;
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_80244A4C
/* 137D8C 80244A4C 27BDFFC8 */  addiu     $sp, $sp, -0x38
D_80244A50:
/* 137D90 80244A50 AFB60028 */  sw        $s6, 0x28($sp)
D_80244A54:
/* 137D94 80244A54 0080B02D */  daddu     $s6, $a0, $zero
glabel .L80244A58
/* 137D98 80244A58 AFB7002C */  sw        $s7, 0x2C($sp)
/* 137D9C 80244A5C 00C0B82D */  daddu     $s7, $a2, $zero
D_80244A60:
/* 137DA0 80244A60 28A20002 */  slti      $v0, $a1, 0x2
/* 137DA4 80244A64 AFBF0030 */  sw        $ra, 0x30($sp)
D_80244A68:
/* 137DA8 80244A68 AFB50024 */  sw        $s5, 0x24($sp)
D_80244A6C:
/* 137DAC 80244A6C AFB40020 */  sw        $s4, 0x20($sp)
D_80244A70:
/* 137DB0 80244A70 AFB3001C */  sw        $s3, 0x1C($sp)
D_80244A74:
/* 137DB4 80244A74 AFB20018 */  sw        $s2, 0x18($sp)
D_80244A78:
/* 137DB8 80244A78 AFB10014 */  sw        $s1, 0x14($sp)
.L80244A7C:
/* 137DBC 80244A7C 14400038 */  bnez      $v0, .L80244B60
/* 137DC0 80244A80 AFB00010 */   sw       $s0, 0x10($sp)
.L80244A84:
/* 137DC4 80244A84 24020002 */  addiu     $v0, $zero, 0x2
/* 137DC8 80244A88 14A2000A */  bne       $a1, $v0, .L80244AB4
/* 137DCC 80244A8C 24140001 */   addiu    $s4, $zero, 0x1
/* 137DD0 80244A90 02E0F809 */  jalr      $s7
/* 137DD4 80244A94 02C22821 */   addu     $a1, $s6, $v0
/* 137DD8 80244A98 18400031 */  blez      $v0, .L80244B60
/* 137DDC 80244A9C 00000000 */   nop
/* 137DE0 80244AA0 96C20002 */  lhu       $v0, 0x2($s6)
/* 137DE4 80244AA4 96C30000 */  lhu       $v1, 0x0($s6)
glabel .L80244AA8
/* 137DE8 80244AA8 A6C20000 */  sh        $v0, 0x0($s6)
.L80244AAC:
/* 137DEC 80244AAC 080912D8 */  j         .L80244B60
/* 137DF0 80244AB0 A6C30002 */   sh       $v1, 0x2($s6)
.L80244AB4:
/* 137DF4 80244AB4 0285102B */  sltu      $v0, $s4, $a1
D_80244AB8:
/* 137DF8 80244AB8 50400007 */  beql      $v0, $zero, .L80244AD8
D_80244ABC:
/* 137DFC 80244ABC 0014A042 */   srl      $s4, $s4, 1
/* 137E00 80244AC0 00141040 */  sll       $v0, $s4, 1
glabel .L80244AC4
/* 137E04 80244AC4 24540001 */  addiu     $s4, $v0, 0x1
/* 137E08 80244AC8 0285102B */  sltu      $v0, $s4, $a1
/* 137E0C 80244ACC 1440FFFD */  bnez      $v0, .L80244AC4
D_80244AD0:
/* 137E10 80244AD0 00141040 */   sll      $v0, $s4, 1
/* 137E14 80244AD4 0014A042 */  srl       $s4, $s4, 1
.L80244AD8:
/* 137E18 80244AD8 00051040 */  sll       $v0, $a1, 1
D_80244ADC:
/* 137E1C 80244ADC 12800020 */  beqz      $s4, .L80244B60
/* 137E20 80244AE0 02C2A821 */   addu     $s5, $s6, $v0
.L80244AE4:
/* 137E24 80244AE4 00141840 */  sll       $v1, $s4, 1
/* 137E28 80244AE8 02C39021 */  addu      $s2, $s6, $v1
glabel .L80244AEC
/* 137E2C 80244AEC 0255102B */  sltu      $v0, $s2, $s5
/* 137E30 80244AF0 10400019 */  beqz      $v0, .L80244B58
D_80244AF4:
/* 137E34 80244AF4 00141042 */   srl      $v0, $s4, 1
/* 137E38 80244AF8 0060982D */  daddu     $s3, $v1, $zero
/* 137E3C 80244AFC 02538023 */  subu      $s0, $s2, $s3
glabel func_80244B00
/* 137E40 80244B00 080912CD */  j         .L80244B34
/* 137E44 80244B04 0216102B */   sltu     $v0, $s0, $s6
.L80244B08:
/* 137E48 80244B08 02138821 */  addu      $s1, $s0, $s3
/* 137E4C 80244B0C 02E0F809 */  jalr      $s7
/* 137E50 80244B10 0220282D */   daddu    $a1, $s1, $zero
/* 137E54 80244B14 5840000C */  blezl     $v0, D_80244B48
/* 137E58 80244B18 26520002 */   addiu    $s2, $s2, 0x2
.L80244B1C:
/* 137E5C 80244B1C 96220000 */  lhu       $v0, 0x0($s1)
D_80244B20:
/* 137E60 80244B20 96030000 */  lhu       $v1, 0x0($s0)
/* 137E64 80244B24 A6020000 */  sh        $v0, 0x0($s0)
/* 137E68 80244B28 02138023 */  subu      $s0, $s0, $s3
D_80244B2C:
/* 137E6C 80244B2C 0216102B */  sltu      $v0, $s0, $s6
D_80244B30:
/* 137E70 80244B30 A6230000 */  sh        $v1, 0x0($s1)
.L80244B34:
/* 137E74 80244B34 14400003 */  bnez      $v0, .L80244B44
.L80244B38:
/* 137E78 80244B38 0215102B */   sltu     $v0, $s0, $s5
D_80244B3C:
/* 137E7C 80244B3C 1440FFF2 */  bnez      $v0, .L80244B08
D_80244B40:
/* 137E80 80244B40 0200202D */   daddu    $a0, $s0, $zero
.L80244B44:
/* 137E84 80244B44 26520002 */  addiu     $s2, $s2, 0x2
D_80244B48:
/* 137E88 80244B48 0255102B */  sltu      $v0, $s2, $s5
/* 137E8C 80244B4C 5440FFEC */  bnel      $v0, $zero, func_80244B00
D_80244B50:
/* 137E90 80244B50 02538023 */   subu     $s0, $s2, $s3
.L80244B54:
/* 137E94 80244B54 00141042 */  srl       $v0, $s4, 1
.L80244B58:
/* 137E98 80244B58 1440FFE2 */  bnez      $v0, .L80244AE4
.L80244B5C:
/* 137E9C 80244B5C 0040A02D */   daddu    $s4, $v0, $zero
.L80244B60:
/* 137EA0 80244B60 8FBF0030 */  lw        $ra, 0x30($sp)
.L80244B64:
/* 137EA4 80244B64 8FB7002C */  lw        $s7, 0x2C($sp)
.L80244B68:
/* 137EA8 80244B68 8FB60028 */  lw        $s6, 0x28($sp)
/* 137EAC 80244B6C 8FB50024 */  lw        $s5, 0x24($sp)
.L80244B70:
/* 137EB0 80244B70 8FB40020 */  lw        $s4, 0x20($sp)
/* 137EB4 80244B74 8FB3001C */  lw        $s3, 0x1C($sp)
.L80244B78:
/* 137EB8 80244B78 8FB20018 */  lw        $s2, 0x18($sp)
/* 137EBC 80244B7C 8FB10014 */  lw        $s1, 0x14($sp)
glabel .L80244B80
/* 137EC0 80244B80 8FB00010 */  lw        $s0, 0x10($sp)
.L80244B84:
/* 137EC4 80244B84 03E00008 */  jr        $ra
D_80244B88:
/* 137EC8 80244B88 27BD0038 */   addiu    $sp, $sp, 0x38

### DECOMPILED C INSTRUCTIONS:

void pause_sort_item_list(s16* arr, s32 len, s32 (*compare)(s16*, s16 *)) {
    if (len < 2) {
        // Trivially sorted
        return;
    } else if (len == 2) {
        // Trivial 2-element sort
        if (compare(&arr[0], &arr[1]) > 0) {
            s16 temp = arr[0];
            arr[0] = arr[1];
            arr[1] = temp;
        }
    } else {
        // Nontrivial sort required, use shell sort
        u32 gap = 1;
        s16* end;

        while (gap < len) {
            gap = gap * 2 + 1;
        }

        end = &arr[len];
        while ((gap /= 2) != 0) {
            s16* window_end;

            for (window_end = &arr[gap]; window_end < end; window_end++) {
                s16* cur_elem = window_end - gap;

                // This could be written simpler as a while loop, but the compiler figures out that it only needs to do
                // the "cur_elem < end" check on the first iteration in that case
                if (cur_elem >= arr && cur_elem < end) {
                    do {
                        s16* elem_a = cur_elem;
                        s16* elem_b = cur_elem + gap;

                        if (compare(elem_a, elem_b) > 0) {
                            s16 temp = *elem_a;
                            *elem_a = *elem_b;
                            *elem_b = temp;
                            cur_elem -= gap;
                        } else {
                            break;
                        }
                    } while (cur_elem >= arr && cur_elem < end);
                }
            }
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel underwater_main
/* 3B8BD0 E00BA000 27BDFFB0 */  addiu     $sp, $sp, -0x50
/* 3B8BD4 E00BA004 F7B40038 */  sdc1      $f20, 0x38($sp)
/* 3B8BD8 E00BA008 4485A000 */  mtc1      $a1, $f20
/* 3B8BDC E00BA00C F7B60040 */  sdc1      $f22, 0x40($sp)
/* 3B8BE0 E00BA010 4486B000 */  mtc1      $a2, $f22
/* 3B8BE4 E00BA014 AFB20030 */  sw        $s2, 0x30($sp)
/* 3B8BE8 E00BA018 0080902D */  daddu     $s2, $a0, $zero
/* 3B8BEC E00BA01C F7B80048 */  sdc1      $f24, 0x48($sp)
/* 3B8BF0 E00BA020 4487C000 */  mtc1      $a3, $f24
/* 3B8BF4 E00BA024 27A40010 */  addiu     $a0, $sp, 0x10
/* 3B8BF8 E00BA028 AFB1002C */  sw        $s1, 0x2C($sp)
/* 3B8BFC E00BA02C 8FB10064 */  lw        $s1, 0x64($sp)
/* 3B8C00 E00BA030 3C02E00C */  lui       $v0, %hi(underwater_init)
/* 3B8C04 E00BA034 2442A16C */  addiu     $v0, $v0, %lo(underwater_init)
/* 3B8C08 E00BA038 AFA20018 */  sw        $v0, 0x18($sp)
/* 3B8C0C E00BA03C 3C02E00C */  lui       $v0, %hi(underwater_update)
/* 3B8C10 E00BA040 2442A174 */  addiu     $v0, $v0, %lo(underwater_update)
/* 3B8C14 E00BA044 AFA2001C */  sw        $v0, 0x1C($sp)
/* 3B8C18 E00BA048 3C02E00C */  lui       $v0, %hi(underwater_render)
/* 3B8C1C E00BA04C 2442A5DC */  addiu     $v0, $v0, %lo(underwater_render)
/* 3B8C20 E00BA050 AFA20020 */  sw        $v0, 0x20($sp)
/* 3B8C24 E00BA054 2402005D */  addiu     $v0, $zero, 0x5D
/* 3B8C28 E00BA058 AFBF0034 */  sw        $ra, 0x34($sp)
/* 3B8C2C E00BA05C AFB00028 */  sw        $s0, 0x28($sp)
/* 3B8C30 E00BA060 AFA00010 */  sw        $zero, 0x10($sp)
/* 3B8C34 E00BA064 AFA00024 */  sw        $zero, 0x24($sp)
/* 3B8C38 E00BA068 0C080124 */  jal       shim_create_effect_instance
/* 3B8C3C E00BA06C AFA20014 */   sw       $v0, 0x14($sp)
/* 3B8C40 E00BA070 24040308 */  addiu     $a0, $zero, 0x308
/* 3B8C44 E00BA074 24030001 */  addiu     $v1, $zero, 0x1
/* 3B8C48 E00BA078 0040802D */  daddu     $s0, $v0, $zero
/* 3B8C4C E00BA07C 0C08012C */  jal       shim_general_heap_malloc
/* 3B8C50 E00BA080 AE030008 */   sw       $v1, 0x8($s0)
/* 3B8C54 E00BA084 0040302D */  daddu     $a2, $v0, $zero
/* 3B8C58 E00BA088 14C00003 */  bnez      $a2, .LE00BA098
/* 3B8C5C E00BA08C AE02000C */   sw       $v0, 0xC($s0)
.LE00BA090:
/* 3B8C60 E00BA090 0802E824 */  j         .LE00BA090
/* 3B8C64 E00BA094 00000000 */   nop
.LE00BA098:
/* 3B8C68 E00BA098 ACD20000 */  sw        $s2, 0x0($a2)
/* 3B8C6C E00BA09C 1E200004 */  bgtz      $s1, .LE00BA0B0
/* 3B8C70 E00BA0A0 ACC00014 */   sw       $zero, 0x14($a2)
/* 3B8C74 E00BA0A4 240203E8 */  addiu     $v0, $zero, 0x3E8
/* 3B8C78 E00BA0A8 0802E82D */  j         .LE00BA0B4
/* 3B8C7C E00BA0AC ACC20010 */   sw       $v0, 0x10($a2)
.LE00BA0B0:
/* 3B8C80 E00BA0B0 ACD10010 */  sw        $s1, 0x10($a2)
.LE00BA0B4:
/* 3B8C84 E00BA0B4 0000482D */  daddu     $t1, $zero, $zero
/* 3B8C88 E00BA0B8 0120402D */  daddu     $t0, $t1, $zero
/* 3B8C8C E00BA0BC 0120382D */  daddu     $a3, $t1, $zero
/* 3B8C90 E00BA0C0 A0C0001F */  sb        $zero, 0x1F($a2)
/* 3B8C94 E00BA0C4 E4D40004 */  swc1      $f20, 0x4($a2)
/* 3B8C98 E00BA0C8 E4D60008 */  swc1      $f22, 0x8($a2)
/* 3B8C9C E00BA0CC E4D8000C */  swc1      $f24, 0xC($a2)
/* 3B8CA0 E00BA0D0 C7A00060 */  lwc1      $f0, 0x60($sp)
/* 3B8CA4 E00BA0D4 2402000A */  addiu     $v0, $zero, 0xA
/* 3B8CA8 E00BA0D8 A0C2001C */  sb        $v0, 0x1C($a2)
/* 3B8CAC E00BA0DC 2402006E */  addiu     $v0, $zero, 0x6E
/* 3B8CB0 E00BA0E0 240300FF */  addiu     $v1, $zero, 0xFF
/* 3B8CB4 E00BA0E4 A0C2001D */  sb        $v0, 0x1D($a2)
/* 3B8CB8 E00BA0E8 240200BE */  addiu     $v0, $zero, 0xBE
/* 3B8CBC E00BA0EC A0C20020 */  sb        $v0, 0x20($a2)
/* 3B8CC0 E00BA0F0 240200DC */  addiu     $v0, $zero, 0xDC
/* 3B8CC4 E00BA0F4 A0C3001E */  sb        $v1, 0x1E($a2)
/* 3B8CC8 E00BA0F8 A0C20021 */  sb        $v0, 0x21($a2)
/* 3B8CCC E00BA0FC A0C30022 */  sb        $v1, 0x22($a2)
/* 3B8CD0 E00BA100 E4C00018 */  swc1      $f0, 0x18($a2)
.LE00BA104:
/* 3B8CD4 E00BA104 0000202D */  daddu     $a0, $zero, $zero
/* 3B8CD8 E00BA108 0100282D */  daddu     $a1, $t0, $zero
.LE00BA10C:
/* 3B8CDC E00BA10C 00C51021 */  addu      $v0, $a2, $a1
/* 3B8CE0 E00BA110 00871821 */  addu      $v1, $a0, $a3
/* 3B8CE4 E00BA114 24840001 */  addiu     $a0, $a0, 0x1
/* 3B8CE8 E00BA118 00C31821 */  addu      $v1, $a2, $v1
/* 3B8CEC E00BA11C A0600023 */  sb        $zero, 0x23($v1)
/* 3B8CF0 E00BA120 A440011A */  sh        $zero, 0x11A($v0)
/* 3B8CF4 E00BA124 2882000D */  slti      $v0, $a0, 0xD
/* 3B8CF8 E00BA128 1440FFF8 */  bnez      $v0, .LE00BA10C
/* 3B8CFC E00BA12C 24A50002 */   addiu    $a1, $a1, 0x2
/* 3B8D00 E00BA130 2508001A */  addiu     $t0, $t0, 0x1A
/* 3B8D04 E00BA134 25290001 */  addiu     $t1, $t1, 0x1
/* 3B8D08 E00BA138 29220013 */  slti      $v0, $t1, 0x13
/* 3B8D0C E00BA13C 1440FFF1 */  bnez      $v0, .LE00BA104
/* 3B8D10 E00BA140 24E7000D */   addiu    $a3, $a3, 0xD
/* 3B8D14 E00BA144 0200102D */  daddu     $v0, $s0, $zero
/* 3B8D18 E00BA148 8FBF0034 */  lw        $ra, 0x34($sp)
/* 3B8D1C E00BA14C 8FB20030 */  lw        $s2, 0x30($sp)
/* 3B8D20 E00BA150 8FB1002C */  lw        $s1, 0x2C($sp)
/* 3B8D24 E00BA154 8FB00028 */  lw        $s0, 0x28($sp)
/* 3B8D28 E00BA158 D7B80048 */  ldc1      $f24, 0x48($sp)
/* 3B8D2C E00BA15C D7B60040 */  ldc1      $f22, 0x40($sp)
/* 3B8D30 E00BA160 D7B40038 */  ldc1      $f20, 0x38($sp)
/* 3B8D34 E00BA164 03E00008 */  jr        $ra
/* 3B8D38 E00BA168 27BD0050 */   addiu    $sp, $sp, 0x50

### DECOMPILED C INSTRUCTIONS:

EffectInstance* underwater_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5) {
    EffectBlueprint bp;
    EffectInstance* effect;
    UnderwaterFXData* data;
    s32 numParts = 1;
    s32 i;
    s32 j;

    bp.init = underwater_init;
    bp.update = underwater_update;
    bp.renderWorld = underwater_render;
    bp.unk_00 = 0;
    bp.renderUI = NULL;
    bp.effectID = EFFECT_UNDERWATER;

    effect = shim_create_effect_instance(&bp);
    effect->numParts = numParts;
    data = effect->data.underwater = shim_general_heap_malloc(numParts * sizeof(*data));
    ASSERT(effect->data.underwater != NULL);

    data->unk_00 = arg0;
    data->lifeTime = 0;
    if (arg5 <= 0) {
        data->timeLeft = 1000;
    } else {
        data->timeLeft = arg5;
    }
    data->waterColor.a = 0;
    data->unk_04 = arg1;
    data->unk_08 = arg2;
    data->unk_0C = arg3;
    data->unk_18 = arg4;
    data->waterColor.r = 10;
    data->waterColor.g = 110;
    data->waterColor.b = 255;
    data->unk_20.r = 190;
    data->unk_20.g = 220;
    data->unk_20.b = 255;

    for (i = 0; i < ARRAY_COUNT(data->unk_23); i++) {
        for (j = 0; j < ARRAY_COUNT(data->unk_23[0]); j++) {
            data->unk_23[i][j] = 0;
            data->unk_11A[i][j] = 0;
        }
    }

    return effect;
}