### RAW ASSEMBLY INSTRUCTIONS:

glabel shape_spell_appendGfx
/* 3396A4 E0024454 27BDFF18 */  addiu     $sp, $sp, -0xE8
/* 3396A8 E0024458 3C07DB06 */  lui       $a3, (0xDB060024 >> 16)
/* 3396AC E002445C 3C05800A */  lui       $a1, %hi(gMainGfxPos)
/* 3396B0 E0024460 24A5A66C */  addiu     $a1, $a1, %lo(gMainGfxPos)
/* 3396B4 E0024464 34E70024 */  ori       $a3, $a3, (0xDB060024 & 0xFFFF)
/* 3396B8 E0024468 AFBF00B4 */  sw        $ra, 0xB4($sp)
/* 3396BC E002446C AFBE00B0 */  sw        $fp, 0xB0($sp)
/* 3396C0 E0024470 AFB700AC */  sw        $s7, 0xAC($sp)
/* 3396C4 E0024474 AFB600A8 */  sw        $s6, 0xA8($sp)
/* 3396C8 E0024478 AFB500A4 */  sw        $s5, 0xA4($sp)
/* 3396CC E002447C AFB400A0 */  sw        $s4, 0xA0($sp)
/* 3396D0 E0024480 AFB3009C */  sw        $s3, 0x9C($sp)
/* 3396D4 E0024484 AFB20098 */  sw        $s2, 0x98($sp)
/* 3396D8 E0024488 AFB10094 */  sw        $s1, 0x94($sp)
/* 3396DC E002448C AFB00090 */  sw        $s0, 0x90($sp)
/* 3396E0 E0024490 F7BE00E0 */  sdc1      $f30, 0xE0($sp)
/* 3396E4 E0024494 F7BC00D8 */  sdc1      $f28, 0xD8($sp)
/* 3396E8 E0024498 F7BA00D0 */  sdc1      $f26, 0xD0($sp)
/* 3396EC E002449C F7B800C8 */  sdc1      $f24, 0xC8($sp)
/* 3396F0 E00244A0 F7B600C0 */  sdc1      $f22, 0xC0($sp)
/* 3396F4 E00244A4 F7B400B8 */  sdc1      $f20, 0xB8($sp)
/* 3396F8 E00244A8 8CA30000 */  lw        $v1, 0x0($a1)
/* 3396FC E00244AC 8C96000C */  lw        $s6, 0xC($a0)
/* 339700 E00244B0 0060302D */  daddu     $a2, $v1, $zero
/* 339704 E00244B4 24630008 */  addiu     $v1, $v1, 0x8
/* 339708 E00244B8 ACA30000 */  sw        $v1, 0x0($a1)
/* 33970C E00244BC C6C40028 */  lwc1      $f4, 0x28($s6)
/* 339710 E00244C0 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 339714 E00244C4 E7A4007C */  swc1      $f4, 0x7C($sp)
/* 339718 E00244C8 ACC20000 */  sw        $v0, 0x0($a2)
/* 33971C E00244CC 24620008 */  addiu     $v0, $v1, 0x8
/* 339720 E00244D0 ACC00004 */  sw        $zero, 0x4($a2)
/* 339724 E00244D4 ACA20000 */  sw        $v0, 0x0($a1)
/* 339728 E00244D8 AC670000 */  sw        $a3, 0x0($v1)
/* 33972C E00244DC 24670010 */  addiu     $a3, $v1, 0x10
/* 339730 E00244E0 ACA70000 */  sw        $a3, 0x0($a1)
/* 339734 E00244E4 8C820010 */  lw        $v0, 0x10($a0)
/* 339738 E00244E8 24660018 */  addiu     $a2, $v1, 0x18
/* 33973C E00244EC ACA60000 */  sw        $a2, 0x0($a1)
/* 339740 E00244F0 8C44001C */  lw        $a0, 0x1C($v0)
/* 339744 E00244F4 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 339748 E00244F8 AC620008 */  sw        $v0, 0x8($v1)
/* 33974C E00244FC 3C020900 */  lui       $v0, %hi(D_09001080_40E310)
/* 339750 E0024500 24421080 */  addiu     $v0, $v0, %lo(D_09001080_40E310)
/* 339754 E0024504 AC62000C */  sw        $v0, 0xC($v1)
/* 339758 E0024508 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 33975C E002450C 00822021 */  addu      $a0, $a0, $v0
/* 339760 E0024510 AC640004 */  sw        $a0, 0x4($v1)
/* 339764 E0024514 8EC80034 */  lw        $t0, 0x34($s6)
/* 339768 E0024518 AFA80080 */  sw        $t0, 0x80($sp)
/* 33976C E002451C C6C40014 */  lwc1      $f4, 0x14($s6)
/* 339770 E0024520 C6DA0010 */  lwc1      $f26, 0x10($s6)
/* 339774 E0024524 E7A40084 */  swc1      $f4, 0x84($sp)
/* 339778 E0024528 C6C40018 */  lwc1      $f4, 0x18($s6)
/* 33977C E002452C AFA70078 */  sw        $a3, 0x78($sp)
/* 339780 E0024530 AFA60074 */  sw        $a2, 0x74($sp)
/* 339784 E0024534 E7A40088 */  swc1      $f4, 0x88($sp)
/* 339788 E0024538 8EC80000 */  lw        $t0, 0x0($s6)
/* 33978C E002453C AFA80070 */  sw        $t0, 0x70($sp)
/* 339790 E0024540 8EC30030 */  lw        $v1, 0x30($s6)
/* 339794 E0024544 15000018 */  bnez      $t0, .LE00245A8
/* 339798 E0024548 00031040 */   sll      $v0, $v1, 1
/* 33979C E002454C 000310C0 */  sll       $v0, $v1, 3
/* 3397A0 E0024550 00431021 */  addu      $v0, $v0, $v1
/* 3397A4 E0024554 00021080 */  sll       $v0, $v0, 2
/* 3397A8 E0024558 00431023 */  subu      $v0, $v0, $v1
/* 3397AC E002455C 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 3397B0 E0024560 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 3397B4 E0024564 4482B000 */  mtc1      $v0, $f22
/* 3397B8 E0024568 00000000 */  nop
/* 3397BC E002456C 4680B5A0 */  cvt.s.w   $f22, $f22
/* 3397C0 E0024570 00031080 */  sll       $v0, $v1, 2
/* 3397C4 E0024574 00431021 */  addu      $v0, $v0, $v1
/* 3397C8 E0024578 00021080 */  sll       $v0, $v0, 2
/* 3397CC E002457C 00431023 */  subu      $v0, $v0, $v1
/* 3397D0 E0024580 000218C0 */  sll       $v1, $v0, 3
/* 3397D4 E0024584 00431021 */  addu      $v0, $v0, $v1
/* 3397D8 E0024588 000210C0 */  sll       $v0, $v0, 3
/* 3397DC E002458C 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 3397E0 E0024590 00220821 */  addu      $at, $at, $v0
/* 3397E4 E0024594 C4201DEC */  lwc1      $f0, %lo(gCameras + 0x6C)($at)
/* 3397E8 E0024598 3C014110 */  lui       $at, (0x41100000 >> 16)
/* 3397EC E002459C 4481C000 */  mtc1      $at, $f24
/* 3397F0 E00245A0 08009176 */  j         .LE00245D8
/* 3397F4 E00245A4 46000787 */   neg.s    $f30, $f0
.LE00245A8:
/* 3397F8 E00245A8 00431021 */  addu      $v0, $v0, $v1
/* 3397FC E00245AC 000210C0 */  sll       $v0, $v0, 3
/* 339800 E00245B0 00431021 */  addu      $v0, $v0, $v1
/* 339804 E00245B4 4482B000 */  mtc1      $v0, $f22
/* 339808 E00245B8 00000000 */  nop
/* 33980C E00245BC 4680B5A0 */  cvt.s.w   $f22, $f22
/* 339810 E00245C0 C7A4007C */  lwc1      $f4, 0x7C($sp)
/* 339814 E00245C4 3C0140C0 */  lui       $at, (0x40C00000 >> 16)
/* 339818 E00245C8 4481C000 */  mtc1      $at, $f24
/* 33981C E00245CC 4480F000 */  mtc1      $zero, $f30
/* 339820 E00245D0 4604D682 */  mul.s     $f26, $f26, $f4
/* 339824 E00245D4 00000000 */  nop
.LE00245D8:
/* 339828 E00245D8 0000B82D */  daddu     $s7, $zero, $zero
/* 33982C E00245DC 3C1E8007 */  lui       $fp, %hi(gMatrixListPos)
/* 339830 E00245E0 27DE41F0 */  addiu     $fp, $fp, %lo(gMatrixListPos)
/* 339834 E00245E4 3C080001 */  lui       $t0, (0x11630 >> 16)
/* 339838 E00245E8 35081630 */  ori       $t0, $t0, (0x11630 & 0xFFFF)
/* 33983C E00245EC 4480E000 */  mtc1      $zero, $f28
/* 339840 E00245F0 3C15800A */  lui       $s5, %hi(gMainGfxPos)
/* 339844 E00245F4 26B5A66C */  addiu     $s5, $s5, %lo(gMainGfxPos)
/* 339848 E00245F8 AFA8008C */  sw        $t0, 0x8C($sp)
.LE00245FC:
/* 33984C E00245FC 1AE00033 */  blez      $s7, .LE00246CC
/* 339850 E0024600 00000000 */   nop
/* 339854 E0024604 8FA80070 */  lw        $t0, 0x70($sp)
/* 339858 E0024608 15000013 */  bnez      $t0, .LE0024658
/* 33985C E002460C 00000000 */   nop
/* 339860 E0024610 3C01428C */  lui       $at, (0x428C0000 >> 16)
/* 339864 E0024614 44810000 */  mtc1      $at, $f0
/* 339868 E0024618 00000000 */  nop
/* 33986C E002461C 4600B581 */  sub.s     $f22, $f22, $f0
/* 339870 E0024620 C6C0001C */  lwc1      $f0, 0x1C($s6)
/* 339874 E0024624 46000000 */  add.s     $f0, $f0, $f0
/* 339878 E0024628 4600D681 */  sub.s     $f26, $f26, $f0
/* 33987C E002462C C6C00020 */  lwc1      $f0, 0x20($s6)
/* 339880 E0024630 46000000 */  add.s     $f0, $f0, $f0
/* 339884 E0024634 C7A40084 */  lwc1      $f4, 0x84($sp)
/* 339888 E0024638 46002101 */  sub.s     $f4, $f4, $f0
/* 33988C E002463C E7A40084 */  swc1      $f4, 0x84($sp)
/* 339890 E0024640 C6C00024 */  lwc1      $f0, 0x24($s6)
/* 339894 E0024644 46000000 */  add.s     $f0, $f0, $f0
/* 339898 E0024648 C7A40088 */  lwc1      $f4, 0x88($sp)
/* 33989C E002464C 46002101 */  sub.s     $f4, $f4, $f0
/* 3398A0 E0024650 080091A4 */  j         .LE0024690
/* 3398A4 E0024654 E7A40088 */   swc1     $f4, 0x88($sp)
.LE0024658:
/* 3398A8 E0024658 C6C0001C */  lwc1      $f0, 0x1C($s6)
/* 3398AC E002465C 3C01E002 */  lui       $at, (0xE0024D00 >> 16)
/* 3398B0 E0024660 D4224D00 */  ldc1      $f2, (0xE0024D00 & 0xFFFF)($at)
/* 3398B4 E0024664 46000021 */  cvt.d.s   $f0, $f0
/* 3398B8 E0024668 46220002 */  mul.d     $f0, $f0, $f2
/* 3398BC E002466C 00000000 */  nop
/* 3398C0 E0024670 46200000 */  add.d     $f0, $f0, $f0
/* 3398C4 E0024674 4600D0A1 */  cvt.d.s   $f2, $f26
/* 3398C8 E0024678 46201081 */  sub.d     $f2, $f2, $f0
/* 3398CC E002467C 3C014248 */  lui       $at, (0x42480000 >> 16)
/* 3398D0 E0024680 44810000 */  mtc1      $at, $f0
/* 3398D4 E0024684 00000000 */  nop
/* 3398D8 E0024688 4600B581 */  sub.s     $f22, $f22, $f0
/* 3398DC E002468C 462016A0 */  cvt.s.d   $f26, $f2
.LE0024690:
/* 3398E0 E0024690 3C048080 */  lui       $a0, (0x80808081 >> 16)
/* 3398E4 E0024694 8EC30034 */  lw        $v1, 0x34($s6)
/* 3398E8 E0024698 34848081 */  ori       $a0, $a0, (0x80808081 & 0xFFFF)
/* 3398EC E002469C 00031040 */  sll       $v0, $v1, 1
/* 3398F0 E00246A0 00431021 */  addu      $v0, $v0, $v1
/* 3398F4 E00246A4 000210C0 */  sll       $v0, $v0, 3
/* 3398F8 E00246A8 00431021 */  addu      $v0, $v0, $v1
/* 3398FC E00246AC 00021080 */  sll       $v0, $v0, 2
/* 339900 E00246B0 00440018 */  mult      $v0, $a0
/* 339904 E00246B4 00004010 */  mfhi      $t0
/* 339908 E00246B8 01021821 */  addu      $v1, $t0, $v0
/* 33990C E00246BC 000319C3 */  sra       $v1, $v1, 7
/* 339910 E00246C0 000217C3 */  sra       $v0, $v0, 31
/* 339914 E00246C4 00621823 */  subu      $v1, $v1, $v0
/* 339918 E00246C8 AFA30080 */  sw        $v1, 0x80($sp)
.LE00246CC:
/* 33991C E00246CC C7A4007C */  lwc1      $f4, 0x7C($sp)
/* 339920 E00246D0 4405E000 */  mfc1      $a1, $f28
/* 339924 E00246D4 4406F000 */  mfc1      $a2, $f30
/* 339928 E00246D8 4407E000 */  mfc1      $a3, $f28
/* 33992C E00246DC E7A40010 */  swc1      $f4, 0x10($sp)
/* 339930 E00246E0 C7A40084 */  lwc1      $f4, 0x84($sp)
/* 339934 E00246E4 E7A40018 */  swc1      $f4, 0x18($sp)
/* 339938 E00246E8 C7A40088 */  lwc1      $f4, 0x88($sp)
/* 33993C E00246EC 27A40020 */  addiu     $a0, $sp, 0x20
/* 339940 E00246F0 E7BA0014 */  swc1      $f26, 0x14($sp)
/* 339944 E00246F4 0C080180 */  jal       shim_guPositionF
/* 339948 E00246F8 E7A4001C */   swc1     $f4, 0x1C($sp)
/* 33994C E00246FC 27A40020 */  addiu     $a0, $sp, 0x20
/* 339950 E0024700 97C50000 */  lhu       $a1, 0x0($fp)
/* 339954 E0024704 3C02800A */  lui       $v0, %hi(gDisplayContext)
/* 339958 E0024708 8C42A674 */  lw        $v0, %lo(gDisplayContext)($v0)
/* 33995C E002470C 8FA8008C */  lw        $t0, 0x8C($sp)
/* 339960 E0024710 00052980 */  sll       $a1, $a1, 6
/* 339964 E0024714 00A82821 */  addu      $a1, $a1, $t0
/* 339968 E0024718 0C080118 */  jal       shim_guMtxF2L
/* 33996C E002471C 00452821 */   addu     $a1, $v0, $a1
/* 339970 E0024720 8EA20000 */  lw        $v0, 0x0($s5)
/* 339974 E0024724 4600B306 */  mov.s     $f12, $f22
/* 339978 E0024728 0040202D */  daddu     $a0, $v0, $zero
/* 33997C E002472C 24420008 */  addiu     $v0, $v0, 0x8
/* 339980 E0024730 AEA20000 */  sw        $v0, 0x0($s5)
/* 339984 E0024734 97C20000 */  lhu       $v0, 0x0($fp)
/* 339988 E0024738 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 33998C E002473C AC830000 */  sw        $v1, 0x0($a0)
/* 339990 E0024740 24430001 */  addiu     $v1, $v0, 0x1
/* 339994 E0024744 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 339998 E0024748 00021180 */  sll       $v0, $v0, 6
/* 33999C E002474C A7C30000 */  sh        $v1, 0x0($fp)
/* 3399A0 E0024750 8FA8008C */  lw        $t0, 0x8C($sp)
/* 3399A4 E0024754 3C03800A */  lui       $v1, %hi(gDisplayContext)
/* 3399A8 E0024758 8C63A674 */  lw        $v1, %lo(gDisplayContext)($v1)
/* 3399AC E002475C 00481021 */  addu      $v0, $v0, $t0
/* 3399B0 E0024760 00621821 */  addu      $v1, $v1, $v0
/* 3399B4 E0024764 0C080140 */  jal       shim_sin_deg
/* 3399B8 E0024768 AC830004 */   sw       $v1, 0x4($a0)
/* 3399BC E002476C 46180502 */  mul.s     $f20, $f0, $f24
/* 3399C0 E0024770 00000000 */  nop
/* 3399C4 E0024774 0C080144 */  jal       shim_cos_deg
/* 3399C8 E0024778 4600B306 */   mov.s    $f12, $f22
/* 3399CC E002477C 46180002 */  mul.s     $f0, $f0, $f24
/* 3399D0 E0024780 00000000 */  nop
/* 3399D4 E0024784 27A40020 */  addiu     $a0, $sp, 0x20
/* 3399D8 E0024788 4407E000 */  mfc1      $a3, $f28
/* 3399DC E002478C 3C0142F0 */  lui       $at, (0x42F00000 >> 16)
/* 3399E0 E0024790 44812000 */  mtc1      $at, $f4
/* 3399E4 E0024794 44060000 */  mfc1      $a2, $f0
/* 3399E8 E0024798 4405A000 */  mfc1      $a1, $f20
/* 3399EC E002479C 0C080108 */  jal       shim_guTranslateF
/* 3399F0 E00247A0 4604B580 */   add.s    $f22, $f22, $f4
/* 3399F4 E00247A4 27A40020 */  addiu     $a0, $sp, 0x20
/* 3399F8 E00247A8 97C30000 */  lhu       $v1, 0x0($fp)
/* 3399FC E00247AC 3C05800A */  lui       $a1, %hi(gDisplayContext)
/* 339A00 E00247B0 8CA5A674 */  lw        $a1, %lo(gDisplayContext)($a1)
/* 339A04 E00247B4 8FA8008C */  lw        $t0, 0x8C($sp)
/* 339A08 E00247B8 3062FFFF */  andi      $v0, $v1, 0xFFFF
/* 339A0C E00247BC 00021180 */  sll       $v0, $v0, 6
/* 339A10 E00247C0 00481021 */  addu      $v0, $v0, $t0
/* 339A14 E00247C4 00A22821 */  addu      $a1, $a1, $v0
/* 339A18 E00247C8 24630001 */  addiu     $v1, $v1, 0x1
/* 339A1C E00247CC A7C30000 */  sh        $v1, 0x0($fp)
/* 339A20 E00247D0 0C080118 */  jal       shim_guMtxF2L
/* 339A24 E00247D4 AFA50060 */   sw       $a1, 0x60($sp)
/* 339A28 E00247D8 0C080140 */  jal       shim_sin_deg
/* 339A2C E00247DC 4600B306 */   mov.s    $f12, $f22
/* 339A30 E00247E0 46180502 */  mul.s     $f20, $f0, $f24
/* 339A34 E00247E4 00000000 */  nop
/* 339A38 E00247E8 0C080144 */  jal       shim_cos_deg
/* 339A3C E00247EC 4600B306 */   mov.s    $f12, $f22
/* 339A40 E00247F0 46180002 */  mul.s     $f0, $f0, $f24
/* 339A44 E00247F4 00000000 */  nop
/* 339A48 E00247F8 27A40020 */  addiu     $a0, $sp, 0x20
/* 339A4C E00247FC 4407E000 */  mfc1      $a3, $f28
/* 339A50 E0024800 3C0142F0 */  lui       $at, (0x42F00000 >> 16)
/* 339A54 E0024804 44812000 */  mtc1      $at, $f4
/* 339A58 E0024808 44060000 */  mfc1      $a2, $f0
/* 339A5C E002480C 4405A000 */  mfc1      $a1, $f20
/* 339A60 E0024810 0C080108 */  jal       shim_guTranslateF
/* 339A64 E0024814 4604B580 */   add.s    $f22, $f22, $f4
/* 339A68 E0024818 27A40020 */  addiu     $a0, $sp, 0x20
/* 339A6C E002481C 97C30000 */  lhu       $v1, 0x0($fp)
/* 339A70 E0024820 3C05800A */  lui       $a1, %hi(gDisplayContext)
/* 339A74 E0024824 8CA5A674 */  lw        $a1, %lo(gDisplayContext)($a1)
/* 339A78 E0024828 8FA8008C */  lw        $t0, 0x8C($sp)
/* 339A7C E002482C 3062FFFF */  andi      $v0, $v1, 0xFFFF
/* 339A80 E0024830 00021180 */  sll       $v0, $v0, 6
/* 339A84 E0024834 00481021 */  addu      $v0, $v0, $t0
/* 339A88 E0024838 00A22821 */  addu      $a1, $a1, $v0
/* 339A8C E002483C 24630001 */  addiu     $v1, $v1, 0x1
/* 339A90 E0024840 A7C30000 */  sh        $v1, 0x0($fp)
/* 339A94 E0024844 0C080118 */  jal       shim_guMtxF2L
/* 339A98 E0024848 AFA50064 */   sw       $a1, 0x64($sp)
/* 339A9C E002484C 0C080140 */  jal       shim_sin_deg
/* 339AA0 E0024850 4600B306 */   mov.s    $f12, $f22
/* 339AA4 E0024854 46180502 */  mul.s     $f20, $f0, $f24
/* 339AA8 E0024858 00000000 */  nop
/* 339AAC E002485C 0C080144 */  jal       shim_cos_deg
/* 339AB0 E0024860 4600B306 */   mov.s    $f12, $f22
/* 339AB4 E0024864 46180002 */  mul.s     $f0, $f0, $f24
/* 339AB8 E0024868 00000000 */  nop
/* 339ABC E002486C 0000A02D */  daddu     $s4, $zero, $zero
/* 339AC0 E0024870 3C13E002 */  lui       $s3, %hi(D_E0024CC0)
/* 339AC4 E0024874 26734CC0 */  addiu     $s3, $s3, %lo(D_E0024CC0)
/* 339AC8 E0024878 4407E000 */  mfc1      $a3, $f28
/* 339ACC E002487C 44060000 */  mfc1      $a2, $f0
/* 339AD0 E0024880 4405A000 */  mfc1      $a1, $f20
/* 339AD4 E0024884 0C080108 */  jal       shim_guTranslateF
/* 339AD8 E0024888 27A40020 */   addiu    $a0, $sp, 0x20
/* 339ADC E002488C 27A40020 */  addiu     $a0, $sp, 0x20
/* 339AE0 E0024890 97C30000 */  lhu       $v1, 0x0($fp)
/* 339AE4 E0024894 3C05800A */  lui       $a1, %hi(gDisplayContext)
/* 339AE8 E0024898 8CA5A674 */  lw        $a1, %lo(gDisplayContext)($a1)
/* 339AEC E002489C 8FA8008C */  lw        $t0, 0x8C($sp)
/* 339AF0 E00248A0 3062FFFF */  andi      $v0, $v1, 0xFFFF
/* 339AF4 E00248A4 00021180 */  sll       $v0, $v0, 6
/* 339AF8 E00248A8 00481021 */  addu      $v0, $v0, $t0
/* 339AFC E00248AC 00A22821 */  addu      $a1, $a1, $v0
/* 339B00 E00248B0 24630001 */  addiu     $v1, $v1, 0x1
/* 339B04 E00248B4 A7C30000 */  sh        $v1, 0x0($fp)
/* 339B08 E00248B8 0C080118 */  jal       shim_guMtxF2L
/* 339B0C E00248BC AFA50068 */   sw       $a1, 0x68($sp)
.LE00248C0:
/* 339B10 E00248C0 8EB20000 */  lw        $s2, 0x0($s5)
/* 339B14 E00248C4 3C02DA38 */  lui       $v0, (0xDA380000 >> 16)
/* 339B18 E00248C8 0240202D */  daddu     $a0, $s2, $zero
/* 339B1C E00248CC 26520008 */  addiu     $s2, $s2, 0x8
/* 339B20 E00248D0 AEB20000 */  sw        $s2, 0x0($s5)
/* 339B24 E00248D4 AC820000 */  sw        $v0, 0x0($a0)
/* 339B28 E00248D8 00141080 */  sll       $v0, $s4, 2
/* 339B2C E00248DC 03A21021 */  addu      $v0, $sp, $v0
/* 339B30 E00248E0 8C430060 */  lw        $v1, 0x60($v0)
/* 339B34 E00248E4 26420008 */  addiu     $v0, $s2, 0x8
/* 339B38 E00248E8 AEA20000 */  sw        $v0, 0x0($s5)
/* 339B3C E00248EC 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 339B40 E00248F0 AC830004 */  sw        $v1, 0x4($a0)
/* 339B44 E00248F4 AE420000 */  sw        $v0, 0x0($s2)
/* 339B48 E00248F8 92640001 */  lbu       $a0, 0x1($s3)
/* 339B4C E00248FC 0C0090EF */  jal       func_E00243BC
/* 339B50 E0024900 92650000 */   lbu      $a1, 0x0($s3)
/* 339B54 E0024904 92640002 */  lbu       $a0, 0x2($s3)
/* 339B58 E0024908 92650000 */  lbu       $a1, 0x0($s3)
/* 339B5C E002490C 0C0090EF */  jal       func_E00243BC
/* 339B60 E0024910 0040882D */   daddu    $s1, $v0, $zero
/* 339B64 E0024914 92640003 */  lbu       $a0, 0x3($s3)
/* 339B68 E0024918 92650000 */  lbu       $a1, 0x0($s3)
/* 339B6C E002491C 0C0090EF */  jal       func_E00243BC
/* 339B70 E0024920 0040802D */   daddu    $s0, $v0, $zero
/* 339B74 E0024924 00118E00 */  sll       $s1, $s1, 24
/* 339B78 E0024928 321000FF */  andi      $s0, $s0, 0xFF
/* 339B7C E002492C 00108400 */  sll       $s0, $s0, 16
/* 339B80 E0024930 02308825 */  or        $s1, $s1, $s0
/* 339B84 E0024934 304200FF */  andi      $v0, $v0, 0xFF
/* 339B88 E0024938 00021200 */  sll       $v0, $v0, 8
/* 339B8C E002493C 02228825 */  or        $s1, $s1, $v0
/* 339B90 E0024940 8FA80080 */  lw        $t0, 0x80($sp)
/* 339B94 E0024944 8EA30000 */  lw        $v1, 0x0($s5)
/* 339B98 E0024948 310200FF */  andi      $v0, $t0, 0xFF
/* 339B9C E002494C 02228825 */  or        $s1, $s1, $v0
/* 339BA0 E0024950 AE510004 */  sw        $s1, 0x4($s2)
/* 339BA4 E0024954 0060902D */  daddu     $s2, $v1, $zero
/* 339BA8 E0024958 24630008 */  addiu     $v1, $v1, 0x8
/* 339BAC E002495C 3C02FB00 */  lui       $v0, (0xFB000000 >> 16)
/* 339BB0 E0024960 AEA30000 */  sw        $v1, 0x0($s5)
/* 339BB4 E0024964 AE420000 */  sw        $v0, 0x0($s2)
/* 339BB8 E0024968 92640001 */  lbu       $a0, 0x1($s3)
/* 339BBC E002496C 0C0090C9 */  jal       func_E0024324
/* 339BC0 E0024970 92650000 */   lbu      $a1, 0x0($s3)
/* 339BC4 E0024974 92640002 */  lbu       $a0, 0x2($s3)
/* 339BC8 E0024978 92650000 */  lbu       $a1, 0x0($s3)
/* 339BCC E002497C 0C0090C9 */  jal       func_E0024324
/* 339BD0 E0024980 0040882D */   daddu    $s1, $v0, $zero
/* 339BD4 E0024984 92640003 */  lbu       $a0, 0x3($s3)
/* 339BD8 E0024988 92650000 */  lbu       $a1, 0x0($s3)
/* 339BDC E002498C 0C0090C9 */  jal       func_E0024324
/* 339BE0 E0024990 0040802D */   daddu    $s0, $v0, $zero
/* 339BE4 E0024994 00118E00 */  sll       $s1, $s1, 24
/* 339BE8 E0024998 321000FF */  andi      $s0, $s0, 0xFF
/* 339BEC E002499C 00108400 */  sll       $s0, $s0, 16
/* 339BF0 E00249A0 02308825 */  or        $s1, $s1, $s0
/* 339BF4 E00249A4 304200FF */  andi      $v0, $v0, 0xFF
/* 339BF8 E00249A8 00021200 */  sll       $v0, $v0, 8
/* 339BFC E00249AC 02228825 */  or        $s1, $s1, $v0
/* 339C00 E00249B0 363100FF */  ori       $s1, $s1, 0xFF
/* 339C04 E00249B4 8EA40000 */  lw        $a0, 0x0($s5)
/* 339C08 E00249B8 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 339C0C E00249BC AE510004 */  sw        $s1, 0x4($s2)
/* 339C10 E00249C0 0080182D */  daddu     $v1, $a0, $zero
/* 339C14 E00249C4 24840008 */  addiu     $a0, $a0, 0x8
/* 339C18 E00249C8 AEA40000 */  sw        $a0, 0x0($s5)
/* 339C1C E00249CC AC620000 */  sw        $v0, 0x0($v1)
/* 339C20 E00249D0 8FA80070 */  lw        $t0, 0x70($sp)
/* 339C24 E00249D4 15000004 */  bnez      $t0, .LE00249E8
/* 339C28 E00249D8 24630004 */   addiu    $v1, $v1, 0x4
/* 339C2C E00249DC 8E640004 */  lw        $a0, 0x4($s3)
/* 339C30 E00249E0 0800927C */  j         .LE00249F0
/* 339C34 E00249E4 3C05D838 */   lui      $a1, (0xD8380002 >> 16)
.LE00249E8:
/* 339C38 E00249E8 8E640008 */  lw        $a0, 0x8($s3)
/* 339C3C E00249EC 3C05D838 */  lui       $a1, (0xD8380002 >> 16)
.LE00249F0:
/* 339C40 E00249F0 34A50002 */  ori       $a1, $a1, (0xD8380002 & 0xFFFF)
/* 339C44 E00249F4 2673000C */  addiu     $s3, $s3, 0xC
/* 339C48 E00249F8 8EA20000 */  lw        $v0, 0x0($s5)
/* 339C4C E00249FC 26940001 */  addiu     $s4, $s4, 0x1
/* 339C50 E0024A00 AC640000 */  sw        $a0, 0x0($v1)
/* 339C54 E0024A04 24040040 */  addiu     $a0, $zero, 0x40
/* 339C58 E0024A08 0040182D */  daddu     $v1, $v0, $zero
/* 339C5C E0024A0C 24420008 */  addiu     $v0, $v0, 0x8
/* 339C60 E0024A10 AEA20000 */  sw        $v0, 0x0($s5)
/* 339C64 E0024A14 2A820003 */  slti      $v0, $s4, 0x3
/* 339C68 E0024A18 AC650000 */  sw        $a1, 0x0($v1)
/* 339C6C E0024A1C 1440FFA8 */  bnez      $v0, .LE00248C0
/* 339C70 E0024A20 AC640004 */   sw       $a0, 0x4($v1)
/* 339C74 E0024A24 8EA20000 */  lw        $v0, 0x0($s5)
/* 339C78 E0024A28 26F70001 */  addiu     $s7, $s7, 0x1
/* 339C7C E0024A2C 0040182D */  daddu     $v1, $v0, $zero
/* 339C80 E0024A30 24420008 */  addiu     $v0, $v0, 0x8
/* 339C84 E0024A34 AEA20000 */  sw        $v0, 0x0($s5)
/* 339C88 E0024A38 2AE20003 */  slti      $v0, $s7, 0x3
/* 339C8C E0024A3C AC650000 */  sw        $a1, 0x0($v1)
/* 339C90 E0024A40 1440FEEE */  bnez      $v0, .LE00245FC
/* 339C94 E0024A44 AC640004 */   sw       $a0, 0x4($v1)
/* 339C98 E0024A48 3C02800A */  lui       $v0, %hi(gMainGfxPos)
/* 339C9C E0024A4C 2442A66C */  addiu     $v0, $v0, %lo(gMainGfxPos)
/* 339CA0 E0024A50 8C430000 */  lw        $v1, 0x0($v0)
/* 339CA4 E0024A54 0060202D */  daddu     $a0, $v1, $zero
/* 339CA8 E0024A58 24630008 */  addiu     $v1, $v1, 0x8
/* 339CAC E0024A5C AC430000 */  sw        $v1, 0x0($v0)
/* 339CB0 E0024A60 3C02DF00 */  lui       $v0, (0xDF000000 >> 16)
/* 339CB4 E0024A64 AC820000 */  sw        $v0, 0x0($a0)
/* 339CB8 E0024A68 AC800004 */  sw        $zero, 0x4($a0)
/* 339CBC E0024A6C 8FA80078 */  lw        $t0, 0x78($sp)
/* 339CC0 E0024A70 3C02DE01 */  lui       $v0, (0xDE010000 >> 16)
/* 339CC4 E0024A74 AD020000 */  sw        $v0, 0x0($t0)
/* 339CC8 E0024A78 AD030004 */  sw        $v1, 0x4($t0)
/* 339CCC E0024A7C 8FA80070 */  lw        $t0, 0x70($sp)
/* 339CD0 E0024A80 15000004 */  bnez      $t0, .LE0024A94
/* 339CD4 E0024A84 00000000 */   nop
/* 339CD8 E0024A88 4480F000 */  mtc1      $zero, $f30
/* 339CDC E0024A8C 080092B2 */  j         .LE0024AC8
/* 339CE0 E0024A90 00000000 */   nop
.LE0024A94:
/* 339CE4 E0024A94 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 339CE8 E0024A98 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 339CEC E0024A9C 00031080 */  sll       $v0, $v1, 2
/* 339CF0 E0024AA0 00431021 */  addu      $v0, $v0, $v1
/* 339CF4 E0024AA4 00021080 */  sll       $v0, $v0, 2
/* 339CF8 E0024AA8 00431023 */  subu      $v0, $v0, $v1
/* 339CFC E0024AAC 000218C0 */  sll       $v1, $v0, 3
/* 339D00 E0024AB0 00431021 */  addu      $v0, $v0, $v1
/* 339D04 E0024AB4 000210C0 */  sll       $v0, $v0, 3
/* 339D08 E0024AB8 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 339D0C E0024ABC 00220821 */  addu      $at, $at, $v0
/* 339D10 E0024AC0 C4201DEC */  lwc1      $f0, %lo(gCameras + 0x6C)($at)
/* 339D14 E0024AC4 46000787 */  neg.s     $f30, $f0
.LE0024AC8:
/* 339D18 E0024AC8 4480A000 */  mtc1      $zero, $f20
/* 339D1C E0024ACC 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 339D20 E0024AD0 4481B000 */  mtc1      $at, $f22
/* 339D24 E0024AD4 4406F000 */  mfc1      $a2, $f30
/* 339D28 E0024AD8 4405A000 */  mfc1      $a1, $f20
/* 339D2C E0024ADC 4407A000 */  mfc1      $a3, $f20
/* 339D30 E0024AE0 E7B60010 */  swc1      $f22, 0x10($sp)
/* 339D34 E0024AE4 C6C00004 */  lwc1      $f0, 0x4($s6)
/* 339D38 E0024AE8 27A40020 */  addiu     $a0, $sp, 0x20
/* 339D3C E0024AEC E7A00014 */  swc1      $f0, 0x14($sp)
/* 339D40 E0024AF0 C6C00008 */  lwc1      $f0, 0x8($s6)
/* 339D44 E0024AF4 3C100001 */  lui       $s0, (0x11630 >> 16)
/* 339D48 E0024AF8 E7A00018 */  swc1      $f0, 0x18($sp)
/* 339D4C E0024AFC C6C0000C */  lwc1      $f0, 0xC($s6)
/* 339D50 E0024B00 36101630 */  ori       $s0, $s0, (0x11630 & 0xFFFF)
/* 339D54 E0024B04 0C080180 */  jal       shim_guPositionF
/* 339D58 E0024B08 E7A0001C */   swc1     $f0, 0x1C($sp)
/* 339D5C E0024B0C 27A40020 */  addiu     $a0, $sp, 0x20
/* 339D60 E0024B10 3C118007 */  lui       $s1, %hi(gMatrixListPos)
/* 339D64 E0024B14 263141F0 */  addiu     $s1, $s1, %lo(gMatrixListPos)
/* 339D68 E0024B18 3C13800A */  lui       $s3, %hi(gDisplayContext)
/* 339D6C E0024B1C 2673A674 */  addiu     $s3, $s3, %lo(gDisplayContext)
/* 339D70 E0024B20 96250000 */  lhu       $a1, 0x0($s1)
/* 339D74 E0024B24 8E620000 */  lw        $v0, 0x0($s3)
/* 339D78 E0024B28 00052980 */  sll       $a1, $a1, 6
/* 339D7C E0024B2C 00B02821 */  addu      $a1, $a1, $s0
/* 339D80 E0024B30 0C080118 */  jal       shim_guMtxF2L
/* 339D84 E0024B34 00452821 */   addu     $a1, $v0, $a1
/* 339D88 E0024B38 3C12800A */  lui       $s2, %hi(gMainGfxPos)
/* 339D8C E0024B3C 2652A66C */  addiu     $s2, $s2, %lo(gMainGfxPos)
/* 339D90 E0024B40 8E450000 */  lw        $a1, 0x0($s2)
/* 339D94 E0024B44 00A0202D */  daddu     $a0, $a1, $zero
/* 339D98 E0024B48 24A50008 */  addiu     $a1, $a1, 0x8
/* 339D9C E0024B4C AE450000 */  sw        $a1, 0x0($s2)
/* 339DA0 E0024B50 96220000 */  lhu       $v0, 0x0($s1)
/* 339DA4 E0024B54 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 339DA8 E0024B58 AC830000 */  sw        $v1, 0x0($a0)
/* 339DAC E0024B5C 24430001 */  addiu     $v1, $v0, 0x1
/* 339DB0 E0024B60 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 339DB4 E0024B64 00021180 */  sll       $v0, $v0, 6
/* 339DB8 E0024B68 A6230000 */  sh        $v1, 0x0($s1)
/* 339DBC E0024B6C 8E630000 */  lw        $v1, 0x0($s3)
/* 339DC0 E0024B70 00501021 */  addu      $v0, $v0, $s0
/* 339DC4 E0024B74 00621821 */  addu      $v1, $v1, $v0
/* 339DC8 E0024B78 AC830004 */  sw        $v1, 0x4($a0)
/* 339DCC E0024B7C 8FA80070 */  lw        $t0, 0x70($sp)
/* 339DD0 E0024B80 15000008 */  bnez      $t0, .LE0024BA4
/* 339DD4 E0024B84 27A40020 */   addiu    $a0, $sp, 0x20
/* 339DD8 E0024B88 24A20008 */  addiu     $v0, $a1, 0x8
/* 339DDC E0024B8C AE420000 */  sw        $v0, 0x0($s2)
/* 339DE0 E0024B90 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 339DE4 E0024B94 ACA20000 */  sw        $v0, 0x0($a1)
/* 339DE8 E0024B98 8FA80074 */  lw        $t0, 0x74($sp)
/* 339DEC E0024B9C 0800930C */  j         .LE0024C30
/* 339DF0 E0024BA0 ACA80004 */   sw       $t0, 0x4($a1)
.LE0024BA4:
/* 339DF4 E0024BA4 3C0541F0 */  lui       $a1, (0x41F00000 >> 16)
/* 339DF8 E0024BA8 4406A000 */  mfc1      $a2, $f20
/* 339DFC E0024BAC 0000B82D */  daddu     $s7, $zero, $zero
/* 339E00 E0024BB0 E7B60010 */  swc1      $f22, 0x10($sp)
/* 339E04 E0024BB4 0C080104 */  jal       shim_guRotateF
/* 339E08 E0024BB8 00C0382D */   daddu    $a3, $a2, $zero
/* 339E0C E0024BBC 27A40020 */  addiu     $a0, $sp, 0x20
/* 339E10 E0024BC0 96220000 */  lhu       $v0, 0x0($s1)
/* 339E14 E0024BC4 8E650000 */  lw        $a1, 0x0($s3)
/* 339E18 E0024BC8 3043FFFF */  andi      $v1, $v0, 0xFFFF
/* 339E1C E0024BCC 00031980 */  sll       $v1, $v1, 6
/* 339E20 E0024BD0 00701821 */  addu      $v1, $v1, $s0
/* 339E24 E0024BD4 00A38021 */  addu      $s0, $a1, $v1
/* 339E28 E0024BD8 0200282D */  daddu     $a1, $s0, $zero
/* 339E2C E0024BDC 24420001 */  addiu     $v0, $v0, 0x1
/* 339E30 E0024BE0 0C080118 */  jal       shim_guMtxF2L
/* 339E34 E0024BE4 A6220000 */   sh       $v0, 0x0($s1)
/* 339E38 E0024BE8 0240202D */  daddu     $a0, $s2, $zero
/* 339E3C E0024BEC 3C05DA38 */  lui       $a1, (0xDA380001 >> 16)
/* 339E40 E0024BF0 34A50001 */  ori       $a1, $a1, (0xDA380001 & 0xFFFF)
/* 339E44 E0024BF4 3C06DE00 */  lui       $a2, (0xDE000000 >> 16)
.LE0024BF8:
/* 339E48 E0024BF8 8C830000 */  lw        $v1, 0x0($a0)
/* 339E4C E0024BFC 26F70001 */  addiu     $s7, $s7, 0x1
/* 339E50 E0024C00 0060102D */  daddu     $v0, $v1, $zero
/* 339E54 E0024C04 24630008 */  addiu     $v1, $v1, 0x8
/* 339E58 E0024C08 AC830000 */  sw        $v1, 0x0($a0)
/* 339E5C E0024C0C AC450000 */  sw        $a1, 0x0($v0)
/* 339E60 E0024C10 AC500004 */  sw        $s0, 0x4($v0)
/* 339E64 E0024C14 24620008 */  addiu     $v0, $v1, 0x8
/* 339E68 E0024C18 AC820000 */  sw        $v0, 0x0($a0)
/* 339E6C E0024C1C AC660000 */  sw        $a2, 0x0($v1)
/* 339E70 E0024C20 8FA80074 */  lw        $t0, 0x74($sp)
/* 339E74 E0024C24 2AE2000C */  slti      $v0, $s7, 0xC
/* 339E78 E0024C28 1440FFF3 */  bnez      $v0, .LE0024BF8
/* 339E7C E0024C2C AC680004 */   sw       $t0, 0x4($v1)
.LE0024C30:
/* 339E80 E0024C30 3C03D838 */  lui       $v1, (0xD8380002 >> 16)
/* 339E84 E0024C34 3C04800A */  lui       $a0, %hi(gMainGfxPos)
/* 339E88 E0024C38 2484A66C */  addiu     $a0, $a0, %lo(gMainGfxPos)
/* 339E8C E0024C3C 8C820000 */  lw        $v0, 0x0($a0)
/* 339E90 E0024C40 34630002 */  ori       $v1, $v1, (0xD8380002 & 0xFFFF)
/* 339E94 E0024C44 0040282D */  daddu     $a1, $v0, $zero
/* 339E98 E0024C48 24420008 */  addiu     $v0, $v0, 0x8
/* 339E9C E0024C4C AC820000 */  sw        $v0, 0x0($a0)
/* 339EA0 E0024C50 ACA30000 */  sw        $v1, 0x0($a1)
/* 339EA4 E0024C54 24030040 */  addiu     $v1, $zero, 0x40
/* 339EA8 E0024C58 ACA30004 */  sw        $v1, 0x4($a1)
/* 339EAC E0024C5C 24430008 */  addiu     $v1, $v0, 0x8
/* 339EB0 E0024C60 AC830000 */  sw        $v1, 0x0($a0)
/* 339EB4 E0024C64 3C03E700 */  lui       $v1, (0xE7000000 >> 16)
/* 339EB8 E0024C68 AC430000 */  sw        $v1, 0x0($v0)
/* 339EBC E0024C6C AC400004 */  sw        $zero, 0x4($v0)
/* 339EC0 E0024C70 8FBF00B4 */  lw        $ra, 0xB4($sp)
/* 339EC4 E0024C74 8FBE00B0 */  lw        $fp, 0xB0($sp)
/* 339EC8 E0024C78 8FB700AC */  lw        $s7, 0xAC($sp)
/* 339ECC E0024C7C 8FB600A8 */  lw        $s6, 0xA8($sp)
/* 339ED0 E0024C80 8FB500A4 */  lw        $s5, 0xA4($sp)
/* 339ED4 E0024C84 8FB400A0 */  lw        $s4, 0xA0($sp)
/* 339ED8 E0024C88 8FB3009C */  lw        $s3, 0x9C($sp)
/* 339EDC E0024C8C 8FB20098 */  lw        $s2, 0x98($sp)
/* 339EE0 E0024C90 8FB10094 */  lw        $s1, 0x94($sp)
/* 339EE4 E0024C94 8FB00090 */  lw        $s0, 0x90($sp)
/* 339EE8 E0024C98 D7BE00E0 */  ldc1      $f30, 0xE0($sp)
/* 339EEC E0024C9C D7BC00D8 */  ldc1      $f28, 0xD8($sp)
/* 339EF0 E0024CA0 D7BA00D0 */  ldc1      $f26, 0xD0($sp)
/* 339EF4 E0024CA4 D7B800C8 */  ldc1      $f24, 0xC8($sp)
/* 339EF8 E0024CA8 D7B600C0 */  ldc1      $f22, 0xC0($sp)
/* 339EFC E0024CAC D7B400B8 */  ldc1      $f20, 0xB8($sp)
/* 339F00 E0024CB0 03E00008 */  jr        $ra
/* 339F04 E0024CB4 27BD00E8 */   addiu    $sp, $sp, 0xE8
/* 339F08 E0024CB8 00000000 */  nop
/* 339F0C E0024CBC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void shape_spell_appendGfx(void* effect) {
    ShapeSpellFXData* data = ((EffectInstance*)effect)->data.shapeSpell;
    s32 isChild;
    Gfx* savedGfxPos2;
    Gfx* savedGfxPos;
    f32 unk_28 = data->unk_28;
    s32 primA;
    f32 unk_10;
    f32 unk_14;
    f32 unk_18;
    f32 angle;
    f32 factor;
    f32 var_f30;
    s32 timeLeft;
    Matrix4f sp20;
    Mtx* sp60[3];
    Mtx* mtx;
    s32 i;
    s32 j;

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

    savedGfxPos = gMainGfxPos++;
    savedGfxPos2 = gMainGfxPos;
    isChild = data->isChild;
    primA = data->unk_34;
    unk_10 = data->unk_10;
    unk_14 = data->unk_14;
    unk_18 = data->unk_18;
    timeLeft = data->timeLeft;

    if (isChild == 0) {
        angle = timeLeft * 35;
        factor = 9.0f;
        var_f30 = -gCameras[gCurrentCameraID].currentYaw;
    } else {
        angle = timeLeft * 25;
        factor = 6.0f;
        var_f30 = 0.0f;
        unk_10 *= unk_28;
    }

    for (i = 0; i < 3; i++) {
        if (i > 0) {
            if (!isChild) {
                angle -= 70.0f;
                unk_10 -= 2.0f * data->unk_1C;
                unk_14 -= 2.0f * data->unk_20;
                unk_18 -= 2.0f * data->unk_24;
            } else {
                angle -= 50.0f;
                unk_10 -= data->unk_1C * (100.0 / 83) * 2.0;
            }
            primA = data->unk_34 * 100 / 255;
        }

        shim_guPositionF(sp20, 0.0f, var_f30, 0.0f, unk_28, unk_10, unk_14, unk_18);
        shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);

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

        shim_guTranslateF(sp20,
            shim_sin_deg(angle) * factor,
            shim_cos_deg(angle) * factor, 0.0f);

        angle += 120.0f;
        sp60[0] = &gDisplayContext->matrixStack[gMatrixListPos++];

        shim_guMtxF2L(sp20, sp60[0]);
        shim_guTranslateF(sp20,
            shim_sin_deg(angle) * factor,
            shim_cos_deg(angle) * factor, 0.0f);

        angle += 120.0f;
        sp60[1] = &gDisplayContext->matrixStack[gMatrixListPos++];

        shim_guMtxF2L(sp20, sp60[1]);
        shim_guTranslateF(sp20,
            shim_sin_deg(angle) * factor,
            shim_cos_deg(angle) * factor, 0.0f);

        sp60[2] = &gDisplayContext->matrixStack[gMatrixListPos++];

        shim_guMtxF2L(sp20, sp60[2]);

        for (j = 0; j < 3; j++) {
            gSPMatrix(gMainGfxPos++, sp60[j], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
            gDPSetPrimColor(gMainGfxPos++, 0, 0,
                func_E00243BC(D_E0024CC0[j].unk_01, D_E0024CC0[j].unk_00),
                func_E00243BC(D_E0024CC0[j].unk_02, D_E0024CC0[j].unk_00),
                func_E00243BC(D_E0024CC0[j].unk_03, D_E0024CC0[j].unk_00),
                primA);
            gDPSetEnvColor(gMainGfxPos++,
                func_E0024324(D_E0024CC0[j].unk_01, D_E0024CC0[j].unk_00),
                func_E0024324(D_E0024CC0[j].unk_02, D_E0024CC0[j].unk_00),
                func_E0024324(D_E0024CC0[j].unk_03, D_E0024CC0[j].unk_00),
                255);
            gSPDisplayList(gMainGfxPos++, !isChild ?
                D_E0024CC0[j].unk_04 : D_E0024CC0[j].unk_08);
            gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
        }

        gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    }

    gSPEndDisplayList(gMainGfxPos++);
    gSPBranchList(savedGfxPos, gMainGfxPos);

    if (!isChild) {
        var_f30 = 0.0f;
    } else {
        var_f30 = -gCameras[gCurrentCameraID].currentYaw;
    }

    shim_guPositionF(sp20, 0.0f, var_f30, 0.0f, 1.0f, data->pos.x, data->pos.y, data->pos.z);
    shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);

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

    if (!isChild) {
        gSPDisplayList(gMainGfxPos++, savedGfxPos2);
    } else {
        shim_guRotateF(sp20, 30.0f, 0.0f, 0.0f, 1.0f);

        mtx = &gDisplayContext->matrixStack[gMatrixListPos++];
        shim_guMtxF2L(sp20, mtx);

        for (i = 0; i < 12; i++) {
            gSPMatrix(gMainGfxPos++, mtx, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
            gSPDisplayList(gMainGfxPos++, savedGfxPos2);
        }
    }

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


### RAW ASSEMBLY INSTRUCTIONS:

glabel npc_follow_npc
/* 3952C 8005E12C 27BDFF98 */  addiu     $sp, $sp, -0x68
/* 39530 8005E130 AFB20040 */  sw        $s2, 0x40($sp)
/* 39534 8005E134 0080902D */  daddu     $s2, $a0, $zero
/* 39538 8005E138 27A50018 */  addiu     $a1, $sp, 0x18
/* 3953C 8005E13C 27A6001C */  addiu     $a2, $sp, 0x1C
/* 39540 8005E140 AFBF0044 */  sw        $ra, 0x44($sp)
/* 39544 8005E144 AFB1003C */  sw        $s1, 0x3C($sp)
/* 39548 8005E148 AFB00038 */  sw        $s0, 0x38($sp)
/* 3954C 8005E14C F7BA0060 */  sdc1      $f26, 0x60($sp)
/* 39550 8005E150 F7B80058 */  sdc1      $f24, 0x58($sp)
/* 39554 8005E154 F7B60050 */  sdc1      $f22, 0x50($sp)
/* 39558 8005E158 F7B40048 */  sdc1      $f20, 0x48($sp)
/* 3955C 8005E15C 8E510020 */  lw        $s1, 0x20($s2)
/* 39560 8005E160 27A20024 */  addiu     $v0, $sp, 0x24
/* 39564 8005E164 AFA20010 */  sw        $v0, 0x10($sp)
/* 39568 8005E168 8E24028C */  lw        $a0, 0x28C($s1)
/* 3956C 8005E16C 0C017784 */  jal       get_npc_pos
/* 39570 8005E170 27A70020 */   addiu    $a3, $sp, 0x20
/* 39574 8005E174 8E230288 */  lw        $v1, 0x288($s1)
/* 39578 8005E178 24020001 */  addiu     $v0, $zero, 0x1
/* 3957C 8005E17C 106200A4 */  beq       $v1, $v0, .L8005E410
/* 39580 8005E180 28620002 */   slti     $v0, $v1, 0x2
/* 39584 8005E184 50400005 */  beql      $v0, $zero, .L8005E19C
/* 39588 8005E188 24020002 */   addiu    $v0, $zero, 0x2
/* 3958C 8005E18C 10600015 */  beqz      $v1, .L8005E1E4
/* 39590 8005E190 00000000 */   nop
/* 39594 8005E194 08017A20 */  j         .L8005E880
/* 39598 8005E198 00000000 */   nop
.L8005E19C:
/* 3959C 8005E19C 10620104 */  beq       $v1, $v0, .L8005E5B0
/* 395A0 8005E1A0 2402000A */   addiu    $v0, $zero, 0xA
/* 395A4 8005E1A4 1062014C */  beq       $v1, $v0, .L8005E6D8
/* 395A8 8005E1A8 00000000 */   nop
/* 395AC 8005E1AC 08017A20 */  j         .L8005E880
/* 395B0 8005E1B0 00000000 */   nop
.L8005E1B4:
/* 395B4 8005E1B4 8E220290 */  lw        $v0, 0x290($s1)
/* 395B8 8005E1B8 C658000C */  lwc1      $f24, 0xC($s2)
/* 395BC 8005E1BC 8C420010 */  lw        $v0, 0x10($v0)
/* 395C0 8005E1C0 080178ED */  j         .L8005E3B4
/* 395C4 8005E1C4 AE420028 */   sw       $v0, 0x28($s2)
.L8005E1C8:
/* 395C8 8005E1C8 AE400018 */  sw        $zero, 0x18($s2)
/* 395CC 8005E1CC 8E220290 */  lw        $v0, 0x290($s1)
/* 395D0 8005E1D0 C658000C */  lwc1      $f24, 0xC($s2)
/* 395D4 8005E1D4 8C420010 */  lw        $v0, 0x10($v0)
/* 395D8 8005E1D8 AE420028 */  sw        $v0, 0x28($s2)
/* 395DC 8005E1DC 080178EC */  j         .L8005E3B0
/* 395E0 8005E1E0 2402000A */   addiu    $v0, $zero, 0xA
.L8005E1E4:
/* 395E4 8005E1E4 C64C0038 */  lwc1      $f12, 0x38($s2)
/* 395E8 8005E1E8 C64E0040 */  lwc1      $f14, 0x40($s2)
/* 395EC 8005E1EC 8FA60018 */  lw        $a2, 0x18($sp)
/* 395F0 8005E1F0 8E220284 */  lw        $v0, 0x284($s1)
/* 395F4 8005E1F4 8FA70020 */  lw        $a3, 0x20($sp)
/* 395F8 8005E1F8 C642003C */  lwc1      $f2, 0x3C($s2)
/* 395FC 8005E1FC C6260294 */  lwc1      $f6, 0x294($s1)
/* 39600 8005E200 00021100 */  sll       $v0, $v0, 4
/* 39604 8005E204 02228021 */  addu      $s0, $s1, $v0
/* 39608 8005E208 46006006 */  mov.s     $f0, $f12
/* 3960C 8005E20C C6160004 */  lwc1      $f22, 0x4($s0)
/* 39610 8005E210 C614000C */  lwc1      $f20, 0xC($s0)
/* 39614 8005E214 46007106 */  mov.s     $f4, $f14
/* 39618 8005E218 E7A00028 */  swc1      $f0, 0x28($sp)
/* 3961C 8005E21C E7A2002C */  swc1      $f2, 0x2C($sp)
/* 39620 8005E220 E7A40030 */  swc1      $f4, 0x30($sp)
/* 39624 8005E224 0C00A7B5 */  jal       dist2D
/* 39628 8005E228 E6460018 */   swc1     $f6, 0x18($s2)
/* 3962C 8005E22C C62202A0 */  lwc1      $f2, 0x2A0($s1)
/* 39630 8005E230 4600103E */  c.le.s    $f2, $f0
/* 39634 8005E234 00000000 */  nop
/* 39638 8005E238 45000003 */  bc1f      .L8005E248
/* 3963C 8005E23C E7A00034 */   swc1     $f0, 0x34($sp)
/* 39640 8005E240 C6200298 */  lwc1      $f0, 0x298($s1)
/* 39644 8005E244 E6400018 */  swc1      $f0, 0x18($s2)
.L8005E248:
/* 39648 8005E248 8E220290 */  lw        $v0, 0x290($s1)
/* 3964C 8005E24C 8C430014 */  lw        $v1, 0x14($v0)
/* 39650 8005E250 8E420000 */  lw        $v0, 0x0($s2)
/* 39654 8005E254 30421000 */  andi      $v0, $v0, 0x1000
/* 39658 8005E258 14400004 */  bnez      $v0, .L8005E26C
/* 3965C 8005E25C AE430028 */   sw       $v1, 0x28($s2)
/* 39660 8005E260 8E220290 */  lw        $v0, 0x290($s1)
/* 39664 8005E264 8C420008 */  lw        $v0, 0x8($v0)
/* 39668 8005E268 AE420028 */  sw        $v0, 0x28($s2)
.L8005E26C:
/* 3966C 8005E26C C7AC0028 */  lwc1      $f12, 0x28($sp)
/* 39670 8005E270 C7AE0030 */  lwc1      $f14, 0x30($sp)
/* 39674 8005E274 4406B000 */  mfc1      $a2, $f22
/* 39678 8005E278 4407A000 */  mfc1      $a3, $f20
/* 3967C 8005E27C 0C00A7B5 */  jal       dist2D
/* 39680 8005E280 00000000 */   nop
/* 39684 8005E284 C7AC0028 */  lwc1      $f12, 0x28($sp)
/* 39688 8005E288 C7AE0030 */  lwc1      $f14, 0x30($sp)
/* 3968C 8005E28C 4406B000 */  mfc1      $a2, $f22
/* 39690 8005E290 4407A000 */  mfc1      $a3, $f20
/* 39694 8005E294 0C00A720 */  jal       atan2
/* 39698 8005E298 E7A00034 */   swc1     $f0, 0x34($sp)
/* 3969C 8005E29C C6440018 */  lwc1      $f4, 0x18($s2)
/* 396A0 8005E2A0 C7A20034 */  lwc1      $f2, 0x34($sp)
/* 396A4 8005E2A4 4602203C */  c.lt.s    $f4, $f2
/* 396A8 8005E2A8 00000000 */  nop
/* 396AC 8005E2AC 45000020 */  bc1f      .L8005E330
/* 396B0 8005E2B0 46000606 */   mov.s    $f24, $f0
/* 396B4 8005E2B4 C7AC0028 */  lwc1      $f12, 0x28($sp)
/* 396B8 8005E2B8 C7AE0030 */  lwc1      $f14, 0x30($sp)
/* 396BC 8005E2BC 8FA60018 */  lw        $a2, 0x18($sp)
/* 396C0 8005E2C0 0C00A7B5 */  jal       dist2D
/* 396C4 8005E2C4 8FA70020 */   lw       $a3, 0x20($sp)
/* 396C8 8005E2C8 E7A00034 */  swc1      $f0, 0x34($sp)
/* 396CC 8005E2CC C62202A0 */  lwc1      $f2, 0x2A0($s1)
/* 396D0 8005E2D0 4600103C */  c.lt.s    $f2, $f0
/* 396D4 8005E2D4 00000000 */  nop
/* 396D8 8005E2D8 45010036 */  bc1t      .L8005E3B4
/* 396DC 8005E2DC 00000000 */   nop
/* 396E0 8005E2E0 C622029C */  lwc1      $f2, 0x29C($s1)
/* 396E4 8005E2E4 4600103C */  c.lt.s    $f2, $f0
/* 396E8 8005E2E8 00000000 */  nop
/* 396EC 8005E2EC 45000010 */  bc1f      .L8005E330
/* 396F0 8005E2F0 00000000 */   nop
/* 396F4 8005E2F4 46020001 */  sub.s     $f0, $f0, $f2
/* 396F8 8005E2F8 E6400018 */  swc1      $f0, 0x18($s2)
/* 396FC 8005E2FC C6220294 */  lwc1      $f2, 0x294($s1)
/* 39700 8005E300 4600103C */  c.lt.s    $f2, $f0
/* 39704 8005E304 00000000 */  nop
/* 39708 8005E308 4503002A */  bc1tl     .L8005E3B4
/* 3970C 8005E30C E6420018 */   swc1     $f2, 0x18($s2)
/* 39710 8005E310 3C013FF0 */  lui       $at, (0x3FF00000 >> 16)
/* 39714 8005E314 44811800 */  mtc1      $at, $f3
/* 39718 8005E318 44801000 */  mtc1      $zero, $f2
/* 3971C 8005E31C 46000021 */  cvt.d.s   $f0, $f0
/* 39720 8005E320 46220000 */  add.d     $f0, $f0, $f2
/* 39724 8005E324 46200020 */  cvt.s.d   $f0, $f0
/* 39728 8005E328 080178ED */  j         .L8005E3B4
/* 3972C 8005E32C E6400018 */   swc1     $f0, 0x18($s2)
.L8005E330:
/* 39730 8005E330 8E230284 */  lw        $v1, 0x284($s1)
/* 39734 8005E334 8E220280 */  lw        $v0, 0x280($s1)
/* 39738 8005E338 5062FF9E */  beql      $v1, $v0, .L8005E1B4
/* 3973C 8005E33C AE400018 */   sw       $zero, 0x18($s2)
/* 39740 8005E340 C64C0038 */  lwc1      $f12, 0x38($s2)
/* 39744 8005E344 C64E0040 */  lwc1      $f14, 0x40($s2)
/* 39748 8005E348 8FA60018 */  lw        $a2, 0x18($sp)
/* 3974C 8005E34C 0C00A7B5 */  jal       dist2D
/* 39750 8005E350 8FA70020 */   lw       $a3, 0x20($sp)
/* 39754 8005E354 C622029C */  lwc1      $f2, 0x29C($s1)
/* 39758 8005E358 4602003E */  c.le.s    $f0, $f2
/* 3975C 8005E35C 00000000 */  nop
/* 39760 8005E360 4501FF99 */  bc1t      .L8005E1C8
/* 39764 8005E364 E7A00034 */   swc1     $f0, 0x34($sp)
/* 39768 8005E368 8E220284 */  lw        $v0, 0x284($s1)
/* 3976C 8005E36C 24420001 */  addiu     $v0, $v0, 0x1
/* 39770 8005E370 AE220284 */  sw        $v0, 0x284($s1)
/* 39774 8005E374 28420028 */  slti      $v0, $v0, 0x28
/* 39778 8005E378 50400001 */  beql      $v0, $zero, .L8005E380
/* 3977C 8005E37C AE200284 */   sw       $zero, 0x284($s1)
.L8005E380:
/* 39780 8005E380 8E220284 */  lw        $v0, 0x284($s1)
/* 39784 8005E384 00021100 */  sll       $v0, $v0, 4
/* 39788 8005E388 02228021 */  addu      $s0, $s1, $v0
/* 3978C 8005E38C C6160004 */  lwc1      $f22, 0x4($s0)
/* 39790 8005E390 8E420000 */  lw        $v0, 0x0($s2)
/* 39794 8005E394 C614000C */  lwc1      $f20, 0xC($s0)
/* 39798 8005E398 30421000 */  andi      $v0, $v0, 0x1000
/* 3979C 8005E39C 1040FFB3 */  beqz      $v0, .L8005E26C
/* 397A0 8005E3A0 00000000 */   nop
/* 397A4 8005E3A4 82020000 */  lb        $v0, 0x0($s0)
/* 397A8 8005E3A8 1040FFB0 */  beqz      $v0, .L8005E26C
/* 397AC 8005E3AC 24020001 */   addiu    $v0, $zero, 0x1
.L8005E3B0:
/* 397B0 8005E3B0 AE220288 */  sw        $v0, 0x288($s1)
.L8005E3B4:
/* 397B4 8005E3B4 8E420000 */  lw        $v0, 0x0($s2)
/* 397B8 8005E3B8 30421000 */  andi      $v0, $v0, 0x1000
/* 397BC 8005E3BC 14400008 */  bnez      $v0, .L8005E3E0
/* 397C0 8005E3C0 00000000 */   nop
/* 397C4 8005E3C4 C6400018 */  lwc1      $f0, 0x18($s2)
/* 397C8 8005E3C8 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* 397CC 8005E3CC 44811000 */  mtc1      $at, $f2
/* 397D0 8005E3D0 00000000 */  nop
/* 397D4 8005E3D4 46020002 */  mul.s     $f0, $f0, $f2
/* 397D8 8005E3D8 00000000 */  nop
/* 397DC 8005E3DC E6400018 */  swc1      $f0, 0x18($s2)
.L8005E3E0:
/* 397E0 8005E3E0 8E450018 */  lw        $a1, 0x18($s2)
/* 397E4 8005E3E4 4406C000 */  mfc1      $a2, $f24
/* 397E8 8005E3E8 0240202D */  daddu     $a0, $s2, $zero
/* 397EC 8005E3EC 0C00EA95 */  jal       npc_move_heading
/* 397F0 8005E3F0 AE46000C */   sw       $a2, 0xC($s2)
/* 397F4 8005E3F4 8E420000 */  lw        $v0, 0x0($s2)
/* 397F8 8005E3F8 24035000 */  addiu     $v1, $zero, 0x5000
/* 397FC 8005E3FC 30425000 */  andi      $v0, $v0, 0x5000
/* 39800 8005E400 1443011F */  bne       $v0, $v1, .L8005E880
/* 39804 8005E404 24020001 */   addiu    $v0, $zero, 0x1
/* 39808 8005E408 08017A20 */  j         .L8005E880
/* 3980C 8005E40C AE220288 */   sw       $v0, 0x288($s1)
.L8005E410:
/* 39810 8005E410 8E230284 */  lw        $v1, 0x284($s1)
/* 39814 8005E414 8E220280 */  lw        $v0, 0x280($s1)
/* 39818 8005E418 10620119 */  beq       $v1, $v0, .L8005E880
/* 3981C 8005E41C 24620001 */   addiu    $v0, $v1, 0x1
/* 39820 8005E420 AE220284 */  sw        $v0, 0x284($s1)
/* 39824 8005E424 28420028 */  slti      $v0, $v0, 0x28
/* 39828 8005E428 50400001 */  beql      $v0, $zero, .L8005E430
/* 3982C 8005E42C AE200284 */   sw       $zero, 0x284($s1)
.L8005E430:
/* 39830 8005E430 C64C0038 */  lwc1      $f12, 0x38($s2)
/* 39834 8005E434 8E220284 */  lw        $v0, 0x284($s1)
/* 39838 8005E438 C64E0040 */  lwc1      $f14, 0x40($s2)
/* 3983C 8005E43C 3C014000 */  lui       $at, (0x40000000 >> 16)
/* 39840 8005E440 44810000 */  mtc1      $at, $f0
/* 39844 8005E444 00021100 */  sll       $v0, $v0, 4
/* 39848 8005E448 02228021 */  addu      $s0, $s1, $v0
/* 3984C 8005E44C C6160004 */  lwc1      $f22, 0x4($s0)
/* 39850 8005E450 C614000C */  lwc1      $f20, 0xC($s0)
/* 39854 8005E454 C6020008 */  lwc1      $f2, 0x8($s0)
/* 39858 8005E458 A640008E */  sh        $zero, 0x8E($s2)
/* 3985C 8005E45C E6400014 */  swc1      $f0, 0x14($s2)
/* 39860 8005E460 E6560060 */  swc1      $f22, 0x60($s2)
/* 39864 8005E464 E6540068 */  swc1      $f20, 0x68($s2)
/* 39868 8005E468 E6420064 */  swc1      $f2, 0x64($s2)
/* 3986C 8005E46C C6200298 */  lwc1      $f0, 0x298($s1)
/* 39870 8005E470 4406B000 */  mfc1      $a2, $f22
/* 39874 8005E474 4407A000 */  mfc1      $a3, $f20
/* 39878 8005E478 0C00A7B5 */  jal       dist2D
/* 3987C 8005E47C E6400018 */   swc1     $f0, 0x18($s2)
/* 39880 8005E480 C64C0038 */  lwc1      $f12, 0x38($s2)
/* 39884 8005E484 C64E0040 */  lwc1      $f14, 0x40($s2)
/* 39888 8005E488 8E460060 */  lw        $a2, 0x60($s2)
/* 3988C 8005E48C 8E470068 */  lw        $a3, 0x68($s2)
/* 39890 8005E490 0C00A720 */  jal       atan2
/* 39894 8005E494 E6400010 */   swc1     $f0, 0x10($s2)
/* 39898 8005E498 C6480010 */  lwc1      $f8, 0x10($s2)
/* 3989C 8005E49C C6440064 */  lwc1      $f4, 0x64($s2)
/* 398A0 8005E4A0 C642003C */  lwc1      $f2, 0x3C($s2)
/* 398A4 8005E4A4 E640000C */  swc1      $f0, 0xC($s2)
/* 398A8 8005E4A8 46022101 */  sub.s     $f4, $f4, $f2
/* 398AC 8005E4AC 46004186 */  mov.s     $f6, $f8
/* 398B0 8005E4B0 E7A80034 */  swc1      $f8, 0x34($sp)
/* 398B4 8005E4B4 4604303C */  c.lt.s    $f6, $f4
/* 398B8 8005E4B8 00000000 */  nop
/* 398BC 8005E4BC 45000002 */  bc1f      .L8005E4C8
/* 398C0 8005E4C0 E7A4002C */   swc1     $f4, 0x2C($sp)
/* 398C4 8005E4C4 E7A40034 */  swc1      $f4, 0x34($sp)
.L8005E4C8:
/* 398C8 8005E4C8 C620029C */  lwc1      $f0, 0x29C($s1)
/* 398CC 8005E4CC C7A20034 */  lwc1      $f2, 0x34($sp)
/* 398D0 8005E4D0 4600103C */  c.lt.s    $f2, $f0
/* 398D4 8005E4D4 00000000 */  nop
/* 398D8 8005E4D8 4500000A */  bc1f      .L8005E504
/* 398DC 8005E4DC 00000000 */   nop
/* 398E0 8005E4E0 C64C0038 */  lwc1      $f12, 0x38($s2)
/* 398E4 8005E4E4 C64E0040 */  lwc1      $f14, 0x40($s2)
/* 398E8 8005E4E8 8FA60018 */  lw        $a2, 0x18($sp)
/* 398EC 8005E4EC 8FA70020 */  lw        $a3, 0x20($sp)
/* 398F0 8005E4F0 8E420000 */  lw        $v0, 0x0($s2)
/* 398F4 8005E4F4 AE40001C */  sw        $zero, 0x1C($s2)
/* 398F8 8005E4F8 34420200 */  ori       $v0, $v0, 0x200
/* 398FC 8005E4FC 080179B1 */  j         .L8005E6C4
/* 39900 8005E500 AE420000 */   sw       $v0, 0x0($s2)
.L8005E504:
/* 39904 8005E504 C6400018 */  lwc1      $f0, 0x18($s2)
/* 39908 8005E508 46001003 */  div.s     $f0, $f2, $f0
/* 3990C 8005E50C 4600028D */  trunc.w.s $f10, $f0
/* 39910 8005E510 44025000 */  mfc1      $v0, $f10
/* 39914 8005E514 00000000 */  nop
/* 39918 8005E518 A642008E */  sh        $v0, 0x8E($s2)
/* 3991C 8005E51C 00021400 */  sll       $v0, $v0, 16
/* 39920 8005E520 00021403 */  sra       $v0, $v0, 16
/* 39924 8005E524 2842000A */  slti      $v0, $v0, 0xA
/* 39928 8005E528 10400002 */  beqz      $v0, .L8005E534
/* 3992C 8005E52C 2402000A */   addiu    $v0, $zero, 0xA
/* 39930 8005E530 A642008E */  sh        $v0, 0x8E($s2)
.L8005E534:
/* 39934 8005E534 8642008E */  lh        $v0, 0x8E($s2)
/* 39938 8005E538 C6420014 */  lwc1      $f2, 0x14($s2)
/* 3993C 8005E53C 44823000 */  mtc1      $v0, $f6
/* 39940 8005E540 00000000 */  nop
/* 39944 8005E544 468031A0 */  cvt.s.w   $f6, $f6
/* 39948 8005E548 46061082 */  mul.s     $f2, $f2, $f6
/* 3994C 8005E54C 00000000 */  nop
/* 39950 8005E550 46061082 */  mul.s     $f2, $f2, $f6
/* 39954 8005E554 00000000 */  nop
/* 39958 8005E558 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* 3995C 8005E55C 44810000 */  mtc1      $at, $f0
/* 39960 8005E560 00000000 */  nop
/* 39964 8005E564 46001082 */  mul.s     $f2, $f2, $f0
/* 39968 8005E568 00000000 */  nop
/* 3996C 8005E56C 2404FDFF */  addiu     $a0, $zero, -0x201
/* 39970 8005E570 C7A4002C */  lwc1      $f4, 0x2C($sp)
/* 39974 8005E574 46003206 */  mov.s     $f8, $f6
/* 39978 8005E578 C6400010 */  lwc1      $f0, 0x10($s2)
/* 3997C 8005E57C 46022100 */  add.s     $f4, $f4, $f2
/* 39980 8005E580 46080003 */  div.s     $f0, $f0, $f8
/* 39984 8005E584 E6400018 */  swc1      $f0, 0x18($s2)
/* 39988 8005E588 46062103 */  div.s     $f4, $f4, $f6
/* 3998C 8005E58C E644001C */  swc1      $f4, 0x1C($s2)
/* 39990 8005E590 8E230290 */  lw        $v1, 0x290($s1)
/* 39994 8005E594 8E420000 */  lw        $v0, 0x0($s2)
/* 39998 8005E598 8C630004 */  lw        $v1, 0x4($v1)
/* 3999C 8005E59C 00441024 */  and       $v0, $v0, $a0
/* 399A0 8005E5A0 AE420000 */  sw        $v0, 0x0($s2)
/* 399A4 8005E5A4 24020002 */  addiu     $v0, $zero, 0x2
/* 399A8 8005E5A8 08017A1F */  j         .L8005E87C
/* 399AC 8005E5AC AE430028 */   sw       $v1, 0x28($s2)
.L8005E5B0:
/* 399B0 8005E5B0 C640001C */  lwc1      $f0, 0x1C($s2)
/* 399B4 8005E5B4 C6420014 */  lwc1      $f2, 0x14($s2)
/* 399B8 8005E5B8 46020001 */  sub.s     $f0, $f0, $f2
/* 399BC 8005E5BC C642003C */  lwc1      $f2, 0x3C($s2)
/* 399C0 8005E5C0 46001080 */  add.s     $f2, $f2, $f0
/* 399C4 8005E5C4 4480B000 */  mtc1      $zero, $f22
/* 399C8 8005E5C8 00000000 */  nop
/* 399CC 8005E5CC 4616003E */  c.le.s    $f0, $f22
/* 399D0 8005E5D0 E640001C */  swc1      $f0, 0x1C($s2)
/* 399D4 8005E5D4 45000004 */  bc1f      .L8005E5E8
/* 399D8 8005E5D8 E642003C */   swc1     $f2, 0x3C($s2)
/* 399DC 8005E5DC 8E220290 */  lw        $v0, 0x290($s1)
/* 399E0 8005E5E0 8C420008 */  lw        $v0, 0x8($v0)
/* 399E4 8005E5E4 AE420028 */  sw        $v0, 0x28($s2)
.L8005E5E8:
/* 399E8 8005E5E8 8E450018 */  lw        $a1, 0x18($s2)
/* 399EC 8005E5EC 8E46000C */  lw        $a2, 0xC($s2)
/* 399F0 8005E5F0 0C00EA95 */  jal       npc_move_heading
/* 399F4 8005E5F4 0240202D */   daddu    $a0, $s2, $zero
/* 399F8 8005E5F8 C640001C */  lwc1      $f0, 0x1C($s2)
/* 399FC 8005E5FC 4616003E */  c.le.s    $f0, $f22
/* 39A00 8005E600 00000000 */  nop
/* 39A04 8005E604 4500009E */  bc1f      .L8005E880
/* 39A08 8005E608 27A50028 */   addiu    $a1, $sp, 0x28
/* 39A0C 8005E60C 46000005 */  abs.s     $f0, $f0
/* 39A10 8005E610 46000021 */  cvt.d.s   $f0, $f0
/* 39A14 8005E614 27A6002C */  addiu     $a2, $sp, 0x2C
/* 39A18 8005E618 27A20034 */  addiu     $v0, $sp, 0x34
/* 39A1C 8005E61C 3C014020 */  lui       $at, (0x40200000 >> 16)
/* 39A20 8005E620 4481A800 */  mtc1      $at, $f21
/* 39A24 8005E624 4480A000 */  mtc1      $zero, $f20
/* 39A28 8005E628 C6420038 */  lwc1      $f2, 0x38($s2)
/* 39A2C 8005E62C 46340000 */  add.d     $f0, $f0, $f20
/* 39A30 8005E630 E7A20028 */  swc1      $f2, 0x28($sp)
/* 39A34 8005E634 C642003C */  lwc1      $f2, 0x3C($s2)
/* 39A38 8005E638 C6440040 */  lwc1      $f4, 0x40($s2)
/* 39A3C 8005E63C 46200020 */  cvt.s.d   $f0, $f0
/* 39A40 8005E640 46001080 */  add.s     $f2, $f2, $f0
/* 39A44 8005E644 E7A40030 */  swc1      $f4, 0x30($sp)
/* 39A48 8005E648 E7A00034 */  swc1      $f0, 0x34($sp)
/* 39A4C 8005E64C E7A2002C */  swc1      $f2, 0x2C($sp)
/* 39A50 8005E650 AFA20010 */  sw        $v0, 0x10($sp)
/* 39A54 8005E654 8E440080 */  lw        $a0, 0x80($s2)
/* 39A58 8005E658 0C0372DF */  jal       npc_raycast_down_sides
/* 39A5C 8005E65C 27A70030 */   addiu    $a3, $sp, 0x30
/* 39A60 8005E660 10400087 */  beqz      $v0, .L8005E880
/* 39A64 8005E664 00000000 */   nop
/* 39A68 8005E668 C640001C */  lwc1      $f0, 0x1C($s2)
/* 39A6C 8005E66C C7A20034 */  lwc1      $f2, 0x34($sp)
/* 39A70 8005E670 46000005 */  abs.s     $f0, $f0
/* 39A74 8005E674 46000021 */  cvt.d.s   $f0, $f0
/* 39A78 8005E678 46340000 */  add.d     $f0, $f0, $f20
/* 39A7C 8005E67C 460010A1 */  cvt.d.s   $f2, $f2
/* 39A80 8005E680 4620103E */  c.le.d    $f2, $f0
/* 39A84 8005E684 00000000 */  nop
/* 39A88 8005E688 4500007D */  bc1f      .L8005E880
/* 39A8C 8005E68C 00000000 */   nop
/* 39A90 8005E690 C7AC0028 */  lwc1      $f12, 0x28($sp)
/* 39A94 8005E694 C7AE0030 */  lwc1      $f14, 0x30($sp)
/* 39A98 8005E698 8FA60018 */  lw        $a2, 0x18($sp)
/* 39A9C 8005E69C 8E220290 */  lw        $v0, 0x290($s1)
/* 39AA0 8005E6A0 8FA70020 */  lw        $a3, 0x20($sp)
/* 39AA4 8005E6A4 C7A0002C */  lwc1      $f0, 0x2C($sp)
/* 39AA8 8005E6A8 8C43000C */  lw        $v1, 0xC($v0)
/* 39AAC 8005E6AC 8E420000 */  lw        $v0, 0x0($s2)
/* 39AB0 8005E6B0 E656001C */  swc1      $f22, 0x1C($s2)
/* 39AB4 8005E6B4 E640003C */  swc1      $f0, 0x3C($s2)
/* 39AB8 8005E6B8 34420200 */  ori       $v0, $v0, 0x200
/* 39ABC 8005E6BC AE420000 */  sw        $v0, 0x0($s2)
/* 39AC0 8005E6C0 AE430028 */  sw        $v1, 0x28($s2)
.L8005E6C4:
/* 39AC4 8005E6C4 0C00A720 */  jal       atan2
/* 39AC8 8005E6C8 00000000 */   nop
/* 39ACC 8005E6CC E640000C */  swc1      $f0, 0xC($s2)
/* 39AD0 8005E6D0 08017A20 */  j         .L8005E880
/* 39AD4 8005E6D4 AE200288 */   sw       $zero, 0x288($s1)
.L8005E6D8:
/* 39AD8 8005E6D8 C64C0038 */  lwc1      $f12, 0x38($s2)
/* 39ADC 8005E6DC C64E0040 */  lwc1      $f14, 0x40($s2)
/* 39AE0 8005E6E0 8FA60018 */  lw        $a2, 0x18($sp)
/* 39AE4 8005E6E4 8E220284 */  lw        $v0, 0x284($s1)
/* 39AE8 8005E6E8 8FA70020 */  lw        $a3, 0x20($sp)
/* 39AEC 8005E6EC C642003C */  lwc1      $f2, 0x3C($s2)
/* 39AF0 8005E6F0 00021100 */  sll       $v0, $v0, 4
/* 39AF4 8005E6F4 02228021 */  addu      $s0, $s1, $v0
/* 39AF8 8005E6F8 46006006 */  mov.s     $f0, $f12
/* 39AFC 8005E6FC C6160004 */  lwc1      $f22, 0x4($s0)
/* 39B00 8005E700 C614000C */  lwc1      $f20, 0xC($s0)
/* 39B04 8005E704 46007106 */  mov.s     $f4, $f14
/* 39B08 8005E708 E7A00028 */  swc1      $f0, 0x28($sp)
/* 39B0C 8005E70C E7A2002C */  swc1      $f2, 0x2C($sp)
/* 39B10 8005E710 0C00A7B5 */  jal       dist2D
/* 39B14 8005E714 E7A40030 */   swc1     $f4, 0x30($sp)
/* 39B18 8005E718 C622029C */  lwc1      $f2, 0x29C($s1)
/* 39B1C 8005E71C 4602003E */  c.le.s    $f0, $f2
/* 39B20 8005E720 00000000 */  nop
/* 39B24 8005E724 45010056 */  bc1t      .L8005E880
/* 39B28 8005E728 E7A00034 */   swc1     $f0, 0x34($sp)
/* 39B2C 8005E72C 3C0142B4 */  lui       $at, (0x42B40000 >> 16)
/* 39B30 8005E730 4481D000 */  mtc1      $at, $f26
.L8005E734:
/* 39B34 8005E734 82020000 */  lb        $v0, 0x0($s0)
/* 39B38 8005E738 14400028 */  bnez      $v0, .L8005E7DC
/* 39B3C 8005E73C 00000000 */   nop
/* 39B40 8005E740 C64C0038 */  lwc1      $f12, 0x38($s2)
/* 39B44 8005E744 C64E0040 */  lwc1      $f14, 0x40($s2)
/* 39B48 8005E748 4406B000 */  mfc1      $a2, $f22
/* 39B4C 8005E74C 4407A000 */  mfc1      $a3, $f20
/* 39B50 8005E750 0C00A720 */  jal       atan2
/* 39B54 8005E754 00000000 */   nop
/* 39B58 8005E758 C64C0038 */  lwc1      $f12, 0x38($s2)
/* 39B5C 8005E75C C64E0040 */  lwc1      $f14, 0x40($s2)
/* 39B60 8005E760 8FA60018 */  lw        $a2, 0x18($sp)
/* 39B64 8005E764 8FA70020 */  lw        $a3, 0x20($sp)
/* 39B68 8005E768 0C00A720 */  jal       atan2
/* 39B6C 8005E76C 46000606 */   mov.s    $f24, $f0
/* 39B70 8005E770 4600C306 */  mov.s     $f12, $f24
/* 39B74 8005E774 0C00A70A */  jal       get_clamped_angle_diff
/* 39B78 8005E778 46000386 */   mov.s    $f14, $f0
/* 39B7C 8005E77C 46000005 */  abs.s     $f0, $f0
/* 39B80 8005E780 461A003C */  c.lt.s    $f0, $f26
/* 39B84 8005E784 00000000 */  nop
/* 39B88 8005E788 4501000F */  bc1t      .L8005E7C8
/* 39B8C 8005E78C 00000000 */   nop
/* 39B90 8005E790 8E230284 */  lw        $v1, 0x284($s1)
/* 39B94 8005E794 8E220280 */  lw        $v0, 0x280($s1)
/* 39B98 8005E798 1062000B */  beq       $v1, $v0, .L8005E7C8
/* 39B9C 8005E79C 24620001 */   addiu    $v0, $v1, 0x1
/* 39BA0 8005E7A0 AE220284 */  sw        $v0, 0x284($s1)
/* 39BA4 8005E7A4 28420028 */  slti      $v0, $v0, 0x28
/* 39BA8 8005E7A8 50400001 */  beql      $v0, $zero, .L8005E7B0
/* 39BAC 8005E7AC AE200284 */   sw       $zero, 0x284($s1)
.L8005E7B0:
/* 39BB0 8005E7B0 8E220284 */  lw        $v0, 0x284($s1)
/* 39BB4 8005E7B4 00021100 */  sll       $v0, $v0, 4
/* 39BB8 8005E7B8 02228021 */  addu      $s0, $s1, $v0
/* 39BBC 8005E7BC C6160004 */  lwc1      $f22, 0x4($s0)
/* 39BC0 8005E7C0 080179CD */  j         .L8005E734
/* 39BC4 8005E7C4 C614000C */   lwc1     $f20, 0xC($s0)
.L8005E7C8:
/* 39BC8 8005E7C8 82020000 */  lb        $v0, 0x0($s0)
/* 39BCC 8005E7CC 14400003 */  bnez      $v0, .L8005E7DC
/* 39BD0 8005E7D0 00000000 */   nop
/* 39BD4 8005E7D4 08017A20 */  j         .L8005E880
/* 39BD8 8005E7D8 AE200288 */   sw       $zero, 0x288($s1)
.L8005E7DC:
/* 39BDC 8005E7DC 3C0142B4 */  lui       $at, (0x42B40000 >> 16)
/* 39BE0 8005E7E0 4481D000 */  mtc1      $at, $f26
.L8005E7E4:
/* 39BE4 8005E7E4 82020000 */  lb        $v0, 0x0($s0)
/* 39BE8 8005E7E8 10400024 */  beqz      $v0, .L8005E87C
/* 39BEC 8005E7EC 24020001 */   addiu    $v0, $zero, 0x1
/* 39BF0 8005E7F0 C64C0038 */  lwc1      $f12, 0x38($s2)
/* 39BF4 8005E7F4 C64E0040 */  lwc1      $f14, 0x40($s2)
/* 39BF8 8005E7F8 4406B000 */  mfc1      $a2, $f22
/* 39BFC 8005E7FC 4407A000 */  mfc1      $a3, $f20
/* 39C00 8005E800 0C00A720 */  jal       atan2
/* 39C04 8005E804 00000000 */   nop
/* 39C08 8005E808 C64C0038 */  lwc1      $f12, 0x38($s2)
/* 39C0C 8005E80C C64E0040 */  lwc1      $f14, 0x40($s2)
/* 39C10 8005E810 8FA60018 */  lw        $a2, 0x18($sp)
/* 39C14 8005E814 8FA70020 */  lw        $a3, 0x20($sp)
/* 39C18 8005E818 0C00A720 */  jal       atan2
/* 39C1C 8005E81C 46000606 */   mov.s    $f24, $f0
/* 39C20 8005E820 4600C306 */  mov.s     $f12, $f24
/* 39C24 8005E824 0C00A70A */  jal       get_clamped_angle_diff
/* 39C28 8005E828 46000386 */   mov.s    $f14, $f0
/* 39C2C 8005E82C 46000005 */  abs.s     $f0, $f0
/* 39C30 8005E830 461A003C */  c.lt.s    $f0, $f26
/* 39C34 8005E834 00000000 */  nop
/* 39C38 8005E838 45010010 */  bc1t      .L8005E87C
/* 39C3C 8005E83C 24020001 */   addiu    $v0, $zero, 0x1
/* 39C40 8005E840 8E230284 */  lw        $v1, 0x284($s1)
/* 39C44 8005E844 8E220280 */  lw        $v0, 0x280($s1)
/* 39C48 8005E848 1062000B */  beq       $v1, $v0, .L8005E878
/* 39C4C 8005E84C 24620001 */   addiu    $v0, $v1, 0x1
/* 39C50 8005E850 AE220284 */  sw        $v0, 0x284($s1)
/* 39C54 8005E854 28420028 */  slti      $v0, $v0, 0x28
/* 39C58 8005E858 50400001 */  beql      $v0, $zero, .L8005E860
/* 39C5C 8005E85C AE200284 */   sw       $zero, 0x284($s1)
.L8005E860:
/* 39C60 8005E860 8E220284 */  lw        $v0, 0x284($s1)
/* 39C64 8005E864 00021100 */  sll       $v0, $v0, 4
/* 39C68 8005E868 02228021 */  addu      $s0, $s1, $v0
/* 39C6C 8005E86C C6160004 */  lwc1      $f22, 0x4($s0)
/* 39C70 8005E870 080179F9 */  j         .L8005E7E4
/* 39C74 8005E874 C614000C */   lwc1     $f20, 0xC($s0)
.L8005E878:
/* 39C78 8005E878 24020001 */  addiu     $v0, $zero, 0x1
.L8005E87C:
/* 39C7C 8005E87C AE220288 */  sw        $v0, 0x288($s1)
.L8005E880:
/* 39C80 8005E880 8FBF0044 */  lw        $ra, 0x44($sp)
/* 39C84 8005E884 8FB20040 */  lw        $s2, 0x40($sp)
/* 39C88 8005E888 8FB1003C */  lw        $s1, 0x3C($sp)
/* 39C8C 8005E88C 8FB00038 */  lw        $s0, 0x38($sp)
/* 39C90 8005E890 D7BA0060 */  ldc1      $f26, 0x60($sp)
/* 39C94 8005E894 D7B80058 */  ldc1      $f24, 0x58($sp)
/* 39C98 8005E898 D7B60050 */  ldc1      $f22, 0x50($sp)
/* 39C9C 8005E89C D7B40048 */  ldc1      $f20, 0x48($sp)
/* 39CA0 8005E8A0 03E00008 */  jr        $ra
/* 39CA4 8005E8A4 27BD0068 */   addiu    $sp, $sp, 0x68
/* 39CA8 8005E8A8 00000000 */  nop
/* 39CAC 8005E8AC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void npc_follow_npc(Npc* npc) {
    NpcFollowData* followData = npc->blur.followData;
    f32 x, y, z;
    s32 airborne;
    f32 currentX, currentY, currentZ;
    f32 dist;
    NpcHistoryPoint* historyPoint;
    f32 targetX, targetY, targetZ;
    f32 theta;
    f32 yaw;

    get_npc_pos(followData->targetNpcID, &x, &y, &z, &airborne);

    switch (followData->followState) {
        case NPC_FOLLOW_STATE_RUN:
            historyPoint = &followData->moveHistory[followData->targetPointIdx];
            targetX = historyPoint->pos.x;
            targetY = historyPoint->pos.y;
            targetZ = historyPoint->pos.z;
            currentX = npc->pos.x;
            currentY = npc->pos.y;
            currentZ = npc->pos.z;
            npc->moveSpeed = followData->walkSpeed;

            dist = dist2D(npc->pos.x, npc->pos.z, x, z);
            if (dist >= followData->walkRadius) {
                npc->moveSpeed = followData->runSpeed;
            }

            npc->currentAnim = followData->anims->run;
            if (!(npc->flags & NPC_FLAG_GROUNDED)) {
                npc->currentAnim = followData->anims->fall;
            }

            while (TRUE) {
                dist = dist2D(currentX, currentZ, targetX, targetZ);
                yaw = atan2(currentX, currentZ, targetX, targetZ);
                if (dist > npc->moveSpeed) {
                    dist = dist2D(currentX, currentZ, x, z);
                    if (dist > followData->walkRadius) {
                        break;
                    }

                    if (dist > followData->idleRadius) {
                        npc->moveSpeed = dist - followData->idleRadius;
                        if (npc->moveSpeed > followData->walkSpeed) {
                            npc->moveSpeed = followData->walkSpeed;
                        } else {
                            npc->moveSpeed += 1.0;
                        }
                        break;
                    }
                }

                if (followData->targetPointIdx == followData->lastPointIdx) {
                    npc->moveSpeed = 0.0f;
                    yaw = npc->yaw;
                    npc->currentAnim = followData->anims->idle;
                    break;
                }

                dist = dist2D(npc->pos.x, npc->pos.z, x, z);
                if (dist <= followData->idleRadius) {
                    npc->moveSpeed = 0.0f;
                    yaw = npc->yaw;
                    npc->currentAnim = followData->anims->idle;
                    followData->followState = NPC_FOLLOW_STATE_IDLE;
                    break;
                }

                followData->targetPointIdx++;
                if (followData->targetPointIdx >= ARRAY_COUNT(followData->moveHistory)) {
                    followData->targetPointIdx = 0;
                }
                historyPoint = &followData->moveHistory[followData->targetPointIdx];
                targetX = historyPoint->pos.x;
                targetZ = historyPoint->pos.z;
                if (npc->flags & NPC_FLAG_GROUNDED) {
                    if (historyPoint->isAirborne) {
                        followData->followState = NPC_FOLLOW_STATE_JUMP;
                        break;
                    }
                }
            }

            if (!(npc->flags & NPC_FLAG_GROUNDED)) {
                npc->moveSpeed *= 0.5f;
            }
            npc->yaw = yaw;
            npc_move_heading(npc, npc->moveSpeed, yaw);
            if ((npc->flags & NPC_FLAG_COLLDING_FORWARD_WITH_WORLD) && (npc->flags & NPC_FLAG_GROUNDED)) {
                followData->followState = NPC_FOLLOW_STATE_JUMP;
            }
            break;
        case NPC_FOLLOW_STATE_JUMP:
            if (followData->targetPointIdx != followData->lastPointIdx) {
                followData->targetPointIdx++;
                if (followData->targetPointIdx >= ARRAY_COUNT(followData->moveHistory)) {
                    followData->targetPointIdx = 0;
                }
                historyPoint = &followData->moveHistory[followData->targetPointIdx];
                targetX = historyPoint->pos.x;
                targetY = historyPoint->pos.y;
                targetZ = historyPoint->pos.z;
                npc->moveToPos.x = targetX;
                npc->moveToPos.y = targetY;
                npc->moveToPos.z = targetZ;
                npc->duration = 0;
                npc->jumpScale = 2.0f;
                npc->moveSpeed = followData->runSpeed;
                npc->planarFlyDist = dist2D(npc->pos.x, npc->pos.z, npc->moveToPos.x, npc->moveToPos.z);
                npc->yaw = atan2(npc->pos.x, npc->pos.z, npc->moveToPos.x, npc->moveToPos.z);
                dist = npc->planarFlyDist;
                currentY = npc->moveToPos.y - npc->pos.y;
                if (npc->planarFlyDist < currentY) {
                    dist = currentY;
                }
                if (dist < followData->idleRadius) {
                    npc->jumpVelocity = 0.0f;
                    npc->flags |= NPC_FLAG_GRAVITY;
                    npc->yaw = atan2(npc->pos.x, npc->pos.z, x, z);
                    followData->followState = NPC_FOLLOW_STATE_RUN;
                    return;
                }
                npc->duration = dist / npc->moveSpeed;
                if (npc->duration < 10) {
                    npc->duration = 10;
                }
                npc->moveSpeed = npc->planarFlyDist / npc->duration;
                npc->jumpVelocity = (currentY + (npc->jumpScale * npc->duration * npc->duration * 0.5f)) / npc->duration;
                npc->currentAnim = followData->anims->jump;
                npc->flags &= ~NPC_FLAG_GRAVITY;
                followData->followState = NPC_FOLLOW_STATE_FALL;
            }
            break;
        case NPC_FOLLOW_STATE_FALL:
            npc->jumpVelocity -= npc->jumpScale;
            npc->pos.y += npc->jumpVelocity;
            if (npc->jumpVelocity <= 0.0f) {
                npc->currentAnim = followData->anims->fall;
            }
            npc_move_heading(npc, npc->moveSpeed, npc->yaw);
            if (npc->jumpVelocity <= 0.0f) {
                currentX = npc->pos.x;
                dist = fabsf(npc->jumpVelocity) + 8.0;
                currentY = npc->pos.y + dist;
                currentZ = npc->pos.z;
                if (npc_raycast_down_sides(npc->collisionChannel, &currentX, &currentY, &currentZ, &dist) != 0 &&
                    dist <= fabsf(npc->jumpVelocity) + 8.0)
                {
                    npc->currentAnim = followData->anims->land;
                    npc->jumpVelocity = 0.0f;
                    npc->pos.y = currentY;
                    npc->flags |= NPC_FLAG_GRAVITY;
                    npc->yaw = atan2(currentX, currentZ, x, z);
                    followData->followState = NPC_FOLLOW_STATE_RUN;
                }
            }
            break;
        case NPC_FOLLOW_STATE_IDLE:
            historyPoint = &followData->moveHistory[followData->targetPointIdx];
            targetX = historyPoint->pos.x;
            targetY = historyPoint->pos.y;
            targetZ = historyPoint->pos.z;
            currentX = npc->pos.x;
            currentY = npc->pos.y;
            currentZ = npc->pos.z;
            dist = dist2D(npc->pos.x, npc->pos.z, x, z);
            if (dist <= followData->idleRadius) {
                break;
            }

            while (TRUE) {
                if (historyPoint->isAirborne) {
                    break;
                }

                yaw = atan2(npc->pos.x, npc->pos.z, targetX, targetZ);
                if (fabsf(get_clamped_angle_diff(yaw, atan2(npc->pos.x, npc->pos.z, x, z))) < 90.0f) {
                    break;
                }

                if (followData->targetPointIdx == followData->lastPointIdx) {
                    break;
                }

                followData->targetPointIdx++;
                if (followData->targetPointIdx >= ARRAY_COUNT(followData->moveHistory)) {
                    followData->targetPointIdx = 0;
                }
                historyPoint = &followData->moveHistory[followData->targetPointIdx];
                targetX = historyPoint->pos.x;
                targetZ = historyPoint->pos.z;
                continue;
            }

            if (!historyPoint->isAirborne) {
                followData->followState = NPC_FOLLOW_STATE_RUN;
                return;
            }

            while (TRUE) {
                if (!historyPoint->isAirborne) {
                    break;
                }

                yaw = atan2(npc->pos.x, npc->pos.z, targetX, targetZ);
                if (fabsf(get_clamped_angle_diff(yaw, atan2(npc->pos.x, npc->pos.z, x, z))) < 90.0f) {
                    break;
                }

                if (followData->targetPointIdx == followData->lastPointIdx) {
                    break;
                }

                followData->targetPointIdx++;
                if (followData->targetPointIdx >= ARRAY_COUNT(followData->moveHistory)) {
                    followData->targetPointIdx = 0;
                }
                historyPoint = &followData->moveHistory[followData->targetPointIdx];
                targetX = historyPoint->pos.x;
                targetZ = historyPoint->pos.z;
            }
            followData->followState = NPC_FOLLOW_STATE_JUMP;
            break;
    }
}