### RAW ASSEMBLY INSTRUCTIONS:

glabel start_child_script
/* E8178 802C37C8 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* E817C 802C37CC AFB10014 */  sw        $s1, 0x14($sp)
/* E8180 802C37D0 0080882D */  daddu     $s1, $a0, $zero
/* E8184 802C37D4 AFB20018 */  sw        $s2, 0x18($sp)
/* E8188 802C37D8 00A0902D */  daddu     $s2, $a1, $zero
/* E818C 802C37DC AFB40020 */  sw        $s4, 0x20($sp)
/* E8190 802C37E0 00C0A02D */  daddu     $s4, $a2, $zero
/* E8194 802C37E4 3C04802E */  lui       $a0, %hi(gCurrentScriptListPtr)
/* E8198 802C37E8 8C84A890 */  lw        $a0, %lo(gCurrentScriptListPtr)($a0)
/* E819C 802C37EC 0000182D */  daddu     $v1, $zero, $zero
/* E81A0 802C37F0 AFBF0024 */  sw        $ra, 0x24($sp)
/* E81A4 802C37F4 AFB3001C */  sw        $s3, 0x1C($sp)
/* E81A8 802C37F8 AFB00010 */  sw        $s0, 0x10($sp)
.L802C37FC:
/* E81AC 802C37FC 8C820000 */  lw        $v0, 0x0($a0)
/* E81B0 802C3800 10400006 */  beqz      $v0, .L802C381C
/* E81B4 802C3804 28620080 */   slti     $v0, $v1, 0x80
/* E81B8 802C3808 24630001 */  addiu     $v1, $v1, 0x1
/* E81BC 802C380C 28620080 */  slti      $v0, $v1, 0x80
/* E81C0 802C3810 1440FFFA */  bnez      $v0, .L802C37FC
/* E81C4 802C3814 24840004 */   addiu    $a0, $a0, 0x4
/* E81C8 802C3818 28620080 */  slti      $v0, $v1, 0x80
.L802C381C:
/* E81CC 802C381C 54400003 */  bnel      $v0, $zero, .L802C382C
/* E81D0 802C3820 24040168 */   addiu    $a0, $zero, 0x168
.L802C3824:
/* E81D4 802C3824 080B0E09 */  j         .L802C3824
/* E81D8 802C3828 00000000 */   nop
.L802C382C:
/* E81DC 802C382C 0C00AB39 */  jal       heap_malloc
/* E81E0 802C3830 0060982D */   daddu    $s3, $v1, $zero
/* E81E4 802C3834 00132080 */  sll       $a0, $s3, 2
/* E81E8 802C3838 3C03802E */  lui       $v1, %hi(gCurrentScriptListPtr)
/* E81EC 802C383C 8C63A890 */  lw        $v1, %lo(gCurrentScriptListPtr)($v1)
/* E81F0 802C3840 3C05802E */  lui       $a1, %hi(gNumScripts)
/* E81F4 802C3844 24A5A488 */  addiu     $a1, $a1, %lo(gNumScripts)
/* E81F8 802C3848 00832021 */  addu      $a0, $a0, $v1
/* E81FC 802C384C 8CA30000 */  lw        $v1, 0x0($a1)
/* E8200 802C3850 0040802D */  daddu     $s0, $v0, $zero
/* E8204 802C3854 AC900000 */  sw        $s0, 0x0($a0)
/* E8208 802C3858 24630001 */  addiu     $v1, $v1, 0x1
/* E820C 802C385C 16000003 */  bnez      $s0, .L802C386C
/* E8210 802C3860 ACA30000 */   sw       $v1, 0x0($a1)
.L802C3864:
/* E8214 802C3864 080B0E19 */  j         .L802C3864
/* E8218 802C3868 00000000 */   nop
.L802C386C:
/* E821C 802C386C 92220000 */  lbu       $v0, 0x0($s1)
/* E8220 802C3870 AE300068 */  sw        $s0, 0x68($s1)
/* E8224 802C3874 34420010 */  ori       $v0, $v0, 0x10
/* E8228 802C3878 A2220000 */  sb        $v0, 0x0($s1)
/* E822C 802C387C 36820001 */  ori       $v0, $s4, 0x1
/* E8230 802C3880 A2020000 */  sb        $v0, 0x0($s0)
/* E8234 802C3884 AE120008 */  sw        $s2, 0x8($s0)
/* E8238 802C3888 AE12015C */  sw        $s2, 0x15C($s0)
/* E823C 802C388C AE120164 */  sw        $s2, 0x164($s0)
/* E8240 802C3890 A2000002 */  sb        $zero, 0x2($s0)
/* E8244 802C3894 AE000060 */  sw        $zero, 0x60($s0)
/* E8248 802C3898 AE110064 */  sw        $s1, 0x64($s0)
/* E824C 802C389C AE000068 */  sw        $zero, 0x68($s0)
/* E8250 802C38A0 AE00006C */  sw        $zero, 0x6C($s0)
/* E8254 802C38A4 92220003 */  lbu       $v0, 0x3($s1)
/* E8258 802C38A8 3C04802E */  lui       $a0, %hi(gStaticScriptCounter)
/* E825C 802C38AC 24849CA0 */  addiu     $a0, $a0, %lo(gStaticScriptCounter)
/* E8260 802C38B0 24420001 */  addiu     $v0, $v0, 0x1
/* E8264 802C38B4 A2020003 */  sb        $v0, 0x3($s0)
/* E8268 802C38B8 8C820000 */  lw        $v0, 0x0($a0)
/* E826C 802C38BC AE020144 */  sw        $v0, 0x144($s0)
/* E8270 802C38C0 8E230148 */  lw        $v1, 0x148($s1)
/* E8274 802C38C4 24420001 */  addiu     $v0, $v0, 0x1
/* E8278 802C38C8 AC820000 */  sw        $v0, 0x0($a0)
/* E827C 802C38CC AE030148 */  sw        $v1, 0x148($s0)
/* E8280 802C38D0 8E23014C */  lw        $v1, 0x14C($s1)
/* E8284 802C38D4 2402FFFF */  addiu     $v0, $zero, -0x1
/* E8288 802C38D8 A2020006 */  sb        $v0, 0x6($s0)
/* E828C 802C38DC A2020007 */  sb        $v0, 0x7($s0)
/* E8290 802C38E0 AE03014C */  sw        $v1, 0x14C($s0)
/* E8294 802C38E4 92220004 */  lbu       $v0, 0x4($s1)
/* E8298 802C38E8 0220282D */  daddu     $a1, $s1, $zero
/* E829C 802C38EC AE000160 */  sw        $zero, 0x160($s0)
/* E82A0 802C38F0 A2020004 */  sb        $v0, 0x4($s0)
/* E82A4 802C38F4 8E22013C */  lw        $v0, 0x13C($s1)
/* E82A8 802C38F8 3C01802E */  lui       $at, %hi(gGlobalTimeSpace)
/* E82AC 802C38FC C4209CA8 */  lwc1      $f0, %lo(gGlobalTimeSpace)($at)
/* E82B0 802C3900 0200202D */  daddu     $a0, $s0, $zero
/* E82B4 802C3904 AE02013C */  sw        $v0, 0x13C($s0)
/* E82B8 802C3908 8E220140 */  lw        $v0, 0x140($s1)
/* E82BC 802C390C 0000182D */  daddu     $v1, $zero, $zero
/* E82C0 802C3910 E6000150 */  swc1      $f0, 0x150($s0)
/* E82C4 802C3914 AE000154 */  sw        $zero, 0x154($s0)
/* E82C8 802C3918 AE020140 */  sw        $v0, 0x140($s0)
/* E82CC 802C391C AE000158 */  sw        $zero, 0x158($s0)
.L802C3920:
/* E82D0 802C3920 8CA20084 */  lw        $v0, 0x84($a1)
/* E82D4 802C3924 24A50004 */  addiu     $a1, $a1, 0x4
/* E82D8 802C3928 24630001 */  addiu     $v1, $v1, 0x1
/* E82DC 802C392C AC820084 */  sw        $v0, 0x84($a0)
/* E82E0 802C3930 28620010 */  slti      $v0, $v1, 0x10
/* E82E4 802C3934 1440FFFA */  bnez      $v0, .L802C3920
/* E82E8 802C3938 24840004 */   addiu    $a0, $a0, 0x4
/* E82EC 802C393C 0000182D */  daddu     $v1, $zero, $zero
/* E82F0 802C3940 0220202D */  daddu     $a0, $s1, $zero
/* E82F4 802C3944 0200282D */  daddu     $a1, $s0, $zero
.L802C3948:
/* E82F8 802C3948 8C8200C4 */  lw        $v0, 0xC4($a0)
/* E82FC 802C394C 24840004 */  addiu     $a0, $a0, 0x4
/* E8300 802C3950 24630001 */  addiu     $v1, $v1, 0x1
/* E8304 802C3954 ACA200C4 */  sw        $v0, 0xC4($a1)
/* E8308 802C3958 28620003 */  slti      $v0, $v1, 0x3
/* E830C 802C395C 1440FFFA */  bnez      $v0, .L802C3948
/* E8310 802C3960 24A50004 */   addiu    $a1, $a1, 0x4
/* E8314 802C3964 0C0B0C52 */  jal       find_script_labels
/* E8318 802C3968 0200202D */   daddu    $a0, $s0, $zero
/* E831C 802C396C 3C02802E */  lui       $v0, %hi(gIsUpdatingScripts)
/* E8320 802C3970 8C429CA4 */  lw        $v0, %lo(gIsUpdatingScripts)($v0)
/* E8324 802C3974 1040000E */  beqz      $v0, .L802C39B0
/* E8328 802C3978 00000000 */   nop
/* E832C 802C397C 3C05802E */  lui       $a1, %hi(gScriptListCount)
/* E8330 802C3980 24A5AC98 */  addiu     $a1, $a1, %lo(gScriptListCount)
/* E8334 802C3984 8CA20000 */  lw        $v0, 0x0($a1)
/* E8338 802C3988 00022080 */  sll       $a0, $v0, 2
/* E833C 802C398C 3C01802E */  lui       $at, %hi(gScriptIndexList)
/* E8340 802C3990 00240821 */  addu      $at, $at, $a0
/* E8344 802C3994 AC33A898 */  sw        $s3, %lo(gScriptIndexList)($at)
/* E8348 802C3998 8E030144 */  lw        $v1, 0x144($s0)
/* E834C 802C399C 24420001 */  addiu     $v0, $v0, 0x1
/* E8350 802C39A0 ACA20000 */  sw        $v0, 0x0($a1)
/* E8354 802C39A4 3C01802E */  lui       $at, %hi(gScriptIdList)
/* E8358 802C39A8 00240821 */  addu      $at, $at, $a0
/* E835C 802C39AC AC23AA98 */  sw        $v1, %lo(gScriptIdList)($at)
.L802C39B0:
/* E8360 802C39B0 0C0B0CE4 */  jal       suspend_frozen_scripts
/* E8364 802C39B4 0200202D */   daddu    $a0, $s0, $zero
/* E8368 802C39B8 3C03802E */  lui       $v1, %hi(gStaticScriptCounter)
/* E836C 802C39BC 24639CA0 */  addiu     $v1, $v1, %lo(gStaticScriptCounter)
/* E8370 802C39C0 8C620000 */  lw        $v0, 0x0($v1)
/* E8374 802C39C4 14400004 */  bnez      $v0, .L802C39D8
/* E8378 802C39C8 0200102D */   daddu    $v0, $s0, $zero
/* E837C 802C39CC 24020001 */  addiu     $v0, $zero, 0x1
/* E8380 802C39D0 AC620000 */  sw        $v0, 0x0($v1)
/* E8384 802C39D4 0200102D */  daddu     $v0, $s0, $zero
.L802C39D8:
/* E8388 802C39D8 8FBF0024 */  lw        $ra, 0x24($sp)
/* E838C 802C39DC 8FB40020 */  lw        $s4, 0x20($sp)
/* E8390 802C39E0 8FB3001C */  lw        $s3, 0x1C($sp)
/* E8394 802C39E4 8FB20018 */  lw        $s2, 0x18($sp)
/* E8398 802C39E8 8FB10014 */  lw        $s1, 0x14($sp)
/* E839C 802C39EC 8FB00010 */  lw        $s0, 0x10($sp)
/* E83A0 802C39F0 03E00008 */  jr        $ra
/* E83A4 802C39F4 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

Evt* start_child_script(Evt* parentScript, EvtScript* source, s32 flags) {
    s32 curScriptIndex;
    s32 scriptListCount;
    Evt* child;
    s32 i;

    for (i = 0; i < MAX_SCRIPTS; i++) {
        if ((*gCurrentScriptListPtr)[i] == NULL) {
            break;
        }
    }

    ASSERT(i < MAX_SCRIPTS);
    curScriptIndex = i;

    (*gCurrentScriptListPtr)[curScriptIndex] = child = heap_malloc(sizeof(*child));
    gNumScripts++;
    ASSERT(child != NULL);

    parentScript->childScript = child;
    parentScript->stateFlags |= EVT_FLAG_BLOCKED_BY_CHILD;
    child->stateFlags = flags | EVT_FLAG_ACTIVE;
    child->ptrCurrentLine = child->ptrFirstLine = child->ptrNextLine = (Bytecode*)source;

    child->currentOpcode = EVT_OP_INTERNAL_FETCH;
    child->userData = NULL;
    child->blockingParent = parentScript;
    child->childScript = NULL;
    child->parentScript = NULL;
    child->priority = parentScript->priority + 1;
    child->id = gStaticScriptCounter++;
    child->owner1 = parentScript->owner1;
    child->owner2 = parentScript->owner2;
    child->loopDepth = -1;
    child->switchDepth = -1;
    child->groupFlags = parentScript->groupFlags;
    child->ptrSavedPos = NULL;
    child->array = parentScript->array;
    child->flagArray = parentScript->flagArray;
    child->timeScale = gGlobalTimeSpace;
    child->frameCounter = 0.0f;
    child->unk_158 = 0;

    scriptListCount = 0;

    for (i = 0; i < ARRAY_COUNT(child->varTable); i++) {
        child->varTable[i] = parentScript->varTable[i];
    }

    for (i = 0; i < ARRAY_COUNT(child->varFlags); i++) {
        child->varFlags[i] = parentScript->varFlags[i];
    }

    find_script_labels(child);
    if (gIsUpdatingScripts) {
        scriptListCount = gScriptListCount++;
        gScriptIndexList[scriptListCount] = curScriptIndex;
        gScriptIdList[scriptListCount] = child->id;
    }

    suspend_frozen_scripts(child);

    if (gStaticScriptCounter == 0) {
        gStaticScriptCounter = 1;
    }

    return child;
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_80252728
/* 181008 80252728 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 18100C 8025272C AFB20018 */  sw        $s2, 0x18($sp)
/* 181010 80252730 0080902D */  daddu     $s2, $a0, $zero
/* 181014 80252734 AFBF0020 */  sw        $ra, 0x20($sp)
dgb_01_D_80252738_C0FFB8:
/* 181018 80252738 AFB3001C */  sw        $s3, 0x1C($sp)
/* 18101C 8025273C AFB10014 */  sw        $s1, 0x14($sp)
/* 181020 80252740 AFB00010 */  sw        $s0, 0x10($sp)
D_80252744:
/* 181024 80252744 8E50000C */  lw        $s0, 0xC($s2)
/* 181028 80252748 3C11800E */  lui       $s1, %hi(gBattleStatus)
/* 18102C 8025274C 2631C070 */  addiu     $s1, $s1, %lo(gBattleStatus)
/* 181030 80252750 8E130000 */  lw        $s3, 0x0($s0)
/* 181034 80252754 26100004 */  addiu     $s0, $s0, 0x4
/* 181038 80252758 8E020000 */  lw        $v0, 0x0($s0)
/* 18103C 8025275C 26100004 */  addiu     $s0, $s0, 0x4
/* 181040 80252760 AE20018C */  sw        $zero, 0x18C($s1)
dgb_01_D_80252764_C0FFE4:
/* 181044 80252764 AE220188 */  sw        $v0, 0x188($s1)
/* 181048 80252768 8E020000 */  lw        $v0, 0x0($s0)
/* 18104C 8025276C 26100004 */  addiu     $s0, $s0, 0x4
/* 181050 80252770 AE220190 */  sw        $v0, 0x190($s1)
/* 181054 80252774 8E050000 */  lw        $a1, 0x0($s0)
/* 181058 80252778 0C0B1EAF */  jal       evt_get_variable
/* 18105C 8025277C 26100004 */   addiu    $s0, $s0, 0x4
/* 181060 80252780 A622017E */  sh        $v0, 0x17E($s1)
D_80252784:
/* 181064 80252784 8E100000 */  lw        $s0, 0x0($s0)
/* 181068 80252788 24020030 */  addiu     $v0, $zero, 0x30
/* 18106C 8025278C 32030030 */  andi      $v1, $s0, 0x30
dgb_01_D_80252790_C10010:
/* 181070 80252790 54620004 */  bnel      $v1, $v0, .L802527A4
D_80252794:
/* 181074 80252794 32020010 */   andi     $v0, $s0, 0x10
D_80252798:
/* 181078 80252798 8E220000 */  lw        $v0, 0x0($s1)
D_8025279C:
/* 18107C 8025279C 080949F9 */  j         .L802527E4
/* 181080 802527A0 34420030 */   ori      $v0, $v0, 0x30
.L802527A4:
/* 181084 802527A4 10400004 */  beqz      $v0, D_802527B8
/* 181088 802527A8 2403FFDF */   addiu    $v1, $zero, -0x21
/* 18108C 802527AC 8E220000 */  lw        $v0, 0x0($s1)
D_802527B0:
/* 181090 802527B0 080949F8 */  j         .L802527E0
/* 181094 802527B4 34420010 */   ori      $v0, $v0, 0x10
D_802527B8:
/* 181098 802527B8 32020020 */  andi      $v0, $s0, 0x20
dgb_01_D_802527BC_C1003C:
/* 18109C 802527BC 10400005 */  beqz      $v0, .L802527D4
jtbl_802527C0:
/* 1810A0 802527C0 2403FFEF */   addiu    $v1, $zero, -0x11
/* 1810A4 802527C4 8E220000 */  lw        $v0, 0x0($s1)
/* 1810A8 802527C8 00431024 */  and       $v0, $v0, $v1
/* 1810AC 802527CC 080949F9 */  j         .L802527E4
/* 1810B0 802527D0 34420020 */   ori      $v0, $v0, 0x20
.L802527D4:
/* 1810B4 802527D4 8E220000 */  lw        $v0, 0x0($s1)
/* 1810B8 802527D8 00431024 */  and       $v0, $v0, $v1
/* 1810BC 802527DC 2403FFDF */  addiu     $v1, $zero, -0x21
.L802527E0:
/* 1810C0 802527E0 00431024 */  and       $v0, $v0, $v1
.L802527E4:
/* 1810C4 802527E4 AE220000 */  sw        $v0, 0x0($s1)
dgb_01_D_802527E8_C10068:
/* 1810C8 802527E8 32020040 */  andi      $v0, $s0, 0x40
/* 1810CC 802527EC 10400007 */  beqz      $v0, .L8025280C
/* 1810D0 802527F0 2404FFBF */   addiu    $a0, $zero, -0x41
/* 1810D4 802527F4 3C03800E */  lui       $v1, %hi(gBattleStatus)
/* 1810D8 802527F8 2463C070 */  addiu     $v1, $v1, %lo(gBattleStatus)
/* 1810DC 802527FC 8C620000 */  lw        $v0, 0x0($v1)
/* 1810E0 80252800 34420040 */  ori       $v0, $v0, 0x40
/* 1810E4 80252804 08094A08 */  j         .L80252820
/* 1810E8 80252808 AC620000 */   sw       $v0, 0x0($v1)
.L8025280C:
/* 1810EC 8025280C 3C02800E */  lui       $v0, %hi(gBattleStatus)
/* 1810F0 80252810 2442C070 */  addiu     $v0, $v0, %lo(gBattleStatus)
dgb_01_D_80252814_C10094:
/* 1810F4 80252814 8C430000 */  lw        $v1, 0x0($v0)
/* 1810F8 80252818 00641824 */  and       $v1, $v1, $a0
/* 1810FC 8025281C AC430000 */  sw        $v1, 0x0($v0)
.L80252820:
/* 181100 80252820 32020200 */  andi      $v0, $s0, 0x200
/* 181104 80252824 10400007 */  beqz      $v0, .L80252844
/* 181108 80252828 2404FDFF */   addiu    $a0, $zero, -0x201
/* 18110C 8025282C 3C03800E */  lui       $v1, %hi(gBattleStatus)
/* 181110 80252830 2463C070 */  addiu     $v1, $v1, %lo(gBattleStatus)
/* 181114 80252834 8C620000 */  lw        $v0, 0x0($v1)
/* 181118 80252838 34420200 */  ori       $v0, $v0, 0x200
/* 18111C 8025283C 08094A16 */  j         .L80252858
dgb_01_D_80252840_C100C0:
/* 181120 80252840 AC620000 */   sw       $v0, 0x0($v1)
.L80252844:
/* 181124 80252844 3C02800E */  lui       $v0, %hi(gBattleStatus)
/* 181128 80252848 2442C070 */  addiu     $v0, $v0, %lo(gBattleStatus)
/* 18112C 8025284C 8C430000 */  lw        $v1, 0x0($v0)
/* 181130 80252850 00641824 */  and       $v1, $v1, $a0
/* 181134 80252854 AC430000 */  sw        $v1, 0x0($v0)
.L80252858:
/* 181138 80252858 32020080 */  andi      $v0, $s0, 0x80
/* 18113C 8025285C 10400007 */  beqz      $v0, .L8025287C
/* 181140 80252860 2404FF7F */   addiu    $a0, $zero, -0x81
/* 181144 80252864 3C03800E */  lui       $v1, %hi(gBattleStatus)
/* 181148 80252868 2463C070 */  addiu     $v1, $v1, %lo(gBattleStatus)
dgb_01_D_8025286C_C100EC:
/* 18114C 8025286C 8C620000 */  lw        $v0, 0x0($v1)
/* 181150 80252870 34420080 */  ori       $v0, $v0, 0x80
/* 181154 80252874 08094A24 */  j         .L80252890
/* 181158 80252878 AC620000 */   sw       $v0, 0x0($v1)
.L8025287C:
/* 18115C 8025287C 3C02800E */  lui       $v0, %hi(gBattleStatus)
/* 181160 80252880 2442C070 */  addiu     $v0, $v0, %lo(gBattleStatus)
/* 181164 80252884 8C430000 */  lw        $v1, 0x0($v0)
/* 181168 80252888 00641824 */  and       $v1, $v1, $a0
/* 18116C 8025288C AC430000 */  sw        $v1, 0x0($v0)
.L80252890:
/* 181170 80252890 0C09A75B */  jal       get_actor
/* 181174 80252894 8E440148 */   lw       $a0, 0x148($s2)
dgb_01_D_80252898_C10118:
/* 181178 80252898 94430428 */  lhu       $v1, 0x428($v0)
/* 18117C 8025289C A62301A0 */  sh        $v1, 0x1A0($s1)
/* 181180 802528A0 92230193 */  lbu       $v1, 0x193($s1)
/* 181184 802528A4 90420426 */  lbu       $v0, 0x426($v0)
/* 181188 802528A8 A2230194 */  sb        $v1, 0x194($s1)
/* 18118C 802528AC 306300FF */  andi      $v1, $v1, 0xFF
/* 181190 802528B0 A22201A2 */  sb        $v0, 0x1A2($s1)
/* 181194 802528B4 240200FF */  addiu     $v0, $zero, 0xFF
/* 181198 802528B8 50620001 */  beql      $v1, $v0, .L802528C0
/* 18119C 802528BC A2200194 */   sb       $zero, 0x194($s1)
.L802528C0:
/* 1811A0 802528C0 8E220190 */  lw        $v0, 0x190($s1)
dgb_01_D_802528C4_C10144:
/* 1811A4 802528C4 30420F00 */  andi      $v0, $v0, 0xF00
/* 1811A8 802528C8 00021203 */  sra       $v0, $v0, 8
/* 1811AC 802528CC 0C0945BA */  jal       func_802516E8
/* 1811B0 802528D0 A2220195 */   sb       $v0, 0x195($s1)
/* 1811B4 802528D4 0440000B */  bltz      $v0, .L80252904
/* 1811B8 802528D8 0240202D */   daddu    $a0, $s2, $zero
/* 1811BC 802528DC 0260282D */  daddu     $a1, $s3, $zero
/* 1811C0 802528E0 0C0B2026 */  jal       evt_set_variable
/* 1811C4 802528E4 0040302D */   daddu    $a2, $v0, $zero
/* 1811C8 802528E8 0C0B1069 */  jal       does_script_exist_by_ref
/* 1811CC 802528EC 0240202D */   daddu    $a0, $s2, $zero
dgb_01_D_802528F0_C10170:
/* 1811D0 802528F0 0040182D */  daddu     $v1, $v0, $zero
/* 1811D4 802528F4 10600004 */  beqz      $v1, .L80252908
/* 1811D8 802528F8 240200FF */   addiu    $v0, $zero, 0xFF
/* 1811DC 802528FC 08094A42 */  j         .L80252908
/* 1811E0 80252900 24020002 */   addiu    $v0, $zero, 0x2
.L80252904:
/* 1811E4 80252904 240200FF */  addiu     $v0, $zero, 0xFF
.L80252908:
/* 1811E8 80252908 8FBF0020 */  lw        $ra, 0x20($sp)
/* 1811EC 8025290C 8FB3001C */  lw        $s3, 0x1C($sp)
/* 1811F0 80252910 8FB20018 */  lw        $s2, 0x18($sp)
/* 1811F4 80252914 8FB10014 */  lw        $s1, 0x14($sp)
/* 1811F8 80252918 8FB00010 */  lw        $s0, 0x10($sp)
dgb_01_D_8025291C_C1019C:
/* 1811FC 8025291C 03E00008 */  jr        $ra
/* 181200 80252920 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

ApiStatus ItemDamageEnemy(Evt* script, s32 isInitialCall) {
    BattleStatus* battleStatus = &gBattleStatus;
    Bytecode* args = script->ptrReadPos;
    s32 hitResultVarOut = *args++;
    s32 flags;
    Actor* actor;
    HitResult hitResult;

    battleStatus->currentAttackElement = *args++;
    battleStatus->currentAttackEventSuppression = 0;
    battleStatus->currentAttackStatus = *args++;
    battleStatus->currentAttackDamage = evt_get_variable(script, *args++);
    flags = *args++;

    if ((flags & (BS_FLAGS1_10 | BS_FLAGS1_SP_EVT_ACTIVE)) == (BS_FLAGS1_10 | BS_FLAGS1_SP_EVT_ACTIVE)) {
        gBattleStatus.flags1 |= BS_FLAGS1_10;
        gBattleStatus.flags1 |= BS_FLAGS1_SP_EVT_ACTIVE;
    } else if (flags & BS_FLAGS1_10) {
        gBattleStatus.flags1 |= BS_FLAGS1_10;
        gBattleStatus.flags1 &= ~BS_FLAGS1_SP_EVT_ACTIVE;
    } else if (flags & BS_FLAGS1_SP_EVT_ACTIVE) {
        gBattleStatus.flags1 &= ~BS_FLAGS1_10;
        gBattleStatus.flags1 |= BS_FLAGS1_SP_EVT_ACTIVE;
    } else {
        gBattleStatus.flags1 &= ~BS_FLAGS1_10;
        gBattleStatus.flags1 &= ~BS_FLAGS1_SP_EVT_ACTIVE;
    }

    if (flags & BS_FLAGS1_40) {
        gBattleStatus.flags1 |= BS_FLAGS1_40;
    } else {
        gBattleStatus.flags1 &= ~BS_FLAGS1_40;
    }

    if (flags & BS_FLAGS1_200) {
        gBattleStatus.flags1 |= BS_FLAGS1_200;
    } else {
        gBattleStatus.flags1 &= ~BS_FLAGS1_200;
    }

    if (flags & BS_FLAGS1_80) {
        gBattleStatus.flags1 |= BS_FLAGS1_80;
    } else {
        gBattleStatus.flags1 &= ~BS_FLAGS1_80;
    }

    actor = get_actor(script->owner1.actorID);
    battleStatus->currentTargetID = actor->targetActorID;
    battleStatus->currentTargetPart = actor->targetPartIndex;
    battleStatus->statusChance = battleStatus->currentAttackStatus;

    if (battleStatus->statusChance == STATUS_KEY_NEVER) {
        battleStatus->statusChance = 0;
    }

    battleStatus->statusDuration = (battleStatus->currentAttackStatus & 0xF00) >> 8;

    hitResult = calc_item_damage_enemy();
    if (hitResult < 0) {
        return ApiStatus_FINISH;
    }

    evt_set_variable(script, hitResultVarOut, hitResult);
    if (!does_script_exist_by_ref(script)) {
        return ApiStatus_FINISH;
    }

    return ApiStatus_DONE2;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel attack_result_text_update
/* 38FAC8 E00901C8 27BDFFE8 */  addiu     $sp, $sp, -0x18
/* 38FACC E00901CC AFBF0010 */  sw        $ra, 0x10($sp)
/* 38FAD0 E00901D0 8C85000C */  lw        $a1, 0xC($a0)
/* 38FAD4 E00901D4 8CA30018 */  lw        $v1, 0x18($a1)
/* 38FAD8 E00901D8 8CA70000 */  lw        $a3, 0x0($a1)
/* 38FADC E00901DC 28620064 */  slti      $v0, $v1, 0x64
/* 38FAE0 E00901E0 10400002 */  beqz      $v0, .LE00901EC
/* 38FAE4 E00901E4 2462FFFF */   addiu    $v0, $v1, -0x1
/* 38FAE8 E00901E8 ACA20018 */  sw        $v0, 0x18($a1)
.LE00901EC:
/* 38FAEC E00901EC 8CA3001C */  lw        $v1, 0x1C($a1)
/* 38FAF0 E00901F0 8CA80018 */  lw        $t0, 0x18($a1)
/* 38FAF4 E00901F4 24660001 */  addiu     $a2, $v1, 0x1
/* 38FAF8 E00901F8 05010007 */  bgez      $t0, .LE0090218
/* 38FAFC E00901FC ACA6001C */   sw       $a2, 0x1C($a1)
/* 38FB00 E0090200 2402FFFF */  addiu     $v0, $zero, -0x1
/* 38FB04 E0090204 ACA00024 */  sw        $zero, 0x24($a1)
/* 38FB08 E0090208 0C080128 */  jal       shim_remove_effect
/* 38FB0C E009020C ACA20018 */   sw       $v0, 0x18($a1)
/* 38FB10 E0090210 08024105 */  j         .LE0090414
/* 38FB14 E0090214 00000000 */   nop
.LE0090218:
/* 38FB18 E0090218 28E20005 */  slti      $v0, $a3, 0x5
/* 38FB1C E009021C 10400048 */  beqz      $v0, .LE0090340
/* 38FB20 E0090220 28C20009 */   slti     $v0, $a2, 0x9
/* 38FB24 E0090224 1040000F */  beqz      $v0, .LE0090264
/* 38FB28 E0090228 2402000A */   addiu    $v0, $zero, 0xA
/* 38FB2C E009022C 3C02E009 */  lui       $v0, (0xE0090A68 >> 16)
/* 38FB30 E0090230 00431021 */  addu      $v0, $v0, $v1
/* 38FB34 E0090234 90420A68 */  lbu       $v0, (0xE0090A68 & 0xFFFF)($v0)
/* 38FB38 E0090238 3C01E009 */  lui       $at, (0xE0090AA0 >> 16)
/* 38FB3C E009023C D4220AA0 */  ldc1      $f2, (0xE0090AA0 & 0xFFFF)($at)
/* 38FB40 E0090240 44820000 */  mtc1      $v0, $f0
/* 38FB44 E0090244 00000000 */  nop
/* 38FB48 E0090248 46800020 */  cvt.s.w   $f0, $f0
/* 38FB4C E009024C 46000021 */  cvt.d.s   $f0, $f0
/* 38FB50 E0090250 46220002 */  mul.d     $f0, $f0, $f2
/* 38FB54 E0090254 00000000 */  nop
/* 38FB58 E0090258 46200020 */  cvt.s.d   $f0, $f0
/* 38FB5C E009025C E4A00028 */  swc1      $f0, 0x28($a1)
/* 38FB60 E0090260 2402000A */  addiu     $v0, $zero, 0xA
.LE0090264:
/* 38FB64 E0090264 14C20003 */  bne       $a2, $v0, .LE0090274
/* 38FB68 E0090268 2463FF9C */   addiu    $v1, $v1, -0x64
/* 38FB6C E009026C 24020009 */  addiu     $v0, $zero, 0x9
/* 38FB70 E0090270 ACA2001C */  sw        $v0, 0x1C($a1)
.LE0090274:
/* 38FB74 E0090274 2C620007 */  sltiu     $v0, $v1, 0x7
/* 38FB78 E0090278 1040000F */  beqz      $v0, .LE00902B8
/* 38FB7C E009027C 2402006D */   addiu    $v0, $zero, 0x6D
/* 38FB80 E0090280 3C02E009 */  lui       $v0, (0xE0090A70 >> 16)
/* 38FB84 E0090284 00431021 */  addu      $v0, $v0, $v1
/* 38FB88 E0090288 90420A70 */  lbu       $v0, (0xE0090A70 & 0xFFFF)($v0)
/* 38FB8C E009028C 3C01E009 */  lui       $at, (0xE0090AA8 >> 16)
/* 38FB90 E0090290 D4220AA8 */  ldc1      $f2, (0xE0090AA8 & 0xFFFF)($at)
/* 38FB94 E0090294 44820000 */  mtc1      $v0, $f0
/* 38FB98 E0090298 00000000 */  nop
/* 38FB9C E009029C 46800020 */  cvt.s.w   $f0, $f0
/* 38FBA0 E00902A0 46000021 */  cvt.d.s   $f0, $f0
/* 38FBA4 E00902A4 46220002 */  mul.d     $f0, $f0, $f2
/* 38FBA8 E00902A8 00000000 */  nop
/* 38FBAC E00902AC 46200020 */  cvt.s.d   $f0, $f0
/* 38FBB0 E00902B0 E4A00028 */  swc1      $f0, 0x28($a1)
/* 38FBB4 E00902B4 2402006D */  addiu     $v0, $zero, 0x6D
.LE00902B8:
/* 38FBB8 E00902B8 14C20004 */  bne       $a2, $v0, .LE00902CC
/* 38FBBC E00902BC 28C203E9 */   slti     $v0, $a2, 0x3E9
/* 38FBC0 E00902C0 2402006C */  addiu     $v0, $zero, 0x6C
/* 38FBC4 E00902C4 ACA2001C */  sw        $v0, 0x1C($a1)
/* 38FBC8 E00902C8 28C203E9 */  slti      $v0, $a2, 0x3E9
.LE00902CC:
/* 38FBCC E00902CC 14400004 */  bnez      $v0, .LE00902E0
/* 38FBD0 E00902D0 29020006 */   slti     $v0, $t0, 0x6
/* 38FBD4 E00902D4 240203E8 */  addiu     $v0, $zero, 0x3E8
/* 38FBD8 E00902D8 ACA2001C */  sw        $v0, 0x1C($a1)
/* 38FBDC E00902DC 29020006 */  slti      $v0, $t0, 0x6
.LE00902E0:
/* 38FBE0 E00902E0 14400010 */  bnez      $v0, .LE0090324
/* 38FBE4 E00902E4 29020005 */   slti     $v0, $t0, 0x5
/* 38FBE8 E00902E8 C4A00030 */  lwc1      $f0, 0x30($a1)
/* 38FBEC E00902EC 3C013FE8 */  lui       $at, (0x3FE80000 >> 16)
/* 38FBF0 E00902F0 44812800 */  mtc1      $at, $f5
/* 38FBF4 E00902F4 44802000 */  mtc1      $zero, $f4
/* 38FBF8 E00902F8 46000021 */  cvt.d.s   $f0, $f0
/* 38FBFC E00902FC 46240002 */  mul.d     $f0, $f0, $f4
/* 38FC00 E0090300 00000000 */  nop
/* 38FC04 E0090304 C4A20034 */  lwc1      $f2, 0x34($a1)
/* 38FC08 E0090308 460010A1 */  cvt.d.s   $f2, $f2
/* 38FC0C E009030C 46241082 */  mul.d     $f2, $f2, $f4
/* 38FC10 E0090310 00000000 */  nop
/* 38FC14 E0090314 46200020 */  cvt.s.d   $f0, $f0
/* 38FC18 E0090318 462010A0 */  cvt.s.d   $f2, $f2
/* 38FC1C E009031C E4A00030 */  swc1      $f0, 0x30($a1)
/* 38FC20 E0090320 E4A20034 */  swc1      $f2, 0x34($a1)
.LE0090324:
/* 38FC24 E0090324 10400027 */  beqz      $v0, .LE00903C4
/* 38FC28 E0090328 00000000 */   nop
/* 38FC2C E009032C C4A00030 */  lwc1      $f0, 0x30($a1)
/* 38FC30 E0090330 3C01E009 */  lui       $at, (0xE0090AB0 >> 16)
/* 38FC34 E0090334 D4240AB0 */  ldc1      $f4, (0xE0090AB0 & 0xFFFF)($at)
/* 38FC38 E0090338 080240E7 */  j         .LE009039C
/* 38FC3C E009033C 46000021 */   cvt.d.s  $f0, $f0
.LE0090340:
/* 38FC40 E0090340 29020006 */  slti      $v0, $t0, 0x6
/* 38FC44 E0090344 1440000F */  bnez      $v0, .LE0090384
/* 38FC48 E0090348 29020005 */   slti     $v0, $t0, 0x5
/* 38FC4C E009034C C4A00030 */  lwc1      $f0, 0x30($a1)
/* 38FC50 E0090350 3C01E009 */  lui       $at, (0xE0090AB8 >> 16)
/* 38FC54 E0090354 D4240AB8 */  ldc1      $f4, (0xE0090AB8 & 0xFFFF)($at)
/* 38FC58 E0090358 46000021 */  cvt.d.s   $f0, $f0
/* 38FC5C E009035C 46240002 */  mul.d     $f0, $f0, $f4
/* 38FC60 E0090360 00000000 */  nop
/* 38FC64 E0090364 C4A20034 */  lwc1      $f2, 0x34($a1)
/* 38FC68 E0090368 460010A1 */  cvt.d.s   $f2, $f2
/* 38FC6C E009036C 46241082 */  mul.d     $f2, $f2, $f4
/* 38FC70 E0090370 00000000 */  nop
/* 38FC74 E0090374 46200020 */  cvt.s.d   $f0, $f0
/* 38FC78 E0090378 462010A0 */  cvt.s.d   $f2, $f2
/* 38FC7C E009037C E4A00030 */  swc1      $f0, 0x30($a1)
/* 38FC80 E0090380 E4A20034 */  swc1      $f2, 0x34($a1)
.LE0090384:
/* 38FC84 E0090384 1040000F */  beqz      $v0, .LE00903C4
/* 38FC88 E0090388 00000000 */   nop
/* 38FC8C E009038C C4A00030 */  lwc1      $f0, 0x30($a1)
/* 38FC90 E0090390 3C01E009 */  lui       $at, (0xE0090AC0 >> 16)
/* 38FC94 E0090394 D4240AC0 */  ldc1      $f4, (0xE0090AC0 & 0xFFFF)($at)
/* 38FC98 E0090398 46000021 */  cvt.d.s   $f0, $f0
.LE009039C:
/* 38FC9C E009039C 46240002 */  mul.d     $f0, $f0, $f4
/* 38FCA0 E00903A0 00000000 */  nop
/* 38FCA4 E00903A4 C4A20034 */  lwc1      $f2, 0x34($a1)
/* 38FCA8 E00903A8 460010A1 */  cvt.d.s   $f2, $f2
/* 38FCAC E00903AC 46241082 */  mul.d     $f2, $f2, $f4
/* 38FCB0 E00903B0 00000000 */  nop
/* 38FCB4 E00903B4 46200020 */  cvt.s.d   $f0, $f0
/* 38FCB8 E00903B8 462010A0 */  cvt.s.d   $f2, $f2
/* 38FCBC E00903BC E4A00030 */  swc1      $f0, 0x30($a1)
/* 38FCC0 E00903C0 E4A20034 */  swc1      $f2, 0x34($a1)
.LE00903C4:
/* 38FCC4 E00903C4 C4A40008 */  lwc1      $f4, 0x8($a1)
/* 38FCC8 E00903C8 C4A00030 */  lwc1      $f0, 0x30($a1)
/* 38FCCC E00903CC C4A2000C */  lwc1      $f2, 0xC($a1)
/* 38FCD0 E00903D0 46002100 */  add.s     $f4, $f4, $f0
/* 38FCD4 E00903D4 C4A00034 */  lwc1      $f0, 0x34($a1)
/* 38FCD8 E00903D8 8CA20020 */  lw        $v0, 0x20($a1)
/* 38FCDC E00903DC 46001080 */  add.s     $f2, $f2, $f0
/* 38FCE0 E00903E0 E4A40008 */  swc1      $f4, 0x8($a1)
/* 38FCE4 E00903E4 1040000B */  beqz      $v0, .LE0090414
/* 38FCE8 E00903E8 E4A2000C */   swc1     $f2, 0xC($a1)
/* 38FCEC E00903EC 8CA20004 */  lw        $v0, 0x4($a1)
/* 38FCF0 E00903F0 24030064 */  addiu     $v1, $zero, 0x64
/* 38FCF4 E00903F4 ACA00020 */  sw        $zero, 0x20($a1)
/* 38FCF8 E00903F8 ACA3001C */  sw        $v1, 0x1C($a1)
/* 38FCFC E00903FC 24420001 */  addiu     $v0, $v0, 0x1
/* 38FD00 E0090400 ACA20004 */  sw        $v0, 0x4($a1)
/* 38FD04 E0090404 28420003 */  slti      $v0, $v0, 0x3
/* 38FD08 E0090408 14400002 */  bnez      $v0, .LE0090414
/* 38FD0C E009040C 24020002 */   addiu    $v0, $zero, 0x2
/* 38FD10 E0090410 ACA20004 */  sw        $v0, 0x4($a1)
.LE0090414:
/* 38FD14 E0090414 8FBF0010 */  lw        $ra, 0x10($sp)
/* 38FD18 E0090418 03E00008 */  jr        $ra
/* 38FD1C E009041C 27BD0018 */   addiu    $sp, $sp, 0x18

