### RAW ASSEMBLY INSTRUCTIONS:

glabel state_step_exit_language_select
/* 10B04 80035704 3C03800A */  lui       $v1, %hi(D_800A0931)
/* 10B08 80035708 80630931 */  lb        $v1, %lo(D_800A0931)($v1)
/* 10B0C 8003570C 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 10B10 80035710 AFBF0024 */  sw        $ra, 0x24($sp)
/* 10B14 80035714 AFB20020 */  sw        $s2, 0x20($sp)
/* 10B18 80035718 AFB1001C */  sw        $s1, 0x1C($sp)
/* 10B1C 8003571C 2C620005 */  sltiu     $v0, $v1, 0x5
/* 10B20 80035720 10400101 */  beqz      $v0, .L80035B28
/* 10B24 80035724 AFB00018 */   sw       $s0, 0x18($sp)
/* 10B28 80035728 00031080 */  sll       $v0, $v1, 2
/* 10B2C 8003572C 3C01800A */  lui       $at, %hi(jtbl_800982E8)
/* 10B30 80035730 00220821 */  addu      $at, $at, $v0
/* 10B34 80035734 8C2282E8 */  lw        $v0, %lo(jtbl_800982E8)($at)
/* 10B38 80035738 00400008 */  jr        $v0
/* 10B3C 8003573C 00000000 */   nop
glabel .L80035740
/* 10B40 80035740 3C10800A */  lui       $s0, %hi(D_800A0932)
/* 10B44 80035744 26100932 */  addiu     $s0, $s0, %lo(D_800A0932)
/* 10B48 80035748 86020000 */  lh        $v0, 0x0($s0)
/* 10B4C 8003574C 96030000 */  lhu       $v1, 0x0($s0)
/* 10B50 80035750 1040000F */  beqz      $v0, .L80035790
/* 10B54 80035754 2462FFEC */   addiu    $v0, $v1, -0x14
/* 10B58 80035758 A6020000 */  sh        $v0, 0x0($s0)
/* 10B5C 8003575C 00021400 */  sll       $v0, $v0, 16
/* 10B60 80035760 04420001 */  bltzl     $v0, .L80035768
/* 10B64 80035764 A6000000 */   sh       $zero, 0x0($s0)
.L80035768:
/* 10B68 80035768 86020000 */  lh        $v0, 0x0($s0)
/* 10B6C 8003576C 44820000 */  mtc1      $v0, $f0
/* 10B70 80035770 00000000 */  nop
/* 10B74 80035774 46800020 */  cvt.s.w   $f0, $f0
/* 10B78 80035778 44050000 */  mfc1      $a1, $f0
/* 10B7C 8003577C 0C04DF62 */  jal       set_screen_overlay_params_front
/* 10B80 80035780 0000202D */   daddu    $a0, $zero, $zero
/* 10B84 80035784 86020000 */  lh        $v0, 0x0($s0)
/* 10B88 80035788 144000E7 */  bnez      $v0, .L80035B28
/* 10B8C 8003578C 00000000 */   nop
.L80035790:
/* 10B90 80035790 24020001 */  addiu     $v0, $zero, 0x1
/* 10B94 80035794 3C01800A */  lui       $at, %hi(D_800A0931)
/* 10B98 80035798 A0220931 */  sb        $v0, %lo(D_800A0931)($at)
/* 10B9C 8003579C 0800D6CA */  j         .L80035B28
/* 10BA0 800357A0 00000000 */   nop
glabel .L800357A4
/* 10BA4 800357A4 3C10800A */  lui       $s0, %hi(D_800A0932)
/* 10BA8 800357A8 26100932 */  addiu     $s0, $s0, %lo(D_800A0932)
/* 10BAC 800357AC 241100FF */  addiu     $s1, $zero, 0xFF
/* 10BB0 800357B0 86020000 */  lh        $v0, 0x0($s0)
/* 10BB4 800357B4 96030000 */  lhu       $v1, 0x0($s0)
/* 10BB8 800357B8 10510011 */  beq       $v0, $s1, .L80035800
/* 10BBC 800357BC 24620014 */   addiu    $v0, $v1, 0x14
/* 10BC0 800357C0 A6020000 */  sh        $v0, 0x0($s0)
/* 10BC4 800357C4 00021400 */  sll       $v0, $v0, 16
/* 10BC8 800357C8 00021403 */  sra       $v0, $v0, 16
/* 10BCC 800357CC 28420100 */  slti      $v0, $v0, 0x100
/* 10BD0 800357D0 50400001 */  beql      $v0, $zero, .L800357D8
/* 10BD4 800357D4 A6110000 */   sh       $s1, 0x0($s0)
.L800357D8:
/* 10BD8 800357D8 86020000 */  lh        $v0, 0x0($s0)
/* 10BDC 800357DC 44820000 */  mtc1      $v0, $f0
/* 10BE0 800357E0 00000000 */  nop
/* 10BE4 800357E4 46800020 */  cvt.s.w   $f0, $f0
/* 10BE8 800357E8 44050000 */  mfc1      $a1, $f0
/* 10BEC 800357EC 0C04DF62 */  jal       set_screen_overlay_params_front
/* 10BF0 800357F0 0000202D */   daddu    $a0, $zero, $zero
/* 10BF4 800357F4 86020000 */  lh        $v0, 0x0($s0)
/* 10BF8 800357F8 145100CB */  bne       $v0, $s1, .L80035B28
/* 10BFC 800357FC 00000000 */   nop
.L80035800:
/* 10C00 80035800 24020002 */  addiu     $v0, $zero, 0x2
/* 10C04 80035804 3C01800A */  lui       $at, %hi(D_800A0931)
/* 10C08 80035808 A0220931 */  sb        $v0, %lo(D_800A0931)($at)
/* 10C0C 8003580C 0800D6CA */  j         .L80035B28
/* 10C10 80035810 00000000 */   nop
glabel .L80035814
/* 10C14 80035814 3C06800A */  lui       $a2, %hi(D_800A0930)
/* 10C18 80035818 24C60930 */  addiu     $a2, $a2, %lo(D_800A0930)
/* 10C1C 8003581C 80C30000 */  lb        $v1, 0x0($a2)
/* 10C20 80035820 24020003 */  addiu     $v0, $zero, 0x3
/* 10C24 80035824 14620006 */  bne       $v1, $v0, .L80035840
/* 10C28 80035828 00000000 */   nop
/* 10C2C 8003582C 3C03800A */  lui       $v1, %hi(gOverrideFlags)
/* 10C30 80035830 2463A650 */  addiu     $v1, $v1, %lo(gOverrideFlags)
/* 10C34 80035834 8C620000 */  lw        $v0, 0x0($v1)
/* 10C38 80035838 34420008 */  ori       $v0, $v0, 0x8
/* 10C3C 8003583C AC620000 */  sw        $v0, 0x0($v1)
.L80035840:
/* 10C40 80035840 80C20000 */  lb        $v0, 0x0($a2)
/* 10C44 80035844 90C30000 */  lbu       $v1, 0x0($a2)
/* 10C48 80035848 044000B7 */  bltz      $v0, .L80035B28
/* 10C4C 8003584C 2462FFFF */   addiu    $v0, $v1, -0x1
/* 10C50 80035850 A0C20000 */  sb        $v0, 0x0($a2)
/* 10C54 80035854 00021600 */  sll       $v0, $v0, 24
/* 10C58 80035858 14400067 */  bnez      $v0, .L800359F8
/* 10C5C 8003585C 24050003 */   addiu    $a1, $zero, 0x3
/* 10C60 80035860 3C048007 */  lui       $a0, %hi(fsFrameBuffers)
/* 10C64 80035864 24847980 */  addiu     $a0, $a0, %lo(fsFrameBuffers)
/* 10C68 80035868 2402FFFF */  addiu     $v0, $zero, -0x1
/* 10C6C 8003586C 0C017CBC */  jal       nuGfxSetCfb
/* 10C70 80035870 A0C20000 */   sb       $v0, 0x0($a2)
/* 10C74 80035874 0C0912C0 */  jal       func_80244B00
/* 10C78 80035878 00000000 */   nop
/* 10C7C 8003587C 3C04800A */  lui       $a0, %hi(gOverrideFlags)
/* 10C80 80035880 2484A650 */  addiu     $a0, $a0, %lo(gOverrideFlags)
/* 10C84 80035884 8C820000 */  lw        $v0, 0x0($a0)
/* 10C88 80035888 2403FFF7 */  addiu     $v1, $zero, -0x9
/* 10C8C 8003588C 00431024 */  and       $v0, $v0, $v1
/* 10C90 80035890 0C016AFA */  jal       get_current_map_settings
/* 10C94 80035894 AC820000 */   sw       $v0, 0x0($a0)
/* 10C98 80035898 3C108007 */  lui       $s0, %hi(gGameStatusPtr)
/* 10C9C 8003589C 2610419C */  addiu     $s0, $s0, %lo(gGameStatusPtr)
/* 10CA0 800358A0 8E040000 */  lw        $a0, 0x0($s0)
/* 10CA4 800358A4 84830086 */  lh        $v1, 0x86($a0)
/* 10CA8 800358A8 00031900 */  sll       $v1, $v1, 4
/* 10CAC 800358AC 3C058009 */  lui       $a1, %hi(gAreas + 0x4)
/* 10CB0 800358B0 00A32821 */  addu      $a1, $a1, $v1
/* 10CB4 800358B4 8CA534F4 */  lw        $a1, %lo(gAreas + 0x4)($a1)
/* 10CB8 800358B8 8483008C */  lh        $v1, 0x8C($a0)
/* 10CBC 800358BC 0040902D */  daddu     $s2, $v0, $zero
/* 10CC0 800358C0 A0800070 */  sb        $zero, 0x70($a0)
/* 10CC4 800358C4 00031940 */  sll       $v1, $v1, 5
/* 10CC8 800358C8 0C016BE1 */  jal       func_8005AF84
/* 10CCC 800358CC 00A38821 */   addu     $s1, $a1, $v1
/* 10CD0 800358D0 0C00AB37 */  jal       func_8002ACDC
/* 10CD4 800358D4 00000000 */   nop
/* 10CD8 800358D8 0C05259C */  jal       sfx_clear_env_sounds
/* 10CDC 800358DC 24040001 */   addiu    $a0, $zero, 0x1
/* 10CE0 800358E0 8E020000 */  lw        $v0, 0x0($s0)
/* 10CE4 800358E4 0C0B763E */  jal       spr_init_sprites
/* 10CE8 800358E8 80440084 */   lb       $a0, 0x84($v0)
/* 10CEC 800358EC 0C0457FA */  jal       init_model_data
/* 10CF0 800358F0 00000000 */   nop
/* 10CF4 800358F4 0C05203C */  jal       init_sprite_shading_data
/* 10CF8 800358F8 00000000 */   nop
/* 10CFC 800358FC 0C048316 */  jal       init_entity_models
/* 10D00 80035900 00000000 */   nop
/* 10D04 80035904 0C0478C4 */  jal       reset_animator_list
/* 10D08 80035908 00000000 */   nop
/* 10D0C 8003590C 0C048C45 */  jal       init_worker_list
/* 10D10 80035910 00000000 */   nop
/* 10D14 80035914 0000202D */  daddu     $a0, $zero, $zero
/* 10D18 80035918 0C0514BA */  jal       hud_element_set_aux_cache
/* 10D1C 8003591C 0080282D */   daddu    $a1, $a0, $zero
/* 10D20 80035920 0C0504C0 */  jal       init_hud_element_list
/* 10D24 80035924 00000000 */   nop
/* 10D28 80035928 0C04C433 */  jal       init_item_entity_list
/* 10D2C 8003592C 00000000 */   nop
/* 10D30 80035930 0C0B0CBB */  jal       init_script_list
/* 10D34 80035934 00000000 */   nop
/* 10D38 80035938 0C00E14B */  jal       init_npc_list
/* 10D3C 8003593C 00000000 */   nop
/* 10D40 80035940 0C044396 */  jal       init_entity_data
/* 10D44 80035944 00000000 */   nop
/* 10D48 80035948 0C0515CA */  jal       init_trigger_list
/* 10D4C 8003594C 00000000 */   nop
/* 10D50 80035950 3C04800E */  lui       $a0, %hi(wMapShapeName)
/* 10D54 80035954 24849230 */  addiu     $a0, $a0, %lo(wMapShapeName)
/* 10D58 80035958 0C016B3A */  jal       load_asset_by_name
/* 10D5C 8003595C 27A50010 */   addiu    $a1, $sp, 0x10
/* 10D60 80035960 0040802D */  daddu     $s0, $v0, $zero
/* 10D64 80035964 3C058021 */  lui       $a1, %hi(gMapShapeData)
/* 10D68 80035968 24A50000 */  addiu     $a1, $a1, %lo(gMapShapeData)
/* 10D6C 8003596C 0C01BB7C */  jal       decode_yay0
/* 10D70 80035970 0200202D */   daddu    $a0, $s0, $zero
/* 10D74 80035974 0C00AB1E */  jal       general_heap_free
/* 10D78 80035978 0200202D */   daddu    $a0, $s0, $zero
/* 10D7C 8003597C 0C016BE5 */  jal       initialize_collision
/* 10D80 80035980 00000000 */   nop
/* 10D84 80035984 0C016C16 */  jal       restore_map_collision_data
/* 10D88 80035988 00000000 */   nop
/* 10D8C 8003598C 8E240008 */  lw        $a0, 0x8($s1)
/* 10D90 80035990 10800004 */  beqz      $a0, .L800359A4
/* 10D94 80035994 00000000 */   nop
/* 10D98 80035998 8E25000C */  lw        $a1, 0xC($s1)
/* 10D9C 8003599C 0C00A5CF */  jal       dma_copy
/* 10DA0 800359A0 8E260010 */   lw       $a2, 0x10($s1)
.L800359A4:
/* 10DA4 800359A4 0C05175C */  jal       load_map_bg
/* 10DA8 800359A8 8E240014 */   lw       $a0, 0x14($s1)
/* 10DAC 800359AC 8E440038 */  lw        $a0, 0x38($s2)
/* 10DB0 800359B0 50800005 */  beql      $a0, $zero, .L800359C8
/* 10DB4 800359B4 24040128 */   addiu    $a0, $zero, 0x128
/* 10DB8 800359B8 0C05178A */  jal       read_background_size
/* 10DBC 800359BC 00000000 */   nop
/* 10DC0 800359C0 0800D676 */  j         .L800359D8
/* 10DC4 800359C4 00000000 */   nop
.L800359C8:
/* 10DC8 800359C8 240500C8 */  addiu     $a1, $zero, 0xC8
/* 10DCC 800359CC 2406000C */  addiu     $a2, $zero, 0xC
/* 10DD0 800359D0 0C05179C */  jal       set_background_size
/* 10DD4 800359D4 24070014 */   addiu    $a3, $zero, 0x14
.L800359D8:
/* 10DD8 800359D8 0C04584B */  jal       calculate_model_sizes
/* 10DDC 800359DC 00000000 */   nop
/* 10DE0 800359E0 0C00EC6C */  jal       npc_reload_all
/* 10DE4 800359E4 00000000 */   nop
/* 10DE8 800359E8 0C03A631 */  jal       status_bar_respond_to_changes
/* 10DEC 800359EC 00000000 */   nop
/* 10DF0 800359F0 0C009C22 */  jal       set_time_freeze_mode
/* 10DF4 800359F4 24040001 */   addiu    $a0, $zero, 0x1
.L800359F8:
/* 10DF8 800359F8 0C051FB1 */  jal       set_windows_visible
/* 10DFC 800359FC 0000202D */   daddu    $a0, $zero, $zero
/* 10E00 80035A00 24020003 */  addiu     $v0, $zero, 0x3
/* 10E04 80035A04 3C01800A */  lui       $at, %hi(D_800A0931)
/* 10E08 80035A08 A0220931 */  sb        $v0, %lo(D_800A0931)($at)
/* 10E0C 80035A0C 0C037DD0 */  jal       update_player
/* 10E10 80035A10 00000000 */   nop
/* 10E14 80035A14 0C00E64C */  jal       update_npcs
/* 10E18 80035A18 00000000 */   nop
/* 10E1C 80035A1C 0C00F949 */  jal       update_encounters
/* 10E20 80035A20 00000000 */   nop
/* 10E24 80035A24 0C016754 */  jal       update_effects
/* 10E28 80035A28 00000000 */   nop
/* 10E2C 80035A2C 3C03800A */  lui       $v1, %hi(D_800A0932)
/* 10E30 80035A30 24630932 */  addiu     $v1, $v1, %lo(D_800A0932)
/* 10E34 80035A34 94620000 */  lhu       $v0, 0x0($v1)
/* 10E38 80035A38 2442FFEC */  addiu     $v0, $v0, -0x14
/* 10E3C 80035A3C A4620000 */  sh        $v0, 0x0($v1)
/* 10E40 80035A40 00021400 */  sll       $v0, $v0, 16
/* 10E44 80035A44 04420001 */  bltzl     $v0, .L80035A4C
/* 10E48 80035A48 A4600000 */   sh       $zero, 0x0($v1)
.L80035A4C:
/* 10E4C 80035A4C 84620000 */  lh        $v0, 0x0($v1)
/* 10E50 80035A50 44820000 */  mtc1      $v0, $f0
/* 10E54 80035A54 00000000 */  nop
/* 10E58 80035A58 46800020 */  cvt.s.w   $f0, $f0
/* 10E5C 80035A5C 44050000 */  mfc1      $a1, $f0
/* 10E60 80035A60 0800D6C8 */  j         .L80035B20
/* 10E64 80035A64 0000202D */   daddu    $a0, $zero, $zero
glabel .L80035A68
/* 10E68 80035A68 0C037DD0 */  jal       update_player
/* 10E6C 80035A6C 00000000 */   nop
/* 10E70 80035A70 0C00E64C */  jal       update_npcs
/* 10E74 80035A74 00000000 */   nop
/* 10E78 80035A78 0C00F949 */  jal       update_encounters
/* 10E7C 80035A7C 00000000 */   nop
/* 10E80 80035A80 0C016754 */  jal       update_effects
/* 10E84 80035A84 00000000 */   nop
/* 10E88 80035A88 3C04800A */  lui       $a0, %hi(D_800A0932)
/* 10E8C 80035A8C 24840932 */  addiu     $a0, $a0, %lo(D_800A0932)
/* 10E90 80035A90 84820000 */  lh        $v0, 0x0($a0)
/* 10E94 80035A94 94830000 */  lhu       $v1, 0x0($a0)
/* 10E98 80035A98 14400006 */  bnez      $v0, .L80035AB4
/* 10E9C 80035A9C 2462FFEC */   addiu    $v0, $v1, -0x14
/* 10EA0 80035AA0 24020004 */  addiu     $v0, $zero, 0x4
/* 10EA4 80035AA4 3C01800A */  lui       $at, %hi(D_800A0931)
/* 10EA8 80035AA8 A0220931 */  sb        $v0, %lo(D_800A0931)($at)
/* 10EAC 80035AAC 0800D6CA */  j         .L80035B28
/* 10EB0 80035AB0 00000000 */   nop
.L80035AB4:
/* 10EB4 80035AB4 A4820000 */  sh        $v0, 0x0($a0)
/* 10EB8 80035AB8 00021400 */  sll       $v0, $v0, 16
/* 10EBC 80035ABC 04420001 */  bltzl     $v0, .L80035AC4
/* 10EC0 80035AC0 A4800000 */   sh       $zero, 0x0($a0)
.L80035AC4:
/* 10EC4 80035AC4 84820000 */  lh        $v0, 0x0($a0)
/* 10EC8 80035AC8 44820000 */  mtc1      $v0, $f0
/* 10ECC 80035ACC 00000000 */  nop
/* 10ED0 80035AD0 46800020 */  cvt.s.w   $f0, $f0
/* 10ED4 80035AD4 44050000 */  mfc1      $a1, $f0
/* 10ED8 80035AD8 0800D6C8 */  j         .L80035B20
/* 10EDC 80035ADC 0000202D */   daddu    $a0, $zero, $zero
glabel .L80035AE0
/* 10EE0 80035AE0 0C009C22 */  jal       set_time_freeze_mode
/* 10EE4 80035AE4 0000202D */   daddu    $a0, $zero, $zero
/* 10EE8 80035AE8 0C037DD0 */  jal       update_player
/* 10EEC 80035AEC 00000000 */   nop
/* 10EF0 80035AF0 0C00E64C */  jal       update_npcs
/* 10EF4 80035AF4 00000000 */   nop
/* 10EF8 80035AF8 0C00F949 */  jal       update_encounters
/* 10EFC 80035AFC 00000000 */   nop
/* 10F00 80035B00 0C016754 */  jal       update_effects
/* 10F04 80035B04 00000000 */   nop
/* 10F08 80035B08 0C038069 */  jal       enable_player_input
/* 10F0C 80035B0C 00000000 */   nop
/* 10F10 80035B10 0C00CD3C */  jal       set_game_mode
/* 10F14 80035B14 24040004 */   addiu    $a0, $zero, 0x4
/* 10F18 80035B18 3C05BF80 */  lui       $a1, (0xBF800000 >> 16)
/* 10F1C 80035B1C 240400FF */  addiu     $a0, $zero, 0xFF
.L80035B20:
/* 10F20 80035B20 0C04DF62 */  jal       set_screen_overlay_params_front
/* 10F24 80035B24 00000000 */   nop
.L80035B28:
/* 10F28 80035B28 8FBF0024 */  lw        $ra, 0x24($sp)
/* 10F2C 80035B2C 8FB20020 */  lw        $s2, 0x20($sp)
/* 10F30 80035B30 8FB1001C */  lw        $s1, 0x1C($sp)
/* 10F34 80035B34 8FB00018 */  lw        $s0, 0x18($sp)
/* 10F38 80035B38 03E00008 */  jr        $ra
/* 10F3C 80035B3C 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

void state_step_exit_language_select(void) {
    switch (D_800A0931) {
        case 0:
            if (D_800A0932[0] != 0) {
                D_800A0932[0] -= 20;
                if (D_800A0932[0] < 0) {
                    D_800A0932[0] = 0;
                }
                set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, D_800A0932[0]);
                if (D_800A0932[0] == 0) {
                    D_800A0931 = 1;
                }
            } else {
                D_800A0931 = 1;
            }
            break;
        case 1:
            if (D_800A0932[0] != 255) {
                D_800A0932[0] += 20;
                if (D_800A0932[0] > 255) {
                    D_800A0932[0] = 255;
                }
                set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, D_800A0932[0]);
                if (D_800A0932[0] == 255) {
                    D_800A0931 = 2;
                }
            } else {
                D_800A0931 = 2;
            }
            break;
        case 2:
            if (D_800A0930 == 3) {
                gOverrideFlags |= GLOBAL_OVERRIDES_8;
            }

            if (D_800A0930 >= 0) {
                D_800A0930--;
                if (D_800A0930 == 0) {
                    MapSettings* mapSettings;
                    MapConfig* mapConfig;
                    u32 mapShapeSize;
                    void* mapShape;
                    BackgroundHeader* bgHeader;

                    D_800A0930 = -1;
                    nuGfxSetCfb(fsFrameBuffers, ARRAY_COUNT(fsFrameBuffers));
                    filemenu_cleanup();
                    gOverrideFlags &= ~GLOBAL_OVERRIDES_8;
                    mapSettings = get_current_map_settings();
                    mapConfig = &gAreas[gGameStatusPtr->areaID].maps[gGameStatusPtr->mapID];
                    gGameStatusPtr->isBattle = FALSE;
                    func_8005AF84();
                    func_8002ACDC();
                    sfx_clear_env_sounds(1);
                    spr_init_sprites(gGameStatusPtr->playerSpriteSet);
                    init_model_data();
                    init_sprite_shading_data();
                    init_entity_models();
                    reset_animator_list();
                    init_worker_list();
                    hud_element_set_aux_cache(0, 0);
                    init_hud_element_list();
                    init_item_entity_list();
                    init_script_list();
                    init_npc_list();
                    init_entity_data();
                    init_trigger_list();
                    mapShape = load_asset_by_name(wMapShapeName, &mapShapeSize);
                    decode_yay0(mapShape, &gMapShapeData);
                    general_heap_free(mapShape);
                    initialize_collision();
                    restore_map_collision_data();

                    if (mapConfig->dmaStart != NULL) {
                        dma_copy(mapConfig->dmaStart, mapConfig->dmaEnd, mapConfig->dmaDest);
                    }

                    load_map_bg(mapConfig->bgName);

                    bgHeader = mapSettings->background;
                    if (bgHeader != NULL) {
                        read_background_size(bgHeader);
                    } else {
                        set_background_size(296, 200, 12, 20);
                    }

                    calculate_model_sizes();
                    npc_reload_all();
                    status_bar_respond_to_changes();
                    set_time_freeze_mode(TIME_FREEZE_PARTIAL);
                }
                set_windows_visible(WINDOW_GROUP_ALL);
                D_800A0931 = 3;
                update_player();
                update_npcs();
                update_encounters();
                update_effects();

                D_800A0932[0] -= 20;
                if (D_800A0932[0] < 0) {
                    D_800A0932[0] = 0;
                }
                set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, D_800A0932[0]);
            }
            break;
        case 3:
            update_player();
            update_npcs();
            update_encounters();
            update_effects();

            if (D_800A0932[0] == 0) {
                D_800A0931 = 4;
            } else {
                D_800A0932[0] -= 20;
                if (D_800A0932[0] < 0) {
                    D_800A0932[0] = 0;
                }
                set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, D_800A0932[0]);
            }
            break;
        case 4:
            set_time_freeze_mode(TIME_FREEZE_NORMAL);
            update_player();
            update_npcs();
            update_encounters();
            update_effects();
            enable_player_input();
            set_game_mode(GAME_MODE_CHANGE_MAP);
            set_screen_overlay_params_front(OVERLAY_NONE, -1.0f);
            break;
        }
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_8025AD90
/* 189670 8025AD90 27BDFFD0 */  addiu     $sp, $sp, -0x30
/* 189674 8025AD94 AFB20018 */  sw        $s2, 0x18($sp)
/* 189678 8025AD98 0080902D */  daddu     $s2, $a0, $zero
/* 18967C 8025AD9C AFB10014 */  sw        $s1, 0x14($sp)
/* 189680 8025ADA0 00A0882D */  daddu     $s1, $a1, $zero
/* 189684 8025ADA4 AFB3001C */  sw        $s3, 0x1C($sp)
/* 189688 8025ADA8 00C0982D */  daddu     $s3, $a2, $zero
/* 18968C 8025ADAC AFBF0028 */  sw        $ra, 0x28($sp)
/* 189690 8025ADB0 AFB50024 */  sw        $s5, 0x24($sp)
/* 189694 8025ADB4 AFB40020 */  sw        $s4, 0x20($sp)
/* 189698 8025ADB8 AFB00010 */  sw        $s0, 0x10($sp)
/* 18969C 8025ADBC 8E3000C0 */  lw        $s0, 0xC0($s1)
/* 1896A0 8025ADC0 820206C1 */  lb        $v0, 0x6C1($s0)
/* 1896A4 8025ADC4 8FB50040 */  lw        $s5, 0x40($sp)
/* 1896A8 8025ADC8 1040004B */  beqz      $v0, .L8025AEF8
/* 1896AC 8025ADCC 00E0A02D */   daddu    $s4, $a3, $zero
/* 1896B0 8025ADD0 16400016 */  bnez      $s2, .L8025AE2C
/* 1896B4 8025ADD4 00000000 */   nop
/* 1896B8 8025ADD8 0C0B7830 */  jal       spr_get_player_palettes
/* 1896BC 8025ADDC 96240088 */   lhu      $a0, 0x88($s1)
/* 1896C0 8025ADE0 AE0206D0 */  sw        $v0, 0x6D0($s0)
/* 1896C4 8025ADE4 0040202D */  daddu     $a0, $v0, $zero
/* 1896C8 8025ADE8 A20006CD */  sb        $zero, 0x6CD($s0)
/* 1896CC 8025ADEC 8C830000 */  lw        $v1, 0x0($a0)
/* 1896D0 8025ADF0 2402FFFF */  addiu     $v0, $zero, -0x1
/* 1896D4 8025ADF4 1062000B */  beq       $v1, $v0, .L8025AE24
/* 1896D8 8025ADF8 0080182D */   daddu    $v1, $a0, $zero
/* 1896DC 8025ADFC 0040202D */  daddu     $a0, $v0, $zero
.L8025AE00:
/* 1896E0 8025AE00 920206CD */  lbu       $v0, 0x6CD($s0)
/* 1896E4 8025AE04 24420001 */  addiu     $v0, $v0, 0x1
/* 1896E8 8025AE08 A20206CD */  sb        $v0, 0x6CD($s0)
/* 1896EC 8025AE0C 00021600 */  sll       $v0, $v0, 24
/* 1896F0 8025AE10 00021583 */  sra       $v0, $v0, 22
D_8025AE14:
/* 1896F4 8025AE14 00431021 */  addu      $v0, $v0, $v1
/* 1896F8 8025AE18 8C420000 */  lw        $v0, 0x0($v0)
/* 1896FC 8025AE1C 1444FFF8 */  bne       $v0, $a0, .L8025AE00
/* 189700 8025AE20 00000000 */   nop
.L8025AE24:
/* 189704 8025AE24 08096BA1 */  j         .L8025AE84
/* 189708 8025AE28 24020006 */   addiu    $v0, $zero, 0x6
.L8025AE2C:
/* 18970C 8025AE2C 96240088 */  lhu       $a0, 0x88($s1)
/* 189710 8025AE30 0C0B7A90 */  jal       spr_get_npc_palettes
/* 189714 8025AE34 00000000 */   nop
/* 189718 8025AE38 AE0206D0 */  sw        $v0, 0x6D0($s0)
/* 18971C 8025AE3C 0040202D */  daddu     $a0, $v0, $zero
/* 189720 8025AE40 A20006CD */  sb        $zero, 0x6CD($s0)
/* 189724 8025AE44 8C830000 */  lw        $v1, 0x0($a0)
/* 189728 8025AE48 2402FFFF */  addiu     $v0, $zero, -0x1
/* 18972C 8025AE4C 1062000B */  beq       $v1, $v0, .L8025AE7C
/* 189730 8025AE50 0080182D */   daddu    $v1, $a0, $zero
/* 189734 8025AE54 0040202D */  daddu     $a0, $v0, $zero
.L8025AE58:
/* 189738 8025AE58 920206CD */  lbu       $v0, 0x6CD($s0)
/* 18973C 8025AE5C 24420001 */  addiu     $v0, $v0, 0x1
/* 189740 8025AE60 A20206CD */  sb        $v0, 0x6CD($s0)
/* 189744 8025AE64 00021600 */  sll       $v0, $v0, 24
/* 189748 8025AE68 00021583 */  sra       $v0, $v0, 22
/* 18974C 8025AE6C 00431021 */  addu      $v0, $v0, $v1
/* 189750 8025AE70 8C420000 */  lw        $v0, 0x0($v0)
/* 189754 8025AE74 1444FFF8 */  bne       $v0, $a0, .L8025AE58
/* 189758 8025AE78 00000000 */   nop
.L8025AE7C:
/* 18975C 8025AE7C 0C0B7A9B */  jal       spr_get_npc_color_variations
/* 189760 8025AE80 96240088 */   lhu      $a0, 0x88($s1)
.L8025AE84:
/* 189764 8025AE84 A20206CC */  sb        $v0, 0x6CC($s0)
/* 189768 8025AE88 820206CD */  lb        $v0, 0x6CD($s0)
/* 18976C 8025AE8C 18400015 */  blez      $v0, .L8025AEE4
/* 189770 8025AE90 0000302D */   daddu    $a2, $zero, $zero
.L8025AE94:
/* 189774 8025AE94 8E0206D0 */  lw        $v0, 0x6D0($s0)
/* 189778 8025AE98 00061880 */  sll       $v1, $a2, 2
/* 18977C 8025AE9C 00621821 */  addu      $v1, $v1, $v0
/* 189780 8025AEA0 00061140 */  sll       $v0, $a2, 5
D_8025AEA4:
/* 189784 8025AEA4 8C630000 */  lw        $v1, 0x0($v1)
/* 189788 8025AEA8 10600009 */  beqz      $v1, .L8025AED0
/* 18978C 8025AEAC 02022821 */   addu     $a1, $s0, $v0
/* 189790 8025AEB0 0000202D */  daddu     $a0, $zero, $zero
.L8025AEB4:
/* 189794 8025AEB4 94620000 */  lhu       $v0, 0x0($v1)
/* 189798 8025AEB8 24630002 */  addiu     $v1, $v1, 0x2
/* 18979C 8025AEBC 24840001 */  addiu     $a0, $a0, 0x1
/* 1897A0 8025AEC0 A4A20000 */  sh        $v0, 0x0($a1)
/* 1897A4 8025AEC4 28820010 */  slti      $v0, $a0, 0x10
/* 1897A8 8025AEC8 1440FFFA */  bnez      $v0, .L8025AEB4
/* 1897AC 8025AECC 24A50002 */   addiu    $a1, $a1, 0x2
.L8025AED0:
/* 1897B0 8025AED0 820206CD */  lb        $v0, 0x6CD($s0)
/* 1897B4 8025AED4 24C60001 */  addiu     $a2, $a2, 0x1
/* 1897B8 8025AED8 00C2102A */  slt       $v0, $a2, $v0
/* 1897BC 8025AEDC 1440FFED */  bnez      $v0, .L8025AE94
/* 1897C0 8025AEE0 00000000 */   nop
.L8025AEE4:
/* 1897C4 8025AEE4 2402FFFE */  addiu     $v0, $zero, -0x2
/* 1897C8 8025AEE8 A20206C2 */  sb        $v0, 0x6C2($s0)
/* 1897CC 8025AEEC A60006CA */  sh        $zero, 0x6CA($s0)
/* 1897D0 8025AEF0 A20006C1 */  sb        $zero, 0x6C1($s0)
/* 1897D4 8025AEF4 A60006C8 */  sh        $zero, 0x6C8($s0)
.L8025AEF8:
/* 1897D8 8025AEF8 16A0001E */  bnez      $s5, .L8025AF74
/* 1897DC 8025AEFC 00000000 */   nop
/* 1897E0 8025AF00 860206C8 */  lh        $v0, 0x6C8($s0)
/* 1897E4 8025AF04 14400013 */  bnez      $v0, .L8025AF54
/* 1897E8 8025AF08 00000000 */   nop
/* 1897EC 8025AF0C 920206C2 */  lbu       $v0, 0x6C2($s0)
/* 1897F0 8025AF10 3C048028 */  lui       $a0, %hi(D_80284104)
/* 1897F4 8025AF14 24844104 */  addiu     $a0, $a0, %lo(D_80284104)
/* 1897F8 8025AF18 24420002 */  addiu     $v0, $v0, 0x2
/* 1897FC 8025AF1C A20206C2 */  sb        $v0, 0x6C2($s0)
/* 189800 8025AF20 00021600 */  sll       $v0, $v0, 24
/* 189804 8025AF24 00021603 */  sra       $v0, $v0, 24
/* 189808 8025AF28 3C038028 */  lui       $v1, %hi(D_80284104)
/* 18980C 8025AF2C 00621821 */  addu      $v1, $v1, $v0
/* 189810 8025AF30 90634104 */  lbu       $v1, %lo(D_80284104)($v1)
/* 189814 8025AF34 240200FF */  addiu     $v0, $zero, 0xFF
/* 189818 8025AF38 50620001 */  beql      $v1, $v0, .L8025AF40
/* 18981C 8025AF3C A20006C2 */   sb       $zero, 0x6C2($s0)
.L8025AF40:
/* 189820 8025AF40 820206C2 */  lb        $v0, 0x6C2($s0)
/* 189824 8025AF44 00441021 */  addu      $v0, $v0, $a0
/* 189828 8025AF48 90420001 */  lbu       $v0, 0x1($v0)
/* 18982C 8025AF4C 00021042 */  srl       $v0, $v0, 1
/* 189830 8025AF50 A60206C8 */  sh        $v0, 0x6C8($s0)
.L8025AF54:
/* 189834 8025AF54 820306C2 */  lb        $v1, 0x6C2($s0)
/* 189838 8025AF58 960206C8 */  lhu       $v0, 0x6C8($s0)
/* 18983C 8025AF5C 3C018028 */  lui       $at, %hi(D_80284104)
/* 189840 8025AF60 00230821 */  addu      $at, $at, $v1
/* 189844 8025AF64 90234104 */  lbu       $v1, %lo(D_80284104)($at)
/* 189848 8025AF68 2442FFFF */  addiu     $v0, $v0, -0x1
/* 18984C 8025AF6C 08096BE1 */  j         .L8025AF84
/* 189850 8025AF70 A60206C8 */   sh       $v0, 0x6C8($s0)
.L8025AF74:
/* 189854 8025AF74 820206C2 */  lb        $v0, 0x6C2($s0)
/* 189858 8025AF78 3C038028 */  lui       $v1, %hi(D_80284104)
/* 18985C 8025AF7C 00621821 */  addu      $v1, $v1, $v0
/* 189860 8025AF80 90634104 */  lbu       $v1, %lo(D_80284104)($v1)
.L8025AF84:
/* 189864 8025AF84 24020001 */  addiu     $v0, $zero, 0x1
/* 189868 8025AF88 10620024 */  beq       $v1, $v0, .L8025B01C
/* 18986C 8025AF8C 28620002 */   slti     $v0, $v1, 0x2
/* 189870 8025AF90 10400005 */  beqz      $v0, .L8025AFA8
/* 189874 8025AF94 24020002 */   addiu    $v0, $zero, 0x2
/* 189878 8025AF98 10600007 */  beqz      $v1, .L8025AFB8
/* 18987C 8025AF9C 00000000 */   nop
/* 189880 8025AFA0 08096C46 */  j         .L8025B118
/* 189884 8025AFA4 00000000 */   nop
.L8025AFA8:
/* 189888 8025AFA8 1062003C */  beq       $v1, $v0, .L8025B09C
/* 18988C 8025AFAC 00000000 */   nop
/* 189890 8025AFB0 08096C46 */  j         .L8025B118
/* 189894 8025AFB4 00000000 */   nop
.L8025AFB8:
/* 189898 8025AFB8 820206CC */  lb        $v0, 0x6CC($s0)
/* 18989C 8025AFBC 18400056 */  blez      $v0, .L8025B118
/* 1898A0 8025AFC0 0000302D */   daddu    $a2, $zero, $zero
.L8025AFC4:
/* 1898A4 8025AFC4 8E0206D0 */  lw        $v0, 0x6D0($s0)
/* 1898A8 8025AFC8 00061880 */  sll       $v1, $a2, 2
/* 1898AC 8025AFCC 00621821 */  addu      $v1, $v1, $v0
/* 1898B0 8025AFD0 00061140 */  sll       $v0, $a2, 5
/* 1898B4 8025AFD4 8C630000 */  lw        $v1, 0x0($v1)
/* 1898B8 8025AFD8 10600009 */  beqz      $v1, .L8025B000
/* 1898BC 8025AFDC 02022821 */   addu     $a1, $s0, $v0
/* 1898C0 8025AFE0 0000202D */  daddu     $a0, $zero, $zero
.L8025AFE4:
/* 1898C4 8025AFE4 94620000 */  lhu       $v0, 0x0($v1)
/* 1898C8 8025AFE8 24630002 */  addiu     $v1, $v1, 0x2
/* 1898CC 8025AFEC 24840001 */  addiu     $a0, $a0, 0x1
/* 1898D0 8025AFF0 A4A20000 */  sh        $v0, 0x0($a1)
/* 1898D4 8025AFF4 28820010 */  slti      $v0, $a0, 0x10
/* 1898D8 8025AFF8 1440FFFA */  bnez      $v0, .L8025AFE4
/* 1898DC 8025AFFC 24A50002 */   addiu    $a1, $a1, 0x2
.L8025B000:
/* 1898E0 8025B000 820206CC */  lb        $v0, 0x6CC($s0)
/* 1898E4 8025B004 24C60001 */  addiu     $a2, $a2, 0x1
/* 1898E8 8025B008 00C2102A */  slt       $v0, $a2, $v0
/* 1898EC 8025B00C 10400042 */  beqz      $v0, .L8025B118
/* 1898F0 8025B010 00000000 */   nop
/* 1898F4 8025B014 08096BF1 */  j         .L8025AFC4
/* 1898F8 8025B018 00000000 */   nop
.L8025B01C:
/* 1898FC 8025B01C 820206CC */  lb        $v0, 0x6CC($s0)
/* 189900 8025B020 920306CC */  lbu       $v1, 0x6CC($s0)
/* 189904 8025B024 1840003C */  blez      $v0, .L8025B118
/* 189908 8025B028 0000302D */   daddu    $a2, $zero, $zero
/* 18990C 8025B02C 00031E00 */  sll       $v1, $v1, 24
.L8025B030:
/* 189910 8025B030 00031E03 */  sra       $v1, $v1, 24
/* 189914 8025B034 00031080 */  sll       $v0, $v1, 2
/* 189918 8025B038 00431021 */  addu      $v0, $v0, $v1
/* 18991C 8025B03C 00461021 */  addu      $v0, $v0, $a2
/* 189920 8025B040 8E0306D0 */  lw        $v1, 0x6D0($s0)
/* 189924 8025B044 00021080 */  sll       $v0, $v0, 2
/* 189928 8025B048 00431021 */  addu      $v0, $v0, $v1
/* 18992C 8025B04C 8C430000 */  lw        $v1, 0x0($v0)
/* 189930 8025B050 00061140 */  sll       $v0, $a2, 5
/* 189934 8025B054 10600009 */  beqz      $v1, .L8025B07C
/* 189938 8025B058 02022821 */   addu     $a1, $s0, $v0
/* 18993C 8025B05C 0000202D */  daddu     $a0, $zero, $zero
.L8025B060:
/* 189940 8025B060 94620000 */  lhu       $v0, 0x0($v1)
/* 189944 8025B064 24630002 */  addiu     $v1, $v1, 0x2
/* 189948 8025B068 24840001 */  addiu     $a0, $a0, 0x1
/* 18994C 8025B06C A4A20000 */  sh        $v0, 0x0($a1)
/* 189950 8025B070 28820010 */  slti      $v0, $a0, 0x10
/* 189954 8025B074 1440FFFA */  bnez      $v0, .L8025B060
/* 189958 8025B078 24A50002 */   addiu    $a1, $a1, 0x2
.L8025B07C:
/* 18995C 8025B07C 24C60001 */  addiu     $a2, $a2, 0x1
/* 189960 8025B080 820206CC */  lb        $v0, 0x6CC($s0)
/* 189964 8025B084 920306CC */  lbu       $v1, 0x6CC($s0)
/* 189968 8025B088 00C2102A */  slt       $v0, $a2, $v0
/* 18996C 8025B08C 5440FFE8 */  bnel      $v0, $zero, .L8025B030
/* 189970 8025B090 00031E00 */   sll      $v1, $v1, 24
/* 189974 8025B094 08096C46 */  j         .L8025B118
/* 189978 8025B098 00000000 */   nop
.L8025B09C:
/* 18997C 8025B09C 820206CC */  lb        $v0, 0x6CC($s0)
/* 189980 8025B0A0 920306CC */  lbu       $v1, 0x6CC($s0)
/* 189984 8025B0A4 1840001C */  blez      $v0, .L8025B118
D_8025B0A8:
/* 189988 8025B0A8 0000302D */   daddu    $a2, $zero, $zero
/* 18998C 8025B0AC 00031E00 */  sll       $v1, $v1, 24
.L8025B0B0:
/* 189990 8025B0B0 00031E03 */  sra       $v1, $v1, 24
/* 189994 8025B0B4 00031040 */  sll       $v0, $v1, 1
/* 189998 8025B0B8 00431021 */  addu      $v0, $v0, $v1
/* 18999C 8025B0BC 00021040 */  sll       $v0, $v0, 1
/* 1899A0 8025B0C0 00461021 */  addu      $v0, $v0, $a2
/* 1899A4 8025B0C4 8E0306D0 */  lw        $v1, 0x6D0($s0)
/* 1899A8 8025B0C8 00021080 */  sll       $v0, $v0, 2
/* 1899AC 8025B0CC 00431021 */  addu      $v0, $v0, $v1
/* 1899B0 8025B0D0 8C430000 */  lw        $v1, 0x0($v0)
/* 1899B4 8025B0D4 00061140 */  sll       $v0, $a2, 5
/* 1899B8 8025B0D8 10600009 */  beqz      $v1, .L8025B100
/* 1899BC 8025B0DC 02022821 */   addu     $a1, $s0, $v0
/* 1899C0 8025B0E0 0000202D */  daddu     $a0, $zero, $zero
.L8025B0E4:
/* 1899C4 8025B0E4 94620000 */  lhu       $v0, 0x0($v1)
/* 1899C8 8025B0E8 24630002 */  addiu     $v1, $v1, 0x2
/* 1899CC 8025B0EC 24840001 */  addiu     $a0, $a0, 0x1
/* 1899D0 8025B0F0 A4A20000 */  sh        $v0, 0x0($a1)
/* 1899D4 8025B0F4 28820010 */  slti      $v0, $a0, 0x10
/* 1899D8 8025B0F8 1440FFFA */  bnez      $v0, .L8025B0E4
/* 1899DC 8025B0FC 24A50002 */   addiu    $a1, $a1, 0x2
.L8025B100:
/* 1899E0 8025B100 24C60001 */  addiu     $a2, $a2, 0x1
/* 1899E4 8025B104 820206CC */  lb        $v0, 0x6CC($s0)
/* 1899E8 8025B108 920306CC */  lbu       $v1, 0x6CC($s0)
/* 1899EC 8025B10C 00C2102A */  slt       $v0, $a2, $v0
D_8025B110:
/* 1899F0 8025B110 5440FFE7 */  bnel      $v0, $zero, .L8025B0B0
/* 1899F4 8025B114 00031E00 */   sll      $v1, $v1, 24
.L8025B118:
/* 1899F8 8025B118 820206CD */  lb        $v0, 0x6CD($s0)
/* 1899FC 8025B11C 1840000A */  blez      $v0, .L8025B148
/* 189A00 8025B120 0000302D */   daddu    $a2, $zero, $zero
/* 189A04 8025B124 0200202D */  daddu     $a0, $s0, $zero
/* 189A08 8025B128 0200182D */  daddu     $v1, $s0, $zero
.L8025B12C:
/* 189A0C 8025B12C AC6406D4 */  sw        $a0, 0x6D4($v1)
/* 189A10 8025B130 24840020 */  addiu     $a0, $a0, 0x20
/* 189A14 8025B134 820206CD */  lb        $v0, 0x6CD($s0)
/* 189A18 8025B138 24C60001 */  addiu     $a2, $a2, 0x1
/* 189A1C 8025B13C 00C2102A */  slt       $v0, $a2, $v0
/* 189A20 8025B140 1440FFFA */  bnez      $v0, .L8025B12C
/* 189A24 8025B144 24630004 */   addiu    $v1, $v1, 0x4
.L8025B148:
/* 189A28 8025B148 16400006 */  bnez      $s2, .L8025B164
/* 189A2C 8025B14C 0220202D */   daddu    $a0, $s1, $zero
/* 189A30 8025B150 0260282D */  daddu     $a1, $s3, $zero
/* 189A34 8025B154 0C096657 */  jal       func_8025995C
/* 189A38 8025B158 0280302D */   daddu    $a2, $s4, $zero
/* 189A3C 8025B15C 08096C5C */  j         .L8025B170
/* 189A40 8025B160 00000000 */   nop
.L8025B164:
/* 189A44 8025B164 0260282D */  daddu     $a1, $s3, $zero
/* 189A48 8025B168 0C0965B0 */  jal       func_802596C0
/* 189A4C 8025B16C 0280302D */   daddu    $a2, $s4, $zero
.L8025B170:
/* 189A50 8025B170 16A00004 */  bnez      $s5, .L8025B184
/* 189A54 8025B174 00000000 */   nop
/* 189A58 8025B178 960206CA */  lhu       $v0, 0x6CA($s0)
/* 189A5C 8025B17C 2442FFFF */  addiu     $v0, $v0, -0x1
/* 189A60 8025B180 A60206CA */  sh        $v0, 0x6CA($s0)
.L8025B184:
/* 189A64 8025B184 8FBF0028 */  lw        $ra, 0x28($sp)
/* 189A68 8025B188 8FB50024 */  lw        $s5, 0x24($sp)
/* 189A6C 8025B18C 8FB40020 */  lw        $s4, 0x20($sp)
/* 189A70 8025B190 8FB3001C */  lw        $s3, 0x1C($sp)
/* 189A74 8025B194 8FB20018 */  lw        $s2, 0x18($sp)
/* 189A78 8025B198 8FB10014 */  lw        $s1, 0x14($sp)
/* 189A7C 8025B19C 8FB00010 */  lw        $s0, 0x10($sp)
/* 189A80 8025B1A0 03E00008 */  jr        $ra
/* 189A84 8025B1A4 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

void render_with_watt_idle_palettes(b32 isNpcSprite, ActorPart* part, s32 yaw, Matrix4f mtx, b32 skipAnimation) {
    DecorationTable* decorationTable = part->decorationTable;
    PAL_PTR palIn;
    PAL_PTR palOut;
    s32 i, j;
    s32 palIdx;
    s32 brightnessLevel;

    if (decorationTable->resetPalAdjust) {
        if (isNpcSprite == SPRITE_MODE_PLAYER) {
            decorationTable->originalPalettesList = spr_get_player_palettes(part->currentAnimation >> 16);
            decorationTable->originalPalettesCount = 0;
            while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) {
                decorationTable->originalPalettesCount++;
            }
            decorationTable->spriteColorVariations = SPR_PLAYER_COLOR_VARIATIONS;
        } else {
            decorationTable->originalPalettesList = spr_get_npc_palettes(part->currentAnimation >> 16);
            decorationTable->originalPalettesCount = 0;
            while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) {
                decorationTable->originalPalettesCount++;
            }
            decorationTable->spriteColorVariations = spr_get_npc_color_variations(part->currentAnimation >> 16);
        }

        for (i = 0; i < decorationTable->originalPalettesCount; i++) {
            palIn = decorationTable->originalPalettesList[i];
            palOut = decorationTable->copiedPalettes[0][i];
            if (palIn != NULL) {
                for (j = 0; j < SPR_PAL_SIZE; j++) {
                    *palOut++ = *palIn++;
                }
            }
        }

        decorationTable->palAnimState = -2;
        decorationTable->palBlendAlpha = 0;
        decorationTable->resetPalAdjust = FALSE;
        decorationTable->nextPalTime = 0;
    }

    if (!skipAnimation) {
        if (decorationTable->nextPalTime == 0) {
            decorationTable->palAnimState += 2;
            if (WattIdlePalettesAnim[decorationTable->palAnimState] == PAL_ANIM_END) {
                decorationTable->palAnimState = 0;
            }
            decorationTable->nextPalTime = WattIdlePalettesAnim[decorationTable->palAnimState + 1] / 2;
        }
        brightnessLevel = WattIdlePalettesAnim[decorationTable->palAnimState];
        decorationTable->nextPalTime--;
    } else {
        //@bug if only called with skipAnimation set, palAnimPos will always be -2 and the array access is OOB
        brightnessLevel = WattIdlePalettesAnim[decorationTable->palAnimState];
    }

    switch (brightnessLevel) {
        case WATT_DEFAULT:
            for (i = 0; i < decorationTable->spriteColorVariations; i++) {
                // use watt's base palettes
                palIn = decorationTable->originalPalettesList[i];
                palOut = decorationTable->copiedPalettes[0][i];
                if (palIn != NULL) {
                    for (j = 0; j < SPR_PAL_SIZE; j++) {
                        *palOut++ = *palIn++;
                    }
                }
            }
            break;
        case WATT_BRIGHTEST:
            for (i = 0; i < decorationTable->spriteColorVariations; i++) {
                // use watt's Brightest palettes
                palIdx = decorationTable->spriteColorVariations * SPR_PAL_BattleWatt_Brightest + i;
                palIn = decorationTable->originalPalettesList[palIdx];
                palOut = decorationTable->copiedPalettes[0][i];
                if (palIn != NULL) {
                    for (j = 0; j < SPR_PAL_SIZE; j++) {
                        *palOut++ = *palIn++;
                    }
                }
            }
            break;
        case WATT_BRIGHTER:
            for (i = 0; i < decorationTable->spriteColorVariations; i++) {
                // use watt's Brighter palettes
                palIdx = decorationTable->spriteColorVariations * SPR_PAL_BattleWatt_Brighter + i;
                palIn = decorationTable->originalPalettesList[palIdx];
                palOut = decorationTable->copiedPalettes[0][i];
                if (palIn != NULL) {
                    for (j = 0; j < SPR_PAL_SIZE; j++) {
                        *palOut++ = *palIn++;
                    }
                }
            }
            break;
    }

    for (i = 0; i < decorationTable->originalPalettesCount; i++) {
        decorationTable->adjustedPalettes[i] = decorationTable->copiedPalettes[0][i];
    }

    if (isNpcSprite == SPRITE_MODE_PLAYER) {
        func_8025995C(part, yaw, mtx);
    } else {
        func_802596C0(part, yaw, mtx);
    }

    if (!skipAnimation) {
        decorationTable->palBlendAlpha--;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel smoke_impact_appendGfx
/* 34EFD4 E003A354 27BDFEF8 */  addiu     $sp, $sp, -0x108
/* 34EFD8 E003A358 AFBE0100 */  sw        $fp, 0x100($sp)
/* 34EFDC E003A35C 0080F02D */  daddu     $fp, $a0, $zero
/* 34EFE0 E003A360 3C07DB06 */  lui       $a3, (0xDB060024 >> 16)
/* 34EFE4 E003A364 34E70024 */  ori       $a3, $a3, (0xDB060024 & 0xFFFF)
/* 34EFE8 E003A368 27A40018 */  addiu     $a0, $sp, 0x18
/* 34EFEC E003A36C AFB200E8 */  sw        $s2, 0xE8($sp)
/* 34EFF0 E003A370 3C120001 */  lui       $s2, (0x11630 >> 16)
/* 34EFF4 E003A374 AFB300EC */  sw        $s3, 0xEC($sp)
/* 34EFF8 E003A378 3C13800A */  lui       $s3, %hi(gMainGfxPos)
/* 34EFFC E003A37C 2673A66C */  addiu     $s3, $s3, %lo(gMainGfxPos)
/* 34F000 E003A380 AFBF0104 */  sw        $ra, 0x104($sp)
/* 34F004 E003A384 AFB700FC */  sw        $s7, 0xFC($sp)
/* 34F008 E003A388 AFB600F8 */  sw        $s6, 0xF8($sp)
/* 34F00C E003A38C AFB500F4 */  sw        $s5, 0xF4($sp)
/* 34F010 E003A390 AFB400F0 */  sw        $s4, 0xF0($sp)
/* 34F014 E003A394 AFB100E4 */  sw        $s1, 0xE4($sp)
/* 34F018 E003A398 AFB000E0 */  sw        $s0, 0xE0($sp)
/* 34F01C E003A39C 8E630000 */  lw        $v1, 0x0($s3)
/* 34F020 E003A3A0 8FD4000C */  lw        $s4, 0xC($fp)
/* 34F024 E003A3A4 0060282D */  daddu     $a1, $v1, $zero
/* 34F028 E003A3A8 24630008 */  addiu     $v1, $v1, 0x8
/* 34F02C E003A3AC AE630000 */  sw        $v1, 0x0($s3)
/* 34F030 E003A3B0 96970000 */  lhu       $s7, 0x0($s4)
/* 34F034 E003A3B4 24620008 */  addiu     $v0, $v1, 0x8
/* 34F038 E003A3B8 AE620000 */  sw        $v0, 0x0($s3)
/* 34F03C E003A3BC C6820030 */  lwc1      $f2, 0x30($s4)
/* 34F040 E003A3C0 00171080 */  sll       $v0, $s7, 2
/* 34F044 E003A3C4 3C09E004 */  lui       $t1, (0xE0040000 >> 16)
/* 34F048 E003A3C8 01224821 */  addu      $t1, $t1, $v0
/* 34F04C E003A3CC 8D29A800 */  lw        $t1, -0x5800($t1)
/* 34F050 E003A3D0 36521630 */  ori       $s2, $s2, (0x11630 & 0xFFFF)
/* 34F054 E003A3D4 AFA900D8 */  sw        $t1, 0xD8($sp)
/* 34F058 E003A3D8 3C06E004 */  lui       $a2, (0xE0040000 >> 16)
/* 34F05C E003A3DC 00C23021 */  addu      $a2, $a2, $v0
/* 34F060 E003A3E0 8CC6A80C */  lw        $a2, -0x57F4($a2)
/* 34F064 E003A3E4 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 34F068 E003A3E8 4600110D */  trunc.w.s $f4, $f2
/* 34F06C E003A3EC 44152000 */  mfc1      $s5, $f4
/* 34F070 E003A3F0 00000000 */  nop
/* 34F074 E003A3F4 44950000 */  mtc1      $s5, $f0
/* 34F078 E003A3F8 00000000 */  nop
/* 34F07C E003A3FC 46800020 */  cvt.s.w   $f0, $f0
/* 34F080 E003A400 46001081 */  sub.s     $f2, $f2, $f0
/* 34F084 E003A404 ACA20000 */  sw        $v0, 0x0($a1)
/* 34F088 E003A408 ACA00004 */  sw        $zero, 0x4($a1)
/* 34F08C E003A40C AC670000 */  sw        $a3, 0x0($v1)
/* 34F090 E003A410 8FC50010 */  lw        $a1, 0x10($fp)
/* 34F094 E003A414 3C014380 */  lui       $at, (0x43800000 >> 16)
/* 34F098 E003A418 44810000 */  mtc1      $at, $f0
/* 34F09C E003A41C 24620010 */  addiu     $v0, $v1, 0x10
/* 34F0A0 E003A420 AE620000 */  sw        $v0, 0x0($s3)
/* 34F0A4 E003A424 8CA5001C */  lw        $a1, 0x1C($a1)
/* 34F0A8 E003A428 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 34F0AC E003A42C AC620008 */  sw        $v0, 0x8($v1)
/* 34F0B0 E003A430 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 34F0B4 E003A434 AC66000C */  sw        $a2, 0xC($v1)
/* 34F0B8 E003A438 00A22821 */  addu      $a1, $a1, $v0
/* 34F0BC E003A43C 3AA20007 */  xori      $v0, $s5, 0x7
/* 34F0C0 E003A440 46001082 */  mul.s     $f2, $f2, $f0
/* 34F0C4 E003A444 00000000 */  nop
/* 34F0C8 E003A448 AC650004 */  sw        $a1, 0x4($v1)
/* 34F0CC E003A44C 8E850004 */  lw        $a1, 0x4($s4)
/* 34F0D0 E003A450 8E860008 */  lw        $a2, 0x8($s4)
/* 34F0D4 E003A454 8E87000C */  lw        $a3, 0xC($s4)
/* 34F0D8 E003A458 2C420001 */  sltiu     $v0, $v0, 0x1
/* 34F0DC E003A45C 4600110D */  trunc.w.s $f4, $f2
/* 34F0E0 E003A460 44162000 */  mfc1      $s6, $f4
/* 34F0E4 E003A464 0C080108 */  jal       shim_guTranslateF
/* 34F0E8 E003A468 AFA200DC */   sw       $v0, 0xDC($sp)
/* 34F0EC E003A46C 27B00058 */  addiu     $s0, $sp, 0x58
/* 34F0F0 E003A470 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 34F0F4 E003A474 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 34F0F8 E003A478 44800000 */  mtc1      $zero, $f0
/* 34F0FC E003A47C 00031080 */  sll       $v0, $v1, 2
/* 34F100 E003A480 00431021 */  addu      $v0, $v0, $v1
/* 34F104 E003A484 00021080 */  sll       $v0, $v0, 2
/* 34F108 E003A488 00431023 */  subu      $v0, $v0, $v1
/* 34F10C E003A48C 000218C0 */  sll       $v1, $v0, 3
/* 34F110 E003A490 00431021 */  addu      $v0, $v0, $v1
/* 34F114 E003A494 000210C0 */  sll       $v0, $v0, 3
/* 34F118 E003A498 44060000 */  mfc1      $a2, $f0
/* 34F11C E003A49C 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 34F120 E003A4A0 00220821 */  addu      $at, $at, $v0
/* 34F124 E003A4A4 C4201DEC */  lwc1      $f0, %lo(gCameras + 0x6C)($at)
/* 34F128 E003A4A8 3C073F80 */  lui       $a3, (0x3F800000 >> 16)
/* 34F12C E003A4AC 46000007 */  neg.s     $f0, $f0
/* 34F130 E003A4B0 44050000 */  mfc1      $a1, $f0
/* 34F134 E003A4B4 0200202D */  daddu     $a0, $s0, $zero
/* 34F138 E003A4B8 0C080104 */  jal       shim_guRotateF
/* 34F13C E003A4BC AFA60010 */   sw       $a2, 0x10($sp)
/* 34F140 E003A4C0 0200202D */  daddu     $a0, $s0, $zero
/* 34F144 E003A4C4 27A50018 */  addiu     $a1, $sp, 0x18
/* 34F148 E003A4C8 27B00098 */  addiu     $s0, $sp, 0x98
/* 34F14C E003A4CC 0C080114 */  jal       shim_guMtxCatF
/* 34F150 E003A4D0 0200302D */   daddu    $a2, $s0, $zero
/* 34F154 E003A4D4 0200202D */  daddu     $a0, $s0, $zero
/* 34F158 E003A4D8 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* 34F15C E003A4DC 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* 34F160 E003A4E0 3C11800A */  lui       $s1, %hi(gDisplayContext)
/* 34F164 E003A4E4 2631A674 */  addiu     $s1, $s1, %lo(gDisplayContext)
/* 34F168 E003A4E8 96050000 */  lhu       $a1, 0x0($s0)
/* 34F16C E003A4EC 8E220000 */  lw        $v0, 0x0($s1)
/* 34F170 E003A4F0 00052980 */  sll       $a1, $a1, 6
/* 34F174 E003A4F4 00B22821 */  addu      $a1, $a1, $s2
/* 34F178 E003A4F8 0C080118 */  jal       shim_guMtxF2L
/* 34F17C E003A4FC 00452821 */   addu     $a1, $v0, $a1
/* 34F180 E003A500 8E650000 */  lw        $a1, 0x0($s3)
/* 34F184 E003A504 00A0202D */  daddu     $a0, $a1, $zero
/* 34F188 E003A508 24A50008 */  addiu     $a1, $a1, 0x8
/* 34F18C E003A50C AE650000 */  sw        $a1, 0x0($s3)
/* 34F190 E003A510 96020000 */  lhu       $v0, 0x0($s0)
/* 34F194 E003A514 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 34F198 E003A518 AC830000 */  sw        $v1, 0x0($a0)
/* 34F19C E003A51C 24430001 */  addiu     $v1, $v0, 0x1
/* 34F1A0 E003A520 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 34F1A4 E003A524 00021180 */  sll       $v0, $v0, 6
/* 34F1A8 E003A528 A6030000 */  sh        $v1, 0x0($s0)
/* 34F1AC E003A52C 8E230000 */  lw        $v1, 0x0($s1)
/* 34F1B0 E003A530 00521021 */  addu      $v0, $v0, $s2
/* 34F1B4 E003A534 00621821 */  addu      $v1, $v1, $v0
/* 34F1B8 E003A538 2AE20002 */  slti      $v0, $s7, 0x2
/* 34F1BC E003A53C 10400009 */  beqz      $v0, .LE003A564
/* 34F1C0 E003A540 AC830004 */   sw       $v1, 0x4($a0)
/* 34F1C4 E003A544 3C02E6DE */  lui       $v0, (0xE6DEDE82 >> 16)
/* 34F1C8 E003A548 3442DE82 */  ori       $v0, $v0, (0xE6DEDE82 & 0xFFFF)
/* 34F1CC E003A54C 24A30008 */  addiu     $v1, $a1, 0x8
/* 34F1D0 E003A550 AE630000 */  sw        $v1, 0x0($s3)
/* 34F1D4 E003A554 3C03FA00 */  lui       $v1, (0xFA000000 >> 16)
/* 34F1D8 E003A558 ACA30000 */  sw        $v1, 0x0($a1)
/* 34F1DC E003A55C 0800E967 */  j         .LE003A59C
/* 34F1E0 E003A560 ACA20004 */   sw       $v0, 0x4($a1)
.LE003A564:
/* 34F1E4 E003A564 3C03FF28 */  lui       $v1, (0xFF280AA0 >> 16)
/* 34F1E8 E003A568 34630AA0 */  ori       $v1, $v1, (0xFF280AA0 & 0xFFFF)
/* 34F1EC E003A56C 3C04E200 */  lui       $a0, (0xE2001E01 >> 16)
/* 34F1F0 E003A570 34841E01 */  ori       $a0, $a0, (0xE2001E01 & 0xFFFF)
/* 34F1F4 E003A574 24A20008 */  addiu     $v0, $a1, 0x8
/* 34F1F8 E003A578 AE620000 */  sw        $v0, 0x0($s3)
/* 34F1FC E003A57C 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 34F200 E003A580 ACA20000 */  sw        $v0, 0x0($a1)
/* 34F204 E003A584 24A20010 */  addiu     $v0, $a1, 0x10
/* 34F208 E003A588 ACA30004 */  sw        $v1, 0x4($a1)
/* 34F20C E003A58C AE620000 */  sw        $v0, 0x0($s3)
/* 34F210 E003A590 24020003 */  addiu     $v0, $zero, 0x3
/* 34F214 E003A594 ACA40008 */  sw        $a0, 0x8($a1)
/* 34F218 E003A598 ACA2000C */  sw        $v0, 0xC($a1)
.LE003A59C:
/* 34F21C E003A59C 3C08800A */  lui       $t0, %hi(gMainGfxPos)
/* 34F220 E003A5A0 2508A66C */  addiu     $t0, $t0, %lo(gMainGfxPos)
/* 34F224 E003A5A4 3C02FB00 */  lui       $v0, (0xFB000000 >> 16)
/* 34F228 E003A5A8 3C04F200 */  lui       $a0, (0xF2000080 >> 16)
/* 34F22C E003A5AC 8D050000 */  lw        $a1, 0x0($t0)
/* 34F230 E003A5B0 00153940 */  sll       $a3, $s5, 5
/* 34F234 E003A5B4 00A0182D */  daddu     $v1, $a1, $zero
/* 34F238 E003A5B8 24A50008 */  addiu     $a1, $a1, 0x8
/* 34F23C E003A5BC AD050000 */  sw        $a1, 0x0($t0)
/* 34F240 E003A5C0 AC620000 */  sw        $v0, 0x0($v1)
/* 34F244 E003A5C4 32C200FF */  andi      $v0, $s6, 0xFF
/* 34F248 E003A5C8 AC620004 */  sw        $v0, 0x4($v1)
/* 34F24C E003A5CC 24A20008 */  addiu     $v0, $a1, 0x8
/* 34F250 E003A5D0 AD020000 */  sw        $v0, 0x0($t0)
/* 34F254 E003A5D4 001511C0 */  sll       $v0, $s5, 7
/* 34F258 E003A5D8 30420FFF */  andi      $v0, $v0, 0xFFF
/* 34F25C E003A5DC 00021300 */  sll       $v0, $v0, 12
/* 34F260 E003A5E0 00441025 */  or        $v0, $v0, $a0
/* 34F264 E003A5E4 ACA20000 */  sw        $v0, 0x0($a1)
/* 34F268 E003A5E8 24E20020 */  addiu     $v0, $a3, 0x20
/* 34F26C E003A5EC 00021080 */  sll       $v0, $v0, 2
/* 34F270 E003A5F0 30420FFF */  andi      $v0, $v0, 0xFFF
/* 34F274 E003A5F4 00023300 */  sll       $a2, $v0, 12
/* 34F278 E003A5F8 34C20080 */  ori       $v0, $a2, 0x80
/* 34F27C E003A5FC ACA20004 */  sw        $v0, 0x4($a1)
/* 34F280 E003A600 8FA900DC */  lw        $t1, 0xDC($sp)
/* 34F284 E003A604 1120000E */  beqz      $t1, .LE003A640
/* 34F288 E003A608 0080182D */   daddu    $v1, $a0, $zero
/* 34F28C E003A60C 34630080 */  ori       $v1, $v1, (0xF2000080 & 0xFFFF)
/* 34F290 E003A610 3C040100 */  lui       $a0, (0x1000100 >> 16)
/* 34F294 E003A614 34840100 */  ori       $a0, $a0, (0x1000100 & 0xFFFF)
/* 34F298 E003A618 24A20010 */  addiu     $v0, $a1, 0x10
/* 34F29C E003A61C 00C31825 */  or        $v1, $a2, $v1
/* 34F2A0 E003A620 AD020000 */  sw        $v0, 0x0($t0)
/* 34F2A4 E003A624 24E20040 */  addiu     $v0, $a3, 0x40
/* 34F2A8 E003A628 00021080 */  sll       $v0, $v0, 2
/* 34F2AC E003A62C 30420FFF */  andi      $v0, $v0, 0xFFF
/* 34F2B0 E003A630 00021300 */  sll       $v0, $v0, 12
/* 34F2B4 E003A634 00441025 */  or        $v0, $v0, $a0
/* 34F2B8 E003A638 0800E99B */  j         .LE003A66C
/* 34F2BC E003A63C ACA30008 */   sw       $v1, 0x8($a1)
.LE003A640:
/* 34F2C0 E003A640 3C030100 */  lui       $v1, (0x1000080 >> 16)
/* 34F2C4 E003A644 34630080 */  ori       $v1, $v1, (0x1000080 & 0xFFFF)
/* 34F2C8 E003A648 24A20010 */  addiu     $v0, $a1, 0x10
/* 34F2CC E003A64C AD020000 */  sw        $v0, 0x0($t0)
/* 34F2D0 E003A650 00C41025 */  or        $v0, $a2, $a0
/* 34F2D4 E003A654 ACA20008 */  sw        $v0, 0x8($a1)
/* 34F2D8 E003A658 24E20040 */  addiu     $v0, $a3, 0x40
/* 34F2DC E003A65C 00021080 */  sll       $v0, $v0, 2
/* 34F2E0 E003A660 30420FFF */  andi      $v0, $v0, 0xFFF
/* 34F2E4 E003A664 00021300 */  sll       $v0, $v0, 12
/* 34F2E8 E003A668 00431025 */  or        $v0, $v0, $v1
.LE003A66C:
/* 34F2EC E003A66C ACA2000C */  sw        $v0, 0xC($a1)
/* 34F2F0 E003A670 8FC20008 */  lw        $v0, 0x8($fp)
/* 34F2F4 E003A674 24110001 */  addiu     $s1, $zero, 0x1
/* 34F2F8 E003A678 0222102A */  slt       $v0, $s1, $v0
/* 34F2FC E003A67C 10400037 */  beqz      $v0, .LE003A75C
/* 34F300 E003A680 26940034 */   addiu    $s4, $s4, 0x34
/* 34F304 E003A684 3C16800A */  lui       $s6, %hi(gDisplayContext)
/* 34F308 E003A688 26D6A674 */  addiu     $s6, $s6, %lo(gDisplayContext)
/* 34F30C E003A68C 3C158007 */  lui       $s5, %hi(gMatrixListPos)
/* 34F310 E003A690 26B541F0 */  addiu     $s5, $s5, %lo(gMatrixListPos)
/* 34F314 E003A694 3C130001 */  lui       $s3, (0x11630 >> 16)
/* 34F318 E003A698 36731630 */  ori       $s3, $s3, (0x11630 & 0xFFFF)
/* 34F31C E003A69C 3C12800A */  lui       $s2, %hi(gMainGfxPos)
/* 34F320 E003A6A0 2652A66C */  addiu     $s2, $s2, %lo(gMainGfxPos)
/* 34F324 E003A6A4 2690000C */  addiu     $s0, $s4, 0xC
.LE003A6A8:
/* 34F328 E003A6A8 27A40018 */  addiu     $a0, $sp, 0x18
/* 34F32C E003A6AC 26310001 */  addiu     $s1, $s1, 0x1
/* 34F330 E003A6B0 8E05FFF8 */  lw        $a1, -0x8($s0)
/* 34F334 E003A6B4 8E06FFFC */  lw        $a2, -0x4($s0)
/* 34F338 E003A6B8 8E070000 */  lw        $a3, 0x0($s0)
/* 34F33C E003A6BC 0C080108 */  jal       shim_guTranslateF
/* 34F340 E003A6C0 26100034 */   addiu    $s0, $s0, 0x34
/* 34F344 E003A6C4 27A40018 */  addiu     $a0, $sp, 0x18
/* 34F348 E003A6C8 96A50000 */  lhu       $a1, 0x0($s5)
/* 34F34C E003A6CC 8EC20000 */  lw        $v0, 0x0($s6)
/* 34F350 E003A6D0 00052980 */  sll       $a1, $a1, 6
/* 34F354 E003A6D4 00B32821 */  addu      $a1, $a1, $s3
/* 34F358 E003A6D8 0C080118 */  jal       shim_guMtxF2L
/* 34F35C E003A6DC 00452821 */   addu     $a1, $v0, $a1
/* 34F360 E003A6E0 3C06D838 */  lui       $a2, (0xD8380002 >> 16)
/* 34F364 E003A6E4 8E440000 */  lw        $a0, 0x0($s2)
/* 34F368 E003A6E8 34C60002 */  ori       $a2, $a2, (0xD8380002 & 0xFFFF)
/* 34F36C E003A6EC 0080282D */  daddu     $a1, $a0, $zero
/* 34F370 E003A6F0 24840008 */  addiu     $a0, $a0, 0x8
/* 34F374 E003A6F4 AE440000 */  sw        $a0, 0x0($s2)
/* 34F378 E003A6F8 96A20000 */  lhu       $v0, 0x0($s5)
/* 34F37C E003A6FC 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 34F380 E003A700 ACA30000 */  sw        $v1, 0x0($a1)
/* 34F384 E003A704 24430001 */  addiu     $v1, $v0, 0x1
/* 34F388 E003A708 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 34F38C E003A70C 00021180 */  sll       $v0, $v0, 6
/* 34F390 E003A710 A6A30000 */  sh        $v1, 0x0($s5)
/* 34F394 E003A714 8EC30000 */  lw        $v1, 0x0($s6)
/* 34F398 E003A718 00531021 */  addu      $v0, $v0, $s3
/* 34F39C E003A71C 00621821 */  addu      $v1, $v1, $v0
/* 34F3A0 E003A720 24820008 */  addiu     $v0, $a0, 0x8
/* 34F3A4 E003A724 ACA30004 */  sw        $v1, 0x4($a1)
/* 34F3A8 E003A728 AE420000 */  sw        $v0, 0x0($s2)
/* 34F3AC E003A72C 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 34F3B0 E003A730 AC820000 */  sw        $v0, 0x0($a0)
/* 34F3B4 E003A734 8FA900D8 */  lw        $t1, 0xD8($sp)
/* 34F3B8 E003A738 24020040 */  addiu     $v0, $zero, 0x40
/* 34F3BC E003A73C AC860008 */  sw        $a2, 0x8($a0)
/* 34F3C0 E003A740 AC82000C */  sw        $v0, 0xC($a0)
/* 34F3C4 E003A744 AC890004 */  sw        $t1, 0x4($a0)
/* 34F3C8 E003A748 8FC20008 */  lw        $v0, 0x8($fp)
/* 34F3CC E003A74C 24840010 */  addiu     $a0, $a0, 0x10
/* 34F3D0 E003A750 0222102A */  slt       $v0, $s1, $v0
/* 34F3D4 E003A754 1440FFD4 */  bnez      $v0, .LE003A6A8
/* 34F3D8 E003A758 AE440000 */   sw       $a0, 0x0($s2)
.LE003A75C:
/* 34F3DC E003A75C 3C02D838 */  lui       $v0, (0xD8380002 >> 16)
/* 34F3E0 E003A760 3C05800A */  lui       $a1, %hi(gMainGfxPos)
/* 34F3E4 E003A764 24A5A66C */  addiu     $a1, $a1, %lo(gMainGfxPos)
/* 34F3E8 E003A768 8CA40000 */  lw        $a0, 0x0($a1)
/* 34F3EC E003A76C 34420002 */  ori       $v0, $v0, (0xD8380002 & 0xFFFF)
/* 34F3F0 E003A770 0080182D */  daddu     $v1, $a0, $zero
/* 34F3F4 E003A774 24840008 */  addiu     $a0, $a0, 0x8
/* 34F3F8 E003A778 ACA40000 */  sw        $a0, 0x0($a1)
/* 34F3FC E003A77C AC620000 */  sw        $v0, 0x0($v1)
/* 34F400 E003A780 24020040 */  addiu     $v0, $zero, 0x40
/* 34F404 E003A784 AC620004 */  sw        $v0, 0x4($v1)
/* 34F408 E003A788 24020002 */  addiu     $v0, $zero, 0x2
/* 34F40C E003A78C 16E20006 */  bne       $s7, $v0, .LE003A7A8
/* 34F410 E003A790 3C03E200 */   lui      $v1, (0xE2001E01 >> 16)
/* 34F414 E003A794 34631E01 */  ori       $v1, $v1, (0xE2001E01 & 0xFFFF)
/* 34F418 E003A798 24820008 */  addiu     $v0, $a0, 0x8
/* 34F41C E003A79C ACA20000 */  sw        $v0, 0x0($a1)
/* 34F420 E003A7A0 AC830000 */  sw        $v1, 0x0($a0)
/* 34F424 E003A7A4 AC800004 */  sw        $zero, 0x4($a0)
.LE003A7A8:
/* 34F428 E003A7A8 8CA20000 */  lw        $v0, 0x0($a1)
/* 34F42C E003A7AC 0040182D */  daddu     $v1, $v0, $zero
/* 34F430 E003A7B0 24420008 */  addiu     $v0, $v0, 0x8
/* 34F434 E003A7B4 ACA20000 */  sw        $v0, 0x0($a1)
/* 34F438 E003A7B8 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 34F43C E003A7BC AC620000 */  sw        $v0, 0x0($v1)
/* 34F440 E003A7C0 AC600004 */  sw        $zero, 0x4($v1)
/* 34F444 E003A7C4 8FBF0104 */  lw        $ra, 0x104($sp)
/* 34F448 E003A7C8 8FBE0100 */  lw        $fp, 0x100($sp)
/* 34F44C E003A7CC 8FB700FC */  lw        $s7, 0xFC($sp)
/* 34F450 E003A7D0 8FB600F8 */  lw        $s6, 0xF8($sp)
/* 34F454 E003A7D4 8FB500F4 */  lw        $s5, 0xF4($sp)
/* 34F458 E003A7D8 8FB400F0 */  lw        $s4, 0xF0($sp)
/* 34F45C E003A7DC 8FB300EC */  lw        $s3, 0xEC($sp)
/* 34F460 E003A7E0 8FB200E8 */  lw        $s2, 0xE8($sp)
/* 34F464 E003A7E4 8FB100E4 */  lw        $s1, 0xE4($sp)
/* 34F468 E003A7E8 8FB000E0 */  lw        $s0, 0xE0($sp)
/* 34F46C E003A7EC 03E00008 */  jr        $ra
/* 34F470 E003A7F0 27BD0108 */   addiu    $sp, $sp, 0x108
/* 34F474 E003A7F4 00000000 */  nop
/* 34F478 E003A7F8 00000000 */  nop
/* 34F47C E003A7FC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void smoke_impact_appendGfx(void* effect) {
    SmokeImpactFXData* part = ((EffectInstance*)effect)->data.smokeImpact;
    s32 unk_00 = part->unk_00;
    f32 unk_30 = part->unk_30;
    s32 unk_30_s32 = unk_30;
    s32 envAlpha = (unk_30 - unk_30_s32) * 256.0f;
    Gfx* dlist = D_E003A800[unk_00];
    Gfx* dlist2 = D_E003A80C[unk_00];
    s32 cond = (unk_30_s32 == 7);
    Matrix4f sp18;
    Matrix4f sp58;
    Matrix4f sp98;
    s32 i;

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

    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);
    shim_guMtxF2L(sp98, &gDisplayContext->matrixStack[gMatrixListPos]);

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

    if (unk_00 < 2) {
        gDPSetPrimColor(gMainGfxPos++, 0, 0, 230, 222, 222, 130);
    } else {
        gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 40, 10, 160);
        gDPSetAlphaCompare(gMainGfxPos++, G_AC_DITHER);
    }

    gDPSetEnvColor(gMainGfxPos++, 0, 0, 0, envAlpha);
    gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE,
        (unk_30_s32 * 32     ) * 4, 0,
        (unk_30_s32 * 32 + 32) * 4, 32 * 4);

    if (cond) {
        gDPSetTileSize(gMainGfxPos++, 1,
            (unk_30_s32 * 32 + 32) * 4, 32 * 4,
            (unk_30_s32 * 32 + 64) * 4, 64 * 4);
    } else {
        gDPSetTileSize(gMainGfxPos++, 1,
            (unk_30_s32 * 32 + 32) * 4, 0,
            (unk_30_s32 * 32 + 64) * 4, 32 * 4);
    }

    part++;
    for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) {
        shim_guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C);
        shim_guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);

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

    gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);

    if (unk_00 == 2) {
        gDPSetAlphaCompare(gMainGfxPos++, G_AC_NONE);
    }

    gDPPipeSync(gMainGfxPos++);
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_8025B1A8
/* 189A88 8025B1A8 27BDFFD0 */  addiu     $sp, $sp, -0x30
/* 189A8C 8025B1AC AFB20018 */  sw        $s2, 0x18($sp)
/* 189A90 8025B1B0 0080902D */  daddu     $s2, $a0, $zero
/* 189A94 8025B1B4 AFB10014 */  sw        $s1, 0x14($sp)
/* 189A98 8025B1B8 00A0882D */  daddu     $s1, $a1, $zero
/* 189A9C 8025B1BC AFB3001C */  sw        $s3, 0x1C($sp)
/* 189AA0 8025B1C0 00C0982D */  daddu     $s3, $a2, $zero
/* 189AA4 8025B1C4 AFBF0028 */  sw        $ra, 0x28($sp)
/* 189AA8 8025B1C8 AFB50024 */  sw        $s5, 0x24($sp)
/* 189AAC 8025B1CC AFB40020 */  sw        $s4, 0x20($sp)
/* 189AB0 8025B1D0 AFB00010 */  sw        $s0, 0x10($sp)
/* 189AB4 8025B1D4 8E3000C0 */  lw        $s0, 0xC0($s1)
/* 189AB8 8025B1D8 820206C1 */  lb        $v0, 0x6C1($s0)
/* 189ABC 8025B1DC 8FB50040 */  lw        $s5, 0x40($sp)
/* 189AC0 8025B1E0 1040004B */  beqz      $v0, .L8025B310
/* 189AC4 8025B1E4 00E0A02D */   daddu    $s4, $a3, $zero
/* 189AC8 8025B1E8 16400016 */  bnez      $s2, .L8025B244
/* 189ACC 8025B1EC 00000000 */   nop
/* 189AD0 8025B1F0 0C0B7830 */  jal       spr_get_player_palettes
/* 189AD4 8025B1F4 96240088 */   lhu      $a0, 0x88($s1)
/* 189AD8 8025B1F8 AE0206D0 */  sw        $v0, 0x6D0($s0)
/* 189ADC 8025B1FC 0040202D */  daddu     $a0, $v0, $zero
/* 189AE0 8025B200 A20006CD */  sb        $zero, 0x6CD($s0)
/* 189AE4 8025B204 8C830000 */  lw        $v1, 0x0($a0)
/* 189AE8 8025B208 2402FFFF */  addiu     $v0, $zero, -0x1
/* 189AEC 8025B20C 1062000B */  beq       $v1, $v0, .L8025B23C
/* 189AF0 8025B210 0080182D */   daddu    $v1, $a0, $zero
/* 189AF4 8025B214 0040202D */  daddu     $a0, $v0, $zero
.L8025B218:
/* 189AF8 8025B218 920206CD */  lbu       $v0, 0x6CD($s0)
/* 189AFC 8025B21C 24420001 */  addiu     $v0, $v0, 0x1
/* 189B00 8025B220 A20206CD */  sb        $v0, 0x6CD($s0)
/* 189B04 8025B224 00021600 */  sll       $v0, $v0, 24
/* 189B08 8025B228 00021583 */  sra       $v0, $v0, 22
/* 189B0C 8025B22C 00431021 */  addu      $v0, $v0, $v1
/* 189B10 8025B230 8C420000 */  lw        $v0, 0x0($v0)
/* 189B14 8025B234 1444FFF8 */  bne       $v0, $a0, .L8025B218
/* 189B18 8025B238 00000000 */   nop
.L8025B23C:
/* 189B1C 8025B23C 08096CA7 */  j         .L8025B29C
/* 189B20 8025B240 24020006 */   addiu    $v0, $zero, 0x6
.L8025B244:
/* 189B24 8025B244 96240088 */  lhu       $a0, 0x88($s1)
/* 189B28 8025B248 0C0B7A90 */  jal       spr_get_npc_palettes
/* 189B2C 8025B24C 00000000 */   nop
D_8025B250:
/* 189B30 8025B250 AE0206D0 */  sw        $v0, 0x6D0($s0)
/* 189B34 8025B254 0040202D */  daddu     $a0, $v0, $zero
/* 189B38 8025B258 A20006CD */  sb        $zero, 0x6CD($s0)
/* 189B3C 8025B25C 8C830000 */  lw        $v1, 0x0($a0)
/* 189B40 8025B260 2402FFFF */  addiu     $v0, $zero, -0x1
/* 189B44 8025B264 1062000B */  beq       $v1, $v0, .L8025B294
/* 189B48 8025B268 0080182D */   daddu    $v1, $a0, $zero
/* 189B4C 8025B26C 0040202D */  daddu     $a0, $v0, $zero
.L8025B270:
/* 189B50 8025B270 920206CD */  lbu       $v0, 0x6CD($s0)
/* 189B54 8025B274 24420001 */  addiu     $v0, $v0, 0x1
/* 189B58 8025B278 A20206CD */  sb        $v0, 0x6CD($s0)
/* 189B5C 8025B27C 00021600 */  sll       $v0, $v0, 24
/* 189B60 8025B280 00021583 */  sra       $v0, $v0, 22
/* 189B64 8025B284 00431021 */  addu      $v0, $v0, $v1
/* 189B68 8025B288 8C420000 */  lw        $v0, 0x0($v0)
/* 189B6C 8025B28C 1444FFF8 */  bne       $v0, $a0, .L8025B270
/* 189B70 8025B290 00000000 */   nop
.L8025B294:
/* 189B74 8025B294 0C0B7A9B */  jal       spr_get_npc_color_variations
/* 189B78 8025B298 96240088 */   lhu      $a0, 0x88($s1)
.L8025B29C:
/* 189B7C 8025B29C A20206CC */  sb        $v0, 0x6CC($s0)
/* 189B80 8025B2A0 820206CD */  lb        $v0, 0x6CD($s0)
/* 189B84 8025B2A4 18400015 */  blez      $v0, .L8025B2FC
D_8025B2A8:
/* 189B88 8025B2A8 0000302D */   daddu    $a2, $zero, $zero
D_8025B2AC:
/* 189B8C 8025B2AC 8E0206D0 */  lw        $v0, 0x6D0($s0)
D_8025B2B0:
/* 189B90 8025B2B0 00061880 */  sll       $v1, $a2, 2
/* 189B94 8025B2B4 00621821 */  addu      $v1, $v1, $v0
/* 189B98 8025B2B8 00061140 */  sll       $v0, $a2, 5
/* 189B9C 8025B2BC 8C630000 */  lw        $v1, 0x0($v1)
/* 189BA0 8025B2C0 10600009 */  beqz      $v1, .L8025B2E8
/* 189BA4 8025B2C4 02022821 */   addu     $a1, $s0, $v0
/* 189BA8 8025B2C8 0000202D */  daddu     $a0, $zero, $zero
.L8025B2CC:
/* 189BAC 8025B2CC 94620000 */  lhu       $v0, 0x0($v1)
/* 189BB0 8025B2D0 24630002 */  addiu     $v1, $v1, 0x2
/* 189BB4 8025B2D4 24840001 */  addiu     $a0, $a0, 0x1
/* 189BB8 8025B2D8 A4A20000 */  sh        $v0, 0x0($a1)
/* 189BBC 8025B2DC 28820010 */  slti      $v0, $a0, 0x10
/* 189BC0 8025B2E0 1440FFFA */  bnez      $v0, .L8025B2CC
/* 189BC4 8025B2E4 24A50002 */   addiu    $a1, $a1, 0x2
.L8025B2E8:
/* 189BC8 8025B2E8 820206CD */  lb        $v0, 0x6CD($s0)
/* 189BCC 8025B2EC 24C60001 */  addiu     $a2, $a2, 0x1
/* 189BD0 8025B2F0 00C2102A */  slt       $v0, $a2, $v0
/* 189BD4 8025B2F4 1440FFED */  bnez      $v0, D_8025B2AC
/* 189BD8 8025B2F8 00000000 */   nop
.L8025B2FC:
/* 189BDC 8025B2FC 2402FFFE */  addiu     $v0, $zero, -0x2
/* 189BE0 8025B300 A20206C2 */  sb        $v0, 0x6C2($s0)
/* 189BE4 8025B304 A60006CA */  sh        $zero, 0x6CA($s0)
/* 189BE8 8025B308 A20006C1 */  sb        $zero, 0x6C1($s0)
/* 189BEC 8025B30C A60006C8 */  sh        $zero, 0x6C8($s0)
.L8025B310:
/* 189BF0 8025B310 16A0001E */  bnez      $s5, .L8025B38C
/* 189BF4 8025B314 00000000 */   nop
/* 189BF8 8025B318 860206C8 */  lh        $v0, 0x6C8($s0)
/* 189BFC 8025B31C 14400013 */  bnez      $v0, .L8025B36C
/* 189C00 8025B320 00000000 */   nop
/* 189C04 8025B324 920206C2 */  lbu       $v0, 0x6C2($s0)
/* 189C08 8025B328 3C048028 */  lui       $a0, %hi(D_80284120)
/* 189C0C 8025B32C 24844120 */  addiu     $a0, $a0, %lo(D_80284120)
/* 189C10 8025B330 24420002 */  addiu     $v0, $v0, 0x2
/* 189C14 8025B334 A20206C2 */  sb        $v0, 0x6C2($s0)
/* 189C18 8025B338 00021600 */  sll       $v0, $v0, 24
/* 189C1C 8025B33C 00021603 */  sra       $v0, $v0, 24
/* 189C20 8025B340 3C038028 */  lui       $v1, %hi(D_80284120)
/* 189C24 8025B344 00621821 */  addu      $v1, $v1, $v0
/* 189C28 8025B348 90634120 */  lbu       $v1, %lo(D_80284120)($v1)
/* 189C2C 8025B34C 240200FF */  addiu     $v0, $zero, 0xFF
/* 189C30 8025B350 50620001 */  beql      $v1, $v0, .L8025B358
/* 189C34 8025B354 A20006C2 */   sb       $zero, 0x6C2($s0)
.L8025B358:
/* 189C38 8025B358 820206C2 */  lb        $v0, 0x6C2($s0)
/* 189C3C 8025B35C 00441021 */  addu      $v0, $v0, $a0
/* 189C40 8025B360 90420001 */  lbu       $v0, 0x1($v0)
/* 189C44 8025B364 00021042 */  srl       $v0, $v0, 1
/* 189C48 8025B368 A60206C8 */  sh        $v0, 0x6C8($s0)
.L8025B36C:
/* 189C4C 8025B36C 820306C2 */  lb        $v1, 0x6C2($s0)
/* 189C50 8025B370 960206C8 */  lhu       $v0, 0x6C8($s0)
/* 189C54 8025B374 3C018028 */  lui       $at, %hi(D_80284120)
/* 189C58 8025B378 00230821 */  addu      $at, $at, $v1
/* 189C5C 8025B37C 90234120 */  lbu       $v1, %lo(D_80284120)($at)
/* 189C60 8025B380 2442FFFF */  addiu     $v0, $v0, -0x1
/* 189C64 8025B384 08096CE7 */  j         .L8025B39C
/* 189C68 8025B388 A60206C8 */   sh       $v0, 0x6C8($s0)
.L8025B38C:
/* 189C6C 8025B38C 820206C2 */  lb        $v0, 0x6C2($s0)
/* 189C70 8025B390 3C038028 */  lui       $v1, %hi(D_80284120)
/* 189C74 8025B394 00621821 */  addu      $v1, $v1, $v0
/* 189C78 8025B398 90634120 */  lbu       $v1, %lo(D_80284120)($v1)
.L8025B39C:
/* 189C7C 8025B39C 24020001 */  addiu     $v0, $zero, 0x1
/* 189C80 8025B3A0 10620024 */  beq       $v1, $v0, .L8025B434
/* 189C84 8025B3A4 28620002 */   slti     $v0, $v1, 0x2
/* 189C88 8025B3A8 10400005 */  beqz      $v0, .L8025B3C0
/* 189C8C 8025B3AC 24020002 */   addiu    $v0, $zero, 0x2
/* 189C90 8025B3B0 10600007 */  beqz      $v1, .L8025B3D0
/* 189C94 8025B3B4 00000000 */   nop
/* 189C98 8025B3B8 08096D4C */  j         .L8025B530
/* 189C9C 8025B3BC 00000000 */   nop
.L8025B3C0:
/* 189CA0 8025B3C0 1062003C */  beq       $v1, $v0, .L8025B4B4
/* 189CA4 8025B3C4 00000000 */   nop
/* 189CA8 8025B3C8 08096D4C */  j         .L8025B530
/* 189CAC 8025B3CC 00000000 */   nop
.L8025B3D0:
/* 189CB0 8025B3D0 820206CC */  lb        $v0, 0x6CC($s0)
/* 189CB4 8025B3D4 18400056 */  blez      $v0, .L8025B530
/* 189CB8 8025B3D8 0000302D */   daddu    $a2, $zero, $zero
.L8025B3DC:
/* 189CBC 8025B3DC 8E0206D0 */  lw        $v0, 0x6D0($s0)
/* 189CC0 8025B3E0 00061880 */  sll       $v1, $a2, 2
/* 189CC4 8025B3E4 00621821 */  addu      $v1, $v1, $v0
/* 189CC8 8025B3E8 00061140 */  sll       $v0, $a2, 5
/* 189CCC 8025B3EC 8C630000 */  lw        $v1, 0x0($v1)
/* 189CD0 8025B3F0 10600009 */  beqz      $v1, .L8025B418
/* 189CD4 8025B3F4 02022821 */   addu     $a1, $s0, $v0
/* 189CD8 8025B3F8 0000202D */  daddu     $a0, $zero, $zero
.L8025B3FC:
/* 189CDC 8025B3FC 94620000 */  lhu       $v0, 0x0($v1)
/* 189CE0 8025B400 24630002 */  addiu     $v1, $v1, 0x2
/* 189CE4 8025B404 24840001 */  addiu     $a0, $a0, 0x1
/* 189CE8 8025B408 A4A20000 */  sh        $v0, 0x0($a1)
/* 189CEC 8025B40C 28820010 */  slti      $v0, $a0, 0x10
/* 189CF0 8025B410 1440FFFA */  bnez      $v0, .L8025B3FC
/* 189CF4 8025B414 24A50002 */   addiu    $a1, $a1, 0x2
.L8025B418:
/* 189CF8 8025B418 820206CC */  lb        $v0, 0x6CC($s0)
/* 189CFC 8025B41C 24C60001 */  addiu     $a2, $a2, 0x1
/* 189D00 8025B420 00C2102A */  slt       $v0, $a2, $v0
/* 189D04 8025B424 10400042 */  beqz      $v0, .L8025B530
/* 189D08 8025B428 00000000 */   nop
/* 189D0C 8025B42C 08096CF7 */  j         .L8025B3DC
/* 189D10 8025B430 00000000 */   nop
.L8025B434:
/* 189D14 8025B434 820206CC */  lb        $v0, 0x6CC($s0)
/* 189D18 8025B438 920306CC */  lbu       $v1, 0x6CC($s0)
/* 189D1C 8025B43C 1840003C */  blez      $v0, .L8025B530
/* 189D20 8025B440 0000302D */   daddu    $a2, $zero, $zero
/* 189D24 8025B444 00031E00 */  sll       $v1, $v1, 24
.L8025B448:
/* 189D28 8025B448 00031E03 */  sra       $v1, $v1, 24
/* 189D2C 8025B44C 00031080 */  sll       $v0, $v1, 2
/* 189D30 8025B450 00431021 */  addu      $v0, $v0, $v1
/* 189D34 8025B454 00461021 */  addu      $v0, $v0, $a2
/* 189D38 8025B458 8E0306D0 */  lw        $v1, 0x6D0($s0)
/* 189D3C 8025B45C 00021080 */  sll       $v0, $v0, 2
/* 189D40 8025B460 00431021 */  addu      $v0, $v0, $v1
/* 189D44 8025B464 8C430000 */  lw        $v1, 0x0($v0)
/* 189D48 8025B468 00061140 */  sll       $v0, $a2, 5
/* 189D4C 8025B46C 10600009 */  beqz      $v1, .L8025B494
/* 189D50 8025B470 02022821 */   addu     $a1, $s0, $v0
/* 189D54 8025B474 0000202D */  daddu     $a0, $zero, $zero
.L8025B478:
/* 189D58 8025B478 94620000 */  lhu       $v0, 0x0($v1)
/* 189D5C 8025B47C 24630002 */  addiu     $v1, $v1, 0x2
/* 189D60 8025B480 24840001 */  addiu     $a0, $a0, 0x1
/* 189D64 8025B484 A4A20000 */  sh        $v0, 0x0($a1)
/* 189D68 8025B488 28820010 */  slti      $v0, $a0, 0x10
/* 189D6C 8025B48C 1440FFFA */  bnez      $v0, .L8025B478
/* 189D70 8025B490 24A50002 */   addiu    $a1, $a1, 0x2
.L8025B494:
/* 189D74 8025B494 24C60001 */  addiu     $a2, $a2, 0x1
/* 189D78 8025B498 820206CC */  lb        $v0, 0x6CC($s0)
/* 189D7C 8025B49C 920306CC */  lbu       $v1, 0x6CC($s0)
/* 189D80 8025B4A0 00C2102A */  slt       $v0, $a2, $v0
/* 189D84 8025B4A4 5440FFE8 */  bnel      $v0, $zero, .L8025B448
/* 189D88 8025B4A8 00031E00 */   sll      $v1, $v1, 24
/* 189D8C 8025B4AC 08096D4C */  j         .L8025B530
/* 189D90 8025B4B0 00000000 */   nop
.L8025B4B4:
/* 189D94 8025B4B4 820206CC */  lb        $v0, 0x6CC($s0)
/* 189D98 8025B4B8 920306CC */  lbu       $v1, 0x6CC($s0)
D_8025B4BC:
/* 189D9C 8025B4BC 1840001C */  blez      $v0, .L8025B530
/* 189DA0 8025B4C0 0000302D */   daddu    $a2, $zero, $zero
/* 189DA4 8025B4C4 00031E00 */  sll       $v1, $v1, 24
.L8025B4C8:
/* 189DA8 8025B4C8 00031E03 */  sra       $v1, $v1, 24
/* 189DAC 8025B4CC 00031040 */  sll       $v0, $v1, 1
/* 189DB0 8025B4D0 00431021 */  addu      $v0, $v0, $v1
/* 189DB4 8025B4D4 00021040 */  sll       $v0, $v0, 1
/* 189DB8 8025B4D8 00461021 */  addu      $v0, $v0, $a2
/* 189DBC 8025B4DC 8E0306D0 */  lw        $v1, 0x6D0($s0)
D_8025B4E0:
/* 189DC0 8025B4E0 00021080 */  sll       $v0, $v0, 2
/* 189DC4 8025B4E4 00431021 */  addu      $v0, $v0, $v1
/* 189DC8 8025B4E8 8C430000 */  lw        $v1, 0x0($v0)
/* 189DCC 8025B4EC 00061140 */  sll       $v0, $a2, 5
/* 189DD0 8025B4F0 10600009 */  beqz      $v1, .L8025B518
/* 189DD4 8025B4F4 02022821 */   addu     $a1, $s0, $v0
/* 189DD8 8025B4F8 0000202D */  daddu     $a0, $zero, $zero
.L8025B4FC:
/* 189DDC 8025B4FC 94620000 */  lhu       $v0, 0x0($v1)
/* 189DE0 8025B500 24630002 */  addiu     $v1, $v1, 0x2
/* 189DE4 8025B504 24840001 */  addiu     $a0, $a0, 0x1
/* 189DE8 8025B508 A4A20000 */  sh        $v0, 0x0($a1)
/* 189DEC 8025B50C 28820010 */  slti      $v0, $a0, 0x10
/* 189DF0 8025B510 1440FFFA */  bnez      $v0, .L8025B4FC
/* 189DF4 8025B514 24A50002 */   addiu    $a1, $a1, 0x2
.L8025B518:
/* 189DF8 8025B518 24C60001 */  addiu     $a2, $a2, 0x1
/* 189DFC 8025B51C 820206CC */  lb        $v0, 0x6CC($s0)
/* 189E00 8025B520 920306CC */  lbu       $v1, 0x6CC($s0)
/* 189E04 8025B524 00C2102A */  slt       $v0, $a2, $v0
/* 189E08 8025B528 5440FFE7 */  bnel      $v0, $zero, .L8025B4C8
/* 189E0C 8025B52C 00031E00 */   sll      $v1, $v1, 24
.L8025B530:
/* 189E10 8025B530 820206CD */  lb        $v0, 0x6CD($s0)
/* 189E14 8025B534 1840000A */  blez      $v0, .L8025B560
/* 189E18 8025B538 0000302D */   daddu    $a2, $zero, $zero
/* 189E1C 8025B53C 0200202D */  daddu     $a0, $s0, $zero
/* 189E20 8025B540 0200182D */  daddu     $v1, $s0, $zero
.L8025B544:
/* 189E24 8025B544 AC6406D4 */  sw        $a0, 0x6D4($v1)
/* 189E28 8025B548 24840020 */  addiu     $a0, $a0, 0x20
/* 189E2C 8025B54C 820206CD */  lb        $v0, 0x6CD($s0)
/* 189E30 8025B550 24C60001 */  addiu     $a2, $a2, 0x1
/* 189E34 8025B554 00C2102A */  slt       $v0, $a2, $v0
/* 189E38 8025B558 1440FFFA */  bnez      $v0, .L8025B544
/* 189E3C 8025B55C 24630004 */   addiu    $v1, $v1, 0x4
.L8025B560:
/* 189E40 8025B560 16400006 */  bnez      $s2, .L8025B57C
/* 189E44 8025B564 0220202D */   daddu    $a0, $s1, $zero
/* 189E48 8025B568 0260282D */  daddu     $a1, $s3, $zero
/* 189E4C 8025B56C 0C096657 */  jal       func_8025995C
/* 189E50 8025B570 0280302D */   daddu    $a2, $s4, $zero
/* 189E54 8025B574 08096D62 */  j         .L8025B588
/* 189E58 8025B578 00000000 */   nop
.L8025B57C:
/* 189E5C 8025B57C 0260282D */  daddu     $a1, $s3, $zero
/* 189E60 8025B580 0C0965B0 */  jal       func_802596C0
/* 189E64 8025B584 0280302D */   daddu    $a2, $s4, $zero
.L8025B588:
/* 189E68 8025B588 16A00004 */  bnez      $s5, .L8025B59C
/* 189E6C 8025B58C 00000000 */   nop
/* 189E70 8025B590 960206CA */  lhu       $v0, 0x6CA($s0)
/* 189E74 8025B594 2442FFFF */  addiu     $v0, $v0, -0x1
/* 189E78 8025B598 A60206CA */  sh        $v0, 0x6CA($s0)
.L8025B59C:
/* 189E7C 8025B59C 8FBF0028 */  lw        $ra, 0x28($sp)
/* 189E80 8025B5A0 8FB50024 */  lw        $s5, 0x24($sp)
/* 189E84 8025B5A4 8FB40020 */  lw        $s4, 0x20($sp)
/* 189E88 8025B5A8 8FB3001C */  lw        $s3, 0x1C($sp)
/* 189E8C 8025B5AC 8FB20018 */  lw        $s2, 0x18($sp)
/* 189E90 8025B5B0 8FB10014 */  lw        $s1, 0x14($sp)
/* 189E94 8025B5B4 8FB00010 */  lw        $s0, 0x10($sp)
/* 189E98 8025B5B8 03E00008 */  jr        $ra
/* 189E9C 8025B5BC 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

void render_with_watt_attack_palettes(b32 isNpcSprite, ActorPart* part, s32 yaw, Matrix4f mtx, b32 skipAnimation) {
    DecorationTable* decorationTable = part->decorationTable;
    PAL_PTR palIn;
    PAL_PTR palOut;
    s32 i, j;
    s32 palIdx;
    s32 brightness;

    if (decorationTable->resetPalAdjust) {
        if (isNpcSprite == SPRITE_MODE_PLAYER) {
            decorationTable->originalPalettesList = spr_get_player_palettes(part->currentAnimation >> 16);
            decorationTable->originalPalettesCount = 0;
            while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) {
                decorationTable->originalPalettesCount++;
            }
            decorationTable->spriteColorVariations = SPR_PLAYER_COLOR_VARIATIONS;
        } else {
            decorationTable->originalPalettesList = spr_get_npc_palettes(part->currentAnimation >> 16);
            decorationTable->originalPalettesCount = 0;
            while ((s32)decorationTable->originalPalettesList[decorationTable->originalPalettesCount] != -1) {
                decorationTable->originalPalettesCount++;
            }
            decorationTable->spriteColorVariations = spr_get_npc_color_variations(part->currentAnimation >> 16);
        }

        for (i = 0; i < decorationTable->originalPalettesCount; i++) {
            palIn = decorationTable->originalPalettesList[i];
            palOut = decorationTable->copiedPalettes[0][i];
            if (palIn != NULL) {
                for (j = 0; j < SPR_PAL_SIZE; j++) {
                    *palOut++ = *palIn++;
                }
            }
        }

        decorationTable->palAnimState = -2;
        decorationTable->palBlendAlpha = 0;
        decorationTable->resetPalAdjust = FALSE;
        decorationTable->nextPalTime = 0;
    }

    if (!skipAnimation) {
        if (decorationTable->nextPalTime == 0) {
            decorationTable->palAnimState += 2;
            if (WattAttackPalettesAnim[decorationTable->palAnimState] == PAL_ANIM_END) {
                decorationTable->palAnimState = 0;
            }
            decorationTable->nextPalTime = WattAttackPalettesAnim[decorationTable->palAnimState + 1] / 2;
        }
        brightness = WattAttackPalettesAnim[decorationTable->palAnimState];
        decorationTable->nextPalTime--;
    } else {
        //@bug if only called with skipAnimation set, palAnimPos will always be -2 and the array access is OOB
        brightness = WattAttackPalettesAnim[decorationTable->palAnimState];
    }

    switch (brightness) {
        case WATT_DEFAULT:
            for (i = 0; i < decorationTable->spriteColorVariations; i++) {
                palIn = decorationTable->originalPalettesList[i];
                palOut = decorationTable->copiedPalettes[0][i];
                if (palIn != NULL) {
                    for (j = 0; j < SPR_PAL_SIZE; j++) {
                        *palOut++ = *palIn++;
                    }
                }
            }
            break;
        case WATT_BRIGHTEST:
            for (i = 0; i < decorationTable->spriteColorVariations; i++) {
                // use watt's Brightest palettes
                palIdx = decorationTable->spriteColorVariations * SPR_PAL_BattleWatt_Brightest + i;
                palIn = decorationTable->originalPalettesList[palIdx];
                palOut = decorationTable->copiedPalettes[0][i];
                if (palIn != NULL) {
                    for (j = 0; j < SPR_PAL_SIZE; j++) {
                        *palOut++ = *palIn++;
                    }
                }
            }
            break;
        case WATT_BRIGHTER:
            for (i = 0; i < decorationTable->spriteColorVariations; i++) {
                // use watt's Brighter palettes
                palIdx = decorationTable->spriteColorVariations * SPR_PAL_BattleWatt_Brighter + i;
                palIn = decorationTable->originalPalettesList[palIdx];
                palOut = decorationTable->copiedPalettes[0][i];
                if (palIn != NULL) {
                    for (j = 0; j < SPR_PAL_SIZE; j++) {
                        *palOut++ = *palIn++;
                    }
                }
            }
            break;
    }

    for (i = 0; i < decorationTable->originalPalettesCount; i++) {
        decorationTable->adjustedPalettes[i] = decorationTable->copiedPalettes[0][i];
    }

    if (isNpcSprite == SPRITE_MODE_PLAYER) {
        func_8025995C(part, yaw, mtx);
    } else {
        func_802596C0(part, yaw, mtx);
    }

    if (!skipAnimation) {
        decorationTable->palBlendAlpha--;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel energy_in_out_appendGfx
/* 3D59A0 E00D6980 27BDFF08 */  addiu     $sp, $sp, -0xF8
/* 3D59A4 E00D6984 3C08DB06 */  lui       $t0, (0xDB060024 >> 16)
/* 3D59A8 E00D6988 AFB200B8 */  sw        $s2, 0xB8($sp)
/* 3D59AC E00D698C 3C12800A */  lui       $s2, %hi(gMainGfxPos)
/* 3D59B0 E00D6990 2652A66C */  addiu     $s2, $s2, %lo(gMainGfxPos)
/* 3D59B4 E00D6994 AFBF00D4 */  sw        $ra, 0xD4($sp)
/* 3D59B8 E00D6998 AFBE00D0 */  sw        $fp, 0xD0($sp)
/* 3D59BC E00D699C AFB700CC */  sw        $s7, 0xCC($sp)
/* 3D59C0 E00D69A0 AFB600C8 */  sw        $s6, 0xC8($sp)
/* 3D59C4 E00D69A4 AFB500C4 */  sw        $s5, 0xC4($sp)
/* 3D59C8 E00D69A8 AFB400C0 */  sw        $s4, 0xC0($sp)
/* 3D59CC E00D69AC AFB300BC */  sw        $s3, 0xBC($sp)
/* 3D59D0 E00D69B0 AFB100B4 */  sw        $s1, 0xB4($sp)
/* 3D59D4 E00D69B4 AFB000B0 */  sw        $s0, 0xB0($sp)
/* 3D59D8 E00D69B8 F7BA00F0 */  sdc1      $f26, 0xF0($sp)
/* 3D59DC E00D69BC F7B800E8 */  sdc1      $f24, 0xE8($sp)
/* 3D59E0 E00D69C0 F7B600E0 */  sdc1      $f22, 0xE0($sp)
/* 3D59E4 E00D69C4 F7B400D8 */  sdc1      $f20, 0xD8($sp)
/* 3D59E8 E00D69C8 AFA400F8 */  sw        $a0, 0xF8($sp)
/* 3D59EC E00D69CC 8E460000 */  lw        $a2, 0x0($s2)
/* 3D59F0 E00D69D0 8FA900F8 */  lw        $t1, 0xF8($sp)
/* 3D59F4 E00D69D4 4480A000 */  mtc1      $zero, $f20
/* 3D59F8 E00D69D8 8D31000C */  lw        $s1, 0xC($t1)
/* 3D59FC E00D69DC 4405A000 */  mfc1      $a1, $f20
/* 3D5A00 E00D69E0 4407A000 */  mfc1      $a3, $f20
/* 3D5A04 E00D69E4 8E290024 */  lw        $t1, 0x24($s1)
/* 3D5A08 E00D69E8 35080024 */  ori       $t0, $t0, (0xDB060024 & 0xFFFF)
/* 3D5A0C E00D69EC AFA900A0 */  sw        $t1, 0xA0($sp)
/* 3D5A10 E00D69F0 8E290000 */  lw        $t1, 0x0($s1)
/* 3D5A14 E00D69F4 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 3D5A18 E00D69F8 AFA900A4 */  sw        $t1, 0xA4($sp)
/* 3D5A1C E00D69FC C6200034 */  lwc1      $f0, 0x34($s1)
/* 3D5A20 E00D6A00 C6220044 */  lwc1      $f2, 0x44($s1)
/* 3D5A24 E00D6A04 8E360018 */  lw        $s6, 0x18($s1)
/* 3D5A28 E00D6A08 8E3E001C */  lw        $fp, 0x1C($s1)
/* 3D5A2C E00D6A0C 8E290020 */  lw        $t1, 0x20($s1)
/* 3D5A30 E00D6A10 00C0182D */  daddu     $v1, $a2, $zero
/* 3D5A34 E00D6A14 AFA900A8 */  sw        $t1, 0xA8($sp)
/* 3D5A38 E00D6A18 C63A0038 */  lwc1      $f26, 0x38($s1)
/* 3D5A3C E00D6A1C 24C60008 */  addiu     $a2, $a2, 0x8
/* 3D5A40 E00D6A20 AC620000 */  sw        $v0, 0x0($v1)
/* 3D5A44 E00D6A24 AC600004 */  sw        $zero, 0x4($v1)
/* 3D5A48 E00D6A28 ACC80000 */  sw        $t0, 0x0($a2)
/* 3D5A4C E00D6A2C 8FA900F8 */  lw        $t1, 0xF8($sp)
/* 3D5A50 E00D6A30 3C088000 */  lui       $t0, (0x80000000 >> 16)
/* 3D5A54 E00D6A34 8D220010 */  lw        $v0, 0x10($t1)
/* 3D5A58 E00D6A38 46020002 */  mul.s     $f0, $f0, $f2
/* 3D5A5C E00D6A3C 00000000 */  nop
/* 3D5A60 E00D6A40 8C42001C */  lw        $v0, 0x1C($v0)
/* 3D5A64 E00D6A44 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 3D5A68 E00D6A48 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 3D5A6C E00D6A4C 00481021 */  addu      $v0, $v0, $t0
/* 3D5A70 E00D6A50 ACC20004 */  sw        $v0, 0x4($a2)
/* 3D5A74 E00D6A54 00031080 */  sll       $v0, $v1, 2
/* 3D5A78 E00D6A58 00431021 */  addu      $v0, $v0, $v1
/* 3D5A7C E00D6A5C 00021080 */  sll       $v0, $v0, 2
/* 3D5A80 E00D6A60 00431023 */  subu      $v0, $v0, $v1
/* 3D5A84 E00D6A64 000218C0 */  sll       $v1, $v0, 3
/* 3D5A88 E00D6A68 00431021 */  addu      $v0, $v0, $v1
/* 3D5A8C E00D6A6C 000210C0 */  sll       $v0, $v0, 3
/* 3D5A90 E00D6A70 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 3D5A94 E00D6A74 00220821 */  addu      $at, $at, $v0
/* 3D5A98 E00D6A78 C4221DEC */  lwc1      $f2, %lo(gCameras + 0x6C)($at)
/* 3D5A9C E00D6A7C 27A40020 */  addiu     $a0, $sp, 0x20
/* 3D5AA0 E00D6A80 E7A00010 */  swc1      $f0, 0x10($sp)
/* 3D5AA4 E00D6A84 C6200004 */  lwc1      $f0, 0x4($s1)
/* 3D5AA8 E00D6A88 3C100001 */  lui       $s0, (0x11630 >> 16)
/* 3D5AAC E00D6A8C AE460000 */  sw        $a2, 0x0($s2)
/* 3D5AB0 E00D6A90 24C60008 */  addiu     $a2, $a2, 0x8
/* 3D5AB4 E00D6A94 E7A00014 */  swc1      $f0, 0x14($sp)
/* 3D5AB8 E00D6A98 C6200008 */  lwc1      $f0, 0x8($s1)
/* 3D5ABC E00D6A9C 46001087 */  neg.s     $f2, $f2
/* 3D5AC0 E00D6AA0 AE460000 */  sw        $a2, 0x0($s2)
/* 3D5AC4 E00D6AA4 44061000 */  mfc1      $a2, $f2
/* 3D5AC8 E00D6AA8 36101630 */  ori       $s0, $s0, (0x11630 & 0xFFFF)
/* 3D5ACC E00D6AAC E7A00018 */  swc1      $f0, 0x18($sp)
/* 3D5AD0 E00D6AB0 C620000C */  lwc1      $f0, 0xC($s1)
/* 3D5AD4 E00D6AB4 24140001 */  addiu     $s4, $zero, 0x1
/* 3D5AD8 E00D6AB8 0C080180 */  jal       shim_guPositionF
/* 3D5ADC E00D6ABC E7A0001C */   swc1     $f0, 0x1C($sp)
/* 3D5AE0 E00D6AC0 27A40020 */  addiu     $a0, $sp, 0x20
/* 3D5AE4 E00D6AC4 3C158007 */  lui       $s5, %hi(gMatrixListPos)
/* 3D5AE8 E00D6AC8 26B541F0 */  addiu     $s5, $s5, %lo(gMatrixListPos)
/* 3D5AEC E00D6ACC 3C17800A */  lui       $s7, %hi(gDisplayContext)
/* 3D5AF0 E00D6AD0 26F7A674 */  addiu     $s7, $s7, %lo(gDisplayContext)
/* 3D5AF4 E00D6AD4 96A50000 */  lhu       $a1, 0x0($s5)
/* 3D5AF8 E00D6AD8 8EE20000 */  lw        $v0, 0x0($s7)
/* 3D5AFC E00D6ADC 00052980 */  sll       $a1, $a1, 6
/* 3D5B00 E00D6AE0 00B02821 */  addu      $a1, $a1, $s0
/* 3D5B04 E00D6AE4 0C080118 */  jal       shim_guMtxF2L
/* 3D5B08 E00D6AE8 00452821 */   addu     $a1, $v0, $a1
/* 3D5B0C E00D6AEC 3C03DA38 */  lui       $v1, (0xDA380002 >> 16)
/* 3D5B10 E00D6AF0 34630002 */  ori       $v1, $v1, (0xDA380002 & 0xFFFF)
/* 3D5B14 E00D6AF4 8E440000 */  lw        $a0, 0x0($s2)
/* 3D5B18 E00D6AF8 96A20000 */  lhu       $v0, 0x0($s5)
/* 3D5B1C E00D6AFC 0080282D */  daddu     $a1, $a0, $zero
/* 3D5B20 E00D6B00 24840008 */  addiu     $a0, $a0, 0x8
/* 3D5B24 E00D6B04 AE440000 */  sw        $a0, 0x0($s2)
/* 3D5B28 E00D6B08 ACA30000 */  sw        $v1, 0x0($a1)
/* 3D5B2C E00D6B0C 00541821 */  addu      $v1, $v0, $s4
/* 3D5B30 E00D6B10 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 3D5B34 E00D6B14 00021180 */  sll       $v0, $v0, 6
/* 3D5B38 E00D6B18 A6A30000 */  sh        $v1, 0x0($s5)
/* 3D5B3C E00D6B1C 8EE30000 */  lw        $v1, 0x0($s7)
/* 3D5B40 E00D6B20 00501021 */  addu      $v0, $v0, $s0
/* 3D5B44 E00D6B24 00621821 */  addu      $v1, $v1, $v0
/* 3D5B48 E00D6B28 24820008 */  addiu     $v0, $a0, 0x8
/* 3D5B4C E00D6B2C ACA30004 */  sw        $v1, 0x4($a1)
/* 3D5B50 E00D6B30 AE420000 */  sw        $v0, 0x0($s2)
/* 3D5B54 E00D6B34 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 3D5B58 E00D6B38 AC820000 */  sw        $v0, 0x0($a0)
/* 3D5B5C E00D6B3C 9222001B */  lbu       $v0, 0x1B($s1)
/* 3D5B60 E00D6B40 9225001F */  lbu       $a1, 0x1F($s1)
/* 3D5B64 E00D6B44 92260023 */  lbu       $a2, 0x23($s1)
/* 3D5B68 E00D6B48 24830010 */  addiu     $v1, $a0, 0x10
/* 3D5B6C E00D6B4C AE430000 */  sw        $v1, 0x0($s2)
/* 3D5B70 E00D6B50 3C03FB00 */  lui       $v1, (0xFB000000 >> 16)
/* 3D5B74 E00D6B54 AC830008 */  sw        $v1, 0x8($a0)
/* 3D5B78 E00D6B58 8FA900A0 */  lw        $t1, 0xA0($sp)
/* 3D5B7C E00D6B5C 00021600 */  sll       $v0, $v0, 24
/* 3D5B80 E00D6B60 00052C00 */  sll       $a1, $a1, 16
/* 3D5B84 E00D6B64 00451025 */  or        $v0, $v0, $a1
/* 3D5B88 E00D6B68 00063200 */  sll       $a2, $a2, 8
/* 3D5B8C E00D6B6C 00461025 */  or        $v0, $v0, $a2
/* 3D5B90 E00D6B70 312300FF */  andi      $v1, $t1, 0xFF
/* 3D5B94 E00D6B74 00431025 */  or        $v0, $v0, $v1
/* 3D5B98 E00D6B78 AC820004 */  sw        $v0, 0x4($a0)
/* 3D5B9C E00D6B7C 9223002B */  lbu       $v1, 0x2B($s1)
/* 3D5BA0 E00D6B80 9225002F */  lbu       $a1, 0x2F($s1)
/* 3D5BA4 E00D6B84 92260033 */  lbu       $a2, 0x33($s1)
/* 3D5BA8 E00D6B88 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 3D5BAC E00D6B8C AC820010 */  sw        $v0, 0x10($a0)
/* 3D5BB0 E00D6B90 3C020900 */  lui       $v0, %hi(D_09000200_415260)
/* 3D5BB4 E00D6B94 24420200 */  addiu     $v0, $v0, %lo(D_09000200_415260)
/* 3D5BB8 E00D6B98 AC820014 */  sw        $v0, 0x14($a0)
/* 3D5BBC E00D6B9C 00031E00 */  sll       $v1, $v1, 24
/* 3D5BC0 E00D6BA0 00052C00 */  sll       $a1, $a1, 16
/* 3D5BC4 E00D6BA4 00651825 */  or        $v1, $v1, $a1
/* 3D5BC8 E00D6BA8 00063200 */  sll       $a2, $a2, 8
/* 3D5BCC E00D6BAC 00661825 */  or        $v1, $v1, $a2
/* 3D5BD0 E00D6BB0 AC83000C */  sw        $v1, 0xC($a0)
/* 3D5BD4 E00D6BB4 8FA900F8 */  lw        $t1, 0xF8($sp)
/* 3D5BD8 E00D6BB8 26310048 */  addiu     $s1, $s1, 0x48
/* 3D5BDC E00D6BBC 8D220008 */  lw        $v0, 0x8($t1)
/* 3D5BE0 E00D6BC0 24840018 */  addiu     $a0, $a0, 0x18
/* 3D5BE4 E00D6BC4 0282102A */  slt       $v0, $s4, $v0
/* 3D5BE8 E00D6BC8 10400080 */  beqz      $v0, .LE00D6DCC
/* 3D5BEC E00D6BCC AE440000 */   sw       $a0, 0x0($s2)
/* 3D5BF0 E00D6BD0 0240982D */  daddu     $s3, $s2, $zero
/* 3D5BF4 E00D6BD4 00161E00 */  sll       $v1, $s6, 24
/* 3D5BF8 E00D6BD8 33C200FF */  andi      $v0, $fp, 0xFF
/* 3D5BFC E00D6BDC 00021400 */  sll       $v0, $v0, 16
/* 3D5C00 E00D6BE0 00621825 */  or        $v1, $v1, $v0
/* 3D5C04 E00D6BE4 4600A606 */  mov.s     $f24, $f20
/* 3D5C08 E00D6BE8 27B20060 */  addiu     $s2, $sp, 0x60
/* 3D5C0C E00D6BEC 02E0F02D */  daddu     $fp, $s7, $zero
/* 3D5C10 E00D6BF0 02A0B82D */  daddu     $s7, $s5, $zero
/* 3D5C14 E00D6BF4 3C150001 */  lui       $s5, (0x11630 >> 16)
/* 3D5C18 E00D6BF8 36B51630 */  ori       $s5, $s5, (0x11630 & 0xFFFF)
/* 3D5C1C E00D6BFC 26300004 */  addiu     $s0, $s1, 0x4
/* 3D5C20 E00D6C00 8FA900A8 */  lw        $t1, 0xA8($sp)
/* 3D5C24 E00D6C04 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 3D5C28 E00D6C08 4481B000 */  mtc1      $at, $f22
/* 3D5C2C E00D6C0C 312200FF */  andi      $v0, $t1, 0xFF
/* 3D5C30 E00D6C10 00021200 */  sll       $v0, $v0, 8
/* 3D5C34 E00D6C14 8FA900A4 */  lw        $t1, 0xA4($sp)
/* 3D5C38 E00D6C18 00621825 */  or        $v1, $v1, $v0
/* 3D5C3C E00D6C1C AFA300AC */  sw        $v1, 0xAC($sp)
/* 3D5C40 E00D6C20 3C03E00D */  lui       $v1, %hi(D_E00D6E40)
/* 3D5C44 E00D6C24 24636E40 */  addiu     $v1, $v1, %lo(D_E00D6E40)
/* 3D5C48 E00D6C28 00091080 */  sll       $v0, $t1, 2
/* 3D5C4C E00D6C2C 0043B021 */  addu      $s6, $v0, $v1
.LE00D6C30:
/* 3D5C50 E00D6C30 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 3D5C54 E00D6C34 8E680000 */  lw        $t0, 0x0($s3)
/* 3D5C58 E00D6C38 C6140030 */  lwc1      $f20, 0x30($s0)
/* 3D5C5C E00D6C3C 0100282D */  daddu     $a1, $t0, $zero
/* 3D5C60 E00D6C40 ACA20000 */  sw        $v0, 0x0($a1)
/* 3D5C64 E00D6C44 8E030020 */  lw        $v1, 0x20($s0)
/* 3D5C68 E00D6C48 8FA900A0 */  lw        $t1, 0xA0($sp)
/* 3D5C6C E00D6C4C 01230018 */  mult      $t1, $v1
/* 3D5C70 E00D6C50 00001812 */  mflo      $v1
/* 3D5C74 E00D6C54 3C028080 */  lui       $v0, (0x80808081 >> 16)
/* 3D5C78 E00D6C58 34428081 */  ori       $v0, $v0, (0x80808081 & 0xFFFF)
/* 3D5C7C E00D6C5C 00620018 */  mult      $v1, $v0
/* 3D5C80 E00D6C60 27A40020 */  addiu     $a0, $sp, 0x20
/* 3D5C84 E00D6C64 4406C000 */  mfc1      $a2, $f24
/* 3D5C88 E00D6C68 4407C000 */  mfc1      $a3, $f24
/* 3D5C8C E00D6C6C 8FA900AC */  lw        $t1, 0xAC($sp)
/* 3D5C90 E00D6C70 00001010 */  mfhi      $v0
/* 3D5C94 E00D6C74 00431021 */  addu      $v0, $v0, $v1
/* 3D5C98 E00D6C78 000211C3 */  sra       $v0, $v0, 7
/* 3D5C9C E00D6C7C 00031FC3 */  sra       $v1, $v1, 31
/* 3D5CA0 E00D6C80 00431023 */  subu      $v0, $v0, $v1
/* 3D5CA4 E00D6C84 304200FF */  andi      $v0, $v0, 0xFF
/* 3D5CA8 E00D6C88 01221025 */  or        $v0, $t1, $v0
/* 3D5CAC E00D6C8C ACA20004 */  sw        $v0, 0x4($a1)
/* 3D5CB0 E00D6C90 E7B60010 */  swc1      $f22, 0x10($sp)
/* 3D5CB4 E00D6C94 8E050038 */  lw        $a1, 0x38($s0)
/* 3D5CB8 E00D6C98 25080008 */  addiu     $t0, $t0, 0x8
/* 3D5CBC E00D6C9C 0C080104 */  jal       shim_guRotateF
/* 3D5CC0 E00D6CA0 AE680000 */   sw       $t0, 0x0($s3)
/* 3D5CC4 E00D6CA4 C6000000 */  lwc1      $f0, 0x0($s0)
/* 3D5CC8 E00D6CA8 461A0000 */  add.s     $f0, $f0, $f26
/* 3D5CCC E00D6CAC 4406C000 */  mfc1      $a2, $f24
/* 3D5CD0 E00D6CB0 4407C000 */  mfc1      $a3, $f24
/* 3D5CD4 E00D6CB4 44050000 */  mfc1      $a1, $f0
/* 3D5CD8 E00D6CB8 0C080108 */  jal       shim_guTranslateF
/* 3D5CDC E00D6CBC 0240202D */   daddu    $a0, $s2, $zero
/* 3D5CE0 E00D6CC0 0240202D */  daddu     $a0, $s2, $zero
/* 3D5CE4 E00D6CC4 27A50020 */  addiu     $a1, $sp, 0x20
/* 3D5CE8 E00D6CC8 0C080114 */  jal       shim_guMtxCatF
/* 3D5CEC E00D6CCC 00A0302D */   daddu    $a2, $a1, $zero
/* 3D5CF0 E00D6CD0 8EC30000 */  lw        $v1, 0x0($s6)
/* 3D5CF4 E00D6CD4 3C020900 */  lui       $v0, %hi(D_09000688_4156E8)
/* 3D5CF8 E00D6CD8 24420688 */  addiu     $v0, $v0, %lo(D_09000688_4156E8)
/* 3D5CFC E00D6CDC 10620005 */  beq       $v1, $v0, .LE00D6CF4
/* 3D5D00 E00D6CE0 00000000 */   nop
/* 3D5D04 E00D6CE4 3C020900 */  lui       $v0, %hi(D_09000808_415868)
/* 3D5D08 E00D6CE8 24420808 */  addiu     $v0, $v0, %lo(D_09000808_415868)
/* 3D5D0C E00D6CEC 14620006 */  bne       $v1, $v0, .LE00D6D08
/* 3D5D10 E00D6CF0 0240202D */   daddu    $a0, $s2, $zero
.LE00D6CF4:
/* 3D5D14 E00D6CF4 4405A000 */  mfc1      $a1, $f20
/* 3D5D18 E00D6CF8 4406B000 */  mfc1      $a2, $f22
/* 3D5D1C E00D6CFC 4407B000 */  mfc1      $a3, $f22
/* 3D5D20 E00D6D00 08035B45 */  j         .LE00D6D14
/* 3D5D24 E00D6D04 0240202D */   daddu    $a0, $s2, $zero
.LE00D6D08:
/* 3D5D28 E00D6D08 4405A000 */  mfc1      $a1, $f20
/* 3D5D2C E00D6D0C 4407B000 */  mfc1      $a3, $f22
/* 3D5D30 E00D6D10 00A0302D */  daddu     $a2, $a1, $zero
.LE00D6D14:
/* 3D5D34 E00D6D14 0C080110 */  jal       shim_guScaleF
/* 3D5D38 E00D6D18 26940001 */   addiu    $s4, $s4, 0x1
/* 3D5D3C E00D6D1C 27A40060 */  addiu     $a0, $sp, 0x60
/* 3D5D40 E00D6D20 27A50020 */  addiu     $a1, $sp, 0x20
/* 3D5D44 E00D6D24 0C080114 */  jal       shim_guMtxCatF
/* 3D5D48 E00D6D28 00A0302D */   daddu    $a2, $a1, $zero
/* 3D5D4C E00D6D2C 27A40020 */  addiu     $a0, $sp, 0x20
/* 3D5D50 E00D6D30 96E50000 */  lhu       $a1, 0x0($s7)
/* 3D5D54 E00D6D34 8FC20000 */  lw        $v0, 0x0($fp)
/* 3D5D58 E00D6D38 00052980 */  sll       $a1, $a1, 6
/* 3D5D5C E00D6D3C 00B52821 */  addu      $a1, $a1, $s5
/* 3D5D60 E00D6D40 0C080118 */  jal       shim_guMtxF2L
/* 3D5D64 E00D6D44 00452821 */   addu     $a1, $v0, $a1
/* 3D5D68 E00D6D48 3C06D838 */  lui       $a2, (0xD8380002 >> 16)
/* 3D5D6C E00D6D4C 8E640000 */  lw        $a0, 0x0($s3)
/* 3D5D70 E00D6D50 34C60002 */  ori       $a2, $a2, (0xD8380002 & 0xFFFF)
/* 3D5D74 E00D6D54 0080282D */  daddu     $a1, $a0, $zero
/* 3D5D78 E00D6D58 24840008 */  addiu     $a0, $a0, 0x8
/* 3D5D7C E00D6D5C AE640000 */  sw        $a0, 0x0($s3)
/* 3D5D80 E00D6D60 96E20000 */  lhu       $v0, 0x0($s7)
/* 3D5D84 E00D6D64 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 3D5D88 E00D6D68 ACA30000 */  sw        $v1, 0x0($a1)
/* 3D5D8C E00D6D6C 24430001 */  addiu     $v1, $v0, 0x1
/* 3D5D90 E00D6D70 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 3D5D94 E00D6D74 00021180 */  sll       $v0, $v0, 6
/* 3D5D98 E00D6D78 A6E30000 */  sh        $v1, 0x0($s7)
/* 3D5D9C E00D6D7C 8FC30000 */  lw        $v1, 0x0($fp)
/* 3D5DA0 E00D6D80 00551021 */  addu      $v0, $v0, $s5
/* 3D5DA4 E00D6D84 00621821 */  addu      $v1, $v1, $v0
/* 3D5DA8 E00D6D88 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 3D5DAC E00D6D8C ACA30004 */  sw        $v1, 0x4($a1)
/* 3D5DB0 E00D6D90 AC820000 */  sw        $v0, 0x0($a0)
/* 3D5DB4 E00D6D94 8EC30000 */  lw        $v1, 0x0($s6)
/* 3D5DB8 E00D6D98 24820008 */  addiu     $v0, $a0, 0x8
/* 3D5DBC E00D6D9C AE620000 */  sw        $v0, 0x0($s3)
/* 3D5DC0 E00D6DA0 24020040 */  addiu     $v0, $zero, 0x40
/* 3D5DC4 E00D6DA4 AC860008 */  sw        $a2, 0x8($a0)
/* 3D5DC8 E00D6DA8 AC82000C */  sw        $v0, 0xC($a0)
/* 3D5DCC E00D6DAC AC830004 */  sw        $v1, 0x4($a0)
/* 3D5DD0 E00D6DB0 8FA900F8 */  lw        $t1, 0xF8($sp)
/* 3D5DD4 E00D6DB4 26100048 */  addiu     $s0, $s0, 0x48
/* 3D5DD8 E00D6DB8 8D220008 */  lw        $v0, 0x8($t1)
/* 3D5DDC E00D6DBC 24840010 */  addiu     $a0, $a0, 0x10
/* 3D5DE0 E00D6DC0 0282102A */  slt       $v0, $s4, $v0
/* 3D5DE4 E00D6DC4 1440FF9A */  bnez      $v0, .LE00D6C30
/* 3D5DE8 E00D6DC8 AE640000 */   sw       $a0, 0x0($s3)
.LE00D6DCC:
/* 3D5DEC E00D6DCC 3C05D838 */  lui       $a1, (0xD8380002 >> 16)
/* 3D5DF0 E00D6DD0 3C03800A */  lui       $v1, %hi(gMainGfxPos)
/* 3D5DF4 E00D6DD4 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
/* 3D5DF8 E00D6DD8 8C620000 */  lw        $v0, 0x0($v1)
/* 3D5DFC E00D6DDC 34A50002 */  ori       $a1, $a1, (0xD8380002 & 0xFFFF)
/* 3D5E00 E00D6DE0 0040202D */  daddu     $a0, $v0, $zero
/* 3D5E04 E00D6DE4 24420008 */  addiu     $v0, $v0, 0x8
/* 3D5E08 E00D6DE8 AC620000 */  sw        $v0, 0x0($v1)
/* 3D5E0C E00D6DEC 24020040 */  addiu     $v0, $zero, 0x40
/* 3D5E10 E00D6DF0 AC850000 */  sw        $a1, 0x0($a0)
/* 3D5E14 E00D6DF4 AC820004 */  sw        $v0, 0x4($a0)
/* 3D5E18 E00D6DF8 8FBF00D4 */  lw        $ra, 0xD4($sp)
/* 3D5E1C E00D6DFC 8FBE00D0 */  lw        $fp, 0xD0($sp)
/* 3D5E20 E00D6E00 8FB700CC */  lw        $s7, 0xCC($sp)
/* 3D5E24 E00D6E04 8FB600C8 */  lw        $s6, 0xC8($sp)
/* 3D5E28 E00D6E08 8FB500C4 */  lw        $s5, 0xC4($sp)
/* 3D5E2C E00D6E0C 8FB400C0 */  lw        $s4, 0xC0($sp)
/* 3D5E30 E00D6E10 8FB300BC */  lw        $s3, 0xBC($sp)
/* 3D5E34 E00D6E14 8FB200B8 */  lw        $s2, 0xB8($sp)
/* 3D5E38 E00D6E18 8FB100B4 */  lw        $s1, 0xB4($sp)
/* 3D5E3C E00D6E1C 8FB000B0 */  lw        $s0, 0xB0($sp)
/* 3D5E40 E00D6E20 D7BA00F0 */  ldc1      $f26, 0xF0($sp)
/* 3D5E44 E00D6E24 D7B800E8 */  ldc1      $f24, 0xE8($sp)
/* 3D5E48 E00D6E28 D7B600E0 */  ldc1      $f22, 0xE0($sp)
/* 3D5E4C E00D6E2C D7B400D8 */  ldc1      $f20, 0xD8($sp)
/* 3D5E50 E00D6E30 03E00008 */  jr        $ra
/* 3D5E54 E00D6E34 27BD00F8 */   addiu    $sp, $sp, 0xF8
/* 3D5E58 E00D6E38 00000000 */  nop
/* 3D5E5C E00D6E3C 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void energy_in_out_appendGfx(void* effect) {
    EnergyInOutFXData* part = ((EffectInstance*)effect)->data.energyInOut;
    s32 unk_24 = part->unk_24;
    s32 unk_00 = part->unk_00;
    f32 scale = part->scale * part->unk_44;
    s32 unk_18 = part->unk_18;
    s32 unk_1C = part->unk_1C;
    s32 unk_20 = part->unk_20;
    f32 unk_38 = part->unk_38;
    Matrix4f sp20;
    Matrix4f sp60;
    s32 i;

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

    shim_guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, scale, part->pos.x, part->pos.y, part->pos.z);
    shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);

    gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
    gDPSetPrimColor(gMainGfxPos++, 0, 0, part->unk_18, part->unk_1C, part->unk_20, unk_24);
    gDPSetEnvColor(gMainGfxPos++, part->unk_28, part->unk_2C, part->unk_30, 0);
    gSPDisplayList(gMainGfxPos++, D_09000200_3D6130);

    part++;
    for (i = 1; i < ((EffectInstance*)effect)->numParts; i++, part++) {
        f32 scale = part->scale;

        gDPSetPrimColor(gMainGfxPos++, 0, 0, unk_18, unk_1C, unk_20, (unk_24 * part->unk_24) / 255);

        shim_guRotateF(sp20, part->unk_3C, 0.0f, 0.0f, 1.0f);
        shim_guTranslateF(sp60, part->pos.x + unk_38, 0.0f, 0.0f);
        shim_guMtxCatF(sp60, sp20, sp20);
        if (D_E00D6E40[unk_00] == D_09000688_3D65B8 || D_E00D6E40[unk_00] == D_09000808_3D6738) {
            shim_guScaleF(sp60, scale, 1.0f, 1.0f);
        } else {
            shim_guScaleF(sp60, scale, scale, 1.0f);
        }
        shim_guMtxCatF(sp60, sp20, sp20);
        shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);

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

    gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
}