### RAW ASSEMBLY INSTRUCTIONS:

glabel RunToGoal
/* 1A8744 80279E64 27BDFFB8 */  addiu     $sp, $sp, -0x48
/* 1A8748 80279E68 AFB20020 */  sw        $s2, 0x20($sp)
/* 1A874C 80279E6C 0080902D */  daddu     $s2, $a0, $zero
/* 1A8750 80279E70 AFBF0024 */  sw        $ra, 0x24($sp)
/* 1A8754 80279E74 AFB1001C */  sw        $s1, 0x1C($sp)
/* 1A8758 80279E78 AFB00018 */  sw        $s0, 0x18($sp)
/* 1A875C 80279E7C F7BA0040 */  sdc1      $f26, 0x40($sp)
/* 1A8760 80279E80 F7B80038 */  sdc1      $f24, 0x38($sp)
/* 1A8764 80279E84 F7B60030 */  sdc1      $f22, 0x30($sp)
/* 1A8768 80279E88 F7B40028 */  sdc1      $f20, 0x28($sp)
/* 1A876C 80279E8C 8E51000C */  lw        $s1, 0xC($s2)
/* 1A8770 80279E90 54A00001 */  bnel      $a1, $zero, .L80279E98
/* 1A8774 80279E94 AE400070 */   sw       $zero, 0x70($s2)
.L80279E98:
/* 1A8778 80279E98 8E420070 */  lw        $v0, 0x70($s2)
/* 1A877C 80279E9C 14400067 */  bnez      $v0, .L8027A03C
/* 1A8780 80279EA0 00000000 */   nop
/* 1A8784 80279EA4 8E250000 */  lw        $a1, 0x0($s1)
/* 1A8788 80279EA8 26310004 */  addiu     $s1, $s1, 0x4
/* 1A878C 80279EAC 0C0B1EAF */  jal       evt_get_variable
/* 1A8790 80279EB0 0240202D */   daddu    $a0, $s2, $zero
/* 1A8794 80279EB4 0040202D */  daddu     $a0, $v0, $zero
/* 1A8798 80279EB8 2402FF81 */  addiu     $v0, $zero, -0x7F
/* 1A879C 80279EBC 14820002 */  bne       $a0, $v0, .L80279EC8
/* 1A87A0 80279EC0 00000000 */   nop
/* 1A87A4 80279EC4 8E440148 */  lw        $a0, 0x148($s2)
.L80279EC8:
/* 1A87A8 80279EC8 0C09A75B */  jal       get_actor
/* 1A87AC 80279ECC 00000000 */   nop
/* 1A87B0 80279ED0 0040802D */  daddu     $s0, $v0, $zero
/* 1A87B4 80279ED4 AE500074 */  sw        $s0, 0x74($s2)
/* 1A87B8 80279ED8 8E250000 */  lw        $a1, 0x0($s1)
/* 1A87BC 80279EDC 26310004 */  addiu     $s1, $s1, 0x4
/* 1A87C0 80279EE0 0C0B1EAF */  jal       evt_get_variable
/* 1A87C4 80279EE4 0240202D */   daddu    $a0, $s2, $zero
/* 1A87C8 80279EE8 A6020070 */  sh        $v0, 0x70($s0)
/* 1A87CC 80279EEC 8E250000 */  lw        $a1, 0x0($s1)
/* 1A87D0 80279EF0 0C0B1EAF */  jal       evt_get_variable
/* 1A87D4 80279EF4 0240202D */   daddu    $a0, $s2, $zero
/* 1A87D8 80279EF8 AE420078 */  sw        $v0, 0x78($s2)
/* 1A87DC 80279EFC C6160018 */  lwc1      $f22, 0x18($s0)
/* 1A87E0 80279F00 C6180020 */  lwc1      $f24, 0x20($s0)
/* 1A87E4 80279F04 C6000144 */  lwc1      $f0, 0x144($s0)
/* 1A87E8 80279F08 C614014C */  lwc1      $f20, 0x14C($s0)
/* 1A87EC 80279F0C C602001C */  lwc1      $f2, 0x1C($s0)
/* 1A87F0 80279F10 4406B000 */  mfc1      $a2, $f22
/* 1A87F4 80279F14 4407C000 */  mfc1      $a3, $f24
/* 1A87F8 80279F18 2611000C */  addiu     $s1, $s0, 0xC
/* 1A87FC 80279F1C E600000C */  swc1      $f0, 0xC($s0)
/* 1A8800 80279F20 C6000148 */  lwc1      $f0, 0x148($s0)
/* 1A8804 80279F24 C61A000C */  lwc1      $f26, 0xC($s0)
/* 1A8808 80279F28 4600A386 */  mov.s     $f14, $f20
/* 1A880C 80279F2C E6140014 */  swc1      $f20, 0x14($s0)
/* 1A8810 80279F30 E6160024 */  swc1      $f22, 0x24($s0)
/* 1A8814 80279F34 E6020028 */  swc1      $f2, 0x28($s0)
/* 1A8818 80279F38 E618002C */  swc1      $f24, 0x2C($s0)
/* 1A881C 80279F3C 4600D306 */  mov.s     $f12, $f26
/* 1A8820 80279F40 0C00A720 */  jal       atan2
/* 1A8824 80279F44 E6000010 */   swc1     $f0, 0x10($s0)
/* 1A8828 80279F48 4600D306 */  mov.s     $f12, $f26
/* 1A882C 80279F4C 4406B000 */  mfc1      $a2, $f22
/* 1A8830 80279F50 4407C000 */  mfc1      $a3, $f24
/* 1A8834 80279F54 4600A386 */  mov.s     $f14, $f20
/* 1A8838 80279F58 0C00A7B5 */  jal       dist2D
/* 1A883C 80279F5C E6000054 */   swc1     $f0, 0x54($s0)
/* 1A8840 80279F60 86020070 */  lh        $v0, 0x70($s0)
/* 1A8844 80279F64 46000086 */  mov.s     $f2, $f0
/* 1A8848 80279F68 14400018 */  bnez      $v0, .L80279FCC
/* 1A884C 80279F6C E6020058 */   swc1     $f2, 0x58($s0)
/* 1A8850 80279F70 C600004C */  lwc1      $f0, 0x4C($s0)
/* 1A8854 80279F74 46001003 */  div.s     $f0, $f2, $f0
/* 1A8858 80279F78 4600020D */  trunc.w.s $f8, $f0
/* 1A885C 80279F7C 44024000 */  mfc1      $v0, $f8
/* 1A8860 80279F80 00000000 */  nop
/* 1A8864 80279F84 A6020070 */  sh        $v0, 0x70($s0)
/* 1A8868 80279F88 00021400 */  sll       $v0, $v0, 16
/* 1A886C 80279F8C 14400002 */  bnez      $v0, .L80279F98
/* 1A8870 80279F90 24020001 */   addiu    $v0, $zero, 0x1
/* 1A8874 80279F94 A6020070 */  sh        $v0, 0x70($s0)
.L80279F98:
/* 1A8878 80279F98 86020070 */  lh        $v0, 0x70($s0)
/* 1A887C 80279F9C C602004C */  lwc1      $f2, 0x4C($s0)
/* 1A8880 80279FA0 44823000 */  mtc1      $v0, $f6
/* 1A8884 80279FA4 00000000 */  nop
/* 1A8888 80279FA8 468031A0 */  cvt.s.w   $f6, $f6
/* 1A888C 80279FAC 46023102 */  mul.s     $f4, $f6, $f2
/* 1A8890 80279FB0 00000000 */  nop
/* 1A8894 80279FB4 C6000058 */  lwc1      $f0, 0x58($s0)
/* 1A8898 80279FB8 46040001 */  sub.s     $f0, $f0, $f4
/* 1A889C 80279FBC 46060003 */  div.s     $f0, $f0, $f6
/* 1A88A0 80279FC0 46001080 */  add.s     $f2, $f2, $f0
/* 1A88A4 80279FC4 0809E7F8 */  j         .L80279FE0
/* 1A88A8 80279FC8 E602004C */   swc1     $f2, 0x4C($s0)
.L80279FCC:
/* 1A88AC 80279FCC 44820000 */  mtc1      $v0, $f0
/* 1A88B0 80279FD0 00000000 */  nop
/* 1A88B4 80279FD4 46800020 */  cvt.s.w   $f0, $f0
/* 1A88B8 80279FD8 46001003 */  div.s     $f0, $f2, $f0
/* 1A88BC 80279FDC E600004C */  swc1      $f0, 0x4C($s0)
.L80279FE0:
/* 1A88C0 80279FE0 860201B4 */  lh        $v0, 0x1B4($s0)
/* 1A88C4 80279FE4 04420002 */  bltzl     $v0, .L80279FF0
/* 1A88C8 80279FE8 00021027 */   nor      $v0, $zero, $v0
/* 1A88CC 80279FEC 24420001 */  addiu     $v0, $v0, 0x1
.L80279FF0:
/* 1A88D0 80279FF0 44820000 */  mtc1      $v0, $f0
/* 1A88D4 80279FF4 00000000 */  nop
/* 1A88D8 80279FF8 46800020 */  cvt.s.w   $f0, $f0
/* 1A88DC 80279FFC E620004C */  swc1      $f0, 0x4C($s1)
/* 1A88E0 8027A000 8E02019C */  lw        $v0, 0x19C($s0)
/* 1A88E4 8027A004 1040000C */  beqz      $v0, .L8027A038
/* 1A88E8 8027A008 24020001 */   addiu    $v0, $zero, 0x1
/* 1A88EC 8027A00C 8E0201A0 */  lw        $v0, 0x1A0($s0)
/* 1A88F0 8027A010 14400009 */  bnez      $v0, .L8027A038
/* 1A88F4 8027A014 24020001 */   addiu    $v0, $zero, 0x1
/* 1A88F8 8027A018 C600014C */  lwc1      $f0, 0x14C($s0)
/* 1A88FC 8027A01C E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A8900 8027A020 8E04019C */  lw        $a0, 0x19C($s0)
/* 1A8904 8027A024 8E060144 */  lw        $a2, 0x144($s0)
/* 1A8908 8027A028 8E070148 */  lw        $a3, 0x148($s0)
/* 1A890C 8027A02C 0C052757 */  jal       sfx_play_sound_at_position
/* 1A8910 8027A030 0000282D */   daddu    $a1, $zero, $zero
/* 1A8914 8027A034 24020001 */  addiu     $v0, $zero, 0x1
.L8027A038:
/* 1A8918 8027A038 AE420070 */  sw        $v0, 0x70($s2)
.L8027A03C:
/* 1A891C 8027A03C 8E500074 */  lw        $s0, 0x74($s2)
/* 1A8920 8027A040 2611000C */  addiu     $s1, $s0, 0xC
/* 1A8924 8027A044 8E05004C */  lw        $a1, 0x4C($s0)
/* 1A8928 8027A048 8E060054 */  lw        $a2, 0x54($s0)
/* 1A892C 8027A04C 0C09904A */  jal       add_xz_vec3f
/* 1A8930 8027A050 0220202D */   daddu    $a0, $s1, $zero
/* 1A8934 8027A054 8E420078 */  lw        $v0, 0x78($s2)
/* 1A8938 8027A058 14400017 */  bnez      $v0, .L8027A0B8
/* 1A893C 8027A05C 00000000 */   nop
/* 1A8940 8027A060 C602004C */  lwc1      $f2, 0x4C($s0)
/* 1A8944 8027A064 3C014080 */  lui       $at, (0x40800000 >> 16)
/* 1A8948 8027A068 44810000 */  mtc1      $at, $f0
/* 1A894C 8027A06C 00000000 */  nop
/* 1A8950 8027A070 4600103C */  c.lt.s    $f2, $f0
/* 1A8954 8027A074 00000000 */  nop
/* 1A8958 8027A078 45000007 */  bc1f      .L8027A098
/* 1A895C 8027A07C 0000202D */   daddu    $a0, $zero, $zero
/* 1A8960 8027A080 C6000054 */  lwc1      $f0, 0x54($s0)
/* 1A8964 8027A084 E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A8968 8027A088 8E05000C */  lw        $a1, 0xC($s0)
/* 1A896C 8027A08C 8E060010 */  lw        $a2, 0x10($s0)
/* 1A8970 8027A090 0809E82C */  j         .L8027A0B0
/* 1A8974 8027A094 8E070014 */   lw       $a3, 0x14($s0)
.L8027A098:
/* 1A8978 8027A098 C6000054 */  lwc1      $f0, 0x54($s0)
/* 1A897C 8027A09C E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A8980 8027A0A0 8E05000C */  lw        $a1, 0xC($s0)
/* 1A8984 8027A0A4 8E060010 */  lw        $a2, 0x10($s0)
/* 1A8988 8027A0A8 8E070014 */  lw        $a3, 0x14($s0)
/* 1A898C 8027A0AC 24040001 */  addiu     $a0, $zero, 0x1
.L8027A0B0:
/* 1A8990 8027A0B0 0C0990BC */  jal       play_movement_dust_effects
/* 1A8994 8027A0B4 00000000 */   nop
.L8027A0B8:
/* 1A8998 8027A0B8 C6200000 */  lwc1      $f0, 0x0($s1)
/* 1A899C 8027A0BC 8E02019C */  lw        $v0, 0x19C($s0)
/* 1A89A0 8027A0C0 E6000144 */  swc1      $f0, 0x144($s0)
/* 1A89A4 8027A0C4 C6200008 */  lwc1      $f0, 0x8($s1)
/* 1A89A8 8027A0C8 1040004A */  beqz      $v0, .L8027A1F4
/* 1A89AC 8027A0CC E600014C */   swc1     $f0, 0x14C($s0)
/* 1A89B0 8027A0D0 8E0201A0 */  lw        $v0, 0x1A0($s0)
/* 1A89B4 8027A0D4 10400047 */  beqz      $v0, .L8027A1F4
/* 1A89B8 8027A0D8 00000000 */   nop
/* 1A89BC 8027A0DC 860201B4 */  lh        $v0, 0x1B4($s0)
/* 1A89C0 8027A0E0 0440001C */  bltz      $v0, .L8027A154
/* 1A89C4 8027A0E4 00000000 */   nop
/* 1A89C8 8027A0E8 C622004C */  lwc1      $f2, 0x4C($s1)
/* 1A89CC 8027A0EC C6200040 */  lwc1      $f0, 0x40($s1)
/* 1A89D0 8027A0F0 46001080 */  add.s     $f2, $f2, $f0
/* 1A89D4 8027A0F4 E622004C */  swc1      $f2, 0x4C($s1)
/* 1A89D8 8027A0F8 860201B4 */  lh        $v0, 0x1B4($s0)
/* 1A89DC 8027A0FC 44820000 */  mtc1      $v0, $f0
/* 1A89E0 8027A100 00000000 */  nop
/* 1A89E4 8027A104 46800020 */  cvt.s.w   $f0, $f0
/* 1A89E8 8027A108 4602003C */  c.lt.s    $f0, $f2
/* 1A89EC 8027A10C 00000000 */  nop
/* 1A89F0 8027A110 45000038 */  bc1f      .L8027A1F4
/* 1A89F4 8027A114 00000000 */   nop
/* 1A89F8 8027A118 92020135 */  lbu       $v0, 0x135($s0)
/* 1A89FC 8027A11C 24420001 */  addiu     $v0, $v0, 0x1
/* 1A8A00 8027A120 A2020135 */  sb        $v0, 0x135($s0)
/* 1A8A04 8027A124 AE20004C */  sw        $zero, 0x4C($s1)
/* 1A8A08 8027A128 92020135 */  lbu       $v0, 0x135($s0)
/* 1A8A0C 8027A12C 30420001 */  andi      $v0, $v0, 0x1
/* 1A8A10 8027A130 10400026 */  beqz      $v0, .L8027A1CC
/* 1A8A14 8027A134 00000000 */   nop
/* 1A8A18 8027A138 8E02019C */  lw        $v0, 0x19C($s0)
/* 1A8A1C 8027A13C 1040002D */  beqz      $v0, .L8027A1F4
/* 1A8A20 8027A140 00000000 */   nop
/* 1A8A24 8027A144 C600014C */  lwc1      $f0, 0x14C($s0)
/* 1A8A28 8027A148 E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A8A2C 8027A14C 0809E879 */  j         .L8027A1E4
/* 1A8A30 8027A150 8E04019C */   lw       $a0, 0x19C($s0)
.L8027A154:
/* 1A8A34 8027A154 C622004C */  lwc1      $f2, 0x4C($s1)
/* 1A8A38 8027A158 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 1A8A3C 8027A15C 44810000 */  mtc1      $at, $f0
/* 1A8A40 8027A160 00000000 */  nop
/* 1A8A44 8027A164 46001080 */  add.s     $f2, $f2, $f0
/* 1A8A48 8027A168 E622004C */  swc1      $f2, 0x4C($s1)
/* 1A8A4C 8027A16C 860201B4 */  lh        $v0, 0x1B4($s0)
/* 1A8A50 8027A170 00021023 */  negu      $v0, $v0
/* 1A8A54 8027A174 44820000 */  mtc1      $v0, $f0
/* 1A8A58 8027A178 00000000 */  nop
/* 1A8A5C 8027A17C 46800020 */  cvt.s.w   $f0, $f0
/* 1A8A60 8027A180 4602003E */  c.le.s    $f0, $f2
/* 1A8A64 8027A184 00000000 */  nop
/* 1A8A68 8027A188 4500001A */  bc1f      .L8027A1F4
/* 1A8A6C 8027A18C 00000000 */   nop
/* 1A8A70 8027A190 92020135 */  lbu       $v0, 0x135($s0)
/* 1A8A74 8027A194 24420001 */  addiu     $v0, $v0, 0x1
/* 1A8A78 8027A198 A2020135 */  sb        $v0, 0x135($s0)
/* 1A8A7C 8027A19C AE20004C */  sw        $zero, 0x4C($s1)
/* 1A8A80 8027A1A0 92020135 */  lbu       $v0, 0x135($s0)
/* 1A8A84 8027A1A4 30420001 */  andi      $v0, $v0, 0x1
/* 1A8A88 8027A1A8 10400008 */  beqz      $v0, .L8027A1CC
/* 1A8A8C 8027A1AC 00000000 */   nop
/* 1A8A90 8027A1B0 8E02019C */  lw        $v0, 0x19C($s0)
/* 1A8A94 8027A1B4 1040000F */  beqz      $v0, .L8027A1F4
/* 1A8A98 8027A1B8 00000000 */   nop
/* 1A8A9C 8027A1BC C600014C */  lwc1      $f0, 0x14C($s0)
/* 1A8AA0 8027A1C0 E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A8AA4 8027A1C4 0809E879 */  j         .L8027A1E4
/* 1A8AA8 8027A1C8 8E04019C */   lw       $a0, 0x19C($s0)
.L8027A1CC:
/* 1A8AAC 8027A1CC 8E0201A0 */  lw        $v0, 0x1A0($s0)
/* 1A8AB0 8027A1D0 10400008 */  beqz      $v0, .L8027A1F4
/* 1A8AB4 8027A1D4 00000000 */   nop
/* 1A8AB8 8027A1D8 C600014C */  lwc1      $f0, 0x14C($s0)
/* 1A8ABC 8027A1DC E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A8AC0 8027A1E0 8E0401A0 */  lw        $a0, 0x1A0($s0)
.L8027A1E4:
/* 1A8AC4 8027A1E4 8E060144 */  lw        $a2, 0x144($s0)
/* 1A8AC8 8027A1E8 8E070148 */  lw        $a3, 0x148($s0)
/* 1A8ACC 8027A1EC 0C052757 */  jal       sfx_play_sound_at_position
/* 1A8AD0 8027A1F0 0000282D */   daddu    $a1, $zero, $zero
.L8027A1F4:
/* 1A8AD4 8027A1F4 96220064 */  lhu       $v0, 0x64($s1)
/* 1A8AD8 8027A1F8 2442FFFF */  addiu     $v0, $v0, -0x1
/* 1A8ADC 8027A1FC A6220064 */  sh        $v0, 0x64($s1)
/* 1A8AE0 8027A200 00021400 */  sll       $v0, $v0, 16
/* 1A8AE4 8027A204 1C40000D */  bgtz      $v0, .L8027A23C
/* 1A8AE8 8027A208 0000102D */   daddu    $v0, $zero, $zero
/* 1A8AEC 8027A20C C6200018 */  lwc1      $f0, 0x18($s1)
/* 1A8AF0 8027A210 8E04019C */  lw        $a0, 0x19C($s0)
/* 1A8AF4 8027A214 E6000144 */  swc1      $f0, 0x144($s0)
/* 1A8AF8 8027A218 C6200020 */  lwc1      $f0, 0x20($s1)
/* 1A8AFC 8027A21C 10800006 */  beqz      $a0, .L8027A238
/* 1A8B00 8027A220 E600014C */   swc1     $f0, 0x14C($s0)
/* 1A8B04 8027A224 8E0201A0 */  lw        $v0, 0x1A0($s0)
/* 1A8B08 8027A228 14400004 */  bnez      $v0, .L8027A23C
/* 1A8B0C 8027A22C 24020001 */   addiu    $v0, $zero, 0x1
/* 1A8B10 8027A230 0C0154F0 */  jal       snd_stop_sound
/* 1A8B14 8027A234 00000000 */   nop
.L8027A238:
/* 1A8B18 8027A238 24020001 */  addiu     $v0, $zero, 0x1
.L8027A23C:
/* 1A8B1C 8027A23C 8FBF0024 */  lw        $ra, 0x24($sp)
/* 1A8B20 8027A240 8FB20020 */  lw        $s2, 0x20($sp)
/* 1A8B24 8027A244 8FB1001C */  lw        $s1, 0x1C($sp)
/* 1A8B28 8027A248 8FB00018 */  lw        $s0, 0x18($sp)
/* 1A8B2C 8027A24C D7BA0040 */  ldc1      $f26, 0x40($sp)
/* 1A8B30 8027A250 D7B80038 */  ldc1      $f24, 0x38($sp)
/* 1A8B34 8027A254 D7B60030 */  ldc1      $f22, 0x30($sp)
/* 1A8B38 8027A258 D7B40028 */  ldc1      $f20, 0x28($sp)
/* 1A8B3C 8027A25C 03E00008 */  jr        $ra
/* 1A8B40 8027A260 27BD0048 */   addiu    $sp, $sp, 0x48

