### RAW ASSEMBLY INSTRUCTIONS:

glabel func_80248660
/* 176F40 80248660 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 176F44 80248664 3C058011 */  lui       $a1, %hi(gPlayerData)
.L80248668:
/* 176F48 80248668 24A5F290 */  addiu     $a1, $a1, %lo(gPlayerData)
.L8024866C:
/* 176F4C 8024866C AFB3001C */  sw        $s3, 0x1C($sp)
/* 176F50 80248670 3C13800E */  lui       $s3, %hi(gBattleStatus)
.L80248674:
/* 176F54 80248674 2673C070 */  addiu     $s3, $s3, %lo(gBattleStatus)
.L80248678:
/* 176F58 80248678 AFBF0024 */  sw        $ra, 0x24($sp)
/* 176F5C 8024867C AFB40020 */  sw        $s4, 0x20($sp)
.L80248680:
/* 176F60 80248680 AFB20018 */  sw        $s2, 0x18($sp)
/* 176F64 80248684 AFB10014 */  sw        $s1, 0x14($sp)
/* 176F68 80248688 AFB00010 */  sw        $s0, 0x10($sp)
.L8024868C:
/* 176F6C 8024868C 8E7200D8 */  lw        $s2, 0xD8($s3)
/* 176F70 80248690 3C03800E */  lui       $v1, %hi(gBattleSubState)
/* 176F74 80248694 8C63C4DC */  lw        $v1, %lo(gBattleSubState)($v1)
/* 176F78 80248698 8E7100DC */  lw        $s1, 0xDC($s3)
/* 176F7C 8024869C 10600005 */  beqz      $v1, .L802486B4
/* 176F80 802486A0 24020002 */   addiu    $v0, $zero, 0x2
/* 176F84 802486A4 1062008A */  beq       $v1, $v0, .L802488D0
.L802486A8:
/* 176F88 802486A8 00000000 */   nop
/* 176F8C 802486AC 080922A1 */  j         .L80248A84
.L802486B0:
/* 176F90 802486B0 00000000 */   nop
.L802486B4:
/* 176F94 802486B4 94A2029E */  lhu       $v0, 0x29E($a1)
/* 176F98 802486B8 3C04F7FF */  lui       $a0, (0xF7FFFFFF >> 16)
/* 176F9C 802486BC A260008C */  sb        $zero, 0x8C($s3)
/* 176FA0 802486C0 A6600180 */  sh        $zero, 0x180($s3)
/* 176FA4 802486C4 A260019A */  sb        $zero, 0x19A($s3)
/* 176FA8 802486C8 24420001 */  addiu     $v0, $v0, 0x1
/* 176FAC 802486CC A4A2029E */  sh        $v0, 0x29E($a1)
/* 176FB0 802486D0 8E620000 */  lw        $v0, 0x0($s3)
/* 176FB4 802486D4 2403FFFD */  addiu     $v1, $zero, -0x3
/* 176FB8 802486D8 00431024 */  and       $v0, $v0, $v1
/* 176FBC 802486DC AE620000 */  sw        $v0, 0x0($s3)
/* 176FC0 802486E0 8E420000 */  lw        $v0, 0x0($s2)
/* 176FC4 802486E4 3484FFFF */  ori       $a0, $a0, (0xF7FFFFFF & 0xFFFF)
.L802486E8:
/* 176FC8 802486E8 3C01802A */  lui       $at, %hi(D_8029F254)
/* 176FCC 802486EC AC20F254 */  sw        $zero, %lo(D_8029F254)($at)
/* 176FD0 802486F0 00441024 */  and       $v0, $v0, $a0
/* 176FD4 802486F4 12200004 */  beqz      $s1, .L80248708
/* 176FD8 802486F8 AE420000 */   sw       $v0, 0x0($s2)
.L802486FC:
/* 176FDC 802486FC 8E220000 */  lw        $v0, 0x0($s1)
/* 176FE0 80248700 00441024 */  and       $v0, $v0, $a0
/* 176FE4 80248704 AE220000 */  sw        $v0, 0x0($s1)
.L80248708:
/* 176FE8 80248708 3C030100 */  lui       $v1, (0x1004000 >> 16)
/* 176FEC 8024870C 34634000 */  ori       $v1, $v1, (0x1004000 & 0xFFFF)
/* 176FF0 80248710 0000502D */  daddu     $t2, $zero, $zero
D_80248714:
/* 176FF4 80248714 0140882D */  daddu     $s1, $t2, $zero
/* 176FF8 80248718 0260282D */  daddu     $a1, $s3, $zero
/* 176FFC 8024871C 8E620004 */  lw        $v0, 0x4($s3)
D_80248720:
/* 177000 80248720 0260202D */  daddu     $a0, $s3, $zero
/* 177004 80248724 00431025 */  or        $v0, $v0, $v1
/* 177008 80248728 AE620004 */  sw        $v0, 0x4($s3)
.L8024872C:
/* 17700C 8024872C 8CB000E0 */  lw        $s0, 0xE0($a1)
/* 177010 80248730 52000006 */  beql      $s0, $zero, .L8024874C
/* 177014 80248734 26310001 */   addiu    $s1, $s1, 0x1
.L80248738:
/* 177018 80248738 36220200 */  ori       $v0, $s1, 0x200
/* 17701C 8024873C A4820140 */  sh        $v0, 0x140($a0)
/* 177020 80248740 24840002 */  addiu     $a0, $a0, 0x2
/* 177024 80248744 254A0001 */  addiu     $t2, $t2, 0x1
/* 177028 80248748 26310001 */  addiu     $s1, $s1, 0x1
.L8024874C:
/* 17702C 8024874C 2A220018 */  slti      $v0, $s1, 0x18
/* 177030 80248750 1440FFF6 */  bnez      $v0, .L8024872C
D_80248754:
/* 177034 80248754 24A50004 */   addiu    $a1, $a1, 0x4
/* 177038 80248758 A26A0171 */  sb        $t2, 0x171($s3)
/* 17703C 8024875C 0000882D */  daddu     $s1, $zero, $zero
D_80248760_jan_02:
/* 177040 80248760 2542FFFF */  addiu     $v0, $t2, -0x1
/* 177044 80248764 18400022 */  blez      $v0, .L802487F0
D_80248768_DCCB38:
/* 177048 80248768 266C0140 */   addiu    $t4, $s3, 0x140
/* 17704C 8024876C 0040682D */  daddu     $t5, $v0, $zero
jtbl_80248770:
/* 177050 80248770 0180582D */  daddu     $t3, $t4, $zero
.L80248774:
/* 177054 80248774 26270001 */  addiu     $a3, $s1, 0x1
D_80248778:
/* 177058 80248778 00EA102A */  slt       $v0, $a3, $t2
D_8024877C:
/* 17705C 8024877C 50400019 */  beql      $v0, $zero, .L802487E4
D_80248780:
/* 177060 80248780 26310001 */   addiu    $s1, $s1, 0x1
D_80248784:
/* 177064 80248784 0160482D */  daddu     $t1, $t3, $zero
D_80248788:
/* 177068 80248788 00071040 */  sll       $v0, $a3, 1
/* 17706C 8024878C 004C3021 */  addu      $a2, $v0, $t4
.L80248790:
/* 177070 80248790 95280000 */  lhu       $t0, 0x0($t1)
/* 177074 80248794 94C50000 */  lhu       $a1, 0x0($a2)
/* 177078 80248798 310300FF */  andi      $v1, $t0, 0xFF
D_8024879C:
/* 17707C 8024879C 00031880 */  sll       $v1, $v1, 2
/* 177080 802487A0 02631821 */  addu      $v1, $s3, $v1
/* 177084 802487A4 30A200FF */  andi      $v0, $a1, 0xFF
/* 177088 802487A8 00021080 */  sll       $v0, $v0, 2
/* 17708C 802487AC 02621021 */  addu      $v0, $s3, $v0
/* 177090 802487B0 8C6300E0 */  lw        $v1, 0xE0($v1)
/* 177094 802487B4 8C4400E0 */  lw        $a0, 0xE0($v0)
/* 177098 802487B8 806201F1 */  lb        $v0, 0x1F1($v1)
/* 17709C 802487BC 808301F1 */  lb        $v1, 0x1F1($a0)
/* 1770A0 802487C0 0043102A */  slt       $v0, $v0, $v1
/* 1770A4 802487C4 10400003 */  beqz      $v0, .L802487D4
/* 1770A8 802487C8 24E70001 */   addiu    $a3, $a3, 0x1
/* 1770AC 802487CC A5250000 */  sh        $a1, 0x0($t1)
/* 1770B0 802487D0 A4C80000 */  sh        $t0, 0x0($a2)
.L802487D4:
/* 1770B4 802487D4 00EA102A */  slt       $v0, $a3, $t2
/* 1770B8 802487D8 1440FFED */  bnez      $v0, .L80248790
/* 1770BC 802487DC 24C60002 */   addiu    $a2, $a2, 0x2
/* 1770C0 802487E0 26310001 */  addiu     $s1, $s1, 0x1
.L802487E4:
/* 1770C4 802487E4 022D102A */  slt       $v0, $s1, $t5
/* 1770C8 802487E8 1440FFE2 */  bnez      $v0, .L80248774
/* 1770CC 802487EC 256B0002 */   addiu    $t3, $t3, 0x2
.L802487F0:
/* 1770D0 802487F0 A2600170 */  sb        $zero, 0x170($s3)
.L802487F4:
/* 1770D4 802487F4 0000282D */  daddu     $a1, $zero, $zero
/* 1770D8 802487F8 3C030020 */  lui       $v1, (0x204000 >> 16)
/* 1770DC 802487FC 34634000 */  ori       $v1, $v1, (0x204000 & 0xFFFF)
.L80248800:
/* 1770E0 80248800 00051040 */  sll       $v0, $a1, 1
.L80248804:
/* 1770E4 80248804 02621021 */  addu      $v0, $s3, $v0
/* 1770E8 80248808 90420141 */  lbu       $v0, 0x141($v0)
/* 1770EC 8024880C 00021080 */  sll       $v0, $v0, 2
/* 1770F0 80248810 02621021 */  addu      $v0, $s3, $v0
/* 1770F4 80248814 8C5000E0 */  lw        $s0, 0xE0($v0)
D_80248818:
/* 1770F8 80248818 12000005 */  beqz      $s0, .L80248830
.L8024881C:
/* 1770FC 8024881C 00000000 */   nop
/* 177100 80248820 8E020000 */  lw        $v0, 0x0($s0)
/* 177104 80248824 00431024 */  and       $v0, $v0, $v1
/* 177108 80248828 10400008 */  beqz      $v0, D_8024884C
.L8024882C:
/* 17710C 8024882C 00051040 */   sll      $v0, $a1, 1
.L80248830:
/* 177110 80248830 82620171 */  lb        $v0, 0x171($s3)
/* 177114 80248834 24A50001 */  addiu     $a1, $a1, 0x1
/* 177118 80248838 00A2102A */  slt       $v0, $a1, $v0
/* 17711C 8024883C 5040FFF0 */  beql      $v0, $zero, .L80248800
/* 177120 80248840 0000282D */   daddu    $a1, $zero, $zero
/* 177124 80248844 08092201 */  j         .L80248804
.L80248848:
/* 177128 80248848 00051040 */   sll      $v0, $a1, 1
D_8024884C:
/* 17712C 8024884C 02621021 */  addu      $v0, $s3, $v0
D_80248850:
/* 177130 80248850 94430140 */  lhu       $v1, 0x140($v0)
/* 177134 80248854 82620171 */  lb        $v0, 0x171($s3)
/* 177138 80248858 24A50001 */  addiu     $a1, $a1, 0x1
/* 17713C 8024885C AE700174 */  sw        $s0, 0x174($s3)
D_80248860:
/* 177140 80248860 00A2102A */  slt       $v0, $a1, $v0
D_80248864:
/* 177144 80248864 14400002 */  bnez      $v0, .L80248870
D_80248868:
/* 177148 80248868 A6630172 */   sh       $v1, 0x172($s3)
/* 17714C 8024886C 0000282D */  daddu     $a1, $zero, $zero
.L80248870:
/* 177150 80248870 86640172 */  lh        $a0, 0x172($s3)
/* 177154 80248874 0C09390F */  jal       func_8024E43C
D_80248878:
/* 177158 80248878 A2650170 */   sb       $a1, 0x170($s3)
/* 17715C 8024887C 8E700174 */  lw        $s0, 0x174($s3)
/* 177160 80248880 0C098F18 */  jal       reset_actor_turn_info
/* 177164 80248884 00000000 */   nop
/* 177168 80248888 24020001 */  addiu     $v0, $zero, 0x1
/* 17716C 8024888C 2405000A */  addiu     $a1, $zero, 0xA
.L80248890:
/* 177170 80248890 A26201A7 */  sb        $v0, 0x1A7($s3)
/* 177174 80248894 8E0401C4 */  lw        $a0, 0x1C4($s0)
/* 177178 80248898 0C0B0CF8 */  jal       start_script
/* 17717C 8024889C 0000302D */   daddu    $a2, $zero, $zero
/* 177180 802488A0 AE0201D4 */  sw        $v0, 0x1D4($s0)
/* 177184 802488A4 8C440144 */  lw        $a0, 0x144($v0)
D_802488A8:
/* 177188 802488A8 24030003 */  addiu     $v1, $zero, 0x3
/* 17718C 802488AC 3C01802A */  lui       $at, %hi(D_8029F248)
/* 177190 802488B0 AC23F248 */  sw        $v1, %lo(D_8029F248)($at)
/* 177194 802488B4 AE0401E4 */  sw        $a0, 0x1E4($s0)
D_802488B8:
/* 177198 802488B8 86640172 */  lh        $a0, 0x172($s3)
.L802488BC:
/* 17719C 802488BC 24030002 */  addiu     $v1, $zero, 0x2
.L802488C0:
/* 1771A0 802488C0 3C01800E */  lui       $at, %hi(gBattleSubState)
/* 1771A4 802488C4 AC23C4DC */  sw        $v1, %lo(gBattleSubState)($at)
.L802488C8:
/* 1771A8 802488C8 080922A1 */  j         .L80248A84
D_802488CC:
/* 1771AC 802488CC AC440148 */   sw       $a0, 0x148($v0)
.L802488D0:
/* 1771B0 802488D0 3C03802A */  lui       $v1, %hi(D_8029F248)
/* 1771B4 802488D4 2463F248 */  addiu     $v1, $v1, %lo(D_8029F248)
/* 1771B8 802488D8 8C620000 */  lw        $v0, 0x0($v1)
/* 1771BC 802488DC 10400003 */  beqz      $v0, .L802488EC
/* 1771C0 802488E0 2442FFFF */   addiu    $v0, $v0, -0x1
/* 1771C4 802488E4 0809223E */  j         .L802488F8
/* 1771C8 802488E8 AC620000 */   sw       $v0, 0x0($v1)
.L802488EC:
/* 1771CC 802488EC 24020001 */  addiu     $v0, $zero, 0x1
/* 1771D0 802488F0 3C01802A */  lui       $at, %hi(D_8029F254)
/* 1771D4 802488F4 AC22F254 */  sw        $v0, %lo(D_8029F254)($at)
.L802488F8:
/* 1771D8 802488F8 8E700174 */  lw        $s0, 0x174($s3)
/* 1771DC 802488FC 8E0201D4 */  lw        $v0, 0x1D4($s0)
.L80248900:
/* 1771E0 80248900 50400007 */  beql      $v0, $zero, .L80248920
.L80248904:
/* 1771E4 80248904 AE0001D4 */   sw       $zero, 0x1D4($s0)
/* 1771E8 80248908 8E0401E4 */  lw        $a0, 0x1E4($s0)
/* 1771EC 8024890C 0C0B1059 */  jal       does_script_exist
D_80248910:
/* 1771F0 80248910 00000000 */   nop
/* 1771F4 80248914 1440005B */  bnez      $v0, .L80248A84
/* 1771F8 80248918 00000000 */   nop
D_8024891C:
/* 1771FC 8024891C AE0001D4 */  sw        $zero, 0x1D4($s0)
.L80248920:
/* 177200 80248920 8E4201D8 */  lw        $v0, 0x1D8($s2)
jan_02_Quizmo_Worker:
/* 177204 80248924 10400005 */  beqz      $v0, .L8024893C
.L80248928:
/* 177208 80248928 00000000 */   nop
/* 17720C 8024892C 0C0B1059 */  jal       does_script_exist
.L80248930:
/* 177210 80248930 8E4401E8 */   lw       $a0, 0x1E8($s2)
/* 177214 80248934 14400053 */  bnez      $v0, .L80248A84
jan_02_Quizmo_AnswerResult:
/* 177218 80248938 00000000 */   nop
.L8024893C:
/* 17721C 8024893C 1220000A */  beqz      $s1, .L80248968
jan_02_Quizmo_StageEffect:
/* 177220 80248940 AE4001D8 */   sw       $zero, 0x1D8($s2)
jan_02_Quizmo_AudienceEffect:
/* 177224 80248944 8E2201D8 */  lw        $v0, 0x1D8($s1)
jan_02_Quizmo_VannaTEffect:
/* 177228 80248948 50400007 */  beql      $v0, $zero, .L80248968
/* 17722C 8024894C AE2001D8 */   sw       $zero, 0x1D8($s1)
/* 177230 80248950 8E2401E8 */  lw        $a0, 0x1E8($s1)
/* 177234 80248954 0C0B1059 */  jal       does_script_exist
/* 177238 80248958 00000000 */   nop
/* 17723C 8024895C 14400049 */  bnez      $v0, .L80248A84
/* 177240 80248960 00000000 */   nop
.L80248964:
/* 177244 80248964 AE2001D8 */  sw        $zero, 0x1D8($s1)
.L80248968:
/* 177248 80248968 0000A02D */  daddu     $s4, $zero, $zero
.L8024896C:
/* 17724C 8024896C 0280882D */  daddu     $s1, $s4, $zero
D_80248970:
/* 177250 80248970 0260902D */  daddu     $s2, $s3, $zero
.L80248974:
/* 177254 80248974 8E5000E0 */  lw        $s0, 0xE0($s2)
D_80248978:
/* 177258 80248978 5200000B */  beql      $s0, $zero, .L802489A8
/* 17725C 8024897C 26310001 */   addiu    $s1, $s1, 0x1
D_80248980:
/* 177260 80248980 8E0201D4 */  lw        $v0, 0x1D4($s0)
.L80248984:
/* 177264 80248984 50400008 */  beql      $v0, $zero, .L802489A8
/* 177268 80248988 26310001 */   addiu    $s1, $s1, 0x1
/* 17726C 8024898C 8E0401E4 */  lw        $a0, 0x1E4($s0)
/* 177270 80248990 0C0B1059 */  jal       does_script_exist
.L80248994:
/* 177274 80248994 00000000 */   nop
/* 177278 80248998 50400002 */  beql      $v0, $zero, .L802489A4
/* 17727C 8024899C AE0001D4 */   sw       $zero, 0x1D4($s0)
D_802489A0:
/* 177280 802489A0 24140001 */  addiu     $s4, $zero, 0x1
.L802489A4:
/* 177284 802489A4 26310001 */  addiu     $s1, $s1, 0x1
.L802489A8:
/* 177288 802489A8 2A220018 */  slti      $v0, $s1, 0x18
/* 17728C 802489AC 1440FFF1 */  bnez      $v0, .L80248974
/* 177290 802489B0 26520004 */   addiu    $s2, $s2, 0x4
/* 177294 802489B4 16800033 */  bnez      $s4, .L80248A84
/* 177298 802489B8 0000882D */   daddu    $s1, $zero, $zero
/* 17729C 802489BC 0260902D */  daddu     $s2, $s3, $zero
.L802489C0:
/* 1772A0 802489C0 8E5000E0 */  lw        $s0, 0xE0($s2)
/* 1772A4 802489C4 5200000B */  beql      $s0, $zero, .L802489F4
.L802489C8:
/* 1772A8 802489C8 26310001 */   addiu    $s1, $s1, 0x1
/* 1772AC 802489CC 8E0201D8 */  lw        $v0, 0x1D8($s0)
D_802489D0:
/* 1772B0 802489D0 50400008 */  beql      $v0, $zero, .L802489F4
/* 1772B4 802489D4 26310001 */   addiu    $s1, $s1, 0x1
.L802489D8:
/* 1772B8 802489D8 8E0401E8 */  lw        $a0, 0x1E8($s0)
.L802489DC:
/* 1772BC 802489DC 0C0B1059 */  jal       does_script_exist
/* 1772C0 802489E0 00000000 */   nop
/* 1772C4 802489E4 50400002 */  beql      $v0, $zero, .L802489F0
/* 1772C8 802489E8 AE0001D8 */   sw       $zero, 0x1D8($s0)
/* 1772CC 802489EC 24140001 */  addiu     $s4, $zero, 0x1
.L802489F0:
/* 1772D0 802489F0 26310001 */  addiu     $s1, $s1, 0x1
.L802489F4:
/* 1772D4 802489F4 2A220018 */  slti      $v0, $s1, 0x18
/* 1772D8 802489F8 1440FFF1 */  bnez      $v0, .L802489C0
.L802489FC:
/* 1772DC 802489FC 26520004 */   addiu    $s2, $s2, 0x4
/* 1772E0 80248A00 16800020 */  bnez      $s4, .L80248A84
/* 1772E4 80248A04 0000882D */   daddu    $s1, $zero, $zero
/* 1772E8 80248A08 3C06FFF7 */  lui       $a2, (0xFFF7FFFF >> 16)
/* 1772EC 80248A0C 34C6FFFF */  ori       $a2, $a2, (0xFFF7FFFF & 0xFFFF)
/* 1772F0 80248A10 0260282D */  daddu     $a1, $s3, $zero
/* 1772F4 80248A14 3C02800E */  lui       $v0, %hi(gBattleStatus)
D_80248A18:
/* 1772F8 80248A18 2442C070 */  addiu     $v0, $v0, %lo(gBattleStatus)
/* 1772FC 80248A1C 8C430004 */  lw        $v1, 0x4($v0)
/* 177300 80248A20 2404BFFF */  addiu     $a0, $zero, -0x4001
/* 177304 80248A24 00641824 */  and       $v1, $v1, $a0
/* 177308 80248A28 AC430004 */  sw        $v1, 0x4($v0)
.L80248A2C:
/* 17730C 80248A2C 8CB000E0 */  lw        $s0, 0xE0($a1)
/* 177310 80248A30 12000004 */  beqz      $s0, .L80248A44
D_80248A34:
/* 177314 80248A34 26310001 */   addiu    $s1, $s1, 0x1
/* 177318 80248A38 8E020000 */  lw        $v0, 0x0($s0)
/* 17731C 80248A3C 00461024 */  and       $v0, $v0, $a2
/* 177320 80248A40 AE020000 */  sw        $v0, 0x0($s0)
.L80248A44:
/* 177324 80248A44 2A220018 */  slti      $v0, $s1, 0x18
.L80248A48:
/* 177328 80248A48 1440FFF8 */  bnez      $v0, .L80248A2C
.L80248A4C:
/* 17732C 80248A4C 24A50004 */   addiu    $a1, $a1, 0x4
D_80248A50:
/* 177330 80248A50 8262008C */  lb        $v0, 0x8C($s3)
/* 177334 80248A54 1440000B */  bnez      $v0, .L80248A84
/* 177338 80248A58 00000000 */   nop
.L80248A5C:
/* 17733C 80248A5C 0C098D19 */  jal       btl_check_player_defeated
/* 177340 80248A60 00000000 */   nop
/* 177344 80248A64 14400007 */  bnez      $v0, .L80248A84
D_80248A68:
/* 177348 80248A68 00000000 */   nop
/* 17734C 80248A6C 0C098D0D */  jal       btl_check_enemies_defeated
/* 177350 80248A70 00000000 */   nop
/* 177354 80248A74 14400003 */  bnez      $v0, .L80248A84
/* 177358 80248A78 00000000 */   nop
/* 17735C 80248A7C 0C090464 */  jal       func_80241190
glabel func_80248A80
/* 177360 80248A80 24040005 */   addiu    $a0, $zero, 0x5
.L80248A84:
/* 177364 80248A84 8FBF0024 */  lw        $ra, 0x24($sp)
.L80248A88:
/* 177368 80248A88 8FB40020 */  lw        $s4, 0x20($sp)
/* 17736C 80248A8C 8FB3001C */  lw        $s3, 0x1C($sp)
/* 177370 80248A90 8FB20018 */  lw        $s2, 0x18($sp)
/* 177374 80248A94 8FB10014 */  lw        $s1, 0x14($sp)
D_80248A98:
/* 177378 80248A98 8FB00010 */  lw        $s0, 0x10($sp)
.L80248A9C:
/* 17737C 80248A9C 03E00008 */  jr        $ra
D_80248AA0:
/* 177380 80248AA0 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

void btl_state_update_enemy_striking_first(void) {
    PlayerData* playerData = &gPlayerData;
    BattleStatus* battleStatus = &gBattleStatus;
    Actor* player = battleStatus->playerActor;
    Actor* partner = battleStatus->partnerActor;
    Evt* script;
    Actor* actor;
    u16* enemyIDs;
    s16 activeEnemyActorID;
    s32 nextEnemyIdx;
    s32 count;
    s32 flags;
    s32 cond;
    s32 i;
    s32 j;

    switch (gBattleSubState) {
        case BTL_SUBSTATE_ENEMY_FIRST_STRIKE_INIT:
            battleStatus->stateFreezeCount = 0;
            battleStatus->lastAttackDamage = 0;
            battleStatus->currentDamageSource = DMG_SRC_DEFAULT;
            playerData->enemyFirstStrikes++;
            battleStatus->flags1 &= ~BS_FLAGS1_MENU_OPEN;
            D_8029F254 = 0;
            player->flags &= ~ACTOR_FLAG_8000000;
            if (partner != NULL) {
                partner->flags &= ~ACTOR_FLAG_8000000;
            }
            battleStatus->flags2 |= BS_FLAGS2_1000000;
            battleStatus->flags2 |= BS_FLAGS2_4000;
            count = 0;

            for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
                actor = battleStatus->enemyActors[i];
                if (actor != NULL) {
                    battleStatus->enemyIDs[count] = i | ACTOR_ENEMY0;
                    count++;
                }
            }

            battleStatus->numEnemyActors = count;

            enemyIDs = battleStatus->enemyIDs;
            for (i = 0; i < count - 1; i++) {
                for (j = i + 1; j < count; j++) {
                    s32 iVal = enemyIDs[i];
                    s32 jVal = enemyIDs[j];

                    if (battleStatus->enemyActors[iVal & 0xFF]->turnPriority <
                        battleStatus->enemyActors[jVal & 0xFF]->turnPriority)
                    {
                        enemyIDs[i] = jVal;
                        enemyIDs[j] = iVal;
                    }
                }
            }

            battleStatus->nextEnemyIndex = 0;
            nextEnemyIdx = 0;
            flags = ACTOR_FLAG_NO_ATTACK | ACTOR_FLAG_TARGET_ONLY;

            while (TRUE) {
                actor = battleStatus->enemyActors[battleStatus->enemyIDs[nextEnemyIdx] & 0xFF];
                if (actor == NULL || (actor->flags & flags)) {
                    nextEnemyIdx++;
                    if (nextEnemyIdx >= battleStatus->numEnemyActors) {
                        nextEnemyIdx = 0;
                    }
                } else {
                    break;
                }
            }

            activeEnemyActorID = battleStatus->enemyIDs[nextEnemyIdx];
            nextEnemyIdx++;
            battleStatus->currentTurnEnemy = actor;
            battleStatus->activeEnemyActorID = activeEnemyActorID;
            if (nextEnemyIdx >= battleStatus->numEnemyActors) {
                nextEnemyIdx = 0;
            }
            battleStatus->nextEnemyIndex = nextEnemyIdx;
            btl_cam_target_actor(battleStatus->activeEnemyActorID);
            actor = battleStatus->currentTurnEnemy;
            reset_actor_turn_info();
            battleStatus->battlePhase = PHASE_FIRST_STRIKE;
            script = start_script(actor->takeTurnSource, EVT_PRIORITY_A, 0);
            actor->takeTurnScript = script;
            D_8029F248 = 3;
            actor->takeTurnScriptID = script->id;
            gBattleSubState = BTL_SUBSTATE_ENEMY_FIRST_STRIKE_AWAIT_SCRIPTS;
            script->owner1.actorID = battleStatus->activeEnemyActorID;
            break;
        case BTL_SUBSTATE_ENEMY_FIRST_STRIKE_AWAIT_SCRIPTS:
            if (D_8029F248 != 0) {
                D_8029F248--;
            } else {
                D_8029F254 = 1;
            }

            actor = battleStatus->currentTurnEnemy;
            if (actor->takeTurnScript == NULL || !does_script_exist(actor->takeTurnScriptID)) {
                actor->takeTurnScript = NULL;

                if (player->handleEventScript == NULL || !does_script_exist(player->handleEventScriptID)) {
                    player->handleEventScript = NULL;

                    if (partner != NULL) {
                        if (partner->handleEventScript == NULL || !does_script_exist(partner->handleEventScriptID)) {
                            partner->handleEventScript = NULL;
                        } else {
                            return;
                        }
                    }

                    cond = FALSE;

                    for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
                        actor = battleStatus->enemyActors[i];
                        if (actor != NULL && actor->takeTurnScript != NULL) {
                            if (does_script_exist(actor->takeTurnScriptID)) {
                                cond = TRUE;
                            } else {
                                actor->takeTurnScript = NULL;
                            }
                        }
                    }

                    if (!cond) {
                        for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
                            actor = battleStatus->enemyActors[i];
                            if (actor != NULL && actor->handleEventScript != NULL) {
                                if (does_script_exist(actor->handleEventScriptID)) {
                                    cond = TRUE;
                                } else {
                                    actor->handleEventScript = NULL;
                                }
                            }
                        }

                        if (!cond) {
                            gBattleStatus.flags2 &= ~BS_FLAGS2_4000;
                            for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
                                actor = battleStatus->enemyActors[i];
                                if (actor != NULL) {
                                    actor->flags &= ~ACTOR_FLAG_HEALTH_BAR_HIDDEN;
                                }
                            }

                            if (battleStatus->stateFreezeCount == 0) {
                                if (btl_check_player_defeated() || btl_check_enemies_defeated()) {
                                    return;
                                }
                                btl_set_state(BATTLE_STATE_BEGIN_TURN);
                            }
                        }
                    }
                }
            }
            break;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel appendGfx_animator_node
/* B6154 8011FA54 27BDFFC0 */  addiu     $sp, $sp, -0x40
/* B6158 8011FA58 AFB60030 */  sw        $s6, 0x30($sp)
/* B615C 8011FA5C 00A0B02D */  daddu     $s6, $a1, $zero
/* B6160 8011FA60 AFBF003C */  sw        $ra, 0x3C($sp)
/* B6164 8011FA64 AFBE0038 */  sw        $fp, 0x38($sp)
/* B6168 8011FA68 AFB70034 */  sw        $s7, 0x34($sp)
/* B616C 8011FA6C AFB5002C */  sw        $s5, 0x2C($sp)
/* B6170 8011FA70 AFB40028 */  sw        $s4, 0x28($sp)
/* B6174 8011FA74 AFB30024 */  sw        $s3, 0x24($sp)
/* B6178 8011FA78 AFB20020 */  sw        $s2, 0x20($sp)
/* B617C 8011FA7C AFB1001C */  sw        $s1, 0x1C($sp)
/* B6180 8011FA80 AFB00018 */  sw        $s0, 0x18($sp)
/* B6184 8011FA84 AFA40040 */  sw        $a0, 0x40($sp)
/* B6188 8011FA88 96C200F4 */  lhu       $v0, 0xF4($s6)
/* B618C 8011FA8C 30420080 */  andi      $v0, $v0, 0x80
/* B6190 8011FA90 10400015 */  beqz      $v0, .L8011FAE8
/* B6194 8011FA94 00C0982D */   daddu    $s3, $a2, $zero
/* B6198 8011FA98 0000882D */  daddu     $s1, $zero, $zero
/* B619C 8011FA9C 26D200B4 */  addiu     $s2, $s6, 0xB4
/* B61A0 8011FAA0 02C0802D */  daddu     $s0, $s6, $zero
.L8011FAA4:
/* B61A4 8011FAA4 8E020004 */  lw        $v0, 0x4($s0)
/* B61A8 8011FAA8 5040000A */  beql      $v0, $zero, .L8011FAD4
/* B61AC 8011FAAC 26310001 */   addiu    $s1, $s1, 0x1
/* B61B0 8011FAB0 0240202D */  daddu     $a0, $s2, $zero
/* B61B4 8011FAB4 0260282D */  daddu     $a1, $s3, $zero
/* B61B8 8011FAB8 0C019D80 */  jal       guMtxCatF
/* B61BC 8011FABC 0240302D */   daddu    $a2, $s2, $zero
/* B61C0 8011FAC0 8FA40040 */  lw        $a0, 0x40($sp)
/* B61C4 8011FAC4 8E050004 */  lw        $a1, 0x4($s0)
/* B61C8 8011FAC8 0C047E95 */  jal       appendGfx_animator_node
/* B61CC 8011FACC 0240302D */   daddu    $a2, $s2, $zero
/* B61D0 8011FAD0 26310001 */  addiu     $s1, $s1, 0x1
.L8011FAD4:
/* B61D4 8011FAD4 2A220020 */  slti      $v0, $s1, 0x20
/* B61D8 8011FAD8 1440FFF2 */  bnez      $v0, .L8011FAA4
/* B61DC 8011FADC 26100004 */   addiu    $s0, $s0, 0x4
/* B61E0 8011FAE0 08047FD1 */  j         .L8011FF44
/* B61E4 8011FAE4 00000000 */   nop
.L8011FAE8:
/* B61E8 8011FAE8 26D000B4 */  addiu     $s0, $s6, 0xB4
/* B61EC 8011FAEC 0200202D */  daddu     $a0, $s0, $zero
/* B61F0 8011FAF0 0260282D */  daddu     $a1, $s3, $zero
/* B61F4 8011FAF4 0C019D80 */  jal       guMtxCatF
/* B61F8 8011FAF8 0200302D */   daddu    $a2, $s0, $zero
/* B61FC 8011FAFC 3C120001 */  lui       $s2, (0x11630 >> 16)
/* B6200 8011FB00 36521630 */  ori       $s2, $s2, (0x11630 & 0xFFFF)
/* B6204 8011FB04 0200202D */  daddu     $a0, $s0, $zero
/* B6208 8011FB08 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* B620C 8011FB0C 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* B6210 8011FB10 3C11800A */  lui       $s1, %hi(gDisplayContext)
/* B6214 8011FB14 2631A674 */  addiu     $s1, $s1, %lo(gDisplayContext)
/* B6218 8011FB18 96050000 */  lhu       $a1, 0x0($s0)
/* B621C 8011FB1C 8E220000 */  lw        $v0, 0x0($s1)
/* B6220 8011FB20 00052980 */  sll       $a1, $a1, 6
/* B6224 8011FB24 00B22821 */  addu      $a1, $a1, $s2
/* B6228 8011FB28 0C019D40 */  jal       guMtxF2L
/* B622C 8011FB2C 00452821 */   addu     $a1, $v0, $a1
/* B6230 8011FB30 3C03DA38 */  lui       $v1, (0xDA380003 >> 16)
/* B6234 8011FB34 34630003 */  ori       $v1, $v1, (0xDA380003 & 0xFFFF)
/* B6238 8011FB38 3C05E300 */  lui       $a1, (0xE3000F00 >> 16)
/* B623C 8011FB3C 34A50F00 */  ori       $a1, $a1, (0xE3000F00 & 0xFFFF)
/* B6240 8011FB40 3C06E300 */  lui       $a2, (0xE3001001 >> 16)
/* B6244 8011FB44 34C61001 */  ori       $a2, $a2, (0xE3001001 & 0xFFFF)
/* B6248 8011FB48 3C07D9FD */  lui       $a3, (0xD9FDFFFF >> 16)
/* B624C 8011FB4C 3C09800A */  lui       $t1, %hi(gMainGfxPos)
/* B6250 8011FB50 2529A66C */  addiu     $t1, $t1, %lo(gMainGfxPos)
/* B6254 8011FB54 34E7FFFF */  ori       $a3, $a3, (0xD9FDFFFF & 0xFFFF)
/* B6258 8011FB58 8D280000 */  lw        $t0, 0x0($t1)
/* B625C 8011FB5C 96020000 */  lhu       $v0, 0x0($s0)
/* B6260 8011FB60 0100202D */  daddu     $a0, $t0, $zero
/* B6264 8011FB64 25080008 */  addiu     $t0, $t0, 0x8
/* B6268 8011FB68 AD280000 */  sw        $t0, 0x0($t1)
/* B626C 8011FB6C AC830000 */  sw        $v1, 0x0($a0)
/* B6270 8011FB70 24430001 */  addiu     $v1, $v0, 0x1
/* B6274 8011FB74 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* B6278 8011FB78 00021180 */  sll       $v0, $v0, 6
/* B627C 8011FB7C A6030000 */  sh        $v1, 0x0($s0)
/* B6280 8011FB80 8E230000 */  lw        $v1, 0x0($s1)
/* B6284 8011FB84 00521021 */  addu      $v0, $v0, $s2
/* B6288 8011FB88 00621821 */  addu      $v1, $v1, $v0
/* B628C 8011FB8C 25020008 */  addiu     $v0, $t0, 0x8
/* B6290 8011FB90 AC830004 */  sw        $v1, 0x4($a0)
/* B6294 8011FB94 AD220000 */  sw        $v0, 0x0($t1)
/* B6298 8011FB98 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* B629C 8011FB9C AD020000 */  sw        $v0, 0x0($t0)
/* B62A0 8011FBA0 25020010 */  addiu     $v0, $t0, 0x10
/* B62A4 8011FBA4 AD000004 */  sw        $zero, 0x4($t0)
/* B62A8 8011FBA8 AD220000 */  sw        $v0, 0x0($t1)
/* B62AC 8011FBAC 3C02D700 */  lui       $v0, (0xD7000000 >> 16)
/* B62B0 8011FBB0 AD020008 */  sw        $v0, 0x8($t0)
/* B62B4 8011FBB4 25020018 */  addiu     $v0, $t0, 0x18
/* B62B8 8011FBB8 AD00000C */  sw        $zero, 0xC($t0)
/* B62BC 8011FBBC AD220000 */  sw        $v0, 0x0($t1)
/* B62C0 8011FBC0 25020020 */  addiu     $v0, $t0, 0x20
/* B62C4 8011FBC4 AD050010 */  sw        $a1, 0x10($t0)
/* B62C8 8011FBC8 AD000014 */  sw        $zero, 0x14($t0)
/* B62CC 8011FBCC AD220000 */  sw        $v0, 0x0($t1)
/* B62D0 8011FBD0 25020028 */  addiu     $v0, $t0, 0x28
/* B62D4 8011FBD4 AD060018 */  sw        $a2, 0x18($t0)
/* B62D8 8011FBD8 AD00001C */  sw        $zero, 0x1C($t0)
/* B62DC 8011FBDC AD220000 */  sw        $v0, 0x0($t1)
/* B62E0 8011FBE0 AD070020 */  sw        $a3, 0x20($t0)
/* B62E4 8011FBE4 AD000024 */  sw        $zero, 0x24($t0)
/* B62E8 8011FBE8 8FAA0040 */  lw        $t2, 0x40($sp)
/* B62EC 8011FBEC 8D420000 */  lw        $v0, 0x0($t2)
/* B62F0 8011FBF0 3C030001 */  lui       $v1, (0x10000 >> 16)
/* B62F4 8011FBF4 00431024 */  and       $v0, $v0, $v1
/* B62F8 8011FBF8 10400007 */  beqz      $v0, .L8011FC18
/* B62FC 8011FBFC 3C02D9FF */   lui      $v0, (0xD9FFFFFF >> 16)
/* B6300 8011FC00 3442FFFF */  ori       $v0, $v0, (0xD9FFFFFF & 0xFFFF)
/* B6304 8011FC04 25030030 */  addiu     $v1, $t0, 0x30
/* B6308 8011FC08 AD230000 */  sw        $v1, 0x0($t1)
/* B630C 8011FC0C AD020028 */  sw        $v0, 0x28($t0)
/* B6310 8011FC10 24020400 */  addiu     $v0, $zero, 0x400
/* B6314 8011FC14 AD02002C */  sw        $v0, 0x2C($t0)
.L8011FC18:
/* B6318 8011FC18 3C028015 */  lui       $v0, %hi(gAnimModelFogEnabled)
/* B631C 8011FC1C 8C423A44 */  lw        $v0, %lo(gAnimModelFogEnabled)($v0)
/* B6320 8011FC20 1440000C */  bnez      $v0, .L8011FC54
/* B6324 8011FC24 3C04FC12 */   lui      $a0, (0xFC121E04 >> 16)
/* B6328 8011FC28 3C05FCFF */  lui       $a1, (0xFCFFFFFF >> 16)
/* B632C 8011FC2C 34A5FFFF */  ori       $a1, $a1, (0xFCFFFFFF & 0xFFFF)
/* B6330 8011FC30 3C04FFFC */  lui       $a0, (0xFFFCF279 >> 16)
/* B6334 8011FC34 8D220000 */  lw        $v0, 0x0($t1)
/* B6338 8011FC38 3484F279 */  ori       $a0, $a0, (0xFFFCF279 & 0xFFFF)
/* B633C 8011FC3C 0040182D */  daddu     $v1, $v0, $zero
/* B6340 8011FC40 24420008 */  addiu     $v0, $v0, 0x8
/* B6344 8011FC44 AD220000 */  sw        $v0, 0x0($t1)
/* B6348 8011FC48 AC650000 */  sw        $a1, 0x0($v1)
/* B634C 8011FC4C 08047F1D */  j         .L8011FC74
/* B6350 8011FC50 AC640004 */   sw       $a0, 0x4($v1)
.L8011FC54:
/* B6354 8011FC54 8D220000 */  lw        $v0, 0x0($t1)
/* B6358 8011FC58 34841E04 */  ori       $a0, $a0, (0xFC121E04 & 0xFFFF)
/* B635C 8011FC5C 0040182D */  daddu     $v1, $v0, $zero
/* B6360 8011FC60 24420008 */  addiu     $v0, $v0, 0x8
/* B6364 8011FC64 AD220000 */  sw        $v0, 0x0($t1)
/* B6368 8011FC68 2402F3F8 */  addiu     $v0, $zero, -0xC08
/* B636C 8011FC6C AC640000 */  sw        $a0, 0x0($v1)
/* B6370 8011FC70 AC620004 */  sw        $v0, 0x4($v1)
.L8011FC74:
/* B6374 8011FC74 3C10800A */  lui       $s0, %hi(gMainGfxPos)
/* B6378 8011FC78 2610A66C */  addiu     $s0, $s0, %lo(gMainGfxPos)
/* B637C 8011FC7C 8E020000 */  lw        $v0, 0x0($s0)
/* B6380 8011FC80 3C11E700 */  lui       $s1, (0xE7000000 >> 16)
/* B6384 8011FC84 0040182D */  daddu     $v1, $v0, $zero
/* B6388 8011FC88 AC710000 */  sw        $s1, 0x0($v1)
/* B638C 8011FC8C AC600004 */  sw        $zero, 0x4($v1)
/* B6390 8011FC90 8FAA0040 */  lw        $t2, 0x40($sp)
/* B6394 8011FC94 8D4302D4 */  lw        $v1, 0x2D4($t2)
/* B6398 8011FC98 24420008 */  addiu     $v0, $v0, 0x8
/* B639C 8011FC9C 10600004 */  beqz      $v1, .L8011FCB0
/* B63A0 8011FCA0 AE020000 */   sw       $v0, 0x0($s0)
/* B63A4 8011FCA4 8D4402D8 */  lw        $a0, 0x2D8($t2)
/* B63A8 8011FCA8 0060F809 */  jalr      $v1
/* B63AC 8011FCAC 00000000 */   nop
.L8011FCB0:
/* B63B0 8011FCB0 8E040000 */  lw        $a0, 0x0($s0)
/* B63B4 8011FCB4 0080102D */  daddu     $v0, $a0, $zero
/* B63B8 8011FCB8 AC510000 */  sw        $s1, 0x0($v0)
/* B63BC 8011FCBC AC400004 */  sw        $zero, 0x4($v0)
/* B63C0 8011FCC0 8EC50000 */  lw        $a1, 0x0($s6)
/* B63C4 8011FCC4 24840008 */  addiu     $a0, $a0, 0x8
/* B63C8 8011FCC8 10A00089 */  beqz      $a1, .L8011FEF0
/* B63CC 8011FCCC AE040000 */   sw       $a0, 0x0($s0)
/* B63D0 8011FCD0 86C200F8 */  lh        $v0, 0xF8($s6)
/* B63D4 8011FCD4 04410008 */  bgez      $v0, .L8011FCF8
/* B63D8 8011FCD8 240200DF */   addiu    $v0, $zero, 0xDF
/* B63DC 8011FCDC 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* B63E0 8011FCE0 AC820000 */  sw        $v0, 0x0($a0)
/* B63E4 8011FCE4 8EC30000 */  lw        $v1, 0x0($s6)
/* B63E8 8011FCE8 24820008 */  addiu     $v0, $a0, 0x8
/* B63EC 8011FCEC AE020000 */  sw        $v0, 0x0($s0)
/* B63F0 8011FCF0 08047FBC */  j         .L8011FEF0
/* B63F4 8011FCF4 AC830004 */   sw       $v1, 0x4($a0)
.L8011FCF8:
/* B63F8 8011FCF8 90A30000 */  lbu       $v1, 0x0($a1)
/* B63FC 8011FCFC 10620008 */  beq       $v1, $v0, .L8011FD20
/* B6400 8011FD00 0000202D */   daddu    $a0, $zero, $zero
/* B6404 8011FD04 0040302D */  daddu     $a2, $v0, $zero
/* B6408 8011FD08 24A20008 */  addiu     $v0, $a1, 0x8
.L8011FD0C:
/* B640C 8011FD0C 24840001 */  addiu     $a0, $a0, 0x1
/* B6410 8011FD10 8C450000 */  lw        $a1, 0x0($v0)
/* B6414 8011FD14 00051E02 */  srl       $v1, $a1, 24
/* B6418 8011FD18 1466FFFC */  bne       $v1, $a2, .L8011FD0C
/* B641C 8011FD1C 24420008 */   addiu    $v0, $v0, 0x8
.L8011FD20:
/* B6420 8011FD20 24840001 */  addiu     $a0, $a0, 0x1
/* B6424 8011FD24 0000182D */  daddu     $v1, $zero, $zero
/* B6428 8011FD28 3C058015 */  lui       $a1, %hi(D_801536C0)
/* B642C 8011FD2C 24A536C0 */  addiu     $a1, $a1, %lo(D_801536C0)
/* B6430 8011FD30 000310C0 */  sll       $v0, $v1, 3
.L8011FD34:
/* B6434 8011FD34 0045B821 */  addu      $s7, $v0, $a1
/* B6438 8011FD38 8EE20000 */  lw        $v0, 0x0($s7)
/* B643C 8011FD3C 04400006 */  bltz      $v0, .L8011FD58
/* B6440 8011FD40 28620060 */   slti     $v0, $v1, 0x60
/* B6444 8011FD44 24630001 */  addiu     $v1, $v1, 0x1
/* B6448 8011FD48 28620060 */  slti      $v0, $v1, 0x60
/* B644C 8011FD4C 1440FFF9 */  bnez      $v0, .L8011FD34
/* B6450 8011FD50 000310C0 */   sll      $v0, $v1, 3
/* B6454 8011FD54 28620060 */  slti      $v0, $v1, 0x60
.L8011FD58:
/* B6458 8011FD58 14400003 */  bnez      $v0, .L8011FD68
/* B645C 8011FD5C 00000000 */   nop
.L8011FD60:
/* B6460 8011FD60 08047F58 */  j         .L8011FD60
/* B6464 8011FD64 00000000 */   nop
.L8011FD68:
/* B6468 8011FD68 0C00AB0A */  jal       general_heap_malloc
/* B646C 8011FD6C 000420C0 */   sll      $a0, $a0, 3
/* B6470 8011FD70 0040982D */  daddu     $s3, $v0, $zero
/* B6474 8011FD74 16600003 */  bnez      $s3, .L8011FD84
/* B6478 8011FD78 AEF30004 */   sw       $s3, 0x4($s7)
.L8011FD7C:
/* B647C 8011FD7C 08047F5F */  j         .L8011FD7C
/* B6480 8011FD80 00000000 */   nop
.L8011FD84:
/* B6484 8011FD84 0000A82D */  daddu     $s5, $zero, $zero
/* B6488 8011FD88 24020003 */  addiu     $v0, $zero, 0x3
/* B648C 8011FD8C AEE20000 */  sw        $v0, 0x0($s7)
/* B6490 8011FD90 8EC20000 */  lw        $v0, 0x0($s6)
/* B6494 8011FD94 8C450000 */  lw        $a1, 0x0($v0)
/* B6498 8011FD98 8C470004 */  lw        $a3, 0x4($v0)
/* B649C 8011FD9C 240200DF */  addiu     $v0, $zero, 0xDF
/* B64A0 8011FDA0 00051E02 */  srl       $v1, $a1, 24
/* B64A4 8011FDA4 10620044 */  beq       $v1, $v0, .L8011FEB8
/* B64A8 8011FDA8 24140002 */   addiu    $s4, $zero, 0x2
/* B64AC 8011FDAC 3C1E0100 */  lui       $fp, (0x1000000 >> 16)
/* B64B0 8011FDB0 2672FFFC */  addiu     $s2, $s3, -0x4
.L8011FDB4:
/* B64B4 8011FDB4 24020001 */  addiu     $v0, $zero, 0x1
/* B64B8 8011FDB8 5462002F */  bnel      $v1, $v0, .L8011FE78
/* B64BC 8011FDBC 0260102D */   daddu    $v0, $s3, $zero
/* B64C0 8011FDC0 00451006 */  srlv      $v0, $a1, $v0
/* B64C4 8011FDC4 3051007F */  andi      $s1, $v0, 0x7F
/* B64C8 8011FDC8 00051302 */  srl       $v0, $a1, 12
/* B64CC 8011FDCC 305000FF */  andi      $s0, $v0, 0xFF
/* B64D0 8011FDD0 8EC200FC */  lw        $v0, 0xFC($s6)
/* B64D4 8011FDD4 14400010 */  bnez      $v0, .L8011FE18
/* B64D8 8011FDD8 02308823 */   subu     $s1, $s1, $s0
/* B64DC 8011FDDC 26520008 */  addiu     $s2, $s2, 0x8
/* B64E0 8011FDE0 26730008 */  addiu     $s3, $s3, 0x8
/* B64E4 8011FDE4 00101300 */  sll       $v0, $s0, 12
/* B64E8 8011FDE8 02301821 */  addu      $v1, $s1, $s0
/* B64EC 8011FDEC 3063007F */  andi      $v1, $v1, 0x7F
/* B64F0 8011FDF0 00031840 */  sll       $v1, $v1, 1
/* B64F4 8011FDF4 007E1825 */  or        $v1, $v1, $fp
/* B64F8 8011FDF8 86C400F8 */  lh        $a0, 0xF8($s6)
/* B64FC 8011FDFC 00431025 */  or        $v0, $v0, $v1
/* B6500 8011FE00 AE42FFFC */  sw        $v0, -0x4($s2)
/* B6504 8011FE04 00952021 */  addu      $a0, $a0, $s5
/* B6508 8011FE08 00042100 */  sll       $a0, $a0, 4
/* B650C 8011FE0C 00E41821 */  addu      $v1, $a3, $a0
/* B6510 8011FE10 08047F9C */  j         .L8011FE70
/* B6514 8011FE14 AE430000 */   sw       $v1, 0x0($s2)
.L8011FE18:
/* B6518 8011FE18 02C0282D */  daddu     $a1, $s6, $zero
/* B651C 8011FE1C 26520008 */  addiu     $s2, $s2, 0x8
/* B6520 8011FE20 8FA40040 */  lw        $a0, 0x40($sp)
/* B6524 8011FE24 86C200F8 */  lh        $v0, 0xF8($s6)
/* B6528 8011FE28 26730008 */  addiu     $s3, $s3, 0x8
/* B652C 8011FE2C AFB10010 */  sw        $s1, 0x10($sp)
/* B6530 8011FE30 AFB50014 */  sw        $s5, 0x14($sp)
/* B6534 8011FE34 00551021 */  addu      $v0, $v0, $s5
/* B6538 8011FE38 00023040 */  sll       $a2, $v0, 1
/* B653C 8011FE3C 00C23021 */  addu      $a2, $a2, $v0
/* B6540 8011FE40 00063040 */  sll       $a2, $a2, 1
/* B6544 8011FE44 00E63021 */  addu      $a2, $a3, $a2
/* B6548 8011FE48 0C0477A0 */  jal       animator_copy_vertices_to_buffer
/* B654C 8011FE4C 0200382D */   daddu    $a3, $s0, $zero
/* B6550 8011FE50 00102300 */  sll       $a0, $s0, 12
/* B6554 8011FE54 02301821 */  addu      $v1, $s1, $s0
/* B6558 8011FE58 3063007F */  andi      $v1, $v1, 0x7F
/* B655C 8011FE5C 00031840 */  sll       $v1, $v1, 1
/* B6560 8011FE60 007E1825 */  or        $v1, $v1, $fp
/* B6564 8011FE64 00832025 */  or        $a0, $a0, $v1
/* B6568 8011FE68 AE44FFFC */  sw        $a0, -0x4($s2)
/* B656C 8011FE6C AE420000 */  sw        $v0, 0x0($s2)
.L8011FE70:
/* B6570 8011FE70 08047FA2 */  j         .L8011FE88
/* B6574 8011FE74 02B0A821 */   addu     $s5, $s5, $s0
.L8011FE78:
/* B6578 8011FE78 26520008 */  addiu     $s2, $s2, 0x8
/* B657C 8011FE7C 26730008 */  addiu     $s3, $s3, 0x8
/* B6580 8011FE80 AC450000 */  sw        $a1, 0x0($v0)
/* B6584 8011FE84 AC470004 */  sw        $a3, 0x4($v0)
.L8011FE88:
/* B6588 8011FE88 00141080 */  sll       $v0, $s4, 2
/* B658C 8011FE8C 26940001 */  addiu     $s4, $s4, 0x1
/* B6590 8011FE90 00141880 */  sll       $v1, $s4, 2
/* B6594 8011FE94 8EC40000 */  lw        $a0, 0x0($s6)
/* B6598 8011FE98 00441021 */  addu      $v0, $v0, $a0
/* B659C 8011FE9C 00641821 */  addu      $v1, $v1, $a0
/* B65A0 8011FEA0 8C450000 */  lw        $a1, 0x0($v0)
/* B65A4 8011FEA4 240200DF */  addiu     $v0, $zero, 0xDF
/* B65A8 8011FEA8 8C670000 */  lw        $a3, 0x0($v1)
/* B65AC 8011FEAC 00051E02 */  srl       $v1, $a1, 24
/* B65B0 8011FEB0 1462FFC0 */  bne       $v1, $v0, .L8011FDB4
/* B65B4 8011FEB4 26940001 */   addiu    $s4, $s4, 0x1
.L8011FEB8:
/* B65B8 8011FEB8 3C05800A */  lui       $a1, %hi(gMainGfxPos)
/* B65BC 8011FEBC 24A5A66C */  addiu     $a1, $a1, %lo(gMainGfxPos)
/* B65C0 8011FEC0 0260202D */  daddu     $a0, $s3, $zero
/* B65C4 8011FEC4 8CA30000 */  lw        $v1, 0x0($a1)
/* B65C8 8011FEC8 3C02DF00 */  lui       $v0, (0xDF000000 >> 16)
/* B65CC 8011FECC AC820000 */  sw        $v0, 0x0($a0)
/* B65D0 8011FED0 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* B65D4 8011FED4 AC800004 */  sw        $zero, 0x4($a0)
/* B65D8 8011FED8 0060202D */  daddu     $a0, $v1, $zero
/* B65DC 8011FEDC AC820000 */  sw        $v0, 0x0($a0)
/* B65E0 8011FEE0 8EE20004 */  lw        $v0, 0x4($s7)
/* B65E4 8011FEE4 24630008 */  addiu     $v1, $v1, 0x8
/* B65E8 8011FEE8 ACA30000 */  sw        $v1, 0x0($a1)
/* B65EC 8011FEEC AC820004 */  sw        $v0, 0x4($a0)
.L8011FEF0:
/* B65F0 8011FEF0 0000882D */  daddu     $s1, $zero, $zero
/* B65F4 8011FEF4 3C03800A */  lui       $v1, %hi(gMainGfxPos)
/* B65F8 8011FEF8 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
/* B65FC 8011FEFC 8C620000 */  lw        $v0, 0x0($v1)
/* B6600 8011FF00 02C0802D */  daddu     $s0, $s6, $zero
/* B6604 8011FF04 0040202D */  daddu     $a0, $v0, $zero
/* B6608 8011FF08 24420008 */  addiu     $v0, $v0, 0x8
/* B660C 8011FF0C AC620000 */  sw        $v0, 0x0($v1)
/* B6610 8011FF10 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* B6614 8011FF14 AC820000 */  sw        $v0, 0x0($a0)
/* B6618 8011FF18 AC800004 */  sw        $zero, 0x4($a0)
.L8011FF1C:
/* B661C 8011FF1C 8E050004 */  lw        $a1, 0x4($s0)
/* B6620 8011FF20 50A00005 */  beql      $a1, $zero, .L8011FF38
/* B6624 8011FF24 26310001 */   addiu    $s1, $s1, 0x1
/* B6628 8011FF28 8FA40040 */  lw        $a0, 0x40($sp)
/* B662C 8011FF2C 0C047E95 */  jal       appendGfx_animator_node
/* B6630 8011FF30 26C600B4 */   addiu    $a2, $s6, 0xB4
/* B6634 8011FF34 26310001 */  addiu     $s1, $s1, 0x1
.L8011FF38:
/* B6638 8011FF38 2A220020 */  slti      $v0, $s1, 0x20
/* B663C 8011FF3C 1440FFF7 */  bnez      $v0, .L8011FF1C
/* B6640 8011FF40 26100004 */   addiu    $s0, $s0, 0x4
.L8011FF44:
/* B6644 8011FF44 8FBF003C */  lw        $ra, 0x3C($sp)
/* B6648 8011FF48 8FBE0038 */  lw        $fp, 0x38($sp)
/* B664C 8011FF4C 8FB70034 */  lw        $s7, 0x34($sp)
/* B6650 8011FF50 8FB60030 */  lw        $s6, 0x30($sp)
/* B6654 8011FF54 8FB5002C */  lw        $s5, 0x2C($sp)
/* B6658 8011FF58 8FB40028 */  lw        $s4, 0x28($sp)
/* B665C 8011FF5C 8FB30024 */  lw        $s3, 0x24($sp)
/* B6660 8011FF60 8FB20020 */  lw        $s2, 0x20($sp)
/* B6664 8011FF64 8FB1001C */  lw        $s1, 0x1C($sp)
/* B6668 8011FF68 8FB00018 */  lw        $s0, 0x18($sp)
/* B666C 8011FF6C 03E00008 */  jr        $ra
/* B6670 8011FF70 27BD0040 */   addiu    $sp, $sp, 0x40

