### RAW ASSEMBLY INSTRUCTIONS:

glabel state_step_pause
/* FD7C 8003497C 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* FD80 80034980 AFB00010 */  sw        $s0, 0x10($sp)
/* FD84 80034984 3C10800A */  lui       $s0, %hi(D_800A0921)
/* FD88 80034988 26100921 */  addiu     $s0, $s0, %lo(D_800A0921)
/* FD8C 8003498C AFBF0018 */  sw        $ra, 0x18($sp)
/* FD90 80034990 AFB10014 */  sw        $s1, 0x14($sp)
/* FD94 80034994 82110000 */  lb        $s1, 0x0($s0)
/* FD98 80034998 12200005 */  beqz      $s1, .L800349B0
/* FD9C 8003499C 24020002 */   addiu    $v0, $zero, 0x2
/* FDA0 800349A0 12220022 */  beq       $s1, $v0, .L80034A2C
/* FDA4 800349A4 00000000 */   nop
/* FDA8 800349A8 0800D2F8 */  j         .L80034BE0
/* FDAC 800349AC 00000000 */   nop
.L800349B0:
/* FDB0 800349B0 0C00F949 */  jal       update_encounters
/* FDB4 800349B4 00000000 */   nop
/* FDB8 800349B8 0C00E64C */  jal       update_npcs
/* FDBC 800349BC 00000000 */   nop
/* FDC0 800349C0 0C037DD0 */  jal       update_player
/* FDC4 800349C4 00000000 */   nop
/* FDC8 800349C8 0C016754 */  jal       update_effects
/* FDCC 800349CC 00000000 */   nop
/* FDD0 800349D0 3C02800A */  lui       $v0, %hi(nuGfxCfb)
/* FDD4 800349D4 8C42A658 */  lw        $v0, %lo(nuGfxCfb)($v0)
/* FDD8 800349D8 8C430004 */  lw        $v1, 0x4($v0)
/* FDDC 800349DC 3C02800A */  lui       $v0, %hi(nuGfxCfb_ptr)
/* FDE0 800349E0 8C42A64C */  lw        $v0, %lo(nuGfxCfb_ptr)($v0)
/* FDE4 800349E4 1462007E */  bne       $v1, $v0, .L80034BE0
/* FDE8 800349E8 24020004 */   addiu    $v0, $zero, 0x4
/* FDEC 800349EC 3C01800A */  lui       $at, %hi(D_800A0920)
/* FDF0 800349F0 A0220920 */  sb        $v0, %lo(D_800A0920)($at)
/* FDF4 800349F4 24020002 */  addiu     $v0, $zero, 0x2
/* FDF8 800349F8 3C04800A */  lui       $a0, %hi(gOverrideFlags)
/* FDFC 800349FC 2484A650 */  addiu     $a0, $a0, %lo(gOverrideFlags)
/* FE00 80034A00 A2020000 */  sb        $v0, 0x0($s0)
/* FE04 80034A04 3C058007 */  lui       $a1, %hi(gGameStatusPtr)
/* FE08 80034A08 8CA5419C */  lw        $a1, %lo(gGameStatusPtr)($a1)
/* FE0C 80034A0C 8C820000 */  lw        $v0, 0x0($a0)
/* FE10 80034A10 94A30148 */  lhu       $v1, 0x148($a1)
/* FE14 80034A14 34420008 */  ori       $v0, $v0, 0x8
/* FE18 80034A18 AC820000 */  sw        $v0, 0x0($a0)
/* FE1C 80034A1C 3063FF0F */  andi      $v1, $v1, 0xFF0F
/* FE20 80034A20 34630010 */  ori       $v1, $v1, 0x10
/* FE24 80034A24 0800D2F8 */  j         .L80034BE0
/* FE28 80034A28 A4A30148 */   sh       $v1, 0x148($a1)
.L80034A2C:
/* FE2C 80034A2C 3C06800A */  lui       $a2, %hi(D_800A0920)
/* FE30 80034A30 24C60920 */  addiu     $a2, $a2, %lo(D_800A0920)
/* FE34 80034A34 80C30000 */  lb        $v1, 0x0($a2)
/* FE38 80034A38 04600056 */  bltz      $v1, .L80034B94
/* FE3C 80034A3C 90C20000 */   lbu      $v0, 0x0($a2)
/* FE40 80034A40 10600005 */  beqz      $v1, .L80034A58
/* FE44 80034A44 2442FFFF */   addiu    $v0, $v0, -0x1
/* FE48 80034A48 A0C20000 */  sb        $v0, 0x0($a2)
/* FE4C 80034A4C 00021600 */  sll       $v0, $v0, 24
/* FE50 80034A50 1440004C */  bnez      $v0, .L80034B84
/* FE54 80034A54 00000000 */   nop
.L80034A58:
/* FE58 80034A58 3C048007 */  lui       $a0, %hi(pause_frameBuffers)
/* FE5C 80034A5C 24847950 */  addiu     $a0, $a0, %lo(pause_frameBuffers)
/* FE60 80034A60 24050002 */  addiu     $a1, $zero, 0x2
/* FE64 80034A64 2402FFFF */  addiu     $v0, $zero, -0x1
/* FE68 80034A68 0C017CBC */  jal       nuGfxSetCfb
/* FE6C 80034A6C A0C20000 */   sb       $v0, 0x0($a2)
/* FE70 80034A70 3C108007 */  lui       $s0, %hi(gGameStatusPtr)
/* FE74 80034A74 2610419C */  addiu     $s0, $s0, %lo(gGameStatusPtr)
/* FE78 80034A78 8E030000 */  lw        $v1, 0x0($s0)
/* FE7C 80034A7C 9462015C */  lhu       $v0, 0x15C($v1)
/* FE80 80034A80 0C05260E */  jal       sfx_stop_env_sounds
/* FE84 80034A84 A462015E */   sh       $v0, 0x15E($v1)
/* FE88 80034A88 0C00EC6A */  jal       func_8003B1A8
/* FE8C 80034A8C 00000000 */   nop
/* FE90 80034A90 8E020000 */  lw        $v0, 0x0($s0)
/* FE94 80034A94 0C016BA8 */  jal       backup_map_collision_data
/* FE98 80034A98 A0510070 */   sb       $s1, 0x70($v0)
/* FE9C 80034A9C 0C00AB28 */  jal       battle_heap_create
/* FEA0 80034AA0 00000000 */   nop
/* FEA4 80034AA4 0C018028 */  jal       nuContRmbForceStop
/* FEA8 80034AA8 00000000 */   nop
/* FEAC 80034AAC 0C05259C */  jal       sfx_clear_env_sounds
/* FEB0 80034AB0 0000202D */   daddu    $a0, $zero, $zero
/* FEB4 80034AB4 0C0B763E */  jal       spr_init_sprites
/* FEB8 80034AB8 0000202D */   daddu    $a0, $zero, $zero
/* FEBC 80034ABC 0C045751 */  jal       clear_model_data
/* FEC0 80034AC0 00000000 */   nop
/* FEC4 80034AC4 0C052010 */  jal       clear_sprite_shading_data
/* FEC8 80034AC8 00000000 */   nop
/* FECC 80034ACC 0C05177E */  jal       reset_background_settings
/* FED0 80034AD0 00000000 */   nop
/* FED4 80034AD4 0C0482EC */  jal       clear_entity_models
/* FED8 80034AD8 00000000 */   nop
/* FEDC 80034ADC 0C047889 */  jal       clear_animator_list
/* FEE0 80034AE0 00000000 */   nop
/* FEE4 80034AE4 0C048C2E */  jal       clear_worker_list
/* FEE8 80034AE8 00000000 */   nop
/* FEEC 80034AEC 3C048020 */  lui       $a0, %hi(vtx_C20F40)
/* FEF0 80034AF0 24840000 */  addiu     $a0, $a0, %lo(vtx_C20F40)
/* FEF4 80034AF4 3C050003 */  lui       $a1, (0x38000 >> 16)
/* FEF8 80034AF8 0C0514BA */  jal       hud_element_set_aux_cache
/* FEFC 80034AFC 34A58000 */   ori      $a1, $a1, (0x38000 & 0xFFFF)
/* FF00 80034B00 0C050440 */  jal       hud_element_clear_cache
/* FF04 80034B04 00000000 */   nop
/* FF08 80034B08 0C03A6EC */  jal       reset_status_bar
/* FF0C 80034B0C 00000000 */   nop
/* FF10 80034B10 0C04C3FC */  jal       clear_item_entity_data
/* FF14 80034B14 00000000 */   nop
/* FF18 80034B18 0C0B0C77 */  jal       clear_script_list
/* FF1C 80034B1C 00000000 */   nop
/* FF20 80034B20 0C00E12F */  jal       clear_npcs
/* FF24 80034B24 00000000 */   nop
/* FF28 80034B28 0C04432E */  jal       clear_entity_data
/* FF2C 80034B2C 0000202D */   daddu    $a0, $zero, $zero
/* FF30 80034B30 0C0515A0 */  jal       clear_trigger_data
/* FF34 80034B34 00000000 */   nop
/* FF38 80034B38 0C05260A */  jal       sfx_get_reverb_mode
/* FF3C 80034B3C 00000000 */   nop
/* FF40 80034B40 3C01800A */  lui       $at, %hi(SavedReverbMode)
/* FF44 80034B44 AC220924 */  sw        $v0, %lo(SavedReverbMode)($at)
/* FF48 80034B48 0C0525FF */  jal       sfx_set_reverb_mode
/* FF4C 80034B4C 0000202D */   daddu    $a0, $zero, $zero
/* FF50 80034B50 0C052B17 */  jal       bgm_quiet_max_volume
/* FF54 80034B54 00000000 */   nop
/* FF58 80034B58 3C048007 */  lui       $a0, %hi(D_8007795C)
/* FF5C 80034B5C 0C018038 */  jal       nuPiReadRomOverlay
/* FF60 80034B60 2484795C */   addiu    $a0, $a0, %lo(D_8007795C)
/* FF64 80034B64 0C091018 */  jal       func_80244060
/* FF68 80034B68 00000000 */   nop
/* FF6C 80034B6C 3C04800A */  lui       $a0, %hi(gOverrideFlags)
/* FF70 80034B70 2484A650 */  addiu     $a0, $a0, %lo(gOverrideFlags)
/* FF74 80034B74 8C820000 */  lw        $v0, 0x0($a0)
/* FF78 80034B78 2403FFF7 */  addiu     $v1, $zero, -0x9
/* FF7C 80034B7C 00431024 */  and       $v0, $v0, $v1
/* FF80 80034B80 AC820000 */  sw        $v0, 0x0($a0)
.L80034B84:
/* FF84 80034B84 3C02800A */  lui       $v0, %hi(D_800A0920)
/* FF88 80034B88 80420920 */  lb        $v0, %lo(D_800A0920)($v0)
/* FF8C 80034B8C 04410014 */  bgez      $v0, .L80034BE0
/* FF90 80034B90 00000000 */   nop
.L80034B94:
/* FF94 80034B94 3C10800A */  lui       $s0, %hi(D_800A0920)
/* FF98 80034B98 26100920 */  addiu     $s0, $s0, %lo(D_800A0920)
/* FF9C 80034B9C 82020000 */  lb        $v0, 0x0($s0)
/* FFA0 80034BA0 2842FFF6 */  slti      $v0, $v0, -0xA
/* FFA4 80034BA4 14400007 */  bnez      $v0, .L80034BC4
/* FFA8 80034BA8 0000202D */   daddu    $a0, $zero, $zero
/* FFAC 80034BAC 0C091109 */  jal       D_80244424
/* FFB0 80034BB0 0080282D */   daddu    $a1, $a0, $zero
/* FFB4 80034BB4 92020000 */  lbu       $v0, 0x0($s0)
/* FFB8 80034BB8 2442FFFF */  addiu     $v0, $v0, -0x1
/* FFBC 80034BBC 0800D2F6 */  j         .L80034BD8
/* FFC0 80034BC0 A2020000 */   sb       $v0, 0x0($s0)
.L80034BC4:
/* FFC4 80034BC4 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* FFC8 80034BC8 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* FFCC 80034BCC 8C440010 */  lw        $a0, 0x10($v0)
/* FFD0 80034BD0 0C091109 */  jal       D_80244424
/* FFD4 80034BD4 8C450020 */   lw       $a1, 0x20($v0)
.L80034BD8:
/* FFD8 80034BD8 3C01800A */  lui       $at, %hi(D_800A0922)
/* FFDC 80034BDC A4200922 */  sh        $zero, %lo(D_800A0922)($at)
.L80034BE0:
/* FFE0 80034BE0 8FBF0018 */  lw        $ra, 0x18($sp)
/* FFE4 80034BE4 8FB10014 */  lw        $s1, 0x14($sp)
/* FFE8 80034BE8 8FB00010 */  lw        $s0, 0x10($sp)
/* FFEC 80034BEC 03E00008 */  jr        $ra
/* FFF0 80034BF0 27BD0020 */   addiu    $sp, $sp, 0x20

### DECOMPILED C INSTRUCTIONS:

