### RAW ASSEMBLY INSTRUCTIONS:

glabel func_80032C64
/* E064 80032C64 27BDFF68 */  addiu     $sp, $sp, -0x98
/* E068 80032C68 AFB10054 */  sw        $s1, 0x54($sp)
/* E06C 80032C6C 0080882D */  daddu     $s1, $a0, $zero
/* E070 80032C70 AFBF0068 */  sw        $ra, 0x68($sp)
/* E074 80032C74 AFB50064 */  sw        $s5, 0x64($sp)
/* E078 80032C78 AFB40060 */  sw        $s4, 0x60($sp)
/* E07C 80032C7C AFB3005C */  sw        $s3, 0x5C($sp)
/* E080 80032C80 AFB20058 */  sw        $s2, 0x58($sp)
/* E084 80032C84 AFB00050 */  sw        $s0, 0x50($sp)
/* E088 80032C88 F7BC0090 */  sdc1      $f28, 0x90($sp)
/* E08C 80032C8C F7BA0088 */  sdc1      $f26, 0x88($sp)
/* E090 80032C90 F7B80080 */  sdc1      $f24, 0x80($sp)
/* E094 80032C94 F7B60078 */  sdc1      $f22, 0x78($sp)
/* E098 80032C98 F7B40070 */  sdc1      $f20, 0x70($sp)
/* E09C 80032C9C C6200084 */  lwc1      $f0, 0x84($s1)
/* E0A0 80032CA0 3C014334 */  lui       $at, (0x43340000 >> 16)
/* E0A4 80032CA4 44811000 */  mtc1      $at, $f2
/* E0A8 80032CA8 3C014049 */  lui       $at, (0x40490FD8 >> 16)
/* E0AC 80032CAC 34210FD8 */  ori       $at, $at, (0x40490FD8 & 0xFFFF)
/* E0B0 80032CB0 44812000 */  mtc1      $at, $f4
/* E0B4 80032CB4 46020003 */  div.s     $f0, $f0, $f2
/* E0B8 80032CB8 46040502 */  mul.s     $f20, $f0, $f4
/* E0BC 80032CBC 00000000 */  nop
/* E0C0 80032CC0 0000902D */  daddu     $s2, $zero, $zero
/* E0C4 80032CC4 C63A050C */  lwc1      $f26, 0x50C($s1)
/* E0C8 80032CC8 0C00A874 */  jal       cos_rad
/* E0CC 80032CCC 4600A306 */   mov.s    $f12, $f20
/* E0D0 80032CD0 0C00A85B */  jal       sin_rad
/* E0D4 80032CD4 4600A306 */   mov.s    $f12, $f20
/* E0D8 80032CD8 C6200064 */  lwc1      $f0, 0x64($s1)
/* E0DC 80032CDC 3C014120 */  lui       $at, (0x41200000 >> 16)
/* E0E0 80032CE0 44817000 */  mtc1      $at, $f14
/* E0E4 80032CE4 C62C0060 */  lwc1      $f12, 0x60($s1)
/* E0E8 80032CE8 460E0380 */  add.s     $f14, $f0, $f14
/* E0EC 80032CEC 8E260068 */  lw        $a2, 0x68($s1)
/* E0F0 80032CF0 0C00C884 */  jal       test_ray_zone
/* E0F4 80032CF4 0240382D */   daddu    $a3, $s2, $zero
/* E0F8 80032CF8 0040802D */  daddu     $s0, $v0, $zero
/* E0FC 80032CFC 120000A1 */  beqz      $s0, .L80032F84
/* E100 80032D00 0200982D */   daddu    $s3, $s0, $zero
/* E104 80032D04 8E030000 */  lw        $v1, 0x0($s0)
/* E108 80032D08 24020002 */  addiu     $v0, $zero, 0x2
/* E10C 80032D0C 1062000A */  beq       $v1, $v0, .L80032D38
/* E110 80032D10 24020005 */   addiu    $v0, $zero, 0x5
/* E114 80032D14 10620008 */  beq       $v1, $v0, .L80032D38
/* E118 80032D18 00000000 */   nop
/* E11C 80032D1C 8E250060 */  lw        $a1, 0x60($s1)
/* E120 80032D20 8E260068 */  lw        $a2, 0x68($s1)
/* E124 80032D24 0C00CA29 */  jal       func_800328A4
/* E128 80032D28 0200202D */   daddu    $a0, $s0, $zero
/* E12C 80032D2C 0040902D */  daddu     $s2, $v0, $zero
/* E130 80032D30 12400094 */  beqz      $s2, .L80032F84
/* E134 80032D34 00000000 */   nop
.L80032D38:
/* E138 80032D38 8E220530 */  lw        $v0, 0x530($s1)
/* E13C 80032D3C 10400049 */  beqz      $v0, .L80032E64
/* E140 80032D40 00000000 */   nop
/* E144 80032D44 263000D4 */  addiu     $s0, $s1, 0xD4
/* E148 80032D48 0200202D */  daddu     $a0, $s0, $zero
/* E14C 80032D4C 8627000A */  lh        $a3, 0xA($s1)
/* E150 80032D50 86220012 */  lh        $v0, 0x12($s1)
/* E154 80032D54 8623000C */  lh        $v1, 0xC($s1)
/* E158 80032D58 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* E15C 80032D5C 4481A000 */  mtc1      $at, $f20
/* E160 80032D60 44820000 */  mtc1      $v0, $f0
/* E164 80032D64 00000000 */  nop
/* E168 80032D68 46800020 */  cvt.s.w   $f0, $f0
/* E16C 80032D6C E7A00010 */  swc1      $f0, 0x10($sp)
/* E170 80032D70 86220014 */  lh        $v0, 0x14($s1)
/* E174 80032D74 44871000 */  mtc1      $a3, $f2
/* E178 80032D78 00000000 */  nop
/* E17C 80032D7C 468010A0 */  cvt.s.w   $f2, $f2
/* E180 80032D80 E7B40018 */  swc1      $f20, 0x18($sp)
/* E184 80032D84 44820000 */  mtc1      $v0, $f0
/* E188 80032D88 00000000 */  nop
/* E18C 80032D8C 46800020 */  cvt.s.w   $f0, $f0
/* E190 80032D90 E7A00014 */  swc1      $f0, 0x14($sp)
/* E194 80032D94 44830000 */  mtc1      $v1, $f0
/* E198 80032D98 00000000 */  nop
/* E19C 80032D9C 46800020 */  cvt.s.w   $f0, $f0
/* E1A0 80032DA0 46001083 */  div.s     $f2, $f2, $f0
/* E1A4 80032DA4 8E260018 */  lw        $a2, 0x18($s1)
/* E1A8 80032DA8 44071000 */  mfc1      $a3, $f2
/* E1AC 80032DAC 0C018EE4 */  jal       guPerspectiveF
/* E1B0 80032DB0 26250038 */   addiu    $a1, $s1, 0x38
/* E1B4 80032DB4 26240114 */  addiu     $a0, $s1, 0x114
/* E1B8 80032DB8 0200282D */  daddu     $a1, $s0, $zero
/* E1BC 80032DBC 0C019D80 */  jal       guMtxCatF
/* E1C0 80032DC0 0200302D */   daddu    $a2, $s0, $zero
/* E1C4 80032DC4 27A20030 */  addiu     $v0, $sp, 0x30
/* E1C8 80032DC8 AFA20014 */  sw        $v0, 0x14($sp)
/* E1CC 80032DCC 27A20034 */  addiu     $v0, $sp, 0x34
/* E1D0 80032DD0 AFA20018 */  sw        $v0, 0x18($sp)
/* E1D4 80032DD4 27A20038 */  addiu     $v0, $sp, 0x38
/* E1D8 80032DD8 AFA2001C */  sw        $v0, 0x1C($sp)
/* E1DC 80032DDC 27A2003C */  addiu     $v0, $sp, 0x3C
/* E1E0 80032DE0 E7B40010 */  swc1      $f20, 0x10($sp)
/* E1E4 80032DE4 AFA20020 */  sw        $v0, 0x20($sp)
/* E1E8 80032DE8 8E250060 */  lw        $a1, 0x60($s1)
/* E1EC 80032DEC 8E260064 */  lw        $a2, 0x64($s1)
/* E1F0 80032DF0 8E270068 */  lw        $a3, 0x68($s1)
/* E1F4 80032DF4 0C00A588 */  jal       transform_point
/* E1F8 80032DF8 0200202D */   daddu    $a0, $s0, $zero
/* E1FC 80032DFC C7A0003C */  lwc1      $f0, 0x3C($sp)
/* E200 80032E00 44802000 */  mtc1      $zero, $f4
/* E204 80032E04 00000000 */  nop
/* E208 80032E08 46040032 */  c.eq.s    $f0, $f4
/* E20C 80032E0C 00000000 */  nop
/* E210 80032E10 45030001 */  bc1tl     .L80032E18
/* E214 80032E14 E7B4003C */   swc1     $f20, 0x3C($sp)
.L80032E18:
/* E218 80032E18 C7A0003C */  lwc1      $f0, 0x3C($sp)
/* E21C 80032E1C C7A20030 */  lwc1      $f2, 0x30($sp)
/* E220 80032E20 4600A003 */  div.s     $f0, $f20, $f0
/* E224 80032E24 46001082 */  mul.s     $f2, $f2, $f0
/* E228 80032E28 00000000 */  nop
/* E22C 80032E2C 2623052C */  addiu     $v1, $s1, 0x52C
/* E230 80032E30 E7A0003C */  swc1      $f0, 0x3C($sp)
/* E234 80032E34 4602203C */  c.lt.s    $f4, $f2
/* E238 80032E38 E7A20030 */  swc1      $f2, 0x30($sp)
/* E23C 80032E3C 45010006 */  bc1t      .L80032E58
/* E240 80032E40 24020001 */   addiu    $v0, $zero, 0x1
/* E244 80032E44 4604103C */  c.lt.s    $f2, $f4
/* E248 80032E48 00000000 */  nop
/* E24C 80032E4C 45000002 */  bc1f      .L80032E58
/* E250 80032E50 0000102D */   daddu    $v0, $zero, $zero
/* E254 80032E54 2402FFFF */  addiu     $v0, $zero, -0x1
.L80032E58:
/* E258 80032E58 AC620000 */  sw        $v0, 0x0($v1)
/* E25C 80032E5C 0800CBC9 */  j         .L80032F24
/* E260 80032E60 AE200530 */   sw       $zero, 0x530($s1)
.L80032E64:
/* E264 80032E64 8E220534 */  lw        $v0, 0x534($s1)
/* E268 80032E68 10400011 */  beqz      $v0, .L80032EB0
/* E26C 80032E6C 00000000 */   nop
/* E270 80032E70 8C430000 */  lw        $v1, 0x0($v0)
/* E274 80032E74 24020002 */  addiu     $v0, $zero, 0x2
/* E278 80032E78 1062002A */  beq       $v1, $v0, .L80032F24
/* E27C 80032E7C 24020005 */   addiu    $v0, $zero, 0x5
/* E280 80032E80 10620028 */  beq       $v1, $v0, .L80032F24
/* E284 80032E84 00000000 */   nop
/* E288 80032E88 8E250524 */  lw        $a1, 0x524($s1)
/* E28C 80032E8C 8E260528 */  lw        $a2, 0x528($s1)
/* E290 80032E90 0C00CA29 */  jal       func_800328A4
/* E294 80032E94 0200202D */   daddu    $a0, $s0, $zero
/* E298 80032E98 14400022 */  bnez      $v0, .L80032F24
/* E29C 80032E9C 00000000 */   nop
/* E2A0 80032EA0 12400003 */  beqz      $s2, .L80032EB0
/* E2A4 80032EA4 00000000 */   nop
/* E2A8 80032EA8 0800CBC9 */  j         .L80032F24
/* E2AC 80032EAC AE32052C */   sw       $s2, 0x52C($s1)
.L80032EB0:
/* E2B0 80032EB0 C6380060 */  lwc1      $f24, 0x60($s1)
/* E2B4 80032EB4 C6200524 */  lwc1      $f0, 0x524($s1)
/* E2B8 80032EB8 C6360068 */  lwc1      $f22, 0x68($s1)
/* E2BC 80032EBC 4600C601 */  sub.s     $f24, $f24, $f0
/* E2C0 80032EC0 C6200528 */  lwc1      $f0, 0x528($s1)
/* E2C4 80032EC4 C62C006C */  lwc1      $f12, 0x6C($s1)
/* E2C8 80032EC8 0C00A8D4 */  jal       cos_deg
/* E2CC 80032ECC 4600B581 */   sub.s    $f22, $f22, $f0
/* E2D0 80032ED0 C62C006C */  lwc1      $f12, 0x6C($s1)
/* E2D4 80032ED4 0C00A8BB */  jal       sin_deg
/* E2D8 80032ED8 46000507 */   neg.s    $f20, $f0
/* E2DC 80032EDC 4614C602 */  mul.s     $f24, $f24, $f20
/* E2E0 80032EE0 00000000 */  nop
/* E2E4 80032EE4 46000007 */  neg.s     $f0, $f0
/* E2E8 80032EE8 4600B582 */  mul.s     $f22, $f22, $f0
/* E2EC 80032EEC 00000000 */  nop
/* E2F0 80032EF0 4616C600 */  add.s     $f24, $f24, $f22
/* E2F4 80032EF4 44800000 */  mtc1      $zero, $f0
/* E2F8 80032EF8 00000000 */  nop
/* E2FC 80032EFC 4618003C */  c.lt.s    $f0, $f24
/* E300 80032F00 00000000 */  nop
/* E304 80032F04 45010006 */  bc1t      .L80032F20
/* E308 80032F08 2402FFFF */   addiu    $v0, $zero, -0x1
/* E30C 80032F0C 4600C03C */  c.lt.s    $f24, $f0
/* E310 80032F10 00000000 */  nop
/* E314 80032F14 45010002 */  bc1t      .L80032F20
/* E318 80032F18 24020001 */   addiu    $v0, $zero, 0x1
/* E31C 80032F1C 0000102D */  daddu     $v0, $zero, $zero
.L80032F20:
/* E320 80032F20 AE22052C */  sw        $v0, 0x52C($s1)
.L80032F24:
/* E324 80032F24 44800000 */  mtc1      $zero, $f0
/* E328 80032F28 00000000 */  nop
/* E32C 80032F2C 461A003C */  c.lt.s    $f0, $f26
/* E330 80032F30 00000000 */  nop
/* E334 80032F34 45000004 */  bc1f      .L80032F48
/* E338 80032F38 00000000 */   nop
/* E33C 80032F3C 8E22052C */  lw        $v0, 0x52C($s1)
/* E340 80032F40 5C400009 */  bgtzl     $v0, .L80032F68
/* E344 80032F44 AE200514 */   sw       $zero, 0x514($s1)
.L80032F48:
/* E348 80032F48 4600D03C */  c.lt.s    $f26, $f0
/* E34C 80032F4C 00000000 */  nop
/* E350 80032F50 45000006 */  bc1f      .L80032F6C
/* E354 80032F54 00000000 */   nop
/* E358 80032F58 8E22052C */  lw        $v0, 0x52C($s1)
/* E35C 80032F5C 04410003 */  bgez      $v0, .L80032F6C
/* E360 80032F60 00000000 */   nop
/* E364 80032F64 AE200514 */  sw        $zero, 0x514($s1)
.L80032F68:
/* E368 80032F68 AE20050C */  sw        $zero, 0x50C($s1)
.L80032F6C:
/* E36C 80032F6C C6200060 */  lwc1      $f0, 0x60($s1)
/* E370 80032F70 C6220068 */  lwc1      $f2, 0x68($s1)
/* E374 80032F74 AE330534 */  sw        $s3, 0x534($s1)
/* E378 80032F78 E6200524 */  swc1      $f0, 0x524($s1)
/* E37C 80032F7C 0800CCD7 */  j         .L8003335C
/* E380 80032F80 E6220528 */   swc1     $f2, 0x528($s1)
.L80032F84:
/* E384 80032F84 C6200060 */  lwc1      $f0, 0x60($s1)
/* E388 80032F88 C6220068 */  lwc1      $f2, 0x68($s1)
/* E38C 80032F8C 4600A306 */  mov.s     $f12, $f20
/* E390 80032F90 AE20052C */  sw        $zero, 0x52C($s1)
/* E394 80032F94 AE330534 */  sw        $s3, 0x534($s1)
/* E398 80032F98 E6200524 */  swc1      $f0, 0x524($s1)
/* E39C 80032F9C 0C00A874 */  jal       cos_rad
/* E3A0 80032FA0 E6220528 */   swc1     $f2, 0x528($s1)
/* E3A4 80032FA4 4600D002 */  mul.s     $f0, $f26, $f0
/* E3A8 80032FA8 00000000 */  nop
/* E3AC 80032FAC C6220060 */  lwc1      $f2, 0x60($s1)
/* E3B0 80032FB0 46001700 */  add.s     $f28, $f2, $f0
/* E3B4 80032FB4 0C00A85B */  jal       sin_rad
/* E3B8 80032FB8 4600A306 */   mov.s    $f12, $f20
/* E3BC 80032FBC 4600D002 */  mul.s     $f0, $f26, $f0
/* E3C0 80032FC0 00000000 */  nop
/* E3C4 80032FC4 C6220068 */  lwc1      $f2, 0x68($s1)
/* E3C8 80032FC8 3C014120 */  lui       $at, (0x41200000 >> 16)
/* E3CC 80032FCC 44817000 */  mtc1      $at, $f14
/* E3D0 80032FD0 46001680 */  add.s     $f26, $f2, $f0
/* E3D4 80032FD4 C6200064 */  lwc1      $f0, 0x64($s1)
/* E3D8 80032FD8 27A70040 */  addiu     $a3, $sp, 0x40
/* E3DC 80032FDC 460E0380 */  add.s     $f14, $f0, $f14
/* E3E0 80032FE0 4406D000 */  mfc1      $a2, $f26
/* E3E4 80032FE4 0C00C884 */  jal       test_ray_zone
/* E3E8 80032FE8 4600E306 */   mov.s    $f12, $f28
/* E3EC 80032FEC 0040802D */  daddu     $s0, $v0, $zero
/* E3F0 80032FF0 120000DA */  beqz      $s0, .L8003335C
/* E3F4 80032FF4 24020002 */   addiu    $v0, $zero, 0x2
/* E3F8 80032FF8 8E040000 */  lw        $a0, 0x0($s0)
/* E3FC 80032FFC 1082000A */  beq       $a0, $v0, .L80033028
/* E400 80033000 24020005 */   addiu    $v0, $zero, 0x5
/* E404 80033004 10820008 */  beq       $a0, $v0, .L80033028
/* E408 80033008 00000000 */   nop
/* E40C 8003300C 8E240534 */  lw        $a0, 0x534($s1)
/* E410 80033010 4405E000 */  mfc1      $a1, $f28
/* E414 80033014 4406D000 */  mfc1      $a2, $f26
/* E418 80033018 0C00CA29 */  jal       func_800328A4
/* E41C 8003301C 00000000 */   nop
/* E420 80033020 104000CE */  beqz      $v0, .L8003335C
/* E424 80033024 00000000 */   nop
.L80033028:
/* E428 80033028 8E240534 */  lw        $a0, 0x534($s1)
/* E42C 8003302C 3C014974 */  lui       $at, (0x49742400 >> 16)
/* E430 80033030 34212400 */  ori       $at, $at, (0x49742400 & 0xFFFF)
/* E434 80033034 4481A000 */  mtc1      $at, $f20
/* E438 80033038 10800043 */  beqz      $a0, .L80033148
/* E43C 8003303C 24120001 */   addiu    $s2, $zero, 0x1
/* E440 80033040 8C830000 */  lw        $v1, 0x0($a0)
/* E444 80033044 24020006 */  addiu     $v0, $zero, 0x6
/* E448 80033048 1462003F */  bne       $v1, $v0, .L80033148
/* E44C 8003304C 0080802D */   daddu    $s0, $a0, $zero
/* E450 80033050 C6200060 */  lwc1      $f0, 0x60($s1)
/* E454 80033054 C6080018 */  lwc1      $f8, 0x18($s0)
/* E458 80033058 C604000C */  lwc1      $f4, 0xC($s0)
/* E45C 8003305C C6020020 */  lwc1      $f2, 0x20($s0)
/* E460 80033060 C6060014 */  lwc1      $f6, 0x14($s0)
/* E464 80033064 E7A00010 */  swc1      $f0, 0x10($sp)
/* E468 80033068 C6200068 */  lwc1      $f0, 0x68($s1)
/* E46C 8003306C 27A20044 */  addiu     $v0, $sp, 0x44
/* E470 80033070 AFA20020 */  sw        $v0, 0x20($sp)
/* E474 80033074 27A20048 */  addiu     $v0, $sp, 0x48
/* E478 80033078 46061601 */  sub.s     $f24, $f2, $f6
/* E47C 8003307C AFA20024 */  sw        $v0, 0x24($sp)
/* E480 80033080 27A2004C */  addiu     $v0, $sp, 0x4C
/* E484 80033084 46044581 */  sub.s     $f22, $f8, $f4
/* E488 80033088 E7BC0018 */  swc1      $f28, 0x18($sp)
/* E48C 8003308C E7BA001C */  swc1      $f26, 0x1C($sp)
/* E490 80033090 AFA20028 */  sw        $v0, 0x28($sp)
/* E494 80033094 46182281 */  sub.s     $f10, $f4, $f24
/* E498 80033098 E7A00014 */  swc1      $f0, 0x14($sp)
/* E49C 8003309C C60C000C */  lwc1      $f12, 0xC($s0)
/* E4A0 800330A0 46163180 */  add.s     $f6, $f6, $f22
/* E4A4 800330A4 C60E0014 */  lwc1      $f14, 0x14($s0)
/* E4A8 800330A8 44065000 */  mfc1      $a2, $f10
/* E4AC 800330AC 44073000 */  mfc1      $a3, $f6
/* E4B0 800330B0 0C00C979 */  jal       calculate_line_segment_intersection
/* E4B4 800330B4 0000902D */   daddu    $s2, $zero, $zero
/* E4B8 800330B8 10400006 */  beqz      $v0, .L800330D4
/* E4BC 800330BC 00000000 */   nop
/* E4C0 800330C0 C7A0004C */  lwc1      $f0, 0x4C($sp)
/* E4C4 800330C4 4614003C */  c.lt.s    $f0, $f20
/* E4C8 800330C8 00000000 */  nop
/* E4CC 800330CC 45030001 */  bc1tl     .L800330D4
/* E4D0 800330D0 46000506 */   mov.s    $f20, $f0
.L800330D4:
/* E4D4 800330D4 C6200060 */  lwc1      $f0, 0x60($s1)
/* E4D8 800330D8 C6020018 */  lwc1      $f2, 0x18($s0)
/* E4DC 800330DC C6040020 */  lwc1      $f4, 0x20($s0)
/* E4E0 800330E0 E7A00010 */  swc1      $f0, 0x10($sp)
/* E4E4 800330E4 C6200068 */  lwc1      $f0, 0x68($s1)
/* E4E8 800330E8 27A20044 */  addiu     $v0, $sp, 0x44
/* E4EC 800330EC AFA20020 */  sw        $v0, 0x20($sp)
/* E4F0 800330F0 27A20048 */  addiu     $v0, $sp, 0x48
/* E4F4 800330F4 46181081 */  sub.s     $f2, $f2, $f24
/* E4F8 800330F8 AFA20024 */  sw        $v0, 0x24($sp)
/* E4FC 800330FC 27A2004C */  addiu     $v0, $sp, 0x4C
/* E500 80033100 46162100 */  add.s     $f4, $f4, $f22
/* E504 80033104 E7BC0018 */  swc1      $f28, 0x18($sp)
/* E508 80033108 E7BA001C */  swc1      $f26, 0x1C($sp)
/* E50C 8003310C AFA20028 */  sw        $v0, 0x28($sp)
/* E510 80033110 E7A00014 */  swc1      $f0, 0x14($sp)
/* E514 80033114 C60C0018 */  lwc1      $f12, 0x18($s0)
/* E518 80033118 C60E0020 */  lwc1      $f14, 0x20($s0)
/* E51C 8003311C 44061000 */  mfc1      $a2, $f2
/* E520 80033120 44072000 */  mfc1      $a3, $f4
/* E524 80033124 0C00C979 */  jal       calculate_line_segment_intersection
/* E528 80033128 00000000 */   nop
/* E52C 8003312C 10400006 */  beqz      $v0, .L80033148
/* E530 80033130 00000000 */   nop
/* E534 80033134 C7A0004C */  lwc1      $f0, 0x4C($sp)
/* E538 80033138 4614003C */  c.lt.s    $f0, $f20
/* E53C 8003313C 00000000 */  nop
/* E540 80033140 45030001 */  bc1tl     .L80033148
/* E544 80033144 46000506 */   mov.s    $f20, $f0
.L80033148:
/* E548 80033148 1240005C */  beqz      $s2, .L800332BC
/* E54C 8003314C 00000000 */   nop
/* E550 80033150 8FA30040 */  lw        $v1, 0x40($sp)
/* E554 80033154 8462000A */  lh        $v0, 0xA($v1)
/* E558 80033158 18400058 */  blez      $v0, .L800332BC
/* E55C 8003315C 0000902D */   daddu    $s2, $zero, $zero
/* E560 80033160 27B50044 */  addiu     $s5, $sp, 0x44
/* E564 80033164 27B40048 */  addiu     $s4, $sp, 0x48
/* E568 80033168 27B3004C */  addiu     $s3, $sp, 0x4C
/* E56C 8003316C 0240802D */  daddu     $s0, $s2, $zero
.L80033170:
/* E570 80033170 8C62000C */  lw        $v0, 0xC($v1)
/* E574 80033174 C6200060 */  lwc1      $f0, 0x60($s1)
/* E578 80033178 02021021 */  addu      $v0, $s0, $v0
/* E57C 8003317C 8C430000 */  lw        $v1, 0x0($v0)
/* E580 80033180 8C420004 */  lw        $v0, 0x4($v0)
/* E584 80033184 E7A00010 */  swc1      $f0, 0x10($sp)
/* E588 80033188 C6200068 */  lwc1      $f0, 0x68($s1)
/* E58C 8003318C E7BC0018 */  swc1      $f28, 0x18($sp)
/* E590 80033190 E7BA001C */  swc1      $f26, 0x1C($sp)
/* E594 80033194 AFB50020 */  sw        $s5, 0x20($sp)
/* E598 80033198 AFB40024 */  sw        $s4, 0x24($sp)
/* E59C 8003319C AFB30028 */  sw        $s3, 0x28($sp)
/* E5A0 800331A0 E7A00014 */  swc1      $f0, 0x14($sp)
/* E5A4 800331A4 C46C0000 */  lwc1      $f12, 0x0($v1)
/* E5A8 800331A8 C46E0008 */  lwc1      $f14, 0x8($v1)
/* E5AC 800331AC 8C460000 */  lw        $a2, 0x0($v0)
/* E5B0 800331B0 0C00C8B7 */  jal       calculate_segment_intersection
/* E5B4 800331B4 8C470008 */   lw       $a3, 0x8($v0)
/* E5B8 800331B8 10400006 */  beqz      $v0, .L800331D4
/* E5BC 800331BC 00000000 */   nop
/* E5C0 800331C0 C7A0004C */  lwc1      $f0, 0x4C($sp)
/* E5C4 800331C4 4614003C */  c.lt.s    $f0, $f20
/* E5C8 800331C8 00000000 */  nop
/* E5CC 800331CC 45030001 */  bc1tl     .L800331D4
/* E5D0 800331D0 46000506 */   mov.s    $f20, $f0
.L800331D4:
/* E5D4 800331D4 8FA20040 */  lw        $v0, 0x40($sp)
/* E5D8 800331D8 8C42000C */  lw        $v0, 0xC($v0)
/* E5DC 800331DC C6200060 */  lwc1      $f0, 0x60($s1)
/* E5E0 800331E0 02021021 */  addu      $v0, $s0, $v0
/* E5E4 800331E4 8C430004 */  lw        $v1, 0x4($v0)
/* E5E8 800331E8 8C420008 */  lw        $v0, 0x8($v0)
/* E5EC 800331EC E7A00010 */  swc1      $f0, 0x10($sp)
/* E5F0 800331F0 C6200068 */  lwc1      $f0, 0x68($s1)
/* E5F4 800331F4 E7BC0018 */  swc1      $f28, 0x18($sp)
/* E5F8 800331F8 E7BA001C */  swc1      $f26, 0x1C($sp)
/* E5FC 800331FC AFB50020 */  sw        $s5, 0x20($sp)
/* E600 80033200 AFB40024 */  sw        $s4, 0x24($sp)
/* E604 80033204 AFB30028 */  sw        $s3, 0x28($sp)
/* E608 80033208 E7A00014 */  swc1      $f0, 0x14($sp)
/* E60C 8003320C C46C0000 */  lwc1      $f12, 0x0($v1)
/* E610 80033210 C46E0008 */  lwc1      $f14, 0x8($v1)
/* E614 80033214 8C460000 */  lw        $a2, 0x0($v0)
/* E618 80033218 0C00C8B7 */  jal       calculate_segment_intersection
/* E61C 8003321C 8C470008 */   lw       $a3, 0x8($v0)
/* E620 80033220 10400006 */  beqz      $v0, .L8003323C
/* E624 80033224 00000000 */   nop
/* E628 80033228 C7A0004C */  lwc1      $f0, 0x4C($sp)
/* E62C 8003322C 4614003C */  c.lt.s    $f0, $f20
/* E630 80033230 00000000 */  nop
/* E634 80033234 45030001 */  bc1tl     .L8003323C
/* E638 80033238 46000506 */   mov.s    $f20, $f0
.L8003323C:
/* E63C 8003323C 8FA20040 */  lw        $v0, 0x40($sp)
/* E640 80033240 8C42000C */  lw        $v0, 0xC($v0)
/* E644 80033244 C6200060 */  lwc1      $f0, 0x60($s1)
/* E648 80033248 02021021 */  addu      $v0, $s0, $v0
/* E64C 8003324C 8C430008 */  lw        $v1, 0x8($v0)
/* E650 80033250 8C420000 */  lw        $v0, 0x0($v0)
/* E654 80033254 E7A00010 */  swc1      $f0, 0x10($sp)
/* E658 80033258 C6200068 */  lwc1      $f0, 0x68($s1)
/* E65C 8003325C E7BC0018 */  swc1      $f28, 0x18($sp)
/* E660 80033260 E7BA001C */  swc1      $f26, 0x1C($sp)
/* E664 80033264 AFB50020 */  sw        $s5, 0x20($sp)
/* E668 80033268 AFB40024 */  sw        $s4, 0x24($sp)
/* E66C 8003326C AFB30028 */  sw        $s3, 0x28($sp)
/* E670 80033270 E7A00014 */  swc1      $f0, 0x14($sp)
/* E674 80033274 C46C0000 */  lwc1      $f12, 0x0($v1)
/* E678 80033278 C46E0008 */  lwc1      $f14, 0x8($v1)
/* E67C 8003327C 8C460000 */  lw        $a2, 0x0($v0)
/* E680 80033280 0C00C8B7 */  jal       calculate_segment_intersection
/* E684 80033284 8C470008 */   lw       $a3, 0x8($v0)
/* E688 80033288 10400006 */  beqz      $v0, .L800332A4
/* E68C 8003328C 00000000 */   nop
/* E690 80033290 C7A0004C */  lwc1      $f0, 0x4C($sp)
/* E694 80033294 4614003C */  c.lt.s    $f0, $f20
/* E698 80033298 00000000 */  nop
/* E69C 8003329C 45030001 */  bc1tl     .L800332A4
/* E6A0 800332A0 46000506 */   mov.s    $f20, $f0
.L800332A4:
/* E6A4 800332A4 8FA30040 */  lw        $v1, 0x40($sp)
/* E6A8 800332A8 8462000A */  lh        $v0, 0xA($v1)
/* E6AC 800332AC 26520001 */  addiu     $s2, $s2, 0x1
/* E6B0 800332B0 0242102A */  slt       $v0, $s2, $v0
/* E6B4 800332B4 1440FFAE */  bnez      $v0, .L80033170
/* E6B8 800332B8 26100040 */   addiu    $s0, $s0, 0x40
.L800332BC:
/* E6BC 800332BC 3C014974 */  lui       $at, (0x49742400 >> 16)
/* E6C0 800332C0 34212400 */  ori       $at, $at, (0x49742400 & 0xFFFF)
/* E6C4 800332C4 44810000 */  mtc1      $at, $f0
/* E6C8 800332C8 00000000 */  nop
/* E6CC 800332CC 4600A032 */  c.eq.s    $f20, $f0
/* E6D0 800332D0 00000000 */  nop
/* E6D4 800332D4 45030020 */  bc1tl     .L80033358
/* E6D8 800332D8 AE20050C */   sw       $zero, 0x50C($s1)
/* E6DC 800332DC 44801000 */  mtc1      $zero, $f2
/* E6E0 800332E0 00000000 */  nop
/* E6E4 800332E4 4602A032 */  c.eq.s    $f20, $f2
/* E6E8 800332E8 00000000 */  nop
/* E6EC 800332EC 45000003 */  bc1f      .L800332FC
/* E6F0 800332F0 00000000 */   nop
/* E6F4 800332F4 0800CCD6 */  j         .L80033358
/* E6F8 800332F8 AE20050C */   sw       $zero, 0x50C($s1)
.L800332FC:
/* E6FC 800332FC C620050C */  lwc1      $f0, 0x50C($s1)
/* E700 80033300 4600103C */  c.lt.s    $f2, $f0
/* E704 80033304 00000000 */  nop
/* E708 80033308 4500000A */  bc1f      .L80033334
/* E70C 8003330C 2630050C */   addiu    $s0, $s1, 0x50C
/* E710 80033310 4600A004 */  sqrt.s    $f0, $f20
/* E714 80033314 46000032 */  c.eq.s    $f0, $f0
/* E718 80033318 00000000 */  nop
/* E71C 8003331C 4503000E */  bc1tl     .L80033358
/* E720 80033320 E6000000 */   swc1     $f0, 0x0($s0)
/* E724 80033324 0C0187BC */  jal       sqrtf
/* E728 80033328 4600A306 */   mov.s    $f12, $f20
/* E72C 8003332C 0800CCD6 */  j         .L80033358
/* E730 80033330 E6000000 */   swc1     $f0, 0x0($s0)
.L80033334:
/* E734 80033334 4600A004 */  sqrt.s    $f0, $f20
/* E738 80033338 46000032 */  c.eq.s    $f0, $f0
/* E73C 8003333C 00000000 */  nop
/* E740 80033340 45030004 */  bc1tl     .L80033354
/* E744 80033344 46000007 */   neg.s    $f0, $f0
/* E748 80033348 0C0187BC */  jal       sqrtf
/* E74C 8003334C 4600A306 */   mov.s    $f12, $f20
/* E750 80033350 46000007 */  neg.s     $f0, $f0
.L80033354:
/* E754 80033354 E6000000 */  swc1      $f0, 0x0($s0)
.L80033358:
/* E758 80033358 AE200514 */  sw        $zero, 0x514($s1)
.L8003335C:
/* E75C 8003335C 8FBF0068 */  lw        $ra, 0x68($sp)
/* E760 80033360 8FB50064 */  lw        $s5, 0x64($sp)
/* E764 80033364 8FB40060 */  lw        $s4, 0x60($sp)
/* E768 80033368 8FB3005C */  lw        $s3, 0x5C($sp)
/* E76C 8003336C 8FB20058 */  lw        $s2, 0x58($sp)
/* E770 80033370 8FB10054 */  lw        $s1, 0x54($sp)
/* E774 80033374 8FB00050 */  lw        $s0, 0x50($sp)
/* E778 80033378 D7BC0090 */  ldc1      $f28, 0x90($sp)
/* E77C 8003337C D7BA0088 */  ldc1      $f26, 0x88($sp)
/* E780 80033380 D7B80080 */  ldc1      $f24, 0x80($sp)
/* E784 80033384 D7B60078 */  ldc1      $f22, 0x78($sp)
/* E788 80033388 D7B40070 */  ldc1      $f20, 0x70($sp)
/* E78C 8003338C 03E00008 */  jr        $ra
/* E790 80033390 27BD0098 */   addiu    $sp, $sp, 0x98

