### RAW ASSEMBLY INSTRUCTIONS:

glabel npc_raycast_up_corner
/* 764FC 800DD04C 27BDFF60 */  addiu     $sp, $sp, -0xA0
/* 76500 800DD050 AFB20060 */  sw        $s2, 0x60($sp)
/* 76504 800DD054 00A0902D */  daddu     $s2, $a1, $zero
/* 76508 800DD058 AFB30064 */  sw        $s3, 0x64($sp)
/* 7650C 800DD05C 00C0982D */  daddu     $s3, $a2, $zero
/* 76510 800DD060 AFB40068 */  sw        $s4, 0x68($sp)
/* 76514 800DD064 00E0A02D */  daddu     $s4, $a3, $zero
/* 76518 800DD068 AFB00058 */  sw        $s0, 0x58($sp)
/* 7651C 800DD06C 2410FFFF */  addiu     $s0, $zero, -0x1
/* 76520 800DD070 AFBF006C */  sw        $ra, 0x6C($sp)
/* 76524 800DD074 AFB1005C */  sw        $s1, 0x5C($sp)
/* 76528 800DD078 F7BE0098 */  sdc1      $f30, 0x98($sp)
/* 7652C 800DD07C F7BC0090 */  sdc1      $f28, 0x90($sp)
/* 76530 800DD080 F7BA0088 */  sdc1      $f26, 0x88($sp)
/* 76534 800DD084 F7B80080 */  sdc1      $f24, 0x80($sp)
/* 76538 800DD088 F7B60078 */  sdc1      $f22, 0x78($sp)
/* 7653C 800DD08C F7B40070 */  sdc1      $f20, 0x70($sp)
/* 76540 800DD090 C6580000 */  lwc1      $f24, 0x0($s2)
/* 76544 800DD094 C6760000 */  lwc1      $f22, 0x0($s3)
/* 76548 800DD098 C6940000 */  lwc1      $f20, 0x0($s4)
/* 7654C 800DD09C 8FB100B0 */  lw        $s1, 0xB0($sp)
/* 76550 800DD0A0 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 76554 800DD0A4 44811000 */  mtc1      $at, $f2
/* 76558 800DD0A8 4406B000 */  mfc1      $a2, $f22
/* 7655C 800DD0AC 4407A000 */  mfc1      $a3, $f20
/* 76560 800DD0B0 C6200000 */  lwc1      $f0, 0x0($s1)
/* 76564 800DD0B4 4405C000 */  mfc1      $a1, $f24
/* 76568 800DD0B8 27A20038 */  addiu     $v0, $sp, 0x38
/* 7656C 800DD0BC E7A00044 */  swc1      $f0, 0x44($sp)
/* 76570 800DD0C0 AFA2001C */  sw        $v0, 0x1C($sp)
/* 76574 800DD0C4 27A2003C */  addiu     $v0, $sp, 0x3C
/* 76578 800DD0C8 AFA20020 */  sw        $v0, 0x20($sp)
/* 7657C 800DD0CC 27A20040 */  addiu     $v0, $sp, 0x40
/* 76580 800DD0D0 AFA20024 */  sw        $v0, 0x24($sp)
/* 76584 800DD0D4 27A20044 */  addiu     $v0, $sp, 0x44
/* 76588 800DD0D8 AFA20028 */  sw        $v0, 0x28($sp)
/* 7658C 800DD0DC 27A20048 */  addiu     $v0, $sp, 0x48
/* 76590 800DD0E0 AFA2002C */  sw        $v0, 0x2C($sp)
/* 76594 800DD0E4 27A2004C */  addiu     $v0, $sp, 0x4C
/* 76598 800DD0E8 AFA20030 */  sw        $v0, 0x30($sp)
/* 7659C 800DD0EC 27A20050 */  addiu     $v0, $sp, 0x50
/* 765A0 800DD0F0 AFA00010 */  sw        $zero, 0x10($sp)
/* 765A4 800DD0F4 E7A20014 */  swc1      $f2, 0x14($sp)
/* 765A8 800DD0F8 AFA00018 */  sw        $zero, 0x18($sp)
/* 765AC 800DD0FC 0C017334 */  jal       test_ray_colliders
/* 765B0 800DD100 AFA20034 */   sw       $v0, 0x34($sp)
/* 765B4 800DD104 4600C686 */  mov.s     $f26, $f24
/* 765B8 800DD108 4600B706 */  mov.s     $f28, $f22
/* 765BC 800DD10C 0440000C */  bltz      $v0, .L800DD140
/* 765C0 800DD110 4600A786 */   mov.s    $f30, $f20
/* 765C4 800DD114 C6200000 */  lwc1      $f0, 0x0($s1)
/* 765C8 800DD118 C7A20044 */  lwc1      $f2, 0x44($sp)
/* 765CC 800DD11C 4600103C */  c.lt.s    $f2, $f0
/* 765D0 800DD120 00000000 */  nop
/* 765D4 800DD124 45020007 */  bc1fl     .L800DD144
/* 765D8 800DD128 4600D606 */   mov.s    $f24, $f26
/* 765DC 800DD12C 0040802D */  daddu     $s0, $v0, $zero
/* 765E0 800DD130 E6220000 */  swc1      $f2, 0x0($s1)
/* 765E4 800DD134 E6580000 */  swc1      $f24, 0x0($s2)
/* 765E8 800DD138 E6760000 */  swc1      $f22, 0x0($s3)
/* 765EC 800DD13C E6940000 */  swc1      $f20, 0x0($s4)
.L800DD140:
/* 765F0 800DD140 4600D606 */  mov.s     $f24, $f26
.L800DD144:
/* 765F4 800DD144 4600E586 */  mov.s     $f22, $f28
/* 765F8 800DD148 3C014120 */  lui       $at, (0x41200000 >> 16)
/* 765FC 800DD14C 44811000 */  mtc1      $at, $f2
/* 76600 800DD150 44802000 */  mtc1      $zero, $f4
/* 76604 800DD154 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 76608 800DD158 44810000 */  mtc1      $at, $f0
/* 7660C 800DD15C 27A20038 */  addiu     $v0, $sp, 0x38
/* 76610 800DD160 E7A20044 */  swc1      $f2, 0x44($sp)
/* 76614 800DD164 AFA20018 */  sw        $v0, 0x18($sp)
/* 76618 800DD168 27A2003C */  addiu     $v0, $sp, 0x3C
/* 7661C 800DD16C AFA2001C */  sw        $v0, 0x1C($sp)
/* 76620 800DD170 27A20040 */  addiu     $v0, $sp, 0x40
/* 76624 800DD174 AFA20020 */  sw        $v0, 0x20($sp)
/* 76628 800DD178 27A20044 */  addiu     $v0, $sp, 0x44
/* 7662C 800DD17C AFA20024 */  sw        $v0, 0x24($sp)
/* 76630 800DD180 27A20048 */  addiu     $v0, $sp, 0x48
/* 76634 800DD184 AFA20028 */  sw        $v0, 0x28($sp)
/* 76638 800DD188 27A2004C */  addiu     $v0, $sp, 0x4C
/* 7663C 800DD18C AFA2002C */  sw        $v0, 0x2C($sp)
/* 76640 800DD190 27A20050 */  addiu     $v0, $sp, 0x50
/* 76644 800DD194 E7A00010 */  swc1      $f0, 0x10($sp)
/* 76648 800DD198 E7A40014 */  swc1      $f4, 0x14($sp)
/* 7664C 800DD19C AFA20030 */  sw        $v0, 0x30($sp)
/* 76650 800DD1A0 8E860000 */  lw        $a2, 0x0($s4)
/* 76654 800DD1A4 44072000 */  mfc1      $a3, $f4
/* 76658 800DD1A8 C64C0000 */  lwc1      $f12, 0x0($s2)
/* 7665C 800DD1AC C66E0000 */  lwc1      $f14, 0x0($s3)
/* 76660 800DD1B0 0C017512 */  jal       test_ray_entities
/* 76664 800DD1B4 4600F506 */   mov.s    $f20, $f30
/* 76668 800DD1B8 0442000D */  bltzl     $v0, .L800DD1F0
/* 7666C 800DD1BC 0200102D */   daddu    $v0, $s0, $zero
/* 76670 800DD1C0 C6200000 */  lwc1      $f0, 0x0($s1)
/* 76674 800DD1C4 C7A20044 */  lwc1      $f2, 0x44($sp)
/* 76678 800DD1C8 4600103C */  c.lt.s    $f2, $f0
/* 7667C 800DD1CC 00000000 */  nop
/* 76680 800DD1D0 45020007 */  bc1fl     .L800DD1F0
/* 76684 800DD1D4 0200102D */   daddu    $v0, $s0, $zero
/* 76688 800DD1D8 34504000 */  ori       $s0, $v0, 0x4000
/* 7668C 800DD1DC E6220000 */  swc1      $f2, 0x0($s1)
/* 76690 800DD1E0 E6580000 */  swc1      $f24, 0x0($s2)
/* 76694 800DD1E4 E6760000 */  swc1      $f22, 0x0($s3)
/* 76698 800DD1E8 E6940000 */  swc1      $f20, 0x0($s4)
/* 7669C 800DD1EC 0200102D */  daddu     $v0, $s0, $zero
.L800DD1F0:
/* 766A0 800DD1F0 8FBF006C */  lw        $ra, 0x6C($sp)
/* 766A4 800DD1F4 8FB40068 */  lw        $s4, 0x68($sp)
/* 766A8 800DD1F8 8FB30064 */  lw        $s3, 0x64($sp)
/* 766AC 800DD1FC 8FB20060 */  lw        $s2, 0x60($sp)
/* 766B0 800DD200 8FB1005C */  lw        $s1, 0x5C($sp)
/* 766B4 800DD204 8FB00058 */  lw        $s0, 0x58($sp)
/* 766B8 800DD208 D7BE0098 */  ldc1      $f30, 0x98($sp)
/* 766BC 800DD20C D7BC0090 */  ldc1      $f28, 0x90($sp)
/* 766C0 800DD210 D7BA0088 */  ldc1      $f26, 0x88($sp)
/* 766C4 800DD214 D7B80080 */  ldc1      $f24, 0x80($sp)
/* 766C8 800DD218 D7B60078 */  ldc1      $f22, 0x78($sp)
/* 766CC 800DD21C D7B40070 */  ldc1      $f20, 0x70($sp)
/* 766D0 800DD220 03E00008 */  jr        $ra
/* 766D4 800DD224 27BD00A0 */   addiu    $sp, $sp, 0xA0

### DECOMPILED C INSTRUCTIONS:

