### RAW ASSEMBLY INSTRUCTIONS:

glabel create_shading_palette
/* DE8C4 801481C4 27BDFF08 */  addiu     $sp, $sp, -0xF8
/* DE8C8 801481C8 AFB300AC */  sw        $s3, 0xAC($sp)
/* DE8CC 801481CC 0080982D */  daddu     $s3, $a0, $zero
/* DE8D0 801481D0 3C01BF80 */  lui       $at, (0xBF800000 >> 16)
/* DE8D4 801481D4 44819000 */  mtc1      $at, $f18
/* DE8D8 801481D8 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* DE8DC 801481DC 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* DE8E0 801481E0 3C04800B */  lui       $a0, %hi(gCameras)
/* DE8E4 801481E4 24841D80 */  addiu     $a0, $a0, %lo(gCameras)
/* DE8E8 801481E8 AFBF00C4 */  sw        $ra, 0xC4($sp)
/* DE8EC 801481EC AFBE00C0 */  sw        $fp, 0xC0($sp)
/* DE8F0 801481F0 AFB700BC */  sw        $s7, 0xBC($sp)
/* DE8F4 801481F4 AFB600B8 */  sw        $s6, 0xB8($sp)
/* DE8F8 801481F8 AFB500B4 */  sw        $s5, 0xB4($sp)
/* DE8FC 801481FC AFB400B0 */  sw        $s4, 0xB0($sp)
/* DE900 80148200 AFB200A8 */  sw        $s2, 0xA8($sp)
/* DE904 80148204 AFB100A4 */  sw        $s1, 0xA4($sp)
/* DE908 80148208 AFB000A0 */  sw        $s0, 0xA0($sp)
/* DE90C 8014820C F7BE00F0 */  sdc1      $f30, 0xF0($sp)
/* DE910 80148210 F7BC00E8 */  sdc1      $f28, 0xE8($sp)
/* DE914 80148214 F7BA00E0 */  sdc1      $f26, 0xE0($sp)
/* DE918 80148218 F7B800D8 */  sdc1      $f24, 0xD8($sp)
/* DE91C 8014821C F7B600D0 */  sdc1      $f22, 0xD0($sp)
/* DE920 80148220 F7B400C8 */  sdc1      $f20, 0xC8($sp)
/* DE924 80148224 AFA70104 */  sw        $a3, 0x104($sp)
/* DE928 80148228 AFA0004C */  sw        $zero, 0x4C($sp)
/* DE92C 8014822C 00031080 */  sll       $v0, $v1, 2
/* DE930 80148230 00431021 */  addu      $v0, $v0, $v1
/* DE934 80148234 00021080 */  sll       $v0, $v0, 2
/* DE938 80148238 00431023 */  subu      $v0, $v0, $v1
/* DE93C 8014823C 000218C0 */  sll       $v1, $v0, 3
/* DE940 80148240 00431021 */  addu      $v0, $v0, $v1
/* DE944 80148244 E7B20060 */  swc1      $f18, 0x60($sp)
/* DE948 80148248 C7B2004C */  lwc1      $f18, 0x4C($sp)
/* DE94C 8014824C 000210C0 */  sll       $v0, $v0, 3
/* DE950 80148250 E7B20048 */  swc1      $f18, 0x48($sp)
/* DE954 80148254 E7B20050 */  swc1      $f18, 0x50($sp)
/* DE958 80148258 E7B2007C */  swc1      $f18, 0x7C($sp)
/* DE95C 8014825C E7B20078 */  swc1      $f18, 0x78($sp)
/* DE960 80148260 E7B20080 */  swc1      $f18, 0x80($sp)
/* DE964 80148264 E7B20084 */  swc1      $f18, 0x84($sp)
/* DE968 80148268 E7B20088 */  swc1      $f18, 0x88($sp)
/* DE96C 8014826C C6720008 */  lwc1      $f18, 0x8($s3)
/* DE970 80148270 00441021 */  addu      $v0, $v0, $a0
/* DE974 80148274 46009087 */  neg.s     $f2, $f18
/* DE978 80148278 E7B20064 */  swc1      $f18, 0x64($sp)
/* DE97C 8014827C C7B20080 */  lwc1      $f18, 0x80($sp)
/* DE980 80148280 C44000DC */  lwc1      $f0, 0xDC($v0)
/* DE984 80148284 E7B2008C */  swc1      $f18, 0x8C($sp)
/* DE988 80148288 C6720028 */  lwc1      $f18, 0x28($s3)
/* DE98C 8014828C 46001082 */  mul.s     $f2, $f2, $f0
/* DE990 80148290 00000000 */  nop
/* DE994 80148294 E7B20068 */  swc1      $f18, 0x68($sp)
/* DE998 80148298 C44000FC */  lwc1      $f0, 0xFC($v0)
/* DE99C 8014829C C7B20080 */  lwc1      $f18, 0x80($sp)
/* DE9A0 801482A0 3C028015 */  lui       $v0, %hi(gSpriteShadingProfile)
/* DE9A4 801482A4 8C421328 */  lw        $v0, %lo(gSpriteShadingProfile)($v0)
/* DE9A8 801482A8 8FB40108 */  lw        $s4, 0x108($sp)
/* DE9AC 801482AC E7B20090 */  swc1      $f18, 0x90($sp)
/* DE9B0 801482B0 C7B20068 */  lwc1      $f18, 0x68($sp)
/* DE9B4 801482B4 8FB5010C */  lw        $s5, 0x10C($sp)
/* DE9B8 801482B8 46009002 */  mul.s     $f0, $f18, $f0
/* DE9BC 801482BC 00000000 */  nop
/* DE9C0 801482C0 C7B20080 */  lwc1      $f18, 0x80($sp)
/* DE9C4 801482C4 E7B20094 */  swc1      $f18, 0x94($sp)
/* DE9C8 801482C8 904300AC */  lbu       $v1, 0xAC($v0)
/* DE9CC 801482CC E7B20098 */  swc1      $f18, 0x98($sp)
/* DE9D0 801482D0 44839000 */  mtc1      $v1, $f18
/* DE9D4 801482D4 00000000 */  nop
/* DE9D8 801482D8 468094A0 */  cvt.s.w   $f18, $f18
/* DE9DC 801482DC E7B2006C */  swc1      $f18, 0x6C($sp)
/* DE9E0 801482E0 904300AD */  lbu       $v1, 0xAD($v0)
/* DE9E4 801482E4 904200AE */  lbu       $v0, 0xAE($v0)
/* DE9E8 801482E8 44839000 */  mtc1      $v1, $f18
/* DE9EC 801482EC 00000000 */  nop
/* DE9F0 801482F0 468094A0 */  cvt.s.w   $f18, $f18
/* DE9F4 801482F4 E7B20070 */  swc1      $f18, 0x70($sp)
/* DE9F8 801482F8 44829000 */  mtc1      $v0, $f18
/* DE9FC 801482FC 00000000 */  nop
/* DEA00 80148300 468094A0 */  cvt.s.w   $f18, $f18
/* DEA04 80148304 E7B20074 */  swc1      $f18, 0x74($sp)
/* DEA08 80148308 46001080 */  add.s     $f2, $f2, $f0
/* DEA0C 8014830C C7B20098 */  lwc1      $f18, 0x98($sp)
/* DEA10 80148310 8FB60110 */  lw        $s6, 0x110($sp)
/* DEA14 80148314 4612103C */  c.lt.s    $f2, $f18
/* DEA18 80148318 C6720030 */  lwc1      $f18, 0x30($s3)
/* DEA1C 8014831C E7B20054 */  swc1      $f18, 0x54($sp)
/* DEA20 80148320 C6720034 */  lwc1      $f18, 0x34($s3)
/* DEA24 80148324 00A0B82D */  daddu     $s7, $a1, $zero
/* DEA28 80148328 E7B20058 */  swc1      $f18, 0x58($sp)
/* DEA2C 8014832C C6720038 */  lwc1      $f18, 0x38($s3)
/* DEA30 80148330 E7B2005C */  swc1      $f18, 0x5C($sp)
/* DEA34 80148334 C67E0018 */  lwc1      $f30, 0x18($s3)
/* DEA38 80148338 45000005 */  bc1f      .L80148350
/* DEA3C 8014833C 00C0F02D */   daddu    $fp, $a2, $zero
/* DEA40 80148340 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* DEA44 80148344 44819000 */  mtc1      $at, $f18
/* DEA48 80148348 00000000 */  nop
/* DEA4C 8014834C E7B20060 */  swc1      $f18, 0x60($sp)
.L80148350:
/* DEA50 80148350 0000902D */  daddu     $s2, $zero, $zero
/* DEA54 80148354 C7BC0098 */  lwc1      $f28, 0x98($sp)
/* DEA58 80148358 24110004 */  addiu     $s1, $zero, 0x4
.L8014835C:
/* DEA5C 8014835C 3C028015 */  lui       $v0, %hi(gSpriteShadingProfile)
/* DEA60 80148360 8C421328 */  lw        $v0, %lo(gSpriteShadingProfile)($v0)
/* DEA64 80148364 00518021 */  addu      $s0, $v0, $s1
/* DEA68 80148368 92020000 */  lbu       $v0, 0x0($s0)
/* DEA6C 8014836C 30420001 */  andi      $v0, $v0, 0x1
/* DEA70 80148370 504000F5 */  beql      $v0, $zero, .L80148748
/* DEA74 80148374 26520001 */   addiu    $s2, $s2, 0x1
/* DEA78 80148378 C6000004 */  lwc1      $f0, 0x4($s0)
/* DEA7C 8014837C C7B20054 */  lwc1      $f18, 0x54($sp)
/* DEA80 80148380 46009681 */  sub.s     $f26, $f18, $f0
/* DEA84 80148384 461AD082 */  mul.s     $f2, $f26, $f26
/* DEA88 80148388 00000000 */  nop
/* DEA8C 8014838C C6000008 */  lwc1      $f0, 0x8($s0)
/* DEA90 80148390 C7B20058 */  lwc1      $f18, 0x58($sp)
/* DEA94 80148394 46009601 */  sub.s     $f24, $f18, $f0
/* DEA98 80148398 4618C102 */  mul.s     $f4, $f24, $f24
/* DEA9C 8014839C 00000000 */  nop
/* DEAA0 801483A0 C600000C */  lwc1      $f0, 0xC($s0)
/* DEAA4 801483A4 C7B2005C */  lwc1      $f18, 0x5C($sp)
/* DEAA8 801483A8 46009581 */  sub.s     $f22, $f18, $f0
/* DEAAC 801483AC 4616B002 */  mul.s     $f0, $f22, $f22
/* DEAB0 801483B0 00000000 */  nop
/* DEAB4 801483B4 46041080 */  add.s     $f2, $f2, $f4
/* DEAB8 801483B8 46001500 */  add.s     $f20, $f2, $f0
/* DEABC 801483BC 461CA032 */  c.eq.s    $f20, $f28
/* DEAC0 801483C0 00000000 */  nop
/* DEAC4 801483C4 4501000D */  bc1t      .L801483FC
/* DEAC8 801483C8 4600E086 */   mov.s    $f2, $f28
/* DEACC 801483CC 4600A004 */  sqrt.s    $f0, $f20
/* DEAD0 801483D0 46000032 */  c.eq.s    $f0, $f0
/* DEAD4 801483D4 00000000 */  nop
/* DEAD8 801483D8 45010003 */  bc1t      .L801483E8
/* DEADC 801483DC 00000000 */   nop
/* DEAE0 801483E0 0C0187BC */  jal       sqrtf
/* DEAE4 801483E4 4600A306 */   mov.s    $f12, $f20
.L801483E8:
/* DEAE8 801483E8 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* DEAEC 801483EC 44819000 */  mtc1      $at, $f18
/* DEAF0 801483F0 46000086 */  mov.s     $f2, $f0
/* DEAF4 801483F4 08052100 */  j         .L80148400
/* DEAF8 801483F8 46029003 */   div.s    $f0, $f18, $f2
.L801483FC:
/* DEAFC 801483FC 4600E006 */  mov.s     $f0, $f28
.L80148400:
/* DEB00 80148400 4600D682 */  mul.s     $f26, $f26, $f0
/* DEB04 80148404 00000000 */  nop
/* DEB08 80148408 4600C602 */  mul.s     $f24, $f24, $f0
/* DEB0C 8014840C 00000000 */  nop
/* DEB10 80148410 92030000 */  lbu       $v1, 0x0($s0)
/* DEB14 80148414 4600B582 */  mul.s     $f22, $f22, $f0
/* DEB18 80148418 00000000 */  nop
/* DEB1C 8014841C 30620004 */  andi      $v0, $v1, 0x4
/* DEB20 80148420 5040000E */  beql      $v0, $zero, .L8014845C
/* DEB24 80148424 30620008 */   andi     $v0, $v1, 0x8
/* DEB28 80148428 461C1032 */  c.eq.s    $f2, $f28
/* DEB2C 8014842C 00000000 */  nop
/* DEB30 80148430 45000006 */  bc1f      .L8014844C
/* DEB34 80148434 00000000 */   nop
/* DEB38 80148438 C6000010 */  lwc1      $f0, 0x10($s0)
/* DEB3C 8014843C 461C0032 */  c.eq.s    $f0, $f28
/* DEB40 80148440 00000000 */  nop
/* DEB44 80148444 4501001E */  bc1t      .L801484C0
/* DEB48 80148448 00000000 */   nop
.L8014844C:
/* DEB4C 8014844C C6000010 */  lwc1      $f0, 0x10($s0)
/* DEB50 80148450 46001002 */  mul.s     $f0, $f2, $f0
/* DEB54 80148454 08052125 */  j         .L80148494
/* DEB58 80148458 00000000 */   nop
.L8014845C:
/* DEB5C 8014845C 10400018 */  beqz      $v0, .L801484C0
/* DEB60 80148460 00000000 */   nop
/* DEB64 80148464 461CA032 */  c.eq.s    $f20, $f28
/* DEB68 80148468 00000000 */  nop
/* DEB6C 8014846C 45000006 */  bc1f      .L80148488
/* DEB70 80148470 00000000 */   nop
/* DEB74 80148474 C6000010 */  lwc1      $f0, 0x10($s0)
/* DEB78 80148478 461C0032 */  c.eq.s    $f0, $f28
/* DEB7C 8014847C 00000000 */  nop
/* DEB80 80148480 4501000F */  bc1t      .L801484C0
/* DEB84 80148484 00000000 */   nop
.L80148488:
/* DEB88 80148488 C6000010 */  lwc1      $f0, 0x10($s0)
/* DEB8C 8014848C 4600A002 */  mul.s     $f0, $f20, $f0
/* DEB90 80148490 00000000 */  nop
.L80148494:
/* DEB94 80148494 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* DEB98 80148498 44819000 */  mtc1      $at, $f18
/* DEB9C 8014849C 00000000 */  nop
/* DEBA0 801484A0 46009203 */  div.s     $f8, $f18, $f0
/* DEBA4 801484A4 4608D682 */  mul.s     $f26, $f26, $f8
/* DEBA8 801484A8 00000000 */  nop
/* DEBAC 801484AC 4608C602 */  mul.s     $f24, $f24, $f8
/* DEBB0 801484B0 00000000 */  nop
/* DEBB4 801484B4 4608B582 */  mul.s     $f22, $f22, $f8
/* DEBB8 801484B8 08052132 */  j         .L801484C8
/* DEBBC 801484BC 00000000 */   nop
.L801484C0:
/* DEBC0 801484C0 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* DEBC4 801484C4 44814000 */  mtc1      $at, $f8
.L801484C8:
/* DEBC8 801484C8 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* DEBCC 801484CC 44819000 */  mtc1      $at, $f18
/* DEBD0 801484D0 00000000 */  nop
/* DEBD4 801484D4 4608903C */  c.lt.s    $f18, $f8
/* DEBD8 801484D8 00000000 */  nop
/* DEBDC 801484DC 45030001 */  bc1tl     .L801484E4
/* DEBE0 801484E0 46009206 */   mov.s    $f8, $f18
.L801484E4:
/* DEBE4 801484E4 C7B20048 */  lwc1      $f18, 0x48($sp)
/* DEBE8 801484E8 461A9480 */  add.s     $f18, $f18, $f26
/* DEBEC 801484EC E7B20048 */  swc1      $f18, 0x48($sp)
/* DEBF0 801484F0 C7B2004C */  lwc1      $f18, 0x4C($sp)
/* DEBF4 801484F4 46189480 */  add.s     $f18, $f18, $f24
/* DEBF8 801484F8 E7B2004C */  swc1      $f18, 0x4C($sp)
/* DEBFC 801484FC C7B20050 */  lwc1      $f18, 0x50($sp)
/* DEC00 80148500 46169480 */  add.s     $f18, $f18, $f22
/* DEC04 80148504 E7B20050 */  swc1      $f18, 0x50($sp)
/* DEC08 80148508 C7B20060 */  lwc1      $f18, 0x60($sp)
/* DEC0C 8014850C 461C903C */  c.lt.s    $f18, $f28
/* DEC10 80148510 00000000 */  nop
/* DEC14 80148514 45000005 */  bc1f      .L8014852C
/* DEC18 80148518 4600F086 */   mov.s    $f2, $f30
/* DEC1C 8014851C C7B20068 */  lwc1      $f18, 0x68($sp)
/* DEC20 80148520 C7A00064 */  lwc1      $f0, 0x64($sp)
/* DEC24 80148524 0805214E */  j         .L80148538
/* DEC28 80148528 46009107 */   neg.s    $f4, $f18
.L8014852C:
/* DEC2C 8014852C C7B20064 */  lwc1      $f18, 0x64($sp)
/* DEC30 80148530 C7A40068 */  lwc1      $f4, 0x68($sp)
/* DEC34 80148534 46009007 */  neg.s     $f0, $f18
.L80148538:
/* DEC38 80148538 461A0002 */  mul.s     $f0, $f0, $f26
/* DEC3C 8014853C 00000000 */  nop
/* DEC40 80148540 46181082 */  mul.s     $f2, $f2, $f24
/* DEC44 80148544 00000000 */  nop
/* DEC48 80148548 46162102 */  mul.s     $f4, $f4, $f22
/* DEC4C 8014854C 00000000 */  nop
/* DEC50 80148550 46020000 */  add.s     $f0, $f0, $f2
/* DEC54 80148554 C7B20060 */  lwc1      $f18, 0x60($sp)
/* DEC58 80148558 461C903C */  c.lt.s    $f18, $f28
/* DEC5C 8014855C 00000000 */  nop
/* DEC60 80148560 45000005 */  bc1f      .L80148578
/* DEC64 80148564 46040280 */   add.s    $f10, $f0, $f4
/* DEC68 80148568 C7A20068 */  lwc1      $f2, 0x68($sp)
/* DEC6C 8014856C C7A60064 */  lwc1      $f6, 0x64($sp)
/* DEC70 80148570 08052163 */  j         .L8014858C
/* DEC74 80148574 4600F106 */   mov.s    $f4, $f30
.L80148578:
/* DEC78 80148578 C7B20068 */  lwc1      $f18, 0x68($sp)
/* DEC7C 8014857C 46009087 */  neg.s     $f2, $f18
/* DEC80 80148580 C7B20064 */  lwc1      $f18, 0x64($sp)
/* DEC84 80148584 4600F106 */  mov.s     $f4, $f30
/* DEC88 80148588 46009187 */  neg.s     $f6, $f18
.L8014858C:
/* DEC8C 8014858C 461A1082 */  mul.s     $f2, $f2, $f26
/* DEC90 80148590 00000000 */  nop
/* DEC94 80148594 46182102 */  mul.s     $f4, $f4, $f24
/* DEC98 80148598 00000000 */  nop
/* DEC9C 8014859C 46163182 */  mul.s     $f6, $f6, $f22
/* DECA0 801485A0 00000000 */  nop
/* DECA4 801485A4 46005005 */  abs.s     $f0, $f10
/* DECA8 801485A8 46004302 */  mul.s     $f12, $f8, $f0
/* DECAC 801485AC 00000000 */  nop
/* DECB0 801485B0 46041080 */  add.s     $f2, $f2, $f4
/* DECB4 801485B4 46061400 */  add.s     $f16, $f2, $f6
/* DECB8 801485B8 460AE03C */  c.lt.s    $f28, $f10
/* DECBC 801485BC 46008005 */  abs.s     $f0, $f16
/* DECC0 801485C0 46004182 */  mul.s     $f6, $f8, $f0
/* DECC4 801485C4 00000000 */  nop
/* DECC8 801485C8 45000021 */  bc1f      .L80148650
/* DECCC 801485CC 46008506 */   mov.s    $f20, $f16
/* DECD0 801485D0 92020001 */  lbu       $v0, 0x1($s0)
/* DECD4 801485D4 44827000 */  mtc1      $v0, $f14
/* DECD8 801485D8 00000000 */  nop
/* DECDC 801485DC 468073A0 */  cvt.s.w   $f14, $f14
/* DECE0 801485E0 460C7102 */  mul.s     $f4, $f14, $f12
/* DECE4 801485E4 00000000 */  nop
/* DECE8 801485E8 C7B20078 */  lwc1      $f18, 0x78($sp)
/* DECEC 801485EC 92020002 */  lbu       $v0, 0x2($s0)
/* DECF0 801485F0 46049480 */  add.s     $f18, $f18, $f4
/* DECF4 801485F4 44825000 */  mtc1      $v0, $f10
/* DECF8 801485F8 00000000 */  nop
/* DECFC 801485FC 468052A0 */  cvt.s.w   $f10, $f10
/* DED00 80148600 92020003 */  lbu       $v0, 0x3($s0)
/* DED04 80148604 460C5082 */  mul.s     $f2, $f10, $f12
/* DED08 80148608 00000000 */  nop
/* DED0C 8014860C E7B20078 */  swc1      $f18, 0x78($sp)
/* DED10 80148610 C7B2007C */  lwc1      $f18, 0x7C($sp)
/* DED14 80148614 46029480 */  add.s     $f18, $f18, $f2
/* DED18 80148618 44824000 */  mtc1      $v0, $f8
/* DED1C 8014861C 00000000 */  nop
/* DED20 80148620 46804220 */  cvt.s.w   $f8, $f8
/* DED24 80148624 460C4002 */  mul.s     $f0, $f8, $f12
/* DED28 80148628 00000000 */  nop
/* DED2C 8014862C E7B2007C */  swc1      $f18, 0x7C($sp)
/* DED30 80148630 C7B20080 */  lwc1      $f18, 0x80($sp)
/* DED34 80148634 46009480 */  add.s     $f18, $f18, $f0
/* DED38 80148638 4610E03C */  c.lt.s    $f28, $f16
/* DED3C 8014863C 00000000 */  nop
/* DED40 80148640 45010021 */  bc1t      .L801486C8
/* DED44 80148644 E7B20080 */   swc1     $f18, 0x80($sp)
/* DED48 80148648 080521C2 */  j         .L80148708
/* DED4C 8014864C 00000000 */   nop
.L80148650:
/* DED50 80148650 92020001 */  lbu       $v0, 0x1($s0)
/* DED54 80148654 44827000 */  mtc1      $v0, $f14
/* DED58 80148658 00000000 */  nop
/* DED5C 8014865C 468073A0 */  cvt.s.w   $f14, $f14
/* DED60 80148660 460C7102 */  mul.s     $f4, $f14, $f12
/* DED64 80148664 00000000 */  nop
/* DED68 80148668 C7B2006C */  lwc1      $f18, 0x6C($sp)
/* DED6C 8014866C 92020002 */  lbu       $v0, 0x2($s0)
/* DED70 80148670 46049480 */  add.s     $f18, $f18, $f4
/* DED74 80148674 44825000 */  mtc1      $v0, $f10
/* DED78 80148678 00000000 */  nop
/* DED7C 8014867C 468052A0 */  cvt.s.w   $f10, $f10
/* DED80 80148680 92020003 */  lbu       $v0, 0x3($s0)
/* DED84 80148684 460C5082 */  mul.s     $f2, $f10, $f12
/* DED88 80148688 00000000 */  nop
/* DED8C 8014868C E7B2006C */  swc1      $f18, 0x6C($sp)
/* DED90 80148690 C7B20070 */  lwc1      $f18, 0x70($sp)
/* DED94 80148694 46029480 */  add.s     $f18, $f18, $f2
/* DED98 80148698 44824000 */  mtc1      $v0, $f8
/* DED9C 8014869C 00000000 */  nop
/* DEDA0 801486A0 46804220 */  cvt.s.w   $f8, $f8
/* DEDA4 801486A4 460C4002 */  mul.s     $f0, $f8, $f12
/* DEDA8 801486A8 00000000 */  nop
/* DEDAC 801486AC E7B20070 */  swc1      $f18, 0x70($sp)
/* DEDB0 801486B0 C7B20074 */  lwc1      $f18, 0x74($sp)
/* DEDB4 801486B4 46009480 */  add.s     $f18, $f18, $f0
/* DEDB8 801486B8 4614E03C */  c.lt.s    $f28, $f20
/* DEDBC 801486BC 00000000 */  nop
/* DEDC0 801486C0 45000011 */  bc1f      .L80148708
/* DEDC4 801486C4 E7B20074 */   swc1     $f18, 0x74($sp)
.L801486C8:
/* DEDC8 801486C8 46067002 */  mul.s     $f0, $f14, $f6
/* DEDCC 801486CC 00000000 */  nop
/* DEDD0 801486D0 C7B20084 */  lwc1      $f18, 0x84($sp)
/* DEDD4 801486D4 46009480 */  add.s     $f18, $f18, $f0
/* DEDD8 801486D8 46065082 */  mul.s     $f2, $f10, $f6
/* DEDDC 801486DC 00000000 */  nop
/* DEDE0 801486E0 E7B20084 */  swc1      $f18, 0x84($sp)
/* DEDE4 801486E4 C7B20088 */  lwc1      $f18, 0x88($sp)
/* DEDE8 801486E8 46029480 */  add.s     $f18, $f18, $f2
/* DEDEC 801486EC 46064102 */  mul.s     $f4, $f8, $f6
/* DEDF0 801486F0 00000000 */  nop
/* DEDF4 801486F4 E7B20088 */  swc1      $f18, 0x88($sp)
/* DEDF8 801486F8 C7B2008C */  lwc1      $f18, 0x8C($sp)
/* DEDFC 801486FC 46049480 */  add.s     $f18, $f18, $f4
/* DEE00 80148700 080521D1 */  j         .L80148744
/* DEE04 80148704 E7B2008C */   swc1     $f18, 0x8C($sp)
.L80148708:
/* DEE08 80148708 46067002 */  mul.s     $f0, $f14, $f6
/* DEE0C 8014870C 00000000 */  nop
/* DEE10 80148710 C7B20090 */  lwc1      $f18, 0x90($sp)
/* DEE14 80148714 46009480 */  add.s     $f18, $f18, $f0
/* DEE18 80148718 46065082 */  mul.s     $f2, $f10, $f6
/* DEE1C 8014871C 00000000 */  nop
/* DEE20 80148720 E7B20090 */  swc1      $f18, 0x90($sp)
/* DEE24 80148724 C7B20094 */  lwc1      $f18, 0x94($sp)
/* DEE28 80148728 46029480 */  add.s     $f18, $f18, $f2
/* DEE2C 8014872C 46064102 */  mul.s     $f4, $f8, $f6
/* DEE30 80148730 00000000 */  nop
/* DEE34 80148734 E7B20094 */  swc1      $f18, 0x94($sp)
/* DEE38 80148738 C7B20098 */  lwc1      $f18, 0x98($sp)
/* DEE3C 8014873C 46049480 */  add.s     $f18, $f18, $f4
/* DEE40 80148740 E7B20098 */  swc1      $f18, 0x98($sp)
.L80148744:
/* DEE44 80148744 26520001 */  addiu     $s2, $s2, 0x1
.L80148748:
/* DEE48 80148748 2A420007 */  slti      $v0, $s2, 0x7
/* DEE4C 8014874C 1440FF03 */  bnez      $v0, .L8014835C
/* DEE50 80148750 26310018 */   addiu    $s1, $s1, 0x18
/* DEE54 80148754 44800000 */  mtc1      $zero, $f0
/* DEE58 80148758 C7B20060 */  lwc1      $f18, 0x60($sp)
/* DEE5C 8014875C 4600903C */  c.lt.s    $f18, $f0
/* DEE60 80148760 00000000 */  nop
/* DEE64 80148764 45000004 */  bc1f      .L80148778
/* DEE68 80148768 4600F086 */   mov.s    $f2, $f30
/* DEE6C 8014876C C7A00068 */  lwc1      $f0, 0x68($sp)
/* DEE70 80148770 080521E2 */  j         .L80148788
/* DEE74 80148774 C7A40064 */   lwc1     $f4, 0x64($sp)
.L80148778:
/* DEE78 80148778 C7B20068 */  lwc1      $f18, 0x68($sp)
/* DEE7C 8014877C 46009007 */  neg.s     $f0, $f18
/* DEE80 80148780 C7B20064 */  lwc1      $f18, 0x64($sp)
/* DEE84 80148784 46009107 */  neg.s     $f4, $f18
.L80148788:
/* DEE88 80148788 C7B20048 */  lwc1      $f18, 0x48($sp)
/* DEE8C 8014878C 46120002 */  mul.s     $f0, $f0, $f18
/* DEE90 80148790 00000000 */  nop
/* DEE94 80148794 C7B2004C */  lwc1      $f18, 0x4C($sp)
/* DEE98 80148798 46121082 */  mul.s     $f2, $f2, $f18
/* DEE9C 8014879C 00000000 */  nop
/* DEEA0 801487A0 C7B20050 */  lwc1      $f18, 0x50($sp)
/* DEEA4 801487A4 46122102 */  mul.s     $f4, $f4, $f18
/* DEEA8 801487A8 00000000 */  nop
/* DEEAC 801487AC 46020000 */  add.s     $f0, $f0, $f2
/* DEEB0 801487B0 46040000 */  add.s     $f0, $f0, $f4
/* DEEB4 801487B4 44801000 */  mtc1      $zero, $f2
/* DEEB8 801487B8 00000000 */  nop
/* DEEBC 801487BC 4600103C */  c.lt.s    $f2, $f0
/* DEEC0 801487C0 00000000 */  nop
/* DEEC4 801487C4 45000031 */  bc1f      .L8014888C
/* DEEC8 801487C8 00000000 */   nop
/* DEECC 801487CC C7B2006C */  lwc1      $f18, 0x6C($sp)
/* DEED0 801487D0 4600948D */  trunc.w.s $f18, $f18
/* DEED4 801487D4 E7B20024 */  swc1      $f18, 0x24($sp)
/* DEED8 801487D8 C7B20070 */  lwc1      $f18, 0x70($sp)
/* DEEDC 801487DC 4600948D */  trunc.w.s $f18, $f18
/* DEEE0 801487E0 E7B20028 */  swc1      $f18, 0x28($sp)
/* DEEE4 801487E4 C7B20074 */  lwc1      $f18, 0x74($sp)
/* DEEE8 801487E8 3C038015 */  lui       $v1, %hi(gSpriteShadingProfile)
/* DEEEC 801487EC 8C631328 */  lw        $v1, %lo(gSpriteShadingProfile)($v1)
/* DEEF0 801487F0 4600948D */  trunc.w.s $f18, $f18
/* DEEF4 801487F4 E7B2002C */  swc1      $f18, 0x2C($sp)
/* DEEF8 801487F8 C7B20048 */  lwc1      $f18, 0x48($sp)
/* DEEFC 801487FC E7B20018 */  swc1      $f18, 0x18($sp)
/* DEF00 80148800 C7B2004C */  lwc1      $f18, 0x4C($sp)
/* DEF04 80148804 E7B2001C */  swc1      $f18, 0x1C($sp)
/* DEF08 80148808 C7B20050 */  lwc1      $f18, 0x50($sp)
/* DEF0C 8014880C AFB40010 */  sw        $s4, 0x10($sp)
/* DEF10 80148810 AFB50014 */  sw        $s5, 0x14($sp)
/* DEF14 80148814 E7B20020 */  swc1      $f18, 0x20($sp)
/* DEF18 80148818 906200AC */  lbu       $v0, 0xAC($v1)
/* DEF1C 8014881C C7B20078 */  lwc1      $f18, 0x78($sp)
/* DEF20 80148820 44820000 */  mtc1      $v0, $f0
/* DEF24 80148824 00000000 */  nop
/* DEF28 80148828 46800020 */  cvt.s.w   $f0, $f0
/* DEF2C 8014882C 46120000 */  add.s     $f0, $f0, $f18
/* DEF30 80148830 C7B20084 */  lwc1      $f18, 0x84($sp)
/* DEF34 80148834 46120000 */  add.s     $f0, $f0, $f18
/* DEF38 80148838 4600048D */  trunc.w.s $f18, $f0
/* DEF3C 8014883C E7B20030 */  swc1      $f18, 0x30($sp)
/* DEF40 80148840 906200AD */  lbu       $v0, 0xAD($v1)
/* DEF44 80148844 C7B2007C */  lwc1      $f18, 0x7C($sp)
/* DEF48 80148848 44820000 */  mtc1      $v0, $f0
/* DEF4C 8014884C 00000000 */  nop
/* DEF50 80148850 46800020 */  cvt.s.w   $f0, $f0
/* DEF54 80148854 46120000 */  add.s     $f0, $f0, $f18
/* DEF58 80148858 C7B20088 */  lwc1      $f18, 0x88($sp)
/* DEF5C 8014885C 46120000 */  add.s     $f0, $f0, $f18
/* DEF60 80148860 4600048D */  trunc.w.s $f18, $f0
/* DEF64 80148864 E7B20034 */  swc1      $f18, 0x34($sp)
/* DEF68 80148868 906200AE */  lbu       $v0, 0xAE($v1)
/* DEF6C 8014886C C7B20080 */  lwc1      $f18, 0x80($sp)
/* DEF70 80148870 44820000 */  mtc1      $v0, $f0
/* DEF74 80148874 00000000 */  nop
/* DEF78 80148878 46800020 */  cvt.s.w   $f0, $f0
/* DEF7C 8014887C 46120000 */  add.s     $f0, $f0, $f18
/* DEF80 80148880 C7B2008C */  lwc1      $f18, 0x8C($sp)
/* DEF84 80148884 08052252 */  j         .L80148948
/* DEF88 80148888 46120000 */   add.s    $f0, $f0, $f18
.L8014888C:
/* DEF8C 8014888C C7B2006C */  lwc1      $f18, 0x6C($sp)
/* DEF90 80148890 4600948D */  trunc.w.s $f18, $f18
/* DEF94 80148894 E7B20024 */  swc1      $f18, 0x24($sp)
/* DEF98 80148898 C7B20070 */  lwc1      $f18, 0x70($sp)
/* DEF9C 8014889C 4600948D */  trunc.w.s $f18, $f18
/* DEFA0 801488A0 E7B20028 */  swc1      $f18, 0x28($sp)
/* DEFA4 801488A4 C7B20074 */  lwc1      $f18, 0x74($sp)
/* DEFA8 801488A8 3C038015 */  lui       $v1, %hi(gSpriteShadingProfile)
/* DEFAC 801488AC 8C631328 */  lw        $v1, %lo(gSpriteShadingProfile)($v1)
/* DEFB0 801488B0 4600948D */  trunc.w.s $f18, $f18
/* DEFB4 801488B4 E7B2002C */  swc1      $f18, 0x2C($sp)
/* DEFB8 801488B8 C7B20048 */  lwc1      $f18, 0x48($sp)
/* DEFBC 801488BC E7B20018 */  swc1      $f18, 0x18($sp)
/* DEFC0 801488C0 C7B2004C */  lwc1      $f18, 0x4C($sp)
/* DEFC4 801488C4 E7B2001C */  swc1      $f18, 0x1C($sp)
/* DEFC8 801488C8 C7B20050 */  lwc1      $f18, 0x50($sp)
/* DEFCC 801488CC AFB40010 */  sw        $s4, 0x10($sp)
/* DEFD0 801488D0 AFB50014 */  sw        $s5, 0x14($sp)
/* DEFD4 801488D4 E7B20020 */  swc1      $f18, 0x20($sp)
/* DEFD8 801488D8 906200AC */  lbu       $v0, 0xAC($v1)
/* DEFDC 801488DC C7B20078 */  lwc1      $f18, 0x78($sp)
/* DEFE0 801488E0 44820000 */  mtc1      $v0, $f0
/* DEFE4 801488E4 00000000 */  nop
/* DEFE8 801488E8 46800020 */  cvt.s.w   $f0, $f0
/* DEFEC 801488EC 46120000 */  add.s     $f0, $f0, $f18
/* DEFF0 801488F0 C7B20090 */  lwc1      $f18, 0x90($sp)
/* DEFF4 801488F4 46120000 */  add.s     $f0, $f0, $f18
/* DEFF8 801488F8 4600048D */  trunc.w.s $f18, $f0
/* DEFFC 801488FC E7B20030 */  swc1      $f18, 0x30($sp)
/* DF000 80148900 906200AD */  lbu       $v0, 0xAD($v1)
/* DF004 80148904 C7B2007C */  lwc1      $f18, 0x7C($sp)
/* DF008 80148908 44820000 */  mtc1      $v0, $f0
/* DF00C 8014890C 00000000 */  nop
/* DF010 80148910 46800020 */  cvt.s.w   $f0, $f0
/* DF014 80148914 46120000 */  add.s     $f0, $f0, $f18
/* DF018 80148918 C7B20094 */  lwc1      $f18, 0x94($sp)
/* DF01C 8014891C 46120000 */  add.s     $f0, $f0, $f18
/* DF020 80148920 4600048D */  trunc.w.s $f18, $f0
/* DF024 80148924 E7B20034 */  swc1      $f18, 0x34($sp)
/* DF028 80148928 906200AE */  lbu       $v0, 0xAE($v1)
/* DF02C 8014892C C7B20080 */  lwc1      $f18, 0x80($sp)
/* DF030 80148930 44820000 */  mtc1      $v0, $f0
/* DF034 80148934 00000000 */  nop
/* DF038 80148938 46800020 */  cvt.s.w   $f0, $f0
/* DF03C 8014893C 46120000 */  add.s     $f0, $f0, $f18
/* DF040 80148940 C7B20098 */  lwc1      $f18, 0x98($sp)
/* DF044 80148944 46120000 */  add.s     $f0, $f0, $f18
.L80148948:
/* DF048 80148948 0260202D */  daddu     $a0, $s3, $zero
/* DF04C 8014894C 02E0282D */  daddu     $a1, $s7, $zero
/* DF050 80148950 4600048D */  trunc.w.s $f18, $f0
/* DF054 80148954 E7B20038 */  swc1      $f18, 0x38($sp)
/* DF058 80148958 906200AF */  lbu       $v0, 0xAF($v1)
/* DF05C 8014895C 8FA70104 */  lw        $a3, 0x104($sp)
/* DF060 80148960 03C0302D */  daddu     $a2, $fp, $zero
/* DF064 80148964 AFB60040 */  sw        $s6, 0x40($sp)
/* DF068 80148968 0C05226E */  jal       appendGfx_shading_palette
/* DF06C 8014896C AFA2003C */   sw       $v0, 0x3C($sp)
/* DF070 80148970 8FBF00C4 */  lw        $ra, 0xC4($sp)
/* DF074 80148974 8FBE00C0 */  lw        $fp, 0xC0($sp)
/* DF078 80148978 8FB700BC */  lw        $s7, 0xBC($sp)
/* DF07C 8014897C 8FB600B8 */  lw        $s6, 0xB8($sp)
/* DF080 80148980 8FB500B4 */  lw        $s5, 0xB4($sp)
/* DF084 80148984 8FB400B0 */  lw        $s4, 0xB0($sp)
/* DF088 80148988 8FB300AC */  lw        $s3, 0xAC($sp)
/* DF08C 8014898C 8FB200A8 */  lw        $s2, 0xA8($sp)
/* DF090 80148990 8FB100A4 */  lw        $s1, 0xA4($sp)
/* DF094 80148994 8FB000A0 */  lw        $s0, 0xA0($sp)
/* DF098 80148998 D7BE00F0 */  ldc1      $f30, 0xF0($sp)
/* DF09C 8014899C D7BC00E8 */  ldc1      $f28, 0xE8($sp)
/* DF0A0 801489A0 D7BA00E0 */  ldc1      $f26, 0xE0($sp)
/* DF0A4 801489A4 D7B800D8 */  ldc1      $f24, 0xD8($sp)
/* DF0A8 801489A8 D7B600D0 */  ldc1      $f22, 0xD0($sp)
/* DF0AC 801489AC D7B400C8 */  ldc1      $f20, 0xC8($sp)
/* DF0B0 801489B0 03E00008 */  jr        $ra
/* DF0B4 801489B4 27BD00F8 */   addiu    $sp, $sp, 0xF8

