### RAW ASSEMBLY INSTRUCTIONS:

glabel draw_coin_sparkles
/* C720C 80130B0C 27BDFE78 */  addiu     $sp, $sp, -0x188
/* C7210 80130B10 AFB20150 */  sw        $s2, 0x150($sp)
/* C7214 80130B14 0080902D */  daddu     $s2, $a0, $zero
/* C7218 80130B18 AFB70164 */  sw        $s7, 0x164($sp)
/* C721C 80130B1C 3C170001 */  lui       $s7, (0x11630 >> 16)
/* C7220 80130B20 3C03800A */  lui       $v1, %hi(gCurrentCamID)
/* C7224 80130B24 8463A634 */  lh        $v1, %lo(gCurrentCamID)($v1)
/* C7228 80130B28 3C014334 */  lui       $at, (0x43340000 >> 16)
/* C722C 80130B2C 44816000 */  mtc1      $at, $f12
/* C7230 80130B30 36F71630 */  ori       $s7, $s7, (0x11630 & 0xFFFF)
/* C7234 80130B34 AFBF016C */  sw        $ra, 0x16C($sp)
/* C7238 80130B38 AFBE0168 */  sw        $fp, 0x168($sp)
/* C723C 80130B3C AFB60160 */  sw        $s6, 0x160($sp)
/* C7240 80130B40 AFB5015C */  sw        $s5, 0x15C($sp)
/* C7244 80130B44 AFB40158 */  sw        $s4, 0x158($sp)
/* C7248 80130B48 AFB30154 */  sw        $s3, 0x154($sp)
/* C724C 80130B4C AFB1014C */  sw        $s1, 0x14C($sp)
/* C7250 80130B50 AFB00148 */  sw        $s0, 0x148($sp)
/* C7254 80130B54 F7B80180 */  sdc1      $f24, 0x180($sp)
/* C7258 80130B58 F7B60178 */  sdc1      $f22, 0x178($sp)
/* C725C 80130B5C F7B40170 */  sdc1      $f20, 0x170($sp)
/* C7260 80130B60 00031080 */  sll       $v0, $v1, 2
/* C7264 80130B64 00431021 */  addu      $v0, $v0, $v1
/* C7268 80130B68 00021080 */  sll       $v0, $v0, 2
/* C726C 80130B6C 00431023 */  subu      $v0, $v0, $v1
/* C7270 80130B70 000218C0 */  sll       $v1, $v0, 3
/* C7274 80130B74 00431021 */  addu      $v0, $v0, $v1
/* C7278 80130B78 000210C0 */  sll       $v0, $v0, 3
/* C727C 80130B7C 3C038015 */  lui       $v1, %hi(D_80155D8C)
/* C7280 80130B80 84635D8C */  lh        $v1, %lo(D_80155D8C)($v1)
/* C7284 80130B84 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* C7288 80130B88 00220821 */  addu      $at, $at, $v0
/* C728C 80130B8C C4201DEC */  lwc1      $f0, %lo(gCameras + 0x6C)($at)
/* C7290 80130B90 3C028015 */  lui       $v0, %hi(D_80155D8E)
/* C7294 80130B94 84425D8E */  lh        $v0, %lo(D_80155D8E)($v0)
/* C7298 80130B98 4483C000 */  mtc1      $v1, $f24
/* C729C 80130B9C 00000000 */  nop
/* C72A0 80130BA0 4680C620 */  cvt.s.w   $f24, $f24
/* C72A4 80130BA4 3C038015 */  lui       $v1, %hi(D_80155D90)
/* C72A8 80130BA8 84635D90 */  lh        $v1, %lo(D_80155D90)($v1)
/* C72AC 80130BAC 4482A000 */  mtc1      $v0, $f20
/* C72B0 80130BB0 00000000 */  nop
/* C72B4 80130BB4 4680A520 */  cvt.s.w   $f20, $f20
/* C72B8 80130BB8 4483B000 */  mtc1      $v1, $f22
/* C72BC 80130BBC 00000000 */  nop
/* C72C0 80130BC0 4680B5A0 */  cvt.s.w   $f22, $f22
/* C72C4 80130BC4 0C00A6C9 */  jal       clamp_angle
/* C72C8 80130BC8 46006301 */   sub.s    $f12, $f12, $f0
/* C72CC 80130BCC 27A40018 */  addiu     $a0, $sp, 0x18
/* C72D0 80130BD0 4405C000 */  mfc1      $a1, $f24
/* C72D4 80130BD4 4406A000 */  mfc1      $a2, $f20
/* C72D8 80130BD8 4407B000 */  mfc1      $a3, $f22
/* C72DC 80130BDC 0C019E40 */  jal       guTranslateF
/* C72E0 80130BE0 46000506 */   mov.s    $f20, $f0
/* C72E4 80130BE4 C642000C */  lwc1      $f2, 0xC($s2)
/* C72E8 80130BE8 3C014140 */  lui       $at, (0x41400000 >> 16)
/* C72EC 80130BEC 44810000 */  mtc1      $at, $f0
/* C72F0 80130BF0 27B10058 */  addiu     $s1, $sp, 0x58
/* C72F4 80130BF4 46001080 */  add.s     $f2, $f2, $f0
/* C72F8 80130BF8 8E450008 */  lw        $a1, 0x8($s2)
/* C72FC 80130BFC 8E470010 */  lw        $a3, 0x10($s2)
/* C7300 80130C00 44061000 */  mfc1      $a2, $f2
/* C7304 80130C04 0C019E40 */  jal       guTranslateF
/* C7308 80130C08 0220202D */   daddu    $a0, $s1, $zero
/* C730C 80130C0C 27B00098 */  addiu     $s0, $sp, 0x98
/* C7310 80130C10 4405A000 */  mfc1      $a1, $f20
/* C7314 80130C14 44800000 */  mtc1      $zero, $f0
/* C7318 80130C18 3C073F80 */  lui       $a3, (0x3F800000 >> 16)
/* C731C 80130C1C 44060000 */  mfc1      $a2, $f0
/* C7320 80130C20 0200202D */  daddu     $a0, $s0, $zero
/* C7324 80130C24 0C019EC8 */  jal       guRotateF
/* C7328 80130C28 AFA60010 */   sw       $a2, 0x10($sp)
/* C732C 80130C2C 27A40018 */  addiu     $a0, $sp, 0x18
/* C7330 80130C30 0200282D */  daddu     $a1, $s0, $zero
/* C7334 80130C34 0C019D80 */  jal       guMtxCatF
/* C7338 80130C38 0200302D */   daddu    $a2, $s0, $zero
/* C733C 80130C3C 0200202D */  daddu     $a0, $s0, $zero
/* C7340 80130C40 0220282D */  daddu     $a1, $s1, $zero
/* C7344 80130C44 27B100D8 */  addiu     $s1, $sp, 0xD8
/* C7348 80130C48 0C019D80 */  jal       guMtxCatF
/* C734C 80130C4C 0220302D */   daddu    $a2, $s1, $zero
/* C7350 80130C50 0220202D */  daddu     $a0, $s1, $zero
/* C7354 80130C54 3C138007 */  lui       $s3, %hi(gMatrixListPos)
/* C7358 80130C58 267341F0 */  addiu     $s3, $s3, %lo(gMatrixListPos)
/* C735C 80130C5C 3C14800A */  lui       $s4, %hi(gDisplayContext)
/* C7360 80130C60 2694A674 */  addiu     $s4, $s4, %lo(gDisplayContext)
glabel func_80130C64
/* C7364 80130C64 96650000 */  lhu       $a1, 0x0($s3)
/* C7368 80130C68 8E820000 */  lw        $v0, 0x0($s4)
/* C736C 80130C6C 00052980 */  sll       $a1, $a1, 6
/* C7370 80130C70 00B72821 */  addu      $a1, $a1, $s7
glabel func_80130C74
/* C7374 80130C74 0C019D40 */  jal       guMtxF2L
/* C7378 80130C78 00452821 */   addu     $a1, $v0, $a1
/* C737C 80130C7C 3C08DA38 */  lui       $t0, (0xDA380002 >> 16)
/* C7380 80130C80 35080002 */  ori       $t0, $t0, (0xDA380002 & 0xFFFF)
/* C7384 80130C84 3C0AE300 */  lui       $t2, (0xE3000A01 >> 16)
/* C7388 80130C88 354A0A01 */  ori       $t2, $t2, (0xE3000A01 & 0xFFFF)
/* C738C 80130C8C 3C0BD9C0 */  lui       $t3, (0xD9C0F9FA >> 16)
/* C7390 80130C90 356BF9FA */  ori       $t3, $t3, (0xD9C0F9FA & 0xFFFF)
/* C7394 80130C94 3C0DD9FF */  lui       $t5, (0xD9FFFFFF >> 16)
/* C7398 80130C98 35ADFFFF */  ori       $t5, $t5, (0xD9FFFFFF & 0xFFFF)
/* C739C 80130C9C 3C0C0022 */  lui       $t4, (0x220005 >> 16)
/* C73A0 80130CA0 358C0005 */  ori       $t4, $t4, (0x220005 & 0xFFFF)
/* C73A4 80130CA4 3C0EDC08 */  lui       $t6, (0xDC08060A >> 16)
/* C73A8 80130CA8 35CE060A */  ori       $t6, $t6, (0xDC08060A & 0xFFFF)
/* C73AC 80130CAC 3C0FDC08 */  lui       $t7, (0xDC08090A >> 16)
/* C73B0 80130CB0 35EF090A */  ori       $t7, $t7, (0xDC08090A & 0xFFFF)
/* C73B4 80130CB4 3C15D700 */  lui       $s5, (0xD7000002 >> 16)
/* C73B8 80130CB8 36B50002 */  ori       $s5, $s5, (0xD7000002 & 0xFFFF)
/* C73BC 80130CBC 3C16E300 */  lui       $s6, (0xE3000F00 >> 16)
/* C73C0 80130CC0 36D60F00 */  ori       $s6, $s6, (0xE3000F00 & 0xFFFF)
/* C73C4 80130CC4 3C18E300 */  lui       $t8, (0xE3000C00 >> 16)
/* C73C8 80130CC8 37180C00 */  ori       $t8, $t8, (0xE3000C00 & 0xFFFF)
/* C73CC 80130CCC 3C19E300 */  lui       $t9, (0xE3001201 >> 16)
/* C73D0 80130CD0 37391201 */  ori       $t9, $t9, (0xE3001201 & 0xFFFF)
/* C73D4 80130CD4 3C1EE300 */  lui       $fp, (0xE3001801 >> 16)
/* C73D8 80130CD8 37DE1801 */  ori       $fp, $fp, (0xE3001801 & 0xFFFF)
/* C73DC 80130CDC AFAA0140 */  sw        $t2, 0x140($sp)
/* C73E0 80130CE0 3C0AE300 */  lui       $t2, (0xE3000D01 >> 16)
/* C73E4 80130CE4 354A0D01 */  ori       $t2, $t2, (0xE3000D01 & 0xFFFF)
/* C73E8 80130CE8 AFAA0130 */  sw        $t2, 0x130($sp)
/* C73EC 80130CEC 3C0AE300 */  lui       $t2, (0xE3001402 >> 16)
/* C73F0 80130CF0 354A1402 */  ori       $t2, $t2, (0xE3001402 & 0xFFFF)
/* C73F4 80130CF4 AFAA0134 */  sw        $t2, 0x134($sp)
/* C73F8 80130CF8 3C0AE300 */  lui       $t2, (0xE3001700 >> 16)
/* C73FC 80130CFC 354A1700 */  ori       $t2, $t2, (0xE3001700 & 0xFFFF)
/* C7400 80130D00 AFAA0138 */  sw        $t2, 0x138($sp)
/* C7404 80130D04 3C0AE200 */  lui       $t2, (0xE2001E01 >> 16)
/* C7408 80130D08 354A1E01 */  ori       $t2, $t2, (0xE2001E01 & 0xFFFF)
/* C740C 80130D0C 0000202D */  daddu     $a0, $zero, $zero
/* C7410 80130D10 3C10800A */  lui       $s0, %hi(gMainGfxPos)
/* C7414 80130D14 2610A66C */  addiu     $s0, $s0, %lo(gMainGfxPos)
/* C7418 80130D18 AFAA013C */  sw        $t2, 0x13C($sp)
/* C741C 80130D1C 8E030000 */  lw        $v1, 0x0($s0)
/* C7420 80130D20 96620000 */  lhu       $v0, 0x0($s3)
/* C7424 80130D24 0060482D */  daddu     $t1, $v1, $zero
/* C7428 80130D28 24630008 */  addiu     $v1, $v1, 0x8
/* C742C 80130D2C AE030000 */  sw        $v1, 0x0($s0)
/* C7430 80130D30 AD280000 */  sw        $t0, 0x0($t1)
/* C7434 80130D34 24480001 */  addiu     $t0, $v0, 0x1
/* C7438 80130D38 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* C743C 80130D3C 00021180 */  sll       $v0, $v0, 6
/* C7440 80130D40 A6680000 */  sh        $t0, 0x0($s3)
/* C7444 80130D44 8E880000 */  lw        $t0, 0x0($s4)
/* C7448 80130D48 00571021 */  addu      $v0, $v0, $s7
/* C744C 80130D4C 01024021 */  addu      $t0, $t0, $v0
/* C7450 80130D50 24620008 */  addiu     $v0, $v1, 0x8
/* C7454 80130D54 AD280004 */  sw        $t0, 0x4($t1)
/* C7458 80130D58 AE020000 */  sw        $v0, 0x0($s0)
/* C745C 80130D5C 24620010 */  addiu     $v0, $v1, 0x10
/* C7460 80130D60 8FAA0140 */  lw        $t2, 0x140($sp)
/* C7464 80130D64 3C088015 */  lui       $t0, %hi(D_8014C6D0)
/* C7468 80130D68 2508C6D0 */  addiu     $t0, $t0, %lo(D_8014C6D0)
/* C746C 80130D6C AC6A0000 */  sw        $t2, 0x0($v1)
/* C7470 80130D70 AC600004 */  sw        $zero, 0x4($v1)
/* C7474 80130D74 AE020000 */  sw        $v0, 0x0($s0)
/* C7478 80130D78 24620018 */  addiu     $v0, $v1, 0x18
/* C747C 80130D7C AC6B0008 */  sw        $t3, 0x8($v1)
/* C7480 80130D80 AC60000C */  sw        $zero, 0xC($v1)
/* C7484 80130D84 AE020000 */  sw        $v0, 0x0($s0)
/* C7488 80130D88 24620020 */  addiu     $v0, $v1, 0x20
/* C748C 80130D8C AC6D0010 */  sw        $t5, 0x10($v1)
/* C7490 80130D90 AC6C0014 */  sw        $t4, 0x14($v1)
/* C7494 80130D94 AE020000 */  sw        $v0, 0x0($s0)
/* C7498 80130D98 3C02DB02 */  lui       $v0, (0xDB020000 >> 16)
/* C749C 80130D9C AC620018 */  sw        $v0, 0x18($v1)
/* C74A0 80130DA0 24020018 */  addiu     $v0, $zero, 0x18
/* C74A4 80130DA4 AC62001C */  sw        $v0, 0x1C($v1)
/* C74A8 80130DA8 24620028 */  addiu     $v0, $v1, 0x28
/* C74AC 80130DAC AE020000 */  sw        $v0, 0x0($s0)
/* C74B0 80130DB0 24620030 */  addiu     $v0, $v1, 0x30
/* C74B4 80130DB4 AC680024 */  sw        $t0, 0x24($v1)
/* C74B8 80130DB8 2508FFF8 */  addiu     $t0, $t0, -0x8
/* C74BC 80130DBC AC6E0020 */  sw        $t6, 0x20($v1)
/* C74C0 80130DC0 AE020000 */  sw        $v0, 0x0($s0)
/* C74C4 80130DC4 24620038 */  addiu     $v0, $v1, 0x38
/* C74C8 80130DC8 AC6F0028 */  sw        $t7, 0x28($v1)
/* C74CC 80130DCC AC68002C */  sw        $t0, 0x2C($v1)
/* C74D0 80130DD0 AE020000 */  sw        $v0, 0x0($s0)
/* C74D4 80130DD4 2402FFFF */  addiu     $v0, $zero, -0x1
/* C74D8 80130DD8 AC750030 */  sw        $s5, 0x30($v1)
/* C74DC 80130DDC AC620034 */  sw        $v0, 0x34($v1)
/* C74E0 80130DE0 24620040 */  addiu     $v0, $v1, 0x40
/* C74E4 80130DE4 AE020000 */  sw        $v0, 0x0($s0)
/* C74E8 80130DE8 24620048 */  addiu     $v0, $v1, 0x48
/* C74EC 80130DEC AC760038 */  sw        $s6, 0x38($v1)
/* C74F0 80130DF0 AC60003C */  sw        $zero, 0x3C($v1)
/* C74F4 80130DF4 AE020000 */  sw        $v0, 0x0($s0)
/* C74F8 80130DF8 3C020008 */  lui       $v0, (0x80000 >> 16)
/* C74FC 80130DFC AC780040 */  sw        $t8, 0x40($v1)
/* C7500 80130E00 AC620044 */  sw        $v0, 0x44($v1)
/* C7504 80130E04 24620050 */  addiu     $v0, $v1, 0x50
/* C7508 80130E08 AE020000 */  sw        $v0, 0x0($s0)
/* C750C 80130E0C 24022000 */  addiu     $v0, $zero, 0x2000
/* C7510 80130E10 AC62004C */  sw        $v0, 0x4C($v1)
/* C7514 80130E14 240200C0 */  addiu     $v0, $zero, 0xC0
/* C7518 80130E18 AC790048 */  sw        $t9, 0x48($v1)
/* C751C 80130E1C AC7E0050 */  sw        $fp, 0x50($v1)
/* C7520 80130E20 AC620054 */  sw        $v0, 0x54($v1)
/* C7524 80130E24 8FAA0130 */  lw        $t2, 0x130($sp)
/* C7528 80130E28 27A50118 */  addiu     $a1, $sp, 0x118
/* C752C 80130E2C AC6A0058 */  sw        $t2, 0x58($v1)
/* C7530 80130E30 AC60005C */  sw        $zero, 0x5C($v1)
/* C7534 80130E34 8FAA0134 */  lw        $t2, 0x134($sp)
/* C7538 80130E38 24020C00 */  addiu     $v0, $zero, 0xC00
/* C753C 80130E3C AC6A0060 */  sw        $t2, 0x60($v1)
/* C7540 80130E40 AC620064 */  sw        $v0, 0x64($v1)
/* C7544 80130E44 8FAA0138 */  lw        $t2, 0x138($sp)
/* C7548 80130E48 0080302D */  daddu     $a2, $a0, $zero
/* C754C 80130E4C AC6A0068 */  sw        $t2, 0x68($v1)
/* C7550 80130E50 AC60006C */  sw        $zero, 0x6C($v1)
/* C7554 80130E54 8FAA013C */  lw        $t2, 0x13C($sp)
/* C7558 80130E58 0220382D */  daddu     $a3, $s1, $zero
/* C755C 80130E5C AC6A0070 */  sw        $t2, 0x70($v1)
/* C7560 80130E60 AC600074 */  sw        $zero, 0x74($v1)
/* C7564 80130E64 8E48004C */  lw        $t0, 0x4C($s2)
/* C7568 80130E68 24620058 */  addiu     $v0, $v1, 0x58
/* C756C 80130E6C AE020000 */  sw        $v0, 0x0($s0)
/* C7570 80130E70 AFA80118 */  sw        $t0, 0x118($sp)
/* C7574 80130E74 8E480050 */  lw        $t0, 0x50($s2)
/* C7578 80130E78 24620060 */  addiu     $v0, $v1, 0x60
/* C757C 80130E7C AE020000 */  sw        $v0, 0x0($s0)
/* C7580 80130E80 AFA8011C */  sw        $t0, 0x11C($sp)
/* C7584 80130E84 96480056 */  lhu       $t0, 0x56($s2)
/* C7588 80130E88 24620068 */  addiu     $v0, $v1, 0x68
/* C758C 80130E8C AE020000 */  sw        $v0, 0x0($s0)
/* C7590 80130E90 A7A80120 */  sh        $t0, 0x120($sp)
/* C7594 80130E94 9648005A */  lhu       $t0, 0x5A($s2)
/* C7598 80130E98 24620070 */  addiu     $v0, $v1, 0x70
/* C759C 80130E9C AE020000 */  sw        $v0, 0x0($s0)
/* C75A0 80130EA0 A7A80122 */  sh        $t0, 0x122($sp)
/* C75A4 80130EA4 8E420054 */  lw        $v0, 0x54($s2)
/* C75A8 80130EA8 24630078 */  addiu     $v1, $v1, 0x78
/* C75AC 80130EAC AE030000 */  sw        $v1, 0x0($s0)
/* C75B0 80130EB0 00021023 */  negu      $v0, $v0
/* C75B4 80130EB4 00021FC2 */  srl       $v1, $v0, 31
/* C75B8 80130EB8 00431021 */  addu      $v0, $v0, $v1
/* C75BC 80130EBC 00021043 */  sra       $v0, $v0, 1
/* C75C0 80130EC0 A7A20124 */  sh        $v0, 0x124($sp)
/* C75C4 80130EC4 8E420058 */  lw        $v0, 0x58($s2)
/* C75C8 80130EC8 240300FF */  addiu     $v1, $zero, 0xFF
/* C75CC 80130ECC A3A30128 */  sb        $v1, 0x128($sp)
/* C75D0 80130ED0 00021FC2 */  srl       $v1, $v0, 31
/* C75D4 80130ED4 00431021 */  addu      $v0, $v0, $v1
/* C75D8 80130ED8 00021043 */  sra       $v0, $v0, 1
/* C75DC 80130EDC 0C04EBDC */  jal       imgfx_appendGfx_component
/* C75E0 80130EE0 A7A20126 */   sh       $v0, 0x126($sp)
/* C75E4 80130EE4 3C03D838 */  lui       $v1, (0xD8380002 >> 16)
/* C75E8 80130EE8 8E020000 */  lw        $v0, 0x0($s0)
/* C75EC 80130EEC 34630002 */  ori       $v1, $v1, (0xD8380002 & 0xFFFF)
/* C75F0 80130EF0 0040202D */  daddu     $a0, $v0, $zero
/* C75F4 80130EF4 24420008 */  addiu     $v0, $v0, 0x8
/* C75F8 80130EF8 AE020000 */  sw        $v0, 0x0($s0)
/* C75FC 80130EFC AC830000 */  sw        $v1, 0x0($a0)
/* C7600 80130F00 24030040 */  addiu     $v1, $zero, 0x40
/* C7604 80130F04 AC830004 */  sw        $v1, 0x4($a0)
/* C7608 80130F08 24430008 */  addiu     $v1, $v0, 0x8
/* C760C 80130F0C AE030000 */  sw        $v1, 0x0($s0)
/* C7610 80130F10 3C03E700 */  lui       $v1, (0xE7000000 >> 16)
/* C7614 80130F14 AC430000 */  sw        $v1, 0x0($v0)
/* C7618 80130F18 AC400004 */  sw        $zero, 0x4($v0)
/* C761C 80130F1C 8FBF016C */  lw        $ra, 0x16C($sp)
/* C7620 80130F20 8FBE0168 */  lw        $fp, 0x168($sp)
/* C7624 80130F24 8FB70164 */  lw        $s7, 0x164($sp)
/* C7628 80130F28 8FB60160 */  lw        $s6, 0x160($sp)
/* C762C 80130F2C 8FB5015C */  lw        $s5, 0x15C($sp)
/* C7630 80130F30 8FB40158 */  lw        $s4, 0x158($sp)
/* C7634 80130F34 8FB30154 */  lw        $s3, 0x154($sp)
/* C7638 80130F38 8FB20150 */  lw        $s2, 0x150($sp)
/* C763C 80130F3C 8FB1014C */  lw        $s1, 0x14C($sp)
/* C7640 80130F40 8FB00148 */  lw        $s0, 0x148($sp)
/* C7644 80130F44 D7B80180 */  ldc1      $f24, 0x180($sp)
/* C7648 80130F48 D7B60178 */  ldc1      $f22, 0x178($sp)
/* C764C 80130F4C D7B40170 */  ldc1      $f20, 0x170($sp)
/* C7650 80130F50 03E00008 */  jr        $ra
/* C7654 80130F54 27BD0188 */   addiu    $sp, $sp, 0x188

