### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_802A81C8_7AFB68
/* 41CF58 802A81C8 27BDFFB0 */  addiu     $sp, $sp, -0x50
/* 41CF5C 802A81CC AFB40020 */  sw        $s4, 0x20($sp)
/* 41CF60 802A81D0 3C14800E */  lui       $s4, %hi(gBattleStatus)
/* 41CF64 802A81D4 2694C070 */  addiu     $s4, $s4, %lo(gBattleStatus)
/* 41CF68 802A81D8 AFB7002C */  sw        $s7, 0x2C($sp)
/* 41CF6C 802A81DC 3C178011 */  lui       $s7, %hi(gPlayerData)
/* 41CF70 802A81E0 26F7F290 */  addiu     $s7, $s7, %lo(gPlayerData)
/* 41CF74 802A81E4 AFB20018 */  sw        $s2, 0x18($sp)
/* 41CF78 802A81E8 3C12802B */  lui       $s2, %hi(D_802ACCD0)
/* 41CF7C 802A81EC 2652CCD0 */  addiu     $s2, $s2, %lo(D_802ACCD0)
/* 41CF80 802A81F0 AFB10014 */  sw        $s1, 0x14($sp)
/* 41CF84 802A81F4 3C11800E */  lui       $s1, %hi(gBattleSubState)
/* 41CF88 802A81F8 2631C4DC */  addiu     $s1, $s1, %lo(gBattleSubState)
/* 41CF8C 802A81FC AFBF0034 */  sw        $ra, 0x34($sp)
/* 41CF90 802A8200 AFBE0030 */  sw        $fp, 0x30($sp)
/* 41CF94 802A8204 AFB60028 */  sw        $s6, 0x28($sp)
/* 41CF98 802A8208 AFB50024 */  sw        $s5, 0x24($sp)
/* 41CF9C 802A820C AFB3001C */  sw        $s3, 0x1C($sp)
/* 41CFA0 802A8210 AFB00010 */  sw        $s0, 0x10($sp)
/* 41CFA4 802A8214 F7B80048 */  sdc1      $f24, 0x48($sp)
/* 41CFA8 802A8218 F7B60040 */  sdc1      $f22, 0x40($sp)
/* 41CFAC 802A821C F7B40038 */  sdc1      $f20, 0x38($sp)
/* 41CFB0 802A8220 8E9300D8 */  lw        $s3, 0xD8($s4)
/* 41CFB4 802A8224 8E220000 */  lw        $v0, 0x0($s1)
/* 41CFB8 802A8228 8E9000DC */  lw        $s0, 0xDC($s4)
/* 41CFBC 802A822C 1440002E */  bnez      $v0, .L802A82E8_7AFC88
/* 41CFC0 802A8230 2402FFFF */   addiu    $v0, $zero, -0x1
/* 41CFC4 802A8234 A2820178 */  sb        $v0, 0x178($s4)
/* 41CFC8 802A8238 A680017C */  sh        $zero, 0x17C($s4)
/* 41CFCC 802A823C 0C0A9634 */  jal       func_802A58D0_7AD270
/* 41CFD0 802A8240 AE800188 */   sw       $zero, 0x188($s4)
/* 41CFD4 802A8244 14400005 */  bnez      $v0, .L802A825C_7AFBFC
/* 41CFD8 802A8248 00000000 */   nop
/* 41CFDC 802A824C 0C090464 */  jal       func_80241190
/* 41CFE0 802A8250 24040009 */   addiu    $a0, $zero, 0x9
/* 41CFE4 802A8254 080AA0B8 */  j         .L802A82E0_7AFC80
/* 41CFE8 802A8258 00000000 */   nop
.L802A825C_7AFBFC:
/* 41CFEC 802A825C 0C093903 */  jal       func_8024E40C
/* 41CFF0 802A8260 24040002 */   addiu    $a0, $zero, 0x2
/* 41CFF4 802A8264 8E820000 */  lw        $v0, 0x0($s4)
/* 41CFF8 802A8268 3C03F3FF */  lui       $v1, (0xF3FFFFFF >> 16)
/* 41CFFC 802A826C 34420002 */  ori       $v0, $v0, 0x2
/* 41D000 802A8270 AE820000 */  sw        $v0, 0x0($s4)
/* 41D004 802A8274 8E620000 */  lw        $v0, 0x0($s3)
/* 41D008 802A8278 3463FFFF */  ori       $v1, $v1, (0xF3FFFFFF & 0xFFFF)
/* 41D00C 802A827C 00431024 */  and       $v0, $v0, $v1
/* 41D010 802A8280 AE620000 */  sw        $v0, 0x0($s3)
/* 41D014 802A8284 8E020000 */  lw        $v0, 0x0($s0)
/* 41D018 802A8288 00431024 */  and       $v0, $v0, $v1
/* 41D01C 802A828C AE020000 */  sw        $v0, 0x0($s0)
/* 41D020 802A8290 8E820000 */  lw        $v0, 0x0($s4)
/* 41D024 802A8294 3C030010 */  lui       $v1, (0x100000 >> 16)
/* 41D028 802A8298 00431024 */  and       $v0, $v0, $v1
/* 41D02C 802A829C 10400003 */  beqz      $v0, .L802A82AC_7AFC4C
/* 41D030 802A82A0 2402012E */   addiu    $v0, $zero, 0x12E
/* 41D034 802A82A4 080AA0B8 */  j         .L802A82E0_7AFC80
/* 41D038 802A82A8 AE220000 */   sw       $v0, 0x0($s1)
.L802A82AC_7AFC4C:
/* 41D03C 802A82AC C6000138 */  lwc1      $f0, 0x138($s0)
/* 41D040 802A82B0 C6020140 */  lwc1      $f2, 0x140($s0)
/* 41D044 802A82B4 E600000C */  swc1      $f0, 0xC($s0)
/* 41D048 802A82B8 E6020014 */  swc1      $f2, 0x14($s0)
/* 41D04C 802A82BC C6600138 */  lwc1      $f0, 0x138($s3)
/* 41D050 802A82C0 2402012D */  addiu     $v0, $zero, 0x12D
/* 41D054 802A82C4 AE220000 */  sw        $v0, 0x0($s1)
/* 41D058 802A82C8 E6000018 */  swc1      $f0, 0x18($s0)
/* 41D05C 802A82CC C6600140 */  lwc1      $f0, 0x140($s3)
/* 41D060 802A82D0 24020004 */  addiu     $v0, $zero, 0x4
/* 41D064 802A82D4 A6020070 */  sh        $v0, 0x70($s0)
/* 41D068 802A82D8 AE000054 */  sw        $zero, 0x54($s0)
/* 41D06C 802A82DC E6000020 */  swc1      $f0, 0x20($s0)
.L802A82E0_7AFC80:
/* 41D070 802A82E0 3C11800E */  lui       $s1, %hi(gBattleSubState)
/* 41D074 802A82E4 2631C4DC */  addiu     $s1, $s1, %lo(gBattleSubState)
.L802A82E8_7AFC88:
/* 41D078 802A82E8 8E230000 */  lw        $v1, 0x0($s1)
/* 41D07C 802A82EC 2402012D */  addiu     $v0, $zero, 0x12D
/* 41D080 802A82F0 1462006C */  bne       $v1, $v0, .L802A84A4_7AFE44
/* 41D084 802A82F4 00000000 */   nop
/* 41D088 802A82F8 86020070 */  lh        $v0, 0x70($s0)
/* 41D08C 802A82FC 10400022 */  beqz      $v0, .L802A8388_7AFD28
/* 41D090 802A8300 00000000 */   nop
/* 41D094 802A8304 C6000018 */  lwc1      $f0, 0x18($s0)
/* 41D098 802A8308 C6080144 */  lwc1      $f8, 0x144($s0)
/* 41D09C 802A830C C6020020 */  lwc1      $f2, 0x20($s0)
/* 41D0A0 802A8310 46080001 */  sub.s     $f0, $f0, $f8
/* 41D0A4 802A8314 C604014C */  lwc1      $f4, 0x14C($s0)
/* 41D0A8 802A8318 46041081 */  sub.s     $f2, $f2, $f4
/* 41D0AC 802A831C 44823000 */  mtc1      $v0, $f6
/* 41D0B0 802A8320 00000000 */  nop
/* 41D0B4 802A8324 468031A0 */  cvt.s.w   $f6, $f6
/* 41D0B8 802A8328 46060003 */  div.s     $f0, $f0, $f6
/* 41D0BC 802A832C 46004200 */  add.s     $f8, $f8, $f0
/* 41D0C0 802A8330 46003006 */  mov.s     $f0, $f6
/* 41D0C4 802A8334 46061083 */  div.s     $f2, $f2, $f6
/* 41D0C8 802A8338 C600000C */  lwc1      $f0, 0xC($s0)
/* 41D0CC 802A833C 46022100 */  add.s     $f4, $f4, $f2
/* 41D0D0 802A8340 E6080144 */  swc1      $f8, 0x144($s0)
/* 41D0D4 802A8344 E604014C */  swc1      $f4, 0x14C($s0)
/* 41D0D8 802A8348 C6640144 */  lwc1      $f4, 0x144($s3)
/* 41D0DC 802A834C 46040001 */  sub.s     $f0, $f0, $f4
/* 41D0E0 802A8350 46003086 */  mov.s     $f2, $f6
/* 41D0E4 802A8354 46060003 */  div.s     $f0, $f0, $f6
/* 41D0E8 802A8358 46002100 */  add.s     $f4, $f4, $f0
/* 41D0EC 802A835C E6640144 */  swc1      $f4, 0x144($s3)
/* 41D0F0 802A8360 C6000014 */  lwc1      $f0, 0x14($s0)
/* 41D0F4 802A8364 C664014C */  lwc1      $f4, 0x14C($s3)
/* 41D0F8 802A8368 86020070 */  lh        $v0, 0x70($s0)
/* 41D0FC 802A836C 46040001 */  sub.s     $f0, $f0, $f4
/* 41D100 802A8370 44821000 */  mtc1      $v0, $f2
/* 41D104 802A8374 00000000 */  nop
/* 41D108 802A8378 468010A0 */  cvt.s.w   $f2, $f2
/* 41D10C 802A837C 46020003 */  div.s     $f0, $f0, $f2
/* 41D110 802A8380 46002100 */  add.s     $f4, $f4, $f0
/* 41D114 802A8384 E664014C */  swc1      $f4, 0x14C($s3)
.L802A8388_7AFD28:
/* 41D118 802A8388 C60C0054 */  lwc1      $f12, 0x54($s0)
/* 41D11C 802A838C 3C0140C9 */  lui       $at, (0x40C90FD0 >> 16)
/* 41D120 802A8390 34210FD0 */  ori       $at, $at, (0x40C90FD0 & 0xFFFF)
/* 41D124 802A8394 4481B000 */  mtc1      $at, $f22
/* 41D128 802A8398 00000000 */  nop
/* 41D12C 802A839C 46166302 */  mul.s     $f12, $f12, $f22
/* 41D130 802A83A0 00000000 */  nop
/* 41D134 802A83A4 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
/* 41D138 802A83A8 4481C000 */  mtc1      $at, $f24
/* 41D13C 802A83AC 3C014180 */  lui       $at, (0x41800000 >> 16)
/* 41D140 802A83B0 4481A000 */  mtc1      $at, $f20
/* 41D144 802A83B4 0C00A85B */  jal       sin_rad
/* 41D148 802A83B8 46186303 */   div.s    $f12, $f12, $f24
/* 41D14C 802A83BC 46140002 */  mul.s     $f0, $f0, $f20
/* 41D150 802A83C0 00000000 */  nop
/* 41D154 802A83C4 C602014C */  lwc1      $f2, 0x14C($s0)
/* 41D158 802A83C8 46001080 */  add.s     $f2, $f2, $f0
/* 41D15C 802A83CC C60C0054 */  lwc1      $f12, 0x54($s0)
/* 41D160 802A83D0 46006307 */  neg.s     $f12, $f12
/* 41D164 802A83D4 0C00A6C9 */  jal       clamp_angle
/* 41D168 802A83D8 E602014C */   swc1     $f2, 0x14C($s0)
/* 41D16C 802A83DC C60C0054 */  lwc1      $f12, 0x54($s0)
/* 41D170 802A83E0 46166302 */  mul.s     $f12, $f12, $f22
/* 41D174 802A83E4 00000000 */  nop
/* 41D178 802A83E8 E600018C */  swc1      $f0, 0x18C($s0)
/* 41D17C 802A83EC 0C00A85B */  jal       sin_rad
/* 41D180 802A83F0 46186303 */   div.s    $f12, $f12, $f24
/* 41D184 802A83F4 46140002 */  mul.s     $f0, $f0, $f20
/* 41D188 802A83F8 00000000 */  nop
/* 41D18C 802A83FC C662014C */  lwc1      $f2, 0x14C($s3)
/* 41D190 802A8400 46001081 */  sub.s     $f2, $f2, $f0
/* 41D194 802A8404 E662014C */  swc1      $f2, 0x14C($s3)
/* 41D198 802A8408 C60C0054 */  lwc1      $f12, 0x54($s0)
/* 41D19C 802A840C 0C00A6C9 */  jal       clamp_angle
/* 41D1A0 802A8410 46006307 */   neg.s    $f12, $f12
/* 41D1A4 802A8414 E660018C */  swc1      $f0, 0x18C($s3)
/* 41D1A8 802A8418 C6000054 */  lwc1      $f0, 0x54($s0)
/* 41D1AC 802A841C 3C0142B4 */  lui       $at, (0x42B40000 >> 16)
/* 41D1B0 802A8420 44811000 */  mtc1      $at, $f2
/* 41D1B4 802A8424 86020070 */  lh        $v0, 0x70($s0)
/* 41D1B8 802A8428 46020000 */  add.s     $f0, $f0, $f2
/* 41D1BC 802A842C 96030070 */  lhu       $v1, 0x70($s0)
/* 41D1C0 802A8430 10400004 */  beqz      $v0, .L802A8444_7AFDE4
/* 41D1C4 802A8434 E6000054 */   swc1     $f0, 0x54($s0)
/* 41D1C8 802A8438 2462FFFF */  addiu     $v0, $v1, -0x1
/* 41D1CC 802A843C 080AA129 */  j         .L802A84A4_7AFE44
/* 41D1D0 802A8440 A6020070 */   sh       $v0, 0x70($s0)
.L802A8444_7AFDE4:
/* 41D1D4 802A8444 C6000018 */  lwc1      $f0, 0x18($s0)
/* 41D1D8 802A8448 C6020020 */  lwc1      $f2, 0x20($s0)
/* 41D1DC 802A844C C604000C */  lwc1      $f4, 0xC($s0)
D_802A8450_7AFDF0:
/* 41D1E0 802A8450 E6000144 */  swc1      $f0, 0x144($s0)
/* 41D1E4 802A8454 E602014C */  swc1      $f2, 0x14C($s0)
/* 41D1E8 802A8458 E6640144 */  swc1      $f4, 0x144($s3)
/* 41D1EC 802A845C C6000014 */  lwc1      $f0, 0x14($s0)
/* 41D1F0 802A8460 E660014C */  swc1      $f0, 0x14C($s3)
/* 41D1F4 802A8464 C6000144 */  lwc1      $f0, 0x144($s0)
/* 41D1F8 802A8468 C602014C */  lwc1      $f2, 0x14C($s0)
/* 41D1FC 802A846C 2402012E */  addiu     $v0, $zero, 0x12E
D_802A8470_7AFE10:
/* 41D200 802A8470 E6000138 */  swc1      $f0, 0x138($s0)
/* 41D204 802A8474 E6020140 */  swc1      $f2, 0x140($s0)
/* 41D208 802A8478 C6600144 */  lwc1      $f0, 0x144($s3)
/* 41D20C 802A847C C662014C */  lwc1      $f2, 0x14C($s3)
/* 41D210 802A8480 3C04800E */  lui       $a0, %hi(gBattleStatus)
/* 41D214 802A8484 2484C070 */  addiu     $a0, $a0, %lo(gBattleStatus)
/* 41D218 802A8488 AE220000 */  sw        $v0, 0x0($s1)
/* 41D21C 802A848C E6600138 */  swc1      $f0, 0x138($s3)
/* 41D220 802A8490 E6620140 */  swc1      $f2, 0x140($s3)
/* 41D224 802A8494 8C820000 */  lw        $v0, 0x0($a0)
/* 41D228 802A8498 3C030010 */  lui       $v1, (0x100000 >> 16)
/* 41D22C 802A849C 00431025 */  or        $v0, $v0, $v1
/* 41D230 802A84A0 AC820000 */  sw        $v0, 0x0($a0)
.L802A84A4_7AFE44:
/* 41D234 802A84A4 3C02800E */  lui       $v0, %hi(gBattleSubState)
/* 41D238 802A84A8 8C42C4DC */  lw        $v0, %lo(gBattleSubState)($v0)
/* 41D23C 802A84AC 2443FFFE */  addiu     $v1, $v0, -0x2
/* 41D240 802A84B0 2C62012D */  sltiu     $v0, $v1, 0x12D
/* 41D244 802A84B4 1040057D */  beqz      $v0, .L802A9AAC_7B144C
/* 41D248 802A84B8 00031080 */   sll      $v0, $v1, 2
/* 41D24C 802A84BC 3C01802B */  lui       $at, %hi(jtbl_802AC3C8_7B3D68)
/* 41D250 802A84C0 00220821 */  addu      $at, $at, $v0
/* 41D254 802A84C4 8C22C3C8 */  lw        $v0, %lo(jtbl_802AC3C8_7B3D68)($at)
/* 41D258 802A84C8 00400008 */  jr        $v0
/* 41D25C 802A84CC 00000000 */   nop
/* 41D260 802A84D0 3C03FBFF */  lui       $v1, (0xFBFFFFFF >> 16)
/* 41D264 802A84D4 3463FFFF */  ori       $v1, $v1, (0xFBFFFFFF & 0xFFFF)
/* 41D268 802A84D8 8E020000 */  lw        $v0, 0x0($s0)
/* 41D26C 802A84DC 3C040800 */  lui       $a0, (0x8000000 >> 16)
/* 41D270 802A84E0 00441025 */  or        $v0, $v0, $a0
/* 41D274 802A84E4 00431024 */  and       $v0, $v0, $v1
/* 41D278 802A84E8 AE020000 */  sw        $v0, 0x0($s0)
/* 41D27C 802A84EC 8E620000 */  lw        $v0, 0x0($s3)
/* 41D280 802A84F0 3C030400 */  lui       $v1, (0x4000000 >> 16)
/* 41D284 802A84F4 00431025 */  or        $v0, $v0, $v1
/* 41D288 802A84F8 00441025 */  or        $v0, $v0, $a0
/* 41D28C 802A84FC 0C098CC0 */  jal       func_80263300
/* 41D290 802A8500 AE620000 */   sw       $v0, 0x0($s3)
/* 41D294 802A8504 0C098C9A */  jal       func_80263268
/* 41D298 802A8508 24110001 */   addiu    $s1, $zero, 0x1
/* 41D29C 802A850C 8282005C */  lb        $v0, 0x5C($s4)
/* 41D2A0 802A8510 04410002 */  bgez      $v0, .L802A851C_7AFEBC
/* 41D2A4 802A8514 24020006 */   addiu    $v0, $zero, 0x6
/* 41D2A8 802A8518 A282005C */  sb        $v0, 0x5C($s4)
.L802A851C_7AFEBC:
/* 41D2AC 802A851C 0C098E45 */  jal       btl_init_menu_partner
/* 41D2B0 802A8520 00000000 */   nop
/* 41D2B4 802A8524 0C098C9A */  jal       func_80263268
/* 41D2B8 802A8528 00000000 */   nop
/* 41D2BC 802A852C 24040007 */  addiu     $a0, $zero, 0x7
/* 41D2C0 802A8530 3C13802B */  lui       $s3, %hi(BattleMenu_OptionEnabled)
/* 41D2C4 802A8534 2673D0D0 */  addiu     $s3, $s3, %lo(BattleMenu_OptionEnabled)
/* 41D2C8 802A8538 3C15802B */  lui       $s5, %hi(battle_menu_isMessageDisabled)
/* 41D2CC 802A853C 26B5D0E8 */  addiu     $s5, $s5, %lo(battle_menu_isMessageDisabled)
/* 41D2D0 802A8540 3C03802B */  lui       $v1, %hi(D_802AB478_7B2E18)
/* 41D2D4 802A8544 2463B478 */  addiu     $v1, $v1, %lo(D_802AB478_7B2E18)
/* 41D2D8 802A8548 3C12802B */  lui       $s2, %hi(BattleMenu_HudScripts)
/* 41D2DC 802A854C 2652D078 */  addiu     $s2, $s2, %lo(BattleMenu_HudScripts)
/* 41D2E0 802A8550 3C01802B */  lui       $at, %hi(battle_menu_submenuIDs)
/* 41D2E4 802A8554 AC24D0B8 */  sw        $a0, %lo(battle_menu_submenuIDs)($at)
/* 41D2E8 802A8558 AE710000 */  sw        $s1, 0x0($s3)
/* 41D2EC 802A855C AEA00000 */  sw        $zero, 0x0($s5)
/* 41D2F0 802A8560 8C620000 */  lw        $v0, 0x0($v1)
/* 41D2F4 802A8564 3C16802B */  lui       $s6, %hi(D_802AB4C0_7B2E60)
/* 41D2F8 802A8568 26D6B4C0 */  addiu     $s6, $s6, %lo(D_802AB4C0_7B2E60)
/* 41D2FC 802A856C AE420000 */  sw        $v0, 0x0($s2)
/* 41D300 802A8570 8EC2001C */  lw        $v0, 0x1C($s6)
/* 41D304 802A8574 3C1E802B */  lui       $fp, %hi(BattleMenu_TitleMessages)
/* 41D308 802A8578 27DED090 */  addiu     $fp, $fp, %lo(BattleMenu_TitleMessages)
/* 41D30C 802A857C AFC20000 */  sw        $v0, 0x0($fp)
/* 41D310 802A8580 96820070 */  lhu       $v0, 0x70($s4)
/* 41D314 802A8584 30420080 */  andi      $v0, $v0, 0x80
/* 41D318 802A8588 14400005 */  bnez      $v0, .L802A85A0_7AFF40
/* 41D31C 802A858C 24020048 */   addiu    $v0, $zero, 0x48
/* 41D320 802A8590 AE600000 */  sw        $zero, 0x0($s3)
/* 41D324 802A8594 8C630004 */  lw        $v1, 0x4($v1)
/* 41D328 802A8598 AEA20000 */  sw        $v0, 0x0($s5)
/* 41D32C 802A859C AE430000 */  sw        $v1, 0x0($s2)
.L802A85A0_7AFF40:
/* 41D330 802A85A0 8282005C */  lb        $v0, 0x5C($s4)
/* 41D334 802A85A4 50440001 */  beql      $v0, $a0, .L802A85AC_7AFF4C
/* 41D338 802A85A8 0000882D */   daddu    $s1, $zero, $zero
.L802A85AC_7AFF4C:
/* 41D33C 802A85AC 82E30012 */  lb        $v1, 0x12($s7)
/* 41D340 802A85B0 24100001 */  addiu     $s0, $zero, 0x1
/* 41D344 802A85B4 00031080 */  sll       $v0, $v1, 2
/* 41D348 802A85B8 00431021 */  addu      $v0, $v0, $v1
/* 41D34C 802A85BC 000210C0 */  sll       $v0, $v0, 3
/* 41D350 802A85C0 3C03802B */  lui       $v1, %hi(D_802AB590_7B2F30)
/* 41D354 802A85C4 00621821 */  addu      $v1, $v1, $v0
/* 41D358 802A85C8 8C63B590 */  lw        $v1, %lo(D_802AB590_7B2F30)($v1)
/* 41D35C 802A85CC 8EC20018 */  lw        $v0, 0x18($s6)
/* 41D360 802A85D0 24050006 */  addiu     $a1, $zero, 0x6
/* 41D364 802A85D4 3C01802B */  lui       $at, %hi(D_802AD0BC_7B4A5C)
/* 41D368 802A85D8 AC25D0BC */  sw        $a1, %lo(D_802AD0BC_7B4A5C)($at)
/* 41D36C 802A85DC AE700004 */  sw        $s0, 0x4($s3)
/* 41D370 802A85E0 AFC20004 */  sw        $v0, 0x4($fp)
/* 41D374 802A85E4 AE430004 */  sw        $v1, 0x4($s2)
/* 41D378 802A85E8 82820080 */  lb        $v0, 0x80($s4)
/* 41D37C 802A85EC 3C04802B */  lui       $a0, %hi(D_802AB590_7B2F30)
/* 41D380 802A85F0 1C40000B */  bgtz      $v0, .L802A8620_7AFFC0
/* 41D384 802A85F4 2484B590 */   addiu    $a0, $a0, %lo(D_802AB590_7B2F30)
/* 41D388 802A85F8 82E30012 */  lb        $v1, 0x12($s7)
/* 41D38C 802A85FC 00031080 */  sll       $v0, $v1, 2
/* 41D390 802A8600 00431021 */  addu      $v0, $v0, $v1
/* 41D394 802A8604 000210C0 */  sll       $v0, $v0, 3
/* 41D398 802A8608 00441021 */  addu      $v0, $v0, $a0
/* 41D39C 802A860C 8C430004 */  lw        $v1, 0x4($v0)
/* 41D3A0 802A8610 24020048 */  addiu     $v0, $zero, 0x48
/* 41D3A4 802A8614 AE600004 */  sw        $zero, 0x4($s3)
/* 41D3A8 802A8618 AEA20004 */  sw        $v0, 0x4($s5)
/* 41D3AC 802A861C AE430004 */  sw        $v1, 0x4($s2)
.L802A8620_7AFFC0:
/* 41D3B0 802A8620 96820070 */  lhu       $v0, 0x70($s4)
/* 41D3B4 802A8624 30420040 */  andi      $v0, $v0, 0x40
/* 41D3B8 802A8628 1440000B */  bnez      $v0, .L802A8658_7AFFF8
/* 41D3BC 802A862C 00000000 */   nop
/* 41D3C0 802A8630 82E30012 */  lb        $v1, 0x12($s7)
/* 41D3C4 802A8634 00031080 */  sll       $v0, $v1, 2
/* 41D3C8 802A8638 00431021 */  addu      $v0, $v0, $v1
/* 41D3CC 802A863C 000210C0 */  sll       $v0, $v0, 3
/* 41D3D0 802A8640 00441021 */  addu      $v0, $v0, $a0
/* 41D3D4 802A8644 8C430004 */  lw        $v1, 0x4($v0)
/* 41D3D8 802A8648 24020048 */  addiu     $v0, $zero, 0x48
/* 41D3DC 802A864C AE600004 */  sw        $zero, 0x4($s3)
/* 41D3E0 802A8650 AEA20004 */  sw        $v0, 0x4($s5)
/* 41D3E4 802A8654 AE430004 */  sw        $v1, 0x4($s2)
.L802A8658_7AFFF8:
/* 41D3E8 802A8658 8282005C */  lb        $v0, 0x5C($s4)
/* 41D3EC 802A865C 50450001 */  beql      $v0, $a1, .L802A8664_7B0004
/* 41D3F0 802A8660 24110001 */   addiu    $s1, $zero, 0x1
.L802A8664_7B0004:
/* 41D3F4 802A8664 82E2028E */  lb        $v0, 0x28E($s7)
/* 41D3F8 802A8668 1040001C */  beqz      $v0, .L802A86DC_7B007C
/* 41D3FC 802A866C 24100002 */   addiu    $s0, $zero, 0x2
/* 41D400 802A8670 0C03A752 */  jal       is_ability_active
/* 41D404 802A8674 24040035 */   addiu    $a0, $zero, 0x35
/* 41D408 802A8678 10400018 */  beqz      $v0, .L802A86DC_7B007C
/* 41D40C 802A867C 2407000B */   addiu    $a3, $zero, 0xB
/* 41D410 802A8680 3C06802B */  lui       $a2, %hi(D_802AB390_7B2D30)
/* 41D414 802A8684 24C6B390 */  addiu     $a2, $a2, %lo(D_802AB390_7B2D30)
/* 41D418 802A8688 8CC40000 */  lw        $a0, 0x0($a2)
/* 41D41C 802A868C 8EC5002C */  lw        $a1, 0x2C($s6)
/* 41D420 802A8690 96830070 */  lhu       $v1, 0x70($s4)
/* 41D424 802A8694 24020001 */  addiu     $v0, $zero, 0x1
/* 41D428 802A8698 3C01802B */  lui       $at, %hi(D_802AD0C0_7B4A60)
/* 41D42C 802A869C AC27D0C0 */  sw        $a3, %lo(D_802AD0C0_7B4A60)($at)
/* 41D430 802A86A0 AE620008 */  sw        $v0, 0x8($s3)
/* 41D434 802A86A4 AEA00008 */  sw        $zero, 0x8($s5)
/* 41D438 802A86A8 30630800 */  andi      $v1, $v1, 0x800
/* 41D43C 802A86AC AE440008 */  sw        $a0, 0x8($s2)
/* 41D440 802A86B0 14600006 */  bnez      $v1, .L802A86CC_7B006C
/* 41D444 802A86B4 AFC50008 */   sw       $a1, 0x8($fp)
/* 41D448 802A86B8 AE600008 */  sw        $zero, 0x8($s3)
/* 41D44C 802A86BC 8CC30004 */  lw        $v1, 0x4($a2)
/* 41D450 802A86C0 24020048 */  addiu     $v0, $zero, 0x48
/* 41D454 802A86C4 AEA20008 */  sw        $v0, 0x8($s5)
/* 41D458 802A86C8 AE430008 */  sw        $v1, 0x8($s2)
.L802A86CC_7B006C:
/* 41D45C 802A86CC 8282005C */  lb        $v0, 0x5C($s4)
/* 41D460 802A86D0 50470001 */  beql      $v0, $a3, .L802A86D8_7B0078
/* 41D464 802A86D4 24110002 */   addiu    $s1, $zero, 0x2
.L802A86D8_7B0078:
/* 41D468 802A86D8 24100003 */  addiu     $s0, $zero, 0x3
.L802A86DC_7B007C:
/* 41D46C 802A86DC 3C01802B */  lui       $at, %hi(BattleMenu_NumOptions)
/* 41D470 802A86E0 AC30D0AC */  sw        $s0, %lo(BattleMenu_NumOptions)($at)
/* 41D474 802A86E4 24100001 */  addiu     $s0, $zero, 0x1
/* 41D478 802A86E8 24020002 */  addiu     $v0, $zero, 0x2
/* 41D47C 802A86EC 00511023 */  subu      $v0, $v0, $s1
/* 41D480 802A86F0 3C01802B */  lui       $at, %hi(D_802AD0A8)
/* 41D484 802A86F4 AC30D0A8 */  sw        $s0, %lo(D_802AD0A8)($at)
/* 41D488 802A86F8 3C01802B */  lui       $at, %hi(D_802AD0B0)
/* 41D48C 802A86FC AC31D0B0 */  sw        $s1, %lo(D_802AD0B0)($at)
/* 41D490 802A8700 3C01802B */  lui       $at, %hi(D_802AD100)
/* 41D494 802A8704 AC22D100 */  sw        $v0, %lo(D_802AD100)($at)
/* 41D498 802A8708 0C0A9606 */  jal       func_802A5818_7AD1B8
/* 41D49C 802A870C 00000000 */   nop
/* 41D4A0 802A8710 10400005 */  beqz      $v0, .L802A8728_7B00C8
/* 41D4A4 802A8714 00000000 */   nop
/* 41D4A8 802A8718 3C01802B */  lui       $at, %hi(BattleMenu_ShowSwapIcons)
/* 41D4AC 802A871C AC30D104 */  sw        $s0, %lo(BattleMenu_ShowSwapIcons)($at)
/* 41D4B0 802A8720 080AA1CC */  j         .L802A8730_7B00D0
/* 41D4B4 802A8724 00000000 */   nop
.L802A8728_7B00C8:
/* 41D4B8 802A8728 3C01802B */  lui       $at, %hi(BattleMenu_ShowSwapIcons)
/* 41D4BC 802A872C AC20D104 */  sw        $zero, %lo(BattleMenu_ShowSwapIcons)($at)
.L802A8730_7B00D0:
/* 41D4C0 802A8730 0C0A8400 */  jal       func_802A1000_7A89A0
/* 41D4C4 802A8734 00000000 */   nop
/* 41D4C8 802A8738 24020008 */  addiu     $v0, $zero, 0x8
/* 41D4CC 802A873C 3C01802B */  lui       $at, %hi(D_802ACC60)
/* 41D4D0 802A8740 AC22CC60 */  sw        $v0, %lo(D_802ACC60)($at)
/* 41D4D4 802A8744 3C01802B */  lui       $at, %hi(D_802ACC6C)
/* 41D4D8 802A8748 AC20CC6C */  sw        $zero, %lo(D_802ACC6C)($at)
/* 41D4DC 802A874C 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41D4E0 802A8750 24020002 */   addiu    $v0, $zero, 0x2
glabel .L802A8754_7B00F4
/* 41D4E4 802A8754 82E20012 */  lb        $v0, 0x12($s7)
/* 41D4E8 802A8758 24040100 */  addiu     $a0, $zero, 0x100
/* 41D4EC 802A875C 00021080 */  sll       $v0, $v0, 2
/* 41D4F0 802A8760 3C06802B */  lui       $a2, %hi(D_802AB520_7B2EC0)
/* 41D4F4 802A8764 00C23021 */  addu      $a2, $a2, $v0
/* 41D4F8 802A8768 8CC6B520 */  lw        $a2, %lo(D_802AB520_7B2EC0)($a2)
/* 41D4FC 802A876C 0C098F3F */  jal       set_animation
/* 41D500 802A8770 0000282D */   daddu    $a1, $zero, $zero
/* 41D504 802A8774 24020003 */  addiu     $v0, $zero, 0x3
/* 41D508 802A8778 3C01800E */  lui       $at, %hi(gBattleSubState)
/* 41D50C 802A877C AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
glabel .L802A8780_7B0120
/* 41D510 802A8780 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41D514 802A8784 00000000 */   nop
/* 41D518 802A8788 3C04802B */  lui       $a0, %hi(D_802ACC6C)
/* 41D51C 802A878C 2484CC6C */  addiu     $a0, $a0, %lo(D_802ACC6C)
D_802A8790_7B0130:
/* 41D520 802A8790 8C830000 */  lw        $v1, 0x0($a0)
/* 41D524 802A8794 10600004 */  beqz      $v1, .L802A87A8_7B0148
/* 41D528 802A8798 0040802D */   daddu    $s0, $v0, $zero
/* 41D52C 802A879C 2462FFFF */  addiu     $v0, $v1, -0x1
/* 41D530 802A87A0 080AA20D */  j         .L802A8834_7B01D4
/* 41D534 802A87A4 AC820000 */   sw       $v0, 0x0($a0)
.L802A87A8_7B0148:
/* 41D538 802A87A8 3C02800E */  lui       $v0, %hi(gBattleStatus)
/* 41D53C 802A87AC 8C42C070 */  lw        $v0, %lo(gBattleStatus)($v0)
D_802A87B0_7B0150:
/* 41D540 802A87B0 3C030200 */  lui       $v1, (0x2000000 >> 16)
/* 41D544 802A87B4 00431024 */  and       $v0, $v0, $v1
/* 41D548 802A87B8 1440001E */  bnez      $v0, .L802A8834_7B01D4
/* 41D54C 802A87BC 00000000 */   nop
D_802A87C0_7B0160:
/* 41D550 802A87C0 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 41D554 802A87C4 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 41D558 802A87C8 8C420010 */  lw        $v0, 0x10($v0)
/* 41D55C 802A87CC 30422000 */  andi      $v0, $v0, 0x2000
/* 41D560 802A87D0 10400018 */  beqz      $v0, .L802A8834_7B01D4
/* 41D564 802A87D4 00000000 */   nop
/* 41D568 802A87D8 0C0A9606 */  jal       func_802A5818_7AD1B8
/* 41D56C 802A87DC 00000000 */   nop
/* 41D570 802A87E0 10400010 */  beqz      $v0, .L802A8824_7B01C4
/* 41D574 802A87E4 00000000 */   nop
/* 41D578 802A87E8 0C05272D */  jal       sfx_play_sound
/* 41D57C 802A87EC 2404000F */   addiu    $a0, $zero, 0xF
/* 41D580 802A87F0 3C02802B */  lui       $v0, %hi(BattleMenu_CurPos)
/* 41D584 802A87F4 8042D002 */  lb        $v0, %lo(BattleMenu_CurPos)($v0)
/* 41D588 802A87F8 3C03802B */  lui       $v1, %hi(BattleMenu_HomePos)
/* 41D58C 802A87FC 8063D06B */  lb        $v1, %lo(BattleMenu_HomePos)($v1)
/* 41D590 802A8800 00431021 */  addu      $v0, $v0, $v1
/* 41D594 802A8804 00021080 */  sll       $v0, $v0, 2
/* 41D598 802A8808 3C01802B */  lui       $at, %hi(D_802AD0BB)
/* 41D59C 802A880C 00220821 */  addu      $at, $at, $v0
/* 41D5A0 802A8810 9022D0BB */  lbu       $v0, %lo(D_802AD0BB)($at)
/* 41D5A4 802A8814 0C0A842E */  jal       func_802A10B8_7A8A58
/* 41D5A8 802A8818 A282005C */   sb       $v0, 0x5C($s4)
/* 41D5AC 802A881C 080AA5DD */  j         .L802A9774_7B1114
/* 41D5B0 802A8820 00000000 */   nop
.L802A8824_7B01C4:
/* 41D5B4 802A8824 0C05272D */  jal       sfx_play_sound
/* 41D5B8 802A8828 2404021D */   addiu    $a0, $zero, 0x21D
/* 41D5BC 802A882C 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41D5C0 802A8830 24020008 */   addiu    $v0, $zero, 0x8
.L802A8834_7B01D4:
/* 41D5C4 802A8834 3C03802B */  lui       $v1, %hi(D_802ACC60)
D_802A8838_7B01D8:
/* 41D5C8 802A8838 2463CC60 */  addiu     $v1, $v1, %lo(D_802ACC60)
/* 41D5CC 802A883C 8C620000 */  lw        $v0, 0x0($v1)
/* 41D5D0 802A8840 10400003 */  beqz      $v0, .L802A8850_7B01F0
/* 41D5D4 802A8844 2442FFFF */   addiu    $v0, $v0, -0x1
/* 41D5D8 802A8848 080AA6AB */  j         .L802A9AAC_7B144C
/* 41D5DC 802A884C AC620000 */   sw       $v0, 0x0($v1)
.L802A8850_7B01F0:
/* 41D5E0 802A8850 12000496 */  beqz      $s0, .L802A9AAC_7B144C
/* 41D5E4 802A8854 24040100 */   addiu    $a0, $zero, 0x100
/* 41D5E8 802A8858 82E20012 */  lb        $v0, 0x12($s7)
/* 41D5EC 802A885C 00021080 */  sll       $v0, $v0, 2
/* 41D5F0 802A8860 3C06802B */  lui       $a2, %hi(D_802AB558_7B2EF8)
/* 41D5F4 802A8864 00C23021 */  addu      $a2, $a2, $v0
/* 41D5F8 802A8868 8CC6B558 */  lw        $a2, %lo(D_802AB558_7B2EF8)($a2)
/* 41D5FC 802A886C 0C098F3F */  jal       set_animation
/* 41D600 802A8870 0000282D */   daddu    $a1, $zero, $zero
/* 41D604 802A8874 2602FFFF */  addiu     $v0, $s0, -0x1
/* 41D608 802A8878 00021080 */  sll       $v0, $v0, 2
/* 41D60C 802A887C 3C01802B */  lui       $at, %hi(D_802AD0BB)
D_802A8880_7B0220:
/* 41D610 802A8880 00220821 */  addu      $at, $at, $v0
/* 41D614 802A8884 9022D0BB */  lbu       $v0, %lo(D_802AD0BB)($at)
/* 41D618 802A8888 A282004A */  sb        $v0, 0x4A($s4)
/* 41D61C 802A888C 8283004A */  lb        $v1, 0x4A($s4)
D_802A8890_7B0230:
/* 41D620 802A8890 24050007 */  addiu     $a1, $zero, 0x7
/* 41D624 802A8894 14650003 */  bne       $v1, $a1, .L802A88A4_7B0244
/* 41D628 802A8898 A282005C */   sb       $v0, 0x5C($s4)
/* 41D62C 802A889C 080AA641 */  j         .L802A9904_7B12A4
D_802A88A0_7B0240:
/* 41D630 802A88A0 240200C8 */   addiu    $v0, $zero, 0xC8
.L802A88A4_7B0244:
/* 41D634 802A88A4 24040006 */  addiu     $a0, $zero, 0x6
/* 41D638 802A88A8 14640003 */  bne       $v1, $a0, .L802A88B8_7B0258
/* 41D63C 802A88AC 24020008 */   addiu    $v0, $zero, 0x8
/* 41D640 802A88B0 080AA641 */  j         .L802A9904_7B12A4
/* 41D644 802A88B4 2402000A */   addiu    $v0, $zero, 0xA
.L802A88B8_7B0258:
/* 41D648 802A88B8 14620003 */  bne       $v1, $v0, .L802A88C8_7B0268
/* 41D64C 802A88BC 24020002 */   addiu    $v0, $zero, 0x2
/* 41D650 802A88C0 080AA641 */  j         .L802A9904_7B12A4
/* 41D654 802A88C4 2402003C */   addiu    $v0, $zero, 0x3C
.L802A88C8_7B0268:
/* 41D658 802A88C8 14620003 */  bne       $v1, $v0, .L802A88D8_7B0278
/* 41D65C 802A88CC 24020005 */   addiu    $v0, $zero, 0x5
/* 41D660 802A88D0 080AA641 */  j         .L802A9904_7B12A4
/* 41D664 802A88D4 24020028 */   addiu    $v0, $zero, 0x28
.L802A88D8_7B0278:
/* 41D668 802A88D8 54620003 */  bnel      $v1, $v0, .L802A88E8_7B0288
/* 41D66C 802A88DC A684006C */   sh       $a0, 0x6C($s4)
D_802A88E0_7B0280:
/* 41D670 802A88E0 080AA641 */  j         .L802A9904_7B12A4
/* 41D674 802A88E4 24020032 */   addiu    $v0, $zero, 0x32
.L802A88E8_7B0288:
/* 41D678 802A88E8 0C0A840C */  jal       func_802A1030_7A89D0
/* 41D67C 802A88EC A685006E */   sh       $a1, 0x6E($s4)
/* 41D680 802A88F0 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41D684 802A88F4 24020004 */   addiu    $v0, $zero, 0x4
glabel .L802A88F8_7B0298
/* 41D688 802A88F8 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41D68C 802A88FC 00000000 */   nop
/* 41D690 802A8900 8E830214 */  lw        $v1, 0x214($s4)
/* 41D694 802A8904 30634000 */  andi      $v1, $v1, 0x4000
/* 41D698 802A8908 10600007 */  beqz      $v1, .L802A8928_7B02C8
/* 41D69C 802A890C 0040802D */   daddu    $s0, $v0, $zero
/* 41D6A0 802A8910 16000007 */  bnez      $s0, D_802A8930_7B02D0
/* 41D6A4 802A8914 24040011 */   addiu    $a0, $zero, 0x11
/* 41D6A8 802A8918 0C0A841E */  jal       func_802A1078_7A8A18
/* 41D6AC 802A891C 00000000 */   nop
/* 41D6B0 802A8920 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41D6B4 802A8924 24020005 */   addiu    $v0, $zero, 0x5
.L802A8928_7B02C8:
/* 41D6B8 802A8928 12000460 */  beqz      $s0, .L802A9AAC_7B144C
/* 41D6BC 802A892C 24040011 */   addiu    $a0, $zero, 0x11
D_802A8930_7B02D0:
/* 41D6C0 802A8930 24020008 */  addiu     $v0, $zero, 0x8
/* 41D6C4 802A8934 A2820178 */  sb        $v0, 0x178($s4)
/* 41D6C8 802A8938 3C038009 */  lui       $v1, %hi(D_8008F9B0)
/* 41D6CC 802A893C 8C63F9B0 */  lw        $v1, %lo(D_8008F9B0)($v1)
/* 41D6D0 802A8940 24020077 */  addiu     $v0, $zero, 0x77
/* 41D6D4 802A8944 A682017C */  sh        $v0, 0x17C($s4)
/* 41D6D8 802A8948 080AA34A */  j         .L802A8D28_7B06C8
/* 41D6DC 802A894C A680017A */   sh       $zero, 0x17A($s4)
D_802A8950_7B02F0:
/* 41D6E0 802A8950 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41D6E4 802A8954 00000000 */   nop
/* 41D6E8 802A8958 10400454 */  beqz      $v0, .L802A9AAC_7B144C
/* 41D6EC 802A895C 24020008 */   addiu    $v0, $zero, 0x8
/* 41D6F0 802A8960 3C01802B */  lui       $at, %hi(D_802ACC60)
/* 41D6F4 802A8964 AC22CC60 */  sw        $v0, %lo(D_802ACC60)($at)
/* 41D6F8 802A8968 24020004 */  addiu     $v0, $zero, 0x4
/* 41D6FC 802A896C 3C01802B */  lui       $at, %hi(D_802ACC6C)
/* 41D700 802A8970 AC22CC6C */  sw        $v0, %lo(D_802ACC6C)($at)
/* 41D704 802A8974 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41D708 802A8978 24020002 */   addiu    $v0, $zero, 0x2
glabel .L802A897C_7B031C
/* 41D70C 802A897C 0C0A841E */  jal       func_802A1078_7A8A18
/* 41D710 802A8980 00000000 */   nop
/* 41D714 802A8984 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41D718 802A8988 24020005 */   addiu    $v0, $zero, 0x5
glabel .L802A898C_7B032C
/* 41D71C 802A898C 0C0A9606 */  jal       func_802A5818_7AD1B8
/* 41D720 802A8990 00000000 */   nop
/* 41D724 802A8994 14400002 */  bnez      $v0, .L802A89A0_7B0340
/* 41D728 802A8998 24040050 */   addiu    $a0, $zero, 0x50
/* 41D72C 802A899C 24040051 */  addiu     $a0, $zero, 0x51
.L802A89A0_7B0340:
/* 41D730 802A89A0 2405003C */  addiu     $a1, $zero, 0x3C
/* 41D734 802A89A4 0C093E81 */  jal       func_8024FA04
/* 41D738 802A89A8 0000302D */   daddu    $a2, $zero, $zero
/* 41D73C 802A89AC 24020001 */  addiu     $v0, $zero, 0x1
/* 41D740 802A89B0 3C01802B */  lui       $at, %hi(D_802AD607)
/* 41D744 802A89B4 A022D607 */  sb        $v0, %lo(D_802AD607)($at)
/* 41D748 802A89B8 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41D74C 802A89BC 24020009 */   addiu    $v0, $zero, 0x9
glabel .L802A89C0_7B0360
/* 41D750 802A89C0 0C093EAD */  jal       func_8024FAB4
/* 41D754 802A89C4 00000000 */   nop
/* 41D758 802A89C8 14400438 */  bnez      $v0, .L802A9AAC_7B144C
/* 41D75C 802A89CC 24020004 */   addiu    $v0, $zero, 0x4
/* 41D760 802A89D0 3C01802B */  lui       $at, %hi(D_802ACC6C)
/* 41D764 802A89D4 AC22CC6C */  sw        $v0, %lo(D_802ACC6C)($at)
/* 41D768 802A89D8 3C01802B */  lui       $at, %hi(D_802ACC60)
/* 41D76C 802A89DC AC20CC60 */  sw        $zero, %lo(D_802ACC60)($at)
/* 41D770 802A89E0 3C01802B */  lui       $at, %hi(D_802AD607)
/* 41D774 802A89E4 A020D607 */  sb        $zero, %lo(D_802AD607)($at)
/* 41D778 802A89E8 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41D77C 802A89EC 24020002 */   addiu    $v0, $zero, 0x2
glabel .L802A89F0_7B0390
/* 41D780 802A89F0 9282020E */  lbu       $v0, 0x20E($s4)
/* 41D784 802A89F4 1040007A */  beqz      $v0, .L802A8BE0_7B0580
/* 41D788 802A89F8 0000882D */   daddu    $s1, $zero, $zero
/* 41D78C 802A89FC 3C1E802B */  lui       $fp, %hi(D_802AB590_7B2F30)
/* 41D790 802A8A00 27DEB590 */  addiu     $fp, $fp, %lo(D_802AB590_7B2F30)
/* 41D794 802A8A04 2416000C */  addiu     $s6, $zero, 0xC
/* 41D798 802A8A08 24150008 */  addiu     $s5, $zero, 0x8
.L802A8A0C_7B03AC:
/* 41D79C 802A8A0C 02912821 */  addu      $a1, $s4, $s1
/* 41D7A0 802A8A10 3C02802B */  lui       $v0, %hi(BattleMenu_Moves_OptionCantUseMessages)
/* 41D7A4 802A8A14 2442D5E8 */  addiu     $v0, $v0, %lo(BattleMenu_Moves_OptionCantUseMessages)
/* 41D7A8 802A8A18 02222021 */  addu      $a0, $s1, $v0
/* 41D7AC 802A8A1C 90A301DE */  lbu       $v1, 0x1DE($a1)
/* 41D7B0 802A8A20 3C188009 */  lui       $t8, %hi(gMoveTable)
/* 41D7B4 802A8A24 2718F060 */  addiu     $t8, $t8, %lo(gMoveTable)
/* 41D7B8 802A8A28 A0800000 */  sb        $zero, 0x0($a0)
/* 41D7BC 802A8A2C 00031080 */  sll       $v0, $v1, 2
/* 41D7C0 802A8A30 00431021 */  addu      $v0, $v0, $v1
/* 41D7C4 802A8A34 00021080 */  sll       $v0, $v0, 2
/* 41D7C8 802A8A38 80A301F6 */  lb        $v1, 0x1F6($a1)
/* 41D7CC 802A8A3C 14600003 */  bnez      $v1, .L802A8A4C_7B03EC
/* 41D7D0 802A8A40 00583821 */   addu     $a3, $v0, $t8
/* 41D7D4 802A8A44 A0800000 */  sb        $zero, 0x0($a0)
/* 41D7D8 802A8A48 80A301F6 */  lb        $v1, 0x1F6($a1)
.L802A8A4C_7B03EC:
/* 41D7DC 802A8A4C 2402FFFF */  addiu     $v0, $zero, -0x1
/* 41D7E0 802A8A50 14620005 */  bne       $v1, $v0, .L802A8A68_7B0408
/* 41D7E4 802A8A54 2402FFFE */   addiu    $v0, $zero, -0x2
/* 41D7E8 802A8A58 A0A001F6 */  sb        $zero, 0x1F6($a1)
/* 41D7EC 802A8A5C 24180048 */  addiu     $t8, $zero, 0x48
/* 41D7F0 802A8A60 A0980000 */  sb        $t8, 0x0($a0)
/* 41D7F4 802A8A64 80A301F6 */  lb        $v1, 0x1F6($a1)
.L802A8A68_7B0408:
/* 41D7F8 802A8A68 14620003 */  bne       $v1, $v0, .L802A8A78_7B0418
/* 41D7FC 802A8A6C 24180048 */   addiu    $t8, $zero, 0x48
/* 41D800 802A8A70 A0A001F6 */  sb        $zero, 0x1F6($a1)
/* 41D804 802A8A74 A0980000 */  sb        $t8, 0x0($a0)
.L802A8A78_7B0418:
/* 41D808 802A8A78 3C04802B */  lui       $a0, %hi(battle_menu_moveOptionIconScripts)
/* 41D80C 802A8A7C 2484D260 */  addiu     $a0, $a0, %lo(battle_menu_moveOptionIconScripts)
/* 41D810 802A8A80 82E30012 */  lb        $v1, 0x12($s7)
/* 41D814 802A8A84 00113080 */  sll       $a2, $s1, 2
/* 41D818 802A8A88 00031080 */  sll       $v0, $v1, 2
/* 41D81C 802A8A8C 00431021 */  addu      $v0, $v0, $v1
/* 41D820 802A8A90 000210C0 */  sll       $v0, $v0, 3
/* 41D824 802A8A94 02A21021 */  addu      $v0, $s5, $v0
/* 41D828 802A8A98 005E1021 */  addu      $v0, $v0, $fp
/* 41D82C 802A8A9C 8C420000 */  lw        $v0, 0x0($v0)
/* 41D830 802A8AA0 00C42021 */  addu      $a0, $a2, $a0
/* 41D834 802A8AA4 AC820000 */  sw        $v0, 0x0($a0)
/* 41D838 802A8AA8 80A201F6 */  lb        $v0, 0x1F6($a1)
/* 41D83C 802A8AAC 14400009 */  bnez      $v0, .L802A8AD4_7B0474
/* 41D840 802A8AB0 00000000 */   nop
/* 41D844 802A8AB4 82E20012 */  lb        $v0, 0x12($s7)
/* 41D848 802A8AB8 00021880 */  sll       $v1, $v0, 2
/* 41D84C 802A8ABC 00621821 */  addu      $v1, $v1, $v0
/* 41D850 802A8AC0 000318C0 */  sll       $v1, $v1, 3
/* 41D854 802A8AC4 02C31821 */  addu      $v1, $s6, $v1
/* 41D858 802A8AC8 007E1821 */  addu      $v1, $v1, $fp
/* 41D85C 802A8ACC 8C620000 */  lw        $v0, 0x0($v1)
D_802A8AD0_7B0470:
/* 41D860 802A8AD0 AC820000 */  sw        $v0, 0x0($a0)
.L802A8AD4_7B0474:
/* 41D864 802A8AD4 90A201DE */  lbu       $v0, 0x1DE($a1)
/* 41D868 802A8AD8 3C01802B */  lui       $at, %hi(BattleMenu_Moves_OptionIndices)
/* 41D86C 802A8ADC 00260821 */  addu      $at, $at, $a2
/* 41D870 802A8AE0 AC22D4B0 */  sw        $v0, %lo(BattleMenu_Moves_OptionIndices)($at)
/* 41D874 802A8AE4 80A201F6 */  lb        $v0, 0x1F6($a1)
/* 41D878 802A8AE8 3C01802B */  lui       $at, %hi(BattleMenu_Moves_OptionEnabled)
/* 41D87C 802A8AEC 00260821 */  addu      $at, $at, $a2
D_802A8AF0_7B0490:
/* 41D880 802A8AF0 AC22D510 */  sw        $v0, %lo(BattleMenu_Moves_OptionEnabled)($at)
/* 41D884 802A8AF4 8CE20000 */  lw        $v0, 0x0($a3)
/* 41D888 802A8AF8 3C01802B */  lui       $at, %hi(battle_menu_moveOptionNames)
/* 41D88C 802A8AFC 00260821 */  addu      $at, $at, $a2
/* 41D890 802A8B00 AC22D2C0 */  sw        $v0, %lo(battle_menu_moveOptionNames)($at)
/* 41D894 802A8B04 8CE20008 */  lw        $v0, 0x8($a3)
/* 41D898 802A8B08 3C01802B */  lui       $at, %hi(BattleMenu_Moves_OptionDescMessages)
/* 41D89C 802A8B0C 00260821 */  addu      $at, $at, $a2
/* 41D8A0 802A8B10 AC22D570 */  sw        $v0, %lo(BattleMenu_Moves_OptionDescMessages)($at)
/* 41D8A4 802A8B14 80E20011 */  lb        $v0, 0x11($a3)
/* 41D8A8 802A8B18 0260202D */  daddu     $a0, $s3, $zero
/* 41D8AC 802A8B1C 3C01802B */  lui       $at, %hi(battle_menu_moveOptionDisplayCosts)
/* 41D8B0 802A8B20 00260821 */  addu      $at, $at, $a2
/* 41D8B4 802A8B24 AC22D320 */  sw        $v0, %lo(battle_menu_moveOptionDisplayCosts)($at)
/* 41D8B8 802A8B28 80E20012 */  lb        $v0, 0x12($a3)
/* 41D8BC 802A8B2C 24050018 */  addiu     $a1, $zero, 0x18
/* 41D8C0 802A8B30 3C01802B */  lui       $at, %hi(BattleMenu_Moves_OptionSortPriority)
/* 41D8C4 802A8B34 00310821 */  addu      $at, $at, $s1
/* 41D8C8 802A8B38 A031D5D0 */  sb        $s1, %lo(BattleMenu_Moves_OptionSortPriority)($at)
/* 41D8CC 802A8B3C 3C01802B */  lui       $at, %hi(battle_menu_moveOptionBPCosts)
/* 41D8D0 802A8B40 00260821 */  addu      $at, $at, $a2
/* 41D8D4 802A8B44 AC22D440 */  sw        $v0, %lo(battle_menu_moveOptionBPCosts)($at)
/* 41D8D8 802A8B48 3C02802B */  lui       $v0, %hi(battle_menu_moveOptionDisplayCostReductions)
/* 41D8DC 802A8B4C 2442D380 */  addiu     $v0, $v0, %lo(battle_menu_moveOptionDisplayCostReductions)
/* 41D8E0 802A8B50 00C28021 */  addu      $s0, $a2, $v0
/* 41D8E4 802A8B54 3C02802B */  lui       $v0, %hi(battle_menu_moveOptionDisplayCostReductionColors)
/* 41D8E8 802A8B58 2442D3E0 */  addiu     $v0, $v0, %lo(battle_menu_moveOptionDisplayCostReductionColors)
/* 41D8EC 802A8B5C 00C29021 */  addu      $s2, $a2, $v0
/* 41D8F0 802A8B60 AE000000 */  sw        $zero, 0x0($s0)
/* 41D8F4 802A8B64 0C099CAB */  jal       player_team_is_ability_active
/* 41D8F8 802A8B68 AE400000 */   sw       $zero, 0x0($s2)
/* 41D8FC 802A8B6C 10400008 */  beqz      $v0, .L802A8B90_7B0530
/* 41D900 802A8B70 0260202D */   daddu    $a0, $s3, $zero
/* 41D904 802A8B74 0C099CAB */  jal       player_team_is_ability_active
/* 41D908 802A8B78 24050018 */   addiu    $a1, $zero, 0x18
/* 41D90C 802A8B7C 8E030000 */  lw        $v1, 0x0($s0)
/* 41D910 802A8B80 00621821 */  addu      $v1, $v1, $v0
/* 41D914 802A8B84 24020001 */  addiu     $v0, $zero, 0x1
/* 41D918 802A8B88 AE030000 */  sw        $v1, 0x0($s0)
/* 41D91C 802A8B8C AE420000 */  sw        $v0, 0x0($s2)
.L802A8B90_7B0530:
/* 41D920 802A8B90 0260202D */  daddu     $a0, $s3, $zero
/* 41D924 802A8B94 0C099CAB */  jal       player_team_is_ability_active
/* 41D928 802A8B98 24050026 */   addiu    $a1, $zero, 0x26
/* 41D92C 802A8B9C 5040000B */  beql      $v0, $zero, .L802A8BCC_7B056C
/* 41D930 802A8BA0 26D60008 */   addiu    $s6, $s6, 0x8
/* 41D934 802A8BA4 0260202D */  daddu     $a0, $s3, $zero
/* 41D938 802A8BA8 0C099CAB */  jal       player_team_is_ability_active
/* 41D93C 802A8BAC 24050026 */   addiu    $a1, $zero, 0x26
/* 41D940 802A8BB0 8E030000 */  lw        $v1, 0x0($s0)
/* 41D944 802A8BB4 00021040 */  sll       $v0, $v0, 1
/* 41D948 802A8BB8 00621821 */  addu      $v1, $v1, $v0
/* 41D94C 802A8BBC 24020002 */  addiu     $v0, $zero, 0x2
/* 41D950 802A8BC0 AE030000 */  sw        $v1, 0x0($s0)
/* 41D954 802A8BC4 AE420000 */  sw        $v0, 0x0($s2)
/* 41D958 802A8BC8 26D60008 */  addiu     $s6, $s6, 0x8
.L802A8BCC_7B056C:
/* 41D95C 802A8BCC 9282020E */  lbu       $v0, 0x20E($s4)
/* 41D960 802A8BD0 26310001 */  addiu     $s1, $s1, 0x1
/* 41D964 802A8BD4 0222102A */  slt       $v0, $s1, $v0
/* 41D968 802A8BD8 1440FF8C */  bnez      $v0, .L802A8A0C_7B03AC
/* 41D96C 802A8BDC 26B50008 */   addiu    $s5, $s5, 0x8
.L802A8BE0_7B0580:
/* 41D970 802A8BE0 8282005D */  lb        $v0, 0x5D($s4)
/* 41D974 802A8BE4 04420001 */  bltzl     $v0, .L802A8BEC_7B058C
/* 41D978 802A8BE8 A280005D */   sb       $zero, 0x5D($s4)
.L802A8BEC_7B058C:
/* 41D97C 802A8BEC 8291005D */  lb        $s1, 0x5D($s4)
/* 41D980 802A8BF0 9282020E */  lbu       $v0, 0x20E($s4)
/* 41D984 802A8BF4 3C01802B */  lui       $at, %hi(BattleMenu_UsingSpiritsSubmenu)
/* 41D988 802A8BF8 AC20D4A0 */  sw        $zero, %lo(BattleMenu_UsingSpiritsSubmenu)($at)
/* 41D98C 802A8BFC 3C01802B */  lui       $at, %hi(BattleMenu_Moves_OptionCount)
/* 41D990 802A8C00 AC22D4A4 */  sw        $v0, %lo(BattleMenu_Moves_OptionCount)($at)
/* 41D994 802A8C04 3C01802B */  lui       $at, %hi(D_802AD4A8)
/* 41D998 802A8C08 AC31D4A8 */  sw        $s1, %lo(D_802AD4A8)($at)
/* 41D99C 802A8C0C 0C0A89A1 */  jal       func_802A2684_7AA024
/* 41D9A0 802A8C10 00000000 */   nop
/* 41D9A4 802A8C14 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41D9A8 802A8C18 2402000B */   addiu    $v0, $zero, 0xB
glabel .L802A8C1C_7B05BC
/* 41D9AC 802A8C1C 0C0A8B21 */  jal       func_802A2C84_7AA624
/* 41D9B0 802A8C20 00000000 */   nop
/* 41D9B4 802A8C24 0040802D */  daddu     $s0, $v0, $zero
/* 41D9B8 802A8C28 2402FFFF */  addiu     $v0, $zero, -0x1
/* 41D9BC 802A8C2C 1202039D */  beq       $s0, $v0, .L802A9AA4_7B1444
/* 41D9C0 802A8C30 24020010 */   addiu    $v0, $zero, 0x10
/* 41D9C4 802A8C34 1200039D */  beqz      $s0, .L802A9AAC_7B144C
/* 41D9C8 802A8C38 240200FF */   addiu    $v0, $zero, 0xFF
/* 41D9CC 802A8C3C 5602000B */  bnel      $s0, $v0, .L802A8C6C_7B060C
/* 41D9D0 802A8C40 2602FFFF */   addiu    $v0, $s0, -0x1
/* 41D9D4 802A8C44 0C0A8414 */  jal       func_802A1050_7A89F0
/* 41D9D8 802A8C48 00000000 */   nop
/* 41D9DC 802A8C4C 24020008 */  addiu     $v0, $zero, 0x8
/* 41D9E0 802A8C50 3C01802B */  lui       $at, %hi(D_802ACC60)
/* 41D9E4 802A8C54 AC22CC60 */  sw        $v0, %lo(D_802ACC60)($at)
/* 41D9E8 802A8C58 24020004 */  addiu     $v0, $zero, 0x4
/* 41D9EC 802A8C5C 3C01802B */  lui       $at, %hi(D_802ACC6C)
/* 41D9F0 802A8C60 AC22CC6C */  sw        $v0, %lo(D_802ACC6C)($at)
/* 41D9F4 802A8C64 080AA641 */  j         .L802A9904_7B12A4
/* 41D9F8 802A8C68 24020002 */   addiu    $v0, $zero, 0x2
.L802A8C6C_7B060C:
/* 41D9FC 802A8C6C 0C0A89F4 */  jal       D_802A27D0_7AA170
D_802A8C70_7B0610:
/* 41DA00 802A8C70 A282004B */   sb       $v0, 0x4B($s4)
/* 41DA04 802A8C74 0C0A840C */  jal       func_802A1030_7A89D0
/* 41DA08 802A8C78 00000000 */   nop
/* 41DA0C 802A8C7C 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41DA10 802A8C80 2402000C */   addiu    $v0, $zero, 0xC
glabel .L802A8C84_7B0624
/* 41DA14 802A8C84 0C0A8B21 */  jal       func_802A2C84_7AA624
/* 41DA18 802A8C88 00000000 */   nop
/* 41DA1C 802A8C8C 8E830214 */  lw        $v1, 0x214($s4)
D_802A8C90_7B0630:
/* 41DA20 802A8C90 30634000 */  andi      $v1, $v1, 0x4000
/* 41DA24 802A8C94 10600009 */  beqz      $v1, .L802A8CBC_7B065C
/* 41DA28 802A8C98 0040802D */   daddu    $s0, $v0, $zero
/* 41DA2C 802A8C9C 16000007 */  bnez      $s0, .L802A8CBC_7B065C
/* 41DA30 802A8CA0 00000000 */   nop
/* 41DA34 802A8CA4 0C0A8AAE */  jal       func_802A2AB8_7AA458
/* 41DA38 802A8CA8 00000000 */   nop
/* 41DA3C 802A8CAC 0C0A8426 */  jal       func_802A1098_7A8A38
/* 41DA40 802A8CB0 00000000 */   nop
/* 41DA44 802A8CB4 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41DA48 802A8CB8 2402000D */   addiu    $v0, $zero, 0xD
.L802A8CBC_7B065C:
/* 41DA4C 802A8CBC 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41DA50 802A8CC0 00000000 */   nop
/* 41DA54 802A8CC4 10400379 */  beqz      $v0, .L802A9AAC_7B144C
/* 41DA58 802A8CC8 24030006 */   addiu    $v1, $zero, 0x6
/* 41DA5C 802A8CCC 8282004B */  lb        $v0, 0x4B($s4)
D_802A8CD0_7B0670:
/* 41DA60 802A8CD0 A2830178 */  sb        $v1, 0x178($s4)
/* 41DA64 802A8CD4 00021080 */  sll       $v0, $v0, 2
/* 41DA68 802A8CD8 3C01802B */  lui       $at, %hi(D_802AD4B2)
/* 41DA6C 802A8CDC 00220821 */  addu      $at, $at, $v0
/* 41DA70 802A8CE0 9422D4B2 */  lhu       $v0, %lo(D_802AD4B2)($at)
/* 41DA74 802A8CE4 A682017C */  sh        $v0, 0x17C($s4)
/* 41DA78 802A8CE8 00021400 */  sll       $v0, $v0, 16
/* 41DA7C 802A8CEC 00021403 */  sra       $v0, $v0, 16
D_802A8CF0_7B0690:
/* 41DA80 802A8CF0 00021880 */  sll       $v1, $v0, 2
/* 41DA84 802A8CF4 00621821 */  addu      $v1, $v1, $v0
/* 41DA88 802A8CF8 00031880 */  sll       $v1, $v1, 2
/* 41DA8C 802A8CFC 3C018009 */  lui       $at, %hi(D_8008F064)
/* 41DA90 802A8D00 00230821 */  addu      $at, $at, $v1
/* 41DA94 802A8D04 8C23F064 */  lw        $v1, %lo(D_8008F064)($at)
/* 41DA98 802A8D08 3C02802B */  lui       $v0, %hi(D_802AD603)
/* 41DA9C 802A8D0C 9042D603 */  lbu       $v0, %lo(D_802AD603)($v0)
/* 41DAA0 802A8D10 24040011 */  addiu     $a0, $zero, 0x11
/* 41DAA4 802A8D14 A282005D */  sb        $v0, 0x5D($s4)
/* 41DAA8 802A8D18 2402000E */  addiu     $v0, $zero, 0xE
/* 41DAAC 802A8D1C A682006C */  sh        $v0, 0x6C($s4)
/* 41DAB0 802A8D20 2402000F */  addiu     $v0, $zero, 0xF
/* 41DAB4 802A8D24 A682006E */  sh        $v0, 0x6E($s4)
.L802A8D28_7B06C8:
/* 41DAB8 802A8D28 0C090464 */  jal       func_80241190
/* 41DABC 802A8D2C AE830184 */   sw       $v1, 0x184($s4)
D_802A8D30_7B06D0:
/* 41DAC0 802A8D30 080AA6AB */  j         .L802A9AAC_7B144C
/* 41DAC4 802A8D34 00000000 */   nop
glabel .L802A8D38_7B06D8
/* 41DAC8 802A8D38 0C0A8B21 */  jal       func_802A2C84_7AA624
/* 41DACC 802A8D3C 00000000 */   nop
/* 41DAD0 802A8D40 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41DAD4 802A8D44 00000000 */   nop
/* 41DAD8 802A8D48 10400358 */  beqz      $v0, .L802A9AAC_7B144C
/* 41DADC 802A8D4C 2402000B */   addiu    $v0, $zero, 0xB
D_802A8D50_7B06F0:
/* 41DAE0 802A8D50 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41DAE4 802A8D54 00000000 */   nop
glabel .L802A8D58_7B06F8
/* 41DAE8 802A8D58 0C0A8AAE */  jal       func_802A2AB8_7AA458
/* 41DAEC 802A8D5C 00000000 */   nop
/* 41DAF0 802A8D60 0C0A8426 */  jal       func_802A1098_7A8A38
/* 41DAF4 802A8D64 00000000 */   nop
/* 41DAF8 802A8D68 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41DAFC 802A8D6C 2402000D */   addiu    $v0, $zero, 0xD
glabel .L802A8D70_7B0710
/* 41DB00 802A8D70 0C0A8B21 */  jal       func_802A2C84_7AA624
/* 41DB04 802A8D74 00000000 */   nop
/* 41DB08 802A8D78 2403FFFF */  addiu     $v1, $zero, -0x1
/* 41DB0C 802A8D7C 1043034B */  beq       $v0, $v1, .L802A9AAC_7B144C
/* 41DB10 802A8D80 2402000B */   addiu    $v0, $zero, 0xB
/* 41DB14 802A8D84 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41DB18 802A8D88 00000000 */   nop
/* 41DB1C 802A8D8C 0000802D */  daddu     $s0, $zero, $zero
D_802A8D90_7B0730:
/* 41DB20 802A8D90 0200882D */  daddu     $s1, $s0, $zero
/* 41DB24 802A8D94 3C098008 */  lui       $t1, %hi(gItemTable)
/* 41DB28 802A8D98 252978E0 */  addiu     $t1, $t1, %lo(gItemTable)
/* 41DB2C 802A8D9C 3C088009 */  lui       $t0, %hi(gItemHudScripts)
/* 41DB30 802A8DA0 2508A680 */  addiu     $t0, $t0, %lo(gItemHudScripts)
/* 41DB34 802A8DA4 24070001 */  addiu     $a3, $zero, 0x1
/* 41DB38 802A8DA8 02E0302D */  daddu     $a2, $s7, $zero
/* 41DB3C 802A8DAC 0240282D */  daddu     $a1, $s2, $zero
D_802A8DB0_7B0750:
/* 41DB40 802A8DB0 84C201B4 */  lh        $v0, 0x1B4($a2)
/* 41DB44 802A8DB4 50400015 */  beql      $v0, $zero, .L802A8E0C_7B07AC
/* 41DB48 802A8DB8 26310001 */   addiu    $s1, $s1, 0x1
/* 41DB4C 802A8DBC 00021140 */  sll       $v0, $v0, 5
/* 41DB50 802A8DC0 00492021 */  addu      $a0, $v0, $t1
/* 41DB54 802A8DC4 84820004 */  lh        $v0, 0x4($a0)
/* 41DB58 802A8DC8 94830018 */  lhu       $v1, 0x18($a0)
/* 41DB5C 802A8DCC 000210C0 */  sll       $v0, $v0, 3
/* 41DB60 802A8DD0 30630002 */  andi      $v1, $v1, 0x2
/* 41DB64 802A8DD4 1060000C */  beqz      $v1, .L802A8E08_7B07A8
/* 41DB68 802A8DD8 00481021 */   addu     $v0, $v0, $t0
/* 41DB6C 802A8DDC 8C420000 */  lw        $v0, 0x0($v0)
/* 41DB70 802A8DE0 ACA20000 */  sw        $v0, 0x0($a1)
/* 41DB74 802A8DE4 84C201B4 */  lh        $v0, 0x1B4($a2)
/* 41DB78 802A8DE8 ACA7018C */  sw        $a3, 0x18C($a1)
/* 41DB7C 802A8DEC ACA20108 */  sw        $v0, 0x108($a1)
D_802A8DF0_7B0790:
/* 41DB80 802A8DF0 8C820000 */  lw        $v0, 0x0($a0)
/* 41DB84 802A8DF4 ACA20084 */  sw        $v0, 0x84($a1)
/* 41DB88 802A8DF8 8C820014 */  lw        $v0, 0x14($a0)
/* 41DB8C 802A8DFC 26100001 */  addiu     $s0, $s0, 0x1
/* 41DB90 802A8E00 ACA20294 */  sw        $v0, 0x294($a1)
/* 41DB94 802A8E04 24A50004 */  addiu     $a1, $a1, 0x4
.L802A8E08_7B07A8:
/* 41DB98 802A8E08 26310001 */  addiu     $s1, $s1, 0x1
.L802A8E0C_7B07AC:
/* 41DB9C 802A8E0C 2A22000A */  slti      $v0, $s1, 0xA
D_802A8E10_7B07B0:
/* 41DBA0 802A8E10 1440FFE7 */  bnez      $v0, D_802A8DB0_7B0750
/* 41DBA4 802A8E14 24C60002 */   addiu    $a2, $a2, 0x2
/* 41DBA8 802A8E18 82820060 */  lb        $v0, 0x60($s4)
/* 41DBAC 802A8E1C 04420001 */  bltzl     $v0, .L802A8E24_7B07C4
/* 41DBB0 802A8E20 A2800060 */   sb       $zero, 0x60($s4)
.L802A8E24_7B07C4:
/* 41DBB4 802A8E24 82910060 */  lb        $s1, 0x60($s4)
/* 41DBB8 802A8E28 0240202D */  daddu     $a0, $s2, $zero
/* 41DBBC 802A8E2C AC800318 */  sw        $zero, 0x318($a0)
/* 41DBC0 802A8E30 AC900324 */  sw        $s0, 0x324($a0)
/* 41DBC4 802A8E34 AC80031C */  sw        $zero, 0x31C($a0)
/* 41DBC8 802A8E38 AC800320 */  sw        $zero, 0x320($a0)
/* 41DBCC 802A8E3C 0C03D44F */  jal       create_battle_popup_menu
/* 41DBD0 802A8E40 AC910328 */   sw       $s1, 0x328($a0)
/* 41DBD4 802A8E44 0C03D4AF */  jal       func_800F52BC
/* 41DBD8 802A8E48 00000000 */   nop
/* 41DBDC 802A8E4C 080AA6A9 */  j         .L802A9AA4_7B1444
D_802A8E50_7B07F0:
/* 41DBE0 802A8E50 24020029 */   addiu    $v0, $zero, 0x29
/* 41DBE4 802A8E54 8643032C */  lh        $v1, 0x32C($s2)
/* 41DBE8 802A8E58 10600314 */  beqz      $v1, .L802A9AAC_7B144C
/* 41DBEC 802A8E5C 240200FF */   addiu    $v0, $zero, 0xFF
/* 41DBF0 802A8E60 5462000B */  bnel      $v1, $v0, .L802A8E90_7B0830
/* 41DBF4 802A8E64 2402002C */   addiu    $v0, $zero, 0x2C
/* 41DBF8 802A8E68 0C0A8414 */  jal       func_802A1050_7A89F0
/* 41DBFC 802A8E6C 00000000 */   nop
D_802A8E70_7B0810:
/* 41DC00 802A8E70 24020008 */  addiu     $v0, $zero, 0x8
/* 41DC04 802A8E74 3C01802B */  lui       $at, %hi(D_802ACC60)
/* 41DC08 802A8E78 AC22CC60 */  sw        $v0, %lo(D_802ACC60)($at)
/* 41DC0C 802A8E7C 24020004 */  addiu     $v0, $zero, 0x4
/* 41DC10 802A8E80 3C01802B */  lui       $at, %hi(D_802ACC6C)
/* 41DC14 802A8E84 AC22CC6C */  sw        $v0, %lo(D_802ACC6C)($at)
/* 41DC18 802A8E88 080AA641 */  j         .L802A9904_7B12A4
/* 41DC1C 802A8E8C 24020002 */   addiu    $v0, $zero, 0x2
.L802A8E90_7B0830:
/* 41DC20 802A8E90 A682006C */  sh        $v0, 0x6C($s4)
/* 41DC24 802A8E94 8642032C */  lh        $v0, 0x32C($s2)
/* 41DC28 802A8E98 2403002D */  addiu     $v1, $zero, 0x2D
/* 41DC2C 802A8E9C A683006E */  sh        $v1, 0x6E($s4)
/* 41DC30 802A8EA0 2442FFFF */  addiu     $v0, $v0, -0x1
/* 41DC34 802A8EA4 00021080 */  sll       $v0, $v0, 2
/* 41DC38 802A8EA8 02421021 */  addu      $v0, $s2, $v0
/* 41DC3C 802A8EAC 9442010A */  lhu       $v0, 0x10A($v0)
D_802A8EB0_7B0850:
/* 41DC40 802A8EB0 24030002 */  addiu     $v1, $zero, 0x2
/* 41DC44 802A8EB4 A2830178 */  sb        $v1, 0x178($s4)
/* 41DC48 802A8EB8 A68201AA */  sh        $v0, 0x1AA($s4)
/* 41DC4C 802A8EBC A682017A */  sh        $v0, 0x17A($s4)
/* 41DC50 802A8EC0 00021400 */  sll       $v0, $v0, 16
/* 41DC54 802A8EC4 000212C3 */  sra       $v0, $v0, 11
/* 41DC58 802A8EC8 3C038008 */  lui       $v1, %hi(gItemTable + 0x8)
/* 41DC5C 802A8ECC 00621821 */  addu      $v1, $v1, $v0
D_802A8ED0_7B0870:
/* 41DC60 802A8ED0 8C6378E8 */  lw        $v1, %lo(gItemTable + 0x8)($v1)
/* 41DC64 802A8ED4 9242032D */  lbu       $v0, 0x32D($s2)
/* 41DC68 802A8ED8 AE800188 */  sw        $zero, 0x188($s4)
/* 41DC6C 802A8EDC 2442FFFF */  addiu     $v0, $v0, -0x1
/* 41DC70 802A8EE0 34638000 */  ori       $v1, $v1, 0x8000
/* 41DC74 802A8EE4 A2820060 */  sb        $v0, 0x60($s4)
/* 41DC78 802A8EE8 0C03C4EC */  jal       hide_popup_menu
/* 41DC7C 802A8EEC AE830184 */   sw       $v1, 0x184($s4)
/* 41DC80 802A8EF0 0C0A840C */  jal       func_802A1030_7A89D0
/* 41DC84 802A8EF4 00000000 */   nop
/* 41DC88 802A8EF8 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41DC8C 802A8EFC 2402002A */   addiu    $v0, $zero, 0x2A
/* 41DC90 802A8F00 8E820214 */  lw        $v0, 0x214($s4)
/* 41DC94 802A8F04 30424000 */  andi      $v0, $v0, 0x4000
/* 41DC98 802A8F08 1040000A */  beqz      $v0, .L802A8F34_7B08D4
/* 41DC9C 802A8F0C 00000000 */   nop
D_802A8F10_7B08B0:
/* 41DCA0 802A8F10 8642032C */  lh        $v0, 0x32C($s2)
/* 41DCA4 802A8F14 14400007 */  bnez      $v0, .L802A8F34_7B08D4
/* 41DCA8 802A8F18 00000000 */   nop
/* 41DCAC 802A8F1C 0C03C5B3 */  jal       func_800F16CC
/* 41DCB0 802A8F20 00000000 */   nop
/* 41DCB4 802A8F24 0C0A8426 */  jal       func_802A1098_7A8A38
/* 41DCB8 802A8F28 00000000 */   nop
/* 41DCBC 802A8F2C 080AA6A9 */  j         .L802A9AA4_7B1444
D_802A8F30_7B08D0:
/* 41DCC0 802A8F30 2402002B */   addiu    $v0, $zero, 0x2B
.L802A8F34_7B08D4:
/* 41DCC4 802A8F34 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41DCC8 802A8F38 00000000 */   nop
/* 41DCCC 802A8F3C 104002DB */  beqz      $v0, .L802A9AAC_7B144C
/* 41DCD0 802A8F40 00000000 */   nop
/* 41DCD4 802A8F44 0C090464 */  jal       func_80241190
/* 41DCD8 802A8F48 24040011 */   addiu    $a0, $zero, 0x11
/* 41DCDC 802A8F4C 080AA6AB */  j         .L802A9AAC_7B144C
/* 41DCE0 802A8F50 00000000 */   nop
/* 41DCE4 802A8F54 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41DCE8 802A8F58 00000000 */   nop
/* 41DCEC 802A8F5C 104002D3 */  beqz      $v0, .L802A9AAC_7B144C
/* 41DCF0 802A8F60 24020029 */   addiu    $v0, $zero, 0x29
/* 41DCF4 802A8F64 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41DCF8 802A8F68 00000000 */   nop
/* 41DCFC 802A8F6C 0C03C5B3 */  jal       func_800F16CC
D_802A8F70_7B0910:
/* 41DD00 802A8F70 00000000 */   nop
/* 41DD04 802A8F74 0C0A8426 */  jal       func_802A1098_7A8A38
/* 41DD08 802A8F78 00000000 */   nop
/* 41DD0C 802A8F7C 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41DD10 802A8F80 2402002B */   addiu    $v0, $zero, 0x2B
/* 41DD14 802A8F84 0000802D */  daddu     $s0, $zero, $zero
/* 41DD18 802A8F88 24110001 */  addiu     $s1, $zero, 0x1
/* 41DD1C 802A8F8C 3C0C8009 */  lui       $t4, %hi(gPartnerPopupProperties)
D_802A8F90_7B0930:
/* 41DD20 802A8F90 258CEF20 */  addiu     $t4, $t4, %lo(gPartnerPopupProperties)
/* 41DD24 802A8F94 3C0B802B */  lui       $t3, %hi(D_802AB3F8_7B2D98)
/* 41DD28 802A8F98 256BB3F8 */  addiu     $t3, $t3, %lo(D_802AB3F8_7B2D98)
/* 41DD2C 802A8F9C 0220502D */  daddu     $t2, $s1, $zero
/* 41DD30 802A8FA0 3C09802B */  lui       $t1, %hi(D_802AB438_7B2DD8)
/* 41DD34 802A8FA4 2529B438 */  addiu     $t1, $t1, %lo(D_802AB438_7B2DD8)
/* 41DD38 802A8FA8 3C088009 */  lui       $t0, %hi(D_8008EEC4)
/* 41DD3C 802A8FAC 2508EEC4 */  addiu     $t0, $t0, %lo(D_8008EEC4)
/* 41DD40 802A8FB0 0240202D */  daddu     $a0, $s2, $zero
.L802A8FB4_7B0954:
/* 41DD44 802A8FB4 8D050000 */  lw        $a1, 0x0($t0)
/* 41DD48 802A8FB8 000510C0 */  sll       $v0, $a1, 3
/* 41DD4C 802A8FBC 02E23021 */  addu      $a2, $s7, $v0
/* 41DD50 802A8FC0 90C20014 */  lbu       $v0, 0x14($a2)
/* 41DD54 802A8FC4 50400019 */  beql      $v0, $zero, .L802A902C_7B09CC
/* 41DD58 802A8FC8 26310001 */   addiu    $s1, $s1, 0x1
/* 41DD5C 802A8FCC 00051900 */  sll       $v1, $a1, 4
D_802A8FD0_7B0970:
/* 41DD60 802A8FD0 00053880 */  sll       $a3, $a1, 2
/* 41DD64 802A8FD4 00EB1021 */  addu      $v0, $a3, $t3
/* 41DD68 802A8FD8 8C420000 */  lw        $v0, 0x0($v0)
/* 41DD6C 802A8FDC 006C1821 */  addu      $v1, $v1, $t4
/* 41DD70 802A8FE0 AC850108 */  sw        $a1, 0x108($a0)
/* 41DD74 802A8FE4 AC8A018C */  sw        $t2, 0x18C($a0)
/* 41DD78 802A8FE8 AC820000 */  sw        $v0, 0x0($a0)
/* 41DD7C 802A8FEC 8C620000 */  lw        $v0, 0x0($v1)
D_802A8FF0_7B0990:
/* 41DD80 802A8FF0 AC820084 */  sw        $v0, 0x84($a0)
/* 41DD84 802A8FF4 8C62000C */  lw        $v0, 0xC($v1)
/* 41DD88 802A8FF8 AC820294 */  sw        $v0, 0x294($a0)
/* 41DD8C 802A8FFC 80C20015 */  lb        $v0, 0x15($a2)
glabel func_802A9000_7B09A0
/* 41DD90 802A9000 AC820210 */  sw        $v0, 0x210($a0)
/* 41DD94 802A9004 82E20012 */  lb        $v0, 0x12($s7)
/* 41DD98 802A9008 54450006 */  bnel      $v0, $a1, .L802A9024_7B09C4
/* 41DD9C 802A900C 24840004 */   addiu    $a0, $a0, 0x4
/* 41DDA0 802A9010 00E91021 */  addu      $v0, $a3, $t1
/* 41DDA4 802A9014 AC80018C */  sw        $zero, 0x18C($a0)
/* 41DDA8 802A9018 8C420000 */  lw        $v0, 0x0($v0)
/* 41DDAC 802A901C AC820000 */  sw        $v0, 0x0($a0)
/* 41DDB0 802A9020 24840004 */  addiu     $a0, $a0, 0x4
.L802A9024_7B09C4:
/* 41DDB4 802A9024 26100001 */  addiu     $s0, $s0, 0x1
/* 41DDB8 802A9028 26310001 */  addiu     $s1, $s1, 0x1
.L802A902C_7B09CC:
/* 41DDBC 802A902C 2A22000C */  slti      $v0, $s1, 0xC
D_802A9030_7B09D0:
/* 41DDC0 802A9030 1440FFE0 */  bnez      $v0, .L802A8FB4_7B0954
/* 41DDC4 802A9034 25080004 */   addiu    $t0, $t0, 0x4
/* 41DDC8 802A9038 82820061 */  lb        $v0, 0x61($s4)
/* 41DDCC 802A903C 04420001 */  bltzl     $v0, .L802A9044_7B09E4
/* 41DDD0 802A9040 A2800061 */   sb       $zero, 0x61($s4)
.L802A9044_7B09E4:
/* 41DDD4 802A9044 82E30012 */  lb        $v1, 0x12($s7)
/* 41DDD8 802A9048 24020001 */  addiu     $v0, $zero, 0x1
/* 41DDDC 802A904C AE420318 */  sw        $v0, 0x318($s2)
D_802A9050_7B09F0:
/* 41DDE0 802A9050 AE500324 */  sw        $s0, 0x324($s2)
/* 41DDE4 802A9054 00031880 */  sll       $v1, $v1, 2
.L802A9058_7B09F8:
/* 41DDE8 802A9058 3C028009 */  lui       $v0, %hi(D_8008EEF0)
.L802A905C_7B09FC:
/* 41DDEC 802A905C 00431021 */  addu      $v0, $v0, $v1
/* 41DDF0 802A9060 8C42EEF0 */  lw        $v0, %lo(D_8008EEF0)($v0)
/* 41DDF4 802A9064 0240202D */  daddu     $a0, $s2, $zero
/* 41DDF8 802A9068 AC80031C */  sw        $zero, 0x31C($a0)
/* 41DDFC 802A906C AC800320 */  sw        $zero, 0x320($a0)
D_802A9070_7B0A10:
/* 41DE00 802A9070 2442FFFF */  addiu     $v0, $v0, -0x1
/* 41DE04 802A9074 0C03D44F */  jal       create_battle_popup_menu
/* 41DE08 802A9078 AC820328 */   sw       $v0, 0x328($a0)
/* 41DE0C 802A907C 0C03D4AF */  jal       func_800F52BC
/* 41DE10 802A9080 00000000 */   nop
/* 41DE14 802A9084 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41DE18 802A9088 24020033 */   addiu    $v0, $zero, 0x33
/* 41DE1C 802A908C 8643032C */  lh        $v1, 0x32C($s2)
D_802A9090_7B0A30:
/* 41DE20 802A9090 2402FFFF */  addiu     $v0, $zero, -0x1
/* 41DE24 802A9094 10620283 */  beq       $v1, $v0, .L802A9AA4_7B1444
/* 41DE28 802A9098 24020038 */   addiu    $v0, $zero, 0x38
.L802A909C_7B0A3C:
/* 41DE2C 802A909C 10600283 */  beqz      $v1, .L802A9AAC_7B144C
/* 41DE30 802A90A0 240200FF */   addiu    $v0, $zero, 0xFF
.L802A90A4_7B0A44:
/* 41DE34 802A90A4 5462000B */  bnel      $v1, $v0, .L802A90D4_7B0A74
/* 41DE38 802A90A8 24020036 */   addiu    $v0, $zero, 0x36
/* 41DE3C 802A90AC 0C0A8414 */  jal       func_802A1050_7A89F0
D_802A90B0_7B0A50:
/* 41DE40 802A90B0 00000000 */   nop
/* 41DE44 802A90B4 24020008 */  addiu     $v0, $zero, 0x8
/* 41DE48 802A90B8 3C01802B */  lui       $at, %hi(D_802ACC60)
/* 41DE4C 802A90BC AC22CC60 */  sw        $v0, %lo(D_802ACC60)($at)
/* 41DE50 802A90C0 24020004 */  addiu     $v0, $zero, 0x4
/* 41DE54 802A90C4 3C01802B */  lui       $at, %hi(D_802ACC6C)
.L802A90C8_7B0A68:
/* 41DE58 802A90C8 AC22CC6C */  sw        $v0, %lo(D_802ACC6C)($at)
/* 41DE5C 802A90CC 080AA641 */  j         .L802A9904_7B12A4
D_802A90D0_7B0A70:
/* 41DE60 802A90D0 24020002 */   addiu    $v0, $zero, 0x2
.L802A90D4_7B0A74:
/* 41DE64 802A90D4 A682006C */  sh        $v0, 0x6C($s4)
/* 41DE68 802A90D8 8642032C */  lh        $v0, 0x32C($s2)
/* 41DE6C 802A90DC 24030037 */  addiu     $v1, $zero, 0x37
/* 41DE70 802A90E0 A683006E */  sh        $v1, 0x6E($s4)
/* 41DE74 802A90E4 2442FFFF */  addiu     $v0, $v0, -0x1
/* 41DE78 802A90E8 00021080 */  sll       $v0, $v0, 2
/* 41DE7C 802A90EC 02421021 */  addu      $v0, $s2, $v0
D_802A90F0_7B0A90:
/* 41DE80 802A90F0 9044010B */  lbu       $a0, 0x10B($v0)
/* 41DE84 802A90F4 24020005 */  addiu     $v0, $zero, 0x5
.L802A90F8_7B0A98:
/* 41DE88 802A90F8 A2820178 */  sb        $v0, 0x178($s4)
.L802A90FC_7B0A9C:
/* 41DE8C 802A90FC 24020002 */  addiu     $v0, $zero, 0x2
.L802A9100_7B0AA0:
/* 41DE90 802A9100 A683017C */  sh        $v1, 0x17C($s4)
.L802A9104_7B0AA4:
/* 41DE94 802A9104 AE820184 */  sw        $v0, 0x184($s4)
.L802A9108_7B0AA8:
/* 41DE98 802A9108 A28401AC */  sb        $a0, 0x1AC($s4)
.L802A910C_7B0AAC:
/* 41DE9C 802A910C 0080182D */  daddu     $v1, $a0, $zero
D_802A9110_7B0AB0:
/* 41DEA0 802A9110 00031E00 */  sll       $v1, $v1, 24
/* 41DEA4 802A9114 9242032D */  lbu       $v0, 0x32D($s2)
.L802A9118_7B0AB8:
/* 41DEA8 802A9118 00031E03 */  sra       $v1, $v1, 24
glabel func_802A911C_7B0ABC
/* 41DEAC 802A911C A683017A */  sh        $v1, 0x17A($s4)
glabel func_802A9120_7B0AC0
/* 41DEB0 802A9120 2442FFFF */  addiu     $v0, $v0, -0x1
/* 41DEB4 802A9124 0C03C4EC */  jal       hide_popup_menu
/* 41DEB8 802A9128 A2820061 */   sb       $v0, 0x61($s4)
/* 41DEBC 802A912C 0C0A840C */  jal       func_802A1030_7A89D0
D_802A9130_7B0AD0:
/* 41DEC0 802A9130 00000000 */   nop
/* 41DEC4 802A9134 080AA6A9 */  j         .L802A9AA4_7B1444
glabel func_802A9138_7B0AD8
/* 41DEC8 802A9138 24020034 */   addiu    $v0, $zero, 0x34
/* 41DECC 802A913C 8E820214 */  lw        $v0, 0x214($s4)
/* 41DED0 802A9140 30424000 */  andi      $v0, $v0, 0x4000
/* 41DED4 802A9144 10400224 */  beqz      $v0, .L802A99D8_7B1378
/* 41DED8 802A9148 00000000 */   nop
/* 41DEDC 802A914C 8642032C */  lh        $v0, 0x32C($s2)
D_802A9150_7B0AF0:
/* 41DEE0 802A9150 14400221 */  bnez      $v0, .L802A99D8_7B1378
.L802A9154_7B0AF4:
/* 41DEE4 802A9154 00000000 */   nop
.L802A9158_7B0AF8:
/* 41DEE8 802A9158 0C03C5B3 */  jal       func_800F16CC
.L802A915C_7B0AFC:
/* 41DEEC 802A915C 00000000 */   nop
.L802A9160_7B0B00:
/* 41DEF0 802A9160 0C0A8426 */  jal       func_802A1098_7A8A38
.L802A9164_7B0B04:
/* 41DEF4 802A9164 00000000 */   nop
.L802A9168_7B0B08:
/* 41DEF8 802A9168 080AA6A9 */  j         .L802A9AA4_7B1444
glabel func_802A916C_7B0B0C
/* 41DEFC 802A916C 24020035 */   addiu    $v0, $zero, 0x35
D_802A9170_7B0B10:
/* 41DF00 802A9170 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41DF04 802A9174 00000000 */   nop
glabel func_802A9178_7B0B18
/* 41DF08 802A9178 1040024C */  beqz      $v0, .L802A9AAC_7B144C
glabel func_802A917C_7B0B1C
/* 41DF0C 802A917C 24020033 */   addiu    $v0, $zero, 0x33
/* 41DF10 802A9180 080AA6A9 */  j         .L802A9AA4_7B1444
glabel func_802A9184_7B0B24
/* 41DF14 802A9184 00000000 */   nop
.L802A9188_7B0B28:
/* 41DF18 802A9188 0C03C5B3 */  jal       func_800F16CC
.L802A918C_7B0B2C:
/* 41DF1C 802A918C 00000000 */   nop
D_802A9190_7B0B30:
/* 41DF20 802A9190 0C0A8426 */  jal       func_802A1098_7A8A38
.L802A9194_7B0B34:
/* 41DF24 802A9194 00000000 */   nop
/* 41DF28 802A9198 080AA6A9 */  j         .L802A9AA4_7B1444
.L802A919C_7B0B3C:
/* 41DF2C 802A919C 24020035 */   addiu    $v0, $zero, 0x35
glabel func_802A91A0_7B0B40
/* 41DF30 802A91A0 0C03C54E */  jal       destroy_popup_menu
.L802A91A4_7B0B44:
/* 41DF34 802A91A4 00000000 */   nop
glabel .L802A91A8_7B0B48
/* 41DF38 802A91A8 0C0A842E */  jal       func_802A10B8_7A8A58
/* 41DF3C 802A91AC 00000000 */   nop
D_802A91B0_7B0B50:
/* 41DF40 802A91B0 080AA6AB */  j         .L802A9AAC_7B144C
/* 41DF44 802A91B4 00000000 */   nop
glabel func_802A91B8_7B0B58
/* 41DF48 802A91B8 8643032C */  lh        $v1, 0x32C($s2)
.L802A91BC_7B0B5C:
/* 41DF4C 802A91BC 2402FFFF */  addiu     $v0, $zero, -0x1
/* 41DF50 802A91C0 1062023A */  beq       $v1, $v0, .L802A9AAC_7B144C
/* 41DF54 802A91C4 24020033 */   addiu    $v0, $zero, 0x33
/* 41DF58 802A91C8 080AA6A9 */  j         .L802A9AA4_7B1444
/* 41DF5C 802A91CC 00000000 */   nop
D_802A91D0_7B0B70:
/* 41DF60 802A91D0 24100001 */  addiu     $s0, $zero, 0x1
.L802A91D4_7B0B74:
/* 41DF64 802A91D4 0000882D */  daddu     $s1, $zero, $zero
/* 41DF68 802A91D8 24020077 */  addiu     $v0, $zero, 0x77
.L802A91DC_7B0B7C:
/* 41DF6C 802A91DC A28201DE */  sb        $v0, 0x1DE($s4)
glabel func_802A91E0_7B0B80
/* 41DF70 802A91E0 24020155 */  addiu     $v0, $zero, 0x155
.L802A91E4_7B0B84:
/* 41DF74 802A91E4 A290020E */  sb        $s0, 0x20E($s4)
/* 41DF78 802A91E8 320300FF */  andi      $v1, $s0, 0xFF
.L802A91EC_7B0B8C:
/* 41DF7C 802A91EC A68201AE */  sh        $v0, 0x1AE($s4)
D_802A91F0_7B0B90:
/* 41DF80 802A91F0 0200102D */  daddu     $v0, $s0, $zero
/* 41DF84 802A91F4 10600049 */  beqz      $v1, .L802A931C_7B0CBC
glabel func_802A91F8
/* 41DF88 802A91F8 A28201F6 */   sb       $v0, 0x1F6($s4)
.L802A91FC_7B0B9C:
/* 41DF8C 802A91FC 3C128009 */  lui       $s2, %hi(gMoveTable)
/* 41DF90 802A9200 2652F060 */  addiu     $s2, $s2, %lo(gMoveTable)
.L802A9204_7B0BA4:
/* 41DF94 802A9204 3C0F802B */  lui       $t7, %hi(D_802AB398_7B2D38)
glabel func_802A9208
/* 41DF98 802A9208 25EFB398 */  addiu     $t7, $t7, %lo(D_802AB398_7B2D38)
.L802A920C_7B0BAC:
/* 41DF9C 802A920C 3C10802B */  lui       $s0, %hi(BattleMenu_Moves_OptionSortPriority)
D_802A9210_7B0BB0:
/* 41DFA0 802A9210 2610D5D0 */  addiu     $s0, $s0, %lo(BattleMenu_Moves_OptionSortPriority)
/* 41DFA4 802A9214 3C0E802B */  lui       $t6, %hi(battle_menu_moveOptionDisplayCostReductionColors)
/* 41DFA8 802A9218 25CED3E0 */  addiu     $t6, $t6, %lo(battle_menu_moveOptionDisplayCostReductionColors)
/* 41DFAC 802A921C 3C0D802B */  lui       $t5, %hi(battle_menu_moveOptionDisplayCostReductions)
/* 41DFB0 802A9220 25ADD380 */  addiu     $t5, $t5, %lo(battle_menu_moveOptionDisplayCostReductions)
/* 41DFB4 802A9224 3C0C802B */  lui       $t4, %hi(BattleMenu_Moves_OptionDescMessages)
glabel func_802A9228
/* 41DFB8 802A9228 258CD570 */  addiu     $t4, $t4, %lo(BattleMenu_Moves_OptionDescMessages)
.L802A922C_7B0BCC:
/* 41DFBC 802A922C 3C0B802B */  lui       $t3, %hi(battle_menu_moveOptionNames)
D_802A9230_7B0BD0:
/* 41DFC0 802A9230 256BD2C0 */  addiu     $t3, $t3, %lo(battle_menu_moveOptionNames)
glabel func_802A9234
/* 41DFC4 802A9234 3C0A802B */  lui       $t2, %hi(BattleMenu_Moves_OptionEnabled)
.L802A9238_7B0BD8:
/* 41DFC8 802A9238 254AD510 */  addiu     $t2, $t2, %lo(BattleMenu_Moves_OptionEnabled)
glabel .L802A923C_7B0BDC
/* 41DFCC 802A923C 3C09802B */  lui       $t1, %hi(BattleMenu_Moves_OptionIndices)
/* 41DFD0 802A9240 2529D4B0 */  addiu     $t1, $t1, %lo(BattleMenu_Moves_OptionIndices)
.L802A9244_7B0BE4:
/* 41DFD4 802A9244 3C08802B */  lui       $t0, %hi(battle_menu_moveOptionBPCosts)
/* 41DFD8 802A9248 2508D440 */  addiu     $t0, $t0, %lo(battle_menu_moveOptionBPCosts)
/* 41DFDC 802A924C 3C06802B */  lui       $a2, %hi(battle_menu_moveOptionDisplayCosts)
D_802A9250_7B0BF0:
/* 41DFE0 802A9250 24C6D320 */  addiu     $a2, $a2, %lo(battle_menu_moveOptionDisplayCosts)
glabel func_802A9254
/* 41DFE4 802A9254 3C05802B */  lui       $a1, %hi(battle_menu_moveOptionIconScripts)
glabel func_802A9258_7B0BF8
/* 41DFE8 802A9258 24A5D260 */  addiu     $a1, $a1, %lo(battle_menu_moveOptionIconScripts)
.L802A925C_7B0BFC:
/* 41DFEC 802A925C 02912021 */  addu      $a0, $s4, $s1
.L802A9260_7B0C00:
/* 41DFF0 802A9260 908301DE */  lbu       $v1, 0x1DE($a0)
/* 41DFF4 802A9264 2462FF89 */  addiu     $v0, $v1, -0x77
.L802A9268_7B0C08:
/* 41DFF8 802A9268 000210C0 */  sll       $v0, $v0, 3
glabel .L802A926C_7B0C0C
/* 41DFFC 802A926C 004F1021 */  addu      $v0, $v0, $t7
D_802A9270_7B0C10:
/* 41E000 802A9270 8C420000 */  lw        $v0, 0x0($v0)
.L802A9274_7B0C14:
/* 41E004 802A9274 ACA20000 */  sw        $v0, 0x0($a1)
glabel func_802A9278
/* 41E008 802A9278 00031080 */  sll       $v0, $v1, 2
.L802A927C_7B0C1C:
/* 41E00C 802A927C 00431021 */  addu      $v0, $v0, $v1
/* 41E010 802A9280 00021080 */  sll       $v0, $v0, 2
.L802A9284_7B0C24:
/* 41E014 802A9284 808301F6 */  lb        $v1, 0x1F6($a0)
glabel .L802A9288_7B0C28
/* 41E018 802A9288 14600008 */  bnez      $v1, .L802A92AC_7B0C4C
glabel func_802A928C
/* 41E01C 802A928C 00523821 */   addu     $a3, $v0, $s2
D_802A9290_7B0C30:
/* 41E020 802A9290 908201DE */  lbu       $v0, 0x1DE($a0)
glabel func_802A9294
/* 41E024 802A9294 2442FF89 */  addiu     $v0, $v0, -0x77
glabel func_802A9298
/* 41E028 802A9298 000210C0 */  sll       $v0, $v0, 3
glabel .L802A929C_7B0C3C
/* 41E02C 802A929C 34420004 */  ori       $v0, $v0, 0x4
glabel func_802A92A0
/* 41E030 802A92A0 004F1021 */  addu      $v0, $v0, $t7
.L802A92A4_7B0C44:
/* 41E034 802A92A4 8C420000 */  lw        $v0, 0x0($v0)
.L802A92A8_7B0C48:
/* 41E038 802A92A8 ACA20000 */  sw        $v0, 0x0($a1)
.L802A92AC_7B0C4C:
/* 41E03C 802A92AC 80E20011 */  lb        $v0, 0x11($a3)
D_802A92B0_7B0C50:
/* 41E040 802A92B0 24A50004 */  addiu     $a1, $a1, 0x4
/* 41E044 802A92B4 ACC20000 */  sw        $v0, 0x0($a2)
.L802A92B8_7B0C58:
/* 41E048 802A92B8 80E20012 */  lb        $v0, 0x12($a3)
.L802A92BC_7B0C5C:
/* 41E04C 802A92BC 24C60004 */  addiu     $a2, $a2, 0x4
glabel .L802A92C0_7B0C60
/* 41E050 802A92C0 AD020000 */  sw        $v0, 0x0($t0)
.L802A92C4_7B0C64:
/* 41E054 802A92C4 AD310000 */  sw        $s1, 0x0($t1)
.L802A92C8_7B0C68:
/* 41E058 802A92C8 25290004 */  addiu     $t1, $t1, 0x4
/* 41E05C 802A92CC 25080004 */  addiu     $t0, $t0, 0x4
D_802A92D0_7B0C70:
/* 41E060 802A92D0 02301021 */  addu      $v0, $s1, $s0
glabel func_802A92D4
/* 41E064 802A92D4 A0510000 */  sb        $s1, 0x0($v0)
/* 41E068 802A92D8 808201F6 */  lb        $v0, 0x1F6($a0)
glabel func_802A92DC
/* 41E06C 802A92DC 26310001 */  addiu     $s1, $s1, 0x1
glabel .L802A92E0_7B0C80
/* 41E070 802A92E0 AD420000 */  sw        $v0, 0x0($t2)
glabel .L802A92E4_7B0C84
/* 41E074 802A92E4 8CE20000 */  lw        $v0, 0x0($a3)
glabel .L802A92E8_7B0C88
/* 41E078 802A92E8 254A0004 */  addiu     $t2, $t2, 0x4
glabel .L802A92EC_7B0C8C
/* 41E07C 802A92EC AD620000 */  sw        $v0, 0x0($t3)
glabel func_802A92F0
/* 41E080 802A92F0 8CE20008 */  lw        $v0, 0x8($a3)
.L802A92F4_7B0C94:
/* 41E084 802A92F4 256B0004 */  addiu     $t3, $t3, 0x4
glabel .L802A92F8_7B0C98
/* 41E088 802A92F8 AD820000 */  sw        $v0, 0x0($t4)
/* 41E08C 802A92FC ADA00000 */  sw        $zero, 0x0($t5)
.L802A9300_7B0CA0:
/* 41E090 802A9300 ADC00000 */  sw        $zero, 0x0($t6)
.L802A9304_7B0CA4:
/* 41E094 802A9304 25CE0004 */  addiu     $t6, $t6, 0x4
.L802A9308_7B0CA8:
/* 41E098 802A9308 25AD0004 */  addiu     $t5, $t5, 0x4
glabel .L802A930C_7B0CAC
/* 41E09C 802A930C 9282020E */  lbu       $v0, 0x20E($s4)
func_802A9310:
/* 41E0A0 802A9310 0222102A */  slt       $v0, $s1, $v0
.L802A9314_7B0CB4:
/* 41E0A4 802A9314 1440FFD1 */  bnez      $v0, .L802A925C_7B0BFC
.L802A9318_7B0CB8:
/* 41E0A8 802A9318 258C0004 */   addiu    $t4, $t4, 0x4
glabel .L802A931C_7B0CBC
/* 41E0AC 802A931C 82820062 */  lb        $v0, 0x62($s4)
glabel .L802A9320_7B0CC0
/* 41E0B0 802A9320 04420001 */  bltzl     $v0, .L802A9328_7B0CC8
.L802A9324_7B0CC4:
/* 41E0B4 802A9324 A2800062 */   sb       $zero, 0x62($s4)
.L802A9328_7B0CC8:
/* 41E0B8 802A9328 82910062 */  lb        $s1, 0x62($s4)
.L802A932C_7B0CCC:
/* 41E0BC 802A932C 9282020E */  lbu       $v0, 0x20E($s4)
D_802A9330_7B0CD0:
/* 41E0C0 802A9330 24030001 */  addiu     $v1, $zero, 0x1
.L802A9334_7B0CD4:
/* 41E0C4 802A9334 3C01802B */  lui       $at, %hi(BattleMenu_UsingSpiritsSubmenu)
glabel .L802A9338_7B0CD8
/* 41E0C8 802A9338 AC23D4A0 */  sw        $v1, %lo(BattleMenu_UsingSpiritsSubmenu)($at)
glabel .L802A933C_7B0CDC
/* 41E0CC 802A933C 3C01802B */  lui       $at, %hi(BattleMenu_Moves_OptionCount)
glabel .L802A9340_7B0CE0
/* 41E0D0 802A9340 AC22D4A4 */  sw        $v0, %lo(BattleMenu_Moves_OptionCount)($at)
glabel .L802A9344_7B0CE4
/* 41E0D4 802A9344 3C01802B */  lui       $at, %hi(D_802AD4A8)
/* 41E0D8 802A9348 AC31D4A8 */  sw        $s1, %lo(D_802AD4A8)($at)
.L802A934C_7B0CEC:
/* 41E0DC 802A934C 0C0A89A1 */  jal       func_802A2684_7AA024
D_802A9350_7B0CF0:
/* 41E0E0 802A9350 00000000 */   nop
glabel .L802A9354_7B0CF4
/* 41E0E4 802A9354 080AA6A9 */  j         .L802A9AA4_7B1444
glabel .L802A9358_7B0CF8
/* 41E0E8 802A9358 2402003D */   addiu    $v0, $zero, 0x3D
glabel .L802A935C_7B0CFC
/* 41E0EC 802A935C 0C0A8B21 */  jal       func_802A2C84_7AA624
.L802A9360_7B0D00:
/* 41E0F0 802A9360 00000000 */   nop
.L802A9364_7B0D04:
/* 41E0F4 802A9364 0040802D */  daddu     $s0, $v0, $zero
glabel .L802A9368_7B0D08
/* 41E0F8 802A9368 120001D0 */  beqz      $s0, .L802A9AAC_7B144C
glabel func_802A936C
/* 41E0FC 802A936C 240200FF */   addiu    $v0, $zero, 0xFF
D_802A9370_7B0D10:
/* 41E100 802A9370 5602000B */  bnel      $s0, $v0, .L802A93A0_7B0D40
/* 41E104 802A9374 2602FFFF */   addiu    $v0, $s0, -0x1
glabel func_802A9378
/* 41E108 802A9378 0C0A8414 */  jal       func_802A1050_7A89F0
.L802A937C_7B0D1C:
/* 41E10C 802A937C 00000000 */   nop
.L802A9380_7B0D20:
/* 41E110 802A9380 24020008 */  addiu     $v0, $zero, 0x8
.L802A9384_7B0D24:
/* 41E114 802A9384 3C01802B */  lui       $at, %hi(D_802ACC60)
glabel .L802A9388_7B0D28
/* 41E118 802A9388 AC22CC60 */  sw        $v0, %lo(D_802ACC60)($at)
glabel .L802A938C_7B0D2C
/* 41E11C 802A938C 24020004 */  addiu     $v0, $zero, 0x4
D_802A9390_7B0D30:
/* 41E120 802A9390 3C01802B */  lui       $at, %hi(D_802ACC6C)
glabel .L802A9394_7B0D34
/* 41E124 802A9394 AC22CC6C */  sw        $v0, %lo(D_802ACC6C)($at)
glabel func_802A9398_7B0D38
/* 41E128 802A9398 080AA641 */  j         .L802A9904_7B12A4
/* 41E12C 802A939C 24020002 */   addiu    $v0, $zero, 0x2
.L802A93A0_7B0D40:
/* 41E130 802A93A0 00021080 */  sll       $v0, $v0, 2
/* 41E134 802A93A4 3C01802B */  lui       $at, %hi(D_802AD4B3)
.L802A93A8_7B0D48:
/* 41E138 802A93A8 00220821 */  addu      $at, $at, $v0
.L802A93AC_7B0D4C:
/* 41E13C 802A93AC 9022D4B3 */  lbu       $v0, %lo(D_802AD4B3)($at)
D_802A93B0_7B0D50:
/* 41E140 802A93B0 0C0A89F4 */  jal       D_802A27D0_7AA170
glabel .L802A93B4_7B0D54
/* 41E144 802A93B4 A282004B */   sb       $v0, 0x4B($s4)
.L802A93B8_7B0D58:
/* 41E148 802A93B8 0C0A840C */  jal       func_802A1030_7A89D0
glabel .L802A93BC_7B0D5C
/* 41E14C 802A93BC 00000000 */   nop
.L802A93C0_7B0D60:
/* 41E150 802A93C0 080AA6A9 */  j         .L802A9AA4_7B1444
glabel .L802A93C4_7B0D64
/* 41E154 802A93C4 2402003E */   addiu    $v0, $zero, 0x3E
/* 41E158 802A93C8 0C0A8B21 */  jal       func_802A2C84_7AA624
.L802A93CC_7B0D6C:
/* 41E15C 802A93CC 00000000 */   nop
D_802A93D0_7B0D70:
/* 41E160 802A93D0 8E830214 */  lw        $v1, 0x214($s4)
.L802A93D4_7B0D74:
/* 41E164 802A93D4 30634000 */  andi      $v1, $v1, 0x4000
glabel .L802A93D8_7B0D78
/* 41E168 802A93D8 10600009 */  beqz      $v1, .L802A9400_7B0DA0
glabel .L802A93DC_7B0D7C
/* 41E16C 802A93DC 0040802D */   daddu    $s0, $v0, $zero
/* 41E170 802A93E0 16000007 */  bnez      $s0, .L802A9400_7B0DA0
.L802A93E4_7B0D84:
/* 41E174 802A93E4 00000000 */   nop
glabel .L802A93E8_7B0D88
/* 41E178 802A93E8 0C0A8AAE */  jal       func_802A2AB8_7AA458
.L802A93EC_7B0D8C:
/* 41E17C 802A93EC 00000000 */   nop
D_802A93F0_7B0D90:
/* 41E180 802A93F0 0C0A8426 */  jal       func_802A1098_7A8A38
glabel .L802A93F4_7B0D94
/* 41E184 802A93F4 00000000 */   nop
.L802A93F8_7B0D98:
/* 41E188 802A93F8 080AA6A9 */  j         .L802A9AA4_7B1444
glabel .L802A93FC_7B0D9C
/* 41E18C 802A93FC 2402003F */   addiu    $v0, $zero, 0x3F
glabel .L802A9400_7B0DA0
/* 41E190 802A9400 0C0A846C */  jal       func_802A11B0_7A8B50
.L802A9404_7B0DA4:
/* 41E194 802A9404 00000000 */   nop
.L802A9408_7B0DA8:
/* 41E198 802A9408 104001A8 */  beqz      $v0, .L802A9AAC_7B144C
/* 41E19C 802A940C 24020040 */   addiu    $v0, $zero, 0x40
D_802A9410_7B0DB0:
/* 41E1A0 802A9410 A682006C */  sh        $v0, 0x6C($s4)
.L802A9414_7B0DB4:
/* 41E1A4 802A9414 24020041 */  addiu     $v0, $zero, 0x41
glabel .L802A9418_7B0DB8
/* 41E1A8 802A9418 A682006E */  sh        $v0, 0x6E($s4)
glabel .L802A941C_7B0DBC
/* 41E1AC 802A941C 8282004B */  lb        $v0, 0x4B($s4)
.L802A9420_7B0DC0:
/* 41E1B0 802A9420 24030008 */  addiu     $v1, $zero, 0x8
.L802A9424_7B0DC4:
/* 41E1B4 802A9424 A2830178 */  sb        $v1, 0x178($s4)
.L802A9428_7B0DC8:
/* 41E1B8 802A9428 02821021 */  addu      $v0, $s4, $v0
.L802A942C_7B0DCC:
/* 41E1BC 802A942C 904301DE */  lbu       $v1, 0x1DE($v0)
D_802A9430_7B0DD0:
/* 41E1C0 802A9430 8282004B */  lb        $v0, 0x4B($s4)
.L802A9434_7B0DD4:
/* 41E1C4 802A9434 02821021 */  addu      $v0, $s4, $v0
.L802A9438_7B0DD8:
/* 41E1C8 802A9438 A683017C */  sh        $v1, 0x17C($s4)
.L802A943C_7B0DDC:
/* 41E1CC 802A943C 904301DE */  lbu       $v1, 0x1DE($v0)
.L802A9440_7B0DE0:
/* 41E1D0 802A9440 24040011 */  addiu     $a0, $zero, 0x11
/* 41E1D4 802A9444 00031080 */  sll       $v0, $v1, 2
.L802A9448_7B0DE8:
/* 41E1D8 802A9448 00431021 */  addu      $v0, $v0, $v1
glabel .L802A944C_7B0DEC
/* 41E1DC 802A944C 00021080 */  sll       $v0, $v0, 2
D_802A9450_7B0DF0:
/* 41E1E0 802A9450 9283004B */  lbu       $v1, 0x4B($s4)
.L802A9454_7B0DF4:
/* 41E1E4 802A9454 3C058009 */  lui       $a1, %hi(D_8008F064)
.L802A9458_7B0DF8:
/* 41E1E8 802A9458 00A22821 */  addu      $a1, $a1, $v0
.L802A945C_7B0DFC:
/* 41E1EC 802A945C 8CA5F064 */  lw        $a1, %lo(D_8008F064)($a1)
/* 41E1F0 802A9460 3C02802B */  lui       $v0, %hi(D_802AD603)
glabel .L802A9464_7B0E04
/* 41E1F4 802A9464 9042D603 */  lbu       $v0, %lo(D_802AD603)($v0)
.L802A9468_7B0E08:
/* 41E1F8 802A9468 00031E00 */  sll       $v1, $v1, 24
.L802A946C_7B0E0C:
/* 41E1FC 802A946C 00031E03 */  sra       $v1, $v1, 24
D_802A9470_7B0E10:
/* 41E200 802A9470 A683017A */  sh        $v1, 0x17A($s4)
.L802A9474_7B0E14:
/* 41E204 802A9474 A2820062 */  sb        $v0, 0x62($s4)
/* 41E208 802A9478 0C090464 */  jal       func_80241190
.L802A947C_7B0E1C:
/* 41E20C 802A947C AE850184 */   sw       $a1, 0x184($s4)
.L802A9480_7B0E20:
/* 41E210 802A9480 080AA6AB */  j         .L802A9AAC_7B144C
.L802A9484_7B0E24:
/* 41E214 802A9484 00000000 */   nop
.L802A9488_7B0E28:
/* 41E218 802A9488 0C0A8B21 */  jal       func_802A2C84_7AA624
glabel func_802A948C
/* 41E21C 802A948C 00000000 */   nop
D_802A9490_7B0E30:
/* 41E220 802A9490 0C0A846C */  jal       func_802A11B0_7A8B50
.L802A9494_7B0E34:
/* 41E224 802A9494 00000000 */   nop
.L802A9498_7B0E38:
/* 41E228 802A9498 10400184 */  beqz      $v0, .L802A9AAC_7B144C
glabel .L802A949C_7B0E3C
/* 41E22C 802A949C 2402003D */   addiu    $v0, $zero, 0x3D
.L802A94A0_7B0E40:
/* 41E230 802A94A0 080AA6A9 */  j         .L802A9AA4_7B1444
glabel func_802A94A4
/* 41E234 802A94A4 00000000 */   nop
glabel .L802A94A8_7B0E48
/* 41E238 802A94A8 0C0A8AAE */  jal       func_802A2AB8_7AA458
glabel .L802A94AC_7B0E4C
/* 41E23C 802A94AC 00000000 */   nop
D_802A94B0_7B0E50:
/* 41E240 802A94B0 0C0A8426 */  jal       func_802A1098_7A8A38
.L802A94B4_7B0E54:
/* 41E244 802A94B4 00000000 */   nop
.L802A94B8_7B0E58:
/* 41E248 802A94B8 080AA6A9 */  j         .L802A9AA4_7B1444
.L802A94BC_7B0E5C:
/* 41E24C 802A94BC 2402003F */   addiu    $v0, $zero, 0x3F
glabel .L802A94C0_7B0E60
/* 41E250 802A94C0 0C0A89F9 */  jal       func_802A27E4_7AA184
glabel .L802A94C4_7B0E64
/* 41E254 802A94C4 00000000 */   nop
/* 41E258 802A94C8 080AA46A */  j         .L802A91A8_7B0B48
/* 41E25C 802A94CC 00000000 */   nop
D_802A94D0_7B0E70:
/* 41E260 802A94D0 0C098C9A */  jal       func_80263268
.L802A94D4_7B0E74:
/* 41E264 802A94D4 0000802D */   daddu    $s0, $zero, $zero
glabel func_802A94D8
/* 41E268 802A94D8 8282007C */  lb        $v0, 0x7C($s4)
/* 41E26C 802A94DC 04400023 */  bltz      $v0, .L802A956C_7B0F0C
.L802A94E0_7B0E80:
/* 41E270 802A94E0 3C05001D */   lui      $a1, (0x1D00A1 >> 16)
.L802A94E4_7B0E84:
/* 41E274 802A94E4 34A500A1 */  ori       $a1, $a1, (0x1D00A1 & 0xFFFF)
/* 41E278 802A94E8 24020005 */  addiu     $v0, $zero, 0x5
.L802A94EC_7B0E8C:
/* 41E27C 802A94EC 3C04802B */  lui       $a0, %hi(D_802AB4A4_7B2E44)
D_802A94F0_7B0E90:
/* 41E280 802A94F0 8C84B4A4 */  lw        $a0, %lo(D_802AB4A4_7B2E44)($a0)
.L802A94F4_7B0E94:
/* 41E284 802A94F4 82E30012 */  lb        $v1, 0x12($s7)
.L802A94F8_7B0E98:
/* 41E288 802A94F8 3C06802B */  lui       $a2, %hi(D_802AD690)
.L802A94FC_7B0E9C:
/* 41E28C 802A94FC 24C6D690 */  addiu     $a2, $a2, %lo(D_802AD690)
/* 41E290 802A9500 3C01802B */  lui       $at, %hi(D_802AD678)
.L802A9504_7B0EA4:
/* 41E294 802A9504 AC22D678 */  sw        $v0, %lo(D_802AD678)($at)
.L802A9508_7B0EA8:
/* 41E298 802A9508 00031880 */  sll       $v1, $v1, 2
glabel .L802A950C_7B0EAC
/* 41E29C 802A950C 3C01802B */  lui       $at, %hi(D_802AD658)
D_802A9510_7B0EB0:
/* 41E2A0 802A9510 AC24D658 */  sw        $a0, %lo(D_802AD658)($at)
.L802A9514_7B0EB4:
/* 41E2A4 802A9514 3C01802B */  lui       $at, %hi(D_802AB3F8_7B2D98)
.L802A9518_7B0EB8:
/* 41E2A8 802A9518 00230821 */  addu      $at, $at, $v1
.L802A951C_7B0EBC:
/* 41E2AC 802A951C 8C23B3F8 */  lw        $v1, %lo(D_802AB3F8_7B2D98)($at)
.L802A9520_7B0EC0:
/* 41E2B0 802A9520 24020001 */  addiu     $v0, $zero, 0x1
glabel .L802A9524_7B0EC4
/* 41E2B4 802A9524 ACC20000 */  sw        $v0, 0x0($a2)
.L802A9528_7B0EC8:
/* 41E2B8 802A9528 3C01802B */  lui       $at, %hi(D_802AD6C0)
.L802A952C_7B0ECC:
/* 41E2BC 802A952C AC25D6C0 */  sw        $a1, %lo(D_802AD6C0)($at)
D_802A9530_7B0ED0:
/* 41E2C0 802A9530 8282007C */  lb        $v0, 0x7C($s4)
.L802A9534_7B0ED4:
/* 41E2C4 802A9534 3C04802B */  lui       $a0, %hi(D_802AD640)
.L802A9538_7B0ED8:
/* 41E2C8 802A9538 2484D640 */  addiu     $a0, $a0, %lo(D_802AD640)
.L802A953C_7B0EDC:
/* 41E2CC 802A953C 1C40000A */  bgtz      $v0, .L802A9568_7B0F08
.L802A9540_7B0EE0:
/* 41E2D0 802A9540 AC830000 */   sw       $v1, 0x0($a0)
glabel func_802A9544
/* 41E2D4 802A9544 82E20012 */  lb        $v0, 0x12($s7)
.L802A9548_7B0EE8:
/* 41E2D8 802A9548 00021080 */  sll       $v0, $v0, 2
.L802A954C_7B0EEC:
/* 41E2DC 802A954C 3C01802B */  lui       $at, %hi(D_802AB438_7B2DD8)
D_802A9550_7B0EF0:
/* 41E2E0 802A9550 00220821 */  addu      $at, $at, $v0
.L802A9554_7B0EF4:
/* 41E2E4 802A9554 8C22B438 */  lw        $v0, %lo(D_802AB438_7B2DD8)($at)
.L802A9558_7B0EF8:
/* 41E2E8 802A9558 ACC00000 */  sw        $zero, 0x0($a2)
glabel func_802A955C
/* 41E2EC 802A955C 3C01802B */  lui       $at, %hi(D_802AD6A8)
/* 41E2F0 802A9560 AC20D6A8 */  sw        $zero, %lo(D_802AD6A8)($at)
.L802A9564_7B0F04:
/* 41E2F4 802A9564 AC820000 */  sw        $v0, 0x0($a0)
.L802A9568_7B0F08:
/* 41E2F8 802A9568 24100001 */  addiu     $s0, $zero, 0x1
.L802A956C_7B0F0C:
/* 41E2FC 802A956C 3C05001D */  lui       $a1, (0x1D00A2 >> 16)
D_802A9570_7B0F10:
/* 41E300 802A9570 00101880 */  sll       $v1, $s0, 2
.L802A9574_7B0F14:
/* 41E304 802A9574 3C04802B */  lui       $a0, %hi(D_802AB480_7B2E20)
.L802A9578_7B0F18:
/* 41E308 802A9578 8C84B480 */  lw        $a0, %lo(D_802AB480_7B2E20)($a0)
/* 41E30C 802A957C 24020009 */  addiu     $v0, $zero, 0x9
.L802A9580_7B0F20:
/* 41E310 802A9580 3C01802B */  lui       $at, %hi(D_802AD678)
.L802A9584_7B0F24:
/* 41E314 802A9584 00230821 */  addu      $at, $at, $v1
/* 41E318 802A9588 AC22D678 */  sw        $v0, %lo(D_802AD678)($at)
.L802A958C_7B0F2C:
/* 41E31C 802A958C 24020001 */  addiu     $v0, $zero, 0x1
func_802A9590:
/* 41E320 802A9590 3C01802B */  lui       $at, %hi(D_802AD690)
/* 41E324 802A9594 00230821 */  addu      $at, $at, $v1
glabel .L802A9598_7B0F38
/* 41E328 802A9598 AC22D690 */  sw        $v0, %lo(D_802AD690)($at)
glabel func_802A959C
/* 41E32C 802A959C 3C01802B */  lui       $at, %hi(D_802AD640)
.L802A95A0_7B0F40:
/* 41E330 802A95A0 00230821 */  addu      $at, $at, $v1
.L802A95A4_7B0F44:
/* 41E334 802A95A4 AC24D640 */  sw        $a0, %lo(D_802AD640)($at)
.L802A95A8_7B0F48:
/* 41E338 802A95A8 3C02802B */  lui       $v0, %hi(D_802AB4B4_7B2E54)
.L802A95AC_7B0F4C:
/* 41E33C 802A95AC 8C42B4B4 */  lw        $v0, %lo(D_802AB4B4_7B2E54)($v0)
D_802A95B0_7B0F50:
/* 41E340 802A95B0 34A500A2 */  ori       $a1, $a1, (0x1D00A2 & 0xFFFF)
.L802A95B4_7B0F54:
/* 41E344 802A95B4 3C01802B */  lui       $at, %hi(D_802AD6C0)
.L802A95B8_7B0F58:
/* 41E348 802A95B8 00230821 */  addu      $at, $at, $v1
/* 41E34C 802A95BC AC25D6C0 */  sw        $a1, %lo(D_802AD6C0)($at)
/* 41E350 802A95C0 3C01802B */  lui       $at, %hi(D_802AD658)
.L802A95C4_7B0F64:
/* 41E354 802A95C4 00230821 */  addu      $at, $at, $v1
.L802A95C8_7B0F68:
/* 41E358 802A95C8 AC22D658 */  sw        $v0, %lo(D_802AD658)($at)
.L802A95CC_7B0F6C:
/* 41E35C 802A95CC 82820063 */  lb        $v0, 0x63($s4)
D_802A95D0_7B0F70:
/* 41E360 802A95D0 04410002 */  bgez      $v0, func_802A95DC_7B0F7C
.L802A95D4_7B0F74:
/* 41E364 802A95D4 26100001 */   addiu    $s0, $s0, 0x1
.L802A95D8_7B0F78:
/* 41E368 802A95D8 A2800063 */  sb        $zero, 0x63($s4)
glabel func_802A95DC_7B0F7C
/* 41E36C 802A95DC 82910063 */  lb        $s1, 0x63($s4)
.L802A95E0_7B0F80:
/* 41E370 802A95E0 3C01802B */  lui       $at, %hi(D_802AD66C)
.L802A95E4_7B0F84:
/* 41E374 802A95E4 AC30D66C */  sw        $s0, %lo(D_802AD66C)($at)
.L802A95E8_7B0F88:
/* 41E378 802A95E8 3C01802B */  lui       $at, %hi(D_802AD670)
.L802A95EC_7B0F8C:
/* 41E37C 802A95EC AC31D670 */  sw        $s1, %lo(D_802AD670)($at)
D_802A95F0_7B0F90:
/* 41E380 802A95F0 0C0A9176 */  jal       func_802A45D8_7ABF78
/* 41E384 802A95F4 00000000 */   nop
.L802A95F8_7B0F98:
/* 41E388 802A95F8 080AA6A9 */  j         .L802A9AA4_7B1444
.L802A95FC_7B0F9C:
/* 41E38C 802A95FC 240200C9 */   addiu    $v0, $zero, 0xC9
.L802A9600_7B0FA0:
/* 41E390 802A9600 0C0A9295 */  jal       func_802A4A54_7AC3F4
.L802A9604_7B0FA4:
/* 41E394 802A9604 00000000 */   nop
.L802A9608_7B0FA8:
/* 41E398 802A9608 0040802D */  daddu     $s0, $v0, $zero
.L802A960C_7B0FAC:
/* 41E39C 802A960C 12000127 */  beqz      $s0, .L802A9AAC_7B144C
D_802A9610_7B0FB0:
/* 41E3A0 802A9610 240200FF */   addiu    $v0, $zero, 0xFF
.L802A9614_7B0FB4:
/* 41E3A4 802A9614 1602000B */  bne       $s0, $v0, .L802A9644_7B0FE4
.L802A9618_7B0FB8:
/* 41E3A8 802A9618 2603FFFF */   addiu    $v1, $s0, -0x1
.L802A961C_7B0FBC:
/* 41E3AC 802A961C 0C0A8414 */  jal       func_802A1050_7A89F0

