### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_802A5988_7AD328
/* 41A718 802A5988 27BDFFB0 */  addiu     $sp, $sp, -0x50
/* 41A71C 802A598C AFB60028 */  sw        $s6, 0x28($sp)
/* 41A720 802A5990 3C16800E */  lui       $s6, %hi(gBattleStatus)
/* 41A724 802A5994 26D6C070 */  addiu     $s6, $s6, %lo(gBattleStatus)
/* 41A728 802A5998 AFB50024 */  sw        $s5, 0x24($sp)
/* 41A72C 802A599C 3C158011 */  lui       $s5, %hi(gPlayerData)
/* 41A730 802A59A0 26B5F290 */  addiu     $s5, $s5, %lo(gPlayerData)
/* 41A734 802A59A4 AFB00010 */  sw        $s0, 0x10($sp)
/* 41A738 802A59A8 3C10800E */  lui       $s0, %hi(gBattleSubState)
/* 41A73C 802A59AC 2610C4DC */  addiu     $s0, $s0, %lo(gBattleSubState)
/* 41A740 802A59B0 AFBF0034 */  sw        $ra, 0x34($sp)
/* 41A744 802A59B4 AFBE0030 */  sw        $fp, 0x30($sp)
/* 41A748 802A59B8 AFB7002C */  sw        $s7, 0x2C($sp)
/* 41A74C 802A59BC AFB40020 */  sw        $s4, 0x20($sp)
/* 41A750 802A59C0 AFB3001C */  sw        $s3, 0x1C($sp)
/* 41A754 802A59C4 AFB20018 */  sw        $s2, 0x18($sp)
/* 41A758 802A59C8 AFB10014 */  sw        $s1, 0x14($sp)
/* 41A75C 802A59CC F7B80048 */  sdc1      $f24, 0x48($sp)
/* 41A760 802A59D0 F7B60040 */  sdc1      $f22, 0x40($sp)
/* 41A764 802A59D4 F7B40038 */  sdc1      $f20, 0x38($sp)
/* 41A768 802A59D8 8ED700D8 */  lw        $s7, 0xD8($s6)
/* 41A76C 802A59DC 8E030000 */  lw        $v1, 0x0($s0)
/* 41A770 802A59E0 8ED100DC */  lw        $s1, 0xDC($s6)
/* 41A774 802A59E4 10600005 */  beqz      $v1, .L802A59FC_7AD39C
/* 41A778 802A59E8 2402012C */   addiu    $v0, $zero, 0x12C
/* 41A77C 802A59EC 10620023 */  beq       $v1, $v0, .L802A5A7C_7AD41C
/* 41A780 802A59F0 00000000 */   nop
/* 41A784 802A59F4 080A9709 */  j         .L802A5C24_7AD5C4
/* 41A788 802A59F8 00000000 */   nop
.L802A59FC_7AD39C:
/* 41A78C 802A59FC 2402FFFF */  addiu     $v0, $zero, -0x1
/* 41A790 802A5A00 A2C20178 */  sb        $v0, 0x178($s6)
/* 41A794 802A5A04 A6C0017C */  sh        $zero, 0x17C($s6)
/* 41A798 802A5A08 0C0A9606 */  jal       func_802A5818_7AD1B8
/* 41A79C 802A5A0C AEC00188 */   sw       $zero, 0x188($s6)
/* 41A7A0 802A5A10 104008D8 */  beqz      $v0, .L802A7D74_7AF714
/* 41A7A4 802A5A14 00000000 */   nop
/* 41A7A8 802A5A18 0C093903 */  jal       func_8024E40C
/* 41A7AC 802A5A1C 24040002 */   addiu    $a0, $zero, 0x2
/* 41A7B0 802A5A20 0C093936 */  jal       D_8024E4D8_C0BD58
/* 41A7B4 802A5A24 2404000A */   addiu    $a0, $zero, 0xA
/* 41A7B8 802A5A28 8EC20000 */  lw        $v0, 0x0($s6)
/* 41A7BC 802A5A2C 3C030010 */  lui       $v1, (0x100000 >> 16)
/* 41A7C0 802A5A30 00431024 */  and       $v0, $v0, $v1
/* 41A7C4 802A5A34 14400004 */  bnez      $v0, .L802A5A48_7AD3E8
/* 41A7C8 802A5A38 2402012C */   addiu    $v0, $zero, 0x12C
/* 41A7CC 802A5A3C 2402012E */  addiu     $v0, $zero, 0x12E
/* 41A7D0 802A5A40 080A9709 */  j         .L802A5C24_7AD5C4
/* 41A7D4 802A5A44 AE020000 */   sw       $v0, 0x0($s0)
.L802A5A48_7AD3E8:
/* 41A7D8 802A5A48 C6200138 */  lwc1      $f0, 0x138($s1)
/* 41A7DC 802A5A4C C6220140 */  lwc1      $f2, 0x140($s1)
/* 41A7E0 802A5A50 E620000C */  swc1      $f0, 0xC($s1)
/* 41A7E4 802A5A54 E6220014 */  swc1      $f2, 0x14($s1)
/* 41A7E8 802A5A58 C6E00138 */  lwc1      $f0, 0x138($s7)
/* 41A7EC 802A5A5C AE020000 */  sw        $v0, 0x0($s0)
/* 41A7F0 802A5A60 E6200018 */  swc1      $f0, 0x18($s1)
/* 41A7F4 802A5A64 C6E00140 */  lwc1      $f0, 0x140($s7)
/* 41A7F8 802A5A68 24020004 */  addiu     $v0, $zero, 0x4
/* 41A7FC 802A5A6C A6220070 */  sh        $v0, 0x70($s1)
/* 41A800 802A5A70 AE200054 */  sw        $zero, 0x54($s1)
/* 41A804 802A5A74 080A9709 */  j         .L802A5C24_7AD5C4
/* 41A808 802A5A78 E6200020 */   swc1     $f0, 0x20($s1)
.L802A5A7C_7AD41C:
/* 41A80C 802A5A7C 86220070 */  lh        $v0, 0x70($s1)
/* 41A810 802A5A80 10400022 */  beqz      $v0, .L802A5B0C_7AD4AC
/* 41A814 802A5A84 00000000 */   nop
/* 41A818 802A5A88 C6200018 */  lwc1      $f0, 0x18($s1)
/* 41A81C 802A5A8C C6280144 */  lwc1      $f8, 0x144($s1)
/* 41A820 802A5A90 C6220020 */  lwc1      $f2, 0x20($s1)
/* 41A824 802A5A94 46080001 */  sub.s     $f0, $f0, $f8
/* 41A828 802A5A98 C624014C */  lwc1      $f4, 0x14C($s1)
/* 41A82C 802A5A9C 46041081 */  sub.s     $f2, $f2, $f4
/* 41A830 802A5AA0 44823000 */  mtc1      $v0, $f6
/* 41A834 802A5AA4 00000000 */  nop
/* 41A838 802A5AA8 468031A0 */  cvt.s.w   $f6, $f6
/* 41A83C 802A5AAC 46060003 */  div.s     $f0, $f0, $f6
/* 41A840 802A5AB0 46004200 */  add.s     $f8, $f8, $f0
/* 41A844 802A5AB4 46003006 */  mov.s     $f0, $f6
/* 41A848 802A5AB8 46061083 */  div.s     $f2, $f2, $f6
/* 41A84C 802A5ABC C620000C */  lwc1      $f0, 0xC($s1)
/* 41A850 802A5AC0 46022100 */  add.s     $f4, $f4, $f2
/* 41A854 802A5AC4 E6280144 */  swc1      $f8, 0x144($s1)
/* 41A858 802A5AC8 E624014C */  swc1      $f4, 0x14C($s1)
/* 41A85C 802A5ACC C6E40144 */  lwc1      $f4, 0x144($s7)
/* 41A860 802A5AD0 46040001 */  sub.s     $f0, $f0, $f4
/* 41A864 802A5AD4 46003086 */  mov.s     $f2, $f6
/* 41A868 802A5AD8 46060003 */  div.s     $f0, $f0, $f6
/* 41A86C 802A5ADC 46002100 */  add.s     $f4, $f4, $f0
/* 41A870 802A5AE0 E6E40144 */  swc1      $f4, 0x144($s7)
/* 41A874 802A5AE4 C6200014 */  lwc1      $f0, 0x14($s1)
/* 41A878 802A5AE8 C6E4014C */  lwc1      $f4, 0x14C($s7)
/* 41A87C 802A5AEC 86220070 */  lh        $v0, 0x70($s1)
/* 41A880 802A5AF0 46040001 */  sub.s     $f0, $f0, $f4
/* 41A884 802A5AF4 44821000 */  mtc1      $v0, $f2
/* 41A888 802A5AF8 00000000 */  nop
/* 41A88C 802A5AFC 468010A0 */  cvt.s.w   $f2, $f2
/* 41A890 802A5B00 46020003 */  div.s     $f0, $f0, $f2
/* 41A894 802A5B04 46002100 */  add.s     $f4, $f4, $f0
/* 41A898 802A5B08 E6E4014C */  swc1      $f4, 0x14C($s7)
.L802A5B0C_7AD4AC:
/* 41A89C 802A5B0C C62C0054 */  lwc1      $f12, 0x54($s1)
/* 41A8A0 802A5B10 3C0140C9 */  lui       $at, (0x40C90FD0 >> 16)
/* 41A8A4 802A5B14 34210FD0 */  ori       $at, $at, (0x40C90FD0 & 0xFFFF)
/* 41A8A8 802A5B18 4481B000 */  mtc1      $at, $f22
/* 41A8AC 802A5B1C 00000000 */  nop
/* 41A8B0 802A5B20 46166302 */  mul.s     $f12, $f12, $f22
/* 41A8B4 802A5B24 00000000 */  nop
/* 41A8B8 802A5B28 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
/* 41A8BC 802A5B2C 4481C000 */  mtc1      $at, $f24
/* 41A8C0 802A5B30 3C014180 */  lui       $at, (0x41800000 >> 16)
/* 41A8C4 802A5B34 4481A000 */  mtc1      $at, $f20
/* 41A8C8 802A5B38 0C00A85B */  jal       sin_rad
/* 41A8CC 802A5B3C 46186303 */   div.s    $f12, $f12, $f24
/* 41A8D0 802A5B40 46140002 */  mul.s     $f0, $f0, $f20
/* 41A8D4 802A5B44 00000000 */  nop
/* 41A8D8 802A5B48 C622014C */  lwc1      $f2, 0x14C($s1)
/* 41A8DC 802A5B4C 46001081 */  sub.s     $f2, $f2, $f0
/* 41A8E0 802A5B50 C62C0054 */  lwc1      $f12, 0x54($s1)
/* 41A8E4 802A5B54 46006307 */  neg.s     $f12, $f12
/* 41A8E8 802A5B58 0C00A6C9 */  jal       clamp_angle
/* 41A8EC 802A5B5C E622014C */   swc1     $f2, 0x14C($s1)
/* 41A8F0 802A5B60 C62C0054 */  lwc1      $f12, 0x54($s1)
/* 41A8F4 802A5B64 46166302 */  mul.s     $f12, $f12, $f22
/* 41A8F8 802A5B68 00000000 */  nop
/* 41A8FC 802A5B6C E620018C */  swc1      $f0, 0x18C($s1)
/* 41A900 802A5B70 0C00A85B */  jal       sin_rad
/* 41A904 802A5B74 46186303 */   div.s    $f12, $f12, $f24
/* 41A908 802A5B78 46140002 */  mul.s     $f0, $f0, $f20
/* 41A90C 802A5B7C 00000000 */  nop
/* 41A910 802A5B80 C6E2014C */  lwc1      $f2, 0x14C($s7)
/* 41A914 802A5B84 46001080 */  add.s     $f2, $f2, $f0
/* 41A918 802A5B88 E6E2014C */  swc1      $f2, 0x14C($s7)
/* 41A91C 802A5B8C C62C0054 */  lwc1      $f12, 0x54($s1)
/* 41A920 802A5B90 0C00A6C9 */  jal       clamp_angle
/* 41A924 802A5B94 46006307 */   neg.s    $f12, $f12
/* 41A928 802A5B98 E6E0018C */  swc1      $f0, 0x18C($s7)
/* 41A92C 802A5B9C C6200054 */  lwc1      $f0, 0x54($s1)
/* 41A930 802A5BA0 3C0142B4 */  lui       $at, (0x42B40000 >> 16)
/* 41A934 802A5BA4 44811000 */  mtc1      $at, $f2
/* 41A938 802A5BA8 86220070 */  lh        $v0, 0x70($s1)
/* 41A93C 802A5BAC 46020000 */  add.s     $f0, $f0, $f2
/* 41A940 802A5BB0 96230070 */  lhu       $v1, 0x70($s1)
/* 41A944 802A5BB4 10400004 */  beqz      $v0, .L802A5BC8_7AD568
/* 41A948 802A5BB8 E6200054 */   swc1     $f0, 0x54($s1)
/* 41A94C 802A5BBC 2462FFFF */  addiu     $v0, $v1, -0x1
/* 41A950 802A5BC0 080A9709 */  j         .L802A5C24_7AD5C4
/* 41A954 802A5BC4 A6220070 */   sh       $v0, 0x70($s1)
.L802A5BC8_7AD568:
/* 41A958 802A5BC8 C6200018 */  lwc1      $f0, 0x18($s1)
/* 41A95C 802A5BCC C6220020 */  lwc1      $f2, 0x20($s1)
/* 41A960 802A5BD0 C624000C */  lwc1      $f4, 0xC($s1)
/* 41A964 802A5BD4 E6200144 */  swc1      $f0, 0x144($s1)
/* 41A968 802A5BD8 E622014C */  swc1      $f2, 0x14C($s1)
/* 41A96C 802A5BDC E6E40144 */  swc1      $f4, 0x144($s7)
/* 41A970 802A5BE0 C6200014 */  lwc1      $f0, 0x14($s1)
/* 41A974 802A5BE4 E6E0014C */  swc1      $f0, 0x14C($s7)
/* 41A978 802A5BE8 C6200144 */  lwc1      $f0, 0x144($s1)
/* 41A97C 802A5BEC C622014C */  lwc1      $f2, 0x14C($s1)
/* 41A980 802A5BF0 3C04FFEF */  lui       $a0, (0xFFEFFFFF >> 16)
/* 41A984 802A5BF4 E6200138 */  swc1      $f0, 0x138($s1)
/* 41A988 802A5BF8 E6220140 */  swc1      $f2, 0x140($s1)
/* 41A98C 802A5BFC C6E00144 */  lwc1      $f0, 0x144($s7)
/* 41A990 802A5C00 C6E2014C */  lwc1      $f2, 0x14C($s7)
/* 41A994 802A5C04 3484FFFF */  ori       $a0, $a0, (0xFFEFFFFF & 0xFFFF)
/* 41A998 802A5C08 E6E00138 */  swc1      $f0, 0x138($s7)
/* 41A99C 802A5C0C E6E20140 */  swc1      $f2, 0x140($s7)
/* 41A9A0 802A5C10 8EC20000 */  lw        $v0, 0x0($s6)
/* 41A9A4 802A5C14 2403012E */  addiu     $v1, $zero, 0x12E
/* 41A9A8 802A5C18 AE030000 */  sw        $v1, 0x0($s0)
/* 41A9AC 802A5C1C 00441024 */  and       $v0, $v0, $a0
/* 41A9B0 802A5C20 AEC20000 */  sw        $v0, 0x0($s6)
.L802A5C24_7AD5C4:
/* 41A9B4 802A5C24 3C02800E */  lui       $v0, %hi(gBattleSubState)
/* 41A9B8 802A5C28 8C42C4DC */  lw        $v0, %lo(gBattleSubState)($v0)
/* 41A9BC 802A5C2C 2443FFFF */  addiu     $v1, $v0, -0x1
/* 41A9C0 802A5C30 2C62012E */  sltiu     $v0, $v1, 0x12E
/* 41A9C4 802A5C34 10400943 */  beqz      $v0, .L802A8144_7AFAE4
/* 41A9C8 802A5C38 00031080 */   sll      $v0, $v1, 2
/* 41A9CC 802A5C3C 3C01802B */  lui       $at, %hi(jtbl_802ABBD8_7B3578)
/* 41A9D0 802A5C40 00220821 */  addu      $at, $at, $v0
/* 41A9D4 802A5C44 8C22BBD8 */  lw        $v0, %lo(jtbl_802ABBD8_7B3578)($at)
/* 41A9D8 802A5C48 00400008 */  jr        $v0
/* 41A9DC 802A5C4C 00000000 */   nop
glabel .L802A5C50_7AD5F0
/* 41A9E0 802A5C50 3C10800E */  lui       $s0, %hi(gBattleStatus)
/* 41A9E4 802A5C54 2610C070 */  addiu     $s0, $s0, %lo(gBattleStatus)
/* 41A9E8 802A5C58 3C03FBFF */  lui       $v1, (0xFBFFFFFF >> 16)
/* 41A9EC 802A5C5C 8E020000 */  lw        $v0, 0x0($s0)
/* 41A9F0 802A5C60 3463FFFF */  ori       $v1, $v1, (0xFBFFFFFF & 0xFFFF)
/* 41A9F4 802A5C64 34420002 */  ori       $v0, $v0, 0x2
/* 41A9F8 802A5C68 AE020000 */  sw        $v0, 0x0($s0)
/* 41A9FC 802A5C6C 8EE20000 */  lw        $v0, 0x0($s7)
/* 41AA00 802A5C70 3C040800 */  lui       $a0, (0x8000000 >> 16)
/* 41AA04 802A5C74 00431024 */  and       $v0, $v0, $v1
/* 41AA08 802A5C78 00441025 */  or        $v0, $v0, $a0
/* 41AA0C 802A5C7C 12200006 */  beqz      $s1, .L802A5C98_7AD638
/* 41AA10 802A5C80 AEE20000 */   sw       $v0, 0x0($s7)
/* 41AA14 802A5C84 8E220000 */  lw        $v0, 0x0($s1)
/* 41AA18 802A5C88 3C030400 */  lui       $v1, (0x4000000 >> 16)
/* 41AA1C 802A5C8C 00431025 */  or        $v0, $v0, $v1
/* 41AA20 802A5C90 00441025 */  or        $v0, $v0, $a0
/* 41AA24 802A5C94 AE220000 */  sw        $v0, 0x0($s1)
.L802A5C98_7AD638:
/* 41AA28 802A5C98 0C098C9A */  jal       func_80263268
/* 41AA2C 802A5C9C 00000000 */   nop
/* 41AA30 802A5CA0 0C098CC0 */  jal       func_80263300
/* 41AA34 802A5CA4 00000000 */   nop
/* 41AA38 802A5CA8 0C098D2E */  jal       btl_init_menu_boots
/* 41AA3C 802A5CAC 00000000 */   nop
/* 41AA40 802A5CB0 0C098DB9 */  jal       btl_init_menu_hammer
/* 41AA44 802A5CB4 00000000 */   nop
/* 41AA48 802A5CB8 02E0202D */  daddu     $a0, $s7, $zero
/* 41AA4C 802A5CBC 0C099CAB */  jal       player_team_is_ability_active
/* 41AA50 802A5CC0 24050015 */   addiu    $a1, $zero, 0x15
/* 41AA54 802A5CC4 1440091D */  bnez      $v0, .L802A813C_7AFADC
/* 41AA58 802A5CC8 24020064 */   addiu    $v0, $zero, 0x64
/* 41AA5C 802A5CCC 0000A02D */  daddu     $s4, $zero, $zero
/* 41AA60 802A5CD0 82C2004C */  lb        $v0, 0x4C($s6)
/* 41AA64 802A5CD4 04410002 */  bgez      $v0, .L802A5CE0_7AD680
/* 41AA68 802A5CD8 241E0002 */   addiu    $fp, $zero, 0x2
/* 41AA6C 802A5CDC A2C0004C */  sb        $zero, 0x4C($s6)
.L802A5CE0_7AD680:
/* 41AA70 802A5CE0 3C03802B */  lui       $v1, %hi(D_802AB478_7B2E18)
/* 41AA74 802A5CE4 8C63B478 */  lw        $v1, %lo(D_802AB478_7B2E18)($v1)
/* 41AA78 802A5CE8 24020007 */  addiu     $v0, $zero, 0x7
/* 41AA7C 802A5CEC 3C01802B */  lui       $at, %hi(battle_menu_submenuIDs)
/* 41AA80 802A5CF0 AC22D0B8 */  sw        $v0, %lo(battle_menu_submenuIDs)($at)
/* 41AA84 802A5CF4 24020001 */  addiu     $v0, $zero, 0x1
/* 41AA88 802A5CF8 3C01802B */  lui       $at, %hi(BattleMenu_OptionEnabled)
/* 41AA8C 802A5CFC AC22D0D0 */  sw        $v0, %lo(BattleMenu_OptionEnabled)($at)
/* 41AA90 802A5D00 3C02802B */  lui       $v0, %hi(D_802AB4DC_7B2E7C)
/* 41AA94 802A5D04 8C42B4DC */  lw        $v0, %lo(D_802AB4DC_7B2E7C)($v0)
/* 41AA98 802A5D08 3C01802B */  lui       $at, %hi(BattleMenu_HudScripts)
/* 41AA9C 802A5D0C AC23D078 */  sw        $v1, %lo(BattleMenu_HudScripts)($at)
/* 41AAA0 802A5D10 82C30083 */  lb        $v1, 0x83($s6)
/* 41AAA4 802A5D14 3C04802B */  lui       $a0, %hi(BattleMenu_TitleMessages)
/* 41AAA8 802A5D18 2484D090 */  addiu     $a0, $a0, %lo(BattleMenu_TitleMessages)
/* 41AAAC 802A5D1C 107E0006 */  beq       $v1, $fp, .L802A5D38_7AD6D8
/* 41AAB0 802A5D20 AC820000 */   sw       $v0, 0x0($a0)
/* 41AAB4 802A5D24 8E020000 */  lw        $v0, 0x0($s0)
/* 41AAB8 802A5D28 3C030200 */  lui       $v1, (0x2000000 >> 16)
/* 41AABC 802A5D2C 00431024 */  and       $v0, $v0, $v1
/* 41AAC0 802A5D30 10400004 */  beqz      $v0, .L802A5D44_7AD6E4
/* 41AAC4 802A5D34 00000000 */   nop
.L802A5D38_7AD6D8:
/* 41AAC8 802A5D38 3C02001D */  lui       $v0, (0x1D0054 >> 16)
/* 41AACC 802A5D3C 34420054 */  ori       $v0, $v0, (0x1D0054 & 0xFFFF)
/* 41AAD0 802A5D40 AC820000 */  sw        $v0, 0x0($a0)
.L802A5D44_7AD6E4:
/* 41AAD4 802A5D44 3C08802B */  lui       $t0, %hi(battle_menu_isMessageDisabled)
/* 41AAD8 802A5D48 2508D0E8 */  addiu     $t0, $t0, %lo(battle_menu_isMessageDisabled)
/* 41AADC 802A5D4C 00141880 */  sll       $v1, $s4, 2
/* 41AAE0 802A5D50 00682021 */  addu      $a0, $v1, $t0
/* 41AAE4 802A5D54 AC800000 */  sw        $zero, 0x0($a0)
/* 41AAE8 802A5D58 96C20070 */  lhu       $v0, 0x70($s6)
/* 41AAEC 802A5D5C 30420080 */  andi      $v0, $v0, 0x80
/* 41AAF0 802A5D60 1440000B */  bnez      $v0, .L802A5D90_7AD730
/* 41AAF4 802A5D64 00000000 */   nop
/* 41AAF8 802A5D68 3C02802B */  lui       $v0, %hi(D_802AB47C_7B2E1C)
/* 41AAFC 802A5D6C 8C42B47C */  lw        $v0, %lo(D_802AB47C_7B2E1C)($v0)
/* 41AB00 802A5D70 3C01802B */  lui       $at, %hi(BattleMenu_OptionEnabled)
/* 41AB04 802A5D74 00230821 */  addu      $at, $at, $v1
/* 41AB08 802A5D78 AC20D0D0 */  sw        $zero, %lo(BattleMenu_OptionEnabled)($at)
/* 41AB0C 802A5D7C 3C01802B */  lui       $at, %hi(BattleMenu_HudScripts)
/* 41AB10 802A5D80 00230821 */  addu      $at, $at, $v1
/* 41AB14 802A5D84 AC22D078 */  sw        $v0, %lo(BattleMenu_HudScripts)($at)
/* 41AB18 802A5D88 24020048 */  addiu     $v0, $zero, 0x48
/* 41AB1C 802A5D8C AC820000 */  sw        $v0, 0x0($a0)
.L802A5D90_7AD730:
/* 41AB20 802A5D90 82C3004C */  lb        $v1, 0x4C($s6)
/* 41AB24 802A5D94 24020007 */  addiu     $v0, $zero, 0x7
/* 41AB28 802A5D98 50620001 */  beql      $v1, $v0, .L802A5DA0_7AD740
/* 41AB2C 802A5D9C 0280F02D */   daddu    $fp, $s4, $zero
.L802A5DA0_7AD740:
/* 41AB30 802A5DA0 82C2007D */  lb        $v0, 0x7D($s6)
/* 41AB34 802A5DA4 04400034 */  bltz      $v0, .L802A5E78_7AD818
/* 41AB38 802A5DA8 26940001 */   addiu    $s4, $s4, 0x1
/* 41AB3C 802A5DAC 3C03802B */  lui       $v1, %hi(BattleMenu_HudScripts)
/* 41AB40 802A5DB0 2463D078 */  addiu     $v1, $v1, %lo(BattleMenu_HudScripts)
/* 41AB44 802A5DB4 00142080 */  sll       $a0, $s4, 2
/* 41AB48 802A5DB8 3C07802B */  lui       $a3, %hi(D_802AB388_7B2D28)
/* 41AB4C 802A5DBC 24E7B388 */  addiu     $a3, $a3, %lo(D_802AB388_7B2D28)
/* 41AB50 802A5DC0 00833021 */  addu      $a2, $a0, $v1
/* 41AB54 802A5DC4 8CE20000 */  lw        $v0, 0x0($a3)
/* 41AB58 802A5DC8 24090002 */  addiu     $t1, $zero, 0x2
/* 41AB5C 802A5DCC ACC20000 */  sw        $v0, 0x0($a2)
/* 41AB60 802A5DD0 3C02802B */  lui       $v0, %hi(BattleMenu_OptionEnabled)
/* 41AB64 802A5DD4 2442D0D0 */  addiu     $v0, $v0, %lo(BattleMenu_OptionEnabled)
/* 41AB68 802A5DD8 00822821 */  addu      $a1, $a0, $v0
/* 41AB6C 802A5DDC 24020001 */  addiu     $v0, $zero, 0x1
/* 41AB70 802A5DE0 3C01802B */  lui       $at, %hi(battle_menu_submenuIDs)
/* 41AB74 802A5DE4 00240821 */  addu      $at, $at, $a0
/* 41AB78 802A5DE8 AC29D0B8 */  sw        $t1, %lo(battle_menu_submenuIDs)($at)
/* 41AB7C 802A5DEC ACA20000 */  sw        $v0, 0x0($a1)
/* 41AB80 802A5DF0 3C02802B */  lui       $v0, %hi(D_802AB4C8_7B2E68)
/* 41AB84 802A5DF4 8C42B4C8 */  lw        $v0, %lo(D_802AB4C8_7B2E68)($v0)
/* 41AB88 802A5DF8 3C01802B */  lui       $at, %hi(BattleMenu_TitleMessages)
/* 41AB8C 802A5DFC 00240821 */  addu      $at, $at, $a0
/* 41AB90 802A5E00 AC22D090 */  sw        $v0, %lo(BattleMenu_TitleMessages)($at)
/* 41AB94 802A5E04 82C2007D */  lb        $v0, 0x7D($s6)
/* 41AB98 802A5E08 14400006 */  bnez      $v0, .L802A5E24_7AD7C4
/* 41AB9C 802A5E0C 00881821 */   addu     $v1, $a0, $t0
/* 41ABA0 802A5E10 8CE20004 */  lw        $v0, 0x4($a3)
/* 41ABA4 802A5E14 ACC20000 */  sw        $v0, 0x0($a2)
/* 41ABA8 802A5E18 24020045 */  addiu     $v0, $zero, 0x45
/* 41ABAC 802A5E1C ACA00000 */  sw        $zero, 0x0($a1)
/* 41ABB0 802A5E20 AC620000 */  sw        $v0, 0x0($v1)
.L802A5E24_7AD7C4:
/* 41ABB4 802A5E24 96C20070 */  lhu       $v0, 0x70($s6)
/* 41ABB8 802A5E28 30420004 */  andi      $v0, $v0, 0x4
/* 41ABBC 802A5E2C 14400006 */  bnez      $v0, .L802A5E48_7AD7E8
/* 41ABC0 802A5E30 00881821 */   addu     $v1, $a0, $t0
/* 41ABC4 802A5E34 8CE20004 */  lw        $v0, 0x4($a3)
/* 41ABC8 802A5E38 ACC20000 */  sw        $v0, 0x0($a2)
/* 41ABCC 802A5E3C 24020048 */  addiu     $v0, $zero, 0x48
/* 41ABD0 802A5E40 ACA00000 */  sw        $zero, 0x0($a1)
/* 41ABD4 802A5E44 AC620000 */  sw        $v0, 0x0($v1)
.L802A5E48_7AD7E8:
/* 41ABD8 802A5E48 82C200B0 */  lb        $v0, 0xB0($s6)
/* 41ABDC 802A5E4C 04400006 */  bltz      $v0, .L802A5E68_7AD808
/* 41ABE0 802A5E50 00881821 */   addu     $v1, $a0, $t0
/* 41ABE4 802A5E54 8CE20004 */  lw        $v0, 0x4($a3)
/* 41ABE8 802A5E58 ACC20000 */  sw        $v0, 0x0($a2)
/* 41ABEC 802A5E5C 24020048 */  addiu     $v0, $zero, 0x48
/* 41ABF0 802A5E60 ACA00000 */  sw        $zero, 0x0($a1)
/* 41ABF4 802A5E64 AC620000 */  sw        $v0, 0x0($v1)
.L802A5E68_7AD808:
/* 41ABF8 802A5E68 82C2004C */  lb        $v0, 0x4C($s6)
/* 41ABFC 802A5E6C 50490001 */  beql      $v0, $t1, .L802A5E74_7AD814
/* 41AC00 802A5E70 0280F02D */   daddu    $fp, $s4, $zero
.L802A5E74_7AD814:
/* 41AC04 802A5E74 26940001 */  addiu     $s4, $s4, 0x1
.L802A5E78_7AD818:
/* 41AC08 802A5E78 3C0C802B */  lui       $t4, %hi(BattleMenu_HudScripts)
/* 41AC0C 802A5E7C 258CD078 */  addiu     $t4, $t4, %lo(BattleMenu_HudScripts)
/* 41AC10 802A5E80 00141880 */  sll       $v1, $s4, 2
/* 41AC14 802A5E84 006C3021 */  addu      $a2, $v1, $t4
/* 41AC18 802A5E88 3C0B802B */  lui       $t3, %hi(BattleMenu_OptionEnabled)
/* 41AC1C 802A5E8C 256BD0D0 */  addiu     $t3, $t3, %lo(BattleMenu_OptionEnabled)
/* 41AC20 802A5E90 006B2821 */  addu      $a1, $v1, $t3
/* 41AC24 802A5E94 24090001 */  addiu     $t1, $zero, 0x1
/* 41AC28 802A5E98 3C0A802B */  lui       $t2, %hi(D_802AB4C0_7B2E60)
/* 41AC2C 802A5E9C 254AB4C0 */  addiu     $t2, $t2, %lo(D_802AB4C0_7B2E60)
/* 41AC30 802A5EA0 82A20000 */  lb        $v0, 0x0($s5)
/* 41AC34 802A5EA4 24420001 */  addiu     $v0, $v0, 0x1
/* 41AC38 802A5EA8 000210C0 */  sll       $v0, $v0, 3
/* 41AC3C 802A5EAC 3C01802B */  lui       $at, %hi(D_802AB348_7B2CE8)
/* 41AC40 802A5EB0 00220821 */  addu      $at, $at, $v0
/* 41AC44 802A5EB4 8C22B348 */  lw        $v0, %lo(D_802AB348_7B2CE8)($at)
/* 41AC48 802A5EB8 3C04802B */  lui       $a0, %hi(D_802AB348_7B2CE8)
/* 41AC4C 802A5EBC 2484B348 */  addiu     $a0, $a0, %lo(D_802AB348_7B2CE8)
/* 41AC50 802A5EC0 ACC20000 */  sw        $v0, 0x0($a2)
/* 41AC54 802A5EC4 3C01802B */  lui       $at, %hi(battle_menu_submenuIDs)
/* 41AC58 802A5EC8 00230821 */  addu      $at, $at, $v1
/* 41AC5C 802A5ECC AC20D0B8 */  sw        $zero, %lo(battle_menu_submenuIDs)($at)
/* 41AC60 802A5ED0 ACA90000 */  sw        $t1, 0x0($a1)
/* 41AC64 802A5ED4 8D420000 */  lw        $v0, 0x0($t2)
/* 41AC68 802A5ED8 3C07802B */  lui       $a3, %hi(battle_menu_submenuIDs)
/* 41AC6C 802A5EDC 24E7D0B8 */  addiu     $a3, $a3, %lo(battle_menu_submenuIDs)
/* 41AC70 802A5EE0 3C01802B */  lui       $at, %hi(BattleMenu_TitleMessages)
/* 41AC74 802A5EE4 00230821 */  addu      $at, $at, $v1
/* 41AC78 802A5EE8 AC22D090 */  sw        $v0, %lo(BattleMenu_TitleMessages)($at)
/* 41AC7C 802A5EEC 82C2007E */  lb        $v0, 0x7E($s6)
/* 41AC80 802A5EF0 3C08802B */  lui       $t0, %hi(BattleMenu_TitleMessages)
/* 41AC84 802A5EF4 2508D090 */  addiu     $t0, $t0, %lo(BattleMenu_TitleMessages)
/* 41AC88 802A5EF8 1C400008 */  bgtz      $v0, .L802A5F1C_7AD8BC
/* 41AC8C 802A5EFC 00000000 */   nop
/* 41AC90 802A5F00 8C820000 */  lw        $v0, 0x0($a0)
/* 41AC94 802A5F04 ACC20000 */  sw        $v0, 0x0($a2)
/* 41AC98 802A5F08 24020043 */  addiu     $v0, $zero, 0x43
/* 41AC9C 802A5F0C ACA00000 */  sw        $zero, 0x0($a1)
/* 41ACA0 802A5F10 3C01802B */  lui       $at, %hi(battle_menu_isMessageDisabled)
/* 41ACA4 802A5F14 00230821 */  addu      $at, $at, $v1
/* 41ACA8 802A5F18 AC22D0E8 */  sw        $v0, %lo(battle_menu_isMessageDisabled)($at)
.L802A5F1C_7AD8BC:
/* 41ACAC 802A5F1C 96C20070 */  lhu       $v0, 0x70($s6)
/* 41ACB0 802A5F20 30420001 */  andi      $v0, $v0, 0x1
/* 41ACB4 802A5F24 14400008 */  bnez      $v0, .L802A5F48_7AD8E8
/* 41ACB8 802A5F28 00000000 */   nop
/* 41ACBC 802A5F2C 8C820004 */  lw        $v0, 0x4($a0)
/* 41ACC0 802A5F30 ACC20000 */  sw        $v0, 0x0($a2)
/* 41ACC4 802A5F34 24020048 */  addiu     $v0, $zero, 0x48
/* 41ACC8 802A5F38 ACA00000 */  sw        $zero, 0x0($a1)
/* 41ACCC 802A5F3C 3C01802B */  lui       $at, %hi(battle_menu_isMessageDisabled)
/* 41ACD0 802A5F40 00230821 */  addu      $at, $at, $v1
/* 41ACD4 802A5F44 AC22D0E8 */  sw        $v0, %lo(battle_menu_isMessageDisabled)($at)
.L802A5F48_7AD8E8:
/* 41ACD8 802A5F48 82C200AF */  lb        $v0, 0xAF($s6)
/* 41ACDC 802A5F4C 04400008 */  bltz      $v0, .L802A5F70_7AD910
/* 41ACE0 802A5F50 00000000 */   nop
/* 41ACE4 802A5F54 8C820004 */  lw        $v0, 0x4($a0)
/* 41ACE8 802A5F58 ACC20000 */  sw        $v0, 0x0($a2)
/* 41ACEC 802A5F5C 24020048 */  addiu     $v0, $zero, 0x48
/* 41ACF0 802A5F60 ACA00000 */  sw        $zero, 0x0($a1)
/* 41ACF4 802A5F64 3C01802B */  lui       $at, %hi(battle_menu_isMessageDisabled)
/* 41ACF8 802A5F68 00230821 */  addu      $at, $at, $v1
/* 41ACFC 802A5F6C AC22D0E8 */  sw        $v0, %lo(battle_menu_isMessageDisabled)($at)
.L802A5F70_7AD910:
/* 41AD00 802A5F70 82C2004C */  lb        $v0, 0x4C($s6)
/* 41AD04 802A5F74 50400001 */  beql      $v0, $zero, .L802A5F7C_7AD91C
/* 41AD08 802A5F78 0280F02D */   daddu    $fp, $s4, $zero
.L802A5F7C_7AD91C:
/* 41AD0C 802A5F7C 82A20001 */  lb        $v0, 0x1($s5)
/* 41AD10 802A5F80 04400034 */  bltz      $v0, .L802A6054_7AD9F4
/* 41AD14 802A5F84 26940001 */   addiu    $s4, $s4, 0x1
/* 41AD18 802A5F88 00142080 */  sll       $a0, $s4, 2
/* 41AD1C 802A5F8C 24420001 */  addiu     $v0, $v0, 0x1
/* 41AD20 802A5F90 000210C0 */  sll       $v0, $v0, 3
/* 41AD24 802A5F94 008C3021 */  addu      $a2, $a0, $t4
/* 41AD28 802A5F98 3C01802B */  lui       $at, %hi(D_802AB368_7B2D08)
/* 41AD2C 802A5F9C 00220821 */  addu      $at, $at, $v0
/* 41AD30 802A5FA0 8C22B368 */  lw        $v0, %lo(D_802AB368_7B2D08)($at)
/* 41AD34 802A5FA4 008B2821 */  addu      $a1, $a0, $t3
/* 41AD38 802A5FA8 ACC20000 */  sw        $v0, 0x0($a2)
/* 41AD3C 802A5FAC 00871021 */  addu      $v0, $a0, $a3
/* 41AD40 802A5FB0 AC490000 */  sw        $t1, 0x0($v0)
/* 41AD44 802A5FB4 ACA90000 */  sw        $t1, 0x0($a1)
/* 41AD48 802A5FB8 8D430004 */  lw        $v1, 0x4($t2)
/* 41AD4C 802A5FBC 00881021 */  addu      $v0, $a0, $t0
/* 41AD50 802A5FC0 AC430000 */  sw        $v1, 0x0($v0)
/* 41AD54 802A5FC4 82C2007F */  lb        $v0, 0x7F($s6)
/* 41AD58 802A5FC8 3C03802B */  lui       $v1, %hi(D_802AB368_7B2D08)
/* 41AD5C 802A5FCC 1C400008 */  bgtz      $v0, .L802A5FF0_7AD990
/* 41AD60 802A5FD0 2463B368 */   addiu    $v1, $v1, %lo(D_802AB368_7B2D08)
/* 41AD64 802A5FD4 8C620000 */  lw        $v0, 0x0($v1)
/* 41AD68 802A5FD8 ACC20000 */  sw        $v0, 0x0($a2)
/* 41AD6C 802A5FDC 24020044 */  addiu     $v0, $zero, 0x44
/* 41AD70 802A5FE0 ACA00000 */  sw        $zero, 0x0($a1)
/* 41AD74 802A5FE4 3C01802B */  lui       $at, %hi(battle_menu_isMessageDisabled)
/* 41AD78 802A5FE8 00240821 */  addu      $at, $at, $a0
/* 41AD7C 802A5FEC AC22D0E8 */  sw        $v0, %lo(battle_menu_isMessageDisabled)($at)
.L802A5FF0_7AD990:
/* 41AD80 802A5FF0 96C20070 */  lhu       $v0, 0x70($s6)
/* 41AD84 802A5FF4 30420002 */  andi      $v0, $v0, 0x2
/* 41AD88 802A5FF8 14400008 */  bnez      $v0, .L802A601C_7AD9BC
/* 41AD8C 802A5FFC 00000000 */   nop
/* 41AD90 802A6000 8C620004 */  lw        $v0, 0x4($v1)
/* 41AD94 802A6004 ACC20000 */  sw        $v0, 0x0($a2)
/* 41AD98 802A6008 24020048 */  addiu     $v0, $zero, 0x48
/* 41AD9C 802A600C ACA00000 */  sw        $zero, 0x0($a1)
/* 41ADA0 802A6010 3C01802B */  lui       $at, %hi(battle_menu_isMessageDisabled)
/* 41ADA4 802A6014 00240821 */  addu      $at, $at, $a0
/* 41ADA8 802A6018 AC22D0E8 */  sw        $v0, %lo(battle_menu_isMessageDisabled)($at)
.L802A601C_7AD9BC:
/* 41ADAC 802A601C 82C200AE */  lb        $v0, 0xAE($s6)
/* 41ADB0 802A6020 04400008 */  bltz      $v0, .L802A6044_7AD9E4
/* 41ADB4 802A6024 00000000 */   nop
/* 41ADB8 802A6028 8C620004 */  lw        $v0, 0x4($v1)
/* 41ADBC 802A602C ACC20000 */  sw        $v0, 0x0($a2)
/* 41ADC0 802A6030 24020048 */  addiu     $v0, $zero, 0x48
/* 41ADC4 802A6034 ACA00000 */  sw        $zero, 0x0($a1)
/* 41ADC8 802A6038 3C01802B */  lui       $at, %hi(battle_menu_isMessageDisabled)
/* 41ADCC 802A603C 00240821 */  addu      $at, $at, $a0
/* 41ADD0 802A6040 AC22D0E8 */  sw        $v0, %lo(battle_menu_isMessageDisabled)($at)
.L802A6044_7AD9E4:
/* 41ADD4 802A6044 82C2004C */  lb        $v0, 0x4C($s6)
/* 41ADD8 802A6048 50490001 */  beql      $v0, $t1, .L802A6050_7AD9F0
/* 41ADDC 802A604C 0280F02D */   daddu    $fp, $s4, $zero
.L802A6050_7AD9F0:
/* 41ADE0 802A6050 26940001 */  addiu     $s4, $s4, 0x1
.L802A6054_7AD9F4:
/* 41ADE4 802A6054 82A2028E */  lb        $v0, 0x28E($s5)
/* 41ADE8 802A6058 10400027 */  beqz      $v0, .L802A60F8_7ADA98
/* 41ADEC 802A605C 00141880 */   sll      $v1, $s4, 2
/* 41ADF0 802A6060 3C04802B */  lui       $a0, %hi(BattleMenu_HudScripts)
/* 41ADF4 802A6064 2484D078 */  addiu     $a0, $a0, %lo(BattleMenu_HudScripts)
/* 41ADF8 802A6068 3C06802B */  lui       $a2, %hi(D_802AB390_7B2D30)
/* 41ADFC 802A606C 24C6B390 */  addiu     $a2, $a2, %lo(D_802AB390_7B2D30)
/* 41AE00 802A6070 00642821 */  addu      $a1, $v1, $a0
/* 41AE04 802A6074 8CC20000 */  lw        $v0, 0x0($a2)
/* 41AE08 802A6078 24070008 */  addiu     $a3, $zero, 0x8
/* 41AE0C 802A607C ACA20000 */  sw        $v0, 0x0($a1)
/* 41AE10 802A6080 3C02802B */  lui       $v0, %hi(BattleMenu_OptionEnabled)
/* 41AE14 802A6084 2442D0D0 */  addiu     $v0, $v0, %lo(BattleMenu_OptionEnabled)
/* 41AE18 802A6088 00622021 */  addu      $a0, $v1, $v0
/* 41AE1C 802A608C 24020001 */  addiu     $v0, $zero, 0x1
/* 41AE20 802A6090 3C01802B */  lui       $at, %hi(battle_menu_submenuIDs)
/* 41AE24 802A6094 00230821 */  addu      $at, $at, $v1
/* 41AE28 802A6098 AC27D0B8 */  sw        $a3, %lo(battle_menu_submenuIDs)($at)
/* 41AE2C 802A609C AC820000 */  sw        $v0, 0x0($a0)
/* 41AE30 802A60A0 3C02802B */  lui       $v0, %hi(D_802AB4E0_7B2E80)
/* 41AE34 802A60A4 8C42B4E0 */  lw        $v0, %lo(D_802AB4E0_7B2E80)($v0)
/* 41AE38 802A60A8 3C01802B */  lui       $at, %hi(BattleMenu_TitleMessages)
/* 41AE3C 802A60AC 00230821 */  addu      $at, $at, $v1
/* 41AE40 802A60B0 AC22D090 */  sw        $v0, %lo(BattleMenu_TitleMessages)($at)
/* 41AE44 802A60B4 3C02802B */  lui       $v0, %hi(battle_menu_isMessageDisabled)
/* 41AE48 802A60B8 2442D0E8 */  addiu     $v0, $v0, %lo(battle_menu_isMessageDisabled)
/* 41AE4C 802A60BC 00621821 */  addu      $v1, $v1, $v0
/* 41AE50 802A60C0 AC600000 */  sw        $zero, 0x0($v1)
/* 41AE54 802A60C4 96C20070 */  lhu       $v0, 0x70($s6)
/* 41AE58 802A60C8 30420100 */  andi      $v0, $v0, 0x100
/* 41AE5C 802A60CC 14400006 */  bnez      $v0, .L802A60E8_7ADA88
/* 41AE60 802A60D0 00000000 */   nop
/* 41AE64 802A60D4 8CC20004 */  lw        $v0, 0x4($a2)
/* 41AE68 802A60D8 ACA20000 */  sw        $v0, 0x0($a1)
/* 41AE6C 802A60DC 24020048 */  addiu     $v0, $zero, 0x48
/* 41AE70 802A60E0 AC800000 */  sw        $zero, 0x0($a0)
/* 41AE74 802A60E4 AC620000 */  sw        $v0, 0x0($v1)
.L802A60E8_7ADA88:
/* 41AE78 802A60E8 82C2004C */  lb        $v0, 0x4C($s6)
/* 41AE7C 802A60EC 50470001 */  beql      $v0, $a3, .L802A60F4_7ADA94
/* 41AE80 802A60F0 0280F02D */   daddu    $fp, $s4, $zero
.L802A60F4_7ADA94:
/* 41AE84 802A60F4 26940001 */  addiu     $s4, $s4, 0x1
.L802A60F8_7ADA98:
/* 41AE88 802A60F8 24020002 */  addiu     $v0, $zero, 0x2
/* 41AE8C 802A60FC 005E1023 */  subu      $v0, $v0, $fp
/* 41AE90 802A6100 3C01802B */  lui       $at, %hi(BattleMenu_NumOptions)
/* 41AE94 802A6104 AC34D0AC */  sw        $s4, %lo(BattleMenu_NumOptions)($at)
/* 41AE98 802A6108 3C01802B */  lui       $at, %hi(D_802AD0A8)
/* 41AE9C 802A610C AC20D0A8 */  sw        $zero, %lo(D_802AD0A8)($at)
/* 41AEA0 802A6110 3C01802B */  lui       $at, %hi(D_802AD0B0)
/* 41AEA4 802A6114 AC3ED0B0 */  sw        $fp, %lo(D_802AD0B0)($at)
/* 41AEA8 802A6118 3C01802B */  lui       $at, %hi(D_802AD100)
/* 41AEAC 802A611C AC22D100 */  sw        $v0, %lo(D_802AD100)($at)
/* 41AEB0 802A6120 0C0A9634 */  jal       func_802A58D0_7AD270
/* 41AEB4 802A6124 00000000 */   nop
/* 41AEB8 802A6128 10400006 */  beqz      $v0, .L802A6144_7ADAE4
/* 41AEBC 802A612C 00000000 */   nop
/* 41AEC0 802A6130 24020001 */  addiu     $v0, $zero, 0x1
/* 41AEC4 802A6134 3C01802B */  lui       $at, %hi(BattleMenu_ShowSwapIcons)
/* 41AEC8 802A6138 AC22D104 */  sw        $v0, %lo(BattleMenu_ShowSwapIcons)($at)
/* 41AECC 802A613C 080A9853 */  j         .L802A614C_7ADAEC
/* 41AED0 802A6140 00000000 */   nop
.L802A6144_7ADAE4:
/* 41AED4 802A6144 3C01802B */  lui       $at, %hi(BattleMenu_ShowSwapIcons)
/* 41AED8 802A6148 AC20D104 */  sw        $zero, %lo(BattleMenu_ShowSwapIcons)($at)
.L802A614C_7ADAEC:
/* 41AEDC 802A614C 0C0A8400 */  jal       func_802A1000_7A89A0
/* 41AEE0 802A6150 00000000 */   nop
/* 41AEE4 802A6154 24020008 */  addiu     $v0, $zero, 0x8
/* 41AEE8 802A6158 3C01802B */  lui       $at, %hi(D_802ACC60)
/* 41AEEC 802A615C AC22CC60 */  sw        $v0, %lo(D_802ACC60)($at)
/* 41AEF0 802A6160 3C01802B */  lui       $at, %hi(D_802ACC6C)
/* 41AEF4 802A6164 AC20CC6C */  sw        $zero, %lo(D_802ACC6C)($at)
/* 41AEF8 802A6168 080AA04F */  j         .L802A813C_7AFADC
/* 41AEFC 802A616C 24020001 */   addiu    $v0, $zero, 0x1
glabel .L802A6170_7ADB10
/* 41AF00 802A6170 82C2008B */  lb        $v0, 0x8B($s6)
/* 41AF04 802A6174 10400005 */  beqz      $v0, .L802A618C_7ADB2C
/* 41AF08 802A6178 0000202D */   daddu    $a0, $zero, $zero
/* 41AF0C 802A617C 0080282D */  daddu     $a1, $a0, $zero
/* 41AF10 802A6180 3C060001 */  lui       $a2, (0x10027 >> 16)
/* 41AF14 802A6184 080A9868 */  j         .L802A61A0_7ADB40
/* 41AF18 802A6188 34C60027 */   ori      $a2, $a2, (0x10027 & 0xFFFF)
.L802A618C_7ADB2C:
/* 41AF1C 802A618C 0C099751 */  jal       get_player_anim_for_status
/* 41AF20 802A6190 2404001C */   addiu    $a0, $zero, 0x1C
/* 41AF24 802A6194 0000202D */  daddu     $a0, $zero, $zero
/* 41AF28 802A6198 0080282D */  daddu     $a1, $a0, $zero
/* 41AF2C 802A619C 0040302D */  daddu     $a2, $v0, $zero
.L802A61A0_7ADB40:
/* 41AF30 802A61A0 0C098F3F */  jal       set_animation
/* 41AF34 802A61A4 00000000 */   nop
/* 41AF38 802A61A8 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41AF3C 802A61AC 00000000 */   nop
/* 41AF40 802A61B0 3C04802B */  lui       $a0, %hi(D_802ACC6C)
/* 41AF44 802A61B4 2484CC6C */  addiu     $a0, $a0, %lo(D_802ACC6C)
/* 41AF48 802A61B8 8C830000 */  lw        $v1, 0x0($a0)
/* 41AF4C 802A61BC 10600004 */  beqz      $v1, .L802A61D0_7ADB70
/* 41AF50 802A61C0 0040802D */   daddu    $s0, $v0, $zero
/* 41AF54 802A61C4 2462FFFF */  addiu     $v0, $v1, -0x1
/* 41AF58 802A61C8 080A98A3 */  j         .L802A628C_7ADC2C
/* 41AF5C 802A61CC AC820000 */   sw       $v0, 0x0($a0)
.L802A61D0_7ADB70:
/* 41AF60 802A61D0 3C02800E */  lui       $v0, %hi(gBattleStatus)
/* 41AF64 802A61D4 8C42C070 */  lw        $v0, %lo(gBattleStatus)($v0)
/* 41AF68 802A61D8 3C030200 */  lui       $v1, (0x2000000 >> 16)
/* 41AF6C 802A61DC 00431024 */  and       $v0, $v0, $v1
/* 41AF70 802A61E0 1440002A */  bnez      $v0, .L802A628C_7ADC2C
/* 41AF74 802A61E4 00000000 */   nop
/* 41AF78 802A61E8 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 41AF7C 802A61EC 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 41AF80 802A61F0 8C420010 */  lw        $v0, 0x10($v0)
/* 41AF84 802A61F4 30422000 */  andi      $v0, $v0, 0x2000
/* 41AF88 802A61F8 10400024 */  beqz      $v0, .L802A628C_7ADC2C
/* 41AF8C 802A61FC 00000000 */   nop
/* 41AF90 802A6200 0C0A9634 */  jal       func_802A58D0_7AD270
/* 41AF94 802A6204 00000000 */   nop
/* 41AF98 802A6208 10400013 */  beqz      $v0, .L802A6258_7ADBF8
/* 41AF9C 802A620C 24020001 */   addiu    $v0, $zero, 0x1
/* 41AFA0 802A6210 82C3008B */  lb        $v1, 0x8B($s6)
/* 41AFA4 802A6214 10620010 */  beq       $v1, $v0, .L802A6258_7ADBF8
/* 41AFA8 802A6218 00000000 */   nop
/* 41AFAC 802A621C 0C05272D */  jal       sfx_play_sound
/* 41AFB0 802A6220 2404000F */   addiu    $a0, $zero, 0xF
/* 41AFB4 802A6224 3C02802B */  lui       $v0, %hi(BattleMenu_CurPos)
/* 41AFB8 802A6228 8042D002 */  lb        $v0, %lo(BattleMenu_CurPos)($v0)
/* 41AFBC 802A622C 3C03802B */  lui       $v1, %hi(BattleMenu_HomePos)
/* 41AFC0 802A6230 8063D06B */  lb        $v1, %lo(BattleMenu_HomePos)($v1)
/* 41AFC4 802A6234 00431021 */  addu      $v0, $v0, $v1
/* 41AFC8 802A6238 00021080 */  sll       $v0, $v0, 2
/* 41AFCC 802A623C 3C01802B */  lui       $at, %hi(D_802AD0BB)
/* 41AFD0 802A6240 00220821 */  addu      $at, $at, $v0
/* 41AFD4 802A6244 9022D0BB */  lbu       $v0, %lo(D_802AD0BB)($at)
/* 41AFD8 802A6248 0C0A842E */  jal       func_802A10B8_7A8A58
/* 41AFDC 802A624C A2C2004C */   sb       $v0, 0x4C($s6)
/* 41AFE0 802A6250 080A9F71 */  j         .L802A7DC4_7AF764
/* 41AFE4 802A6254 00000000 */   nop
.L802A6258_7ADBF8:
/* 41AFE8 802A6258 122007BA */  beqz      $s1, .L802A8144_7AFAE4
/* 41AFEC 802A625C 3C030020 */   lui      $v1, (0x200000 >> 16)
/* 41AFF0 802A6260 8E220000 */  lw        $v0, 0x0($s1)
/* 41AFF4 802A6264 00431024 */  and       $v0, $v0, $v1
/* 41AFF8 802A6268 144007B6 */  bnez      $v0, .L802A8144_7AFAE4
/* 41AFFC 802A626C 24020001 */   addiu    $v0, $zero, 0x1
/* 41B000 802A6270 82C3008B */  lb        $v1, 0x8B($s6)
/* 41B004 802A6274 106207B3 */  beq       $v1, $v0, .L802A8144_7AFAE4
/* 41B008 802A6278 00000000 */   nop
/* 41B00C 802A627C 0C05272D */  jal       sfx_play_sound
/* 41B010 802A6280 2404021D */   addiu    $a0, $zero, 0x21D
/* 41B014 802A6284 080AA04F */  j         .L802A813C_7AFADC
/* 41B018 802A6288 24020008 */   addiu    $v0, $zero, 0x8
.L802A628C_7ADC2C:
/* 41B01C 802A628C 3C03802B */  lui       $v1, %hi(D_802ACC60)
/* 41B020 802A6290 2463CC60 */  addiu     $v1, $v1, %lo(D_802ACC60)
/* 41B024 802A6294 8C620000 */  lw        $v0, 0x0($v1)
/* 41B028 802A6298 5440058D */  bnel      $v0, $zero, .L802A78D0_7AF270
/* 41B02C 802A629C 2442FFFF */   addiu    $v0, $v0, -0x1
/* 41B030 802A62A0 120007A8 */  beqz      $s0, .L802A8144_7AFAE4
/* 41B034 802A62A4 0000202D */   daddu    $a0, $zero, $zero
/* 41B038 802A62A8 0080282D */  daddu     $a1, $a0, $zero
/* 41B03C 802A62AC 3C060001 */  lui       $a2, (0x10004 >> 16)
/* 41B040 802A62B0 0C098F3F */  jal       set_animation
/* 41B044 802A62B4 34C60004 */   ori      $a2, $a2, (0x10004 & 0xFFFF)
/* 41B048 802A62B8 2602FFFF */  addiu     $v0, $s0, -0x1
/* 41B04C 802A62BC 00021080 */  sll       $v0, $v0, 2
/* 41B050 802A62C0 3C01802B */  lui       $at, %hi(D_802AD0BB)
/* 41B054 802A62C4 00220821 */  addu      $at, $at, $v0
/* 41B058 802A62C8 9022D0BB */  lbu       $v0, %lo(D_802AD0BB)($at)
/* 41B05C 802A62CC 0000982D */  daddu     $s3, $zero, $zero
/* 41B060 802A62D0 A2C20048 */  sb        $v0, 0x48($s6)
/* 41B064 802A62D4 A2C2004C */  sb        $v0, 0x4C($s6)
/* 41B068 802A62D8 02D31021 */  addu      $v0, $s6, $s3
.L802A62DC_7ADC7C:
/* 41B06C 802A62DC 26730001 */  addiu     $s3, $s3, 0x1
/* 41B070 802A62E0 A04001DE */  sb        $zero, 0x1DE($v0)
/* 41B074 802A62E4 A6C001AE */  sh        $zero, 0x1AE($s6)
/* 41B078 802A62E8 A04001F6 */  sb        $zero, 0x1F6($v0)
/* 41B07C 802A62EC 2A620018 */  slti      $v0, $s3, 0x18
/* 41B080 802A62F0 1440FFFA */  bnez      $v0, .L802A62DC_7ADC7C
/* 41B084 802A62F4 02D31021 */   addu     $v0, $s6, $s3
/* 41B088 802A62F8 82C30048 */  lb        $v1, 0x48($s6)
/* 41B08C 802A62FC 24100001 */  addiu     $s0, $zero, 0x1
/* 41B090 802A6300 10700059 */  beq       $v1, $s0, .L802A6468_7ADE08
/* 41B094 802A6304 28620002 */   slti     $v0, $v1, 0x2
/* 41B098 802A6308 10400005 */  beqz      $v0, .L802A6320_7ADCC0
/* 41B09C 802A630C 24020002 */   addiu    $v0, $zero, 0x2
/* 41B0A0 802A6310 10600059 */  beqz      $v1, .L802A6478_7ADE18
/* 41B0A4 802A6314 00000000 */   nop
/* 41B0A8 802A6318 080A99AC */  j         .L802A66B0_7AE050
/* 41B0AC 802A631C 00000000 */   nop
.L802A6320_7ADCC0:
/* 41B0B0 802A6320 10620005 */  beq       $v1, $v0, .L802A6338_7ADCD8
/* 41B0B4 802A6324 24020008 */   addiu    $v0, $zero, 0x8
/* 41B0B8 802A6328 1062005E */  beq       $v1, $v0, .L802A64A4_7ADE44
/* 41B0BC 802A632C 24140001 */   addiu    $s4, $zero, 0x1
/* 41B0C0 802A6330 080A99AC */  j         .L802A66B0_7AE050
/* 41B0C4 802A6334 00000000 */   nop
.L802A6338_7ADCD8:
/* 41B0C8 802A6338 0000982D */  daddu     $s3, $zero, $zero
/* 41B0CC 802A633C 3C148008 */  lui       $s4, %hi(gItemTable)
/* 41B0D0 802A6340 269478E0 */  addiu     $s4, $s4, %lo(gItemTable)
/* 41B0D4 802A6344 24120002 */  addiu     $s2, $zero, 0x2
/* 41B0D8 802A6348 02A0882D */  daddu     $s1, $s5, $zero
/* 41B0DC 802A634C 3C03802B */  lui       $v1, %hi(D_802AB513)
/* 41B0E0 802A6350 9063B513 */  lbu       $v1, %lo(D_802AB513)($v1)
/* 41B0E4 802A6354 24020155 */  addiu     $v0, $zero, 0x155
/* 41B0E8 802A6358 A6C201AE */  sh        $v0, 0x1AE($s6)
/* 41B0EC 802A635C A2D001F6 */  sb        $s0, 0x1F6($s6)
/* 41B0F0 802A6360 A2C301DE */  sb        $v1, 0x1DE($s6)
.L802A6364_7ADD04:
/* 41B0F4 802A6364 862201B4 */  lh        $v0, 0x1B4($s1)
/* 41B0F8 802A6368 5040000B */  beql      $v0, $zero, .L802A6398_7ADD38
/* 41B0FC 802A636C 26730001 */   addiu    $s3, $s3, 0x1
/* 41B100 802A6370 00021140 */  sll       $v0, $v0, 5
/* 41B104 802A6374 A2D20178 */  sb        $s2, 0x178($s6)
/* 41B108 802A6378 962301B4 */  lhu       $v1, 0x1B4($s1)
/* 41B10C 802A637C 00548021 */  addu      $s0, $v0, $s4
/* 41B110 802A6380 A6C3017A */  sh        $v1, 0x17A($s6)
/* 41B114 802A6384 8E020008 */  lw        $v0, 0x8($s0)
/* 41B118 802A6388 02E0202D */  daddu     $a0, $s7, $zero
/* 41B11C 802A638C 0C098C0B */  jal       func_8026302C
/* 41B120 802A6390 AEC20184 */   sw       $v0, 0x184($s6)
/* 41B124 802A6394 26730001 */  addiu     $s3, $s3, 0x1
.L802A6398_7ADD38:
/* 41B128 802A6398 2A62000A */  slti      $v0, $s3, 0xA
/* 41B12C 802A639C 1440FFF1 */  bnez      $v0, .L802A6364_7ADD04
/* 41B130 802A63A0 26310002 */   addiu    $s1, $s1, 0x2
/* 41B134 802A63A4 24140001 */  addiu     $s4, $zero, 0x1
/* 41B138 802A63A8 0000982D */  daddu     $s3, $zero, $zero
/* 41B13C 802A63AC 3C0B8008 */  lui       $t3, %hi(gItemTable)
/* 41B140 802A63B0 256B78E0 */  addiu     $t3, $t3, %lo(gItemTable)
/* 41B144 802A63B4 3C0A8009 */  lui       $t2, %hi(gMoveTable)
/* 41B148 802A63B8 254AF060 */  addiu     $t2, $t2, %lo(gMoveTable)
/* 41B14C 802A63BC 3C09802B */  lui       $t1, %hi(D_802AB4F0_7B2E90)
/* 41B150 802A63C0 2529B4F0 */  addiu     $t1, $t1, %lo(D_802AB4F0_7B2E90)
/* 41B154 802A63C4 0280402D */  daddu     $t0, $s4, $zero
/* 41B158 802A63C8 02A0302D */  daddu     $a2, $s5, $zero
/* 41B15C 802A63CC 26C70002 */  addiu     $a3, $s6, 0x2
.L802A63D0_7ADD70:
/* 41B160 802A63D0 84C20208 */  lh        $v0, 0x208($a2)
/* 41B164 802A63D4 5040001C */  beql      $v0, $zero, .L802A6448_7ADDE8
/* 41B168 802A63D8 26730001 */   addiu    $s3, $s3, 0x1
/* 41B16C 802A63DC 00021140 */  sll       $v0, $v0, 5
/* 41B170 802A63E0 004B1021 */  addu      $v0, $v0, $t3
/* 41B174 802A63E4 9045001A */  lbu       $a1, 0x1A($v0)
/* 41B178 802A63E8 82C30048 */  lb        $v1, 0x48($s6)
/* 41B17C 802A63EC 00051080 */  sll       $v0, $a1, 2
/* 41B180 802A63F0 00451021 */  addu      $v0, $v0, $a1
/* 41B184 802A63F4 00021080 */  sll       $v0, $v0, 2
/* 41B188 802A63F8 004A9021 */  addu      $s2, $v0, $t2
/* 41B18C 802A63FC 00031880 */  sll       $v1, $v1, 2
/* 41B190 802A6400 00691821 */  addu      $v1, $v1, $t1
/* 41B194 802A6404 82440010 */  lb        $a0, 0x10($s2)
/* 41B198 802A6408 8C620000 */  lw        $v0, 0x0($v1)
/* 41B19C 802A640C 5482000E */  bnel      $a0, $v0, .L802A6448_7ADDE8
/* 41B1A0 802A6410 26730001 */   addiu    $s3, $s3, 0x1
/* 41B1A4 802A6414 02D42021 */  addu      $a0, $s6, $s4
/* 41B1A8 802A6418 A08501DE */  sb        $a1, 0x1DE($a0)
/* 41B1AC 802A641C 94C20208 */  lhu       $v0, 0x208($a2)
/* 41B1B0 802A6420 A4E201AE */  sh        $v0, 0x1AE($a3)
/* 41B1B4 802A6424 A08801F6 */  sb        $t0, 0x1F6($a0)
/* 41B1B8 802A6428 82A20005 */  lb        $v0, 0x5($s5)
/* 41B1BC 802A642C 82430011 */  lb        $v1, 0x11($s2)
/* 41B1C0 802A6430 0043102A */  slt       $v0, $v0, $v1
/* 41B1C4 802A6434 54400001 */  bnel      $v0, $zero, .L802A643C_7ADDDC
/* 41B1C8 802A6438 A08001F6 */   sb       $zero, 0x1F6($a0)
.L802A643C_7ADDDC:
/* 41B1CC 802A643C 24E70002 */  addiu     $a3, $a3, 0x2
/* 41B1D0 802A6440 26940001 */  addiu     $s4, $s4, 0x1
/* 41B1D4 802A6444 26730001 */  addiu     $s3, $s3, 0x1
.L802A6448_7ADDE8:
/* 41B1D8 802A6448 2A620040 */  slti      $v0, $s3, 0x40
/* 41B1DC 802A644C 1440FFE0 */  bnez      $v0, .L802A63D0_7ADD70
/* 41B1E0 802A6450 24C60002 */   addiu    $a2, $a2, 0x2
/* 41B1E4 802A6454 24020001 */  addiu     $v0, $zero, 0x1
/* 41B1E8 802A6458 16820095 */  bne       $s4, $v0, .L802A66B0_7AE050
/* 41B1EC 802A645C A2D4020E */   sb       $s4, 0x20E($s6)
/* 41B1F0 802A6460 080A99AC */  j         .L802A66B0_7AE050
/* 41B1F4 802A6464 A2C0020E */   sb       $zero, 0x20E($s6)
.L802A6468_7ADE08:
/* 41B1F8 802A6468 0C098DB9 */  jal       btl_init_menu_hammer
/* 41B1FC 802A646C 00000000 */   nop
/* 41B200 802A6470 080A9920 */  j         .L802A6480_7ADE20
/* 41B204 802A6474 00000000 */   nop
.L802A6478_7ADE18:
/* 41B208 802A6478 0C098D2E */  jal       btl_init_menu_boots
/* 41B20C 802A647C 00000000 */   nop
.L802A6480_7ADE20:
/* 41B210 802A6480 92C2020E */  lbu       $v0, 0x20E($s6)
/* 41B214 802A6484 50500001 */  beql      $v0, $s0, .L802A648C_7ADE2C
/* 41B218 802A6488 A2C0020E */   sb       $zero, 0x20E($s6)
.L802A648C_7ADE2C:
/* 41B21C 802A648C 82C30083 */  lb        $v1, 0x83($s6)
/* 41B220 802A6490 24020002 */  addiu     $v0, $zero, 0x2
/* 41B224 802A6494 50620086 */  beql      $v1, $v0, .L802A66B0_7AE050
/* 41B228 802A6498 A2C0020E */   sb       $zero, 0x20E($s6)
/* 41B22C 802A649C 080A99AC */  j         .L802A66B0_7AE050
/* 41B230 802A64A0 00000000 */   nop
.L802A64A4_7ADE44:
/* 41B234 802A64A4 0000982D */  daddu     $s3, $zero, $zero
/* 41B238 802A64A8 24020077 */  addiu     $v0, $zero, 0x77
/* 41B23C 802A64AC A2C201DE */  sb        $v0, 0x1DE($s6)
/* 41B240 802A64B0 82A3028E */  lb        $v1, 0x28E($s5)
/* 41B244 802A64B4 24020155 */  addiu     $v0, $zero, 0x155
/* 41B248 802A64B8 A6C201AE */  sh        $v0, 0x1AE($s6)
/* 41B24C 802A64BC 1860002B */  blez      $v1, .L802A656C_7ADF0C
/* 41B250 802A64C0 A2D001F6 */   sb       $s0, 0x1F6($s6)
/* 41B254 802A64C4 241E0008 */  addiu     $fp, $zero, 0x8
/* 41B258 802A64C8 3C038009 */  lui       $v1, %hi(D_8008F9C0)
/* 41B25C 802A64CC 2463F9C0 */  addiu     $v1, $v1, %lo(D_8008F9C0)
/* 41B260 802A64D0 26D10002 */  addiu     $s1, $s6, 0x2
.L802A64D4_7ADE74:
/* 41B264 802A64D4 0060902D */  daddu     $s2, $v1, $zero
/* 41B268 802A64D8 02D48021 */  addu      $s0, $s6, $s4
/* 41B26C 802A64DC 26620078 */  addiu     $v0, $s3, 0x78
/* 41B270 802A64E0 A20201DE */  sb        $v0, 0x1DE($s0)
/* 41B274 802A64E4 A62001AE */  sh        $zero, 0x1AE($s1)
/* 41B278 802A64E8 A2DE0178 */  sb        $fp, 0x178($s6)
/* 41B27C 802A64EC A6C2017A */  sh        $v0, 0x17A($s6)
/* 41B280 802A64F0 8E420004 */  lw        $v0, 0x4($s2)
/* 41B284 802A64F4 02E0202D */  daddu     $a0, $s7, $zero
/* 41B288 802A64F8 0C098C0B */  jal       func_8026302C
/* 41B28C 802A64FC AEC20184 */   sw       $v0, 0x184($s6)
/* 41B290 802A6500 24020001 */  addiu     $v0, $zero, 0x1
/* 41B294 802A6504 A20201F6 */  sb        $v0, 0x1F6($s0)
/* 41B298 802A6508 82E2040C */  lb        $v0, 0x40C($s7)
/* 41B29C 802A650C 14400002 */  bnez      $v0, .L802A6518_7ADEB8
/* 41B2A0 802A6510 2402FFFE */   addiu    $v0, $zero, -0x2
/* 41B2A4 802A6514 A20201F6 */  sb        $v0, 0x1F6($s0)
.L802A6518_7ADEB8:
/* 41B2A8 802A6518 86A20290 */  lh        $v0, 0x290($s5)
/* 41B2AC 802A651C 04420001 */  bltzl     $v0, .L802A6524_7ADEC4
/* 41B2B0 802A6520 244200FF */   addiu    $v0, $v0, 0xFF
.L802A6524_7ADEC4:
/* 41B2B4 802A6524 82430011 */  lb        $v1, 0x11($s2)
/* 41B2B8 802A6528 00021203 */  sra       $v0, $v0, 8
/* 41B2BC 802A652C 0043102A */  slt       $v0, $v0, $v1
/* 41B2C0 802A6530 54400001 */  bnel      $v0, $zero, .L802A6538_7ADED8
/* 41B2C4 802A6534 A20001F6 */   sb       $zero, 0x1F6($s0)
.L802A6538_7ADED8:
/* 41B2C8 802A6538 3C02800E */  lui       $v0, %hi(gBattleStatus + 0x4)
/* 41B2CC 802A653C 8C42C074 */  lw        $v0, %lo(gBattleStatus + 0x4)($v0)
/* 41B2D0 802A6540 30421000 */  andi      $v0, $v0, 0x1000
/* 41B2D4 802A6544 10400002 */  beqz      $v0, .L802A6550_7ADEF0
/* 41B2D8 802A6548 2402FFFF */   addiu    $v0, $zero, -0x1
/* 41B2DC 802A654C A20201F6 */  sb        $v0, 0x1F6($s0)
.L802A6550_7ADEF0:
/* 41B2E0 802A6550 26310002 */  addiu     $s1, $s1, 0x2
/* 41B2E4 802A6554 26940001 */  addiu     $s4, $s4, 0x1
/* 41B2E8 802A6558 82A2028E */  lb        $v0, 0x28E($s5)
/* 41B2EC 802A655C 26730001 */  addiu     $s3, $s3, 0x1
/* 41B2F0 802A6560 0262102A */  slt       $v0, $s3, $v0
/* 41B2F4 802A6564 1440FFDB */  bnez      $v0, .L802A64D4_7ADE74
/* 41B2F8 802A6568 26430014 */   addiu    $v1, $s2, 0x14
.L802A656C_7ADF0C:
/* 41B2FC 802A656C 82B10292 */  lb        $s1, 0x292($s5)
/* 41B300 802A6570 24020001 */  addiu     $v0, $zero, 0x1
/* 41B304 802A6574 16220024 */  bne       $s1, $v0, .L802A6608_7ADFA8
/* 41B308 802A6578 02D48021 */   addu     $s0, $s6, $s4
/* 41B30C 802A657C 3C128009 */  lui       $s2, %hi(D_8008FA4C)
D_802A6580_7ADF20:
/* 41B310 802A6580 2652FA4C */  addiu     $s2, $s2, %lo(D_8008FA4C)
/* 41B314 802A6584 2402007F */  addiu     $v0, $zero, 0x7F
/* 41B318 802A6588 A20201DE */  sb        $v0, 0x1DE($s0)
/* 41B31C 802A658C 00141040 */  sll       $v0, $s4, 1
/* 41B320 802A6590 02C21021 */  addu      $v0, $s6, $v0
/* 41B324 802A6594 A44001AE */  sh        $zero, 0x1AE($v0)
/* 41B328 802A6598 24020008 */  addiu     $v0, $zero, 0x8
/* 41B32C 802A659C A2C20178 */  sb        $v0, 0x178($s6)
/* 41B330 802A65A0 26620078 */  addiu     $v0, $s3, 0x78
/* 41B334 802A65A4 A6C2017A */  sh        $v0, 0x17A($s6)
/* 41B338 802A65A8 8E420004 */  lw        $v0, 0x4($s2)
/* 41B33C 802A65AC 02E0202D */  daddu     $a0, $s7, $zero
/* 41B340 802A65B0 0C098C0B */  jal       func_8026302C
/* 41B344 802A65B4 AEC20184 */   sw       $v0, 0x184($s6)
/* 41B348 802A65B8 A21101F6 */  sb        $s1, 0x1F6($s0)
/* 41B34C 802A65BC 82E2040C */  lb        $v0, 0x40C($s7)
/* 41B350 802A65C0 14400002 */  bnez      $v0, .L802A65CC_7ADF6C
/* 41B354 802A65C4 2402FFFE */   addiu    $v0, $zero, -0x2
/* 41B358 802A65C8 A20201F6 */  sb        $v0, 0x1F6($s0)
.L802A65CC_7ADF6C:
/* 41B35C 802A65CC 86A20290 */  lh        $v0, 0x290($s5)
/* 41B360 802A65D0 04420001 */  bltzl     $v0, .L802A65D8_7ADF78
/* 41B364 802A65D4 244200FF */   addiu    $v0, $v0, 0xFF
.L802A65D8_7ADF78:
/* 41B368 802A65D8 82430011 */  lb        $v1, 0x11($s2)
/* 41B36C 802A65DC 00021203 */  sra       $v0, $v0, 8
/* 41B370 802A65E0 0043102A */  slt       $v0, $v0, $v1
/* 41B374 802A65E4 54400001 */  bnel      $v0, $zero, .L802A65EC_7ADF8C
/* 41B378 802A65E8 A20001F6 */   sb       $zero, 0x1F6($s0)
.L802A65EC_7ADF8C:
/* 41B37C 802A65EC 3C02800E */  lui       $v0, %hi(gBattleStatus + 0x4)
/* 41B380 802A65F0 8C42C074 */  lw        $v0, %lo(gBattleStatus + 0x4)($v0)
/* 41B384 802A65F4 30421000 */  andi      $v0, $v0, 0x1000
D_802A65F8_7ADF98:
/* 41B388 802A65F8 10400002 */  beqz      $v0, .L802A6604_7ADFA4
/* 41B38C 802A65FC 2402FFFF */   addiu    $v0, $zero, -0x1
/* 41B390 802A6600 A20201F6 */  sb        $v0, 0x1F6($s0)
.L802A6604_7ADFA4:
/* 41B394 802A6604 26940001 */  addiu     $s4, $s4, 0x1
.L802A6608_7ADFA8:
/* 41B398 802A6608 82A30292 */  lb        $v1, 0x292($s5)
/* 41B39C 802A660C 24020002 */  addiu     $v0, $zero, 0x2
/* 41B3A0 802A6610 54620027 */  bnel      $v1, $v0, .L802A66B0_7AE050
/* 41B3A4 802A6614 A2D4020E */   sb       $s4, 0x20E($s6)
/* 41B3A8 802A6618 3C128009 */  lui       $s2, %hi(D_8008FA60)
/* 41B3AC 802A661C 2652FA60 */  addiu     $s2, $s2, %lo(D_8008FA60)
/* 41B3B0 802A6620 02D48021 */  addu      $s0, $s6, $s4
/* 41B3B4 802A6624 24020080 */  addiu     $v0, $zero, 0x80
/* 41B3B8 802A6628 A20201DE */  sb        $v0, 0x1DE($s0)
/* 41B3BC 802A662C 00141040 */  sll       $v0, $s4, 1
/* 41B3C0 802A6630 02C21021 */  addu      $v0, $s6, $v0
/* 41B3C4 802A6634 A44001AE */  sh        $zero, 0x1AE($v0)
/* 41B3C8 802A6638 24020008 */  addiu     $v0, $zero, 0x8
/* 41B3CC 802A663C A2C20178 */  sb        $v0, 0x178($s6)
D_802A6640_7ADFE0:
/* 41B3D0 802A6640 26620078 */  addiu     $v0, $s3, 0x78
/* 41B3D4 802A6644 A6C2017A */  sh        $v0, 0x17A($s6)
/* 41B3D8 802A6648 8E420004 */  lw        $v0, 0x4($s2)
/* 41B3DC 802A664C 02E0202D */  daddu     $a0, $s7, $zero
D_802A6650_7ADFF0:
/* 41B3E0 802A6650 0C098C0B */  jal       func_8026302C
/* 41B3E4 802A6654 AEC20184 */   sw       $v0, 0x184($s6)
/* 41B3E8 802A6658 24020001 */  addiu     $v0, $zero, 0x1
/* 41B3EC 802A665C A20201F6 */  sb        $v0, 0x1F6($s0)
D_802A6660_7AE000:
/* 41B3F0 802A6660 82E2040C */  lb        $v0, 0x40C($s7)
/* 41B3F4 802A6664 14400002 */  bnez      $v0, .L802A6670_7AE010
/* 41B3F8 802A6668 2402FFFE */   addiu    $v0, $zero, -0x2
/* 41B3FC 802A666C A20201F6 */  sb        $v0, 0x1F6($s0)
.L802A6670_7AE010:
/* 41B400 802A6670 86A20290 */  lh        $v0, 0x290($s5)
/* 41B404 802A6674 04420001 */  bltzl     $v0, .L802A667C_7AE01C
/* 41B408 802A6678 244200FF */   addiu    $v0, $v0, 0xFF
.L802A667C_7AE01C:
/* 41B40C 802A667C 82430011 */  lb        $v1, 0x11($s2)
/* 41B410 802A6680 00021203 */  sra       $v0, $v0, 8
/* 41B414 802A6684 0043102A */  slt       $v0, $v0, $v1
/* 41B418 802A6688 54400001 */  bnel      $v0, $zero, .L802A6690_7AE030
/* 41B41C 802A668C A20001F6 */   sb       $zero, 0x1F6($s0)
.L802A6690_7AE030:
/* 41B420 802A6690 3C02800E */  lui       $v0, %hi(gBattleStatus + 0x4)
/* 41B424 802A6694 8C42C074 */  lw        $v0, %lo(gBattleStatus + 0x4)($v0)
/* 41B428 802A6698 30421000 */  andi      $v0, $v0, 0x1000
/* 41B42C 802A669C 10400002 */  beqz      $v0, .L802A66A8_7AE048
D_802A66A0_7AE040:
/* 41B430 802A66A0 2402FFFF */   addiu    $v0, $zero, -0x1
/* 41B434 802A66A4 A20201F6 */  sb        $v0, 0x1F6($s0)
.L802A66A8_7AE048:
/* 41B438 802A66A8 26940001 */  addiu     $s4, $s4, 0x1
/* 41B43C 802A66AC A2D4020E */  sb        $s4, 0x20E($s6)
.L802A66B0_7AE050:
/* 41B440 802A66B0 82D00048 */  lb        $s0, 0x48($s6)
/* 41B444 802A66B4 24020008 */  addiu     $v0, $zero, 0x8
/* 41B448 802A66B8 16020003 */  bne       $s0, $v0, .L802A66C8_7AE068
/* 41B44C 802A66BC 24020007 */   addiu    $v0, $zero, 0x7
/* 41B450 802A66C0 080A9FE1 */  j         .L802A7F84_7AF924
/* 41B454 802A66C4 2402003C */   addiu    $v0, $zero, 0x3C
.L802A66C8_7AE068:
/* 41B458 802A66C8 16020012 */  bne       $s0, $v0, .L802A6714_7AE0B4
/* 41B45C 802A66CC 24020002 */   addiu    $v0, $zero, 0x2
/* 41B460 802A66D0 82C30083 */  lb        $v1, 0x83($s6)
/* 41B464 802A66D4 10620006 */  beq       $v1, $v0, .L802A66F0_7AE090
/* 41B468 802A66D8 3C030200 */   lui      $v1, (0x2000000 >> 16)
/* 41B46C 802A66DC 3C02800E */  lui       $v0, %hi(gBattleStatus)
/* 41B470 802A66E0 8C42C070 */  lw        $v0, %lo(gBattleStatus)($v0)
/* 41B474 802A66E4 00431024 */  and       $v0, $v0, $v1
/* 41B478 802A66E8 10400626 */  beqz      $v0, .L802A7F84_7AF924
/* 41B47C 802A66EC 240200C8 */   addiu    $v0, $zero, 0xC8
.L802A66F0_7AE090:
/* 41B480 802A66F0 0C0A842E */  jal       func_802A10B8_7A8A58
/* 41B484 802A66F4 00000000 */   nop
/* 41B488 802A66F8 24040012 */  addiu     $a0, $zero, 0x12
/* 41B48C 802A66FC A2D00178 */  sb        $s0, 0x178($s6)
/* 41B490 802A6700 A6C0017A */  sh        $zero, 0x17A($s6)
/* 41B494 802A6704 0C090464 */  jal       func_80241190
/* 41B498 802A6708 A6C0017C */   sh       $zero, 0x17C($s6)
/* 41B49C 802A670C 080AA051 */  j         .L802A8144_7AFAE4
/* 41B4A0 802A6710 00000000 */   nop
.L802A6714_7AE0B4:
/* 41B4A4 802A6714 92C2020E */  lbu       $v0, 0x20E($s6)
/* 41B4A8 802A6718 14400005 */  bnez      $v0, .L802A6730_7AE0D0
/* 41B4AC 802A671C 24020002 */   addiu    $v0, $zero, 0x2
/* 41B4B0 802A6720 16020686 */  bne       $s0, $v0, .L802A813C_7AFADC
/* 41B4B4 802A6724 2402000A */   addiu    $v0, $zero, 0xA
/* 41B4B8 802A6728 080A9FE1 */  j         .L802A7F84_7AF924
/* 41B4BC 802A672C 24020028 */   addiu    $v0, $zero, 0x28
.L802A6730_7AE0D0:
/* 41B4C0 802A6730 16000005 */  bnez      $s0, .L802A6748_7AE0E8
/* 41B4C4 802A6734 0000F02D */   daddu    $fp, $zero, $zero
/* 41B4C8 802A6738 82C2004D */  lb        $v0, 0x4D($s6)
/* 41B4CC 802A673C 04420001 */  bltzl     $v0, .L802A6744_7AE0E4
/* 41B4D0 802A6740 A2C0004D */   sb       $zero, 0x4D($s6)
.L802A6744_7AE0E4:
/* 41B4D4 802A6744 82DE004D */  lb        $fp, 0x4D($s6)
.L802A6748_7AE0E8:
/* 41B4D8 802A6748 82C30048 */  lb        $v1, 0x48($s6)
/* 41B4DC 802A674C 24020001 */  addiu     $v0, $zero, 0x1
/* 41B4E0 802A6750 14620007 */  bne       $v1, $v0, .L802A6770_7AE110
/* 41B4E4 802A6754 24020002 */   addiu    $v0, $zero, 0x2
/* 41B4E8 802A6758 82C2004E */  lb        $v0, 0x4E($s6)
/* 41B4EC 802A675C 04420001 */  bltzl     $v0, .L802A6764_7AE104
/* 41B4F0 802A6760 A2C0004E */   sb       $zero, 0x4E($s6)
.L802A6764_7AE104:
/* 41B4F4 802A6764 82DE004E */  lb        $fp, 0x4E($s6)
/* 41B4F8 802A6768 82C30048 */  lb        $v1, 0x48($s6)
/* 41B4FC 802A676C 24020002 */  addiu     $v0, $zero, 0x2
.L802A6770_7AE110:
/* 41B500 802A6770 14620005 */  bne       $v1, $v0, .L802A6788_7AE128
/* 41B504 802A6774 00000000 */   nop
/* 41B508 802A6778 82C2004F */  lb        $v0, 0x4F($s6)
/* 41B50C 802A677C 04420001 */  bltzl     $v0, .L802A6784_7AE124
/* 41B510 802A6780 A2C0004F */   sb       $zero, 0x4F($s6)
.L802A6784_7AE124:
/* 41B514 802A6784 82DE004F */  lb        $fp, 0x4F($s6)
.L802A6788_7AE128:
/* 41B518 802A6788 92C2020E */  lbu       $v0, 0x20E($s6)
/* 41B51C 802A678C 1040007A */  beqz      $v0, .L802A6978_7AE318
/* 41B520 802A6790 0000982D */   daddu    $s3, $zero, $zero
/* 41B524 802A6794 02D3A021 */  addu      $s4, $s6, $s3
.L802A6798_7AE138:
/* 41B528 802A6798 928201DE */  lbu       $v0, 0x1DE($s4)
/* 41B52C 802A679C 3C0E8009 */  lui       $t6, %hi(gMoveTable)
/* 41B530 802A67A0 25CEF060 */  addiu     $t6, $t6, %lo(gMoveTable)
/* 41B534 802A67A4 00021880 */  sll       $v1, $v0, 2
/* 41B538 802A67A8 00621821 */  addu      $v1, $v1, $v0
/* 41B53C 802A67AC 00031880 */  sll       $v1, $v1, 2
/* 41B540 802A67B0 00131040 */  sll       $v0, $s3, 1
/* 41B544 802A67B4 02C21021 */  addu      $v0, $s6, $v0
/* 41B548 802A67B8 006E9021 */  addu      $s2, $v1, $t6
/* 41B54C 802A67BC 3C0E8008 */  lui       $t6, %hi(gItemTable)
/* 41B550 802A67C0 25CE78E0 */  addiu     $t6, $t6, %lo(gItemTable)
/* 41B554 802A67C4 3C03802B */  lui       $v1, %hi(BattleMenu_Moves_OptionCantUseMessages)
/* 41B558 802A67C8 2463D5E8 */  addiu     $v1, $v1, %lo(BattleMenu_Moves_OptionCantUseMessages)
/* 41B55C 802A67CC 844201AE */  lh        $v0, 0x1AE($v0)
/* 41B560 802A67D0 02632021 */  addu      $a0, $s3, $v1
/* 41B564 802A67D4 00021140 */  sll       $v0, $v0, 5
/* 41B568 802A67D8 004E8021 */  addu      $s0, $v0, $t6
/* 41B56C 802A67DC 86020004 */  lh        $v0, 0x4($s0)
/* 41B570 802A67E0 3C0E8009 */  lui       $t6, %hi(gItemHudScripts)
/* 41B574 802A67E4 25CEA680 */  addiu     $t6, $t6, %lo(gItemHudScripts)
/* 41B578 802A67E8 A0800000 */  sb        $zero, 0x0($a0)
/* 41B57C 802A67EC 828301F6 */  lb        $v1, 0x1F6($s4)
/* 41B580 802A67F0 000210C0 */  sll       $v0, $v0, 3
/* 41B584 802A67F4 14600003 */  bnez      $v1, .L802A6804_7AE1A4
/* 41B588 802A67F8 004EA821 */   addu     $s5, $v0, $t6
/* 41B58C 802A67FC A0800000 */  sb        $zero, 0x0($a0)
/* 41B590 802A6800 828301F6 */  lb        $v1, 0x1F6($s4)
.L802A6804_7AE1A4:
/* 41B594 802A6804 2402FFFF */  addiu     $v0, $zero, -0x1
/* 41B598 802A6808 14620005 */  bne       $v1, $v0, .L802A6820_7AE1C0
/* 41B59C 802A680C 2402FFFE */   addiu    $v0, $zero, -0x2
/* 41B5A0 802A6810 A28001F6 */  sb        $zero, 0x1F6($s4)
/* 41B5A4 802A6814 240E0048 */  addiu     $t6, $zero, 0x48
/* 41B5A8 802A6818 A08E0000 */  sb        $t6, 0x0($a0)
/* 41B5AC 802A681C 828301F6 */  lb        $v1, 0x1F6($s4)
.L802A6820_7AE1C0:
/* 41B5B0 802A6820 14620003 */  bne       $v1, $v0, .L802A6830_7AE1D0
/* 41B5B4 802A6824 240E0048 */   addiu    $t6, $zero, 0x48
/* 41B5B8 802A6828 A28001F6 */  sb        $zero, 0x1F6($s4)
/* 41B5BC 802A682C A08E0000 */  sb        $t6, 0x0($a0)
.L802A6830_7AE1D0:
/* 41B5C0 802A6830 828301F6 */  lb        $v1, 0x1F6($s4)
/* 41B5C4 802A6834 2402FFFD */  addiu     $v0, $zero, -0x3
/* 41B5C8 802A6838 14620003 */  bne       $v1, $v0, .L802A6848_7AE1E8
/* 41B5CC 802A683C 24020054 */   addiu    $v0, $zero, 0x54
/* 41B5D0 802A6840 A28001F6 */  sb        $zero, 0x1F6($s4)
/* 41B5D4 802A6844 A0820000 */  sb        $v0, 0x0($a0)
.L802A6848_7AE1E8:
/* 41B5D8 802A6848 3C03802B */  lui       $v1, %hi(battle_menu_moveOptionIconScripts)
/* 41B5DC 802A684C 2463D260 */  addiu     $v1, $v1, %lo(battle_menu_moveOptionIconScripts)
/* 41B5E0 802A6850 00138080 */  sll       $s0, $s3, 2
/* 41B5E4 802A6854 8EA20000 */  lw        $v0, 0x0($s5)
/* 41B5E8 802A6858 02031821 */  addu      $v1, $s0, $v1
/* 41B5EC 802A685C AC620000 */  sw        $v0, 0x0($v1)
/* 41B5F0 802A6860 828201F6 */  lb        $v0, 0x1F6($s4)
/* 41B5F4 802A6864 14400003 */  bnez      $v0, .L802A6874_7AE214
/* 41B5F8 802A6868 00000000 */   nop
/* 41B5FC 802A686C 8EA20004 */  lw        $v0, 0x4($s5)
/* 41B600 802A6870 AC620000 */  sw        $v0, 0x0($v1)
.L802A6874_7AE214:
/* 41B604 802A6874 82420011 */  lb        $v0, 0x11($s2)
/* 41B608 802A6878 02E0202D */  daddu     $a0, $s7, $zero
/* 41B60C 802A687C 3C01802B */  lui       $at, %hi(battle_menu_moveOptionDisplayCosts)
/* 41B610 802A6880 00300821 */  addu      $at, $at, $s0
/* 41B614 802A6884 AC22D320 */  sw        $v0, %lo(battle_menu_moveOptionDisplayCosts)($at)
/* 41B618 802A6888 82420012 */  lb        $v0, 0x12($s2)
/* 41B61C 802A688C 24050018 */  addiu     $a1, $zero, 0x18
/* 41B620 802A6890 3C01802B */  lui       $at, %hi(BattleMenu_Moves_OptionSortPriority)
/* 41B624 802A6894 00330821 */  addu      $at, $at, $s3
/* 41B628 802A6898 A020D5D0 */  sb        $zero, %lo(BattleMenu_Moves_OptionSortPriority)($at)
/* 41B62C 802A689C 3C01802B */  lui       $at, %hi(battle_menu_moveOptionBPCosts)
/* 41B630 802A68A0 00300821 */  addu      $at, $at, $s0
/* 41B634 802A68A4 AC22D440 */  sw        $v0, %lo(battle_menu_moveOptionBPCosts)($at)
/* 41B638 802A68A8 3C02802B */  lui       $v0, %hi(battle_menu_moveOptionDisplayCostReductions)
/* 41B63C 802A68AC 2442D380 */  addiu     $v0, $v0, %lo(battle_menu_moveOptionDisplayCostReductions)
/* 41B640 802A68B0 02028821 */  addu      $s1, $s0, $v0
/* 41B644 802A68B4 3C02802B */  lui       $v0, %hi(battle_menu_moveOptionDisplayCostReductionColors)
/* 41B648 802A68B8 2442D3E0 */  addiu     $v0, $v0, %lo(battle_menu_moveOptionDisplayCostReductionColors)
/* 41B64C 802A68BC 0202A821 */  addu      $s5, $s0, $v0
/* 41B650 802A68C0 AE200000 */  sw        $zero, 0x0($s1)
/* 41B654 802A68C4 0C099CAB */  jal       player_team_is_ability_active
/* 41B658 802A68C8 AEA00000 */   sw       $zero, 0x0($s5)
/* 41B65C 802A68CC 10400008 */  beqz      $v0, .L802A68F0_7AE290
/* 41B660 802A68D0 02E0202D */   daddu    $a0, $s7, $zero
/* 41B664 802A68D4 0C099CAB */  jal       player_team_is_ability_active
/* 41B668 802A68D8 24050018 */   addiu    $a1, $zero, 0x18
/* 41B66C 802A68DC 8E230000 */  lw        $v1, 0x0($s1)
/* 41B670 802A68E0 00621821 */  addu      $v1, $v1, $v0
/* 41B674 802A68E4 24020001 */  addiu     $v0, $zero, 0x1
/* 41B678 802A68E8 AE230000 */  sw        $v1, 0x0($s1)
/* 41B67C 802A68EC AEA20000 */  sw        $v0, 0x0($s5)
.L802A68F0_7AE290:
/* 41B680 802A68F0 02E0202D */  daddu     $a0, $s7, $zero
/* 41B684 802A68F4 0C099CAB */  jal       player_team_is_ability_active
/* 41B688 802A68F8 24050026 */   addiu    $a1, $zero, 0x26
/* 41B68C 802A68FC 10400009 */  beqz      $v0, .L802A6924_7AE2C4
/* 41B690 802A6900 02E0202D */   daddu    $a0, $s7, $zero
/* 41B694 802A6904 0C099CAB */  jal       player_team_is_ability_active
/* 41B698 802A6908 24050026 */   addiu    $a1, $zero, 0x26
/* 41B69C 802A690C 8E230000 */  lw        $v1, 0x0($s1)
/* 41B6A0 802A6910 00021040 */  sll       $v0, $v0, 1
/* 41B6A4 802A6914 00621821 */  addu      $v1, $v1, $v0
/* 41B6A8 802A6918 24020002 */  addiu     $v0, $zero, 0x2
/* 41B6AC 802A691C AE230000 */  sw        $v1, 0x0($s1)
/* 41B6B0 802A6920 AEA20000 */  sw        $v0, 0x0($s5)
.L802A6924_7AE2C4:
/* 41B6B4 802A6924 3C01802B */  lui       $at, %hi(BattleMenu_Moves_OptionIndices)
/* 41B6B8 802A6928 00300821 */  addu      $at, $at, $s0
/* 41B6BC 802A692C AC33D4B0 */  sw        $s3, %lo(BattleMenu_Moves_OptionIndices)($at)
/* 41B6C0 802A6930 828201F6 */  lb        $v0, 0x1F6($s4)
/* 41B6C4 802A6934 3C01802B */  lui       $at, %hi(BattleMenu_Moves_OptionEnabled)
/* 41B6C8 802A6938 00300821 */  addu      $at, $at, $s0
/* 41B6CC 802A693C AC22D510 */  sw        $v0, %lo(BattleMenu_Moves_OptionEnabled)($at)
/* 41B6D0 802A6940 8E420000 */  lw        $v0, 0x0($s2)
/* 41B6D4 802A6944 3C01802B */  lui       $at, %hi(battle_menu_moveOptionNames)
/* 41B6D8 802A6948 00300821 */  addu      $at, $at, $s0
/* 41B6DC 802A694C AC22D2C0 */  sw        $v0, %lo(battle_menu_moveOptionNames)($at)
/* 41B6E0 802A6950 8E420008 */  lw        $v0, 0x8($s2)
/* 41B6E4 802A6954 3C01802B */  lui       $at, %hi(BattleMenu_Moves_OptionDescMessages)
/* 41B6E8 802A6958 00300821 */  addu      $at, $at, $s0
/* 41B6EC 802A695C AC22D570 */  sw        $v0, %lo(BattleMenu_Moves_OptionDescMessages)($at)
/* 41B6F0 802A6960 92C2020E */  lbu       $v0, 0x20E($s6)
/* 41B6F4 802A6964 26730001 */  addiu     $s3, $s3, 0x1
/* 41B6F8 802A6968 0262102A */  slt       $v0, $s3, $v0
/* 41B6FC 802A696C 1440FF8A */  bnez      $v0, .L802A6798_7AE138
/* 41B700 802A6970 02D3A021 */   addu     $s4, $s6, $s3
/* 41B704 802A6974 92C2020E */  lbu       $v0, 0x20E($s6)
.L802A6978_7AE318:
/* 41B708 802A6978 3C01802B */  lui       $at, %hi(BattleMenu_UsingSpiritsSubmenu)
/* 41B70C 802A697C AC20D4A0 */  sw        $zero, %lo(BattleMenu_UsingSpiritsSubmenu)($at)
/* 41B710 802A6980 3C01802B */  lui       $at, %hi(D_802AD4A8)
/* 41B714 802A6984 AC3ED4A8 */  sw        $fp, %lo(D_802AD4A8)($at)
/* 41B718 802A6988 3C01802B */  lui       $at, %hi(BattleMenu_Moves_OptionCount)
/* 41B71C 802A698C AC22D4A4 */  sw        $v0, %lo(BattleMenu_Moves_OptionCount)($at)
/* 41B720 802A6990 0C0A89A1 */  jal       func_802A2684_7AA024
/* 41B724 802A6994 00000000 */   nop
/* 41B728 802A6998 080AA04F */  j         .L802A813C_7AFADC
/* 41B72C 802A699C 24020002 */   addiu    $v0, $zero, 0x2
glabel .L802A69A0_7AE340
/* 41B730 802A69A0 0C0A8B21 */  jal       func_802A2C84_7AA624
/* 41B734 802A69A4 00000000 */   nop
/* 41B738 802A69A8 0040802D */  daddu     $s0, $v0, $zero
/* 41B73C 802A69AC 2402FFFF */  addiu     $v0, $zero, -0x1
/* 41B740 802A69B0 120205E2 */  beq       $s0, $v0, .L802A813C_7AFADC
/* 41B744 802A69B4 24020007 */   addiu    $v0, $zero, 0x7
/* 41B748 802A69B8 120005E2 */  beqz      $s0, .L802A8144_7AFAE4
/* 41B74C 802A69BC 240200FF */   addiu    $v0, $zero, 0xFF
/* 41B750 802A69C0 5602000B */  bnel      $s0, $v0, .L802A69F0_7AE390
/* 41B754 802A69C4 2602FFFF */   addiu    $v0, $s0, -0x1
/* 41B758 802A69C8 0C0A8414 */  jal       func_802A1050_7A89F0
/* 41B75C 802A69CC 00000000 */   nop
/* 41B760 802A69D0 24020008 */  addiu     $v0, $zero, 0x8
/* 41B764 802A69D4 3C01802B */  lui       $at, %hi(D_802ACC60)
/* 41B768 802A69D8 AC22CC60 */  sw        $v0, %lo(D_802ACC60)($at)
/* 41B76C 802A69DC 24020004 */  addiu     $v0, $zero, 0x4
/* 41B770 802A69E0 3C01802B */  lui       $at, %hi(D_802ACC6C)
/* 41B774 802A69E4 AC22CC6C */  sw        $v0, %lo(D_802ACC6C)($at)
/* 41B778 802A69E8 080A9FE1 */  j         .L802A7F84_7AF924
/* 41B77C 802A69EC 24020001 */   addiu    $v0, $zero, 0x1
.L802A69F0_7AE390:
/* 41B780 802A69F0 00021080 */  sll       $v0, $v0, 2
/* 41B784 802A69F4 3C01802B */  lui       $at, %hi(D_802AD4B3)
/* 41B788 802A69F8 00220821 */  addu      $at, $at, $v0
/* 41B78C 802A69FC 9022D4B3 */  lbu       $v0, %lo(D_802AD4B3)($at)
/* 41B790 802A6A00 82C30048 */  lb        $v1, 0x48($s6)
/* 41B794 802A6A04 A2C20049 */  sb        $v0, 0x49($s6)
/* 41B798 802A6A08 00021600 */  sll       $v0, $v0, 24
/* 41B79C 802A6A0C 00021603 */  sra       $v0, $v0, 24
/* 41B7A0 802A6A10 02C21021 */  addu      $v0, $s6, $v0
/* 41B7A4 802A6A14 904201DE */  lbu       $v0, 0x1DE($v0)
/* 41B7A8 802A6A18 14600004 */  bnez      $v1, .L802A6A2C_7AE3CC
/* 41B7AC 802A6A1C A6C2017C */   sh       $v0, 0x17C($s6)
/* 41B7B0 802A6A20 3C02802B */  lui       $v0, %hi(D_802AD603)
/* 41B7B4 802A6A24 9042D603 */  lbu       $v0, %lo(D_802AD603)($v0)
/* 41B7B8 802A6A28 A2C2004D */  sb        $v0, 0x4D($s6)
.L802A6A2C_7AE3CC:
/* 41B7BC 802A6A2C 82C30048 */  lb        $v1, 0x48($s6)
/* 41B7C0 802A6A30 24020001 */  addiu     $v0, $zero, 0x1
/* 41B7C4 802A6A34 14620004 */  bne       $v1, $v0, .L802A6A48_7AE3E8
/* 41B7C8 802A6A38 00000000 */   nop
/* 41B7CC 802A6A3C 3C02802B */  lui       $v0, %hi(D_802AD603)
/* 41B7D0 802A6A40 9042D603 */  lbu       $v0, %lo(D_802AD603)($v0)
/* 41B7D4 802A6A44 A2C2004E */  sb        $v0, 0x4E($s6)
.L802A6A48_7AE3E8:
/* 41B7D8 802A6A48 82C40048 */  lb        $a0, 0x48($s6)
/* 41B7DC 802A6A4C 24020002 */  addiu     $v0, $zero, 0x2
/* 41B7E0 802A6A50 14820007 */  bne       $a0, $v0, .L802A6A70_7AE410
/* 41B7E4 802A6A54 0080182D */   daddu    $v1, $a0, $zero
/* 41B7E8 802A6A58 3C02802B */  lui       $v0, %hi(D_802AD603)
/* 41B7EC 802A6A5C 9042D603 */  lbu       $v0, %lo(D_802AD603)($v0)
/* 41B7F0 802A6A60 14640003 */  bne       $v1, $a0, .L802A6A70_7AE410
/* 41B7F4 802A6A64 A2C2004F */   sb       $v0, 0x4F($s6)
/* 41B7F8 802A6A68 080A9FE1 */  j         .L802A7F84_7AF924
/* 41B7FC 802A6A6C 24020014 */   addiu    $v0, $zero, 0x14
.L802A6A70_7AE410:
/* 41B800 802A6A70 0C0A89F4 */  jal       D_802A27D0_7AA170
/* 41B804 802A6A74 00000000 */   nop
/* 41B808 802A6A78 0C0A840C */  jal       func_802A1030_7A89D0
/* 41B80C 802A6A7C 00000000 */   nop
/* 41B810 802A6A80 080AA04F */  j         .L802A813C_7AFADC
/* 41B814 802A6A84 24020003 */   addiu    $v0, $zero, 0x3
glabel .L802A6A88_7AE428
/* 41B818 802A6A88 0C0A8B21 */  jal       func_802A2C84_7AA624
/* 41B81C 802A6A8C 00000000 */   nop
/* 41B820 802A6A90 8EC30214 */  lw        $v1, 0x214($s6)
/* 41B824 802A6A94 30634000 */  andi      $v1, $v1, 0x4000
/* 41B828 802A6A98 10600009 */  beqz      $v1, .L802A6AC0_7AE460
/* 41B82C 802A6A9C 0040802D */   daddu    $s0, $v0, $zero
/* 41B830 802A6AA0 16000007 */  bnez      $s0, .L802A6AC0_7AE460
/* 41B834 802A6AA4 00000000 */   nop
/* 41B838 802A6AA8 0C0A8AAE */  jal       func_802A2AB8_7AA458
/* 41B83C 802A6AAC 00000000 */   nop
/* 41B840 802A6AB0 0C0A8426 */  jal       func_802A1098_7A8A38
/* 41B844 802A6AB4 00000000 */   nop
/* 41B848 802A6AB8 080AA04F */  j         .L802A813C_7AFADC
/* 41B84C 802A6ABC 24020004 */   addiu    $v0, $zero, 0x4
.L802A6AC0_7AE460:
/* 41B850 802A6AC0 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41B854 802A6AC4 00000000 */   nop
/* 41B858 802A6AC8 1040059E */  beqz      $v0, .L802A8144_7AFAE4
/* 41B85C 802A6ACC 24020005 */   addiu    $v0, $zero, 0x5
/* 41B860 802A6AD0 A6C2006C */  sh        $v0, 0x6C($s6)
/* 41B864 802A6AD4 82C20049 */  lb        $v0, 0x49($s6)
/* 41B868 802A6AD8 24030006 */  addiu     $v1, $zero, 0x6
/* 41B86C 802A6ADC A6C3006E */  sh        $v1, 0x6E($s6)
/* 41B870 802A6AE0 02C21021 */  addu      $v0, $s6, $v0
/* 41B874 802A6AE4 904301DE */  lbu       $v1, 0x1DE($v0)
/* 41B878 802A6AE8 82C20049 */  lb        $v0, 0x49($s6)
/* 41B87C 802A6AEC 02C21021 */  addu      $v0, $s6, $v0
/* 41B880 802A6AF0 A6C3017C */  sh        $v1, 0x17C($s6)
/* 41B884 802A6AF4 904301DE */  lbu       $v1, 0x1DE($v0)
/* 41B888 802A6AF8 82D00048 */  lb        $s0, 0x48($s6)
/* 41B88C 802A6AFC 00031080 */  sll       $v0, $v1, 2
/* 41B890 802A6B00 00431021 */  addu      $v0, $v0, $v1
/* 41B894 802A6B04 00021080 */  sll       $v0, $v0, 2
/* 41B898 802A6B08 3C018009 */  lui       $at, %hi(D_8008F064)
/* 41B89C 802A6B0C 00220821 */  addu      $at, $at, $v0
/* 41B8A0 802A6B10 8C22F064 */  lw        $v0, %lo(D_8008F064)($at)
/* 41B8A4 802A6B14 AEC20184 */  sw        $v0, 0x184($s6)
/* 41B8A8 802A6B18 24020001 */  addiu     $v0, $zero, 0x1
/* 41B8AC 802A6B1C 1202000E */  beq       $s0, $v0, .L802A6B58_7AE4F8
/* 41B8B0 802A6B20 2A020002 */   slti     $v0, $s0, 0x2
/* 41B8B4 802A6B24 50400005 */  beql      $v0, $zero, .L802A6B3C_7AE4DC
/* 41B8B8 802A6B28 24020004 */   addiu    $v0, $zero, 0x4
/* 41B8BC 802A6B2C 12000007 */  beqz      $s0, .L802A6B4C_7AE4EC
/* 41B8C0 802A6B30 24040011 */   addiu    $a0, $zero, 0x11
/* 41B8C4 802A6B34 080AA051 */  j         .L802A8144_7AFAE4
/* 41B8C8 802A6B38 00000000 */   nop
.L802A6B3C_7AE4DC:
/* 41B8CC 802A6B3C 1202000F */  beq       $s0, $v0, .L802A6B7C_7AE51C
/* 41B8D0 802A6B40 00000000 */   nop
/* 41B8D4 802A6B44 080AA051 */  j         .L802A8144_7AFAE4
/* 41B8D8 802A6B48 00000000 */   nop
.L802A6B4C_7AE4EC:
/* 41B8DC 802A6B4C 92A20000 */  lbu       $v0, 0x0($s5)
/* 41B8E0 802A6B50 080A9AD9 */  j         .L802A6B64_7AE504
/* 41B8E4 802A6B54 A2C00178 */   sb       $zero, 0x178($s6)
.L802A6B58_7AE4F8:
/* 41B8E8 802A6B58 92A20001 */  lbu       $v0, 0x1($s5)
/* 41B8EC 802A6B5C 24040011 */  addiu     $a0, $zero, 0x11
/* 41B8F0 802A6B60 A2D00178 */  sb        $s0, 0x178($s6)
.L802A6B64_7AE504:
/* 41B8F4 802A6B64 00021600 */  sll       $v0, $v0, 24
/* 41B8F8 802A6B68 00021603 */  sra       $v0, $v0, 24
/* 41B8FC 802A6B6C 0C090464 */  jal       func_80241190
/* 41B900 802A6B70 A6C2017A */   sh       $v0, 0x17A($s6)
/* 41B904 802A6B74 080AA051 */  j         .L802A8144_7AFAE4
/* 41B908 802A6B78 00000000 */   nop
.L802A6B7C_7AE51C:
/* 41B90C 802A6B7C 86C2006E */  lh        $v0, 0x6E($s6)
/* 41B910 802A6B80 3C01800E */  lui       $at, %hi(gBattleSubState)
/* 41B914 802A6B84 AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
/* 41B918 802A6B88 0C0A9662 */  jal       func_802A5988_7AD328
/* 41B91C 802A6B8C 00000000 */   nop
/* 41B920 802A6B90 080A9F69 */  j         .L802A7DA4_7AF744
/* 41B924 802A6B94 24040019 */   addiu    $a0, $zero, 0x19
glabel .L802A6B98_7AE538
/* 41B928 802A6B98 0C0A8B21 */  jal       func_802A2C84_7AA624
/* 41B92C 802A6B9C 00000000 */   nop
/* 41B930 802A6BA0 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41B934 802A6BA4 00000000 */   nop
/* 41B938 802A6BA8 10400566 */  beqz      $v0, .L802A8144_7AFAE4
/* 41B93C 802A6BAC 24020002 */   addiu    $v0, $zero, 0x2
/* 41B940 802A6BB0 080AA04F */  j         .L802A813C_7AFADC
/* 41B944 802A6BB4 00000000 */   nop
glabel .L802A6BB8_7AE558
/* 41B948 802A6BB8 0C0A8AAE */  jal       func_802A2AB8_7AA458
/* 41B94C 802A6BBC 00000000 */   nop
/* 41B950 802A6BC0 0C0A8426 */  jal       func_802A1098_7A8A38
/* 41B954 802A6BC4 00000000 */   nop
/* 41B958 802A6BC8 080AA04F */  j         .L802A813C_7AFADC
/* 41B95C 802A6BCC 24020004 */   addiu    $v0, $zero, 0x4
glabel .L802A6BD0_7AE570
/* 41B960 802A6BD0 0C0A8B21 */  jal       func_802A2C84_7AA624
/* 41B964 802A6BD4 00000000 */   nop
/* 41B968 802A6BD8 2403FFFF */  addiu     $v1, $zero, -0x1
/* 41B96C 802A6BDC 10430559 */  beq       $v0, $v1, .L802A8144_7AFAE4
/* 41B970 802A6BE0 24020002 */   addiu    $v0, $zero, 0x2
/* 41B974 802A6BE4 080AA04F */  j         .L802A813C_7AFADC
/* 41B978 802A6BE8 00000000 */   nop
glabel .L802A6BEC_7AE58C
/* 41B97C 802A6BEC 3C02800E */  lui       $v0, %hi(gBattleStatus + 0x4)
/* 41B980 802A6BF0 8C42C074 */  lw        $v0, %lo(gBattleStatus + 0x4)($v0)
/* 41B984 802A6BF4 30420004 */  andi      $v0, $v0, 0x4
/* 41B988 802A6BF8 10400004 */  beqz      $v0, .L802A6C0C_7AE5AC
/* 41B98C 802A6BFC 24040050 */   addiu    $a0, $zero, 0x50
/* 41B990 802A6C00 2405003C */  addiu     $a1, $zero, 0x3C
/* 41B994 802A6C04 080A9B06 */  j         .L802A6C18_7AE5B8
/* 41B998 802A6C08 0000302D */   daddu    $a2, $zero, $zero
.L802A6C0C_7AE5AC:
/* 41B99C 802A6C0C 24040051 */  addiu     $a0, $zero, 0x51
/* 41B9A0 802A6C10 82A60012 */  lb        $a2, 0x12($s5)
/* 41B9A4 802A6C14 2405003C */  addiu     $a1, $zero, 0x3C
.L802A6C18_7AE5B8:
/* 41B9A8 802A6C18 0C093E81 */  jal       func_8024FA04
/* 41B9AC 802A6C1C 00000000 */   nop
/* 41B9B0 802A6C20 24020001 */  addiu     $v0, $zero, 0x1
/* 41B9B4 802A6C24 3C01802B */  lui       $at, %hi(D_802AD607)
/* 41B9B8 802A6C28 A022D607 */  sb        $v0, %lo(D_802AD607)($at)
/* 41B9BC 802A6C2C 080AA04F */  j         .L802A813C_7AFADC
/* 41B9C0 802A6C30 24020009 */   addiu    $v0, $zero, 0x9
glabel .L802A6C34_7AE5D4
/* 41B9C4 802A6C34 0C093EAD */  jal       func_8024FAB4
/* 41B9C8 802A6C38 00000000 */   nop
/* 41B9CC 802A6C3C 14400541 */  bnez      $v0, .L802A8144_7AFAE4
/* 41B9D0 802A6C40 24020004 */   addiu    $v0, $zero, 0x4
/* 41B9D4 802A6C44 3C01802B */  lui       $at, %hi(D_802ACC6C)
/* 41B9D8 802A6C48 AC22CC6C */  sw        $v0, %lo(D_802ACC6C)($at)
/* 41B9DC 802A6C4C 3C01802B */  lui       $at, %hi(D_802AD607)
/* 41B9E0 802A6C50 A020D607 */  sb        $zero, %lo(D_802AD607)($at)
/* 41B9E4 802A6C54 3C01802B */  lui       $at, %hi(D_802ACC60)
/* 41B9E8 802A6C58 AC20CC60 */  sw        $zero, %lo(D_802ACC60)($at)
/* 41B9EC 802A6C5C 080AA04F */  j         .L802A813C_7AFADC
/* 41B9F0 802A6C60 24020001 */   addiu    $v0, $zero, 0x1
glabel .L802A6C64_7AE604
/* 41B9F4 802A6C64 0C0A840C */  jal       func_802A1030_7A89D0
/* 41B9F8 802A6C68 00000000 */   nop
/* 41B9FC 802A6C6C 080AA04F */  j         .L802A813C_7AFADC
/* 41BA00 802A6C70 2402000B */   addiu    $v0, $zero, 0xB
glabel .L802A6C74_7AE614
/* 41BA04 802A6C74 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41BA08 802A6C78 00000000 */   nop
/* 41BA0C 802A6C7C 8EC30214 */  lw        $v1, 0x214($s6)
/* 41BA10 802A6C80 30634000 */  andi      $v1, $v1, 0x4000
/* 41BA14 802A6C84 10600007 */  beqz      $v1, .L802A6CA4_7AE644
/* 41BA18 802A6C88 0040802D */   daddu    $s0, $v0, $zero
/* 41BA1C 802A6C8C 16000007 */  bnez      $s0, .L802A6CAC_7AE64C
/* 41BA20 802A6C90 00000000 */   nop
/* 41BA24 802A6C94 0C0A841E */  jal       func_802A1078_7A8A18
/* 41BA28 802A6C98 00000000 */   nop
/* 41BA2C 802A6C9C 080AA04F */  j         .L802A813C_7AFADC
/* 41BA30 802A6CA0 2402000C */   addiu    $v0, $zero, 0xC
.L802A6CA4_7AE644:
/* 41BA34 802A6CA4 12000527 */  beqz      $s0, .L802A8144_7AFAE4
/* 41BA38 802A6CA8 00000000 */   nop
.L802A6CAC_7AE64C:
/* 41BA3C 802A6CAC 82C40048 */  lb        $a0, 0x48($s6)
/* 41BA40 802A6CB0 2402000D */  addiu     $v0, $zero, 0xD
/* 41BA44 802A6CB4 A6C2006C */  sh        $v0, 0x6C($s6)
/* 41BA48 802A6CB8 2402000E */  addiu     $v0, $zero, 0xE
/* 41BA4C 802A6CBC 10800006 */  beqz      $a0, .L802A6CD8_7AE678
/* 41BA50 802A6CC0 A6C2006E */   sh       $v0, 0x6E($s6)
/* 41BA54 802A6CC4 24020001 */  addiu     $v0, $zero, 0x1
/* 41BA58 802A6CC8 1082000C */  beq       $a0, $v0, .L802A6CFC_7AE69C
/* 41BA5C 802A6CCC 00000000 */   nop
/* 41BA60 802A6CD0 080A9B56 */  j         .L802A6D58_7AE6F8
/* 41BA64 802A6CD4 00000000 */   nop
.L802A6CD8_7AE678:
/* 41BA68 802A6CD8 92A30000 */  lbu       $v1, 0x0($s5)
/* 41BA6C 802A6CDC A2C00178 */  sb        $zero, 0x178($s6)
/* 41BA70 802A6CE0 92A20000 */  lbu       $v0, 0x0($s5)
/* 41BA74 802A6CE4 00031E00 */  sll       $v1, $v1, 24
/* 41BA78 802A6CE8 00031E03 */  sra       $v1, $v1, 24
/* 41BA7C 802A6CEC 00021600 */  sll       $v0, $v0, 24
/* 41BA80 802A6CF0 00021603 */  sra       $v0, $v0, 24
/* 41BA84 802A6CF4 080A9B47 */  j         .L802A6D1C_7AE6BC
/* 41BA88 802A6CF8 2442001A */   addiu    $v0, $v0, 0x1A
.L802A6CFC_7AE69C:
/* 41BA8C 802A6CFC 92A30001 */  lbu       $v1, 0x1($s5)
/* 41BA90 802A6D00 A2C40178 */  sb        $a0, 0x178($s6)
/* 41BA94 802A6D04 92A20001 */  lbu       $v0, 0x1($s5)
/* 41BA98 802A6D08 00031E00 */  sll       $v1, $v1, 24
/* 41BA9C 802A6D0C 00031E03 */  sra       $v1, $v1, 24
/* 41BAA0 802A6D10 00021600 */  sll       $v0, $v0, 24
/* 41BAA4 802A6D14 00021603 */  sra       $v0, $v0, 24
/* 41BAA8 802A6D18 24420003 */  addiu     $v0, $v0, 0x3
.L802A6D1C_7AE6BC:
/* 41BAAC 802A6D1C A6C2017C */  sh        $v0, 0x17C($s6)
/* 41BAB0 802A6D20 00021400 */  sll       $v0, $v0, 16
/* 41BAB4 802A6D24 00021403 */  sra       $v0, $v0, 16
/* 41BAB8 802A6D28 A6C3017A */  sh        $v1, 0x17A($s6)
/* 41BABC 802A6D2C 00021880 */  sll       $v1, $v0, 2
/* 41BAC0 802A6D30 00621821 */  addu      $v1, $v1, $v0
/* 41BAC4 802A6D34 00031880 */  sll       $v1, $v1, 2
/* 41BAC8 802A6D38 3C028009 */  lui       $v0, %hi(D_8008F064)
/* 41BACC 802A6D3C 00431021 */  addu      $v0, $v0, $v1
/* 41BAD0 802A6D40 8C42F064 */  lw        $v0, %lo(D_8008F064)($v0)
/* 41BAD4 802A6D44 24040011 */  addiu     $a0, $zero, 0x11
/* 41BAD8 802A6D48 0C090464 */  jal       func_80241190
/* 41BADC 802A6D4C AEC20184 */   sw       $v0, 0x184($s6)
/* 41BAE0 802A6D50 080AA051 */  j         .L802A8144_7AFAE4
/* 41BAE4 802A6D54 00000000 */   nop
glabel .L802A6D58_7AE6F8
/* 41BAE8 802A6D58 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41BAEC 802A6D5C 00000000 */   nop
/* 41BAF0 802A6D60 104004F8 */  beqz      $v0, .L802A8144_7AFAE4
/* 41BAF4 802A6D64 24020008 */   addiu    $v0, $zero, 0x8
/* 41BAF8 802A6D68 3C01802B */  lui       $at, %hi(D_802ACC60)
/* 41BAFC 802A6D6C AC22CC60 */  sw        $v0, %lo(D_802ACC60)($at)
/* 41BB00 802A6D70 24020004 */  addiu     $v0, $zero, 0x4
/* 41BB04 802A6D74 3C01802B */  lui       $at, %hi(D_802ACC6C)
/* 41BB08 802A6D78 AC22CC6C */  sw        $v0, %lo(D_802ACC6C)($at)
/* 41BB0C 802A6D7C 080AA04F */  j         .L802A813C_7AFADC
/* 41BB10 802A6D80 24020001 */   addiu    $v0, $zero, 0x1
glabel .L802A6D84_7AE724
/* 41BB14 802A6D84 0C0A841E */  jal       func_802A1078_7A8A18
/* 41BB18 802A6D88 00000000 */   nop
/* 41BB1C 802A6D8C 080AA04F */  j         .L802A813C_7AFADC
/* 41BB20 802A6D90 2402000C */   addiu    $v0, $zero, 0xC
glabel .L802A6D94_7AE734
/* 41BB24 802A6D94 86C3017C */  lh        $v1, 0x17C($s6)
/* 41BB28 802A6D98 24020035 */  addiu     $v0, $zero, 0x35
/* 41BB2C 802A6D9C 14620005 */  bne       $v1, $v0, .L802A6DB4_7AE754
/* 41BB30 802A6DA0 24020036 */   addiu    $v0, $zero, 0x36
/* 41BB34 802A6DA4 24020002 */  addiu     $v0, $zero, 0x2
/* 41BB38 802A6DA8 A2C20088 */  sb        $v0, 0x88($s6)
/* 41BB3C 802A6DAC 86C3017C */  lh        $v1, 0x17C($s6)
/* 41BB40 802A6DB0 24020036 */  addiu     $v0, $zero, 0x36
.L802A6DB4_7AE754:
/* 41BB44 802A6DB4 14620003 */  bne       $v1, $v0, .L802A6DC4_7AE764
/* 41BB48 802A6DB8 0000A02D */   daddu    $s4, $zero, $zero
/* 41BB4C 802A6DBC 24020003 */  addiu     $v0, $zero, 0x3
/* 41BB50 802A6DC0 A2C20088 */  sb        $v0, 0x88($s6)
.L802A6DC4_7AE764:
/* 41BB54 802A6DC4 0280982D */  daddu     $s3, $s4, $zero
/* 41BB58 802A6DC8 241E0002 */  addiu     $fp, $zero, 0x2
/* 41BB5C 802A6DCC 02A0902D */  daddu     $s2, $s5, $zero
/* 41BB60 802A6DD0 3C11802B */  lui       $s1, %hi(D_802ACCD0)
/* 41BB64 802A6DD4 2631CCD0 */  addiu     $s1, $s1, %lo(D_802ACCD0)
.L802A6DD8_7AE778:
/* 41BB68 802A6DD8 864201B4 */  lh        $v0, 0x1B4($s2)
/* 41BB6C 802A6DDC 50400027 */  beql      $v0, $zero, .L802A6E7C_7AE81C
/* 41BB70 802A6DE0 26730001 */   addiu    $s3, $s3, 0x1
/* 41BB74 802A6DE4 00021140 */  sll       $v0, $v0, 5
/* 41BB78 802A6DE8 3C0E8008 */  lui       $t6, %hi(gItemTable)
/* 41BB7C 802A6DEC 25CE78E0 */  addiu     $t6, $t6, %lo(gItemTable)
/* 41BB80 802A6DF0 004E8021 */  addu      $s0, $v0, $t6
/* 41BB84 802A6DF4 3C0E8009 */  lui       $t6, %hi(gItemHudScripts)
/* 41BB88 802A6DF8 25CEA680 */  addiu     $t6, $t6, %lo(gItemHudScripts)
/* 41BB8C 802A6DFC 86020004 */  lh        $v0, 0x4($s0)
/* 41BB90 802A6E00 96030018 */  lhu       $v1, 0x18($s0)
/* 41BB94 802A6E04 000210C0 */  sll       $v0, $v0, 3
/* 41BB98 802A6E08 30630002 */  andi      $v1, $v1, 0x2
/* 41BB9C 802A6E0C 1060001A */  beqz      $v1, .L802A6E78_7AE818
/* 41BBA0 802A6E10 004EA821 */   addu     $s5, $v0, $t6
/* 41BBA4 802A6E14 A2DE0178 */  sb        $fp, 0x178($s6)
/* 41BBA8 802A6E18 964201B4 */  lhu       $v0, 0x1B4($s2)
/* 41BBAC 802A6E1C A6C2017A */  sh        $v0, 0x17A($s6)
/* 41BBB0 802A6E20 8E020008 */  lw        $v0, 0x8($s0)
/* 41BBB4 802A6E24 02E0202D */  daddu     $a0, $s7, $zero
/* 41BBB8 802A6E28 0C098C0B */  jal       func_8026302C
/* 41BBBC 802A6E2C AEC20184 */   sw       $v0, 0x184($s6)
/* 41BBC0 802A6E30 8EA20000 */  lw        $v0, 0x0($s5)
/* 41BBC4 802A6E34 AE220000 */  sw        $v0, 0x0($s1)
/* 41BBC8 802A6E38 864301B4 */  lh        $v1, 0x1B4($s2)
/* 41BBCC 802A6E3C 24020001 */  addiu     $v0, $zero, 0x1
/* 41BBD0 802A6E40 AE22018C */  sw        $v0, 0x18C($s1)
/* 41BBD4 802A6E44 AE230108 */  sw        $v1, 0x108($s1)
/* 41BBD8 802A6E48 8E020000 */  lw        $v0, 0x0($s0)
/* 41BBDC 802A6E4C AE220084 */  sw        $v0, 0x84($s1)
/* 41BBE0 802A6E50 8E020014 */  lw        $v0, 0x14($s0)
/* 41BBE4 802A6E54 AE220294 */  sw        $v0, 0x294($s1)
/* 41BBE8 802A6E58 82E2040C */  lb        $v0, 0x40C($s7)
/* 41BBEC 802A6E5C 54400005 */  bnel      $v0, $zero, .L802A6E74_7AE814
/* 41BBF0 802A6E60 26310004 */   addiu    $s1, $s1, 0x4
/* 41BBF4 802A6E64 8EA20004 */  lw        $v0, 0x4($s5)
/* 41BBF8 802A6E68 AE20018C */  sw        $zero, 0x18C($s1)
/* 41BBFC 802A6E6C AE220000 */  sw        $v0, 0x0($s1)
/* 41BC00 802A6E70 26310004 */  addiu     $s1, $s1, 0x4
.L802A6E74_7AE814:
/* 41BC04 802A6E74 26940001 */  addiu     $s4, $s4, 0x1
.L802A6E78_7AE818:
/* 41BC08 802A6E78 26730001 */  addiu     $s3, $s3, 0x1
.L802A6E7C_7AE81C:
/* 41BC0C 802A6E7C 2A62000A */  slti      $v0, $s3, 0xA
/* 41BC10 802A6E80 1440FFD5 */  bnez      $v0, .L802A6DD8_7AE778
/* 41BC14 802A6E84 26520002 */   addiu    $s2, $s2, 0x2
/* 41BC18 802A6E88 3C01802B */  lui       $at, %hi(D_802ACFEC)
/* 41BC1C 802A6E8C AC20CFEC */  sw        $zero, %lo(D_802ACFEC)($at)
/* 41BC20 802A6E90 3C01802B */  lui       $at, %hi(D_802ACFF0)
/* 41BC24 802A6E94 AC20CFF0 */  sw        $zero, %lo(D_802ACFF0)($at)
/* 41BC28 802A6E98 86C3017C */  lh        $v1, 0x17C($s6)
/* 41BC2C 802A6E9C 24020035 */  addiu     $v0, $zero, 0x35
/* 41BC30 802A6EA0 14620009 */  bne       $v1, $v0, .L802A6EC8_7AE868
/* 41BC34 802A6EA4 24020036 */   addiu    $v0, $zero, 0x36
/* 41BC38 802A6EA8 82C30088 */  lb        $v1, 0x88($s6)
/* 41BC3C 802A6EAC 24020001 */  addiu     $v0, $zero, 0x1
/* 41BC40 802A6EB0 3C01802B */  lui       $at, %hi(D_802ACFEC)
/* 41BC44 802A6EB4 AC22CFEC */  sw        $v0, %lo(D_802ACFEC)($at)
/* 41BC48 802A6EB8 3C01802B */  lui       $at, %hi(D_802ACFF0)
/* 41BC4C 802A6EBC AC23CFF0 */  sw        $v1, %lo(D_802ACFF0)($at)
/* 41BC50 802A6EC0 86C3017C */  lh        $v1, 0x17C($s6)
/* 41BC54 802A6EC4 24020036 */  addiu     $v0, $zero, 0x36
.L802A6EC8_7AE868:
/* 41BC58 802A6EC8 14620006 */  bne       $v1, $v0, .L802A6EE4_7AE884
/* 41BC5C 802A6ECC 24020002 */   addiu    $v0, $zero, 0x2
/* 41BC60 802A6ED0 82C30088 */  lb        $v1, 0x88($s6)
/* 41BC64 802A6ED4 3C01802B */  lui       $at, %hi(D_802ACFEC)
/* 41BC68 802A6ED8 AC22CFEC */  sw        $v0, %lo(D_802ACFEC)($at)
/* 41BC6C 802A6EDC 3C01802B */  lui       $at, %hi(D_802ACFF0)
/* 41BC70 802A6EE0 AC23CFF0 */  sw        $v1, %lo(D_802ACFF0)($at)
.L802A6EE4_7AE884:
/* 41BC74 802A6EE4 82C20050 */  lb        $v0, 0x50($s6)
/* 41BC78 802A6EE8 04420001 */  bltzl     $v0, .L802A6EF0_7AE890
/* 41BC7C 802A6EEC A2C00050 */   sb       $zero, 0x50($s6)
.L802A6EF0_7AE890:
/* 41BC80 802A6EF0 82DE0050 */  lb        $fp, 0x50($s6)
/* 41BC84 802A6EF4 3C04802B */  lui       $a0, %hi(D_802ACCD0)
/* 41BC88 802A6EF8 2484CCD0 */  addiu     $a0, $a0, %lo(D_802ACCD0)
/* 41BC8C 802A6EFC AC800318 */  sw        $zero, 0x318($a0)
/* 41BC90 802A6F00 AC940324 */  sw        $s4, 0x324($a0)
/* 41BC94 802A6F04 0C03D44F */  jal       create_battle_popup_menu
/* 41BC98 802A6F08 AC9E0328 */   sw       $fp, 0x328($a0)
/* 41BC9C 802A6F0C 0C03D4AF */  jal       func_800F52BC
/* 41BCA0 802A6F10 00000000 */   nop
/* 41BCA4 802A6F14 080AA04F */  j         .L802A813C_7AFADC
/* 41BCA8 802A6F18 24020015 */   addiu    $v0, $zero, 0x15
glabel .L802A6F1C_7AE8BC
/* 41BCAC 802A6F1C 3C03802B */  lui       $v1, %hi(D_802ACFFC)
/* 41BCB0 802A6F20 8463CFFC */  lh        $v1, %lo(D_802ACFFC)($v1)
/* 41BCB4 802A6F24 10600487 */  beqz      $v1, .L802A8144_7AFAE4
/* 41BCB8 802A6F28 240200FF */   addiu    $v0, $zero, 0xFF
/* 41BCBC 802A6F2C 14620007 */  bne       $v1, $v0, .L802A6F4C_7AE8EC
/* 41BCC0 802A6F30 24020018 */   addiu    $v0, $zero, 0x18
/* 41BCC4 802A6F34 0C0A8A44 */  jal       func_802A2910_7AA2B0
/* 41BCC8 802A6F38 00000000 */   nop
/* 41BCCC 802A6F3C 24020002 */  addiu     $v0, $zero, 0x2
/* 41BCD0 802A6F40 A6C0017C */  sh        $zero, 0x17C($s6)
/* 41BCD4 802A6F44 080A9FE1 */  j         .L802A7F84_7AF924
/* 41BCD8 802A6F48 A2C00088 */   sb       $zero, 0x88($s6)
.L802A6F4C_7AE8EC:
/* 41BCDC 802A6F4C 24030019 */  addiu     $v1, $zero, 0x19
/* 41BCE0 802A6F50 A6C2006C */  sh        $v0, 0x6C($s6)
/* 41BCE4 802A6F54 3C02802B */  lui       $v0, %hi(D_802ACFFC)
/* 41BCE8 802A6F58 8442CFFC */  lh        $v0, %lo(D_802ACFFC)($v0)
/* 41BCEC 802A6F5C 3C0E802B */  lui       $t6, %hi(D_802ACCD0)
/* 41BCF0 802A6F60 25CECCD0 */  addiu     $t6, $t6, %lo(D_802ACCD0)
/* 41BCF4 802A6F64 A6C3006E */  sh        $v1, 0x6E($s6)
/* 41BCF8 802A6F68 2442FFFF */  addiu     $v0, $v0, -0x1
/* 41BCFC 802A6F6C 00021080 */  sll       $v0, $v0, 2
/* 41BD00 802A6F70 01C21021 */  addu      $v0, $t6, $v0
/* 41BD04 802A6F74 9442010A */  lhu       $v0, 0x10A($v0)
/* 41BD08 802A6F78 24030002 */  addiu     $v1, $zero, 0x2
/* 41BD0C 802A6F7C A2C30178 */  sb        $v1, 0x178($s6)
/* 41BD10 802A6F80 A6C201AA */  sh        $v0, 0x1AA($s6)
/* 41BD14 802A6F84 A6C2017A */  sh        $v0, 0x17A($s6)
/* 41BD18 802A6F88 00021400 */  sll       $v0, $v0, 16
/* 41BD1C 802A6F8C 000212C3 */  sra       $v0, $v0, 11
/* 41BD20 802A6F90 3C038008 */  lui       $v1, %hi(gItemTable + 0x8)
/* 41BD24 802A6F94 00621821 */  addu      $v1, $v1, $v0
/* 41BD28 802A6F98 8C6378E8 */  lw        $v1, %lo(gItemTable + 0x8)($v1)
/* 41BD2C 802A6F9C 3C02802B */  lui       $v0, %hi(D_802ACFFD)
/* 41BD30 802A6FA0 9042CFFD */  lbu       $v0, %lo(D_802ACFFD)($v0)
/* 41BD34 802A6FA4 AEC00188 */  sw        $zero, 0x188($s6)
/* 41BD38 802A6FA8 2442FFFF */  addiu     $v0, $v0, -0x1
/* 41BD3C 802A6FAC 34638000 */  ori       $v1, $v1, 0x8000
/* 41BD40 802A6FB0 A2C20050 */  sb        $v0, 0x50($s6)
/* 41BD44 802A6FB4 0C03C4EC */  jal       hide_popup_menu
/* 41BD48 802A6FB8 AEC30184 */   sw       $v1, 0x184($s6)
/* 41BD4C 802A6FBC 0C0A89F4 */  jal       D_802A27D0_7AA170
/* 41BD50 802A6FC0 00000000 */   nop
/* 41BD54 802A6FC4 0C0A840C */  jal       func_802A1030_7A89D0
/* 41BD58 802A6FC8 00000000 */   nop
/* 41BD5C 802A6FCC 080AA04F */  j         .L802A813C_7AFADC
/* 41BD60 802A6FD0 24020016 */   addiu    $v0, $zero, 0x16
glabel .L802A6FD4_7AE974
/* 41BD64 802A6FD4 8EC20214 */  lw        $v0, 0x214($s6)
/* 41BD68 802A6FD8 30424000 */  andi      $v0, $v0, 0x4000
/* 41BD6C 802A6FDC 1040000E */  beqz      $v0, .L802A7018_7AE9B8
/* 41BD70 802A6FE0 00000000 */   nop
/* 41BD74 802A6FE4 3C02802B */  lui       $v0, %hi(D_802ACFFC)
/* 41BD78 802A6FE8 8442CFFC */  lh        $v0, %lo(D_802ACFFC)($v0)
/* 41BD7C 802A6FEC 1440000A */  bnez      $v0, .L802A7018_7AE9B8
/* 41BD80 802A6FF0 00000000 */   nop
/* 41BD84 802A6FF4 0C03C5B3 */  jal       func_800F16CC
/* 41BD88 802A6FF8 00000000 */   nop
/* 41BD8C 802A6FFC 0C0A8B16 */  jal       func_802A2C58_7AA5F8
/* 41BD90 802A7000 00000000 */   nop
/* 41BD94 802A7004 0C0A8426 */  jal       func_802A1098_7A8A38
/* 41BD98 802A7008 00000000 */   nop
/* 41BD9C 802A700C 24020017 */  addiu     $v0, $zero, 0x17
/* 41BDA0 802A7010 080AA04F */  j         .L802A813C_7AFADC
/* 41BDA4 802A7014 A6C0017C */   sh       $zero, 0x17C($s6)
.L802A7018_7AE9B8:
/* 41BDA8 802A7018 0C0A8B21 */  jal       func_802A2C84_7AA624
/* 41BDAC 802A701C 00000000 */   nop
.L802A7020_7AE9C0:
/* 41BDB0 802A7020 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41BDB4 802A7024 00000000 */   nop
/* 41BDB8 802A7028 10400446 */  beqz      $v0, .L802A8144_7AFAE4
/* 41BDBC 802A702C 00000000 */   nop
/* 41BDC0 802A7030 080A9E2B */  j         .L802A78AC_7AF24C
/* 41BDC4 802A7034 00000000 */   nop
glabel .L802A7038_7AE9D8
/* 41BDC8 802A7038 0C0A8B21 */  jal       func_802A2C84_7AA624
/* 41BDCC 802A703C 00000000 */   nop
/* 41BDD0 802A7040 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41BDD4 802A7044 00000000 */   nop
/* 41BDD8 802A7048 1040043E */  beqz      $v0, .L802A8144_7AFAE4
/* 41BDDC 802A704C 24020015 */   addiu    $v0, $zero, 0x15
/* 41BDE0 802A7050 080AA04F */  j         .L802A813C_7AFADC
/* 41BDE4 802A7054 00000000 */   nop
glabel .L802A7058_7AE9F8
/* 41BDE8 802A7058 0C03C5B3 */  jal       func_800F16CC
/* 41BDEC 802A705C 00000000 */   nop
/* 41BDF0 802A7060 0C0A8B16 */  jal       func_802A2C58_7AA5F8
/* 41BDF4 802A7064 00000000 */   nop
/* 41BDF8 802A7068 0C0A8426 */  jal       func_802A1098_7A8A38
/* 41BDFC 802A706C 00000000 */   nop
/* 41BE00 802A7070 0C0A8B21 */  jal       func_802A2C84_7AA624
/* 41BE04 802A7074 00000000 */   nop
/* 41BE08 802A7078 080AA04F */  j         .L802A813C_7AFADC
/* 41BE0C 802A707C 24020017 */   addiu    $v0, $zero, 0x17
glabel .L802A7080_7AEA20
/* 41BE10 802A7080 0C03C54E */  jal       destroy_popup_menu
/* 41BE14 802A7084 00000000 */   nop
/* 41BE18 802A7088 080A9D8B */  j         .L802A762C_7AEFCC
/* 41BE1C 802A708C 00000000 */   nop
glabel .L802A7090_7AEA30
/* 41BE20 802A7090 0000A02D */  daddu     $s4, $zero, $zero
/* 41BE24 802A7094 0280982D */  daddu     $s3, $s4, $zero
/* 41BE28 802A7098 241E0002 */  addiu     $fp, $zero, 0x2
/* 41BE2C 802A709C 02A0902D */  daddu     $s2, $s5, $zero
/* 41BE30 802A70A0 3C11802B */  lui       $s1, %hi(D_802ACCD0)
/* 41BE34 802A70A4 2631CCD0 */  addiu     $s1, $s1, %lo(D_802ACCD0)
.L802A70A8_7AEA48:
/* 41BE38 802A70A8 864201B4 */  lh        $v0, 0x1B4($s2)
/* 41BE3C 802A70AC 50400027 */  beql      $v0, $zero, .L802A714C_7AEAEC
/* 41BE40 802A70B0 26730001 */   addiu    $s3, $s3, 0x1
/* 41BE44 802A70B4 00021140 */  sll       $v0, $v0, 5
/* 41BE48 802A70B8 3C0E8008 */  lui       $t6, %hi(gItemTable)
/* 41BE4C 802A70BC 25CE78E0 */  addiu     $t6, $t6, %lo(gItemTable)
/* 41BE50 802A70C0 004E8021 */  addu      $s0, $v0, $t6
/* 41BE54 802A70C4 3C0E8009 */  lui       $t6, %hi(gItemHudScripts)
/* 41BE58 802A70C8 25CEA680 */  addiu     $t6, $t6, %lo(gItemHudScripts)
/* 41BE5C 802A70CC 86020004 */  lh        $v0, 0x4($s0)
/* 41BE60 802A70D0 96030018 */  lhu       $v1, 0x18($s0)
/* 41BE64 802A70D4 000210C0 */  sll       $v0, $v0, 3
/* 41BE68 802A70D8 30630002 */  andi      $v1, $v1, 0x2
/* 41BE6C 802A70DC 1060001A */  beqz      $v1, .L802A7148_7AEAE8
/* 41BE70 802A70E0 004EA821 */   addu     $s5, $v0, $t6
/* 41BE74 802A70E4 A2DE0178 */  sb        $fp, 0x178($s6)
/* 41BE78 802A70E8 964201B4 */  lhu       $v0, 0x1B4($s2)
/* 41BE7C 802A70EC A6C2017A */  sh        $v0, 0x17A($s6)
/* 41BE80 802A70F0 8E020008 */  lw        $v0, 0x8($s0)
/* 41BE84 802A70F4 02E0202D */  daddu     $a0, $s7, $zero
/* 41BE88 802A70F8 0C098C0B */  jal       func_8026302C
/* 41BE8C 802A70FC AEC20184 */   sw       $v0, 0x184($s6)
/* 41BE90 802A7100 8EA20000 */  lw        $v0, 0x0($s5)
/* 41BE94 802A7104 AE220000 */  sw        $v0, 0x0($s1)
/* 41BE98 802A7108 864301B4 */  lh        $v1, 0x1B4($s2)
/* 41BE9C 802A710C 24020001 */  addiu     $v0, $zero, 0x1
/* 41BEA0 802A7110 AE22018C */  sw        $v0, 0x18C($s1)
/* 41BEA4 802A7114 AE230108 */  sw        $v1, 0x108($s1)
/* 41BEA8 802A7118 8E020000 */  lw        $v0, 0x0($s0)
/* 41BEAC 802A711C AE220084 */  sw        $v0, 0x84($s1)
/* 41BEB0 802A7120 8E020014 */  lw        $v0, 0x14($s0)
/* 41BEB4 802A7124 AE220294 */  sw        $v0, 0x294($s1)
/* 41BEB8 802A7128 82E2040C */  lb        $v0, 0x40C($s7)
/* 41BEBC 802A712C 54400005 */  bnel      $v0, $zero, .L802A7144_7AEAE4
/* 41BEC0 802A7130 26310004 */   addiu    $s1, $s1, 0x4
/* 41BEC4 802A7134 8EA20004 */  lw        $v0, 0x4($s5)
/* 41BEC8 802A7138 AE20018C */  sw        $zero, 0x18C($s1)
/* 41BECC 802A713C AE220000 */  sw        $v0, 0x0($s1)
/* 41BED0 802A7140 26310004 */  addiu     $s1, $s1, 0x4
.L802A7144_7AEAE4:
/* 41BED4 802A7144 26940001 */  addiu     $s4, $s4, 0x1
.L802A7148_7AEAE8:
/* 41BED8 802A7148 26730001 */  addiu     $s3, $s3, 0x1
.L802A714C_7AEAEC:
/* 41BEDC 802A714C 2A62000A */  slti      $v0, $s3, 0xA
/* 41BEE0 802A7150 1440FFD5 */  bnez      $v0, .L802A70A8_7AEA48
/* 41BEE4 802A7154 26520002 */   addiu    $s2, $s2, 0x2
/* 41BEE8 802A7158 82C20050 */  lb        $v0, 0x50($s6)
/* 41BEEC 802A715C 04420001 */  bltzl     $v0, .L802A7164_7AEB04
/* 41BEF0 802A7160 A2C00050 */   sb       $zero, 0x50($s6)
.L802A7164_7AEB04:
/* 41BEF4 802A7164 82DE0050 */  lb        $fp, 0x50($s6)
/* 41BEF8 802A7168 3C04802B */  lui       $a0, %hi(D_802ACCD0)
/* 41BEFC 802A716C 2484CCD0 */  addiu     $a0, $a0, %lo(D_802ACCD0)
/* 41BF00 802A7170 AC800318 */  sw        $zero, 0x318($a0)
/* 41BF04 802A7174 AC940324 */  sw        $s4, 0x324($a0)
/* 41BF08 802A7178 AC80031C */  sw        $zero, 0x31C($a0)
/* 41BF0C 802A717C AC800320 */  sw        $zero, 0x320($a0)
/* 41BF10 802A7180 0C03D44F */  jal       create_battle_popup_menu
/* 41BF14 802A7184 AC9E0328 */   sw       $fp, 0x328($a0)
/* 41BF18 802A7188 0C03D4AF */  jal       func_800F52BC
/* 41BF1C 802A718C 00000000 */   nop
/* 41BF20 802A7190 080AA04F */  j         .L802A813C_7AFADC
/* 41BF24 802A7194 24020029 */   addiu    $v0, $zero, 0x29
glabel .L802A7198_7AEB38
/* 41BF28 802A7198 3C03802B */  lui       $v1, %hi(D_802ACFFC)
/* 41BF2C 802A719C 8463CFFC */  lh        $v1, %lo(D_802ACFFC)($v1)
/* 41BF30 802A71A0 106003E8 */  beqz      $v1, .L802A8144_7AFAE4
/* 41BF34 802A71A4 240200FF */   addiu    $v0, $zero, 0xFF
/* 41BF38 802A71A8 5462000B */  bnel      $v1, $v0, .L802A71D8_7AEB78
/* 41BF3C 802A71AC 2402002C */   addiu    $v0, $zero, 0x2C
/* 41BF40 802A71B0 0C0A8414 */  jal       func_802A1050_7A89F0
/* 41BF44 802A71B4 00000000 */   nop
/* 41BF48 802A71B8 24020008 */  addiu     $v0, $zero, 0x8
/* 41BF4C 802A71BC 3C01802B */  lui       $at, %hi(D_802ACC60)
/* 41BF50 802A71C0 AC22CC60 */  sw        $v0, %lo(D_802ACC60)($at)
/* 41BF54 802A71C4 24020004 */  addiu     $v0, $zero, 0x4
/* 41BF58 802A71C8 3C01802B */  lui       $at, %hi(D_802ACC6C)
/* 41BF5C 802A71CC AC22CC6C */  sw        $v0, %lo(D_802ACC6C)($at)
/* 41BF60 802A71D0 080A9FE1 */  j         .L802A7F84_7AF924
/* 41BF64 802A71D4 24020001 */   addiu    $v0, $zero, 0x1
.L802A71D8_7AEB78:
/* 41BF68 802A71D8 2403002D */  addiu     $v1, $zero, 0x2D
/* 41BF6C 802A71DC A6C2006C */  sh        $v0, 0x6C($s6)
/* 41BF70 802A71E0 3C02802B */  lui       $v0, %hi(D_802ACFFC)
/* 41BF74 802A71E4 8442CFFC */  lh        $v0, %lo(D_802ACFFC)($v0)
/* 41BF78 802A71E8 3C0E802B */  lui       $t6, %hi(D_802ACCD0)
/* 41BF7C 802A71EC 25CECCD0 */  addiu     $t6, $t6, %lo(D_802ACCD0)
/* 41BF80 802A71F0 A6C3006E */  sh        $v1, 0x6E($s6)
/* 41BF84 802A71F4 2442FFFF */  addiu     $v0, $v0, -0x1
/* 41BF88 802A71F8 00021080 */  sll       $v0, $v0, 2
/* 41BF8C 802A71FC 01C21021 */  addu      $v0, $t6, $v0
/* 41BF90 802A7200 9442010A */  lhu       $v0, 0x10A($v0)
/* 41BF94 802A7204 A6C201AA */  sh        $v0, 0x1AA($s6)
/* 41BF98 802A7208 0040182D */  daddu     $v1, $v0, $zero
/* 41BF9C 802A720C 24020002 */  addiu     $v0, $zero, 0x2
/* 41BFA0 802A7210 A2C20178 */  sb        $v0, 0x178($s6)
/* 41BFA4 802A7214 A6C3017A */  sh        $v1, 0x17A($s6)
/* 41BFA8 802A7218 86C2017A */  lh        $v0, 0x17A($s6)
/* 41BFAC 802A721C 24030034 */  addiu     $v1, $zero, 0x34
/* 41BFB0 802A7220 A6C3017C */  sh        $v1, 0x17C($s6)
/* 41BFB4 802A7224 00021140 */  sll       $v0, $v0, 5
/* 41BFB8 802A7228 3C038008 */  lui       $v1, %hi(gItemTable + 0x8)
/* 41BFBC 802A722C 00621821 */  addu      $v1, $v1, $v0
/* 41BFC0 802A7230 8C6378E8 */  lw        $v1, %lo(gItemTable + 0x8)($v1)
/* 41BFC4 802A7234 3C02802B */  lui       $v0, %hi(D_802ACFFD)
/* 41BFC8 802A7238 9042CFFD */  lbu       $v0, %lo(D_802ACFFD)($v0)
/* 41BFCC 802A723C AEC00188 */  sw        $zero, 0x188($s6)
/* 41BFD0 802A7240 2442FFFF */  addiu     $v0, $v0, -0x1
/* 41BFD4 802A7244 34638000 */  ori       $v1, $v1, 0x8000
/* 41BFD8 802A7248 A2C20050 */  sb        $v0, 0x50($s6)
/* 41BFDC 802A724C 0C03C4EC */  jal       hide_popup_menu
/* 41BFE0 802A7250 AEC30184 */   sw       $v1, 0x184($s6)
/* 41BFE4 802A7254 0C0A840C */  jal       func_802A1030_7A89D0
/* 41BFE8 802A7258 00000000 */   nop
/* 41BFEC 802A725C 080AA04F */  j         .L802A813C_7AFADC
/* 41BFF0 802A7260 2402002A */   addiu    $v0, $zero, 0x2A
glabel .L802A7264_7AEC04
/* 41BFF4 802A7264 8EC20214 */  lw        $v0, 0x214($s6)
/* 41BFF8 802A7268 30424000 */  andi      $v0, $v0, 0x4000
/* 41BFFC 802A726C 1040FF6C */  beqz      $v0, .L802A7020_7AE9C0
/* 41C000 802A7270 00000000 */   nop
/* 41C004 802A7274 3C02802B */  lui       $v0, %hi(D_802ACFFC)
/* 41C008 802A7278 8442CFFC */  lh        $v0, %lo(D_802ACFFC)($v0)
/* 41C00C 802A727C 1440FF68 */  bnez      $v0, .L802A7020_7AE9C0
/* 41C010 802A7280 00000000 */   nop
/* 41C014 802A7284 0C03C5B3 */  jal       func_800F16CC
/* 41C018 802A7288 00000000 */   nop
/* 41C01C 802A728C 0C0A8426 */  jal       func_802A1098_7A8A38
/* 41C020 802A7290 00000000 */   nop
/* 41C024 802A7294 080AA04F */  j         .L802A813C_7AFADC
/* 41C028 802A7298 2402002B */   addiu    $v0, $zero, 0x2B
glabel .L802A729C_7AEC3C
/* 41C02C 802A729C 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41C030 802A72A0 00000000 */   nop
/* 41C034 802A72A4 104003A7 */  beqz      $v0, .L802A8144_7AFAE4
/* 41C038 802A72A8 24020029 */   addiu    $v0, $zero, 0x29
/* 41C03C 802A72AC 080AA04F */  j         .L802A813C_7AFADC
/* 41C040 802A72B0 00000000 */   nop
glabel .L802A72B4_7AEC54
/* 41C044 802A72B4 0C03C5B3 */  jal       func_800F16CC
/* 41C048 802A72B8 00000000 */   nop
/* 41C04C 802A72BC 0C0A8426 */  jal       func_802A1098_7A8A38
/* 41C050 802A72C0 00000000 */   nop
/* 41C054 802A72C4 080AA04F */  j         .L802A813C_7AFADC
/* 41C058 802A72C8 2402002B */   addiu    $v0, $zero, 0x2B
glabel .L802A72CC_7AEC6C
/* 41C05C 802A72CC 0C03C54E */  jal       destroy_popup_menu
/* 41C060 802A72D0 00000000 */   nop
glabel .L802A72D4_7AEC74
/* 41C064 802A72D4 0C0A842E */  jal       func_802A10B8_7A8A58
/* 41C068 802A72D8 00000000 */   nop
/* 41C06C 802A72DC 080AA051 */  j         .L802A8144_7AFAE4
/* 41C070 802A72E0 00000000 */   nop
glabel .L802A72E4_7AEC84
/* 41C074 802A72E4 92C2020E */  lbu       $v0, 0x20E($s6)
/* 41C078 802A72E8 1040005E */  beqz      $v0, .L802A7464_7AEE04
/* 41C07C 802A72EC 0000982D */   daddu    $s3, $zero, $zero
/* 41C080 802A72F0 3C0D8009 */  lui       $t5, %hi(gMoveTable)
/* 41C084 802A72F4 25ADF060 */  addiu     $t5, $t5, %lo(gMoveTable)
/* 41C088 802A72F8 3C0C802B */  lui       $t4, %hi(BattleMenu_Moves_OptionCantUseMessages)
/* 41C08C 802A72FC 258CD5E8 */  addiu     $t4, $t4, %lo(BattleMenu_Moves_OptionCantUseMessages)
/* 41C090 802A7300 240BFFFF */  addiu     $t3, $zero, -0x1
/* 41C094 802A7304 24070048 */  addiu     $a3, $zero, 0x48
/* 41C098 802A7308 240AFFFE */  addiu     $t2, $zero, -0x2
/* 41C09C 802A730C 24090001 */  addiu     $t1, $zero, 0x1
/* 41C0A0 802A7310 3C08802B */  lui       $t0, %hi(D_802AB398_7B2D38)
/* 41C0A4 802A7314 2508B398 */  addiu     $t0, $t0, %lo(D_802AB398_7B2D38)
/* 41C0A8 802A7318 3C06802B */  lui       $a2, %hi(battle_menu_moveOptionIconScripts)
/* 41C0AC 802A731C 24C6D260 */  addiu     $a2, $a2, %lo(battle_menu_moveOptionIconScripts)
.L802A7320_7AECC0:
/* 41C0B0 802A7320 02D32021 */  addu      $a0, $s6, $s3
/* 41C0B4 802A7324 908201DE */  lbu       $v0, 0x1DE($a0)
/* 41C0B8 802A7328 026C2821 */  addu      $a1, $s3, $t4
/* 41C0BC 802A732C A0A00000 */  sb        $zero, 0x0($a1)
/* 41C0C0 802A7330 00021880 */  sll       $v1, $v0, 2
/* 41C0C4 802A7334 00621821 */  addu      $v1, $v1, $v0
/* 41C0C8 802A7338 00031880 */  sll       $v1, $v1, 2
/* 41C0CC 802A733C 808201F6 */  lb        $v0, 0x1F6($a0)
/* 41C0D0 802A7340 14400003 */  bnez      $v0, .L802A7350_7AECF0
/* 41C0D4 802A7344 006D9021 */   addu     $s2, $v1, $t5
/* 41C0D8 802A7348 A0A00000 */  sb        $zero, 0x0($a1)
/* 41C0DC 802A734C 808201F6 */  lb        $v0, 0x1F6($a0)
.L802A7350_7AECF0:
/* 41C0E0 802A7350 144B0004 */  bne       $v0, $t3, .L802A7364_7AED04
/* 41C0E4 802A7354 00000000 */   nop
/* 41C0E8 802A7358 A08001F6 */  sb        $zero, 0x1F6($a0)
/* 41C0EC 802A735C A0A70000 */  sb        $a3, 0x0($a1)
/* 41C0F0 802A7360 808201F6 */  lb        $v0, 0x1F6($a0)
.L802A7364_7AED04:
/* 41C0F4 802A7364 144A0003 */  bne       $v0, $t2, .L802A7374_7AED14
/* 41C0F8 802A7368 00000000 */   nop
/* 41C0FC 802A736C A08001F6 */  sb        $zero, 0x1F6($a0)
/* 41C100 802A7370 A0A70000 */  sb        $a3, 0x0($a1)
.L802A7374_7AED14:
/* 41C104 802A7374 8EC20074 */  lw        $v0, 0x74($s6)
/* 41C108 802A7378 02691804 */  sllv      $v1, $t1, $s3
/* 41C10C 802A737C 00431024 */  and       $v0, $v0, $v1
/* 41C110 802A7380 14400003 */  bnez      $v0, .L802A7390_7AED30
/* 41C114 802A7384 00000000 */   nop
/* 41C118 802A7388 A08001F6 */  sb        $zero, 0x1F6($a0)
/* 41C11C 802A738C A0A70000 */  sb        $a3, 0x0($a1)
.L802A7390_7AED30:
/* 41C120 802A7390 908201DE */  lbu       $v0, 0x1DE($a0)
/* 41C124 802A7394 2442FF89 */  addiu     $v0, $v0, -0x77
/* 41C128 802A7398 000210C0 */  sll       $v0, $v0, 3
/* 41C12C 802A739C 00481021 */  addu      $v0, $v0, $t0
/* 41C130 802A73A0 8C420000 */  lw        $v0, 0x0($v0)
/* 41C134 802A73A4 ACC20000 */  sw        $v0, 0x0($a2)
/* 41C138 802A73A8 808201F6 */  lb        $v0, 0x1F6($a0)
/* 41C13C 802A73AC 14400008 */  bnez      $v0, .L802A73D0_7AED70
/* 41C140 802A73B0 00131880 */   sll      $v1, $s3, 2
/* 41C144 802A73B4 908201DE */  lbu       $v0, 0x1DE($a0)
/* 41C148 802A73B8 2442FF89 */  addiu     $v0, $v0, -0x77
/* 41C14C 802A73BC 000210C0 */  sll       $v0, $v0, 3
/* 41C150 802A73C0 34420004 */  ori       $v0, $v0, 0x4
/* 41C154 802A73C4 00481021 */  addu      $v0, $v0, $t0
/* 41C158 802A73C8 8C420000 */  lw        $v0, 0x0($v0)
/* 41C15C 802A73CC ACC20000 */  sw        $v0, 0x0($a2)
.L802A73D0_7AED70:
/* 41C160 802A73D0 82420011 */  lb        $v0, 0x11($s2)
/* 41C164 802A73D4 3C01802B */  lui       $at, %hi(battle_menu_moveOptionDisplayCosts)
/* 41C168 802A73D8 00230821 */  addu      $at, $at, $v1
/* 41C16C 802A73DC AC22D320 */  sw        $v0, %lo(battle_menu_moveOptionDisplayCosts)($at)
/* 41C170 802A73E0 82420012 */  lb        $v0, 0x12($s2)
/* 41C174 802A73E4 3C01802B */  lui       $at, %hi(BattleMenu_Moves_OptionSortPriority)
/* 41C178 802A73E8 00330821 */  addu      $at, $at, $s3
/* 41C17C 802A73EC A020D5D0 */  sb        $zero, %lo(BattleMenu_Moves_OptionSortPriority)($at)
/* 41C180 802A73F0 3C01802B */  lui       $at, %hi(BattleMenu_Moves_OptionIndices)
/* 41C184 802A73F4 00230821 */  addu      $at, $at, $v1
/* 41C188 802A73F8 AC33D4B0 */  sw        $s3, %lo(BattleMenu_Moves_OptionIndices)($at)
/* 41C18C 802A73FC 3C01802B */  lui       $at, %hi(battle_menu_moveOptionBPCosts)
/* 41C190 802A7400 00230821 */  addu      $at, $at, $v1
/* 41C194 802A7404 AC22D440 */  sw        $v0, %lo(battle_menu_moveOptionBPCosts)($at)
/* 41C198 802A7408 808201F6 */  lb        $v0, 0x1F6($a0)
/* 41C19C 802A740C 3C01802B */  lui       $at, %hi(BattleMenu_Moves_OptionEnabled)
/* 41C1A0 802A7410 00230821 */  addu      $at, $at, $v1
/* 41C1A4 802A7414 AC22D510 */  sw        $v0, %lo(BattleMenu_Moves_OptionEnabled)($at)
/* 41C1A8 802A7418 8E420000 */  lw        $v0, 0x0($s2)
/* 41C1AC 802A741C 3C01802B */  lui       $at, %hi(battle_menu_moveOptionNames)
/* 41C1B0 802A7420 00230821 */  addu      $at, $at, $v1
/* 41C1B4 802A7424 AC22D2C0 */  sw        $v0, %lo(battle_menu_moveOptionNames)($at)
/* 41C1B8 802A7428 8E420008 */  lw        $v0, 0x8($s2)
/* 41C1BC 802A742C 3C01802B */  lui       $at, %hi(battle_menu_moveOptionDisplayCostReductions)
/* 41C1C0 802A7430 00230821 */  addu      $at, $at, $v1
/* 41C1C4 802A7434 AC20D380 */  sw        $zero, %lo(battle_menu_moveOptionDisplayCostReductions)($at)
/* 41C1C8 802A7438 3C01802B */  lui       $at, %hi(battle_menu_moveOptionDisplayCostReductionColors)
/* 41C1CC 802A743C 00230821 */  addu      $at, $at, $v1
/* 41C1D0 802A7440 AC20D3E0 */  sw        $zero, %lo(battle_menu_moveOptionDisplayCostReductionColors)($at)
/* 41C1D4 802A7444 3C01802B */  lui       $at, %hi(BattleMenu_Moves_OptionDescMessages)
/* 41C1D8 802A7448 00230821 */  addu      $at, $at, $v1
/* 41C1DC 802A744C AC22D570 */  sw        $v0, %lo(BattleMenu_Moves_OptionDescMessages)($at)
/* 41C1E0 802A7450 92C2020E */  lbu       $v0, 0x20E($s6)
/* 41C1E4 802A7454 26730001 */  addiu     $s3, $s3, 0x1
/* 41C1E8 802A7458 0262102A */  slt       $v0, $s3, $v0
/* 41C1EC 802A745C 1440FFB0 */  bnez      $v0, .L802A7320_7AECC0
/* 41C1F0 802A7460 24C60004 */   addiu    $a2, $a2, 0x4
.L802A7464_7AEE04:
/* 41C1F4 802A7464 82C20052 */  lb        $v0, 0x52($s6)
/* 41C1F8 802A7468 04420001 */  bltzl     $v0, .L802A7470_7AEE10
/* 41C1FC 802A746C A2C00052 */   sb       $zero, 0x52($s6)
.L802A7470_7AEE10:
/* 41C200 802A7470 82DE0052 */  lb        $fp, 0x52($s6)
/* 41C204 802A7474 92C2020E */  lbu       $v0, 0x20E($s6)
/* 41C208 802A7478 24030001 */  addiu     $v1, $zero, 0x1
/* 41C20C 802A747C 3C01802B */  lui       $at, %hi(BattleMenu_UsingSpiritsSubmenu)
/* 41C210 802A7480 AC23D4A0 */  sw        $v1, %lo(BattleMenu_UsingSpiritsSubmenu)($at)
/* 41C214 802A7484 3C01802B */  lui       $at, %hi(BattleMenu_Moves_OptionCount)
/* 41C218 802A7488 AC22D4A4 */  sw        $v0, %lo(BattleMenu_Moves_OptionCount)($at)
/* 41C21C 802A748C 3C01802B */  lui       $at, %hi(D_802AD4A8)
/* 41C220 802A7490 AC3ED4A8 */  sw        $fp, %lo(D_802AD4A8)($at)
/* 41C224 802A7494 0C0A89A1 */  jal       func_802A2684_7AA024
/* 41C228 802A7498 00000000 */   nop
/* 41C22C 802A749C 080AA04F */  j         .L802A813C_7AFADC
/* 41C230 802A74A0 2402003D */   addiu    $v0, $zero, 0x3D
glabel .L802A74A4_7AEE44
/* 41C234 802A74A4 0C0A8B21 */  jal       func_802A2C84_7AA624
/* 41C238 802A74A8 00000000 */   nop
/* 41C23C 802A74AC 0040802D */  daddu     $s0, $v0, $zero
/* 41C240 802A74B0 2402FFFF */  addiu     $v0, $zero, -0x1
/* 41C244 802A74B4 12020321 */  beq       $s0, $v0, .L802A813C_7AFADC
/* 41C248 802A74B8 24020042 */   addiu    $v0, $zero, 0x42
/* 41C24C 802A74BC 12000321 */  beqz      $s0, .L802A8144_7AFAE4
/* 41C250 802A74C0 240200FF */   addiu    $v0, $zero, 0xFF
/* 41C254 802A74C4 5602000B */  bnel      $s0, $v0, .L802A74F4_7AEE94
/* 41C258 802A74C8 2602FFFF */   addiu    $v0, $s0, -0x1
/* 41C25C 802A74CC 0C0A8414 */  jal       func_802A1050_7A89F0
/* 41C260 802A74D0 00000000 */   nop
/* 41C264 802A74D4 24020008 */  addiu     $v0, $zero, 0x8
/* 41C268 802A74D8 3C01802B */  lui       $at, %hi(D_802ACC60)
/* 41C26C 802A74DC AC22CC60 */  sw        $v0, %lo(D_802ACC60)($at)
/* 41C270 802A74E0 24020004 */  addiu     $v0, $zero, 0x4
/* 41C274 802A74E4 3C01802B */  lui       $at, %hi(D_802ACC6C)
/* 41C278 802A74E8 AC22CC6C */  sw        $v0, %lo(D_802ACC6C)($at)
/* 41C27C 802A74EC 080A9FE1 */  j         .L802A7F84_7AF924
/* 41C280 802A74F0 24020001 */   addiu    $v0, $zero, 0x1
.L802A74F4_7AEE94:
/* 41C284 802A74F4 00021080 */  sll       $v0, $v0, 2
/* 41C288 802A74F8 3C01802B */  lui       $at, %hi(D_802AD4B3)
/* 41C28C 802A74FC 00220821 */  addu      $at, $at, $v0
/* 41C290 802A7500 9022D4B3 */  lbu       $v0, %lo(D_802AD4B3)($at)
/* 41C294 802A7504 3C03802B */  lui       $v1, %hi(D_802AD603)
/* 41C298 802A7508 9063D603 */  lbu       $v1, %lo(D_802AD603)($v1)
/* 41C29C 802A750C A2C20049 */  sb        $v0, 0x49($s6)
/* 41C2A0 802A7510 0C0A89F4 */  jal       D_802A27D0_7AA170
/* 41C2A4 802A7514 A2C30052 */   sb       $v1, 0x52($s6)
/* 41C2A8 802A7518 0C0A840C */  jal       func_802A1030_7A89D0
/* 41C2AC 802A751C 00000000 */   nop
/* 41C2B0 802A7520 080AA04F */  j         .L802A813C_7AFADC
/* 41C2B4 802A7524 2402003E */   addiu    $v0, $zero, 0x3E
glabel .L802A7528_7AEEC8
/* 41C2B8 802A7528 0C0A8B21 */  jal       func_802A2C84_7AA624
/* 41C2BC 802A752C 00000000 */   nop
/* 41C2C0 802A7530 8EC30214 */  lw        $v1, 0x214($s6)
/* 41C2C4 802A7534 30634000 */  andi      $v1, $v1, 0x4000
/* 41C2C8 802A7538 10600009 */  beqz      $v1, .L802A7560_7AEF00
/* 41C2CC 802A753C 0040802D */   daddu    $s0, $v0, $zero
/* 41C2D0 802A7540 16000007 */  bnez      $s0, .L802A7560_7AEF00
/* 41C2D4 802A7544 00000000 */   nop
/* 41C2D8 802A7548 0C0A8AAE */  jal       func_802A2AB8_7AA458
/* 41C2DC 802A754C 00000000 */   nop
/* 41C2E0 802A7550 0C0A8426 */  jal       func_802A1098_7A8A38
/* 41C2E4 802A7554 00000000 */   nop
/* 41C2E8 802A7558 080AA04F */  j         .L802A813C_7AFADC
/* 41C2EC 802A755C 2402003F */   addiu    $v0, $zero, 0x3F
.L802A7560_7AEF00:
/* 41C2F0 802A7560 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41C2F4 802A7564 00000000 */   nop
/* 41C2F8 802A7568 104002F6 */  beqz      $v0, .L802A8144_7AFAE4
/* 41C2FC 802A756C 24020040 */   addiu    $v0, $zero, 0x40
/* 41C300 802A7570 A6C2006C */  sh        $v0, 0x6C($s6)
/* 41C304 802A7574 24020041 */  addiu     $v0, $zero, 0x41
/* 41C308 802A7578 A6C2006E */  sh        $v0, 0x6E($s6)
/* 41C30C 802A757C 82C20049 */  lb        $v0, 0x49($s6)
/* 41C310 802A7580 24030008 */  addiu     $v1, $zero, 0x8
/* 41C314 802A7584 A2C30178 */  sb        $v1, 0x178($s6)
/* 41C318 802A7588 02C21021 */  addu      $v0, $s6, $v0
/* 41C31C 802A758C 904301DE */  lbu       $v1, 0x1DE($v0)
/* 41C320 802A7590 82C20049 */  lb        $v0, 0x49($s6)
/* 41C324 802A7594 02C21021 */  addu      $v0, $s6, $v0
/* 41C328 802A7598 A6C3017C */  sh        $v1, 0x17C($s6)
/* 41C32C 802A759C 904301DE */  lbu       $v1, 0x1DE($v0)
/* 41C330 802A75A0 00031080 */  sll       $v0, $v1, 2
/* 41C334 802A75A4 00431021 */  addu      $v0, $v0, $v1
/* 41C338 802A75A8 00021080 */  sll       $v0, $v0, 2
/* 41C33C 802A75AC 92C30049 */  lbu       $v1, 0x49($s6)
/* 41C340 802A75B0 3C018009 */  lui       $at, %hi(D_8008F064)
/* 41C344 802A75B4 00220821 */  addu      $at, $at, $v0
/* 41C348 802A75B8 8C22F064 */  lw        $v0, %lo(D_8008F064)($at)
/* 41C34C 802A75BC 00031E00 */  sll       $v1, $v1, 24
/* 41C350 802A75C0 00032603 */  sra       $a0, $v1, 24
/* 41C354 802A75C4 A6C4017A */  sh        $a0, 0x17A($s6)
/* 41C358 802A75C8 AEC20184 */  sw        $v0, 0x184($s6)
/* 41C35C 802A75CC 82A30292 */  lb        $v1, 0x292($s5)
/* 41C360 802A75D0 24020002 */  addiu     $v0, $zero, 0x2
/* 41C364 802A75D4 146200B5 */  bne       $v1, $v0, .L802A78AC_7AF24C
/* 41C368 802A75D8 00041400 */   sll      $v0, $a0, 16
/* 41C36C 802A75DC 00021403 */  sra       $v0, $v0, 16
/* 41C370 802A75E0 24030008 */  addiu     $v1, $zero, 0x8
/* 41C374 802A75E4 144300B1 */  bne       $v0, $v1, .L802A78AC_7AF24C
/* 41C378 802A75E8 24820001 */   addiu    $v0, $a0, 0x1
/* 41C37C 802A75EC 080A9E2B */  j         .L802A78AC_7AF24C
/* 41C380 802A75F0 A6C2017A */   sh       $v0, 0x17A($s6)
glabel .L802A75F4_7AEF94
/* 41C384 802A75F4 0C0A8B21 */  jal       func_802A2C84_7AA624
/* 41C388 802A75F8 00000000 */   nop
/* 41C38C 802A75FC 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41C390 802A7600 00000000 */   nop
/* 41C394 802A7604 104002CF */  beqz      $v0, .L802A8144_7AFAE4
/* 41C398 802A7608 2402003D */   addiu    $v0, $zero, 0x3D
/* 41C39C 802A760C 080AA04F */  j         .L802A813C_7AFADC
/* 41C3A0 802A7610 00000000 */   nop
glabel .L802A7614_7AEFB4
/* 41C3A4 802A7614 0C0A8AAE */  jal       func_802A2AB8_7AA458
/* 41C3A8 802A7618 00000000 */   nop
/* 41C3AC 802A761C 0C0A8426 */  jal       func_802A1098_7A8A38
/* 41C3B0 802A7620 00000000 */   nop
/* 41C3B4 802A7624 080AA04F */  j         .L802A813C_7AFADC
/* 41C3B8 802A7628 2402003F */   addiu    $v0, $zero, 0x3F
glabel .L802A762C_7AEFCC
/* 41C3BC 802A762C 0C0A89F9 */  jal       func_802A27E4_7AA184
/* 41C3C0 802A7630 00000000 */   nop
/* 41C3C4 802A7634 080A9CB5 */  j         .L802A72D4_7AEC74
/* 41C3C8 802A7638 00000000 */   nop
glabel .L802A763C_7AEFDC
/* 41C3CC 802A763C 0C0A8B21 */  jal       func_802A2C84_7AA624
/* 41C3D0 802A7640 00000000 */   nop
/* 41C3D4 802A7644 2403FFFF */  addiu     $v1, $zero, -0x1
/* 41C3D8 802A7648 104302BE */  beq       $v0, $v1, .L802A8144_7AFAE4
/* 41C3DC 802A764C 2402003D */   addiu    $v0, $zero, 0x3D
/* 41C3E0 802A7650 080AA04F */  j         .L802A813C_7AFADC
/* 41C3E4 802A7654 00000000 */   nop
glabel .L802A7658_7AEFF8
/* 41C3E8 802A7658 0C0A9606 */  jal       func_802A5818_7AD1B8
/* 41C3EC 802A765C 00000000 */   nop
/* 41C3F0 802A7660 14400004 */  bnez      $v0, .L802A7674_7AF014
/* 41C3F4 802A7664 0000A02D */   daddu    $s4, $zero, $zero
/* 41C3F8 802A7668 24020001 */  addiu     $v0, $zero, 0x1
/* 41C3FC 802A766C 080A9F5D */  j         .L802A7D74_7AF714
D_802A7670_7AF010:
/* 41C400 802A7670 A2C20088 */   sb       $v0, 0x88($s6)
.L802A7674_7AF014:
/* 41C404 802A7674 0280982D */  daddu     $s3, $s4, $zero
/* 41C408 802A7678 241E0002 */  addiu     $fp, $zero, 0x2
/* 41C40C 802A767C 02A0902D */  daddu     $s2, $s5, $zero
/* 41C410 802A7680 3C11802B */  lui       $s1, %hi(D_802ACCD0)
/* 41C414 802A7684 2631CCD0 */  addiu     $s1, $s1, %lo(D_802ACCD0)
.L802A7688_7AF028:
/* 41C418 802A7688 864201B4 */  lh        $v0, 0x1B4($s2)
/* 41C41C 802A768C 50400027 */  beql      $v0, $zero, .L802A772C_7AF0CC
/* 41C420 802A7690 26730001 */   addiu    $s3, $s3, 0x1
/* 41C424 802A7694 00021140 */  sll       $v0, $v0, 5
/* 41C428 802A7698 3C0E8008 */  lui       $t6, %hi(gItemTable)
/* 41C42C 802A769C 25CE78E0 */  addiu     $t6, $t6, %lo(gItemTable)
D_802A76A0_7AF040:
/* 41C430 802A76A0 004E8021 */  addu      $s0, $v0, $t6
/* 41C434 802A76A4 3C0E8009 */  lui       $t6, %hi(gItemHudScripts)
/* 41C438 802A76A8 25CEA680 */  addiu     $t6, $t6, %lo(gItemHudScripts)
/* 41C43C 802A76AC 86020004 */  lh        $v0, 0x4($s0)
/* 41C440 802A76B0 96030018 */  lhu       $v1, 0x18($s0)
/* 41C444 802A76B4 000210C0 */  sll       $v0, $v0, 3
/* 41C448 802A76B8 30630002 */  andi      $v1, $v1, 0x2
/* 41C44C 802A76BC 1060001A */  beqz      $v1, .L802A7728_7AF0C8
/* 41C450 802A76C0 004EA821 */   addu     $s5, $v0, $t6
/* 41C454 802A76C4 A2DE0178 */  sb        $fp, 0x178($s6)
/* 41C458 802A76C8 964201B4 */  lhu       $v0, 0x1B4($s2)
/* 41C45C 802A76CC A6C2017A */  sh        $v0, 0x17A($s6)
/* 41C460 802A76D0 8E020008 */  lw        $v0, 0x8($s0)
/* 41C464 802A76D4 02E0202D */  daddu     $a0, $s7, $zero
/* 41C468 802A76D8 0C098C0B */  jal       func_8026302C
/* 41C46C 802A76DC AEC20184 */   sw       $v0, 0x184($s6)
/* 41C470 802A76E0 8EA20000 */  lw        $v0, 0x0($s5)
/* 41C474 802A76E4 AE220000 */  sw        $v0, 0x0($s1)
D_802A76E8_7AF088:
/* 41C478 802A76E8 864301B4 */  lh        $v1, 0x1B4($s2)
/* 41C47C 802A76EC 24020001 */  addiu     $v0, $zero, 0x1
/* 41C480 802A76F0 AE22018C */  sw        $v0, 0x18C($s1)
/* 41C484 802A76F4 AE230108 */  sw        $v1, 0x108($s1)
/* 41C488 802A76F8 8E020000 */  lw        $v0, 0x0($s0)
/* 41C48C 802A76FC AE220084 */  sw        $v0, 0x84($s1)
/* 41C490 802A7700 8E020014 */  lw        $v0, 0x14($s0)
/* 41C494 802A7704 AE220294 */  sw        $v0, 0x294($s1)
/* 41C498 802A7708 82E2040C */  lb        $v0, 0x40C($s7)
/* 41C49C 802A770C 54400005 */  bnel      $v0, $zero, .L802A7724_7AF0C4
/* 41C4A0 802A7710 26310004 */   addiu    $s1, $s1, 0x4
/* 41C4A4 802A7714 8EA20004 */  lw        $v0, 0x4($s5)
D_802A7718_7AF0B8:
/* 41C4A8 802A7718 AE20018C */  sw        $zero, 0x18C($s1)
/* 41C4AC 802A771C AE220000 */  sw        $v0, 0x0($s1)
/* 41C4B0 802A7720 26310004 */  addiu     $s1, $s1, 0x4
.L802A7724_7AF0C4:
/* 41C4B4 802A7724 26940001 */  addiu     $s4, $s4, 0x1
.L802A7728_7AF0C8:
/* 41C4B8 802A7728 26730001 */  addiu     $s3, $s3, 0x1
.L802A772C_7AF0CC:
/* 41C4BC 802A772C 2A62000A */  slti      $v0, $s3, 0xA
/* 41C4C0 802A7730 1440FFD5 */  bnez      $v0, .L802A7688_7AF028
/* 41C4C4 802A7734 26520002 */   addiu    $s2, $s2, 0x2
/* 41C4C8 802A7738 16800004 */  bnez      $s4, .L802A774C_7AF0EC
/* 41C4CC 802A773C 24020035 */   addiu    $v0, $zero, 0x35
/* 41C4D0 802A7740 24020001 */  addiu     $v0, $zero, 0x1
/* 41C4D4 802A7744 080A9F5D */  j         .L802A7D74_7AF714
/* 41C4D8 802A7748 A2C20088 */   sb       $v0, 0x88($s6)
.L802A774C_7AF0EC:
/* 41C4DC 802A774C 3C01802B */  lui       $at, %hi(D_802ACFE8)
D_802A7750_7AF0F0:
/* 41C4E0 802A7750 AC20CFE8 */  sw        $zero, %lo(D_802ACFE8)($at)
/* 41C4E4 802A7754 86C3017C */  lh        $v1, 0x17C($s6)
/* 41C4E8 802A7758 1462000C */  bne       $v1, $v0, .L802A778C_7AF12C
/* 41C4EC 802A775C 24020036 */   addiu    $v0, $zero, 0x36
D_802A7760_7AF100:
/* 41C4F0 802A7760 24020064 */  addiu     $v0, $zero, 0x64
/* 41C4F4 802A7764 3C01802B */  lui       $at, %hi(D_802ACFE8)
/* 41C4F8 802A7768 AC22CFE8 */  sw        $v0, %lo(D_802ACFE8)($at)
/* 41C4FC 802A776C 82C30088 */  lb        $v1, 0x88($s6)
D_802A7770_7AF110:
/* 41C500 802A7770 24020001 */  addiu     $v0, $zero, 0x1
/* 41C504 802A7774 3C01802B */  lui       $at, %hi(D_802ACFEC)
/* 41C508 802A7778 AC22CFEC */  sw        $v0, %lo(D_802ACFEC)($at)
/* 41C50C 802A777C 3C01802B */  lui       $at, %hi(D_802ACFF0)
D_802A7780_7AF120:
/* 41C510 802A7780 AC23CFF0 */  sw        $v1, %lo(D_802ACFF0)($at)
/* 41C514 802A7784 86C3017C */  lh        $v1, 0x17C($s6)
/* 41C518 802A7788 24020036 */  addiu     $v0, $zero, 0x36
.L802A778C_7AF12C:
/* 41C51C 802A778C 1462000B */  bne       $v1, $v0, .L802A77BC_7AF15C
/* 41C520 802A7790 24020002 */   addiu    $v0, $zero, 0x2
/* 41C524 802A7794 3C01802B */  lui       $at, %hi(D_802ACFEC)
/* 41C528 802A7798 AC22CFEC */  sw        $v0, %lo(D_802ACFEC)($at)
/* 41C52C 802A779C 3C02802B */  lui       $v0, %hi(D_802ACFE8)
/* 41C530 802A77A0 8C42CFE8 */  lw        $v0, %lo(D_802ACFE8)($v0)
/* 41C534 802A77A4 82C30088 */  lb        $v1, 0x88($s6)
/* 41C538 802A77A8 244200C8 */  addiu     $v0, $v0, 0xC8
/* 41C53C 802A77AC 3C01802B */  lui       $at, %hi(D_802ACFE8)
/* 41C540 802A77B0 AC22CFE8 */  sw        $v0, %lo(D_802ACFE8)($at)
/* 41C544 802A77B4 3C01802B */  lui       $at, %hi(D_802ACFF0)
D_802A77B8_7AF158:
/* 41C548 802A77B8 AC23CFF0 */  sw        $v1, %lo(D_802ACFF0)($at)
.L802A77BC_7AF15C:
/* 41C54C 802A77BC 82C20050 */  lb        $v0, 0x50($s6)
D_802A77C0_7AF160:
/* 41C550 802A77C0 04420001 */  bltzl     $v0, .L802A77C8_7AF168
/* 41C554 802A77C4 A2C00050 */   sb       $zero, 0x50($s6)
.L802A77C8_7AF168:
/* 41C558 802A77C8 82DE0050 */  lb        $fp, 0x50($s6)
/* 41C55C 802A77CC 3C04802B */  lui       $a0, %hi(D_802ACCD0)
/* 41C560 802A77D0 2484CCD0 */  addiu     $a0, $a0, %lo(D_802ACCD0)
/* 41C564 802A77D4 AC940324 */  sw        $s4, 0x324($a0)
/* 41C568 802A77D8 0C03D44F */  jal       create_battle_popup_menu
/* 41C56C 802A77DC AC9E0328 */   sw       $fp, 0x328($a0)
/* 41C570 802A77E0 0C03D4AF */  jal       func_800F52BC
/* 41C574 802A77E4 00000000 */   nop
/* 41C578 802A77E8 080AA04F */  j         .L802A813C_7AFADC
/* 41C57C 802A77EC 24020047 */   addiu    $v0, $zero, 0x47
glabel .L802A77F0_7AF190
/* 41C580 802A77F0 3C03802B */  lui       $v1, %hi(D_802ACFFC)
/* 41C584 802A77F4 8463CFFC */  lh        $v1, %lo(D_802ACFFC)($v1)
/* 41C588 802A77F8 10600252 */  beqz      $v1, .L802A8144_7AFAE4
/* 41C58C 802A77FC 240200FF */   addiu    $v0, $zero, 0xFF
/* 41C590 802A7800 14620004 */  bne       $v1, $v0, .L802A7814_7AF1B4
/* 41C594 802A7804 2402004A */   addiu    $v0, $zero, 0x4A
/* 41C598 802A7808 24020001 */  addiu     $v0, $zero, 0x1
/* 41C59C 802A780C 080A9F5D */  j         .L802A7D74_7AF714
/* 41C5A0 802A7810 A2C20088 */   sb       $v0, 0x88($s6)
.L802A7814_7AF1B4:
/* 41C5A4 802A7814 2403004B */  addiu     $v1, $zero, 0x4B
/* 41C5A8 802A7818 A6C2006C */  sh        $v0, 0x6C($s6)
/* 41C5AC 802A781C 3C02802B */  lui       $v0, %hi(D_802ACFFC)
D_802A7820_7AF1C0:
/* 41C5B0 802A7820 8442CFFC */  lh        $v0, %lo(D_802ACFFC)($v0)
/* 41C5B4 802A7824 3C0E802B */  lui       $t6, %hi(D_802ACCD0)
/* 41C5B8 802A7828 25CECCD0 */  addiu     $t6, $t6, %lo(D_802ACCD0)
/* 41C5BC 802A782C A6C3006E */  sh        $v1, 0x6E($s6)
/* 41C5C0 802A7830 2442FFFF */  addiu     $v0, $v0, -0x1
/* 41C5C4 802A7834 00021080 */  sll       $v0, $v0, 2
/* 41C5C8 802A7838 01C21021 */  addu      $v0, $t6, $v0
/* 41C5CC 802A783C 9442010A */  lhu       $v0, 0x10A($v0)
/* 41C5D0 802A7840 24030002 */  addiu     $v1, $zero, 0x2
/* 41C5D4 802A7844 A2C30178 */  sb        $v1, 0x178($s6)
/* 41C5D8 802A7848 A6C201AA */  sh        $v0, 0x1AA($s6)
/* 41C5DC 802A784C A6C2017A */  sh        $v0, 0x17A($s6)
/* 41C5E0 802A7850 00021400 */  sll       $v0, $v0, 16
/* 41C5E4 802A7854 000212C3 */  sra       $v0, $v0, 11
/* 41C5E8 802A7858 3C038008 */  lui       $v1, %hi(gItemTable + 0x8)
/* 41C5EC 802A785C 00621821 */  addu      $v1, $v1, $v0
/* 41C5F0 802A7860 8C6378E8 */  lw        $v1, %lo(gItemTable + 0x8)($v1)
/* 41C5F4 802A7864 3C02802B */  lui       $v0, %hi(D_802ACFFD)
/* 41C5F8 802A7868 9042CFFD */  lbu       $v0, %lo(D_802ACFFD)($v0)
/* 41C5FC 802A786C AEC00188 */  sw        $zero, 0x188($s6)
/* 41C600 802A7870 2442FFFF */  addiu     $v0, $v0, -0x1
/* 41C604 802A7874 34638000 */  ori       $v1, $v1, 0x8000
/* 41C608 802A7878 A2C20050 */  sb        $v0, 0x50($s6)
/* 41C60C 802A787C 0C03C4EC */  jal       hide_popup_menu
/* 41C610 802A7880 AEC30184 */   sw       $v1, 0x184($s6)
/* 41C614 802A7884 24020005 */  addiu     $v0, $zero, 0x5
D_802A7888_7AF228:
/* 41C618 802A7888 3C01802B */  lui       $at, %hi(D_802ACC60)
/* 41C61C 802A788C AC22CC60 */  sw        $v0, %lo(D_802ACC60)($at)
/* 41C620 802A7890 080AA04F */  j         .L802A813C_7AFADC
/* 41C624 802A7894 24020048 */   addiu    $v0, $zero, 0x48
glabel .L802A7898_7AF238
/* 41C628 802A7898 3C03802B */  lui       $v1, %hi(D_802ACC60)
/* 41C62C 802A789C 2463CC60 */  addiu     $v1, $v1, %lo(D_802ACC60)
/* 41C630 802A78A0 8C620000 */  lw        $v0, 0x0($v1)
/* 41C634 802A78A4 1440000A */  bnez      $v0, .L802A78D0_7AF270
/* 41C638 802A78A8 2442FFFF */   addiu    $v0, $v0, -0x1
.L802A78AC_7AF24C:
/* 41C63C 802A78AC 0C090464 */  jal       func_80241190
/* 41C640 802A78B0 24040011 */   addiu    $a0, $zero, 0x11
/* 41C644 802A78B4 080AA051 */  j         .L802A8144_7AFAE4
/* 41C648 802A78B8 00000000 */   nop
glabel .L802A78BC_7AF25C
/* 41C64C 802A78BC 3C03802B */  lui       $v1, %hi(D_802ACC60)
/* 41C650 802A78C0 2463CC60 */  addiu     $v1, $v1, %lo(D_802ACC60)
/* 41C654 802A78C4 8C620000 */  lw        $v0, 0x0($v1)
/* 41C658 802A78C8 10400003 */  beqz      $v0, .L802A78D8_7AF278
/* 41C65C 802A78CC 2442FFFF */   addiu    $v0, $v0, -0x1
.L802A78D0_7AF270:
/* 41C660 802A78D0 080AA051 */  j         .L802A8144_7AFAE4
/* 41C664 802A78D4 AC620000 */   sw       $v0, 0x0($v1)
.L802A78D8_7AF278:
/* 41C668 802A78D8 080AA04F */  j         .L802A813C_7AFADC
/* 41C66C 802A78DC 24020047 */   addiu    $v0, $zero, 0x47
glabel .L802A78E0_7AF280
/* 41C670 802A78E0 0C03C5B3 */  jal       func_800F16CC
/* 41C674 802A78E4 00000000 */   nop
/* 41C678 802A78E8 24020005 */  addiu     $v0, $zero, 0x5
/* 41C67C 802A78EC 3C01802B */  lui       $at, %hi(D_802ACC60)
D_802A78F0_7AF290:
/* 41C680 802A78F0 AC22CC60 */  sw        $v0, %lo(D_802ACC60)($at)
/* 41C684 802A78F4 080AA04F */  j         .L802A813C_7AFADC
/* 41C688 802A78F8 24020049 */   addiu    $v0, $zero, 0x49
glabel .L802A78FC_7AF29C
/* 41C68C 802A78FC 0C03C54E */  jal       destroy_popup_menu
/* 41C690 802A7900 00000000 */   nop
/* 41C694 802A7904 080AA051 */  j         .L802A8144_7AFAE4
/* 41C698 802A7908 00000000 */   nop
glabel .L802A790C_7AF2AC
/* 41C69C 802A790C 82A20000 */  lb        $v0, 0x0($s5)
/* 41C6A0 802A7910 04400008 */  bltz      $v0, .L802A7934_7AF2D4
/* 41C6A4 802A7914 02E0202D */   daddu    $a0, $s7, $zero
/* 41C6A8 802A7918 3C028009 */  lui       $v0, %hi(D_8008F2BC)
/* 41C6AC 802A791C 8C42F2BC */  lw        $v0, %lo(D_8008F2BC)($v0)
/* 41C6B0 802A7920 0C098C0B */  jal       func_8026302C
/* 41C6B4 802A7924 AEC20184 */   sw       $v0, 0x184($s6)
/* 41C6B8 802A7928 82F1040C */  lb        $s1, 0x40C($s7)
/* 41C6BC 802A792C 080A9E4E */  j         .L802A7938_7AF2D8
/* 41C6C0 802A7930 00000000 */   nop
.L802A7934_7AF2D4:
/* 41C6C4 802A7934 0000882D */  daddu     $s1, $zero, $zero
.L802A7938_7AF2D8:
/* 41C6C8 802A7938 82A20001 */  lb        $v0, 0x1($s5)
/* 41C6CC 802A793C 04400008 */  bltz      $v0, .L802A7960_7AF300
/* 41C6D0 802A7940 02E0202D */   daddu    $a0, $s7, $zero
/* 41C6D4 802A7944 3C028009 */  lui       $v0, %hi(D_8008F0F0)
/* 41C6D8 802A7948 8C42F0F0 */  lw        $v0, %lo(D_8008F0F0)($v0)
/* 41C6DC 802A794C 0C098C0B */  jal       func_8026302C
/* 41C6E0 802A7950 AEC20184 */   sw       $v0, 0x184($s6)
/* 41C6E4 802A7954 82E2040C */  lb        $v0, 0x40C($s7)
D_802A7958_7AF2F8:
/* 41C6E8 802A7958 080A9E59 */  j         .L802A7964_7AF304
/* 41C6EC 802A795C 00000000 */   nop
.L802A7960_7AF300:
/* 41C6F0 802A7960 0000102D */  daddu     $v0, $zero, $zero
.L802A7964_7AF304:
/* 41C6F4 802A7964 1E200009 */  bgtz      $s1, .L802A798C_7AF32C
/* 41C6F8 802A7968 00000000 */   nop
/* 41C6FC 802A796C 1C400007 */  bgtz      $v0, .L802A798C_7AF32C
/* 41C700 802A7970 24040016 */   addiu    $a0, $zero, 0x16
/* 41C704 802A7974 24020009 */  addiu     $v0, $zero, 0x9
/* 41C708 802A7978 A2C20178 */  sb        $v0, 0x178($s6)
/* 41C70C 802A797C 0C090464 */  jal       func_80241190
/* 41C710 802A7980 A2C00095 */   sb       $zero, 0x95($s6)
/* 41C714 802A7984 080AA051 */  j         .L802A8144_7AFAE4
/* 41C718 802A7988 00000000 */   nop
.L802A798C_7AF32C:
/* 41C71C 802A798C 1E200002 */  bgtz      $s1, .L802A7998_7AF338
/* 41C720 802A7990 24100032 */   addiu    $s0, $zero, 0x32
/* 41C724 802A7994 0000802D */  daddu     $s0, $zero, $zero
.L802A7998_7AF338:
/* 41C728 802A7998 58400001 */  blezl     $v0, .L802A79A0_7AF340
/* 41C72C 802A799C 24100065 */   addiu    $s0, $zero, 0x65
.L802A79A0_7AF340:
/* 41C730 802A79A0 0C00A67F */  jal       rand_int
/* 41C734 802A79A4 24040064 */   addiu    $a0, $zero, 0x64
/* 41C738 802A79A8 0050102A */  slt       $v0, $v0, $s0
/* 41C73C 802A79AC 1040000C */  beqz      $v0, .L802A79E0_7AF380
/* 41C740 802A79B0 02E0202D */   daddu    $a0, $s7, $zero
/* 41C744 802A79B4 92A20000 */  lbu       $v0, 0x0($s5)
/* 41C748 802A79B8 2403001E */  addiu     $v1, $zero, 0x1E
/* 41C74C 802A79BC A6C3017C */  sh        $v1, 0x17C($s6)
D_802A79C0_7AF360:
/* 41C750 802A79C0 A2C00178 */  sb        $zero, 0x178($s6)
/* 41C754 802A79C4 3C038009 */  lui       $v1, %hi(D_8008F2BC)
/* 41C758 802A79C8 8C63F2BC */  lw        $v1, %lo(D_8008F2BC)($v1)
/* 41C75C 802A79CC 00021600 */  sll       $v0, $v0, 24
/* 41C760 802A79D0 00021603 */  sra       $v0, $v0, 24
/* 41C764 802A79D4 AEC30184 */  sw        $v1, 0x184($s6)
/* 41C768 802A79D8 080A9E83 */  j         .L802A7A0C_7AF3AC
/* 41C76C 802A79DC A6C2017A */   sh       $v0, 0x17A($s6)
.L802A79E0_7AF380:
/* 41C770 802A79E0 24020007 */  addiu     $v0, $zero, 0x7
/* 41C774 802A79E4 A6C2017C */  sh        $v0, 0x17C($s6)
/* 41C778 802A79E8 92A30001 */  lbu       $v1, 0x1($s5)
/* 41C77C 802A79EC 24020001 */  addiu     $v0, $zero, 0x1
/* 41C780 802A79F0 A2C20178 */  sb        $v0, 0x178($s6)
/* 41C784 802A79F4 3C028009 */  lui       $v0, %hi(D_8008F0F0)
/* 41C788 802A79F8 8C42F0F0 */  lw        $v0, %lo(D_8008F0F0)($v0)
/* 41C78C 802A79FC 00031E00 */  sll       $v1, $v1, 24
/* 41C790 802A7A00 00031E03 */  sra       $v1, $v1, 24
/* 41C794 802A7A04 AEC20184 */  sw        $v0, 0x184($s6)
/* 41C798 802A7A08 A6C3017A */  sh        $v1, 0x17A($s6)
.L802A7A0C_7AF3AC:
/* 41C79C 802A7A0C 0C098C0B */  jal       func_8026302C
/* 41C7A0 802A7A10 00000000 */   nop
/* 41C7A4 802A7A14 0C090464 */  jal       func_80241190
/* 41C7A8 802A7A18 24040012 */   addiu    $a0, $zero, 0x12
/* 41C7AC 802A7A1C 080AA051 */  j         .L802A8144_7AFAE4
/* 41C7B0 802A7A20 00000000 */   nop
glabel .L802A7A24_7AF3C4
/* 41C7B4 802A7A24 0C098C9A */  jal       func_80263268
D_802A7A28_7AF3C8:
/* 41C7B8 802A7A28 0000A02D */   daddu    $s4, $zero, $zero
/* 41C7BC 802A7A2C 82C2007C */  lb        $v0, 0x7C($s6)
/* 41C7C0 802A7A30 04400023 */  bltz      $v0, .L802A7AC0_7AF460
/* 41C7C4 802A7A34 3C05001D */   lui      $a1, (0x1D00A1 >> 16)
/* 41C7C8 802A7A38 34A500A1 */  ori       $a1, $a1, (0x1D00A1 & 0xFFFF)
/* 41C7CC 802A7A3C 24020005 */  addiu     $v0, $zero, 0x5
/* 41C7D0 802A7A40 3C04802B */  lui       $a0, %hi(D_802AB4A4_7B2E44)
/* 41C7D4 802A7A44 8C84B4A4 */  lw        $a0, %lo(D_802AB4A4_7B2E44)($a0)
/* 41C7D8 802A7A48 82A30012 */  lb        $v1, 0x12($s5)
/* 41C7DC 802A7A4C 3C06802B */  lui       $a2, %hi(D_802AD690)
/* 41C7E0 802A7A50 24C6D690 */  addiu     $a2, $a2, %lo(D_802AD690)
/* 41C7E4 802A7A54 3C01802B */  lui       $at, %hi(D_802AD678)
/* 41C7E8 802A7A58 AC22D678 */  sw        $v0, %lo(D_802AD678)($at)
/* 41C7EC 802A7A5C 00031880 */  sll       $v1, $v1, 2
/* 41C7F0 802A7A60 3C01802B */  lui       $at, %hi(D_802AD658)
/* 41C7F4 802A7A64 AC24D658 */  sw        $a0, %lo(D_802AD658)($at)
/* 41C7F8 802A7A68 3C01802B */  lui       $at, %hi(D_802AB3F8_7B2D98)
/* 41C7FC 802A7A6C 00230821 */  addu      $at, $at, $v1
/* 41C800 802A7A70 8C23B3F8 */  lw        $v1, %lo(D_802AB3F8_7B2D98)($at)
/* 41C804 802A7A74 24020001 */  addiu     $v0, $zero, 0x1
/* 41C808 802A7A78 ACC20000 */  sw        $v0, 0x0($a2)
/* 41C80C 802A7A7C 3C01802B */  lui       $at, %hi(D_802AD6C0)
/* 41C810 802A7A80 AC25D6C0 */  sw        $a1, %lo(D_802AD6C0)($at)
/* 41C814 802A7A84 82C2007C */  lb        $v0, 0x7C($s6)
D_802A7A88_7AF428:
/* 41C818 802A7A88 3C04802B */  lui       $a0, %hi(D_802AD640)
/* 41C81C 802A7A8C 2484D640 */  addiu     $a0, $a0, %lo(D_802AD640)
/* 41C820 802A7A90 1C40000A */  bgtz      $v0, .L802A7ABC_7AF45C
/* 41C824 802A7A94 AC830000 */   sw       $v1, 0x0($a0)
/* 41C828 802A7A98 82A20012 */  lb        $v0, 0x12($s5)
/* 41C82C 802A7A9C 00021080 */  sll       $v0, $v0, 2
/* 41C830 802A7AA0 3C01802B */  lui       $at, %hi(D_802AB438_7B2DD8)
/* 41C834 802A7AA4 00220821 */  addu      $at, $at, $v0
/* 41C838 802A7AA8 8C22B438 */  lw        $v0, %lo(D_802AB438_7B2DD8)($at)
/* 41C83C 802A7AAC ACC00000 */  sw        $zero, 0x0($a2)
D_802A7AB0_7AF450:
/* 41C840 802A7AB0 3C01802B */  lui       $at, %hi(D_802AD6A8)
/* 41C844 802A7AB4 AC20D6A8 */  sw        $zero, %lo(D_802AD6A8)($at)
/* 41C848 802A7AB8 AC820000 */  sw        $v0, 0x0($a0)
.L802A7ABC_7AF45C:
/* 41C84C 802A7ABC 24140001 */  addiu     $s4, $zero, 0x1
.L802A7AC0_7AF460:
/* 41C850 802A7AC0 3C05001D */  lui       $a1, (0x1D00A2 >> 16)
/* 41C854 802A7AC4 34A500A2 */  ori       $a1, $a1, (0x1D00A2 & 0xFFFF)
/* 41C858 802A7AC8 00141880 */  sll       $v1, $s4, 2
/* 41C85C 802A7ACC 26940001 */  addiu     $s4, $s4, 0x1
/* 41C860 802A7AD0 24020009 */  addiu     $v0, $zero, 0x9
/* 41C864 802A7AD4 24080001 */  addiu     $t0, $zero, 0x1
/* 41C868 802A7AD8 3C04802B */  lui       $a0, %hi(D_802AB480_7B2E20)
/* 41C86C 802A7ADC 8C84B480 */  lw        $a0, %lo(D_802AB480_7B2E20)($a0)
/* 41C870 802A7AE0 3C06001D */  lui       $a2, (0x1D00A3 >> 16)
/* 41C874 802A7AE4 3C01802B */  lui       $at, %hi(D_802AD678)
/* 41C878 802A7AE8 00230821 */  addu      $at, $at, $v1
/* 41C87C 802A7AEC AC22D678 */  sw        $v0, %lo(D_802AD678)($at)
/* 41C880 802A7AF0 3C01802B */  lui       $at, %hi(D_802AD690)
/* 41C884 802A7AF4 00230821 */  addu      $at, $at, $v1
/* 41C888 802A7AF8 AC28D690 */  sw        $t0, %lo(D_802AD690)($at)
/* 41C88C 802A7AFC 3C01802B */  lui       $at, %hi(D_802AD640)
/* 41C890 802A7B00 00230821 */  addu      $at, $at, $v1
/* 41C894 802A7B04 AC24D640 */  sw        $a0, %lo(D_802AD640)($at)
/* 41C898 802A7B08 3C04802B */  lui       $a0, %hi(D_802AB490_7B2E30)
/* 41C89C 802A7B0C 2484B490 */  addiu     $a0, $a0, %lo(D_802AB490_7B2E30)
/* 41C8A0 802A7B10 8C820024 */  lw        $v0, 0x24($a0)
/* 41C8A4 802A7B14 3C09802B */  lui       $t1, %hi(D_802AB488_7B2E28)
/* 41C8A8 802A7B18 2529B488 */  addiu     $t1, $t1, %lo(D_802AB488_7B2E28)
/* 41C8AC 802A7B1C 3C01802B */  lui       $at, %hi(D_802AD6C0)
/* 41C8B0 802A7B20 00230821 */  addu      $at, $at, $v1
/* 41C8B4 802A7B24 AC25D6C0 */  sw        $a1, %lo(D_802AD6C0)($at)
/* 41C8B8 802A7B28 00142880 */  sll       $a1, $s4, 2
/* 41C8BC 802A7B2C 3C01802B */  lui       $at, %hi(D_802AD658)
/* 41C8C0 802A7B30 00230821 */  addu      $at, $at, $v1
/* 41C8C4 802A7B34 AC22D658 */  sw        $v0, %lo(D_802AD658)($at)
/* 41C8C8 802A7B38 3C03802B */  lui       $v1, %hi(D_802AD640)
/* 41C8CC 802A7B3C 2463D640 */  addiu     $v1, $v1, %lo(D_802AD640)
/* 41C8D0 802A7B40 8D220000 */  lw        $v0, 0x0($t1)
/* 41C8D4 802A7B44 00A33821 */  addu      $a3, $a1, $v1
/* 41C8D8 802A7B48 ACE20000 */  sw        $v0, 0x0($a3)
/* 41C8DC 802A7B4C 24020003 */  addiu     $v0, $zero, 0x3
/* 41C8E0 802A7B50 3C01802B */  lui       $at, %hi(D_802AD678)
/* 41C8E4 802A7B54 00250821 */  addu      $at, $at, $a1
/* 41C8E8 802A7B58 AC22D678 */  sw        $v0, %lo(D_802AD678)($at)
/* 41C8EC 802A7B5C 3C02802B */  lui       $v0, %hi(D_802AD690)
/* 41C8F0 802A7B60 2442D690 */  addiu     $v0, $v0, %lo(D_802AD690)
/* 41C8F4 802A7B64 00A21821 */  addu      $v1, $a1, $v0
/* 41C8F8 802A7B68 AC680000 */  sw        $t0, 0x0($v1)
/* 41C8FC 802A7B6C 8C82000C */  lw        $v0, 0xC($a0)
/* 41C900 802A7B70 34C600A3 */  ori       $a2, $a2, (0x1D00A3 & 0xFFFF)
/* 41C904 802A7B74 3C01802B */  lui       $at, %hi(D_802AD6C0)
/* 41C908 802A7B78 00250821 */  addu      $at, $at, $a1
/* 41C90C 802A7B7C AC26D6C0 */  sw        $a2, %lo(D_802AD6C0)($at)
/* 41C910 802A7B80 3C01802B */  lui       $at, %hi(D_802AD658)
/* 41C914 802A7B84 00250821 */  addu      $at, $at, $a1
/* 41C918 802A7B88 AC22D658 */  sw        $v0, %lo(D_802AD658)($at)
/* 41C91C 802A7B8C 3C02800E */  lui       $v0, %hi(gBattleStatus + 0x4)
/* 41C920 802A7B90 8C42C074 */  lw        $v0, %lo(gBattleStatus + 0x4)($v0)
/* 41C924 802A7B94 30420020 */  andi      $v0, $v0, 0x20
/* 41C928 802A7B98 14400007 */  bnez      $v0, .L802A7BB8_7AF558
/* 41C92C 802A7B9C 00000000 */   nop
/* 41C930 802A7BA0 8D220004 */  lw        $v0, 0x4($t1)
/* 41C934 802A7BA4 ACE20000 */  sw        $v0, 0x0($a3)
/* 41C938 802A7BA8 AC600000 */  sw        $zero, 0x0($v1)
/* 41C93C 802A7BAC 3C01802B */  lui       $at, %hi(D_802AD6A8)
/* 41C940 802A7BB0 00250821 */  addu      $at, $at, $a1
/* 41C944 802A7BB4 AC28D6A8 */  sw        $t0, %lo(D_802AD6A8)($at)
.L802A7BB8_7AF558:
/* 41C948 802A7BB8 82C20053 */  lb        $v0, 0x53($s6)
/* 41C94C 802A7BBC 04410002 */  bgez      $v0, .L802A7BC8_7AF568
/* 41C950 802A7BC0 26940001 */   addiu    $s4, $s4, 0x1
/* 41C954 802A7BC4 A2C00053 */  sb        $zero, 0x53($s6)
.L802A7BC8_7AF568:
/* 41C958 802A7BC8 82DE0053 */  lb        $fp, 0x53($s6)
/* 41C95C 802A7BCC 3C01802B */  lui       $at, %hi(D_802AD66C)
/* 41C960 802A7BD0 AC34D66C */  sw        $s4, %lo(D_802AD66C)($at)
/* 41C964 802A7BD4 3C01802B */  lui       $at, %hi(D_802AD670)
/* 41C968 802A7BD8 AC3ED670 */  sw        $fp, %lo(D_802AD670)($at)
/* 41C96C 802A7BDC 0C0A9176 */  jal       func_802A45D8_7ABF78
/* 41C970 802A7BE0 00000000 */   nop
/* 41C974 802A7BE4 080AA04F */  j         .L802A813C_7AFADC
/* 41C978 802A7BE8 240200C9 */   addiu    $v0, $zero, 0xC9
glabel .L802A7BEC_7AF58C
/* 41C97C 802A7BEC 0C0A9295 */  jal       func_802A4A54_7AC3F4
/* 41C980 802A7BF0 00000000 */   nop
/* 41C984 802A7BF4 0040802D */  daddu     $s0, $v0, $zero
/* 41C988 802A7BF8 2402FFFF */  addiu     $v0, $zero, -0x1
/* 41C98C 802A7BFC 1202014F */  beq       $s0, $v0, .L802A813C_7AFADC
/* 41C990 802A7C00 240200CF */   addiu    $v0, $zero, 0xCF
/* 41C994 802A7C04 1200014F */  beqz      $s0, .L802A8144_7AFAE4
/* 41C998 802A7C08 240200FF */   addiu    $v0, $zero, 0xFF
/* 41C99C 802A7C0C 1602000B */  bne       $s0, $v0, .L802A7C3C_7AF5DC
/* 41C9A0 802A7C10 2603FFFF */   addiu    $v1, $s0, -0x1
/* 41C9A4 802A7C14 0C0A8414 */  jal       func_802A1050_7A89F0
/* 41C9A8 802A7C18 00000000 */   nop
/* 41C9AC 802A7C1C 24020008 */  addiu     $v0, $zero, 0x8
/* 41C9B0 802A7C20 3C01802B */  lui       $at, %hi(D_802ACC60)
/* 41C9B4 802A7C24 AC22CC60 */  sw        $v0, %lo(D_802ACC60)($at)
/* 41C9B8 802A7C28 24020004 */  addiu     $v0, $zero, 0x4
/* 41C9BC 802A7C2C 3C01802B */  lui       $at, %hi(D_802ACC6C)
/* 41C9C0 802A7C30 AC22CC6C */  sw        $v0, %lo(D_802ACC6C)($at)
/* 41C9C4 802A7C34 080A9FE1 */  j         .L802A7F84_7AF924
/* 41C9C8 802A7C38 24020001 */   addiu    $v0, $zero, 0x1
.L802A7C3C_7AF5DC:
/* 41C9CC 802A7C3C 00031080 */  sll       $v0, $v1, 2
/* 41C9D0 802A7C40 3C01802B */  lui       $at, %hi(D_802AD67B)
/* 41C9D4 802A7C44 00220821 */  addu      $at, $at, $v0
/* 41C9D8 802A7C48 9022D67B */  lbu       $v0, %lo(D_802AD67B)($at)
/* 41C9DC 802A7C4C A2C30053 */  sb        $v1, 0x53($s6)
/* 41C9E0 802A7C50 A2C20048 */  sb        $v0, 0x48($s6)
/* 41C9E4 802A7C54 82C30048 */  lb        $v1, 0x48($s6)
/* 41C9E8 802A7C58 24020005 */  addiu     $v0, $zero, 0x5
/* 41C9EC 802A7C5C 106200C9 */  beq       $v1, $v0, .L802A7F84_7AF924
/* 41C9F0 802A7C60 2402001E */   addiu    $v0, $zero, 0x1E
/* 41C9F4 802A7C64 0C0A91C6 */  jal       func_802A4718_7AC0B8
/* 41C9F8 802A7C68 00000000 */   nop
/* 41C9FC 802A7C6C 0C0A840C */  jal       func_802A1030_7A89D0
/* 41CA00 802A7C70 00000000 */   nop
/* 41CA04 802A7C74 080AA04F */  j         .L802A813C_7AFADC
/* 41CA08 802A7C78 240200CA */   addiu    $v0, $zero, 0xCA
glabel .L802A7C7C_7AF61C
/* 41CA0C 802A7C7C 0C0A9295 */  jal       func_802A4A54_7AC3F4
/* 41CA10 802A7C80 00000000 */   nop
/* 41CA14 802A7C84 8EC30214 */  lw        $v1, 0x214($s6)
/* 41CA18 802A7C88 30634000 */  andi      $v1, $v1, 0x4000
/* 41CA1C 802A7C8C 10600009 */  beqz      $v1, .L802A7CB4_7AF654
/* 41CA20 802A7C90 0040802D */   daddu    $s0, $v0, $zero
/* 41CA24 802A7C94 16000007 */  bnez      $s0, .L802A7CB4_7AF654
/* 41CA28 802A7C98 00000000 */   nop
/* 41CA2C 802A7C9C 0C0A923F */  jal       func_802A48FC_7AC29C
/* 41CA30 802A7CA0 00000000 */   nop
/* 41CA34 802A7CA4 0C0A8426 */  jal       func_802A1098_7A8A38
/* 41CA38 802A7CA8 00000000 */   nop
/* 41CA3C 802A7CAC 080AA04F */  j         .L802A813C_7AFADC
/* 41CA40 802A7CB0 240200CB */   addiu    $v0, $zero, 0xCB
.L802A7CB4_7AF654:
/* 41CA44 802A7CB4 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41CA48 802A7CB8 00000000 */   nop
/* 41CA4C 802A7CBC 10400121 */  beqz      $v0, .L802A8144_7AFAE4
/* 41CA50 802A7CC0 240200CC */   addiu    $v0, $zero, 0xCC
/* 41CA54 802A7CC4 82D00048 */  lb        $s0, 0x48($s6)
/* 41CA58 802A7CC8 A6C2006C */  sh        $v0, 0x6C($s6)
/* 41CA5C 802A7CCC 240200CD */  addiu     $v0, $zero, 0xCD
/* 41CA60 802A7CD0 A6C2006E */  sh        $v0, 0x6E($s6)
/* 41CA64 802A7CD4 24020004 */  addiu     $v0, $zero, 0x4
/* 41CA68 802A7CD8 1202002A */  beq       $s0, $v0, .L802A7D84_7AF724
/* 41CA6C 802A7CDC 2A020005 */   slti     $v0, $s0, 0x5
/* 41CA70 802A7CE0 10400005 */  beqz      $v0, .L802A7CF8_7AF698
/* 41CA74 802A7CE4 24020003 */   addiu    $v0, $zero, 0x3
/* 41CA78 802A7CE8 1202000A */  beq       $s0, $v0, .L802A7D14_7AF6B4
/* 41CA7C 802A7CEC 240200CD */   addiu    $v0, $zero, 0xCD
/* 41CA80 802A7CF0 080AA051 */  j         .L802A8144_7AFAE4
/* 41CA84 802A7CF4 00000000 */   nop
.L802A7CF8_7AF698:
/* 41CA88 802A7CF8 24020009 */  addiu     $v0, $zero, 0x9
/* 41CA8C 802A7CFC 12020010 */  beq       $s0, $v0, .L802A7D40_7AF6E0
/* 41CA90 802A7D00 2402000A */   addiu    $v0, $zero, 0xA
/* 41CA94 802A7D04 1202002B */  beq       $s0, $v0, .L802A7DB4_7AF754
/* 41CA98 802A7D08 240200CD */   addiu    $v0, $zero, 0xCD
/* 41CA9C 802A7D0C 080AA051 */  j         .L802A8144_7AFAE4
/* 41CAA0 802A7D10 00000000 */   nop
.L802A7D14_7AF6B4:
/* 41CAA4 802A7D14 3C01800E */  lui       $at, %hi(gBattleSubState)
/* 41CAA8 802A7D18 AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
/* 41CAAC 802A7D1C 0C0A9662 */  jal       func_802A5988_7AD328
/* 41CAB0 802A7D20 00000000 */   nop
/* 41CAB4 802A7D24 24040018 */  addiu     $a0, $zero, 0x18
/* 41CAB8 802A7D28 24020039 */  addiu     $v0, $zero, 0x39
/* 41CABC 802A7D2C A2D00178 */  sb        $s0, 0x178($s6)
/* 41CAC0 802A7D30 0C090464 */  jal       func_80241190
/* 41CAC4 802A7D34 A6C2017C */   sh       $v0, 0x17C($s6)
/* 41CAC8 802A7D38 080AA051 */  j         .L802A8144_7AFAE4
/* 41CACC 802A7D3C 00000000 */   nop
.L802A7D40_7AF6E0:
/* 41CAD0 802A7D40 3C05FBFF */  lui       $a1, (0xFBFFFFFF >> 16)
/* 41CAD4 802A7D44 34A5FFFF */  ori       $a1, $a1, (0xFBFFFFFF & 0xFFFF)
/* 41CAD8 802A7D48 3C03800E */  lui       $v1, %hi(gBattleStatus)
/* 41CADC 802A7D4C 2463C070 */  addiu     $v1, $v1, %lo(gBattleStatus)
/* 41CAE0 802A7D50 A2C0008B */  sb        $zero, 0x8B($s6)
/* 41CAE4 802A7D54 8C620000 */  lw        $v0, 0x0($v1)
/* 41CAE8 802A7D58 86C4006E */  lh        $a0, 0x6E($s6)
/* 41CAEC 802A7D5C 00451024 */  and       $v0, $v0, $a1
/* 41CAF0 802A7D60 AC620000 */  sw        $v0, 0x0($v1)
/* 41CAF4 802A7D64 3C01800E */  lui       $at, %hi(gBattleSubState)
/* 41CAF8 802A7D68 AC24C4DC */  sw        $a0, %lo(gBattleSubState)($at)
/* 41CAFC 802A7D6C 0C0A9662 */  jal       func_802A5988_7AD328
/* 41CB00 802A7D70 00000000 */   nop
.L802A7D74_7AF714:
/* 41CB04 802A7D74 0C090464 */  jal       func_80241190
/* 41CB08 802A7D78 24040016 */   addiu    $a0, $zero, 0x16
/* 41CB0C 802A7D7C 080AA051 */  j         .L802A8144_7AFAE4
/* 41CB10 802A7D80 00000000 */   nop
.L802A7D84_7AF724:
/* 41CB14 802A7D84 240200CD */  addiu     $v0, $zero, 0xCD
/* 41CB18 802A7D88 3C01800E */  lui       $at, %hi(gBattleSubState)
/* 41CB1C 802A7D8C AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
/* 41CB20 802A7D90 0C0A9662 */  jal       func_802A5988_7AD328
/* 41CB24 802A7D94 00000000 */   nop
/* 41CB28 802A7D98 24040019 */  addiu     $a0, $zero, 0x19
/* 41CB2C 802A7D9C 24020031 */  addiu     $v0, $zero, 0x31
/* 41CB30 802A7DA0 A6C2017C */  sh        $v0, 0x17C($s6)
.L802A7DA4_7AF744:
/* 41CB34 802A7DA4 0C090464 */  jal       func_80241190
/* 41CB38 802A7DA8 A2D00178 */   sb       $s0, 0x178($s6)
/* 41CB3C 802A7DAC 080AA051 */  j         .L802A8144_7AFAE4
/* 41CB40 802A7DB0 00000000 */   nop
.L802A7DB4_7AF754:
/* 41CB44 802A7DB4 3C01800E */  lui       $at, %hi(gBattleSubState)
/* 41CB48 802A7DB8 AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
/* 41CB4C 802A7DBC 0C0A9662 */  jal       func_802A5988_7AD328
/* 41CB50 802A7DC0 00000000 */   nop
.L802A7DC4_7AF764:
/* 41CB54 802A7DC4 0C090464 */  jal       func_80241190
/* 41CB58 802A7DC8 2404000B */   addiu    $a0, $zero, 0xB
/* 41CB5C 802A7DCC 080AA051 */  j         .L802A8144_7AFAE4
D_802A7DD0_7AF770:
/* 41CB60 802A7DD0 00000000 */   nop
glabel .L802A7DD4_7AF774
/* 41CB64 802A7DD4 0C0A9295 */  jal       func_802A4A54_7AC3F4
/* 41CB68 802A7DD8 00000000 */   nop
/* 41CB6C 802A7DDC 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41CB70 802A7DE0 00000000 */   nop
/* 41CB74 802A7DE4 104000D7 */  beqz      $v0, .L802A8144_7AFAE4
/* 41CB78 802A7DE8 24020008 */   addiu    $v0, $zero, 0x8
/* 41CB7C 802A7DEC 3C01802B */  lui       $at, %hi(D_802ACC60)
D_802A7DF0_7AF790:
/* 41CB80 802A7DF0 AC22CC60 */  sw        $v0, %lo(D_802ACC60)($at)
/* 41CB84 802A7DF4 24020004 */  addiu     $v0, $zero, 0x4
/* 41CB88 802A7DF8 3C01802B */  lui       $at, %hi(D_802ACC6C)
/* 41CB8C 802A7DFC AC22CC6C */  sw        $v0, %lo(D_802ACC6C)($at)
/* 41CB90 802A7E00 080AA04F */  j         .L802A813C_7AFADC
/* 41CB94 802A7E04 24020001 */   addiu    $v0, $zero, 0x1
glabel .L802A7E08_7AF7A8
/* 41CB98 802A7E08 0C0A923F */  jal       func_802A48FC_7AC29C
/* 41CB9C 802A7E0C 00000000 */   nop
/* 41CBA0 802A7E10 0C0A8426 */  jal       func_802A1098_7A8A38
/* 41CBA4 802A7E14 00000000 */   nop
/* 41CBA8 802A7E18 080AA04F */  j         .L802A813C_7AFADC
/* 41CBAC 802A7E1C 240200CB */   addiu    $v0, $zero, 0xCB
glabel .L802A7E20_7AF7C0
/* 41CBB0 802A7E20 0C0A9295 */  jal       func_802A4A54_7AC3F4
/* 41CBB4 802A7E24 00000000 */   nop
/* 41CBB8 802A7E28 2403FFFF */  addiu     $v1, $zero, -0x1
/* 41CBBC 802A7E2C 104300C5 */  beq       $v0, $v1, .L802A8144_7AFAE4
/* 41CBC0 802A7E30 240200C9 */   addiu    $v0, $zero, 0xC9
/* 41CBC4 802A7E34 080AA04F */  j         .L802A813C_7AFADC
/* 41CBC8 802A7E38 00000000 */   nop
glabel .L802A7E3C_7AF7DC
/* 41CBCC 802A7E3C 0000A02D */  daddu     $s4, $zero, $zero
/* 41CBD0 802A7E40 24130001 */  addiu     $s3, $zero, 0x1
/* 41CBD4 802A7E44 3C0C8009 */  lui       $t4, %hi(gPartnerPopupProperties)
/* 41CBD8 802A7E48 258CEF20 */  addiu     $t4, $t4, %lo(gPartnerPopupProperties)
/* 41CBDC 802A7E4C 3C0B802B */  lui       $t3, %hi(D_802AB3F8_7B2D98)
/* 41CBE0 802A7E50 256BB3F8 */  addiu     $t3, $t3, %lo(D_802AB3F8_7B2D98)
/* 41CBE4 802A7E54 0260502D */  daddu     $t2, $s3, $zero
/* 41CBE8 802A7E58 3C09802B */  lui       $t1, %hi(D_802AB438_7B2DD8)
/* 41CBEC 802A7E5C 2529B438 */  addiu     $t1, $t1, %lo(D_802AB438_7B2DD8)
/* 41CBF0 802A7E60 3C088009 */  lui       $t0, %hi(D_8008EEC4)
/* 41CBF4 802A7E64 2508EEC4 */  addiu     $t0, $t0, %lo(D_8008EEC4)
/* 41CBF8 802A7E68 3C04802B */  lui       $a0, %hi(D_802ACCD0)
/* 41CBFC 802A7E6C 2484CCD0 */  addiu     $a0, $a0, %lo(D_802ACCD0)
.L802A7E70_7AF810:
/* 41CC00 802A7E70 8D050000 */  lw        $a1, 0x0($t0)
/* 41CC04 802A7E74 000510C0 */  sll       $v0, $a1, 3
/* 41CC08 802A7E78 02A23021 */  addu      $a2, $s5, $v0
/* 41CC0C 802A7E7C 90C20014 */  lbu       $v0, 0x14($a2)
/* 41CC10 802A7E80 50400019 */  beql      $v0, $zero, .L802A7EE8_7AF888
/* 41CC14 802A7E84 26730001 */   addiu    $s3, $s3, 0x1
/* 41CC18 802A7E88 00053880 */  sll       $a3, $a1, 2
/* 41CC1C 802A7E8C 00EB1021 */  addu      $v0, $a3, $t3
/* 41CC20 802A7E90 00051900 */  sll       $v1, $a1, 4
/* 41CC24 802A7E94 8C420000 */  lw        $v0, 0x0($v0)
/* 41CC28 802A7E98 006C1821 */  addu      $v1, $v1, $t4
/* 41CC2C 802A7E9C AC850108 */  sw        $a1, 0x108($a0)
/* 41CC30 802A7EA0 AC8A018C */  sw        $t2, 0x18C($a0)
/* 41CC34 802A7EA4 AC820000 */  sw        $v0, 0x0($a0)
/* 41CC38 802A7EA8 8C620000 */  lw        $v0, 0x0($v1)
/* 41CC3C 802A7EAC AC820084 */  sw        $v0, 0x84($a0)
/* 41CC40 802A7EB0 8C62000C */  lw        $v0, 0xC($v1)
/* 41CC44 802A7EB4 AC820294 */  sw        $v0, 0x294($a0)
/* 41CC48 802A7EB8 80C20015 */  lb        $v0, 0x15($a2)
/* 41CC4C 802A7EBC AC820210 */  sw        $v0, 0x210($a0)
/* 41CC50 802A7EC0 82A20012 */  lb        $v0, 0x12($s5)
/* 41CC54 802A7EC4 54450006 */  bnel      $v0, $a1, .L802A7EE0_7AF880
/* 41CC58 802A7EC8 24840004 */   addiu    $a0, $a0, 0x4
/* 41CC5C 802A7ECC 00E91021 */  addu      $v0, $a3, $t1
/* 41CC60 802A7ED0 AC80018C */  sw        $zero, 0x18C($a0)
/* 41CC64 802A7ED4 8C420000 */  lw        $v0, 0x0($v0)
/* 41CC68 802A7ED8 AC820000 */  sw        $v0, 0x0($a0)
/* 41CC6C 802A7EDC 24840004 */  addiu     $a0, $a0, 0x4
.L802A7EE0_7AF880:
/* 41CC70 802A7EE0 26940001 */  addiu     $s4, $s4, 0x1
/* 41CC74 802A7EE4 26730001 */  addiu     $s3, $s3, 0x1
.L802A7EE8_7AF888:
/* 41CC78 802A7EE8 2A62000C */  slti      $v0, $s3, 0xC
/* 41CC7C 802A7EEC 1440FFE0 */  bnez      $v0, .L802A7E70_7AF810
/* 41CC80 802A7EF0 25080004 */   addiu    $t0, $t0, 0x4
/* 41CC84 802A7EF4 82C20051 */  lb        $v0, 0x51($s6)
/* 41CC88 802A7EF8 04420001 */  bltzl     $v0, .L802A7F00_7AF8A0
/* 41CC8C 802A7EFC A2C00051 */   sb       $zero, 0x51($s6)
.L802A7F00_7AF8A0:
/* 41CC90 802A7F00 82A30012 */  lb        $v1, 0x12($s5)
/* 41CC94 802A7F04 24020001 */  addiu     $v0, $zero, 0x1
/* 41CC98 802A7F08 3C01802B */  lui       $at, %hi(D_802ACFE8)
/* 41CC9C 802A7F0C AC22CFE8 */  sw        $v0, %lo(D_802ACFE8)($at)
/* 41CCA0 802A7F10 3C01802B */  lui       $at, %hi(D_802ACFF4)
/* 41CCA4 802A7F14 AC34CFF4 */  sw        $s4, %lo(D_802ACFF4)($at)
/* 41CCA8 802A7F18 00031880 */  sll       $v1, $v1, 2
/* 41CCAC 802A7F1C 3C028009 */  lui       $v0, %hi(D_8008EEF0)
/* 41CCB0 802A7F20 00431021 */  addu      $v0, $v0, $v1
/* 41CCB4 802A7F24 8C42EEF0 */  lw        $v0, %lo(D_8008EEF0)($v0)
/* 41CCB8 802A7F28 3C04802B */  lui       $a0, %hi(D_802ACCD0)
/* 41CCBC 802A7F2C 2484CCD0 */  addiu     $a0, $a0, %lo(D_802ACCD0)
/* 41CCC0 802A7F30 AC80031C */  sw        $zero, 0x31C($a0)
/* 41CCC4 802A7F34 AC800320 */  sw        $zero, 0x320($a0)
/* 41CCC8 802A7F38 2442FFFF */  addiu     $v0, $v0, -0x1
/* 41CCCC 802A7F3C 0C03D44F */  jal       create_battle_popup_menu
/* 41CCD0 802A7F40 AC820328 */   sw       $v0, 0x328($a0)
/* 41CCD4 802A7F44 0C03D4AF */  jal       func_800F52BC
/* 41CCD8 802A7F48 00000000 */   nop
/* 41CCDC 802A7F4C 080AA04F */  j         .L802A813C_7AFADC
/* 41CCE0 802A7F50 2402001F */   addiu    $v0, $zero, 0x1F
glabel .L802A7F54_7AF8F4
/* 41CCE4 802A7F54 3C03802B */  lui       $v1, %hi(D_802ACFFC)
/* 41CCE8 802A7F58 8463CFFC */  lh        $v1, %lo(D_802ACFFC)($v1)
/* 41CCEC 802A7F5C 2402FFFF */  addiu     $v0, $zero, -0x1
/* 41CCF0 802A7F60 10620076 */  beq       $v1, $v0, .L802A813C_7AFADC
/* 41CCF4 802A7F64 24020024 */   addiu    $v0, $zero, 0x24
/* 41CCF8 802A7F68 10600076 */  beqz      $v1, .L802A8144_7AFAE4
/* 41CCFC 802A7F6C 240200FF */   addiu    $v0, $zero, 0xFF
/* 41CD00 802A7F70 1462000C */  bne       $v1, $v0, .L802A7FA4_7AF944
/* 41CD04 802A7F74 24020022 */   addiu    $v0, $zero, 0x22
/* 41CD08 802A7F78 0C0A91F8 */  jal       func_802A47E0_7AC180
/* 41CD0C 802A7F7C 00000000 */   nop
/* 41CD10 802A7F80 240200C9 */  addiu     $v0, $zero, 0xC9
.L802A7F84_7AF924:
/* 41CD14 802A7F84 3C01800E */  lui       $at, %hi(gBattleSubState)
/* 41CD18 802A7F88 AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
/* 41CD1C 802A7F8C 0C0A9662 */  jal       func_802A5988_7AD328
/* 41CD20 802A7F90 00000000 */   nop
/* 41CD24 802A7F94 0C0A9662 */  jal       func_802A5988_7AD328
/* 41CD28 802A7F98 00000000 */   nop
/* 41CD2C 802A7F9C 080AA051 */  j         .L802A8144_7AFAE4
/* 41CD30 802A7FA0 00000000 */   nop
.L802A7FA4_7AF944:
/* 41CD34 802A7FA4 24030023 */  addiu     $v1, $zero, 0x23
/* 41CD38 802A7FA8 A6C2006C */  sh        $v0, 0x6C($s6)
/* 41CD3C 802A7FAC 3C02802B */  lui       $v0, %hi(D_802ACFFC)
/* 41CD40 802A7FB0 8442CFFC */  lh        $v0, %lo(D_802ACFFC)($v0)
/* 41CD44 802A7FB4 3C0E802B */  lui       $t6, %hi(D_802ACCD0)
/* 41CD48 802A7FB8 25CECCD0 */  addiu     $t6, $t6, %lo(D_802ACCD0)
/* 41CD4C 802A7FBC A6C3006E */  sh        $v1, 0x6E($s6)
/* 41CD50 802A7FC0 2442FFFF */  addiu     $v0, $v0, -0x1
/* 41CD54 802A7FC4 00021080 */  sll       $v0, $v0, 2
/* 41CD58 802A7FC8 01C21021 */  addu      $v0, $t6, $v0
/* 41CD5C 802A7FCC 9043010B */  lbu       $v1, 0x10B($v0)
/* 41CD60 802A7FD0 24020005 */  addiu     $v0, $zero, 0x5
/* 41CD64 802A7FD4 A2C20178 */  sb        $v0, 0x178($s6)
/* 41CD68 802A7FD8 24020037 */  addiu     $v0, $zero, 0x37
/* 41CD6C 802A7FDC A6C2017C */  sh        $v0, 0x17C($s6)
/* 41CD70 802A7FE0 24020002 */  addiu     $v0, $zero, 0x2
/* 41CD74 802A7FE4 AEC20184 */  sw        $v0, 0x184($s6)
/* 41CD78 802A7FE8 A2C301AC */  sb        $v1, 0x1AC($s6)
/* 41CD7C 802A7FEC 00031E00 */  sll       $v1, $v1, 24
/* 41CD80 802A7FF0 3C02802B */  lui       $v0, %hi(D_802ACFFD)
/* 41CD84 802A7FF4 9042CFFD */  lbu       $v0, %lo(D_802ACFFD)($v0)
/* 41CD88 802A7FF8 00031E03 */  sra       $v1, $v1, 24
/* 41CD8C 802A7FFC A6C3017A */  sh        $v1, 0x17A($s6)
/* 41CD90 802A8000 2442FFFF */  addiu     $v0, $v0, -0x1
/* 41CD94 802A8004 0C03C4EC */  jal       hide_popup_menu
/* 41CD98 802A8008 A2C20051 */   sb       $v0, 0x51($s6)
/* 41CD9C 802A800C 0C0A91C6 */  jal       func_802A4718_7AC0B8
/* 41CDA0 802A8010 00000000 */   nop
/* 41CDA4 802A8014 0C0A840C */  jal       func_802A1030_7A89D0
/* 41CDA8 802A8018 00000000 */   nop
/* 41CDAC 802A801C 080AA04F */  j         .L802A813C_7AFADC
/* 41CDB0 802A8020 24020020 */   addiu    $v0, $zero, 0x20
glabel .L802A8024_7AF9C4
/* 41CDB4 802A8024 8EC20214 */  lw        $v0, 0x214($s6)
/* 41CDB8 802A8028 30424000 */  andi      $v0, $v0, 0x4000
/* 41CDBC 802A802C 1040000D */  beqz      $v0, .L802A8064_7AFA04
/* 41CDC0 802A8030 00000000 */   nop
/* 41CDC4 802A8034 3C02802B */  lui       $v0, %hi(D_802ACFFC)
/* 41CDC8 802A8038 8442CFFC */  lh        $v0, %lo(D_802ACFFC)($v0)
/* 41CDCC 802A803C 14400009 */  bnez      $v0, .L802A8064_7AFA04
/* 41CDD0 802A8040 00000000 */   nop
/* 41CDD4 802A8044 0C03C5B3 */  jal       func_800F16CC
/* 41CDD8 802A8048 00000000 */   nop
/* 41CDDC 802A804C 0C0A9284 */  jal       func_802A4A10_7AC3B0
/* 41CDE0 802A8050 00000000 */   nop
/* 41CDE4 802A8054 0C0A8426 */  jal       func_802A1098_7A8A38
/* 41CDE8 802A8058 00000000 */   nop
/* 41CDEC 802A805C 080AA04F */  j         .L802A813C_7AFADC
/* 41CDF0 802A8060 24020021 */   addiu    $v0, $zero, 0x21
.L802A8064_7AFA04:
/* 41CDF4 802A8064 0C0A9295 */  jal       func_802A4A54_7AC3F4
/* 41CDF8 802A8068 00000000 */   nop
/* 41CDFC 802A806C 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41CE00 802A8070 00000000 */   nop
/* 41CE04 802A8074 10400033 */  beqz      $v0, .L802A8144_7AFAE4
/* 41CE08 802A8078 00000000 */   nop
/* 41CE0C 802A807C 86C2006E */  lh        $v0, 0x6E($s6)
/* 41CE10 802A8080 3C01800E */  lui       $at, %hi(gBattleSubState)
/* 41CE14 802A8084 AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
/* 41CE18 802A8088 0C0A9662 */  jal       func_802A5988_7AD328
/* 41CE1C 802A808C 00000000 */   nop
/* 41CE20 802A8090 0C090464 */  jal       func_80241190
/* 41CE24 802A8094 2404001D */   addiu    $a0, $zero, 0x1D
/* 41CE28 802A8098 080AA051 */  j         .L802A8144_7AFAE4
/* 41CE2C 802A809C 00000000 */   nop
glabel .L802A80A0_7AFA40
/* 41CE30 802A80A0 0C0A9295 */  jal       func_802A4A54_7AC3F4
/* 41CE34 802A80A4 00000000 */   nop
/* 41CE38 802A80A8 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41CE3C 802A80AC 00000000 */   nop
/* 41CE40 802A80B0 10400024 */  beqz      $v0, .L802A8144_7AFAE4
/* 41CE44 802A80B4 2402001F */   addiu    $v0, $zero, 0x1F
/* 41CE48 802A80B8 080AA04F */  j         .L802A813C_7AFADC
/* 41CE4C 802A80BC 00000000 */   nop
glabel .L802A80C0_7AFA60
/* 41CE50 802A80C0 0C03C5B3 */  jal       func_800F16CC
/* 41CE54 802A80C4 00000000 */   nop
/* 41CE58 802A80C8 0C0A9284 */  jal       func_802A4A10_7AC3B0
/* 41CE5C 802A80CC 00000000 */   nop
/* 41CE60 802A80D0 0C0A8426 */  jal       func_802A1098_7A8A38
/* 41CE64 802A80D4 00000000 */   nop
/* 41CE68 802A80D8 080AA04F */  j         .L802A813C_7AFADC
/* 41CE6C 802A80DC 24020021 */   addiu    $v0, $zero, 0x21
glabel .L802A80E0_7AFA80
/* 41CE70 802A80E0 0C03C54E */  jal       destroy_popup_menu
/* 41CE74 802A80E4 00000000 */   nop
glabel .L802A80E8_7AFA88
/* 41CE78 802A80E8 0C0A91CB */  jal       func_802A472C_7AC0CC
/* 41CE7C 802A80EC 00000000 */   nop
/* 41CE80 802A80F0 080A9CB5 */  j         .L802A72D4_7AEC74
/* 41CE84 802A80F4 00000000 */   nop
glabel .L802A80F8_7AFA98
/* 41CE88 802A80F8 24040006 */  addiu     $a0, $zero, 0x6
/* 41CE8C 802A80FC 0C051F9F */  jal       set_window_update
/* 41CE90 802A8100 24050002 */   addiu    $a1, $zero, 0x2
/* 41CE94 802A8104 24040007 */  addiu     $a0, $zero, 0x7
/* 41CE98 802A8108 0C051F9F */  jal       set_window_update
/* 41CE9C 802A810C 24050002 */   addiu    $a1, $zero, 0x2
D_802A8110_7AFAB0:
/* 41CEA0 802A8110 3C03802B */  lui       $v1, %hi(D_802ACFFC)
/* 41CEA4 802A8114 8463CFFC */  lh        $v1, %lo(D_802ACFFC)($v1)
/* 41CEA8 802A8118 2402FFFF */  addiu     $v0, $zero, -0x1
/* 41CEAC 802A811C 10620009 */  beq       $v1, $v0, .L802A8144_7AFAE4
/* 41CEB0 802A8120 24040006 */   addiu    $a0, $zero, 0x6
/* 41CEB4 802A8124 0C051F9F */  jal       set_window_update
/* 41CEB8 802A8128 24050009 */   addiu    $a1, $zero, 0x9
/* 41CEBC 802A812C 24040007 */  addiu     $a0, $zero, 0x7
D_802A8130_7AFAD0:
/* 41CEC0 802A8130 0C051F9F */  jal       set_window_update
/* 41CEC4 802A8134 24050009 */   addiu    $a1, $zero, 0x9
/* 41CEC8 802A8138 2402001F */  addiu     $v0, $zero, 0x1F
.L802A813C_7AFADC:
/* 41CECC 802A813C 3C01800E */  lui       $at, %hi(gBattleSubState)
/* 41CED0 802A8140 AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
glabel .L802A8144_7AFAE4
/* 41CED4 802A8144 8FBF0034 */  lw        $ra, 0x34($sp)
/* 41CED8 802A8148 8FBE0030 */  lw        $fp, 0x30($sp)
/* 41CEDC 802A814C 8FB7002C */  lw        $s7, 0x2C($sp)
/* 41CEE0 802A8150 8FB60028 */  lw        $s6, 0x28($sp)
/* 41CEE4 802A8154 8FB50024 */  lw        $s5, 0x24($sp)
/* 41CEE8 802A8158 8FB40020 */  lw        $s4, 0x20($sp)
/* 41CEEC 802A815C 8FB3001C */  lw        $s3, 0x1C($sp)
/* 41CEF0 802A8160 8FB20018 */  lw        $s2, 0x18($sp)
/* 41CEF4 802A8164 8FB10014 */  lw        $s1, 0x14($sp)
/* 41CEF8 802A8168 8FB00010 */  lw        $s0, 0x10($sp)
/* 41CEFC 802A816C D7B80048 */  ldc1      $f24, 0x48($sp)
/* 41CF00 802A8170 D7B60040 */  ldc1      $f22, 0x40($sp)
/* 41CF04 802A8174 D7B40038 */  ldc1      $f20, 0x38($sp)
/* 41CF08 802A8178 03E00008 */  jr        $ra
/* 41CF0C 802A817C 27BD0050 */   addiu    $sp, $sp, 0x50

