### RAW ASSEMBLY INSTRUCTIONS:

glabel func_80218100
/* 464590 80218100 27BDFFA0 */  addiu     $sp, $sp, -0x60
b_area_dgb_clubba_ActorParts:
/* 464594 80218104 AFB50054 */  sw        $s5, 0x54($sp)
glabel func_80218108
/* 464598 80218108 0080A82D */  daddu     $s5, $a0, $zero
/* 46459C 8021810C AFB40050 */  sw        $s4, 0x50($sp)
/* 4645A0 80218110 3C148011 */  lui       $s4, %hi(gPlayerData)
glabel b_area_flo2_CosInterpMinMax
/* 4645A4 80218114 2694F290 */  addiu     $s4, $s4, %lo(gPlayerData)
glabel func_80218118
/* 4645A8 80218118 3C058023 */  lui       $a1, %hi(D_80232C50)
/* 4645AC 8021811C 24A52C50 */  addiu     $a1, $a1, %lo(D_80232C50)
glabel dup_b_area_kpa2_StartRumbleWithParams
/* 4645B0 80218120 AFBF0058 */  sw        $ra, 0x58($sp)
/* 4645B4 80218124 AFB3004C */  sw        $s3, 0x4C($sp)
glabel dup_b_area_tik_SetAbsoluteStatusOffsets
/* 4645B8 80218128 AFB20048 */  sw        $s2, 0x48($sp)
glabel b_area_kzn2_SetVineBonePos
/* 4645BC 8021812C AFB10044 */  sw        $s1, 0x44($sp)
glabel func_80218130
/* 4645C0 80218130 AFB00040 */  sw        $s0, 0x40($sp)
.L80218134:
/* 4645C4 80218134 8CA20000 */  lw        $v0, 0x0($a1)
.L80218138:
/* 4645C8 80218138 8EB30098 */  lw        $s3, 0x98($s5)
.L8021813C:
/* 4645CC 8021813C 04410005 */  bgez      $v0, .L80218154
/* 4645D0 80218140 24030001 */   addiu    $v1, $zero, 0x1
/* 4645D4 80218144 24020002 */  addiu     $v0, $zero, 0x2
glabel func_80218148
/* 4645D8 80218148 00532004 */  sllv      $a0, $s3, $v0
.L8021814C:
/* 4645DC 8021814C 080860B4 */  j         .L802182D0
glabel b_area_kpa4_ShrinkActor
/* 4645E0 80218150 ACB30000 */   sw       $s3, 0x0($a1)
.L80218154:
/* 4645E4 80218154 1053000C */  beq       $v0, $s3, .L80218188
glabel b_area_trd_part_3_ClearPlayerMenuSelections
/* 4645E8 80218158 00131880 */   sll      $v1, $s3, 2
.L8021815C:
/* 4645EC 8021815C 3C028023 */  lui       $v0, %hi(func_80218000_47F0B0)
.L80218160:
/* 4645F0 80218160 24422C20 */  addiu     $v0, $v0, %lo(func_80218000_47F0B0)
.L80218164:
/* 4645F4 80218164 00622021 */  addu      $a0, $v1, $v0
/* 4645F8 80218168 8C820000 */  lw        $v0, 0x0($a0)
/* 4645FC 8021816C 14400007 */  bnez      $v0, b_area_nok_goomba_CalculateRotationZ
glabel func_80218170
/* 464600 80218170 2411000B */   addiu    $s1, $zero, 0xB
.L80218174:
/* 464604 80218174 24020002 */  addiu     $v0, $zero, 0x2
glabel dup3_b_area_kpa2_UnkFireBreathFXFunc
/* 464608 80218178 24030001 */  addiu     $v1, $zero, 0x1
glabel b_area_trd_part_2_fake_bowser_UnkFunc26
/* 46460C 8021817C ACB30000 */  sw        $s3, 0x0($a1)
glabel b_area_kkj_GetEntityPosition
/* 464610 80218180 080860B7 */  j         .L802182DC
glabel b_area_dig_SpawnDrainHealthContinueFX
/* 464614 80218184 AC830000 */   sw       $v1, 0x0($a0)
.L80218188:
/* 464618 80218188 2411000B */  addiu     $s1, $zero, 0xB
glabel b_area_nok_goomba_CalculateRotationZ
/* 46461C 8021818C 27A2003C */  addiu     $v0, $sp, 0x3C
.L80218190:
/* 464620 80218190 AC510000 */  sw        $s1, 0x0($v0)
/* 464624 80218194 2631FFFF */  addiu     $s1, $s1, -0x1
/* 464628 80218198 0621FFFD */  bgez      $s1, .L80218190
glabel b_area_kpa_StartRumbleWithParams
/* 46462C 8021819C 2442FFFC */   addiu    $v0, $v0, -0x4
glabel b_area_jan_jungle_fuzzy_SpawnDrainHealthStartFX
/* 464630 802181A0 0000882D */  daddu     $s1, $zero, $zero
.L802181A4:
/* 464634 802181A4 27B20010 */  addiu     $s2, $sp, 0x10
.L802181A8:
/* 464638 802181A8 0C00A67F */  jal       rand_int
b_area_dgb_clubba_handleEvent_802181AC:
/* 46463C 802181AC 2404000B */   addiu    $a0, $zero, 0xB
/* 464640 802181B0 2404000B */  addiu     $a0, $zero, 0xB
glabel b_area_trd_part_3_func_802181B4_4CF364
/* 464644 802181B4 0C00A67F */  jal       rand_int
/* 464648 802181B8 0040802D */   daddu    $s0, $v0, $zero
/* 46464C 802181BC 00108080 */  sll       $s0, $s0, 2
glabel b_area_iwa_iwa_02_IsSaveVar123
/* 464650 802181C0 02508021 */  addu      $s0, $s2, $s0
/* 464654 802181C4 00021080 */  sll       $v0, $v0, 2
.L802181C8:
/* 464658 802181C8 02421021 */  addu      $v0, $s2, $v0
.L802181CC:
/* 46465C 802181CC 8E040000 */  lw        $a0, 0x0($s0)
/* 464660 802181D0 8C430000 */  lw        $v1, 0x0($v0)
/* 464664 802181D4 26310001 */  addiu     $s1, $s1, 0x1
/* 464668 802181D8 AE030000 */  sw        $v1, 0x0($s0)
.L802181DC:
/* 46466C 802181DC AC440000 */  sw        $a0, 0x0($v0)
/* 464670 802181E0 2A220064 */  slti      $v0, $s1, 0x64
glabel func_802181E4_69F3E4
/* 464674 802181E4 1440FFF0 */  bnez      $v0, .L802181A8
glabel GetActorPartOpacity
/* 464678 802181E8 24080005 */   addiu    $t0, $zero, 0x5
.L802181EC:
/* 46467C 802181EC 0000882D */  daddu     $s1, $zero, $zero
glabel b_area_flo_CosInterpMinMax
/* 464680 802181F0 2407000A */  addiu     $a3, $zero, 0xA
glabel func_802181F4
/* 464684 802181F4 2406000B */  addiu     $a2, $zero, 0xB
glabel b_area_trd_part_3_AddStarPower
/* 464688 802181F8 3C058023 */  lui       $a1, %hi(func_80218000_47F0B0)
glabel b_area_kzn_putrid_piranha_UnkEffect6FFunc
/* 46468C 802181FC 24A52C20 */  addiu     $a1, $a1, %lo(func_80218000_47F0B0)
glabel b_area_kpa_ShrinkActor
/* 464690 80218200 27A30010 */  addiu     $v1, $sp, 0x10
.L80218204:
/* 464694 80218204 8C640000 */  lw        $a0, 0x0($v1)
/* 464698 80218208 000410C0 */  sll       $v0, $a0, 3
.L8021820C:
/* 46469C 8021820C 02821021 */  addu      $v0, $s4, $v0
b_area_iwa_Formation_00:
/* 4646A0 80218210 90420014 */  lbu       $v0, 0x14($v0)
/* 4646A4 80218214 5040000F */  beql      $v0, $zero, b_area_jan_jungle_fuzzy_SpawnDrainHealthContinueFX
.L80218218:
/* 4646A8 80218218 26310001 */   addiu    $s1, $s1, 0x1
/* 4646AC 8021821C 5088000D */  beql      $a0, $t0, b_area_jan_jungle_fuzzy_SpawnDrainHealthContinueFX
glabel func_80218220_6DBFC0
/* 4646B0 80218220 26310001 */   addiu    $s1, $s1, 0x1
glabel func_80218224
/* 4646B4 80218224 5087000B */  beql      $a0, $a3, b_area_jan_jungle_fuzzy_SpawnDrainHealthContinueFX
/* 4646B8 80218228 26310001 */   addiu    $s1, $s1, 0x1
D_8021822C:
/* 4646BC 8021822C 50860009 */  beql      $a0, $a2, b_area_jan_jungle_fuzzy_SpawnDrainHealthContinueFX
.L80218230:
/* 4646C0 80218230 26310001 */   addiu    $s1, $s1, 0x1
/* 4646C4 80218234 50930007 */  beql      $a0, $s3, b_area_jan_jungle_fuzzy_SpawnDrainHealthContinueFX
glabel func_80218238
/* 4646C8 80218238 26310001 */   addiu    $s1, $s1, 0x1
glabel func_8021823C
/* 4646CC 8021823C 00041080 */  sll       $v0, $a0, 2
glabel dup_b_area_dig_SetAbsoluteStatusOffsets
/* 4646D0 80218240 00451021 */  addu      $v0, $v0, $a1
/* 4646D4 80218244 8C420000 */  lw        $v0, 0x0($v0)
/* 4646D8 80218248 10400006 */  beqz      $v0, D_80218264
/* 4646DC 8021824C 2A22000C */   slti     $v0, $s1, 0xC
glabel b_area_tik3_SpawnDrainHealthContinueFX
/* 4646E0 80218250 26310001 */  addiu     $s1, $s1, 0x1
glabel b_area_jan_jungle_fuzzy_SpawnDrainHealthContinueFX
/* 4646E4 80218254 2A22000C */  slti      $v0, $s1, 0xC
glabel func_80218258
/* 4646E8 80218258 1440FFEA */  bnez      $v0, .L80218204
glabel b_area_isk_part_2_chain_chomp_ChompChainUpdate
/* 4646EC 8021825C 24630004 */   addiu    $v1, $v1, 0x4
.L80218260:
/* 4646F0 80218260 2A22000C */  slti      $v0, $s1, 0xC
D_80218264:
/* 4646F4 80218264 1040000E */  beqz      $v0, .L802182A0
/* 4646F8 80218268 00041880 */   sll      $v1, $a0, 2
/* 4646FC 8021826C 24020001 */  addiu     $v0, $zero, 0x1
glabel func_80218270
/* 464700 80218270 3C018023 */  lui       $at, %hi(func_80218000_47F0B0)
/* 464704 80218274 00230821 */  addu      $at, $at, $v1
glabel func_80218278
/* 464708 80218278 AC222C20 */  sw        $v0, %lo(func_80218000_47F0B0)($at)
/* 46470C 8021827C 000410C0 */  sll       $v0, $a0, 3
glabel func_80218280_6609D0
/* 464710 80218280 02821021 */  addu      $v0, $s4, $v0
.L80218284:
/* 464714 80218284 3C018023 */  lui       $at, %hi(D_80232C50)
/* 464718 80218288 AC242C50 */  sw        $a0, %lo(D_80232C50)($at)
b_area_trd_part_3_eldstar_DefenseTable_8021828C:
/* 46471C 8021828C AEA40098 */  sw        $a0, 0x98($s5)
.L80218290:
/* 464720 80218290 80430015 */  lb        $v1, 0x15($v0)
.L80218294:
/* 464724 80218294 24020002 */  addiu     $v0, $zero, 0x2
b_area_trd_part_3_eldstar_StatusTable_80218298:
/* 464728 80218298 080860B7 */  j         .L802182DC
/* 46472C 8021829C AEA3009C */   sw       $v1, 0x9C($s5)
.L802182A0:
/* 464730 802182A0 2411000B */  addiu     $s1, $zero, 0xB
glabel func_802182A4_5CE934
/* 464734 802182A4 3C028023 */  lui       $v0, %hi(D_80232C4C)
glabel b_area_kpa4_CosInterpMinMax
/* 464738 802182A8 24422C4C */  addiu     $v0, $v0, %lo(D_80232C4C)
.L802182AC:
/* 46473C 802182AC AC400000 */  sw        $zero, 0x0($v0)
.L802182B0:
/* 464740 802182B0 2631FFFF */  addiu     $s1, $s1, -0x1
.L802182B4:
/* 464744 802182B4 0621FFFD */  bgez      $s1, .L802182AC
b_area_iwa_Formation_03:
/* 464748 802182B8 2442FFFC */   addiu    $v0, $v0, -0x4
/* 46474C 802182BC 24020002 */  addiu     $v0, $zero, 0x2
.L802182C0:
/* 464750 802182C0 00532004 */  sllv      $a0, $s3, $v0
/* 464754 802182C4 24030001 */  addiu     $v1, $zero, 0x1
.L802182C8:
/* 464758 802182C8 3C018023 */  lui       $at, %hi(D_80232C50)
/* 46475C 802182CC AC332C50 */  sw        $s3, %lo(D_80232C50)($at)
.L802182D0:
/* 464760 802182D0 3C018023 */  lui       $at, %hi(func_80218000_47F0B0)
glabel b_area_hos_magikoopa_SetAbsoluteStatusOffsets
/* 464764 802182D4 00240821 */  addu      $at, $at, $a0
glabel func_802182D8
/* 464768 802182D8 AC232C20 */  sw        $v1, %lo(func_80218000_47F0B0)($at)
.L802182DC:
/* 46476C 802182DC 8FBF0058 */  lw        $ra, 0x58($sp)
glabel func_802182E0
/* 464770 802182E0 8FB50054 */  lw        $s5, 0x54($sp)
glabel func_802182E4_660A34
/* 464774 802182E4 8FB40050 */  lw        $s4, 0x50($sp)
/* 464778 802182E8 8FB3004C */  lw        $s3, 0x4C($sp)
glabel b_area_tik2_FadeBackgroundToBlack
/* 46477C 802182EC 8FB20048 */  lw        $s2, 0x48($sp)
b_area_iwa_Formation_04:
/* 464780 802182F0 8FB10044 */  lw        $s1, 0x44($sp)
.L802182F4:
/* 464784 802182F4 8FB00040 */  lw        $s0, 0x40($sp)
/* 464788 802182F8 03E00008 */  jr        $ra
.L802182FC:
/* 46478C 802182FC 27BD0060 */   addiu    $sp, $sp, 0x60

### DECOMPILED C INSTRUCTIONS:

