### RAW ASSEMBLY INSTRUCTIONS:

glabel update_cameras
/* 8800 8002D400 27BDFF90 */  addiu     $sp, $sp, -0x70
/* 8804 8002D404 F7B60068 */  sdc1      $f22, 0x68($sp)
/* 8808 8002D408 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 880C 8002D40C 4481B000 */  mtc1      $at, $f22
/* 8810 8002D410 F7B40060 */  sdc1      $f20, 0x60($sp)
/* 8814 8002D414 3C013FE0 */  lui       $at, (0x3FE00000 >> 16)
/* 8818 8002D418 4481A800 */  mtc1      $at, $f21
/* 881C 8002D41C 4480A000 */  mtc1      $zero, $f20
/* 8820 8002D420 AFB3004C */  sw        $s3, 0x4C($sp)
/* 8824 8002D424 0000982D */  daddu     $s3, $zero, $zero
/* 8828 8002D428 AFB60058 */  sw        $s6, 0x58($sp)
/* 882C 8002D42C 27B60030 */  addiu     $s6, $sp, 0x30
/* 8830 8002D430 AFB50054 */  sw        $s5, 0x54($sp)
/* 8834 8002D434 27B50034 */  addiu     $s5, $sp, 0x34
/* 8838 8002D438 AFB40050 */  sw        $s4, 0x50($sp)
/* 883C 8002D43C 27B40038 */  addiu     $s4, $sp, 0x38
/* 8840 8002D440 AFB00040 */  sw        $s0, 0x40($sp)
/* 8844 8002D444 3C10800B */  lui       $s0, %hi(gCameras)
/* 8848 8002D448 26101D80 */  addiu     $s0, $s0, %lo(gCameras)
/* 884C 8002D44C AFBF005C */  sw        $ra, 0x5C($sp)
/* 8850 8002D450 AFB20048 */  sw        $s2, 0x48($sp)
/* 8854 8002D454 AFB10044 */  sw        $s1, 0x44($sp)
.L8002D458:
/* 8858 8002D458 96020000 */  lhu       $v0, 0x0($s0)
/* 885C 8002D45C 104000A5 */  beqz      $v0, .L8002D6F4
/* 8860 8002D460 30420002 */   andi     $v0, $v0, 0x2
/* 8864 8002D464 544000A4 */  bnel      $v0, $zero, .L8002D6F8
/* 8868 8002D468 26730001 */   addiu    $s3, $s3, 0x1
/* 886C 8002D46C 86030004 */  lh        $v1, 0x4($s0)
/* 8870 8002D470 3C01800A */  lui       $at, %hi(gCurrentCamID)
/* 8874 8002D474 A433A634 */  sh        $s3, %lo(gCurrentCamID)($at)
/* 8878 8002D478 2C620007 */  sltiu     $v0, $v1, 0x7
/* 887C 8002D47C 1040001E */  beqz      $v0, .L8002D4F8
/* 8880 8002D480 00031080 */   sll      $v0, $v1, 2
/* 8884 8002D484 3C01800A */  lui       $at, %hi(jtbl_800981E0)
/* 8888 8002D488 00220821 */  addu      $at, $at, $v0
/* 888C 8002D48C 8C2281E0 */  lw        $v0, %lo(jtbl_800981E0)($at)
/* 8890 8002D490 00400008 */  jr        $v0
/* 8894 8002D494 00000000 */   nop
glabel .L8002D498
/* 8898 8002D498 0C00C525 */  jal       update_camera_zone_interp
/* 889C 8002D49C 0200202D */   daddu    $a0, $s0, $zero
/* 88A0 8002D4A0 0800B540 */  j         .L8002D500
/* 88A4 8002D4A4 00000000 */   nop
glabel .L8002D4A8
/* 88A8 8002D4A8 0C00BE14 */  jal       update_camera_mode_0
/* 88AC 8002D4AC 0200202D */   daddu    $a0, $s0, $zero
/* 88B0 8002D4B0 0800B540 */  j         .L8002D500
/* 88B4 8002D4B4 00000000 */   nop
glabel .L8002D4B8
/* 88B8 8002D4B8 0C00BCA4 */  jal       update_camera_mode_1
/* 88BC 8002D4BC 0200202D */   daddu    $a0, $s0, $zero
/* 88C0 8002D4C0 0800B540 */  j         .L8002D500
/* 88C4 8002D4C4 00000000 */   nop
glabel .L8002D4C8
/* 88C8 8002D4C8 0C00BB3E */  jal       update_camera_mode_2
/* 88CC 8002D4CC 0200202D */   daddu    $a0, $s0, $zero
/* 88D0 8002D4D0 0800B540 */  j         .L8002D500
/* 88D4 8002D4D4 00000000 */   nop
glabel .L8002D4D8
/* 88D8 8002D4D8 0C00BA44 */  jal       update_camera_mode_4
/* 88DC 8002D4DC 0200202D */   daddu    $a0, $s0, $zero
/* 88E0 8002D4E0 0800B540 */  j         .L8002D500
/* 88E4 8002D4E4 00000000 */   nop
glabel .L8002D4E8
/* 88E8 8002D4E8 0C00C000 */  jal       update_camera_mode_5
/* 88EC 8002D4EC 0200202D */   daddu    $a0, $s0, $zero
/* 88F0 8002D4F0 0800B540 */  j         .L8002D500
/* 88F4 8002D4F4 00000000 */   nop
glabel .L8002D4F8
/* 88F8 8002D4F8 0C00BE64 */  jal       update_camera_mode_6
/* 88FC 8002D4FC 0200202D */   daddu    $a0, $s0, $zero
.L8002D500:
/* 8900 8002D500 C6000044 */  lwc1      $f0, 0x44($s0)
/* 8904 8002D504 3C05800A */  lui       $a1, %hi(gDisplayContext)
/* 8908 8002D508 8CA5A674 */  lw        $a1, %lo(gDisplayContext)($a1)
/* 890C 8002D50C E7A00010 */  swc1      $f0, 0x10($sp)
/* 8910 8002D510 C6000048 */  lwc1      $f0, 0x48($s0)
/* 8914 8002D514 E7A00014 */  swc1      $f0, 0x14($sp)
/* 8918 8002D518 C600004C */  lwc1      $f0, 0x4C($s0)
/* 891C 8002D51C E7A00018 */  swc1      $f0, 0x18($sp)
/* 8920 8002D520 C6000050 */  lwc1      $f0, 0x50($s0)
/* 8924 8002D524 26120114 */  addiu     $s2, $s0, 0x114
/* 8928 8002D528 AFA00020 */  sw        $zero, 0x20($sp)
/* 892C 8002D52C E7B60024 */  swc1      $f22, 0x24($sp)
/* 8930 8002D530 AFA00028 */  sw        $zero, 0x28($sp)
/* 8934 8002D534 E7A0001C */  swc1      $f0, 0x1C($sp)
/* 8938 8002D538 8E06003C */  lw        $a2, 0x3C($s0)
/* 893C 8002D53C 8E070040 */  lw        $a3, 0x40($s0)
/* 8940 8002D540 0C018CC8 */  jal       guLookAtReflectF
/* 8944 8002D544 0240202D */   daddu    $a0, $s2, $zero
/* 8948 8002D548 96030000 */  lhu       $v1, 0x0($s0)
/* 894C 8002D54C 30620010 */  andi      $v0, $v1, 0x10
/* 8950 8002D550 14400034 */  bnez      $v0, .L8002D624
/* 8954 8002D554 260400D4 */   addiu    $a0, $s0, 0xD4
/* 8958 8002D558 30620004 */  andi      $v0, $v1, 0x4
/* 895C 8002D55C 10400004 */  beqz      $v0, .L8002D570
/* 8960 8002D560 261100D4 */   addiu    $s1, $s0, 0xD4
/* 8964 8002D564 0C00CCE5 */  jal       create_camera_leadplayer_matrix
/* 8968 8002D568 0200202D */   daddu    $a0, $s0, $zero
/* 896C 8002D56C 261100D4 */  addiu     $s1, $s0, 0xD4
.L8002D570:
/* 8970 8002D570 0220202D */  daddu     $a0, $s1, $zero
/* 8974 8002D574 8607000A */  lh        $a3, 0xA($s0)
/* 8978 8002D578 86020012 */  lh        $v0, 0x12($s0)
/* 897C 8002D57C 8603000C */  lh        $v1, 0xC($s0)
/* 8980 8002D580 44820000 */  mtc1      $v0, $f0
/* 8984 8002D584 00000000 */  nop
/* 8988 8002D588 46800020 */  cvt.s.w   $f0, $f0
/* 898C 8002D58C E7A00010 */  swc1      $f0, 0x10($sp)
/* 8990 8002D590 86020014 */  lh        $v0, 0x14($s0)
/* 8994 8002D594 44871000 */  mtc1      $a3, $f2
/* 8998 8002D598 00000000 */  nop
/* 899C 8002D59C 468010A0 */  cvt.s.w   $f2, $f2
/* 89A0 8002D5A0 E7B60018 */  swc1      $f22, 0x18($sp)
/* 89A4 8002D5A4 44820000 */  mtc1      $v0, $f0
/* 89A8 8002D5A8 00000000 */  nop
/* 89AC 8002D5AC 46800020 */  cvt.s.w   $f0, $f0
/* 89B0 8002D5B0 E7A00014 */  swc1      $f0, 0x14($sp)
/* 89B4 8002D5B4 44830000 */  mtc1      $v1, $f0
/* 89B8 8002D5B8 00000000 */  nop
/* 89BC 8002D5BC 46800020 */  cvt.s.w   $f0, $f0
/* 89C0 8002D5C0 46001083 */  div.s     $f2, $f2, $f0
/* 89C4 8002D5C4 8E060018 */  lw        $a2, 0x18($s0)
/* 89C8 8002D5C8 44071000 */  mfc1      $a3, $f2
/* 89CC 8002D5CC 0C018EE4 */  jal       guPerspectiveF
/* 89D0 8002D5D0 26050038 */   addiu    $a1, $s0, 0x38
/* 89D4 8002D5D4 96020000 */  lhu       $v0, 0x0($s0)
/* 89D8 8002D5D8 30420008 */  andi      $v0, $v0, 0x8
/* 89DC 8002D5DC 10400004 */  beqz      $v0, .L8002D5F0
/* 89E0 8002D5E0 26040194 */   addiu    $a0, $s0, 0x194
/* 89E4 8002D5E4 0220282D */  daddu     $a1, $s1, $zero
/* 89E8 8002D5E8 0C019D80 */  jal       guMtxCatF
/* 89EC 8002D5EC 0220302D */   daddu    $a2, $s1, $zero
.L8002D5F0:
/* 89F0 8002D5F0 96020000 */  lhu       $v0, 0x0($s0)
/* 89F4 8002D5F4 30420004 */  andi      $v0, $v0, 0x4
/* 89F8 8002D5F8 10400004 */  beqz      $v0, .L8002D60C
/* 89FC 8002D5FC 26040154 */   addiu    $a0, $s0, 0x154
/* 8A00 8002D600 0220282D */  daddu     $a1, $s1, $zero
/* 8A04 8002D604 0C019D80 */  jal       guMtxCatF
/* 8A08 8002D608 0220302D */   daddu    $a2, $s1, $zero
.L8002D60C:
/* 8A0C 8002D60C 0240202D */  daddu     $a0, $s2, $zero
/* 8A10 8002D610 0220282D */  daddu     $a1, $s1, $zero
/* 8A14 8002D614 0C019D80 */  jal       guMtxCatF
/* 8A18 8002D618 00A0302D */   daddu    $a2, $a1, $zero
/* 8A1C 8002D61C 0800B5B0 */  j         .L8002D6C0
/* 8A20 8002D620 AFB60010 */   sw       $s6, 0x10($sp)
.L8002D624:
/* 8A24 8002D624 8602000A */  lh        $v0, 0xA($s0)
/* 8A28 8002D628 44822000 */  mtc1      $v0, $f4
/* 8A2C 8002D62C 00000000 */  nop
/* 8A30 8002D630 46802120 */  cvt.s.w   $f4, $f4
/* 8A34 8002D634 46002187 */  neg.s     $f6, $f4
/* 8A38 8002D638 460031A1 */  cvt.d.s   $f6, $f6
/* 8A3C 8002D63C 46343182 */  mul.d     $f6, $f6, $f20
/* 8A40 8002D640 00000000 */  nop
/* 8A44 8002D644 46002121 */  cvt.d.s   $f4, $f4
/* 8A48 8002D648 46342102 */  mul.d     $f4, $f4, $f20
/* 8A4C 8002D64C 00000000 */  nop
/* 8A50 8002D650 8602000C */  lh        $v0, 0xC($s0)
/* 8A54 8002D654 44820000 */  mtc1      $v0, $f0
/* 8A58 8002D658 00000000 */  nop
/* 8A5C 8002D65C 46800020 */  cvt.s.w   $f0, $f0
/* 8A60 8002D660 46000087 */  neg.s     $f2, $f0
/* 8A64 8002D664 460010A1 */  cvt.d.s   $f2, $f2
/* 8A68 8002D668 46341082 */  mul.d     $f2, $f2, $f20
/* 8A6C 8002D66C 00000000 */  nop
/* 8A70 8002D670 3C01C47A */  lui       $at, (0xC47A0000 >> 16)
/* 8A74 8002D674 44814000 */  mtc1      $at, $f8
/* 8A78 8002D678 3C01447A */  lui       $at, (0x447A0000 >> 16)
/* 8A7C 8002D67C 44815000 */  mtc1      $at, $f10
/* 8A80 8002D680 E7B6001C */  swc1      $f22, 0x1C($sp)
/* 8A84 8002D684 E7A80014 */  swc1      $f8, 0x14($sp)
/* 8A88 8002D688 46000021 */  cvt.d.s   $f0, $f0
/* 8A8C 8002D68C 46340002 */  mul.d     $f0, $f0, $f20
/* 8A90 8002D690 00000000 */  nop
/* 8A94 8002D694 E7AA0018 */  swc1      $f10, 0x18($sp)
/* 8A98 8002D698 462031A0 */  cvt.s.d   $f6, $f6
/* 8A9C 8002D69C 46202120 */  cvt.s.d   $f4, $f4
/* 8AA0 8002D6A0 44053000 */  mfc1      $a1, $f6
/* 8AA4 8002D6A4 44062000 */  mfc1      $a2, $f4
/* 8AA8 8002D6A8 462010A0 */  cvt.s.d   $f2, $f2
/* 8AAC 8002D6AC 44071000 */  mfc1      $a3, $f2
/* 8AB0 8002D6B0 46200020 */  cvt.s.d   $f0, $f0
/* 8AB4 8002D6B4 0C018E44 */  jal       guOrthoF
/* 8AB8 8002D6B8 E7A00010 */   swc1     $f0, 0x10($sp)
/* 8ABC 8002D6BC AFB60010 */  sw        $s6, 0x10($sp)
.L8002D6C0:
/* 8AC0 8002D6C0 AFB50014 */  sw        $s5, 0x14($sp)
/* 8AC4 8002D6C4 AFB40018 */  sw        $s4, 0x18($sp)
/* 8AC8 8002D6C8 8E050060 */  lw        $a1, 0x60($s0)
/* 8ACC 8002D6CC 8E060064 */  lw        $a2, 0x64($s0)
/* 8AD0 8002D6D0 8E070068 */  lw        $a3, 0x68($s0)
/* 8AD4 8002D6D4 0C00B94E */  jal       get_screen_coords
/* 8AD8 8002D6D8 0000202D */   daddu    $a0, $zero, $zero
/* 8ADC 8002D6DC 96C20002 */  lhu       $v0, 0x2($s6)
/* 8AE0 8002D6E0 A6020032 */  sh        $v0, 0x32($s0)
/* 8AE4 8002D6E4 96A20002 */  lhu       $v0, 0x2($s5)
/* 8AE8 8002D6E8 A6020034 */  sh        $v0, 0x34($s0)
/* 8AEC 8002D6EC 96820002 */  lhu       $v0, 0x2($s4)
/* 8AF0 8002D6F0 A6020036 */  sh        $v0, 0x36($s0)
.L8002D6F4:
/* 8AF4 8002D6F4 26730001 */  addiu     $s3, $s3, 0x1
.L8002D6F8:
/* 8AF8 8002D6F8 2A620004 */  slti      $v0, $s3, 0x4
/* 8AFC 8002D6FC 1440FF56 */  bnez      $v0, .L8002D458
/* 8B00 8002D700 26100558 */   addiu    $s0, $s0, 0x558
/* 8B04 8002D704 8FBF005C */  lw        $ra, 0x5C($sp)
/* 8B08 8002D708 8FB60058 */  lw        $s6, 0x58($sp)
/* 8B0C 8002D70C 8FB50054 */  lw        $s5, 0x54($sp)
/* 8B10 8002D710 8FB40050 */  lw        $s4, 0x50($sp)
/* 8B14 8002D714 8FB3004C */  lw        $s3, 0x4C($sp)
/* 8B18 8002D718 8FB20048 */  lw        $s2, 0x48($sp)
/* 8B1C 8002D71C 8FB10044 */  lw        $s1, 0x44($sp)
/* 8B20 8002D720 8FB00040 */  lw        $s0, 0x40($sp)
/* 8B24 8002D724 D7B60068 */  ldc1      $f22, 0x68($sp)
/* 8B28 8002D728 D7B40060 */  ldc1      $f20, 0x60($sp)
/* 8B2C 8002D72C 3C01800A */  lui       $at, %hi(gCurrentCamID)
/* 8B30 8002D730 A420A634 */  sh        $zero, %lo(gCurrentCamID)($at)
/* 8B34 8002D734 03E00008 */  jr        $ra
/* 8B38 8002D738 27BD0070 */   addiu    $sp, $sp, 0x70