### DECOMPILED C INSTRUCTIONS:

void func_80032C64(Camera* camera) {
    s32 i;
    f32 rotationRad;
    f32 leadAmount;
    CameraControlSettings* settings;
    CameraControlSettings* settings2;
    CameraControlSettings* settings3;
    s32 s2;
    f32 X, Y, Z, W;
    f32 product;
    f32 newPosX, newPosZ;
    Collider* zone;
    s32 cond;
    f32 dist;
    f32 sp44, sp48, sp4C;
    f32 deltaPosX, deltaPosZ;
    f32 f24, f22, cosYaw, sinYaw;

    rotationRad = camera->trueRotation.x / 180.0f * PI;
    leadAmount = camera->leadAmount;
    s2 = 0;
    cos_rad(rotationRad);
    sin_rad(rotationRad);
    settings3 = settings = test_ray_zone(camera->targetPos.x, camera->targetPos.y + 10.0f, camera->targetPos.z, NULL);

    if (settings != NULL) {
        if (settings->type == CAM_CONTROL_CONSTRAIN_TO_LINE || settings->type == CAM_CONTROL_LOOK_AT_POINT_CONSTAIN_TO_LINE || (s2 = func_800328A4(settings, camera->targetPos.x, camera->targetPos.z))) {
            if (camera->unk_530) {
                guPerspectiveF(camera->perspectiveMatrix, &camera->perspNorm, camera->vfov,
                               (f32)camera->viewportW / (f32)camera->viewportH, camera->nearClip, camera->farClip, 1.0f);
                guMtxCatF(camera->viewMtxPlayer, camera->perspectiveMatrix, camera->perspectiveMatrix);
                transform_point(camera->perspectiveMatrix, camera->targetPos.x, camera->targetPos.y, camera->targetPos.z,
                                1.0f, &X, &Y, &Z, &W);
                if (W == 0.0f) {
                    W = 1.0f;
                }
                W = 1.0f / W;
                X *= W;
                camera->unk_52C = (X > 0.0f) ? 1 : (X < 0.0f) ? -1 : 0;
                camera->unk_530 = 0;
            } else {
                CameraControlSettings* aabbForZoneBelow = camera->aabbForZoneBelow;

                if (!(aabbForZoneBelow != NULL && (aabbForZoneBelow->type == CAM_CONTROL_CONSTRAIN_TO_LINE || aabbForZoneBelow->type == CAM_CONTROL_LOOK_AT_POINT_CONSTAIN_TO_LINE || func_800328A4(settings, camera->unk_524, camera->unk_528) != 0))) {
                    if (aabbForZoneBelow != NULL && s2 != 0) {
                        camera->unk_52C = s2;
                    } else {
                        f24 = cosYaw = camera->targetPos.x - camera->unk_524;
                        f22 = camera->targetPos.z - camera->unk_528;
                        cosYaw = -cos_deg(camera->currentYaw);
                        sinYaw = -sin_deg(camera->currentYaw);
                        product = f24 * cosYaw + f22 * sinYaw;
                        camera->unk_52C = (product > 0) ? -1 : (product < 0) ? 1 : 0;
                    }
                }
            }

            if (leadAmount > 0.0f && camera->unk_52C > 0 || leadAmount < 0.0f && camera->unk_52C < 0) {
                camera->unk_514 = 0.0f;
                camera->leadAmount = 0.0f;
            }
            camera->aabbForZoneBelow = settings3;
            camera->unk_524 = camera->targetPos.x;
            camera->unk_528 = camera->targetPos.z;
            return;
        }
    }

    camera->unk_52C = 0;
    camera->aabbForZoneBelow = settings3;
    camera->unk_524 = camera->targetPos.x;
    camera->unk_528 = camera->targetPos.z;
    newPosX = camera->targetPos.x + leadAmount * cos_rad(rotationRad);
    newPosZ = camera->targetPos.z + leadAmount * sin_rad(rotationRad);
    settings = test_ray_zone(newPosX, camera->targetPos.y + 10.0f, newPosZ, &zone);
    if (settings != NULL) {
        if (settings->type == CAM_CONTROL_CONSTRAIN_TO_LINE || settings->type == CAM_CONTROL_LOOK_AT_POINT_CONSTAIN_TO_LINE || func_800328A4(camera->aabbForZoneBelow, newPosX, newPosZ) != 0) {
            cond = TRUE;
            dist = SQ(1000.0f);
            if (camera->aabbForZoneBelow != NULL && camera->aabbForZoneBelow->type == CAM_CONTROL_CONSTAIN_BETWEEN_POINTS) {
                settings2 = camera->aabbForZoneBelow;
                cond = FALSE;

                deltaPosX = settings2->points.two.Bx - settings2->points.two.Ax;
                deltaPosZ = settings2->points.two.Bz - settings2->points.two.Az;

                if (calculate_line_segment_intersection(settings2->points.two.Ax, settings2->points.two.Az, settings2->points.two.Ax - deltaPosZ, settings2->points.two.Az + deltaPosX,
                                  camera->targetPos.x, camera->targetPos.z, newPosX, newPosZ, &sp44, &sp48, &sp4C) && sp4C < SQ(1000.0f)) {
                    dist = sp4C;
                }
                do {
                    if (calculate_line_segment_intersection(settings2->points.two.Bx, settings2->points.two.Bz, settings2->points.two.Bx - deltaPosZ, settings2->points.two.Bz + deltaPosX,
                                  camera->targetPos.x, camera->targetPos.z, newPosX, newPosZ, &sp44, &sp48, &sp4C) && sp4C < dist) {
                        dist = sp4C;
                    }
                } while (0); // TODO find better match
            }
            if (cond) {
                for (i = 0; i < zone->numTriangles; i++) {
                    if (calculate_segment_intersection(zone->triangleTable[i].v1->x, zone->triangleTable[i].v1->z,
                                      zone->triangleTable[i].v2->x, zone->triangleTable[i].v2->z,
                                      camera->targetPos.x, camera->targetPos.z, newPosX, newPosZ, &sp44, &sp48, &sp4C) && sp4C < dist) {
                        dist = sp4C;
                    }
                    if (calculate_segment_intersection(zone->triangleTable[i].v2->x, zone->triangleTable[i].v2->z,
                                      zone->triangleTable[i].v3->x, zone->triangleTable[i].v3->z,
                                      camera->targetPos.x, camera->targetPos.z, newPosX, newPosZ, &sp44, &sp48, &sp4C) && sp4C < dist) {
                        dist = sp4C;
                    }
                    if (calculate_segment_intersection(zone->triangleTable[i].v3->x, zone->triangleTable[i].v3->z,
                                      zone->triangleTable[i].v1->x, zone->triangleTable[i].v1->z,
                                      camera->targetPos.x, camera->targetPos.z, newPosX, newPosZ, &sp44, &sp48, &sp4C) && sp4C < dist) {
                        dist = sp4C;
                    }
                }
            }

            if (dist == SQ(1000.0f) || dist == 0) {
                camera->leadAmount = 0.0f;
            } else {
                camera->leadAmount = (camera->leadAmount > 0.0f) ? sqrtf(dist) : -sqrtf(dist);
            }
            camera->unk_514 = 0.0f;
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel update_encounters_pre_battle
/* 1C764 80041364 27BDFFC8 */  addiu     $sp, $sp, -0x38
/* 1C768 80041368 AFB50024 */  sw        $s5, 0x24($sp)
/* 1C76C 8004136C 3C15800B */  lui       $s5, %hi(gCurrentEncounter)
/* 1C770 80041370 26B50F10 */  addiu     $s5, $s5, %lo(gCurrentEncounter)
/* 1C774 80041374 AFB7002C */  sw        $s7, 0x2C($sp)
/* 1C778 80041378 3C178011 */  lui       $s7, %hi(gPlayerData)
/* 1C77C 8004137C 26F7F290 */  addiu     $s7, $s7, %lo(gPlayerData)
/* 1C780 80041380 3C04800A */  lui       $a0, %hi(gEncounterSubState)
/* 1C784 80041384 2484A5D0 */  addiu     $a0, $a0, %lo(gEncounterSubState)
/* 1C788 80041388 AFBF0030 */  sw        $ra, 0x30($sp)
/* 1C78C 8004138C AFB60028 */  sw        $s6, 0x28($sp)
/* 1C790 80041390 AFB40020 */  sw        $s4, 0x20($sp)
/* 1C794 80041394 AFB3001C */  sw        $s3, 0x1C($sp)
/* 1C798 80041398 AFB20018 */  sw        $s2, 0x18($sp)
/* 1C79C 8004139C AFB10014 */  sw        $s1, 0x14($sp)
/* 1C7A0 800413A0 AFB00010 */  sw        $s0, 0x10($sp)
/* 1C7A4 800413A4 8C830000 */  lw        $v1, 0x0($a0)
/* 1C7A8 800413A8 24050001 */  addiu     $a1, $zero, 0x1
/* 1C7AC 800413AC 106500CF */  beq       $v1, $a1, .L800416EC
/* 1C7B0 800413B0 28620002 */   slti     $v0, $v1, 0x2
/* 1C7B4 800413B4 50400005 */  beql      $v0, $zero, .L800413CC
/* 1C7B8 800413B8 24020002 */   addiu    $v0, $zero, 0x2
/* 1C7BC 800413BC 10600009 */  beqz      $v1, .L800413E4
/* 1C7C0 800413C0 2402FFFF */   addiu    $v0, $zero, -0x1
/* 1C7C4 800413C4 0801064E */  j         .L80041938
/* 1C7C8 800413C8 00000000 */   nop
.L800413CC:
/* 1C7CC 800413CC 1062011C */  beq       $v1, $v0, .L80041840
/* 1C7D0 800413D0 24020003 */   addiu    $v0, $zero, 0x3
/* 1C7D4 800413D4 1062014E */  beq       $v1, $v0, .L80041910
/* 1C7D8 800413D8 24020004 */   addiu    $v0, $zero, 0x4
/* 1C7DC 800413DC 0801064E */  j         .L80041938
/* 1C7E0 800413E0 00000000 */   nop
.L800413E4:
/* 1C7E4 800413E4 AEA00090 */  sw        $zero, 0x90($s5)
/* 1C7E8 800413E8 AEA50094 */  sw        $a1, 0x94($s5)
/* 1C7EC 800413EC AEA50098 */  sw        $a1, 0x98($s5)
/* 1C7F0 800413F0 A2A20008 */  sb        $v0, 0x8($s5)
/* 1C7F4 800413F4 3C01800A */  lui       $at, %hi(D_8009A654)
/* 1C7F8 800413F8 A020A654 */  sb        $zero, %lo(D_8009A654)($at)
/* 1C7FC 800413FC 3C018007 */  lui       $at, %hi(D_80077C40)
/* 1C800 80041400 AC207C40 */  sw        $zero, %lo(D_80077C40)($at)
/* 1C804 80041404 0C0B117A */  jal       suspend_all_group
/* 1C808 80041408 24040010 */   addiu    $a0, $zero, 0x10
/* 1C80C 8004140C 82A2001C */  lb        $v0, 0x1C($s5)
/* 1C810 80041410 18400024 */  blez      $v0, .L800414A4
/* 1C814 80041414 0000982D */   daddu    $s3, $zero, $zero
/* 1C818 80041418 02A0B02D */  daddu     $s6, $s5, $zero
.L8004141C:
/* 1C81C 8004141C 8ED40028 */  lw        $s4, 0x28($s6)
/* 1C820 80041420 1280001B */  beqz      $s4, .L80041490
/* 1C824 80041424 00000000 */   nop
/* 1C828 80041428 8E820000 */  lw        $v0, 0x0($s4)
/* 1C82C 8004142C 18400018 */  blez      $v0, .L80041490
/* 1C830 80041430 0000882D */   daddu    $s1, $zero, $zero
/* 1C834 80041434 0280902D */  daddu     $s2, $s4, $zero
.L80041438:
/* 1C838 80041438 8E500004 */  lw        $s0, 0x4($s2)
/* 1C83C 8004143C 1200000F */  beqz      $s0, .L8004147C
/* 1C840 80041440 00000000 */   nop
/* 1C844 80041444 8E020000 */  lw        $v0, 0x0($s0)
/* 1C848 80041448 30420020 */  andi      $v0, $v0, 0x20
/* 1C84C 8004144C 1440000B */  bnez      $v0, .L8004147C
/* 1C850 80041450 00000000 */   nop
/* 1C854 80041454 8E02003C */  lw        $v0, 0x3C($s0)
/* 1C858 80041458 10400003 */  beqz      $v0, .L80041468
/* 1C85C 8004145C 00000000 */   nop
/* 1C860 80041460 0C0B1108 */  jal       suspend_all_script
/* 1C864 80041464 8E040054 */   lw       $a0, 0x54($s0)
.L80041468:
/* 1C868 80041468 8E020044 */  lw        $v0, 0x44($s0)
/* 1C86C 8004146C 10400003 */  beqz      $v0, .L8004147C
/* 1C870 80041470 00000000 */   nop
/* 1C874 80041474 0C0B1108 */  jal       suspend_all_script
/* 1C878 80041478 8E04005C */   lw       $a0, 0x5C($s0)
.L8004147C:
/* 1C87C 8004147C 8E820000 */  lw        $v0, 0x0($s4)
/* 1C880 80041480 26310001 */  addiu     $s1, $s1, 0x1
/* 1C884 80041484 0222102A */  slt       $v0, $s1, $v0
/* 1C888 80041488 1440FFEB */  bnez      $v0, .L80041438
/* 1C88C 8004148C 26520004 */   addiu    $s2, $s2, 0x4
.L80041490:
/* 1C890 80041490 82A2001C */  lb        $v0, 0x1C($s5)
/* 1C894 80041494 26730001 */  addiu     $s3, $s3, 0x1
/* 1C898 80041498 0262102A */  slt       $v0, $s3, $v0
/* 1C89C 8004149C 1440FFDF */  bnez      $v0, .L8004141C
/* 1C8A0 800414A0 26D60004 */   addiu    $s6, $s6, 0x4
.L800414A4:
/* 1C8A4 800414A4 8EB0008C */  lw        $s0, 0x8C($s5)
/* 1C8A8 800414A8 8E020000 */  lw        $v0, 0x0($s0)
/* 1C8AC 800414AC 3C030010 */  lui       $v1, (0x100000 >> 16)
/* 1C8B0 800414B0 00431024 */  and       $v0, $v0, $v1
/* 1C8B4 800414B4 1040000C */  beqz      $v0, .L800414E8
/* 1C8B8 800414B8 00000000 */   nop
/* 1C8BC 800414BC 82A20012 */  lb        $v0, 0x12($s5)
/* 1C8C0 800414C0 14400009 */  bnez      $v0, .L800414E8
/* 1C8C4 800414C4 00000000 */   nop
/* 1C8C8 800414C8 AEA00094 */  sw        $zero, 0x94($s5)
/* 1C8CC 800414CC 0C03AD96 */  jal       partner_handle_before_battle
/* 1C8D0 800414D0 AEA0009C */   sw       $zero, 0x9C($s5)
/* 1C8D4 800414D4 24020003 */  addiu     $v0, $zero, 0x3
/* 1C8D8 800414D8 3C01800A */  lui       $at, %hi(gEncounterSubState)
/* 1C8DC 800414DC AC22A5D0 */  sw        $v0, %lo(gEncounterSubState)($at)
/* 1C8E0 800414E0 0801064E */  j         .L80041938
/* 1C8E4 800414E4 00000000 */   nop
.L800414E8:
/* 1C8E8 800414E8 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 1C8EC 800414EC 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 1C8F0 800414F0 80420074 */  lb        $v0, 0x74($v0)
/* 1C8F4 800414F4 24110002 */  addiu     $s1, $zero, 0x2
/* 1C8F8 800414F8 14510009 */  bne       $v0, $s1, .L80041520
/* 1C8FC 800414FC 24120001 */   addiu    $s2, $zero, 0x1
/* 1C900 80041500 2402000A */  addiu     $v0, $zero, 0xA
/* 1C904 80041504 AEA00094 */  sw        $zero, 0x94($s5)
/* 1C908 80041508 0C03AD96 */  jal       partner_handle_before_battle
/* 1C90C 8004150C AEA2009C */   sw       $v0, 0x9C($s5)
/* 1C910 80041510 3C01800A */  lui       $at, %hi(gEncounterSubState)
/* 1C914 80041514 AC31A5D0 */  sw        $s1, %lo(gEncounterSubState)($at)
/* 1C918 80041518 0801064E */  j         .L80041938
/* 1C91C 8004151C 00000000 */   nop
.L80041520:
/* 1C920 80041520 82A30005 */  lb        $v1, 0x5($s5)
/* 1C924 80041524 8EB0008C */  lw        $s0, 0x8C($s5)
/* 1C928 80041528 1072001D */  beq       $v1, $s2, .L800415A0
/* 1C92C 8004152C 24020003 */   addiu    $v0, $zero, 0x3
/* 1C930 80041530 1062001B */  beq       $v1, $v0, .L800415A0
/* 1C934 80041534 00000000 */   nop
/* 1C938 80041538 0C03A752 */  jal       is_ability_active
/* 1C93C 8004153C 0040202D */   daddu    $a0, $v0, $zero
/* 1C940 80041540 10400016 */  beqz      $v0, .L8004159C
/* 1C944 80041544 00000000 */   nop
/* 1C948 80041548 8E020018 */  lw        $v0, 0x18($s0)
/* 1C94C 8004154C 82E30009 */  lb        $v1, 0x9($s7)
/* 1C950 80041550 84420028 */  lh        $v0, 0x28($v0)
/* 1C954 80041554 0062182A */  slt       $v1, $v1, $v0
/* 1C958 80041558 14600010 */  bnez      $v1, .L8004159C
/* 1C95C 8004155C 00000000 */   nop
/* 1C960 80041560 8E020000 */  lw        $v0, 0x0($s0)
/* 1C964 80041564 30420040 */  andi      $v0, $v0, 0x40
/* 1C968 80041568 1440000C */  bnez      $v0, .L8004159C
/* 1C96C 8004156C 00000000 */   nop
/* 1C970 80041570 82A20012 */  lb        $v0, 0x12($s5)
/* 1C974 80041574 14400009 */  bnez      $v0, .L8004159C
/* 1C978 80041578 2402000A */   addiu    $v0, $zero, 0xA
/* 1C97C 8004157C AEA00094 */  sw        $zero, 0x94($s5)
/* 1C980 80041580 AEA2009C */  sw        $v0, 0x9C($s5)
/* 1C984 80041584 3C018007 */  lui       $at, %hi(D_80077C40)
/* 1C988 80041588 AC327C40 */  sw        $s2, %lo(D_80077C40)($at)
/* 1C98C 8004158C 3C01800A */  lui       $at, %hi(gEncounterSubState)
/* 1C990 80041590 AC31A5D0 */  sw        $s1, %lo(gEncounterSubState)($at)
/* 1C994 80041594 0801064E */  j         .L80041938
/* 1C998 80041598 00000000 */   nop
.L8004159C:
/* 1C99C 8004159C 8EB0008C */  lw        $s0, 0x8C($s5)
.L800415A0:
/* 1C9A0 800415A0 0C03A752 */  jal       is_ability_active
/* 1C9A4 800415A4 2404002A */   addiu    $a0, $zero, 0x2A
/* 1C9A8 800415A8 1040000E */  beqz      $v0, .L800415E4
/* 1C9AC 800415AC 24020003 */   addiu    $v0, $zero, 0x3
/* 1C9B0 800415B0 8E020018 */  lw        $v0, 0x18($s0)
/* 1C9B4 800415B4 82E30009 */  lb        $v1, 0x9($s7)
/* 1C9B8 800415B8 84420028 */  lh        $v0, 0x28($v0)
/* 1C9BC 800415BC 0062182A */  slt       $v1, $v1, $v0
/* 1C9C0 800415C0 14600008 */  bnez      $v1, .L800415E4
/* 1C9C4 800415C4 24020003 */   addiu    $v0, $zero, 0x3
/* 1C9C8 800415C8 8E020000 */  lw        $v0, 0x0($s0)
/* 1C9CC 800415CC 30420040 */  andi      $v0, $v0, 0x40
/* 1C9D0 800415D0 14400004 */  bnez      $v0, .L800415E4
/* 1C9D4 800415D4 24020003 */   addiu    $v0, $zero, 0x3
/* 1C9D8 800415D8 82A20012 */  lb        $v0, 0x12($s5)
/* 1C9DC 800415DC 10400015 */  beqz      $v0, .L80041634
/* 1C9E0 800415E0 24020003 */   addiu    $v0, $zero, 0x3
.L800415E4:
/* 1C9E4 800415E4 82A30005 */  lb        $v1, 0x5($s5)
/* 1C9E8 800415E8 1462001D */  bne       $v1, $v0, .L80041660
/* 1C9EC 800415EC 8EB0008C */   lw       $s0, 0x8C($s5)
/* 1C9F0 800415F0 0C03A752 */  jal       is_ability_active
/* 1C9F4 800415F4 24040028 */   addiu    $a0, $zero, 0x28
/* 1C9F8 800415F8 10400019 */  beqz      $v0, .L80041660
/* 1C9FC 800415FC 00000000 */   nop
/* 1CA00 80041600 8E020018 */  lw        $v0, 0x18($s0)
/* 1CA04 80041604 82E30009 */  lb        $v1, 0x9($s7)
/* 1CA08 80041608 84420028 */  lh        $v0, 0x28($v0)
/* 1CA0C 8004160C 0062182A */  slt       $v1, $v1, $v0
/* 1CA10 80041610 14600013 */  bnez      $v1, .L80041660
/* 1CA14 80041614 00000000 */   nop
/* 1CA18 80041618 8E020000 */  lw        $v0, 0x0($s0)
/* 1CA1C 8004161C 30420040 */  andi      $v0, $v0, 0x40
/* 1CA20 80041620 1440000F */  bnez      $v0, .L80041660
/* 1CA24 80041624 00000000 */   nop
/* 1CA28 80041628 82A20012 */  lb        $v0, 0x12($s5)
/* 1CA2C 8004162C 1440000C */  bnez      $v0, .L80041660
/* 1CA30 80041630 00000000 */   nop
.L80041634:
/* 1CA34 80041634 2402000A */  addiu     $v0, $zero, 0xA
/* 1CA38 80041638 AEA2009C */  sw        $v0, 0x9C($s5)
/* 1CA3C 8004163C 24020001 */  addiu     $v0, $zero, 0x1
/* 1CA40 80041640 3C018007 */  lui       $at, %hi(D_80077C40)
/* 1CA44 80041644 AC227C40 */  sw        $v0, %lo(D_80077C40)($at)
/* 1CA48 80041648 24020002 */  addiu     $v0, $zero, 0x2
/* 1CA4C 8004164C AEA00094 */  sw        $zero, 0x94($s5)
/* 1CA50 80041650 3C01800A */  lui       $at, %hi(gEncounterSubState)
/* 1CA54 80041654 AC22A5D0 */  sw        $v0, %lo(gEncounterSubState)($at)
/* 1CA58 80041658 0801064E */  j         .L80041938
/* 1CA5C 8004165C 00000000 */   nop
.L80041660:
/* 1CA60 80041660 8EA40014 */  lw        $a0, 0x14($s5)
/* 1CA64 80041664 04810015 */  bgez      $a0, .L800416BC
/* 1CA68 80041668 0000282D */   daddu    $a1, $zero, $zero
/* 1CA6C 8004166C 82A30004 */  lb        $v1, 0x4($s5)
/* 1CA70 80041670 24020001 */  addiu     $v0, $zero, 0x1
/* 1CA74 80041674 1062000B */  beq       $v1, $v0, .L800416A4
/* 1CA78 80041678 28620002 */   slti     $v0, $v1, 0x2
/* 1CA7C 8004167C 10400005 */  beqz      $v0, .L80041694
/* 1CA80 80041680 24020002 */   addiu    $v0, $zero, 0x2
/* 1CA84 80041684 1060000D */  beqz      $v1, .L800416BC
/* 1CA88 80041688 24040002 */   addiu    $a0, $zero, 0x2
/* 1CA8C 8004168C 080105B1 */  j         .L800416C4
/* 1CA90 80041690 00000000 */   nop
.L80041694:
/* 1CA94 80041694 10620006 */  beq       $v1, $v0, .L800416B0
/* 1CA98 80041698 24040002 */   addiu    $a0, $zero, 0x2
/* 1CA9C 8004169C 080105B1 */  j         .L800416C4
/* 1CAA0 800416A0 00000000 */   nop
.L800416A4:
/* 1CAA4 800416A4 24040002 */  addiu     $a0, $zero, 0x2
/* 1CAA8 800416A8 080105AF */  j         .L800416BC
/* 1CAAC 800416AC 24050001 */   addiu    $a1, $zero, 0x1
.L800416B0:
/* 1CAB0 800416B0 080105AF */  j         .L800416BC
/* 1CAB4 800416B4 0080282D */   daddu    $a1, $a0, $zero
/* 1CAB8 800416B8 0000282D */  daddu     $a1, $zero, $zero
.L800416BC:
/* 1CABC 800416BC 0C052BE3 */  jal       bgm_set_battle_song
/* 1CAC0 800416C0 00000000 */   nop
.L800416C4:
/* 1CAC4 800416C4 0C052BBE */  jal       bgm_push_battle_song
/* 1CAC8 800416C8 00000000 */   nop
/* 1CACC 800416CC 24020001 */  addiu     $v0, $zero, 0x1
/* 1CAD0 800416D0 3C01800A */  lui       $at, %hi(D_8009A654)
/* 1CAD4 800416D4 A022A654 */  sb        $v0, %lo(D_8009A654)($at)
/* 1CAD8 800416D8 2402000A */  addiu     $v0, $zero, 0xA
/* 1CADC 800416DC AEA2009C */  sw        $v0, 0x9C($s5)
/* 1CAE0 800416E0 24020001 */  addiu     $v0, $zero, 0x1
/* 1CAE4 800416E4 3C01800A */  lui       $at, %hi(gEncounterSubState)
/* 1CAE8 800416E8 AC22A5D0 */  sw        $v0, %lo(gEncounterSubState)($at)
.L800416EC:
/* 1CAEC 800416EC 8EA30090 */  lw        $v1, 0x90($s5)
/* 1CAF0 800416F0 240200FF */  addiu     $v0, $zero, 0xFF
/* 1CAF4 800416F4 14620090 */  bne       $v1, $v0, .L80041938
/* 1CAF8 800416F8 00000000 */   nop
/* 1CAFC 800416FC 8EA2009C */  lw        $v0, 0x9C($s5)
/* 1CB00 80041700 14400052 */  bnez      $v0, .L8004184C
/* 1CB04 80041704 2442FFFF */   addiu    $v0, $v0, -0x1
/* 1CB08 80041708 8EB40088 */  lw        $s4, 0x88($s5)
/* 1CB0C 8004170C 8E820000 */  lw        $v0, 0x0($s4)
/* 1CB10 80041710 18400019 */  blez      $v0, .L80041778
/* 1CB14 80041714 0000982D */   daddu    $s3, $zero, $zero
/* 1CB18 80041718 0280882D */  daddu     $s1, $s4, $zero
.L8004171C:
/* 1CB1C 8004171C 8E300004 */  lw        $s0, 0x4($s1)
/* 1CB20 80041720 12000010 */  beqz      $s0, .L80041764
/* 1CB24 80041724 00000000 */   nop
/* 1CB28 80041728 8E030000 */  lw        $v1, 0x0($s0)
/* 1CB2C 8004172C 30620008 */  andi      $v0, $v1, 0x8
/* 1CB30 80041730 10400004 */  beqz      $v0, .L80041744
/* 1CB34 80041734 30620020 */   andi     $v0, $v1, 0x20
/* 1CB38 80041738 8EA2008C */  lw        $v0, 0x8C($s5)
/* 1CB3C 8004173C 16020009 */  bne       $s0, $v0, .L80041764
/* 1CB40 80041740 30620020 */   andi     $v0, $v1, 0x20
.L80041744:
/* 1CB44 80041744 14400007 */  bnez      $v0, .L80041764
/* 1CB48 80041748 00000000 */   nop
/* 1CB4C 8004174C 8E020040 */  lw        $v0, 0x40($s0)
/* 1CB50 80041750 10400004 */  beqz      $v0, .L80041764
/* 1CB54 80041754 00000000 */   nop
/* 1CB58 80041758 0C0B102B */  jal       kill_script_by_ID
/* 1CB5C 8004175C 8E040058 */   lw       $a0, 0x58($s0)
/* 1CB60 80041760 AE000040 */  sw        $zero, 0x40($s0)
.L80041764:
/* 1CB64 80041764 8E820000 */  lw        $v0, 0x0($s4)
/* 1CB68 80041768 26730001 */  addiu     $s3, $s3, 0x1
/* 1CB6C 8004176C 0262102A */  slt       $v0, $s3, $v0
/* 1CB70 80041770 1440FFEA */  bnez      $v0, .L8004171C
/* 1CB74 80041774 26310004 */   addiu    $s1, $s1, 0x4
.L80041778:
/* 1CB78 80041778 0C03AD96 */  jal       partner_handle_before_battle
/* 1CB7C 8004177C 00000000 */   nop
/* 1CB80 80041780 8EB0008C */  lw        $s0, 0x8C($s5)
/* 1CB84 80041784 A2A000A0 */  sb        $zero, 0xA0($s5)
/* 1CB88 80041788 A6A000A2 */  sh        $zero, 0xA2($s5)
/* 1CB8C 8004178C 920200B5 */  lbu       $v0, 0xB5($s0)
/* 1CB90 80041790 2404002D */  addiu     $a0, $zero, 0x2D
/* 1CB94 80041794 0C03A752 */  jal       is_ability_active
/* 1CB98 80041798 A2A20010 */   sb       $v0, 0x10($s5)
/* 1CB9C 8004179C 10400008 */  beqz      $v0, .L800417C0
/* 1CBA0 800417A0 00000000 */   nop
/* 1CBA4 800417A4 82A30005 */  lb        $v1, 0x5($s5)
/* 1CBA8 800417A8 24020003 */  addiu     $v0, $zero, 0x3
/* 1CBAC 800417AC 14620004 */  bne       $v1, $v0, .L800417C0
/* 1CBB0 800417B0 00000000 */   nop
/* 1CBB4 800417B4 24020004 */  addiu     $v0, $zero, 0x4
/* 1CBB8 800417B8 A2A200A0 */  sb        $v0, 0xA0($s5)
/* 1CBBC 800417BC A6A300A2 */  sh        $v1, 0xA2($s5)
.L800417C0:
/* 1CBC0 800417C0 0C05271B */  jal       sfx_stop_sound
/* 1CBC4 800417C4 24042111 */   addiu    $a0, $zero, 0x2111
/* 1CBC8 800417C8 0C05271B */  jal       sfx_stop_sound
/* 1CBCC 800417CC 24042112 */   addiu    $a0, $zero, 0x2112
/* 1CBD0 800417D0 0C05271B */  jal       sfx_stop_sound
/* 1CBD4 800417D4 24042113 */   addiu    $a0, $zero, 0x2113
/* 1CBD8 800417D8 0C05271B */  jal       sfx_stop_sound
/* 1CBDC 800417DC 24042114 */   addiu    $a0, $zero, 0x2114
/* 1CBE0 800417E0 0C01CB37 */  jal       set_battle_formation
/* 1CBE4 800417E4 0000202D */   daddu    $a0, $zero, $zero
/* 1CBE8 800417E8 86840046 */  lh        $a0, 0x46($s4)
/* 1CBEC 800417EC 0C01CB33 */  jal       set_battle_stage
/* 1CBF0 800417F0 00000000 */   nop
/* 1CBF4 800417F4 0C01CB24 */  jal       load_battle
/* 1CBF8 800417F8 86840044 */   lh       $a0, 0x44($s4)
/* 1CBFC 800417FC 0000202D */  daddu     $a0, $zero, $zero
/* 1CC00 80041800 3C05437F */  lui       $a1, (0x437F0000 >> 16)
/* 1CC04 80041804 24020001 */  addiu     $v0, $zero, 0x1
/* 1CC08 80041808 A2A20007 */  sb        $v0, 0x7($s5)
/* 1CC0C 8004180C 240200FF */  addiu     $v0, $zero, 0xFF
/* 1CC10 80041810 A2A00008 */  sb        $zero, 0x8($s5)
/* 1CC14 80041814 A2A0000B */  sb        $zero, 0xB($s5)
/* 1CC18 80041818 A2A0000C */  sb        $zero, 0xC($s5)
/* 1CC1C 8004181C A6A0000E */  sh        $zero, 0xE($s5)
/* 1CC20 80041820 AEA00098 */  sw        $zero, 0x98($s5)
/* 1CC24 80041824 0C04DF62 */  jal       set_screen_overlay_params_front
/* 1CC28 80041828 AEA20090 */   sw       $v0, 0x90($s5)
/* 1CC2C 8004182C 24020005 */  addiu     $v0, $zero, 0x5
/* 1CC30 80041830 3C01800A */  lui       $at, %hi(gEncounterState)
/* 1CC34 80041834 AC22A600 */  sw        $v0, %lo(gEncounterState)($at)
/* 1CC38 80041838 0801063E */  j         .L800418F8
/* 1CC3C 8004183C 24020001 */   addiu    $v0, $zero, 0x1
.L80041840:
/* 1CC40 80041840 8EA2009C */  lw        $v0, 0x9C($s5)
/* 1CC44 80041844 10400003 */  beqz      $v0, .L80041854
/* 1CC48 80041848 2442FFFF */   addiu    $v0, $v0, -0x1
.L8004184C:
/* 1CC4C 8004184C 0801064E */  j         .L80041938
/* 1CC50 80041850 AEA2009C */   sw       $v0, 0x9C($s5)
.L80041854:
/* 1CC54 80041854 8EB40088 */  lw        $s4, 0x88($s5)
/* 1CC58 80041858 8E820000 */  lw        $v0, 0x0($s4)
/* 1CC5C 8004185C 18400019 */  blez      $v0, .L800418C4
/* 1CC60 80041860 0000982D */   daddu    $s3, $zero, $zero
/* 1CC64 80041864 0280882D */  daddu     $s1, $s4, $zero
.L80041868:
/* 1CC68 80041868 8E300004 */  lw        $s0, 0x4($s1)
/* 1CC6C 8004186C 12000010 */  beqz      $s0, .L800418B0
/* 1CC70 80041870 00000000 */   nop
/* 1CC74 80041874 8E030000 */  lw        $v1, 0x0($s0)
/* 1CC78 80041878 30620008 */  andi      $v0, $v1, 0x8
/* 1CC7C 8004187C 10400004 */  beqz      $v0, .L80041890
/* 1CC80 80041880 30620020 */   andi     $v0, $v1, 0x20
/* 1CC84 80041884 8EA2008C */  lw        $v0, 0x8C($s5)
/* 1CC88 80041888 16020009 */  bne       $s0, $v0, .L800418B0
/* 1CC8C 8004188C 30620020 */   andi     $v0, $v1, 0x20
.L80041890:
/* 1CC90 80041890 14400007 */  bnez      $v0, .L800418B0
/* 1CC94 80041894 00000000 */   nop
/* 1CC98 80041898 8E020040 */  lw        $v0, 0x40($s0)
/* 1CC9C 8004189C 10400004 */  beqz      $v0, .L800418B0
/* 1CCA0 800418A0 00000000 */   nop
/* 1CCA4 800418A4 0C0B102B */  jal       kill_script_by_ID
/* 1CCA8 800418A8 8E040058 */   lw       $a0, 0x58($s0)
/* 1CCAC 800418AC AE000040 */  sw        $zero, 0x40($s0)
.L800418B0:
/* 1CCB0 800418B0 8E820000 */  lw        $v0, 0x0($s4)
/* 1CCB4 800418B4 26730001 */  addiu     $s3, $s3, 0x1
/* 1CCB8 800418B8 0262102A */  slt       $v0, $s3, $v0
/* 1CCBC 800418BC 1440FFEA */  bnez      $v0, .L80041868
/* 1CCC0 800418C0 26310004 */   addiu    $s1, $s1, 0x4
.L800418C4:
/* 1CCC4 800418C4 24020001 */  addiu     $v0, $zero, 0x1
/* 1CCC8 800418C8 A2A20008 */  sb        $v0, 0x8($s5)
/* 1CCCC 800418CC A2A20007 */  sb        $v0, 0x7($s5)
/* 1CCD0 800418D0 24020005 */  addiu     $v0, $zero, 0x5
/* 1CCD4 800418D4 A2A00009 */  sb        $zero, 0x9($s5)
/* 1CCD8 800418D8 A2A0000B */  sb        $zero, 0xB($s5)
/* 1CCDC 800418DC A2A0000C */  sb        $zero, 0xC($s5)
/* 1CCE0 800418E0 3C01800A */  lui       $at, %hi(gEncounterState)
/* 1CCE4 800418E4 AC22A600 */  sw        $v0, %lo(gEncounterState)($at)
/* 1CCE8 800418E8 24020001 */  addiu     $v0, $zero, 0x1
/* 1CCEC 800418EC A6A0000E */  sh        $zero, 0xE($s5)
/* 1CCF0 800418F0 AEA00098 */  sw        $zero, 0x98($s5)
/* 1CCF4 800418F4 AEA00090 */  sw        $zero, 0x90($s5)
.L800418F8:
/* 1CCF8 800418F8 3C01800A */  lui       $at, %hi(D_8009A678)
/* 1CCFC 800418FC AC22A678 */  sw        $v0, %lo(D_8009A678)($at)
/* 1CD00 80041900 3C01800A */  lui       $at, %hi(gEncounterSubState)
/* 1CD04 80041904 AC20A5D0 */  sw        $zero, %lo(gEncounterSubState)($at)
/* 1CD08 80041908 0801064E */  j         .L80041938
/* 1CD0C 8004190C 00000000 */   nop
.L80041910:
/* 1CD10 80041910 A2A20009 */  sb        $v0, 0x9($s5)
/* 1CD14 80041914 24020005 */  addiu     $v0, $zero, 0x5
/* 1CD18 80041918 A2A50008 */  sb        $a1, 0x8($s5)
/* 1CD1C 8004191C AEA00090 */  sw        $zero, 0x90($s5)
/* 1CD20 80041920 AEA00098 */  sw        $zero, 0x98($s5)
/* 1CD24 80041924 3C01800A */  lui       $at, %hi(gEncounterState)
/* 1CD28 80041928 AC22A600 */  sw        $v0, %lo(gEncounterState)($at)
/* 1CD2C 8004192C 3C01800A */  lui       $at, %hi(D_8009A678)
/* 1CD30 80041930 AC25A678 */  sw        $a1, %lo(D_8009A678)($at)
/* 1CD34 80041934 AC800000 */  sw        $zero, 0x0($a0)
.L80041938:
/* 1CD38 80041938 8FBF0030 */  lw        $ra, 0x30($sp)
/* 1CD3C 8004193C 8FB7002C */  lw        $s7, 0x2C($sp)
/* 1CD40 80041940 8FB60028 */  lw        $s6, 0x28($sp)
/* 1CD44 80041944 8FB50024 */  lw        $s5, 0x24($sp)
/* 1CD48 80041948 8FB40020 */  lw        $s4, 0x20($sp)
/* 1CD4C 8004194C 8FB3001C */  lw        $s3, 0x1C($sp)
/* 1CD50 80041950 8FB20018 */  lw        $s2, 0x18($sp)
/* 1CD54 80041954 8FB10014 */  lw        $s1, 0x14($sp)
/* 1CD58 80041958 8FB00010 */  lw        $s0, 0x10($sp)
/* 1CD5C 8004195C 03E00008 */  jr        $ra
/* 1CD60 80041960 27BD0038 */   addiu    $sp, $sp, 0x38

### DECOMPILED C INSTRUCTIONS:

void update_encounters_pre_battle(void) {
    EncounterStatus* currentEncounter = &gCurrentEncounter;
    PlayerData* playerData = &gPlayerData;
    Encounter* encounter;
    Enemy* enemy;
    s32 i;
    s32 j;

    switch (gEncounterSubState) {
        case ENCOUNTER_SUBSTATE_PRE_BATTLE_INIT:
            currentEncounter->fadeOutAmount = 0;
            currentEncounter->unk_94 = 1;
            currentEncounter->fadeOutAccel = 1;
            currentEncounter->unk_08 = -1;
            D_8009A654 = FALSE;
            D_80077C40 = 0;
            suspend_all_group(EVT_GROUP_10);

            for (i = 0; i < currentEncounter->numEncounters; i++) {
                encounter = currentEncounter->encounterList[i];

                if (encounter != NULL) {
                    for (j = 0; j < encounter->count; j++) {
                        enemy = encounter->enemy[j];
                        if (enemy != NULL && !(enemy->flags & ENEMY_FLAG_DISABLE_AI)) {
                            if (enemy->aiScript != NULL) {
                                suspend_all_script(enemy->aiScriptID);
                            }
                            if (enemy->auxScript != NULL) {
                                suspend_all_script(enemy->auxScriptID);
                            }
                        }
                    }
                }
            }

            enemy = currentEncounter->currentEnemy;
            if ((enemy->flags & ENEMY_FLAG_100000) && !currentEncounter->scriptedBattle) {
                currentEncounter->unk_94 = 0;
                currentEncounter->battleStartCountdown = 0;
                partner_handle_before_battle();
                gEncounterSubState = ENCOUNTER_SUBSTATE_PRE_BATTLE_3;
                return;
            }

            if (gGameStatusPtr->debugEnemyContact == DEBUG_CONTACT_DIE_ON_TOUCH) {
                currentEncounter->unk_94 = 0;
                currentEncounter->battleStartCountdown = 10;
                partner_handle_before_battle();
                gEncounterSubState = ENCOUNTER_SUBSTATE_PRE_BATTLE_AUTO_WIN;
                return;
            }

            enemy = currentEncounter->currentEnemy;
            if (currentEncounter->hitType != ENCOUNTER_TRIGGER_NONE
                && currentEncounter->hitType != ENCOUNTER_TRIGGER_SPIN
                && is_ability_active(ABILITY_FIRST_ATTACK)
                && (playerData->level >= enemy->npcSettings->level)
                && !(enemy->flags & ENEMY_FLAG_PROJECTILE)
                && !currentEncounter->scriptedBattle
            ) {
                currentEncounter->unk_94 = 0;
                currentEncounter->battleStartCountdown = 10;
                D_80077C40 = 1;
                gEncounterSubState = ENCOUNTER_SUBSTATE_PRE_BATTLE_AUTO_WIN;
                return;
            }

            enemy = currentEncounter->currentEnemy;
            if ((
                    (is_ability_active(ABILITY_BUMP_ATTACK)) &&
                    (playerData->level >= enemy->npcSettings->level) &&
                    (!(enemy->flags & ENEMY_FLAG_PROJECTILE) &&
                    !(currentEncounter->scriptedBattle))
                ) || (
                    (enemy = currentEncounter->currentEnemy,
                    (currentEncounter->hitType == ENCOUNTER_TRIGGER_SPIN)) &&
                    (is_ability_active(ABILITY_SPIN_ATTACK)) &&
                    playerData->level >= enemy->npcSettings->level &&
                    !(enemy->flags & ENEMY_FLAG_PROJECTILE) &&
                    !currentEncounter->scriptedBattle
                ))
            {
                currentEncounter->battleStartCountdown = 10;
                D_80077C40 = 1;
                currentEncounter->unk_94 = 0;
                gEncounterSubState = ENCOUNTER_SUBSTATE_PRE_BATTLE_AUTO_WIN;
                return;
            }

            if (currentEncounter->songID < 0) {
                switch (currentEncounter->firstStrikeType) {
                    case 0:
                        bgm_set_battle_song(SONG_NORMAL_BATTLE, FIRST_STRIKE_NONE);
                        break;
                    case 1:
                        bgm_set_battle_song(SONG_NORMAL_BATTLE, FIRST_STRIKE_PLAYER);
                        break;
                    case 2:
                        bgm_set_battle_song(SONG_NORMAL_BATTLE, FIRST_STRIKE_ENEMY);
                        break;
                }
            } else {
                bgm_set_battle_song(currentEncounter->songID, FIRST_STRIKE_NONE);
            }
            bgm_push_battle_song();
            D_8009A654 = TRUE;
            currentEncounter->battleStartCountdown = 10;
            gEncounterSubState = ENCOUNTER_SUBSTATE_PRE_BATTLE_LOAD_BATTLE;
        case ENCOUNTER_SUBSTATE_PRE_BATTLE_LOAD_BATTLE:
            if (currentEncounter->fadeOutAmount == 255) {
                if (currentEncounter->battleStartCountdown != 0) {
                    currentEncounter->battleStartCountdown--;
                    break;
                }

                encounter = currentEncounter->currentEncounter;
                for (i = 0; i < encounter->count; i++) {
                    enemy = encounter->enemy[i];
                    if (enemy != NULL &&
                        ((!(enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) || enemy == currentEncounter->currentEnemy)) &&
                        !(enemy->flags & ENEMY_FLAG_DISABLE_AI) &&
                        enemy->hitScript != NULL)
                    {
                        kill_script_by_ID(enemy->hitScriptID);
                        enemy->hitScript = NULL;
                    }
                }

                partner_handle_before_battle();
                currentEncounter->dizzyAttackStatus = 0;
                currentEncounter->dizzyAttackDuration = 0;

                enemy = currentEncounter->currentEnemy;
                currentEncounter->instigatorValue = enemy->instigatorValue;

                if (is_ability_active(ABILITY_DIZZY_ATTACK) && currentEncounter->hitType == ENCOUNTER_TRIGGER_SPIN) {
                    currentEncounter->dizzyAttackStatus = 4;
                    currentEncounter->dizzyAttackDuration = 3;
                }

                sfx_stop_sound(SOUND_2111);
                sfx_stop_sound(SOUND_2112);
                sfx_stop_sound(SOUND_2113);
                sfx_stop_sound(SOUND_2114);
                set_battle_formation(NULL);
                set_battle_stage(encounter->stage);
                load_battle(encounter->battle);
                currentEncounter->unk_07 = 1;
                currentEncounter->unk_08 = 0;
                currentEncounter->hasMerleeCoinBonus = FALSE;
                currentEncounter->damageTaken = 0;
                currentEncounter->coinsEarned = 0;
                currentEncounter->fadeOutAccel = 0;
                currentEncounter->fadeOutAmount = 255;
                set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, 255.0f);
                gEncounterState = ENCOUNTER_STATE_POST_BATTLE;
                D_8009A678 = 1;
                gEncounterSubState = ENCOUNTER_SUBSTATE_POST_BATTLE_INIT;
            }
            break;
        case ENCOUNTER_SUBSTATE_PRE_BATTLE_AUTO_WIN:
            if (currentEncounter->battleStartCountdown != 0) {
                currentEncounter->battleStartCountdown--;
                break;
            }

            encounter = currentEncounter->currentEncounter;
            for (i = 0; i < encounter->count; i++) {
                enemy = encounter->enemy[i];
                if (enemy != NULL &&
                    (!(enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) || enemy == currentEncounter->currentEnemy) &&
                    !(enemy->flags & ENEMY_FLAG_DISABLE_AI) &&
                    (enemy->hitScript != 0))
                {
                    kill_script_by_ID(enemy->hitScriptID);
                    enemy->hitScript = NULL;
                }
            }

            currentEncounter->unk_08 = 1;
            currentEncounter->unk_07 = 1;
            currentEncounter->battleOutcome = OUTCOME_PLAYER_WON;
            currentEncounter->hasMerleeCoinBonus = FALSE;
            currentEncounter->damageTaken = 0;
            gEncounterState = ENCOUNTER_STATE_POST_BATTLE;
            currentEncounter->coinsEarned = 0;
            currentEncounter->fadeOutAccel = 0;
            currentEncounter->fadeOutAmount = 0;
            D_8009A678 = 1;
            gEncounterSubState = ENCOUNTER_SUBSTATE_POST_BATTLE_INIT;
            break;
        case ENCOUNTER_SUBSTATE_PRE_BATTLE_3:
            currentEncounter->battleOutcome = OUTCOME_4;
            currentEncounter->unk_08 = 1;
            currentEncounter->fadeOutAmount = 0;
            currentEncounter->fadeOutAccel = 0;
            gEncounterState = ENCOUNTER_STATE_POST_BATTLE;
            D_8009A678 = 1;
            gEncounterSubState = ENCOUNTER_SUBSTATE_POST_BATTLE_INIT;
            break;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel ring_blast_appendGfx
/* 356B98 E0048218 27BDFF20 */  addiu     $sp, $sp, -0xE0
/* 356B9C E004821C 0080302D */  daddu     $a2, $a0, $zero
/* 356BA0 E0048220 3C07DB06 */  lui       $a3, (0xDB060024 >> 16)
/* 356BA4 E0048224 34E70024 */  ori       $a3, $a3, (0xDB060024 & 0xFFFF)
/* 356BA8 E0048228 27A40020 */  addiu     $a0, $sp, 0x20
/* 356BAC E004822C AFB500BC */  sw        $s5, 0xBC($sp)
/* 356BB0 E0048230 3C15800A */  lui       $s5, %hi(gMainGfxPos)
/* 356BB4 E0048234 26B5A66C */  addiu     $s5, $s5, %lo(gMainGfxPos)
/* 356BB8 E0048238 AFB300B4 */  sw        $s3, 0xB4($sp)
/* 356BBC E004823C 3C130001 */  lui       $s3, (0x11630 >> 16)
/* 356BC0 E0048240 36731630 */  ori       $s3, $s3, (0x11630 & 0xFFFF)
/* 356BC4 E0048244 AFBF00CC */  sw        $ra, 0xCC($sp)
/* 356BC8 E0048248 AFBE00C8 */  sw        $fp, 0xC8($sp)
/* 356BCC E004824C AFB700C4 */  sw        $s7, 0xC4($sp)
/* 356BD0 E0048250 AFB600C0 */  sw        $s6, 0xC0($sp)
/* 356BD4 E0048254 AFB400B8 */  sw        $s4, 0xB8($sp)
/* 356BD8 E0048258 AFB200B0 */  sw        $s2, 0xB0($sp)
/* 356BDC E004825C AFB100AC */  sw        $s1, 0xAC($sp)
/* 356BE0 E0048260 AFB000A8 */  sw        $s0, 0xA8($sp)
/* 356BE4 E0048264 F7B600D8 */  sdc1      $f22, 0xD8($sp)
/* 356BE8 E0048268 F7B400D0 */  sdc1      $f20, 0xD0($sp)
/* 356BEC E004826C 8EA80000 */  lw        $t0, 0x0($s5)
/* 356BF0 E0048270 8CD4000C */  lw        $s4, 0xC($a2)
/* 356BF4 E0048274 4480A000 */  mtc1      $zero, $f20
/* 356BF8 E0048278 3C014380 */  lui       $at, (0x43800000 >> 16)
/* 356BFC E004827C 44812000 */  mtc1      $at, $f4
/* 356C00 E0048280 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 356C04 E0048284 4481B000 */  mtc1      $at, $f22
/* 356C08 E0048288 0100182D */  daddu     $v1, $t0, $zero
/* 356C0C E004828C 96920000 */  lhu       $s2, 0x0($s4)
/* 356C10 E0048290 4405A000 */  mfc1      $a1, $f20
/* 356C14 E0048294 C6860020 */  lwc1      $f6, 0x20($s4)
/* 356C18 E0048298 00121080 */  sll       $v0, $s2, 2
/* 356C1C E004829C 3C0AE005 */  lui       $t2, (0xE0050000 >> 16)
/* 356C20 E00482A0 01425021 */  addu      $t2, $t2, $v0
/* 356C24 E00482A4 8D4A8A00 */  lw        $t2, -0x7600($t2)
/* 356C28 E00482A8 25080008 */  addiu     $t0, $t0, 0x8
/* 356C2C E00482AC AFAA00A0 */  sw        $t2, 0xA0($sp)
/* 356C30 E00482B0 3C09E005 */  lui       $t1, (0xE0050000 >> 16)
/* 356C34 E00482B4 01224821 */  addu      $t1, $t1, $v0
/* 356C38 E00482B8 8D298A08 */  lw        $t1, -0x75F8($t1)
/* 356C3C E00482BC 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 356C40 E00482C0 4600328D */  trunc.w.s $f10, $f6
/* 356C44 E00482C4 44165000 */  mfc1      $s6, $f10
/* 356C48 E00482C8 00000000 */  nop
/* 356C4C E00482CC 44961000 */  mtc1      $s6, $f2
/* 356C50 E00482D0 00000000 */  nop
/* 356C54 E00482D4 468010A0 */  cvt.s.w   $f2, $f2
/* 356C58 E00482D8 46023181 */  sub.s     $f6, $f6, $f2
/* 356C5C E00482DC AC620000 */  sw        $v0, 0x0($v1)
/* 356C60 E00482E0 AC600004 */  sw        $zero, 0x4($v1)
/* 356C64 E00482E4 AD070000 */  sw        $a3, 0x0($t0)
/* 356C68 E00482E8 8CC20010 */  lw        $v0, 0x10($a2)
/* 356C6C E00482EC 4407A000 */  mfc1      $a3, $f20
/* 356C70 E00482F0 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 356C74 E00482F4 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 356C78 E00482F8 8C46001C */  lw        $a2, 0x1C($v0)
/* 356C7C E00482FC 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 356C80 E0048300 AD020008 */  sw        $v0, 0x8($t0)
/* 356C84 E0048304 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 356C88 E0048308 AD09000C */  sw        $t1, 0xC($t0)
/* 356C8C E004830C 00C23021 */  addu      $a2, $a2, $v0
/* 356C90 E0048310 00031080 */  sll       $v0, $v1, 2
/* 356C94 E0048314 00431021 */  addu      $v0, $v0, $v1
/* 356C98 E0048318 00021080 */  sll       $v0, $v0, 2
/* 356C9C E004831C 00431023 */  subu      $v0, $v0, $v1
/* 356CA0 E0048320 000218C0 */  sll       $v1, $v0, 3
/* 356CA4 E0048324 00431021 */  addu      $v0, $v0, $v1
/* 356CA8 E0048328 000210C0 */  sll       $v0, $v0, 3
/* 356CAC E004832C AD060004 */  sw        $a2, 0x4($t0)
/* 356CB0 E0048330 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 356CB4 E0048334 00220821 */  addu      $at, $at, $v0
/* 356CB8 E0048338 C4281DEC */  lwc1      $f8, %lo(gCameras + 0x6C)($at)
/* 356CBC E004833C C6800010 */  lwc1      $f0, 0x10($s4)
/* 356CC0 E0048340 25020008 */  addiu     $v0, $t0, 0x8
/* 356CC4 E0048344 AEA80000 */  sw        $t0, 0x0($s5)
/* 356CC8 E0048348 25080010 */  addiu     $t0, $t0, 0x10
/* 356CCC E004834C 46004207 */  neg.s     $f8, $f8
/* 356CD0 E0048350 E7A00010 */  swc1      $f0, 0x10($sp)
/* 356CD4 E0048354 C6800004 */  lwc1      $f0, 0x4($s4)
/* 356CD8 E0048358 44064000 */  mfc1      $a2, $f8
/* 356CDC E004835C 46043182 */  mul.s     $f6, $f6, $f4
/* 356CE0 E0048360 00000000 */  nop
/* 356CE4 E0048364 AEA20000 */  sw        $v0, 0x0($s5)
/* 356CE8 E0048368 3AC20007 */  xori      $v0, $s6, 0x7
/* 356CEC E004836C E7A00014 */  swc1      $f0, 0x14($sp)
/* 356CF0 E0048370 C6800008 */  lwc1      $f0, 0x8($s4)
/* 356CF4 E0048374 2C5E0001 */  sltiu     $fp, $v0, 0x1
/* 356CF8 E0048378 AEA80000 */  sw        $t0, 0x0($s5)
/* 356CFC E004837C E7A00018 */  swc1      $f0, 0x18($sp)
/* 356D00 E0048380 C680000C */  lwc1      $f0, 0xC($s4)
/* 356D04 E0048384 4600328D */  trunc.w.s $f10, $f6
/* 356D08 E0048388 44175000 */  mfc1      $s7, $f10
/* 356D0C E004838C 0C080180 */  jal       shim_guPositionF
/* 356D10 E0048390 E7A0001C */   swc1     $f0, 0x1C($sp)
/* 356D14 E0048394 27B00060 */  addiu     $s0, $sp, 0x60
/* 356D18 E0048398 E7B60010 */  swc1      $f22, 0x10($sp)
/* 356D1C E004839C 8E850024 */  lw        $a1, 0x24($s4)
/* 356D20 E00483A0 4406A000 */  mfc1      $a2, $f20
/* 356D24 E00483A4 4407A000 */  mfc1      $a3, $f20
/* 356D28 E00483A8 0C080104 */  jal       shim_guRotateF
/* 356D2C E00483AC 0200202D */   daddu    $a0, $s0, $zero
/* 356D30 E00483B0 0200202D */  daddu     $a0, $s0, $zero
/* 356D34 E00483B4 27A50020 */  addiu     $a1, $sp, 0x20
/* 356D38 E00483B8 0C080114 */  jal       shim_guMtxCatF
/* 356D3C E00483BC 00A0302D */   daddu    $a2, $a1, $zero
/* 356D40 E00483C0 27A40020 */  addiu     $a0, $sp, 0x20
/* 356D44 E00483C4 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* 356D48 E00483C8 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* 356D4C E00483CC 3C11800A */  lui       $s1, %hi(gDisplayContext)
/* 356D50 E00483D0 2631A674 */  addiu     $s1, $s1, %lo(gDisplayContext)
/* 356D54 E00483D4 96050000 */  lhu       $a1, 0x0($s0)
/* 356D58 E00483D8 8E220000 */  lw        $v0, 0x0($s1)
/* 356D5C E00483DC 00052980 */  sll       $a1, $a1, 6
/* 356D60 E00483E0 00B32821 */  addu      $a1, $a1, $s3
/* 356D64 E00483E4 0C080118 */  jal       shim_guMtxF2L
/* 356D68 E00483E8 00452821 */   addu     $a1, $v0, $a1
/* 356D6C E00483EC 8EA60000 */  lw        $a2, 0x0($s5)
/* 356D70 E00483F0 00C0202D */  daddu     $a0, $a2, $zero
/* 356D74 E00483F4 24C60008 */  addiu     $a2, $a2, 0x8
/* 356D78 E00483F8 AEA60000 */  sw        $a2, 0x0($s5)
/* 356D7C E00483FC 96020000 */  lhu       $v0, 0x0($s0)
/* 356D80 E0048400 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 356D84 E0048404 AC830000 */  sw        $v1, 0x0($a0)
/* 356D88 E0048408 24430001 */  addiu     $v1, $v0, 0x1
/* 356D8C E004840C 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 356D90 E0048410 00021180 */  sll       $v0, $v0, 6
/* 356D94 E0048414 A6030000 */  sh        $v1, 0x0($s0)
/* 356D98 E0048418 8E230000 */  lw        $v1, 0x0($s1)
/* 356D9C E004841C 00531021 */  addu      $v0, $v0, $s3
/* 356DA0 E0048420 00621821 */  addu      $v1, $v1, $v0
/* 356DA4 E0048424 1640010F */  bnez      $s2, .LE0048864
/* 356DA8 E0048428 AC830004 */   sw       $v1, 0x4($a0)
/* 356DAC E004842C C6800020 */  lwc1      $f0, 0x20($s4)
/* 356DB0 E0048430 3C0140A0 */  lui       $at, (0x40A00000 >> 16)
/* 356DB4 E0048434 44811000 */  mtc1      $at, $f2
/* 356DB8 E0048438 00000000 */  nop
/* 356DBC E004843C 4600103C */  c.lt.s    $f2, $f0
/* 356DC0 E0048440 00000000 */  nop
/* 356DC4 E0048444 45000007 */  bc1f      .LE0048464
/* 356DC8 E0048448 4600B106 */   mov.s    $f4, $f22
/* 356DCC E004844C 46020001 */  sub.s     $f0, $f0, $f2
/* 356DD0 E0048450 46002101 */  sub.s     $f4, $f4, $f0
/* 356DD4 E0048454 4614203C */  c.lt.s    $f4, $f20
/* 356DD8 E0048458 00000000 */  nop
/* 356DDC E004845C 45030001 */  bc1tl     .LE0048464
/* 356DE0 E0048460 4600A106 */   mov.s    $f4, $f20
.LE0048464:
/* 356DE4 E0048464 3C03800A */  lui       $v1, %hi(gMainGfxPos)
/* 356DE8 E0048468 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
/* 356DEC E004846C 8C620000 */  lw        $v0, 0x0($v1)
/* 356DF0 E0048470 3C01437F */  lui       $at, (0x437F0000 >> 16)
/* 356DF4 E0048474 44810000 */  mtc1      $at, $f0
/* 356DF8 E0048478 3C014F00 */  lui       $at, (0x4F000000 >> 16)
/* 356DFC E004847C 44811000 */  mtc1      $at, $f2
/* 356E00 E0048480 0040202D */  daddu     $a0, $v0, $zero
/* 356E04 E0048484 24420008 */  addiu     $v0, $v0, 0x8
/* 356E08 E0048488 46002002 */  mul.s     $f0, $f4, $f0
/* 356E0C E004848C 00000000 */  nop
/* 356E10 E0048490 AC620000 */  sw        $v0, 0x0($v1)
/* 356E14 E0048494 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 356E18 E0048498 AC820000 */  sw        $v0, 0x0($a0)
/* 356E1C E004849C 4600103E */  c.le.s    $f2, $f0
/* 356E20 E00484A0 00000000 */  nop
/* 356E24 E00484A4 45010005 */  bc1t      .LE00484BC
/* 356E28 E00484A8 24840004 */   addiu    $a0, $a0, 0x4
/* 356E2C E00484AC 4600028D */  trunc.w.s $f10, $f0
/* 356E30 E00484B0 44035000 */  mfc1      $v1, $f10
/* 356E34 E00484B4 08012135 */  j         .LE00484D4
/* 356E38 E00484B8 00000000 */   nop
.LE00484BC:
/* 356E3C E00484BC 46020001 */  sub.s     $f0, $f0, $f2
/* 356E40 E00484C0 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 356E44 E00484C4 4600028D */  trunc.w.s $f10, $f0
/* 356E48 E00484C8 44035000 */  mfc1      $v1, $f10
/* 356E4C E00484CC 00000000 */  nop
/* 356E50 E00484D0 00621825 */  or        $v1, $v1, $v0
.LE00484D4:
/* 356E54 E00484D4 3C014190 */  lui       $at, (0x41900000 >> 16)
/* 356E58 E00484D8 44810000 */  mtc1      $at, $f0
/* 356E5C E00484DC 00000000 */  nop
/* 356E60 E00484E0 46002002 */  mul.s     $f0, $f4, $f0
/* 356E64 E00484E4 00000000 */  nop
/* 356E68 E00484E8 3C014F00 */  lui       $at, (0x4F000000 >> 16)
/* 356E6C E00484EC 44811000 */  mtc1      $at, $f2
/* 356E70 E00484F0 00000000 */  nop
/* 356E74 E00484F4 4600103E */  c.le.s    $f2, $f0
/* 356E78 E00484F8 00000000 */  nop
/* 356E7C E00484FC 45010005 */  bc1t      .LE0048514
/* 356E80 E0048500 00032E00 */   sll      $a1, $v1, 24
/* 356E84 E0048504 4600028D */  trunc.w.s $f10, $f0
/* 356E88 E0048508 44035000 */  mfc1      $v1, $f10
/* 356E8C E004850C 0801214B */  j         .LE004852C
/* 356E90 E0048510 00000000 */   nop
.LE0048514:
/* 356E94 E0048514 46020001 */  sub.s     $f0, $f0, $f2
/* 356E98 E0048518 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 356E9C E004851C 4600028D */  trunc.w.s $f10, $f0
/* 356EA0 E0048520 44035000 */  mfc1      $v1, $f10
/* 356EA4 E0048524 00000000 */  nop
/* 356EA8 E0048528 00621825 */  or        $v1, $v1, $v0
.LE004852C:
/* 356EAC E004852C 3C01426C */  lui       $at, (0x426C0000 >> 16)
/* 356EB0 E0048530 44810000 */  mtc1      $at, $f0
/* 356EB4 E0048534 00000000 */  nop
/* 356EB8 E0048538 46002002 */  mul.s     $f0, $f4, $f0
/* 356EBC E004853C 00000000 */  nop
/* 356EC0 E0048540 306200FF */  andi      $v0, $v1, 0xFF
/* 356EC4 E0048544 00021400 */  sll       $v0, $v0, 16
/* 356EC8 E0048548 3C014F00 */  lui       $at, (0x4F000000 >> 16)
/* 356ECC E004854C 44811000 */  mtc1      $at, $f2
/* 356ED0 E0048550 00000000 */  nop
/* 356ED4 E0048554 4600103E */  c.le.s    $f2, $f0
/* 356ED8 E0048558 00000000 */  nop
/* 356EDC E004855C 45010005 */  bc1t      .LE0048574
/* 356EE0 E0048560 00A23825 */   or       $a3, $a1, $v0
/* 356EE4 E0048564 4600028D */  trunc.w.s $f10, $f0
/* 356EE8 E0048568 44065000 */  mfc1      $a2, $f10
/* 356EEC E004856C 08012163 */  j         .LE004858C
/* 356EF0 E0048570 00000000 */   nop
.LE0048574:
/* 356EF4 E0048574 46020001 */  sub.s     $f0, $f0, $f2
/* 356EF8 E0048578 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 356EFC E004857C 4600028D */  trunc.w.s $f10, $f0
/* 356F00 E0048580 44065000 */  mfc1      $a2, $f10
/* 356F04 E0048584 00000000 */  nop
/* 356F08 E0048588 00C23025 */  or        $a2, $a2, $v0
.LE004858C:
/* 356F0C E004858C 3C05800A */  lui       $a1, %hi(gMainGfxPos)
/* 356F10 E0048590 24A5A66C */  addiu     $a1, $a1, %lo(gMainGfxPos)
/* 356F14 E0048594 30C200FF */  andi      $v0, $a2, 0xFF
/* 356F18 E0048598 00021200 */  sll       $v0, $v0, 8
/* 356F1C E004859C 8CA30000 */  lw        $v1, 0x0($a1)
/* 356F20 E00485A0 00E21025 */  or        $v0, $a3, $v0
/* 356F24 E00485A4 AC820000 */  sw        $v0, 0x0($a0)
/* 356F28 E00485A8 3C02FB00 */  lui       $v0, (0xFB000000 >> 16)
/* 356F2C E00485AC 3C01437F */  lui       $at, (0x437F0000 >> 16)
/* 356F30 E00485B0 44810000 */  mtc1      $at, $f0
/* 356F34 E00485B4 3C014F00 */  lui       $at, (0x4F000000 >> 16)
/* 356F38 E00485B8 44811000 */  mtc1      $at, $f2
/* 356F3C E00485BC 0060202D */  daddu     $a0, $v1, $zero
/* 356F40 E00485C0 46002002 */  mul.s     $f0, $f4, $f0
/* 356F44 E00485C4 00000000 */  nop
/* 356F48 E00485C8 24630008 */  addiu     $v1, $v1, 0x8
/* 356F4C E00485CC 24870004 */  addiu     $a3, $a0, 0x4
/* 356F50 E00485D0 ACA30000 */  sw        $v1, 0x0($a1)
/* 356F54 E00485D4 4600103E */  c.le.s    $f2, $f0
/* 356F58 E00485D8 00000000 */  nop
/* 356F5C E00485DC 45010005 */  bc1t      .LE00485F4
/* 356F60 E00485E0 AC820000 */   sw       $v0, 0x0($a0)
/* 356F64 E00485E4 4600028D */  trunc.w.s $f10, $f0
/* 356F68 E00485E8 44035000 */  mfc1      $v1, $f10
/* 356F6C E00485EC 08012183 */  j         .LE004860C
/* 356F70 E00485F0 00000000 */   nop
.LE00485F4:
/* 356F74 E00485F4 46020001 */  sub.s     $f0, $f0, $f2
/* 356F78 E00485F8 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 356F7C E00485FC 4600028D */  trunc.w.s $f10, $f0
/* 356F80 E0048600 44035000 */  mfc1      $v1, $f10
/* 356F84 E0048604 00000000 */  nop
/* 356F88 E0048608 00621825 */  or        $v1, $v1, $v0
.LE004860C:
/* 356F8C E004860C 3C014254 */  lui       $at, (0x42540000 >> 16)
/* 356F90 E0048610 44810000 */  mtc1      $at, $f0
/* 356F94 E0048614 00000000 */  nop
/* 356F98 E0048618 46002002 */  mul.s     $f0, $f4, $f0
/* 356F9C E004861C 00000000 */  nop
/* 356FA0 E0048620 3C014F00 */  lui       $at, (0x4F000000 >> 16)
/* 356FA4 E0048624 44811000 */  mtc1      $at, $f2
/* 356FA8 E0048628 00000000 */  nop
/* 356FAC E004862C 4600103E */  c.le.s    $f2, $f0
/* 356FB0 E0048630 00000000 */  nop
/* 356FB4 E0048634 45010005 */  bc1t      .LE004864C
/* 356FB8 E0048638 00032600 */   sll      $a0, $v1, 24
/* 356FBC E004863C 4600028D */  trunc.w.s $f10, $f0
/* 356FC0 E0048640 44035000 */  mfc1      $v1, $f10
/* 356FC4 E0048644 08012199 */  j         .LE0048664
/* 356FC8 E0048648 00000000 */   nop
.LE004864C:
/* 356FCC E004864C 46020001 */  sub.s     $f0, $f0, $f2
/* 356FD0 E0048650 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 356FD4 E0048654 4600028D */  trunc.w.s $f10, $f0
/* 356FD8 E0048658 44035000 */  mfc1      $v1, $f10
/* 356FDC E004865C 00000000 */  nop
/* 356FE0 E0048660 00621825 */  or        $v1, $v1, $v0
.LE0048664:
/* 356FE4 E0048664 3C0141C0 */  lui       $at, (0x41C00000 >> 16)
/* 356FE8 E0048668 44810000 */  mtc1      $at, $f0
/* 356FEC E004866C 00000000 */  nop
/* 356FF0 E0048670 46002002 */  mul.s     $f0, $f4, $f0
/* 356FF4 E0048674 00000000 */  nop
/* 356FF8 E0048678 306200FF */  andi      $v0, $v1, 0xFF
/* 356FFC E004867C 00021400 */  sll       $v0, $v0, 16
/* 357000 E0048680 3C014F00 */  lui       $at, (0x4F000000 >> 16)
/* 357004 E0048684 44811000 */  mtc1      $at, $f2
/* 357008 E0048688 00000000 */  nop
/* 35700C E004868C 4600103E */  c.le.s    $f2, $f0
/* 357010 E0048690 00000000 */  nop
/* 357014 E0048694 45010005 */  bc1t      .LE00486AC
/* 357018 E0048698 00823025 */   or       $a2, $a0, $v0
/* 35701C E004869C 4600028D */  trunc.w.s $f10, $f0
/* 357020 E00486A0 44035000 */  mfc1      $v1, $f10
/* 357024 E00486A4 080121B1 */  j         .LE00486C4
/* 357028 E00486A8 00000000 */   nop
.LE00486AC:
/* 35702C E00486AC 46020001 */  sub.s     $f0, $f0, $f2
/* 357030 E00486B0 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 357034 E00486B4 4600028D */  trunc.w.s $f10, $f0
/* 357038 E00486B8 44035000 */  mfc1      $v1, $f10
/* 35703C E00486BC 00000000 */  nop
/* 357040 E00486C0 00621825 */  or        $v1, $v1, $v0
.LE00486C4:
/* 357044 E00486C4 3C05800A */  lui       $a1, %hi(gMainGfxPos)
/* 357048 E00486C8 24A5A66C */  addiu     $a1, $a1, %lo(gMainGfxPos)
/* 35704C E00486CC 306200FF */  andi      $v0, $v1, 0xFF
/* 357050 E00486D0 00021200 */  sll       $v0, $v0, 8
/* 357054 E00486D4 00C21025 */  or        $v0, $a2, $v0
/* 357058 E00486D8 32E300FF */  andi      $v1, $s7, 0xFF
/* 35705C E00486DC 8CA40000 */  lw        $a0, 0x0($a1)
/* 357060 E00486E0 00431025 */  or        $v0, $v0, $v1
/* 357064 E00486E4 ACE20000 */  sw        $v0, 0x0($a3)
/* 357068 E00486E8 3C02EB00 */  lui       $v0, (0xEB000000 >> 16)
/* 35706C E00486EC 3C014353 */  lui       $at, (0x43530000 >> 16)
/* 357070 E00486F0 44810000 */  mtc1      $at, $f0
/* 357074 E00486F4 3C014F00 */  lui       $at, (0x4F000000 >> 16)
/* 357078 E00486F8 44811000 */  mtc1      $at, $f2
/* 35707C E00486FC 0080182D */  daddu     $v1, $a0, $zero
/* 357080 E0048700 46002002 */  mul.s     $f0, $f4, $f0
/* 357084 E0048704 00000000 */  nop
/* 357088 E0048708 24840008 */  addiu     $a0, $a0, 0x8
/* 35708C E004870C 24660004 */  addiu     $a2, $v1, 0x4
/* 357090 E0048710 ACA40000 */  sw        $a0, 0x0($a1)
/* 357094 E0048714 4600103E */  c.le.s    $f2, $f0
/* 357098 E0048718 00000000 */  nop
/* 35709C E004871C 45010005 */  bc1t      .LE0048734
/* 3570A0 E0048720 AC620000 */   sw       $v0, 0x0($v1)
/* 3570A4 E0048724 4600028D */  trunc.w.s $f10, $f0
/* 3570A8 E0048728 44055000 */  mfc1      $a1, $f10
/* 3570AC E004872C 080121D3 */  j         .LE004874C
/* 3570B0 E0048730 00000000 */   nop
.LE0048734:
/* 3570B4 E0048734 46020001 */  sub.s     $f0, $f0, $f2
/* 3570B8 E0048738 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 3570BC E004873C 4600028D */  trunc.w.s $f10, $f0
/* 3570C0 E0048740 44055000 */  mfc1      $a1, $f10
/* 3570C4 E0048744 00000000 */  nop
/* 3570C8 E0048748 00A22825 */  or        $a1, $a1, $v0
.LE004874C:
/* 3570CC E004874C 3C04800A */  lui       $a0, %hi(gMainGfxPos)
/* 3570D0 E0048750 2484A66C */  addiu     $a0, $a0, %lo(gMainGfxPos)
/* 3570D4 E0048754 30A200FF */  andi      $v0, $a1, 0xFF
/* 3570D8 E0048758 8C830000 */  lw        $v1, 0x0($a0)
/* 3570DC E004875C 00021200 */  sll       $v0, $v0, 8
/* 3570E0 E0048760 ACC20000 */  sw        $v0, 0x0($a2)
/* 3570E4 E0048764 3C02EA00 */  lui       $v0, (0xEA000000 >> 16)
/* 3570E8 E0048768 3C01437F */  lui       $at, (0x437F0000 >> 16)
/* 3570EC E004876C 44810000 */  mtc1      $at, $f0
/* 3570F0 E0048770 3C014F00 */  lui       $at, (0x4F000000 >> 16)
/* 3570F4 E0048774 44811000 */  mtc1      $at, $f2
/* 3570F8 E0048778 0060282D */  daddu     $a1, $v1, $zero
/* 3570FC E004877C 46002002 */  mul.s     $f0, $f4, $f0
/* 357100 E0048780 00000000 */  nop
/* 357104 E0048784 24630008 */  addiu     $v1, $v1, 0x8
/* 357108 E0048788 24A90004 */  addiu     $t1, $a1, 0x4
/* 35710C E004878C AC830000 */  sw        $v1, 0x0($a0)
/* 357110 E0048790 4600103E */  c.le.s    $f2, $f0
/* 357114 E0048794 00000000 */  nop
/* 357118 E0048798 45010005 */  bc1t      .LE00487B0
/* 35711C E004879C ACA20000 */   sw       $v0, 0x0($a1)
/* 357120 E00487A0 4600028D */  trunc.w.s $f10, $f0
/* 357124 E00487A4 44035000 */  mfc1      $v1, $f10
/* 357128 E00487A8 080121F2 */  j         .LE00487C8
/* 35712C E00487AC 00000000 */   nop
.LE00487B0:
/* 357130 E00487B0 46020001 */  sub.s     $f0, $f0, $f2
/* 357134 E00487B4 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 357138 E00487B8 4600028D */  trunc.w.s $f10, $f0
/* 35713C E00487BC 44035000 */  mfc1      $v1, $f10
/* 357140 E00487C0 00000000 */  nop
/* 357144 E00487C4 00621825 */  or        $v1, $v1, $v0
.LE00487C8:
/* 357148 E00487C8 3C014358 */  lui       $at, (0x43580000 >> 16)
/* 35714C E00487CC 44810000 */  mtc1      $at, $f0
/* 357150 E00487D0 00000000 */  nop
/* 357154 E00487D4 46002002 */  mul.s     $f0, $f4, $f0
/* 357158 E00487D8 00000000 */  nop
/* 35715C E00487DC 3C014F00 */  lui       $at, (0x4F000000 >> 16)
/* 357160 E00487E0 44811000 */  mtc1      $at, $f2
/* 357164 E00487E4 00000000 */  nop
/* 357168 E00487E8 4600103E */  c.le.s    $f2, $f0
/* 35716C E00487EC 00000000 */  nop
/* 357170 E00487F0 45010005 */  bc1t      .LE0048808
/* 357174 E00487F4 00034600 */   sll      $t0, $v1, 24
/* 357178 E00487F8 4600028D */  trunc.w.s $f10, $f0
/* 35717C E00487FC 44075000 */  mfc1      $a3, $f10
/* 357180 E0048800 08012209 */  j         .LE0048824
/* 357184 E0048804 3C06FC26 */   lui      $a2, (0xFC262A60 >> 16)
.LE0048808:
/* 357188 E0048808 46020001 */  sub.s     $f0, $f0, $f2
/* 35718C E004880C 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 357190 E0048810 4600028D */  trunc.w.s $f10, $f0
/* 357194 E0048814 44075000 */  mfc1      $a3, $f10
/* 357198 E0048818 00000000 */  nop
/* 35719C E004881C 00E23825 */  or        $a3, $a3, $v0
/* 3571A0 E0048820 3C06FC26 */  lui       $a2, (0xFC262A60 >> 16)
.LE0048824:
/* 3571A4 E0048824 34C62A60 */  ori       $a2, $a2, (0xFC262A60 & 0xFFFF)
/* 3571A8 E0048828 3C0516FC */  lui       $a1, (0x16FC9378 >> 16)
/* 3571AC E004882C 34A59378 */  ori       $a1, $a1, (0x16FC9378 & 0xFFFF)
/* 3571B0 E0048830 3C04800A */  lui       $a0, %hi(gMainGfxPos)
/* 3571B4 E0048834 2484A66C */  addiu     $a0, $a0, %lo(gMainGfxPos)
/* 3571B8 E0048838 30E200FF */  andi      $v0, $a3, 0xFF
/* 3571BC E004883C 00021200 */  sll       $v0, $v0, 8
/* 3571C0 E0048840 8C830000 */  lw        $v1, 0x0($a0)
/* 3571C4 E0048844 01021025 */  or        $v0, $t0, $v0
/* 3571C8 E0048848 AD220000 */  sw        $v0, 0x0($t1)
/* 3571CC E004884C 0060102D */  daddu     $v0, $v1, $zero
/* 3571D0 E0048850 24630008 */  addiu     $v1, $v1, 0x8
/* 3571D4 E0048854 AC830000 */  sw        $v1, 0x0($a0)
/* 3571D8 E0048858 AC460000 */  sw        $a2, 0x0($v0)
/* 3571DC E004885C 08012230 */  j         .LE00488C0
/* 3571E0 E0048860 AC450004 */   sw       $a1, 0x4($v0)
.LE0048864:
/* 3571E4 E0048864 3C04FC26 */  lui       $a0, (0xFC262AC3 >> 16)
/* 3571E8 E0048868 34842AC3 */  ori       $a0, $a0, (0xFC262AC3 & 0xFFFF)
/* 3571EC E004886C 3C0310FC */  lui       $v1, (0x10FC9238 >> 16)
/* 3571F0 E0048870 34639238 */  ori       $v1, $v1, (0x10FC9238 & 0xFFFF)
/* 3571F4 E0048874 3C05FFFF */  lui       $a1, (0xFFFF287F >> 16)
/* 3571F8 E0048878 34A5287F */  ori       $a1, $a1, (0xFFFF287F & 0xFFFF)
/* 3571FC E004887C 24C20008 */  addiu     $v0, $a2, 0x8
/* 357200 E0048880 AEA20000 */  sw        $v0, 0x0($s5)
/* 357204 E0048884 24C20010 */  addiu     $v0, $a2, 0x10
/* 357208 E0048888 ACC40000 */  sw        $a0, 0x0($a2)
/* 35720C E004888C ACC30004 */  sw        $v1, 0x4($a2)
/* 357210 E0048890 AEA20000 */  sw        $v0, 0x0($s5)
/* 357214 E0048894 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 357218 E0048898 ACC20008 */  sw        $v0, 0x8($a2)
/* 35721C E004889C 24C20018 */  addiu     $v0, $a2, 0x18
/* 357220 E00488A0 ACC5000C */  sw        $a1, 0xC($a2)
/* 357224 E00488A4 AEA20000 */  sw        $v0, 0x0($s5)
/* 357228 E00488A8 3C02FB00 */  lui       $v0, (0xFB000000 >> 16)
/* 35722C E00488AC ACC20010 */  sw        $v0, 0x10($a2)
/* 357230 E00488B0 32E200FF */  andi      $v0, $s7, 0xFF
/* 357234 E00488B4 24038B00 */  addiu     $v1, $zero, -0x7500
/* 357238 E00488B8 00431025 */  or        $v0, $v0, $v1
/* 35723C E00488BC ACC20014 */  sw        $v0, 0x14($a2)
.LE00488C0:
/* 357240 E00488C0 3C08800A */  lui       $t0, %hi(gMainGfxPos)
/* 357244 E00488C4 2508A66C */  addiu     $t0, $t0, %lo(gMainGfxPos)
/* 357248 E00488C8 001611C0 */  sll       $v0, $s6, 7
/* 35724C E00488CC 30420FFF */  andi      $v0, $v0, 0xFFF
/* 357250 E00488D0 00021300 */  sll       $v0, $v0, 12
/* 357254 E00488D4 3C04F200 */  lui       $a0, (0xF2000080 >> 16)
/* 357258 E00488D8 00441025 */  or        $v0, $v0, $a0
/* 35725C E00488DC 8D050000 */  lw        $a1, 0x0($t0)
/* 357260 E00488E0 00163940 */  sll       $a3, $s6, 5
/* 357264 E00488E4 00A0182D */  daddu     $v1, $a1, $zero
/* 357268 E00488E8 24A50008 */  addiu     $a1, $a1, 0x8
/* 35726C E00488EC AD050000 */  sw        $a1, 0x0($t0)
/* 357270 E00488F0 AC620000 */  sw        $v0, 0x0($v1)
/* 357274 E00488F4 24E20020 */  addiu     $v0, $a3, 0x20
/* 357278 E00488F8 00021080 */  sll       $v0, $v0, 2
/* 35727C E00488FC 30420FFF */  andi      $v0, $v0, 0xFFF
/* 357280 E0048900 00023300 */  sll       $a2, $v0, 12
/* 357284 E0048904 34C20080 */  ori       $v0, $a2, 0x80
/* 357288 E0048908 13C0000F */  beqz      $fp, .LE0048948
/* 35728C E004890C AC620004 */   sw       $v0, 0x4($v1)
/* 357290 E0048910 0080182D */  daddu     $v1, $a0, $zero
/* 357294 E0048914 34630080 */  ori       $v1, $v1, (0xF2000080 & 0xFFFF)
/* 357298 E0048918 3C040100 */  lui       $a0, (0x1000100 >> 16)
/* 35729C E004891C 34840100 */  ori       $a0, $a0, (0x1000100 & 0xFFFF)
/* 3572A0 E0048920 24A20008 */  addiu     $v0, $a1, 0x8
/* 3572A4 E0048924 00C31825 */  or        $v1, $a2, $v1
/* 3572A8 E0048928 AD020000 */  sw        $v0, 0x0($t0)
/* 3572AC E004892C 24E20040 */  addiu     $v0, $a3, 0x40
/* 3572B0 E0048930 00021080 */  sll       $v0, $v0, 2
/* 3572B4 E0048934 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3572B8 E0048938 00021300 */  sll       $v0, $v0, 12
/* 3572BC E004893C 00441025 */  or        $v0, $v0, $a0
/* 3572C0 E0048940 0801225D */  j         .LE0048974
/* 3572C4 E0048944 ACA30000 */   sw       $v1, 0x0($a1)
.LE0048948:
/* 3572C8 E0048948 3C030100 */  lui       $v1, (0x1000080 >> 16)
/* 3572CC E004894C 34630080 */  ori       $v1, $v1, (0x1000080 & 0xFFFF)
/* 3572D0 E0048950 24A20008 */  addiu     $v0, $a1, 0x8
/* 3572D4 E0048954 AD020000 */  sw        $v0, 0x0($t0)
/* 3572D8 E0048958 00C41025 */  or        $v0, $a2, $a0
/* 3572DC E004895C ACA20000 */  sw        $v0, 0x0($a1)
/* 3572E0 E0048960 24E20040 */  addiu     $v0, $a3, 0x40
/* 3572E4 E0048964 00021080 */  sll       $v0, $v0, 2
/* 3572E8 E0048968 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3572EC E004896C 00021300 */  sll       $v0, $v0, 12
/* 3572F0 E0048970 00431025 */  or        $v0, $v0, $v1
.LE0048974:
/* 3572F4 E0048974 ACA20004 */  sw        $v0, 0x4($a1)
/* 3572F8 E0048978 3C06D838 */  lui       $a2, (0xD8380002 >> 16)
/* 3572FC E004897C 3C04800A */  lui       $a0, %hi(gMainGfxPos)
/* 357300 E0048980 2484A66C */  addiu     $a0, $a0, %lo(gMainGfxPos)
/* 357304 E0048984 34C60002 */  ori       $a2, $a2, (0xD8380002 & 0xFFFF)
/* 357308 E0048988 8C820000 */  lw        $v0, 0x0($a0)
/* 35730C E004898C 3C03DE00 */  lui       $v1, (0xDE000000 >> 16)
/* 357310 E0048990 0040282D */  daddu     $a1, $v0, $zero
/* 357314 E0048994 24420008 */  addiu     $v0, $v0, 0x8
/* 357318 E0048998 AC820000 */  sw        $v0, 0x0($a0)
/* 35731C E004899C ACA30000 */  sw        $v1, 0x0($a1)
/* 357320 E00489A0 8FAA00A0 */  lw        $t2, 0xA0($sp)
/* 357324 E00489A4 24430008 */  addiu     $v1, $v0, 0x8
/* 357328 E00489A8 ACAA0004 */  sw        $t2, 0x4($a1)
/* 35732C E00489AC AC830000 */  sw        $v1, 0x0($a0)
/* 357330 E00489B0 24030040 */  addiu     $v1, $zero, 0x40
/* 357334 E00489B4 AC460000 */  sw        $a2, 0x0($v0)
/* 357338 E00489B8 AC430004 */  sw        $v1, 0x4($v0)
/* 35733C E00489BC 8FBF00CC */  lw        $ra, 0xCC($sp)
/* 357340 E00489C0 8FBE00C8 */  lw        $fp, 0xC8($sp)
/* 357344 E00489C4 8FB700C4 */  lw        $s7, 0xC4($sp)
/* 357348 E00489C8 8FB600C0 */  lw        $s6, 0xC0($sp)
/* 35734C E00489CC 8FB500BC */  lw        $s5, 0xBC($sp)
/* 357350 E00489D0 8FB400B8 */  lw        $s4, 0xB8($sp)
/* 357354 E00489D4 8FB300B4 */  lw        $s3, 0xB4($sp)
/* 357358 E00489D8 8FB200B0 */  lw        $s2, 0xB0($sp)
/* 35735C E00489DC 8FB100AC */  lw        $s1, 0xAC($sp)
/* 357360 E00489E0 8FB000A8 */  lw        $s0, 0xA8($sp)
/* 357364 E00489E4 D7B600D8 */  ldc1      $f22, 0xD8($sp)
/* 357368 E00489E8 D7B400D0 */  ldc1      $f20, 0xD0($sp)
/* 35736C E00489EC 03E00008 */  jr        $ra
/* 357370 E00489F0 27BD00E0 */   addiu    $sp, $sp, 0xE0
/* 357374 E00489F4 00000000 */  nop
/* 357378 E00489F8 00000000 */  nop
/* 35737C E00489FC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void ring_blast_appendGfx(void* effect) {
    RingBlastFXData* data = ((EffectInstance*)effect)->data.ringBlast;
    s32 unk_00 = data->unk_00;
    s32 unk_20_s32 = data->unk_20;
    s32 envAlpha = (data->unk_20 - unk_20_s32) * 256.0f;
    s32 cond = (unk_20_s32 == 7);
    Gfx* dlist = D_E0048A00[unk_00];
    Gfx* dlist2 = D_E0048A08[unk_00];
    Matrix4f sp20;
    Matrix4f sp60;

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

    shim_guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, data->unk_10, data->pos.x, data->pos.y, data->pos.z);
    shim_guRotateF(sp60, data->unk_24, 0.0f, 0.0f, 1.0f);
    shim_guMtxCatF(sp60, sp20, sp20);
    shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);

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

    if (unk_00 == 0) {
        f32 var_f4 = 1.0f;

        if (data->unk_20 > 5.0f) {
            var_f4 = 1.0f - (data->unk_20 - 5.0f);
            if (var_f4 < 0.0f) {
                var_f4 = 0.0f;
            }
        }

        gDPSetPrimColor(gMainGfxPos++, 0, 0, var_f4 * 255.0f, var_f4 * 18.0f, var_f4 * 59.0f, 0);
        gDPSetEnvColor(gMainGfxPos++, var_f4 * 255.0f, var_f4 * 53.0f, var_f4 * 24.0f, envAlpha);
        gDPSetKeyR(gMainGfxPos++, var_f4 * 211.0f, 0, 0);
        gDPSetKeyGB(gMainGfxPos++, var_f4 * 255.0f, 0, 0, var_f4 * 216.0f, 0, 0);
        gDPSetCombineLERP(gMainGfxPos++, TEXEL1, TEXEL0, ENV_ALPHA, TEXEL0, TEXEL1, TEXEL0, ENVIRONMENT, TEXEL0, PRIMITIVE, CENTER, COMBINED, ENVIRONMENT, 0, 0, 0, COMBINED);
    } else {
        gDPSetCombineLERP(gMainGfxPos++, TEXEL1, TEXEL0, ENV_ALPHA, TEXEL0, TEXEL1, TEXEL0, ENVIRONMENT, TEXEL0, 1, COMBINED, PRIMITIVE, COMBINED, 0, 0, 0, COMBINED);
        gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 40, 127);
        gDPSetEnvColor(gMainGfxPos++, 255, 255, 139, envAlpha);
    }

    gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE,
        (unk_20_s32 * 32     ) * 4, 0,
        (unk_20_s32 * 32 + 32) * 4, 32 * 4);

    if (cond) {
        gDPSetTileSize(gMainGfxPos++, 1,
            (unk_20_s32 * 32 + 32) * 4, 32 * 4,
            (unk_20_s32 * 32 + 64) * 4, 64 * 4);
    } else {
        gDPSetTileSize(gMainGfxPos++, 1,
            (unk_20_s32 * 32 + 32) * 4, 0,
            (unk_20_s32 * 32 + 64) * 4, 32 * 4);
    }

    gSPDisplayList(gMainGfxPos++, dlist);
    gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
}