API_CALLABLE(func_80218100_464590) {
    PlayerData* playerData = &gPlayerData;
    s32 currentPartner = script->varTable[5];
    s32 partnerId;
    s32 i;
    s32 sp10[12];

    if (D_80232C50 < 0) {
        D_80232C50 = currentPartner;
        D_80232C20[currentPartner] = TRUE;
        return ApiStatus_DONE2;
    }

    if (D_80232C50 != currentPartner && !D_80232C20[currentPartner]) {
        D_80232C50 = currentPartner;
        D_80232C20[currentPartner] = TRUE;
        return ApiStatus_DONE2;
    }

    for (i = 0; i < 12; i++) {
        sp10[i] = i;
    }

    for (i = 0; i < 100; i++) {
        s32 index1 = rand_int(11);
        s32 index2 = rand_int(11);
        s32 tempValue = sp10[index1];
        sp10[index1] = sp10[index2];
        sp10[index2] = tempValue;
    }

    for (i = 0; i < 12; i++) {
        partnerId = sp10[i];

        if (playerData->partners[partnerId].enabled &&
            partnerId != PARTNER_GOOMPA &&
            partnerId != PARTNER_GOOMBARIA &&
            partnerId != PARTNER_TWINK &&
            partnerId != currentPartner &&
            !D_80232C20[partnerId]
        ) {
            break;
        }
    }

    if (i < 12) {
        D_80232C20[partnerId] = TRUE;
        D_80232C50 = partnerId;
        script->varTable[5] = partnerId;
        script->varTable[6] = playerData->partners[partnerId].level;
        return ApiStatus_DONE2;
    } else {
        for (i = 0; i < 12; i++) {
            D_80232C20[i] = FALSE;
        }
        D_80232C50 = currentPartner;
        D_80232C20[currentPartner] = TRUE;
        return ApiStatus_DONE2;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel btl_init_menu_boots
/* 191D98 802634B8 27BDFFC8 */  addiu     $sp, $sp, -0x38
/* 191D9C 802634BC AFB40020 */  sw        $s4, 0x20($sp)
/* 191DA0 802634C0 3C14800E */  lui       $s4, %hi(gBattleStatus)
/* 191DA4 802634C4 2694C070 */  addiu     $s4, $s4, %lo(gBattleStatus)
/* 191DA8 802634C8 AFB7002C */  sw        $s7, 0x2C($sp)
/* 191DAC 802634CC 3C178011 */  lui       $s7, %hi(gPlayerData)
/* 191DB0 802634D0 26F7F290 */  addiu     $s7, $s7, %lo(gPlayerData)
/* 191DB4 802634D4 2403FFFF */  addiu     $v1, $zero, -0x1
/* 191DB8 802634D8 AFBF0034 */  sw        $ra, 0x34($sp)
/* 191DBC 802634DC AFBE0030 */  sw        $fp, 0x30($sp)
/* 191DC0 802634E0 AFB60028 */  sw        $s6, 0x28($sp)
/* 191DC4 802634E4 AFB50024 */  sw        $s5, 0x24($sp)
/* 191DC8 802634E8 AFB3001C */  sw        $s3, 0x1C($sp)
/* 191DCC 802634EC AFB20018 */  sw        $s2, 0x18($sp)
/* 191DD0 802634F0 AFB10014 */  sw        $s1, 0x14($sp)
/* 191DD4 802634F4 AFB00010 */  sw        $s0, 0x10($sp)
/* 191DD8 802634F8 82E20000 */  lb        $v0, 0x0($s7)
/* 191DDC 802634FC 8E9500D8 */  lw        $s5, 0xD8($s4)
/* 191DE0 80263500 14430003 */  bne       $v0, $v1, D_80263510_C20D90
/* 191DE4 80263504 24120017 */   addiu    $s2, $zero, 0x17
D_80263508:
/* 191DE8 80263508 08098DAD */  j         .L802636B4
/* 191DEC 8026350C A280007E */   sb       $zero, 0x7E($s4)
D_80263510_C20D90:
/* 191DF0 80263510 02921021 */  addu      $v0, $s4, $s2
.L80263514:
/* 191DF4 80263514 A04001DE */  sb        $zero, 0x1DE($v0)
D_80263518_C20D98:
/* 191DF8 80263518 2652FFFF */  addiu     $s2, $s2, -0x1
/* 191DFC 8026351C 0641FFFD */  bgez      $s2, .L80263514
jtbl_80263520:
/* 191E00 80263520 2442FFFF */   addiu    $v0, $v0, -0x1
/* 191E04 80263524 24060001 */  addiu     $a2, $zero, 0x1
/* 191E08 80263528 92E20000 */  lbu       $v0, 0x0($s7)
/* 191E0C 8026352C 24030155 */  addiu     $v1, $zero, 0x155
/* 191E10 80263530 A68301AE */  sh        $v1, 0x1AE($s4)
/* 191E14 80263534 2442001A */  addiu     $v0, $v0, 0x1A
/* 191E18 80263538 A28201DE */  sb        $v0, 0x1DE($s4)
/* 191E1C 8026353C 0000902D */  daddu     $s2, $zero, $zero
/* 191E20 80263540 3C098009 */  lui       $t1, %hi(gMoveTable)
/* 191E24 80263544 2529F060 */  addiu     $t1, $t1, %lo(gMoveTable)
/* 191E28 80263548 3C088008 */  lui       $t0, %hi(gItemTable)
/* 191E2C 8026354C 250878E0 */  addiu     $t0, $t0, %lo(gItemTable)
/* 191E30 80263550 24070002 */  addiu     $a3, $zero, 0x2
/* 191E34 80263554 02E0202D */  daddu     $a0, $s7, $zero
/* 191E38 80263558 02872821 */  addu      $a1, $s4, $a3
.L8026355C:
/* 191E3C 8026355C 84820208 */  lh        $v0, 0x208($a0)
/* 191E40 80263560 10400011 */  beqz      $v0, .L802635A8
/* 191E44 80263564 26520001 */   addiu    $s2, $s2, 0x1
/* 191E48 80263568 00021140 */  sll       $v0, $v0, 5
/* 191E4C 8026356C 00481021 */  addu      $v0, $v0, $t0
/* 191E50 80263570 9043001A */  lbu       $v1, 0x1A($v0)
/* 191E54 80263574 00031080 */  sll       $v0, $v1, 2
/* 191E58 80263578 00431021 */  addu      $v0, $v0, $v1
/* 191E5C 8026357C 00021080 */  sll       $v0, $v0, 2
/* 191E60 80263580 00498821 */  addu      $s1, $v0, $t1
/* 191E64 80263584 82220010 */  lb        $v0, 0x10($s1)
/* 191E68 80263588 14470007 */  bne       $v0, $a3, .L802635A8
/* 191E6C 8026358C 00000000 */   nop
/* 191E70 80263590 02861021 */  addu      $v0, $s4, $a2
/* 191E74 80263594 A04301DE */  sb        $v1, 0x1DE($v0)
/* 191E78 80263598 94820208 */  lhu       $v0, 0x208($a0)
/* 191E7C 8026359C 24C60001 */  addiu     $a2, $a2, 0x1
/* 191E80 802635A0 A4A201AE */  sh        $v0, 0x1AE($a1)
/* 191E84 802635A4 24A50002 */  addiu     $a1, $a1, 0x2
.L802635A8:
/* 191E88 802635A8 2A420040 */  slti      $v0, $s2, 0x40
/* 191E8C 802635AC 1440FFEB */  bnez      $v0, .L8026355C
/* 191E90 802635B0 24840002 */   addiu    $a0, $a0, 0x2
/* 191E94 802635B4 A286020E */  sb        $a2, 0x20E($s4)
/* 191E98 802635B8 0000902D */  daddu     $s2, $zero, $zero
/* 191E9C 802635BC 30C200FF */  andi      $v0, $a2, 0xFF
/* 191EA0 802635C0 10400038 */  beqz      $v0, .L802636A4
/* 191EA4 802635C4 0240B02D */   daddu    $s6, $s2, $zero
/* 191EA8 802635C8 0286F021 */  addu      $fp, $s4, $a2
/* 191EAC 802635CC 0280982D */  daddu     $s3, $s4, $zero
.L802635D0:
/* 191EB0 802635D0 926301DE */  lbu       $v1, 0x1DE($s3)
/* 191EB4 802635D4 3C0A8009 */  lui       $t2, %hi(gMoveTable)
/* 191EB8 802635D8 254AF060 */  addiu     $t2, $t2, %lo(gMoveTable)
/* 191EBC 802635DC 00031080 */  sll       $v0, $v1, 2
/* 191EC0 802635E0 00431021 */  addu      $v0, $v0, $v1
/* 191EC4 802635E4 00021080 */  sll       $v0, $v0, 2
/* 191EC8 802635E8 004A8821 */  addu      $s1, $v0, $t2
/* 191ECC 802635EC 82300011 */  lb        $s0, 0x11($s1)
/* 191ED0 802635F0 1200000B */  beqz      $s0, .L80263620
/* 191ED4 802635F4 02A0202D */   daddu    $a0, $s5, $zero
/* 191ED8 802635F8 0C099CAB */  jal       player_team_is_ability_active
/* 191EDC 802635FC 24050018 */   addiu    $a1, $zero, 0x18
/* 191EE0 80263600 02028023 */  subu      $s0, $s0, $v0
/* 191EE4 80263604 02A0202D */  daddu     $a0, $s5, $zero
/* 191EE8 80263608 0C099CAB */  jal       player_team_is_ability_active
/* 191EEC 8026360C 24050026 */   addiu    $a1, $zero, 0x26
/* 191EF0 80263610 00021040 */  sll       $v0, $v0, 1
/* 191EF4 80263614 02028023 */  subu      $s0, $s0, $v0
/* 191EF8 80263618 5A000001 */  blezl     $s0, .L80263620
/* 191EFC 8026361C 24100001 */   addiu    $s0, $zero, 0x1
.L80263620:
/* 191F00 80263620 92E20000 */  lbu       $v0, 0x0($s7)
/* 191F04 80263624 A2800178 */  sb        $zero, 0x178($s4)
/* 191F08 80263628 00021600 */  sll       $v0, $v0, 24
/* 191F0C 8026362C 00021603 */  sra       $v0, $v0, 24
/* 191F10 80263630 A682017A */  sh        $v0, 0x17A($s4)
/* 191F14 80263634 8E220004 */  lw        $v0, 0x4($s1)
/* 191F18 80263638 02A0202D */  daddu     $a0, $s5, $zero
/* 191F1C 8026363C 0C098C0B */  jal       func_8026302C
/* 191F20 80263640 AE820184 */   sw       $v0, 0x184($s4)
/* 191F24 80263644 82A2040C */  lb        $v0, 0x40C($s5)
/* 191F28 80263648 10400003 */  beqz      $v0, .L80263658
/* 191F2C 8026364C 00000000 */   nop
/* 191F30 80263650 24160001 */  addiu     $s6, $zero, 0x1
/* 191F34 80263654 A27601F6 */  sb        $s6, 0x1F6($s3)
.L80263658:
/* 191F38 80263658 82E20005 */  lb        $v0, 0x5($s7)
/* 191F3C 8026365C 0050102A */  slt       $v0, $v0, $s0
/* 191F40 80263660 54400001 */  bnel      $v0, $zero, .L80263668
/* 191F44 80263664 A26001F6 */   sb       $zero, 0x1F6($s3)
.L80263668:
/* 191F48 80263668 82A2040C */  lb        $v0, 0x40C($s5)
/* 191F4C 8026366C 14400002 */  bnez      $v0, .L80263678
/* 191F50 80263670 2402FFFE */   addiu    $v0, $zero, -0x2
/* 191F54 80263674 A26201F6 */  sb        $v0, 0x1F6($s3)
.L80263678:
/* 191F58 80263678 3C02800E */  lui       $v0, %hi(gBattleStatus + 0x4)
/* 191F5C 8026367C 8C42C074 */  lw        $v0, %lo(gBattleStatus + 0x4)($v0)
/* 191F60 80263680 30421000 */  andi      $v0, $v0, 0x1000
/* 191F64 80263684 10400002 */  beqz      $v0, .L80263690
/* 191F68 80263688 2402FFFF */   addiu    $v0, $zero, -0x1
/* 191F6C 8026368C A3C201F6 */  sb        $v0, 0x1F6($fp)
.L80263690:
/* 191F70 80263690 9282020E */  lbu       $v0, 0x20E($s4)
/* 191F74 80263694 26520001 */  addiu     $s2, $s2, 0x1
/* 191F78 80263698 0242102A */  slt       $v0, $s2, $v0
/* 191F7C 8026369C 1440FFCC */  bnez      $v0, .L802635D0
/* 191F80 802636A0 26730001 */   addiu    $s3, $s3, 0x1
.L802636A4:
/* 191F84 802636A4 16C00002 */  bnez      $s6, D_802636B0
/* 191F88 802636A8 24020001 */   addiu    $v0, $zero, 0x1
/* 191F8C 802636AC 2402FFFF */  addiu     $v0, $zero, -0x1
D_802636B0:
/* 191F90 802636B0 A282007E */  sb        $v0, 0x7E($s4)
.L802636B4:
/* 191F94 802636B4 8FBF0034 */  lw        $ra, 0x34($sp)
/* 191F98 802636B8 8FBE0030 */  lw        $fp, 0x30($sp)
/* 191F9C 802636BC 8FB7002C */  lw        $s7, 0x2C($sp)
/* 191FA0 802636C0 8FB60028 */  lw        $s6, 0x28($sp)
/* 191FA4 802636C4 8FB50024 */  lw        $s5, 0x24($sp)
/* 191FA8 802636C8 8FB40020 */  lw        $s4, 0x20($sp)
/* 191FAC 802636CC 8FB3001C */  lw        $s3, 0x1C($sp)
/* 191FB0 802636D0 8FB20018 */  lw        $s2, 0x18($sp)
/* 191FB4 802636D4 8FB10014 */  lw        $s1, 0x14($sp)
/* 191FB8 802636D8 8FB00010 */  lw        $s0, 0x10($sp)
/* 191FBC 802636DC 03E00008 */  jr        $ra
/* 191FC0 802636E0 27BD0038 */   addiu    $sp, $sp, 0x38

### DECOMPILED C INSTRUCTIONS:

void btl_init_menu_boots(void) {
    BattleStatus* battleStatus = &gBattleStatus;
    PlayerData* playerData = &gPlayerData;
    Actor* player = battleStatus->playerActor;
    MoveData* move;
    s32 i;
    s32 moveCount;
    s32 hasAnyBadgeMoves;
    s32 fpCost;

    // If you don't have boots equipped, disable this menu
    if (playerData->bootsLevel == -1) {
        battleStatus->menuStatus[1] = 0;
        return;
    }

    for (i = 0; i < ARRAY_COUNT(battleStatus->submenuMoves); i++) {
        battleStatus->submenuMoves[i] = MOVE_NONE;
    }

    // Standard jump move
    moveCount = 1;
    battleStatus->submenuMoves[0] = playerData->bootsLevel + MOVE_JUMP1;
    battleStatus->submenuIcons[0] = ITEM_PARTNER_ATTACK;

    // Jump badges
    do {
        for (i = 0; i < ARRAY_COUNT(playerData->equippedBadges); i++) {
            s16 badge = playerData->equippedBadges[i];

            if (badge != ITEM_NONE) {
                MoveData* moveTable = gMoveTable;
                u8 moveID = gItemTable[badge].moveID;

                move = &moveTable[moveID];
                if (move->category == MOVE_TYPE_JUMP) {
                    battleStatus->submenuMoves[moveCount] = moveID;
                    battleStatus->submenuIcons[moveCount] = playerData->equippedBadges[i];
                    moveCount++;
                }
            }
        }
    } while (0);

    battleStatus->submenuMoveCount = moveCount;

    hasAnyBadgeMoves = FALSE;
    for (i = 0; i < battleStatus->submenuMoveCount; i++) {
        move = &gMoveTable[battleStatus->submenuMoves[i]];

        // Calculate FP cost
        fpCost = move->costFP;
        if (fpCost != 0) {
            fpCost -= player_team_is_ability_active(player, ABILITY_FLOWER_SAVER);
            fpCost -= player_team_is_ability_active(player, ABILITY_FLOWER_FANATIC) * 2;
            if (fpCost < 1) {
                fpCost = 1;
            }
        }

        // See if there are any targets for this move
        battleStatus->moveCategory = BTL_MENU_TYPE_JUMP;
        battleStatus->moveArgument = playerData->bootsLevel;
        battleStatus->currentTargetListFlags = move->flags; // Controls target filters
        player_create_target_list(player);

        // If there are targets, enable the move
        if (player->targetListLength != 0) {
            hasAnyBadgeMoves = TRUE;
            battleStatus->submenuStatus[i] = BATTLE_SUBMENU_STATUS_ENABLED;
        }

        // If you don't have enough FP, disable the move
        if (playerData->curFP < fpCost) {
            battleStatus->submenuStatus[i] = BATTLE_SUBMENU_STATUS_NOT_ENOUGH_FP;
        }

        // If there are no targets available, disable the move
        if (player->targetListLength == 0) {
            battleStatus->submenuStatus[i] = BATTLE_SUBMENU_STATUS_NO_TARGETS_2;
        }
        if (gBattleStatus.flags2 & BS_FLAGS2_NO_TARGET_AVAILABLE) {
            battleStatus->submenuStatus[moveCount] = BATTLE_SUBMENU_STATUS_NO_TARGETS;
        }
    }

    if (!hasAnyBadgeMoves) {
        // Only the standard jump is available - no badge moves.
        // Selecting this submenu should immediately pick the standard jump move
        battleStatus->menuStatus[1] = -1;
    } else {
        // Enable this submenu
        battleStatus->menuStatus[1] = 1;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel light_rays_update
/* 36D5A0 E006A580 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 36D5A4 E006A584 AFB40020 */  sw        $s4, 0x20($sp)
/* 36D5A8 E006A588 0080A02D */  daddu     $s4, $a0, $zero
/* 36D5AC E006A58C AFBF0024 */  sw        $ra, 0x24($sp)
/* 36D5B0 E006A590 AFB3001C */  sw        $s3, 0x1C($sp)
/* 36D5B4 E006A594 AFB20018 */  sw        $s2, 0x18($sp)
/* 36D5B8 E006A598 AFB10014 */  sw        $s1, 0x14($sp)
/* 36D5BC E006A59C AFB00010 */  sw        $s0, 0x10($sp)
/* 36D5C0 E006A5A0 8E91000C */  lw        $s1, 0xC($s4)
/* 36D5C4 E006A5A4 8E230028 */  lw        $v1, 0x28($s1)
/* 36D5C8 E006A5A8 8E240000 */  lw        $a0, 0x0($s1)
/* 36D5CC E006A5AC 2862000B */  slti      $v0, $v1, 0xB
/* 36D5D0 E006A5B0 10400002 */  beqz      $v0, .LE006A5BC
/* 36D5D4 E006A5B4 2462FFFF */   addiu    $v0, $v1, -0x1
/* 36D5D8 E006A5B8 AE220028 */  sw        $v0, 0x28($s1)
.LE006A5BC:
/* 36D5DC E006A5BC 8E22002C */  lw        $v0, 0x2C($s1)
/* 36D5E0 E006A5C0 24420001 */  addiu     $v0, $v0, 0x1
/* 36D5E4 E006A5C4 AE22002C */  sw        $v0, 0x2C($s1)
/* 36D5E8 E006A5C8 8E830000 */  lw        $v1, 0x0($s4)
/* 36D5EC E006A5CC 30620010 */  andi      $v0, $v1, 0x10
/* 36D5F0 E006A5D0 10400005 */  beqz      $v0, .LE006A5E8
/* 36D5F4 E006A5D4 2402FFEF */   addiu    $v0, $zero, -0x11
/* 36D5F8 E006A5D8 00621024 */  and       $v0, $v1, $v0
/* 36D5FC E006A5DC AE820000 */  sw        $v0, 0x0($s4)
/* 36D600 E006A5E0 2402000A */  addiu     $v0, $zero, 0xA
/* 36D604 E006A5E4 AE220028 */  sw        $v0, 0x28($s1)
.LE006A5E8:
/* 36D608 E006A5E8 8E220028 */  lw        $v0, 0x28($s1)
/* 36D60C E006A5EC 04410005 */  bgez      $v0, .LE006A604
/* 36D610 E006A5F0 0040982D */   daddu    $s3, $v0, $zero
/* 36D614 E006A5F4 0C080128 */  jal       shim_remove_effect
/* 36D618 E006A5F8 0280202D */   daddu    $a0, $s4, $zero
/* 36D61C E006A5FC 0801A9FD */  j         .LE006A7F4
/* 36D620 E006A600 00000000 */   nop
.LE006A604:
/* 36D624 E006A604 8E23002C */  lw        $v1, 0x2C($s1)
/* 36D628 E006A608 28820002 */  slti      $v0, $a0, 0x2
/* 36D62C E006A60C 10400030 */  beqz      $v0, .LE006A6D0
/* 36D630 E006A610 00000000 */   nop
/* 36D634 E006A614 0480002E */  bltz      $a0, .LE006A6D0
/* 36D638 E006A618 24120001 */   addiu    $s2, $zero, 0x1
/* 36D63C E006A61C 8E820008 */  lw        $v0, 0x8($s4)
/* 36D640 E006A620 0242102A */  slt       $v0, $s2, $v0
/* 36D644 E006A624 10400073 */  beqz      $v0, .LE006A7F4
/* 36D648 E006A628 26310094 */   addiu    $s1, $s1, 0x94
/* 36D64C E006A62C 00031080 */  sll       $v0, $v1, 2
/* 36D650 E006A630 00431021 */  addu      $v0, $v0, $v1
/* 36D654 E006A634 02429804 */  sllv      $s3, $v0, $s2
/* 36D658 E006A638 26300028 */  addiu     $s0, $s1, 0x28
.LE006A63C:
/* 36D65C E006A63C 8E020000 */  lw        $v0, 0x0($s0)
/* 36D660 E006A640 8E030004 */  lw        $v1, 0x4($s0)
/* 36D664 E006A644 2442FFFF */  addiu     $v0, $v0, -0x1
/* 36D668 E006A648 24630001 */  addiu     $v1, $v1, 0x1
/* 36D66C E006A64C AE020000 */  sw        $v0, 0x0($s0)
/* 36D670 E006A650 2862000A */  slti      $v0, $v1, 0xA
/* 36D674 E006A654 10400005 */  beqz      $v0, .LE006A66C
/* 36D678 E006A658 AE030004 */   sw       $v1, 0x4($s0)
/* 36D67C E006A65C 00031040 */  sll       $v0, $v1, 1
/* 36D680 E006A660 00431021 */  addu      $v0, $v0, $v1
/* 36D684 E006A664 00021080 */  sll       $v0, $v0, 2
/* 36D688 E006A668 AE02FFFC */  sw        $v0, -0x4($s0)
.LE006A66C:
/* 36D68C E006A66C 8E030000 */  lw        $v1, 0x0($s0)
/* 36D690 E006A670 28620005 */  slti      $v0, $v1, 0x5
/* 36D694 E006A674 10400005 */  beqz      $v0, .LE006A68C
/* 36D698 E006A678 00031040 */   sll      $v0, $v1, 1
/* 36D69C E006A67C 00431021 */  addu      $v0, $v0, $v1
/* 36D6A0 E006A680 000210C0 */  sll       $v0, $v0, 3
/* 36D6A4 E006A684 00431021 */  addu      $v0, $v0, $v1
/* 36D6A8 E006A688 AE02FFFC */  sw        $v0, -0x4($s0)
.LE006A68C:
/* 36D6AC E006A68C C6000030 */  lwc1      $f0, 0x30($s0)
/* 36D6B0 E006A690 C6020064 */  lwc1      $f2, 0x64($s0)
/* 36D6B4 E006A694 46020000 */  add.s     $f0, $f0, $f2
/* 36D6B8 E006A698 8E020000 */  lw        $v0, 0x0($s0)
/* 36D6BC E006A69C 1C400004 */  bgtz      $v0, .LE006A6B0
/* 36D6C0 E006A6A0 E6000030 */   swc1     $f0, 0x30($s0)
/* 36D6C4 E006A6A4 0220202D */  daddu     $a0, $s1, $zero
/* 36D6C8 E006A6A8 0C01A800 */  jal       func_E006A000
/* 36D6CC E006A6AC 26650001 */   addiu    $a1, $s3, 0x1
.LE006A6B0:
/* 36D6D0 E006A6B0 26520001 */  addiu     $s2, $s2, 0x1
/* 36D6D4 E006A6B4 26100094 */  addiu     $s0, $s0, 0x94
/* 36D6D8 E006A6B8 8E820008 */  lw        $v0, 0x8($s4)
/* 36D6DC E006A6BC 0242102A */  slt       $v0, $s2, $v0
/* 36D6E0 E006A6C0 1440FFDE */  bnez      $v0, .LE006A63C
/* 36D6E4 E006A6C4 26310094 */   addiu    $s1, $s1, 0x94
/* 36D6E8 E006A6C8 0801A9FD */  j         .LE006A7F4
/* 36D6EC E006A6CC 00000000 */   nop
.LE006A6D0:
/* 36D6F0 E006A6D0 8E820008 */  lw        $v0, 0x8($s4)
/* 36D6F4 E006A6D4 24120001 */  addiu     $s2, $zero, 0x1
/* 36D6F8 E006A6D8 0242102A */  slt       $v0, $s2, $v0
/* 36D6FC E006A6DC 10400045 */  beqz      $v0, .LE006A7F4
/* 36D700 E006A6E0 26310094 */   addiu    $s1, $s1, 0x94
/* 36D704 E006A6E4 26300064 */  addiu     $s0, $s1, 0x64
.LE006A6E8:
/* 36D708 E006A6E8 0C01A919 */  jal       func_E006A464
/* 36D70C E006A6EC 0220202D */   daddu    $a0, $s1, $zero
/* 36D710 E006A6F0 8E02FFC4 */  lw        $v0, -0x3C($s0)
/* 36D714 E006A6F4 8E03FFC8 */  lw        $v1, -0x38($s0)
/* 36D718 E006A6F8 2442FFFF */  addiu     $v0, $v0, -0x1
/* 36D71C E006A6FC 24630001 */  addiu     $v1, $v1, 0x1
/* 36D720 E006A700 AE02FFC4 */  sw        $v0, -0x3C($s0)
/* 36D724 E006A704 28620005 */  slti      $v0, $v1, 0x5
/* 36D728 E006A708 10400007 */  beqz      $v0, .LE006A728
/* 36D72C E006A70C AE03FFC8 */   sw       $v1, -0x38($s0)
/* 36D730 E006A710 00031040 */  sll       $v0, $v1, 1
/* 36D734 E006A714 00431021 */  addu      $v0, $v0, $v1
/* 36D738 E006A718 000210C0 */  sll       $v0, $v0, 3
/* 36D73C E006A71C 00431021 */  addu      $v0, $v0, $v1
/* 36D740 E006A720 00021040 */  sll       $v0, $v0, 1
/* 36D744 E006A724 AE02FFC0 */  sw        $v0, -0x40($s0)
.LE006A728:
/* 36D748 E006A728 8E03FFC4 */  lw        $v1, -0x3C($s0)
/* 36D74C E006A72C 28620005 */  slti      $v0, $v1, 0x5
/* 36D750 E006A730 10400006 */  beqz      $v0, .LE006A74C
/* 36D754 E006A734 00031040 */   sll      $v0, $v1, 1
/* 36D758 E006A738 00431021 */  addu      $v0, $v0, $v1
/* 36D75C E006A73C 000210C0 */  sll       $v0, $v0, 3
/* 36D760 E006A740 00431021 */  addu      $v0, $v0, $v1
/* 36D764 E006A744 00021040 */  sll       $v0, $v0, 1
/* 36D768 E006A748 AE02FFC0 */  sw        $v0, -0x40($s0)
.LE006A74C:
/* 36D76C E006A74C 2A62000A */  slti      $v0, $s3, 0xA
/* 36D770 E006A750 1040000C */  beqz      $v0, .LE006A784
/* 36D774 E006A754 3C026666 */   lui      $v0, (0x66666667 >> 16)
/* 36D778 E006A758 8E03FFC0 */  lw        $v1, -0x40($s0)
/* 36D77C E006A75C 00730018 */  mult      $v1, $s3
/* 36D780 E006A760 00001812 */  mflo      $v1
/* 36D784 E006A764 34426667 */  ori       $v0, $v0, (0x66666667 & 0xFFFF)
/* 36D788 E006A768 00000000 */  nop
/* 36D78C E006A76C 00620018 */  mult      $v1, $v0
/* 36D790 E006A770 00031FC3 */  sra       $v1, $v1, 31
/* 36D794 E006A774 00001010 */  mfhi      $v0
/* 36D798 E006A778 00021083 */  sra       $v0, $v0, 2
/* 36D79C E006A77C 00431023 */  subu      $v0, $v0, $v1
/* 36D7A0 E006A780 AE02FFC0 */  sw        $v0, -0x40($s0)
.LE006A784:
/* 36D7A4 E006A784 8E02FFC4 */  lw        $v0, -0x3C($s0)
/* 36D7A8 E006A788 1C400003 */  bgtz      $v0, .LE006A798
/* 36D7AC E006A78C 0220202D */   daddu    $a0, $s1, $zero
/* 36D7B0 E006A790 0C01A82F */  jal       func_E006A0BC
/* 36D7B4 E006A794 0240282D */   daddu    $a1, $s2, $zero
.LE006A798:
/* 36D7B8 E006A798 8E02002C */  lw        $v0, 0x2C($s0)
/* 36D7BC E006A79C 18400003 */  blez      $v0, .LE006A7AC
/* 36D7C0 E006A7A0 2442FFFF */   addiu    $v0, $v0, -0x1
/* 36D7C4 E006A7A4 1C40000D */  bgtz      $v0, .LE006A7DC
/* 36D7C8 E006A7A8 AE02002C */   sw       $v0, 0x2C($s0)
.LE006A7AC:
/* 36D7CC E006A7AC C606FFF8 */  lwc1      $f6, -0x8($s0)
/* 36D7D0 E006A7B0 C600001C */  lwc1      $f0, 0x1C($s0)
/* 36D7D4 E006A7B4 C604FFFC */  lwc1      $f4, -0x4($s0)
/* 36D7D8 E006A7B8 46003180 */  add.s     $f6, $f6, $f0
/* 36D7DC E006A7BC C6000020 */  lwc1      $f0, 0x20($s0)
/* 36D7E0 E006A7C0 C6020000 */  lwc1      $f2, 0x0($s0)
/* 36D7E4 E006A7C4 46002100 */  add.s     $f4, $f4, $f0
/* 36D7E8 E006A7C8 C6000024 */  lwc1      $f0, 0x24($s0)
/* 36D7EC E006A7CC 46001080 */  add.s     $f2, $f2, $f0
/* 36D7F0 E006A7D0 E606FFF8 */  swc1      $f6, -0x8($s0)
/* 36D7F4 E006A7D4 E604FFFC */  swc1      $f4, -0x4($s0)
/* 36D7F8 E006A7D8 E6020000 */  swc1      $f2, 0x0($s0)
.LE006A7DC:
/* 36D7FC E006A7DC 26520001 */  addiu     $s2, $s2, 0x1
/* 36D800 E006A7E0 26100094 */  addiu     $s0, $s0, 0x94
/* 36D804 E006A7E4 8E820008 */  lw        $v0, 0x8($s4)
/* 36D808 E006A7E8 0242102A */  slt       $v0, $s2, $v0
/* 36D80C E006A7EC 1440FFBE */  bnez      $v0, .LE006A6E8
/* 36D810 E006A7F0 26310094 */   addiu    $s1, $s1, 0x94
.LE006A7F4:
/* 36D814 E006A7F4 8FBF0024 */  lw        $ra, 0x24($sp)
/* 36D818 E006A7F8 8FB40020 */  lw        $s4, 0x20($sp)
/* 36D81C E006A7FC 8FB3001C */  lw        $s3, 0x1C($sp)
/* 36D820 E006A800 8FB20018 */  lw        $s2, 0x18($sp)
/* 36D824 E006A804 8FB10014 */  lw        $s1, 0x14($sp)
/* 36D828 E006A808 8FB00010 */  lw        $s0, 0x10($sp)
/* 36D82C E006A80C 03E00008 */  jr        $ra
/* 36D830 E006A810 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

void light_rays_update(EffectInstance* effect) {
    LightRaysFXData* part = effect->data.lightRays;
    s32 type = part->type;
    s32 timeLeft;
    s32 lifetime;
    s32 i;

    if (part->timeLeft < 11) {
        part->timeLeft--;
    }

    part->lifetime++;

    if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
        effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
        part->timeLeft = 10;
    }

    if (part->timeLeft < 0) {
        shim_remove_effect(effect);
        return;
    }

    timeLeft = part->timeLeft;
    lifetime = part->lifetime;

    switch (type) {
        case 0:
        case 1:
            part++;
            for (i = 1; i < effect->numParts; i++, part++) {
                part->timeLeft--;
                part->lifetime++;
                if (part->lifetime < 10) {
                    part->alpha = part->lifetime * 12;
                }
                if (part->timeLeft < 5) {
                    part->alpha = part->timeLeft * 25;
                }
                part->unk_58 += part->unk_8C;
                if (part->timeLeft <= 0) {
                    func_E006A000(part, lifetime * 10 + 1);
                }
            }
            break;
        default:
            part++;
            for (i = 1; i < effect->numParts; i++, part++) {
                func_E006A464(part);
                part->timeLeft--;
                part->lifetime++;
                if (part->lifetime < 5) {
                    part->alpha = part->lifetime * 50;
                }
                if (part->timeLeft < 5) {
                    part->alpha = part->timeLeft * 50;
                }
                if (timeLeft < 10) {
                    part->alpha = (part->alpha * timeLeft) / 10;
                }
                if (part->timeLeft <= 0) {
                    func_E006A0BC(part, i);
                }
                if (part->unk_90 <= 0 || --part->unk_90 <= 0) {
                    part->rotation.x += part->unk_80;
                    part->rotation.y += part->unk_84;
                    part->rotation.z += part->unk_88;
                }
            }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_802532D0
/* 181BB0 802532D0 27BDFFB8 */  addiu     $sp, $sp, -0x48
/* 181BB4 802532D4 AFB20038 */  sw        $s2, 0x38($sp)
/* 181BB8 802532D8 0080902D */  daddu     $s2, $a0, $zero
/* 181BBC 802532DC AFBF0040 */  sw        $ra, 0x40($sp)
dgb_01_D_802532E0_C10B60:
/* 181BC0 802532E0 AFB3003C */  sw        $s3, 0x3C($sp)
/* 181BC4 802532E4 AFB10034 */  sw        $s1, 0x34($sp)
/* 181BC8 802532E8 AFB00030 */  sw        $s0, 0x30($sp)
/* 181BCC 802532EC 10A00029 */  beqz      $a1, .L80253394
/* 181BD0 802532F0 8E50000C */   lw       $s0, 0xC($s2)
/* 181BD4 802532F4 8E050000 */  lw        $a1, 0x0($s0)
/* 181BD8 802532F8 0C0B1EAF */  jal       evt_get_variable
/* 181BDC 802532FC 26100004 */   addiu    $s0, $s0, 0x4
/* 181BE0 80253300 0040882D */  daddu     $s1, $v0, $zero
/* 181BE4 80253304 8E050000 */  lw        $a1, 0x0($s0)
/* 181BE8 80253308 26100004 */  addiu     $s0, $s0, 0x4
/* 181BEC 8025330C 0C0B1EAF */  jal       evt_get_variable
/* 181BF0 80253310 0240202D */   daddu    $a0, $s2, $zero
/* 181BF4 80253314 8E050000 */  lw        $a1, 0x0($s0)
/* 181BF8 80253318 26100004 */  addiu     $s0, $s0, 0x4
/* 181BFC 8025331C 0240202D */  daddu     $a0, $s2, $zero
dgb_01_D_80253320_C10BA0:
/* 181C00 80253320 0C0B1EAF */  jal       evt_get_variable
/* 181C04 80253324 0040982D */   daddu    $s3, $v0, $zero
/* 181C08 80253328 3C01802A */  lui       $at, %hi(gSpeakingActorTalkAnim)
/* 181C0C 8025332C AC22FA6C */  sw        $v0, %lo(gSpeakingActorTalkAnim)($at)
/* 181C10 80253330 8E050000 */  lw        $a1, 0x0($s0)
/* 181C14 80253334 0C0B1EAF */  jal       evt_get_variable
/* 181C18 80253338 0240202D */   daddu    $a0, $s2, $zero
/* 181C1C 8025333C 3C01802A */  lui       $at, %hi(gSpeakingActorIdleAnim)
/* 181C20 80253340 AC22FA70 */  sw        $v0, %lo(gSpeakingActorIdleAnim)($at)
/* 181C24 80253344 2402FF81 */  addiu     $v0, $zero, -0x7F
/* 181C28 80253348 16220002 */  bne       $s1, $v0, .L80253354
/* 181C2C 8025334C 00000000 */   nop
/* 181C30 80253350 8E510148 */  lw        $s1, 0x148($s2)
.L80253354:
/* 181C34 80253354 0C09A75B */  jal       get_actor
/* 181C38 80253358 0220202D */   daddu    $a0, $s1, $zero
/* 181C3C 8025335C 0040882D */  daddu     $s1, $v0, $zero
dgb_01_D_80253360_C10BE0:
/* 181C40 80253360 0220202D */  daddu     $a0, $s1, $zero
/* 181C44 80253364 0C099117 */  jal       get_actor_part
/* 181C48 80253368 0260282D */   daddu    $a1, $s3, $zero
/* 181C4C 8025336C 3C04802A */  lui       $a0, %hi(gSpeakingActorPrintCtx)
/* 181C50 80253370 8C84FA60 */  lw        $a0, %lo(gSpeakingActorPrintCtx)($a0)
/* 181C54 80253374 3C01802A */  lui       $at, %hi(gSpeakingActor)
D_80253378:
/* 181C58 80253378 AC31FA74 */  sw        $s1, %lo(gSpeakingActor)($at)
/* 181C5C 8025337C 3C01802A */  lui       $at, %hi(gSpeakingActorPart)
/* 181C60 80253380 AC22FA78 */  sw        $v0, %lo(gSpeakingActorPart)($at)
D_80253384:
/* 181C64 80253384 0C04971C */  jal       close_message
/* 181C68 80253388 00000000 */   nop
D_8025338C:
/* 181C6C 8025338C 0C03A6D5 */  jal       increment_status_bar_disabled
D_80253390:
/* 181C70 80253390 AE400070 */   sw       $zero, 0x70($s2)
.L80253394:
/* 181C74 80253394 8E420070 */  lw        $v0, 0x70($s2)
/* 181C78 80253398 14400060 */  bnez      $v0, .L8025351C
/* 181C7C 8025339C 0000102D */   daddu    $v0, $zero, $zero
dgb_01_D_802533A0_C10C20:
/* 181C80 802533A0 3C11802A */  lui       $s1, %hi(gSpeakingActor)
/* 181C84 802533A4 8E31FA74 */  lw        $s1, %lo(gSpeakingActor)($s1)
/* 181C88 802533A8 3C12802A */  lui       $s2, %hi(gSpeakingActorPart)
/* 181C8C 802533AC 8E52FA78 */  lw        $s2, %lo(gSpeakingActorPart)($s2)
/* 181C90 802533B0 86220150 */  lh        $v0, 0x150($s1)
/* 181C94 802533B4 C6200144 */  lwc1      $f0, 0x144($s1)
/* 181C98 802533B8 44821000 */  mtc1      $v0, $f2
/* 181C9C 802533BC 00000000 */  nop
/* 181CA0 802533C0 468010A0 */  cvt.s.w   $f2, $f2
/* 181CA4 802533C4 8E220000 */  lw        $v0, 0x0($s1)
/* 181CA8 802533C8 30428000 */  andi      $v0, $v0, 0x8000
/* 181CAC 802533CC 1440000D */  bnez      $v0, .L80253404
/* 181CB0 802533D0 46020100 */   add.s    $f4, $f0, $f2
/* 181CB4 802533D4 86220152 */  lh        $v0, 0x152($s1)
/* 181CB8 802533D8 C6200148 */  lwc1      $f0, 0x148($s1)
/* 181CBC 802533DC 44821000 */  mtc1      $v0, $f2
dgb_01_D_802533E0_C10C60:
/* 181CC0 802533E0 00000000 */  nop
/* 181CC4 802533E4 468010A0 */  cvt.s.w   $f2, $f2
/* 181CC8 802533E8 92220191 */  lbu       $v0, 0x191($s1)
/* 181CCC 802533EC 46020000 */  add.s     $f0, $f0, $f2
/* 181CD0 802533F0 44821000 */  mtc1      $v0, $f2
/* 181CD4 802533F4 00000000 */  nop
/* 181CD8 802533F8 468010A0 */  cvt.s.w   $f2, $f2
/* 181CDC 802533FC 08094D0D */  j         .L80253434
/* 181CE0 80253400 46001000 */   add.s    $f0, $f2, $f0
.L80253404:
/* 181CE4 80253404 86220152 */  lh        $v0, 0x152($s1)
/* 181CE8 80253408 C6220148 */  lwc1      $f2, 0x148($s1)
/* 181CEC 8025340C 44820000 */  mtc1      $v0, $f0
/* 181CF0 80253410 00000000 */  nop
/* 181CF4 80253414 46800020 */  cvt.s.w   $f0, $f0
/* 181CF8 80253418 92220191 */  lbu       $v0, 0x191($s1)
/* 181CFC 8025341C 46001080 */  add.s     $f2, $f2, $f0
dgb_01_D_80253420_C10CA0:
/* 181D00 80253420 00021042 */  srl       $v0, $v0, 1
/* 181D04 80253424 44820000 */  mtc1      $v0, $f0
/* 181D08 80253428 00000000 */  nop
/* 181D0C 8025342C 46800020 */  cvt.s.w   $f0, $f0
/* 181D10 80253430 46001000 */  add.s     $f0, $f2, $f0
.L80253434:
/* 181D14 80253434 24040001 */  addiu     $a0, $zero, 0x1
/* 181D18 80253438 44052000 */  mfc1      $a1, $f4
/* 181D1C 8025343C 44060000 */  mfc1      $a2, $f0
/* 181D20 80253440 86230154 */  lh        $v1, 0x154($s1)
/* 181D24 80253444 C622014C */  lwc1      $f2, 0x14C($s1)
/* 181D28 80253448 27A20020 */  addiu     $v0, $sp, 0x20
/* 181D2C 8025344C AFA20010 */  sw        $v0, 0x10($sp)
/* 181D30 80253450 44830000 */  mtc1      $v1, $f0
/* 181D34 80253454 00000000 */  nop
/* 181D38 80253458 46800020 */  cvt.s.w   $f0, $f0
/* 181D3C 8025345C 46001080 */  add.s     $f2, $f2, $f0
dgb_01_D_80253460_C10CE0:
/* 181D40 80253460 27A20024 */  addiu     $v0, $sp, 0x24
/* 181D44 80253464 AFA20014 */  sw        $v0, 0x14($sp)
/* 181D48 80253468 44071000 */  mfc1      $a3, $f2
/* 181D4C 8025346C 27A20028 */  addiu     $v0, $sp, 0x28
/* 181D50 80253470 0C00B94E */  jal       get_screen_coords
/* 181D54 80253474 AFA20018 */   sw       $v0, 0x18($sp)
/* 181D58 80253478 3C10802A */  lui       $s0, %hi(gSpeakingActorPrintCtx)
/* 181D5C 8025347C 2610FA60 */  addiu     $s0, $s0, %lo(gSpeakingActorPrintCtx)
/* 181D60 80253480 8E040000 */  lw        $a0, 0x0($s0)
/* 181D64 80253484 8FA50020 */  lw        $a1, 0x20($sp)
D_80253488:
/* 181D68 80253488 0C0496AE */  jal       msg_printer_set_origin_pos
/* 181D6C 8025348C 8FA60024 */   lw       $a2, 0x24($sp)
/* 181D70 80253490 8E020000 */  lw        $v0, 0x0($s0)
/* 181D74 80253494 8C4304FC */  lw        $v1, 0x4FC($v0)
/* 181D78 80253498 30620040 */  andi      $v0, $v1, 0x40
/* 181D7C 8025349C 10400005 */  beqz      $v0, .L802534B4
dgb_01_D_802534A0_C10D20:
/* 181D80 802534A0 30620080 */   andi     $v0, $v1, 0x80
/* 181D84 802534A4 0C03A6CC */  jal       decrement_status_bar_disabled
/* 181D88 802534A8 00000000 */   nop
/* 181D8C 802534AC 08094D47 */  j         .L8025351C
/* 181D90 802534B0 24020001 */   addiu    $v0, $zero, 0x1
.L802534B4:
/* 181D94 802534B4 10400005 */  beqz      $v0, .L802534CC
/* 181D98 802534B8 00000000 */   nop
/* 181D9C 802534BC 3C06802A */  lui       $a2, %hi(gSpeakingActorTalkAnim)
/* 181DA0 802534C0 8CC6FA6C */  lw        $a2, %lo(gSpeakingActorTalkAnim)($a2)
/* 181DA4 802534C4 08094D35 */  j         .L802534D4
/* 181DA8 802534C8 00000000 */   nop
.L802534CC:
/* 181DAC 802534CC 3C06802A */  lui       $a2, %hi(gSpeakingActorIdleAnim)
/* 181DB0 802534D0 8CC6FA70 */  lw        $a2, %lo(gSpeakingActorIdleAnim)($a2)
.L802534D4:
/* 181DB4 802534D4 04C00003 */  bltz      $a2, .L802534E4
/* 181DB8 802534D8 0220202D */   daddu    $a0, $s1, $zero
/* 181DBC 802534DC 0C098F82 */  jal       func_80263E08
dgb_01_D_802534E0_C10D60:
/* 181DC0 802534E0 0240282D */   daddu    $a1, $s2, $zero
.L802534E4:
/* 181DC4 802534E4 3C03802A */  lui       $v1, %hi(gSpeakingActorPrintIsDone)
/* 181DC8 802534E8 8C63FA68 */  lw        $v1, %lo(gSpeakingActorPrintIsDone)($v1)
/* 181DCC 802534EC 24020001 */  addiu     $v0, $zero, 0x1
/* 181DD0 802534F0 1462000A */  bne       $v1, $v0, .L8025351C
/* 181DD4 802534F4 0000102D */   daddu    $v0, $zero, $zero
/* 181DD8 802534F8 0C03A6CC */  jal       decrement_status_bar_disabled
/* 181DDC 802534FC 00000000 */   nop
/* 181DE0 80253500 24020001 */  addiu     $v0, $zero, 0x1
/* 181DE4 80253504 3C03800A */  lui       $v1, %hi(gOverrideFlags)
/* 181DE8 80253508 2463A650 */  addiu     $v1, $v1, %lo(gOverrideFlags)
/* 181DEC 8025350C 8C640000 */  lw        $a0, 0x0($v1)
/* 181DF0 80253510 2405FFEF */  addiu     $a1, $zero, -0x11
/* 181DF4 80253514 00852024 */  and       $a0, $a0, $a1
/* 181DF8 80253518 AC640000 */  sw        $a0, 0x0($v1)
.L8025351C:
/* 181DFC 8025351C 8FBF0040 */  lw        $ra, 0x40($sp)
dgb_01_D_80253520_C10DA0:
/* 181E00 80253520 8FB3003C */  lw        $s3, 0x3C($sp)
/* 181E04 80253524 8FB20038 */  lw        $s2, 0x38($sp)
/* 181E08 80253528 8FB10034 */  lw        $s1, 0x34($sp)
/* 181E0C 8025352C 8FB00030 */  lw        $s0, 0x30($sp)
/* 181E10 80253530 03E00008 */  jr        $ra
/* 181E14 80253534 27BD0048 */   addiu    $sp, $sp, 0x48

### DECOMPILED C INSTRUCTIONS:

ApiStatus EndActorSpeech(Evt* script, s32 isInitialCall) {
    Bytecode* args = script->ptrReadPos;
    s32 flags;
    s32 anim;
    f32 x, y, z;
    s32 screenX, screenY, screenZ;

    if (isInitialCall) {
        s32 actor = evt_get_variable(script, *args++);
        s32 partID = evt_get_variable(script, *args++);
        ActorPart* actorPart;

        gSpeakingActorTalkAnim = evt_get_variable(script, *args++);
        gSpeakingActorIdleAnim = evt_get_variable(script, *args++);

        if (actor == ACTOR_SELF) {
            actor = script->owner1.actorID;
        }
        actor = (s32) get_actor(actor);
        actorPart = get_actor_part((Actor*)actor, partID);
        gSpeakingActor = (Actor*) actor;
        gSpeakingActorPart = actorPart;
        close_message(gSpeakingActorPrintCtx);
        script->functionTemp[0] = 0;
        increment_status_bar_disabled();
    }

    if (script->functionTemp[0] == 0) {
        Actor* actor = gSpeakingActor;
        ActorPart* actorPart = gSpeakingActorPart;

        x = actor->currentPos.x + actor->headOffset.x;
        if (!(gSpeakingActor->flags & ACTOR_FLAG_8000)) {
            y = actor->currentPos.y + actor->headOffset.y + actor->size.y ;
        } else {
            y = actor->currentPos.y + actor->headOffset.y + actor->size.y / 2;
        }
        z = actor->currentPos.z + actor->headOffset.z;
        get_screen_coords(CAM_BATTLE, x, y, z, &screenX, &screenY, &screenZ);
        msg_printer_set_origin_pos(gSpeakingActorPrintCtx, screenX, screenY);

        flags = gSpeakingActorPrintCtx->stateFlags;
        if (flags & 0x40) {
            decrement_status_bar_disabled();
            return ApiStatus_DONE1;
        }

        if (flags & 0x80) {
            anim = gSpeakingActorTalkAnim;
        } else {
            anim = gSpeakingActorIdleAnim;
        }

        if (anim >= 0) {
            func_80263E08(actor, actorPart, anim);
        }

        if (gSpeakingActorPrintIsDone == TRUE) {
            decrement_status_bar_disabled();
            gOverrideFlags &= ~GLOBAL_OVERRIDES_10;
            return ApiStatus_DONE1;
        }
    }

    return ApiStatus_BLOCK;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel npc_test_move_with_slipping
/* 76AC8 800DD618 27BDFF50 */  addiu     $sp, $sp, -0xB0
/* 76ACC 800DD61C C7AC00C4 */  lwc1      $f12, 0xC4($sp)
/* 76AD0 800DD620 3C0140C9 */  lui       $at, (0x40C90FD0 >> 16)
/* 76AD4 800DD624 34210FD0 */  ori       $at, $at, (0x40C90FD0 & 0xFFFF)
/* 76AD8 800DD628 44810000 */  mtc1      $at, $f0
/* 76ADC 800DD62C AFB00068 */  sw        $s0, 0x68($sp)
/* 76AE0 800DD630 0080802D */  daddu     $s0, $a0, $zero
/* 76AE4 800DD634 AFB30074 */  sw        $s3, 0x74($sp)
/* 76AE8 800DD638 00A0982D */  daddu     $s3, $a1, $zero
/* 76AEC 800DD63C AFB1006C */  sw        $s1, 0x6C($sp)
/* 76AF0 800DD640 00C0882D */  daddu     $s1, $a2, $zero
/* 76AF4 800DD644 AFB40078 */  sw        $s4, 0x78($sp)
/* 76AF8 800DD648 00E0A02D */  daddu     $s4, $a3, $zero
/* 76AFC 800DD64C F7B80098 */  sdc1      $f24, 0x98($sp)
/* 76B00 800DD650 C7B800C0 */  lwc1      $f24, 0xC0($sp)
/* 76B04 800DD654 27A50038 */  addiu     $a1, $sp, 0x38
/* 76B08 800DD658 F7B40088 */  sdc1      $f20, 0x88($sp)
/* 76B0C 800DD65C C7B400C8 */  lwc1      $f20, 0xC8($sp)
/* 76B10 800DD660 46006302 */  mul.s     $f12, $f12, $f0
/* 76B14 800DD664 00000000 */  nop
/* 76B18 800DD668 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
/* 76B1C 800DD66C 44810000 */  mtc1      $at, $f0
/* 76B20 800DD670 27A6003C */  addiu     $a2, $sp, 0x3C
/* 76B24 800DD674 AFBF0080 */  sw        $ra, 0x80($sp)
/* 76B28 800DD678 AFB5007C */  sw        $s5, 0x7C($sp)
/* 76B2C 800DD67C AFB20070 */  sw        $s2, 0x70($sp)
/* 76B30 800DD680 F7BC00A8 */  sdc1      $f28, 0xA8($sp)
/* 76B34 800DD684 F7BA00A0 */  sdc1      $f26, 0xA0($sp)
/* 76B38 800DD688 F7B60090 */  sdc1      $f22, 0x90($sp)
/* 76B3C 800DD68C 0C00A82D */  jal       sin_cos_rad
/* 76B40 800DD690 46006303 */   div.s    $f12, $f12, $f0
/* 76B44 800DD694 C7A40038 */  lwc1      $f4, 0x38($sp)
/* 76B48 800DD698 4604C702 */  mul.s     $f28, $f24, $f4
/* 76B4C 800DD69C 00000000 */  nop
/* 76B50 800DD6A0 4604A182 */  mul.s     $f6, $f20, $f4
/* 76B54 800DD6A4 00000000 */  nop
/* 76B58 800DD6A8 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* 76B5C 800DD6AC 44814000 */  mtc1      $at, $f8
/* 76B60 800DD6B0 00000000 */  nop
/* 76B64 800DD6B4 4608A082 */  mul.s     $f2, $f20, $f8
/* 76B68 800DD6B8 00000000 */  nop
/* 76B6C 800DD6BC 46083182 */  mul.s     $f6, $f6, $f8
/* 76B70 800DD6C0 00000000 */  nop
/* 76B74 800DD6C4 2412FFFF */  addiu     $s2, $zero, -0x1
/* 76B78 800DD6C8 4614C000 */  add.s     $f0, $f24, $f20
/* 76B7C 800DD6CC 0000A82D */  daddu     $s5, $zero, $zero
/* 76B80 800DD6D0 46020580 */  add.s     $f22, $f0, $f2
/* 76B84 800DD6D4 C7A2003C */  lwc1      $f2, 0x3C($sp)
/* 76B88 800DD6D8 27A20040 */  addiu     $v0, $sp, 0x40
/* 76B8C 800DD6DC 46001087 */  neg.s     $f2, $f2
/* 76B90 800DD6E0 E7A2003C */  swc1      $f2, 0x3C($sp)
/* 76B94 800DD6E4 E7B6004C */  swc1      $f22, 0x4C($sp)
/* 76B98 800DD6E8 C66A0000 */  lwc1      $f10, 0x0($s3)
/* 76B9C 800DD6EC C68C0000 */  lwc1      $f12, 0x0($s4)
/* 76BA0 800DD6F0 4602A002 */  mul.s     $f0, $f20, $f2
/* 76BA4 800DD6F4 00000000 */  nop
/* 76BA8 800DD6F8 AFA2001C */  sw        $v0, 0x1C($sp)
/* 76BAC 800DD6FC 27A20044 */  addiu     $v0, $sp, 0x44
/* 76BB0 800DD700 AFA20020 */  sw        $v0, 0x20($sp)
/* 76BB4 800DD704 27A20048 */  addiu     $v0, $sp, 0x48
/* 76BB8 800DD708 AFA20024 */  sw        $v0, 0x24($sp)
/* 76BBC 800DD70C 27A2004C */  addiu     $v0, $sp, 0x4C
/* 76BC0 800DD710 AFA20028 */  sw        $v0, 0x28($sp)
/* 76BC4 800DD714 27A20050 */  addiu     $v0, $sp, 0x50
/* 76BC8 800DD718 AFA2002C */  sw        $v0, 0x2C($sp)
/* 76BCC 800DD71C 27A20054 */  addiu     $v0, $sp, 0x54
/* 76BD0 800DD720 46080002 */  mul.s     $f0, $f0, $f8
/* 76BD4 800DD724 00000000 */  nop
/* 76BD8 800DD728 AFA20030 */  sw        $v0, 0x30($sp)
/* 76BDC 800DD72C 27A20058 */  addiu     $v0, $sp, 0x58
/* 76BE0 800DD730 E7A40010 */  swc1      $f4, 0x10($sp)
/* 76BE4 800DD734 AFA00014 */  sw        $zero, 0x14($sp)
/* 76BE8 800DD738 46065281 */  sub.s     $f10, $f10, $f6
/* 76BEC 800DD73C E7A20018 */  swc1      $f2, 0x18($sp)
/* 76BF0 800DD740 AFA20034 */  sw        $v0, 0x34($sp)
/* 76BF4 800DD744 46006301 */  sub.s     $f12, $f12, $f0
/* 76BF8 800DD748 8E260000 */  lw        $a2, 0x0($s1)
/* 76BFC 800DD74C 44055000 */  mfc1      $a1, $f10
/* 76C00 800DD750 44076000 */  mfc1      $a3, $f12
/* 76C04 800DD754 4602C682 */  mul.s     $f26, $f24, $f2
/* 76C08 800DD758 00000000 */  nop
/* 76C0C 800DD75C 0C037513 */  jal       npc_raycast_general
/* 76C10 800DD760 0200202D */   daddu    $a0, $s0, $zero
/* 76C14 800DD764 0040802D */  daddu     $s0, $v0, $zero
/* 76C18 800DD768 0600004E */  bltz      $s0, .L800DD8A4
/* 76C1C 800DD76C 00000000 */   nop
/* 76C20 800DD770 C7A0004C */  lwc1      $f0, 0x4C($sp)
/* 76C24 800DD774 4616003E */  c.le.s    $f0, $f22
/* 76C28 800DD778 00000000 */  nop
/* 76C2C 800DD77C 45000049 */  bc1f      .L800DD8A4
/* 76C30 800DD780 00000000 */   nop
/* 76C34 800DD784 C7A20050 */  lwc1      $f2, 0x50($sp)
/* 76C38 800DD788 46021082 */  mul.s     $f2, $f2, $f2
/* 76C3C 800DD78C 00000000 */  nop
/* 76C40 800DD790 C7A00058 */  lwc1      $f0, 0x58($sp)
/* 76C44 800DD794 46000002 */  mul.s     $f0, $f0, $f0
/* 76C48 800DD798 00000000 */  nop
/* 76C4C 800DD79C 46001300 */  add.s     $f12, $f2, $f0
/* 76C50 800DD7A0 46006004 */  sqrt.s    $f0, $f12
/* 76C54 800DD7A4 46000032 */  c.eq.s    $f0, $f0
/* 76C58 800DD7A8 00000000 */  nop
/* 76C5C 800DD7AC 45010003 */  bc1t      .L800DD7BC
/* 76C60 800DD7B0 00000000 */   nop
/* 76C64 800DD7B4 0C0187BC */  jal       sqrtf
/* 76C68 800DD7B8 00000000 */   nop
.L800DD7BC:
/* 76C6C 800DD7BC 44060000 */  mfc1      $a2, $f0
/* 76C70 800DD7C0 C7A00054 */  lwc1      $f0, 0x54($sp)
/* 76C74 800DD7C4 44806000 */  mtc1      $zero, $f12
/* 76C78 800DD7C8 46000007 */  neg.s     $f0, $f0
/* 76C7C 800DD7CC 44070000 */  mfc1      $a3, $f0
/* 76C80 800DD7D0 0C00A720 */  jal       atan2
/* 76C84 800DD7D4 46006386 */   mov.s    $f14, $f12
/* 76C88 800DD7D8 3C014270 */  lui       $at, (0x42700000 >> 16)
/* 76C8C 800DD7DC 44811000 */  mtc1      $at, $f2
/* 76C90 800DD7E0 46000106 */  mov.s     $f4, $f0
/* 76C94 800DD7E4 4604103C */  c.lt.s    $f2, $f4
/* 76C98 800DD7E8 00000000 */  nop
/* 76C9C 800DD7EC 45000008 */  bc1f      .L800DD810
/* 76CA0 800DD7F0 00000000 */   nop
/* 76CA4 800DD7F4 3C0142B4 */  lui       $at, (0x42B40000 >> 16)
/* 76CA8 800DD7F8 44810000 */  mtc1      $at, $f0
/* 76CAC 800DD7FC 00000000 */  nop
/* 76CB0 800DD800 4600203C */  c.lt.s    $f4, $f0
/* 76CB4 800DD804 00000000 */  nop
/* 76CB8 800DD808 45030001 */  bc1tl     .L800DD810
/* 76CBC 800DD80C 24150001 */   addiu    $s5, $zero, 0x1
.L800DD810:
/* 76CC0 800DD810 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* 76CC4 800DD814 44810000 */  mtc1      $at, $f0
/* 76CC8 800DD818 00000000 */  nop
/* 76CCC 800DD81C 4600A002 */  mul.s     $f0, $f20, $f0
/* 76CD0 800DD820 00000000 */  nop
/* 76CD4 800DD824 4614C080 */  add.s     $f2, $f24, $f20
/* 76CD8 800DD828 27A4005C */  addiu     $a0, $sp, 0x5C
/* 76CDC 800DD82C 4406E000 */  mfc1      $a2, $f28
/* 76CE0 800DD830 46001080 */  add.s     $f2, $f2, $f0
/* 76CE4 800DD834 C7B4004C */  lwc1      $f20, 0x4C($sp)
/* 76CE8 800DD838 4407D000 */  mfc1      $a3, $f26
/* 76CEC 800DD83C 4602A501 */  sub.s     $f20, $f20, $f2
/* 76CF0 800DD840 C7B60038 */  lwc1      $f22, 0x38($sp)
/* 76CF4 800DD844 C7A00050 */  lwc1      $f0, 0x50($sp)
/* 76CF8 800DD848 4616A582 */  mul.s     $f22, $f20, $f22
/* 76CFC 800DD84C 00000000 */  nop
/* 76D00 800DD850 C7A2003C */  lwc1      $f2, 0x3C($sp)
/* 76D04 800DD854 27A50060 */  addiu     $a1, $sp, 0x60
/* 76D08 800DD858 E7A00010 */  swc1      $f0, 0x10($sp)
/* 76D0C 800DD85C C7A00058 */  lwc1      $f0, 0x58($sp)
/* 76D10 800DD860 4602A502 */  mul.s     $f20, $f20, $f2
/* 76D14 800DD864 00000000 */  nop
/* 76D18 800DD868 0C03756D */  jal       npc_get_slip_vector
/* 76D1C 800DD86C E7A00014 */   swc1     $f0, 0x14($sp)
/* 76D20 800DD870 C7A0005C */  lwc1      $f0, 0x5C($sp)
/* 76D24 800DD874 4600B580 */  add.s     $f22, $f22, $f0
/* 76D28 800DD878 C6600000 */  lwc1      $f0, 0x0($s3)
/* 76D2C 800DD87C 46160000 */  add.s     $f0, $f0, $f22
/* 76D30 800DD880 E6600000 */  swc1      $f0, 0x0($s3)
/* 76D34 800DD884 C7A00060 */  lwc1      $f0, 0x60($sp)
/* 76D38 800DD888 4600A500 */  add.s     $f20, $f20, $f0
/* 76D3C 800DD88C C6800000 */  lwc1      $f0, 0x0($s4)
/* 76D40 800DD890 46140000 */  add.s     $f0, $f0, $f20
/* 76D44 800DD894 0200902D */  daddu     $s2, $s0, $zero
/* 76D48 800DD898 E6800000 */  swc1      $f0, 0x0($s4)
/* 76D4C 800DD89C 3C018011 */  lui       $at, %hi(NpcHitQueryColliderID)
/* 76D50 800DD8A0 AC32C978 */  sw        $s2, %lo(NpcHitQueryColliderID)($at)
.L800DD8A4:
/* 76D54 800DD8A4 16A00007 */  bnez      $s5, .L800DD8C4
/* 76D58 800DD8A8 0240102D */   daddu    $v0, $s2, $zero
/* 76D5C 800DD8AC C6600000 */  lwc1      $f0, 0x0($s3)
/* 76D60 800DD8B0 461C0000 */  add.s     $f0, $f0, $f28
/* 76D64 800DD8B4 E6600000 */  swc1      $f0, 0x0($s3)
/* 76D68 800DD8B8 C6800000 */  lwc1      $f0, 0x0($s4)
/* 76D6C 800DD8BC 461A0000 */  add.s     $f0, $f0, $f26
/* 76D70 800DD8C0 E6800000 */  swc1      $f0, 0x0($s4)
.L800DD8C4:
/* 76D74 800DD8C4 8FBF0080 */  lw        $ra, 0x80($sp)
/* 76D78 800DD8C8 8FB5007C */  lw        $s5, 0x7C($sp)
/* 76D7C 800DD8CC 8FB40078 */  lw        $s4, 0x78($sp)
/* 76D80 800DD8D0 8FB30074 */  lw        $s3, 0x74($sp)
/* 76D84 800DD8D4 8FB20070 */  lw        $s2, 0x70($sp)
/* 76D88 800DD8D8 8FB1006C */  lw        $s1, 0x6C($sp)
/* 76D8C 800DD8DC 8FB00068 */  lw        $s0, 0x68($sp)
/* 76D90 800DD8E0 D7BC00A8 */  ldc1      $f28, 0xA8($sp)
/* 76D94 800DD8E4 D7BA00A0 */  ldc1      $f26, 0xA0($sp)
/* 76D98 800DD8E8 D7B80098 */  ldc1      $f24, 0x98($sp)
/* 76D9C 800DD8EC D7B60090 */  ldc1      $f22, 0x90($sp)
/* 76DA0 800DD8F0 D7B40088 */  ldc1      $f20, 0x88($sp)
/* 76DA4 800DD8F4 03E00008 */  jr        $ra
/* 76DA8 800DD8F8 27BD00B0 */   addiu    $sp, $sp, 0xB0

### DECOMPILED C INSTRUCTIONS:

s32 npc_test_move_with_slipping(s32 ignoreFlags, f32* x, f32* y, f32* z, f32 length, f32 yaw, f32 radius) {
    f32 outX, outY;
    f32 bX, bZ;
    f32 hitNy;
    f32 hitDepth;
    f32 hitX, hitY, hitZ;
    f32 outSinTheta, outCosTheta;
    f32 temp_f0, temp_f20, temp_f22;
    f32 aX, aZ;
    f32 inverseOutCosTheta;
    s32 raycastHitID;
    s32 phi_s5;
    s32 hitResult = NO_COLLIDER;
    f32 a, b;

    sin_cos_rad(DEG_TO_RAD(yaw), &outSinTheta, &outCosTheta);
    aX = length * outSinTheta;
    temp_f22 = length + radius + (radius * 0.5f);
    inverseOutCosTheta = -outCosTheta;
    outCosTheta = inverseOutCosTheta;
    hitDepth = temp_f22;
    aZ = length * inverseOutCosTheta;
    raycastHitID = npc_raycast_general(ignoreFlags, *x - (radius * outSinTheta * 0.5f), *y,
                                        *z - (radius * inverseOutCosTheta * 0.5f), outSinTheta,
                                        0.0f, inverseOutCosTheta, &hitX, &hitY, &hitZ, &hitDepth, &bX, &hitNy, &bZ);
    phi_s5 = FALSE;

    if (raycastHitID >= 0 && hitDepth <= temp_f22) {
        temp_f0 = atan2(0.0f, 0.0f, sqrtf(SQ(bX) + SQ(bZ)), -hitNy);
        if (temp_f0 > 60.0f && temp_f0 < 90.0f) {
            phi_s5 = TRUE;
        }

        temp_f20 = hitDepth - (length + radius + (radius * 0.5f));
        a = temp_f20 * outSinTheta;
        b = temp_f20 * outCosTheta;
        npc_get_slip_vector(&outX, &outY, aX, aZ, bX, bZ);
        *x += a + outX;
        *z += b + outY;
        NpcHitQueryColliderID = raycastHitID;
        hitResult = raycastHitID;
    }

    if (phi_s5 == 0) {
        *x += aX;
        *z += aZ;
    }

    return hitResult;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel btl_init_menu_hammer
/* 191FC4 802636E4 27BDFFC8 */  addiu     $sp, $sp, -0x38
/* 191FC8 802636E8 AFB40020 */  sw        $s4, 0x20($sp)
/* 191FCC 802636EC 3C14800E */  lui       $s4, %hi(gBattleStatus)
/* 191FD0 802636F0 2694C070 */  addiu     $s4, $s4, %lo(gBattleStatus)
/* 191FD4 802636F4 AFB7002C */  sw        $s7, 0x2C($sp)
/* 191FD8 802636F8 3C178011 */  lui       $s7, %hi(gPlayerData)
/* 191FDC 802636FC 26F7F290 */  addiu     $s7, $s7, %lo(gPlayerData)
/* 191FE0 80263700 2403FFFF */  addiu     $v1, $zero, -0x1
/* 191FE4 80263704 AFBF0034 */  sw        $ra, 0x34($sp)
/* 191FE8 80263708 AFBE0030 */  sw        $fp, 0x30($sp)
/* 191FEC 8026370C AFB60028 */  sw        $s6, 0x28($sp)
/* 191FF0 80263710 AFB50024 */  sw        $s5, 0x24($sp)
/* 191FF4 80263714 AFB3001C */  sw        $s3, 0x1C($sp)
/* 191FF8 80263718 AFB20018 */  sw        $s2, 0x18($sp)
/* 191FFC 8026371C AFB10014 */  sw        $s1, 0x14($sp)
/* 192000 80263720 AFB00010 */  sw        $s0, 0x10($sp)
/* 192004 80263724 82E20001 */  lb        $v0, 0x1($s7)
/* 192008 80263728 8E9500D8 */  lw        $s5, 0xD8($s4)
/* 19200C 8026372C 14430003 */  bne       $v0, $v1, .L8026373C
/* 192010 80263730 24120017 */   addiu    $s2, $zero, 0x17
/* 192014 80263734 08098E39 */  j         .L802638E4
/* 192018 80263738 A280007F */   sb       $zero, 0x7F($s4)
.L8026373C:
/* 19201C 8026373C 02921021 */  addu      $v0, $s4, $s2
.L80263740:
/* 192020 80263740 A04001DE */  sb        $zero, 0x1DE($v0)
/* 192024 80263744 2652FFFF */  addiu     $s2, $s2, -0x1
/* 192028 80263748 0641FFFD */  bgez      $s2, .L80263740
/* 19202C 8026374C 2442FFFF */   addiu    $v0, $v0, -0x1
/* 192030 80263750 24060001 */  addiu     $a2, $zero, 0x1
/* 192034 80263754 92E20001 */  lbu       $v0, 0x1($s7)
/* 192038 80263758 24030155 */  addiu     $v1, $zero, 0x155
/* 19203C 8026375C A68301AE */  sh        $v1, 0x1AE($s4)
/* 192040 80263760 24420003 */  addiu     $v0, $v0, 0x3
/* 192044 80263764 A28201DE */  sb        $v0, 0x1DE($s4)
/* 192048 80263768 0000902D */  daddu     $s2, $zero, $zero
/* 19204C 8026376C 3C098009 */  lui       $t1, %hi(gMoveTable)
/* 192050 80263770 2529F060 */  addiu     $t1, $t1, %lo(gMoveTable)
/* 192054 80263774 3C088008 */  lui       $t0, %hi(gItemTable)
/* 192058 80263778 250878E0 */  addiu     $t0, $t0, %lo(gItemTable)
/* 19205C 8026377C 00C0382D */  daddu     $a3, $a2, $zero
/* 192060 80263780 02E0202D */  daddu     $a0, $s7, $zero
/* 192064 80263784 26850002 */  addiu     $a1, $s4, 0x2
.L80263788:
/* 192068 80263788 84820208 */  lh        $v0, 0x208($a0)
/* 19206C 8026378C 10400011 */  beqz      $v0, .L802637D4
/* 192070 80263790 26520001 */   addiu    $s2, $s2, 0x1
/* 192074 80263794 00021140 */  sll       $v0, $v0, 5
/* 192078 80263798 00481021 */  addu      $v0, $v0, $t0
/* 19207C 8026379C 9043001A */  lbu       $v1, 0x1A($v0)
/* 192080 802637A0 00031080 */  sll       $v0, $v1, 2
/* 192084 802637A4 00431021 */  addu      $v0, $v0, $v1
/* 192088 802637A8 00021080 */  sll       $v0, $v0, 2
/* 19208C 802637AC 00498821 */  addu      $s1, $v0, $t1
/* 192090 802637B0 82220010 */  lb        $v0, 0x10($s1)
/* 192094 802637B4 14470007 */  bne       $v0, $a3, .L802637D4
/* 192098 802637B8 00000000 */   nop
/* 19209C 802637BC 02861021 */  addu      $v0, $s4, $a2
/* 1920A0 802637C0 A04301DE */  sb        $v1, 0x1DE($v0)
/* 1920A4 802637C4 94820208 */  lhu       $v0, 0x208($a0)
/* 1920A8 802637C8 24C60001 */  addiu     $a2, $a2, 0x1
/* 1920AC 802637CC A4A201AE */  sh        $v0, 0x1AE($a1)
/* 1920B0 802637D0 24A50002 */  addiu     $a1, $a1, 0x2
.L802637D4:
/* 1920B4 802637D4 2A420040 */  slti      $v0, $s2, 0x40
/* 1920B8 802637D8 1440FFEB */  bnez      $v0, .L80263788
/* 1920BC 802637DC 24840002 */   addiu    $a0, $a0, 0x2
/* 1920C0 802637E0 A286020E */  sb        $a2, 0x20E($s4)
/* 1920C4 802637E4 0000902D */  daddu     $s2, $zero, $zero
/* 1920C8 802637E8 30C200FF */  andi      $v0, $a2, 0xFF
/* 1920CC 802637EC 10400039 */  beqz      $v0, .L802638D4
/* 1920D0 802637F0 0240B02D */   daddu    $s6, $s2, $zero
/* 1920D4 802637F4 0286F021 */  addu      $fp, $s4, $a2
/* 1920D8 802637F8 0280982D */  daddu     $s3, $s4, $zero
.L802637FC:
/* 1920DC 802637FC 926301DE */  lbu       $v1, 0x1DE($s3)
/* 1920E0 80263800 3C0A8009 */  lui       $t2, %hi(gMoveTable)
/* 1920E4 80263804 254AF060 */  addiu     $t2, $t2, %lo(gMoveTable)
/* 1920E8 80263808 00031080 */  sll       $v0, $v1, 2
/* 1920EC 8026380C 00431021 */  addu      $v0, $v0, $v1
/* 1920F0 80263810 00021080 */  sll       $v0, $v0, 2
/* 1920F4 80263814 004A8821 */  addu      $s1, $v0, $t2
/* 1920F8 80263818 82300011 */  lb        $s0, 0x11($s1)
/* 1920FC 8026381C 1200000B */  beqz      $s0, .L8026384C
/* 192100 80263820 02A0202D */   daddu    $a0, $s5, $zero
/* 192104 80263824 0C099CAB */  jal       player_team_is_ability_active
/* 192108 80263828 24050018 */   addiu    $a1, $zero, 0x18
/* 19210C 8026382C 02028023 */  subu      $s0, $s0, $v0
/* 192110 80263830 02A0202D */  daddu     $a0, $s5, $zero
/* 192114 80263834 0C099CAB */  jal       player_team_is_ability_active
/* 192118 80263838 24050026 */   addiu    $a1, $zero, 0x26
/* 19211C 8026383C 00021040 */  sll       $v0, $v0, 1
/* 192120 80263840 02028023 */  subu      $s0, $s0, $v0
/* 192124 80263844 5A000001 */  blezl     $s0, .L8026384C
/* 192128 80263848 24100001 */   addiu    $s0, $zero, 0x1
.L8026384C:
/* 19212C 8026384C 92E30001 */  lbu       $v1, 0x1($s7)
/* 192130 80263850 24020001 */  addiu     $v0, $zero, 0x1
/* 192134 80263854 A2820178 */  sb        $v0, 0x178($s4)
/* 192138 80263858 00031E00 */  sll       $v1, $v1, 24
/* 19213C 8026385C 00031E03 */  sra       $v1, $v1, 24
/* 192140 80263860 A683017A */  sh        $v1, 0x17A($s4)
/* 192144 80263864 8E220004 */  lw        $v0, 0x4($s1)
/* 192148 80263868 02A0202D */  daddu     $a0, $s5, $zero
/* 19214C 8026386C 0C098C0B */  jal       func_8026302C
/* 192150 80263870 AE820184 */   sw       $v0, 0x184($s4)
/* 192154 80263874 82A2040C */  lb        $v0, 0x40C($s5)
/* 192158 80263878 10400003 */  beqz      $v0, .L80263888
/* 19215C 8026387C 00000000 */   nop
/* 192160 80263880 24160001 */  addiu     $s6, $zero, 0x1
/* 192164 80263884 A27601F6 */  sb        $s6, 0x1F6($s3)
.L80263888:
/* 192168 80263888 82E20005 */  lb        $v0, 0x5($s7)
/* 19216C 8026388C 0050102A */  slt       $v0, $v0, $s0
/* 192170 80263890 54400001 */  bnel      $v0, $zero, .L80263898
/* 192174 80263894 A26001F6 */   sb       $zero, 0x1F6($s3)
.L80263898:
/* 192178 80263898 82A2040C */  lb        $v0, 0x40C($s5)
/* 19217C 8026389C 14400002 */  bnez      $v0, .L802638A8
/* 192180 802638A0 2402FFFE */   addiu    $v0, $zero, -0x2
/* 192184 802638A4 A26201F6 */  sb        $v0, 0x1F6($s3)
.L802638A8:
/* 192188 802638A8 3C02800E */  lui       $v0, %hi(gBattleStatus + 0x4)
/* 19218C 802638AC 8C42C074 */  lw        $v0, %lo(gBattleStatus + 0x4)($v0)
/* 192190 802638B0 30421000 */  andi      $v0, $v0, 0x1000
/* 192194 802638B4 10400002 */  beqz      $v0, .L802638C0
/* 192198 802638B8 2402FFFF */   addiu    $v0, $zero, -0x1
/* 19219C 802638BC A3C201F6 */  sb        $v0, 0x1F6($fp)
.L802638C0:
/* 1921A0 802638C0 9282020E */  lbu       $v0, 0x20E($s4)
/* 1921A4 802638C4 26520001 */  addiu     $s2, $s2, 0x1
/* 1921A8 802638C8 0242102A */  slt       $v0, $s2, $v0
/* 1921AC 802638CC 1440FFCB */  bnez      $v0, .L802637FC
/* 1921B0 802638D0 26730001 */   addiu    $s3, $s3, 0x1
.L802638D4:
/* 1921B4 802638D4 16C00002 */  bnez      $s6, .L802638E0
/* 1921B8 802638D8 24020001 */   addiu    $v0, $zero, 0x1
/* 1921BC 802638DC 2402FFFF */  addiu     $v0, $zero, -0x1
.L802638E0:
/* 1921C0 802638E0 A282007F */  sb        $v0, 0x7F($s4)
.L802638E4:
/* 1921C4 802638E4 8FBF0034 */  lw        $ra, 0x34($sp)
/* 1921C8 802638E8 8FBE0030 */  lw        $fp, 0x30($sp)
/* 1921CC 802638EC 8FB7002C */  lw        $s7, 0x2C($sp)
/* 1921D0 802638F0 8FB60028 */  lw        $s6, 0x28($sp)
/* 1921D4 802638F4 8FB50024 */  lw        $s5, 0x24($sp)
/* 1921D8 802638F8 8FB40020 */  lw        $s4, 0x20($sp)
/* 1921DC 802638FC 8FB3001C */  lw        $s3, 0x1C($sp)
/* 1921E0 80263900 8FB20018 */  lw        $s2, 0x18($sp)
/* 1921E4 80263904 8FB10014 */  lw        $s1, 0x14($sp)
/* 1921E8 80263908 8FB00010 */  lw        $s0, 0x10($sp)
/* 1921EC 8026390C 03E00008 */  jr        $ra
/* 1921F0 80263910 27BD0038 */   addiu    $sp, $sp, 0x38

### DECOMPILED C INSTRUCTIONS:

void btl_init_menu_hammer(void) {
    BattleStatus* battleStatus = &gBattleStatus;
    PlayerData* playerData = &gPlayerData;
    Actor* player = battleStatus->playerActor;
    MoveData* move;
    s32 i;
    s32 moveCount;
    s32 hasAnyBadgeMoves;
    s32 fpCost;

    // If you don't have a hammer, disable this menu
    if (playerData->hammerLevel == -1) {
        battleStatus->menuStatus[2] = 0;
        return;
    }

    for (i = 0; i < ARRAY_COUNT(battleStatus->submenuMoves); i++) {
        battleStatus->submenuMoves[i] = 0;
    }

    // Standard hammer move
    moveCount = 1;
    battleStatus->submenuMoves[0] = playerData->hammerLevel + MOVE_HAMMER1;
    battleStatus->submenuIcons[0] = ITEM_PARTNER_ATTACK;

    // Hammer badges
    do {
        for (i = 0; i < ARRAY_COUNT(playerData->equippedBadges); i++) {
            s16 badge = playerData->equippedBadges[i];
            if (badge != MOVE_NONE) {
                MoveData* moveTable = gMoveTable;
                u8 moveID = gItemTable[badge].moveID;
                move = &moveTable[moveID];
                if (move->category == MOVE_TYPE_HAMMER) {
                    battleStatus->submenuMoves[moveCount] = moveID;
                    battleStatus->submenuIcons[moveCount] = playerData->equippedBadges[i];
                    moveCount++;
                }
            }
        }
    } while (0);

    battleStatus->submenuMoveCount = moveCount;

    hasAnyBadgeMoves = FALSE;
    for (i = 0; i < battleStatus->submenuMoveCount; i++) {
        move = &gMoveTable[battleStatus->submenuMoves[i]];

        // Calculate FP cost
        fpCost = move->costFP;
        if (fpCost != 0) {
            fpCost -= player_team_is_ability_active(player, ABILITY_FLOWER_SAVER);
            fpCost -= player_team_is_ability_active(player, ABILITY_FLOWER_FANATIC) * 2;
            if (fpCost < 1) {
                fpCost = 1;
            }
        }

        // See if there are any targets for this move
        battleStatus->moveCategory = BTL_MENU_TYPE_SMASH;
        battleStatus->moveArgument = playerData->hammerLevel;
        battleStatus->currentTargetListFlags = move->flags;
        player_create_target_list(player);

        // If there are targets, enable the move
        if (player->targetListLength != 0) {
            hasAnyBadgeMoves = TRUE;
            battleStatus->submenuStatus[i] = 1;
        }

        // If you don't have enough FP, disable the move
        if (playerData->curFP < fpCost) {
            battleStatus->submenuStatus[i] = 0;
        }

        // If there are no targets available, disable the move
        if (player->targetListLength == 0) {
            battleStatus->submenuStatus[i] = BATTLE_SUBMENU_STATUS_NO_TARGETS_2;
        }
        if (gBattleStatus.flags2 & BS_FLAGS2_NO_TARGET_AVAILABLE) {
            battleStatus->submenuStatus[moveCount] = BATTLE_SUBMENU_STATUS_NO_TARGETS;
        }
    }

    if (!hasAnyBadgeMoves) {
        // Only the standard hammer is available - no badge moves.
        // Selecting this submenu should immediately pick the standard hammer move
        battleStatus->menuStatus[2] = -1;
    } else {
        // Enable this submenu
        battleStatus->menuStatus[2] = 1;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel state_step_change_map
/* 1157C 8003617C 3C03800A */  lui       $v1, %hi(gMapTransitionState)
/* 11580 80036180 84630944 */  lh        $v1, %lo(gMapTransitionState)($v1)
/* 11584 80036184 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* 11588 80036188 AFBF0018 */  sw        $ra, 0x18($sp)
/* 1158C 8003618C AFB10014 */  sw        $s1, 0x14($sp)
/* 11590 80036190 2C620005 */  sltiu     $v0, $v1, 0x5
/* 11594 80036194 10400094 */  beqz      $v0, .L800363E8
/* 11598 80036198 AFB00010 */   sw       $s0, 0x10($sp)
/* 1159C 8003619C 00031080 */  sll       $v0, $v1, 2
/* 115A0 800361A0 3C01800A */  lui       $at, %hi(jtbl_80098320)
/* 115A4 800361A4 00220821 */  addu      $at, $at, $v0
/* 115A8 800361A8 8C228320 */  lw        $v0, %lo(jtbl_80098320)($at)
/* 115AC 800361AC 00400008 */  jr        $v0
/* 115B0 800361B0 00000000 */   nop
glabel .L800361B4
/* 115B4 800361B4 0C00E64C */  jal       update_npcs
/* 115B8 800361B8 00000000 */   nop
/* 115BC 800361BC 0C037DD0 */  jal       update_player
/* 115C0 800361C0 00000000 */   nop
/* 115C4 800361C4 0C016754 */  jal       update_effects
/* 115C8 800361C8 00000000 */   nop
/* 115CC 800361CC 0C00B500 */  jal       update_cameras
/* 115D0 800361D0 00000000 */   nop
/* 115D4 800361D4 3C04800A */  lui       $a0, %hi(gMapTransitionAlpha)
/* 115D8 800361D8 24840940 */  addiu     $a0, $a0, %lo(gMapTransitionAlpha)
/* 115DC 800361DC 0C04E0AB */  jal       update_exit_map_screen_overlay
/* 115E0 800361E0 00000000 */   nop
/* 115E4 800361E4 00021400 */  sll       $v0, $v0, 16
/* 115E8 800361E8 1040007F */  beqz      $v0, .L800363E8
/* 115EC 800361EC 00000000 */   nop
/* 115F0 800361F0 3C03800A */  lui       $v1, %hi(gMapTransitionState)
/* 115F4 800361F4 24630944 */  addiu     $v1, $v1, %lo(gMapTransitionState)
/* 115F8 800361F8 94620000 */  lhu       $v0, 0x0($v1)
/* 115FC 800361FC 24420001 */  addiu     $v0, $v0, 0x1
/* 11600 80036200 0800D8FA */  j         .L800363E8
/* 11604 80036204 A4620000 */   sh       $v0, 0x0($v1)
glabel .L80036208
/* 11608 80036208 3C03800A */  lui       $v1, %hi(gOverrideFlags)
/* 1160C 8003620C 2463A650 */  addiu     $v1, $v1, %lo(gOverrideFlags)
/* 11610 80036210 8C620000 */  lw        $v0, 0x0($v1)
/* 11614 80036214 34420008 */  ori       $v0, $v0, 0x8
/* 11618 80036218 0C018028 */  jal       nuContRmbForceStop
/* 1161C 8003621C AC620000 */   sw       $v0, 0x0($v1)
/* 11620 80036220 3C04800A */  lui       $a0, %hi(gMapTransitionState)
/* 11624 80036224 24840944 */  addiu     $a0, $a0, %lo(gMapTransitionState)
/* 11628 80036228 94820000 */  lhu       $v0, 0x0($a0)
/* 1162C 8003622C 24030004 */  addiu     $v1, $zero, 0x4
/* 11630 80036230 3C01800A */  lui       $at, %hi(gMapTransitionStateTime)
/* 11634 80036234 A4230946 */  sh        $v1, %lo(gMapTransitionStateTime)($at)
/* 11638 80036238 24420001 */  addiu     $v0, $v0, 0x1
/* 1163C 8003623C 0800D8FA */  j         .L800363E8
/* 11640 80036240 A4820000 */   sh       $v0, 0x0($a0)
glabel .L80036244
/* 11644 80036244 3C108007 */  lui       $s0, %hi(gGameStatusPtr)
/* 11648 80036248 2610419C */  addiu     $s0, $s0, %lo(gGameStatusPtr)
/* 1164C 8003624C 8E020000 */  lw        $v0, 0x0($s0)
/* 11650 80036250 80420071 */  lb        $v0, 0x71($v0)
/* 11654 80036254 10400003 */  beqz      $v0, .L80036264
/* 11658 80036258 00000000 */   nop
/* 1165C 8003625C 0C00CD3C */  jal       set_game_mode
/* 11660 80036260 24040011 */   addiu    $a0, $zero, 0x11
.L80036264:
/* 11664 80036264 3C11800A */  lui       $s1, %hi(gMapTransitionStateTime)
/* 11668 80036268 26310946 */  addiu     $s1, $s1, %lo(gMapTransitionStateTime)
/* 1166C 8003626C 86220000 */  lh        $v0, 0x0($s1)
/* 11670 80036270 96230000 */  lhu       $v1, 0x0($s1)
/* 11674 80036274 10400003 */  beqz      $v0, .L80036284
/* 11678 80036278 2462FFFF */   addiu    $v0, $v1, -0x1
/* 1167C 8003627C 0800D8FA */  j         .L800363E8
/* 11680 80036280 A6220000 */   sh       $v0, 0x0($s1)
.L80036284:
/* 11684 80036284 8E020000 */  lw        $v0, 0x0($s0)
/* 11688 80036288 A0400070 */  sb        $zero, 0x70($v0)
/* 1168C 8003628C 8E020000 */  lw        $v0, 0x0($s0)
/* 11690 80036290 A0400078 */  sb        $zero, 0x78($v0)
/* 11694 80036294 8E020000 */  lw        $v0, 0x0($s0)
/* 11698 80036298 84440086 */  lh        $a0, 0x86($v0)
/* 1169C 8003629C 8445008C */  lh        $a1, 0x8C($v0)
/* 116A0 800362A0 0C0169BD */  jal       load_map_by_IDs
/* 116A4 800362A4 0000302D */   daddu    $a2, $zero, $zero
/* 116A8 800362A8 0C009C22 */  jal       set_time_freeze_mode
/* 116AC 800362AC 0000202D */   daddu    $a0, $zero, $zero
/* 116B0 800362B0 0C018030 */  jal       nuContRmbForceStopEnd
/* 116B4 800362B4 00000000 */   nop
/* 116B8 800362B8 8E020000 */  lw        $v0, 0x0($s0)
/* 116BC 800362BC 80420071 */  lb        $v0, 0x71($v0)
/* 116C0 800362C0 14400003 */  bnez      $v0, .L800362D0
/* 116C4 800362C4 00000000 */   nop
/* 116C8 800362C8 0C03805E */  jal       disable_player_input
/* 116CC 800362CC 00000000 */   nop
.L800362D0:
/* 116D0 800362D0 0C00B500 */  jal       update_cameras
/* 116D4 800362D4 00000000 */   nop
/* 116D8 800362D8 3C02800A */  lui       $v0, %hi(gMapTransitionState)
/* 116DC 800362DC 24420944 */  addiu     $v0, $v0, %lo(gMapTransitionState)
/* 116E0 800362E0 94430000 */  lhu       $v1, 0x0($v0)
/* 116E4 800362E4 24040002 */  addiu     $a0, $zero, 0x2
/* 116E8 800362E8 A6240000 */  sh        $a0, 0x0($s1)
/* 116EC 800362EC 24630001 */  addiu     $v1, $v1, 0x1
/* 116F0 800362F0 0800D8FA */  j         .L800363E8
/* 116F4 800362F4 A4430000 */   sh       $v1, 0x0($v0)
glabel .L800362F8
/* 116F8 800362F8 0C00F949 */  jal       update_encounters
/* 116FC 800362FC 00000000 */   nop
/* 11700 80036300 0C00E64C */  jal       update_npcs
/* 11704 80036304 00000000 */   nop
/* 11708 80036308 0C037DD0 */  jal       update_player
/* 1170C 8003630C 00000000 */   nop
/* 11710 80036310 0C00B500 */  jal       update_cameras
/* 11714 80036314 00000000 */   nop
/* 11718 80036318 3C04800A */  lui       $a0, %hi(gMapTransitionStateTime)
/* 1171C 8003631C 24840946 */  addiu     $a0, $a0, %lo(gMapTransitionStateTime)
/* 11720 80036320 84820000 */  lh        $v0, 0x0($a0)
/* 11724 80036324 94830000 */  lhu       $v1, 0x0($a0)
/* 11728 80036328 10400003 */  beqz      $v0, .L80036338
/* 1172C 8003632C 2462FFFF */   addiu    $v0, $v1, -0x1
/* 11730 80036330 0800D8FA */  j         .L800363E8
/* 11734 80036334 A4820000 */   sh       $v0, 0x0($a0)
.L80036338:
/* 11738 80036338 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 1173C 8003633C 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 11740 80036340 0C0B1059 */  jal       does_script_exist
/* 11744 80036344 8C44006C */   lw       $a0, 0x6C($v0)
/* 11748 80036348 14400027 */  bnez      $v0, .L800363E8
/* 1174C 8003634C 2405FFF7 */   addiu    $a1, $zero, -0x9
/* 11750 80036350 3C04800A */  lui       $a0, %hi(gOverrideFlags)
/* 11754 80036354 2484A650 */  addiu     $a0, $a0, %lo(gOverrideFlags)
/* 11758 80036358 3C06800A */  lui       $a2, %hi(gMapTransitionState)
/* 1175C 8003635C 24C60944 */  addiu     $a2, $a2, %lo(gMapTransitionState)
/* 11760 80036360 8C820000 */  lw        $v0, 0x0($a0)
/* 11764 80036364 94C30000 */  lhu       $v1, 0x0($a2)
/* 11768 80036368 00451024 */  and       $v0, $v0, $a1
/* 1176C 8003636C 24630001 */  addiu     $v1, $v1, 0x1
/* 11770 80036370 AC820000 */  sw        $v0, 0x0($a0)
/* 11774 80036374 0800D8FA */  j         .L800363E8
/* 11778 80036378 A4C30000 */   sh       $v1, 0x0($a2)
glabel .L8003637C
/* 1177C 8003637C 0C00E64C */  jal       update_npcs
/* 11780 80036380 00000000 */   nop
/* 11784 80036384 0C037DD0 */  jal       update_player
/* 11788 80036388 00000000 */   nop
/* 1178C 8003638C 0C016754 */  jal       update_effects
/* 11790 80036390 00000000 */   nop
/* 11794 80036394 0C00B500 */  jal       update_cameras
/* 11798 80036398 00000000 */   nop
/* 1179C 8003639C 3C04800A */  lui       $a0, %hi(gMapTransitionAlpha)
/* 117A0 800363A0 24840940 */  addiu     $a0, $a0, %lo(gMapTransitionAlpha)
/* 117A4 800363A4 0C04E175 */  jal       update_enter_map_screen_overlay
/* 117A8 800363A8 00000000 */   nop
/* 117AC 800363AC 00021400 */  sll       $v0, $v0, 16
/* 117B0 800363B0 1040000D */  beqz      $v0, .L800363E8
/* 117B4 800363B4 00000000 */   nop
/* 117B8 800363B8 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 117BC 800363BC 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 117C0 800363C0 80420071 */  lb        $v0, 0x71($v0)
/* 117C4 800363C4 14400003 */  bnez      $v0, .L800363D4
/* 117C8 800363C8 00000000 */   nop
/* 117CC 800363CC 0C038069 */  jal       enable_player_input
/* 117D0 800363D0 00000000 */   nop
.L800363D4:
/* 117D4 800363D4 3C05BF80 */  lui       $a1, (0xBF800000 >> 16)
/* 117D8 800363D8 0C04DF62 */  jal       set_screen_overlay_params_front
/* 117DC 800363DC 240400FF */   addiu    $a0, $zero, 0xFF
/* 117E0 800363E0 0C00CD3C */  jal       set_game_mode
/* 117E4 800363E4 24040004 */   addiu    $a0, $zero, 0x4
.L800363E8:
/* 117E8 800363E8 8FBF0018 */  lw        $ra, 0x18($sp)
/* 117EC 800363EC 8FB10014 */  lw        $s1, 0x14($sp)
/* 117F0 800363F0 8FB00010 */  lw        $s0, 0x10($sp)
/* 117F4 800363F4 03E00008 */  jr        $ra
/* 117F8 800363F8 27BD0020 */   addiu    $sp, $sp, 0x20

### DECOMPILED C INSTRUCTIONS:

void state_step_change_map(void) {
    switch (gMapTransitionState) {
        case 0:
            update_npcs();
            update_player();
            update_effects();
            update_cameras();

            if (update_exit_map_screen_overlay(&gMapTransitionAlpha) != 0) {
                gMapTransitionState++;
            }
            break;
        case 1:
            gOverrideFlags |= GLOBAL_OVERRIDES_8;
            nuContRmbForceStop();
            gMapTransitionStateTime = 4;
            gMapTransitionState++;
            break;
        case 2:
            if (gGameStatusPtr->demoState != DEMO_STATE_NONE) {
                set_game_mode(GAME_MODE_DEMO);
            }

            if (gMapTransitionStateTime != 0) {
                gMapTransitionStateTime--;
            } else {
                gGameStatusPtr->isBattle = FALSE;
                gGameStatusPtr->disableScripts = FALSE;
                load_map_by_IDs(gGameStatusPtr->areaID, gGameStatusPtr->mapID, 0);
                set_time_freeze_mode(TIME_FREEZE_NORMAL);
                nuContRmbForceStopEnd();
                if (gGameStatusPtr->demoState == DEMO_STATE_NONE) {
                    disable_player_input();
                }
                update_cameras();
                gMapTransitionStateTime = 2;
                gMapTransitionState++;
            }
            break;
        case 3:
            update_encounters();
            update_npcs();
            update_player();
            update_cameras();

            if (gMapTransitionStateTime != 0) {
                gMapTransitionStateTime--;
            } else if (!does_script_exist(gGameStatusPtr->mainScriptID)) {
                gOverrideFlags &= ~GLOBAL_OVERRIDES_8;
                gMapTransitionState++;
            }
            break;
        case 4:
            update_npcs();
            update_player();
            update_effects();
            update_cameras();

            if (update_enter_map_screen_overlay(&gMapTransitionAlpha) != 0) {
                if (gGameStatusPtr->demoState == DEMO_STATE_NONE) {
                    enable_player_input();
                }
                set_screen_overlay_params_front(OVERLAY_NONE, -1.0f);
                set_game_mode(GAME_MODE_CHANGE_MAP);
            }
            break;
        }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel music_note_appendGfx
/* 35A2C8 E004C3A8 27BDFF40 */  addiu     $sp, $sp, -0xC0
/* 35A2CC E004C3AC 0080182D */  daddu     $v1, $a0, $zero
/* 35A2D0 E004C3B0 3C0838E3 */  lui       $t0, (0x38E38E39 >> 16)
/* 35A2D4 E004C3B4 35088E39 */  ori       $t0, $t0, (0x38E38E39 & 0xFFFF)
/* 35A2D8 E004C3B8 3C05DB06 */  lui       $a1, (0xDB060024 >> 16)
/* 35A2DC E004C3BC 34A50024 */  ori       $a1, $a1, (0xDB060024 & 0xFFFF)
/* 35A2E0 E004C3C0 27A40018 */  addiu     $a0, $sp, 0x18
/* 35A2E4 E004C3C4 AFB500AC */  sw        $s5, 0xAC($sp)
/* 35A2E8 E004C3C8 3C150001 */  lui       $s5, (0x11630 >> 16)
/* 35A2EC E004C3CC AFB200A0 */  sw        $s2, 0xA0($sp)
/* 35A2F0 E004C3D0 3C12800A */  lui       $s2, %hi(gMainGfxPos)
/* 35A2F4 E004C3D4 2652A66C */  addiu     $s2, $s2, %lo(gMainGfxPos)
/* 35A2F8 E004C3D8 AFB600B0 */  sw        $s6, 0xB0($sp)
/* 35A2FC E004C3DC 3C16E700 */  lui       $s6, (0xE7000000 >> 16)
/* 35A300 E004C3E0 AFBF00B4 */  sw        $ra, 0xB4($sp)
/* 35A304 E004C3E4 AFB400A8 */  sw        $s4, 0xA8($sp)
/* 35A308 E004C3E8 AFB300A4 */  sw        $s3, 0xA4($sp)
/* 35A30C E004C3EC AFB1009C */  sw        $s1, 0x9C($sp)
/* 35A310 E004C3F0 AFB00098 */  sw        $s0, 0x98($sp)
/* 35A314 E004C3F4 F7B400B8 */  sdc1      $f20, 0xB8($sp)
/* 35A318 E004C3F8 8E460000 */  lw        $a2, 0x0($s2)
/* 35A31C E004C3FC 8C71000C */  lw        $s1, 0xC($v1)
/* 35A320 E004C400 00C0102D */  daddu     $v0, $a2, $zero
/* 35A324 E004C404 24C60008 */  addiu     $a2, $a2, 0x8
/* 35A328 E004C408 AE460000 */  sw        $a2, 0x0($s2)
/* 35A32C E004C40C 8E27001C */  lw        $a3, 0x1C($s1)
/* 35A330 E004C410 8E330020 */  lw        $s3, 0x20($s1)
/* 35A334 E004C414 3C14DE00 */  lui       $s4, (0xDE000000 >> 16)
/* 35A338 E004C418 AC560000 */  sw        $s6, 0x0($v0)
/* 35A33C E004C41C AC400004 */  sw        $zero, 0x4($v0)
/* 35A340 E004C420 24C20008 */  addiu     $v0, $a2, 0x8
/* 35A344 E004C424 AE420000 */  sw        $v0, 0x0($s2)
/* 35A348 E004C428 24C20010 */  addiu     $v0, $a2, 0x10
/* 35A34C E004C42C ACC50000 */  sw        $a1, 0x0($a2)
/* 35A350 E004C430 AE420000 */  sw        $v0, 0x0($s2)
/* 35A354 E004C434 8C630010 */  lw        $v1, 0x10($v1)
/* 35A358 E004C438 24C20018 */  addiu     $v0, $a2, 0x18
/* 35A35C E004C43C AE420000 */  sw        $v0, 0x0($s2)
/* 35A360 E004C440 3C020900 */  lui       $v0, %hi(D_09000FC0_40E250)
/* 35A364 E004C444 24420FC0 */  addiu     $v0, $v0, %lo(D_09000FC0_40E250)
/* 35A368 E004C448 00072840 */  sll       $a1, $a3, 1
/* 35A36C E004C44C 8C63001C */  lw        $v1, 0x1C($v1)
/* 35A370 E004C450 00A72821 */  addu      $a1, $a1, $a3
/* 35A374 E004C454 ACC2000C */  sw        $v0, 0xC($a2)
/* 35A378 E004C458 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 35A37C E004C45C ACC20010 */  sw        $v0, 0x10($a2)
/* 35A380 E004C460 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 35A384 E004C464 00A80018 */  mult      $a1, $t0
/* 35A388 E004C468 ACD40008 */  sw        $s4, 0x8($a2)
/* 35A38C E004C46C 00621821 */  addu      $v1, $v1, $v0
/* 35A390 E004C470 000517C3 */  sra       $v0, $a1, 31
/* 35A394 E004C474 ACC30004 */  sw        $v1, 0x4($a2)
/* 35A398 E004C478 00004810 */  mfhi      $t1
/* 35A39C E004C47C 000918C3 */  sra       $v1, $t1, 3
/* 35A3A0 E004C480 00621823 */  subu      $v1, $v1, $v0
/* 35A3A4 E004C484 000310C0 */  sll       $v0, $v1, 3
/* 35A3A8 E004C488 00431021 */  addu      $v0, $v0, $v1
/* 35A3AC E004C48C 00021080 */  sll       $v0, $v0, 2
/* 35A3B0 E004C490 00A22823 */  subu      $a1, $a1, $v0
/* 35A3B4 E004C494 3C02E005 */  lui       $v0, (0xE0050000 >> 16)
/* 35A3B8 E004C498 00451021 */  addu      $v0, $v0, $a1
/* 35A3BC E004C49C 9042C67C */  lbu       $v0, -0x3984($v0)
/* 35A3C0 E004C4A0 3C03E005 */  lui       $v1, (0xE0050000 >> 16)
/* 35A3C4 E004C4A4 00651821 */  addu      $v1, $v1, $a1
/* 35A3C8 E004C4A8 9063C67D */  lbu       $v1, -0x3983($v1)
/* 35A3CC E004C4AC 3C01E005 */  lui       $at, (0xE0050000 >> 16)
/* 35A3D0 E004C4B0 00250821 */  addu      $at, $at, $a1
/* 35A3D4 E004C4B4 9025C67E */  lbu       $a1, -0x3982($at)
/* 35A3D8 E004C4B8 00021600 */  sll       $v0, $v0, 24
/* 35A3DC E004C4BC 00031C00 */  sll       $v1, $v1, 16
/* 35A3E0 E004C4C0 00431025 */  or        $v0, $v0, $v1
/* 35A3E4 E004C4C4 00052A00 */  sll       $a1, $a1, 8
/* 35A3E8 E004C4C8 92230017 */  lbu       $v1, 0x17($s1)
/* 35A3EC E004C4CC 00451025 */  or        $v0, $v0, $a1
/* 35A3F0 E004C4D0 00431025 */  or        $v0, $v0, $v1
/* 35A3F4 E004C4D4 ACC20014 */  sw        $v0, 0x14($a2)
/* 35A3F8 E004C4D8 8E250004 */  lw        $a1, 0x4($s1)
/* 35A3FC E004C4DC 8E260008 */  lw        $a2, 0x8($s1)
/* 35A400 E004C4E0 8E27000C */  lw        $a3, 0xC($s1)
/* 35A404 E004C4E4 4480A000 */  mtc1      $zero, $f20
/* 35A408 E004C4E8 0C080108 */  jal       shim_guTranslateF
/* 35A40C E004C4EC 36B51630 */   ori      $s5, $s5, (0x11630 & 0xFFFF)
/* 35A410 E004C4F0 27B00058 */  addiu     $s0, $sp, 0x58
/* 35A414 E004C4F4 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 35A418 E004C4F8 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 35A41C E004C4FC 4406A000 */  mfc1      $a2, $f20
/* 35A420 E004C500 00031080 */  sll       $v0, $v1, 2
/* 35A424 E004C504 00431021 */  addu      $v0, $v0, $v1
/* 35A428 E004C508 00021080 */  sll       $v0, $v0, 2
/* 35A42C E004C50C 00431023 */  subu      $v0, $v0, $v1
/* 35A430 E004C510 000218C0 */  sll       $v1, $v0, 3
/* 35A434 E004C514 00431021 */  addu      $v0, $v0, $v1
/* 35A438 E004C518 000210C0 */  sll       $v0, $v0, 3
/* 35A43C E004C51C 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 35A440 E004C520 00220821 */  addu      $at, $at, $v0
/* 35A444 E004C524 C4201DEC */  lwc1      $f0, %lo(gCameras + 0x6C)($at)
/* 35A448 E004C528 3C073F80 */  lui       $a3, (0x3F800000 >> 16)
/* 35A44C E004C52C 46000007 */  neg.s     $f0, $f0
/* 35A450 E004C530 44050000 */  mfc1      $a1, $f0
/* 35A454 E004C534 0200202D */  daddu     $a0, $s0, $zero
/* 35A458 E004C538 0C080104 */  jal       shim_guRotateF
/* 35A45C E004C53C E7B40010 */   swc1     $f20, 0x10($sp)
/* 35A460 E004C540 0200202D */  daddu     $a0, $s0, $zero
/* 35A464 E004C544 27A50018 */  addiu     $a1, $sp, 0x18
/* 35A468 E004C548 0C080114 */  jal       shim_guMtxCatF
/* 35A46C E004C54C 00A0302D */   daddu    $a2, $a1, $zero
/* 35A470 E004C550 0200202D */  daddu     $a0, $s0, $zero
/* 35A474 E004C554 8E250010 */  lw        $a1, 0x10($s1)
/* 35A478 E004C558 4407A000 */  mfc1      $a3, $f20
/* 35A47C E004C55C 0C080110 */  jal       shim_guScaleF
/* 35A480 E004C560 00A0302D */   daddu    $a2, $a1, $zero
/* 35A484 E004C564 0200202D */  daddu     $a0, $s0, $zero
/* 35A488 E004C568 27A50018 */  addiu     $a1, $sp, 0x18
/* 35A48C E004C56C 0C080114 */  jal       shim_guMtxCatF
/* 35A490 E004C570 00A0302D */   daddu    $a2, $a1, $zero
/* 35A494 E004C574 27A40018 */  addiu     $a0, $sp, 0x18
/* 35A498 E004C578 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* 35A49C E004C57C 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* 35A4A0 E004C580 3C11800A */  lui       $s1, %hi(gDisplayContext)
/* 35A4A4 E004C584 2631A674 */  addiu     $s1, $s1, %lo(gDisplayContext)
/* 35A4A8 E004C588 96050000 */  lhu       $a1, 0x0($s0)
/* 35A4AC E004C58C 8E220000 */  lw        $v0, 0x0($s1)
/* 35A4B0 E004C590 00052980 */  sll       $a1, $a1, 6
/* 35A4B4 E004C594 00B52821 */  addu      $a1, $a1, $s5
/* 35A4B8 E004C598 0C080118 */  jal       shim_guMtxF2L
/* 35A4BC E004C59C 00452821 */   addu     $a1, $v0, $a1
/* 35A4C0 E004C5A0 3C06D838 */  lui       $a2, (0xD8380002 >> 16)
/* 35A4C4 E004C5A4 34C60002 */  ori       $a2, $a2, (0xD8380002 & 0xFFFF)
/* 35A4C8 E004C5A8 8E440000 */  lw        $a0, 0x0($s2)
/* 35A4CC E004C5AC 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 35A4D0 E004C5B0 0080282D */  daddu     $a1, $a0, $zero
/* 35A4D4 E004C5B4 24840008 */  addiu     $a0, $a0, 0x8
/* 35A4D8 E004C5B8 AE440000 */  sw        $a0, 0x0($s2)
/* 35A4DC E004C5BC 96020000 */  lhu       $v0, 0x0($s0)
/* 35A4E0 E004C5C0 00139880 */  sll       $s3, $s3, 2
/* 35A4E4 E004C5C4 ACA30000 */  sw        $v1, 0x0($a1)
/* 35A4E8 E004C5C8 24430001 */  addiu     $v1, $v0, 0x1
/* 35A4EC E004C5CC 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 35A4F0 E004C5D0 00021180 */  sll       $v0, $v0, 6
/* 35A4F4 E004C5D4 A6030000 */  sh        $v1, 0x0($s0)
/* 35A4F8 E004C5D8 8E230000 */  lw        $v1, 0x0($s1)
/* 35A4FC E004C5DC 00551021 */  addu      $v0, $v0, $s5
/* 35A500 E004C5E0 00621821 */  addu      $v1, $v1, $v0
/* 35A504 E004C5E4 24820008 */  addiu     $v0, $a0, 0x8
/* 35A508 E004C5E8 ACA30004 */  sw        $v1, 0x4($a1)
/* 35A50C E004C5EC AE420000 */  sw        $v0, 0x0($s2)
/* 35A510 E004C5F0 AC940000 */  sw        $s4, 0x0($a0)
/* 35A514 E004C5F4 3C03E005 */  lui       $v1, (0xE0050000 >> 16)
/* 35A518 E004C5F8 00731821 */  addu      $v1, $v1, $s3
/* 35A51C E004C5FC 8C63C660 */  lw        $v1, -0x39A0($v1)
/* 35A520 E004C600 24820010 */  addiu     $v0, $a0, 0x10
/* 35A524 E004C604 AE420000 */  sw        $v0, 0x0($s2)
/* 35A528 E004C608 24020040 */  addiu     $v0, $zero, 0x40
/* 35A52C E004C60C AC82000C */  sw        $v0, 0xC($a0)
/* 35A530 E004C610 24820018 */  addiu     $v0, $a0, 0x18
/* 35A534 E004C614 AC860008 */  sw        $a2, 0x8($a0)
/* 35A538 E004C618 AE420000 */  sw        $v0, 0x0($s2)
/* 35A53C E004C61C AC960010 */  sw        $s6, 0x10($a0)
/* 35A540 E004C620 AC800014 */  sw        $zero, 0x14($a0)
/* 35A544 E004C624 AC830004 */  sw        $v1, 0x4($a0)
/* 35A548 E004C628 8FBF00B4 */  lw        $ra, 0xB4($sp)
/* 35A54C E004C62C 8FB600B0 */  lw        $s6, 0xB0($sp)
/* 35A550 E004C630 8FB500AC */  lw        $s5, 0xAC($sp)
/* 35A554 E004C634 8FB400A8 */  lw        $s4, 0xA8($sp)
/* 35A558 E004C638 8FB300A4 */  lw        $s3, 0xA4($sp)
/* 35A55C E004C63C 8FB200A0 */  lw        $s2, 0xA0($sp)
/* 35A560 E004C640 8FB1009C */  lw        $s1, 0x9C($sp)
/* 35A564 E004C644 8FB00098 */  lw        $s0, 0x98($sp)
/* 35A568 E004C648 D7B400B8 */  ldc1      $f20, 0xB8($sp)
/* 35A56C E004C64C 03E00008 */  jr        $ra
/* 35A570 E004C650 27BD00C0 */   addiu    $sp, $sp, 0xC0
/* 35A574 E004C654 00000000 */  nop
/* 35A578 E004C658 00000000 */  nop
/* 35A57C E004C65C 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void music_note_appendGfx(void* data) {
    EffectInstance* effect = data;
    MusicNoteFXData* fxData = effect->data.musicNote;
    Matrix4f sp18, sp58;
    s32 colorIdx = fxData->unk_1C;
    s32 dlistIdx = fxData->unk_20;
    s32 rgbOffset;

    // TODO required to match - need to initialize define twice for some reason
    rgbOffset = (colorIdx * 3) % ARRAY_COUNT(D_E004C67C);
    rgbOffset = (colorIdx * 3) % ARRAY_COUNT(D_E004C67C);

    gDPPipeSync(gMainGfxPos++);
    gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
    gSPDisplayList(gMainGfxPos++, D_09000FC0_35B5A0);
    gDPSetPrimColor(gMainGfxPos++, 0, 0,
        D_E004C67C[rgbOffset], D_E004C67C[rgbOffset + 1], D_E004C67C[rgbOffset + 2], fxData->unk_14
    );
    shim_guTranslateF(sp18, fxData->pos.x, fxData->pos.y, fxData->pos.z);
    shim_guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f);
    shim_guMtxCatF(sp58, sp18, sp18);
    shim_guScaleF(sp58, fxData->unk_10, fxData->unk_10, 0.0f);
    shim_guMtxCatF(sp58, sp18, sp18);
    shim_guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);
    gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
    gSPDisplayList(gMainGfxPos++, D_E004C660[dlistIdx]);
    gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    gDPPipeSync(gMainGfxPos++);
}