### RAW ASSEMBLY INSTRUCTIONS:

glabel D_80244A50
/* 173330 80244A50 3C03800E */  lui       $v1, %hi(gBattleSubState)
D_80244A54:
/* 173334 80244A54 8C63C4DC */  lw        $v1, %lo(gBattleSubState)($v1)
glabel .L80244A58
/* 173338 80244A58 3C06800E */  lui       $a2, %hi(gCurrentBattlePtr)
/* 17333C 80244A5C 8CC6C4FC */  lw        $a2, %lo(gCurrentBattlePtr)($a2)
D_80244A60:
/* 173340 80244A60 27BDFFD0 */  addiu     $sp, $sp, -0x30
/* 173344 80244A64 AFB30024 */  sw        $s3, 0x24($sp)
D_80244A68:
/* 173348 80244A68 3C13800B */  lui       $s3, %hi(gCurrentEncounter)
D_80244A6C:
/* 17334C 80244A6C 26730F10 */  addiu     $s3, $s3, %lo(gCurrentEncounter)
D_80244A70:
/* 173350 80244A70 AFB20020 */  sw        $s2, 0x20($sp)
D_80244A74:
/* 173354 80244A74 3C12800E */  lui       $s2, %hi(gBattleStatus)
D_80244A78:
/* 173358 80244A78 2652C070 */  addiu     $s2, $s2, %lo(gBattleStatus)
.L80244A7C:
/* 17335C 80244A7C AFBF0028 */  sw        $ra, 0x28($sp)
/* 173360 80244A80 AFB1001C */  sw        $s1, 0x1C($sp)
.L80244A84:
/* 173364 80244A84 2C620005 */  sltiu     $v0, $v1, 0x5
/* 173368 80244A88 104000BA */  beqz      $v0, D_80244D74
/* 17336C 80244A8C AFB00018 */   sw       $s0, 0x18($sp)
/* 173370 80244A90 00031080 */  sll       $v0, $v1, 2
/* 173374 80244A94 3C01802A */  lui       $at, %hi(jtbl_8029CAB8)
/* 173378 80244A98 00220821 */  addu      $at, $at, $v0
/* 17337C 80244A9C 8C22CAB8 */  lw        $v0, %lo(jtbl_8029CAB8)($at)
/* 173380 80244AA0 00400008 */  jr        $v0
/* 173384 80244AA4 00000000 */   nop
glabel .L80244AA8
/* 173388 80244AA8 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
.L80244AAC:
/* 17338C 80244AAC 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 173390 80244AB0 3C048028 */  lui       $a0, %hi(BattleScreenFadeAmt)
.L80244AB4:
/* 173394 80244AB4 24840A30 */  addiu     $a0, $a0, %lo(BattleScreenFadeAmt)
D_80244AB8:
/* 173398 80244AB8 AC800000 */  sw        $zero, 0x0($a0)
D_80244ABC:
/* 17339C 80244ABC 80430074 */  lb        $v1, 0x74($v0)
/* 1733A0 80244AC0 24020002 */  addiu     $v0, $zero, 0x2
glabel .L80244AC4
/* 1733A4 80244AC4 14620002 */  bne       $v1, $v0, D_80244AD0
/* 1733A8 80244AC8 240200FF */   addiu    $v0, $zero, 0xFF
/* 1733AC 80244ACC AC820000 */  sw        $v0, 0x0($a0)
D_80244AD0:
/* 1733B0 80244AD0 82630009 */  lb        $v1, 0x9($s3)
/* 1733B4 80244AD4 24020001 */  addiu     $v0, $zero, 0x1
.L80244AD8:
/* 1733B8 80244AD8 14620015 */  bne       $v1, $v0, D_80244B30
D_80244ADC:
/* 1733BC 80244ADC 3C030080 */   lui      $v1, (0x800000 >> 16)
/* 1733C0 80244AE0 3C02800E */  lui       $v0, %hi(gBattleStatus)
.L80244AE4:
/* 1733C4 80244AE4 8C42C070 */  lw        $v0, %lo(gBattleStatus)($v0)
/* 1733C8 80244AE8 00431024 */  and       $v0, $v0, $v1
glabel .L80244AEC
/* 1733CC 80244AEC 14400010 */  bnez      $v0, D_80244B30
/* 1733D0 80244AF0 24020001 */   addiu    $v0, $zero, 0x1
D_80244AF4:
/* 1733D4 80244AF4 0C093980 */  jal       func_8024E600
/* 1733D8 80244AF8 00000000 */   nop
/* 1733DC 80244AFC 0C093903 */  jal       func_8024E40C
glabel func_80244B00
/* 1733E0 80244B00 24040001 */   addiu    $a0, $zero, 0x1
/* 1733E4 80244B04 0000202D */  daddu     $a0, $zero, $zero
.L80244B08:
/* 1733E8 80244B08 0080282D */  daddu     $a1, $a0, $zero
/* 1733EC 80244B0C 0080302D */  daddu     $a2, $a0, $zero
/* 1733F0 80244B10 0C04DF84 */  jal       set_screen_overlay_color
/* 1733F4 80244B14 0080382D */   daddu    $a3, $a0, $zero
/* 1733F8 80244B18 0000202D */  daddu     $a0, $zero, $zero
.L80244B1C:
/* 1733FC 80244B1C 0080282D */  daddu     $a1, $a0, $zero
D_80244B20:
/* 173400 80244B20 240600A0 */  addiu     $a2, $zero, 0xA0
/* 173404 80244B24 0C04DF93 */  jal       set_screen_overlay_center
/* 173408 80244B28 24070078 */   addiu    $a3, $zero, 0x78
D_80244B2C:
/* 17340C 80244B2C 24020001 */  addiu     $v0, $zero, 0x1
D_80244B30:
/* 173410 80244B30 3C01800E */  lui       $at, %hi(gBattleSubState)
.L80244B34:
/* 173414 80244B34 AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
.L80244B38:
/* 173418 80244B38 0809135D */  j         D_80244D74
D_80244B3C:
/* 17341C 80244B3C 00000000 */   nop
D_80244B40:
/* 173420 80244B40 3C048028 */  lui       $a0, %hi(BattleScreenFadeAmt)
.L80244B44:
/* 173424 80244B44 24840A30 */  addiu     $a0, $a0, %lo(BattleScreenFadeAmt)
D_80244B48:
/* 173428 80244B48 8C830000 */  lw        $v1, 0x0($a0)
/* 17342C 80244B4C 240500FF */  addiu     $a1, $zero, 0xFF
D_80244B50:
/* 173430 80244B50 14650005 */  bne       $v1, $a1, .L80244B68
.L80244B54:
/* 173434 80244B54 24020002 */   addiu    $v0, $zero, 0x2
.L80244B58:
/* 173438 80244B58 3C01800E */  lui       $at, %hi(gBattleSubState)
.L80244B5C:
/* 17343C 80244B5C AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
.L80244B60:
/* 173440 80244B60 0809135D */  j         D_80244D74
.L80244B64:
/* 173444 80244B64 00000000 */   nop
.L80244B68:
/* 173448 80244B68 8242008D */  lb        $v0, 0x8D($s2)
/* 17344C 80244B6C 00621021 */  addu      $v0, $v1, $v0
.L80244B70:
/* 173450 80244B70 AC820000 */  sw        $v0, 0x0($a0)
/* 173454 80244B74 28420100 */  slti      $v0, $v0, 0x100
.L80244B78:
/* 173458 80244B78 5040007E */  beql      $v0, $zero, D_80244D74
/* 17345C 80244B7C AC850000 */   sw       $a1, 0x0($a0)
glabel .L80244B80
/* 173460 80244B80 0809135D */  j         D_80244D74
.L80244B84:
/* 173464 80244B84 00000000 */   nop
D_80244B88:
/* 173468 80244B88 240200FF */  addiu     $v0, $zero, 0xFF
D_80244B8C:
/* 17346C 80244B8C 3C04800E */  lui       $a0, %hi(gBattleStatus)
D_80244B90:
/* 173470 80244B90 2484C070 */  addiu     $a0, $a0, %lo(gBattleStatus)
/* 173474 80244B94 2403FFFE */  addiu     $v1, $zero, -0x2
glabel func_80244B98
/* 173478 80244B98 3C018028 */  lui       $at, %hi(BattleScreenFadeAmt)
/* 17347C 80244B9C AC220A30 */  sw        $v0, %lo(BattleScreenFadeAmt)($at)
/* 173480 80244BA0 8C820000 */  lw        $v0, 0x0($a0)
/* 173484 80244BA4 3C05800E */  lui       $a1, %hi(gCurrentStagePtr)
/* 173488 80244BA8 8CA5C064 */  lw        $a1, %lo(gCurrentStagePtr)($a1)
/* 17348C 80244BAC 00431024 */  and       $v0, $v0, $v1
D_80244BB0:
/* 173490 80244BB0 14A00004 */  bnez      $a1, func_80244BC4
/* 173494 80244BB4 AC820000 */   sw       $v0, 0x0($a0)
D_80244BB8_ED8DD8:
/* 173498 80244BB8 8CC4000C */  lw        $a0, 0xC($a2)
/* 17349C 80244BBC 080912F2 */  j         D_80244BC8
D_80244BC0:
/* 1734A0 80244BC0 00000000 */   nop
glabel func_80244BC4
/* 1734A4 80244BC4 8CA40004 */  lw        $a0, 0x4($a1)
D_80244BC8:
/* 1734A8 80244BC8 8C840010 */  lw        $a0, 0x10($a0)
/* 1734AC 80244BCC 14800006 */  bnez      $a0, .L80244BE8
/* 1734B0 80244BD0 2405000A */   addiu    $a1, $zero, 0xA
/* 1734B4 80244BD4 24020004 */  addiu     $v0, $zero, 0x4
/* 1734B8 80244BD8 3C01800E */  lui       $at, %hi(gBattleSubState)
/* 1734BC 80244BDC AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
/* 1734C0 80244BE0 0809135D */  j         D_80244D74
/* 1734C4 80244BE4 00000000 */   nop
.L80244BE8:
/* 1734C8 80244BE8 0C0B0CF8 */  jal       start_script
D_80244BEC_ED8E0C:
/* 1734CC 80244BEC 0000302D */   daddu    $a2, $zero, $zero
D_80244BF0:
/* 1734D0 80244BF0 AE4200BC */  sw        $v0, 0xBC($s2)
D_80244BF4:
/* 1734D4 80244BF4 8C430144 */  lw        $v1, 0x144($v0)
D_80244BF8:
/* 1734D8 80244BF8 24020003 */  addiu     $v0, $zero, 0x3
.L80244BFC:
/* 1734DC 80244BFC 3C01800E */  lui       $at, %hi(gBattleSubState)
/* 1734E0 80244C00 AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
/* 1734E4 80244C04 0809135D */  j         D_80244D74
/* 1734E8 80244C08 AE4300C0 */   sw       $v1, 0xC0($s2)
glabel .L80244C0C
/* 1734EC 80244C0C 8E4400C0 */  lw        $a0, 0xC0($s2)
/* 1734F0 80244C10 0C0B1059 */  jal       does_script_exist
D_80244C14:
/* 1734F4 80244C14 00000000 */   nop
sbk_30_D_80244C18:
/* 1734F8 80244C18 14400056 */  bnez      $v0, D_80244D74
.L80244C1C:
/* 1734FC 80244C1C 24020004 */   addiu    $v0, $zero, 0x4
.L80244C20:
/* 173500 80244C20 3C01800E */  lui       $at, %hi(gBattleSubState)
.L80244C24:
/* 173504 80244C24 AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
glabel .L80244C28
/* 173508 80244C28 0C0B1045 */  jal       kill_all_scripts
/* 17350C 80244C2C 0000882D */   daddu    $s1, $zero, $zero
glabel func_80244C30
/* 173510 80244C30 0240802D */  daddu     $s0, $s2, $zero
.L80244C34:
/* 173514 80244C34 8E0400E0 */  lw        $a0, 0xE0($s0)
D_80244C38:
/* 173518 80244C38 10800003 */  beqz      $a0, D_80244C48
D_80244C3C:
/* 17351C 80244C3C 26310001 */   addiu    $s1, $s1, 0x1
D_80244C40:
/* 173520 80244C40 0C0902EF */  jal       func_80240BBC
D_80244C44:
/* 173524 80244C44 00000000 */   nop
D_80244C48:
/* 173528 80244C48 2A220018 */  slti      $v0, $s1, 0x18
D_80244C4C:
/* 17352C 80244C4C 1440FFF9 */  bnez      $v0, .L80244C34
/* 173530 80244C50 26100004 */   addiu    $s0, $s0, 0x4
D_80244C54:
/* 173534 80244C54 8E4400DC */  lw        $a0, 0xDC($s2)
D_80244C58:
/* 173538 80244C58 10800003 */  beqz      $a0, .L80244C68
/* 17353C 80244C5C 00000000 */   nop
glabel func_80244C60
/* 173540 80244C60 0C0902EF */  jal       func_80240BBC
D_80244C64:
/* 173544 80244C64 00000000 */   nop
.L80244C68:
/* 173548 80244C68 0C09035A */  jal       func_80240D68
/* 17354C 80244C6C 8E4400D8 */   lw       $a0, 0xD8($s2)
D_80244C70:
/* 173550 80244C70 8243008A */  lb        $v1, 0x8A($s2)
glabel .L80244C74
/* 173554 80244C74 24020004 */  addiu     $v0, $zero, 0x4
D_80244C78:
/* 173558 80244C78 14620003 */  bne       $v1, $v0, .L80244C88
/* 17355C 80244C7C 24020001 */   addiu    $v0, $zero, 0x1
glabel .L80244C80
/* 173560 80244C80 A262000B */  sb        $v0, 0xB($s3)
D_80244C84:
/* 173564 80244C84 A240008A */  sb        $zero, 0x8A($s2)
.L80244C88:
/* 173568 80244C88 9242007B */  lbu       $v0, 0x7B($s2)
glabel func_80244C8C
/* 17356C 80244C8C 3C10800E */  lui       $s0, %hi(gBattleStatus)
/* 173570 80244C90 2610C070 */  addiu     $s0, $s0, %lo(gBattleStatus)
/* 173574 80244C94 A262000C */  sb        $v0, 0xC($s3)
D_80244C98:
/* 173578 80244C98 8E020004 */  lw        $v0, 0x4($s0)
/* 17357C 80244C9C 3C031000 */  lui       $v1, (0x10000000 >> 16)
D_80244CA0:
/* 173580 80244CA0 00431024 */  and       $v0, $v0, $v1
glabel .L80244CA4
/* 173584 80244CA4 10400002 */  beqz      $v0, D_80244CB0
/* 173588 80244CA8 24020001 */   addiu    $v0, $zero, 0x1
.L80244CAC:
/* 17358C 80244CAC A2620013 */  sb        $v0, 0x13($s3)
D_80244CB0:
/* 173590 80244CB0 0C016938 */  jal       remove_all_effects
/* 173594 80244CB4 00000000 */   nop
D_80244CB8:
/* 173598 80244CB8 0C051FB1 */  jal       set_windows_visible
/* 17359C 80244CBC 0000202D */   daddu    $a0, $zero, $zero
D_80244CC0:
/* 1735A0 80244CC0 8E020004 */  lw        $v0, 0x4($s0)
/* 1735A4 80244CC4 30420040 */  andi      $v0, $v0, 0x40
D_80244CC8:
/* 1735A8 80244CC8 10400003 */  beqz      $v0, .L80244CD8
/* 1735AC 80244CCC 00000000 */   nop
D_80244CD0:
/* 1735B0 80244CD0 0C03A6CC */  jal       decrement_status_bar_disabled
D_80244CD4:
/* 1735B4 80244CD4 00000000 */   nop
.L80244CD8:
/* 1735B8 80244CD8 82630009 */  lb        $v1, 0x9($s3)
/* 1735BC 80244CDC 24020001 */  addiu     $v0, $zero, 0x1
/* 1735C0 80244CE0 14620019 */  bne       $v1, $v0, .L80244D48
/* 1735C4 80244CE4 3C030080 */   lui      $v1, (0x800000 >> 16)
D_80244CE8:
/* 1735C8 80244CE8 8E020000 */  lw        $v0, 0x0($s0)
glabel func_80244CEC
/* 1735CC 80244CEC 00431024 */  and       $v0, $v0, $v1
D_80244CF0:
/* 1735D0 80244CF0 14400015 */  bnez      $v0, .L80244D48
/* 1735D4 80244CF4 00000000 */   nop
jtbl_80244CF8:
/* 1735D8 80244CF8 0C090464 */  jal       func_80241190
.L80244CFC:
/* 1735DC 80244CFC 0000202D */   daddu    $a0, $zero, $zero
D_80244D00:
/* 1735E0 80244D00 3C04802A */  lui       $a0, %hi(D_8029CAAC)
/* 1735E4 80244D04 2484CAAC */  addiu     $a0, $a0, %lo(D_8029CAAC)
D_80244D08:
/* 1735E8 80244D08 27A50010 */  addiu     $a1, $sp, 0x10
D_80244D0C:
/* 1735EC 80244D0C 3C02800E */  lui       $v0, %hi(gBattleState)
D_80244D10:
/* 1735F0 80244D10 8C42C068 */  lw        $v0, %lo(gBattleState)($v0)
/* 1735F4 80244D14 3C01800E */  lui       $at, %hi(gLastDrawBattleState)
jtbl_80244D18:
/* 1735F8 80244D18 AC22C4D0 */  sw        $v0, %lo(gLastDrawBattleState)($at)
/* 1735FC 80244D1C 0C016AFE */  jal       get_map_IDs_by_name
/* 173600 80244D20 27A60012 */   addiu    $a2, $sp, 0x12
D_80244D24:
/* 173604 80244D24 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
jtbl_80244D28:
/* 173608 80244D28 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
.L80244D2C:
/* 17360C 80244D2C 97A30010 */  lhu       $v1, 0x10($sp)
.L80244D30:
/* 173610 80244D30 97A50012 */  lhu       $a1, 0x12($sp)
/* 173614 80244D34 24040006 */  addiu     $a0, $zero, 0x6
D_80244D38:
/* 173618 80244D38 A4430086 */  sh        $v1, 0x86($v0)
/* 17361C 80244D3C A445008C */  sh        $a1, 0x8C($v0)
/* 173620 80244D40 0809135B */  j         D_80244D6C
.L80244D44:
/* 173624 80244D44 A440008E */   sh       $zero, 0x8E($v0)
.L80244D48:
/* 173628 80244D48 0C090464 */  jal       func_80241190
.L80244D4C:
/* 17362C 80244D4C 0000202D */   daddu    $a0, $zero, $zero
D_80244D50:
/* 173630 80244D50 3C02800E */  lui       $v0, %hi(gBattleState)
D_80244D54:
/* 173634 80244D54 8C42C068 */  lw        $v0, %lo(gBattleState)($v0)
D_80244D58:
/* 173638 80244D58 3C01800E */  lui       $at, %hi(gLastDrawBattleState)
.L80244D5C:
/* 17363C 80244D5C AC22C4D0 */  sw        $v0, %lo(gLastDrawBattleState)($at)
D_80244D60:
/* 173640 80244D60 0C00F945 */  jal       func_8003E514
/* 173644 80244D64 24040001 */   addiu    $a0, $zero, 0x1
glabel func_80244D68
/* 173648 80244D68 24040009 */  addiu     $a0, $zero, 0x9
D_80244D6C:
/* 17364C 80244D6C 0C00CD3C */  jal       set_game_mode
/* 173650 80244D70 00000000 */   nop
D_80244D74:
/* 173654 80244D74 8FBF0028 */  lw        $ra, 0x28($sp)
/* 173658 80244D78 8FB30024 */  lw        $s3, 0x24($sp)
D_80244D7C:
/* 17365C 80244D7C 8FB20020 */  lw        $s2, 0x20($sp)
/* 173660 80244D80 8FB1001C */  lw        $s1, 0x1C($sp)
D_80244D84:
/* 173664 80244D84 8FB00018 */  lw        $s0, 0x18($sp)
D_80244D88:
/* 173668 80244D88 03E00008 */  jr        $ra
/* 17366C 80244D8C 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

void btl_state_update_end_battle(void) {
    EncounterStatus* encounterStatus = &gCurrentEncounter;
    BattleStatus* battleStatus = &gBattleStatus;
    Battle* battle = gCurrentBattlePtr;
    Stage* stage;
    Evt* script;
    s32 i;

    switch (gBattleSubState) {
        case BTL_SUBSTATE_END_BATTLE_INIT:
            BattleScreenFadeAmt = 0;
            if (gGameStatusPtr->debugEnemyContact == DEBUG_CONTACT_DIE_ON_TOUCH) {
                BattleScreenFadeAmt = 255;
            }
            if (encounterStatus->battleOutcome == OUTCOME_PLAYER_LOST && !(gBattleStatus.flags1 & BS_FLAGS1_NO_GAME_OVER)) {
                btl_cam_unfreeze();
                btl_cam_use_preset(BTL_CAM_PRESET_01);
                set_screen_overlay_color(SCREEN_LAYER_FRONT, 0, 0, 0);
                set_screen_overlay_center(SCREEN_LAYER_FRONT, 0, 160, 120);
            }
            gBattleSubState = BTL_SUBSTATE_END_BATTLE_FADE_OUT;
            break;
        case BTL_SUBSTATE_END_BATTLE_FADE_OUT:
            if (BattleScreenFadeAmt == 255) {
                gBattleSubState = BTL_SUBSTATE_END_BATTLE_EXEC_STAGE_SCRIPT;
                break;
            }
            BattleScreenFadeAmt += battleStatus->endBattleFadeOutRate;
            if (BattleScreenFadeAmt > 255) {
                BattleScreenFadeAmt = 255;
            }
            break;
        case BTL_SUBSTATE_END_BATTLE_EXEC_STAGE_SCRIPT:
            BattleScreenFadeAmt = 255;
            gBattleStatus.flags1 &= ~BS_FLAGS1_ACTORS_VISIBLE;
            if (gCurrentStagePtr == NULL) {
                stage = battle->stage;
            } else {
                stage = gCurrentStagePtr->stage;
            }
            if (stage->postBattle == NULL) {
                gBattleSubState = BTL_SUBSTATE_END_BATTLE_CLEANUP;
                return;
            }
            script = start_script(stage->postBattle, EVT_PRIORITY_A, 0);
            battleStatus->controlScript = script;
            battleStatus->controlScriptID = script->id;
            gBattleSubState = BTL_SUBSTATE_END_BATTLE_AWAIT_STAGE_SCRIPT;
            break;
        case BTL_SUBSTATE_END_BATTLE_AWAIT_STAGE_SCRIPT:
            if (does_script_exist(battleStatus->controlScriptID)) {
                break;
            }
            gBattleSubState = BTL_SUBSTATE_END_BATTLE_CLEANUP;
            // fallthrough
        case BTL_SUBSTATE_END_BATTLE_CLEANUP:
            kill_all_scripts();
            for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
                if (battleStatus->enemyActors[i] != NULL) {
                    btl_delete_actor(battleStatus->enemyActors[i]);
                }
            }
            if (battleStatus->partnerActor != NULL) {
                btl_delete_actor(battleStatus->partnerActor);
            }

            btl_delete_player_actor(battleStatus->playerActor);

            if (battleStatus->nextMerleeSpellType == MERLEE_SPELL_COIN_BOOST) {
                encounterStatus->hasMerleeCoinBonus = TRUE;
                battleStatus->nextMerleeSpellType = MERLEE_SPELL_0;
            }

            encounterStatus->damageTaken = battleStatus->damageTaken;

            if (gBattleStatus.flags2 & BS_FLAGS2_DROP_WHACKA_BUMP) {
                encounterStatus->dropWhackaBump = TRUE;
            }

            remove_all_effects();
            set_windows_visible(0);

            if (gBattleStatus.flags2 & BS_FLAGS2_PEACH_BATTLE) {
                decrement_status_bar_disabled();
            }

            if (encounterStatus->battleOutcome == OUTCOME_PLAYER_LOST &&
                !(gBattleStatus.flags1 & BS_FLAGS1_NO_GAME_OVER))
            {
                s16 areaID;
                s16 mapID;

                btl_set_state(BATTLE_STATE_0);
                gLastDrawBattleState = gBattleState;
                get_map_IDs_by_name("gv_01", &areaID, &mapID);
                gGameStatusPtr->areaID = areaID;
                gGameStatusPtr->mapID = mapID;
                gGameStatusPtr->entryID = gv_01_ENTRY_0;
                set_game_mode(GAME_MODE_ENTER_WORLD);
            } else {
                btl_set_state(BATTLE_STATE_0);
                gLastDrawBattleState = gBattleState;
                func_8003E514(1);
                set_game_mode(GAME_MODE_END_BATTLE);
            }
            break;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel JumpToGoal
/* 1A75E8 80278D08 27BDFFA0 */  addiu     $sp, $sp, -0x60
/* 1A75EC 80278D0C AFB30024 */  sw        $s3, 0x24($sp)
/* 1A75F0 80278D10 0080982D */  daddu     $s3, $a0, $zero
/* 1A75F4 80278D14 AFBF0028 */  sw        $ra, 0x28($sp)
/* 1A75F8 80278D18 AFB20020 */  sw        $s2, 0x20($sp)
/* 1A75FC 80278D1C AFB1001C */  sw        $s1, 0x1C($sp)
/* 1A7600 80278D20 AFB00018 */  sw        $s0, 0x18($sp)
/* 1A7604 80278D24 F7BE0058 */  sdc1      $f30, 0x58($sp)
/* 1A7608 80278D28 F7BC0050 */  sdc1      $f28, 0x50($sp)
/* 1A760C 80278D2C F7BA0048 */  sdc1      $f26, 0x48($sp)
/* 1A7610 80278D30 F7B80040 */  sdc1      $f24, 0x40($sp)
/* 1A7614 80278D34 F7B60038 */  sdc1      $f22, 0x38($sp)
/* 1A7618 80278D38 F7B40030 */  sdc1      $f20, 0x30($sp)
/* 1A761C 80278D3C 8E71000C */  lw        $s1, 0xC($s3)
/* 1A7620 80278D40 54A00001 */  bnel      $a1, $zero, .L80278D48
/* 1A7624 80278D44 AE600070 */   sw       $zero, 0x70($s3)
.L80278D48:
/* 1A7628 80278D48 8E620070 */  lw        $v0, 0x70($s3)
/* 1A762C 80278D4C 14400096 */  bnez      $v0, .L80278FA8
/* 1A7630 80278D50 00000000 */   nop
/* 1A7634 80278D54 8E250000 */  lw        $a1, 0x0($s1)
/* 1A7638 80278D58 26310004 */  addiu     $s1, $s1, 0x4
/* 1A763C 80278D5C 0C0B1EAF */  jal       evt_get_variable
/* 1A7640 80278D60 0260202D */   daddu    $a0, $s3, $zero
/* 1A7644 80278D64 0040202D */  daddu     $a0, $v0, $zero
/* 1A7648 80278D68 2402FF81 */  addiu     $v0, $zero, -0x7F
/* 1A764C 80278D6C 14820002 */  bne       $a0, $v0, .L80278D78
/* 1A7650 80278D70 00000000 */   nop
/* 1A7654 80278D74 8E640148 */  lw        $a0, 0x148($s3)
.L80278D78:
/* 1A7658 80278D78 0C09A75B */  jal       get_actor
/* 1A765C 80278D7C 00000000 */   nop
/* 1A7660 80278D80 0040802D */  daddu     $s0, $v0, $zero
/* 1A7664 80278D84 2612000C */  addiu     $s2, $s0, 0xC
/* 1A7668 80278D88 AE700074 */  sw        $s0, 0x74($s3)
/* 1A766C 80278D8C 8E250000 */  lw        $a1, 0x0($s1)
/* 1A7670 80278D90 26310004 */  addiu     $s1, $s1, 0x4
/* 1A7674 80278D94 0C0B1EAF */  jal       evt_get_variable
/* 1A7678 80278D98 0260202D */   daddu    $a0, $s3, $zero
/* 1A767C 80278D9C A6020070 */  sh        $v0, 0x70($s0)
/* 1A7680 80278DA0 8E250000 */  lw        $a1, 0x0($s1)
/* 1A7684 80278DA4 26310004 */  addiu     $s1, $s1, 0x4
/* 1A7688 80278DA8 0C0B1EAF */  jal       evt_get_variable
/* 1A768C 80278DAC 0260202D */   daddu    $a0, $s3, $zero
/* 1A7690 80278DB0 AE620078 */  sw        $v0, 0x78($s3)
/* 1A7694 80278DB4 AE60007C */  sw        $zero, 0x7C($s3)
/* 1A7698 80278DB8 8E250000 */  lw        $a1, 0x0($s1)
/* 1A769C 80278DBC 26310004 */  addiu     $s1, $s1, 0x4
/* 1A76A0 80278DC0 0C0B1EAF */  jal       evt_get_variable
/* 1A76A4 80278DC4 0260202D */   daddu    $a0, $s3, $zero
/* 1A76A8 80278DC8 10400004 */  beqz      $v0, .L80278DDC
/* 1A76AC 80278DCC 00000000 */   nop
/* 1A76B0 80278DD0 8E62007C */  lw        $v0, 0x7C($s3)
/* 1A76B4 80278DD4 34420001 */  ori       $v0, $v0, 0x1
/* 1A76B8 80278DD8 AE62007C */  sw        $v0, 0x7C($s3)
.L80278DDC:
/* 1A76BC 80278DDC 8E250000 */  lw        $a1, 0x0($s1)
/* 1A76C0 80278DE0 0C0B1EAF */  jal       evt_get_variable
/* 1A76C4 80278DE4 0260202D */   daddu    $a0, $s3, $zero
/* 1A76C8 80278DE8 10400004 */  beqz      $v0, .L80278DFC
/* 1A76CC 80278DEC 00000000 */   nop
/* 1A76D0 80278DF0 8E62007C */  lw        $v0, 0x7C($s3)
/* 1A76D4 80278DF4 34420002 */  ori       $v0, $v0, 0x2
/* 1A76D8 80278DF8 AE62007C */  sw        $v0, 0x7C($s3)
.L80278DFC:
/* 1A76DC 80278DFC C6000148 */  lwc1      $f0, 0x148($s0)
/* 1A76E0 80278E00 C61A0018 */  lwc1      $f26, 0x18($s0)
/* 1A76E4 80278E04 C61C0020 */  lwc1      $f28, 0x20($s0)
/* 1A76E8 80278E08 C614014C */  lwc1      $f20, 0x14C($s0)
/* 1A76EC 80278E0C C618001C */  lwc1      $f24, 0x1C($s0)
/* 1A76F0 80278E10 E6000010 */  swc1      $f0, 0x10($s0)
/* 1A76F4 80278E14 46000786 */  mov.s     $f30, $f0
/* 1A76F8 80278E18 4406D000 */  mfc1      $a2, $f26
/* 1A76FC 80278E1C 4407E000 */  mfc1      $a3, $f28
/* 1A7700 80278E20 C6000144 */  lwc1      $f0, 0x144($s0)
/* 1A7704 80278E24 4600A386 */  mov.s     $f14, $f20
/* 1A7708 80278E28 E6140014 */  swc1      $f20, 0x14($s0)
/* 1A770C 80278E2C E600000C */  swc1      $f0, 0xC($s0)
/* 1A7710 80278E30 46000586 */  mov.s     $f22, $f0
/* 1A7714 80278E34 0C00A720 */  jal       atan2
/* 1A7718 80278E38 4600B306 */   mov.s    $f12, $f22
/* 1A771C 80278E3C 4600B306 */  mov.s     $f12, $f22
/* 1A7720 80278E40 4600A386 */  mov.s     $f14, $f20
/* 1A7724 80278E44 4406D000 */  mfc1      $a2, $f26
/* 1A7728 80278E48 4407E000 */  mfc1      $a3, $f28
/* 1A772C 80278E4C 461EC781 */  sub.s     $f30, $f24, $f30
/* 1A7730 80278E50 0C00A7B5 */  jal       dist2D
/* 1A7734 80278E54 E6000054 */   swc1     $f0, 0x54($s0)
/* 1A7738 80278E58 86020070 */  lh        $v0, 0x70($s0)
/* 1A773C 80278E5C 46000106 */  mov.s     $f4, $f0
/* 1A7740 80278E60 14400012 */  bnez      $v0, .L80278EAC
/* 1A7744 80278E64 E6040058 */   swc1     $f4, 0x58($s0)
/* 1A7748 80278E68 C600004C */  lwc1      $f0, 0x4C($s0)
/* 1A774C 80278E6C C602004C */  lwc1      $f2, 0x4C($s0)
/* 1A7750 80278E70 46002003 */  div.s     $f0, $f4, $f0
/* 1A7754 80278E74 4600028D */  trunc.w.s $f10, $f0
/* 1A7758 80278E78 44035000 */  mfc1      $v1, $f10
/* 1A775C 80278E7C 00000000 */  nop
/* 1A7760 80278E80 00031400 */  sll       $v0, $v1, 16
/* 1A7764 80278E84 00021403 */  sra       $v0, $v0, 16
/* 1A7768 80278E88 44820000 */  mtc1      $v0, $f0
/* 1A776C 80278E8C 00000000 */  nop
/* 1A7770 80278E90 46800020 */  cvt.s.w   $f0, $f0
/* 1A7774 80278E94 46020002 */  mul.s     $f0, $f0, $f2
/* 1A7778 80278E98 00000000 */  nop
/* 1A777C 80278E9C 46002086 */  mov.s     $f2, $f4
/* 1A7780 80278EA0 A6030070 */  sh        $v1, 0x70($s0)
/* 1A7784 80278EA4 0809E3B8 */  j         .L80278EE0
/* 1A7788 80278EA8 46001201 */   sub.s    $f8, $f2, $f0
.L80278EAC:
/* 1A778C 80278EAC 44821000 */  mtc1      $v0, $f2
/* 1A7790 80278EB0 00000000 */  nop
/* 1A7794 80278EB4 468010A0 */  cvt.s.w   $f2, $f2
/* 1A7798 80278EB8 86020070 */  lh        $v0, 0x70($s0)
/* 1A779C 80278EBC 46022083 */  div.s     $f2, $f4, $f2
/* 1A77A0 80278EC0 44820000 */  mtc1      $v0, $f0
/* 1A77A4 80278EC4 00000000 */  nop
/* 1A77A8 80278EC8 46800020 */  cvt.s.w   $f0, $f0
/* 1A77AC 80278ECC 46020002 */  mul.s     $f0, $f0, $f2
/* 1A77B0 80278ED0 00000000 */  nop
/* 1A77B4 80278ED4 C6040058 */  lwc1      $f4, 0x58($s0)
/* 1A77B8 80278ED8 E602004C */  swc1      $f2, 0x4C($s0)
/* 1A77BC 80278EDC 46002201 */  sub.s     $f8, $f4, $f0
.L80278EE0:
/* 1A77C0 80278EE0 86420064 */  lh        $v0, 0x64($s2)
/* 1A77C4 80278EE4 14400003 */  bnez      $v0, .L80278EF4
/* 1A77C8 80278EE8 00000000 */   nop
/* 1A77CC 80278EEC 0809E436 */  j         .L802790D8
/* 1A77D0 80278EF0 24020002 */   addiu    $v0, $zero, 0x2
.L80278EF4:
/* 1A77D4 80278EF4 C642003C */  lwc1      $f2, 0x3C($s2)
/* 1A77D8 80278EF8 44823000 */  mtc1      $v0, $f6
/* 1A77DC 80278EFC 00000000 */  nop
/* 1A77E0 80278F00 468031A0 */  cvt.s.w   $f6, $f6
/* 1A77E4 80278F04 46061082 */  mul.s     $f2, $f2, $f6
/* 1A77E8 80278F08 00000000 */  nop
/* 1A77EC 80278F0C 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* 1A77F0 80278F10 44810000 */  mtc1      $at, $f0
/* 1A77F4 80278F14 00000000 */  nop
/* 1A77F8 80278F18 46001082 */  mul.s     $f2, $f2, $f0
/* 1A77FC 80278F1C 00000000 */  nop
/* 1A7800 80278F20 86420064 */  lh        $v0, 0x64($s2)
/* 1A7804 80278F24 C6440040 */  lwc1      $f4, 0x40($s2)
/* 1A7808 80278F28 44820000 */  mtc1      $v0, $f0
/* 1A780C 80278F2C 00000000 */  nop
/* 1A7810 80278F30 46800020 */  cvt.s.w   $f0, $f0
/* 1A7814 80278F34 46004003 */  div.s     $f0, $f8, $f0
/* 1A7818 80278F38 46002100 */  add.s     $f4, $f4, $f0
/* 1A781C 80278F3C 4606F183 */  div.s     $f6, $f30, $f6
/* 1A7820 80278F40 46061080 */  add.s     $f2, $f2, $f6
/* 1A7824 80278F44 E6440040 */  swc1      $f4, 0x40($s2)
/* 1A7828 80278F48 E6420044 */  swc1      $f2, 0x44($s2)
/* 1A782C 80278F4C 8E620078 */  lw        $v0, 0x78($s3)
/* 1A7830 80278F50 10400005 */  beqz      $v0, .L80278F68
/* 1A7834 80278F54 00000000 */   nop
/* 1A7838 80278F58 86040192 */  lh        $a0, 0x192($s0)
/* 1A783C 80278F5C 82050077 */  lb        $a1, 0x77($s0)
/* 1A7840 80278F60 0C098F3F */  jal       set_animation
/* 1A7844 80278F64 8E060064 */   lw       $a2, 0x64($s0)
.L80278F68:
/* 1A7848 80278F68 8E62007C */  lw        $v0, 0x7C($s3)
/* 1A784C 80278F6C 30420002 */  andi      $v0, $v0, 0x2
/* 1A7850 80278F70 1440000C */  bnez      $v0, .L80278FA4
/* 1A7854 80278F74 24020001 */   addiu    $v0, $zero, 0x1
/* 1A7858 80278F78 8E0201AC */  lw        $v0, 0x1AC($s0)
/* 1A785C 80278F7C 10400009 */  beqz      $v0, .L80278FA4
/* 1A7860 80278F80 24020001 */   addiu    $v0, $zero, 0x1
/* 1A7864 80278F84 C600014C */  lwc1      $f0, 0x14C($s0)
/* 1A7868 80278F88 E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A786C 80278F8C 8E0401AC */  lw        $a0, 0x1AC($s0)
/* 1A7870 80278F90 8E060144 */  lw        $a2, 0x144($s0)
/* 1A7874 80278F94 8E070148 */  lw        $a3, 0x148($s0)
/* 1A7878 80278F98 0C052757 */  jal       sfx_play_sound_at_position
/* 1A787C 80278F9C 0000282D */   daddu    $a1, $zero, $zero
/* 1A7880 80278FA0 24020001 */  addiu     $v0, $zero, 0x1
.L80278FA4:
/* 1A7884 80278FA4 AE620070 */  sw        $v0, 0x70($s3)
.L80278FA8:
/* 1A7888 80278FA8 8E700074 */  lw        $s0, 0x74($s3)
/* 1A788C 80278FAC C6000050 */  lwc1      $f0, 0x50($s0)
/* 1A7890 80278FB0 C6020010 */  lwc1      $f2, 0x10($s0)
/* 1A7894 80278FB4 46000106 */  mov.s     $f4, $f0
/* 1A7898 80278FB8 46001080 */  add.s     $f2, $f2, $f0
/* 1A789C 80278FBC C6000048 */  lwc1      $f0, 0x48($s0)
/* 1A78A0 80278FC0 46002101 */  sub.s     $f4, $f4, $f0
/* 1A78A4 80278FC4 E6020010 */  swc1      $f2, 0x10($s0)
/* 1A78A8 80278FC8 E6040050 */  swc1      $f4, 0x50($s0)
/* 1A78AC 80278FCC 8E620078 */  lw        $v0, 0x78($s3)
/* 1A78B0 80278FD0 1040000B */  beqz      $v0, .L80279000
/* 1A78B4 80278FD4 2612000C */   addiu    $s2, $s0, 0xC
/* 1A78B8 80278FD8 44800000 */  mtc1      $zero, $f0
/* 1A78BC 80278FDC 00000000 */  nop
/* 1A78C0 80278FE0 4600203C */  c.lt.s    $f4, $f0
/* 1A78C4 80278FE4 00000000 */  nop
/* 1A78C8 80278FE8 45000005 */  bc1f      .L80279000
/* 1A78CC 80278FEC 00000000 */   nop
/* 1A78D0 80278FF0 86040192 */  lh        $a0, 0x192($s0)
/* 1A78D4 80278FF4 82050077 */  lb        $a1, 0x77($s0)
/* 1A78D8 80278FF8 0C098F3F */  jal       set_animation
/* 1A78DC 80278FFC 8E060068 */   lw       $a2, 0x68($s0)
.L80279000:
/* 1A78E0 80279000 C6420044 */  lwc1      $f2, 0x44($s2)
/* 1A78E4 80279004 44800000 */  mtc1      $zero, $f0
/* 1A78E8 80279008 00000000 */  nop
/* 1A78EC 8027900C 4600103C */  c.lt.s    $f2, $f0
/* 1A78F0 80279010 00000000 */  nop
/* 1A78F4 80279014 45000007 */  bc1f      .L80279034
/* 1A78F8 80279018 00000000 */   nop
/* 1A78FC 8027901C C6400004 */  lwc1      $f0, 0x4($s2)
/* 1A7900 80279020 C6420010 */  lwc1      $f2, 0x10($s2)
/* 1A7904 80279024 4602003C */  c.lt.s    $f0, $f2
/* 1A7908 80279028 00000000 */  nop
/* 1A790C 8027902C 45030001 */  bc1tl     .L80279034
/* 1A7910 80279030 E6420004 */   swc1     $f2, 0x4($s2)
.L80279034:
/* 1A7914 80279034 8E450040 */  lw        $a1, 0x40($s2)
/* 1A7918 80279038 8E460048 */  lw        $a2, 0x48($s2)
/* 1A791C 8027903C 0C09904A */  jal       add_xz_vec3f
/* 1A7920 80279040 0240202D */   daddu    $a0, $s2, $zero
/* 1A7924 80279044 C6400000 */  lwc1      $f0, 0x0($s2)
/* 1A7928 80279048 E6000144 */  swc1      $f0, 0x144($s0)
/* 1A792C 8027904C C6400004 */  lwc1      $f0, 0x4($s2)
/* 1A7930 80279050 E6000148 */  swc1      $f0, 0x148($s0)
/* 1A7934 80279054 C6400008 */  lwc1      $f0, 0x8($s2)
/* 1A7938 80279058 E600014C */  swc1      $f0, 0x14C($s0)
/* 1A793C 8027905C 96420064 */  lhu       $v0, 0x64($s2)
/* 1A7940 80279060 2442FFFF */  addiu     $v0, $v0, -0x1
/* 1A7944 80279064 A6420064 */  sh        $v0, 0x64($s2)
/* 1A7948 80279068 00021400 */  sll       $v0, $v0, 16
/* 1A794C 8027906C 1C40001A */  bgtz      $v0, .L802790D8
/* 1A7950 80279070 0000102D */   daddu    $v0, $zero, $zero
/* 1A7954 80279074 8E62007C */  lw        $v0, 0x7C($s3)
/* 1A7958 80279078 30420001 */  andi      $v0, $v0, 0x1
/* 1A795C 8027907C 10400008 */  beqz      $v0, .L802790A0
/* 1A7960 80279080 00000000 */   nop
/* 1A7964 80279084 C6400048 */  lwc1      $f0, 0x48($s2)
/* 1A7968 80279088 E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A796C 8027908C 8E45000C */  lw        $a1, 0xC($s2)
/* 1A7970 80279090 8E460010 */  lw        $a2, 0x10($s2)
/* 1A7974 80279094 8E470014 */  lw        $a3, 0x14($s2)
/* 1A7978 80279098 0C0990BC */  jal       play_movement_dust_effects
/* 1A797C 8027909C 24040002 */   addiu    $a0, $zero, 0x2
.L802790A0:
/* 1A7980 802790A0 C640000C */  lwc1      $f0, 0xC($s2)
/* 1A7984 802790A4 E6000144 */  swc1      $f0, 0x144($s0)
/* 1A7988 802790A8 C6400010 */  lwc1      $f0, 0x10($s2)
/* 1A798C 802790AC E6000148 */  swc1      $f0, 0x148($s0)
/* 1A7990 802790B0 C6400014 */  lwc1      $f0, 0x14($s2)
/* 1A7994 802790B4 E600014C */  swc1      $f0, 0x14C($s0)
/* 1A7998 802790B8 8E620078 */  lw        $v0, 0x78($s3)
/* 1A799C 802790BC 10400006 */  beqz      $v0, .L802790D8
/* 1A79A0 802790C0 24020001 */   addiu    $v0, $zero, 0x1
/* 1A79A4 802790C4 86040192 */  lh        $a0, 0x192($s0)
/* 1A79A8 802790C8 8245006B */  lb        $a1, 0x6B($s2)
/* 1A79AC 802790CC 0C098F3F */  jal       set_animation
/* 1A79B0 802790D0 8E460060 */   lw       $a2, 0x60($s2)
/* 1A79B4 802790D4 24020001 */  addiu     $v0, $zero, 0x1
.L802790D8:
/* 1A79B8 802790D8 8FBF0028 */  lw        $ra, 0x28($sp)
/* 1A79BC 802790DC 8FB30024 */  lw        $s3, 0x24($sp)
/* 1A79C0 802790E0 8FB20020 */  lw        $s2, 0x20($sp)
/* 1A79C4 802790E4 8FB1001C */  lw        $s1, 0x1C($sp)
/* 1A79C8 802790E8 8FB00018 */  lw        $s0, 0x18($sp)
/* 1A79CC 802790EC D7BE0058 */  ldc1      $f30, 0x58($sp)
/* 1A79D0 802790F0 D7BC0050 */  ldc1      $f28, 0x50($sp)
/* 1A79D4 802790F4 D7BA0048 */  ldc1      $f26, 0x48($sp)
/* 1A79D8 802790F8 D7B80040 */  ldc1      $f24, 0x40($sp)
/* 1A79DC 802790FC D7B60038 */  ldc1      $f22, 0x38($sp)
/* 1A79E0 80279100 D7B40030 */  ldc1      $f20, 0x30($sp)
/* 1A79E4 80279104 03E00008 */  jr        $ra
/* 1A79E8 80279108 27BD0060 */   addiu    $sp, $sp, 0x60

