### RAW ASSEMBLY INSTRUCTIONS:

glabel shimmer_wave_appendGfx
/* 376A40 E00745E0 27BDFF10 */  addiu     $sp, $sp, -0xF0
/* 376A44 E00745E4 3C06DB06 */  lui       $a2, (0xDB060024 >> 16)
/* 376A48 E00745E8 34C60024 */  ori       $a2, $a2, (0xDB060024 & 0xFFFF)
/* 376A4C E00745EC AFA400F0 */  sw        $a0, 0xF0($sp)
/* 376A50 E00745F0 27A40020 */  addiu     $a0, $sp, 0x20
/* 376A54 E00745F4 AFB100B4 */  sw        $s1, 0xB4($sp)
/* 376A58 E00745F8 3C110001 */  lui       $s1, (0x11630 >> 16)
/* 376A5C E00745FC 36311630 */  ori       $s1, $s1, (0x11630 & 0xFFFF)
/* 376A60 E0074600 AFB500C4 */  sw        $s5, 0xC4($sp)
/* 376A64 E0074604 3C15800A */  lui       $s5, %hi(gMainGfxPos)
/* 376A68 E0074608 26B5A66C */  addiu     $s5, $s5, %lo(gMainGfxPos)
/* 376A6C E007460C AFBF00D4 */  sw        $ra, 0xD4($sp)
/* 376A70 E0074610 AFBE00D0 */  sw        $fp, 0xD0($sp)
/* 376A74 E0074614 AFB700CC */  sw        $s7, 0xCC($sp)
/* 376A78 E0074618 AFB600C8 */  sw        $s6, 0xC8($sp)
/* 376A7C E007461C AFB400C0 */  sw        $s4, 0xC0($sp)
/* 376A80 E0074620 AFB300BC */  sw        $s3, 0xBC($sp)
/* 376A84 E0074624 AFB200B8 */  sw        $s2, 0xB8($sp)
/* 376A88 E0074628 AFB000B0 */  sw        $s0, 0xB0($sp)
/* 376A8C E007462C F7B800E8 */  sdc1      $f24, 0xE8($sp)
/* 376A90 E0074630 F7B600E0 */  sdc1      $f22, 0xE0($sp)
/* 376A94 E0074634 F7B400D8 */  sdc1      $f20, 0xD8($sp)
/* 376A98 E0074638 8EA50000 */  lw        $a1, 0x0($s5)
/* 376A9C E007463C 8FAA00F0 */  lw        $t2, 0xF0($sp)
/* 376AA0 E0074640 00A0182D */  daddu     $v1, $a1, $zero
/* 376AA4 E0074644 8D52000C */  lw        $s2, 0xC($t2)
/* 376AA8 E0074648 24A50008 */  addiu     $a1, $a1, 0x8
/* 376AAC E007464C AEA50000 */  sw        $a1, 0x0($s5)
/* 376AB0 E0074650 8E4A0050 */  lw        $t2, 0x50($s2)
/* 376AB4 E0074654 C642004C */  lwc1      $f2, 0x4C($s2)
/* 376AB8 E0074658 468010A0 */  cvt.s.w   $f2, $f2
/* 376ABC E007465C AFAA00A0 */  sw        $t2, 0xA0($sp)
/* 376AC0 E0074660 8E4A0054 */  lw        $t2, 0x54($s2)
/* 376AC4 E0074664 24130001 */  addiu     $s3, $zero, 0x1
/* 376AC8 E0074668 AFAA00A4 */  sw        $t2, 0xA4($sp)
/* 376ACC E007466C 8E4A0058 */  lw        $t2, 0x58($s2)
/* 376AD0 E0074670 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 376AD4 E0074674 AFAA00A8 */  sw        $t2, 0xA8($sp)
/* 376AD8 E0074678 AC620000 */  sw        $v0, 0x0($v1)
/* 376ADC E007467C AC600004 */  sw        $zero, 0x4($v1)
/* 376AE0 E0074680 ACA60000 */  sw        $a2, 0x0($a1)
/* 376AE4 E0074684 8FAA00F0 */  lw        $t2, 0xF0($sp)
/* 376AE8 E0074688 3C01437F */  lui       $at, (0x437F0000 >> 16)
/* 376AEC E007468C 44810000 */  mtc1      $at, $f0
/* 376AF0 E0074690 8D430010 */  lw        $v1, 0x10($t2)
/* 376AF4 E0074694 24A20008 */  addiu     $v0, $a1, 0x8
/* 376AF8 E0074698 AEA20000 */  sw        $v0, 0x0($s5)
/* 376AFC E007469C 8C62001C */  lw        $v0, 0x1C($v1)
/* 376B00 E00746A0 3C038000 */  lui       $v1, (0x80000000 >> 16)
/* 376B04 E00746A4 00431021 */  addu      $v0, $v0, $v1
/* 376B08 E00746A8 ACA20004 */  sw        $v0, 0x4($a1)
/* 376B0C E00746AC 8E450004 */  lw        $a1, 0x4($s2)
/* 376B10 E00746B0 8E460008 */  lw        $a2, 0x8($s2)
/* 376B14 E00746B4 8E47000C */  lw        $a3, 0xC($s2)
/* 376B18 E00746B8 0C080108 */  jal       shim_guTranslateF
/* 376B1C E00746BC 46001503 */   div.s    $f20, $f2, $f0
/* 376B20 E00746C0 27B00060 */  addiu     $s0, $sp, 0x60
/* 376B24 E00746C4 8E450060 */  lw        $a1, 0x60($s2)
/* 376B28 E00746C8 0200202D */  daddu     $a0, $s0, $zero
/* 376B2C E00746CC 00A0302D */  daddu     $a2, $a1, $zero
/* 376B30 E00746D0 0C080110 */  jal       shim_guScaleF
/* 376B34 E00746D4 00A0382D */   daddu    $a3, $a1, $zero
/* 376B38 E00746D8 0200202D */  daddu     $a0, $s0, $zero
/* 376B3C E00746DC 27A50020 */  addiu     $a1, $sp, 0x20
/* 376B40 E00746E0 0C080114 */  jal       shim_guMtxCatF
/* 376B44 E00746E4 00A0302D */   daddu    $a2, $a1, $zero
/* 376B48 E00746E8 27A40020 */  addiu     $a0, $sp, 0x20
/* 376B4C E00746EC 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* 376B50 E00746F0 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* 376B54 E00746F4 3C16800A */  lui       $s6, %hi(gDisplayContext)
/* 376B58 E00746F8 26D6A674 */  addiu     $s6, $s6, %lo(gDisplayContext)
/* 376B5C E00746FC 96050000 */  lhu       $a1, 0x0($s0)
/* 376B60 E0074700 8EC20000 */  lw        $v0, 0x0($s6)
/* 376B64 E0074704 00052980 */  sll       $a1, $a1, 6
/* 376B68 E0074708 00B12821 */  addu      $a1, $a1, $s1
/* 376B6C E007470C 0C080118 */  jal       shim_guMtxF2L
/* 376B70 E0074710 00452821 */   addu     $a1, $v0, $a1
/* 376B74 E0074714 3C03DA38 */  lui       $v1, (0xDA380002 >> 16)
/* 376B78 E0074718 34630002 */  ori       $v1, $v1, (0xDA380002 & 0xFFFF)
/* 376B7C E007471C 8EA40000 */  lw        $a0, 0x0($s5)
/* 376B80 E0074720 96020000 */  lhu       $v0, 0x0($s0)
/* 376B84 E0074724 0080282D */  daddu     $a1, $a0, $zero
/* 376B88 E0074728 24840008 */  addiu     $a0, $a0, 0x8
/* 376B8C E007472C AEA40000 */  sw        $a0, 0x0($s5)
/* 376B90 E0074730 ACA30000 */  sw        $v1, 0x0($a1)
/* 376B94 E0074734 00531821 */  addu      $v1, $v0, $s3
/* 376B98 E0074738 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 376B9C E007473C 00021180 */  sll       $v0, $v0, 6
/* 376BA0 E0074740 00511021 */  addu      $v0, $v0, $s1
/* 376BA4 E0074744 A6030000 */  sh        $v1, 0x0($s0)
/* 376BA8 E0074748 8EC30000 */  lw        $v1, 0x0($s6)
/* 376BAC E007474C 24870010 */  addiu     $a3, $a0, 0x10
/* 376BB0 E0074750 00621821 */  addu      $v1, $v1, $v0
/* 376BB4 E0074754 24820008 */  addiu     $v0, $a0, 0x8
/* 376BB8 E0074758 ACA30004 */  sw        $v1, 0x4($a1)
/* 376BBC E007475C AEA20000 */  sw        $v0, 0x0($s5)
/* 376BC0 E0074760 3C02FB00 */  lui       $v0, (0xFB000000 >> 16)
/* 376BC4 E0074764 AC820000 */  sw        $v0, 0x0($a0)
/* 376BC8 E0074768 92430043 */  lbu       $v1, 0x43($s2)
/* 376BCC E007476C 92450047 */  lbu       $a1, 0x47($s2)
/* 376BD0 E0074770 9246004B */  lbu       $a2, 0x4B($s2)
/* 376BD4 E0074774 9248005F */  lbu       $t0, 0x5F($s2)
/* 376BD8 E0074778 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 376BDC E007477C AEA70000 */  sw        $a3, 0x0($s5)
/* 376BE0 E0074780 AC820008 */  sw        $v0, 0x8($a0)
/* 376BE4 E0074784 3C020900 */  lui       $v0, %hi(D_09000F20_327330)
/* 376BE8 E0074788 24420F20 */  addiu     $v0, $v0, %lo(D_09000F20_327330)
/* 376BEC E007478C AC82000C */  sw        $v0, 0xC($a0)
/* 376BF0 E0074790 24820018 */  addiu     $v0, $a0, 0x18
/* 376BF4 E0074794 AEA20000 */  sw        $v0, 0x0($s5)
/* 376BF8 E0074798 00031E00 */  sll       $v1, $v1, 24
/* 376BFC E007479C 00052C00 */  sll       $a1, $a1, 16
/* 376C00 E00747A0 00651825 */  or        $v1, $v1, $a1
/* 376C04 E00747A4 00063200 */  sll       $a2, $a2, 8
/* 376C08 E00747A8 00661825 */  or        $v1, $v1, $a2
/* 376C0C E00747AC 00681825 */  or        $v1, $v1, $t0
/* 376C10 E00747B0 AC830004 */  sw        $v1, 0x4($a0)
/* 376C14 E00747B4 8FAA00F0 */  lw        $t2, 0xF0($sp)
/* 376C18 E00747B8 00E0A02D */  daddu     $s4, $a3, $zero
/* 376C1C E00747BC 8D420008 */  lw        $v0, 0x8($t2)
/* 376C20 E00747C0 0262102A */  slt       $v0, $s3, $v0
/* 376C24 E00747C4 1040006E */  beqz      $v0, .LE0074980
/* 376C28 E00747C8 2652006C */   addiu    $s2, $s2, 0x6C
/* 376C2C E00747CC 02C0F02D */  daddu     $fp, $s6, $zero
/* 376C30 E00747D0 0200B82D */  daddu     $s7, $s0, $zero
/* 376C34 E00747D4 3C160001 */  lui       $s6, (0x11630 >> 16)
/* 376C38 E00747D8 36D61630 */  ori       $s6, $s6, (0x11630 & 0xFFFF)
/* 376C3C E00747DC 02A0882D */  daddu     $s1, $s5, $zero
/* 376C40 E00747E0 2650004C */  addiu     $s0, $s2, 0x4C
/* 376C44 E00747E4 8FAA00A0 */  lw        $t2, 0xA0($sp)
/* 376C48 E00747E8 4480C000 */  mtc1      $zero, $f24
/* 376C4C E00747EC 000A1600 */  sll       $v0, $t2, 24
/* 376C50 E00747F0 8FAA00A4 */  lw        $t2, 0xA4($sp)
/* 376C54 E00747F4 3C014F00 */  lui       $at, (0x4F000000 >> 16)
/* 376C58 E00747F8 4481B000 */  mtc1      $at, $f22
/* 376C5C E00747FC 314300FF */  andi      $v1, $t2, 0xFF
/* 376C60 E0074800 00031C00 */  sll       $v1, $v1, 16
/* 376C64 E0074804 8FAA00A8 */  lw        $t2, 0xA8($sp)
/* 376C68 E0074808 00431025 */  or        $v0, $v0, $v1
/* 376C6C E007480C 314300FF */  andi      $v1, $t2, 0xFF
/* 376C70 E0074810 00031A00 */  sll       $v1, $v1, 8
/* 376C74 E0074814 0043A825 */  or        $s5, $v0, $v1
.LE0074818:
/* 376C78 E0074818 8E02FFE4 */  lw        $v0, -0x1C($s0)
/* 376C7C E007481C 04400052 */  bltz      $v0, .LE0074968
/* 376C80 E0074820 00000000 */   nop
/* 376C84 E0074824 C6000014 */  lwc1      $f0, 0x14($s0)
/* 376C88 E0074828 46140002 */  mul.s     $f0, $f0, $f20
/* 376C8C E007482C 00000000 */  nop
/* 376C90 E0074830 4405C000 */  mfc1      $a1, $f24
/* 376C94 E0074834 4406C000 */  mfc1      $a2, $f24
/* 376C98 E0074838 E7A00010 */  swc1      $f0, 0x10($sp)
/* 376C9C E007483C C600FFB8 */  lwc1      $f0, -0x48($s0)
/* 376CA0 E0074840 E7A00014 */  swc1      $f0, 0x14($sp)
/* 376CA4 E0074844 C600FFBC */  lwc1      $f0, -0x44($s0)
/* 376CA8 E0074848 E7A00018 */  swc1      $f0, 0x18($sp)
/* 376CAC E007484C C600FFC0 */  lwc1      $f0, -0x40($s0)
/* 376CB0 E0074850 E7A0001C */  swc1      $f0, 0x1C($sp)
/* 376CB4 E0074854 8E07FFE8 */  lw        $a3, -0x18($s0)
/* 376CB8 E0074858 0C080180 */  jal       shim_guPositionF
/* 376CBC E007485C 27A40020 */   addiu    $a0, $sp, 0x20
/* 376CC0 E0074860 27A40020 */  addiu     $a0, $sp, 0x20
/* 376CC4 E0074864 96E50000 */  lhu       $a1, 0x0($s7)
/* 376CC8 E0074868 8FC20000 */  lw        $v0, 0x0($fp)
/* 376CCC E007486C 00052980 */  sll       $a1, $a1, 6
/* 376CD0 E0074870 00B62821 */  addu      $a1, $a1, $s6
/* 376CD4 E0074874 0C080118 */  jal       shim_guMtxF2L
/* 376CD8 E0074878 00452821 */   addu     $a1, $v0, $a1
/* 376CDC E007487C 8E240000 */  lw        $a0, 0x0($s1)
/* 376CE0 E0074880 0080302D */  daddu     $a2, $a0, $zero
/* 376CE4 E0074884 24840008 */  addiu     $a0, $a0, 0x8
/* 376CE8 E0074888 AE240000 */  sw        $a0, 0x0($s1)
/* 376CEC E007488C 96E50000 */  lhu       $a1, 0x0($s7)
/* 376CF0 E0074890 3C02DA38 */  lui       $v0, (0xDA380000 >> 16)
/* 376CF4 E0074894 ACC20000 */  sw        $v0, 0x0($a2)
/* 376CF8 E0074898 8FC30000 */  lw        $v1, 0x0($fp)
/* 376CFC E007489C 30A2FFFF */  andi      $v0, $a1, 0xFFFF
/* 376D00 E00748A0 00021180 */  sll       $v0, $v0, 6
/* 376D04 E00748A4 00561021 */  addu      $v0, $v0, $s6
/* 376D08 E00748A8 00621821 */  addu      $v1, $v1, $v0
/* 376D0C E00748AC 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 376D10 E00748B0 24A50001 */  addiu     $a1, $a1, 0x1
/* 376D14 E00748B4 ACC30004 */  sw        $v1, 0x4($a2)
/* 376D18 E00748B8 AC820000 */  sw        $v0, 0x0($a0)
/* 376D1C E00748BC C6000000 */  lwc1      $f0, 0x0($s0)
/* 376D20 E00748C0 46800020 */  cvt.s.w   $f0, $f0
/* 376D24 E00748C4 46140002 */  mul.s     $f0, $f0, $f20
/* 376D28 E00748C8 00000000 */  nop
/* 376D2C E00748CC 24820008 */  addiu     $v0, $a0, 0x8
/* 376D30 E00748D0 24840004 */  addiu     $a0, $a0, 0x4
/* 376D34 E00748D4 A6E50000 */  sh        $a1, 0x0($s7)
/* 376D38 E00748D8 4600B03E */  c.le.s    $f22, $f0
/* 376D3C E00748DC 00000000 */  nop
/* 376D40 E00748E0 45010005 */  bc1t      .LE00748F8
/* 376D44 E00748E4 AE220000 */   sw       $v0, 0x0($s1)
/* 376D48 E00748E8 4600010D */  trunc.w.s $f4, $f0
/* 376D4C E00748EC 44052000 */  mfc1      $a1, $f4
/* 376D50 E00748F0 0801D245 */  j         .LE0074914
/* 376D54 E00748F4 3C06D838 */   lui      $a2, (0xD8380002 >> 16)
.LE00748F8:
/* 376D58 E00748F8 46160001 */  sub.s     $f0, $f0, $f22
/* 376D5C E00748FC 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 376D60 E0074900 4600010D */  trunc.w.s $f4, $f0
/* 376D64 E0074904 44052000 */  mfc1      $a1, $f4
/* 376D68 E0074908 00000000 */  nop
/* 376D6C E007490C 00A22825 */  or        $a1, $a1, $v0
/* 376D70 E0074910 3C06D838 */  lui       $a2, (0xD8380002 >> 16)
.LE0074914:
/* 376D74 E0074914 34C60002 */  ori       $a2, $a2, (0xD8380002 & 0xFFFF)
/* 376D78 E0074918 30A200FF */  andi      $v0, $a1, 0xFF
/* 376D7C E007491C 8E230000 */  lw        $v1, 0x0($s1)
/* 376D80 E0074920 02A21025 */  or        $v0, $s5, $v0
/* 376D84 E0074924 AC820000 */  sw        $v0, 0x0($a0)
/* 376D88 E0074928 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 376D8C E007492C 0060282D */  daddu     $a1, $v1, $zero
/* 376D90 E0074930 24630008 */  addiu     $v1, $v1, 0x8
/* 376D94 E0074934 AE230000 */  sw        $v1, 0x0($s1)
/* 376D98 E0074938 ACA20000 */  sw        $v0, 0x0($a1)
/* 376D9C E007493C 32620007 */  andi      $v0, $s3, 0x7
/* 376DA0 E0074940 00021080 */  sll       $v0, $v0, 2
/* 376DA4 E0074944 3C04E007 */  lui       $a0, (0xE0074B60 >> 16)
/* 376DA8 E0074948 00822021 */  addu      $a0, $a0, $v0
/* 376DAC E007494C 8C844B60 */  lw        $a0, (0xE0074B60 & 0xFFFF)($a0)
/* 376DB0 E0074950 24620008 */  addiu     $v0, $v1, 0x8
/* 376DB4 E0074954 AE220000 */  sw        $v0, 0x0($s1)
/* 376DB8 E0074958 24020040 */  addiu     $v0, $zero, 0x40
/* 376DBC E007495C ACA40004 */  sw        $a0, 0x4($a1)
/* 376DC0 E0074960 AC660000 */  sw        $a2, 0x0($v1)
/* 376DC4 E0074964 AC620004 */  sw        $v0, 0x4($v1)
.LE0074968:
/* 376DC8 E0074968 8FAA00F0 */  lw        $t2, 0xF0($sp)
/* 376DCC E007496C 26730001 */  addiu     $s3, $s3, 0x1
/* 376DD0 E0074970 8D420008 */  lw        $v0, 0x8($t2)
/* 376DD4 E0074974 0262102A */  slt       $v0, $s3, $v0
/* 376DD8 E0074978 1440FFA7 */  bnez      $v0, .LE0074818
/* 376DDC E007497C 2610006C */   addiu    $s0, $s0, 0x6C
.LE0074980:
/* 376DE0 E0074980 27A40020 */  addiu     $a0, $sp, 0x20
/* 376DE4 E0074984 3C150001 */  lui       $s5, (0x11630 >> 16)
/* 376DE8 E0074988 36B51630 */  ori       $s5, $s5, (0x11630 & 0xFFFF)
/* 376DEC E007498C 3C1ED838 */  lui       $fp, (0xD8380002 >> 16)
/* 376DF0 E0074990 37DE0002 */  ori       $fp, $fp, (0xD8380002 & 0xFFFF)
/* 376DF4 E0074994 3C10800A */  lui       $s0, %hi(gMainGfxPos)
/* 376DF8 E0074998 2610A66C */  addiu     $s0, $s0, %lo(gMainGfxPos)
/* 376DFC E007499C 3C02DF00 */  lui       $v0, (0xDF000000 >> 16)
/* 376E00 E00749A0 3C16DE00 */  lui       $s6, (0xDE000000 >> 16)
/* 376E04 E00749A4 8E030000 */  lw        $v1, 0x0($s0)
/* 376E08 E00749A8 3C0542F0 */  lui       $a1, (0x42F00000 >> 16)
/* 376E0C E00749AC 4480A000 */  mtc1      $zero, $f20
/* 376E10 E00749B0 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 376E14 E00749B4 4481B000 */  mtc1      $at, $f22
/* 376E18 E00749B8 0060402D */  daddu     $t0, $v1, $zero
/* 376E1C E00749BC 4406A000 */  mfc1      $a2, $f20
/* 376E20 E00749C0 4407B000 */  mfc1      $a3, $f22
/* 376E24 E00749C4 24630008 */  addiu     $v1, $v1, 0x8
/* 376E28 E00749C8 AE030000 */  sw        $v1, 0x0($s0)
/* 376E2C E00749CC AD020000 */  sw        $v0, 0x0($t0)
/* 376E30 E00749D0 3C02DE01 */  lui       $v0, (0xDE010000 >> 16)
/* 376E34 E00749D4 AD000004 */  sw        $zero, 0x4($t0)
/* 376E38 E00749D8 AE820000 */  sw        $v0, 0x0($s4)
/* 376E3C E00749DC 24620008 */  addiu     $v0, $v1, 0x8
/* 376E40 E00749E0 AE830004 */  sw        $v1, 0x4($s4)
/* 376E44 E00749E4 26940008 */  addiu     $s4, $s4, 0x8
/* 376E48 E00749E8 AE020000 */  sw        $v0, 0x0($s0)
/* 376E4C E00749EC AC760000 */  sw        $s6, 0x0($v1)
/* 376E50 E00749F0 AC740004 */  sw        $s4, 0x4($v1)
/* 376E54 E00749F4 0C080104 */  jal       shim_guRotateF
/* 376E58 E00749F8 E7B40010 */   swc1     $f20, 0x10($sp)
/* 376E5C E00749FC 27A40020 */  addiu     $a0, $sp, 0x20
/* 376E60 E0074A00 3C118007 */  lui       $s1, %hi(gMatrixListPos)
/* 376E64 E0074A04 263141F0 */  addiu     $s1, $s1, %lo(gMatrixListPos)
/* 376E68 E0074A08 3C13800A */  lui       $s3, %hi(gDisplayContext)
/* 376E6C E0074A0C 2673A674 */  addiu     $s3, $s3, %lo(gDisplayContext)
/* 376E70 E0074A10 96250000 */  lhu       $a1, 0x0($s1)
/* 376E74 E0074A14 8E620000 */  lw        $v0, 0x0($s3)
/* 376E78 E0074A18 00052980 */  sll       $a1, $a1, 6
/* 376E7C E0074A1C 00B52821 */  addu      $a1, $a1, $s5
/* 376E80 E0074A20 0C080118 */  jal       shim_guMtxF2L
/* 376E84 E0074A24 00452821 */   addu     $a1, $v0, $a1
/* 376E88 E0074A28 27A40020 */  addiu     $a0, $sp, 0x20
/* 376E8C E0074A2C 3C17DA38 */  lui       $s7, (0xDA380000 >> 16)
/* 376E90 E0074A30 8E080000 */  lw        $t0, 0x0($s0)
/* 376E94 E0074A34 3C05C2F0 */  lui       $a1, (0xC2F00000 >> 16)
/* 376E98 E0074A38 4406A000 */  mfc1      $a2, $f20
/* 376E9C E0074A3C 4407B000 */  mfc1      $a3, $f22
/* 376EA0 E0074A40 0100482D */  daddu     $t1, $t0, $zero
/* 376EA4 E0074A44 25080008 */  addiu     $t0, $t0, 0x8
/* 376EA8 E0074A48 AE080000 */  sw        $t0, 0x0($s0)
/* 376EAC E0074A4C 96220000 */  lhu       $v0, 0x0($s1)
/* 376EB0 E0074A50 24120040 */  addiu     $s2, $zero, 0x40
/* 376EB4 E0074A54 AD370000 */  sw        $s7, 0x0($t1)
/* 376EB8 E0074A58 24430001 */  addiu     $v1, $v0, 0x1
/* 376EBC E0074A5C 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 376EC0 E0074A60 00021180 */  sll       $v0, $v0, 6
/* 376EC4 E0074A64 A6230000 */  sh        $v1, 0x0($s1)
/* 376EC8 E0074A68 8E630000 */  lw        $v1, 0x0($s3)
/* 376ECC E0074A6C 00551021 */  addu      $v0, $v0, $s5
/* 376ED0 E0074A70 00621821 */  addu      $v1, $v1, $v0
/* 376ED4 E0074A74 25020008 */  addiu     $v0, $t0, 0x8
/* 376ED8 E0074A78 AD230004 */  sw        $v1, 0x4($t1)
/* 376EDC E0074A7C AE020000 */  sw        $v0, 0x0($s0)
/* 376EE0 E0074A80 25020010 */  addiu     $v0, $t0, 0x10
/* 376EE4 E0074A84 AD160000 */  sw        $s6, 0x0($t0)
/* 376EE8 E0074A88 AD140004 */  sw        $s4, 0x4($t0)
/* 376EEC E0074A8C AE020000 */  sw        $v0, 0x0($s0)
/* 376EF0 E0074A90 AD1E0008 */  sw        $fp, 0x8($t0)
/* 376EF4 E0074A94 AD12000C */  sw        $s2, 0xC($t0)
/* 376EF8 E0074A98 0C080104 */  jal       shim_guRotateF
/* 376EFC E0074A9C AFA60010 */   sw       $a2, 0x10($sp)
/* 376F00 E0074AA0 27A40020 */  addiu     $a0, $sp, 0x20
/* 376F04 E0074AA4 96250000 */  lhu       $a1, 0x0($s1)
/* 376F08 E0074AA8 8E620000 */  lw        $v0, 0x0($s3)
/* 376F0C E0074AAC 00052980 */  sll       $a1, $a1, 6
/* 376F10 E0074AB0 00B52821 */  addu      $a1, $a1, $s5
/* 376F14 E0074AB4 0C080118 */  jal       shim_guMtxF2L
/* 376F18 E0074AB8 00452821 */   addu     $a1, $v0, $a1
/* 376F1C E0074ABC 8E040000 */  lw        $a0, 0x0($s0)
/* 376F20 E0074AC0 96220000 */  lhu       $v0, 0x0($s1)
/* 376F24 E0074AC4 0080282D */  daddu     $a1, $a0, $zero
/* 376F28 E0074AC8 24840008 */  addiu     $a0, $a0, 0x8
/* 376F2C E0074ACC 24430001 */  addiu     $v1, $v0, 0x1
/* 376F30 E0074AD0 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 376F34 E0074AD4 00021180 */  sll       $v0, $v0, 6
/* 376F38 E0074AD8 AE040000 */  sw        $a0, 0x0($s0)
/* 376F3C E0074ADC ACB70000 */  sw        $s7, 0x0($a1)
/* 376F40 E0074AE0 A6230000 */  sh        $v1, 0x0($s1)
/* 376F44 E0074AE4 8E630000 */  lw        $v1, 0x0($s3)
/* 376F48 E0074AE8 00551021 */  addu      $v0, $v0, $s5
/* 376F4C E0074AEC 00621821 */  addu      $v1, $v1, $v0
/* 376F50 E0074AF0 24820008 */  addiu     $v0, $a0, 0x8
/* 376F54 E0074AF4 ACA30004 */  sw        $v1, 0x4($a1)
/* 376F58 E0074AF8 AE020000 */  sw        $v0, 0x0($s0)
/* 376F5C E0074AFC 24820010 */  addiu     $v0, $a0, 0x10
/* 376F60 E0074B00 AC960000 */  sw        $s6, 0x0($a0)
/* 376F64 E0074B04 AC940004 */  sw        $s4, 0x4($a0)
/* 376F68 E0074B08 AE020000 */  sw        $v0, 0x0($s0)
/* 376F6C E0074B0C 24820018 */  addiu     $v0, $a0, 0x18
/* 376F70 E0074B10 AC9E0008 */  sw        $fp, 0x8($a0)
/* 376F74 E0074B14 AC92000C */  sw        $s2, 0xC($a0)
/* 376F78 E0074B18 AE020000 */  sw        $v0, 0x0($s0)
/* 376F7C E0074B1C AC9E0010 */  sw        $fp, 0x10($a0)
/* 376F80 E0074B20 AC920014 */  sw        $s2, 0x14($a0)
/* 376F84 E0074B24 8FBF00D4 */  lw        $ra, 0xD4($sp)
/* 376F88 E0074B28 8FBE00D0 */  lw        $fp, 0xD0($sp)
/* 376F8C E0074B2C 8FB700CC */  lw        $s7, 0xCC($sp)
/* 376F90 E0074B30 8FB600C8 */  lw        $s6, 0xC8($sp)
/* 376F94 E0074B34 8FB500C4 */  lw        $s5, 0xC4($sp)
/* 376F98 E0074B38 8FB400C0 */  lw        $s4, 0xC0($sp)
/* 376F9C E0074B3C 8FB300BC */  lw        $s3, 0xBC($sp)
/* 376FA0 E0074B40 8FB200B8 */  lw        $s2, 0xB8($sp)
/* 376FA4 E0074B44 8FB100B4 */  lw        $s1, 0xB4($sp)
/* 376FA8 E0074B48 8FB000B0 */  lw        $s0, 0xB0($sp)
/* 376FAC E0074B4C D7B800E8 */  ldc1      $f24, 0xE8($sp)
/* 376FB0 E0074B50 D7B600E0 */  ldc1      $f22, 0xE0($sp)
/* 376FB4 E0074B54 D7B400D8 */  ldc1      $f20, 0xD8($sp)
/* 376FB8 E0074B58 03E00008 */  jr        $ra
/* 376FBC E0074B5C 27BD00F0 */   addiu    $sp, $sp, 0xF0

