### RAW ASSEMBLY INSTRUCTIONS:

glabel light_rays_appendGfx
/* 36D96C E006A94C 27BDFEE0 */  addiu     $sp, $sp, -0x120
/* 36D970 E006A950 AFA40120 */  sw        $a0, 0x120($sp)
/* 36D974 E006A954 8FA80120 */  lw        $t0, 0x120($sp)
/* 36D978 E006A958 3C07DB06 */  lui       $a3, (0xDB060024 >> 16)
/* 36D97C E006A95C AFB100E4 */  sw        $s1, 0xE4($sp)
/* 36D980 E006A960 3C11800A */  lui       $s1, %hi(gMainGfxPos)
/* 36D984 E006A964 2631A66C */  addiu     $s1, $s1, %lo(gMainGfxPos)
/* 36D988 E006A968 AFBF0104 */  sw        $ra, 0x104($sp)
/* 36D98C E006A96C AFBE0100 */  sw        $fp, 0x100($sp)
/* 36D990 E006A970 AFB700FC */  sw        $s7, 0xFC($sp)
/* 36D994 E006A974 AFB600F8 */  sw        $s6, 0xF8($sp)
/* 36D998 E006A978 AFB500F4 */  sw        $s5, 0xF4($sp)
/* 36D99C E006A97C AFB400F0 */  sw        $s4, 0xF0($sp)
/* 36D9A0 E006A980 AFB300EC */  sw        $s3, 0xEC($sp)
/* 36D9A4 E006A984 AFB200E8 */  sw        $s2, 0xE8($sp)
/* 36D9A8 E006A988 AFB000E0 */  sw        $s0, 0xE0($sp)
/* 36D9AC E006A98C F7B80118 */  sdc1      $f24, 0x118($sp)
/* 36D9B0 E006A990 F7B60110 */  sdc1      $f22, 0x110($sp)
/* 36D9B4 E006A994 F7B40108 */  sdc1      $f20, 0x108($sp)
/* 36D9B8 E006A998 8E230000 */  lw        $v1, 0x0($s1)
/* 36D9BC E006A99C 8D12000C */  lw        $s2, 0xC($t0)
/* 36D9C0 E006A9A0 0060282D */  daddu     $a1, $v1, $zero
/* 36D9C4 E006A9A4 8E570000 */  lw        $s7, 0x0($s2)
/* 36D9C8 E006A9A8 24630008 */  addiu     $v1, $v1, 0x8
/* 36D9CC E006A9AC AE230000 */  sw        $v1, 0x0($s1)
/* 36D9D0 E006A9B0 00171080 */  sll       $v0, $s7, 2
/* 36D9D4 E006A9B4 3C08E007 */  lui       $t0, (0xE0070000 >> 16)
/* 36D9D8 E006A9B8 01024021 */  addu      $t0, $t0, $v0
/* 36D9DC E006A9BC 8D08ADF0 */  lw        $t0, -0x5210($t0)
/* 36D9E0 E006A9C0 34E70024 */  ori       $a3, $a3, (0xDB060024 & 0xFFFF)
/* 36D9E4 E006A9C4 AFA800D8 */  sw        $t0, 0xD8($sp)
/* 36D9E8 E006A9C8 3C06E007 */  lui       $a2, (0xE0070000 >> 16)
/* 36D9EC E006A9CC 00C23021 */  addu      $a2, $a2, $v0
/* 36D9F0 E006A9D0 8CC6AE00 */  lw        $a2, -0x5200($a2)
/* 36D9F4 E006A9D4 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 36D9F8 E006A9D8 ACA20000 */  sw        $v0, 0x0($a1)
/* 36D9FC E006A9DC ACA00004 */  sw        $zero, 0x4($a1)
/* 36DA00 E006A9E0 AC670000 */  sw        $a3, 0x0($v1)
/* 36DA04 E006A9E4 8FA80120 */  lw        $t0, 0x120($sp)
/* 36DA08 E006A9E8 27A40098 */  addiu     $a0, $sp, 0x98
/* 36DA0C E006A9EC 8D050010 */  lw        $a1, 0x10($t0)
/* 36DA10 E006A9F0 24620008 */  addiu     $v0, $v1, 0x8
/* 36DA14 E006A9F4 AE220000 */  sw        $v0, 0x0($s1)
/* 36DA18 E006A9F8 8CA5001C */  lw        $a1, 0x1C($a1)
/* 36DA1C E006A9FC 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 36DA20 E006AA00 AC620008 */  sw        $v0, 0x8($v1)
/* 36DA24 E006AA04 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 36DA28 E006AA08 AC66000C */  sw        $a2, 0xC($v1)
/* 36DA2C E006AA0C 00A22821 */  addu      $a1, $a1, $v0
/* 36DA30 E006AA10 AC650004 */  sw        $a1, 0x4($v1)
/* 36DA34 E006AA14 8E450010 */  lw        $a1, 0x10($s2)
/* 36DA38 E006AA18 8E460014 */  lw        $a2, 0x14($s2)
/* 36DA3C E006AA1C 8E470018 */  lw        $a3, 0x18($s2)
/* 36DA40 E006AA20 24630010 */  addiu     $v1, $v1, 0x10
/* 36DA44 E006AA24 0C080108 */  jal       shim_guTranslateF
/* 36DA48 E006AA28 AE230000 */   sw       $v1, 0x0($s1)
/* 36DA4C E006AA2C 8FA80120 */  lw        $t0, 0x120($sp)
/* 36DA50 E006AA30 24140001 */  addiu     $s4, $zero, 0x1
/* 36DA54 E006AA34 8D020008 */  lw        $v0, 0x8($t0)
/* 36DA58 E006AA38 0282102A */  slt       $v0, $s4, $v0
/* 36DA5C E006AA3C 104000D2 */  beqz      $v0, .LE006AD88
/* 36DA60 E006AA40 26520094 */   addiu    $s2, $s2, 0x94
/* 36DA64 E006AA44 2AF60002 */  slti      $s6, $s7, 0x2
/* 36DA68 E006AA48 27B00058 */  addiu     $s0, $sp, 0x58
/* 36DA6C E006AA4C 0220982D */  daddu     $s3, $s1, $zero
/* 36DA70 E006AA50 3C1E8007 */  lui       $fp, %hi(gMatrixListPos)
/* 36DA74 E006AA54 27DE41F0 */  addiu     $fp, $fp, %lo(gMatrixListPos)
/* 36DA78 E006AA58 3C150001 */  lui       $s5, (0x11630 >> 16)
/* 36DA7C E006AA5C 36B51630 */  ori       $s5, $s5, (0x11630 & 0xFFFF)
/* 36DA80 E006AA60 26510024 */  addiu     $s1, $s2, 0x24
/* 36DA84 E006AA64 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 36DA88 E006AA68 4481C000 */  mtc1      $at, $f24
/* 36DA8C E006AA6C 4480B000 */  mtc1      $zero, $f22
.LE006AA70:
/* 36DA90 E006AA70 3C01437F */  lui       $at, (0x437F0000 >> 16)
/* 36DA94 E006AA74 44811000 */  mtc1      $at, $f2
/* 36DA98 E006AA78 C6200000 */  lwc1      $f0, 0x0($s1)
/* 36DA9C E006AA7C 46800020 */  cvt.s.w   $f0, $f0
/* 36DAA0 E006AA80 16C00003 */  bnez      $s6, .LE006AA90
/* 36DAA4 E006AA84 46020503 */   div.s    $f20, $f0, $f2
/* 36DAA8 E006AA88 0C01AA17 */  jal       func_E006A85C
/* 36DAAC E006AA8C 0240202D */   daddu    $a0, $s2, $zero
.LE006AA90:
/* 36DAB0 E006AA90 E7B60010 */  swc1      $f22, 0x10($sp)
/* 36DAB4 E006AA94 8E250038 */  lw        $a1, 0x38($s1)
/* 36DAB8 E006AA98 4406C000 */  mfc1      $a2, $f24
/* 36DABC E006AA9C 4407B000 */  mfc1      $a3, $f22
/* 36DAC0 E006AAA0 0C080104 */  jal       shim_guRotateF
/* 36DAC4 E006AAA4 0200202D */   daddu    $a0, $s0, $zero
/* 36DAC8 E006AAA8 0200202D */  daddu     $a0, $s0, $zero
/* 36DACC E006AAAC 27A50098 */  addiu     $a1, $sp, 0x98
/* 36DAD0 E006AAB0 0C080114 */  jal       shim_guMtxCatF
/* 36DAD4 E006AAB4 27A60018 */   addiu    $a2, $sp, 0x18
/* 36DAD8 E006AAB8 56C00060 */  bnel      $s6, $zero, .LE006AC3C
/* 36DADC E006AABC E7B60010 */   swc1     $f22, 0x10($sp)
/* 36DAE0 E006AAC0 C6220040 */  lwc1      $f2, 0x40($s1)
/* 36DAE4 E006AAC4 24020003 */  addiu     $v0, $zero, 0x3
/* 36DAE8 E006AAC8 56E20005 */  bnel      $s7, $v0, .LE006AAE0
/* 36DAEC E006AACC 46161000 */   add.s    $f0, $f2, $f22
/* 36DAF0 E006AAD0 3C014234 */  lui       $at, (0x42340000 >> 16)
/* 36DAF4 E006AAD4 44810000 */  mtc1      $at, $f0
/* 36DAF8 E006AAD8 00000000 */  nop
/* 36DAFC E006AADC 46001000 */  add.s     $f0, $f2, $f0
.LE006AAE0:
/* 36DB00 E006AAE0 44050000 */  mfc1      $a1, $f0
/* 36DB04 E006AAE4 4406B000 */  mfc1      $a2, $f22
/* 36DB08 E006AAE8 4407B000 */  mfc1      $a3, $f22
/* 36DB0C E006AAEC 0200202D */  daddu     $a0, $s0, $zero
/* 36DB10 E006AAF0 0C080104 */  jal       shim_guRotateF
/* 36DB14 E006AAF4 E7B80010 */   swc1     $f24, 0x10($sp)
/* 36DB18 E006AAF8 0200202D */  daddu     $a0, $s0, $zero
/* 36DB1C E006AAFC 27A50018 */  addiu     $a1, $sp, 0x18
/* 36DB20 E006AB00 0C080114 */  jal       shim_guMtxCatF
/* 36DB24 E006AB04 00A0302D */   daddu    $a2, $a1, $zero
/* 36DB28 E006AB08 E7B60010 */  swc1      $f22, 0x10($sp)
/* 36DB2C E006AB0C 8E25003C */  lw        $a1, 0x3C($s1)
/* 36DB30 E006AB10 4406B000 */  mfc1      $a2, $f22
/* 36DB34 E006AB14 4407C000 */  mfc1      $a3, $f24
/* 36DB38 E006AB18 0C080104 */  jal       shim_guRotateF
/* 36DB3C E006AB1C 0200202D */   daddu    $a0, $s0, $zero
/* 36DB40 E006AB20 0200202D */  daddu     $a0, $s0, $zero
/* 36DB44 E006AB24 27A50018 */  addiu     $a1, $sp, 0x18
/* 36DB48 E006AB28 0C080114 */  jal       shim_guMtxCatF
/* 36DB4C E006AB2C 00A0302D */   daddu    $a2, $a1, $zero
/* 36DB50 E006AB30 8E250034 */  lw        $a1, 0x34($s1)
/* 36DB54 E006AB34 4406B000 */  mfc1      $a2, $f22
/* 36DB58 E006AB38 4407B000 */  mfc1      $a3, $f22
/* 36DB5C E006AB3C 0C080108 */  jal       shim_guTranslateF
/* 36DB60 E006AB40 0200202D */   daddu    $a0, $s0, $zero
/* 36DB64 E006AB44 0200202D */  daddu     $a0, $s0, $zero
/* 36DB68 E006AB48 27A50018 */  addiu     $a1, $sp, 0x18
/* 36DB6C E006AB4C 0C080114 */  jal       shim_guMtxCatF
/* 36DB70 E006AB50 00A0302D */   daddu    $a2, $a1, $zero
/* 36DB74 E006AB54 3C014040 */  lui       $at, (0x40400000 >> 16)
/* 36DB78 E006AB58 44810000 */  mtc1      $at, $f0
/* 36DB7C E006AB5C 00000000 */  nop
/* 36DB80 E006AB60 4600A000 */  add.s     $f0, $f20, $f0
/* 36DB84 E006AB64 3C013FD0 */  lui       $at, (0x3FD00000 >> 16)
/* 36DB88 E006AB68 44811800 */  mtc1      $at, $f3
/* 36DB8C E006AB6C 44801000 */  mtc1      $zero, $f2
/* 36DB90 E006AB70 46000021 */  cvt.d.s   $f0, $f0
/* 36DB94 E006AB74 46220002 */  mul.d     $f0, $f0, $f2
/* 36DB98 E006AB78 00000000 */  nop
/* 36DB9C E006AB7C 32830003 */  andi      $v1, $s4, 0x3
/* 36DBA0 E006AB80 24020001 */  addiu     $v0, $zero, 0x1
/* 36DBA4 E006AB84 46200120 */  cvt.s.d   $f4, $f0
/* 36DBA8 E006AB88 10620010 */  beq       $v1, $v0, .LE006ABCC
/* 36DBAC E006AB8C 46002186 */   mov.s    $f6, $f4
/* 36DBB0 E006AB90 28620002 */  slti      $v0, $v1, 0x2
/* 36DBB4 E006AB94 10400005 */  beqz      $v0, .LE006ABAC
/* 36DBB8 E006AB98 24020002 */   addiu    $v0, $zero, 0x2
/* 36DBBC E006AB9C 10600007 */  beqz      $v1, .LE006ABBC
/* 36DBC0 E006ABA0 00000000 */   nop
/* 36DBC4 E006ABA4 0801AAFD */  j         .LE006ABF4
/* 36DBC8 E006ABA8 4600A006 */   mov.s    $f0, $f20
.LE006ABAC:
/* 36DBCC E006ABAC 5062000C */  beql      $v1, $v0, .LE006ABE0
/* 36DBD0 E006ABB0 4600A021 */   cvt.d.s  $f0, $f20
/* 36DBD4 E006ABB4 0801AAFD */  j         .LE006ABF4
/* 36DBD8 E006ABB8 4600A006 */   mov.s    $f0, $f20
.LE006ABBC:
/* 36DBDC E006ABBC 3C01E007 */  lui       $at, (0xE0070000 >> 16)
/* 36DBE0 E006ABC0 D422AF58 */  ldc1      $f2, -0x50A8($at)
/* 36DBE4 E006ABC4 0801AAFA */  j         .LE006ABE8
/* 36DBE8 E006ABC8 4600A021 */   cvt.d.s  $f0, $f20
.LE006ABCC:
/* 36DBEC E006ABCC 3C013FE0 */  lui       $at, (0x3FE00000 >> 16)
/* 36DBF0 E006ABD0 44811800 */  mtc1      $at, $f3
/* 36DBF4 E006ABD4 44801000 */  mtc1      $zero, $f2
/* 36DBF8 E006ABD8 0801AAFA */  j         .LE006ABE8
/* 36DBFC E006ABDC 4600A021 */   cvt.d.s  $f0, $f20
.LE006ABE0:
/* 36DC00 E006ABE0 3C01E007 */  lui       $at, (0xE0070000 >> 16)
/* 36DC04 E006ABE4 D422AF60 */  ldc1      $f2, -0x50A0($at)
.LE006ABE8:
/* 36DC08 E006ABE8 46220002 */  mul.d     $f0, $f0, $f2
/* 36DC0C E006ABEC 00000000 */  nop
/* 36DC10 E006ABF0 46200020 */  cvt.s.d   $f0, $f0
.LE006ABF4:
/* 36DC14 E006ABF4 44053000 */  mfc1      $a1, $f6
/* 36DC18 E006ABF8 44060000 */  mfc1      $a2, $f0
/* 36DC1C E006ABFC 44072000 */  mfc1      $a3, $f4
/* 36DC20 E006AC00 0C080110 */  jal       shim_guScaleF
/* 36DC24 E006AC04 0200202D */   daddu    $a0, $s0, $zero
/* 36DC28 E006AC08 0200202D */  daddu     $a0, $s0, $zero
/* 36DC2C E006AC0C 27A50018 */  addiu     $a1, $sp, 0x18
/* 36DC30 E006AC10 0C080114 */  jal       shim_guMtxCatF
/* 36DC34 E006AC14 00A0302D */   daddu    $a2, $a1, $zero
/* 36DC38 E006AC18 8E620000 */  lw        $v0, 0x0($s3)
/* 36DC3C E006AC1C 0040202D */  daddu     $a0, $v0, $zero
/* 36DC40 E006AC20 24420008 */  addiu     $v0, $v0, 0x8
/* 36DC44 E006AC24 AE620000 */  sw        $v0, 0x0($s3)
/* 36DC48 E006AC28 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 36DC4C E006AC2C AC820000 */  sw        $v0, 0x0($a0)
/* 36DC50 E006AC30 92220003 */  lbu       $v0, 0x3($s1)
/* 36DC54 E006AC34 0801AB33 */  j         .LE006ACCC
/* 36DC58 E006AC38 2403F000 */   addiu    $v1, $zero, -0x1000
.LE006AC3C:
/* 36DC5C E006AC3C 8E25003C */  lw        $a1, 0x3C($s1)
/* 36DC60 E006AC40 4406B000 */  mfc1      $a2, $f22
/* 36DC64 E006AC44 4407C000 */  mfc1      $a3, $f24
/* 36DC68 E006AC48 0C080104 */  jal       shim_guRotateF
/* 36DC6C E006AC4C 0200202D */   daddu    $a0, $s0, $zero
/* 36DC70 E006AC50 0200202D */  daddu     $a0, $s0, $zero
/* 36DC74 E006AC54 27A50018 */  addiu     $a1, $sp, 0x18
/* 36DC78 E006AC58 0C080114 */  jal       shim_guMtxCatF
/* 36DC7C E006AC5C 00A0302D */   daddu    $a2, $a1, $zero
/* 36DC80 E006AC60 E7B80010 */  swc1      $f24, 0x10($sp)
/* 36DC84 E006AC64 8E250040 */  lw        $a1, 0x40($s1)
/* 36DC88 E006AC68 4406B000 */  mfc1      $a2, $f22
/* 36DC8C E006AC6C 4407B000 */  mfc1      $a3, $f22
/* 36DC90 E006AC70 0C080104 */  jal       shim_guRotateF
/* 36DC94 E006AC74 0200202D */   daddu    $a0, $s0, $zero
/* 36DC98 E006AC78 0200202D */  daddu     $a0, $s0, $zero
/* 36DC9C E006AC7C 27A50018 */  addiu     $a1, $sp, 0x18
/* 36DCA0 E006AC80 0C080114 */  jal       shim_guMtxCatF
/* 36DCA4 E006AC84 00A0302D */   daddu    $a2, $a1, $zero
/* 36DCA8 E006AC88 8E250034 */  lw        $a1, 0x34($s1)
/* 36DCAC E006AC8C 4406B000 */  mfc1      $a2, $f22
/* 36DCB0 E006AC90 4407B000 */  mfc1      $a3, $f22
/* 36DCB4 E006AC94 0C080108 */  jal       shim_guTranslateF
/* 36DCB8 E006AC98 0200202D */   daddu    $a0, $s0, $zero
/* 36DCBC E006AC9C 0200202D */  daddu     $a0, $s0, $zero
/* 36DCC0 E006ACA0 27A50018 */  addiu     $a1, $sp, 0x18
/* 36DCC4 E006ACA4 0C080114 */  jal       shim_guMtxCatF
/* 36DCC8 E006ACA8 00A0302D */   daddu    $a2, $a1, $zero
/* 36DCCC E006ACAC 8E620000 */  lw        $v0, 0x0($s3)
/* 36DCD0 E006ACB0 0040202D */  daddu     $a0, $v0, $zero
/* 36DCD4 E006ACB4 24420008 */  addiu     $v0, $v0, 0x8
/* 36DCD8 E006ACB8 AE620000 */  sw        $v0, 0x0($s3)
/* 36DCDC E006ACBC 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 36DCE0 E006ACC0 AC820000 */  sw        $v0, 0x0($a0)
/* 36DCE4 E006ACC4 92220003 */  lbu       $v0, 0x3($s1)
/* 36DCE8 E006ACC8 2403B500 */  addiu     $v1, $zero, -0x4B00
.LE006ACCC:
/* 36DCEC E006ACCC 00431025 */  or        $v0, $v0, $v1
/* 36DCF0 E006ACD0 AC820004 */  sw        $v0, 0x4($a0)
/* 36DCF4 E006ACD4 27A40018 */  addiu     $a0, $sp, 0x18
/* 36DCF8 E006ACD8 26940001 */  addiu     $s4, $s4, 0x1
/* 36DCFC E006ACDC 26310094 */  addiu     $s1, $s1, 0x94
/* 36DD00 E006ACE0 97C50000 */  lhu       $a1, 0x0($fp)
/* 36DD04 E006ACE4 3C02800A */  lui       $v0, %hi(gDisplayContext)
/* 36DD08 E006ACE8 8C42A674 */  lw        $v0, %lo(gDisplayContext)($v0)
/* 36DD0C E006ACEC 00052980 */  sll       $a1, $a1, 6
/* 36DD10 E006ACF0 00B52821 */  addu      $a1, $a1, $s5
/* 36DD14 E006ACF4 0C080118 */  jal       shim_guMtxF2L
/* 36DD18 E006ACF8 00452821 */   addu     $a1, $v0, $a1
/* 36DD1C E006ACFC 3C02DA38 */  lui       $v0, (0xDA380002 >> 16)
/* 36DD20 E006AD00 34420002 */  ori       $v0, $v0, (0xDA380002 & 0xFFFF)
/* 36DD24 E006AD04 3C06D838 */  lui       $a2, (0xD8380002 >> 16)
/* 36DD28 E006AD08 34C60002 */  ori       $a2, $a2, (0xD8380002 & 0xFFFF)
/* 36DD2C E006AD0C 8E640000 */  lw        $a0, 0x0($s3)
/* 36DD30 E006AD10 97C30000 */  lhu       $v1, 0x0($fp)
/* 36DD34 E006AD14 0080282D */  daddu     $a1, $a0, $zero
/* 36DD38 E006AD18 24840008 */  addiu     $a0, $a0, 0x8
/* 36DD3C E006AD1C AE640000 */  sw        $a0, 0x0($s3)
/* 36DD40 E006AD20 ACA20000 */  sw        $v0, 0x0($a1)
/* 36DD44 E006AD24 24620001 */  addiu     $v0, $v1, 0x1
/* 36DD48 E006AD28 3063FFFF */  andi      $v1, $v1, 0xFFFF
/* 36DD4C E006AD2C 00031980 */  sll       $v1, $v1, 6
/* 36DD50 E006AD30 A7C20000 */  sh        $v0, 0x0($fp)
/* 36DD54 E006AD34 3C02800A */  lui       $v0, %hi(gDisplayContext)
/* 36DD58 E006AD38 8C42A674 */  lw        $v0, %lo(gDisplayContext)($v0)
/* 36DD5C E006AD3C 00751821 */  addu      $v1, $v1, $s5
/* 36DD60 E006AD40 00431021 */  addu      $v0, $v0, $v1
/* 36DD64 E006AD44 ACA20004 */  sw        $v0, 0x4($a1)
/* 36DD68 E006AD48 24820008 */  addiu     $v0, $a0, 0x8
/* 36DD6C E006AD4C AE620000 */  sw        $v0, 0x0($s3)
/* 36DD70 E006AD50 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 36DD74 E006AD54 AC820000 */  sw        $v0, 0x0($a0)
/* 36DD78 E006AD58 8FA800D8 */  lw        $t0, 0xD8($sp)
/* 36DD7C E006AD5C 24020040 */  addiu     $v0, $zero, 0x40
/* 36DD80 E006AD60 AC860008 */  sw        $a2, 0x8($a0)
/* 36DD84 E006AD64 AC82000C */  sw        $v0, 0xC($a0)
/* 36DD88 E006AD68 AC880004 */  sw        $t0, 0x4($a0)
/* 36DD8C E006AD6C 8FA80120 */  lw        $t0, 0x120($sp)
/* 36DD90 E006AD70 26520094 */  addiu     $s2, $s2, 0x94
/* 36DD94 E006AD74 8D020008 */  lw        $v0, 0x8($t0)
/* 36DD98 E006AD78 24840010 */  addiu     $a0, $a0, 0x10
/* 36DD9C E006AD7C 0282102A */  slt       $v0, $s4, $v0
/* 36DDA0 E006AD80 1440FF3B */  bnez      $v0, .LE006AA70
/* 36DDA4 E006AD84 AE640000 */   sw       $a0, 0x0($s3)
.LE006AD88:
/* 36DDA8 E006AD88 3C03800A */  lui       $v1, %hi(gMainGfxPos)
/* 36DDAC E006AD8C 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
/* 36DDB0 E006AD90 8C620000 */  lw        $v0, 0x0($v1)
/* 36DDB4 E006AD94 0040202D */  daddu     $a0, $v0, $zero
/* 36DDB8 E006AD98 24420008 */  addiu     $v0, $v0, 0x8
/* 36DDBC E006AD9C AC620000 */  sw        $v0, 0x0($v1)
/* 36DDC0 E006ADA0 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 36DDC4 E006ADA4 AC820000 */  sw        $v0, 0x0($a0)
/* 36DDC8 E006ADA8 AC800004 */  sw        $zero, 0x4($a0)
/* 36DDCC E006ADAC 8FBF0104 */  lw        $ra, 0x104($sp)
/* 36DDD0 E006ADB0 8FBE0100 */  lw        $fp, 0x100($sp)
/* 36DDD4 E006ADB4 8FB700FC */  lw        $s7, 0xFC($sp)
/* 36DDD8 E006ADB8 8FB600F8 */  lw        $s6, 0xF8($sp)
/* 36DDDC E006ADBC 8FB500F4 */  lw        $s5, 0xF4($sp)
/* 36DDE0 E006ADC0 8FB400F0 */  lw        $s4, 0xF0($sp)
/* 36DDE4 E006ADC4 8FB300EC */  lw        $s3, 0xEC($sp)
/* 36DDE8 E006ADC8 8FB200E8 */  lw        $s2, 0xE8($sp)
/* 36DDEC E006ADCC 8FB100E4 */  lw        $s1, 0xE4($sp)
/* 36DDF0 E006ADD0 8FB000E0 */  lw        $s0, 0xE0($sp)
/* 36DDF4 E006ADD4 D7B80118 */  ldc1      $f24, 0x118($sp)
/* 36DDF8 E006ADD8 D7B60110 */  ldc1      $f22, 0x110($sp)
/* 36DDFC E006ADDC D7B40108 */  ldc1      $f20, 0x108($sp)
/* 36DE00 E006ADE0 03E00008 */  jr        $ra
/* 36DE04 E006ADE4 27BD0120 */   addiu    $sp, $sp, 0x120
/* 36DE08 E006ADE8 00000000 */  nop
/* 36DE0C E006ADEC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void light_rays_appendGfx(void* effect) {
    LightRaysFXData* part = ((EffectInstance*)effect)->data.lightRays;
    s32 type = part->type;
    Gfx* dlist = D_E006ADF0[type];
    Gfx* dlist2 = D_E006AE00[type];
    Matrix4f mtxTransform;
    Matrix4f mtxTemp;
    Matrix4f mtxTranslate;
    s32 i;

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

    shim_guTranslateF(mtxTranslate, part->pos.x, part->pos.y, part->pos.z);

    part++;
    for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) {
        f32 temp = part->alpha / 255.0f;
        f32 angleZ;
        f32 scaleX;
        f32 scaleY;
        f32 scaleZ;
        f32 unk_64;

        if (type >= 2) {
            func_E006A85C(part);
        }

        shim_guRotateF(mtxTemp, part->rotation.x, 1.0f, 0.0f, 0.0f);
        shim_guMtxCatF(mtxTemp, mtxTranslate, mtxTransform);

        if (type >= 2) {
            unk_64 = part->rotation.z;
            if (type == 3) {
                angleZ = unk_64 + 45.0f;
            } else {
                angleZ = unk_64 + 0.0f;
            }

            shim_guRotateF(mtxTemp, angleZ, 0.0f, 0.0f, 1.0f);
            shim_guMtxCatF(mtxTemp, mtxTransform, mtxTransform);
            shim_guRotateF(mtxTemp, part->rotation.y, 0.0f, 1.0f, 0.0f);
            shim_guMtxCatF(mtxTemp, mtxTransform, mtxTransform);
            shim_guTranslateF(mtxTemp, part->unk_58, 0.0f, 0.0f);
            shim_guMtxCatF(mtxTemp, mtxTransform, mtxTransform);

            scaleX = scaleZ = (temp + 3.0f) * 0.25;
            switch (i & 3) {
                case 0:
                    scaleY = temp * 0.3;
                    break;
                case 1:
                    scaleY = temp * 0.5;
                    break;
                case 2:
                    scaleY = temp * 0.9;
                    break;
                case 3:
                default:
                    scaleY = temp;
                    break;
            }

            shim_guScaleF(mtxTemp, scaleX, scaleY, scaleZ);
            shim_guMtxCatF(mtxTemp, mtxTransform, mtxTransform);

            gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 240, part->alpha);
        } else {
            shim_guRotateF(mtxTemp, part->rotation.y, 0.0f, 1.0f, 0.0f);
            shim_guMtxCatF(mtxTemp, mtxTransform, mtxTransform);
            shim_guRotateF(mtxTemp, part->rotation.z, 0.0f, 0.0f, 1.0f);
            shim_guMtxCatF(mtxTemp, mtxTransform, mtxTransform);
            shim_guTranslateF(mtxTemp, part->unk_58, 0.0f, 0.0f);
            shim_guMtxCatF(mtxTemp, mtxTransform, mtxTransform);

            gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 181, part->alpha);
        }

        shim_guMtxF2L(mtxTransform, &gDisplayContext->matrixStack[gMatrixListPos]);

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

    gDPPipeSync(gMainGfxPos++);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel flame_appendGfx
/* 353648 E0040348 27BDFF08 */  addiu     $sp, $sp, -0xF8
/* 35364C E004034C 3C03DB06 */  lui       $v1, (0xDB060024 >> 16)
/* 353650 E0040350 AFB400E8 */  sw        $s4, 0xE8($sp)
/* 353654 E0040354 3C14800A */  lui       $s4, %hi(gMainGfxPos)
/* 353658 E0040358 2694A66C */  addiu     $s4, $s4, %lo(gMainGfxPos)
/* 35365C E004035C 34630024 */  ori       $v1, $v1, (0xDB060024 & 0xFFFF)
/* 353660 E0040360 AFB600F0 */  sw        $s6, 0xF0($sp)
/* 353664 E0040364 3C16E700 */  lui       $s6, (0xE7000000 >> 16)
/* 353668 E0040368 3C0B8000 */  lui       $t3, (0x80000000 >> 16)
/* 35366C E004036C AFBF00F4 */  sw        $ra, 0xF4($sp)
/* 353670 E0040370 AFB500EC */  sw        $s5, 0xEC($sp)
/* 353674 E0040374 AFB300E4 */  sw        $s3, 0xE4($sp)
/* 353678 E0040378 AFB200E0 */  sw        $s2, 0xE0($sp)
/* 35367C E004037C AFB100DC */  sw        $s1, 0xDC($sp)
/* 353680 E0040380 AFB000D8 */  sw        $s0, 0xD8($sp)
/* 353684 E0040384 8E870000 */  lw        $a3, 0x0($s4)
/* 353688 E0040388 8C92000C */  lw        $s2, 0xC($a0)
/* 35368C E004038C 3C014080 */  lui       $at, (0x40800000 >> 16)
/* 353690 E0040390 44812000 */  mtc1      $at, $f4
/* 353694 E0040394 00E0102D */  daddu     $v0, $a3, $zero
/* 353698 E0040398 24E70008 */  addiu     $a3, $a3, 0x8
/* 35369C E004039C AE870000 */  sw        $a3, 0x0($s4)
/* 3536A0 E00403A0 8E4C0000 */  lw        $t4, 0x0($s2)
/* 3536A4 E00403A4 C640001C */  lwc1      $f0, 0x1C($s2)
/* 3536A8 E00403A8 C6420024 */  lwc1      $f2, 0x24($s2)
/* 3536AC E00403AC 3C108007 */  lui       $s0, %hi(gCurrentCameraID)
/* 3536B0 E00403B0 26107410 */  addiu     $s0, $s0, %lo(gCurrentCameraID)
/* 3536B4 E00403B4 AC560000 */  sw        $s6, 0x0($v0)
/* 3536B8 E00403B8 AC400004 */  sw        $zero, 0x4($v0)
/* 3536BC E00403BC ACE30000 */  sw        $v1, 0x0($a3)
/* 3536C0 E00403C0 8C830010 */  lw        $v1, 0x10($a0)
/* 3536C4 E00403C4 24E20008 */  addiu     $v0, $a3, 0x8
/* 3536C8 E00403C8 AE820000 */  sw        $v0, 0x0($s4)
/* 3536CC E00403CC 46040002 */  mul.s     $f0, $f0, $f4
/* 3536D0 E00403D0 00000000 */  nop
/* 3536D4 E00403D4 8C62001C */  lw        $v0, 0x1C($v1)
/* 3536D8 E00403D8 3C15800B */  lui       $s5, %hi(gCameras)
/* 3536DC E00403DC 26B51D80 */  addiu     $s5, $s5, %lo(gCameras)
/* 3536E0 E00403E0 004B1021 */  addu      $v0, $v0, $t3
/* 3536E4 E00403E4 ACE20004 */  sw        $v0, 0x4($a3)
/* 3536E8 E00403E8 8E030000 */  lw        $v1, 0x0($s0)
/* 3536EC E00403EC 46041082 */  mul.s     $f2, $f2, $f4
/* 3536F0 E00403F0 00000000 */  nop
/* 3536F4 E00403F4 00031080 */  sll       $v0, $v1, 2
/* 3536F8 E00403F8 00431021 */  addu      $v0, $v0, $v1
/* 3536FC E00403FC 00021080 */  sll       $v0, $v0, 2
/* 353700 E0040400 00431023 */  subu      $v0, $v0, $v1
/* 353704 E0040404 000218C0 */  sll       $v1, $v0, 3
/* 353708 E0040408 00431021 */  addu      $v0, $v0, $v1
/* 35370C E004040C 000210C0 */  sll       $v0, $v0, 3
/* 353710 E0040410 00554021 */  addu      $t0, $v0, $s5
/* 353714 E0040414 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 353718 E0040418 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 35371C E004041C 3C04E004 */  lui       $a0, %hi(D_E0040880)
/* 353720 E0040420 24840880 */  addiu     $a0, $a0, %lo(D_E0040880)
/* 353724 E0040424 94430134 */  lhu       $v1, 0x134($v0)
/* 353728 E0040428 8C820000 */  lw        $v0, 0x0($a0)
/* 35372C E004042C 4600018D */  trunc.w.s $f6, $f0
/* 353730 E0040430 440A3000 */  mfc1      $t2, $f6
/* 353734 E0040434 4600118D */  trunc.w.s $f6, $f2
/* 353738 E0040438 44093000 */  mfc1      $t1, $f6
/* 35373C E004043C 1043005F */  beq       $v0, $v1, .LE00405BC
/* 353740 E0040440 24E20010 */   addiu    $v0, $a3, 0x10
/* 353744 E0040444 3C06FF10 */  lui       $a2, (0xFF10013F >> 16)
/* 353748 E0040448 34C6013F */  ori       $a2, $a2, (0xFF10013F & 0xFFFF)
/* 35374C E004044C 3C05DE00 */  lui       $a1, (0xDE000000 >> 16)
/* 353750 E0040450 AC830000 */  sw        $v1, 0x0($a0)
/* 353754 E0040454 AE820000 */  sw        $v0, 0x0($s4)
/* 353758 E0040458 3C020900 */  lui       $v0, %hi(D_09000918_415978)
/* 35375C E004045C 24420918 */  addiu     $v0, $v0, %lo(D_09000918_415978)
/* 353760 E0040460 31430FFF */  andi      $v1, $t2, 0xFFF
/* 353764 E0040464 00031B00 */  sll       $v1, $v1, 12
/* 353768 E0040468 ACE2000C */  sw        $v0, 0xC($a3)
/* 35376C E004046C 31220FFF */  andi      $v0, $t1, 0xFFF
/* 353770 E0040470 3C04F200 */  lui       $a0, (0xF2000000 >> 16)
/* 353774 E0040474 00441025 */  or        $v0, $v0, $a0
/* 353778 E0040478 00621825 */  or        $v1, $v1, $v0
/* 35377C E004047C 25420080 */  addiu     $v0, $t2, 0x80
/* 353780 E0040480 30420FFF */  andi      $v0, $v0, 0xFFF
/* 353784 E0040484 00021300 */  sll       $v0, $v0, 12
/* 353788 E0040488 ACE30010 */  sw        $v1, 0x10($a3)
/* 35378C E004048C 25230100 */  addiu     $v1, $t1, 0x100
/* 353790 E0040490 30630FFF */  andi      $v1, $v1, 0xFFF
/* 353794 E0040494 3C040100 */  lui       $a0, (0x1000000 >> 16)
/* 353798 E0040498 00641825 */  or        $v1, $v1, $a0
/* 35379C E004049C 00431025 */  or        $v0, $v0, $v1
/* 3537A0 E00404A0 ACE20014 */  sw        $v0, 0x14($a3)
/* 3537A4 E00404A4 3C020900 */  lui       $v0, %hi(D_090009E0_415A40)
/* 3537A8 E00404A8 244209E0 */  addiu     $v0, $v0, %lo(D_090009E0_415A40)
/* 3537AC E00404AC 3C03800A */  lui       $v1, %hi(nuGfxCfb_ptr)
/* 3537B0 E00404B0 8C63A64C */  lw        $v1, %lo(nuGfxCfb_ptr)($v1)
/* 3537B4 E00404B4 3C04ED00 */  lui       $a0, (0xED000000 >> 16)
/* 3537B8 E00404B8 ACE50008 */  sw        $a1, 0x8($a3)
/* 3537BC E00404BC ACE50018 */  sw        $a1, 0x18($a3)
/* 3537C0 E00404C0 ACE2001C */  sw        $v0, 0x1C($a3)
/* 3537C4 E00404C4 ACE60020 */  sw        $a2, 0x20($a3)
/* 3537C8 E00404C8 006B1821 */  addu      $v1, $v1, $t3
/* 3537CC E00404CC ACE30024 */  sw        $v1, 0x24($a3)
/* 3537D0 E00404D0 8502000E */  lh        $v0, 0xE($t0)
/* 3537D4 E00404D4 24E30018 */  addiu     $v1, $a3, 0x18
/* 3537D8 E00404D8 44821000 */  mtc1      $v0, $f2
/* 3537DC E00404DC 00000000 */  nop
/* 3537E0 E00404E0 468010A0 */  cvt.s.w   $f2, $f2
/* 3537E4 E00404E4 46041082 */  mul.s     $f2, $f2, $f4
/* 3537E8 E00404E8 00000000 */  nop
/* 3537EC E00404EC AE830000 */  sw        $v1, 0x0($s4)
/* 3537F0 E00404F0 85020010 */  lh        $v0, 0x10($t0)
/* 3537F4 E00404F4 24E30020 */  addiu     $v1, $a3, 0x20
/* 3537F8 E00404F8 44820000 */  mtc1      $v0, $f0
/* 3537FC E00404FC 00000000 */  nop
/* 353800 E0040500 46800020 */  cvt.s.w   $f0, $f0
/* 353804 E0040504 46040002 */  mul.s     $f0, $f0, $f4
/* 353808 E0040508 00000000 */  nop
/* 35380C E004050C AE830000 */  sw        $v1, 0x0($s4)
/* 353810 E0040510 4600118D */  trunc.w.s $f6, $f2
/* 353814 E0040514 44023000 */  mfc1      $v0, $f6
/* 353818 E0040518 00000000 */  nop
/* 35381C E004051C 30420FFF */  andi      $v0, $v0, 0xFFF
/* 353820 E0040520 00021300 */  sll       $v0, $v0, 12
/* 353824 E0040524 4600018D */  trunc.w.s $f6, $f0
/* 353828 E0040528 44033000 */  mfc1      $v1, $f6
/* 35382C E004052C 00000000 */  nop
/* 353830 E0040530 30630FFF */  andi      $v1, $v1, 0xFFF
/* 353834 E0040534 00641825 */  or        $v1, $v1, $a0
/* 353838 E0040538 00431025 */  or        $v0, $v0, $v1
/* 35383C E004053C ACE20028 */  sw        $v0, 0x28($a3)
/* 353840 E0040540 8503000E */  lh        $v1, 0xE($t0)
/* 353844 E0040544 8504000A */  lh        $a0, 0xA($t0)
/* 353848 E0040548 24E20028 */  addiu     $v0, $a3, 0x28
/* 35384C E004054C AE820000 */  sw        $v0, 0x0($s4)
/* 353850 E0040550 85020010 */  lh        $v0, 0x10($t0)
/* 353854 E0040554 00641821 */  addu      $v1, $v1, $a0
/* 353858 E0040558 44831000 */  mtc1      $v1, $f2
/* 35385C E004055C 00000000 */  nop
/* 353860 E0040560 468010A0 */  cvt.s.w   $f2, $f2
/* 353864 E0040564 46041082 */  mul.s     $f2, $f2, $f4
/* 353868 E0040568 00000000 */  nop
/* 35386C E004056C 8503000C */  lh        $v1, 0xC($t0)
/* 353870 E0040570 24E40030 */  addiu     $a0, $a3, 0x30
/* 353874 E0040574 00431021 */  addu      $v0, $v0, $v1
/* 353878 E0040578 44820000 */  mtc1      $v0, $f0
/* 35387C E004057C 00000000 */  nop
/* 353880 E0040580 46800020 */  cvt.s.w   $f0, $f0
/* 353884 E0040584 46040002 */  mul.s     $f0, $f0, $f4
/* 353888 E0040588 00000000 */  nop
/* 35388C E004058C AE840000 */  sw        $a0, 0x0($s4)
/* 353890 E0040590 4600118D */  trunc.w.s $f6, $f2
/* 353894 E0040594 44023000 */  mfc1      $v0, $f6
/* 353898 E0040598 00000000 */  nop
/* 35389C E004059C 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3538A0 E00405A0 00021300 */  sll       $v0, $v0, 12
/* 3538A4 E00405A4 4600018D */  trunc.w.s $f6, $f0
/* 3538A8 E00405A8 44033000 */  mfc1      $v1, $f6
/* 3538AC E00405AC 00000000 */  nop
/* 3538B0 E00405B0 30630FFF */  andi      $v1, $v1, 0xFFF
/* 3538B4 E00405B4 00431025 */  or        $v0, $v0, $v1
/* 3538B8 E00405B8 ACE2002C */  sw        $v0, 0x2C($a3)
.LE00405BC:
/* 3538BC E00405BC 3C13DE00 */  lui       $s3, (0xDE000000 >> 16)
/* 3538C0 E00405C0 3C02E004 */  lui       $v0, %hi(D_E0040840)
/* 3538C4 E00405C4 24420840 */  addiu     $v0, $v0, %lo(D_E0040840)
/* 3538C8 E00405C8 000C3100 */  sll       $a2, $t4, 4
/* 3538CC E00405CC 8E850000 */  lw        $a1, 0x0($s4)
/* 3538D0 E00405D0 00C23021 */  addu      $a2, $a2, $v0
/* 3538D4 E00405D4 00A0202D */  daddu     $a0, $a1, $zero
/* 3538D8 E00405D8 24A50008 */  addiu     $a1, $a1, 0x8
/* 3538DC E00405DC AE850000 */  sw        $a1, 0x0($s4)
/* 3538E0 E00405E0 AC930000 */  sw        $s3, 0x0($a0)
/* 3538E4 E00405E4 8CC3000C */  lw        $v1, 0xC($a2)
/* 3538E8 E00405E8 24A20008 */  addiu     $v0, $a1, 0x8
/* 3538EC E00405EC AE820000 */  sw        $v0, 0x0($s4)
/* 3538F0 E00405F0 3C02EB00 */  lui       $v0, (0xEB000000 >> 16)
/* 3538F4 E00405F4 AC830004 */  sw        $v1, 0x4($a0)
/* 3538F8 E00405F8 ACA20000 */  sw        $v0, 0x0($a1)
/* 3538FC E00405FC 90C30003 */  lbu       $v1, 0x3($a2)
/* 353900 E0040600 90C40000 */  lbu       $a0, 0x0($a2)
/* 353904 E0040604 24A20010 */  addiu     $v0, $a1, 0x10
/* 353908 E0040608 AE820000 */  sw        $v0, 0x0($s4)
/* 35390C E004060C 3C02EA00 */  lui       $v0, (0xEA000000 >> 16)
/* 353910 E0040610 ACA20008 */  sw        $v0, 0x8($a1)
/* 353914 E0040614 00031A00 */  sll       $v1, $v1, 8
/* 353918 E0040618 00641825 */  or        $v1, $v1, $a0
/* 35391C E004061C ACA30004 */  sw        $v1, 0x4($a1)
/* 353920 E0040620 90C40003 */  lbu       $a0, 0x3($a2)
/* 353924 E0040624 90C30001 */  lbu       $v1, 0x1($a2)
/* 353928 E0040628 90C70002 */  lbu       $a3, 0x2($a2)
/* 35392C E004062C 24A20018 */  addiu     $v0, $a1, 0x18
/* 353930 E0040630 AE820000 */  sw        $v0, 0x0($s4)
/* 353934 E0040634 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 353938 E0040638 ACA20010 */  sw        $v0, 0x10($a1)
/* 35393C E004063C 00041600 */  sll       $v0, $a0, 24
/* 353940 E0040640 00031C00 */  sll       $v1, $v1, 16
/* 353944 E0040644 00431025 */  or        $v0, $v0, $v1
/* 353948 E0040648 00042200 */  sll       $a0, $a0, 8
/* 35394C E004064C 00441025 */  or        $v0, $v0, $a0
/* 353950 E0040650 00471025 */  or        $v0, $v0, $a3
/* 353954 E0040654 ACA2000C */  sw        $v0, 0xC($a1)
/* 353958 E0040658 90C40007 */  lbu       $a0, 0x7($a2)
/* 35395C E004065C 24A20020 */  addiu     $v0, $a1, 0x20
/* 353960 E0040660 AE820000 */  sw        $v0, 0x0($s4)
/* 353964 E0040664 3C02FB00 */  lui       $v0, (0xFB000000 >> 16)
/* 353968 E0040668 ACA20018 */  sw        $v0, 0x18($a1)
/* 35396C E004066C 00041600 */  sll       $v0, $a0, 24
/* 353970 E0040670 00041C00 */  sll       $v1, $a0, 16
/* 353974 E0040674 00431025 */  or        $v0, $v0, $v1
/* 353978 E0040678 00042200 */  sll       $a0, $a0, 8
/* 35397C E004067C 00441025 */  or        $v0, $v0, $a0
/* 353980 E0040680 ACA20014 */  sw        $v0, 0x14($a1)
/* 353984 E0040684 90C20004 */  lbu       $v0, 0x4($a2)
/* 353988 E0040688 90C40005 */  lbu       $a0, 0x5($a2)
/* 35398C E004068C 90C30006 */  lbu       $v1, 0x6($a2)
/* 353990 E0040690 00021600 */  sll       $v0, $v0, 24
/* 353994 E0040694 00042400 */  sll       $a0, $a0, 16
/* 353998 E0040698 00441025 */  or        $v0, $v0, $a0
/* 35399C E004069C 00031A00 */  sll       $v1, $v1, 8
/* 3539A0 E00406A0 00431025 */  or        $v0, $v0, $v1
/* 3539A4 E00406A4 ACA2001C */  sw        $v0, 0x1C($a1)
/* 3539A8 E00406A8 8E450004 */  lw        $a1, 0x4($s2)
/* 3539AC E00406AC 8E460008 */  lw        $a2, 0x8($s2)
/* 3539B0 E00406B0 8E47000C */  lw        $a3, 0xC($s2)
/* 3539B4 E00406B4 0C080108 */  jal       shim_guTranslateF
/* 3539B8 E00406B8 27A40018 */   addiu    $a0, $sp, 0x18
/* 3539BC E00406BC 27B10058 */  addiu     $s1, $sp, 0x58
/* 3539C0 E00406C0 8E030000 */  lw        $v1, 0x0($s0)
/* 3539C4 E00406C4 44800000 */  mtc1      $zero, $f0
/* 3539C8 E00406C8 00031080 */  sll       $v0, $v1, 2
/* 3539CC E00406CC 00431021 */  addu      $v0, $v0, $v1
/* 3539D0 E00406D0 00021080 */  sll       $v0, $v0, 2
/* 3539D4 E00406D4 00431023 */  subu      $v0, $v0, $v1
/* 3539D8 E00406D8 000218C0 */  sll       $v1, $v0, 3
/* 3539DC E00406DC 00431021 */  addu      $v0, $v0, $v1
/* 3539E0 E00406E0 000210C0 */  sll       $v0, $v0, 3
/* 3539E4 E00406E4 00551021 */  addu      $v0, $v0, $s5
/* 3539E8 E00406E8 44060000 */  mfc1      $a2, $f0
/* 3539EC E00406EC C440006C */  lwc1      $f0, 0x6C($v0)
/* 3539F0 E00406F0 3C073F80 */  lui       $a3, (0x3F800000 >> 16)
/* 3539F4 E00406F4 46000007 */  neg.s     $f0, $f0
/* 3539F8 E00406F8 44050000 */  mfc1      $a1, $f0
/* 3539FC E00406FC 0220202D */  daddu     $a0, $s1, $zero
/* 353A00 E0040700 0C080104 */  jal       shim_guRotateF
/* 353A04 E0040704 AFA60010 */   sw       $a2, 0x10($sp)
/* 353A08 E0040708 0220202D */  daddu     $a0, $s1, $zero
/* 353A0C E004070C 27A50018 */  addiu     $a1, $sp, 0x18
/* 353A10 E0040710 27B00098 */  addiu     $s0, $sp, 0x98
/* 353A14 E0040714 0C080114 */  jal       shim_guMtxCatF
/* 353A18 E0040718 0200302D */   daddu    $a2, $s0, $zero
/* 353A1C E004071C C6420010 */  lwc1      $f2, 0x10($s2)
/* 353A20 E0040720 C6400030 */  lwc1      $f0, 0x30($s2)
/* 353A24 E0040724 46001002 */  mul.s     $f0, $f2, $f0
/* 353A28 E0040728 00000000 */  nop
/* 353A2C E004072C 44050000 */  mfc1      $a1, $f0
/* 353A30 E0040730 C640002C */  lwc1      $f0, 0x2C($s2)
/* 353A34 E0040734 46001002 */  mul.s     $f0, $f2, $f0
/* 353A38 E0040738 00000000 */  nop
/* 353A3C E004073C 0220202D */  daddu     $a0, $s1, $zero
/* 353A40 E0040740 44071000 */  mfc1      $a3, $f2
/* 353A44 E0040744 3C120001 */  lui       $s2, (0x11630 >> 16)
/* 353A48 E0040748 44060000 */  mfc1      $a2, $f0
/* 353A4C E004074C 0C080110 */  jal       shim_guScaleF
/* 353A50 E0040750 36521630 */   ori      $s2, $s2, (0x11630 & 0xFFFF)
/* 353A54 E0040754 0220202D */  daddu     $a0, $s1, $zero
/* 353A58 E0040758 0200282D */  daddu     $a1, $s0, $zero
/* 353A5C E004075C 0C080114 */  jal       shim_guMtxCatF
/* 353A60 E0040760 0200302D */   daddu    $a2, $s0, $zero
/* 353A64 E0040764 0200202D */  daddu     $a0, $s0, $zero
/* 353A68 E0040768 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* 353A6C E004076C 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* 353A70 E0040770 3C11800A */  lui       $s1, %hi(gDisplayContext)
/* 353A74 E0040774 2631A674 */  addiu     $s1, $s1, %lo(gDisplayContext)
/* 353A78 E0040778 96050000 */  lhu       $a1, 0x0($s0)
/* 353A7C E004077C 8E220000 */  lw        $v0, 0x0($s1)
/* 353A80 E0040780 00052980 */  sll       $a1, $a1, 6
/* 353A84 E0040784 00B22821 */  addu      $a1, $a1, $s2
/* 353A88 E0040788 0C080118 */  jal       shim_guMtxF2L
/* 353A8C E004078C 00452821 */   addu     $a1, $v0, $a1
/* 353A90 E0040790 3C06D838 */  lui       $a2, (0xD8380002 >> 16)
/* 353A94 E0040794 8E840000 */  lw        $a0, 0x0($s4)
/* 353A98 E0040798 34C60002 */  ori       $a2, $a2, (0xD8380002 & 0xFFFF)
/* 353A9C E004079C 0080282D */  daddu     $a1, $a0, $zero
/* 353AA0 E00407A0 24840008 */  addiu     $a0, $a0, 0x8
/* 353AA4 E00407A4 AE840000 */  sw        $a0, 0x0($s4)
/* 353AA8 E00407A8 96020000 */  lhu       $v0, 0x0($s0)
/* 353AAC E00407AC 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 353AB0 E00407B0 ACA30000 */  sw        $v1, 0x0($a1)
/* 353AB4 E00407B4 24430001 */  addiu     $v1, $v0, 0x1
/* 353AB8 E00407B8 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 353ABC E00407BC 00021180 */  sll       $v0, $v0, 6
/* 353AC0 E00407C0 A6030000 */  sh        $v1, 0x0($s0)
/* 353AC4 E00407C4 8E230000 */  lw        $v1, 0x0($s1)
/* 353AC8 E00407C8 00521021 */  addu      $v0, $v0, $s2
/* 353ACC E00407CC 00621821 */  addu      $v1, $v1, $v0
/* 353AD0 E00407D0 24820008 */  addiu     $v0, $a0, 0x8
/* 353AD4 E00407D4 ACA30004 */  sw        $v1, 0x4($a1)
/* 353AD8 E00407D8 AE820000 */  sw        $v0, 0x0($s4)
/* 353ADC E00407DC 3C020900 */  lui       $v0, %hi(D_090008F8_415958)
/* 353AE0 E00407E0 244208F8 */  addiu     $v0, $v0, %lo(D_090008F8_415958)
/* 353AE4 E00407E4 AC820004 */  sw        $v0, 0x4($a0)
/* 353AE8 E00407E8 24820010 */  addiu     $v0, $a0, 0x10
/* 353AEC E00407EC AC930000 */  sw        $s3, 0x0($a0)
/* 353AF0 E00407F0 AE820000 */  sw        $v0, 0x0($s4)
/* 353AF4 E00407F4 24020040 */  addiu     $v0, $zero, 0x40
/* 353AF8 E00407F8 AC82000C */  sw        $v0, 0xC($a0)
/* 353AFC E00407FC 24820018 */  addiu     $v0, $a0, 0x18
/* 353B00 E0040800 AC860008 */  sw        $a2, 0x8($a0)
/* 353B04 E0040804 AE820000 */  sw        $v0, 0x0($s4)
/* 353B08 E0040808 AC960010 */  sw        $s6, 0x10($a0)
/* 353B0C E004080C AC800014 */  sw        $zero, 0x14($a0)
/* 353B10 E0040810 8FBF00F4 */  lw        $ra, 0xF4($sp)
/* 353B14 E0040814 8FB600F0 */  lw        $s6, 0xF0($sp)
/* 353B18 E0040818 8FB500EC */  lw        $s5, 0xEC($sp)
/* 353B1C E004081C 8FB400E8 */  lw        $s4, 0xE8($sp)
/* 353B20 E0040820 8FB300E4 */  lw        $s3, 0xE4($sp)
/* 353B24 E0040824 8FB200E0 */  lw        $s2, 0xE0($sp)
/* 353B28 E0040828 8FB100DC */  lw        $s1, 0xDC($sp)
/* 353B2C E004082C 8FB000D8 */  lw        $s0, 0xD8($sp)
/* 353B30 E0040830 03E00008 */  jr        $ra
/* 353B34 E0040834 27BD00F8 */   addiu    $sp, $sp, 0xF8
/* 353B38 E0040838 00000000 */  nop
/* 353B3C E004083C 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void flame_appendGfx(void* effect) {
    FlameFXData* data = ((EffectInstance*)effect)->data.flame;
    Camera* camera = &gCameras[gCurrentCameraID];
    s32 unk_00 = data->unk_00;
    s32 uls = data->unk_1C * 4.0f;
    s32 ult = data->unk_24 * 4.0f;
    UnkStruct* unkStruct;
    Matrix4f sp18;
    Matrix4f sp58;
    Matrix4f sp98;

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

    if (D_E0040880 != gGameStatusPtr->frameCounter) {
        D_E0040880 = gGameStatusPtr->frameCounter;
        gSPDisplayList(gMainGfxPos++, D_09000918_3544C8);
        gDPSetTileSize(gMainGfxPos++, 1, uls, ult, uls + 128, ult + 256);
        gSPDisplayList(gMainGfxPos++, D_090009E0_354590);
        gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, VIRTUAL_TO_PHYSICAL(nuGfxCfb_ptr));
        gDPSetScissorFrac(gMainGfxPos++, G_SC_NON_INTERLACE,
            camera->viewportStartX * 4.0f,
            camera->viewportStartY * 4.0f,
            (camera->viewportStartX + camera->viewportW) * 4.0f,
            (camera->viewportStartY + camera->viewportH) * 4.0f);
    }

    unkStruct = &D_E0040840[unk_00];

    gSPDisplayList(gMainGfxPos++, unkStruct->unk_0C);
    gDPSetKeyR(gMainGfxPos++, unkStruct->unk_03, unkStruct->unk_00, 0);
    gDPSetKeyGB(gMainGfxPos++, unkStruct->unk_03, unkStruct->unk_01, 0, unkStruct->unk_03, unkStruct->unk_02, 0);
    gDPSetPrimColor(gMainGfxPos++, 0, 0, unkStruct->unk_07, unkStruct->unk_07, unkStruct->unk_07, 0);
    gDPSetEnvColor(gMainGfxPos++, unkStruct->unk_04, unkStruct->unk_05, unkStruct->unk_06, 0);

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

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


### RAW ASSEMBLY INSTRUCTIONS:

glabel RunPartTo
/* 1A958C 8027ACAC 27BDFFB0 */  addiu     $sp, $sp, -0x50
/* 1A9590 8027ACB0 AFB40028 */  sw        $s4, 0x28($sp)
/* 1A9594 8027ACB4 0080A02D */  daddu     $s4, $a0, $zero
/* 1A9598 8027ACB8 AFBF002C */  sw        $ra, 0x2C($sp)
/* 1A959C 8027ACBC AFB30024 */  sw        $s3, 0x24($sp)
/* 1A95A0 8027ACC0 AFB20020 */  sw        $s2, 0x20($sp)
/* 1A95A4 8027ACC4 AFB1001C */  sw        $s1, 0x1C($sp)
/* 1A95A8 8027ACC8 AFB00018 */  sw        $s0, 0x18($sp)
/* 1A95AC 8027ACCC F7BA0048 */  sdc1      $f26, 0x48($sp)
/* 1A95B0 8027ACD0 F7B80040 */  sdc1      $f24, 0x40($sp)
/* 1A95B4 8027ACD4 F7B60038 */  sdc1      $f22, 0x38($sp)
/* 1A95B8 8027ACD8 F7B40030 */  sdc1      $f20, 0x30($sp)
/* 1A95BC 8027ACDC 8E91000C */  lw        $s1, 0xC($s4)
/* 1A95C0 8027ACE0 54A00001 */  bnel      $a1, $zero, .L8027ACE8
/* 1A95C4 8027ACE4 AE800070 */   sw       $zero, 0x70($s4)
.L8027ACE8:
/* 1A95C8 8027ACE8 8E820070 */  lw        $v0, 0x70($s4)
/* 1A95CC 8027ACEC 1440006F */  bnez      $v0, .L8027AEAC
/* 1A95D0 8027ACF0 00000000 */   nop
/* 1A95D4 8027ACF4 8E250000 */  lw        $a1, 0x0($s1)
/* 1A95D8 8027ACF8 26310004 */  addiu     $s1, $s1, 0x4
/* 1A95DC 8027ACFC 0C0B1EAF */  jal       evt_get_variable
/* 1A95E0 8027AD00 0280202D */   daddu    $a0, $s4, $zero
/* 1A95E4 8027AD04 0040802D */  daddu     $s0, $v0, $zero
/* 1A95E8 8027AD08 2402FF81 */  addiu     $v0, $zero, -0x7F
/* 1A95EC 8027AD0C 16020002 */  bne       $s0, $v0, .L8027AD18
/* 1A95F0 8027AD10 00000000 */   nop
/* 1A95F4 8027AD14 8E900148 */  lw        $s0, 0x148($s4)
.L8027AD18:
/* 1A95F8 8027AD18 8E250000 */  lw        $a1, 0x0($s1)
/* 1A95FC 8027AD1C 26310004 */  addiu     $s1, $s1, 0x4
/* 1A9600 8027AD20 0C0B1EAF */  jal       evt_get_variable
/* 1A9604 8027AD24 0280202D */   daddu    $a0, $s4, $zero
/* 1A9608 8027AD28 0200202D */  daddu     $a0, $s0, $zero
/* 1A960C 8027AD2C 0C09A75B */  jal       get_actor
/* 1A9610 8027AD30 0040802D */   daddu    $s0, $v0, $zero
/* 1A9614 8027AD34 0040982D */  daddu     $s3, $v0, $zero
/* 1A9618 8027AD38 0260202D */  daddu     $a0, $s3, $zero
/* 1A961C 8027AD3C 0C099117 */  jal       get_actor_part
/* 1A9620 8027AD40 0200282D */   daddu    $a1, $s0, $zero
/* 1A9624 8027AD44 0040902D */  daddu     $s2, $v0, $zero
/* 1A9628 8027AD48 AE930074 */  sw        $s3, 0x74($s4)
/* 1A962C 8027AD4C AE920078 */  sw        $s2, 0x78($s4)
/* 1A9630 8027AD50 8E250000 */  lw        $a1, 0x0($s1)
/* 1A9634 8027AD54 26310004 */  addiu     $s1, $s1, 0x4
/* 1A9638 8027AD58 8E500010 */  lw        $s0, 0x10($s2)
/* 1A963C 8027AD5C 0C0B1EAF */  jal       evt_get_variable
/* 1A9640 8027AD60 0280202D */   daddu    $a0, $s4, $zero
/* 1A9644 8027AD64 4482D000 */  mtc1      $v0, $f26
/* 1A9648 8027AD68 00000000 */  nop
/* 1A964C 8027AD6C 4680D6A0 */  cvt.s.w   $f26, $f26
/* 1A9650 8027AD70 8E250000 */  lw        $a1, 0x0($s1)
/* 1A9654 8027AD74 26310004 */  addiu     $s1, $s1, 0x4
/* 1A9658 8027AD78 0C0B1EAF */  jal       evt_get_variable
/* 1A965C 8027AD7C 0280202D */   daddu    $a0, $s4, $zero
/* 1A9660 8027AD80 8E250000 */  lw        $a1, 0x0($s1)
/* 1A9664 8027AD84 26310004 */  addiu     $s1, $s1, 0x4
/* 1A9668 8027AD88 4482A000 */  mtc1      $v0, $f20
/* 1A966C 8027AD8C 00000000 */  nop
/* 1A9670 8027AD90 4680A520 */  cvt.s.w   $f20, $f20
/* 1A9674 8027AD94 0C0B1EAF */  jal       evt_get_variable
/* 1A9678 8027AD98 0280202D */   daddu    $a0, $s4, $zero
/* 1A967C 8027AD9C 44820000 */  mtc1      $v0, $f0
/* 1A9680 8027ADA0 00000000 */  nop
/* 1A9684 8027ADA4 46800020 */  cvt.s.w   $f0, $f0
/* 1A9688 8027ADA8 E61A000C */  swc1      $f26, 0xC($s0)
/* 1A968C 8027ADAC E6140010 */  swc1      $f20, 0x10($s0)
/* 1A9690 8027ADB0 E6000014 */  swc1      $f0, 0x14($s0)
/* 1A9694 8027ADB4 8E250000 */  lw        $a1, 0x0($s1)
/* 1A9698 8027ADB8 0C0B1EAF */  jal       evt_get_variable
/* 1A969C 8027ADBC 0280202D */   daddu    $a0, $s4, $zero
/* 1A96A0 8027ADC0 A6020038 */  sh        $v0, 0x38($s0)
/* 1A96A4 8027ADC4 C640002C */  lwc1      $f0, 0x2C($s2)
/* 1A96A8 8027ADC8 C616000C */  lwc1      $f22, 0xC($s0)
/* 1A96AC 8027ADCC C6180014 */  lwc1      $f24, 0x14($s0)
/* 1A96B0 8027ADD0 E6000000 */  swc1      $f0, 0x0($s0)
/* 1A96B4 8027ADD4 46000686 */  mov.s     $f26, $f0
/* 1A96B8 8027ADD8 4406B000 */  mfc1      $a2, $f22
/* 1A96BC 8027ADDC C6400030 */  lwc1      $f0, 0x30($s2)
/* 1A96C0 8027ADE0 4600D306 */  mov.s     $f12, $f26
/* 1A96C4 8027ADE4 E6000004 */  swc1      $f0, 0x4($s0)
/* 1A96C8 8027ADE8 C6540034 */  lwc1      $f20, 0x34($s2)
/* 1A96CC 8027ADEC 4407C000 */  mfc1      $a3, $f24
/* 1A96D0 8027ADF0 4600A386 */  mov.s     $f14, $f20
/* 1A96D4 8027ADF4 0C00A720 */  jal       atan2
/* 1A96D8 8027ADF8 E6140008 */   swc1     $f20, 0x8($s0)
/* 1A96DC 8027ADFC 4600D306 */  mov.s     $f12, $f26
/* 1A96E0 8027AE00 4406B000 */  mfc1      $a2, $f22
/* 1A96E4 8027AE04 4407C000 */  mfc1      $a3, $f24
/* 1A96E8 8027AE08 4600A386 */  mov.s     $f14, $f20
/* 1A96EC 8027AE0C 0C00A7B5 */  jal       dist2D
/* 1A96F0 8027AE10 E6000030 */   swc1     $f0, 0x30($s0)
/* 1A96F4 8027AE14 86020038 */  lh        $v0, 0x38($s0)
/* 1A96F8 8027AE18 46000086 */  mov.s     $f2, $f0
/* 1A96FC 8027AE1C 14400007 */  bnez      $v0, .L8027AE3C
/* 1A9700 8027AE20 E6020034 */   swc1     $f2, 0x34($s0)
/* 1A9704 8027AE24 C6000028 */  lwc1      $f0, 0x28($s0)
/* 1A9708 8027AE28 46001003 */  div.s     $f0, $f2, $f0
/* 1A970C 8027AE2C 4600010D */  trunc.w.s $f4, $f0
/* 1A9710 8027AE30 44022000 */  mfc1      $v0, $f4
/* 1A9714 8027AE34 0809EB94 */  j         .L8027AE50
/* 1A9718 8027AE38 A6020038 */   sh       $v0, 0x38($s0)
.L8027AE3C:
/* 1A971C 8027AE3C 44820000 */  mtc1      $v0, $f0
/* 1A9720 8027AE40 00000000 */  nop
/* 1A9724 8027AE44 46800020 */  cvt.s.w   $f0, $f0
/* 1A9728 8027AE48 46001003 */  div.s     $f0, $f2, $f0
/* 1A972C 8027AE4C E6000028 */  swc1      $f0, 0x28($s0)
.L8027AE50:
/* 1A9730 8027AE50 864200BC */  lh        $v0, 0xBC($s2)
/* 1A9734 8027AE54 04420002 */  bltzl     $v0, .L8027AE60
/* 1A9738 8027AE58 00021027 */   nor      $v0, $zero, $v0
/* 1A973C 8027AE5C 24420001 */  addiu     $v0, $v0, 0x1
.L8027AE60:
/* 1A9740 8027AE60 44820000 */  mtc1      $v0, $f0
/* 1A9744 8027AE64 00000000 */  nop
/* 1A9748 8027AE68 46800020 */  cvt.s.w   $f0, $f0
/* 1A974C 8027AE6C E6000034 */  swc1      $f0, 0x34($s0)
/* 1A9750 8027AE70 8E4200A4 */  lw        $v0, 0xA4($s2)
/* 1A9754 8027AE74 1040000C */  beqz      $v0, .L8027AEA8
/* 1A9758 8027AE78 24020001 */   addiu    $v0, $zero, 0x1
/* 1A975C 8027AE7C 8E4200A8 */  lw        $v0, 0xA8($s2)
/* 1A9760 8027AE80 14400009 */  bnez      $v0, .L8027AEA8
/* 1A9764 8027AE84 24020001 */   addiu    $v0, $zero, 0x1
/* 1A9768 8027AE88 C6400034 */  lwc1      $f0, 0x34($s2)
/* 1A976C 8027AE8C E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A9770 8027AE90 8E4400A4 */  lw        $a0, 0xA4($s2)
/* 1A9774 8027AE94 8E46002C */  lw        $a2, 0x2C($s2)
/* 1A9778 8027AE98 8E470030 */  lw        $a3, 0x30($s2)
/* 1A977C 8027AE9C 0C052757 */  jal       sfx_play_sound_at_position
/* 1A9780 8027AEA0 0000282D */   daddu    $a1, $zero, $zero
/* 1A9784 8027AEA4 24020001 */  addiu     $v0, $zero, 0x1
.L8027AEA8:
/* 1A9788 8027AEA8 AE820070 */  sw        $v0, 0x70($s4)
.L8027AEAC:
/* 1A978C 8027AEAC 8E920078 */  lw        $s2, 0x78($s4)
/* 1A9790 8027AEB0 8E500010 */  lw        $s0, 0x10($s2)
/* 1A9794 8027AEB4 8E930074 */  lw        $s3, 0x74($s4)
/* 1A9798 8027AEB8 8E050028 */  lw        $a1, 0x28($s0)
/* 1A979C 8027AEBC 8E060030 */  lw        $a2, 0x30($s0)
/* 1A97A0 8027AEC0 0C099070 */  jal       add_xz_vec3f_copy1
/* 1A97A4 8027AEC4 0200202D */   daddu    $a0, $s0, $zero
/* 1A97A8 8027AEC8 C6020028 */  lwc1      $f2, 0x28($s0)
/* 1A97AC 8027AECC 3C014080 */  lui       $at, (0x40800000 >> 16)
/* 1A97B0 8027AED0 44810000 */  mtc1      $at, $f0
/* 1A97B4 8027AED4 00000000 */  nop
/* 1A97B8 8027AED8 4600103C */  c.lt.s    $f2, $f0
/* 1A97BC 8027AEDC 00000000 */  nop
/* 1A97C0 8027AEE0 45000007 */  bc1f      .L8027AF00
/* 1A97C4 8027AEE4 0000202D */   daddu    $a0, $zero, $zero
/* 1A97C8 8027AEE8 C6000030 */  lwc1      $f0, 0x30($s0)
/* 1A97CC 8027AEEC E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A97D0 8027AEF0 8E050000 */  lw        $a1, 0x0($s0)
/* 1A97D4 8027AEF4 8E060004 */  lw        $a2, 0x4($s0)
/* 1A97D8 8027AEF8 0809EBC6 */  j         .L8027AF18
/* 1A97DC 8027AEFC 8E070008 */   lw       $a3, 0x8($s0)
.L8027AF00:
/* 1A97E0 8027AF00 C6000030 */  lwc1      $f0, 0x30($s0)
/* 1A97E4 8027AF04 E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A97E8 8027AF08 8E050000 */  lw        $a1, 0x0($s0)
/* 1A97EC 8027AF0C 8E060004 */  lw        $a2, 0x4($s0)
/* 1A97F0 8027AF10 8E070008 */  lw        $a3, 0x8($s0)
/* 1A97F4 8027AF14 24040001 */  addiu     $a0, $zero, 0x1
.L8027AF18:
/* 1A97F8 8027AF18 0C0990BC */  jal       play_movement_dust_effects
/* 1A97FC 8027AF1C 00000000 */   nop
/* 1A9800 8027AF20 C6000000 */  lwc1      $f0, 0x0($s0)
/* 1A9804 8027AF24 8E4200A4 */  lw        $v0, 0xA4($s2)
/* 1A9808 8027AF28 E640002C */  swc1      $f0, 0x2C($s2)
/* 1A980C 8027AF2C C6000004 */  lwc1      $f0, 0x4($s0)
/* 1A9810 8027AF30 E6400030 */  swc1      $f0, 0x30($s2)
/* 1A9814 8027AF34 C6000008 */  lwc1      $f0, 0x8($s0)
/* 1A9818 8027AF38 1040004A */  beqz      $v0, .L8027B064
/* 1A981C 8027AF3C E6400034 */   swc1     $f0, 0x34($s2)
/* 1A9820 8027AF40 8E4200A8 */  lw        $v0, 0xA8($s2)
/* 1A9824 8027AF44 10400047 */  beqz      $v0, .L8027B064
/* 1A9828 8027AF48 00000000 */   nop
/* 1A982C 8027AF4C 864200BC */  lh        $v0, 0xBC($s2)
/* 1A9830 8027AF50 0440001C */  bltz      $v0, .L8027AFC4
/* 1A9834 8027AF54 00000000 */   nop
/* 1A9838 8027AF58 C6020034 */  lwc1      $f2, 0x34($s0)
/* 1A983C 8027AF5C C6000028 */  lwc1      $f0, 0x28($s0)
/* 1A9840 8027AF60 46001080 */  add.s     $f2, $f2, $f0
/* 1A9844 8027AF64 E6020034 */  swc1      $f2, 0x34($s0)
/* 1A9848 8027AF68 864200BC */  lh        $v0, 0xBC($s2)
/* 1A984C 8027AF6C 44820000 */  mtc1      $v0, $f0
/* 1A9850 8027AF70 00000000 */  nop
/* 1A9854 8027AF74 46800020 */  cvt.s.w   $f0, $f0
/* 1A9858 8027AF78 4602003C */  c.lt.s    $f0, $f2
/* 1A985C 8027AF7C 00000000 */  nop
/* 1A9860 8027AF80 45000038 */  bc1f      .L8027B064
/* 1A9864 8027AF84 00000000 */   nop
/* 1A9868 8027AF88 92620135 */  lbu       $v0, 0x135($s3)
/* 1A986C 8027AF8C 24420001 */  addiu     $v0, $v0, 0x1
/* 1A9870 8027AF90 A2620135 */  sb        $v0, 0x135($s3)
/* 1A9874 8027AF94 AE000034 */  sw        $zero, 0x34($s0)
/* 1A9878 8027AF98 92620135 */  lbu       $v0, 0x135($s3)
/* 1A987C 8027AF9C 30420001 */  andi      $v0, $v0, 0x1
/* 1A9880 8027AFA0 10400026 */  beqz      $v0, .L8027B03C
/* 1A9884 8027AFA4 00000000 */   nop
/* 1A9888 8027AFA8 8E4200A4 */  lw        $v0, 0xA4($s2)
/* 1A988C 8027AFAC 1040002D */  beqz      $v0, .L8027B064
/* 1A9890 8027AFB0 00000000 */   nop
/* 1A9894 8027AFB4 C6400034 */  lwc1      $f0, 0x34($s2)
/* 1A9898 8027AFB8 E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A989C 8027AFBC 0809EC15 */  j         .L8027B054
/* 1A98A0 8027AFC0 8E4400A4 */   lw       $a0, 0xA4($s2)
.L8027AFC4:
/* 1A98A4 8027AFC4 C6020034 */  lwc1      $f2, 0x34($s0)
/* 1A98A8 8027AFC8 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 1A98AC 8027AFCC 44810000 */  mtc1      $at, $f0
/* 1A98B0 8027AFD0 00000000 */  nop
/* 1A98B4 8027AFD4 46001080 */  add.s     $f2, $f2, $f0
/* 1A98B8 8027AFD8 E6020034 */  swc1      $f2, 0x34($s0)
/* 1A98BC 8027AFDC 864200BC */  lh        $v0, 0xBC($s2)
/* 1A98C0 8027AFE0 00021023 */  negu      $v0, $v0
/* 1A98C4 8027AFE4 44820000 */  mtc1      $v0, $f0
/* 1A98C8 8027AFE8 00000000 */  nop
/* 1A98CC 8027AFEC 46800020 */  cvt.s.w   $f0, $f0
/* 1A98D0 8027AFF0 4602003E */  c.le.s    $f0, $f2
/* 1A98D4 8027AFF4 00000000 */  nop
/* 1A98D8 8027AFF8 4500001A */  bc1f      .L8027B064
/* 1A98DC 8027AFFC 00000000 */   nop
/* 1A98E0 8027B000 92620135 */  lbu       $v0, 0x135($s3)
/* 1A98E4 8027B004 24420001 */  addiu     $v0, $v0, 0x1
/* 1A98E8 8027B008 A2620135 */  sb        $v0, 0x135($s3)
/* 1A98EC 8027B00C AE000034 */  sw        $zero, 0x34($s0)
/* 1A98F0 8027B010 92620135 */  lbu       $v0, 0x135($s3)
/* 1A98F4 8027B014 30420001 */  andi      $v0, $v0, 0x1
/* 1A98F8 8027B018 10400008 */  beqz      $v0, .L8027B03C
/* 1A98FC 8027B01C 00000000 */   nop
/* 1A9900 8027B020 8E4200A4 */  lw        $v0, 0xA4($s2)
/* 1A9904 8027B024 1040000F */  beqz      $v0, .L8027B064
/* 1A9908 8027B028 00000000 */   nop
/* 1A990C 8027B02C C6400034 */  lwc1      $f0, 0x34($s2)
/* 1A9910 8027B030 E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A9914 8027B034 0809EC15 */  j         .L8027B054
/* 1A9918 8027B038 8E4400A4 */   lw       $a0, 0xA4($s2)
.L8027B03C:
/* 1A991C 8027B03C 8E4200A8 */  lw        $v0, 0xA8($s2)
/* 1A9920 8027B040 10400008 */  beqz      $v0, .L8027B064
/* 1A9924 8027B044 00000000 */   nop
/* 1A9928 8027B048 C6400034 */  lwc1      $f0, 0x34($s2)
/* 1A992C 8027B04C E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A9930 8027B050 8E4400A8 */  lw        $a0, 0xA8($s2)
.L8027B054:
/* 1A9934 8027B054 8E46002C */  lw        $a2, 0x2C($s2)
/* 1A9938 8027B058 8E470030 */  lw        $a3, 0x30($s2)
/* 1A993C 8027B05C 0C052757 */  jal       sfx_play_sound_at_position
/* 1A9940 8027B060 0000282D */   daddu    $a1, $zero, $zero
.L8027B064:
/* 1A9944 8027B064 96020038 */  lhu       $v0, 0x38($s0)
/* 1A9948 8027B068 2442FFFF */  addiu     $v0, $v0, -0x1
/* 1A994C 8027B06C A6020038 */  sh        $v0, 0x38($s0)
/* 1A9950 8027B070 00021400 */  sll       $v0, $v0, 16
/* 1A9954 8027B074 1C40000D */  bgtz      $v0, .L8027B0AC
/* 1A9958 8027B078 0000102D */   daddu    $v0, $zero, $zero
/* 1A995C 8027B07C C600000C */  lwc1      $f0, 0xC($s0)
/* 1A9960 8027B080 8E4400A4 */  lw        $a0, 0xA4($s2)
/* 1A9964 8027B084 E640002C */  swc1      $f0, 0x2C($s2)
/* 1A9968 8027B088 C6000014 */  lwc1      $f0, 0x14($s0)
/* 1A996C 8027B08C 10800006 */  beqz      $a0, .L8027B0A8
/* 1A9970 8027B090 E6400034 */   swc1     $f0, 0x34($s2)
/* 1A9974 8027B094 8E4200A8 */  lw        $v0, 0xA8($s2)
/* 1A9978 8027B098 14400004 */  bnez      $v0, .L8027B0AC
/* 1A997C 8027B09C 24020001 */   addiu    $v0, $zero, 0x1
/* 1A9980 8027B0A0 0C0154F0 */  jal       snd_stop_sound
/* 1A9984 8027B0A4 00000000 */   nop
.L8027B0A8:
/* 1A9988 8027B0A8 24020001 */  addiu     $v0, $zero, 0x1
.L8027B0AC:
/* 1A998C 8027B0AC 8FBF002C */  lw        $ra, 0x2C($sp)
/* 1A9990 8027B0B0 8FB40028 */  lw        $s4, 0x28($sp)
/* 1A9994 8027B0B4 8FB30024 */  lw        $s3, 0x24($sp)
/* 1A9998 8027B0B8 8FB20020 */  lw        $s2, 0x20($sp)
/* 1A999C 8027B0BC 8FB1001C */  lw        $s1, 0x1C($sp)
/* 1A99A0 8027B0C0 8FB00018 */  lw        $s0, 0x18($sp)
/* 1A99A4 8027B0C4 D7BA0048 */  ldc1      $f26, 0x48($sp)
/* 1A99A8 8027B0C8 D7B80040 */  ldc1      $f24, 0x40($sp)
/* 1A99AC 8027B0CC D7B60038 */  ldc1      $f22, 0x38($sp)
/* 1A99B0 8027B0D0 D7B40030 */  ldc1      $f20, 0x30($sp)
/* 1A99B4 8027B0D4 03E00008 */  jr        $ra
/* 1A99B8 8027B0D8 27BD0050 */   addiu    $sp, $sp, 0x50