### DECOMPILED C INSTRUCTIONS:

void btl_state_update_player_menu(void) {
    BattleStatus* battleStatus = &gBattleStatus;
    PlayerData* playerData = &gPlayerData;
    Actor* playerActor = battleStatus->playerActor;
    Actor* partnerActor = battleStatus->partnerActor;
    PopupMenu* popup = &D_802ACCD0;
    MoveData* moveData;
    s32 entryIdx, initialPos;
    s32 i;
    s32 submenuResult;
    s32 jumpTargetCount, hammerTargetCount, jumpChance;
    ItemData* itemData;
    s32 starBeamLevel;
    s32 currentSubmenu;
    s32 currentSubmenu2;
    IconHudScriptPair* hudScriptPair;
    PartnerPopupProperties* prop;

    switch (gBattleSubState) {
        case BTL_SUBSTATE_PLAYER_MENU_INIT:
            battleStatus->moveCategory = BTL_MENU_TYPE_INVALID;
            battleStatus->selectedMoveID = 0;
            battleStatus->currentAttackElement = 0;
            if (!can_btl_state_update_switch_to_player()) {
                btl_set_state(BATTLE_STATE_END_PLAYER_TURN);
                return;
            }
            btl_cam_use_preset(BTL_CAM_DEFAULT);
            btl_cam_move(10);
            if (!(battleStatus->flags1 & BS_FLAGS1_PLAYER_IN_BACK)) {
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CREATE_MAIN_MENU;
            } else {
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_PERFORM_SWAP;
                partnerActor->state.currentPos.x = partnerActor->homePos.x;
                partnerActor->state.currentPos.z = partnerActor->homePos.z;
                partnerActor->state.goalPos.x = playerActor->homePos.x;
                partnerActor->state.goalPos.z = playerActor->homePos.z;
                partnerActor->state.moveTime = 4;
                partnerActor->state.angle = 0.0f;
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_PERFORM_SWAP:
            if (partnerActor->state.moveTime != 0) {
                partnerActor->currentPos.x += (partnerActor->state.goalPos.x - partnerActor->currentPos.x) / partnerActor->state.moveTime;
                partnerActor->currentPos.z += (partnerActor->state.goalPos.z - partnerActor->currentPos.z) / partnerActor->state.moveTime;
                playerActor->currentPos.x += (partnerActor->state.currentPos.x - playerActor->currentPos.x) / partnerActor->state.moveTime;
                playerActor->currentPos.z += (partnerActor->state.currentPos.z - playerActor->currentPos.z) / partnerActor->state.moveTime;
            }
            partnerActor->currentPos.z -= sin_rad(DEG_TO_RAD(partnerActor->state.angle)) * 16.0f;
            partnerActor->yaw = clamp_angle(-partnerActor->state.angle);
            playerActor->currentPos.z += sin_rad(DEG_TO_RAD(partnerActor->state.angle)) * 16.0f;
            playerActor->yaw = clamp_angle(-partnerActor->state.angle);
            partnerActor->state.angle += 90.0f;
            if (partnerActor->state.moveTime != 0) {
                partnerActor->state.moveTime--;
            } else {
                partnerActor->currentPos.x = partnerActor->state.goalPos.x;
                partnerActor->currentPos.z = partnerActor->state.goalPos.z;
                playerActor->currentPos.x = partnerActor->state.currentPos.x;
                playerActor->currentPos.z = partnerActor->state.currentPos.z;
                partnerActor->homePos.x = partnerActor->currentPos.x;
                partnerActor->homePos.z = partnerActor->currentPos.z;
                playerActor->homePos.x = playerActor->currentPos.x;
                playerActor->homePos.z = playerActor->currentPos.z;
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CREATE_MAIN_MENU;
                battleStatus->flags1 &= ~BS_FLAGS1_PLAYER_IN_BACK;
            }
            break;
    }

    switch (gBattleSubState) {
        case BTL_SUBSTATE_PLAYER_MENU_CREATE_MAIN_MENU:
            gBattleStatus.flags1 |= BS_FLAGS1_MENU_OPEN;
            playerActor->flags &= ~ACTOR_FLAG_4000000;
            playerActor->flags |= ACTOR_FLAG_8000000;
            if (partnerActor != NULL) {
                partnerActor->flags |= ACTOR_FLAG_4000000;
                partnerActor->flags |= ACTOR_FLAG_8000000;
            }
            func_80263268();
            func_80263300();
            btl_init_menu_boots();
            btl_init_menu_hammer();
            if (player_team_is_ability_active(playerActor, ABILITY_BERSERKER)) {
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_BERSERKER_1;
                break;
            }

            entryIdx = 0;
            initialPos = 2;
            if (battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_MAIN] < 0) {
                battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_MAIN] = 0;
            }

            // strategies menu category
            battle_menu_submenuIDs[entryIdx] = BTL_MENU_TYPE_STRATEGIES;
            BattleMenu_OptionEnabled[entryIdx] = TRUE;
            BattleMenu_HudScripts[entryIdx] = battle_menu_StrategiesHudScript.enabled;
            BattleMenu_TitleMessages[entryIdx] = BattleMenu_CenteredMessages[BTL_MENU_TYPE_STRATEGIES];
            if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_TUTORIAL || gBattleStatus.flags1 & BS_FLAGS1_TUTORIAL_BATTLE) {
                BattleMenu_TitleMessages[entryIdx] = MSG_Menus_EndTraining_Centered;
            }
            battle_menu_isMessageDisabled[entryIdx] = 0;
            if (!(battleStatus->enabledMenusFlags & BTL_MENU_ENABLED_STRATEGIES)) {
                BattleMenu_HudScripts[entryIdx] = battle_menu_StrategiesHudScript.disabled;
                BattleMenu_OptionEnabled[entryIdx] = FALSE;
                battle_menu_isMessageDisabled[entryIdx] = BTL_MSG_CANT_SELECT_NOW;
            }
            if (battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_MAIN] == BTL_MENU_TYPE_STRATEGIES) {
                initialPos = entryIdx;
            }
            entryIdx++;

            // items menu category
            if (battleStatus->menuStatus[0] >= 0) {
                BattleMenu_HudScripts[entryIdx] = battle_menu_ItemHudScripts.enabled;
                battle_menu_submenuIDs[entryIdx] = BTL_MENU_TYPE_ITEMS;
                BattleMenu_OptionEnabled[entryIdx] = TRUE;
                BattleMenu_TitleMessages[entryIdx] = BattleMenu_CenteredMessages[BTL_MENU_TYPE_ITEMS];

                if(battleStatus->menuStatus[0] == 0) {
                    BattleMenu_HudScripts[entryIdx] = battle_menu_ItemHudScripts.disabled;
                    BattleMenu_OptionEnabled[entryIdx] = FALSE;
                    battle_menu_isMessageDisabled[entryIdx] = BTL_MSG_NO_ITEM_TARGET;
                }

                if (!(battleStatus->enabledMenusFlags & BTL_MENU_ENABLED_ITEMS)) {
                    BattleMenu_HudScripts[entryIdx] = battle_menu_ItemHudScripts.disabled;
                    BattleMenu_OptionEnabled[entryIdx] = FALSE;
                    battle_menu_isMessageDisabled[entryIdx] = BTL_MSG_CANT_SELECT_NOW;
                }

                if (battleStatus->itemLossTurns >= 0) {
                    BattleMenu_HudScripts[entryIdx] = battle_menu_ItemHudScripts.disabled;
                    BattleMenu_OptionEnabled[entryIdx] = FALSE;
                    battle_menu_isMessageDisabled[entryIdx] = BTL_MSG_CANT_SELECT_NOW;
                }

                if (battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_MAIN] == BTL_MENU_TYPE_ITEMS) {
                    initialPos = entryIdx;
                }

                entryIdx++;
            }

            // jump menu category
            BattleMenu_HudScripts[entryIdx] = battle_menu_JumpHudScripts[playerData->bootsLevel + 1].enabled;
            battle_menu_submenuIDs[entryIdx] = BTL_MENU_TYPE_JUMP;
            BattleMenu_OptionEnabled[entryIdx] = TRUE;
            BattleMenu_TitleMessages[entryIdx] = BattleMenu_CenteredMessages[BTL_MENU_TYPE_JUMP];

            if (battleStatus->menuStatus[1] <= 0) {
                BattleMenu_HudScripts[entryIdx] = battle_menu_JumpHudScripts[0].enabled;
                BattleMenu_OptionEnabled[entryIdx] = FALSE;
                battle_menu_isMessageDisabled[entryIdx] = BTL_MSG_NO_JUMP_TARGET;
            }
            if (!(battleStatus->enabledMenusFlags & BTL_MENU_ENABLED_JUMP)) {
                BattleMenu_HudScripts[entryIdx] = battle_menu_JumpHudScripts[0].disabled;
                BattleMenu_OptionEnabled[entryIdx] = FALSE;
                battle_menu_isMessageDisabled[entryIdx] = BTL_MSG_CANT_SELECT_NOW;
            }
            if (battleStatus->jumpLossTurns >= 0) {
                BattleMenu_HudScripts[entryIdx] = battle_menu_JumpHudScripts[0].disabled;
                BattleMenu_OptionEnabled[entryIdx] = FALSE;
                battle_menu_isMessageDisabled[entryIdx] = BTL_MSG_CANT_SELECT_NOW;
            }
            if (battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_MAIN] == BTL_MENU_TYPE_JUMP) {
                initialPos = entryIdx;
            }
            entryIdx++;

            // hammer menu category
            if (playerData->hammerLevel >= 0) {
                BattleMenu_HudScripts[entryIdx] = battle_menu_HammerHudScripts[playerData->hammerLevel + 1].enabled;
                battle_menu_submenuIDs[entryIdx] = BTL_MENU_TYPE_SMASH;
                BattleMenu_OptionEnabled[entryIdx] = TRUE;
                BattleMenu_TitleMessages[entryIdx] = BattleMenu_CenteredMessages[BTL_MENU_TYPE_SMASH];
                if (battleStatus->menuStatus[2] <= 0) {
                    BattleMenu_HudScripts[entryIdx] = battle_menu_HammerHudScripts[0].enabled;
                    BattleMenu_OptionEnabled[entryIdx] = FALSE;
                    battle_menu_isMessageDisabled[entryIdx] = BTL_MSG_NO_HAMMER_TARGET;
                }
                if (!(battleStatus->enabledMenusFlags & BTL_MENU_ENABLED_SMASH)) {
                    BattleMenu_HudScripts[entryIdx] = battle_menu_HammerHudScripts[0].disabled;
                    BattleMenu_OptionEnabled[entryIdx] = FALSE;
                    battle_menu_isMessageDisabled[entryIdx] = BTL_MSG_CANT_SELECT_NOW;
                }
                if (battleStatus->hammerLossTurns >= 0) {
                    BattleMenu_HudScripts[entryIdx] = battle_menu_HammerHudScripts[0].disabled;
                    BattleMenu_OptionEnabled[entryIdx] = FALSE;
                    battle_menu_isMessageDisabled[entryIdx] = BTL_MSG_CANT_SELECT_NOW;
                }
                if (battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_MAIN] == BTL_MENU_TYPE_SMASH) {
                    initialPos = entryIdx;
                }
                entryIdx++;
            }

            // star powers menu category
            if (playerData->maxStarPower != 0) {
                BattleMenu_HudScripts[entryIdx] = battle_menu_StarPowerHudScripts.enabled;
                battle_menu_submenuIDs[entryIdx] = BTL_MENU_TYPE_STAR_POWERS;
                BattleMenu_OptionEnabled[entryIdx] = TRUE;
                BattleMenu_TitleMessages[entryIdx] = BattleMenu_CenteredMessages[BTL_MENU_TYPE_STAR_POWERS];
                battle_menu_isMessageDisabled[entryIdx] = 0;
                if (!(battleStatus->enabledMenusFlags & BTL_MENU_ENABLED_STAR_POWERS)) {
                    BattleMenu_HudScripts[entryIdx] = battle_menu_StarPowerHudScripts.disabled;
                    BattleMenu_OptionEnabled[entryIdx] = FALSE;
                    battle_menu_isMessageDisabled[entryIdx] = BTL_MSG_CANT_SELECT_NOW;
                }
                if (battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_MAIN] == BTL_MENU_TYPE_STAR_POWERS) {
                    initialPos = entryIdx;
                }
                entryIdx++;
            }

            BattleMenu_NumOptions = entryIdx;
            D_802AD0A8 = 0;
            D_802AD0B0 = initialPos;
            D_802AD100 = 2 - initialPos;
            if (func_802A58D0()) {
                BattleMenu_ShowSwapIcons = TRUE;
            } else {
                BattleMenu_ShowSwapIcons = FALSE;
            }
            btl_main_menu_init();
            D_802ACC60 = 8;
            D_802ACC6C = 0;
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CHOOSE_CATEGORY;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_CHOOSE_CATEGORY:
            if (battleStatus->hustleTurns != 0) {
                set_animation(ACTOR_PLAYER, 0, ANIM_Mario1_ThinkingRun);
            } else {
                set_animation(ACTOR_PLAYER, 0, get_player_anim_for_status(STATUS_KEY_THINKING));
            }
            submenuResult = btl_main_menu_update();
            if (D_802ACC6C != 0) {
                D_802ACC6C--;
            } else if (!(gBattleStatus.flags1 & BS_FLAGS1_TUTORIAL_BATTLE) && (gGameStatusPtr->pressedButtons[0] & BUTTON_Z)) {
                if (func_802A58D0() && battleStatus->hustleTurns != 1) {
                    sfx_play_sound(SOUND_F);
                    battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_MAIN] = battle_menu_submenuIDs[BattleMenu_CurPos + BattleMenu_HomePos];
                    btl_main_menu_destroy();
                    btl_set_state(BATTLE_STATE_SWITCH_TO_PARTNER);
                } else if (partnerActor != NULL && !(partnerActor->flags & BS_FLAGS1_YIELD_TURN) && battleStatus->hustleTurns != 1) {
                    sfx_play_sound(SOUND_MENU_ERROR);
                    gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_MAIN_SHOW_CANT_SWAP;
                }
                break;
            }

            if (D_802ACC60 != 0) {
                D_802ACC60--;
            } else if (submenuResult != 0) {
                set_animation(ACTOR_PLAYER, 0, ANIM_Mario1_Walk);
                battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_MAIN] = battleStatus->currentSubmenu = battle_menu_submenuIDs[submenuResult - 1];
                for (i = 0; i < ARRAY_COUNT(battleStatus->submenuMoves); i++) {
                    battleStatus->submenuMoves[i] = 0;
                    battleStatus->submenuIcons[0] = 0; ///< @bug ?
                    battleStatus->submenuStatus[i] = 0;
                }

                switch (battleStatus->currentSubmenu) {
                    case BTL_MENU_TYPE_ITEMS:
                        battleStatus->submenuMoves[0] = D_802AB4F0[8];
                        battleStatus->submenuIcons[0] = ITEM_PARTNER_ATTACK;
                        battleStatus->submenuStatus[0] = 1;
                        for (i = 0; i < ARRAY_COUNT(playerData->invItems); i++) {
                            if (playerData->invItems[i] == 0) {
                                continue;
                            }
                            itemData = &gItemTable[playerData->invItems[i]];

                            battleStatus->moveCategory = BTL_MENU_TYPE_ITEMS;
                            battleStatus->moveArgument = playerData->invItems[i];
                            battleStatus->currentTargetListFlags = itemData->targetFlags;
                            player_create_target_list(playerActor);
                        }
                        entryIdx = 1;
                        for (i = 0; i < ARRAY_COUNT(playerData->equippedBadges); i++) {
                            if (playerData->equippedBadges[i] != 0) {
                                s32 moveID = gItemTable[playerData->equippedBadges[i]].moveID;
                                moveData = &gMoveTable[moveID];
                                if (moveData->category == D_802AB4F0[battleStatus->currentSubmenu]) {
                                    battleStatus->submenuMoves[entryIdx] = moveID;
                                    battleStatus->submenuIcons[entryIdx] = playerData->equippedBadges[i];
                                    battleStatus->submenuStatus[entryIdx] = 1;
                                    if (playerData->curFP < moveData->costFP) {
                                        battleStatus->submenuStatus[entryIdx] = 0;
                                    }
                                    entryIdx++;
                                }
                            }
                        }
                        battleStatus->submenuMoveCount = entryIdx;
                        if (entryIdx == 1) {
                            battleStatus->submenuMoveCount = 0;
                        }
                        break;
                        do { // required to match
                    case BTL_MENU_TYPE_SMASH:
                        btl_init_menu_hammer();
                        if (battleStatus->submenuMoveCount == 1) {
                            battleStatus->submenuMoveCount = 0;
                        }
                        if (battleStatus->actionCommandMode == 2) {
                            battleStatus->submenuMoveCount = 0;
                        }
                        break;
                    case BTL_MENU_TYPE_JUMP:
                        btl_init_menu_boots();
                        if (battleStatus->submenuMoveCount == 1) {
                            battleStatus->submenuMoveCount = 0;
                        }
                        if (battleStatus->actionCommandMode == 2) {
                            battleStatus->submenuMoveCount = 0;
                        }
                        break;
                    case BTL_MENU_TYPE_STAR_POWERS:
                        battleStatus->submenuMoves[0] = MOVE_FOCUS;
                        battleStatus->submenuIcons[0] = ITEM_PARTNER_ATTACK;
                        battleStatus->submenuStatus[0] = 1;
                        entryIdx = 1;
                        initialPos = 8;
                        for (i = 0; i < playerData->maxStarPower; i++) {
                            moveData = &gMoveTable[MOVE_REFRESH + i];
                            battleStatus->submenuMoves[entryIdx] = MOVE_REFRESH + i;
                            battleStatus->submenuIcons[entryIdx] = 0;
                            battleStatus->moveCategory = BTL_MENU_TYPE_STAR_POWERS;
                            battleStatus->moveArgument = MOVE_REFRESH + i;
                            battleStatus->currentTargetListFlags = moveData->flags;
                            player_create_target_list(playerActor);
                            battleStatus->submenuStatus[entryIdx] = 1;
                            if (playerActor->targetListLength == 0) {
                                battleStatus->submenuStatus[entryIdx] = -2;
                            }
                            if (playerData->specialBarsFilled / 256 < moveData->costFP) {
                                battleStatus->submenuStatus[entryIdx] = 0;
                            }
                            if (gBattleStatus.flags2 & BS_FLAGS2_NO_TARGET_AVAILABLE) {
                                battleStatus->submenuStatus[entryIdx] = -1;
                            }
                            entryIdx++;
                        }
                        starBeamLevel = playerData->starBeamLevel;
                        if (starBeamLevel == 1) {
                            do {
                                moveData = &gMoveTable[MOVE_STAR_BEAM];
                                battleStatus->submenuMoves[entryIdx] = MOVE_STAR_BEAM;
                                battleStatus->submenuIcons[entryIdx] = 0;
                                battleStatus->moveCategory = BTL_MENU_TYPE_STAR_POWERS;
                                battleStatus->moveArgument = MOVE_REFRESH + i;
                                battleStatus->currentTargetListFlags = moveData->flags;
                                player_create_target_list(playerActor);
                                battleStatus->submenuStatus[entryIdx] = starBeamLevel;
                                if (playerActor->targetListLength == 0) {
                                    battleStatus->submenuStatus[entryIdx] = -2;
                                }
                                if (playerData->specialBarsFilled / 256 < moveData->costFP) {
                                    battleStatus->submenuStatus[entryIdx] = 0;
                                }
                                if (gBattleStatus.flags2 & BS_FLAGS2_NO_TARGET_AVAILABLE) {
                                    battleStatus->submenuStatus[entryIdx] = -1;
                                }
                                entryIdx++;
                            } while (0);
                        }
                        if (playerData->starBeamLevel == 2) {
                            do {
                                do {
                                    moveData = &gMoveTable[MOVE_PEACH_BEAM];
                                    battleStatus->submenuMoves[entryIdx] = MOVE_PEACH_BEAM;
                                    battleStatus->submenuIcons[entryIdx] = 0;
                                    battleStatus->moveCategory = BTL_MENU_TYPE_STAR_POWERS;
                                    battleStatus->moveArgument = MOVE_REFRESH + i;
                                    battleStatus->currentTargetListFlags = moveData->flags;
                                    player_create_target_list(playerActor);
                                    battleStatus->submenuStatus[entryIdx] = 1;
                                    if (playerActor->targetListLength == 0) {
                                        battleStatus->submenuStatus[entryIdx] = -2;
                                    }
                                    if (playerData->specialBarsFilled / 256 < moveData->costFP) {
                                        battleStatus->submenuStatus[entryIdx] = 0;
                                    }
                                    if (gBattleStatus.flags2 & BS_FLAGS2_NO_TARGET_AVAILABLE) {
                                        battleStatus->submenuStatus[entryIdx] = -1;
                                    }
                                    entryIdx++;
                                } while (0);
                            } while (0); // TODO required to match
                        }
                        battleStatus->submenuMoveCount = entryIdx;
                        break;
                    } while (0); // TODO required to match
                }

                currentSubmenu = battleStatus->currentSubmenu;
                if (currentSubmenu == BTL_MENU_TYPE_STAR_POWERS) {
                    gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_1;
                    btl_state_update_player_menu();
                    btl_state_update_player_menu();
                    break;
                } else if (currentSubmenu == BTL_MENU_TYPE_STRATEGIES) {
                    if (battleStatus->actionCommandMode != ACTION_COMMAND_MODE_TUTORIAL && !(gBattleStatus.flags1 & BS_FLAGS1_TUTORIAL_BATTLE)) {
                        gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_BUILD_STRATEGIES;
                        btl_state_update_player_menu();
                        btl_state_update_player_menu();
                        break;
                    } else {
                        btl_main_menu_destroy();
                        battleStatus->moveCategory = currentSubmenu;
                        battleStatus->moveArgument = 0;
                        battleStatus->selectedMoveID = 0;
                        btl_set_state(BATTLE_STATE_PLAYER_MOVE);
                        break;
                    }
                } else {
                    if (battleStatus->submenuMoveCount == 0) {
                        if (currentSubmenu != BTL_MENU_TYPE_ITEMS) {
                            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_10;
                            break;
                        } else {
                            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_ITEMS_1;
                            btl_state_update_player_menu();
                            btl_state_update_player_menu();
                            break;
                        }
                    }

                    initialPos = 0;
                    if (currentSubmenu == BTL_MENU_TYPE_JUMP) {
                        if (battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_JUMP] < 0) {
                            battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_JUMP] = 0;
                        }
                        initialPos = battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_JUMP];
                    }
                    if (battleStatus->currentSubmenu == BTL_MENU_TYPE_SMASH) {
                        if (battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_SMASH] < 0) {
                            battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_SMASH] = 0;
                        }
                        initialPos = battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_SMASH];
                    }
                    if (battleStatus->currentSubmenu == BTL_MENU_TYPE_ITEMS) {
                        if (battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_ITEMS] < 0) {
                            battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_ITEMS] = 0;
                        }
                        initialPos = battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_ITEMS];
                    }

                    for (i = 0; i < battleStatus->submenuMoveCount; i++) {
                        moveData = &gMoveTable[battleStatus->submenuMoves[i]];
                        itemData = &gItemTable[battleStatus->submenuIcons[i]];
                        hudScriptPair = &gItemHudScripts[itemData->hudElemID];

                        BattleMenu_Moves_OptionCantUseMessages[i] = 0;
                        if (battleStatus->submenuStatus[i] == 0) {
                            BattleMenu_Moves_OptionCantUseMessages[i] = 0;
                        }
                        if (battleStatus->submenuStatus[i] == -1) {
                            battleStatus->submenuStatus[i] = 0;
                            BattleMenu_Moves_OptionCantUseMessages[i] = BTL_MSG_CANT_SELECT_NOW;
                        }
                        if (battleStatus->submenuStatus[i] == -2) {
                            battleStatus->submenuStatus[i] = 0;
                            BattleMenu_Moves_OptionCantUseMessages[i] = BTL_MSG_CANT_SELECT_NOW;
                        }
                        if (battleStatus->submenuStatus[i] == -3) {
                            battleStatus->submenuStatus[i] = 0;
                            BattleMenu_Moves_OptionCantUseMessages[i] = BTL_MSG_CANT_SELECT_NOW_ALT;
                        }
                        battle_menu_moveOptionIconScripts[i] = hudScriptPair->enabled;
                        if (battleStatus->submenuStatus[i] == 0) {
                            battle_menu_moveOptionIconScripts[i] = hudScriptPair->disabled;
                        }

                        battle_menu_moveOptionDisplayCosts[i] = moveData->costFP;
                        battle_menu_moveOptionBPCosts[i] = moveData->costBP;
                        BattleMenu_Moves_OptionSortPriority[i] = 0;
                        battle_menu_moveOptionDisplayCostReductions[i] = 0;
                        battle_menu_moveOptionDisplayCostReductionColors[i] = 0;

                        if (player_team_is_ability_active(playerActor, ABILITY_FLOWER_SAVER)) {
                            battle_menu_moveOptionDisplayCostReductions[i] += player_team_is_ability_active(playerActor, ABILITY_FLOWER_SAVER);
                            battle_menu_moveOptionDisplayCostReductionColors[i] = 1;
                        }
                        if (player_team_is_ability_active(playerActor, ABILITY_FLOWER_FANATIC)) {
                            battle_menu_moveOptionDisplayCostReductions[i] += 2 * player_team_is_ability_active(playerActor, ABILITY_FLOWER_FANATIC);
                            battle_menu_moveOptionDisplayCostReductionColors[i] = 2;
                        }

                        BattleMenu_Moves_OptionIndices[i] = i;
                        BattleMenu_Moves_OptionEnabled[i] = battleStatus->submenuStatus[i];
                        battle_menu_moveOptionNames[i] = moveData->nameMsg;
                        BattleMenu_Moves_OptionDescMessages[i] = moveData->shortDescMsg;

                    }
                    BattleMenu_UsingSpiritsSubmenu = FALSE;
                    D_802AD4A8 = initialPos;
                    BattleMenu_Moves_OptionCount = battleStatus->submenuMoveCount;
                    func_802A2684();
                    gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_2;
                    break;
                }
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_2:
            submenuResult = btl_submenu_moves_update();
            if (submenuResult == -1) {
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_7;
            } else if (submenuResult == 0) {
            } else if (submenuResult == 255) {
                func_802A1050();
                D_802ACC60 = 8;
                D_802ACC6C = 4;
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CHOOSE_CATEGORY;
                btl_state_update_player_menu();
                btl_state_update_player_menu();
            } else {
                battleStatus->unk_49 = BattleMenu_Moves_OptionIndices[submenuResult - 1];
                battleStatus->selectedMoveID = battleStatus->submenuMoves[battleStatus->unk_49];
                if (battleStatus->currentSubmenu == BTL_MENU_TYPE_JUMP) {
                    battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_JUMP] = battle_menu_moveOptionActive;
                }
                if (battleStatus->currentSubmenu == BTL_MENU_TYPE_SMASH) {
                    battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_SMASH] = battle_menu_moveOptionActive;
                }
                currentSubmenu2 = battleStatus->currentSubmenu;
                if (battleStatus->currentSubmenu == BTL_MENU_TYPE_ITEMS) {
                    battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_ITEMS] = battle_menu_moveOptionActive;
                    if (battleStatus->currentSubmenu == currentSubmenu2) {
                        gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_UNKNOWN_1;
                        btl_state_update_player_menu();
                        btl_state_update_player_menu();
                        break;
                    }
                }
                func_802A27D0();
                func_802A1030();
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_MOVE_CHOOSE_TARGET;
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_MOVE_CHOOSE_TARGET:
            submenuResult = btl_submenu_moves_update();
            if ((battleStatus->currentButtonsPressed & BUTTON_B) && submenuResult == 0) {
                func_802A2AB8();
                func_802A1098();
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_4;
                break;
            }
            if (btl_main_menu_update() == 0) {
                break;
            }
            battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_MOVE_TARGET_CANCEL;
            battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_MOVE_TARGET_CHOSEN;
            battleStatus->selectedMoveID = battleStatus->submenuMoves[battleStatus->unk_49];
            battleStatus->currentTargetListFlags = gMoveTable[battleStatus->submenuMoves[battleStatus->unk_49]].flags;
            currentSubmenu = battleStatus->currentSubmenu;
            switch (currentSubmenu) {
                case BTL_MENU_TYPE_JUMP:
                    battleStatus->moveCategory = BTL_MENU_TYPE_JUMP;
                    battleStatus->moveArgument = playerData->bootsLevel;
                    btl_set_state(BATTLE_STATE_SELECT_TARGET);
                    break;
                case BTL_MENU_TYPE_SMASH:
                    battleStatus->moveCategory = BTL_MENU_TYPE_SMASH;
                    battleStatus->moveArgument = playerData->hammerLevel;
                    btl_set_state(BATTLE_STATE_SELECT_TARGET);
                    break;
                case BTL_MENU_TYPE_DEFEND:
                    gBattleSubState = battleStatus->acceptTargetMenuSubstate;
                    btl_state_update_player_menu();
                    battleStatus->moveCategory = BTL_MENU_TYPE_DEFEND;
                    btl_set_state(BATTLE_STATE_DEFEND);
                    break;
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_4:
            btl_submenu_moves_update();
            if (btl_main_menu_update() == 0) {
                break;
            }
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_2;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_MOVE_TARGET_CANCEL:
            func_802A2AB8();
            func_802A1098();
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_4;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_MOVE_TARGET_CHOSEN:
            func_802A27E4();
            btl_main_menu_destroy();
            break;
        case BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_7:
            if (btl_submenu_moves_update() != -1) {
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_2;
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_MAIN_SHOW_CANT_SWAP:
            if (gBattleStatus.flags2 & BS_FLAGS2_4) {
                btl_show_variable_battle_message(BTL_MSG_CANT_SWITCH, 60, 0);
            } else {
                btl_show_variable_battle_message(BTL_MSG_CANT_MOVE, 60, playerData->currentPartner);
            }
            D_802AD607 = 1;
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_MAIN_AWAIT_CANT_SWAP;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_MAIN_AWAIT_CANT_SWAP:
            if (btl_is_popup_displayed()) {
                break;
            }
            D_802ACC6C = 4;
            D_802AD607 = 0;
            D_802ACC60 = 0;
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CHOOSE_CATEGORY;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_10:
            func_802A1030();
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_11;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_11:
            submenuResult = btl_main_menu_update();
            if ((battleStatus->currentButtonsPressed & BUTTON_B) && submenuResult == 0) {
                func_802A1078();
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_12;
            } else if (submenuResult != 0) {
                battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_13;
                battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_14;
                switch (battleStatus->currentSubmenu) {
                    case BTL_MENU_TYPE_JUMP:
                        battleStatus->moveCategory = BTL_MENU_TYPE_JUMP;
                        battleStatus->moveArgument = playerData->bootsLevel;
                        battleStatus->selectedMoveID = playerData->bootsLevel + MOVE_JUMP1;
                        battleStatus->currentTargetListFlags = gMoveTable[battleStatus->selectedMoveID].flags;
                        btl_set_state(BATTLE_STATE_SELECT_TARGET);
                        break;
                    case BTL_MENU_TYPE_SMASH:
                        battleStatus->moveCategory = BTL_MENU_TYPE_SMASH;
                        battleStatus->moveArgument = playerData->hammerLevel;
                        battleStatus->selectedMoveID = playerData->hammerLevel + MOVE_HAMMER1;
                        battleStatus->currentTargetListFlags = gMoveTable[battleStatus->selectedMoveID].flags;
                        btl_set_state(BATTLE_STATE_SELECT_TARGET);
                        break;
                    default:
                        goto CASE_C; // TODO find better match
                }
            }
            break;
        CASE_C:
        case BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_12:
            if (btl_main_menu_update() == 0) {
                break;
            }
            D_802ACC60 = 8;
            D_802ACC6C = 4;
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CHOOSE_CATEGORY;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_13:
            func_802A1078();
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_12;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_14:
            btl_main_menu_destroy();
            break;
        case BTL_SUBSTATE_PLAYER_MENU_UNKNOWN_1:
            if (battleStatus->selectedMoveID == MOVE_DOUBLE_DIP) {
                battleStatus->itemUsesLeft = 2;
            }
            if (battleStatus->selectedMoveID == MOVE_TRIPLE_DIP) {
                battleStatus->itemUsesLeft = 3;
            }
            entryIdx = 0;
            for (i = 0; i < ARRAY_COUNT(playerData->invItems); i++) {
                if (playerData->invItems[i] == 0) {
                    continue;
                }
                itemData = &gItemTable[playerData->invItems[i]];
                hudScriptPair = &gItemHudScripts[itemData->hudElemID];
                if (!(itemData->typeFlags & ITEM_TYPE_FLAG_BATTLE_USABLE)) {
                    continue;
                }
                battleStatus->moveCategory = BTL_MENU_TYPE_ITEMS;
                battleStatus->moveArgument = playerData->invItems[i];
                battleStatus->currentTargetListFlags = itemData->targetFlags;
                player_create_target_list(playerActor);
                popup->ptrIcon[entryIdx] = hudScriptPair->enabled;
                popup->userIndex[entryIdx] = playerData->invItems[i];
                popup->enabled[entryIdx] = TRUE;
                popup->nameMsg[entryIdx] = itemData->nameMsg;
                popup->descMsg[entryIdx] = itemData->shortDescMsg;
                if (playerActor->targetListLength == 0) {
                    popup->ptrIcon[entryIdx] = hudScriptPair->disabled;
                    popup->enabled[entryIdx] = 0;
                }
                entryIdx++;
            }
            popup->dipMode = 0;
            popup->titleNumber = 0;
            if (battleStatus->selectedMoveID == MOVE_DOUBLE_DIP) {
                popup->dipMode = 1;
                popup->titleNumber = battleStatus->itemUsesLeft;
            }
            if (battleStatus->selectedMoveID == MOVE_TRIPLE_DIP) {
                popup->dipMode = 2;
                popup->titleNumber = battleStatus->itemUsesLeft;
            }
            if (battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_DIP] < 0) {
                battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_DIP] = 0;
            }
            popup->popupType = POPUP_MENU_USE_ITEM;
            popup->numEntries = entryIdx;
            initialPos = battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_DIP];
            popup->initialPos = initialPos;
            create_battle_popup_menu(popup);
            func_800F52BC();
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_DIPPING_CHOOSE_TARGET;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_DIPPING_CHOOSE_TARGET:
            if (popup->result != POPUP_RESULT_CHOOSING) {
                if (popup->result == POPUP_RESULT_CANCEL) {
                    func_802A2910();
                    battleStatus->selectedMoveID = 0;
                    battleStatus->itemUsesLeft = 0;
                    gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_MAIN_MENU_2;
                    btl_state_update_player_menu();
                    btl_state_update_player_menu();
                } else {
                    battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_DIPPING_TARGET_CANCEL;
                    battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_DIPPING_TARGET_CHOSEN;
                    battleStatus->unk_1AA = popup->userIndex[popup->result - 1];
                    battleStatus->moveCategory = BTL_MENU_TYPE_ITEMS;
                    battleStatus->moveArgument = battleStatus->unk_1AA;
                    battleStatus->currentTargetListFlags = gItemTable[battleStatus->moveArgument].targetFlags | TARGET_FLAG_8000;
                    battleStatus->currentAttackElement = 0;
                    battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_DIP] = popup->result - 1;
                    hide_popup_menu();
                    func_802A27D0();
                    func_802A1030();
                    gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_UNKNOWN_3;
                }
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_UNKNOWN_3:
            if ((battleStatus->currentButtonsPressed & BUTTON_B) && popup->result == POPUP_RESULT_CHOOSING) {
                func_800F16CC();
                func_802A2C58();
                func_802A1098();
                battleStatus->selectedMoveID = 0;
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_UNKNOWN_4;
            } else {
                btl_submenu_moves_update();
                if (btl_main_menu_update()) {
                    btl_set_state(BATTLE_STATE_SELECT_TARGET);
                }
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_UNKNOWN_4:
            btl_submenu_moves_update();
            if (btl_main_menu_update() != 0) {
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_DIPPING_CHOOSE_TARGET;
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_DIPPING_TARGET_CANCEL:
            func_800F16CC();
            func_802A2C58();
            func_802A1098();
            btl_submenu_moves_update();
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_UNKNOWN_4;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_DIPPING_TARGET_CHOSEN:
            destroy_popup_menu();
            func_802A27E4();
            btl_main_menu_destroy();
            break;
        case BTL_SUBSTATE_PLAYER_MENU_ITEMS_1:
            entryIdx = 0;
            for (i = 0; i < ARRAY_COUNT(playerData->invItems); i++) {
                if (playerData->invItems[i] == 0) {
                    continue;
                }
                itemData = &gItemTable[playerData->invItems[i]];
                hudScriptPair = &gItemHudScripts[itemData->hudElemID];
                if (!(itemData->typeFlags & ITEM_TYPE_FLAG_BATTLE_USABLE)) {
                    continue;
                }
                battleStatus->moveCategory = BTL_MENU_TYPE_ITEMS;
                battleStatus->moveArgument = playerData->invItems[i];
                battleStatus->currentTargetListFlags = itemData->targetFlags;
                player_create_target_list(playerActor);
                popup->ptrIcon[entryIdx] = hudScriptPair->enabled;

                popup->userIndex[entryIdx] = playerData->invItems[i];
                popup->enabled[entryIdx] = 1;
                popup->nameMsg[entryIdx] = itemData->nameMsg;
                popup->descMsg[entryIdx] = itemData->shortDescMsg;
                if (playerActor->targetListLength == 0) {
                    popup->ptrIcon[entryIdx] = hudScriptPair->disabled;
                    popup->enabled[entryIdx] = 0;
                }
                entryIdx++;
            }
            if (battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_DIP] < 0) {
                battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_DIP] = 0;
            }
            initialPos = battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_DIP];
            popup->popupType = POPUP_MENU_USE_ITEM;
            popup->numEntries = entryIdx;
            popup->dipMode = 0;
            popup->titleNumber = 0;
            popup->initialPos = initialPos;
            create_battle_popup_menu(popup);
            func_800F52BC();
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_ITEMS_2;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_ITEMS_2:
            if (popup->result != POPUP_RESULT_CHOOSING) {
                if (popup->result == POPUP_RESULT_CANCEL) {
                    func_802A1050();
                    D_802ACC60 = 8;
                    D_802ACC6C = 4;
                    gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CHOOSE_CATEGORY;
                    btl_state_update_player_menu();
                    btl_state_update_player_menu();
                } else {
                    battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_ITEMS_5;
                    battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_ITEMS_6;
                    battleStatus->unk_1AA = popup->userIndex[popup->result - 1];
                    battleStatus->moveCategory = BTL_MENU_TYPE_ITEMS;
                    battleStatus->moveArgument = battleStatus->unk_1AA;
                    battleStatus->selectedMoveID = MOVE_ITEMS;
                    battleStatus->currentTargetListFlags = gItemTable[battleStatus->moveArgument].targetFlags | TARGET_FLAG_8000;
                    battleStatus->currentAttackElement = 0;
                    battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_DIP] = popup->result - 1;
                    hide_popup_menu();
                    func_802A1030();
                    gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_ITEMS_3;
                }
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_ITEMS_3:
            if ((battleStatus->currentButtonsPressed & BUTTON_B) && popup->result == POPUP_RESULT_CHOOSING) {
                func_800F16CC();
                func_802A1098();
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_ITEMS_4;
            } else {
                if (btl_main_menu_update() != 0) {
                    btl_set_state(BATTLE_STATE_SELECT_TARGET);
                }
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_ITEMS_4:
            if (btl_main_menu_update() != 0) {
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_ITEMS_2;
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_ITEMS_5:
            func_800F16CC();
            func_802A1098();
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_ITEMS_4;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_ITEMS_6:
            destroy_popup_menu();
            btl_main_menu_destroy();
            break;
        case BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_1:
            for (i = 0; i < battleStatus->submenuMoveCount; i++) {
                moveData = &gMoveTable[battleStatus->submenuMoves[i]];
                BattleMenu_Moves_OptionCantUseMessages[i] = 0;

                if (battleStatus->submenuStatus[i] == 0) {
                    BattleMenu_Moves_OptionCantUseMessages[i] = 0;
                }

                if (battleStatus->submenuStatus[i] == -1) {
                    battleStatus->submenuStatus[i] = 0;
                    BattleMenu_Moves_OptionCantUseMessages[i] = BTL_MSG_CANT_SELECT_NOW;
                }
                if (battleStatus->submenuStatus[i] == -2) {
                    battleStatus->submenuStatus[i] = 0;
                    BattleMenu_Moves_OptionCantUseMessages[i] = BTL_MSG_CANT_SELECT_NOW;
                }
                if (!(battleStatus->enabledStarPowersFlags & (1 << i))) {
                    battleStatus->submenuStatus[i] = 0;
                    BattleMenu_Moves_OptionCantUseMessages[i] = BTL_MSG_CANT_SELECT_NOW;
                }

                battle_menu_moveOptionIconScripts[i] = battle_menu_StarPowerMovesHudScripts[2 * STAR_POWER_INDEX(battleStatus->submenuMoves[i]) + 0];
                if (battleStatus->submenuStatus[i] == 0) {
                    battle_menu_moveOptionIconScripts[i] = battle_menu_StarPowerMovesHudScripts[2 * STAR_POWER_INDEX(battleStatus->submenuMoves[i]) + 1];
                }
                battle_menu_moveOptionDisplayCosts[i] = moveData->costFP;
                battle_menu_moveOptionBPCosts[i] = moveData->costBP;
                BattleMenu_Moves_OptionSortPriority[i] = 0;
                BattleMenu_Moves_OptionIndices[i] = i;
                BattleMenu_Moves_OptionEnabled[i] = battleStatus->submenuStatus[i];
                battle_menu_moveOptionNames[i] = moveData->nameMsg;
                BattleMenu_Moves_OptionDescMessages[i] = moveData->shortDescMsg;
                battle_menu_moveOptionDisplayCostReductions[i] = 0;
                battle_menu_moveOptionDisplayCostReductionColors[i] = 0;
            }
            if (battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_STAR_POWER] < 0) {
                battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_STAR_POWER] = 0;
            }
            initialPos = battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_STAR_POWER];
            BattleMenu_Moves_OptionCount = battleStatus->submenuMoveCount;
            D_802AD4A8 = initialPos;
            BattleMenu_UsingSpiritsSubmenu = TRUE;
            func_802A2684();
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_2;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_2:
            submenuResult = btl_submenu_moves_update();
            if (submenuResult == -1) {
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_7;
            } else if (submenuResult == 0) {
            } else if (submenuResult == 255) {
                func_802A1050();
                D_802ACC60 = 8;
                D_802ACC6C = 4;
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CHOOSE_CATEGORY;
                btl_state_update_player_menu();
                btl_state_update_player_menu();
            } else {
                battleStatus->unk_49 = BattleMenu_Moves_OptionIndices[submenuResult - 1];
                battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_STAR_POWER] = battle_menu_moveOptionActive;
                func_802A27D0();
                func_802A1030();
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_3;
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_3:
            submenuResult = btl_submenu_moves_update();
            if ((battleStatus->currentButtonsPressed & BUTTON_B) && submenuResult == 0) {
                func_802A2AB8();
                func_802A1098();
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_4;
            } else if (btl_main_menu_update() != 0) {
                battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_5;
                battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_6;
                battleStatus->moveCategory = BTL_MENU_TYPE_STAR_POWERS;
                battleStatus->selectedMoveID = battleStatus->submenuMoves[battleStatus->unk_49];
                battleStatus->currentTargetListFlags = gMoveTable[battleStatus->submenuMoves[battleStatus->unk_49]].flags;
                battleStatus->moveArgument = battleStatus->unk_49;
                if (playerData->starBeamLevel == 2 && battleStatus->moveArgument == 8) {
                    battleStatus->moveArgument++;
                }
                btl_set_state(BATTLE_STATE_SELECT_TARGET);
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_4:
            btl_submenu_moves_update();
            if (btl_main_menu_update() != 0) {
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_2;
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_5:
            func_802A2AB8();
            func_802A1098();
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_4;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_6:
            func_802A27E4();
            btl_main_menu_destroy();
            break;
        case BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_7:
            if (btl_submenu_moves_update() != -1) {
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STAR_SPIRITS_2;
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_DIPPING_1:
            if (!can_btl_state_update_switch_to_player()) {
                battleStatus->itemUsesLeft = 1;
                btl_set_state(BATTLE_STATE_END_PLAYER_TURN);
            } else {
                entryIdx = 0;
                for (i = 0; i < ARRAY_COUNT(playerData->invItems); i++) {
                    if (playerData->invItems[i] == 0) {
                        continue;
                    }
                    itemData = &gItemTable[playerData->invItems[i]];
                    hudScriptPair = &gItemHudScripts[itemData->hudElemID];
                    if (!(itemData->typeFlags & ITEM_TYPE_FLAG_BATTLE_USABLE)) {
                        continue;
                    }

                    battleStatus->moveCategory = BTL_MENU_TYPE_ITEMS;
                    battleStatus->moveArgument = playerData->invItems[i];
                    battleStatus->currentTargetListFlags = itemData->targetFlags;
                    player_create_target_list(playerActor);
                    popup->ptrIcon[entryIdx] = hudScriptPair->enabled;
                    popup->userIndex[entryIdx] = playerData->invItems[i];
                    popup->enabled[entryIdx] = TRUE;
                    popup->nameMsg[entryIdx] = itemData->nameMsg;
                    popup->descMsg[entryIdx] = itemData->shortDescMsg;
                    if (playerActor->targetListLength == 0) {
                        popup->ptrIcon[entryIdx] = hudScriptPair->disabled;
                        popup->enabled[entryIdx] = FALSE;
                    }
                    entryIdx++;
                }
                if (entryIdx == 0) {
                    battleStatus->itemUsesLeft = 1;
                    btl_set_state(BATTLE_STATE_END_PLAYER_TURN);
                } else {
                    popup->popupType = POPUP_MENU_USE_ITEM;
                    if (battleStatus->selectedMoveID == MOVE_DOUBLE_DIP) {
                        popup->popupType += POPUP_MENU_DOUBLE_DIP;
                        popup->dipMode = 1;
                        popup->titleNumber = battleStatus->itemUsesLeft;
                    }
                    if (battleStatus->selectedMoveID == MOVE_TRIPLE_DIP) {
                        popup->popupType += POPUP_MENU_TRIPLE_DIP;
                        popup->dipMode = 2;
                        popup->titleNumber = battleStatus->itemUsesLeft;
                    }
                    if (battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_DIP] < 0) {
                        battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_DIP] = 0;
                    }
                    popup->numEntries = entryIdx;
                    initialPos = battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_DIP];
                    popup->initialPos = initialPos;
                    create_battle_popup_menu(popup);
                    func_800F52BC();
                    gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_DIPPING_2;
                }
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_DIPPING_2:
            if (popup->result != POPUP_RESULT_CHOOSING) {
                if (popup->result == POPUP_RESULT_CANCEL) {
                    battleStatus->itemUsesLeft = 1;
                    btl_set_state(BATTLE_STATE_END_PLAYER_TURN);
                } else {
                    battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_DIPPING_5;
                    battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_DIPPING_6;
                    battleStatus->unk_1AA = popup->userIndex[popup->result - 1];
                    battleStatus->moveCategory = BTL_MENU_TYPE_ITEMS;
                    battleStatus->moveArgument = battleStatus->unk_1AA;
                    battleStatus->currentTargetListFlags = gItemTable[battleStatus->moveArgument].targetFlags | TARGET_FLAG_8000;
                    battleStatus->currentAttackElement = 0;
                    battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_DIP] = popup->result - 1;
                    hide_popup_menu();
                    D_802ACC60 = 5;
                    gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_DIPPING_3;
                }
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_DIPPING_3:
            if (D_802ACC60 != 0) {
                D_802ACC60--;
            } else {
                btl_set_state(BATTLE_STATE_SELECT_TARGET);
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_DIPPING_4:
            if (D_802ACC60 != 0) {
                D_802ACC60--;
            } else {
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_DIPPING_2;
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_DIPPING_5:
            func_800F16CC();
            D_802ACC60 = 5;
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_DIPPING_4;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_DIPPING_6:
            destroy_popup_menu();
            break;
        case BTL_SUBSTATE_PLAYER_MENU_BERSERKER_1:
            if (playerData->bootsLevel >= 0) {
                battleStatus->currentTargetListFlags = gMoveTable[MOVE_UNUSED_JUMP5].flags;
                player_create_target_list(playerActor);
                jumpTargetCount = playerActor->targetListLength;
            } else {
                jumpTargetCount = 0;
            }

            if (playerData->hammerLevel >= 0) {
                battleStatus->currentTargetListFlags = gMoveTable[MOVE_UNUSED_HAMMER5].flags;
                player_create_target_list(playerActor);
                hammerTargetCount = playerActor->targetListLength;
            } else {
                hammerTargetCount = 0;
            }

            if (jumpTargetCount <= 0 && hammerTargetCount <= 0) {
                battleStatus->moveCategory = BTL_MENU_TYPE_DO_NOTHING;
                battleStatus->unk_95 = 0;
                btl_set_state(BATTLE_STATE_END_PLAYER_TURN);
            } else {
                jumpChance = 50;
                if (jumpTargetCount <= 0) {
                    jumpChance = 0;
                }
                if (hammerTargetCount <= 0) {
                    jumpChance = 101;
                }
                if (rand_int(100) < jumpChance) {
                    battleStatus->selectedMoveID = MOVE_UNUSED_JUMP5;
                    battleStatus->moveCategory = BTL_MENU_TYPE_JUMP;
                    battleStatus->currentTargetListFlags = gMoveTable[MOVE_UNUSED_JUMP5].flags;
                    battleStatus->moveArgument = playerData->bootsLevel;
                    player_create_target_list(playerActor);
                } else {
                    battleStatus->selectedMoveID = MOVE_UNUSED_HAMMER5;
                    battleStatus->moveCategory = BTL_MENU_TYPE_SMASH;
                    battleStatus->currentTargetListFlags = gMoveTable[MOVE_UNUSED_HAMMER5].flags;
                    battleStatus->moveArgument = playerData->hammerLevel;
                    player_create_target_list(playerActor);
                }
                btl_set_state(BATTLE_STATE_PLAYER_MOVE);
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_BUILD_STRATEGIES:
            entryIdx = 0;
            func_80263268();
            if (battleStatus->changePartnerAllowed >= 0) {
                D_802AD678[0] = BTL_MENU_TYPE_CHANGE_PARTNER;
                D_802AD658[0] = BattleMenu_LeftJustMessages[BTL_MENU_TYPE_CHANGE_PARTNER];
                D_802AD640[0] = battle_menu_PartnerHudScripts[playerData->currentPartner];
                D_802AD690[0] = 1;
                D_802AD6C0[0] = MSG_Menus_Action_ChangePartner;
                if (battleStatus->changePartnerAllowed <= 0) {
                    D_802AD640[0] = battle_menu_DisabledPartnerHudScripts[playerData->currentPartner];
                    D_802AD690[0] = 0;
                    D_802AD6A8[0] = 0;
                }
                entryIdx++;
            }

            D_802AD640[entryIdx] = battle_menu_DoNothingHudScripts.enabled;
            D_802AD678[entryIdx] = BTL_MENU_TYPE_DO_NOTHING;
            D_802AD690[entryIdx] = 1;
            D_802AD658[entryIdx] = BattleMenu_LeftJustMessages[BTL_MENU_TYPE_DO_NOTHING];
            D_802AD6C0[entryIdx] = MSG_Menus_Action_DoNothing;
            entryIdx++;

            D_802AD640[entryIdx] = battle_menu_FleeHudScripts.enabled;
            D_802AD678[entryIdx] = BTL_MENU_TYPE_RUN_AWAY;
            D_802AD690[entryIdx] = 1;
            D_802AD658[entryIdx] = BattleMenu_LeftJustMessages[BTL_MENU_TYPE_RUN_AWAY];
            D_802AD6C0[entryIdx] = MSG_Menus_Action_RunAway;
            if (!(gBattleStatus.flags2 & BS_FLAGS2_CANT_FLEE)) {
                D_802AD640[entryIdx] = battle_menu_FleeHudScripts.disabled;
                D_802AD690[entryIdx] = 0;
                D_802AD6A8[entryIdx] = 1;
            }
            entryIdx++;

            if (battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_STRATEGY] < 0) {
                battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_STRATEGY] = 0;
            }
            initialPos = battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_STRATEGY];
            D_802AD66C = entryIdx;
            D_802AD670 = initialPos;
            func_802A45D8();
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_2;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_2:
            submenuResult = func_802A4A54();
            if (submenuResult == -1) {
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_8;
            } else if (submenuResult == 0) {
            } else if (submenuResult == 255) {
                func_802A1050();
                D_802ACC60 = 8;
                D_802ACC6C = 4;
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CHOOSE_CATEGORY;
                btl_state_update_player_menu();
                btl_state_update_player_menu();
            } else {
                battleStatus->currentSubmenu = D_802AD678[submenuResult - 1];
                battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_STRATEGY] = submenuResult - 1;
                if (battleStatus->currentSubmenu == 5) {
                    gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_1;
                    btl_state_update_player_menu();
                    btl_state_update_player_menu();
                } else {
                    func_802A4718();
                    func_802A1030();
                    gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_3;
                }
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_3:
            submenuResult = func_802A4A54();
            if ((battleStatus->currentButtonsPressed & BUTTON_B) && submenuResult == 0) {
                func_802A48FC();
                func_802A1098();
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_4;
            } else if (btl_main_menu_update() != 0) {
                battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_5;
                battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_6;
                switch (battleStatus->currentSubmenu) {
                    case 3:
                        gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_6;
                        btl_state_update_player_menu();
                        battleStatus->moveCategory = BTL_MENU_TYPE_RUN_AWAY;
                        battleStatus->selectedMoveID = MOVE_UNUSED_39;
                        btl_set_state(BATTLE_STATE_RUN_AWAY);
                        break;
                    case 9:
                        battleStatus->hustleTurns = 0;
                        gBattleStatus.flags1 &= ~BS_FLAGS1_HUSTLED;
                        gBattleSubState = battleStatus->acceptTargetMenuSubstate;
                        btl_state_update_player_menu();
                        btl_set_state(BATTLE_STATE_END_PLAYER_TURN);
                        break;
                    case 4:
                        gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_6;
                        btl_state_update_player_menu();
                        battleStatus->selectedMoveID = MOVE_UNUSED_DEFEND_PLUS;
                        battleStatus->moveCategory = BTL_MENU_TYPE_DEFEND;
                        btl_set_state(BATTLE_STATE_DEFEND);
                        break;
                    case 10:
                        gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_6;
                        btl_state_update_player_menu();
                        btl_set_state(BATTLE_STATE_SWITCH_TO_PARTNER);
                        break;
                }
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_4:
            func_802A4A54();
            if (btl_main_menu_update() != 0) {
                D_802ACC60 = 8;
                D_802ACC6C = 4;
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CHOOSE_CATEGORY;
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_5:
            func_802A48FC();
            func_802A1098();
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_4;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_6:
            func_802A472C();
            btl_main_menu_destroy();
            break;
        case BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_8:
            if (func_802A4A54() != -1) {
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_2;
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_1:
            entryIdx = 0;
            for (i = 1; i < ARRAY_COUNT(playerData->partners); i++) {
                s32 partnerId = D_8008EEC0[i];
                if (playerData->partners[partnerId].enabled) {
                    prop = &gPartnerPopupProperties[partnerId];
                    popup->ptrIcon[entryIdx] = battle_menu_PartnerHudScripts[partnerId];
                    popup->userIndex[entryIdx] = partnerId;
                    popup->enabled[entryIdx] = 1;
                    popup->nameMsg[entryIdx] = prop->nameMsg;
                    popup->descMsg[entryIdx] = prop->battleDescMsg;
                    popup->value[entryIdx] = playerData->partners[partnerId].level;
                    if (playerData->currentPartner == partnerId) {
                        popup->enabled[entryIdx] = 0;
                        popup->ptrIcon[entryIdx] = battle_menu_DisabledPartnerHudScripts[partnerId];
                    }
                    entryIdx++;
                }
            }
            if (battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_PARTNER] < 0) {
                battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_PARTNER] = 0;
            }
            popup->popupType = POPUP_MENU_SWITCH_PARTNER;
            popup->numEntries = entryIdx;
            popup->initialPos = D_8008EEF0[playerData->currentPartner] - 1;
            popup->dipMode = 0;
            popup->titleNumber = 0;
            create_battle_popup_menu(popup);
            func_800F52BC();
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_2;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_2:
            if (popup->result == POPUP_RESULT_MINUS_1) {
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_7;
            } else if (popup->result != POPUP_RESULT_CHOOSING) {
                if (popup->result == POPUP_RESULT_CANCEL) {
                    func_802A47E0();
                    gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_STRATEGIES_2;
                    btl_state_update_player_menu();
                    btl_state_update_player_menu();
                } else {
                    battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_5;
                    battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_6;
                    battleStatus->unk_1AC = popup->userIndex[popup->result - 1];
                    battleStatus->moveCategory = BTL_MENU_TYPE_CHANGE_PARTNER;
                    battleStatus->selectedMoveID = MOVE_UNUSED_37;
                    battleStatus->currentTargetListFlags = TARGET_FLAG_2;
                    battleStatus->moveArgument = battleStatus->unk_1AC;
                    battleStatus->lastPlayerMenuSelection[BTL_MENU_IDX_PARTNER] = popup->result - 1;
                    hide_popup_menu();
                    func_802A4718();
                    func_802A1030();
                    gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_3;
                }
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_3:
            if ((battleStatus->currentButtonsPressed & BUTTON_B) && popup->result == POPUP_RESULT_CHOOSING) {
                func_800F16CC();
                func_802A4A10();
                func_802A1098();
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_4;
            } else {
                func_802A4A54();
                if (btl_main_menu_update() != 0) {
                    gBattleSubState = battleStatus->acceptTargetMenuSubstate;
                    btl_state_update_player_menu();
                    btl_set_state(BATTLE_STATE_CHANGE_PARTNER);
                }
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_4:
            func_802A4A54();
            if (btl_main_menu_update() != 0) {
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_2;
            }
            break;
        case BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_5:
            func_800F16CC();
            func_802A4A10();
            func_802A1098();
            gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_4;
            break;
        case BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_6:
            destroy_popup_menu();
            func_802A472C();
            btl_main_menu_destroy();
            break;
        case BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_7:
            set_window_update(WINDOW_ID_6, WINDOW_UPDATE_HIDE);
            set_window_update(WINDOW_ID_7, WINDOW_UPDATE_HIDE);
            if (popup->result != POPUP_RESULT_MINUS_1) {
                set_window_update(WINDOW_ID_6, WINDOW_UPDATE_9);
                set_window_update(WINDOW_ID_7, WINDOW_UPDATE_9);
                gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_2;
            }
            break;
    }
}