### DECOMPILED C INSTRUCTIONS:

ApiStatus RunToGoal(Evt* script, s32 isInitialCall) {
    Bytecode* args = script->ptrReadPos;
    Actor* actor;
    ActorState* actorState;
    s32 actorID;
    f32 posX, posY, posZ;
    f32 goalX, goalY, goalZ;

    if (isInitialCall) {
        script->functionTemp[0] = FALSE;
    }

    if (!script->functionTemp[0]) {
        actorID = evt_get_variable(script, *args++);
        if (actorID == ACTOR_SELF) {
            actorID = script->owner1.enemyID;
        }
        script->functionTempPtr[1] = actor = get_actor(actorID);
        actorState = &actor->state;

        actorState->moveTime = evt_get_variable(script, *args++);
        script->functionTemp[2] = evt_get_variable(script, *args++);

        actorState->currentPos.x = actor->currentPos.x;
        actorState->currentPos.y = actor->currentPos.y;
        actorState->currentPos.z = actor->currentPos.z;

        goalX = actorState->goalPos.x;
        goalY = actorState->goalPos.y;
        goalZ = actorState->goalPos.z;
        posX = actorState->currentPos.x;
        posY = actorState->currentPos.y;
        posZ = actorState->currentPos.z;

        actorState->unk_18.x = goalX;
        actorState->unk_18.y = goalY;
        actorState->unk_18.z = goalZ;

        actorState->angle = atan2(posX, posZ, goalX, goalZ);
        actorState->distance = dist2D(posX, posZ, goalX, goalZ);

        if (actorState->moveTime == 0) {
            actorState->moveTime = actorState->distance / actorState->speed;
            if (actorState->moveTime == 0) {
                actorState->moveTime = 1;
            }
            actorState->speed += (actorState->distance - (actorState->moveTime * actorState->speed)) / actorState->moveTime;
        } else {
            actorState->speed = actorState->distance / actorState->moveTime;
        }

        if (actor->actorTypeData1b[0] >= 0) {
            actorState->distance = actor->actorTypeData1b[0] + 1;
        } else {
            actorState->distance = ~actor->actorTypeData1b[0]; //TODO optimization?
        }
        if ((actor->actorTypeData1[0] != 0) && (actor->actorTypeData1[1] == 0)) {
            sfx_play_sound_at_position(actor->actorTypeData1[0], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z);
        }
        script->functionTemp[0] = TRUE;
    }

    actor = script->functionTempPtr[1];
    actorState = &actor->state;

    add_xz_vec3f(&actorState->currentPos, actorState->speed, actorState->angle);
    if (script->functionTemp[2] == 0) {
        if (actorState->speed < 4.0f) {
            play_movement_dust_effects(0, actorState->currentPos.x, actorState->currentPos.y, actorState->currentPos.z, actorState->angle);
        } else {
            play_movement_dust_effects(1, actorState->currentPos.x, actorState->currentPos.y, actorState->currentPos.z, actorState->angle);
        }
    }
    actor->currentPos.x = actorState->currentPos.x;
    actor->currentPos.z = actorState->currentPos.z;

    if ((actor->actorTypeData1[0] != 0) && (actor->actorTypeData1[1] != 0)) {
        if (actor->actorTypeData1b[0] >= 0) {
            actorState->distance += actorState->speed;
            if (actor->actorTypeData1b[0] < actorState->distance) {
                actor->footStepCounter++;
                actorState->distance = 0.0f;
                if (actor->footStepCounter & 1) {
                    if (actor->actorTypeData1[0] != 0) {
                        sfx_play_sound_at_position(actor->actorTypeData1[0], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z);
                    }
                } else {
                    if (actor->actorTypeData1[1] != 0) {
                        sfx_play_sound_at_position(actor->actorTypeData1[1], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z);
                    }
                }
            }
        } else {
            actorState->distance += 1.0f;
            if (-actor->actorTypeData1b[0] <= actorState->distance) {
                actor->footStepCounter++;
                actorState->distance = 0.0f;
                if (actor->footStepCounter & 1) {
                    if (actor->actorTypeData1[0] != 0) {
                        sfx_play_sound_at_position(actor->actorTypeData1[0], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z);
                    }
                } else {
                    if (actor->actorTypeData1[1] != 0) {
                        sfx_play_sound_at_position(actor->actorTypeData1[1], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z);
                    }
                }
            }
        }
    }

    actorState->moveTime--;
    if (actorState->moveTime > 0) {
        return ApiStatus_BLOCK;
    }

    actor->currentPos.x = actorState->unk_18.x;
    actor->currentPos.z = actorState->unk_18.z;
    if (actor->actorTypeData1[0] != 0) {
        if (actor->actorTypeData1[1] == 0) {
            snd_stop_sound(actor->actorTypeData1[0]);
        }
    }
    return ApiStatus_DONE1;
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_80247508
/* 13A848 80247508 27BDFF40 */  addiu     $sp, $sp, -0xC0
/* 13A84C 8024750C 240A0001 */  addiu     $t2, $zero, 0x1
/* 13A850 80247510 3C028027 */  lui       $v0, %hi(gPauseBadgesCurrentPage)
/* 13A854 80247514 8C420280 */  lw        $v0, %lo(gPauseBadgesCurrentPage)($v0)
/* 13A858 80247518 3C038027 */  lui       $v1, %hi(gPauseBadgesPages)
/* 13A85C 8024751C 24630288 */  addiu     $v1, $v1, %lo(gPauseBadgesPages)
/* 13A860 80247520 AFBF00BC */  sw        $ra, 0xBC($sp)
/* 13A864 80247524 AFBE00B8 */  sw        $fp, 0xB8($sp)
/* 13A868 80247528 AFB700B4 */  sw        $s7, 0xB4($sp)
D_8024752C:
/* 13A86C 8024752C AFB600B0 */  sw        $s6, 0xB0($sp)
/* 13A870 80247530 AFB500AC */  sw        $s5, 0xAC($sp)
/* 13A874 80247534 AFB400A8 */  sw        $s4, 0xA8($sp)
.L80247538:
/* 13A878 80247538 AFB300A4 */  sw        $s3, 0xA4($sp)
/* 13A87C 8024753C AFB200A0 */  sw        $s2, 0xA0($sp)
/* 13A880 80247540 AFB1009C */  sw        $s1, 0x9C($sp)
/* 13A884 80247544 AFB00098 */  sw        $s0, 0x98($sp)

### DECOMPILED C INSTRUCTIONS:

void pause_badges_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
    s32 pageIndex, i;
    s32 badgeIndex;
    s32 currentBadgeRow;
    s32 currentBadgeColumn;
    s32 style;
    s32 palette;
    s32 bpAvailable;
    s32 costBP;
    s32 canBeEquipped;
    PauseItemPage* page;
    s32 badgeListX;
    s32 badgeListY;
    s32 isEquipped;
    s32 isNone;
    s32 cannotBeEquipped;
    s32 x1, y1, x2, y2;
    s16 badgeID;
    s32 isSelected;
    s32 badgeEntryOffsetX, badgeEntryOffsetY;
    s32 posX, posY, cursorOffsetX, cursorOffsetY, selectedPosX, selectedPosY;
    s32 orbOffsetY;
    s32 numOrbs;
    s32 orbY, orbX;
    s32 bpAmount;
    s32 bpAvailOffsetX;
    s32 bpAvailOffsetY;
    f32 orbBlinkValue;
    s32 orbBlinkOpacity;
    s32 orbColorR, orbColorG, orbColorB;
    s32 orbColorR1, orbColorG1, orbColorB1;
    s32 badgeIconElement;
    s32 msg;
    s32 msgX, msgY;
    s32 msgOpacity;
    s32 maxBP;
    s32 itemIndex, j;
    s16* equippedBadges;
    s32 itemID;
    s32 orbIndex;
    s32* iconIDs;
    PlayerData* playerData = &gPlayerData;
    PauseItemPage* currentPage = &gPauseBadgesPages[gPauseBadgesCurrentPage];

    costBP = 0;
    canBeEquipped = FALSE;
    style = DRAW_MSG_STYLE_MENU;
    bpAvailable = gPlayerData.maxBP - pause_get_total_equipped_bp_cost();
    currentBadgeColumn = gPauseBadgesSelectedIndex / currentPage->numCols;
    currentBadgeRow = gPauseBadgesSelectedIndex % currentPage->numCols;

    draw_box(DRAW_FLAG_NO_CLIP, &gPauseWS_15, baseX + 84, baseY, 0, width - 84, height, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0);
    hud_element_set_render_pos(gPauseBadgesIconIDs[20], baseX + 241, baseY + 11);
    palette = MSG_PAL_STANDARD;
    hud_element_draw_without_clipping(gPauseBadgesIconIDs[20]);

    x1 = baseX + 1;
    y1 = baseY + 14;
    x2 = baseX + width - 1;
    y2 = baseY + height - 9;

    if (x1 <= 0) {
        x1 = 1;
    }
    if (y1 <= 0) {
        y1 = 1;
    }

    if (x2 <= 0 || y2 <= 0 || x1 >= SCREEN_WIDTH - 1 || y1 >= SCREEN_HEIGHT - 1) {
        return;
    }

    if (x2 >= SCREEN_WIDTH - 1) {
        x2 = SCREEN_WIDTH - 1;
    }
    if (y2 >= SCREEN_HEIGHT - 1) {
        y2 = SCREEN_HEIGHT - 1;
    }
    gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, x1, y1, x2, y2);

    badgeIndex = 0;
    for (i = 0; i < 3; i++) {
        for (pageIndex = 0; pageIndex < 20; pageIndex++) {
            iconIDs = gPauseBadgesIconIDs;
            badgeListX = baseX + 119;
            badgeListY = baseY + 17;

            page = &gPauseBadgesPages[pageIndex];
            if (!page->enabled) {
                break;
            }

            pause_badges_get_pos_y(pageIndex, 0);

            for (itemIndex = 0; itemIndex < page->count; itemIndex++) {
                badgeID = gPauseBadgesItemIds[page->startIndex + itemIndex];
                isEquipped = FALSE;
                isSelected = FALSE;
                equippedBadges = gPlayerData.equippedBadges;
                cannotBeEquipped = FALSE;
                if (badgeID == BADGE_INVALID) {
                    continue;
                }

                posX = pause_badges_get_pos_x(pageIndex, itemIndex);
                posY = pause_badges_get_pos_y(pageIndex, itemIndex);
                isNone = badgeID == BADGE_NONE_STANDIN;

                for (j = 0; j < 64; equippedBadges++, j++) {
                    if (badgeID == *equippedBadges) {
                        isEquipped = TRUE;
                        break;
                    }
                }

                if (gPauseMenuCurrentTab == 2 &&
                    gPauseBadgesLevel == 1 &&
                    pause_badges_get_column(pageIndex, itemIndex) == currentBadgeRow &&
                    pause_badges_get_row(pageIndex, itemIndex) == currentBadgeColumn) {
                    itemID = badgeID;
                    isSelected = TRUE;
                    if (!isNone) {
                        costBP = gMoveTable[gItemTable[itemID].moveID].costBP;
                        if (!isEquipped && bpAvailable >= costBP) {
                            canBeEquipped = TRUE;
                        }
                    }
                }

                if (!isNone && bpAvailable < gMoveTable[gItemTable[badgeID].moveID].costBP) {
                    cannotBeEquipped = TRUE;
                }

                badgeEntryOffsetX = 0;
                badgeEntryOffsetY = 0;
                if (isSelected) {
                    badgeEntryOffsetX = -1;
                    badgeEntryOffsetY = -1;
                }

                if (i == 0) {
                    style = DRAW_MSG_STYLE_MENU;
                    palette = MSG_PAL_STANDARD;
                    if (isSelected) {
                        style = DRAW_MSG_STYLE_MENU | DRAW_MSG_STYLE_DROP_SHADOW;
                    }

                    if (isEquipped) {
                        draw_box(DRAW_FLAG_NO_CLIP, &gPauseWS_14, badgeListX + pause_badges_scroll_offset_x(posX) - 20,
                                baseY + pause_badges_scroll_offset_y(posY) + 17, 0, 200, 13, 255, 0, 0, 0, 0, 0,
                                0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0);
                    } else if (cannotBeEquipped) {
                        palette = MSG_PAL_0B;
                    }
                }

                if (!pause_badges_is_visible(posY)) {
                    continue;
                }

                if (i == 0) {
                    if (isNone) {
                        draw_msg(pause_get_menu_msg(PAUSE_MSG_NO_BADGE), badgeListX + pause_badges_scroll_offset_x(posX) + badgeEntryOffsetX,
                                badgeListY + pause_badges_scroll_offset_y(posY) + badgeEntryOffsetY, 255, palette, style);
                    } else {
                        if (gItemTable[badgeID].nameMsg) {
                            if (gItemTable[badgeID].nameMsg > 0) {
                                draw_msg(gItemTable[badgeID].nameMsg, badgeListX + pause_badges_scroll_offset_x(posX) + badgeEntryOffsetX,
                                        badgeListY + pause_badges_scroll_offset_y(posY) + badgeEntryOffsetY, 255, palette, style);
                            }
                        }
                        draw_number(gMoveTable[gItemTable[badgeID].moveID].costBP, baseX + 235 + pause_badges_scroll_offset_x(posX),
                                    baseY + 17 + pause_badges_scroll_offset_y(posY), DRAW_NUMBER_CHARSET_THIN, palette, 255, DRAW_NUMBER_STYLE_ALIGN_RIGHT | DRAW_NUMBER_STYLE_MONOSPACE);
                    }
                }

                if (i == 1) {
                    badgeIconElement = iconIDs[badgeIndex];
                    hud_element_clear_flags(badgeIconElement, HUD_ELEMENT_FLAG_DROP_SHADOW);
                    hud_element_set_flags(badgeIconElement, HUD_ELEMENT_FLAG_FILTER_TEX);
                    if (isNone) {
                        badgeIconElement = gPauseBadgesIconIDs[21];
                    } else {
                        if (isSelected) {
                            hud_element_set_flags(badgeIconElement, HUD_ELEMENT_FLAG_DROP_SHADOW);
                            gPauseCurrentDescIconScript = gItemHudScripts[gItemTable[badgeID].hudElemID].enabled;
                        }

                        if (!isEquipped && cannotBeEquipped) {
                            hud_element_set_script(badgeIconElement, gItemHudScripts[gItemTable[badgeID].hudElemID].disabled);
                        } else {
                            hud_element_set_script(badgeIconElement, gItemHudScripts[gItemTable[badgeID].hudElemID].enabled);
                        }

                        hud_element_set_scale(badgeIconElement, 0.670816f);
                    }

                    hud_element_set_render_pos(badgeIconElement, baseX + 107 + pause_badges_scroll_offset_x(posX) + badgeEntryOffsetX,
                                                baseY + 23 + pause_badges_scroll_offset_y(posY) + badgeEntryOffsetY);
                    if (badgeIndex == 0) {
                        hud_element_draw_without_clipping(badgeIconElement);
                    } else {
                        hud_element_draw_next(badgeIconElement);
                    }

                    badgeIndex++;
                }

                if (i == 2 && !isNone) {
                    numOrbs = gMoveTable[gItemTable[badgeID].moveID].costBP;
                    orbOffsetY = 1;
                    if (numOrbs < 11) {
                        orbOffsetY = 4;
                    }

                    orbColorR1 = 0;
                    orbColorG1 = 255;
                    orbColorB1 = 100;

                    gSPDisplayList(gMainGfxPos++, gPauseDLOrbs);
                    gDPSetTextureFilter(gMainGfxPos++, G_TF_BILERP);

                    if (isEquipped == 0) {
                        for (j = 0; j < numOrbs; j++) {
                            gDPSetPrimColor(gMainGfxPos++, 0, 0, 227, 227, 227, 255);
                            orbX = baseX + 235 + pause_badges_scroll_offset_x(posX) + 1 + (j % 5) * 6;
                            orbY = baseY + 17 + pause_badges_scroll_offset_y(posY) + orbOffsetY;
                            if (numOrbs >= 5) {
                                orbY += j / 5 * 6 - 3;
                            }
                            pause_badges_draw_bp_orbs(0, orbX, orbY);
                        }

                        gDPPipeSync(gMainGfxPos++);
                        gDPSetRenderMode(gMainGfxPos++, G_RM_CLD_SURF, G_RM_CLD_SURF2);
                        gDPSetPrimColor(gMainGfxPos++, 0, 0, orbColorR1, orbColorG1, orbColorB1, 128);

                        for (j = 0; j < numOrbs; j++) {
                            if (j < bpAvailable) {
                                orbX = baseX + 235 + pause_badges_scroll_offset_x(posX) + 1 + (j % 5) * 6;
                                orbY = baseY + 17 + pause_badges_scroll_offset_y(posY) + orbOffsetY;
                                if (numOrbs >= 5) {
                                    orbY += j / 5 * 6 - 3;
                                }
                                pause_badges_draw_bp_orbs(1, orbX, orbY);
                            }
                        }
                    } else {
                        gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 255, 100, 255);
                        for (j = 0; j < numOrbs; j++) {
                            orbX = baseX + 235 + pause_badges_scroll_offset_x(posX) + 1 + (j % 5) * 6;
                            orbY = baseY + 17 + pause_badges_scroll_offset_y(posY) + orbOffsetY;
                            if (numOrbs >= 5) {
                                orbY += j / 5 * 6 - 3;
                            }
                            pause_badges_draw_bp_orbs(2, orbX, orbY);
                        }
                        gDPPipeSync(gMainGfxPos++);
                    }
                }
            }
        }
    }

    x1 = baseX + 1;
    y1 = baseY + 1;
    x2 = baseX + width - 1;
    y2 = baseY + height - 1;
    gDPPipeSync(gMainGfxPos++);

    if (x1 <= 0) {
        x1 = 1;
    }
    if (y1 <= 0) {
        y1 = 1;
    }

    if (x2 <= 0 || y2 <= 0 || x1 >= SCREEN_WIDTH - 1 || y1 >= SCREEN_HEIGHT - 1) {
        return;
    }

    if (x2 >= SCREEN_WIDTH - 1) {
        x2 = SCREEN_WIDTH - 1;
    }
    if (y2 >= SCREEN_HEIGHT - 1) {
        y2 = SCREEN_HEIGHT - 1;
    }

    gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, x1, y1, x2, y2);

    if (gPauseMenuCurrentTab == 2 && gPauseBadgesLevel == 1) {
        if (gPauseBadgesCurrentPage > 0) {
            hud_element_set_render_pos(gPauseBadgesIconIDs[17], baseX + 278, baseY + 14);
            hud_element_draw_without_clipping(gPauseBadgesIconIDs[17]);
        }

        if (gPauseBadgesPages[gPauseBadgesCurrentPage + 1].enabled) {
            hud_element_set_render_pos(gPauseBadgesIconIDs[18], baseX + 278, baseY + 146);
            hud_element_draw_without_clipping(gPauseBadgesIconIDs[18]);
        }
    }

    hud_element_set_render_pos(gPauseBadgesIconIDs[16], baseX + OFFSET_1_X, baseY + OFFSET_1_Y);
    hud_element_draw_without_clipping(gPauseBadgesIconIDs[16]);
    draw_msg(pause_get_menu_msg(PAUSE_MSG_BADGE_BP), baseX + OFFSET_2_X, baseY + 74, 255, MSG_PAL_STANDARD, DRAW_MSG_STYLE_MENU);
    draw_number(playerData->maxBP, baseX + OFFSET_3_X, baseY + OFFSET_3_Y, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_STANDARD, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT);
    bpAmount = playerData->maxBP - pause_get_total_equipped_bp_cost();
    bpAvailOffsetX = 0;
    bpAvailOffsetY = (playerData->maxBP - 1) / 10 * 8;
    if (bpAmount < 10) {
        bpAvailOffsetX = -4;
    }
    pause_draw_menu_label(PAUSE_LBL_AVAILABLE, baseX + 12, baseY + 100 + bpAvailOffsetY);
    draw_number(bpAmount, baseX + 73 + bpAvailOffsetX, baseY + 100 + bpAvailOffsetY, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_STANDARD, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT);

    orbColorR = 0;
    orbColorG = 255;
    orbColorB = 100;
    maxBP = playerData->maxBP;
    gSPDisplayList(gMainGfxPos++, gPauseDLOrbs);
    gDPSetTextureFilter(gMainGfxPos++, G_TF_BILERP);
    for (orbIndex = 0; orbIndex < maxBP; orbIndex++) {
        gDPSetPrimColor(gMainGfxPos++, 0, 0, 227, 227, 227, 255);
        pause_badges_draw_bp_orbs(0, baseX + 11 + (orbIndex % 10) * 6, baseY + 92 + (orbIndex / 10) * 8);
    }

    gDPPipeSync(gMainGfxPos++);
    if (canBeEquipped) {
        gDPSetPrimColor(gMainGfxPos++, 0, 0, orbColorR, orbColorG, orbColorB, 255);
        for (orbIndex = 0; orbIndex < bpAvailable - costBP; orbIndex++) {
            pause_badges_draw_bp_orbs(2, baseX + 11 +(orbIndex % 10) * 6, baseY + 92 + (orbIndex / 10) * 8);
        }

        gDPPipeSync(gMainGfxPos++);
        orbBlinkValue = (sin_deg(gGameStatusPtr->frameCounter * 15) + 1.0f) * 0.2 + 0.5;
        gDPSetRenderMode(gMainGfxPos++, G_RM_CLD_SURF, G_RM_CLD_SURF2);

        orbBlinkOpacity = orbBlinkValue * 255.0f;
        gDPSetPrimColor(gMainGfxPos++, 0, 0, orbColorR, orbColorG, orbColorB, orbBlinkOpacity);

        for (orbIndex = bpAvailable - costBP; orbIndex < bpAvailable; orbIndex++) {
            pause_badges_draw_bp_orbs(2, baseX + 11 +(orbIndex % 10) * 6, baseY + 92 + (orbIndex / 10) * 8);
        }
        gDPPipeSync(gMainGfxPos++);
    } else {
        gDPSetPrimColor(gMainGfxPos++, 0, 0, orbColorR, orbColorG, orbColorB, 255);
        for (orbIndex = 0; orbIndex < bpAvailable; orbIndex++) {
            pause_badges_draw_bp_orbs(2, baseX + 11 + (orbIndex % 10) * 6, baseY + 92 + (orbIndex / 10) * 8);
        }
        gDPPipeSync(gMainGfxPos++);
    }

    draw_box(DRAW_FLAG_NO_CLIP, &gPauseWS_13, gPauseBadgesCurrentTab == 0 ? baseX + 9 : baseX, baseY + 7, 0,
         91, 34, 255, gPauseBadgesCurrentTab == 1 ? 128 : 0, 0, 0,
         0, 0, 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0);

    msg = pause_get_menu_msg(PAUSE_MSG_ALL_BADGES);
    msgX = baseX + 10;
    if (gPauseBadgesCurrentTab == 0) {
        msgX = baseX + 19;
    }
    msgOpacity = 255;
    msgY = baseY + 17;
    if (gPauseBadgesCurrentTab == 1) {
        msgOpacity = 191;
    }
    draw_msg(msg, msgX, msgY, msgOpacity, MSG_PAL_WHITE, DRAW_MSG_STYLE_MENU);

    draw_box(DRAW_FLAG_NO_CLIP, &gPauseWS_13, gPauseBadgesCurrentTab == 1 ? baseX + 9 : baseX, baseY + 37, 0, 91, 34, 255,
            gPauseBadgesCurrentTab == 0 ? 128 : 0, 0, 0, 0, 0, 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0);

    msg = pause_get_menu_msg(PAUSE_MSG_ACTIVE);
    msgX = baseX + 12;
    if (gPauseBadgesCurrentTab == 1) {
        msgX = baseX + 21;
    }
    msgY = baseY + 42;
    msgOpacity = 255;
    if (gPauseBadgesCurrentTab == 0) {
        msgOpacity = 191;
    }
    draw_msg(msg, msgX, msgY, msgOpacity, MSG_PAL_WHITE, DRAW_MSG_STYLE_MENU);

    msg = pause_get_menu_msg(PAUSE_MSG_BADGES);
    msgX = baseX + 26;
    if (gPauseBadgesCurrentTab == 1) {
        msgX = baseX + 35;
    }
    msgY = baseY + 52;
    msgOpacity = 255;
    if (gPauseBadgesCurrentTab == 0) {
        msgOpacity = 191;
    }
    draw_msg(msg, msgX, msgY, msgOpacity, MSG_PAL_WHITE, DRAW_MSG_STYLE_MENU);

    if (gPauseMenuCurrentTab == 2) {
         if (gPauseBadgesLevel == 0) {
             pause_set_cursor_pos(32, baseX + 10, baseY + 26 + gPauseBadgesCurrentTab * 32);
         } else {
             selectedPosX = pause_badges_get_pos_x(gPauseBadgesCurrentPage, gPauseBadgesSelectedIndex - gPauseBadgesPages[gPauseBadgesCurrentPage].listStart * gPauseBadgesPages[gPauseBadgesCurrentPage].numCols);
             selectedPosY = pause_badges_get_pos_y(gPauseBadgesCurrentPage, gPauseBadgesSelectedIndex - gPauseBadgesPages[gPauseBadgesCurrentPage].listStart * gPauseBadgesPages[gPauseBadgesCurrentPage].numCols);
             cursorOffsetX = pause_badges_scroll_offset_x(selectedPosX);
             cursorOffsetY = pause_badges_scroll_offset_y(selectedPosY);
             if (cursorOffsetY < 0) {
                 cursorOffsetY = 0;
             } else if (cursorOffsetY > 112) {
                 cursorOffsetY = 112;
             }

             if (gPauseBadgesCurrentScrollPos != gPauseBadgesTargetScrollPos) {
                 pause_set_cursor_pos_immediate(WINDOW_ID_PAUSE_BADGES, baseX + 93 + cursorOffsetX, baseY + 23 + cursorOffsetY);
             } else {
                 pause_set_cursor_pos(WINDOW_ID_PAUSE_BADGES, baseX + 93 + cursorOffsetX, baseY + 23 + cursorOffsetY);
             }
         }
    }

    if (gPauseBadgesShowNotEnoughBP != 0) {
        pause_set_cursor_opacity(0);
        if (gPauseBadgesShowNotEnoughBP == 1) {
            draw_box(DRAW_FLAG_NO_CLIP, &gPauseWS_13, baseX + 67, baseY + 60, 0, 137, 26, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0);
            draw_msg(pause_get_menu_msg(PAUSE_MSG_NOT_ENOUGH_BP), baseX + 86, baseY + 66, 255, MSG_PAL_WHITE, DRAW_MSG_STYLE_MENU);
        } else {
            draw_box(DRAW_FLAG_NO_CLIP, &gPauseWS_13, baseX + 67, baseY + 60, 0, 173, 26, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0);
            draw_msg(pause_get_menu_msg(PAUSE_MSG_DONT_WEAR_MORE), baseX + 90, baseY + 66, 255, MSG_PAL_WHITE, DRAW_MSG_STYLE_MENU);
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel fire_breath_appendGfx
/* 372EF4 E006E764 27BDFF30 */  addiu     $sp, $sp, -0xD0
/* 372EF8 E006E768 3C07DB06 */  lui       $a3, (0xDB060024 >> 16)
/* 372EFC E006E76C AFB500B4 */  sw        $s5, 0xB4($sp)
/* 372F00 E006E770 3C15800A */  lui       $s5, %hi(gMainGfxPos)
/* 372F04 E006E774 26B5A66C */  addiu     $s5, $s5, %lo(gMainGfxPos)
/* 372F08 E006E778 AFBF00C4 */  sw        $ra, 0xC4($sp)
/* 372F0C E006E77C AFBE00C0 */  sw        $fp, 0xC0($sp)
/* 372F10 E006E780 AFB700BC */  sw        $s7, 0xBC($sp)
/* 372F14 E006E784 AFB600B8 */  sw        $s6, 0xB8($sp)
/* 372F18 E006E788 AFB400B0 */  sw        $s4, 0xB0($sp)
/* 372F1C E006E78C AFB300AC */  sw        $s3, 0xAC($sp)
/* 372F20 E006E790 AFB200A8 */  sw        $s2, 0xA8($sp)
/* 372F24 E006E794 AFB100A4 */  sw        $s1, 0xA4($sp)
/* 372F28 E006E798 AFB000A0 */  sw        $s0, 0xA0($sp)
/* 372F2C E006E79C F7B400C8 */  sdc1      $f20, 0xC8($sp)
/* 372F30 E006E7A0 8EA50000 */  lw        $a1, 0x0($s5)
/* 372F34 E006E7A4 8C94000C */  lw        $s4, 0xC($a0)
/* 372F38 E006E7A8 00A0182D */  daddu     $v1, $a1, $zero
/* 372F3C E006E7AC 24A50008 */  addiu     $a1, $a1, 0x8
/* 372F40 E006E7B0 AEA50000 */  sw        $a1, 0x0($s5)
/* 372F44 E006E7B4 8E860000 */  lw        $a2, 0x0($s4)
/* 372F48 E006E7B8 24A20008 */  addiu     $v0, $a1, 0x8
/* 372F4C E006E7BC AEA20000 */  sw        $v0, 0x0($s5)
/* 372F50 E006E7C0 C682005C */  lwc1      $f2, 0x5C($s4)
/* 372F54 E006E7C4 00061080 */  sll       $v0, $a2, 2
/* 372F58 E006E7C8 3C0CE007 */  lui       $t4, (0xE0070000 >> 16)
/* 372F5C E006E7CC 01826021 */  addu      $t4, $t4, $v0
/* 372F60 E006E7D0 8D8CEC00 */  lw        $t4, -0x1400($t4)
/* 372F64 E006E7D4 34E70024 */  ori       $a3, $a3, (0xDB060024 & 0xFFFF)
/* 372F68 E006E7D8 AFAC0098 */  sw        $t4, 0x98($sp)
/* 372F6C E006E7DC 3C17E007 */  lui       $s7, (0xE0070000 >> 16)
/* 372F70 E006E7E0 02E2B821 */  addu      $s7, $s7, $v0
/* 372F74 E006E7E4 8EF7EC0C */  lw        $s7, -0x13F4($s7)
/* 372F78 E006E7E8 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 372F7C E006E7EC 4600110D */  trunc.w.s $f4, $f2
/* 372F80 E006E7F0 44162000 */  mfc1      $s6, $f4
/* 372F84 E006E7F4 00000000 */  nop
/* 372F88 E006E7F8 44960000 */  mtc1      $s6, $f0
/* 372F8C E006E7FC 00000000 */  nop
/* 372F90 E006E800 46800020 */  cvt.s.w   $f0, $f0
/* 372F94 E006E804 46001081 */  sub.s     $f2, $f2, $f0
/* 372F98 E006E808 AC620000 */  sw        $v0, 0x0($v1)
/* 372F9C E006E80C AC600004 */  sw        $zero, 0x4($v1)
/* 372FA0 E006E810 ACA70000 */  sw        $a3, 0x0($a1)
/* 372FA4 E006E814 8C820010 */  lw        $v0, 0x10($a0)
/* 372FA8 E006E818 3C014380 */  lui       $at, (0x43800000 >> 16)
/* 372FAC E006E81C 44810000 */  mtc1      $at, $f0
/* 372FB0 E006E820 8C42001C */  lw        $v0, 0x1C($v0)
/* 372FB4 E006E824 46001082 */  mul.s     $f2, $f2, $f0
/* 372FB8 E006E828 00000000 */  nop
/* 372FBC E006E82C 3C038000 */  lui       $v1, (0x80000000 >> 16)
/* 372FC0 E006E830 00431021 */  addu      $v0, $v0, $v1
/* 372FC4 E006E834 ACA20004 */  sw        $v0, 0x4($a1)
/* 372FC8 E006E838 24020001 */  addiu     $v0, $zero, 0x1
/* 372FCC E006E83C 4600110D */  trunc.w.s $f4, $f2
/* 372FD0 E006E840 441E2000 */  mfc1      $fp, $f4
/* 372FD4 E006E844 14C20051 */  bne       $a2, $v0, .LE006E98C
/* 372FD8 E006E848 3C0B0100 */   lui      $t3, (0x1000080 >> 16)
/* 372FDC E006E84C 27A40018 */  addiu     $a0, $sp, 0x18
/* 372FE0 E006E850 3C120001 */  lui       $s2, (0x11630 >> 16)
/* 372FE4 E006E854 8E850018 */  lw        $a1, 0x18($s4)
/* 372FE8 E006E858 8E86001C */  lw        $a2, 0x1C($s4)
/* 372FEC E006E85C 8E870020 */  lw        $a3, 0x20($s4)
/* 372FF0 E006E860 0C080108 */  jal       shim_guTranslateF
/* 372FF4 E006E864 36521630 */   ori      $s2, $s2, (0x11630 & 0xFFFF)
/* 372FF8 E006E868 27B00058 */  addiu     $s0, $sp, 0x58
/* 372FFC E006E86C 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 373000 E006E870 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 373004 E006E874 44800000 */  mtc1      $zero, $f0
/* 373008 E006E878 00031080 */  sll       $v0, $v1, 2
/* 37300C E006E87C 00431021 */  addu      $v0, $v0, $v1
/* 373010 E006E880 00021080 */  sll       $v0, $v0, 2
/* 373014 E006E884 00431023 */  subu      $v0, $v0, $v1
/* 373018 E006E888 000218C0 */  sll       $v1, $v0, 3
/* 37301C E006E88C 00431021 */  addu      $v0, $v0, $v1
/* 373020 E006E890 000210C0 */  sll       $v0, $v0, 3
/* 373024 E006E894 44060000 */  mfc1      $a2, $f0
/* 373028 E006E898 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 37302C E006E89C 00220821 */  addu      $at, $at, $v0
/* 373030 E006E8A0 C4201DEC */  lwc1      $f0, %lo(gCameras + 0x6C)($at)
/* 373034 E006E8A4 3C073F80 */  lui       $a3, (0x3F800000 >> 16)
/* 373038 E006E8A8 46000007 */  neg.s     $f0, $f0
/* 37303C E006E8AC 44050000 */  mfc1      $a1, $f0
/* 373040 E006E8B0 0200202D */  daddu     $a0, $s0, $zero
/* 373044 E006E8B4 0C080104 */  jal       shim_guRotateF
/* 373048 E006E8B8 AFA60010 */   sw       $a2, 0x10($sp)
/* 37304C E006E8BC 0200202D */  daddu     $a0, $s0, $zero
/* 373050 E006E8C0 27A50018 */  addiu     $a1, $sp, 0x18
/* 373054 E006E8C4 0C080114 */  jal       shim_guMtxCatF
/* 373058 E006E8C8 00A0302D */   daddu    $a2, $a1, $zero
/* 37305C E006E8CC 27A40018 */  addiu     $a0, $sp, 0x18
/* 373060 E006E8D0 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* 373064 E006E8D4 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* 373068 E006E8D8 3C11800A */  lui       $s1, %hi(gDisplayContext)
/* 37306C E006E8DC 2631A674 */  addiu     $s1, $s1, %lo(gDisplayContext)
/* 373070 E006E8E0 96050000 */  lhu       $a1, 0x0($s0)
/* 373074 E006E8E4 8E220000 */  lw        $v0, 0x0($s1)
/* 373078 E006E8E8 00052980 */  sll       $a1, $a1, 6
/* 37307C E006E8EC 00B22821 */  addu      $a1, $a1, $s2
/* 373080 E006E8F0 0C080118 */  jal       shim_guMtxF2L
/* 373084 E006E8F4 00452821 */   addu     $a1, $v0, $a1
/* 373088 E006E8F8 3C03DA38 */  lui       $v1, (0xDA380002 >> 16)
/* 37308C E006E8FC 34630002 */  ori       $v1, $v1, (0xDA380002 & 0xFFFF)
/* 373090 E006E900 3C06D838 */  lui       $a2, (0xD8380002 >> 16)
/* 373094 E006E904 34C60002 */  ori       $a2, $a2, (0xD8380002 & 0xFFFF)
/* 373098 E006E908 8EA40000 */  lw        $a0, 0x0($s5)
/* 37309C E006E90C 96020000 */  lhu       $v0, 0x0($s0)
/* 3730A0 E006E910 0080282D */  daddu     $a1, $a0, $zero
/* 3730A4 E006E914 24840008 */  addiu     $a0, $a0, 0x8
/* 3730A8 E006E918 AEA40000 */  sw        $a0, 0x0($s5)
/* 3730AC E006E91C ACA30000 */  sw        $v1, 0x0($a1)
/* 3730B0 E006E920 24430001 */  addiu     $v1, $v0, 0x1
/* 3730B4 E006E924 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 3730B8 E006E928 00021180 */  sll       $v0, $v0, 6
/* 3730BC E006E92C A6030000 */  sh        $v1, 0x0($s0)
/* 3730C0 E006E930 8E230000 */  lw        $v1, 0x0($s1)
/* 3730C4 E006E934 00521021 */  addu      $v0, $v0, $s2
/* 3730C8 E006E938 00621821 */  addu      $v1, $v1, $v0
/* 3730CC E006E93C 24820008 */  addiu     $v0, $a0, 0x8
/* 3730D0 E006E940 ACA30004 */  sw        $v1, 0x4($a1)
/* 3730D4 E006E944 3C03DE00 */  lui       $v1, (0xDE000000 >> 16)
/* 3730D8 E006E948 AEA20000 */  sw        $v0, 0x0($s5)
/* 3730DC E006E94C 3C020900 */  lui       $v0, %hi(D_09000C20_415C80)
/* 3730E0 E006E950 24420C20 */  addiu     $v0, $v0, %lo(D_09000C20_415C80)
/* 3730E4 E006E954 AC820004 */  sw        $v0, 0x4($a0)
/* 3730E8 E006E958 24820010 */  addiu     $v0, $a0, 0x10
/* 3730EC E006E95C AC830000 */  sw        $v1, 0x0($a0)
/* 3730F0 E006E960 AEA20000 */  sw        $v0, 0x0($s5)
/* 3730F4 E006E964 3C020900 */  lui       $v0, %hi(D_09000C00_415C60)
/* 3730F8 E006E968 24420C00 */  addiu     $v0, $v0, %lo(D_09000C00_415C60)
/* 3730FC E006E96C AC82000C */  sw        $v0, 0xC($a0)
/* 373100 E006E970 24820018 */  addiu     $v0, $a0, 0x18
/* 373104 E006E974 AC830008 */  sw        $v1, 0x8($a0)
/* 373108 E006E978 AEA20000 */  sw        $v0, 0x0($s5)
/* 37310C E006E97C 24020040 */  addiu     $v0, $zero, 0x40
/* 373110 E006E980 AC860010 */  sw        $a2, 0x10($a0)
/* 373114 E006E984 AC820014 */  sw        $v0, 0x14($a0)
/* 373118 E006E988 3C0B0100 */  lui       $t3, (0x1000080 >> 16)
.LE006E98C:
/* 37311C E006E98C 356B0080 */  ori       $t3, $t3, (0x1000080 & 0xFFFF)
/* 373120 E006E990 27A40018 */  addiu     $a0, $sp, 0x18
/* 373124 E006E994 3C130001 */  lui       $s3, (0x11630 >> 16)
/* 373128 E006E998 3C12DE00 */  lui       $s2, (0xDE000000 >> 16)
/* 37312C E006E99C 8EA60000 */  lw        $a2, 0x0($s5)
/* 373130 E006E9A0 3C0AF200 */  lui       $t2, (0xF2000000 >> 16)
/* 373134 E006E9A4 00C0102D */  daddu     $v0, $a2, $zero
/* 373138 E006E9A8 24C60008 */  addiu     $a2, $a2, 0x8
/* 37313C E006E9AC AEA60000 */  sw        $a2, 0x0($s5)
/* 373140 E006E9B0 AC520000 */  sw        $s2, 0x0($v0)
/* 373144 E006E9B4 AC570004 */  sw        $s7, 0x4($v0)
/* 373148 E006E9B8 24C20008 */  addiu     $v0, $a2, 0x8
/* 37314C E006E9BC AEA20000 */  sw        $v0, 0x0($s5)
/* 373150 E006E9C0 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 373154 E006E9C4 ACC20000 */  sw        $v0, 0x0($a2)
/* 373158 E006E9C8 92820067 */  lbu       $v0, 0x67($s4)
/* 37315C E006E9CC 9285006B */  lbu       $a1, 0x6B($s4)
/* 373160 E006E9D0 9287006F */  lbu       $a3, 0x6F($s4)
/* 373164 E006E9D4 92880043 */  lbu       $t0, 0x43($s4)
/* 373168 E006E9D8 24C30010 */  addiu     $v1, $a2, 0x10
/* 37316C E006E9DC AEA30000 */  sw        $v1, 0x0($s5)
/* 373170 E006E9E0 3C03FB00 */  lui       $v1, (0xFB000000 >> 16)
/* 373174 E006E9E4 ACC30008 */  sw        $v1, 0x8($a2)
/* 373178 E006E9E8 00161940 */  sll       $v1, $s6, 5
/* 37317C E006E9EC 00021600 */  sll       $v0, $v0, 24
/* 373180 E006E9F0 00052C00 */  sll       $a1, $a1, 16
/* 373184 E006E9F4 00451025 */  or        $v0, $v0, $a1
/* 373188 E006E9F8 00073A00 */  sll       $a3, $a3, 8
/* 37318C E006E9FC 00471025 */  or        $v0, $v0, $a3
/* 373190 E006EA00 00481025 */  or        $v0, $v0, $t0
/* 373194 E006EA04 ACC20004 */  sw        $v0, 0x4($a2)
/* 373198 E006EA08 92870073 */  lbu       $a3, 0x73($s4)
/* 37319C E006EA0C 92880077 */  lbu       $t0, 0x77($s4)
/* 3731A0 E006EA10 9289007B */  lbu       $t1, 0x7B($s4)
/* 3731A4 E006EA14 24C20018 */  addiu     $v0, $a2, 0x18
/* 3731A8 E006EA18 AEA20000 */  sw        $v0, 0x0($s5)
/* 3731AC E006EA1C 001611C0 */  sll       $v0, $s6, 7
/* 3731B0 E006EA20 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3731B4 E006EA24 00021300 */  sll       $v0, $v0, 12
/* 3731B8 E006EA28 004A1025 */  or        $v0, $v0, $t2
/* 3731BC E006EA2C ACC20010 */  sw        $v0, 0x10($a2)
/* 3731C0 E006EA30 24620020 */  addiu     $v0, $v1, 0x20
/* 3731C4 E006EA34 00021080 */  sll       $v0, $v0, 2
/* 3731C8 E006EA38 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3731CC E006EA3C 00021300 */  sll       $v0, $v0, 12
/* 3731D0 E006EA40 34450080 */  ori       $a1, $v0, 0x80
/* 3731D4 E006EA44 ACC50014 */  sw        $a1, 0x14($a2)
/* 3731D8 E006EA48 24C50020 */  addiu     $a1, $a2, 0x20
/* 3731DC E006EA4C 004A1025 */  or        $v0, $v0, $t2
/* 3731E0 E006EA50 24630040 */  addiu     $v1, $v1, 0x40
/* 3731E4 E006EA54 00031880 */  sll       $v1, $v1, 2
/* 3731E8 E006EA58 30630FFF */  andi      $v1, $v1, 0xFFF
/* 3731EC E006EA5C 00031B00 */  sll       $v1, $v1, 12
/* 3731F0 E006EA60 006B1825 */  or        $v1, $v1, $t3
/* 3731F4 E006EA64 AEA50000 */  sw        $a1, 0x0($s5)
/* 3731F8 E006EA68 ACC20018 */  sw        $v0, 0x18($a2)
/* 3731FC E006EA6C 33C200FF */  andi      $v0, $fp, 0xFF
/* 373200 E006EA70 ACC3001C */  sw        $v1, 0x1C($a2)
/* 373204 E006EA74 00073E00 */  sll       $a3, $a3, 24
/* 373208 E006EA78 00084400 */  sll       $t0, $t0, 16
/* 37320C E006EA7C 00E83825 */  or        $a3, $a3, $t0
/* 373210 E006EA80 00094A00 */  sll       $t1, $t1, 8
/* 373214 E006EA84 00E93825 */  or        $a3, $a3, $t1
/* 373218 E006EA88 00E23825 */  or        $a3, $a3, $v0
/* 37321C E006EA8C ACC7000C */  sw        $a3, 0xC($a2)
/* 373220 E006EA90 8E85000C */  lw        $a1, 0xC($s4)
/* 373224 E006EA94 8E860010 */  lw        $a2, 0x10($s4)
/* 373228 E006EA98 8E870014 */  lw        $a3, 0x14($s4)
/* 37322C E006EA9C 4480A000 */  mtc1      $zero, $f20
/* 373230 E006EAA0 0C080108 */  jal       shim_guTranslateF
/* 373234 E006EAA4 36731630 */   ori      $s3, $s3, (0x11630 & 0xFFFF)
/* 373238 E006EAA8 27B00058 */  addiu     $s0, $sp, 0x58
/* 37323C E006EAAC 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 373240 E006EAB0 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 373244 E006EAB4 4406A000 */  mfc1      $a2, $f20
/* 373248 E006EAB8 00031080 */  sll       $v0, $v1, 2
/* 37324C E006EABC 00431021 */  addu      $v0, $v0, $v1
/* 373250 E006EAC0 00021080 */  sll       $v0, $v0, 2
/* 373254 E006EAC4 00431023 */  subu      $v0, $v0, $v1
/* 373258 E006EAC8 000218C0 */  sll       $v1, $v0, 3
/* 37325C E006EACC 00431021 */  addu      $v0, $v0, $v1
/* 373260 E006EAD0 000210C0 */  sll       $v0, $v0, 3
/* 373264 E006EAD4 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 373268 E006EAD8 00220821 */  addu      $at, $at, $v0
/* 37326C E006EADC C4201DEC */  lwc1      $f0, %lo(gCameras + 0x6C)($at)
/* 373270 E006EAE0 3C073F80 */  lui       $a3, (0x3F800000 >> 16)
/* 373274 E006EAE4 46000007 */  neg.s     $f0, $f0
/* 373278 E006EAE8 44050000 */  mfc1      $a1, $f0
/* 37327C E006EAEC 0200202D */  daddu     $a0, $s0, $zero
/* 373280 E006EAF0 0C080104 */  jal       shim_guRotateF
/* 373284 E006EAF4 E7B40010 */   swc1     $f20, 0x10($sp)
/* 373288 E006EAF8 0200202D */  daddu     $a0, $s0, $zero
/* 37328C E006EAFC 27A50018 */  addiu     $a1, $sp, 0x18
/* 373290 E006EB00 0C080114 */  jal       shim_guMtxCatF
/* 373294 E006EB04 00A0302D */   daddu    $a2, $a1, $zero
/* 373298 E006EB08 0200202D */  daddu     $a0, $s0, $zero
/* 37329C E006EB0C 8E850038 */  lw        $a1, 0x38($s4)
/* 3732A0 E006EB10 4407A000 */  mfc1      $a3, $f20
/* 3732A4 E006EB14 0C080110 */  jal       shim_guScaleF
/* 3732A8 E006EB18 00A0302D */   daddu    $a2, $a1, $zero
/* 3732AC E006EB1C 0200202D */  daddu     $a0, $s0, $zero
/* 3732B0 E006EB20 27A50018 */  addiu     $a1, $sp, 0x18
/* 3732B4 E006EB24 0C080114 */  jal       shim_guMtxCatF
/* 3732B8 E006EB28 00A0302D */   daddu    $a2, $a1, $zero
/* 3732BC E006EB2C 27A40018 */  addiu     $a0, $sp, 0x18
/* 3732C0 E006EB30 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* 3732C4 E006EB34 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* 3732C8 E006EB38 3C11800A */  lui       $s1, %hi(gDisplayContext)
/* 3732CC E006EB3C 2631A674 */  addiu     $s1, $s1, %lo(gDisplayContext)
/* 3732D0 E006EB40 96050000 */  lhu       $a1, 0x0($s0)
/* 3732D4 E006EB44 8E220000 */  lw        $v0, 0x0($s1)
/* 3732D8 E006EB48 00052980 */  sll       $a1, $a1, 6
/* 3732DC E006EB4C 00B32821 */  addu      $a1, $a1, $s3
/* 3732E0 E006EB50 0C080118 */  jal       shim_guMtxF2L
/* 3732E4 E006EB54 00452821 */   addu     $a1, $v0, $a1
/* 3732E8 E006EB58 3C06D838 */  lui       $a2, (0xD8380002 >> 16)
/* 3732EC E006EB5C 8EA40000 */  lw        $a0, 0x0($s5)
/* 3732F0 E006EB60 34C60002 */  ori       $a2, $a2, (0xD8380002 & 0xFFFF)
/* 3732F4 E006EB64 0080282D */  daddu     $a1, $a0, $zero
/* 3732F8 E006EB68 24840008 */  addiu     $a0, $a0, 0x8
/* 3732FC E006EB6C AEA40000 */  sw        $a0, 0x0($s5)
/* 373300 E006EB70 96020000 */  lhu       $v0, 0x0($s0)
/* 373304 E006EB74 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 373308 E006EB78 ACA30000 */  sw        $v1, 0x0($a1)
/* 37330C E006EB7C 24430001 */  addiu     $v1, $v0, 0x1
/* 373310 E006EB80 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 373314 E006EB84 00021180 */  sll       $v0, $v0, 6
/* 373318 E006EB88 A6030000 */  sh        $v1, 0x0($s0)
/* 37331C E006EB8C 8E230000 */  lw        $v1, 0x0($s1)
/* 373320 E006EB90 00531021 */  addu      $v0, $v0, $s3
/* 373324 E006EB94 00621821 */  addu      $v1, $v1, $v0
/* 373328 E006EB98 24820008 */  addiu     $v0, $a0, 0x8
/* 37332C E006EB9C ACA30004 */  sw        $v1, 0x4($a1)
/* 373330 E006EBA0 AEA20000 */  sw        $v0, 0x0($s5)
/* 373334 E006EBA4 AC920000 */  sw        $s2, 0x0($a0)
/* 373338 E006EBA8 8FAC0098 */  lw        $t4, 0x98($sp)
/* 37333C E006EBAC 24820010 */  addiu     $v0, $a0, 0x10
/* 373340 E006EBB0 AC8C0004 */  sw        $t4, 0x4($a0)
/* 373344 E006EBB4 AEA20000 */  sw        $v0, 0x0($s5)
/* 373348 E006EBB8 24020040 */  addiu     $v0, $zero, 0x40
/* 37334C E006EBBC AC860008 */  sw        $a2, 0x8($a0)
/* 373350 E006EBC0 AC82000C */  sw        $v0, 0xC($a0)
/* 373354 E006EBC4 8FBF00C4 */  lw        $ra, 0xC4($sp)
/* 373358 E006EBC8 8FBE00C0 */  lw        $fp, 0xC0($sp)
/* 37335C E006EBCC 8FB700BC */  lw        $s7, 0xBC($sp)
/* 373360 E006EBD0 8FB600B8 */  lw        $s6, 0xB8($sp)
/* 373364 E006EBD4 8FB500B4 */  lw        $s5, 0xB4($sp)
/* 373368 E006EBD8 8FB400B0 */  lw        $s4, 0xB0($sp)
/* 37336C E006EBDC 8FB300AC */  lw        $s3, 0xAC($sp)
/* 373370 E006EBE0 8FB200A8 */  lw        $s2, 0xA8($sp)
/* 373374 E006EBE4 8FB100A4 */  lw        $s1, 0xA4($sp)
/* 373378 E006EBE8 8FB000A0 */  lw        $s0, 0xA0($sp)
/* 37337C E006EBEC D7B400C8 */  ldc1      $f20, 0xC8($sp)
/* 373380 E006EBF0 03E00008 */  jr        $ra
/* 373384 E006EBF4 27BD00D0 */   addiu    $sp, $sp, 0xD0
/* 373388 E006EBF8 00000000 */  nop
/* 37338C E006EBFC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void fire_breath_appendGfx(void* effect) {
    Matrix4f sp18;
    Matrix4f sp58;
    FireBreathFXData* data = ((EffectInstance*)effect)->data.fireBreath;
    s32 type = data->type;
    s32 envAlpha = (data->unk_5C - (s32)data->unk_5C) * 256.0f;
    Gfx* dlist = D_E006EC00[type];
    Gfx* dlist2 = D_E006EC0C[type];
    s32 unk_5C = data->unk_5C;

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

    if (type == FIRE_BREATH_SMALL) {
        shim_guTranslateF(sp18, data->initPos.x, data->initPos.y, data->initPos.z);
        shim_guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f);
        shim_guMtxCatF(sp58, sp18, sp18);
        shim_guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);

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

    gSPDisplayList(gMainGfxPos++, dlist2);
    gDPSetPrimColor(gMainGfxPos++, 0, 0, data->primR, data->primG, data->primB, data->alpha);
    gDPSetEnvColor(gMainGfxPos++, data->envR, data->envG, data->envB, envAlpha);
    gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE, ((unk_5C * 32) + 0)  * 4, 0, ((unk_5C * 32) + 32) * 4, 128);
    gDPSetTileSize(gMainGfxPos++, 1,               ((unk_5C * 32) + 32) * 4, 0, ((unk_5C * 32) + 64) * 4, 128);

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

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


### RAW ASSEMBLY INSTRUCTIONS:

glabel calc_partner_test_enemy
/* 1AC85C 8027DF7C 27BDFFD0 */  addiu     $sp, $sp, -0x30
/* 1AC860 8027DF80 AFB1001C */  sw        $s1, 0x1C($sp)
/* 1AC864 8027DF84 3C11800E */  lui       $s1, %hi(gBattleStatus)
/* 1AC868 8027DF88 2631C070 */  addiu     $s1, $s1, %lo(gBattleStatus)
/* 1AC86C 8027DF8C AFBF002C */  sw        $ra, 0x2C($sp)
/* 1AC870 8027DF90 AFB40028 */  sw        $s4, 0x28($sp)
/* 1AC874 8027DF94 AFB30024 */  sw        $s3, 0x24($sp)
/* 1AC878 8027DF98 AFB20020 */  sw        $s2, 0x20($sp)
/* 1AC87C 8027DF9C AFB00018 */  sw        $s0, 0x18($sp)
/* 1AC880 8027DFA0 962201A0 */  lhu       $v0, 0x1A0($s1)
/* 1AC884 8027DFA4 862401A0 */  lh        $a0, 0x1A0($s1)
/* 1AC888 8027DFA8 922301A2 */  lbu       $v1, 0x1A2($s1)
/* 1AC88C 8027DFAC 8E3400DC */  lw        $s4, 0xDC($s1)
/* 1AC890 8027DFB0 823201A2 */  lb        $s2, 0x1A2($s1)
/* 1AC894 8027DFB4 A62201A4 */  sh        $v0, 0x1A4($s1)
/* 1AC898 8027DFB8 0C09A75B */  jal       get_actor
/* 1AC89C 8027DFBC A22301A6 */   sb       $v1, 0x1A6($s1)
/* 1AC8A0 8027DFC0 0040982D */  daddu     $s3, $v0, $zero
/* 1AC8A4 8027DFC4 126000CF */  beqz      $s3, .L8027E304
/* 1AC8A8 8027DFC8 2690000C */   addiu    $s0, $s4, 0xC
/* 1AC8AC 8027DFCC 0260202D */  daddu     $a0, $s3, $zero
/* 1AC8B0 8027DFD0 0C099117 */  jal       get_actor_part
/* 1AC8B4 8027DFD4 0240282D */   daddu    $a1, $s2, $zero
/* 1AC8B8 8027DFD8 0040902D */  daddu     $s2, $v0, $zero
/* 1AC8BC 8027DFDC 16400003 */  bnez      $s2, .L8027DFEC
/* 1AC8C0 8027DFE0 2402000C */   addiu    $v0, $zero, 0xC
.L8027DFE4:
/* 1AC8C4 8027DFE4 0809F7F9 */  j         .L8027DFE4
/* 1AC8C8 8027DFE8 00000000 */   nop
.L8027DFEC:
/* 1AC8CC 8027DFEC 82630214 */  lb        $v1, 0x214($s3)
/* 1AC8D0 8027DFF0 106200C5 */  beq       $v1, $v0, .L8027E308
/* 1AC8D4 8027DFF4 24020008 */   addiu    $v0, $zero, 0x8
/* 1AC8D8 8027DFF8 8E44007C */  lw        $a0, 0x7C($s2)
/* 1AC8DC 8027DFFC 30820020 */  andi      $v0, $a0, 0x20
/* 1AC8E0 8027E000 144000C1 */  bnez      $v0, .L8027E308
/* 1AC8E4 8027E004 24020006 */   addiu    $v0, $zero, 0x6
/* 1AC8E8 8027E008 82630218 */  lb        $v1, 0x218($s3)
/* 1AC8EC 8027E00C 2402000E */  addiu     $v0, $zero, 0xE
/* 1AC8F0 8027E010 106200BD */  beq       $v1, $v0, .L8027E308
/* 1AC8F4 8027E014 24020006 */   addiu    $v0, $zero, 0x6
/* 1AC8F8 8027E018 8E220188 */  lw        $v0, 0x188($s1)
/* 1AC8FC 8027E01C 30420080 */  andi      $v0, $v0, 0x80
/* 1AC900 8027E020 1040000F */  beqz      $v0, .L8027E060
/* 1AC904 8027E024 30820010 */   andi     $v0, $a0, 0x10
/* 1AC908 8027E028 1040000E */  beqz      $v0, .L8027E064
/* 1AC90C 8027E02C 3C031000 */   lui      $v1, (0x10000080 >> 16)
/* 1AC910 8027E030 8E620004 */  lw        $v0, 0x4($s3)
/* 1AC914 8027E034 30420800 */  andi      $v0, $v0, 0x800
/* 1AC918 8027E038 1440000A */  bnez      $v0, .L8027E064
/* 1AC91C 8027E03C 24040108 */   addiu    $a0, $zero, 0x108
/* 1AC920 8027E040 C6000014 */  lwc1      $f0, 0x14($s0)
/* 1AC924 8027E044 E7A00010 */  swc1      $f0, 0x10($sp)
/* 1AC928 8027E048 8E06000C */  lw        $a2, 0xC($s0)
/* 1AC92C 8027E04C 8E070010 */  lw        $a3, 0x10($s0)
/* 1AC930 8027E050 0C052757 */  jal       sfx_play_sound_at_position
/* 1AC934 8027E054 0000282D */   daddu    $a1, $zero, $zero
/* 1AC938 8027E058 0809F8C2 */  j         .L8027E308
/* 1AC93C 8027E05C 24020004 */   addiu    $v0, $zero, 0x4
.L8027E060:
/* 1AC940 8027E060 3C031000 */  lui       $v1, (0x10000080 >> 16)
.L8027E064:
/* 1AC944 8027E064 8E220188 */  lw        $v0, 0x188($s1)
/* 1AC948 8027E068 34630080 */  ori       $v1, $v1, (0x10000080 & 0xFFFF)
/* 1AC94C 8027E06C 00431024 */  and       $v0, $v0, $v1
/* 1AC950 8027E070 1440001B */  bnez      $v0, .L8027E0E0
/* 1AC954 8027E074 3C031000 */   lui      $v1, (0x10000040 >> 16)
/* 1AC958 8027E078 8E42007C */  lw        $v0, 0x7C($s2)
/* 1AC95C 8027E07C 3C030001 */  lui       $v1, (0x10000 >> 16)
/* 1AC960 8027E080 00431024 */  and       $v0, $v0, $v1
/* 1AC964 8027E084 10400016 */  beqz      $v0, .L8027E0E0
/* 1AC968 8027E088 3C031000 */   lui      $v1, (0x10000040 >> 16)
/* 1AC96C 8027E08C 8E22018C */  lw        $v0, 0x18C($s1)
/* 1AC970 8027E090 30420004 */  andi      $v0, $v0, 0x4
/* 1AC974 8027E094 14400012 */  bnez      $v0, .L8027E0E0
/* 1AC978 8027E098 0280202D */   daddu    $a0, $s4, $zero
/* 1AC97C 8027E09C 0C099CAB */  jal       player_team_is_ability_active
/* 1AC980 8027E0A0 24050002 */   addiu    $a1, $zero, 0x2
/* 1AC984 8027E0A4 1440000E */  bnez      $v0, .L8027E0E0
/* 1AC988 8027E0A8 3C031000 */   lui      $v1, (0x10000040 >> 16)
/* 1AC98C 8027E0AC C6000014 */  lwc1      $f0, 0x14($s0)
/* 1AC990 8027E0B0 24040108 */  addiu     $a0, $zero, 0x108
/* 1AC994 8027E0B4 E7A00010 */  swc1      $f0, 0x10($sp)
/* 1AC998 8027E0B8 8E06000C */  lw        $a2, 0xC($s0)
/* 1AC99C 8027E0BC 8E070010 */  lw        $a3, 0x10($s0)
/* 1AC9A0 8027E0C0 0C052757 */  jal       sfx_play_sound_at_position
/* 1AC9A4 8027E0C4 0000282D */   daddu    $a1, $zero, $zero
/* 1AC9A8 8027E0C8 24040001 */  addiu     $a0, $zero, 0x1
/* 1AC9AC 8027E0CC 0C09FEE7 */  jal       dispatch_damage_event_partner_1
/* 1AC9B0 8027E0D0 2405002A */   addiu    $a1, $zero, 0x2A
/* 1AC9B4 8027E0D4 0260202D */  daddu     $a0, $s3, $zero
/* 1AC9B8 8027E0D8 0809F8BB */  j         .L8027E2EC
/* 1AC9BC 8027E0DC 2405001B */   addiu    $a1, $zero, 0x1B
.L8027E0E0:
/* 1AC9C0 8027E0E0 8E220188 */  lw        $v0, 0x188($s1)
/* 1AC9C4 8027E0E4 34630040 */  ori       $v1, $v1, (0x10000040 & 0xFFFF)
/* 1AC9C8 8027E0E8 00431024 */  and       $v0, $v0, $v1
/* 1AC9CC 8027E0EC 14400009 */  bnez      $v0, .L8027E114
/* 1AC9D0 8027E0F0 00000000 */   nop
/* 1AC9D4 8027E0F4 8E42007C */  lw        $v0, 0x7C($s2)
/* 1AC9D8 8027E0F8 30420002 */  andi      $v0, $v0, 0x2
/* 1AC9DC 8027E0FC 10400005 */  beqz      $v0, .L8027E114
/* 1AC9E0 8027E100 00000000 */   nop
/* 1AC9E4 8027E104 8E22018C */  lw        $v0, 0x18C($s1)
/* 1AC9E8 8027E108 30420010 */  andi      $v0, $v0, 0x10
/* 1AC9EC 8027E10C 1040006B */  beqz      $v0, .L8027E2BC
/* 1AC9F0 8027E110 00000000 */   nop
.L8027E114:
/* 1AC9F4 8027E114 8E230188 */  lw        $v1, 0x188($s1)
/* 1AC9F8 8027E118 30628000 */  andi      $v0, $v1, 0x8000
/* 1AC9FC 8027E11C 10400079 */  beqz      $v0, .L8027E304
/* 1ACA00 8027E120 3C021000 */   lui      $v0, (0x10000000 >> 16)
/* 1ACA04 8027E124 00621024 */  and       $v0, $v1, $v0
/* 1ACA08 8027E128 14400036 */  bnez      $v0, .L8027E204
/* 1ACA0C 8027E12C 00000000 */   nop
/* 1ACA10 8027E130 8E42007C */  lw        $v0, 0x7C($s2)
/* 1ACA14 8027E134 30420010 */  andi      $v0, $v0, 0x10
/* 1ACA18 8027E138 10400015 */  beqz      $v0, .L8027E190
/* 1ACA1C 8027E13C 00000000 */   nop
/* 1ACA20 8027E140 8E620000 */  lw        $v0, 0x0($s3)
/* 1ACA24 8027E144 30420800 */  andi      $v0, $v0, 0x800
/* 1ACA28 8027E148 14400011 */  bnez      $v0, .L8027E190
/* 1ACA2C 8027E14C 00000000 */   nop
/* 1ACA30 8027E150 8E22018C */  lw        $v0, 0x18C($s1)
/* 1ACA34 8027E154 30420001 */  andi      $v0, $v0, 0x1
/* 1ACA38 8027E158 1440000D */  bnez      $v0, .L8027E190
/* 1ACA3C 8027E15C 24040108 */   addiu    $a0, $zero, 0x108
/* 1ACA40 8027E160 C6000014 */  lwc1      $f0, 0x14($s0)
/* 1ACA44 8027E164 E7A00010 */  swc1      $f0, 0x10($sp)
/* 1ACA48 8027E168 8E06000C */  lw        $a2, 0xC($s0)
/* 1ACA4C 8027E16C 8E070010 */  lw        $a3, 0x10($s0)
/* 1ACA50 8027E170 0C052757 */  jal       sfx_play_sound_at_position
/* 1ACA54 8027E174 0000282D */   daddu    $a1, $zero, $zero
/* 1ACA58 8027E178 24040001 */  addiu     $a0, $zero, 0x1
/* 1ACA5C 8027E17C 0C09FEE7 */  jal       dispatch_damage_event_partner_1
/* 1ACA60 8027E180 2405002A */   addiu    $a1, $zero, 0x2A
/* 1ACA64 8027E184 0260202D */  daddu     $a0, $s3, $zero
/* 1ACA68 8027E188 0809F8BB */  j         .L8027E2EC
/* 1ACA6C 8027E18C 2405001B */   addiu    $a1, $zero, 0x1B
.L8027E190:
/* 1ACA70 8027E190 8E220188 */  lw        $v0, 0x188($s1)
/* 1ACA74 8027E194 3C031000 */  lui       $v1, (0x10000000 >> 16)
/* 1ACA78 8027E198 00431024 */  and       $v0, $v0, $v1
/* 1ACA7C 8027E19C 14400019 */  bnez      $v0, .L8027E204
/* 1ACA80 8027E1A0 3C030020 */   lui      $v1, (0x200000 >> 16)
/* 1ACA84 8027E1A4 8E42007C */  lw        $v0, 0x7C($s2)
/* 1ACA88 8027E1A8 00431024 */  and       $v0, $v0, $v1
/* 1ACA8C 8027E1AC 10400015 */  beqz      $v0, .L8027E204
/* 1ACA90 8027E1B0 00000000 */   nop
/* 1ACA94 8027E1B4 8E620000 */  lw        $v0, 0x0($s3)
/* 1ACA98 8027E1B8 30420800 */  andi      $v0, $v0, 0x800
/* 1ACA9C 8027E1BC 14400011 */  bnez      $v0, .L8027E204
/* 1ACAA0 8027E1C0 00000000 */   nop
/* 1ACAA4 8027E1C4 8E22018C */  lw        $v0, 0x18C($s1)
/* 1ACAA8 8027E1C8 30420080 */  andi      $v0, $v0, 0x80
/* 1ACAAC 8027E1CC 1440000D */  bnez      $v0, .L8027E204
/* 1ACAB0 8027E1D0 24040108 */   addiu    $a0, $zero, 0x108
/* 1ACAB4 8027E1D4 C6000014 */  lwc1      $f0, 0x14($s0)
/* 1ACAB8 8027E1D8 E7A00010 */  swc1      $f0, 0x10($sp)
/* 1ACABC 8027E1DC 8E06000C */  lw        $a2, 0xC($s0)
/* 1ACAC0 8027E1E0 8E070010 */  lw        $a3, 0x10($s0)
/* 1ACAC4 8027E1E4 0C052757 */  jal       sfx_play_sound_at_position
/* 1ACAC8 8027E1E8 0000282D */   daddu    $a1, $zero, $zero
/* 1ACACC 8027E1EC 24040001 */  addiu     $a0, $zero, 0x1
/* 1ACAD0 8027E1F0 0C09FEE7 */  jal       dispatch_damage_event_partner_1
/* 1ACAD4 8027E1F4 2405002A */   addiu    $a1, $zero, 0x2A
/* 1ACAD8 8027E1F8 0260202D */  daddu     $a0, $s3, $zero
/* 1ACADC 8027E1FC 0809F8BB */  j         .L8027E2EC
/* 1ACAE0 8027E200 2405001B */   addiu    $a1, $zero, 0x1B
.L8027E204:
/* 1ACAE4 8027E204 82820212 */  lb        $v0, 0x212($s4)
/* 1ACAE8 8027E208 2403000B */  addiu     $v1, $zero, 0xB
/* 1ACAEC 8027E20C 5043001E */  beql      $v0, $v1, .L8027E288
/* 1ACAF0 8027E210 3C031000 */   lui      $v1, (0x10000040 >> 16)
/* 1ACAF4 8027E214 82620212 */  lb        $v0, 0x212($s3)
/* 1ACAF8 8027E218 10430005 */  beq       $v0, $v1, .L8027E230
/* 1ACAFC 8027E21C 00000000 */   nop
/* 1ACB00 8027E220 8E42007C */  lw        $v0, 0x7C($s2)
/* 1ACB04 8027E224 30420080 */  andi      $v0, $v0, 0x80
/* 1ACB08 8027E228 10400017 */  beqz      $v0, .L8027E288
/* 1ACB0C 8027E22C 3C031000 */   lui      $v1, (0x10000040 >> 16)
.L8027E230:
/* 1ACB10 8027E230 8E220188 */  lw        $v0, 0x188($s1)
/* 1ACB14 8027E234 3C031000 */  lui       $v1, (0x10000040 >> 16)
/* 1ACB18 8027E238 00431024 */  and       $v0, $v0, $v1
/* 1ACB1C 8027E23C 14400012 */  bnez      $v0, .L8027E288
/* 1ACB20 8027E240 00000000 */   nop
/* 1ACB24 8027E244 8E22018C */  lw        $v0, 0x18C($s1)
/* 1ACB28 8027E248 30420008 */  andi      $v0, $v0, 0x8
/* 1ACB2C 8027E24C 1440000E */  bnez      $v0, .L8027E288
/* 1ACB30 8027E250 2404037B */   addiu    $a0, $zero, 0x37B
/* 1ACB34 8027E254 C6000014 */  lwc1      $f0, 0x14($s0)
/* 1ACB38 8027E258 E7A00010 */  swc1      $f0, 0x10($sp)
/* 1ACB3C 8027E25C 8E06000C */  lw        $a2, 0xC($s0)
/* 1ACB40 8027E260 8E070010 */  lw        $a3, 0x10($s0)
/* 1ACB44 8027E264 0C052757 */  jal       sfx_play_sound_at_position
/* 1ACB48 8027E268 0000282D */   daddu    $a1, $zero, $zero
/* 1ACB4C 8027E26C 0C09451D */  jal       apply_shock_effect
/* 1ACB50 8027E270 0280202D */   daddu    $a0, $s4, $zero
/* 1ACB54 8027E274 24040001 */  addiu     $a0, $zero, 0x1
/* 1ACB58 8027E278 0C09FEE7 */  jal       dispatch_damage_event_partner_1
/* 1ACB5C 8027E27C 2405002F */   addiu    $a1, $zero, 0x2F
/* 1ACB60 8027E280 0809F8C2 */  j         .L8027E308
/* 1ACB64 8027E284 2402FFFF */   addiu    $v0, $zero, -0x1
.L8027E288:
/* 1ACB68 8027E288 8E220188 */  lw        $v0, 0x188($s1)
/* 1ACB6C 8027E28C 34630040 */  ori       $v1, $v1, (0x10000040 & 0xFFFF)
/* 1ACB70 8027E290 00431024 */  and       $v0, $v0, $v1
/* 1ACB74 8027E294 14400019 */  bnez      $v0, .L8027E2FC
/* 1ACB78 8027E298 0260202D */   daddu    $a0, $s3, $zero
/* 1ACB7C 8027E29C 8E42007C */  lw        $v0, 0x7C($s2)
/* 1ACB80 8027E2A0 30420002 */  andi      $v0, $v0, 0x2
/* 1ACB84 8027E2A4 10400015 */  beqz      $v0, .L8027E2FC
/* 1ACB88 8027E2A8 00000000 */   nop
/* 1ACB8C 8027E2AC 8E22018C */  lw        $v0, 0x18C($s1)
/* 1ACB90 8027E2B0 30420010 */  andi      $v0, $v0, 0x10
/* 1ACB94 8027E2B4 14400011 */  bnez      $v0, .L8027E2FC
/* 1ACB98 8027E2B8 00000000 */   nop
.L8027E2BC:
/* 1ACB9C 8027E2BC C6000014 */  lwc1      $f0, 0x14($s0)
/* 1ACBA0 8027E2C0 240400EA */  addiu     $a0, $zero, 0xEA
/* 1ACBA4 8027E2C4 E7A00010 */  swc1      $f0, 0x10($sp)
/* 1ACBA8 8027E2C8 8E06000C */  lw        $a2, 0xC($s0)
/* 1ACBAC 8027E2CC 8E070010 */  lw        $a3, 0x10($s0)
/* 1ACBB0 8027E2D0 0C052757 */  jal       sfx_play_sound_at_position
/* 1ACBB4 8027E2D4 0000282D */   daddu    $a1, $zero, $zero
/* 1ACBB8 8027E2D8 24040001 */  addiu     $a0, $zero, 0x1
/* 1ACBBC 8027E2DC 0C09FEE7 */  jal       dispatch_damage_event_partner_1
/* 1ACBC0 8027E2E0 2405002C */   addiu    $a1, $zero, 0x2C
/* 1ACBC4 8027E2E4 0260202D */  daddu     $a0, $s3, $zero
/* 1ACBC8 8027E2E8 2405001C */  addiu     $a1, $zero, 0x1C
.L8027E2EC:
/* 1ACBCC 8027E2EC 0C09DC58 */  jal       dispatch_event_actor
/* 1ACBD0 8027E2F0 00000000 */   nop
/* 1ACBD4 8027E2F4 0809F8C2 */  j         .L8027E308
/* 1ACBD8 8027E2F8 2402FFFF */   addiu    $v0, $zero, -0x1
.L8027E2FC:
/* 1ACBDC 8027E2FC 0C09DC58 */  jal       dispatch_event_actor
/* 1ACBE0 8027E300 2405003A */   addiu    $a1, $zero, 0x3A
.L8027E304:
/* 1ACBE4 8027E304 0000102D */  daddu     $v0, $zero, $zero
.L8027E308:
/* 1ACBE8 8027E308 8FBF002C */  lw        $ra, 0x2C($sp)
/* 1ACBEC 8027E30C 8FB40028 */  lw        $s4, 0x28($sp)
/* 1ACBF0 8027E310 8FB30024 */  lw        $s3, 0x24($sp)
/* 1ACBF4 8027E314 8FB20020 */  lw        $s2, 0x20($sp)
/* 1ACBF8 8027E318 8FB1001C */  lw        $s1, 0x1C($sp)
/* 1ACBFC 8027E31C 8FB00018 */  lw        $s0, 0x18($sp)
/* 1ACC00 8027E320 03E00008 */  jr        $ra
/* 1ACC04 8027E324 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

HitResult calc_partner_test_enemy(void) {
    BattleStatus* battleStatus = &gBattleStatus;
    Actor* partner = battleStatus->partnerActor;
    s32 currentTargetID = battleStatus->currentTargetID;
    s32 currentTargetPart = battleStatus->currentTargetPart;
    Actor* target;
    ActorState* state;
    ActorPart* part;

    battleStatus->currentTargetID2 = battleStatus->currentTargetID;
    battleStatus->currentTargetPart2 = battleStatus->currentTargetPart;
    target = get_actor(currentTargetID);
    state = &partner->state;

    if (target == NULL) {
        return HIT_RESULT_HIT;
    }

    part = get_actor_part(target, currentTargetPart);
    ASSERT(part != NULL);

    if (target->stoneStatus == STATUS_KEY_STONE) {
        return HIT_RESULT_IMMUNE;
    }

    if ((part->eventFlags & ACTOR_EVENT_FLAG_ILLUSORY) || target->transparentStatus == STATUS_KEY_TRANSPARENT) {
        return HIT_RESULT_MISS;
    }

    // check partner jumping on top-spiky enemy (cannot be suppressed)
    if ((battleStatus->currentAttackElement & DAMAGE_TYPE_JUMP)
        && (part->eventFlags & ACTOR_EVENT_FLAG_SPIKY_TOP)
        && !(target->flags2 & ACTOR_FLAG_UPSIDE_DOWN)
    ) {
        sfx_play_sound_at_position(SOUND_108, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z);
        return HIT_RESULT_LANDED_ON_SPIKE;
    }

    // check partner contacting front-spiky enemy
    if (!(battleStatus->currentAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_JUMP))
        && (part->eventFlags & ACTOR_EVENT_FLAG_SPIKY_FRONT)
        && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_SPIKY_FRONT)
        && !player_team_is_ability_active(partner, ABILITY_SPIKE_SHIELD)
    ) {
        sfx_play_sound_at_position(SOUND_108, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z);
        dispatch_damage_event_partner_1(1, EVENT_SPIKE_CONTACT);
        dispatch_event_actor(target, EVENT_SPIKE_TAUNT);
        return HIT_RESULT_BACKFIRE;
    }

    // check partner contacting fiery enemy
    if (!(battleStatus->currentAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_SMASH))
        && (part->eventFlags & ACTOR_EVENT_FLAG_FIREY)
        && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_BURN_CONTACT)
    ) {
        sfx_play_sound_at_position(SOUND_HIT_FIRE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z);
        dispatch_damage_event_partner_1(1, EVENT_BURN_CONTACT);
        dispatch_event_actor(target, EVENT_BURN_TAUNT);
        return HIT_RESULT_BACKFIRE;
    }

    // specifal handling for air lift
    if (battleStatus->currentAttackElement & DAMAGE_TYPE_AIR_LIFT) {
        // check partner airlifting top-spiky enemy
        if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_NO_CONTACT)) {
            if ((part->eventFlags & ACTOR_EVENT_FLAG_SPIKY_TOP)
                && !(target->flags & ACTOR_FLAG_UPSIDE_DOWN)
                && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_SPIKY_TOP)
            ) {
                sfx_play_sound_at_position(SOUND_108, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z);
                dispatch_damage_event_partner_1(1, EVENT_SPIKE_CONTACT);
                dispatch_event_actor(target, EVENT_SPIKE_TAUNT);
                return HIT_RESULT_BACKFIRE;
            }

            if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_NO_CONTACT)
                && (part->eventFlags & ACTOR_EVENT_FLAG_200000)
                && !(target->flags & ACTOR_FLAG_UPSIDE_DOWN)
                && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_FLAG_80)
            ) {
                sfx_play_sound_at_position(SOUND_108, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z);
                dispatch_damage_event_partner_1(1, EVENT_SPIKE_CONTACT);
                dispatch_event_actor(target, EVENT_SPIKE_TAUNT);
                return HIT_RESULT_BACKFIRE;
            }
        }

        // check partner airlifting electrified enemy
        if (partner->staticStatus != STATUS_KEY_STATIC
            && (target->staticStatus == STATUS_KEY_STATIC || (part->eventFlags & ACTOR_EVENT_FLAG_ELECTRIFIED))
            && !(battleStatus->currentAttackElement & DAMAGE_TYPE_NO_CONTACT)
            && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_SHOCK_CONTACT))
        {
            sfx_play_sound_at_position(SOUND_HIT_SHOCK, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z);
            apply_shock_effect(partner);
            dispatch_damage_event_partner_1(1, EVENT_SHOCK_HIT);
            return HIT_RESULT_BACKFIRE;
        }

        // check partner airlifting fiery enemy
        if (!(battleStatus->currentAttackElement & (DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_SMASH))
            && (part->eventFlags & ACTOR_EVENT_FLAG_FIREY)
            && !(battleStatus->currentAttackEventSuppression & SUPPRESS_EVENT_BURN_CONTACT))
        {
            sfx_play_sound_at_position(SOUND_HIT_FIRE, SOUND_SPACE_MODE_0, state->goalPos.x, state->goalPos.y, state->goalPos.z);
            dispatch_damage_event_partner_1(1, EVENT_BURN_CONTACT);
            dispatch_event_actor(target, EVENT_BURN_TAUNT);
            return HIT_RESULT_BACKFIRE;
        }
        dispatch_event_actor(target, EVENT_BEGIN_AIR_LIFT);
    }
    return HIT_RESULT_HIT;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel __udivdi3
/* 49710 8006E310 00E0482D */  daddu     $t1, $a3, $zero
/* 49714 8006E314 00C0402D */  daddu     $t0, $a2, $zero
/* 49718 8006E318 150000DF */  bnez      $t0, .L8006E698
/* 4971C 8006E31C 00A0582D */   daddu    $t3, $a1, $zero
/* 49720 8006E320 0089102B */  sltu      $v0, $a0, $t1
/* 49724 8006E324 1040004E */  beqz      $v0, .L8006E460
/* 49728 8006E328 3402FFFF */   ori      $v0, $zero, 0xFFFF
/* 4972C 8006E32C 0049102B */  sltu      $v0, $v0, $t1
/* 49730 8006E330 14400005 */  bnez      $v0, .L8006E348
/* 49734 8006E334 00E0302D */   daddu    $a2, $a3, $zero
/* 49738 8006E338 2D220100 */  sltiu     $v0, $t1, 0x100
/* 4973C 8006E33C 38420001 */  xori      $v0, $v0, 0x1
/* 49740 8006E340 0801B8D8 */  j         .L8006E360
/* 49744 8006E344 000218C0 */   sll      $v1, $v0, 3
.L8006E348:
/* 49748 8006E348 3C0200FF */  lui       $v0, (0xFFFFFF >> 16)
/* 4974C 8006E34C 3442FFFF */  ori       $v0, $v0, (0xFFFFFF & 0xFFFF)
/* 49750 8006E350 0049102B */  sltu      $v0, $v0, $t1
/* 49754 8006E354 14400002 */  bnez      $v0, .L8006E360
/* 49758 8006E358 24030018 */   addiu    $v1, $zero, 0x18
/* 4975C 8006E35C 24030010 */  addiu     $v1, $zero, 0x10
.L8006E360:
/* 49760 8006E360 00661006 */  srlv      $v0, $a2, $v1
/* 49764 8006E364 3C01800A */  lui       $at, %hi(D_8009A040)
/* 49768 8006E368 00220821 */  addu      $at, $at, $v0
/* 4976C 8006E36C 9022A040 */  lbu       $v0, %lo(D_8009A040)($at)
/* 49770 8006E370 24050020 */  addiu     $a1, $zero, 0x20
/* 49774 8006E374 00431021 */  addu      $v0, $v0, $v1
/* 49778 8006E378 00A23023 */  subu      $a2, $a1, $v0
/* 4977C 8006E37C 10C00006 */  beqz      $a2, .L8006E398
/* 49780 8006E380 00C41804 */   sllv     $v1, $a0, $a2
/* 49784 8006E384 00C94804 */  sllv      $t1, $t1, $a2
/* 49788 8006E388 00A61023 */  subu      $v0, $a1, $a2
/* 4978C 8006E38C 004B1006 */  srlv      $v0, $t3, $v0
/* 49790 8006E390 00622025 */  or        $a0, $v1, $v0
/* 49794 8006E394 00CB5804 */  sllv      $t3, $t3, $a2
.L8006E398:
/* 49798 8006E398 00093402 */  srl       $a2, $t1, 16
/* 4979C 8006E39C 14C00002 */  bnez      $a2, .L8006E3A8
/* 497A0 8006E3A0 0086001B */   divu     $zero, $a0, $a2
/* 497A4 8006E3A4 0007000D */  break     7
.L8006E3A8:
/* 497A8 8006E3A8 00003812 */  mflo      $a3
/* 497AC 8006E3AC 00001810 */  mfhi      $v1
/* 497B0 8006E3B0 3128FFFF */  andi      $t0, $t1, 0xFFFF
/* 497B4 8006E3B4 00000000 */  nop
/* 497B8 8006E3B8 00E80018 */  mult      $a3, $t0
/* 497BC 8006E3BC 000B1402 */  srl       $v0, $t3, 16
/* 497C0 8006E3C0 00031C00 */  sll       $v1, $v1, 16
/* 497C4 8006E3C4 00621825 */  or        $v1, $v1, $v0
/* 497C8 8006E3C8 00002812 */  mflo      $a1
/* 497CC 8006E3CC 0065102B */  sltu      $v0, $v1, $a1
/* 497D0 8006E3D0 5040000B */  beql      $v0, $zero, .L8006E400
/* 497D4 8006E3D4 00651823 */   subu     $v1, $v1, $a1
/* 497D8 8006E3D8 00691821 */  addu      $v1, $v1, $t1
/* 497DC 8006E3DC 0069102B */  sltu      $v0, $v1, $t1
/* 497E0 8006E3E0 14400006 */  bnez      $v0, .L8006E3FC
/* 497E4 8006E3E4 24E7FFFF */   addiu    $a3, $a3, -0x1
/* 497E8 8006E3E8 0065102B */  sltu      $v0, $v1, $a1
/* 497EC 8006E3EC 50400004 */  beql      $v0, $zero, .L8006E400
/* 497F0 8006E3F0 00651823 */   subu     $v1, $v1, $a1
/* 497F4 8006E3F4 24E7FFFF */  addiu     $a3, $a3, -0x1
/* 497F8 8006E3F8 00691821 */  addu      $v1, $v1, $t1
.L8006E3FC:
/* 497FC 8006E3FC 00651823 */  subu      $v1, $v1, $a1
.L8006E400:
/* 49800 8006E400 14C00002 */  bnez      $a2, .L8006E40C
/* 49804 8006E404 0066001B */   divu     $zero, $v1, $a2
/* 49808 8006E408 0007000D */  break     7
.L8006E40C:
/* 4980C 8006E40C 00002012 */  mflo      $a0
/* 49810 8006E410 00001810 */  mfhi      $v1
/* 49814 8006E414 00000000 */  nop
/* 49818 8006E418 00000000 */  nop
/* 4981C 8006E41C 00880018 */  mult      $a0, $t0
/* 49820 8006E420 3162FFFF */  andi      $v0, $t3, 0xFFFF
/* 49824 8006E424 00031C00 */  sll       $v1, $v1, 16
/* 49828 8006E428 00621825 */  or        $v1, $v1, $v0
/* 4982C 8006E42C 00002812 */  mflo      $a1
/* 49830 8006E430 0065102B */  sltu      $v0, $v1, $a1
/* 49834 8006E434 10400007 */  beqz      $v0, .L8006E454
/* 49838 8006E438 00691821 */   addu     $v1, $v1, $t1
/* 4983C 8006E43C 0069102B */  sltu      $v0, $v1, $t1
/* 49840 8006E440 14400004 */  bnez      $v0, .L8006E454
/* 49844 8006E444 2484FFFF */   addiu    $a0, $a0, -0x1
/* 49848 8006E448 0065102B */  sltu      $v0, $v1, $a1
/* 4984C 8006E44C 54400001 */  bnel      $v0, $zero, .L8006E454
/* 49850 8006E450 2484FFFF */   addiu    $a0, $a0, -0x1
.L8006E454:
/* 49854 8006E454 00071400 */  sll       $v0, $a3, 16
/* 49858 8006E458 0801BA13 */  j         .L8006E84C
/* 4985C 8006E45C 00443025 */   or       $a2, $v0, $a0
.L8006E460:
/* 49860 8006E460 15200008 */  bnez      $t1, .L8006E484
/* 49864 8006E464 0049102B */   sltu     $v0, $v0, $t1
/* 49868 8006E468 24020001 */  addiu     $v0, $zero, 0x1
/* 4986C 8006E46C 15000002 */  bnez      $t0, .L8006E478
/* 49870 8006E470 0048001B */   divu     $zero, $v0, $t0
/* 49874 8006E474 0007000D */  break     7
.L8006E478:
/* 49878 8006E478 00004812 */  mflo      $t1
/* 4987C 8006E47C 3402FFFF */  ori       $v0, $zero, 0xFFFF
/* 49880 8006E480 0049102B */  sltu      $v0, $v0, $t1
.L8006E484:
/* 49884 8006E484 14400005 */  bnez      $v0, .L8006E49C
/* 49888 8006E488 0120282D */   daddu    $a1, $t1, $zero
/* 4988C 8006E48C 2D220100 */  sltiu     $v0, $t1, 0x100
/* 49890 8006E490 38420001 */  xori      $v0, $v0, 0x1
/* 49894 8006E494 0801B92D */  j         .L8006E4B4
/* 49898 8006E498 000218C0 */   sll      $v1, $v0, 3
.L8006E49C:
/* 4989C 8006E49C 3C0200FF */  lui       $v0, (0xFFFFFF >> 16)
/* 498A0 8006E4A0 3442FFFF */  ori       $v0, $v0, (0xFFFFFF & 0xFFFF)
/* 498A4 8006E4A4 0049102B */  sltu      $v0, $v0, $t1
/* 498A8 8006E4A8 14400002 */  bnez      $v0, .L8006E4B4
/* 498AC 8006E4AC 24030018 */   addiu    $v1, $zero, 0x18
/* 498B0 8006E4B0 24030010 */  addiu     $v1, $zero, 0x10
.L8006E4B4:
/* 498B4 8006E4B4 00651006 */  srlv      $v0, $a1, $v1
/* 498B8 8006E4B8 3C01800A */  lui       $at, %hi(D_8009A040)
/* 498BC 8006E4BC 00220821 */  addu      $at, $at, $v0
/* 498C0 8006E4C0 9022A040 */  lbu       $v0, %lo(D_8009A040)($at)
/* 498C4 8006E4C4 00431021 */  addu      $v0, $v0, $v1
/* 498C8 8006E4C8 24030020 */  addiu     $v1, $zero, 0x20
/* 498CC 8006E4CC 00623023 */  subu      $a2, $v1, $v0
/* 498D0 8006E4D0 14C00004 */  bnez      $a2, .L8006E4E4
/* 498D4 8006E4D4 00662823 */   subu     $a1, $v1, $a2
/* 498D8 8006E4D8 00892023 */  subu      $a0, $a0, $t1
/* 498DC 8006E4DC 0801B974 */  j         .L8006E5D0
/* 498E0 8006E4E0 240A0001 */   addiu    $t2, $zero, 0x1
.L8006E4E4:
/* 498E4 8006E4E4 00C94804 */  sllv      $t1, $t1, $a2
/* 498E8 8006E4E8 00A43806 */  srlv      $a3, $a0, $a1
/* 498EC 8006E4EC 00C41804 */  sllv      $v1, $a0, $a2
/* 498F0 8006E4F0 00AB1006 */  srlv      $v0, $t3, $a1
/* 498F4 8006E4F4 00622025 */  or        $a0, $v1, $v0
/* 498F8 8006E4F8 00CB5804 */  sllv      $t3, $t3, $a2
/* 498FC 8006E4FC 00093402 */  srl       $a2, $t1, 16
/* 49900 8006E500 14C00002 */  bnez      $a2, .L8006E50C
/* 49904 8006E504 00E6001B */   divu     $zero, $a3, $a2
/* 49908 8006E508 0007000D */  break     7
.L8006E50C:
/* 4990C 8006E50C 00004012 */  mflo      $t0
/* 49910 8006E510 00001810 */  mfhi      $v1
/* 49914 8006E514 3125FFFF */  andi      $a1, $t1, 0xFFFF
/* 49918 8006E518 00000000 */  nop
/* 4991C 8006E51C 01050018 */  mult      $t0, $a1
/* 49920 8006E520 00041402 */  srl       $v0, $a0, 16
/* 49924 8006E524 00031C00 */  sll       $v1, $v1, 16
/* 49928 8006E528 00621825 */  or        $v1, $v1, $v0
/* 4992C 8006E52C 00003812 */  mflo      $a3
/* 49930 8006E530 0067102B */  sltu      $v0, $v1, $a3
/* 49934 8006E534 5040000B */  beql      $v0, $zero, .L8006E564
/* 49938 8006E538 00671823 */   subu     $v1, $v1, $a3
/* 4993C 8006E53C 00691821 */  addu      $v1, $v1, $t1
/* 49940 8006E540 0069102B */  sltu      $v0, $v1, $t1
/* 49944 8006E544 14400006 */  bnez      $v0, .L8006E560
/* 49948 8006E548 2508FFFF */   addiu    $t0, $t0, -0x1
/* 4994C 8006E54C 0067102B */  sltu      $v0, $v1, $a3
/* 49950 8006E550 50400004 */  beql      $v0, $zero, .L8006E564
/* 49954 8006E554 00671823 */   subu     $v1, $v1, $a3
/* 49958 8006E558 2508FFFF */  addiu     $t0, $t0, -0x1
/* 4995C 8006E55C 00691821 */  addu      $v1, $v1, $t1
.L8006E560:
/* 49960 8006E560 00671823 */  subu      $v1, $v1, $a3
.L8006E564:
/* 49964 8006E564 14C00002 */  bnez      $a2, .L8006E570
/* 49968 8006E568 0066001B */   divu     $zero, $v1, $a2
/* 4996C 8006E56C 0007000D */  break     7
.L8006E570:
/* 49970 8006E570 00003012 */  mflo      $a2
/* 49974 8006E574 00001810 */  mfhi      $v1
/* 49978 8006E578 00000000 */  nop
/* 4997C 8006E57C 00000000 */  nop
/* 49980 8006E580 00C50018 */  mult      $a2, $a1
/* 49984 8006E584 3082FFFF */  andi      $v0, $a0, 0xFFFF
/* 49988 8006E588 00031C00 */  sll       $v1, $v1, 16
/* 4998C 8006E58C 00621825 */  or        $v1, $v1, $v0
/* 49990 8006E590 00003812 */  mflo      $a3
/* 49994 8006E594 0067102B */  sltu      $v0, $v1, $a3
/* 49998 8006E598 1040000B */  beqz      $v0, .L8006E5C8
/* 4999C 8006E59C 00081400 */   sll      $v0, $t0, 16
/* 499A0 8006E5A0 00691821 */  addu      $v1, $v1, $t1
/* 499A4 8006E5A4 0069102B */  sltu      $v0, $v1, $t1
/* 499A8 8006E5A8 14400006 */  bnez      $v0, .L8006E5C4
/* 499AC 8006E5AC 24C6FFFF */   addiu    $a2, $a2, -0x1
/* 499B0 8006E5B0 0067102B */  sltu      $v0, $v1, $a3
/* 499B4 8006E5B4 10400004 */  beqz      $v0, .L8006E5C8
/* 499B8 8006E5B8 00081400 */   sll      $v0, $t0, 16
/* 499BC 8006E5BC 24C6FFFF */  addiu     $a2, $a2, -0x1
/* 499C0 8006E5C0 00691821 */  addu      $v1, $v1, $t1
.L8006E5C4:
/* 499C4 8006E5C4 00081400 */  sll       $v0, $t0, 16
.L8006E5C8:
/* 499C8 8006E5C8 00465025 */  or        $t2, $v0, $a2
/* 499CC 8006E5CC 00672023 */  subu      $a0, $v1, $a3
.L8006E5D0:
/* 499D0 8006E5D0 00093402 */  srl       $a2, $t1, 16
/* 499D4 8006E5D4 14C00002 */  bnez      $a2, .L8006E5E0
/* 499D8 8006E5D8 0086001B */   divu     $zero, $a0, $a2
/* 499DC 8006E5DC 0007000D */  break     7
.L8006E5E0:
/* 499E0 8006E5E0 00003812 */  mflo      $a3
/* 499E4 8006E5E4 00001810 */  mfhi      $v1
/* 499E8 8006E5E8 3128FFFF */  andi      $t0, $t1, 0xFFFF
/* 499EC 8006E5EC 00000000 */  nop
/* 499F0 8006E5F0 00E80018 */  mult      $a3, $t0
/* 499F4 8006E5F4 000B1402 */  srl       $v0, $t3, 16
/* 499F8 8006E5F8 00031C00 */  sll       $v1, $v1, 16
/* 499FC 8006E5FC 00621825 */  or        $v1, $v1, $v0
/* 49A00 8006E600 00002812 */  mflo      $a1
/* 49A04 8006E604 0065102B */  sltu      $v0, $v1, $a1
/* 49A08 8006E608 5040000B */  beql      $v0, $zero, .L8006E638
/* 49A0C 8006E60C 00651823 */   subu     $v1, $v1, $a1
/* 49A10 8006E610 00691821 */  addu      $v1, $v1, $t1
/* 49A14 8006E614 0069102B */  sltu      $v0, $v1, $t1
/* 49A18 8006E618 14400006 */  bnez      $v0, .L8006E634
/* 49A1C 8006E61C 24E7FFFF */   addiu    $a3, $a3, -0x1
/* 49A20 8006E620 0065102B */  sltu      $v0, $v1, $a1
/* 49A24 8006E624 50400004 */  beql      $v0, $zero, .L8006E638
/* 49A28 8006E628 00651823 */   subu     $v1, $v1, $a1
/* 49A2C 8006E62C 24E7FFFF */  addiu     $a3, $a3, -0x1
/* 49A30 8006E630 00691821 */  addu      $v1, $v1, $t1
.L8006E634:
/* 49A34 8006E634 00651823 */  subu      $v1, $v1, $a1
.L8006E638:
/* 49A38 8006E638 14C00002 */  bnez      $a2, .L8006E644
/* 49A3C 8006E63C 0066001B */   divu     $zero, $v1, $a2
/* 49A40 8006E640 0007000D */  break     7
.L8006E644:
/* 49A44 8006E644 00002012 */  mflo      $a0
/* 49A48 8006E648 00001810 */  mfhi      $v1
/* 49A4C 8006E64C 00000000 */  nop
/* 49A50 8006E650 00000000 */  nop
/* 49A54 8006E654 00880018 */  mult      $a0, $t0
/* 49A58 8006E658 3162FFFF */  andi      $v0, $t3, 0xFFFF
/* 49A5C 8006E65C 00031C00 */  sll       $v1, $v1, 16
/* 49A60 8006E660 00621825 */  or        $v1, $v1, $v0
/* 49A64 8006E664 00002812 */  mflo      $a1
/* 49A68 8006E668 0065102B */  sltu      $v0, $v1, $a1
/* 49A6C 8006E66C 10400007 */  beqz      $v0, .L8006E68C
/* 49A70 8006E670 00691821 */   addu     $v1, $v1, $t1
/* 49A74 8006E674 0069102B */  sltu      $v0, $v1, $t1
/* 49A78 8006E678 14400004 */  bnez      $v0, .L8006E68C
/* 49A7C 8006E67C 2484FFFF */   addiu    $a0, $a0, -0x1
/* 49A80 8006E680 0065102B */  sltu      $v0, $v1, $a1
/* 49A84 8006E684 54400001 */  bnel      $v0, $zero, .L8006E68C
/* 49A88 8006E688 2484FFFF */   addiu    $a0, $a0, -0x1
.L8006E68C:
/* 49A8C 8006E68C 00071400 */  sll       $v0, $a3, 16
/* 49A90 8006E690 0801BA14 */  j         .L8006E850
/* 49A94 8006E694 00443025 */   or       $a2, $v0, $a0
.L8006E698:
/* 49A98 8006E698 0088102B */  sltu      $v0, $a0, $t0
/* 49A9C 8006E69C 10400003 */  beqz      $v0, .L8006E6AC
/* 49AA0 8006E6A0 3402FFFF */   ori      $v0, $zero, 0xFFFF
/* 49AA4 8006E6A4 0801BA13 */  j         .L8006E84C
/* 49AA8 8006E6A8 0000302D */   daddu    $a2, $zero, $zero
.L8006E6AC:
/* 49AAC 8006E6AC 0048102B */  sltu      $v0, $v0, $t0
/* 49AB0 8006E6B0 14400005 */  bnez      $v0, .L8006E6C8
/* 49AB4 8006E6B4 0100282D */   daddu    $a1, $t0, $zero
/* 49AB8 8006E6B8 2D020100 */  sltiu     $v0, $t0, 0x100
/* 49ABC 8006E6BC 38420001 */  xori      $v0, $v0, 0x1
/* 49AC0 8006E6C0 0801B9B8 */  j         .L8006E6E0
/* 49AC4 8006E6C4 000218C0 */   sll      $v1, $v0, 3
.L8006E6C8:
/* 49AC8 8006E6C8 3C0200FF */  lui       $v0, (0xFFFFFF >> 16)
/* 49ACC 8006E6CC 3442FFFF */  ori       $v0, $v0, (0xFFFFFF & 0xFFFF)
/* 49AD0 8006E6D0 0048102B */  sltu      $v0, $v0, $t0
/* 49AD4 8006E6D4 14400002 */  bnez      $v0, .L8006E6E0
/* 49AD8 8006E6D8 24030018 */   addiu    $v1, $zero, 0x18
/* 49ADC 8006E6DC 24030010 */  addiu     $v1, $zero, 0x10
.L8006E6E0:
/* 49AE0 8006E6E0 00651006 */  srlv      $v0, $a1, $v1
/* 49AE4 8006E6E4 3C01800A */  lui       $at, %hi(D_8009A040)
/* 49AE8 8006E6E8 00220821 */  addu      $at, $at, $v0
/* 49AEC 8006E6EC 9022A040 */  lbu       $v0, %lo(D_8009A040)($at)
/* 49AF0 8006E6F0 00431021 */  addu      $v0, $v0, $v1
/* 49AF4 8006E6F4 24030020 */  addiu     $v1, $zero, 0x20
/* 49AF8 8006E6F8 00623023 */  subu      $a2, $v1, $v0
/* 49AFC 8006E6FC 54C00009 */  bnel      $a2, $zero, .L8006E724
/* 49B00 8006E700 00662823 */   subu     $a1, $v1, $a2
/* 49B04 8006E704 0104102B */  sltu      $v0, $t0, $a0
/* 49B08 8006E708 14400050 */  bnez      $v0, .L8006E84C
/* 49B0C 8006E70C 24060001 */   addiu    $a2, $zero, 0x1
/* 49B10 8006E710 0169102B */  sltu      $v0, $t3, $t1
/* 49B14 8006E714 1440004D */  bnez      $v0, .L8006E84C
/* 49B18 8006E718 0000302D */   daddu    $a2, $zero, $zero
/* 49B1C 8006E71C 0801BA13 */  j         .L8006E84C
/* 49B20 8006E720 24060001 */   addiu    $a2, $zero, 0x1
.L8006E724:
/* 49B24 8006E724 00C81804 */  sllv      $v1, $t0, $a2
/* 49B28 8006E728 00A91006 */  srlv      $v0, $t1, $a1
/* 49B2C 8006E72C 00624025 */  or        $t0, $v1, $v0
/* 49B30 8006E730 00C94804 */  sllv      $t1, $t1, $a2
/* 49B34 8006E734 00A43806 */  srlv      $a3, $a0, $a1
/* 49B38 8006E738 00C41804 */  sllv      $v1, $a0, $a2
/* 49B3C 8006E73C 00AB1006 */  srlv      $v0, $t3, $a1
/* 49B40 8006E740 00622025 */  or        $a0, $v1, $v0
/* 49B44 8006E744 00CB5804 */  sllv      $t3, $t3, $a2
/* 49B48 8006E748 00083402 */  srl       $a2, $t0, 16
/* 49B4C 8006E74C 14C00002 */  bnez      $a2, .L8006E758
/* 49B50 8006E750 00E6001B */   divu     $zero, $a3, $a2
/* 49B54 8006E754 0007000D */  break     7
.L8006E758:
/* 49B58 8006E758 00005012 */  mflo      $t2
/* 49B5C 8006E75C 00001810 */  mfhi      $v1
/* 49B60 8006E760 3105FFFF */  andi      $a1, $t0, 0xFFFF
/* 49B64 8006E764 00000000 */  nop
/* 49B68 8006E768 01450018 */  mult      $t2, $a1
/* 49B6C 8006E76C 00041402 */  srl       $v0, $a0, 16
/* 49B70 8006E770 00031C00 */  sll       $v1, $v1, 16
/* 49B74 8006E774 00621825 */  or        $v1, $v1, $v0
/* 49B78 8006E778 00003812 */  mflo      $a3
/* 49B7C 8006E77C 0067102B */  sltu      $v0, $v1, $a3
/* 49B80 8006E780 5040000B */  beql      $v0, $zero, .L8006E7B0
/* 49B84 8006E784 00671823 */   subu     $v1, $v1, $a3
/* 49B88 8006E788 00681821 */  addu      $v1, $v1, $t0
/* 49B8C 8006E78C 0068102B */  sltu      $v0, $v1, $t0
/* 49B90 8006E790 14400006 */  bnez      $v0, .L8006E7AC
/* 49B94 8006E794 254AFFFF */   addiu    $t2, $t2, -0x1
/* 49B98 8006E798 0067102B */  sltu      $v0, $v1, $a3
/* 49B9C 8006E79C 50400004 */  beql      $v0, $zero, .L8006E7B0
/* 49BA0 8006E7A0 00671823 */   subu     $v1, $v1, $a3
/* 49BA4 8006E7A4 254AFFFF */  addiu     $t2, $t2, -0x1
/* 49BA8 8006E7A8 00681821 */  addu      $v1, $v1, $t0
.L8006E7AC:
/* 49BAC 8006E7AC 00671823 */  subu      $v1, $v1, $a3
.L8006E7B0:
/* 49BB0 8006E7B0 14C00002 */  bnez      $a2, .L8006E7BC
/* 49BB4 8006E7B4 0066001B */   divu     $zero, $v1, $a2
/* 49BB8 8006E7B8 0007000D */  break     7
.L8006E7BC:
/* 49BBC 8006E7BC 00003012 */  mflo      $a2
/* 49BC0 8006E7C0 00001810 */  mfhi      $v1
/* 49BC4 8006E7C4 00000000 */  nop
/* 49BC8 8006E7C8 00000000 */  nop
/* 49BCC 8006E7CC 00C50018 */  mult      $a2, $a1
/* 49BD0 8006E7D0 3082FFFF */  andi      $v0, $a0, 0xFFFF
/* 49BD4 8006E7D4 00031C00 */  sll       $v1, $v1, 16
/* 49BD8 8006E7D8 00621825 */  or        $v1, $v1, $v0
/* 49BDC 8006E7DC 00003812 */  mflo      $a3
/* 49BE0 8006E7E0 0067102B */  sltu      $v0, $v1, $a3
/* 49BE4 8006E7E4 1040000B */  beqz      $v0, .L8006E814
/* 49BE8 8006E7E8 000A1400 */   sll      $v0, $t2, 16
/* 49BEC 8006E7EC 00681821 */  addu      $v1, $v1, $t0
/* 49BF0 8006E7F0 0068102B */  sltu      $v0, $v1, $t0
/* 49BF4 8006E7F4 14400006 */  bnez      $v0, .L8006E810
/* 49BF8 8006E7F8 24C6FFFF */   addiu    $a2, $a2, -0x1
/* 49BFC 8006E7FC 0067102B */  sltu      $v0, $v1, $a3
/* 49C00 8006E800 10400004 */  beqz      $v0, .L8006E814
/* 49C04 8006E804 000A1400 */   sll      $v0, $t2, 16
/* 49C08 8006E808 24C6FFFF */  addiu     $a2, $a2, -0x1
/* 49C0C 8006E80C 00681821 */  addu      $v1, $v1, $t0
.L8006E810:
/* 49C10 8006E810 000A1400 */  sll       $v0, $t2, 16
.L8006E814:
/* 49C14 8006E814 00463025 */  or        $a2, $v0, $a2
/* 49C18 8006E818 00672023 */  subu      $a0, $v1, $a3
/* 49C1C 8006E81C 00C90019 */  multu     $a2, $t1
/* 49C20 8006E820 00001810 */  mfhi      $v1
/* 49C24 8006E824 0083102B */  sltu      $v0, $a0, $v1
/* 49C28 8006E828 00004012 */  mflo      $t0
/* 49C2C 8006E82C 54400007 */  bnel      $v0, $zero, .L8006E84C
/* 49C30 8006E830 24C6FFFF */   addiu    $a2, $a2, -0x1
/* 49C34 8006E834 14640006 */  bne       $v1, $a0, .L8006E850
/* 49C38 8006E838 0000502D */   daddu    $t2, $zero, $zero
/* 49C3C 8006E83C 0168102B */  sltu      $v0, $t3, $t0
/* 49C40 8006E840 10400004 */  beqz      $v0, .L8006E854
/* 49C44 8006E844 00C0682D */   daddu    $t5, $a2, $zero
/* 49C48 8006E848 24C6FFFF */  addiu     $a2, $a2, -0x1
.L8006E84C:
/* 49C4C 8006E84C 0000502D */  daddu     $t2, $zero, $zero
.L8006E850:
/* 49C50 8006E850 00C0682D */  daddu     $t5, $a2, $zero
.L8006E854:
/* 49C54 8006E854 0140602D */  daddu     $t4, $t2, $zero
/* 49C58 8006E858 0180102D */  daddu     $v0, $t4, $zero
/* 49C5C 8006E85C 03E00008 */  jr        $ra
/* 49C60 8006E860 01A0182D */   daddu    $v1, $t5, $zero
/* 49C64 8006E864 00000000 */  nop
/* 49C68 8006E868 00000000 */  nop
/* 49C6C 8006E86C 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

UDItype __udivdi3(UDItype n, UDItype d) {
    return __udivmoddi4(n, d, (UDItype *) 0);
}