### DECOMPILED C INSTRUCTIONS:

void update_cameras(void) {
    s32 i;

    for (i = 0; i < ARRAY_COUNT(gCameras); i++) {
        Camera* cam = &gCameras[i];
        s32 sx;
        s32 sy;
        s32 sz;

        if (cam->flags == 0 || cam->flags & CAMERA_FLAG_DISABLED) {
            continue;
        }

        gCurrentCamID = i;

        switch (cam->updateMode) {
            case CAM_UPDATE_FROM_ZONE:
                update_camera_zone_interp(cam);
                break;
            case CAM_UPDATE_MODE_INIT:
                update_camera_mode_0(cam);
                break;
            case CAM_UPDATE_UNUSED_1:
                update_camera_mode_1(cam);
                break;
            case CAM_UPDATE_MODE_2:
                update_camera_mode_2(cam);
                break;
            case CAM_UPDATE_UNUSED_4:
                update_camera_mode_4(cam);
                break;
            case CAM_UPDATE_UNUSED_5:
                update_camera_mode_5(cam);
                break;
            case CAM_UPDATE_MODE_6:
            default:
                update_camera_mode_6(cam);
                break;
        }

        guLookAtReflectF(cam->viewMtxPlayer, &gDisplayContext->lookAt, cam->lookAt_eye.x, cam->lookAt_eye.y, cam->lookAt_eye.z, cam->lookAt_obj.x, cam->lookAt_obj.y, cam->lookAt_obj.z, 0, 1.0f, 0);

        if (!(cam->flags & CAMERA_FLAG_ORTHO)) {
            if (cam->flags & CAMERA_FLAG_LEAD_PLAYER) {
                create_camera_leadplayer_matrix(cam);
            }

            guPerspectiveF(cam->perspectiveMatrix, &cam->perspNorm, cam->vfov, (f32) cam->viewportW / (f32) cam->viewportH, (f32) cam->nearClip, (f32) cam->farClip, 1.0f);

            if (cam->flags & CAMERA_FLAG_SHAKING) {
                guMtxCatF(cam->viewMtxShaking, cam->perspectiveMatrix, cam->perspectiveMatrix);
            }

            if (cam->flags & CAMERA_FLAG_LEAD_PLAYER) {
                guMtxCatF(cam->viewMtxLeading, cam->perspectiveMatrix, cam->perspectiveMatrix);
            }

            guMtxCatF(cam->viewMtxPlayer, cam->perspectiveMatrix, cam->perspectiveMatrix);
        } else {
            f32 w = cam->viewportW;
            f32 h = cam->viewportH;

            guOrthoF(cam->perspectiveMatrix, -w * 0.5, w * 0.5, -h * 0.5, h * 0.5, -1000.0f, 1000.0f, 1.0f);
        }

        get_screen_coords(0, cam->targetPos.x, cam->targetPos.y, cam->targetPos.z, &sx, &sy, &sz);
        cam->targetScreenCoords.x = sx;
        cam->targetScreenCoords.y = sy;
        cam->targetScreenCoords.z = sz;
    }

    gCurrentCamID = CAM_DEFAULT;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_80245440
/* 173D20 80245440 27BDFFD0 */  addiu     $sp, $sp, -0x30
D_80245444:
/* 173D24 80245444 AFB1001C */  sw        $s1, 0x1C($sp)
D_80245448:
/* 173D28 80245448 3C11800E */  lui       $s1, %hi(gBattleStatus)
glabel func_8024544C
/* 173D2C 8024544C 2631C070 */  addiu     $s1, $s1, %lo(gBattleStatus)
D_80245450_EF2550:
/* 173D30 80245450 AFB30024 */  sw        $s3, 0x24($sp)
/* 173D34 80245454 3C13800E */  lui       $s3, %hi(gBattleSubState)
D_80245458_EF2558:
/* 173D38 80245458 2673C4DC */  addiu     $s3, $s3, %lo(gBattleSubState)
/* 173D3C 8024545C 24020001 */  addiu     $v0, $zero, 0x1
D_80245460_EF2560:
/* 173D40 80245460 AFBF0028 */  sw        $ra, 0x28($sp)
/* 173D44 80245464 AFB20020 */  sw        $s2, 0x20($sp)
D_80245468_EF7A78:
/* 173D48 80245468 AFB00018 */  sw        $s0, 0x18($sp)
D_8024546C:
/* 173D4C 8024546C 8E3000D8 */  lw        $s0, 0xD8($s1)
/* 173D50 80245470 8E630000 */  lw        $v1, 0x0($s3)
.L80245474:
/* 173D54 80245474 8E3200DC */  lw        $s2, 0xDC($s1)
.L80245478:
/* 173D58 80245478 1062004D */  beq       $v1, $v0, .L802455B0
.L8024547C:
/* 173D5C 8024547C 28620002 */   slti     $v0, $v1, 0x2
/* 173D60 80245480 10400005 */  beqz      $v0, D_80245498
/* 173D64 80245484 24020002 */   addiu    $v0, $zero, 0x2
glabel func_80245488
/* 173D68 80245488 10600007 */  beqz      $v1, D_802454A8_EF25A8
/* 173D6C 8024548C 2404FFF7 */   addiu    $a0, $zero, -0x9
D_80245490:
/* 173D70 80245490 0809158F */  j         .L8024563C
/* 173D74 80245494 00000000 */   nop
D_80245498:
/* 173D78 80245498 1062005E */  beq       $v1, $v0, D_80245614
/* 173D7C 8024549C 00000000 */   nop
D_802454A0:
/* 173D80 802454A0 0809158F */  j         .L8024563C
/* 173D84 802454A4 00000000 */   nop
D_802454A8_EF25A8:
/* 173D88 802454A8 8E220000 */  lw        $v0, 0x0($s1)
/* 173D8C 802454AC 00441024 */  and       $v0, $v0, $a0
D_802454B0:
/* 173D90 802454B0 AE220000 */  sw        $v0, 0x0($s1)
glabel func_802454B4
/* 173D94 802454B4 8E220004 */  lw        $v0, 0x4($s1)
D_802454B8:
/* 173D98 802454B8 2403FFFD */  addiu     $v1, $zero, -0x3
/* 173D9C 802454BC A220008C */  sb        $zero, 0x8C($s1)
.L802454C0:
/* 173DA0 802454C0 00431024 */  and       $v0, $v0, $v1
/* 173DA4 802454C4 2403FFFB */  addiu     $v1, $zero, -0x5
/* 173DA8 802454C8 00431024 */  and       $v0, $v0, $v1
/* 173DAC 802454CC 00441024 */  and       $v0, $v0, $a0
/* 173DB0 802454D0 2403FFEF */  addiu     $v1, $zero, -0x11
D_802454D4:
/* 173DB4 802454D4 00431024 */  and       $v0, $v0, $v1
/* 173DB8 802454D8 AE220004 */  sw        $v0, 0x4($s1)
/* 173DBC 802454DC 82030210 */  lb        $v1, 0x210($s0)
D_802454E0:
/* 173DC0 802454E0 10600013 */  beqz      $v1, jtbl_80245530
/* 173DC4 802454E4 24020007 */   addiu    $v0, $zero, 0x7
/* 173DC8 802454E8 14620008 */  bne       $v1, $v0, .L8024550C
/* 173DCC 802454EC 00000000 */   nop
.L802454F0:
/* 173DD0 802454F0 0C05272D */  jal       sfx_play_sound
/* 173DD4 802454F4 240400E7 */   addiu    $a0, $zero, 0xE7
D_802454F8:
/* 173DD8 802454F8 8E030228 */  lw        $v1, 0x228($s0)
/* 173DDC 802454FC 8C620000 */  lw        $v0, 0x0($v1)
/* 173DE0 80245500 34420010 */  ori       $v0, $v0, 0x10
glabel func_80245504
/* 173DE4 80245504 AC620000 */  sw        $v0, 0x0($v1)
.L80245508:
/* 173DE8 80245508 AE000228 */  sw        $zero, 0x228($s0)
.L8024550C:
/* 173DEC 8024550C 86040436 */  lh        $a0, 0x436($s0)
/* 173DF0 80245510 A2000210 */  sb        $zero, 0x210($s0)
/* 173DF4 80245514 0C011E26 */  jal       remove_status_debuff
D_80245518:
/* 173DF8 80245518 A2000211 */   sb       $zero, 0x211($s0)
/* 173DFC 8024551C 8E020440 */  lw        $v0, 0x440($s0)
/* 173E00 80245520 A2000216 */  sb        $zero, 0x216($s0)
/* 173E04 80245524 A2000217 */  sb        $zero, 0x217($s0)
D_80245528:
/* 173E08 80245528 8C42000C */  lw        $v0, 0xC($v0)
glabel func_8024552C
/* 173E0C 8024552C AC40003C */  sw        $zero, 0x3C($v0)
jtbl_80245530:
/* 173E10 80245530 0C093903 */  jal       func_8024E40C
/* 173E14 80245534 24040019 */   addiu    $a0, $zero, 0x19
.L80245538:
/* 173E18 80245538 0C09390F */  jal       func_8024E43C
/* 173E1C 8024553C 0000202D */   daddu    $a0, $zero, $zero
D_80245540:
/* 173E20 80245540 3C048028 */  lui       $a0, %hi(EVS_Mario_HandlePhase)
D_80245544:
/* 173E24 80245544 24844EBC */  addiu     $a0, $a0, %lo(EVS_Mario_HandlePhase)
D_80245548:
/* 173E28 80245548 2405000A */  addiu     $a1, $zero, 0xA
/* 173E2C 8024554C 0000302D */  daddu     $a2, $zero, $zero
D_80245550:
/* 173E30 80245550 24020004 */  addiu     $v0, $zero, 0x4
/* 173E34 80245554 0C0B0CF8 */  jal       start_script
/* 173E38 80245558 A22201A7 */   sb       $v0, 0x1A7($s1)
/* 173E3C 8024555C 0040202D */  daddu     $a0, $v0, $zero
/* 173E40 80245560 AE0401D4 */  sw        $a0, 0x1D4($s0)
/* 173E44 80245564 8C820144 */  lw        $v0, 0x144($a0)
.L80245568:
/* 173E48 80245568 AE0201E4 */  sw        $v0, 0x1E4($s0)
/* 173E4C 8024556C 1240000B */  beqz      $s2, .L8024559C
/* 173E50 80245570 AC800148 */   sw       $zero, 0x148($a0)
/* 173E54 80245574 2405000A */  addiu     $a1, $zero, 0xA
/* 173E58 80245578 8E4401C4 */  lw        $a0, 0x1C4($s2)
/* 173E5C 8024557C 0C0B0CF8 */  jal       start_script
.L80245580:
/* 173E60 80245580 0000302D */   daddu    $a2, $zero, $zero
/* 173E64 80245584 0040202D */  daddu     $a0, $v0, $zero
glabel func_80245588
/* 173E68 80245588 AE4401D4 */  sw        $a0, 0x1D4($s2)
/* 173E6C 8024558C 8C820144 */  lw        $v0, 0x144($a0)
/* 173E70 80245590 AE4201E4 */  sw        $v0, 0x1E4($s2)
/* 173E74 80245594 24020100 */  addiu     $v0, $zero, 0x100
.L80245598:
/* 173E78 80245598 AC820148 */  sw        $v0, 0x148($a0)
.L8024559C:
/* 173E7C 8024559C 24020001 */  addiu     $v0, $zero, 0x1
/* 173E80 802455A0 3C01800E */  lui       $at, %hi(gBattleSubState)
/* 173E84 802455A4 AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
/* 173E88 802455A8 0809158F */  j         .L8024563C
/* 173E8C 802455AC 00000000 */   nop
.L802455B0:
/* 173E90 802455B0 0C0B1059 */  jal       does_script_exist
D_802455B4:
/* 173E94 802455B4 8E0401E4 */   lw       $a0, 0x1E4($s0)
/* 173E98 802455B8 14400020 */  bnez      $v0, .L8024563C
glabel func_802455BC
/* 173E9C 802455BC 00000000 */   nop
/* 173EA0 802455C0 8222008C */  lb        $v0, 0x8C($s1)
/* 173EA4 802455C4 1440001D */  bnez      $v0, .L8024563C
D_802455C8:
/* 173EA8 802455C8 00000000 */   nop
.L802455CC:
/* 173EAC 802455CC 0C039D91 */  jal       find_item
D_802455D0:
/* 173EB0 802455D0 24040095 */   addiu    $a0, $zero, 0x95
D_802455D4:
/* 173EB4 802455D4 04400017 */  bltz      $v0, D_80245634
glabel func_802455D8
/* 173EB8 802455D8 2405000A */   addiu    $a1, $zero, 0xA
/* 173EBC 802455DC 3C048028 */  lui       $a0, %hi(EVS_Mario_HandlePhase)
D_802455E0:
/* 173EC0 802455E0 24844EBC */  addiu     $a0, $a0, %lo(EVS_Mario_HandlePhase)
/* 173EC4 802455E4 0000302D */  daddu     $a2, $zero, $zero
D_802455E8:
/* 173EC8 802455E8 24020008 */  addiu     $v0, $zero, 0x8
/* 173ECC 802455EC 0C0B0CF8 */  jal       start_script
D_802455F0:
/* 173ED0 802455F0 A22201A7 */   sb       $v0, 0x1A7($s1)
D_802455F4:
/* 173ED4 802455F4 0040202D */  daddu     $a0, $v0, $zero
D_802455F8:
/* 173ED8 802455F8 AE0401D4 */  sw        $a0, 0x1D4($s0)
/* 173EDC 802455FC 8C830144 */  lw        $v1, 0x144($a0)
D_80245600:
/* 173EE0 80245600 24020002 */  addiu     $v0, $zero, 0x2
D_80245604:
/* 173EE4 80245604 AE620000 */  sw        $v0, 0x0($s3)
D_80245608:
/* 173EE8 80245608 AE0301E4 */  sw        $v1, 0x1E4($s0)
D_8024560C:
/* 173EEC 8024560C 0809158F */  j         .L8024563C
D_80245610:
/* 173EF0 80245610 AC800148 */   sw       $zero, 0x148($a0)
D_80245614:
/* 173EF4 80245614 8E0401E4 */  lw        $a0, 0x1E4($s0)
D_80245618:
/* 173EF8 80245618 0C0B1059 */  jal       does_script_exist
D_8024561C:
/* 173EFC 8024561C 00000000 */   nop
D_80245620:
/* 173F00 80245620 14400006 */  bnez      $v0, .L8024563C
D_80245624:
/* 173F04 80245624 00000000 */   nop
glabel func_80245628
/* 173F08 80245628 8222008C */  lb        $v0, 0x8C($s1)
/* 173F0C 8024562C 14400003 */  bnez      $v0, .L8024563C
sbk_02_D_80245630:
/* 173F10 80245630 00000000 */   nop
D_80245634:
/* 173F14 80245634 2402000A */  addiu     $v0, $zero, 0xA
D_80245638:
/* 173F18 80245638 AE620000 */  sw        $v0, 0x0($s3)
.L8024563C:
/* 173F1C 8024563C 3C03800E */  lui       $v1, %hi(gBattleSubState)
jtbl_80245640:
/* 173F20 80245640 8C63C4DC */  lw        $v1, %lo(gBattleSubState)($v1)
/* 173F24 80245644 2402000A */  addiu     $v0, $zero, 0xA
D_80245648:
/* 173F28 80245648 14620012 */  bne       $v1, $v0, D_80245694
glabel func_8024564C
/* 173F2C 8024564C 24030001 */   addiu    $v1, $zero, 0x1
D_80245650:
/* 173F30 80245650 3C02800B */  lui       $v0, %hi(gCurrentEncounter)
/* 173F34 80245654 24420F10 */  addiu     $v0, $v0, %lo(gCurrentEncounter)
/* 173F38 80245658 A0430009 */  sb        $v1, 0x9($v0)
/* 173F3C 8024565C 3C02800E */  lui       $v0, %hi(gBattleStatus + 0x4)
/* 173F40 80245660 8C42C074 */  lw        $v0, %lo(gBattleStatus + 0x4)($v0)
/* 173F44 80245664 3C030200 */  lui       $v1, (0x2000000 >> 16)
D_80245668:
/* 173F48 80245668 00431024 */  and       $v0, $v0, $v1
.L8024566C:
/* 173F4C 8024566C 14400007 */  bnez      $v0, .L8024568C
D_80245670:
/* 173F50 80245670 24020008 */   addiu    $v0, $zero, 0x8
D_80245674:
/* 173F54 80245674 AFA20010 */  sw        $v0, 0x10($sp)
glabel func_80245678
/* 173F58 80245678 0000202D */  daddu     $a0, $zero, $zero
/* 173F5C 8024567C 2405FFFF */  addiu     $a1, $zero, -0x1
/* 173F60 80245680 0080302D */  daddu     $a2, $a0, $zero
/* 173F64 80245684 0C052A46 */  jal       bgm_set_song
/* 173F68 80245688 240705DC */   addiu    $a3, $zero, 0x5DC
.L8024568C:
/* 173F6C 8024568C 0C090464 */  jal       func_80241190
.L80245690:
/* 173F70 80245690 24040020 */   addiu    $a0, $zero, 0x20
D_80245694:
/* 173F74 80245694 8FBF0028 */  lw        $ra, 0x28($sp)
D_80245698:
/* 173F78 80245698 8FB30024 */  lw        $s3, 0x24($sp)
glabel func_8024569C
/* 173F7C 8024569C 8FB20020 */  lw        $s2, 0x20($sp)
D_802456A0:
/* 173F80 802456A0 8FB1001C */  lw        $s1, 0x1C($sp)
D_802456A4:
/* 173F84 802456A4 8FB00018 */  lw        $s0, 0x18($sp)
glabel func_802456A8
/* 173F88 802456A8 03E00008 */  jr        $ra
D_802456AC:
/* 173F8C 802456AC 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

void btl_state_update_defeat(void) {
    BattleStatus* battleStatus = &gBattleStatus;
    EncounterStatus* currentEncounter = &gCurrentEncounter;
    Actor* player = battleStatus->playerActor;
    Actor* partner = battleStatus->partnerActor;
    Evt* script;

    switch (gBattleSubState) {
        case BTL_SUBSTATE_DEFEAT_INIT:
            battleStatus->flags1 &= ~BS_FLAGS1_SHOW_PLAYER_DECORATIONS;
            gBattleStatus.flags2 &= ~BS_FLAGS2_2;
            gBattleStatus.flags2 &= ~BS_FLAGS2_4;
            gBattleStatus.flags2 &= ~BS_FLAGS2_8;
            gBattleStatus.flags2 &= ~BS_FLAGS2_10;
            battleStatus->stateFreezeCount = 0;

            if (player->debuff != 0) {
                if (player->debuff == STATUS_KEY_FROZEN) {
                    sfx_play_sound(SOUND_FROZEN_SHATTER);
                    player->icePillarEffect->flags |= FX_INSTANCE_FLAG_DISMISS;
                    player->icePillarEffect = NULL;
                }
                player->debuff = 0;
                player->debuffDuration = 0;
                remove_status_debuff(player->hudElementDataIndex);
                player->koStatus = 0;
                player->koDuration = 0;
                player->disableEffect->data.disableX->koDuration = 0;
            }

            btl_cam_use_preset(BTL_CAM_PRESET_25);
            btl_cam_target_actor(ACTOR_PLAYER);
            battleStatus->battlePhase = PHASE_DEATH;
            script = start_script(&EVS_Mario_HandlePhase, EVT_PRIORITY_A, 0);
            player->takeTurnScript = script;
            player->takeTurnScriptID = script->id;
            script->owner1.actorID = ACTOR_PLAYER;

            if (partner != NULL) {
                script = start_script(partner->takeTurnSource, EVT_PRIORITY_A, 0);
                partner->takeTurnScript = script;
                partner->takeTurnScriptID = script->id;
                script->owner1.actorID = ACTOR_PARTNER;
            }
            gBattleSubState = BTL_SUBSTATE_DEFEAT_CHECK_LIFE_SHROOM;
            break;
        case BTL_SUBSTATE_DEFEAT_CHECK_LIFE_SHROOM:
            if (does_script_exist(player->takeTurnScriptID) || battleStatus->stateFreezeCount != 0) {
                break;
            }
            if (find_item(ITEM_LIFE_SHROOM) >= 0) {
                battleStatus->battlePhase = PHASE_USE_LIFE_SHROOM;
                script = start_script(&EVS_Mario_HandlePhase, EVT_PRIORITY_A, 0);
                player->takeTurnScript = script;
                player->takeTurnScriptID = script->id;
                script->owner1.actorID = ACTOR_PLAYER;
                gBattleSubState = BTL_SUBSTATE_DEFEAT_AWAIT_LIFE_SHROOM;
            } else {
                gBattleSubState = BTL_SUBSTATE_DEFEAT_DONE;
            }
            break;
        case BTL_SUBSTATE_DEFEAT_AWAIT_LIFE_SHROOM:
            if (does_script_exist(player->takeTurnScriptID) || battleStatus->stateFreezeCount != 0) {
                break;
            }
            // never reached if life shroom is successful. its item script calls RestorePreDefeatState,
            // resetting the state to BATTLE_STATE_ENEMY_MOVE (based on the value of gDefeatedBattleState)
            gBattleSubState = BTL_SUBSTATE_DEFEAT_DONE;
            break;
    }

    if (gBattleSubState == BTL_SUBSTATE_DEFEAT_DONE) {
        currentEncounter->battleOutcome = OUTCOME_PLAYER_LOST;
        if (!(gBattleStatus.flags2 & BS_FLAGS2_DONT_STOP_MUSIC)) {
            bgm_set_song(0, -1, 0, 1500, 8);
        }
        btl_set_state(BATTLE_STATE_END_BATTLE);
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel clear_model_data
/* AC444 80115D44 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* AC448 80115D48 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* AC44C 80115D4C 80420070 */  lb        $v0, 0x70($v0)
/* AC450 80115D50 1440002C */  bnez      $v0, .L80115E04
/* AC454 80115D54 00000000 */   nop
/* AC458 80115D58 3C028015 */  lui       $v0, %hi(wModelList)
/* AC45C 80115D5C 24421770 */  addiu     $v0, $v0, %lo(wModelList)
/* AC460 80115D60 3C018015 */  lui       $at, %hi(gCurrentModels)
/* AC464 80115D64 AC2212CC */  sw        $v0, %lo(gCurrentModels)($at)
/* AC468 80115D68 3C028015 */  lui       $v0, %hi(wTransformGroups)
/* AC46C 80115D6C 24421F70 */  addiu     $v0, $v0, %lo(wTransformGroups)
/* AC470 80115D70 3C018015 */  lui       $at, %hi(gCurrentTransformGroups)
/* AC474 80115D74 AC2212E0 */  sw        $v0, %lo(gCurrentTransformGroups)($at)
/* AC478 80115D78 3C028015 */  lui       $v0, %hi(wModelSpecialDls)
/* AC47C 80115D7C 24421F90 */  addiu     $v0, $v0, %lo(wModelSpecialDls)
/* AC480 80115D80 3C018015 */  lui       $at, %hi(gCurrentCustomModelGfxPtr)
/* AC484 80115D84 AC2212E8 */  sw        $v0, %lo(gCurrentCustomModelGfxPtr)($at)
/* AC488 80115D88 3C028015 */  lui       $v0, %hi(wCustomModelGfxBuilders)
/* AC48C 80115D8C 24422090 */  addiu     $v0, $v0, %lo(wCustomModelGfxBuilders)
/* AC490 80115D90 3C018015 */  lui       $at, %hi(gCurrentCustomModelGfxBuildersPtr)
/* AC494 80115D94 AC2212B8 */  sw        $v0, %lo(gCurrentCustomModelGfxBuildersPtr)($at)
/* AC498 80115D98 3C028015 */  lui       $v0, %hi(D_80152214)
/* AC49C 80115D9C 24422214 */  addiu     $v0, $v0, %lo(D_80152214)
/* AC4A0 80115DA0 3C018015 */  lui       $at, %hi(gCurrentModelTreeRoot)
/* AC4A4 80115DA4 AC2212FC */  sw        $v0, %lo(gCurrentModelTreeRoot)($at)
/* AC4A8 80115DA8 3C028015 */  lui       $v0, %hi(wModelLocalVtxBuffers)
/* AC4AC 80115DAC 24422190 */  addiu     $v0, $v0, %lo(wModelLocalVtxBuffers)
/* AC4B0 80115DB0 3C018015 */  lui       $at, %hi(gCurrentModelLocalVtxBuffers)
/* AC4B4 80115DB4 AC222210 */  sw        $v0, %lo(gCurrentModelLocalVtxBuffers)($at)
/* AC4B8 80115DB8 3C028015 */  lui       $v0, %hi(D_80152220)
/* AC4BC 80115DBC 24422220 */  addiu     $v0, $v0, %lo(D_80152220)
/* AC4C0 80115DC0 3C01800A */  lui       $at, %hi(mdl_currentModelTreeNodeInfo)
/* AC4C4 80115DC4 AC22A5F4 */  sw        $v0, %lo(mdl_currentModelTreeNodeInfo)($at)
/* AC4C8 80115DC8 3C028015 */  lui       $v0, %hi(wBackgroundFogMode)
/* AC4CC 80115DCC 24423220 */  addiu     $v0, $v0, %lo(wBackgroundFogMode)
/* AC4D0 80115DD0 3C018015 */  lui       $at, %hi(gBackgroundFogModePtr)
/* AC4D4 80115DD4 AC2212F0 */  sw        $v0, %lo(gBackgroundFogModePtr)($at)
/* AC4D8 80115DD8 3C028015 */  lui       $v0, %hi(wFogSettings)
/* AC4DC 80115DDC 24423228 */  addiu     $v0, $v0, %lo(wFogSettings)
/* AC4E0 80115DE0 3C018015 */  lui       $at, %hi(mdl_bgMultiplyColorA)
/* AC4E4 80115DE4 A020B74C */  sb        $zero, %lo(mdl_bgMultiplyColorA)($at)
/* AC4E8 80115DE8 3C018015 */  lui       $at, %hi(mdl_bgMultiplyColorR)
/* AC4EC 80115DEC A020B74D */  sb        $zero, %lo(mdl_bgMultiplyColorR)($at)
/* AC4F0 80115DF0 3C018015 */  lui       $at, %hi(mdl_bgMultiplyColorG)
/* AC4F4 80115DF4 A020B74E */  sb        $zero, %lo(mdl_bgMultiplyColorG)($at)
/* AC4F8 80115DF8 3C018015 */  lui       $at, %hi(mdl_bgMultiplyColorB)
/* AC4FC 80115DFC 080457A3 */  j         .L80115E8C
/* AC500 80115E00 A020B74F */   sb       $zero, %lo(mdl_bgMultiplyColorB)($at)
.L80115E04:
/* AC504 80115E04 3C028015 */  lui       $v0, %hi(bModelList)
/* AC508 80115E08 24421B70 */  addiu     $v0, $v0, %lo(bModelList)
/* AC50C 80115E0C 3C018015 */  lui       $at, %hi(gCurrentModels)
/* AC510 80115E10 AC2212CC */  sw        $v0, %lo(gCurrentModels)($at)
/* AC514 80115E14 3C028015 */  lui       $v0, %hi(bTransformGroups)
/* AC518 80115E18 24421F80 */  addiu     $v0, $v0, %lo(bTransformGroups)
/* AC51C 80115E1C 3C018015 */  lui       $at, %hi(gCurrentTransformGroups)
/* AC520 80115E20 AC2212E0 */  sw        $v0, %lo(gCurrentTransformGroups)($at)
/* AC524 80115E24 3C028015 */  lui       $v0, %hi(bModelSpecialDls)
/* AC528 80115E28 24422010 */  addiu     $v0, $v0, %lo(bModelSpecialDls)
/* AC52C 80115E2C 3C018015 */  lui       $at, %hi(gCurrentCustomModelGfxPtr)
/* AC530 80115E30 AC2212E8 */  sw        $v0, %lo(gCurrentCustomModelGfxPtr)($at)
/* AC534 80115E34 3C028015 */  lui       $v0, %hi(bCustomModelGfxBuilders)
/* AC538 80115E38 24422110 */  addiu     $v0, $v0, %lo(bCustomModelGfxBuilders)
/* AC53C 80115E3C 3C018015 */  lui       $at, %hi(gCurrentCustomModelGfxBuildersPtr)
/* AC540 80115E40 AC2212B8 */  sw        $v0, %lo(gCurrentCustomModelGfxBuildersPtr)($at)
/* AC544 80115E44 3C028015 */  lui       $v0, %hi(D_80152218)
/* AC548 80115E48 24422218 */  addiu     $v0, $v0, %lo(D_80152218)
/* AC54C 80115E4C 3C018015 */  lui       $at, %hi(gCurrentModelTreeRoot)
/* AC550 80115E50 AC2212FC */  sw        $v0, %lo(gCurrentModelTreeRoot)($at)
/* AC554 80115E54 3C028015 */  lui       $v0, %hi(bModelLocalVtxBuffers)
/* AC558 80115E58 244221D0 */  addiu     $v0, $v0, %lo(bModelLocalVtxBuffers)
/* AC55C 80115E5C 3C018015 */  lui       $at, %hi(gCurrentModelLocalVtxBuffers)
/* AC560 80115E60 AC222210 */  sw        $v0, %lo(gCurrentModelLocalVtxBuffers)($at)
/* AC564 80115E64 3C028015 */  lui       $v0, %hi(D_80152A20)
/* AC568 80115E68 24422A20 */  addiu     $v0, $v0, %lo(D_80152A20)
/* AC56C 80115E6C 3C01800A */  lui       $at, %hi(mdl_currentModelTreeNodeInfo)
/* AC570 80115E70 AC22A5F4 */  sw        $v0, %lo(mdl_currentModelTreeNodeInfo)($at)
/* AC574 80115E74 3C028015 */  lui       $v0, %hi(bBackgroundFogMode)
/* AC578 80115E78 24423221 */  addiu     $v0, $v0, %lo(bBackgroundFogMode)
/* AC57C 80115E7C 3C018015 */  lui       $at, %hi(gBackgroundFogModePtr)
/* AC580 80115E80 AC2212F0 */  sw        $v0, %lo(gBackgroundFogModePtr)($at)
/* AC584 80115E84 3C028015 */  lui       $v0, %hi(bFogSettings)
/* AC588 80115E88 24423248 */  addiu     $v0, $v0, %lo(bFogSettings)
.L80115E8C:
/* AC58C 80115E8C 3C018015 */  lui       $at, %hi(gCurrentFogSettings)
/* AC590 80115E90 AC223264 */  sw        $v0, %lo(gCurrentFogSettings)($at)
/* AC594 80115E94 3C028015 */  lui       $v0, %hi(gCurrentModels)
/* AC598 80115E98 8C4212CC */  lw        $v0, %lo(gCurrentModels)($v0)
/* AC59C 80115E9C 240400FF */  addiu     $a0, $zero, 0xFF
/* AC5A0 80115EA0 244203FC */  addiu     $v0, $v0, 0x3FC
.L80115EA4:
/* AC5A4 80115EA4 AC400000 */  sw        $zero, 0x0($v0)
/* AC5A8 80115EA8 2484FFFF */  addiu     $a0, $a0, -0x1
/* AC5AC 80115EAC 0481FFFD */  bgez      $a0, .L80115EA4
/* AC5B0 80115EB0 2442FFFC */   addiu    $v0, $v0, -0x4
/* AC5B4 80115EB4 3C028015 */  lui       $v0, %hi(gCurrentTransformGroups)
/* AC5B8 80115EB8 8C4212E0 */  lw        $v0, %lo(gCurrentTransformGroups)($v0)
/* AC5BC 80115EBC 24040003 */  addiu     $a0, $zero, 0x3
/* AC5C0 80115EC0 2442000C */  addiu     $v0, $v0, 0xC
.L80115EC4:
/* AC5C4 80115EC4 AC400000 */  sw        $zero, 0x0($v0)
/* AC5C8 80115EC8 2484FFFF */  addiu     $a0, $a0, -0x1
/* AC5CC 80115ECC 0481FFFD */  bgez      $a0, .L80115EC4
/* AC5D0 80115ED0 2442FFFC */   addiu    $v0, $v0, -0x4
/* AC5D4 80115ED4 0000202D */  daddu     $a0, $zero, $zero
/* AC5D8 80115ED8 3C058015 */  lui       $a1, %hi(gCurrentCustomModelGfxBuildersPtr)
/* AC5DC 80115EDC 8CA512B8 */  lw        $a1, %lo(gCurrentCustomModelGfxBuildersPtr)($a1)
/* AC5E0 80115EE0 3C038015 */  lui       $v1, %hi(gCurrentCustomModelGfxPtr)
/* AC5E4 80115EE4 8C6312E8 */  lw        $v1, %lo(gCurrentCustomModelGfxPtr)($v1)
.L80115EE8:
/* AC5E8 80115EE8 AC600000 */  sw        $zero, 0x0($v1)
/* AC5EC 80115EEC ACA00000 */  sw        $zero, 0x0($a1)
/* AC5F0 80115EF0 24A50004 */  addiu     $a1, $a1, 0x4
/* AC5F4 80115EF4 24840001 */  addiu     $a0, $a0, 0x1
/* AC5F8 80115EF8 28820020 */  slti      $v0, $a0, 0x20
/* AC5FC 80115EFC 1440FFFA */  bnez      $v0, .L80115EE8
/* AC600 80115F00 24630004 */   addiu    $v1, $v1, 0x4
/* AC604 80115F04 0000202D */  daddu     $a0, $zero, $zero
/* AC608 80115F08 3C05800A */  lui       $a1, %hi(mdl_currentModelTreeNodeInfo)
/* AC60C 80115F0C 24A5A5F4 */  addiu     $a1, $a1, %lo(mdl_currentModelTreeNodeInfo)
/* AC610 80115F10 3C028015 */  lui       $v0, %hi(gCurrentModelTreeRoot)
/* AC614 80115F14 8C4212FC */  lw        $v0, %lo(gCurrentModelTreeRoot)($v0)
/* AC618 80115F18 240600FF */  addiu     $a2, $zero, 0xFF
/* AC61C 80115F1C AC400000 */  sw        $zero, 0x0($v0)
.L80115F20:
/* AC620 80115F20 8CA20000 */  lw        $v0, 0x0($a1)
/* AC624 80115F24 00041880 */  sll       $v1, $a0, 2
/* AC628 80115F28 00621021 */  addu      $v0, $v1, $v0
/* AC62C 80115F2C A0460000 */  sb        $a2, 0x0($v0)
/* AC630 80115F30 8CA20000 */  lw        $v0, 0x0($a1)
/* AC634 80115F34 00621021 */  addu      $v0, $v1, $v0
/* AC638 80115F38 A0400001 */  sb        $zero, 0x1($v0)
/* AC63C 80115F3C 8CA20000 */  lw        $v0, 0x0($a1)
/* AC640 80115F40 24840001 */  addiu     $a0, $a0, 0x1
/* AC644 80115F44 00621821 */  addu      $v1, $v1, $v0
/* AC648 80115F48 28820200 */  slti      $v0, $a0, 0x200
/* AC64C 80115F4C 1440FFF4 */  bnez      $v0, .L80115F20
/* AC650 80115F50 A0600002 */   sb       $zero, 0x2($v1)
/* AC654 80115F54 0000202D */  daddu     $a0, $zero, $zero
/* AC658 80115F58 3C088015 */  lui       $t0, %hi(texPannerMainU)
/* AC65C 80115F5C 25083268 */  addiu     $t0, $t0, %lo(texPannerMainU)
/* AC660 80115F60 3C078015 */  lui       $a3, %hi(texPannerMainV)
/* AC664 80115F64 24E732A8 */  addiu     $a3, $a3, %lo(texPannerMainV)
/* AC668 80115F68 3C068015 */  lui       $a2, %hi(texPannerAuxU)
/* AC66C 80115F6C 24C632E8 */  addiu     $a2, $a2, %lo(texPannerAuxU)
/* AC670 80115F70 3C028015 */  lui       $v0, %hi(gBackgroundFogModePtr)
/* AC674 80115F74 8C4212F0 */  lw        $v0, %lo(gBackgroundFogModePtr)($v0)
/* AC678 80115F78 3C058015 */  lui       $a1, %hi(texPannerAuxV)
/* AC67C 80115F7C 24A53328 */  addiu     $a1, $a1, %lo(texPannerAuxV)
/* AC680 80115F80 A0400000 */  sb        $zero, 0x0($v0)
/* AC684 80115F84 3C038015 */  lui       $v1, %hi(gCurrentFogSettings)
/* AC688 80115F88 8C633264 */  lw        $v1, %lo(gCurrentFogSettings)($v1)
/* AC68C 80115F8C 2402000A */  addiu     $v0, $zero, 0xA
/* AC690 80115F90 AC620004 */  sw        $v0, 0x4($v1)
/* AC694 80115F94 AC620008 */  sw        $v0, 0x8($v1)
/* AC698 80115F98 AC62000C */  sw        $v0, 0xC($v1)
/* AC69C 80115F9C 240203B6 */  addiu     $v0, $zero, 0x3B6
/* AC6A0 80115FA0 AC620014 */  sw        $v0, 0x14($v1)
/* AC6A4 80115FA4 240203E8 */  addiu     $v0, $zero, 0x3E8
/* AC6A8 80115FA8 AC600000 */  sw        $zero, 0x0($v1)
/* AC6AC 80115FAC AC600010 */  sw        $zero, 0x10($v1)
/* AC6B0 80115FB0 AC620018 */  sw        $v0, 0x18($v1)
.L80115FB4:
/* AC6B4 80115FB4 ACA00000 */  sw        $zero, 0x0($a1)
/* AC6B8 80115FB8 ACC00000 */  sw        $zero, 0x0($a2)
/* AC6BC 80115FBC ACE00000 */  sw        $zero, 0x0($a3)
/* AC6C0 80115FC0 AD000000 */  sw        $zero, 0x0($t0)
/* AC6C4 80115FC4 25080004 */  addiu     $t0, $t0, 0x4
/* AC6C8 80115FC8 24E70004 */  addiu     $a3, $a3, 0x4
/* AC6CC 80115FCC 24C60004 */  addiu     $a2, $a2, 0x4
/* AC6D0 80115FD0 24840001 */  addiu     $a0, $a0, 0x1
/* AC6D4 80115FD4 28820010 */  slti      $v0, $a0, 0x10
/* AC6D8 80115FD8 1440FFF6 */  bnez      $v0, .L80115FB4
/* AC6DC 80115FDC 24A50004 */   addiu    $a1, $a1, 0x4
/* AC6E0 80115FE0 03E00008 */  jr        $ra
/* AC6E4 80115FE4 00000000 */   nop

### DECOMPILED C INSTRUCTIONS:

void clear_model_data(void) {
    s32 i;

    if (!gGameStatusPtr->isBattle) {
        gCurrentModels = &wModelList;
        gCurrentTransformGroups = &wTransformGroups;
        gCurrentCustomModelGfxPtr = &wModelSpecialDls;
        gCurrentCustomModelGfxBuildersPtr = &wCustomModelGfxBuilders;
        gCurrentModelTreeRoot = &D_80152214;
        gCurrentModelLocalVtxBuffers = &wModelLocalVtxBuffers;
        mdl_currentModelTreeNodeInfo = &D_80152220;
        gBackgroundFogModePtr = &wBackgroundFogMode;
        mdl_bgMultiplyColorA = 0;
        mdl_bgMultiplyColorR = 0;
        mdl_bgMultiplyColorG = 0;
        mdl_bgMultiplyColorB = 0;
        gCurrentFogSettings = &wFogSettings;
    } else {
        gCurrentModels = &bModelList;
        gCurrentTransformGroups = &bTransformGroups;
        gCurrentCustomModelGfxPtr = &bModelSpecialDls;
        gCurrentCustomModelGfxBuildersPtr = &bCustomModelGfxBuilders;
        gCurrentModelTreeRoot = &D_80152218;
        gCurrentModelLocalVtxBuffers = &bModelLocalVtxBuffers;
        mdl_currentModelTreeNodeInfo = &D_80152A20;
        gBackgroundFogModePtr = &bBackgroundFogMode;
        gCurrentFogSettings = &bFogSettings;
    }

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

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

    for (i = 0; i < ARRAY_COUNT(*gCurrentCustomModelGfxPtr); i++) {
        (*gCurrentCustomModelGfxPtr)[i] = 0;
        (*gCurrentCustomModelGfxBuildersPtr)[i] = 0;
    }

    *gCurrentModelTreeRoot = NULL;

    for (i = 0; i < ARRAY_COUNT(*mdl_currentModelTreeNodeInfo); i++) {
        (*mdl_currentModelTreeNodeInfo)[i].modelIndex = -1;
        (*mdl_currentModelTreeNodeInfo)[i].treeDepth = 0;
        (*mdl_currentModelTreeNodeInfo)[i].textureID = 0;
    }

    *gBackgroundFogModePtr = FOG_MODE_0;
    gCurrentFogSettings->color.r = 10;
    gCurrentFogSettings->color.g = 10;
    gCurrentFogSettings->color.b = 10;
    gCurrentFogSettings->startDistance = 950;
    gCurrentFogSettings->enabled = FALSE;
    gCurrentFogSettings->color.a = 0;
    gCurrentFogSettings->endDistance = 1000;

    for (i = 0; i < ARRAY_COUNT(texPannerAuxV); i++) {
        texPannerAuxV[i] = 0;
        texPannerAuxU[i] = 0;
        texPannerMainV[i] = 0;
        texPannerMainU[i] = 0;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_E005E334
/* 3628F4 E005E334 27BDFEF0 */  addiu     $sp, $sp, -0x110
/* 3628F8 E005E338 AFBF0104 */  sw        $ra, 0x104($sp)
/* 3628FC E005E33C AFBE0100 */  sw        $fp, 0x100($sp)
/* 362900 E005E340 AFB700FC */  sw        $s7, 0xFC($sp)
/* 362904 E005E344 AFB600F8 */  sw        $s6, 0xF8($sp)
/* 362908 E005E348 AFB500F4 */  sw        $s5, 0xF4($sp)
/* 36290C E005E34C AFB400F0 */  sw        $s4, 0xF0($sp)
/* 362910 E005E350 AFB300EC */  sw        $s3, 0xEC($sp)
/* 362914 E005E354 AFB200E8 */  sw        $s2, 0xE8($sp)
/* 362918 E005E358 AFB100E4 */  sw        $s1, 0xE4($sp)
/* 36291C E005E35C AFB000E0 */  sw        $s0, 0xE0($sp)
/* 362920 E005E360 F7B40108 */  sdc1      $f20, 0x108($sp)
/* 362924 E005E364 AFA40110 */  sw        $a0, 0x110($sp)
/* 362928 E005E368 8C92000C */  lw        $s2, 0xC($a0)
/* 36292C E005E36C 8E420028 */  lw        $v0, 0x28($s2)
/* 362930 E005E370 104000B2 */  beqz      $v0, .LE005E63C
/* 362934 E005E374 3C07DB06 */   lui      $a3, (0xDB060024 >> 16)
/* 362938 E005E378 34E70024 */  ori       $a3, $a3, (0xDB060024 & 0xFFFF)
/* 36293C E005E37C 27A40018 */  addiu     $a0, $sp, 0x18
/* 362940 E005E380 3C110001 */  lui       $s1, (0x11630 >> 16)
/* 362944 E005E384 3C16800A */  lui       $s6, %hi(gMainGfxPos)
/* 362948 E005E388 26D6A66C */  addiu     $s6, $s6, %lo(gMainGfxPos)
/* 36294C E005E38C 8EC30000 */  lw        $v1, 0x0($s6)
/* 362950 E005E390 36311630 */  ori       $s1, $s1, (0x11630 & 0xFFFF)
/* 362954 E005E394 0060282D */  daddu     $a1, $v1, $zero
/* 362958 E005E398 24630008 */  addiu     $v1, $v1, 0x8
/* 36295C E005E39C AEC30000 */  sw        $v1, 0x0($s6)
/* 362960 E005E3A0 3C08E006 */  lui       $t0, (0xE0060000 >> 16)
/* 362964 E005E3A4 8D08E670 */  lw        $t0, -0x1990($t0)
/* 362968 E005E3A8 3C06E006 */  lui       $a2, (0xE0060000 >> 16)
/* 36296C E005E3AC 8CC6E674 */  lw        $a2, -0x198C($a2)
/* 362970 E005E3B0 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 362974 E005E3B4 AFA800D8 */  sw        $t0, 0xD8($sp)
/* 362978 E005E3B8 ACA20000 */  sw        $v0, 0x0($a1)
/* 36297C E005E3BC 24620008 */  addiu     $v0, $v1, 0x8
/* 362980 E005E3C0 ACA00004 */  sw        $zero, 0x4($a1)
/* 362984 E005E3C4 AEC20000 */  sw        $v0, 0x0($s6)
/* 362988 E005E3C8 AC670000 */  sw        $a3, 0x0($v1)
/* 36298C E005E3CC 8FA80110 */  lw        $t0, 0x110($sp)
/* 362990 E005E3D0 8D050010 */  lw        $a1, 0x10($t0)
/* 362994 E005E3D4 24620010 */  addiu     $v0, $v1, 0x10
/* 362998 E005E3D8 AEC20000 */  sw        $v0, 0x0($s6)
/* 36299C E005E3DC 8CA5001C */  lw        $a1, 0x1C($a1)
/* 3629A0 E005E3E0 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 3629A4 E005E3E4 AC620008 */  sw        $v0, 0x8($v1)
/* 3629A8 E005E3E8 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 3629AC E005E3EC AC66000C */  sw        $a2, 0xC($v1)
/* 3629B0 E005E3F0 00A22821 */  addu      $a1, $a1, $v0
/* 3629B4 E005E3F4 AC650004 */  sw        $a1, 0x4($v1)
/* 3629B8 E005E3F8 8E450004 */  lw        $a1, 0x4($s2)
/* 3629BC E005E3FC 8E460008 */  lw        $a2, 0x8($s2)
/* 3629C0 E005E400 8E47000C */  lw        $a3, 0xC($s2)
/* 3629C4 E005E404 4480A000 */  mtc1      $zero, $f20
/* 3629C8 E005E408 0C080108 */  jal       shim_guTranslateF
/* 3629CC E005E40C 24140001 */   addiu    $s4, $zero, 0x1
/* 3629D0 E005E410 27B30058 */  addiu     $s3, $sp, 0x58
/* 3629D4 E005E414 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 3629D8 E005E418 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 3629DC E005E41C 4406A000 */  mfc1      $a2, $f20
/* 3629E0 E005E420 00031080 */  sll       $v0, $v1, 2
/* 3629E4 E005E424 00431021 */  addu      $v0, $v0, $v1
/* 3629E8 E005E428 00021080 */  sll       $v0, $v0, 2
/* 3629EC E005E42C 00431023 */  subu      $v0, $v0, $v1
/* 3629F0 E005E430 000218C0 */  sll       $v1, $v0, 3
/* 3629F4 E005E434 00431021 */  addu      $v0, $v0, $v1
/* 3629F8 E005E438 000210C0 */  sll       $v0, $v0, 3
/* 3629FC E005E43C 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 362A00 E005E440 00220821 */  addu      $at, $at, $v0
/* 362A04 E005E444 C4201DEC */  lwc1      $f0, %lo(gCameras + 0x6C)($at)
/* 362A08 E005E448 3C073F80 */  lui       $a3, (0x3F800000 >> 16)
/* 362A0C E005E44C 46000007 */  neg.s     $f0, $f0
/* 362A10 E005E450 44050000 */  mfc1      $a1, $f0
/* 362A14 E005E454 0260202D */  daddu     $a0, $s3, $zero
/* 362A18 E005E458 0C080104 */  jal       shim_guRotateF
/* 362A1C E005E45C E7B40010 */   swc1     $f20, 0x10($sp)
/* 362A20 E005E460 0260202D */  daddu     $a0, $s3, $zero
/* 362A24 E005E464 27A50018 */  addiu     $a1, $sp, 0x18
/* 362A28 E005E468 27B00098 */  addiu     $s0, $sp, 0x98
/* 362A2C E005E46C 0C080114 */  jal       shim_guMtxCatF
/* 362A30 E005E470 0200302D */   daddu    $a2, $s0, $zero
/* 362A34 E005E474 0200202D */  daddu     $a0, $s0, $zero
/* 362A38 E005E478 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* 362A3C E005E47C 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* 362A40 E005E480 3C17800A */  lui       $s7, %hi(gDisplayContext)
/* 362A44 E005E484 26F7A674 */  addiu     $s7, $s7, %lo(gDisplayContext)
/* 362A48 E005E488 96050000 */  lhu       $a1, 0x0($s0)
/* 362A4C E005E48C 8EE20000 */  lw        $v0, 0x0($s7)
/* 362A50 E005E490 00052980 */  sll       $a1, $a1, 6
/* 362A54 E005E494 00B12821 */  addu      $a1, $a1, $s1
/* 362A58 E005E498 0C080118 */  jal       shim_guMtxF2L
/* 362A5C E005E49C 00452821 */   addu     $a1, $v0, $a1
/* 362A60 E005E4A0 3C06DCDC */  lui       $a2, (0xDCDC28FF >> 16)
/* 362A64 E005E4A4 8EC40000 */  lw        $a0, 0x0($s6)
/* 362A68 E005E4A8 34C628FF */  ori       $a2, $a2, (0xDCDC28FF & 0xFFFF)
/* 362A6C E005E4AC 0080282D */  daddu     $a1, $a0, $zero
/* 362A70 E005E4B0 24840008 */  addiu     $a0, $a0, 0x8
/* 362A74 E005E4B4 AEC40000 */  sw        $a0, 0x0($s6)
/* 362A78 E005E4B8 96020000 */  lhu       $v0, 0x0($s0)
/* 362A7C E005E4BC 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 362A80 E005E4C0 ACA30000 */  sw        $v1, 0x0($a1)
/* 362A84 E005E4C4 00541821 */  addu      $v1, $v0, $s4
/* 362A88 E005E4C8 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 362A8C E005E4CC 00021180 */  sll       $v0, $v0, 6
/* 362A90 E005E4D0 A6030000 */  sh        $v1, 0x0($s0)
/* 362A94 E005E4D4 8EE30000 */  lw        $v1, 0x0($s7)
/* 362A98 E005E4D8 00511021 */  addu      $v0, $v0, $s1
/* 362A9C E005E4DC 00621821 */  addu      $v1, $v1, $v0
/* 362AA0 E005E4E0 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 362AA4 E005E4E4 ACA30004 */  sw        $v1, 0x4($a1)
/* 362AA8 E005E4E8 AC820000 */  sw        $v0, 0x0($a0)
/* 362AAC E005E4EC AC860004 */  sw        $a2, 0x4($a0)
/* 362AB0 E005E4F0 8FA80110 */  lw        $t0, 0x110($sp)
/* 362AB4 E005E4F4 2652002C */  addiu     $s2, $s2, 0x2C
/* 362AB8 E005E4F8 8D020008 */  lw        $v0, 0x8($t0)
/* 362ABC E005E4FC 24840008 */  addiu     $a0, $a0, 0x8
/* 362AC0 E005E500 0282102A */  slt       $v0, $s4, $v0
/* 362AC4 E005E504 10400042 */  beqz      $v0, .LE005E610
/* 362AC8 E005E508 AEC40000 */   sw       $a0, 0x0($s6)
/* 362ACC E005E50C 0260A82D */  daddu     $s5, $s3, $zero
/* 362AD0 E005E510 02E0F02D */  daddu     $fp, $s7, $zero
/* 362AD4 E005E514 0200B82D */  daddu     $s7, $s0, $zero
/* 362AD8 E005E518 3C130001 */  lui       $s3, (0x11630 >> 16)
/* 362ADC E005E51C 36731630 */  ori       $s3, $s3, (0x11630 & 0xFFFF)
/* 362AE0 E005E520 02C0882D */  daddu     $s1, $s6, $zero
/* 362AE4 E005E524 26500018 */  addiu     $s0, $s2, 0x18
.LE005E528:
/* 362AE8 E005E528 8E05FFEC */  lw        $a1, -0x14($s0)
/* 362AEC E005E52C 8E06FFF0 */  lw        $a2, -0x10($s0)
/* 362AF0 E005E530 8E07FFF4 */  lw        $a3, -0xC($s0)
/* 362AF4 E005E534 0C080108 */  jal       shim_guTranslateF
/* 362AF8 E005E538 27A40018 */   addiu    $a0, $sp, 0x18
/* 362AFC E005E53C 4406A000 */  mfc1      $a2, $f20
/* 362B00 E005E540 4407A000 */  mfc1      $a3, $f20
/* 362B04 E005E544 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 362B08 E005E548 44810000 */  mtc1      $at, $f0
/* 362B0C E005E54C 26940001 */  addiu     $s4, $s4, 0x1
/* 362B10 E005E550 E7A00010 */  swc1      $f0, 0x10($sp)
/* 362B14 E005E554 8E050000 */  lw        $a1, 0x0($s0)
/* 362B18 E005E558 0C080104 */  jal       shim_guRotateF
/* 362B1C E005E55C 02A0202D */   daddu    $a0, $s5, $zero
/* 362B20 E005E560 02A0202D */  daddu     $a0, $s5, $zero
/* 362B24 E005E564 27A50018 */  addiu     $a1, $sp, 0x18
/* 362B28 E005E568 0C080114 */  jal       shim_guMtxCatF
/* 362B2C E005E56C 00A0302D */   daddu    $a2, $a1, $zero
/* 362B30 E005E570 27A40018 */  addiu     $a0, $sp, 0x18
/* 362B34 E005E574 96E50000 */  lhu       $a1, 0x0($s7)
/* 362B38 E005E578 8FC20000 */  lw        $v0, 0x0($fp)
/* 362B3C E005E57C 00052980 */  sll       $a1, $a1, 6
/* 362B40 E005E580 00B32821 */  addu      $a1, $a1, $s3
/* 362B44 E005E584 0C080118 */  jal       shim_guMtxF2L
/* 362B48 E005E588 00452821 */   addu     $a1, $v0, $a1
/* 362B4C E005E58C 3C06D838 */  lui       $a2, (0xD8380002 >> 16)
/* 362B50 E005E590 8E240000 */  lw        $a0, 0x0($s1)
/* 362B54 E005E594 34C60002 */  ori       $a2, $a2, (0xD8380002 & 0xFFFF)
/* 362B58 E005E598 0080282D */  daddu     $a1, $a0, $zero
/* 362B5C E005E59C 24840008 */  addiu     $a0, $a0, 0x8
/* 362B60 E005E5A0 AE240000 */  sw        $a0, 0x0($s1)
/* 362B64 E005E5A4 96E20000 */  lhu       $v0, 0x0($s7)
/* 362B68 E005E5A8 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 362B6C E005E5AC ACA30000 */  sw        $v1, 0x0($a1)
/* 362B70 E005E5B0 24430001 */  addiu     $v1, $v0, 0x1
/* 362B74 E005E5B4 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 362B78 E005E5B8 00021180 */  sll       $v0, $v0, 6
/* 362B7C E005E5BC A6E30000 */  sh        $v1, 0x0($s7)
/* 362B80 E005E5C0 8FC30000 */  lw        $v1, 0x0($fp)
/* 362B84 E005E5C4 00531021 */  addu      $v0, $v0, $s3
/* 362B88 E005E5C8 00621821 */  addu      $v1, $v1, $v0
/* 362B8C E005E5CC 24820008 */  addiu     $v0, $a0, 0x8
/* 362B90 E005E5D0 ACA30004 */  sw        $v1, 0x4($a1)
/* 362B94 E005E5D4 AE220000 */  sw        $v0, 0x0($s1)
/* 362B98 E005E5D8 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 362B9C E005E5DC AC820000 */  sw        $v0, 0x0($a0)
/* 362BA0 E005E5E0 8FA800D8 */  lw        $t0, 0xD8($sp)
/* 362BA4 E005E5E4 24020040 */  addiu     $v0, $zero, 0x40
/* 362BA8 E005E5E8 AC860008 */  sw        $a2, 0x8($a0)
/* 362BAC E005E5EC AC82000C */  sw        $v0, 0xC($a0)
/* 362BB0 E005E5F0 AC880004 */  sw        $t0, 0x4($a0)
/* 362BB4 E005E5F4 8FA80110 */  lw        $t0, 0x110($sp)
/* 362BB8 E005E5F8 2610002C */  addiu     $s0, $s0, 0x2C
/* 362BBC E005E5FC 8D020008 */  lw        $v0, 0x8($t0)
/* 362BC0 E005E600 24840010 */  addiu     $a0, $a0, 0x10
/* 362BC4 E005E604 0282102A */  slt       $v0, $s4, $v0
/* 362BC8 E005E608 1440FFC7 */  bnez      $v0, .LE005E528
/* 362BCC E005E60C AE240000 */   sw       $a0, 0x0($s1)
.LE005E610:
/* 362BD0 E005E610 3C05D838 */  lui       $a1, (0xD8380002 >> 16)
/* 362BD4 E005E614 3C03800A */  lui       $v1, %hi(gMainGfxPos)
/* 362BD8 E005E618 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
/* 362BDC E005E61C 8C620000 */  lw        $v0, 0x0($v1)
/* 362BE0 E005E620 34A50002 */  ori       $a1, $a1, (0xD8380002 & 0xFFFF)
/* 362BE4 E005E624 0040202D */  daddu     $a0, $v0, $zero
/* 362BE8 E005E628 24420008 */  addiu     $v0, $v0, 0x8
/* 362BEC E005E62C AC620000 */  sw        $v0, 0x0($v1)
/* 362BF0 E005E630 24020040 */  addiu     $v0, $zero, 0x40
/* 362BF4 E005E634 AC850000 */  sw        $a1, 0x0($a0)
/* 362BF8 E005E638 AC820004 */  sw        $v0, 0x4($a0)
.LE005E63C:
/* 362BFC E005E63C 8FBF0104 */  lw        $ra, 0x104($sp)
/* 362C00 E005E640 8FBE0100 */  lw        $fp, 0x100($sp)
/* 362C04 E005E644 8FB700FC */  lw        $s7, 0xFC($sp)
/* 362C08 E005E648 8FB600F8 */  lw        $s6, 0xF8($sp)
/* 362C0C E005E64C 8FB500F4 */  lw        $s5, 0xF4($sp)
/* 362C10 E005E650 8FB400F0 */  lw        $s4, 0xF0($sp)
/* 362C14 E005E654 8FB300EC */  lw        $s3, 0xEC($sp)
/* 362C18 E005E658 8FB200E8 */  lw        $s2, 0xE8($sp)
/* 362C1C E005E65C 8FB100E4 */  lw        $s1, 0xE4($sp)
/* 362C20 E005E660 8FB000E0 */  lw        $s0, 0xE0($sp)
/* 362C24 E005E664 D7B40108 */  ldc1      $f20, 0x108($sp)
/* 362C28 E005E668 03E00008 */  jr        $ra
/* 362C2C E005E66C 27BD0110 */   addiu    $sp, $sp, 0x110

### DECOMPILED C INSTRUCTIONS:

void func_E005E334(EffectInstance* effect) {
    StarsOrbitingFXData* part = effect->data.starsOrbiting;
    Matrix4f sp18;
    Matrix4f sp58;
    Matrix4f sp98;
    s32 i;

    if (part->enabled) {
        Gfx* dlist = D_E005E670[0];
        Gfx* dlist2 = D_E005E674[0];

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

        shim_guTranslateF(sp18, part->pos.x, part->pos.y, part->pos.z);
        shim_guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f);
        shim_guMtxCatF(sp58, sp18, sp98);
        shim_guMtxF2L(sp98, &gDisplayContext->matrixStack[gMatrixListPos]);

        gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
        gDPSetPrimColor(gMainGfxPos++, 0, 0, 220, 220, 40, 255);

        part++;
        for (i = 1; i < effect->numParts; i++, part++) {
            shim_guTranslateF(sp18, part->pos.x, part->pos.y, part->pos.z);
            shim_guRotateF(sp58, part->roll, 0.0f, 0.0f, 1.0f);
            shim_guMtxCatF(sp58, sp18, sp18);
            shim_guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);

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

        gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel update_item_entities
/* C85EC 80131EEC 3C02800A */  lui       $v0, %hi(gOverrideFlags)
/* C85F0 80131EF0 8C42A650 */  lw        $v0, %lo(gOverrideFlags)($v0)
/* C85F4 80131EF4 27BDFFC0 */  addiu     $sp, $sp, -0x40
/* C85F8 80131EF8 AFBF0038 */  sw        $ra, 0x38($sp)
/* C85FC 80131EFC AFB30034 */  sw        $s3, 0x34($sp)
/* C8600 80131F00 AFB20030 */  sw        $s2, 0x30($sp)
/* C8604 80131F04 AFB1002C */  sw        $s1, 0x2C($sp)
/* C8608 80131F08 30420C00 */  andi      $v0, $v0, 0xC00
/* C860C 80131F0C 1440009E */  bnez      $v0, .L80132188
/* C8610 80131F10 AFB00028 */   sw       $s0, 0x28($sp)
/* C8614 80131F14 0000982D */  daddu     $s3, $zero, $zero
/* C8618 80131F18 0260902D */  daddu     $s2, $s3, $zero
.L80131F1C:
/* C861C 80131F1C 3C028015 */  lui       $v0, %hi(gCurrentItemEntities)
/* C8620 80131F20 8C4265A0 */  lw        $v0, %lo(gCurrentItemEntities)($v0)
/* C8624 80131F24 02421021 */  addu      $v0, $s2, $v0
/* C8628 80131F28 8C510000 */  lw        $s1, 0x0($v0)
/* C862C 80131F2C 52200093 */  beql      $s1, $zero, .L8013217C
/* C8630 80131F30 26730001 */   addiu    $s3, $s3, 0x1
/* C8634 80131F34 8E220000 */  lw        $v0, 0x0($s1)
/* C8638 80131F38 1040008F */  beqz      $v0, .L80132178
/* C863C 80131F3C 24020157 */   addiu    $v0, $zero, 0x157
/* C8640 80131F40 86230018 */  lh        $v1, 0x18($s1)
/* C8644 80131F44 14620019 */  bne       $v1, $v0, .L80131FAC
/* C8648 80131F48 00000000 */   nop
/* C864C 80131F4C 0C00A67F */  jal       rand_int
/* C8650 80131F50 24040064 */   addiu    $a0, $zero, 0x64
/* C8654 80131F54 2842005B */  slti      $v0, $v0, 0x5B
/* C8658 80131F58 14400012 */  bnez      $v0, .L80131FA4
/* C865C 80131F5C 00000000 */   nop
/* C8660 80131F60 3C058010 */  lui       $a1, %hi(SparkleScript_Coin)
/* C8664 80131F64 24A54AC0 */  addiu     $a1, $a1, %lo(SparkleScript_Coin)
/* C8668 80131F68 0C04C27C */  jal       sparkle_script_init
/* C866C 80131F6C 0220202D */   daddu    $a0, $s1, $zero
/* C8670 80131F70 0C00A67F */  jal       rand_int
/* C8674 80131F74 24040010 */   addiu    $a0, $zero, 0x10
/* C8678 80131F78 2442FFF8 */  addiu     $v0, $v0, -0x8
/* C867C 80131F7C 3C018015 */  lui       $at, %hi(D_80155D8C)
/* C8680 80131F80 A4225D8C */  sh        $v0, %lo(D_80155D8C)($at)
/* C8684 80131F84 0C00A67F */  jal       rand_int
/* C8688 80131F88 24040010 */   addiu    $a0, $zero, 0x10
/* C868C 80131F8C 2442FFF8 */  addiu     $v0, $v0, -0x8
/* C8690 80131F90 3C018015 */  lui       $at, %hi(D_80155D8E)
/* C8694 80131F94 A4225D8E */  sh        $v0, %lo(D_80155D8E)($at)
/* C8698 80131F98 24020005 */  addiu     $v0, $zero, 0x5
/* C869C 80131F9C 3C018015 */  lui       $at, %hi(D_80155D90)
/* C86A0 80131FA0 A4225D90 */  sh        $v0, %lo(D_80155D90)($at)
.L80131FA4:
/* C86A4 80131FA4 0C04C2B3 */  jal       sparkle_script_update
/* C86A8 80131FA8 0220202D */   daddu    $a0, $s1, $zero
.L80131FAC:
/* C86AC 80131FAC 0C04C775 */  jal       item_entity_update
/* C86B0 80131FB0 0220202D */   daddu    $a0, $s1, $zero
/* C86B4 80131FB4 8223001B */  lb        $v1, 0x1B($s1)
/* C86B8 80131FB8 2C62001D */  sltiu     $v0, $v1, 0x1D
/* C86BC 80131FBC 10400014 */  beqz      $v0, .L80132010
/* C86C0 80131FC0 00031080 */   sll      $v0, $v1, 2
/* C86C4 80131FC4 3C018015 */  lui       $at, %hi(jtbl_80150BD8)
/* C86C8 80131FC8 00220821 */  addu      $at, $at, $v0
/* C86CC 80131FCC 8C220BD8 */  lw        $v0, %lo(jtbl_80150BD8)($at)
/* C86D0 80131FD0 00400008 */  jr        $v0
/* C86D4 80131FD4 00000000 */   nop
glabel .L80131FD8
/* C86D8 80131FD8 0C04D596 */  jal       update_item_entity_stationary
/* C86DC 80131FDC 0220202D */   daddu    $a0, $s1, $zero
/* C86E0 80131FE0 0804C804 */  j         .L80132010
/* C86E4 80131FE4 00000000 */   nop
glabel .L80131FE8
/* C86E8 80131FE8 0C04D5B3 */  jal       update_item_entity_no_pickup
/* C86EC 80131FEC 0220202D */   daddu    $a0, $s1, $zero
/* C86F0 80131FF0 0804C804 */  j         .L80132010
/* C86F4 80131FF4 00000000 */   nop
glabel .L80131FF8
/* C86F8 80131FF8 0C04D094 */  jal       update_item_entity_collectable
/* C86FC 80131FFC 0220202D */   daddu    $a0, $s1, $zero
/* C8700 80132000 0804C804 */  j         .L80132010
/* C8704 80132004 00000000 */   nop
glabel .L80132008
/* C8708 80132008 0C04D5B7 */  jal       update_item_entity_pickup
/* C870C 8013200C 0220202D */   daddu    $a0, $s1, $zero
glabel .L80132010
/* C8710 80132010 3C028015 */  lui       $v0, %hi(gCurrentItemEntities)
/* C8714 80132014 8C4265A0 */  lw        $v0, %lo(gCurrentItemEntities)($v0)
/* C8718 80132018 02421021 */  addu      $v0, $s2, $v0
/* C871C 8013201C 8C510000 */  lw        $s1, 0x0($v0)
/* C8720 80132020 52200056 */  beql      $s1, $zero, .L8013217C
/* C8724 80132024 26730001 */   addiu    $s3, $s3, 0x1
/* C8728 80132028 8223001B */  lb        $v1, 0x1B($s1)
/* C872C 8013202C 2C62001D */  sltiu     $v0, $v1, 0x1D
/* C8730 80132030 10400043 */  beqz      $v0, .L80132140
/* C8734 80132034 00031080 */   sll      $v0, $v1, 2
/* C8738 80132038 3C018015 */  lui       $at, %hi(jtbl_80150C50)
/* C873C 8013203C 00220821 */  addu      $at, $at, $v0
/* C8740 80132040 8C220C50 */  lw        $v0, %lo(jtbl_80150C50)($at)
/* C8744 80132044 00400008 */  jr        $v0
/* C8748 80132048 00000000 */   nop
glabel .L8013204C
/* C874C 8013204C C6200008 */  lwc1      $f0, 0x8($s1)
/* C8750 80132050 C622000C */  lwc1      $f2, 0xC($s1)
/* C8754 80132054 86220034 */  lh        $v0, 0x34($s1)
/* C8758 80132058 4600020D */  trunc.w.s $f8, $f0
/* C875C 8013205C 44034000 */  mfc1      $v1, $f8
/* C8760 80132060 C6200010 */  lwc1      $f0, 0x10($s1)
/* C8764 80132064 4600120D */  trunc.w.s $f8, $f2
/* C8768 80132068 44054000 */  mfc1      $a1, $f8
/* C876C 8013206C 4600020D */  trunc.w.s $f8, $f0
/* C8770 80132070 44044000 */  mfc1      $a0, $f8
/* C8774 80132074 14620007 */  bne       $v1, $v0, .L80132094
/* C8778 80132078 00000000 */   nop
/* C877C 8013207C 86220036 */  lh        $v0, 0x36($s1)
/* C8780 80132080 14A20004 */  bne       $a1, $v0, .L80132094
/* C8784 80132084 00000000 */   nop
/* C8788 80132088 86220038 */  lh        $v0, 0x38($s1)
/* C878C 8013208C 1082002C */  beq       $a0, $v0, .L80132140
/* C8790 80132090 00000000 */   nop
.L80132094:
/* C8794 80132094 0C044181 */  jal       get_shadow_by_index
/* C8798 80132098 86240020 */   lh       $a0, 0x20($s1)
/* C879C 8013209C 3C040002 */  lui       $a0, (0x20000 >> 16)
/* C87A0 801320A0 27A50018 */  addiu     $a1, $sp, 0x18
/* C87A4 801320A4 27A30024 */  addiu     $v1, $sp, 0x24
/* C87A8 801320A8 0040802D */  daddu     $s0, $v0, $zero
/* C87AC 801320AC 27A6001C */  addiu     $a2, $sp, 0x1C
/* C87B0 801320B0 C6200008 */  lwc1      $f0, 0x8($s1)
/* C87B4 801320B4 3C014140 */  lui       $at, (0x41400000 >> 16)
/* C87B8 801320B8 44811000 */  mtc1      $at, $f2
/* C87BC 801320BC 3C01447A */  lui       $at, (0x447A0000 >> 16)
/* C87C0 801320C0 44813000 */  mtc1      $at, $f6
/* C87C4 801320C4 27A70020 */  addiu     $a3, $sp, 0x20
/* C87C8 801320C8 E7A00018 */  swc1      $f0, 0x18($sp)
/* C87CC 801320CC C620000C */  lwc1      $f0, 0xC($s1)
/* C87D0 801320D0 C6240010 */  lwc1      $f4, 0x10($s1)
/* C87D4 801320D4 46020000 */  add.s     $f0, $f0, $f2
/* C87D8 801320D8 E7A60024 */  swc1      $f6, 0x24($sp)
/* C87DC 801320DC E7A40020 */  swc1      $f4, 0x20($sp)
/* C87E0 801320E0 E7A0001C */  swc1      $f0, 0x1C($sp)
/* C87E4 801320E4 0C0372DF */  jal       npc_raycast_down_sides
/* C87E8 801320E8 AFA30010 */   sw       $v1, 0x10($sp)
/* C87EC 801320EC C7A00018 */  lwc1      $f0, 0x18($sp)
/* C87F0 801320F0 C7A2001C */  lwc1      $f2, 0x1C($sp)
/* C87F4 801320F4 C7A40020 */  lwc1      $f4, 0x20($sp)
/* C87F8 801320F8 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* C87FC 801320FC 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* C8800 80132100 E6000010 */  swc1      $f0, 0x10($s0)
/* C8804 80132104 E6020014 */  swc1      $f2, 0x14($s0)
/* C8808 80132108 E6040018 */  swc1      $f4, 0x18($s0)
/* C880C 8013210C C7A20024 */  lwc1      $f2, 0x24($sp)
/* C8810 80132110 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* C8814 80132114 44810000 */  mtc1      $at, $f0
/* C8818 80132118 C444011C */  lwc1      $f4, 0x11C($v0)
/* C881C 8013211C 46001082 */  mul.s     $f2, $f2, $f0
/* C8820 80132120 00000000 */  nop
/* C8824 80132124 AE00002C */  sw        $zero, 0x2C($s0)
/* C8828 80132128 E6040028 */  swc1      $f4, 0x28($s0)
/* C882C 8013212C C4400124 */  lwc1      $f0, 0x124($v0)
/* C8830 80132130 44051000 */  mfc1      $a1, $f2
/* C8834 80132134 0200202D */  daddu     $a0, $s0, $zero
/* C8838 80132138 0C044A17 */  jal       set_standard_shadow_scale
/* C883C 8013213C E4800030 */   swc1     $f0, 0x30($a0)
glabel .L80132140
/* C8840 80132140 C6200008 */  lwc1      $f0, 0x8($s1)
/* C8844 80132144 C6220010 */  lwc1      $f2, 0x10($s1)
/* C8848 80132148 4600020D */  trunc.w.s $f8, $f0
/* C884C 8013214C 44024000 */  mfc1      $v0, $f8
/* C8850 80132150 C620000C */  lwc1      $f0, 0xC($s1)
/* C8854 80132154 A6220034 */  sh        $v0, 0x34($s1)
/* C8858 80132158 4600020D */  trunc.w.s $f8, $f0
/* C885C 8013215C 44024000 */  mfc1      $v0, $f8
/* C8860 80132160 00000000 */  nop
/* C8864 80132164 A6220036 */  sh        $v0, 0x36($s1)
/* C8868 80132168 4600120D */  trunc.w.s $f8, $f2
/* C886C 8013216C 44024000 */  mfc1      $v0, $f8
/* C8870 80132170 00000000 */  nop
/* C8874 80132174 A6220038 */  sh        $v0, 0x38($s1)
.L80132178:
/* C8878 80132178 26730001 */  addiu     $s3, $s3, 0x1
.L8013217C:
/* C887C 8013217C 2A620100 */  slti      $v0, $s3, 0x100
/* C8880 80132180 1440FF66 */  bnez      $v0, .L80131F1C
/* C8884 80132184 26520004 */   addiu    $s2, $s2, 0x4
.L80132188:
/* C8888 80132188 8FBF0038 */  lw        $ra, 0x38($sp)
/* C888C 8013218C 8FB30034 */  lw        $s3, 0x34($sp)
/* C8890 80132190 8FB20030 */  lw        $s2, 0x30($sp)
/* C8894 80132194 8FB1002C */  lw        $s1, 0x2C($sp)
/* C8898 80132198 8FB00028 */  lw        $s0, 0x28($sp)
/* C889C 8013219C 03E00008 */  jr        $ra
/* C88A0 801321A0 27BD0040 */   addiu    $sp, $sp, 0x40

### DECOMPILED C INSTRUCTIONS:

void update_item_entities(void) {
    ItemEntity* item;
    f32 x, y, z, hitDepth;
    s32 i;

    if (!(gOverrideFlags & (GLOBAL_OVERRIDES_400 | GLOBAL_OVERRIDES_800))) {
        for (i = 0; i < MAX_ITEM_ENTITIES; i++) {
            item = gCurrentItemEntities[i];

            if (item != NULL && item->flags != 0) {
                if (item->itemID == ITEM_COIN) {
                    if (rand_int(100) > 90) {
                        sparkle_script_init(item, &SparkleScript_Coin);
                        D_80155D8C = rand_int(16) - 8;
                        D_80155D8E = rand_int(16) - 8;
                        D_80155D90 = 5;
                    }
                    sparkle_script_update(item);
                }

                item_entity_update(item);

                switch (item->spawnType) {
                    case ITEM_SPAWN_MODE_KEY:
                        update_item_entity_stationary(item);
                        break;
                    case ITEM_SPAWN_MODE_DECORATION:
                    case ITEM_SPAWN_MODE_INVISIBLE:
                        update_item_entity_no_pickup(item);
                        break;
                    case ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS:
                    case ITEM_SPAWN_MODE_FALL_SPAWN_ALWAYS:
                    case ITEM_SPAWN_MODE_FIXED_SPAWN_ALWAYS:
                    case ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS:
                    case ITEM_SPAWN_MODE_TOSS_FADE1:
                        update_item_entity_collectable(item);
                        break;
                    case ITEM_SPAWN_AT_PLAYER:
                        update_item_entity_pickup(item);
                        break;
                }

                item = gCurrentItemEntities[i];
                if (item != NULL) {
                    s32 xs, ys, zs;

                    switch (item->spawnType) {
                        case ITEM_SPAWN_MODE_KEY:
                        case ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS:
                        case ITEM_SPAWN_MODE_FALL_SPAWN_ALWAYS:
                        case ITEM_SPAWN_MODE_FIXED_SPAWN_ALWAYS:
                        case ITEM_SPAWN_AT_PLAYER:
                            xs = item->position.x;
                            ys = item->position.y;
                            zs = item->position.z;

                            if (xs != item->lastPos.x || ys != item->lastPos.y || zs != item->lastPos.z) {
                                Shadow* shadow = get_shadow_by_index(item->shadowIndex);

                                x = item->position.x;
                                y = item->position.y + 12.0f;
                                z = item->position.z;
                                hitDepth = 1000.0f;
                                npc_raycast_down_sides(COLLISION_CHANNEL_20000, &x, &y, &z, &hitDepth);

                                shadow->position.x = x;
                                shadow->position.y = y;
                                shadow->position.z = z;
                                shadow->rotation.x = gGameStatusPtr->playerGroundTraceAngles.x;
                                shadow->rotation.y = 0.0f;
                                shadow->rotation.z = gGameStatusPtr->playerGroundTraceAngles.z;
                                set_standard_shadow_scale(shadow, hitDepth * 0.5f);
                            }
                            break;
                    }
                    item->lastPos.x = item->position.x;
                    item->lastPos.y = item->position.y;
                    item->lastPos.z = item->position.z;
                }
            }
            do {} while (0); // required to match
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel sparkles_appendGfx
/* 337BD8 E0022998 27BDFF00 */  addiu     $sp, $sp, -0x100
/* 337BDC E002299C 3C06DB06 */  lui       $a2, (0xDB060024 >> 16)
/* 337BE0 E00229A0 34C60024 */  ori       $a2, $a2, (0xDB060024 & 0xFFFF)
/* 337BE4 E00229A4 AFA40100 */  sw        $a0, 0x100($sp)
/* 337BE8 E00229A8 27A40018 */  addiu     $a0, $sp, 0x18
/* 337BEC E00229AC AFB300E4 */  sw        $s3, 0xE4($sp)
/* 337BF0 E00229B0 3C13800A */  lui       $s3, %hi(gMainGfxPos)
/* 337BF4 E00229B4 2673A66C */  addiu     $s3, $s3, %lo(gMainGfxPos)
/* 337BF8 E00229B8 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 337BFC E00229BC AFBF00FC */  sw        $ra, 0xFC($sp)
/* 337C00 E00229C0 AFBE00F8 */  sw        $fp, 0xF8($sp)
/* 337C04 E00229C4 AFB700F4 */  sw        $s7, 0xF4($sp)
/* 337C08 E00229C8 AFB600F0 */  sw        $s6, 0xF0($sp)
/* 337C0C E00229CC AFB500EC */  sw        $s5, 0xEC($sp)
/* 337C10 E00229D0 AFB400E8 */  sw        $s4, 0xE8($sp)
/* 337C14 E00229D4 AFB200E0 */  sw        $s2, 0xE0($sp)
/* 337C18 E00229D8 AFB100DC */  sw        $s1, 0xDC($sp)
/* 337C1C E00229DC AFB000D8 */  sw        $s0, 0xD8($sp)
/* 337C20 E00229E0 8E630000 */  lw        $v1, 0x0($s3)
/* 337C24 E00229E4 8FAA0100 */  lw        $t2, 0x100($sp)
/* 337C28 E00229E8 0060282D */  daddu     $a1, $v1, $zero
/* 337C2C E00229EC 8D50000C */  lw        $s0, 0xC($t2)
/* 337C30 E00229F0 24630008 */  addiu     $v1, $v1, 0x8
/* 337C34 E00229F4 AE630000 */  sw        $v1, 0x0($s3)
/* 337C38 E00229F8 ACA20000 */  sw        $v0, 0x0($a1)
/* 337C3C E00229FC 24620008 */  addiu     $v0, $v1, 0x8
/* 337C40 E0022A00 ACA00004 */  sw        $zero, 0x4($a1)
/* 337C44 E0022A04 AE620000 */  sw        $v0, 0x0($s3)
/* 337C48 E0022A08 AC660000 */  sw        $a2, 0x0($v1)
/* 337C4C E0022A0C 8D450010 */  lw        $a1, 0x10($t2)
/* 337C50 E0022A10 24620010 */  addiu     $v0, $v1, 0x10
/* 337C54 E0022A14 AE620000 */  sw        $v0, 0x0($s3)
/* 337C58 E0022A18 8CA5001C */  lw        $a1, 0x1C($a1)
/* 337C5C E0022A1C 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 337C60 E0022A20 AC620008 */  sw        $v0, 0x8($v1)
/* 337C64 E0022A24 3C020900 */  lui       $v0, %hi(D_09000F20_327330)
/* 337C68 E0022A28 24420F20 */  addiu     $v0, $v0, %lo(D_09000F20_327330)
/* 337C6C E0022A2C AC62000C */  sw        $v0, 0xC($v1)
/* 337C70 E0022A30 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 337C74 E0022A34 00A22821 */  addu      $a1, $a1, $v0
/* 337C78 E0022A38 AC650004 */  sw        $a1, 0x4($v1)
/* 337C7C E0022A3C 8E050004 */  lw        $a1, 0x4($s0)
/* 337C80 E0022A40 8E060008 */  lw        $a2, 0x8($s0)
/* 337C84 E0022A44 8E020020 */  lw        $v0, 0x20($s0)
/* 337C88 E0022A48 8E07000C */  lw        $a3, 0xC($s0)
/* 337C8C E0022A4C 2442FFFF */  addiu     $v0, $v0, -0x1
/* 337C90 E0022A50 00021840 */  sll       $v1, $v0, 1
/* 337C94 E0022A54 0C080108 */  jal       shim_guTranslateF
/* 337C98 E0022A58 00628821 */   addu     $s1, $v1, $v0
/* 337C9C E0022A5C 27B20058 */  addiu     $s2, $sp, 0x58
/* 337CA0 E0022A60 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 337CA4 E0022A64 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 337CA8 E0022A68 44800000 */  mtc1      $zero, $f0
/* 337CAC E0022A6C 00031080 */  sll       $v0, $v1, 2
/* 337CB0 E0022A70 00431021 */  addu      $v0, $v0, $v1
/* 337CB4 E0022A74 00021080 */  sll       $v0, $v0, 2
/* 337CB8 E0022A78 00431023 */  subu      $v0, $v0, $v1
/* 337CBC E0022A7C 000218C0 */  sll       $v1, $v0, 3
/* 337CC0 E0022A80 00431021 */  addu      $v0, $v0, $v1
/* 337CC4 E0022A84 000210C0 */  sll       $v0, $v0, 3
/* 337CC8 E0022A88 44060000 */  mfc1      $a2, $f0
/* 337CCC E0022A8C 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 337CD0 E0022A90 00220821 */  addu      $at, $at, $v0
/* 337CD4 E0022A94 C4201DEC */  lwc1      $f0, %lo(gCameras + 0x6C)($at)
/* 337CD8 E0022A98 3C073F80 */  lui       $a3, (0x3F800000 >> 16)
/* 337CDC E0022A9C 46000007 */  neg.s     $f0, $f0
/* 337CE0 E0022AA0 44050000 */  mfc1      $a1, $f0
/* 337CE4 E0022AA4 0240202D */  daddu     $a0, $s2, $zero
/* 337CE8 E0022AA8 0C080104 */  jal       shim_guRotateF
/* 337CEC E0022AAC AFA60010 */   sw       $a2, 0x10($sp)
/* 337CF0 E0022AB0 0240202D */  daddu     $a0, $s2, $zero
/* 337CF4 E0022AB4 27A50018 */  addiu     $a1, $sp, 0x18
/* 337CF8 E0022AB8 0C080114 */  jal       shim_guMtxCatF
/* 337CFC E0022ABC 27A60098 */   addiu    $a2, $sp, 0x98
/* 337D00 E0022AC0 8FAA0100 */  lw        $t2, 0x100($sp)
/* 337D04 E0022AC4 0000A02D */  daddu     $s4, $zero, $zero
/* 337D08 E0022AC8 8D420008 */  lw        $v0, 0x8($t2)
/* 337D0C E0022ACC 2442FFFF */  addiu     $v0, $v0, -0x1
/* 337D10 E0022AD0 18400069 */  blez      $v0, .LE0022C78
/* 337D14 E0022AD4 26100030 */   addiu    $s0, $s0, 0x30
/* 337D18 E0022AD8 0240B02D */  daddu     $s6, $s2, $zero
/* 337D1C E0022ADC 3C1E8007 */  lui       $fp, %hi(gMatrixListPos)
/* 337D20 E0022AE0 27DE41F0 */  addiu     $fp, $fp, %lo(gMatrixListPos)
/* 337D24 E0022AE4 3C150001 */  lui       $s5, (0x11630 >> 16)
/* 337D28 E0022AE8 36B51630 */  ori       $s5, $s5, (0x11630 & 0xFFFF)
/* 337D2C E0022AEC 0260902D */  daddu     $s2, $s3, $zero
/* 337D30 E0022AF0 3C17E002 */  lui       $s7, %hi(D_E0022CF0)
/* 337D34 E0022AF4 26F72CF0 */  addiu     $s7, $s7, %lo(D_E0022CF0)
/* 337D38 E0022AF8 2610001C */  addiu     $s0, $s0, 0x1C
.LE0022AFC:
/* 337D3C E0022AFC 8E130010 */  lw        $s3, 0x10($s0)
/* 337D40 E0022B00 06600056 */  bltz      $s3, .LE0022C5C
/* 337D44 E0022B04 02C0202D */   daddu    $a0, $s6, $zero
/* 337D48 E0022B08 8E05FFE8 */  lw        $a1, -0x18($s0)
/* 337D4C E0022B0C 8E06FFEC */  lw        $a2, -0x14($s0)
/* 337D50 E0022B10 8E07FFF0 */  lw        $a3, -0x10($s0)
/* 337D54 E0022B14 0C080108 */  jal       shim_guTranslateF
/* 337D58 E0022B18 26310003 */   addiu    $s1, $s1, 0x3
/* 337D5C E0022B1C C6000000 */  lwc1      $f0, 0x0($s0)
/* 337D60 E0022B20 02C0202D */  daddu     $a0, $s6, $zero
/* 337D64 E0022B24 E7A00058 */  swc1      $f0, 0x58($sp)
/* 337D68 E0022B28 C6000000 */  lwc1      $f0, 0x0($s0)
/* 337D6C E0022B2C 27A50098 */  addiu     $a1, $sp, 0x98
/* 337D70 E0022B30 E7A0006C */  swc1      $f0, 0x6C($sp)
/* 337D74 E0022B34 C6000000 */  lwc1      $f0, 0x0($s0)
/* 337D78 E0022B38 27A60018 */  addiu     $a2, $sp, 0x18
/* 337D7C E0022B3C 0C080114 */  jal       shim_guMtxCatF
/* 337D80 E0022B40 E7A00080 */   swc1     $f0, 0x80($sp)
/* 337D84 E0022B44 27A40018 */  addiu     $a0, $sp, 0x18
/* 337D88 E0022B48 97C50000 */  lhu       $a1, 0x0($fp)
/* 337D8C E0022B4C 3C02800A */  lui       $v0, %hi(gDisplayContext)
/* 337D90 E0022B50 8C42A674 */  lw        $v0, %lo(gDisplayContext)($v0)
/* 337D94 E0022B54 00052980 */  sll       $a1, $a1, 6
/* 337D98 E0022B58 00B52821 */  addu      $a1, $a1, $s5
/* 337D9C E0022B5C 0C080118 */  jal       shim_guMtxF2L
/* 337DA0 E0022B60 00452821 */   addu     $a1, $v0, $a1
/* 337DA4 E0022B64 3C0238E3 */  lui       $v0, (0x38E38E39 >> 16)
/* 337DA8 E0022B68 34428E39 */  ori       $v0, $v0, (0x38E38E39 & 0xFFFF)
/* 337DAC E0022B6C 3C09D838 */  lui       $t1, (0xD8380002 >> 16)
/* 337DB0 E0022B70 35290002 */  ori       $t1, $t1, (0xD8380002 & 0xFFFF)
/* 337DB4 E0022B74 02220018 */  mult      $s1, $v0
/* 337DB8 E0022B78 8E470000 */  lw        $a3, 0x0($s2)
/* 337DBC E0022B7C 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 337DC0 E0022B80 00E0402D */  daddu     $t0, $a3, $zero
/* 337DC4 E0022B84 24E70008 */  addiu     $a3, $a3, 0x8
/* 337DC8 E0022B88 AE470000 */  sw        $a3, 0x0($s2)
/* 337DCC E0022B8C AD020000 */  sw        $v0, 0x0($t0)
/* 337DD0 E0022B90 001117C3 */  sra       $v0, $s1, 31
/* 337DD4 E0022B94 00005010 */  mfhi      $t2
/* 337DD8 E0022B98 000A18C3 */  sra       $v1, $t2, 3
/* 337DDC E0022B9C 00621823 */  subu      $v1, $v1, $v0
/* 337DE0 E0022BA0 000310C0 */  sll       $v0, $v1, 3
/* 337DE4 E0022BA4 00431021 */  addu      $v0, $v0, $v1
/* 337DE8 E0022BA8 00021080 */  sll       $v0, $v0, 2
/* 337DEC E0022BAC 02228823 */  subu      $s1, $s1, $v0
/* 337DF0 E0022BB0 02371021 */  addu      $v0, $s1, $s7
/* 337DF4 E0022BB4 0040202D */  daddu     $a0, $v0, $zero
/* 337DF8 E0022BB8 0040282D */  daddu     $a1, $v0, $zero
/* 337DFC E0022BBC 90430000 */  lbu       $v1, 0x0($v0)
/* 337E00 E0022BC0 24E20008 */  addiu     $v0, $a3, 0x8
/* 337E04 E0022BC4 90860001 */  lbu       $a2, 0x1($a0)
/* 337E08 E0022BC8 90A50002 */  lbu       $a1, 0x2($a1)
/* 337E0C E0022BCC 97C40000 */  lhu       $a0, 0x0($fp)
/* 337E10 E0022BD0 3C0AE002 */  lui       $t2, %hi(D_E0022CD0)
/* 337E14 E0022BD4 254A2CD0 */  addiu     $t2, $t2, %lo(D_E0022CD0)
/* 337E18 E0022BD8 AE420000 */  sw        $v0, 0x0($s2)
/* 337E1C E0022BDC 24820001 */  addiu     $v0, $a0, 0x1
/* 337E20 E0022BE0 A7C20000 */  sh        $v0, 0x0($fp)
/* 337E24 E0022BE4 24E20010 */  addiu     $v0, $a3, 0x10
/* 337E28 E0022BE8 00031E00 */  sll       $v1, $v1, 24
/* 337E2C E0022BEC 00063400 */  sll       $a2, $a2, 16
/* 337E30 E0022BF0 00661825 */  or        $v1, $v1, $a2
/* 337E34 E0022BF4 00052A00 */  sll       $a1, $a1, 8
/* 337E38 E0022BF8 00651825 */  or        $v1, $v1, $a1
/* 337E3C E0022BFC 346300FF */  ori       $v1, $v1, 0xFF
/* 337E40 E0022C00 AE420000 */  sw        $v0, 0x0($s2)
/* 337E44 E0022C04 3C02DA38 */  lui       $v0, (0xDA380000 >> 16)
/* 337E48 E0022C08 3084FFFF */  andi      $a0, $a0, 0xFFFF
/* 337E4C E0022C0C 00042180 */  sll       $a0, $a0, 6
/* 337E50 E0022C10 AD030004 */  sw        $v1, 0x4($t0)
/* 337E54 E0022C14 ACE20000 */  sw        $v0, 0x0($a3)
/* 337E58 E0022C18 3C02800A */  lui       $v0, %hi(gDisplayContext)
/* 337E5C E0022C1C 8C42A674 */  lw        $v0, %lo(gDisplayContext)($v0)
/* 337E60 E0022C20 00952021 */  addu      $a0, $a0, $s5
/* 337E64 E0022C24 00441021 */  addu      $v0, $v0, $a0
/* 337E68 E0022C28 ACE20004 */  sw        $v0, 0x4($a3)
/* 337E6C E0022C2C 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 337E70 E0022C30 ACE20008 */  sw        $v0, 0x8($a3)
/* 337E74 E0022C34 32620007 */  andi      $v0, $s3, 0x7
/* 337E78 E0022C38 00021080 */  sll       $v0, $v0, 2
/* 337E7C E0022C3C 004A1021 */  addu      $v0, $v0, $t2
/* 337E80 E0022C40 8C430000 */  lw        $v1, 0x0($v0)
/* 337E84 E0022C44 24E20018 */  addiu     $v0, $a3, 0x18
/* 337E88 E0022C48 AE420000 */  sw        $v0, 0x0($s2)
/* 337E8C E0022C4C 24020040 */  addiu     $v0, $zero, 0x40
/* 337E90 E0022C50 ACE90010 */  sw        $t1, 0x10($a3)
/* 337E94 E0022C54 ACE20014 */  sw        $v0, 0x14($a3)
/* 337E98 E0022C58 ACE3000C */  sw        $v1, 0xC($a3)
.LE0022C5C:
/* 337E9C E0022C5C 8FAA0100 */  lw        $t2, 0x100($sp)
/* 337EA0 E0022C60 26940001 */  addiu     $s4, $s4, 0x1
/* 337EA4 E0022C64 8D420008 */  lw        $v0, 0x8($t2)
/* 337EA8 E0022C68 2442FFFF */  addiu     $v0, $v0, -0x1
/* 337EAC E0022C6C 0282102A */  slt       $v0, $s4, $v0
/* 337EB0 E0022C70 1440FFA2 */  bnez      $v0, .LE0022AFC
/* 337EB4 E0022C74 26100030 */   addiu    $s0, $s0, 0x30
.LE0022C78:
/* 337EB8 E0022C78 3C03800A */  lui       $v1, %hi(gMainGfxPos)
/* 337EBC E0022C7C 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
/* 337EC0 E0022C80 8C620000 */  lw        $v0, 0x0($v1)
/* 337EC4 E0022C84 0040202D */  daddu     $a0, $v0, $zero
/* 337EC8 E0022C88 24420008 */  addiu     $v0, $v0, 0x8
/* 337ECC E0022C8C AC620000 */  sw        $v0, 0x0($v1)
/* 337ED0 E0022C90 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 337ED4 E0022C94 AC820000 */  sw        $v0, 0x0($a0)
/* 337ED8 E0022C98 AC800004 */  sw        $zero, 0x4($a0)
/* 337EDC E0022C9C 8FBF00FC */  lw        $ra, 0xFC($sp)
/* 337EE0 E0022CA0 8FBE00F8 */  lw        $fp, 0xF8($sp)
/* 337EE4 E0022CA4 8FB700F4 */  lw        $s7, 0xF4($sp)
/* 337EE8 E0022CA8 8FB600F0 */  lw        $s6, 0xF0($sp)
/* 337EEC E0022CAC 8FB500EC */  lw        $s5, 0xEC($sp)
/* 337EF0 E0022CB0 8FB400E8 */  lw        $s4, 0xE8($sp)
/* 337EF4 E0022CB4 8FB300E4 */  lw        $s3, 0xE4($sp)
/* 337EF8 E0022CB8 8FB200E0 */  lw        $s2, 0xE0($sp)
/* 337EFC E0022CBC 8FB100DC */  lw        $s1, 0xDC($sp)
/* 337F00 E0022CC0 8FB000D8 */  lw        $s0, 0xD8($sp)
/* 337F04 E0022CC4 03E00008 */  jr        $ra
/* 337F08 E0022CC8 27BD0100 */   addiu    $sp, $sp, 0x100
/* 337F0C E0022CCC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void sparkles_appendGfx(void* effect) {
    SparklesFXData* part = ((EffectInstance*)effect)->data.sparkles;
    Matrix4f sp18;
    Matrix4f sp58;
    Matrix4f sp98;
    s32 colorIdx;
    s32 i;

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

    colorIdx = (part->unk_20 - 1) * 3;

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

    part++;
    for (i = 0; i < ((EffectInstance*)effect)->numParts - 1; i++, part++) {
        s32 unk_2C = part->unk_2C;

        if (unk_2C >= 0) {
            shim_guTranslateF(sp58, part->unk_04, part->unk_08, part->unk_0C);

            sp58[0][0] = part->unk_1C;
            sp58[1][1] = part->unk_1C;
            sp58[2][2] = part->unk_1C;
            colorIdx += 3;

            shim_guMtxCatF(sp58, sp98, sp18);
            shim_guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);

            colorIdx %= ARRAY_COUNT(D_E0022CF0);

            gDPSetPrimColor(gMainGfxPos++, 0, 0, D_E0022CF0[colorIdx], D_E0022CF0[colorIdx + 1], D_E0022CF0[colorIdx + 2], 255);
            gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
            gSPDisplayList(gMainGfxPos++, D_E0022CD0[unk_2C & 7]);
            gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
        }
    }

    gDPPipeSync(gMainGfxPos++);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel quizmo_assistant_appendGfx
/* 406D04 E011C1C4 27BDFF40 */  addiu     $sp, $sp, -0xC0
/* 406D08 E011C1C8 0080302D */  daddu     $a2, $a0, $zero
/* 406D0C E011C1CC 3C07DB06 */  lui       $a3, (0xDB060024 >> 16)
/* 406D10 E011C1D0 34E70024 */  ori       $a3, $a3, (0xDB060024 & 0xFFFF)
/* 406D14 E011C1D4 27A40018 */  addiu     $a0, $sp, 0x18
/* 406D18 E011C1D8 AFB200A0 */  sw        $s2, 0xA0($sp)
/* 406D1C E011C1DC 3C12800A */  lui       $s2, %hi(gMainGfxPos)
/* 406D20 E011C1E0 2652A66C */  addiu     $s2, $s2, %lo(gMainGfxPos)
/* 406D24 E011C1E4 AFB500AC */  sw        $s5, 0xAC($sp)
/* 406D28 E011C1E8 AFBF00B4 */  sw        $ra, 0xB4($sp)
/* 406D2C E011C1EC AFB600B0 */  sw        $s6, 0xB0($sp)
/* 406D30 E011C1F0 AFB400A8 */  sw        $s4, 0xA8($sp)
/* 406D34 E011C1F4 AFB300A4 */  sw        $s3, 0xA4($sp)
/* 406D38 E011C1F8 AFB1009C */  sw        $s1, 0x9C($sp)
/* 406D3C E011C1FC AFB00098 */  sw        $s0, 0x98($sp)
/* 406D40 E011C200 F7B400B8 */  sdc1      $f20, 0xB8($sp)
/* 406D44 E011C204 8E450000 */  lw        $a1, 0x0($s2)
/* 406D48 E011C208 8CD4000C */  lw        $s4, 0xC($a2)
/* 406D4C E011C20C 00A0182D */  daddu     $v1, $a1, $zero
/* 406D50 E011C210 24A50008 */  addiu     $a1, $a1, 0x8
/* 406D54 E011C214 AE450000 */  sw        $a1, 0x0($s2)
/* 406D58 E011C218 8E960014 */  lw        $s6, 0x14($s4)
/* 406D5C E011C21C 8E910018 */  lw        $s1, 0x18($s4)
/* 406D60 E011C220 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 406D64 E011C224 AC620000 */  sw        $v0, 0x0($v1)
/* 406D68 E011C228 AC600004 */  sw        $zero, 0x4($v1)
/* 406D6C E011C22C ACA70000 */  sw        $a3, 0x0($a1)
/* 406D70 E011C230 8CC30010 */  lw        $v1, 0x10($a2)
/* 406D74 E011C234 24A20008 */  addiu     $v0, $a1, 0x8
/* 406D78 E011C238 AE420000 */  sw        $v0, 0x0($s2)
/* 406D7C E011C23C 8C62001C */  lw        $v0, 0x1C($v1)
/* 406D80 E011C240 3C038000 */  lui       $v1, (0x80000000 >> 16)
/* 406D84 E011C244 00431021 */  addu      $v0, $v0, $v1
/* 406D88 E011C248 ACA20004 */  sw        $v0, 0x4($a1)
/* 406D8C E011C24C 8E850004 */  lw        $a1, 0x4($s4)
/* 406D90 E011C250 8E860008 */  lw        $a2, 0x8($s4)
/* 406D94 E011C254 8E87000C */  lw        $a3, 0xC($s4)
/* 406D98 E011C258 4480A000 */  mtc1      $zero, $f20
/* 406D9C E011C25C 0C080108 */  jal       shim_guTranslateF
/* 406DA0 E011C260 3C150001 */   lui      $s5, (0x11630 >> 16)
/* 406DA4 E011C264 27B00058 */  addiu     $s0, $sp, 0x58
/* 406DA8 E011C268 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 406DAC E011C26C 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 406DB0 E011C270 4406A000 */  mfc1      $a2, $f20
/* 406DB4 E011C274 00031080 */  sll       $v0, $v1, 2
/* 406DB8 E011C278 00431021 */  addu      $v0, $v0, $v1
/* 406DBC E011C27C 00021080 */  sll       $v0, $v0, 2
/* 406DC0 E011C280 00431023 */  subu      $v0, $v0, $v1
/* 406DC4 E011C284 000218C0 */  sll       $v1, $v0, 3
/* 406DC8 E011C288 00431021 */  addu      $v0, $v0, $v1
/* 406DCC E011C28C 000210C0 */  sll       $v0, $v0, 3
/* 406DD0 E011C290 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 406DD4 E011C294 00220821 */  addu      $at, $at, $v0
/* 406DD8 E011C298 C4201DEC */  lwc1      $f0, %lo(gCameras + 0x6C)($at)
/* 406DDC E011C29C 3C073F80 */  lui       $a3, (0x3F800000 >> 16)
/* 406DE0 E011C2A0 46000007 */  neg.s     $f0, $f0
/* 406DE4 E011C2A4 44050000 */  mfc1      $a1, $f0
/* 406DE8 E011C2A8 0200202D */  daddu     $a0, $s0, $zero
/* 406DEC E011C2AC 0C080104 */  jal       shim_guRotateF
/* 406DF0 E011C2B0 E7B40010 */   swc1     $f20, 0x10($sp)
/* 406DF4 E011C2B4 0200202D */  daddu     $a0, $s0, $zero
/* 406DF8 E011C2B8 27A50018 */  addiu     $a1, $sp, 0x18
/* 406DFC E011C2BC 0C080114 */  jal       shim_guMtxCatF
/* 406E00 E011C2C0 00A0302D */   daddu    $a2, $a1, $zero
/* 406E04 E011C2C4 3C0542B3 */  lui       $a1, (0x42B30000 >> 16)
/* 406E08 E011C2C8 4406A000 */  mfc1      $a2, $f20
/* 406E0C E011C2CC 3C074000 */  lui       $a3, (0x40000000 >> 16)
/* 406E10 E011C2D0 0C080108 */  jal       shim_guTranslateF
/* 406E14 E011C2D4 0200202D */   daddu    $a0, $s0, $zero
/* 406E18 E011C2D8 0200202D */  daddu     $a0, $s0, $zero
/* 406E1C E011C2DC 27A50018 */  addiu     $a1, $sp, 0x18
/* 406E20 E011C2E0 0C080114 */  jal       shim_guMtxCatF
/* 406E24 E011C2E4 00A0302D */   daddu    $a2, $a1, $zero
/* 406E28 E011C2E8 3C013F36 */  lui       $at, (0x3F36DB6E >> 16)
/* 406E2C E011C2EC 3421DB6E */  ori       $at, $at, (0x3F36DB6E & 0xFFFF)
/* 406E30 E011C2F0 44810000 */  mtc1      $at, $f0
/* 406E34 E011C2F4 36B51630 */  ori       $s5, $s5, (0x11630 & 0xFFFF)
/* 406E38 E011C2F8 44050000 */  mfc1      $a1, $f0
/* 406E3C E011C2FC 0200202D */  daddu     $a0, $s0, $zero
/* 406E40 E011C300 00A0302D */  daddu     $a2, $a1, $zero
/* 406E44 E011C304 0C080110 */  jal       shim_guScaleF
/* 406E48 E011C308 00A0382D */   daddu    $a3, $a1, $zero
/* 406E4C E011C30C 0200202D */  daddu     $a0, $s0, $zero
/* 406E50 E011C310 27A50018 */  addiu     $a1, $sp, 0x18
/* 406E54 E011C314 0C080114 */  jal       shim_guMtxCatF
/* 406E58 E011C318 00A0302D */   daddu    $a2, $a1, $zero
/* 406E5C E011C31C 27A40018 */  addiu     $a0, $sp, 0x18
/* 406E60 E011C320 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* 406E64 E011C324 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* 406E68 E011C328 3C13800A */  lui       $s3, %hi(gDisplayContext)
/* 406E6C E011C32C 2673A674 */  addiu     $s3, $s3, %lo(gDisplayContext)
/* 406E70 E011C330 96050000 */  lhu       $a1, 0x0($s0)
/* 406E74 E011C334 8E620000 */  lw        $v0, 0x0($s3)
/* 406E78 E011C338 00052980 */  sll       $a1, $a1, 6
/* 406E7C E011C33C 00B52821 */  addu      $a1, $a1, $s5
/* 406E80 E011C340 0C080118 */  jal       shim_guMtxF2L
/* 406E84 E011C344 00452821 */   addu     $a1, $v0, $a1
/* 406E88 E011C348 3C03DA38 */  lui       $v1, (0xDA380002 >> 16)
/* 406E8C E011C34C 34630002 */  ori       $v1, $v1, (0xDA380002 & 0xFFFF)
/* 406E90 E011C350 323100FF */  andi      $s1, $s1, 0xFF
/* 406E94 E011C354 8E440000 */  lw        $a0, 0x0($s2)
/* 406E98 E011C358 96020000 */  lhu       $v0, 0x0($s0)
/* 406E9C E011C35C 0080282D */  daddu     $a1, $a0, $zero
/* 406EA0 E011C360 24840008 */  addiu     $a0, $a0, 0x8
/* 406EA4 E011C364 AE440000 */  sw        $a0, 0x0($s2)
/* 406EA8 E011C368 ACA30000 */  sw        $v1, 0x0($a1)
/* 406EAC E011C36C 24430001 */  addiu     $v1, $v0, 0x1
/* 406EB0 E011C370 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 406EB4 E011C374 00021180 */  sll       $v0, $v0, 6
/* 406EB8 E011C378 A6030000 */  sh        $v1, 0x0($s0)
/* 406EBC E011C37C 8E630000 */  lw        $v1, 0x0($s3)
/* 406EC0 E011C380 00551021 */  addu      $v0, $v0, $s5
/* 406EC4 E011C384 00621821 */  addu      $v1, $v1, $v0
/* 406EC8 E011C388 24820008 */  addiu     $v0, $a0, 0x8
/* 406ECC E011C38C ACA30004 */  sw        $v1, 0x4($a1)
/* 406ED0 E011C390 AE420000 */  sw        $v0, 0x0($s2)
/* 406ED4 E011C394 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 406ED8 E011C398 AC820000 */  sw        $v0, 0x0($a0)
/* 406EDC E011C39C 00111600 */  sll       $v0, $s1, 24
/* 406EE0 E011C3A0 00111C00 */  sll       $v1, $s1, 16
/* 406EE4 E011C3A4 00431025 */  or        $v0, $v0, $v1
/* 406EE8 E011C3A8 00118A00 */  sll       $s1, $s1, 8
/* 406EEC E011C3AC 00511025 */  or        $v0, $v0, $s1
/* 406EF0 E011C3B0 344200FF */  ori       $v0, $v0, 0xFF
/* 406EF4 E011C3B4 AC820004 */  sw        $v0, 0x4($a0)
/* 406EF8 E011C3B8 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 406EFC E011C3BC AC820008 */  sw        $v0, 0x8($a0)
/* 406F00 E011C3C0 3C03E012 */  lui       $v1, (0xE0120000 >> 16)
/* 406F04 E011C3C4 8C63C514 */  lw        $v1, -0x3AEC($v1)
/* 406F08 E011C3C8 24820010 */  addiu     $v0, $a0, 0x10
/* 406F0C E011C3CC AE420000 */  sw        $v0, 0x0($s2)
/* 406F10 E011C3D0 AC83000C */  sw        $v1, 0xC($a0)
/* 406F14 E011C3D4 8E83001C */  lw        $v1, 0x1C($s4)
/* 406F18 E011C3D8 24020001 */  addiu     $v0, $zero, 0x1
/* 406F1C E011C3DC 10620007 */  beq       $v1, $v0, .LE011C3FC
/* 406F20 E011C3E0 28620002 */   slti     $v0, $v1, 0x2
/* 406F24 E011C3E4 10400015 */  beqz      $v0, .LE011C43C
/* 406F28 E011C3E8 00000000 */   nop
/* 406F2C E011C3EC 14600013 */  bnez      $v1, .LE011C43C
/* 406F30 E011C3F0 0000282D */   daddu    $a1, $zero, $zero
/* 406F34 E011C3F4 0804711B */  j         .LE011C46C
/* 406F38 E011C3F8 3C07D838 */   lui      $a3, (0xD8380002 >> 16)
.LE011C3FC:
/* 406F3C E011C3FC 3C026666 */  lui       $v0, (0x66666667 >> 16)
/* 406F40 E011C400 34426667 */  ori       $v0, $v0, (0x66666667 & 0xFFFF)
/* 406F44 E011C404 02C20018 */  mult      $s6, $v0
/* 406F48 E011C408 001617C3 */  sra       $v0, $s6, 31
/* 406F4C E011C40C 00004010 */  mfhi      $t0
/* 406F50 E011C410 00081843 */  sra       $v1, $t0, 1
/* 406F54 E011C414 00621823 */  subu      $v1, $v1, $v0
/* 406F58 E011C418 00031080 */  sll       $v0, $v1, 2
/* 406F5C E011C41C 00431021 */  addu      $v0, $v0, $v1
/* 406F60 E011C420 02C21023 */  subu      $v0, $s6, $v0
/* 406F64 E011C424 00021080 */  sll       $v0, $v0, 2
/* 406F68 E011C428 3C05E012 */  lui       $a1, (0xE0120000 >> 16)
/* 406F6C E011C42C 00A22821 */  addu      $a1, $a1, $v0
/* 406F70 E011C430 8CA5C518 */  lw        $a1, -0x3AE8($a1)
/* 406F74 E011C434 0804711B */  j         .LE011C46C
/* 406F78 E011C438 3C07D838 */   lui      $a3, (0xD8380002 >> 16)
.LE011C43C:
/* 406F7C E011C43C 06C10002 */  bgez      $s6, .LE011C448
/* 406F80 E011C440 02C0102D */   daddu    $v0, $s6, $zero
/* 406F84 E011C444 26C20003 */  addiu     $v0, $s6, 0x3
.LE011C448:
/* 406F88 E011C448 00021083 */  sra       $v0, $v0, 2
/* 406F8C E011C44C 00021080 */  sll       $v0, $v0, 2
/* 406F90 E011C450 02C21023 */  subu      $v0, $s6, $v0
/* 406F94 E011C454 00021080 */  sll       $v0, $v0, 2
/* 406F98 E011C458 3C03E012 */  lui       $v1, %hi(D_E011C52C)
/* 406F9C E011C45C 2463C52C */  addiu     $v1, $v1, %lo(D_E011C52C)
/* 406FA0 E011C460 00431021 */  addu      $v0, $v0, $v1
/* 406FA4 E011C464 8C450000 */  lw        $a1, 0x0($v0)
/* 406FA8 E011C468 3C07D838 */  lui       $a3, (0xD8380002 >> 16)
.LE011C46C:
/* 406FAC E011C46C 3C04800A */  lui       $a0, %hi(gMainGfxPos)
/* 406FB0 E011C470 2484A66C */  addiu     $a0, $a0, %lo(gMainGfxPos)
/* 406FB4 E011C474 34E70002 */  ori       $a3, $a3, (0xD8380002 & 0xFFFF)
/* 406FB8 E011C478 8C830000 */  lw        $v1, 0x0($a0)
/* 406FBC E011C47C 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 406FC0 E011C480 0060302D */  daddu     $a2, $v1, $zero
/* 406FC4 E011C484 24630008 */  addiu     $v1, $v1, 0x8
/* 406FC8 E011C488 AC830000 */  sw        $v1, 0x0($a0)
/* 406FCC E011C48C ACC20000 */  sw        $v0, 0x0($a2)
/* 406FD0 E011C490 24620008 */  addiu     $v0, $v1, 0x8
/* 406FD4 E011C494 AC820000 */  sw        $v0, 0x0($a0)
/* 406FD8 E011C498 00051080 */  sll       $v0, $a1, 2
/* 406FDC E011C49C 3C05E012 */  lui       $a1, (0xE0120000 >> 16)
/* 406FE0 E011C4A0 00A22821 */  addu      $a1, $a1, $v0
/* 406FE4 E011C4A4 8CA5C500 */  lw        $a1, -0x3B00($a1)
/* 406FE8 E011C4A8 24620010 */  addiu     $v0, $v1, 0x10
/* 406FEC E011C4AC AC820000 */  sw        $v0, 0x0($a0)
/* 406FF0 E011C4B0 24020040 */  addiu     $v0, $zero, 0x40
/* 406FF4 E011C4B4 ACC50004 */  sw        $a1, 0x4($a2)
/* 406FF8 E011C4B8 AC620004 */  sw        $v0, 0x4($v1)
/* 406FFC E011C4BC 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 407000 E011C4C0 AC670000 */  sw        $a3, 0x0($v1)
/* 407004 E011C4C4 AC620008 */  sw        $v0, 0x8($v1)
/* 407008 E011C4C8 AC60000C */  sw        $zero, 0xC($v1)
/* 40700C E011C4CC 8FBF00B4 */  lw        $ra, 0xB4($sp)
/* 407010 E011C4D0 8FB600B0 */  lw        $s6, 0xB0($sp)
/* 407014 E011C4D4 8FB500AC */  lw        $s5, 0xAC($sp)
/* 407018 E011C4D8 8FB400A8 */  lw        $s4, 0xA8($sp)
/* 40701C E011C4DC 8FB300A4 */  lw        $s3, 0xA4($sp)
/* 407020 E011C4E0 8FB200A0 */  lw        $s2, 0xA0($sp)
/* 407024 E011C4E4 8FB1009C */  lw        $s1, 0x9C($sp)
/* 407028 E011C4E8 8FB00098 */  lw        $s0, 0x98($sp)
/* 40702C E011C4EC D7B400B8 */  ldc1      $f20, 0xB8($sp)
/* 407030 E011C4F0 03E00008 */  jr        $ra
/* 407034 E011C4F4 27BD00C0 */   addiu    $sp, $sp, 0xC0
/* 407038 E011C4F8 00000000 */  nop
/* 40703C E011C4FC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void quizmo_assistant_appendGfx(void* effect) {
    QuizmoAssistantFXData* data = ((EffectInstance*)effect)->data.quizmoAssistant;
    s32 lifetime = data->lifetime;
    s32 fadeInAmt = data->fadeInAmt;
    s32 idx;
    Matrix4f sp18;
    Matrix4f sp58;

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

    shim_guTranslateF(sp18, data->position.x, data->position.y, data->position.z);
    shim_guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f);
    shim_guMtxCatF(sp58, sp18, sp18);
    shim_guTranslateF(sp58, 89.5f, 0.0f, 2.0f);
    shim_guMtxCatF(sp58, sp18, sp18);
    shim_guScaleF(sp58, 5.0f / 7, 5.0f / 7, 5.0f / 7);
    shim_guMtxCatF(sp58, sp18, sp18);
    shim_guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);

    gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
    gDPSetPrimColor(gMainGfxPos++, 0, 0, fadeInAmt, fadeInAmt, fadeInAmt, 255);
    gSPDisplayList(gMainGfxPos++, D_E011C514[0]);

    switch (data->anim) {
        case 0:
            idx = 0;
            break;
        case 1:
            idx = D_E011C518[lifetime % ARRAY_COUNT(D_E011C518)];
            break;
        case 2:
        default:
            idx = D_E011C52C[lifetime % ARRAY_COUNT(D_E011C52C)];
            break;
    }

    gSPDisplayList(gMainGfxPos++, D_E011C500[idx]);
    gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    gDPPipeSync(gMainGfxPos++);
}