### DECOMPILED C INSTRUCTIONS:

ApiStatus JumpToGoal(Evt* script, s32 isInitialCall) {
    Bytecode* args = script->ptrReadPos;
    Actor* actor;
    ActorState* actorState;
    s32 actorID;
    f32 posX, posY, posZ;
    f32 goalX, goalY, goalZ;
    f32 moveDist;

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

    if (script->functionTemp[0] == 0) {
        actorID = evt_get_variable(script, *args++);
        if (actorID == ACTOR_SELF) {
            actorID = script->owner1.enemyID;
        }
        script->functionTempPtr[1] = actor = get_actor(actorID);
        actorState = &actor->state;
        actorState->moveTime = evt_get_variable(script, *args++);
        script->functionTemp[2] = evt_get_variable(script, *args++);
        script->functionTemp[3] = 0;
        if (evt_get_variable(script, *args++) != 0) {
            script->functionTemp[3] |= 1;
        }
        if (evt_get_variable(script, *args++) != 0) {
            script->functionTemp[3] |= 2;
        }

        actorState->currentPos.x = actor->currentPos.x;
        actorState->currentPos.y = actor->currentPos.y;
        actorState->currentPos.z = actor->currentPos.z;

        posX = actorState->currentPos.x;
        posY = actorState->currentPos.y;
        posZ = actorState->currentPos.z;
        goalX = actorState->goalPos.x;
        goalY = actorState->goalPos.y;
        goalZ = actorState->goalPos.z;
        actorState->angle = atan2(posX, posZ, goalX, goalZ);
        actorState->distance = dist2D(posX, posZ, goalX, goalZ);

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

        if (actorState->moveTime == 0) {
            actorState->moveTime = actorState->distance / actorState->speed;
            moveDist = actorState->distance - (actorState->moveTime * actorState->speed);
        } else {
            actorState->speed = actorState->distance / actorState->moveTime;
            moveDist = actorState->distance - (actorState->moveTime * actorState->speed);
        }

        if (actorState->moveTime == 0) {
            return ApiStatus_DONE2;
        }

        actorState->velocity = (actorState->acceleration * actorState->moveTime * 0.5f) + (posY / actorState->moveTime);
        actorState->speed += (moveDist / actorState->moveTime);

        if (script->functionTemp[2] != 0) {
            set_animation(actor->actorID, (s8) actor->state.jumpPartIndex, actor->state.animJumpRise);
        }
        if (!(script->functionTemp[3] & 2) && (actor->actorTypeData1[4] != 0)) {
            sfx_play_sound_at_position(actor->actorTypeData1[4], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z);
        }
        script->functionTemp[0] = 1;
    }

    actor = script->functionTempPtr[1];
    actorState = &actor->state;

    actorState->currentPos.y += actorState->velocity;
    actorState->velocity -= actorState->acceleration;

    if ((script->functionTemp[2] != 0) && (actorState->velocity < 0.0f)) {
        set_animation(actor->actorID, (s8) actorState->jumpPartIndex, actorState->animJumpFall);
    }
    if (actorState->velocity < 0.0f) {
        if (actorState->currentPos.y < actorState->goalPos.y) {
            actorState->currentPos.y = actorState->goalPos.y;
        }
    }

    add_xz_vec3f(&actorState->currentPos, actorState->speed, actorState->angle);
    actor->currentPos.x = actorState->currentPos.x;
    actor->currentPos.y = actorState->currentPos.y;
    actor->currentPos.z = actorState->currentPos.z;

    actorState->moveTime--;
    if (actorState->moveTime > 0) {
        return ApiStatus_BLOCK;
    }

    if (script->functionTemp[3] & 1) {
        play_movement_dust_effects(2, actorState->goalPos.x, actorState->goalPos.y, actorState->goalPos.z, actorState->angle);
    }
    actor->currentPos.x = actorState->goalPos.x;
    actor->currentPos.y = actorState->goalPos.y;
    actor->currentPos.z = actorState->goalPos.z;
    if (script->functionTemp[2] != 0) {
        set_animation(actor->actorID, (s8) actorState->jumpPartIndex, actorState->animJumpLand);
    }
    return ApiStatus_DONE1;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel _Ldtob
/* 46FD0 8006BBD0 27BDFF80 */  addiu     $sp, $sp, -0x80
/* 46FD4 8006BBD4 AFB30054 */  sw        $s3, 0x54($sp)
/* 46FD8 8006BBD8 00809821 */  addu      $s3, $a0, $zero
/* 46FDC 8006BBDC AFB1004C */  sw        $s1, 0x4C($sp)
/* 46FE0 8006BBE0 27B10018 */  addiu     $s1, $sp, 0x18
/* 46FE4 8006BBE4 AFBF0060 */  sw        $ra, 0x60($sp)
/* 46FE8 8006BBE8 AFB5005C */  sw        $s5, 0x5C($sp)
/* 46FEC 8006BBEC AFB40058 */  sw        $s4, 0x58($sp)
/* 46FF0 8006BBF0 AFB20050 */  sw        $s2, 0x50($sp)
/* 46FF4 8006BBF4 AFB00048 */  sw        $s0, 0x48($sp)
/* 46FF8 8006BBF8 F7B80078 */  sdc1      $f24, 0x78($sp)
/* 46FFC 8006BBFC F7B60070 */  sdc1      $f22, 0x70($sp)
/* 47000 8006BC00 F7B40068 */  sdc1      $f20, 0x68($sp)
/* 47004 8006BC04 8E630024 */  lw        $v1, 0x24($s3)
/* 47008 8006BC08 D6740000 */  ldc1      $f20, 0x0($s3)
/* 4700C 8006BC0C 04610003 */  bgez      $v1, .L8006BC1C
/* 47010 8006BC10 00A0A821 */   addu     $s5, $a1, $zero
/* 47014 8006BC14 0801AF12 */  j         .L8006BC48
/* 47018 8006BC18 24020006 */   addiu    $v0, $zero, 0x6
.L8006BC1C:
/* 4701C 8006BC1C 1460000C */  bnez      $v1, .L8006BC50
/* 47020 8006BC20 27A40038 */   addiu    $a0, $sp, 0x38
/* 47024 8006BC24 00051600 */  sll       $v0, $a1, 24
/* 47028 8006BC28 00021603 */  sra       $v0, $v0, 24
/* 4702C 8006BC2C 38430067 */  xori      $v1, $v0, 0x67
/* 47030 8006BC30 2C630001 */  sltiu     $v1, $v1, 0x1
/* 47034 8006BC34 38420047 */  xori      $v0, $v0, 0x47
/* 47038 8006BC38 2C420001 */  sltiu     $v0, $v0, 0x1
/* 4703C 8006BC3C 00621825 */  or        $v1, $v1, $v0
/* 47040 8006BC40 10600003 */  beqz      $v1, .L8006BC50
/* 47044 8006BC44 24020001 */   addiu    $v0, $zero, 0x1
.L8006BC48:
/* 47048 8006BC48 AE620024 */  sw        $v0, 0x24($s3)
/* 4704C 8006BC4C 27A40038 */  addiu     $a0, $sp, 0x38
.L8006BC50:
/* 47050 8006BC50 0C01B007 */  jal       _Ldunscale
/* 47054 8006BC54 02602821 */   addu     $a1, $s3, $zero
/* 47058 8006BC58 00021400 */  sll       $v0, $v0, 16
/* 4705C 8006BC5C 00021C03 */  sra       $v1, $v0, 16
/* 47060 8006BC60 18600010 */  blez      $v1, .L8006BCA4
/* 47064 8006BC64 24020002 */   addiu    $v0, $zero, 0x2
/* 47068 8006BC68 3C06800A */  lui       $a2, %hi(D_80099E1C)
/* 4706C 8006BC6C 24C69E1C */  addiu     $a2, $a2, %lo(D_80099E1C)
/* 47070 8006BC70 8E670008 */  lw        $a3, 0x8($s3)
/* 47074 8006BC74 14620003 */  bne       $v1, $v0, .L8006BC84
/* 47078 8006BC78 24020003 */   addiu    $v0, $zero, 0x3
/* 4707C 8006BC7C 3C06800A */  lui       $a2, %hi(D_80099E18)
/* 47080 8006BC80 24C69E18 */  addiu     $a2, $a2, %lo(D_80099E18)
.L8006BC84:
/* 47084 8006BC84 AE620014 */  sw        $v0, 0x14($s3)
/* 47088 8006BC88 80C20000 */  lb        $v0, 0x0($a2)
/* 4708C 8006BC8C 80C30001 */  lb        $v1, 0x1($a2)
/* 47090 8006BC90 80C40002 */  lb        $a0, 0x2($a2)
/* 47094 8006BC94 A0E20000 */  sb        $v0, 0x0($a3)
/* 47098 8006BC98 A0E30001 */  sb        $v1, 0x1($a3)
/* 4709C 8006BC9C 0801AFFB */  j         .L8006BFEC
/* 470A0 8006BCA0 A0E40002 */   sb       $a0, 0x2($a3)
.L8006BCA4:
/* 470A4 8006BCA4 14600003 */  bnez      $v1, .L8006BCB4
/* 470A8 8006BCA8 00003821 */   addu     $a3, $zero, $zero
/* 470AC 8006BCAC 0801AFF2 */  j         .L8006BFC8
/* 470B0 8006BCB0 A7A00038 */   sh       $zero, 0x38($sp)
.L8006BCB4:
/* 470B4 8006BCB4 44800000 */  mtc1      $zero, $f0
/* 470B8 8006BCB8 44800800 */  mtc1      $zero, $f1
/* 470BC 8006BCBC 00000000 */  nop
/* 470C0 8006BCC0 4620A03C */  c.lt.d    $f20, $f0
/* 470C4 8006BCC4 00000000 */  nop
/* 470C8 8006BCC8 00000000 */  nop
/* 470CC 8006BCCC 45030001 */  bc1tl     .L8006BCD4
/* 470D0 8006BCD0 4620A507 */   neg.d    $f20, $f20
.L8006BCD4:
/* 470D4 8006BCD4 87A30038 */  lh        $v1, 0x38($sp)
/* 470D8 8006BCD8 24027597 */  addiu     $v0, $zero, 0x7597
/* 470DC 8006BCDC 00620018 */  mult      $v1, $v0
/* 470E0 8006BCE0 00001812 */  mflo      $v1
/* 470E4 8006BCE4 3C0214F8 */  lui       $v0, (0x14F8B589 >> 16)
/* 470E8 8006BCE8 3442B589 */  ori       $v0, $v0, (0x14F8B589 & 0xFFFF)
/* 470EC 8006BCEC 00620018 */  mult      $v1, $v0
/* 470F0 8006BCF0 00031FC3 */  sra       $v1, $v1, 31
/* 470F4 8006BCF4 00004010 */  mfhi      $t0
/* 470F8 8006BCF8 00081343 */  sra       $v0, $t0, 13
/* 470FC 8006BCFC 00431023 */  subu      $v0, $v0, $v1
/* 47100 8006BD00 2443FFFC */  addiu     $v1, $v0, -0x4
/* 47104 8006BD04 00031400 */  sll       $v0, $v1, 16
/* 47108 8006BD08 00021403 */  sra       $v0, $v0, 16
/* 4710C 8006BD0C 04410013 */  bgez      $v0, .L8006BD5C
/* 47110 8006BD10 A7A30038 */   sh       $v1, 0x38($sp)
/* 47114 8006BD14 00021023 */  negu      $v0, $v0
/* 47118 8006BD18 24420003 */  addiu     $v0, $v0, 0x3
/* 4711C 8006BD1C 2403FFFC */  addiu     $v1, $zero, -0x4
/* 47120 8006BD20 00431824 */  and       $v1, $v0, $v1
/* 47124 8006BD24 00031023 */  negu      $v0, $v1
/* 47128 8006BD28 1860001F */  blez      $v1, .L8006BDA8
/* 4712C 8006BD2C A7A20038 */   sh       $v0, 0x38($sp)
/* 47130 8006BD30 3C04800A */  lui       $a0, %hi(D_80099DD0)
/* 47134 8006BD34 24849DD0 */  addiu     $a0, $a0, %lo(D_80099DD0)
.L8006BD38:
/* 47138 8006BD38 30620001 */  andi      $v0, $v1, 0x1
/* 4713C 8006BD3C 10400003 */  beqz      $v0, .L8006BD4C
/* 47140 8006BD40 00031843 */   sra      $v1, $v1, 1
/* 47144 8006BD44 D4800000 */  ldc1      $f0, 0x0($a0)
/* 47148 8006BD48 4620A502 */  mul.d     $f20, $f20, $f0
.L8006BD4C:
/* 4714C 8006BD4C 1C60FFFA */  bgtz      $v1, .L8006BD38
/* 47150 8006BD50 24840008 */   addiu    $a0, $a0, 0x8
/* 47154 8006BD54 0801AF6A */  j         .L8006BDA8
/* 47158 8006BD58 00000000 */   nop
.L8006BD5C:
/* 4715C 8006BD5C 18400012 */  blez      $v0, .L8006BDA8
/* 47160 8006BD60 2402FFFC */   addiu    $v0, $zero, -0x4
/* 47164 8006BD64 3C01800A */  lui       $at, %hi(D_80099E20)
/* 47168 8006BD68 D4229E20 */  ldc1      $f2, %lo(D_80099E20)($at)
/* 4716C 8006BD6C 00621024 */  and       $v0, $v1, $v0
/* 47170 8006BD70 00021C00 */  sll       $v1, $v0, 16
/* 47174 8006BD74 00031C03 */  sra       $v1, $v1, 16
/* 47178 8006BD78 1860000A */  blez      $v1, .L8006BDA4
/* 4717C 8006BD7C A7A20038 */   sh       $v0, 0x38($sp)
/* 47180 8006BD80 3C04800A */  lui       $a0, %hi(D_80099DD0)
/* 47184 8006BD84 24849DD0 */  addiu     $a0, $a0, %lo(D_80099DD0)
.L8006BD88:
/* 47188 8006BD88 30620001 */  andi      $v0, $v1, 0x1
/* 4718C 8006BD8C 10400003 */  beqz      $v0, .L8006BD9C
/* 47190 8006BD90 00031843 */   sra      $v1, $v1, 1
/* 47194 8006BD94 D4800000 */  ldc1      $f0, 0x0($a0)
/* 47198 8006BD98 46201082 */  mul.d     $f2, $f2, $f0
.L8006BD9C:
/* 4719C 8006BD9C 1C60FFFA */  bgtz      $v1, .L8006BD88
/* 471A0 8006BDA0 24840008 */   addiu    $a0, $a0, 0x8
.L8006BDA4:
/* 471A4 8006BDA4 4622A503 */  div.d     $f20, $f20, $f2
.L8006BDA8:
/* 471A8 8006BDA8 8E640024 */  lw        $a0, 0x24($s3)
/* 471AC 8006BDAC 00151600 */  sll       $v0, $s5, 24
/* 471B0 8006BDB0 00021603 */  sra       $v0, $v0, 24
/* 471B4 8006BDB4 24030066 */  addiu     $v1, $zero, 0x66
/* 471B8 8006BDB8 14430004 */  bne       $v0, $v1, .L8006BDCC
/* 471BC 8006BDBC 24920006 */   addiu    $s2, $a0, 0x6
/* 471C0 8006BDC0 87A30038 */  lh        $v1, 0x38($sp)
/* 471C4 8006BDC4 2482000A */  addiu     $v0, $a0, 0xA
/* 471C8 8006BDC8 00439021 */  addu      $s2, $v0, $v1
.L8006BDCC:
/* 471CC 8006BDCC 2A420014 */  slti      $v0, $s2, 0x14
/* 471D0 8006BDD0 50400001 */  beql      $v0, $zero, .L8006BDD8
/* 471D4 8006BDD4 24120013 */   addiu    $s2, $zero, 0x13
.L8006BDD8:
/* 471D8 8006BDD8 24020030 */  addiu     $v0, $zero, 0x30
/* 471DC 8006BDDC A2220000 */  sb        $v0, 0x0($s1)
/* 471E0 8006BDE0 26310001 */  addiu     $s1, $s1, 0x1
/* 471E4 8006BDE4 4480C000 */  mtc1      $zero, $f24
/* 471E8 8006BDE8 4480C800 */  mtc1      $zero, $f25
/* 471EC 8006BDEC 3C01800A */  lui       $at, %hi(D_80099E28)
/* 471F0 8006BDF0 D4369E28 */  ldc1      $f22, %lo(D_80099E28)($at)
/* 471F4 8006BDF4 24140030 */  addiu     $s4, $zero, 0x30
.L8006BDF8:
/* 471F8 8006BDF8 4634C03C */  c.lt.d    $f24, $f20
/* 471FC 8006BDFC 24030001 */  addiu     $v1, $zero, 0x1
/* 47200 8006BE00 00000000 */  nop
/* 47204 8006BE04 45010002 */  bc1t      .L8006BE10
/* 47208 8006BE08 0012102A */   slt      $v0, $zero, $s2
/* 4720C 8006BE0C 00001821 */  addu      $v1, $zero, $zero
.L8006BE10:
/* 47210 8006BE10 00431024 */  and       $v0, $v0, $v1
/* 47214 8006BE14 10400021 */  beqz      $v0, .L8006BE9C
/* 47218 8006BE18 2652FFF8 */   addiu    $s2, $s2, -0x8
/* 4721C 8006BE1C 4620A00D */  trunc.w.d $f0, $f20
/* 47220 8006BE20 44050000 */  mfc1      $a1, $f0
/* 47224 8006BE24 00000000 */  nop
/* 47228 8006BE28 1A400006 */  blez      $s2, .L8006BE44
/* 4722C 8006BE2C 26310008 */   addiu    $s1, $s1, 0x8
/* 47230 8006BE30 44850000 */  mtc1      $a1, $f0
/* 47234 8006BE34 00000000 */  nop
/* 47238 8006BE38 46800021 */  cvt.d.w   $f0, $f0
/* 4723C 8006BE3C 4620A001 */  sub.d     $f0, $f20, $f0
/* 47240 8006BE40 46360502 */  mul.d     $f20, $f0, $f22
.L8006BE44:
/* 47244 8006BE44 18A00010 */  blez      $a1, .L8006BE88
/* 47248 8006BE48 24100008 */   addiu    $s0, $zero, 0x8
/* 4724C 8006BE4C 2610FFFF */  addiu     $s0, $s0, -0x1
.L8006BE50:
/* 47250 8006BE50 0600000D */  bltz      $s0, .L8006BE88
/* 47254 8006BE54 27A40040 */   addiu    $a0, $sp, 0x40
/* 47258 8006BE58 0C01B588 */  jal       ldiv
/* 4725C 8006BE5C 2406000A */   addiu    $a2, $zero, 0xA
/* 47260 8006BE60 8FA20044 */  lw        $v0, 0x44($sp)
/* 47264 8006BE64 2631FFFF */  addiu     $s1, $s1, -0x1
/* 47268 8006BE68 24420030 */  addiu     $v0, $v0, 0x30
/* 4726C 8006BE6C A2220000 */  sb        $v0, 0x0($s1)
/* 47270 8006BE70 8FA50040 */  lw        $a1, 0x40($sp)
/* 47274 8006BE74 1CA0FFF6 */  bgtz      $a1, .L8006BE50
/* 47278 8006BE78 2610FFFF */   addiu    $s0, $s0, -0x1
/* 4727C 8006BE7C 0801AFA3 */  j         .L8006BE8C
/* 47280 8006BE80 00000000 */   nop
.L8006BE84:
/* 47284 8006BE84 A2340000 */  sb        $s4, 0x0($s1)
.L8006BE88:
/* 47288 8006BE88 2610FFFF */  addiu     $s0, $s0, -0x1
.L8006BE8C:
/* 4728C 8006BE8C 0603FFFD */  bgezl     $s0, .L8006BE84
/* 47290 8006BE90 2631FFFF */   addiu    $s1, $s1, -0x1
/* 47294 8006BE94 0801AF7E */  j         .L8006BDF8
/* 47298 8006BE98 26310008 */   addiu    $s1, $s1, 0x8
.L8006BE9C:
/* 4729C 8006BE9C 2623FFFF */  addiu     $v1, $s1, -0x1
/* 472A0 8006BEA0 27A20018 */  addiu     $v0, $sp, 0x18
/* 472A4 8006BEA4 00629023 */  subu      $s2, $v1, $v0
/* 472A8 8006BEA8 97A20038 */  lhu       $v0, 0x38($sp)
/* 472AC 8006BEAC 83A30019 */  lb        $v1, 0x19($sp)
/* 472B0 8006BEB0 24420007 */  addiu     $v0, $v0, 0x7
/* 472B4 8006BEB4 A7A20038 */  sh        $v0, 0x38($sp)
/* 472B8 8006BEB8 24020030 */  addiu     $v0, $zero, 0x30
/* 472BC 8006BEBC 14620009 */  bne       $v1, $v0, .L8006BEE4
/* 472C0 8006BEC0 27B10019 */   addiu    $s1, $sp, 0x19
/* 472C4 8006BEC4 24030030 */  addiu     $v1, $zero, 0x30
.L8006BEC8:
/* 472C8 8006BEC8 97A20038 */  lhu       $v0, 0x38($sp)
/* 472CC 8006BECC 26310001 */  addiu     $s1, $s1, 0x1
/* 472D0 8006BED0 2442FFFF */  addiu     $v0, $v0, -0x1
/* 472D4 8006BED4 A7A20038 */  sh        $v0, 0x38($sp)
/* 472D8 8006BED8 82220000 */  lb        $v0, 0x0($s1)
/* 472DC 8006BEDC 1043FFFA */  beq       $v0, $v1, .L8006BEC8
/* 472E0 8006BEE0 2652FFFF */   addiu    $s2, $s2, -0x1
.L8006BEE4:
/* 472E4 8006BEE4 8E650024 */  lw        $a1, 0x24($s3)
/* 472E8 8006BEE8 00151600 */  sll       $v0, $s5, 24
/* 472EC 8006BEEC 00022603 */  sra       $a0, $v0, 24
/* 472F0 8006BEF0 24020066 */  addiu     $v0, $zero, 0x66
/* 472F4 8006BEF4 14820005 */  bne       $a0, $v0, .L8006BF0C
/* 472F8 8006BEF8 38830065 */   xori     $v1, $a0, 0x65
/* 472FC 8006BEFC 87A30038 */  lh        $v1, 0x38($sp)
/* 47300 8006BF00 24A20001 */  addiu     $v0, $a1, 0x1
/* 47304 8006BF04 0801AFC8 */  j         .L8006BF20
/* 47308 8006BF08 00433821 */   addu     $a3, $v0, $v1
.L8006BF0C:
/* 4730C 8006BF0C 2C630001 */  sltiu     $v1, $v1, 0x1
/* 47310 8006BF10 38820045 */  xori      $v0, $a0, 0x45
/* 47314 8006BF14 2C420001 */  sltiu     $v0, $v0, 0x1
/* 47318 8006BF18 00621825 */  or        $v1, $v1, $v0
/* 4731C 8006BF1C 00A33821 */  addu      $a3, $a1, $v1
.L8006BF20:
/* 47320 8006BF20 00071400 */  sll       $v0, $a3, 16
/* 47324 8006BF24 00021403 */  sra       $v0, $v0, 16
/* 47328 8006BF28 0242102A */  slt       $v0, $s2, $v0
/* 4732C 8006BF2C 54400001 */  bnel      $v0, $zero, .L8006BF34
/* 47330 8006BF30 02403821 */   addu     $a3, $s2, $zero
.L8006BF34:
/* 47334 8006BF34 00071400 */  sll       $v0, $a3, 16
/* 47338 8006BF38 00022403 */  sra       $a0, $v0, 16
/* 4733C 8006BF3C 18800022 */  blez      $a0, .L8006BFC8
/* 47340 8006BF40 0092102A */   slt      $v0, $a0, $s2
/* 47344 8006BF44 10400008 */  beqz      $v0, .L8006BF68
/* 47348 8006BF48 24030030 */   addiu    $v1, $zero, 0x30
/* 4734C 8006BF4C 02241021 */  addu      $v0, $s1, $a0
/* 47350 8006BF50 80420000 */  lb        $v0, 0x0($v0)
/* 47354 8006BF54 28420035 */  slti      $v0, $v0, 0x35
/* 47358 8006BF58 38420001 */  xori      $v0, $v0, 0x1
/* 4735C 8006BF5C 00021023 */  negu      $v0, $v0
/* 47360 8006BF60 30420039 */  andi      $v0, $v0, 0x39
/* 47364 8006BF64 34430030 */  ori       $v1, $v0, 0x30
.L8006BF68:
/* 47368 8006BF68 2485FFFF */  addiu     $a1, $a0, -0x1
/* 4736C 8006BF6C 02252021 */  addu      $a0, $s1, $a1
/* 47370 8006BF70 80820000 */  lb        $v0, 0x0($a0)
/* 47374 8006BF74 54430008 */  bnel      $v0, $v1, .L8006BF98
/* 47378 8006BF78 24020039 */   addiu    $v0, $zero, 0x39
/* 4737C 8006BF7C 00403021 */  addu      $a2, $v0, $zero
.L8006BF80:
/* 47380 8006BF80 2484FFFF */  addiu     $a0, $a0, -0x1
/* 47384 8006BF84 80820000 */  lb        $v0, 0x0($a0)
/* 47388 8006BF88 24E7FFFF */  addiu     $a3, $a3, -0x1
/* 4738C 8006BF8C 1046FFFC */  beq       $v0, $a2, .L8006BF80
/* 47390 8006BF90 24A5FFFF */   addiu    $a1, $a1, -0x1
/* 47394 8006BF94 24020039 */  addiu     $v0, $zero, 0x39
.L8006BF98:
/* 47398 8006BF98 14620004 */  bne       $v1, $v0, .L8006BFAC
/* 4739C 8006BF9C 02251821 */   addu     $v1, $s1, $a1
/* 473A0 8006BFA0 90620000 */  lbu       $v0, 0x0($v1)
/* 473A4 8006BFA4 24420001 */  addiu     $v0, $v0, 0x1
/* 473A8 8006BFA8 A0620000 */  sb        $v0, 0x0($v1)
.L8006BFAC:
/* 473AC 8006BFAC 04A10007 */  bgez      $a1, .L8006BFCC
/* 473B0 8006BFB0 02602021 */   addu     $a0, $s3, $zero
/* 473B4 8006BFB4 97A20038 */  lhu       $v0, 0x38($sp)
/* 473B8 8006BFB8 2631FFFF */  addiu     $s1, $s1, -0x1
/* 473BC 8006BFBC 24E70001 */  addiu     $a3, $a3, 0x1
/* 473C0 8006BFC0 24420001 */  addiu     $v0, $v0, 0x1
/* 473C4 8006BFC4 A7A20038 */  sh        $v0, 0x38($sp)
.L8006BFC8:
/* 473C8 8006BFC8 02602021 */  addu      $a0, $s3, $zero
.L8006BFCC:
/* 473CC 8006BFCC 00152E00 */  sll       $a1, $s5, 24
/* 473D0 8006BFD0 87A20038 */  lh        $v0, 0x38($sp)
/* 473D4 8006BFD4 00052E03 */  sra       $a1, $a1, 24
/* 473D8 8006BFD8 02203021 */  addu      $a2, $s1, $zero
/* 473DC 8006BFDC 00073C00 */  sll       $a3, $a3, 16
/* 473E0 8006BFE0 00073C03 */  sra       $a3, $a3, 16
/* 473E4 8006BFE4 0C01B02D */  jal       _Genld
/* 473E8 8006BFE8 AFA20010 */   sw       $v0, 0x10($sp)
.L8006BFEC:
/* 473EC 8006BFEC 8FBF0060 */  lw        $ra, 0x60($sp)
/* 473F0 8006BFF0 8FB5005C */  lw        $s5, 0x5C($sp)
/* 473F4 8006BFF4 8FB40058 */  lw        $s4, 0x58($sp)
/* 473F8 8006BFF8 8FB30054 */  lw        $s3, 0x54($sp)
/* 473FC 8006BFFC 8FB20050 */  lw        $s2, 0x50($sp)
/* 47400 8006C000 8FB1004C */  lw        $s1, 0x4C($sp)
/* 47404 8006C004 8FB00048 */  lw        $s0, 0x48($sp)
/* 47408 8006C008 D7B80078 */  ldc1      $f24, 0x78($sp)
/* 4740C 8006C00C D7B60070 */  ldc1      $f22, 0x70($sp)
/* 47410 8006C010 D7B40068 */  ldc1      $f20, 0x68($sp)
/* 47414 8006C014 03E00008 */  jr        $ra
/* 47418 8006C018 27BD0080 */   addiu    $sp, $sp, 0x80

### DECOMPILED C INSTRUCTIONS:

void _Ldtob(_Pft* px, char code) {
    char buff[BUFF_LEN];
    char *p;
    f64 ldval;
    s16 err;
    s16 nsig;
    s16 xexp;

    // char unused[0x4];
    p = buff;
    ldval = px->v.ld;

    if (px->prec < 0) {
        px->prec = 6;
    } else if (px->prec == 0 && (code == 'g' || code == 'G')) {
        px->prec = 1;
    }

    err = _Ldunscale(&xexp, px);
    if (err > 0) {
        memcpy(px->s, err == 2 ? "NaN" : "Inf", px->n1 = 3);
        return;
    } else if (err == 0) {
        nsig = 0;
        xexp = 0;
    } else {
        int i;
        int n;

        if (ldval < 0) {
            ldval = -ldval;
        }

        // what
        if ((xexp = xexp * 30103 / 100000 - 4) < 0) {
            n = ALIGN(-xexp, 4), xexp = -n;

            for (i = 0; n > 0; n >>= 1, i++) {
                if (n & 1) {
                    ldval *= pows[i];
                }
            }
        } else if (xexp > 0) {
            f64 factor = 1;

            xexp &= ~3;

            for (n = xexp, i = 0; n > 0; n >>= 1, i++) {
                if (n & 1) {
                    factor *= pows[i];
                }
            }

            ldval /= factor;
        }
        {
            int gen = px->prec + ((code == 'f') ? 10 + xexp : 6);

            if (gen > 0x13) {
                gen = 0x13;
            }

            for (*p++ = '0'; gen > 0 && 0 < ldval; p += 8) {
                int j;
                int lo = ldval;

                if ((gen -= 8) > 0) {
                    ldval = (ldval - lo) * 1e8;
                }

                for (p += 8, j = 8; lo > 0 && --j >= 0;) {
                    ldiv_t qr = ldiv(lo, 10);
                    *--p = qr.rem + '0', lo = qr.quot;
                }

                while (--j >= 0) {
                    *--p = '0';
                }
            }

            gen = p - &buff[1];

            for (p = &buff[1], xexp += 7; *p == '0'; p++) {
                --gen, --xexp;
            }

            nsig = px->prec + ((code == 'f') ? xexp + 1 : ((code == 'e' || code == 'E') ? 1 : 0));

            if (gen < nsig) {
                nsig = gen;
            }

            if (nsig > 0) {
                char drop = nsig < gen && '5' <= p[nsig] ? '9' : '0';
                int n;

                for (n = nsig; p[--n] == drop;) {
                    --nsig;
                }

                if (drop == '9') {
                    ++p[n];
                }

                if (n < 0) {
                    --p, ++nsig, ++xexp;
                }
            }
        }
    }

    _Genld(px, code, p, nsig, xexp);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel osPfsReadWriteFile
/* 43BE0 800687E0 27BDFEA0 */  addiu     $sp, $sp, -0x160
/* 43BE4 800687E4 AFB60158 */  sw        $s6, 0x158($sp)
/* 43BE8 800687E8 8FB60170 */  lw        $s6, 0x170($sp)
/* 43BEC 800687EC AFB00140 */  sw        $s0, 0x140($sp)
/* 43BF0 800687F0 00808021 */  addu      $s0, $a0, $zero
/* 43BF4 800687F4 AFB50154 */  sw        $s5, 0x154($sp)
/* 43BF8 800687F8 00A0A821 */  addu      $s5, $a1, $zero
/* 43BFC 800687FC AFB10144 */  sw        $s1, 0x144($sp)
/* 43C00 80068800 00E08821 */  addu      $s1, $a3, $zero
/* 43C04 80068804 AFBF015C */  sw        $ra, 0x15C($sp)
/* 43C08 80068808 AFB40150 */  sw        $s4, 0x150($sp)
/* 43C0C 8006880C AFB3014C */  sw        $s3, 0x14C($sp)
/* 43C10 80068810 AFB20148 */  sw        $s2, 0x148($sp)
/* 43C14 80068814 8E020050 */  lw        $v0, 0x50($s0)
/* 43C18 80068818 00151FC2 */  srl       $v1, $s5, 31
/* 43C1C 8006881C 02A2102A */  slt       $v0, $s5, $v0
/* 43C20 80068820 38420001 */  xori      $v0, $v0, 0x1
/* 43C24 80068824 00431025 */  or        $v0, $v0, $v1
/* 43C28 80068828 1440003F */  bnez      $v0, .L80068928
/* 43C2C 8006882C 00C0A021 */   addu     $s4, $a2, $zero
/* 43C30 80068830 1AC0003D */  blez      $s6, .L80068928
/* 43C34 80068834 32C2001F */   andi     $v0, $s6, 0x1F
/* 43C38 80068838 544000EF */  bnel      $v0, $zero, .L80068BF8
/* 43C3C 8006883C 24020005 */   addiu    $v0, $zero, 0x5
/* 43C40 80068840 06200039 */  bltz      $s1, .L80068928
/* 43C44 80068844 3222001F */   andi     $v0, $s1, 0x1F
/* 43C48 80068848 144000EB */  bnez      $v0, .L80068BF8
/* 43C4C 8006884C 24020005 */   addiu    $v0, $zero, 0x5
/* 43C50 80068850 8E020000 */  lw        $v0, 0x0($s0)
/* 43C54 80068854 30420001 */  andi      $v0, $v0, 0x1
/* 43C58 80068858 104000E7 */  beqz      $v0, .L80068BF8
/* 43C5C 8006885C 24020005 */   addiu    $v0, $zero, 0x5
/* 43C60 80068860 0C01A775 */  jal       __osCheckId
/* 43C64 80068864 02002021 */   addu     $a0, $s0, $zero
/* 43C68 80068868 24030002 */  addiu     $v1, $zero, 0x2
/* 43C6C 8006886C 104300E2 */  beq       $v0, $v1, .L80068BF8
/* 43C70 80068870 24020002 */   addiu    $v0, $zero, 0x2
/* 43C74 80068874 92020065 */  lbu       $v0, 0x65($s0)
/* 43C78 80068878 10400006 */  beqz      $v0, .L80068894
/* 43C7C 8006887C 02002021 */   addu     $a0, $s0, $zero
/* 43C80 80068880 0C01A5B4 */  jal       __osPfsSelectBank
/* 43C84 80068884 00002821 */   addu     $a1, $zero, $zero
/* 43C88 80068888 00401821 */  addu      $v1, $v0, $zero
/* 43C8C 8006888C 146000DA */  bnez      $v1, .L80068BF8
/* 43C90 80068890 00000000 */   nop
.L80068894:
/* 43C94 80068894 8E040004 */  lw        $a0, 0x4($s0)
/* 43C98 80068898 8E06005C */  lw        $a2, 0x5C($s0)
/* 43C9C 8006889C 8E050008 */  lw        $a1, 0x8($s0)
/* 43CA0 800688A0 27A70018 */  addiu     $a3, $sp, 0x18
/* 43CA4 800688A4 00D53021 */  addu      $a2, $a2, $s5
/* 43CA8 800688A8 0C01A874 */  jal       __osContRamRead
/* 43CAC 800688AC 30C6FFFF */   andi     $a2, $a2, 0xFFFF
/* 43CB0 800688B0 00401821 */  addu      $v1, $v0, $zero
/* 43CB4 800688B4 146000D0 */  bnez      $v1, .L80068BF8
/* 43CB8 800688B8 00000000 */   nop
/* 43CBC 800688BC 97A2001C */  lhu       $v0, 0x1C($sp)
/* 43CC0 800688C0 104000CD */  beqz      $v0, .L80068BF8
/* 43CC4 800688C4 24020005 */   addiu    $v0, $zero, 0x5
/* 43CC8 800688C8 8FA20018 */  lw        $v0, 0x18($sp)
/* 43CCC 800688CC 104000CA */  beqz      $v0, .L80068BF8
/* 43CD0 800688D0 24020005 */   addiu    $v0, $zero, 0x5
/* 43CD4 800688D4 97A2001E */  lhu       $v0, 0x1E($sp)
/* 43CD8 800688D8 8E030060 */  lw        $v1, 0x60($s0)
/* 43CDC 800688DC 0043102A */  slt       $v0, $v0, $v1
/* 43CE0 800688E0 1440000D */  bnez      $v0, .L80068918
/* 43CE4 800688E4 00000000 */   nop
/* 43CE8 800688E8 93A2001E */  lbu       $v0, 0x1E($sp)
/* 43CEC 800688EC 92030064 */  lbu       $v1, 0x64($s0)
/* 43CF0 800688F0 0043102B */  sltu      $v0, $v0, $v1
/* 43CF4 800688F4 10400008 */  beqz      $v0, .L80068918
/* 43CF8 800688F8 00000000 */   nop
/* 43CFC 800688FC 93A2001F */  lbu       $v0, 0x1F($sp)
/* 43D00 80068900 2C430001 */  sltiu     $v1, $v0, 0x1
/* 43D04 80068904 2C420080 */  sltiu     $v0, $v0, 0x80
/* 43D08 80068908 38420001 */  xori      $v0, $v0, 0x1
/* 43D0C 8006890C 00621825 */  or        $v1, $v1, $v0
/* 43D10 80068910 50600007 */  beql      $v1, $zero, .L80068930
/* 43D14 80068914 328200FF */   andi     $v0, $s4, 0xFF
.L80068918:
/* 43D18 80068918 97A4001E */  lhu       $a0, 0x1E($sp)
/* 43D1C 8006891C 24030001 */  addiu     $v1, $zero, 0x1
/* 43D20 80068920 148300B5 */  bne       $a0, $v1, .L80068BF8
/* 43D24 80068924 24020003 */   addiu    $v0, $zero, 0x3
.L80068928:
/* 43D28 80068928 0801A2FE */  j         .L80068BF8
/* 43D2C 8006892C 24020005 */   addiu    $v0, $zero, 0x5
.L80068930:
/* 43D30 80068930 14400007 */  bnez      $v0, .L80068950
/* 43D34 80068934 240200FF */   addiu    $v0, $zero, 0xFF
/* 43D38 80068938 93A20020 */  lbu       $v0, 0x20($sp)
/* 43D3C 8006893C 30420002 */  andi      $v0, $v0, 0x2
/* 43D40 80068940 14400003 */  bnez      $v0, .L80068950
/* 43D44 80068944 240200FF */   addiu    $v0, $zero, 0xFF
/* 43D48 80068948 0801A2FE */  j         .L80068BF8
/* 43D4C 8006894C 24020006 */   addiu    $v0, $zero, 0x6
.L80068950:
/* 43D50 80068950 02203821 */  addu      $a3, $s1, $zero
/* 43D54 80068954 04E10002 */  bgez      $a3, .L80068960
/* 43D58 80068958 A3A20138 */   sb       $v0, 0x138($sp)
/* 43D5C 8006895C 24E7001F */  addiu     $a3, $a3, 0x1F
.L80068960:
/* 43D60 80068960 97A2001E */  lhu       $v0, 0x1E($sp)
/* 43D64 80068964 00078943 */  sra       $s1, $a3, 5
/* 43D68 80068968 A7A2013A */  sh        $v0, 0x13A($sp)
/* 43D6C 8006896C 2A220008 */  slti      $v0, $s1, 0x8
/* 43D70 80068970 1440002C */  bnez      $v0, .L80068A24
/* 43D74 80068974 02C01021 */   addu     $v0, $s6, $zero
/* 43D78 80068978 27B20038 */  addiu     $s2, $sp, 0x38
/* 43D7C 8006897C 24130001 */  addiu     $s3, $zero, 0x1
.L80068980:
/* 43D80 80068980 93A3013A */  lbu       $v1, 0x13A($sp)
/* 43D84 80068984 93A20138 */  lbu       $v0, 0x138($sp)
/* 43D88 80068988 306700FF */  andi      $a3, $v1, 0xFF
/* 43D8C 8006898C 10E20007 */  beq       $a3, $v0, .L800689AC
/* 43D90 80068990 02002021 */   addu     $a0, $s0, $zero
/* 43D94 80068994 A3A30138 */  sb        $v1, 0x138($sp)
/* 43D98 80068998 02402821 */  addu      $a1, $s2, $zero
/* 43D9C 8006899C 0C01A7A3 */  jal       __osPfsRWInode
/* 43DA0 800689A0 00003021 */   addu     $a2, $zero, $zero
/* 43DA4 800689A4 1440001A */  bnez      $v0, .L80068A10
/* 43DA8 800689A8 00401821 */   addu     $v1, $v0, $zero
.L800689AC:
/* 43DAC 800689AC 93A2013B */  lbu       $v0, 0x13B($sp)
/* 43DB0 800689B0 00021040 */  sll       $v0, $v0, 1
/* 43DB4 800689B4 00521021 */  addu      $v0, $v0, $s2
/* 43DB8 800689B8 94430000 */  lhu       $v1, 0x0($v0)
/* 43DBC 800689BC A7A3013A */  sh        $v1, 0x13A($sp)
/* 43DC0 800689C0 8E020060 */  lw        $v0, 0x60($s0)
/* 43DC4 800689C4 0062182A */  slt       $v1, $v1, $v0
/* 43DC8 800689C8 1460000D */  bnez      $v1, .L80068A00
/* 43DCC 800689CC 00000000 */   nop
/* 43DD0 800689D0 93A2013A */  lbu       $v0, 0x13A($sp)
/* 43DD4 800689D4 92030064 */  lbu       $v1, 0x64($s0)
/* 43DD8 800689D8 0043102B */  sltu      $v0, $v0, $v1
/* 43DDC 800689DC 10400008 */  beqz      $v0, .L80068A00
/* 43DE0 800689E0 00000000 */   nop
/* 43DE4 800689E4 93A2013B */  lbu       $v0, 0x13B($sp)
/* 43DE8 800689E8 2C430001 */  sltiu     $v1, $v0, 0x1
/* 43DEC 800689EC 2C420080 */  sltiu     $v0, $v0, 0x80
/* 43DF0 800689F0 38420001 */  xori      $v0, $v0, 0x1
/* 43DF4 800689F4 00621825 */  or        $v1, $v1, $v0
/* 43DF8 800689F8 50600005 */  beql      $v1, $zero, .L80068A10
/* 43DFC 800689FC 00001821 */   addu     $v1, $zero, $zero
.L80068A00:
/* 43E00 80068A00 97A2013A */  lhu       $v0, 0x13A($sp)
/* 43E04 80068A04 14530002 */  bne       $v0, $s3, .L80068A10
/* 43E08 80068A08 24030003 */   addiu    $v1, $zero, 0x3
/* 43E0C 80068A0C 24030005 */  addiu     $v1, $zero, 0x5
.L80068A10:
/* 43E10 80068A10 14600074 */  bnez      $v1, .L80068BE4
/* 43E14 80068A14 2631FFF8 */   addiu    $s1, $s1, -0x8
/* 43E18 80068A18 2A220008 */  slti      $v0, $s1, 0x8
/* 43E1C 80068A1C 1040FFD8 */  beqz      $v0, .L80068980
/* 43E20 80068A20 02C01021 */   addu     $v0, $s6, $zero
.L80068A24:
/* 43E24 80068A24 04420001 */  bltzl     $v0, .L80068A2C
/* 43E28 80068A28 2442001F */   addiu    $v0, $v0, 0x1F
.L80068A2C:
/* 43E2C 80068A2C 00029943 */  sra       $s3, $v0, 5
/* 43E30 80068A30 8FB20174 */  lw        $s2, 0x174($sp)
/* 43E34 80068A34 5A60004E */  blezl     $s3, .L80068B70
/* 43E38 80068A38 328300FF */   andi     $v1, $s4, 0xFF
/* 43E3C 80068A3C 24160001 */  addiu     $s6, $zero, 0x1
.L80068A40:
/* 43E40 80068A40 24020008 */  addiu     $v0, $zero, 0x8
/* 43E44 80068A44 16220028 */  bne       $s1, $v0, .L80068AE8
/* 43E48 80068A48 00000000 */   nop
/* 43E4C 80068A4C 93A3013A */  lbu       $v1, 0x13A($sp)
/* 43E50 80068A50 93A20138 */  lbu       $v0, 0x138($sp)
/* 43E54 80068A54 306700FF */  andi      $a3, $v1, 0xFF
/* 43E58 80068A58 10E20008 */  beq       $a3, $v0, .L80068A7C
/* 43E5C 80068A5C 27B10038 */   addiu    $s1, $sp, 0x38
/* 43E60 80068A60 A3A30138 */  sb        $v1, 0x138($sp)
/* 43E64 80068A64 02002021 */  addu      $a0, $s0, $zero
/* 43E68 80068A68 02202821 */  addu      $a1, $s1, $zero
/* 43E6C 80068A6C 0C01A7A3 */  jal       __osPfsRWInode
/* 43E70 80068A70 00003021 */   addu     $a2, $zero, $zero
/* 43E74 80068A74 1440001A */  bnez      $v0, .L80068AE0
/* 43E78 80068A78 00401821 */   addu     $v1, $v0, $zero
.L80068A7C:
/* 43E7C 80068A7C 93A2013B */  lbu       $v0, 0x13B($sp)
/* 43E80 80068A80 00021040 */  sll       $v0, $v0, 1
/* 43E84 80068A84 00511021 */  addu      $v0, $v0, $s1
/* 43E88 80068A88 94430000 */  lhu       $v1, 0x0($v0)
/* 43E8C 80068A8C A7A3013A */  sh        $v1, 0x13A($sp)
/* 43E90 80068A90 8E020060 */  lw        $v0, 0x60($s0)
/* 43E94 80068A94 0062182A */  slt       $v1, $v1, $v0
/* 43E98 80068A98 1460000D */  bnez      $v1, .L80068AD0
/* 43E9C 80068A9C 00000000 */   nop
/* 43EA0 80068AA0 93A2013A */  lbu       $v0, 0x13A($sp)
/* 43EA4 80068AA4 92030064 */  lbu       $v1, 0x64($s0)
/* 43EA8 80068AA8 0043102B */  sltu      $v0, $v0, $v1
/* 43EAC 80068AAC 10400008 */  beqz      $v0, .L80068AD0
/* 43EB0 80068AB0 00000000 */   nop
/* 43EB4 80068AB4 93A2013B */  lbu       $v0, 0x13B($sp)
/* 43EB8 80068AB8 2C430001 */  sltiu     $v1, $v0, 0x1
/* 43EBC 80068ABC 2C420080 */  sltiu     $v0, $v0, 0x80
/* 43EC0 80068AC0 38420001 */  xori      $v0, $v0, 0x1
/* 43EC4 80068AC4 00621825 */  or        $v1, $v1, $v0
/* 43EC8 80068AC8 50600005 */  beql      $v1, $zero, .L80068AE0
/* 43ECC 80068ACC 00001821 */   addu     $v1, $zero, $zero
.L80068AD0:
/* 43ED0 80068AD0 97A2013A */  lhu       $v0, 0x13A($sp)
/* 43ED4 80068AD4 14560002 */  bne       $v0, $s6, .L80068AE0
/* 43ED8 80068AD8 24030003 */   addiu    $v1, $zero, 0x3
/* 43EDC 80068ADC 24030005 */  addiu     $v1, $zero, 0x5
.L80068AE0:
/* 43EE0 80068AE0 14600040 */  bnez      $v1, .L80068BE4
/* 43EE4 80068AE4 00008821 */   addu     $s1, $zero, $zero
.L80068AE8:
/* 43EE8 80068AE8 92020065 */  lbu       $v0, 0x65($s0)
/* 43EEC 80068AEC 93A5013A */  lbu       $a1, 0x13A($sp)
/* 43EF0 80068AF0 10450006 */  beq       $v0, $a1, .L80068B0C
/* 43EF4 80068AF4 00000000 */   nop
/* 43EF8 80068AF8 0C01A5B4 */  jal       __osPfsSelectBank
/* 43EFC 80068AFC 02002021 */   addu     $a0, $s0, $zero
/* 43F00 80068B00 00401821 */  addu      $v1, $v0, $zero
/* 43F04 80068B04 1460003C */  bnez      $v1, .L80068BF8
/* 43F08 80068B08 00601021 */   addu     $v0, $v1, $zero
.L80068B0C:
/* 43F0C 80068B0C 93A2013B */  lbu       $v0, 0x13B($sp)
/* 43F10 80068B10 000210C0 */  sll       $v0, $v0, 3
/* 43F14 80068B14 00513021 */  addu      $a2, $v0, $s1
/* 43F18 80068B18 328200FF */  andi      $v0, $s4, 0xFF
/* 43F1C 80068B1C 54400008 */  bnel      $v0, $zero, .L80068B40
/* 43F20 80068B20 AFA00010 */   sw       $zero, 0x10($sp)
/* 43F24 80068B24 8E040004 */  lw        $a0, 0x4($s0)
/* 43F28 80068B28 8E050008 */  lw        $a1, 0x8($s0)
/* 43F2C 80068B2C 30C6FFFF */  andi      $a2, $a2, 0xFFFF
/* 43F30 80068B30 0C01A874 */  jal       __osContRamRead
/* 43F34 80068B34 02403821 */   addu     $a3, $s2, $zero
/* 43F38 80068B38 0801A2D6 */  j         .L80068B58
/* 43F3C 80068B3C 00401821 */   addu     $v1, $v0, $zero
.L80068B40:
/* 43F40 80068B40 8E040004 */  lw        $a0, 0x4($s0)
/* 43F44 80068B44 8E050008 */  lw        $a1, 0x8($s0)
/* 43F48 80068B48 30C6FFFF */  andi      $a2, $a2, 0xFFFF
/* 43F4C 80068B4C 0C01A8F0 */  jal       osContRamWrite
/* 43F50 80068B50 02403821 */   addu     $a3, $s2, $zero
/* 43F54 80068B54 00401821 */  addu      $v1, $v0, $zero
.L80068B58:
/* 43F58 80068B58 14600022 */  bnez      $v1, .L80068BE4
/* 43F5C 80068B5C 26520020 */   addiu    $s2, $s2, 0x20
/* 43F60 80068B60 2673FFFF */  addiu     $s3, $s3, -0x1
/* 43F64 80068B64 1E60FFB6 */  bgtz      $s3, .L80068A40
/* 43F68 80068B68 26310001 */   addiu    $s1, $s1, 0x1
/* 43F6C 80068B6C 328300FF */  andi      $v1, $s4, 0xFF
.L80068B70:
/* 43F70 80068B70 24020001 */  addiu     $v0, $zero, 0x1
/* 43F74 80068B74 1462001D */  bne       $v1, $v0, .L80068BEC
/* 43F78 80068B78 00000000 */   nop
/* 43F7C 80068B7C 93A30020 */  lbu       $v1, 0x20($sp)
/* 43F80 80068B80 30620002 */  andi      $v0, $v1, 0x2
/* 43F84 80068B84 14400019 */  bnez      $v0, .L80068BEC
/* 43F88 80068B88 34620002 */   ori      $v0, $v1, 0x2
/* 43F8C 80068B8C A3A20020 */  sb        $v0, 0x20($sp)
/* 43F90 80068B90 92020065 */  lbu       $v0, 0x65($s0)
/* 43F94 80068B94 10400006 */  beqz      $v0, .L80068BB0
/* 43F98 80068B98 02002021 */   addu     $a0, $s0, $zero
/* 43F9C 80068B9C 0C01A5B4 */  jal       __osPfsSelectBank
/* 43FA0 80068BA0 00002821 */   addu     $a1, $zero, $zero
/* 43FA4 80068BA4 00401821 */  addu      $v1, $v0, $zero
/* 43FA8 80068BA8 14600013 */  bnez      $v1, .L80068BF8
/* 43FAC 80068BAC 00000000 */   nop
.L80068BB0:
/* 43FB0 80068BB0 8E06005C */  lw        $a2, 0x5C($s0)
/* 43FB4 80068BB4 AFA00010 */  sw        $zero, 0x10($sp)
/* 43FB8 80068BB8 8E040004 */  lw        $a0, 0x4($s0)
/* 43FBC 80068BBC 8E050008 */  lw        $a1, 0x8($s0)
/* 43FC0 80068BC0 27A70018 */  addiu     $a3, $sp, 0x18
/* 43FC4 80068BC4 00D53021 */  addu      $a2, $a2, $s5
/* 43FC8 80068BC8 0C01A8F0 */  jal       osContRamWrite
/* 43FCC 80068BCC 30C6FFFF */   andi     $a2, $a2, 0xFFFF
/* 43FD0 80068BD0 00401821 */  addu      $v1, $v0, $zero
/* 43FD4 80068BD4 10600005 */  beqz      $v1, .L80068BEC
/* 43FD8 80068BD8 00000000 */   nop
/* 43FDC 80068BDC 0801A2FE */  j         .L80068BF8
/* 43FE0 80068BE0 00000000 */   nop
.L80068BE4:
/* 43FE4 80068BE4 0801A2FE */  j         .L80068BF8
/* 43FE8 80068BE8 00601021 */   addu     $v0, $v1, $zero
.L80068BEC:
/* 43FEC 80068BEC 8E040004 */  lw        $a0, 0x4($s0)
/* 43FF0 80068BF0 0C01A530 */  jal       __osPfsGetStatus
/* 43FF4 80068BF4 8E050008 */   lw       $a1, 0x8($s0)
.L80068BF8:
/* 43FF8 80068BF8 8FBF015C */  lw        $ra, 0x15C($sp)
/* 43FFC 80068BFC 8FB60158 */  lw        $s6, 0x158($sp)
/* 44000 80068C00 8FB50154 */  lw        $s5, 0x154($sp)
/* 44004 80068C04 8FB40150 */  lw        $s4, 0x150($sp)
/* 44008 80068C08 8FB3014C */  lw        $s3, 0x14C($sp)
/* 4400C 80068C0C 8FB20148 */  lw        $s2, 0x148($sp)
/* 44010 80068C10 8FB10144 */  lw        $s1, 0x144($sp)
/* 44014 80068C14 8FB00140 */  lw        $s0, 0x140($sp)
/* 44018 80068C18 03E00008 */  jr        $ra
/* 4401C 80068C1C 27BD0160 */   addiu    $sp, $sp, 0x160

### DECOMPILED C INSTRUCTIONS:

s32 osPfsReadWriteFile(OSPfs* pfs, s32 fileNo, u8 flag, int offset, int size, u8* data) {
    s32 ret;
    __OSDir dir;
    __OSInode inode;
    __OSInodeUnit curPage;
    s32 curBlock;
    s32 blockSize;
    u8* buffer;
    u8 bank;
    u16 blockno;

    if ((fileNo >= pfs->dir_size) || (fileNo < 0)) {
        return PFS_ERR_INVALID;
    }
    if ((size <= 0) || ((size % BLOCKSIZE) != 0)) {
        return PFS_ERR_INVALID;
    }
    if ((offset < 0) || ((offset % BLOCKSIZE) != 0)) {
        return PFS_ERR_INVALID;
    }
    if (!(pfs->status & PFS_INITIALIZED)) {
        return PFS_ERR_INVALID;
    }
    if (__osCheckId(pfs) == PFS_ERR_NEW_PACK) {
        return PFS_ERR_NEW_PACK;
    }
    if (pfs->activebank != 0 && (ret = __osPfsSelectBank(pfs, 0)) != 0) {
        return ret;
    }
    if ((ret = __osContRamRead(pfs->queue, pfs->channel, pfs->dir_table + fileNo, (u8*)&dir)) != 0) {
        return ret;
    }
    if ((dir.company_code == 0) || (dir.game_code == 0)) {
        return PFS_ERR_INVALID;
    }
    if (!CHECK_IPAGE(dir.start_page, *pfs)) {
        if (dir.start_page.ipage == PFS_EOF) {
            return PFS_ERR_INVALID;
        }
        return PFS_ERR_INCONSISTENT;
    }
    if ((flag == PFS_READ) && ((dir.status & PFS_WRITTEN) == 0)) {
        return PFS_ERR_BAD_DATA;
    }

    bank = 255;
    curBlock = offset / BLOCKSIZE;
    curPage = dir.start_page;

    while (curBlock >= 8) {
        if ((ret = __osPfsGetNextPage(pfs, &bank, &inode, &curPage)) != 0) {
            return ret;
        }
        curBlock -= 8;
    }

    blockSize = size / BLOCKSIZE;
    buffer = data;

    while (blockSize > 0) {
        if (curBlock == 8) {
            if ((ret = __osPfsGetNextPage(pfs, &bank, &inode, &curPage)) != 0) {
                return ret;
            }
            curBlock = 0;
        }
        if (pfs->activebank != curPage.inode_t.bank && (ret = __osPfsSelectBank(pfs, curPage.inode_t.bank)) != 0) {
            return ret;
        }

        blockno = curPage.inode_t.page * PFS_ONE_PAGE + curBlock;
        if (flag == PFS_READ) {
            ret = __osContRamRead(pfs->queue, pfs->channel, blockno, buffer);
        } else {
            ret = __osContRamWrite(pfs->queue, pfs->channel, blockno, buffer, 0);
        }
        if (ret != 0) {
            return ret;
        }

        buffer += BLOCKSIZE;
        curBlock++;
        blockSize--;
    }

    if (flag == PFS_WRITE && !(dir.status & PFS_WRITTEN)) {
        dir.status |= PFS_WRITTEN;
        if (pfs->activebank != 0 && (ret = __osPfsSelectBank(pfs, 0)) != 0) {
            return ret;
        }
        if ((ret = __osContRamWrite(pfs->queue, pfs->channel, pfs->dir_table + fileNo, (u8*)&dir, 0)) != 0) {
            return ret;
        }
    }

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


### RAW ASSEMBLY INSTRUCTIONS:

glabel aura_update
/* 3773E8 E0076378 27BDFFE8 */  addiu     $sp, $sp, -0x18
/* 3773EC E007637C AFBF0010 */  sw        $ra, 0x10($sp)
/* 3773F0 E0076380 8C830000 */  lw        $v1, 0x0($a0)
/* 3773F4 E0076384 8C85000C */  lw        $a1, 0xC($a0)
/* 3773F8 E0076388 30620010 */  andi      $v0, $v1, 0x10
/* 3773FC E007638C 10400005 */  beqz      $v0, .LE00763A4
/* 377400 E0076390 2402FFEF */   addiu    $v0, $zero, -0x11
/* 377404 E0076394 00621024 */  and       $v0, $v1, $v0
/* 377408 E0076398 AC820000 */  sw        $v0, 0x0($a0)
/* 37740C E007639C 24020005 */  addiu     $v0, $zero, 0x5
/* 377410 E00763A0 ACA2002C */  sw        $v0, 0x2C($a1)
.LE00763A4:
/* 377414 E00763A4 3C030004 */  lui       $v1, (0x4F1A0 >> 16)
/* 377418 E00763A8 8CA20030 */  lw        $v0, 0x30($a1)
/* 37741C E00763AC 3463F1A0 */  ori       $v1, $v1, (0x4F1A0 & 0xFFFF)
/* 377420 E00763B0 24420001 */  addiu     $v0, $v0, 0x1
/* 377424 E00763B4 0062182A */  slt       $v1, $v1, $v0
/* 377428 E00763B8 10600003 */  beqz      $v1, .LE00763C8
/* 37742C E00763BC ACA20030 */   sw       $v0, 0x30($a1)
/* 377430 E00763C0 24020100 */  addiu     $v0, $zero, 0x100
/* 377434 E00763C4 ACA20030 */  sw        $v0, 0x30($a1)
.LE00763C8:
/* 377438 E00763C8 8CA3002C */  lw        $v1, 0x2C($a1)
/* 37743C E00763CC 2862000B */  slti      $v0, $v1, 0xB
/* 377440 E00763D0 10400002 */  beqz      $v0, .LE00763DC
/* 377444 E00763D4 2462FFFF */   addiu    $v0, $v1, -0x1
/* 377448 E00763D8 ACA2002C */  sw        $v0, 0x2C($a1)
.LE00763DC:
/* 37744C E00763DC 8CA2002C */  lw        $v0, 0x2C($a1)
/* 377450 E00763E0 04410005 */  bgez      $v0, .LE00763F8
/* 377454 E00763E4 0040382D */   daddu    $a3, $v0, $zero
/* 377458 E00763E8 0C080128 */  jal       shim_remove_effect
/* 37745C E00763EC 00000000 */   nop
/* 377460 E00763F0 0801D9FF */  j         .LE00767FC
/* 377464 E00763F4 00000000 */   nop
.LE00763F8:
/* 377468 E00763F8 8CA60000 */  lw        $a2, 0x0($a1)
/* 37746C E00763FC 8CA40030 */  lw        $a0, 0x30($a1)
/* 377470 E0076400 28C20002 */  slti      $v0, $a2, 0x2
/* 377474 E0076404 10400015 */  beqz      $v0, .LE007645C
/* 377478 E0076408 2882000B */   slti     $v0, $a0, 0xB
/* 37747C E007640C 1040001E */  beqz      $v0, .LE0076488
/* 377480 E0076410 24020080 */   addiu    $v0, $zero, 0x80
/* 377484 E0076414 8CA30028 */  lw        $v1, 0x28($a1)
/* 377488 E0076418 3C013FE0 */  lui       $at, (0x3FE00000 >> 16)
/* 37748C E007641C 44810800 */  mtc1      $at, $f1
/* 377490 E0076420 44800000 */  mtc1      $zero, $f0
/* 377494 E0076424 00431023 */  subu      $v0, $v0, $v1
/* 377498 E0076428 44821000 */  mtc1      $v0, $f2
/* 37749C E007642C 00000000 */  nop
/* 3774A0 E0076430 468010A1 */  cvt.d.w   $f2, $f2
/* 3774A4 E0076434 46201082 */  mul.d     $f2, $f2, $f0
/* 3774A8 E0076438 00000000 */  nop
/* 3774AC E007643C 44830000 */  mtc1      $v1, $f0
/* 3774B0 E0076440 00000000 */  nop
/* 3774B4 E0076444 46800021 */  cvt.d.w   $f0, $f0
/* 3774B8 E0076448 46220000 */  add.d     $f0, $f0, $f2
/* 3774BC E007644C 4620048D */  trunc.w.d $f18, $f0
/* 3774C0 E0076450 E4B20028 */  swc1      $f18, 0x28($a1)
/* 3774C4 E0076454 0801D923 */  j         .LE007648C
/* 3774C8 E0076458 28E2000A */   slti     $v0, $a3, 0xA
.LE007645C:
/* 3774CC E007645C 1040000A */  beqz      $v0, .LE0076488
/* 3774D0 E0076460 3C036666 */   lui      $v1, (0x66666667 >> 16)
/* 3774D4 E0076464 34636667 */  ori       $v1, $v1, (0x66666667 & 0xFFFF)
/* 3774D8 E0076468 00041200 */  sll       $v0, $a0, 8
/* 3774DC E007646C 00441023 */  subu      $v0, $v0, $a0
/* 3774E0 E0076470 00430018 */  mult      $v0, $v1
/* 3774E4 E0076474 000217C3 */  sra       $v0, $v0, 31
/* 3774E8 E0076478 00004010 */  mfhi      $t0
/* 3774EC E007647C 00081883 */  sra       $v1, $t0, 2
/* 3774F0 E0076480 00621823 */  subu      $v1, $v1, $v0
/* 3774F4 E0076484 ACA30028 */  sw        $v1, 0x28($a1)
.LE0076488:
/* 3774F8 E0076488 28E2000A */  slti      $v0, $a3, 0xA
.LE007648C:
/* 3774FC E007648C 1040000A */  beqz      $v0, .LE00764B8
/* 377500 E0076490 00000000 */   nop
/* 377504 E0076494 3C013FE0 */  lui       $at, (0x3FE00000 >> 16)
/* 377508 E0076498 44811800 */  mtc1      $at, $f3
/* 37750C E007649C 44801000 */  mtc1      $zero, $f2
/* 377510 E00764A0 C4A00028 */  lwc1      $f0, 0x28($a1)
/* 377514 E00764A4 46800021 */  cvt.d.w   $f0, $f0
/* 377518 E00764A8 46220002 */  mul.d     $f0, $f0, $f2
/* 37751C E00764AC 00000000 */  nop
/* 377520 E00764B0 4620048D */  trunc.w.d $f18, $f0
/* 377524 E00764B4 E4B20028 */  swc1      $f18, 0x28($a1)
.LE00764B8:
/* 377528 E00764B8 14C0002E */  bnez      $a2, .LE0076574
/* 37752C E00764BC 00000000 */   nop
/* 377530 E00764C0 C4AE0038 */  lwc1      $f14, 0x38($a1)
/* 377534 E00764C4 C4AA003C */  lwc1      $f10, 0x3C($a1)
/* 377538 E00764C8 460E5281 */  sub.s     $f10, $f10, $f14
/* 37753C E00764CC 3C01E007 */  lui       $at, (0xE0076EE8 >> 16)
/* 377540 E00764D0 D4206EE8 */  ldc1      $f0, (0xE0076EE8 & 0xFFFF)($at)
/* 377544 E00764D4 460052A1 */  cvt.d.s   $f10, $f10
/* 377548 E00764D8 46205282 */  mul.d     $f10, $f10, $f0
/* 37754C E00764DC 00000000 */  nop
/* 377550 E00764E0 C4AC0044 */  lwc1      $f12, 0x44($a1)
/* 377554 E00764E4 C4A40048 */  lwc1      $f4, 0x48($a1)
/* 377558 E00764E8 460C2101 */  sub.s     $f4, $f4, $f12
/* 37755C E00764EC 46002121 */  cvt.d.s   $f4, $f4
/* 377560 E00764F0 46202102 */  mul.d     $f4, $f4, $f0
/* 377564 E00764F4 00000000 */  nop
/* 377568 E00764F8 C4A8001C */  lwc1      $f8, 0x1C($a1)
/* 37756C E00764FC C4A60024 */  lwc1      $f6, 0x24($a1)
/* 377570 E0076500 46083181 */  sub.s     $f6, $f6, $f8
/* 377574 E0076504 3C01E007 */  lui       $at, (0xE0076EF0 >> 16)
/* 377578 E0076508 D4306EF0 */  ldc1      $f16, (0xE0076EF0 & 0xFFFF)($at)
/* 37757C E007650C 460031A1 */  cvt.d.s   $f6, $f6
/* 377580 E0076510 46303182 */  mul.d     $f6, $f6, $f16
/* 377584 E0076514 00000000 */  nop
/* 377588 E0076518 C4A20020 */  lwc1      $f2, 0x20($a1)
/* 37758C E007651C C4A00024 */  lwc1      $f0, 0x24($a1)
/* 377590 E0076520 46020001 */  sub.s     $f0, $f0, $f2
/* 377594 E0076524 46000021 */  cvt.d.s   $f0, $f0
/* 377598 E0076528 46300002 */  mul.d     $f0, $f0, $f16
/* 37759C E007652C 00000000 */  nop
/* 3775A0 E0076530 460073A1 */  cvt.d.s   $f14, $f14
/* 3775A4 E0076534 462A7380 */  add.d     $f14, $f14, $f10
/* 3775A8 E0076538 46006321 */  cvt.d.s   $f12, $f12
/* 3775AC E007653C 46246300 */  add.d     $f12, $f12, $f4
/* 3775B0 E0076540 46004221 */  cvt.d.s   $f8, $f8
/* 3775B4 E0076544 460010A1 */  cvt.d.s   $f2, $f2
/* 3775B8 E0076548 46264200 */  add.d     $f8, $f8, $f6
/* 3775BC E007654C 462073A0 */  cvt.s.d   $f14, $f14
/* 3775C0 E0076550 46206320 */  cvt.s.d   $f12, $f12
/* 3775C4 E0076554 46204220 */  cvt.s.d   $f8, $f8
/* 3775C8 E0076558 E4AE0038 */  swc1      $f14, 0x38($a1)
/* 3775CC E007655C 46201080 */  add.d     $f2, $f2, $f0
/* 3775D0 E0076560 E4AC0044 */  swc1      $f12, 0x44($a1)
/* 3775D4 E0076564 E4A8001C */  swc1      $f8, 0x1C($a1)
/* 3775D8 E0076568 462010A0 */  cvt.s.d   $f2, $f2
/* 3775DC E007656C 0801D987 */  j         .LE007661C
/* 3775E0 E0076570 E4A20020 */   swc1     $f2, 0x20($a1)
.LE0076574:
/* 3775E4 E0076574 C4AE0038 */  lwc1      $f14, 0x38($a1)
/* 3775E8 E0076578 C4AA003C */  lwc1      $f10, 0x3C($a1)
/* 3775EC E007657C 460E5281 */  sub.s     $f10, $f10, $f14
/* 3775F0 E0076580 3C01E007 */  lui       $at, (0xE0076EF8 >> 16)
/* 3775F4 E0076584 D4306EF8 */  ldc1      $f16, (0xE0076EF8 & 0xFFFF)($at)
/* 3775F8 E0076588 460052A1 */  cvt.d.s   $f10, $f10
/* 3775FC E007658C 46305282 */  mul.d     $f10, $f10, $f16
/* 377600 E0076590 00000000 */  nop
/* 377604 E0076594 C4AC0044 */  lwc1      $f12, 0x44($a1)
/* 377608 E0076598 C4A20048 */  lwc1      $f2, 0x48($a1)
/* 37760C E007659C 460C1081 */  sub.s     $f2, $f2, $f12
/* 377610 E00765A0 460010A1 */  cvt.d.s   $f2, $f2
/* 377614 E00765A4 46301082 */  mul.d     $f2, $f2, $f16
/* 377618 E00765A8 00000000 */  nop
/* 37761C E00765AC C4A80050 */  lwc1      $f8, 0x50($a1)
/* 377620 E00765B0 C4A40054 */  lwc1      $f4, 0x54($a1)
/* 377624 E00765B4 46082101 */  sub.s     $f4, $f4, $f8
/* 377628 E00765B8 46002121 */  cvt.d.s   $f4, $f4
/* 37762C E00765BC 46302102 */  mul.d     $f4, $f4, $f16
/* 377630 E00765C0 00000000 */  nop
/* 377634 E00765C4 C4A6005C */  lwc1      $f6, 0x5C($a1)
/* 377638 E00765C8 C4A00060 */  lwc1      $f0, 0x60($a1)
/* 37763C E00765CC 46060001 */  sub.s     $f0, $f0, $f6
/* 377640 E00765D0 46000021 */  cvt.d.s   $f0, $f0
/* 377644 E00765D4 46300002 */  mul.d     $f0, $f0, $f16
/* 377648 E00765D8 00000000 */  nop
/* 37764C E00765DC 460073A1 */  cvt.d.s   $f14, $f14
/* 377650 E00765E0 462A7380 */  add.d     $f14, $f14, $f10
/* 377654 E00765E4 46006321 */  cvt.d.s   $f12, $f12
/* 377658 E00765E8 46226300 */  add.d     $f12, $f12, $f2
/* 37765C E00765EC 46004221 */  cvt.d.s   $f8, $f8
/* 377660 E00765F0 46244200 */  add.d     $f8, $f8, $f4
/* 377664 E00765F4 460031A1 */  cvt.d.s   $f6, $f6
/* 377668 E00765F8 46203180 */  add.d     $f6, $f6, $f0
/* 37766C E00765FC 462073A0 */  cvt.s.d   $f14, $f14
/* 377670 E0076600 46206320 */  cvt.s.d   $f12, $f12
/* 377674 E0076604 46204220 */  cvt.s.d   $f8, $f8
/* 377678 E0076608 462031A0 */  cvt.s.d   $f6, $f6
/* 37767C E007660C E4AE0038 */  swc1      $f14, 0x38($a1)
/* 377680 E0076610 E4AC0044 */  swc1      $f12, 0x44($a1)
/* 377684 E0076614 E4A80050 */  swc1      $f8, 0x50($a1)
/* 377688 E0076618 E4A6005C */  swc1      $f6, 0x5C($a1)
.LE007661C:
/* 37768C E007661C C4A00034 */  lwc1      $f0, 0x34($a1)
/* 377690 E0076620 C4A20038 */  lwc1      $f2, 0x38($a1)
/* 377694 E0076624 46020080 */  add.s     $f2, $f0, $f2
/* 377698 E0076628 44800000 */  mtc1      $zero, $f0
/* 37769C E007662C 00000000 */  nop
/* 3776A0 E0076630 4600103C */  c.lt.s    $f2, $f0
/* 3776A4 E0076634 00000000 */  nop
/* 3776A8 E0076638 45000005 */  bc1f      .LE0076650
/* 3776AC E007663C E4A20034 */   swc1     $f2, 0x34($a1)
/* 3776B0 E0076640 3C014280 */  lui       $at, (0x42800000 >> 16)
/* 3776B4 E0076644 44810000 */  mtc1      $at, $f0
/* 3776B8 E0076648 0801D99C */  j         .LE0076670
/* 3776BC E007664C 46001000 */   add.s    $f0, $f2, $f0
.LE0076650:
/* 3776C0 E0076650 3C014280 */  lui       $at, (0x42800000 >> 16)
/* 3776C4 E0076654 44810000 */  mtc1      $at, $f0
/* 3776C8 E0076658 00000000 */  nop
/* 3776CC E007665C 4602003C */  c.lt.s    $f0, $f2
/* 3776D0 E0076660 00000000 */  nop
/* 3776D4 E0076664 45000003 */  bc1f      .LE0076674
/* 3776D8 E0076668 00000000 */   nop
/* 3776DC E007666C 46001001 */  sub.s     $f0, $f2, $f0
.LE0076670:
/* 3776E0 E0076670 E4A00034 */  swc1      $f0, 0x34($a1)
.LE0076674:
/* 3776E4 E0076674 C4A00040 */  lwc1      $f0, 0x40($a1)
/* 3776E8 E0076678 C4A20044 */  lwc1      $f2, 0x44($a1)
/* 3776EC E007667C 46020080 */  add.s     $f2, $f0, $f2
/* 3776F0 E0076680 44800000 */  mtc1      $zero, $f0
/* 3776F4 E0076684 00000000 */  nop
/* 3776F8 E0076688 4600103C */  c.lt.s    $f2, $f0
/* 3776FC E007668C 00000000 */  nop
/* 377700 E0076690 45000005 */  bc1f      .LE00766A8
/* 377704 E0076694 E4A20040 */   swc1     $f2, 0x40($a1)
/* 377708 E0076698 3C014300 */  lui       $at, (0x43000000 >> 16)
/* 37770C E007669C 44810000 */  mtc1      $at, $f0
/* 377710 E00766A0 0801D9B2 */  j         .LE00766C8
/* 377714 E00766A4 46001000 */   add.s    $f0, $f2, $f0
.LE00766A8:
/* 377718 E00766A8 3C014300 */  lui       $at, (0x43000000 >> 16)
/* 37771C E00766AC 44810000 */  mtc1      $at, $f0
/* 377720 E00766B0 00000000 */  nop
/* 377724 E00766B4 4602003C */  c.lt.s    $f0, $f2
/* 377728 E00766B8 00000000 */  nop
/* 37772C E00766BC 45000003 */  bc1f      .LE00766CC
/* 377730 E00766C0 00000000 */   nop
/* 377734 E00766C4 46001001 */  sub.s     $f0, $f2, $f0
.LE00766C8:
/* 377738 E00766C8 E4A00040 */  swc1      $f0, 0x40($a1)
.LE00766CC:
/* 37773C E00766CC C4A0004C */  lwc1      $f0, 0x4C($a1)
/* 377740 E00766D0 C4A20050 */  lwc1      $f2, 0x50($a1)
/* 377744 E00766D4 46020080 */  add.s     $f2, $f0, $f2
/* 377748 E00766D8 44800000 */  mtc1      $zero, $f0
/* 37774C E00766DC 00000000 */  nop
/* 377750 E00766E0 4600103C */  c.lt.s    $f2, $f0
/* 377754 E00766E4 00000000 */  nop
/* 377758 E00766E8 45000005 */  bc1f      .LE0076700
/* 37775C E00766EC E4A2004C */   swc1     $f2, 0x4C($a1)
/* 377760 E00766F0 3C014280 */  lui       $at, (0x42800000 >> 16)
/* 377764 E00766F4 44810000 */  mtc1      $at, $f0
/* 377768 E00766F8 0801D9C8 */  j         .LE0076720
/* 37776C E00766FC 46001000 */   add.s    $f0, $f2, $f0
.LE0076700:
/* 377770 E0076700 3C014280 */  lui       $at, (0x42800000 >> 16)
/* 377774 E0076704 44810000 */  mtc1      $at, $f0
/* 377778 E0076708 00000000 */  nop
/* 37777C E007670C 4602003C */  c.lt.s    $f0, $f2
/* 377780 E0076710 00000000 */  nop
/* 377784 E0076714 45000003 */  bc1f      .LE0076724
/* 377788 E0076718 00000000 */   nop
/* 37778C E007671C 46001001 */  sub.s     $f0, $f2, $f0
.LE0076720:
/* 377790 E0076720 E4A0004C */  swc1      $f0, 0x4C($a1)
.LE0076724:
/* 377794 E0076724 C4A00058 */  lwc1      $f0, 0x58($a1)
/* 377798 E0076728 C4A2005C */  lwc1      $f2, 0x5C($a1)
/* 37779C E007672C 46020080 */  add.s     $f2, $f0, $f2
/* 3777A0 E0076730 44800000 */  mtc1      $zero, $f0
/* 3777A4 E0076734 00000000 */  nop
/* 3777A8 E0076738 4600103C */  c.lt.s    $f2, $f0
/* 3777AC E007673C 00000000 */  nop
/* 3777B0 E0076740 45000005 */  bc1f      .LE0076758
/* 3777B4 E0076744 E4A20058 */   swc1     $f2, 0x58($a1)
/* 3777B8 E0076748 3C014300 */  lui       $at, (0x43000000 >> 16)
/* 3777BC E007674C 44810000 */  mtc1      $at, $f0
/* 3777C0 E0076750 0801D9DE */  j         .LE0076778
/* 3777C4 E0076754 46001000 */   add.s    $f0, $f2, $f0
.LE0076758:
/* 3777C8 E0076758 3C014300 */  lui       $at, (0x43000000 >> 16)
/* 3777CC E007675C 44810000 */  mtc1      $at, $f0
/* 3777D0 E0076760 00000000 */  nop
/* 3777D4 E0076764 4602003C */  c.lt.s    $f0, $f2
/* 3777D8 E0076768 00000000 */  nop
/* 3777DC E007676C 45000003 */  bc1f      .LE007677C
/* 3777E0 E0076770 00000000 */   nop
/* 3777E4 E0076774 46001001 */  sub.s     $f0, $f2, $f0
.LE0076778:
/* 3777E8 E0076778 E4A00058 */  swc1      $f0, 0x58($a1)
.LE007677C:
/* 3777EC E007677C C4AA0010 */  lwc1      $f10, 0x10($a1)
/* 3777F0 E0076780 C4A60004 */  lwc1      $f6, 0x4($a1)
/* 3777F4 E0076784 460A3181 */  sub.s     $f6, $f6, $f10
/* 3777F8 E0076788 3C01E007 */  lui       $at, (0xE0076F00 >> 16)
/* 3777FC E007678C D42C6F00 */  ldc1      $f12, (0xE0076F00 & 0xFFFF)($at)
/* 377800 E0076790 460031A1 */  cvt.d.s   $f6, $f6
/* 377804 E0076794 462C3182 */  mul.d     $f6, $f6, $f12
/* 377808 E0076798 00000000 */  nop
/* 37780C E007679C C4A80014 */  lwc1      $f8, 0x14($a1)
/* 377810 E00767A0 C4A20008 */  lwc1      $f2, 0x8($a1)
/* 377814 E00767A4 46081081 */  sub.s     $f2, $f2, $f8
/* 377818 E00767A8 460010A1 */  cvt.d.s   $f2, $f2
/* 37781C E00767AC 462C1082 */  mul.d     $f2, $f2, $f12
/* 377820 E00767B0 00000000 */  nop
/* 377824 E00767B4 C4A40018 */  lwc1      $f4, 0x18($a1)
/* 377828 E00767B8 C4A0000C */  lwc1      $f0, 0xC($a1)
/* 37782C E00767BC 46040001 */  sub.s     $f0, $f0, $f4
/* 377830 E00767C0 46000021 */  cvt.d.s   $f0, $f0
/* 377834 E00767C4 462C0002 */  mul.d     $f0, $f0, $f12
/* 377838 E00767C8 00000000 */  nop
/* 37783C E00767CC 460052A1 */  cvt.d.s   $f10, $f10
/* 377840 E00767D0 46265280 */  add.d     $f10, $f10, $f6
/* 377844 E00767D4 46004221 */  cvt.d.s   $f8, $f8
/* 377848 E00767D8 46224200 */  add.d     $f8, $f8, $f2
/* 37784C E00767DC 46002121 */  cvt.d.s   $f4, $f4
/* 377850 E00767E0 46202100 */  add.d     $f4, $f4, $f0
/* 377854 E00767E4 462052A0 */  cvt.s.d   $f10, $f10
/* 377858 E00767E8 46204220 */  cvt.s.d   $f8, $f8
/* 37785C E00767EC 46202120 */  cvt.s.d   $f4, $f4
/* 377860 E00767F0 E4AA0010 */  swc1      $f10, 0x10($a1)
/* 377864 E00767F4 E4A80014 */  swc1      $f8, 0x14($a1)
/* 377868 E00767F8 E4A40018 */  swc1      $f4, 0x18($a1)
.LE00767FC:
/* 37786C E00767FC 8FBF0010 */  lw        $ra, 0x10($sp)
/* 377870 E0076800 03E00008 */  jr        $ra
/* 377874 E0076804 27BD0018 */   addiu    $sp, $sp, 0x18

### DECOMPILED C INSTRUCTIONS:

void aura_update(EffectInstance* effect) {
    AuraFXData* data;
    s32 type;
    s32 fadeTime;
    s32 lifeTime;

    data = effect->data.aura;
    if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
        effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
        data->fadeTime = 5;
    }

    data->lifeTime++;
    if (data->lifeTime > 90*60*60) {
        data->lifeTime = 256;
    }

    if (data->fadeTime <= 10) {
        data->fadeTime--;
    }

    if (data->fadeTime < 0) {
        shim_remove_effect(effect);
        return;
    }

    type = data->type;
    fadeTime = data->fadeTime;
    lifeTime = data->lifeTime;

    if (type < 2) {
        if (lifeTime <= 10) {
            data->primA += (128 - data->primA) * 0.5;
        }
    } else {
        if (lifeTime <= 10) {
            data->primA = (lifeTime * 0xFF) / 10;
        }
    }

    if (fadeTime < 10) {
        data->primA *= 0.5;
    }

    if (type == 0) {
        data->unk_38 += (data->unk_3C - data->unk_38) * 0.02;
        data->unk_44 += (data->unk_48 - data->unk_44) * 0.02;
        data->scale.x += (data->unk_24 - data->scale.x) * 0.04;
        data->scale.y += (data->unk_24 - data->scale.y) * 0.04;
    } else {
        data->unk_38 += (data->unk_3C - data->unk_38) * 0.02;
        data->unk_44 += (data->unk_48 - data->unk_44) * 0.02;
        data->unk_50 += (data->unk_54 - data->unk_50) * 0.02;
        data->unk_5C += (data->unk_60 - data->unk_5C) * 0.02;
    }

    data->unk_34 += data->unk_38;
    if (data->unk_34 < 0.0f) {
        data->unk_34 += 64.0f;
    } else if (data->unk_34 > 64.0f) {
        data->unk_34 -= 64.0f;
    }

    data->unk_40 += data->unk_44;
    if (data->unk_40 < 0.0f) {
        data->unk_40 += 128.0f;
    } else if (data->unk_40 > 128.0f) {
        data->unk_40 -= 128.0f;
    }

    data->unk_4C += data->unk_50;
    if (data->unk_4C < 0.0f) {
        data->unk_4C += 64.0f;
    } else if (data->unk_4C > 64.0f) {
        data->unk_4C -= 64.0f;
    }

    data->unk_58 += data->unk_5C;
    if (data->unk_58 < 0.0f) {
        data->unk_58 += 128.0f;
    } else if (data->unk_58 > 128.0f) {
        data->unk_58 -= 128.0f;
    }

    data->posB.x += (data->posA.x - data->posB.x) * 0.1;
    data->posB.y += (data->posA.y - data->posB.y) * 0.1;
    data->posB.z += (data->posA.z - data->posB.z) * 0.1;
}