s32 npc_raycast_up_corner(s32 ignoreFlags, f32* x, f32* y, f32* z, f32* length) {
    f32 hitX;
    f32 hitY;
    f32 hitZ;
    f32 hitDepth;
    f32 hitNx;
    f32 hitNy;
    f32 hitNz;
    s32 colliderID;
    s32 entityID;
    f32 sx, sy, sz;
    f32 sx2, sy2, sz2;
    s32 ret = -1;

    // needed to match
    sx2 = sx = *x;
    sy2 = sy = *y;
    sz2 = sz = *z;
    hitDepth = *length;
    colliderID = test_ray_colliders(ignoreFlags, sx, sy, sz, 0.0f, 1.0f, 0.0f, &hitX, &hitY, &hitZ, &hitDepth, &hitNx, &hitNy, &hitNz);
    if (colliderID >= 0 && *length > hitDepth) {
        *length = hitDepth;
        ret = colliderID;
        *x = sx = sx2;
        *y = sy = sy2;
        *z = sz = sz2;
    }

    hitDepth = 10.0f;
    entityID = test_ray_entities(*x, *y, *z, 0.0f, 1.0f, 0.0f, &hitX, &hitY, &hitZ, &hitDepth, &hitNx, &hitNy, &hitNz);
    sx = sx2;
    sy = sy2;
    sz = sz2;
    if (entityID >= 0 && *length > hitDepth) {
        ret = entityID | COLLISION_WITH_ENTITY_BIT;
        *length = hitDepth;
        *x = sx;
        *y = sy;
        *z = sz;
    }

    return ret;
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_80244858
/* 137B98 80244858 2882F581 */  slti      $v0, $a0, -0xA7F
.L8024485C:
/* 137B9C 8024485C 8FA90014 */  lw        $t1, 0x14($sp)
D_80244860:
/* 137BA0 80244860 8FAA0018 */  lw        $t2, 0x18($sp)
/* 137BA4 80244864 8FAB001C */  lw        $t3, 0x1C($sp)
D_80244868:
/* 137BA8 80244868 8FAC0020 */  lw        $t4, 0x20($sp)
glabel func_8024486C
/* 137BAC 8024486C 14400075 */  bnez      $v0, .L80244A44
jtbl_80244870:
/* 137BB0 80244870 28A2F581 */   slti     $v0, $a1, -0xA7F
/* 137BB4 80244874 14400073 */  bnez      $v0, .L80244A44
D_80244878:
/* 137BB8 80244878 00000000 */   nop
/* 137BBC 8024487C 18C00071 */  blez      $a2, .L80244A44
D_80244880:
/* 137BC0 80244880 00000000 */   nop
/* 137BC4 80244884 18E0006F */  blez      $a3, .L80244A44
D_80244888:
/* 137BC8 80244888 28820500 */   slti     $v0, $a0, 0x500
.L8024488C:
/* 137BCC 8024488C 1040006D */  beqz      $v0, .L80244A44
D_80244890:
/* 137BD0 80244890 28A203C0 */   slti     $v0, $a1, 0x3C0
.L80244894:
/* 137BD4 80244894 1040006B */  beqz      $v0, .L80244A44
jtbl_80244898:
/* 137BD8 80244898 28C20A80 */   slti     $v0, $a2, 0xA80
/* 137BDC 8024489C 10400069 */  beqz      $v0, .L80244A44
D_802448A0:
/* 137BE0 802448A0 28E20A80 */   slti     $v0, $a3, 0xA80
/* 137BE4 802448A4 10400067 */  beqz      $v0, .L80244A44
D_802448A8:
/* 137BE8 802448A8 00000000 */   nop
/* 137BEC 802448AC 3C02800A */  lui       $v0, %hi(gMainGfxPos)
D_802448B0:
/* 137BF0 802448B0 2442A66C */  addiu     $v0, $v0, %lo(gMainGfxPos)
/* 137BF4 802448B4 8C480000 */  lw        $t0, 0x0($v0)
jtbl_802448B8:
/* 137BF8 802448B8 25030008 */  addiu     $v1, $t0, 0x8
D_802448BC:
/* 137BFC 802448BC AC430000 */  sw        $v1, 0x0($v0)
D_802448C0:
/* 137C00 802448C0 00061400 */  sll       $v0, $a2, 16
/* 137C04 802448C4 00021403 */  sra       $v0, $v0, 16
.L802448C8:
/* 137C08 802448C8 18400005 */  blez      $v0, func_802448E0
/* 137C0C 802448CC 30420FFF */   andi     $v0, $v0, 0xFFF
/* 137C10 802448D0 00021300 */  sll       $v0, $v0, 12
/* 137C14 802448D4 3C03E400 */  lui       $v1, (0xE4000000 >> 16)
jtbl_802448D8:
/* 137C18 802448D8 08091239 */  j         .L802448E4
/* 137C1C 802448DC 00431825 */   or       $v1, $v0, $v1
glabel func_802448E0
/* 137C20 802448E0 3C03E400 */  lui       $v1, (0xE4000000 >> 16)
.L802448E4:
/* 137C24 802448E4 00071400 */  sll       $v0, $a3, 16
/* 137C28 802448E8 00021403 */  sra       $v0, $v0, 16
/* 137C2C 802448EC 18400004 */  blez      $v0, D_80244900
/* 137C30 802448F0 AD030000 */   sw       $v1, 0x0($t0)
D_802448F4:
/* 137C34 802448F4 30420FFF */  andi      $v0, $v0, 0xFFF
/* 137C38 802448F8 00621025 */  or        $v0, $v1, $v0
D_802448FC:
/* 137C3C 802448FC AD020000 */  sw        $v0, 0x0($t0)
D_80244900:
/* 137C40 80244900 8FA20010 */  lw        $v0, 0x10($sp)
/* 137C44 80244904 30420007 */  andi      $v0, $v0, 0x7
/* 137C48 80244908 00021E00 */  sll       $v1, $v0, 24
D_8024490C:
/* 137C4C 8024490C 00041400 */  sll       $v0, $a0, 16
jtbl_80244910:
/* 137C50 80244910 00023403 */  sra       $a2, $v0, 16
/* 137C54 80244914 18C00003 */  blez      $a2, .L80244924
.L80244918:
/* 137C58 80244918 30C20FFF */   andi     $v0, $a2, 0xFFF
.L8024491C:
/* 137C5C 8024491C 00021300 */  sll       $v0, $v0, 12
D_80244920:
/* 137C60 80244920 00621825 */  or        $v1, $v1, $v0
.L80244924:
/* 137C64 80244924 00051400 */  sll       $v0, $a1, 16
/* 137C68 80244928 00021403 */  sra       $v0, $v0, 16
/* 137C6C 8024492C 18400004 */  blez      $v0, .L80244940
/* 137C70 80244930 AD030004 */   sw       $v1, 0x4($t0)
glabel func_80244934
/* 137C74 80244934 30420FFF */  andi      $v0, $v0, 0xFFF
/* 137C78 80244938 00621025 */  or        $v0, $v1, $v0
/* 137C7C 8024493C AD020004 */  sw        $v0, 0x4($t0)
.L80244940:
/* 137C80 80244940 3C03800A */  lui       $v1, %hi(gMainGfxPos)
/* 137C84 80244944 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
.L80244948:
/* 137C88 80244948 8C620000 */  lw        $v0, 0x0($v1)
/* 137C8C 8024494C 0040202D */  daddu     $a0, $v0, $zero
/* 137C90 80244950 24420008 */  addiu     $v0, $v0, 0x8
.L80244954:
/* 137C94 80244954 AC620000 */  sw        $v0, 0x0($v1)
/* 137C98 80244958 3C02E100 */  lui       $v0, (0xE1000000 >> 16)
/* 137C9C 8024495C AC820000 */  sw        $v0, 0x0($a0)
D_80244960:
/* 137CA0 80244960 04C10012 */  bgez      $a2, .L802449AC
.L80244964:
/* 137CA4 80244964 24840004 */   addiu    $a0, $a0, 0x4
D_80244968:
/* 137CA8 80244968 000B1400 */  sll       $v0, $t3, 16
/* 137CAC 8024496C 00021403 */  sra       $v0, $v0, 16
/* 137CB0 80244970 04410007 */  bgez      $v0, .L80244990
.L80244974:
/* 137CB4 80244974 00C20018 */   mult     $a2, $v0
/* 137CB8 80244978 00006812 */  mflo      $t5
/* 137CBC 8024497C 000D11C3 */  sra       $v0, $t5, 7
/* 137CC0 80244980 04410008 */  bgez      $v0, .L802449A4
glabel func_80244984
/* 137CC4 80244984 01221023 */   subu     $v0, $t1, $v0
D_80244988:
/* 137CC8 80244988 08091268 */  j         .L802449A0
.L8024498C:
/* 137CCC 8024498C 0000102D */   daddu    $v0, $zero, $zero
.L80244990:
/* 137CD0 80244990 00006812 */  mflo      $t5
/* 137CD4 80244994 000D11C3 */  sra       $v0, $t5, 7
D_80244998:
/* 137CD8 80244998 5C400001 */  bgtzl     $v0, .L802449A0
/* 137CDC 8024499C 0000102D */   daddu    $v0, $zero, $zero
.L802449A0:
/* 137CE0 802449A0 01221023 */  subu      $v0, $t1, $v0
.L802449A4:
/* 137CE4 802449A4 0809126C */  j         D_802449B0
/* 137CE8 802449A8 00023400 */   sll      $a2, $v0, 16
.L802449AC:
/* 137CEC 802449AC 00093400 */  sll       $a2, $t1, 16
D_802449B0:
/* 137CF0 802449B0 04A10016 */  bgez      $a1, D_80244A0C
.L802449B4:
/* 137CF4 802449B4 3142FFFF */   andi     $v0, $t2, 0xFFFF
.L802449B8:
/* 137CF8 802449B8 000C1400 */  sll       $v0, $t4, 16
/* 137CFC 802449BC 00021C03 */  sra       $v1, $v0, 16
/* 137D00 802449C0 0461000A */  bgez      $v1, D_802449EC
D_802449C4:
/* 137D04 802449C4 00051400 */   sll      $v0, $a1, 16
.L802449C8:
/* 137D08 802449C8 00021403 */  sra       $v0, $v0, 16
D_802449CC:
/* 137D0C 802449CC 00430018 */  mult      $v0, $v1
D_802449D0:
/* 137D10 802449D0 00006812 */  mflo      $t5
/* 137D14 802449D4 000D11C3 */  sra       $v0, $t5, 7
D_802449D8:
/* 137D18 802449D8 04420001 */  bltzl     $v0, .L802449E0
.L802449DC:
/* 137D1C 802449DC 0000102D */   daddu    $v0, $zero, $zero
.L802449E0:
/* 137D20 802449E0 01421023 */  subu      $v0, $t2, $v0
glabel func_802449E4
/* 137D24 802449E4 08091283 */  j         D_80244A0C
/* 137D28 802449E8 3042FFFF */   andi     $v0, $v0, 0xFFFF
D_802449EC:
/* 137D2C 802449EC 00021403 */  sra       $v0, $v0, 16
D_802449F0:
/* 137D30 802449F0 00430018 */  mult      $v0, $v1
D_802449F4:
/* 137D34 802449F4 00006812 */  mflo      $t5
glabel func_802449F8
/* 137D38 802449F8 000D11C3 */  sra       $v0, $t5, 7
D_802449FC:
/* 137D3C 802449FC 5C400001 */  bgtzl     $v0, D_80244A04
jtbl_80244A00:
/* 137D40 80244A00 0000102D */   daddu    $v0, $zero, $zero
D_80244A04:
/* 137D44 80244A04 01421023 */  subu      $v0, $t2, $v0
/* 137D48 80244A08 3042FFFF */  andi      $v0, $v0, 0xFFFF
D_80244A0C:
/* 137D4C 80244A0C 00C21025 */  or        $v0, $a2, $v0
D_80244A10:
/* 137D50 80244A10 AC820000 */  sw        $v0, 0x0($a0)
/* 137D54 80244A14 3C03800A */  lui       $v1, %hi(gMainGfxPos)
/* 137D58 80244A18 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
.L80244A1C:
/* 137D5C 80244A1C 8C620000 */  lw        $v0, 0x0($v1)

### DECOMPILED C INSTRUCTIONS:

void pause_draw_rect(s32 ulx, s32 uly, s32 lrx, s32 lry, s32 tileDescriptor, s32 uls, s32 ult, s32 dsdx, s32 dtdy) {
    if (ulx <= -2688 || uly <= -2688 || lrx <= 0 || lry <= 0) {
        return;
    }
    if (ulx >= 1280 || uly >= 960 || lrx >= 2688 || lry >= 2688) {
        return;
    }
    gSPScisTextureRectangle(gMainGfxPos++, ulx, uly, lrx, lry, tileDescriptor, uls, ult, dsdx, dtdy);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel __osGetId
/* 45008 80069C08 27BDFF98 */  addiu     $sp, $sp, -0x68
/* 4500C 80069C0C AFB00058 */  sw        $s0, 0x58($sp)
/* 45010 80069C10 00808021 */  addu      $s0, $a0, $zero
/* 45014 80069C14 AFBF0060 */  sw        $ra, 0x60($sp)
/* 45018 80069C18 AFB1005C */  sw        $s1, 0x5C($sp)
/* 4501C 80069C1C 92020065 */  lbu       $v0, 0x65($s0)
/* 45020 80069C20 10400006 */  beqz      $v0, .L80069C3C
/* 45024 80069C24 00000000 */   nop
/* 45028 80069C28 0C01A5B4 */  jal       __osPfsSelectBank
/* 4502C 80069C2C 00002821 */   addu     $a1, $zero, $zero
/* 45030 80069C30 00401821 */  addu      $v1, $v0, $zero
/* 45034 80069C34 14600062 */  bnez      $v1, .L80069DC0
/* 45038 80069C38 00000000 */   nop
.L80069C3C:
/* 4503C 80069C3C 8E040004 */  lw        $a0, 0x4($s0)
/* 45040 80069C40 8E050008 */  lw        $a1, 0x8($s0)
/* 45044 80069C44 24060001 */  addiu     $a2, $zero, 0x1
/* 45048 80069C48 0C01A874 */  jal       __osContRamRead
/* 4504C 80069C4C 27A70010 */   addiu    $a3, $sp, 0x10
/* 45050 80069C50 00401821 */  addu      $v1, $v0, $zero
/* 45054 80069C54 1460005A */  bnez      $v1, .L80069DC0
/* 45058 80069C58 27A50010 */   addiu    $a1, $sp, 0x10
/* 4505C 80069C5C 27A7002C */  addiu     $a3, $sp, 0x2C
/* 45060 80069C60 A7A00052 */  sh        $zero, 0x52($sp)
/* 45064 80069C64 A7A00050 */  sh        $zero, 0x50($sp)
.L80069C68:
/* 45068 80069C68 94A20000 */  lhu       $v0, 0x0($a1)
/* 4506C 80069C6C 97A30050 */  lhu       $v1, 0x50($sp)
/* 45070 80069C70 97A40052 */  lhu       $a0, 0x52($sp)
/* 45074 80069C74 24A50002 */  addiu     $a1, $a1, 0x2
/* 45078 80069C78 00623021 */  addu      $a2, $v1, $v0
/* 4507C 80069C7C 00021027 */  nor       $v0, $zero, $v0
/* 45080 80069C80 00822021 */  addu      $a0, $a0, $v0
/* 45084 80069C84 00A7102B */  sltu      $v0, $a1, $a3
/* 45088 80069C88 A7A60050 */  sh        $a2, 0x50($sp)
/* 4508C 80069C8C 1440FFF6 */  bnez      $v0, .L80069C68
/* 45090 80069C90 A7A40052 */   sh       $a0, 0x52($sp)
/* 45094 80069C94 97A3002C */  lhu       $v1, 0x2C($sp)
/* 45098 80069C98 30C2FFFF */  andi      $v0, $a2, 0xFFFF
/* 4509C 80069C9C 14620005 */  bne       $v1, $v0, .L80069CB4
/* 450A0 80069CA0 27B10010 */   addiu    $s1, $sp, 0x10
/* 450A4 80069CA4 97A3002E */  lhu       $v1, 0x2E($sp)
/* 450A8 80069CA8 3082FFFF */  andi      $v0, $a0, 0xFFFF
/* 450AC 80069CAC 10620013 */  beq       $v1, $v0, .L80069CFC
/* 450B0 80069CB0 00000000 */   nop
.L80069CB4:
/* 450B4 80069CB4 02002021 */  addu      $a0, $s0, $zero
/* 450B8 80069CB8 0C01A6A9 */  jal       __osCheckPackId
/* 450BC 80069CBC 02202821 */   addu     $a1, $s1, $zero
/* 450C0 80069CC0 00401821 */  addu      $v1, $v0, $zero
/* 450C4 80069CC4 2402000A */  addiu     $v0, $zero, 0xA
/* 450C8 80069CC8 1462000A */  bne       $v1, $v0, .L80069CF4
/* 450CC 80069CCC 02002021 */   addu     $a0, $s0, $zero
/* 450D0 80069CD0 02202821 */  addu      $a1, $s1, $zero
/* 450D4 80069CD4 27B10030 */  addiu     $s1, $sp, 0x30
/* 450D8 80069CD8 0C01A5EE */  jal       __osRepairPackId
/* 450DC 80069CDC 02203021 */   addu     $a2, $s1, $zero
/* 450E0 80069CE0 00401821 */  addu      $v1, $v0, $zero
/* 450E4 80069CE4 10600005 */  beqz      $v1, .L80069CFC
/* 450E8 80069CE8 00000000 */   nop
/* 450EC 80069CEC 0801A770 */  j         .L80069DC0
/* 450F0 80069CF0 00000000 */   nop
.L80069CF4:
/* 450F4 80069CF4 14600032 */  bnez      $v1, .L80069DC0
/* 450F8 80069CF8 00601021 */   addu     $v0, $v1, $zero
.L80069CFC:
/* 450FC 80069CFC 96220018 */  lhu       $v0, 0x18($s1)
/* 45100 80069D00 30420001 */  andi      $v0, $v0, 0x1
/* 45104 80069D04 1440000F */  bnez      $v0, .L80069D44
/* 45108 80069D08 02202021 */   addu     $a0, $s1, $zero
/* 4510C 80069D0C 02002021 */  addu      $a0, $s0, $zero
/* 45110 80069D10 02202821 */  addu      $a1, $s1, $zero
/* 45114 80069D14 27B10030 */  addiu     $s1, $sp, 0x30
/* 45118 80069D18 0C01A5EE */  jal       __osRepairPackId
/* 4511C 80069D1C 02203021 */   addu     $a2, $s1, $zero
/* 45120 80069D20 00401821 */  addu      $v1, $v0, $zero
/* 45124 80069D24 14600026 */  bnez      $v1, .L80069DC0
/* 45128 80069D28 00000000 */   nop
/* 4512C 80069D2C 97A20048 */  lhu       $v0, 0x48($sp)
/* 45130 80069D30 30420001 */  andi      $v0, $v0, 0x1
/* 45134 80069D34 14400003 */  bnez      $v0, .L80069D44
/* 45138 80069D38 02202021 */   addu     $a0, $s1, $zero
/* 4513C 80069D3C 0801A770 */  j         .L80069DC0
/* 45140 80069D40 2402000B */   addiu    $v0, $zero, 0xB
.L80069D44:
/* 45144 80069D44 2605000C */  addiu     $a1, $s0, 0xC
/* 45148 80069D48 0C019194 */  jal       bcopy
/* 4514C 80069D4C 24060020 */   addiu    $a2, $zero, 0x20
/* 45150 80069D50 8E040004 */  lw        $a0, 0x4($s0)
/* 45154 80069D54 8E050008 */  lw        $a1, 0x8($s0)
/* 45158 80069D58 9222001B */  lbu       $v0, 0x1B($s1)
/* 4515C 80069D5C 24060007 */  addiu     $a2, $zero, 0x7
/* 45160 80069D60 AE02004C */  sw        $v0, 0x4C($s0)
/* 45164 80069D64 9223001A */  lbu       $v1, 0x1A($s1)
/* 45168 80069D68 2607002C */  addiu     $a3, $s0, 0x2C
/* 4516C 80069D6C 24020010 */  addiu     $v0, $zero, 0x10
/* 45170 80069D70 AE020050 */  sw        $v0, 0x50($s0)
/* 45174 80069D74 24020008 */  addiu     $v0, $zero, 0x8
/* 45178 80069D78 AE020054 */  sw        $v0, 0x54($s0)
/* 4517C 80069D7C A2030064 */  sb        $v1, 0x64($s0)
/* 45180 80069D80 92020064 */  lbu       $v0, 0x64($s0)
/* 45184 80069D84 00031840 */  sll       $v1, $v1, 1
/* 45188 80069D88 24630003 */  addiu     $v1, $v1, 0x3
/* 4518C 80069D8C AE030060 */  sw        $v1, 0x60($s0)
/* 45190 80069D90 92030064 */  lbu       $v1, 0x64($s0)
/* 45194 80069D94 24420001 */  addiu     $v0, $v0, 0x1
/* 45198 80069D98 000210C0 */  sll       $v0, $v0, 3
/* 4519C 80069D9C 000318C0 */  sll       $v1, $v1, 3
/* 451A0 80069DA0 AE020058 */  sw        $v0, 0x58($s0)
/* 451A4 80069DA4 00431021 */  addu      $v0, $v0, $v1
/* 451A8 80069DA8 0C01A874 */  jal       __osContRamRead
/* 451AC 80069DAC AE02005C */   sw       $v0, 0x5C($s0)
/* 451B0 80069DB0 00401821 */  addu      $v1, $v0, $zero
/* 451B4 80069DB4 0003102B */  sltu      $v0, $zero, $v1
/* 451B8 80069DB8 00021023 */  negu      $v0, $v0
/* 451BC 80069DBC 00621024 */  and       $v0, $v1, $v0
.L80069DC0:
/* 451C0 80069DC0 8FBF0060 */  lw        $ra, 0x60($sp)
/* 451C4 80069DC4 8FB1005C */  lw        $s1, 0x5C($sp)
/* 451C8 80069DC8 8FB00058 */  lw        $s0, 0x58($sp)
/* 451CC 80069DCC 03E00008 */  jr        $ra
/* 451D0 80069DD0 27BD0068 */   addiu    $sp, $sp, 0x68

### DECOMPILED C INSTRUCTIONS:

s32 __osGetId(OSPfs *pfs) {
    int k;
    u16 sum;
    u16 isum;
    u8 temp[BLOCKSIZE];
    __OSPackId newid;
    s32 ret;
    __OSPackId *id;

    SET_ACTIVEBANK_TO_ZERO;
    ERRCK(__osContRamRead(pfs->queue, pfs->channel, 1, (u8*)temp));
    __osIdCheckSum((u16*)temp, &sum, &isum);
    id = (__OSPackId*)temp;
    if (id->checksum != sum || id->inverted_checksum != isum) {
        ret = __osCheckPackId(pfs, id);
        if (ret == PFS_ERR_ID_FATAL) {
            ERRCK(__osRepairPackId(pfs, id, &newid));
            id = &newid;
        } else if (ret != 0) {
            return ret;
        }
    }
    if ((id->deviceid & 1) == 0) {  //TODO: remove magic constant
        ERRCK(__osRepairPackId(pfs, id, &newid));
        id = &newid;
        if ((id->deviceid & 1) == 0) {
            return PFS_ERR_DEVICE;
        }
    }
    bcopy(id, pfs->id, ARRAY_COUNT(pfs->id));
    pfs->version = id->version;
    pfs->banks = id->banks;
    pfs->inode_start_page = pfs->banks * 2 + 3; //TODO: loads of magic constants..
    pfs->dir_size = 16;
    pfs->inode_table = 8;
    pfs->minode_table = (pfs->banks + 1) * PFS_ONE_PAGE;
    pfs->dir_table = pfs->minode_table + pfs->banks * PFS_ONE_PAGE;
    ERRCK(__osContRamRead(pfs->queue, pfs->channel, 7, pfs->label));
    return 0;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel npc_test_move_without_slipping
/* 76DAC 800DD8FC 27BDFF68 */  addiu     $sp, $sp, -0x98
/* 76DB0 800DD900 C7AC00AC */  lwc1      $f12, 0xAC($sp)
/* 76DB4 800DD904 3C0140C9 */  lui       $at, (0x40C90FD0 >> 16)
/* 76DB8 800DD908 34210FD0 */  ori       $at, $at, (0x40C90FD0 & 0xFFFF)
/* 76DBC 800DD90C 44810000 */  mtc1      $at, $f0
/* 76DC0 800DD910 AFB10064 */  sw        $s1, 0x64($sp)
/* 76DC4 800DD914 0080882D */  daddu     $s1, $a0, $zero
/* 76DC8 800DD918 AFB3006C */  sw        $s3, 0x6C($sp)
/* 76DCC 800DD91C 00A0982D */  daddu     $s3, $a1, $zero
/* 76DD0 800DD920 AFB00060 */  sw        $s0, 0x60($sp)
/* 76DD4 800DD924 00C0802D */  daddu     $s0, $a2, $zero
/* 76DD8 800DD928 AFB40070 */  sw        $s4, 0x70($sp)
/* 76DDC 800DD92C 00E0A02D */  daddu     $s4, $a3, $zero
/* 76DE0 800DD930 F7B60080 */  sdc1      $f22, 0x80($sp)
/* 76DE4 800DD934 C7B600A8 */  lwc1      $f22, 0xA8($sp)
/* 76DE8 800DD938 27A50038 */  addiu     $a1, $sp, 0x38
/* 76DEC 800DD93C F7B40078 */  sdc1      $f20, 0x78($sp)
/* 76DF0 800DD940 C7B400B0 */  lwc1      $f20, 0xB0($sp)
/* 76DF4 800DD944 46006302 */  mul.s     $f12, $f12, $f0
/* 76DF8 800DD948 00000000 */  nop
/* 76DFC 800DD94C 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
/* 76E00 800DD950 44810000 */  mtc1      $at, $f0
/* 76E04 800DD954 27A6003C */  addiu     $a2, $sp, 0x3C
/* 76E08 800DD958 AFBF0074 */  sw        $ra, 0x74($sp)
/* 76E0C 800DD95C AFB20068 */  sw        $s2, 0x68($sp)
/* 76E10 800DD960 F7BA0090 */  sdc1      $f26, 0x90($sp)
/* 76E14 800DD964 F7B80088 */  sdc1      $f24, 0x88($sp)
/* 76E18 800DD968 0C00A82D */  jal       sin_cos_rad
/* 76E1C 800DD96C 46006303 */   div.s    $f12, $f12, $f0
/* 76E20 800DD970 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* 76E24 800DD974 44813000 */  mtc1      $at, $f6
/* 76E28 800DD978 00000000 */  nop
/* 76E2C 800DD97C 4606A082 */  mul.s     $f2, $f20, $f6
/* 76E30 800DD980 00000000 */  nop
/* 76E34 800DD984 4614B000 */  add.s     $f0, $f22, $f20
/* 76E38 800DD988 46020600 */  add.s     $f24, $f0, $f2
/* 76E3C 800DD98C C7A00038 */  lwc1      $f0, 0x38($sp)
/* 76E40 800DD990 4600B682 */  mul.s     $f26, $f22, $f0
/* 76E44 800DD994 00000000 */  nop
/* 76E48 800DD998 2412FFFF */  addiu     $s2, $zero, -0x1
/* 76E4C 800DD99C 27A20040 */  addiu     $v0, $sp, 0x40
/* 76E50 800DD9A0 C7A2003C */  lwc1      $f2, 0x3C($sp)
/* 76E54 800DD9A4 46001087 */  neg.s     $f2, $f2
/* 76E58 800DD9A8 4600A102 */  mul.s     $f4, $f20, $f0
/* 76E5C 800DD9AC 00000000 */  nop
/* 76E60 800DD9B0 E7A2003C */  swc1      $f2, 0x3C($sp)
/* 76E64 800DD9B4 E7B8004C */  swc1      $f24, 0x4C($sp)
/* 76E68 800DD9B8 C6680000 */  lwc1      $f8, 0x0($s3)
/* 76E6C 800DD9BC C68A0000 */  lwc1      $f10, 0x0($s4)
/* 76E70 800DD9C0 4602A502 */  mul.s     $f20, $f20, $f2
/* 76E74 800DD9C4 00000000 */  nop
/* 76E78 800DD9C8 AFA2001C */  sw        $v0, 0x1C($sp)
/* 76E7C 800DD9CC 27A20044 */  addiu     $v0, $sp, 0x44
/* 76E80 800DD9D0 AFA20020 */  sw        $v0, 0x20($sp)
/* 76E84 800DD9D4 27A20048 */  addiu     $v0, $sp, 0x48
/* 76E88 800DD9D8 AFA20024 */  sw        $v0, 0x24($sp)
/* 76E8C 800DD9DC 27A2004C */  addiu     $v0, $sp, 0x4C
/* 76E90 800DD9E0 46062102 */  mul.s     $f4, $f4, $f6
/* 76E94 800DD9E4 00000000 */  nop
/* 76E98 800DD9E8 AFA20028 */  sw        $v0, 0x28($sp)
/* 76E9C 800DD9EC 27A20050 */  addiu     $v0, $sp, 0x50
/* 76EA0 800DD9F0 AFA2002C */  sw        $v0, 0x2C($sp)
/* 76EA4 800DD9F4 27A20054 */  addiu     $v0, $sp, 0x54
/* 76EA8 800DD9F8 4606A502 */  mul.s     $f20, $f20, $f6
/* 76EAC 800DD9FC 00000000 */  nop
/* 76EB0 800DDA00 AFA20030 */  sw        $v0, 0x30($sp)
/* 76EB4 800DDA04 27A20058 */  addiu     $v0, $sp, 0x58
/* 76EB8 800DDA08 E7A00010 */  swc1      $f0, 0x10($sp)
/* 76EBC 800DDA0C AFA00014 */  sw        $zero, 0x14($sp)
/* 76EC0 800DDA10 46044201 */  sub.s     $f8, $f8, $f4
/* 76EC4 800DDA14 E7A20018 */  swc1      $f2, 0x18($sp)
/* 76EC8 800DDA18 AFA20034 */  sw        $v0, 0x34($sp)
/* 76ECC 800DDA1C 46145281 */  sub.s     $f10, $f10, $f20
/* 76ED0 800DDA20 8E060000 */  lw        $a2, 0x0($s0)
/* 76ED4 800DDA24 44054000 */  mfc1      $a1, $f8
/* 76ED8 800DDA28 44075000 */  mfc1      $a3, $f10
/* 76EDC 800DDA2C 4602B582 */  mul.s     $f22, $f22, $f2
/* 76EE0 800DDA30 00000000 */  nop
/* 76EE4 800DDA34 0C037513 */  jal       npc_raycast_general
/* 76EE8 800DDA38 0220202D */   daddu    $a0, $s1, $zero
/* 76EEC 800DDA3C 04400016 */  bltz      $v0, .L800DDA98
/* 76EF0 800DDA40 00000000 */   nop
/* 76EF4 800DDA44 C7A4004C */  lwc1      $f4, 0x4C($sp)
/* 76EF8 800DDA48 4618203E */  c.le.s    $f4, $f24
/* 76EFC 800DDA4C 00000000 */  nop
/* 76F00 800DDA50 45000011 */  bc1f      .L800DDA98
/* 76F04 800DDA54 00000000 */   nop
/* 76F08 800DDA58 46182101 */  sub.s     $f4, $f4, $f24
/* 76F0C 800DDA5C C7A00038 */  lwc1      $f0, 0x38($sp)
/* 76F10 800DDA60 46002002 */  mul.s     $f0, $f4, $f0
/* 76F14 800DDA64 00000000 */  nop
/* 76F18 800DDA68 C6620000 */  lwc1      $f2, 0x0($s3)
/* 76F1C 800DDA6C 46001080 */  add.s     $f2, $f2, $f0
/* 76F20 800DDA70 C7A0003C */  lwc1      $f0, 0x3C($sp)
/* 76F24 800DDA74 46002102 */  mul.s     $f4, $f4, $f0
/* 76F28 800DDA78 00000000 */  nop
/* 76F2C 800DDA7C E6620000 */  swc1      $f2, 0x0($s3)
/* 76F30 800DDA80 C6800000 */  lwc1      $f0, 0x0($s4)
/* 76F34 800DDA84 46040000 */  add.s     $f0, $f0, $f4
/* 76F38 800DDA88 0040902D */  daddu     $s2, $v0, $zero
/* 76F3C 800DDA8C E6800000 */  swc1      $f0, 0x0($s4)
/* 76F40 800DDA90 3C018011 */  lui       $at, %hi(NpcHitQueryColliderID)
/* 76F44 800DDA94 AC32C978 */  sw        $s2, %lo(NpcHitQueryColliderID)($at)
.L800DDA98:
/* 76F48 800DDA98 C6600000 */  lwc1      $f0, 0x0($s3)
/* 76F4C 800DDA9C 461A0000 */  add.s     $f0, $f0, $f26
/* 76F50 800DDAA0 E6600000 */  swc1      $f0, 0x0($s3)
/* 76F54 800DDAA4 C6800000 */  lwc1      $f0, 0x0($s4)
/* 76F58 800DDAA8 46160000 */  add.s     $f0, $f0, $f22
/* 76F5C 800DDAAC 0240102D */  daddu     $v0, $s2, $zero
/* 76F60 800DDAB0 E6800000 */  swc1      $f0, 0x0($s4)
/* 76F64 800DDAB4 8FBF0074 */  lw        $ra, 0x74($sp)
/* 76F68 800DDAB8 8FB40070 */  lw        $s4, 0x70($sp)
/* 76F6C 800DDABC 8FB3006C */  lw        $s3, 0x6C($sp)
/* 76F70 800DDAC0 8FB20068 */  lw        $s2, 0x68($sp)
/* 76F74 800DDAC4 8FB10064 */  lw        $s1, 0x64($sp)
/* 76F78 800DDAC8 8FB00060 */  lw        $s0, 0x60($sp)
/* 76F7C 800DDACC D7BA0090 */  ldc1      $f26, 0x90($sp)
/* 76F80 800DDAD0 D7B80088 */  ldc1      $f24, 0x88($sp)
/* 76F84 800DDAD4 D7B60080 */  ldc1      $f22, 0x80($sp)
/* 76F88 800DDAD8 D7B40078 */  ldc1      $f20, 0x78($sp)
/* 76F8C 800DDADC 03E00008 */  jr        $ra
/* 76F90 800DDAE0 27BD0098 */   addiu    $sp, $sp, 0x98

### DECOMPILED C INSTRUCTIONS:

s32 npc_test_move_without_slipping(s32 ignoreFlags, f32* x, f32* y, f32* z, f32 length, f32 yaw, f32 radius) {
    s32 ret = -1;
    f32 depth;
    f32 originalDepth;
    f32 dirY;
    f32 cosTheta;
    f32 hitNx, hitNy, hitNz;
    f32 hitX, hitY, hitZ;
    s32 hitID;
    f32 temp1;
    f32 temp2;

    sin_cos_rad(DEG_TO_RAD(yaw), &dirY, &cosTheta);
    cosTheta = -cosTheta;
    originalDepth = length + radius + (radius * 0.5f);
    depth = originalDepth;
    temp1 = length * dirY;
    temp2 = length * cosTheta;

    hitID = npc_raycast_general(ignoreFlags, *x - (radius * dirY * 0.5f), *y, *z - (radius * cosTheta * 0.5f), dirY,
                                0.0f, cosTheta, &hitX, &hitY, &hitZ, &depth, &hitNx, &hitNy, &hitNz);

    if (hitID >= 0 && depth <= originalDepth) {
        f32 depthDiff = depth - originalDepth;
        f32 cosThetaTemp = cosTheta; // needed to match

        *x += depthDiff * dirY;
        *z += depthDiff * cosThetaTemp;
        NpcHitQueryColliderID = hitID;
        ret = hitID;
    }

    *x += temp1;
    *z += temp2;
    return ret;
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_802597B0
/* 188090 802597B0 27BDFFD0 */  addiu     $sp, $sp, -0x30
/* 188094 802597B4 AFB1001C */  sw        $s1, 0x1C($sp)
/* 188098 802597B8 0080882D */  daddu     $s1, $a0, $zero
/* 18809C 802597BC AFB30024 */  sw        $s3, 0x24($sp)
/* 1880A0 802597C0 00A0982D */  daddu     $s3, $a1, $zero
/* 1880A4 802597C4 AFB20020 */  sw        $s2, 0x20($sp)
/* 1880A8 802597C8 00C0902D */  daddu     $s2, $a2, $zero
/* 1880AC 802597CC 240600FF */  addiu     $a2, $zero, 0xFF
/* 1880B0 802597D0 AFBF0028 */  sw        $ra, 0x28($sp)
/* 1880B4 802597D4 AFB00018 */  sw        $s0, 0x18($sp)
/* 1880B8 802597D8 86230098 */  lh        $v1, 0x98($s1)
/* 1880BC 802597DC 8E3000C0 */  lw        $s0, 0xC0($s1)
/* 1880C0 802597E0 0066102A */  slt       $v0, $v1, $a2
/* 1880C4 802597E4 10400003 */  beqz      $v0, .L802597F4
/* 1880C8 802597E8 0000202D */   daddu    $a0, $zero, $zero
/* 1880CC 802597EC 3C048000 */  lui       $a0, (0x80000000 >> 16)
/* 1880D0 802597F0 0060302D */  daddu     $a2, $v1, $zero
.L802597F4:
/* 1880D4 802597F4 8E220000 */  lw        $v0, 0x0($s1)
/* 1880D8 802597F8 30420100 */  andi      $v0, $v0, 0x100
/* 1880DC 802597FC 1040000C */  beqz      $v0, .L80259830
/* 1880E0 80259800 3C038080 */   lui      $v1, (0x80808081 >> 16)
/* 1880E4 80259804 34638081 */  ori       $v1, $v1, (0x80808081 & 0xFFFF)
/* 1880E8 80259808 00061100 */  sll       $v0, $a2, 4
/* 1880EC 8025980C 00461023 */  subu      $v0, $v0, $a2
/* 1880F0 80259810 000210C0 */  sll       $v0, $v0, 3
/* 1880F4 80259814 00430018 */  mult      $v0, $v1
/* 1880F8 80259818 3C048000 */  lui       $a0, (0x80000000 >> 16)
/* 1880FC 8025981C 00004010 */  mfhi      $t0
/* 188100 80259820 01021821 */  addu      $v1, $t0, $v0
/* 188104 80259824 000319C3 */  sra       $v1, $v1, 7
/* 188108 80259828 000217C3 */  sra       $v0, $v0, 31
/* 18810C 8025982C 00623023 */  subu      $a2, $v1, $v0
.L80259830:
/* 188110 80259830 92020768 */  lbu       $v0, 0x768($s0)
/* 188114 80259834 5040003F */  beql      $v0, $zero, .L80259934
/* 188118 80259838 AFB20010 */   sw       $s2, 0x10($sp)
/* 18811C 8025983C 96240088 */  lhu       $a0, 0x88($s1)
/* 188120 80259840 0C0B7830 */  jal       spr_get_player_palettes
/* 188124 80259844 00000000 */   nop
/* 188128 80259848 AE0206D0 */  sw        $v0, 0x6D0($s0)
/* 18812C 8025984C 0040202D */  daddu     $a0, $v0, $zero
/* 188130 80259850 A20006CD */  sb        $zero, 0x6CD($s0)
/* 188134 80259854 8C830000 */  lw        $v1, 0x0($a0)
/* 188138 80259858 2402FFFF */  addiu     $v0, $zero, -0x1
/* 18813C 8025985C 1062000C */  beq       $v1, $v0, .L80259890
/* 188140 80259860 00000000 */   nop
/* 188144 80259864 0080182D */  daddu     $v1, $a0, $zero
/* 188148 80259868 0040202D */  daddu     $a0, $v0, $zero
.L8025986C:
/* 18814C 8025986C 920206CD */  lbu       $v0, 0x6CD($s0)
/* 188150 80259870 24420001 */  addiu     $v0, $v0, 0x1
/* 188154 80259874 A20206CD */  sb        $v0, 0x6CD($s0)
/* 188158 80259878 00021600 */  sll       $v0, $v0, 24
/* 18815C 8025987C 00021583 */  sra       $v0, $v0, 22
/* 188160 80259880 00431021 */  addu      $v0, $v0, $v1
/* 188164 80259884 8C420000 */  lw        $v0, 0x0($v0)
/* 188168 80259888 1444FFF8 */  bne       $v0, $a0, .L8025986C
/* 18816C 8025988C 00000000 */   nop
.L80259890:
/* 188170 80259890 820206CD */  lb        $v0, 0x6CD($s0)
/* 188174 80259894 18400016 */  blez      $v0, .L802598F0
/* 188178 80259898 0000302D */   daddu    $a2, $zero, $zero
.L8025989C:
/* 18817C 8025989C 8E0206D0 */  lw        $v0, 0x6D0($s0)
/* 188180 802598A0 00061880 */  sll       $v1, $a2, 2
/* 188184 802598A4 00621821 */  addu      $v1, $v1, $v0
/* 188188 802598A8 00061140 */  sll       $v0, $a2, 5
/* 18818C 802598AC 8C630000 */  lw        $v1, 0x0($v1)
/* 188190 802598B0 10600009 */  beqz      $v1, .L802598D8
/* 188194 802598B4 02022821 */   addu     $a1, $s0, $v0
/* 188198 802598B8 0000202D */  daddu     $a0, $zero, $zero
.L802598BC:
/* 18819C 802598BC 94620000 */  lhu       $v0, 0x0($v1)
/* 1881A0 802598C0 24630002 */  addiu     $v1, $v1, 0x2
/* 1881A4 802598C4 24840001 */  addiu     $a0, $a0, 0x1
/* 1881A8 802598C8 A4A20000 */  sh        $v0, 0x0($a1)
/* 1881AC 802598CC 28820010 */  slti      $v0, $a0, 0x10
/* 1881B0 802598D0 1440FFFA */  bnez      $v0, .L802598BC
/* 1881B4 802598D4 24A50002 */   addiu    $a1, $a1, 0x2
.L802598D8:
/* 1881B8 802598D8 820206CD */  lb        $v0, 0x6CD($s0)
/* 1881BC 802598DC 24C60001 */  addiu     $a2, $a2, 0x1
/* 1881C0 802598E0 00C2102A */  slt       $v0, $a2, $v0
/* 1881C4 802598E4 1440FFED */  bnez      $v0, .L8025989C
/* 1881C8 802598E8 00000000 */   nop
/* 1881CC 802598EC 820206CD */  lb        $v0, 0x6CD($s0)
.L802598F0:
/* 1881D0 802598F0 1840000A */  blez      $v0, .L8025991C
/* 1881D4 802598F4 0000302D */   daddu    $a2, $zero, $zero
/* 1881D8 802598F8 0200202D */  daddu     $a0, $s0, $zero
/* 1881DC 802598FC 0200182D */  daddu     $v1, $s0, $zero
.L80259900:
/* 1881E0 80259900 AC6406D4 */  sw        $a0, 0x6D4($v1)
/* 1881E4 80259904 24840020 */  addiu     $a0, $a0, 0x20
/* 1881E8 80259908 820206CD */  lb        $v0, 0x6CD($s0)
/* 1881EC 8025990C 24C60001 */  addiu     $a2, $a2, 0x1
/* 1881F0 80259910 00C2102A */  slt       $v0, $a2, $v0
/* 1881F4 80259914 1440FFFA */  bnez      $v0, .L80259900
/* 1881F8 80259918 24630004 */   addiu    $v1, $v1, 0x4
.L8025991C:
/* 1881FC 8025991C 0220202D */  daddu     $a0, $s1, $zero
/* 188200 80259920 0260282D */  daddu     $a1, $s3, $zero
/* 188204 80259924 0C096657 */  jal       func_8025995C
/* 188208 80259928 0240302D */   daddu    $a2, $s2, $zero
/* 18820C 8025992C 08096650 */  j         .L80259940
/* 188210 80259930 00000000 */   nop
.L80259934:
/* 188214 80259934 0260282D */  daddu     $a1, $s3, $zero
/* 188218 80259938 0C0B7710 */  jal       spr_draw_player_sprite
/* 18821C 8025993C 0000382D */   daddu    $a3, $zero, $zero
.L80259940:
/* 188220 80259940 8FBF0028 */  lw        $ra, 0x28($sp)
/* 188224 80259944 8FB30024 */  lw        $s3, 0x24($sp)
/* 188228 80259948 8FB20020 */  lw        $s2, 0x20($sp)
/* 18822C 8025994C 8FB1001C */  lw        $s1, 0x1C($sp)
/* 188230 80259950 8FB00018 */  lw        $s0, 0x18($sp)
/* 188234 80259954 03E00008 */  jr        $ra
/* 188238 80259958 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

void func_802597B0(ActorPart* part, s32 yaw, Matrix4f mtx) {
    DecorationTable* decor = part->decorationTable;
    s32 opacity = 255;
    s32 idMask = 0;
    PAL_PTR src;
    PAL_PTR dest;
    s32 i, j;

    if (part->opacity < 255) {
        idMask = DRAW_SPRITE_OVERRIDE_ALPHA;
        opacity = part->opacity;
    }
    if (part->flags & ACTOR_PART_FLAG_100) {
        idMask = DRAW_SPRITE_OVERRIDE_ALPHA;
        opacity = (opacity * 120) / 255;
    }

    if (decor->unk_768 != 0) {
        decor->originalPalettesList = spr_get_player_palettes(part->currentAnimation >> 16);
        decor->originalPalettesCount = 0;

        while (decor->originalPalettesList[decor->originalPalettesCount] != (PAL_PTR) -1) {
            decor->originalPalettesCount++;
        }

        for (i = 0; i < decor->originalPalettesCount; i++) {
            src = decor->originalPalettesList[i];
            dest = decor->copiedPalettes[0][i];
            if (decor->originalPalettesList[i] != NULL) {
                for (j = 0; j < ARRAY_COUNT(decor->copiedPalettes[0][i]); j++) {
                    *dest = *src;
                    dest++;
                    src++;
                }
            }
        }
        for (i = 0; i < decor->originalPalettesCount; i++) {
            decor->adjustedPalettes[i] = decor->copiedPalettes[0][i];
        }
        func_8025995C(part, yaw, mtx);
    } else {
        spr_draw_player_sprite(PLAYER_SPRITE_MAIN | idMask, yaw, opacity, NULL, mtx);
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_80261DF4
/* 1906D4 80261DF4 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* 1906D8 80261DF8 AFB10014 */  sw        $s1, 0x14($sp)
/* 1906DC 80261DFC 0080882D */  daddu     $s1, $a0, $zero
/* 1906E0 80261E00 AFBF0018 */  sw        $ra, 0x18($sp)
/* 1906E4 80261E04 AFB00010 */  sw        $s0, 0x10($sp)
/* 1906E8 80261E08 8E2400AC */  lw        $a0, 0xAC($s1)
/* 1906EC 80261E0C 0C04C3D6 */  jal       get_item_entity
/* 1906F0 80261E10 00A0802D */   daddu    $s0, $a1, $zero
/* 1906F4 80261E14 12000003 */  beqz      $s0, .L80261E24
/* 1906F8 80261E18 0040202D */   daddu    $a0, $v0, $zero
/* 1906FC 80261E1C AE200070 */  sw        $zero, 0x70($s1)
/* 190700 80261E20 AE200074 */  sw        $zero, 0x74($s1)
.L80261E24:
/* 190704 80261E24 8E230074 */  lw        $v1, 0x74($s1)
/* 190708 80261E28 24050001 */  addiu     $a1, $zero, 0x1
/* 19070C 80261E2C 10650020 */  beq       $v1, $a1, .L80261EB0
/* 190710 80261E30 28620002 */   slti     $v0, $v1, 0x2
/* 190714 80261E34 10400005 */  beqz      $v0, .L80261E4C
/* 190718 80261E38 24020002 */   addiu    $v0, $zero, 0x2
/* 19071C 80261E3C 10600009 */  beqz      $v1, .L80261E64
/* 190720 80261E40 0000102D */   daddu    $v0, $zero, $zero
/* 190724 80261E44 080987E8 */  j         .L80261FA0
/* 190728 80261E48 00000000 */   nop
.L80261E4C:
/* 19072C 80261E4C 10620033 */  beq       $v1, $v0, .L80261F1C
/* 190730 80261E50 24020003 */   addiu    $v0, $zero, 0x3
/* 190734 80261E54 10620049 */  beq       $v1, $v0, .L80261F7C
/* 190738 80261E58 0000102D */   daddu    $v0, $zero, $zero
/* 19073C 80261E5C 080987E8 */  j         .L80261FA0
/* 190740 80261E60 00000000 */   nop
.L80261E64:
/* 190744 80261E64 8E220070 */  lw        $v0, 0x70($s1)
/* 190748 80261E68 2442FFFF */  addiu     $v0, $v0, -0x1
/* 19074C 80261E6C AE220070 */  sw        $v0, 0x70($s1)
/* 190750 80261E70 C480000C */  lwc1      $f0, 0xC($a0)
/* 190754 80261E74 44821000 */  mtc1      $v0, $f2
/* 190758 80261E78 00000000 */  nop
/* 19075C 80261E7C 468010A0 */  cvt.s.w   $f2, $f2
/* 190760 80261E80 46020000 */  add.s     $f0, $f0, $f2
/* 190764 80261E84 44801000 */  mtc1      $zero, $f2
/* 190768 80261E88 00000000 */  nop
/* 19076C 80261E8C 4602003C */  c.lt.s    $f0, $f2
/* 190770 80261E90 00000000 */  nop
/* 190774 80261E94 45000041 */  bc1f      .L80261F9C
/* 190778 80261E98 E480000C */   swc1     $f0, 0xC($a0)
/* 19077C 80261E9C 24020008 */  addiu     $v0, $zero, 0x8
/* 190780 80261EA0 E482000C */  swc1      $f2, 0xC($a0)
/* 190784 80261EA4 AE220070 */  sw        $v0, 0x70($s1)
/* 190788 80261EA8 080987E7 */  j         .L80261F9C
/* 19078C 80261EAC AE250074 */   sw       $a1, 0x74($s1)
.L80261EB0:
/* 190790 80261EB0 8E220070 */  lw        $v0, 0x70($s1)
/* 190794 80261EB4 2442FFFF */  addiu     $v0, $v0, -0x1
/* 190798 80261EB8 AE220070 */  sw        $v0, 0x70($s1)
/* 19079C 80261EBC C480000C */  lwc1      $f0, 0xC($a0)
/* 1907A0 80261EC0 44821000 */  mtc1      $v0, $f2
/* 1907A4 80261EC4 00000000 */  nop
/* 1907A8 80261EC8 468010A0 */  cvt.s.w   $f2, $f2
/* 1907AC 80261ECC 46020000 */  add.s     $f0, $f0, $f2
/* 1907B0 80261ED0 44802000 */  mtc1      $zero, $f4
/* 1907B4 80261ED4 E480000C */  swc1      $f0, 0xC($a0)
/* 1907B8 80261ED8 C4800008 */  lwc1      $f0, 0x8($a0)
/* 1907BC 80261EDC 3C013FF8 */  lui       $at, (0x3FF80000 >> 16)
/* 1907C0 80261EE0 44811800 */  mtc1      $at, $f3
/* 1907C4 80261EE4 44801000 */  mtc1      $zero, $f2
/* 1907C8 80261EE8 46000021 */  cvt.d.s   $f0, $f0
/* 1907CC 80261EEC 46220000 */  add.d     $f0, $f0, $f2
/* 1907D0 80261EF0 C482000C */  lwc1      $f2, 0xC($a0)
/* 1907D4 80261EF4 4604103C */  c.lt.s    $f2, $f4
/* 1907D8 80261EF8 46200020 */  cvt.s.d   $f0, $f0
/* 1907DC 80261EFC 45000027 */  bc1f      .L80261F9C
/* 1907E0 80261F00 E4800008 */   swc1     $f0, 0x8($a0)
/* 1907E4 80261F04 24020004 */  addiu     $v0, $zero, 0x4
/* 1907E8 80261F08 E484000C */  swc1      $f4, 0xC($a0)
/* 1907EC 80261F0C AE220070 */  sw        $v0, 0x70($s1)
/* 1907F0 80261F10 24020002 */  addiu     $v0, $zero, 0x2
/* 1907F4 80261F14 080987E7 */  j         .L80261F9C
/* 1907F8 80261F18 AE220074 */   sw       $v0, 0x74($s1)
.L80261F1C:
/* 1907FC 80261F1C 8E220070 */  lw        $v0, 0x70($s1)
/* 190800 80261F20 2442FFFF */  addiu     $v0, $v0, -0x1
/* 190804 80261F24 AE220070 */  sw        $v0, 0x70($s1)
/* 190808 80261F28 C480000C */  lwc1      $f0, 0xC($a0)
/* 19080C 80261F2C 44821000 */  mtc1      $v0, $f2
/* 190810 80261F30 00000000 */  nop
/* 190814 80261F34 468010A0 */  cvt.s.w   $f2, $f2
/* 190818 80261F38 46020000 */  add.s     $f0, $f0, $f2
/* 19081C 80261F3C 44802000 */  mtc1      $zero, $f4
D_80261F40:
/* 190820 80261F40 E480000C */  swc1      $f0, 0xC($a0)
/* 190824 80261F44 C4800008 */  lwc1      $f0, 0x8($a0)
/* 190828 80261F48 3C01802A */  lui       $at, %hi(D_8029D598)
/* 19082C 80261F4C D422D598 */  ldc1      $f2, %lo(D_8029D598)($at)
/* 190830 80261F50 46000021 */  cvt.d.s   $f0, $f0
/* 190834 80261F54 46220000 */  add.d     $f0, $f0, $f2
/* 190838 80261F58 C482000C */  lwc1      $f2, 0xC($a0)
/* 19083C 80261F5C 4604103C */  c.lt.s    $f2, $f4
/* 190840 80261F60 46200020 */  cvt.s.d   $f0, $f0
/* 190844 80261F64 4500000D */  bc1f      .L80261F9C
/* 190848 80261F68 E4800008 */   swc1     $f0, 0x8($a0)
/* 19084C 80261F6C 24020003 */  addiu     $v0, $zero, 0x3
/* 190850 80261F70 E484000C */  swc1      $f4, 0xC($a0)
/* 190854 80261F74 080987E7 */  j         .L80261F9C
/* 190858 80261F78 AE220074 */   sw       $v0, 0x74($s1)
.L80261F7C:
/* 19085C 80261F7C 24020002 */  addiu     $v0, $zero, 0x2
/* 190860 80261F80 3C04802A */  lui       $a0, %hi(D_8029FBB0)
/* 190864 80261F84 2484FBB0 */  addiu     $a0, $a0, %lo(D_8029FBB0)
/* 190868 80261F88 24030014 */  addiu     $v1, $zero, 0x14
/* 19086C 80261F8C AC830000 */  sw        $v1, 0x0($a0)
/* 190870 80261F90 AC830004 */  sw        $v1, 0x4($a0)
/* 190874 80261F94 080987E8 */  j         .L80261FA0
/* 190878 80261F98 AC830008 */   sw       $v1, 0x8($a0)
.L80261F9C:
/* 19087C 80261F9C 0000102D */  daddu     $v0, $zero, $zero
.L80261FA0:
/* 190880 80261FA0 8FBF0018 */  lw        $ra, 0x18($sp)
/* 190884 80261FA4 8FB10014 */  lw        $s1, 0x14($sp)
/* 190888 80261FA8 8FB00010 */  lw        $s0, 0x10($sp)
/* 19088C 80261FAC 03E00008 */  jr        $ra
/* 190890 80261FB0 27BD0020 */   addiu    $sp, $sp, 0x20

### DECOMPILED C INSTRUCTIONS:

API_CALLABLE(func_80261DF4) {
    ItemEntity* item = get_item_entity(script->varTable[10]);

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

    switch (script->functionTemp[1]) {
        case 0:
            script->functionTemp[0]--;
            item->position.y += script->functionTemp[0];
            if (item->position.y < 0.0f) {
                item->position.y = 0.0f;
                script->functionTemp[0] = 8;
                script->functionTemp[1] = 1;
            }
            break;
        case 1:
            script->functionTemp[0]--;
            item->position.y += script->functionTemp[0];
            item->position.x += 1.5;
            if (item->position.y < 0.0f) {
                item->position.y = 0.0f;
                script->functionTemp[0] = 4;
                script->functionTemp[1] = 2;
            }
            break;
        case 2:
            script->functionTemp[0]--;
            item->position.y += script->functionTemp[0];
            item->position.x += 1.2;
            if (item->position.y < 0.0f) {
                item->position.y = 0.0f;
                script->functionTemp[1] = 3;
            }
            break;
        case 3:
            D_8029FBB0[0] = 20;
            D_8029FBB0[1] = 20;
            D_8029FBB0[2] = 20;
            return ApiStatus_DONE2;
    }
    return ApiStatus_BLOCK;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel snaking_static_main
/* 3B2350 E00AE000 27BDFFA8 */  addiu     $sp, $sp, -0x58
/* 3B2354 E00AE004 F7B40040 */  sdc1      $f20, 0x40($sp)
/* 3B2358 E00AE008 4485A000 */  mtc1      $a1, $f20
/* 3B235C E00AE00C F7B60048 */  sdc1      $f22, 0x48($sp)
/* 3B2360 E00AE010 4486B000 */  mtc1      $a2, $f22
/* 3B2364 E00AE014 AFB30034 */  sw        $s3, 0x34($sp)
/* 3B2368 E00AE018 0080982D */  daddu     $s3, $a0, $zero
/* 3B236C E00AE01C F7B80050 */  sdc1      $f24, 0x50($sp)
/* 3B2370 E00AE020 4487C000 */  mtc1      $a3, $f24
/* 3B2374 E00AE024 27A40010 */  addiu     $a0, $sp, 0x10
/* 3B2378 E00AE028 AFB20030 */  sw        $s2, 0x30($sp)
/* 3B237C E00AE02C 8FB2006C */  lw        $s2, 0x6C($sp)
/* 3B2380 E00AE030 3C02E00B */  lui       $v0, %hi(snaking_static_init)
/* 3B2384 E00AE034 2442E1AC */  addiu     $v0, $v0, %lo(snaking_static_init)
/* 3B2388 E00AE038 AFA20018 */  sw        $v0, 0x18($sp)
/* 3B238C E00AE03C 3C02E00B */  lui       $v0, %hi(snaking_static_update)
/* 3B2390 E00AE040 2442E1B4 */  addiu     $v0, $v0, %lo(snaking_static_update)
/* 3B2394 E00AE044 AFA2001C */  sw        $v0, 0x1C($sp)
/* 3B2398 E00AE048 3C02E00B */  lui       $v0, %hi(snaking_static_render)
/* 3B239C E00AE04C 2442E4FC */  addiu     $v0, $v0, %lo(snaking_static_render)
/* 3B23A0 E00AE050 AFA20020 */  sw        $v0, 0x20($sp)
/* 3B23A4 E00AE054 24020057 */  addiu     $v0, $zero, 0x57
/* 3B23A8 E00AE058 AFBF0038 */  sw        $ra, 0x38($sp)
/* 3B23AC E00AE05C AFB1002C */  sw        $s1, 0x2C($sp)
/* 3B23B0 E00AE060 AFB00028 */  sw        $s0, 0x28($sp)
/* 3B23B4 E00AE064 AFA00010 */  sw        $zero, 0x10($sp)
/* 3B23B8 E00AE068 AFA00024 */  sw        $zero, 0x24($sp)
/* 3B23BC E00AE06C 0C080124 */  jal       shim_create_effect_instance
/* 3B23C0 E00AE070 AFA20014 */   sw       $v0, 0x14($sp)
/* 3B23C4 E00AE074 240405D8 */  addiu     $a0, $zero, 0x5D8
/* 3B23C8 E00AE078 24110016 */  addiu     $s1, $zero, 0x16
/* 3B23CC E00AE07C 0040802D */  daddu     $s0, $v0, $zero
/* 3B23D0 E00AE080 0C08012C */  jal       shim_general_heap_malloc
/* 3B23D4 E00AE084 AE110008 */   sw       $s1, 0x8($s0)
/* 3B23D8 E00AE088 0040202D */  daddu     $a0, $v0, $zero
/* 3B23DC E00AE08C 14800003 */  bnez      $a0, .LE00AE09C
/* 3B23E0 E00AE090 AE04000C */   sw       $a0, 0xC($s0)
.LE00AE094:
/* 3B23E4 E00AE094 0802B825 */  j         .LE00AE094
/* 3B23E8 E00AE098 00000000 */   nop
.LE00AE09C:
/* 3B23EC E00AE09C AC930000 */  sw        $s3, 0x0($a0)
/* 3B23F0 E00AE0A0 1E400004 */  bgtz      $s2, .LE00AE0B4
/* 3B23F4 E00AE0A4 AC800014 */   sw       $zero, 0x14($a0)
/* 3B23F8 E00AE0A8 240203E8 */  addiu     $v0, $zero, 0x3E8
/* 3B23FC E00AE0AC 0802B82E */  j         .LE00AE0B8
/* 3B2400 E00AE0B0 AC820010 */   sw       $v0, 0x10($a0)
.LE00AE0B4:
/* 3B2404 E00AE0B4 AC920010 */  sw        $s2, 0x10($a0)
.LE00AE0B8:
/* 3B2408 E00AE0B8 240300FF */  addiu     $v1, $zero, 0xFF
/* 3B240C E00AE0BC 240200E6 */  addiu     $v0, $zero, 0xE6
/* 3B2410 E00AE0C0 AC800024 */  sw        $zero, 0x24($a0)
/* 3B2414 E00AE0C4 E4940004 */  swc1      $f20, 0x4($a0)
/* 3B2418 E00AE0C8 E4960008 */  swc1      $f22, 0x8($a0)
/* 3B241C E00AE0CC E498000C */  swc1      $f24, 0xC($a0)
/* 3B2420 E00AE0D0 C7A00068 */  lwc1      $f0, 0x68($sp)
/* 3B2424 E00AE0D4 24060001 */  addiu     $a2, $zero, 0x1
/* 3B2428 E00AE0D8 AC82001C */  sw        $v0, 0x1C($a0)
/* 3B242C E00AE0DC 00D1102A */  slt       $v0, $a2, $s1
/* 3B2430 E00AE0E0 AC830018 */  sw        $v1, 0x18($a0)
/* 3B2434 E00AE0E4 AC800020 */  sw        $zero, 0x20($a0)
/* 3B2438 E00AE0E8 AC830028 */  sw        $v1, 0x28($a0)
/* 3B243C E00AE0EC AC83002C */  sw        $v1, 0x2C($a0)
/* 3B2440 E00AE0F0 AC830030 */  sw        $v1, 0x30($a0)
/* 3B2444 E00AE0F4 E4800038 */  swc1      $f0, 0x38($a0)
/* 3B2448 E00AE0F8 10400021 */  beqz      $v0, .LE00AE180
/* 3B244C E00AE0FC 24840044 */   addiu    $a0, $a0, 0x44
/* 3B2450 E00AE100 24080014 */  addiu     $t0, $zero, 0x14
/* 3B2454 E00AE104 2627FFFF */  addiu     $a3, $s1, -0x1
/* 3B2458 E00AE108 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 3B245C E00AE10C 44811000 */  mtc1      $at, $f2
/* 3B2460 E00AE110 24840040 */  addiu     $a0, $a0, 0x40
/* 3B2464 E00AE114 0000282D */  daddu     $a1, $zero, $zero
.LE00AE118:
/* 3B2468 E00AE118 14E00002 */  bnez      $a3, .LE00AE124
/* 3B246C E00AE11C 00A7001A */   div      $zero, $a1, $a3
/* 3B2470 E00AE120 0007000D */  break     7
.LE00AE124:
/* 3B2474 E00AE124 2401FFFF */  addiu     $at, $zero, -0x1
/* 3B2478 E00AE128 14E10004 */  bne       $a3, $at, .LE00AE13C
/* 3B247C E00AE12C 3C018000 */   lui      $at, (0x80000000 >> 16)
/* 3B2480 E00AE130 14A10002 */  bne       $a1, $at, .LE00AE13C
/* 3B2484 E00AE134 00000000 */   nop
/* 3B2488 E00AE138 0006000D */  break     6
.LE00AE13C:
/* 3B248C E00AE13C 00001812 */  mflo      $v1
/* 3B2490 E00AE140 24A50168 */  addiu     $a1, $a1, 0x168
/* 3B2494 E00AE144 30C2000F */  andi      $v0, $a2, 0xF
/* 3B2498 E00AE148 24C60001 */  addiu     $a2, $a2, 0x1
/* 3B249C E00AE14C AC820000 */  sw        $v0, 0x0($a0)
/* 3B24A0 E00AE150 00D1102A */  slt       $v0, $a2, $s1
/* 3B24A4 E00AE154 AC88FFD0 */  sw        $t0, -0x30($a0)
/* 3B24A8 E00AE158 AC80FFD4 */  sw        $zero, -0x2C($a0)
/* 3B24AC E00AE15C AC80FFC4 */  sw        $zero, -0x3C($a0)
/* 3B24B0 E00AE160 AC80FFC8 */  sw        $zero, -0x38($a0)
/* 3B24B4 E00AE164 E482FFF4 */  swc1      $f2, -0xC($a0)
/* 3B24B8 E00AE168 44830000 */  mtc1      $v1, $f0
/* 3B24BC E00AE16C 00000000 */  nop
/* 3B24C0 E00AE170 46800020 */  cvt.s.w   $f0, $f0
/* 3B24C4 E00AE174 E480FFFC */  swc1      $f0, -0x4($a0)
/* 3B24C8 E00AE178 1440FFE7 */  bnez      $v0, .LE00AE118
/* 3B24CC E00AE17C 24840044 */   addiu    $a0, $a0, 0x44
.LE00AE180:
/* 3B24D0 E00AE180 0200102D */  daddu     $v0, $s0, $zero
/* 3B24D4 E00AE184 8FBF0038 */  lw        $ra, 0x38($sp)
/* 3B24D8 E00AE188 8FB30034 */  lw        $s3, 0x34($sp)
/* 3B24DC E00AE18C 8FB20030 */  lw        $s2, 0x30($sp)
/* 3B24E0 E00AE190 8FB1002C */  lw        $s1, 0x2C($sp)
/* 3B24E4 E00AE194 8FB00028 */  lw        $s0, 0x28($sp)
/* 3B24E8 E00AE198 D7B80050 */  ldc1      $f24, 0x50($sp)
/* 3B24EC E00AE19C D7B60048 */  ldc1      $f22, 0x48($sp)
/* 3B24F0 E00AE1A0 D7B40040 */  ldc1      $f20, 0x40($sp)
/* 3B24F4 E00AE1A4 03E00008 */  jr        $ra
/* 3B24F8 E00AE1A8 27BD0058 */   addiu    $sp, $sp, 0x58

### DECOMPILED C INSTRUCTIONS:

EffectInstance* snaking_static_main(s32 arg0, f32 posX, f32 posY, f32 posZ, f32 arg4, s32 timeLeft) {
    EffectBlueprint effectBp;
    EffectInstance* effect;
    SnakingStaticFXData* data;
    s32 numParts = 22;
    s32 i;

    effectBp.init = snaking_static_init;
    effectBp.update = snaking_static_update;
    effectBp.renderWorld = snaking_static_render;
    effectBp.unk_00 = 0;
    effectBp.renderUI = NULL;
    effectBp.effectID = EFFECT_SNAKING_STATIC;

    effect = shim_create_effect_instance(&effectBp);
    effect->numParts = numParts;

    data = effect->data.snakingStatic = shim_general_heap_malloc(numParts * sizeof(*data));
    ASSERT(data != NULL);

    data->unk_00 = arg0;
    data->lifeTime = 0;

    if (timeLeft <= 0) {
        data->timeLeft = 1000;
    } else {
        data->timeLeft = timeLeft;
    }

    data->unk_24 = 0;
    data->pos.x = posX;
    data->pos.y = posY;
    data->pos.z = posZ;
    data->unk_38 = arg4;

    data->unk_18 = 255;
    data->unk_1C = 230;
    data->unk_20 = 0;

    data->unk_28 = 255;
    data->unk_2C = 255;
    data->unk_30 = 255;

    data++;
    for(i = 1; i < numParts; i++, data++) {
        data->timeLeft = 20;
        data->unk_3C = (i - 1) * 360 / (numParts - 1);
        data->lifeTime = 0;
        data->pos.x = 0;
        data->pos.y = 0;
        data->unk_34 = 1.0f;
        data->unk_40 = i & 15;
    }

    return effect;

}


### RAW ASSEMBLY INSTRUCTIONS:

glabel energy_orb_wave_main
/* 3A37E0 E00A4000 27BDFFA8 */  addiu     $sp, $sp, -0x58
/* 3A37E4 E00A4004 F7B60040 */  sdc1      $f22, 0x40($sp)
/* 3A37E8 E00A4008 4485B000 */  mtc1      $a1, $f22
/* 3A37EC E00A400C F7B80048 */  sdc1      $f24, 0x48($sp)
/* 3A37F0 E00A4010 4486C000 */  mtc1      $a2, $f24
/* 3A37F4 E00A4014 F7BA0050 */  sdc1      $f26, 0x50($sp)
/* 3A37F8 E00A4018 4487D000 */  mtc1      $a3, $f26
/* 3A37FC E00A401C AFB1002C */  sw        $s1, 0x2C($sp)
/* 3A3800 E00A4020 0080882D */  daddu     $s1, $a0, $zero
/* 3A3804 E00A4024 F7B40038 */  sdc1      $f20, 0x38($sp)
/* 3A3808 E00A4028 C7B40068 */  lwc1      $f20, 0x68($sp)
/* 3A380C E00A402C 27A40010 */  addiu     $a0, $sp, 0x10
/* 3A3810 E00A4030 AFB20030 */  sw        $s2, 0x30($sp)
/* 3A3814 E00A4034 8FB2006C */  lw        $s2, 0x6C($sp)
/* 3A3818 E00A4038 3C02E00A */  lui       $v0, %hi(energy_orb_wave_init)
/* 3A381C E00A403C 244241A4 */  addiu     $v0, $v0, %lo(energy_orb_wave_init)
/* 3A3820 E00A4040 AFA20018 */  sw        $v0, 0x18($sp)
/* 3A3824 E00A4044 3C02E00A */  lui       $v0, %hi(energy_orb_wave_update)
/* 3A3828 E00A4048 244241AC */  addiu     $v0, $v0, %lo(energy_orb_wave_update)
/* 3A382C E00A404C AFA2001C */  sw        $v0, 0x1C($sp)
/* 3A3830 E00A4050 3C02E00A */  lui       $v0, %hi(energy_orb_wave_render)
/* 3A3834 E00A4054 244245DC */  addiu     $v0, $v0, %lo(energy_orb_wave_render)
/* 3A3838 E00A4058 AFA20020 */  sw        $v0, 0x20($sp)
/* 3A383C E00A405C 24020052 */  addiu     $v0, $zero, 0x52
/* 3A3840 E00A4060 AFBF0034 */  sw        $ra, 0x34($sp)
/* 3A3844 E00A4064 AFB00028 */  sw        $s0, 0x28($sp)
/* 3A3848 E00A4068 AFA00010 */  sw        $zero, 0x10($sp)
/* 3A384C E00A406C AFA00024 */  sw        $zero, 0x24($sp)
/* 3A3850 E00A4070 0C080124 */  jal       shim_create_effect_instance
/* 3A3854 E00A4074 AFA20014 */   sw       $v0, 0x14($sp)
/* 3A3858 E00A4078 24040038 */  addiu     $a0, $zero, 0x38
/* 3A385C E00A407C 24030001 */  addiu     $v1, $zero, 0x1
/* 3A3860 E00A4080 0040802D */  daddu     $s0, $v0, $zero
/* 3A3864 E00A4084 0C08012C */  jal       shim_general_heap_malloc
/* 3A3868 E00A4088 AE030008 */   sw       $v1, 0x8($s0)
/* 3A386C E00A408C 0040182D */  daddu     $v1, $v0, $zero
/* 3A3870 E00A4090 14600003 */  bnez      $v1, .LE00A40A0
/* 3A3874 E00A4094 AE02000C */   sw       $v0, 0xC($s0)
.LE00A4098:
/* 3A3878 E00A4098 08029026 */  j         .LE00A4098
/* 3A387C E00A409C 00000000 */   nop
.LE00A40A0:
/* 3A3880 E00A40A0 AC710000 */  sw        $s1, 0x0($v1)
/* 3A3884 E00A40A4 1E400004 */  bgtz      $s2, .LE00A40B8
/* 3A3888 E00A40A8 AC600014 */   sw       $zero, 0x14($v1)
/* 3A388C E00A40AC 24020064 */  addiu     $v0, $zero, 0x64
/* 3A3890 E00A40B0 0802902F */  j         .LE00A40BC
/* 3A3894 E00A40B4 AC620010 */   sw       $v0, 0x10($v1)
.LE00A40B8:
/* 3A3898 E00A40B8 AC720010 */  sw        $s2, 0x10($v1)
.LE00A40BC:
/* 3A389C E00A40BC 2E220007 */  sltiu     $v0, $s1, 0x7
/* 3A38A0 E00A40C0 AC60002C */  sw        $zero, 0x2C($v1)
/* 3A38A4 E00A40C4 E4760004 */  swc1      $f22, 0x4($v1)
/* 3A38A8 E00A40C8 E4780008 */  swc1      $f24, 0x8($v1)
/* 3A38AC E00A40CC E47A000C */  swc1      $f26, 0xC($v1)
/* 3A38B0 E00A40D0 E4740030 */  swc1      $f20, 0x30($v1)
/* 3A38B4 E00A40D4 1040001B */  beqz      $v0, .LE00A4144
/* 3A38B8 E00A40D8 AC600018 */   sw       $zero, 0x18($v1)
/* 3A38BC E00A40DC 00111080 */  sll       $v0, $s1, 2
/* 3A38C0 E00A40E0 3C01E00A */  lui       $at, (0xE00A4AD0 >> 16)
/* 3A38C4 E00A40E4 00220821 */  addu      $at, $at, $v0
/* 3A38C8 E00A40E8 8C224AD0 */  lw        $v0, (0xE00A4AD0 & 0xFFFF)($at)
/* 3A38CC E00A40EC 00400008 */  jr        $v0
/* 3A38D0 E00A40F0 00000000 */   nop
/* 3A38D4 E00A40F4 0802905E */  j         .LE00A4178
/* 3A38D8 E00A40F8 AC60001C */   sw       $zero, 0x1C($v1)
/* 3A38DC E00A40FC 24020002 */  addiu     $v0, $zero, 0x2
/* 3A38E0 E00A4100 0802905E */  j         .LE00A4178
/* 3A38E4 E00A4104 AC62001C */   sw       $v0, 0x1C($v1)
/* 3A38E8 E00A4108 24020004 */  addiu     $v0, $zero, 0x4
/* 3A38EC E00A410C 0802905E */  j         .LE00A4178
/* 3A38F0 E00A4110 AC62001C */   sw       $v0, 0x1C($v1)
/* 3A38F4 E00A4114 24020006 */  addiu     $v0, $zero, 0x6
/* 3A38F8 E00A4118 0802905E */  j         .LE00A4178
/* 3A38FC E00A411C AC62001C */   sw       $v0, 0x1C($v1)
/* 3A3900 E00A4120 24020007 */  addiu     $v0, $zero, 0x7
/* 3A3904 E00A4124 0802905E */  j         .LE00A4178
/* 3A3908 E00A4128 AC62001C */   sw       $v0, 0x1C($v1)
/* 3A390C E00A412C 24020008 */  addiu     $v0, $zero, 0x8
/* 3A3910 E00A4130 0802905E */  j         .LE00A4178
/* 3A3914 E00A4134 AC62001C */   sw       $v0, 0x1C($v1)
/* 3A3918 E00A4138 24020009 */  addiu     $v0, $zero, 0x9
/* 3A391C E00A413C 0802905E */  j         .LE00A4178
/* 3A3920 E00A4140 AC62001C */   sw       $v0, 0x1C($v1)
.LE00A4144:
/* 3A3924 E00A4144 2402000A */  addiu     $v0, $zero, 0xA
/* 3A3928 E00A4148 3C01E00A */  lui       $at, (0xE00A4AF0 >> 16)
/* 3A392C E00A414C D4224AF0 */  ldc1      $f2, (0xE00A4AF0 & 0xFFFF)($at)
/* 3A3930 E00A4150 4600A021 */  cvt.d.s   $f0, $f20
/* 3A3934 E00A4154 46220001 */  sub.d     $f0, $f0, $f2
/* 3A3938 E00A4158 AC62001C */  sw        $v0, 0x1C($v1)
/* 3A393C E00A415C 44921000 */  mtc1      $s2, $f2
/* 3A3940 E00A4160 00000000 */  nop
/* 3A3944 E00A4164 468010A1 */  cvt.d.w   $f2, $f2
/* 3A3948 E00A4168 46200007 */  neg.d     $f0, $f0
/* 3A394C E00A416C 46220003 */  div.d     $f0, $f0, $f2
/* 3A3950 E00A4170 46200020 */  cvt.s.d   $f0, $f0
/* 3A3954 E00A4174 E4600034 */  swc1      $f0, 0x34($v1)
.LE00A4178:
/* 3A3958 E00A4178 0200102D */  daddu     $v0, $s0, $zero
/* 3A395C E00A417C 8FBF0034 */  lw        $ra, 0x34($sp)
/* 3A3960 E00A4180 8FB20030 */  lw        $s2, 0x30($sp)
/* 3A3964 E00A4184 8FB1002C */  lw        $s1, 0x2C($sp)
/* 3A3968 E00A4188 8FB00028 */  lw        $s0, 0x28($sp)
/* 3A396C E00A418C D7BA0050 */  ldc1      $f26, 0x50($sp)
/* 3A3970 E00A4190 D7B80048 */  ldc1      $f24, 0x48($sp)
/* 3A3974 E00A4194 D7B60040 */  ldc1      $f22, 0x40($sp)
/* 3A3978 E00A4198 D7B40038 */  ldc1      $f20, 0x38($sp)
/* 3A397C E00A419C 03E00008 */  jr        $ra
/* 3A3980 E00A41A0 27BD0058 */   addiu    $sp, $sp, 0x58

### DECOMPILED C INSTRUCTIONS:

EffectInstance* energy_orb_wave_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5) {
    EffectBlueprint bp;
    EffectInstance* effect;
    EnergyOrbWaveFXData* data;
    s32 numParts = 1;

    bp.init = energy_orb_wave_init;
    bp.update = energy_orb_wave_update;
    bp.renderWorld = energy_orb_wave_render;
    bp.unk_00 = 0;
    bp.renderUI = NULL;
    bp.effectID = EFFECT_ENERGY_ORB_WAVE;

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

    data->unk_00 = arg0;
    data->unk_14 = 0;
    if (arg5 <= 0) {
        data->unk_10 = 100;
    } else {
        data->unk_10 = arg5;
    }
    data->unk_2C = 0;
    data->pos.x = arg1;
    data->pos.y = arg2;
    data->pos.z = arg3;
    data->scale = arg4;
    data->unk_18 = 0;

    switch (arg0) {
        case 0:
            data->unk_1C = 0;
            break;
        case 1:
            data->unk_1C = 2;
            break;
        case 2:
            data->unk_1C = 4;
            break;
        case 3:
            data->unk_1C = 6;
            break;
        case 4:
            data->unk_1C = 7;
            break;
        case 5:
            data->unk_1C = 8;
            break;
        case 6:
            data->unk_1C = 9;
            break;
        default:
            data->unk_1C = 10;
            data->unk_34 = -(arg4 - 0.1) / arg5;
            break;
    }

    return effect;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel osCreateViManager
/* 41E70 80066A70 27BDFFD0 */  addiu     $sp, $sp, -0x30
/* 41E74 80066A74 AFB40028 */  sw        $s4, 0x28($sp)
/* 41E78 80066A78 3C148009 */  lui       $s4, %hi(D_80094680)
/* 41E7C 80066A7C 26944680 */  addiu     $s4, $s4, %lo(D_80094680)
/* 41E80 80066A80 AFBF002C */  sw        $ra, 0x2C($sp)
/* 41E84 80066A84 AFB30024 */  sw        $s3, 0x24($sp)
/* 41E88 80066A88 AFB20020 */  sw        $s2, 0x20($sp)
/* 41E8C 80066A8C AFB1001C */  sw        $s1, 0x1C($sp)
/* 41E90 80066A90 AFB00018 */  sw        $s0, 0x18($sp)
/* 41E94 80066A94 8E820000 */  lw        $v0, 0x0($s4)
/* 41E98 80066A98 14400055 */  bnez      $v0, .L80066BF0
/* 41E9C 80066A9C 00808821 */   addu     $s1, $a0, $zero
/* 41EA0 80066AA0 0C019920 */  jal       __osTimerServicesInit
/* 41EA4 80066AA4 2412FFFF */   addiu    $s2, $zero, -0x1
/* 41EA8 80066AA8 3C13800B */  lui       $s3, %hi(viEventQueue)
/* 41EAC 80066AAC 26730AD0 */  addiu     $s3, $s3, %lo(viEventQueue)
/* 41EB0 80066AB0 02602021 */  addu      $a0, $s3, $zero
/* 41EB4 80066AB4 3C05800B */  lui       $a1, %hi(viEventBuf)
/* 41EB8 80066AB8 24A50AE8 */  addiu     $a1, $a1, %lo(viEventBuf)
/* 41EBC 80066ABC 3C018009 */  lui       $at, %hi(D_8009469C)
/* 41EC0 80066AC0 AC20469C */  sw        $zero, %lo(D_8009469C)($at)
/* 41EC4 80066AC4 0C019560 */  jal       osCreateMesgQueue
/* 41EC8 80066AC8 24060005 */   addiu    $a2, $zero, 0x5
/* 41ECC 80066ACC 24040007 */  addiu     $a0, $zero, 0x7
/* 41ED0 80066AD0 3C06800B */  lui       $a2, %hi(viRetraceMsg)
/* 41ED4 80066AD4 24C60B00 */  addiu     $a2, $a2, %lo(viRetraceMsg)
/* 41ED8 80066AD8 2402000D */  addiu     $v0, $zero, 0xD
/* 41EDC 80066ADC 3C10800B */  lui       $s0, %hi(viCounterMsg)
/* 41EE0 80066AE0 26100B18 */  addiu     $s0, $s0, %lo(viCounterMsg)
/* 41EE4 80066AE4 A4C20000 */  sh        $v0, 0x0($a2)
/* 41EE8 80066AE8 2402000E */  addiu     $v0, $zero, 0xE
/* 41EEC 80066AEC 3C01800B */  lui       $at, %hi(D_800B0B02)
/* 41EF0 80066AF0 A0200B02 */  sb        $zero, %lo(D_800B0B02)($at)
/* 41EF4 80066AF4 3C01800B */  lui       $at, %hi(D_800B0B04)
/* 41EF8 80066AF8 AC200B04 */  sw        $zero, %lo(D_800B0B04)($at)
/* 41EFC 80066AFC A6020000 */  sh        $v0, 0x0($s0)
/* 41F00 80066B00 3C01800B */  lui       $at, %hi(D_800B0B1A)
/* 41F04 80066B04 A0200B1A */  sb        $zero, %lo(D_800B0B1A)($at)
/* 41F08 80066B08 3C01800B */  lui       $at, %hi(D_800B0B1C)
/* 41F0C 80066B0C AC200B1C */  sw        $zero, %lo(D_800B0B1C)($at)
/* 41F10 80066B10 0C019654 */  jal       osSetEventMesg
/* 41F14 80066B14 02602821 */   addu     $a1, $s3, $zero
/* 41F18 80066B18 24040003 */  addiu     $a0, $zero, 0x3
/* 41F1C 80066B1C 02602821 */  addu      $a1, $s3, $zero
/* 41F20 80066B20 0C019654 */  jal       osSetEventMesg
/* 41F24 80066B24 02003021 */   addu     $a2, $s0, $zero
/* 41F28 80066B28 0C0197CC */  jal       osGetThreadPri
/* 41F2C 80066B2C 00002021 */   addu     $a0, $zero, $zero
/* 41F30 80066B30 00401821 */  addu      $v1, $v0, $zero
/* 41F34 80066B34 0071102A */  slt       $v0, $v1, $s1
/* 41F38 80066B38 10400005 */  beqz      $v0, .L80066B50
/* 41F3C 80066B3C 00000000 */   nop
/* 41F40 80066B40 00609021 */  addu      $s2, $v1, $zero
/* 41F44 80066B44 00002021 */  addu      $a0, $zero, $zero
/* 41F48 80066B48 0C0197D4 */  jal       osSetThreadPri
/* 41F4C 80066B4C 02202821 */   addu     $a1, $s1, $zero
.L80066B50:
/* 41F50 80066B50 0C01ACD8 */  jal       __osDisableInt
/* 41F54 80066B54 00000000 */   nop
/* 41F58 80066B58 3C10800B */  lui       $s0, %hi(viThread)
/* 41F5C 80066B5C 2610F918 */  addiu     $s0, $s0, %lo(viThread)
/* 41F60 80066B60 02002021 */  addu      $a0, $s0, $zero
/* 41F64 80066B64 00002821 */  addu      $a1, $zero, $zero
/* 41F68 80066B68 3C068006 */  lui       $a2, %hi(viMgrMain)
/* 41F6C 80066B6C 24C66C10 */  addiu     $a2, $a2, %lo(viMgrMain)
/* 41F70 80066B70 24030001 */  addiu     $v1, $zero, 0x1
/* 41F74 80066B74 AE830000 */  sw        $v1, 0x0($s4)
/* 41F78 80066B78 3C03800B */  lui       $v1, %hi(viEventQueue)
/* 41F7C 80066B7C 24630AD0 */  addiu     $v1, $v1, %lo(viEventQueue)
/* 41F80 80066B80 AFB10014 */  sw        $s1, 0x14($sp)
/* 41F84 80066B84 00408821 */  addu      $s1, $v0, $zero
/* 41F88 80066B88 02803821 */  addu      $a3, $s4, $zero
/* 41F8C 80066B8C 3C018009 */  lui       $at, %hi(D_80094684)
/* 41F90 80066B90 AC304684 */  sw        $s0, %lo(D_80094684)($at)
/* 41F94 80066B94 3C018009 */  lui       $at, %hi(D_80094688)
/* 41F98 80066B98 AC334688 */  sw        $s3, %lo(D_80094688)($at)
/* 41F9C 80066B9C 3C018009 */  lui       $at, %hi(D_8009468C)
/* 41FA0 80066BA0 AC33468C */  sw        $s3, %lo(D_8009468C)($at)
/* 41FA4 80066BA4 3C018009 */  lui       $at, %hi(D_80094690)
/* 41FA8 80066BA8 AC204690 */  sw        $zero, %lo(D_80094690)($at)
/* 41FAC 80066BAC 3C018009 */  lui       $at, %hi(D_80094694)
/* 41FB0 80066BB0 AC204694 */  sw        $zero, %lo(D_80094694)($at)
/* 41FB4 80066BB4 3C018009 */  lui       $at, %hi(D_80094698)
/* 41FB8 80066BB8 AC204698 */  sw        $zero, %lo(D_80094698)($at)
/* 41FBC 80066BBC 0C019798 */  jal       osCreateThread
/* 41FC0 80066BC0 AFA30010 */   sw       $v1, 0x10($sp)
/* 41FC4 80066BC4 0C01B2A4 */  jal       __osViInit
/* 41FC8 80066BC8 00000000 */   nop
/* 41FCC 80066BCC 0C019808 */  jal       osStartThread
/* 41FD0 80066BD0 02002021 */   addu     $a0, $s0, $zero
/* 41FD4 80066BD4 0C01ACF4 */  jal       __osRestoreInt
/* 41FD8 80066BD8 02202021 */   addu     $a0, $s1, $zero
/* 41FDC 80066BDC 2402FFFF */  addiu     $v0, $zero, -0x1
/* 41FE0 80066BE0 12420003 */  beq       $s2, $v0, .L80066BF0
/* 41FE4 80066BE4 00002021 */   addu     $a0, $zero, $zero
/* 41FE8 80066BE8 0C0197D4 */  jal       osSetThreadPri
/* 41FEC 80066BEC 02402821 */   addu     $a1, $s2, $zero
.L80066BF0:
/* 41FF0 80066BF0 8FBF002C */  lw        $ra, 0x2C($sp)
/* 41FF4 80066BF4 8FB40028 */  lw        $s4, 0x28($sp)
/* 41FF8 80066BF8 8FB30024 */  lw        $s3, 0x24($sp)
/* 41FFC 80066BFC 8FB20020 */  lw        $s2, 0x20($sp)
/* 42000 80066C00 8FB1001C */  lw        $s1, 0x1C($sp)
/* 42004 80066C04 8FB00018 */  lw        $s0, 0x18($sp)
/* 42008 80066C08 03E00008 */  jr        $ra
/* 4200C 80066C0C 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

void osCreateViManager(OSPri pri) {
    u32 savedMask;
    OSPri myPri;
    OSPri oldPri;

    if (!__osViDevMgr.active) {
        __osTimerServicesInit();
        __additional_scanline = 0;
        osCreateMesgQueue(&viEventQueue, viEventBuf, ARRAY_COUNT(viEventBuf));
        viRetraceMsg.hdr.type = OS_MESG_TYPE_VRETRACE;
        viRetraceMsg.hdr.pri = OS_MESG_PRI_NORMAL;
        viRetraceMsg.hdr.retQueue = NULL;
        viCounterMsg.hdr.type = OS_MESG_TYPE_COUNTER;
        viCounterMsg.hdr.pri = OS_MESG_PRI_NORMAL;
        viCounterMsg.hdr.retQueue = NULL;
        osSetEventMesg(OS_EVENT_VI, &viEventQueue, &viRetraceMsg);
        osSetEventMesg(OS_EVENT_COUNTER, &viEventQueue, &viCounterMsg);
        oldPri = -1;
        myPri = osGetThreadPri(NULL);

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

        savedMask = __osDisableInt();
        __osViDevMgr.active = TRUE;
        __osViDevMgr.thread = &viThread;
        __osViDevMgr.cmdQueue = &viEventQueue;
        __osViDevMgr.evtQueue = &viEventQueue;
        __osViDevMgr.acsQueue = NULL;
        __osViDevMgr.dma = NULL;
        __osViDevMgr.edma = NULL;
        osCreateThread(&viThread, 0, viMgrMain, &__osViDevMgr, &viThreadStack[OS_VIM_STACKSIZE], pri);
        __osViInit();
        osStartThread(&viThread);
        __osRestoreInt(savedMask);

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


### RAW ASSEMBLY INSTRUCTIONS:

glabel osPfsFindFile
/* 441C0 80068DC0 27BDFFA0 */  addiu     $sp, $sp, -0x60
/* 441C4 80068DC4 AFB30044 */  sw        $s3, 0x44($sp)
/* 441C8 80068DC8 8FB30070 */  lw        $s3, 0x70($sp)
/* 441CC 80068DCC AFB00038 */  sw        $s0, 0x38($sp)
/* 441D0 80068DD0 00808021 */  addu      $s0, $a0, $zero
/* 441D4 80068DD4 AFBE0058 */  sw        $fp, 0x58($sp)
/* 441D8 80068DD8 00C0F021 */  addu      $fp, $a2, $zero
/* 441DC 80068DDC AFB20040 */  sw        $s2, 0x40($sp)
/* 441E0 80068DE0 00E09021 */  addu      $s2, $a3, $zero
/* 441E4 80068DE4 AFBF005C */  sw        $ra, 0x5C($sp)
/* 441E8 80068DE8 AFB70054 */  sw        $s7, 0x54($sp)
/* 441EC 80068DEC AFB60050 */  sw        $s6, 0x50($sp)
/* 441F0 80068DF0 AFB5004C */  sw        $s5, 0x4C($sp)
/* 441F4 80068DF4 AFB40048 */  sw        $s4, 0x48($sp)
/* 441F8 80068DF8 AFB1003C */  sw        $s1, 0x3C($sp)
/* 441FC 80068DFC 8E020000 */  lw        $v0, 0x0($s0)
/* 44200 80068E00 8FB40074 */  lw        $s4, 0x74($sp)
/* 44204 80068E04 30420001 */  andi      $v0, $v0, 0x1
/* 44208 80068E08 1040004E */  beqz      $v0, .L80068F44
/* 4420C 80068E0C 00A0B821 */   addu     $s7, $a1, $zero
/* 44210 80068E10 0C01A775 */  jal       __osCheckId
/* 44214 80068E14 02002021 */   addu     $a0, $s0, $zero
/* 44218 80068E18 00403821 */  addu      $a3, $v0, $zero
/* 4421C 80068E1C 14E0004A */  bnez      $a3, .L80068F48
/* 44220 80068E20 00000000 */   nop
/* 44224 80068E24 8E020050 */  lw        $v0, 0x50($s0)
/* 44228 80068E28 18400044 */  blez      $v0, .L80068F3C
/* 4422C 80068E2C 00008821 */   addu     $s1, $zero, $zero
/* 44230 80068E30 27B60020 */  addiu     $s6, $sp, 0x20
/* 44234 80068E34 27B5001C */  addiu     $s5, $sp, 0x1C
.L80068E38:
/* 44238 80068E38 8E06005C */  lw        $a2, 0x5C($s0)
/* 4423C 80068E3C 8E040004 */  lw        $a0, 0x4($s0)
/* 44240 80068E40 8E050008 */  lw        $a1, 0x8($s0)
/* 44244 80068E44 27A70010 */  addiu     $a3, $sp, 0x10
/* 44248 80068E48 00D13021 */  addu      $a2, $a2, $s1
/* 4424C 80068E4C 0C01A874 */  jal       __osContRamRead
/* 44250 80068E50 30C6FFFF */   andi     $a2, $a2, 0xFFFF
/* 44254 80068E54 00403821 */  addu      $a3, $v0, $zero
/* 44258 80068E58 14E0003B */  bnez      $a3, .L80068F48
/* 4425C 80068E5C 00E01021 */   addu     $v0, $a3, $zero
/* 44260 80068E60 8E040004 */  lw        $a0, 0x4($s0)
/* 44264 80068E64 0C01A530 */  jal       __osPfsGetStatus
/* 44268 80068E68 8E050008 */   lw       $a1, 0x8($s0)
/* 4426C 80068E6C 00403821 */  addu      $a3, $v0, $zero
/* 44270 80068E70 14E00027 */  bnez      $a3, .L80068F10
/* 44274 80068E74 32E2FFFF */   andi     $v0, $s7, 0xFFFF
/* 44278 80068E78 97A30014 */  lhu       $v1, 0x14($sp)
/* 4427C 80068E7C 1462002A */  bne       $v1, $v0, .L80068F28
/* 44280 80068E80 00000000 */   nop
/* 44284 80068E84 8FA20010 */  lw        $v0, 0x10($sp)
/* 44288 80068E88 145E0027 */  bne       $v0, $fp, .L80068F28
/* 4428C 80068E8C 00000000 */   nop
/* 44290 80068E90 1240000C */  beqz      $s2, .L80068EC4
/* 44294 80068E94 00004021 */   addu     $t0, $zero, $zero
/* 44298 80068E98 00002021 */  addu      $a0, $zero, $zero
/* 4429C 80068E9C 02403021 */  addu      $a2, $s2, $zero
/* 442A0 80068EA0 02C02821 */  addu      $a1, $s6, $zero
.L80068EA4:
/* 442A4 80068EA4 90A30000 */  lbu       $v1, 0x0($a1)
/* 442A8 80068EA8 90C20000 */  lbu       $v0, 0x0($a2)
/* 442AC 80068EAC 1462001C */  bne       $v1, $v0, .L80068F20
/* 442B0 80068EB0 24C60001 */   addiu    $a2, $a2, 0x1
/* 442B4 80068EB4 24840001 */  addiu     $a0, $a0, 0x1
/* 442B8 80068EB8 28820010 */  slti      $v0, $a0, 0x10
/* 442BC 80068EBC 1440FFF9 */  bnez      $v0, .L80068EA4
/* 442C0 80068EC0 24A50001 */   addiu    $a1, $a1, 0x1
.L80068EC4:
/* 442C4 80068EC4 0013102B */  sltu      $v0, $zero, $s3
/* 442C8 80068EC8 2D030001 */  sltiu     $v1, $t0, 0x1
/* 442CC 80068ECC 00431024 */  and       $v0, $v0, $v1
/* 442D0 80068ED0 1040000C */  beqz      $v0, .L80068F04
/* 442D4 80068ED4 00000000 */   nop
/* 442D8 80068ED8 00002021 */  addu      $a0, $zero, $zero
/* 442DC 80068EDC 02603021 */  addu      $a2, $s3, $zero
/* 442E0 80068EE0 02A02821 */  addu      $a1, $s5, $zero
.L80068EE4:
/* 442E4 80068EE4 90A30000 */  lbu       $v1, 0x0($a1)
/* 442E8 80068EE8 90C20000 */  lbu       $v0, 0x0($a2)
/* 442EC 80068EEC 1462000A */  bne       $v1, $v0, .L80068F18
/* 442F0 80068EF0 24C60001 */   addiu    $a2, $a2, 0x1
/* 442F4 80068EF4 24840001 */  addiu     $a0, $a0, 0x1
/* 442F8 80068EF8 28820004 */  slti      $v0, $a0, 0x4
/* 442FC 80068EFC 1440FFF9 */  bnez      $v0, .L80068EE4
/* 44300 80068F00 24A50001 */   addiu    $a1, $a1, 0x1
.L80068F04:
/* 44304 80068F04 15000008 */  bnez      $t0, .L80068F28
/* 44308 80068F08 00000000 */   nop
/* 4430C 80068F0C AE910000 */  sw        $s1, 0x0($s4)
.L80068F10:
/* 44310 80068F10 0801A3D2 */  j         .L80068F48
/* 44314 80068F14 00E01021 */   addu     $v0, $a3, $zero
.L80068F18:
/* 44318 80068F18 0801A3C1 */  j         .L80068F04
/* 4431C 80068F1C 24080001 */   addiu    $t0, $zero, 0x1
.L80068F20:
/* 44320 80068F20 0801A3B1 */  j         .L80068EC4
/* 44324 80068F24 24080001 */   addiu    $t0, $zero, 0x1
.L80068F28:
/* 44328 80068F28 8E020050 */  lw        $v0, 0x50($s0)
/* 4432C 80068F2C 26310001 */  addiu     $s1, $s1, 0x1
/* 44330 80068F30 0222102A */  slt       $v0, $s1, $v0
/* 44334 80068F34 1440FFC0 */  bnez      $v0, .L80068E38
/* 44338 80068F38 00000000 */   nop
.L80068F3C:
/* 4433C 80068F3C 2402FFFF */  addiu     $v0, $zero, -0x1
/* 44340 80068F40 AE820000 */  sw        $v0, 0x0($s4)
.L80068F44:
/* 44344 80068F44 24020005 */  addiu     $v0, $zero, 0x5
.L80068F48:
/* 44348 80068F48 8FBF005C */  lw        $ra, 0x5C($sp)
/* 4434C 80068F4C 8FBE0058 */  lw        $fp, 0x58($sp)
/* 44350 80068F50 8FB70054 */  lw        $s7, 0x54($sp)
/* 44354 80068F54 8FB60050 */  lw        $s6, 0x50($sp)
/* 44358 80068F58 8FB5004C */  lw        $s5, 0x4C($sp)
/* 4435C 80068F5C 8FB40048 */  lw        $s4, 0x48($sp)
/* 44360 80068F60 8FB30044 */  lw        $s3, 0x44($sp)
/* 44364 80068F64 8FB20040 */  lw        $s2, 0x40($sp)
/* 44368 80068F68 8FB1003C */  lw        $s1, 0x3C($sp)
/* 4436C 80068F6C 8FB00038 */  lw        $s0, 0x38($sp)
/* 44370 80068F70 03E00008 */  jr        $ra
/* 44374 80068F74 27BD0060 */   addiu    $sp, $sp, 0x60
/* 44378 80068F78 00000000 */  nop
/* 4437C 80068F7C 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

s32 osPfsFindFile(OSPfs* pfs, u16 companyCode, u32 gameCode, u8* gameName, u8* extName, s32* fileNo) {
    s32 j;
    s32 i;
    __OSDir dir;
    s32 ret = 0;
    s32 err;

    PFS_CHECK_STATUS;

    if ((ret = __osCheckId(pfs)) != 0) {
        return ret;
    }

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

        if ((dir.company_code == companyCode) && (dir.game_code == gameCode)) {
            err = 0;
            if (gameName != 0) {
                for (i = 0; i < PFS_FILE_NAME_LEN; i++) {
                    if (dir.game_name[i] != gameName[i]) {
                        err = 1;
                        break;
                    }
                }
            }
            if ((extName != 0) && (err == 0)) {
                for (i = 0; i < PFS_FILE_EXT_LEN; i++) {
                    if (dir.ext_name[i] != extName[i]) {
                        err = 1;
                        break;
                    }
                }
            }
            if (err == 0) {
                *fileNo = j;
                return ret;
            }
        }
    }
    *fileNo = -1;
    return PFS_ERR_INVALID;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel dead_kzn_17_GetActingPartner
/* 163660 80242E00 27BDFFD8 */  addiu     $sp, $sp, -0x28
.L80242E04:
/* 163664 80242E04 AFB20018 */  sw        $s2, 0x18($sp)
.L80242E08:
/* 163668 80242E08 00A0902D */  daddu     $s2, $a1, $zero
glabel func_80242E0C
/* 16366C 80242E0C AFB3001C */  sw        $s3, 0x1C($sp)
.L80242E10:
/* 163670 80242E10 00C0982D */  daddu     $s3, $a2, $zero
glabel func_80242E14
/* 163674 80242E14 AFB40020 */  sw        $s4, 0x20($sp)
.L80242E18:
/* 163678 80242E18 3C148016 */  lui       $s4, %hi(gWindows)
.L80242E1C:
/* 16367C 80242E1C 26949D50 */  addiu     $s4, $s4, %lo(gWindows)
glabel func_80242E20
/* 163680 80242E20 00042140 */  sll       $a0, $a0, 5
.L80242E24:
/* 163684 80242E24 AFB10014 */  sw        $s1, 0x14($sp)
D_80242E28:
/* 163688 80242E28 3C118025 */  lui       $s1, %hi(D_80249BB0)
glabel dead_kzn_17_UnkFunc46
/* 16368C 80242E2C 26319BB0 */  addiu     $s1, $s1, %lo(D_80249BB0)
/* 163690 80242E30 AFBF0024 */  sw        $ra, 0x24($sp)
/* 163694 80242E34 AFB00010 */  sw        $s0, 0x10($sp)
.L80242E38:
/* 163698 80242E38 8E220000 */  lw        $v0, 0x0($s1)
.L80242E3C:
/* 16369C 80242E3C 14400012 */  bnez      $v0, D_80242E88
.L80242E40:
/* 1636A0 80242E40 00948021 */   addu     $s0, $a0, $s4
.L80242E44:
/* 1636A4 80242E44 0C00CD4A */  jal       get_game_mode
.L80242E48:
/* 1636A8 80242E48 00000000 */   nop
.L80242E4C:
/* 1636AC 80242E4C 00021400 */  sll       $v0, $v0, 16
.L80242E50:
/* 1636B0 80242E50 00021403 */  sra       $v0, $v0, 16
glabel func_80242E54
/* 1636B4 80242E54 2403000F */  addiu     $v1, $zero, 0xF
.L80242E58:
/* 1636B8 80242E58 10430008 */  beq       $v0, $v1, .L80242E7C
.L80242E5C:
/* 1636BC 80242E5C 00000000 */   nop
.L80242E60:
/* 1636C0 80242E60 0C00CD4A */  jal       get_game_mode
.L80242E64:
/* 1636C4 80242E64 00000000 */   nop
.L80242E68:
/* 1636C8 80242E68 00021400 */  sll       $v0, $v0, 16
glabel func_80242E6C
/* 1636CC 80242E6C 00021403 */  sra       $v0, $v0, 16
glabel func_80242E70
/* 1636D0 80242E70 2403000D */  addiu     $v1, $zero, 0xD
.L80242E74:
/* 1636D4 80242E74 14430024 */  bne       $v0, $v1, func_80242F08
glabel func_80242E78
/* 1636D8 80242E78 00000000 */   nop
.L80242E7C:
/* 1636DC 80242E7C 8E220000 */  lw        $v0, 0x0($s1)
.L80242E80:
/* 1636E0 80242E80 10400018 */  beqz      $v0, .L80242EE4
glabel func_80242E84
/* 1636E4 80242E84 00000000 */   nop
D_80242E88:
/* 1636E8 80242E88 2404002C */  addiu     $a0, $zero, 0x2C
glabel func_80242E8C
/* 1636EC 80242E8C 2406FFFF */  addiu     $a2, $zero, -0x1
D_80242E90:
/* 1636F0 80242E90 0080282D */  daddu     $a1, $a0, $zero
glabel .L80242E94
/* 1636F4 80242E94 3C038016 */  lui       $v1, %hi(D_8015A2D0)
jtbl_80242E98:
/* 1636F8 80242E98 2463A2D0 */  addiu     $v1, $v1, %lo(D_8015A2D0)
.L80242E9C:
/* 1636FC 80242E9C 80620003 */  lb        $v0, 0x3($v1)
D_80242EA0:
/* 163700 80242EA0 10460003 */  beq       $v0, $a2, D_80242EB0
.L80242EA4:
/* 163704 80242EA4 00000000 */   nop
flo_08_pad_2EA8:
/* 163708 80242EA8 54450006 */  bnel      $v0, $a1, func_80242EC4_EA37C4
D_80242EAC:
/* 16370C 80242EAC 24840001 */   addiu    $a0, $a0, 0x1
D_80242EB0:
/* 163710 80242EB0 90620000 */  lbu       $v0, 0x0($v1)
glabel func_80242EB4
/* 163714 80242EB4 30420008 */  andi      $v0, $v0, 0x8
glabel func_80242EB8
/* 163718 80242EB8 14400006 */  bnez      $v0, .L80242ED4
glabel func_80242EBC
/* 16371C 80242EBC 28820040 */   slti     $v0, $a0, 0x40
.L80242EC0:
/* 163720 80242EC0 24840001 */  addiu     $a0, $a0, 0x1
glabel func_80242EC4_EA37C4
/* 163724 80242EC4 28820040 */  slti      $v0, $a0, 0x40
.L80242EC8:
/* 163728 80242EC8 1440FFF4 */  bnez      $v0, .L80242E9C
D_80242ECC:
/* 16372C 80242ECC 24630020 */   addiu    $v1, $v1, 0x20
.L80242ED0:
/* 163730 80242ED0 28820040 */  slti      $v0, $a0, 0x40
.L80242ED4:
/* 163734 80242ED4 14400003 */  bnez      $v0, .L80242EE4
.L80242ED8:
/* 163738 80242ED8 00000000 */   nop
.L80242EDC:
/* 16373C 80242EDC 3C018025 */  lui       $at, %hi(D_80249BB0)
D_80242EE0:
/* 163740 80242EE0 AC209BB0 */  sw        $zero, %lo(D_80249BB0)($at)
.L80242EE4:
/* 163744 80242EE4 3C018025 */  lui       $at, %hi(D_80249BA0)
D_80242EE8:
/* 163748 80242EE8 AC329BA0 */  sw        $s2, %lo(D_80249BA0)($at)
.L80242EEC:
/* 16374C 80242EEC 3C018025 */  lui       $at, %hi(D_80249B94)
D_80242EF0:
/* 163750 80242EF0 AC329B94 */  sw        $s2, %lo(D_80249B94)($at)
.L80242EF4:
/* 163754 80242EF4 3C018025 */  lui       $at, %hi(D_80249BA4)
glabel func_80242EF8
/* 163758 80242EF8 AC339BA4 */  sw        $s3, %lo(D_80249BA4)($at)
.L80242EFC:
/* 16375C 80242EFC 3C018025 */  lui       $at, %hi(D_80249B98)
D_80242F00:
/* 163760 80242F00 08090BD2 */  j         .L80242F48
/* 163764 80242F04 AC339B98 */   sw       $s3, %lo(D_80249B98)($at)
glabel func_80242F08
/* 163768 80242F08 92020000 */  lbu       $v0, 0x0($s0)
.L80242F0C:
/* 16376C 80242F0C 30420008 */  andi      $v0, $v0, 0x8
D_80242F10:
/* 163770 80242F10 1440000D */  bnez      $v0, .L80242F48
glabel func_80242F14
/* 163774 80242F14 2402FFFF */   addiu    $v0, $zero, -0x1
.L80242F18:
/* 163778 80242F18 82040003 */  lb        $a0, 0x3($s0)
glabel func_80242F1C
/* 16377C 80242F1C 10820006 */  beq       $a0, $v0, D_80242F38
glabel func_80242F20
/* 163780 80242F20 00041140 */   sll      $v0, $a0, 5
/* 163784 80242F24 00541021 */  addu      $v0, $v0, $s4
D_80242F28:
/* 163788 80242F28 90420000 */  lbu       $v0, 0x0($v0)
.L80242F2C:
/* 16378C 80242F2C 30420008 */  andi      $v0, $v0, 0x8
D_80242F30:
/* 163790 80242F30 14400005 */  bnez      $v0, .L80242F48
D_80242F34:
/* 163794 80242F34 00000000 */   nop
D_80242F38:
/* 163798 80242F38 3C018025 */  lui       $at, %hi(D_80249BA0)
glabel func_80242F3C
/* 16379C 80242F3C AC329BA0 */  sw        $s2, %lo(D_80249BA0)($at)
D_80242F40:
/* 1637A0 80242F40 3C018025 */  lui       $at, %hi(D_80249BA4)
glabel func_80242F44
/* 1637A4 80242F44 AC339BA4 */  sw        $s3, %lo(D_80249BA4)($at)
.L80242F48:
/* 1637A8 80242F48 8FBF0024 */  lw        $ra, 0x24($sp)
.L80242F4C:
/* 1637AC 80242F4C 8FB40020 */  lw        $s4, 0x20($sp)
D_80242F50:
/* 1637B0 80242F50 8FB3001C */  lw        $s3, 0x1C($sp)
glabel func_80242F54
/* 1637B4 80242F54 8FB20018 */  lw        $s2, 0x18($sp)
D_80242F58:
/* 1637B8 80242F58 8FB10014 */  lw        $s1, 0x14($sp)
.L80242F5C:
/* 1637BC 80242F5C 8FB00010 */  lw        $s0, 0x10($sp)
D_80242F60:
/* 1637C0 80242F60 03E00008 */  jr        $ra
glabel dead_kzn_17_UnkFunc48
/* 1637C4 80242F64 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

void filemenu_set_cursor_goal_pos(s32 windowID, s32 posX, s32 posY) {
    Window* window = &gWindows[windowID];

    if (D_80249BB0
            || get_game_mode() == GAME_MODE_END_FILE_SELECT
            || get_game_mode() == GAME_MODE_END_LANGUAGE_SELECT) {
        if (D_80249BB0) {
            s32 i;

            for (i = WINDOW_ID_FILEMENU_MAIN; i < ARRAY_COUNT(gWindows); i++) {
                Window* window = &gWindows[i];
                s8 parent = window->parent;

                if ((parent == -1 || parent == WINDOW_ID_FILEMENU_MAIN) && (window->flags & WINDOW_FLAG_INITIAL_ANIMATION)) {
                    break;
                }
            }
            if (i >= ARRAY_COUNT(gWindows)) {
                D_80249BB0 = FALSE;
            }
        }
        filemenu_cursor_targetX = posX;
        filemenu_cursor_posX = posX;
        filemenu_cursor_targetY = posY;
        filemenu_cursor_posY = posY;
    } else if (!(window->flags & WINDOW_FLAG_INITIAL_ANIMATION) &&
                (window->parent == -1 || !(gWindows[window->parent].flags & WINDOW_FLAG_INITIAL_ANIMATION))) {
        filemenu_cursor_targetX = posX;
        filemenu_cursor_targetY = posY;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_80218C74_48DE14
/* 48DE14 80218C74 27BDFFB8 */  addiu     $sp, $sp, -0x48
D_80218C78:
/* 48DE18 80218C78 AFB10014 */  sw        $s1, 0x14($sp)
glabel b_area_omo3_StartRumbleWithParams
/* 48DE1C 80218C7C 0080882D */  daddu     $s1, $a0, $zero
.L80218C80:
/* 48DE20 80218C80 AFBF0024 */  sw        $ra, 0x24($sp)
.L80218C84:
/* 48DE24 80218C84 AFB40020 */  sw        $s4, 0x20($sp)
glabel dup2_b_area_pra_UnkFunc52
/* 48DE28 80218C88 AFB3001C */  sw        $s3, 0x1C($sp)
b_area_omo2_general_guy_attack_throw_bomb:
/* 48DE2C 80218C8C AFB20018 */  sw        $s2, 0x18($sp)
.L80218C90:
/* 48DE30 80218C90 AFB00010 */  sw        $s0, 0x10($sp)
/* 48DE34 80218C94 F7BA0040 */  sdc1      $f26, 0x40($sp)
.L80218C98:
/* 48DE38 80218C98 F7B80038 */  sdc1      $f24, 0x38($sp)
/* 48DE3C 80218C9C F7B60030 */  sdc1      $f22, 0x30($sp)
/* 48DE40 80218CA0 F7B40028 */  sdc1      $f20, 0x28($sp)
.L80218CA4:
/* 48DE44 80218CA4 8E30000C */  lw        $s0, 0xC($s1)
/* 48DE48 80218CA8 8E050000 */  lw        $a1, 0x0($s0)
/* 48DE4C 80218CAC 0C0B1EAF */  jal       evt_get_variable
b_area_trd_part_1_Formations:
/* 48DE50 80218CB0 26100004 */   addiu    $s0, $s0, 0x4
/* 48DE54 80218CB4 0220202D */  daddu     $a0, $s1, $zero
/* 48DE58 80218CB8 8E050000 */  lw        $a1, 0x0($s0)
/* 48DE5C 80218CBC 0C0B1EAF */  jal       evt_get_variable
glabel func_80218CC0
/* 48DE60 80218CC0 0040902D */   daddu    $s2, $v0, $zero
.L80218CC4:
/* 48DE64 80218CC4 24040168 */  addiu     $a0, $zero, 0x168
b_area_isk_part_1_pokey_mummy_ActorParts:
/* 48DE68 80218CC8 0C00A67F */  jal       rand_int
.L80218CCC:
/* 48DE6C 80218CCC 0040982D */   daddu    $s3, $v0, $zero
glabel b_area_trd_part_2_red_ninja_koopa_GetKoopaBrosWithState
/* 48DE70 80218CD0 4482B000 */  mtc1      $v0, $f22
.L80218CD4:
/* 48DE74 80218CD4 00000000 */  nop
/* 48DE78 80218CD8 4680B5A0 */  cvt.s.w   $f22, $f22
/* 48DE7C 80218CDC 3C014238 */  lui       $at, (0x42380000 >> 16)
glabel func_80218CE0
/* 48DE80 80218CE0 4481C000 */  mtc1      $at, $f24
glabel func_80218CE4
/* 48DE84 80218CE4 0C00A8D4 */  jal       cos_deg
/* 48DE88 80218CE8 4600B306 */   mov.s    $f12, $f22
glabel func_80218CEC
/* 48DE8C 80218CEC 46180002 */  mul.s     $f0, $f0, $f24
.L80218CF0:
/* 48DE90 80218CF0 00000000 */  nop
glabel b_area_omo_spy_guy_SpyGuyActionFunc
/* 48DE94 80218CF4 4492A000 */  mtc1      $s2, $f20
/* 48DE98 80218CF8 00000000 */  nop
/* 48DE9C 80218CFC 4680A520 */  cvt.s.w   $f20, $f20
.L80218D00:
/* 48DEA0 80218D00 4600A000 */  add.s     $f0, $f20, $f0
.L80218D04:
/* 48DEA4 80218D04 4600008D */  trunc.w.s $f2, $f0
.L80218D08:
/* 48DEA8 80218D08 44121000 */  mfc1      $s2, $f2
glabel b_area_kzn_white_magikoopa_GetBootsHammerLevel
/* 48DEAC 80218D0C 0C00A8BB */  jal       sin_deg
glabel b_area_kpa3_UnkActorPosFunc
/* 48DEB0 80218D10 4600B306 */   mov.s    $f12, $f22
/* 48DEB4 80218D14 46180002 */  mul.s     $f0, $f0, $f24
.L80218D18:
/* 48DEB8 80218D18 00000000 */  nop
.L80218D1C:
/* 48DEBC 80218D1C 4493C000 */  mtc1      $s3, $f24
.L80218D20:
/* 48DEC0 80218D20 00000000 */  nop
D_80218D24:
/* 48DEC4 80218D24 4680C620 */  cvt.s.w   $f24, $f24
glabel b_area_kmr_part_3_final_jr_troopa_CalculateRotationZ
/* 48DEC8 80218D28 4600C000 */  add.s     $f0, $f24, $f0
.L80218D2C:
/* 48DECC 80218D2C 3C014278 */  lui       $at, (0x42780000 >> 16)
/* 48DED0 80218D30 4481D000 */  mtc1      $at, $f26
D_80218D34:
/* 48DED4 80218D34 4600008D */  trunc.w.s $f2, $f0
.L80218D38:
/* 48DED8 80218D38 44131000 */  mfc1      $s3, $f2
.L80218D3C:
/* 48DEDC 80218D3C 0C00A8D4 */  jal       cos_deg
glabel b_area_kzn2_petit_piranha_SetFlameUnk2C
/* 48DEE0 80218D40 4600B306 */   mov.s    $f12, $f22
.L80218D44:
/* 48DEE4 80218D44 461A0002 */  mul.s     $f0, $f0, $f26
b_area_dgb_tubba_blubba:
/* 48DEE8 80218D48 00000000 */  nop
glabel func_80218D4C
/* 48DEEC 80218D4C 4600A500 */  add.s     $f20, $f20, $f0
glabel dup3_b_area_pra_ShrinkActor
/* 48DEF0 80218D50 4600A08D */  trunc.w.s $f2, $f20
glabel func_80218D54
/* 48DEF4 80218D54 44141000 */  mfc1      $s4, $f2
b_area_kgr_fuzzipede_idle_80218D58:
/* 48DEF8 80218D58 0C00A8BB */  jal       sin_deg
.L80218D5C:
/* 48DEFC 80218D5C 4600B306 */   mov.s    $f12, $f22
.L80218D60:
/* 48DF00 80218D60 461A0002 */  mul.s     $f0, $f0, $f26
glabel b_area_pra3_duplighost_UnkActorPosFunc
/* 48DF04 80218D64 00000000 */  nop
D_80218D68:
/* 48DF08 80218D68 26100004 */  addiu     $s0, $s0, 0x4
glabel b_area_kzn_white_magikoopa_UnkBattleFunc5
/* 48DF0C 80218D6C 8E050000 */  lw        $a1, 0x0($s0)
b_area_trd_part_2_red_ninja_koopa_GetTowerFallPosition:
/* 48DF10 80218D70 26100004 */  addiu     $s0, $s0, 0x4
.L80218D74:
/* 48DF14 80218D74 4600C600 */  add.s     $f24, $f24, $f0
glabel b_area_sam2_sam_01_Set80071270_0_16
/* 48DF18 80218D78 0240302D */  daddu     $a2, $s2, $zero
b_area_jan_spear_guy_80218D7C:
/* 48DF1C 80218D7C 4600C08D */  trunc.w.s $f2, $f24
/* 48DF20 80218D80 44121000 */  mfc1      $s2, $f2
/* 48DF24 80218D84 0C0B2026 */  jal       evt_set_variable
/* 48DF28 80218D88 0220202D */   daddu    $a0, $s1, $zero
/* 48DF2C 80218D8C 8E050000 */  lw        $a1, 0x0($s0)
glabel b_area_kzn2_petit_piranha_SetFlameX
/* 48DF30 80218D90 26100004 */  addiu     $s0, $s0, 0x4
.L80218D94:
/* 48DF34 80218D94 0220202D */  daddu     $a0, $s1, $zero
glabel dup2_b_area_flo_GetSelectedMoveID
/* 48DF38 80218D98 0C0B2026 */  jal       evt_set_variable
glabel func_80218D9C
/* 48DF3C 80218D9C 0260302D */   daddu    $a2, $s3, $zero
b_area_isk_part_1_pokey_mummy:
/* 48DF40 80218DA0 8E050000 */  lw        $a1, 0x0($s0)
.L80218DA4:
/* 48DF44 80218DA4 26100004 */  addiu     $s0, $s0, 0x4
.L80218DA8:
/* 48DF48 80218DA8 0220202D */  daddu     $a0, $s1, $zero
/* 48DF4C 80218DAC 0C0B2026 */  jal       evt_set_variable
glabel b_area_omo_sky_guy_StartRumbleWithParams
/* 48DF50 80218DB0 0280302D */   daddu    $a2, $s4, $zero
.L80218DB4:
/* 48DF54 80218DB4 0220202D */  daddu     $a0, $s1, $zero
/* 48DF58 80218DB8 8E050000 */  lw        $a1, 0x0($s0)
.L80218DBC:
/* 48DF5C 80218DBC 0C0B2026 */  jal       evt_set_variable
.L80218DC0:
/* 48DF60 80218DC0 0240302D */   daddu    $a2, $s2, $zero
glabel dup4_b_area_flo_SetAbsoluteStatusOffsets
/* 48DF64 80218DC4 8FBF0024 */  lw        $ra, 0x24($sp)
D_80218DC8:
/* 48DF68 80218DC8 8FB40020 */  lw        $s4, 0x20($sp)
.L80218DCC:
/* 48DF6C 80218DCC 8FB3001C */  lw        $s3, 0x1C($sp)
glabel func_80218DD0_5CF460
/* 48DF70 80218DD0 8FB20018 */  lw        $s2, 0x18($sp)
.L80218DD4:
/* 48DF74 80218DD4 8FB10014 */  lw        $s1, 0x14($sp)
/* 48DF78 80218DD8 8FB00010 */  lw        $s0, 0x10($sp)
.L80218DDC:
/* 48DF7C 80218DDC D7BA0040 */  ldc1      $f26, 0x40($sp)
.L80218DE0:
/* 48DF80 80218DE0 D7B80038 */  ldc1      $f24, 0x38($sp)
/* 48DF84 80218DE4 D7B60030 */  ldc1      $f22, 0x30($sp)
.L80218DE8:
/* 48DF88 80218DE8 D7B40028 */  ldc1      $f20, 0x28($sp)
/* 48DF8C 80218DEC 24020002 */  addiu     $v0, $zero, 0x2
glabel func_80218DF0
/* 48DF90 80218DF0 03E00008 */  jr        $ra
glabel func_80218DF4
/* 48DF94 80218DF4 27BD0048 */   addiu    $sp, $sp, 0x48

### DECOMPILED C INSTRUCTIONS:

API_CALLABLE(func_80218C74_48DE14) {
    Bytecode* args = script->ptrReadPos;
    s32 x = evt_get_variable(script, *args++);
    s32 z = evt_get_variable(script, *args++);
    f32 rand = rand_int(0x168);

    f32 fx = x;
    f32 fz = z;

    s32 outX1 = fx + cos_deg(rand) * 46.0f;
    s32 outZ1 = fz + sin_deg(rand) * 46.0f;
    s32 outX2 = fx + cos_deg(rand) * 62.0f;
    s32 outZ2 = fz + sin_deg(rand) * 62.0f;

    evt_set_variable(script, *args++, outX1);
    evt_set_variable(script, *args++, outZ1);
    evt_set_variable(script, *args++, outX2);
    evt_set_variable(script, *args++, outZ2);

    return ApiStatus_DONE2;
}