### RAW ASSEMBLY INSTRUCTIONS:

glabel firework_rocket_appendGfx
/* 3E4888 E010A4E8 27BDFF30 */  addiu     $sp, $sp, -0xD0
/* 3E488C E010A4EC AFB70094 */  sw        $s7, 0x94($sp)
/* 3E4890 E010A4F0 0080B82D */  daddu     $s7, $a0, $zero
/* 3E4894 E010A4F4 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 3E4898 E010A4F8 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 3E489C E010A4FC 3C04800B */  lui       $a0, %hi(gCameras)
/* 3E48A0 E010A500 24841D80 */  addiu     $a0, $a0, %lo(gCameras)
/* 3E48A4 E010A504 AFBF009C */  sw        $ra, 0x9C($sp)
/* 3E48A8 E010A508 AFBE0098 */  sw        $fp, 0x98($sp)
/* 3E48AC E010A50C AFB60090 */  sw        $s6, 0x90($sp)
/* 3E48B0 E010A510 AFB5008C */  sw        $s5, 0x8C($sp)
/* 3E48B4 E010A514 AFB40088 */  sw        $s4, 0x88($sp)
/* 3E48B8 E010A518 AFB30084 */  sw        $s3, 0x84($sp)
/* 3E48BC E010A51C AFB20080 */  sw        $s2, 0x80($sp)
/* 3E48C0 E010A520 AFB1007C */  sw        $s1, 0x7C($sp)
/* 3E48C4 E010A524 AFB00078 */  sw        $s0, 0x78($sp)
/* 3E48C8 E010A528 F7BE00C8 */  sdc1      $f30, 0xC8($sp)
/* 3E48CC E010A52C F7BC00C0 */  sdc1      $f28, 0xC0($sp)
/* 3E48D0 E010A530 F7BA00B8 */  sdc1      $f26, 0xB8($sp)
/* 3E48D4 E010A534 F7B800B0 */  sdc1      $f24, 0xB0($sp)
/* 3E48D8 E010A538 F7B600A8 */  sdc1      $f22, 0xA8($sp)
/* 3E48DC E010A53C F7B400A0 */  sdc1      $f20, 0xA0($sp)
/* 3E48E0 E010A540 8EF1000C */  lw        $s1, 0xC($s7)
/* 3E48E4 E010A544 00031080 */  sll       $v0, $v1, 2
/* 3E48E8 E010A548 00431021 */  addu      $v0, $v0, $v1
/* 3E48EC E010A54C 00021080 */  sll       $v0, $v0, 2
/* 3E48F0 E010A550 00431023 */  subu      $v0, $v0, $v1
/* 3E48F4 E010A554 000218C0 */  sll       $v1, $v0, 3
/* 3E48F8 E010A558 00431021 */  addu      $v0, $v0, $v1
/* 3E48FC E010A55C 000210C0 */  sll       $v0, $v0, 3
/* 3E4900 E010A560 00449021 */  addu      $s2, $v0, $a0
/* 3E4904 E010A564 C654006C */  lwc1      $f20, 0x6C($s2)
/* 3E4908 E010A568 8E330030 */  lw        $s3, 0x30($s1)
/* 3E490C E010A56C 8E360000 */  lw        $s6, 0x0($s1)
/* 3E4910 E010A570 4600A507 */  neg.s     $f20, $f20
/* 3E4914 E010A574 0C080140 */  jal       shim_sin_deg
/* 3E4918 E010A578 4600A306 */   mov.s    $f12, $f20
/* 3E491C E010A57C 4600A306 */  mov.s     $f12, $f20
/* 3E4920 E010A580 0C080144 */  jal       shim_cos_deg
/* 3E4924 E010A584 E7A00058 */   swc1     $f0, 0x58($sp)
/* 3E4928 E010A588 3C148007 */  lui       $s4, %hi(gGameStatusPtr)
/* 3E492C E010A58C 2694419C */  addiu     $s4, $s4, %lo(gGameStatusPtr)
/* 3E4930 E010A590 E7A0005C */  swc1      $f0, 0x5C($sp)
/* 3E4934 E010A594 8E820000 */  lw        $v0, 0x0($s4)
/* 3E4938 E010A598 3C15E011 */  lui       $s5, %hi(D_E010AF80)
/* 3E493C E010A59C 26B5AF80 */  addiu     $s5, $s5, %lo(D_E010AF80)
/* 3E4940 E010A5A0 94430134 */  lhu       $v1, 0x134($v0)
/* 3E4944 E010A5A4 8EA20000 */  lw        $v0, 0x0($s5)
/* 3E4948 E010A5A8 8E3E004C */  lw        $fp, 0x4C($s1)
/* 3E494C E010A5AC 10430013 */  beq       $v0, $v1, .LE010A5FC
/* 3E4950 E010A5B0 2404000A */   addiu    $a0, $zero, 0xA
/* 3E4954 E010A5B4 3C10E011 */  lui       $s0, %hi(D_E010AF84)
/* 3E4958 E010A5B8 2610AF84 */  addiu     $s0, $s0, %lo(D_E010AF84)
/* 3E495C E010A5BC 3C01E011 */  lui       $at, (0xE0110000 >> 16)
/* 3E4960 E010A5C0 D422AFA8 */  ldc1      $f2, -0x5058($at)
/* 3E4964 E010A5C4 C6000000 */  lwc1      $f0, 0x0($s0)
/* 3E4968 E010A5C8 46800021 */  cvt.d.w   $f0, $f0
/* 3E496C E010A5CC 46220002 */  mul.d     $f0, $f0, $f2
/* 3E4970 E010A5D0 00000000 */  nop
/* 3E4974 E010A5D4 0080282D */  daddu     $a1, $a0, $zero
/* 3E4978 E010A5D8 24060136 */  addiu     $a2, $zero, 0x136
/* 3E497C E010A5DC 240700E6 */  addiu     $a3, $zero, 0xE6
/* 3E4980 E010A5E0 46200020 */  cvt.s.d   $f0, $f0
/* 3E4984 E010A5E4 0C08018C */  jal       shim_draw_prev_frame_buffer_at_screen_pos
/* 3E4988 E010A5E8 E7A00010 */   swc1     $f0, 0x10($sp)
/* 3E498C E010A5EC 8E820000 */  lw        $v0, 0x0($s4)
/* 3E4990 E010A5F0 94420134 */  lhu       $v0, 0x134($v0)
/* 3E4994 E010A5F4 AE000000 */  sw        $zero, 0x0($s0)
/* 3E4998 E010A5F8 AEA20000 */  sw        $v0, 0x0($s5)
.LE010A5FC:
/* 3E499C E010A5FC 3C03E011 */  lui       $v1, %hi(D_E010AF84)
/* 3E49A0 E010A600 2463AF84 */  addiu     $v1, $v1, %lo(D_E010AF84)
/* 3E49A4 E010A604 8C620000 */  lw        $v0, 0x0($v1)
/* 3E49A8 E010A608 0053102A */  slt       $v0, $v0, $s3
/* 3E49AC E010A60C 54400001 */  bnel      $v0, $zero, .LE010A614
/* 3E49B0 E010A610 AC730000 */   sw       $s3, 0x0($v1)
.LE010A614:
/* 3E49B4 E010A614 3C04DB06 */  lui       $a0, (0xDB060024 >> 16)
/* 3E49B8 E010A618 3C07800A */  lui       $a3, %hi(gMainGfxPos)
/* 3E49BC E010A61C 24E7A66C */  addiu     $a3, $a3, %lo(gMainGfxPos)
/* 3E49C0 E010A620 34840024 */  ori       $a0, $a0, (0xDB060024 & 0xFFFF)
/* 3E49C4 E010A624 8CE50000 */  lw        $a1, 0x0($a3)
/* 3E49C8 E010A628 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 3E49CC E010A62C 00A0182D */  daddu     $v1, $a1, $zero
/* 3E49D0 E010A630 24A50008 */  addiu     $a1, $a1, 0x8
/* 3E49D4 E010A634 ACE50000 */  sw        $a1, 0x0($a3)
/* 3E49D8 E010A638 AC620000 */  sw        $v0, 0x0($v1)
/* 3E49DC E010A63C AC600004 */  sw        $zero, 0x4($v1)
/* 3E49E0 E010A640 ACA40000 */  sw        $a0, 0x0($a1)
/* 3E49E4 E010A644 8EE30010 */  lw        $v1, 0x10($s7)
/* 3E49E8 E010A648 24A20008 */  addiu     $v0, $a1, 0x8
/* 3E49EC E010A64C ACE20000 */  sw        $v0, 0x0($a3)
/* 3E49F0 E010A650 8C62001C */  lw        $v0, 0x1C($v1)
/* 3E49F4 E010A654 3C038000 */  lui       $v1, (0x80000000 >> 16)
/* 3E49F8 E010A658 00431021 */  addu      $v0, $v0, $v1
/* 3E49FC E010A65C ACA20004 */  sw        $v0, 0x4($a1)
/* 3E4A00 E010A660 C64E00D4 */  lwc1      $f14, 0xD4($s2)
/* 3E4A04 E010A664 E7AE0018 */  swc1      $f14, 0x18($sp)
/* 3E4A08 E010A668 C64E00D8 */  lwc1      $f14, 0xD8($s2)
/* 3E4A0C E010A66C E7AE001C */  swc1      $f14, 0x1C($sp)
/* 3E4A10 E010A670 C64E00DC */  lwc1      $f14, 0xDC($s2)
/* 3E4A14 E010A674 E7AE0020 */  swc1      $f14, 0x20($sp)
/* 3E4A18 E010A678 C64E00E0 */  lwc1      $f14, 0xE0($s2)
/* 3E4A1C E010A67C E7AE0024 */  swc1      $f14, 0x24($sp)
/* 3E4A20 E010A680 C64E00E4 */  lwc1      $f14, 0xE4($s2)
/* 3E4A24 E010A684 E7AE0028 */  swc1      $f14, 0x28($sp)
/* 3E4A28 E010A688 C64E00E8 */  lwc1      $f14, 0xE8($s2)
/* 3E4A2C E010A68C E7AE002C */  swc1      $f14, 0x2C($sp)
/* 3E4A30 E010A690 C64E00EC */  lwc1      $f14, 0xEC($s2)
/* 3E4A34 E010A694 E7AE0030 */  swc1      $f14, 0x30($sp)
/* 3E4A38 E010A698 C64E00F0 */  lwc1      $f14, 0xF0($s2)
/* 3E4A3C E010A69C E7AE0034 */  swc1      $f14, 0x34($sp)
/* 3E4A40 E010A6A0 C64E00F4 */  lwc1      $f14, 0xF4($s2)
/* 3E4A44 E010A6A4 E7AE0038 */  swc1      $f14, 0x38($sp)
/* 3E4A48 E010A6A8 C64E00F8 */  lwc1      $f14, 0xF8($s2)
/* 3E4A4C E010A6AC E7AE003C */  swc1      $f14, 0x3C($sp)
/* 3E4A50 E010A6B0 C64E00FC */  lwc1      $f14, 0xFC($s2)
/* 3E4A54 E010A6B4 E7AE0040 */  swc1      $f14, 0x40($sp)
/* 3E4A58 E010A6B8 C64E0100 */  lwc1      $f14, 0x100($s2)
/* 3E4A5C E010A6BC E7AE0044 */  swc1      $f14, 0x44($sp)
/* 3E4A60 E010A6C0 C64E0104 */  lwc1      $f14, 0x104($s2)
/* 3E4A64 E010A6C4 E7AE0048 */  swc1      $f14, 0x48($sp)
/* 3E4A68 E010A6C8 C64E0108 */  lwc1      $f14, 0x108($s2)
/* 3E4A6C E010A6CC E7AE004C */  swc1      $f14, 0x4C($sp)
/* 3E4A70 E010A6D0 C64E010C */  lwc1      $f14, 0x10C($s2)
/* 3E4A74 E010A6D4 E7AE0050 */  swc1      $f14, 0x50($sp)
/* 3E4A78 E010A6D8 C64E0110 */  lwc1      $f14, 0x110($s2)
/* 3E4A7C E010A6DC 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 3E4A80 E010A6E0 E7AE0054 */  swc1      $f14, 0x54($sp)
/* 3E4A84 E010A6E4 ACA20008 */  sw        $v0, 0x8($a1)
/* 3E4A88 E010A6E8 00161080 */  sll       $v0, $s6, 2
/* 3E4A8C E010A6EC 3C03E011 */  lui       $v1, (0xE0110000 >> 16)
/* 3E4A90 E010A6F0 00621821 */  addu      $v1, $v1, $v0
/* 3E4A94 E010A6F4 8C63ACCC */  lw        $v1, -0x5334($v1)
/* 3E4A98 E010A6F8 24A20010 */  addiu     $v0, $a1, 0x10
/* 3E4A9C E010A6FC ACE20000 */  sw        $v0, 0x0($a3)
/* 3E4AA0 E010A700 ACA3000C */  sw        $v1, 0xC($a1)
/* 3E4AA4 E010A704 C62E0004 */  lwc1      $f14, 0x4($s1)
/* 3E4AA8 E010A708 E7AE0060 */  swc1      $f14, 0x60($sp)
/* 3E4AAC E010A70C C62E0008 */  lwc1      $f14, 0x8($s1)
/* 3E4AB0 E010A710 E7AE0064 */  swc1      $f14, 0x64($sp)
/* 3E4AB4 E010A714 C62E000C */  lwc1      $f14, 0xC($s1)
/* 3E4AB8 E010A718 E7AE0068 */  swc1      $f14, 0x68($sp)
/* 3E4ABC E010A71C C63E0044 */  lwc1      $f30, 0x44($s1)
/* 3E4AC0 E010A720 24A20018 */  addiu     $v0, $a1, 0x18
/* 3E4AC4 E010A724 ACE20000 */  sw        $v0, 0x0($a3)
/* 3E4AC8 E010A728 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 3E4ACC E010A72C ACA20010 */  sw        $v0, 0x10($a1)
/* 3E4AD0 E010A730 92220027 */  lbu       $v0, 0x27($s1)
/* 3E4AD4 E010A734 9224002B */  lbu       $a0, 0x2B($s1)
/* 3E4AD8 E010A738 9226002F */  lbu       $a2, 0x2F($s1)
/* 3E4ADC E010A73C 24A30020 */  addiu     $v1, $a1, 0x20
/* 3E4AE0 E010A740 ACE30000 */  sw        $v1, 0x0($a3)
/* 3E4AE4 E010A744 3C03FB00 */  lui       $v1, (0xFB000000 >> 16)
/* 3E4AE8 E010A748 ACA30018 */  sw        $v1, 0x18($a1)
/* 3E4AEC E010A74C 326300FF */  andi      $v1, $s3, 0xFF
/* 3E4AF0 E010A750 00021600 */  sll       $v0, $v0, 24
/* 3E4AF4 E010A754 00042400 */  sll       $a0, $a0, 16
/* 3E4AF8 E010A758 00441025 */  or        $v0, $v0, $a0
/* 3E4AFC E010A75C 00063200 */  sll       $a2, $a2, 8
/* 3E4B00 E010A760 00461025 */  or        $v0, $v0, $a2
/* 3E4B04 E010A764 00431025 */  or        $v0, $v0, $v1
/* 3E4B08 E010A768 ACA20014 */  sw        $v0, 0x14($a1)
/* 3E4B0C E010A76C 92220027 */  lbu       $v0, 0x27($s1)
/* 3E4B10 E010A770 9224002B */  lbu       $a0, 0x2B($s1)
/* 3E4B14 E010A774 9223002F */  lbu       $v1, 0x2F($s1)
/* 3E4B18 E010A778 00021600 */  sll       $v0, $v0, 24
/* 3E4B1C E010A77C 00042400 */  sll       $a0, $a0, 16
/* 3E4B20 E010A780 00441025 */  or        $v0, $v0, $a0
/* 3E4B24 E010A784 00031A00 */  sll       $v1, $v1, 8
/* 3E4B28 E010A788 00431025 */  or        $v0, $v0, $v1
/* 3E4B2C E010A78C ACA2001C */  sw        $v0, 0x1C($a1)
/* 3E4B30 E010A790 24020001 */  addiu     $v0, $zero, 0x1
/* 3E4B34 E010A794 17C20009 */  bne       $fp, $v0, .LE010A7BC
/* 3E4B38 E010A798 0000A02D */   daddu    $s4, $zero, $zero
/* 3E4B3C E010A79C 3C03E011 */  lui       $v1, %hi(D_E010AF68)
/* 3E4B40 E010A7A0 2463AF68 */  addiu     $v1, $v1, %lo(D_E010AF68)
/* 3E4B44 E010A7A4 001610C0 */  sll       $v0, $s6, 3
/* 3E4B48 E010A7A8 00431021 */  addu      $v0, $v0, $v1
/* 3E4B4C E010A7AC 8C540000 */  lw        $s4, 0x0($v0)
/* 3E4B50 E010A7B0 8C570004 */  lw        $s7, 0x4($v0)
/* 3E4B54 E010A7B4 080429F1 */  j         .LE010A7C4
/* 3E4B58 E010A7B8 0000A82D */   daddu    $s5, $zero, $zero
.LE010A7BC:
/* 3E4B5C E010A7BC 24170004 */  addiu     $s7, $zero, 0x4
/* 3E4B60 E010A7C0 0000A82D */  daddu     $s5, $zero, $zero
.LE010A7C4:
/* 3E4B64 E010A7C4 1AE00129 */  blez      $s7, .LE010AC6C
/* 3E4B68 E010A7C8 26930001 */   addiu    $s3, $s4, 0x1
/* 3E4B6C E010A7CC 3C16800A */  lui       $s6, %hi(gMainGfxPos)
/* 3E4B70 E010A7D0 26D6A66C */  addiu     $s6, $s6, %lo(gMainGfxPos)
/* 3E4B74 E010A7D4 0220802D */  daddu     $s0, $s1, $zero
/* 3E4B78 E010A7D8 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 3E4B7C E010A7DC 4481E000 */  mtc1      $at, $f28
.LE010A7E0:
/* 3E4B80 E010A7E0 24020001 */  addiu     $v0, $zero, 0x1
/* 3E4B84 E010A7E4 17C20030 */  bne       $fp, $v0, .LE010A8A8
/* 3E4B88 E010A7E8 00000000 */   nop
/* 3E4B8C E010A7EC 0C080138 */  jal       shim_rand_int
/* 3E4B90 E010A7F0 24040010 */   addiu    $a0, $zero, 0x10
/* 3E4B94 E010A7F4 28420006 */  slti      $v0, $v0, 0x6
/* 3E4B98 E010A7F8 54400117 */  bnel      $v0, $zero, .LE010AC58
/* 3E4B9C E010A7FC 26100004 */   addiu    $s0, $s0, 0x4
/* 3E4BA0 E010A800 82830000 */  lb        $v1, 0x0($s4)
/* 3E4BA4 E010A804 C7AE005C */  lwc1      $f14, 0x5C($sp)
/* 3E4BA8 E010A808 44832000 */  mtc1      $v1, $f4
/* 3E4BAC E010A80C 00000000 */  nop
/* 3E4BB0 E010A810 46802120 */  cvt.s.w   $f4, $f4
/* 3E4BB4 E010A814 460E2102 */  mul.s     $f4, $f4, $f14
/* 3E4BB8 E010A818 00000000 */  nop
/* 3E4BBC E010A81C 82620001 */  lb        $v0, 0x1($s3)
/* 3E4BC0 E010A820 C7AE0058 */  lwc1      $f14, 0x58($sp)
/* 3E4BC4 E010A824 44823000 */  mtc1      $v0, $f6
/* 3E4BC8 E010A828 00000000 */  nop
/* 3E4BCC E010A82C 468031A0 */  cvt.s.w   $f6, $f6
/* 3E4BD0 E010A830 460E3002 */  mul.s     $f0, $f6, $f14
/* 3E4BD4 E010A834 00000000 */  nop
/* 3E4BD8 E010A838 82620000 */  lb        $v0, 0x0($s3)
/* 3E4BDC E010A83C 44821000 */  mtc1      $v0, $f2
/* 3E4BE0 E010A840 00000000 */  nop
/* 3E4BE4 E010A844 468010A0 */  cvt.s.w   $f2, $f2
/* 3E4BE8 E010A848 461E1082 */  mul.s     $f2, $f2, $f30
/* 3E4BEC E010A84C 00000000 */  nop
/* 3E4BF0 E010A850 46002100 */  add.s     $f4, $f4, $f0
/* 3E4BF4 E010A854 00031823 */  negu      $v1, $v1
/* 3E4BF8 E010A858 44830000 */  mtc1      $v1, $f0
/* 3E4BFC E010A85C 00000000 */  nop
/* 3E4C00 E010A860 46800020 */  cvt.s.w   $f0, $f0
/* 3E4C04 E010A864 460E0002 */  mul.s     $f0, $f0, $f14
/* 3E4C08 E010A868 00000000 */  nop
/* 3E4C0C E010A86C C7AE005C */  lwc1      $f14, 0x5C($sp)
/* 3E4C10 E010A870 460E3182 */  mul.s     $f6, $f6, $f14
/* 3E4C14 E010A874 00000000 */  nop
/* 3E4C18 E010A878 461E2102 */  mul.s     $f4, $f4, $f30
/* 3E4C1C E010A87C 00000000 */  nop
/* 3E4C20 E010A880 46060000 */  add.s     $f0, $f0, $f6
/* 3E4C24 E010A884 461E0002 */  mul.s     $f0, $f0, $f30
/* 3E4C28 E010A888 00000000 */  nop
/* 3E4C2C E010A88C C7AE0064 */  lwc1      $f14, 0x64($sp)
/* 3E4C30 E010A890 460E1680 */  add.s     $f26, $f2, $f14
/* 3E4C34 E010A894 C7AE0060 */  lwc1      $f14, 0x60($sp)
/* 3E4C38 E010A898 460E2600 */  add.s     $f24, $f4, $f14
/* 3E4C3C E010A89C C7AE0068 */  lwc1      $f14, 0x68($sp)
/* 3E4C40 E010A8A0 08042A2D */  j         .LE010A8B4
/* 3E4C44 E010A8A4 460E0100 */   add.s    $f4, $f0, $f14
.LE010A8A8:
/* 3E4C48 E010A8A8 C6180050 */  lwc1      $f24, 0x50($s0)
/* 3E4C4C E010A8AC C61A0060 */  lwc1      $f26, 0x60($s0)
/* 3E4C50 E010A8B0 C6040070 */  lwc1      $f4, 0x70($s0)
.LE010A8B4:
/* 3E4C54 E010A8B4 C7AE0018 */  lwc1      $f14, 0x18($sp)
/* 3E4C58 E010A8B8 46187182 */  mul.s     $f6, $f14, $f24
/* 3E4C5C E010A8BC 00000000 */  nop
/* 3E4C60 E010A8C0 C7AE0028 */  lwc1      $f14, 0x28($sp)
/* 3E4C64 E010A8C4 461A7402 */  mul.s     $f16, $f14, $f26
/* 3E4C68 E010A8C8 00000000 */  nop
/* 3E4C6C E010A8CC C7AE0038 */  lwc1      $f14, 0x38($sp)
/* 3E4C70 E010A8D0 46047482 */  mul.s     $f18, $f14, $f4
/* 3E4C74 E010A8D4 00000000 */  nop
/* 3E4C78 E010A8D8 C7AE001C */  lwc1      $f14, 0x1C($sp)
/* 3E4C7C E010A8DC 46187202 */  mul.s     $f8, $f14, $f24
/* 3E4C80 E010A8E0 00000000 */  nop
/* 3E4C84 E010A8E4 C7AE002C */  lwc1      $f14, 0x2C($sp)
/* 3E4C88 E010A8E8 461A7302 */  mul.s     $f12, $f14, $f26
/* 3E4C8C E010A8EC 00000000 */  nop
/* 3E4C90 E010A8F0 C7AE003C */  lwc1      $f14, 0x3C($sp)
/* 3E4C94 E010A8F4 46047502 */  mul.s     $f20, $f14, $f4
/* 3E4C98 E010A8F8 00000000 */  nop
/* 3E4C9C E010A8FC C7AE0020 */  lwc1      $f14, 0x20($sp)
/* 3E4CA0 E010A900 46187282 */  mul.s     $f10, $f14, $f24
/* 3E4CA4 E010A904 00000000 */  nop
/* 3E4CA8 E010A908 C7AE0030 */  lwc1      $f14, 0x30($sp)
/* 3E4CAC E010A90C 461A7382 */  mul.s     $f14, $f14, $f26
/* 3E4CB0 E010A910 00000000 */  nop
/* 3E4CB4 E010A914 E7AE0070 */  swc1      $f14, 0x70($sp)
/* 3E4CB8 E010A918 C7AE0040 */  lwc1      $f14, 0x40($sp)
/* 3E4CBC E010A91C 46047582 */  mul.s     $f22, $f14, $f4
/* 3E4CC0 E010A920 00000000 */  nop
/* 3E4CC4 E010A924 C7AE0024 */  lwc1      $f14, 0x24($sp)
/* 3E4CC8 E010A928 46187002 */  mul.s     $f0, $f14, $f24
/* 3E4CCC E010A92C 00000000 */  nop
/* 3E4CD0 E010A930 C7AE0034 */  lwc1      $f14, 0x34($sp)
/* 3E4CD4 E010A934 461A7082 */  mul.s     $f2, $f14, $f26
/* 3E4CD8 E010A938 00000000 */  nop
/* 3E4CDC E010A93C C7AE0044 */  lwc1      $f14, 0x44($sp)
/* 3E4CE0 E010A940 46047102 */  mul.s     $f4, $f14, $f4
/* 3E4CE4 E010A944 00000000 */  nop
/* 3E4CE8 E010A948 46103180 */  add.s     $f6, $f6, $f16
/* 3E4CEC E010A94C 46123180 */  add.s     $f6, $f6, $f18
/* 3E4CF0 E010A950 460C4200 */  add.s     $f8, $f8, $f12
/* 3E4CF4 E010A954 46144200 */  add.s     $f8, $f8, $f20
/* 3E4CF8 E010A958 46020000 */  add.s     $f0, $f0, $f2
/* 3E4CFC E010A95C 46040000 */  add.s     $f0, $f0, $f4
/* 3E4D00 E010A960 C7AE0054 */  lwc1      $f14, 0x54($sp)
/* 3E4D04 E010A964 460E0080 */  add.s     $f2, $f0, $f14
/* 3E4D08 E010A968 C7AE0048 */  lwc1      $f14, 0x48($sp)
/* 3E4D0C E010A96C 460E3100 */  add.s     $f4, $f6, $f14
/* 3E4D10 E010A970 C7AE0070 */  lwc1      $f14, 0x70($sp)
/* 3E4D14 E010A974 460E5280 */  add.s     $f10, $f10, $f14
/* 3E4D18 E010A978 C7AE004C */  lwc1      $f14, 0x4C($sp)
/* 3E4D1C E010A97C 460E4200 */  add.s     $f8, $f8, $f14
/* 3E4D20 E010A980 46165280 */  add.s     $f10, $f10, $f22
/* 3E4D24 E010A984 44807000 */  mtc1      $zero, $f14
/* 3E4D28 E010A988 00000000 */  nop
/* 3E4D2C E010A98C 460E1032 */  c.eq.s    $f2, $f14
/* 3E4D30 E010A990 C7AE0050 */  lwc1      $f14, 0x50($sp)
/* 3E4D34 E010A994 450100AF */  bc1t      .LE010AC54
/* 3E4D38 E010A998 460E5000 */   add.s    $f0, $f10, $f14
/* 3E4D3C E010A99C 4602E083 */  div.s     $f2, $f28, $f2
/* 3E4D40 E010A9A0 46022602 */  mul.s     $f24, $f4, $f2
/* 3E4D44 E010A9A4 00000000 */  nop
/* 3E4D48 E010A9A8 46020102 */  mul.s     $f4, $f0, $f2
/* 3E4D4C E010A9AC 00000000 */  nop
/* 3E4D50 E010A9B0 46004007 */  neg.s     $f0, $f8
/* 3E4D54 E010A9B4 46020682 */  mul.s     $f26, $f0, $f2
/* 3E4D58 E010A9B8 00000000 */  nop
/* 3E4D5C E010A9BC 3C01BF80 */  lui       $at, (0xBF800000 >> 16)
/* 3E4D60 E010A9C0 44817000 */  mtc1      $at, $f14
/* 3E4D64 E010A9C4 00000000 */  nop
/* 3E4D68 E010A9C8 460E203E */  c.le.s    $f4, $f14
/* 3E4D6C E010A9CC 00000000 */  nop
/* 3E4D70 E010A9D0 450300A1 */  bc1tl     .LE010AC58
/* 3E4D74 E010A9D4 26100004 */   addiu    $s0, $s0, 0x4
/* 3E4D78 E010A9D8 460EC03E */  c.le.s    $f24, $f14
/* 3E4D7C E010A9DC 00000000 */  nop
/* 3E4D80 E010A9E0 4503009D */  bc1tl     .LE010AC58
/* 3E4D84 E010A9E4 26100004 */   addiu    $s0, $s0, 0x4
/* 3E4D88 E010A9E8 4618E03E */  c.le.s    $f28, $f24
/* 3E4D8C E010A9EC 00000000 */  nop
/* 3E4D90 E010A9F0 45030099 */  bc1tl     .LE010AC58
/* 3E4D94 E010A9F4 26100004 */   addiu    $s0, $s0, 0x4
/* 3E4D98 E010A9F8 460ED03E */  c.le.s    $f26, $f14
/* 3E4D9C E010A9FC 00000000 */  nop
/* 3E4DA0 E010AA00 45030095 */  bc1tl     .LE010AC58
/* 3E4DA4 E010AA04 26100004 */   addiu    $s0, $s0, 0x4
/* 3E4DA8 E010AA08 461AE03E */  c.le.s    $f28, $f26
/* 3E4DAC E010AA0C 00000000 */  nop
/* 3E4DB0 E010AA10 45030091 */  bc1tl     .LE010AC58
/* 3E4DB4 E010AA14 26100004 */   addiu    $s0, $s0, 0x4
/* 3E4DB8 E010AA18 8642000A */  lh        $v0, 0xA($s2)
/* 3E4DBC E010AA1C 461CC000 */  add.s     $f0, $f24, $f28
/* 3E4DC0 E010AA20 44821000 */  mtc1      $v0, $f2
/* 3E4DC4 E010AA24 00000000 */  nop
/* 3E4DC8 E010AA28 468010A0 */  cvt.s.w   $f2, $f2
/* 3E4DCC E010AA2C 46020002 */  mul.s     $f0, $f0, $f2
/* 3E4DD0 E010AA30 00000000 */  nop
/* 3E4DD4 E010AA34 3C013FE0 */  lui       $at, (0x3FE00000 >> 16)
/* 3E4DD8 E010AA38 44817800 */  mtc1      $at, $f15
/* 3E4DDC E010AA3C 44807000 */  mtc1      $zero, $f14
/* 3E4DE0 E010AA40 46000021 */  cvt.d.s   $f0, $f0
/* 3E4DE4 E010AA44 462E0002 */  mul.d     $f0, $f0, $f14
/* 3E4DE8 E010AA48 00000000 */  nop
/* 3E4DEC E010AA4C 8642000C */  lh        $v0, 0xC($s2)
/* 3E4DF0 E010AA50 461CD080 */  add.s     $f2, $f26, $f28
/* 3E4DF4 E010AA54 44822000 */  mtc1      $v0, $f4
/* 3E4DF8 E010AA58 00000000 */  nop
/* 3E4DFC E010AA5C 46802120 */  cvt.s.w   $f4, $f4
/* 3E4E00 E010AA60 46041082 */  mul.s     $f2, $f2, $f4
/* 3E4E04 E010AA64 00000000 */  nop
/* 3E4E08 E010AA68 460010A1 */  cvt.d.s   $f2, $f2
/* 3E4E0C E010AA6C 462E1082 */  mul.d     $f2, $f2, $f14
/* 3E4E10 E010AA70 00000000 */  nop
/* 3E4E14 E010AA74 8642000E */  lh        $v0, 0xE($s2)
/* 3E4E18 E010AA78 46200620 */  cvt.s.d   $f24, $f0
/* 3E4E1C E010AA7C 44820000 */  mtc1      $v0, $f0
/* 3E4E20 E010AA80 00000000 */  nop
/* 3E4E24 E010AA84 46800020 */  cvt.s.w   $f0, $f0
/* 3E4E28 E010AA88 4600C600 */  add.s     $f24, $f24, $f0
/* 3E4E2C E010AA8C 3C014080 */  lui       $at, (0x40800000 >> 16)
/* 3E4E30 E010AA90 44812000 */  mtc1      $at, $f4
/* 3E4E34 E010AA94 00000000 */  nop
/* 3E4E38 E010AA98 4604C602 */  mul.s     $f24, $f24, $f4
/* 3E4E3C E010AA9C 00000000 */  nop
/* 3E4E40 E010AAA0 86420010 */  lh        $v0, 0x10($s2)
/* 3E4E44 E010AAA4 44820000 */  mtc1      $v0, $f0
/* 3E4E48 E010AAA8 00000000 */  nop
/* 3E4E4C E010AAAC 46800020 */  cvt.s.w   $f0, $f0
/* 3E4E50 E010AAB0 462016A0 */  cvt.s.d   $f26, $f2
/* 3E4E54 E010AAB4 4600D680 */  add.s     $f26, $f26, $f0
/* 3E4E58 E010AAB8 3C014100 */  lui       $at, (0x41000000 >> 16)
/* 3E4E5C E010AABC 44810000 */  mtc1      $at, $f0
/* 3E4E60 E010AAC0 8EC40000 */  lw        $a0, 0x0($s6)
/* 3E4E64 E010AAC4 4600C000 */  add.s     $f0, $f24, $f0
/* 3E4E68 E010AAC8 24820008 */  addiu     $v0, $a0, 0x8
/* 3E4E6C E010AACC AEC20000 */  sw        $v0, 0x0($s6)
/* 3E4E70 E010AAD0 4604D682 */  mul.s     $f26, $f26, $f4
/* 3E4E74 E010AAD4 00000000 */  nop
/* 3E4E78 E010AAD8 4600038D */  trunc.w.s $f14, $f0
/* 3E4E7C E010AADC 44027000 */  mfc1      $v0, $f14
/* 3E4E80 E010AAE0 00000000 */  nop
/* 3E4E84 E010AAE4 00021400 */  sll       $v0, $v0, 16
/* 3E4E88 E010AAE8 00021403 */  sra       $v0, $v0, 16
/* 3E4E8C E010AAEC 18400005 */  blez      $v0, .LE010AB04
/* 3E4E90 E010AAF0 30420FFF */   andi     $v0, $v0, 0xFFF
/* 3E4E94 E010AAF4 00021300 */  sll       $v0, $v0, 12
/* 3E4E98 E010AAF8 3C03E400 */  lui       $v1, (0xE4000000 >> 16)
/* 3E4E9C E010AAFC 08042AC2 */  j         .LE010AB08
/* 3E4EA0 E010AB00 00431825 */   or       $v1, $v0, $v1
.LE010AB04:
/* 3E4EA4 E010AB04 3C03E400 */  lui       $v1, (0xE4000000 >> 16)
.LE010AB08:
/* 3E4EA8 E010AB08 3C014100 */  lui       $at, (0x41000000 >> 16)
/* 3E4EAC E010AB0C 44810000 */  mtc1      $at, $f0
/* 3E4EB0 E010AB10 00000000 */  nop
/* 3E4EB4 E010AB14 4600D000 */  add.s     $f0, $f26, $f0
/* 3E4EB8 E010AB18 4600038D */  trunc.w.s $f14, $f0
/* 3E4EBC E010AB1C 44027000 */  mfc1      $v0, $f14
/* 3E4EC0 E010AB20 00000000 */  nop
/* 3E4EC4 E010AB24 00021400 */  sll       $v0, $v0, 16
/* 3E4EC8 E010AB28 00021403 */  sra       $v0, $v0, 16
/* 3E4ECC E010AB2C 18400004 */  blez      $v0, .LE010AB40
/* 3E4ED0 E010AB30 AC830000 */   sw       $v1, 0x0($a0)
/* 3E4ED4 E010AB34 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3E4ED8 E010AB38 00621025 */  or        $v0, $v1, $v0
/* 3E4EDC E010AB3C AC820000 */  sw        $v0, 0x0($a0)
.LE010AB40:
/* 3E4EE0 E010AB40 4600C38D */  trunc.w.s $f14, $f24
/* 3E4EE4 E010AB44 44027000 */  mfc1      $v0, $f14
/* 3E4EE8 E010AB48 00000000 */  nop
/* 3E4EEC E010AB4C 00021400 */  sll       $v0, $v0, 16
/* 3E4EF0 E010AB50 00021403 */  sra       $v0, $v0, 16
/* 3E4EF4 E010AB54 18400004 */  blez      $v0, .LE010AB68
/* 3E4EF8 E010AB58 24840004 */   addiu    $a0, $a0, 0x4
/* 3E4EFC E010AB5C 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3E4F00 E010AB60 08042ADB */  j         .LE010AB6C
/* 3E4F04 E010AB64 00021B00 */   sll      $v1, $v0, 12
.LE010AB68:
/* 3E4F08 E010AB68 0000182D */  daddu     $v1, $zero, $zero
.LE010AB6C:
/* 3E4F0C E010AB6C 4600D38D */  trunc.w.s $f14, $f26
/* 3E4F10 E010AB70 44027000 */  mfc1      $v0, $f14
/* 3E4F14 E010AB74 00000000 */  nop
/* 3E4F18 E010AB78 00021400 */  sll       $v0, $v0, 16
/* 3E4F1C E010AB7C 00021403 */  sra       $v0, $v0, 16
/* 3E4F20 E010AB80 18400004 */  blez      $v0, .LE010AB94
/* 3E4F24 E010AB84 AC830000 */   sw       $v1, 0x0($a0)
/* 3E4F28 E010AB88 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3E4F2C E010AB8C 00621025 */  or        $v0, $v1, $v0
/* 3E4F30 E010AB90 AC820000 */  sw        $v0, 0x0($a0)
.LE010AB94:
/* 3E4F34 E010AB94 8EC20000 */  lw        $v0, 0x0($s6)
/* 3E4F38 E010AB98 0040182D */  daddu     $v1, $v0, $zero
/* 3E4F3C E010AB9C 24420008 */  addiu     $v0, $v0, 0x8
/* 3E4F40 E010ABA0 AEC20000 */  sw        $v0, 0x0($s6)
/* 3E4F44 E010ABA4 3C02E100 */  lui       $v0, (0xE1000000 >> 16)
/* 3E4F48 E010ABA8 AC620000 */  sw        $v0, 0x0($v1)
/* 3E4F4C E010ABAC 4600C38D */  trunc.w.s $f14, $f24
/* 3E4F50 E010ABB0 44027000 */  mfc1      $v0, $f14
/* 3E4F54 E010ABB4 00000000 */  nop
/* 3E4F58 E010ABB8 00021400 */  sll       $v0, $v0, 16
/* 3E4F5C E010ABBC 00021403 */  sra       $v0, $v0, 16
/* 3E4F60 E010ABC0 04410008 */  bgez      $v0, .LE010ABE4
/* 3E4F64 E010ABC4 24630004 */   addiu    $v1, $v1, 0x4
/* 3E4F68 E010ABC8 000221C0 */  sll       $a0, $v0, 7
/* 3E4F6C E010ABCC 5C800001 */  bgtzl     $a0, .LE010ABD4
/* 3E4F70 E010ABD0 0000202D */   daddu    $a0, $zero, $zero
.LE010ABD4:
/* 3E4F74 E010ABD4 24020080 */  addiu     $v0, $zero, 0x80
/* 3E4F78 E010ABD8 00441023 */  subu      $v0, $v0, $a0
/* 3E4F7C E010ABDC 08042AFA */  j         .LE010ABE8
/* 3E4F80 E010ABE0 00022C00 */   sll      $a1, $v0, 16
.LE010ABE4:
/* 3E4F84 E010ABE4 3C050080 */  lui       $a1, (0x800080 >> 16)
.LE010ABE8:
/* 3E4F88 E010ABE8 44807000 */  mtc1      $zero, $f14
/* 3E4F8C E010ABEC 00000000 */  nop
/* 3E4F90 E010ABF0 460ED03C */  c.lt.s    $f26, $f14
/* 3E4F94 E010ABF4 00000000 */  nop
/* 3E4F98 E010ABF8 4500000C */  bc1f      .LE010AC2C
/* 3E4F9C E010ABFC 34A20080 */   ori      $v0, $a1, (0x800080 & 0xFFFF)
/* 3E4FA0 E010AC00 4600D38D */  trunc.w.s $f14, $f26
/* 3E4FA4 E010AC04 44027000 */  mfc1      $v0, $f14
/* 3E4FA8 E010AC08 00000000 */  nop
/* 3E4FAC E010AC0C 00021400 */  sll       $v0, $v0, 16
/* 3E4FB0 E010AC10 00022243 */  sra       $a0, $v0, 9
/* 3E4FB4 E010AC14 5C800001 */  bgtzl     $a0, .LE010AC1C
/* 3E4FB8 E010AC18 0000202D */   daddu    $a0, $zero, $zero
.LE010AC1C:
/* 3E4FBC E010AC1C 24020080 */  addiu     $v0, $zero, 0x80
/* 3E4FC0 E010AC20 00441023 */  subu      $v0, $v0, $a0
/* 3E4FC4 E010AC24 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 3E4FC8 E010AC28 00A21025 */  or        $v0, $a1, $v0
.LE010AC2C:
/* 3E4FCC E010AC2C AC620000 */  sw        $v0, 0x0($v1)
/* 3E4FD0 E010AC30 3C044000 */  lui       $a0, (0x40004000 >> 16)
/* 3E4FD4 E010AC34 8EC20000 */  lw        $v0, 0x0($s6)
/* 3E4FD8 E010AC38 34844000 */  ori       $a0, $a0, (0x40004000 & 0xFFFF)
/* 3E4FDC E010AC3C 0040182D */  daddu     $v1, $v0, $zero
/* 3E4FE0 E010AC40 24420008 */  addiu     $v0, $v0, 0x8
/* 3E4FE4 E010AC44 AEC20000 */  sw        $v0, 0x0($s6)
/* 3E4FE8 E010AC48 3C02F100 */  lui       $v0, (0xF1000000 >> 16)
/* 3E4FEC E010AC4C AC620000 */  sw        $v0, 0x0($v1)
/* 3E4FF0 E010AC50 AC640004 */  sw        $a0, 0x4($v1)
.LE010AC54:
/* 3E4FF4 E010AC54 26100004 */  addiu     $s0, $s0, 0x4
.LE010AC58:
/* 3E4FF8 E010AC58 26B50001 */  addiu     $s5, $s5, 0x1
/* 3E4FFC E010AC5C 26730003 */  addiu     $s3, $s3, 0x3
/* 3E5000 E010AC60 02B7102A */  slt       $v0, $s5, $s7
/* 3E5004 E010AC64 1440FEDE */  bnez      $v0, .LE010A7E0
/* 3E5008 E010AC68 26940003 */   addiu    $s4, $s4, 0x3
.LE010AC6C:
/* 3E500C E010AC6C 8FBF009C */  lw        $ra, 0x9C($sp)
/* 3E5010 E010AC70 8FBE0098 */  lw        $fp, 0x98($sp)
/* 3E5014 E010AC74 8FB70094 */  lw        $s7, 0x94($sp)
/* 3E5018 E010AC78 8FB60090 */  lw        $s6, 0x90($sp)
/* 3E501C E010AC7C 8FB5008C */  lw        $s5, 0x8C($sp)
/* 3E5020 E010AC80 8FB40088 */  lw        $s4, 0x88($sp)
/* 3E5024 E010AC84 8FB30084 */  lw        $s3, 0x84($sp)
/* 3E5028 E010AC88 8FB20080 */  lw        $s2, 0x80($sp)
/* 3E502C E010AC8C 8FB1007C */  lw        $s1, 0x7C($sp)
/* 3E5030 E010AC90 8FB00078 */  lw        $s0, 0x78($sp)
/* 3E5034 E010AC94 D7BE00C8 */  ldc1      $f30, 0xC8($sp)
/* 3E5038 E010AC98 D7BC00C0 */  ldc1      $f28, 0xC0($sp)
/* 3E503C E010AC9C D7BA00B8 */  ldc1      $f26, 0xB8($sp)
/* 3E5040 E010ACA0 D7B800B0 */  ldc1      $f24, 0xB0($sp)
/* 3E5044 E010ACA4 D7B600A8 */  ldc1      $f22, 0xA8($sp)
/* 3E5048 E010ACA8 D7B400A0 */  ldc1      $f20, 0xA0($sp)
/* 3E504C E010ACAC 03E00008 */  jr        $ra
/* 3E5050 E010ACB0 27BD00D0 */   addiu    $sp, $sp, 0xD0
/* 3E5054 E010ACB4 00000000 */  nop
/* 3E5058 E010ACB8 00000000 */  nop
/* 3E505C E010ACBC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void firework_rocket_appendGfx(void* effect) {
    FireworkRocketFXData* data = ((EffectInstance*)effect)->data.fireworkRocket;
    Camera* camera = &gCameras[gCurrentCameraID];
    s32 minBlurAlpha = data->minBlurAlpha;
    s32 variation = data->variation;
    f32 mtx_0_0, mtx_0_1, mtx_0_2, mtx_0_3;
    f32 mtx_1_0, mtx_1_1, mtx_1_2, mtx_1_3;
    f32 mtx_2_0, mtx_2_1, mtx_2_2, mtx_2_3;
    f32 mtx_3_0, mtx_3_1, mtx_3_2, mtx_3_3;
    f32 sinTheta, cosTheta;
    f32 centerX, centerY, centerZ;
    f32 negYaw;
    f32 x, y, z;
    f32 outX, outY, outZ, outS;
    f32 radius;
    s32 isExploded;
    s32 numSparks;
    Vec3b* sparkDir;
    s32 i;

    negYaw = -camera->currentYaw;
    sinTheta = shim_sin_deg(negYaw);
    cosTheta = shim_cos_deg(negYaw);
    isExploded = data->isExploded;
    if (firework_rocket_frame_counter != gGameStatusPtr->frameCounter) {
        // draw previous frame to create motion blur effect
        shim_draw_prev_frame_buffer_at_screen_pos(10, 10, SCREEN_WIDTH - 10, SCREEN_HEIGHT - 10, firework_rocket_blur_alpha * 0.8);
        firework_rocket_frame_counter = gGameStatusPtr->frameCounter;
        firework_rocket_blur_alpha = 0;
    }
    if (firework_rocket_blur_alpha < minBlurAlpha) {
        firework_rocket_blur_alpha = minBlurAlpha;
    }

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

    mtx_0_0 = camera->perspectiveMatrix[0][0];
    mtx_0_1 = camera->perspectiveMatrix[0][1];
    mtx_0_2 = camera->perspectiveMatrix[0][2];
    mtx_0_3 = camera->perspectiveMatrix[0][3];
    mtx_1_0 = camera->perspectiveMatrix[1][0];
    mtx_1_1 = camera->perspectiveMatrix[1][1];
    mtx_1_2 = camera->perspectiveMatrix[1][2];
    mtx_1_3 = camera->perspectiveMatrix[1][3];
    mtx_2_0 = camera->perspectiveMatrix[2][0];
    mtx_2_1 = camera->perspectiveMatrix[2][1];
    mtx_2_2 = camera->perspectiveMatrix[2][2];
    mtx_2_3 = camera->perspectiveMatrix[2][3];
    mtx_3_0 = camera->perspectiveMatrix[3][0];
    mtx_3_1 = camera->perspectiveMatrix[3][1];
    mtx_3_2 = camera->perspectiveMatrix[3][2];
    mtx_3_3 = camera->perspectiveMatrix[3][3];

    gSPDisplayList(gMainGfxPos++, D_E010ACCC[variation]);
    centerX = data->pos.x;
    centerY = data->pos.y;
    centerZ = data->pos.z;
    radius = data->radius;
    gDPSetPrimColor(gMainGfxPos++, 0, 0, data->r, data->g, data->b, minBlurAlpha);
    gDPSetEnvColor(gMainGfxPos++, data->r, data->g, data->b, 0);

    if (isExploded == TRUE) {
        sparkDir = D_E010AF68[variation].sparks;
        numSparks = D_E010AF68[variation].num;
    } else {
        sparkDir = NULL;
        numSparks = 4;
    }

    for (i = 0; i < numSparks; i++, sparkDir++) {
        if (isExploded == TRUE) {
            // create blinking effect
            if (shim_rand_int(16) < 6) {
                continue;
            }
            x = (sparkDir->x * cosTheta + sparkDir->z * sinTheta) * radius + centerX;
            y = sparkDir->y * radius + centerY;
            z = (-sparkDir->x * sinTheta + sparkDir->z * cosTheta) * radius + centerZ;
        } else {
            x = data->rocketX[i];
            y = data->rocketY[i];
            z = data->rocketZ[i];
        }

        // convert world coords to screen coords
        outX = mtx_0_0 * x + mtx_1_0 * y + mtx_2_0 * z + mtx_3_0;
        outY = mtx_0_1 * x + mtx_1_1 * y + mtx_2_1 * z + mtx_3_1;
        outZ = mtx_0_2 * x + mtx_1_2 * y + mtx_2_2 * z + mtx_3_2;
        outS = mtx_0_3 * x + mtx_1_3 * y + mtx_2_3 * z + mtx_3_3;

        if (outS != 0.0f) {
            outS = 1.0f / outS;
            x = outX * outS;
            y = -outY * outS;
            z = outZ * outS;

            if (z <= -1.0f || x <= -1.0f || x >= 1.0f || y <= -1.0f || y >= 1.0f) {
                continue;
            }
            z = 4.0f; // required to match

            x = (x + 1.0f) * camera->viewportW * 0.5;
            x += camera->viewportStartX;
            x *= 4.0f;

            y = (y + 1.0f) * camera->viewportH * 0.5;
            y += camera->viewportStartY;
            y *= 4.0f;

            gSPScisTextureRectangle(gMainGfxPos++,
                x, y, x + 8.0f, y + 8.0f,
                G_TX_RENDERTILE, 4 << 5, 4 << 5, 16 << 10, 16 << 10);
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel motion_blur_flame_appendGfx
/* 3A2BCC E00A223C 27BDFF60 */  addiu     $sp, $sp, -0xA0
/* 3A2BD0 E00A2240 3C07DB06 */  lui       $a3, (0xDB060024 >> 16)
/* 3A2BD4 E00A2244 34E70024 */  ori       $a3, $a3, (0xDB060024 & 0xFFFF)
/* 3A2BD8 E00A2248 3C02800A */  lui       $v0, %hi(gMainGfxPos)
/* 3A2BDC E00A224C 2442A66C */  addiu     $v0, $v0, %lo(gMainGfxPos)
/* 3A2BE0 E00A2250 AFB00078 */  sw        $s0, 0x78($sp)
/* 3A2BE4 E00A2254 0040802D */  daddu     $s0, $v0, $zero
/* 3A2BE8 E00A2258 AFB60090 */  sw        $s6, 0x90($sp)
/* 3A2BEC E00A225C 3C16F510 */  lui       $s6, (0xF5100100 >> 16)
/* 3A2BF0 E00A2260 36D60100 */  ori       $s6, $s6, (0xF5100100 & 0xFFFF)
/* 3A2BF4 E00A2264 AFBF009C */  sw        $ra, 0x9C($sp)
/* 3A2BF8 E00A2268 AFBE0098 */  sw        $fp, 0x98($sp)
/* 3A2BFC E00A226C AFB70094 */  sw        $s7, 0x94($sp)
/* 3A2C00 E00A2270 AFB5008C */  sw        $s5, 0x8C($sp)
/* 3A2C04 E00A2274 AFB40088 */  sw        $s4, 0x88($sp)
/* 3A2C08 E00A2278 AFB30084 */  sw        $s3, 0x84($sp)
/* 3A2C0C E00A227C AFB20080 */  sw        $s2, 0x80($sp)
/* 3A2C10 E00A2280 AFB1007C */  sw        $s1, 0x7C($sp)
/* 3A2C14 E00A2284 AFB60060 */  sw        $s6, 0x60($sp)
/* 3A2C18 E00A2288 8E050000 */  lw        $a1, 0x0($s0)
/* 3A2C1C E00A228C 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 3A2C20 E00A2290 AFA0006C */  sw        $zero, 0x6C($sp)
/* 3A2C24 E00A2294 8C94000C */  lw        $s4, 0xC($a0)
/* 3A2C28 E00A2298 00A0182D */  daddu     $v1, $a1, $zero
/* 3A2C2C E00A229C 24A50008 */  addiu     $a1, $a1, 0x8
/* 3A2C30 E00A22A0 AE050000 */  sw        $a1, 0x0($s0)
/* 3A2C34 E00A22A4 8E860000 */  lw        $a2, 0x0($s4)
/* 3A2C38 E00A22A8 8E96004C */  lw        $s6, 0x4C($s4)
/* 3A2C3C E00A22AC 0280B82D */  daddu     $s7, $s4, $zero
/* 3A2C40 E00A22B0 AFB60050 */  sw        $s6, 0x50($sp)
/* 3A2C44 E00A22B4 AC620000 */  sw        $v0, 0x0($v1)
/* 3A2C48 E00A22B8 24A20008 */  addiu     $v0, $a1, 0x8
/* 3A2C4C E00A22BC AC600004 */  sw        $zero, 0x4($v1)
/* 3A2C50 E00A22C0 AE020000 */  sw        $v0, 0x0($s0)
/* 3A2C54 E00A22C4 ACA70000 */  sw        $a3, 0x0($a1)
/* 3A2C58 E00A22C8 8C830010 */  lw        $v1, 0x10($a0)
/* 3A2C5C E00A22CC 24A20010 */  addiu     $v0, $a1, 0x10
/* 3A2C60 E00A22D0 AE020000 */  sw        $v0, 0x0($s0)
/* 3A2C64 E00A22D4 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 3A2C68 E00A22D8 8C63001C */  lw        $v1, 0x1C($v1)
/* 3A2C6C E00A22DC 3C04E00A */  lui       $a0, %hi(D_E00A29DC)
/* 3A2C70 E00A22E0 248429DC */  addiu     $a0, $a0, %lo(D_E00A29DC)
/* 3A2C74 E00A22E4 ACA20008 */  sw        $v0, 0x8($a1)
/* 3A2C78 E00A22E8 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 3A2C7C E00A22EC 00621821 */  addu      $v1, $v1, $v0
/* 3A2C80 E00A22F0 00061040 */  sll       $v0, $a2, 1
/* 3A2C84 E00A22F4 00461021 */  addu      $v0, $v0, $a2
/* 3A2C88 E00A22F8 000210C0 */  sll       $v0, $v0, 3
/* 3A2C8C E00A22FC 00063080 */  sll       $a2, $a2, 2
/* 3A2C90 E00A2300 ACA30004 */  sw        $v1, 0x4($a1)
/* 3A2C94 E00A2304 3C03E00A */  lui       $v1, (0xE00A29D0 >> 16)
/* 3A2C98 E00A2308 00661821 */  addu      $v1, $v1, $a2
/* 3A2C9C E00A230C 8C6329D0 */  lw        $v1, (0xE00A29D0 & 0xFFFF)($v1)
/* 3A2CA0 E00A2310 00448821 */  addu      $s1, $v0, $a0
/* 3A2CA4 E00A2314 ACA3000C */  sw        $v1, 0xC($a1)
.LE00A2318:
/* 3A2CA8 E00A2318 C6EC001C */  lwc1      $f12, 0x1C($s7)
/* 3A2CAC E00A231C C6EE002C */  lwc1      $f14, 0x2C($s7)
/* 3A2CB0 E00A2320 C6E0003C */  lwc1      $f0, 0x3C($s7)
/* 3A2CB4 E00A2324 8E350010 */  lw        $s5, 0x10($s1)
/* 3A2CB8 E00A2328 8E320014 */  lw        $s2, 0x14($s1)
/* 3A2CBC E00A232C 56F4000A */  bnel      $s7, $s4, .LE00A2358
/* 3A2CC0 E00A2330 E7AC0048 */   swc1     $f12, 0x48($sp)
/* 3A2CC4 E00A2334 27A20048 */  addiu     $v0, $sp, 0x48
/* 3A2CC8 E00A2338 AFA20010 */  sw        $v0, 0x10($sp)
/* 3A2CCC E00A233C 27A2004C */  addiu     $v0, $sp, 0x4C
/* 3A2CD0 E00A2340 44060000 */  mfc1      $a2, $f0
/* 3A2CD4 E00A2344 2407FFFF */  addiu     $a3, $zero, -0x1
/* 3A2CD8 E00A2348 0C08015C */  jal       shim_is_point_visible
/* 3A2CDC E00A234C AFA20014 */   sw       $v0, 0x14($sp)
/* 3A2CE0 E00A2350 080288D9 */  j         .LE00A2364
/* 3A2CE4 E00A2354 0040302D */   daddu    $a2, $v0, $zero
.LE00A2358:
/* 3A2CE8 E00A2358 4600018D */  trunc.w.s $f6, $f0
/* 3A2CEC E00A235C 44063000 */  mfc1      $a2, $f6
/* 3A2CF0 E00A2360 E7AE004C */  swc1      $f14, 0x4C($sp)
.LE00A2364:
/* 3A2CF4 E00A2364 8FB6006C */  lw        $s6, 0x6C($sp)
/* 3A2CF8 E00A2368 03B61021 */  addu      $v0, $sp, $s6
/* 3A2CFC E00A236C AC460018 */  sw        $a2, 0x18($v0)
/* 3A2D00 E00A2370 C7A20048 */  lwc1      $f2, 0x48($sp)
/* 3A2D04 E00A2374 E4420028 */  swc1      $f2, 0x28($v0)
/* 3A2D08 E00A2378 C7A4004C */  lwc1      $f4, 0x4C($sp)
/* 3A2D0C E00A237C 10C0016B */  beqz      $a2, .LE00A292C
/* 3A2D10 E00A2380 E4440038 */   swc1     $f4, 0x38($v0)
/* 3A2D14 E00A2384 44800000 */  mtc1      $zero, $f0
/* 3A2D18 E00A2388 00000000 */  nop
/* 3A2D1C E00A238C 4600103C */  c.lt.s    $f2, $f0
/* 3A2D20 E00A2390 00000000 */  nop
/* 3A2D24 E00A2394 45030166 */  bc1tl     .LE00A2930
/* 3A2D28 E00A2398 26F70004 */   addiu    $s7, $s7, 0x4
/* 3A2D2C E00A239C 4600203C */  c.lt.s    $f4, $f0
/* 3A2D30 E00A23A0 00000000 */  nop
/* 3A2D34 E00A23A4 45030162 */  bc1tl     .LE00A2930
/* 3A2D38 E00A23A8 26F70004 */   addiu    $s7, $s7, 0x4
/* 3A2D3C E00A23AC 3C0143A0 */  lui       $at, (0x43A00000 >> 16)
/* 3A2D40 E00A23B0 44810000 */  mtc1      $at, $f0
/* 3A2D44 E00A23B4 00000000 */  nop
/* 3A2D48 E00A23B8 4602003E */  c.le.s    $f0, $f2
/* 3A2D4C E00A23BC 00000000 */  nop
/* 3A2D50 E00A23C0 4503015B */  bc1tl     .LE00A2930
/* 3A2D54 E00A23C4 26F70004 */   addiu    $s7, $s7, 0x4
/* 3A2D58 E00A23C8 3C014370 */  lui       $at, (0x43700000 >> 16)
/* 3A2D5C E00A23CC 44810000 */  mtc1      $at, $f0
/* 3A2D60 E00A23D0 00000000 */  nop
/* 3A2D64 E00A23D4 4604003E */  c.le.s    $f0, $f4
/* 3A2D68 E00A23D8 00000000 */  nop
/* 3A2D6C E00A23DC 45030154 */  bc1tl     .LE00A2930
/* 3A2D70 E00A23E0 26F70004 */   addiu    $s7, $s7, 0x4
/* 3A2D74 E00A23E4 3C02E00A */  lui       $v0, (0xE00A2A24 >> 16)
/* 3A2D78 E00A23E8 00561021 */  addu      $v0, $v0, $s6
/* 3A2D7C E00A23EC 8C422A24 */  lw        $v0, (0xE00A2A24 & 0xFFFF)($v0)
/* 3A2D80 E00A23F0 8FB60050 */  lw        $s6, 0x50($sp)
/* 3A2D84 E00A23F4 02C20018 */  mult      $s6, $v0
/* 3A2D88 E00A23F8 00001012 */  mflo      $v0
/* 3A2D8C E00A23FC 3C0351EB */  lui       $v1, (0x51EB851F >> 16)
/* 3A2D90 E00A2400 3463851F */  ori       $v1, $v1, (0x51EB851F & 0xFFFF)
/* 3A2D94 E00A2404 00430018 */  mult      $v0, $v1
/* 3A2D98 E00A2408 000217C3 */  sra       $v0, $v0, 31
/* 3A2D9C E00A240C 00001810 */  mfhi      $v1
/* 3A2DA0 E00A2410 00032143 */  sra       $a0, $v1, 5
/* 3A2DA4 E00A2414 8E83005C */  lw        $v1, 0x5C($s4)
/* 3A2DA8 E00A2418 00822023 */  subu      $a0, $a0, $v0
/* 3A2DAC E00A241C 00640018 */  mult      $v1, $a0
/* 3A2DB0 E00A2420 00001812 */  mflo      $v1
/* 3A2DB4 E00A2424 8E820060 */  lw        $v0, 0x60($s4)
/* 3A2DB8 E00A2428 00000000 */  nop
/* 3A2DBC E00A242C 00440018 */  mult      $v0, $a0
/* 3A2DC0 E00A2430 00003812 */  mflo      $a3
/* 3A2DC4 E00A2434 8E820064 */  lw        $v0, 0x64($s4)
/* 3A2DC8 E00A2438 00000000 */  nop
/* 3A2DCC E00A243C 00440018 */  mult      $v0, $a0
/* 3A2DD0 E00A2440 00004812 */  mflo      $t1
/* 3A2DD4 E00A2444 8E060000 */  lw        $a2, 0x0($s0)
/* 3A2DD8 E00A2448 00031A43 */  sra       $v1, $v1, 9
/* 3A2DDC E00A244C 00640018 */  mult      $v1, $a0
/* 3A2DE0 E00A2450 00C0282D */  daddu     $a1, $a2, $zero
/* 3A2DE4 E00A2454 24C60008 */  addiu     $a2, $a2, 0x8
/* 3A2DE8 E00A2458 AE060000 */  sw        $a2, 0x0($s0)
/* 3A2DEC E00A245C 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 3A2DF0 E00A2460 00005812 */  mflo      $t3
/* 3A2DF4 E00A2464 ACA20000 */  sw        $v0, 0x0($a1)
/* 3A2DF8 E00A2468 00071243 */  sra       $v0, $a3, 9
/* 3A2DFC E00A246C 00440018 */  mult      $v0, $a0
/* 3A2E00 E00A2470 246A0020 */  addiu     $t2, $v1, 0x20
/* 3A2E04 E00A2474 24480020 */  addiu     $t0, $v0, 0x20
/* 3A2E08 E00A2478 00091243 */  sra       $v0, $t1, 9
/* 3A2E0C E00A247C 24490020 */  addiu     $t1, $v0, 0x20
/* 3A2E10 E00A2480 00003812 */  mflo      $a3
/* 3A2E14 E00A2484 000B1A03 */  sra       $v1, $t3, 8
/* 3A2E18 E00A2488 00031E00 */  sll       $v1, $v1, 24
/* 3A2E1C E00A248C 00440018 */  mult      $v0, $a0
/* 3A2E20 E00A2490 00071203 */  sra       $v0, $a3, 8
/* 3A2E24 E00A2494 304200FF */  andi      $v0, $v0, 0xFF
/* 3A2E28 E00A2498 00021400 */  sll       $v0, $v0, 16
/* 3A2E2C E00A249C 00621825 */  or        $v1, $v1, $v0
/* 3A2E30 E00A24A0 00005812 */  mflo      $t3
/* 3A2E34 E00A24A4 3162FF00 */  andi      $v0, $t3, 0xFF00
/* 3A2E38 E00A24A8 00621825 */  or        $v1, $v1, $v0
/* 3A2E3C E00A24AC 346300FF */  ori       $v1, $v1, 0xFF
/* 3A2E40 E00A24B0 29420080 */  slti      $v0, $t2, 0x80
/* 3A2E44 E00A24B4 14400002 */  bnez      $v0, .LE00A24C0
/* 3A2E48 E00A24B8 ACA30004 */   sw       $v1, 0x4($a1)
/* 3A2E4C E00A24BC 240A007F */  addiu     $t2, $zero, 0x7F
.LE00A24C0:
/* 3A2E50 E00A24C0 29020080 */  slti      $v0, $t0, 0x80
/* 3A2E54 E00A24C4 50400001 */  beql      $v0, $zero, .LE00A24CC
/* 3A2E58 E00A24C8 2408007F */   addiu    $t0, $zero, 0x7F
.LE00A24CC:
/* 3A2E5C E00A24CC 29220080 */  slti      $v0, $t1, 0x80
/* 3A2E60 E00A24D0 50400001 */  beql      $v0, $zero, .LE00A24D8
/* 3A2E64 E00A24D4 2409007F */   addiu    $t1, $zero, 0x7F
.LE00A24D8:
/* 3A2E68 E00A24D8 0000282D */  daddu     $a1, $zero, $zero
/* 3A2E6C E00A24DC 24C20008 */  addiu     $v0, $a2, 0x8
/* 3A2E70 E00A24E0 AE020000 */  sw        $v0, 0x0($s0)
/* 3A2E74 E00A24E4 3C02FB00 */  lui       $v0, (0xFB000000 >> 16)
/* 3A2E78 E00A24E8 000A1E00 */  sll       $v1, $t2, 24
/* 3A2E7C E00A24EC ACC20000 */  sw        $v0, 0x0($a2)
/* 3A2E80 E00A24F0 310200FF */  andi      $v0, $t0, 0xFF
/* 3A2E84 E00A24F4 00021400 */  sll       $v0, $v0, 16
/* 3A2E88 E00A24F8 00621825 */  or        $v1, $v1, $v0
/* 3A2E8C E00A24FC 312200FF */  andi      $v0, $t1, 0xFF
/* 3A2E90 E00A2500 00021200 */  sll       $v0, $v0, 8
/* 3A2E94 E00A2504 00621825 */  or        $v1, $v1, $v0
/* 3A2E98 E00A2508 C7A00048 */  lwc1      $f0, 0x48($sp)
/* 3A2E9C E00A250C 44952000 */  mtc1      $s5, $f4
/* 3A2EA0 E00A2510 00000000 */  nop
/* 3A2EA4 E00A2514 46802120 */  cvt.s.w   $f4, $f4
/* 3A2EA8 E00A2518 ACC30004 */  sw        $v1, 0x4($a2)
/* 3A2EAC E00A251C 46040001 */  sub.s     $f0, $f0, $f4
/* 3A2EB0 E00A2520 C7A2004C */  lwc1      $f2, 0x4C($sp)
/* 3A2EB4 E00A2524 00151840 */  sll       $v1, $s5, 1
/* 3A2EB8 E00A2528 46041081 */  sub.s     $f2, $f2, $f4
/* 3A2EBC E00A252C 4600018D */  trunc.w.s $f6, $f0
/* 3A2EC0 E00A2530 44133000 */  mfc1      $s3, $f6
/* 3A2EC4 E00A2534 00000000 */  nop
/* 3A2EC8 E00A2538 02637021 */  addu      $t6, $s3, $v1
/* 3A2ECC E00A253C 4600118D */  trunc.w.s $f6, $f2
/* 3A2ED0 E00A2540 44023000 */  mfc1      $v0, $f6
/* 3A2ED4 E00A2544 00000000 */  nop
/* 3A2ED8 E00A2548 00432021 */  addu      $a0, $v0, $v1
/* 3A2EDC E00A254C 06610002 */  bgez      $s3, .LE00A2558
/* 3A2EE0 E00A2550 0040582D */   daddu    $t3, $v0, $zero
/* 3A2EE4 E00A2554 00132823 */  negu      $a1, $s3
.LE00A2558:
/* 3A2EE8 E00A2558 05610002 */  bgez      $t3, .LE00A2564
/* 3A2EEC E00A255C 0000182D */   daddu    $v1, $zero, $zero
/* 3A2EF0 E00A2560 000B1823 */  negu      $v1, $t3
.LE00A2564:
/* 3A2EF4 E00A2564 29C20141 */  slti      $v0, $t6, 0x141
/* 3A2EF8 E00A2568 50400001 */  beql      $v0, $zero, .LE00A2570
/* 3A2EFC E00A256C 240E013F */   addiu    $t6, $zero, 0x13F
.LE00A2570:
/* 3A2F00 E00A2570 288200F1 */  slti      $v0, $a0, 0xF1
/* 3A2F04 E00A2574 50400001 */  beql      $v0, $zero, .LE00A257C
/* 3A2F08 E00A2578 240400EF */   addiu    $a0, $zero, 0xEF
.LE00A257C:
/* 3A2F0C E00A257C 16400002 */  bnez      $s2, .LE00A2588
/* 3A2F10 E00A2580 0072001A */   div      $zero, $v1, $s2
/* 3A2F14 E00A2584 0007000D */  break     7
.LE00A2588:
/* 3A2F18 E00A2588 2401FFFF */  addiu     $at, $zero, -0x1
/* 3A2F1C E00A258C 16410004 */  bne       $s2, $at, .LE00A25A0
/* 3A2F20 E00A2590 3C018000 */   lui      $at, (0x80000000 >> 16)
/* 3A2F24 E00A2594 14610002 */  bne       $v1, $at, .LE00A25A0
/* 3A2F28 E00A2598 00000000 */   nop
/* 3A2F2C E00A259C 0006000D */  break     6
.LE00A25A0:
/* 3A2F30 E00A25A0 00005012 */  mflo      $t2
/* 3A2F34 E00A25A4 008B1023 */  subu      $v0, $a0, $t3
/* 3A2F38 E00A25A8 16400002 */  bnez      $s2, .LE00A25B4
/* 3A2F3C E00A25AC 0052001A */   div      $zero, $v0, $s2
/* 3A2F40 E00A25B0 0007000D */  break     7
.LE00A25B4:
/* 3A2F44 E00A25B4 2401FFFF */  addiu     $at, $zero, -0x1
/* 3A2F48 E00A25B8 16410004 */  bne       $s2, $at, .LE00A25CC
/* 3A2F4C E00A25BC 3C018000 */   lui      $at, (0x80000000 >> 16)
/* 3A2F50 E00A25C0 14410002 */  bne       $v0, $at, .LE00A25CC
/* 3A2F54 E00A25C4 00000000 */   nop
/* 3A2F58 E00A25C8 0006000D */  break     6
.LE00A25CC:
/* 3A2F5C E00A25CC 0000B012 */  mflo      $s6
/* 3A2F60 E00A25D0 0156102A */  slt       $v0, $t2, $s6
/* 3A2F64 E00A25D4 104000D5 */  beqz      $v0, .LE00A292C
/* 3A2F68 E00A25D8 AFB60054 */   sw       $s6, 0x54($sp)
/* 3A2F6C E00A25DC 01520018 */  mult      $t2, $s2
/* 3A2F70 E00A25E0 0265A821 */  addu      $s5, $s3, $a1
/* 3A2F74 E00A25E4 01D51023 */  subu      $v0, $t6, $s5
/* 3A2F78 E00A25E8 00021040 */  sll       $v0, $v0, 1
/* 3A2F7C E00A25EC AFA2005C */  sw        $v0, 0x5C($sp)
/* 3A2F80 E00A25F0 0000B012 */  mflo      $s6
/* 3A2F84 E00A25F4 02CB4821 */  addu      $t1, $s6, $t3
.LE00A25F8:
/* 3A2F88 E00A25F8 01321021 */  addu      $v0, $t1, $s2
/* 3A2F8C E00A25FC 284200F0 */  slti      $v0, $v0, 0xF0
/* 3A2F90 E00A2600 104000CA */  beqz      $v0, .LE00A292C
/* 3A2F94 E00A2604 0120582D */   daddu    $t3, $t1, $zero
/* 3A2F98 E00A2608 00093080 */  sll       $a2, $t1, 2
/* 3A2F9C E00A260C 00C91021 */  addu      $v0, $a2, $t1
/* 3A2FA0 E00A2610 000211C0 */  sll       $v0, $v0, 7
/* 3A2FA4 E00A2614 8FB6005C */  lw        $s6, 0x5C($sp)
/* 3A2FA8 E00A2618 44932000 */  mtc1      $s3, $f4
/* 3A2FAC E00A261C 00000000 */  nop
/* 3A2FB0 E00A2620 46802120 */  cvt.s.w   $f4, $f4
/* 3A2FB4 E00A2624 AFA20058 */  sw        $v0, 0x58($sp)
/* 3A2FB8 E00A2628 26C20007 */  addiu     $v0, $s6, 0x7
/* 3A2FBC E00A262C 000210C3 */  sra       $v0, $v0, 3
/* 3A2FC0 E00A2630 304201FF */  andi      $v0, $v0, 0x1FF
/* 3A2FC4 E00A2634 8FB60060 */  lw        $s6, 0x60($sp)
/* 3A2FC8 E00A2638 00021240 */  sll       $v0, $v0, 9
/* 3A2FCC E00A263C 00567825 */  or        $t7, $v0, $s6
/* 3A2FD0 E00A2640 00151080 */  sll       $v0, $s5, 2
/* 3A2FD4 E00A2644 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3A2FD8 E00A2648 00026B00 */  sll       $t5, $v0, 12
/* 3A2FDC E00A264C 3C16F400 */  lui       $s6, (0xF4000000 >> 16)
/* 3A2FE0 E00A2650 01B6B025 */  or        $s6, $t5, $s6
/* 3A2FE4 E00A2654 25C2FFFF */  addiu     $v0, $t6, -0x1
/* 3A2FE8 E00A2658 00021080 */  sll       $v0, $v0, 2
/* 3A2FEC E00A265C 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3A2FF0 E00A2660 0002CB00 */  sll       $t9, $v0, 12
/* 3A2FF4 E00A2664 2642FFFF */  addiu     $v0, $s2, -0x1
/* 3A2FF8 E00A2668 00021080 */  sll       $v0, $v0, 2
/* 3A2FFC E00A266C 30580FFF */  andi      $t8, $v0, 0xFFF
/* 3A3000 E00A2670 3C020700 */  lui       $v0, (0x7000000 >> 16)
/* 3A3004 E00A2674 03021025 */  or        $v0, $t8, $v0
/* 3A3008 E00A2678 AFB60064 */  sw        $s6, 0x64($sp)
/* 3A300C E00A267C C6200008 */  lwc1      $f0, 0x8($s1)
/* 3A3010 E00A2680 03221025 */  or        $v0, $t9, $v0
/* 3A3014 E00A2684 46002002 */  mul.s     $f0, $f4, $f0
/* 3A3018 E00A2688 00000000 */  nop
/* 3A301C E00A268C AFA20068 */  sw        $v0, 0x68($sp)
/* 3A3020 E00A2690 8E220014 */  lw        $v0, 0x14($s1)
/* 3A3024 E00A2694 8E050000 */  lw        $a1, 0x0($s0)
/* 3A3028 E00A2698 8E230004 */  lw        $v1, 0x4($s1)
/* 3A302C E00A269C 01420018 */  mult      $t2, $v0
/* 3A3030 E00A26A0 00A0382D */  daddu     $a3, $a1, $zero
/* 3A3034 E00A26A4 00031080 */  sll       $v0, $v1, 2
/* 3A3038 E00A26A8 00431021 */  addu      $v0, $v0, $v1
/* 3A303C E00A26AC 4600018D */  trunc.w.s $f6, $f0
/* 3A3040 E00A26B0 44043000 */  mfc1      $a0, $f6
/* 3A3044 E00A26B4 0000B012 */  mflo      $s6
/* 3A3048 E00A26B8 C620000C */  lwc1      $f0, 0xC($s1)
/* 3A304C E00A26BC 44961000 */  mtc1      $s6, $f2
/* 3A3050 E00A26C0 00000000 */  nop
/* 3A3054 E00A26C4 468010A0 */  cvt.s.w   $f2, $f2
/* 3A3058 E00A26C8 46001082 */  mul.s     $f2, $f2, $f0
/* 3A305C E00A26CC 00000000 */  nop
/* 3A3060 E00A26D0 00021080 */  sll       $v0, $v0, 2
/* 3A3064 E00A26D4 24A50008 */  addiu     $a1, $a1, 0x8
/* 3A3068 E00A26D8 00042080 */  sll       $a0, $a0, 2
/* 3A306C E00A26DC 44820000 */  mtc1      $v0, $f0
/* 3A3070 E00A26E0 00000000 */  nop
/* 3A3074 E00A26E4 46800020 */  cvt.s.w   $f0, $f0
/* 3A3078 E00A26E8 46020001 */  sub.s     $f0, $f0, $f2
/* 3A307C E00A26EC 30840FFF */  andi      $a0, $a0, 0xFFF
/* 3A3080 E00A26F0 00042300 */  sll       $a0, $a0, 12
/* 3A3084 E00A26F4 4600018D */  trunc.w.s $f6, $f0
/* 3A3088 E00A26F8 44023000 */  mfc1      $v0, $f6
/* 3A308C E00A26FC 00000000 */  nop
/* 3A3090 E00A2700 00021080 */  sll       $v0, $v0, 2
/* 3A3094 E00A2704 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3A3098 E00A2708 3C16F200 */  lui       $s6, (0xF2000000 >> 16)
/* 3A309C E00A270C 00561025 */  or        $v0, $v0, $s6
/* 3A30A0 E00A2710 00822025 */  or        $a0, $a0, $v0
/* 3A30A4 E00A2714 32A201FF */  andi      $v0, $s5, 0x1FF
/* 3A30A8 E00A2718 ACE40000 */  sw        $a0, 0x0($a3)
/* 3A30AC E00A271C C6200008 */  lwc1      $f0, 0x8($s1)
/* 3A30B0 E00A2720 00021540 */  sll       $v0, $v0, 21
/* 3A30B4 E00A2724 AFA20070 */  sw        $v0, 0x70($sp)
/* 3A30B8 E00A2728 46002102 */  mul.s     $f4, $f4, $f0
/* 3A30BC E00A272C 00000000 */  nop
/* 3A30C0 E00A2730 C6200000 */  lwc1      $f0, 0x0($s1)
/* 3A30C4 E00A2734 46800020 */  cvt.s.w   $f0, $f0
/* 3A30C8 E00A2738 AE050000 */  sw        $a1, 0x0($s0)
/* 3A30CC E00A273C 8E220014 */  lw        $v0, 0x14($s1)
/* 3A30D0 E00A2740 01420018 */  mult      $t2, $v0
/* 3A30D4 E00A2744 0000602D */  daddu     $t4, $zero, $zero
/* 3A30D8 E00A2748 30C60FFF */  andi      $a2, $a2, 0xFFF
/* 3A30DC E00A274C 01A6F025 */  or        $fp, $t5, $a2
/* 3A30E0 E00A2750 8E240004 */  lw        $a0, 0x4($s1)
/* 3A30E4 E00A2754 46002100 */  add.s     $f4, $f4, $f0
/* 3A30E8 E00A2758 00041080 */  sll       $v0, $a0, 2
/* 3A30EC E00A275C 00441021 */  addu      $v0, $v0, $a0
/* 3A30F0 E00A2760 4600218D */  trunc.w.s $f6, $f4
/* 3A30F4 E00A2764 44033000 */  mfc1      $v1, $f6
/* 3A30F8 E00A2768 0000B012 */  mflo      $s6
/* 3A30FC E00A276C C620000C */  lwc1      $f0, 0xC($s1)
/* 3A3100 E00A2770 44961000 */  mtc1      $s6, $f2
/* 3A3104 E00A2774 00000000 */  nop
/* 3A3108 E00A2778 468010A0 */  cvt.s.w   $f2, $f2
/* 3A310C E00A277C 46001082 */  mul.s     $f2, $f2, $f0
/* 3A3110 E00A2780 00000000 */  nop
/* 3A3114 E00A2784 00021080 */  sll       $v0, $v0, 2
/* 3A3118 E00A2788 00441021 */  addu      $v0, $v0, $a0
/* 3A311C E00A278C 00031880 */  sll       $v1, $v1, 2
/* 3A3120 E00A2790 44820000 */  mtc1      $v0, $f0
/* 3A3124 E00A2794 00000000 */  nop
/* 3A3128 E00A2798 46800020 */  cvt.s.w   $f0, $f0
/* 3A312C E00A279C 46020001 */  sub.s     $f0, $f0, $f2
/* 3A3130 E00A27A0 30630FFF */  andi      $v1, $v1, 0xFFF
/* 3A3134 E00A27A4 00031B00 */  sll       $v1, $v1, 12
/* 3A3138 E00A27A8 4600018D */  trunc.w.s $f6, $f0
/* 3A313C E00A27AC 44023000 */  mfc1      $v0, $f6
/* 3A3140 E00A27B0 00000000 */  nop
/* 3A3144 E00A27B4 00021080 */  sll       $v0, $v0, 2
/* 3A3148 E00A27B8 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3A314C E00A27BC 00621825 */  or        $v1, $v1, $v0
/* 3A3150 E00A27C0 ACE30004 */  sw        $v1, 0x4($a3)
.LE00A27C4:
/* 3A3154 E00A27C4 3C02FD10 */  lui       $v0, (0xFD10013F >> 16)
/* 3A3158 E00A27C8 3442013F */  ori       $v0, $v0, (0xFD10013F & 0xFFFF)
/* 3A315C E00A27CC 3C060702 */  lui       $a2, (0x7020090 >> 16)
/* 3A3160 E00A27D0 34C60090 */  ori       $a2, $a2, (0x7020090 & 0xFFFF)
/* 3A3164 E00A27D4 3C070102 */  lui       $a3, (0x1020090 >> 16)
/* 3A3168 E00A27D8 34E70090 */  ori       $a3, $a3, (0x1020090 & 0xFFFF)
/* 3A316C E00A27DC 3C080400 */  lui       $t0, (0x4000400 >> 16)
/* 3A3170 E00A27E0 35080400 */  ori       $t0, $t0, (0x4000400 & 0xFFFF)
/* 3A3174 E00A27E4 258C0001 */  addiu     $t4, $t4, 0x1
/* 3A3178 E00A27E8 8E050000 */  lw        $a1, 0x0($s0)
/* 3A317C E00A27EC 3C03800A */  lui       $v1, %hi(nuGfxCfb_ptr)
/* 3A3180 E00A27F0 8C63A64C */  lw        $v1, %lo(nuGfxCfb_ptr)($v1)
/* 3A3184 E00A27F4 00A0202D */  daddu     $a0, $a1, $zero
/* 3A3188 E00A27F8 24A50008 */  addiu     $a1, $a1, 0x8
/* 3A318C E00A27FC AE050000 */  sw        $a1, 0x0($s0)
/* 3A3190 E00A2800 AC820000 */  sw        $v0, 0x0($a0)
/* 3A3194 E00A2804 8FB60058 */  lw        $s6, 0x58($sp)
/* 3A3198 E00A2808 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 3A319C E00A280C 00761821 */  addu      $v1, $v1, $s6
/* 3A31A0 E00A2810 00621821 */  addu      $v1, $v1, $v0
/* 3A31A4 E00A2814 24A20008 */  addiu     $v0, $a1, 0x8
/* 3A31A8 E00A2818 AC830004 */  sw        $v1, 0x4($a0)
/* 3A31AC E00A281C AE020000 */  sw        $v0, 0x0($s0)
/* 3A31B0 E00A2820 24A20010 */  addiu     $v0, $a1, 0x10
/* 3A31B4 E00A2824 ACAF0000 */  sw        $t7, 0x0($a1)
/* 3A31B8 E00A2828 ACA60004 */  sw        $a2, 0x4($a1)
/* 3A31BC E00A282C AE020000 */  sw        $v0, 0x0($s0)
/* 3A31C0 E00A2830 3C02E600 */  lui       $v0, (0xE6000000 >> 16)
/* 3A31C4 E00A2834 ACA20008 */  sw        $v0, 0x8($a1)
/* 3A31C8 E00A2838 24A20018 */  addiu     $v0, $a1, 0x18
/* 3A31CC E00A283C ACA0000C */  sw        $zero, 0xC($a1)
/* 3A31D0 E00A2840 AE020000 */  sw        $v0, 0x0($s0)
/* 3A31D4 E00A2844 24A20020 */  addiu     $v0, $a1, 0x20
/* 3A31D8 E00A2848 000E2080 */  sll       $a0, $t6, 2
/* 3A31DC E00A284C 30840FFF */  andi      $a0, $a0, 0xFFF
/* 3A31E0 E00A2850 8FB60064 */  lw        $s6, 0x64($sp)
/* 3A31E4 E00A2854 00042300 */  sll       $a0, $a0, 12
/* 3A31E8 E00A2858 ACB60010 */  sw        $s6, 0x10($a1)
/* 3A31EC E00A285C 8FB60068 */  lw        $s6, 0x68($sp)
/* 3A31F0 E00A2860 3C03E400 */  lui       $v1, (0xE4000000 >> 16)
/* 3A31F4 E00A2864 ACB60014 */  sw        $s6, 0x14($a1)
/* 3A31F8 E00A2868 3C16E700 */  lui       $s6, (0xE7000000 >> 16)
/* 3A31FC E00A286C AE020000 */  sw        $v0, 0x0($s0)
/* 3A3200 E00A2870 24A20028 */  addiu     $v0, $a1, 0x28
/* 3A3204 E00A2874 ACB60018 */  sw        $s6, 0x18($a1)
/* 3A3208 E00A2878 ACA0001C */  sw        $zero, 0x1C($a1)
/* 3A320C E00A287C AE020000 */  sw        $v0, 0x0($s0)
/* 3A3210 E00A2880 24A20030 */  addiu     $v0, $a1, 0x30
/* 3A3214 E00A2884 3C16F200 */  lui       $s6, (0xF2000000 >> 16)
/* 3A3218 E00A2888 ACAF0020 */  sw        $t7, 0x20($a1)
/* 3A321C E00A288C ACA70024 */  sw        $a3, 0x24($a1)
/* 3A3220 E00A2890 AE020000 */  sw        $v0, 0x0($s0)
/* 3A3224 E00A2894 01B61025 */  or        $v0, $t5, $s6
/* 3A3228 E00A2898 ACA20028 */  sw        $v0, 0x28($a1)
/* 3A322C E00A289C 3C020100 */  lui       $v0, (0x1000000 >> 16)
/* 3A3230 E00A28A0 03021025 */  or        $v0, $t8, $v0
/* 3A3234 E00A28A4 03221025 */  or        $v0, $t9, $v0
/* 3A3238 E00A28A8 ACA2002C */  sw        $v0, 0x2C($a1)
/* 3A323C E00A28AC 24A20038 */  addiu     $v0, $a1, 0x38
/* 3A3240 E00A28B0 AE020000 */  sw        $v0, 0x0($s0)
/* 3A3244 E00A28B4 01721021 */  addu      $v0, $t3, $s2
/* 3A3248 E00A28B8 00021080 */  sll       $v0, $v0, 2
/* 3A324C E00A28BC 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3A3250 E00A28C0 00431025 */  or        $v0, $v0, $v1
/* 3A3254 E00A28C4 00822025 */  or        $a0, $a0, $v0
/* 3A3258 E00A28C8 24A20040 */  addiu     $v0, $a1, 0x40
/* 3A325C E00A28CC ACA40030 */  sw        $a0, 0x30($a1)
/* 3A3260 E00A28D0 ACBE0034 */  sw        $fp, 0x34($a1)
/* 3A3264 E00A28D4 AE020000 */  sw        $v0, 0x0($s0)
/* 3A3268 E00A28D8 3C02E100 */  lui       $v0, (0xE1000000 >> 16)
/* 3A326C E00A28DC ACA20038 */  sw        $v0, 0x38($a1)
/* 3A3270 E00A28E0 8FB60070 */  lw        $s6, 0x70($sp)
/* 3A3274 E00A28E4 24A20048 */  addiu     $v0, $a1, 0x48
/* 3A3278 E00A28E8 ACB6003C */  sw        $s6, 0x3C($a1)
/* 3A327C E00A28EC AE020000 */  sw        $v0, 0x0($s0)
/* 3A3280 E00A28F0 3C02F100 */  lui       $v0, (0xF1000000 >> 16)
/* 3A3284 E00A28F4 ACA20040 */  sw        $v0, 0x40($a1)
/* 3A3288 E00A28F8 24A20050 */  addiu     $v0, $a1, 0x50
/* 3A328C E00A28FC ACA80044 */  sw        $t0, 0x44($a1)
/* 3A3290 E00A2900 AE020000 */  sw        $v0, 0x0($s0)
/* 3A3294 E00A2904 3C16E700 */  lui       $s6, (0xE7000000 >> 16)
/* 3A3298 E00A2908 29820002 */  slti      $v0, $t4, 0x2
/* 3A329C E00A290C ACB60048 */  sw        $s6, 0x48($a1)
/* 3A32A0 E00A2910 1440FFAC */  bnez      $v0, .LE00A27C4
/* 3A32A4 E00A2914 ACA0004C */   sw       $zero, 0x4C($a1)
/* 3A32A8 E00A2918 8FB60054 */  lw        $s6, 0x54($sp)
/* 3A32AC E00A291C 254A0001 */  addiu     $t2, $t2, 0x1
/* 3A32B0 E00A2920 0156102A */  slt       $v0, $t2, $s6
/* 3A32B4 E00A2924 1440FF34 */  bnez      $v0, .LE00A25F8
/* 3A32B8 E00A2928 01324821 */   addu     $t1, $t1, $s2
.LE00A292C:
/* 3A32BC E00A292C 26F70004 */  addiu     $s7, $s7, 0x4
.LE00A2930:
/* 3A32C0 E00A2930 26820010 */  addiu     $v0, $s4, 0x10
/* 3A32C4 E00A2934 8FB6006C */  lw        $s6, 0x6C($sp)
/* 3A32C8 E00A2938 02E2102A */  slt       $v0, $s7, $v0
/* 3A32CC E00A293C 26D60004 */  addiu     $s6, $s6, 0x4
/* 3A32D0 E00A2940 1440FE75 */  bnez      $v0, .LE00A2318
/* 3A32D4 E00A2944 AFB6006C */   sw       $s6, 0x6C($sp)
/* 3A32D8 E00A2948 0000182D */  daddu     $v1, $zero, $zero
/* 3A32DC E00A294C 27A80018 */  addiu     $t0, $sp, 0x18
/* 3A32E0 E00A2950 27A70028 */  addiu     $a3, $sp, 0x28
/* 3A32E4 E00A2954 27A60038 */  addiu     $a2, $sp, 0x38
.LE00A2958:
/* 3A32E8 E00A2958 24650001 */  addiu     $a1, $v1, 0x1
/* 3A32EC E00A295C 00052080 */  sll       $a0, $a1, 2
/* 3A32F0 E00A2960 02842021 */  addu      $a0, $s4, $a0
/* 3A32F4 E00A2964 00031880 */  sll       $v1, $v1, 2
/* 3A32F8 E00A2968 01031021 */  addu      $v0, $t0, $v1
/* 3A32FC E00A296C C4400000 */  lwc1      $f0, 0x0($v0)
/* 3A3300 E00A2970 46800020 */  cvt.s.w   $f0, $f0
/* 3A3304 E00A2974 00E31021 */  addu      $v0, $a3, $v1
/* 3A3308 E00A2978 E480003C */  swc1      $f0, 0x3C($a0)
/* 3A330C E00A297C C4400000 */  lwc1      $f0, 0x0($v0)
/* 3A3310 E00A2980 00C31821 */  addu      $v1, $a2, $v1
/* 3A3314 E00A2984 E480001C */  swc1      $f0, 0x1C($a0)
/* 3A3318 E00A2988 C4600000 */  lwc1      $f0, 0x0($v1)
/* 3A331C E00A298C 00A0182D */  daddu     $v1, $a1, $zero
/* 3A3320 E00A2990 28620003 */  slti      $v0, $v1, 0x3
/* 3A3324 E00A2994 1440FFF0 */  bnez      $v0, .LE00A2958
/* 3A3328 E00A2998 E480002C */   swc1     $f0, 0x2C($a0)
/* 3A332C E00A299C 8FBF009C */  lw        $ra, 0x9C($sp)
/* 3A3330 E00A29A0 8FBE0098 */  lw        $fp, 0x98($sp)
/* 3A3334 E00A29A4 8FB70094 */  lw        $s7, 0x94($sp)
/* 3A3338 E00A29A8 8FB60090 */  lw        $s6, 0x90($sp)
/* 3A333C E00A29AC 8FB5008C */  lw        $s5, 0x8C($sp)
/* 3A3340 E00A29B0 8FB40088 */  lw        $s4, 0x88($sp)
/* 3A3344 E00A29B4 8FB30084 */  lw        $s3, 0x84($sp)
/* 3A3348 E00A29B8 8FB20080 */  lw        $s2, 0x80($sp)
/* 3A334C E00A29BC 8FB1007C */  lw        $s1, 0x7C($sp)
/* 3A3350 E00A29C0 8FB00078 */  lw        $s0, 0x78($sp)
/* 3A3354 E00A29C4 03E00008 */  jr        $ra
/* 3A3358 E00A29C8 27BD00A0 */   addiu    $sp, $sp, 0xA0
/* 3A335C E00A29CC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void motion_blur_flame_appendGfx(void* effect) {
    MotionBlurFlameFXData* data = ((EffectInstance*)effect)->data.motionBlurFlame;
    s32 temp_a2 = data->unk_00;
    f32 sp48;
    f32 sp4C;
    s32 sp50 = data->unk_4C;
    UnkStruct* temp_s1 = &D_E00A29DC[temp_a2];
    s32 sp54; // declaration must come after sp50
    s32 envR, envG, envB;
    s32 sp18[4];
    f32 sp28[4];
    f32 sp38[4];
    s32 i;

    s32 t3;
    s32 v0;
    s32 temp_a0;
    s32 s3;
    s32 temp_v0_2;
    s32 temp_v0_3;
    s32 temp_v1;
    s32 var_a0;
    s32 var_a1;
    s32 var_a2;
    s32 uly;
    s32 var_t2_2;
    s32 var_t4;
    s32 t6;
    s32 var_v1;

    gDPPipeSync(gMainGfxPos++);
    gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
    gSPDisplayList(gMainGfxPos++, D_E00A29D0[temp_a2]);

    for (i = 0; i < 4; i++) {
        f32 temp_f12 = data->unk_1C[i];
        f32 temp_f14 = data->unk_2C[i];
        f32 temp_f0 = data->unk_3C[i];
        s32 temp_s5 = temp_s1->unk_10;
        s32 height = temp_s1->unk_14;

        if (i == 0) {
            var_a2 = shim_is_point_visible(temp_f12, temp_f14, temp_f0, -1, &sp48, &sp4C);
        } else {
            var_a2 = temp_f0;
            sp48 = temp_f12;
            sp4C = temp_f14;
        }

        sp18[i] = var_a2;
        sp28[i] = sp48;
        sp38[i] = sp4C;

        if ((var_a2 != 0) && !(sp48 < 0.0f) && !(sp4C < 0.0f) && !(sp48 >= 320.0f) && !(sp4C >= 240.0f)) {
            temp_a0 = (sp50 * D_E00A2A24[i]) / 100;
            temp_v1 = (data->unk_5C * temp_a0) >> 9;
            temp_v0_2 = (data->unk_60 * temp_a0) >> 9;
            temp_v0_3 = (data->unk_64 * temp_a0) >> 9;

            gDPSetPrimColor(gMainGfxPos++, 0, 0,
                (temp_v1 * temp_a0) >> 8,
                (temp_v0_2 * temp_a0) >> 8,
                (temp_v0_3 * temp_a0) >> 8,
                255
            );

            envR = temp_v1 + 32;
            envG = temp_v0_2 + 32;
            envB = temp_v0_3 + 32;
            if (envR > 127) {
                envR = 127;
            }
            if (envG > 127) {
                envG = 127;
            }
            if (envB > 127) {
                envB = 127;
            }

            gDPSetEnvColor(gMainGfxPos++, envR, envG, envB, 0);

            s3 = sp48 - temp_s5;
            t6 = s3 + temp_s5 * 2;
            v0 = sp4C - temp_s5;
            var_a0 = v0 + 2 * temp_s5;
            t3 = uly = sp4C - temp_s5;

            if (s3 < 0) {
                var_a1 = -s3;
            } else {
                var_a1 = 0;
            }

            if (t3 < 0) {
                var_v1 = -uly;
            } else {
                var_v1 = 0;
            }

            if (t6 > SCREEN_WIDTH) {
                t6 = SCREEN_WIDTH - 1;
            }
            if (var_a0 > SCREEN_HEIGHT) {
                var_a0 = SCREEN_HEIGHT - 1;
            }

            var_t2_2 = var_v1 / height;
            sp54 = (var_a0 - t3) / height;

            while (var_t2_2 < sp54) {
                uly = t3 + var_t2_2 * height;
                if (uly + height >= SCREEN_HEIGHT) {
                    break;
                }

                gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE,
                    (s32) (s3 * temp_s1->unk_08) * 4,
                    (s32) (temp_s1->unk_04 * 20 - var_t2_2 * temp_s1->unk_14 * temp_s1->unk_0C) * 4,
                    (s32) (s3 * temp_s1->unk_08 + temp_s1->unk_00) * 4,
                    (s32) (temp_s1->unk_04 * 21 - var_t2_2 * temp_s1->unk_14 * temp_s1->unk_0C) * 4);

                for (var_t4 = 0; var_t4 < 2; var_t4++) {
                    gDPLoadMultiTile(gMainGfxPos++, VIRTUAL_TO_PHYSICAL(nuGfxCfb_ptr + uly * SCREEN_WIDTH),
                        0x0100, 1, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, SCREEN_HEIGHT,
                        s3 + var_a1,
                        0,
                        t6 - 1,
                        height - 1,
                        0,
                        G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 9, 8, G_TX_NOLOD, G_TX_NOLOD
                    );
                    gSPTextureRectangle(gMainGfxPos++,
                        (s3 + var_a1) * 4,
                        uly * 4,
                        t6 * 4,
                        (uly + height) * 4,
                        G_TX_RENDERTILE,
                        ((u32) (s3 + var_a1) % 0x200) * 32,
                        0,
                        0x0400,
                        0x0400
                    );
                    gDPPipeSync(gMainGfxPos++);
                }
                var_t2_2++;
            }
        }
    }

    for (i = 0; i < ARRAY_COUNT(data->unk_3C) - 1; i++) {
        data->unk_3C[i + 1] = sp18[i];
        data->unk_1C[i + 1] = sp28[i];
        data->unk_2C[i + 1] = sp38[i];
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_80247570
/* 175E50 80247570 3C03800E */  lui       $v1, %hi(gBattleSubState)
/* 175E54 80247574 8C63C4DC */  lw        $v1, %lo(gBattleSubState)($v1)
/* 175E58 80247578 27BDFFD0 */  addiu     $sp, $sp, -0x30
/* 175E5C 8024757C AFB60028 */  sw        $s6, 0x28($sp)
/* 175E60 80247580 3C16800E */  lui       $s6, %hi(gBattleStatus)
D_80247584:
/* 175E64 80247584 26D6C070 */  addiu     $s6, $s6, %lo(gBattleStatus)
D_80247588:
/* 175E68 80247588 AFBF002C */  sw        $ra, 0x2C($sp)
/* 175E6C 8024758C AFB50024 */  sw        $s5, 0x24($sp)
/* 175E70 80247590 AFB40020 */  sw        $s4, 0x20($sp)
/* 175E74 80247594 AFB3001C */  sw        $s3, 0x1C($sp)
/* 175E78 80247598 AFB20018 */  sw        $s2, 0x18($sp)
/* 175E7C 8024759C AFB10014 */  sw        $s1, 0x14($sp)
/* 175E80 802475A0 AFB00010 */  sw        $s0, 0x10($sp)
D_802475A4:
/* 175E84 802475A4 8ED500D8 */  lw        $s5, 0xD8($s6)
/* 175E88 802475A8 8ED400DC */  lw        $s4, 0xDC($s6)
/* 175E8C 802475AC 2C62000D */  sltiu     $v0, $v1, 0xD
D_802475B0:
/* 175E90 802475B0 10400106 */  beqz      $v0, .L802479CC
/* 175E94 802475B4 00031080 */   sll      $v0, $v1, 2
.L802475B8:
/* 175E98 802475B8 3C01802A */  lui       $at, %hi(jtbl_8029CB88)
/* 175E9C 802475BC 00220821 */  addu      $at, $at, $v0
.L802475C0:
/* 175EA0 802475C0 8C22CB88 */  lw        $v0, %lo(jtbl_8029CB88)($at)
/* 175EA4 802475C4 00400008 */  jr        $v0
/* 175EA8 802475C8 00000000 */   nop
glabel .L802475CC
/* 175EAC 802475CC 3C04FFDF */  lui       $a0, (0xFFDFFFFF >> 16)
D_802475D0:
/* 175EB0 802475D0 3484FFFF */  ori       $a0, $a0, (0xFFDFFFFF & 0xFFFF)
/* 175EB4 802475D4 3C05F7FF */  lui       $a1, (0xF7FFFFFF >> 16)
.L802475D8:
/* 175EB8 802475D8 3C10800E */  lui       $s0, %hi(gBattleStatus)
D_802475DC:
/* 175EBC 802475DC 2610C070 */  addiu     $s0, $s0, %lo(gBattleStatus)
D_802475E0:
/* 175EC0 802475E0 8E020000 */  lw        $v0, 0x0($s0)
D_802475E4:
/* 175EC4 802475E4 2403FFFD */  addiu     $v1, $zero, -0x3
D_802475E8:
/* 175EC8 802475E8 00431024 */  and       $v0, $v0, $v1
/* 175ECC 802475EC 00441024 */  and       $v0, $v0, $a0
/* 175ED0 802475F0 AE020000 */  sw        $v0, 0x0($s0)
/* 175ED4 802475F4 8EA20000 */  lw        $v0, 0x0($s5)
/* 175ED8 802475F8 34A5FFFF */  ori       $a1, $a1, (0xF7FFFFFF & 0xFFFF)
/* 175EDC 802475FC 00451024 */  and       $v0, $v0, $a1
/* 175EE0 80247600 12800004 */  beqz      $s4, .L80247614
/* 175EE4 80247604 AEA20000 */   sw       $v0, 0x0($s5)
/* 175EE8 80247608 8E820000 */  lw        $v0, 0x0($s4)
/* 175EEC 8024760C 00451024 */  and       $v0, $v0, $a1
D_80247610:
/* 175EF0 80247610 AE820000 */  sw        $v0, 0x0($s4)
.L80247614:
/* 175EF4 80247614 2402007F */  addiu     $v0, $zero, 0x7F
D_80247618:
/* 175EF8 80247618 A2C0008C */  sb        $zero, 0x8C($s6)
/* 175EFC 8024761C A6C00180 */  sh        $zero, 0x180($s6)
jtbl_80247620:
/* 175F00 80247620 A2C00081 */  sb        $zero, 0x81($s6)
/* 175F04 80247624 A2C20086 */  sb        $v0, 0x86($s6)
D_80247628:
/* 175F08 80247628 A2C20087 */  sb        $v0, 0x87($s6)
/* 175F0C 8024762C 0C098F18 */  jal       reset_actor_turn_info
/* 175F10 80247630 A2C0019A */   sb       $zero, 0x19A($s6)
/* 175F14 80247634 8E020000 */  lw        $v0, 0x0($s0)
/* 175F18 80247638 34420100 */  ori       $v0, $v0, 0x100
/* 175F1C 8024763C AE020000 */  sw        $v0, 0x0($s0)
/* 175F20 80247640 12800002 */  beqz      $s4, .L8024764C
/* 175F24 80247644 A2A0021C */   sb       $zero, 0x21C($s5)
D_80247648:
/* 175F28 80247648 A280021C */  sb        $zero, 0x21C($s4)
.L8024764C:
/* 175F2C 8024764C 0000882D */  daddu     $s1, $zero, $zero
/* 175F30 80247650 3C04FFF7 */  lui       $a0, (0xFFF7FFFF >> 16)
/* 175F34 80247654 3484FFFF */  ori       $a0, $a0, (0xFFF7FFFF & 0xFFFF)
/* 175F38 80247658 8E020004 */  lw        $v0, 0x4($s0)
/* 175F3C 8024765C 02C0182D */  daddu     $v1, $s6, $zero
/* 175F40 80247660 34424000 */  ori       $v0, $v0, 0x4000
glabel D_80247664
/* 175F44 80247664 AE020004 */  sw        $v0, 0x4($s0)
.L80247668:
/* 175F48 80247668 8C7000E0 */  lw        $s0, 0xE0($v1)
/* 175F4C 8024766C 12000004 */  beqz      $s0, D_80247680
jtbl_80247670:
/* 175F50 80247670 26310001 */   addiu    $s1, $s1, 0x1
/* 175F54 80247674 8E020000 */  lw        $v0, 0x0($s0)
D_80247678:
/* 175F58 80247678 00441024 */  and       $v0, $v0, $a0
/* 175F5C 8024767C AE020000 */  sw        $v0, 0x0($s0)
D_80247680:
/* 175F60 80247680 2A220018 */  slti      $v0, $s1, 0x18
/* 175F64 80247684 1440FFF8 */  bnez      $v0, .L80247668
D_80247688:
/* 175F68 80247688 24630004 */   addiu    $v1, $v1, 0x4
D_8024768C:
/* 175F6C 8024768C 0000882D */  daddu     $s1, $zero, $zero
D_80247690:
/* 175F70 80247690 3C060040 */  lui       $a2, (0x400000 >> 16)
/* 175F74 80247694 3C05F7FF */  lui       $a1, (0xF7FFFFFF >> 16)
D_80247698:
/* 175F78 80247698 34A5FFFF */  ori       $a1, $a1, (0xF7FFFFFF & 0xFFFF)
D_8024769C:
/* 175F7C 8024769C 02C0202D */  daddu     $a0, $s6, $zero
D_802476A0:
/* 175F80 802476A0 8C9000E0 */  lw        $s0, 0xE0($a0)
.L802476A4:
/* 175F84 802476A4 12000007 */  beqz      $s0, .L802476C4
/* 175F88 802476A8 26310001 */   addiu    $s1, $s1, 0x1
/* 175F8C 802476AC 8E030000 */  lw        $v1, 0x0($s0)
/* 175F90 802476B0 00661024 */  and       $v0, $v1, $a2
/* 175F94 802476B4 14400003 */  bnez      $v0, .L802476C4
/* 175F98 802476B8 00000000 */   nop
/* 175F9C 802476BC 00651024 */  and       $v0, $v1, $a1
/* 175FA0 802476C0 AE020000 */  sw        $v0, 0x0($s0)
.L802476C4:
/* 175FA4 802476C4 2A220018 */  slti      $v0, $s1, 0x18
/* 175FA8 802476C8 1440FFF5 */  bnez      $v0, D_802476A0
.L802476CC:
/* 175FAC 802476CC 24840004 */   addiu    $a0, $a0, 0x4
.L802476D0:
/* 175FB0 802476D0 8ED00174 */  lw        $s0, 0x174($s6)
/* 175FB4 802476D4 8E020000 */  lw        $v0, 0x0($s0)
D_802476D8:
/* 175FB8 802476D8 3C030020 */  lui       $v1, (0x200000 >> 16)
D_802476DC:
/* 175FBC 802476DC 00431024 */  and       $v0, $v0, $v1
/* 175FC0 802476E0 544000B8 */  bnel      $v0, $zero, .L802479C4
/* 175FC4 802476E4 24020002 */   addiu    $v0, $zero, 0x2
/* 175FC8 802476E8 0C099EA7 */  jal       reset_all_actor_sounds
/* 175FCC 802476EC 0200202D */   daddu    $a0, $s0, $zero
/* 175FD0 802476F0 2405000A */  addiu     $a1, $zero, 0xA
D_802476F4:
/* 175FD4 802476F4 A2C001A7 */  sb        $zero, 0x1A7($s6)
/* 175FD8 802476F8 8E0401C4 */  lw        $a0, 0x1C4($s0)
D_802476FC:
/* 175FDC 802476FC 0C0B0CF8 */  jal       start_script
/* 175FE0 80247700 0000302D */   daddu    $a2, $zero, $zero
/* 175FE4 80247704 AE0201D4 */  sw        $v0, 0x1D4($s0)
/* 175FE8 80247708 8C430144 */  lw        $v1, 0x144($v0)
/* 175FEC 8024770C AE0301E4 */  sw        $v1, 0x1E4($s0)
/* 175FF0 80247710 86C30172 */  lh        $v1, 0x172($s6)
/* 175FF4 80247714 AC430148 */  sw        $v1, 0x148($v0)
/* 175FF8 80247718 08091E71 */  j         .L802479C4
D_8024771C:
/* 175FFC 8024771C 24020002 */   addiu    $v0, $zero, 0x2
D_80247720:
/* 176000 80247720 8EA201D4 */  lw        $v0, 0x1D4($s5)
/* 176004 80247724 10400005 */  beqz      $v0, .L8024773C
D_80247728:
/* 176008 80247728 00000000 */   nop
D_8024772C:
/* 17600C 8024772C 0C0B1059 */  jal       does_script_exist
.L80247730:
/* 176010 80247730 8EA401E4 */   lw       $a0, 0x1E4($s5)
/* 176014 80247734 144000A5 */  bnez      $v0, .L802479CC
D_80247738:
/* 176018 80247738 00000000 */   nop
.L8024773C:
/* 17601C 8024773C 8EA201D8 */  lw        $v0, 0x1D8($s5)
D_80247740:
/* 176020 80247740 10400006 */  beqz      $v0, .L8024775C
/* 176024 80247744 AEA001D4 */   sw       $zero, 0x1D4($s5)
/* 176028 80247748 8EA401E8 */  lw        $a0, 0x1E8($s5)
/* 17602C 8024774C 0C0B1059 */  jal       does_script_exist
D_80247750:
/* 176030 80247750 00000000 */   nop
/* 176034 80247754 1440009D */  bnez      $v0, .L802479CC
/* 176038 80247758 00000000 */   nop
.L8024775C:
/* 17603C 8024775C 1280000A */  beqz      $s4, D_80247788
/* 176040 80247760 AEA001D8 */   sw       $zero, 0x1D8($s5)
D_80247764:
/* 176044 80247764 8E8201D8 */  lw        $v0, 0x1D8($s4)
D_80247768:
/* 176048 80247768 50400007 */  beql      $v0, $zero, D_80247788
/* 17604C 8024776C AE8001D8 */   sw       $zero, 0x1D8($s4)
D_80247770:
/* 176050 80247770 8E8401E8 */  lw        $a0, 0x1E8($s4)
/* 176054 80247774 0C0B1059 */  jal       does_script_exist
/* 176058 80247778 00000000 */   nop
/* 17605C 8024777C 14400093 */  bnez      $v0, .L802479CC
D_80247780:
/* 176060 80247780 00000000 */   nop
/* 176064 80247784 AE8001D8 */  sw        $zero, 0x1D8($s4)
D_80247788:
/* 176068 80247788 0000982D */  daddu     $s3, $zero, $zero
/* 17606C 8024778C 0260882D */  daddu     $s1, $s3, $zero
/* 176070 80247790 02C0902D */  daddu     $s2, $s6, $zero
D_80247794:
/* 176074 80247794 8E5000E0 */  lw        $s0, 0xE0($s2)
/* 176078 80247798 5200000B */  beql      $s0, $zero, D_802477C8
/* 17607C 8024779C 26310001 */   addiu    $s1, $s1, 0x1
/* 176080 802477A0 8E0201D8 */  lw        $v0, 0x1D8($s0)
/* 176084 802477A4 50400008 */  beql      $v0, $zero, D_802477C8
/* 176088 802477A8 26310001 */   addiu    $s1, $s1, 0x1
/* 17608C 802477AC 8E0401E8 */  lw        $a0, 0x1E8($s0)
D_802477B0:
/* 176090 802477B0 0C0B1059 */  jal       does_script_exist
D_802477B4:
/* 176094 802477B4 00000000 */   nop
D_802477B8:
/* 176098 802477B8 50400002 */  beql      $v0, $zero, .L802477C4
/* 17609C 802477BC AE0001D8 */   sw       $zero, 0x1D8($s0)
D_802477C0:
/* 1760A0 802477C0 24130001 */  addiu     $s3, $zero, 0x1
.L802477C4:
/* 1760A4 802477C4 26310001 */  addiu     $s1, $s1, 0x1
D_802477C8:
/* 1760A8 802477C8 2A220018 */  slti      $v0, $s1, 0x18
D_802477CC:
/* 1760AC 802477CC 1440FFF1 */  bnez      $v0, D_80247794
/* 1760B0 802477D0 26520004 */   addiu    $s2, $s2, 0x4
D_802477D4:
/* 1760B4 802477D4 1660007D */  bnez      $s3, .L802479CC
/* 1760B8 802477D8 00000000 */   nop
/* 1760BC 802477DC 0C098D19 */  jal       btl_check_player_defeated
D_802477E0:
/* 1760C0 802477E0 00000000 */   nop
D_802477E4:
/* 1760C4 802477E4 144000BB */  bnez      $v0, .L80247AD4
D_802477E8:
/* 1760C8 802477E8 0000882D */   daddu    $s1, $zero, $zero
D_802477EC:
/* 1760CC 802477EC 02C0902D */  daddu     $s2, $s6, $zero
.L802477F0:
/* 1760D0 802477F0 8E5000E0 */  lw        $s0, 0xE0($s2)
/* 1760D4 802477F4 5200000B */  beql      $s0, $zero, .L80247824
glabel .L802477F8
/* 1760D8 802477F8 26310001 */   addiu    $s1, $s1, 0x1
/* 1760DC 802477FC 8E0201D4 */  lw        $v0, 0x1D4($s0)
D_80247800:
/* 1760E0 80247800 50400008 */  beql      $v0, $zero, .L80247824
/* 1760E4 80247804 26310001 */   addiu    $s1, $s1, 0x1
D_80247808:
/* 1760E8 80247808 8E0401E4 */  lw        $a0, 0x1E4($s0)
/* 1760EC 8024780C 0C0B1059 */  jal       does_script_exist
/* 1760F0 80247810 00000000 */   nop
/* 1760F4 80247814 50400002 */  beql      $v0, $zero, .L80247820
/* 1760F8 80247818 AE0001D4 */   sw       $zero, 0x1D4($s0)
/* 1760FC 8024781C 24130001 */  addiu     $s3, $zero, 0x1
.L80247820:
/* 176100 80247820 26310001 */  addiu     $s1, $s1, 0x1
.L80247824:
/* 176104 80247824 2A220018 */  slti      $v0, $s1, 0x18
/* 176108 80247828 1440FFF1 */  bnez      $v0, .L802477F0
/* 17610C 8024782C 26520004 */   addiu    $s2, $s2, 0x4
/* 176110 80247830 12600006 */  beqz      $s3, .L8024784C
/* 176114 80247834 3C030020 */   lui      $v1, (0x200000 >> 16)
/* 176118 80247838 3C02800E */  lui       $v0, %hi(gBattleStatus)
/* 17611C 8024783C 8C42C070 */  lw        $v0, %lo(gBattleStatus)($v0)
D_80247840:
/* 176120 80247840 00431024 */  and       $v0, $v0, $v1
/* 176124 80247844 10400061 */  beqz      $v0, .L802479CC
/* 176128 80247848 00000000 */   nop
.L8024784C:
/* 17612C 8024784C 3C04800E */  lui       $a0, %hi(gBattleStatus)
/* 176130 80247850 2484C070 */  addiu     $a0, $a0, %lo(gBattleStatus)
/* 176134 80247854 8C820000 */  lw        $v0, 0x0($a0)
/* 176138 80247858 2403FEFF */  addiu     $v1, $zero, -0x101
/* 17613C 8024785C 00431024 */  and       $v0, $v0, $v1
/* 176140 80247860 AC820000 */  sw        $v0, 0x0($a0)
.L80247864:
/* 176144 80247864 8C820004 */  lw        $v0, 0x4($a0)
/* 176148 80247868 2403BFFF */  addiu     $v1, $zero, -0x4001
/* 17614C 8024786C 00431024 */  and       $v0, $v0, $v1
D_80247870:
/* 176150 80247870 0C098D0D */  jal       btl_check_enemies_defeated
/* 176154 80247874 AC820004 */   sw       $v0, 0x4($a0)
D_80247878:
/* 176158 80247878 14400096 */  bnez      $v0, .L80247AD4
D_8024787C:
/* 17615C 8024787C 00000000 */   nop
D_80247880:
/* 176160 80247880 82C2008C */  lb        $v0, 0x8C($s6)
/* 176164 80247884 14400051 */  bnez      $v0, .L802479CC
D_80247888:
/* 176168 80247888 00000000 */   nop
/* 17616C 8024788C 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 176170 80247890 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 176174 80247894 904200AA */  lbu       $v0, 0xAA($v0)
/* 176178 80247898 30420001 */  andi      $v0, $v0, 0x1
.L8024789C:
/* 17617C 8024789C 10400005 */  beqz      $v0, .L802478B4
/* 176180 802478A0 00000000 */   nop
/* 176184 802478A4 0C090464 */  jal       func_80241190
/* 176188 802478A8 24040023 */   addiu    $a0, $zero, 0x23
/* 17618C 802478AC 08091E73 */  j         .L802479CC
/* 176190 802478B0 00000000 */   nop
.L802478B4:
/* 176194 802478B4 0C099DDF */  jal       btl_update_ko_status
D_802478B8:
/* 176198 802478B8 00000000 */   nop
/* 17619C 802478BC 82A2021C */  lb        $v0, 0x21C($s5)
D_802478C0:
/* 1761A0 802478C0 1040003F */  beqz      $v0, D_802479C0
/* 1761A4 802478C4 3C030C00 */   lui      $v1, (0xC000000 >> 16)
D_802478C8:
/* 1761A8 802478C8 8EA20000 */  lw        $v0, 0x0($s5)
/* 1761AC 802478CC 00431025 */  or        $v0, $v0, $v1
/* 1761B0 802478D0 12800004 */  beqz      $s4, .L802478E4
/* 1761B4 802478D4 AEA20000 */   sw       $v0, 0x0($s5)
/* 1761B8 802478D8 8E820000 */  lw        $v0, 0x0($s4)
/* 1761BC 802478DC 00431025 */  or        $v0, $v0, $v1
/* 1761C0 802478E0 AE820000 */  sw        $v0, 0x0($s4)
.L802478E4:
/* 1761C4 802478E4 0C093903 */  jal       func_8024E40C
D_802478E8:
/* 1761C8 802478E8 24040021 */   addiu    $a0, $zero, 0x21
/* 1761CC 802478EC 92A2021C */  lbu       $v0, 0x21C($s5)
/* 1761D0 802478F0 2442FFFC */  addiu     $v0, $v0, -0x4
/* 1761D4 802478F4 00021600 */  sll       $v0, $v0, 24
/* 1761D8 802478F8 00021E03 */  sra       $v1, $v0, 24
/* 1761DC 802478FC 2C620007 */  sltiu     $v0, $v1, 0x7
D_80247900:
/* 1761E0 80247900 10400012 */  beqz      $v0, .L8024794C
/* 1761E4 80247904 00031080 */   sll      $v0, $v1, 2
/* 1761E8 80247908 3C01802A */  lui       $at, %hi(jtbl_8029CBC0)
/* 1761EC 8024790C 00220821 */  addu      $at, $at, $v0
/* 1761F0 80247910 8C22CBC0 */  lw        $v0, %lo(jtbl_8029CBC0)($at)
/* 1761F4 80247914 00400008 */  jr        $v0
/* 1761F8 80247918 00000000 */   nop
glabel .L8024791C
/* 1761FC 8024791C 08091E57 */  j         .L8024795C
/* 176200 80247920 2404000A */   addiu    $a0, $zero, 0xA
glabel .L80247924
/* 176204 80247924 08091E57 */  j         .L8024795C
/* 176208 80247928 2404000B */   addiu    $a0, $zero, 0xB
D_8024792C:
/* 17620C 8024792C 08091E57 */  j         .L8024795C
/* 176210 80247930 2404000C */   addiu    $a0, $zero, 0xC
glabel .L80247934
/* 176214 80247934 08091E57 */  j         .L8024795C
rodata_alignment:
/* 176218 80247938 2404000D */   addiu    $a0, $zero, 0xD
glabel .L8024793C
/* 17621C 8024793C 08091E57 */  j         .L8024795C
D_80247940:
/* 176220 80247940 2404000E */   addiu    $a0, $zero, 0xE
glabel .L80247944
/* 176224 80247944 08091E57 */  j         .L8024795C
/* 176228 80247948 2404000F */   addiu    $a0, $zero, 0xF
glabel .L8024794C
/* 17622C 8024794C 0000202D */  daddu     $a0, $zero, $zero
D_80247950:
/* 176230 80247950 24020014 */  addiu     $v0, $zero, 0x14
/* 176234 80247954 3C01800E */  lui       $at, %hi(gBattleSubState)
D_80247958:
/* 176238 80247958 AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
.L8024795C:
/* 17623C 8024795C 0C093E58 */  jal       func_8024F960
D_80247960:
/* 176240 80247960 2405003C */   addiu    $a1, $zero, 0x3C
/* 176244 80247964 2402000B */  addiu     $v0, $zero, 0xB
jtbl_80247968:
/* 176248 80247968 08091E71 */  j         .L802479C4
D_8024796C:
/* 17624C 8024796C A2A0021C */   sb       $zero, 0x21C($s5)
glabel .L80247970
/* 176250 80247970 0C093EAD */  jal       func_8024FAB4
/* 176254 80247974 00000000 */   nop
/* 176258 80247978 14400014 */  bnez      $v0, .L802479CC
D_8024797C:
/* 17625C 8024797C 00000000 */   nop
D_80247980:
/* 176260 80247980 0C093903 */  jal       func_8024E40C
D_80247984:
/* 176264 80247984 24040002 */   addiu    $a0, $zero, 0x2
/* 176268 80247988 0C093936 */  jal       D_8024E4D8_C0BD58
/* 17626C 8024798C 2404000F */   addiu    $a0, $zero, 0xF
/* 176270 80247990 2402000A */  addiu     $v0, $zero, 0xA
/* 176274 80247994 3C01802A */  lui       $at, %hi(D_8029F248)
/* 176278 80247998 AC22F248 */  sw        $v0, %lo(D_8029F248)($at)
/* 17627C 8024799C 08091E71 */  j         .L802479C4
/* 176280 802479A0 2402000C */   addiu    $v0, $zero, 0xC
glabel .L802479A4
/* 176284 802479A4 3C03802A */  lui       $v1, %hi(D_8029F248)
D_802479A8:
/* 176288 802479A8 2463F248 */  addiu     $v1, $v1, %lo(D_8029F248)
/* 17628C 802479AC 8C620000 */  lw        $v0, 0x0($v1)
D_802479B0:
/* 176290 802479B0 10400003 */  beqz      $v0, D_802479C0
/* 176294 802479B4 2442FFFF */   addiu    $v0, $v0, -0x1
D_802479B8:
/* 176298 802479B8 08091E73 */  j         .L802479CC
.L802479BC:
/* 17629C 802479BC AC620000 */   sw       $v0, 0x0($v1)
D_802479C0:
/* 1762A0 802479C0 24020014 */  addiu     $v0, $zero, 0x14
.L802479C4:
/* 1762A4 802479C4 3C01800E */  lui       $at, %hi(gBattleSubState)
D_802479C8:
/* 1762A8 802479C8 AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
glabel .L802479CC
/* 1762AC 802479CC 3C10800E */  lui       $s0, %hi(gBattleSubState)
jtbl_802479D0:
/* 1762B0 802479D0 2610C4DC */  addiu     $s0, $s0, %lo(gBattleSubState)
/* 1762B4 802479D4 8E030000 */  lw        $v1, 0x0($s0)
/* 1762B8 802479D8 24110015 */  addiu     $s1, $zero, 0x15
/* 1762BC 802479DC 10710020 */  beq       $v1, $s1, .L80247A60
/* 1762C0 802479E0 28620016 */   slti     $v0, $v1, 0x16
/* 1762C4 802479E4 10400005 */  beqz      $v0, D_802479FC
/* 1762C8 802479E8 24020014 */   addiu    $v0, $zero, 0x14
/* 1762CC 802479EC 10620008 */  beq       $v1, $v0, D_80247A10
D_802479F0:
/* 1762D0 802479F0 00000000 */   nop
.L802479F4:
/* 1762D4 802479F4 08091EAE */  j         jtbl_80247AB8
/* 1762D8 802479F8 00000000 */   nop
D_802479FC:
/* 1762DC 802479FC 24020016 */  addiu     $v0, $zero, 0x16
D_80247A00:
/* 1762E0 80247A00 10620024 */  beq       $v1, $v0, .L80247A94
/* 1762E4 80247A04 00000000 */   nop
/* 1762E8 80247A08 08091EAE */  j         jtbl_80247AB8
/* 1762EC 80247A0C 00000000 */   nop
D_80247A10:
/* 1762F0 80247A10 12800027 */  beqz      $s4, .L80247AB0
/* 1762F4 80247A14 2402000D */   addiu    $v0, $zero, 0xD
D_80247A18:
/* 1762F8 80247A18 8283021C */  lb        $v1, 0x21C($s4)
/* 1762FC 80247A1C 14620025 */  bne       $v1, $v0, .L80247AB4
D_80247A20:
/* 176300 80247A20 2402001E */   addiu    $v0, $zero, 0x1E
.L80247A24:
/* 176304 80247A24 8EA20000 */  lw        $v0, 0x0($s5)
jtbl_80247A28:
/* 176308 80247A28 3C030C00 */  lui       $v1, (0xC000000 >> 16)
.L80247A2C:
/* 17630C 80247A2C 00431025 */  or        $v0, $v0, $v1
D_80247A30:
/* 176310 80247A30 AEA20000 */  sw        $v0, 0x0($s5)
/* 176314 80247A34 8E820000 */  lw        $v0, 0x0($s4)
D_80247A38:
/* 176318 80247A38 24040036 */  addiu     $a0, $zero, 0x36
glabel .L80247A3C
/* 17631C 80247A3C 00431025 */  or        $v0, $v0, $v1
D_80247A40:
/* 176320 80247A40 0C093903 */  jal       func_8024E40C
/* 176324 80247A44 AE820000 */   sw       $v0, 0x0($s4)
jtbl_80247A48:
/* 176328 80247A48 24040023 */  addiu     $a0, $zero, 0x23
/* 17632C 80247A4C 0C093E58 */  jal       func_8024F960
/* 176330 80247A50 2405003C */   addiu    $a1, $zero, 0x3C
/* 176334 80247A54 A280021C */  sb        $zero, 0x21C($s4)
/* 176338 80247A58 08091EAE */  j         jtbl_80247AB8
/* 17633C 80247A5C AE110000 */   sw       $s1, 0x0($s0)
.L80247A60:
/* 176340 80247A60 0C093EAD */  jal       func_8024FAB4
/* 176344 80247A64 00000000 */   nop
/* 176348 80247A68 14400013 */  bnez      $v0, jtbl_80247AB8
/* 17634C 80247A6C 00000000 */   nop
D_80247A70:
/* 176350 80247A70 0C093903 */  jal       func_8024E40C
/* 176354 80247A74 24040002 */   addiu    $a0, $zero, 0x2
jtbl_80247A78:
/* 176358 80247A78 0C093936 */  jal       D_8024E4D8_C0BD58
.L80247A7C:
/* 17635C 80247A7C 2404000F */   addiu    $a0, $zero, 0xF
D_80247A80:
/* 176360 80247A80 2402000A */  addiu     $v0, $zero, 0xA
/* 176364 80247A84 3C01802A */  lui       $at, %hi(D_8029F248)
.L80247A88:
/* 176368 80247A88 AC22F248 */  sw        $v0, %lo(D_8029F248)($at)
/* 17636C 80247A8C 08091EAD */  j         .L80247AB4
D_80247A90:
/* 176370 80247A90 24020016 */   addiu    $v0, $zero, 0x16
.L80247A94:
/* 176374 80247A94 3C03802A */  lui       $v1, %hi(D_8029F248)
jtbl_80247A98:
/* 176378 80247A98 2463F248 */  addiu     $v1, $v1, %lo(D_8029F248)
/* 17637C 80247A9C 8C620000 */  lw        $v0, 0x0($v1)
D_80247AA0:
/* 176380 80247AA0 10400003 */  beqz      $v0, .L80247AB0
.L80247AA4:
/* 176384 80247AA4 2442FFFF */   addiu    $v0, $v0, -0x1
/* 176388 80247AA8 08091EAE */  j         jtbl_80247AB8
/* 17638C 80247AAC AC620000 */   sw       $v0, 0x0($v1)
.L80247AB0:
/* 176390 80247AB0 2402001E */  addiu     $v0, $zero, 0x1E
.L80247AB4:
/* 176394 80247AB4 AE020000 */  sw        $v0, 0x0($s0)
jtbl_80247AB8:
/* 176398 80247AB8 3C03800E */  lui       $v1, %hi(gBattleSubState)
/* 17639C 80247ABC 8C63C4DC */  lw        $v1, %lo(gBattleSubState)($v1)
D_80247AC0:
/* 1763A0 80247AC0 2402001E */  addiu     $v0, $zero, 0x1E
/* 1763A4 80247AC4 14620003 */  bne       $v1, $v0, .L80247AD4
/* 1763A8 80247AC8 00000000 */   nop
/* 1763AC 80247ACC 0C090464 */  jal       func_80241190
/* 1763B0 80247AD0 24040014 */   addiu    $a0, $zero, 0x14
.L80247AD4:
/* 1763B4 80247AD4 8FBF002C */  lw        $ra, 0x2C($sp)
/* 1763B8 80247AD8 8FB60028 */  lw        $s6, 0x28($sp)
/* 1763BC 80247ADC 8FB50024 */  lw        $s5, 0x24($sp)
/* 1763C0 80247AE0 8FB40020 */  lw        $s4, 0x20($sp)
/* 1763C4 80247AE4 8FB3001C */  lw        $s3, 0x1C($sp)
D_80247AE8:
/* 1763C8 80247AE8 8FB20018 */  lw        $s2, 0x18($sp)
/* 1763CC 80247AEC 8FB10014 */  lw        $s1, 0x14($sp)
D_80247AF0_EE64B0:
/* 1763D0 80247AF0 8FB00010 */  lw        $s0, 0x10($sp)
/* 1763D4 80247AF4 03E00008 */  jr        $ra
D_80247AF8_EE64B8:
/* 1763D8 80247AF8 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

void btl_state_update_enemy_move(void) {
    BattleStatus* battleStatus = &gBattleStatus;
    Actor* player = gBattleStatus.playerActor;
    Actor* partner = gBattleStatus.partnerActor;
    Actor* enemy;
    s32 i;

    Evt* script;
    s32 messageIndex;
    s32 waitingForEnemyScript;

    switch (gBattleSubState) {
        case BTL_SUBSTATE_ENEMY_MOVE_EXECUTE:
        case BTL_SUBSTATE_ENEMY_MOVE_UNUSED_1:
            gBattleStatus.flags1 &= ~BS_FLAGS1_MENU_OPEN;
            gBattleStatus.flags1 &= ~BS_FLAGS1_YIELD_TURN;
            player->flags &= ~ACTOR_FLAG_8000000;
            if (partner != NULL) {
                partner->flags &= ~ACTOR_FLAG_8000000;
            }
            battleStatus->stateFreezeCount = 0;
            battleStatus->lastAttackDamage = 0;
            battleStatus->actionSuccess = 0;
            battleStatus->unk_86 = 127;
            battleStatus->blockResult = 127;
            battleStatus->currentDamageSource = DMG_SRC_DEFAULT;
            reset_actor_turn_info();
            gBattleStatus.flags1 |= BS_FLAGS1_100;
            player->statusAfflicted = 0;
            if (partner != NULL) {
                partner->statusAfflicted = 0;
            }

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

            for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
                enemy = battleStatus->enemyActors[i];
                if (enemy != NULL) {
                    if (!(enemy->flags & ACTOR_FLAG_NO_DMG_APPLY)) {
                        enemy->flags &= ~ACTOR_FLAG_8000000;
                    }
                }
            }

            enemy = battleStatus->currentTurnEnemy;
            if (!(enemy->flags & ACTOR_FLAG_NO_ATTACK)) {
                reset_all_actor_sounds(enemy);
                battleStatus->battlePhase = PHASE_EXECUTE_ACTION;
                script = start_script(enemy->takeTurnSource, EVT_PRIORITY_A, 0);
                enemy->takeTurnScript = script;
                enemy->takeTurnScriptID = script->id;
                script->owner1.actorID = battleStatus->activeEnemyActorID;
            }
            gBattleSubState = BTL_SUBSTATE_ENEMY_MOVE_AWAIT_SCRIPTS;
            break;
        case BTL_SUBSTATE_ENEMY_MOVE_AWAIT_SCRIPTS:
            if (player->takeTurnScript != NULL && does_script_exist(player->takeTurnScriptID)) {
                break;
            }
            player->takeTurnScript = NULL;

            if (player->handleEventScript != NULL && does_script_exist(player->handleEventScriptID)) {
                break;
            }
            player->handleEventScript = NULL;

            if (partner != NULL) {
                if (partner->handleEventScript != NULL && does_script_exist(partner->handleEventScriptID)) {
                    break;
                }
                partner->handleEventScript = NULL;
            }

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

            if (waitingForEnemyScript) {
                break;
            }

            if (btl_check_player_defeated()) {
                return;
            }

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

            if (!waitingForEnemyScript || (gBattleStatus.flags1 & BS_FLAGS1_YIELD_TURN)) {
                gBattleStatus.flags1 &= ~BS_FLAGS1_100;
                gBattleStatus.flags2 &= ~BS_FLAGS2_4000;
                if (btl_check_enemies_defeated()) {
                    return;
                }

                if (battleStatus->stateFreezeCount == 0) {
                    if (gGameStatusPtr->demoFlags & 1) {
                        btl_set_state(BATTLE_STATE_END_DEMO_BATTLE);
                    } else {
                        btl_update_ko_status();
                        if (player->statusAfflicted != 0) {
                            player->flags |= ACTOR_FLAG_8000000 | ACTOR_FLAG_4000000;
                            if (partner != NULL) {
                                partner->flags |= ACTOR_FLAG_8000000 | ACTOR_FLAG_4000000;
                            }
                            btl_cam_use_preset(BTL_CAM_PLAYER_STATUS_AFFLICTED);

                            switch (player->statusAfflicted) {
                                case STATUS_KEY_DIZZY:
                                    messageIndex = BTL_MSG_PLAYER_DAZED;
                                    break;
                                case STATUS_KEY_SLEEP:
                                    messageIndex = BTL_MSG_PLAYER_ASLEEP;
                                    break;
                                case STATUS_KEY_FROZEN:
                                    messageIndex = BTL_MSG_PLAYER_FROZEN;
                                    break;
                                case STATUS_KEY_POISON:
                                    messageIndex = BTL_MSG_PLAYER_POISONED;
                                    break;
                                case STATUS_KEY_SHRINK:
                                    messageIndex = BTL_MSG_PLAYER_SHRUNK;
                                    break;
                                case STATUS_KEY_PARALYZE:
                                    messageIndex = BTL_MSG_PLAYER_PARALYZED;
                                    break;
                                default:
                                    messageIndex = 0;
                                    gBattleSubState = BTL_SUBSTATE_ENEMY_MOVE_CHECK_PARTNER;
                                    break;
                            }
                            btl_show_battle_message(messageIndex, 60);
                            player->statusAfflicted = 0;
                            gBattleSubState = BTL_SUBSTATE_ENEMY_MOVE_AWAIT_PLAYER_POPUP_DONE;
                            break;
                        } else {
                            gBattleSubState = BTL_SUBSTATE_ENEMY_MOVE_CHECK_PARTNER;
                            break;
                        }
                    }
                }
            }
            break;
        case BTL_SUBSTATE_ENEMY_MOVE_AWAIT_PLAYER_POPUP_DONE:
            if (!btl_is_popup_displayed()) {
                btl_cam_use_preset(BTL_CAM_DEFAULT);
                btl_cam_move(15);
                D_8029F248 = 10;
                gBattleSubState = BTL_SUBSTATE_ENEMY_MOVE_POST_PLAYER_POPUP_DELAY;
            }
            break;
        case BTL_SUBSTATE_ENEMY_MOVE_POST_PLAYER_POPUP_DELAY:
            if (D_8029F248 != 0) {
                D_8029F248--;
            } else {
                gBattleSubState = BTL_SUBSTATE_ENEMY_MOVE_CHECK_PARTNER;
                break;
            }
            break;
    }

    switch (gBattleSubState) {
        case BTL_SUBSTATE_ENEMY_MOVE_CHECK_PARTNER:
            if (partner != NULL) {
                if (partner->statusAfflicted == STATUS_KEY_DAZE) {
                    player->flags |= ACTOR_FLAG_8000000 | ACTOR_FLAG_4000000;
                    partner->flags |= ACTOR_FLAG_8000000 | ACTOR_FLAG_4000000;
                    btl_cam_use_preset(BTL_CAM_PARTNER_INJURED);
                    btl_show_battle_message(BTL_MSG_PARTNER_INJURED, 60);
                    partner->statusAfflicted = 0;
                    gBattleSubState = BTL_SUBSTATE_ENEMY_MOVE_AWAIT_PARTNER_POPUP_DONE;
                } else {
                    gBattleSubState = BTL_SUBSTATE_ENEMY_MOVE_DONE;
                }
            } else {
                gBattleSubState = BTL_SUBSTATE_ENEMY_MOVE_DONE;
            }
            break;
        case BTL_SUBSTATE_ENEMY_MOVE_AWAIT_PARTNER_POPUP_DONE:
            if (!btl_is_popup_displayed()) {
                btl_cam_use_preset(BTL_CAM_DEFAULT);
                btl_cam_move(15);
                D_8029F248 = 10;
                gBattleSubState = BTL_SUBSTATE_ENEMY_MOVE_POST_PARTNER_POPUP_DELAY;
            }
            break;
        case BTL_SUBSTATE_ENEMY_MOVE_POST_PARTNER_POPUP_DELAY:
            if (D_8029F248 != 0) {
                D_8029F248--;
            } else {
                gBattleSubState = BTL_SUBSTATE_ENEMY_MOVE_DONE;
            }
            break;
    }

    if (gBattleSubState == BTL_SUBSTATE_ENEMY_MOVE_DONE) {
        btl_set_state(BATTLE_STATE_NEXT_ENEMY);
    }
}