### DECOMPILED C INSTRUCTIONS:

void create_shading_palette(Matrix4f mtx, s32 uls, s32 ult, s32 lrs, s32 lrt, s32 alpha, s32 otherModeLBits) {
    Camera* camera = &gCameras[gCurrentCameraID];
    SpriteShadingLightSource* lightSource;
    f32 shadowDirX, shadowDirY, shadowDirZ;
    f32 posX, posY, posZ;
    f32 facingDir;
    f32 Mxz, Myz, Mzz;
    f32 shadowColorR, shadowColorG, shadowColorB;
    f32 commonColorR, commonColorG, commonColorB;
    f32 backColorR, backColorG, backColorB;
    f32 frontColorR, frontColorG, frontColorB;
    f32 shadowIntensity;
    f32 lightIntensity;
    f32 intensityScale;
    f32 temp_f10;
    f32 temp_f16;
    f32 temp3;
    f32 distSq;
    f32 dx, dy, dz;
    f32 dist;
    f32 invDist;
    f32 qx, qy, qz;
    f32 wx, wy, wz;
    f32 ex, ey, ez;
    f32 Pxz, Pzz;
    s32 i;

    shadowDirX = 0.0f;
    shadowDirY = 0.0f;
    shadowDirZ = 0.0f;

    posX = mtx[3][0];
    posY = mtx[3][1];
    posZ = mtx[3][2];

    Mxz = mtx[0][2];
    Myz = mtx[1][2];
    Mzz = mtx[2][2];

    commonColorR = 0.0f;
    commonColorG = 0.0f;
    commonColorB = 0.0f;

    backColorR = 0.0f;
    backColorG = 0.0f;
    backColorB = 0.0f;

    frontColorR = 0.0f;
    frontColorG = 0.0f;
    frontColorB = 0.0f;

    shadowColorR = gSpriteShadingProfile->ambientColor.r;
    shadowColorG = gSpriteShadingProfile->ambientColor.g;
    shadowColorB = gSpriteShadingProfile->ambientColor.b;

    Pxz = camera->perspectiveMatrix[0][2];
    Pzz = camera->perspectiveMatrix[2][2];

    if ((-Mxz * Pxz + Mzz * Pzz) < 0.0f) {
        facingDir = 1.0f;
    } else {
        facingDir = -1.0f;
    }

    for (i = 0; i < ARRAY_COUNT(gSpriteShadingProfile->sources); i++) {
        lightSource = &gSpriteShadingProfile->sources[i];
        if (lightSource->flags & LIGHT_SOURCE_ENABLED) {
            dx = posX - lightSource->pos.x;
            dy = posY - lightSource->pos.y;
            dz = posZ - lightSource->pos.z;

            distSq = SQ(dx) + SQ(dy) + SQ(dz);

            if (distSq != 0.0f) {
                dist = sqrtf(distSq);
                invDist = 1.0f / dist;
            } else {
                dist = 0.0f;
                invDist = 0.0f;
            }

            // normalize dx/dy/dz
            // they now form a normal vector pointing from light source to sprite
            dx *= invDist;
            dy *= invDist;
            dz *= invDist;

            // apply falloff from light source
            if (lightSource->flags & LIGHT_SOURCE_LINEAR_FALLOFF) {
                if ((dist == 0.0f) && (lightSource->falloff == 0.0f)) {
                    intensityScale = 1.0f;
                } else {
                    intensityScale = 1.0f / (dist * lightSource->falloff);
                    dx *= intensityScale;
                    dy *= intensityScale;
                    dz *= intensityScale;
                }
            } else if (lightSource->flags & LIGHT_SOURCE_QUADRATIC_FALLOFF) {
                if ((distSq == 0.0f) && (lightSource->falloff == 0.0f)) {
                    intensityScale = 1.0f;
                } else {
                    intensityScale = 1.0f / (distSq * lightSource->falloff);
                    dx *= intensityScale;
                    dy *= intensityScale;
                    dz *= intensityScale;
                }
            } else {
                intensityScale = 1.0f;
            }

            if (intensityScale > 1.0f) {
                intensityScale = 1.0f;
            }

            shadowDirX += dx;
            shadowDirY += dy;
            shadowDirZ += dz;

            if (facingDir < 0.0f) {
                ex = Mxz;
                ey = Myz;
                ez = -Mzz;
            } else {
                ex = -Mxz;
                ey = Myz;
                ez = Mzz;
            }
            temp_f10 = ex * dx + ey * dy + ez * dz;

            if (facingDir < 0.0f) {
                wx = Mzz;
                wy = Myz;
                wz = Mxz;
            } else {
                wx = -Mzz;
                wy = Myz;
                wz = -Mxz;
            }
            temp3 = wx * dx + wy * dy + wz * dz;

            temp_f16 = temp3;
            shadowIntensity = intensityScale * fabsf(temp_f10);
            lightIntensity  = intensityScale * fabsf(temp_f16);
            if (temp_f10 > 0.0f) {
                commonColorR += lightSource->rgb.r * shadowIntensity;
                commonColorG += lightSource->rgb.g * shadowIntensity;
                commonColorB += lightSource->rgb.b * shadowIntensity;
                if (temp_f16 > 0.0f) {
                    backColorR += lightSource->rgb.r * lightIntensity;
                    backColorG += lightSource->rgb.g * lightIntensity;
                    backColorB += lightSource->rgb.b * lightIntensity;
                } else {
                    frontColorR += lightSource->rgb.r * lightIntensity;
                    frontColorG += lightSource->rgb.g * lightIntensity;
                    frontColorB += lightSource->rgb.b * lightIntensity;
                }
            } else {
                shadowColorR += lightSource->rgb.r * shadowIntensity;
                shadowColorG += lightSource->rgb.g * shadowIntensity;
                shadowColorB += lightSource->rgb.b * shadowIntensity;
                if (temp_f16 > 0.0f) {
                    backColorR += lightSource->rgb.r * lightIntensity;
                    backColorG += lightSource->rgb.g * lightIntensity;
                    backColorB += lightSource->rgb.b * lightIntensity;
                } else {
                    frontColorR += lightSource->rgb.r * lightIntensity;
                    frontColorG += lightSource->rgb.g * lightIntensity;
                    frontColorB += lightSource->rgb.b * lightIntensity;
                }
            }
        }
    }

    if (facingDir < 0.0f) {
        qx = Mzz;
        qy = Myz;
        qz = Mxz;
    } else {
        qx = -Mzz;
        qy = Myz;
        qz = -Mxz;
    }

    if (qx * shadowDirX + qy * shadowDirY + qz * shadowDirZ > 0.0f) {
        appendGfx_shading_palette(
            mtx,
            uls, ult, lrs, lrt,
            alpha,
            shadowDirX, shadowDirY, shadowDirZ,
            shadowColorR, shadowColorG, shadowColorB,
            gSpriteShadingProfile->ambientColor.r + commonColorR + backColorR,
            gSpriteShadingProfile->ambientColor.g + commonColorG + backColorG,
            gSpriteShadingProfile->ambientColor.b + commonColorB + backColorB,
            gSpriteShadingProfile->ambientPower,
            otherModeLBits
        );
    } else {
        appendGfx_shading_palette(
            mtx,
            uls, ult, lrs, lrt,
            alpha,
            shadowDirX, shadowDirY, shadowDirZ,
            shadowColorR, shadowColorG, shadowColorB,
            gSpriteShadingProfile->ambientColor.r + commonColorR + frontColorR,
            gSpriteShadingProfile->ambientColor.g + commonColorG + frontColorG,
            gSpriteShadingProfile->ambientColor.b + commonColorB + frontColorB,
            gSpriteShadingProfile->ambientPower,
            otherModeLBits
        );
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel effect_65_appendGfx
/* 3D09CC E00CA4CC 27BDFF38 */  addiu     $sp, $sp, -0xC8
/* 3D09D0 E00CA4D0 0080482D */  daddu     $t1, $a0, $zero
/* 3D09D4 E00CA4D4 3C0ADB06 */  lui       $t2, (0xDB060024 >> 16)
/* 3D09D8 E00CA4D8 354A0024 */  ori       $t2, $t2, (0xDB060024 & 0xFFFF)
/* 3D09DC E00CA4DC 27A40010 */  addiu     $a0, $sp, 0x10
/* 3D09E0 E00CA4E0 AFB20078 */  sw        $s2, 0x78($sp)
/* 3D09E4 E00CA4E4 3C120001 */  lui       $s2, (0x11630 >> 16)
/* 3D09E8 E00CA4E8 44800000 */  mtc1      $zero, $f0
/* 3D09EC E00CA4EC 36521630 */  ori       $s2, $s2, (0x11630 & 0xFFFF)
/* 3D09F0 E00CA4F0 AFB3007C */  sw        $s3, 0x7C($sp)
/* 3D09F4 E00CA4F4 3C13800A */  lui       $s3, %hi(gMainGfxPos)
/* 3D09F8 E00CA4F8 2673A66C */  addiu     $s3, $s3, %lo(gMainGfxPos)
/* 3D09FC E00CA4FC AFBF0094 */  sw        $ra, 0x94($sp)
/* 3D0A00 E00CA500 AFBE0090 */  sw        $fp, 0x90($sp)
/* 3D0A04 E00CA504 AFB7008C */  sw        $s7, 0x8C($sp)
/* 3D0A08 E00CA508 AFB60088 */  sw        $s6, 0x88($sp)
/* 3D0A0C E00CA50C AFB50084 */  sw        $s5, 0x84($sp)
/* 3D0A10 E00CA510 AFB40080 */  sw        $s4, 0x80($sp)
/* 3D0A14 E00CA514 AFB10074 */  sw        $s1, 0x74($sp)
/* 3D0A18 E00CA518 AFB00070 */  sw        $s0, 0x70($sp)
/* 3D0A1C E00CA51C F7BE00C0 */  sdc1      $f30, 0xC0($sp)
/* 3D0A20 E00CA520 F7BC00B8 */  sdc1      $f28, 0xB8($sp)
/* 3D0A24 E00CA524 F7BA00B0 */  sdc1      $f26, 0xB0($sp)
/* 3D0A28 E00CA528 F7B800A8 */  sdc1      $f24, 0xA8($sp)
/* 3D0A2C E00CA52C F7B600A0 */  sdc1      $f22, 0xA0($sp)
/* 3D0A30 E00CA530 F7B40098 */  sdc1      $f20, 0x98($sp)
/* 3D0A34 E00CA534 8E680000 */  lw        $t0, 0x0($s3)
/* 3D0A38 E00CA538 8D36000C */  lw        $s6, 0xC($t1)
/* 3D0A3C E00CA53C 0100182D */  daddu     $v1, $t0, $zero
/* 3D0A40 E00CA540 44050000 */  mfc1      $a1, $f0
/* 3D0A44 E00CA544 25080008 */  addiu     $t0, $t0, 0x8
/* 3D0A48 E00CA548 AE680000 */  sw        $t0, 0x0($s3)
/* 3D0A4C E00CA54C 8ECB0014 */  lw        $t3, 0x14($s6)
/* 3D0A50 E00CA550 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 3D0A54 E00CA554 AFAB0050 */  sw        $t3, 0x50($sp)
/* 3D0A58 E00CA558 8ED50024 */  lw        $s5, 0x24($s6)
/* 3D0A5C E00CA55C 8ECB0000 */  lw        $t3, 0x0($s6)
/* 3D0A60 E00CA560 00A0302D */  daddu     $a2, $a1, $zero
/* 3D0A64 E00CA564 AFAB0054 */  sw        $t3, 0x54($sp)
/* 3D0A68 E00CA568 C6C60034 */  lwc1      $f6, 0x34($s6)
/* 3D0A6C E00CA56C 00A0382D */  daddu     $a3, $a1, $zero
/* 3D0A70 E00CA570 E7A60058 */  swc1      $f6, 0x58($sp)
/* 3D0A74 E00CA574 AC620000 */  sw        $v0, 0x0($v1)
/* 3D0A78 E00CA578 AC600004 */  sw        $zero, 0x4($v1)
/* 3D0A7C E00CA57C AD0A0000 */  sw        $t2, 0x0($t0)
/* 3D0A80 E00CA580 8D230010 */  lw        $v1, 0x10($t1)
/* 3D0A84 E00CA584 25020008 */  addiu     $v0, $t0, 0x8
/* 3D0A88 E00CA588 AE620000 */  sw        $v0, 0x0($s3)
/* 3D0A8C E00CA58C 8C62001C */  lw        $v0, 0x1C($v1)
/* 3D0A90 E00CA590 3C038000 */  lui       $v1, (0x80000000 >> 16)
/* 3D0A94 E00CA594 00431021 */  addu      $v0, $v0, $v1
/* 3D0A98 E00CA598 0C080108 */  jal       shim_guTranslateF
/* 3D0A9C E00CA59C AD020004 */   sw       $v0, 0x4($t0)
/* 3D0AA0 E00CA5A0 27A40010 */  addiu     $a0, $sp, 0x10
/* 3D0AA4 E00CA5A4 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* 3D0AA8 E00CA5A8 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* 3D0AAC E00CA5AC 3C11800A */  lui       $s1, %hi(gDisplayContext)
/* 3D0AB0 E00CA5B0 2631A674 */  addiu     $s1, $s1, %lo(gDisplayContext)
/* 3D0AB4 E00CA5B4 96050000 */  lhu       $a1, 0x0($s0)
/* 3D0AB8 E00CA5B8 8E220000 */  lw        $v0, 0x0($s1)
/* 3D0ABC E00CA5BC 00052980 */  sll       $a1, $a1, 6
/* 3D0AC0 E00CA5C0 00B22821 */  addu      $a1, $a1, $s2
/* 3D0AC4 E00CA5C4 0C080118 */  jal       shim_guMtxF2L
/* 3D0AC8 E00CA5C8 00452821 */   addu     $a1, $v0, $a1
/* 3D0ACC E00CA5CC 3C03DA38 */  lui       $v1, (0xDA380002 >> 16)
/* 3D0AD0 E00CA5D0 34630002 */  ori       $v1, $v1, (0xDA380002 & 0xFFFF)
/* 3D0AD4 E00CA5D4 8E650000 */  lw        $a1, 0x0($s3)
/* 3D0AD8 E00CA5D8 96020000 */  lhu       $v0, 0x0($s0)
/* 3D0ADC E00CA5DC 00A0202D */  daddu     $a0, $a1, $zero
/* 3D0AE0 E00CA5E0 24A50008 */  addiu     $a1, $a1, 0x8
/* 3D0AE4 E00CA5E4 AE650000 */  sw        $a1, 0x0($s3)
/* 3D0AE8 E00CA5E8 AC830000 */  sw        $v1, 0x0($a0)
/* 3D0AEC E00CA5EC 24430001 */  addiu     $v1, $v0, 0x1
/* 3D0AF0 E00CA5F0 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 3D0AF4 E00CA5F4 00021180 */  sll       $v0, $v0, 6
/* 3D0AF8 E00CA5F8 A6030000 */  sh        $v1, 0x0($s0)
/* 3D0AFC E00CA5FC 8E230000 */  lw        $v1, 0x0($s1)
/* 3D0B00 E00CA600 00521021 */  addu      $v0, $v0, $s2
/* 3D0B04 E00CA604 00621821 */  addu      $v1, $v1, $v0
/* 3D0B08 E00CA608 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 3D0B0C E00CA60C AC830004 */  sw        $v1, 0x4($a0)
/* 3D0B10 E00CA610 ACA20000 */  sw        $v0, 0x0($a1)
/* 3D0B14 E00CA614 8FAB0054 */  lw        $t3, 0x54($sp)
/* 3D0B18 E00CA618 000B1080 */  sll       $v0, $t3, 2
/* 3D0B1C E00CA61C 3C03E00D */  lui       $v1, (0xE00D0000 >> 16)
/* 3D0B20 E00CA620 00621821 */  addu      $v1, $v1, $v0
/* 3D0B24 E00CA624 8C63ACB0 */  lw        $v1, -0x5350($v1)
/* 3D0B28 E00CA628 24A20008 */  addiu     $v0, $a1, 0x8
/* 3D0B2C E00CA62C AE620000 */  sw        $v0, 0x0($s3)
/* 3D0B30 E00CA630 29620002 */  slti      $v0, $t3, 0x2
/* 3D0B34 E00CA634 14400009 */  bnez      $v0, .LE00CA65C
/* 3D0B38 E00CA638 ACA30004 */   sw       $v1, 0x4($a1)
/* 3D0B3C E00CA63C 3C04FC40 */  lui       $a0, (0xFC4099FF >> 16)
/* 3D0B40 E00CA640 348499FF */  ori       $a0, $a0, (0xFC4099FF & 0xFFFF)
/* 3D0B44 E00CA644 3C035F0E */  lui       $v1, (0x5F0EFE3F >> 16)
/* 3D0B48 E00CA648 3463FE3F */  ori       $v1, $v1, (0x5F0EFE3F & 0xFFFF)
/* 3D0B4C E00CA64C 24A20010 */  addiu     $v0, $a1, 0x10
/* 3D0B50 E00CA650 AE620000 */  sw        $v0, 0x0($s3)
/* 3D0B54 E00CA654 ACA40008 */  sw        $a0, 0x8($a1)
/* 3D0B58 E00CA658 ACA3000C */  sw        $v1, 0xC($a1)
.LE00CA65C:
/* 3D0B5C E00CA65C 240BFFFF */  addiu     $t3, $zero, -0x1
/* 3D0B60 E00CA660 0000F02D */  daddu     $fp, $zero, $zero
/* 3D0B64 E00CA664 03C0A02D */  daddu     $s4, $fp, $zero
/* 3D0B68 E00CA668 3C088888 */  lui       $t0, (0x88888889 >> 16)
/* 3D0B6C E00CA66C AFAB0060 */  sw        $t3, 0x60($sp)
/* 3D0B70 E00CA670 8FAB0050 */  lw        $t3, 0x50($sp)
/* 3D0B74 E00CA674 35088889 */  ori       $t0, $t0, (0x88888889 & 0xFFFF)
/* 3D0B78 E00CA678 3162003F */  andi      $v0, $t3, 0x3F
/* 3D0B7C E00CA67C 00021140 */  sll       $v0, $v0, 5
/* 3D0B80 E00CA680 AFA20064 */  sw        $v0, 0x64($sp)
/* 3D0B84 E00CA684 8E660000 */  lw        $a2, 0x0($s3)
/* 3D0B88 E00CA688 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 3D0B8C E00CA68C 00C0382D */  daddu     $a3, $a2, $zero
/* 3D0B90 E00CA690 24C60008 */  addiu     $a2, $a2, 0x8
/* 3D0B94 E00CA694 24CB0010 */  addiu     $t3, $a2, 0x10
/* 3D0B98 E00CA698 AFAB005C */  sw        $t3, 0x5C($sp)
/* 3D0B9C E00CA69C AE660000 */  sw        $a2, 0x0($s3)
/* 3D0BA0 E00CA6A0 ACE20000 */  sw        $v0, 0x0($a3)
/* 3D0BA4 E00CA6A4 92C2001B */  lbu       $v0, 0x1B($s6)
/* 3D0BA8 E00CA6A8 92C4001F */  lbu       $a0, 0x1F($s6)
/* 3D0BAC E00CA6AC 92C50023 */  lbu       $a1, 0x23($s6)
/* 3D0BB0 E00CA6B0 24C30008 */  addiu     $v1, $a2, 0x8
/* 3D0BB4 E00CA6B4 AE630000 */  sw        $v1, 0x0($s3)
/* 3D0BB8 E00CA6B8 32A300FF */  andi      $v1, $s5, 0xFF
/* 3D0BBC E00CA6BC 00021600 */  sll       $v0, $v0, 24
/* 3D0BC0 E00CA6C0 00042400 */  sll       $a0, $a0, 16
/* 3D0BC4 E00CA6C4 00441025 */  or        $v0, $v0, $a0
/* 3D0BC8 E00CA6C8 00052A00 */  sll       $a1, $a1, 8
/* 3D0BCC E00CA6CC 00451025 */  or        $v0, $v0, $a1
/* 3D0BD0 E00CA6D0 00431025 */  or        $v0, $v0, $v1
/* 3D0BD4 E00CA6D4 ACE20004 */  sw        $v0, 0x4($a3)
/* 3D0BD8 E00CA6D8 3C02FB00 */  lui       $v0, (0xFB000000 >> 16)
/* 3D0BDC E00CA6DC ACC20000 */  sw        $v0, 0x0($a2)
/* 3D0BE0 E00CA6E0 92C3002B */  lbu       $v1, 0x2B($s6)
/* 3D0BE4 E00CA6E4 92C4002F */  lbu       $a0, 0x2F($s6)
/* 3D0BE8 E00CA6E8 92C50033 */  lbu       $a1, 0x33($s6)
/* 3D0BEC E00CA6EC 3C02DE01 */  lui       $v0, (0xDE010000 >> 16)
/* 3D0BF0 E00CA6F0 ACC20008 */  sw        $v0, 0x8($a2)
/* 3D0BF4 E00CA6F4 24C203D0 */  addiu     $v0, $a2, 0x3D0
/* 3D0BF8 E00CA6F8 ACC2000C */  sw        $v0, 0xC($a2)
/* 3D0BFC E00CA6FC AE620000 */  sw        $v0, 0x0($s3)
/* 3D0C00 E00CA700 00031E00 */  sll       $v1, $v1, 24
/* 3D0C04 E00CA704 00042400 */  sll       $a0, $a0, 16
/* 3D0C08 E00CA708 00641825 */  or        $v1, $v1, $a0
/* 3D0C0C E00CA70C 00052A00 */  sll       $a1, $a1, 8
/* 3D0C10 E00CA710 00651825 */  or        $v1, $v1, $a1
/* 3D0C14 E00CA714 ACC30004 */  sw        $v1, 0x4($a2)
/* 3D0C18 E00CA718 8EC602A8 */  lw        $a2, 0x2A8($s6)
/* 3D0C1C E00CA71C 26850001 */  addiu     $a1, $s4, 0x1
.LE00CA720:
/* 3D0C20 E00CA720 00C52021 */  addu      $a0, $a2, $a1
/* 3D0C24 E00CA724 00880018 */  mult      $a0, $t0
/* 3D0C28 E00CA728 00041FC3 */  sra       $v1, $a0, 31
/* 3D0C2C E00CA72C 00005810 */  mfhi      $t3
/* 3D0C30 E00CA730 01641021 */  addu      $v0, $t3, $a0
/* 3D0C34 E00CA734 00021103 */  sra       $v0, $v0, 4
/* 3D0C38 E00CA738 00431823 */  subu      $v1, $v0, $v1
/* 3D0C3C E00CA73C 00031100 */  sll       $v0, $v1, 4
/* 3D0C40 E00CA740 00431023 */  subu      $v0, $v0, $v1
/* 3D0C44 E00CA744 00021040 */  sll       $v0, $v0, 1
/* 3D0C48 E00CA748 00821823 */  subu      $v1, $a0, $v0
/* 3D0C4C E00CA74C 00031080 */  sll       $v0, $v1, 2
/* 3D0C50 E00CA750 02C21021 */  addu      $v0, $s6, $v0
/* 3D0C54 E00CA754 8C420230 */  lw        $v0, 0x230($v0)
/* 3D0C58 E00CA758 54400001 */  bnel      $v0, $zero, .LE00CA760
/* 3D0C5C E00CA75C 27DE0001 */   addiu    $fp, $fp, 0x1
.LE00CA760:
/* 3D0C60 E00CA760 00A0A02D */  daddu     $s4, $a1, $zero
/* 3D0C64 E00CA764 2A82001E */  slti      $v0, $s4, 0x1E
/* 3D0C68 E00CA768 1440FFED */  bnez      $v0, .LE00CA720
/* 3D0C6C E00CA76C 26850001 */   addiu    $a1, $s4, 0x1
/* 3D0C70 E00CA770 27DEFFFF */  addiu     $fp, $fp, -0x1
/* 3D0C74 E00CA774 1BC00130 */  blez      $fp, .LE00CAC38
/* 3D0C78 E00CA778 0000A02D */   daddu    $s4, $zero, $zero
/* 3D0C7C E00CA77C AFA00068 */  sw        $zero, 0x68($sp)
.LE00CA780:
/* 3D0C80 E00CA780 8FAB0068 */  lw        $t3, 0x68($sp)
/* 3D0C84 E00CA784 17C00002 */  bnez      $fp, .LE00CA790
/* 3D0C88 E00CA788 017E001A */   div      $zero, $t3, $fp
/* 3D0C8C E00CA78C 0007000D */  break     7
.LE00CA790:
/* 3D0C90 E00CA790 2401FFFF */  addiu     $at, $zero, -0x1
/* 3D0C94 E00CA794 17C10004 */  bne       $fp, $at, .LE00CA7A8
/* 3D0C98 E00CA798 3C018000 */   lui      $at, (0x80000000 >> 16)
/* 3D0C9C E00CA79C 15610002 */  bne       $t3, $at, .LE00CA7A8
/* 3D0CA0 E00CA7A0 00000000 */   nop
/* 3D0CA4 E00CA7A4 0006000D */  break     6
.LE00CA7A8:
/* 3D0CA8 E00CA7A8 00002812 */  mflo      $a1
/* 3D0CAC E00CA7AC 3C038888 */  lui       $v1, (0x88888889 >> 16)
/* 3D0CB0 E00CA7B0 34638889 */  ori       $v1, $v1, (0x88888889 & 0xFFFF)
/* 3D0CB4 E00CA7B4 8EC402A8 */  lw        $a0, 0x2A8($s6)
/* 3D0CB8 E00CA7B8 26820001 */  addiu     $v0, $s4, 0x1
/* 3D0CBC E00CA7BC 00822021 */  addu      $a0, $a0, $v0
/* 3D0CC0 E00CA7C0 00830018 */  mult      $a0, $v1
/* 3D0CC4 E00CA7C4 8FAB005C */  lw        $t3, 0x5C($sp)
/* 3D0CC8 E00CA7C8 00141140 */  sll       $v0, $s4, 5
/* 3D0CCC E00CA7CC 01629021 */  addu      $s2, $t3, $v0
/* 3D0CD0 E00CA7D0 00001810 */  mfhi      $v1
/* 3D0CD4 E00CA7D4 00641021 */  addu      $v0, $v1, $a0
/* 3D0CD8 E00CA7D8 00021103 */  sra       $v0, $v0, 4
/* 3D0CDC E00CA7DC 00041FC3 */  sra       $v1, $a0, 31
/* 3D0CE0 E00CA7E0 00439823 */  subu      $s3, $v0, $v1
/* 3D0CE4 E00CA7E4 00131100 */  sll       $v0, $s3, 4
/* 3D0CE8 E00CA7E8 00531023 */  subu      $v0, $v0, $s3
/* 3D0CEC E00CA7EC 00021040 */  sll       $v0, $v0, 1
/* 3D0CF0 E00CA7F0 44856000 */  mtc1      $a1, $f12
/* 3D0CF4 E00CA7F4 00000000 */  nop
/* 3D0CF8 E00CA7F8 46806320 */  cvt.s.w   $f12, $f12
/* 3D0CFC E00CA7FC 0C080140 */  jal       shim_sin_deg
/* 3D0D00 E00CA800 00829823 */   subu     $s3, $a0, $v0
/* 3D0D04 E00CA804 3C01437F */  lui       $at, (0x437F0000 >> 16)
/* 3D0D08 E00CA808 44811000 */  mtc1      $at, $f2
/* 3D0D0C E00CA80C 00000000 */  nop
/* 3D0D10 E00CA810 46020002 */  mul.s     $f0, $f0, $f2
/* 3D0D14 E00CA814 00000000 */  nop
/* 3D0D18 E00CA818 4600018D */  trunc.w.s $f6, $f0
/* 3D0D1C E00CA81C 44173000 */  mfc1      $s7, $f6
/* 3D0D20 E00CA820 00000000 */  nop
/* 3D0D24 E00CA824 2AE200C9 */  slti      $v0, $s7, 0xC9
/* 3D0D28 E00CA828 50400001 */  beql      $v0, $zero, .LE00CA830
/* 3D0D2C E00CA82C 241700C8 */   addiu    $s7, $zero, 0xC8
.LE00CA830:
/* 3D0D30 E00CA830 00131080 */  sll       $v0, $s3, 2
/* 3D0D34 E00CA834 02C28021 */  addu      $s0, $s6, $v0
/* 3D0D38 E00CA838 8E020230 */  lw        $v0, 0x230($s0)
/* 3D0D3C E00CA83C 504000DF */  beql      $v0, $zero, .LE00CABBC
/* 3D0D40 E00CA840 26940001 */   addiu    $s4, $s4, 0x1
/* 3D0D44 E00CA844 8FAB0060 */  lw        $t3, 0x60($sp)
/* 3D0D48 E00CA848 2402FFFF */  addiu     $v0, $zero, -0x1
/* 3D0D4C E00CA84C 15620012 */  bne       $t3, $v0, .LE00CA898
/* 3D0D50 E00CA850 2402001D */   addiu    $v0, $zero, 0x1D
/* 3D0D54 E00CA854 26630001 */  addiu     $v1, $s3, 0x1
/* 3D0D58 E00CA858 2862001E */  slti      $v0, $v1, 0x1E
/* 3D0D5C E00CA85C 50400001 */  beql      $v0, $zero, .LE00CA864
/* 3D0D60 E00CA860 0000182D */   daddu    $v1, $zero, $zero
.LE00CA864:
/* 3D0D64 E00CA864 00031080 */  sll       $v0, $v1, 2
/* 3D0D68 E00CA868 02C21021 */  addu      $v0, $s6, $v0
/* 3D0D6C E00CA86C AFB40060 */  sw        $s4, 0x60($sp)
/* 3D0D70 E00CA870 C44C00C8 */  lwc1      $f12, 0xC8($v0)
/* 3D0D74 E00CA874 8E0600C8 */  lw        $a2, 0xC8($s0)
/* 3D0D78 E00CA878 C6000050 */  lwc1      $f0, 0x50($s0)
/* 3D0D7C E00CA87C C44E0050 */  lwc1      $f14, 0x50($v0)
/* 3D0D80 E00CA880 46000007 */  neg.s     $f0, $f0
/* 3D0D84 E00CA884 44070000 */  mfc1      $a3, $f0
/* 3D0D88 E00CA888 0C080148 */  jal       shim_atan2
/* 3D0D8C E00CA88C 46007387 */   neg.s    $f14, $f14
/* 3D0D90 E00CA890 08032A63 */  j         .LE00CA98C
/* 3D0D94 E00CA894 46000787 */   neg.s    $f30, $f0
.LE00CA898:
/* 3D0D98 E00CA898 1282003C */  beq       $s4, $v0, .LE00CA98C
/* 3D0D9C E00CA89C 26630001 */   addiu    $v1, $s3, 0x1
/* 3D0DA0 E00CA8A0 2862001E */  slti      $v0, $v1, 0x1E
/* 3D0DA4 E00CA8A4 14400002 */  bnez      $v0, .LE00CA8B0
/* 3D0DA8 E00CA8A8 2671FFFF */   addiu    $s1, $s3, -0x1
/* 3D0DAC E00CA8AC 0000182D */  daddu     $v1, $zero, $zero
.LE00CA8B0:
/* 3D0DB0 E00CA8B0 06220001 */  bltzl     $s1, .LE00CA8B8
/* 3D0DB4 E00CA8B4 2411001D */   addiu    $s1, $zero, 0x1D
.LE00CA8B8:
/* 3D0DB8 E00CA8B8 00031080 */  sll       $v0, $v1, 2
/* 3D0DBC E00CA8BC 02C21021 */  addu      $v0, $s6, $v0
/* 3D0DC0 E00CA8C0 C44C00C8 */  lwc1      $f12, 0xC8($v0)
/* 3D0DC4 E00CA8C4 8E0600C8 */  lw        $a2, 0xC8($s0)
/* 3D0DC8 E00CA8C8 C6000050 */  lwc1      $f0, 0x50($s0)
/* 3D0DCC E00CA8CC C44E0050 */  lwc1      $f14, 0x50($v0)
/* 3D0DD0 E00CA8D0 46000007 */  neg.s     $f0, $f0
/* 3D0DD4 E00CA8D4 44070000 */  mfc1      $a3, $f0
/* 3D0DD8 E00CA8D8 0C080148 */  jal       shim_atan2
/* 3D0DDC E00CA8DC 46007387 */   neg.s    $f14, $f14
/* 3D0DE0 E00CA8E0 00111080 */  sll       $v0, $s1, 2
/* 3D0DE4 E00CA8E4 02C21021 */  addu      $v0, $s6, $v0
/* 3D0DE8 E00CA8E8 C60C00C8 */  lwc1      $f12, 0xC8($s0)
/* 3D0DEC E00CA8EC 8C4600C8 */  lw        $a2, 0xC8($v0)
/* 3D0DF0 E00CA8F0 46000507 */  neg.s     $f20, $f0
/* 3D0DF4 E00CA8F4 C4400050 */  lwc1      $f0, 0x50($v0)
/* 3D0DF8 E00CA8F8 C60E0050 */  lwc1      $f14, 0x50($s0)
/* 3D0DFC E00CA8FC 46000007 */  neg.s     $f0, $f0
/* 3D0E00 E00CA900 44070000 */  mfc1      $a3, $f0
/* 3D0E04 E00CA904 0C080148 */  jal       shim_atan2
/* 3D0E08 E00CA908 46007387 */   neg.s    $f14, $f14
/* 3D0E0C E00CA90C 46000307 */  neg.s     $f12, $f0
/* 3D0E10 E00CA910 46146081 */  sub.s     $f2, $f12, $f20
/* 3D0E14 E00CA914 3C014334 */  lui       $at, (0x43340000 >> 16)
/* 3D0E18 E00CA918 44810000 */  mtc1      $at, $f0
/* 3D0E1C E00CA91C 00000000 */  nop
/* 3D0E20 E00CA920 4602003C */  c.lt.s    $f0, $f2
/* 3D0E24 E00CA924 00000000 */  nop
/* 3D0E28 E00CA928 45000005 */  bc1f      .LE00CA940
/* 3D0E2C E00CA92C 00000000 */   nop
/* 3D0E30 E00CA930 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
/* 3D0E34 E00CA934 44813000 */  mtc1      $at, $f6
/* 3D0E38 E00CA938 08032A5B */  j         .LE00CA96C
/* 3D0E3C E00CA93C 4606A500 */   add.s    $f20, $f20, $f6
.LE00CA940:
/* 3D0E40 E00CA940 3C01C334 */  lui       $at, (0xC3340000 >> 16)
/* 3D0E44 E00CA944 44810000 */  mtc1      $at, $f0
/* 3D0E48 E00CA948 00000000 */  nop
/* 3D0E4C E00CA94C 4600103C */  c.lt.s    $f2, $f0
/* 3D0E50 E00CA950 00000000 */  nop
/* 3D0E54 E00CA954 45020006 */  bc1fl     .LE00CA970
/* 3D0E58 E00CA958 460CA780 */   add.s    $f30, $f20, $f12
/* 3D0E5C E00CA95C 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
/* 3D0E60 E00CA960 44813000 */  mtc1      $at, $f6
/* 3D0E64 E00CA964 00000000 */  nop
/* 3D0E68 E00CA968 46066300 */  add.s     $f12, $f12, $f6
.LE00CA96C:
/* 3D0E6C E00CA96C 460CA780 */  add.s     $f30, $f20, $f12
.LE00CA970:
/* 3D0E70 E00CA970 3C013FE0 */  lui       $at, (0x3FE00000 >> 16)
/* 3D0E74 E00CA974 44811800 */  mtc1      $at, $f3
/* 3D0E78 E00CA978 44801000 */  mtc1      $zero, $f2
/* 3D0E7C E00CA97C 4600F021 */  cvt.d.s   $f0, $f30
/* 3D0E80 E00CA980 46220002 */  mul.d     $f0, $f0, $f2
/* 3D0E84 E00CA984 00000000 */  nop
/* 3D0E88 E00CA988 462007A0 */  cvt.s.d   $f30, $f0
.LE00CA98C:
/* 3D0E8C E00CA98C 00131080 */  sll       $v0, $s3, 2
/* 3D0E90 E00CA990 02C28021 */  addu      $s0, $s6, $v0
/* 3D0E94 E00CA994 8E0301B8 */  lw        $v1, 0x1B8($s0)
/* 3D0E98 E00CA998 8FAB0050 */  lw        $t3, 0x50($sp)
/* 3D0E9C E00CA99C C6180050 */  lwc1      $f24, 0x50($s0)
/* 3D0EA0 E00CA9A0 C61A00C8 */  lwc1      $f26, 0xC8($s0)
/* 3D0EA4 E00CA9A4 C61C0140 */  lwc1      $f28, 0x140($s0)
/* 3D0EA8 E00CA9A8 00031080 */  sll       $v0, $v1, 2
/* 3D0EAC E00CA9AC 00431021 */  addu      $v0, $v0, $v1
/* 3D0EB0 E00CA9B0 00021100 */  sll       $v0, $v0, 4
/* 3D0EB4 E00CA9B4 01621023 */  subu      $v0, $t3, $v0
/* 3D0EB8 E00CA9B8 00021080 */  sll       $v0, $v0, 2
/* 3D0EBC E00CA9BC 44826000 */  mtc1      $v0, $f12
/* 3D0EC0 E00CA9C0 00000000 */  nop
/* 3D0EC4 E00CA9C4 46806320 */  cvt.s.w   $f12, $f12
/* 3D0EC8 E00CA9C8 0C080140 */  jal       shim_sin_deg
/* 3D0ECC E00CA9CC 01638823 */   subu     $s1, $t3, $v1
/* 3D0ED0 E00CA9D0 3C014040 */  lui       $at, (0x40400000 >> 16)
/* 3D0ED4 E00CA9D4 44811000 */  mtc1      $at, $f2
/* 3D0ED8 E00CA9D8 00000000 */  nop
/* 3D0EDC E00CA9DC 46020002 */  mul.s     $f0, $f0, $f2
/* 3D0EE0 E00CA9E0 00000000 */  nop
/* 3D0EE4 E00CA9E4 3C014180 */  lui       $at, (0x41800000 >> 16)
/* 3D0EE8 E00CA9E8 44811000 */  mtc1      $at, $f2
/* 3D0EEC E00CA9EC 00000000 */  nop
/* 3D0EF0 E00CA9F0 46020000 */  add.s     $f0, $f0, $f2
/* 3D0EF4 E00CA9F4 44911000 */  mtc1      $s1, $f2
/* 3D0EF8 E00CA9F8 00000000 */  nop
/* 3D0EFC E00CA9FC 468010A0 */  cvt.s.w   $f2, $f2
/* 3D0F00 E00CAA00 46020580 */  add.s     $f22, $f0, $f2
/* 3D0F04 E00CAA04 C7A60058 */  lwc1      $f6, 0x58($sp)
/* 3D0F08 E00CAA08 8FAB0054 */  lw        $t3, 0x54($sp)
/* 3D0F0C E00CAA0C 4606B582 */  mul.s     $f22, $f22, $f6
/* 3D0F10 E00CAA10 00000000 */  nop
/* 3D0F14 E00CAA14 C60002AC */  lwc1      $f0, 0x2AC($s0)
/* 3D0F18 E00CAA18 3C0141C0 */  lui       $at, (0x41C00000 >> 16)
/* 3D0F1C E00CAA1C 44813000 */  mtc1      $at, $f6
/* 3D0F20 E00CAA20 00000000 */  nop
/* 3D0F24 E00CAA24 46060002 */  mul.s     $f0, $f0, $f6
/* 3D0F28 E00CAA28 00000000 */  nop
/* 3D0F2C E00CAA2C C7A20064 */  lwc1      $f2, 0x64($sp)
/* 3D0F30 E00CAA30 468010A0 */  cvt.s.w   $f2, $f2
/* 3D0F34 E00CAA34 46020000 */  add.s     $f0, $f0, $f2
/* 3D0F38 E00CAA38 4600018D */  trunc.w.s $f6, $f0
/* 3D0F3C E00CAA3C 44153000 */  mfc1      $s5, $f6
/* 3D0F40 E00CAA40 241300FF */  addiu     $s3, $zero, 0xFF
/* 3D0F44 E00CAA44 0260802D */  daddu     $s0, $s3, $zero
/* 3D0F48 E00CAA48 00111040 */  sll       $v0, $s1, 1
/* 3D0F4C E00CAA4C 00511021 */  addu      $v0, $v0, $s1
/* 3D0F50 E00CAA50 000210C0 */  sll       $v0, $v0, 3
/* 3D0F54 E00CAA54 00511021 */  addu      $v0, $v0, $s1
/* 3D0F58 E00CAA58 00021080 */  sll       $v0, $v0, 2
/* 3D0F5C E00CAA5C 02028823 */  subu      $s1, $s0, $v0
/* 3D0F60 E00CAA60 06210022 */  bgez      $s1, .LE00CAAEC
/* 3D0F64 E00CAA64 00000000 */   nop
/* 3D0F68 E00CAA68 44910000 */  mtc1      $s1, $f0
/* 3D0F6C E00CAA6C 00000000 */  nop
/* 3D0F70 E00CAA70 46800020 */  cvt.s.w   $f0, $f0
/* 3D0F74 E00CAA74 3C01E00D */  lui       $at, (0xE00D0000 >> 16)
/* 3D0F78 E00CAA78 D422ACC0 */  ldc1      $f2, -0x5340($at)
/* 3D0F7C E00CAA7C 46000021 */  cvt.d.s   $f0, $f0
/* 3D0F80 E00CAA80 46220002 */  mul.d     $f0, $f0, $f2
/* 3D0F84 E00CAA84 00000000 */  nop
/* 3D0F88 E00CAA88 3C01E00D */  lui       $at, (0xE00D0000 >> 16)
/* 3D0F8C E00CAA8C D426ACC8 */  ldc1      $f6, -0x5338($at)
/* 3D0F90 E00CAA90 46260000 */  add.d     $f0, $f0, $f6
/* 3D0F94 E00CAA94 4620018D */  trunc.w.d $f6, $f0
/* 3D0F98 E00CAA98 44103000 */  mfc1      $s0, $f6
/* 3D0F9C E00CAA9C 00000000 */  nop
/* 3D0FA0 E00CAAA0 06010012 */  bgez      $s0, .LE00CAAEC
/* 3D0FA4 E00CAAA4 0000882D */   daddu    $s1, $zero, $zero
/* 3D0FA8 E00CAAA8 44900000 */  mtc1      $s0, $f0
/* 3D0FAC E00CAAAC 00000000 */  nop
/* 3D0FB0 E00CAAB0 46800020 */  cvt.s.w   $f0, $f0
/* 3D0FB4 E00CAAB4 3C01E00D */  lui       $at, (0xE00D0000 >> 16)
/* 3D0FB8 E00CAAB8 D422ACD0 */  ldc1      $f2, -0x5330($at)
/* 3D0FBC E00CAABC 46000021 */  cvt.d.s   $f0, $f0
/* 3D0FC0 E00CAAC0 46220002 */  mul.d     $f0, $f0, $f2
/* 3D0FC4 E00CAAC4 00000000 */  nop
/* 3D0FC8 E00CAAC8 3C01E00D */  lui       $at, (0xE00D0000 >> 16)
/* 3D0FCC E00CAACC D426ACD8 */  ldc1      $f6, -0x5328($at)
/* 3D0FD0 E00CAAD0 46260000 */  add.d     $f0, $f0, $f6
/* 3D0FD4 E00CAAD4 4620018D */  trunc.w.d $f6, $f0
/* 3D0FD8 E00CAAD8 44133000 */  mfc1      $s3, $f6
/* 3D0FDC E00CAADC 00000000 */  nop
/* 3D0FE0 E00CAAE0 06610002 */  bgez      $s3, .LE00CAAEC
/* 3D0FE4 E00CAAE4 0220802D */   daddu    $s0, $s1, $zero
/* 3D0FE8 E00CAAE8 0220982D */  daddu     $s3, $s1, $zero
.LE00CAAEC:
/* 3D0FEC E00CAAEC 0C080140 */  jal       shim_sin_deg
/* 3D0FF0 E00CAAF0 4600F306 */   mov.s    $f12, $f30
/* 3D0FF4 E00CAAF4 4600B502 */  mul.s     $f20, $f22, $f0
/* 3D0FF8 E00CAAF8 00000000 */  nop
/* 3D0FFC E00CAAFC 0C080144 */  jal       shim_cos_deg
/* 3D1000 E00CAB00 4600F306 */   mov.s    $f12, $f30
/* 3D1004 E00CAB04 4600B002 */  mul.s     $f0, $f22, $f0
/* 3D1008 E00CAB08 00000000 */  nop
/* 3D100C E00CAB0C 24020400 */  addiu     $v0, $zero, 0x400
/* 3D1010 E00CAB10 8FAB0068 */  lw        $t3, 0x68($sp)
/* 3D1014 E00CAB14 44803000 */  mtc1      $zero, $f6
/* 3D1018 E00CAB18 256B00B4 */  addiu     $t3, $t3, 0xB4
/* 3D101C E00CAB1C 4606E080 */  add.s     $f2, $f28, $f6
/* 3D1020 E00CAB20 AFAB0068 */  sw        $t3, 0x68($sp)
/* 3D1024 E00CAB24 A6550008 */  sh        $s5, 0x8($s2)
/* 3D1028 E00CAB28 A642000A */  sh        $v0, 0xA($s2)
/* 3D102C E00CAB2C 4614C100 */  add.s     $f4, $f24, $f20
/* 3D1030 E00CAB30 A253000C */  sb        $s3, 0xC($s2)
/* 3D1034 E00CAB34 4600118D */  trunc.w.s $f6, $f2
/* 3D1038 E00CAB38 44033000 */  mfc1      $v1, $f6
/* 3D103C E00CAB3C 4600D080 */  add.s     $f2, $f26, $f0
/* 3D1040 E00CAB40 A250000D */  sb        $s0, 0xD($s2)
/* 3D1044 E00CAB44 A251000E */  sb        $s1, 0xE($s2)
/* 3D1048 E00CAB48 4614C501 */  sub.s     $f20, $f24, $f20
/* 3D104C E00CAB4C A257000F */  sb        $s7, 0xF($s2)
/* 3D1050 E00CAB50 A6430004 */  sh        $v1, 0x4($s2)
/* 3D1054 E00CAB54 4600D001 */  sub.s     $f0, $f26, $f0
/* 3D1058 E00CAB58 4600218D */  trunc.w.s $f6, $f4
/* 3D105C E00CAB5C 44023000 */  mfc1      $v0, $f6
/* 3D1060 E00CAB60 00000000 */  nop
/* 3D1064 E00CAB64 A6420000 */  sh        $v0, 0x0($s2)
/* 3D1068 E00CAB68 4600118D */  trunc.w.s $f6, $f2
/* 3D106C E00CAB6C 44023000 */  mfc1      $v0, $f6
/* 3D1070 E00CAB70 00000000 */  nop
/* 3D1074 E00CAB74 A6420002 */  sh        $v0, 0x2($s2)
/* 3D1078 E00CAB78 26520010 */  addiu     $s2, $s2, 0x10
/* 3D107C E00CAB7C 4600A18D */  trunc.w.s $f6, $f20
/* 3D1080 E00CAB80 44023000 */  mfc1      $v0, $f6
/* 3D1084 E00CAB84 00000000 */  nop
/* 3D1088 E00CAB88 A6420000 */  sh        $v0, 0x0($s2)
/* 3D108C E00CAB8C 4600018D */  trunc.w.s $f6, $f0
/* 3D1090 E00CAB90 44023000 */  mfc1      $v0, $f6
/* 3D1094 E00CAB94 00000000 */  nop
/* 3D1098 E00CAB98 A6420002 */  sh        $v0, 0x2($s2)
/* 3D109C E00CAB9C A6430004 */  sh        $v1, 0x4($s2)
/* 3D10A0 E00CABA0 A6550008 */  sh        $s5, 0x8($s2)
/* 3D10A4 E00CABA4 A640000A */  sh        $zero, 0xA($s2)
/* 3D10A8 E00CABA8 A253000C */  sb        $s3, 0xC($s2)
/* 3D10AC E00CABAC A250000D */  sb        $s0, 0xD($s2)
/* 3D10B0 E00CABB0 A251000E */  sb        $s1, 0xE($s2)
/* 3D10B4 E00CABB4 A257000F */  sb        $s7, 0xF($s2)
/* 3D10B8 E00CABB8 26940001 */  addiu     $s4, $s4, 0x1
.LE00CABBC:
/* 3D10BC E00CABBC 2A82001E */  slti      $v0, $s4, 0x1E
/* 3D10C0 E00CABC0 1440FEEF */  bnez      $v0, .LE00CA780
/* 3D10C4 E00CABC4 00000000 */   nop
/* 3D10C8 E00CABC8 8FB40060 */  lw        $s4, 0x60($sp)
/* 3D10CC E00CABCC 2A82001D */  slti      $v0, $s4, 0x1D
/* 3D10D0 E00CABD0 10400019 */  beqz      $v0, .LE00CAC38
/* 3D10D4 E00CABD4 3C050002 */   lui      $a1, (0x20406 >> 16)
/* 3D10D8 E00CABD8 3C04800A */  lui       $a0, %hi(gMainGfxPos)
/* 3D10DC E00CABDC 2484A66C */  addiu     $a0, $a0, %lo(gMainGfxPos)
/* 3D10E0 E00CABE0 3C080100 */  lui       $t0, (0x1004008 >> 16)
/* 3D10E4 E00CABE4 35084008 */  ori       $t0, $t0, (0x1004008 & 0xFFFF)
/* 3D10E8 E00CABE8 3C070600 */  lui       $a3, (0x6000402 >> 16)
/* 3D10EC E00CABEC 34E70402 */  ori       $a3, $a3, (0x6000402 & 0xFFFF)
/* 3D10F0 E00CABF0 34A50406 */  ori       $a1, $a1, (0x20406 & 0xFFFF)
/* 3D10F4 E00CABF4 8FAB005C */  lw        $t3, 0x5C($sp)
/* 3D10F8 E00CABF8 00141140 */  sll       $v0, $s4, 5
/* 3D10FC E00CABFC 004B3021 */  addu      $a2, $v0, $t3
.LE00CAC00:
/* 3D1100 E00CAC00 8C830000 */  lw        $v1, 0x0($a0)
/* 3D1104 E00CAC04 26940001 */  addiu     $s4, $s4, 0x1
/* 3D1108 E00CAC08 0060102D */  daddu     $v0, $v1, $zero
/* 3D110C E00CAC0C 24630008 */  addiu     $v1, $v1, 0x8
/* 3D1110 E00CAC10 AC460004 */  sw        $a2, 0x4($v0)
/* 3D1114 E00CAC14 24C60020 */  addiu     $a2, $a2, 0x20
/* 3D1118 E00CAC18 AC830000 */  sw        $v1, 0x0($a0)
/* 3D111C E00CAC1C AC480000 */  sw        $t0, 0x0($v0)
/* 3D1120 E00CAC20 24620008 */  addiu     $v0, $v1, 0x8
/* 3D1124 E00CAC24 AC820000 */  sw        $v0, 0x0($a0)
/* 3D1128 E00CAC28 2A82001D */  slti      $v0, $s4, 0x1D
/* 3D112C E00CAC2C AC670000 */  sw        $a3, 0x0($v1)
/* 3D1130 E00CAC30 1440FFF3 */  bnez      $v0, .LE00CAC00
/* 3D1134 E00CAC34 AC650004 */   sw       $a1, 0x4($v1)
.LE00CAC38:
/* 3D1138 E00CAC38 3C05D838 */  lui       $a1, (0xD8380002 >> 16)
/* 3D113C E00CAC3C 3C03800A */  lui       $v1, %hi(gMainGfxPos)
/* 3D1140 E00CAC40 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
/* 3D1144 E00CAC44 8C620000 */  lw        $v0, 0x0($v1)
/* 3D1148 E00CAC48 34A50002 */  ori       $a1, $a1, (0xD8380002 & 0xFFFF)
/* 3D114C E00CAC4C 0040202D */  daddu     $a0, $v0, $zero
/* 3D1150 E00CAC50 24420008 */  addiu     $v0, $v0, 0x8
/* 3D1154 E00CAC54 AC620000 */  sw        $v0, 0x0($v1)
/* 3D1158 E00CAC58 24020040 */  addiu     $v0, $zero, 0x40
/* 3D115C E00CAC5C AC850000 */  sw        $a1, 0x0($a0)
/* 3D1160 E00CAC60 AC820004 */  sw        $v0, 0x4($a0)
/* 3D1164 E00CAC64 8FBF0094 */  lw        $ra, 0x94($sp)
/* 3D1168 E00CAC68 8FBE0090 */  lw        $fp, 0x90($sp)
/* 3D116C E00CAC6C 8FB7008C */  lw        $s7, 0x8C($sp)
/* 3D1170 E00CAC70 8FB60088 */  lw        $s6, 0x88($sp)
/* 3D1174 E00CAC74 8FB50084 */  lw        $s5, 0x84($sp)
/* 3D1178 E00CAC78 8FB40080 */  lw        $s4, 0x80($sp)
/* 3D117C E00CAC7C 8FB3007C */  lw        $s3, 0x7C($sp)
/* 3D1180 E00CAC80 8FB20078 */  lw        $s2, 0x78($sp)
/* 3D1184 E00CAC84 8FB10074 */  lw        $s1, 0x74($sp)
/* 3D1188 E00CAC88 8FB00070 */  lw        $s0, 0x70($sp)
/* 3D118C E00CAC8C D7BE00C0 */  ldc1      $f30, 0xC0($sp)
/* 3D1190 E00CAC90 D7BC00B8 */  ldc1      $f28, 0xB8($sp)
/* 3D1194 E00CAC94 D7BA00B0 */  ldc1      $f26, 0xB0($sp)
/* 3D1198 E00CAC98 D7B800A8 */  ldc1      $f24, 0xA8($sp)
/* 3D119C E00CAC9C D7B600A0 */  ldc1      $f22, 0xA0($sp)
/* 3D11A0 E00CACA0 D7B40098 */  ldc1      $f20, 0x98($sp)
/* 3D11A4 E00CACA4 03E00008 */  jr        $ra
/* 3D11A8 E00CACA8 27BD00C8 */   addiu    $sp, $sp, 0xC8
/* 3D11AC E00CACAC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void effect_65_appendGfx(void* effect) {
    Effect65FXData* data = ((EffectInstance*)effect)->data.unk_65;
    Matrix4f mtx;
    s32 lifeTime;
    s32 variation;
    f32 scale;
    Vtx_t* vtxBuffer;
    Vtx_t* vtx;
    s32 firstPointIdx;
    s32 baseTexOffset;
    s32 phase;
    f32 deltaY;
    f32 deltaX;

    f32 width;
    f32 pathPointX;
    f32 pathPointY;
    f32 pathPointZ;
    f32 deltaAngle;
    f32 prevAngle;
    f32 nextAngle;
    f32 angle;
    s32 primAlpha;
    s32 texOffsetX;
    s32 numPoints;
    s32 pathPointLifetime;
    s32 r, g, b, a;
    f32 deltaZ;

    s32 idx;
    s32 next;
    s32 prev;
    s32 i;
    s32 fadeOutPhase;

    lifeTime = data->lifeTime;
    primAlpha = data->alpha;
    variation = data->variation;
    scale = data->scale;

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

    shim_guTranslateF(mtx, 0.0f, 0.0f, 0.0f);
    shim_guMtxF2L(mtx, &gDisplayContext->matrixStack[gMatrixListPos]);

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

    if (variation >= 2) {
        gDPSetCombineLERP(gMainGfxPos++, SHADE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, SHADE, 0, 0, 0, 0, COMBINED, COMBINED, 0, PRIMITIVE, 0);
    }

    gDPSetPrimColor(gMainGfxPos++, 0, 0, data->primR, data->primG, data->primB, primAlpha);
    gDPSetEnvColor(gMainGfxPos++, data->envR, data->envG, data->envB, 0);
    gSPBranchList(gMainGfxPos, gMainGfxPos + 0x79);

    vtxBuffer = (Vtx_t*) (gMainGfxPos + 1);
    firstPointIdx = -1;
    baseTexOffset = (lifeTime & 0x3F) << 5;
    gMainGfxPos += 0x79;

    numPoints = 0;
    for (i = 0; i < MAX_POINTS; i++) {
        s32 a1 = i + 1;
        s32 idx = (data->lastPointIndex + a1) % MAX_POINTS;
        if (data->pathPointEnabled[idx]) {
            numPoints++;
        }
    }

    numPoints--;
    if (numPoints > 0) {
        phase = 0;
        for (i = 0; i < MAX_POINTS; i++) {
            s32 a1 = i + 1;
            vtx = &vtxBuffer[i * 2];
            fadeOutPhase = phase / numPoints;
            idx = (data->lastPointIndex + a1) % MAX_POINTS;

            a = shim_sin_deg(fadeOutPhase) * 255.0f;
            if (a > 200) {
                a = 200;
            }

            if (!data->pathPointEnabled[idx]) {
                continue;
            }

            if (firstPointIdx == -1) {
                next = idx + 1;
                if (next >= MAX_POINTS) {
                    next = 0;
                }
                firstPointIdx = i;
                angle = -shim_atan2(data->pathY[next], -data->pathX[next], data->pathY[idx], -data->pathX[idx]);
            } else {
                if (i != MAX_POINTS - 1) {
                    next = idx + 1;
                    prev = idx - 1;
                    if (next >= MAX_POINTS) {
                        next = 0;
                    }
                    if (prev < 0) {
                        prev = MAX_POINTS - 1;
                    }
                    nextAngle = -shim_atan2(data->pathY[next], -data->pathX[next], data->pathY[idx], -data->pathX[idx]);
                    prevAngle = -shim_atan2(data->pathY[idx], -data->pathX[idx], data->pathY[prev], -data->pathX[prev]);
                    deltaAngle = prevAngle - nextAngle;
                    if (deltaAngle > 180.0f) {
                        nextAngle += 360.0f;
                    } else if (deltaAngle < -180.0f) {
                        prevAngle += 360.0f;
                    }
                    angle = nextAngle + prevAngle;
                    angle *= 0.5;
                }
            }
            pathPointX = data->pathX[idx];
            pathPointY = data->pathY[idx];
            pathPointZ = data->pathZ[idx];
            pathPointLifetime = lifeTime - data->pathTimestamp[idx];
            width = shim_sin_deg((lifeTime - data->pathTimestamp[idx] * 80) * 4) * 3.0f + 16.0f + pathPointLifetime;

            width *= scale;
            if (variation >= 0) {
                texOffsetX = (data->pathLength[idx] * 24.0f) + baseTexOffset;
            } else {
                texOffsetX = (data->pathLength[idx] * 24.0f) + baseTexOffset;
            }

            r = 255;
            g = 255;
            b = 255 - pathPointLifetime * 100;
            if (b < 0) {
                g = (f32) b * 0.8 + 255.0;
                b = 0;
                if (g < 0) {
                    r = (f32) g * 0.4 + 255.0;
                    g = 0;
                    if (r < 0) {
                        r = 0;
                    }
                }
            }

            deltaX = width * shim_sin_deg(angle);
            deltaY = width * shim_cos_deg(angle);
            deltaZ = 0.0f;

            vtx->ob[0] = pathPointX + deltaX;
            vtx->ob[1] = pathPointY + deltaY;
            vtx->ob[2] = pathPointZ + deltaZ;
            vtx->tc[0] = texOffsetX;
            vtx->tc[1] = 0x400;
            vtx->cn[0] = r;
            vtx->cn[1] = g;
            vtx->cn[2] = b;
            vtx->cn[3] = a;
            vtx++;

            vtx->ob[0] = pathPointX - deltaX;
            vtx->ob[1] = pathPointY - deltaY;
            vtx->ob[2] = pathPointZ + deltaZ;
            vtx->tc[0] = texOffsetX;
            vtx->tc[1] = 0;
            vtx->cn[0] = r;
            vtx->cn[1] = g;
            vtx->cn[2] = b;
            vtx->cn[3] = a;
            vtx++;

            phase += 180;
        }

        for (i = firstPointIdx; i < MAX_POINTS - 1; i++) {
            gSPVertex(gMainGfxPos++, &vtxBuffer[i * 2], 4, 0);
            gSP2Triangles(gMainGfxPos++, 0, 2, 1, 0, 1, 2, 3, 0);
        }
    }

    gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
}