### DECOMPILED C INSTRUCTIONS:

void shimmer_wave_appendGfx(void* effect) {
    ShimmerWaveFXData* part = ((EffectInstance*)effect)->data.shimmerWave;
    s32 unk_50 = part->unk_50;
    s32 unk_54 = part->unk_54;
    s32 unk_58 = part->unk_58;
    f32 temp_4C = part->unk_4C / 255.0f;
    Gfx* savedGfxPos;
    Matrix4f sp20;
    Matrix4f sp60;
    s32 i;

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

    shim_guTranslateF(sp20, part->unk_04, part->unk_08, part->unk_0C);
    shim_guScaleF(sp60, part->unk_60, part->unk_60, part->unk_60);
    shim_guMtxCatF(sp60, sp20, sp20);
    shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);

    gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
    gDPSetEnvColor(gMainGfxPos++, part->unk_40, part->unk_44, part->unk_48, part->unk_5C);
    gSPDisplayList(gMainGfxPos++, D_09000F20_338EE0);

    savedGfxPos = gMainGfxPos;
    gMainGfxPos++;

    part++;
    for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) {
        if (part->unk_30 >= 0) {
            shim_guPositionF(sp20, 0.0f, 0.0f, part->unk_34, part->unk_60 * temp_4C, part->unk_04, part->unk_08, part->unk_0C);
            shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);

            gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
            gDPSetPrimColor(gMainGfxPos++, 0, 0, unk_50, unk_54, unk_58, part->unk_4C * temp_4C);
            gSPDisplayList(gMainGfxPos++, D_E0074B60[i & 7]);
            gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
        }
    }

    gSPEndDisplayList(gMainGfxPos++);
    gSPBranchList(savedGfxPos, gMainGfxPos);
    gSPDisplayList(gMainGfxPos++, savedGfxPos + 1);

    shim_guRotateF(sp20, 120.0f, 0.0f, 1.0f, 0.0f);
    shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);

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

    shim_guRotateF(sp20, -120.0f, 0.0f, 1.0f, 0.0f);
    shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);

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


### RAW ASSEMBLY INSTRUCTIONS:

glabel update_camera_mode_2
/* A0F8 8002ECF8 27BDFFB8 */  addiu     $sp, $sp, -0x48
/* A0FC 8002ECFC AFB00010 */  sw        $s0, 0x10($sp)
/* A100 8002ED00 0080802D */  daddu     $s0, $a0, $zero
/* A104 8002ED04 AFBF0014 */  sw        $ra, 0x14($sp)
/* A108 8002ED08 F7BE0040 */  sdc1      $f30, 0x40($sp)
/* A10C 8002ED0C F7BC0038 */  sdc1      $f28, 0x38($sp)
/* A110 8002ED10 F7BA0030 */  sdc1      $f26, 0x30($sp)
/* A114 8002ED14 F7B80028 */  sdc1      $f24, 0x28($sp)
/* A118 8002ED18 F7B60020 */  sdc1      $f22, 0x20($sp)
/* A11C 8002ED1C F7B40018 */  sdc1      $f20, 0x18($sp)
/* A120 8002ED20 86020020 */  lh        $v0, 0x20($s0)
/* A124 8002ED24 3C01800A */  lui       $at, %hi(D_8009A5EC)
/* A128 8002ED28 C426A5EC */  lwc1      $f6, %lo(D_8009A5EC)($at)
/* A12C 8002ED2C 86030022 */  lh        $v1, 0x22($s0)
/* A130 8002ED30 44822000 */  mtc1      $v0, $f4
/* A134 8002ED34 00000000 */  nop
/* A138 8002ED38 46802120 */  cvt.s.w   $f4, $f4
/* A13C 8002ED3C 44831000 */  mtc1      $v1, $f2
/* A140 8002ED40 00000000 */  nop
/* A144 8002ED44 468010A0 */  cvt.s.w   $f2, $f2
/* A148 8002ED48 46062102 */  mul.s     $f4, $f4, $f6
/* A14C 8002ED4C 00000000 */  nop
/* A150 8002ED50 8602001E */  lh        $v0, 0x1E($s0)
/* A154 8002ED54 86030006 */  lh        $v1, 0x6($s0)
/* A158 8002ED58 44820000 */  mtc1      $v0, $f0
/* A15C 8002ED5C 00000000 */  nop
/* A160 8002ED60 46800020 */  cvt.s.w   $f0, $f0
/* A164 8002ED64 8602001C */  lh        $v0, 0x1C($s0)
/* A168 8002ED68 46061082 */  mul.s     $f2, $f2, $f6
/* A16C 8002ED6C 00000000 */  nop
/* A170 8002ED70 E6000070 */  swc1      $f0, 0x70($s0)
/* A174 8002ED74 46000186 */  mov.s     $f6, $f0
/* A178 8002ED78 E6060084 */  swc1      $f6, 0x84($s0)
/* A17C 8002ED7C 44820000 */  mtc1      $v0, $f0
/* A180 8002ED80 00000000 */  nop
/* A184 8002ED84 46800020 */  cvt.s.w   $f0, $f0
/* A188 8002ED88 E6000074 */  swc1      $f0, 0x74($s0)
/* A18C 8002ED8C E6040078 */  swc1      $f4, 0x78($s0)
/* A190 8002ED90 10600047 */  beqz      $v1, .L8002EEB0
/* A194 8002ED94 E602007C */   swc1     $f2, 0x7C($s0)
/* A198 8002ED98 46000086 */  mov.s     $f2, $f0
/* A19C 8002ED9C 4480C000 */  mtc1      $zero, $f24
/* A1A0 8002EDA0 3C0140C9 */  lui       $at, (0x40C90FD0 >> 16)
/* A1A4 8002EDA4 34210FD0 */  ori       $at, $at, (0x40C90FD0 & 0xFFFF)
/* A1A8 8002EDA8 4481B000 */  mtc1      $at, $f22
/* A1AC 8002EDAC C6080054 */  lwc1      $f8, 0x54($s0)
/* A1B0 8002EDB0 C6000058 */  lwc1      $f0, 0x58($s0)
/* A1B4 8002EDB4 C604007C */  lwc1      $f4, 0x7C($s0)
/* A1B8 8002EDB8 C606005C */  lwc1      $f6, 0x5C($s0)
/* A1BC 8002EDBC 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
/* A1C0 8002EDC0 4481A000 */  mtc1      $at, $f20
/* A1C4 8002EDC4 46161082 */  mul.s     $f2, $f2, $f22
/* A1C8 8002EDC8 00000000 */  nop
/* A1CC 8002EDCC A6000006 */  sh        $zero, 0x6($s0)
/* A1D0 8002EDD0 E6180098 */  swc1      $f24, 0x98($s0)
/* A1D4 8002EDD4 E618009C */  swc1      $f24, 0x9C($s0)
/* A1D8 8002EDD8 46040000 */  add.s     $f0, $f0, $f4
/* A1DC 8002EDDC E6080048 */  swc1      $f8, 0x48($s0)
/* A1E0 8002EDE0 E6060050 */  swc1      $f6, 0x50($s0)
/* A1E4 8002EDE4 E600004C */  swc1      $f0, 0x4C($s0)
/* A1E8 8002EDE8 46141683 */  div.s     $f26, $f2, $f20
/* A1EC 8002EDEC 0C00A85B */  jal       sin_rad
/* A1F0 8002EDF0 4600D306 */   mov.s    $f12, $f26
/* A1F4 8002EDF4 46000786 */  mov.s     $f30, $f0
/* A1F8 8002EDF8 0C00A874 */  jal       cos_rad
/* A1FC 8002EDFC 4600D306 */   mov.s    $f12, $f26
/* A200 8002EE00 46000306 */  mov.s     $f12, $f0
/* A204 8002EE04 46186202 */  mul.s     $f8, $f12, $f24
/* A208 8002EE08 00000000 */  nop
/* A20C 8002EE0C 4600C087 */  neg.s     $f2, $f24
/* A210 8002EE10 4602F082 */  mul.s     $f2, $f30, $f2
/* A214 8002EE14 00000000 */  nop
/* A218 8002EE18 C61C0078 */  lwc1      $f28, 0x78($s0)
/* A21C 8002EE1C 461EE102 */  mul.s     $f4, $f28, $f30
/* A220 8002EE20 00000000 */  nop
/* A224 8002EE24 460CE182 */  mul.s     $f6, $f28, $f12
/* A228 8002EE28 00000000 */  nop
/* A22C 8002EE2C C6000070 */  lwc1      $f0, 0x70($s0)
/* A230 8002EE30 46160002 */  mul.s     $f0, $f0, $f22
/* A234 8002EE34 00000000 */  nop
/* A238 8002EE38 4600C286 */  mov.s     $f10, $f24
/* A23C 8002EE3C 46005586 */  mov.s     $f22, $f10
/* A240 8002EE40 46044600 */  add.s     $f24, $f8, $f4
/* A244 8002EE44 46140683 */  div.s     $f26, $f0, $f20
/* A248 8002EE48 4600D306 */  mov.s     $f12, $f26
/* A24C 8002EE4C 0C00A85B */  jal       sin_rad
/* A250 8002EE50 46061700 */   add.s    $f28, $f2, $f6
/* A254 8002EE54 46000786 */  mov.s     $f30, $f0
/* A258 8002EE58 0C00A874 */  jal       cos_rad
/* A25C 8002EE5C 4600D306 */   mov.s    $f12, $f26
/* A260 8002EE60 46000306 */  mov.s     $f12, $f0
/* A264 8002EE64 46166202 */  mul.s     $f8, $f12, $f22
/* A268 8002EE68 00000000 */  nop
/* A26C 8002EE6C 4616F182 */  mul.s     $f6, $f30, $f22
/* A270 8002EE70 00000000 */  nop
/* A274 8002EE74 461EE102 */  mul.s     $f4, $f28, $f30
/* A278 8002EE78 00000000 */  nop
/* A27C 8002EE7C 460CE082 */  mul.s     $f2, $f28, $f12
/* A280 8002EE80 00000000 */  nop
/* A284 8002EE84 C600004C */  lwc1      $f0, 0x4C($s0)
/* A288 8002EE88 46180400 */  add.s     $f16, $f0, $f24
/* A28C 8002EE8C 46044281 */  sub.s     $f10, $f8, $f4
/* A290 8002EE90 46023080 */  add.s     $f2, $f6, $f2
/* A294 8002EE94 C6000048 */  lwc1      $f0, 0x48($s0)
/* A298 8002EE98 460A0100 */  add.s     $f4, $f0, $f10
/* A29C 8002EE9C C6000050 */  lwc1      $f0, 0x50($s0)
/* A2A0 8002EEA0 46020200 */  add.s     $f8, $f0, $f2
/* A2A4 8002EEA4 E6100040 */  swc1      $f16, 0x40($s0)
/* A2A8 8002EEA8 E604003C */  swc1      $f4, 0x3C($s0)
/* A2AC 8002EEAC E6080044 */  swc1      $f8, 0x44($s0)
.L8002EEB0:
/* A2B0 8002EEB0 C6020054 */  lwc1      $f2, 0x54($s0)
/* A2B4 8002EEB4 C6000048 */  lwc1      $f0, 0x48($s0)
/* A2B8 8002EEB8 46001101 */  sub.s     $f4, $f2, $f0
/* A2BC 8002EEBC C602005C */  lwc1      $f2, 0x5C($s0)
/* A2C0 8002EEC0 C6000050 */  lwc1      $f0, 0x50($s0)
/* A2C4 8002EEC4 46001201 */  sub.s     $f8, $f2, $f0
/* A2C8 8002EEC8 C6000058 */  lwc1      $f0, 0x58($s0)
/* A2CC 8002EECC C602007C */  lwc1      $f2, 0x7C($s0)
/* A2D0 8002EED0 46020000 */  add.s     $f0, $f0, $f2
/* A2D4 8002EED4 C602004C */  lwc1      $f2, 0x4C($s0)
/* A2D8 8002EED8 46020401 */  sub.s     $f16, $f0, $f2
/* A2DC 8002EEDC 3C014180 */  lui       $at, (0x41800000 >> 16)
/* A2E0 8002EEE0 44811000 */  mtc1      $at, $f2
/* A2E4 8002EEE4 46002005 */  abs.s     $f0, $f4
/* A2E8 8002EEE8 4600103C */  c.lt.s    $f2, $f0
/* A2EC 8002EEEC 00000000 */  nop
/* A2F0 8002EEF0 4502000C */  bc1fl     .L8002EF24
/* A2F4 8002EEF4 46008005 */   abs.s    $f0, $f16
/* A2F8 8002EEF8 44800000 */  mtc1      $zero, $f0
/* A2FC 8002EEFC 00000000 */  nop
/* A300 8002EF00 4600203C */  c.lt.s    $f4, $f0
/* A304 8002EF04 00000000 */  nop
/* A308 8002EF08 45000005 */  bc1f      .L8002EF20
/* A30C 8002EF0C 46001106 */   mov.s    $f4, $f2
/* A310 8002EF10 3C01C180 */  lui       $at, (0xC1800000 >> 16)
/* A314 8002EF14 44812000 */  mtc1      $at, $f4
/* A318 8002EF18 3C014180 */  lui       $at, (0x41800000 >> 16)
/* A31C 8002EF1C 44811000 */  mtc1      $at, $f2
.L8002EF20:
/* A320 8002EF20 46008005 */  abs.s     $f0, $f16
.L8002EF24:
/* A324 8002EF24 4600103C */  c.lt.s    $f2, $f0
/* A328 8002EF28 00000000 */  nop
/* A32C 8002EF2C 45000009 */  bc1f      .L8002EF54
/* A330 8002EF30 00000000 */   nop
/* A334 8002EF34 44800000 */  mtc1      $zero, $f0
/* A338 8002EF38 00000000 */  nop
/* A33C 8002EF3C 4600803C */  c.lt.s    $f16, $f0
/* A340 8002EF40 00000000 */  nop
/* A344 8002EF44 45000003 */  bc1f      .L8002EF54
/* A348 8002EF48 46001406 */   mov.s    $f16, $f2
/* A34C 8002EF4C 3C01C180 */  lui       $at, (0xC1800000 >> 16)
/* A350 8002EF50 44818000 */  mtc1      $at, $f16
.L8002EF54:
/* A354 8002EF54 3C014180 */  lui       $at, (0x41800000 >> 16)
/* A358 8002EF58 44811000 */  mtc1      $at, $f2
/* A35C 8002EF5C 46004005 */  abs.s     $f0, $f8
/* A360 8002EF60 4600103C */  c.lt.s    $f2, $f0
/* A364 8002EF64 00000000 */  nop
/* A368 8002EF68 45000009 */  bc1f      .L8002EF90
/* A36C 8002EF6C 00000000 */   nop
/* A370 8002EF70 44800000 */  mtc1      $zero, $f0
/* A374 8002EF74 00000000 */  nop
/* A378 8002EF78 4600403C */  c.lt.s    $f8, $f0
/* A37C 8002EF7C 00000000 */  nop
/* A380 8002EF80 45000003 */  bc1f      .L8002EF90
/* A384 8002EF84 46001206 */   mov.s    $f8, $f2
/* A388 8002EF88 3C01C180 */  lui       $at, (0xC1800000 >> 16)
/* A38C 8002EF8C 44814000 */  mtc1      $at, $f8
.L8002EF90:
/* A390 8002EF90 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* A394 8002EF94 4481A000 */  mtc1      $at, $f20
/* A398 8002EF98 00000000 */  nop
/* A39C 8002EF9C 46142082 */  mul.s     $f2, $f4, $f20
/* A3A0 8002EFA0 00000000 */  nop
/* A3A4 8002EFA4 46148182 */  mul.s     $f6, $f16, $f20
/* A3A8 8002EFA8 00000000 */  nop
/* A3AC 8002EFAC 46144202 */  mul.s     $f8, $f8, $f20
/* A3B0 8002EFB0 00000000 */  nop
/* A3B4 8002EFB4 C6000074 */  lwc1      $f0, 0x74($s0)
/* A3B8 8002EFB8 3C0140C9 */  lui       $at, (0x40C90FD0 >> 16)
/* A3BC 8002EFBC 34210FD0 */  ori       $at, $at, (0x40C90FD0 & 0xFFFF)
/* A3C0 8002EFC0 4481B000 */  mtc1      $at, $f22
/* A3C4 8002EFC4 00000000 */  nop
/* A3C8 8002EFC8 46160002 */  mul.s     $f0, $f0, $f22
/* A3CC 8002EFCC 00000000 */  nop
/* A3D0 8002EFD0 4480C000 */  mtc1      $zero, $f24
/* A3D4 8002EFD4 C6040048 */  lwc1      $f4, 0x48($s0)
/* A3D8 8002EFD8 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
/* A3DC 8002EFDC 44819000 */  mtc1      $at, $f18
/* A3E0 8002EFE0 46022100 */  add.s     $f4, $f4, $f2
/* A3E4 8002EFE4 C602004C */  lwc1      $f2, 0x4C($s0)
/* A3E8 8002EFE8 46120683 */  div.s     $f26, $f0, $f18
/* A3EC 8002EFEC 46061080 */  add.s     $f2, $f2, $f6
/* A3F0 8002EFF0 C6000050 */  lwc1      $f0, 0x50($s0)
/* A3F4 8002EFF4 4600D306 */  mov.s     $f12, $f26
/* A3F8 8002EFF8 46080000 */  add.s     $f0, $f0, $f8
/* A3FC 8002EFFC E6040048 */  swc1      $f4, 0x48($s0)
/* A400 8002F000 E602004C */  swc1      $f2, 0x4C($s0)
/* A404 8002F004 0C00A85B */  jal       sin_rad
/* A408 8002F008 E6000050 */   swc1     $f0, 0x50($s0)
/* A40C 8002F00C 46000786 */  mov.s     $f30, $f0
/* A410 8002F010 0C00A874 */  jal       cos_rad
/* A414 8002F014 4600D306 */   mov.s    $f12, $f26
/* A418 8002F018 46000306 */  mov.s     $f12, $f0
/* A41C 8002F01C 46186202 */  mul.s     $f8, $f12, $f24
/* A420 8002F020 00000000 */  nop
/* A424 8002F024 4600C087 */  neg.s     $f2, $f24
/* A428 8002F028 4602F082 */  mul.s     $f2, $f30, $f2
/* A42C 8002F02C 00000000 */  nop
/* A430 8002F030 C61C0078 */  lwc1      $f28, 0x78($s0)
/* A434 8002F034 461EE102 */  mul.s     $f4, $f28, $f30
/* A438 8002F038 00000000 */  nop
/* A43C 8002F03C 460CE182 */  mul.s     $f6, $f28, $f12
/* A440 8002F040 00000000 */  nop
/* A444 8002F044 C6000070 */  lwc1      $f0, 0x70($s0)
/* A448 8002F048 46160002 */  mul.s     $f0, $f0, $f22
/* A44C 8002F04C 00000000 */  nop
/* A450 8002F050 4600C286 */  mov.s     $f10, $f24
/* A454 8002F054 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
/* A458 8002F058 44819000 */  mtc1      $at, $f18
/* A45C 8002F05C 46005586 */  mov.s     $f22, $f10
/* A460 8002F060 46044600 */  add.s     $f24, $f8, $f4
/* A464 8002F064 46120683 */  div.s     $f26, $f0, $f18
/* A468 8002F068 4600D306 */  mov.s     $f12, $f26
/* A46C 8002F06C 0C00A85B */  jal       sin_rad
/* A470 8002F070 46061700 */   add.s    $f28, $f2, $f6
/* A474 8002F074 46000786 */  mov.s     $f30, $f0
/* A478 8002F078 0C00A874 */  jal       cos_rad
/* A47C 8002F07C 4600D306 */   mov.s    $f12, $f26
/* A480 8002F080 46000306 */  mov.s     $f12, $f0
/* A484 8002F084 461EE002 */  mul.s     $f0, $f28, $f30
/* A488 8002F088 00000000 */  nop
/* A48C 8002F08C C602004C */  lwc1      $f2, 0x4C($s0)
/* A490 8002F090 46181400 */  add.s     $f16, $f2, $f24
/* A494 8002F094 C6020040 */  lwc1      $f2, 0x40($s0)
/* A498 8002F098 46028081 */  sub.s     $f2, $f16, $f2
/* A49C 8002F09C 46141402 */  mul.s     $f16, $f2, $f20
/* A4A0 8002F0A0 00000000 */  nop
/* A4A4 8002F0A4 46166082 */  mul.s     $f2, $f12, $f22
/* A4A8 8002F0A8 00000000 */  nop
/* A4AC 8002F0AC 46001281 */  sub.s     $f10, $f2, $f0
/* A4B0 8002F0B0 4616F082 */  mul.s     $f2, $f30, $f22
/* A4B4 8002F0B4 00000000 */  nop
/* A4B8 8002F0B8 C6000048 */  lwc1      $f0, 0x48($s0)
/* A4BC 8002F0BC 460A0100 */  add.s     $f4, $f0, $f10
/* A4C0 8002F0C0 C600003C */  lwc1      $f0, 0x3C($s0)
/* A4C4 8002F0C4 46002001 */  sub.s     $f0, $f4, $f0
/* A4C8 8002F0C8 46140102 */  mul.s     $f4, $f0, $f20
/* A4CC 8002F0CC 00000000 */  nop
/* A4D0 8002F0D0 460CE002 */  mul.s     $f0, $f28, $f12
/* A4D4 8002F0D4 00000000 */  nop
/* A4D8 8002F0D8 46001080 */  add.s     $f2, $f2, $f0
/* A4DC 8002F0DC C6000050 */  lwc1      $f0, 0x50($s0)
/* A4E0 8002F0E0 46020200 */  add.s     $f8, $f0, $f2
/* A4E4 8002F0E4 C6000044 */  lwc1      $f0, 0x44($s0)
/* A4E8 8002F0E8 46004001 */  sub.s     $f0, $f8, $f0
/* A4EC 8002F0EC 46140202 */  mul.s     $f8, $f0, $f20
/* A4F0 8002F0F0 00000000 */  nop
/* A4F4 8002F0F4 3C014180 */  lui       $at, (0x41800000 >> 16)
/* A4F8 8002F0F8 44811000 */  mtc1      $at, $f2
/* A4FC 8002F0FC 46002005 */  abs.s     $f0, $f4
/* A500 8002F100 4600103C */  c.lt.s    $f2, $f0
/* A504 8002F104 00000000 */  nop
/* A508 8002F108 4502000A */  bc1fl     .L8002F134
/* A50C 8002F10C 46008005 */   abs.s    $f0, $f16
/* A510 8002F110 4616203C */  c.lt.s    $f4, $f22
/* A514 8002F114 00000000 */  nop
/* A518 8002F118 45000005 */  bc1f      .L8002F130
/* A51C 8002F11C 46001106 */   mov.s    $f4, $f2
/* A520 8002F120 3C01C180 */  lui       $at, (0xC1800000 >> 16)
/* A524 8002F124 44812000 */  mtc1      $at, $f4
/* A528 8002F128 3C014180 */  lui       $at, (0x41800000 >> 16)
/* A52C 8002F12C 44811000 */  mtc1      $at, $f2
.L8002F130:
/* A530 8002F130 46008005 */  abs.s     $f0, $f16
.L8002F134:
/* A534 8002F134 4600103C */  c.lt.s    $f2, $f0
/* A538 8002F138 00000000 */  nop
/* A53C 8002F13C 45000009 */  bc1f      .L8002F164
/* A540 8002F140 00000000 */   nop
/* A544 8002F144 44800000 */  mtc1      $zero, $f0
/* A548 8002F148 00000000 */  nop
/* A54C 8002F14C 4600803C */  c.lt.s    $f16, $f0
/* A550 8002F150 00000000 */  nop
/* A554 8002F154 45000003 */  bc1f      .L8002F164
/* A558 8002F158 46001406 */   mov.s    $f16, $f2
/* A55C 8002F15C 3C01C180 */  lui       $at, (0xC1800000 >> 16)
/* A560 8002F160 44818000 */  mtc1      $at, $f16
.L8002F164:
/* A564 8002F164 3C014180 */  lui       $at, (0x41800000 >> 16)
/* A568 8002F168 44811000 */  mtc1      $at, $f2
/* A56C 8002F16C 46004005 */  abs.s     $f0, $f8
/* A570 8002F170 4600103C */  c.lt.s    $f2, $f0
/* A574 8002F174 00000000 */  nop
/* A578 8002F178 45000009 */  bc1f      .L8002F1A0
/* A57C 8002F17C 00000000 */   nop
/* A580 8002F180 44800000 */  mtc1      $zero, $f0
/* A584 8002F184 00000000 */  nop
/* A588 8002F188 4600403C */  c.lt.s    $f8, $f0
/* A58C 8002F18C 00000000 */  nop
/* A590 8002F190 45000003 */  bc1f      .L8002F1A0
/* A594 8002F194 46001206 */   mov.s    $f8, $f2
/* A598 8002F198 3C01C180 */  lui       $at, (0xC1800000 >> 16)
/* A59C 8002F19C 44814000 */  mtc1      $at, $f8
.L8002F1A0:
/* A5A0 8002F1A0 C600003C */  lwc1      $f0, 0x3C($s0)
/* A5A4 8002F1A4 46040000 */  add.s     $f0, $f0, $f4
/* A5A8 8002F1A8 C60E0044 */  lwc1      $f14, 0x44($s0)
/* A5AC 8002F1AC 8E060048 */  lw        $a2, 0x48($s0)
/* A5B0 8002F1B0 46087380 */  add.s     $f14, $f14, $f8
/* A5B4 8002F1B4 C6020040 */  lwc1      $f2, 0x40($s0)
/* A5B8 8002F1B8 8E070050 */  lw        $a3, 0x50($s0)
/* A5BC 8002F1BC 46101080 */  add.s     $f2, $f2, $f16
/* A5C0 8002F1C0 E600003C */  swc1      $f0, 0x3C($s0)
/* A5C4 8002F1C4 46000306 */  mov.s     $f12, $f0
/* A5C8 8002F1C8 E6020040 */  swc1      $f2, 0x40($s0)
/* A5CC 8002F1CC 0C00A720 */  jal       atan2
/* A5D0 8002F1D0 E60E0044 */   swc1     $f14, 0x44($s0)
/* A5D4 8002F1D4 C6040048 */  lwc1      $f4, 0x48($s0)
/* A5D8 8002F1D8 4480A000 */  mtc1      $zero, $f20
/* A5DC 8002F1DC C602003C */  lwc1      $f2, 0x3C($s0)
/* A5E0 8002F1E0 E600006C */  swc1      $f0, 0x6C($s0)
/* A5E4 8002F1E4 46022581 */  sub.s     $f22, $f4, $f2
/* A5E8 8002F1E8 C6040050 */  lwc1      $f4, 0x50($s0)
/* A5EC 8002F1EC C6020044 */  lwc1      $f2, 0x44($s0)
/* A5F0 8002F1F0 4600A306 */  mov.s     $f12, $f20
/* A5F4 8002F1F4 46022701 */  sub.s     $f28, $f4, $f2
/* A5F8 8002F1F8 C604004C */  lwc1      $f4, 0x4C($s0)
/* A5FC 8002F1FC C6020040 */  lwc1      $f2, 0x40($s0)
/* A600 8002F200 4406B000 */  mfc1      $a2, $f22
/* A604 8002F204 46022601 */  sub.s     $f24, $f4, $f2
/* A608 8002F208 4407E000 */  mfc1      $a3, $f28
/* A60C 8002F20C 0C00A720 */  jal       atan2
/* A610 8002F210 4600A386 */   mov.s    $f14, $f20
/* A614 8002F214 4616B102 */  mul.s     $f4, $f22, $f22
/* A618 8002F218 00000000 */  nop
/* A61C 8002F21C 461CE082 */  mul.s     $f2, $f28, $f28
/* A620 8002F220 00000000 */  nop
/* A624 8002F224 46022300 */  add.s     $f12, $f4, $f2
/* A628 8002F228 46000007 */  neg.s     $f0, $f0
/* A62C 8002F22C E6000090 */  swc1      $f0, 0x90($s0)
/* A630 8002F230 46006004 */  sqrt.s    $f0, $f12
/* A634 8002F234 46000032 */  c.eq.s    $f0, $f0
/* A638 8002F238 00000000 */  nop
/* A63C 8002F23C 45030004 */  bc1tl     .L8002F250
/* A640 8002F240 4600A306 */   mov.s    $f12, $f20
/* A644 8002F244 0C0187BC */  jal       sqrtf
/* A648 8002F248 00000000 */   nop
/* A64C 8002F24C 4600A306 */  mov.s     $f12, $f20
.L8002F250:
/* A650 8002F250 46000007 */  neg.s     $f0, $f0
/* A654 8002F254 4406C000 */  mfc1      $a2, $f24
/* A658 8002F258 44070000 */  mfc1      $a3, $f0
/* A65C 8002F25C 0C00A720 */  jal       atan2
/* A660 8002F260 46006386 */   mov.s    $f14, $f12
/* A664 8002F264 E6000094 */  swc1      $f0, 0x94($s0)
/* A668 8002F268 8FBF0014 */  lw        $ra, 0x14($sp)
/* A66C 8002F26C 8FB00010 */  lw        $s0, 0x10($sp)
/* A670 8002F270 D7BE0040 */  ldc1      $f30, 0x40($sp)
/* A674 8002F274 D7BC0038 */  ldc1      $f28, 0x38($sp)
/* A678 8002F278 D7BA0030 */  ldc1      $f26, 0x30($sp)
/* A67C 8002F27C D7B80028 */  ldc1      $f24, 0x28($sp)
/* A680 8002F280 D7B60020 */  ldc1      $f22, 0x20($sp)
/* A684 8002F284 D7B40018 */  ldc1      $f20, 0x18($sp)
/* A688 8002F288 03E00008 */  jr        $ra
/* A68C 8002F28C 27BD0048 */   addiu    $sp, $sp, 0x48