### DECOMPILED C INSTRUCTIONS:

void appendGfx_animator_node(ModelAnimator* animator, AnimatorNode* node, Matrix4f mtx) {
    DisplayListBufferHandle* bufferHandle;
    u32 w0,w1;
    s32 cmd;
    s32 i;

    if (node->flags & MODEL_ANIMATOR_FLAG_HIDDEN) {
        for (i = 0; i < ARRAY_COUNT(node->children); i++) {
            if (node->children[i] != NULL) {
                guMtxCatF(node->mtx, mtx, node->mtx);
                appendGfx_animator_node(animator, node->children[i], node->mtx);
            }
        }
        return;
    }

    guMtxCatF(node->mtx, mtx, node->mtx);
    guMtxF2L(node->mtx, &gDisplayContext->matrixStack[gMatrixListPos]);
    gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
    gDPPipeSync(gMainGfxPos++);

    gSPTexture(gMainGfxPos++, 0, 0, 0, G_TX_RENDERTILE, G_OFF);
    gDPSetTextureLOD(gMainGfxPos++, G_TL_TILE);
    gDPSetTextureLUT(gMainGfxPos++, G_TT_NONE);
    gSPClearGeometryMode(gMainGfxPos++, G_LIGHTING);
    if (animator->flags & MODEL_ANIMATOR_FLAG_CULL_BACK) {
        gSPSetGeometryMode(gMainGfxPos++, G_CULL_BACK);
    }
    if (!gAnimModelFogEnabled) {
        gDPSetCombineMode(gMainGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA);
    } else {
        gDPSetCombineLERP(gMainGfxPos++, TEXEL0, 0, SHADE, 0, TEXEL0, 0, 0, TEXEL0, COMBINED, 0, SHADE, 0, 0, 0, 0, COMBINED);
    }
    gDPPipeSync(gMainGfxPos++);

    if (animator->fpRenderCallback != NULL) animator->fpRenderCallback(animator->renderCallbackArg);

    gDPPipeSync(gMainGfxPos++);

    if (node->displayList != NULL) {
        if (node->vertexStartOffset < 0) {
            gSPDisplayList(gMainGfxPos++, node->displayList);
        } else {
            Gfx* gfxPos;
            s32 vtxIdx, dlIdx;
            s32 j = 0;
            s32 k;

            if ((node->displayList[0].words.w0 >> 0x18) != G_ENDDL) {
                Gfx* gfxPtr = node->displayList;
                s32 endDL = G_ENDDL;

                for(;; j++) {
                    w0 = gfxPtr->words.w0;
                    gfxPtr++;
                    cmd = w0 >> 0x18;
                    if (cmd == endDL) {
                        break;
                    }
                }
            }
            j++;
            for (k = 0; k < ARRAY_COUNT(D_801536C0); k++) {
                bufferHandle = &D_801536C0[k];
                if (bufferHandle->ttl < 0) {
                    break;
                }
            }
            ASSERT(k < ARRAY_COUNT(D_801536C0));

            bufferHandle->addr = gfxPos = general_heap_malloc(j * sizeof(Gfx));
            ASSERT(gfxPos != NULL);
            bufferHandle->ttl = 3;

            vtxIdx = 0;
            dlIdx = 0;

            do {
                w0 = ((s32*)node->displayList)[dlIdx++];
                w1 = ((s32*)node->displayList)[dlIdx++];
                cmd = w0 >> 0x18;
                if (cmd == G_ENDDL) {
                    break;
                }
                if (cmd == G_VTX) {
                    s32 startIdx = _SHIFTR(w0,1,7);
                    s32 vtxCount = _SHIFTR(w0,12,8);
                    Vtx* newBuffer;

                    startIdx -= vtxCount;

                    if (node->fcData.vtxList == NULL) {
                        newBuffer = &((Vtx*)w1)[node->vertexStartOffset + vtxIdx];
                        gSPVertex(gfxPos++, newBuffer, vtxCount, startIdx);
                    } else {
                        newBuffer = animator_copy_vertices_to_buffer(
                            animator,
                            node,
                            (Vec3s*)(w1 + (node->vertexStartOffset + vtxIdx) * 0x6),
                            vtxCount,
                            startIdx,
                            vtxIdx
                        );
                        gSPVertex(gfxPos++, newBuffer, vtxCount, startIdx);
                    }
                    vtxIdx += vtxCount;
                } else {
                    Gfx* temp[1] = {gfxPos++}; // required to match
                    temp[0]->words.w0 = w0;
                    temp[0]->words.w1 = w1;
                }
            } while (TRUE);

            gSPEndDisplayList(gfxPos++);
            gSPDisplayList(gMainGfxPos++, bufferHandle->addr);
        }
    }
    gDPPipeSync(gMainGfxPos++);

    for (i = 0; i < ARRAY_COUNT(node->children); i++) {
        if (node->children[i] != NULL) {
            appendGfx_animator_node(animator, node->children[i], node->mtx);
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel thunderbolt_ring_appendGfx
/* 3B40E4 E00B0234 27BDFF10 */  addiu     $sp, $sp, -0xF0
/* 3B40E8 E00B0238 0080402D */  daddu     $t0, $a0, $zero
/* 3B40EC E00B023C 3C09DB06 */  lui       $t1, (0xDB060024 >> 16)
/* 3B40F0 E00B0240 35290024 */  ori       $t1, $t1, (0xDB060024 & 0xFFFF)
/* 3B40F4 E00B0244 27A40020 */  addiu     $a0, $sp, 0x20
/* 3B40F8 E00B0248 AFB000B0 */  sw        $s0, 0xB0($sp)
/* 3B40FC E00B024C 3C100001 */  lui       $s0, (0x11630 >> 16)
/* 3B4100 E00B0250 36101630 */  ori       $s0, $s0, (0x11630 & 0xFFFF)
/* 3B4104 E00B0254 AFB100B4 */  sw        $s1, 0xB4($sp)
/* 3B4108 E00B0258 0000882D */  daddu     $s1, $zero, $zero
/* 3B410C E00B025C AFB400C0 */  sw        $s4, 0xC0($sp)
/* 3B4110 E00B0260 27B40060 */  addiu     $s4, $sp, 0x60
/* 3B4114 E00B0264 3C028007 */  lui       $v0, %hi(gMatrixListPos)
/* 3B4118 E00B0268 244241F0 */  addiu     $v0, $v0, %lo(gMatrixListPos)
/* 3B411C E00B026C AFB500C4 */  sw        $s5, 0xC4($sp)
/* 3B4120 E00B0270 0040A82D */  daddu     $s5, $v0, $zero
/* 3B4124 E00B0274 3C02800A */  lui       $v0, %hi(gMainGfxPos)
/* 3B4128 E00B0278 2442A66C */  addiu     $v0, $v0, %lo(gMainGfxPos)
/* 3B412C E00B027C AFB200B8 */  sw        $s2, 0xB8($sp)
/* 3B4130 E00B0280 0040902D */  daddu     $s2, $v0, $zero
/* 3B4134 E00B0284 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 3B4138 E00B0288 AFBF00D4 */  sw        $ra, 0xD4($sp)
/* 3B413C E00B028C AFBE00D0 */  sw        $fp, 0xD0($sp)
/* 3B4140 E00B0290 AFB700CC */  sw        $s7, 0xCC($sp)
/* 3B4144 E00B0294 AFB600C8 */  sw        $s6, 0xC8($sp)
/* 3B4148 E00B0298 AFB300BC */  sw        $s3, 0xBC($sp)
/* 3B414C E00B029C F7B800E8 */  sdc1      $f24, 0xE8($sp)
/* 3B4150 E00B02A0 F7B600E0 */  sdc1      $f22, 0xE0($sp)
/* 3B4154 E00B02A4 F7B400D8 */  sdc1      $f20, 0xD8($sp)
/* 3B4158 E00B02A8 8E460000 */  lw        $a2, 0x0($s2)
/* 3B415C E00B02AC 44800000 */  mtc1      $zero, $f0
/* 3B4160 E00B02B0 8D13000C */  lw        $s3, 0xC($t0)
/* 3B4164 E00B02B4 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 3B4168 E00B02B8 4481C000 */  mtc1      $at, $f24
/* 3B416C E00B02BC 44050000 */  mfc1      $a1, $f0
/* 3B4170 E00B02C0 8E6A0014 */  lw        $t2, 0x14($s3)
/* 3B4174 E00B02C4 00C0182D */  daddu     $v1, $a2, $zero
/* 3B4178 E00B02C8 AFAA00A0 */  sw        $t2, 0xA0($sp)
/* 3B417C E00B02CC 8E6A0024 */  lw        $t2, 0x24($s3)
/* 3B4180 E00B02D0 4485A000 */  mtc1      $a1, $f20
/* 3B4184 E00B02D4 24C60008 */  addiu     $a2, $a2, 0x8
/* 3B4188 E00B02D8 AFAA00A4 */  sw        $t2, 0xA4($sp)
/* 3B418C E00B02DC AC620000 */  sw        $v0, 0x0($v1)
/* 3B4190 E00B02E0 AC600004 */  sw        $zero, 0x4($v1)
/* 3B4194 E00B02E4 ACC90000 */  sw        $t1, 0x0($a2)
/* 3B4198 E00B02E8 8D020010 */  lw        $v0, 0x10($t0)
/* 3B419C E00B02EC 3C088000 */  lui       $t0, (0x80000000 >> 16)
/* 3B41A0 E00B02F0 8C42001C */  lw        $v0, 0x1C($v0)
/* 3B41A4 E00B02F4 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 3B41A8 E00B02F8 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 3B41AC E00B02FC 00481021 */  addu      $v0, $v0, $t0
/* 3B41B0 E00B0300 ACC20004 */  sw        $v0, 0x4($a2)
/* 3B41B4 E00B0304 00031080 */  sll       $v0, $v1, 2
/* 3B41B8 E00B0308 00431021 */  addu      $v0, $v0, $v1
/* 3B41BC E00B030C 00021080 */  sll       $v0, $v0, 2
/* 3B41C0 E00B0310 00431023 */  subu      $v0, $v0, $v1
/* 3B41C4 E00B0314 000218C0 */  sll       $v1, $v0, 3
/* 3B41C8 E00B0318 00431021 */  addu      $v0, $v0, $v1
/* 3B41CC E00B031C 000210C0 */  sll       $v0, $v0, 3
/* 3B41D0 E00B0320 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 3B41D4 E00B0324 00220821 */  addu      $at, $at, $v0
/* 3B41D8 E00B0328 C4221DEC */  lwc1      $f2, %lo(gCameras + 0x6C)($at)
/* 3B41DC E00B032C C6600028 */  lwc1      $f0, 0x28($s3)
/* 3B41E0 E00B0330 3C1E0001 */  lui       $fp, (0x11630 >> 16)
/* 3B41E4 E00B0334 E7A00010 */  swc1      $f0, 0x10($sp)
/* 3B41E8 E00B0338 C6600004 */  lwc1      $f0, 0x4($s3)
/* 3B41EC E00B033C 37DE1630 */  ori       $fp, $fp, (0x11630 & 0xFFFF)
/* 3B41F0 E00B0340 AE460000 */  sw        $a2, 0x0($s2)
/* 3B41F4 E00B0344 24C60008 */  addiu     $a2, $a2, 0x8
/* 3B41F8 E00B0348 E7A00014 */  swc1      $f0, 0x14($sp)
/* 3B41FC E00B034C C6600008 */  lwc1      $f0, 0x8($s3)
/* 3B4200 E00B0350 46001087 */  neg.s     $f2, $f2
/* 3B4204 E00B0354 AE460000 */  sw        $a2, 0x0($s2)
/* 3B4208 E00B0358 44061000 */  mfc1      $a2, $f2
/* 3B420C E00B035C 2416005A */  addiu     $s6, $zero, 0x5A
/* 3B4210 E00B0360 E7A00018 */  swc1      $f0, 0x18($sp)
/* 3B4214 E00B0364 C660000C */  lwc1      $f0, 0xC($s3)
/* 3B4218 E00B0368 00A0382D */  daddu     $a3, $a1, $zero
/* 3B421C E00B036C 0C080180 */  jal       shim_guPositionF
/* 3B4220 E00B0370 E7A0001C */   swc1     $f0, 0x1C($sp)
/* 3B4224 E00B0374 27A40020 */  addiu     $a0, $sp, 0x20
/* 3B4228 E00B0378 96A50000 */  lhu       $a1, 0x0($s5)
/* 3B422C E00B037C 3C02800A */  lui       $v0, %hi(gDisplayContext)
/* 3B4230 E00B0380 8C42A674 */  lw        $v0, %lo(gDisplayContext)($v0)
/* 3B4234 E00B0384 00052980 */  sll       $a1, $a1, 6
/* 3B4238 E00B0388 00B02821 */  addu      $a1, $a1, $s0
/* 3B423C E00B038C 0C080118 */  jal       shim_guMtxF2L
/* 3B4240 E00B0390 00452821 */   addu     $a1, $v0, $a1
/* 3B4244 E00B0394 3C06DA38 */  lui       $a2, (0xDA380002 >> 16)
/* 3B4248 E00B0398 8E440000 */  lw        $a0, 0x0($s2)
/* 3B424C E00B039C 34C60002 */  ori       $a2, $a2, (0xDA380002 & 0xFFFF)
/* 3B4250 E00B03A0 0080282D */  daddu     $a1, $a0, $zero
/* 3B4254 E00B03A4 24840008 */  addiu     $a0, $a0, 0x8
/* 3B4258 E00B03A8 24820008 */  addiu     $v0, $a0, 0x8
/* 3B425C E00B03AC 0040B82D */  daddu     $s7, $v0, $zero
/* 3B4260 E00B03B0 96A20000 */  lhu       $v0, 0x0($s5)
/* 3B4264 E00B03B4 24830010 */  addiu     $v1, $a0, 0x10
/* 3B4268 E00B03B8 AFA300A8 */  sw        $v1, 0xA8($sp)
/* 3B426C E00B03BC AE440000 */  sw        $a0, 0x0($s2)
/* 3B4270 E00B03C0 ACA60000 */  sw        $a2, 0x0($a1)
/* 3B4274 E00B03C4 24430001 */  addiu     $v1, $v0, 0x1
/* 3B4278 E00B03C8 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 3B427C E00B03CC 00021180 */  sll       $v0, $v0, 6
/* 3B4280 E00B03D0 A6A30000 */  sh        $v1, 0x0($s5)
/* 3B4284 E00B03D4 3C03800A */  lui       $v1, %hi(gDisplayContext)
/* 3B4288 E00B03D8 8C63A674 */  lw        $v1, %lo(gDisplayContext)($v1)
/* 3B428C E00B03DC 00501021 */  addu      $v0, $v0, $s0
/* 3B4290 E00B03E0 00621821 */  addu      $v1, $v1, $v0
/* 3B4294 E00B03E4 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 3B4298 E00B03E8 ACA30004 */  sw        $v1, 0x4($a1)
/* 3B429C E00B03EC AE570000 */  sw        $s7, 0x0($s2)
/* 3B42A0 E00B03F0 AC820000 */  sw        $v0, 0x0($a0)
/* 3B42A4 E00B03F4 3C020900 */  lui       $v0, %hi(D_09000000_415060)
/* 3B42A8 E00B03F8 24420000 */  addiu     $v0, $v0, %lo(D_09000000_415060)
/* 3B42AC E00B03FC AC820004 */  sw        $v0, 0x4($a0)
/* 3B42B0 E00B0400 8FAA00A8 */  lw        $t2, 0xA8($sp)
/* 3B42B4 E00B0404 4600C586 */  mov.s     $f22, $f24
/* 3B42B8 E00B0408 AE4A0000 */  sw        $t2, 0x0($s2)
.LE00B040C:
/* 3B42BC E00B040C 27A40020 */  addiu     $a0, $sp, 0x20
/* 3B42C0 E00B0410 44962000 */  mtc1      $s6, $f4
/* 3B42C4 E00B0414 00000000 */  nop
/* 3B42C8 E00B0418 46802120 */  cvt.s.w   $f4, $f4
/* 3B42CC E00B041C 26D60048 */  addiu     $s6, $s6, 0x48
/* 3B42D0 E00B0420 44052000 */  mfc1      $a1, $f4
/* 3B42D4 E00B0424 4406A000 */  mfc1      $a2, $f20
/* 3B42D8 E00B0428 4407A000 */  mfc1      $a3, $f20
/* 3B42DC E00B042C 26310001 */  addiu     $s1, $s1, 0x1
/* 3B42E0 E00B0430 0C080104 */  jal       shim_guRotateF
/* 3B42E4 E00B0434 E7B60010 */   swc1     $f22, 0x10($sp)
/* 3B42E8 E00B0438 4405B000 */  mfc1      $a1, $f22
/* 3B42EC E00B043C 4406C000 */  mfc1      $a2, $f24
/* 3B42F0 E00B0440 4407B000 */  mfc1      $a3, $f22
/* 3B42F4 E00B0444 0C080110 */  jal       shim_guScaleF
/* 3B42F8 E00B0448 0280202D */   daddu    $a0, $s4, $zero
/* 3B42FC E00B044C 0280202D */  daddu     $a0, $s4, $zero
/* 3B4300 E00B0450 27A50020 */  addiu     $a1, $sp, 0x20
/* 3B4304 E00B0454 0C080114 */  jal       shim_guMtxCatF
/* 3B4308 E00B0458 00A0302D */   daddu    $a2, $a1, $zero
/* 3B430C E00B045C 4405A000 */  mfc1      $a1, $f20
/* 3B4310 E00B0460 4406A000 */  mfc1      $a2, $f20
/* 3B4314 E00B0464 4407A000 */  mfc1      $a3, $f20
/* 3B4318 E00B0468 3C0141F0 */  lui       $at, (0x41F00000 >> 16)
/* 3B431C E00B046C 44810000 */  mtc1      $at, $f0
/* 3B4320 E00B0470 0280202D */  daddu     $a0, $s4, $zero
/* 3B4324 E00B0474 E7B60010 */  swc1      $f22, 0x10($sp)
/* 3B4328 E00B0478 E7B40018 */  swc1      $f20, 0x18($sp)
/* 3B432C E00B047C E7B4001C */  swc1      $f20, 0x1C($sp)
/* 3B4330 E00B0480 0C080180 */  jal       shim_guPositionF
/* 3B4334 E00B0484 E7A00014 */   swc1     $f0, 0x14($sp)
/* 3B4338 E00B0488 0280202D */  daddu     $a0, $s4, $zero
/* 3B433C E00B048C 27A50020 */  addiu     $a1, $sp, 0x20
/* 3B4340 E00B0490 0C080114 */  jal       shim_guMtxCatF
/* 3B4344 E00B0494 00A0302D */   daddu    $a2, $a1, $zero
/* 3B4348 E00B0498 27A40020 */  addiu     $a0, $sp, 0x20
/* 3B434C E00B049C 96A50000 */  lhu       $a1, 0x0($s5)
/* 3B4350 E00B04A0 3C02800A */  lui       $v0, %hi(gDisplayContext)
/* 3B4354 E00B04A4 8C42A674 */  lw        $v0, %lo(gDisplayContext)($v0)
/* 3B4358 E00B04A8 00052980 */  sll       $a1, $a1, 6
/* 3B435C E00B04AC 00BE2821 */  addu      $a1, $a1, $fp
/* 3B4360 E00B04B0 0C080118 */  jal       shim_guMtxF2L
/* 3B4364 E00B04B4 00452821 */   addu     $a1, $v0, $a1
/* 3B4368 E00B04B8 3C06D838 */  lui       $a2, (0xD8380002 >> 16)
/* 3B436C E00B04BC 8E440000 */  lw        $a0, 0x0($s2)
/* 3B4370 E00B04C0 34C60002 */  ori       $a2, $a2, (0xD8380002 & 0xFFFF)
/* 3B4374 E00B04C4 0080282D */  daddu     $a1, $a0, $zero
/* 3B4378 E00B04C8 24840008 */  addiu     $a0, $a0, 0x8
/* 3B437C E00B04CC AE440000 */  sw        $a0, 0x0($s2)
/* 3B4380 E00B04D0 96A20000 */  lhu       $v0, 0x0($s5)
/* 3B4384 E00B04D4 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 3B4388 E00B04D8 ACA30000 */  sw        $v1, 0x0($a1)
/* 3B438C E00B04DC 24430001 */  addiu     $v1, $v0, 0x1
/* 3B4390 E00B04E0 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 3B4394 E00B04E4 00021180 */  sll       $v0, $v0, 6
/* 3B4398 E00B04E8 A6A30000 */  sh        $v1, 0x0($s5)
/* 3B439C E00B04EC 3C03800A */  lui       $v1, %hi(gDisplayContext)
/* 3B43A0 E00B04F0 8C63A674 */  lw        $v1, %lo(gDisplayContext)($v1)
/* 3B43A4 E00B04F4 005E1021 */  addu      $v0, $v0, $fp
/* 3B43A8 E00B04F8 00621821 */  addu      $v1, $v1, $v0
/* 3B43AC E00B04FC 24820008 */  addiu     $v0, $a0, 0x8
/* 3B43B0 E00B0500 ACA30004 */  sw        $v1, 0x4($a1)
/* 3B43B4 E00B0504 AE420000 */  sw        $v0, 0x0($s2)
/* 3B43B8 E00B0508 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 3B43BC E00B050C AC820000 */  sw        $v0, 0x0($a0)
/* 3B43C0 E00B0510 3C020900 */  lui       $v0, %hi(D_090000C8_415128)
/* 3B43C4 E00B0514 244200C8 */  addiu     $v0, $v0, %lo(D_090000C8_415128)
/* 3B43C8 E00B0518 AC820004 */  sw        $v0, 0x4($a0)
/* 3B43CC E00B051C 24820010 */  addiu     $v0, $a0, 0x10
/* 3B43D0 E00B0520 AE420000 */  sw        $v0, 0x0($s2)
/* 3B43D4 E00B0524 24020040 */  addiu     $v0, $zero, 0x40
/* 3B43D8 E00B0528 AC82000C */  sw        $v0, 0xC($a0)
/* 3B43DC E00B052C 2A220005 */  slti      $v0, $s1, 0x5
/* 3B43E0 E00B0530 1440FFB6 */  bnez      $v0, .LE00B040C
/* 3B43E4 E00B0534 AC860008 */   sw       $a2, 0x8($a0)
/* 3B43E8 E00B0538 3C07800A */  lui       $a3, %hi(gMainGfxPos)
/* 3B43EC E00B053C 24E7A66C */  addiu     $a3, $a3, %lo(gMainGfxPos)
/* 3B43F0 E00B0540 0000882D */  daddu     $s1, $zero, $zero
/* 3B43F4 E00B0544 8CE40000 */  lw        $a0, 0x0($a3)
/* 3B43F8 E00B0548 3C02DF00 */  lui       $v0, (0xDF000000 >> 16)
/* 3B43FC E00B054C 0080182D */  daddu     $v1, $a0, $zero
/* 3B4400 E00B0550 24840008 */  addiu     $a0, $a0, 0x8
/* 3B4404 E00B0554 ACE40000 */  sw        $a0, 0x0($a3)
/* 3B4408 E00B0558 AC620000 */  sw        $v0, 0x0($v1)
/* 3B440C E00B055C 3C02DE01 */  lui       $v0, (0xDE010000 >> 16)
/* 3B4410 E00B0560 AC600004 */  sw        $zero, 0x4($v1)
/* 3B4414 E00B0564 AEE20000 */  sw        $v0, 0x0($s7)
/* 3B4418 E00B0568 24820008 */  addiu     $v0, $a0, 0x8
/* 3B441C E00B056C AEE40004 */  sw        $a0, 0x4($s7)
/* 3B4420 E00B0570 ACE20000 */  sw        $v0, 0x0($a3)
/* 3B4424 E00B0574 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 3B4428 E00B0578 AC820000 */  sw        $v0, 0x0($a0)
/* 3B442C E00B057C 9262001B */  lbu       $v0, 0x1B($s3)
/* 3B4430 E00B0580 9265001F */  lbu       $a1, 0x1F($s3)
/* 3B4434 E00B0584 92660023 */  lbu       $a2, 0x23($s3)
/* 3B4438 E00B0588 3C03FB00 */  lui       $v1, (0xFB000000 >> 16)
/* 3B443C E00B058C AC830008 */  sw        $v1, 0x8($a0)
/* 3B4440 E00B0590 2403FF00 */  addiu     $v1, $zero, -0x100
/* 3B4444 E00B0594 AC83000C */  sw        $v1, 0xC($a0)
/* 3B4448 E00B0598 8FAA00A4 */  lw        $t2, 0xA4($sp)
/* 3B444C E00B059C 00021600 */  sll       $v0, $v0, 24
/* 3B4450 E00B05A0 00052C00 */  sll       $a1, $a1, 16
/* 3B4454 E00B05A4 00451025 */  or        $v0, $v0, $a1
/* 3B4458 E00B05A8 00063200 */  sll       $a2, $a2, 8
/* 3B445C E00B05AC 00461025 */  or        $v0, $v0, $a2
/* 3B4460 E00B05B0 314300FF */  andi      $v1, $t2, 0xFF
/* 3B4464 E00B05B4 00431025 */  or        $v0, $v0, $v1
/* 3B4468 E00B05B8 AC820004 */  sw        $v0, 0x4($a0)
/* 3B446C E00B05BC 8E660030 */  lw        $a2, 0x30($s3)
/* 3B4470 E00B05C0 24840010 */  addiu     $a0, $a0, 0x10
/* 3B4474 E00B05C4 24C20001 */  addiu     $v0, $a2, 0x1
/* 3B4478 E00B05C8 18400065 */  blez      $v0, .LE00B0760
/* 3B447C E00B05CC ACE40000 */   sw       $a0, 0x0($a3)
/* 3B4480 E00B05D0 8FAA00A0 */  lw        $t2, 0xA0($sp)
/* 3B4484 E00B05D4 000AB8C0 */  sll       $s7, $t2, 3
/* 3B4488 E00B05D8 3C16800A */  lui       $s6, %hi(gDisplayContext)
/* 3B448C E00B05DC 26D6A674 */  addiu     $s6, $s6, %lo(gDisplayContext)
/* 3B4490 E00B05E0 3C158007 */  lui       $s5, %hi(gMatrixListPos)
/* 3B4494 E00B05E4 26B541F0 */  addiu     $s5, $s5, %lo(gMatrixListPos)
/* 3B4498 E00B05E8 3C140001 */  lui       $s4, (0x11630 >> 16)
/* 3B449C E00B05EC 36941630 */  ori       $s4, $s4, (0x11630 & 0xFFFF)
/* 3B44A0 E00B05F0 00E0902D */  daddu     $s2, $a3, $zero
.LE00B05F4:
/* 3B44A4 E00B05F4 00111840 */  sll       $v1, $s1, 1
/* 3B44A8 E00B05F8 00711821 */  addu      $v1, $v1, $s1
/* 3B44AC E00B05FC 00031100 */  sll       $v0, $v1, 4
/* 3B44B0 E00B0600 00431023 */  subu      $v0, $v0, $v1
/* 3B44B4 E00B0604 00021080 */  sll       $v0, $v0, 2
/* 3B44B8 E00B0608 24C30001 */  addiu     $v1, $a2, 0x1
/* 3B44BC E00B060C 14600002 */  bnez      $v1, .LE00B0618
/* 3B44C0 E00B0610 0043001A */   div      $zero, $v0, $v1
/* 3B44C4 E00B0614 0007000D */  break     7
.LE00B0618:
/* 3B44C8 E00B0618 2401FFFF */  addiu     $at, $zero, -0x1
/* 3B44CC E00B061C 14610004 */  bne       $v1, $at, .LE00B0630
/* 3B44D0 E00B0620 3C018000 */   lui      $at, (0x80000000 >> 16)
/* 3B44D4 E00B0624 14410002 */  bne       $v0, $at, .LE00B0630
/* 3B44D8 E00B0628 00000000 */   nop
/* 3B44DC E00B062C 0006000D */  break     6
.LE00B0630:
/* 3B44E0 E00B0630 00001012 */  mflo      $v0
/* 3B44E4 E00B0634 02E21021 */  addu      $v0, $s7, $v0
/* 3B44E8 E00B0638 44826000 */  mtc1      $v0, $f12
/* 3B44EC E00B063C 00000000 */  nop
/* 3B44F0 E00B0640 46806320 */  cvt.s.w   $f12, $f12
/* 3B44F4 E00B0644 0C080144 */  jal       shim_cos_deg
/* 3B44F8 E00B0648 26300001 */   addiu    $s0, $s1, 0x1
/* 3B44FC E00B064C 46000021 */  cvt.d.s   $f0, $f0
/* 3B4500 E00B0650 3C01E00B */  lui       $at, (0xE00B07E8 >> 16)
/* 3B4504 E00B0654 D42207E8 */  ldc1      $f2, (0xE00B07E8 & 0xFFFF)($at)
/* 3B4508 E00B0658 001110C0 */  sll       $v0, $s1, 3
/* 3B450C E00B065C 46220002 */  mul.d     $f0, $f0, $f2
/* 3B4510 E00B0660 00000000 */  nop
/* 3B4514 E00B0664 00511021 */  addu      $v0, $v0, $s1
/* 3B4518 E00B0668 00021080 */  sll       $v0, $v0, 2
/* 3B451C E00B066C 44822000 */  mtc1      $v0, $f4
/* 3B4520 E00B0670 00000000 */  nop
/* 3B4524 E00B0674 46802120 */  cvt.s.w   $f4, $f4
/* 3B4528 E00B0678 4405A000 */  mfc1      $a1, $f20
/* 3B452C E00B067C 4406A000 */  mfc1      $a2, $f20
/* 3B4530 E00B0680 44901000 */  mtc1      $s0, $f2
/* 3B4534 E00B0684 00000000 */  nop
/* 3B4538 E00B0688 468010A0 */  cvt.s.w   $f2, $f2
/* 3B453C E00B068C 460010A1 */  cvt.d.s   $f2, $f2
/* 3B4540 E00B0690 46201080 */  add.d     $f2, $f2, $f0
/* 3B4544 E00B0694 44072000 */  mfc1      $a3, $f4
/* 3B4548 E00B0698 C660002C */  lwc1      $f0, 0x2C($s3)
/* 3B454C E00B069C 462010A0 */  cvt.s.d   $f2, $f2
/* 3B4550 E00B06A0 46001082 */  mul.s     $f2, $f2, $f0
/* 3B4554 E00B06A4 00000000 */  nop
/* 3B4558 E00B06A8 27A40020 */  addiu     $a0, $sp, 0x20
/* 3B455C E00B06AC E7B40014 */  swc1      $f20, 0x14($sp)
/* 3B4560 E00B06B0 E7B40018 */  swc1      $f20, 0x18($sp)
/* 3B4564 E00B06B4 E7B4001C */  swc1      $f20, 0x1C($sp)
/* 3B4568 E00B06B8 0C080180 */  jal       shim_guPositionF
/* 3B456C E00B06BC E7A20010 */   swc1     $f2, 0x10($sp)
/* 3B4570 E00B06C0 27A40020 */  addiu     $a0, $sp, 0x20
/* 3B4574 E00B06C4 96A50000 */  lhu       $a1, 0x0($s5)
/* 3B4578 E00B06C8 8EC20000 */  lw        $v0, 0x0($s6)
/* 3B457C E00B06CC 00052980 */  sll       $a1, $a1, 6
/* 3B4580 E00B06D0 00B42821 */  addu      $a1, $a1, $s4
/* 3B4584 E00B06D4 0C080118 */  jal       shim_guMtxF2L
/* 3B4588 E00B06D8 00452821 */   addu     $a1, $v0, $a1
/* 3B458C E00B06DC 3C07D838 */  lui       $a3, (0xD8380002 >> 16)
/* 3B4590 E00B06E0 34E70002 */  ori       $a3, $a3, (0xD8380002 & 0xFFFF)
/* 3B4594 E00B06E4 3C02DA38 */  lui       $v0, (0xDA380000 >> 16)
/* 3B4598 E00B06E8 0200882D */  daddu     $s1, $s0, $zero
/* 3B459C E00B06EC 8E440000 */  lw        $a0, 0x0($s2)
/* 3B45A0 E00B06F0 96A50000 */  lhu       $a1, 0x0($s5)
/* 3B45A4 E00B06F4 0080302D */  daddu     $a2, $a0, $zero
/* 3B45A8 E00B06F8 24840008 */  addiu     $a0, $a0, 0x8
/* 3B45AC E00B06FC ACC20000 */  sw        $v0, 0x0($a2)
/* 3B45B0 E00B0700 30A2FFFF */  andi      $v0, $a1, 0xFFFF
/* 3B45B4 E00B0704 00021180 */  sll       $v0, $v0, 6
/* 3B45B8 E00B0708 00541021 */  addu      $v0, $v0, $s4
/* 3B45BC E00B070C 8EC30000 */  lw        $v1, 0x0($s6)
/* 3B45C0 E00B0710 24A50001 */  addiu     $a1, $a1, 0x1
/* 3B45C4 E00B0714 00621821 */  addu      $v1, $v1, $v0
/* 3B45C8 E00B0718 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 3B45CC E00B071C ACC30004 */  sw        $v1, 0x4($a2)
/* 3B45D0 E00B0720 AC820000 */  sw        $v0, 0x0($a0)
/* 3B45D4 E00B0724 8FAA00A8 */  lw        $t2, 0xA8($sp)
/* 3B45D8 E00B0728 24020040 */  addiu     $v0, $zero, 0x40
/* 3B45DC E00B072C AC870008 */  sw        $a3, 0x8($a0)
/* 3B45E0 E00B0730 AC82000C */  sw        $v0, 0xC($a0)
/* 3B45E4 E00B0734 AC8A0004 */  sw        $t2, 0x4($a0)
/* 3B45E8 E00B0738 8E660030 */  lw        $a2, 0x30($s3)
/* 3B45EC E00B073C 24820008 */  addiu     $v0, $a0, 0x8
/* 3B45F0 E00B0740 AE440000 */  sw        $a0, 0x0($s2)
/* 3B45F4 E00B0744 24840010 */  addiu     $a0, $a0, 0x10
/* 3B45F8 E00B0748 A6A50000 */  sh        $a1, 0x0($s5)
/* 3B45FC E00B074C AE420000 */  sw        $v0, 0x0($s2)
/* 3B4600 E00B0750 24C20001 */  addiu     $v0, $a2, 0x1
/* 3B4604 E00B0754 0222102A */  slt       $v0, $s1, $v0
/* 3B4608 E00B0758 1440FFA6 */  bnez      $v0, .LE00B05F4
/* 3B460C E00B075C AE440000 */   sw       $a0, 0x0($s2)
.LE00B0760:
/* 3B4610 E00B0760 3C03D838 */  lui       $v1, (0xD8380002 >> 16)
/* 3B4614 E00B0764 3C04800A */  lui       $a0, %hi(gMainGfxPos)
/* 3B4618 E00B0768 2484A66C */  addiu     $a0, $a0, %lo(gMainGfxPos)
/* 3B461C E00B076C 8C820000 */  lw        $v0, 0x0($a0)
/* 3B4620 E00B0770 34630002 */  ori       $v1, $v1, (0xD8380002 & 0xFFFF)
/* 3B4624 E00B0774 0040282D */  daddu     $a1, $v0, $zero
/* 3B4628 E00B0778 24420008 */  addiu     $v0, $v0, 0x8
/* 3B462C E00B077C AC820000 */  sw        $v0, 0x0($a0)
/* 3B4630 E00B0780 ACA30000 */  sw        $v1, 0x0($a1)
/* 3B4634 E00B0784 24030040 */  addiu     $v1, $zero, 0x40
/* 3B4638 E00B0788 ACA30004 */  sw        $v1, 0x4($a1)
/* 3B463C E00B078C 24430008 */  addiu     $v1, $v0, 0x8
/* 3B4640 E00B0790 AC830000 */  sw        $v1, 0x0($a0)
/* 3B4644 E00B0794 3C03E700 */  lui       $v1, (0xE7000000 >> 16)
/* 3B4648 E00B0798 AC430000 */  sw        $v1, 0x0($v0)
/* 3B464C E00B079C AC400004 */  sw        $zero, 0x4($v0)
/* 3B4650 E00B07A0 8FBF00D4 */  lw        $ra, 0xD4($sp)
/* 3B4654 E00B07A4 8FBE00D0 */  lw        $fp, 0xD0($sp)
/* 3B4658 E00B07A8 8FB700CC */  lw        $s7, 0xCC($sp)
/* 3B465C E00B07AC 8FB600C8 */  lw        $s6, 0xC8($sp)
/* 3B4660 E00B07B0 8FB500C4 */  lw        $s5, 0xC4($sp)
/* 3B4664 E00B07B4 8FB400C0 */  lw        $s4, 0xC0($sp)
/* 3B4668 E00B07B8 8FB300BC */  lw        $s3, 0xBC($sp)
/* 3B466C E00B07BC 8FB200B8 */  lw        $s2, 0xB8($sp)
/* 3B4670 E00B07C0 8FB100B4 */  lw        $s1, 0xB4($sp)
/* 3B4674 E00B07C4 8FB000B0 */  lw        $s0, 0xB0($sp)
/* 3B4678 E00B07C8 D7B800E8 */  ldc1      $f24, 0xE8($sp)
/* 3B467C E00B07CC D7B600E0 */  ldc1      $f22, 0xE0($sp)
/* 3B4680 E00B07D0 D7B400D8 */  ldc1      $f20, 0xD8($sp)
/* 3B4684 E00B07D4 03E00008 */  jr        $ra
/* 3B4688 E00B07D8 27BD00F0 */   addiu    $sp, $sp, 0xF0
/* 3B468C E00B07DC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void thunderbolt_ring_appendGfx(void* effect) {
    ThunderboltRingFXData* data = ((EffectInstance*)effect)->data.thunderboltRing;
    s32 lifeTime = data->lifeTime;
    s32 unk_24 = data->unk_24;
    f32 scaleY = 1.0f;
    Gfx* savedGfxPos;
    Gfx* savedGfxPos2;
    Matrix4f sp20;
    Matrix4f sp60;
    s32 i;

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

    shim_guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, data->unk_28, data->pos.x, data->pos.y, data->pos.z);
    shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);

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

    savedGfxPos = gMainGfxPos++;
    savedGfxPos2 = gMainGfxPos;

    for (i = 0; i < 5; i++) {
        shim_guRotateF(sp20, i * 72 + 90, 0.0f, 0.0f, 1.0f);
        shim_guScaleF(sp60, 1.0f, scaleY, 1.0f);
        shim_guMtxCatF(sp60, sp20, sp20);
        shim_guPositionF(sp60, 0.0f, 0.0f, 0.0f, 1.0f, 30.0f, 0.0f, 0.0f);
        shim_guMtxCatF(sp60, sp20, sp20);
        shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);

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

    gSPEndDisplayList(gMainGfxPos++);
    gSPBranchList(savedGfxPos, gMainGfxPos);
    gDPSetPrimColor(gMainGfxPos++, 0, 0, data->unk_18, data->unk_1C, data->unk_20, unk_24);
    gDPSetEnvColor(gMainGfxPos++, 255, 255, 255, 0);

    for (i = 0; i < data->unk_30 + 1; i++) {
        f32 angle = lifeTime * 8 + i * 180 / (data->unk_30 + 1);
        f32 temp = (f32) (i + 1) + shim_cos_deg(angle) * 0.1;

        shim_guPositionF(sp20, 0.0f, 0.0f, i * 36, temp * data->unk_2C, 0.0f, 0.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++, savedGfxPos2);
        gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    }

    gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    gDPPipeSync(gMainGfxPos++);
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_80259D9C
/* 18867C 80259D9C 27BDFFD0 */  addiu     $sp, $sp, -0x30
/* 188680 80259DA0 AFB20018 */  sw        $s2, 0x18($sp)
/* 188684 80259DA4 0080902D */  daddu     $s2, $a0, $zero
/* 188688 80259DA8 AFB10014 */  sw        $s1, 0x14($sp)
/* 18868C 80259DAC 00A0882D */  daddu     $s1, $a1, $zero
/* 188690 80259DB0 AFB3001C */  sw        $s3, 0x1C($sp)
/* 188694 80259DB4 00C0982D */  daddu     $s3, $a2, $zero
/* 188698 80259DB8 AFBF0028 */  sw        $ra, 0x28($sp)
/* 18869C 80259DBC AFB50024 */  sw        $s5, 0x24($sp)
/* 1886A0 80259DC0 AFB40020 */  sw        $s4, 0x20($sp)
/* 1886A4 80259DC4 AFB00010 */  sw        $s0, 0x10($sp)
/* 1886A8 80259DC8 8E3000C0 */  lw        $s0, 0xC0($s1)
/* 1886AC 80259DCC 820206C1 */  lb        $v0, 0x6C1($s0)
/* 1886B0 80259DD0 8FB50040 */  lw        $s5, 0x40($sp)
/* 1886B4 80259DD4 1040004B */  beqz      $v0, .L80259F04
/* 1886B8 80259DD8 00E0A02D */   daddu    $s4, $a3, $zero
/* 1886BC 80259DDC 16400016 */  bnez      $s2, .L80259E38
/* 1886C0 80259DE0 00000000 */   nop
/* 1886C4 80259DE4 0C0B7830 */  jal       spr_get_player_palettes
/* 1886C8 80259DE8 96240088 */   lhu      $a0, 0x88($s1)
/* 1886CC 80259DEC AE0206D0 */  sw        $v0, 0x6D0($s0)
/* 1886D0 80259DF0 0040202D */  daddu     $a0, $v0, $zero
/* 1886D4 80259DF4 A20006CD */  sb        $zero, 0x6CD($s0)
/* 1886D8 80259DF8 8C830000 */  lw        $v1, 0x0($a0)
/* 1886DC 80259DFC 2402FFFF */  addiu     $v0, $zero, -0x1
/* 1886E0 80259E00 1062000B */  beq       $v1, $v0, .L80259E30
/* 1886E4 80259E04 0080182D */   daddu    $v1, $a0, $zero
/* 1886E8 80259E08 0040202D */  daddu     $a0, $v0, $zero
.L80259E0C:
/* 1886EC 80259E0C 920206CD */  lbu       $v0, 0x6CD($s0)
/* 1886F0 80259E10 24420001 */  addiu     $v0, $v0, 0x1
/* 1886F4 80259E14 A20206CD */  sb        $v0, 0x6CD($s0)
/* 1886F8 80259E18 00021600 */  sll       $v0, $v0, 24
/* 1886FC 80259E1C 00021583 */  sra       $v0, $v0, 22
/* 188700 80259E20 00431021 */  addu      $v0, $v0, $v1
/* 188704 80259E24 8C420000 */  lw        $v0, 0x0($v0)
/* 188708 80259E28 1444FFF8 */  bne       $v0, $a0, .L80259E0C
/* 18870C 80259E2C 00000000 */   nop
.L80259E30:
/* 188710 80259E30 080967A4 */  j         .L80259E90
/* 188714 80259E34 24020006 */   addiu    $v0, $zero, 0x6
.L80259E38:
/* 188718 80259E38 96240088 */  lhu       $a0, 0x88($s1)
/* 18871C 80259E3C 0C0B7A90 */  jal       spr_get_npc_palettes
/* 188720 80259E40 00000000 */   nop
/* 188724 80259E44 AE0206D0 */  sw        $v0, 0x6D0($s0)
/* 188728 80259E48 0040202D */  daddu     $a0, $v0, $zero
/* 18872C 80259E4C A20006CD */  sb        $zero, 0x6CD($s0)
/* 188730 80259E50 8C830000 */  lw        $v1, 0x0($a0)
/* 188734 80259E54 2402FFFF */  addiu     $v0, $zero, -0x1
/* 188738 80259E58 1062000B */  beq       $v1, $v0, .L80259E88
/* 18873C 80259E5C 0080182D */   daddu    $v1, $a0, $zero
/* 188740 80259E60 0040202D */  daddu     $a0, $v0, $zero
.L80259E64:
/* 188744 80259E64 920206CD */  lbu       $v0, 0x6CD($s0)
/* 188748 80259E68 24420001 */  addiu     $v0, $v0, 0x1
/* 18874C 80259E6C A20206CD */  sb        $v0, 0x6CD($s0)
/* 188750 80259E70 00021600 */  sll       $v0, $v0, 24
/* 188754 80259E74 00021583 */  sra       $v0, $v0, 22
/* 188758 80259E78 00431021 */  addu      $v0, $v0, $v1
/* 18875C 80259E7C 8C420000 */  lw        $v0, 0x0($v0)
/* 188760 80259E80 1444FFF8 */  bne       $v0, $a0, .L80259E64
/* 188764 80259E84 00000000 */   nop
.L80259E88:
/* 188768 80259E88 0C0B7A9B */  jal       spr_get_npc_color_variations
/* 18876C 80259E8C 96240088 */   lhu      $a0, 0x88($s1)
.L80259E90:
/* 188770 80259E90 A20206CC */  sb        $v0, 0x6CC($s0)
/* 188774 80259E94 820206CD */  lb        $v0, 0x6CD($s0)
/* 188778 80259E98 18400015 */  blez      $v0, .L80259EF0
/* 18877C 80259E9C 0000482D */   daddu    $t1, $zero, $zero
.L80259EA0:
/* 188780 80259EA0 8E0206D0 */  lw        $v0, 0x6D0($s0)
/* 188784 80259EA4 00091880 */  sll       $v1, $t1, 2
/* 188788 80259EA8 00621821 */  addu      $v1, $v1, $v0
/* 18878C 80259EAC 00091140 */  sll       $v0, $t1, 5
/* 188790 80259EB0 8C660000 */  lw        $a2, 0x0($v1)
/* 188794 80259EB4 10C00009 */  beqz      $a2, .L80259EDC
/* 188798 80259EB8 02024021 */   addu     $t0, $s0, $v0
/* 18879C 80259EBC 0000382D */  daddu     $a3, $zero, $zero
.L80259EC0:
/* 1887A0 80259EC0 94C20000 */  lhu       $v0, 0x0($a2)
/* 1887A4 80259EC4 24C60002 */  addiu     $a2, $a2, 0x2
/* 1887A8 80259EC8 24E70001 */  addiu     $a3, $a3, 0x1
/* 1887AC 80259ECC A5020000 */  sh        $v0, 0x0($t0)
/* 1887B0 80259ED0 28E20010 */  slti      $v0, $a3, 0x10
/* 1887B4 80259ED4 1440FFFA */  bnez      $v0, .L80259EC0
/* 1887B8 80259ED8 25080002 */   addiu    $t0, $t0, 0x2
.L80259EDC:
/* 1887BC 80259EDC 820206CD */  lb        $v0, 0x6CD($s0)
/* 1887C0 80259EE0 25290001 */  addiu     $t1, $t1, 0x1
/* 1887C4 80259EE4 0122102A */  slt       $v0, $t1, $v0
/* 1887C8 80259EE8 1440FFED */  bnez      $v0, .L80259EA0
/* 1887CC 80259EEC 00000000 */   nop
.L80259EF0:
/* 1887D0 80259EF0 2402FFFE */  addiu     $v0, $zero, -0x2
/* 1887D4 80259EF4 A20206C2 */  sb        $v0, 0x6C2($s0)
/* 1887D8 80259EF8 A60006CA */  sh        $zero, 0x6CA($s0)
/* 1887DC 80259EFC A20006C1 */  sb        $zero, 0x6C1($s0)
/* 1887E0 80259F00 A60006C8 */  sh        $zero, 0x6C8($s0)
.L80259F04:
/* 1887E4 80259F04 16A0001E */  bnez      $s5, .L80259F80
/* 1887E8 80259F08 00000000 */   nop
/* 1887EC 80259F0C 860206C8 */  lh        $v0, 0x6C8($s0)
/* 1887F0 80259F10 14400013 */  bnez      $v0, .L80259F60
/* 1887F4 80259F14 00000000 */   nop
/* 1887F8 80259F18 920206C2 */  lbu       $v0, 0x6C2($s0)
/* 1887FC 80259F1C 3C048028 */  lui       $a0, %hi(D_80284080)
/* 188800 80259F20 24844080 */  addiu     $a0, $a0, %lo(D_80284080)
/* 188804 80259F24 24420002 */  addiu     $v0, $v0, 0x2
/* 188808 80259F28 A20206C2 */  sb        $v0, 0x6C2($s0)
/* 18880C 80259F2C 00021600 */  sll       $v0, $v0, 24
/* 188810 80259F30 00021603 */  sra       $v0, $v0, 24
/* 188814 80259F34 3C038028 */  lui       $v1, %hi(D_80284080)
/* 188818 80259F38 00621821 */  addu      $v1, $v1, $v0
/* 18881C 80259F3C 90634080 */  lbu       $v1, %lo(D_80284080)($v1)
/* 188820 80259F40 240200FF */  addiu     $v0, $zero, 0xFF
/* 188824 80259F44 50620001 */  beql      $v1, $v0, .L80259F4C
/* 188828 80259F48 A20006C2 */   sb       $zero, 0x6C2($s0)
.L80259F4C:
/* 18882C 80259F4C 820206C2 */  lb        $v0, 0x6C2($s0)
/* 188830 80259F50 00441021 */  addu      $v0, $v0, $a0
/* 188834 80259F54 90420001 */  lbu       $v0, 0x1($v0)
/* 188838 80259F58 00021042 */  srl       $v0, $v0, 1
/* 18883C 80259F5C A60206C8 */  sh        $v0, 0x6C8($s0)
.L80259F60:
/* 188840 80259F60 820306C2 */  lb        $v1, 0x6C2($s0)
/* 188844 80259F64 960206C8 */  lhu       $v0, 0x6C8($s0)
/* 188848 80259F68 3C018028 */  lui       $at, %hi(D_80284080)
/* 18884C 80259F6C 00230821 */  addu      $at, $at, $v1
/* 188850 80259F70 90234080 */  lbu       $v1, %lo(D_80284080)($at)
/* 188854 80259F74 2442FFFF */  addiu     $v0, $v0, -0x1
/* 188858 80259F78 080967E4 */  j         .L80259F90
/* 18885C 80259F7C A60206C8 */   sh       $v0, 0x6C8($s0)
.L80259F80:
/* 188860 80259F80 820206C2 */  lb        $v0, 0x6C2($s0)
/* 188864 80259F84 3C038028 */  lui       $v1, %hi(D_80284080)
/* 188868 80259F88 00621821 */  addu      $v1, $v1, $v0
/* 18886C 80259F8C 90634080 */  lbu       $v1, %lo(D_80284080)($v1)
.L80259F90:
/* 188870 80259F90 24020001 */  addiu     $v0, $zero, 0x1
/* 188874 80259F94 10620024 */  beq       $v1, $v0, .L8025A028
/* 188878 80259F98 28620002 */   slti     $v0, $v1, 0x2
/* 18887C 80259F9C 10400005 */  beqz      $v0, .L80259FB4
/* 188880 80259FA0 24020002 */   addiu    $v0, $zero, 0x2
/* 188884 80259FA4 10600007 */  beqz      $v1, .L80259FC4
/* 188888 80259FA8 00000000 */   nop
/* 18888C 80259FAC 0809688D */  j         .L8025A234
/* 188890 80259FB0 00000000 */   nop
.L80259FB4:
/* 188894 80259FB4 1062003C */  beq       $v1, $v0, .L8025A0A8
/* 188898 80259FB8 00000000 */   nop
/* 18889C 80259FBC 0809688D */  j         .L8025A234
/* 1888A0 80259FC0 00000000 */   nop
.L80259FC4:
/* 1888A4 80259FC4 820206CC */  lb        $v0, 0x6CC($s0)
/* 1888A8 80259FC8 1840009A */  blez      $v0, .L8025A234
/* 1888AC 80259FCC 0000482D */   daddu    $t1, $zero, $zero
.L80259FD0:
/* 1888B0 80259FD0 8E0206D0 */  lw        $v0, 0x6D0($s0)
/* 1888B4 80259FD4 00091880 */  sll       $v1, $t1, 2
/* 1888B8 80259FD8 00621821 */  addu      $v1, $v1, $v0
/* 1888BC 80259FDC 00091140 */  sll       $v0, $t1, 5
/* 1888C0 80259FE0 8C660000 */  lw        $a2, 0x0($v1)
/* 1888C4 80259FE4 10C00009 */  beqz      $a2, .L8025A00C
/* 1888C8 80259FE8 02024021 */   addu     $t0, $s0, $v0
/* 1888CC 80259FEC 0000382D */  daddu     $a3, $zero, $zero
.L80259FF0:
/* 1888D0 80259FF0 94C20000 */  lhu       $v0, 0x0($a2)
/* 1888D4 80259FF4 24C60002 */  addiu     $a2, $a2, 0x2
/* 1888D8 80259FF8 24E70001 */  addiu     $a3, $a3, 0x1
/* 1888DC 80259FFC A5020000 */  sh        $v0, 0x0($t0)
/* 1888E0 8025A000 28E20010 */  slti      $v0, $a3, 0x10
D_8025A004:
/* 1888E4 8025A004 1440FFFA */  bnez      $v0, .L80259FF0
/* 1888E8 8025A008 25080002 */   addiu    $t0, $t0, 0x2
.L8025A00C:
/* 1888EC 8025A00C 820206CC */  lb        $v0, 0x6CC($s0)
/* 1888F0 8025A010 25290001 */  addiu     $t1, $t1, 0x1
/* 1888F4 8025A014 0122102A */  slt       $v0, $t1, $v0
/* 1888F8 8025A018 10400086 */  beqz      $v0, .L8025A234
/* 1888FC 8025A01C 00000000 */   nop
/* 188900 8025A020 080967F4 */  j         .L80259FD0
/* 188904 8025A024 00000000 */   nop
.L8025A028:
/* 188908 8025A028 820206CC */  lb        $v0, 0x6CC($s0)
/* 18890C 8025A02C 920306CC */  lbu       $v1, 0x6CC($s0)
/* 188910 8025A030 18400080 */  blez      $v0, .L8025A234
/* 188914 8025A034 0000482D */   daddu    $t1, $zero, $zero
/* 188918 8025A038 00031E00 */  sll       $v1, $v1, 24
.L8025A03C:
/* 18891C 8025A03C 00031E03 */  sra       $v1, $v1, 24
/* 188920 8025A040 00031040 */  sll       $v0, $v1, 1
/* 188924 8025A044 00431021 */  addu      $v0, $v0, $v1
/* 188928 8025A048 00491021 */  addu      $v0, $v0, $t1
/* 18892C 8025A04C 8E0306D0 */  lw        $v1, 0x6D0($s0)
/* 188930 8025A050 00021080 */  sll       $v0, $v0, 2
/* 188934 8025A054 00431021 */  addu      $v0, $v0, $v1
/* 188938 8025A058 8C460000 */  lw        $a2, 0x0($v0)
/* 18893C 8025A05C 00091140 */  sll       $v0, $t1, 5
/* 188940 8025A060 10C00009 */  beqz      $a2, .L8025A088
/* 188944 8025A064 02024021 */   addu     $t0, $s0, $v0
/* 188948 8025A068 0000382D */  daddu     $a3, $zero, $zero
.L8025A06C:
/* 18894C 8025A06C 94C20000 */  lhu       $v0, 0x0($a2)
/* 188950 8025A070 24C60002 */  addiu     $a2, $a2, 0x2
/* 188954 8025A074 24E70001 */  addiu     $a3, $a3, 0x1
/* 188958 8025A078 A5020000 */  sh        $v0, 0x0($t0)
/* 18895C 8025A07C 28E20010 */  slti      $v0, $a3, 0x10
/* 188960 8025A080 1440FFFA */  bnez      $v0, .L8025A06C
/* 188964 8025A084 25080002 */   addiu    $t0, $t0, 0x2
.L8025A088:
/* 188968 8025A088 25290001 */  addiu     $t1, $t1, 0x1
/* 18896C 8025A08C 820206CC */  lb        $v0, 0x6CC($s0)
/* 188970 8025A090 920306CC */  lbu       $v1, 0x6CC($s0)
/* 188974 8025A094 0122102A */  slt       $v0, $t1, $v0
/* 188978 8025A098 1440FFE8 */  bnez      $v0, .L8025A03C
/* 18897C 8025A09C 00031E00 */   sll      $v1, $v1, 24
/* 188980 8025A0A0 0809688D */  j         .L8025A234
/* 188984 8025A0A4 00000000 */   nop
.L8025A0A8:
/* 188988 8025A0A8 820206CC */  lb        $v0, 0x6CC($s0)
/* 18898C 8025A0AC 18400061 */  blez      $v0, .L8025A234
/* 188990 8025A0B0 0000482D */   daddu    $t1, $zero, $zero
/* 188994 8025A0B4 3C0B8000 */  lui       $t3, (0x80000000 >> 16)
/* 188998 8025A0B8 3C01802A */  lui       $at, %hi(D_8029D400)
/* 18899C 8025A0BC D424D400 */  ldc1      $f4, %lo(D_8029D400)($at)
/* 1889A0 8025A0C0 3C0141E0 */  lui       $at, (0x41E00000 >> 16)
/* 1889A4 8025A0C4 44811800 */  mtc1      $at, $f3
/* 1889A8 8025A0C8 44801000 */  mtc1      $zero, $f2
.L8025A0CC:
/* 1889AC 8025A0CC 8E0206D0 */  lw        $v0, 0x6D0($s0)
/* 1889B0 8025A0D0 00091880 */  sll       $v1, $t1, 2
/* 1889B4 8025A0D4 00621821 */  addu      $v1, $v1, $v0
/* 1889B8 8025A0D8 00091140 */  sll       $v0, $t1, 5
/* 1889BC 8025A0DC 8C660000 */  lw        $a2, 0x0($v1)
/* 1889C0 8025A0E0 10C0004F */  beqz      $a2, .L8025A220
/* 1889C4 8025A0E4 02024021 */   addu     $t0, $s0, $v0
/* 1889C8 8025A0E8 0000382D */  daddu     $a3, $zero, $zero
.L8025A0EC:
/* 1889CC 8025A0EC 94C30000 */  lhu       $v1, 0x0($a2)
/* 1889D0 8025A0F0 000312C2 */  srl       $v0, $v1, 11
/* 1889D4 8025A0F4 44820000 */  mtc1      $v0, $f0
/* 1889D8 8025A0F8 00000000 */  nop
/* 1889DC 8025A0FC 46800021 */  cvt.d.w   $f0, $f0
/* 1889E0 8025A100 46240002 */  mul.d     $f0, $f0, $f4
/* 1889E4 8025A104 00000000 */  nop
/* 1889E8 8025A108 90C40001 */  lbu       $a0, 0x1($a2)
/* 1889EC 8025A10C 24C60002 */  addiu     $a2, $a2, 0x2
/* 1889F0 8025A110 00031182 */  srl       $v0, $v1, 6
/* 1889F4 8025A114 3042001F */  andi      $v0, $v0, 0x1F
/* 1889F8 8025A118 00031842 */  srl       $v1, $v1, 1
/* 1889FC 8025A11C 306A001F */  andi      $t2, $v1, 0x1F
/* 188A00 8025A120 4620103E */  c.le.d    $f2, $f0
/* 188A04 8025A124 00000000 */  nop
/* 188A08 8025A128 45010005 */  bc1t      .L8025A140
/* 188A0C 8025A12C 30840001 */   andi     $a0, $a0, 0x1
/* 188A10 8025A130 4620018D */  trunc.w.d $f6, $f0
/* 188A14 8025A134 44033000 */  mfc1      $v1, $f6
/* 188A18 8025A138 08096856 */  j         .L8025A158
/* 188A1C 8025A13C 304200FF */   andi     $v0, $v0, 0xFF
.L8025A140:
/* 188A20 8025A140 46220001 */  sub.d     $f0, $f0, $f2
/* 188A24 8025A144 4620018D */  trunc.w.d $f6, $f0
/* 188A28 8025A148 44033000 */  mfc1      $v1, $f6
/* 188A2C 8025A14C 00000000 */  nop
/* 188A30 8025A150 006B1825 */  or        $v1, $v1, $t3
/* 188A34 8025A154 304200FF */  andi      $v0, $v0, 0xFF
.L8025A158:
/* 188A38 8025A158 44820000 */  mtc1      $v0, $f0
/* 188A3C 8025A15C 00000000 */  nop
/* 188A40 8025A160 46800021 */  cvt.d.w   $f0, $f0
/* 188A44 8025A164 46240002 */  mul.d     $f0, $f0, $f4
/* 188A48 8025A168 00000000 */  nop
/* 188A4C 8025A16C 4620103E */  c.le.d    $f2, $f0
/* 188A50 8025A170 00000000 */  nop
/* 188A54 8025A174 45030005 */  bc1tl     .L8025A18C
/* 188A58 8025A178 46220001 */   sub.d    $f0, $f0, $f2
/* 188A5C 8025A17C 4620018D */  trunc.w.d $f6, $f0
/* 188A60 8025A180 44053000 */  mfc1      $a1, $f6
/* 188A64 8025A184 08096868 */  j         .L8025A1A0
/* 188A68 8025A188 314200FF */   andi     $v0, $t2, 0xFF
.L8025A18C:
/* 188A6C 8025A18C 4620018D */  trunc.w.d $f6, $f0
/* 188A70 8025A190 44053000 */  mfc1      $a1, $f6
/* 188A74 8025A194 00000000 */  nop
/* 188A78 8025A198 00AB2825 */  or        $a1, $a1, $t3
/* 188A7C 8025A19C 314200FF */  andi      $v0, $t2, 0xFF
.L8025A1A0:
/* 188A80 8025A1A0 44820000 */  mtc1      $v0, $f0
/* 188A84 8025A1A4 00000000 */  nop
/* 188A88 8025A1A8 46800021 */  cvt.d.w   $f0, $f0
/* 188A8C 8025A1AC 46240002 */  mul.d     $f0, $f0, $f4
/* 188A90 8025A1B0 00000000 */  nop
/* 188A94 8025A1B4 4620103E */  c.le.d    $f2, $f0
/* 188A98 8025A1B8 00000000 */  nop
/* 188A9C 8025A1BC 45010005 */  bc1t      .L8025A1D4
/* 188AA0 8025A1C0 00A0102D */   daddu    $v0, $a1, $zero
/* 188AA4 8025A1C4 4620018D */  trunc.w.d $f6, $f0
/* 188AA8 8025A1C8 44053000 */  mfc1      $a1, $f6
/* 188AAC 8025A1CC 0809687B */  j         .L8025A1EC
/* 188AB0 8025A1D0 306300FF */   andi     $v1, $v1, 0xFF
.L8025A1D4:
/* 188AB4 8025A1D4 46220001 */  sub.d     $f0, $f0, $f2
/* 188AB8 8025A1D8 4620018D */  trunc.w.d $f6, $f0
/* 188ABC 8025A1DC 44053000 */  mfc1      $a1, $f6
/* 188AC0 8025A1E0 00000000 */  nop
/* 188AC4 8025A1E4 00AB2825 */  or        $a1, $a1, $t3
/* 188AC8 8025A1E8 306300FF */  andi      $v1, $v1, 0xFF
.L8025A1EC:
/* 188ACC 8025A1EC 00031AC0 */  sll       $v1, $v1, 11
/* 188AD0 8025A1F0 304200FF */  andi      $v0, $v0, 0xFF
/* 188AD4 8025A1F4 00021180 */  sll       $v0, $v0, 6
/* 188AD8 8025A1F8 00621825 */  or        $v1, $v1, $v0
/* 188ADC 8025A1FC 30A200FF */  andi      $v0, $a1, 0xFF
/* 188AE0 8025A200 00021040 */  sll       $v0, $v0, 1
/* 188AE4 8025A204 00621825 */  or        $v1, $v1, $v0
/* 188AE8 8025A208 00831825 */  or        $v1, $a0, $v1
/* 188AEC 8025A20C A5030000 */  sh        $v1, 0x0($t0)
/* 188AF0 8025A210 24E70001 */  addiu     $a3, $a3, 0x1
/* 188AF4 8025A214 28E20010 */  slti      $v0, $a3, 0x10
/* 188AF8 8025A218 1440FFB4 */  bnez      $v0, .L8025A0EC
/* 188AFC 8025A21C 25080002 */   addiu    $t0, $t0, 0x2
.L8025A220:
/* 188B00 8025A220 820206CC */  lb        $v0, 0x6CC($s0)
/* 188B04 8025A224 25290001 */  addiu     $t1, $t1, 0x1
/* 188B08 8025A228 0122102A */  slt       $v0, $t1, $v0
/* 188B0C 8025A22C 1440FFA7 */  bnez      $v0, .L8025A0CC
/* 188B10 8025A230 00000000 */   nop
.L8025A234:
/* 188B14 8025A234 820206CD */  lb        $v0, 0x6CD($s0)
/* 188B18 8025A238 1840000A */  blez      $v0, .L8025A264
/* 188B1C 8025A23C 0000482D */   daddu    $t1, $zero, $zero
/* 188B20 8025A240 0200202D */  daddu     $a0, $s0, $zero
/* 188B24 8025A244 0200182D */  daddu     $v1, $s0, $zero
.L8025A248:
/* 188B28 8025A248 AC6406D4 */  sw        $a0, 0x6D4($v1)
/* 188B2C 8025A24C 24840020 */  addiu     $a0, $a0, 0x20
/* 188B30 8025A250 820206CD */  lb        $v0, 0x6CD($s0)
/* 188B34 8025A254 25290001 */  addiu     $t1, $t1, 0x1
/* 188B38 8025A258 0122102A */  slt       $v0, $t1, $v0
/* 188B3C 8025A25C 1440FFFA */  bnez      $v0, .L8025A248
/* 188B40 8025A260 24630004 */   addiu    $v1, $v1, 0x4
.L8025A264:
/* 188B44 8025A264 16400006 */  bnez      $s2, .L8025A280
/* 188B48 8025A268 0220202D */   daddu    $a0, $s1, $zero
/* 188B4C 8025A26C 0260282D */  daddu     $a1, $s3, $zero
/* 188B50 8025A270 0C096657 */  jal       func_8025995C
/* 188B54 8025A274 0280302D */   daddu    $a2, $s4, $zero
/* 188B58 8025A278 080968A3 */  j         .L8025A28C
/* 188B5C 8025A27C 00000000 */   nop
.L8025A280:
/* 188B60 8025A280 0260282D */  daddu     $a1, $s3, $zero
/* 188B64 8025A284 0C0965B0 */  jal       func_802596C0
/* 188B68 8025A288 0280302D */   daddu    $a2, $s4, $zero
.L8025A28C:
/* 188B6C 8025A28C 16A00004 */  bnez      $s5, .L8025A2A0
/* 188B70 8025A290 00000000 */   nop
/* 188B74 8025A294 960206CA */  lhu       $v0, 0x6CA($s0)
/* 188B78 8025A298 2442FFFF */  addiu     $v0, $v0, -0x1
/* 188B7C 8025A29C A60206CA */  sh        $v0, 0x6CA($s0)
.L8025A2A0:
/* 188B80 8025A2A0 8FBF0028 */  lw        $ra, 0x28($sp)
/* 188B84 8025A2A4 8FB50024 */  lw        $s5, 0x24($sp)
/* 188B88 8025A2A8 8FB40020 */  lw        $s4, 0x20($sp)
/* 188B8C 8025A2AC 8FB3001C */  lw        $s3, 0x1C($sp)
/* 188B90 8025A2B0 8FB20018 */  lw        $s2, 0x18($sp)
/* 188B94 8025A2B4 8FB10014 */  lw        $s1, 0x14($sp)
/* 188B98 8025A2B8 8FB00010 */  lw        $s0, 0x10($sp)
/* 188B9C 8025A2BC 03E00008 */  jr        $ra
/* 188BA0 8025A2C0 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

void render_with_static_palettes(b32 isNpcSprite, ActorPart* part, s32 yaw, Matrix4f mtx, b32 skipAnimation) {
    DecorationTable* decorationTable = part->decorationTable;
    PAL_PTR palIn;
    PAL_PTR palOut;
    s32 i, j;
    s32 paletteType;
    s32 staticPalIdx;

    if (decorationTable->resetPalAdjust) {
        if (isNpcSprite == SPRITE_MODE_PLAYER) {
            decorationTable->originalPalettesList = spr_get_player_palettes(part->currentAnimation >> 16);
            decorationTable->originalPalettesCount = 0;
            while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) {
                decorationTable->originalPalettesCount++;
            }
            decorationTable->spriteColorVariations = SPR_PLAYER_COLOR_VARIATIONS;
        } else {
            decorationTable->originalPalettesList = spr_get_npc_palettes(part->currentAnimation >> 16);
            decorationTable->originalPalettesCount = 0;
            while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) {
                decorationTable->originalPalettesCount++;
            }
            decorationTable->spriteColorVariations = spr_get_npc_color_variations(part->currentAnimation >> 16);
        }

        for (i = 0; i < decorationTable->originalPalettesCount; i++) {
            palIn = decorationTable->originalPalettesList[i];
            palOut = decorationTable->copiedPalettes[0][i];
            if (palIn != NULL) {
                for (j = 0; j < SPR_PAL_SIZE; j++) {
                    *palOut++ = *palIn++;
                }
            }
        }

        decorationTable->palAnimState = -2;
        decorationTable->palBlendAlpha = 0;
        decorationTable->resetPalAdjust = FALSE;
        decorationTable->nextPalTime = 0;
    }

    if (!skipAnimation) {
        if (decorationTable->nextPalTime == 0) {
            decorationTable->palAnimState += 2;
            if (StaticPalettesAnim[decorationTable->palAnimState] == PAL_ANIM_END) {
                decorationTable->palAnimState = 0;
            }
            decorationTable->nextPalTime = StaticPalettesAnim[decorationTable->palAnimState + 1] / 2;
        }
        paletteType = StaticPalettesAnim[decorationTable->palAnimState];
        decorationTable->nextPalTime--;
    } else {
        paletteType = StaticPalettesAnim[decorationTable->palAnimState];
    }

    switch (paletteType) {
        case STATIC_DEFAULT: // no change
            for (i = 0; i < decorationTable->spriteColorVariations; i++) {
                palIn = decorationTable->originalPalettesList[i];
                palOut = decorationTable->copiedPalettes[0][i];
                if (palIn != NULL) {
                    for (j = 0; j < SPR_PAL_SIZE; j++) {
                        *palOut++ = *palIn++;
                    }
                }
            }
            break;
        case STATIC_BRIGHT: // bright yellow
            for (i = 0; i < decorationTable->spriteColorVariations; i++) {
                staticPalIdx = decorationTable->spriteColorVariations * STANDARD_PAL_STATIC + i;
                palIn = decorationTable->originalPalettesList[staticPalIdx];
                palOut = decorationTable->copiedPalettes[0][i];
                if (palIn != NULL) {
                    for (j = 0; j < SPR_PAL_SIZE; j++) {
                        *palOut++ = *palIn++;
                    }
                }
            }
            break;
        case STATIC_DARK: // darkened via code
            for (i = 0; i < decorationTable->spriteColorVariations; i++) {
                palIn = decorationTable->originalPalettesList[i];
                palOut = decorationTable->copiedPalettes[0][i];
                if (palIn != NULL) {
                    for (j = 0; j < SPR_PAL_SIZE; j++) {
                        u8 r = UNPACK_PAL_R(*palIn);
                        u8 g = UNPACK_PAL_G(*palIn);
                        u8 b = UNPACK_PAL_B(*palIn);
                        u8 a = UNPACK_PAL_A(*palIn);
                        palIn++;

                        r *= 0.1;
                        g *= 0.1;
                        b *= 0.1;

                        *palOut++ = PACK_PAL_RGBA(r, g, b, a);
                    }
                }
            }
            break;
    }

    for (i = 0; i < decorationTable->originalPalettesCount; i++) {
        decorationTable->adjustedPalettes[i] = decorationTable->copiedPalettes[0][i];
    }

    if (isNpcSprite == SPRITE_MODE_PLAYER) {
        func_8025995C(part, yaw, mtx);
    } else {
        func_802596C0(part, yaw, mtx);
    }

    if (!skipAnimation) {
        decorationTable->palBlendAlpha--;
    }
}