### RAW ASSEMBLY INSTRUCTIONS:

glabel get_path_position
/* F9C20 802D5270 24C6FFFF */  addiu     $a2, $a2, -0x1
/* F9C24 802D5274 18C00010 */  blez      $a2, .L802D52B8
/* F9C28 802D5278 0000202D */   daddu    $a0, $zero, $zero
/* F9C2C 802D527C 00861021 */  addu      $v0, $a0, $a2
.L802D5280:
/* F9C30 802D5280 00021FC2 */  srl       $v1, $v0, 31
/* F9C34 802D5284 00431021 */  addu      $v0, $v0, $v1
/* F9C38 802D5288 00021843 */  sra       $v1, $v0, 1
/* F9C3C 802D528C 00031080 */  sll       $v0, $v1, 2
/* F9C40 802D5290 00471021 */  addu      $v0, $v0, $a3
/* F9C44 802D5294 C4400000 */  lwc1      $f0, 0x0($v0)
/* F9C48 802D5298 460C003C */  c.lt.s    $f0, $f12
/* F9C4C 802D529C 00000000 */  nop
/* F9C50 802D52A0 45020002 */  bc1fl     .L802D52AC
/* F9C54 802D52A4 0060302D */   daddu    $a2, $v1, $zero
/* F9C58 802D52A8 24640001 */  addiu     $a0, $v1, 0x1
.L802D52AC:
/* F9C5C 802D52AC 0086102A */  slt       $v0, $a0, $a2
/* F9C60 802D52B0 1440FFF3 */  bnez      $v0, .L802D5280
/* F9C64 802D52B4 00861021 */   addu     $v0, $a0, $a2
.L802D52B8:
/* F9C68 802D52B8 5C800001 */  bgtzl     $a0, .L802D52C0
/* F9C6C 802D52BC 2484FFFF */   addiu    $a0, $a0, -0x1
.L802D52C0:
/* F9C70 802D52C0 00041080 */  sll       $v0, $a0, 2
/* F9C74 802D52C4 00471021 */  addu      $v0, $v0, $a3
/* F9C78 802D52C8 00041840 */  sll       $v1, $a0, 1
/* F9C7C 802D52CC 00641821 */  addu      $v1, $v1, $a0
/* F9C80 802D52D0 00031880 */  sll       $v1, $v1, 2
/* F9C84 802D52D4 8FA40014 */  lw        $a0, 0x14($sp)
/* F9C88 802D52D8 C4480000 */  lwc1      $f8, 0x0($v0)
/* F9C8C 802D52DC 00642021 */  addu      $a0, $v1, $a0
/* F9C90 802D52E0 C4840000 */  lwc1      $f4, 0x0($a0)
/* F9C94 802D52E4 46086281 */  sub.s     $f10, $f12, $f8
/* F9C98 802D52E8 3C014040 */  lui       $at, (0x40400000 >> 16)
/* F9C9C 802D52EC 44816000 */  mtc1      $at, $f12
/* F9CA0 802D52F0 00000000 */  nop
/* F9CA4 802D52F4 460C2002 */  mul.s     $f0, $f4, $f12
/* F9CA8 802D52F8 00000000 */  nop
/* F9CAC 802D52FC C48E000C */  lwc1      $f14, 0xC($a0)
/* F9CB0 802D5300 46047081 */  sub.s     $f2, $f14, $f4
/* F9CB4 802D5304 460A1082 */  mul.s     $f2, $f2, $f10
/* F9CB8 802D5308 00000000 */  nop
/* F9CBC 802D530C C4460004 */  lwc1      $f6, 0x4($v0)
/* F9CC0 802D5310 46083181 */  sub.s     $f6, $f6, $f8
/* F9CC4 802D5314 46042100 */  add.s     $f4, $f4, $f4
/* F9CC8 802D5318 460E2100 */  add.s     $f4, $f4, $f14
/* F9CCC 802D531C 46062102 */  mul.s     $f4, $f4, $f6
/* F9CD0 802D5320 00000000 */  nop
/* F9CD4 802D5324 46061083 */  div.s     $f2, $f2, $f6
/* F9CD8 802D5328 46001080 */  add.s     $f2, $f2, $f0
/* F9CDC 802D532C 8FA20010 */  lw        $v0, 0x10($sp)
/* F9CE0 802D5330 460A1082 */  mul.s     $f2, $f2, $f10
/* F9CE4 802D5334 00000000 */  nop
/* F9CE8 802D5338 00621821 */  addu      $v1, $v1, $v0
/* F9CEC 802D533C C4680000 */  lwc1      $f8, 0x0($v1)
/* F9CF0 802D5340 C460000C */  lwc1      $f0, 0xC($v1)
/* F9CF4 802D5344 46080001 */  sub.s     $f0, $f0, $f8
/* F9CF8 802D5348 46060003 */  div.s     $f0, $f0, $f6
/* F9CFC 802D534C 46040001 */  sub.s     $f0, $f0, $f4
/* F9D00 802D5350 46001080 */  add.s     $f2, $f2, $f0
/* F9D04 802D5354 460A1082 */  mul.s     $f2, $f2, $f10
/* F9D08 802D5358 00000000 */  nop
/* F9D0C 802D535C 46081080 */  add.s     $f2, $f2, $f8
/* F9D10 802D5360 E4A20000 */  swc1      $f2, 0x0($a1)
/* F9D14 802D5364 C4840004 */  lwc1      $f4, 0x4($a0)
/* F9D18 802D5368 460C2002 */  mul.s     $f0, $f4, $f12
/* F9D1C 802D536C 00000000 */  nop
/* F9D20 802D5370 C4880010 */  lwc1      $f8, 0x10($a0)
/* F9D24 802D5374 46044081 */  sub.s     $f2, $f8, $f4
/* F9D28 802D5378 460A1082 */  mul.s     $f2, $f2, $f10
/* F9D2C 802D537C 00000000 */  nop
/* F9D30 802D5380 46042100 */  add.s     $f4, $f4, $f4
/* F9D34 802D5384 46082100 */  add.s     $f4, $f4, $f8
/* F9D38 802D5388 46062102 */  mul.s     $f4, $f4, $f6
/* F9D3C 802D538C 00000000 */  nop
/* F9D40 802D5390 46061083 */  div.s     $f2, $f2, $f6
/* F9D44 802D5394 46001080 */  add.s     $f2, $f2, $f0
/* F9D48 802D5398 460A1082 */  mul.s     $f2, $f2, $f10
/* F9D4C 802D539C 00000000 */  nop
/* F9D50 802D53A0 C4680004 */  lwc1      $f8, 0x4($v1)
/* F9D54 802D53A4 C4600010 */  lwc1      $f0, 0x10($v1)
/* F9D58 802D53A8 46080001 */  sub.s     $f0, $f0, $f8
/* F9D5C 802D53AC 46060003 */  div.s     $f0, $f0, $f6
/* F9D60 802D53B0 46040001 */  sub.s     $f0, $f0, $f4
/* F9D64 802D53B4 46001080 */  add.s     $f2, $f2, $f0
/* F9D68 802D53B8 460A1082 */  mul.s     $f2, $f2, $f10
/* F9D6C 802D53BC 00000000 */  nop
/* F9D70 802D53C0 46081080 */  add.s     $f2, $f2, $f8
/* F9D74 802D53C4 E4A20004 */  swc1      $f2, 0x4($a1)
/* F9D78 802D53C8 C4840008 */  lwc1      $f4, 0x8($a0)
/* F9D7C 802D53CC 460C2302 */  mul.s     $f12, $f4, $f12
/* F9D80 802D53D0 00000000 */  nop
/* F9D84 802D53D4 C4800014 */  lwc1      $f0, 0x14($a0)
/* F9D88 802D53D8 46040081 */  sub.s     $f2, $f0, $f4
/* F9D8C 802D53DC 460A1082 */  mul.s     $f2, $f2, $f10
/* F9D90 802D53E0 00000000 */  nop
/* F9D94 802D53E4 46042100 */  add.s     $f4, $f4, $f4
/* F9D98 802D53E8 46002100 */  add.s     $f4, $f4, $f0
/* F9D9C 802D53EC 46062102 */  mul.s     $f4, $f4, $f6
/* F9DA0 802D53F0 00000000 */  nop
/* F9DA4 802D53F4 46061083 */  div.s     $f2, $f2, $f6
/* F9DA8 802D53F8 460C1080 */  add.s     $f2, $f2, $f12
/* F9DAC 802D53FC 460A1082 */  mul.s     $f2, $f2, $f10
/* F9DB0 802D5400 00000000 */  nop
/* F9DB4 802D5404 C4680008 */  lwc1      $f8, 0x8($v1)
/* F9DB8 802D5408 C4600014 */  lwc1      $f0, 0x14($v1)
/* F9DBC 802D540C 46080001 */  sub.s     $f0, $f0, $f8
/* F9DC0 802D5410 46060003 */  div.s     $f0, $f0, $f6
/* F9DC4 802D5414 46040001 */  sub.s     $f0, $f0, $f4
/* F9DC8 802D5418 46001080 */  add.s     $f2, $f2, $f0
/* F9DCC 802D541C 460A1082 */  mul.s     $f2, $f2, $f10
/* F9DD0 802D5420 00000000 */  nop
/* F9DD4 802D5424 46081080 */  add.s     $f2, $f2, $f8
/* F9DD8 802D5428 03E00008 */  jr        $ra
/* F9DDC 802D542C E4A20008 */   swc1     $f2, 0x8($a1)

### DECOMPILED C INSTRUCTIONS:

void get_path_position(f32 alpha, Vec3f* outPos, s32 numVectors, f32* normalizedLengths, Vec3f* pathPoints, Vec3f* vectors) {
    s32 limit = numVectors - 1;
    f32 curLength;
    f32 curProgress;
    f32 ax, ay, az, bx, by, bz, dx, dy, dz;
    s32 i;

    for (i = 0; i < limit;) {
        s32 temp_v1 = (i + limit) / 2;

        if (normalizedLengths[temp_v1] < alpha) {
            i = temp_v1 + 1;
        } else {
            limit = temp_v1;
        }
    }

    if (i > 0) {
        i--;
    }

    curLength = normalizedLengths[i+1] - normalizedLengths[i];
    curProgress = alpha - normalizedLengths[i];

    dx = (pathPoints[i+1].x - pathPoints[i].x) / curLength;
    ax = (((vectors[i+1].x - vectors[i].x) * curProgress / curLength) + (3.0f * vectors[i].x)) * curProgress;
    bx = dx - (((2.0f * vectors[i].x) + vectors[i+1].x) * curLength);
    outPos->x = ((ax + bx) * curProgress) + pathPoints[i].x;

    dy = (pathPoints[i+1].y - pathPoints[i].y) / curLength;
    ay = (((vectors[i+1].y - vectors[i].y) * curProgress / curLength) + (3.0f * vectors[i].y)) * curProgress;
    by = dy - (((2.0f * vectors[i].y) + vectors[i+1].y) * curLength);
    outPos->y = ((ay + by) * curProgress) + pathPoints[i].y;

    dz = (pathPoints[i+1].z - pathPoints[i].z) / curLength;
    az = (((vectors[i+1].z - vectors[i].z) * curProgress / curLength) + (3.0f * vectors[i].z)) * curProgress;
    bz = dz - (((2.0f * vectors[i].z) + vectors[i+1].z) * curLength);
    outPos->z = ((az + bz) * curProgress) + pathPoints[i].z;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel set_cam_viewport
/* 9714 8002E314 3C08800B */  lui       $t0, %hi(gCameras)
/* 9718 8002E318 25081D80 */  addiu     $t0, $t0, %lo(gCameras)
/* 971C 8002E31C 00042400 */  sll       $a0, $a0, 16
/* 9720 8002E320 00042403 */  sra       $a0, $a0, 16
/* 9724 8002E324 00041880 */  sll       $v1, $a0, 2
/* 9728 8002E328 00641821 */  addu      $v1, $v1, $a0
/* 972C 8002E32C 00031880 */  sll       $v1, $v1, 2
/* 9730 8002E330 00641823 */  subu      $v1, $v1, $a0
/* 9734 8002E334 000310C0 */  sll       $v0, $v1, 3
/* 9738 8002E338 00621821 */  addu      $v1, $v1, $v0
/* 973C 8002E33C 000318C0 */  sll       $v1, $v1, 3
/* 9740 8002E340 00681821 */  addu      $v1, $v1, $t0
/* 9744 8002E344 A467000A */  sh        $a3, 0xA($v1)
/* 9748 8002E348 A465000E */  sh        $a1, 0xE($v1)
/* 974C 8002E34C 00E0282D */  daddu     $a1, $a3, $zero
/* 9750 8002E350 A4660010 */  sh        $a2, 0x10($v1)
/* 9754 8002E354 8FA40010 */  lw        $a0, 0x10($sp)
/* 9758 8002E358 240201FF */  addiu     $v0, $zero, 0x1FF
/* 975C 8002E35C A46200A4 */  sh        $v0, 0xA4($v1)
/* 9760 8002E360 A46200AC */  sh        $v0, 0xAC($v1)
/* 9764 8002E364 A46200B4 */  sh        $v0, 0xB4($v1)
/* 9768 8002E368 9462000E */  lhu       $v0, 0xE($v1)
/* 976C 8002E36C 00052C00 */  sll       $a1, $a1, 16
/* 9770 8002E370 A46000A6 */  sh        $zero, 0xA6($v1)
/* 9774 8002E374 A46000AE */  sh        $zero, 0xAE($v1)
/* 9778 8002E378 A46000B6 */  sh        $zero, 0xB6($v1)
/* 977C 8002E37C A464000C */  sh        $a0, 0xC($v1)
/* 9780 8002E380 00052403 */  sra       $a0, $a1, 16
/* 9784 8002E384 00052FC2 */  srl       $a1, $a1, 31
/* 9788 8002E388 00852021 */  addu      $a0, $a0, $a1
/* 978C 8002E38C 00042043 */  sra       $a0, $a0, 1
/* 9790 8002E390 00441021 */  addu      $v0, $v0, $a0
/* 9794 8002E394 00021400 */  sll       $v0, $v0, 16
/* 9798 8002E398 8464000A */  lh        $a0, 0xA($v1)
/* 979C 8002E39C 00021383 */  sra       $v0, $v0, 14
/* 97A0 8002E3A0 A46200A8 */  sh        $v0, 0xA8($v1)
/* 97A4 8002E3A4 9462000C */  lhu       $v0, 0xC($v1)
/* 97A8 8002E3A8 44840000 */  mtc1      $a0, $f0
/* 97AC 8002E3AC 00000000 */  nop
/* 97B0 8002E3B0 46800020 */  cvt.s.w   $f0, $f0
/* 97B4 8002E3B4 00021400 */  sll       $v0, $v0, 16
/* 97B8 8002E3B8 00022403 */  sra       $a0, $v0, 16
/* 97BC 8002E3BC 000217C2 */  srl       $v0, $v0, 31
/* 97C0 8002E3C0 00822021 */  addu      $a0, $a0, $v0
/* 97C4 8002E3C4 00C0102D */  daddu     $v0, $a2, $zero
/* 97C8 8002E3C8 00042043 */  sra       $a0, $a0, 1
/* 97CC 8002E3CC 00441021 */  addu      $v0, $v0, $a0
/* 97D0 8002E3D0 00021400 */  sll       $v0, $v0, 16
/* 97D4 8002E3D4 00021383 */  sra       $v0, $v0, 14
/* 97D8 8002E3D8 46000000 */  add.s     $f0, $f0, $f0
/* 97DC 8002E3DC A46200AA */  sh        $v0, 0xAA($v1)
/* 97E0 8002E3E0 8462000A */  lh        $v0, 0xA($v1)
/* 97E4 8002E3E4 4600010D */  trunc.w.s $f4, $f0
/* 97E8 8002E3E8 44042000 */  mfc1      $a0, $f4
/* 97EC 8002E3EC 44820000 */  mtc1      $v0, $f0
/* 97F0 8002E3F0 00000000 */  nop
/* 97F4 8002E3F4 46800020 */  cvt.s.w   $f0, $f0
/* 97F8 8002E3F8 46000000 */  add.s     $f0, $f0, $f0
/* 97FC 8002E3FC 8462000C */  lh        $v0, 0xC($v1)
/* 9800 8002E400 3C068007 */  lui       $a2, %hi(gGameStatusPtr)
/* 9804 8002E404 8CC6419C */  lw        $a2, %lo(gGameStatusPtr)($a2)
/* 9808 8002E408 44821000 */  mtc1      $v0, $f2
/* 980C 8002E40C 00000000 */  nop
/* 9810 8002E410 468010A0 */  cvt.s.w   $f2, $f2
/* 9814 8002E414 4600010D */  trunc.w.s $f4, $f0
/* 9818 8002E418 44022000 */  mfc1      $v0, $f4
/* 981C 8002E41C 00000000 */  nop
/* 9820 8002E420 A46200B0 */  sh        $v0, 0xB0($v1)
/* 9824 8002E424 8462000C */  lh        $v0, 0xC($v1)
/* 9828 8002E428 46021080 */  add.s     $f2, $f2, $f2
/* 982C 8002E42C A46400A0 */  sh        $a0, 0xA0($v1)
/* 9830 8002E430 44820000 */  mtc1      $v0, $f0
/* 9834 8002E434 00000000 */  nop
/* 9838 8002E438 46800020 */  cvt.s.w   $f0, $f0
/* 983C 8002E43C 46000000 */  add.s     $f0, $f0, $f0
/* 9840 8002E440 4600110D */  trunc.w.s $f4, $f2
/* 9844 8002E444 44042000 */  mfc1      $a0, $f4
/* 9848 8002E448 00000000 */  nop
/* 984C 8002E44C A46400A2 */  sh        $a0, 0xA2($v1)
/* 9850 8002E450 4600010D */  trunc.w.s $f4, $f0
/* 9854 8002E454 44022000 */  mfc1      $v0, $f4
/* 9858 8002E458 00000000 */  nop
/* 985C 8002E45C A46200B2 */  sh        $v0, 0xB2($v1)
/* 9860 8002E460 00E0102D */  daddu     $v0, $a3, $zero
/* 9864 8002E464 00021400 */  sll       $v0, $v0, 16
/* 9868 8002E468 00022403 */  sra       $a0, $v0, 16
/* 986C 8002E46C 000217C2 */  srl       $v0, $v0, 31
/* 9870 8002E470 00822021 */  addu      $a0, $a0, $v0
/* 9874 8002E474 00042043 */  sra       $a0, $a0, 1
/* 9878 8002E478 90C50082 */  lbu       $a1, 0x82($a2)
/* 987C 8002E47C 9462000E */  lhu       $v0, 0xE($v1)
/* 9880 8002E480 00052E00 */  sll       $a1, $a1, 24
/* 9884 8002E484 00052E03 */  sra       $a1, $a1, 24
/* 9888 8002E488 00441021 */  addu      $v0, $v0, $a0
/* 988C 8002E48C 00021400 */  sll       $v0, $v0, 16
/* 9890 8002E490 00021383 */  sra       $v0, $v0, 14
/* 9894 8002E494 00A22821 */  addu      $a1, $a1, $v0
/* 9898 8002E498 A46500B8 */  sh        $a1, 0xB8($v1)
/* 989C 8002E49C 90C50083 */  lbu       $a1, 0x83($a2)
/* 98A0 8002E4A0 9462000C */  lhu       $v0, 0xC($v1)
/* 98A4 8002E4A4 00052E00 */  sll       $a1, $a1, 24
/* 98A8 8002E4A8 00052E03 */  sra       $a1, $a1, 24
/* 98AC 8002E4AC 00021400 */  sll       $v0, $v0, 16
/* 98B0 8002E4B0 00022403 */  sra       $a0, $v0, 16
/* 98B4 8002E4B4 000217C2 */  srl       $v0, $v0, 31
/* 98B8 8002E4B8 00822021 */  addu      $a0, $a0, $v0
/* 98BC 8002E4BC 94620010 */  lhu       $v0, 0x10($v1)
/* 98C0 8002E4C0 00042043 */  sra       $a0, $a0, 1
/* 98C4 8002E4C4 00441021 */  addu      $v0, $v0, $a0
/* 98C8 8002E4C8 00021400 */  sll       $v0, $v0, 16
/* 98CC 8002E4CC 00021383 */  sra       $v0, $v0, 14
/* 98D0 8002E4D0 00A22821 */  addu      $a1, $a1, $v0
/* 98D4 8002E4D4 24020200 */  addiu     $v0, $zero, 0x200
/* 98D8 8002E4D8 A46500BA */  sh        $a1, 0xBA($v1)
/* 98DC 8002E4DC A46200BC */  sh        $v0, 0xBC($v1)
/* 98E0 8002E4E0 03E00008 */  jr        $ra
/* 98E4 8002E4E4 A46000BE */   sh       $zero, 0xBE($v1)

### DECOMPILED C INSTRUCTIONS:

void set_cam_viewport(s16 id, s16 x, s16 y, s16 width, s16 height) {
    Camera* camera = &gCameras[id];

    camera->viewportW = width;
    camera->viewportH = height;
    camera->viewportStartX = x;
    camera->viewportStartY = y;

    camera->vp.vp.vscale[0] = 2.0f * camera->viewportW;
    camera->vp.vp.vscale[1] = 2.0f * camera->viewportH;
    camera->vp.vp.vscale[2] = 0x1FF;
    camera->vp.vp.vscale[3] = 0;

    camera->vp.vp.vtrans[0] = 4 * (s16) ((u16) camera->viewportStartX + (camera->viewportW / 2));
    camera->vp.vp.vtrans[1] = (s16) ((u16) camera->viewportStartY + (camera->viewportH / 2));
    camera->vp.vp.vtrans[1] = 4 * camera->vp.vp.vtrans[1];
    camera->vp.vp.vtrans[2] = 0x1FF;
    camera->vp.vp.vtrans[3] = 0;

    camera->vpAlt.vp.vscale[0] = 2.0f * camera->viewportW;
    camera->vpAlt.vp.vscale[1] = 2.0f * camera->viewportH;
    camera->vpAlt.vp.vscale[2] = 0x1FF;
    camera->vpAlt.vp.vscale[3] = 0;

    camera->vpAlt.vp.vtrans[0] = gGameStatusPtr->unk_82 + 4 * (s16) ((u16) camera->viewportStartX + (camera->viewportW / 2));
    camera->vpAlt.vp.vtrans[1] = gGameStatusPtr->unk_83 + 4 * (s16) ((u16) camera->viewportStartY + (camera->viewportH / 2));
    camera->vpAlt.vp.vtrans[2] = 0x200;
    camera->vpAlt.vp.vtrans[3] = 0;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel spr_transform_point
/* FFDF0 802DCD00 27BDFF20 */  addiu     $sp, $sp, -0xE0
/* FFDF4 802DCD04 F7B800C8 */  sdc1      $f24, 0xC8($sp)
/* FFDF8 802DCD08 4487C000 */  mtc1      $a3, $f24
/* FFDFC 802DCD0C F7BA00D0 */  sdc1      $f26, 0xD0($sp)
/* FFE00 802DCD10 C7BA00F0 */  lwc1      $f26, 0xF0($sp)
/* FFE04 802DCD14 F7BC00D8 */  sdc1      $f28, 0xD8($sp)
/* FFE08 802DCD18 C7BC00F4 */  lwc1      $f28, 0xF4($sp)
/* FFE0C 802DCD1C AFB300A4 */  sw        $s3, 0xA4($sp)
/* FFE10 802DCD20 8FB300F8 */  lw        $s3, 0xF8($sp)
/* FFE14 802DCD24 AFB400A8 */  sw        $s4, 0xA8($sp)
/* FFE18 802DCD28 8FB400FC */  lw        $s4, 0xFC($sp)
/* FFE1C 802DCD2C AFB500AC */  sw        $s5, 0xAC($sp)
/* FFE20 802DCD30 8FB50100 */  lw        $s5, 0x100($sp)
/* FFE24 802DCD34 AFB200A0 */  sw        $s2, 0xA0($sp)
/* FFE28 802DCD38 0080902D */  daddu     $s2, $a0, $zero
/* FFE2C 802DCD3C AFB1009C */  sw        $s1, 0x9C($sp)
/* FFE30 802DCD40 AFBF00B0 */  sw        $ra, 0xB0($sp)
/* FFE34 802DCD44 AFB00098 */  sw        $s0, 0x98($sp)
/* FFE38 802DCD48 F7B600C0 */  sdc1      $f22, 0xC0($sp)
/* FFE3C 802DCD4C F7B400B8 */  sdc1      $f20, 0xB8($sp)
/* FFE40 802DCD50 16400009 */  bnez      $s2, .L802DCD78
/* FFE44 802DCD54 00C0882D */   daddu    $s1, $a2, $zero
/* FFE48 802DCD58 14A00007 */  bnez      $a1, .L802DCD78
/* FFE4C 802DCD5C 00000000 */   nop
/* FFE50 802DCD60 16200005 */  bnez      $s1, .L802DCD78
/* FFE54 802DCD64 00000000 */   nop
/* FFE58 802DCD68 E6780000 */  swc1      $f24, 0x0($s3)
/* FFE5C 802DCD6C E69A0000 */  swc1      $f26, 0x0($s4)
/* FFE60 802DCD70 080B73A9 */  j         .L802DCEA4
/* FFE64 802DCD74 E6BC0000 */   swc1     $f28, 0x0($s5)
.L802DCD78:
/* FFE68 802DCD78 44859000 */  mtc1      $a1, $f18
/* FFE6C 802DCD7C 00000000 */  nop
/* FFE70 802DCD80 468094A0 */  cvt.s.w   $f18, $f18
/* FFE74 802DCD84 4480A000 */  mtc1      $zero, $f20
/* FFE78 802DCD88 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* FFE7C 802DCD8C 4481B000 */  mtc1      $at, $f22
/* FFE80 802DCD90 44059000 */  mfc1      $a1, $f18
/* FFE84 802DCD94 4406A000 */  mfc1      $a2, $f20
/* FFE88 802DCD98 4407B000 */  mfc1      $a3, $f22
/* FFE8C 802DCD9C 27A40018 */  addiu     $a0, $sp, 0x18
/* FFE90 802DCDA0 0C019EC8 */  jal       guRotateF
/* FFE94 802DCDA4 E7B40010 */   swc1     $f20, 0x10($sp)
/* FFE98 802DCDA8 27B00058 */  addiu     $s0, $sp, 0x58
/* FFE9C 802DCDAC 44919000 */  mtc1      $s1, $f18
/* FFEA0 802DCDB0 00000000 */  nop
/* FFEA4 802DCDB4 468094A0 */  cvt.s.w   $f18, $f18
/* FFEA8 802DCDB8 4406A000 */  mfc1      $a2, $f20
/* FFEAC 802DCDBC 4407A000 */  mfc1      $a3, $f20
/* FFEB0 802DCDC0 44059000 */  mfc1      $a1, $f18
/* FFEB4 802DCDC4 0200202D */  daddu     $a0, $s0, $zero
/* FFEB8 802DCDC8 0C019EC8 */  jal       guRotateF
/* FFEBC 802DCDCC E7B60010 */   swc1     $f22, 0x10($sp)
/* FFEC0 802DCDD0 0200202D */  daddu     $a0, $s0, $zero
/* FFEC4 802DCDD4 27A50018 */  addiu     $a1, $sp, 0x18
/* FFEC8 802DCDD8 0C019D80 */  jal       guMtxCatF
/* FFECC 802DCDDC 00A0302D */   daddu    $a2, $a1, $zero
/* FFED0 802DCDE0 44929000 */  mtc1      $s2, $f18
/* FFED4 802DCDE4 00000000 */  nop
/* FFED8 802DCDE8 468094A0 */  cvt.s.w   $f18, $f18
/* FFEDC 802DCDEC 4406B000 */  mfc1      $a2, $f22
/* FFEE0 802DCDF0 4407A000 */  mfc1      $a3, $f20
/* FFEE4 802DCDF4 44059000 */  mfc1      $a1, $f18
/* FFEE8 802DCDF8 0200202D */  daddu     $a0, $s0, $zero
/* FFEEC 802DCDFC 0C019EC8 */  jal       guRotateF
/* FFEF0 802DCE00 AFA70010 */   sw       $a3, 0x10($sp)
/* FFEF4 802DCE04 0200202D */  daddu     $a0, $s0, $zero
/* FFEF8 802DCE08 27A50018 */  addiu     $a1, $sp, 0x18
/* FFEFC 802DCE0C 0C019D80 */  jal       guMtxCatF
/* FFF00 802DCE10 00A0302D */   daddu    $a2, $a1, $zero
/* FFF04 802DCE14 C7A80018 */  lwc1      $f8, 0x18($sp)
/* FFF08 802DCE18 46184202 */  mul.s     $f8, $f8, $f24
/* FFF0C 802DCE1C 00000000 */  nop
/* FFF10 802DCE20 C7B00028 */  lwc1      $f16, 0x28($sp)
/* FFF14 802DCE24 461A8402 */  mul.s     $f16, $f16, $f26
/* FFF18 802DCE28 00000000 */  nop
/* FFF1C 802DCE2C C7AE0038 */  lwc1      $f14, 0x38($sp)
/* FFF20 802DCE30 461C7382 */  mul.s     $f14, $f14, $f28
/* FFF24 802DCE34 00000000 */  nop
/* FFF28 802DCE38 C7A2001C */  lwc1      $f2, 0x1C($sp)
/* FFF2C 802DCE3C 46181082 */  mul.s     $f2, $f2, $f24
/* FFF30 802DCE40 00000000 */  nop
/* FFF34 802DCE44 C7AA002C */  lwc1      $f10, 0x2C($sp)
/* FFF38 802DCE48 461A5282 */  mul.s     $f10, $f10, $f26
/* FFF3C 802DCE4C 00000000 */  nop
/* FFF40 802DCE50 C7AC003C */  lwc1      $f12, 0x3C($sp)
/* FFF44 802DCE54 461C6302 */  mul.s     $f12, $f12, $f28
/* FFF48 802DCE58 00000000 */  nop
/* FFF4C 802DCE5C C7A00020 */  lwc1      $f0, 0x20($sp)
/* FFF50 802DCE60 46180002 */  mul.s     $f0, $f0, $f24
/* FFF54 802DCE64 00000000 */  nop
/* FFF58 802DCE68 C7A40030 */  lwc1      $f4, 0x30($sp)
/* FFF5C 802DCE6C 461A2102 */  mul.s     $f4, $f4, $f26
/* FFF60 802DCE70 00000000 */  nop
/* FFF64 802DCE74 C7A60040 */  lwc1      $f6, 0x40($sp)
/* FFF68 802DCE78 461C3182 */  mul.s     $f6, $f6, $f28
/* FFF6C 802DCE7C 00000000 */  nop
/* FFF70 802DCE80 46104200 */  add.s     $f8, $f8, $f16
/* FFF74 802DCE84 460A1080 */  add.s     $f2, $f2, $f10
/* FFF78 802DCE88 46040000 */  add.s     $f0, $f0, $f4
/* FFF7C 802DCE8C 460E4200 */  add.s     $f8, $f8, $f14
/* FFF80 802DCE90 460C1080 */  add.s     $f2, $f2, $f12
/* FFF84 802DCE94 46060000 */  add.s     $f0, $f0, $f6
/* FFF88 802DCE98 E6680000 */  swc1      $f8, 0x0($s3)
/* FFF8C 802DCE9C E6820000 */  swc1      $f2, 0x0($s4)
/* FFF90 802DCEA0 E6A00000 */  swc1      $f0, 0x0($s5)
.L802DCEA4:
/* FFF94 802DCEA4 8FBF00B0 */  lw        $ra, 0xB0($sp)
/* FFF98 802DCEA8 8FB500AC */  lw        $s5, 0xAC($sp)
/* FFF9C 802DCEAC 8FB400A8 */  lw        $s4, 0xA8($sp)
/* FFFA0 802DCEB0 8FB300A4 */  lw        $s3, 0xA4($sp)
/* FFFA4 802DCEB4 8FB200A0 */  lw        $s2, 0xA0($sp)
/* FFFA8 802DCEB8 8FB1009C */  lw        $s1, 0x9C($sp)
/* FFFAC 802DCEBC 8FB00098 */  lw        $s0, 0x98($sp)
/* FFFB0 802DCEC0 D7BC00D8 */  ldc1      $f28, 0xD8($sp)
/* FFFB4 802DCEC4 D7BA00D0 */  ldc1      $f26, 0xD0($sp)
/* FFFB8 802DCEC8 D7B800C8 */  ldc1      $f24, 0xC8($sp)
/* FFFBC 802DCECC D7B600C0 */  ldc1      $f22, 0xC0($sp)
/* FFFC0 802DCED0 D7B400B8 */  ldc1      $f20, 0xB8($sp)
/* FFFC4 802DCED4 03E00008 */  jr        $ra
/* FFFC8 802DCED8 27BD00E0 */   addiu    $sp, $sp, 0xE0

### DECOMPILED C INSTRUCTIONS:

void spr_transform_point(s32 rotX, s32 rotY, s32 rotZ, f32 inX, f32 inY, f32 inZ, f32* outX, f32* outY, f32* outZ) {
    if (rotX == 0 && rotY == 0 && rotZ == 0) {
        *outX = inX;
        *outY = inY;
        *outZ = inZ;
    } else {
        Matrix4f mtxTransform, mtxTemp;
        f32 xx, yx, zx, xy, yy, zy, xz, yz, zz;

        guRotateF(mtxTransform, rotY, 0.0f, 1.0f, 0.0f);
        guRotateF(mtxTemp, rotZ, 0.0f, 0.0f, 1.0f);
        guMtxCatF(mtxTemp, mtxTransform, mtxTransform);
        guRotateF(mtxTemp, rotX, 1.0f, 0.0f, 0.0f);
        guMtxCatF(mtxTemp, mtxTransform, mtxTransform);

        xx = (mtxTransform[0][0] * inX);
        yx = (mtxTransform[1][0] * inY);
        zx = (mtxTransform[2][0] * inZ);
        xy = (mtxTransform[0][1] * inX);
        yy = (mtxTransform[1][1] * inY);
        zy = (mtxTransform[2][1] * inZ);
        xz = (mtxTransform[0][2] * inX);
        yz = (mtxTransform[1][2] * inY);
        zz = (mtxTransform[2][2] * inZ);

        *outX = xx + yx + zx;
        *outY = xy + yy + zy;
        *outZ = xz + yz + zz;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel appendGfx_startup_prim_rect
/* 5D04 8002A904 27BDFFF8 */  addiu     $sp, $sp, -0x8
/* 5D08 8002A908 0080602D */  daddu     $t4, $a0, $zero
/* 5D0C 8002A90C 00A0682D */  daddu     $t5, $a1, $zero
glabel func_8002A910
/* 5D10 8002A910 00E0582D */  daddu     $t3, $a3, $zero
/* 5D14 8002A914 3C08800A */  lui       $t0, %hi(gMainGfxPos)
/* 5D18 8002A918 2508A66C */  addiu     $t0, $t0, %lo(gMainGfxPos)
/* 5D1C 8002A91C 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 5D20 8002A920 AFB00000 */  sw        $s0, 0x0($sp)
/* 5D24 8002A924 8D070000 */  lw        $a3, 0x0($t0)
/* 5D28 8002A928 97B9001A */  lhu       $t9, 0x1A($sp)
/* 5D2C 8002A92C 97B0001E */  lhu       $s0, 0x1E($sp)
/* 5D30 8002A930 97AF0022 */  lhu       $t7, 0x22($sp)
/* 5D34 8002A934 97B80026 */  lhu       $t8, 0x26($sp)
/* 5D38 8002A938 00E0182D */  daddu     $v1, $a3, $zero
/* 5D3C 8002A93C 24E70008 */  addiu     $a3, $a3, 0x8
/* 5D40 8002A940 AD070000 */  sw        $a3, 0x0($t0)
/* 5D44 8002A944 AC620000 */  sw        $v0, 0x0($v1)
/* 5D48 8002A948 24E20008 */  addiu     $v0, $a3, 0x8
/* 5D4C 8002A94C AC600004 */  sw        $zero, 0x4($v1)
/* 5D50 8002A950 AD020000 */  sw        $v0, 0x0($t0)
/* 5D54 8002A954 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 5D58 8002A958 ACE20000 */  sw        $v0, 0x0($a3)
/* 5D5C 8002A95C 3C028007 */  lui       $v0, %hi(D_80074580)
/* 5D60 8002A960 24424580 */  addiu     $v0, $v0, %lo(D_80074580)
/* 5D64 8002A964 316300FF */  andi      $v1, $t3, 0xFF
/* 5D68 8002A968 ACE20004 */  sw        $v0, 0x4($a3)
/* 5D6C 8002A96C 240200FF */  addiu     $v0, $zero, 0xFF
/* 5D70 8002A970 1462000A */  bne       $v1, $v0, .L8002A99C
/* 5D74 8002A974 00C0702D */   daddu    $t6, $a2, $zero
/* 5D78 8002A978 3C05E200 */  lui       $a1, (0xE200001C >> 16)
/* 5D7C 8002A97C 34A5001C */  ori       $a1, $a1, (0xE200001C & 0xFFFF)
/* 5D80 8002A980 3C030F0A */  lui       $v1, (0xF0A4000 >> 16)
/* 5D84 8002A984 34634000 */  ori       $v1, $v1, (0xF0A4000 & 0xFFFF)
/* 5D88 8002A988 3C06FCFF */  lui       $a2, (0xFCFFFFFF >> 16)
/* 5D8C 8002A98C 34C6FFFF */  ori       $a2, $a2, (0xFCFFFFFF & 0xFFFF)
/* 5D90 8002A990 3C04FFFD */  lui       $a0, (0xFFFDFCFE >> 16)
/* 5D94 8002A994 0800AA6F */  j         .L8002A9BC
/* 5D98 8002A998 3484FCFE */   ori      $a0, $a0, (0xFFFDFCFE & 0xFFFF)
.L8002A99C:
/* 5D9C 8002A99C 3C05E200 */  lui       $a1, (0xE200001C >> 16)
/* 5DA0 8002A9A0 34A5001C */  ori       $a1, $a1, (0xE200001C & 0xFFFF)
/* 5DA4 8002A9A4 3C030050 */  lui       $v1, (0x504240 >> 16)
/* 5DA8 8002A9A8 34634240 */  ori       $v1, $v1, (0x504240 & 0xFFFF)
/* 5DAC 8002A9AC 3C06FCFF */  lui       $a2, (0xFCFFFFFF >> 16)
/* 5DB0 8002A9B0 34C6FFFF */  ori       $a2, $a2, (0xFCFFFFFF & 0xFFFF)
/* 5DB4 8002A9B4 3C04FFFD */  lui       $a0, (0xFFFDF6FB >> 16)
/* 5DB8 8002A9B8 3484F6FB */  ori       $a0, $a0, (0xFFFDF6FB & 0xFFFF)
.L8002A9BC:
/* 5DBC 8002A9BC 24E20010 */  addiu     $v0, $a3, 0x10
/* 5DC0 8002A9C0 AD020000 */  sw        $v0, 0x0($t0)
/* 5DC4 8002A9C4 24E20018 */  addiu     $v0, $a3, 0x18
/* 5DC8 8002A9C8 ACE50008 */  sw        $a1, 0x8($a3)
/* 5DCC 8002A9CC ACE3000C */  sw        $v1, 0xC($a3)
/* 5DD0 8002A9D0 AD020000 */  sw        $v0, 0x0($t0)
/* 5DD4 8002A9D4 ACE60010 */  sw        $a2, 0x10($a3)
/* 5DD8 8002A9D8 ACE40014 */  sw        $a0, 0x14($a3)
/* 5DDC 8002A9DC 3C09E200 */  lui       $t1, (0xE200001C >> 16)
/* 5DE0 8002A9E0 3529001C */  ori       $t1, $t1, (0xE200001C & 0xFFFF)
/* 5DE4 8002A9E4 3C070F0A */  lui       $a3, (0xF0A7008 >> 16)
/* 5DE8 8002A9E8 34E77008 */  ori       $a3, $a3, (0xF0A7008 & 0xFFFF)
/* 5DEC 8002A9EC 3C0AFCFF */  lui       $t2, (0xFCFFFFFF >> 16)
/* 5DF0 8002A9F0 354AFFFF */  ori       $t2, $t2, (0xFCFFFFFF & 0xFFFF)
/* 5DF4 8002A9F4 3C08FFFC */  lui       $t0, (0xFFFCF279 >> 16)
/* 5DF8 8002A9F8 3C06800A */  lui       $a2, %hi(gMainGfxPos)
/* 5DFC 8002A9FC 24C6A66C */  addiu     $a2, $a2, %lo(gMainGfxPos)
/* 5E00 8002AA00 3508F279 */  ori       $t0, $t0, (0xFFFCF279 & 0xFFFF)
/* 5E04 8002AA04 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 5E08 8002AA08 8CC50000 */  lw        $a1, 0x0($a2)
/* 5E0C 8002AA0C 000C1E00 */  sll       $v1, $t4, 24
/* 5E10 8002AA10 00A0202D */  daddu     $a0, $a1, $zero
/* 5E14 8002AA14 24A50008 */  addiu     $a1, $a1, 0x8
/* 5E18 8002AA18 ACC50000 */  sw        $a1, 0x0($a2)
/* 5E1C 8002AA1C AC820000 */  sw        $v0, 0x0($a0)
/* 5E20 8002AA20 31A200FF */  andi      $v0, $t5, 0xFF
/* 5E24 8002AA24 00021400 */  sll       $v0, $v0, 16
/* 5E28 8002AA28 00621825 */  or        $v1, $v1, $v0
glabel func_8002AA2C
/* 5E2C 8002AA2C 31C200FF */  andi      $v0, $t6, 0xFF
/* 5E30 8002AA30 00021200 */  sll       $v0, $v0, 8
/* 5E34 8002AA34 00621825 */  or        $v1, $v1, $v0
/* 5E38 8002AA38 316200FF */  andi      $v0, $t3, 0xFF
/* 5E3C 8002AA3C 00621825 */  or        $v1, $v1, $v0
/* 5E40 8002AA40 24A20008 */  addiu     $v0, $a1, 0x8
/* 5E44 8002AA44 AC830004 */  sw        $v1, 0x4($a0)
/* 5E48 8002AA48 31E403FF */  andi      $a0, $t7, 0x3FF
/* 5E4C 8002AA4C 00042380 */  sll       $a0, $a0, 14
/* 5E50 8002AA50 ACC20000 */  sw        $v0, 0x0($a2)
/* 5E54 8002AA54 330203FF */  andi      $v0, $t8, 0x3FF
/* 5E58 8002AA58 00021080 */  sll       $v0, $v0, 2
/* 5E5C 8002AA5C 3C03F600 */  lui       $v1, (0xF6000000 >> 16)
/* 5E60 8002AA60 00431025 */  or        $v0, $v0, $v1
/* 5E64 8002AA64 00822025 */  or        $a0, $a0, $v0
/* 5E68 8002AA68 332303FF */  andi      $v1, $t9, 0x3FF
/* 5E6C 8002AA6C 00031B80 */  sll       $v1, $v1, 14
/* 5E70 8002AA70 320203FF */  andi      $v0, $s0, 0x3FF
/* 5E74 8002AA74 00021080 */  sll       $v0, $v0, 2
/* 5E78 8002AA78 00621825 */  or        $v1, $v1, $v0
/* 5E7C 8002AA7C 24A20010 */  addiu     $v0, $a1, 0x10
/* 5E80 8002AA80 ACA40000 */  sw        $a0, 0x0($a1)
/* 5E84 8002AA84 ACA30004 */  sw        $v1, 0x4($a1)
/* 5E88 8002AA88 ACC20000 */  sw        $v0, 0x0($a2)
/* 5E8C 8002AA8C 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 5E90 8002AA90 ACA20008 */  sw        $v0, 0x8($a1)
/* 5E94 8002AA94 24A20018 */  addiu     $v0, $a1, 0x18
/* 5E98 8002AA98 ACA0000C */  sw        $zero, 0xC($a1)
/* 5E9C 8002AA9C ACC20000 */  sw        $v0, 0x0($a2)
/* 5EA0 8002AAA0 24A20020 */  addiu     $v0, $a1, 0x20
/* 5EA4 8002AAA4 ACA90010 */  sw        $t1, 0x10($a1)
/* 5EA8 8002AAA8 ACA70014 */  sw        $a3, 0x14($a1)
/* 5EAC 8002AAAC ACC20000 */  sw        $v0, 0x0($a2)
/* 5EB0 8002AAB0 ACAA0018 */  sw        $t2, 0x18($a1)
/* 5EB4 8002AAB4 ACA8001C */  sw        $t0, 0x1C($a1)
/* 5EB8 8002AAB8 8FB00000 */  lw        $s0, 0x0($sp)
/* 5EBC 8002AABC 03E00008 */  jr        $ra
/* 5EC0 8002AAC0 27BD0008 */   addiu    $sp, $sp, 0x8

### DECOMPILED C INSTRUCTIONS:

void appendGfx_startup_prim_rect(u8 r, u8 g, u8 b, u8 a, u16 left, u16 top, u16 right, u16 bottom) {
    gDPPipeSync(gMainGfxPos++);
    gSPDisplayList(gMainGfxPos++, D_80074580);

    if (a == 255) {
        gDPSetRenderMode(gMainGfxPos++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
        gDPSetCombineMode(gMainGfxPos++, PM_CC_08, PM_CC_08);
    } else {
        gDPSetRenderMode(gMainGfxPos++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
        gDPSetCombineMode(gMainGfxPos++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
    }

    gDPSetPrimColor(gMainGfxPos++, 0, 0, r, g, b, a);
    gDPFillRectangle(gMainGfxPos++, left, top, right, bottom);

    gDPPipeSync(gMainGfxPos++);
    gDPSetRenderMode(gMainGfxPos++, G_RM_TEX_EDGE, G_RM_TEX_EDGE2);
    gDPSetCombineMode(gMainGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel green_impact_main
/* 364F10 E0064000 27BDFFA0 */  addiu     $sp, $sp, -0x60
/* 364F14 E0064004 F7B40040 */  sdc1      $f20, 0x40($sp)
/* 364F18 E0064008 4485A000 */  mtc1      $a1, $f20
/* 364F1C E006400C F7B60048 */  sdc1      $f22, 0x48($sp)
/* 364F20 E0064010 4486B000 */  mtc1      $a2, $f22
/* 364F24 E0064014 F7B80050 */  sdc1      $f24, 0x50($sp)
/* 364F28 E0064018 4487C000 */  mtc1      $a3, $f24
/* 364F2C E006401C AFB30034 */  sw        $s3, 0x34($sp)
/* 364F30 E0064020 0080982D */  daddu     $s3, $a0, $zero
/* 364F34 E0064024 AFB1002C */  sw        $s1, 0x2C($sp)
/* 364F38 E0064028 24110001 */  addiu     $s1, $zero, 0x1
/* 364F3C E006402C F7BA0058 */  sdc1      $f26, 0x58($sp)
/* 364F40 E0064030 C7BA0070 */  lwc1      $f26, 0x70($sp)
/* 364F44 E0064034 27A40010 */  addiu     $a0, $sp, 0x10
/* 364F48 E0064038 AFBF0038 */  sw        $ra, 0x38($sp)
/* 364F4C E006403C AFB20030 */  sw        $s2, 0x30($sp)
/* 364F50 E0064040 16600002 */  bnez      $s3, .LE006404C
/* 364F54 E0064044 AFB00028 */   sw       $s0, 0x28($sp)
/* 364F58 E0064048 24110004 */  addiu     $s1, $zero, 0x4
.LE006404C:
/* 364F5C E006404C 26310001 */  addiu     $s1, $s1, 0x1
/* 364F60 E0064050 3C02E006 */  lui       $v0, %hi(green_impact_init)
/* 364F64 E0064054 2442419C */  addiu     $v0, $v0, %lo(green_impact_init)
/* 364F68 E0064058 AFA00010 */  sw        $zero, 0x10($sp)
/* 364F6C E006405C AC820008 */  sw        $v0, 0x8($a0)
/* 364F70 E0064060 3C02E006 */  lui       $v0, %hi(green_impact_update)
/* 364F74 E0064064 244241A4 */  addiu     $v0, $v0, %lo(green_impact_update)
/* 364F78 E0064068 AC82000C */  sw        $v0, 0xC($a0)
/* 364F7C E006406C 3C02E006 */  lui       $v0, %hi(green_impact_render)
/* 364F80 E0064070 244243DC */  addiu     $v0, $v0, %lo(green_impact_render)
/* 364F84 E0064074 AC820010 */  sw        $v0, 0x10($a0)
/* 364F88 E0064078 24020032 */  addiu     $v0, $zero, 0x32
/* 364F8C E006407C AC800014 */  sw        $zero, 0x14($a0)
/* 364F90 E0064080 0C080124 */  jal       shim_create_effect_instance
/* 364F94 E0064084 AC820004 */   sw       $v0, 0x4($a0)
/* 364F98 E0064088 00112040 */  sll       $a0, $s1, 1
/* 364F9C E006408C 00912021 */  addu      $a0, $a0, $s1
/* 364FA0 E0064090 00042080 */  sll       $a0, $a0, 2
/* 364FA4 E0064094 00912023 */  subu      $a0, $a0, $s1
/* 364FA8 E0064098 000420C0 */  sll       $a0, $a0, 3
/* 364FAC E006409C 0040902D */  daddu     $s2, $v0, $zero
/* 364FB0 E00640A0 0C08012C */  jal       shim_general_heap_malloc
/* 364FB4 E00640A4 AE510008 */   sw       $s1, 0x8($s2)
/* 364FB8 E00640A8 0040802D */  daddu     $s0, $v0, $zero
/* 364FBC E00640AC 16000003 */  bnez      $s0, .LE00640BC
/* 364FC0 E00640B0 AE50000C */   sw       $s0, 0xC($s2)
.LE00640B4:
/* 364FC4 E00640B4 0801902D */  j         .LE00640B4
/* 364FC8 E00640B8 00000000 */   nop
.LE00640BC:
/* 364FCC E00640BC 0200202D */  daddu     $a0, $s0, $zero
/* 364FD0 E00640C0 00112840 */  sll       $a1, $s1, 1
/* 364FD4 E00640C4 00B12821 */  addu      $a1, $a1, $s1
/* 364FD8 E00640C8 00052880 */  sll       $a1, $a1, 2
/* 364FDC E00640CC 00B12823 */  subu      $a1, $a1, $s1
/* 364FE0 E00640D0 0C080130 */  jal       shim_mem_clear
/* 364FE4 E00640D4 000528C0 */   sll      $a1, $a1, 3
/* 364FE8 E00640D8 2402003C */  addiu     $v0, $zero, 0x3C
/* 364FEC E00640DC 240300FF */  addiu     $v1, $zero, 0xFF
/* 364FF0 E00640E0 AE020028 */  sw        $v0, 0x28($s0)
/* 364FF4 E00640E4 2402007A */  addiu     $v0, $zero, 0x7A
/* 364FF8 E00640E8 A2020052 */  sb        $v0, 0x52($s0)
/* 364FFC E00640EC 240200F0 */  addiu     $v0, $zero, 0xF0
/* 365000 E00640F0 A2020053 */  sb        $v0, 0x53($s0)
/* 365004 E00640F4 240200FA */  addiu     $v0, $zero, 0xFA
/* 365008 E00640F8 AE00002C */  sw        $zero, 0x2C($s0)
/* 36500C E00640FC A6130000 */  sh        $s3, 0x0($s0)
/* 365010 E0064100 E6140004 */  swc1      $f20, 0x4($s0)
/* 365014 E0064104 E6160008 */  swc1      $f22, 0x8($s0)
/* 365018 E0064108 E618000C */  swc1      $f24, 0xC($s0)
/* 36501C E006410C AE030038 */  sw        $v1, 0x38($s0)
/* 365020 E0064110 A2000050 */  sb        $zero, 0x50($s0)
/* 365024 E0064114 A2030051 */  sb        $v1, 0x51($s0)
/* 365028 E0064118 A2030054 */  sb        $v1, 0x54($s0)
/* 36502C E006411C A2020055 */  sb        $v0, 0x55($s0)
/* 365030 E0064120 24030001 */  addiu     $v1, $zero, 0x1
/* 365034 E0064124 0071102A */  slt       $v0, $v1, $s1
/* 365038 E0064128 10400010 */  beqz      $v0, .LE006416C
/* 36503C E006412C 26100058 */   addiu    $s0, $s0, 0x58
/* 365040 E0064130 26040030 */  addiu     $a0, $s0, 0x30
/* 365044 E0064134 2406001E */  addiu     $a2, $zero, 0x1E
/* 365048 E0064138 2405FFFF */  addiu     $a1, $zero, -0x1
.LE006413C:
/* 36504C E006413C 44860000 */  mtc1      $a2, $f0
/* 365050 E0064140 00000000 */  nop
/* 365054 E0064144 46800020 */  cvt.s.w   $f0, $f0
/* 365058 E0064148 24C6001E */  addiu     $a2, $a2, 0x1E
/* 36505C E006414C AC85001C */  sw        $a1, 0x1C($a0)
/* 365060 E0064150 24A5FFFC */  addiu     $a1, $a1, -0x4
/* 365064 E0064154 24630001 */  addiu     $v1, $v1, 0x1
/* 365068 E0064158 E49A0004 */  swc1      $f26, 0x4($a0)
/* 36506C E006415C E4800000 */  swc1      $f0, 0x0($a0)
/* 365070 E0064160 0071102A */  slt       $v0, $v1, $s1
/* 365074 E0064164 1440FFF5 */  bnez      $v0, .LE006413C
/* 365078 E0064168 24840058 */   addiu    $a0, $a0, 0x58
.LE006416C:
/* 36507C E006416C 0240102D */  daddu     $v0, $s2, $zero
/* 365080 E0064170 8FBF0038 */  lw        $ra, 0x38($sp)
/* 365084 E0064174 8FB30034 */  lw        $s3, 0x34($sp)
/* 365088 E0064178 8FB20030 */  lw        $s2, 0x30($sp)
/* 36508C E006417C 8FB1002C */  lw        $s1, 0x2C($sp)
/* 365090 E0064180 8FB00028 */  lw        $s0, 0x28($sp)
/* 365094 E0064184 D7BA0058 */  ldc1      $f26, 0x58($sp)
/* 365098 E0064188 D7B80050 */  ldc1      $f24, 0x50($sp)
/* 36509C E006418C D7B60048 */  ldc1      $f22, 0x48($sp)
/* 3650A0 E0064190 D7B40040 */  ldc1      $f20, 0x40($sp)
/* 3650A4 E0064194 03E00008 */  jr        $ra
/* 3650A8 E0064198 27BD0060 */   addiu    $sp, $sp, 0x60

### DECOMPILED C INSTRUCTIONS:

EffectInstance* green_impact_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
    EffectBlueprint bp;
    EffectBlueprint* bpPtr = &bp;
    EffectInstance* effect;
    GreenImpactFXData* part;
    s32 numParts;
    s32 temp;
    s32 i;

    if (arg0 == 0) {
        numParts = 4;
    } else {
        temp = 1; // Required to match
        numParts = temp;
    }
    numParts++;

    bpPtr->unk_00 = 0;
    bpPtr->init = green_impact_init;
    bpPtr->update = green_impact_update;
    bpPtr->renderWorld = green_impact_render;
    bpPtr->renderUI = NULL;
    bpPtr->effectID = EFFECT_GREEN_IMPACT;

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

    shim_mem_clear(part, numParts * sizeof(*part));

    part->unk_2C = 0;
    part->unk_00 = arg0;
    part->unk_04 = arg1;
    part->unk_08 = arg2;
    part->unk_0C = arg3;
    part->unk_28 = 60;
    part->unk_38 = 255;
    part->unk_50.r = 0;
    part->unk_50.g = 255;
    part->unk_50.b = 122;
    part->unk_53.r = 240;
    part->unk_53.g = 255;
    part->unk_53.b = 250;

    part++;
    for (i = 1; i < numParts; i++, part++) {
        part->unk_4C = -1 + (i - 1) * (-4);
        part->unk_34 = arg4;
        part->unk_30 = i * 30;
    }

    return effect;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel emote_main
/* 33418C E00202CC 27BDFF90 */  addiu     $sp, $sp, -0x70
/* 334190 E00202D0 F7B80058 */  sdc1      $f24, 0x58($sp)
/* 334194 E00202D4 4486C000 */  mtc1      $a2, $f24
/* 334198 E00202D8 F7BC0068 */  sdc1      $f28, 0x68($sp)
/* 33419C E00202DC 4487E000 */  mtc1      $a3, $f28
/* 3341A0 E00202E0 AFB00028 */  sw        $s0, 0x28($sp)
/* 3341A4 E00202E4 8FB0008C */  lw        $s0, 0x8C($sp)
/* 3341A8 E00202E8 F7B60050 */  sdc1      $f22, 0x50($sp)
/* 3341AC E00202EC C7B60080 */  lwc1      $f22, 0x80($sp)
/* 3341B0 E00202F0 F7BA0060 */  sdc1      $f26, 0x60($sp)
/* 3341B4 E00202F4 C7BA0084 */  lwc1      $f26, 0x84($sp)
/* 3341B8 E00202F8 AFB20030 */  sw        $s2, 0x30($sp)
/* 3341BC E00202FC 0080902D */  daddu     $s2, $a0, $zero
/* 3341C0 E0020300 AFB5003C */  sw        $s5, 0x3C($sp)
/* 3341C4 E0020304 00A0A82D */  daddu     $s5, $a1, $zero
/* 3341C8 E0020308 AFB30034 */  sw        $s3, 0x34($sp)
/* 3341CC E002030C 24130001 */  addiu     $s3, $zero, 0x1
/* 3341D0 E0020310 F7B40048 */  sdc1      $f20, 0x48($sp)
/* 3341D4 E0020314 C7B40088 */  lwc1      $f20, 0x88($sp)
/* 3341D8 E0020318 27A40010 */  addiu     $a0, $sp, 0x10
/* 3341DC E002031C AFBF0040 */  sw        $ra, 0x40($sp)
/* 3341E0 E0020320 AFB40038 */  sw        $s4, 0x38($sp)
/* 3341E4 E0020324 16530002 */  bne       $s2, $s3, .LE0020330
/* 3341E8 E0020328 AFB1002C */   sw       $s1, 0x2C($sp)
/* 3341EC E002032C 24130003 */  addiu     $s3, $zero, 0x3
.LE0020330:
/* 3341F0 E0020330 3C02E002 */  lui       $v0, %hi(emote_init)
/* 3341F4 E0020334 24420460 */  addiu     $v0, $v0, %lo(emote_init)
/* 3341F8 E0020338 AFA20018 */  sw        $v0, 0x18($sp)
/* 3341FC E002033C 3C02E002 */  lui       $v0, %hi(emote_update)
/* 334200 E0020340 24420468 */  addiu     $v0, $v0, %lo(emote_update)
/* 334204 E0020344 AFA2001C */  sw        $v0, 0x1C($sp)
/* 334208 E0020348 3C02E002 */  lui       $v0, %hi(emote_render)
/* 33420C E002034C 2442058C */  addiu     $v0, $v0, %lo(emote_render)
/* 334210 E0020350 AFA20020 */  sw        $v0, 0x20($sp)
/* 334214 E0020354 24020010 */  addiu     $v0, $zero, 0x10
/* 334218 E0020358 AFA00010 */  sw        $zero, 0x10($sp)
/* 33421C E002035C AFA00024 */  sw        $zero, 0x24($sp)
/* 334220 E0020360 0C080124 */  jal       shim_create_effect_instance
/* 334224 E0020364 AFA20014 */   sw       $v0, 0x14($sp)
/* 334228 E0020368 00132180 */  sll       $a0, $s3, 6
/* 33422C E002036C 0040A02D */  daddu     $s4, $v0, $zero
/* 334230 E0020370 0C08012C */  jal       shim_general_heap_malloc
/* 334234 E0020374 AE930008 */   sw       $s3, 0x8($s4)
/* 334238 E0020378 0040882D */  daddu     $s1, $v0, $zero
/* 33423C E002037C 16200003 */  bnez      $s1, .LE002038C
/* 334240 E0020380 AE91000C */   sw       $s1, 0xC($s4)
.LE0020384:
/* 334244 E0020384 080080E1 */  j         .LE0020384
/* 334248 E0020388 00000000 */   nop
.LE002038C:
/* 33424C E002038C AE35003C */  sw        $s5, 0x3C($s1)
/* 334250 E0020390 AE320000 */  sw        $s2, 0x0($s1)
/* 334254 E0020394 1E000002 */  bgtz      $s0, .LE00203A0
/* 334258 E0020398 AE320030 */   sw       $s2, 0x30($s1)
/* 33425C E002039C 24102710 */  addiu     $s0, $zero, 0x2710
.LE00203A0:
/* 334260 E00203A0 24020001 */  addiu     $v0, $zero, 0x1
/* 334264 E00203A4 AE30002C */  sw        $s0, 0x2C($s1)
/* 334268 E00203A8 16420014 */  bne       $s2, $v0, .LE00203FC
/* 33426C E00203AC AE200034 */   sw       $zero, 0x34($s1)
/* 334270 E00203B0 1260001B */  beqz      $s3, .LE0020420
/* 334274 E00203B4 0000902D */   daddu    $s2, $zero, $zero
/* 334278 E00203B8 2630003C */  addiu     $s0, $s1, 0x3C
.LE00203BC:
/* 33427C E00203BC 0220202D */  daddu     $a0, $s1, $zero
/* 334280 E00203C0 0240282D */  daddu     $a1, $s2, $zero
/* 334284 E00203C4 E618FFD4 */  swc1      $f24, -0x2C($s0)
/* 334288 E00203C8 E61CFFD8 */  swc1      $f28, -0x28($s0)
/* 33428C E00203CC E616FFDC */  swc1      $f22, -0x24($s0)
/* 334290 E00203D0 E614FFE0 */  swc1      $f20, -0x20($s0)
/* 334294 E00203D4 E61AFFE4 */  swc1      $f26, -0x1C($s0)
/* 334298 E00203D8 0C008000 */  jal       func_E0020000
/* 33429C E00203DC AE150000 */   sw       $s5, 0x0($s0)
/* 3342A0 E00203E0 26520001 */  addiu     $s2, $s2, 0x1
/* 3342A4 E00203E4 26100040 */  addiu     $s0, $s0, 0x40
/* 3342A8 E00203E8 0253102A */  slt       $v0, $s2, $s3
/* 3342AC E00203EC 1440FFF3 */  bnez      $v0, .LE00203BC
/* 3342B0 E00203F0 26310040 */   addiu    $s1, $s1, 0x40
/* 3342B4 E00203F4 08008108 */  j         .LE0020420
/* 3342B8 E00203F8 00000000 */   nop
.LE00203FC:
/* 3342BC E00203FC 0220202D */  daddu     $a0, $s1, $zero
/* 3342C0 E0020400 24050001 */  addiu     $a1, $zero, 0x1
/* 3342C4 E0020404 E4980010 */  swc1      $f24, 0x10($a0)
/* 3342C8 E0020408 E49C0014 */  swc1      $f28, 0x14($a0)
/* 3342CC E002040C E4960018 */  swc1      $f22, 0x18($a0)
/* 3342D0 E0020410 E494001C */  swc1      $f20, 0x1C($a0)
/* 3342D4 E0020414 E49A0020 */  swc1      $f26, 0x20($a0)
/* 3342D8 E0020418 0C008000 */  jal       func_E0020000
/* 3342DC E002041C AC95003C */   sw       $s5, 0x3C($a0)
.LE0020420:
/* 3342E0 E0020420 8FA20090 */  lw        $v0, 0x90($sp)
/* 3342E4 E0020424 AC540000 */  sw        $s4, 0x0($v0)
/* 3342E8 E0020428 8FBF0040 */  lw        $ra, 0x40($sp)
/* 3342EC E002042C 8FB5003C */  lw        $s5, 0x3C($sp)
/* 3342F0 E0020430 8FB40038 */  lw        $s4, 0x38($sp)
/* 3342F4 E0020434 8FB30034 */  lw        $s3, 0x34($sp)
/* 3342F8 E0020438 8FB20030 */  lw        $s2, 0x30($sp)
/* 3342FC E002043C 8FB1002C */  lw        $s1, 0x2C($sp)
/* 334300 E0020440 8FB00028 */  lw        $s0, 0x28($sp)
/* 334304 E0020444 D7BC0068 */  ldc1      $f28, 0x68($sp)
/* 334308 E0020448 D7BA0060 */  ldc1      $f26, 0x60($sp)
/* 33430C E002044C D7B80058 */  ldc1      $f24, 0x58($sp)
/* 334310 E0020450 D7B60050 */  ldc1      $f22, 0x50($sp)
/* 334314 E0020454 D7B40048 */  ldc1      $f20, 0x48($sp)
/* 334318 E0020458 03E00008 */  jr        $ra
/* 33431C E002045C 27BD0070 */   addiu    $sp, $sp, 0x70

### DECOMPILED C INSTRUCTIONS:

void emote_main(s32 arg0, Npc* arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, s32 arg7, EffectInstance** arg8) {
    EffectBlueprint bp;
    EffectBlueprint* bpPtr = &bp;
    EmoteFXData* data;
    EffectInstance* effect;
    s32 numParts;

    if (arg0 == 1) {
        numParts = 3;
    } else {
        numParts = 1;
    }

    bp.unk_00 = 0;
    bp.init = emote_init;
    bp.update = emote_update;
    bp.renderWorld = emote_render;
    bp.renderUI = NULL;
    bp.effectID = EFFECT_EMOTE;

    effect = shim_create_effect_instance(bpPtr);
    effect->numParts = numParts;
    data = effect->data.emote = shim_general_heap_malloc(numParts * sizeof(*data));

    ASSERT(effect->data.emote != NULL);
    data->unk_3C = arg1;
    data->unk_00 = arg0;
    data->unk_30 = arg0;

    if (arg7 <= 0) {
        arg7 = 10000;
    }
    data->unk_2C = arg7;
    data->unk_34 = 0;

    if (arg0 == 1) {
        s32 i;

        for (i = 0; i < numParts; i++, data++) {
            data->unk_10 = arg2;
            data->unk_14 = arg3;
            data->unk_18 = arg4;
            data->unk_1C = arg6;
            data->unk_20 = arg5;
            data->unk_3C = arg1;
            func_E0020000(data, i);
        }
    } else {
        data->unk_10 = arg2;
        data->unk_14 = arg3;
        data->unk_18 = arg4;
        data->unk_1C = arg6;
        data->unk_20 = arg5;
        data->unk_3C = arg1;
        func_E0020000(data, 1);
    }
    *arg8 = effect;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel osCreatePiManager
/* 3BDE0 800609E0 27BDFFC8 */  addiu     $sp, $sp, -0x38
/* 3BDE4 800609E4 AFB00018 */  sw        $s0, 0x18($sp)
/* 3BDE8 800609E8 00808021 */  addu      $s0, $a0, $zero
/* 3BDEC 800609EC AFB5002C */  sw        $s5, 0x2C($sp)
/* 3BDF0 800609F0 00A0A821 */  addu      $s5, $a1, $zero
/* 3BDF4 800609F4 AFB40028 */  sw        $s4, 0x28($sp)
/* 3BDF8 800609F8 3C148009 */  lui       $s4, %hi(__osPiDevMgr)
/* 3BDFC 800609FC 26943D50 */  addiu     $s4, $s4, %lo(__osPiDevMgr)
/* 3BE00 80060A00 AFBF0030 */  sw        $ra, 0x30($sp)
/* 3BE04 80060A04 AFB30024 */  sw        $s3, 0x24($sp)
/* 3BE08 80060A08 AFB20020 */  sw        $s2, 0x20($sp)
/* 3BE0C 80060A0C AFB1001C */  sw        $s1, 0x1C($sp)
/* 3BE10 80060A10 8E820000 */  lw        $v0, 0x0($s4)
/* 3BE14 80060A14 00C02821 */  addu      $a1, $a2, $zero
/* 3BE18 80060A18 1440004C */  bnez      $v0, .L80060B4C
/* 3BE1C 80060A1C 00E03021 */   addu     $a2, $a3, $zero
/* 3BE20 80060A20 0C019560 */  jal       osCreateMesgQueue
/* 3BE24 80060A24 02A02021 */   addu     $a0, $s5, $zero
/* 3BE28 80060A28 3C13800B */  lui       $s3, %hi(piEventQueue)
/* 3BE2C 80060A2C 2673F890 */  addiu     $s3, $s3, %lo(piEventQueue)
/* 3BE30 80060A30 02602021 */  addu      $a0, $s3, $zero
/* 3BE34 80060A34 3C05800B */  lui       $a1, %hi(piEventBuf)
/* 3BE38 80060A38 24A5F8A8 */  addiu     $a1, $a1, %lo(piEventBuf)
/* 3BE3C 80060A3C 0C019560 */  jal       osCreateMesgQueue
/* 3BE40 80060A40 24060001 */   addiu    $a2, $zero, 0x1
/* 3BE44 80060A44 3C028009 */  lui       $v0, %hi(__osPiAccessQueueEnabled)
/* 3BE48 80060A48 8C423D90 */  lw        $v0, %lo(__osPiAccessQueueEnabled)($v0)
/* 3BE4C 80060A4C 54400004 */  bnel      $v0, $zero, .L80060A60
/* 3BE50 80060A50 24040008 */   addiu    $a0, $zero, 0x8
/* 3BE54 80060A54 0C018514 */  jal       __osPiCreateAccessQueue
/* 3BE58 80060A58 00000000 */   nop
/* 3BE5C 80060A5C 24040008 */  addiu     $a0, $zero, 0x8
.L80060A60:
/* 3BE60 80060A60 02602821 */  addu      $a1, $s3, $zero
/* 3BE64 80060A64 3C062222 */  lui       $a2, (0x22222222 >> 16)
/* 3BE68 80060A68 0C019654 */  jal       osSetEventMesg
/* 3BE6C 80060A6C 34C62222 */   ori      $a2, $a2, (0x22222222 & 0xFFFF)
/* 3BE70 80060A70 2412FFFF */  addiu     $s2, $zero, -0x1
/* 3BE74 80060A74 0C0197CC */  jal       osGetThreadPri
/* 3BE78 80060A78 00002021 */   addu     $a0, $zero, $zero
/* 3BE7C 80060A7C 00401821 */  addu      $v1, $v0, $zero
/* 3BE80 80060A80 0070102A */  slt       $v0, $v1, $s0
/* 3BE84 80060A84 10400005 */  beqz      $v0, .L80060A9C
/* 3BE88 80060A88 00000000 */   nop
/* 3BE8C 80060A8C 00609021 */  addu      $s2, $v1, $zero
/* 3BE90 80060A90 00002021 */  addu      $a0, $zero, $zero
/* 3BE94 80060A94 0C0197D4 */  jal       osSetThreadPri
/* 3BE98 80060A98 02002821 */   addu     $a1, $s0, $zero
.L80060A9C:
/* 3BE9C 80060A9C 0C01ACD8 */  jal       __osDisableInt
/* 3BEA0 80060AA0 00000000 */   nop
/* 3BEA4 80060AA4 3C11800B */  lui       $s1, %hi(piThread)
/* 3BEA8 80060AA8 2631E6E0 */  addiu     $s1, $s1, %lo(piThread)
/* 3BEAC 80060AAC 02202021 */  addu      $a0, $s1, $zero
/* 3BEB0 80060AB0 00002821 */  addu      $a1, $zero, $zero
/* 3BEB4 80060AB4 3C068006 */  lui       $a2, %hi(__osDevMgrMain)
/* 3BEB8 80060AB8 24C61090 */  addiu     $a2, $a2, %lo(__osDevMgrMain)
/* 3BEBC 80060ABC 24030001 */  addiu     $v1, $zero, 0x1
/* 3BEC0 80060AC0 AE830000 */  sw        $v1, 0x0($s4)
/* 3BEC4 80060AC4 3C03800B */  lui       $v1, %hi(__osPiAccessQueue)
/* 3BEC8 80060AC8 24634380 */  addiu     $v1, $v1, %lo(__osPiAccessQueue)
/* 3BECC 80060ACC 3C018009 */  lui       $at, %hi(__osPiDevMgr + 0x10)
/* 3BED0 80060AD0 AC233D60 */  sw        $v1, %lo(__osPiDevMgr + 0x10)($at)
/* 3BED4 80060AD4 3C038007 */  lui       $v1, %hi(__osPiRawStartDma)
/* 3BED8 80060AD8 2463B480 */  addiu     $v1, $v1, %lo(__osPiRawStartDma)
/* 3BEDC 80060ADC 3C018009 */  lui       $at, %hi(__osPiDevMgr + 0x14)
/* 3BEE0 80060AE0 AC233D64 */  sw        $v1, %lo(__osPiDevMgr + 0x14)($at)
/* 3BEE4 80060AE4 3C038006 */  lui       $v1, %hi(__osEPiRawStartDma)
/* 3BEE8 80060AE8 24630B70 */  addiu     $v1, $v1, %lo(__osEPiRawStartDma)
/* 3BEEC 80060AEC 3C018009 */  lui       $at, %hi(__osPiDevMgr + 0x18)
/* 3BEF0 80060AF0 AC233D68 */  sw        $v1, %lo(__osPiDevMgr + 0x18)($at)
/* 3BEF4 80060AF4 3C03800B */  lui       $v1, %hi(piEventQueue)
/* 3BEF8 80060AF8 2463F890 */  addiu     $v1, $v1, %lo(piEventQueue)
/* 3BEFC 80060AFC AFB00014 */  sw        $s0, 0x14($sp)
/* 3BF00 80060B00 00408021 */  addu      $s0, $v0, $zero
/* 3BF04 80060B04 02803821 */  addu      $a3, $s4, $zero
/* 3BF08 80060B08 3C018009 */  lui       $at, %hi(__osPiDevMgr + 0x4)
/* 3BF0C 80060B0C AC313D54 */  sw        $s1, %lo(__osPiDevMgr + 0x4)($at)
/* 3BF10 80060B10 3C018009 */  lui       $at, %hi(__osPiDevMgr + 0x8)
/* 3BF14 80060B14 AC353D58 */  sw        $s5, %lo(__osPiDevMgr + 0x8)($at)
/* 3BF18 80060B18 3C018009 */  lui       $at, %hi(__osPiDevMgr + 0xC)
/* 3BF1C 80060B1C AC333D5C */  sw        $s3, %lo(__osPiDevMgr + 0xC)($at)
/* 3BF20 80060B20 0C019798 */  jal       osCreateThread
/* 3BF24 80060B24 AFA30010 */   sw       $v1, 0x10($sp)
/* 3BF28 80060B28 0C019808 */  jal       osStartThread
/* 3BF2C 80060B2C 02202021 */   addu     $a0, $s1, $zero
/* 3BF30 80060B30 0C01ACF4 */  jal       __osRestoreInt
/* 3BF34 80060B34 02002021 */   addu     $a0, $s0, $zero
/* 3BF38 80060B38 2402FFFF */  addiu     $v0, $zero, -0x1
/* 3BF3C 80060B3C 12420003 */  beq       $s2, $v0, .L80060B4C
/* 3BF40 80060B40 00002021 */   addu     $a0, $zero, $zero
/* 3BF44 80060B44 0C0197D4 */  jal       osSetThreadPri
/* 3BF48 80060B48 02402821 */   addu     $a1, $s2, $zero
.L80060B4C:
/* 3BF4C 80060B4C 8FBF0030 */  lw        $ra, 0x30($sp)
/* 3BF50 80060B50 8FB5002C */  lw        $s5, 0x2C($sp)
/* 3BF54 80060B54 8FB40028 */  lw        $s4, 0x28($sp)
/* 3BF58 80060B58 8FB30024 */  lw        $s3, 0x24($sp)
/* 3BF5C 80060B5C 8FB20020 */  lw        $s2, 0x20($sp)
/* 3BF60 80060B60 8FB1001C */  lw        $s1, 0x1C($sp)
/* 3BF64 80060B64 8FB00018 */  lw        $s0, 0x18($sp)
/* 3BF68 80060B68 03E00008 */  jr        $ra
/* 3BF6C 80060B6C 27BD0038 */   addiu    $sp, $sp, 0x38

### DECOMPILED C INSTRUCTIONS:

void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgCnt) {
    u32 savedMask;
    OSPri oldPri;
    OSPri myPri;

    if (!__osPiDevMgr.active) {
        osCreateMesgQueue(cmdQ, cmdBuf, cmdMsgCnt);
        osCreateMesgQueue(&piEventQueue, (OSMesg*)piEventBuf, 1);

        if (!__osPiAccessQueueEnabled) {
            __osPiCreateAccessQueue();
        }

        osSetEventMesg(OS_EVENT_PI, &piEventQueue, (OSMesg)0x22222222);
        oldPri = -1;
        myPri = osGetThreadPri(NULL);

        if (myPri < pri) {
            oldPri = myPri;
            osSetThreadPri(NULL, pri);
        }

        savedMask = __osDisableInt();
        __osPiDevMgr.active = 1;
        __osPiDevMgr.thread = &piThread;
        __osPiDevMgr.cmdQueue = cmdQ;
        __osPiDevMgr.evtQueue = &piEventQueue;
        __osPiDevMgr.acsQueue = &__osPiAccessQueue;
        __osPiDevMgr.dma = __osPiRawStartDma;
        __osPiDevMgr.edma = __osEPiRawStartDma;
        osCreateThread(&piThread, 0, __osDevMgrMain, &__osPiDevMgr, &piThreadStack[OS_PIM_STACKSIZE], pri);
        osStartThread(&piThread);
        __osRestoreInt(savedMask);

        if (oldPri != -1) {
            osSetThreadPri(NULL, oldPri);
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel draw_digit
/* BDBC0 801274C0 3C0A800A */  lui       $t2, %hi(gMainGfxPos)
/* BDBC4 801274C4 254AA66C */  addiu     $t2, $t2, %lo(gMainGfxPos)
/* BDBC8 801274C8 3C028015 */  lui       $v0, %hi(gMsgNumbers)
/* BDBCC 801274CC 2442C340 */  addiu     $v0, $v0, %lo(gMsgNumbers)
/* BDBD0 801274D0 00054880 */  sll       $t1, $a1, 2
/* BDBD4 801274D4 01254821 */  addu      $t1, $t1, $a1
/* BDBD8 801274D8 00094880 */  sll       $t1, $t1, 2
/* BDBDC 801274DC 01224821 */  addu      $t1, $t1, $v0
/* BDBE0 801274E0 8D480000 */  lw        $t0, 0x0($t2)
/* BDBE4 801274E4 3C050700 */  lui       $a1, (0x7000000 >> 16)
/* BDBE8 801274E8 0100582D */  daddu     $t3, $t0, $zero
/* BDBEC 801274EC 25080008 */  addiu     $t0, $t0, 0x8
/* BDBF0 801274F0 AD480000 */  sw        $t0, 0x0($t2)
/* BDBF4 801274F4 91220005 */  lbu       $v0, 0x5($t1)
/* BDBF8 801274F8 25030008 */  addiu     $v1, $t0, 0x8
/* BDBFC 801274FC AD640004 */  sw        $a0, 0x4($t3)
/* BDC00 80127500 AD430000 */  sw        $v1, 0x0($t2)
/* BDC04 80127504 3C03FD48 */  lui       $v1, (0xFD480000 >> 16)
/* BDC08 80127508 00021042 */  srl       $v0, $v0, 1
/* BDC0C 8012750C 2442FFFF */  addiu     $v0, $v0, -0x1
/* BDC10 80127510 30420FFF */  andi      $v0, $v0, 0xFFF
/* BDC14 80127514 00431025 */  or        $v0, $v0, $v1
/* BDC18 80127518 AD620000 */  sw        $v0, 0x0($t3)
/* BDC1C 8012751C 91220005 */  lbu       $v0, 0x5($t1)
/* BDC20 80127520 25030010 */  addiu     $v1, $t0, 0x10
/* BDC24 80127524 AD050004 */  sw        $a1, 0x4($t0)
/* BDC28 80127528 AD430000 */  sw        $v1, 0x0($t2)
/* BDC2C 8012752C 3C03E600 */  lui       $v1, (0xE6000000 >> 16)
/* BDC30 80127530 AD030008 */  sw        $v1, 0x8($t0)
/* BDC34 80127534 25030018 */  addiu     $v1, $t0, 0x18
/* BDC38 80127538 AD00000C */  sw        $zero, 0xC($t0)
/* BDC3C 8012753C AD430000 */  sw        $v1, 0x0($t2)
/* BDC40 80127540 3C03F400 */  lui       $v1, (0xF4000000 >> 16)
/* BDC44 80127544 AD030010 */  sw        $v1, 0x10($t0)
/* BDC48 80127548 3C03F548 */  lui       $v1, (0xF5480000 >> 16)
/* BDC4C 8012754C 00021042 */  srl       $v0, $v0, 1
/* BDC50 80127550 24420007 */  addiu     $v0, $v0, 0x7
/* BDC54 80127554 000210C2 */  srl       $v0, $v0, 3
/* BDC58 80127558 00021240 */  sll       $v0, $v0, 9
/* BDC5C 8012755C 00431025 */  or        $v0, $v0, $v1
/* BDC60 80127560 AD020000 */  sw        $v0, 0x0($t0)
/* BDC64 80127564 91220005 */  lbu       $v0, 0x5($t1)
/* BDC68 80127568 91240006 */  lbu       $a0, 0x6($t1)
/* BDC6C 8012756C 25030020 */  addiu     $v1, $t0, 0x20
/* BDC70 80127570 AD430000 */  sw        $v1, 0x0($t2)
/* BDC74 80127574 3C03E700 */  lui       $v1, (0xE7000000 >> 16)
/* BDC78 80127578 AD030018 */  sw        $v1, 0x18($t0)
/* BDC7C 8012757C 25030028 */  addiu     $v1, $t0, 0x28
/* BDC80 80127580 AD00001C */  sw        $zero, 0x1C($t0)
/* BDC84 80127584 AD430000 */  sw        $v1, 0x0($t2)
/* BDC88 80127588 25030030 */  addiu     $v1, $t0, 0x30
/* BDC8C 8012758C 2442FFFF */  addiu     $v0, $v0, -0x1
/* BDC90 80127590 00021040 */  sll       $v0, $v0, 1
/* BDC94 80127594 30420FFF */  andi      $v0, $v0, 0xFFF
/* BDC98 80127598 00021300 */  sll       $v0, $v0, 12
/* BDC9C 8012759C 2484FFFF */  addiu     $a0, $a0, -0x1
/* BDCA0 801275A0 00042080 */  sll       $a0, $a0, 2
/* BDCA4 801275A4 30840FFF */  andi      $a0, $a0, 0xFFF
/* BDCA8 801275A8 00852025 */  or        $a0, $a0, $a1
/* BDCAC 801275AC 00441025 */  or        $v0, $v0, $a0
/* BDCB0 801275B0 AD020014 */  sw        $v0, 0x14($t0)
/* BDCB4 801275B4 91220005 */  lbu       $v0, 0x5($t1)
/* BDCB8 801275B8 3C050400 */  lui       $a1, (0x4000400 >> 16)
/* BDCBC 801275BC AD000024 */  sw        $zero, 0x24($t0)
/* BDCC0 801275C0 AD430000 */  sw        $v1, 0x0($t2)
/* BDCC4 801275C4 3C03F200 */  lui       $v1, (0xF2000000 >> 16)
/* BDCC8 801275C8 AD030028 */  sw        $v1, 0x28($t0)
/* BDCCC 801275CC 3C03F540 */  lui       $v1, (0xF5400000 >> 16)
/* BDCD0 801275D0 25040038 */  addiu     $a0, $t0, 0x38
/* BDCD4 801275D4 00021042 */  srl       $v0, $v0, 1
/* BDCD8 801275D8 24420007 */  addiu     $v0, $v0, 0x7
/* BDCDC 801275DC 000210C2 */  srl       $v0, $v0, 3
/* BDCE0 801275E0 00021240 */  sll       $v0, $v0, 9
/* BDCE4 801275E4 00431025 */  or        $v0, $v0, $v1
/* BDCE8 801275E8 AD020020 */  sw        $v0, 0x20($t0)
/* BDCEC 801275EC 91220005 */  lbu       $v0, 0x5($t1)
/* BDCF0 801275F0 91230006 */  lbu       $v1, 0x6($t1)
/* BDCF4 801275F4 34A50400 */  ori       $a1, $a1, (0x4000400 & 0xFFFF)
/* BDCF8 801275F8 AD440000 */  sw        $a0, 0x0($t2)
/* BDCFC 801275FC 3C04E400 */  lui       $a0, (0xE4000000 >> 16)
/* BDD00 80127600 2442FFFF */  addiu     $v0, $v0, -0x1
/* BDD04 80127604 00021080 */  sll       $v0, $v0, 2
/* BDD08 80127608 30420FFF */  andi      $v0, $v0, 0xFFF
/* BDD0C 8012760C 00021300 */  sll       $v0, $v0, 12
/* BDD10 80127610 2463FFFF */  addiu     $v1, $v1, -0x1
/* BDD14 80127614 00031880 */  sll       $v1, $v1, 2
/* BDD18 80127618 30630FFF */  andi      $v1, $v1, 0xFFF
/* BDD1C 8012761C 00431025 */  or        $v0, $v0, $v1
/* BDD20 80127620 AD02002C */  sw        $v0, 0x2C($t0)
/* BDD24 80127624 91230005 */  lbu       $v1, 0x5($t1)
/* BDD28 80127628 91220006 */  lbu       $v0, 0x6($t1)
/* BDD2C 8012762C 00C31821 */  addu      $v1, $a2, $v1
/* BDD30 80127630 00031880 */  sll       $v1, $v1, 2
/* BDD34 80127634 30630FFF */  andi      $v1, $v1, 0xFFF
/* BDD38 80127638 00031B00 */  sll       $v1, $v1, 12
/* BDD3C 8012763C 00E21021 */  addu      $v0, $a3, $v0
/* BDD40 80127640 00021080 */  sll       $v0, $v0, 2
/* BDD44 80127644 30420FFF */  andi      $v0, $v0, 0xFFF
/* BDD48 80127648 00441025 */  or        $v0, $v0, $a0
/* BDD4C 8012764C 00621825 */  or        $v1, $v1, $v0
/* BDD50 80127650 00063080 */  sll       $a2, $a2, 2
/* BDD54 80127654 30C60FFF */  andi      $a2, $a2, 0xFFF
/* BDD58 80127658 00063300 */  sll       $a2, $a2, 12
/* BDD5C 8012765C 00073880 */  sll       $a3, $a3, 2
/* BDD60 80127660 30E70FFF */  andi      $a3, $a3, 0xFFF
/* BDD64 80127664 00C73025 */  or        $a2, $a2, $a3
/* BDD68 80127668 25020040 */  addiu     $v0, $t0, 0x40
/* BDD6C 8012766C AD030030 */  sw        $v1, 0x30($t0)
/* BDD70 80127670 AD060034 */  sw        $a2, 0x34($t0)
/* BDD74 80127674 AD420000 */  sw        $v0, 0x0($t2)
/* BDD78 80127678 3C02E100 */  lui       $v0, (0xE1000000 >> 16)
/* BDD7C 8012767C AD020038 */  sw        $v0, 0x38($t0)
/* BDD80 80127680 25020048 */  addiu     $v0, $t0, 0x48
/* BDD84 80127684 AD00003C */  sw        $zero, 0x3C($t0)
/* BDD88 80127688 AD420000 */  sw        $v0, 0x0($t2)
/* BDD8C 8012768C 3C02F100 */  lui       $v0, (0xF1000000 >> 16)
/* BDD90 80127690 AD020040 */  sw        $v0, 0x40($t0)
/* BDD94 80127694 03E00008 */  jr        $ra
/* BDD98 80127698 AD050044 */   sw       $a1, 0x44($t0)

### DECOMPILED C INSTRUCTIONS:

void draw_digit(IMG_PTR img, s32 charset, s32 posX, s32 posY) {
    MessageNumber* num = &gMsgNumbers[charset];

    gDPLoadTextureTile_4b(gMainGfxPos++,
        img, G_IM_FMT_CI,
        num->texWidth , num->texHeight,
        0, 0,
        num->texWidth - 1, num->texHeight - 1,
        0,
        G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
        G_TX_NOMASK, G_TX_NOMASK,
        G_TX_NOLOD, G_TX_NOLOD);
    gSPTextureRectangle(gMainGfxPos++,
        4 * posX, 4 * posY,
        4 * (posX + num->texWidth), 4 * (posY + num->texHeight),
        G_TX_RENDERTILE,
        0, 0,
        1 << 10, 1 << 10);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel osPfsFileState
/* 44020 80068C20 27BDFEB0 */  addiu     $sp, $sp, -0x150
/* 44024 80068C24 AFB10134 */  sw        $s1, 0x134($sp)
/* 44028 80068C28 00808821 */  addu      $s1, $a0, $zero
/* 4402C 80068C2C AFB00130 */  sw        $s0, 0x130($sp)
/* 44030 80068C30 00A08021 */  addu      $s0, $a1, $zero
/* 44034 80068C34 AFBF0148 */  sw        $ra, 0x148($sp)
/* 44038 80068C38 AFB50144 */  sw        $s5, 0x144($sp)
/* 4403C 80068C3C AFB40140 */  sw        $s4, 0x140($sp)
/* 44040 80068C40 AFB3013C */  sw        $s3, 0x13C($sp)
/* 44044 80068C44 AFB20138 */  sw        $s2, 0x138($sp)
/* 44048 80068C48 8E220050 */  lw        $v0, 0x50($s1)
/* 4404C 80068C4C 00101FC2 */  srl       $v1, $s0, 31
/* 44050 80068C50 0202102A */  slt       $v0, $s0, $v0
/* 44054 80068C54 38420001 */  xori      $v0, $v0, 0x1
/* 44058 80068C58 00431025 */  or        $v0, $v0, $v1
/* 4405C 80068C5C 1440001F */  bnez      $v0, .L80068CDC
/* 44060 80068C60 00C0A021 */   addu     $s4, $a2, $zero
/* 44064 80068C64 8E220000 */  lw        $v0, 0x0($s1)
/* 44068 80068C68 30420001 */  andi      $v0, $v0, 0x1
/* 4406C 80068C6C 10400048 */  beqz      $v0, .L80068D90
/* 44070 80068C70 24020005 */   addiu    $v0, $zero, 0x5
/* 44074 80068C74 0C01A775 */  jal       __osCheckId
/* 44078 80068C78 02202021 */   addu     $a0, $s1, $zero
/* 4407C 80068C7C 14400044 */  bnez      $v0, .L80068D90
/* 44080 80068C80 00000000 */   nop
/* 44084 80068C84 92220065 */  lbu       $v0, 0x65($s1)
/* 44088 80068C88 10400005 */  beqz      $v0, .L80068CA0
/* 4408C 80068C8C 02202021 */   addu     $a0, $s1, $zero
/* 44090 80068C90 0C01A5B4 */  jal       __osPfsSelectBank
/* 44094 80068C94 00002821 */   addu     $a1, $zero, $zero
/* 44098 80068C98 1440003D */  bnez      $v0, .L80068D90
/* 4409C 80068C9C 00000000 */   nop
.L80068CA0:
/* 440A0 80068CA0 8E240004 */  lw        $a0, 0x4($s1)
/* 440A4 80068CA4 8E26005C */  lw        $a2, 0x5C($s1)
/* 440A8 80068CA8 8E250008 */  lw        $a1, 0x8($s1)
/* 440AC 80068CAC 27A70110 */  addiu     $a3, $sp, 0x110
/* 440B0 80068CB0 00D03021 */  addu      $a2, $a2, $s0
/* 440B4 80068CB4 0C01A874 */  jal       __osContRamRead
/* 440B8 80068CB8 30C6FFFF */   andi     $a2, $a2, 0xFFFF
/* 440BC 80068CBC 14400034 */  bnez      $v0, .L80068D90
/* 440C0 80068CC0 00000000 */   nop
/* 440C4 80068CC4 97A20114 */  lhu       $v0, 0x114($sp)
/* 440C8 80068CC8 10400031 */  beqz      $v0, .L80068D90
/* 440CC 80068CCC 24020005 */   addiu    $v0, $zero, 0x5
/* 440D0 80068CD0 8FA20110 */  lw        $v0, 0x110($sp)
/* 440D4 80068CD4 14400003 */  bnez      $v0, .L80068CE4
/* 440D8 80068CD8 00009821 */   addu     $s3, $zero, $zero
.L80068CDC:
/* 440DC 80068CDC 0801A364 */  j         .L80068D90
/* 440E0 80068CE0 24020005 */   addiu    $v0, $zero, 0x5
.L80068CE4:
/* 440E4 80068CE4 97B00116 */  lhu       $s0, 0x116($sp)
/* 440E8 80068CE8 241200FF */  addiu     $s2, $zero, 0xFF
/* 440EC 80068CEC 27B50010 */  addiu     $s5, $sp, 0x10
.L80068CF0:
/* 440F0 80068CF0 8E220060 */  lw        $v0, 0x60($s1)
/* 440F4 80068CF4 3203FFFF */  andi      $v1, $s0, 0xFFFF
/* 440F8 80068CF8 0062102A */  slt       $v0, $v1, $v0
/* 440FC 80068CFC 14400010 */  bnez      $v0, .L80068D40
/* 44100 80068D00 00031202 */   srl      $v0, $v1, 8
/* 44104 80068D04 304700FF */  andi      $a3, $v0, 0xFF
/* 44108 80068D08 10F20007 */  beq       $a3, $s2, .L80068D28
/* 4410C 80068D0C 02202021 */   addu     $a0, $s1, $zero
/* 44110 80068D10 00409021 */  addu      $s2, $v0, $zero
/* 44114 80068D14 27A50010 */  addiu     $a1, $sp, 0x10
/* 44118 80068D18 0C01A7A3 */  jal       __osPfsRWInode
/* 4411C 80068D1C 00003021 */   addu     $a2, $zero, $zero
/* 44120 80068D20 1440001B */  bnez      $v0, .L80068D90
/* 44124 80068D24 00000000 */   nop
.L80068D28:
/* 44128 80068D28 320200FF */  andi      $v0, $s0, 0xFF
/* 4412C 80068D2C 00021040 */  sll       $v0, $v0, 1
/* 44130 80068D30 00551021 */  addu      $v0, $v0, $s5
/* 44134 80068D34 94500000 */  lhu       $s0, 0x0($v0)
/* 44138 80068D38 0801A33C */  j         .L80068CF0
/* 4413C 80068D3C 26730001 */   addiu    $s3, $s3, 0x1
.L80068D40:
/* 44140 80068D40 24020001 */  addiu     $v0, $zero, 0x1
/* 44144 80068D44 14620012 */  bne       $v1, $v0, .L80068D90
/* 44148 80068D48 24020003 */   addiu    $v0, $zero, 0x3
/* 4414C 80068D4C 00131200 */  sll       $v0, $s3, 8
/* 44150 80068D50 AE820000 */  sw        $v0, 0x0($s4)
/* 44154 80068D54 97A20114 */  lhu       $v0, 0x114($sp)
/* 44158 80068D58 27A40120 */  addiu     $a0, $sp, 0x120
/* 4415C 80068D5C A6820008 */  sh        $v0, 0x8($s4)
/* 44160 80068D60 8FA20110 */  lw        $v0, 0x110($sp)
/* 44164 80068D64 2685000E */  addiu     $a1, $s4, 0xE
/* 44168 80068D68 24060010 */  addiu     $a2, $zero, 0x10
/* 4416C 80068D6C 0C019194 */  jal       bcopy
/* 44170 80068D70 AE820004 */   sw       $v0, 0x4($s4)
/* 44174 80068D74 27A4011C */  addiu     $a0, $sp, 0x11C
/* 44178 80068D78 2685000A */  addiu     $a1, $s4, 0xA
/* 4417C 80068D7C 0C019194 */  jal       bcopy
/* 44180 80068D80 24060004 */   addiu    $a2, $zero, 0x4
/* 44184 80068D84 8E240004 */  lw        $a0, 0x4($s1)
/* 44188 80068D88 0C01A530 */  jal       __osPfsGetStatus
/* 4418C 80068D8C 8E250008 */   lw       $a1, 0x8($s1)
.L80068D90:
/* 44190 80068D90 8FBF0148 */  lw        $ra, 0x148($sp)
/* 44194 80068D94 8FB50144 */  lw        $s5, 0x144($sp)
/* 44198 80068D98 8FB40140 */  lw        $s4, 0x140($sp)
/* 4419C 80068D9C 8FB3013C */  lw        $s3, 0x13C($sp)
/* 441A0 80068DA0 8FB20138 */  lw        $s2, 0x138($sp)
/* 441A4 80068DA4 8FB10134 */  lw        $s1, 0x134($sp)
/* 441A8 80068DA8 8FB00130 */  lw        $s0, 0x130($sp)
/* 441AC 80068DAC 03E00008 */  jr        $ra
/* 441B0 80068DB0 27BD0150 */   addiu    $sp, $sp, 0x150
/* 441B4 80068DB4 00000000 */  nop
/* 441B8 80068DB8 00000000 */  nop
/* 441BC 80068DBC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

s32 osPfsFileState(OSPfs* pfs, s32 fileNo, OSPfsState* state) {
    s32 ret;
    s32 pages;
    __OSInode inode;
    __OSDir dir;
    __OSInodeUnit page;
    u8 bank;

    if (fileNo >= pfs->dir_size || fileNo < 0) {
        return PFS_ERR_INVALID;
    }
    if (!(pfs->status & PFS_INITIALIZED)) {
        return PFS_ERR_INVALID;
    }
    if ((ret = __osCheckId(pfs)) != 0) {
        return ret;
    }
    if (pfs->activebank != 0 && (ret = __osPfsSelectBank(pfs, 0)) != 0) {
        return ret;
    }
    if ((ret = __osContRamRead(pfs->queue, pfs->channel, pfs->dir_table + fileNo, (u8*)&dir)) != 0) {
        return ret;
    }
    if (dir.company_code == 0 || dir.game_code == 0) {
        return PFS_ERR_INVALID;
    }

    page = dir.start_page;
    pages = 0;
    bank = 0xFF;
    while (TRUE) {
        if (page.ipage < pfs->inode_start_page) {
            break;
        }
        if (page.inode_t.bank != bank) {
            bank = page.inode_t.bank;
            if ((ret = __osPfsRWInode(pfs, &inode, PFS_READ, bank)) != 0) {
                return ret;
            }
        }
        pages++;
        page = inode.inode_page[page.inode_t.page];
    }
    if (page.ipage != PFS_EOF) {
        return PFS_ERR_INCONSISTENT;
    }

    state->file_size = pages * PFS_ONE_PAGE * BLOCKSIZE;
    state->company_code = dir.company_code;
    state->game_code = dir.game_code;
    bcopy(&dir.game_name, state->game_name, PFS_FILE_NAME_LEN);
    bcopy(&dir.ext_name, state->ext_name, PFS_FILE_EXT_LEN);

    return __osPfsGetStatus(pfs->queue, pfs->channel);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel hud_element_set_scale
/* DB320 80144C20 2402F7FF */  addiu     $v0, $zero, -0x801
/* DB324 80144C24 00822024 */  and       $a0, $a0, $v0
/* DB328 80144C28 00042080 */  sll       $a0, $a0, 2
/* DB32C 80144C2C 3C028015 */  lui       $v0, %hi(gHudElements)
/* DB330 80144C30 8C427960 */  lw        $v0, %lo(gHudElements)($v0)
/* DB334 80144C34 44853000 */  mtc1      $a1, $f6
/* DB338 80144C38 00822021 */  addu      $a0, $a0, $v0
/* DB33C 80144C3C 8C850000 */  lw        $a1, 0x0($a0)
/* DB340 80144C40 8CA20000 */  lw        $v0, 0x0($a1)
/* DB344 80144C44 3C030010 */  lui       $v1, (0x100000 >> 16)
/* DB348 80144C48 00431024 */  and       $v0, $v0, $v1
/* DB34C 80144C4C 14400012 */  bnez      $v0, .L80144C98
/* DB350 80144C50 E4A60030 */   swc1     $f6, 0x30($a1)
/* DB354 80144C54 80A30046 */  lb        $v1, 0x46($a1)
/* DB358 80144C58 3C048015 */  lui       $a0, %hi(gHudElementSizes)
/* DB35C 80144C5C 2484EFCC */  addiu     $a0, $a0, %lo(gHudElementSizes)
/* DB360 80144C60 00031040 */  sll       $v0, $v1, 1
/* DB364 80144C64 00431021 */  addu      $v0, $v0, $v1
/* DB368 80144C68 00021040 */  sll       $v0, $v0, 1
/* DB36C 80144C6C 00441021 */  addu      $v0, $v0, $a0
/* DB370 80144C70 84480000 */  lh        $t0, 0x0($v0)
/* DB374 80144C74 80A30045 */  lb        $v1, 0x45($a1)
/* DB378 80144C78 84490002 */  lh        $t1, 0x2($v0)
/* DB37C 80144C7C 00031040 */  sll       $v0, $v1, 1
/* DB380 80144C80 00431021 */  addu      $v0, $v0, $v1
/* DB384 80144C84 00021040 */  sll       $v0, $v0, 1
/* DB388 80144C88 00441021 */  addu      $v0, $v0, $a0
/* DB38C 80144C8C 84440000 */  lh        $a0, 0x0($v0)
/* DB390 80144C90 0805132A */  j         .L80144CA8
/* DB394 80144C94 84460002 */   lh       $a2, 0x2($v0)
.L80144C98:
/* DB398 80144C98 90A8004E */  lbu       $t0, 0x4E($a1)
/* DB39C 80144C9C 90A9004F */  lbu       $t1, 0x4F($a1)
/* DB3A0 80144CA0 90A40050 */  lbu       $a0, 0x50($a1)
/* DB3A4 80144CA4 90A60051 */  lbu       $a2, 0x51($a1)
.L80144CA8:
/* DB3A8 80144CA8 44840000 */  mtc1      $a0, $f0
/* DB3AC 80144CAC 00000000 */  nop
/* DB3B0 80144CB0 46800020 */  cvt.s.w   $f0, $f0
/* DB3B4 80144CB4 46060002 */  mul.s     $f0, $f0, $f6
/* DB3B8 80144CB8 00000000 */  nop
/* DB3BC 80144CBC 3C014F00 */  lui       $at, (0x4F000000 >> 16)
/* DB3C0 80144CC0 44811000 */  mtc1      $at, $f2
/* DB3C4 80144CC4 00000000 */  nop
/* DB3C8 80144CC8 4600103E */  c.le.s    $f2, $f0
/* DB3CC 80144CCC 00000000 */  nop
/* DB3D0 80144CD0 45010005 */  bc1t      .L80144CE8
/* DB3D4 80144CD4 24A70048 */   addiu    $a3, $a1, 0x48
/* DB3D8 80144CD8 4600020D */  trunc.w.s $f8, $f0
/* DB3DC 80144CDC 44034000 */  mfc1      $v1, $f8
/* DB3E0 80144CE0 08051340 */  j         .L80144D00
/* DB3E4 80144CE4 00000000 */   nop
.L80144CE8:
/* DB3E8 80144CE8 46020001 */  sub.s     $f0, $f0, $f2
/* DB3EC 80144CEC 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* DB3F0 80144CF0 4600020D */  trunc.w.s $f8, $f0
/* DB3F4 80144CF4 44034000 */  mfc1      $v1, $f8
/* DB3F8 80144CF8 00000000 */  nop
/* DB3FC 80144CFC 00621825 */  or        $v1, $v1, $v0
.L80144D00:
/* DB400 80144D00 44860000 */  mtc1      $a2, $f0
/* DB404 80144D04 00000000 */  nop
/* DB408 80144D08 46800020 */  cvt.s.w   $f0, $f0
/* DB40C 80144D0C 46060002 */  mul.s     $f0, $f0, $f6
/* DB410 80144D10 00000000 */  nop
/* DB414 80144D14 3C014F00 */  lui       $at, (0x4F000000 >> 16)
/* DB418 80144D18 44811000 */  mtc1      $at, $f2
/* DB41C 80144D1C A0E30000 */  sb        $v1, 0x0($a3)
/* DB420 80144D20 4600103E */  c.le.s    $f2, $f0
/* DB424 80144D24 00000000 */  nop
/* DB428 80144D28 45010005 */  bc1t      .L80144D40
/* DB42C 80144D2C 24A70049 */   addiu    $a3, $a1, 0x49
/* DB430 80144D30 4600020D */  trunc.w.s $f8, $f0
/* DB434 80144D34 44034000 */  mfc1      $v1, $f8
/* DB438 80144D38 08051356 */  j         .L80144D58
/* DB43C 80144D3C 00000000 */   nop
.L80144D40:
/* DB440 80144D40 46020001 */  sub.s     $f0, $f0, $f2
/* DB444 80144D44 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* DB448 80144D48 4600020D */  trunc.w.s $f8, $f0
/* DB44C 80144D4C 44034000 */  mfc1      $v1, $f8
/* DB450 80144D50 00000000 */  nop
/* DB454 80144D54 00621825 */  or        $v1, $v1, $v0
.L80144D58:
/* DB458 80144D58 44842000 */  mtc1      $a0, $f4
/* DB45C 80144D5C 00000000 */  nop
/* DB460 80144D60 46802120 */  cvt.s.w   $f4, $f4
/* DB464 80144D64 44880000 */  mtc1      $t0, $f0
/* DB468 80144D68 00000000 */  nop
/* DB46C 80144D6C 46800020 */  cvt.s.w   $f0, $f0
/* DB470 80144D70 46002103 */  div.s     $f4, $f4, $f0
/* DB474 80144D74 46062102 */  mul.s     $f4, $f4, $f6
/* DB478 80144D78 00000000 */  nop
/* DB47C 80144D7C 44861000 */  mtc1      $a2, $f2
/* DB480 80144D80 00000000 */  nop
/* DB484 80144D84 468010A0 */  cvt.s.w   $f2, $f2
/* DB488 80144D88 44890000 */  mtc1      $t1, $f0
/* DB48C 80144D8C 00000000 */  nop
/* DB490 80144D90 46800020 */  cvt.s.w   $f0, $f0
/* DB494 80144D94 46001083 */  div.s     $f2, $f2, $f0
/* DB498 80144D98 46061082 */  mul.s     $f2, $f2, $f6
/* DB49C 80144D9C 00000000 */  nop
/* DB4A0 80144DA0 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* DB4A4 80144DA4 44810000 */  mtc1      $at, $f0
/* DB4A8 80144DA8 3C014480 */  lui       $at, (0x44800000 >> 16)
/* DB4AC 80144DAC 44813000 */  mtc1      $at, $f6
/* DB4B0 80144DB0 46040103 */  div.s     $f4, $f0, $f4
/* DB4B4 80144DB4 46062102 */  mul.s     $f4, $f4, $f6
/* DB4B8 80144DB8 00000000 */  nop
/* DB4BC 80144DBC A0E30000 */  sb        $v1, 0x0($a3)
/* DB4C0 80144DC0 2403FEFF */  addiu     $v1, $zero, -0x101
/* DB4C4 80144DC4 8CA20000 */  lw        $v0, 0x0($a1)
/* DB4C8 80144DC8 46020083 */  div.s     $f2, $f0, $f2
/* DB4CC 80144DCC 46061082 */  mul.s     $f2, $f2, $f6
/* DB4D0 80144DD0 00000000 */  nop
/* DB4D4 80144DD4 00431024 */  and       $v0, $v0, $v1
/* DB4D8 80144DD8 34420810 */  ori       $v0, $v0, 0x810
/* DB4DC 80144DDC ACA20000 */  sw        $v0, 0x0($a1)
/* DB4E0 80144DE0 4600220D */  trunc.w.s $f8, $f4
/* DB4E4 80144DE4 E4A80034 */  swc1      $f8, 0x34($a1)
/* DB4E8 80144DE8 4600120D */  trunc.w.s $f8, $f2
/* DB4EC 80144DEC 03E00008 */  jr        $ra
/* DB4F0 80144DF0 E4A80038 */   swc1     $f8, 0x38($a1)

### DECOMPILED C INSTRUCTIONS:

void hud_element_set_scale(s32 index, f32 scale) {
    HudElement* elem = (*gHudElements)[index & ~HUD_ELEMENT_BATTLE_ID_MASK];
    s32 drawSizeX;
    s32 drawSizeY;
    s32 imgSizeX;
    s32 imgSizeY;
    f32 xScaled, yScaled;

    elem->uniformScale = scale;
    if (!(elem->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
        imgSizeX = gHudElementSizes[elem->tileSizePreset].width;
        imgSizeY = gHudElementSizes[elem->tileSizePreset].height;
        drawSizeX = gHudElementSizes[elem->drawSizePreset].width;
        drawSizeY = gHudElementSizes[elem->drawSizePreset].height;
    } else {
        imgSizeX = elem->customImageSize.x;
        imgSizeY = elem->customImageSize.y;
        drawSizeX = elem->customDrawSize.x;
        drawSizeY = elem->customDrawSize.y;
    }
    elem->sizeX = drawSizeX * scale;
    elem->sizeY = drawSizeY * scale;
    elem->flags &= ~HUD_ELEMENT_FLAG_FIXEDSCALE;
    elem->flags |= HUD_ELEMENT_FLAG_REPEATED | HUD_ELEMENT_FLAG_SCALED;

    xScaled = ((f32) drawSizeX / (f32) imgSizeX) * scale;
    yScaled = ((f32) drawSizeY / (f32) imgSizeY) * scale;

    xScaled = 1.0f / xScaled;
    yScaled = 1.0f / yScaled;

    elem->widthScale = X10(xScaled);
    elem->heightScale = X10(yScaled);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel firework_rocket_main
/* 3E43A0 E010A000 27BDFFB0 */  addiu     $sp, $sp, -0x50
/* 3E43A4 E010A004 F7B40038 */  sdc1      $f20, 0x38($sp)
/* 3E43A8 E010A008 4485A000 */  mtc1      $a1, $f20
/* 3E43AC E010A00C F7B60040 */  sdc1      $f22, 0x40($sp)
/* 3E43B0 E010A010 4486B000 */  mtc1      $a2, $f22
/* 3E43B4 E010A014 AFB20030 */  sw        $s2, 0x30($sp)
/* 3E43B8 E010A018 0080902D */  daddu     $s2, $a0, $zero
/* 3E43BC E010A01C F7B80048 */  sdc1      $f24, 0x48($sp)
/* 3E43C0 E010A020 4487C000 */  mtc1      $a3, $f24
/* 3E43C4 E010A024 27A40010 */  addiu     $a0, $sp, 0x10
/* 3E43C8 E010A028 AFB1002C */  sw        $s1, 0x2C($sp)
/* 3E43CC E010A02C 8FB10070 */  lw        $s1, 0x70($sp)
/* 3E43D0 E010A030 3C02E011 */  lui       $v0, %hi(firework_rocket_init)
/* 3E43D4 E010A034 2442A184 */  addiu     $v0, $v0, %lo(firework_rocket_init)
/* 3E43D8 E010A038 AFA20018 */  sw        $v0, 0x18($sp)
/* 3E43DC E010A03C 3C02E011 */  lui       $v0, %hi(firework_rocket_update)
/* 3E43E0 E010A040 2442A18C */  addiu     $v0, $v0, %lo(firework_rocket_update)
/* 3E43E4 E010A044 AFA2001C */  sw        $v0, 0x1C($sp)
/* 3E43E8 E010A048 3C02E011 */  lui       $v0, %hi(firework_rocket_render)
/* 3E43EC E010A04C 2442A4A0 */  addiu     $v0, $v0, %lo(firework_rocket_render)
/* 3E43F0 E010A050 AFA20020 */  sw        $v0, 0x20($sp)
/* 3E43F4 E010A054 24020077 */  addiu     $v0, $zero, 0x77
/* 3E43F8 E010A058 AFBF0034 */  sw        $ra, 0x34($sp)
/* 3E43FC E010A05C AFB00028 */  sw        $s0, 0x28($sp)
/* 3E4400 E010A060 AFA00010 */  sw        $zero, 0x10($sp)
/* 3E4404 E010A064 AFA00024 */  sw        $zero, 0x24($sp)
/* 3E4408 E010A068 0C080124 */  jal       shim_create_effect_instance
/* 3E440C E010A06C AFA20014 */   sw       $v0, 0x14($sp)
/* 3E4410 E010A070 240400B0 */  addiu     $a0, $zero, 0xB0
/* 3E4414 E010A074 24030001 */  addiu     $v1, $zero, 0x1
/* 3E4418 E010A078 0040802D */  daddu     $s0, $v0, $zero
/* 3E441C E010A07C 0C08012C */  jal       shim_general_heap_malloc
/* 3E4420 E010A080 AE030008 */   sw       $v1, 0x8($s0)
/* 3E4424 E010A084 0040202D */  daddu     $a0, $v0, $zero
/* 3E4428 E010A088 14800003 */  bnez      $a0, .LE010A098
/* 3E442C E010A08C AE02000C */   sw       $v0, 0xC($s0)
.LE010A090:
/* 3E4430 E010A090 08042824 */  j         .LE010A090
/* 3E4434 E010A094 00000000 */   nop
.LE010A098:
/* 3E4438 E010A098 AC920000 */  sw        $s2, 0x0($a0)
/* 3E443C E010A09C 1E200003 */  bgtz      $s1, .LE010A0AC
/* 3E4440 E010A0A0 AC800020 */   sw       $zero, 0x20($a0)
/* 3E4444 E010A0A4 0804282C */  j         .LE010A0B0
/* 3E4448 E010A0A8 240203E8 */   addiu    $v0, $zero, 0x3E8
.LE010A0AC:
/* 3E444C E010A0AC 26220020 */  addiu     $v0, $s1, 0x20
.LE010A0B0:
/* 3E4450 E010A0B0 AC82001C */  sw        $v0, 0x1C($a0)
/* 3E4454 E010A0B4 240300FF */  addiu     $v1, $zero, 0xFF
/* 3E4458 E010A0B8 AC80004C */  sw        $zero, 0x4C($a0)
/* 3E445C E010A0BC AC830030 */  sw        $v1, 0x30($a0)
/* 3E4460 E010A0C0 E4940004 */  swc1      $f20, 0x4($a0)
/* 3E4464 E010A0C4 E4960008 */  swc1      $f22, 0x8($a0)
/* 3E4468 E010A0C8 E498000C */  swc1      $f24, 0xC($a0)
/* 3E446C E010A0CC AC800044 */  sw        $zero, 0x44($a0)
/* 3E4470 E010A0D0 C7A00060 */  lwc1      $f0, 0x60($sp)
/* 3E4474 E010A0D4 3C01447A */  lui       $at, (0x447A0000 >> 16)
/* 3E4478 E010A0D8 44811000 */  mtc1      $at, $f2
/* 3E447C E010A0DC E4800010 */  swc1      $f0, 0x10($a0)
/* 3E4480 E010A0E0 C7A00064 */  lwc1      $f0, 0x64($sp)
/* 3E4484 E010A0E4 0000302D */  daddu     $a2, $zero, $zero
/* 3E4488 E010A0E8 E4800014 */  swc1      $f0, 0x14($a0)
/* 3E448C E010A0EC C7A00068 */  lwc1      $f0, 0x68($sp)
/* 3E4490 E010A0F0 0080282D */  daddu     $a1, $a0, $zero
/* 3E4494 E010A0F4 E4800018 */  swc1      $f0, 0x18($a0)
/* 3E4498 E010A0F8 C7A0006C */  lwc1      $f0, 0x6C($sp)
/* 3E449C E010A0FC 24020064 */  addiu     $v0, $zero, 0x64
/* 3E44A0 E010A100 AC82002C */  sw        $v0, 0x2C($a0)
/* 3E44A4 E010A104 AC820038 */  sw        $v0, 0x38($a0)
/* 3E44A8 E010A108 24020096 */  addiu     $v0, $zero, 0x96
/* 3E44AC E010A10C AC830024 */  sw        $v1, 0x24($a0)
/* 3E44B0 E010A110 AC830028 */  sw        $v1, 0x28($a0)
/* 3E44B4 E010A114 AC830034 */  sw        $v1, 0x34($a0)
/* 3E44B8 E010A118 AC82003C */  sw        $v0, 0x3C($a0)
/* 3E44BC E010A11C AC830040 */  sw        $v1, 0x40($a0)
/* 3E44C0 E010A120 E4800048 */  swc1      $f0, 0x48($a0)
.LE010A124:
/* 3E44C4 E010A124 C4800004 */  lwc1      $f0, 0x4($a0)
/* 3E44C8 E010A128 E4A00050 */  swc1      $f0, 0x50($a1)
/* 3E44CC E010A12C C4800008 */  lwc1      $f0, 0x8($a0)
/* 3E44D0 E010A130 46020001 */  sub.s     $f0, $f0, $f2
/* 3E44D4 E010A134 24C60001 */  addiu     $a2, $a2, 0x1
/* 3E44D8 E010A138 E4A00060 */  swc1      $f0, 0x60($a1)
/* 3E44DC E010A13C C480000C */  lwc1      $f0, 0xC($a0)
/* 3E44E0 E010A140 28C20004 */  slti      $v0, $a2, 0x4
/* 3E44E4 E010A144 ACA00080 */  sw        $zero, 0x80($a1)
/* 3E44E8 E010A148 ACA00090 */  sw        $zero, 0x90($a1)
/* 3E44EC E010A14C ACA000A0 */  sw        $zero, 0xA0($a1)
/* 3E44F0 E010A150 E4A00070 */  swc1      $f0, 0x70($a1)
/* 3E44F4 E010A154 1440FFF3 */  bnez      $v0, .LE010A124
/* 3E44F8 E010A158 24A50004 */   addiu    $a1, $a1, 0x4
/* 3E44FC E010A15C 0200102D */  daddu     $v0, $s0, $zero
/* 3E4500 E010A160 8FBF0034 */  lw        $ra, 0x34($sp)
/* 3E4504 E010A164 8FB20030 */  lw        $s2, 0x30($sp)
/* 3E4508 E010A168 8FB1002C */  lw        $s1, 0x2C($sp)
/* 3E450C E010A16C 8FB00028 */  lw        $s0, 0x28($sp)
/* 3E4510 E010A170 D7B80048 */  ldc1      $f24, 0x48($sp)
/* 3E4514 E010A174 D7B60040 */  ldc1      $f22, 0x40($sp)
/* 3E4518 E010A178 D7B40038 */  ldc1      $f20, 0x38($sp)
/* 3E451C E010A17C 03E00008 */  jr        $ra
/* 3E4520 E010A180 27BD0050 */   addiu    $sp, $sp, 0x50

### DECOMPILED C INSTRUCTIONS:

EffectInstance* firework_rocket_main(s32 variation, f32 centerX, f32 centerY, f32 centerZ, f32 velX, f32 velY, f32 velZ, f32 radius, s32 duration) {
    EffectBlueprint bp;
    EffectInstance* effect;
    FireworkRocketFXData* data;
    s32 numParts = 1;
    s32 i;

    bp.init = firework_rocket_init;
    bp.update = firework_rocket_update;
    bp.renderWorld = firework_rocket_render;
    bp.unk_00 = 0;
    bp.renderUI = NULL;
    bp.effectID = EFFECT_FIREWORK_ROCKET;

    effect = shim_create_effect_instance(&bp);
    effect->numParts = numParts;
    data = effect->data.fireworkRocket = shim_general_heap_malloc(numParts * sizeof(*data));
    ASSERT(effect->data.fireworkRocket != NULL);

    data->variation = variation;
    data->lifeTime = 0;
    if (duration <= 0) {
        data->timeLeft = 1000;
    } else {
        data->timeLeft = duration + 32;
    }
    data->isExploded = FALSE;
    data->minBlurAlpha = 255;
    data->pos.x = centerX;
    data->pos.y = centerY;
    data->pos.z = centerZ;
    data->radius = 0;
    data->velocity.x = velX;
    data->velocity.y = velY;
    data->velocity.z = velZ;
    data->maxRadius = radius;
    data->r = 255;
    data->g = 255;
    data->b = 100;
    data->unk_34 = 255;
    data->unk_38 = 100;
    data->unk_3C = 150;
    data->unk_40 = 255;

    for (i = 0; i < 4; i++) {
        data->rocketX[i] = data->pos.x;
        data->rocketY[i] = data->pos.y - 1000.0f;
        data->rocketZ[i] = data->pos.z;
        data->rocketVelocityX[i] = 0;
        data->rocketVelocityY[i] = 0;
        data->rocketVelocityZ[i] = 0;
    }

    return effect;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel guPosition
/* 3F4E8 800640E8 3C018009 */  lui       $at, %hi(dtor)
/* 3F4EC 800640EC C4203DC0 */  lwc1      $f0, %lo(dtor)($at)
/* 3F4F0 800640F0 44859000 */  mtc1      $a1, $f18
/* 3F4F4 800640F4 27BDFF70 */  addiu     $sp, $sp, -0x90
/* 3F4F8 800640F8 F7B40060 */  sdc1      $f20, 0x60($sp)
/* 3F4FC 800640FC 46009502 */  mul.s     $f20, $f18, $f0
/* 3F500 80064100 44869000 */  mtc1      $a2, $f18
/* 3F504 80064104 F7BA0078 */  sdc1      $f26, 0x78($sp)
/* 3F508 80064108 F7B80070 */  sdc1      $f24, 0x70($sp)
/* 3F50C 8006410C 46009682 */  mul.s     $f26, $f18, $f0
/* 3F510 80064110 C7B800A0 */  lwc1      $f24, 0xA0($sp)
/* 3F514 80064114 AFB10054 */  sw        $s1, 0x54($sp)
/* 3F518 80064118 44879000 */  mtc1      $a3, $f18
/* 3F51C 8006411C 00808821 */  addu      $s1, $a0, $zero
/* 3F520 80064120 46009482 */  mul.s     $f18, $f18, $f0
/* 3F524 80064124 AFBF0058 */  sw        $ra, 0x58($sp)
/* 3F528 80064128 AFB00050 */  sw        $s0, 0x50($sp)
/* 3F52C 8006412C F7BE0088 */  sdc1      $f30, 0x88($sp)
/* 3F530 80064130 F7BC0080 */  sdc1      $f28, 0x80($sp)
/* 3F534 80064134 F7B60068 */  sdc1      $f22, 0x68($sp)
/* 3F538 80064138 44109000 */  mfc1      $s0, $f18
/* 3F53C 8006413C 00000000 */  nop
/* 3F540 80064140 0C00A85B */  jal       sin_rad
/* 3F544 80064144 4600A306 */   mov.s    $f12, $f20
/* 3F548 80064148 4600A306 */  mov.s     $f12, $f20
/* 3F54C 8006414C 0C00A874 */  jal       cos_rad
/* 3F550 80064150 46000786 */   mov.s    $f30, $f0
/* 3F554 80064154 4600D306 */  mov.s     $f12, $f26
/* 3F558 80064158 0C00A85B */  jal       sin_rad
/* 3F55C 8006415C 46000586 */   mov.s    $f22, $f0
/* 3F560 80064160 4600D306 */  mov.s     $f12, $f26
/* 3F564 80064164 0C00A874 */  jal       cos_rad
/* 3F568 80064168 46000506 */   mov.s    $f20, $f0
/* 3F56C 8006416C 44906000 */  mtc1      $s0, $f12
/* 3F570 80064170 00000000 */  nop
/* 3F574 80064174 0C00A85B */  jal       sin_rad
/* 3F578 80064178 46000706 */   mov.s    $f28, $f0
/* 3F57C 8006417C 44906000 */  mtc1      $s0, $f12
/* 3F580 80064180 00000000 */  nop
/* 3F584 80064184 0C00A874 */  jal       cos_rad
/* 3F588 80064188 46000686 */   mov.s    $f26, $f0
/* 3F58C 8006418C 00000000 */  nop
/* 3F590 80064190 4600E382 */  mul.s     $f14, $f28, $f0
/* 3F594 80064194 00000000 */  nop
/* 3F598 80064198 461AE402 */  mul.s     $f16, $f28, $f26
/* 3F59C 8006419C 00000000 */  nop
/* 3F5A0 800641A0 4614F102 */  mul.s     $f4, $f30, $f20
/* 3F5A4 800641A4 00000000 */  nop
/* 3F5A8 800641A8 461AB082 */  mul.s     $f2, $f22, $f26
/* 3F5AC 800641AC 00000000 */  nop
/* 3F5B0 800641B0 4600B182 */  mul.s     $f6, $f22, $f0
/* 3F5B4 800641B4 4600A307 */  neg.s     $f12, $f20
/* 3F5B8 800641B8 4614B502 */  mul.s     $f20, $f22, $f20
/* 3F5BC 800641BC 00000000 */  nop
/* 3F5C0 800641C0 461CF282 */  mul.s     $f10, $f30, $f28
/* 3F5C4 800641C4 00000000 */  nop
/* 3F5C8 800641C8 461CB582 */  mul.s     $f22, $f22, $f28
/* 3F5CC 800641CC 00000000 */  nop
/* 3F5D0 800641D0 46186302 */  mul.s     $f12, $f12, $f24
/* 3F5D4 800641D4 00000000 */  nop
/* 3F5D8 800641D8 46187382 */  mul.s     $f14, $f14, $f24
/* 3F5DC 800641DC 00000000 */  nop
/* 3F5E0 800641E0 46188402 */  mul.s     $f16, $f16, $f24
/* 3F5E4 800641E4 00000000 */  nop
/* 3F5E8 800641E8 46002202 */  mul.s     $f8, $f4, $f0
/* 3F5EC 800641EC 00000000 */  nop
/* 3F5F0 800641F0 461A2102 */  mul.s     $f4, $f4, $f26
/* 3F5F4 800641F4 00000000 */  nop
/* 3F5F8 800641F8 46185282 */  mul.s     $f10, $f10, $f24
/* 3F5FC 800641FC 00000000 */  nop
/* 3F600 80064200 4618B582 */  mul.s     $f22, $f22, $f24
/* 3F604 80064204 46062100 */  add.s     $f4, $f4, $f6
/* 3F608 80064208 4600A182 */  mul.s     $f6, $f20, $f0
/* 3F60C 8006420C 46024201 */  sub.s     $f8, $f8, $f2
/* 3F610 80064210 461AF082 */  mul.s     $f2, $f30, $f26
/* 3F614 80064214 00000000 */  nop
/* 3F618 80064218 461AA502 */  mul.s     $f20, $f20, $f26
/* 3F61C 8006421C 00000000 */  nop
/* 3F620 80064220 4600F782 */  mul.s     $f30, $f30, $f0
/* 3F624 80064224 C7B200A4 */  lwc1      $f18, 0xA4($sp)
/* 3F628 80064228 46184202 */  mul.s     $f8, $f8, $f24
/* 3F62C 8006422C E7B20040 */  swc1      $f18, 0x40($sp)
/* 3F630 80064230 C7B200A8 */  lwc1      $f18, 0xA8($sp)
/* 3F634 80064234 27A40010 */  addiu     $a0, $sp, 0x10
/* 3F638 80064238 E7B20044 */  swc1      $f18, 0x44($sp)
/* 3F63C 8006423C 46182102 */  mul.s     $f4, $f4, $f24
/* 3F640 80064240 C7B200AC */  lwc1      $f18, 0xAC($sp)
/* 3F644 80064244 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 3F648 80064248 44810000 */  mtc1      $at, $f0
/* 3F64C 8006424C 46023180 */  add.s     $f6, $f6, $f2
/* 3F650 80064250 02202821 */  addu      $a1, $s1, $zero
/* 3F654 80064254 AFA0001C */  sw        $zero, 0x1C($sp)
/* 3F658 80064258 AFA0002C */  sw        $zero, 0x2C($sp)
/* 3F65C 8006425C 46183182 */  mul.s     $f6, $f6, $f24
/* 3F660 80064260 AFA0003C */  sw        $zero, 0x3C($sp)
/* 3F664 80064264 E7B20048 */  swc1      $f18, 0x48($sp)
/* 3F668 80064268 461EA501 */  sub.s     $f20, $f20, $f30
/* 3F66C 8006426C E7AC0018 */  swc1      $f12, 0x18($sp)
/* 3F670 80064270 E7AE0010 */  swc1      $f14, 0x10($sp)
/* 3F674 80064274 E7B00014 */  swc1      $f16, 0x14($sp)
/* 3F678 80064278 4618A502 */  mul.s     $f20, $f20, $f24
/* 3F67C 8006427C E7AA0028 */  swc1      $f10, 0x28($sp)
/* 3F680 80064280 E7B60038 */  swc1      $f22, 0x38($sp)
/* 3F684 80064284 E7A0004C */  swc1      $f0, 0x4C($sp)
/* 3F688 80064288 E7A80020 */  swc1      $f8, 0x20($sp)
/* 3F68C 8006428C E7A40024 */  swc1      $f4, 0x24($sp)
/* 3F690 80064290 E7A60030 */  swc1      $f6, 0x30($sp)
/* 3F694 80064294 0C019D40 */  jal       guMtxF2L
/* 3F698 80064298 E7B40034 */   swc1     $f20, 0x34($sp)
/* 3F69C 8006429C 8FBF0058 */  lw        $ra, 0x58($sp)
/* 3F6A0 800642A0 8FB10054 */  lw        $s1, 0x54($sp)
/* 3F6A4 800642A4 8FB00050 */  lw        $s0, 0x50($sp)
/* 3F6A8 800642A8 D7BE0088 */  ldc1      $f30, 0x88($sp)
/* 3F6AC 800642AC D7BC0080 */  ldc1      $f28, 0x80($sp)
/* 3F6B0 800642B0 D7BA0078 */  ldc1      $f26, 0x78($sp)
/* 3F6B4 800642B4 D7B80070 */  ldc1      $f24, 0x70($sp)
/* 3F6B8 800642B8 D7B60068 */  ldc1      $f22, 0x68($sp)
/* 3F6BC 800642BC D7B40060 */  ldc1      $f20, 0x60($sp)
/* 3F6C0 800642C0 03E00008 */  jr        $ra
/* 3F6C4 800642C4 27BD0090 */   addiu    $sp, $sp, 0x90
/* 3F6C8 800642C8 00000000 */  nop
/* 3F6CC 800642CC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void guPositionF(f32 mf[4][4], f32 r, f32 p, f32 h, f32 s, f32 x, f32 y, f32 z) {
        static f32 dtor = 3.1415926 / 180.0;
        f32   sinr, sinp, sinh;
        f32   cosr, cosp, cosh;

        r *= dtor;
        p *= dtor;
        h *= dtor;
        sinr = sin_rad(r);
        cosr = cos_rad(r);
        sinp = sin_rad(p);
        cosp = cos_rad(p);
        sinh = sin_rad(h);
        cosh = cos_rad(h);

        mf[0][0] = (cosp * cosh) * s;
        mf[0][1] = (cosp * sinh) * s;
        mf[0][2] = (-sinp) * s;
        mf[0][3] = 0.0;

        mf[1][0] = (sinr * sinp * cosh - cosr * sinh) * s;
        mf[1][1] = (sinr * sinp * sinh + cosr * cosh) * s;
        mf[1][2] = (sinr * cosp) * s;
        mf[1][3] = 0.0;

        mf[2][0] = (cosr * sinp * cosh + sinr * sinh) * s;
        mf[2][1] = (cosr * sinp * sinh - sinr * cosh) * s;
        mf[2][2] = (cosr * cosp) * s;
        mf[2][3] = 0.0;

        mf[3][0] = x;
        mf[3][1] = y;
        mf[3][2] = z;
        mf[3][3] = 1.0;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel imgfx_appendGfx_component
/* D1670 8013AF70 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* D1674 8013AF74 0080402D */  daddu     $t0, $a0, $zero
/* D1678 8013AF78 AFB20018 */  sw        $s2, 0x18($sp)
/* D167C 8013AF7C 00E0902D */  daddu     $s2, $a3, $zero
/* D1680 8013AF80 AFB10014 */  sw        $s1, 0x14($sp)
/* D1684 8013AF84 0000882D */  daddu     $s1, $zero, $zero
/* D1688 8013AF88 00081140 */  sll       $v0, $t0, 5
/* D168C 8013AF8C 00481023 */  subu      $v0, $v0, $t0
/* D1690 8013AF90 3C038015 */  lui       $v1, %hi(ImgFXInstances)
/* D1694 8013AF94 8C636954 */  lw        $v1, %lo(ImgFXInstances)($v1)
/* D1698 8013AF98 00021080 */  sll       $v0, $v0, 2
/* D169C 8013AF9C AFBF001C */  sw        $ra, 0x1C($sp)
/* D16A0 8013AFA0 AFB00010 */  sw        $s0, 0x10($sp)
/* D16A4 8013AFA4 90A40010 */  lbu       $a0, 0x10($a1)
/* D16A8 8013AFA8 10800049 */  beqz      $a0, .L8013B0D0
/* D16AC 8013AFAC 00628021 */   addu     $s0, $v1, $v0
/* D16B0 8013AFB0 8E020014 */  lw        $v0, 0x14($s0)
/* D16B4 8013AFB4 A2080000 */  sb        $t0, 0x0($s0)
/* D16B8 8013AFB8 3C038015 */  lui       $v1, %hi(ImgFXCurrentTexturePtr)
/* D16BC 8013AFBC 8C63EE10 */  lw        $v1, %lo(ImgFXCurrentTexturePtr)($v1)
/* D16C0 8013AFC0 00461025 */  or        $v0, $v0, $a2
/* D16C4 8013AFC4 AE020014 */  sw        $v0, 0x14($s0)
/* D16C8 8013AFC8 8CA20000 */  lw        $v0, 0x0($a1)
/* D16CC 8013AFCC AC620000 */  sw        $v0, 0x0($v1)
/* D16D0 8013AFD0 8CA20004 */  lw        $v0, 0x4($a1)
/* D16D4 8013AFD4 AC620004 */  sw        $v0, 0x4($v1)
/* D16D8 8013AFD8 94A20008 */  lhu       $v0, 0x8($a1)
/* D16DC 8013AFDC A4620008 */  sh        $v0, 0x8($v1)
/* D16E0 8013AFE0 94A2000A */  lhu       $v0, 0xA($a1)
/* D16E4 8013AFE4 A462000A */  sh        $v0, 0xA($v1)
/* D16E8 8013AFE8 94A2000C */  lhu       $v0, 0xC($a1)
/* D16EC 8013AFEC A462000C */  sh        $v0, 0xC($v1)
/* D16F0 8013AFF0 94A2000E */  lhu       $v0, 0xE($a1)
/* D16F4 8013AFF4 A4600018 */  sh        $zero, 0x18($v1)
/* D16F8 8013AFF8 A460001E */  sh        $zero, 0x1E($v1)
/* D16FC 8013AFFC A462000E */  sh        $v0, 0xE($v1)
/* D1700 8013B000 90A20010 */  lbu       $v0, 0x10($a1)
/* D1704 8013B004 A0620024 */  sb        $v0, 0x24($v1)
/* D1708 8013B008 2D02005A */  sltiu     $v0, $t0, 0x5A
/* D170C 8013B00C 14400003 */  bnez      $v0, .L8013B01C
/* D1710 8013B010 2902005A */   slti     $v0, $t0, 0x5A
/* D1714 8013B014 0804EC35 */  j         .L8013B0D4
/* D1718 8013B018 0000102D */   daddu    $v0, $zero, $zero
.L8013B01C:
/* D171C 8013B01C 1040002D */  beqz      $v0, .L8013B0D4
/* D1720 8013B020 0000102D */   daddu    $v0, $zero, $zero
/* D1724 8013B024 1200002B */  beqz      $s0, .L8013B0D4
/* D1728 8013B028 00000000 */   nop
/* D172C 8013B02C 0C04EC3B */  jal       imgfx_make_mesh
/* D1730 8013B030 0200202D */   daddu    $a0, $s0, $zero
/* D1734 8013B034 0200202D */  daddu     $a0, $s0, $zero
/* D1738 8013B038 0C04EC6C */  jal       imgfx_appendGfx_mesh
/* D173C 8013B03C 0240282D */   daddu    $a1, $s2, $zero
/* D1740 8013B040 8E030014 */  lw        $v1, 0x14($s0)
/* D1744 8013B044 30621000 */  andi      $v0, $v1, 0x1000
/* D1748 8013B048 1040000F */  beqz      $v0, .L8013B088
/* D174C 8013B04C 0200202D */   daddu    $a0, $s0, $zero
/* D1750 8013B050 24110001 */  addiu     $s1, $zero, 0x1
/* D1754 8013B054 2402FFFF */  addiu     $v0, $zero, -0x1
/* D1758 8013B058 AC82001C */  sw        $v0, 0x1C($a0)
/* D175C 8013B05C AC82002C */  sw        $v0, 0x2C($a0)
/* D1760 8013B060 8C820014 */  lw        $v0, 0x14($a0)
/* D1764 8013B064 2403E67F */  addiu     $v1, $zero, -0x1981
/* D1768 8013B068 A0800005 */  sb        $zero, 0x5($a0)
/* D176C 8013B06C A0800001 */  sb        $zero, 0x1($a0)
/* D1770 8013B070 A0800002 */  sb        $zero, 0x2($a0)
/* D1774 8013B074 00431024 */  and       $v0, $v0, $v1
/* D1778 8013B078 0C04EA4F */  jal       imgfx_cache_instance_data
/* D177C 8013B07C AC820014 */   sw       $v0, 0x14($a0)
/* D1780 8013B080 0804EC35 */  j         .L8013B0D4
/* D1784 8013B084 0220102D */   daddu    $v0, $s1, $zero
.L8013B088:
/* D1788 8013B088 30624000 */  andi      $v0, $v1, 0x4000
/* D178C 8013B08C 10400003 */  beqz      $v0, .L8013B09C
/* D1790 8013B090 3C020002 */   lui      $v0, (0x20000 >> 16)
/* D1794 8013B094 0804EC34 */  j         .L8013B0D0
/* D1798 8013B098 24110002 */   addiu    $s1, $zero, 0x2
.L8013B09C:
/* D179C 8013B09C 00621024 */  and       $v0, $v1, $v0
/* D17A0 8013B0A0 1040000B */  beqz      $v0, .L8013B0D0
/* D17A4 8013B0A4 2403FFFF */   addiu    $v1, $zero, -0x1
/* D17A8 8013B0A8 24110001 */  addiu     $s1, $zero, 0x1
/* D17AC 8013B0AC 8E020014 */  lw        $v0, 0x14($s0)
/* D17B0 8013B0B0 A2000005 */  sb        $zero, 0x5($s0)
/* D17B4 8013B0B4 A2000006 */  sb        $zero, 0x6($s0)
/* D17B8 8013B0B8 A2000001 */  sb        $zero, 0x1($s0)
/* D17BC 8013B0BC A2000002 */  sb        $zero, 0x2($s0)
/* D17C0 8013B0C0 AE03001C */  sw        $v1, 0x1C($s0)
/* D17C4 8013B0C4 AE03002C */  sw        $v1, 0x2C($s0)
/* D17C8 8013B0C8 00511024 */  and       $v0, $v0, $s1
/* D17CC 8013B0CC AE020014 */  sw        $v0, 0x14($s0)
.L8013B0D0:
/* D17D0 8013B0D0 0220102D */  daddu     $v0, $s1, $zero
.L8013B0D4:
/* D17D4 8013B0D4 8FBF001C */  lw        $ra, 0x1C($sp)
/* D17D8 8013B0D8 8FB20018 */  lw        $s2, 0x18($sp)
/* D17DC 8013B0DC 8FB10014 */  lw        $s1, 0x14($sp)
/* D17E0 8013B0E0 8FB00010 */  lw        $s0, 0x10($sp)
/* D17E4 8013B0E4 03E00008 */  jr        $ra
/* D17E8 8013B0E8 27BD0020 */   addiu    $sp, $sp, 0x20

### DECOMPILED C INSTRUCTIONS:

s32 imgfx_appendGfx_component(s32 idx, ImgFXTexture* ifxImg, u32 flagBits, Matrix4f mtx) {
    ImgFXState* state = &(*ImgFXInstances)[idx];
    s32 ret = 0;

    if (ifxImg->alpha == 0) {
        return 0;
    }

    state->arrayIdx = idx;
    state->flags |= flagBits;
    ImgFXCurrentTexturePtr->tex.raster  = ifxImg->raster;
    ImgFXCurrentTexturePtr->tex.palette = ifxImg->palette;
    ImgFXCurrentTexturePtr->tex.width   = ifxImg->width;
    ImgFXCurrentTexturePtr->tex.height  = ifxImg->height;
    ImgFXCurrentTexturePtr->tex.xOffset = ifxImg->xOffset;
    ImgFXCurrentTexturePtr->tex.yOffset = ifxImg->yOffset;
    ImgFXCurrentTexturePtr->unk_18  = 0;
    ImgFXCurrentTexturePtr->unk_1E  = 0;
    ImgFXCurrentTexturePtr->alphaMultiplier = ifxImg->alpha;

    if (idx < 0 || idx >= MAX_IMGFX_INSTANCES) {
        return 0;
    }

    if (idx >= MAX_IMGFX_INSTANCES || state == NULL) {
        return 0;
    }

    imgfx_make_mesh(state);
    imgfx_appendGfx_mesh(state, mtx);

    if (state->flags & IMGFX_FLAG_ANIM_DONE) {
        state->ints.raw[0][0] = -1;
        state->ints.raw[1][0] = -1;
        state->lastAnimCmd = IMGFX_CLEAR;
        state->meshType = 0;
        state->renderType = IMGFX_RENDER_DEFAULT;
        state->flags &= ~(IMGFX_FLAG_ANIM_DONE | IMGFX_FLAG_800 | IMGFX_FLAG_REVERSE_ANIM | IMGFX_FLAG_LOOP_ANIM);
        imgfx_cache_instance_data(state);
        ret = 1;
    } else if (state->flags & IMGFX_FLAG_4000) {
        ret = 2;
    } else if (state->flags & IMGFX_FLAG_20000) {
        state->lastAnimCmd = IMGFX_CLEAR;
        state->lastColorCmd = IMGFX_CLEAR;
        state->meshType = IMGFX_MESH_DEFAULT;
        state->renderType = IMGFX_RENDER_DEFAULT;
        state->ints.raw[0][0] = -1;
        state->ints.raw[1][0] = -1;
        state->flags &= IMGFX_FLAG_IN_USE;
        ret = 1;
    }
    return ret;
}