### DECOMPILED C INSTRUCTIONS:

void btl_state_update_partner_menu(void) {
    BattleStatus* battleStatus = &gBattleStatus;
    PlayerData* playerData = &gPlayerData;
    Actor* playerActor = battleStatus->playerActor;
    Actor* partnerActor = battleStatus->partnerActor;
    PopupMenu* popupMenu = &D_802ACCD0;
    s32 entryIdx;
    s32 i;
    s32 popupIndex;
    s32 initialPos;
    MoveData* moveData;
    PartnerPopupProperties* popupProps;

    if (gBattleSubState == BTL_SUBSTATE_PARTNER_MENU_NONE) {
        battleStatus->moveCategory = BTL_MENU_TYPE_INVALID;
        battleStatus->selectedMoveID = MOVE_NONE;
        battleStatus->currentAttackElement = 0;
        if (!func_802A58D0()) {
            btl_set_state(BATTLE_STATE_9);
        } else {
            btl_cam_use_preset(BTL_CAM_DEFAULT);
            battleStatus->flags1 |= BS_FLAGS1_MENU_OPEN;
            playerActor->flags &= ~(ACTOR_FLAG_4000000 | ACTOR_FLAG_8000000);
            partnerActor->flags &= ~(ACTOR_FLAG_4000000 | ACTOR_FLAG_8000000);
            if (battleStatus->flags1 & BS_FLAGS1_PLAYER_IN_BACK) {
                gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_INIT_MENU;
            } else {
                gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_12D;
                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;
            }
        }
    }
    if (gBattleSubState == BTL_SUBSTATE_PARTNER_MENU_12D) {
        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 {
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_INIT_MENU;
            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;
            gBattleStatus.flags1 |= BS_FLAGS1_PLAYER_IN_BACK;
        }
    }
    switch (gBattleSubState) {
        case BTL_SUBSTATE_PARTNER_MENU_INIT_MENU:
            partnerActor->flags |= ACTOR_FLAG_8000000;
            partnerActor->flags &= ~ACTOR_FLAG_4000000;
            playerActor->flags |= ACTOR_FLAG_4000000;
            playerActor->flags |= ACTOR_FLAG_8000000;
            func_80263300();
            func_80263268();
            entryIdx = 0;
            initialPos = 1;
            if (battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_MAIN] < 0) {
                battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_MAIN] = BTL_MENU_TYPE_ABILITY;
            }
            btl_init_menu_partner();
            func_80263268();

            // strategies menu category
            battle_menu_submenuIDs[entryIdx] = BTL_MENU_TYPE_STRATEGIES;
            BattleMenu_OptionEnabled[entryIdx] = TRUE;
            battle_menu_isMessageDisabled[entryIdx] = 0;
            BattleMenu_HudScripts[entryIdx] = battle_menu_StrategiesHudScript.enabled;
            BattleMenu_TitleMessages[entryIdx] = BattleMenu_CenteredMessages[BTL_MENU_TYPE_STRATEGIES];
            if (!(battleStatus->enabledMenusFlags & BTL_MENU_ENABLED_STRATEGIES)) {
                BattleMenu_OptionEnabled[entryIdx] = FALSE;
                battle_menu_isMessageDisabled[entryIdx] = BTL_MSG_CANT_SELECT_NOW;
                BattleMenu_HudScripts[entryIdx] = battle_menu_StrategiesHudScript.disabled;
            }
            if (battleStatus->lastPartnerMenuSelection[entryIdx] == BTL_MENU_TYPE_STRATEGIES) {
                initialPos = entryIdx;
            }
            entryIdx++;

            // abilities menu category
            BattleMenu_HudScripts[entryIdx] = battle_menu_PartnerMoveHudScripts[playerData->currentPartner][0];
            battle_menu_submenuIDs[entryIdx] = BTL_MENU_TYPE_ABILITY;
            BattleMenu_OptionEnabled[entryIdx] = TRUE;
            BattleMenu_TitleMessages[entryIdx] = BattleMenu_CenteredMessages[BTL_MENU_TYPE_ABILITY];
            if (battleStatus->menuStatus[3] <= 0) {
                BattleMenu_HudScripts[entryIdx] = battle_menu_PartnerMoveHudScripts[playerData->currentPartner][1];
                BattleMenu_OptionEnabled[entryIdx] = FALSE;
                battle_menu_isMessageDisabled[entryIdx] = BTL_MSG_CANT_SELECT_NOW;
            }
            if (!(battleStatus->enabledMenusFlags & BTL_MENU_ENABLED_ABILITIES)) {
                BattleMenu_HudScripts[entryIdx] = battle_menu_PartnerMoveHudScripts[playerData->currentPartner][1];
                BattleMenu_OptionEnabled[entryIdx] = FALSE;
                battle_menu_isMessageDisabled[entryIdx] = BTL_MSG_CANT_SELECT_NOW;
            }
            if (battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_MAIN] == BTL_MENU_TYPE_ABILITY) {
                initialPos = entryIdx;
            }
            entryIdx++;

            // focus menu category
            if (playerData->maxStarPower != 0 && is_ability_active(ABILITY_GROUP_FOCUS)) {
                battle_menu_submenuIDs[entryIdx] = BTL_MENU_TYPE_PARTNER_FOCUS;
                BattleMenu_OptionEnabled[entryIdx] = TRUE;
                battle_menu_isMessageDisabled[entryIdx] = 0;
                BattleMenu_HudScripts[entryIdx] = battle_menu_StarPowerHudScripts.enabled;
                BattleMenu_TitleMessages[entryIdx] = BattleMenu_CenteredMessages[BTL_MENU_TYPE_PARTNER_FOCUS];
                if (!(battleStatus->enabledMenusFlags & BTL_MENU_ENABLED_PARTNER_FOCUS)) {
                    BattleMenu_OptionEnabled[entryIdx] = FALSE;
                    battle_menu_isMessageDisabled[entryIdx] = BTL_MSG_CANT_SELECT_NOW;
                    BattleMenu_HudScripts[entryIdx] = battle_menu_StarPowerHudScripts.disabled;
                }
                if (battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_MAIN] == BTL_MENU_TYPE_PARTNER_FOCUS) {
                    initialPos = entryIdx;
                }
                entryIdx++;
            }

            BattleMenu_NumOptions = entryIdx;
            D_802AD0A8 = 1;
            D_802AD0B0 = initialPos;
            D_802AD100 = 2 - initialPos;
            if (can_btl_state_update_switch_to_player()) {
                BattleMenu_ShowSwapIcons = TRUE;
            } else {
                BattleMenu_ShowSwapIcons = FALSE;
            }
            btl_main_menu_init();
            D_802ACC60 = 8;
            D_802ACC6C = 0;
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_1;
            return;
        case BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_1:
            set_animation(ACTOR_PARTNER, 0, BattleMenu_PartnerThinkAnims[playerData->currentPartner]);
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_2;
        case BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_2:
            entryIdx = btl_main_menu_update();

            if (D_802ACC6C != 0) {
                D_802ACC6C--;
            } else if (!(gBattleStatus.flags1 & BS_FLAGS1_TUTORIAL_BATTLE) && (gGameStatusPtr->pressedButtons[0] & BUTTON_Z)) {
                if (can_btl_state_update_switch_to_player()) {
                    sfx_play_sound(SOUND_F);
                    battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_MAIN] = battle_menu_submenuIDs[BattleMenu_CurPos + BattleMenu_HomePos];
                    btl_main_menu_destroy();
                    btl_set_state(BATTLE_STATE_SWITCH_TO_PLAYER);
                } else {
                    sfx_play_sound(SOUND_MENU_ERROR);
                    gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_7;
                }
                break;
            }

            if (D_802ACC60 != 0) {
                D_802ACC60--;
            } else if (entryIdx != 0) {
                set_animation(ACTOR_PARTNER, 0, BattleMenu_PartnerIdleAnims[playerData->currentPartner]);
                battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_MAIN] = battleStatus->unk_4A = battle_menu_submenuIDs[entryIdx - 1];
                if (battleStatus->unk_4A == 7) {
                    gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_1;
                    btl_state_update_partner_menu();
                    btl_state_update_partner_menu();
                } else if (battleStatus->unk_4A == 6) {
                    gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_ABILITIES_1;
                    btl_state_update_partner_menu();
                    btl_state_update_partner_menu();
                } else if (battleStatus->unk_4A == 8) {
                    gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_FOCUS_1;
                    btl_state_update_partner_menu();
                    btl_state_update_partner_menu();
                } else if (battleStatus->unk_4A == 2) {
                    gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_ITEMS_1;
                    btl_state_update_partner_menu();
                    btl_state_update_partner_menu();
                } else if (battleStatus->unk_4A == 5) {
                    gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_1;
                    btl_state_update_partner_menu();
                    btl_state_update_partner_menu();
                } else {
                    battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_5;
                    battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_6;
                    func_802A1030();
                    gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_3;
                }
            }
            break;
    case BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_3:
        entryIdx = btl_main_menu_update();
        if ((battleStatus->currentButtonsPressed & BUTTON_B) && entryIdx == 0) {
            func_802A1078();
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_4;
            return;
        }
        if (entryIdx != 0) {
            battleStatus->moveCategory = BTL_MENU_TYPE_STAR_POWERS;
            battleStatus->selectedMoveID = MOVE_FOCUS;
            battleStatus->moveArgument = 0;
            battleStatus->currentTargetListFlags = gMoveTable[MOVE_FOCUS].flags;
            btl_set_state(BATTLE_STATE_SELECT_TARGET);
            return;
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_4:
        if (btl_main_menu_update() != 0) {
            D_802ACC60 = 8;
            D_802ACC6C = 4;
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_1;
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_5:
        func_802A1078();
        gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_4;
        break;
    case BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_6:
        btl_main_menu_destroy();
        break;
    case BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_7:
        if (can_btl_state_update_switch_to_player() == 0) {
            btl_show_variable_battle_message(BTL_MSG_CANT_MOVE, 60, 0);
        } else {
            btl_show_variable_battle_message(BTL_MSG_CANT_SWITCH, 60, 0);
        }
        D_802AD607 = 1;
        gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_8;
        break;
    case BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_8:
        if (btl_is_popup_displayed() == 0) {
            D_802ACC6C = 4;
            D_802ACC60 = 0;
            D_802AD607 = 0;
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_1;
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_ABILITIES_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;
            }
            battle_menu_moveOptionIconScripts[i] = battle_menu_PartnerMoveHudScripts[playerData->currentPartner][2 * i + 2];
            if (battleStatus->submenuStatus[i] == 0) {
                battle_menu_moveOptionIconScripts[i] = battle_menu_PartnerMoveHudScripts[playerData->currentPartner][2 * i + 3];
            }
            BattleMenu_Moves_OptionIndices[i] = battleStatus->submenuMoves[i];
            BattleMenu_Moves_OptionEnabled[i] = battleStatus->submenuStatus[i];
            battle_menu_moveOptionNames[i] = moveData->nameMsg;
            BattleMenu_Moves_OptionDescMessages[i] = moveData->shortDescMsg;
            battle_menu_moveOptionDisplayCosts[i] = moveData->costFP;
            battle_menu_moveOptionBPCosts[i] = moveData->costBP;
            BattleMenu_Moves_OptionSortPriority[i] = i;

            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] += player_team_is_ability_active(playerActor, ABILITY_FLOWER_FANATIC) * 2;
                battle_menu_moveOptionDisplayCostReductionColors[i] = 2;
            }
        }
        if (battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_ABILITY] < 0) {
            battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_ABILITY] = 0;
        }
        BattleMenu_UsingSpiritsSubmenu = FALSE;
        BattleMenu_Moves_OptionCount = battleStatus->submenuMoveCount;
        initialPos = battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_ABILITY];
        D_802AD4A8 = initialPos;
        func_802A2684();
        gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_ABILITIES_2;
        break;
    case BTL_SUBSTATE_PARTNER_MENU_ABILITIES_2:
        entryIdx = btl_submenu_moves_update();
        if (entryIdx == -1) {
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_ABILITIES_7;
        } else if (entryIdx  != 0) {
            if (entryIdx == 255) {
                func_802A1050();
                D_802ACC60 = 8;
                D_802ACC6C = 4;
                gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_1;
                btl_state_update_partner_menu();
                btl_state_update_partner_menu();
            } else {
                battleStatus->unk_4B = entryIdx - 1;
                func_802A27D0();
                func_802A1030();
                gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_ABILITIES_3;
            }
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_ABILITIES_3:
        entryIdx = btl_submenu_moves_update();
        if ((battleStatus->currentButtonsPressed & BUTTON_B) && entryIdx == 0) {
            func_802A2AB8();
            func_802A1098();
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_ABILITIES_4;
        } else if (btl_main_menu_update() != 0) {
            battleStatus->moveCategory = BTL_MENU_TYPE_ABILITY;
            battleStatus->selectedMoveID = BattleMenu_Moves_OptionIndices[battleStatus->unk_4B];
            battleStatus->currentTargetListFlags = gMoveTable[battleStatus->selectedMoveID].flags;
            battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_ABILITY] = battle_menu_moveOptionActive;
            battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PARTNER_MENU_ABILITIES_5;
            battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PARTNER_MENU_ABILITIES_6;
            btl_set_state(BATTLE_STATE_SELECT_TARGET);
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_ABILITIES_4:
        btl_submenu_moves_update();
        if (btl_main_menu_update() != 0) {
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_ABILITIES_2;
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_ABILITIES_5:
        func_802A2AB8();
        func_802A1098();
        gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_ABILITIES_4;
        break;
    case BTL_SUBSTATE_PARTNER_MENU_ABILITIES_6:
        func_802A27E4();
        btl_main_menu_destroy();
        break;
    case BTL_SUBSTATE_PARTNER_MENU_ABILITIES_7:
        if (btl_submenu_moves_update() != -1) {
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_ABILITIES_2;
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_ITEMS_1:
        popupIndex = 0;
        for (i = 0; i < ARRAY_COUNT(playerData->invItems); i++) {
            ItemData* item;
            HudScript** hudScript;
            if (playerData->invItems[i] == 0) {
                continue;
            }
            item = &gItemTable[playerData->invItems[i]];
            hudScript = &gItemHudScripts[item->hudElemID].enabled;

            if (!(item->typeFlags & ITEM_TYPE_FLAG_BATTLE_USABLE)) {
                continue;
            }
            popupMenu->ptrIcon[popupIndex] = hudScript[0];
            popupMenu->userIndex[popupIndex] = playerData->invItems[i];
            popupMenu->enabled[popupIndex] = TRUE;
            popupMenu->nameMsg[popupIndex] = item->nameMsg;
            popupMenu->descMsg[popupIndex] = item->shortDescMsg;
            popupIndex++;
        }
        if (battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_PARTNER_ITEM] < 0) {
            battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_PARTNER_ITEM] = 0;
        }
        popupMenu->popupType = POPUP_MENU_USE_ITEM;
        popupMenu->numEntries = popupIndex;
        popupMenu->dipMode = 0;
        popupMenu->titleNumber = 0;
        initialPos = battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_PARTNER_ITEM];
        popupMenu->initialPos = initialPos;
        create_battle_popup_menu(popupMenu);
        func_800F52BC();
        gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_ITEMS_2;
        break;
    case BTL_SUBSTATE_PARTNER_MENU_ITEMS_2:
        if (popupMenu->result != POPUP_RESULT_CHOOSING) {
            if (popupMenu->result == POPUP_RESULT_CANCEL) {
                func_802A1050();
                D_802ACC60 = 8;
                D_802ACC6C = 4;
                gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_1;
                btl_state_update_partner_menu();
                btl_state_update_partner_menu();
            } else {
                battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PARTNER_MENU_ITEMS_5;
                battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PARTNER_MENU_ITEMS_6;
                battleStatus->unk_1AA = popupMenu->userIndex[popupMenu->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->lastPartnerMenuSelection[BTL_MENU_IDX_PARTNER_ITEM] = popupMenu->result - 1;
                hide_popup_menu();
                func_802A1030();
                gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_ITEMS_3;
            }
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_ITEMS_3:
        if ((battleStatus->currentButtonsPressed & BUTTON_B) && popupMenu->result == POPUP_RESULT_CHOOSING) {
            func_800F16CC();
            func_802A1098();
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_ITEMS_4;
        } else if (btl_main_menu_update() != 0) {
            btl_set_state(BATTLE_STATE_SELECT_TARGET);
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_ITEMS_4:
        if (btl_main_menu_update() != 0) {
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_ITEMS_2;
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_ITEMS_5:
        func_800F16CC();
        func_802A1098();
        gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_ITEMS_4;
        break;
    case BTL_SUBSTATE_PARTNER_MENU_ITEMS_6:
        destroy_popup_menu();
        btl_main_menu_destroy();
        break;
    case BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_1:
        popupIndex = 0;
        for (i = 1; i < ARRAY_COUNT(D_8008EEC0); i++) {
            s32 partnerId = D_8008EEC0[i];
            if (playerData->partners[partnerId].enabled) {
                popupProps = &gPartnerPopupProperties[partnerId];
                popupMenu->ptrIcon[popupIndex] = battle_menu_PartnerHudScripts[partnerId];
                popupMenu->userIndex[popupIndex] = partnerId;
                popupMenu->enabled[popupIndex] = 1;
                popupMenu->nameMsg[popupIndex] = popupProps->nameMsg;
                popupMenu->descMsg[popupIndex] = popupProps->battleDescMsg;
                popupMenu->value[popupIndex] = playerData->partners[partnerId].level;
                if (playerData->currentPartner == partnerId) {
                    popupMenu->enabled[popupIndex] = 0;
                    popupMenu->ptrIcon[popupIndex] = battle_menu_DisabledPartnerHudScripts[partnerId];
                }
                popupIndex++;
            }
        }
        if (battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_PARTNER] < 0) {
            battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_PARTNER] = 0;
        }
        popupMenu->popupType = POPUP_MENU_SWITCH_PARTNER;
        popupMenu->numEntries = popupIndex;
        popupMenu->initialPos = D_8008EEF0[playerData->currentPartner] - 1;
        popupMenu->dipMode = 0;
        popupMenu->titleNumber = 0;
        create_battle_popup_menu(popupMenu);
        func_800F52BC();
        gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_2;
        break;
    case BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_2:
        if (popupMenu->result == POPUP_RESULT_MINUS_1) {
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_7;
        } else if (popupMenu->result != POPUP_RESULT_CHOOSING) {
            if (popupMenu->result == POPUP_RESULT_CANCEL) {
                func_802A1050();
                D_802ACC60 = 8;
                D_802ACC6C = 4;
                gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_1;
                btl_state_update_partner_menu();
                btl_state_update_partner_menu();
            } else {
                battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_5;
                battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_6;
                battleStatus->unk_1AC = popupMenu->userIndex[popupMenu->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->lastPartnerMenuSelection[BTL_MENU_IDX_PARTNER] = popupMenu->result - 1;
                hide_popup_menu();
                func_802A1030();
                gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_3;
            }
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_3:
        if ((battleStatus->currentButtonsPressed & BUTTON_B) && (popupMenu->result == POPUP_RESULT_CHOOSING)) {
            func_800F16CC();
            func_802A1098();
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_4;
        } else if (btl_main_menu_update() != 0) {
            gBattleSubState = battleStatus->acceptTargetMenuSubstate;
            btl_state_update_partner_menu();
            btl_set_state(BATTLE_STATE_CHANGE_PARTNER);
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_4:
        if (btl_main_menu_update() != 0) {
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_2;
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_5:
        func_800F16CC();
        func_802A1098();
        gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_4;
        break;
    case BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_6:
        destroy_popup_menu();
        btl_main_menu_destroy();
        break;
    case BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_7:
        if (popupMenu->result != POPUP_RESULT_MINUS_1) {
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_UNUSED_CHANGE_PARTNER_2;
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_FOCUS_1:
        entryIdx = 1;
        battleStatus->submenuMoves[0] = MOVE_FOCUS;
        battleStatus->submenuMoveCount = entryIdx;
        battleStatus->submenuIcons[0] = ITEM_PARTNER_ATTACK;
        battleStatus->submenuStatus[0] = 1;
        for (i = 0; i < battleStatus->submenuMoveCount; i++) {
            moveData = &gMoveTable[battleStatus->submenuMoves[i]];
            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_OptionIndices[i] = i;
            BattleMenu_Moves_OptionSortPriority[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->lastPartnerMenuSelection[BTL_MENU_IDX_STAR_POWER] < 0) {
            battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_STAR_POWER] = 0;
        }
        BattleMenu_UsingSpiritsSubmenu = TRUE;
        BattleMenu_Moves_OptionCount = battleStatus->submenuMoveCount;
        initialPos = battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_STAR_POWER];
        D_802AD4A8 = initialPos;
        func_802A2684();
        gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_FOCUS_2;
        break;
    case BTL_SUBSTATE_PARTNER_MENU_FOCUS_2:
        entryIdx = btl_submenu_moves_update();
        if (entryIdx != 0) {
            if (entryIdx == 255) {
                func_802A1050();
                D_802ACC60 = 8;
                D_802ACC6C = 4;
                gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_1;
                btl_state_update_partner_menu();
                btl_state_update_partner_menu();
            } else {
                battleStatus->unk_4B = BattleMenu_Moves_OptionIndices[entryIdx - 1];
                func_802A27D0();
                func_802A1030();
                gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_FOCUS_3;
            }
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_FOCUS_3:
        entryIdx = btl_submenu_moves_update();
        if ((battleStatus->currentButtonsPressed & BUTTON_B) && (entryIdx == 0)) {
            func_802A2AB8();
            func_802A1098();
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_FOCUS_4;
        } else if (btl_main_menu_update() != 0) {
            battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PARTNER_MENU_FOCUS_5;
            battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PARTNER_MENU_FOCUS_6;
            battleStatus->moveCategory = BTL_MENU_TYPE_STAR_POWERS;
            battleStatus->selectedMoveID = battleStatus->submenuMoves[battleStatus->unk_4B];
            battleStatus->currentTargetListFlags = gMoveTable[battleStatus->submenuMoves[battleStatus->unk_4B]].flags;
            battleStatus->moveArgument = battleStatus->unk_4B;
            battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_STAR_POWER] = battle_menu_moveOptionActive;
            btl_set_state(BATTLE_STATE_SELECT_TARGET);
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_FOCUS_4:
        btl_submenu_moves_update();
        if (btl_main_menu_update() != 0) {
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_FOCUS_2;
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_FOCUS_5:
        func_802A2AB8();
        func_802A1098();
        gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_FOCUS_4;
        break;
    case BTL_SUBSTATE_PARTNER_MENU_FOCUS_6:
        func_802A27E4();
        btl_main_menu_destroy();
        break;
    case BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_1:
        popupIndex = 0;
        func_80263268();
        if (battleStatus->changePartnerAllowed >= 0) {
            D_802AD678[popupIndex] = BTL_MENU_TYPE_CHANGE_PARTNER;
            D_802AD658[popupIndex] = BattleMenu_LeftJustMessages[BTL_MENU_TYPE_CHANGE_PARTNER];
            D_802AD640[popupIndex] = battle_menu_PartnerHudScripts[playerData->currentPartner];
            D_802AD690[popupIndex] = 1;
            D_802AD6C0[popupIndex] = MSG_Menus_Action_ChangePartner;
            if (battleStatus->changePartnerAllowed <= 0) {
                D_802AD640[popupIndex] = battle_menu_DisabledPartnerHudScripts[playerData->currentPartner];
                D_802AD690[popupIndex] = 0;
                D_802AD6A8[popupIndex] = 0;
            }
            popupIndex++;
        }
        D_802AD640[popupIndex] = battle_menu_DoNothingHudScripts.enabled;
        D_802AD678[popupIndex] = BTL_MENU_TYPE_DO_NOTHING;
        D_802AD690[popupIndex] = 1;
        D_802AD658[popupIndex] = BattleMenu_LeftJustMessages[BTL_MENU_TYPE_DO_NOTHING];
        D_802AD6C0[popupIndex] = MSG_Menus_Action_DoNothing;
        popupIndex++;

        if (battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_STRATEGY] < 0) {
            battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_STRATEGY] = 0;
        }
        D_802AD66C = popupIndex;
        initialPos = battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_STRATEGY];
        D_802AD670 = initialPos;
        func_802A45D8();
        gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_2;
        break;
    case BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_2:
        entryIdx = func_802A4A54();
        if (entryIdx != 0) {
            if (entryIdx == 255) {
                func_802A1050();
                D_802ACC60 = 8;
                D_802ACC6C = 4;
                gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_1;
                btl_state_update_partner_menu();
                btl_state_update_partner_menu();
            } else {
                battleStatus->unk_4A = D_802AD678[entryIdx - 1];
                battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_STRATEGY] = entryIdx - 1;
                if (battleStatus->unk_4A == 5) {
                    gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_1;
                    btl_state_update_partner_menu();
                    btl_state_update_partner_menu();
                } else {
                    func_802A4718();
                    func_802A1030();
                    gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_3;
                }
            }
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_3:
        entryIdx = func_802A4A54();
        if ((battleStatus->currentButtonsPressed & BUTTON_B) && entryIdx == 0) {
            func_802A48FC();
            func_802A1098();
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_4;
        } else if (btl_main_menu_update() != 0) {
            battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_5;
            battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_6;
            entryIdx = battleStatus->unk_4A;
            switch (entryIdx) {
                case 9:
                    gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_6;
                    btl_state_update_partner_menu();
                    btl_set_state(BATTLE_STATE_END_PARTNER_TURN);
                    break;
                case 3:
                    gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_6;
                    btl_state_update_partner_menu();
                    battleStatus->moveCategory = entryIdx;
                    battleStatus->selectedMoveID = MOVE_UNUSED_39;
                    btl_set_state(BATTLE_STATE_RUN_AWAY);
                    break;
                case 10:
                    gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_6;
                    btl_state_update_partner_menu();
                    btl_set_state(BATTLE_STATE_SWITCH_TO_PLAYER);
                    break;
            }
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_4:
        func_802A4A54();
        if (btl_main_menu_update() != 0) {
            D_802ACC60 = 8;
            D_802ACC6C = 4;
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_MAIN_MENU_1;
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_5:
        func_802A48FC();
        func_802A1098();
        gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_4;
        break;
    case BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_6:
        func_802A472C();
        btl_main_menu_destroy();
        break;
    case BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_1:
        popupIndex = 0;
        for (i = 1; i < 12; i++) {
            s32 partnerId = D_8008EEC0[i];
            if (playerData->partners[partnerId].enabled) {
                popupProps = &gPartnerPopupProperties[partnerId];
                popupMenu->ptrIcon[popupIndex] = battle_menu_PartnerHudScripts[partnerId];
                popupMenu->userIndex[popupIndex] = partnerId;
                popupMenu->enabled[popupIndex] = 1;
                popupMenu->nameMsg[popupIndex] = popupProps->nameMsg;
                popupMenu->descMsg[popupIndex] = popupProps->battleDescMsg;
                popupMenu->value[popupIndex] = playerData->partners[partnerId].level;
                if (playerData->currentPartner == partnerId) {
                    popupMenu->enabled[popupIndex] = 0;
                    popupMenu->ptrIcon[popupIndex] = battle_menu_DisabledPartnerHudScripts[partnerId];
                }
                popupIndex++;
            }
        }
        if (battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_PARTNER] < 0) {
            battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_PARTNER] = 0;
        }
        popupMenu->popupType = POPUP_MENU_SWITCH_PARTNER;
        popupMenu->numEntries = popupIndex;
        popupMenu->initialPos = D_8008EEF0[playerData->currentPartner] - 1;
        popupMenu->dipMode = 0;
        popupMenu->titleNumber = 0;
        create_battle_popup_menu(popupMenu);
        func_800F52BC();
        gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_2;
        break;
    case BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_2:
        if (popupMenu->result == POPUP_RESULT_MINUS_1) {
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_7;
        } else if (popupMenu->result != POPUP_RESULT_CHOOSING) {
            if (popupMenu->result == POPUP_RESULT_CANCEL) {
                func_802A47E0();
                gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_2;
                btl_state_update_partner_menu();
                btl_state_update_partner_menu();
            } else {
                battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_5;
                battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_6;
                battleStatus->unk_1AC = popupMenu->userIndex[popupMenu->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->lastPartnerMenuSelection[BTL_MENU_IDX_PARTNER] = popupMenu->result - 1;
                hide_popup_menu();
                func_802A4718();
                func_802A1030();
                gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_3;
            }
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_3:
        if ((battleStatus->currentButtonsPressed & BUTTON_B) && popupMenu->result == POPUP_RESULT_CHOOSING) {
            func_800F16CC();
            func_802A4A10();
            func_802A1098();
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_4;
        } else {
            func_802A4A54();
            if (btl_main_menu_update() != 0) {
                gBattleSubState = battleStatus->acceptTargetMenuSubstate;
                btl_state_update_partner_menu();
                btl_set_state(BATTLE_STATE_CHANGE_PARTNER);
            }
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_4:
        func_802A4A54();
        if (btl_main_menu_update() != 0) {
            gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_2;
        }
        break;
    case BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_5:
        func_800F16CC();
        func_802A4A10();
        func_802A1098();
        gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_4;
        break;
    case BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_6:
        destroy_popup_menu();
        func_802A472C();
        btl_main_menu_destroy();
        break;
    case BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_7:
        set_window_update(WINDOW_ID_6, WINDOW_UPDATE_HIDE);
        set_window_update(WINDOW_ID_7, WINDOW_UPDATE_HIDE);
        if (popupMenu->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_PARTNER_MENU_CHANGE_PARTNER_2;
        }
        break;
    }
}