void state_step_pause(void) {
    s32 oldIsBattle = D_800A0921;

    switch (D_800A0921) {
        case 0:
            update_encounters();
            update_npcs();
            update_player();
            update_effects();
            if (nuGfxCfb[1] == nuGfxCfb_ptr) {
                D_800A0920 = 4;
                D_800A0921 = 2;
                gOverrideFlags |= GLOBAL_OVERRIDES_8;
                gGameStatusPtr->backgroundFlags &= ~BACKGROUND_RENDER_STATE_MASK;
                gGameStatusPtr->backgroundFlags |= BACKGROUND_RENDER_STATE_1;

            }
            break;
        case 2:
            if (D_800A0920 >= 0) {
                if (D_800A0920 != 0) {
                    (D_800A0920)--;
                }

                if (D_800A0920 == 0) {
                    D_800A0920 = -1;
                    nuGfxSetCfb(pause_frameBuffers, 2);
                    gGameStatusPtr->savedBackgroundDarkness = gGameStatusPtr->backgroundDarkness;
                    sfx_stop_env_sounds();
                    func_8003B1A8();
                    gGameStatusPtr->isBattle = oldIsBattle;
                    backup_map_collision_data();
                    battle_heap_create();
                    nuContRmbForceStop();
                    sfx_clear_env_sounds(0);
                    spr_init_sprites(PLAYER_SPRITES_MARIO_WORLD);
                    clear_model_data();
                    clear_sprite_shading_data();
                    reset_background_settings();
                    clear_entity_models();
                    clear_animator_list();
                    clear_worker_list();
                    hud_element_set_aux_cache(D_80200000, 0x38000); // TODO shiftability (what should this symbol be?)
                    hud_element_clear_cache();
                    reset_status_bar();
                    clear_item_entity_data();
                    clear_script_list();
                    clear_npcs();
                    clear_entity_data(0);
                    clear_trigger_data();
                    SavedReverbMode = sfx_get_reverb_mode();
                    sfx_set_reverb_mode(0);
                    bgm_quiet_max_volume();
                    nuPiReadRomOverlay(&D_8007795C);
                    pause_init();
                    gOverrideFlags &= ~GLOBAL_OVERRIDES_8;
                }

                if (D_800A0920 >= 0) {
                    break;
                }
            }

            if (D_800A0920 >= -10) {
                pause_handle_input(0, 0);
                D_800A0920--;
            } else {
                pause_handle_input(gGameStatusPtr->pressedButtons[0], gGameStatusPtr->heldButtons[0]);
            }
            D_800A0922 = 0;
            break;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel calc_enemy_test_target
/* 1A5AD8 802771F8 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 1A5ADC 802771FC AFB20018 */  sw        $s2, 0x18($sp)
/* 1A5AE0 80277200 3C12800E */  lui       $s2, %hi(gBattleStatus)
/* 1A5AE4 80277204 2652C070 */  addiu     $s2, $s2, %lo(gBattleStatus)
/* 1A5AE8 80277208 AFBF0020 */  sw        $ra, 0x20($sp)
/* 1A5AEC 8027720C AFB3001C */  sw        $s3, 0x1C($sp)
/* 1A5AF0 80277210 AFB10014 */  sw        $s1, 0x14($sp)
/* 1A5AF4 80277214 AFB00010 */  sw        $s0, 0x10($sp)
/* 1A5AF8 80277218 964301A0 */  lhu       $v1, 0x1A0($s2)
/* 1A5AFC 8027721C 865301A0 */  lh        $s3, 0x1A0($s2)
/* 1A5B00 80277220 924201A2 */  lbu       $v0, 0x1A2($s2)
/* 1A5B04 80277224 825101A2 */  lb        $s1, 0x1A2($s2)
/* 1A5B08 80277228 0260202D */  daddu     $a0, $s3, $zero
/* 1A5B0C 8027722C A64301A4 */  sh        $v1, 0x1A4($s2)
/* 1A5B10 80277230 0C09A75B */  jal       get_actor
/* 1A5B14 80277234 A24201A6 */   sb       $v0, 0x1A6($s2)
/* 1A5B18 80277238 0040802D */  daddu     $s0, $v0, $zero
/* 1A5B1C 8027723C 1200001C */  beqz      $s0, .L802772B0
/* 1A5B20 80277240 0200202D */   daddu    $a0, $s0, $zero
/* 1A5B24 80277244 0C099117 */  jal       get_actor_part
/* 1A5B28 80277248 0220282D */   daddu    $a1, $s1, $zero
/* 1A5B2C 8027724C 0040182D */  daddu     $v1, $v0, $zero
/* 1A5B30 80277250 14600003 */  bnez      $v1, .L80277260
/* 1A5B34 80277254 32640700 */   andi     $a0, $s3, 0x700
.L80277258:
/* 1A5B38 80277258 0809DC96 */  j         .L80277258
/* 1A5B3C 8027725C 00000000 */   nop
.L80277260:
/* 1A5B40 80277260 24020100 */  addiu     $v0, $zero, 0x100
/* 1A5B44 80277264 1082000A */  beq       $a0, $v0, .L80277290
/* 1A5B48 80277268 28820101 */   slti     $v0, $a0, 0x101
/* 1A5B4C 8027726C 1040000A */  beqz      $v0, .L80277298
/* 1A5B50 80277270 00000000 */   nop
/* 1A5B54 80277274 14800008 */  bnez      $a0, .L80277298
/* 1A5B58 80277278 00000000 */   nop
/* 1A5B5C 8027727C 3C028011 */  lui       $v0, %hi(gPlayerData)
/* 1A5B60 80277280 2442F290 */  addiu     $v0, $v0, %lo(gPlayerData)
/* 1A5B64 80277284 90420002 */  lbu       $v0, 0x2($v0)
/* 1A5B68 80277288 0809DCA6 */  j         .L80277298
/* 1A5B6C 8027728C A20201B8 */   sb       $v0, 0x1B8($s0)
.L80277290:
/* 1A5B70 80277290 2402007F */  addiu     $v0, $zero, 0x7F
/* 1A5B74 80277294 A20201B8 */  sb        $v0, 0x1B8($s0)
.L80277298:
/* 1A5B78 80277298 8E420188 */  lw        $v0, 0x188($s2)
/* 1A5B7C 8027729C 04410006 */  bgez      $v0, .L802772B8
/* 1A5B80 802772A0 00000000 */   nop
/* 1A5B84 802772A4 0200202D */  daddu     $a0, $s0, $zero
/* 1A5B88 802772A8 0C09DBE3 */  jal       dispatch_event_general
/* 1A5B8C 802772AC 24050037 */   addiu    $a1, $zero, 0x37
.L802772B0:
/* 1A5B90 802772B0 0809DD04 */  j         .L80277410
/* 1A5B94 802772B4 0000102D */   daddu    $v0, $zero, $zero
.L802772B8:
/* 1A5B98 802772B8 8C62007C */  lw        $v0, 0x7C($v1)
/* 1A5B9C 802772BC 30420020 */  andi      $v0, $v0, 0x20
/* 1A5BA0 802772C0 14400007 */  bnez      $v0, .L802772E0
/* 1A5BA4 802772C4 0000882D */   daddu    $s1, $zero, $zero
/* 1A5BA8 802772C8 8242009A */  lb        $v0, 0x9A($s2)
/* 1A5BAC 802772CC 14400004 */  bnez      $v0, .L802772E0
/* 1A5BB0 802772D0 2402000E */   addiu    $v0, $zero, 0xE
/* 1A5BB4 802772D4 82030218 */  lb        $v1, 0x218($s0)
/* 1A5BB8 802772D8 14620006 */  bne       $v1, $v0, .L802772F4
/* 1A5BBC 802772DC 24020006 */   addiu    $v0, $zero, 0x6
.L802772E0:
/* 1A5BC0 802772E0 8E420188 */  lw        $v0, 0x188($s2)
/* 1A5BC4 802772E4 30420010 */  andi      $v0, $v0, 0x10
/* 1A5BC8 802772E8 50400001 */  beql      $v0, $zero, .L802772F0
/* 1A5BCC 802772EC 24110006 */   addiu    $s1, $zero, 0x6
.L802772F0:
/* 1A5BD0 802772F0 24020006 */  addiu     $v0, $zero, 0x6
.L802772F4:
/* 1A5BD4 802772F4 12220046 */  beq       $s1, $v0, .L80277410
/* 1A5BD8 802772F8 00000000 */   nop
/* 1A5BDC 802772FC 24020100 */  addiu     $v0, $zero, 0x100
/* 1A5BE0 80277300 10820033 */  beq       $a0, $v0, .L802773D0
/* 1A5BE4 80277304 0000882D */   daddu    $s1, $zero, $zero
/* 1A5BE8 80277308 28820101 */  slti      $v0, $a0, 0x101
/* 1A5BEC 8027730C 10400031 */  beqz      $v0, .L802773D4
/* 1A5BF0 80277310 24020006 */   addiu    $v0, $zero, 0x6
/* 1A5BF4 80277314 1480002F */  bnez      $a0, .L802773D4
/* 1A5BF8 80277318 00000000 */   nop
/* 1A5BFC 8027731C 824200A4 */  lb        $v0, 0xA4($s2)
/* 1A5C00 80277320 10400009 */  beqz      $v0, .L80277348
/* 1A5C04 80277324 0200202D */   daddu    $a0, $s0, $zero
/* 1A5C08 80277328 0C00A67F */  jal       rand_int
/* 1A5C0C 8027732C 24040064 */   addiu    $a0, $zero, 0x64
/* 1A5C10 80277330 824300A5 */  lb        $v1, 0xA5($s2)
/* 1A5C14 80277334 0043102A */  slt       $v0, $v0, $v1
/* 1A5C18 80277338 54400025 */  bnel      $v0, $zero, .L802773D0
/* 1A5C1C 8027733C 24110006 */   addiu    $s1, $zero, 0x6
/* 1A5C20 80277340 0809DCF5 */  j         .L802773D4
/* 1A5C24 80277344 24020006 */   addiu    $v0, $zero, 0x6
.L80277348:
/* 1A5C28 80277348 0C099CAB */  jal       player_team_is_ability_active
/* 1A5C2C 8027734C 24050008 */   addiu    $a1, $zero, 0x8
/* 1A5C30 80277350 10400007 */  beqz      $v0, .L80277370
/* 1A5C34 80277354 0200202D */   daddu    $a0, $s0, $zero
/* 1A5C38 80277358 0C00A67F */  jal       rand_int
/* 1A5C3C 8027735C 24040064 */   addiu    $a0, $zero, 0x64
/* 1A5C40 80277360 2842000A */  slti      $v0, $v0, 0xA
/* 1A5C44 80277364 5440001A */  bnel      $v0, $zero, .L802773D0
/* 1A5C48 80277368 24110005 */   addiu    $s1, $zero, 0x5
/* 1A5C4C 8027736C 0200202D */  daddu     $a0, $s0, $zero
.L80277370:
/* 1A5C50 80277370 0C099CAB */  jal       player_team_is_ability_active
/* 1A5C54 80277374 24050021 */   addiu    $a1, $zero, 0x21
/* 1A5C58 80277378 1040000B */  beqz      $v0, .L802773A8
/* 1A5C5C 8027737C 0200202D */   daddu    $a0, $s0, $zero
/* 1A5C60 80277380 820201B8 */  lb        $v0, 0x1B8($s0)
/* 1A5C64 80277384 28420006 */  slti      $v0, $v0, 0x6
/* 1A5C68 80277388 10400007 */  beqz      $v0, .L802773A8
/* 1A5C6C 8027738C 00000000 */   nop
/* 1A5C70 80277390 0C00A67F */  jal       rand_int
/* 1A5C74 80277394 24040064 */   addiu    $a0, $zero, 0x64
/* 1A5C78 80277398 2842001E */  slti      $v0, $v0, 0x1E
/* 1A5C7C 8027739C 5440000C */  bnel      $v0, $zero, .L802773D0
/* 1A5C80 802773A0 24110005 */   addiu    $s1, $zero, 0x5
/* 1A5C84 802773A4 0200202D */  daddu     $a0, $s0, $zero
.L802773A8:
/* 1A5C88 802773A8 0C099CAB */  jal       player_team_is_ability_active
/* 1A5C8C 802773AC 24050023 */   addiu    $a1, $zero, 0x23
/* 1A5C90 802773B0 10400008 */  beqz      $v0, .L802773D4
/* 1A5C94 802773B4 24020006 */   addiu    $v0, $zero, 0x6
/* 1A5C98 802773B8 0C00A67F */  jal       rand_int
/* 1A5C9C 802773BC 24040064 */   addiu    $a0, $zero, 0x64
/* 1A5CA0 802773C0 28420014 */  slti      $v0, $v0, 0x14
/* 1A5CA4 802773C4 10400003 */  beqz      $v0, .L802773D4
/* 1A5CA8 802773C8 24020006 */   addiu    $v0, $zero, 0x6
/* 1A5CAC 802773CC 24110005 */  addiu     $s1, $zero, 0x5
.L802773D0:
/* 1A5CB0 802773D0 24020006 */  addiu     $v0, $zero, 0x6
.L802773D4:
/* 1A5CB4 802773D4 1222000E */  beq       $s1, $v0, .L80277410
/* 1A5CB8 802773D8 00000000 */   nop
/* 1A5CBC 802773DC 24020005 */  addiu     $v0, $zero, 0x5
/* 1A5CC0 802773E0 1222000B */  beq       $s1, $v0, .L80277410
/* 1A5CC4 802773E4 00000000 */   nop
/* 1A5CC8 802773E8 82030214 */  lb        $v1, 0x214($s0)
/* 1A5CCC 802773EC 2402000C */  addiu     $v0, $zero, 0xC
/* 1A5CD0 802773F0 10620006 */  beq       $v1, $v0, .L8027740C
/* 1A5CD4 802773F4 2403000B */   addiu    $v1, $zero, 0xB
/* 1A5CD8 802773F8 82040212 */  lb        $a0, 0x212($s0)
/* 1A5CDC 802773FC 10830004 */  beq       $a0, $v1, .L80277410
/* 1A5CE0 80277400 24020007 */   addiu    $v0, $zero, 0x7
/* 1A5CE4 80277404 0809DD04 */  j         .L80277410
/* 1A5CE8 80277408 0000102D */   daddu    $v0, $zero, $zero
.L8027740C:
/* 1A5CEC 8027740C 24020008 */  addiu     $v0, $zero, 0x8
.L80277410:
/* 1A5CF0 80277410 8FBF0020 */  lw        $ra, 0x20($sp)
/* 1A5CF4 80277414 8FB3001C */  lw        $s3, 0x1C($sp)
/* 1A5CF8 80277418 8FB20018 */  lw        $s2, 0x18($sp)
/* 1A5CFC 8027741C 8FB10014 */  lw        $s1, 0x14($sp)
/* 1A5D00 80277420 8FB00010 */  lw        $s0, 0x10($sp)
/* 1A5D04 80277424 03E00008 */  jr        $ra
/* 1A5D08 80277428 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

HitResult calc_enemy_test_target(Actor* actor) {
    PlayerData* playerData = &gPlayerData;
    BattleStatus* battleStatus = &gBattleStatus;
    s32 targetID = battleStatus->currentTargetID;
    s32 targetPartIdx = battleStatus->currentTargetPart;
    Actor* target;
    Actor* target2;
    ActorPart* targetPart;
    s32 actorClass;
    s32 hitResult;

    battleStatus->currentTargetID2 = battleStatus->currentTargetID;
    battleStatus->currentTargetPart2 = battleStatus->currentTargetPart;

    target = get_actor(targetID);
    if (target == NULL) {
        return HIT_RESULT_HIT;
    }

    targetPart = get_actor_part(target, targetPartIdx);
    ASSERT(targetPart != NULL);

    actorClass = targetID & ACTOR_CLASS_MASK;
    switch (actorClass) {
        case ACTOR_CLASS_PLAYER:
            target->currentHP = playerData->curHP;
            break;
        case ACTOR_CLASS_PARTNER:
            target->currentHP = 127;
            break;
        case ACTOR_CLASS_ENEMY:
            break;
    }

    if (battleStatus->currentAttackElement & DAMAGE_TYPE_TRIGGER_LUCKY) {
        dispatch_event_general(target, EVENT_LUCKY);
        return HIT_RESULT_HIT;
    }

    hitResult = HIT_RESULT_HIT;
    target2 = target;
    if (targetPart->eventFlags & ACTOR_EVENT_FLAG_ILLUSORY || battleStatus->outtaSightActive || target2->transparentStatus == STATUS_KEY_TRANSPARENT) {
        if (!(battleStatus->currentAttackElement & DAMAGE_TYPE_MAGIC)) {
            hitResult = HIT_RESULT_MISS;
        }
    }

    if (hitResult == HIT_RESULT_MISS) {
        return HIT_RESULT_MISS;
    }
    hitResult = HIT_RESULT_HIT;
    switch (actorClass) {
        case ACTOR_CLASS_PLAYER:
            if (battleStatus->cloudNineTurnsLeft) {
                if (rand_int(100) < battleStatus->cloudNineDodgeChance) {
                    hitResult = HIT_RESULT_MISS;
                    break;
                }
            } else {
                if (player_team_is_ability_active(target2, ABILITY_PRETTY_LUCKY)) {
                    if (rand_int(100) < 10) {
                        hitResult = HIT_RESULT_LUCKY;
                        break;
                    }
                }
                if (player_team_is_ability_active(target2, ABILITY_CLOSE_CALL) && (target2->currentHP < 6)) {
                    if (rand_int(100) < 30) {
                        hitResult = HIT_RESULT_LUCKY;
                        break;
                    }
                }
                if (player_team_is_ability_active(target2, ABILITY_LUCKY_DAY)) {
                    if (rand_int(100) < 20) {
                        hitResult = HIT_RESULT_LUCKY;
                        break;
                    }
                }
            }
            break;
        case ACTOR_CLASS_PARTNER:
            break;
        case ACTOR_CLASS_ENEMY:
            break;
    }

    if (hitResult == HIT_RESULT_MISS) {
        return HIT_RESULT_MISS;
    }

    if (hitResult == HIT_RESULT_LUCKY) {
        return HIT_RESULT_LUCKY;
    }

    if (target2->stoneStatus == STATUS_KEY_STONE) {
        return HIT_RESULT_IMMUNE;
    }

    if (target2->staticStatus == STATUS_KEY_STATIC) {
        return HIT_RESULT_HIT_STATIC;
    }

    return HIT_RESULT_HIT;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel snowman_doll_appendGfx
/* 3BD4C0 E00C0760 27BDFF48 */  addiu     $sp, $sp, -0xB8
/* 3BD4C4 E00C0764 0080282D */  daddu     $a1, $a0, $zero
/* 3BD4C8 E00C0768 3C06DB06 */  lui       $a2, (0xDB060024 >> 16)
/* 3BD4CC E00C076C 34C60024 */  ori       $a2, $a2, (0xDB060024 & 0xFFFF)
/* 3BD4D0 E00C0770 27A40018 */  addiu     $a0, $sp, 0x18
/* 3BD4D4 E00C0774 AFB1009C */  sw        $s1, 0x9C($sp)
/* 3BD4D8 E00C0778 3C11800A */  lui       $s1, %hi(gMainGfxPos)
/* 3BD4DC E00C077C 2631A66C */  addiu     $s1, $s1, %lo(gMainGfxPos)
/* 3BD4E0 E00C0780 AFB500AC */  sw        $s5, 0xAC($sp)
/* 3BD4E4 E00C0784 3C150001 */  lui       $s5, (0x11630 >> 16)
/* 3BD4E8 E00C0788 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 3BD4EC E00C078C AFBF00B4 */  sw        $ra, 0xB4($sp)
/* 3BD4F0 E00C0790 AFB600B0 */  sw        $s6, 0xB0($sp)
/* 3BD4F4 E00C0794 AFB400A8 */  sw        $s4, 0xA8($sp)
/* 3BD4F8 E00C0798 AFB300A4 */  sw        $s3, 0xA4($sp)
/* 3BD4FC E00C079C AFB200A0 */  sw        $s2, 0xA0($sp)
/* 3BD500 E00C07A0 AFB00098 */  sw        $s0, 0x98($sp)
/* 3BD504 E00C07A4 8E280000 */  lw        $t0, 0x0($s1)
/* 3BD508 E00C07A8 8CB0000C */  lw        $s0, 0xC($a1)
/* 3BD50C E00C07AC 0100182D */  daddu     $v1, $t0, $zero
/* 3BD510 E00C07B0 8E160024 */  lw        $s6, 0x24($s0)
/* 3BD514 E00C07B4 25080008 */  addiu     $t0, $t0, 0x8
/* 3BD518 E00C07B8 AC620000 */  sw        $v0, 0x0($v1)
/* 3BD51C E00C07BC AC600004 */  sw        $zero, 0x4($v1)
/* 3BD520 E00C07C0 AD060000 */  sw        $a2, 0x0($t0)
/* 3BD524 E00C07C4 8CA20010 */  lw        $v0, 0x10($a1)
/* 3BD528 E00C07C8 36B51630 */  ori       $s5, $s5, (0x11630 & 0xFFFF)
/* 3BD52C E00C07CC AE280000 */  sw        $t0, 0x0($s1)
/* 3BD530 E00C07D0 8C42001C */  lw        $v0, 0x1C($v0)
/* 3BD534 E00C07D4 3C038000 */  lui       $v1, (0x80000000 >> 16)
/* 3BD538 E00C07D8 00431021 */  addu      $v0, $v0, $v1
/* 3BD53C E00C07DC AD020004 */  sw        $v0, 0x4($t0)
/* 3BD540 E00C07E0 8E050004 */  lw        $a1, 0x4($s0)
/* 3BD544 E00C07E4 8E060008 */  lw        $a2, 0x8($s0)
/* 3BD548 E00C07E8 8E07000C */  lw        $a3, 0xC($s0)
/* 3BD54C E00C07EC 25080008 */  addiu     $t0, $t0, 0x8
/* 3BD550 E00C07F0 0C080108 */  jal       shim_guTranslateF
/* 3BD554 E00C07F4 AE280000 */   sw       $t0, 0x0($s1)
/* 3BD558 E00C07F8 27B20058 */  addiu     $s2, $sp, 0x58
/* 3BD55C E00C07FC 8E050028 */  lw        $a1, 0x28($s0)
/* 3BD560 E00C0800 0240202D */  daddu     $a0, $s2, $zero
/* 3BD564 E00C0804 00A0302D */  daddu     $a2, $a1, $zero
/* 3BD568 E00C0808 0C080110 */  jal       shim_guScaleF
/* 3BD56C E00C080C 00A0382D */   daddu    $a3, $a1, $zero
/* 3BD570 E00C0810 0240202D */  daddu     $a0, $s2, $zero
/* 3BD574 E00C0814 27A50018 */  addiu     $a1, $sp, 0x18
/* 3BD578 E00C0818 0C080114 */  jal       shim_guMtxCatF
/* 3BD57C E00C081C 00A0302D */   daddu    $a2, $a1, $zero
/* 3BD580 E00C0820 27A40018 */  addiu     $a0, $sp, 0x18
/* 3BD584 E00C0824 3C138007 */  lui       $s3, %hi(gMatrixListPos)
/* 3BD588 E00C0828 267341F0 */  addiu     $s3, $s3, %lo(gMatrixListPos)
/* 3BD58C E00C082C 3C14800A */  lui       $s4, %hi(gDisplayContext)
/* 3BD590 E00C0830 2694A674 */  addiu     $s4, $s4, %lo(gDisplayContext)
/* 3BD594 E00C0834 96650000 */  lhu       $a1, 0x0($s3)
/* 3BD598 E00C0838 8E820000 */  lw        $v0, 0x0($s4)
/* 3BD59C E00C083C 00052980 */  sll       $a1, $a1, 6
/* 3BD5A0 E00C0840 00B52821 */  addu      $a1, $a1, $s5
/* 3BD5A4 E00C0844 0C080118 */  jal       shim_guMtxF2L
/* 3BD5A8 E00C0848 00452821 */   addu     $a1, $v0, $a1
/* 3BD5AC E00C084C 3C02DA38 */  lui       $v0, (0xDA380002 >> 16)
/* 3BD5B0 E00C0850 34420002 */  ori       $v0, $v0, (0xDA380002 & 0xFFFF)
/* 3BD5B4 E00C0854 27A40018 */  addiu     $a0, $sp, 0x18
/* 3BD5B8 E00C0858 8E280000 */  lw        $t0, 0x0($s1)
/* 3BD5BC E00C085C 96690000 */  lhu       $t1, 0x0($s3)
/* 3BD5C0 E00C0860 0100282D */  daddu     $a1, $t0, $zero
/* 3BD5C4 E00C0864 ACA20000 */  sw        $v0, 0x0($a1)
/* 3BD5C8 E00C0868 3122FFFF */  andi      $v0, $t1, 0xFFFF
/* 3BD5CC E00C086C 00021180 */  sll       $v0, $v0, 6
/* 3BD5D0 E00C0870 00551021 */  addu      $v0, $v0, $s5
/* 3BD5D4 E00C0874 8E830000 */  lw        $v1, 0x0($s4)
/* 3BD5D8 E00C0878 25080008 */  addiu     $t0, $t0, 0x8
/* 3BD5DC E00C087C 00621821 */  addu      $v1, $v1, $v0
/* 3BD5E0 E00C0880 ACA30004 */  sw        $v1, 0x4($a1)
/* 3BD5E4 E00C0884 8E050030 */  lw        $a1, 0x30($s0)
/* 3BD5E8 E00C0888 8E060034 */  lw        $a2, 0x34($s0)
/* 3BD5EC E00C088C 8E070038 */  lw        $a3, 0x38($s0)
/* 3BD5F0 E00C0890 25290001 */  addiu     $t1, $t1, 0x1
/* 3BD5F4 E00C0894 AE280000 */  sw        $t0, 0x0($s1)
/* 3BD5F8 E00C0898 0C080108 */  jal       shim_guTranslateF
/* 3BD5FC E00C089C A6690000 */   sh       $t1, 0x0($s3)
/* 3BD600 E00C08A0 0240202D */  daddu     $a0, $s2, $zero
/* 3BD604 E00C08A4 8E050048 */  lw        $a1, 0x48($s0)
/* 3BD608 E00C08A8 8E06004C */  lw        $a2, 0x4C($s0)
/* 3BD60C E00C08AC 0C080110 */  jal       shim_guScaleF
/* 3BD610 E00C08B0 00A0382D */   daddu    $a3, $a1, $zero
/* 3BD614 E00C08B4 0240202D */  daddu     $a0, $s2, $zero
/* 3BD618 E00C08B8 27A50018 */  addiu     $a1, $sp, 0x18
/* 3BD61C E00C08BC 0C080114 */  jal       shim_guMtxCatF
/* 3BD620 E00C08C0 00A0302D */   daddu    $a2, $a1, $zero
/* 3BD624 E00C08C4 44800000 */  mtc1      $zero, $f0
/* 3BD628 E00C08C8 3C073F80 */  lui       $a3, (0x3F800000 >> 16)
/* 3BD62C E00C08CC E7A00010 */  swc1      $f0, 0x10($sp)
/* 3BD630 E00C08D0 8E05002C */  lw        $a1, 0x2C($s0)
/* 3BD634 E00C08D4 44060000 */  mfc1      $a2, $f0
/* 3BD638 E00C08D8 0C080104 */  jal       shim_guRotateF
/* 3BD63C E00C08DC 0240202D */   daddu    $a0, $s2, $zero
/* 3BD640 E00C08E0 0240202D */  daddu     $a0, $s2, $zero
/* 3BD644 E00C08E4 27A50018 */  addiu     $a1, $sp, 0x18
/* 3BD648 E00C08E8 0C080114 */  jal       shim_guMtxCatF
/* 3BD64C E00C08EC 00A0302D */   daddu    $a2, $a1, $zero
/* 3BD650 E00C08F0 27A40018 */  addiu     $a0, $sp, 0x18
/* 3BD654 E00C08F4 96650000 */  lhu       $a1, 0x0($s3)
/* 3BD658 E00C08F8 8E820000 */  lw        $v0, 0x0($s4)
/* 3BD65C E00C08FC 00052980 */  sll       $a1, $a1, 6
/* 3BD660 E00C0900 00B52821 */  addu      $a1, $a1, $s5
/* 3BD664 E00C0904 0C080118 */  jal       shim_guMtxF2L
/* 3BD668 E00C0908 00452821 */   addu     $a1, $v0, $a1
/* 3BD66C E00C090C 3C08D838 */  lui       $t0, (0xD8380002 >> 16)
/* 3BD670 E00C0910 35080002 */  ori       $t0, $t0, (0xD8380002 & 0xFFFF)
/* 3BD674 E00C0914 8E240000 */  lw        $a0, 0x0($s1)
/* 3BD678 E00C0918 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 3BD67C E00C091C 0080282D */  daddu     $a1, $a0, $zero
/* 3BD680 E00C0920 24840008 */  addiu     $a0, $a0, 0x8
/* 3BD684 E00C0924 AE240000 */  sw        $a0, 0x0($s1)
/* 3BD688 E00C0928 96620000 */  lhu       $v0, 0x0($s3)
/* 3BD68C E00C092C 32D600FF */  andi      $s6, $s6, 0xFF
/* 3BD690 E00C0930 ACA30000 */  sw        $v1, 0x0($a1)
/* 3BD694 E00C0934 24430001 */  addiu     $v1, $v0, 0x1
/* 3BD698 E00C0938 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 3BD69C E00C093C 00021180 */  sll       $v0, $v0, 6
/* 3BD6A0 E00C0940 A6630000 */  sh        $v1, 0x0($s3)
/* 3BD6A4 E00C0944 8E830000 */  lw        $v1, 0x0($s4)
/* 3BD6A8 E00C0948 00551021 */  addu      $v0, $v0, $s5
/* 3BD6AC E00C094C 00621821 */  addu      $v1, $v1, $v0
/* 3BD6B0 E00C0950 24820008 */  addiu     $v0, $a0, 0x8
/* 3BD6B4 E00C0954 ACA30004 */  sw        $v1, 0x4($a1)
/* 3BD6B8 E00C0958 AE220000 */  sw        $v0, 0x0($s1)
/* 3BD6BC E00C095C 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 3BD6C0 E00C0960 AC820000 */  sw        $v0, 0x0($a0)
/* 3BD6C4 E00C0964 24820010 */  addiu     $v0, $a0, 0x10
/* 3BD6C8 E00C0968 9203001B */  lbu       $v1, 0x1B($s0)
/* 3BD6CC E00C096C 9206001F */  lbu       $a2, 0x1F($s0)
/* 3BD6D0 E00C0970 92070023 */  lbu       $a3, 0x23($s0)
/* 3BD6D4 E00C0974 3C05DE00 */  lui       $a1, (0xDE000000 >> 16)
/* 3BD6D8 E00C0978 AE220000 */  sw        $v0, 0x0($s1)
/* 3BD6DC E00C097C 3C020900 */  lui       $v0, %hi(D_090037A8_410A38)
/* 3BD6E0 E00C0980 244237A8 */  addiu     $v0, $v0, %lo(D_090037A8_410A38)
/* 3BD6E4 E00C0984 AC82000C */  sw        $v0, 0xC($a0)
/* 3BD6E8 E00C0988 24820018 */  addiu     $v0, $a0, 0x18
/* 3BD6EC E00C098C AC850008 */  sw        $a1, 0x8($a0)
/* 3BD6F0 E00C0990 AE220000 */  sw        $v0, 0x0($s1)
/* 3BD6F4 E00C0994 3C020900 */  lui       $v0, %hi(D_09003818_410AA8)
/* 3BD6F8 E00C0998 24423818 */  addiu     $v0, $v0, %lo(D_09003818_410AA8)
/* 3BD6FC E00C099C AC820014 */  sw        $v0, 0x14($a0)
/* 3BD700 E00C09A0 24820020 */  addiu     $v0, $a0, 0x20
/* 3BD704 E00C09A4 AC850010 */  sw        $a1, 0x10($a0)
/* 3BD708 E00C09A8 24050040 */  addiu     $a1, $zero, 0x40
/* 3BD70C E00C09AC AE220000 */  sw        $v0, 0x0($s1)
/* 3BD710 E00C09B0 24820028 */  addiu     $v0, $a0, 0x28
/* 3BD714 E00C09B4 AC880018 */  sw        $t0, 0x18($a0)
/* 3BD718 E00C09B8 AC85001C */  sw        $a1, 0x1C($a0)
/* 3BD71C E00C09BC AE220000 */  sw        $v0, 0x0($s1)
/* 3BD720 E00C09C0 AC880020 */  sw        $t0, 0x20($a0)
/* 3BD724 E00C09C4 AC850024 */  sw        $a1, 0x24($a0)
/* 3BD728 E00C09C8 00031E00 */  sll       $v1, $v1, 24
/* 3BD72C E00C09CC 00063400 */  sll       $a2, $a2, 16
/* 3BD730 E00C09D0 00661825 */  or        $v1, $v1, $a2
/* 3BD734 E00C09D4 00073A00 */  sll       $a3, $a3, 8
/* 3BD738 E00C09D8 00671825 */  or        $v1, $v1, $a3
/* 3BD73C E00C09DC 00761825 */  or        $v1, $v1, $s6
/* 3BD740 E00C09E0 AC830004 */  sw        $v1, 0x4($a0)
/* 3BD744 E00C09E4 8FBF00B4 */  lw        $ra, 0xB4($sp)
/* 3BD748 E00C09E8 8FB600B0 */  lw        $s6, 0xB0($sp)
/* 3BD74C E00C09EC 8FB500AC */  lw        $s5, 0xAC($sp)
/* 3BD750 E00C09F0 8FB400A8 */  lw        $s4, 0xA8($sp)
/* 3BD754 E00C09F4 8FB300A4 */  lw        $s3, 0xA4($sp)
/* 3BD758 E00C09F8 8FB200A0 */  lw        $s2, 0xA0($sp)
/* 3BD75C E00C09FC 8FB1009C */  lw        $s1, 0x9C($sp)
/* 3BD760 E00C0A00 8FB00098 */  lw        $s0, 0x98($sp)
/* 3BD764 E00C0A04 03E00008 */  jr        $ra
/* 3BD768 E00C0A08 27BD00B8 */   addiu    $sp, $sp, 0xB8
/* 3BD76C E00C0A0C 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void snowman_doll_appendGfx(void* effect) {
    SnowmanDollFXData* data = ((EffectInstance*)effect)->data.snowmanDoll;
    s32 unk_24 = data->unk_24;
    Matrix4f sp18;
    Matrix4f sp58;

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

    shim_guTranslateF(sp18, data->unk_04, data->unk_08, data->unk_0C);
    shim_guScaleF(sp58, data->unk_28, data->unk_28, data->unk_28);
    shim_guMtxCatF(sp58, sp18, sp18);
    shim_guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);

    gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

    shim_guTranslateF(sp18, data->unk_30, data->unk_34, data->unk_38);
    shim_guScaleF(sp58, data->unk_48, data->unk_4C, data->unk_48);
    shim_guMtxCatF(sp58, sp18, sp18);
    shim_guRotateF(sp58, data->unk_2C, 0.0f, 1.0f, 0.0f);
    shim_guMtxCatF(sp58, sp18, sp18);
    shim_guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);

    gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
    gDPSetPrimColor(gMainGfxPos++, 0, 0, data->unk_18, data->unk_1C, data->unk_20, unk_24);
    gSPDisplayList(gMainGfxPos++, D_090037A8_3C1148);
    gSPDisplayList(gMainGfxPos++, D_09003818_3C11B8);
    gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel PartnerDamageEnemy
/* 1AE694 8027FDB4 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 1AE698 8027FDB8 AFB20018 */  sw        $s2, 0x18($sp)
/* 1AE69C 8027FDBC 0080902D */  daddu     $s2, $a0, $zero
/* 1AE6A0 8027FDC0 AFBF0024 */  sw        $ra, 0x24($sp)
/* 1AE6A4 8027FDC4 AFB40020 */  sw        $s4, 0x20($sp)
/* 1AE6A8 8027FDC8 AFB3001C */  sw        $s3, 0x1C($sp)
/* 1AE6AC 8027FDCC AFB10014 */  sw        $s1, 0x14($sp)
/* 1AE6B0 8027FDD0 AFB00010 */  sw        $s0, 0x10($sp)
/* 1AE6B4 8027FDD4 8E440148 */  lw        $a0, 0x148($s2)
/* 1AE6B8 8027FDD8 0C09A75B */  jal       get_actor
/* 1AE6BC 8027FDDC 8E50000C */   lw       $s0, 0xC($s2)
/* 1AE6C0 8027FDE0 8E140000 */  lw        $s4, 0x0($s0)
/* 1AE6C4 8027FDE4 26100004 */  addiu     $s0, $s0, 0x4
/* 1AE6C8 8027FDE8 8E030000 */  lw        $v1, 0x0($s0)
/* 1AE6CC 8027FDEC 26100004 */  addiu     $s0, $s0, 0x4
/* 1AE6D0 8027FDF0 0240202D */  daddu     $a0, $s2, $zero
/* 1AE6D4 8027FDF4 3C11800E */  lui       $s1, %hi(gBattleStatus)
/* 1AE6D8 8027FDF8 2631C070 */  addiu     $s1, $s1, %lo(gBattleStatus)
/* 1AE6DC 8027FDFC 0040982D */  daddu     $s3, $v0, $zero
/* 1AE6E0 8027FE00 AE230188 */  sw        $v1, 0x188($s1)
/* 1AE6E4 8027FE04 8E030000 */  lw        $v1, 0x0($s0)
/* 1AE6E8 8027FE08 26100004 */  addiu     $s0, $s0, 0x4
/* 1AE6EC 8027FE0C AE23018C */  sw        $v1, 0x18C($s1)
/* 1AE6F0 8027FE10 8E030000 */  lw        $v1, 0x0($s0)
/* 1AE6F4 8027FE14 26100004 */  addiu     $s0, $s0, 0x4
/* 1AE6F8 8027FE18 AE230190 */  sw        $v1, 0x190($s1)
/* 1AE6FC 8027FE1C 8E050000 */  lw        $a1, 0x0($s0)
/* 1AE700 8027FE20 0C0B1EAF */  jal       evt_get_variable
/* 1AE704 8027FE24 26100004 */   addiu    $s0, $s0, 0x4
/* 1AE708 8027FE28 A622017E */  sh        $v0, 0x17E($s1)
/* 1AE70C 8027FE2C A2200198 */  sb        $zero, 0x198($s1)
/* 1AE710 8027FE30 8E100000 */  lw        $s0, 0x0($s0)
/* 1AE714 8027FE34 24020030 */  addiu     $v0, $zero, 0x30
/* 1AE718 8027FE38 32030030 */  andi      $v1, $s0, 0x30
/* 1AE71C 8027FE3C 54620004 */  bnel      $v1, $v0, .L8027FE50
/* 1AE720 8027FE40 32020010 */   andi     $v0, $s0, 0x10
/* 1AE724 8027FE44 8E220000 */  lw        $v0, 0x0($s1)
/* 1AE728 8027FE48 0809FFA4 */  j         .L8027FE90
/* 1AE72C 8027FE4C 34420030 */   ori      $v0, $v0, 0x30
.L8027FE50:
/* 1AE730 8027FE50 10400004 */  beqz      $v0, .L8027FE64
/* 1AE734 8027FE54 2403FFDF */   addiu    $v1, $zero, -0x21
/* 1AE738 8027FE58 8E220000 */  lw        $v0, 0x0($s1)
/* 1AE73C 8027FE5C 0809FFA3 */  j         .L8027FE8C
/* 1AE740 8027FE60 34420010 */   ori      $v0, $v0, 0x10
.L8027FE64:
/* 1AE744 8027FE64 32020020 */  andi      $v0, $s0, 0x20
/* 1AE748 8027FE68 10400005 */  beqz      $v0, .L8027FE80
/* 1AE74C 8027FE6C 2403FFEF */   addiu    $v1, $zero, -0x11
/* 1AE750 8027FE70 8E220000 */  lw        $v0, 0x0($s1)
/* 1AE754 8027FE74 00431024 */  and       $v0, $v0, $v1
/* 1AE758 8027FE78 0809FFA4 */  j         .L8027FE90
/* 1AE75C 8027FE7C 34420020 */   ori      $v0, $v0, 0x20
.L8027FE80:
/* 1AE760 8027FE80 8E220000 */  lw        $v0, 0x0($s1)
/* 1AE764 8027FE84 00431024 */  and       $v0, $v0, $v1
/* 1AE768 8027FE88 2403FFDF */  addiu     $v1, $zero, -0x21
.L8027FE8C:
/* 1AE76C 8027FE8C 00431024 */  and       $v0, $v0, $v1
.L8027FE90:
/* 1AE770 8027FE90 AE220000 */  sw        $v0, 0x0($s1)
/* 1AE774 8027FE94 32020040 */  andi      $v0, $s0, 0x40
/* 1AE778 8027FE98 10400007 */  beqz      $v0, .L8027FEB8
/* 1AE77C 8027FE9C 2404FFBF */   addiu    $a0, $zero, -0x41
/* 1AE780 8027FEA0 3C03800E */  lui       $v1, %hi(gBattleStatus)
/* 1AE784 8027FEA4 2463C070 */  addiu     $v1, $v1, %lo(gBattleStatus)
/* 1AE788 8027FEA8 8C620000 */  lw        $v0, 0x0($v1)
/* 1AE78C 8027FEAC 34420040 */  ori       $v0, $v0, 0x40
/* 1AE790 8027FEB0 0809FFB3 */  j         .L8027FECC
/* 1AE794 8027FEB4 AC620000 */   sw       $v0, 0x0($v1)
.L8027FEB8:
/* 1AE798 8027FEB8 3C02800E */  lui       $v0, %hi(gBattleStatus)
/* 1AE79C 8027FEBC 2442C070 */  addiu     $v0, $v0, %lo(gBattleStatus)
/* 1AE7A0 8027FEC0 8C430000 */  lw        $v1, 0x0($v0)
/* 1AE7A4 8027FEC4 00641824 */  and       $v1, $v1, $a0
/* 1AE7A8 8027FEC8 AC430000 */  sw        $v1, 0x0($v0)
.L8027FECC:
/* 1AE7AC 8027FECC 32020200 */  andi      $v0, $s0, 0x200
/* 1AE7B0 8027FED0 10400007 */  beqz      $v0, .L8027FEF0
/* 1AE7B4 8027FED4 2404FDFF */   addiu    $a0, $zero, -0x201
/* 1AE7B8 8027FED8 3C03800E */  lui       $v1, %hi(gBattleStatus)
/* 1AE7BC 8027FEDC 2463C070 */  addiu     $v1, $v1, %lo(gBattleStatus)
/* 1AE7C0 8027FEE0 8C620000 */  lw        $v0, 0x0($v1)
/* 1AE7C4 8027FEE4 34420200 */  ori       $v0, $v0, 0x200
/* 1AE7C8 8027FEE8 0809FFC1 */  j         .L8027FF04
/* 1AE7CC 8027FEEC AC620000 */   sw       $v0, 0x0($v1)
.L8027FEF0:
/* 1AE7D0 8027FEF0 3C02800E */  lui       $v0, %hi(gBattleStatus)
/* 1AE7D4 8027FEF4 2442C070 */  addiu     $v0, $v0, %lo(gBattleStatus)
/* 1AE7D8 8027FEF8 8C430000 */  lw        $v1, 0x0($v0)
/* 1AE7DC 8027FEFC 00641824 */  and       $v1, $v1, $a0
/* 1AE7E0 8027FF00 AC430000 */  sw        $v1, 0x0($v0)
.L8027FF04:
/* 1AE7E4 8027FF04 32020080 */  andi      $v0, $s0, 0x80
/* 1AE7E8 8027FF08 10400007 */  beqz      $v0, .L8027FF28
/* 1AE7EC 8027FF0C 2404FF7F */   addiu    $a0, $zero, -0x81
/* 1AE7F0 8027FF10 3C03800E */  lui       $v1, %hi(gBattleStatus)
/* 1AE7F4 8027FF14 2463C070 */  addiu     $v1, $v1, %lo(gBattleStatus)
/* 1AE7F8 8027FF18 8C620000 */  lw        $v0, 0x0($v1)
/* 1AE7FC 8027FF1C 34420080 */  ori       $v0, $v0, 0x80
/* 1AE800 8027FF20 0809FFCF */  j         .L8027FF3C
/* 1AE804 8027FF24 AC620000 */   sw       $v0, 0x0($v1)
.L8027FF28:
/* 1AE808 8027FF28 3C02800E */  lui       $v0, %hi(gBattleStatus)
/* 1AE80C 8027FF2C 2442C070 */  addiu     $v0, $v0, %lo(gBattleStatus)
/* 1AE810 8027FF30 8C430000 */  lw        $v1, 0x0($v0)
/* 1AE814 8027FF34 00641824 */  and       $v1, $v1, $a0
/* 1AE818 8027FF38 AC430000 */  sw        $v1, 0x0($v0)
.L8027FF3C:
/* 1AE81C 8027FF3C 32020800 */  andi      $v0, $s0, 0x800
/* 1AE820 8027FF40 10400007 */  beqz      $v0, .L8027FF60
/* 1AE824 8027FF44 2404F7FF */   addiu    $a0, $zero, -0x801
/* 1AE828 8027FF48 3C03800E */  lui       $v1, %hi(gBattleStatus)
/* 1AE82C 8027FF4C 2463C070 */  addiu     $v1, $v1, %lo(gBattleStatus)
/* 1AE830 8027FF50 8C620000 */  lw        $v0, 0x0($v1)
/* 1AE834 8027FF54 34420800 */  ori       $v0, $v0, 0x800
/* 1AE838 8027FF58 0809FFDD */  j         .L8027FF74
/* 1AE83C 8027FF5C AC620000 */   sw       $v0, 0x0($v1)
.L8027FF60:
/* 1AE840 8027FF60 3C02800E */  lui       $v0, %hi(gBattleStatus)
/* 1AE844 8027FF64 2442C070 */  addiu     $v0, $v0, %lo(gBattleStatus)
/* 1AE848 8027FF68 8C430000 */  lw        $v1, 0x0($v0)
/* 1AE84C 8027FF6C 00641824 */  and       $v1, $v1, $a0
/* 1AE850 8027FF70 AC430000 */  sw        $v1, 0x0($v0)
.L8027FF74:
/* 1AE854 8027FF74 96620428 */  lhu       $v0, 0x428($s3)
/* 1AE858 8027FF78 92230193 */  lbu       $v1, 0x193($s1)
/* 1AE85C 8027FF7C A62201A0 */  sh        $v0, 0x1A0($s1)
/* 1AE860 8027FF80 92620426 */  lbu       $v0, 0x426($s3)
/* 1AE864 8027FF84 A2230194 */  sb        $v1, 0x194($s1)
/* 1AE868 8027FF88 306300FF */  andi      $v1, $v1, 0xFF
/* 1AE86C 8027FF8C A22201A2 */  sb        $v0, 0x1A2($s1)
/* 1AE870 8027FF90 240200FF */  addiu     $v0, $zero, 0xFF
/* 1AE874 8027FF94 50620001 */  beql      $v1, $v0, .L8027FF9C
/* 1AE878 8027FF98 A2200194 */   sb       $zero, 0x194($s1)
.L8027FF9C:
/* 1AE87C 8027FF9C 8E220190 */  lw        $v0, 0x190($s1)
/* 1AE880 8027FFA0 30420F00 */  andi      $v0, $v0, 0xF00
/* 1AE884 8027FFA4 00021203 */  sra       $v0, $v0, 8
/* 1AE888 8027FFA8 0C09F8CA */  jal       calc_partner_damage_enemy
/* 1AE88C 8027FFAC A2220195 */   sb       $v0, 0x195($s1)
/* 1AE890 8027FFB0 0440000B */  bltz      $v0, .L8027FFE0
/* 1AE894 8027FFB4 0240202D */   daddu    $a0, $s2, $zero
/* 1AE898 8027FFB8 0280282D */  daddu     $a1, $s4, $zero
/* 1AE89C 8027FFBC 0C0B2026 */  jal       evt_set_variable
/* 1AE8A0 8027FFC0 0040302D */   daddu    $a2, $v0, $zero
/* 1AE8A4 8027FFC4 0C0B1069 */  jal       does_script_exist_by_ref
/* 1AE8A8 8027FFC8 0240202D */   daddu    $a0, $s2, $zero
/* 1AE8AC 8027FFCC 0040182D */  daddu     $v1, $v0, $zero
/* 1AE8B0 8027FFD0 10600004 */  beqz      $v1, .L8027FFE4
/* 1AE8B4 8027FFD4 240200FF */   addiu    $v0, $zero, 0xFF
/* 1AE8B8 8027FFD8 0809FFF9 */  j         .L8027FFE4
/* 1AE8BC 8027FFDC 24020002 */   addiu    $v0, $zero, 0x2
.L8027FFE0:
/* 1AE8C0 8027FFE0 240200FF */  addiu     $v0, $zero, 0xFF
.L8027FFE4:
/* 1AE8C4 8027FFE4 8FBF0024 */  lw        $ra, 0x24($sp)
/* 1AE8C8 8027FFE8 8FB40020 */  lw        $s4, 0x20($sp)
/* 1AE8CC 8027FFEC 8FB3001C */  lw        $s3, 0x1C($sp)
/* 1AE8D0 8027FFF0 8FB20018 */  lw        $s2, 0x18($sp)
/* 1AE8D4 8027FFF4 8FB10014 */  lw        $s1, 0x14($sp)
/* 1AE8D8 8027FFF8 8FB00010 */  lw        $s0, 0x10($sp)
/* 1AE8DC 8027FFFC 03E00008 */  jr        $ra
shop_owner_begin_speech:
/* 1AE8E0 80280000 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

ApiStatus PartnerDamageEnemy(Evt* script, s32 isInitialCall) {
    BattleStatus* battleStatus = &gBattleStatus;
    PlayerStatus* playerStatus = &gPlayerStatus;
    Bytecode* args = script->ptrReadPos;
    Actor* enemy = get_actor(script->owner1.enemyID);
    s32 temp_s4 = *args++;
    s32 flags;
    s32 damageResult;
    u8 statusChance;

    gBattleStatus.currentAttackElement = *args++;
    gBattleStatus.currentAttackEventSuppression = *args++;
    gBattleStatus.currentAttackStatus = *args++;
    gBattleStatus.currentAttackDamage = evt_get_variable(script, *args++);
    gBattleStatus.powerBounceCounter = 0;
    flags = *args++;

    if ((flags & (BS_FLAGS1_10 | BS_FLAGS1_SP_EVT_ACTIVE)) == (BS_FLAGS1_10 | BS_FLAGS1_SP_EVT_ACTIVE)) {
        battleStatus->flags1 |= BS_FLAGS1_10;
        battleStatus->flags1 |= BS_FLAGS1_SP_EVT_ACTIVE;
    } else if (flags & BS_FLAGS1_10) {
        battleStatus->flags1 |= BS_FLAGS1_10;
        battleStatus->flags1 &= ~BS_FLAGS1_SP_EVT_ACTIVE;
    } else if (flags & BS_FLAGS1_SP_EVT_ACTIVE) {
        battleStatus->flags1 &= ~BS_FLAGS1_10;
        battleStatus->flags1 |= BS_FLAGS1_SP_EVT_ACTIVE;
    } else {
        battleStatus->flags1 &= ~BS_FLAGS1_10;
        battleStatus->flags1 &= ~BS_FLAGS1_SP_EVT_ACTIVE;
    }

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

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

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

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

    statusChance = battleStatus->currentAttackStatus;
    battleStatus->currentTargetID = enemy->targetActorID;
    battleStatus->currentTargetPart = enemy->targetPartIndex;
    battleStatus->statusChance = statusChance;

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

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

    if (damageResult < 0) {
        return ApiStatus_FINISH;
    }

    evt_set_variable(script, temp_s4, damageResult);

    if (!does_script_exist_by_ref(script)) {
        return ApiStatus_FINISH;
    }

    return ApiStatus_DONE2;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel GetStatusFlags
/* 19DB10 8026F230 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* 19DB14 8026F234 AFB10014 */  sw        $s1, 0x14($sp)
/* 19DB18 8026F238 0080882D */  daddu     $s1, $a0, $zero
/* 19DB1C 8026F23C AFBF001C */  sw        $ra, 0x1C($sp)
/* 19DB20 8026F240 AFB20018 */  sw        $s2, 0x18($sp)
/* 19DB24 8026F244 AFB00010 */  sw        $s0, 0x10($sp)
/* 19DB28 8026F248 8E30000C */  lw        $s0, 0xC($s1)
/* 19DB2C 8026F24C 8E050000 */  lw        $a1, 0x0($s0)
/* 19DB30 8026F250 0C0B1EAF */  jal       evt_get_variable
/* 19DB34 8026F254 26100004 */   addiu    $s0, $s0, 0x4
/* 19DB38 8026F258 0040202D */  daddu     $a0, $v0, $zero
/* 19DB3C 8026F25C 2402FF81 */  addiu     $v0, $zero, -0x7F
/* 19DB40 8026F260 14820002 */  bne       $a0, $v0, .L8026F26C
/* 19DB44 8026F264 8E120000 */   lw       $s2, 0x0($s0)
/* 19DB48 8026F268 8E240148 */  lw        $a0, 0x148($s1)
.L8026F26C:
/* 19DB4C 8026F26C 0C09A75B */  jal       get_actor
/* 19DB50 8026F270 0000802D */   daddu    $s0, $zero, $zero
/* 19DB54 8026F274 0040202D */  daddu     $a0, $v0, $zero
/* 19DB58 8026F278 94820192 */  lhu       $v0, 0x192($a0)
/* 19DB5C 8026F27C 80830210 */  lb        $v1, 0x210($a0)
/* 19DB60 8026F280 10600020 */  beqz      $v1, .L8026F304
/* 19DB64 8026F284 30460700 */   andi     $a2, $v0, 0x700
/* 19DB68 8026F288 38620008 */  xori      $v0, $v1, 0x8
/* 19DB6C 8026F28C 2C420001 */  sltiu     $v0, $v0, 0x1
/* 19DB70 8026F290 00028540 */  sll       $s0, $v0, 21
/* 19DB74 8026F294 24020007 */  addiu     $v0, $zero, 0x7
/* 19DB78 8026F298 50620001 */  beql      $v1, $v0, D_8026F2A0
/* 19DB7C 8026F29C 36104000 */   ori      $s0, $s0, 0x4000
D_8026F2A0:
/* 19DB80 8026F2A0 24020006 */  addiu     $v0, $zero, 0x6
/* 19DB84 8026F2A4 50620001 */  beql      $v1, $v0, .L8026F2AC
/* 19DB88 8026F2A8 36101000 */   ori      $s0, $s0, 0x1000
.L8026F2AC:
/* 19DB8C 8026F2AC 24020005 */  addiu     $v0, $zero, 0x5
/* 19DB90 8026F2B0 14620004 */  bne       $v1, $v0, .L8026F2C4
/* 19DB94 8026F2B4 24020004 */   addiu    $v0, $zero, 0x4
/* 19DB98 8026F2B8 3C020001 */  lui       $v0, (0x12000 >> 16)
/* 19DB9C 8026F2BC 02028025 */  or        $s0, $s0, $v0
/* 19DBA0 8026F2C0 24020004 */  addiu     $v0, $zero, 0x4
.L8026F2C4:
/* 19DBA4 8026F2C4 14620004 */  bne       $v1, $v0, .L8026F2D8
/* 19DBA8 8026F2C8 24020003 */   addiu    $v0, $zero, 0x3
/* 19DBAC 8026F2CC 3C020004 */  lui       $v0, (0x48000 >> 16)
/* 19DBB0 8026F2D0 02028025 */  or        $s0, $s0, $v0
/* 19DBB4 8026F2D4 24020003 */  addiu     $v0, $zero, 0x3
.L8026F2D8:
/* 19DBB8 8026F2D8 50620001 */  beql      $v1, $v0, .L8026F2E0
/* 19DBBC 8026F2DC 36108000 */   ori      $s0, $s0, (0x18000 & 0xFFFF)
.L8026F2E0:
/* 19DBC0 8026F2E0 24020009 */  addiu     $v0, $zero, 0x9
/* 19DBC4 8026F2E4 14620004 */  bne       $v1, $v0, .L8026F2F8
/* 19DBC8 8026F2E8 2402000A */   addiu    $v0, $zero, 0xA
/* 19DBCC 8026F2EC 3C020002 */  lui       $v0, (0x22000 >> 16)
/* 19DBD0 8026F2F0 02028025 */  or        $s0, $s0, $v0
/* 19DBD4 8026F2F4 2402000A */  addiu     $v0, $zero, 0xA
.L8026F2F8:
/* 19DBD8 8026F2F8 14620002 */  bne       $v1, $v0, .L8026F304
/* 19DBDC 8026F2FC 3C020008 */   lui      $v0, (0x80000 >> 16)
/* 19DBE0 8026F300 02028025 */  or        $s0, $s0, $v0
.L8026F304:
/* 19DBE4 8026F304 80830212 */  lb        $v1, 0x212($a0)
/* 19DBE8 8026F308 10600003 */  beqz      $v1, .L8026F318
/* 19DBEC 8026F30C 2402000B */   addiu    $v0, $zero, 0xB
/* 19DBF0 8026F310 50620001 */  beql      $v1, $v0, .L8026F318
/* 19DBF4 8026F314 36102000 */   ori      $s0, $s0, (0x12000 & 0xFFFF)
.L8026F318:
/* 19DBF8 8026F318 80830214 */  lb        $v1, 0x214($a0)
/* 19DBFC 8026F31C 10600004 */  beqz      $v1, .L8026F330
/* 19DC00 8026F320 2402000C */   addiu    $v0, $zero, 0xC
/* 19DC04 8026F324 14620002 */  bne       $v1, $v0, .L8026F330
/* 19DC08 8026F328 3C020010 */   lui      $v0, (0x100000 >> 16)
/* 19DC0C 8026F32C 02028025 */  or        $s0, $s0, $v0
.L8026F330:
/* 19DC10 8026F330 80830216 */  lb        $v1, 0x216($a0)
/* 19DC14 8026F334 10600004 */  beqz      $v1, D_8026F348
/* 19DC18 8026F338 2402000D */   addiu    $v0, $zero, 0xD
/* 19DC1C 8026F33C 14620002 */  bne       $v1, $v0, D_8026F348
/* 19DC20 8026F340 3C020100 */   lui      $v0, (0x1000000 >> 16)
/* 19DC24 8026F344 02028025 */  or        $s0, $s0, $v0
D_8026F348:
/* 19DC28 8026F348 80830218 */  lb        $v1, 0x218($a0)
/* 19DC2C 8026F34C 10600004 */  beqz      $v1, .L8026F360
/* 19DC30 8026F350 2402000E */   addiu    $v0, $zero, 0xE
/* 19DC34 8026F354 14620002 */  bne       $v1, $v0, .L8026F360
/* 19DC38 8026F358 3C020400 */   lui      $v0, (0x4000000 >> 16)
/* 19DC3C 8026F35C 02028025 */  or        $s0, $s0, $v0
.L8026F360:
/* 19DC40 8026F360 8C8301F4 */  lw        $v1, 0x1F4($a0)
/* 19DC44 8026F364 1060000D */  beqz      $v1, .L8026F39C
/* 19DC48 8026F368 24020100 */   addiu    $v0, $zero, 0x100
/* 19DC4C 8026F36C 3C050400 */  lui       $a1, (0x4000000 >> 16)
.L8026F370:
/* 19DC50 8026F370 8C620000 */  lw        $v0, 0x0($v1)
/* 19DC54 8026F374 30420100 */  andi      $v0, $v0, 0x100
/* 19DC58 8026F378 54400001 */  bnel      $v0, $zero, .L8026F380
/* 19DC5C 8026F37C 02058025 */   or       $s0, $s0, $a1
.L8026F380:
/* 19DC60 8026F380 8C62007C */  lw        $v0, 0x7C($v1)
/* 19DC64 8026F384 30420020 */  andi      $v0, $v0, 0x20
/* 19DC68 8026F388 54400001 */  bnel      $v0, $zero, .L8026F390
/* 19DC6C 8026F38C 02058025 */   or       $s0, $s0, $a1
.L8026F390:
/* 19DC70 8026F390 8C63000C */  lw        $v1, 0xC($v1)
/* 19DC74 8026F394 1460FFF6 */  bnez      $v1, .L8026F370
/* 19DC78 8026F398 24020100 */   addiu    $v0, $zero, 0x100
.L8026F39C:
/* 19DC7C 8026F39C 10C20005 */  beq       $a2, $v0, .L8026F3B4
/* 19DC80 8026F3A0 28C20101 */   slti     $v0, $a2, 0x101
/* 19DC84 8026F3A4 10400009 */  beqz      $v0, .L8026F3CC
/* 19DC88 8026F3A8 00000000 */   nop
/* 19DC8C 8026F3AC 14C00007 */  bnez      $a2, .L8026F3CC
/* 19DC90 8026F3B0 00000000 */   nop
.L8026F3B4:
/* 19DC94 8026F3B4 3C02800E */  lui       $v0, %hi(gBattleStatus)
/* 19DC98 8026F3B8 2442C070 */  addiu     $v0, $v0, %lo(gBattleStatus)
/* 19DC9C 8026F3BC 8042009A */  lb        $v0, 0x9A($v0)
/* 19DCA0 8026F3C0 10400002 */  beqz      $v0, .L8026F3CC
/* 19DCA4 8026F3C4 3C020400 */   lui      $v0, (0x4000000 >> 16)
/* 19DCA8 8026F3C8 02028025 */  or        $s0, $s0, $v0
.L8026F3CC:
/* 19DCAC 8026F3CC 80820220 */  lb        $v0, 0x220($a0)
/* 19DCB0 8026F3D0 10400002 */  beqz      $v0, .L8026F3DC
/* 19DCB4 8026F3D4 3C020200 */   lui      $v0, (0x2000000 >> 16)
/* 19DCB8 8026F3D8 02028025 */  or        $s0, $s0, $v0
.L8026F3DC:
/* 19DCBC 8026F3DC 80820221 */  lb        $v0, 0x221($a0)
/* 19DCC0 8026F3E0 10400002 */  beqz      $v0, .L8026F3EC
/* 19DCC4 8026F3E4 3C020800 */   lui      $v0, (0x8000000 >> 16)
/* 19DCC8 8026F3E8 02028025 */  or        $s0, $s0, $v0
.L8026F3EC:
/* 19DCCC 8026F3EC 80820222 */  lb        $v0, 0x222($a0)
gPauseDLAvailable:
/* 19DCD0 8026F3F0 10400002 */  beqz      $v0, .L8026F3FC
/* 19DCD4 8026F3F4 3C021000 */   lui      $v0, (0x10000000 >> 16)
/* 19DCD8 8026F3F8 02028025 */  or        $s0, $s0, $v0
.L8026F3FC:
/* 19DCDC 8026F3FC 80820223 */  lb        $v0, 0x223($a0)
/* 19DCE0 8026F400 10400002 */  beqz      $v0, .L8026F40C
/* 19DCE4 8026F404 3C022000 */   lui      $v0, (0x20000000 >> 16)
/* 19DCE8 8026F408 02028025 */  or        $s0, $s0, $v0
.L8026F40C:
/* 19DCEC 8026F40C 0C099CAB */  jal       player_team_is_ability_active
/* 19DCF0 8026F410 24050016 */   addiu    $a1, $zero, 0x16
/* 19DCF4 8026F414 10400002 */  beqz      $v0, .L8026F420
/* 19DCF8 8026F418 3C024000 */   lui      $v0, (0x40000000 >> 16)
/* 19DCFC 8026F41C 02028025 */  or        $s0, $s0, $v0
.L8026F420:
/* 19DD00 8026F420 0220202D */  daddu     $a0, $s1, $zero
/* 19DD04 8026F424 0240282D */  daddu     $a1, $s2, $zero
/* 19DD08 8026F428 0C0B2026 */  jal       evt_set_variable
/* 19DD0C 8026F42C 0200302D */   daddu    $a2, $s0, $zero
/* 19DD10 8026F430 8FBF001C */  lw        $ra, 0x1C($sp)
/* 19DD14 8026F434 8FB20018 */  lw        $s2, 0x18($sp)
/* 19DD18 8026F438 8FB10014 */  lw        $s1, 0x14($sp)
/* 19DD1C 8026F43C 8FB00010 */  lw        $s0, 0x10($sp)
/* 19DD20 8026F440 24020002 */  addiu     $v0, $zero, 0x2
/* 19DD24 8026F444 03E00008 */  jr        $ra
/* 19DD28 8026F448 27BD0020 */   addiu    $sp, $sp, 0x20

### DECOMPILED C INSTRUCTIONS:

ApiStatus GetStatusFlags(Evt* script, s32 isInitialCall) {
    Bytecode* args = script->ptrReadPos;
    BattleStatus* battleStatus = &gBattleStatus;
    s32 actorID = evt_get_variable(script, *args++);
    s32 outVar = *args++;
    Actor* actor;
    s32 actorClass;
    s8 debuff;
    s8 staticStatus;
    s8 stoneStatus;
    s8 koStatus;
    s8 transStatus;
    ActorPart* partsTable;
    s32 flags;

    if (actorID == ACTOR_SELF) {
        actorID = script->owner1.actorID;
    }
    actor = get_actor(actorID);
    debuff = actor->debuff;
    actorClass = actor->actorID & ACTOR_CLASS_MASK;
    flags = 0;

    if (debuff != 0) {
        if (debuff == STATUS_KEY_STOP) {
            flags |= STATUS_FLAG_STOP;
        }
        if (debuff == STATUS_KEY_FROZEN) {
            flags |= STATUS_FLAG_FROZEN;
        }
        if (debuff == STATUS_KEY_SLEEP) {
            flags |= STATUS_FLAG_SLEEP;
        }
        if (debuff == STATUS_KEY_PARALYZE) {
            flags |= STATUS_FLAG_PARALYZE;
        }
        if (debuff == STATUS_KEY_DIZZY) {
            flags |= STATUS_FLAG_DIZZY;
        }
        if (debuff == STATUS_KEY_FEAR) {
            flags |= STATUS_FLAG_FEAR;
        }
        if (debuff == STATUS_KEY_POISON) {
            flags |= STATUS_FLAG_POISON;
        }
        if (debuff == STATUS_KEY_SHRINK) {
            flags |= STATUS_FLAG_SHRINK;
        }
    }

    switch (actor->staticStatus) {
        case 0:
            break;
        case STATUS_KEY_STATIC:
            flags |= STATUS_FLAG_STATIC;
            break;
    }

    switch (actor->stoneStatus) {
        case 0:
            break;
        case STATUS_KEY_STONE:
            flags |= STATUS_FLAG_STONE;
            break;
    }

    switch (actor->koStatus) {
        case 0:
            break;
        case STATUS_KEY_DAZE:
            flags |= STATUS_FLAG_KO;
            break;
    }

    switch (actor->transparentStatus) {
        case 0:
            break;
        case STATUS_KEY_TRANSPARENT:
            flags |= STATUS_FLAG_TRANSPARENT;
            break;
    }

    for (partsTable = actor->partsTable; partsTable != NULL; partsTable = partsTable->nextPart) {
            if (partsTable->flags & 0x100) {
                flags |= STATUS_FLAG_TRANSPARENT;
            }
            if (partsTable->eventFlags & ACTOR_EVENT_FLAG_ILLUSORY) {
                flags |= STATUS_FLAG_TRANSPARENT;
            }
    }

    switch (actorClass) {
        case ACTOR_CLASS_PLAYER:
        case ACTOR_CLASS_PARTNER:
            if (battleStatus->outtaSightActive) {
                flags |= STATUS_FLAG_TRANSPARENT;
            }
            break;
        case ACTOR_CLASS_ENEMY:
            break;
    }

    if (actor->isGlowing) {
        flags |= STATUS_FLAG_GLOWING;
    }

    if (actor->attackBoost) {
        flags |= STATUS_FLAG_ATTACK_BOOST;
    }

    if (actor->defenseBoost) {
        flags |= STATUS_FLAG_DEFENSE_BOOST;
    }

    if (actor->chillOutAmount) {
        flags |= STATUS_FLAG_CHILL_OUT;
    }

    if (player_team_is_ability_active(actor, ABILITY_RIGHT_ON)) {
        flags |= STATUS_FLAG_RIGHT_ON;
    }

    evt_set_variable(script, outVar, flags);
    return ApiStatus_DONE2;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel drop_leaves_appendGfx
/* 33D31C E002852C 27BDFEF0 */  addiu     $sp, $sp, -0x110
/* 33D320 E0028530 AFB700F4 */  sw        $s7, 0xF4($sp)
/* 33D324 E0028534 0080B82D */  daddu     $s7, $a0, $zero
/* 33D328 E0028538 3C02DB06 */  lui       $v0, (0xDB060024 >> 16)
/* 33D32C E002853C 34420024 */  ori       $v0, $v0, (0xDB060024 & 0xFFFF)
/* 33D330 E0028540 3C061464 */  lui       $a2, (0x14641400 >> 16)
/* 33D334 E0028544 34C61400 */  ori       $a2, $a2, (0x14641400 & 0xFFFF)
/* 33D338 E0028548 AFB300E4 */  sw        $s3, 0xE4($sp)
/* 33D33C E002854C 3C13800A */  lui       $s3, %hi(gMainGfxPos)
/* 33D340 E0028550 2673A66C */  addiu     $s3, $s3, %lo(gMainGfxPos)
/* 33D344 E0028554 AFBF00F8 */  sw        $ra, 0xF8($sp)
/* 33D348 E0028558 AFB600F0 */  sw        $s6, 0xF0($sp)
/* 33D34C E002855C AFB500EC */  sw        $s5, 0xEC($sp)
/* 33D350 E0028560 AFB400E8 */  sw        $s4, 0xE8($sp)
/* 33D354 E0028564 AFB200E0 */  sw        $s2, 0xE0($sp)
/* 33D358 E0028568 AFB100DC */  sw        $s1, 0xDC($sp)
/* 33D35C E002856C AFB000D8 */  sw        $s0, 0xD8($sp)
/* 33D360 E0028570 F7B60108 */  sdc1      $f22, 0x108($sp)
/* 33D364 E0028574 F7B40100 */  sdc1      $f20, 0x100($sp)
/* 33D368 E0028578 8E650000 */  lw        $a1, 0x0($s3)
/* 33D36C E002857C 8EF0000C */  lw        $s0, 0xC($s7)
/* 33D370 E0028580 00A0202D */  daddu     $a0, $a1, $zero
/* 33D374 E0028584 24A50008 */  addiu     $a1, $a1, 0x8
/* 33D378 E0028588 AE650000 */  sw        $a1, 0x0($s3)
/* 33D37C E002858C AC820000 */  sw        $v0, 0x0($a0)
/* 33D380 E0028590 24A20008 */  addiu     $v0, $a1, 0x8
/* 33D384 E0028594 AE620000 */  sw        $v0, 0x0($s3)
/* 33D388 E0028598 8EE30010 */  lw        $v1, 0x10($s7)
/* 33D38C E002859C 24A20010 */  addiu     $v0, $a1, 0x10
/* 33D390 E00285A0 AE620000 */  sw        $v0, 0x0($s3)
/* 33D394 E00285A4 8C62001C */  lw        $v0, 0x1C($v1)
/* 33D398 E00285A8 3C038000 */  lui       $v1, (0x80000000 >> 16)
/* 33D39C E00285AC 00431021 */  addu      $v0, $v0, $v1
/* 33D3A0 E00285B0 AC820004 */  sw        $v0, 0x4($a0)
/* 33D3A4 E00285B4 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 33D3A8 E00285B8 ACA20000 */  sw        $v0, 0x0($a1)
/* 33D3AC E00285BC 3C020900 */  lui       $v0, %hi(D_09001180_40E410)
/* 33D3B0 E00285C0 24421180 */  addiu     $v0, $v0, %lo(D_09001180_40E410)
/* 33D3B4 E00285C4 ACA20004 */  sw        $v0, 0x4($a1)
/* 33D3B8 E00285C8 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 33D3BC E00285CC ACA20008 */  sw        $v0, 0x8($a1)
/* 33D3C0 E00285D0 92020027 */  lbu       $v0, 0x27($s0)
/* 33D3C4 E00285D4 24120001 */  addiu     $s2, $zero, 0x1
/* 33D3C8 E00285D8 00461025 */  or        $v0, $v0, $a2
/* 33D3CC E00285DC ACA2000C */  sw        $v0, 0xC($a1)
/* 33D3D0 E00285E0 8E050004 */  lw        $a1, 0x4($s0)
/* 33D3D4 E00285E4 8E060008 */  lw        $a2, 0x8($s0)
/* 33D3D8 E00285E8 8E07000C */  lw        $a3, 0xC($s0)
/* 33D3DC E00285EC 0C080108 */  jal       shim_guTranslateF
/* 33D3E0 E00285F0 27A40018 */   addiu    $a0, $sp, 0x18
/* 33D3E4 E00285F4 27B10058 */  addiu     $s1, $sp, 0x58
/* 33D3E8 E00285F8 4480A000 */  mtc1      $zero, $f20
/* 33D3EC E00285FC 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 33D3F0 E0028600 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 33D3F4 E0028604 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 33D3F8 E0028608 4481B000 */  mtc1      $at, $f22
/* 33D3FC E002860C 00031080 */  sll       $v0, $v1, 2
/* 33D400 E0028610 00431021 */  addu      $v0, $v0, $v1
/* 33D404 E0028614 00021080 */  sll       $v0, $v0, 2
/* 33D408 E0028618 00431023 */  subu      $v0, $v0, $v1
/* 33D40C E002861C 000218C0 */  sll       $v1, $v0, 3
/* 33D410 E0028620 00431021 */  addu      $v0, $v0, $v1
/* 33D414 E0028624 000210C0 */  sll       $v0, $v0, 3
/* 33D418 E0028628 4406A000 */  mfc1      $a2, $f20
/* 33D41C E002862C 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 33D420 E0028630 00220821 */  addu      $at, $at, $v0
/* 33D424 E0028634 C4201DEC */  lwc1      $f0, %lo(gCameras + 0x6C)($at)
/* 33D428 E0028638 4407B000 */  mfc1      $a3, $f22
/* 33D42C E002863C 46000007 */  neg.s     $f0, $f0
/* 33D430 E0028640 44050000 */  mfc1      $a1, $f0
/* 33D434 E0028644 0220202D */  daddu     $a0, $s1, $zero
/* 33D438 E0028648 0C080104 */  jal       shim_guRotateF
/* 33D43C E002864C E7B40010 */   swc1     $f20, 0x10($sp)
/* 33D440 E0028650 0220202D */  daddu     $a0, $s1, $zero
/* 33D444 E0028654 27A50018 */  addiu     $a1, $sp, 0x18
/* 33D448 E0028658 0C080114 */  jal       shim_guMtxCatF
/* 33D44C E002865C 27A60098 */   addiu    $a2, $sp, 0x98
/* 33D450 E0028660 8EE20008 */  lw        $v0, 0x8($s7)
/* 33D454 E0028664 0242102A */  slt       $v0, $s2, $v0
/* 33D458 E0028668 1040004E */  beqz      $v0, .LE00287A4
/* 33D45C E002866C 26100030 */   addiu    $s0, $s0, 0x30
/* 33D460 E0028670 3C16800A */  lui       $s6, %hi(gDisplayContext)
/* 33D464 E0028674 26D6A674 */  addiu     $s6, $s6, %lo(gDisplayContext)
/* 33D468 E0028678 3C158007 */  lui       $s5, %hi(gMatrixListPos)
/* 33D46C E002867C 26B541F0 */  addiu     $s5, $s5, %lo(gMatrixListPos)
/* 33D470 E0028680 3C140001 */  lui       $s4, (0x11630 >> 16)
/* 33D474 E0028684 36941630 */  ori       $s4, $s4, (0x11630 & 0xFFFF)
/* 33D478 E0028688 26100020 */  addiu     $s0, $s0, 0x20
.LE002868C:
/* 33D47C E002868C 0220202D */  daddu     $a0, $s1, $zero
/* 33D480 E0028690 8E05FFE4 */  lw        $a1, -0x1C($s0)
/* 33D484 E0028694 8E06FFE8 */  lw        $a2, -0x18($s0)
/* 33D488 E0028698 8E07FFEC */  lw        $a3, -0x14($s0)
/* 33D48C E002869C 0C080108 */  jal       shim_guTranslateF
/* 33D490 E00286A0 26520001 */   addiu    $s2, $s2, 0x1
/* 33D494 E00286A4 0220202D */  daddu     $a0, $s1, $zero
/* 33D498 E00286A8 27A50098 */  addiu     $a1, $sp, 0x98
/* 33D49C E00286AC 0C080114 */  jal       shim_guMtxCatF
/* 33D4A0 E00286B0 27A60018 */   addiu    $a2, $sp, 0x18
/* 33D4A4 E00286B4 E7B60010 */  swc1      $f22, 0x10($sp)
/* 33D4A8 E00286B8 8E05FFF8 */  lw        $a1, -0x8($s0)
/* 33D4AC E00286BC 4406A000 */  mfc1      $a2, $f20
/* 33D4B0 E00286C0 4407A000 */  mfc1      $a3, $f20
/* 33D4B4 E00286C4 0C080104 */  jal       shim_guRotateF
/* 33D4B8 E00286C8 0220202D */   daddu    $a0, $s1, $zero
/* 33D4BC E00286CC 0220202D */  daddu     $a0, $s1, $zero
/* 33D4C0 E00286D0 27A50018 */  addiu     $a1, $sp, 0x18
/* 33D4C4 E00286D4 0C080114 */  jal       shim_guMtxCatF
/* 33D4C8 E00286D8 00A0302D */   daddu    $a2, $a1, $zero
/* 33D4CC E00286DC 0220202D */  daddu     $a0, $s1, $zero
/* 33D4D0 E00286E0 E7B40010 */  swc1      $f20, 0x10($sp)
/* 33D4D4 E00286E4 8E050000 */  lw        $a1, 0x0($s0)
/* 33D4D8 E00286E8 4406A000 */  mfc1      $a2, $f20
/* 33D4DC E00286EC 4407B000 */  mfc1      $a3, $f22
/* 33D4E0 E00286F0 0C080104 */  jal       shim_guRotateF
/* 33D4E4 E00286F4 26100030 */   addiu    $s0, $s0, 0x30
/* 33D4E8 E00286F8 0220202D */  daddu     $a0, $s1, $zero
/* 33D4EC E00286FC 27A50018 */  addiu     $a1, $sp, 0x18
/* 33D4F0 E0028700 0C080114 */  jal       shim_guMtxCatF
/* 33D4F4 E0028704 00A0302D */   daddu    $a2, $a1, $zero
/* 33D4F8 E0028708 27A40018 */  addiu     $a0, $sp, 0x18
/* 33D4FC E002870C 96A50000 */  lhu       $a1, 0x0($s5)
/* 33D500 E0028710 8EC20000 */  lw        $v0, 0x0($s6)
/* 33D504 E0028714 00052980 */  sll       $a1, $a1, 6
/* 33D508 E0028718 00B42821 */  addu      $a1, $a1, $s4
/* 33D50C E002871C 0C080118 */  jal       shim_guMtxF2L
/* 33D510 E0028720 00452821 */   addu     $a1, $v0, $a1
/* 33D514 E0028724 3C06D838 */  lui       $a2, (0xD8380002 >> 16)
/* 33D518 E0028728 8E640000 */  lw        $a0, 0x0($s3)
/* 33D51C E002872C 34C60002 */  ori       $a2, $a2, (0xD8380002 & 0xFFFF)
/* 33D520 E0028730 0080282D */  daddu     $a1, $a0, $zero
/* 33D524 E0028734 24840008 */  addiu     $a0, $a0, 0x8
/* 33D528 E0028738 AE640000 */  sw        $a0, 0x0($s3)
/* 33D52C E002873C 96A20000 */  lhu       $v0, 0x0($s5)
/* 33D530 E0028740 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 33D534 E0028744 ACA30000 */  sw        $v1, 0x0($a1)
/* 33D538 E0028748 24430001 */  addiu     $v1, $v0, 0x1
/* 33D53C E002874C 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 33D540 E0028750 00021180 */  sll       $v0, $v0, 6
/* 33D544 E0028754 A6A30000 */  sh        $v1, 0x0($s5)
/* 33D548 E0028758 8EC30000 */  lw        $v1, 0x0($s6)
/* 33D54C E002875C 00541021 */  addu      $v0, $v0, $s4
/* 33D550 E0028760 00621821 */  addu      $v1, $v1, $v0
/* 33D554 E0028764 24820008 */  addiu     $v0, $a0, 0x8
/* 33D558 E0028768 ACA30004 */  sw        $v1, 0x4($a1)
/* 33D55C E002876C AE620000 */  sw        $v0, 0x0($s3)
/* 33D560 E0028770 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 33D564 E0028774 AC820000 */  sw        $v0, 0x0($a0)
/* 33D568 E0028778 3C020900 */  lui       $v0, %hi(D_09001230_40E4C0)
/* 33D56C E002877C 24421230 */  addiu     $v0, $v0, %lo(D_09001230_40E4C0)
/* 33D570 E0028780 AC820004 */  sw        $v0, 0x4($a0)
/* 33D574 E0028784 24020040 */  addiu     $v0, $zero, 0x40
/* 33D578 E0028788 AC860008 */  sw        $a2, 0x8($a0)
/* 33D57C E002878C AC82000C */  sw        $v0, 0xC($a0)
/* 33D580 E0028790 8EE20008 */  lw        $v0, 0x8($s7)
/* 33D584 E0028794 24840010 */  addiu     $a0, $a0, 0x10
/* 33D588 E0028798 0242102A */  slt       $v0, $s2, $v0
/* 33D58C E002879C 1440FFBB */  bnez      $v0, .LE002868C
/* 33D590 E00287A0 AE640000 */   sw       $a0, 0x0($s3)
.LE00287A4:
/* 33D594 E00287A4 8FBF00F8 */  lw        $ra, 0xF8($sp)
/* 33D598 E00287A8 8FB700F4 */  lw        $s7, 0xF4($sp)
/* 33D59C E00287AC 8FB600F0 */  lw        $s6, 0xF0($sp)
/* 33D5A0 E00287B0 8FB500EC */  lw        $s5, 0xEC($sp)
/* 33D5A4 E00287B4 8FB400E8 */  lw        $s4, 0xE8($sp)
/* 33D5A8 E00287B8 8FB300E4 */  lw        $s3, 0xE4($sp)
/* 33D5AC E00287BC 8FB200E0 */  lw        $s2, 0xE0($sp)
/* 33D5B0 E00287C0 8FB100DC */  lw        $s1, 0xDC($sp)
/* 33D5B4 E00287C4 8FB000D8 */  lw        $s0, 0xD8($sp)
/* 33D5B8 E00287C8 D7B60108 */  ldc1      $f22, 0x108($sp)
/* 33D5BC E00287CC D7B40100 */  ldc1      $f20, 0x100($sp)
/* 33D5C0 E00287D0 03E00008 */  jr        $ra
/* 33D5C4 E00287D4 27BD0110 */   addiu    $sp, $sp, 0x110
/* 33D5C8 E00287D8 00000000 */  nop
/* 33D5CC E00287DC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void drop_leaves_appendGfx(void* effect) {
    DropLeavesFXData* part = ((EffectInstance*)effect)->data.dropLeaves;
    Matrix4f sp18;
    Matrix4f sp58;
    Matrix4f sp98;
    s32 i;

    gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
    gSPDisplayList(gMainGfxPos++, D_09001180_33E790);
    gDPSetPrimColor(gMainGfxPos++, 0, 0, 20, 100, 20, part->unk_24);

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

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

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


### RAW ASSEMBLY INSTRUCTIONS:

glabel au_amb_restore_voices
/* 2D72C 8005232C 27BDFFC8 */  addiu     $sp, $sp, -0x38
/* 2D730 80052330 AFB60028 */  sw        $s6, 0x28($sp)
/* 2D734 80052334 0080B02D */  daddu     $s6, $a0, $zero
/* 2D738 80052338 AFB40020 */  sw        $s4, 0x20($sp)
/* 2D73C 8005233C 00A0A02D */  daddu     $s4, $a1, $zero
/* 2D740 80052340 AFBF0030 */  sw        $ra, 0x30($sp)
/* 2D744 80052344 AFB7002C */  sw        $s7, 0x2C($sp)
/* 2D748 80052348 AFB50024 */  sw        $s5, 0x24($sp)
/* 2D74C 8005234C AFB3001C */  sw        $s3, 0x1C($sp)
/* 2D750 80052350 AFB20018 */  sw        $s2, 0x18($sp)
/* 2D754 80052354 AFB10014 */  sw        $s1, 0x14($sp)
/* 2D758 80052358 AFB00010 */  sw        $s0, 0x10($sp)
/* 2D75C 8005235C 92820025 */  lbu       $v0, 0x25($s4)
/* 2D760 80052360 8ED70000 */  lw        $s7, 0x0($s6)
/* 2D764 80052364 14400081 */  bnez      $v0, .L8005256C
/* 2D768 80052368 0000A82D */   daddu    $s5, $zero, $zero
.L8005236C:
/* 2D76C 8005236C 00151080 */  sll       $v0, $s5, 2
/* 2D770 80052370 244201D4 */  addiu     $v0, $v0, 0x1D4
/* 2D774 80052374 02829821 */  addu      $s3, $s4, $v0
/* 2D778 80052378 92620001 */  lbu       $v0, 0x1($s3)
/* 2D77C 8005237C 50400076 */  beql      $v0, $zero, .L80052558
/* 2D780 80052380 26B50001 */   addiu    $s5, $s5, 0x1
/* 2D784 80052384 92620000 */  lbu       $v0, 0x0($s3)
/* 2D788 80052388 8E900030 */  lw        $s0, 0x30($s4)
/* 2D78C 8005238C 8E840034 */  lw        $a0, 0x34($s4)
/* 2D790 80052390 00021880 */  sll       $v1, $v0, 2
/* 2D794 80052394 00621821 */  addu      $v1, $v1, $v0
/* 2D798 80052398 000318C0 */  sll       $v1, $v1, 3
/* 2D79C 8005239C 24630044 */  addiu     $v1, $v1, 0x44
/* 2D7A0 800523A0 0204102B */  sltu      $v0, $s0, $a0
/* 2D7A4 800523A4 10400012 */  beqz      $v0, .L800523F0
/* 2D7A8 800523A8 02839021 */   addu     $s2, $s4, $v1
/* 2D7AC 800523AC 001010C0 */  sll       $v0, $s0, 3
/* 2D7B0 800523B0 00501021 */  addu      $v0, $v0, $s0
/* 2D7B4 800523B4 000210C0 */  sll       $v0, $v0, 3
/* 2D7B8 800523B8 24431320 */  addiu     $v1, $v0, 0x1320
.L800523BC:
/* 2D7BC 800523BC 02E38821 */  addu      $s1, $s7, $v1
/* 2D7C0 800523C0 92220045 */  lbu       $v0, 0x45($s1)
/* 2D7C4 800523C4 10400005 */  beqz      $v0, .L800523DC
/* 2D7C8 800523C8 00000000 */   nop
/* 2D7CC 800523CC 26100001 */  addiu     $s0, $s0, 0x1
/* 2D7D0 800523D0 0204102B */  sltu      $v0, $s0, $a0
/* 2D7D4 800523D4 1440FFF9 */  bnez      $v0, .L800523BC
/* 2D7D8 800523D8 24630048 */   addiu    $v1, $v1, 0x48
.L800523DC:
/* 2D7DC 800523DC 8E820034 */  lw        $v0, 0x34($s4)
/* 2D7E0 800523E0 0202102B */  sltu      $v0, $s0, $v0
/* 2D7E4 800523E4 1440001C */  bnez      $v0, .L80052458
/* 2D7E8 800523E8 00000000 */   nop
/* 2D7EC 800523EC 8E900030 */  lw        $s0, 0x30($s4)
.L800523F0:
/* 2D7F0 800523F0 8E820034 */  lw        $v0, 0x34($s4)
/* 2D7F4 800523F4 0202102B */  sltu      $v0, $s0, $v0
/* 2D7F8 800523F8 10400056 */  beqz      $v0, .L80052554
/* 2D7FC 800523FC 001010C0 */   sll      $v0, $s0, 3
/* 2D800 80052400 00501021 */  addu      $v0, $v0, $s0
/* 2D804 80052404 000210C0 */  sll       $v0, $v0, 3
/* 2D808 80052408 24441320 */  addiu     $a0, $v0, 0x1320
.L8005240C:
/* 2D80C 8005240C 02E48821 */  addu      $s1, $s7, $a0
/* 2D810 80052410 92220045 */  lbu       $v0, 0x45($s1)
/* 2D814 80052414 92C30022 */  lbu       $v1, 0x22($s6)
/* 2D818 80052418 0043102B */  sltu      $v0, $v0, $v1
/* 2D81C 8005241C 50400006 */  beql      $v0, $zero, .L80052438
/* 2D820 80052420 26100001 */   addiu    $s0, $s0, 0x1
/* 2D824 80052424 0220202D */  daddu     $a0, $s1, $zero
/* 2D828 80052428 0C014E31 */  jal       au_reset_voice
/* 2D82C 8005242C 320500FF */   andi     $a1, $s0, 0xFF
/* 2D830 80052430 08014912 */  j         .L80052448
/* 2D834 80052434 00000000 */   nop
.L80052438:
/* 2D838 80052438 8E820034 */  lw        $v0, 0x34($s4)
/* 2D83C 8005243C 0202102B */  sltu      $v0, $s0, $v0
/* 2D840 80052440 1440FFF2 */  bnez      $v0, .L8005240C
/* 2D844 80052444 24840048 */   addiu    $a0, $a0, 0x48
.L80052448:
/* 2D848 80052448 8E820034 */  lw        $v0, 0x34($s4)
/* 2D84C 8005244C 0202102B */  sltu      $v0, $s0, $v0
/* 2D850 80052450 50400041 */  beql      $v0, $zero, .L80052558
/* 2D854 80052454 26B50001 */   addiu    $s5, $s5, 0x1
.L80052458:
/* 2D858 80052458 8E850030 */  lw        $a1, 0x30($s4)
/* 2D85C 8005245C 92640000 */  lbu       $a0, 0x0($s3)
/* 2D860 80052460 8E830014 */  lw        $v1, 0x14($s4)
/* 2D864 80052464 92620001 */  lbu       $v0, 0x1($s3)
/* 2D868 80052468 02052823 */  subu      $a1, $s0, $a1
/* 2D86C 8005246C 000528C0 */  sll       $a1, $a1, 3
/* 2D870 80052470 24A507B4 */  addiu     $a1, $a1, 0x7B4
/* 2D874 80052474 02C52821 */  addu      $a1, $s6, $a1
/* 2D878 80052478 00042400 */  sll       $a0, $a0, 16
/* 2D87C 8005247C 00641821 */  addu      $v1, $v1, $a0
/* 2D880 80052480 00021200 */  sll       $v0, $v0, 8
/* 2D884 80052484 00621821 */  addu      $v1, $v1, $v0
/* 2D888 80052488 ACA30000 */  sw        $v1, 0x0($a1)
/* 2D88C 8005248C 92630001 */  lbu       $v1, 0x1($s3)
/* 2D890 80052490 8E440000 */  lw        $a0, 0x0($s2)
/* 2D894 80052494 3063007F */  andi      $v1, $v1, 0x7F
/* 2D898 80052498 00031040 */  sll       $v0, $v1, 1
/* 2D89C 8005249C 00431021 */  addu      $v0, $v0, $v1
/* 2D8A0 800524A0 000210C0 */  sll       $v0, $v0, 3
/* 2D8A4 800524A4 00431021 */  addu      $v0, $v0, $v1
/* 2D8A8 800524A8 9483001E */  lhu       $v1, 0x1E($a0)
/* 2D8AC 800524AC 00021080 */  sll       $v0, $v0, 2
/* 2D8B0 800524B0 00431023 */  subu      $v0, $v0, $v1
/* 2D8B4 800524B4 A4A20004 */  sh        $v0, 0x4($a1)
/* 2D8B8 800524B8 92630002 */  lbu       $v1, 0x2($s3)
/* 2D8BC 800524BC 3063007F */  andi      $v1, $v1, 0x7F
/* 2D8C0 800524C0 A0A30006 */  sb        $v1, 0x6($a1)
/* 2D8C4 800524C4 82840038 */  lb        $a0, 0x38($s4)
/* 2D8C8 800524C8 86420018 */  lh        $v0, 0x18($s2)
/* 2D8CC 800524CC 00820018 */  mult      $a0, $v0
/* 2D8D0 800524D0 00003012 */  mflo      $a2
/* 2D8D4 800524D4 00000000 */  nop
/* 2D8D8 800524D8 00000000 */  nop
/* 2D8DC 800524DC 00C30018 */  mult      $a2, $v1
/* 2D8E0 800524E0 00003012 */  mflo      $a2
/* 2D8E4 800524E4 00061383 */  sra       $v0, $a2, 14
/* 2D8E8 800524E8 A6220040 */  sh        $v0, 0x40($s1)
/* 2D8EC 800524EC 84A20004 */  lh        $v0, 0x4($a1)
/* 2D8F0 800524F0 8644000C */  lh        $a0, 0xC($s2)
/* 2D8F4 800524F4 0C014E3E */  jal       au_compute_pitch_ratio
/* 2D8F8 800524F8 00442021 */   addu     $a0, $v0, $a0
/* 2D8FC 800524FC 8E420000 */  lw        $v0, 0x0($s2)
/* 2D900 80052500 C4420020 */  lwc1      $f2, 0x20($v0)
/* 2D904 80052504 46020002 */  mul.s     $f0, $f0, $f2
/* 2D908 80052508 00000000 */  nop
/* 2D90C 8005250C E6200004 */  swc1      $f0, 0x4($s1)
/* 2D910 80052510 92420024 */  lbu       $v0, 0x24($s2)
/* 2D914 80052514 A222000E */  sb        $v0, 0xE($s1)
/* 2D918 80052518 92420025 */  lbu       $v0, 0x25($s2)
/* 2D91C 8005251C A222000F */  sb        $v0, 0xF($s1)
/* 2D920 80052520 8E420000 */  lw        $v0, 0x0($s2)
/* 2D924 80052524 AE220000 */  sw        $v0, 0x0($s1)
/* 2D928 80052528 92C20023 */  lbu       $v0, 0x23($s6)
/* 2D92C 8005252C A2220010 */  sb        $v0, 0x10($s1)
/* 2D930 80052530 8E420004 */  lw        $v0, 0x4($s2)
/* 2D934 80052534 AE220014 */  sw        $v0, 0x14($s1)
/* 2D938 80052538 8E430008 */  lw        $v1, 0x8($s2)
/* 2D93C 8005253C 24020002 */  addiu     $v0, $zero, 0x2
/* 2D940 80052540 A2220043 */  sb        $v0, 0x43($s1)
/* 2D944 80052544 AE230018 */  sw        $v1, 0x18($s1)
/* 2D948 80052548 92C20022 */  lbu       $v0, 0x22($s6)
/* 2D94C 8005254C A2220045 */  sb        $v0, 0x45($s1)
/* 2D950 80052550 A2220044 */  sb        $v0, 0x44($s1)
.L80052554:
/* 2D954 80052554 26B50001 */  addiu     $s5, $s5, 0x1
.L80052558:
/* 2D958 80052558 2EA20004 */  sltiu     $v0, $s5, 0x4
/* 2D95C 8005255C A2600000 */  sb        $zero, 0x0($s3)
/* 2D960 80052560 A2600001 */  sb        $zero, 0x1($s3)
/* 2D964 80052564 1440FF81 */  bnez      $v0, .L8005236C
/* 2D968 80052568 A2600002 */   sb       $zero, 0x2($s3)
.L8005256C:
/* 2D96C 8005256C 8FBF0030 */  lw        $ra, 0x30($sp)
/* 2D970 80052570 8FB7002C */  lw        $s7, 0x2C($sp)
/* 2D974 80052574 8FB60028 */  lw        $s6, 0x28($sp)
/* 2D978 80052578 8FB50024 */  lw        $s5, 0x24($sp)
/* 2D97C 8005257C 8FB40020 */  lw        $s4, 0x20($sp)
/* 2D980 80052580 8FB3001C */  lw        $s3, 0x1C($sp)
/* 2D984 80052584 8FB20018 */  lw        $s2, 0x18($sp)
/* 2D988 80052588 8FB10014 */  lw        $s1, 0x14($sp)
/* 2D98C 8005258C 8FB00010 */  lw        $s0, 0x10($sp)
/* 2D990 80052590 03E00008 */  jr        $ra
/* 2D994 80052594 27BD0038 */   addiu    $sp, $sp, 0x38
/* 2D998 80052598 00000000 */  nop
/* 2D99C 8005259C 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void au_amb_restore_voices(AmbienceManager* manager, AmbiencePlayer* player) {
    AuGlobals* globals;
    AuVoice* voice;
    AmbienceSavedVoice* savedVoice;
    AmbienceVoiceState* voiceState;
    AmbienceTrack* track;
    u32 i, j;

    globals = manager->globals;
    if (player->playState == AMB_PLAYER_PLAYING) {
        for (i = 0; i < ARRAY_COUNT(player->savedVoices); i++) {
            savedVoice = &player->savedVoices[i];
            if (savedVoice->tune != 0) {
                track = &player->tracks[savedVoice->trackIndex];

                // find first free voice
                for (j = player->firstVoiceIdx; j < player->lastVoiceIdx; j++) {
                    voice = &globals->voices[j];
                    if (voice->priority == AU_PRIORITY_FREE) {
                        break;
                    }
                }

                // try stealing a voice with lower priority
                if (j >= player->lastVoiceIdx) {
                    for (j = player->firstVoiceIdx; j < player->lastVoiceIdx; j++) {
                        voice = &globals->voices[j];
                        if (voice->priority < manager->priority) {
                            au_reset_voice(voice, j);
                            break;
                        }
                    }
                }

                if (j < player->lastVoiceIdx) {
                    voiceState = &manager->voiceStates[j - player->firstVoiceIdx];
                    voiceState->info.all = player->id.all + (savedVoice->trackIndex << 0x10) + (savedVoice->tune << 8);
                    voiceState->pitch = (savedVoice->tune & 0x7F) * 100 - track->instrument->keyBase;
                    voiceState->volume = savedVoice->volume & 0x7F;
                    voice->clientVolume = ((player->fadeVolume >> 0x18) * (track->volumeLerp.current >> 0x10) * voiceState->volume) >> 0xE;
                    voice->pitchRatio = au_compute_pitch_ratio(voiceState->pitch + (track->tuneLerp.current >> 0x10)) * track->instrument->pitchRatio;
                    voice->pan = track->pan;
                    voice->reverb = track->reverb;
                    voice->instrument = track->instrument;
                    voice->busId = manager->busId;
                    voice->envelope.cmdListPress = track->envelope.cmdListPress;
                    voice->envelope.cmdListRelease = track->envelope.cmdListRelease;
                    voice->syncFlags = AU_VOICE_SYNC_FLAG_ALL;
                    voice->priority = manager->priority;
                    voice->clientPriority = voice->priority;
                }
            }
            savedVoice->trackIndex = 0;
            savedVoice->tune = 0;
            savedVoice->volume = 0;
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel butterflies_appendGfx
/* 3AAD24 E00AA404 27BDFF40 */  addiu     $sp, $sp, -0xC0
/* 3AAD28 E00AA408 3C03DB06 */  lui       $v1, (0xDB060024 >> 16)
/* 3AAD2C E00AA40C AFB1009C */  sw        $s1, 0x9C($sp)
/* 3AAD30 E00AA410 3C11800A */  lui       $s1, %hi(gMainGfxPos)
/* 3AAD34 E00AA414 2631A66C */  addiu     $s1, $s1, %lo(gMainGfxPos)
/* 3AAD38 E00AA418 34630024 */  ori       $v1, $v1, (0xDB060024 & 0xFFFF)
/* 3AAD3C E00AA41C AFB700B4 */  sw        $s7, 0xB4($sp)
/* 3AAD40 E00AA420 3C17E700 */  lui       $s7, (0xE7000000 >> 16)
/* 3AAD44 E00AA424 AFBF00B8 */  sw        $ra, 0xB8($sp)
/* 3AAD48 E00AA428 AFB600B0 */  sw        $s6, 0xB0($sp)
/* 3AAD4C E00AA42C AFB500AC */  sw        $s5, 0xAC($sp)
/* 3AAD50 E00AA430 AFB400A8 */  sw        $s4, 0xA8($sp)
/* 3AAD54 E00AA434 AFB300A4 */  sw        $s3, 0xA4($sp)
/* 3AAD58 E00AA438 AFB200A0 */  sw        $s2, 0xA0($sp)
/* 3AAD5C E00AA43C AFB00098 */  sw        $s0, 0x98($sp)
/* 3AAD60 E00AA440 8E250000 */  lw        $a1, 0x0($s1)
/* 3AAD64 E00AA444 8C93000C */  lw        $s3, 0xC($a0)
/* 3AAD68 E00AA448 00A0102D */  daddu     $v0, $a1, $zero
/* 3AAD6C E00AA44C 8E720024 */  lw        $s2, 0x24($s3)
/* 3AAD70 E00AA450 8E750000 */  lw        $s5, 0x0($s3)
/* 3AAD74 E00AA454 24A50008 */  addiu     $a1, $a1, 0x8
/* 3AAD78 E00AA458 AC570000 */  sw        $s7, 0x0($v0)
/* 3AAD7C E00AA45C AC400004 */  sw        $zero, 0x4($v0)
/* 3AAD80 E00AA460 ACA30000 */  sw        $v1, 0x0($a1)
/* 3AAD84 E00AA464 8C820010 */  lw        $v0, 0x10($a0)
/* 3AAD88 E00AA468 AE250000 */  sw        $a1, 0x0($s1)
/* 3AAD8C E00AA46C 8C42001C */  lw        $v0, 0x1C($v0)
/* 3AAD90 E00AA470 3C038000 */  lui       $v1, (0x80000000 >> 16)
/* 3AAD94 E00AA474 00431021 */  addu      $v0, $v0, $v1
/* 3AAD98 E00AA478 ACA20004 */  sw        $v0, 0x4($a1)
/* 3AAD9C E00AA47C 8E62002C */  lw        $v0, 0x2C($s3)
/* 3AADA0 E00AA480 24A50008 */  addiu     $a1, $a1, 0x8
/* 3AADA4 E00AA484 AE250000 */  sw        $a1, 0x0($s1)
/* 3AADA8 E00AA488 3C01E00B */  lui       $at, (0xE00B0000 >> 16)
/* 3AADAC E00AA48C 00220821 */  addu      $at, $at, $v0
/* 3AADB0 E00AA490 8022A6EC */  lb        $v0, -0x5914($at)
/* 3AADB4 E00AA494 3C013E99 */  lui       $at, (0x3E99999A >> 16)
/* 3AADB8 E00AA498 3421999A */  ori       $at, $at, (0x3E99999A & 0xFFFF)
/* 3AADBC E00AA49C 44811000 */  mtc1      $at, $f2
/* 3AADC0 E00AA4A0 44820000 */  mtc1      $v0, $f0
/* 3AADC4 E00AA4A4 00000000 */  nop
/* 3AADC8 E00AA4A8 46800020 */  cvt.s.w   $f0, $f0
/* 3AADCC E00AA4AC 46020002 */  mul.s     $f0, $f0, $f2
/* 3AADD0 E00AA4B0 00000000 */  nop
/* 3AADD4 E00AA4B4 C6620010 */  lwc1      $f2, 0x10($s3)
/* 3AADD8 E00AA4B8 46001080 */  add.s     $f2, $f2, $f0
/* 3AADDC E00AA4BC 8E65000C */  lw        $a1, 0xC($s3)
/* 3AADE0 E00AA4C0 8E670014 */  lw        $a3, 0x14($s3)
/* 3AADE4 E00AA4C4 44061000 */  mfc1      $a2, $f2
/* 3AADE8 E00AA4C8 0C080108 */  jal       shim_guTranslateF
/* 3AADEC E00AA4CC 27A40018 */   addiu    $a0, $sp, 0x18
/* 3AADF0 E00AA4D0 3C160001 */  lui       $s6, (0x11630 >> 16)
/* 3AADF4 E00AA4D4 3C073F80 */  lui       $a3, (0x3F800000 >> 16)
/* 3AADF8 E00AA4D8 44800000 */  mtc1      $zero, $f0
/* 3AADFC E00AA4DC 27B00058 */  addiu     $s0, $sp, 0x58
/* 3AAE00 E00AA4E0 E7A00010 */  swc1      $f0, 0x10($sp)
/* 3AAE04 E00AA4E4 8E650028 */  lw        $a1, 0x28($s3)
/* 3AAE08 E00AA4E8 44060000 */  mfc1      $a2, $f0
/* 3AAE0C E00AA4EC 0C080104 */  jal       shim_guRotateF
/* 3AAE10 E00AA4F0 0200202D */   daddu    $a0, $s0, $zero
/* 3AAE14 E00AA4F4 0200202D */  daddu     $a0, $s0, $zero
/* 3AAE18 E00AA4F8 27A50018 */  addiu     $a1, $sp, 0x18
/* 3AAE1C E00AA4FC 0C080114 */  jal       shim_guMtxCatF
/* 3AAE20 E00AA500 00A0302D */   daddu    $a2, $a1, $zero
/* 3AAE24 E00AA504 3C013CA3 */  lui       $at, (0x3CA3D70A >> 16)
/* 3AAE28 E00AA508 3421D70A */  ori       $at, $at, (0x3CA3D70A & 0xFFFF)
/* 3AAE2C E00AA50C 44810000 */  mtc1      $at, $f0
/* 3AAE30 E00AA510 36D61630 */  ori       $s6, $s6, (0x11630 & 0xFFFF)
/* 3AAE34 E00AA514 44050000 */  mfc1      $a1, $f0
/* 3AAE38 E00AA518 0200202D */  daddu     $a0, $s0, $zero
/* 3AAE3C E00AA51C 00A0302D */  daddu     $a2, $a1, $zero
/* 3AAE40 E00AA520 0C080110 */  jal       shim_guScaleF
/* 3AAE44 E00AA524 00A0382D */   daddu    $a3, $a1, $zero
/* 3AAE48 E00AA528 0200202D */  daddu     $a0, $s0, $zero
/* 3AAE4C E00AA52C 27A50018 */  addiu     $a1, $sp, 0x18
/* 3AAE50 E00AA530 0C080114 */  jal       shim_guMtxCatF
/* 3AAE54 E00AA534 00A0302D */   daddu    $a2, $a1, $zero
/* 3AAE58 E00AA538 27A40018 */  addiu     $a0, $sp, 0x18
/* 3AAE5C E00AA53C 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* 3AAE60 E00AA540 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* 3AAE64 E00AA544 3C14800A */  lui       $s4, %hi(gDisplayContext)
/* 3AAE68 E00AA548 2694A674 */  addiu     $s4, $s4, %lo(gDisplayContext)
/* 3AAE6C E00AA54C 96050000 */  lhu       $a1, 0x0($s0)
/* 3AAE70 E00AA550 8E820000 */  lw        $v0, 0x0($s4)
/* 3AAE74 E00AA554 00052980 */  sll       $a1, $a1, 6
/* 3AAE78 E00AA558 00B62821 */  addu      $a1, $a1, $s6
/* 3AAE7C E00AA55C 0C080118 */  jal       shim_guMtxF2L
/* 3AAE80 E00AA560 00452821 */   addu     $a1, $v0, $a1
/* 3AAE84 E00AA564 3C03DA38 */  lui       $v1, (0xDA380002 >> 16)
/* 3AAE88 E00AA568 34630002 */  ori       $v1, $v1, (0xDA380002 & 0xFFFF)
/* 3AAE8C E00AA56C 3C060100 */  lui       $a2, (0x100600C >> 16)
/* 3AAE90 E00AA570 34C6600C */  ori       $a2, $a2, (0x100600C & 0xFFFF)
/* 3AAE94 E00AA574 3C07D838 */  lui       $a3, (0xD8380002 >> 16)
/* 3AAE98 E00AA578 34E70002 */  ori       $a3, $a3, (0xD8380002 & 0xFFFF)
/* 3AAE9C E00AA57C 325200FF */  andi      $s2, $s2, 0xFF
/* 3AAEA0 E00AA580 0015A880 */  sll       $s5, $s5, 2
/* 3AAEA4 E00AA584 8E240000 */  lw        $a0, 0x0($s1)
/* 3AAEA8 E00AA588 96020000 */  lhu       $v0, 0x0($s0)
/* 3AAEAC E00AA58C 0080282D */  daddu     $a1, $a0, $zero
/* 3AAEB0 E00AA590 24840008 */  addiu     $a0, $a0, 0x8
/* 3AAEB4 E00AA594 AE240000 */  sw        $a0, 0x0($s1)
/* 3AAEB8 E00AA598 ACA30000 */  sw        $v1, 0x0($a1)
/* 3AAEBC E00AA59C 24430001 */  addiu     $v1, $v0, 0x1
/* 3AAEC0 E00AA5A0 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 3AAEC4 E00AA5A4 00021180 */  sll       $v0, $v0, 6
/* 3AAEC8 E00AA5A8 A6030000 */  sh        $v1, 0x0($s0)
/* 3AAECC E00AA5AC 8E830000 */  lw        $v1, 0x0($s4)
/* 3AAED0 E00AA5B0 00561021 */  addu      $v0, $v0, $s6
/* 3AAED4 E00AA5B4 00621821 */  addu      $v1, $v1, $v0
/* 3AAED8 E00AA5B8 24820008 */  addiu     $v0, $a0, 0x8
/* 3AAEDC E00AA5BC ACA30004 */  sw        $v1, 0x4($a1)
/* 3AAEE0 E00AA5C0 AE220000 */  sw        $v0, 0x0($s1)
/* 3AAEE4 E00AA5C4 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 3AAEE8 E00AA5C8 AC820000 */  sw        $v0, 0x0($a0)
/* 3AAEEC E00AA5CC 00121600 */  sll       $v0, $s2, 24
/* 3AAEF0 E00AA5D0 00121C00 */  sll       $v1, $s2, 16
/* 3AAEF4 E00AA5D4 00431025 */  or        $v0, $v0, $v1
/* 3AAEF8 E00AA5D8 00129200 */  sll       $s2, $s2, 8
/* 3AAEFC E00AA5DC 00521025 */  or        $v0, $v0, $s2
/* 3AAF00 E00AA5E0 344200FF */  ori       $v0, $v0, 0xFF
/* 3AAF04 E00AA5E4 AC820004 */  sw        $v0, 0x4($a0)
/* 3AAF08 E00AA5E8 24820010 */  addiu     $v0, $a0, 0x10
/* 3AAF0C E00AA5EC 3C03DE00 */  lui       $v1, (0xDE000000 >> 16)
/* 3AAF10 E00AA5F0 AE220000 */  sw        $v0, 0x0($s1)
/* 3AAF14 E00AA5F4 3C020900 */  lui       $v0, %hi(D_09003880_410B10)
/* 3AAF18 E00AA5F8 24423880 */  addiu     $v0, $v0, %lo(D_09003880_410B10)
/* 3AAF1C E00AA5FC AC82000C */  sw        $v0, 0xC($a0)
/* 3AAF20 E00AA600 24820018 */  addiu     $v0, $a0, 0x18
/* 3AAF24 E00AA604 AC830008 */  sw        $v1, 0x8($a0)
/* 3AAF28 E00AA608 AE220000 */  sw        $v0, 0x0($s1)
/* 3AAF2C E00AA60C AC830010 */  sw        $v1, 0x10($a0)
/* 3AAF30 E00AA610 3C05E00B */  lui       $a1, (0xE00B0000 >> 16)
/* 3AAF34 E00AA614 00B52821 */  addu      $a1, $a1, $s5
/* 3AAF38 E00AA618 8CA5A6C0 */  lw        $a1, -0x5940($a1)
/* 3AAF3C E00AA61C 24820020 */  addiu     $v0, $a0, 0x20
/* 3AAF40 E00AA620 AE220000 */  sw        $v0, 0x0($s1)
/* 3AAF44 E00AA624 24820028 */  addiu     $v0, $a0, 0x28
/* 3AAF48 E00AA628 AC860018 */  sw        $a2, 0x18($a0)
/* 3AAF4C E00AA62C AE220000 */  sw        $v0, 0x0($s1)
/* 3AAF50 E00AA630 24820030 */  addiu     $v0, $a0, 0x30
/* 3AAF54 E00AA634 AE220000 */  sw        $v0, 0x0($s1)
/* 3AAF58 E00AA638 AC850014 */  sw        $a1, 0x14($a0)
/* 3AAF5C E00AA63C 8E65002C */  lw        $a1, 0x2C($s3)
/* 3AAF60 E00AA640 24820038 */  addiu     $v0, $a0, 0x38
/* 3AAF64 E00AA644 AE220000 */  sw        $v0, 0x0($s1)
/* 3AAF68 E00AA648 3C020900 */  lui       $v0, %hi(D_09003DC8_411058)
/* 3AAF6C E00AA64C 24423DC8 */  addiu     $v0, $v0, %lo(D_09003DC8_411058)
/* 3AAF70 E00AA650 AC820024 */  sw        $v0, 0x24($a0)
/* 3AAF74 E00AA654 24020040 */  addiu     $v0, $zero, 0x40
/* 3AAF78 E00AA658 AC830020 */  sw        $v1, 0x20($a0)
/* 3AAF7C E00AA65C 3C030900 */  lui       $v1, %hi(D_09002D40_40FFD0)
/* 3AAF80 E00AA660 24632D40 */  addiu     $v1, $v1, %lo(D_09002D40_40FFD0)
/* 3AAF84 E00AA664 AC870028 */  sw        $a3, 0x28($a0)
/* 3AAF88 E00AA668 AC82002C */  sw        $v0, 0x2C($a0)
/* 3AAF8C E00AA66C AC970030 */  sw        $s7, 0x30($a0)
/* 3AAF90 E00AA670 AC800034 */  sw        $zero, 0x34($a0)
/* 3AAF94 E00AA674 00051040 */  sll       $v0, $a1, 1
/* 3AAF98 E00AA678 00451021 */  addu      $v0, $v0, $a1
/* 3AAF9C E00AA67C 00021140 */  sll       $v0, $v0, 5
/* 3AAFA0 E00AA680 00431021 */  addu      $v0, $v0, $v1
/* 3AAFA4 E00AA684 AC82001C */  sw        $v0, 0x1C($a0)
/* 3AAFA8 E00AA688 8FBF00B8 */  lw        $ra, 0xB8($sp)
/* 3AAFAC E00AA68C 8FB700B4 */  lw        $s7, 0xB4($sp)
/* 3AAFB0 E00AA690 8FB600B0 */  lw        $s6, 0xB0($sp)
/* 3AAFB4 E00AA694 8FB500AC */  lw        $s5, 0xAC($sp)
/* 3AAFB8 E00AA698 8FB400A8 */  lw        $s4, 0xA8($sp)
/* 3AAFBC E00AA69C 8FB300A4 */  lw        $s3, 0xA4($sp)
/* 3AAFC0 E00AA6A0 8FB200A0 */  lw        $s2, 0xA0($sp)
/* 3AAFC4 E00AA6A4 8FB1009C */  lw        $s1, 0x9C($sp)
/* 3AAFC8 E00AA6A8 8FB00098 */  lw        $s0, 0x98($sp)
/* 3AAFCC E00AA6AC 03E00008 */  jr        $ra
/* 3AAFD0 E00AA6B0 27BD00C0 */   addiu    $sp, $sp, 0xC0
/* 3AAFD4 E00AA6B4 00000000 */  nop
/* 3AAFD8 E00AA6B8 00000000 */  nop
/* 3AAFDC E00AA6BC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void butterflies_appendGfx(void* effect) {
    EffectInstance* effectTemp = effect;
    ButterfliesFXData* data = effectTemp->data.butterflies;
    Matrix4f sp18;
    Matrix4f sp58;

    s32 primColor = data->unk_24;
    s32 type = data->unk_00;

    gDPPipeSync(gMainGfxPos++);
    gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->graphics->data));

    shim_guTranslateF(sp18, data->unk_0C, data->unk_10 + D_E00AA6EC[data->unk_2C] * 0.3f, data->unk_14);
    shim_guRotateF(sp58, data->unk_28, 0.0f, 1.0f, 0.0f);
    shim_guMtxCatF(sp58, sp18, sp18);
    shim_guScaleF(sp58, 0.02f, 0.02f, 0.02f);
    shim_guMtxCatF(sp58, sp18, sp18);
    shim_guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);

    gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
    gDPSetPrimColor(gMainGfxPos++, 0, 0, primColor, primColor, primColor, 255);
    gSPDisplayList(gMainGfxPos++, D_09003880_3AE8B0);
    gSPDisplayList(gMainGfxPos++, D_E00AA6C0[type]);
    gSPVertex(gMainGfxPos++, &D_09002D40_3ADD70[data->unk_2C], 6, 0);
    gSPDisplayList(gMainGfxPos++, D_09003DC8_3AEDF8);
    gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    gDPPipeSync(gMainGfxPos++);
}