### DECOMPILED C INSTRUCTIONS:

void draw_coin_sparkles(ItemEntity* item) {
    f32 x, y, z;
    f32 angle;
    Matrix4f sp18;
    Matrix4f sp58;
    Matrix4f sp98;
    Matrix4f spD8;
    ImgFXTexture ifxImg;

    x = D_80155D8C;
    y = D_80155D8E;
    z = D_80155D90;
    angle = clamp_angle(180.0f - gCameras[gCurrentCamID].currentYaw);

    guTranslateF(sp18, x, y, z);
    guTranslateF(sp58, item->position.x, item->position.y + 12.0f, item->position.z);
    guRotateF(sp98, angle, 0.0f, 1.0f, 0.0f);
    guMtxCatF(sp18, sp98, sp98);
    guMtxCatF(sp98, sp58, spD8);
    guMtxF2L(spD8, &gDisplayContext->matrixStack[gMatrixListPos]);

    gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
    gDPSetCycleType(gMainGfxPos++, G_CYC_1CYCLE);
    gSPClearGeometryMode(gMainGfxPos++, G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH);
    gSPSetGeometryMode(gMainGfxPos++, G_ZBUFFER | G_SHADE | G_LIGHTING | G_SHADING_SMOOTH);
    gSPSetLights1(gMainGfxPos++, D_8014C6C8);
    gSPTexture(gMainGfxPos++, -1, -1, 0, G_TX_RENDERTILE, G_ON);
    gDPSetTextureLOD(gMainGfxPos++, G_TL_TILE);
    gDPSetTexturePersp(gMainGfxPos++, G_TP_PERSP);
    gDPSetTextureFilter(gMainGfxPos++, G_TF_BILERP);
    gDPSetColorDither(gMainGfxPos++, G_CD_DISABLE);
    gDPSetTextureDetail(gMainGfxPos++, G_TD_CLAMP);
    gDPSetTextureConvert(gMainGfxPos++, G_TC_FILT);
    gDPSetCombineKey(gMainGfxPos++, G_CK_NONE);
    gDPSetAlphaCompare(gMainGfxPos++, G_AC_NONE);

    ifxImg.raster = item->sparkleRaster;
    ifxImg.palette = item->sparklePalette;
    ifxImg.width = item->sparkleWidth;
    ifxImg.height = item->sparkleHeight;
    ifxImg.xOffset = -item->sparkleWidth / 2;
    ifxImg.yOffset = item->sparkleHeight / 2;
    ifxImg.alpha = 255;
    imgfx_appendGfx_component(0, &ifxImg, 0, spD8);

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


### RAW ASSEMBLY INSTRUCTIONS:

glabel confetti_main
/* 38AF6C E008817C 27BDFF78 */  addiu     $sp, $sp, -0x88
/* 38AF70 E0088180 F7B40058 */  sdc1      $f20, 0x58($sp)
/* 38AF74 E0088184 4485A000 */  mtc1      $a1, $f20
/* 38AF78 E0088188 AFB50044 */  sw        $s5, 0x44($sp)
/* 38AF7C E008818C 0080A82D */  daddu     $s5, $a0, $zero
/* 38AF80 E0088190 F7B60060 */  sdc1      $f22, 0x60($sp)
/* 38AF84 E0088194 4486B000 */  mtc1      $a2, $f22
/* 38AF88 E0088198 F7B80068 */  sdc1      $f24, 0x68($sp)
/* 38AF8C E008819C 4487C000 */  mtc1      $a3, $f24
/* 38AF90 E00881A0 2EA20007 */  sltiu     $v0, $s5, 0x7
/* 38AF94 E00881A4 AFBF0054 */  sw        $ra, 0x54($sp)
/* 38AF98 E00881A8 AFBE0050 */  sw        $fp, 0x50($sp)
/* 38AF9C E00881AC AFB7004C */  sw        $s7, 0x4C($sp)
/* 38AFA0 E00881B0 AFB60048 */  sw        $s6, 0x48($sp)
/* 38AFA4 E00881B4 AFB40040 */  sw        $s4, 0x40($sp)
/* 38AFA8 E00881B8 AFB3003C */  sw        $s3, 0x3C($sp)
/* 38AFAC E00881BC AFB20038 */  sw        $s2, 0x38($sp)
/* 38AFB0 E00881C0 AFB10034 */  sw        $s1, 0x34($sp)
/* 38AFB4 E00881C4 AFB00030 */  sw        $s0, 0x30($sp)
/* 38AFB8 E00881C8 F7BE0080 */  sdc1      $f30, 0x80($sp)
/* 38AFBC E00881CC F7BC0078 */  sdc1      $f28, 0x78($sp)
/* 38AFC0 E00881D0 F7BA0070 */  sdc1      $f26, 0x70($sp)
/* 38AFC4 E00881D4 1040000D */  beqz      $v0, .LE008820C
/* 38AFC8 E00881D8 27A40010 */   addiu    $a0, $sp, 0x10
/* 38AFCC E00881DC 00151080 */  sll       $v0, $s5, 2
/* 38AFD0 E00881E0 3C01E009 */  lui       $at, (0xE0090000 >> 16)
/* 38AFD4 E00881E4 00220821 */  addu      $at, $at, $v0
/* 38AFD8 E00881E8 8C228D30 */  lw        $v0, -0x72D0($at)
/* 38AFDC E00881EC 00400008 */  jr        $v0
/* 38AFE0 E00881F0 00000000 */   nop
/* 38AFE4 E00881F4 08022084 */  j         .LE0088210
/* 38AFE8 E00881F8 2413000C */   addiu    $s3, $zero, 0xC
/* 38AFEC E00881FC 08022084 */  j         .LE0088210
/* 38AFF0 E0088200 24130012 */   addiu    $s3, $zero, 0x12
/* 38AFF4 E0088204 08022084 */  j         .LE0088210
/* 38AFF8 E0088208 24130018 */   addiu    $s3, $zero, 0x18
.LE008820C:
/* 38AFFC E008820C 24130030 */  addiu     $s3, $zero, 0x30
.LE0088210:
/* 38B000 E0088210 2EA20007 */  sltiu     $v0, $s5, 0x7
/* 38B004 E0088214 1040000E */  beqz      $v0, .LE0088250
/* 38B008 E0088218 00151080 */   sll      $v0, $s5, 2
/* 38B00C E008821C 3C01E009 */  lui       $at, (0xE0090000 >> 16)
/* 38B010 E0088220 00220821 */  addu      $at, $at, $v0
/* 38B014 E0088224 8C228D50 */  lw        $v0, -0x72B0($at)
/* 38B018 E0088228 00400008 */  jr        $v0
/* 38B01C E008822C 00000000 */   nop
/* 38B020 E0088230 3C014040 */  lui       $at, (0x40400000 >> 16)
/* 38B024 E0088234 44818000 */  mtc1      $at, $f16
/* 38B028 E0088238 08022098 */  j         .LE0088260
/* 38B02C E008823C E7B00028 */   swc1     $f16, 0x28($sp)
/* 38B030 E0088240 3C014080 */  lui       $at, (0x40800000 >> 16)
/* 38B034 E0088244 44818000 */  mtc1      $at, $f16
/* 38B038 E0088248 08022098 */  j         .LE0088260
/* 38B03C E008824C E7B00028 */   swc1     $f16, 0x28($sp)
.LE0088250:
/* 38B040 E0088250 3C0140A0 */  lui       $at, (0x40A00000 >> 16)
/* 38B044 E0088254 44818000 */  mtc1      $at, $f16
/* 38B048 E0088258 00000000 */  nop
/* 38B04C E008825C E7B00028 */  swc1      $f16, 0x28($sp)
.LE0088260:
/* 38B050 E0088260 3C02E009 */  lui       $v0, %hi(confetti_init)
/* 38B054 E0088264 244285A0 */  addiu     $v0, $v0, %lo(confetti_init)
/* 38B058 E0088268 AC820008 */  sw        $v0, 0x8($a0)
/* 38B05C E008826C 3C02E009 */  lui       $v0, %hi(confetti_update)
/* 38B060 E0088270 244285A8 */  addiu     $v0, $v0, %lo(confetti_update)
/* 38B064 E0088274 AC82000C */  sw        $v0, 0xC($a0)
/* 38B068 E0088278 3C02E009 */  lui       $v0, %hi(confetti_render)
/* 38B06C E008827C 244287A8 */  addiu     $v0, $v0, %lo(confetti_render)
/* 38B070 E0088280 AC820010 */  sw        $v0, 0x10($a0)
/* 38B074 E0088284 24020044 */  addiu     $v0, $zero, 0x44
/* 38B078 E0088288 AC800000 */  sw        $zero, 0x0($a0)
/* 38B07C E008828C AC800014 */  sw        $zero, 0x14($a0)
/* 38B080 E0088290 0C080124 */  jal       shim_create_effect_instance
/* 38B084 E0088294 AC820004 */   sw       $v0, 0x4($a0)
/* 38B088 E0088298 26630001 */  addiu     $v1, $s3, 0x1
/* 38B08C E008829C 00032040 */  sll       $a0, $v1, 1
/* 38B090 E00882A0 00832021 */  addu      $a0, $a0, $v1
/* 38B094 E00882A4 00042080 */  sll       $a0, $a0, 2
/* 38B098 E00882A8 00832021 */  addu      $a0, $a0, $v1
/* 38B09C E00882AC 00042080 */  sll       $a0, $a0, 2
/* 38B0A0 E00882B0 0040B02D */  daddu     $s6, $v0, $zero
/* 38B0A4 E00882B4 0C08012C */  jal       shim_general_heap_malloc
/* 38B0A8 E00882B8 AEC30008 */   sw       $v1, 0x8($s6)
/* 38B0AC E00882BC 0040902D */  daddu     $s2, $v0, $zero
/* 38B0B0 E00882C0 16400003 */  bnez      $s2, .LE00882D0
/* 38B0B4 E00882C4 AED2000C */   sw       $s2, 0xC($s6)
.LE00882C8:
/* 38B0B8 E00882C8 080220B2 */  j         .LE00882C8
/* 38B0BC E00882CC 00000000 */   nop
.LE00882D0:
/* 38B0C0 E00882D0 E6540004 */  swc1      $f20, 0x4($s2)
/* 38B0C4 E00882D4 E6560008 */  swc1      $f22, 0x8($s2)
/* 38B0C8 E00882D8 E658000C */  swc1      $f24, 0xC($s2)
/* 38B0CC E00882DC AE400024 */  sw        $zero, 0x24($s2)
/* 38B0D0 E00882E0 8FA2009C */  lw        $v0, 0x9C($sp)
/* 38B0D4 E00882E4 24040168 */  addiu     $a0, $zero, 0x168
/* 38B0D8 E00882E8 AE550000 */  sw        $s5, 0x0($s2)
/* 38B0DC E00882EC AE53002C */  sw        $s3, 0x2C($s2)
/* 38B0E0 E00882F0 AE420020 */  sw        $v0, 0x20($s2)
/* 38B0E4 E00882F4 240200FF */  addiu     $v0, $zero, 0xFF
/* 38B0E8 E00882F8 AE420028 */  sw        $v0, 0x28($s2)
/* 38B0EC E00882FC 0C080138 */  jal       shim_rand_int
/* 38B0F0 E0088300 26520034 */   addiu    $s2, $s2, 0x34
/* 38B0F4 E0088304 0000882D */  daddu     $s1, $zero, $zero
/* 38B0F8 E0088308 12600092 */  beqz      $s3, .LE0088554
/* 38B0FC E008830C 0040F02D */   daddu    $fp, $v0, $zero
/* 38B100 E0088310 3C03E009 */  lui       $v1, %hi(D_E0088D70)
/* 38B104 E0088314 24638D70 */  addiu     $v1, $v1, %lo(D_E0088D70)
/* 38B108 E0088318 00151080 */  sll       $v0, $s5, 2
/* 38B10C E008831C 0043B821 */  addu      $s7, $v0, $v1
/* 38B110 E0088320 26500030 */  addiu     $s0, $s2, 0x30
/* 38B114 E0088324 0220A02D */  daddu     $s4, $s1, $zero
.LE0088328:
/* 38B118 E0088328 0C080000 */  jal       effect_rand_int
/* 38B11C E008832C 24040064 */   addiu    $a0, $zero, 0x64
/* 38B120 E0088330 3C013C23 */  lui       $at, (0x3C23D70A >> 16)
/* 38B124 E0088334 3421D70A */  ori       $at, $at, (0x3C23D70A & 0xFFFF)
/* 38B128 E0088338 44810000 */  mtc1      $at, $f0
/* 38B12C E008833C 44821000 */  mtc1      $v0, $f2
/* 38B130 E0088340 00000000 */  nop
/* 38B134 E0088344 468010A0 */  cvt.s.w   $f2, $f2
/* 38B138 E0088348 46001082 */  mul.s     $f2, $f2, $f0
/* 38B13C E008834C 00000000 */  nop
/* 38B140 E0088350 C7B00028 */  lwc1      $f16, 0x28($sp)
/* 38B144 E0088354 2EA20007 */  sltiu     $v0, $s5, 0x7
/* 38B148 E0088358 46028782 */  mul.s     $f30, $f16, $f2
/* 38B14C E008835C 00000000 */  nop
/* 38B150 E0088360 10400006 */  beqz      $v0, .LE008837C
/* 38B154 E0088364 46008021 */   cvt.d.s  $f0, $f16
/* 38B158 E0088368 8EE20000 */  lw        $v0, 0x0($s7)
/* 38B15C E008836C 080220DF */  j         .LE008837C
/* 38B160 E0088370 00000000 */   nop
/* 38B164 E0088374 C7B00028 */  lwc1      $f16, 0x28($sp)
/* 38B168 E0088378 46008021 */  cvt.d.s   $f0, $f16
.LE008837C:
/* 38B16C E008837C 3C013FE0 */  lui       $at, (0x3FE00000 >> 16)
/* 38B170 E0088380 44818800 */  mtc1      $at, $f17
/* 38B174 E0088384 44808000 */  mtc1      $zero, $f16
/* 38B178 E0088388 00000000 */  nop
/* 38B17C E008838C 46300002 */  mul.d     $f0, $f0, $f16
/* 38B180 E0088390 00000000 */  nop
/* 38B184 E0088394 46200000 */  add.d     $f0, $f0, $f0
/* 38B188 E0088398 0220102D */  daddu     $v0, $s1, $zero
/* 38B18C E008839C 06210002 */  bgez      $s1, .LE00883A8
/* 38B190 E00883A0 46200720 */   cvt.s.d  $f28, $f0
/* 38B194 E00883A4 26220003 */  addiu     $v0, $s1, 0x3
.LE00883A8:
/* 38B198 E00883A8 00021083 */  sra       $v0, $v0, 2
/* 38B19C E00883AC 4491A000 */  mtc1      $s1, $f20
/* 38B1A0 E00883B0 00000000 */  nop
/* 38B1A4 E00883B4 4680A520 */  cvt.s.w   $f20, $f20
/* 38B1A8 E00883B8 00021080 */  sll       $v0, $v0, 2
/* 38B1AC E00883BC 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
/* 38B1B0 E00883C0 44810000 */  mtc1      $at, $f0
/* 38B1B4 E00883C4 02221023 */  subu      $v0, $s1, $v0
/* 38B1B8 E00883C8 4600A502 */  mul.s     $f20, $f20, $f0
/* 38B1BC E00883CC 00000000 */  nop
/* 38B1C0 E00883D0 3C08E009 */  lui       $t0, %hi(D_E0088D08)
/* 38B1C4 E00883D4 25088D08 */  addiu     $t0, $t0, %lo(D_E0088D08)
/* 38B1C8 E00883D8 00481021 */  addu      $v0, $v0, $t0
/* 38B1CC E00883DC 90420000 */  lbu       $v0, 0x0($v0)
/* 38B1D0 E00883E0 44930000 */  mtc1      $s3, $f0
/* 38B1D4 E00883E4 00000000 */  nop
/* 38B1D8 E00883E8 46800020 */  cvt.s.w   $f0, $f0
/* 38B1DC E00883EC 4600A503 */  div.s     $f20, $f20, $f0
/* 38B1E0 E00883F0 449E0000 */  mtc1      $fp, $f0
/* 38B1E4 E00883F4 00000000 */  nop
/* 38B1E8 E00883F8 46800020 */  cvt.s.w   $f0, $f0
/* 38B1EC E00883FC 4600A500 */  add.s     $f20, $f20, $f0
/* 38B1F0 E0088400 AE550000 */  sw        $s5, 0x0($s2)
/* 38B1F4 E0088404 4482B000 */  mtc1      $v0, $f22
/* 38B1F8 E0088408 00000000 */  nop
/* 38B1FC E008840C 4680B5A0 */  cvt.s.w   $f22, $f22
/* 38B200 E0088410 0C080140 */  jal       shim_sin_deg
/* 38B204 E0088414 4600A306 */   mov.s    $f12, $f20
/* 38B208 E0088418 4600A306 */  mov.s     $f12, $f20
/* 38B20C E008841C 0C080144 */  jal       shim_cos_deg
/* 38B210 E0088420 46000606 */   mov.s    $f24, $f0
/* 38B214 E0088424 4600B306 */  mov.s     $f12, $f22
/* 38B218 E0088428 0C080140 */  jal       shim_sin_deg
/* 38B21C E008842C 46000686 */   mov.s    $f26, $f0
/* 38B220 E0088430 4600B306 */  mov.s     $f12, $f22
/* 38B224 E0088434 0C080144 */  jal       shim_cos_deg
/* 38B228 E0088438 46000506 */   mov.s    $f20, $f0
/* 38B22C E008843C 24020003 */  addiu     $v0, $zero, 0x3
/* 38B230 E0088440 16A20005 */  bne       $s5, $v0, .LE0088458
/* 38B234 E0088444 46000386 */   mov.s    $f14, $f0
/* 38B238 E0088448 0C022000 */  jal       func_E0088000
/* 38B23C E008844C 0240202D */   daddu    $a0, $s2, $zero
/* 38B240 E0088450 0802214F */  j         .LE008853C
/* 38B244 E0088454 AE140000 */   sw       $s4, 0x0($s0)
.LE0088458:
/* 38B248 E0088458 4618F182 */  mul.s     $f6, $f30, $f24
/* 38B24C E008845C 00000000 */  nop
/* 38B250 E0088460 461AF202 */  mul.s     $f8, $f30, $f26
/* 38B254 E0088464 00000000 */  nop
/* 38B258 E0088468 4618E082 */  mul.s     $f2, $f28, $f24
/* 38B25C E008846C 00000000 */  nop
/* 38B260 E0088470 4614F302 */  mul.s     $f12, $f30, $f20
/* 38B264 E0088474 00000000 */  nop
/* 38B268 E0088478 461AE002 */  mul.s     $f0, $f28, $f26
/* 38B26C E008847C 00000000 */  nop
/* 38B270 E0088480 4614E102 */  mul.s     $f4, $f28, $f20
/* 38B274 E0088484 00000000 */  nop
/* 38B278 E0088488 460E3182 */  mul.s     $f6, $f6, $f14
/* 38B27C E008848C 00000000 */  nop
/* 38B280 E0088490 460E4202 */  mul.s     $f8, $f8, $f14
/* 38B284 E0088494 00000000 */  nop
/* 38B288 E0088498 460E1082 */  mul.s     $f2, $f2, $f14
/* 38B28C E008849C 00000000 */  nop
/* 38B290 E00884A0 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 38B294 E00884A4 44815000 */  mtc1      $at, $f10
/* 38B298 E00884A8 460E0002 */  mul.s     $f0, $f0, $f14
/* 38B29C E00884AC 00000000 */  nop
/* 38B2A0 E00884B0 2AA20004 */  slti      $v0, $s5, 0x4
/* 38B2A4 E00884B4 E60CFFDC */  swc1      $f12, -0x24($s0)
/* 38B2A8 E00884B8 E604FFE8 */  swc1      $f4, -0x18($s0)
/* 38B2AC E00884BC E606FFD4 */  swc1      $f6, -0x2C($s0)
/* 38B2B0 E00884C0 460A0000 */  add.s     $f0, $f0, $f10
/* 38B2B4 E00884C4 E608FFD8 */  swc1      $f8, -0x28($s0)
/* 38B2B8 E00884C8 E602FFE0 */  swc1      $f2, -0x20($s0)
/* 38B2BC E00884CC 14400018 */  bnez      $v0, .LE0088530
/* 38B2C0 E00884D0 E600FFE4 */   swc1     $f0, -0x1C($s0)
/* 38B2C4 E00884D4 3C025555 */  lui       $v0, (0x55555556 >> 16)
/* 38B2C8 E00884D8 34425556 */  ori       $v0, $v0, (0x55555556 & 0xFFFF)
/* 38B2CC E00884DC 26240001 */  addiu     $a0, $s1, 0x1
/* 38B2D0 E00884E0 00820018 */  mult      $a0, $v0
/* 38B2D4 E00884E4 00041FC3 */  sra       $v1, $a0, 31
/* 38B2D8 E00884E8 3C01E009 */  lui       $at, (0xE0090000 >> 16)
/* 38B2DC E00884EC D4208D90 */  ldc1      $f0, -0x7270($at)
/* 38B2E0 E00884F0 00004010 */  mfhi      $t0
/* 38B2E4 E00884F4 01031823 */  subu      $v1, $t0, $v1
/* 38B2E8 E00884F8 00031040 */  sll       $v0, $v1, 1
/* 38B2EC E00884FC 00431021 */  addu      $v0, $v0, $v1
/* 38B2F0 E0088500 00822023 */  subu      $a0, $a0, $v0
/* 38B2F4 E0088504 44841000 */  mtc1      $a0, $f2
/* 38B2F8 E0088508 00000000 */  nop
/* 38B2FC E008850C 468010A1 */  cvt.d.w   $f2, $f2
/* 38B300 E0088510 46201082 */  mul.d     $f2, $f2, $f0
/* 38B304 E0088514 00000000 */  nop
/* 38B308 E0088518 3C01E009 */  lui       $at, (0xE0090000 >> 16)
/* 38B30C E008851C D4208D98 */  ldc1      $f0, -0x7268($at)
/* 38B310 E0088520 46220001 */  sub.d     $f0, $f0, $f2
/* 38B314 E0088524 46200020 */  cvt.s.d   $f0, $f0
/* 38B318 E0088528 0802214D */  j         .LE0088534
/* 38B31C E008852C E600FFEC */   swc1     $f0, -0x14($s0)
.LE0088530:
/* 38B320 E0088530 AE00FFEC */  sw        $zero, -0x14($s0)
.LE0088534:
/* 38B324 E0088534 32220003 */  andi      $v0, $s1, 0x3
/* 38B328 E0088538 AE020000 */  sw        $v0, 0x0($s0)
.LE008853C:
/* 38B32C E008853C 26940003 */  addiu     $s4, $s4, 0x3
/* 38B330 E0088540 26310001 */  addiu     $s1, $s1, 0x1
/* 38B334 E0088544 26100034 */  addiu     $s0, $s0, 0x34
/* 38B338 E0088548 0233102A */  slt       $v0, $s1, $s3
/* 38B33C E008854C 1440FF76 */  bnez      $v0, .LE0088328
/* 38B340 E0088550 26520034 */   addiu    $s2, $s2, 0x34
.LE0088554:
/* 38B344 E0088554 02C0102D */  daddu     $v0, $s6, $zero
/* 38B348 E0088558 8FBF0054 */  lw        $ra, 0x54($sp)
/* 38B34C E008855C 8FBE0050 */  lw        $fp, 0x50($sp)
/* 38B350 E0088560 8FB7004C */  lw        $s7, 0x4C($sp)
/* 38B354 E0088564 8FB60048 */  lw        $s6, 0x48($sp)
/* 38B358 E0088568 8FB50044 */  lw        $s5, 0x44($sp)
/* 38B35C E008856C 8FB40040 */  lw        $s4, 0x40($sp)
/* 38B360 E0088570 8FB3003C */  lw        $s3, 0x3C($sp)
/* 38B364 E0088574 8FB20038 */  lw        $s2, 0x38($sp)
/* 38B368 E0088578 8FB10034 */  lw        $s1, 0x34($sp)
/* 38B36C E008857C 8FB00030 */  lw        $s0, 0x30($sp)
/* 38B370 E0088580 D7BE0080 */  ldc1      $f30, 0x80($sp)
/* 38B374 E0088584 D7BC0078 */  ldc1      $f28, 0x78($sp)
/* 38B378 E0088588 D7BA0070 */  ldc1      $f26, 0x70($sp)
/* 38B37C E008858C D7B80068 */  ldc1      $f24, 0x68($sp)
/* 38B380 E0088590 D7B60060 */  ldc1      $f22, 0x60($sp)
/* 38B384 E0088594 D7B40058 */  ldc1      $f20, 0x58($sp)
/* 38B388 E0088598 03E00008 */  jr        $ra
/* 38B38C E008859C 27BD0088 */   addiu    $sp, $sp, 0x88

### DECOMPILED C INSTRUCTIONS:

EffectInstance* confetti_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5) {
    EffectBlueprint bp;
    EffectBlueprint* bpPtr = &bp;
    f32 sp28;
    ConfettiFXData* data;
    EffectInstance* effect;
    s32 numParts;
    f32 theta;
    f32 sinTheta;
    f32 cosTheta;
    f32 theta2;
    f32 sinTheta2;
    f32 cosTheta2;
    f32 temp_f28;
    f32 temp_f30;
    s32 temp_fp;
    s32 np;
    s32 var_v0;
    s32 i;

    switch (arg0) {
        case 0:
        case 4:
            np = 12;
            break;
        case 1:
        case 5:
            np = 18;
            break;
        case 2:
        case 6:
            np = 24;
            break;
        default:
            np = 48;
            break;
    }

    switch (arg0) {
        case 0:
        case 4:
            sp28 = 3.0f;
            break;
        case 1:
        case 5:
            sp28 = 4.0f;
            break;
        case 2:
        case 3:
        case 6:
        default:
            sp28 = 5.0f;
            break;
    }

    numParts = np + 1;

    bpPtr->init = confetti_init;
    bpPtr->update = confetti_update;
    bpPtr->renderWorld = confetti_render;
    bpPtr->unk_00 = 0;
    bpPtr->renderUI = NULL;
    bpPtr->effectID = EFFECT_CONFETTI;

    effect = shim_create_effect_instance(bpPtr);
    effect->numParts = numParts;
    data = effect->data.confetti = (ConfettiFXData*)shim_general_heap_malloc(numParts * sizeof(*data));
    ASSERT(effect->data.confetti != NULL);

    data->unk_04 = arg1;
    data->unk_08 = arg2;
    data->unk_0C = arg3;
    data->unk_24 = 0;
    data->unk_20 = arg5;
    data->unk_00 = arg0;
    data->unk_2C = np;
    data->unk_28 = 255;

    data++;
    temp_fp = shim_rand_int(360);

    for (i = 0; i < np; i++, data++) {
        temp_f30 = sp28 * (effect_rand_int(100) * 0.01f);
        switch (arg0) {
            case 0:
            case 4:
                temp_f28 = sp28 * 0.5 * 2.0;
                break;
            case 1:
            case 5:
                temp_f28 = sp28 * 0.5 * 2.0;
                break;
            case 2:
            case 6:
                temp_f28 = sp28 * 0.5 * 2.0;
                break;
        }
        temp_f28 = sp28 * 0.5 * 2.0;
        theta2 = D_E0088D08[i % 4];
        theta = ((i * 360.0f) / np) + temp_fp;

        data->unk_00 = arg0;

        sinTheta = shim_sin_deg(theta);
        cosTheta = shim_cos_deg(theta);
        sinTheta2 = shim_sin_deg(theta2);
        cosTheta2 = shim_cos_deg(theta2);
        if (arg0 == 3) {
            func_E0088000(data);
            data->unk_30 = i * 3;
        } else {
            data->unk_04 = temp_f30 * sinTheta * cosTheta2;
            data->unk_08 = temp_f30 * cosTheta * cosTheta2;
            data->unk_0C = temp_f30 * sinTheta2;
            data->unk_10 = temp_f28 * sinTheta * cosTheta2;
            data->unk_14 = (temp_f28 * cosTheta * cosTheta2) + 1.0f;
            data->unk_18 = temp_f28 * sinTheta2;
            if (arg0 >= 4) {
                data->unk_1C = -0.02 - ((i + 1) % 3) * 0.02;
            } else {
                data->unk_1C = 0.0f;
            }
            data->unk_30 = i & 3;
        }
    }
    return effect;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel __osDevMgrMain
/* 3C490 80061090 27BDFFB8 */  addiu     $sp, $sp, -0x48
/* 3C494 80061094 AFB20030 */  sw        $s2, 0x30($sp)
/* 3C498 80061098 00809021 */  addu      $s2, $a0, $zero
/* 3C49C 8006109C AFB40038 */  sw        $s4, 0x38($sp)
/* 3C4A0 800610A0 24140002 */  addiu     $s4, $zero, 0x2
/* 3C4A4 800610A4 AFB5003C */  sw        $s5, 0x3C($sp)
/* 3C4A8 800610A8 24150001 */  addiu     $s5, $zero, 0x1
/* 3C4AC 800610AC AFBF0040 */  sw        $ra, 0x40($sp)
/* 3C4B0 800610B0 AFB30034 */  sw        $s3, 0x34($sp)
/* 3C4B4 800610B4 AFB1002C */  sw        $s1, 0x2C($sp)
/* 3C4B8 800610B8 AFB00028 */  sw        $s0, 0x28($sp)
/* 3C4BC 800610BC AFA00018 */  sw        $zero, 0x18($sp)
.L800610C0:
/* 3C4C0 800610C0 8E440008 */  lw        $a0, 0x8($s2)
/* 3C4C4 800610C4 27A50018 */  addiu     $a1, $sp, 0x18
/* 3C4C8 800610C8 0C0195BC */  jal       osRecvMesg
/* 3C4CC 800610CC 24060001 */   addiu    $a2, $zero, 0x1
/* 3C4D0 800610D0 8FA20018 */  lw        $v0, 0x18($sp)
/* 3C4D4 800610D4 8C500014 */  lw        $s0, 0x14($v0)
/* 3C4D8 800610D8 1200007C */  beqz      $s0, .L800612CC
/* 3C4DC 800610DC 00000000 */   nop
/* 3C4E0 800610E0 92020004 */  lbu       $v0, 0x4($s0)
/* 3C4E4 800610E4 14540078 */  bne       $v0, $s4, .L800612C8
/* 3C4E8 800610E8 00000000 */   nop
/* 3C4EC 800610EC 8E020014 */  lw        $v0, 0x14($s0)
/* 3C4F0 800610F0 2C420002 */  sltiu     $v0, $v0, 0x2
/* 3C4F4 800610F4 10400074 */  beqz      $v0, .L800612C8
/* 3C4F8 800610F8 2402FFFF */   addiu    $v0, $zero, -0x1
/* 3C4FC 800610FC 9603001A */  lhu       $v1, 0x1A($s0)
/* 3C500 80061100 AE02001C */  sw        $v0, 0x1C($s0)
/* 3C504 80061104 000310C0 */  sll       $v0, $v1, 3
/* 3C508 80061108 00431021 */  addu      $v0, $v0, $v1
/* 3C50C 8006110C 00021080 */  sll       $v0, $v0, 2
/* 3C510 80061110 02021021 */  addu      $v0, $s0, $v0
/* 3C514 80061114 96030018 */  lhu       $v1, 0x18($s0)
/* 3C518 80061118 2451002C */  addiu     $s1, $v0, 0x2C
/* 3C51C 8006111C 24020003 */  addiu     $v0, $zero, 0x3
/* 3C520 80061120 10620005 */  beq       $v1, $v0, .L80061138
/* 3C524 80061124 00000000 */   nop
/* 3C528 80061128 8E220004 */  lw        $v0, 0x4($s1)
/* 3C52C 8006112C 8E23000C */  lw        $v1, 0xC($s1)
/* 3C530 80061130 00431023 */  subu      $v0, $v0, $v1
/* 3C534 80061134 AE220004 */  sw        $v0, 0x4($s1)
.L80061138:
/* 3C538 80061138 96020018 */  lhu       $v0, 0x18($s0)
/* 3C53C 8006113C 14540005 */  bne       $v0, $s4, .L80061154
/* 3C540 80061140 00009821 */   addu     $s3, $zero, $zero
/* 3C544 80061144 8FA20018 */  lw        $v0, 0x18($sp)
/* 3C548 80061148 8C420014 */  lw        $v0, 0x14($v0)
/* 3C54C 8006114C 8C420014 */  lw        $v0, 0x14($v0)
/* 3C550 80061150 2C530001 */  sltiu     $s3, $v0, 0x1
.L80061154:
/* 3C554 80061154 8E440010 */  lw        $a0, 0x10($s2)
/* 3C558 80061158 27A5001C */  addiu     $a1, $sp, 0x1C
/* 3C55C 8006115C 0C0195BC */  jal       osRecvMesg
/* 3C560 80061160 24060001 */   addiu    $a2, $zero, 0x1
/* 3C564 80061164 3C040010 */  lui       $a0, (0x100401 >> 16)
/* 3C568 80061168 0C01AD0C */  jal       __osResetGlobalIntMask
/* 3C56C 8006116C 34840401 */   ori      $a0, $a0, (0x100401 & 0xFFFF)
/* 3C570 80061170 3C050500 */  lui       $a1, (0x5000510 >> 16)
/* 3C574 80061174 8FA20018 */  lw        $v0, 0x18($sp)
/* 3C578 80061178 34A50510 */  ori       $a1, $a1, (0x5000510 & 0xFFFF)
/* 3C57C 8006117C 8E030024 */  lw        $v1, 0x24($s0)
/* 3C580 80061180 8C440014 */  lw        $a0, 0x14($v0)
/* 3C584 80061184 3C068000 */  lui       $a2, (0x80000000 >> 16)
/* 3C588 80061188 0C01ADB8 */  jal       __osEPiRawWriteIo
/* 3C58C 8006118C 00663025 */   or       $a2, $v1, $a2
.L80061190:
/* 3C590 80061190 8E44000C */  lw        $a0, 0xC($s2)
/* 3C594 80061194 27A50020 */  addiu     $a1, $sp, 0x20
/* 3C598 80061198 0C0195BC */  jal       osRecvMesg
/* 3C59C 8006119C 24060001 */   addiu    $a2, $zero, 0x1
/* 3C5A0 800611A0 8FA20018 */  lw        $v0, 0x18($sp)
/* 3C5A4 800611A4 8C500014 */  lw        $s0, 0x14($v0)
/* 3C5A8 800611A8 9603001A */  lhu       $v1, 0x1A($s0)
/* 3C5AC 800611AC 000310C0 */  sll       $v0, $v1, 3
/* 3C5B0 800611B0 00431021 */  addu      $v0, $v0, $v1
/* 3C5B4 800611B4 00021080 */  sll       $v0, $v0, 2
/* 3C5B8 800611B8 02021021 */  addu      $v0, $s0, $v0
/* 3C5BC 800611BC 2451002C */  addiu     $s1, $v0, 0x2C
/* 3C5C0 800611C0 8E230000 */  lw        $v1, 0x0($s1)
/* 3C5C4 800611C4 2402001D */  addiu     $v0, $zero, 0x1D
/* 3C5C8 800611C8 14620027 */  bne       $v1, $v0, .L80061268
/* 3C5CC 800611CC 02002021 */   addu     $a0, $s0, $zero
/* 3C5D0 800611D0 3C050500 */  lui       $a1, (0x5000510 >> 16)
/* 3C5D4 800611D4 8E020024 */  lw        $v0, 0x24($s0)
/* 3C5D8 800611D8 34A50510 */  ori       $a1, $a1, (0x5000510 & 0xFFFF)
/* 3C5DC 800611DC 3C061000 */  lui       $a2, (0x10000000 >> 16)
/* 3C5E0 800611E0 0C01ADB8 */  jal       __osEPiRawWriteIo
/* 3C5E4 800611E4 00463025 */   or       $a2, $v0, $a2
/* 3C5E8 800611E8 8FA20018 */  lw        $v0, 0x18($sp)
/* 3C5EC 800611EC 8E060024 */  lw        $a2, 0x24($s0)
/* 3C5F0 800611F0 8C440014 */  lw        $a0, 0x14($v0)
/* 3C5F4 800611F4 3C050500 */  lui       $a1, (0x5000510 >> 16)
/* 3C5F8 800611F8 0C01ADB8 */  jal       __osEPiRawWriteIo
/* 3C5FC 800611FC 34A50510 */   ori      $a1, $a1, (0x5000510 & 0xFFFF)
/* 3C600 80061200 8FA20018 */  lw        $v0, 0x18($sp)
/* 3C604 80061204 3C050500 */  lui       $a1, (0x5000508 >> 16)
/* 3C608 80061208 8C440014 */  lw        $a0, 0x14($v0)
/* 3C60C 8006120C 34A50508 */  ori       $a1, $a1, (0x5000508 & 0xFFFF)
/* 3C610 80061210 0C01AD5C */  jal       __osEPiRawReadIo
/* 3C614 80061214 27A60024 */   addiu    $a2, $sp, 0x24
/* 3C618 80061218 8FA20024 */  lw        $v0, 0x24($sp)
/* 3C61C 8006121C 3C030200 */  lui       $v1, (0x2000000 >> 16)
/* 3C620 80061220 00431024 */  and       $v0, $v0, $v1
/* 3C624 80061224 10400008 */  beqz      $v0, .L80061248
/* 3C628 80061228 3C050500 */   lui      $a1, (0x5000510 >> 16)
/* 3C62C 8006122C 8FA20018 */  lw        $v0, 0x18($sp)
/* 3C630 80061230 34A50510 */  ori       $a1, $a1, (0x5000510 & 0xFFFF)
/* 3C634 80061234 8E030024 */  lw        $v1, 0x24($s0)
/* 3C638 80061238 8C440014 */  lw        $a0, 0x14($v0)
/* 3C63C 8006123C 3C060100 */  lui       $a2, (0x1000000 >> 16)
/* 3C640 80061240 0C01ADB8 */  jal       __osEPiRawWriteIo
/* 3C644 80061244 00663025 */   or       $a2, $v1, $a2
.L80061248:
/* 3C648 80061248 3C03A460 */  lui       $v1, (0xA4600010 >> 16)
/* 3C64C 8006124C 34630010 */  ori       $v1, $v1, (0xA4600010 & 0xFFFF)
/* 3C650 80061250 3C040010 */  lui       $a0, (0x100C01 >> 16)
/* 3C654 80061254 24020004 */  addiu     $v0, $zero, 0x4
/* 3C658 80061258 AE220000 */  sw        $v0, 0x0($s1)
/* 3C65C 8006125C AC740000 */  sw        $s4, 0x0($v1)
/* 3C660 80061260 0C01ACFC */  jal       __osSetGlobalIntMask
/* 3C664 80061264 34840C01 */   ori      $a0, $a0, (0x100C01 & 0xFFFF)
.L80061268:
/* 3C668 80061268 8FA50018 */  lw        $a1, 0x18($sp)
/* 3C66C 8006126C 8CA40004 */  lw        $a0, 0x4($a1)
/* 3C670 80061270 0C019608 */  jal       osSendMesg
/* 3C674 80061274 00003021 */   addu     $a2, $zero, $zero
/* 3C678 80061278 16750006 */  bne       $s3, $s5, .L80061294
/* 3C67C 8006127C 00000000 */   nop
/* 3C680 80061280 8FA20018 */  lw        $v0, 0x18($sp)
/* 3C684 80061284 8C420014 */  lw        $v0, 0x14($v0)
/* 3C688 80061288 8C42002C */  lw        $v0, 0x2C($v0)
/* 3C68C 8006128C 1040FFC0 */  beqz      $v0, .L80061190
/* 3C690 80061290 00009821 */   addu     $s3, $zero, $zero
.L80061294:
/* 3C694 80061294 8E440010 */  lw        $a0, 0x10($s2)
/* 3C698 80061298 00002821 */  addu      $a1, $zero, $zero
/* 3C69C 8006129C 0C019608 */  jal       osSendMesg
/* 3C6A0 800612A0 00003021 */   addu     $a2, $zero, $zero
/* 3C6A4 800612A4 8FA20018 */  lw        $v0, 0x18($sp)
/* 3C6A8 800612A8 8C420014 */  lw        $v0, 0x14($v0)
/* 3C6AC 800612AC 9442001A */  lhu       $v0, 0x1A($v0)
/* 3C6B0 800612B0 1455FF83 */  bne       $v0, $s5, .L800610C0
/* 3C6B4 800612B4 00000000 */   nop
/* 3C6B8 800612B8 0C019890 */  jal       osYieldThread
/* 3C6BC 800612BC 00000000 */   nop
/* 3C6C0 800612C0 08018430 */  j         .L800610C0
/* 3C6C4 800612C4 00000000 */   nop
.L800612C8:
/* 3C6C8 800612C8 8FA20018 */  lw        $v0, 0x18($sp)
.L800612CC:
/* 3C6CC 800612CC 94420000 */  lhu       $v0, 0x0($v0)
/* 3C6D0 800612D0 2443FFF6 */  addiu     $v1, $v0, -0xA
/* 3C6D4 800612D4 2C620007 */  sltiu     $v0, $v1, 0x7
/* 3C6D8 800612D8 10400042 */  beqz      $v0, .L800613E4
/* 3C6DC 800612DC 00031080 */   sll      $v0, $v1, 2
/* 3C6E0 800612E0 3C01800A */  lui       $at, %hi(jtbl_80099B20)
/* 3C6E4 800612E4 00220821 */  addu      $at, $at, $v0
/* 3C6E8 800612E8 8C229B20 */  lw        $v0, %lo(jtbl_80099B20)($at)
/* 3C6EC 800612EC 00400008 */  jr        $v0
/* 3C6F0 800612F0 00000000 */   nop
glabel .L800612F4
/* 3C6F4 800612F4 8E440010 */  lw        $a0, 0x10($s2)
/* 3C6F8 800612F8 27A5001C */  addiu     $a1, $sp, 0x1C
/* 3C6FC 800612FC 0C0195BC */  jal       osRecvMesg
/* 3C700 80061300 24060001 */   addiu    $a2, $zero, 0x1
/* 3C704 80061304 8FA20018 */  lw        $v0, 0x18($sp)
/* 3C708 80061308 8C45000C */  lw        $a1, 0xC($v0)
/* 3C70C 8006130C 8C460008 */  lw        $a2, 0x8($v0)
/* 3C710 80061310 8C470010 */  lw        $a3, 0x10($v0)
/* 3C714 80061314 8E420014 */  lw        $v0, 0x14($s2)
/* 3C718 80061318 0040F809 */  jalr      $v0
/* 3C71C 8006131C 00002021 */   addu     $a0, $zero, $zero
/* 3C720 80061320 080184FA */  j         .L800613E8
/* 3C724 80061324 00000000 */   nop
glabel .L80061328
/* 3C728 80061328 8E440010 */  lw        $a0, 0x10($s2)
/* 3C72C 8006132C 27A5001C */  addiu     $a1, $sp, 0x1C
/* 3C730 80061330 0C0195BC */  jal       osRecvMesg
/* 3C734 80061334 24060001 */   addiu    $a2, $zero, 0x1
/* 3C738 80061338 8FA20018 */  lw        $v0, 0x18($sp)
/* 3C73C 8006133C 8C45000C */  lw        $a1, 0xC($v0)
/* 3C740 80061340 8C460008 */  lw        $a2, 0x8($v0)
/* 3C744 80061344 8C470010 */  lw        $a3, 0x10($v0)
/* 3C748 80061348 8E420014 */  lw        $v0, 0x14($s2)
/* 3C74C 8006134C 0040F809 */  jalr      $v0
/* 3C750 80061350 24040001 */   addiu    $a0, $zero, 0x1
/* 3C754 80061354 080184FA */  j         .L800613E8
/* 3C758 80061358 00000000 */   nop
glabel .L8006135C
/* 3C75C 8006135C 8E440010 */  lw        $a0, 0x10($s2)
/* 3C760 80061360 27A5001C */  addiu     $a1, $sp, 0x1C
/* 3C764 80061364 0C0195BC */  jal       osRecvMesg
/* 3C768 80061368 24060001 */   addiu    $a2, $zero, 0x1
/* 3C76C 8006136C 8FA20018 */  lw        $v0, 0x18($sp)
/* 3C770 80061370 8C430010 */  lw        $v1, 0x10($v0)
/* 3C774 80061374 AFA30010 */  sw        $v1, 0x10($sp)
/* 3C778 80061378 8C440014 */  lw        $a0, 0x14($v0)
/* 3C77C 8006137C 8C46000C */  lw        $a2, 0xC($v0)
/* 3C780 80061380 8C470008 */  lw        $a3, 0x8($v0)
/* 3C784 80061384 8E420018 */  lw        $v0, 0x18($s2)
/* 3C788 80061388 0040F809 */  jalr      $v0
/* 3C78C 8006138C 00002821 */   addu     $a1, $zero, $zero
/* 3C790 80061390 080184FA */  j         .L800613E8
/* 3C794 80061394 00000000 */   nop
glabel .L80061398
/* 3C798 80061398 8E440010 */  lw        $a0, 0x10($s2)
/* 3C79C 8006139C 27A5001C */  addiu     $a1, $sp, 0x1C
/* 3C7A0 800613A0 0C0195BC */  jal       osRecvMesg
/* 3C7A4 800613A4 24060001 */   addiu    $a2, $zero, 0x1
/* 3C7A8 800613A8 8FA20018 */  lw        $v0, 0x18($sp)
/* 3C7AC 800613AC 8C430010 */  lw        $v1, 0x10($v0)
/* 3C7B0 800613B0 AFA30010 */  sw        $v1, 0x10($sp)
/* 3C7B4 800613B4 8C440014 */  lw        $a0, 0x14($v0)
/* 3C7B8 800613B8 8C46000C */  lw        $a2, 0xC($v0)
/* 3C7BC 800613BC 8C470008 */  lw        $a3, 0x8($v0)
/* 3C7C0 800613C0 8E420018 */  lw        $v0, 0x18($s2)
/* 3C7C4 800613C4 0040F809 */  jalr      $v0
/* 3C7C8 800613C8 24050001 */   addiu    $a1, $zero, 0x1
/* 3C7CC 800613CC 080184FA */  j         .L800613E8
/* 3C7D0 800613D0 00000000 */   nop
glabel .L800613D4
/* 3C7D4 800613D4 8FA50018 */  lw        $a1, 0x18($sp)
/* 3C7D8 800613D8 8CA40004 */  lw        $a0, 0x4($a1)
/* 3C7DC 800613DC 0C019608 */  jal       osSendMesg
/* 3C7E0 800613E0 00003021 */   addu     $a2, $zero, $zero
glabel .L800613E4
/* 3C7E4 800613E4 2402FFFF */  addiu     $v0, $zero, -0x1
.L800613E8:
/* 3C7E8 800613E8 1440FF35 */  bnez      $v0, .L800610C0
/* 3C7EC 800613EC 27A50020 */   addiu    $a1, $sp, 0x20
/* 3C7F0 800613F0 8E44000C */  lw        $a0, 0xC($s2)
/* 3C7F4 800613F4 0C0195BC */  jal       osRecvMesg
/* 3C7F8 800613F8 24060001 */   addiu    $a2, $zero, 0x1
/* 3C7FC 800613FC 8FA50018 */  lw        $a1, 0x18($sp)
/* 3C800 80061400 8CA40004 */  lw        $a0, 0x4($a1)
/* 3C804 80061404 0C019608 */  jal       osSendMesg
/* 3C808 80061408 00003021 */   addu     $a2, $zero, $zero
/* 3C80C 8006140C 8E440010 */  lw        $a0, 0x10($s2)
/* 3C810 80061410 00002821 */  addu      $a1, $zero, $zero
/* 3C814 80061414 0C019608 */  jal       osSendMesg
/* 3C818 80061418 00003021 */   addu     $a2, $zero, $zero
/* 3C81C 8006141C 08018430 */  j         .L800610C0
/* 3C820 80061420 00000000 */   nop
/* 3C824 80061424 8FBF0040 */  lw        $ra, 0x40($sp)
/* 3C828 80061428 8FB5003C */  lw        $s5, 0x3C($sp)
/* 3C82C 8006142C 8FB40038 */  lw        $s4, 0x38($sp)
/* 3C830 80061430 8FB30034 */  lw        $s3, 0x34($sp)
/* 3C834 80061434 8FB20030 */  lw        $s2, 0x30($sp)
/* 3C838 80061438 8FB1002C */  lw        $s1, 0x2C($sp)
/* 3C83C 8006143C 8FB00028 */  lw        $s0, 0x28($sp)
/* 3C840 80061440 03E00008 */  jr        $ra
/* 3C844 80061444 27BD0048 */   addiu    $sp, $sp, 0x48
/* 3C848 80061448 00000000 */  nop
/* 3C84C 8006144C 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void __osDevMgrMain(void *args) {
    OSIoMesg *mb = NULL;
    OSMesg em;
    OSMesg dummy;
    s32 ret = 0;
    OSDevMgr *dm = (OSDevMgr *)args;
    s32 messageSend = 0;

    while (TRUE)
    {
        osRecvMesg(dm->cmdQueue, (OSMesg)&mb, OS_MESG_BLOCK);

        if (mb->piHandle != NULL &&
            mb->piHandle->type == DEVICE_TYPE_64DD &&
            (mb->piHandle->transferInfo.cmdType == LEO_CMD_TYPE_0 ||
             mb->piHandle->transferInfo.cmdType == LEO_CMD_TYPE_1))
        {
            __OSBlockInfo *blockInfo;
            __OSTranxInfo *info;
            info = &mb->piHandle->transferInfo;
            blockInfo = &info->block[info->blockNum];
            info->sectorNum = -1;

            if (info->transferMode != LEO_SECTOR_MODE) {
                blockInfo->dramAddr = (void *)((u32)blockInfo->dramAddr - blockInfo->sectorSize);
            }

            if (info->transferMode == LEO_TRACK_MODE && mb->piHandle->transferInfo.cmdType == LEO_CMD_TYPE_0) {
                messageSend = 1;
            } else {
                messageSend = 0;
            }

            osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK);
            __osResetGlobalIntMask(OS_IM_PI);
            __osEPiRawWriteIo(mb->piHandle, LEO_BM_CTL, (info->bmCtlShadow | 0x80000000));

doMessageSend:
                osRecvMesg(dm->evtQueue, &em, OS_MESG_BLOCK);
                info = &mb->piHandle->transferInfo;
                blockInfo = &info->block[info->blockNum];

                if (blockInfo->errStatus == LEO_ERROR_29) {
                    u32 stat;
                    __osEPiRawWriteIo(mb->piHandle, LEO_BM_CTL, info->bmCtlShadow | LEO_BM_CTL_RESET);
                    __osEPiRawWriteIo(mb->piHandle, LEO_BM_CTL, info->bmCtlShadow);
                    __osEPiRawReadIo(mb->piHandle, LEO_STATUS, &stat);

                    if (stat & LEO_STATUS_MECHANIC_INTERRUPT) {
                        __osEPiRawWriteIo(mb->piHandle, LEO_BM_CTL, info->bmCtlShadow | LEO_BM_CTL_CLR_MECHANIC_INTR);
                    }

                    blockInfo->errStatus = LEO_ERROR_4;
                    IO_WRITE(PI_STATUS_REG, PI_CLR_INTR);
                    __osSetGlobalIntMask(OS_IM_PI | SR_IBIT4);
                }

                osSendMesg(mb->hdr.retQueue, mb, OS_MESG_NOBLOCK);

                if (messageSend == 1 && mb->piHandle->transferInfo.block[0].errStatus == LEO_ERROR_GOOD) {
                    messageSend = 0;
                    goto doMessageSend;
                }

            osSendMesg(dm->acsQueue, NULL, OS_MESG_NOBLOCK);
            if (mb->piHandle->transferInfo.blockNum == 1) {
                osYieldThread();
            }
        } else {
            switch (mb->hdr.type) {
                case OS_MESG_TYPE_DMAREAD:
                    osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK);
                    ret = dm->dma(OS_READ, mb->devAddr, mb->dramAddr, mb->size);
                    break;
                case OS_MESG_TYPE_DMAWRITE:
                    osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK);
                    ret = dm->dma(OS_WRITE, mb->devAddr, mb->dramAddr, mb->size);
                    break;
                case OS_MESG_TYPE_EDMAREAD:
                    osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK);
                    ret = dm->edma(mb->piHandle, OS_READ, mb->devAddr, mb->dramAddr,
                                mb->size);
                    break;
                case OS_MESG_TYPE_EDMAWRITE:
                    osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK);
                    ret = dm->edma(mb->piHandle, OS_WRITE, mb->devAddr, mb->dramAddr,
                                mb->size);
                    break;
                case OS_MESG_TYPE_LOOPBACK:
                    osSendMesg(mb->hdr.retQueue, mb, OS_MESG_NOBLOCK);
                    ret = -1;
                    break;
                default:
                    ret = -1;
                    break;
            }

            if (ret == 0) {
                osRecvMesg(dm->evtQueue, &em, OS_MESG_BLOCK);
                osSendMesg(mb->hdr.retQueue, mb, OS_MESG_NOBLOCK);
                osSendMesg(dm->acsQueue, NULL, OS_MESG_NOBLOCK);
            }
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel embers_appendGfx
/* 3DBA60 E00E0600 27BDFF48 */  addiu     $sp, $sp, -0xB8
/* 3DBA64 E00E0604 AFBE00B0 */  sw        $fp, 0xB0($sp)
/* 3DBA68 E00E0608 0080F02D */  daddu     $fp, $a0, $zero
/* 3DBA6C E00E060C 3C06DB06 */  lui       $a2, (0xDB060024 >> 16)
/* 3DBA70 E00E0610 34C60024 */  ori       $a2, $a2, (0xDB060024 & 0xFFFF)
/* 3DBA74 E00E0614 27A40010 */  addiu     $a0, $sp, 0x10
/* 3DBA78 E00E0618 AFB3009C */  sw        $s3, 0x9C($sp)
/* 3DBA7C E00E061C 3C130001 */  lui       $s3, (0x11630 >> 16)
/* 3DBA80 E00E0620 36731630 */  ori       $s3, $s3, (0x11630 & 0xFFFF)
/* 3DBA84 E00E0624 AFB500A4 */  sw        $s5, 0xA4($sp)
/* 3DBA88 E00E0628 24150001 */  addiu     $s5, $zero, 0x1
/* 3DBA8C E00E062C AFB600A8 */  sw        $s6, 0xA8($sp)
/* 3DBA90 E00E0630 3C16800A */  lui       $s6, %hi(gMainGfxPos)
/* 3DBA94 E00E0634 26D6A66C */  addiu     $s6, $s6, %lo(gMainGfxPos)
/* 3DBA98 E00E0638 AFBF00B4 */  sw        $ra, 0xB4($sp)
/* 3DBA9C E00E063C AFB700AC */  sw        $s7, 0xAC($sp)
/* 3DBAA0 E00E0640 AFB400A0 */  sw        $s4, 0xA0($sp)
/* 3DBAA4 E00E0644 AFB20098 */  sw        $s2, 0x98($sp)
/* 3DBAA8 E00E0648 AFB10094 */  sw        $s1, 0x94($sp)
/* 3DBAAC E00E064C AFB00090 */  sw        $s0, 0x90($sp)
/* 3DBAB0 E00E0650 8EC50000 */  lw        $a1, 0x0($s6)
/* 3DBAB4 E00E0654 8FD4000C */  lw        $s4, 0xC($fp)
/* 3DBAB8 E00E0658 00A0182D */  daddu     $v1, $a1, $zero
/* 3DBABC E00E065C 24A50008 */  addiu     $a1, $a1, 0x8
/* 3DBAC0 E00E0660 AEC50000 */  sw        $a1, 0x0($s6)
/* 3DBAC4 E00E0664 8E92002C */  lw        $s2, 0x2C($s4)
/* 3DBAC8 E00E0668 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 3DBACC E00E066C AC620000 */  sw        $v0, 0x0($v1)
/* 3DBAD0 E00E0670 AC600004 */  sw        $zero, 0x4($v1)
/* 3DBAD4 E00E0674 ACA60000 */  sw        $a2, 0x0($a1)
/* 3DBAD8 E00E0678 8FC30010 */  lw        $v1, 0x10($fp)
/* 3DBADC E00E067C 24A20008 */  addiu     $v0, $a1, 0x8
/* 3DBAE0 E00E0680 AEC20000 */  sw        $v0, 0x0($s6)
/* 3DBAE4 E00E0684 8C62001C */  lw        $v0, 0x1C($v1)
/* 3DBAE8 E00E0688 3C038000 */  lui       $v1, (0x80000000 >> 16)
/* 3DBAEC E00E068C 00431021 */  addu      $v0, $v0, $v1
/* 3DBAF0 E00E0690 3C03800B */  lui       $v1, %hi(gCameras)
/* 3DBAF4 E00E0694 24631D80 */  addiu     $v1, $v1, %lo(gCameras)
/* 3DBAF8 E00E0698 ACA20004 */  sw        $v0, 0x4($a1)
/* 3DBAFC E00E069C 8E850004 */  lw        $a1, 0x4($s4)
/* 3DBB00 E00E06A0 8E860008 */  lw        $a2, 0x8($s4)
/* 3DBB04 E00E06A4 3C028007 */  lui       $v0, %hi(gCurrentCameraID)
/* 3DBB08 E00E06A8 8C427410 */  lw        $v0, %lo(gCurrentCameraID)($v0)
/* 3DBB0C E00E06AC 8E87000C */  lw        $a3, 0xC($s4)
/* 3DBB10 E00E06B0 00028080 */  sll       $s0, $v0, 2
/* 3DBB14 E00E06B4 02028021 */  addu      $s0, $s0, $v0
/* 3DBB18 E00E06B8 00108080 */  sll       $s0, $s0, 2
/* 3DBB1C E00E06BC 02028023 */  subu      $s0, $s0, $v0
/* 3DBB20 E00E06C0 001010C0 */  sll       $v0, $s0, 3
/* 3DBB24 E00E06C4 02028021 */  addu      $s0, $s0, $v0
/* 3DBB28 E00E06C8 001080C0 */  sll       $s0, $s0, 3
/* 3DBB2C E00E06CC 0C080108 */  jal       shim_guTranslateF
/* 3DBB30 E00E06D0 02038021 */   addu     $s0, $s0, $v1
/* 3DBB34 E00E06D4 27B10050 */  addiu     $s1, $sp, 0x50
/* 3DBB38 E00E06D8 8E850040 */  lw        $a1, 0x40($s4)
/* 3DBB3C E00E06DC 0220202D */  daddu     $a0, $s1, $zero
/* 3DBB40 E00E06E0 00A0302D */  daddu     $a2, $a1, $zero
/* 3DBB44 E00E06E4 0C080110 */  jal       shim_guScaleF
/* 3DBB48 E00E06E8 00A0382D */   daddu    $a3, $a1, $zero
/* 3DBB4C E00E06EC 0220202D */  daddu     $a0, $s1, $zero
/* 3DBB50 E00E06F0 27A50010 */  addiu     $a1, $sp, 0x10
/* 3DBB54 E00E06F4 0C080114 */  jal       shim_guMtxCatF
/* 3DBB58 E00E06F8 00A0302D */   daddu    $a2, $a1, $zero
/* 3DBB5C E00E06FC 27A40010 */  addiu     $a0, $sp, 0x10
/* 3DBB60 E00E0700 3C118007 */  lui       $s1, %hi(gMatrixListPos)
/* 3DBB64 E00E0704 263141F0 */  addiu     $s1, $s1, %lo(gMatrixListPos)
/* 3DBB68 E00E0708 3C17800A */  lui       $s7, %hi(gDisplayContext)
/* 3DBB6C E00E070C 26F7A674 */  addiu     $s7, $s7, %lo(gDisplayContext)
/* 3DBB70 E00E0710 96250000 */  lhu       $a1, 0x0($s1)
/* 3DBB74 E00E0714 8EE20000 */  lw        $v0, 0x0($s7)
/* 3DBB78 E00E0718 00052980 */  sll       $a1, $a1, 6
/* 3DBB7C E00E071C 00B32821 */  addu      $a1, $a1, $s3
/* 3DBB80 E00E0720 0C080118 */  jal       shim_guMtxF2L
/* 3DBB84 E00E0724 00452821 */   addu     $a1, $v0, $a1
/* 3DBB88 E00E0728 3C03DA38 */  lui       $v1, (0xDA380002 >> 16)
/* 3DBB8C E00E072C 34630002 */  ori       $v1, $v1, (0xDA380002 & 0xFFFF)
/* 3DBB90 E00E0730 3C06DA38 */  lui       $a2, (0xDA380000 >> 16)
/* 3DBB94 E00E0734 00D53025 */  or        $a2, $a2, $s5
/* 3DBB98 E00E0738 325200FF */  andi      $s2, $s2, 0xFF
/* 3DBB9C E00E073C 8EC40000 */  lw        $a0, 0x0($s6)
/* 3DBBA0 E00E0740 96220000 */  lhu       $v0, 0x0($s1)
/* 3DBBA4 E00E0744 0080282D */  daddu     $a1, $a0, $zero
/* 3DBBA8 E00E0748 24840008 */  addiu     $a0, $a0, 0x8
/* 3DBBAC E00E074C AEC40000 */  sw        $a0, 0x0($s6)
/* 3DBBB0 E00E0750 ACA30000 */  sw        $v1, 0x0($a1)
/* 3DBBB4 E00E0754 00551821 */  addu      $v1, $v0, $s5
/* 3DBBB8 E00E0758 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 3DBBBC E00E075C 00021180 */  sll       $v0, $v0, 6
/* 3DBBC0 E00E0760 A6230000 */  sh        $v1, 0x0($s1)
/* 3DBBC4 E00E0764 8EE30000 */  lw        $v1, 0x0($s7)
/* 3DBBC8 E00E0768 00531021 */  addu      $v0, $v0, $s3
/* 3DBBCC E00E076C 00621821 */  addu      $v1, $v1, $v0
/* 3DBBD0 E00E0770 24820008 */  addiu     $v0, $a0, 0x8
/* 3DBBD4 E00E0774 ACA30004 */  sw        $v1, 0x4($a1)
/* 3DBBD8 E00E0778 AEC20000 */  sw        $v0, 0x0($s6)
/* 3DBBDC E00E077C 24820010 */  addiu     $v0, $a0, 0x10
/* 3DBBE0 E00E0780 AC860000 */  sw        $a2, 0x0($a0)
/* 3DBBE4 E00E0784 AEC20000 */  sw        $v0, 0x0($s6)
/* 3DBBE8 E00E0788 8E030204 */  lw        $v1, 0x204($s0)
/* 3DBBEC E00E078C 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 3DBBF0 E00E0790 AC820008 */  sw        $v0, 0x8($a0)
/* 3DBBF4 E00E0794 AC830004 */  sw        $v1, 0x4($a0)
/* 3DBBF8 E00E0798 92820023 */  lbu       $v0, 0x23($s4)
/* 3DBBFC E00E079C 92850027 */  lbu       $a1, 0x27($s4)
/* 3DBC00 E00E07A0 9286002B */  lbu       $a2, 0x2B($s4)
/* 3DBC04 E00E07A4 24830018 */  addiu     $v1, $a0, 0x18
/* 3DBC08 E00E07A8 AEC30000 */  sw        $v1, 0x0($s6)
/* 3DBC0C E00E07AC 3C03FB00 */  lui       $v1, (0xFB000000 >> 16)
/* 3DBC10 E00E07B0 AC830010 */  sw        $v1, 0x10($a0)
/* 3DBC14 E00E07B4 00021600 */  sll       $v0, $v0, 24
/* 3DBC18 E00E07B8 00052C00 */  sll       $a1, $a1, 16
/* 3DBC1C E00E07BC 00451025 */  or        $v0, $v0, $a1
/* 3DBC20 E00E07C0 00063200 */  sll       $a2, $a2, 8
/* 3DBC24 E00E07C4 00461025 */  or        $v0, $v0, $a2
/* 3DBC28 E00E07C8 00521025 */  or        $v0, $v0, $s2
/* 3DBC2C E00E07CC AC82000C */  sw        $v0, 0xC($a0)
/* 3DBC30 E00E07D0 92820033 */  lbu       $v0, 0x33($s4)
/* 3DBC34 E00E07D4 92850037 */  lbu       $a1, 0x37($s4)
/* 3DBC38 E00E07D8 9286003B */  lbu       $a2, 0x3B($s4)
/* 3DBC3C E00E07DC 9287003F */  lbu       $a3, 0x3F($s4)
/* 3DBC40 E00E07E0 3C03DE00 */  lui       $v1, (0xDE000000 >> 16)
/* 3DBC44 E00E07E4 AC830018 */  sw        $v1, 0x18($a0)
/* 3DBC48 E00E07E8 00021600 */  sll       $v0, $v0, 24
/* 3DBC4C E00E07EC 00052C00 */  sll       $a1, $a1, 16
/* 3DBC50 E00E07F0 00451025 */  or        $v0, $v0, $a1
/* 3DBC54 E00E07F4 00063200 */  sll       $a2, $a2, 8
/* 3DBC58 E00E07F8 00461025 */  or        $v0, $v0, $a2
/* 3DBC5C E00E07FC 00471025 */  or        $v0, $v0, $a3
/* 3DBC60 E00E0800 AC820014 */  sw        $v0, 0x14($a0)
/* 3DBC64 E00E0804 3C02E00E */  lui       $v0, (0xE00E0A44 >> 16)
/* 3DBC68 E00E0808 8C420A44 */  lw        $v0, (0xE00E0A44 & 0xFFFF)($v0)
/* 3DBC6C E00E080C 26940070 */  addiu     $s4, $s4, 0x70
/* 3DBC70 E00E0810 AC82001C */  sw        $v0, 0x1C($a0)
/* 3DBC74 E00E0814 8FC20008 */  lw        $v0, 0x8($fp)
/* 3DBC78 E00E0818 24840020 */  addiu     $a0, $a0, 0x20
/* 3DBC7C E00E081C 02A2102A */  slt       $v0, $s5, $v0
/* 3DBC80 E00E0820 10400070 */  beqz      $v0, .LE00E09E4
/* 3DBC84 E00E0824 AEC40000 */   sw       $a0, 0x0($s6)
/* 3DBC88 E00E0828 0220982D */  daddu     $s3, $s1, $zero
/* 3DBC8C E00E082C 3C120001 */  lui       $s2, (0x11630 >> 16)
/* 3DBC90 E00E0830 36521630 */  ori       $s2, $s2, (0x11630 & 0xFFFF)
/* 3DBC94 E00E0834 02C0882D */  daddu     $s1, $s6, $zero
/* 3DBC98 E00E0838 3C16F200 */  lui       $s6, (0xF2000000 >> 16)
/* 3DBC9C E00E083C 26900060 */  addiu     $s0, $s4, 0x60
.LE00E0840:
/* 3DBCA0 E00E0840 8E020004 */  lw        $v0, 0x4($s0)
/* 3DBCA4 E00E0844 04420063 */  bltzl     $v0, .LE00E09D4
/* 3DBCA8 E00E0848 26B50001 */   addiu    $s5, $s5, 0x1
/* 3DBCAC E00E084C 8E05FFA4 */  lw        $a1, -0x5C($s0)
/* 3DBCB0 E00E0850 8E06FFA8 */  lw        $a2, -0x58($s0)
/* 3DBCB4 E00E0854 8E07FFAC */  lw        $a3, -0x54($s0)
/* 3DBCB8 E00E0858 0C080108 */  jal       shim_guTranslateF
/* 3DBCBC E00E085C 27A40010 */   addiu    $a0, $sp, 0x10
/* 3DBCC0 E00E0860 27A40010 */  addiu     $a0, $sp, 0x10
/* 3DBCC4 E00E0864 96650000 */  lhu       $a1, 0x0($s3)
/* 3DBCC8 E00E0868 8EE20000 */  lw        $v0, 0x0($s7)
/* 3DBCCC E00E086C 00052980 */  sll       $a1, $a1, 6
/* 3DBCD0 E00E0870 00B22821 */  addu      $a1, $a1, $s2
/* 3DBCD4 E00E0874 0C080118 */  jal       shim_guMtxF2L
/* 3DBCD8 E00E0878 00452821 */   addu     $a1, $v0, $a1
/* 3DBCDC E00E087C 8E260000 */  lw        $a2, 0x0($s1)
/* 3DBCE0 E00E0880 02A0382D */  daddu     $a3, $s5, $zero
/* 3DBCE4 E00E0884 00C0202D */  daddu     $a0, $a2, $zero
/* 3DBCE8 E00E0888 24C60008 */  addiu     $a2, $a2, 0x8
/* 3DBCEC E00E088C AE260000 */  sw        $a2, 0x0($s1)
/* 3DBCF0 E00E0890 96620000 */  lhu       $v0, 0x0($s3)
/* 3DBCF4 E00E0894 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 3DBCF8 E00E0898 AC830000 */  sw        $v1, 0x0($a0)
/* 3DBCFC E00E089C 24430001 */  addiu     $v1, $v0, 0x1
/* 3DBD00 E00E08A0 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 3DBD04 E00E08A4 00021180 */  sll       $v0, $v0, 6
/* 3DBD08 E00E08A8 A6630000 */  sh        $v1, 0x0($s3)
/* 3DBD0C E00E08AC 8EE30000 */  lw        $v1, 0x0($s7)
/* 3DBD10 E00E08B0 00521021 */  addu      $v0, $v0, $s2
/* 3DBD14 E00E08B4 00621821 */  addu      $v1, $v1, $v0
/* 3DBD18 E00E08B8 24C20008 */  addiu     $v0, $a2, 0x8
/* 3DBD1C E00E08BC AC830004 */  sw        $v1, 0x4($a0)
/* 3DBD20 E00E08C0 06A10002 */  bgez      $s5, .LE00E08CC
/* 3DBD24 E00E08C4 AE220000 */   sw       $v0, 0x0($s1)
/* 3DBD28 E00E08C8 26A70003 */  addiu     $a3, $s5, 0x3
.LE00E08CC:
/* 3DBD2C E00E08CC 3C040003 */  lui       $a0, (0x3C000 >> 16)
/* 3DBD30 E00E08D0 3484C000 */  ori       $a0, $a0, (0x3C000 & 0xFFFF)
/* 3DBD34 E00E08D4 3C05D838 */  lui       $a1, (0xD8380002 >> 16)
/* 3DBD38 E00E08D8 34A50002 */  ori       $a1, $a1, (0xD8380002 & 0xFFFF)
/* 3DBD3C E00E08DC 00071883 */  sra       $v1, $a3, 2
/* 3DBD40 E00E08E0 00031880 */  sll       $v1, $v1, 2
/* 3DBD44 E00E08E4 02A31823 */  subu      $v1, $s5, $v1
/* 3DBD48 E00E08E8 00031180 */  sll       $v0, $v1, 6
/* 3DBD4C E00E08EC 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3DBD50 E00E08F0 00561025 */  or        $v0, $v0, $s6
/* 3DBD54 E00E08F4 00031980 */  sll       $v1, $v1, 6
/* 3DBD58 E00E08F8 3463003C */  ori       $v1, $v1, 0x3C
/* 3DBD5C E00E08FC 30630FFF */  andi      $v1, $v1, 0xFFF
/* 3DBD60 E00E0900 00641825 */  or        $v1, $v1, $a0
/* 3DBD64 E00E0904 ACC20000 */  sw        $v0, 0x0($a2)
/* 3DBD68 E00E0908 24C20010 */  addiu     $v0, $a2, 0x10
/* 3DBD6C E00E090C ACC30004 */  sw        $v1, 0x4($a2)
/* 3DBD70 E00E0910 AE220000 */  sw        $v0, 0x0($s1)
/* 3DBD74 E00E0914 24C20018 */  addiu     $v0, $a2, 0x18
/* 3DBD78 E00E0918 C600FFFC */  lwc1      $f0, -0x4($s0)
/* 3DBD7C E00E091C 3C040100 */  lui       $a0, (0x1000000 >> 16)
/* 3DBD80 E00E0920 AE220000 */  sw        $v0, 0x0($s1)
/* 3DBD84 E00E0924 4600010D */  trunc.w.s $f4, $f0
/* 3DBD88 E00E0928 44032000 */  mfc1      $v1, $f4
/* 3DBD8C E00E092C 00000000 */  nop
/* 3DBD90 E00E0930 00031880 */  sll       $v1, $v1, 2
/* 3DBD94 E00E0934 30630FFF */  andi      $v1, $v1, 0xFFF
/* 3DBD98 E00E0938 C6000000 */  lwc1      $f0, 0x0($s0)
/* 3DBD9C E00E093C 00031B00 */  sll       $v1, $v1, 12
/* 3DBDA0 E00E0940 4600010D */  trunc.w.s $f4, $f0
/* 3DBDA4 E00E0944 44022000 */  mfc1      $v0, $f4
/* 3DBDA8 E00E0948 00000000 */  nop
/* 3DBDAC E00E094C 00021080 */  sll       $v0, $v0, 2
/* 3DBDB0 E00E0950 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3DBDB4 E00E0954 00561025 */  or        $v0, $v0, $s6
/* 3DBDB8 E00E0958 00621825 */  or        $v1, $v1, $v0
/* 3DBDBC E00E095C ACC30008 */  sw        $v1, 0x8($a2)
/* 3DBDC0 E00E0960 C600FFFC */  lwc1      $f0, -0x4($s0)
/* 3DBDC4 E00E0964 C6020000 */  lwc1      $f2, 0x0($s0)
/* 3DBDC8 E00E0968 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 3DBDCC E00E096C ACC20010 */  sw        $v0, 0x10($a2)
/* 3DBDD0 E00E0970 4600010D */  trunc.w.s $f4, $f0
/* 3DBDD4 E00E0974 44032000 */  mfc1      $v1, $f4
/* 3DBDD8 E00E0978 00000000 */  nop
/* 3DBDDC E00E097C 2463000F */  addiu     $v1, $v1, 0xF
/* 3DBDE0 E00E0980 00031880 */  sll       $v1, $v1, 2
/* 3DBDE4 E00E0984 30630FFF */  andi      $v1, $v1, 0xFFF
/* 3DBDE8 E00E0988 00031B00 */  sll       $v1, $v1, 12
/* 3DBDEC E00E098C 4600110D */  trunc.w.s $f4, $f2
/* 3DBDF0 E00E0990 44022000 */  mfc1      $v0, $f4
/* 3DBDF4 E00E0994 00000000 */  nop
/* 3DBDF8 E00E0998 2442000F */  addiu     $v0, $v0, 0xF
/* 3DBDFC E00E099C 00021080 */  sll       $v0, $v0, 2
/* 3DBE00 E00E09A0 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3DBE04 E00E09A4 00441025 */  or        $v0, $v0, $a0
/* 3DBE08 E00E09A8 00621825 */  or        $v1, $v1, $v0
/* 3DBE0C E00E09AC ACC3000C */  sw        $v1, 0xC($a2)
/* 3DBE10 E00E09B0 3C03E00E */  lui       $v1, (0xE00E0A40 >> 16)
/* 3DBE14 E00E09B4 8C630A40 */  lw        $v1, (0xE00E0A40 & 0xFFFF)($v1)
/* 3DBE18 E00E09B8 24C20020 */  addiu     $v0, $a2, 0x20
/* 3DBE1C E00E09BC AE220000 */  sw        $v0, 0x0($s1)
/* 3DBE20 E00E09C0 24020040 */  addiu     $v0, $zero, 0x40
/* 3DBE24 E00E09C4 ACC50018 */  sw        $a1, 0x18($a2)
/* 3DBE28 E00E09C8 ACC2001C */  sw        $v0, 0x1C($a2)
/* 3DBE2C E00E09CC ACC30014 */  sw        $v1, 0x14($a2)
/* 3DBE30 E00E09D0 26B50001 */  addiu     $s5, $s5, 0x1
.LE00E09D4:
/* 3DBE34 E00E09D4 8FC20008 */  lw        $v0, 0x8($fp)
/* 3DBE38 E00E09D8 02A2102A */  slt       $v0, $s5, $v0
/* 3DBE3C E00E09DC 1440FF98 */  bnez      $v0, .LE00E0840
/* 3DBE40 E00E09E0 26100070 */   addiu    $s0, $s0, 0x70
.LE00E09E4:
/* 3DBE44 E00E09E4 3C05D838 */  lui       $a1, (0xD8380002 >> 16)
/* 3DBE48 E00E09E8 3C03800A */  lui       $v1, %hi(gMainGfxPos)
/* 3DBE4C E00E09EC 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
/* 3DBE50 E00E09F0 8C620000 */  lw        $v0, 0x0($v1)
/* 3DBE54 E00E09F4 34A50002 */  ori       $a1, $a1, (0xD8380002 & 0xFFFF)
/* 3DBE58 E00E09F8 0040202D */  daddu     $a0, $v0, $zero
/* 3DBE5C E00E09FC 24420008 */  addiu     $v0, $v0, 0x8
/* 3DBE60 E00E0A00 AC620000 */  sw        $v0, 0x0($v1)
/* 3DBE64 E00E0A04 24020040 */  addiu     $v0, $zero, 0x40
/* 3DBE68 E00E0A08 AC850000 */  sw        $a1, 0x0($a0)
/* 3DBE6C E00E0A0C AC820004 */  sw        $v0, 0x4($a0)
/* 3DBE70 E00E0A10 8FBF00B4 */  lw        $ra, 0xB4($sp)
/* 3DBE74 E00E0A14 8FBE00B0 */  lw        $fp, 0xB0($sp)
/* 3DBE78 E00E0A18 8FB700AC */  lw        $s7, 0xAC($sp)
/* 3DBE7C E00E0A1C 8FB600A8 */  lw        $s6, 0xA8($sp)
/* 3DBE80 E00E0A20 8FB500A4 */  lw        $s5, 0xA4($sp)
/* 3DBE84 E00E0A24 8FB400A0 */  lw        $s4, 0xA0($sp)
/* 3DBE88 E00E0A28 8FB3009C */  lw        $s3, 0x9C($sp)
/* 3DBE8C E00E0A2C 8FB20098 */  lw        $s2, 0x98($sp)
/* 3DBE90 E00E0A30 8FB10094 */  lw        $s1, 0x94($sp)
/* 3DBE94 E00E0A34 8FB00090 */  lw        $s0, 0x90($sp)
/* 3DBE98 E00E0A38 03E00008 */  jr        $ra
/* 3DBE9C E00E0A3C 27BD00B8 */   addiu    $sp, $sp, 0xB8

### DECOMPILED C INSTRUCTIONS:

void embers_appendGfx(void* effect) {
    EmbersFXData* part = ((EffectInstance*)effect)->data.embers;
    Camera* camera = &gCameras[gCurrentCameraID];
    s32 unk_2C = part->unk_2C;
    Matrix4f sp10;
    Matrix4f sp50;
    s32 i;

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

    shim_guTranslateF(sp10, part->unk_04, part->unk_08, part->unk_0C);
    shim_guScaleF(sp50, part->unk_40, part->unk_40, part->unk_40);
    shim_guMtxCatF(sp50, sp10, sp10);
    shim_guMtxF2L(sp10, &gDisplayContext->matrixStack[gMatrixListPos]);

    gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
    gSPMatrix(gMainGfxPos++, camera->unkMatrix, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
    gDPSetPrimColor(gMainGfxPos++, 0, 0, part->unk_20, part->unk_24, part->unk_28, unk_2C);
    gDPSetEnvColor(gMainGfxPos++, part->unk_30, part->unk_34, part->unk_38, part->unk_3C);
    gSPDisplayList(gMainGfxPos++, D_E00E0A40[1]);

    part++;
    for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) {
        if (part->unk_64 >= 0) {
            shim_guTranslateF(sp10, part->unk_04, part->unk_08, part->unk_0C);
            shim_guMtxF2L(sp10, &gDisplayContext->matrixStack[gMatrixListPos]);

            gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
            gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE, 0, (i % 4) * 16 * 4, 15 * 4, ((i % 4) * 16 + 15) * 4);
            gDPSetTileSize(gMainGfxPos++, 1, (s32) part->unk_5C * 4, (s32) part->unk_60 * 4, ((s32) part->unk_5C + 15) * 4, ((s32) part->unk_60 + 15) * 4);
            gSPDisplayList(gMainGfxPos++, D_E00E0A40[0]);
            gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
        }
    }

    gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel render_curtains
/* 6E80 8002BA80 3C01800A */  lui       $at, %hi(gCurtainScaleGoal)
/* 6E84 8002BA84 C420BA94 */  lwc1      $f0, %lo(gCurtainScaleGoal)($at)
/* 6E88 8002BA88 27BDFF78 */  addiu     $sp, $sp, -0x88
/* 6E8C 8002BA8C AFB20068 */  sw        $s2, 0x68($sp)
/* 6E90 8002BA90 3C12800A */  lui       $s2, %hi(gCurtainScale)
/* 6E94 8002BA94 2652BA90 */  addiu     $s2, $s2, %lo(gCurtainScale)
/* 6E98 8002BA98 AFBF0078 */  sw        $ra, 0x78($sp)
/* 6E9C 8002BA9C AFB50074 */  sw        $s5, 0x74($sp)
/* 6EA0 8002BAA0 AFB40070 */  sw        $s4, 0x70($sp)
/* 6EA4 8002BAA4 AFB3006C */  sw        $s3, 0x6C($sp)
/* 6EA8 8002BAA8 AFB10064 */  sw        $s1, 0x64($sp)
/* 6EAC 8002BAAC AFB00060 */  sw        $s0, 0x60($sp)
/* 6EB0 8002BAB0 F7B40080 */  sdc1      $f20, 0x80($sp)
/* 6EB4 8002BAB4 C6440000 */  lwc1      $f4, 0x0($s2)
/* 6EB8 8002BAB8 46040032 */  c.eq.s    $f0, $f4
/* 6EBC 8002BABC 00000000 */  nop
/* 6EC0 8002BAC0 4501000B */  bc1t      .L8002BAF0
/* 6EC4 8002BAC4 00000000 */   nop
/* 6EC8 8002BAC8 46040001 */  sub.s     $f0, $f0, $f4
/* 6ECC 8002BACC 3C018009 */  lui       $at, %hi(D_80097E00)
/* 6ED0 8002BAD0 D4227E00 */  ldc1      $f2, %lo(D_80097E00)($at)
/* 6ED4 8002BAD4 46000021 */  cvt.d.s   $f0, $f0
/* 6ED8 8002BAD8 46220002 */  mul.d     $f0, $f0, $f2
/* 6EDC 8002BADC 00000000 */  nop
/* 6EE0 8002BAE0 460020A1 */  cvt.d.s   $f2, $f4
/* 6EE4 8002BAE4 46201080 */  add.d     $f2, $f2, $f0
/* 6EE8 8002BAE8 462010A0 */  cvt.s.d   $f2, $f2
/* 6EEC 8002BAEC E6420000 */  swc1      $f2, 0x0($s2)
.L8002BAF0:
/* 6EF0 8002BAF0 3C13800A */  lui       $s3, %hi(gCurtainFade)
/* 6EF4 8002BAF4 2673BA98 */  addiu     $s3, $s3, %lo(gCurtainFade)
/* 6EF8 8002BAF8 3C01800A */  lui       $at, %hi(gCurtainFadeGoal)
/* 6EFC 8002BAFC C420BA9C */  lwc1      $f0, %lo(gCurtainFadeGoal)($at)
/* 6F00 8002BB00 C6640000 */  lwc1      $f4, 0x0($s3)
/* 6F04 8002BB04 46040032 */  c.eq.s    $f0, $f4
/* 6F08 8002BB08 00000000 */  nop
/* 6F0C 8002BB0C 4501000B */  bc1t      .L8002BB3C
/* 6F10 8002BB10 00000000 */   nop
/* 6F14 8002BB14 46040001 */  sub.s     $f0, $f0, $f4
/* 6F18 8002BB18 3C018009 */  lui       $at, %hi(D_80097E08)
/* 6F1C 8002BB1C D4227E08 */  ldc1      $f2, %lo(D_80097E08)($at)
/* 6F20 8002BB20 46000021 */  cvt.d.s   $f0, $f0
/* 6F24 8002BB24 46220002 */  mul.d     $f0, $f0, $f2
/* 6F28 8002BB28 00000000 */  nop
/* 6F2C 8002BB2C 460020A1 */  cvt.d.s   $f2, $f4
/* 6F30 8002BB30 46201080 */  add.d     $f2, $f2, $f0
/* 6F34 8002BB34 462010A0 */  cvt.s.d   $f2, $f2
/* 6F38 8002BB38 E6620000 */  swc1      $f2, 0x0($s3)
.L8002BB3C:
/* 6F3C 8002BB3C C6400000 */  lwc1      $f0, 0x0($s2)
/* 6F40 8002BB40 3C018009 */  lui       $at, %hi(D_80097E10)
/* 6F44 8002BB44 D4227E10 */  ldc1      $f2, %lo(D_80097E10)($at)
/* 6F48 8002BB48 46000021 */  cvt.d.s   $f0, $f0
/* 6F4C 8002BB4C 4622003C */  c.lt.d    $f0, $f2
/* 6F50 8002BB50 00000000 */  nop
/* 6F54 8002BB54 45000087 */  bc1f      .L8002BD74
/* 6F58 8002BB58 3C03FF10 */   lui      $v1, (0xFF10013F >> 16)
/* 6F5C 8002BB5C 3463013F */  ori       $v1, $v1, (0xFF10013F & 0xFFFF)
/* 6F60 8002BB60 3C11800A */  lui       $s1, %hi(gMainGfxPos)
/* 6F64 8002BB64 2631A66C */  addiu     $s1, $s1, %lo(gMainGfxPos)
/* 6F68 8002BB68 3C15E700 */  lui       $s5, (0xE7000000 >> 16)
/* 6F6C 8002BB6C 8E300000 */  lw        $s0, 0x0($s1)
/* 6F70 8002BB70 3C04800A */  lui       $a0, %hi(nuGfxCfb_ptr)
/* 6F74 8002BB74 8C84A64C */  lw        $a0, %lo(nuGfxCfb_ptr)($a0)
/* 6F78 8002BB78 0200102D */  daddu     $v0, $s0, $zero
/* 6F7C 8002BB7C 26100008 */  addiu     $s0, $s0, 0x8
/* 6F80 8002BB80 AE300000 */  sw        $s0, 0x0($s1)
/* 6F84 8002BB84 AC550000 */  sw        $s5, 0x0($v0)
/* 6F88 8002BB88 AC400004 */  sw        $zero, 0x4($v0)
/* 6F8C 8002BB8C 26020008 */  addiu     $v0, $s0, 0x8
/* 6F90 8002BB90 AE220000 */  sw        $v0, 0x0($s1)
/* 6F94 8002BB94 0C0187A4 */  jal       osVirtualToPhysical
/* 6F98 8002BB98 AE030000 */   sw       $v1, 0x0($s0)
/* 6F9C 8002BB9C 27A40020 */  addiu     $a0, $sp, 0x20
/* 6FA0 8002BBA0 8E230000 */  lw        $v1, 0x0($s1)
/* 6FA4 8002BBA4 3C14DE00 */  lui       $s4, (0xDE000000 >> 16)
/* 6FA8 8002BBA8 AE020004 */  sw        $v0, 0x4($s0)
/* 6FAC 8002BBAC 3C028007 */  lui       $v0, %hi(TheaterInitGfx)
/* 6FB0 8002BBB0 244260C0 */  addiu     $v0, $v0, %lo(TheaterInitGfx)
/* 6FB4 8002BBB4 3C05C2A0 */  lui       $a1, (0xC2A00000 >> 16)
/* 6FB8 8002BBB8 3C0642A0 */  lui       $a2, (0x42A00000 >> 16)
/* 6FBC 8002BBBC 3C07C270 */  lui       $a3, (0xC2700000 >> 16)
/* 6FC0 8002BBC0 3C014270 */  lui       $at, (0x42700000 >> 16)
/* 6FC4 8002BBC4 44810000 */  mtc1      $at, $f0
/* 6FC8 8002BBC8 3C014320 */  lui       $at, (0x43200000 >> 16)
/* 6FCC 8002BBCC 44811000 */  mtc1      $at, $f2
/* 6FD0 8002BBD0 3C014420 */  lui       $at, (0x44200000 >> 16)
/* 6FD4 8002BBD4 44812000 */  mtc1      $at, $f4
/* 6FD8 8002BBD8 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 6FDC 8002BBDC 4481A000 */  mtc1      $at, $f20
/* 6FE0 8002BBE0 0060402D */  daddu     $t0, $v1, $zero
/* 6FE4 8002BBE4 24630008 */  addiu     $v1, $v1, 0x8
/* 6FE8 8002BBE8 AE230000 */  sw        $v1, 0x0($s1)
/* 6FEC 8002BBEC AD140000 */  sw        $s4, 0x0($t0)
/* 6FF0 8002BBF0 AD020004 */  sw        $v0, 0x4($t0)
/* 6FF4 8002BBF4 E7A00010 */  swc1      $f0, 0x10($sp)
/* 6FF8 8002BBF8 E7A20014 */  swc1      $f2, 0x14($sp)
/* 6FFC 8002BBFC E7A40018 */  swc1      $f4, 0x18($sp)
/* 7000 8002BC00 0C0187CC */  jal       guFrustumF
/* 7004 8002BC04 E7B4001C */   swc1     $f20, 0x1C($sp)
/* 7008 8002BC08 27A40020 */  addiu     $a0, $sp, 0x20
/* 700C 8002BC0C 3C10800A */  lui       $s0, %hi(D_8009BAA8)
/* 7010 8002BC10 2610BAA8 */  addiu     $s0, $s0, %lo(D_8009BAA8)
/* 7014 8002BC14 0C019D40 */  jal       guMtxF2L
/* 7018 8002BC18 0200282D */   daddu    $a1, $s0, $zero
/* 701C 8002BC1C 3C04DA38 */  lui       $a0, (0xDA380007 >> 16)
/* 7020 8002BC20 8E220000 */  lw        $v0, 0x0($s1)
/* 7024 8002BC24 34840007 */  ori       $a0, $a0, (0xDA380007 & 0xFFFF)
/* 7028 8002BC28 0040182D */  daddu     $v1, $v0, $zero
/* 702C 8002BC2C 24420008 */  addiu     $v0, $v0, 0x8
/* 7030 8002BC30 AE220000 */  sw        $v0, 0x0($s1)
/* 7034 8002BC34 C6400000 */  lwc1      $f0, 0x0($s2)
/* 7038 8002BC38 3C018009 */  lui       $at, %hi(D_80097E18)
/* 703C 8002BC3C D4227E18 */  ldc1      $f2, %lo(D_80097E18)($at)
/* 7040 8002BC40 46000021 */  cvt.d.s   $f0, $f0
/* 7044 8002BC44 46220001 */  sub.d     $f0, $f0, $f2
/* 7048 8002BC48 AC640000 */  sw        $a0, 0x0($v1)
/* 704C 8002BC4C 46200120 */  cvt.s.d   $f4, $f0
/* 7050 8002BC50 4614203C */  c.lt.s    $f4, $f20
/* 7054 8002BC54 00000000 */  nop
/* 7058 8002BC58 45000002 */  bc1f      .L8002BC64
/* 705C 8002BC5C AC700004 */   sw       $s0, 0x4($v1)
/* 7060 8002BC60 4600A106 */  mov.s     $f4, $f20
.L8002BC64:
/* 7064 8002BC64 44800000 */  mtc1      $zero, $f0
/* 7068 8002BC68 3C018009 */  lui       $at, %hi(D_80097E20)
/* 706C 8002BC6C D4227E20 */  ldc1      $f2, %lo(D_80097E20)($at)
/* 7070 8002BC70 44050000 */  mfc1      $a1, $f0
/* 7074 8002BC74 46002021 */  cvt.d.s   $f0, $f4
/* 7078 8002BC78 46220002 */  mul.d     $f0, $f0, $f2
/* 707C 8002BC7C 00000000 */  nop
/* 7080 8002BC80 27A40020 */  addiu     $a0, $sp, 0x20
/* 7084 8002BC84 3C01C3A0 */  lui       $at, (0xC3A00000 >> 16)
/* 7088 8002BC88 44811000 */  mtc1      $at, $f2
/* 708C 8002BC8C 00A0302D */  daddu     $a2, $a1, $zero
/* 7090 8002BC90 00A0382D */  daddu     $a3, $a1, $zero
/* 7094 8002BC94 AFA50014 */  sw        $a1, 0x14($sp)
/* 7098 8002BC98 AFA50018 */  sw        $a1, 0x18($sp)
/* 709C 8002BC9C E7A2001C */  swc1      $f2, 0x1C($sp)
/* 70A0 8002BCA0 46200020 */  cvt.s.d   $f0, $f0
/* 70A4 8002BCA4 0C018FC4 */  jal       guPositionF
/* 70A8 8002BCA8 E7A00010 */   swc1     $f0, 0x10($sp)
/* 70AC 8002BCAC 27A40020 */  addiu     $a0, $sp, 0x20
/* 70B0 8002BCB0 26100040 */  addiu     $s0, $s0, 0x40
/* 70B4 8002BCB4 0C019D40 */  jal       guMtxF2L
/* 70B8 8002BCB8 0200282D */   daddu    $a1, $s0, $zero
/* 70BC 8002BCBC 3C03DA38 */  lui       $v1, (0xDA380002 >> 16)
/* 70C0 8002BCC0 34630002 */  ori       $v1, $v1, (0xDA380002 & 0xFFFF)
/* 70C4 8002BCC4 3C04D838 */  lui       $a0, (0xD8380002 >> 16)
/* 70C8 8002BCC8 34840002 */  ori       $a0, $a0, (0xD8380002 & 0xFFFF)
/* 70CC 8002BCCC 8E250000 */  lw        $a1, 0x0($s1)
/* 70D0 8002BCD0 3C01437F */  lui       $at, (0x437F0000 >> 16)
/* 70D4 8002BCD4 44810000 */  mtc1      $at, $f0
/* 70D8 8002BCD8 00A0102D */  daddu     $v0, $a1, $zero
/* 70DC 8002BCDC 24A50008 */  addiu     $a1, $a1, 0x8
/* 70E0 8002BCE0 AE250000 */  sw        $a1, 0x0($s1)
/* 70E4 8002BCE4 AC430000 */  sw        $v1, 0x0($v0)
/* 70E8 8002BCE8 AC500004 */  sw        $s0, 0x4($v0)
/* 70EC 8002BCEC 24A20008 */  addiu     $v0, $a1, 0x8
/* 70F0 8002BCF0 AE220000 */  sw        $v0, 0x0($s1)
/* 70F4 8002BCF4 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 70F8 8002BCF8 ACA20000 */  sw        $v0, 0x0($a1)
/* 70FC 8002BCFC 24A20010 */  addiu     $v0, $a1, 0x10
/* 7100 8002BD00 AE220000 */  sw        $v0, 0x0($s1)
/* 7104 8002BD04 3C028007 */  lui       $v0, %hi(TheaterGfx)
/* 7108 8002BD08 24426078 */  addiu     $v0, $v0, %lo(TheaterGfx)
/* 710C 8002BD0C ACB40008 */  sw        $s4, 0x8($a1)
/* 7110 8002BD10 ACA2000C */  sw        $v0, 0xC($a1)
/* 7114 8002BD14 C6620000 */  lwc1      $f2, 0x0($s3)
/* 7118 8002BD18 24A20018 */  addiu     $v0, $a1, 0x18
/* 711C 8002BD1C AE220000 */  sw        $v0, 0x0($s1)
/* 7120 8002BD20 24020040 */  addiu     $v0, $zero, 0x40
/* 7124 8002BD24 46001082 */  mul.s     $f2, $f2, $f0
/* 7128 8002BD28 00000000 */  nop
/* 712C 8002BD2C ACA20014 */  sw        $v0, 0x14($a1)
/* 7130 8002BD30 24A20020 */  addiu     $v0, $a1, 0x20
/* 7134 8002BD34 ACA40010 */  sw        $a0, 0x10($a1)
/* 7138 8002BD38 AE220000 */  sw        $v0, 0x0($s1)
/* 713C 8002BD3C 46020001 */  sub.s     $f0, $f0, $f2
/* 7140 8002BD40 ACB50018 */  sw        $s5, 0x18($a1)
/* 7144 8002BD44 ACA0001C */  sw        $zero, 0x1C($a1)
/* 7148 8002BD48 4600018D */  trunc.w.s $f6, $f0
/* 714C 8002BD4C 44023000 */  mfc1      $v0, $f6
/* 7150 8002BD50 00000000 */  nop
/* 7154 8002BD54 304200FF */  andi      $v0, $v0, 0xFF
/* 7158 8002BD58 00021E00 */  sll       $v1, $v0, 24
/* 715C 8002BD5C 00022400 */  sll       $a0, $v0, 16
/* 7160 8002BD60 00641825 */  or        $v1, $v1, $a0
/* 7164 8002BD64 00021200 */  sll       $v0, $v0, 8
/* 7168 8002BD68 00621825 */  or        $v1, $v1, $v0
/* 716C 8002BD6C 346300FF */  ori       $v1, $v1, 0xFF
/* 7170 8002BD70 ACA30004 */  sw        $v1, 0x4($a1)
.L8002BD74:
/* 7174 8002BD74 3C02800A */  lui       $v0, %hi(gCurtainDrawCallback)
/* 7178 8002BD78 8C42BAA0 */  lw        $v0, %lo(gCurtainDrawCallback)($v0)
/* 717C 8002BD7C 10400003 */  beqz      $v0, .L8002BD8C
/* 7180 8002BD80 00000000 */   nop
/* 7184 8002BD84 0040F809 */  jalr      $v0
/* 7188 8002BD88 00000000 */   nop
.L8002BD8C:
/* 718C 8002BD8C 3C108007 */  lui       $s0, %hi(gGameStatusPtr)
/* 7190 8002BD90 2610419C */  addiu     $s0, $s0, %lo(gGameStatusPtr)
/* 7194 8002BD94 8E020000 */  lw        $v0, 0x0($s0)
/* 7198 8002BD98 90420073 */  lbu       $v0, 0x73($v0)
/* 719C 8002BD9C 30420001 */  andi      $v0, $v0, 0x1
/* 71A0 8002BDA0 14400044 */  bnez      $v0, .L8002BEB4
/* 71A4 8002BDA4 00000000 */   nop
/* 71A8 8002BDA8 0C00CD4A */  jal       get_game_mode
/* 71AC 8002BDAC 00000000 */   nop
/* 71B0 8002BDB0 00021400 */  sll       $v0, $v0, 16
/* 71B4 8002BDB4 00021403 */  sra       $v0, $v0, 16
/* 71B8 8002BDB8 24030010 */  addiu     $v1, $zero, 0x10
/* 71BC 8002BDBC 1043000C */  beq       $v0, $v1, .L8002BDF0
/* 71C0 8002BDC0 00000000 */   nop
/* 71C4 8002BDC4 0C00CD4A */  jal       get_game_mode
/* 71C8 8002BDC8 00000000 */   nop
/* 71CC 8002BDCC 00021400 */  sll       $v0, $v0, 16
/* 71D0 8002BDD0 00021403 */  sra       $v0, $v0, 16
/* 71D4 8002BDD4 24030002 */  addiu     $v1, $zero, 0x2
/* 71D8 8002BDD8 10430005 */  beq       $v0, $v1, .L8002BDF0
/* 71DC 8002BDDC 00000000 */   nop
/* 71E0 8002BDE0 8E020000 */  lw        $v0, 0x0($s0)
/* 71E4 8002BDE4 80420071 */  lb        $v0, 0x71($v0)
/* 71E8 8002BDE8 10400032 */  beqz      $v0, .L8002BEB4
/* 71EC 8002BDEC 00000000 */   nop
.L8002BDF0:
/* 71F0 8002BDF0 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 71F4 8002BDF4 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 71F8 8002BDF8 94430134 */  lhu       $v1, 0x134($v0)
/* 71FC 8002BDFC 3C02AAAA */  lui       $v0, (0xAAAAAAAB >> 16)
/* 7200 8002BE00 3442AAAB */  ori       $v0, $v0, (0xAAAAAAAB & 0xFFFF)
/* 7204 8002BE04 00620019 */  multu     $v1, $v0
/* 7208 8002BE08 00004810 */  mfhi      $t1
/* 720C 8002BE0C 00092102 */  srl       $a0, $t1, 4
/* 7210 8002BE10 00041040 */  sll       $v0, $a0, 1
/* 7214 8002BE14 00441021 */  addu      $v0, $v0, $a0
/* 7218 8002BE18 000210C0 */  sll       $v0, $v0, 3
/* 721C 8002BE1C 00621823 */  subu      $v1, $v1, $v0
/* 7220 8002BE20 3063FFFF */  andi      $v1, $v1, 0xFFFF
/* 7224 8002BE24 00034140 */  sll       $t0, $v1, 5
/* 7228 8002BE28 29020100 */  slti      $v0, $t0, 0x100
/* 722C 8002BE2C 50400001 */  beql      $v0, $zero, .L8002BE34
/* 7230 8002BE30 240800FF */   addiu    $t0, $zero, 0xFF
.L8002BE34:
/* 7234 8002BE34 3C07FF20 */  lui       $a3, (0xFF201000 >> 16)
/* 7238 8002BE38 3C04800A */  lui       $a0, %hi(gMainGfxPos)
/* 723C 8002BE3C 2484A66C */  addiu     $a0, $a0, %lo(gMainGfxPos)
/* 7240 8002BE40 34E71000 */  ori       $a3, $a3, (0xFF201000 & 0xFFFF)
/* 7244 8002BE44 3C06DE00 */  lui       $a2, (0xDE000000 >> 16)
/* 7248 8002BE48 8C830000 */  lw        $v1, 0x0($a0)
/* 724C 8002BE4C 3C028007 */  lui       $v0, %hi(TheaterInitGfx)
/* 7250 8002BE50 244260C0 */  addiu     $v0, $v0, %lo(TheaterInitGfx)
/* 7254 8002BE54 0060282D */  daddu     $a1, $v1, $zero
/* 7258 8002BE58 24630008 */  addiu     $v1, $v1, 0x8
/* 725C 8002BE5C AC830000 */  sw        $v1, 0x0($a0)
/* 7260 8002BE60 ACA20004 */  sw        $v0, 0x4($a1)
/* 7264 8002BE64 24620008 */  addiu     $v0, $v1, 0x8
/* 7268 8002BE68 ACA60000 */  sw        $a2, 0x0($a1)
/* 726C 8002BE6C AC820000 */  sw        $v0, 0x0($a0)
/* 7270 8002BE70 3C028007 */  lui       $v0, %hi(NoControllerSetupTexGfx)
/* 7274 8002BE74 24427140 */  addiu     $v0, $v0, %lo(NoControllerSetupTexGfx)
/* 7278 8002BE78 AC620004 */  sw        $v0, 0x4($v1)
/* 727C 8002BE7C 24620010 */  addiu     $v0, $v1, 0x10
/* 7280 8002BE80 AC660000 */  sw        $a2, 0x0($v1)
/* 7284 8002BE84 AC820000 */  sw        $v0, 0x0($a0)
/* 7288 8002BE88 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 728C 8002BE8C AC620008 */  sw        $v0, 0x8($v1)
/* 7290 8002BE90 310200FF */  andi      $v0, $t0, 0xFF
/* 7294 8002BE94 00471025 */  or        $v0, $v0, $a3
/* 7298 8002BE98 AC62000C */  sw        $v0, 0xC($v1)
/* 729C 8002BE9C 24620018 */  addiu     $v0, $v1, 0x18
/* 72A0 8002BEA0 AC820000 */  sw        $v0, 0x0($a0)
/* 72A4 8002BEA4 3C028007 */  lui       $v0, %hi(NoControllerGfx)
/* 72A8 8002BEA8 244271E8 */  addiu     $v0, $v0, %lo(NoControllerGfx)
/* 72AC 8002BEAC AC660010 */  sw        $a2, 0x10($v1)
/* 72B0 8002BEB0 AC620014 */  sw        $v0, 0x14($v1)
.L8002BEB4:
/* 72B4 8002BEB4 8FBF0078 */  lw        $ra, 0x78($sp)
/* 72B8 8002BEB8 8FB50074 */  lw        $s5, 0x74($sp)
/* 72BC 8002BEBC 8FB40070 */  lw        $s4, 0x70($sp)
/* 72C0 8002BEC0 8FB3006C */  lw        $s3, 0x6C($sp)
/* 72C4 8002BEC4 8FB20068 */  lw        $s2, 0x68($sp)
/* 72C8 8002BEC8 8FB10064 */  lw        $s1, 0x64($sp)
/* 72CC 8002BECC 8FB00060 */  lw        $s0, 0x60($sp)
/* 72D0 8002BED0 D7B40080 */  ldc1      $f20, 0x80($sp)
/* 72D4 8002BED4 03E00008 */  jr        $ra
/* 72D8 8002BED8 27BD0088 */   addiu    $sp, $sp, 0x88

### DECOMPILED C INSTRUCTIONS:

void render_curtains(void) {
    if (gCurtainScaleGoal != gCurtainScale) {
        gCurtainScale += (gCurtainScaleGoal - gCurtainScale) * 0.1;
    }

    if (gCurtainFadeGoal != gCurtainFade) {
        gCurtainFade += (gCurtainFadeGoal - gCurtainFade) * 0.03;
    }

    if (gCurtainScale < 1.9) {
        Matrix4f m;
        f32 scale;
        s8 rgb;

        gDPPipeSync(gMainGfxPos++);
        gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, osVirtualToPhysical(nuGfxCfb_ptr));
        gSPDisplayList(gMainGfxPos++, &TheaterInitGfx);

        guFrustumF(m, -80.0f, 80.0f, -60.0f, 60.0f, 160.0f, 640.0f, 1.0f);
        guMtxF2L(m, &D_8009BAA8[0]);

        gSPMatrix(gMainGfxPos++, &D_8009BAA8[0], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);

        scale = gCurtainScale - 0.01;
        if (scale < 1.0f) {
            scale = 1.0f;
        }

        guPositionF(m, 0.0f, 0.0f, 0.0f, scale * 0.1, 0.0f, 0.0f, -320.0f);

        guMtxF2L(m, &D_8009BAA8[1]);

        gSPMatrix(gMainGfxPos++, &D_8009BAA8[1], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
        rgb = 255.0f - (gCurtainFade * 255.0f);
        gDPSetPrimColor(gMainGfxPos++, 0, 0, rgb, rgb, rgb, 255);
        gSPDisplayList(gMainGfxPos++, &TheaterGfx);
        gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
        gDPPipeSync(gMainGfxPos++);
    }

    if (gCurtainDrawCallback != NULL) {
        gCurtainDrawCallback();
    }

    if (!(gGameStatusPtr->contBitPattern & 1)) {
        if ((get_game_mode() == GAME_MODE_INTRO)
                || (get_game_mode() == GAME_MODE_TITLE_SCREEN)
                || (gGameStatusPtr->demoState != DEMO_STATE_NONE)) {
            s32 alpha = ((gGameStatusPtr->frameCounter) % 0x18) << 5;

            if (alpha > 255) {
                alpha = 255;
            }

            gSPDisplayList(gMainGfxPos++, &TheaterInitGfx);
            gSPDisplayList(gMainGfxPos++, &NoControllerSetupTexGfx);
            gDPSetPrimColor(gMainGfxPos++, 0, 0, 0xFF, 0x20, 0x10, alpha);
            gSPDisplayList(gMainGfxPos++, &NoControllerGfx);
        }
    }
}