### DECOMPILED C INSTRUCTIONS:

void attack_result_text_update(EffectInstance* effect) {
    AttackResultTextFXData* data = effect->data.attackResultText;
    s32 type = data->type;
    s32 prevTime;
    s32 curTime;
    s32 timeLeft;
    u32 temp1C;

    if (data->timeLeft < 100) {
        data->timeLeft--;
    }

    prevTime = data->lifetime;
    data->lifetime++;
    curTime = data->lifetime;

    if (data->timeLeft < 0) {
        data->isVisible = FALSE;
        data->timeLeft = -1;
        shim_remove_effect(effect);
        return;
    }

    timeLeft = data->timeLeft;

    if (type < 5) {
        if (data->lifetime < 9) {
            data->scale = (f32) D_E0090A68[prevTime] * 0.01;
        }

        temp1C = prevTime - 100;
        if (curTime == 10) {
            data->lifetime = 9;
        }

        if (temp1C < 7) {
            data->scale = (f32) D_E0090A70[temp1C] * 0.01;
        }

        if (curTime == 109) {
            data->lifetime = 108;
        }
        if (curTime > 1000) {
            data->lifetime = 1000;
        }
        if (timeLeft >= 6) {
            data->vel.x *= 0.75;
            data->vel.y *= 0.75;
        }
        if (timeLeft < 5) {
            data->vel.x *= 0.7;
            data->vel.y *= 0.7;
        }
    } else {
        if (timeLeft >= 6) {
            data->vel.x *= 0.7;
            data->vel.y *= 0.7;
        }
        if (timeLeft < 5) {
            data->vel.x *= 0.6;
            data->vel.y *= 0.6;
        }
    }

    data->pos.x += data->vel.x;
    data->pos.y += data->vel.y;
    if (data->unk_20 != 0) {
        data->unk_20 = 0;
        data->lifetime = 100;
        data->unk_04++;
        if (data->unk_04 > 2) {
            data->unk_04 = 2;
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_80240E60
/* 16F740 80240E60 27BDFFD8 */  addiu     $sp, $sp, -0x28
glabel dead_11_FlyingAI_Chase
/* 16F744 80240E64 AFB40020 */  sw        $s4, 0x20($sp)
D_80240E68:
/* 16F748 80240E68 3C14800E */  lui       $s4, %hi(gBattleStatus)
glabel func_80240E6C
/* 16F74C 80240E6C 2694C070 */  addiu     $s4, $s4, %lo(gBattleStatus)
glabel func_80240E70
/* 16F750 80240E70 AFB3001C */  sw        $s3, 0x1C($sp)
glabel func_80240E74
/* 16F754 80240E74 3C13800B */  lui       $s3, %hi(gCurrentEncounter)
glabel .L80240E78
/* 16F758 80240E78 26730F10 */  addiu     $s3, $s3, %lo(gCurrentEncounter)
glabel .L80240E7C
/* 16F75C 80240E7C AFB00010 */  sw        $s0, 0x10($sp)
glabel func_80240E80
/* 16F760 80240E80 3C108011 */  lui       $s0, %hi(gPlayerData)
glabel dead_flo_13_FlyingAI_ChaseInit
/* 16F764 80240E84 2610F290 */  addiu     $s0, $s0, %lo(gPlayerData)
flo_18_pad_E88:
/* 16F768 80240E88 AFBF0024 */  sw        $ra, 0x24($sp)
glabel sam_02_Quizmo_RenderInit
/* 16F76C 80240E8C AFB20018 */  sw        $s2, 0x18($sp)
D_80240E90:
/* 16F770 80240E90 AFB10014 */  sw        $s1, 0x14($sp)
glabel func_80240E94
/* 16F774 80240E94 8E820004 */  lw        $v0, 0x4($s4)
glabel func_80240E98
/* 16F778 80240E98 30420040 */  andi      $v0, $v0, 0x40
glabel func_80240E9C
/* 16F77C 80240E9C 14400047 */  bnez      $v0, func_80240FBC
glabel .L80240EA0
/* 16F780 80240EA0 24110003 */   addiu    $s1, $zero, 0x3
glabel flo_03_pad_EA4
/* 16F784 80240EA4 8282008A */  lb        $v0, 0x8A($s4)
glabel func_80240EA8
/* 16F788 80240EA8 10510044 */  beq       $v0, $s1, func_80240FBC
glabel func_80240EAC
/* 16F78C 80240EAC 24120004 */   addiu    $s2, $zero, 0x4
glabel func_80240EB0
/* 16F790 80240EB0 10520042 */  beq       $v0, $s2, func_80240FBC
glabel func_80240EB4
/* 16F794 80240EB4 00000000 */   nop
glabel func_80240EB8
/* 16F798 80240EB8 8202028A */  lb        $v0, 0x28A($s0)
glabel sam_11_Quizmo_UpdateRecords
/* 16F79C 80240EBC 1840003F */  blez      $v0, func_80240FBC
glabel end_01_CharAnim_FadeIn_5
/* 16F7A0 80240EC0 00000000 */   nop
glabel .L80240EC4
/* 16F7A4 80240EC4 8602028C */  lh        $v0, 0x28C($s0)
glabel dead_11_FlyingAI_LosePlayer
/* 16F7A8 80240EC8 1C400030 */  bgtz      $v0, func_80240F8C
glabel func_80240ECC
/* 16F7AC 80240ECC 00000000 */   nop
glabel func_80240ED0
/* 16F7B0 80240ED0 0C00A67F */  jal       rand_int
glabel .L80240ED4
/* 16F7B4 80240ED4 24040064 */   addiu    $a0, $zero, 0x64
glabel sam_02_Quizmo_NPC_Aux_Impl
/* 16F7B8 80240ED8 8E63008C */  lw        $v1, 0x8C($s3)
glabel omo_02_GuardAI_IdleInit
/* 16F7BC 80240EDC 10600018 */  beqz      $v1, func_80240F40_EB9D90
D_80240EE0:
/* 16F7C0 80240EE0 0040202D */   daddu    $a0, $v0, $zero
glabel .L80240EE4
/* 16F7C4 80240EE4 8C620000 */  lw        $v0, 0x0($v1)
glabel pra_39_worker_reflect_partner_floor
/* 16F7C8 80240EE8 3C030004 */  lui       $v1, (0x40000 >> 16)
glabel func_80240EEC
/* 16F7CC 80240EEC 00431024 */  and       $v0, $v0, $v1
D_80240EF0:
/* 16F7D0 80240EF0 10400008 */  beqz      $v0, func_80240F14
glabel sam_08_MeleeHitbox_33
/* 16F7D4 80240EF4 2882002E */   slti     $v0, $a0, 0x2E
glabel func_80240EF8
/* 16F7D8 80240EF8 14400014 */  bnez      $v0, func_80240F4C
glabel dead_flo_09_FlyingAI_JumpInit
/* 16F7DC 80240EFC 24020001 */   addiu    $v0, $zero, 0x1
glabel func_80240F00
/* 16F7E0 80240F00 2882005B */  slti      $v0, $a0, 0x5B
glabel func_80240F04
/* 16F7E4 80240F04 14400016 */  bnez      $v0, func_80240F60_D4DFA0
flo_03_varStash:
/* 16F7E8 80240F08 24020002 */   addiu    $v0, $zero, 0x2
D_80240F0C:
/* 16F7EC 80240F0C 080903DE */  j         func_80240F78
glabel func_80240F10
/* 16F7F0 80240F10 A2110289 */   sb       $s1, 0x289($s0)
glabel func_80240F14
/* 16F7F4 80240F14 2882001F */  slti      $v0, $a0, 0x1F
glabel func_80240F18
/* 16F7F8 80240F18 1440000C */  bnez      $v0, func_80240F4C
glabel func_80240F1C
/* 16F7FC 80240F1C 24020001 */   addiu    $v0, $zero, 0x1
glabel func_80240F20
/* 16F800 80240F20 2882003D */  slti      $v0, $a0, 0x3D
glabel .L80240F24
/* 16F804 80240F24 1440000E */  bnez      $v0, func_80240F60_D4DFA0
dead_flo_03_varStash:
/* 16F808 80240F28 24020002 */   addiu    $v0, $zero, 0x2
glabel func_80240F2C_D7FC8C
/* 16F80C 80240F2C 28820051 */  slti      $v0, $a0, 0x51
glabel func_80240F30
/* 16F810 80240F30 54400011 */  bnel      $v0, $zero, func_80240F78
glabel .L80240F34
/* 16F814 80240F34 A2110289 */   sb       $s1, 0x289($s0)
glabel func_80240F38
/* 16F818 80240F38 080903DE */  j         func_80240F78
D_80240F3C:
/* 16F81C 80240F3C A2120289 */   sb       $s2, 0x289($s0)
glabel func_80240F40_EB9D90
/* 16F820 80240F40 2882001F */  slti      $v0, $a0, 0x1F
glabel func_80240F44
/* 16F824 80240F44 10400003 */  beqz      $v0, func_80240F54_DE33E4
glabel func_80240F48
/* 16F828 80240F48 24020001 */   addiu    $v0, $zero, 0x1
glabel func_80240F4C
/* 16F82C 80240F4C 080903DE */  j         func_80240F78
glabel pra_39_SwooperAI_Main
/* 16F830 80240F50 A2020289 */   sb       $v0, 0x289($s0)
glabel func_80240F54_DE33E4
/* 16F834 80240F54 2882003D */  slti      $v0, $a0, 0x3D
glabel func_80240F58
/* 16F838 80240F58 10400003 */  beqz      $v0, func_80240F68
.L80240F5C:
/* 16F83C 80240F5C 24020002 */   addiu    $v0, $zero, 0x2
glabel func_80240F60_D4DFA0
/* 16F840 80240F60 080903DE */  j         func_80240F78
D_80240F64:
/* 16F844 80240F64 A2020289 */   sb       $v0, 0x289($s0)
glabel func_80240F68
/* 16F848 80240F68 28820051 */  slti      $v0, $a0, 0x51
D_80240F6C:
/* 16F84C 80240F6C 50400002 */  beql      $v0, $zero, func_80240F78
glabel func_80240F70
/* 16F850 80240F70 A2120289 */   sb       $s2, 0x289($s0)
glabel dead_flo_09lo_09_FlyingAI_Jump
/* 16F854 80240F74 A2110289 */  sb        $s1, 0x289($s0)
glabel func_80240F78
/* 16F858 80240F78 0C00A67F */  jal       rand_int
glabel omo_04_FlyingAI_JumpInit
/* 16F85C 80240F7C 2404000A */   addiu    $a0, $zero, 0xA
glabel func_80240F80
/* 16F860 80240F80 24440006 */  addiu     $a0, $v0, 0x6
glabel func_80240F84
/* 16F864 80240F84 A604028C */  sh        $a0, 0x28C($s0)
glabel kzn_04_SuperBlock_PartnerSparkles2
/* 16F868 80240F88 8602028C */  lh        $v0, 0x28C($s0)
glabel func_80240F8C
/* 16F86C 80240F8C 9603028C */  lhu       $v1, 0x28C($s0)
glabel func_80240F90
/* 16F870 80240F90 28420002 */  slti      $v0, $v0, 0x2
glabel func_80240F94
/* 16F874 80240F94 14400003 */  bnez      $v0, func_80240FA4
glabel .L80240F98
/* 16F878 80240F98 2462FFFF */   addiu    $v0, $v1, -0x1
glabel func_80240F9C
/* 16F87C 80240F9C 080903EF */  j         func_80240FBC
glabel func_80240FA0
/* 16F880 80240FA0 A602028C */   sh       $v0, 0x28C($s0)
glabel func_80240FA4
/* 16F884 80240FA4 92030289 */  lbu       $v1, 0x289($s0)
glabel func_80240FA8
/* 16F888 80240FA8 9202028A */  lbu       $v0, 0x28A($s0)
glabel func_80240FAC
/* 16F88C 80240FAC A600028C */  sh        $zero, 0x28C($s0)
glabel func_80240FB0_EB9E00
/* 16F890 80240FB0 2442FFFF */  addiu     $v0, $v0, -0x1
glabel omo_17_FlyingAI_WanderInit
/* 16F894 80240FB4 A283008A */  sb        $v1, 0x8A($s4)
glabel func_80240FB8
/* 16F898 80240FB8 A202028A */  sb        $v0, 0x28A($s0)
glabel func_80240FBC
/* 16F89C 80240FBC 8FBF0024 */  lw        $ra, 0x24($sp)
glabel func_80240FC0
/* 16F8A0 80240FC0 8FB40020 */  lw        $s4, 0x20($sp)
glabel func_80240FC4
/* 16F8A4 80240FC4 8FB3001C */  lw        $s3, 0x1C($sp)
.L80240FC8:
/* 16F8A8 80240FC8 8FB20018 */  lw        $s2, 0x18($sp)
glabel func_80240FCC
/* 16F8AC 80240FCC 8FB10014 */  lw        $s1, 0x14($sp)
tst_04_B_80240FD0:
/* 16F8B0 80240FD0 8FB00010 */  lw        $s0, 0x10($sp)
glabel func_80240FD4
/* 16F8B4 80240FD4 03E00008 */  jr        $ra
glabel omo_07_PatrolAI_LosePlayer
/* 16F8B8 80240FD8 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

void btl_merlee_on_start_turn(void) {
    BattleStatus* battleStatus = &gBattleStatus;
    EncounterStatus* currentEncounter = &gCurrentEncounter;
    PlayerData* playerData = &gPlayerData;

    do {
        if (!(gBattleStatus.flags2 & BS_FLAGS2_PEACH_BATTLE)
            && battleStatus->nextMerleeSpellType != MERLEE_SPELL_EXP_BOOST
            && battleStatus->nextMerleeSpellType != MERLEE_SPELL_COIN_BOOST
            && playerData->merleeCastsLeft > 0
        ) {
            if (playerData->merleeTurnCount <= 0) {
                s32 temp = rand_int(100);

                if (currentEncounter->currentEnemy != NULL) {
                    if (currentEncounter->currentEnemy->flags & ACTOR_FLAG_NO_HEALTH_BAR) {
                        if (temp <= 45) {
                            playerData->merleeSpellType = MERLEE_SPELL_1;
                        } else if (temp <= 90) {
                            playerData->merleeSpellType = MERLEE_SPELL_2;
                        } else {
                            playerData->merleeSpellType = MERLEE_SPELL_EXP_BOOST;
                        }
                    } else if (temp <= 30) {
                        playerData->merleeSpellType = MERLEE_SPELL_1;
                    } else if (temp <= 60) {
                        playerData->merleeSpellType = MERLEE_SPELL_2;
                    } else if (temp <= 80) {
                        playerData->merleeSpellType = MERLEE_SPELL_EXP_BOOST;
                    } else {
                        playerData->merleeSpellType = MERLEE_SPELL_COIN_BOOST;
                    }
                } else if (temp <= 30) {
                    playerData->merleeSpellType = MERLEE_SPELL_1;
                } else if (temp <= 60) {
                    playerData->merleeSpellType = MERLEE_SPELL_2;
                } else if (temp <= 80) {
                    playerData->merleeSpellType = MERLEE_SPELL_EXP_BOOST;
                } else {
                    playerData->merleeSpellType = MERLEE_SPELL_COIN_BOOST;
                }

                temp = rand_int(10) + 6;
                playerData->merleeTurnCount = temp;
            }

            if (playerData->merleeTurnCount >= 2) {
                playerData->merleeTurnCount--;
            } else {
                playerData->merleeTurnCount = 0;
                battleStatus->nextMerleeSpellType = playerData->merleeSpellType;
                playerData->merleeCastsLeft--;
            }
        }
    } while (0); // TODO: required to match
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel smoke_ring_main
/* 3419E0 E002E000 27BDFF90 */  addiu     $sp, $sp, -0x70
/* 3419E4 E002E004 F7B40040 */  sdc1      $f20, 0x40($sp)
/* 3419E8 E002E008 4485A000 */  mtc1      $a1, $f20
/* 3419EC E002E00C F7B80050 */  sdc1      $f24, 0x50($sp)
/* 3419F0 E002E010 4486C000 */  mtc1      $a2, $f24
/* 3419F4 E002E014 AFB20030 */  sw        $s2, 0x30($sp)
/* 3419F8 E002E018 0080902D */  daddu     $s2, $a0, $zero
/* 3419FC E002E01C F7BA0058 */  sdc1      $f26, 0x58($sp)
/* 341A00 E002E020 4487D000 */  mtc1      $a3, $f26
/* 341A04 E002E024 AFBF003C */  sw        $ra, 0x3C($sp)
/* 341A08 E002E028 AFB40038 */  sw        $s4, 0x38($sp)
/* 341A0C E002E02C AFB30034 */  sw        $s3, 0x34($sp)
/* 341A10 E002E030 AFB1002C */  sw        $s1, 0x2C($sp)
/* 341A14 E002E034 AFB00028 */  sw        $s0, 0x28($sp)
/* 341A18 E002E038 F7BE0068 */  sdc1      $f30, 0x68($sp)
/* 341A1C E002E03C F7BC0060 */  sdc1      $f28, 0x60($sp)
/* 341A20 E002E040 F7B60048 */  sdc1      $f22, 0x48($sp)
/* 341A24 E002E044 12400006 */  beqz      $s2, .LE002E060
/* 341A28 E002E048 27A40010 */   addiu    $a0, $sp, 0x10
/* 341A2C E002E04C 24020001 */  addiu     $v0, $zero, 0x1
/* 341A30 E002E050 12420007 */  beq       $s2, $v0, .LE002E070
/* 341A34 E002E054 2413000B */   addiu    $s3, $zero, 0xB
/* 341A38 E002E058 0800B820 */  j         .LE002E080
/* 341A3C E002E05C 00000000 */   nop
.LE002E060:
/* 341A40 E002E060 3C014160 */  lui       $at, (0x41600000 >> 16)
/* 341A44 E002E064 4481B000 */  mtc1      $at, $f22
/* 341A48 E002E068 0800B822 */  j         .LE002E088
/* 341A4C E002E06C 24130007 */   addiu    $s3, $zero, 0x7
.LE002E070:
/* 341A50 E002E070 3C0141E0 */  lui       $at, (0x41E00000 >> 16)
/* 341A54 E002E074 4481B000 */  mtc1      $at, $f22
/* 341A58 E002E078 0800B822 */  j         .LE002E088
/* 341A5C E002E07C 24130009 */   addiu    $s3, $zero, 0x9
.LE002E080:
/* 341A60 E002E080 3C014228 */  lui       $at, (0x42280000 >> 16)
/* 341A64 E002E084 4481B000 */  mtc1      $at, $f22
.LE002E088:
/* 341A68 E002E088 3C02E003 */  lui       $v0, %hi(smoke_ring_init)
/* 341A6C E002E08C 2442E248 */  addiu     $v0, $v0, %lo(smoke_ring_init)
/* 341A70 E002E090 AC820008 */  sw        $v0, 0x8($a0)
/* 341A74 E002E094 3C02E003 */  lui       $v0, %hi(smoke_ring_update)
/* 341A78 E002E098 2442E250 */  addiu     $v0, $v0, %lo(smoke_ring_update)
/* 341A7C E002E09C AC82000C */  sw        $v0, 0xC($a0)
/* 341A80 E002E0A0 3C02E003 */  lui       $v0, %hi(smoke_ring_render)
/* 341A84 E002E0A4 2442E330 */  addiu     $v0, $v0, %lo(smoke_ring_render)
/* 341A88 E002E0A8 AC820010 */  sw        $v0, 0x10($a0)
/* 341A8C E002E0AC 24020017 */  addiu     $v0, $zero, 0x17
/* 341A90 E002E0B0 AC800000 */  sw        $zero, 0x0($a0)
/* 341A94 E002E0B4 AC800014 */  sw        $zero, 0x14($a0)
/* 341A98 E002E0B8 0C080124 */  jal       shim_create_effect_instance
/* 341A9C E002E0BC AC820004 */   sw       $v0, 0x4($a0)
/* 341AA0 E002E0C0 00132100 */  sll       $a0, $s3, 4
/* 341AA4 E002E0C4 00932021 */  addu      $a0, $a0, $s3
/* 341AA8 E002E0C8 00042080 */  sll       $a0, $a0, 2
/* 341AAC E002E0CC 0040802D */  daddu     $s0, $v0, $zero
/* 341AB0 E002E0D0 0C08012C */  jal       shim_general_heap_malloc
/* 341AB4 E002E0D4 AE130008 */   sw       $s3, 0x8($s0)
/* 341AB8 E002E0D8 0040882D */  daddu     $s1, $v0, $zero
/* 341ABC E002E0DC 16200003 */  bnez      $s1, .LE002E0EC
/* 341AC0 E002E0E0 AE11000C */   sw       $s1, 0xC($s0)
.LE002E0E4:
/* 341AC4 E002E0E4 0800B839 */  j         .LE002E0E4
/* 341AC8 E002E0E8 00000000 */   nop
.LE002E0EC:
/* 341ACC E002E0EC 0220202D */  daddu     $a0, $s1, $zero
/* 341AD0 E002E0F0 00132900 */  sll       $a1, $s3, 4
/* 341AD4 E002E0F4 00B32821 */  addu      $a1, $a1, $s3
/* 341AD8 E002E0F8 0C080130 */  jal       shim_mem_clear
/* 341ADC E002E0FC 00052880 */   sll      $a1, $a1, 2
/* 341AE0 E002E100 AE200038 */  sw        $zero, 0x38($s1)
/* 341AE4 E002E104 AE20003C */  sw        $zero, 0x3C($s1)
/* 341AE8 E002E108 A6320000 */  sh        $s2, 0x0($s1)
/* 341AEC E002E10C E6340004 */  swc1      $f20, 0x4($s1)
/* 341AF0 E002E110 E6380008 */  swc1      $f24, 0x8($s1)
/* 341AF4 E002E114 E63A000C */  swc1      $f26, 0xC($s1)
/* 341AF8 E002E118 24120001 */  addiu     $s2, $zero, 0x1
/* 341AFC E002E11C 0253102A */  slt       $v0, $s2, $s3
/* 341B00 E002E120 1040003B */  beqz      $v0, .LE002E210
/* 341B04 E002E124 26310044 */   addiu    $s1, $s1, 0x44
/* 341B08 E002E128 2674FFFF */  addiu     $s4, $s3, -0x1
/* 341B0C E002E12C 26300034 */  addiu     $s0, $s1, 0x34
/* 341B10 E002E130 0000882D */  daddu     $s1, $zero, $zero
/* 341B14 E002E134 3C01C040 */  lui       $at, (0xC0400000 >> 16)
/* 341B18 E002E138 4481F000 */  mtc1      $at, $f30
/* 341B1C E002E13C 3C013E4C */  lui       $at, (0x3E4CCCCC >> 16)
/* 341B20 E002E140 3421CCCC */  ori       $at, $at, (0x3E4CCCCC & 0xFFFF)
/* 341B24 E002E144 4481E000 */  mtc1      $at, $f28
/* 341B28 E002E148 3C013FE0 */  lui       $at, (0x3FE00000 >> 16)
/* 341B2C E002E14C 4481D000 */  mtc1      $at, $f26
/* 341B30 E002E150 3C01BE23 */  lui       $at, (0xBE23D70A >> 16)
/* 341B34 E002E154 3421D70A */  ori       $at, $at, (0xBE23D70A & 0xFFFF)
/* 341B38 E002E158 4481C000 */  mtc1      $at, $f24
.LE002E15C:
/* 341B3C E002E15C 16800002 */  bnez      $s4, .LE002E168
/* 341B40 E002E160 0234001A */   div      $zero, $s1, $s4
/* 341B44 E002E164 0007000D */  break     7
.LE002E168:
/* 341B48 E002E168 2401FFFF */  addiu     $at, $zero, -0x1
/* 341B4C E002E16C 16810004 */  bne       $s4, $at, .LE002E180
/* 341B50 E002E170 3C018000 */   lui      $at, (0x80000000 >> 16)
/* 341B54 E002E174 16210002 */  bne       $s1, $at, .LE002E180
/* 341B58 E002E178 00000000 */   nop
/* 341B5C E002E17C 0006000D */  break     6
.LE002E180:
/* 341B60 E002E180 00001812 */  mflo      $v1
/* 341B64 E002E184 E61EFFDC */  swc1      $f30, -0x24($s0)
/* 341B68 E002E188 E61CFFE0 */  swc1      $f28, -0x20($s0)
/* 341B6C E002E18C AE00FFE4 */  sw        $zero, -0x1C($s0)
/* 341B70 E002E190 AE00FFE8 */  sw        $zero, -0x18($s0)
/* 341B74 E002E194 E61AFFEC */  swc1      $f26, -0x14($s0)
/* 341B78 E002E198 E618FFF0 */  swc1      $f24, -0x10($s0)
/* 341B7C E002E19C AE00FFF4 */  sw        $zero, -0xC($s0)
/* 341B80 E002E1A0 AE00FFF8 */  sw        $zero, -0x8($s0)
/* 341B84 E002E1A4 4483A000 */  mtc1      $v1, $f20
/* 341B88 E002E1A8 00000000 */  nop
/* 341B8C E002E1AC 4680A520 */  cvt.s.w   $f20, $f20
/* 341B90 E002E1B0 0C080140 */  jal       shim_sin_deg
/* 341B94 E002E1B4 4600A306 */   mov.s    $f12, $f20
/* 341B98 E002E1B8 46000007 */  neg.s     $f0, $f0
/* 341B9C E002E1BC 46160002 */  mul.s     $f0, $f0, $f22
/* 341BA0 E002E1C0 00000000 */  nop
/* 341BA4 E002E1C4 4600A306 */  mov.s     $f12, $f20
/* 341BA8 E002E1C8 0C080144 */  jal       shim_cos_deg
/* 341BAC E002E1CC E600FFD0 */   swc1     $f0, -0x30($s0)
/* 341BB0 E002E1D0 46000007 */  neg.s     $f0, $f0
/* 341BB4 E002E1D4 46160002 */  mul.s     $f0, $f0, $f22
/* 341BB8 E002E1D8 00000000 */  nop
/* 341BBC E002E1DC 26310168 */  addiu     $s1, $s1, 0x168
/* 341BC0 E002E1E0 26520001 */  addiu     $s2, $s2, 0x1
/* 341BC4 E002E1E4 4600A306 */  mov.s     $f12, $f20
/* 341BC8 E002E1E8 AE00FFD8 */  sw        $zero, -0x28($s0)
/* 341BCC E002E1EC 0C080140 */  jal       shim_sin_deg
/* 341BD0 E002E1F0 E600FFD4 */   swc1     $f0, -0x2C($s0)
/* 341BD4 E002E1F4 4600A306 */  mov.s     $f12, $f20
/* 341BD8 E002E1F8 0C080144 */  jal       shim_cos_deg
/* 341BDC E002E1FC E600FFFC */   swc1     $f0, -0x4($s0)
/* 341BE0 E002E200 E6000000 */  swc1      $f0, 0x0($s0)
/* 341BE4 E002E204 0253102A */  slt       $v0, $s2, $s3
/* 341BE8 E002E208 1440FFD4 */  bnez      $v0, .LE002E15C
/* 341BEC E002E20C 26100044 */   addiu    $s0, $s0, 0x44
.LE002E210:
/* 341BF0 E002E210 8FBF003C */  lw        $ra, 0x3C($sp)
/* 341BF4 E002E214 8FB40038 */  lw        $s4, 0x38($sp)
/* 341BF8 E002E218 8FB30034 */  lw        $s3, 0x34($sp)
/* 341BFC E002E21C 8FB20030 */  lw        $s2, 0x30($sp)
/* 341C00 E002E220 8FB1002C */  lw        $s1, 0x2C($sp)
/* 341C04 E002E224 8FB00028 */  lw        $s0, 0x28($sp)
/* 341C08 E002E228 D7BE0068 */  ldc1      $f30, 0x68($sp)
/* 341C0C E002E22C D7BC0060 */  ldc1      $f28, 0x60($sp)
/* 341C10 E002E230 D7BA0058 */  ldc1      $f26, 0x58($sp)
/* 341C14 E002E234 D7B80050 */  ldc1      $f24, 0x50($sp)
/* 341C18 E002E238 D7B60048 */  ldc1      $f22, 0x48($sp)
/* 341C1C E002E23C D7B40040 */  ldc1      $f20, 0x40($sp)
/* 341C20 E002E240 03E00008 */  jr        $ra
/* 341C24 E002E244 27BD0070 */   addiu    $sp, $sp, 0x70

### DECOMPILED C INSTRUCTIONS:

void smoke_ring_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3) {
    EffectBlueprint bp;
    EffectBlueprint* bpPtr = &bp;
    EffectInstance* effect;
    SmokeRingFXData* part;
    s32 numParts;
    f32 factor;
    s32 i;

    switch (arg0) {
        case 0:
            numParts = 7;
            factor = 14.0f;
            break;
        case 1:
            numParts = 9;
            factor = 28.0f;
            break;
        default:
            numParts = 11;
            factor = 42.0f;
            break;
    }

    bpPtr->init = smoke_ring_init;
    bpPtr->update = smoke_ring_update;
    bpPtr->renderWorld = smoke_ring_render;
    bpPtr->unk_00 = 0;
    bpPtr->renderUI = NULL;
    bpPtr->effectID = EFFECT_SMOKE_RING;

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

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

    part->unk_38 = 0;
    part->unk_3C = 0;
    part->unk_00 = arg0;
    part->unk_04 = arg1;
    part->unk_08 = arg2;
    part->unk_0C = arg3;

    part++;
    for (i = 1; i < numParts; i++, part++) {
        f32 angle = (i - 1) * 360 / (numParts - 1);

        part->unk_10 = -3.0f;
        part->unk_14 = 0.19999999f;
        part->unk_18 = 0;
        part->unk_1C = 0;
        part->unk_20 = 1.75f;
        part->unk_24 = -0.16f;
        part->unk_28 = 0;
        part->unk_2C = 0;
        part->unk_04 = -shim_sin_deg(angle) * factor;
        part->unk_08 = -shim_cos_deg(angle) * factor;
        part->unk_0C = 0;
        part->unk_30 = shim_sin_deg(angle);
        part->unk_34 = shim_cos_deg(angle);
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel evt_set_float_variable
/* ECFF0 802C8640 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* ECFF4 802C8644 AFB10014 */  sw        $s1, 0x14($sp)
/* ECFF8 802C8648 0080882D */  daddu     $s1, $a0, $zero
/* ECFFC 802C864C 3C02EFE8 */  lui       $v0, (0xEFE82080 >> 16)
/* ED000 802C8650 34422080 */  ori       $v0, $v0, (0xEFE82080 & 0xFFFF)
/* ED004 802C8654 44866000 */  mtc1      $a2, $f12
/* ED008 802C8658 0045102A */  slt       $v0, $v0, $a1
/* ED00C 802C865C AFBF001C */  sw        $ra, 0x1C($sp)
/* ED010 802C8660 AFB20018 */  sw        $s2, 0x18($sp)
/* ED014 802C8664 1040003D */  beqz      $v0, .L802C875C
/* ED018 802C8668 AFB00010 */   sw       $s0, 0x10($sp)
/* ED01C 802C866C 3C02F2E3 */  lui       $v0, (0xF2E31100 >> 16)
/* ED020 802C8670 34421100 */  ori       $v0, $v0, (0xF2E31100 & 0xFFFF)
/* ED024 802C8674 0045102A */  slt       $v0, $v0, $a1
/* ED028 802C8678 10400038 */  beqz      $v0, .L802C875C
/* ED02C 802C867C 3C02F545 */   lui      $v0, (0xF5456B00 >> 16)
/* ED030 802C8680 34426B00 */  ori       $v0, $v0, (0xF5456B00 & 0xFFFF)
/* ED034 802C8684 0045102A */  slt       $v0, $v0, $a1
/* ED038 802C8688 1440000E */  bnez      $v0, .L802C86C4
/* ED03C 802C868C 3C02FB3B */   lui      $v0, (0xFB3B4C00 >> 16)
/* ED040 802C8690 3C020B53 */  lui       $v0, (0xB532B80 >> 16)
/* ED044 802C8694 34422B80 */  ori       $v0, $v0, (0xB532B80 & 0xFFFF)
/* ED048 802C8698 00A22821 */  addu      $a1, $a1, $v0
/* ED04C 802C869C 8E22013C */  lw        $v0, 0x13C($s1)
/* ED050 802C86A0 00058080 */  sll       $s0, $a1, 2
/* ED054 802C86A4 02021021 */  addu      $v0, $s0, $v0
/* ED058 802C86A8 0C0B125B */  jal       evt_float_to_fixed_var
/* ED05C 802C86AC 8C520000 */   lw       $s2, 0x0($v0)
/* ED060 802C86B0 8E23013C */  lw        $v1, 0x13C($s1)
/* ED064 802C86B4 0240202D */  daddu     $a0, $s2, $zero
/* ED068 802C86B8 02038021 */  addu      $s0, $s0, $v1
/* ED06C 802C86BC 080B221C */  j         .L802C8870
/* ED070 802C86C0 AE020000 */   sw       $v0, 0x0($s0)
.L802C86C4:
/* ED074 802C86C4 34424C00 */  ori       $v0, $v0, (0xFB3B4C00 & 0xFFFF)
/* ED078 802C86C8 0045102A */  slt       $v0, $v0, $a1
/* ED07C 802C86CC 54400025 */  bnel      $v0, $zero, .L802C8764
/* ED080 802C86D0 3C02FC6C */   lui      $v0, (0xFC6C7900 >> 16)
/* ED084 802C86D4 3C02055D */  lui       $v0, (0x55D4A80 >> 16)
/* ED088 802C86D8 34424A80 */  ori       $v0, $v0, (0x55D4A80 & 0xFFFF)
/* ED08C 802C86DC 00A22821 */  addu      $a1, $a1, $v0
/* ED090 802C86E0 04A10002 */  bgez      $a1, .L802C86EC
/* ED094 802C86E4 00A0102D */   daddu    $v0, $a1, $zero
/* ED098 802C86E8 24A2001F */  addiu     $v0, $a1, 0x1F
.L802C86EC:
/* ED09C 802C86EC 00023143 */  sra       $a2, $v0, 5
/* ED0A0 802C86F0 00C0202D */  daddu     $a0, $a2, $zero
/* ED0A4 802C86F4 00041140 */  sll       $v0, $a0, 5
/* ED0A8 802C86F8 44800000 */  mtc1      $zero, $f0
/* ED0AC 802C86FC 00000000 */  nop
/* ED0B0 802C8700 46006032 */  c.eq.s    $f12, $f0
/* ED0B4 802C8704 00000000 */  nop
/* ED0B8 802C8708 4501000A */  bc1t      .L802C8734
/* ED0BC 802C870C 00A23023 */   subu     $a2, $a1, $v0
/* ED0C0 802C8710 3C02802E */  lui       $v0, %hi(gMapFlags)
/* ED0C4 802C8714 8C42A480 */  lw        $v0, %lo(gMapFlags)($v0)
/* ED0C8 802C8718 00042080 */  sll       $a0, $a0, 2
/* ED0CC 802C871C 00822021 */  addu      $a0, $a0, $v0
/* ED0D0 802C8720 24020001 */  addiu     $v0, $zero, 0x1
/* ED0D4 802C8724 8C830000 */  lw        $v1, 0x0($a0)
/* ED0D8 802C8728 00C21004 */  sllv      $v0, $v0, $a2
/* ED0DC 802C872C 080B21D6 */  j         .L802C8758
/* ED0E0 802C8730 00621825 */   or       $v1, $v1, $v0
.L802C8734:
/* ED0E4 802C8734 3C02802E */  lui       $v0, %hi(gMapFlags)
/* ED0E8 802C8738 8C42A480 */  lw        $v0, %lo(gMapFlags)($v0)
/* ED0EC 802C873C 00042080 */  sll       $a0, $a0, 2
/* ED0F0 802C8740 00822021 */  addu      $a0, $a0, $v0
/* ED0F4 802C8744 24020001 */  addiu     $v0, $zero, 0x1
/* ED0F8 802C8748 00C21004 */  sllv      $v0, $v0, $a2
/* ED0FC 802C874C 8C830000 */  lw        $v1, 0x0($a0)
/* ED100 802C8750 00021027 */  nor       $v0, $zero, $v0
/* ED104 802C8754 00621824 */  and       $v1, $v1, $v0
.L802C8758:
/* ED108 802C8758 AC830000 */  sw        $v1, 0x0($a0)
.L802C875C:
/* ED10C 802C875C 080B221E */  j         .L802C8878
/* ED110 802C8760 46006006 */   mov.s    $f0, $f12
.L802C8764:
/* ED114 802C8764 34427900 */  ori       $v0, $v0, (0xFC6C7900 & 0xFFFF)
/* ED118 802C8768 0045102A */  slt       $v0, $v0, $a1
/* ED11C 802C876C 54400020 */  bnel      $v0, $zero, .L802C87F0
/* ED120 802C8770 3C02FD9D */   lui      $v0, (0xFD9DA600 >> 16)
/* ED124 802C8774 3C02042C */  lui       $v0, (0x42C1D80 >> 16)
/* ED128 802C8778 34421D80 */  ori       $v0, $v0, (0x42C1D80 & 0xFFFF)
/* ED12C 802C877C 00A22821 */  addu      $a1, $a1, $v0
/* ED130 802C8780 04A10002 */  bgez      $a1, .L802C878C
/* ED134 802C8784 00A0102D */   daddu    $v0, $a1, $zero
/* ED138 802C8788 24A2001F */  addiu     $v0, $a1, 0x1F
.L802C878C:
/* ED13C 802C878C 00023143 */  sra       $a2, $v0, 5
/* ED140 802C8790 00C0182D */  daddu     $v1, $a2, $zero
/* ED144 802C8794 00031140 */  sll       $v0, $v1, 5
/* ED148 802C8798 44800000 */  mtc1      $zero, $f0
/* ED14C 802C879C 00000000 */  nop
/* ED150 802C87A0 46006032 */  c.eq.s    $f12, $f0
/* ED154 802C87A4 00000000 */  nop
/* ED158 802C87A8 45010008 */  bc1t      .L802C87CC
/* ED15C 802C87AC 00A23023 */   subu     $a2, $a1, $v0
/* ED160 802C87B0 00031080 */  sll       $v0, $v1, 2
/* ED164 802C87B4 02221021 */  addu      $v0, $s1, $v0
/* ED168 802C87B8 24030001 */  addiu     $v1, $zero, 0x1
/* ED16C 802C87BC 8C4400C4 */  lw        $a0, 0xC4($v0)
/* ED170 802C87C0 00C31804 */  sllv      $v1, $v1, $a2
/* ED174 802C87C4 080B21FA */  j         .L802C87E8
/* ED178 802C87C8 00832025 */   or       $a0, $a0, $v1
.L802C87CC:
/* ED17C 802C87CC 00031080 */  sll       $v0, $v1, 2
/* ED180 802C87D0 02221021 */  addu      $v0, $s1, $v0
/* ED184 802C87D4 24030001 */  addiu     $v1, $zero, 0x1
/* ED188 802C87D8 00C31804 */  sllv      $v1, $v1, $a2
/* ED18C 802C87DC 8C4400C4 */  lw        $a0, 0xC4($v0)
/* ED190 802C87E0 00031827 */  nor       $v1, $zero, $v1
/* ED194 802C87E4 00832024 */  and       $a0, $a0, $v1
.L802C87E8:
/* ED198 802C87E8 080B21D7 */  j         .L802C875C
/* ED19C 802C87EC AC4400C4 */   sw       $a0, 0xC4($v0)
.L802C87F0:
/* ED1A0 802C87F0 3442A600 */  ori       $v0, $v0, (0xFD9DA600 & 0xFFFF)
/* ED1A4 802C87F4 0045102A */  slt       $v0, $v0, $a1
/* ED1A8 802C87F8 14400010 */  bnez      $v0, .L802C883C
/* ED1AC 802C87FC 3C02FECE */   lui      $v0, (0xFECED300 >> 16)
/* ED1B0 802C8800 3C0202FA */  lui       $v0, (0x2FAF080 >> 16)
/* ED1B4 802C8804 3442F080 */  ori       $v0, $v0, (0x2FAF080 & 0xFFFF)
/* ED1B8 802C8808 00A22821 */  addu      $a1, $a1, $v0
/* ED1BC 802C880C 3C11802E */  lui       $s1, %hi(gMapVars)
/* ED1C0 802C8810 2631A484 */  addiu     $s1, $s1, %lo(gMapVars)
/* ED1C4 802C8814 8E220000 */  lw        $v0, 0x0($s1)
/* ED1C8 802C8818 00058080 */  sll       $s0, $a1, 2
/* ED1CC 802C881C 02021021 */  addu      $v0, $s0, $v0
/* ED1D0 802C8820 0C0B125B */  jal       evt_float_to_fixed_var
/* ED1D4 802C8824 8C520000 */   lw       $s2, 0x0($v0)
/* ED1D8 802C8828 8E230000 */  lw        $v1, 0x0($s1)
/* ED1DC 802C882C 0240202D */  daddu     $a0, $s2, $zero
/* ED1E0 802C8830 02038021 */  addu      $s0, $s0, $v1
/* ED1E4 802C8834 080B221C */  j         .L802C8870
/* ED1E8 802C8838 AE020000 */   sw       $v0, 0x0($s0)
.L802C883C:
/* ED1EC 802C883C 3442D300 */  ori       $v0, $v0, (0xFECED300 & 0xFFFF)
/* ED1F0 802C8840 0045102A */  slt       $v0, $v0, $a1
/* ED1F4 802C8844 1440000C */  bnez      $v0, .L802C8878
/* ED1F8 802C8848 46006006 */   mov.s    $f0, $f12
/* ED1FC 802C884C 3C0201C9 */  lui       $v0, (0x1C9C380 >> 16)
/* ED200 802C8850 3442C380 */  ori       $v0, $v0, (0x1C9C380 & 0xFFFF)
/* ED204 802C8854 00A22821 */  addu      $a1, $a1, $v0
/* ED208 802C8858 00058080 */  sll       $s0, $a1, 2
/* ED20C 802C885C 02308021 */  addu      $s0, $s1, $s0
/* ED210 802C8860 0C0B125B */  jal       evt_float_to_fixed_var
/* ED214 802C8864 8E120084 */   lw       $s2, 0x84($s0)
/* ED218 802C8868 AE020084 */  sw        $v0, 0x84($s0)
/* ED21C 802C886C 0240202D */  daddu     $a0, $s2, $zero
.L802C8870:
/* ED220 802C8870 0C0B1248 */  jal       evt_fixed_var_to_float
/* ED224 802C8874 00000000 */   nop
.L802C8878:
/* ED228 802C8878 8FBF001C */  lw        $ra, 0x1C($sp)
/* ED22C 802C887C 8FB20018 */  lw        $s2, 0x18($sp)
/* ED230 802C8880 8FB10014 */  lw        $s1, 0x14($sp)
/* ED234 802C8884 8FB00010 */  lw        $s0, 0x10($sp)
/* ED238 802C8888 03E00008 */  jr        $ra
/* ED23C 802C888C 27BD0020 */   addiu    $sp, $sp, 0x20

### DECOMPILED C INSTRUCTIONS:

f32 evt_set_float_variable(Evt* script, Bytecode var, f32 value) {
    s32 temp;
    s32 oldValue;

    if (var <= EVT_LIMIT) {
        return value;
    } else if (var <= EVT_FIXED_CUTOFF) {
        return value;
    } else if (var <= EVT_ARRAY_VAR_CUTOFF) {
        var = EVT_INDEX_OF_ARRAY_VAR(var);
        oldValue = script->array[var];
        script->array[var] = evt_float_to_fixed_var(value);
        return evt_fixed_var_to_float(oldValue);
    } else if (var <= EVT_MAP_FLAG_CUTOFF) {
        var = EVT_INDEX_OF_MAP_FLAG(var);
        temp = var % 32;
        if (value) {
            gMapFlags[var / 32] |= 1 << temp;
        } else {
            gMapFlags[var / 32] &= ~(1 << temp);
        }
        return value;
    } else if (var <= EVT_LOCAL_FLAG_CUTOFF) {
        var = EVT_INDEX_OF_LOCAL_FLAG(var);
        temp = var % 32;
        if (value) {
            script->varFlags[var / 32] |= 1 << temp;
        } else {
            script->varFlags[var / 32] &= ~(1 << temp);
        }
        return value;
    } else if (var <= EVT_MAP_VAR_CUTOFF) {
        var = EVT_INDEX_OF_MAP_VAR(var);
        oldValue = gMapVars[var];
        gMapVars[var] = evt_float_to_fixed_var(value);
        return evt_fixed_var_to_float(oldValue);
    } else if (var <= EVT_LOCAL_VAR_CUTOFF) {
        var = EVT_INDEX_OF_LOCAL_VAR(var);
        oldValue = script->varTable[var];
        script->varTable[var] = evt_float_to_fixed_var(value);
        return evt_fixed_var_to_float(oldValue);
    } else {
        return value;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel state_init_logos
/* F270 80033E70 27BDFFD0 */  addiu     $sp, $sp, -0x30
/* F274 80033E74 AFBF0024 */  sw        $ra, 0x24($sp)
/* F278 80033E78 AFB20020 */  sw        $s2, 0x20($sp)
/* F27C 80033E7C AFB1001C */  sw        $s1, 0x1C($sp)
/* F280 80033E80 AFB00018 */  sw        $s0, 0x18($sp)
/* F284 80033E84 0C00AB00 */  jal       general_heap_create
/* F288 80033E88 F7B40028 */   sdc1     $f20, 0x28($sp)
/* F28C 80033E8C 3C128007 */  lui       $s2, %hi(gGameStatusPtr)
/* F290 80033E90 2652419C */  addiu     $s2, $s2, %lo(gGameStatusPtr)
/* F294 80033E94 8E420000 */  lw        $v0, 0x0($s2)
/* F298 80033E98 A04000AC */  sb        $zero, 0xAC($v0)
/* F29C 80033E9C 8E420000 */  lw        $v0, 0x0($s2)
/* F2A0 80033EA0 A04000AD */  sb        $zero, 0xAD($v0)
/* F2A4 80033EA4 8E420000 */  lw        $v0, 0x0($s2)
/* F2A8 80033EA8 240400FF */  addiu     $a0, $zero, 0xFF
/* F2AC 80033EAC 0C00CDF4 */  jal       intro_logos_set_fade_alpha
/* F2B0 80033EB0 A04000AE */   sb       $zero, 0xAE($v0)
/* F2B4 80033EB4 0C00CDF8 */  jal       intro_logos_set_fade_color
/* F2B8 80033EB8 0000202D */   daddu    $a0, $zero, $zero
/* F2BC 80033EBC 3C110022 */  lui       $s1, %hi(D_2191B0)
/* F2C0 80033EC0 263191B0 */  addiu     $s1, $s1, %lo(D_2191B0)
/* F2C4 80033EC4 3C100020 */  lui       $s0, %hi(D_1FE1B0)
/* F2C8 80033EC8 2610E1B0 */  addiu     $s0, $s0, %lo(D_1FE1B0)
/* F2CC 80033ECC 0C00AB39 */  jal       heap_malloc
/* F2D0 80033ED0 02302023 */   subu     $a0, $s1, $s0
/* F2D4 80033ED4 0200202D */  daddu     $a0, $s0, $zero
/* F2D8 80033ED8 0220282D */  daddu     $a1, $s1, $zero
/* F2DC 80033EDC 0040302D */  daddu     $a2, $v0, $zero
/* F2E0 80033EE0 3C10800A */  lui       $s0, %hi(gLogosImages)
/* F2E4 80033EE4 26100910 */  addiu     $s0, $s0, %lo(gLogosImages)
/* F2E8 80033EE8 0C00A5CF */  jal       dma_copy
/* F2EC 80033EEC AE060000 */   sw       $a2, 0x0($s0)
/* F2F0 80033EF0 3C040001 */  lui       $a0, (0x15000 >> 16)
/* F2F4 80033EF4 8E020000 */  lw        $v0, 0x0($s0)
/* F2F8 80033EF8 34845000 */  ori       $a0, $a0, (0x15000 & 0xFFFF)
/* F2FC 80033EFC 24437000 */  addiu     $v1, $v0, 0x7000
/* F300 80033F00 3C01800A */  lui       $at, %hi(gLogosImage1)
/* F304 80033F04 AC220918 */  sw        $v0, %lo(gLogosImage1)($at)
/* F308 80033F08 00441021 */  addu      $v0, $v0, $a0
/* F30C 80033F0C 3C01800A */  lui       $at, %hi(gLogosImage3)
/* F310 80033F10 AC230914 */  sw        $v1, %lo(gLogosImage3)($at)
/* F314 80033F14 3C01800A */  lui       $at, %hi(gLogosImage2)
/* F318 80033F18 AC22091C */  sw        $v0, %lo(gLogosImage2)($at)
/* F31C 80033F1C 0C018028 */  jal       nuContRmbForceStop
/* F320 80033F20 00000000 */   nop
/* F324 80033F24 0C00B7BD */  jal       create_cameras_a
/* F328 80033F28 00000000 */   nop
/* F32C 80033F2C 0000202D */  daddu     $a0, $zero, $zero
/* F330 80033F30 2405000C */  addiu     $a1, $zero, 0xC
/* F334 80033F34 2406001C */  addiu     $a2, $zero, 0x1C
/* F338 80033F38 3C10800B */  lui       $s0, %hi(gCameras)
/* F33C 80033F3C 26101D80 */  addiu     $s0, $s0, %lo(gCameras)
/* F340 80033F40 24020006 */  addiu     $v0, $zero, 0x6
/* F344 80033F44 A6020004 */  sh        $v0, 0x4($s0)
/* F348 80033F48 24020001 */  addiu     $v0, $zero, 0x1
/* F34C 80033F4C A6020006 */  sh        $v0, 0x6($s0)
/* F350 80033F50 24020010 */  addiu     $v0, $zero, 0x10
/* F354 80033F54 A6020012 */  sh        $v0, 0x12($s0)
/* F358 80033F58 24021000 */  addiu     $v0, $zero, 0x1000
/* F35C 80033F5C A6020014 */  sh        $v0, 0x14($s0)
/* F360 80033F60 240200B8 */  addiu     $v0, $zero, 0xB8
/* F364 80033F64 3C0141C8 */  lui       $at, (0x41C80000 >> 16)
/* F368 80033F68 4481A000 */  mtc1      $at, $f20
/* F36C 80033F6C 24070128 */  addiu     $a3, $zero, 0x128
/* F370 80033F70 3C018007 */  lui       $at, %hi(gCurrentCameraID)
/* F374 80033F74 AC207410 */  sw        $zero, %lo(gCurrentCameraID)($at)
/* F378 80033F78 E6140018 */  swc1      $f20, 0x18($s0)
/* F37C 80033F7C AFA20010 */  sw        $v0, 0x10($sp)
/* F380 80033F80 96020000 */  lhu       $v0, 0x0($s0)
/* F384 80033F84 96030558 */  lhu       $v1, 0x558($s0)
/* F388 80033F88 34420002 */  ori       $v0, $v0, 0x2
/* F38C 80033F8C A6020000 */  sh        $v0, 0x0($s0)
/* F390 80033F90 96020AB0 */  lhu       $v0, 0xAB0($s0)
/* F394 80033F94 34630002 */  ori       $v1, $v1, 0x2
/* F398 80033F98 A6030558 */  sh        $v1, 0x558($s0)
/* F39C 80033F9C 96031008 */  lhu       $v1, 0x1008($s0)
/* F3A0 80033FA0 34420002 */  ori       $v0, $v0, 0x2
/* F3A4 80033FA4 34630002 */  ori       $v1, $v1, 0x2
/* F3A8 80033FA8 A6020AB0 */  sh        $v0, 0xAB0($s0)
/* F3AC 80033FAC 0C00B8C5 */  jal       set_cam_viewport
/* F3B0 80033FB0 A6031008 */   sh       $v1, 0x1008($s0)
/* F3B4 80033FB4 3C0143FA */  lui       $at, (0x43FA0000 >> 16)
/* F3B8 80033FB8 44810000 */  mtc1      $at, $f0
/* F3BC 80033FBC 3C01447A */  lui       $at, (0x447A0000 >> 16)
/* F3C0 80033FC0 44811000 */  mtc1      $at, $f2
/* F3C4 80033FC4 3C0144BB */  lui       $at, (0x44BB8000 >> 16)
/* F3C8 80033FC8 34218000 */  ori       $at, $at, (0x44BB8000 & 0xFFFF)
/* F3CC 80033FCC 44812000 */  mtc1      $at, $f4
/* F3D0 80033FD0 3C014316 */  lui       $at, (0x43160000 >> 16)
/* F3D4 80033FD4 44813000 */  mtc1      $at, $f6
/* F3D8 80033FD8 24020028 */  addiu     $v0, $zero, 0x28
/* F3DC 80033FDC A602001E */  sh        $v0, 0x1E($s0)
/* F3E0 80033FE0 24020064 */  addiu     $v0, $zero, 0x64
/* F3E4 80033FE4 A600002C */  sh        $zero, 0x2C($s0)
/* F3E8 80033FE8 A600002E */  sh        $zero, 0x2E($s0)
/* F3EC 80033FEC A6000030 */  sh        $zero, 0x30($s0)
/* F3F0 80033FF0 E6140054 */  swc1      $f20, 0x54($s0)
/* F3F4 80033FF4 E6140058 */  swc1      $f20, 0x58($s0)
/* F3F8 80033FF8 A600001C */  sh        $zero, 0x1C($s0)
/* F3FC 80033FFC A6020020 */  sh        $v0, 0x20($s0)
/* F400 80034000 A6000022 */  sh        $zero, 0x22($s0)
/* F404 80034004 E600003C */  swc1      $f0, 0x3C($s0)
/* F408 80034008 E6020040 */  swc1      $f2, 0x40($s0)
/* F40C 8003400C E6040044 */  swc1      $f4, 0x44($s0)
/* F410 80034010 0C0B0C77 */  jal       clear_script_list
/* F414 80034014 E606005C */   swc1     $f6, 0x5C($s0)
/* F418 80034018 0C048C2E */  jal       clear_worker_list
/* F41C 8003401C 00000000 */   nop
/* F420 80034020 0C047624 */  jal       clear_render_tasks
/* F424 80034024 00000000 */   nop
/* F428 80034028 0C0B763E */  jal       spr_init_sprites
/* F42C 8003402C 0000202D */   daddu    $a0, $zero, $zero
/* F430 80034030 0C047889 */  jal       clear_animator_list
/* F434 80034034 00000000 */   nop
/* F438 80034038 0C0482EC */  jal       clear_entity_models
/* F43C 8003403C 00000000 */   nop
/* F440 80034040 0C00E12F */  jal       clear_npcs
/* F444 80034044 00000000 */   nop
/* F448 80034048 0C050440 */  jal       hud_element_clear_cache
/* F44C 8003404C 00000000 */   nop
/* F450 80034050 0C05177E */  jal       reset_background_settings
/* F454 80034054 00000000 */   nop
/* F458 80034058 0C04432E */  jal       clear_entity_data
/* F45C 8003405C 24040001 */   addiu    $a0, $zero, 0x1
/* F460 80034060 0C016727 */  jal       clear_effect_data
/* F464 80034064 00000000 */   nop
/* F468 80034068 3C03800A */  lui       $v1, %hi(gOverrideFlags)
/* F46C 8003406C 2463A650 */  addiu     $v1, $v1, %lo(gOverrideFlags)
/* F470 80034070 8C620000 */  lw        $v0, 0x0($v1)
/* F474 80034074 34420002 */  ori       $v0, $v0, 0x2
/* F478 80034078 0C00CE1D */  jal       intro_logos_update_fade
/* F47C 8003407C AC620000 */   sw       $v0, 0x0($v1)
/* F480 80034080 8E420000 */  lw        $v0, 0x0($s2)
/* F484 80034084 A4400148 */  sh        $zero, 0x148($v0)
/* F488 80034088 8FBF0024 */  lw        $ra, 0x24($sp)
/* F48C 8003408C 8FB20020 */  lw        $s2, 0x20($sp)
/* F490 80034090 8FB1001C */  lw        $s1, 0x1C($sp)
/* F494 80034094 8FB00018 */  lw        $s0, 0x18($sp)
/* F498 80034098 D7B40028 */  ldc1      $f20, 0x28($sp)
/* F49C 8003409C 03E00008 */  jr        $ra
/* F4A0 800340A0 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

void state_init_logos(void) {
    s8* romStart;
    s8* romEnd;

    general_heap_create();
    gGameStatusPtr->introState = INTRO_STATE_0;
    gGameStatusPtr->introCounter = 0;
    gGameStatusPtr->bSkipIntro = FALSE;
    intro_logos_set_fade_alpha(255);
    intro_logos_set_fade_color(0);

    romEnd = logos_ROM_END;
    romStart = logos_ROM_START;
    gLogosImages = heap_malloc(romEnd - romStart);
    dma_copy(romStart, romEnd, gLogosImages);

    gLogosImage1 = gLogosImages + 0x0;
    gLogosImage3 = gLogosImages + 0x7000;
    gLogosImage2 = gLogosImages + 0x15000;

    nuContRmbForceStop();
    create_cameras_a();
    gCameras[CAM_DEFAULT].updateMode = CAM_UPDATE_MODE_6;
    gCameras[CAM_DEFAULT].needsInit = TRUE;
    gCameras[CAM_DEFAULT].nearClip = 16;
    gCameras[CAM_DEFAULT].farClip = 4096;
    gCurrentCameraID = CAM_DEFAULT;
    gCameras[CAM_DEFAULT].vfov = 25.0f;
    gCameras[CAM_DEFAULT].flags |= CAMERA_FLAG_DISABLED;
    gCameras[CAM_BATTLE].flags |= CAMERA_FLAG_DISABLED;
    gCameras[CAM_TATTLE].flags |= CAMERA_FLAG_DISABLED;
    gCameras[CAM_3].flags |= CAMERA_FLAG_DISABLED;
    set_cam_viewport(0, 12, 28, 296, 184);
    gCameras[CAM_DEFAULT].auxBoomLength = 40;
    gCameras[CAM_DEFAULT].bgColor[0] = 0;
    gCameras[CAM_DEFAULT].bgColor[1] = 0;
    gCameras[CAM_DEFAULT].bgColor[2] = 0;
    gCameras[CAM_DEFAULT].lookAt_obj_target.x = 25.0f;
    gCameras[CAM_DEFAULT].lookAt_obj_target.y = 25.0f;
    gCameras[CAM_DEFAULT].auxPitch = 0;
    gCameras[CAM_DEFAULT].lookAt_dist = 100;
    gCameras[CAM_DEFAULT].auxBoomPitch = 0;
    gCameras[CAM_DEFAULT].lookAt_eye.x = 500.0f;
    gCameras[CAM_DEFAULT].lookAt_eye.y = 1000.0f;
    gCameras[CAM_DEFAULT].lookAt_eye.z = 1500.0f;
    gCameras[CAM_DEFAULT].lookAt_obj_target.z = 150.0f;
    clear_script_list();
    clear_worker_list();
    clear_render_tasks();
    spr_init_sprites(PLAYER_SPRITES_MARIO_WORLD);
    clear_animator_list();
    clear_entity_models();
    clear_npcs();
    hud_element_clear_cache();
    reset_background_settings();
    clear_entity_data(1);
    clear_effect_data();
    gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_RENDER_WORLD;
    intro_logos_update_fade();
    gGameStatusPtr->backgroundFlags = 0;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_8024C944
/* 17B224 8024C944 27BDFFC0 */  addiu     $sp, $sp, -0x40
/* 17B228 8024C948 AFB00030 */  sw        $s0, 0x30($sp)
/* 17B22C 8024C94C 3C10800B */  lui       $s0, %hi(gCameras + 0x558)
/* 17B230 8024C950 261022D8 */  addiu     $s0, $s0, %lo(gCameras + 0x558)
/* 17B234 8024C954 3C06800E */  lui       $a2, %hi(gBattleStatus)
/* 17B238 8024C958 24C6C070 */  addiu     $a2, $a2, %lo(gBattleStatus)
/* 17B23C 8024C95C AFBF0034 */  sw        $ra, 0x34($sp)
/* 17B240 8024C960 10A0001C */  beqz      $a1, .L8024C9D4
.L8024C964:
/* 17B244 8024C964 F7B40038 */   sdc1     $f20, 0x38($sp)
/* 17B248 8024C968 C6000054 */  lwc1      $f0, 0x54($s0)
/* 17B24C 8024C96C C6020058 */  lwc1      $f2, 0x58($s0)
/* 17B250 8024C970 C604005C */  lwc1      $f4, 0x5C($s0)
/* 17B254 8024C974 8602001E */  lh        $v0, 0x1E($s0)
/* 17B258 8024C978 86030022 */  lh        $v1, 0x22($s0)
/* 17B25C 8024C97C 3C01802A */  lui       $at, %hi(BattleCam_PosX)
/* 17B260 8024C980 E420F270 */  swc1      $f0, %lo(BattleCam_PosX)($at)
glabel func_8024C984
/* 17B264 8024C984 44820000 */  mtc1      $v0, $f0
/* 17B268 8024C988 00000000 */  nop
/* 17B26C 8024C98C 46800020 */  cvt.s.w   $f0, $f0
/* 17B270 8024C990 86020024 */  lh        $v0, 0x24($s0)
/* 17B274 8024C994 3C01802A */  lui       $at, %hi(BattleCam_PosY)
D_8024C998_C0A218:
/* 17B278 8024C998 E422F274 */  swc1      $f2, %lo(BattleCam_PosY)($at)
/* 17B27C 8024C99C 3C01802A */  lui       $at, %hi(BattleCam_PosZ)
.L8024C9A0:
/* 17B280 8024C9A0 E424F278 */  swc1      $f4, %lo(BattleCam_PosZ)($at)
/* 17B284 8024C9A4 3C01802A */  lui       $at, %hi(D_8029F288)
/* 17B288 8024C9A8 E420F288 */  swc1      $f0, %lo(D_8029F288)($at)
/* 17B28C 8024C9AC 44820000 */  mtc1      $v0, $f0
/* 17B290 8024C9B0 00000000 */  nop
/* 17B294 8024C9B4 46800020 */  cvt.s.w   $f0, $f0
/* 17B298 8024C9B8 3C01802A */  lui       $at, %hi(BattleCam_InitialBoomYaw)
/* 17B29C 8024C9BC E420F290 */  swc1      $f0, %lo(BattleCam_InitialBoomYaw)($at)
D_8024C9C0:
/* 17B2A0 8024C9C0 44830000 */  mtc1      $v1, $f0
/* 17B2A4 8024C9C4 00000000 */  nop
.L8024C9C8:
/* 17B2A8 8024C9C8 46800020 */  cvt.s.w   $f0, $f0
/* 17B2AC 8024C9CC 3C01802A */  lui       $at, %hi(BattleCam_InitialBoomPitch)
/* 17B2B0 8024C9D0 E420F294 */  swc1      $f0, %lo(BattleCam_InitialBoomPitch)($at)
.L8024C9D4:
/* 17B2B4 8024C9D4 3C02802A */  lui       $v0, %hi(BattleCam_TargetActor)
/* 17B2B8 8024C9D8 9442F27C */  lhu       $v0, %lo(BattleCam_TargetActor)($v0)
/* 17B2BC 8024C9DC 4480A000 */  mtc1      $zero, $f20
/* 17B2C0 8024C9E0 30430700 */  andi      $v1, $v0, 0x700
/* 17B2C4 8024C9E4 304400FF */  andi      $a0, $v0, 0xFF
/* 17B2C8 8024C9E8 24020100 */  addiu     $v0, $zero, 0x100
/* 17B2CC 8024C9EC 1062001C */  beq       $v1, $v0, .L8024CA60
/* 17B2D0 8024C9F0 28620101 */   slti     $v0, $v1, 0x101
/* 17B2D4 8024C9F4 50400005 */  beql      $v0, $zero, .L8024CA0C
/* 17B2D8 8024C9F8 24020200 */   addiu    $v0, $zero, 0x200
/* 17B2DC 8024C9FC 10600007 */  beqz      $v1, .L8024CA1C
glabel func_8024CA00
/* 17B2E0 8024CA00 27A20020 */   addiu    $v0, $sp, 0x20
/* 17B2E4 8024CA04 080932A3 */  j         .L8024CA8C
/* 17B2E8 8024CA08 AFA20010 */   sw       $v0, 0x10($sp)
.L8024CA0C:
/* 17B2EC 8024CA0C 10620017 */  beq       $v1, $v0, .L8024CA6C
/* 17B2F0 8024CA10 27A20020 */   addiu    $v0, $sp, 0x20
/* 17B2F4 8024CA14 080932A3 */  j         .L8024CA8C
/* 17B2F8 8024CA18 AFA20010 */   sw       $v0, 0x10($sp)
.L8024CA1C:
/* 17B2FC 8024CA1C 8CC400D8 */  lw        $a0, 0xD8($a2)
/* 17B300 8024CA20 1080004C */  beqz      $a0, .L8024CB54
/* 17B304 8024CA24 0000102D */   daddu    $v0, $zero, $zero
/* 17B308 8024CA28 3C028011 */  lui       $v0, %hi(gPlayerStatus)
/* 17B30C 8024CA2C 2442EFC8 */  addiu     $v0, $v0, %lo(gPlayerStatus)
/* 17B310 8024CA30 944200B0 */  lhu       $v0, 0xB0($v0)
/* 17B314 8024CA34 C4820148 */  lwc1      $f2, 0x148($a0)
/* 17B318 8024CA38 00021400 */  sll       $v0, $v0, 16
/* 17B31C 8024CA3C 00021C03 */  sra       $v1, $v0, 16
/* 17B320 8024CA40 000217C2 */  srl       $v0, $v0, 31
/* 17B324 8024CA44 00621821 */  addu      $v1, $v1, $v0
/* 17B328 8024CA48 00031843 */  sra       $v1, $v1, 1
/* 17B32C 8024CA4C 44830000 */  mtc1      $v1, $f0
/* 17B330 8024CA50 00000000 */  nop
/* 17B334 8024CA54 46800020 */  cvt.s.w   $f0, $f0
/* 17B338 8024CA58 080932A1 */  j         .L8024CA84
/* 17B33C 8024CA5C 46001500 */   add.s    $f20, $f2, $f0
.L8024CA60:
/* 17B340 8024CA60 8CC600DC */  lw        $a2, 0xDC($a2)
/* 17B344 8024CA64 0809329E */  j         .L8024CA78
/* 17B348 8024CA68 00000000 */   nop
.L8024CA6C:
/* 17B34C 8024CA6C 00041080 */  sll       $v0, $a0, 2
/* 17B350 8024CA70 00461021 */  addu      $v0, $v0, $a2
/* 17B354 8024CA74 8C4600E0 */  lw        $a2, 0xE0($v0)
.L8024CA78:
/* 17B358 8024CA78 10C00036 */  beqz      $a2, .L8024CB54
/* 17B35C 8024CA7C 0000102D */   daddu    $v0, $zero, $zero
/* 17B360 8024CA80 C4D40148 */  lwc1      $f20, 0x148($a2)
.L8024CA84:
/* 17B364 8024CA84 27A20020 */  addiu     $v0, $sp, 0x20
/* 17B368 8024CA88 AFA20010 */  sw        $v0, 0x10($sp)
.L8024CA8C:
/* 17B36C 8024CA8C 27A20024 */  addiu     $v0, $sp, 0x24
/* 17B370 8024CA90 AFA20014 */  sw        $v0, 0x14($sp)
/* 17B374 8024CA94 27A20028 */  addiu     $v0, $sp, 0x28
/* 17B378 8024CA98 3C05802A */  lui       $a1, %hi(BattleCam_PosX)
/* 17B37C 8024CA9C 8CA5F270 */  lw        $a1, %lo(BattleCam_PosX)($a1)
/* 17B380 8024CAA0 4406A000 */  mfc1      $a2, $f20
/* 17B384 8024CAA4 3C07802A */  lui       $a3, %hi(BattleCam_PosZ)
D_8024CAA8_C0A328:
/* 17B388 8024CAA8 8CE7F278 */  lw        $a3, %lo(BattleCam_PosZ)($a3)
/* 17B38C 8024CAAC 24040001 */  addiu     $a0, $zero, 0x1
/* 17B390 8024CAB0 0C00B94E */  jal       get_screen_coords
/* 17B394 8024CAB4 AFA20018 */   sw       $v0, 0x18($sp)
/* 17B398 8024CAB8 8FA20024 */  lw        $v0, 0x24($sp)
/* 17B39C 8024CABC 28420064 */  slti      $v0, $v0, 0x64
/* 17B3A0 8024CAC0 10400005 */  beqz      $v0, .L8024CAD8
/* 17B3A4 8024CAC4 00000000 */   nop
/* 17B3A8 8024CAC8 3C0141C8 */  lui       $at, (0x41C80000 >> 16)
/* 17B3AC 8024CACC 44810000 */  mtc1      $at, $f0
/* 17B3B0 8024CAD0 00000000 */  nop
/* 17B3B4 8024CAD4 4600A500 */  add.s     $f20, $f20, $f0
.L8024CAD8:
/* 17B3B8 8024CAD8 3C01802A */  lui       $at, %hi(BattleCam_PosY)
.L8024CADC:
/* 17B3BC 8024CADC C420F274 */  lwc1      $f0, %lo(BattleCam_PosY)($at)
/* 17B3C0 8024CAE0 4600A03C */  c.lt.s    $f20, $f0
/* 17B3C4 8024CAE4 00000000 */  nop
/* 17B3C8 8024CAE8 45030001 */  bc1tl     D_8024CAF0_C0A370
/* 17B3CC 8024CAEC 46000506 */   mov.s    $f20, $f0
D_8024CAF0_C0A370:
/* 17B3D0 8024CAF0 C6060058 */  lwc1      $f6, 0x58($s0)
/* 17B3D4 8024CAF4 4606A101 */  sub.s     $f4, $f20, $f6
/* 17B3D8 8024CAF8 3C01802A */  lui       $at, %hi(D_8029CC28)
/* 17B3DC 8024CAFC D422CC28 */  ldc1      $f2, %lo(D_8029CC28)($at)
/* 17B3E0 8024CB00 46002005 */  abs.s     $f0, $f4
/* 17B3E4 8024CB04 46000021 */  cvt.d.s   $f0, $f0
/* 17B3E8 8024CB08 4622003C */  c.lt.d    $f0, $f2
/* 17B3EC 8024CB0C 00000000 */  nop
/* 17B3F0 8024CB10 45000009 */  bc1f      .L8024CB38
/* 17B3F4 8024CB14 00000000 */   nop
/* 17B3F8 8024CB18 44800000 */  mtc1      $zero, $f0
/* 17B3FC 8024CB1C 00000000 */  nop
/* 17B400 8024CB20 46002032 */  c.eq.s    $f4, $f0
/* 17B404 8024CB24 00000000 */  nop
/* 17B408 8024CB28 45020009 */  bc1fl     .L8024CB50
/* 17B40C 8024CB2C E6140058 */   swc1     $f20, 0x58($s0)
/* 17B410 8024CB30 080932D5 */  j         .L8024CB54
/* 17B414 8024CB34 0000102D */   daddu    $v0, $zero, $zero
.L8024CB38:
/* 17B418 8024CB38 3C0140A0 */  lui       $at, (0x40A00000 >> 16)
/* 17B41C 8024CB3C 44810000 */  mtc1      $at, $f0
/* 17B420 8024CB40 00000000 */  nop
/* 17B424 8024CB44 46002003 */  div.s     $f0, $f4, $f0
/* 17B428 8024CB48 46003000 */  add.s     $f0, $f6, $f0
/* 17B42C 8024CB4C E6000058 */  swc1      $f0, 0x58($s0)
.L8024CB50:
/* 17B430 8024CB50 0000102D */  daddu     $v0, $zero, $zero
.L8024CB54:
/* 17B434 8024CB54 8FBF0034 */  lw        $ra, 0x34($sp)
/* 17B438 8024CB58 8FB00030 */  lw        $s0, 0x30($sp)
/* 17B43C 8024CB5C D7B40038 */  ldc1      $f20, 0x38($sp)
/* 17B440 8024CB60 03E00008 */  jr        $ra
/* 17B444 8024CB64 27BD0040 */   addiu    $sp, $sp, 0x40

### DECOMPILED C INSTRUCTIONS:

ApiStatus CamPresetUpdate_K(Evt* script, s32 isInitialCall) {
    Camera* camera = &gCameras[CAM_BATTLE];
    BattleStatus* battleStatus = &gBattleStatus;
    PlayerStatus* playerStatus = &gPlayerStatus;
    s32 screenX, screenY, screenZ;
    f32 deltaY;
    f32 y;
    s32 actorID;
    s32 actorClass;

    if (isInitialCall) {
        BattleCam_PosX = camera->lookAt_obj_target.x;
        BattleCam_PosY = camera->lookAt_obj_target.y;
        BattleCam_PosZ = camera->lookAt_obj_target.z;
        D_8029F288 = camera->auxBoomLength;
        BattleCam_InitialBoomYaw = camera->auxBoomYaw;
        BattleCam_InitialBoomPitch = camera->auxBoomPitch;
    }

    y = 0.0f;
    actorClass = BattleCam_TargetActor & ACTOR_CLASS_MASK;
    actorID = BattleCam_TargetActor & 0xFF;

    switch (actorClass) {
        case ACTOR_CLASS_PLAYER:
            if (battleStatus->playerActor == NULL) {
                return ApiStatus_BLOCK;
            }
            y = battleStatus->playerActor->currentPos.y + (playerStatus->colliderHeight / 2);
            break;
        case ACTOR_CLASS_PARTNER:
            if (battleStatus->partnerActor == NULL) {
                return ApiStatus_BLOCK;
            }
            y = battleStatus->partnerActor->currentPos.y;
            break;
        case ACTOR_CLASS_ENEMY:
            if (battleStatus->enemyActors[actorID] == NULL) {
                return ApiStatus_BLOCK;
            }
            y = battleStatus->enemyActors[actorID]->currentPos.y;
            break;
    }

    get_screen_coords(1, BattleCam_PosX, y, BattleCam_PosZ, &screenX, &screenY, &screenZ);

    if (screenY < 100) {
        y += 25.0f;
    }

    if (y < BattleCam_PosY) {
        y = BattleCam_PosY;
    }

    deltaY = y - camera->lookAt_obj_target.y;
    if (fabsf(deltaY) < 0.01) {
        if (deltaY != 0.0f) {
            camera->lookAt_obj_target.y = y;
        }
    } else {
        camera->lookAt_obj_target.y += deltaY / 5.0f;
    }

    return ApiStatus_BLOCK;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_80240BBC
/* 16F49C 80240BBC 27BDFFD0 */  addiu     $sp, $sp, -0x30
glabel func_80240BC0
/* 16F4A0 80240BC0 AFB10024 */  sw        $s1, 0x24($sp)
glabel func_80240BC4
/* 16F4A4 80240BC4 0080882D */  daddu     $s1, $a0, $zero
glabel func_80240BC8
/* 16F4A8 80240BC8 AFB00020 */  sw        $s0, 0x20($sp)
D_80240BCC:
/* 16F4AC 80240BCC 0000802D */  daddu     $s0, $zero, $zero
glabel func_80240BD0
/* 16F4B0 80240BD0 AFBF002C */  sw        $ra, 0x2C($sp)
glabel func_80240BD4
/* 16F4B4 80240BD4 AFB20028 */  sw        $s2, 0x28($sp)
glabel func_80240BD8
/* 16F4B8 80240BD8 0220202D */  daddu     $a0, $s1, $zero
arn_10_pad_BDC:
/* 16F4BC 80240BDC 0C099C8D */  jal       remove_actor_decoration
glabel func_80240BE0
/* 16F4C0 80240BE0 0200282D */   daddu    $a1, $s0, $zero
D_80240BE4:
/* 16F4C4 80240BE4 26100001 */  addiu     $s0, $s0, 0x1
glabel func_80240BE8
/* 16F4C8 80240BE8 2A020002 */  slti      $v0, $s0, 0x2
glabel func_80240BEC
/* 16F4CC 80240BEC 1440FFFB */  bnez      $v0, arn_10_pad_BDC
D_80240BF0:
/* 16F4D0 80240BF0 0220202D */   daddu    $a0, $s1, $zero
glabel mgm_01_EndPanelAnimation
/* 16F4D4 80240BF4 8E2201D0 */  lw        $v0, 0x1D0($s1)
D_80240BF8:
/* 16F4D8 80240BF8 10400003 */  beqz      $v0, func_80240C08
glabel func_80240BFC
/* 16F4DC 80240BFC 00000000 */   nop
glabel func_80240C00
/* 16F4E0 80240C00 0C0B102B */  jal       kill_script_by_ID
glabel func_80240C04
/* 16F4E4 80240C04 8E2401E0 */   lw       $a0, 0x1E0($s1)
glabel func_80240C08
/* 16F4E8 80240C08 8E2201D8 */  lw        $v0, 0x1D8($s1)
glabel func_80240C0C
/* 16F4EC 80240C0C 10400003 */  beqz      $v0, func_80240C1C
glabel func_80240C10
/* 16F4F0 80240C10 00000000 */   nop
.L80240C14:
/* 16F4F4 80240C14 0C0B102B */  jal       kill_script_by_ID
glabel func_80240C18
/* 16F4F8 80240C18 8E2401E8 */   lw       $a0, 0x1E8($s1)
glabel func_80240C1C
/* 16F4FC 80240C1C 8E2201D4 */  lw        $v0, 0x1D4($s1)
D_80240C20:
/* 16F500 80240C20 10400005 */  beqz      $v0, omo_04_FlyingAI_Loiter
D_80240C24:
/* 16F504 80240C24 0220202D */   daddu    $a0, $s1, $zero
D_80240C28:
/* 16F508 80240C28 8E2401E4 */  lw        $a0, 0x1E4($s1)
glabel func_80240C2C
/* 16F50C 80240C2C 0C0B102B */  jal       kill_script_by_ID
glabel func_80240C30
/* 16F510 80240C30 00000000 */   nop
glabel func_80240C34
/* 16F514 80240C34 0220202D */  daddu     $a0, $s1, $zero
glabel omo_04_FlyingAI_Loiter
/* 16F518 80240C38 0C099BBA */  jal       func_80266EE8
.L80240C3C:
/* 16F51C 80240C3C 0000282D */   daddu    $a1, $zero, $zero
glabel func_80240C40
/* 16F520 80240C40 8E3001F4 */  lw        $s0, 0x1F4($s1)
glabel func_80240C44
/* 16F524 80240C44 1200002B */  beqz      $s0, func_80240CF4
.L80240C48:
/* 16F528 80240C48 00000000 */   nop
glabel dead_11_FlyingAI_JumpInit
/* 16F52C 80240C4C 3C128000 */  lui       $s2, (0x80000000 >> 16)
glabel .L80240C50
/* 16F530 80240C50 8E020000 */  lw        $v0, 0x0($s0)
glabel mgm_01_UpdateRecords
/* 16F534 80240C54 30420004 */  andi      $v0, $v0, 0x4
glabel func_80240C58
/* 16F538 80240C58 14400003 */  bnez      $v0, func_80240C68
glabel dead_kzn_17_PiranhaPlantAI_00
/* 16F53C 80240C5C 00000000 */   nop
glabel func_80240C60
/* 16F540 80240C60 0C0448CA */  jal       delete_shadow
glabel kzn_03_MeleeHitbox_31
/* 16F544 80240C64 8E04009C */   lw       $a0, 0x9C($s0)
glabel func_80240C68
/* 16F548 80240C68 8E020094 */  lw        $v0, 0x94($s0)
glabel sam_07_WanderMeleeAI_Main
/* 16F54C 80240C6C 1040001C */  beqz      $v0, omo_17_GrooveGuyAI_Main
glabel func_80240C70
/* 16F550 80240C70 0000282D */   daddu    $a1, $zero, $zero
dgb_09_ClubbaNappingAI_LoiterInit:
/* 16F554 80240C74 00A0302D */  daddu     $a2, $a1, $zero
glabel func_80240C78
/* 16F558 80240C78 AFA00010 */  sw        $zero, 0x10($sp)
glabel func_80240C7C
/* 16F55C 80240C7C AFA00014 */  sw        $zero, 0x14($sp)
glabel func_80240C80
/* 16F560 80240C80 AFA00018 */  sw        $zero, 0x18($sp)
glabel func_80240C84
/* 16F564 80240C84 8E040084 */  lw        $a0, 0x84($s0)
glabel func_80240C88
/* 16F568 80240C88 0C0B7A25 */  jal       set_npc_imgfx_all
glabel func_80240C8C
/* 16F56C 80240C8C 00A0382D */   daddu    $a3, $a1, $zero
glabel arn_02_CleftAI_Main
/* 16F570 80240C90 8E040084 */  lw        $a0, 0x84($s0)
glabel func_80240C94
/* 16F574 80240C94 0C0B797A */  jal       spr_free_sprite
.L80240C98:
/* 16F578 80240C98 00000000 */   nop
glabel omo_07_PatrolAI_JumpInit
/* 16F57C 80240C9C 10400003 */  beqz      $v0, func_80240CAC
glabel func_80240CA0
/* 16F580 80240CA0 00000000 */   nop
glabel .L80240CA4
/* 16F584 80240CA4 08090329 */  j         .L80240CA4
glabel func_80240CA8
/* 16F588 80240CA8 00000000 */   nop
glabel func_80240CAC
/* 16F58C 80240CAC 8E020000 */  lw        $v0, 0x0($s0)
glabel func_80240CB0
/* 16F590 80240CB0 00521024 */  and       $v0, $v0, $s2
glabel arn_08_pad_CB4
/* 16F594 80240CB4 14400003 */  bnez      $v0, dead_11_FlyingAI_Jump
glabel func_80240CB8
/* 16F598 80240CB8 00000000 */   nop
D_80240CBC:
/* 16F59C 80240CBC 0C00AB4B */  jal       heap_free
glabel dead_flo_14_FlyingAI_Wander
/* 16F5A0 80240CC0 8E040010 */   lw       $a0, 0x10($s0)
glabel dead_11_FlyingAI_Jump
/* 16F5A4 80240CC4 8E020000 */  lw        $v0, 0x0($s0)
glabel func_80240CC8
/* 16F5A8 80240CC8 30420002 */  andi      $v0, $v0, 0x2
glabel func_80240CCC
/* 16F5AC 80240CCC 14400005 */  bnez      $v0, .L80240CE4
glabel func_80240CD0
/* 16F5B0 80240CD0 0200202D */   daddu    $a0, $s0, $zero
glabel func_80240CD4
/* 16F5B4 80240CD4 8E0400C0 */  lw        $a0, 0xC0($s0)
glabel func_80240CD8_EA97B8
/* 16F5B8 80240CD8 0C00AB4B */  jal       heap_free
glabel func_80240CDC
/* 16F5BC 80240CDC 00000000 */   nop
glabel omo_17_GrooveGuyAI_Main
/* 16F5C0 80240CE0 0200202D */  daddu     $a0, $s0, $zero
.L80240CE4:
/* 16F5C4 80240CE4 0C00AB4B */  jal       heap_free
glabel func_80240CE8
/* 16F5C8 80240CE8 8C90000C */   lw       $s0, 0xC($a0)
glabel func_80240CEC
/* 16F5CC 80240CEC 1600FFD8 */  bnez      $s0, .L80240C50
D_80240CF0:
/* 16F5D0 80240CF0 00000000 */   nop
glabel func_80240CF4
/* 16F5D4 80240CF4 0C0448CA */  jal       delete_shadow
glabel func_80240CF8
/* 16F5D8 80240CF8 8E24042C */   lw       $a0, 0x42C($s1)
glabel func_80240CFC
/* 16F5DC 80240CFC 0C011DBD */  jal       remove_all_status_icons
glabel func_80240D00
/* 16F5E0 80240D00 86240436 */   lh       $a0, 0x436($s1)
glabel .L80240D04
/* 16F5E4 80240D04 0C016914 */  jal       remove_effect
glabel func_80240D08
/* 16F5E8 80240D08 8E240440 */   lw       $a0, 0x440($s1)
glabel func_80240D0C
/* 16F5EC 80240D0C 8E220200 */  lw        $v0, 0x200($s1)
glabel func_80240D10
/* 16F5F0 80240D10 10400003 */  beqz      $v0, .L80240D20
glabel func_80240D14
/* 16F5F4 80240D14 0000802D */   daddu    $s0, $zero, $zero
glabel func_80240D18
/* 16F5F8 80240D18 8C42000C */  lw        $v0, 0xC($v0)
glabel func_80240D1C
/* 16F5FC 80240D1C AC400024 */  sw        $zero, 0x24($v0)
.L80240D20:
/* 16F600 80240D20 3C03800E */  lui       $v1, %hi(gBattleStatus)
D_80240D24:
/* 16F604 80240D24 2463C070 */  addiu     $v1, $v1, %lo(gBattleStatus)
glabel func_80240D28
/* 16F608 80240D28 8C6200E0 */  lw        $v0, 0xE0($v1)
glabel .L80240D2C
/* 16F60C 80240D2C 14510003 */  bne       $v0, $s1, pra_40_EnablePartnerReflection
glabel dead_11_FlyingAI_ChaseInit
/* 16F610 80240D30 26100001 */   addiu    $s0, $s0, 0x1
glabel .L80240D34
/* 16F614 80240D34 08090352 */  j         func_80240D48
flo_24_pad_D38:
/* 16F618 80240D38 AC6000E0 */   sw       $zero, 0xE0($v1)
glabel pra_40_EnablePartnerReflection
/* 16F61C 80240D3C 2A020018 */  slti      $v0, $s0, 0x18
glabel dead_flo_08_DeadUnkFunc1
/* 16F620 80240D40 1440FFF9 */  bnez      $v0, func_80240D28
glabel func_80240D44
/* 16F624 80240D44 24630004 */   addiu    $v1, $v1, 0x4
glabel func_80240D48
/* 16F628 80240D48 0C00AB4B */  jal       heap_free
glabel mgm_00_PatrolAI_LosePlayer
/* 16F62C 80240D4C 0220202D */   daddu    $a0, $s1, $zero
glabel func_80240D50
/* 16F630 80240D50 8FBF002C */  lw        $ra, 0x2C($sp)
glabel func_80240D54
/* 16F634 80240D54 8FB20028 */  lw        $s2, 0x28($sp)
glabel dead_flo_16_SuperBlock_PartnerSparkles2
/* 16F638 80240D58 8FB10024 */  lw        $s1, 0x24($sp)
glabel func_80240D5C
/* 16F63C 80240D5C 8FB00020 */  lw        $s0, 0x20($sp)
glabel mim_08_FlyingAI_ChaseInit
/* 16F640 80240D60 03E00008 */  jr        $ra
glabel .L80240D64
/* 16F644 80240D64 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

void btl_delete_actor(Actor* actor) {
    ActorPart* part;
    ActorPart* actorPartTemp;
    BattleStatus* battleStatus;
    s32 i;

    // TODO hard-coded
    for (i = 0; i < 2; i++) {
        remove_actor_decoration(actor, i);
    }
    if (actor->idleScript != NULL) {
        kill_script_by_ID(actor->idleScriptID);
    }
    if (actor->handleEventScript != NULL) {
        kill_script_by_ID(actor->handleEventScriptID);
    }
    if (actor->takeTurnScript != NULL) {
        kill_script_by_ID(actor->takeTurnScriptID);
    }
    func_80266EE8(actor, UNK_PAL_EFFECT_0);

    part = actor->partsTable;

    while (part != NULL) {
        if (!(part->flags & ACTOR_PART_FLAG_4)) {
            delete_shadow(part->shadowIndex);
        }

        if (part->idleAnimations != NULL) {
            set_npc_imgfx_all(part->spriteInstanceID, IMGFX_CLEAR, 0, 0, 0, 0, 0);

            ASSERT(spr_free_sprite(part->spriteInstanceID) == 0);

            if (!(part->flags & ACTOR_PART_FLAG_80000000)) {
                heap_free(part->movement);
            }

            if (!(part->flags & ACTOR_PART_FLAG_2)) {
                heap_free(part->decorationTable);
            }
        }
        actorPartTemp = part->nextPart;
        heap_free(part);
        part = actorPartTemp;
    }

    delete_shadow(actor->shadow.id);
    remove_all_status_icons(actor->hudElementDataIndex);
    remove_effect(actor->disableEffect);

    if (actor->attackResultEffect != NULL) {
        actor->attackResultEffect->data.attackResultText->isVisible = FALSE;
    }

    battleStatus = &gBattleStatus;
    for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
        if (battleStatus->enemyActors[i] == actor) {
            battleStatus->enemyActors[i] = NULL;
            break;
        }
    }

    heap_free(actor);
}