### RAW ASSEMBLY INSTRUCTIONS:

glabel item_entity_load
/* C7828 80131128 27BDFFC8 */  addiu     $sp, $sp, -0x38
/* C782C 8013112C AFBE0030 */  sw        $fp, 0x30($sp)
/* C7830 80131130 0080F02D */  daddu     $fp, $a0, $zero
/* C7834 80131134 AFB7002C */  sw        $s7, 0x2C($sp)
/* C7838 80131138 2417FFFF */  addiu     $s7, $zero, -0x1
/* C783C 8013113C AFB50024 */  sw        $s5, 0x24($sp)
/* C7840 80131140 3C150001 */  lui       $s5, (0x10FFF >> 16)
/* C7844 80131144 AFBF0034 */  sw        $ra, 0x34($sp)
/* C7848 80131148 AFB60028 */  sw        $s6, 0x28($sp)
/* C784C 8013114C AFB40020 */  sw        $s4, 0x20($sp)
/* C7850 80131150 AFB3001C */  sw        $s3, 0x1C($sp)
/* C7854 80131154 AFB20018 */  sw        $s2, 0x18($sp)
/* C7858 80131158 AFB10014 */  sw        $s1, 0x14($sp)
/* C785C 8013115C AFB00010 */  sw        $s0, 0x10($sp)
/* C7860 80131160 87C20018 */  lh        $v0, 0x18($fp)
/* C7864 80131164 36B50FFF */  ori       $s5, $s5, (0x10FFF & 0xFFFF)
/* C7868 80131168 00021080 */  sll       $v0, $v0, 2
/* C786C 8013116C 3C108009 */  lui       $s0, %hi(gItemEntityScripts)
/* C7870 80131170 02028021 */  addu      $s0, $s0, $v0
/* C7874 80131174 8E10DDD4 */  lw        $s0, %lo(gItemEntityScripts)($s0)
/* C7878 80131178 3C16001D */  lui       $s6, %hi(D_1CC310)
/* C787C 8013117C 26D6C310 */  addiu     $s6, $s6, %lo(D_1CC310)
/* C7880 80131180 AFD00024 */  sw        $s0, 0x24($fp)
/* C7884 80131184 AFD00028 */  sw        $s0, 0x28($fp)
glabel .L80131188
/* C7888 80131188 8E030000 */  lw        $v1, 0x0($s0)
/* C788C 8013118C 2C620005 */  sltiu     $v0, $v1, 0x5
/* C7890 80131190 1040FFFD */  beqz      $v0, .L80131188
/* C7894 80131194 26100004 */   addiu    $s0, $s0, 0x4
/* C7898 80131198 00031080 */  sll       $v0, $v1, 2
/* C789C 8013119C 3C018015 */  lui       $at, %hi(jtbl_80150A80)
/* C78A0 801311A0 00220821 */  addu      $at, $at, $v0
/* C78A4 801311A4 8C220A80 */  lw        $v0, %lo(jtbl_80150A80)($at)
/* C78A8 801311A8 00400008 */  jr        $v0
/* C78AC 801311AC 00000000 */   nop
glabel .L801311B0
/* C78B0 801311B0 0804C462 */  j         .L80131188
/* C78B4 801311B4 26100008 */   addiu    $s0, $s0, 0x8
glabel .L801311B8
/* C78B8 801311B8 26100004 */  addiu     $s0, $s0, 0x4
/* C78BC 801311BC 8E060000 */  lw        $a2, 0x0($s0)
/* C78C0 801311C0 26100004 */  addiu     $s0, $s0, 0x4
/* C78C4 801311C4 8E140000 */  lw        $s4, 0x0($s0)
/* C78C8 801311C8 26100004 */  addiu     $s0, $s0, 0x4
/* C78CC 801311CC 8FC20000 */  lw        $v0, 0x0($fp)
/* C78D0 801311D0 3C030004 */  lui       $v1, (0x40000 >> 16)
/* C78D4 801311D4 00431024 */  and       $v0, $v0, $v1
/* C78D8 801311D8 10400002 */  beqz      $v0, .L801311E4
/* C78DC 801311DC 24120120 */   addiu    $s2, $zero, 0x120
/* C78E0 801311E0 24120200 */  addiu     $s2, $zero, 0x200
.L801311E4:
/* C78E4 801311E4 3C038015 */  lui       $v1, %hi(gHudElementCacheTableRaster)
/* C78E8 801311E8 8C6312C8 */  lw        $v1, %lo(gHudElementCacheTableRaster)($v1)
/* C78EC 801311EC 0000882D */  daddu     $s1, $zero, $zero
/* C78F0 801311F0 0220982D */  daddu     $s3, $s1, $zero
/* C78F4 801311F4 24650004 */  addiu     $a1, $v1, 0x4
.L801311F8:
/* C78F8 801311F8 8C620000 */  lw        $v0, 0x0($v1)
/* C78FC 801311FC 1457001F */  bne       $v0, $s7, .L8013127C
/* C7900 80131200 00000000 */   nop
/* C7904 80131204 3C048015 */  lui       $a0, %hi(gHudElementCacheSize)
/* C7908 80131208 8C84133C */  lw        $a0, %lo(gHudElementCacheSize)($a0)
/* C790C 8013120C 3C028015 */  lui       $v0, %hi(gHudElementCacheBuffer)
/* C7910 80131210 8C421314 */  lw        $v0, %lo(gHudElementCacheBuffer)($v0)
/* C7914 80131214 AC660000 */  sw        $a2, 0x0($v1)
/* C7918 80131218 8C830000 */  lw        $v1, 0x0($a0)
/* C791C 8013121C 00431021 */  addu      $v0, $v0, $v1
/* C7920 80131220 ACA20000 */  sw        $v0, 0x0($a1)
/* C7924 80131224 8C820000 */  lw        $v0, 0x0($a0)
/* C7928 80131228 00521021 */  addu      $v0, $v0, $s2
/* C792C 8013122C 02A2102A */  slt       $v0, $s5, $v0
/* C7930 80131230 10400003 */  beqz      $v0, .L80131240
/* C7934 80131234 00D62021 */   addu     $a0, $a2, $s6
.L80131238:
/* C7938 80131238 0804C48E */  j         .L80131238
/* C793C 8013123C 00000000 */   nop
.L80131240:
/* C7940 80131240 8CA50000 */  lw        $a1, 0x0($a1)
/* C7944 80131244 0C017D24 */  jal       nuPiReadRom
/* C7948 80131248 0240302D */   daddu    $a2, $s2, $zero
/* C794C 8013124C 3C038015 */  lui       $v1, %hi(gHudElementCacheSize)
/* C7950 80131250 8C63133C */  lw        $v1, %lo(gHudElementCacheSize)($v1)
/* C7954 80131254 8C620000 */  lw        $v0, 0x0($v1)
/* C7958 80131258 00521021 */  addu      $v0, $v0, $s2
/* C795C 8013125C AC620000 */  sw        $v0, 0x0($v1)
/* C7960 80131260 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* C7964 80131264 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* C7968 80131268 80420070 */  lb        $v0, 0x70($v0)
/* C796C 8013126C 5040000F */  beql      $v0, $zero, .L801312AC
/* C7970 80131270 AE110000 */   sw       $s1, 0x0($s0)
/* C7974 80131274 0804C4A8 */  j         .L801312A0
/* C7978 80131278 00000000 */   nop
.L8013127C:
/* C797C 8013127C 5446000D */  bnel      $v0, $a2, .L801312B4
/* C7980 80131280 24A50008 */   addiu    $a1, $a1, 0x8
/* C7984 80131284 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* C7988 80131288 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* C798C 8013128C 80420070 */  lb        $v0, 0x70($v0)
/* C7990 80131290 14400003 */  bnez      $v0, .L801312A0
/* C7994 80131294 00000000 */   nop
/* C7998 80131298 0804C4AB */  j         .L801312AC
/* C799C 8013129C AE110000 */   sw       $s1, 0x0($s0)
.L801312A0:
/* C79A0 801312A0 96020002 */  lhu       $v0, 0x2($s0)
/* C79A4 801312A4 00531025 */  or        $v0, $v0, $s3
/* C79A8 801312A8 AE020000 */  sw        $v0, 0x0($s0)
.L801312AC:
/* C79AC 801312AC 0804C4B2 */  j         .L801312C8
/* C79B0 801312B0 26100004 */   addiu    $s0, $s0, 0x4
.L801312B4:
/* C79B4 801312B4 24630008 */  addiu     $v1, $v1, 0x8
/* C79B8 801312B8 3C020001 */  lui       $v0, (0x10000 >> 16)
/* C79BC 801312BC 02629821 */  addu      $s3, $s3, $v0
/* C79C0 801312C0 0804C47E */  j         .L801311F8
/* C79C4 801312C4 26310001 */   addiu    $s1, $s1, 0x1
.L801312C8:
/* C79C8 801312C8 2A220100 */  slti      $v0, $s1, 0x100
/* C79CC 801312CC 14400003 */  bnez      $v0, .L801312DC
/* C79D0 801312D0 0000882D */   daddu    $s1, $zero, $zero
.L801312D4:
/* C79D4 801312D4 0804C4B5 */  j         .L801312D4
/* C79D8 801312D8 00000000 */   nop
.L801312DC:
/* C79DC 801312DC 3C038015 */  lui       $v1, %hi(gHudElementCacheTablePalette)
/* C79E0 801312E0 8C6312D0 */  lw        $v1, %lo(gHudElementCacheTablePalette)($v1)
/* C79E4 801312E4 0220902D */  daddu     $s2, $s1, $zero
/* C79E8 801312E8 24650004 */  addiu     $a1, $v1, 0x4
.L801312EC:
/* C79EC 801312EC 8C620000 */  lw        $v0, 0x0($v1)
/* C79F0 801312F0 1457001F */  bne       $v0, $s7, .L80131370
/* C79F4 801312F4 00000000 */   nop
/* C79F8 801312F8 3C048015 */  lui       $a0, %hi(gHudElementCacheSize)
/* C79FC 801312FC 8C84133C */  lw        $a0, %lo(gHudElementCacheSize)($a0)
/* C7A00 80131300 3C028015 */  lui       $v0, %hi(gHudElementCacheBuffer)
/* C7A04 80131304 8C421314 */  lw        $v0, %lo(gHudElementCacheBuffer)($v0)
/* C7A08 80131308 AC740000 */  sw        $s4, 0x0($v1)
/* C7A0C 8013130C 8C830000 */  lw        $v1, 0x0($a0)
/* C7A10 80131310 00431021 */  addu      $v0, $v0, $v1
/* C7A14 80131314 ACA20000 */  sw        $v0, 0x0($a1)
/* C7A18 80131318 8C820000 */  lw        $v0, 0x0($a0)
/* C7A1C 8013131C 24420020 */  addiu     $v0, $v0, 0x20
/* C7A20 80131320 02A2102A */  slt       $v0, $s5, $v0
/* C7A24 80131324 10400003 */  beqz      $v0, .L80131334
/* C7A28 80131328 02962021 */   addu     $a0, $s4, $s6
.L8013132C:
/* C7A2C 8013132C 0804C4CB */  j         .L8013132C
/* C7A30 80131330 00000000 */   nop
.L80131334:
/* C7A34 80131334 8CA50000 */  lw        $a1, 0x0($a1)
/* C7A38 80131338 0C017D24 */  jal       nuPiReadRom
/* C7A3C 8013133C 24060020 */   addiu    $a2, $zero, 0x20
/* C7A40 80131340 3C038015 */  lui       $v1, %hi(gHudElementCacheSize)
/* C7A44 80131344 8C63133C */  lw        $v1, %lo(gHudElementCacheSize)($v1)
/* C7A48 80131348 8C620000 */  lw        $v0, 0x0($v1)
/* C7A4C 8013134C 24420020 */  addiu     $v0, $v0, 0x20
/* C7A50 80131350 AC620000 */  sw        $v0, 0x0($v1)
/* C7A54 80131354 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* C7A58 80131358 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* C7A5C 8013135C 80420070 */  lb        $v0, 0x70($v0)
/* C7A60 80131360 5040000F */  beql      $v0, $zero, .L801313A0
/* C7A64 80131364 AE110000 */   sw       $s1, 0x0($s0)
/* C7A68 80131368 0804C4E5 */  j         .L80131394
/* C7A6C 8013136C 00000000 */   nop
.L80131370:
/* C7A70 80131370 5454000D */  bnel      $v0, $s4, .L801313A8
/* C7A74 80131374 24A50008 */   addiu    $a1, $a1, 0x8
/* C7A78 80131378 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* C7A7C 8013137C 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* C7A80 80131380 80420070 */  lb        $v0, 0x70($v0)
/* C7A84 80131384 14400003 */  bnez      $v0, .L80131394
/* C7A88 80131388 00000000 */   nop
/* C7A8C 8013138C 0804C4E8 */  j         .L801313A0
/* C7A90 80131390 AE110000 */   sw       $s1, 0x0($s0)
.L80131394:
/* C7A94 80131394 96020002 */  lhu       $v0, 0x2($s0)
/* C7A98 80131398 00521025 */  or        $v0, $v0, $s2
/* C7A9C 8013139C AE020000 */  sw        $v0, 0x0($s0)
.L801313A0:
/* C7AA0 801313A0 0804C462 */  j         .L80131188
/* C7AA4 801313A4 26100004 */   addiu    $s0, $s0, 0x4
.L801313A8:
/* C7AA8 801313A8 24630008 */  addiu     $v1, $v1, 0x8
/* C7AAC 801313AC 3C020001 */  lui       $v0, (0x10000 >> 16)
/* C7AB0 801313B0 02429021 */  addu      $s2, $s2, $v0
/* C7AB4 801313B4 0804C4BB */  j         .L801312EC
/* C7AB8 801313B8 26310001 */   addiu    $s1, $s1, 0x1
glabel .L801313BC
/* C7ABC 801313BC 0C04C775 */  jal       item_entity_update
/* C7AC0 801313C0 03C0202D */   daddu    $a0, $fp, $zero
/* C7AC4 801313C4 8FBF0034 */  lw        $ra, 0x34($sp)
/* C7AC8 801313C8 8FBE0030 */  lw        $fp, 0x30($sp)
/* C7ACC 801313CC 8FB7002C */  lw        $s7, 0x2C($sp)
/* C7AD0 801313D0 8FB60028 */  lw        $s6, 0x28($sp)
/* C7AD4 801313D4 8FB50024 */  lw        $s5, 0x24($sp)
/* C7AD8 801313D8 8FB40020 */  lw        $s4, 0x20($sp)
/* C7ADC 801313DC 8FB3001C */  lw        $s3, 0x1C($sp)
/* C7AE0 801313E0 8FB20018 */  lw        $s2, 0x18($sp)
/* C7AE4 801313E4 8FB10014 */  lw        $s1, 0x14($sp)
/* C7AE8 801313E8 8FB00010 */  lw        $s0, 0x10($sp)
/* C7AEC 801313EC 03E00008 */  jr        $ra
/* C7AF0 801313F0 27BD0038 */   addiu    $sp, $sp, 0x38

### DECOMPILED C INSTRUCTIONS:

void item_entity_load(ItemEntity* item) {
    s32* pos;
    HudCacheEntry* entry;
    s32 cond;
    s32 raster;
    s32 palette;
    s32 size;
    s32 i;

    item->savedReadPos = item->readPos = pos = gItemEntityScripts[item->itemID];

    while (TRUE) {
        switch (*pos++) {
            case ITEM_SCRIPT_OP_End:
                break;
            case ITEM_SCRIPT_OP_Restart:
            case ITEM_SCRIPT_OP_Loop:
            default:
                continue;
            case ITEM_SCRIPT_OP_RandomRestart:
                pos += 2;
                continue;
            case ITEM_SCRIPT_OP_SetImage:
                pos++;
                raster = *pos++;
                palette = *pos++;

                // 32x32 or 24x24 (divided by 2 because these are ci4 iamges)
                size = (item->flags & ITEM_ENTITY_FLAG_40000) ? (32 * 32 / 2) : (24 * 24 / 2);

                entry = gHudElementCacheTableRaster;
                i = 0;
                while (TRUE) {
                    if (entry->id == -1) {
                        entry->id = raster;
                        entry->data = &gHudElementCacheBuffer[*gHudElementCacheSize];

                        ASSERT(*gHudElementCacheSize + size < 0x11000);
                        nuPiReadRom((s32)icon_present_ROM_START + raster, entry->data, size);
                        *gHudElementCacheSize += size;
                        if (!gGameStatusPtr->isBattle) {
                            *pos = i;
                        } else {
                            *pos = (u16)(*pos) | (i << 16);
                        }
                        pos++;
                        break;
                    } else {
                        cond = entry->id == raster;  // TODO required to match
                        if (cond) {
                            if (!gGameStatusPtr->isBattle) {
                                *pos = i;
                            } else {
                                *pos = (u16)(*pos) | (i << 16);
                            }
                            pos++;
                            break;
                       }
                    }
                    entry++;
                    i++;
                }
                ASSERT(i < MAX_ITEM_ENTITIES);

                entry = gHudElementCacheTablePalette;
                i = 0;
                while (TRUE) {
                    if (entry->id == -1) {
                        entry->id = palette;
                        entry->data = &gHudElementCacheBuffer[*gHudElementCacheSize];
                        ASSERT(*gHudElementCacheSize + 0x20 < 0x11000);
                        nuPiReadRom((s32)icon_present_ROM_START + palette, entry->data, 0x20);
                        *gHudElementCacheSize += 0x20;
                        if (!gGameStatusPtr->isBattle) {
                            *pos = i;
                        } else {
                            *pos = (u16)(*pos) | (i << 16);
                        }
                        pos++;
                        break;
                    } else if (entry->id == palette) {
                        if (!gGameStatusPtr->isBattle) {
                            *pos = i;
                        } else {
                            *pos = (u16)(*pos) | (i << 16);
                        }
                        pos++;
                        break;
                    }
                    entry++;
                    i++;
                }
                continue;
        }
        break;
    }
    item_entity_update(item);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel FallPartTo
/* 1A9134 8027A854 27BDFFA0 */  addiu     $sp, $sp, -0x60
/* 1A9138 8027A858 AFB30024 */  sw        $s3, 0x24($sp)
/* 1A913C 8027A85C 0080982D */  daddu     $s3, $a0, $zero
/* 1A9140 8027A860 AFBF0028 */  sw        $ra, 0x28($sp)
/* 1A9144 8027A864 AFB20020 */  sw        $s2, 0x20($sp)
/* 1A9148 8027A868 AFB1001C */  sw        $s1, 0x1C($sp)
/* 1A914C 8027A86C AFB00018 */  sw        $s0, 0x18($sp)
/* 1A9150 8027A870 F7BE0058 */  sdc1      $f30, 0x58($sp)
/* 1A9154 8027A874 F7BC0050 */  sdc1      $f28, 0x50($sp)
/* 1A9158 8027A878 F7BA0048 */  sdc1      $f26, 0x48($sp)
/* 1A915C 8027A87C F7B80040 */  sdc1      $f24, 0x40($sp)
/* 1A9160 8027A880 F7B60038 */  sdc1      $f22, 0x38($sp)
/* 1A9164 8027A884 F7B40030 */  sdc1      $f20, 0x30($sp)
/* 1A9168 8027A888 8E72000C */  lw        $s2, 0xC($s3)
/* 1A916C 8027A88C 54A00001 */  bnel      $a1, $zero, .L8027A894
/* 1A9170 8027A890 AE600070 */   sw       $zero, 0x70($s3)
.L8027A894:
/* 1A9174 8027A894 8E620070 */  lw        $v0, 0x70($s3)
/* 1A9178 8027A898 1440007C */  bnez      $v0, .L8027AA8C
/* 1A917C 8027A89C 00000000 */   nop
/* 1A9180 8027A8A0 8E450000 */  lw        $a1, 0x0($s2)
/* 1A9184 8027A8A4 26520004 */  addiu     $s2, $s2, 0x4
/* 1A9188 8027A8A8 0C0B1EAF */  jal       evt_get_variable
/* 1A918C 8027A8AC 0260202D */   daddu    $a0, $s3, $zero
/* 1A9190 8027A8B0 0040802D */  daddu     $s0, $v0, $zero
/* 1A9194 8027A8B4 2402FF81 */  addiu     $v0, $zero, -0x7F
/* 1A9198 8027A8B8 16020002 */  bne       $s0, $v0, .L8027A8C4
/* 1A919C 8027A8BC 00000000 */   nop
/* 1A91A0 8027A8C0 8E700148 */  lw        $s0, 0x148($s3)
.L8027A8C4:
/* 1A91A4 8027A8C4 8E450000 */  lw        $a1, 0x0($s2)
/* 1A91A8 8027A8C8 26520004 */  addiu     $s2, $s2, 0x4
/* 1A91AC 8027A8CC 0C0B1EAF */  jal       evt_get_variable
/* 1A91B0 8027A8D0 0260202D */   daddu    $a0, $s3, $zero
/* 1A91B4 8027A8D4 0200202D */  daddu     $a0, $s0, $zero
/* 1A91B8 8027A8D8 0C09A75B */  jal       get_actor
/* 1A91BC 8027A8DC 0040882D */   daddu    $s1, $v0, $zero
/* 1A91C0 8027A8E0 0040802D */  daddu     $s0, $v0, $zero
/* 1A91C4 8027A8E4 0200202D */  daddu     $a0, $s0, $zero
/* 1A91C8 8027A8E8 0C099117 */  jal       get_actor_part
/* 1A91CC 8027A8EC 0220282D */   daddu    $a1, $s1, $zero
/* 1A91D0 8027A8F0 0040882D */  daddu     $s1, $v0, $zero
/* 1A91D4 8027A8F4 AE700074 */  sw        $s0, 0x74($s3)
/* 1A91D8 8027A8F8 AE710078 */  sw        $s1, 0x78($s3)
/* 1A91DC 8027A8FC 8E450000 */  lw        $a1, 0x0($s2)
/* 1A91E0 8027A900 26520004 */  addiu     $s2, $s2, 0x4
/* 1A91E4 8027A904 8E300010 */  lw        $s0, 0x10($s1)
/* 1A91E8 8027A908 0C0B1EAF */  jal       evt_get_variable
/* 1A91EC 8027A90C 0260202D */   daddu    $a0, $s3, $zero
/* 1A91F0 8027A910 4482E000 */  mtc1      $v0, $f28
/* 1A91F4 8027A914 00000000 */  nop
/* 1A91F8 8027A918 4680E720 */  cvt.s.w   $f28, $f28
/* 1A91FC 8027A91C 8E450000 */  lw        $a1, 0x0($s2)
/* 1A9200 8027A920 26520004 */  addiu     $s2, $s2, 0x4
/* 1A9204 8027A924 0C0B1EAF */  jal       evt_get_variable
/* 1A9208 8027A928 0260202D */   daddu    $a0, $s3, $zero
/* 1A920C 8027A92C 4482F000 */  mtc1      $v0, $f30
/* 1A9210 8027A930 00000000 */  nop
/* 1A9214 8027A934 4680F7A0 */  cvt.s.w   $f30, $f30
/* 1A9218 8027A938 8E450000 */  lw        $a1, 0x0($s2)
/* 1A921C 8027A93C 26520004 */  addiu     $s2, $s2, 0x4
/* 1A9220 8027A940 0C0B1EAF */  jal       evt_get_variable
/* 1A9224 8027A944 0260202D */   daddu    $a0, $s3, $zero
/* 1A9228 8027A948 44820000 */  mtc1      $v0, $f0
/* 1A922C 8027A94C 00000000 */  nop
/* 1A9230 8027A950 46800020 */  cvt.s.w   $f0, $f0
/* 1A9234 8027A954 E61C000C */  swc1      $f28, 0xC($s0)
/* 1A9238 8027A958 E61E0010 */  swc1      $f30, 0x10($s0)
/* 1A923C 8027A95C E6000014 */  swc1      $f0, 0x14($s0)
/* 1A9240 8027A960 8E450000 */  lw        $a1, 0x0($s2)
/* 1A9244 8027A964 0C0B1EAF */  jal       evt_get_variable
/* 1A9248 8027A968 0260202D */   daddu    $a0, $s3, $zero
/* 1A924C 8027A96C A6020038 */  sh        $v0, 0x38($s0)
/* 1A9250 8027A970 C620002C */  lwc1      $f0, 0x2C($s1)
/* 1A9254 8027A974 C618000C */  lwc1      $f24, 0xC($s0)
/* 1A9258 8027A978 C61A0014 */  lwc1      $f26, 0x14($s0)
/* 1A925C 8027A97C C6160010 */  lwc1      $f22, 0x10($s0)
/* 1A9260 8027A980 E6000000 */  swc1      $f0, 0x0($s0)
/* 1A9264 8027A984 46000706 */  mov.s     $f28, $f0
/* 1A9268 8027A988 4406C000 */  mfc1      $a2, $f24
/* 1A926C 8027A98C 4407D000 */  mfc1      $a3, $f26
/* 1A9270 8027A990 C6200030 */  lwc1      $f0, 0x30($s1)
/* 1A9274 8027A994 4600E306 */  mov.s     $f12, $f28
/* 1A9278 8027A998 E6000004 */  swc1      $f0, 0x4($s0)
/* 1A927C 8027A99C C6340034 */  lwc1      $f20, 0x34($s1)
/* 1A9280 8027A9A0 46000786 */  mov.s     $f30, $f0
/* 1A9284 8027A9A4 4600A386 */  mov.s     $f14, $f20
/* 1A9288 8027A9A8 0C00A720 */  jal       atan2
/* 1A928C 8027A9AC E6140008 */   swc1     $f20, 0x8($s0)
/* 1A9290 8027A9B0 4600E306 */  mov.s     $f12, $f28
/* 1A9294 8027A9B4 4600A386 */  mov.s     $f14, $f20
/* 1A9298 8027A9B8 4406C000 */  mfc1      $a2, $f24
/* 1A929C 8027A9BC 4407D000 */  mfc1      $a3, $f26
/* 1A92A0 8027A9C0 461EB781 */  sub.s     $f30, $f22, $f30
/* 1A92A4 8027A9C4 0C00A7B5 */  jal       dist2D
/* 1A92A8 8027A9C8 E6000030 */   swc1     $f0, 0x30($s0)
/* 1A92AC 8027A9CC 86020038 */  lh        $v0, 0x38($s0)
/* 1A92B0 8027A9D0 46000086 */  mov.s     $f2, $f0
/* 1A92B4 8027A9D4 14400007 */  bnez      $v0, .L8027A9F4
/* 1A92B8 8027A9D8 E6020034 */   swc1     $f2, 0x34($s0)
/* 1A92BC 8027A9DC C6000028 */  lwc1      $f0, 0x28($s0)
/* 1A92C0 8027A9E0 46001003 */  div.s     $f0, $f2, $f0
/* 1A92C4 8027A9E4 4600018D */  trunc.w.s $f6, $f0
/* 1A92C8 8027A9E8 44023000 */  mfc1      $v0, $f6
/* 1A92CC 8027A9EC 0809EA82 */  j         .L8027AA08
/* 1A92D0 8027A9F0 A6020038 */   sh       $v0, 0x38($s0)
.L8027A9F4:
/* 1A92D4 8027A9F4 44820000 */  mtc1      $v0, $f0
/* 1A92D8 8027A9F8 00000000 */  nop
/* 1A92DC 8027A9FC 46800020 */  cvt.s.w   $f0, $f0
/* 1A92E0 8027AA00 46001003 */  div.s     $f0, $f2, $f0
/* 1A92E4 8027AA04 E6000028 */  swc1      $f0, 0x28($s0)
.L8027AA08:
/* 1A92E8 8027AA08 86030038 */  lh        $v1, 0x38($s0)
/* 1A92EC 8027AA0C 3C013FE0 */  lui       $at, (0x3FE00000 >> 16)
/* 1A92F0 8027AA10 44810800 */  mtc1      $at, $f1
/* 1A92F4 8027AA14 44800000 */  mtc1      $zero, $f0
/* 1A92F8 8027AA18 00031023 */  negu      $v0, $v1
/* 1A92FC 8027AA1C 44821000 */  mtc1      $v0, $f2
/* 1A9300 8027AA20 00000000 */  nop
/* 1A9304 8027AA24 468010A1 */  cvt.d.w   $f2, $f2
/* 1A9308 8027AA28 46201082 */  mul.d     $f2, $f2, $f0
/* 1A930C 8027AA2C 00000000 */  nop
/* 1A9310 8027AA30 AE00002C */  sw        $zero, 0x2C($s0)
/* 1A9314 8027AA34 C604002C */  lwc1      $f4, 0x2C($s0)
/* 1A9318 8027AA38 44830000 */  mtc1      $v1, $f0
/* 1A931C 8027AA3C 00000000 */  nop
/* 1A9320 8027AA40 46800020 */  cvt.s.w   $f0, $f0
/* 1A9324 8027AA44 4600F003 */  div.s     $f0, $f30, $f0
/* 1A9328 8027AA48 46040001 */  sub.s     $f0, $f0, $f4
/* 1A932C 8027AA4C 46000021 */  cvt.d.s   $f0, $f0
/* 1A9330 8027AA50 46220003 */  div.d     $f0, $f0, $f2
/* 1A9334 8027AA54 46200020 */  cvt.s.d   $f0, $f0
/* 1A9338 8027AA58 E6000024 */  swc1      $f0, 0x24($s0)
/* 1A933C 8027AA5C 8E2200B4 */  lw        $v0, 0xB4($s1)
/* 1A9340 8027AA60 10400009 */  beqz      $v0, .L8027AA88
/* 1A9344 8027AA64 24020001 */   addiu    $v0, $zero, 0x1
/* 1A9348 8027AA68 C6200034 */  lwc1      $f0, 0x34($s1)
/* 1A934C 8027AA6C E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A9350 8027AA70 8E2400B4 */  lw        $a0, 0xB4($s1)
/* 1A9354 8027AA74 8E26002C */  lw        $a2, 0x2C($s1)
/* 1A9358 8027AA78 8E270030 */  lw        $a3, 0x30($s1)
/* 1A935C 8027AA7C 0C052757 */  jal       sfx_play_sound_at_position
/* 1A9360 8027AA80 0000282D */   daddu    $a1, $zero, $zero
/* 1A9364 8027AA84 24020001 */  addiu     $v0, $zero, 0x1
.L8027AA88:
/* 1A9368 8027AA88 AE620070 */  sw        $v0, 0x70($s3)
.L8027AA8C:
/* 1A936C 8027AA8C 8E710078 */  lw        $s1, 0x78($s3)
/* 1A9370 8027AA90 8E300010 */  lw        $s0, 0x10($s1)
/* 1A9374 8027AA94 C6040004 */  lwc1      $f4, 0x4($s0)
/* 1A9378 8027AA98 C600002C */  lwc1      $f0, 0x2C($s0)
/* 1A937C 8027AA9C 8E050028 */  lw        $a1, 0x28($s0)
/* 1A9380 8027AAA0 46002100 */  add.s     $f4, $f4, $f0
/* 1A9384 8027AAA4 C6020024 */  lwc1      $f2, 0x24($s0)
/* 1A9388 8027AAA8 8E060030 */  lw        $a2, 0x30($s0)
/* 1A938C 8027AAAC 46020001 */  sub.s     $f0, $f0, $f2
/* 1A9390 8027AAB0 0200202D */  daddu     $a0, $s0, $zero
/* 1A9394 8027AAB4 E6040004 */  swc1      $f4, 0x4($s0)
/* 1A9398 8027AAB8 0C099070 */  jal       add_xz_vec3f_copy1
/* 1A939C 8027AABC E600002C */   swc1     $f0, 0x2C($s0)
/* 1A93A0 8027AAC0 C6000000 */  lwc1      $f0, 0x0($s0)
/* 1A93A4 8027AAC4 E620002C */  swc1      $f0, 0x2C($s1)
/* 1A93A8 8027AAC8 C6000004 */  lwc1      $f0, 0x4($s0)
/* 1A93AC 8027AACC E6200030 */  swc1      $f0, 0x30($s1)
/* 1A93B0 8027AAD0 C6000008 */  lwc1      $f0, 0x8($s0)
/* 1A93B4 8027AAD4 E6200034 */  swc1      $f0, 0x34($s1)
/* 1A93B8 8027AAD8 96020038 */  lhu       $v0, 0x38($s0)
/* 1A93BC 8027AADC 2442FFFF */  addiu     $v0, $v0, -0x1
/* 1A93C0 8027AAE0 A6020038 */  sh        $v0, 0x38($s0)
/* 1A93C4 8027AAE4 00021400 */  sll       $v0, $v0, 16
/* 1A93C8 8027AAE8 1C40000F */  bgtz      $v0, .L8027AB28
/* 1A93CC 8027AAEC 0000102D */   daddu    $v0, $zero, $zero
/* 1A93D0 8027AAF0 C6000030 */  lwc1      $f0, 0x30($s0)
/* 1A93D4 8027AAF4 E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A93D8 8027AAF8 8E05000C */  lw        $a1, 0xC($s0)
/* 1A93DC 8027AAFC 8E060010 */  lw        $a2, 0x10($s0)
/* 1A93E0 8027AB00 8E070014 */  lw        $a3, 0x14($s0)
/* 1A93E4 8027AB04 0C0990BC */  jal       play_movement_dust_effects
/* 1A93E8 8027AB08 24040002 */   addiu    $a0, $zero, 0x2
/* 1A93EC 8027AB0C C600000C */  lwc1      $f0, 0xC($s0)
/* 1A93F0 8027AB10 E620002C */  swc1      $f0, 0x2C($s1)
/* 1A93F4 8027AB14 C6000010 */  lwc1      $f0, 0x10($s0)
/* 1A93F8 8027AB18 E6200030 */  swc1      $f0, 0x30($s1)
/* 1A93FC 8027AB1C C6000014 */  lwc1      $f0, 0x14($s0)
/* 1A9400 8027AB20 24020001 */  addiu     $v0, $zero, 0x1
/* 1A9404 8027AB24 E6200034 */  swc1      $f0, 0x34($s1)
.L8027AB28:
/* 1A9408 8027AB28 8FBF0028 */  lw        $ra, 0x28($sp)
/* 1A940C 8027AB2C 8FB30024 */  lw        $s3, 0x24($sp)
/* 1A9410 8027AB30 8FB20020 */  lw        $s2, 0x20($sp)
/* 1A9414 8027AB34 8FB1001C */  lw        $s1, 0x1C($sp)
/* 1A9418 8027AB38 8FB00018 */  lw        $s0, 0x18($sp)
/* 1A941C 8027AB3C D7BE0058 */  ldc1      $f30, 0x58($sp)
/* 1A9420 8027AB40 D7BC0050 */  ldc1      $f28, 0x50($sp)
/* 1A9424 8027AB44 D7BA0048 */  ldc1      $f26, 0x48($sp)
/* 1A9428 8027AB48 D7B80040 */  ldc1      $f24, 0x40($sp)
/* 1A942C 8027AB4C D7B60038 */  ldc1      $f22, 0x38($sp)
/* 1A9430 8027AB50 D7B40030 */  ldc1      $f20, 0x30($sp)
/* 1A9434 8027AB54 03E00008 */  jr        $ra
/* 1A9438 8027AB58 27BD0060 */   addiu    $sp, $sp, 0x60

### DECOMPILED C INSTRUCTIONS:

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

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

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

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

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

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

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

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

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

        // make relative
        posX = (goalX - posX);
        posY = (goalY - posY);
        posZ = (goalZ - posZ);

        if (movement->moveTime == 0) {
            movement->moveTime = movement->distance / movement->moveSpeed;
        } else {
            movement->moveSpeed = movement->distance / movement->moveTime;
        }

        movement->unk_2C = 0.0f;
        movement->jumpScale = (posY / movement->moveTime - movement->unk_2C) / (-movement->moveTime * 0.5);
        if (part->partTypeData[4] != 0) {
            sfx_play_sound_at_position(part->partTypeData[4], SOUND_SPACE_MODE_0, part->absolutePosition.x, part->absolutePosition.y, part->absolutePosition.z);
        }
        script->functionTemp[0] = 1;
    }

    part = script->functionTempPtr[2];
    movement = part->movement;
    movement->absolutePosition.y += movement->unk_2C;
    movement->unk_2C -= movement->jumpScale;
    add_xz_vec3f_copy1(&movement->absolutePosition, movement->moveSpeed, movement->angle);
    part->absolutePosition.x = movement->absolutePosition.x;
    part->absolutePosition.y = movement->absolutePosition.y;
    part->absolutePosition.z = movement->absolutePosition.z;
    movement->moveTime--;

    if (movement->moveTime <= 0) {
        play_movement_dust_effects(2, movement->goalPos.x, movement->goalPos.y, movement->goalPos.z, movement->angle);
        part->absolutePosition.x = movement->goalPos.x;
        part->absolutePosition.y = movement->goalPos.y;
        part->absolutePosition.z = movement->goalPos.z;
        return ApiStatus_DONE1;
    } else {
        return ApiStatus_BLOCK;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel __osPfsRWInode
/* 4528C 80069E8C 27BDFFB0 */  addiu     $sp, $sp, -0x50
/* 45290 80069E90 AFB20030 */  sw        $s2, 0x30($sp)
/* 45294 80069E94 00809021 */  addu      $s2, $a0, $zero
/* 45298 80069E98 AFB40038 */  sw        $s4, 0x38($sp)
/* 4529C 80069E9C 00A0A021 */  addu      $s4, $a1, $zero
/* 452A0 80069EA0 AFB60040 */  sw        $s6, 0x40($sp)
/* 452A4 80069EA4 00C0B021 */  addu      $s6, $a2, $zero
/* 452A8 80069EA8 AFB70044 */  sw        $s7, 0x44($sp)
/* 452AC 80069EAC 00E0B821 */  addu      $s7, $a3, $zero
/* 452B0 80069EB0 32C200FF */  andi      $v0, $s6, 0xFF
/* 452B4 80069EB4 AFBF004C */  sw        $ra, 0x4C($sp)
/* 452B8 80069EB8 AFBE0048 */  sw        $fp, 0x48($sp)
/* 452BC 80069EBC AFB5003C */  sw        $s5, 0x3C($sp)
/* 452C0 80069EC0 AFB30034 */  sw        $s3, 0x34($sp)
/* 452C4 80069EC4 AFB1002C */  sw        $s1, 0x2C($sp)
/* 452C8 80069EC8 14400011 */  bnez      $v0, .L80069F10
/* 452CC 80069ECC AFB00028 */   sw       $s0, 0x28($sp)
/* 452D0 80069ED0 3C038009 */  lui       $v1, %hi(D_800958D4)
/* 452D4 80069ED4 906358D4 */  lbu       $v1, %lo(D_800958D4)($v1)
/* 452D8 80069ED8 32E200FF */  andi      $v0, $s7, 0xFF
/* 452DC 80069EDC 1443000C */  bne       $v0, $v1, .L80069F10
/* 452E0 80069EE0 00000000 */   nop
/* 452E4 80069EE4 8E430008 */  lw        $v1, 0x8($s2)
/* 452E8 80069EE8 3C028009 */  lui       $v0, %hi(D_800958D0)
/* 452EC 80069EEC 8C4258D0 */  lw        $v0, %lo(D_800958D0)($v0)
/* 452F0 80069EF0 14620007 */  bne       $v1, $v0, .L80069F10
/* 452F4 80069EF4 00000000 */   nop
/* 452F8 80069EF8 3C04800E */  lui       $a0, %hi(__osPfsInodeCache)
/* 452FC 80069EFC 24849680 */  addiu     $a0, $a0, %lo(__osPfsInodeCache)
/* 45300 80069F00 0C019194 */  jal       bcopy
/* 45304 80069F04 24060100 */   addiu    $a2, $zero, 0x100
/* 45308 80069F08 0801A865 */  j         .L8006A194
/* 4530C 80069F0C 00001021 */   addu     $v0, $zero, $zero
.L80069F10:
/* 45310 80069F10 92420065 */  lbu       $v0, 0x65($s2)
/* 45314 80069F14 10400006 */  beqz      $v0, .L80069F30
/* 45318 80069F18 02402021 */   addu     $a0, $s2, $zero
/* 4531C 80069F1C 0C01A5B4 */  jal       __osPfsSelectBank
/* 45320 80069F20 00002821 */   addu     $a1, $zero, $zero
/* 45324 80069F24 00401821 */  addu      $v1, $v0, $zero
/* 45328 80069F28 1460009A */  bnez      $v1, .L8006A194
/* 4532C 80069F2C 00000000 */   nop
.L80069F30:
/* 45330 80069F30 32E200FF */  andi      $v0, $s7, 0xFF
/* 45334 80069F34 14400002 */  bnez      $v0, .L80069F40
/* 45338 80069F38 24150001 */   addiu    $s5, $zero, 0x1
/* 4533C 80069F3C 8E550060 */  lw        $s5, 0x60($s2)
.L80069F40:
/* 45340 80069F40 32C300FF */  andi      $v1, $s6, 0xFF
/* 45344 80069F44 24020001 */  addiu     $v0, $zero, 0x1
/* 45348 80069F48 14620011 */  bne       $v1, $v0, .L80069F90
/* 4534C 80069F4C 00008021 */   addu     $s0, $zero, $zero
/* 45350 80069F50 00151040 */  sll       $v0, $s5, 1
/* 45354 80069F54 00542821 */  addu      $a1, $v0, $s4
/* 45358 80069F58 00002021 */  addu      $a0, $zero, $zero
/* 4535C 80069F5C 24020080 */  addiu     $v0, $zero, 0x80
/* 45360 80069F60 00551023 */  subu      $v0, $v0, $s5
/* 45364 80069F64 00023040 */  sll       $a2, $v0, 1
/* 45368 80069F68 18C00007 */  blez      $a2, .L80069F88
/* 4536C 80069F6C 00001821 */   addu     $v1, $zero, $zero
.L80069F70:
/* 45370 80069F70 90A20000 */  lbu       $v0, 0x0($a1)
/* 45374 80069F74 24840001 */  addiu     $a0, $a0, 0x1
/* 45378 80069F78 00621821 */  addu      $v1, $v1, $v0
/* 4537C 80069F7C 0086102A */  slt       $v0, $a0, $a2
/* 45380 80069F80 1440FFFB */  bnez      $v0, .L80069F70
/* 45384 80069F84 24A50001 */   addiu    $a1, $a1, 0x1
.L80069F88:
/* 45388 80069F88 A2830001 */  sb        $v1, 0x1($s4)
/* 4538C 80069F8C 00008021 */  addu      $s0, $zero, $zero
.L80069F90:
/* 45390 80069F90 32DE00FF */  andi      $fp, $s6, 0xFF
/* 45394 80069F94 32E200FF */  andi      $v0, $s7, 0xFF
/* 45398 80069F98 000298C0 */  sll       $s3, $v0, 3
/* 4539C 80069F9C 00101140 */  sll       $v0, $s0, 5
.L80069FA0:
/* 453A0 80069FA0 24080001 */  addiu     $t0, $zero, 0x1
/* 453A4 80069FA4 17C80015 */  bne       $fp, $t0, .L80069FFC
/* 453A8 80069FA8 02828821 */   addu     $s1, $s4, $v0
/* 453AC 80069FAC 8E460054 */  lw        $a2, 0x54($s2)
/* 453B0 80069FB0 AFA00010 */  sw        $zero, 0x10($sp)
/* 453B4 80069FB4 8E440004 */  lw        $a0, 0x4($s2)
/* 453B8 80069FB8 8E450008 */  lw        $a1, 0x8($s2)
/* 453BC 80069FBC 02203821 */  addu      $a3, $s1, $zero
/* 453C0 80069FC0 00D33021 */  addu      $a2, $a2, $s3
/* 453C4 80069FC4 00D03021 */  addu      $a2, $a2, $s0
/* 453C8 80069FC8 0C01A8F0 */  jal       osContRamWrite
/* 453CC 80069FCC 30C6FFFF */   andi     $a2, $a2, 0xFFFF
/* 453D0 80069FD0 8E460058 */  lw        $a2, 0x58($s2)
/* 453D4 80069FD4 AFA00010 */  sw        $zero, 0x10($sp)
/* 453D8 80069FD8 8E440004 */  lw        $a0, 0x4($s2)
/* 453DC 80069FDC 8E450008 */  lw        $a1, 0x8($s2)
/* 453E0 80069FE0 02203821 */  addu      $a3, $s1, $zero
/* 453E4 80069FE4 00D33021 */  addu      $a2, $a2, $s3
/* 453E8 80069FE8 00D03021 */  addu      $a2, $a2, $s0
/* 453EC 80069FEC 0C01A8F0 */  jal       osContRamWrite
/* 453F0 80069FF0 30C6FFFF */   andi     $a2, $a2, 0xFFFF
/* 453F4 80069FF4 0801A808 */  j         .L8006A020
/* 453F8 80069FF8 00401821 */   addu     $v1, $v0, $zero
.L80069FFC:
/* 453FC 80069FFC 8E440004 */  lw        $a0, 0x4($s2)
/* 45400 8006A000 8E460054 */  lw        $a2, 0x54($s2)
/* 45404 8006A004 8E450008 */  lw        $a1, 0x8($s2)
/* 45408 8006A008 02203821 */  addu      $a3, $s1, $zero
/* 4540C 8006A00C 00D33021 */  addu      $a2, $a2, $s3
/* 45410 8006A010 00D03021 */  addu      $a2, $a2, $s0
/* 45414 8006A014 0C01A874 */  jal       __osContRamRead
/* 45418 8006A018 30C6FFFF */   andi     $a2, $a2, 0xFFFF
/* 4541C 8006A01C 00401821 */  addu      $v1, $v0, $zero
.L8006A020:
/* 45420 8006A020 1460003D */  bnez      $v1, .L8006A118
/* 45424 8006A024 26100001 */   addiu    $s0, $s0, 0x1
/* 45428 8006A028 2A020008 */  slti      $v0, $s0, 0x8
/* 4542C 8006A02C 1440FFDC */  bnez      $v0, .L80069FA0
/* 45430 8006A030 00101140 */   sll      $v0, $s0, 5
/* 45434 8006A034 32C200FF */  andi      $v0, $s6, 0xFF
/* 45438 8006A038 5440004C */  bnel      $v0, $zero, .L8006A16C
/* 4543C 8006A03C 02802021 */   addu     $a0, $s4, $zero
/* 45440 8006A040 00003821 */  addu      $a3, $zero, $zero
/* 45444 8006A044 00151040 */  sll       $v0, $s5, 1
/* 45448 8006A048 00542821 */  addu      $a1, $v0, $s4
/* 4544C 8006A04C 24020080 */  addiu     $v0, $zero, 0x80
/* 45450 8006A050 00551023 */  subu      $v0, $v0, $s5
/* 45454 8006A054 00023040 */  sll       $a2, $v0, 1
/* 45458 8006A058 0066102A */  slt       $v0, $v1, $a2
/* 4545C 8006A05C 10400007 */  beqz      $v0, .L8006A07C
/* 45460 8006A060 00002021 */   addu     $a0, $zero, $zero
.L8006A064:
/* 45464 8006A064 90A20000 */  lbu       $v0, 0x0($a1)
/* 45468 8006A068 24840001 */  addiu     $a0, $a0, 0x1
/* 4546C 8006A06C 00E23821 */  addu      $a3, $a3, $v0
/* 45470 8006A070 0086102A */  slt       $v0, $a0, $a2
/* 45474 8006A074 1440FFFB */  bnez      $v0, .L8006A064
/* 45478 8006A078 24A50001 */   addiu    $a1, $a1, 0x1
.L8006A07C:
/* 4547C 8006A07C 92830001 */  lbu       $v1, 0x1($s4)
/* 45480 8006A080 30E200FF */  andi      $v0, $a3, 0xFF
/* 45484 8006A084 10430038 */  beq       $v0, $v1, .L8006A168
/* 45488 8006A088 32E200FF */   andi     $v0, $s7, 0xFF
/* 4548C 8006A08C 00008021 */  addu      $s0, $zero, $zero
/* 45490 8006A090 000298C0 */  sll       $s3, $v0, 3
/* 45494 8006A094 02808821 */  addu      $s1, $s4, $zero
.L8006A098:
/* 45498 8006A098 8E440004 */  lw        $a0, 0x4($s2)
/* 4549C 8006A09C 8E450008 */  lw        $a1, 0x8($s2)
/* 454A0 8006A0A0 8E460058 */  lw        $a2, 0x58($s2)
/* 454A4 8006A0A4 02203821 */  addu      $a3, $s1, $zero
/* 454A8 8006A0A8 26310020 */  addiu     $s1, $s1, 0x20
/* 454AC 8006A0AC 00D33021 */  addu      $a2, $a2, $s3
/* 454B0 8006A0B0 00D03021 */  addu      $a2, $a2, $s0
/* 454B4 8006A0B4 0C01A874 */  jal       __osContRamRead
/* 454B8 8006A0B8 30C6FFFF */   andi     $a2, $a2, 0xFFFF
/* 454BC 8006A0BC 26100001 */  addiu     $s0, $s0, 0x1
/* 454C0 8006A0C0 2A020008 */  slti      $v0, $s0, 0x8
/* 454C4 8006A0C4 1440FFF4 */  bnez      $v0, .L8006A098
/* 454C8 8006A0C8 24030080 */   addiu    $v1, $zero, 0x80
/* 454CC 8006A0CC 00151040 */  sll       $v0, $s5, 1
/* 454D0 8006A0D0 00543021 */  addu      $a2, $v0, $s4
/* 454D4 8006A0D4 00002021 */  addu      $a0, $zero, $zero
/* 454D8 8006A0D8 00751823 */  subu      $v1, $v1, $s5
/* 454DC 8006A0DC 00031840 */  sll       $v1, $v1, 1
/* 454E0 8006A0E0 18600007 */  blez      $v1, .L8006A100
/* 454E4 8006A0E4 00002821 */   addu     $a1, $zero, $zero
.L8006A0E8:
/* 454E8 8006A0E8 90C20000 */  lbu       $v0, 0x0($a2)
/* 454EC 8006A0EC 24840001 */  addiu     $a0, $a0, 0x1
/* 454F0 8006A0F0 00A22821 */  addu      $a1, $a1, $v0
/* 454F4 8006A0F4 0083102A */  slt       $v0, $a0, $v1
/* 454F8 8006A0F8 1440FFFB */  bnez      $v0, .L8006A0E8
/* 454FC 8006A0FC 24C60001 */   addiu    $a2, $a2, 0x1
.L8006A100:
/* 45500 8006A100 92830001 */  lbu       $v1, 0x1($s4)
/* 45504 8006A104 30A200FF */  andi      $v0, $a1, 0xFF
/* 45508 8006A108 10430005 */  beq       $v0, $v1, .L8006A120
/* 4550C 8006A10C 24020003 */   addiu    $v0, $zero, 0x3
/* 45510 8006A110 0801A865 */  j         .L8006A194
/* 45514 8006A114 00000000 */   nop
.L8006A118:
/* 45518 8006A118 0801A865 */  j         .L8006A194
/* 4551C 8006A11C 00601021 */   addu     $v0, $v1, $zero
.L8006A120:
/* 45520 8006A120 00008021 */  addu      $s0, $zero, $zero
/* 45524 8006A124 32E200FF */  andi      $v0, $s7, 0xFF
/* 45528 8006A128 000298C0 */  sll       $s3, $v0, 3
/* 4552C 8006A12C 02808821 */  addu      $s1, $s4, $zero
.L8006A130:
/* 45530 8006A130 8E460054 */  lw        $a2, 0x54($s2)
/* 45534 8006A134 AFA00010 */  sw        $zero, 0x10($sp)
/* 45538 8006A138 8E440004 */  lw        $a0, 0x4($s2)
/* 4553C 8006A13C 8E450008 */  lw        $a1, 0x8($s2)
/* 45540 8006A140 02203821 */  addu      $a3, $s1, $zero
/* 45544 8006A144 26310020 */  addiu     $s1, $s1, 0x20
/* 45548 8006A148 00D33021 */  addu      $a2, $a2, $s3
/* 4554C 8006A14C 00D03021 */  addu      $a2, $a2, $s0
/* 45550 8006A150 0C01A8F0 */  jal       osContRamWrite
/* 45554 8006A154 30C6FFFF */   andi     $a2, $a2, 0xFFFF
/* 45558 8006A158 26100001 */  addiu     $s0, $s0, 0x1
/* 4555C 8006A15C 2A020008 */  slti      $v0, $s0, 0x8
/* 45560 8006A160 1440FFF3 */  bnez      $v0, .L8006A130
/* 45564 8006A164 00000000 */   nop
.L8006A168:
/* 45568 8006A168 02802021 */  addu      $a0, $s4, $zero
.L8006A16C:
/* 4556C 8006A16C 3C05800E */  lui       $a1, %hi(__osPfsInodeCache)
/* 45570 8006A170 24A59680 */  addiu     $a1, $a1, %lo(__osPfsInodeCache)
/* 45574 8006A174 3C018009 */  lui       $at, %hi(D_800958D4)
/* 45578 8006A178 A03758D4 */  sb        $s7, %lo(D_800958D4)($at)
/* 4557C 8006A17C 0C019194 */  jal       bcopy
/* 45580 8006A180 24060100 */   addiu    $a2, $zero, 0x100
/* 45584 8006A184 8E430008 */  lw        $v1, 0x8($s2)
/* 45588 8006A188 00001021 */  addu      $v0, $zero, $zero
/* 4558C 8006A18C 3C018009 */  lui       $at, %hi(D_800958D0)
/* 45590 8006A190 AC2358D0 */  sw        $v1, %lo(D_800958D0)($at)
.L8006A194:
/* 45594 8006A194 8FBF004C */  lw        $ra, 0x4C($sp)
/* 45598 8006A198 8FBE0048 */  lw        $fp, 0x48($sp)
/* 4559C 8006A19C 8FB70044 */  lw        $s7, 0x44($sp)
/* 455A0 8006A1A0 8FB60040 */  lw        $s6, 0x40($sp)
/* 455A4 8006A1A4 8FB5003C */  lw        $s5, 0x3C($sp)
/* 455A8 8006A1A8 8FB40038 */  lw        $s4, 0x38($sp)
/* 455AC 8006A1AC 8FB30034 */  lw        $s3, 0x34($sp)
/* 455B0 8006A1B0 8FB20030 */  lw        $s2, 0x30($sp)
/* 455B4 8006A1B4 8FB1002C */  lw        $s1, 0x2C($sp)
/* 455B8 8006A1B8 8FB00028 */  lw        $s0, 0x28($sp)
/* 455BC 8006A1BC 03E00008 */  jr        $ra
/* 455C0 8006A1C0 27BD0050 */   addiu    $sp, $sp, 0x50
/* 455C4 8006A1C4 00000000 */  nop
/* 455C8 8006A1C8 00000000 */  nop
/* 455CC 8006A1CC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

s32 __osPfsRWInode(OSPfs *pfs, __OSInode *inode, u8 flag, u8 bank) {
    u8 sum;
    int j;
    s32 ret;
    int offset;
    u8 *addr;

    if (flag == PFS_READ && bank == __osPfsInodeCacheBank && pfs->channel == __osPfsInodeCacheChannel) {
        bcopy(&__osPfsInodeCache, inode, sizeof(__OSInode));
        return 0;
    }

    SET_ACTIVEBANK_TO_ZERO;

    if (bank > 0) {
        offset = 1;
    } else {
        offset = pfs->inode_start_page;
    }

    if (flag == PFS_WRITE) {
        inode->inode_page[0].inode_t.page = __osSumcalc((u8*)&inode->inode_page[offset], (128 - offset) * 2);
    }

    for (j = 0; j < PFS_ONE_PAGE; j++) {
        addr = ((u8 *)inode->inode_page + j * 32);
        if (flag == PFS_WRITE) {
            ret = __osContRamWrite(pfs->queue, pfs->channel, pfs->inode_table + bank * PFS_ONE_PAGE + j, addr, FALSE);
            ret = __osContRamWrite(pfs->queue, pfs->channel, pfs->minode_table + bank * PFS_ONE_PAGE + j, addr, FALSE);
        } else {
            ret = __osContRamRead(pfs->queue, pfs->channel, pfs->inode_table + bank * 8 + j, addr);
        }
        if (ret != 0) {
            return ret;
        }
    }
    if (flag == PFS_READ) {
        sum = __osSumcalc((u8*)&inode->inode_page[offset], (128 - offset) * 2);
        if (sum != inode->inode_page[0].inode_t.page) {
            for (j = 0; j < PFS_ONE_PAGE; j++) {
                addr = ((u8 *)inode->inode_page + j * 32);
                ret = __osContRamRead(pfs->queue, pfs->channel, pfs->minode_table + bank * PFS_ONE_PAGE + j, addr);
            }
            sum = __osSumcalc((u8*)&inode->inode_page[offset], (128 - offset) * 2);
            if (sum != inode->inode_page[0].inode_t.page) {
                return PFS_ERR_INCONSISTENT;
            }
            for (j = 0; j < PFS_ONE_PAGE; j++) {
                addr = ((u8 *)inode->inode_page + j * 32);
                ret = __osContRamWrite(pfs->queue, pfs->channel, pfs->inode_table + bank * PFS_ONE_PAGE + j, addr, FALSE);
            }
        }
    }
    __osPfsInodeCacheBank = bank;
    bcopy(inode, &__osPfsInodeCache, sizeof(__OSInode));
    __osPfsInodeCacheChannel = pfs->channel;
    return 0;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel stars_spread_appendGfx
/* 3606B4 E005A3F4 27BDFF28 */  addiu     $sp, $sp, -0xD8
/* 3606B8 E005A3F8 AFBE00B8 */  sw        $fp, 0xB8($sp)
/* 3606BC E005A3FC 0080F02D */  daddu     $fp, $a0, $zero
/* 3606C0 E005A400 3C06DB06 */  lui       $a2, (0xDB060024 >> 16)
/* 3606C4 E005A404 34C60024 */  ori       $a2, $a2, (0xDB060024 & 0xFFFF)
/* 3606C8 E005A408 27A40018 */  addiu     $a0, $sp, 0x18
/* 3606CC E005A40C AFB00098 */  sw        $s0, 0x98($sp)
/* 3606D0 E005A410 3C100001 */  lui       $s0, (0x11630 >> 16)
/* 3606D4 E005A414 36101630 */  ori       $s0, $s0, (0x11630 & 0xFFFF)
/* 3606D8 E005A418 AFB200A0 */  sw        $s2, 0xA0($sp)
/* 3606DC E005A41C 3C12800A */  lui       $s2, %hi(gMainGfxPos)
/* 3606E0 E005A420 2652A66C */  addiu     $s2, $s2, %lo(gMainGfxPos)
/* 3606E4 E005A424 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 3606E8 E005A428 AFBF00BC */  sw        $ra, 0xBC($sp)
/* 3606EC E005A42C AFB700B4 */  sw        $s7, 0xB4($sp)
/* 3606F0 E005A430 AFB600B0 */  sw        $s6, 0xB0($sp)
/* 3606F4 E005A434 AFB500AC */  sw        $s5, 0xAC($sp)
/* 3606F8 E005A438 AFB400A8 */  sw        $s4, 0xA8($sp)
/* 3606FC E005A43C AFB300A4 */  sw        $s3, 0xA4($sp)
/* 360700 E005A440 AFB1009C */  sw        $s1, 0x9C($sp)
/* 360704 E005A444 F7B800D0 */  sdc1      $f24, 0xD0($sp)
/* 360708 E005A448 F7B600C8 */  sdc1      $f22, 0xC8($sp)
/* 36070C E005A44C F7B400C0 */  sdc1      $f20, 0xC0($sp)
/* 360710 E005A450 8E430000 */  lw        $v1, 0x0($s2)
/* 360714 E005A454 8FD3000C */  lw        $s3, 0xC($fp)
/* 360718 E005A458 0060282D */  daddu     $a1, $v1, $zero
/* 36071C E005A45C 24630008 */  addiu     $v1, $v1, 0x8
/* 360720 E005A460 AE430000 */  sw        $v1, 0x0($s2)
/* 360724 E005A464 ACA20000 */  sw        $v0, 0x0($a1)
/* 360728 E005A468 24620008 */  addiu     $v0, $v1, 0x8
/* 36072C E005A46C ACA00004 */  sw        $zero, 0x4($a1)
/* 360730 E005A470 AE420000 */  sw        $v0, 0x0($s2)
/* 360734 E005A474 AC660000 */  sw        $a2, 0x0($v1)
/* 360738 E005A478 8FC50010 */  lw        $a1, 0x10($fp)
/* 36073C E005A47C 24620010 */  addiu     $v0, $v1, 0x10
/* 360740 E005A480 AE420000 */  sw        $v0, 0x0($s2)
/* 360744 E005A484 8CA5001C */  lw        $a1, 0x1C($a1)
/* 360748 E005A488 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 36074C E005A48C AC620008 */  sw        $v0, 0x8($v1)
/* 360750 E005A490 3C020900 */  lui       $v0, %hi(D_09000440_4154A0)
/* 360754 E005A494 24420440 */  addiu     $v0, $v0, %lo(D_09000440_4154A0)
/* 360758 E005A498 AC62000C */  sw        $v0, 0xC($v1)
/* 36075C E005A49C 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 360760 E005A4A0 00A22821 */  addu      $a1, $a1, $v0
/* 360764 E005A4A4 AC650004 */  sw        $a1, 0x4($v1)
/* 360768 E005A4A8 8E650004 */  lw        $a1, 0x4($s3)
/* 36076C E005A4AC 8E660008 */  lw        $a2, 0x8($s3)
/* 360770 E005A4B0 8E67000C */  lw        $a3, 0xC($s3)
/* 360774 E005A4B4 0C080108 */  jal       shim_guTranslateF
/* 360778 E005A4B8 24140001 */   addiu    $s4, $zero, 0x1
/* 36077C E005A4BC 27B10058 */  addiu     $s1, $sp, 0x58
/* 360780 E005A4C0 4480A000 */  mtc1      $zero, $f20
/* 360784 E005A4C4 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 360788 E005A4C8 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 36078C E005A4CC 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 360790 E005A4D0 4481C000 */  mtc1      $at, $f24
/* 360794 E005A4D4 00031080 */  sll       $v0, $v1, 2
/* 360798 E005A4D8 00431021 */  addu      $v0, $v0, $v1
/* 36079C E005A4DC 00021080 */  sll       $v0, $v0, 2
/* 3607A0 E005A4E0 00431023 */  subu      $v0, $v0, $v1
/* 3607A4 E005A4E4 000218C0 */  sll       $v1, $v0, 3
/* 3607A8 E005A4E8 00431021 */  addu      $v0, $v0, $v1
/* 3607AC E005A4EC 000210C0 */  sll       $v0, $v0, 3
/* 3607B0 E005A4F0 4406A000 */  mfc1      $a2, $f20
/* 3607B4 E005A4F4 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 3607B8 E005A4F8 00220821 */  addu      $at, $at, $v0
/* 3607BC E005A4FC C4201DEC */  lwc1      $f0, %lo(gCameras + 0x6C)($at)
/* 3607C0 E005A500 4407C000 */  mfc1      $a3, $f24
/* 3607C4 E005A504 46000007 */  neg.s     $f0, $f0
/* 3607C8 E005A508 44050000 */  mfc1      $a1, $f0
/* 3607CC E005A50C 0220202D */  daddu     $a0, $s1, $zero
/* 3607D0 E005A510 0C080104 */  jal       shim_guRotateF
/* 3607D4 E005A514 E7B40010 */   swc1     $f20, 0x10($sp)
/* 3607D8 E005A518 0220202D */  daddu     $a0, $s1, $zero
/* 3607DC E005A51C 27A50018 */  addiu     $a1, $sp, 0x18
/* 3607E0 E005A520 0C080114 */  jal       shim_guMtxCatF
/* 3607E4 E005A524 00A0302D */   daddu    $a2, $a1, $zero
/* 3607E8 E005A528 27A40018 */  addiu     $a0, $sp, 0x18
/* 3607EC E005A52C 3C158007 */  lui       $s5, %hi(gMatrixListPos)
/* 3607F0 E005A530 26B541F0 */  addiu     $s5, $s5, %lo(gMatrixListPos)
/* 3607F4 E005A534 3C16800A */  lui       $s6, %hi(gDisplayContext)
/* 3607F8 E005A538 26D6A674 */  addiu     $s6, $s6, %lo(gDisplayContext)
/* 3607FC E005A53C 96A50000 */  lhu       $a1, 0x0($s5)
/* 360800 E005A540 8EC20000 */  lw        $v0, 0x0($s6)
/* 360804 E005A544 00052980 */  sll       $a1, $a1, 6
/* 360808 E005A548 00B02821 */  addu      $a1, $a1, $s0
/* 36080C E005A54C 0C080118 */  jal       shim_guMtxF2L
/* 360810 E005A550 00452821 */   addu     $a1, $v0, $a1
/* 360814 E005A554 3C06DCDC */  lui       $a2, (0xDCDC28E6 >> 16)
/* 360818 E005A558 8E440000 */  lw        $a0, 0x0($s2)
/* 36081C E005A55C 34C628E6 */  ori       $a2, $a2, (0xDCDC28E6 & 0xFFFF)
/* 360820 E005A560 0080282D */  daddu     $a1, $a0, $zero
/* 360824 E005A564 24840008 */  addiu     $a0, $a0, 0x8
/* 360828 E005A568 AE440000 */  sw        $a0, 0x0($s2)
/* 36082C E005A56C 96A20000 */  lhu       $v0, 0x0($s5)
/* 360830 E005A570 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 360834 E005A574 ACA30000 */  sw        $v1, 0x0($a1)
/* 360838 E005A578 00541821 */  addu      $v1, $v0, $s4
/* 36083C E005A57C 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 360840 E005A580 00021180 */  sll       $v0, $v0, 6
/* 360844 E005A584 A6A30000 */  sh        $v1, 0x0($s5)
/* 360848 E005A588 8EC30000 */  lw        $v1, 0x0($s6)
/* 36084C E005A58C 00501021 */  addu      $v0, $v0, $s0
/* 360850 E005A590 00621821 */  addu      $v1, $v1, $v0
/* 360854 E005A594 24820008 */  addiu     $v0, $a0, 0x8
/* 360858 E005A598 ACA30004 */  sw        $v1, 0x4($a1)
/* 36085C E005A59C AE420000 */  sw        $v0, 0x0($s2)
/* 360860 E005A5A0 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 360864 E005A5A4 AC820000 */  sw        $v0, 0x0($a0)
/* 360868 E005A5A8 AC860004 */  sw        $a2, 0x4($a0)
/* 36086C E005A5AC 8FC20008 */  lw        $v0, 0x8($fp)
/* 360870 E005A5B0 0282102A */  slt       $v0, $s4, $v0
/* 360874 E005A5B4 10400049 */  beqz      $v0, .LE005A6DC
/* 360878 E005A5B8 26730034 */   addiu    $s3, $s3, 0x34
/* 36087C E005A5BC 4600A586 */  mov.s     $f22, $f20
/* 360880 E005A5C0 4600C506 */  mov.s     $f20, $f24
/* 360884 E005A5C4 02C0B82D */  daddu     $s7, $s6, $zero
/* 360888 E005A5C8 02A0B02D */  daddu     $s6, $s5, $zero
/* 36088C E005A5CC 3C150001 */  lui       $s5, (0x11630 >> 16)
/* 360890 E005A5D0 36B51630 */  ori       $s5, $s5, (0x11630 & 0xFFFF)
/* 360894 E005A5D4 26700030 */  addiu     $s0, $s3, 0x30
.LE005A5D8:
/* 360898 E005A5D8 27A40018 */  addiu     $a0, $sp, 0x18
/* 36089C E005A5DC 8E05FFD4 */  lw        $a1, -0x2C($s0)
/* 3608A0 E005A5E0 8E06FFD8 */  lw        $a2, -0x28($s0)
/* 3608A4 E005A5E4 8E07FFDC */  lw        $a3, -0x24($s0)
/* 3608A8 E005A5E8 0C080108 */  jal       shim_guTranslateF
/* 3608AC E005A5EC 26940001 */   addiu    $s4, $s4, 0x1
/* 3608B0 E005A5F0 E7B40010 */  swc1      $f20, 0x10($sp)
/* 3608B4 E005A5F4 8E05FFEC */  lw        $a1, -0x14($s0)
/* 3608B8 E005A5F8 4406B000 */  mfc1      $a2, $f22
/* 3608BC E005A5FC 4407B000 */  mfc1      $a3, $f22
/* 3608C0 E005A600 0C080104 */  jal       shim_guRotateF
/* 3608C4 E005A604 0220202D */   daddu    $a0, $s1, $zero
/* 3608C8 E005A608 0220202D */  daddu     $a0, $s1, $zero
/* 3608CC E005A60C 27A50018 */  addiu     $a1, $sp, 0x18
/* 3608D0 E005A610 0C080114 */  jal       shim_guMtxCatF
/* 3608D4 E005A614 00A0302D */   daddu    $a2, $a1, $zero
/* 3608D8 E005A618 0220202D */  daddu     $a0, $s1, $zero
/* 3608DC E005A61C 8E050000 */  lw        $a1, 0x0($s0)
/* 3608E0 E005A620 26100034 */  addiu     $s0, $s0, 0x34
/* 3608E4 E005A624 4407A000 */  mfc1      $a3, $f20
/* 3608E8 E005A628 0C080110 */  jal       shim_guScaleF
/* 3608EC E005A62C 00A0302D */   daddu    $a2, $a1, $zero
/* 3608F0 E005A630 0220202D */  daddu     $a0, $s1, $zero
/* 3608F4 E005A634 27A50018 */  addiu     $a1, $sp, 0x18
/* 3608F8 E005A638 0C080114 */  jal       shim_guMtxCatF
/* 3608FC E005A63C 00A0302D */   daddu    $a2, $a1, $zero
/* 360900 E005A640 27A40018 */  addiu     $a0, $sp, 0x18
/* 360904 E005A644 96C50000 */  lhu       $a1, 0x0($s6)
/* 360908 E005A648 8EE20000 */  lw        $v0, 0x0($s7)
/* 36090C E005A64C 00052980 */  sll       $a1, $a1, 6
/* 360910 E005A650 00B52821 */  addu      $a1, $a1, $s5
/* 360914 E005A654 0C080118 */  jal       shim_guMtxF2L
/* 360918 E005A658 00452821 */   addu     $a1, $v0, $a1
/* 36091C E005A65C 3C06D838 */  lui       $a2, (0xD8380002 >> 16)
/* 360920 E005A660 8E440000 */  lw        $a0, 0x0($s2)
/* 360924 E005A664 34C60002 */  ori       $a2, $a2, (0xD8380002 & 0xFFFF)
/* 360928 E005A668 0080282D */  daddu     $a1, $a0, $zero
/* 36092C E005A66C 24840008 */  addiu     $a0, $a0, 0x8
/* 360930 E005A670 AE440000 */  sw        $a0, 0x0($s2)
/* 360934 E005A674 96C20000 */  lhu       $v0, 0x0($s6)
/* 360938 E005A678 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 36093C E005A67C ACA30000 */  sw        $v1, 0x0($a1)
/* 360940 E005A680 24430001 */  addiu     $v1, $v0, 0x1
/* 360944 E005A684 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 360948 E005A688 00021180 */  sll       $v0, $v0, 6
/* 36094C E005A68C A6C30000 */  sh        $v1, 0x0($s6)
/* 360950 E005A690 8EE30000 */  lw        $v1, 0x0($s7)
/* 360954 E005A694 00551021 */  addu      $v0, $v0, $s5
/* 360958 E005A698 00621821 */  addu      $v1, $v1, $v0
/* 36095C E005A69C 24820008 */  addiu     $v0, $a0, 0x8
/* 360960 E005A6A0 ACA30004 */  sw        $v1, 0x4($a1)
/* 360964 E005A6A4 AE420000 */  sw        $v0, 0x0($s2)
/* 360968 E005A6A8 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 36096C E005A6AC 3C080900 */  lui       $t0, %hi(D_090004F0_415550)
/* 360970 E005A6B0 250804F0 */  addiu     $t0, $t0, %lo(D_090004F0_415550)
/* 360974 E005A6B4 AC820000 */  sw        $v0, 0x0($a0)
/* 360978 E005A6B8 24020040 */  addiu     $v0, $zero, 0x40
/* 36097C E005A6BC AC880004 */  sw        $t0, 0x4($a0)
/* 360980 E005A6C0 AC860008 */  sw        $a2, 0x8($a0)
/* 360984 E005A6C4 AC82000C */  sw        $v0, 0xC($a0)
/* 360988 E005A6C8 8FC20008 */  lw        $v0, 0x8($fp)
/* 36098C E005A6CC 24840010 */  addiu     $a0, $a0, 0x10
/* 360990 E005A6D0 0282102A */  slt       $v0, $s4, $v0
/* 360994 E005A6D4 1440FFC0 */  bnez      $v0, .LE005A5D8
/* 360998 E005A6D8 AE440000 */   sw       $a0, 0x0($s2)
.LE005A6DC:
/* 36099C E005A6DC 3C05D838 */  lui       $a1, (0xD8380002 >> 16)
/* 3609A0 E005A6E0 3C03800A */  lui       $v1, %hi(gMainGfxPos)
/* 3609A4 E005A6E4 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
/* 3609A8 E005A6E8 8C620000 */  lw        $v0, 0x0($v1)
/* 3609AC E005A6EC 34A50002 */  ori       $a1, $a1, (0xD8380002 & 0xFFFF)
/* 3609B0 E005A6F0 0040202D */  daddu     $a0, $v0, $zero
/* 3609B4 E005A6F4 24420008 */  addiu     $v0, $v0, 0x8
/* 3609B8 E005A6F8 AC620000 */  sw        $v0, 0x0($v1)
/* 3609BC E005A6FC 24020040 */  addiu     $v0, $zero, 0x40
/* 3609C0 E005A700 AC850000 */  sw        $a1, 0x0($a0)
/* 3609C4 E005A704 AC820004 */  sw        $v0, 0x4($a0)
/* 3609C8 E005A708 8FBF00BC */  lw        $ra, 0xBC($sp)
/* 3609CC E005A70C 8FBE00B8 */  lw        $fp, 0xB8($sp)
/* 3609D0 E005A710 8FB700B4 */  lw        $s7, 0xB4($sp)
/* 3609D4 E005A714 8FB600B0 */  lw        $s6, 0xB0($sp)
/* 3609D8 E005A718 8FB500AC */  lw        $s5, 0xAC($sp)
/* 3609DC E005A71C 8FB400A8 */  lw        $s4, 0xA8($sp)
/* 3609E0 E005A720 8FB300A4 */  lw        $s3, 0xA4($sp)
/* 3609E4 E005A724 8FB200A0 */  lw        $s2, 0xA0($sp)
/* 3609E8 E005A728 8FB1009C */  lw        $s1, 0x9C($sp)
/* 3609EC E005A72C 8FB00098 */  lw        $s0, 0x98($sp)
/* 3609F0 E005A730 D7B800D0 */  ldc1      $f24, 0xD0($sp)
/* 3609F4 E005A734 D7B600C8 */  ldc1      $f22, 0xC8($sp)
/* 3609F8 E005A738 D7B400C0 */  ldc1      $f20, 0xC0($sp)
/* 3609FC E005A73C 03E00008 */  jr        $ra
/* 360A00 E005A740 27BD00D8 */   addiu    $sp, $sp, 0xD8
/* 360A04 E005A744 00000000 */  nop
/* 360A08 E005A748 00000000 */  nop
/* 360A0C E005A74C 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void stars_spread_appendGfx(void* effect) {
    StarsSpreadFXData* part = ((EffectInstance*)effect)->data.starsSpread;
    Gfx* dlist = D_090004F0_360F20;
    Matrix4f sp18;
    Matrix4f sp58;
    s32 i;

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

    shim_guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C);
    shim_guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f);
    shim_guMtxCatF(sp58, sp18, sp18);
    shim_guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);

    gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
    gDPSetPrimColor(gMainGfxPos++, 0, 0, 220, 220, 40, 230);

    part++;
    for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) {
        shim_guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C);
        shim_guRotateF(sp58, part->unk_1C, 0.0f, 0.0f, 1.0f);
        shim_guMtxCatF(sp58, sp18, sp18);
        shim_guScaleF(sp58, part->unk_30, part->unk_30, 1.0f);
        shim_guMtxCatF(sp58, sp18, sp18);
        shim_guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);

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

    gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel spr_load_npc_extra_anims
/* 1020FC 802DF00C 27BDFE30 */  addiu     $sp, $sp, -0x1D0
/* 102100 802DF010 AFB601C0 */  sw        $s6, 0x1C0($sp)
/* 102104 802DF014 0080B02D */  daddu     $s6, $a0, $zero
/* 102108 802DF018 AFB101AC */  sw        $s1, 0x1AC($sp)
/* 10210C 802DF01C 24110063 */  addiu     $s1, $zero, 0x63
/* 102110 802DF020 27A2019C */  addiu     $v0, $sp, 0x19C
/* 102114 802DF024 AFBF01C8 */  sw        $ra, 0x1C8($sp)
/* 102118 802DF028 AFB701C4 */  sw        $s7, 0x1C4($sp)
/* 10211C 802DF02C AFB501BC */  sw        $s5, 0x1BC($sp)
/* 102120 802DF030 AFB401B8 */  sw        $s4, 0x1B8($sp)
/* 102124 802DF034 AFB301B4 */  sw        $s3, 0x1B4($sp)
/* 102128 802DF038 AFB201B0 */  sw        $s2, 0x1B0($sp)
/* 10212C 802DF03C AFB001A8 */  sw        $s0, 0x1A8($sp)
.L802DF040:
/* 102130 802DF040 AC400000 */  sw        $zero, 0x0($v0)
/* 102134 802DF044 2631FFFF */  addiu     $s1, $s1, -0x1
/* 102138 802DF048 0621FFFD */  bgez      $s1, .L802DF040
/* 10213C 802DF04C 2442FFFC */   addiu    $v0, $v0, -0x4
/* 102140 802DF050 8CA30000 */  lw        $v1, 0x0($a1)
/* 102144 802DF054 2402FFFF */  addiu     $v0, $zero, -0x1
/* 102148 802DF058 1062004B */  beq       $v1, $v0, .L802DF188
/* 10214C 802DF05C 24A50004 */   addiu    $a1, $a1, 0x4
/* 102150 802DF060 0040602D */  daddu     $t4, $v0, $zero
/* 102154 802DF064 24124000 */  addiu     $s2, $zero, 0x4000
/* 102158 802DF068 24111000 */  addiu     $s1, $zero, 0x1000
/* 10215C 802DF06C 24102000 */  addiu     $s0, $zero, 0x2000
/* 102160 802DF070 240F3000 */  addiu     $t7, $zero, 0x3000
/* 102164 802DF074 240E6000 */  addiu     $t6, $zero, 0x6000
/* 102168 802DF078 240D5000 */  addiu     $t5, $zero, 0x5000
.L802DF07C:
/* 10216C 802DF07C 306200FF */  andi      $v0, $v1, 0xFF
/* 102170 802DF080 00021080 */  sll       $v0, $v0, 2
/* 102174 802DF084 02C21021 */  addu      $v0, $s6, $v0
/* 102178 802DF088 080B7C5C */  j         .L802DF170
/* 10217C 802DF08C 8C480010 */   lw       $t0, 0x10($v0)
.L802DF090:
/* 102180 802DF090 94620004 */  lhu       $v0, 0x4($v1)
/* 102184 802DF094 8C660000 */  lw        $a2, 0x0($v1)
/* 102188 802DF098 00021400 */  sll       $v0, $v0, 16
/* 10218C 802DF09C 00021C03 */  sra       $v1, $v0, 16
/* 102190 802DF0A0 000217C2 */  srl       $v0, $v0, 31
/* 102194 802DF0A4 00621821 */  addu      $v1, $v1, $v0
/* 102198 802DF0A8 00031843 */  sra       $v1, $v1, 1
/* 10219C 802DF0AC 18600030 */  blez      $v1, .L802DF170
/* 1021A0 802DF0B0 00000000 */   nop
/* 1021A4 802DF0B4 240B7000 */  addiu     $t3, $zero, 0x7000
/* 1021A8 802DF0B8 27A90010 */  addiu     $t1, $sp, 0x10
/* 1021AC 802DF0BC 240A0001 */  addiu     $t2, $zero, 0x1
.L802DF0C0:
/* 1021B0 802DF0C0 94C70000 */  lhu       $a3, 0x0($a2)
/* 1021B4 802DF0C4 24C60002 */  addiu     $a2, $a2, 0x2
/* 1021B8 802DF0C8 30E4F000 */  andi      $a0, $a3, 0xF000
/* 1021BC 802DF0CC 10920022 */  beq       $a0, $s2, .L802DF158
/* 1021C0 802DF0D0 2463FFFF */   addiu    $v1, $v1, -0x1
/* 1021C4 802DF0D4 28824001 */  slti      $v0, $a0, 0x4001
/* 1021C8 802DF0D8 1040000B */  beqz      $v0, .L802DF108
/* 1021CC 802DF0DC 00000000 */   nop
/* 1021D0 802DF0E0 10910015 */  beq       $a0, $s1, .L802DF138
/* 1021D4 802DF0E4 28821001 */   slti     $v0, $a0, 0x1001
/* 1021D8 802DF0E8 1440001F */  bnez      $v0, .L802DF168
/* 1021DC 802DF0EC 00000000 */   nop
/* 1021E0 802DF0F0 1090001D */  beq       $a0, $s0, .L802DF168
/* 1021E4 802DF0F4 00000000 */   nop
/* 1021E8 802DF0F8 508F0016 */  beql      $a0, $t7, .L802DF154
/* 1021EC 802DF0FC 24C60002 */   addiu    $a2, $a2, 0x2
/* 1021F0 802DF100 080B7C5A */  j         .L802DF168
/* 1021F4 802DF104 00000000 */   nop
.L802DF108:
/* 1021F8 802DF108 108E0017 */  beq       $a0, $t6, .L802DF168
/* 1021FC 802DF10C 28826001 */   slti     $v0, $a0, 0x6001
/* 102200 802DF110 10400005 */  beqz      $v0, .L802DF128
/* 102204 802DF114 00000000 */   nop
/* 102208 802DF118 508D0012 */  beql      $a0, $t5, .L802DF164
/* 10220C 802DF11C 24C60002 */   addiu    $a2, $a2, 0x2
/* 102210 802DF120 080B7C5A */  j         .L802DF168
/* 102214 802DF124 00000000 */   nop
.L802DF128:
/* 102218 802DF128 508B000E */  beql      $a0, $t3, .L802DF164
/* 10221C 802DF12C 24C60002 */   addiu    $a2, $a2, 0x2
/* 102220 802DF130 080B7C5A */  j         .L802DF168
/* 102224 802DF134 00000000 */   nop
.L802DF138:
/* 102228 802DF138 30E400FF */  andi      $a0, $a3, 0xFF
/* 10222C 802DF13C 28820064 */  slti      $v0, $a0, 0x64
/* 102230 802DF140 10400009 */  beqz      $v0, .L802DF168
/* 102234 802DF144 00041080 */   sll      $v0, $a0, 2
/* 102238 802DF148 01221021 */  addu      $v0, $t1, $v0
/* 10223C 802DF14C 080B7C5A */  j         .L802DF168
/* 102240 802DF150 AC4A0000 */   sw       $t2, 0x0($v0)
.L802DF154:
/* 102244 802DF154 2463FFFF */  addiu     $v1, $v1, -0x1
.L802DF158:
/* 102248 802DF158 24C60002 */  addiu     $a2, $a2, 0x2
/* 10224C 802DF15C 2463FFFF */  addiu     $v1, $v1, -0x1
/* 102250 802DF160 24C60002 */  addiu     $a2, $a2, 0x2
.L802DF164:
/* 102254 802DF164 2463FFFF */  addiu     $v1, $v1, -0x1
.L802DF168:
/* 102258 802DF168 1C60FFD5 */  bgtz      $v1, .L802DF0C0
/* 10225C 802DF16C 00000000 */   nop
.L802DF170:
/* 102260 802DF170 8D030000 */  lw        $v1, 0x0($t0)
/* 102264 802DF174 146CFFC6 */  bne       $v1, $t4, .L802DF090
/* 102268 802DF178 25080004 */   addiu    $t0, $t0, 0x4
/* 10226C 802DF17C 8CA30000 */  lw        $v1, 0x0($a1)
/* 102270 802DF180 146CFFBE */  bne       $v1, $t4, .L802DF07C
/* 102274 802DF184 24A50004 */   addiu    $a1, $a1, 0x4
.L802DF188:
/* 102278 802DF188 0000882D */  daddu     $s1, $zero, $zero
/* 10227C 802DF18C 8ED30000 */  lw        $s3, 0x0($s6)
/* 102280 802DF190 2417FFFF */  addiu     $s7, $zero, -0x1
/* 102284 802DF194 8E650000 */  lw        $a1, 0x0($s3)
/* 102288 802DF198 27B40010 */  addiu     $s4, $sp, 0x10
/* 10228C 802DF19C 8CB20000 */  lw        $s2, 0x0($a1)
.L802DF1A0:
/* 102290 802DF1A0 8E650000 */  lw        $a1, 0x0($s3)
/* 102294 802DF1A4 50B70019 */  beql      $a1, $s7, .L802DF20C
/* 102298 802DF1A8 0240302D */   daddu    $a2, $s2, $zero
/* 10229C 802DF1AC 8E820000 */  lw        $v0, 0x0($s4)
/* 1022A0 802DF1B0 50400011 */  beql      $v0, $zero, .L802DF1F8
/* 1022A4 802DF1B4 26730004 */   addiu    $s3, $s3, 0x4
/* 1022A8 802DF1B8 90A30004 */  lbu       $v1, 0x4($a1)
/* 1022AC 802DF1BC 90A20005 */  lbu       $v0, 0x5($a1)
/* 1022B0 802DF1C0 00620018 */  mult      $v1, $v0
/* 1022B4 802DF1C4 8CA40000 */  lw        $a0, 0x0($a1)
/* 1022B8 802DF1C8 0000C012 */  mflo      $t8
/* 1022BC 802DF1CC 00188043 */  sra       $s0, $t8, 1
/* 1022C0 802DF1D0 0250A821 */  addu      $s5, $s2, $s0
/* 1022C4 802DF1D4 12440005 */  beq       $s2, $a0, .L802DF1EC
/* 1022C8 802DF1D8 26100008 */   addiu    $s0, $s0, 0x8
/* 1022CC 802DF1DC ACB20000 */  sw        $s2, 0x0($a1)
/* 1022D0 802DF1E0 0240282D */  daddu     $a1, $s2, $zero
/* 1022D4 802DF1E4 0C019194 */  jal       bcopy
/* 1022D8 802DF1E8 0200302D */   daddu    $a2, $s0, $zero
.L802DF1EC:
/* 1022DC 802DF1EC AE750000 */  sw        $s5, 0x0($s3)
/* 1022E0 802DF1F0 02509021 */  addu      $s2, $s2, $s0
/* 1022E4 802DF1F4 26730004 */  addiu     $s3, $s3, 0x4
.L802DF1F8:
/* 1022E8 802DF1F8 26310001 */  addiu     $s1, $s1, 0x1
/* 1022EC 802DF1FC 2A220064 */  slti      $v0, $s1, 0x64
/* 1022F0 802DF200 1440FFE7 */  bnez      $v0, .L802DF1A0
/* 1022F4 802DF204 26940004 */   addiu    $s4, $s4, 0x4
/* 1022F8 802DF208 0240302D */  daddu     $a2, $s2, $zero
.L802DF20C:
/* 1022FC 802DF20C 00111080 */  sll       $v0, $s1, 2
/* 102300 802DF210 0000882D */  daddu     $s1, $zero, $zero
/* 102304 802DF214 27A40010 */  addiu     $a0, $sp, 0x10
/* 102308 802DF218 00821021 */  addu      $v0, $a0, $v0
/* 10230C 802DF21C 24030001 */  addiu     $v1, $zero, 0x1
/* 102310 802DF220 AC430000 */  sw        $v1, 0x0($v0)
/* 102314 802DF224 8ED30000 */  lw        $s3, 0x0($s6)
/* 102318 802DF228 2407FFFF */  addiu     $a3, $zero, -0x1
/* 10231C 802DF22C AEC60000 */  sw        $a2, 0x0($s6)
.L802DF230:
/* 102320 802DF230 8E650000 */  lw        $a1, 0x0($s3)
/* 102324 802DF234 8C820000 */  lw        $v0, 0x0($a0)
/* 102328 802DF238 10400003 */  beqz      $v0, .L802DF248
/* 10232C 802DF23C 26730004 */   addiu    $s3, $s3, 0x4
/* 102330 802DF240 080B7C93 */  j         .L802DF24C
/* 102334 802DF244 ACC50000 */   sw       $a1, 0x0($a2)
.L802DF248:
/* 102338 802DF248 ACD50000 */  sw        $s5, 0x0($a2)
.L802DF24C:
/* 10233C 802DF24C 10A70005 */  beq       $a1, $a3, .L802DF264
/* 102340 802DF250 24C60004 */   addiu    $a2, $a2, 0x4
/* 102344 802DF254 26310001 */  addiu     $s1, $s1, 0x1
/* 102348 802DF258 2A220064 */  slti      $v0, $s1, 0x64
/* 10234C 802DF25C 1440FFF4 */  bnez      $v0, .L802DF230
/* 102350 802DF260 24840004 */   addiu    $a0, $a0, 0x4
.L802DF264:
/* 102354 802DF264 0000882D */  daddu     $s1, $zero, $zero
/* 102358 802DF268 8EC30004 */  lw        $v1, 0x4($s6)
/* 10235C 802DF26C 2404FFFF */  addiu     $a0, $zero, -0x1
/* 102360 802DF270 AEC60004 */  sw        $a2, 0x4($s6)
.L802DF274:
/* 102364 802DF274 8C650000 */  lw        $a1, 0x0($v1)
/* 102368 802DF278 24630004 */  addiu     $v1, $v1, 0x4
/* 10236C 802DF27C ACC50000 */  sw        $a1, 0x0($a2)
/* 102370 802DF280 10A40005 */  beq       $a1, $a0, .L802DF298
/* 102374 802DF284 24C60004 */   addiu    $a2, $a2, 0x4
/* 102378 802DF288 26310001 */  addiu     $s1, $s1, 0x1
/* 10237C 802DF28C 2A220064 */  slti      $v0, $s1, 0x64
/* 102380 802DF290 1440FFF8 */  bnez      $v0, .L802DF274
/* 102384 802DF294 00000000 */   nop
.L802DF298:
/* 102388 802DF298 3C048035 */  lui       $a0, %hi(heap_spriteHead)
/* 10238C 802DF29C 2484F800 */  addiu     $a0, $a0, %lo(heap_spriteHead)
/* 102390 802DF2A0 02C0282D */  daddu     $a1, $s6, $zero
/* 102394 802DF2A4 0C00A4B1 */  jal       _heap_realloc
/* 102398 802DF2A8 00C53023 */   subu     $a2, $a2, $a1
/* 10239C 802DF2AC 8FBF01C8 */  lw        $ra, 0x1C8($sp)
/* 1023A0 802DF2B0 8FB701C4 */  lw        $s7, 0x1C4($sp)
/* 1023A4 802DF2B4 8FB601C0 */  lw        $s6, 0x1C0($sp)
/* 1023A8 802DF2B8 8FB501BC */  lw        $s5, 0x1BC($sp)
/* 1023AC 802DF2BC 8FB401B8 */  lw        $s4, 0x1B8($sp)
/* 1023B0 802DF2C0 8FB301B4 */  lw        $s3, 0x1B4($sp)
/* 1023B4 802DF2C4 8FB201B0 */  lw        $s2, 0x1B0($sp)
/* 1023B8 802DF2C8 8FB101AC */  lw        $s1, 0x1AC($sp)
/* 1023BC 802DF2CC 8FB001A8 */  lw        $s0, 0x1A8($sp)
/* 1023C0 802DF2D0 03E00008 */  jr        $ra
/* 1023C4 802DF2D4 27BD01D0 */   addiu    $sp, $sp, 0x1D0

### DECOMPILED C INSTRUCTIONS:

void spr_load_npc_extra_anims(SpriteAnimData* header, u32* extraAnimList) {
    u8* src;
    s32 imgID;
    s32 rasterSize;
    s32 remaining;
    u16 animCmd;
    u16* cmdList;
    u32 extraAnimID;
    u8* dataPos;
    void* copyEnd;
    SpriteAnimComponent* comp;
    SpriteAnimComponent** compList;
    void* writePos;
    SpriteRasterCacheEntry** rasterList;
    SpriteRasterCacheEntry* raster;
    u16** oldPalList;
    u16* palette;
    // one extra required for 'done' sentinel
    s32 sawRaster[100 + 1];
    s32 i;

    for (i = 0; i < ARRAY_COUNT(sawRaster) - 1; i++) {
        sawRaster[i] = FALSE;
    }

    while ((extraAnimID = *extraAnimList++) != -1) {
        compList = header->animListStart[extraAnimID & 0xFF];
        while ((comp = *compList++) != PTR_LIST_END) {
            cmdList = comp->cmdList;
            remaining = (s16) comp->cmdListSize / 2;
            while (remaining > 0) {
                animCmd = *cmdList++;
                remaining--;
                switch (animCmd & 0xF000) {
                    case 0x1000:
                        i = animCmd; // required to match
                        imgID = i & 0xFF;
                        if (imgID < ARRAY_COUNT(sawRaster) - 1) {
                            sawRaster[imgID] = TRUE;
                        }
                        break;
                    case 0x3000:
                        cmdList++;
                        remaining--;
                        // fallthrough
                    case 0x4000:
                        cmdList++;
                        remaining--;
                        // fallthrough
                    case 0x7000:
                    case 0x5000:
                        cmdList++;
                        remaining--;
                        // fallthrough
                    case 0x0000:
                    case 0x2000:
                    case 0x6000:
                    case 0x8000:
                        break;
                }
            }
        }
    }

    rasterList = header->rastersOffset;
    raster = *rasterList;
    dataPos = raster->image;

    for (i = 0; i < ARRAY_COUNT(sawRaster) - 1; i++) {
        if ((raster = *rasterList) == PTR_LIST_END) {
            break;
        }
        if (sawRaster[i]) {
            src = raster->image;
            rasterSize = (raster->width * raster->height) / 2;
            copyEnd = &dataPos[rasterSize];
            rasterSize += 8;
            if (dataPos != src) {
                raster->image = dataPos;
                bcopy(src, dataPos, rasterSize);
            }
            *rasterList = copyEnd;
            dataPos += rasterSize;
        }
        rasterList++;
    }
    // sentinel value to mark end of valid data
    sawRaster[i] = TRUE;

    writePos = dataPos;

    // copy raster list
    rasterList = header->rastersOffset;
    header->rastersOffset = writePos;

    for (i = 0; i < ARRAY_COUNT(sawRaster) - 1; i++) {
        raster = *rasterList++;
        if (sawRaster[i]) {
            *(SpriteRasterCacheEntry**) writePos = raster;
        } else {
            *(SpriteRasterCacheEntry**) writePos = (SpriteRasterCacheEntry*) copyEnd;
        }
        writePos += 4;
        if (raster == PTR_LIST_END) {
            break;
        }
    }

    // copy palette list
    oldPalList = header->palettesOffset;
    header->palettesOffset = writePos;

    for (i = 0; i < ARRAY_COUNT(sawRaster) - 1; i++) {
        raster = (SpriteRasterCacheEntry*)*oldPalList++; // required to match
        *(u16**)writePos = (u16*)raster;
        writePos += 4;
        if (raster == PTR_LIST_END) {
            break;
        }
    }

    _heap_realloc(&heap_spriteHead, header, (s32)writePos - (s32)header);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel osPfsAllocateFile
/* 43590 80068190 27BDFD68 */  addiu     $sp, $sp, -0x298
/* 43594 80068194 AFB00270 */  sw        $s0, 0x270($sp)
/* 43598 80068198 8FB002AC */  lw        $s0, 0x2AC($sp)
/* 4359C 8006819C A7A50256 */  sh        $a1, 0x256($sp)
/* 435A0 800681A0 97A50256 */  lhu       $a1, 0x256($sp)
/* 435A4 800681A4 AFB20278 */  sw        $s2, 0x278($sp)
/* 435A8 800681A8 00809021 */  addu      $s2, $a0, $zero
/* 435AC 800681AC AFB60288 */  sw        $s6, 0x288($sp)
/* 435B0 800681B0 0000B021 */  addu      $s6, $zero, $zero
/* 435B4 800681B4 AFB7028C */  sw        $s7, 0x28C($sp)
/* 435B8 800681B8 0000B821 */  addu      $s7, $zero, $zero
/* 435BC 800681BC AFB50284 */  sw        $s5, 0x284($sp)
/* 435C0 800681C0 0000A821 */  addu      $s5, $zero, $zero
/* 435C4 800681C4 AFA6025C */  sw        $a2, 0x25C($sp)
/* 435C8 800681C8 2CC30001 */  sltiu     $v1, $a2, 0x1
/* 435CC 800681CC AFBF0294 */  sw        $ra, 0x294($sp)
/* 435D0 800681D0 AFBE0290 */  sw        $fp, 0x290($sp)
/* 435D4 800681D4 AFB40280 */  sw        $s4, 0x280($sp)
/* 435D8 800681D8 AFB3027C */  sw        $s3, 0x27C($sp)
/* 435DC 800681DC AFB10274 */  sw        $s1, 0x274($sp)
/* 435E0 800681E0 2CA20001 */  sltiu     $v0, $a1, 0x1
/* 435E4 800681E4 00431025 */  or        $v0, $v0, $v1
/* 435E8 800681E8 14400020 */  bnez      $v0, .L8006826C
/* 435EC 800681EC AFA70264 */   sw       $a3, 0x264($sp)
/* 435F0 800681F0 260600FF */  addiu     $a2, $s0, 0xFF
/* 435F4 800681F4 04C20001 */  bltzl     $a2, .L800681FC
/* 435F8 800681F8 260601FE */   addiu    $a2, $s0, 0x1FE
.L800681FC:
/* 435FC 800681FC 00069A03 */  sra       $s3, $a2, 8
/* 43600 80068200 8FA802A8 */  lw        $t0, 0x2A8($sp)
/* 43604 80068204 8FA6025C */  lw        $a2, 0x25C($sp)
/* 43608 80068208 8FA70264 */  lw        $a3, 0x264($sp)
/* 4360C 8006820C AFA80010 */  sw        $t0, 0x10($sp)
/* 43610 80068210 8FA802B0 */  lw        $t0, 0x2B0($sp)
/* 43614 80068214 02402021 */  addu      $a0, $s2, $zero
/* 43618 80068218 0C01A370 */  jal       osPfsFindFile
/* 4361C 8006821C AFA80014 */   sw       $t0, 0x14($sp)
/* 43620 80068220 00401821 */  addu      $v1, $v0, $zero
/* 43624 80068224 10600003 */  beqz      $v1, .L80068234
/* 43628 80068228 24020005 */   addiu    $v0, $zero, 0x5
/* 4362C 8006822C 1462008F */  bne       $v1, $v0, .L8006846C
/* 43630 80068230 00601021 */   addu     $v0, $v1, $zero
.L80068234:
/* 43634 80068234 8FA802B0 */  lw        $t0, 0x2B0($sp)
/* 43638 80068238 8D030000 */  lw        $v1, 0x0($t0)
/* 4363C 8006823C 2402FFFF */  addiu     $v0, $zero, -0x1
/* 43640 80068240 1462008A */  bne       $v1, $v0, .L8006846C
/* 43644 80068244 24020009 */   addiu    $v0, $zero, 0x9
/* 43648 80068248 02402021 */  addu      $a0, $s2, $zero
/* 4364C 8006824C 0C01A3E0 */  jal       osPfsFreeBlocks
/* 43650 80068250 27A50240 */   addiu    $a1, $sp, 0x240
/* 43654 80068254 8FA20240 */  lw        $v0, 0x240($sp)
/* 43658 80068258 0050102A */  slt       $v0, $v0, $s0
/* 4365C 8006825C 14400083 */  bnez      $v0, .L8006846C
/* 43660 80068260 24020007 */   addiu    $v0, $zero, 0x7
/* 43664 80068264 16600003 */  bnez      $s3, .L80068274
/* 43668 80068268 02402021 */   addu     $a0, $s2, $zero
.L8006826C:
/* 4366C 8006826C 0801A11B */  j         .L8006846C
/* 43670 80068270 24020005 */   addiu    $v0, $zero, 0x5
.L80068274:
/* 43674 80068274 00002821 */  addu      $a1, $zero, $zero
/* 43678 80068278 8FA802B0 */  lw        $t0, 0x2B0($sp)
/* 4367C 8006827C 00003021 */  addu      $a2, $zero, $zero
/* 43680 80068280 00003821 */  addu      $a3, $zero, $zero
/* 43684 80068284 AFA00010 */  sw        $zero, 0x10($sp)
/* 43688 80068288 0C01A370 */  jal       osPfsFindFile
/* 4368C 8006828C AFA80014 */   sw       $t0, 0x14($sp)
/* 43690 80068290 00401821 */  addu      $v1, $v0, $zero
/* 43694 80068294 10600003 */  beqz      $v1, .L800682A4
/* 43698 80068298 24020005 */   addiu    $v0, $zero, 0x5
/* 4369C 8006829C 14620073 */  bne       $v1, $v0, .L8006846C
/* 436A0 800682A0 00601021 */   addu     $v0, $v1, $zero
.L800682A4:
/* 436A4 800682A4 8FA802B0 */  lw        $t0, 0x2B0($sp)
/* 436A8 800682A8 8D030000 */  lw        $v1, 0x0($t0)
/* 436AC 800682AC 2402FFFF */  addiu     $v0, $zero, -0x1
/* 436B0 800682B0 1062006E */  beq       $v1, $v0, .L8006846C
/* 436B4 800682B4 24020008 */   addiu    $v0, $zero, 0x8
/* 436B8 800682B8 92420064 */  lbu       $v0, 0x64($s2)
/* 436BC 800682BC 1040004A */  beqz      $v0, .L800683E8
/* 436C0 800682C0 00008821 */   addu     $s1, $zero, $zero
/* 436C4 800682C4 27B40120 */  addiu     $s4, $sp, 0x120
/* 436C8 800682C8 02402021 */  addu      $a0, $s2, $zero
.L800682CC:
/* 436CC 800682CC 27A50020 */  addiu     $a1, $sp, 0x20
/* 436D0 800682D0 00003021 */  addu      $a2, $zero, $zero
/* 436D4 800682D4 323000FF */  andi      $s0, $s1, 0xFF
/* 436D8 800682D8 0C01A7A3 */  jal       __osPfsRWInode
/* 436DC 800682DC 02003821 */   addu     $a3, $s0, $zero
/* 436E0 800682E0 00401821 */  addu      $v1, $v0, $zero
/* 436E4 800682E4 14600048 */  bnez      $v1, .L80068408
/* 436E8 800682E8 02402021 */   addu     $a0, $s2, $zero
/* 436EC 800682EC 27A50020 */  addiu     $a1, $sp, 0x20
/* 436F0 800682F0 02603021 */  addu      $a2, $s3, $zero
/* 436F4 800682F4 27A70244 */  addiu     $a3, $sp, 0x244
/* 436F8 800682F8 27A20248 */  addiu     $v0, $sp, 0x248
/* 436FC 800682FC AFA20014 */  sw        $v0, 0x14($sp)
/* 43700 80068300 27A2024C */  addiu     $v0, $sp, 0x24C
/* 43704 80068304 AFB00010 */  sw        $s0, 0x10($sp)
/* 43708 80068308 0C01A127 */  jal       osPfsDeclearPage
/* 4370C 8006830C AFA20018 */   sw       $v0, 0x18($sp)
/* 43710 80068310 00401821 */  addu      $v1, $v0, $zero
/* 43714 80068314 1460003C */  bnez      $v1, .L80068408
/* 43718 80068318 2402FFFF */   addiu    $v0, $zero, -0x1
/* 4371C 8006831C 8FA30244 */  lw        $v1, 0x244($sp)
/* 43720 80068320 1062002B */  beq       $v1, $v0, .L800683D0
/* 43724 80068324 00000000 */   nop
/* 43728 80068328 12A0000F */  beqz      $s5, .L80068368
/* 4372C 8006832C 02402021 */   addu     $a0, $s2, $zero
/* 43730 80068330 02802821 */  addu      $a1, $s4, $zero
/* 43734 80068334 00161040 */  sll       $v0, $s6, 1
/* 43738 80068338 02821021 */  addu      $v0, $s4, $v0
/* 4373C 8006833C A0510000 */  sb        $s1, 0x0($v0)
/* 43740 80068340 8FA30244 */  lw        $v1, 0x244($sp)
/* 43744 80068344 24060001 */  addiu     $a2, $zero, 0x1
/* 43748 80068348 32E700FF */  andi      $a3, $s7, 0xFF
/* 4374C 8006834C 0C01A7A3 */  jal       __osPfsRWInode
/* 43750 80068350 A0430001 */   sb       $v1, 0x1($v0)
/* 43754 80068354 00401821 */  addu      $v1, $v0, $zero
/* 43758 80068358 10600006 */  beqz      $v1, .L80068374
/* 4375C 8006835C 00000000 */   nop
/* 43760 80068360 0801A11B */  j         .L8006846C
/* 43764 80068364 00000000 */   nop
.L80068368:
/* 43768 80068368 306300FF */  andi      $v1, $v1, 0xFF
/* 4376C 8006836C 00111200 */  sll       $v0, $s1, 8
/* 43770 80068370 0043F025 */  or        $fp, $v0, $v1
.L80068374:
/* 43774 80068374 8FA20248 */  lw        $v0, 0x248($sp)
/* 43778 80068378 0053102A */  slt       $v0, $v0, $s3
/* 4377C 8006837C 1440000C */  bnez      $v0, .L800683B0
/* 43780 80068380 27A40020 */   addiu    $a0, $sp, 0x20
/* 43784 80068384 00009821 */  addu      $s3, $zero, $zero
/* 43788 80068388 02402021 */  addu      $a0, $s2, $zero
/* 4378C 8006838C 27A50020 */  addiu     $a1, $sp, 0x20
/* 43790 80068390 24060001 */  addiu     $a2, $zero, 0x1
/* 43794 80068394 0C01A7A3 */  jal       __osPfsRWInode
/* 43798 80068398 322700FF */   andi     $a3, $s1, 0xFF
/* 4379C 8006839C 00401821 */  addu      $v1, $v0, $zero
/* 437A0 800683A0 10600011 */  beqz      $v1, .L800683E8
/* 437A4 800683A4 00000000 */   nop
/* 437A8 800683A8 0801A11B */  j         .L8006846C
/* 437AC 800683AC 00000000 */   nop
.L800683B0:
/* 437B0 800683B0 27A50120 */  addiu     $a1, $sp, 0x120
/* 437B4 800683B4 0C019194 */  jal       bcopy
/* 437B8 800683B8 24060100 */   addiu    $a2, $zero, 0x100
/* 437BC 800683BC 8FB6024C */  lw        $s6, 0x24C($sp)
/* 437C0 800683C0 8FA20248 */  lw        $v0, 0x248($sp)
/* 437C4 800683C4 0220B821 */  addu      $s7, $s1, $zero
/* 437C8 800683C8 26B50001 */  addiu     $s5, $s5, 0x1
/* 437CC 800683CC 02629823 */  subu      $s3, $s3, $v0
.L800683D0:
/* 437D0 800683D0 92430064 */  lbu       $v1, 0x64($s2)
/* 437D4 800683D4 26310001 */  addiu     $s1, $s1, 0x1
/* 437D8 800683D8 322200FF */  andi      $v0, $s1, 0xFF
/* 437DC 800683DC 0043102B */  sltu      $v0, $v0, $v1
/* 437E0 800683E0 1440FFBA */  bnez      $v0, .L800682CC
/* 437E4 800683E4 02402021 */   addu     $a0, $s2, $zero
.L800683E8:
/* 437E8 800683E8 1E600020 */  bgtz      $s3, .L8006846C
/* 437EC 800683EC 24020003 */   addiu    $v0, $zero, 0x3
/* 437F0 800683F0 8FA30244 */  lw        $v1, 0x244($sp)
/* 437F4 800683F4 2402FFFF */  addiu     $v0, $zero, -0x1
/* 437F8 800683F8 14620005 */  bne       $v1, $v0, .L80068410
/* 437FC 800683FC 27A50230 */   addiu    $a1, $sp, 0x230
/* 43800 80068400 0801A11B */  j         .L8006846C
/* 43804 80068404 24020003 */   addiu    $v0, $zero, 0x3
.L80068408:
/* 43808 80068408 0801A11B */  j         .L8006846C
/* 4380C 8006840C 00601021 */   addu     $v0, $v1, $zero
.L80068410:
/* 43810 80068410 97A80256 */  lhu       $t0, 0x256($sp)
/* 43814 80068414 8FA40264 */  lw        $a0, 0x264($sp)
/* 43818 80068418 A7A80224 */  sh        $t0, 0x224($sp)
/* 4381C 8006841C 8FA8025C */  lw        $t0, 0x25C($sp)
/* 43820 80068420 24060010 */  addiu     $a2, $zero, 0x10
/* 43824 80068424 A7BE0226 */  sh        $fp, 0x226($sp)
/* 43828 80068428 A7A0022A */  sh        $zero, 0x22A($sp)
/* 4382C 8006842C 0C019194 */  jal       bcopy
/* 43830 80068430 AFA80220 */   sw       $t0, 0x220($sp)
/* 43834 80068434 8FA402A8 */  lw        $a0, 0x2A8($sp)
/* 43838 80068438 27A5022C */  addiu     $a1, $sp, 0x22C
/* 4383C 8006843C 0C019194 */  jal       bcopy
/* 43840 80068440 24060004 */   addiu    $a2, $zero, 0x4
/* 43844 80068444 8FA802B0 */  lw        $t0, 0x2B0($sp)
/* 43848 80068448 8E46005C */  lw        $a2, 0x5C($s2)
/* 4384C 8006844C 8D020000 */  lw        $v0, 0x0($t0)
/* 43850 80068450 27A70220 */  addiu     $a3, $sp, 0x220
/* 43854 80068454 AFA00010 */  sw        $zero, 0x10($sp)
/* 43858 80068458 8E440004 */  lw        $a0, 0x4($s2)
/* 4385C 8006845C 8E450008 */  lw        $a1, 0x8($s2)
/* 43860 80068460 00C23021 */  addu      $a2, $a2, $v0
/* 43864 80068464 0C01A8F0 */  jal       osContRamWrite
/* 43868 80068468 30C6FFFF */   andi     $a2, $a2, 0xFFFF
.L8006846C:
/* 4386C 8006846C 8FBF0294 */  lw        $ra, 0x294($sp)
/* 43870 80068470 8FBE0290 */  lw        $fp, 0x290($sp)
/* 43874 80068474 8FB7028C */  lw        $s7, 0x28C($sp)
/* 43878 80068478 8FB60288 */  lw        $s6, 0x288($sp)
/* 4387C 8006847C 8FB50284 */  lw        $s5, 0x284($sp)
/* 43880 80068480 8FB40280 */  lw        $s4, 0x280($sp)
/* 43884 80068484 8FB3027C */  lw        $s3, 0x27C($sp)
/* 43888 80068488 8FB20278 */  lw        $s2, 0x278($sp)
/* 4388C 8006848C 8FB10274 */  lw        $s1, 0x274($sp)
/* 43890 80068490 8FB00270 */  lw        $s0, 0x270($sp)
/* 43894 80068494 03E00008 */  jr        $ra
/* 43898 80068498 27BD0298 */   addiu    $sp, $sp, 0x298

### DECOMPILED C INSTRUCTIONS:

s32 osPfsAllocateFile(OSPfs* pfs, u16 companyCode, u32 gameCode, u8* gameName, u8* extName, int fileSize, s32* fileNo) {
    s32 startPage;
    s32 decleared;
    s32 prevPage;
    s32 oldPrevPage = 0;
    s32 ret = 0;
    s32 fileSizeInPages;
    __OSInode inode;
    __OSInode backupInode;
    __OSDir dir;
    u8 bank;
    u8 prevBank = 0;
    s32 firsttime = 0;
    s32 bytes;
    __OSInodeUnit fpage;

    if ((companyCode == 0) || (gameCode == 0)) {
        return PFS_ERR_INVALID;
    }

    fileSizeInPages = (fileSize + PFS_PAGE_SIZE - 1) / PFS_PAGE_SIZE;

    if (((ret = osPfsFindFile(pfs, companyCode, gameCode, gameName, extName, fileNo)) != 0) &&
        (ret != PFS_ERR_INVALID)) {
        return ret;
    }
    if (*fileNo != -1) {
        return PFS_ERR_EXIST;
    }

    ret = osPfsFreeBlocks(pfs, &bytes);
    if (fileSize > bytes) {
        return PFS_DATA_FULL;
    }

    if (fileSizeInPages == 0) {
        return (PFS_ERR_INVALID);
    }

    if (((ret = osPfsFindFile(pfs, 0, 0, 0, 0, fileNo)) != 0) && (ret != PFS_ERR_INVALID)) {
        return ret;
    }
    if (*fileNo == -1) {
        return PFS_DIR_FULL;
    }

    for (bank = PFS_ID_BANK_256K; bank < pfs->banks; bank++) {
        if ((ret = __osPfsRWInode(pfs, &inode, PFS_READ, bank)) != 0) {
            return ret;
        }
        ret = __osPfsDeclearPage(pfs, &inode, fileSizeInPages, &startPage, bank, &decleared, &prevPage);
        if (ret) {
            return ret;
        }
        if (startPage != -1) { /* There is free space */
            if (firsttime == 0) {
                fpage.inode_t.page = (u8)startPage;
                fpage.inode_t.bank = bank;
            } else { /* Writing previous bank inode */
                backupInode.inode_page[oldPrevPage].inode_t.bank = bank;
                backupInode.inode_page[oldPrevPage].inode_t.page = (u8)startPage;
                if ((ret = __osPfsRWInode(pfs, &backupInode, PFS_WRITE, prevBank)) != 0) {
                    return ret;
                }
            }
            if (fileSizeInPages > decleared) {
                bcopy(&inode, &backupInode, sizeof(__OSInode));
                oldPrevPage = prevPage;
                prevBank = bank;
                fileSizeInPages -= decleared;
                firsttime++;
            } else {
                fileSizeInPages = 0;
                if ((ret = __osPfsRWInode(pfs, &inode, PFS_WRITE, bank)) != 0) {
                    return ret;
                }
                break;
            }
        }
    }
    if ((fileSizeInPages > 0) || (startPage == -1)) {
        return PFS_ERR_INCONSISTENT;
    }

    dir.start_page = fpage;
    dir.company_code = companyCode;
    dir.game_code = gameCode;
    dir.data_sum = 0;

    bcopy(gameName, dir.game_name, PFS_FILE_NAME_LEN);
    bcopy(extName, dir.ext_name, PFS_FILE_EXT_LEN);

    return __osContRamWrite(pfs->queue, pfs->channel, pfs->dir_table + *fileNo, (u8*)&dir, 0);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel draw_shop_items
/* 7E23A4 80281524 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 7E23A8 80281528 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 7E23AC 8028152C 27BDFF90 */  addiu     $sp, $sp, -0x70
/* 7E23B0 80281530 AFBF005C */  sw        $ra, 0x5C($sp)
/* 7E23B4 80281534 AFBE0058 */  sw        $fp, 0x58($sp)
/* 7E23B8 80281538 AFB70054 */  sw        $s7, 0x54($sp)
/* 7E23BC 8028153C AFB60050 */  sw        $s6, 0x50($sp)
/* 7E23C0 80281540 AFB5004C */  sw        $s5, 0x4C($sp)
/* 7E23C4 80281544 AFB40048 */  sw        $s4, 0x48($sp)
/* 7E23C8 80281548 AFB30044 */  sw        $s3, 0x44($sp)
/* 7E23CC 8028154C AFB20040 */  sw        $s2, 0x40($sp)
/* 7E23D0 80281550 AFB1003C */  sw        $s1, 0x3C($sp)
/* 7E23D4 80281554 AFB00038 */  sw        $s0, 0x38($sp)
/* 7E23D8 80281558 F7B60068 */  sdc1      $f22, 0x68($sp)
/* 7E23DC 8028155C F7B40060 */  sdc1      $f20, 0x60($sp)
/* 7E23E0 80281560 8C520144 */  lw        $s2, 0x144($v0)
/* 7E23E4 80281564 96420000 */  lhu       $v0, 0x0($s2)
/* 7E23E8 80281568 30420001 */  andi      $v0, $v0, 0x1
/* 7E23EC 8028156C 10400005 */  beqz      $v0, .L80281584
/* 7E23F0 80281570 2404000A */   addiu    $a0, $zero, 0xA
/* 7E23F4 80281574 3C108014 */  lui       $s0, %hi(basic_window_update)
/* 7E23F8 80281578 26107474 */  addiu     $s0, $s0, %lo(basic_window_update)
/* 7E23FC 8028157C 080A0563 */  j         .L8028158C
/* 7E2400 80281580 00000000 */   nop
.L80281584:
/* 7E2404 80281584 3C108014 */  lui       $s0, %hi(basic_hidden_window_update)
/* 7E2408 80281588 26107574 */  addiu     $s0, $s0, %lo(basic_hidden_window_update)
.L8028158C:
/* 7E240C 8028158C 0C051F9F */  jal       set_window_update
/* 7E2410 80281590 0200282D */   daddu    $a1, $s0, $zero
/* 7E2414 80281594 2404000B */  addiu     $a0, $zero, 0xB
/* 7E2418 80281598 0C051F9F */  jal       set_window_update
/* 7E241C 8028159C 0200282D */   daddu    $a1, $s0, $zero
/* 7E2420 802815A0 96420000 */  lhu       $v0, 0x0($s2)
/* 7E2424 802815A4 30420001 */  andi      $v0, $v0, 0x1
/* 7E2428 802815A8 10400096 */  beqz      $v0, .L80281804
/* 7E242C 802815AC 00000000 */   nop
/* 7E2430 802815B0 3C04800B */  lui       $a0, %hi(gCameras)
/* 7E2434 802815B4 24841D80 */  addiu     $a0, $a0, %lo(gCameras)
/* 7E2438 802815B8 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 7E243C 802815BC 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 7E2440 802815C0 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 7E2444 802815C4 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 7E2448 802815C8 8C5E0140 */  lw        $fp, 0x140($v0)
/* 7E244C 802815CC 00031080 */  sll       $v0, $v1, 2
/* 7E2450 802815D0 00431021 */  addu      $v0, $v0, $v1
/* 7E2454 802815D4 00021080 */  sll       $v0, $v0, 2
/* 7E2458 802815D8 00431023 */  subu      $v0, $v0, $v1
/* 7E245C 802815DC 000218C0 */  sll       $v1, $v0, 3
/* 7E2460 802815E0 00431021 */  addu      $v0, $v0, $v1
/* 7E2464 802815E4 000210C0 */  sll       $v0, $v0, 3
/* 7E2468 802815E8 0044A821 */  addu      $s5, $v0, $a0
/* 7E246C 802815EC 86420002 */  lh        $v0, 0x2($s2)
/* 7E2470 802815F0 8E440018 */  lw        $a0, 0x18($s2)
/* 7E2474 802815F4 18400083 */  blez      $v0, .L80281804
/* 7E2478 802815F8 0000B82D */   daddu    $s7, $zero, $zero
/* 7E247C 802815FC 27D4000C */  addiu     $s4, $fp, 0xC
/* 7E2480 80281600 24960004 */  addiu     $s6, $a0, 0x4
/* 7E2484 80281604 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 7E2488 80281608 4481B000 */  mtc1      $at, $f22
/* 7E248C 8028160C 3C013FE0 */  lui       $at, (0x3FE00000 >> 16)
/* 7E2490 80281610 4481A800 */  mtc1      $at, $f21
/* 7E2494 80281614 4480A000 */  mtc1      $zero, $f20
.L80281618:
/* 7E2498 80281618 26A400D4 */  addiu     $a0, $s5, 0xD4
/* 7E249C 8028161C C686FFF8 */  lwc1      $f6, -0x8($s4)
/* 7E24A0 80281620 C682FFFC */  lwc1      $f2, -0x4($s4)
/* 7E24A4 80281624 C6840000 */  lwc1      $f4, 0x0($s4)
/* 7E24A8 80281628 3C0141F0 */  lui       $at, (0x41F00000 >> 16)
/* 7E24AC 8028162C 44810000 */  mtc1      $at, $f0
/* 7E24B0 80281630 27A20028 */  addiu     $v0, $sp, 0x28
/* 7E24B4 80281634 AFA20014 */  sw        $v0, 0x14($sp)
/* 7E24B8 80281638 27A2002C */  addiu     $v0, $sp, 0x2C
/* 7E24BC 8028163C AFA20018 */  sw        $v0, 0x18($sp)
/* 7E24C0 80281640 27A20030 */  addiu     $v0, $sp, 0x30
/* 7E24C4 80281644 AFA2001C */  sw        $v0, 0x1C($sp)
/* 7E24C8 80281648 46001080 */  add.s     $f2, $f2, $f0
/* 7E24CC 8028164C 44053000 */  mfc1      $a1, $f6
/* 7E24D0 80281650 44072000 */  mfc1      $a3, $f4
/* 7E24D4 80281654 44061000 */  mfc1      $a2, $f2
/* 7E24D8 80281658 27A20034 */  addiu     $v0, $sp, 0x34
/* 7E24DC 8028165C E7B60010 */  swc1      $f22, 0x10($sp)
/* 7E24E0 80281660 0C00A588 */  jal       transform_point
/* 7E24E4 80281664 AFA20020 */   sw       $v0, 0x20($sp)
/* 7E24E8 80281668 C7A60034 */  lwc1      $f6, 0x34($sp)
/* 7E24EC 8028166C C7A00030 */  lwc1      $f0, 0x30($sp)
/* 7E24F0 80281670 4606B183 */  div.s     $f6, $f22, $f6
/* 7E24F4 80281674 46060002 */  mul.s     $f0, $f0, $f6
/* 7E24F8 80281678 00000000 */  nop
/* 7E24FC 8028167C 46160000 */  add.s     $f0, $f0, $f22
/* 7E2500 80281680 46000021 */  cvt.d.s   $f0, $f0
/* 7E2504 80281684 46340002 */  mul.d     $f0, $f0, $f20
/* 7E2508 80281688 00000000 */  nop
/* 7E250C 8028168C C7A20028 */  lwc1      $f2, 0x28($sp)
/* 7E2510 80281690 46061202 */  mul.s     $f8, $f2, $f6
/* 7E2514 80281694 00000000 */  nop
/* 7E2518 80281698 C7A4002C */  lwc1      $f4, 0x2C($sp)
/* 7E251C 8028169C 46003087 */  neg.s     $f2, $f6
/* 7E2520 802816A0 46022282 */  mul.s     $f10, $f4, $f2
/* 7E2524 802816A4 00000000 */  nop
/* 7E2528 802816A8 44801000 */  mtc1      $zero, $f2
/* 7E252C 802816AC E7A60034 */  swc1      $f6, 0x34($sp)
/* 7E2530 802816B0 E7A80028 */  swc1      $f8, 0x28($sp)
/* 7E2534 802816B4 E7AA002C */  swc1      $f10, 0x2C($sp)
/* 7E2538 802816B8 46200020 */  cvt.s.d   $f0, $f0
/* 7E253C 802816BC 4600103C */  c.lt.s    $f2, $f0
/* 7E2540 802816C0 00000000 */  nop
/* 7E2544 802816C4 45000048 */  bc1f      .L802817E8
/* 7E2548 802816C8 E7A00030 */   swc1     $f0, 0x30($sp)
/* 7E254C 802816CC 4616003C */  c.lt.s    $f0, $f22
/* 7E2550 802816D0 00000000 */  nop
/* 7E2554 802816D4 45020045 */  bc1fl     .L802817EC
/* 7E2558 802816D8 26F70001 */   addiu    $s7, $s7, 0x1
/* 7E255C 802816DC 86A2000A */  lh        $v0, 0xA($s5)
/* 7E2560 802816E0 44820000 */  mtc1      $v0, $f0
/* 7E2564 802816E4 00000000 */  nop
/* 7E2568 802816E8 46800020 */  cvt.s.w   $f0, $f0
/* 7E256C 802816EC 46004102 */  mul.s     $f4, $f8, $f0
/* 7E2570 802816F0 00000000 */  nop
/* 7E2574 802816F4 46002100 */  add.s     $f4, $f4, $f0
/* 7E2578 802816F8 46002121 */  cvt.d.s   $f4, $f4
/* 7E257C 802816FC 46342102 */  mul.d     $f4, $f4, $f20
/* 7E2580 80281700 00000000 */  nop
/* 7E2584 80281704 86A2000C */  lh        $v0, 0xC($s5)
/* 7E2588 80281708 44820000 */  mtc1      $v0, $f0
/* 7E258C 8028170C 00000000 */  nop
/* 7E2590 80281710 46800020 */  cvt.s.w   $f0, $f0
/* 7E2594 80281714 46005082 */  mul.s     $f2, $f10, $f0
/* 7E2598 80281718 00000000 */  nop
/* 7E259C 8028171C 46001080 */  add.s     $f2, $f2, $f0
/* 7E25A0 80281720 460010A1 */  cvt.d.s   $f2, $f2
/* 7E25A4 80281724 46341082 */  mul.d     $f2, $f2, $f20
/* 7E25A8 80281728 00000000 */  nop
/* 7E25AC 8028172C 86A2000E */  lh        $v0, 0xE($s5)
/* 7E25B0 80281730 44820000 */  mtc1      $v0, $f0
/* 7E25B4 80281734 00000000 */  nop
/* 7E25B8 80281738 46800021 */  cvt.d.w   $f0, $f0
/* 7E25BC 8028173C 86A20010 */  lh        $v0, 0x10($s5)
/* 7E25C0 80281740 46202100 */  add.d     $f4, $f4, $f0
/* 7E25C4 80281744 44820000 */  mtc1      $v0, $f0
/* 7E25C8 80281748 00000000 */  nop
/* 7E25CC 8028174C 46800021 */  cvt.d.w   $f0, $f0
/* 7E25D0 80281750 8EC20000 */  lw        $v0, 0x0($s6)
/* 7E25D4 80281754 46201080 */  add.d     $f2, $f2, $f0
/* 7E25D8 80281758 28420064 */  slti      $v0, $v0, 0x64
/* 7E25DC 8028175C 4620230D */  trunc.w.d $f12, $f4
/* 7E25E0 80281760 44116000 */  mfc1      $s1, $f12
/* 7E25E4 80281764 4620130D */  trunc.w.d $f12, $f2
/* 7E25E8 80281768 44136000 */  mfc1      $s3, $f12
/* 7E25EC 8028176C 10400002 */  beqz      $v0, .L80281778
/* 7E25F0 80281770 0000802D */   daddu    $s0, $zero, $zero
/* 7E25F4 80281774 2410FFFC */  addiu     $s0, $zero, -0x4
.L80281778:
/* 7E25F8 80281778 0C04C3D6 */  jal       get_item_entity
/* 7E25FC 8028177C 8FC40000 */   lw       $a0, 0x0($fp)
/* 7E2600 80281780 8C420000 */  lw        $v0, 0x0($v0)
/* 7E2604 80281784 30420040 */  andi      $v0, $v0, 0x40
/* 7E2608 80281788 14400009 */  bnez      $v0, .L802817B0
/* 7E260C 8028178C 02302821 */   addu     $a1, $s1, $s0
/* 7E2610 80281790 0260302D */  daddu     $a2, $s3, $zero
/* 7E2614 80281794 240200FF */  addiu     $v0, $zero, 0xFF
/* 7E2618 80281798 AFA00010 */  sw        $zero, 0x10($sp)
/* 7E261C 8028179C AFA20014 */  sw        $v0, 0x14($sp)
/* 7E2620 802817A0 AFA00018 */  sw        $zero, 0x18($sp)
/* 7E2624 802817A4 8EC40000 */  lw        $a0, 0x0($s6)
/* 7E2628 802817A8 0C049DA7 */  jal       draw_number
/* 7E262C 802817AC 24070001 */   addiu    $a3, $zero, 0x1
.L802817B0:
/* 7E2630 802817B0 8E420008 */  lw        $v0, 0x8($s2)
/* 7E2634 802817B4 56E2000D */  bnel      $s7, $v0, .L802817EC
/* 7E2638 802817B8 26F70001 */   addiu    $s7, $s7, 0x1
/* 7E263C 802817BC 02302821 */  addu      $a1, $s1, $s0
/* 7E2640 802817C0 24A5FFFA */  addiu     $a1, $a1, -0x6
/* 7E2644 802817C4 8E440020 */  lw        $a0, 0x20($s2)
/* 7E2648 802817C8 0C051261 */  jal       hud_element_set_render_pos
/* 7E264C 802817CC 26660005 */   addiu    $a2, $s3, 0x5
/* 7E2650 802817D0 8E440020 */  lw        $a0, 0x20($s2)
/* 7E2654 802817D4 3C053F33 */  lui       $a1, (0x3F333333 >> 16)
/* 7E2658 802817D8 0C051308 */  jal       hud_element_set_scale
/* 7E265C 802817DC 34A53333 */   ori      $a1, $a1, (0x3F333333 & 0xFFFF)
/* 7E2660 802817E0 0C0511EA */  jal       hud_element_draw_clipped
/* 7E2664 802817E4 8E440020 */   lw       $a0, 0x20($s2)
.L802817E8:
/* 7E2668 802817E8 26F70001 */  addiu     $s7, $s7, 0x1
.L802817EC:
/* 7E266C 802817EC 26D6000C */  addiu     $s6, $s6, 0xC
/* 7E2670 802817F0 26940010 */  addiu     $s4, $s4, 0x10
/* 7E2674 802817F4 86420002 */  lh        $v0, 0x2($s2)
/* 7E2678 802817F8 02E2102A */  slt       $v0, $s7, $v0
/* 7E267C 802817FC 1440FF86 */  bnez      $v0, .L80281618
/* 7E2680 80281800 27DE0010 */   addiu    $fp, $fp, 0x10
.L80281804:
/* 7E2684 80281804 8E420358 */  lw        $v0, 0x358($s2)
/* 7E2688 80281808 18400003 */  blez      $v0, .L80281818
/* 7E268C 8028180C 2442FFFF */   addiu    $v0, $v0, -0x1
/* 7E2690 80281810 080A060A */  j         .L80281828
/* 7E2694 80281814 AE420358 */   sw       $v0, 0x358($s2)
.L80281818:
/* 7E2698 80281818 96420000 */  lhu       $v0, 0x0($s2)
/* 7E269C 8028181C 3042FFFE */  andi      $v0, $v0, 0xFFFE
/* 7E26A0 80281820 0C03A640 */  jal       func_800E9900
/* 7E26A4 80281824 A6420000 */   sh       $v0, 0x0($s2)
.L80281828:
/* 7E26A8 80281828 8FBF005C */  lw        $ra, 0x5C($sp)
/* 7E26AC 8028182C 8FBE0058 */  lw        $fp, 0x58($sp)
/* 7E26B0 80281830 8FB70054 */  lw        $s7, 0x54($sp)
/* 7E26B4 80281834 8FB60050 */  lw        $s6, 0x50($sp)
/* 7E26B8 80281838 8FB5004C */  lw        $s5, 0x4C($sp)
/* 7E26BC 8028183C 8FB40048 */  lw        $s4, 0x48($sp)
/* 7E26C0 80281840 8FB30044 */  lw        $s3, 0x44($sp)
/* 7E26C4 80281844 8FB20040 */  lw        $s2, 0x40($sp)
/* 7E26C8 80281848 8FB1003C */  lw        $s1, 0x3C($sp)
/* 7E26CC 8028184C 8FB00038 */  lw        $s0, 0x38($sp)
/* 7E26D0 80281850 D7B60068 */  ldc1      $f22, 0x68($sp)
/* 7E26D4 80281854 D7B40060 */  ldc1      $f20, 0x60($sp)
/* 7E26D8 80281858 03E00008 */  jr        $ra
/* 7E26DC 8028185C 27BD0070 */   addiu    $sp, $sp, 0x70

### DECOMPILED C INSTRUCTIONS:

void draw_shop_items(void) {
    Shop* shop = gGameStatusPtr->mapShop;
    ShopItemData* itemData;
    Camera* camera;
    s32 i;
    s32 xTemp;
    s32 yTemp;
    s32 xOffset;
    f32 x, y, z, s;
    f32 inX, inY, inZ;
    ShopItemEntity* shopItemEntities;

    if (shop->flags & SHOP_FLAG_1) {
        set_window_update(WINDOW_ID_ITEM_INFO_NAME, (s32) basic_window_update);
        set_window_update(WINDOW_ID_ITEM_INFO_DESC, (s32) basic_window_update);
    } else {
        set_window_update(WINDOW_ID_ITEM_INFO_NAME, (s32) basic_hidden_window_update);
        set_window_update(WINDOW_ID_ITEM_INFO_DESC, (s32) basic_hidden_window_update);
    }

    if (shop->flags & SHOP_FLAG_1) {
        camera = &gCameras[gCurrentCameraID];
        itemData = shop->staticInventory;
        shopItemEntities = gGameStatusPtr->shopItemEntities;

        for (i = 0; i < shop->numItems; i++, itemData++, shopItemEntities++) {
            inX = shopItemEntities->pos.x;
            inY = shopItemEntities->pos.y + 30.0f;
            inZ = shopItemEntities->pos.z;

            transform_point(camera->perspectiveMatrix, inX, inY, inZ, 1.0f, &x, &y, &z, &s);

            s = 1.0f / s;

            x *= s;
            y *= -s;
            z = (z * s + 1.0f) * 0.5;

            if (z > 0.0f && z < 1.0f) {
                xTemp = (((x * camera->viewportW) + camera->viewportW) * 0.5) + camera->viewportStartX;
                yTemp = (((y * camera->viewportH) + camera->viewportH) * 0.5) + camera->viewportStartY;

                if (itemData->price < 100) {
                    xOffset = -4;
                } else {
                    xOffset = 0;
                }

                if (!(get_item_entity(shopItemEntities->index)->flags & ITEM_ENTITY_FLAG_HIDDEN)) {
                    draw_number(itemData->price, xTemp + xOffset, yTemp, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_WHITE, 255, 0);
                }

                if (i == shop->currentItemSlot) {
                    hud_element_set_render_pos(shop->costIconID, (xTemp + xOffset) - 6, yTemp + 5);
                    hud_element_set_scale(shop->costIconID, 0.7f);
                    hud_element_draw_clipped(shop->costIconID);
                }
            }
        }
    }

    if (shop->unk_358 > 0) {
        shop->unk_358--;
    } else {
        shop->flags &= ~SHOP_FLAG_1;
        func_800E9900();
    }
}