### DECOMPILED C INSTRUCTIONS:

void update_camera_mode_2(Camera *camera) {
    f32 cosBoom;
    f32 sinBoom;
    f32 boomYaw;
    f32 deltaX;
    f32 deltaY;
    f32 deltaZ;
    f32 deltaX2;
    f32 deltaY2;
    f32 deltaZ2;
    f32 deltaX3;
    f32 deltaY3;
    f32 deltaZ3;
    f32 tmp;

    camera->unk_70 = camera->auxBoomLength;
    camera->currentBoomLength = camera->lookAt_dist * D_8009A5EC;
    camera->currentYOffset = camera->auxBoomPitch * D_8009A5EC;
    camera->currentBoomYaw = camera->auxPitch;
    camera->trueRotation.x = camera->unk_70;
    if (camera->needsInit) {
        camera->needsInit = FALSE;
        camera->unk_98 = 0.0f;
        camera->unk_9C = 0.0f;

        camera->lookAt_obj.x = camera->lookAt_obj_target.x;
        camera->lookAt_obj.y = camera->lookAt_obj_target.y + camera->currentYOffset;
        camera->lookAt_obj.z = camera->lookAt_obj_target.z;

        boomYaw = DEG_TO_RAD(camera->currentBoomYaw);
        sinBoom = sin_rad(boomYaw);
        cosBoom = cos_rad(boomYaw);

        deltaX = 0.0f;
        deltaY = 0.0f;
        deltaZ = camera->currentBoomLength;

        deltaX3 = deltaX;
        deltaY3 = -deltaY;
        tmp = -0.0f; //required to match
        deltaZ3 = deltaZ;

        deltaX = deltaX3;
        deltaY = cosBoom * -deltaY3 + deltaZ3 * sinBoom;
        deltaZ = sinBoom * deltaY3 + deltaZ3 * cosBoom;

        boomYaw = DEG_TO_RAD(camera->unk_70);
        sinBoom = sin_rad(boomYaw);
        cosBoom = cos_rad(boomYaw);

        deltaX3 = cosBoom * deltaX - deltaZ * sinBoom;
        deltaY3 = deltaY;
        deltaZ3 = sinBoom * deltaX + deltaZ * cosBoom;

        deltaX2 = camera->lookAt_obj.x + deltaX3;
        deltaY2 = camera->lookAt_obj.y + deltaY3;
        deltaZ2 = camera->lookAt_obj.z + deltaZ3;

        camera->lookAt_eye.x = deltaX2;
        camera->lookAt_eye.y = deltaY2;
        camera->lookAt_eye.z = deltaZ2;
    }

    deltaX2 = camera->lookAt_obj_target.x - camera->lookAt_obj.x;
    deltaY2 = (camera->lookAt_obj_target.y + camera->currentYOffset) - camera->lookAt_obj.y;
    deltaZ2 = camera->lookAt_obj_target.z - camera->lookAt_obj.z;

    if (fabsf(deltaX2) > 16.0f) {
        if (deltaX2 < 0.0f) {
            deltaX2 = -16.0f;
        } else {
            deltaX2 = 16.0f;
        }
    }
    if (fabsf(deltaY2) > 16.0f) {
        if (deltaY2 < 0.0f) {
            deltaY2 = -16.0f;
        } else {
            deltaY2 = 16.0f;
        }
    }
    if (fabsf(deltaZ2) > 16.0f) {
        if (deltaZ2 < 0.0f) {
            deltaZ2 = -16.0f;
        } else {
            deltaZ2 = 16.0f;
        }
    }

    camera->lookAt_obj.x += deltaX2 * 0.5f;
    camera->lookAt_obj.y += deltaY2 * 0.5f;
    camera->lookAt_obj.z += deltaZ2 * 0.5f;

    boomYaw = DEG_TO_RAD(camera->currentBoomYaw);
    sinBoom = sin_rad(boomYaw);
    cosBoom = cos_rad(boomYaw);

    deltaX = 0.0f;
    deltaY = 0.0f;
    deltaZ = camera->currentBoomLength;

    deltaX3 = deltaX;
    deltaY3 = -deltaY;
    deltaZ3 = deltaZ;

    deltaX = deltaX3;
    deltaY = cosBoom * -deltaY3 + deltaZ3 * sinBoom;
    deltaZ = sinBoom * deltaY3 + deltaZ3 * cosBoom;

    boomYaw = DEG_TO_RAD(camera->unk_70);
    sinBoom = sin_rad(boomYaw);
    cosBoom = cos_rad(boomYaw);

    deltaX3 = cosBoom * deltaX - deltaZ * sinBoom;
    deltaY3 = deltaY;
    deltaZ3 = sinBoom * deltaX + deltaZ * cosBoom;

    deltaX2 = camera->lookAt_obj.x + deltaX3;
    deltaY2 = camera->lookAt_obj.y + deltaY3;
    deltaZ2 = camera->lookAt_obj.z + deltaZ3;

    deltaX2 = (deltaX2 - camera->lookAt_eye.x) * 0.5f;
    deltaY2 = (deltaY2 - camera->lookAt_eye.y) * 0.5f;
    deltaZ2 = (deltaZ2 - camera->lookAt_eye.z) * 0.5f;

    tmp = 0.0f; //required to match

    if (fabsf(deltaX2) > 16.0f) {
        if (deltaX2 < 0.0f) {
            deltaX2 = -16.0f;
        } else {
            deltaX2 = 16.0f;
        }
    }
    if (fabsf(deltaY2) > 16.0f) {
        if (deltaY2 < 0.0f) {
            deltaY2 = -16.0f;
        } else {
            deltaY2 = 16.0f;
        }
    }
    if (fabsf(deltaZ2) > 16.0f) {
        if (deltaZ2 < 0.0f) {
            deltaZ2 = -16.0f;
        } else {
            deltaZ2 = 16.0f;
        }
    }

    camera->lookAt_eye.x += deltaX2;
    camera->lookAt_eye.y += deltaY2;
    camera->lookAt_eye.z += deltaZ2;

    camera->currentYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z);

    deltaX = camera->lookAt_obj.x - camera->lookAt_eye.x;
    deltaY = camera->lookAt_obj.y - camera->lookAt_eye.y;
    deltaZ = camera->lookAt_obj.z - camera->lookAt_eye.z;

    camera->currentBlendedYawNegated = -atan2(0.0f, 0.0f, deltaX, deltaZ);
    camera->currentPitch = atan2(0.0f, 0.0f, deltaY, -sqrtf(SQ(deltaX) + SQ(deltaZ)));
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel D_8024A7D8_DD74A8
/* 13DB18 8024A7D8 3C038027 */  lui       $v1, %hi(gPauseItemsCurrentPage)
/* 13DB1C 8024A7DC 8C6304C8 */  lw        $v1, %lo(gPauseItemsCurrentPage)($v1)
jtbl_8024A7E0:
/* 13DB20 8024A7E0 27BDFFE8 */  addiu     $sp, $sp, -0x18
/* 13DB24 8024A7E4 AFBF0014 */  sw        $ra, 0x14($sp)
/* 13DB28 8024A7E8 AFB00010 */  sw        $s0, 0x10($sp)
/* 13DB2C 8024A7EC 00031040 */  sll       $v0, $v1, 1
/* 13DB30 8024A7F0 00431021 */  addu      $v0, $v0, $v1
/* 13DB34 8024A7F4 00021080 */  sll       $v0, $v0, 2
/* 13DB38 8024A7F8 3C038027 */  lui       $v1, %hi(D_802704D2)
/* 13DB3C 8024A7FC 00621821 */  addu      $v1, $v1, $v0
/* 13DB40 8024A800 906304D2 */  lbu       $v1, %lo(D_802704D2)($v1)
/* 13DB44 8024A804 3C028027 */  lui       $v0, %hi(gPausePressedButtons)
/* 13DB48 8024A808 8C4200C4 */  lw        $v0, %lo(gPausePressedButtons)($v0)
/* 13DB4C 8024A80C 3C098027 */  lui       $t1, %hi(gPauseItemsSelectedIndex)
/* 13DB50 8024A810 8D2905C0 */  lw        $t1, %lo(gPauseItemsSelectedIndex)($t1)
/* 13DB54 8024A814 30428000 */  andi      $v0, $v0, 0x8000
/* 13DB58 8024A818 14600002 */  bnez      $v1, .L8024A824
/* 13DB5C 8024A81C 0123001A */   div      $zero, $t1, $v1
/* 13DB60 8024A820 0007000D */  break     7
.L8024A824:
/* 13DB64 8024A824 2401FFFF */  addiu     $at, $zero, -0x1
/* 13DB68 8024A828 14610004 */  bne       $v1, $at, .L8024A83C
/* 13DB6C 8024A82C 3C018000 */   lui      $at, (0x80000000 >> 16)
/* 13DB70 8024A830 15210002 */  bne       $t1, $at, .L8024A83C
/* 13DB74 8024A834 00000000 */   nop
/* 13DB78 8024A838 0006000D */  break     6
.L8024A83C:
/* 13DB7C 8024A83C 00002812 */  mflo      $a1
/* 13DB80 8024A840 00004010 */  mfhi      $t0
/* 13DB84 8024A844 10400015 */  beqz      $v0, .L8024A89C
/* 13DB88 8024A848 00000000 */   nop
/* 13DB8C 8024A84C 3C048027 */  lui       $a0, %hi(gPauseItemsLevel)
/* 13DB90 8024A850 248405E0 */  addiu     $a0, $a0, %lo(gPauseItemsLevel)
/* 13DB94 8024A854 8C820000 */  lw        $v0, 0x0($a0)
/* 13DB98 8024A858 14400010 */  bnez      $v0, .L8024A89C
/* 13DB9C 8024A85C 00091040 */   sll      $v0, $t1, 1
/* 13DBA0 8024A860 3C038027 */  lui       $v1, %hi(gPauseItemsItemIDs)
/* 13DBA4 8024A864 00621821 */  addu      $v1, $v1, $v0
/* 13DBA8 8024A868 84630400 */  lh        $v1, %lo(gPauseItemsItemIDs)($v1)
/* 13DBAC 8024A86C 24027FFE */  addiu     $v0, $zero, 0x7FFE
/* 13DBB0 8024A870 14620005 */  bne       $v1, $v0, .L8024A888
/* 13DBB4 8024A874 24020001 */   addiu    $v0, $zero, 0x1
/* 13DBB8 8024A878 0C05272D */  jal       sfx_play_sound
/* 13DBBC 8024A87C 2404021D */   addiu    $a0, $zero, 0x21D
/* 13DBC0 8024A880 08092B11 */  j         .L8024AC44
/* 13DBC4 8024A884 00000000 */   nop
.L8024A888:
/* 13DBC8 8024A888 AC820000 */  sw        $v0, 0x0($a0)
D_8024A88C:
/* 13DBCC 8024A88C 0C05272D */  jal       sfx_play_sound
/* 13DBD0 8024A890 240400C9 */   addiu    $a0, $zero, 0xC9
/* 13DBD4 8024A894 08092B11 */  j         .L8024AC44
/* 13DBD8 8024A898 00000000 */   nop
.L8024A89C:
/* 13DBDC 8024A89C 3C028027 */  lui       $v0, %hi(gPauseItemsNumItems)
/* 13DBE0 8024A8A0 844205CC */  lh        $v0, %lo(gPauseItemsNumItems)($v0)
/* 13DBE4 8024A8A4 104000B1 */  beqz      $v0, .L8024AB6C
/* 13DBE8 8024A8A8 00000000 */   nop
/* 13DBEC 8024A8AC 3C028027 */  lui       $v0, %hi(gPauseItemsLevel)
D_8024A8B0:
/* 13DBF0 8024A8B0 8C4205E0 */  lw        $v0, %lo(gPauseItemsLevel)($v0)
/* 13DBF4 8024A8B4 14400015 */  bnez      $v0, .L8024A90C
/* 13DBF8 8024A8B8 3C020001 */   lui      $v0, (0x12000 >> 16)
/* 13DBFC 8024A8BC 3C108027 */  lui       $s0, %hi(gPauseItemsCurrentTab)
/* 13DC00 8024A8C0 261005E4 */  addiu     $s0, $s0, %lo(gPauseItemsCurrentTab)
/* 13DC04 8024A8C4 3C028027 */  lui       $v0, %hi(gPauseHeldButtons)
/* 13DC08 8024A8C8 8C4200C0 */  lw        $v0, %lo(gPauseHeldButtons)($v0)
/* 13DC0C 8024A8CC 3C030003 */  lui       $v1, (0x30000 >> 16)
/* 13DC10 8024A8D0 00431024 */  and       $v0, $v0, $v1
/* 13DC14 8024A8D4 8E030000 */  lw        $v1, 0x0($s0)
/* 13DC18 8024A8D8 10400002 */  beqz      $v0, .L8024A8E4
D_8024A8DC:
/* 13DC1C 8024A8DC 38620001 */   xori     $v0, $v1, 0x1
/* 13DC20 8024A8E0 AE020000 */  sw        $v0, 0x0($s0)
.L8024A8E4:
/* 13DC24 8024A8E4 8E020000 */  lw        $v0, 0x0($s0)
/* 13DC28 8024A8E8 106200A0 */  beq       $v1, $v0, .L8024AB6C
/* 13DC2C 8024A8EC 00000000 */   nop
/* 13DC30 8024A8F0 0C05272D */  jal       sfx_play_sound
/* 13DC34 8024A8F4 240400C8 */   addiu    $a0, $zero, 0xC8
/* 13DC38 8024A8F8 8E040000 */  lw        $a0, 0x0($s0)
/* 13DC3C 8024A8FC 0C092937 */  jal       func_8024A4DC
/* 13DC40 8024A900 00000000 */   nop
/* 13DC44 8024A904 08092ADB */  j         .L8024AB6C
D_8024A908:
/* 13DC48 8024A908 00000000 */   nop
.L8024A90C:
/* 13DC4C 8024A90C 3C038027 */  lui       $v1, %hi(gPauseHeldButtons)
/* 13DC50 8024A910 8C6300C0 */  lw        $v1, %lo(gPauseHeldButtons)($v1)
/* 13DC54 8024A914 34422000 */  ori       $v0, $v0, (0x12000 & 0xFFFF)
/* 13DC58 8024A918 00621024 */  and       $v0, $v1, $v0
/* 13DC5C 8024A91C 10400022 */  beqz      $v0, .L8024A9A8
/* 13DC60 8024A920 3C020001 */   lui      $v0, (0x10000 >> 16)
/* 13DC64 8024A924 00621024 */  and       $v0, $v1, $v0
/* 13DC68 8024A928 10400011 */  beqz      $v0, D_8024A970_DD7640
/* 13DC6C 8024A92C 24A5FFFF */   addiu    $a1, $a1, -0x1
/* 13DC70 8024A930 04A20001 */  bltzl     $a1, .L8024A938
/* 13DC74 8024A934 0000282D */   daddu    $a1, $zero, $zero
.L8024A938:
/* 13DC78 8024A938 3C048027 */  lui       $a0, %hi(gPauseItemsCurrentPage)
/* 13DC7C 8024A93C 248404C8 */  addiu     $a0, $a0, %lo(gPauseItemsCurrentPage)
/* 13DC80 8024A940 8C830000 */  lw        $v1, 0x0($a0)
/* 13DC84 8024A944 00031040 */  sll       $v0, $v1, 1
/* 13DC88 8024A948 00431021 */  addu      $v0, $v0, $v1
/* 13DC8C 8024A94C 00021080 */  sll       $v0, $v0, 2
/* 13DC90 8024A950 3C018027 */  lui       $at, %hi(D_802704D1)
/* 13DC94 8024A954 00220821 */  addu      $at, $at, $v0
.L8024A958:
/* 13DC98 8024A958 902204D1 */  lbu       $v0, %lo(D_802704D1)($at)
/* 13DC9C 8024A95C 00A2102A */  slt       $v0, $a1, $v0
.L8024A960:
/* 13DCA0 8024A960 10400011 */  beqz      $v0, .L8024A9A8
/* 13DCA4 8024A964 2462FFFF */   addiu    $v0, $v1, -0x1
/* 13DCA8 8024A968 08092A6A */  j         .L8024A9A8
D_8024A96C:
/* 13DCAC 8024A96C AC820000 */   sw       $v0, 0x0($a0)
D_8024A970_DD7640:
/* 13DCB0 8024A970 3C038027 */  lui       $v1, %hi(gPauseItemsCurrentPage)
/* 13DCB4 8024A974 246304C8 */  addiu     $v1, $v1, %lo(gPauseItemsCurrentPage)
D_8024A978_DD7648:
/* 13DCB8 8024A978 8C620000 */  lw        $v0, 0x0($v1)
/* 13DCBC 8024A97C 2442FFFF */  addiu     $v0, $v0, -0x1
jtbl_8024A980:
/* 13DCC0 8024A980 04410002 */  bgez      $v0, .L8024A98C
/* 13DCC4 8024A984 AC620000 */   sw       $v0, 0x0($v1)
/* 13DCC8 8024A988 AC600000 */  sw        $zero, 0x0($v1)
.L8024A98C:
/* 13DCCC 8024A98C 8C630000 */  lw        $v1, 0x0($v1)
glabel func_8024A990
/* 13DCD0 8024A990 00031040 */  sll       $v0, $v1, 1
/* 13DCD4 8024A994 00431021 */  addu      $v0, $v0, $v1
/* 13DCD8 8024A998 00021080 */  sll       $v0, $v0, 2
/* 13DCDC 8024A99C 3C058027 */  lui       $a1, %hi(D_802704D1)
/* 13DCE0 8024A9A0 00A22821 */  addu      $a1, $a1, $v0
/* 13DCE4 8024A9A4 90A504D1 */  lbu       $a1, %lo(D_802704D1)($a1)
.L8024A9A8:
/* 13DCE8 8024A9A8 3C020002 */  lui       $v0, (0x20010 >> 16)
/* 13DCEC 8024A9AC 3C038027 */  lui       $v1, %hi(gPauseHeldButtons)
/* 13DCF0 8024A9B0 8C6300C0 */  lw        $v1, %lo(gPauseHeldButtons)($v1)
D_8024A9B4:
/* 13DCF4 8024A9B4 34420010 */  ori       $v0, $v0, (0x20010 & 0xFFFF)
/* 13DCF8 8024A9B8 00621024 */  and       $v0, $v1, $v0
/* 13DCFC 8024A9BC 10400030 */  beqz      $v0, .L8024AA80
/* 13DD00 8024A9C0 3C020002 */   lui      $v0, (0x20000 >> 16)
/* 13DD04 8024A9C4 00621024 */  and       $v0, $v1, $v0
D_8024A9C8:
/* 13DD08 8024A9C8 1040001C */  beqz      $v0, .L8024AA3C
D_8024A9CC:
/* 13DD0C 8024A9CC 00000000 */   nop
/* 13DD10 8024A9D0 3C068027 */  lui       $a2, %hi(gPauseItemsCurrentPage)
/* 13DD14 8024A9D4 24C604C8 */  addiu     $a2, $a2, %lo(gPauseItemsCurrentPage)
/* 13DD18 8024A9D8 8CC40000 */  lw        $a0, 0x0($a2)
/* 13DD1C 8024A9DC 3C078027 */  lui       $a3, %hi(gPauseItemsPages)
/* 13DD20 8024A9E0 24E704D0 */  addiu     $a3, $a3, %lo(gPauseItemsPages)
/* 13DD24 8024A9E4 00041040 */  sll       $v0, $a0, 1
/* 13DD28 8024A9E8 00441021 */  addu      $v0, $v0, $a0
/* 13DD2C 8024A9EC 00021080 */  sll       $v0, $v0, 2
/* 13DD30 8024A9F0 00471021 */  addu      $v0, $v0, $a3
/* 13DD34 8024A9F4 90430001 */  lbu       $v1, 0x1($v0)
.L8024A9F8:
/* 13DD38 8024A9F8 90420003 */  lbu       $v0, 0x3($v0)
/* 13DD3C 8024A9FC 24A50001 */  addiu     $a1, $a1, 0x1
/* 13DD40 8024AA00 00621821 */  addu      $v1, $v1, $v0
/* 13DD44 8024AA04 00A3182A */  slt       $v1, $a1, $v1
.L8024AA08:
/* 13DD48 8024AA08 1460001D */  bnez      $v1, .L8024AA80
/* 13DD4C 8024AA0C 24820001 */   addiu    $v0, $a0, 0x1
/* 13DD50 8024AA10 00021840 */  sll       $v1, $v0, 1
.L8024AA14:
/* 13DD54 8024AA14 00621821 */  addu      $v1, $v1, $v0
/* 13DD58 8024AA18 00031880 */  sll       $v1, $v1, 2
/* 13DD5C 8024AA1C 00671821 */  addu      $v1, $v1, $a3
D_8024AA20:
/* 13DD60 8024AA20 ACC20000 */  sw        $v0, 0x0($a2)
.L8024AA24:
/* 13DD64 8024AA24 90620000 */  lbu       $v0, 0x0($v1)
D_8024AA28:
/* 13DD68 8024AA28 14400015 */  bnez      $v0, .L8024AA80
/* 13DD6C 8024AA2C 00000000 */   nop
/* 13DD70 8024AA30 ACC40000 */  sw        $a0, 0x0($a2)
/* 13DD74 8024AA34 08092AA0 */  j         .L8024AA80
/* 13DD78 8024AA38 24A5FFFF */   addiu    $a1, $a1, -0x1
.L8024AA3C:
/* 13DD7C 8024AA3C 3C068027 */  lui       $a2, %hi(gPauseItemsCurrentPage)
/* 13DD80 8024AA40 24C604C8 */  addiu     $a2, $a2, %lo(gPauseItemsCurrentPage)
/* 13DD84 8024AA44 8CC70000 */  lw        $a3, 0x0($a2)
/* 13DD88 8024AA48 3C048027 */  lui       $a0, %hi(gPauseItemsPages)
/* 13DD8C 8024AA4C 248404D0 */  addiu     $a0, $a0, %lo(gPauseItemsPages)
/* 13DD90 8024AA50 24E30001 */  addiu     $v1, $a3, 0x1
/* 13DD94 8024AA54 00031040 */  sll       $v0, $v1, 1
/* 13DD98 8024AA58 00431021 */  addu      $v0, $v0, $v1
/* 13DD9C 8024AA5C 00021080 */  sll       $v0, $v0, 2
/* 13DDA0 8024AA60 ACC30000 */  sw        $v1, 0x0($a2)
/* 13DDA4 8024AA64 00441821 */  addu      $v1, $v0, $a0
/* 13DDA8 8024AA68 90620000 */  lbu       $v0, 0x0($v1)
/* 13DDAC 8024AA6C 14400003 */  bnez      $v0, .L8024AA7C
/* 13DDB0 8024AA70 00000000 */   nop
/* 13DDB4 8024AA74 08092AA0 */  j         .L8024AA80
/* 13DDB8 8024AA78 ACC70000 */   sw       $a3, 0x0($a2)
.L8024AA7C:
/* 13DDBC 8024AA7C 90650001 */  lbu       $a1, 0x1($v1)
.L8024AA80:
/* 13DDC0 8024AA80 3C038027 */  lui       $v1, %hi(gPauseItemsCurrentPage)
/* 13DDC4 8024AA84 8C6304C8 */  lw        $v1, %lo(gPauseItemsCurrentPage)($v1)
.L8024AA88:
/* 13DDC8 8024AA88 00031040 */  sll       $v0, $v1, 1
/* 13DDCC 8024AA8C 00431021 */  addu      $v0, $v0, $v1
/* 13DDD0 8024AA90 00021080 */  sll       $v0, $v0, 2
.L8024AA94:
/* 13DDD4 8024AA94 3C048027 */  lui       $a0, %hi(D_802704D2)
/* 13DDD8 8024AA98 00822021 */  addu      $a0, $a0, $v0
/* 13DDDC 8024AA9C 908404D2 */  lbu       $a0, %lo(D_802704D2)($a0)
.L8024AAA0:
/* 13DDE0 8024AAA0 00A40018 */  mult      $a1, $a0
/* 13DDE4 8024AAA4 00005012 */  mflo      $t2
/* 13DDE8 8024AAA8 000A1040 */  sll       $v0, $t2, 1
/* 13DDEC 8024AAAC 3C038027 */  lui       $v1, %hi(gPauseItemsItemIDs)
D_8024AAB0:
/* 13DDF0 8024AAB0 00621821 */  addu      $v1, $v1, $v0
D_8024AAB4:
/* 13DDF4 8024AAB4 84630400 */  lh        $v1, %lo(gPauseItemsItemIDs)($v1)
D_8024AAB8:
/* 13DDF8 8024AAB8 24027FFE */  addiu     $v0, $zero, 0x7FFE
D_8024AABC:
/* 13DDFC 8024AABC 10620012 */  beq       $v1, $v0, .L8024AB08
D_8024AAC0:
/* 13DE00 8024AAC0 3C020004 */   lui      $v0, (0x40000 >> 16)
/* 13DE04 8024AAC4 3C038027 */  lui       $v1, %hi(gPauseHeldButtons)
/* 13DE08 8024AAC8 8C6300C0 */  lw        $v1, %lo(gPauseHeldButtons)($v1)
/* 13DE0C 8024AACC 00621024 */  and       $v0, $v1, $v0
/* 13DE10 8024AAD0 10400006 */  beqz      $v0, .L8024AAEC
/* 13DE14 8024AAD4 3C020008 */   lui      $v0, (0x80000 >> 16)
/* 13DE18 8024AAD8 2508FFFF */  addiu     $t0, $t0, -0x1
/* 13DE1C 8024AADC 0502000B */  bltzl     $t0, .L8024AB0C
/* 13DE20 8024AAE0 2488FFFF */   addiu    $t0, $a0, -0x1
/* 13DE24 8024AAE4 08092AC3 */  j         .L8024AB0C
/* 13DE28 8024AAE8 00000000 */   nop
.L8024AAEC:
/* 13DE2C 8024AAEC 00621024 */  and       $v0, $v1, $v0
/* 13DE30 8024AAF0 10400006 */  beqz      $v0, .L8024AB0C
/* 13DE34 8024AAF4 00000000 */   nop
/* 13DE38 8024AAF8 25080001 */  addiu     $t0, $t0, 0x1
/* 13DE3C 8024AAFC 0104102A */  slt       $v0, $t0, $a0
/* 13DE40 8024AB00 14400002 */  bnez      $v0, .L8024AB0C
/* 13DE44 8024AB04 00000000 */   nop
.L8024AB08:
/* 13DE48 8024AB08 0000402D */  daddu     $t0, $zero, $zero
.L8024AB0C:
/* 13DE4C 8024AB0C 3C038027 */  lui       $v1, %hi(gPauseItemsCurrentPage)
D_8024AB10_DD77E0:
/* 13DE50 8024AB10 8C6304C8 */  lw        $v1, %lo(gPauseItemsCurrentPage)($v1)
/* 13DE54 8024AB14 00031040 */  sll       $v0, $v1, 1
D_8024AB18_DD77E8:
/* 13DE58 8024AB18 00431021 */  addu      $v0, $v0, $v1
/* 13DE5C 8024AB1C 00021080 */  sll       $v0, $v0, 2
D_8024AB20_DD77F0:
/* 13DE60 8024AB20 3C018027 */  lui       $at, %hi(D_802704D2)
/* 13DE64 8024AB24 00220821 */  addu      $at, $at, $v0
D_8024AB28_DD77F8:
/* 13DE68 8024AB28 902204D2 */  lbu       $v0, %lo(D_802704D2)($at)
/* 13DE6C 8024AB2C 00A20018 */  mult      $a1, $v0
D_8024AB30_DD7800:
/* 13DE70 8024AB30 3C108027 */  lui       $s0, %hi(gPauseItemsSelectedIndex)
/* 13DE74 8024AB34 261005C0 */  addiu     $s0, $s0, %lo(gPauseItemsSelectedIndex)
jtbl_8024AB38:
/* 13DE78 8024AB38 00005012 */  mflo      $t2
D_8024AB3C:
/* 13DE7C 8024AB3C 010A1021 */  addu      $v0, $t0, $t2
/* 13DE80 8024AB40 10490003 */  beq       $v0, $t1, .L8024AB50
/* 13DE84 8024AB44 AE020000 */   sw       $v0, 0x0($s0)
/* 13DE88 8024AB48 0C05272D */  jal       sfx_play_sound
/* 13DE8C 8024AB4C 240400C7 */   addiu    $a0, $zero, 0xC7
.L8024AB50:
/* 13DE90 8024AB50 8E020000 */  lw        $v0, 0x0($s0)
/* 13DE94 8024AB54 00021040 */  sll       $v0, $v0, 1
/* 13DE98 8024AB58 3C018027 */  lui       $at, %hi(gPauseItemsItemIDs)
/* 13DE9C 8024AB5C 00220821 */  addu      $at, $at, $v0
/* 13DEA0 8024AB60 84220400 */  lh        $v0, %lo(gPauseItemsItemIDs)($at)
/* 13DEA4 8024AB64 3C018027 */  lui       $at, %hi(gPauseItemsSelectedItem)
/* 13DEA8 8024AB68 AC2205C8 */  sw        $v0, %lo(gPauseItemsSelectedItem)($at)
.L8024AB6C:
/* 13DEAC 8024AB6C 3C028027 */  lui       $v0, %hi(gPauseItemsLevel)
/* 13DEB0 8024AB70 8C4205E0 */  lw        $v0, %lo(gPauseItemsLevel)($v0)
/* 13DEB4 8024AB74 24030001 */  addiu     $v1, $zero, 0x1
/* 13DEB8 8024AB78 14430014 */  bne       $v0, $v1, .L8024ABCC
/* 13DEBC 8024AB7C 00000000 */   nop
/* 13DEC0 8024AB80 3C038027 */  lui       $v1, %hi(gPauseItemsSelectedItem)
.L8024AB84:
/* 13DEC4 8024AB84 8C6305C8 */  lw        $v1, %lo(gPauseItemsSelectedItem)($v1)
/* 13DEC8 8024AB88 24628002 */  addiu     $v0, $v1, -0x7FFE
/* 13DECC 8024AB8C 2C420002 */  sltiu     $v0, $v0, 0x2
/* 13DED0 8024AB90 1440000A */  bnez      $v0, .L8024ABBC
/* 13DED4 8024AB94 00000000 */   nop
/* 13DED8 8024AB98 10600008 */  beqz      $v1, .L8024ABBC
/* 13DEDC 8024AB9C 00031140 */   sll      $v0, $v1, 5
/* 13DEE0 8024ABA0 3C018008 */  lui       $at, %hi(gItemTable + 0x10)
/* 13DEE4 8024ABA4 00220821 */  addu      $at, $at, $v0
/* 13DEE8 8024ABA8 8C2278F0 */  lw        $v0, %lo(gItemTable + 0x10)($at)
/* 13DEEC 8024ABAC 3C018027 */  lui       $at, %hi(gPauseCurrentDescMsg)
.L8024ABB0:
/* 13DEF0 8024ABB0 AC2200C8 */  sw        $v0, %lo(gPauseCurrentDescMsg)($at)
/* 13DEF4 8024ABB4 08092AFE */  j         .L8024ABF8
/* 13DEF8 8024ABB8 00000000 */   nop
.L8024ABBC:
/* 13DEFC 8024ABBC 3C018027 */  lui       $at, %hi(gPauseCurrentDescMsg)
/* 13DF00 8024ABC0 AC2000C8 */  sw        $zero, %lo(gPauseCurrentDescMsg)($at)
/* 13DF04 8024ABC4 08092AFC */  j         .L8024ABF0
/* 13DF08 8024ABC8 00000000 */   nop
.L8024ABCC:
/* 13DF0C 8024ABCC 3C028027 */  lui       $v0, %hi(gPauseItemsCurrentTab)
/* 13DF10 8024ABD0 8C4205E4 */  lw        $v0, %lo(gPauseItemsCurrentTab)($v0)
/* 13DF14 8024ABD4 14430002 */  bne       $v0, $v1, .L8024ABE0
/* 13DF18 8024ABD8 24040052 */   addiu    $a0, $zero, 0x52
/* 13DF1C 8024ABDC 24040051 */  addiu     $a0, $zero, 0x51
.L8024ABE0:
/* 13DF20 8024ABE0 0C093BA0 */  jal       func_8024EE80
.L8024ABE4:
/* 13DF24 8024ABE4 00000000 */   nop
/* 13DF28 8024ABE8 3C018027 */  lui       $at, %hi(gPauseCurrentDescMsg)
/* 13DF2C 8024ABEC AC2200C8 */  sw        $v0, %lo(gPauseCurrentDescMsg)($at)
.L8024ABF0:
/* 13DF30 8024ABF0 3C018027 */  lui       $at, %hi(gPauseCurrentDescIconScript)
.L8024ABF4:
/* 13DF34 8024ABF4 AC2000CC */  sw        $zero, %lo(gPauseCurrentDescIconScript)($at)
.L8024ABF8:
/* 13DF38 8024ABF8 3C028027 */  lui       $v0, %hi(gPausePressedButtons)
/* 13DF3C 8024ABFC 8C4200C4 */  lw        $v0, %lo(gPausePressedButtons)($v0)
/* 13DF40 8024AC00 30424000 */  andi      $v0, $v0, 0x4000
/* 13DF44 8024AC04 1040000F */  beqz      $v0, .L8024AC44
/* 13DF48 8024AC08 00000000 */   nop
/* 13DF4C 8024AC0C 3C108027 */  lui       $s0, %hi(gPauseItemsLevel)
/* 13DF50 8024AC10 261005E0 */  addiu     $s0, $s0, %lo(gPauseItemsLevel)
D_8024AC14:
/* 13DF54 8024AC14 8E020000 */  lw        $v0, 0x0($s0)
/* 13DF58 8024AC18 14400007 */  bnez      $v0, .L8024AC38
/* 13DF5C 8024AC1C 00000000 */   nop
/* 13DF60 8024AC20 0C05272D */  jal       sfx_play_sound
/* 13DF64 8024AC24 240400CA */   addiu    $a0, $zero, 0xCA
/* 13DF68 8024AC28 3C018027 */  lui       $at, %hi(gPauseMenuCurrentTab)
/* 13DF6C 8024AC2C A02000D4 */  sb        $zero, %lo(gPauseMenuCurrentTab)($at)
/* 13DF70 8024AC30 08092B11 */  j         .L8024AC44
D_8024AC34:
/* 13DF74 8024AC34 00000000 */   nop
.L8024AC38:
/* 13DF78 8024AC38 0C05272D */  jal       sfx_play_sound
/* 13DF7C 8024AC3C 240400CA */   addiu    $a0, $zero, 0xCA
/* 13DF80 8024AC40 AE000000 */  sw        $zero, 0x0($s0)
.L8024AC44:
/* 13DF84 8024AC44 8FBF0014 */  lw        $ra, 0x14($sp)
/* 13DF88 8024AC48 8FB00010 */  lw        $s0, 0x10($sp)
/* 13DF8C 8024AC4C 03E00008 */  jr        $ra
/* 13DF90 8024AC50 27BD0018 */   addiu    $sp, $sp, 0x18