### DECOMPILED C INSTRUCTIONS:

ApiStatus RunPartTo(Evt* script, s32 isInitialCall) {
    Bytecode* args = script->ptrReadPos;
    Actor* actor;
    ActorPart* part;
    ActorPartMovement* movement;
    s32 actorID, partID;
    f32 posX, posY, posZ;
    f32 goalX, goalY, goalZ;
    f32 deltaDist;

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

    if (script->functionTemp[0] == 0) {
        actorID = evt_get_variable(script, *args++);
        if (actorID == ACTOR_SELF) {
            actorID = script->owner1.actorID;
        }
        partID = evt_get_variable(script, *args++);

        actor = get_actor(actorID);
        part = get_actor_part(actor, partID);
        script->functionTempPtr[1] = actor;
        script->functionTempPtr[2] = part;
        movement = part->movement;

        posX = evt_get_variable(script, *args++);
        posY = evt_get_variable(script, *args++);
        posZ = evt_get_variable(script, *args++);
        movement->goalPos.x = posX;
        movement->goalPos.y = posY;
        movement->goalPos.z = posZ;
        movement->moveTime = evt_get_variable(script, *args++);

        goalX = movement->goalPos.x;
        goalY = movement->goalPos.y;
        goalZ = movement->goalPos.z;

        movement->absolutePosition.x = part->absolutePosition.x;
        movement->absolutePosition.y = part->absolutePosition.y;
        movement->absolutePosition.z = part->absolutePosition.z;

        posX = movement->absolutePosition.x;
        posY = movement->absolutePosition.y;
        posZ = movement->absolutePosition.z;

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

        if (movement->moveTime == 0) {
            movement->moveTime = movement->distance / movement->moveSpeed;
        } else {
            movement->moveSpeed = movement->distance / movement->moveTime;
        }
        if (part->actorTypeData2b[0] >= 0) {
            movement->distance = part->actorTypeData2b[0] + 1;
        } else {
            movement->distance = ~part->actorTypeData2b[0];
        }
        if (part->partTypeData[0] != 0 && part->partTypeData[1] == 0) {
            sfx_play_sound_at_position(part->partTypeData[0], SOUND_SPACE_MODE_0, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z);
        }
        script->functionTemp[0] = 1;
    }

    part = script->functionTempPtr[2];
    movement = part->movement;
    actor = script->functionTempPtr[1];

    add_xz_vec3f_copy1(&movement->absolutePosition, movement->moveSpeed, movement->angle);
    if (movement->moveSpeed < 4.0f) {
        play_movement_dust_effects(0, movement->absolutePosition.x, movement->absolutePosition.y, movement->absolutePosition.z, movement->angle);
    } else {
        play_movement_dust_effects(1, movement->absolutePosition.x, movement->absolutePosition.y, movement->absolutePosition.z, movement->angle);
    }
    part->absolutePosition.x = movement->absolutePosition.x;
    part->absolutePosition.y = movement->absolutePosition.y;
    part->absolutePosition.z = movement->absolutePosition.z;

    if (part->partTypeData[0] != 0 && part->partTypeData[1] != 0) {
        if (part->actorTypeData2b[0] >= 0) {
            movement->distance += movement->moveSpeed;
            if (part->actorTypeData2b[0] < movement->distance) {
                actor->footStepCounter++;
                movement->distance = 0;
                if (actor->footStepCounter % 2 != 0) {
                    if (part->partTypeData[0] != 0) {
                        sfx_play_sound_at_position(part->partTypeData[0], SOUND_SPACE_MODE_0, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z);
                    }
                } else {
                    if (part->partTypeData[1] != 0) {
                        sfx_play_sound_at_position(part->partTypeData[1], SOUND_SPACE_MODE_0, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z);
                    }
                }
            }
        } else {
            movement->distance += 1.0f;
            if (-part->actorTypeData2b[0] <= movement->distance) {
                actor->footStepCounter++;
                movement->distance = 0;
                if (actor->footStepCounter % 2 != 0) {
                    if (part->partTypeData[0] != 0) {
                        sfx_play_sound_at_position(part->partTypeData[0], SOUND_SPACE_MODE_0, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z);
                    }
                } else {
                    if (part->partTypeData[1] != 0) {
                        sfx_play_sound_at_position(part->partTypeData[1], SOUND_SPACE_MODE_0, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z);
                    }
                }
            }
        }
    }

    movement->moveTime--;
    if (movement->moveTime > 0) {
        return ApiStatus_BLOCK;
    } else {
        part->absolutePosition.x = movement->goalPos.x;
        part->absolutePosition.z = movement->goalPos.z;
        if (part->partTypeData[0] != 0 && part->partTypeData[1] == 0) {
            snd_stop_sound(part->partTypeData[0]);
        }
        return ApiStatus_DONE1;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel osPfsChecker
/* 48020 8006CC20 27BDFB60 */  addiu     $sp, $sp, -0x4A0
/* 48024 8006CC24 AFB1047C */  sw        $s1, 0x47C($sp)
/* 48028 8006CC28 00808821 */  addu      $s1, $a0, $zero
/* 4802C 8006CC2C AFBE0498 */  sw        $fp, 0x498($sp)
/* 48030 8006CC30 0000F021 */  addu      $fp, $zero, $zero
/* 48034 8006CC34 AFB60490 */  sw        $s6, 0x490($sp)
/* 48038 8006CC38 241600FE */  addiu     $s6, $zero, 0xFE
/* 4803C 8006CC3C AFBF049C */  sw        $ra, 0x49C($sp)
/* 48040 8006CC40 AFB70494 */  sw        $s7, 0x494($sp)
/* 48044 8006CC44 AFB5048C */  sw        $s5, 0x48C($sp)
/* 48048 8006CC48 AFB40488 */  sw        $s4, 0x488($sp)
/* 4804C 8006CC4C AFB30484 */  sw        $s3, 0x484($sp)
/* 48050 8006CC50 AFB20480 */  sw        $s2, 0x480($sp)
/* 48054 8006CC54 0C01A775 */  jal       __osCheckId
/* 48058 8006CC58 AFB00478 */   sw       $s0, 0x478($sp)
/* 4805C 8006CC5C 00408021 */  addu      $s0, $v0, $zero
/* 48060 8006CC60 24020002 */  addiu     $v0, $zero, 0x2
/* 48064 8006CC64 16020004 */  bne       $s0, $v0, .L8006CC78
/* 48068 8006CC68 00000000 */   nop
/* 4806C 8006CC6C 0C01A702 */  jal       __osGetId
/* 48070 8006CC70 02202021 */   addu     $a0, $s1, $zero
/* 48074 8006CC74 00408021 */  addu      $s0, $v0, $zero
.L8006CC78:
/* 48078 8006CC78 12000003 */  beqz      $s0, .L8006CC88
/* 4807C 8006CC7C 02202021 */   addu     $a0, $s1, $zero
.L8006CC80:
/* 48080 8006CC80 0801B414 */  j         .L8006D050
/* 48084 8006CC84 02001021 */   addu     $v0, $s0, $zero
.L8006CC88:
/* 48088 8006CC88 0C01B420 */  jal       corrupted_init
/* 4808C 8006CC8C 27A50258 */   addiu    $a1, $sp, 0x258
/* 48090 8006CC90 00408021 */  addu      $s0, $v0, $zero
/* 48094 8006CC94 160000EE */  bnez      $s0, .L8006D050
/* 48098 8006CC98 00000000 */   nop
/* 4809C 8006CC9C 8E220050 */  lw        $v0, 0x50($s1)
/* 480A0 8006CCA0 0202102A */  slt       $v0, $s0, $v0
/* 480A4 8006CCA4 1040006B */  beqz      $v0, .L8006CE54
/* 480A8 8006CCA8 00009021 */   addu     $s2, $zero, $zero
/* 480AC 8006CCAC 27B70018 */  addiu     $s7, $sp, 0x18
.L8006CCB0:
/* 480B0 8006CCB0 8E240004 */  lw        $a0, 0x4($s1)
/* 480B4 8006CCB4 8E26005C */  lw        $a2, 0x5C($s1)
/* 480B8 8006CCB8 8E250008 */  lw        $a1, 0x8($s1)
/* 480BC 8006CCBC 27A70218 */  addiu     $a3, $sp, 0x218
/* 480C0 8006CCC0 00D23021 */  addu      $a2, $a2, $s2
/* 480C4 8006CCC4 0C01A874 */  jal       __osContRamRead
/* 480C8 8006CCC8 30C6FFFF */   andi     $a2, $a2, 0xFFFF
/* 480CC 8006CCCC 00408021 */  addu      $s0, $v0, $zero
/* 480D0 8006CCD0 160000DF */  bnez      $s0, .L8006D050
/* 480D4 8006CCD4 02001021 */   addu     $v0, $s0, $zero
/* 480D8 8006CCD8 97A2021C */  lhu       $v0, 0x21C($sp)
/* 480DC 8006CCDC 14400006 */  bnez      $v0, .L8006CCF8
/* 480E0 8006CCE0 00000000 */   nop
/* 480E4 8006CCE4 8FA20218 */  lw        $v0, 0x218($sp)
/* 480E8 8006CCE8 10400055 */  beqz      $v0, .L8006CE40
/* 480EC 8006CCEC 2405FFFF */   addiu    $a1, $zero, -0x1
/* 480F0 8006CCF0 0801B374 */  j         .L8006CDD0
/* 480F4 8006CCF4 00000000 */   nop
.L8006CCF8:
/* 480F8 8006CCF8 8FA20218 */  lw        $v0, 0x218($sp)
/* 480FC 8006CCFC 14400003 */  bnez      $v0, .L8006CD0C
/* 48100 8006CD00 00002821 */   addu     $a1, $zero, $zero
/* 48104 8006CD04 0801B374 */  j         .L8006CDD0
/* 48108 8006CD08 2405FFFF */   addiu    $a1, $zero, -0x1
.L8006CD0C:
/* 4810C 8006CD0C 97B4021E */  lhu       $s4, 0x21E($sp)
/* 48110 8006CD10 0000A821 */  addu      $s5, $zero, $zero
/* 48114 8006CD14 8E220060 */  lw        $v0, 0x60($s1)
/* 48118 8006CD18 0801B36C */  j         .L8006CDB0
/* 4811C 8006CD1C 241300FF */   addiu    $s3, $zero, 0xFF
.L8006CD20:
/* 48120 8006CD20 0002182B */  sltu      $v1, $zero, $v0
/* 48124 8006CD24 2C420080 */  sltiu     $v0, $v0, 0x80
/* 48128 8006CD28 00621824 */  and       $v1, $v1, $v0
/* 4812C 8006CD2C 10600028 */  beqz      $v1, .L8006CDD0
/* 48130 8006CD30 00041A02 */   srl      $v1, $a0, 8
/* 48134 8006CD34 326200FF */  andi      $v0, $s3, 0xFF
/* 48138 8006CD38 306700FF */  andi      $a3, $v1, 0xFF
/* 4813C 8006CD3C 1047000F */  beq       $v0, $a3, .L8006CD7C
/* 48140 8006CD40 32C200FF */   andi     $v0, $s6, 0xFF
/* 48144 8006CD44 10470007 */  beq       $v0, $a3, .L8006CD64
/* 48148 8006CD48 00609821 */   addu     $s3, $v1, $zero
/* 4814C 8006CD4C 02202021 */  addu      $a0, $s1, $zero
/* 48150 8006CD50 27A50118 */  addiu     $a1, $sp, 0x118
/* 48154 8006CD54 0C01A7A3 */  jal       __osPfsRWInode
/* 48158 8006CD58 00003021 */   addu     $a2, $zero, $zero
/* 4815C 8006CD5C 00408021 */  addu      $s0, $v0, $zero
/* 48160 8006CD60 0260B021 */  addu      $s6, $s3, $zero
.L8006CD64:
/* 48164 8006CD64 0010182B */  sltu      $v1, $zero, $s0
/* 48168 8006CD68 3A020003 */  xori      $v0, $s0, 0x3
/* 4816C 8006CD6C 0002102B */  sltu      $v0, $zero, $v0
/* 48170 8006CD70 00621824 */  and       $v1, $v1, $v0
/* 48174 8006CD74 146000B6 */  bnez      $v1, .L8006D050
/* 48178 8006CD78 02001021 */   addu     $v0, $s0, $zero
.L8006CD7C:
/* 4817C 8006CD7C 02202021 */  addu      $a0, $s1, $zero
/* 48180 8006CD80 02802821 */  addu      $a1, $s4, $zero
/* 48184 8006CD84 27A60258 */  addiu     $a2, $sp, 0x258
/* 48188 8006CD88 0C01B476 */  jal       corrupted
/* 4818C 8006CD8C 00052C00 */   sll      $a1, $a1, 16
/* 48190 8006CD90 00552823 */  subu      $a1, $v0, $s5
/* 48194 8006CD94 14A00014 */  bnez      $a1, .L8006CDE8
/* 48198 8006CD98 328200FF */   andi     $v0, $s4, 0xFF
/* 4819C 8006CD9C 00021040 */  sll       $v0, $v0, 1
/* 481A0 8006CDA0 00571021 */  addu      $v0, $v0, $s7
/* 481A4 8006CDA4 94540100 */  lhu       $s4, 0x100($v0)
/* 481A8 8006CDA8 8E220060 */  lw        $v0, 0x60($s1)
/* 481AC 8006CDAC 24150001 */  addiu     $s5, $zero, 0x1
.L8006CDB0:
/* 481B0 8006CDB0 3284FFFF */  andi      $a0, $s4, 0xFFFF
/* 481B4 8006CDB4 0082102A */  slt       $v0, $a0, $v0
/* 481B8 8006CDB8 14400005 */  bnez      $v0, .L8006CDD0
/* 481BC 8006CDBC 00041202 */   srl      $v0, $a0, 8
/* 481C0 8006CDC0 92230064 */  lbu       $v1, 0x64($s1)
/* 481C4 8006CDC4 0043102B */  sltu      $v0, $v0, $v1
/* 481C8 8006CDC8 1440FFD5 */  bnez      $v0, .L8006CD20
/* 481CC 8006CDCC 328200FF */   andi     $v0, $s4, 0xFF
.L8006CDD0:
/* 481D0 8006CDD0 54A00006 */  bnel      $a1, $zero, .L8006CDEC
/* 481D4 8006CDD4 27A40218 */   addiu    $a0, $sp, 0x218
/* 481D8 8006CDD8 3283FFFF */  andi      $v1, $s4, 0xFFFF
/* 481DC 8006CDDC 24020001 */  addiu     $v0, $zero, 0x1
/* 481E0 8006CDE0 10620017 */  beq       $v1, $v0, .L8006CE40
/* 481E4 8006CDE4 00000000 */   nop
.L8006CDE8:
/* 481E8 8006CDE8 27A40218 */  addiu     $a0, $sp, 0x218
.L8006CDEC:
/* 481EC 8006CDEC 0C01925C */  jal       bzero
/* 481F0 8006CDF0 24050020 */   addiu    $a1, $zero, 0x20
/* 481F4 8006CDF4 92220065 */  lbu       $v0, 0x65($s1)
/* 481F8 8006CDF8 10400006 */  beqz      $v0, .L8006CE14
/* 481FC 8006CDFC 02202021 */   addu     $a0, $s1, $zero
/* 48200 8006CE00 0C01A5B4 */  jal       __osPfsSelectBank
/* 48204 8006CE04 00002821 */   addu     $a1, $zero, $zero
/* 48208 8006CE08 00408021 */  addu      $s0, $v0, $zero
/* 4820C 8006CE0C 16000090 */  bnez      $s0, .L8006D050
/* 48210 8006CE10 02001021 */   addu     $v0, $s0, $zero
.L8006CE14:
/* 48214 8006CE14 8E26005C */  lw        $a2, 0x5C($s1)
/* 48218 8006CE18 AFA00010 */  sw        $zero, 0x10($sp)
/* 4821C 8006CE1C 8E240004 */  lw        $a0, 0x4($s1)
/* 48220 8006CE20 8E250008 */  lw        $a1, 0x8($s1)
/* 48224 8006CE24 27A70218 */  addiu     $a3, $sp, 0x218
/* 48228 8006CE28 00D23021 */  addu      $a2, $a2, $s2
/* 4822C 8006CE2C 0C01A8F0 */  jal       osContRamWrite
/* 48230 8006CE30 30C6FFFF */   andi     $a2, $a2, 0xFFFF
/* 48234 8006CE34 00408021 */  addu      $s0, $v0, $zero
/* 48238 8006CE38 1600FF91 */  bnez      $s0, .L8006CC80
/* 4823C 8006CE3C 27DE0001 */   addiu    $fp, $fp, 0x1
.L8006CE40:
/* 48240 8006CE40 8E220050 */  lw        $v0, 0x50($s1)
/* 48244 8006CE44 26520001 */  addiu     $s2, $s2, 0x1
/* 48248 8006CE48 0242102A */  slt       $v0, $s2, $v0
/* 4824C 8006CE4C 1440FF98 */  bnez      $v0, .L8006CCB0
/* 48250 8006CE50 00000000 */   nop
.L8006CE54:
/* 48254 8006CE54 8E220050 */  lw        $v0, 0x50($s1)
/* 48258 8006CE58 1840001D */  blez      $v0, .L8006CED0
/* 4825C 8006CE5C 00009021 */   addu     $s2, $zero, $zero
/* 48260 8006CE60 27B30238 */  addiu     $s3, $sp, 0x238
.L8006CE64:
/* 48264 8006CE64 8E240004 */  lw        $a0, 0x4($s1)
/* 48268 8006CE68 8E26005C */  lw        $a2, 0x5C($s1)
/* 4826C 8006CE6C 8E250008 */  lw        $a1, 0x8($s1)
/* 48270 8006CE70 27A70218 */  addiu     $a3, $sp, 0x218
/* 48274 8006CE74 00D23021 */  addu      $a2, $a2, $s2
/* 48278 8006CE78 0C01A874 */  jal       __osContRamRead
/* 4827C 8006CE7C 30C6FFFF */   andi     $a2, $a2, 0xFFFF
/* 48280 8006CE80 00408021 */  addu      $s0, $v0, $zero
/* 48284 8006CE84 16000072 */  bnez      $s0, .L8006D050
/* 48288 8006CE88 02001021 */   addu     $v0, $s0, $zero
/* 4828C 8006CE8C 97A2021C */  lhu       $v0, 0x21C($sp)
/* 48290 8006CE90 5040000A */  beql      $v0, $zero, .L8006CEBC
/* 48294 8006CE94 A6600000 */   sh       $zero, 0x0($s3)
/* 48298 8006CE98 8FA20218 */  lw        $v0, 0x218($sp)
/* 4829C 8006CE9C 50400007 */  beql      $v0, $zero, .L8006CEBC
/* 482A0 8006CEA0 A6600000 */   sh       $zero, 0x0($s3)
/* 482A4 8006CEA4 97A3021E */  lhu       $v1, 0x21E($sp)
/* 482A8 8006CEA8 96220062 */  lhu       $v0, 0x62($s1)
/* 482AC 8006CEAC 0062102B */  sltu      $v0, $v1, $v0
/* 482B0 8006CEB0 54400002 */  bnel      $v0, $zero, .L8006CEBC
/* 482B4 8006CEB4 A6600000 */   sh       $zero, 0x0($s3)
/* 482B8 8006CEB8 A6630000 */  sh        $v1, 0x0($s3)
.L8006CEBC:
/* 482BC 8006CEBC 8E220050 */  lw        $v0, 0x50($s1)
/* 482C0 8006CEC0 26520001 */  addiu     $s2, $s2, 0x1
/* 482C4 8006CEC4 0242102A */  slt       $v0, $s2, $v0
/* 482C8 8006CEC8 1440FFE6 */  bnez      $v0, .L8006CE64
/* 482CC 8006CECC 26730002 */   addiu    $s3, $s3, 0x2
.L8006CED0:
/* 482D0 8006CED0 92220064 */  lbu       $v0, 0x64($s1)
/* 482D4 8006CED4 10400055 */  beqz      $v0, .L8006D02C
/* 482D8 8006CED8 00009821 */   addu     $s3, $zero, $zero
/* 482DC 8006CEDC 27B40018 */  addiu     $s4, $sp, 0x18
/* 482E0 8006CEE0 27B60118 */  addiu     $s6, $sp, 0x118
/* 482E4 8006CEE4 27B50238 */  addiu     $s5, $sp, 0x238
/* 482E8 8006CEE8 02202021 */  addu      $a0, $s1, $zero
.L8006CEEC:
/* 482EC 8006CEEC 27A50118 */  addiu     $a1, $sp, 0x118
/* 482F0 8006CEF0 00003021 */  addu      $a2, $zero, $zero
/* 482F4 8006CEF4 327200FF */  andi      $s2, $s3, 0xFF
/* 482F8 8006CEF8 0C01A7A3 */  jal       __osPfsRWInode
/* 482FC 8006CEFC 02403821 */   addu     $a3, $s2, $zero
/* 48300 8006CF00 00408021 */  addu      $s0, $v0, $zero
/* 48304 8006CF04 0010182B */  sltu      $v1, $zero, $s0
/* 48308 8006CF08 3A020003 */  xori      $v0, $s0, 0x3
/* 4830C 8006CF0C 0002102B */  sltu      $v0, $zero, $v0
/* 48310 8006CF10 00621824 */  and       $v1, $v1, $v0
/* 48314 8006CF14 5460004E */  bnel      $v1, $zero, .L8006D050
/* 48318 8006CF18 02001021 */   addu     $v0, $s0, $zero
/* 4831C 8006CF1C 16400002 */  bnez      $s2, .L8006CF28
/* 48320 8006CF20 24050001 */   addiu    $a1, $zero, 0x1
/* 48324 8006CF24 8E250060 */  lw        $a1, 0x60($s1)
.L8006CF28:
/* 48328 8006CF28 18A0000A */  blez      $a1, .L8006CF54
/* 4832C 8006CF2C 00009021 */   addu     $s2, $zero, $zero
/* 48330 8006CF30 02802021 */  addu      $a0, $s4, $zero
/* 48334 8006CF34 02C01821 */  addu      $v1, $s6, $zero
.L8006CF38:
/* 48338 8006CF38 94620000 */  lhu       $v0, 0x0($v1)
/* 4833C 8006CF3C 24630002 */  addiu     $v1, $v1, 0x2
/* 48340 8006CF40 26520001 */  addiu     $s2, $s2, 0x1
/* 48344 8006CF44 A4820000 */  sh        $v0, 0x0($a0)
/* 48348 8006CF48 0245102A */  slt       $v0, $s2, $a1
/* 4834C 8006CF4C 1440FFFA */  bnez      $v0, .L8006CF38
/* 48350 8006CF50 24840002 */   addiu    $a0, $a0, 0x2
.L8006CF54:
/* 48354 8006CF54 2A420080 */  slti      $v0, $s2, 0x80
/* 48358 8006CF58 10400008 */  beqz      $v0, .L8006CF7C
/* 4835C 8006CF5C 00121040 */   sll      $v0, $s2, 1
/* 48360 8006CF60 24040003 */  addiu     $a0, $zero, 0x3
/* 48364 8006CF64 00541821 */  addu      $v1, $v0, $s4
.L8006CF68:
/* 48368 8006CF68 A4640000 */  sh        $a0, 0x0($v1)
/* 4836C 8006CF6C 26520001 */  addiu     $s2, $s2, 0x1
/* 48370 8006CF70 2A420080 */  slti      $v0, $s2, 0x80
/* 48374 8006CF74 1440FFFC */  bnez      $v0, .L8006CF68
/* 48378 8006CF78 24630002 */   addiu    $v1, $v1, 0x2
.L8006CF7C:
/* 4837C 8006CF7C 8E220050 */  lw        $v0, 0x50($s1)
/* 48380 8006CF80 1840001D */  blez      $v0, .L8006CFF8
/* 48384 8006CF84 00009021 */   addu     $s2, $zero, $zero
/* 48388 8006CF88 326800FF */  andi      $t0, $s3, 0xFF
/* 4838C 8006CF8C 00003021 */  addu      $a2, $zero, $zero
/* 48390 8006CF90 02A03821 */  addu      $a3, $s5, $zero
.L8006CF94:
/* 48394 8006CF94 90E20000 */  lbu       $v0, 0x0($a3)
/* 48398 8006CF98 14480011 */  bne       $v0, $t0, .L8006CFE0
/* 4839C 8006CF9C 02A02821 */   addu     $a1, $s5, $zero
.L8006CFA0:
/* 483A0 8006CFA0 00A62021 */  addu      $a0, $a1, $a2
/* 483A4 8006CFA4 94830000 */  lhu       $v1, 0x0($a0)
/* 483A8 8006CFA8 96220062 */  lhu       $v0, 0x62($s1)
/* 483AC 8006CFAC 0062182B */  sltu      $v1, $v1, $v0
/* 483B0 8006CFB0 5460000C */  bnel      $v1, $zero, .L8006CFE4
/* 483B4 8006CFB4 24C60002 */   addiu    $a2, $a2, 0x2
/* 483B8 8006CFB8 90820001 */  lbu       $v0, 0x1($a0)
/* 483BC 8006CFBC 00021040 */  sll       $v0, $v0, 1
/* 483C0 8006CFC0 00541021 */  addu      $v0, $v0, $s4
/* 483C4 8006CFC4 94430100 */  lhu       $v1, 0x100($v0)
/* 483C8 8006CFC8 A4430000 */  sh        $v1, 0x0($v0)
/* 483CC 8006CFCC 00D41021 */  addu      $v0, $a2, $s4
/* 483D0 8006CFD0 A4430220 */  sh        $v1, 0x220($v0)
/* 483D4 8006CFD4 90820000 */  lbu       $v0, 0x0($a0)
/* 483D8 8006CFD8 1048FFF1 */  beq       $v0, $t0, .L8006CFA0
/* 483DC 8006CFDC 00000000 */   nop
.L8006CFE0:
/* 483E0 8006CFE0 24C60002 */  addiu     $a2, $a2, 0x2
.L8006CFE4:
/* 483E4 8006CFE4 8E220050 */  lw        $v0, 0x50($s1)
/* 483E8 8006CFE8 26520001 */  addiu     $s2, $s2, 0x1
/* 483EC 8006CFEC 0242102A */  slt       $v0, $s2, $v0
/* 483F0 8006CFF0 1440FFE8 */  bnez      $v0, .L8006CF94
/* 483F4 8006CFF4 24E70002 */   addiu    $a3, $a3, 0x2
.L8006CFF8:
/* 483F8 8006CFF8 02202021 */  addu      $a0, $s1, $zero
/* 483FC 8006CFFC 27A50018 */  addiu     $a1, $sp, 0x18
/* 48400 8006D000 24060001 */  addiu     $a2, $zero, 0x1
/* 48404 8006D004 0C01A7A3 */  jal       __osPfsRWInode
/* 48408 8006D008 326700FF */   andi     $a3, $s3, 0xFF
/* 4840C 8006D00C 00408021 */  addu      $s0, $v0, $zero
/* 48410 8006D010 1600FF1B */  bnez      $s0, .L8006CC80
/* 48414 8006D014 26730001 */   addiu    $s3, $s3, 0x1
/* 48418 8006D018 92230064 */  lbu       $v1, 0x64($s1)
/* 4841C 8006D01C 326200FF */  andi      $v0, $s3, 0xFF
/* 48420 8006D020 0043102B */  sltu      $v0, $v0, $v1
/* 48424 8006D024 1440FFB1 */  bnez      $v0, .L8006CEEC
/* 48428 8006D028 02202021 */   addu     $a0, $s1, $zero
.L8006D02C:
/* 4842C 8006D02C 13C00004 */  beqz      $fp, .L8006D040
/* 48430 8006D030 2403FFFD */   addiu    $v1, $zero, -0x3
/* 48434 8006D034 8E220000 */  lw        $v0, 0x0($s1)
/* 48438 8006D038 0801B412 */  j         .L8006D048
/* 4843C 8006D03C 34420002 */   ori      $v0, $v0, 0x2
.L8006D040:
/* 48440 8006D040 8E220000 */  lw        $v0, 0x0($s1)
/* 48444 8006D044 00431024 */  and       $v0, $v0, $v1
.L8006D048:
/* 48448 8006D048 AE220000 */  sw        $v0, 0x0($s1)
/* 4844C 8006D04C 00001021 */  addu      $v0, $zero, $zero
.L8006D050:
/* 48450 8006D050 8FBF049C */  lw        $ra, 0x49C($sp)
/* 48454 8006D054 8FBE0498 */  lw        $fp, 0x498($sp)
/* 48458 8006D058 8FB70494 */  lw        $s7, 0x494($sp)
/* 4845C 8006D05C 8FB60490 */  lw        $s6, 0x490($sp)
/* 48460 8006D060 8FB5048C */  lw        $s5, 0x48C($sp)
/* 48464 8006D064 8FB40488 */  lw        $s4, 0x488($sp)
/* 48468 8006D068 8FB30484 */  lw        $s3, 0x484($sp)
/* 4846C 8006D06C 8FB20480 */  lw        $s2, 0x480($sp)
/* 48470 8006D070 8FB1047C */  lw        $s1, 0x47C($sp)
/* 48474 8006D074 8FB00478 */  lw        $s0, 0x478($sp)
/* 48478 8006D078 03E00008 */  jr        $ra
/* 4847C 8006D07C 27BD04A0 */   addiu    $sp, $sp, 0x4A0

### DECOMPILED C INSTRUCTIONS:

s32 osPfsChecker(OSPfs* pfs) {
    s32 j;
    s32 ret;
    __OSInodeUnit next;
    __OSInode checkedInode;
    __OSInode tempInode;
    __OSDir tempDir;
    __OSInodeUnit nextNodeInFile[16];
    __OSInodeCache cache;
    s32 fixed = 0;
    u8 bank, prevBank = 254;
    s32 cc, cl;
    s32 offset;

    ret = __osCheckId(pfs);
    if (ret == PFS_ERR_NEW_PACK) {
        ret = __osGetId(pfs);
    }
    if (ret) {
        return ret;
    }
    if ((ret = corrupted_init(pfs, &cache)) != 0) {
        return ret;
    }

    for (j = 0; j < pfs->dir_size; j++) {
        if ((ret = __osContRamRead(pfs->queue, pfs->channel, pfs->dir_table + j, (u8*)&tempDir)) != 0) {
            return ret;
        }
        if ((tempDir.company_code != 0) || (tempDir.game_code != 0)) {
            if ((tempDir.company_code == 0) || (tempDir.game_code == 0)) {
                cc = -1;
            } else {
                next = tempDir.start_page;
                cl = cc = 0;
                bank = 255;

                while (CHECK_IPAGE(next)) {
                    if (bank != next.inode_t.bank) {
                        bank = next.inode_t.bank;
                        if (prevBank != bank) {
                            ret = __osPfsRWInode(pfs, &tempInode, PFS_READ, bank);
                            prevBank = bank;
                        }
                        if ((ret != 0) && (ret != PFS_ERR_INCONSISTENT)) {
                            return ret;
                        }
                    }
                    if ((cc = corrupted(pfs, next, &cache) - cl) != 0) {
                        break;
                    }
                    cl = 1;
                    next = tempInode.inode_page[next.inode_t.page];
                }
            }
            if ((cc != 0) || (next.ipage != PFS_EOF)) {
                bzero(&tempDir, sizeof(__OSDir));
                if (pfs->activebank != 0) {
                    if ((ret = __osPfsSelectBank(pfs, 0)) != 0) {
                        return ret;
                    }
                }
                if ((ret = __osContRamWrite(pfs->queue, pfs->channel, pfs->dir_table + j, (u8*)&tempDir, 0)) != 0) {
                    return ret;
                }

                fixed++;
            }
        }
    }

    for (j = 0; j < pfs->dir_size; j++) {
        if ((ret = __osContRamRead(pfs->queue, pfs->channel, pfs->dir_table + j, (u8*)&tempDir)) != 0) {
            return ret;
        }

        if ((tempDir.company_code != 0) && (tempDir.game_code != 0) &&
            (tempDir.start_page.ipage >= (u16)pfs->inode_start_page)) { // cast required
            nextNodeInFile[j].ipage = tempDir.start_page.ipage;
        } else {
            nextNodeInFile[j].ipage = 0;
        }
    }

    for (bank = 0; bank < pfs->banks; bank++) {
        ret = __osPfsRWInode(pfs, &tempInode, PFS_READ, bank);
        if ((ret != 0) && (ret != PFS_ERR_INCONSISTENT)) {
            return (ret);
        }
        offset = ((bank > PFS_ID_BANK_256K) ? 1 : pfs->inode_start_page);
        for (j = 0; j < offset; j++) {
            checkedInode.inode_page[j].ipage = tempInode.inode_page[j].ipage;
        }
        for (; j < PFS_INODE_SIZE_PER_PAGE; j++) {
            checkedInode.inode_page[j].ipage = PFS_PAGE_NOT_USED;
        }

        for (j = 0; j < pfs->dir_size; j++) {
            while (nextNodeInFile[j].inode_t.bank == bank &&
                   nextNodeInFile[j].ipage >= (u16)pfs->inode_start_page) { // cast required
                u8 val;
                val = nextNodeInFile[j].inode_t.page;
                nextNodeInFile[j] = checkedInode.inode_page[val] = tempInode.inode_page[val];
            }
        }
        if ((ret = __osPfsRWInode(pfs, &checkedInode, PFS_WRITE, bank)) != 0) {
            return ret;
        }
    }

    if (fixed != 0) {
        pfs->status |= PFS_CORRUPTED;
    } else {
        pfs->status &= ~PFS_CORRUPTED;
    }
    return 0;
}