### DECOMPILED C INSTRUCTIONS:

void pause_items_handle_input(MenuPanel* panel) {
    s32 oldTab;
    s32 oldSelectedIndex = gPauseItemsSelectedIndex;
    s32 row = gPauseItemsSelectedIndex / gPauseItemsPages[gPauseItemsCurrentPage].numCols;
    s32 column = gPauseItemsSelectedIndex % gPauseItemsPages[gPauseItemsCurrentPage].numCols;

    if ((gPausePressedButtons & BUTTON_A) && gPauseItemsLevel == 0) {
        if (gPauseItemsItemIDs[gPauseItemsSelectedIndex] == ITEM_NONE_STANDIN) {
            sfx_play_sound(SOUND_MENU_ERROR);
        } else {
            gPauseItemsLevel = 1;
            sfx_play_sound(SOUND_MENU_NEXT);
        }
        return;
    }

    if (gPauseItemsNumItems != 0) {
        if (gPauseItemsLevel == 0) {
            oldTab = gPauseItemsCurrentTab;
            if (gPauseHeldButtons & (BUTTON_STICK_UP|BUTTON_STICK_DOWN)) {
                gPauseItemsCurrentTab ^= 1;
            }

            if (oldTab != gPauseItemsCurrentTab) {
                sfx_play_sound(SOUND_MENU_CHANGE_TAB);
                pause_items_load_items(gPauseItemsCurrentTab);
            }
        } else {
            if (gPauseHeldButtons & (BUTTON_STICK_UP|BUTTON_Z)) {
                row--;
                if (gPauseHeldButtons & BUTTON_STICK_UP) {
                    if (row < 0) {
                        row = 0;
                    }

                    if (row < gPauseItemsPages[gPauseItemsCurrentPage].listStart) {
                        gPauseItemsCurrentPage--;
                    }
                } else {
                    gPauseItemsCurrentPage--;
                    if (gPauseItemsCurrentPage < 0) {
                        gPauseItemsCurrentPage = 0;
                    }
                    row = gPauseItemsPages[gPauseItemsCurrentPage].listStart;
                }
            }

            if (gPauseHeldButtons & (BUTTON_STICK_DOWN|BUTTON_R)) {
                if (gPauseHeldButtons & BUTTON_STICK_DOWN) {
                    row++;
                    if (row >= gPauseItemsPages[gPauseItemsCurrentPage].listStart + gPauseItemsPages[gPauseItemsCurrentPage].numRows) {
                        gPauseItemsCurrentPage++;

                        if (!gPauseItemsPages[gPauseItemsCurrentPage].enabled) {
                            gPauseItemsCurrentPage--;
                            row--;
                        }
                    }
                } else {
                    gPauseItemsCurrentPage++;

                    if (!gPauseItemsPages[gPauseItemsCurrentPage].enabled) {
                        gPauseItemsCurrentPage--;
                    } else {
                        row = gPauseItemsPages[gPauseItemsCurrentPage].listStart;
                    }
                }
            }

            if (gPauseItemsItemIDs[row * gPauseItemsPages[gPauseItemsCurrentPage].numCols] != ITEM_NONE_STANDIN) {
                if (gPauseHeldButtons & BUTTON_STICK_LEFT) {
                    column--;

                    if (column < 0) {
                        column = gPauseItemsPages[gPauseItemsCurrentPage].numCols - 1;
                    }
                } else if (gPauseHeldButtons & BUTTON_STICK_RIGHT) {
                    column++;
                    if (column >= gPauseItemsPages[gPauseItemsCurrentPage].numCols) {
                        column = 0;
                    }
                }
            } else {
                column = 0;
            }

            gPauseItemsSelectedIndex = column + row * gPauseItemsPages[gPauseItemsCurrentPage].numCols;
            if (gPauseItemsSelectedIndex != oldSelectedIndex) {
                sfx_play_sound(SOUND_MENU_CHANGE_SELECTION);
            }

            gPauseItemsSelectedItem = gPauseItemsItemIDs[gPauseItemsSelectedIndex];
        }
    }

    if (gPauseItemsLevel == 1) {
        if (gPauseItemsSelectedItem != ITEM_NONE_STANDIN && gPauseItemsSelectedItem != ITEM_INVALID && gPauseItemsSelectedItem != 0) {
            gPauseCurrentDescMsg = gItemTable[gPauseItemsSelectedItem].fullDescMsg;
        } else {
            gPauseCurrentDescMsg = MSG_NONE;
            gPauseCurrentDescIconScript = NULL;
        }
    } else {
        if (gPauseItemsCurrentTab == 1) {
            gPauseCurrentDescMsg = pause_get_menu_msg(PAUSE_MSG_DESC_CONSUMABLES);
        } else {
            gPauseCurrentDescMsg = pause_get_menu_msg(PAUSE_MSG_DESC_KEY_ITEMS);
        }

        gPauseCurrentDescIconScript = NULL;
    }

    if (gPausePressedButtons & BUTTON_B) {
        if (gPauseItemsLevel == 0) {
            sfx_play_sound(SOUND_MENU_BACK);
            gPauseMenuCurrentTab = 0;
        } else {
            sfx_play_sound(SOUND_MENU_BACK);
            gPauseItemsLevel = 0;
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel npc_draw_palswap_mode_4
/* 172D8 8003BED8 27BDFFB8 */  addiu     $sp, $sp, -0x48
/* 172DC 8003BEDC AFB40030 */  sw        $s4, 0x30($sp)
/* 172E0 8003BEE0 0080A02D */  daddu     $s4, $a0, $zero
/* 172E4 8003BEE4 AFB60038 */  sw        $s6, 0x38($sp)
/* 172E8 8003BEE8 00A0B02D */  daddu     $s6, $a1, $zero
/* 172EC 8003BEEC AFBF0040 */  sw        $ra, 0x40($sp)
/* 172F0 8003BEF0 AFB7003C */  sw        $s7, 0x3C($sp)
/* 172F4 8003BEF4 AFB50034 */  sw        $s5, 0x34($sp)
/* 172F8 8003BEF8 AFB3002C */  sw        $s3, 0x2C($sp)
/* 172FC 8003BEFC AFB20028 */  sw        $s2, 0x28($sp)
/* 17300 8003BF00 AFB10024 */  sw        $s1, 0x24($sp)
/* 17304 8003BF04 AFB00020 */  sw        $s0, 0x20($sp)
/* 17308 8003BF08 828200B6 */  lb        $v0, 0xB6($s4)
/* 1730C 8003BF0C 10400041 */  beqz      $v0, .L8003C014
/* 17310 8003BF10 00C0B82D */   daddu    $s7, $a2, $zero
/* 17314 8003BF14 8E820000 */  lw        $v0, 0x0($s4)
/* 17318 8003BF18 3C034000 */  lui       $v1, (0x40000000 >> 16)
/* 1731C 8003BF1C 00431024 */  and       $v0, $v0, $v1
/* 17320 8003BF20 14400004 */  bnez      $v0, .L8003BF34
/* 17324 8003BF24 00000000 */   nop
/* 17328 8003BF28 0C0B7A90 */  jal       spr_get_npc_palettes
/* 1732C 8003BF2C 96840028 */   lhu      $a0, 0x28($s4)
/* 17330 8003BF30 AE8200C4 */  sw        $v0, 0xC4($s4)
.L8003BF34:
/* 17334 8003BF34 8E8400C4 */  lw        $a0, 0xC4($s4)
/* 17338 8003BF38 A28000C1 */  sb        $zero, 0xC1($s4)
/* 1733C 8003BF3C 8C830000 */  lw        $v1, 0x0($a0)
/* 17340 8003BF40 2402FFFF */  addiu     $v0, $zero, -0x1
/* 17344 8003BF44 1062000B */  beq       $v1, $v0, .L8003BF74
/* 17348 8003BF48 0080182D */   daddu    $v1, $a0, $zero
/* 1734C 8003BF4C 0040202D */  daddu     $a0, $v0, $zero
.L8003BF50:
/* 17350 8003BF50 928200C1 */  lbu       $v0, 0xC1($s4)
/* 17354 8003BF54 24420001 */  addiu     $v0, $v0, 0x1
/* 17358 8003BF58 A28200C1 */  sb        $v0, 0xC1($s4)
/* 1735C 8003BF5C 00021600 */  sll       $v0, $v0, 24
/* 17360 8003BF60 00021583 */  sra       $v0, $v0, 22
/* 17364 8003BF64 00431021 */  addu      $v0, $v0, $v1
/* 17368 8003BF68 8C420000 */  lw        $v0, 0x0($v0)
/* 1736C 8003BF6C 1444FFF8 */  bne       $v0, $a0, .L8003BF50
/* 17370 8003BF70 00000000 */   nop
.L8003BF74:
/* 17374 8003BF74 828300B6 */  lb        $v1, 0xB6($s4)
/* 17378 8003BF78 24020001 */  addiu     $v0, $zero, 0x1
/* 1737C 8003BF7C 14620004 */  bne       $v1, $v0, .L8003BF90
/* 17380 8003BF80 240200FF */   addiu    $v0, $zero, 0xFF
/* 17384 8003BF84 A28000B7 */  sb        $zero, 0xB7($s4)
/* 17388 8003BF88 0800EFE6 */  j         .L8003BF98
/* 1738C 8003BF8C A68000BE */   sh       $zero, 0xBE($s4)
.L8003BF90:
/* 17390 8003BF90 A28000B7 */  sb        $zero, 0xB7($s4)
/* 17394 8003BF94 A68200BE */  sh        $v0, 0xBE($s4)
.L8003BF98:
/* 17398 8003BF98 828200C1 */  lb        $v0, 0xC1($s4)
/* 1739C 8003BF9C 18400018 */  blez      $v0, .L8003C000
/* 173A0 8003BFA0 0000202D */   daddu    $a0, $zero, $zero
/* 173A4 8003BFA4 0280302D */  daddu     $a2, $s4, $zero
/* 173A8 8003BFA8 240500C8 */  addiu     $a1, $zero, 0xC8
.L8003BFAC:
/* 173AC 8003BFAC 8E8300C4 */  lw        $v1, 0xC4($s4)
/* 173B0 8003BFB0 00041080 */  sll       $v0, $a0, 2
/* 173B4 8003BFB4 00431021 */  addu      $v0, $v0, $v1
/* 173B8 8003BFB8 8C520000 */  lw        $s2, 0x0($v0)
/* 173BC 8003BFBC 02858021 */  addu      $s0, $s4, $a1
/* 173C0 8003BFC0 12400009 */  beqz      $s2, .L8003BFE8
/* 173C4 8003BFC4 ACD002C8 */   sw       $s0, 0x2C8($a2)
/* 173C8 8003BFC8 0000882D */  daddu     $s1, $zero, $zero
.L8003BFCC:
/* 173CC 8003BFCC 96420000 */  lhu       $v0, 0x0($s2)
/* 173D0 8003BFD0 26520002 */  addiu     $s2, $s2, 0x2
/* 173D4 8003BFD4 26310001 */  addiu     $s1, $s1, 0x1
/* 173D8 8003BFD8 A6020000 */  sh        $v0, 0x0($s0)
/* 173DC 8003BFDC 2A220010 */  slti      $v0, $s1, 0x10
/* 173E0 8003BFE0 1440FFFA */  bnez      $v0, .L8003BFCC
/* 173E4 8003BFE4 26100002 */   addiu    $s0, $s0, 0x2
.L8003BFE8:
/* 173E8 8003BFE8 24C60004 */  addiu     $a2, $a2, 0x4
/* 173EC 8003BFEC 828200C1 */  lb        $v0, 0xC1($s4)
/* 173F0 8003BFF0 24840001 */  addiu     $a0, $a0, 0x1
/* 173F4 8003BFF4 0082102A */  slt       $v0, $a0, $v0
/* 173F8 8003BFF8 1440FFEC */  bnez      $v0, .L8003BFAC
/* 173FC 8003BFFC 24A50020 */   addiu    $a1, $a1, 0x20
.L8003C000:
/* 17400 8003C000 9682030C */  lhu       $v0, 0x30C($s4)
/* 17404 8003C004 A68000BE */  sh        $zero, 0xBE($s4)
/* 17408 8003C008 A28000B7 */  sb        $zero, 0xB7($s4)
/* 1740C 8003C00C A28000B6 */  sb        $zero, 0xB6($s4)
/* 17410 8003C010 A68200BC */  sh        $v0, 0xBC($s4)
.L8003C014:
/* 17414 8003C014 828300B7 */  lb        $v1, 0xB7($s4)
/* 17418 8003C018 10600005 */  beqz      $v1, .L8003C030
/* 1741C 8003C01C 24020001 */   addiu    $v0, $zero, 0x1
/* 17420 8003C020 1062000C */  beq       $v1, $v0, .L8003C054
/* 17424 8003C024 24020002 */   addiu    $v0, $zero, 0x2
/* 17428 8003C028 0800F06B */  j         .L8003C1AC
/* 1742C 8003C02C 00000000 */   nop
.L8003C030:
/* 17430 8003C030 868200BC */  lh        $v0, 0xBC($s4)
/* 17434 8003C034 968300BC */  lhu       $v1, 0xBC($s4)
/* 17438 8003C038 10400003 */  beqz      $v0, .L8003C048
/* 1743C 8003C03C 2462FFFF */   addiu    $v0, $v1, -0x1
/* 17440 8003C040 0800F069 */  j         .L8003C1A4
/* 17444 8003C044 A68200BC */   sh       $v0, 0xBC($s4)
.L8003C048:
/* 17448 8003C048 24020001 */  addiu     $v0, $zero, 0x1
/* 1744C 8003C04C A68000BE */  sh        $zero, 0xBE($s4)
/* 17450 8003C050 A28200B7 */  sb        $v0, 0xB7($s4)
.L8003C054:
/* 17454 8003C054 8682030E */  lh        $v0, 0x30E($s4)
/* 17458 8003C058 24036400 */  addiu     $v1, $zero, 0x6400
/* 1745C 8003C05C 14400002 */  bnez      $v0, .L8003C068
/* 17460 8003C060 0062001A */   div      $zero, $v1, $v0
/* 17464 8003C064 0007000D */  break     7
.L8003C068:
/* 17468 8003C068 2401FFFF */  addiu     $at, $zero, -0x1
/* 1746C 8003C06C 14410004 */  bne       $v0, $at, .L8003C080
/* 17470 8003C070 3C018000 */   lui      $at, (0x80000000 >> 16)
/* 17474 8003C074 14610002 */  bne       $v1, $at, .L8003C080
/* 17478 8003C078 00000000 */   nop
/* 1747C 8003C07C 0006000D */  break     6
.L8003C080:
/* 17480 8003C080 00001812 */  mflo      $v1
/* 17484 8003C084 968200BE */  lhu       $v0, 0xBE($s4)
/* 17488 8003C088 00431021 */  addu      $v0, $v0, $v1
/* 1748C 8003C08C A68200BE */  sh        $v0, 0xBE($s4)
/* 17490 8003C090 00021400 */  sll       $v0, $v0, 16
/* 17494 8003C094 00021403 */  sra       $v0, $v0, 16
/* 17498 8003C098 2842639D */  slti      $v0, $v0, 0x639D
/* 1749C 8003C09C 14400003 */  bnez      $v0, .L8003C0AC
/* 174A0 8003C0A0 3C0651EB */   lui      $a2, (0x51EB851F >> 16)
/* 174A4 8003C0A4 2402639C */  addiu     $v0, $zero, 0x639C
/* 174A8 8003C0A8 A68200BE */  sh        $v0, 0xBE($s4)
.L8003C0AC:
/* 174AC 8003C0AC 34C6851F */  ori       $a2, $a2, (0x51EB851F & 0xFFFF)
/* 174B0 8003C0B0 269300C8 */  addiu     $s3, $s4, 0xC8
/* 174B4 8003C0B4 0000882D */  daddu     $s1, $zero, $zero
/* 174B8 8003C0B8 86820308 */  lh        $v0, 0x308($s4)
/* 174BC 8003C0BC 8E8500C4 */  lw        $a1, 0xC4($s4)
/* 174C0 8003C0C0 968300BE */  lhu       $v1, 0xBE($s4)
/* 174C4 8003C0C4 00021080 */  sll       $v0, $v0, 2
/* 174C8 8003C0C8 00451021 */  addu      $v0, $v0, $a1
/* 174CC 8003C0CC 00031C00 */  sll       $v1, $v1, 16
/* 174D0 8003C0D0 00032403 */  sra       $a0, $v1, 16
/* 174D4 8003C0D4 8C520000 */  lw        $s2, 0x0($v0)
/* 174D8 8003C0D8 8682030A */  lh        $v0, 0x30A($s4)
/* 174DC 8003C0DC 00860018 */  mult      $a0, $a2
/* 174E0 8003C0E0 00021080 */  sll       $v0, $v0, 2
/* 174E4 8003C0E4 00451021 */  addu      $v0, $v0, $a1
/* 174E8 8003C0E8 8C500000 */  lw        $s0, 0x0($v0)
/* 174EC 8003C0EC 00031FC3 */  sra       $v1, $v1, 31
/* 174F0 8003C0F0 AE9302C8 */  sw        $s3, 0x2C8($s4)
/* 174F4 8003C0F4 00004010 */  mfhi      $t0
/* 174F8 8003C0F8 00081143 */  sra       $v0, $t0, 5
/* 174FC 8003C0FC 0043A823 */  subu      $s5, $v0, $v1
.L8003C100:
/* 17500 8003C100 96440000 */  lhu       $a0, 0x0($s2)
/* 17504 8003C104 26520002 */  addiu     $s2, $s2, 0x2
/* 17508 8003C108 96050000 */  lhu       $a1, 0x0($s0)
/* 1750C 8003C10C 26100002 */  addiu     $s0, $s0, 0x2
/* 17510 8003C110 32A600FF */  andi      $a2, $s5, 0xFF
/* 17514 8003C114 0C00EE5B */  jal       npc_blend_palette_colors
/* 17518 8003C118 26310001 */   addiu    $s1, $s1, 0x1
/* 1751C 8003C11C A6620000 */  sh        $v0, 0x0($s3)
/* 17520 8003C120 2A220010 */  slti      $v0, $s1, 0x10
/* 17524 8003C124 1440FFF6 */  bnez      $v0, .L8003C100
/* 17528 8003C128 26730002 */   addiu    $s3, $s3, 0x2
/* 1752C 8003C12C 26930128 */  addiu     $s3, $s4, 0x128
/* 17530 8003C130 86820314 */  lh        $v0, 0x314($s4)
/* 17534 8003C134 8E8400C4 */  lw        $a0, 0xC4($s4)
/* 17538 8003C138 86830316 */  lh        $v1, 0x316($s4)
/* 1753C 8003C13C 00021080 */  sll       $v0, $v0, 2
/* 17540 8003C140 00441021 */  addu      $v0, $v0, $a0
/* 17544 8003C144 00031880 */  sll       $v1, $v1, 2
/* 17548 8003C148 00641821 */  addu      $v1, $v1, $a0
/* 1754C 8003C14C 8C520000 */  lw        $s2, 0x0($v0)
/* 17550 8003C150 8C700000 */  lw        $s0, 0x0($v1)
/* 17554 8003C154 0000882D */  daddu     $s1, $zero, $zero
/* 17558 8003C158 AE9302D4 */  sw        $s3, 0x2D4($s4)
.L8003C15C:
/* 1755C 8003C15C 96440000 */  lhu       $a0, 0x0($s2)
/* 17560 8003C160 26520002 */  addiu     $s2, $s2, 0x2
/* 17564 8003C164 96050000 */  lhu       $a1, 0x0($s0)
/* 17568 8003C168 26100002 */  addiu     $s0, $s0, 0x2
/* 1756C 8003C16C 32A600FF */  andi      $a2, $s5, 0xFF
/* 17570 8003C170 0C00EE5B */  jal       npc_blend_palette_colors
/* 17574 8003C174 26310001 */   addiu    $s1, $s1, 0x1
/* 17578 8003C178 A6620000 */  sh        $v0, 0x0($s3)
/* 1757C 8003C17C 2A220010 */  slti      $v0, $s1, 0x10
/* 17580 8003C180 1440FFF6 */  bnez      $v0, .L8003C15C
/* 17584 8003C184 26730002 */   addiu    $s3, $s3, 0x2
/* 17588 8003C188 32A300FF */  andi      $v1, $s5, 0xFF
/* 1758C 8003C18C 240200FF */  addiu     $v0, $zero, 0xFF
/* 17590 8003C190 14620004 */  bne       $v1, $v0, .L8003C1A4
/* 17594 8003C194 24020002 */   addiu    $v0, $zero, 0x2
/* 17598 8003C198 96830310 */  lhu       $v1, 0x310($s4)
/* 1759C 8003C19C A28200B7 */  sb        $v0, 0xB7($s4)
/* 175A0 8003C1A0 A68300BC */  sh        $v1, 0xBC($s4)
.L8003C1A4:
/* 175A4 8003C1A4 828300B7 */  lb        $v1, 0xB7($s4)
/* 175A8 8003C1A8 24020002 */  addiu     $v0, $zero, 0x2
.L8003C1AC:
/* 175AC 8003C1AC 10620005 */  beq       $v1, $v0, .L8003C1C4
/* 175B0 8003C1B0 24020003 */   addiu    $v0, $zero, 0x3
/* 175B4 8003C1B4 1062000A */  beq       $v1, $v0, .L8003C1E0
/* 175B8 8003C1B8 00000000 */   nop
/* 175BC 8003C1BC 0800F0CD */  j         .L8003C334
/* 175C0 8003C1C0 00000000 */   nop
.L8003C1C4:
/* 175C4 8003C1C4 868200BC */  lh        $v0, 0xBC($s4)
/* 175C8 8003C1C8 968300BC */  lhu       $v1, 0xBC($s4)
/* 175CC 8003C1CC 14400058 */  bnez      $v0, .L8003C330
/* 175D0 8003C1D0 2462FFFF */   addiu    $v0, $v1, -0x1
/* 175D4 8003C1D4 24020003 */  addiu     $v0, $zero, 0x3
/* 175D8 8003C1D8 A68000BE */  sh        $zero, 0xBE($s4)
/* 175DC 8003C1DC A28200B7 */  sb        $v0, 0xB7($s4)
.L8003C1E0:
/* 175E0 8003C1E0 86820312 */  lh        $v0, 0x312($s4)
/* 175E4 8003C1E4 24036400 */  addiu     $v1, $zero, 0x6400
/* 175E8 8003C1E8 14400002 */  bnez      $v0, .L8003C1F4
/* 175EC 8003C1EC 0062001A */   div      $zero, $v1, $v0
/* 175F0 8003C1F0 0007000D */  break     7
.L8003C1F4:
/* 175F4 8003C1F4 2401FFFF */  addiu     $at, $zero, -0x1
/* 175F8 8003C1F8 14410004 */  bne       $v0, $at, .L8003C20C
/* 175FC 8003C1FC 3C018000 */   lui      $at, (0x80000000 >> 16)
/* 17600 8003C200 14610002 */  bne       $v1, $at, .L8003C20C
/* 17604 8003C204 00000000 */   nop
/* 17608 8003C208 0006000D */  break     6
.L8003C20C:
/* 1760C 8003C20C 00001812 */  mflo      $v1
/* 17610 8003C210 968200BE */  lhu       $v0, 0xBE($s4)
/* 17614 8003C214 00431021 */  addu      $v0, $v0, $v1
/* 17618 8003C218 A68200BE */  sh        $v0, 0xBE($s4)
/* 1761C 8003C21C 00021400 */  sll       $v0, $v0, 16
/* 17620 8003C220 00021403 */  sra       $v0, $v0, 16
/* 17624 8003C224 2842639D */  slti      $v0, $v0, 0x639D
/* 17628 8003C228 14400003 */  bnez      $v0, .L8003C238
/* 1762C 8003C22C 3C0651EB */   lui      $a2, (0x51EB851F >> 16)
/* 17630 8003C230 2402639C */  addiu     $v0, $zero, 0x639C
/* 17634 8003C234 A68200BE */  sh        $v0, 0xBE($s4)
.L8003C238:
/* 17638 8003C238 34C6851F */  ori       $a2, $a2, (0x51EB851F & 0xFFFF)
/* 1763C 8003C23C 269300C8 */  addiu     $s3, $s4, 0xC8
/* 17640 8003C240 0000882D */  daddu     $s1, $zero, $zero
/* 17644 8003C244 8682030A */  lh        $v0, 0x30A($s4)
/* 17648 8003C248 8E8500C4 */  lw        $a1, 0xC4($s4)
/* 1764C 8003C24C 968300BE */  lhu       $v1, 0xBE($s4)
/* 17650 8003C250 00021080 */  sll       $v0, $v0, 2
/* 17654 8003C254 00451021 */  addu      $v0, $v0, $a1
/* 17658 8003C258 00031C00 */  sll       $v1, $v1, 16
/* 1765C 8003C25C 00032403 */  sra       $a0, $v1, 16
/* 17660 8003C260 8C520000 */  lw        $s2, 0x0($v0)
/* 17664 8003C264 86820308 */  lh        $v0, 0x308($s4)
/* 17668 8003C268 00860018 */  mult      $a0, $a2
/* 1766C 8003C26C 00021080 */  sll       $v0, $v0, 2
/* 17670 8003C270 00451021 */  addu      $v0, $v0, $a1
/* 17674 8003C274 8C500000 */  lw        $s0, 0x0($v0)
/* 17678 8003C278 00031FC3 */  sra       $v1, $v1, 31
/* 1767C 8003C27C AE9302C8 */  sw        $s3, 0x2C8($s4)
/* 17680 8003C280 00004010 */  mfhi      $t0
/* 17684 8003C284 00081143 */  sra       $v0, $t0, 5
/* 17688 8003C288 0043A823 */  subu      $s5, $v0, $v1
.L8003C28C:
/* 1768C 8003C28C 96440000 */  lhu       $a0, 0x0($s2)
/* 17690 8003C290 26520002 */  addiu     $s2, $s2, 0x2
/* 17694 8003C294 96050000 */  lhu       $a1, 0x0($s0)
/* 17698 8003C298 26100002 */  addiu     $s0, $s0, 0x2
/* 1769C 8003C29C 32A600FF */  andi      $a2, $s5, 0xFF
/* 176A0 8003C2A0 0C00EE5B */  jal       npc_blend_palette_colors
/* 176A4 8003C2A4 26310001 */   addiu    $s1, $s1, 0x1
/* 176A8 8003C2A8 A6620000 */  sh        $v0, 0x0($s3)
/* 176AC 8003C2AC 2A220010 */  slti      $v0, $s1, 0x10
/* 176B0 8003C2B0 1440FFF6 */  bnez      $v0, .L8003C28C
/* 176B4 8003C2B4 26730002 */   addiu    $s3, $s3, 0x2
/* 176B8 8003C2B8 269300E8 */  addiu     $s3, $s4, 0xE8
/* 176BC 8003C2BC 0000882D */  daddu     $s1, $zero, $zero
/* 176C0 8003C2C0 86830316 */  lh        $v1, 0x316($s4)
/* 176C4 8003C2C4 8E8400C4 */  lw        $a0, 0xC4($s4)
/* 176C8 8003C2C8 86820314 */  lh        $v0, 0x314($s4)
/* 176CC 8003C2CC 00031880 */  sll       $v1, $v1, 2
/* 176D0 8003C2D0 00641821 */  addu      $v1, $v1, $a0
/* 176D4 8003C2D4 00021080 */  sll       $v0, $v0, 2
/* 176D8 8003C2D8 00441021 */  addu      $v0, $v0, $a0
/* 176DC 8003C2DC 8C720000 */  lw        $s2, 0x0($v1)
/* 176E0 8003C2E0 8C500000 */  lw        $s0, 0x0($v0)
/* 176E4 8003C2E4 26820128 */  addiu     $v0, $s4, 0x128
/* 176E8 8003C2E8 AE8202D4 */  sw        $v0, 0x2D4($s4)
.L8003C2EC:
/* 176EC 8003C2EC 96440000 */  lhu       $a0, 0x0($s2)
/* 176F0 8003C2F0 26520002 */  addiu     $s2, $s2, 0x2
/* 176F4 8003C2F4 96050000 */  lhu       $a1, 0x0($s0)
/* 176F8 8003C2F8 26100002 */  addiu     $s0, $s0, 0x2
/* 176FC 8003C2FC 32A600FF */  andi      $a2, $s5, 0xFF
/* 17700 8003C300 0C00EE5B */  jal       npc_blend_palette_colors
/* 17704 8003C304 26310001 */   addiu    $s1, $s1, 0x1
/* 17708 8003C308 A6620000 */  sh        $v0, 0x0($s3)
/* 1770C 8003C30C 2A220010 */  slti      $v0, $s1, 0x10
/* 17710 8003C310 1440FFF6 */  bnez      $v0, .L8003C2EC
/* 17714 8003C314 26730002 */   addiu    $s3, $s3, 0x2
/* 17718 8003C318 32A300FF */  andi      $v1, $s5, 0xFF
/* 1771C 8003C31C 240200FF */  addiu     $v0, $zero, 0xFF
/* 17720 8003C320 14620004 */  bne       $v1, $v0, .L8003C334
/* 17724 8003C324 00000000 */   nop
/* 17728 8003C328 9682030C */  lhu       $v0, 0x30C($s4)
/* 1772C 8003C32C A28000B7 */  sb        $zero, 0xB7($s4)
.L8003C330:
/* 17730 8003C330 A68200BC */  sh        $v0, 0xBC($s4)
.L8003C334:
/* 17734 8003C334 828300B7 */  lb        $v1, 0xB7($s4)
/* 17738 8003C338 28620004 */  slti      $v0, $v1, 0x4
/* 1773C 8003C33C 1040001B */  beqz      $v0, .L8003C3AC
/* 17740 8003C340 00000000 */   nop
/* 17744 8003C344 04600019 */  bltz      $v1, .L8003C3AC
/* 17748 8003C348 3C034000 */   lui      $v1, (0x40000000 >> 16)
/* 1774C 8003C34C 8E820000 */  lw        $v0, 0x0($s4)
/* 17750 8003C350 00431024 */  and       $v0, $v0, $v1
/* 17754 8003C354 14400015 */  bnez      $v0, .L8003C3AC
/* 17758 8003C358 02C0282D */   daddu    $a1, $s6, $zero
/* 1775C 8003C35C 928200AC */  lbu       $v0, 0xAC($s4)
/* 17760 8003C360 928300AD */  lbu       $v1, 0xAD($s4)
/* 17764 8003C364 00430018 */  mult      $v0, $v1
/* 17768 8003C368 00001012 */  mflo      $v0
/* 1776C 8003C36C 3C038080 */  lui       $v1, (0x80808081 >> 16)
/* 17770 8003C370 34638081 */  ori       $v1, $v1, (0x80808081 & 0xFFFF)
/* 17774 8003C374 00430018 */  mult      $v0, $v1
/* 17778 8003C378 8E830024 */  lw        $v1, 0x24($s4)
/* 1777C 8003C37C 268702C8 */  addiu     $a3, $s4, 0x2C8
/* 17780 8003C380 AFB70010 */  sw        $s7, 0x10($sp)
/* 17784 8003C384 00004810 */  mfhi      $t1
/* 17788 8003C388 01221021 */  addu      $v0, $t1, $v0
/* 1778C 8003C38C 0002A9C2 */  srl       $s5, $v0, 7
/* 17790 8003C390 32A600FF */  andi      $a2, $s5, 0xFF
/* 17794 8003C394 2CC400FF */  sltiu     $a0, $a2, 0xFF
/* 17798 8003C398 000427C0 */  sll       $a0, $a0, 31
/* 1779C 8003C39C 3C022000 */  lui       $v0, (0x20000000 >> 16)
/* 177A0 8003C3A0 00822025 */  or        $a0, $a0, $v0
/* 177A4 8003C3A4 0C0B78F6 */  jal       spr_draw_npc_sprite
/* 177A8 8003C3A8 00642025 */   or       $a0, $v1, $a0
.L8003C3AC:
/* 177AC 8003C3AC 8FBF0040 */  lw        $ra, 0x40($sp)
/* 177B0 8003C3B0 8FB7003C */  lw        $s7, 0x3C($sp)
/* 177B4 8003C3B4 8FB60038 */  lw        $s6, 0x38($sp)
/* 177B8 8003C3B8 8FB50034 */  lw        $s5, 0x34($sp)
/* 177BC 8003C3BC 8FB40030 */  lw        $s4, 0x30($sp)
/* 177C0 8003C3C0 8FB3002C */  lw        $s3, 0x2C($sp)
/* 177C4 8003C3C4 8FB20028 */  lw        $s2, 0x28($sp)
/* 177C8 8003C3C8 8FB10024 */  lw        $s1, 0x24($sp)
/* 177CC 8003C3CC 8FB00020 */  lw        $s0, 0x20($sp)
/* 177D0 8003C3D0 03E00008 */  jr        $ra
/* 177D4 8003C3D4 27BD0048 */   addiu    $sp, $sp, 0x48

### DECOMPILED C INSTRUCTIONS:

s32 npc_draw_palswap_mode_4(Npc* npc, s32 arg1, Matrix4f mtx) {
    s32 i, j;
    PAL_PTR src;
    PAL_PTR src2;
    PAL_PTR dst;
    u8 blendAlpha;

    if (npc->dirtyPalettes != 0) {
        if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
            npc->spritePaletteList = spr_get_npc_palettes(npc->currentAnim >> 16);
        }

        npc->paletteCount = 0;
        while ((s32)npc->spritePaletteList[npc->paletteCount] != -1) {
            npc->paletteCount++;
        }

        if (npc->dirtyPalettes == 1) {
            npc->palSwapState = 0;
            npc->palSwapLerpAlpha = 0;
        } else {
            npc->palSwapState = 0;
            npc->palSwapLerpAlpha = 255;
        }

        for (i = 0; i < npc->paletteCount; i++) {
            src2 = npc->localPaletteData[i];
            src = npc->spritePaletteList[i];
            npc->localPalettes[i] = src2;
            if (src != NULL) {
                for (j = 0; j < 16; j++) {
                    *src2++ = *src++;
                }
            }
        }

        npc->palSwapLerpAlpha = 0;
        npc->palSwapState = 0;
        npc->dirtyPalettes = 0;
        npc->palSwapTimer = npc->unk_30C;
    }

    switch (npc->palSwapState) {
        case 0:
            if (npc->palSwapTimer != 0) {
                npc->palSwapTimer--;
                break;
            } else {
                npc->palSwapLerpAlpha = 0;
                npc->palSwapState = 1;
            }
            // fallthrough
        case 1:
            npc->palSwapLerpAlpha += 25600 / npc->unk_30E;
            if (npc->palSwapLerpAlpha > 25500) {
                npc->palSwapLerpAlpha = 25500;
            }
            blendAlpha = npc->palSwapLerpAlpha / 100;

            dst = npc->localPaletteData[0];
            src = npc->spritePaletteList[npc->unk_308];
            src2 = npc->spritePaletteList[npc->unk_30A];
            npc->localPalettes[0] = dst;

            for (j = 0; j < 16; j++) {
                *dst++ = npc_blend_palette_colors(*src++, *src2++, blendAlpha);
            }

            dst = npc->localPaletteData[3];
            src = npc->spritePaletteList[npc->unk_314];
            src2 = npc->spritePaletteList[npc->unk_316];
            npc->localPalettes[3] = dst;

            for (j = 0; j < 16; j++) {
                *dst++ = npc_blend_palette_colors(*src++, *src2++, blendAlpha);
            }

            if (blendAlpha == 255) {
                npc->palSwapState = 2;
                npc->palSwapTimer = npc->unk_310;
            }
            break;
    }
    switch (npc->palSwapState) {
        case 2:
            if (npc->palSwapTimer != 0) {
                npc->palSwapTimer--;
                break;
            } else {
                npc->palSwapLerpAlpha = 0;
                npc->palSwapState = 3;
            }
            // fallthrough
        case 3:
            npc->palSwapLerpAlpha += 25600 / npc->unk_312;
            if (npc->palSwapLerpAlpha > 25500) {
                npc->palSwapLerpAlpha = 25500;
            }
            blendAlpha = npc->palSwapLerpAlpha / 100;

            dst = npc->localPaletteData[0];
            src = npc->spritePaletteList[npc->unk_30A];
            src2 = npc->spritePaletteList[npc->unk_308];
            npc->localPalettes[0] = dst;

            for (j = 0; j < 16; j++) {
                *dst++ = npc_blend_palette_colors(*src++, *src2++, blendAlpha);
            }

            dst = npc->localPaletteData[1];
            src = npc->spritePaletteList[npc->unk_316];
            src2 = npc->spritePaletteList[npc->unk_314];
            npc->localPalettes[3] = npc->localPaletteData[3];

            for (j = 0; j < 16; j++) {
                *dst++ = npc_blend_palette_colors(*src++, *src2++, blendAlpha);
            }

            if (blendAlpha == 255) {
                npc->palSwapState = 0;
                npc->palSwapTimer = npc->unk_30C;
            }
            break;
    }

    if (npc->palSwapState < 4) {
        if (npc->palSwapState >= 0) {
            if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) {
                s32 temp;
                u32 spriteInstanceMask;

                blendAlpha = npc->alpha * npc->alpha2 / 255;
                temp = blendAlpha < 255;
                spriteInstanceMask = ((temp) << 31) | DRAW_SPRITE_OVERRIDE_PALETTES;
                spr_draw_npc_sprite(npc->spriteInstanceID | spriteInstanceMask, arg1, blendAlpha, npc->localPalettes, mtx);
            }
        }
    }
}