### RAW ASSEMBLY INSTRUCTIONS:

glabel popup_menu_update
/* 8AEC0 800F1A10 3C028011 */  lui       $v0, %hi(gPopupState)
/* 8AEC4 800F1A14 8C42D640 */  lw        $v0, %lo(gPopupState)($v0)
/* 8AEC8 800F1A18 27BDFFC0 */  addiu     $sp, $sp, -0x40
/* 8AECC 800F1A1C AFBF0038 */  sw        $ra, 0x38($sp)
/* 8AED0 800F1A20 AFB30034 */  sw        $s3, 0x34($sp)
/* 8AED4 800F1A24 AFB20030 */  sw        $s2, 0x30($sp)
/* 8AED8 800F1A28 AFB1002C */  sw        $s1, 0x2C($sp)
/* 8AEDC 800F1A2C 24430007 */  addiu     $v1, $v0, 0x7
/* 8AEE0 800F1A30 2C62006F */  sltiu     $v0, $v1, 0x6F
/* 8AEE4 800F1A34 10400707 */  beqz      $v0, .L800F3654
/* 8AEE8 800F1A38 AFB00028 */   sw       $s0, 0x28($sp)
/* 8AEEC 800F1A3C 00031080 */  sll       $v0, $v1, 2
/* 8AEF0 800F1A40 3C018011 */  lui       $at, %hi(jtbl_8010C410)
/* 8AEF4 800F1A44 00220821 */  addu      $at, $at, $v0
/* 8AEF8 800F1A48 8C22C410 */  lw        $v0, %lo(jtbl_8010C410)($at)
/* 8AEFC 800F1A4C 00400008 */  jr        $v0
/* 8AF00 800F1A50 00000000 */   nop
glabel .L800F1A54
/* 8AF04 800F1A54 3C048011 */  lui       $a0, %hi(D_8010D67C)
/* 8AF08 800F1A58 2484D67C */  addiu     $a0, $a0, %lo(D_8010D67C)
/* 8AF0C 800F1A5C 24030014 */  addiu     $v1, $zero, 0x14
/* 8AF10 800F1A60 3C058011 */  lui       $a1, %hi(D_8010D67E)
/* 8AF14 800F1A64 24A5D67E */  addiu     $a1, $a1, %lo(D_8010D67E)
/* 8AF18 800F1A68 24020048 */  addiu     $v0, $zero, 0x48
/* 8AF1C 800F1A6C A4830000 */  sh        $v1, 0x0($a0)
/* 8AF20 800F1A70 A4A20000 */  sh        $v0, 0x0($a1)
/* 8AF24 800F1A74 3C018011 */  lui       $at, %hi(D_8010D680)
/* 8AF28 800F1A78 A423D680 */  sh        $v1, %lo(D_8010D680)($at)
/* 8AF2C 800F1A7C 3C038011 */  lui       $v1, %hi(PopupNotBattle)
/* 8AF30 800F1A80 8063D68E */  lb        $v1, %lo(PopupNotBattle)($v1)
/* 8AF34 800F1A84 240200BA */  addiu     $v0, $zero, 0xBA
/* 8AF38 800F1A88 3C018011 */  lui       $at, %hi(D_8010D682)
/* 8AF3C 800F1A8C A422D682 */  sh        $v0, %lo(D_8010D682)($at)
/* 8AF40 800F1A90 24020010 */  addiu     $v0, $zero, 0x10
/* 8AF44 800F1A94 3C018011 */  lui       $at, %hi(D_8010D684)
/* 8AF48 800F1A98 A422D684 */  sh        $v0, %lo(D_8010D684)($at)
/* 8AF4C 800F1A9C 24020058 */  addiu     $v0, $zero, 0x58
/* 8AF50 800F1AA0 3C018011 */  lui       $at, %hi(D_8010D686)
/* 8AF54 800F1AA4 A422D686 */  sh        $v0, %lo(D_8010D686)($at)
/* 8AF58 800F1AA8 24020020 */  addiu     $v0, $zero, 0x20
/* 8AF5C 800F1AAC 3C018011 */  lui       $at, %hi(PopupMenu_StarPieceCounterPosX)
/* 8AF60 800F1AB0 A422D688 */  sh        $v0, %lo(PopupMenu_StarPieceCounterPosX)($at)
/* 8AF64 800F1AB4 240200A4 */  addiu     $v0, $zero, 0xA4
/* 8AF68 800F1AB8 3C018011 */  lui       $at, %hi(PopupMenu_StarPieceCounterPosY)
/* 8AF6C 800F1ABC A422D68A */  sh        $v0, %lo(PopupMenu_StarPieceCounterPosY)($at)
/* 8AF70 800F1AC0 1060000A */  beqz      $v1, .L800F1AEC
/* 8AF74 800F1AC4 00000000 */   nop
/* 8AF78 800F1AC8 3C028011 */  lui       $v0, %hi(gPopupMenu)
/* 8AF7C 800F1ACC 8C42D69C */  lw        $v0, %lo(gPopupMenu)($v0)
/* 8AF80 800F1AD0 8C420318 */  lw        $v0, 0x318($v0)
/* 8AF84 800F1AD4 00021040 */  sll       $v0, $v0, 1
/* 8AF88 800F1AD8 3C018011 */  lui       $at, %hi(D_801098A0)
/* 8AF8C 800F1ADC 00220821 */  addu      $at, $at, $v0
/* 8AF90 800F1AE0 942298A0 */  lhu       $v0, %lo(D_801098A0)($at)
/* 8AF94 800F1AE4 24420014 */  addiu     $v0, $v0, 0x14
/* 8AF98 800F1AE8 A4820000 */  sh        $v0, 0x0($a0)
.L800F1AEC:
/* 8AF9C 800F1AEC 3C028011 */  lui       $v0, %hi(PopupMenu_MaxDisplayableEntryCount)
/* 8AFA0 800F1AF0 8042D68F */  lb        $v0, %lo(PopupMenu_MaxDisplayableEntryCount)($v0)
/* 8AFA4 800F1AF4 28420007 */  slti      $v0, $v0, 0x7
/* 8AFA8 800F1AF8 14400002 */  bnez      $v0, .L800F1B04
/* 8AFAC 800F1AFC 2402003E */   addiu    $v0, $zero, 0x3E
/* 8AFB0 800F1B00 A4A20000 */  sh        $v0, 0x0($a1)
.L800F1B04:
/* 8AFB4 800F1B04 3C048010 */  lui       $a0, %hi(HES_EmptyBar)
/* 8AFB8 800F1B08 2484790C */  addiu     $a0, $a0, %lo(HES_EmptyBar)
/* 8AFBC 800F1B0C 3C018011 */  lui       $at, %hi(D_8010D68C)
/* 8AFC0 800F1B10 A420D68C */  sh        $zero, %lo(D_8010D68C)($at)
/* 8AFC4 800F1B14 0C050529 */  jal       hud_element_create
/* 8AFC8 800F1B18 00000000 */   nop
/* 8AFCC 800F1B1C 0040802D */  daddu     $s0, $v0, $zero
/* 8AFD0 800F1B20 0200202D */  daddu     $a0, $s0, $zero
/* 8AFD4 800F1B24 3C018011 */  lui       $at, %hi(PopupMenu_EmptybarHEID)
/* 8AFD8 800F1B28 AC30D65C */  sw        $s0, %lo(PopupMenu_EmptybarHEID)($at)
/* 8AFDC 800F1B2C 0C051280 */  jal       hud_element_set_flags
/* 8AFE0 800F1B30 24050080 */   addiu    $a1, $zero, 0x80
/* 8AFE4 800F1B34 0200202D */  daddu     $a0, $s0, $zero
/* 8AFE8 800F1B38 240500FF */  addiu     $a1, $zero, 0xFF
/* 8AFEC 800F1B3C 00A0302D */  daddu     $a2, $a1, $zero
/* 8AFF0 800F1B40 0C0513BF */  jal       hud_element_set_tint
/* 8AFF4 800F1B44 00A0382D */   daddu    $a3, $a1, $zero
/* 8AFF8 800F1B48 3C118011 */  lui       $s1, %hi(gPopupMenu)
/* 8AFFC 800F1B4C 2631D69C */  addiu     $s1, $s1, %lo(gPopupMenu)
/* 8B000 800F1B50 8E220000 */  lw        $v0, 0x0($s1)
/* 8B004 800F1B54 8C430318 */  lw        $v1, 0x318($v0)
/* 8B008 800F1B58 24020002 */  addiu     $v0, $zero, 0x2
/* 8B00C 800F1B5C 10620004 */  beq       $v1, $v0, .L800F1B70
/* 8B010 800F1B60 00000000 */   nop
/* 8B014 800F1B64 0200202D */  daddu     $a0, $s0, $zero
/* 8B018 800F1B68 0C051280 */  jal       hud_element_set_flags
/* 8B01C 800F1B6C 0040282D */   daddu    $a1, $v0, $zero
.L800F1B70:
/* 8B020 800F1B70 8E220000 */  lw        $v0, 0x0($s1)
/* 8B024 800F1B74 8C440000 */  lw        $a0, 0x0($v0)
/* 8B028 800F1B78 0C050529 */  jal       hud_element_create
/* 8B02C 800F1B7C 24130001 */   addiu    $s3, $zero, 0x1
/* 8B030 800F1B80 0040802D */  daddu     $s0, $v0, $zero
/* 8B034 800F1B84 3C053EE6 */  lui       $a1, (0x3EE66666 >> 16)
/* 8B038 800F1B88 34A56666 */  ori       $a1, $a1, (0x3EE66666 & 0xFFFF)
/* 8B03C 800F1B8C 3C018011 */  lui       $at, %hi(D_8010D678)
/* 8B040 800F1B90 AC30D678 */  sw        $s0, %lo(D_8010D678)($at)
/* 8B044 800F1B94 0C051308 */  jal       hud_element_set_scale
/* 8B048 800F1B98 0200202D */   daddu    $a0, $s0, $zero
/* 8B04C 800F1B9C 0200202D */  daddu     $a0, $s0, $zero
/* 8B050 800F1BA0 0C051280 */  jal       hud_element_set_flags
/* 8B054 800F1BA4 34058080 */   ori      $a1, $zero, 0x8080
/* 8B058 800F1BA8 3C048010 */  lui       $a0, %hi(HES_AnimatedHandPointer)
/* 8B05C 800F1BAC 24844A28 */  addiu     $a0, $a0, %lo(HES_AnimatedHandPointer)
/* 8B060 800F1BB0 0C050529 */  jal       hud_element_create
/* 8B064 800F1BB4 00000000 */   nop
/* 8B068 800F1BB8 0040802D */  daddu     $s0, $v0, $zero
/* 8B06C 800F1BBC 0200202D */  daddu     $a0, $s0, $zero
/* 8B070 800F1BC0 3C052000 */  lui       $a1, (0x20000080 >> 16)
/* 8B074 800F1BC4 3C018011 */  lui       $at, %hi(D_8010D66C)
/* 8B078 800F1BC8 AC24D66C */  sw        $a0, %lo(D_8010D66C)($at)
/* 8B07C 800F1BCC 0C051280 */  jal       hud_element_set_flags
/* 8B080 800F1BD0 34A50080 */   ori      $a1, $a1, (0x20000080 & 0xFFFF)
/* 8B084 800F1BD4 3C048010 */  lui       $a0, %hi(HES_GreenArrowUp)
/* 8B088 800F1BD8 248477E4 */  addiu     $a0, $a0, %lo(HES_GreenArrowUp)
/* 8B08C 800F1BDC 0C050529 */  jal       hud_element_create
/* 8B090 800F1BE0 00000000 */   nop
/* 8B094 800F1BE4 0040802D */  daddu     $s0, $v0, $zero
/* 8B098 800F1BE8 0200202D */  daddu     $a0, $s0, $zero
/* 8B09C 800F1BEC 3C052000 */  lui       $a1, (0x20000080 >> 16)
/* 8B0A0 800F1BF0 3C018011 */  lui       $at, %hi(D_8010D670)
/* 8B0A4 800F1BF4 AC24D670 */  sw        $a0, %lo(D_8010D670)($at)
/* 8B0A8 800F1BF8 0C051280 */  jal       hud_element_set_flags
/* 8B0AC 800F1BFC 34A50080 */   ori      $a1, $a1, (0x20000080 & 0xFFFF)
/* 8B0B0 800F1C00 3C048010 */  lui       $a0, %hi(HES_GreenArrowDown)
/* 8B0B4 800F1C04 24847798 */  addiu     $a0, $a0, %lo(HES_GreenArrowDown)
/* 8B0B8 800F1C08 0C050529 */  jal       hud_element_create
/* 8B0BC 800F1C0C 00000000 */   nop
/* 8B0C0 800F1C10 0040802D */  daddu     $s0, $v0, $zero
/* 8B0C4 800F1C14 0200202D */  daddu     $a0, $s0, $zero
/* 8B0C8 800F1C18 3C052000 */  lui       $a1, (0x20000080 >> 16)
/* 8B0CC 800F1C1C 3C018011 */  lui       $at, %hi(D_8010D674)
/* 8B0D0 800F1C20 AC24D674 */  sw        $a0, %lo(D_8010D674)($at)
/* 8B0D4 800F1C24 0C051280 */  jal       hud_element_set_flags
/* 8B0D8 800F1C28 34A50080 */   ori      $a1, $a1, (0x20000080 & 0xFFFF)
/* 8B0DC 800F1C2C 8E220000 */  lw        $v0, 0x0($s1)
/* 8B0E0 800F1C30 8C430318 */  lw        $v1, 0x318($v0)
/* 8B0E4 800F1C34 24020003 */  addiu     $v0, $zero, 0x3
/* 8B0E8 800F1C38 14620010 */  bne       $v1, $v0, .L800F1C7C
/* 8B0EC 800F1C3C 00000000 */   nop
/* 8B0F0 800F1C40 3C048010 */  lui       $a0, %hi(HES_StatusStarPiece)
/* 8B0F4 800F1C44 24844C10 */  addiu     $a0, $a0, %lo(HES_StatusStarPiece)
/* 8B0F8 800F1C48 0C050529 */  jal       hud_element_create
/* 8B0FC 800F1C4C 00000000 */   nop
/* 8B100 800F1C50 3C018011 */  lui       $at, %hi(PopupTitleIconHEID)
/* 8B104 800F1C54 AC22D660 */  sw        $v0, %lo(PopupTitleIconHEID)($at)
/* 8B108 800F1C58 0040802D */  daddu     $s0, $v0, $zero
/* 8B10C 800F1C5C 0040202D */  daddu     $a0, $v0, $zero
/* 8B110 800F1C60 0C051280 */  jal       hud_element_set_flags
/* 8B114 800F1C64 24050080 */   addiu    $a1, $zero, 0x80
/* 8B118 800F1C68 0200202D */  daddu     $a0, $s0, $zero
/* 8B11C 800F1C6C 240500FF */  addiu     $a1, $zero, 0xFF
/* 8B120 800F1C70 00A0302D */  daddu     $a2, $a1, $zero
/* 8B124 800F1C74 0C0513BF */  jal       hud_element_set_tint
/* 8B128 800F1C78 00A0382D */   daddu    $a3, $a1, $zero
.L800F1C7C:
/* 8B12C 800F1C7C 8E220000 */  lw        $v0, 0x0($s1)
/* 8B130 800F1C80 8C420318 */  lw        $v0, 0x318($v0)
/* 8B134 800F1C84 24120004 */  addiu     $s2, $zero, 0x4
/* 8B138 800F1C88 14520010 */  bne       $v0, $s2, .L800F1CCC
/* 8B13C 800F1C8C 00000000 */   nop
/* 8B140 800F1C90 3C048010 */  lui       $a0, %hi(HES_StatusStarPiece)
/* 8B144 800F1C94 24844C10 */  addiu     $a0, $a0, %lo(HES_StatusStarPiece)
/* 8B148 800F1C98 0C050529 */  jal       hud_element_create
/* 8B14C 800F1C9C 00000000 */   nop
/* 8B150 800F1CA0 3C018011 */  lui       $at, %hi(PopupTitleIconHEID)
/* 8B154 800F1CA4 AC22D660 */  sw        $v0, %lo(PopupTitleIconHEID)($at)
/* 8B158 800F1CA8 0040802D */  daddu     $s0, $v0, $zero
/* 8B15C 800F1CAC 0040202D */  daddu     $a0, $v0, $zero
/* 8B160 800F1CB0 0C051280 */  jal       hud_element_set_flags
/* 8B164 800F1CB4 34058080 */   ori      $a1, $zero, 0x8080
/* 8B168 800F1CB8 0200202D */  daddu     $a0, $s0, $zero
/* 8B16C 800F1CBC 240500FF */  addiu     $a1, $zero, 0xFF
/* 8B170 800F1CC0 00A0302D */  daddu     $a2, $a1, $zero
/* 8B174 800F1CC4 0C0513BF */  jal       hud_element_set_tint
/* 8B178 800F1CC8 00A0382D */   daddu    $a3, $a1, $zero
.L800F1CCC:
/* 8B17C 800F1CCC 8E220000 */  lw        $v0, 0x0($s1)
/* 8B180 800F1CD0 8C430318 */  lw        $v1, 0x318($v0)
/* 8B184 800F1CD4 24020005 */  addiu     $v0, $zero, 0x5
/* 8B188 800F1CD8 14620010 */  bne       $v1, $v0, .L800F1D1C
/* 8B18C 800F1CDC 00000000 */   nop
/* 8B190 800F1CE0 3C048011 */  lui       $a0, %hi(HES_StatusCoin)
/* 8B194 800F1CE4 24848558 */  addiu     $a0, $a0, %lo(HES_StatusCoin)
/* 8B198 800F1CE8 0C050529 */  jal       hud_element_create
/* 8B19C 800F1CEC 00000000 */   nop
/* 8B1A0 800F1CF0 3C018011 */  lui       $at, %hi(PopupTitleIconHEID)
/* 8B1A4 800F1CF4 AC22D660 */  sw        $v0, %lo(PopupTitleIconHEID)($at)
/* 8B1A8 800F1CF8 0040802D */  daddu     $s0, $v0, $zero
/* 8B1AC 800F1CFC 0040202D */  daddu     $a0, $v0, $zero
/* 8B1B0 800F1D00 0C051280 */  jal       hud_element_set_flags
/* 8B1B4 800F1D04 24050080 */   addiu    $a1, $zero, 0x80
/* 8B1B8 800F1D08 0200202D */  daddu     $a0, $s0, $zero
/* 8B1BC 800F1D0C 240500FF */  addiu     $a1, $zero, 0xFF
/* 8B1C0 800F1D10 00A0302D */  daddu     $a2, $a1, $zero
/* 8B1C4 800F1D14 0C0513BF */  jal       hud_element_set_tint
/* 8B1C8 800F1D18 00A0382D */   daddu    $a3, $a1, $zero
.L800F1D1C:
/* 8B1CC 800F1D1C 8E220000 */  lw        $v0, 0x0($s1)
/* 8B1D0 800F1D20 8C420318 */  lw        $v0, 0x318($v0)
/* 8B1D4 800F1D24 2442FFFD */  addiu     $v0, $v0, -0x3
/* 8B1D8 800F1D28 2C420002 */  sltiu     $v0, $v0, 0x2
/* 8B1DC 800F1D2C 10400010 */  beqz      $v0, .L800F1D70
/* 8B1E0 800F1D30 00000000 */   nop
/* 8B1E4 800F1D34 3C048011 */  lui       $a0, %hi(HES_MenuTimes)
/* 8B1E8 800F1D38 24849270 */  addiu     $a0, $a0, %lo(HES_MenuTimes)
/* 8B1EC 800F1D3C 0C050529 */  jal       hud_element_create
/* 8B1F0 800F1D40 00000000 */   nop
/* 8B1F4 800F1D44 3C018011 */  lui       $at, %hi(D_8010D664)
/* 8B1F8 800F1D48 AC22D664 */  sw        $v0, %lo(D_8010D664)($at)
/* 8B1FC 800F1D4C 0040802D */  daddu     $s0, $v0, $zero
/* 8B200 800F1D50 0040202D */  daddu     $a0, $v0, $zero
/* 8B204 800F1D54 0C051280 */  jal       hud_element_set_flags
/* 8B208 800F1D58 24050080 */   addiu    $a1, $zero, 0x80
/* 8B20C 800F1D5C 0200202D */  daddu     $a0, $s0, $zero
/* 8B210 800F1D60 240500FF */  addiu     $a1, $zero, 0xFF
/* 8B214 800F1D64 00A0302D */  daddu     $a2, $a1, $zero
/* 8B218 800F1D68 0C0513BF */  jal       hud_element_set_tint
/* 8B21C 800F1D6C 00A0382D */   daddu    $a3, $a1, $zero
.L800F1D70:
/* 8B220 800F1D70 8E220000 */  lw        $v0, 0x0($s1)
/* 8B224 800F1D74 8C420318 */  lw        $v0, 0x318($v0)
/* 8B228 800F1D78 10530003 */  beq       $v0, $s3, .L800F1D88
/* 8B22C 800F1D7C 00000000 */   nop
/* 8B230 800F1D80 14520010 */  bne       $v0, $s2, .L800F1DC4
/* 8B234 800F1D84 2402FF38 */   addiu    $v0, $zero, -0xC8
.L800F1D88:
/* 8B238 800F1D88 3C048011 */  lui       $a0, %hi(D_80109890)
/* 8B23C 800F1D8C 0C050529 */  jal       hud_element_create
/* 8B240 800F1D90 8C849890 */   lw       $a0, %lo(D_80109890)($a0)
/* 8B244 800F1D94 0040802D */  daddu     $s0, $v0, $zero
/* 8B248 800F1D98 0200202D */  daddu     $a0, $s0, $zero
glabel func_800F1D9C
/* 8B24C 800F1D9C 3C018011 */  lui       $at, %hi(D_8010D668)
/* 8B250 800F1DA0 AC30D668 */  sw        $s0, %lo(D_8010D668)($at)
/* 8B254 800F1DA4 0C051280 */  jal       hud_element_set_flags
/* 8B258 800F1DA8 24050080 */   addiu    $a1, $zero, 0x80
/* 8B25C 800F1DAC 0200202D */  daddu     $a0, $s0, $zero
/* 8B260 800F1DB0 240500FF */  addiu     $a1, $zero, 0xFF
/* 8B264 800F1DB4 00A0302D */  daddu     $a2, $a1, $zero
/* 8B268 800F1DB8 0C0513BF */  jal       hud_element_set_tint
/* 8B26C 800F1DBC 00A0382D */   daddu    $a3, $a1, $zero
/* 8B270 800F1DC0 2402FF38 */  addiu     $v0, $zero, -0xC8
.L800F1DC4:
/* 8B274 800F1DC4 3C018011 */  lui       $at, %hi(D_8010D65A)
/* 8B278 800F1DC8 A422D65A */  sh        $v0, %lo(D_8010D65A)($at)
/* 8B27C 800F1DCC 3C028011 */  lui       $v0, %hi(D_8010D691)
/* 8B280 800F1DD0 8042D691 */  lb        $v0, %lo(D_8010D691)($v0)
/* 8B284 800F1DD4 3C038011 */  lui       $v1, %hi(PopupNotBattle)
/* 8B288 800F1DD8 8063D68E */  lb        $v1, %lo(PopupNotBattle)($v1)
/* 8B28C 800F1DDC 3C048011 */  lui       $a0, %hi(D_8010D644)
/* 8B290 800F1DE0 2484D644 */  addiu     $a0, $a0, %lo(D_8010D644)
/* 8B294 800F1DE4 14600003 */  bnez      $v1, .L800F1DF4
/* 8B298 800F1DE8 AC820000 */   sw       $v0, 0x0($a0)
/* 8B29C 800F1DEC 24020001 */  addiu     $v0, $zero, 0x1
/* 8B2A0 800F1DF0 AC820000 */  sw        $v0, 0x0($a0)
.L800F1DF4:
/* 8B2A4 800F1DF4 3C058011 */  lui       $a1, %hi(D_8010D67C)
/* 8B2A8 800F1DF8 84A5D67C */  lh        $a1, %lo(D_8010D67C)($a1)
/* 8B2AC 800F1DFC 3C028011 */  lui       $v0, %hi(gPopupMenu)
/* 8B2B0 800F1E00 8C42D69C */  lw        $v0, %lo(gPopupMenu)($v0)
/* 8B2B4 800F1E04 3C068011 */  lui       $a2, %hi(D_8010D67E)
/* 8B2B8 800F1E08 84C6D67E */  lh        $a2, %lo(D_8010D67E)($a2)
/* 8B2BC 800F1E0C 8C430318 */  lw        $v1, 0x318($v0)
/* 8B2C0 800F1E10 2402000A */  addiu     $v0, $zero, 0xA
/* 8B2C4 800F1E14 3C018011 */  lui       $at, %hi(D_8010D690)
/* 8B2C8 800F1E18 A022D690 */  sb        $v0, %lo(D_8010D690)($at)
/* 8B2CC 800F1E1C 2C62000E */  sltiu     $v0, $v1, 0xE
/* 8B2D0 800F1E20 1040017B */  beqz      $v0, .L800F2410
/* 8B2D4 800F1E24 00031080 */   sll      $v0, $v1, 2
/* 8B2D8 800F1E28 3C018011 */  lui       $at, %hi(jtbl_8010C5D0)
/* 8B2DC 800F1E2C 00220821 */  addu      $at, $at, $v0
/* 8B2E0 800F1E30 8C22C5D0 */  lw        $v0, %lo(jtbl_8010C5D0)($at)
/* 8B2E4 800F1E34 00400008 */  jr        $v0
/* 8B2E8 800F1E38 00000000 */   nop
glabel .L800F1E3C
/* 8B2EC 800F1E3C 2404000E */  addiu     $a0, $zero, 0xE
/* 8B2F0 800F1E40 24070091 */  addiu     $a3, $zero, 0x91
/* 8B2F4 800F1E44 3C038011 */  lui       $v1, %hi(PopupMenu_DisplayedEntryCount)
/* 8B2F8 800F1E48 8063D656 */  lb        $v1, %lo(PopupMenu_DisplayedEntryCount)($v1)
/* 8B2FC 800F1E4C 24020014 */  addiu     $v0, $zero, 0x14
/* 8B300 800F1E50 AFA20014 */  sw        $v0, 0x14($sp)
/* 8B304 800F1E54 3C02800F */  lui       $v0, %hi(popup_menu_draw_menu_contents)
/* 8B308 800F1E58 24423680 */  addiu     $v0, $v0, %lo(popup_menu_draw_menu_contents)
/* 8B30C 800F1E5C AFA20018 */  sw        $v0, 0x18($sp)
/* 8B310 800F1E60 2402FFFF */  addiu     $v0, $zero, -0x1
/* 8B314 800F1E64 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B318 800F1E68 AFA20020 */  sw        $v0, 0x20($sp)
/* 8B31C 800F1E6C 00031040 */  sll       $v0, $v1, 1
/* 8B320 800F1E70 00431021 */  addu      $v0, $v0, $v1
/* 8B324 800F1E74 00021080 */  sll       $v0, $v0, 2
/* 8B328 800F1E78 00431021 */  addu      $v0, $v0, $v1
/* 8B32C 800F1E7C 2442001A */  addiu     $v0, $v0, 0x1A
/* 8B330 800F1E80 0C051F32 */  jal       set_window_properties
/* 8B334 800F1E84 AFA20010 */   sw       $v0, 0x10($sp)
/* 8B338 800F1E88 3C028011 */  lui       $v0, %hi(gPopupMenu)
/* 8B33C 800F1E8C 8C42D69C */  lw        $v0, %lo(gPopupMenu)($v0)
/* 8B340 800F1E90 8C42031C */  lw        $v0, 0x31C($v0)
/* 8B344 800F1E94 14400005 */  bnez      $v0, .L800F1EAC
/* 8B348 800F1E98 2404000F */   addiu    $a0, $zero, 0xF
/* 8B34C 800F1E9C 24050019 */  addiu     $a1, $zero, 0x19
/* 8B350 800F1EA0 2406FFFA */  addiu     $a2, $zero, -0x6
/* 8B354 800F1EA4 0803C7AE */  j         .L800F1EB8
/* 8B358 800F1EA8 2407005F */   addiu    $a3, $zero, 0x5F
.L800F1EAC:
/* 8B35C 800F1EAC 2405000C */  addiu     $a1, $zero, 0xC
/* 8B360 800F1EB0 2406FFFA */  addiu     $a2, $zero, -0x6
/* 8B364 800F1EB4 24070079 */  addiu     $a3, $zero, 0x79
.L800F1EB8:
/* 8B368 800F1EB8 24020010 */  addiu     $v0, $zero, 0x10
/* 8B36C 800F1EBC AFA20010 */  sw        $v0, 0x10($sp)
/* 8B370 800F1EC0 24020015 */  addiu     $v0, $zero, 0x15
/* 8B374 800F1EC4 AFA20014 */  sw        $v0, 0x14($sp)
/* 8B378 800F1EC8 3C02800F */  lui       $v0, %hi(popup_menu_draw_title_contents)
/* 8B37C 800F1ECC 24424648 */  addiu     $v0, $v0, %lo(popup_menu_draw_title_contents)
/* 8B380 800F1ED0 AFA20018 */  sw        $v0, 0x18($sp)
/* 8B384 800F1ED4 2402000E */  addiu     $v0, $zero, 0xE
/* 8B388 800F1ED8 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B38C 800F1EDC 0C051F32 */  jal       set_window_properties
/* 8B390 800F1EE0 AFA20020 */   sw       $v0, 0x20($sp)
/* 8B394 800F1EE4 2404000F */  addiu     $a0, $zero, 0xF
/* 8B398 800F1EE8 0C051F9F */  jal       set_window_update
/* 8B39C 800F1EEC 24050001 */   addiu    $a1, $zero, 0x1
/* 8B3A0 800F1EF0 24040011 */  addiu     $a0, $zero, 0x11
/* 8B3A4 800F1EF4 0803C902 */  j         .L800F2408
glabel func_800F1EF8
/* 8B3A8 800F1EF8 24050002 */   addiu    $a1, $zero, 0x2
glabel .L800F1EFC
/* 8B3AC 800F1EFC 2404000E */  addiu     $a0, $zero, 0xE
/* 8B3B0 800F1F00 2407008B */  addiu     $a3, $zero, 0x8B
/* 8B3B4 800F1F04 3C038011 */  lui       $v1, %hi(PopupMenu_DisplayedEntryCount)
/* 8B3B8 800F1F08 8063D656 */  lb        $v1, %lo(PopupMenu_DisplayedEntryCount)($v1)
/* 8B3BC 800F1F0C 24020014 */  addiu     $v0, $zero, 0x14
/* 8B3C0 800F1F10 AFA20014 */  sw        $v0, 0x14($sp)
/* 8B3C4 800F1F14 3C02800F */  lui       $v0, %hi(popup_menu_draw_menu_contents)
/* 8B3C8 800F1F18 24423680 */  addiu     $v0, $v0, %lo(popup_menu_draw_menu_contents)
/* 8B3CC 800F1F1C AFA20018 */  sw        $v0, 0x18($sp)
/* 8B3D0 800F1F20 2402FFFF */  addiu     $v0, $zero, -0x1
/* 8B3D4 800F1F24 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B3D8 800F1F28 AFA20020 */  sw        $v0, 0x20($sp)
/* 8B3DC 800F1F2C 00031040 */  sll       $v0, $v1, 1
/* 8B3E0 800F1F30 00431021 */  addu      $v0, $v0, $v1
/* 8B3E4 800F1F34 00021080 */  sll       $v0, $v0, 2
/* 8B3E8 800F1F38 00431021 */  addu      $v0, $v0, $v1
/* 8B3EC 800F1F3C 2442001A */  addiu     $v0, $v0, 0x1A
/* 8B3F0 800F1F40 0C051F32 */  jal       set_window_properties
/* 8B3F4 800F1F44 AFA20010 */   sw       $v0, 0x10($sp)
/* 8B3F8 800F1F48 24040011 */  addiu     $a0, $zero, 0x11
/* 8B3FC 800F1F4C 0803C8F0 */  j         .L800F23C0
/* 8B400 800F1F50 2405000D */   addiu    $a1, $zero, 0xD
glabel .L800F1F54
/* 8B404 800F1F54 2404000E */  addiu     $a0, $zero, 0xE
/* 8B408 800F1F58 240700A2 */  addiu     $a3, $zero, 0xA2
/* 8B40C 800F1F5C 3C038011 */  lui       $v1, %hi(PopupMenu_DisplayedEntryCount)
/* 8B410 800F1F60 8063D656 */  lb        $v1, %lo(PopupMenu_DisplayedEntryCount)($v1)
/* 8B414 800F1F64 24020014 */  addiu     $v0, $zero, 0x14
/* 8B418 800F1F68 AFA20014 */  sw        $v0, 0x14($sp)
/* 8B41C 800F1F6C 3C02800F */  lui       $v0, %hi(popup_menu_draw_menu_contents)
/* 8B420 800F1F70 24423680 */  addiu     $v0, $v0, %lo(popup_menu_draw_menu_contents)
/* 8B424 800F1F74 AFA20018 */  sw        $v0, 0x18($sp)
/* 8B428 800F1F78 2402FFFF */  addiu     $v0, $zero, -0x1
/* 8B42C 800F1F7C AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B430 800F1F80 AFA20020 */  sw        $v0, 0x20($sp)
/* 8B434 800F1F84 00031040 */  sll       $v0, $v1, 1
/* 8B438 800F1F88 00431021 */  addu      $v0, $v0, $v1
/* 8B43C 800F1F8C 00021080 */  sll       $v0, $v0, 2
/* 8B440 800F1F90 00431021 */  addu      $v0, $v0, $v1
/* 8B444 800F1F94 2442001A */  addiu     $v0, $v0, 0x1A
/* 8B448 800F1F98 0C051F32 */  jal       set_window_properties
/* 8B44C 800F1F9C AFA20010 */   sw       $v0, 0x10($sp)
/* 8B450 800F1FA0 2404000F */  addiu     $a0, $zero, 0xF
/* 8B454 800F1FA4 24050011 */  addiu     $a1, $zero, 0x11
/* 8B458 800F1FA8 2406FFFA */  addiu     $a2, $zero, -0x6
/* 8B45C 800F1FAC 24070060 */  addiu     $a3, $zero, 0x60
/* 8B460 800F1FB0 24020010 */  addiu     $v0, $zero, 0x10
/* 8B464 800F1FB4 AFA20010 */  sw        $v0, 0x10($sp)
/* 8B468 800F1FB8 24020015 */  addiu     $v0, $zero, 0x15
/* 8B46C 800F1FBC AFA20014 */  sw        $v0, 0x14($sp)
/* 8B470 800F1FC0 3C02800F */  lui       $v0, %hi(popup_menu_draw_title_contents)
/* 8B474 800F1FC4 24424648 */  addiu     $v0, $v0, %lo(popup_menu_draw_title_contents)
/* 8B478 800F1FC8 AFA20018 */  sw        $v0, 0x18($sp)
/* 8B47C 800F1FCC 2402000E */  addiu     $v0, $zero, 0xE
/* 8B480 800F1FD0 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B484 800F1FD4 0C051F32 */  jal       set_window_properties
/* 8B488 800F1FD8 AFA20020 */   sw       $v0, 0x20($sp)
/* 8B48C 800F1FDC 2404000F */  addiu     $a0, $zero, 0xF
/* 8B490 800F1FE0 0C051F9F */  jal       set_window_update
/* 8B494 800F1FE4 24050001 */   addiu    $a1, $zero, 0x1
/* 8B498 800F1FE8 24040011 */  addiu     $a0, $zero, 0x11
/* 8B49C 800F1FEC 0803C902 */  j         .L800F2408
/* 8B4A0 800F1FF0 24050002 */   addiu    $a1, $zero, 0x2
glabel .L800F1FF4
/* 8B4A4 800F1FF4 2404000E */  addiu     $a0, $zero, 0xE
/* 8B4A8 800F1FF8 24070092 */  addiu     $a3, $zero, 0x92
/* 8B4AC 800F1FFC 3C038011 */  lui       $v1, %hi(PopupMenu_DisplayedEntryCount)
/* 8B4B0 800F2000 8063D656 */  lb        $v1, %lo(PopupMenu_DisplayedEntryCount)($v1)
/* 8B4B4 800F2004 24020014 */  addiu     $v0, $zero, 0x14
/* 8B4B8 800F2008 AFA20014 */  sw        $v0, 0x14($sp)
/* 8B4BC 800F200C 3C02800F */  lui       $v0, %hi(popup_menu_draw_menu_contents)
/* 8B4C0 800F2010 24423680 */  addiu     $v0, $v0, %lo(popup_menu_draw_menu_contents)
/* 8B4C4 800F2014 AFA20018 */  sw        $v0, 0x18($sp)
/* 8B4C8 800F2018 2402FFFF */  addiu     $v0, $zero, -0x1
/* 8B4CC 800F201C AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B4D0 800F2020 AFA20020 */  sw        $v0, 0x20($sp)
/* 8B4D4 800F2024 00031040 */  sll       $v0, $v1, 1
/* 8B4D8 800F2028 00431021 */  addu      $v0, $v0, $v1
/* 8B4DC 800F202C 00021080 */  sll       $v0, $v0, 2
/* 8B4E0 800F2030 00431021 */  addu      $v0, $v0, $v1
/* 8B4E4 800F2034 2442001A */  addiu     $v0, $v0, 0x1A
/* 8B4E8 800F2038 0C051F32 */  jal       set_window_properties
/* 8B4EC 800F203C AFA20010 */   sw       $v0, 0x10($sp)
/* 8B4F0 800F2040 24040011 */  addiu     $a0, $zero, 0x11
/* 8B4F4 800F2044 0803C8F0 */  j         .L800F23C0
/* 8B4F8 800F2048 2405000C */   addiu    $a1, $zero, 0xC
glabel .L800F204C
/* 8B4FC 800F204C 2404000E */  addiu     $a0, $zero, 0xE
/* 8B500 800F2050 240700A7 */  addiu     $a3, $zero, 0xA7
/* 8B504 800F2054 3C038011 */  lui       $v1, %hi(PopupMenu_DisplayedEntryCount)
/* 8B508 800F2058 8063D656 */  lb        $v1, %lo(PopupMenu_DisplayedEntryCount)($v1)
/* 8B50C 800F205C 24020014 */  addiu     $v0, $zero, 0x14
/* 8B510 800F2060 AFA20014 */  sw        $v0, 0x14($sp)
/* 8B514 800F2064 3C02800F */  lui       $v0, %hi(popup_menu_draw_menu_contents)
/* 8B518 800F2068 24423680 */  addiu     $v0, $v0, %lo(popup_menu_draw_menu_contents)
/* 8B51C 800F206C AFA20018 */  sw        $v0, 0x18($sp)
/* 8B520 800F2070 2402FFFF */  addiu     $v0, $zero, -0x1
/* 8B524 800F2074 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B528 800F2078 AFA20020 */  sw        $v0, 0x20($sp)
/* 8B52C 800F207C 00031040 */  sll       $v0, $v1, 1
/* 8B530 800F2080 00431021 */  addu      $v0, $v0, $v1
/* 8B534 800F2084 00021080 */  sll       $v0, $v0, 2
/* 8B538 800F2088 00431021 */  addu      $v0, $v0, $v1
/* 8B53C 800F208C 2442001A */  addiu     $v0, $v0, 0x1A
/* 8B540 800F2090 0C051F32 */  jal       set_window_properties
/* 8B544 800F2094 AFA20010 */   sw       $v0, 0x10($sp)
/* 8B548 800F2098 2404000F */  addiu     $a0, $zero, 0xF
/* 8B54C 800F209C 24050016 */  addiu     $a1, $zero, 0x16
/* 8B550 800F20A0 2406FFFA */  addiu     $a2, $zero, -0x6
/* 8B554 800F20A4 2407005F */  addiu     $a3, $zero, 0x5F
/* 8B558 800F20A8 24020010 */  addiu     $v0, $zero, 0x10
/* 8B55C 800F20AC AFA20010 */  sw        $v0, 0x10($sp)
/* 8B560 800F20B0 24020015 */  addiu     $v0, $zero, 0x15
/* 8B564 800F20B4 AFA20014 */  sw        $v0, 0x14($sp)
/* 8B568 800F20B8 3C02800F */  lui       $v0, %hi(popup_menu_draw_title_contents)
/* 8B56C 800F20BC 24424648 */  addiu     $v0, $v0, %lo(popup_menu_draw_title_contents)
/* 8B570 800F20C0 AFA20018 */  sw        $v0, 0x18($sp)
/* 8B574 800F20C4 2402000E */  addiu     $v0, $zero, 0xE
/* 8B578 800F20C8 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B57C 800F20CC 0C051F32 */  jal       set_window_properties
/* 8B580 800F20D0 AFA20020 */   sw       $v0, 0x20($sp)
/* 8B584 800F20D4 2404000F */  addiu     $a0, $zero, 0xF
/* 8B588 800F20D8 0C051F9F */  jal       set_window_update
/* 8B58C 800F20DC 24050001 */   addiu    $a1, $zero, 0x1
/* 8B590 800F20E0 24040011 */  addiu     $a0, $zero, 0x11
/* 8B594 800F20E4 0803C902 */  j         .L800F2408
/* 8B598 800F20E8 24050002 */   addiu    $a1, $zero, 0x2
glabel .L800F20EC
/* 8B59C 800F20EC 2404000E */  addiu     $a0, $zero, 0xE
/* 8B5A0 800F20F0 240700AA */  addiu     $a3, $zero, 0xAA
/* 8B5A4 800F20F4 3C038011 */  lui       $v1, %hi(PopupMenu_DisplayedEntryCount)
/* 8B5A8 800F20F8 8063D656 */  lb        $v1, %lo(PopupMenu_DisplayedEntryCount)($v1)
/* 8B5AC 800F20FC 24020014 */  addiu     $v0, $zero, 0x14
/* 8B5B0 800F2100 AFA20014 */  sw        $v0, 0x14($sp)
/* 8B5B4 800F2104 3C02800F */  lui       $v0, %hi(popup_menu_draw_menu_contents)
/* 8B5B8 800F2108 24423680 */  addiu     $v0, $v0, %lo(popup_menu_draw_menu_contents)
/* 8B5BC 800F210C AFA20018 */  sw        $v0, 0x18($sp)
/* 8B5C0 800F2110 2402FFFF */  addiu     $v0, $zero, -0x1
/* 8B5C4 800F2114 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B5C8 800F2118 AFA20020 */  sw        $v0, 0x20($sp)
/* 8B5CC 800F211C 00031040 */  sll       $v0, $v1, 1
/* 8B5D0 800F2120 00431021 */  addu      $v0, $v0, $v1
/* 8B5D4 800F2124 00021080 */  sll       $v0, $v0, 2
/* 8B5D8 800F2128 00431021 */  addu      $v0, $v0, $v1
/* 8B5DC 800F212C 2442001A */  addiu     $v0, $v0, 0x1A
/* 8B5E0 800F2130 0C051F32 */  jal       set_window_properties
/* 8B5E4 800F2134 AFA20010 */   sw       $v0, 0x10($sp)
/* 8B5E8 800F2138 2404000F */  addiu     $a0, $zero, 0xF
/* 8B5EC 800F213C 24050020 */  addiu     $a1, $zero, 0x20
/* 8B5F0 800F2140 2406FFFA */  addiu     $a2, $zero, -0x6
/* 8B5F4 800F2144 24070068 */  addiu     $a3, $zero, 0x68
/* 8B5F8 800F2148 24020010 */  addiu     $v0, $zero, 0x10
/* 8B5FC 800F214C AFA20010 */  sw        $v0, 0x10($sp)
/* 8B600 800F2150 24020015 */  addiu     $v0, $zero, 0x15
/* 8B604 800F2154 AFA20014 */  sw        $v0, 0x14($sp)
/* 8B608 800F2158 3C02800F */  lui       $v0, %hi(popup_menu_draw_title_contents)
/* 8B60C 800F215C 24424648 */  addiu     $v0, $v0, %lo(popup_menu_draw_title_contents)
/* 8B610 800F2160 AFA20018 */  sw        $v0, 0x18($sp)
/* 8B614 800F2164 2402000E */  addiu     $v0, $zero, 0xE
/* 8B618 800F2168 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B61C 800F216C 0C051F32 */  jal       set_window_properties
/* 8B620 800F2170 AFA20020 */   sw       $v0, 0x20($sp)
/* 8B624 800F2174 2404000F */  addiu     $a0, $zero, 0xF
/* 8B628 800F2178 0C051F9F */  jal       set_window_update
/* 8B62C 800F217C 24050001 */   addiu    $a1, $zero, 0x1
/* 8B630 800F2180 24040011 */  addiu     $a0, $zero, 0x11
/* 8B634 800F2184 0803C902 */  j         .L800F2408
/* 8B638 800F2188 24050002 */   addiu    $a1, $zero, 0x2
glabel .L800F218C
/* 8B63C 800F218C 2404000E */  addiu     $a0, $zero, 0xE
/* 8B640 800F2190 24070091 */  addiu     $a3, $zero, 0x91
/* 8B644 800F2194 3C038011 */  lui       $v1, %hi(PopupMenu_DisplayedEntryCount)
/* 8B648 800F2198 8063D656 */  lb        $v1, %lo(PopupMenu_DisplayedEntryCount)($v1)
/* 8B64C 800F219C 24020014 */  addiu     $v0, $zero, 0x14
/* 8B650 800F21A0 AFA20014 */  sw        $v0, 0x14($sp)
/* 8B654 800F21A4 3C02800F */  lui       $v0, %hi(popup_menu_draw_menu_contents)
/* 8B658 800F21A8 24423680 */  addiu     $v0, $v0, %lo(popup_menu_draw_menu_contents)
/* 8B65C 800F21AC AFA20018 */  sw        $v0, 0x18($sp)
/* 8B660 800F21B0 2402FFFF */  addiu     $v0, $zero, -0x1
/* 8B664 800F21B4 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B668 800F21B8 AFA20020 */  sw        $v0, 0x20($sp)
/* 8B66C 800F21BC 00031040 */  sll       $v0, $v1, 1
/* 8B670 800F21C0 00431021 */  addu      $v0, $v0, $v1
/* 8B674 800F21C4 00021080 */  sll       $v0, $v0, 2
/* 8B678 800F21C8 00431021 */  addu      $v0, $v0, $v1
/* 8B67C 800F21CC 2442001A */  addiu     $v0, $v0, 0x1A
/* 8B680 800F21D0 0C051F32 */  jal       set_window_properties
/* 8B684 800F21D4 AFA20010 */   sw       $v0, 0x10($sp)
/* 8B688 800F21D8 2404000F */  addiu     $a0, $zero, 0xF
/* 8B68C 800F21DC 2405000C */  addiu     $a1, $zero, 0xC
/* 8B690 800F21E0 2406FFFA */  addiu     $a2, $zero, -0x6
/* 8B694 800F21E4 24070079 */  addiu     $a3, $zero, 0x79
/* 8B698 800F21E8 24020010 */  addiu     $v0, $zero, 0x10
/* 8B69C 800F21EC AFA20010 */  sw        $v0, 0x10($sp)
/* 8B6A0 800F21F0 24020015 */  addiu     $v0, $zero, 0x15
/* 8B6A4 800F21F4 AFA20014 */  sw        $v0, 0x14($sp)
/* 8B6A8 800F21F8 3C02800F */  lui       $v0, %hi(popup_menu_draw_title_contents)
/* 8B6AC 800F21FC 24424648 */  addiu     $v0, $v0, %lo(popup_menu_draw_title_contents)
/* 8B6B0 800F2200 AFA20018 */  sw        $v0, 0x18($sp)
/* 8B6B4 800F2204 2402000E */  addiu     $v0, $zero, 0xE
/* 8B6B8 800F2208 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B6BC 800F220C 0C051F32 */  jal       set_window_properties
/* 8B6C0 800F2210 AFA20020 */   sw       $v0, 0x20($sp)
/* 8B6C4 800F2214 2404000F */  addiu     $a0, $zero, 0xF
/* 8B6C8 800F2218 0C051F9F */  jal       set_window_update
/* 8B6CC 800F221C 24050001 */   addiu    $a1, $zero, 0x1
/* 8B6D0 800F2220 24040011 */  addiu     $a0, $zero, 0x11
/* 8B6D4 800F2224 0803C902 */  j         .L800F2408
/* 8B6D8 800F2228 24050002 */   addiu    $a1, $zero, 0x2
glabel .L800F222C
/* 8B6DC 800F222C 2404000E */  addiu     $a0, $zero, 0xE
/* 8B6E0 800F2230 24070080 */  addiu     $a3, $zero, 0x80
/* 8B6E4 800F2234 3C038011 */  lui       $v1, %hi(PopupMenu_DisplayedEntryCount)
/* 8B6E8 800F2238 8063D656 */  lb        $v1, %lo(PopupMenu_DisplayedEntryCount)($v1)
/* 8B6EC 800F223C 24020014 */  addiu     $v0, $zero, 0x14
/* 8B6F0 800F2240 AFA20014 */  sw        $v0, 0x14($sp)
/* 8B6F4 800F2244 3C02800F */  lui       $v0, %hi(popup_menu_draw_menu_contents)
/* 8B6F8 800F2248 24423680 */  addiu     $v0, $v0, %lo(popup_menu_draw_menu_contents)
/* 8B6FC 800F224C AFA20018 */  sw        $v0, 0x18($sp)
/* 8B700 800F2250 2402FFFF */  addiu     $v0, $zero, -0x1
/* 8B704 800F2254 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B708 800F2258 AFA20020 */  sw        $v0, 0x20($sp)
/* 8B70C 800F225C 00031040 */  sll       $v0, $v1, 1
/* 8B710 800F2260 00431021 */  addu      $v0, $v0, $v1
/* 8B714 800F2264 00021080 */  sll       $v0, $v0, 2
/* 8B718 800F2268 00431021 */  addu      $v0, $v0, $v1
/* 8B71C 800F226C 2442001A */  addiu     $v0, $v0, 0x1A
/* 8B720 800F2270 0C051F32 */  jal       set_window_properties
/* 8B724 800F2274 AFA20010 */   sw       $v0, 0x10($sp)
/* 8B728 800F2278 2404000F */  addiu     $a0, $zero, 0xF
/* 8B72C 800F227C 2405000C */  addiu     $a1, $zero, 0xC
/* 8B730 800F2280 2406FFFA */  addiu     $a2, $zero, -0x6
/* 8B734 800F2284 24070068 */  addiu     $a3, $zero, 0x68
/* 8B738 800F2288 24020010 */  addiu     $v0, $zero, 0x10
/* 8B73C 800F228C AFA20010 */  sw        $v0, 0x10($sp)
/* 8B740 800F2290 24020015 */  addiu     $v0, $zero, 0x15
/* 8B744 800F2294 AFA20014 */  sw        $v0, 0x14($sp)
/* 8B748 800F2298 3C02800F */  lui       $v0, %hi(popup_menu_draw_title_contents)
/* 8B74C 800F229C 24424648 */  addiu     $v0, $v0, %lo(popup_menu_draw_title_contents)
/* 8B750 800F22A0 AFA20018 */  sw        $v0, 0x18($sp)
/* 8B754 800F22A4 2402000E */  addiu     $v0, $zero, 0xE
/* 8B758 800F22A8 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B75C 800F22AC 0C051F32 */  jal       set_window_properties
/* 8B760 800F22B0 AFA20020 */   sw       $v0, 0x20($sp)
/* 8B764 800F22B4 2404000F */  addiu     $a0, $zero, 0xF
/* 8B768 800F22B8 0C051F9F */  jal       set_window_update
/* 8B76C 800F22BC 24050001 */   addiu    $a1, $zero, 0x1
/* 8B770 800F22C0 24040011 */  addiu     $a0, $zero, 0x11
/* 8B774 800F22C4 0803C902 */  j         .L800F2408
/* 8B778 800F22C8 24050002 */   addiu    $a1, $zero, 0x2
glabel .L800F22CC
/* 8B77C 800F22CC 2404000E */  addiu     $a0, $zero, 0xE
/* 8B780 800F22D0 24070095 */  addiu     $a3, $zero, 0x95
/* 8B784 800F22D4 3C038011 */  lui       $v1, %hi(PopupMenu_DisplayedEntryCount)
/* 8B788 800F22D8 8063D656 */  lb        $v1, %lo(PopupMenu_DisplayedEntryCount)($v1)
/* 8B78C 800F22DC 24020014 */  addiu     $v0, $zero, 0x14
/* 8B790 800F22E0 AFA20014 */  sw        $v0, 0x14($sp)
/* 8B794 800F22E4 3C02800F */  lui       $v0, %hi(popup_menu_draw_menu_contents)
/* 8B798 800F22E8 24423680 */  addiu     $v0, $v0, %lo(popup_menu_draw_menu_contents)
/* 8B79C 800F22EC AFA20018 */  sw        $v0, 0x18($sp)
/* 8B7A0 800F22F0 2402FFFF */  addiu     $v0, $zero, -0x1
/* 8B7A4 800F22F4 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B7A8 800F22F8 AFA20020 */  sw        $v0, 0x20($sp)
/* 8B7AC 800F22FC 00031040 */  sll       $v0, $v1, 1
/* 8B7B0 800F2300 00431021 */  addu      $v0, $v0, $v1
/* 8B7B4 800F2304 00021080 */  sll       $v0, $v0, 2
/* 8B7B8 800F2308 00431021 */  addu      $v0, $v0, $v1
/* 8B7BC 800F230C 2442001A */  addiu     $v0, $v0, 0x1A
/* 8B7C0 800F2310 0C051F32 */  jal       set_window_properties
/* 8B7C4 800F2314 AFA20010 */   sw       $v0, 0x10($sp)
/* 8B7C8 800F2318 2404000F */  addiu     $a0, $zero, 0xF
/* 8B7CC 800F231C 24050006 */  addiu     $a1, $zero, 0x6
/* 8B7D0 800F2320 2406FFFA */  addiu     $a2, $zero, -0x6
/* 8B7D4 800F2324 2407008B */  addiu     $a3, $zero, 0x8B
/* 8B7D8 800F2328 24020010 */  addiu     $v0, $zero, 0x10
/* 8B7DC 800F232C AFA20010 */  sw        $v0, 0x10($sp)
/* 8B7E0 800F2330 24020015 */  addiu     $v0, $zero, 0x15
/* 8B7E4 800F2334 AFA20014 */  sw        $v0, 0x14($sp)
/* 8B7E8 800F2338 3C02800F */  lui       $v0, %hi(popup_menu_draw_title_contents)
/* 8B7EC 800F233C 24424648 */  addiu     $v0, $v0, %lo(popup_menu_draw_title_contents)
/* 8B7F0 800F2340 AFA20018 */  sw        $v0, 0x18($sp)
/* 8B7F4 800F2344 2402000E */  addiu     $v0, $zero, 0xE
/* 8B7F8 800F2348 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B7FC 800F234C 0C051F32 */  jal       set_window_properties
/* 8B800 800F2350 AFA20020 */   sw       $v0, 0x20($sp)
/* 8B804 800F2354 2404000F */  addiu     $a0, $zero, 0xF
/* 8B808 800F2358 0C051F9F */  jal       set_window_update
/* 8B80C 800F235C 24050001 */   addiu    $a1, $zero, 0x1
/* 8B810 800F2360 24040011 */  addiu     $a0, $zero, 0x11
/* 8B814 800F2364 0803C902 */  j         .L800F2408
/* 8B818 800F2368 24050002 */   addiu    $a1, $zero, 0x2
glabel .L800F236C
/* 8B81C 800F236C 2404000E */  addiu     $a0, $zero, 0xE
/* 8B820 800F2370 24070083 */  addiu     $a3, $zero, 0x83
/* 8B824 800F2374 3C038011 */  lui       $v1, %hi(PopupMenu_DisplayedEntryCount)
/* 8B828 800F2378 8063D656 */  lb        $v1, %lo(PopupMenu_DisplayedEntryCount)($v1)
/* 8B82C 800F237C 24020014 */  addiu     $v0, $zero, 0x14
/* 8B830 800F2380 AFA20014 */  sw        $v0, 0x14($sp)
/* 8B834 800F2384 3C02800F */  lui       $v0, %hi(popup_menu_draw_menu_contents)
/* 8B838 800F2388 24423680 */  addiu     $v0, $v0, %lo(popup_menu_draw_menu_contents)
/* 8B83C 800F238C AFA20018 */  sw        $v0, 0x18($sp)
/* 8B840 800F2390 2402FFFF */  addiu     $v0, $zero, -0x1
/* 8B844 800F2394 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B848 800F2398 AFA20020 */  sw        $v0, 0x20($sp)
/* 8B84C 800F239C 00031040 */  sll       $v0, $v1, 1
/* 8B850 800F23A0 00431021 */  addu      $v0, $v0, $v1
/* 8B854 800F23A4 00021080 */  sll       $v0, $v0, 2
/* 8B858 800F23A8 00431021 */  addu      $v0, $v0, $v1
/* 8B85C 800F23AC 2442001A */  addiu     $v0, $v0, 0x1A
/* 8B860 800F23B0 0C051F32 */  jal       set_window_properties
/* 8B864 800F23B4 AFA20010 */   sw       $v0, 0x10($sp)
/* 8B868 800F23B8 24040011 */  addiu     $a0, $zero, 0x11
/* 8B86C 800F23BC 2405000A */  addiu     $a1, $zero, 0xA
.L800F23C0:
/* 8B870 800F23C0 2406FFFA */  addiu     $a2, $zero, -0x6
/* 8B874 800F23C4 24070072 */  addiu     $a3, $zero, 0x72
/* 8B878 800F23C8 24020010 */  addiu     $v0, $zero, 0x10
/* 8B87C 800F23CC AFA20010 */  sw        $v0, 0x10($sp)
/* 8B880 800F23D0 24020015 */  addiu     $v0, $zero, 0x15
/* 8B884 800F23D4 AFA20014 */  sw        $v0, 0x14($sp)
/* 8B888 800F23D8 3C02800F */  lui       $v0, %hi(popup_menu_draw_title_contents)
/* 8B88C 800F23DC 24424648 */  addiu     $v0, $v0, %lo(popup_menu_draw_title_contents)
/* 8B890 800F23E0 AFA20018 */  sw        $v0, 0x18($sp)
/* 8B894 800F23E4 2402000E */  addiu     $v0, $zero, 0xE
/* 8B898 800F23E8 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B89C 800F23EC 0C051F32 */  jal       set_window_properties
/* 8B8A0 800F23F0 AFA20020 */   sw       $v0, 0x20($sp)
/* 8B8A4 800F23F4 2404000F */  addiu     $a0, $zero, 0xF
/* 8B8A8 800F23F8 0C051F9F */  jal       set_window_update
/* 8B8AC 800F23FC 24050002 */   addiu    $a1, $zero, 0x2
/* 8B8B0 800F2400 24040011 */  addiu     $a0, $zero, 0x11
/* 8B8B4 800F2404 24050001 */  addiu     $a1, $zero, 0x1
.L800F2408:
/* 8B8B8 800F2408 0C051F9F */  jal       set_window_update
/* 8B8BC 800F240C 00000000 */   nop
.L800F2410:
/* 8B8C0 800F2410 3C028011 */  lui       $v0, %hi(gPopupMenu)
/* 8B8C4 800F2414 8C42D69C */  lw        $v0, %lo(gPopupMenu)($v0)
/* 8B8C8 800F2418 8C430318 */  lw        $v1, 0x318($v0)
/* 8B8CC 800F241C 24020003 */  addiu     $v0, $zero, 0x3
/* 8B8D0 800F2420 10620005 */  beq       $v1, $v0, .L800F2438
/* 8B8D4 800F2424 24020005 */   addiu    $v0, $zero, 0x5
/* 8B8D8 800F2428 10620006 */  beq       $v1, $v0, .L800F2444
/* 8B8DC 800F242C 24040010 */   addiu    $a0, $zero, 0x10
/* 8B8E0 800F2430 0803C91F */  j         .L800F247C
/* 8B8E4 800F2434 00000000 */   nop
.L800F2438:
/* 8B8E8 800F2438 24040010 */  addiu     $a0, $zero, 0x10
/* 8B8EC 800F243C 0803C912 */  j         .L800F2448
/* 8B8F0 800F2440 2405007E */   addiu    $a1, $zero, 0x7E
.L800F2444:
/* 8B8F4 800F2444 24050083 */  addiu     $a1, $zero, 0x83
.L800F2448:
/* 8B8F8 800F2448 2406FFF2 */  addiu     $a2, $zero, -0xE
/* 8B8FC 800F244C 24070020 */  addiu     $a3, $zero, 0x20
/* 8B900 800F2450 00E0102D */  daddu     $v0, $a3, $zero
/* 8B904 800F2454 AFA20010 */  sw        $v0, 0x10($sp)
/* 8B908 800F2458 24020015 */  addiu     $v0, $zero, 0x15
/* 8B90C 800F245C AFA20014 */  sw        $v0, 0x14($sp)
/* 8B910 800F2460 3C02800F */  lui       $v0, %hi(popup_draw_cost_icon)
/* 8B914 800F2464 24424C6C */  addiu     $v0, $v0, %lo(popup_draw_cost_icon)
/* 8B918 800F2468 AFA20018 */  sw        $v0, 0x18($sp)
/* 8B91C 800F246C 2402000E */  addiu     $v0, $zero, 0xE
/* 8B920 800F2470 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B924 800F2474 0C051F32 */  jal       set_window_properties
/* 8B928 800F2478 AFA20020 */   sw       $v0, 0x20($sp)
.L800F247C:
/* 8B92C 800F247C 3C108011 */  lui       $s0, %hi(gPopupMenu)
/* 8B930 800F2480 2610D69C */  addiu     $s0, $s0, %lo(gPopupMenu)
/* 8B934 800F2484 8E020000 */  lw        $v0, 0x0($s0)
/* 8B938 800F2488 8C430318 */  lw        $v1, 0x318($v0)
/* 8B93C 800F248C 24020003 */  addiu     $v0, $zero, 0x3
/* 8B940 800F2490 14620011 */  bne       $v1, $v0, .L800F24D8
/* 8B944 800F2494 24040014 */   addiu    $a0, $zero, 0x14
/* 8B948 800F2498 24070040 */  addiu     $a3, $zero, 0x40
/* 8B94C 800F249C 3C058011 */  lui       $a1, %hi(PopupMenu_StarPieceCounterPosX)
/* 8B950 800F24A0 84A5D688 */  lh        $a1, %lo(PopupMenu_StarPieceCounterPosX)($a1)
/* 8B954 800F24A4 3C068011 */  lui       $a2, %hi(PopupMenu_StarPieceCounterPosY)
/* 8B958 800F24A8 84C6D68A */  lh        $a2, %lo(PopupMenu_StarPieceCounterPosY)($a2)
/* 8B95C 800F24AC 0080102D */  daddu     $v0, $a0, $zero
/* 8B960 800F24B0 AFA20010 */  sw        $v0, 0x10($sp)
/* 8B964 800F24B4 24020015 */  addiu     $v0, $zero, 0x15
/* 8B968 800F24B8 AFA20014 */  sw        $v0, 0x14($sp)
/* 8B96C 800F24BC 3C02800F */  lui       $v0, %hi(func_800F4D28)
/* 8B970 800F24C0 24424D28 */  addiu     $v0, $v0, %lo(func_800F4D28)
/* 8B974 800F24C4 AFA20018 */  sw        $v0, 0x18($sp)
/* 8B978 800F24C8 2402FFFF */  addiu     $v0, $zero, -0x1
/* 8B97C 800F24CC AFA0001C */  sw        $zero, 0x1C($sp)
/* 8B980 800F24D0 0C051F32 */  jal       set_window_properties
/* 8B984 800F24D4 AFA20020 */   sw       $v0, 0x20($sp)
.L800F24D8:
/* 8B988 800F24D8 3C078011 */  lui       $a3, %hi(PopupMenu_FirstDisplayIndex)
/* 8B98C 800F24DC 24E7D654 */  addiu     $a3, $a3, %lo(PopupMenu_FirstDisplayIndex)
/* 8B990 800F24E0 0200582D */  daddu     $t3, $s0, $zero
/* 8B994 800F24E4 3C0A8011 */  lui       $t2, %hi(PopupMenu_MaxDisplayableEntryCount)
/* 8B998 800F24E8 254AD68F */  addiu     $t2, $t2, %lo(PopupMenu_MaxDisplayableEntryCount)
/* 8B99C 800F24EC 3C098011 */  lui       $t1, %hi(PopupMenu_LastDisplayIndex)
/* 8B9A0 800F24F0 8129D655 */  lb        $t1, %lo(PopupMenu_LastDisplayIndex)($t1)
/* 8B9A4 800F24F4 3C088011 */  lui       $t0, %hi(PopupMenu_SelectedIndex)
/* 8B9A8 800F24F8 8D08D648 */  lw        $t0, %lo(PopupMenu_SelectedIndex)($t0)
.L800F24FC:
/* 8B9AC 800F24FC 80E20000 */  lb        $v0, 0x0($a3)
/* 8B9B0 800F2500 90E30000 */  lbu       $v1, 0x0($a3)
/* 8B9B4 800F2504 00491021 */  addu      $v0, $v0, $t1
/* 8B9B8 800F2508 2442FFFF */  addiu     $v0, $v0, -0x1
/* 8B9BC 800F250C 0102102A */  slt       $v0, $t0, $v0
/* 8B9C0 800F2510 14400013 */  bnez      $v0, .L800F2560
/* 8B9C4 800F2514 0000302D */   daddu    $a2, $zero, $zero
/* 8B9C8 800F2518 24620001 */  addiu     $v0, $v1, 0x1
/* 8B9CC 800F251C A0E20000 */  sb        $v0, 0x0($a3)
/* 8B9D0 800F2520 00021600 */  sll       $v0, $v0, 24
/* 8B9D4 800F2524 8D650000 */  lw        $a1, 0x0($t3)
/* 8B9D8 800F2528 81440000 */  lb        $a0, 0x0($t2)
/* 8B9DC 800F252C 8CA30324 */  lw        $v1, 0x324($a1)
/* 8B9E0 800F2530 00021603 */  sra       $v0, $v0, 24
/* 8B9E4 800F2534 00641823 */  subu      $v1, $v1, $a0
/* 8B9E8 800F2538 0062182A */  slt       $v1, $v1, $v0
/* 8B9EC 800F253C 91440000 */  lbu       $a0, 0x0($t2)
/* 8B9F0 800F2540 50600007 */  beql      $v1, $zero, .L800F2560
/* 8B9F4 800F2544 24060001 */   addiu    $a2, $zero, 0x1
/* 8B9F8 800F2548 90A20327 */  lbu       $v0, 0x327($a1)
/* 8B9FC 800F254C 00441023 */  subu      $v0, $v0, $a0
/* 8BA00 800F2550 A0E20000 */  sb        $v0, 0x0($a3)
/* 8BA04 800F2554 00021600 */  sll       $v0, $v0, 24
/* 8BA08 800F2558 04420001 */  bltzl     $v0, .L800F2560
/* 8BA0C 800F255C A0E00000 */   sb       $zero, 0x0($a3)
.L800F2560:
/* 8BA10 800F2560 14C0FFE6 */  bnez      $a2, .L800F24FC
/* 8BA14 800F2564 00000000 */   nop
/* 8BA18 800F2568 3C038011 */  lui       $v1, %hi(PopupMenu_FirstDisplayIndex)
/* 8BA1C 800F256C 9063D654 */  lbu       $v1, %lo(PopupMenu_FirstDisplayIndex)($v1)
/* 8BA20 800F2570 3C028011 */  lui       $v0, %hi(PopupMenu_MaxDisplayableEntryCount)
/* 8BA24 800F2574 9042D68F */  lbu       $v0, %lo(PopupMenu_MaxDisplayableEntryCount)($v0)
/* 8BA28 800F2578 3C048011 */  lui       $a0, %hi(gPopupMenu)
/* 8BA2C 800F257C 8C84D69C */  lw        $a0, %lo(gPopupMenu)($a0)
/* 8BA30 800F2580 00621021 */  addu      $v0, $v1, $v0
/* 8BA34 800F2584 00031E00 */  sll       $v1, $v1, 24
/* 8BA38 800F2588 00031E03 */  sra       $v1, $v1, 24
/* 8BA3C 800F258C 00031823 */  negu      $v1, $v1
/* 8BA40 800F2590 3C018011 */  lui       $at, %hi(PopupMenu_LastDisplayIndex)
/* 8BA44 800F2594 A022D655 */  sb        $v0, %lo(PopupMenu_LastDisplayIndex)($at)
/* 8BA48 800F2598 00031040 */  sll       $v0, $v1, 1
/* 8BA4C 800F259C 00431021 */  addu      $v0, $v0, $v1
/* 8BA50 800F25A0 00021080 */  sll       $v0, $v0, 2
/* 8BA54 800F25A4 8C840318 */  lw        $a0, 0x318($a0)
/* 8BA58 800F25A8 00431021 */  addu      $v0, $v0, $v1
/* 8BA5C 800F25AC 3C018011 */  lui       $at, %hi(D_8010D658)
/* 8BA60 800F25B0 A422D658 */  sh        $v0, %lo(D_8010D658)($at)
/* 8BA64 800F25B4 04800016 */  bltz      $a0, .L800F2610
/* 8BA68 800F25B8 2882000A */   slti     $v0, $a0, 0xA
/* 8BA6C 800F25BC 54400004 */  bnel      $v0, $zero, .L800F25D0
/* 8BA70 800F25C0 24040013 */   addiu    $a0, $zero, 0x13
/* 8BA74 800F25C4 2402000C */  addiu     $v0, $zero, 0xC
/* 8BA78 800F25C8 14820011 */  bne       $a0, $v0, .L800F2610
/* 8BA7C 800F25CC 24040013 */   addiu    $a0, $zero, 0x13
.L800F25D0:
/* 8BA80 800F25D0 24070118 */  addiu     $a3, $zero, 0x118
/* 8BA84 800F25D4 3C058011 */  lui       $a1, %hi(D_8010D680)
/* 8BA88 800F25D8 84A5D680 */  lh        $a1, %lo(D_8010D680)($a1)
/* 8BA8C 800F25DC 3C068011 */  lui       $a2, %hi(D_8010D682)
/* 8BA90 800F25E0 84C6D682 */  lh        $a2, %lo(D_8010D682)($a2)
/* 8BA94 800F25E4 24020020 */  addiu     $v0, $zero, 0x20
/* 8BA98 800F25E8 AFA20010 */  sw        $v0, 0x10($sp)
/* 8BA9C 800F25EC 24020014 */  addiu     $v0, $zero, 0x14
/* 8BAA0 800F25F0 AFA20014 */  sw        $v0, 0x14($sp)
/* 8BAA4 800F25F4 3C02800F */  lui       $v0, %hi(func_800F48F4)
/* 8BAA8 800F25F8 244248F4 */  addiu     $v0, $v0, %lo(func_800F48F4)
/* 8BAAC 800F25FC AFA20018 */  sw        $v0, 0x18($sp)
/* 8BAB0 800F2600 2402FFFF */  addiu     $v0, $zero, -0x1
/* 8BAB4 800F2604 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8BAB8 800F2608 0C051F32 */  jal       set_window_properties
/* 8BABC 800F260C AFA20020 */   sw       $v0, 0x20($sp)
.L800F2610:
/* 8BAC0 800F2610 3C028011 */  lui       $v0, %hi(gPopupMenu)
/* 8BAC4 800F2614 8C42D69C */  lw        $v0, %lo(gPopupMenu)($v0)
/* 8BAC8 800F2618 3C058011 */  lui       $a1, %hi(D_8010D684)
/* 8BACC 800F261C 84A5D684 */  lh        $a1, %lo(D_8010D684)($a1)
/* 8BAD0 800F2620 8C430318 */  lw        $v1, 0x318($v0)
/* 8BAD4 800F2624 3C068011 */  lui       $a2, %hi(D_8010D686)
/* 8BAD8 800F2628 84C6D686 */  lh        $a2, %lo(D_8010D686)($a2)
/* 8BADC 800F262C 2C62000E */  sltiu     $v0, $v1, 0xE
/* 8BAE0 800F2630 10400026 */  beqz      $v0, .L800F26CC
/* 8BAE4 800F2634 00031080 */   sll      $v0, $v1, 2
/* 8BAE8 800F2638 3C018011 */  lui       $at, %hi(jtbl_8010C608)
/* 8BAEC 800F263C 00220821 */  addu      $at, $at, $v0
/* 8BAF0 800F2640 8C22C608 */  lw        $v0, %lo(jtbl_8010C608)($at)
/* 8BAF4 800F2644 00400008 */  jr        $v0
/* 8BAF8 800F2648 00000000 */   nop
glabel .L800F264C
/* 8BAFC 800F264C 24040015 */  addiu     $a0, $zero, 0x15
/* 8BB00 800F2650 0803C9A8 */  j         .L800F26A0
/* 8BB04 800F2654 24070090 */   addiu    $a3, $zero, 0x90
glabel .L800F2658
/* 8BB08 800F2658 24040015 */  addiu     $a0, $zero, 0x15
/* 8BB0C 800F265C 24070090 */  addiu     $a3, $zero, 0x90
/* 8BB10 800F2660 0803C9A9 */  j         .L800F26A4
/* 8BB14 800F2664 24020028 */   addiu    $v0, $zero, 0x28
glabel .L800F2668
/* 8BB18 800F2668 24040015 */  addiu     $a0, $zero, 0x15
/* 8BB1C 800F266C 24070080 */  addiu     $a3, $zero, 0x80
/* 8BB20 800F2670 0803C9A9 */  j         .L800F26A4
/* 8BB24 800F2674 24020028 */   addiu    $v0, $zero, 0x28
glabel .L800F2678
/* 8BB28 800F2678 24040015 */  addiu     $a0, $zero, 0x15
/* 8BB2C 800F267C 24070088 */  addiu     $a3, $zero, 0x88
/* 8BB30 800F2680 0803C9A9 */  j         .L800F26A4
/* 8BB34 800F2684 24020028 */   addiu    $v0, $zero, 0x28
glabel .L800F2688
/* 8BB38 800F2688 24040015 */  addiu     $a0, $zero, 0x15
/* 8BB3C 800F268C 24070070 */  addiu     $a3, $zero, 0x70
/* 8BB40 800F2690 0803C9A9 */  j         .L800F26A4
/* 8BB44 800F2694 24020028 */   addiu    $v0, $zero, 0x28
glabel .L800F2698
/* 8BB48 800F2698 24040015 */  addiu     $a0, $zero, 0x15
/* 8BB4C 800F269C 24070078 */  addiu     $a3, $zero, 0x78
.L800F26A0:
/* 8BB50 800F26A0 24020020 */  addiu     $v0, $zero, 0x20
.L800F26A4:
/* 8BB54 800F26A4 AFA20010 */  sw        $v0, 0x10($sp)
/* 8BB58 800F26A8 24020014 */  addiu     $v0, $zero, 0x14
/* 8BB5C 800F26AC AFA20014 */  sw        $v0, 0x14($sp)
/* 8BB60 800F26B0 3C02800F */  lui       $v0, %hi(func_800F4944)
/* 8BB64 800F26B4 24424944 */  addiu     $v0, $v0, %lo(func_800F4944)
/* 8BB68 800F26B8 AFA20018 */  sw        $v0, 0x18($sp)
/* 8BB6C 800F26BC 2402FFFF */  addiu     $v0, $zero, -0x1
/* 8BB70 800F26C0 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8BB74 800F26C4 0C051F32 */  jal       set_window_properties
/* 8BB78 800F26C8 AFA20020 */   sw       $v0, 0x20($sp)
.L800F26CC:
/* 8BB7C 800F26CC 3C028011 */  lui       $v0, %hi(PopupNotBattle)
/* 8BB80 800F26D0 8042D68E */  lb        $v0, %lo(PopupNotBattle)($v0)
/* 8BB84 800F26D4 14400018 */  bnez      $v0, .L800F2738
/* 8BB88 800F26D8 00000000 */   nop
/* 8BB8C 800F26DC 3C028011 */  lui       $v0, %hi(gPopupMenu)
/* 8BB90 800F26E0 8C42D69C */  lw        $v0, %lo(gPopupMenu)($v0)
/* 8BB94 800F26E4 8C430318 */  lw        $v1, 0x318($v0)
/* 8BB98 800F26E8 2C62000E */  sltiu     $v0, $v1, 0xE
/* 8BB9C 800F26EC 1040003A */  beqz      $v0, .L800F27D8
/* 8BBA0 800F26F0 00031080 */   sll      $v0, $v1, 2
/* 8BBA4 800F26F4 3C018011 */  lui       $at, %hi(jtbl_8010C640)
/* 8BBA8 800F26F8 00220821 */  addu      $at, $at, $v0
/* 8BBAC 800F26FC 8C22C640 */  lw        $v0, %lo(jtbl_8010C640)($at)
/* 8BBB0 800F2700 00400008 */  jr        $v0
/* 8BBB4 800F2704 00000000 */   nop
glabel .L800F2708
/* 8BBB8 800F2708 2404000E */  addiu     $a0, $zero, 0xE
/* 8BBBC 800F270C 0C051F9F */  jal       set_window_update
/* 8BBC0 800F2710 24050001 */   addiu    $a1, $zero, 0x1
/* 8BBC4 800F2714 0803C9F4 */  j         .L800F27D0
/* 8BBC8 800F2718 24040013 */   addiu    $a0, $zero, 0x13
glabel .L800F271C
/* 8BBCC 800F271C 2404000E */  addiu     $a0, $zero, 0xE
/* 8BBD0 800F2720 0C051F9F */  jal       set_window_update
/* 8BBD4 800F2724 24050001 */   addiu    $a1, $zero, 0x1
/* 8BBD8 800F2728 0803C9F4 */  j         .L800F27D0
/* 8BBDC 800F272C 24040013 */   addiu    $a0, $zero, 0x13
glabel .L800F2730
/* 8BBE0 800F2730 0803C9F4 */  j         .L800F27D0
/* 8BBE4 800F2734 2404000E */   addiu    $a0, $zero, 0xE
.L800F2738:
/* 8BBE8 800F2738 3C028011 */  lui       $v0, %hi(gPopupMenu)
/* 8BBEC 800F273C 8C42D69C */  lw        $v0, %lo(gPopupMenu)($v0)
/* 8BBF0 800F2740 8C430318 */  lw        $v1, 0x318($v0)
/* 8BBF4 800F2744 2C62000E */  sltiu     $v0, $v1, 0xE
/* 8BBF8 800F2748 10400020 */  beqz      $v0, .L800F27CC
/* 8BBFC 800F274C 00031080 */   sll      $v0, $v1, 2
/* 8BC00 800F2750 3C018011 */  lui       $at, %hi(jtbl_8010C678)
/* 8BC04 800F2754 00220821 */  addu      $at, $at, $v0
/* 8BC08 800F2758 8C22C678 */  lw        $v0, %lo(jtbl_8010C678)($at)
/* 8BC0C 800F275C 00400008 */  jr        $v0
/* 8BC10 800F2760 00000000 */   nop
glabel .L800F2764
/* 8BC14 800F2764 2404000E */  addiu     $a0, $zero, 0xE
/* 8BC18 800F2768 3C108014 */  lui       $s0, %hi(basic_window_update)
/* 8BC1C 800F276C 26107474 */  addiu     $s0, $s0, %lo(basic_window_update)
/* 8BC20 800F2770 0C051F9F */  jal       set_window_update
/* 8BC24 800F2774 0200282D */   daddu    $a1, $s0, $zero
/* 8BC28 800F2778 0803C9E6 */  j         .L800F2798
/* 8BC2C 800F277C 24040001 */   addiu    $a0, $zero, 0x1
glabel .L800F2780
/* 8BC30 800F2780 2404000E */  addiu     $a0, $zero, 0xE
/* 8BC34 800F2784 3C108014 */  lui       $s0, %hi(basic_window_update)
/* 8BC38 800F2788 26107474 */  addiu     $s0, $s0, %lo(basic_window_update)
/* 8BC3C 800F278C 0C051F9F */  jal       set_window_update
/* 8BC40 800F2790 0200282D */   daddu    $a1, $s0, $zero
/* 8BC44 800F2794 24040002 */  addiu     $a0, $zero, 0x2
.L800F2798:
/* 8BC48 800F2798 0C05272D */  jal       sfx_play_sound
/* 8BC4C 800F279C 00000000 */   nop
/* 8BC50 800F27A0 24040013 */  addiu     $a0, $zero, 0x13
/* 8BC54 800F27A4 0C051F9F */  jal       set_window_update
/* 8BC58 800F27A8 0200282D */   daddu    $a1, $s0, $zero
/* 8BC5C 800F27AC 0803C9F4 */  j         .L800F27D0
/* 8BC60 800F27B0 24040015 */   addiu    $a0, $zero, 0x15
glabel .L800F27B4
/* 8BC64 800F27B4 3C058014 */  lui       $a1, %hi(basic_window_update)
/* 8BC68 800F27B8 24A57474 */  addiu     $a1, $a1, %lo(basic_window_update)
/* 8BC6C 800F27BC 0C051F9F */  jal       set_window_update
/* 8BC70 800F27C0 2404000E */   addiu    $a0, $zero, 0xE
/* 8BC74 800F27C4 0C05272D */  jal       sfx_play_sound
/* 8BC78 800F27C8 24040001 */   addiu    $a0, $zero, 0x1
.L800F27CC:
/* 8BC7C 800F27CC 24040015 */  addiu     $a0, $zero, 0x15
.L800F27D0:
/* 8BC80 800F27D0 0C051F9F */  jal       set_window_update
/* 8BC84 800F27D4 24050001 */   addiu    $a1, $zero, 0x1
.L800F27D8:
/* 8BC88 800F27D8 3C118011 */  lui       $s1, %hi(gPopupMenu)
/* 8BC8C 800F27DC 2631D69C */  addiu     $s1, $s1, %lo(gPopupMenu)
/* 8BC90 800F27E0 8E220000 */  lw        $v0, 0x0($s1)
/* 8BC94 800F27E4 8C430318 */  lw        $v1, 0x318($v0)
/* 8BC98 800F27E8 24020003 */  addiu     $v0, $zero, 0x3
/* 8BC9C 800F27EC 14620008 */  bne       $v1, $v0, .L800F2810
/* 8BCA0 800F27F0 24040010 */   addiu    $a0, $zero, 0x10
/* 8BCA4 800F27F4 3C108014 */  lui       $s0, %hi(basic_window_update)
/* 8BCA8 800F27F8 26107474 */  addiu     $s0, $s0, %lo(basic_window_update)
/* 8BCAC 800F27FC 0C051F9F */  jal       set_window_update
/* 8BCB0 800F2800 0200282D */   daddu    $a1, $s0, $zero
/* 8BCB4 800F2804 24040014 */  addiu     $a0, $zero, 0x14
/* 8BCB8 800F2808 0C051F9F */  jal       set_window_update
/* 8BCBC 800F280C 0200282D */   daddu    $a1, $s0, $zero
.L800F2810:
/* 8BCC0 800F2810 8E220000 */  lw        $v0, 0x0($s1)
/* 8BCC4 800F2814 8C430318 */  lw        $v1, 0x318($v0)
/* 8BCC8 800F2818 24020004 */  addiu     $v0, $zero, 0x4
/* 8BCCC 800F281C 14620005 */  bne       $v1, $v0, .L800F2834
/* 8BCD0 800F2820 00000000 */   nop
/* 8BCD4 800F2824 3C058014 */  lui       $a1, %hi(basic_window_update)
/* 8BCD8 800F2828 24A57474 */  addiu     $a1, $a1, %lo(basic_window_update)
/* 8BCDC 800F282C 0C051F9F */  jal       set_window_update
/* 8BCE0 800F2830 24040012 */   addiu    $a0, $zero, 0x12
.L800F2834:
/* 8BCE4 800F2834 8E220000 */  lw        $v0, 0x0($s1)
/* 8BCE8 800F2838 8C430318 */  lw        $v1, 0x318($v0)
/* 8BCEC 800F283C 24020005 */  addiu     $v0, $zero, 0x5
/* 8BCF0 800F2840 14620382 */  bne       $v1, $v0, .L800F364C
/* 8BCF4 800F2844 24020001 */   addiu    $v0, $zero, 0x1
/* 8BCF8 800F2848 3C058014 */  lui       $a1, %hi(basic_window_update)
/* 8BCFC 800F284C 24A57474 */  addiu     $a1, $a1, %lo(basic_window_update)
/* 8BD00 800F2850 0C051F9F */  jal       set_window_update
/* 8BD04 800F2854 24040010 */   addiu    $a0, $zero, 0x10
/* 8BD08 800F2858 0803CD93 */  j         .L800F364C
/* 8BD0C 800F285C 24020001 */   addiu    $v0, $zero, 0x1
glabel .L800F2860
/* 8BD10 800F2860 3C038011 */  lui       $v1, %hi(D_8010D644)
/* 8BD14 800F2864 2463D644 */  addiu     $v1, $v1, %lo(D_8010D644)
/* 8BD18 800F2868 8C620000 */  lw        $v0, 0x0($v1)
/* 8BD1C 800F286C 10400003 */  beqz      $v0, .L800F287C
/* 8BD20 800F2870 2442FFFF */   addiu    $v0, $v0, -0x1
/* 8BD24 800F2874 0803CD95 */  j         .L800F3654
/* 8BD28 800F2878 AC620000 */   sw       $v0, 0x0($v1)
.L800F287C:
/* 8BD2C 800F287C 3C060001 */  lui       $a2, (0x12000 >> 16)
/* 8BD30 800F2880 3C058011 */  lui       $a1, %hi(PopupMenu_SelectedIndex)
/* 8BD34 800F2884 24A5D648 */  addiu     $a1, $a1, %lo(PopupMenu_SelectedIndex)
/* 8BD38 800F2888 3C048007 */  lui       $a0, %hi(gGameStatusPtr)
/* 8BD3C 800F288C 8C84419C */  lw        $a0, %lo(gGameStatusPtr)($a0)
/* 8BD40 800F2890 8CA30000 */  lw        $v1, 0x0($a1)
/* 8BD44 800F2894 8C820020 */  lw        $v0, 0x20($a0)
/* 8BD48 800F2898 34C62000 */  ori       $a2, $a2, (0x12000 & 0xFFFF)
/* 8BD4C 800F289C 3C018011 */  lui       $at, %hi(PopupMenu_PrevSelectedIndex)
/* 8BD50 800F28A0 AC23D64C */  sw        $v1, %lo(PopupMenu_PrevSelectedIndex)($at)
/* 8BD54 800F28A4 00461024 */  and       $v0, $v0, $a2
/* 8BD58 800F28A8 10400008 */  beqz      $v0, .L800F28CC
/* 8BD5C 800F28AC 00000000 */   nop
/* 8BD60 800F28B0 1C600005 */  bgtz      $v1, .L800F28C8
/* 8BD64 800F28B4 2462FFFF */   addiu    $v0, $v1, -0x1
/* 8BD68 800F28B8 8C820010 */  lw        $v0, 0x10($a0)
/* 8BD6C 800F28BC 00461024 */  and       $v0, $v0, $a2
/* 8BD70 800F28C0 10400002 */  beqz      $v0, .L800F28CC
/* 8BD74 800F28C4 2462FFFF */   addiu    $v0, $v1, -0x1
.L800F28C8:
/* 8BD78 800F28C8 ACA20000 */  sw        $v0, 0x0($a1)
.L800F28CC:
/* 8BD7C 800F28CC 3C058007 */  lui       $a1, %hi(gGameStatusPtr)
/* 8BD80 800F28D0 8CA5419C */  lw        $a1, %lo(gGameStatusPtr)($a1)
/* 8BD84 800F28D4 3C060002 */  lui       $a2, (0x20010 >> 16)
/* 8BD88 800F28D8 8CA20020 */  lw        $v0, 0x20($a1)
/* 8BD8C 800F28DC 34C60010 */  ori       $a2, $a2, (0x20010 & 0xFFFF)
/* 8BD90 800F28E0 00461024 */  and       $v0, $v0, $a2
/* 8BD94 800F28E4 10400010 */  beqz      $v0, .L800F2928
/* 8BD98 800F28E8 00000000 */   nop
/* 8BD9C 800F28EC 3C028011 */  lui       $v0, %hi(gPopupMenu)
/* 8BDA0 800F28F0 8C42D69C */  lw        $v0, %lo(gPopupMenu)($v0)
/* 8BDA4 800F28F4 3C048011 */  lui       $a0, %hi(PopupMenu_SelectedIndex)
/* 8BDA8 800F28F8 2484D648 */  addiu     $a0, $a0, %lo(PopupMenu_SelectedIndex)
/* 8BDAC 800F28FC 8C420324 */  lw        $v0, 0x324($v0)
/* 8BDB0 800F2900 8C830000 */  lw        $v1, 0x0($a0)
/* 8BDB4 800F2904 2442FFFF */  addiu     $v0, $v0, -0x1
/* 8BDB8 800F2908 0062102A */  slt       $v0, $v1, $v0
/* 8BDBC 800F290C 14400005 */  bnez      $v0, .L800F2924
/* 8BDC0 800F2910 24620001 */   addiu    $v0, $v1, 0x1
/* 8BDC4 800F2914 8CA20010 */  lw        $v0, 0x10($a1)
/* 8BDC8 800F2918 00461024 */  and       $v0, $v0, $a2
/* 8BDCC 800F291C 10400002 */  beqz      $v0, .L800F2928
/* 8BDD0 800F2920 24620001 */   addiu    $v0, $v1, 0x1
.L800F2924:
/* 8BDD4 800F2924 AC820000 */  sw        $v0, 0x0($a0)
.L800F2928:
/* 8BDD8 800F2928 3C108011 */  lui       $s0, %hi(PopupMenu_SelectedIndex)
/* 8BDDC 800F292C 2610D648 */  addiu     $s0, $s0, %lo(PopupMenu_SelectedIndex)
/* 8BDE0 800F2930 8E020000 */  lw        $v0, 0x0($s0)
/* 8BDE4 800F2934 04410006 */  bgez      $v0, .L800F2950
/* 8BDE8 800F2938 00000000 */   nop
/* 8BDEC 800F293C 3C028011 */  lui       $v0, %hi(gPopupMenu)
/* 8BDF0 800F2940 8C42D69C */  lw        $v0, %lo(gPopupMenu)($v0)
/* 8BDF4 800F2944 8C420324 */  lw        $v0, 0x324($v0)
/* 8BDF8 800F2948 2442FFFF */  addiu     $v0, $v0, -0x1
/* 8BDFC 800F294C AE020000 */  sw        $v0, 0x0($s0)
.L800F2950:
/* 8BE00 800F2950 3C028011 */  lui       $v0, %hi(gPopupMenu)
/* 8BE04 800F2954 8C42D69C */  lw        $v0, %lo(gPopupMenu)($v0)
/* 8BE08 800F2958 8C420324 */  lw        $v0, 0x324($v0)
/* 8BE0C 800F295C 8E030000 */  lw        $v1, 0x0($s0)
/* 8BE10 800F2960 2442FFFF */  addiu     $v0, $v0, -0x1
/* 8BE14 800F2964 0043102A */  slt       $v0, $v0, $v1
/* 8BE18 800F2968 54400001 */  bnel      $v0, $zero, .L800F2970
/* 8BE1C 800F296C AE000000 */   sw       $zero, 0x0($s0)
.L800F2970:
/* 8BE20 800F2970 3C038011 */  lui       $v1, %hi(PopupMenu_PrevSelectedIndex)
/* 8BE24 800F2974 8C63D64C */  lw        $v1, %lo(PopupMenu_PrevSelectedIndex)($v1)
/* 8BE28 800F2978 8E020000 */  lw        $v0, 0x0($s0)
/* 8BE2C 800F297C 10620004 */  beq       $v1, $v0, .L800F2990
/* 8BE30 800F2980 0000302D */   daddu    $a2, $zero, $zero
/* 8BE34 800F2984 0C05272D */  jal       sfx_play_sound
/* 8BE38 800F2988 240400C7 */   addiu    $a0, $zero, 0xC7
/* 8BE3C 800F298C 0000302D */  daddu     $a2, $zero, $zero
.L800F2990:
/* 8BE40 800F2990 3C058011 */  lui       $a1, %hi(PopupMenu_FirstDisplayIndex)
/* 8BE44 800F2994 24A5D654 */  addiu     $a1, $a1, %lo(PopupMenu_FirstDisplayIndex)
/* 8BE48 800F2998 8E030000 */  lw        $v1, 0x0($s0)
.L800F299C:
/* 8BE4C 800F299C 80A20000 */  lb        $v0, 0x0($a1)
/* 8BE50 800F29A0 90A40000 */  lbu       $a0, 0x0($a1)
/* 8BE54 800F29A4 24420001 */  addiu     $v0, $v0, 0x1
/* 8BE58 800F29A8 0062102A */  slt       $v0, $v1, $v0
/* 8BE5C 800F29AC 50400007 */  beql      $v0, $zero, .L800F29CC
/* 8BE60 800F29B0 24C60001 */   addiu    $a2, $a2, 0x1
/* 8BE64 800F29B4 2482FFFF */  addiu     $v0, $a0, -0x1
/* 8BE68 800F29B8 A0A20000 */  sb        $v0, 0x0($a1)
/* 8BE6C 800F29BC 00021600 */  sll       $v0, $v0, 24
/* 8BE70 800F29C0 04420001 */  bltzl     $v0, .L800F29C8
/* 8BE74 800F29C4 A0A00000 */   sb       $zero, 0x0($a1)
.L800F29C8:
/* 8BE78 800F29C8 24C60001 */  addiu     $a2, $a2, 0x1
.L800F29CC:
/* 8BE7C 800F29CC 28C20004 */  slti      $v0, $a2, 0x4
/* 8BE80 800F29D0 1440FFF2 */  bnez      $v0, .L800F299C
/* 8BE84 800F29D4 00000000 */   nop
/* 8BE88 800F29D8 0000302D */  daddu     $a2, $zero, $zero
/* 8BE8C 800F29DC 3C098011 */  lui       $t1, %hi(PopupMenu_LastDisplayIndex)
/* 8BE90 800F29E0 2529D655 */  addiu     $t1, $t1, %lo(PopupMenu_LastDisplayIndex)
/* 8BE94 800F29E4 3C0A8011 */  lui       $t2, %hi(PopupMenu_SelectedIndex)
/* 8BE98 800F29E8 8D4AD648 */  lw        $t2, %lo(PopupMenu_SelectedIndex)($t2)
/* 8BE9C 800F29EC 3C078011 */  lui       $a3, %hi(PopupMenu_FirstDisplayIndex)
/* 8BEA0 800F29F0 24E7D654 */  addiu     $a3, $a3, %lo(PopupMenu_FirstDisplayIndex)
/* 8BEA4 800F29F4 3C0B8011 */  lui       $t3, %hi(gPopupMenu)
/* 8BEA8 800F29F8 256BD69C */  addiu     $t3, $t3, %lo(gPopupMenu)
/* 8BEAC 800F29FC 3C088011 */  lui       $t0, %hi(PopupMenu_MaxDisplayableEntryCount)
/* 8BEB0 800F2A00 2508D68F */  addiu     $t0, $t0, %lo(PopupMenu_MaxDisplayableEntryCount)
.L800F2A04:
/* 8BEB4 800F2A04 81220000 */  lb        $v0, 0x0($t1)
/* 8BEB8 800F2A08 2442FFFF */  addiu     $v0, $v0, -0x1
/* 8BEBC 800F2A0C 0142102A */  slt       $v0, $t2, $v0
/* 8BEC0 800F2A10 14400013 */  bnez      $v0, .L800F2A60
/* 8BEC4 800F2A14 00000000 */   nop
/* 8BEC8 800F2A18 90E20000 */  lbu       $v0, 0x0($a3)
/* 8BECC 800F2A1C 24420001 */  addiu     $v0, $v0, 0x1
/* 8BED0 800F2A20 A0E20000 */  sb        $v0, 0x0($a3)
/* 8BED4 800F2A24 00021600 */  sll       $v0, $v0, 24
/* 8BED8 800F2A28 8D650000 */  lw        $a1, 0x0($t3)
/* 8BEDC 800F2A2C 81040000 */  lb        $a0, 0x0($t0)
/* 8BEE0 800F2A30 8CA30324 */  lw        $v1, 0x324($a1)
/* 8BEE4 800F2A34 00021603 */  sra       $v0, $v0, 24
/* 8BEE8 800F2A38 00641823 */  subu      $v1, $v1, $a0
/* 8BEEC 800F2A3C 0062182A */  slt       $v1, $v1, $v0
/* 8BEF0 800F2A40 10600007 */  beqz      $v1, .L800F2A60
/* 8BEF4 800F2A44 91040000 */   lbu      $a0, 0x0($t0)
/* 8BEF8 800F2A48 90A20327 */  lbu       $v0, 0x327($a1)
/* 8BEFC 800F2A4C 00441023 */  subu      $v0, $v0, $a0
/* 8BF00 800F2A50 A0E20000 */  sb        $v0, 0x0($a3)
/* 8BF04 800F2A54 00021600 */  sll       $v0, $v0, 24
/* 8BF08 800F2A58 04420001 */  bltzl     $v0, .L800F2A60
/* 8BF0C 800F2A5C A0E00000 */   sb       $zero, 0x0($a3)
.L800F2A60:
/* 8BF10 800F2A60 90E20000 */  lbu       $v0, 0x0($a3)
/* 8BF14 800F2A64 91030000 */  lbu       $v1, 0x0($t0)
/* 8BF18 800F2A68 24C60001 */  addiu     $a2, $a2, 0x1
/* 8BF1C 800F2A6C 00431021 */  addu      $v0, $v0, $v1
/* 8BF20 800F2A70 A1220000 */  sb        $v0, 0x0($t1)
/* 8BF24 800F2A74 28C20004 */  slti      $v0, $a2, 0x4
/* 8BF28 800F2A78 1440FFE2 */  bnez      $v0, .L800F2A04
/* 8BF2C 800F2A7C 00000000 */   nop
/* 8BF30 800F2A80 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 8BF34 800F2A84 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 8BF38 800F2A88 8C420010 */  lw        $v0, 0x10($v0)
/* 8BF3C 800F2A8C 30428000 */  andi      $v0, $v0, 0x8000
/* 8BF40 800F2A90 1040003F */  beqz      $v0, .L800F2B90
/* 8BF44 800F2A94 00000000 */   nop
/* 8BF48 800F2A98 3C028011 */  lui       $v0, %hi(gPopupMenu)
/* 8BF4C 800F2A9C 8C42D69C */  lw        $v0, %lo(gPopupMenu)($v0)
/* 8BF50 800F2AA0 8C430318 */  lw        $v1, 0x318($v0)
/* 8BF54 800F2AA4 24020008 */  addiu     $v0, $zero, 0x8
/* 8BF58 800F2AA8 10620005 */  beq       $v1, $v0, .L800F2AC0
/* 8BF5C 800F2AAC 2402000D */   addiu    $v0, $zero, 0xD
/* 8BF60 800F2AB0 1062000B */  beq       $v1, $v0, .L800F2AE0
/* 8BF64 800F2AB4 00000000 */   nop
/* 8BF68 800F2AB8 0803CAC0 */  j         .L800F2B00
/* 8BF6C 800F2ABC 00000000 */   nop
.L800F2AC0:
/* 8BF70 800F2AC0 0C05272D */  jal       sfx_play_sound
/* 8BF74 800F2AC4 240400C9 */   addiu    $a0, $zero, 0xC9
/* 8BF78 800F2AC8 3C028011 */  lui       $v0, %hi(PopupNotBattle)
/* 8BF7C 800F2ACC 8042D68E */  lb        $v0, %lo(PopupNotBattle)($v0)
/* 8BF80 800F2AD0 144002DE */  bnez      $v0, .L800F364C
/* 8BF84 800F2AD4 2402FFFE */   addiu    $v0, $zero, -0x2
/* 8BF88 800F2AD8 0803CD93 */  j         .L800F364C
/* 8BF8C 800F2ADC 2402FFFF */   addiu    $v0, $zero, -0x1
.L800F2AE0:
/* 8BF90 800F2AE0 0C05272D */  jal       sfx_play_sound
/* 8BF94 800F2AE4 240400C9 */   addiu    $a0, $zero, 0xC9
/* 8BF98 800F2AE8 3C028011 */  lui       $v0, %hi(PopupNotBattle)
/* 8BF9C 800F2AEC 8042D68E */  lb        $v0, %lo(PopupNotBattle)($v0)
/* 8BFA0 800F2AF0 144002D6 */  bnez      $v0, .L800F364C
/* 8BFA4 800F2AF4 2402FFFE */   addiu    $v0, $zero, -0x2
/* 8BFA8 800F2AF8 0803CD93 */  j         .L800F364C
/* 8BFAC 800F2AFC 2402FFFF */   addiu    $v0, $zero, -0x1
.L800F2B00:
/* 8BFB0 800F2B00 3C028011 */  lui       $v0, %hi(PopupMenu_SelectedIndex)
/* 8BFB4 800F2B04 8C42D648 */  lw        $v0, %lo(PopupMenu_SelectedIndex)($v0)
/* 8BFB8 800F2B08 3C038011 */  lui       $v1, %hi(gPopupMenu)
/* 8BFBC 800F2B0C 8C63D69C */  lw        $v1, %lo(gPopupMenu)($v1)
/* 8BFC0 800F2B10 00021080 */  sll       $v0, $v0, 2
/* 8BFC4 800F2B14 00621021 */  addu      $v0, $v1, $v0
/* 8BFC8 800F2B18 8C42018C */  lw        $v0, 0x18C($v0)
/* 8BFCC 800F2B1C 10400009 */  beqz      $v0, .L800F2B44
/* 8BFD0 800F2B20 24020001 */   addiu    $v0, $zero, 0x1
/* 8BFD4 800F2B24 0C05272D */  jal       sfx_play_sound
/* 8BFD8 800F2B28 240400C9 */   addiu    $a0, $zero, 0xC9
/* 8BFDC 800F2B2C 3C028011 */  lui       $v0, %hi(PopupNotBattle)
/* 8BFE0 800F2B30 8042D68E */  lb        $v0, %lo(PopupNotBattle)($v0)
/* 8BFE4 800F2B34 144002C5 */  bnez      $v0, .L800F364C
/* 8BFE8 800F2B38 2402FFFE */   addiu    $v0, $zero, -0x2
/* 8BFEC 800F2B3C 0803CD93 */  j         .L800F364C
/* 8BFF0 800F2B40 2402FFFF */   addiu    $v0, $zero, -0x1
.L800F2B44:
/* 8BFF4 800F2B44 8C630318 */  lw        $v1, 0x318($v1)
/* 8BFF8 800F2B48 14620005 */  bne       $v1, $v0, .L800F2B60
/* 8BFFC 800F2B4C 00000000 */   nop
/* 8C000 800F2B50 0C05272D */  jal       sfx_play_sound
/* 8C004 800F2B54 2404021D */   addiu    $a0, $zero, 0x21D
/* 8C008 800F2B58 0803CD93 */  j         .L800F364C
/* 8C00C 800F2B5C 2402001E */   addiu    $v0, $zero, 0x1E
.L800F2B60:
/* 8C010 800F2B60 3C028011 */  lui       $v0, %hi(PopupNotBattle)
/* 8C014 800F2B64 8042D68E */  lb        $v0, %lo(PopupNotBattle)($v0)
/* 8C018 800F2B68 104002BA */  beqz      $v0, .L800F3654
/* 8C01C 800F2B6C 00000000 */   nop
/* 8C020 800F2B70 10600003 */  beqz      $v1, .L800F2B80
/* 8C024 800F2B74 24020003 */   addiu    $v0, $zero, 0x3
/* 8C028 800F2B78 146202B6 */  bne       $v1, $v0, .L800F3654
/* 8C02C 800F2B7C 00000000 */   nop
.L800F2B80:
/* 8C030 800F2B80 0C05272D */  jal       sfx_play_sound
/* 8C034 800F2B84 2404021D */   addiu    $a0, $zero, 0x21D
/* 8C038 800F2B88 0803CD95 */  j         .L800F3654
/* 8C03C 800F2B8C 00000000 */   nop
.L800F2B90:
/* 8C040 800F2B90 3C028011 */  lui       $v0, %hi(gPopupMenu)
/* 8C044 800F2B94 8C42D69C */  lw        $v0, %lo(gPopupMenu)($v0)
/* 8C048 800F2B98 8C430318 */  lw        $v1, 0x318($v0)
/* 8C04C 800F2B9C 2C62000E */  sltiu     $v0, $v1, 0xE
/* 8C050 800F2BA0 10400014 */  beqz      $v0, .L800F2BF4
/* 8C054 800F2BA4 00031080 */   sll      $v0, $v1, 2
/* 8C058 800F2BA8 3C018011 */  lui       $at, %hi(jtbl_8010C6B0)
/* 8C05C 800F2BAC 00220821 */  addu      $at, $at, $v0
/* 8C060 800F2BB0 8C22C6B0 */  lw        $v0, %lo(jtbl_8010C6B0)($at)
/* 8C064 800F2BB4 00400008 */  jr        $v0
/* 8C068 800F2BB8 00000000 */   nop
glabel .L800F2BBC
/* 8C06C 800F2BBC 3C028011 */  lui       $v0, %hi(PopupNotBattle)
/* 8C070 800F2BC0 8042D68E */  lb        $v0, %lo(PopupNotBattle)($v0)
/* 8C074 800F2BC4 1040000C */  beqz      $v0, .L800F2BF8
/* 8C078 800F2BC8 24034000 */   addiu    $v1, $zero, 0x4000
/* 8C07C 800F2BCC 0803CAFE */  j         .L800F2BF8
/* 8C080 800F2BD0 24034002 */   addiu    $v1, $zero, 0x4002
glabel .L800F2BD4
/* 8C084 800F2BD4 3C028011 */  lui       $v0, %hi(PopupNotBattle)
/* 8C088 800F2BD8 8042D68E */  lb        $v0, %lo(PopupNotBattle)($v0)
/* 8C08C 800F2BDC 10400006 */  beqz      $v0, .L800F2BF8
/* 8C090 800F2BE0 24034000 */   addiu    $v1, $zero, 0x4000
/* 8C094 800F2BE4 0803CAFE */  j         .L800F2BF8
/* 8C098 800F2BE8 24034001 */   addiu    $v1, $zero, 0x4001
glabel .L800F2BEC
/* 8C09C 800F2BEC 0803CAFE */  j         .L800F2BF8
/* 8C0A0 800F2BF0 24034000 */   addiu    $v1, $zero, 0x4000
.L800F2BF4:
/* 8C0A4 800F2BF4 0000182D */  daddu     $v1, $zero, $zero
.L800F2BF8:
/* 8C0A8 800F2BF8 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 8C0AC 800F2BFC 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 8C0B0 800F2C00 8C420010 */  lw        $v0, 0x10($v0)
/* 8C0B4 800F2C04 00431024 */  and       $v0, $v0, $v1
/* 8C0B8 800F2C08 10400013 */  beqz      $v0, .L800F2C58
/* 8C0BC 800F2C0C 00000000 */   nop
/* 8C0C0 800F2C10 0C05272D */  jal       sfx_play_sound
/* 8C0C4 800F2C14 240400CA */   addiu    $a0, $zero, 0xCA
/* 8C0C8 800F2C18 3C028011 */  lui       $v0, %hi(PopupNotDipping)
/* 8C0CC 800F2C1C 8042D698 */  lb        $v0, %lo(PopupNotDipping)($v0)
/* 8C0D0 800F2C20 10400007 */  beqz      $v0, .L800F2C40
/* 8C0D4 800F2C24 00000000 */   nop
/* 8C0D8 800F2C28 3C028011 */  lui       $v0, %hi(PopupNotBattle)
/* 8C0DC 800F2C2C 8042D68E */  lb        $v0, %lo(PopupNotBattle)($v0)
/* 8C0E0 800F2C30 14400286 */  bnez      $v0, .L800F364C
/* 8C0E4 800F2C34 2402FFF9 */   addiu    $v0, $zero, -0x7
/* 8C0E8 800F2C38 0803CD93 */  j         .L800F364C
/* 8C0EC 800F2C3C 2402FFFD */   addiu    $v0, $zero, -0x3
.L800F2C40:
/* 8C0F0 800F2C40 3C028011 */  lui       $v0, %hi(PopupDipMode)
/* 8C0F4 800F2C44 8042D699 */  lb        $v0, %lo(PopupDipMode)($v0)
/* 8C0F8 800F2C48 14400280 */  bnez      $v0, .L800F364C
/* 8C0FC 800F2C4C 24020064 */   addiu    $v0, $zero, 0x64
/* 8C100 800F2C50 0803CD93 */  j         .L800F364C
/* 8C104 800F2C54 2402001E */   addiu    $v0, $zero, 0x1E
.L800F2C58:
/* 8C108 800F2C58 3C028011 */  lui       $v0, %hi(gPopupMenu)
/* 8C10C 800F2C5C 8C42D69C */  lw        $v0, %lo(gPopupMenu)($v0)
/* 8C110 800F2C60 8C430318 */  lw        $v1, 0x318($v0)
/* 8C114 800F2C64 10600005 */  beqz      $v1, .L800F2C7C
/* 8C118 800F2C68 24020001 */   addiu    $v0, $zero, 0x1
/* 8C11C 800F2C6C 10620005 */  beq       $v1, $v0, .L800F2C84
/* 8C120 800F2C70 0000182D */   daddu    $v1, $zero, $zero
/* 8C124 800F2C74 0803CB22 */  j         .L800F2C88
/* 8C128 800F2C78 00000000 */   nop
.L800F2C7C:
/* 8C12C 800F2C7C 0803CB22 */  j         .L800F2C88
/* 8C130 800F2C80 24030001 */   addiu    $v1, $zero, 0x1
.L800F2C84:
/* 8C134 800F2C84 24030002 */  addiu     $v1, $zero, 0x2
.L800F2C88:
/* 8C138 800F2C88 3C028011 */  lui       $v0, %hi(PopupNotBattle)
/* 8C13C 800F2C8C 8042D68E */  lb        $v0, %lo(PopupNotBattle)($v0)
/* 8C140 800F2C90 10400270 */  beqz      $v0, .L800F3654
/* 8C144 800F2C94 00000000 */   nop
/* 8C148 800F2C98 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 8C14C 800F2C9C 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 8C150 800F2CA0 8C420010 */  lw        $v0, 0x10($v0)
/* 8C154 800F2CA4 00431024 */  and       $v0, $v0, $v1
/* 8C158 800F2CA8 1040026A */  beqz      $v0, .L800F3654
/* 8C15C 800F2CAC 00000000 */   nop
/* 8C160 800F2CB0 0C05272D */  jal       sfx_play_sound
/* 8C164 800F2CB4 240400CA */   addiu    $a0, $zero, 0xCA
/* 8C168 800F2CB8 0803CD93 */  j         .L800F364C
/* 8C16C 800F2CBC 2402FFFA */   addiu    $v0, $zero, -0x6
glabel .L800F2CC0
/* 8C170 800F2CC0 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8C174 800F2CC4 00A0302D */  daddu     $a2, $a1, $zero
/* 8C178 800F2CC8 3C048011 */  lui       $a0, %hi(PopupMenu_EmptybarHEID)
/* 8C17C 800F2CCC 8C84D65C */  lw        $a0, %lo(PopupMenu_EmptybarHEID)($a0)
/* 8C180 800F2CD0 0C0513BF */  jal       hud_element_set_tint
/* 8C184 800F2CD4 00A0382D */   daddu    $a3, $a1, $zero
/* 8C188 800F2CD8 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8C18C 800F2CDC 00A0302D */  daddu     $a2, $a1, $zero
/* 8C190 800F2CE0 3C048011 */  lui       $a0, %hi(D_8010D678)
/* 8C194 800F2CE4 8C84D678 */  lw        $a0, %lo(D_8010D678)($a0)
/* 8C198 800F2CE8 0C0513BF */  jal       hud_element_set_tint
/* 8C19C 800F2CEC 00A0382D */   daddu    $a3, $a1, $zero
/* 8C1A0 800F2CF0 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8C1A4 800F2CF4 00A0302D */  daddu     $a2, $a1, $zero
/* 8C1A8 800F2CF8 3C108011 */  lui       $s0, %hi(D_8010D66C)
/* 8C1AC 800F2CFC 2610D66C */  addiu     $s0, $s0, %lo(D_8010D66C)
/* 8C1B0 800F2D00 8E040000 */  lw        $a0, 0x0($s0)
/* 8C1B4 800F2D04 0C0513BF */  jal       hud_element_set_tint
/* 8C1B8 800F2D08 00A0382D */   daddu    $a3, $a1, $zero
/* 8C1BC 800F2D0C 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8C1C0 800F2D10 00A0302D */  daddu     $a2, $a1, $zero
/* 8C1C4 800F2D14 3C048011 */  lui       $a0, %hi(D_8010D670)
/* 8C1C8 800F2D18 8C84D670 */  lw        $a0, %lo(D_8010D670)($a0)
/* 8C1CC 800F2D1C 0C0513BF */  jal       hud_element_set_tint
/* 8C1D0 800F2D20 00A0382D */   daddu    $a3, $a1, $zero
/* 8C1D4 800F2D24 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8C1D8 800F2D28 00A0302D */  daddu     $a2, $a1, $zero
/* 8C1DC 800F2D2C 3C048011 */  lui       $a0, %hi(D_8010D674)
/* 8C1E0 800F2D30 8C84D674 */  lw        $a0, %lo(D_8010D674)($a0)
/* 8C1E4 800F2D34 0C0513BF */  jal       hud_element_set_tint
/* 8C1E8 800F2D38 00A0382D */   daddu    $a3, $a1, $zero
/* 8C1EC 800F2D3C 8E040000 */  lw        $a0, 0x0($s0)
/* 8C1F0 800F2D40 3C058010 */  lui       $a1, %hi(HES_HandPointer)
/* 8C1F4 800F2D44 24A54A00 */  addiu     $a1, $a1, %lo(HES_HandPointer)
/* 8C1F8 800F2D48 0C0511FF */  jal       hud_element_set_script
/* 8C1FC 800F2D4C 00000000 */   nop
/* 8C200 800F2D50 3C108011 */  lui       $s0, %hi(gPopupMenu)
/* 8C204 800F2D54 2610D69C */  addiu     $s0, $s0, %lo(gPopupMenu)
/* 8C208 800F2D58 8E020000 */  lw        $v0, 0x0($s0)
glabel func_800F2D5C
/* 8C20C 800F2D5C 8C430318 */  lw        $v1, 0x318($v0)
/* 8C210 800F2D60 24020003 */  addiu     $v0, $zero, 0x3
/* 8C214 800F2D64 1462000C */  bne       $v1, $v0, .L800F2D98
/* 8C218 800F2D68 240500A0 */   addiu    $a1, $zero, 0xA0
/* 8C21C 800F2D6C 00A0302D */  daddu     $a2, $a1, $zero
/* 8C220 800F2D70 3C048011 */  lui       $a0, %hi(PopupTitleIconHEID)
/* 8C224 800F2D74 8C84D660 */  lw        $a0, %lo(PopupTitleIconHEID)($a0)
/* 8C228 800F2D78 0C0513BF */  jal       hud_element_set_tint
/* 8C22C 800F2D7C 00A0382D */   daddu    $a3, $a1, $zero
/* 8C230 800F2D80 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8C234 800F2D84 00A0302D */  daddu     $a2, $a1, $zero
/* 8C238 800F2D88 3C048011 */  lui       $a0, %hi(D_8010D664)
/* 8C23C 800F2D8C 8C84D664 */  lw        $a0, %lo(D_8010D664)($a0)
/* 8C240 800F2D90 0C0513BF */  jal       hud_element_set_tint
/* 8C244 800F2D94 00A0382D */   daddu    $a3, $a1, $zero
.L800F2D98:
/* 8C248 800F2D98 8E020000 */  lw        $v0, 0x0($s0)
/* 8C24C 800F2D9C 8C420318 */  lw        $v0, 0x318($v0)
/* 8C250 800F2DA0 24110004 */  addiu     $s1, $zero, 0x4
/* 8C254 800F2DA4 1451000C */  bne       $v0, $s1, .L800F2DD8
/* 8C258 800F2DA8 240500A0 */   addiu    $a1, $zero, 0xA0
/* 8C25C 800F2DAC 00A0302D */  daddu     $a2, $a1, $zero
/* 8C260 800F2DB0 3C048011 */  lui       $a0, %hi(PopupTitleIconHEID)
/* 8C264 800F2DB4 8C84D660 */  lw        $a0, %lo(PopupTitleIconHEID)($a0)
/* 8C268 800F2DB8 0C0513BF */  jal       hud_element_set_tint
/* 8C26C 800F2DBC 00A0382D */   daddu    $a3, $a1, $zero
/* 8C270 800F2DC0 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8C274 800F2DC4 00A0302D */  daddu     $a2, $a1, $zero
/* 8C278 800F2DC8 3C048011 */  lui       $a0, %hi(D_8010D664)
/* 8C27C 800F2DCC 8C84D664 */  lw        $a0, %lo(D_8010D664)($a0)
/* 8C280 800F2DD0 0C0513BF */  jal       hud_element_set_tint
/* 8C284 800F2DD4 00A0382D */   daddu    $a3, $a1, $zero
.L800F2DD8:
/* 8C288 800F2DD8 8E020000 */  lw        $v0, 0x0($s0)
/* 8C28C 800F2DDC 8C430318 */  lw        $v1, 0x318($v0)
/* 8C290 800F2DE0 24020001 */  addiu     $v0, $zero, 0x1
/* 8C294 800F2DE4 10620003 */  beq       $v1, $v0, .L800F2DF4
/* 8C298 800F2DE8 00000000 */   nop
/* 8C29C 800F2DEC 14710007 */  bne       $v1, $s1, .L800F2E0C
/* 8C2A0 800F2DF0 00000000 */   nop
.L800F2DF4:
/* 8C2A4 800F2DF4 3C048011 */  lui       $a0, %hi(D_8010D668)
/* 8C2A8 800F2DF8 8C84D668 */  lw        $a0, %lo(D_8010D668)($a0)
/* 8C2AC 800F2DFC 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8C2B0 800F2E00 00A0302D */  daddu     $a2, $a1, $zero
/* 8C2B4 800F2E04 0C0513BF */  jal       hud_element_set_tint
/* 8C2B8 800F2E08 00A0382D */   daddu    $a3, $a1, $zero
.L800F2E0C:
/* 8C2BC 800F2E0C 3C108011 */  lui       $s0, %hi(gPopupMenu)
/* 8C2C0 800F2E10 2610D69C */  addiu     $s0, $s0, %lo(gPopupMenu)
/* 8C2C4 800F2E14 8E020000 */  lw        $v0, 0x0($s0)
/* 8C2C8 800F2E18 8C430318 */  lw        $v1, 0x318($v0)
/* 8C2CC 800F2E1C 24020005 */  addiu     $v0, $zero, 0x5
/* 8C2D0 800F2E20 14620006 */  bne       $v1, $v0, .L800F2E3C
/* 8C2D4 800F2E24 240500A0 */   addiu    $a1, $zero, 0xA0
/* 8C2D8 800F2E28 3C048011 */  lui       $a0, %hi(PopupTitleIconHEID)
/* 8C2DC 800F2E2C 8C84D660 */  lw        $a0, %lo(PopupTitleIconHEID)($a0)
/* 8C2E0 800F2E30 00A0302D */  daddu     $a2, $a1, $zero
/* 8C2E4 800F2E34 0C0513BF */  jal       hud_element_set_tint
/* 8C2E8 800F2E38 00A0382D */   daddu    $a3, $a1, $zero
.L800F2E3C:
/* 8C2EC 800F2E3C 3C048011 */  lui       $a0, %hi(PopupMenu_SelectedIndex)
/* 8C2F0 800F2E40 2484D648 */  addiu     $a0, $a0, %lo(PopupMenu_SelectedIndex)
/* 8C2F4 800F2E44 8C820000 */  lw        $v0, 0x0($a0)
/* 8C2F8 800F2E48 2403000D */  addiu     $v1, $zero, 0xD
/* 8C2FC 800F2E4C 3C018011 */  lui       $at, %hi(D_8010D690)
/* 8C300 800F2E50 A023D690 */  sb        $v1, %lo(D_8010D690)($at)
/* 8C304 800F2E54 94830002 */  lhu       $v1, 0x2($a0)
/* 8C308 800F2E58 8E040000 */  lw        $a0, 0x0($s0)
/* 8C30C 800F2E5C 0803CC01 */  j         .L800F3004
/* 8C310 800F2E60 24420001 */   addiu    $v0, $v0, 0x1
glabel .L800F2E64
/* 8C314 800F2E64 3C038011 */  lui       $v1, %hi(PopupMenu_SelectedIndex)
/* 8C318 800F2E68 2463D648 */  addiu     $v1, $v1, %lo(PopupMenu_SelectedIndex)
/* 8C31C 800F2E6C 8C620000 */  lw        $v0, 0x0($v1)
/* 8C320 800F2E70 94630002 */  lhu       $v1, 0x2($v1)
/* 8C324 800F2E74 3C048011 */  lui       $a0, %hi(gPopupMenu)
/* 8C328 800F2E78 8C84D69C */  lw        $a0, %lo(gPopupMenu)($a0)
/* 8C32C 800F2E7C 0803CC01 */  j         .L800F3004
/* 8C330 800F2E80 24420001 */   addiu    $v0, $v0, 0x1
glabel .L800F2E84
/* 8C334 800F2E84 3C028011 */  lui       $v0, %hi(gPopupMenu)
/* 8C338 800F2E88 8C42D69C */  lw        $v0, %lo(gPopupMenu)($v0)
/* 8C33C 800F2E8C 8C430318 */  lw        $v1, 0x318($v0)
/* 8C340 800F2E90 2C62000E */  sltiu     $v0, $v1, 0xE
/* 8C344 800F2E94 10400013 */  beqz      $v0, .L800F2EE4
glabel func_800F2E98
/* 8C348 800F2E98 00031080 */   sll      $v0, $v1, 2
/* 8C34C 800F2E9C 3C018011 */  lui       $at, %hi(jtbl_8010C6E8)
/* 8C350 800F2EA0 00220821 */  addu      $at, $at, $v0
/* 8C354 800F2EA4 8C22C6E8 */  lw        $v0, %lo(jtbl_8010C6E8)($at)
/* 8C358 800F2EA8 00400008 */  jr        $v0
/* 8C35C 800F2EAC 00000000 */   nop
glabel .L800F2EB0
/* 8C360 800F2EB0 2404000E */  addiu     $a0, $zero, 0xE
/* 8C364 800F2EB4 0C051F9F */  jal       set_window_update
/* 8C368 800F2EB8 24050002 */   addiu    $a1, $zero, 0x2
/* 8C36C 800F2EBC 0803CBB7 */  j         .L800F2EDC
/* 8C370 800F2EC0 24040013 */   addiu    $a0, $zero, 0x13
glabel .L800F2EC4
/* 8C374 800F2EC4 2404000E */  addiu     $a0, $zero, 0xE
/* 8C378 800F2EC8 0C051F9F */  jal       set_window_update
/* 8C37C 800F2ECC 24050002 */   addiu    $a1, $zero, 0x2
/* 8C380 800F2ED0 0803CBB7 */  j         .L800F2EDC
/* 8C384 800F2ED4 24040013 */   addiu    $a0, $zero, 0x13
glabel .L800F2ED8
/* 8C388 800F2ED8 2404000E */  addiu     $a0, $zero, 0xE
.L800F2EDC:
/* 8C38C 800F2EDC 0C051F9F */  jal       set_window_update
/* 8C390 800F2EE0 24050002 */   addiu    $a1, $zero, 0x2
.L800F2EE4:
/* 8C394 800F2EE4 0C03C54E */  jal       destroy_popup_menu
/* 8C398 800F2EE8 00000000 */   nop
/* 8C39C 800F2EEC 3C048011 */  lui       $a0, %hi(gPopupWorker)
/* 8C3A0 800F2EF0 8C84D694 */  lw        $a0, %lo(gPopupWorker)($a0)
/* 8C3A4 800F2EF4 0C048D70 */  jal       free_worker
/* 8C3A8 800F2EF8 00000000 */   nop
/* 8C3AC 800F2EFC 3C048011 */  lui       $a0, %hi(gPopupMenu)
/* 8C3B0 800F2F00 8C84D69C */  lw        $a0, %lo(gPopupMenu)($a0)
/* 8C3B4 800F2F04 2403FFFB */  addiu     $v1, $zero, -0x5
/* 8C3B8 800F2F08 3C018011 */  lui       $at, %hi(gPopupState)
/* 8C3BC 800F2F0C AC23D640 */  sw        $v1, %lo(gPopupState)($at)
/* 8C3C0 800F2F10 0803CBDA */  j         .L800F2F68
/* 8C3C4 800F2F14 240200FF */   addiu    $v0, $zero, 0xFF
glabel .L800F2F18
/* 8C3C8 800F2F18 3C048011 */  lui       $a0, %hi(gPopupWorker)
/* 8C3CC 800F2F1C 8C84D694 */  lw        $a0, %lo(gPopupWorker)($a0)
/* 8C3D0 800F2F20 0C048D70 */  jal       free_worker
/* 8C3D4 800F2F24 00000000 */   nop
/* 8C3D8 800F2F28 3C048011 */  lui       $a0, %hi(gPopupMenu)
/* 8C3DC 800F2F2C 8C84D69C */  lw        $a0, %lo(gPopupMenu)($a0)
/* 8C3E0 800F2F30 2403FFFB */  addiu     $v1, $zero, -0x5
/* 8C3E4 800F2F34 3C018011 */  lui       $at, %hi(gPopupState)
/* 8C3E8 800F2F38 AC23D640 */  sw        $v1, %lo(gPopupState)($at)
/* 8C3EC 800F2F3C 0803CBDA */  j         .L800F2F68
/* 8C3F0 800F2F40 240200FF */   addiu    $v0, $zero, 0xFF
glabel .L800F2F44
/* 8C3F4 800F2F44 240200FF */  addiu     $v0, $zero, 0xFF
/* 8C3F8 800F2F48 3C048011 */  lui       $a0, %hi(gPopupMenu)
/* 8C3FC 800F2F4C 8C84D69C */  lw        $a0, %lo(gPopupMenu)($a0)
/* 8C400 800F2F50 2403FFFE */  addiu     $v1, $zero, -0x2
/* 8C404 800F2F54 0803CD99 */  j         .L800F3664
/* 8C408 800F2F58 A483032C */   sh       $v1, 0x32C($a0)
glabel .L800F2F5C
/* 8C40C 800F2F5C 240200FF */  addiu     $v0, $zero, 0xFF
/* 8C410 800F2F60 3C048011 */  lui       $a0, %hi(gPopupMenu)
/* 8C414 800F2F64 8C84D69C */  lw        $a0, %lo(gPopupMenu)($a0)
.L800F2F68:
/* 8C418 800F2F68 0040182D */  daddu     $v1, $v0, $zero
/* 8C41C 800F2F6C 0803CD99 */  j         .L800F3664
/* 8C420 800F2F70 A483032C */   sh       $v1, 0x32C($a0)
glabel .L800F2F74
/* 8C424 800F2F74 3C038011 */  lui       $v1, %hi(D_8010D644)
/* 8C428 800F2F78 2463D644 */  addiu     $v1, $v1, %lo(D_8010D644)
/* 8C42C 800F2F7C 8C620000 */  lw        $v0, 0x0($v1)
/* 8C430 800F2F80 2442FFFF */  addiu     $v0, $v0, -0x1
/* 8C434 800F2F84 144001B3 */  bnez      $v0, .L800F3654
/* 8C438 800F2F88 AC620000 */   sw       $v0, 0x0($v1)
/* 8C43C 800F2F8C 3C048011 */  lui       $a0, %hi(PopupMenu_SelectedIndex)
/* 8C440 800F2F90 2484D648 */  addiu     $a0, $a0, %lo(PopupMenu_SelectedIndex)
/* 8C444 800F2F94 8C820000 */  lw        $v0, 0x0($a0)
/* 8C448 800F2F98 2403000B */  addiu     $v1, $zero, 0xB
/* 8C44C 800F2F9C 3C018011 */  lui       $at, %hi(gPopupState)
/* 8C450 800F2FA0 AC23D640 */  sw        $v1, %lo(gPopupState)($at)
/* 8C454 800F2FA4 94830002 */  lhu       $v1, 0x2($a0)
/* 8C458 800F2FA8 3C048011 */  lui       $a0, %hi(gPopupMenu)
/* 8C45C 800F2FAC 8C84D69C */  lw        $a0, %lo(gPopupMenu)($a0)
/* 8C460 800F2FB0 0803CC01 */  j         .L800F3004
/* 8C464 800F2FB4 24420001 */   addiu    $v0, $v0, 0x1
glabel .L800F2FB8
/* 8C468 800F2FB8 3C028011 */  lui       $v0, %hi(D_8010D644)
/* 8C46C 800F2FBC 2442D644 */  addiu     $v0, $v0, %lo(D_8010D644)
/* 8C470 800F2FC0 8C430000 */  lw        $v1, 0x0($v0)
/* 8C474 800F2FC4 3C048011 */  lui       $a0, %hi(D_8010D692)
/* 8C478 800F2FC8 8084D692 */  lb        $a0, %lo(D_8010D692)($a0)
/* 8C47C 800F2FCC 24630001 */  addiu     $v1, $v1, 0x1
/* 8C480 800F2FD0 AC430000 */  sw        $v1, 0x0($v0)
/* 8C484 800F2FD4 0064182A */  slt       $v1, $v1, $a0
/* 8C488 800F2FD8 1460019E */  bnez      $v1, .L800F3654
/* 8C48C 800F2FDC 24030001 */   addiu    $v1, $zero, 0x1
/* 8C490 800F2FE0 3C048011 */  lui       $a0, %hi(PopupMenu_SelectedIndex)
/* 8C494 800F2FE4 2484D648 */  addiu     $a0, $a0, %lo(PopupMenu_SelectedIndex)
/* 8C498 800F2FE8 8C820000 */  lw        $v0, 0x0($a0)
/* 8C49C 800F2FEC 3C018011 */  lui       $at, %hi(gPopupState)
/* 8C4A0 800F2FF0 AC23D640 */  sw        $v1, %lo(gPopupState)($at)
/* 8C4A4 800F2FF4 00431021 */  addu      $v0, $v0, $v1
/* 8C4A8 800F2FF8 94830002 */  lhu       $v1, 0x2($a0)
/* 8C4AC 800F2FFC 3C048011 */  lui       $a0, %hi(gPopupMenu)
/* 8C4B0 800F3000 8C84D69C */  lw        $a0, %lo(gPopupMenu)($a0)
.L800F3004:
/* 8C4B4 800F3004 24630001 */  addiu     $v1, $v1, 0x1
/* 8C4B8 800F3008 0803CD99 */  j         .L800F3664
/* 8C4BC 800F300C A483032C */   sh       $v1, 0x32C($a0)
glabel .L800F3010
/* 8C4C0 800F3010 0000102D */  daddu     $v0, $zero, $zero
/* 8C4C4 800F3014 3C048011 */  lui       $a0, %hi(gPopupMenu)
/* 8C4C8 800F3018 8C84D69C */  lw        $a0, %lo(gPopupMenu)($a0)
/* 8C4CC 800F301C 2403001F */  addiu     $v1, $zero, 0x1F
/* 8C4D0 800F3020 3C018011 */  lui       $at, %hi(gPopupState)
/* 8C4D4 800F3024 AC23D640 */  sw        $v1, %lo(gPopupState)($at)
/* 8C4D8 800F3028 2403FFFF */  addiu     $v1, $zero, -0x1
/* 8C4DC 800F302C 0803CD99 */  j         .L800F3664
/* 8C4E0 800F3030 A483032C */   sh       $v1, 0x32C($a0)
glabel .L800F3034
/* 8C4E4 800F3034 2404000E */  addiu     $a0, $zero, 0xE
/* 8C4E8 800F3038 0C051F9F */  jal       set_window_update
/* 8C4EC 800F303C 24050002 */   addiu    $a1, $zero, 0x2
/* 8C4F0 800F3040 24040013 */  addiu     $a0, $zero, 0x13
/* 8C4F4 800F3044 0C051F9F */  jal       set_window_update
/* 8C4F8 800F3048 24050002 */   addiu    $a1, $zero, 0x2
/* 8C4FC 800F304C 3C028011 */  lui       $v0, %hi(PopupNotBattle)
/* 8C500 800F3050 8042D68E */  lb        $v0, %lo(PopupNotBattle)($v0)
/* 8C504 800F3054 10400003 */  beqz      $v0, .L800F3064
/* 8C508 800F3058 24040015 */   addiu    $a0, $zero, 0x15
/* 8C50C 800F305C 0C051F9F */  jal       set_window_update
/* 8C510 800F3060 24050002 */   addiu    $a1, $zero, 0x2
.L800F3064:
/* 8C514 800F3064 3C04001D */  lui       $a0, (0x1D006B >> 16)
/* 8C518 800F3068 3484006B */  ori       $a0, $a0, (0x1D006B & 0xFFFF)
/* 8C51C 800F306C 0C04991D */  jal       get_msg_width
/* 8C520 800F3070 0000282D */   daddu    $a1, $zero, $zero
/* 8C524 800F3074 24470017 */  addiu     $a3, $v0, 0x17
/* 8C528 800F3078 24040009 */  addiu     $a0, $zero, 0x9
/* 8C52C 800F307C 00072FC2 */  srl       $a1, $a3, 31
/* 8C530 800F3080 00E52821 */  addu      $a1, $a3, $a1
/* 8C534 800F3084 00052843 */  sra       $a1, $a1, 1
/* 8C538 800F3088 240200A0 */  addiu     $v0, $zero, 0xA0
/* 8C53C 800F308C 00452823 */  subu      $a1, $v0, $a1
/* 8C540 800F3090 24060050 */  addiu     $a2, $zero, 0x50
/* 8C544 800F3094 24020028 */  addiu     $v0, $zero, 0x28
/* 8C548 800F3098 AFA20010 */  sw        $v0, 0x10($sp)
/* 8C54C 800F309C 24020014 */  addiu     $v0, $zero, 0x14
/* 8C550 800F30A0 AFA20014 */  sw        $v0, 0x14($sp)
/* 8C554 800F30A4 3C02800F */  lui       $v0, %hi(popup_draw_already_have_partner)
/* 8C558 800F30A8 24424CF0 */  addiu     $v0, $v0, %lo(popup_draw_already_have_partner)
/* 8C55C 800F30AC AFA20018 */  sw        $v0, 0x18($sp)
/* 8C560 800F30B0 2402FFFF */  addiu     $v0, $zero, -0x1
/* 8C564 800F30B4 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8C568 800F30B8 0C051F32 */  jal       set_window_properties
/* 8C56C 800F30BC AFA20020 */   sw       $v0, 0x20($sp)
/* 8C570 800F30C0 24040009 */  addiu     $a0, $zero, 0x9
/* 8C574 800F30C4 0C051F9F */  jal       set_window_update
/* 8C578 800F30C8 24050001 */   addiu    $a1, $zero, 0x1
/* 8C57C 800F30CC 2403003C */  addiu     $v1, $zero, 0x3C
/* 8C580 800F30D0 3C018011 */  lui       $at, %hi(D_8010D644)
/* 8C584 800F30D4 AC23D644 */  sw        $v1, %lo(D_8010D644)($at)
/* 8C588 800F30D8 24030020 */  addiu     $v1, $zero, 0x20
/* 8C58C 800F30DC 3C018011 */  lui       $at, %hi(gPopupState)
/* 8C590 800F30E0 AC23D640 */  sw        $v1, %lo(gPopupState)($at)
/* 8C594 800F30E4 0803CD99 */  j         .L800F3664
/* 8C598 800F30E8 0000102D */   daddu    $v0, $zero, $zero
glabel .L800F30EC
/* 8C59C 800F30EC 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 8C5A0 800F30F0 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 8C5A4 800F30F4 8C420010 */  lw        $v0, 0x10($v0)
/* 8C5A8 800F30F8 3042C001 */  andi      $v0, $v0, 0xC001
/* 8C5AC 800F30FC 10400003 */  beqz      $v0, .L800F310C
/* 8C5B0 800F3100 00000000 */   nop
/* 8C5B4 800F3104 3C018011 */  lui       $at, %hi(D_8010D644)
/* 8C5B8 800F3108 AC20D644 */  sw        $zero, %lo(D_8010D644)($at)
.L800F310C:
/* 8C5BC 800F310C 3C038011 */  lui       $v1, %hi(D_8010D644)
/* 8C5C0 800F3110 2463D644 */  addiu     $v1, $v1, %lo(D_8010D644)
/* 8C5C4 800F3114 8C620000 */  lw        $v0, 0x0($v1)
/* 8C5C8 800F3118 10400004 */  beqz      $v0, .L800F312C
/* 8C5CC 800F311C 2442FFFF */   addiu    $v0, $v0, -0x1
/* 8C5D0 800F3120 AC620000 */  sw        $v0, 0x0($v1)
/* 8C5D4 800F3124 0803CD99 */  j         .L800F3664
/* 8C5D8 800F3128 0000102D */   daddu    $v0, $zero, $zero
.L800F312C:
/* 8C5DC 800F312C 24040009 */  addiu     $a0, $zero, 0x9
/* 8C5E0 800F3130 0C051F9F */  jal       set_window_update
/* 8C5E4 800F3134 24050002 */   addiu    $a1, $zero, 0x2
/* 8C5E8 800F3138 2404000E */  addiu     $a0, $zero, 0xE
/* 8C5EC 800F313C 0C051F9F */  jal       set_window_update
/* 8C5F0 800F3140 24050001 */   addiu    $a1, $zero, 0x1
/* 8C5F4 800F3144 24040013 */  addiu     $a0, $zero, 0x13
/* 8C5F8 800F3148 0C051F9F */  jal       set_window_update
/* 8C5FC 800F314C 24050001 */   addiu    $a1, $zero, 0x1
/* 8C600 800F3150 3C028011 */  lui       $v0, %hi(PopupNotBattle)
/* 8C604 800F3154 8042D68E */  lb        $v0, %lo(PopupNotBattle)($v0)
/* 8C608 800F3158 10400003 */  beqz      $v0, .L800F3168
/* 8C60C 800F315C 24040015 */   addiu    $a0, $zero, 0x15
/* 8C610 800F3160 0C051F9F */  jal       set_window_update
/* 8C614 800F3164 24050001 */   addiu    $a1, $zero, 0x1
.L800F3168:
/* 8C618 800F3168 3C038011 */  lui       $v1, %hi(gPopupMenu)
/* 8C61C 800F316C 8C63D69C */  lw        $v1, %lo(gPopupMenu)($v1)
/* 8C620 800F3170 24020001 */  addiu     $v0, $zero, 0x1
/* 8C624 800F3174 3C018011 */  lui       $at, %hi(gPopupState)
/* 8C628 800F3178 AC22D640 */  sw        $v0, %lo(gPopupState)($at)
/* 8C62C 800F317C 0803CD95 */  j         .L800F3654
/* 8C630 800F3180 A460032C */   sh       $zero, 0x32C($v1)
glabel .L800F3184
/* 8C634 800F3184 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8C638 800F3188 00A0302D */  daddu     $a2, $a1, $zero
/* 8C63C 800F318C 3C048011 */  lui       $a0, %hi(PopupMenu_EmptybarHEID)
/* 8C640 800F3190 8C84D65C */  lw        $a0, %lo(PopupMenu_EmptybarHEID)($a0)
/* 8C644 800F3194 0C0513BF */  jal       hud_element_set_tint
/* 8C648 800F3198 00A0382D */   daddu    $a3, $a1, $zero
/* 8C64C 800F319C 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8C650 800F31A0 00A0302D */  daddu     $a2, $a1, $zero
/* 8C654 800F31A4 3C048011 */  lui       $a0, %hi(D_8010D678)
/* 8C658 800F31A8 8C84D678 */  lw        $a0, %lo(D_8010D678)($a0)
/* 8C65C 800F31AC 0C0513BF */  jal       hud_element_set_tint
/* 8C660 800F31B0 00A0382D */   daddu    $a3, $a1, $zero
/* 8C664 800F31B4 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8C668 800F31B8 00A0302D */  daddu     $a2, $a1, $zero
/* 8C66C 800F31BC 3C108011 */  lui       $s0, %hi(D_8010D66C)
/* 8C670 800F31C0 2610D66C */  addiu     $s0, $s0, %lo(D_8010D66C)
/* 8C674 800F31C4 8E040000 */  lw        $a0, 0x0($s0)
/* 8C678 800F31C8 0C0513BF */  jal       hud_element_set_tint
/* 8C67C 800F31CC 00A0382D */   daddu    $a3, $a1, $zero
/* 8C680 800F31D0 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8C684 800F31D4 00A0302D */  daddu     $a2, $a1, $zero
/* 8C688 800F31D8 3C048011 */  lui       $a0, %hi(D_8010D670)
/* 8C68C 800F31DC 8C84D670 */  lw        $a0, %lo(D_8010D670)($a0)
/* 8C690 800F31E0 0C0513BF */  jal       hud_element_set_tint
/* 8C694 800F31E4 00A0382D */   daddu    $a3, $a1, $zero
/* 8C698 800F31E8 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8C69C 800F31EC 00A0302D */  daddu     $a2, $a1, $zero
/* 8C6A0 800F31F0 3C048011 */  lui       $a0, %hi(D_8010D674)
/* 8C6A4 800F31F4 8C84D674 */  lw        $a0, %lo(D_8010D674)($a0)
/* 8C6A8 800F31F8 0C0513BF */  jal       hud_element_set_tint
/* 8C6AC 800F31FC 00A0382D */   daddu    $a3, $a1, $zero
/* 8C6B0 800F3200 8E040000 */  lw        $a0, 0x0($s0)
/* 8C6B4 800F3204 3C058010 */  lui       $a1, %hi(HES_HandPointer)
/* 8C6B8 800F3208 24A54A00 */  addiu     $a1, $a1, %lo(HES_HandPointer)
/* 8C6BC 800F320C 0C0511FF */  jal       hud_element_set_script
/* 8C6C0 800F3210 00000000 */   nop
/* 8C6C4 800F3214 3C108011 */  lui       $s0, %hi(gPopupMenu)
/* 8C6C8 800F3218 2610D69C */  addiu     $s0, $s0, %lo(gPopupMenu)
/* 8C6CC 800F321C 8E020000 */  lw        $v0, 0x0($s0)
/* 8C6D0 800F3220 8C430318 */  lw        $v1, 0x318($v0)
/* 8C6D4 800F3224 24020003 */  addiu     $v0, $zero, 0x3
/* 8C6D8 800F3228 1462000C */  bne       $v1, $v0, .L800F325C
/* 8C6DC 800F322C 240500A0 */   addiu    $a1, $zero, 0xA0
/* 8C6E0 800F3230 00A0302D */  daddu     $a2, $a1, $zero
/* 8C6E4 800F3234 3C048011 */  lui       $a0, %hi(PopupTitleIconHEID)
/* 8C6E8 800F3238 8C84D660 */  lw        $a0, %lo(PopupTitleIconHEID)($a0)
/* 8C6EC 800F323C 0C0513BF */  jal       hud_element_set_tint
/* 8C6F0 800F3240 00A0382D */   daddu    $a3, $a1, $zero
/* 8C6F4 800F3244 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8C6F8 800F3248 00A0302D */  daddu     $a2, $a1, $zero
/* 8C6FC 800F324C 3C048011 */  lui       $a0, %hi(D_8010D664)
/* 8C700 800F3250 8C84D664 */  lw        $a0, %lo(D_8010D664)($a0)
/* 8C704 800F3254 0C0513BF */  jal       hud_element_set_tint
/* 8C708 800F3258 00A0382D */   daddu    $a3, $a1, $zero
.L800F325C:
/* 8C70C 800F325C 8E020000 */  lw        $v0, 0x0($s0)
/* 8C710 800F3260 8C420318 */  lw        $v0, 0x318($v0)
/* 8C714 800F3264 24110004 */  addiu     $s1, $zero, 0x4
/* 8C718 800F3268 1451000C */  bne       $v0, $s1, .L800F329C
/* 8C71C 800F326C 240500A0 */   addiu    $a1, $zero, 0xA0
/* 8C720 800F3270 00A0302D */  daddu     $a2, $a1, $zero
/* 8C724 800F3274 3C048011 */  lui       $a0, %hi(PopupTitleIconHEID)
/* 8C728 800F3278 8C84D660 */  lw        $a0, %lo(PopupTitleIconHEID)($a0)
/* 8C72C 800F327C 0C0513BF */  jal       hud_element_set_tint
/* 8C730 800F3280 00A0382D */   daddu    $a3, $a1, $zero
/* 8C734 800F3284 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8C738 800F3288 00A0302D */  daddu     $a2, $a1, $zero
/* 8C73C 800F328C 3C048011 */  lui       $a0, %hi(D_8010D664)
/* 8C740 800F3290 8C84D664 */  lw        $a0, %lo(D_8010D664)($a0)
/* 8C744 800F3294 0C0513BF */  jal       hud_element_set_tint
/* 8C748 800F3298 00A0382D */   daddu    $a3, $a1, $zero
.L800F329C:
/* 8C74C 800F329C 8E020000 */  lw        $v0, 0x0($s0)
/* 8C750 800F32A0 8C430318 */  lw        $v1, 0x318($v0)
/* 8C754 800F32A4 24020001 */  addiu     $v0, $zero, 0x1
/* 8C758 800F32A8 10620003 */  beq       $v1, $v0, .L800F32B8
/* 8C75C 800F32AC 00000000 */   nop
/* 8C760 800F32B0 14710007 */  bne       $v1, $s1, .L800F32D0
/* 8C764 800F32B4 00000000 */   nop
.L800F32B8:
/* 8C768 800F32B8 3C048011 */  lui       $a0, %hi(D_8010D668)
/* 8C76C 800F32BC 8C84D668 */  lw        $a0, %lo(D_8010D668)($a0)
/* 8C770 800F32C0 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8C774 800F32C4 00A0302D */  daddu     $a2, $a1, $zero
/* 8C778 800F32C8 0C0513BF */  jal       hud_element_set_tint
/* 8C77C 800F32CC 00A0382D */   daddu    $a3, $a1, $zero
.L800F32D0:
/* 8C780 800F32D0 3C108011 */  lui       $s0, %hi(gPopupMenu)
/* 8C784 800F32D4 2610D69C */  addiu     $s0, $s0, %lo(gPopupMenu)
/* 8C788 800F32D8 8E020000 */  lw        $v0, 0x0($s0)
/* 8C78C 800F32DC 8C430318 */  lw        $v1, 0x318($v0)
/* 8C790 800F32E0 24020005 */  addiu     $v0, $zero, 0x5
/* 8C794 800F32E4 14620006 */  bne       $v1, $v0, .L800F3300
/* 8C798 800F32E8 240500A0 */   addiu    $a1, $zero, 0xA0
/* 8C79C 800F32EC 3C048011 */  lui       $a0, %hi(PopupTitleIconHEID)
/* 8C7A0 800F32F0 8C84D660 */  lw        $a0, %lo(PopupTitleIconHEID)($a0)
/* 8C7A4 800F32F4 00A0302D */  daddu     $a2, $a1, $zero
/* 8C7A8 800F32F8 0C0513BF */  jal       hud_element_set_tint
/* 8C7AC 800F32FC 00A0382D */   daddu    $a3, $a1, $zero
.L800F3300:
/* 8C7B0 800F3300 8E020000 */  lw        $v0, 0x0($s0)
/* 8C7B4 800F3304 8C430318 */  lw        $v1, 0x318($v0)
/* 8C7B8 800F3308 2C62000E */  sltiu     $v0, $v1, 0xE
/* 8C7BC 800F330C 10400013 */  beqz      $v0, .L800F335C
/* 8C7C0 800F3310 00031080 */   sll      $v0, $v1, 2
/* 8C7C4 800F3314 3C018011 */  lui       $at, %hi(jtbl_8010C720)
/* 8C7C8 800F3318 00220821 */  addu      $at, $at, $v0
/* 8C7CC 800F331C 8C22C720 */  lw        $v0, %lo(jtbl_8010C720)($at)
/* 8C7D0 800F3320 00400008 */  jr        $v0
/* 8C7D4 800F3324 00000000 */   nop
glabel .L800F3328
/* 8C7D8 800F3328 2404000E */  addiu     $a0, $zero, 0xE
/* 8C7DC 800F332C 0C051F9F */  jal       set_window_update
/* 8C7E0 800F3330 24050002 */   addiu    $a1, $zero, 0x2
/* 8C7E4 800F3334 0803CCD5 */  j         .L800F3354
/* 8C7E8 800F3338 24040013 */   addiu    $a0, $zero, 0x13
glabel .L800F333C
/* 8C7EC 800F333C 2404000E */  addiu     $a0, $zero, 0xE
/* 8C7F0 800F3340 0C051F9F */  jal       set_window_update
/* 8C7F4 800F3344 24050002 */   addiu    $a1, $zero, 0x2
/* 8C7F8 800F3348 0803CCD5 */  j         .L800F3354
/* 8C7FC 800F334C 24040013 */   addiu    $a0, $zero, 0x13
glabel .L800F3350
/* 8C800 800F3350 2404000E */  addiu     $a0, $zero, 0xE
.L800F3354:
/* 8C804 800F3354 0C051F9F */  jal       set_window_update
/* 8C808 800F3358 24050002 */   addiu    $a1, $zero, 0x2
.L800F335C:
/* 8C80C 800F335C 3C04001D */  lui       $a0, (0x1D0069 >> 16)
/* 8C810 800F3360 3C038011 */  lui       $v1, %hi(PopupDipMode)
/* 8C814 800F3364 8063D699 */  lb        $v1, %lo(PopupDipMode)($v1)
/* 8C818 800F3368 2402000D */  addiu     $v0, $zero, 0xD
/* 8C81C 800F336C 3C018011 */  lui       $at, %hi(D_8010D690)
/* 8C820 800F3370 A022D690 */  sb        $v0, %lo(D_8010D690)($at)
/* 8C824 800F3374 24020001 */  addiu     $v0, $zero, 0x1
/* 8C828 800F3378 14620003 */  bne       $v1, $v0, .L800F3388
/* 8C82C 800F337C 34840069 */   ori      $a0, $a0, (0x1D0069 & 0xFFFF)
/* 8C830 800F3380 3C04001D */  lui       $a0, (0x1D0068 >> 16)
/* 8C834 800F3384 34840068 */  ori       $a0, $a0, (0x1D0068 & 0xFFFF)
.L800F3388:
/* 8C838 800F3388 0C04991D */  jal       get_msg_width
/* 8C83C 800F338C 0000282D */   daddu    $a1, $zero, $zero
/* 8C840 800F3390 24470017 */  addiu     $a3, $v0, 0x17
/* 8C844 800F3394 24040015 */  addiu     $a0, $zero, 0x15
/* 8C848 800F3398 00072FC2 */  srl       $a1, $a3, 31
/* 8C84C 800F339C 00E52821 */  addu      $a1, $a3, $a1
/* 8C850 800F33A0 00052843 */  sra       $a1, $a1, 1
/* 8C854 800F33A4 240200A0 */  addiu     $v0, $zero, 0xA0
/* 8C858 800F33A8 00452823 */  subu      $a1, $v0, $a1
/* 8C85C 800F33AC 2406004C */  addiu     $a2, $zero, 0x4C
/* 8C860 800F33B0 24020020 */  addiu     $v0, $zero, 0x20
/* 8C864 800F33B4 AFA20010 */  sw        $v0, 0x10($sp)
/* 8C868 800F33B8 24020013 */  addiu     $v0, $zero, 0x13
/* 8C86C 800F33BC AFA20014 */  sw        $v0, 0x14($sp)
/* 8C870 800F33C0 3C02800F */  lui       $v0, %hi(func_800F4C1C)
/* 8C874 800F33C4 24424C1C */  addiu     $v0, $v0, %lo(func_800F4C1C)
/* 8C878 800F33C8 AFA20018 */  sw        $v0, 0x18($sp)
/* 8C87C 800F33CC 2402FFFF */  addiu     $v0, $zero, -0x1
/* 8C880 800F33D0 AFA0001C */  sw        $zero, 0x1C($sp)
/* 8C884 800F33D4 0C051F32 */  jal       set_window_properties
/* 8C888 800F33D8 AFA20020 */   sw       $v0, 0x20($sp)
/* 8C88C 800F33DC 24040015 */  addiu     $a0, $zero, 0x15
/* 8C890 800F33E0 0C051F9F */  jal       set_window_update
/* 8C894 800F33E4 24050001 */   addiu    $a1, $zero, 0x1
/* 8C898 800F33E8 3C04001E */  lui       $a0, (0x1E001D >> 16)
/* 8C89C 800F33EC 3C058011 */  lui       $a1, %hi(D_8010D6A4)
/* 8C8A0 800F33F0 24A5D6A4 */  addiu     $a1, $a1, %lo(D_8010D6A4)
/* 8C8A4 800F33F4 0C049640 */  jal       msg_get_printer_for_msg
/* 8C8A8 800F33F8 3484001D */   ori      $a0, $a0, (0x1E001D & 0xFFFF)
/* 8C8AC 800F33FC 0040202D */  daddu     $a0, $v0, $zero
/* 8C8B0 800F3400 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8C8B4 800F3404 3C018011 */  lui       $at, %hi(D_8010D6A0)
/* 8C8B8 800F3408 AC24D6A0 */  sw        $a0, %lo(D_8010D6A0)($at)
/* 8C8BC 800F340C 0C0496AE */  jal       msg_printer_set_origin_pos
/* 8C8C0 800F3410 24060090 */   addiu    $a2, $zero, 0x90
/* 8C8C4 800F3414 0803CD93 */  j         .L800F364C
/* 8C8C8 800F3418 24020065 */   addiu    $v0, $zero, 0x65
glabel .L800F341C
/* 8C8CC 800F341C 3C108011 */  lui       $s0, %hi(D_8010D6A4)
/* 8C8D0 800F3420 8E10D6A4 */  lw        $s0, %lo(D_8010D6A4)($s0)
/* 8C8D4 800F3424 24020001 */  addiu     $v0, $zero, 0x1
/* 8C8D8 800F3428 1602008A */  bne       $s0, $v0, .L800F3654
/* 8C8DC 800F342C 24040015 */   addiu    $a0, $zero, 0x15
/* 8C8E0 800F3430 0C051F9F */  jal       set_window_update
/* 8C8E4 800F3434 24050002 */   addiu    $a1, $zero, 0x2
/* 8C8E8 800F3438 3C028011 */  lui       $v0, %hi(D_8010D6A0)
/* 8C8EC 800F343C 8C42D6A0 */  lw        $v0, %lo(D_8010D6A0)($v0)
/* 8C8F0 800F3440 904204E8 */  lbu       $v0, 0x4E8($v0)
/* 8C8F4 800F3444 50400081 */  beql      $v0, $zero, .L800F364C
/* 8C8F8 800F3448 24020066 */   addiu    $v0, $zero, 0x66
/* 8C8FC 800F344C 1050007F */  beq       $v0, $s0, .L800F364C
/* 8C900 800F3450 24020067 */   addiu    $v0, $zero, 0x67
/* 8C904 800F3454 0803CD95 */  j         .L800F3654
/* 8C908 800F3458 00000000 */   nop
glabel .L800F345C
/* 8C90C 800F345C 0803CD93 */  j         .L800F364C
/* 8C910 800F3460 2402FFFD */   addiu    $v0, $zero, -0x3
glabel .L800F3464
/* 8C914 800F3464 240500FF */  addiu     $a1, $zero, 0xFF
/* 8C918 800F3468 00A0302D */  daddu     $a2, $a1, $zero
/* 8C91C 800F346C 3C048011 */  lui       $a0, %hi(PopupMenu_EmptybarHEID)
/* 8C920 800F3470 8C84D65C */  lw        $a0, %lo(PopupMenu_EmptybarHEID)($a0)
/* 8C924 800F3474 0C0513BF */  jal       hud_element_set_tint
/* 8C928 800F3478 00A0382D */   daddu    $a3, $a1, $zero
/* 8C92C 800F347C 240500FF */  addiu     $a1, $zero, 0xFF
/* 8C930 800F3480 00A0302D */  daddu     $a2, $a1, $zero
/* 8C934 800F3484 3C048011 */  lui       $a0, %hi(D_8010D678)
/* 8C938 800F3488 8C84D678 */  lw        $a0, %lo(D_8010D678)($a0)
/* 8C93C 800F348C 0C0513BF */  jal       hud_element_set_tint
/* 8C940 800F3490 00A0382D */   daddu    $a3, $a1, $zero
/* 8C944 800F3494 240500FF */  addiu     $a1, $zero, 0xFF
/* 8C948 800F3498 00A0302D */  daddu     $a2, $a1, $zero
/* 8C94C 800F349C 3C048011 */  lui       $a0, %hi(D_8010D66C)
/* 8C950 800F34A0 8C84D66C */  lw        $a0, %lo(D_8010D66C)($a0)
/* 8C954 800F34A4 0C0513BF */  jal       hud_element_set_tint
/* 8C958 800F34A8 00A0382D */   daddu    $a3, $a1, $zero
/* 8C95C 800F34AC 240500FF */  addiu     $a1, $zero, 0xFF
/* 8C960 800F34B0 00A0302D */  daddu     $a2, $a1, $zero
/* 8C964 800F34B4 3C048011 */  lui       $a0, %hi(D_8010D670)
/* 8C968 800F34B8 8C84D670 */  lw        $a0, %lo(D_8010D670)($a0)
/* 8C96C 800F34BC 0C0513BF */  jal       hud_element_set_tint
/* 8C970 800F34C0 00A0382D */   daddu    $a3, $a1, $zero
/* 8C974 800F34C4 240500FF */  addiu     $a1, $zero, 0xFF
/* 8C978 800F34C8 00A0302D */  daddu     $a2, $a1, $zero
/* 8C97C 800F34CC 3C048011 */  lui       $a0, %hi(D_8010D674)
/* 8C980 800F34D0 8C84D674 */  lw        $a0, %lo(D_8010D674)($a0)
/* 8C984 800F34D4 0C0513BF */  jal       hud_element_set_tint
/* 8C988 800F34D8 00A0382D */   daddu    $a3, $a1, $zero
/* 8C98C 800F34DC 3C108011 */  lui       $s0, %hi(gPopupMenu)
/* 8C990 800F34E0 2610D69C */  addiu     $s0, $s0, %lo(gPopupMenu)
/* 8C994 800F34E4 8E020000 */  lw        $v0, 0x0($s0)
/* 8C998 800F34E8 8C430318 */  lw        $v1, 0x318($v0)
/* 8C99C 800F34EC 24020003 */  addiu     $v0, $zero, 0x3
/* 8C9A0 800F34F0 1462000C */  bne       $v1, $v0, .L800F3524
/* 8C9A4 800F34F4 240500A0 */   addiu    $a1, $zero, 0xA0
/* 8C9A8 800F34F8 00A0302D */  daddu     $a2, $a1, $zero
/* 8C9AC 800F34FC 3C048011 */  lui       $a0, %hi(PopupTitleIconHEID)
/* 8C9B0 800F3500 8C84D660 */  lw        $a0, %lo(PopupTitleIconHEID)($a0)
/* 8C9B4 800F3504 0C0513BF */  jal       hud_element_set_tint
/* 8C9B8 800F3508 00A0382D */   daddu    $a3, $a1, $zero
/* 8C9BC 800F350C 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8C9C0 800F3510 00A0302D */  daddu     $a2, $a1, $zero
/* 8C9C4 800F3514 3C048011 */  lui       $a0, %hi(D_8010D664)
/* 8C9C8 800F3518 8C84D664 */  lw        $a0, %lo(D_8010D664)($a0)
/* 8C9CC 800F351C 0C0513BF */  jal       hud_element_set_tint
/* 8C9D0 800F3520 00A0382D */   daddu    $a3, $a1, $zero
.L800F3524:
/* 8C9D4 800F3524 8E020000 */  lw        $v0, 0x0($s0)
/* 8C9D8 800F3528 8C420318 */  lw        $v0, 0x318($v0)
/* 8C9DC 800F352C 24110004 */  addiu     $s1, $zero, 0x4
/* 8C9E0 800F3530 1451000C */  bne       $v0, $s1, .L800F3564
/* 8C9E4 800F3534 240500A0 */   addiu    $a1, $zero, 0xA0
/* 8C9E8 800F3538 00A0302D */  daddu     $a2, $a1, $zero
/* 8C9EC 800F353C 3C048011 */  lui       $a0, %hi(PopupTitleIconHEID)
/* 8C9F0 800F3540 8C84D660 */  lw        $a0, %lo(PopupTitleIconHEID)($a0)
/* 8C9F4 800F3544 0C0513BF */  jal       hud_element_set_tint
/* 8C9F8 800F3548 00A0382D */   daddu    $a3, $a1, $zero
/* 8C9FC 800F354C 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8CA00 800F3550 00A0302D */  daddu     $a2, $a1, $zero
/* 8CA04 800F3554 3C048011 */  lui       $a0, %hi(D_8010D664)
/* 8CA08 800F3558 8C84D664 */  lw        $a0, %lo(D_8010D664)($a0)
/* 8CA0C 800F355C 0C0513BF */  jal       hud_element_set_tint
/* 8CA10 800F3560 00A0382D */   daddu    $a3, $a1, $zero
.L800F3564:
/* 8CA14 800F3564 8E020000 */  lw        $v0, 0x0($s0)
/* 8CA18 800F3568 8C430318 */  lw        $v1, 0x318($v0)
/* 8CA1C 800F356C 24020001 */  addiu     $v0, $zero, 0x1
/* 8CA20 800F3570 10620003 */  beq       $v1, $v0, .L800F3580
/* 8CA24 800F3574 00000000 */   nop
/* 8CA28 800F3578 14710007 */  bne       $v1, $s1, .L800F3598
/* 8CA2C 800F357C 00000000 */   nop
.L800F3580:
/* 8CA30 800F3580 3C048011 */  lui       $a0, %hi(D_8010D668)
/* 8CA34 800F3584 8C84D668 */  lw        $a0, %lo(D_8010D668)($a0)
/* 8CA38 800F3588 240500A0 */  addiu     $a1, $zero, 0xA0
/* 8CA3C 800F358C 00A0302D */  daddu     $a2, $a1, $zero
/* 8CA40 800F3590 0C0513BF */  jal       hud_element_set_tint
/* 8CA44 800F3594 00A0382D */   daddu    $a3, $a1, $zero
.L800F3598:
/* 8CA48 800F3598 3C108011 */  lui       $s0, %hi(gPopupMenu)
/* 8CA4C 800F359C 2610D69C */  addiu     $s0, $s0, %lo(gPopupMenu)
/* 8CA50 800F35A0 8E020000 */  lw        $v0, 0x0($s0)
/* 8CA54 800F35A4 8C430318 */  lw        $v1, 0x318($v0)
/* 8CA58 800F35A8 24020005 */  addiu     $v0, $zero, 0x5
/* 8CA5C 800F35AC 14620006 */  bne       $v1, $v0, .L800F35C8
/* 8CA60 800F35B0 240500A0 */   addiu    $a1, $zero, 0xA0
/* 8CA64 800F35B4 3C048011 */  lui       $a0, %hi(PopupTitleIconHEID)
/* 8CA68 800F35B8 8C84D660 */  lw        $a0, %lo(PopupTitleIconHEID)($a0)
/* 8CA6C 800F35BC 00A0302D */  daddu     $a2, $a1, $zero
/* 8CA70 800F35C0 0C0513BF */  jal       hud_element_set_tint
/* 8CA74 800F35C4 00A0382D */   daddu    $a3, $a1, $zero
.L800F35C8:
/* 8CA78 800F35C8 3C048011 */  lui       $a0, %hi(D_8010D66C)
/* 8CA7C 800F35CC 8C84D66C */  lw        $a0, %lo(D_8010D66C)($a0)
/* 8CA80 800F35D0 3C058010 */  lui       $a1, %hi(HES_HandPointer)
/* 8CA84 800F35D4 24A54A00 */  addiu     $a1, $a1, %lo(HES_HandPointer)
/* 8CA88 800F35D8 0C0511FF */  jal       hud_element_set_script
/* 8CA8C 800F35DC 00000000 */   nop
/* 8CA90 800F35E0 8E020000 */  lw        $v0, 0x0($s0)
/* 8CA94 800F35E4 8C430318 */  lw        $v1, 0x318($v0)
/* 8CA98 800F35E8 2C62000E */  sltiu     $v0, $v1, 0xE
/* 8CA9C 800F35EC 10400013 */  beqz      $v0, .L800F363C
/* 8CAA0 800F35F0 00031080 */   sll      $v0, $v1, 2
/* 8CAA4 800F35F4 3C018011 */  lui       $at, %hi(jtbl_8010C758)
/* 8CAA8 800F35F8 00220821 */  addu      $at, $at, $v0
/* 8CAAC 800F35FC 8C22C758 */  lw        $v0, %lo(jtbl_8010C758)($at)
/* 8CAB0 800F3600 00400008 */  jr        $v0
/* 8CAB4 800F3604 00000000 */   nop
glabel .L800F3608
/* 8CAB8 800F3608 2404000E */  addiu     $a0, $zero, 0xE
/* 8CABC 800F360C 0C051F9F */  jal       set_window_update
/* 8CAC0 800F3610 24050001 */   addiu    $a1, $zero, 0x1
/* 8CAC4 800F3614 0803CD8D */  j         .L800F3634
/* 8CAC8 800F3618 24040013 */   addiu    $a0, $zero, 0x13
glabel .L800F361C
/* 8CACC 800F361C 2404000E */  addiu     $a0, $zero, 0xE
/* 8CAD0 800F3620 0C051F9F */  jal       set_window_update
/* 8CAD4 800F3624 24050001 */   addiu    $a1, $zero, 0x1
/* 8CAD8 800F3628 0803CD8D */  j         .L800F3634
/* 8CADC 800F362C 24040013 */   addiu    $a0, $zero, 0x13
glabel .L800F3630
/* 8CAE0 800F3630 2404000E */  addiu     $a0, $zero, 0xE
.L800F3634:
/* 8CAE4 800F3634 0C051F9F */  jal       set_window_update
/* 8CAE8 800F3638 24050001 */   addiu    $a1, $zero, 0x1
.L800F363C:
/* 8CAEC 800F363C 2402000A */  addiu     $v0, $zero, 0xA
/* 8CAF0 800F3640 3C018011 */  lui       $at, %hi(D_8010D690)
/* 8CAF4 800F3644 A022D690 */  sb        $v0, %lo(D_8010D690)($at)
/* 8CAF8 800F3648 24020001 */  addiu     $v0, $zero, 0x1
.L800F364C:
/* 8CAFC 800F364C 3C018011 */  lui       $at, %hi(gPopupState)
/* 8CB00 800F3650 AC22D640 */  sw        $v0, %lo(gPopupState)($at)
glabel .L800F3654
/* 8CB04 800F3654 3C038011 */  lui       $v1, %hi(gPopupMenu)
/* 8CB08 800F3658 8C63D69C */  lw        $v1, %lo(gPopupMenu)($v1)
/* 8CB0C 800F365C 0000102D */  daddu     $v0, $zero, $zero
/* 8CB10 800F3660 A460032C */  sh        $zero, 0x32C($v1)
.L800F3664:
/* 8CB14 800F3664 8FBF0038 */  lw        $ra, 0x38($sp)
/* 8CB18 800F3668 8FB30034 */  lw        $s3, 0x34($sp)
/* 8CB1C 800F366C 8FB20030 */  lw        $s2, 0x30($sp)
/* 8CB20 800F3670 8FB1002C */  lw        $s1, 0x2C($sp)
/* 8CB24 800F3674 8FB00028 */  lw        $s0, 0x28($sp)
/* 8CB28 800F3678 03E00008 */  jr        $ra
/* 8CB2C 800F367C 27BD0040 */   addiu    $sp, $sp, 0x40

### DECOMPILED C INSTRUCTIONS:

s32 popup_menu_update(void) {
    s32 posX;
    s32 posY;
    s32 width;
    s32 elementID;
    s32 cond;
    s32 buttons;
    s32 msgID;
    s32 one;
    s32 i;

    switch (gPopupState) {
        case POPUP_STATE_INIT:
            D_8010D67C = 20;
            D_8010D67E = 72;
            D_8010D680 = 20;
            D_8010D682 = 186;
            D_8010D684 = 16;
            D_8010D686 = 88;
            PopupMenu_StarPieceCounterPosX = 32;
            PopupMenu_StarPieceCounterPosY = 164;
            if (PopupNotBattle) {
                D_8010D67C = PopupWorldStartX[gPopupMenu->popupType] + 20;
            }
            if (PopupMenu_MaxDisplayableEntryCount >= 7) {
                D_8010D67E = 62;
            }
            D_8010D68C = 0;
            elementID = hud_element_create(&HES_EmptyBar);
            PopupMenu_EmptybarHEID = elementID;
            hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80);
            hud_element_set_tint(elementID, 255, 255, 255);
            if (gPopupMenu->popupType != POPUP_MENU_THROW_AWAY_ITEM) {
                hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_DISABLED);
            }

            one = POPUP_MENU_SWITCH_PARTNER; // required to match (why is 1 loaded so early?)
            elementID = hud_element_create(gPopupMenu->ptrIcon[0]);
            PopupMenu_EntryIconHEID = elementID;
            hud_element_set_scale(elementID, 0.45f);
            hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_FILTER_TEX | HUD_ELEMENT_FLAG_80);

            elementID = hud_element_create(&HES_AnimatedHandPointer);
            PopupMenu_CursorHEID = elementID;
            hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80);

            elementID = hud_element_create(&HES_GreenArrowUp);
            PopupMenu_UpArrowHEID = elementID;
            hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80);

            elementID = hud_element_create(&HES_GreenArrowDown);
            PopupMenu_DownArrowHEID = elementID;
            hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80);

            if (gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE) {
                PopupMenu_TitleIconHEID = hud_element_create(&HES_StatusStarPiece);
                elementID = PopupMenu_TitleIconHEID;
                hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80);
                hud_element_set_tint(elementID, 255, 255, 255);
            }
            if (gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) {
                PopupMenu_TitleIconHEID = hud_element_create(&HES_StatusStarPiece);
                elementID = PopupMenu_TitleIconHEID;
                hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_FILTER_TEX | HUD_ELEMENT_FLAG_80);
                hud_element_set_tint(elementID, 255, 255, 255);
            }
            if (gPopupMenu->popupType == POPUP_MENU_SELL_ITEM) {
                PopupMenu_TitleIconHEID = hud_element_create(&HES_StatusCoin);
                elementID = PopupMenu_TitleIconHEID;
                hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80);
                hud_element_set_tint(elementID, 255, 255, 255);
            }
            if (gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE || gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) {
                PopupMenu_TimesHEID = hud_element_create(&HES_MenuTimes);
                elementID = PopupMenu_TimesHEID;
                hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80);
                hud_element_set_tint(elementID, 255, 255, 255);
            }
            if (gPopupMenu->popupType == one || gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) {
                PopupMenu_PartnerLevelHEID = hud_element_create(D_80109890[0]);
                elementID = PopupMenu_PartnerLevelHEID;
                hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80);
                hud_element_set_tint(elementID, 255, 255, 255);
            }

            D_8010D65A = -200;
            D_8010D644 = D_8010D691;
            if (!PopupNotBattle) {
                D_8010D644 = 1;
            }
            D_8010D690 = MSG_PAL_STANDARD;

            posX = D_8010D67C;
            posY = D_8010D67E;
            switch (gPopupMenu->popupType) {
                case POPUP_MENU_USE_ITEM:
                case POPUP_MENU_THROW_AWAY_ITEM:
                case POPUP_MENU_CHECK_ITEM:
                case POPUP_MENU_CLAIM_ITEM:
                case POPUP_MENU_USEKEY:
                    set_window_properties(WINDOW_ID_14, posX, posY, 145, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
                    if (gPopupMenu->dipMode == 0) {
                        set_window_properties(WINDOW_ID_15, 25, -6, 95, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14);
                    } else {
                        set_window_properties(WINDOW_ID_15, 12, -6, 121, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14);
                    }
                    set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW);
                    set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE);
                    break;
                case POPUP_MENU_SWITCH_PARTNER:
                    set_window_properties(WINDOW_ID_14, posX, posY, 139, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
                    set_window_properties(WINDOW_ID_17, 13, -6, 114, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14);
                    set_window_update(WINDOW_ID_15, WINDOW_UPDATE_HIDE);
                    set_window_update(WINDOW_ID_17, WINDOW_UPDATE_SHOW);
                    break;
                case POPUP_MENU_TRADE_FOR_BADGE:
                    set_window_properties(WINDOW_ID_14, posX, posY, 162, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
                    set_window_properties(WINDOW_ID_15, 17, -6, 96, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14);
                    set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW);
                    set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE);
                    break;
                case POPUP_MENU_UPGRADE_PARTNER:
                    set_window_properties(WINDOW_ID_14, posX, posY, 146, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
                    set_window_properties(WINDOW_ID_17, 12, -6, 114, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14);
                    set_window_update(WINDOW_ID_15, WINDOW_UPDATE_HIDE);
                    set_window_update(WINDOW_ID_17, WINDOW_UPDATE_SHOW);
                    break;
                case POPUP_MENU_SELL_ITEM:
                    set_window_properties(WINDOW_ID_14, posX, posY, 167, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
                    set_window_properties(WINDOW_ID_15, 22, -6, 95, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14);
                    set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW);
                    set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE);
                    break;
                case POPUP_MENU_READ_LETTER:
                    set_window_properties(WINDOW_ID_14, posX, posY, 170, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
                    set_window_properties(WINDOW_ID_15, 32, -6, 104, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14);
                    set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW);
                    set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE);
                    break;
                case POPUP_MENU_TAKE_FROM_CHEST:
                    set_window_properties(WINDOW_ID_14, posX, posY, 145, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
                    set_window_properties(WINDOW_ID_15, 12, -6, 121, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14);
                    set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW);
                    set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE);
                    break;
                case POPUP_MENU_READ_DIARY_PAGE:
                    set_window_properties(WINDOW_ID_14, posX, posY, 128, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
                    set_window_properties(WINDOW_ID_15, 12, -6, 104, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14);
                    set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW);
                    set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE);
                    break;
                case POPUP_MENU_READ_POSTCARD:
                    set_window_properties(WINDOW_ID_14, posX, posY, 149, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
                    set_window_properties(WINDOW_ID_15, 6, -6, 139, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14);
                    set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW);
                    set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE);
                    break;
                case POPUP_MENU_POST_OFFICE:
                    set_window_properties(WINDOW_ID_14, posX, posY, 131, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
                    set_window_properties(WINDOW_ID_17, 10, -6, 114, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14);
                    set_window_update(WINDOW_ID_15, WINDOW_UPDATE_HIDE);
                    set_window_update(WINDOW_ID_17, WINDOW_UPDATE_SHOW);
                    break;
            }

            switch (gPopupMenu->popupType) {
                case POPUP_MENU_TRADE_FOR_BADGE:
                    set_window_properties(WINDOW_ID_16, 126, -14, 32, 32, WINDOW_PRIORITY_21, popup_draw_cost_icon, NULL, WINDOW_ID_14);
                    break;
                case POPUP_MENU_SELL_ITEM:
                    set_window_properties(WINDOW_ID_16, 131, -14, 32, 32, WINDOW_PRIORITY_21, popup_draw_cost_icon, NULL, WINDOW_ID_14);
                    break;
            }

            if (gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE) {
                set_window_properties(WINDOW_ID_CURRENCY_COUNTER, PopupMenu_StarPieceCounterPosX, PopupMenu_StarPieceCounterPosY,
                    64, 20, WINDOW_PRIORITY_21, func_800F4D28, NULL, -1);
            }

            do {
                cond = FALSE;
                if (PopupMenu_SelectedIndex >= PopupMenu_FirstDisplayIndex + PopupMenu_LastDisplayIndex - 1) {
                    PopupMenu_FirstDisplayIndex++;
                    if (PopupMenu_FirstDisplayIndex > gPopupMenu->numEntries - PopupMenu_MaxDisplayableEntryCount) {
                        PopupMenu_FirstDisplayIndex = gPopupMenu->numEntries - PopupMenu_MaxDisplayableEntryCount;
                        if (PopupMenu_FirstDisplayIndex < 0) {
                            PopupMenu_FirstDisplayIndex = 0;
                        }
                    } else {
                        cond = TRUE;
                    }
                }
            } while (cond);

            PopupMenu_LastDisplayIndex = PopupMenu_FirstDisplayIndex + PopupMenu_MaxDisplayableEntryCount;
            D_8010D658 = -PopupMenu_FirstDisplayIndex * LINE_HEIGHT;
            if (gPopupMenu->popupType >= POPUP_MENU_USE_ITEM
                && (gPopupMenu->popupType < POPUP_MENU_READ_DIARY_PAGE || gPopupMenu->popupType == POPUP_MENU_USEKEY))
            {
                set_window_properties(WINDOW_ID_19, D_8010D680, D_8010D682, 280, 32, WINDOW_PRIORITY_20, func_800F48F4, NULL, -1);
            }

            posX = D_8010D684;
            posY = D_8010D686;
            switch (gPopupMenu->popupType) {
                case POPUP_MENU_USE_ITEM:
                case POPUP_MENU_CHECK_ITEM:
                case POPUP_MENU_CLAIM_ITEM:
                case POPUP_MENU_TAKE_FROM_CHEST:
                case POPUP_MENU_USEKEY:
                    set_window_properties(WINDOW_ID_21, posX, posY, 144, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
                    break;
                case POPUP_MENU_SWITCH_PARTNER:
                case POPUP_MENU_THROW_AWAY_ITEM:
                case POPUP_MENU_POST_OFFICE:
                    set_window_properties(WINDOW_ID_21, posX, posY, 144, 40, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
                    break;
                case POPUP_MENU_TRADE_FOR_BADGE:
                case POPUP_MENU_READ_DIARY_PAGE:
                case POPUP_MENU_READ_POSTCARD:
                    set_window_properties(WINDOW_ID_21, posX, posY, 128, 40, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
                    break;
                case POPUP_MENU_UPGRADE_PARTNER:
                    set_window_properties(WINDOW_ID_21, posX, posY, 136, 40, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
                    break;
                case POPUP_MENU_READ_LETTER:
                    set_window_properties(WINDOW_ID_21, posX, posY, 112, 40, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
                    break;
                case POPUP_MENU_SELL_ITEM:
                    set_window_properties(WINDOW_ID_21, posX, posY, 120, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
                    break;
            }

            if (!PopupNotBattle) {
                switch (gPopupMenu->popupType) {
                    case POPUP_MENU_USE_ITEM:
                    case POPUP_MENU_THROW_AWAY_ITEM:
                    case POPUP_MENU_TRADE_FOR_BADGE:
                    case POPUP_MENU_SELL_ITEM:
                    case POPUP_MENU_CHECK_ITEM:
                    case POPUP_MENU_CLAIM_ITEM:
                    case POPUP_MENU_READ_LETTER:
                    case POPUP_MENU_TAKE_FROM_CHEST:
                    case POPUP_MENU_USEKEY:
                        set_window_update(WINDOW_ID_14, WINDOW_UPDATE_SHOW);
                        set_window_update(WINDOW_ID_19, WINDOW_UPDATE_SHOW);
                        break;
                    case POPUP_MENU_SWITCH_PARTNER:
                    case POPUP_MENU_UPGRADE_PARTNER:
                        set_window_update(WINDOW_ID_14, WINDOW_UPDATE_SHOW);
                        set_window_update(WINDOW_ID_19, WINDOW_UPDATE_SHOW);
                        break;
                    case POPUP_MENU_READ_DIARY_PAGE:
                    case POPUP_MENU_READ_POSTCARD:
                    case POPUP_MENU_POST_OFFICE:
                        set_window_update(WINDOW_ID_14, WINDOW_UPDATE_SHOW);
                        break;
                }
            } else {
                switch (gPopupMenu->popupType) {
                    case POPUP_MENU_USE_ITEM:
                    case POPUP_MENU_THROW_AWAY_ITEM:
                    case POPUP_MENU_TRADE_FOR_BADGE:
                    case POPUP_MENU_SELL_ITEM:
                    case POPUP_MENU_CHECK_ITEM:
                    case POPUP_MENU_CLAIM_ITEM:
                    case POPUP_MENU_READ_LETTER:
                    case POPUP_MENU_TAKE_FROM_CHEST:
                    case POPUP_MENU_USEKEY:
                        set_window_update(WINDOW_ID_14, (s32)basic_window_update);
                        sfx_play_sound(SOUND_1);
                        set_window_update(WINDOW_ID_19, (s32)basic_window_update);
                        break;
                    case POPUP_MENU_SWITCH_PARTNER:
                    case POPUP_MENU_UPGRADE_PARTNER:
                        set_window_update(WINDOW_ID_14, (s32)basic_window_update);
                        sfx_play_sound(SOUND_2);
                        set_window_update(WINDOW_ID_19, (s32)basic_window_update);
                        break;
                    case POPUP_MENU_READ_DIARY_PAGE:
                    case POPUP_MENU_READ_POSTCARD:
                    case POPUP_MENU_POST_OFFICE:
                        set_window_update(WINDOW_ID_14, (s32)basic_window_update);
                        sfx_play_sound(SOUND_1);
                        break;
                }
                set_window_update(WINDOW_ID_21, WINDOW_UPDATE_SHOW);
            }

            if (gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE) {
                set_window_update(WINDOW_ID_16, (s32)basic_window_update);
                set_window_update(WINDOW_ID_CURRENCY_COUNTER, (s32)basic_window_update);
            }
            if (gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) {
                set_window_update(WINDOW_ID_18, (s32)basic_window_update);
            }
            if (gPopupMenu->popupType == POPUP_MENU_SELL_ITEM) {
                set_window_update(WINDOW_ID_16, (s32)basic_window_update);
            }
            gPopupState = POPUP_STATE_CHOOSING;
            break;
        case POPUP_STATE_CHOOSING:
            if (D_8010D644 != 0) {
                D_8010D644--;
            } else {
                PopupMenu_PrevSelectedIndex = PopupMenu_SelectedIndex;

                // change selection on up input
                if (gGameStatusPtr->heldButtons[0] & (BUTTON_STICK_UP | BUTTON_Z) &&
                    (PopupMenu_SelectedIndex > 0 || (gGameStatusPtr->pressedButtons[0] & (BUTTON_STICK_UP | BUTTON_Z))))
                {
                    do {
                        PopupMenu_SelectedIndex--;
                    } while (0); // required to match
                }

                // change selection on down input
                if (gGameStatusPtr->heldButtons[0] & (BUTTON_STICK_DOWN | BUTTON_R) &&
                    ((PopupMenu_SelectedIndex < gPopupMenu->numEntries - 1) || (gGameStatusPtr->pressedButtons[0] & (BUTTON_STICK_DOWN | BUTTON_R))))
                {
                    do {
                        PopupMenu_SelectedIndex++;
                    } while (0); // required to match
                }

                // wrap selected index
                if (PopupMenu_SelectedIndex < 0) {
                    PopupMenu_SelectedIndex = gPopupMenu->numEntries - 1;
                }
                if (PopupMenu_SelectedIndex > gPopupMenu->numEntries - 1) {
                    PopupMenu_SelectedIndex = 0;
                }

                if (PopupMenu_PrevSelectedIndex != PopupMenu_SelectedIndex) {
                    sfx_play_sound(SOUND_MENU_CHANGE_SELECTION);
                }

                // ensure one option is displayed above the selected index, if applicable
                // shift up to 4 entries at a time on list wrap
                for (i = 0; i < 4; i++) {
                    if (PopupMenu_SelectedIndex < PopupMenu_FirstDisplayIndex + 1) {
                        PopupMenu_FirstDisplayIndex--;
                        if (PopupMenu_FirstDisplayIndex < 0) {
                            PopupMenu_FirstDisplayIndex = 0;
                        }
                    }
                }

                // ensure one option is displayed after the selected index, if applicable
                // shift up to 4 entries at a time on list wrap
                for (i = 0; i < 4; i++) {
                    if (PopupMenu_SelectedIndex >= PopupMenu_LastDisplayIndex - 1) {
                        PopupMenu_FirstDisplayIndex++;
                        if (PopupMenu_FirstDisplayIndex > gPopupMenu->numEntries - PopupMenu_MaxDisplayableEntryCount) {
                            PopupMenu_FirstDisplayIndex = gPopupMenu->numEntries - PopupMenu_MaxDisplayableEntryCount;
                            if (PopupMenu_FirstDisplayIndex < 0) {
                                PopupMenu_FirstDisplayIndex = 0;
                            }
                        }
                    }
                    PopupMenu_LastDisplayIndex = PopupMenu_FirstDisplayIndex + PopupMenu_MaxDisplayableEntryCount;
                }

                // make selection on A button input
                if (gGameStatusPtr->pressedButtons[0] & BUTTON_A) {
                    switch (gPopupMenu->popupType) {
                        case POPUP_MENU_READ_LETTER:
                            sfx_play_sound(SOUND_MENU_NEXT);
                            if (!PopupNotBattle) {
                                gPopupState = POPUP_STATE_CHOSE_WORLD;
                            } else {
                                gPopupState = POPUP_STATE_CHOSE_BATTLE;
                            }
                            break;
                        case POPUP_MENU_POST_OFFICE:
                            sfx_play_sound(SOUND_MENU_NEXT);
                            if (!PopupNotBattle) {
                                gPopupState = POPUP_STATE_CHOSE_WORLD;
                            } else {
                                gPopupState = POPUP_STATE_CHOSE_BATTLE;
                            }
                            break;
                        default:
                            if (gPopupMenu->enabled[PopupMenu_SelectedIndex]) {
                                sfx_play_sound(SOUND_MENU_NEXT);
                                if (!PopupNotBattle) {
                                    gPopupState = POPUP_STATE_CHOSE_WORLD;
                                } else {
                                    gPopupState = POPUP_STATE_CHOSE_BATTLE;
                                }
                                break;
                            }
                            if (gPopupMenu->popupType == POPUP_MENU_SWITCH_PARTNER) {
                                sfx_play_sound(SOUND_MENU_ERROR);
                                gPopupState = POPUP_STATE_ALREADY_HAVE_PARTNER_BEGIN;
                                break;
                            }
                            if (PopupNotBattle && (gPopupMenu->popupType == POPUP_MENU_USE_ITEM || gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE)) {
                                sfx_play_sound(SOUND_MENU_ERROR);
                            }
                            break;
                    }
                } else {
                    switch (gPopupMenu->popupType) {
                        case POPUP_MENU_USE_ITEM:
                        case POPUP_MENU_THROW_AWAY_ITEM:
                        case POPUP_MENU_TRADE_FOR_BADGE:
                        case POPUP_MENU_SELL_ITEM:
                        case POPUP_MENU_CHECK_ITEM:
                        case POPUP_MENU_CLAIM_ITEM:
                        case POPUP_MENU_USEKEY:
                            if (PopupNotBattle) {
                                buttons = BUTTON_B | BUTTON_C_LEFT;
                            } else {
                                buttons = BUTTON_B;
                            }
                            break;
                        case POPUP_MENU_SWITCH_PARTNER:
                        case POPUP_MENU_UPGRADE_PARTNER:
                            if (PopupNotBattle) {
                                buttons = BUTTON_B | BUTTON_C_RIGHT;
                            } else {
                                buttons = BUTTON_B;
                            }
                            break;
                        case POPUP_MENU_READ_LETTER:
                        case POPUP_MENU_TAKE_FROM_CHEST:
                        case POPUP_MENU_READ_DIARY_PAGE:
                        case POPUP_MENU_READ_POSTCARD:
                        case POPUP_MENU_POST_OFFICE:
                            buttons = BUTTON_B;
                            break;
                        default:
                            buttons = 0;
                            break;
                    }

                    if (gGameStatusPtr->pressedButtons[0] & buttons) {
                        sfx_play_sound(SOUND_MENU_BACK);
                        if (PopupNotDipping) {
                            if (!PopupNotBattle) {
                                gPopupState = POPUP_STATE_MINUS_3;
                            } else {
                                gPopupState = POPUP_STATE_MINUS_7;
                            }
                        } else {
                            if (PopupDipMode == 0) {
                                gPopupState = POPUP_STATE_ALREADY_HAVE_PARTNER_BEGIN;
                            } else {
                                gPopupState = POPUP_STATE_CANCEL_DIP;
                            }
                        }
                        break;
                    }

                    switch (gPopupMenu->popupType) {
                        default:
                            buttons = 0;
                            break;
                        case POPUP_MENU_USE_ITEM:
                            buttons = BUTTON_C_RIGHT;
                            break;
                        case POPUP_MENU_SWITCH_PARTNER:
                            buttons = BUTTON_C_LEFT;
                            break;
                    }

                    if (PopupNotBattle && (gGameStatusPtr->pressedButtons[0] & buttons)) {
                        sfx_play_sound(SOUND_MENU_BACK);
                        gPopupState = POPUP_STATE_MINUS_6;
                        break;
                    }
                }
            }
            break;
        case POPUP_STATE_CHOSE_WORLD:
            hud_element_set_tint(PopupMenu_EmptybarHEID, 160, 160, 160);
            hud_element_set_tint(PopupMenu_EntryIconHEID, 160, 160, 160);
            hud_element_set_tint(PopupMenu_CursorHEID, 160, 160, 160);
            hud_element_set_tint(PopupMenu_UpArrowHEID, 160, 160, 160);
            hud_element_set_tint(PopupMenu_DownArrowHEID, 160, 160, 160);
            hud_element_set_script(PopupMenu_CursorHEID, &HES_HandPointer);
            if (gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE) {
                hud_element_set_tint(PopupMenu_TitleIconHEID, 160, 160, 160);
                hud_element_set_tint(PopupMenu_TimesHEID, 160, 160, 160);
            }
            if (gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) {
                hud_element_set_tint(PopupMenu_TitleIconHEID, 160, 160, 160);
                hud_element_set_tint(PopupMenu_TimesHEID, 160, 160, 160);
            }
            if (gPopupMenu->popupType == POPUP_MENU_SWITCH_PARTNER || gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) {
                hud_element_set_tint(PopupMenu_PartnerLevelHEID, 160, 160, 160);
            }
            if (gPopupMenu->popupType == POPUP_MENU_SELL_ITEM) {
                hud_element_set_tint(PopupMenu_TitleIconHEID, 160, 160, 160);
            }
            D_8010D690 = MSG_PAL_0D;

            gPopupMenu->result = PopupMenu_SelectedIndex + 1;
            return PopupMenu_SelectedIndex + 1;
        case POPUP_STATE_CHOSE_BATTLE:
            gPopupMenu->result = PopupMenu_SelectedIndex + 1;
            return PopupMenu_SelectedIndex + 1;
        case POPUP_STATE_MINUS_3:
            switch (gPopupMenu->popupType) {
                case POPUP_MENU_USE_ITEM:
                case POPUP_MENU_THROW_AWAY_ITEM:
                case POPUP_MENU_TRADE_FOR_BADGE:
                case POPUP_MENU_SELL_ITEM:
                case POPUP_MENU_CHECK_ITEM:
                case POPUP_MENU_CLAIM_ITEM:
                case POPUP_MENU_READ_LETTER:
                case POPUP_MENU_TAKE_FROM_CHEST:
                case POPUP_MENU_USEKEY:
                    set_window_update(WINDOW_ID_14, WINDOW_UPDATE_HIDE);
                    set_window_update(WINDOW_ID_19, WINDOW_UPDATE_HIDE);
                    break;
                case POPUP_MENU_SWITCH_PARTNER:
                case POPUP_MENU_UPGRADE_PARTNER:
                    set_window_update(WINDOW_ID_14, WINDOW_UPDATE_HIDE);
                    set_window_update(WINDOW_ID_19, WINDOW_UPDATE_HIDE);
                    break;
                case POPUP_MENU_READ_DIARY_PAGE:
                case POPUP_MENU_READ_POSTCARD:
                case POPUP_MENU_POST_OFFICE:
                    set_window_update(WINDOW_ID_14, WINDOW_UPDATE_HIDE);
                    break;
            }
            destroy_popup_menu();
            free_worker(gPopupWorker);
            gPopupState = POPUP_STATE_MINUS_5;
            gPopupMenu->result = POPUP_RESULT_CANCEL;
            return 255;
        case POPUP_STATE_MINUS_4:
            free_worker(gPopupWorker);
            gPopupState = POPUP_STATE_MINUS_5;
            gPopupMenu->result = POPUP_RESULT_CANCEL;
            return 255;
        case POPUP_STATE_MINUS_6:
            gPopupMenu->result = POPUP_RESULT_MINUS_2;
            return 255;
        case POPUP_STATE_MINUS_7:
        case POPUP_STATE_MINUS_5:
            gPopupMenu->result = POPUP_RESULT_CANCEL;
            return 255;
        case POPUP_STATE_10:
            D_8010D644--;
            if (D_8010D644 == 0) {
                gPopupState = POPUP_STATE_11;
                gPopupMenu->result = PopupMenu_SelectedIndex + 1;
                return PopupMenu_SelectedIndex + 1;
            }
            break;
        case POPUP_STATE_20:
            D_8010D644++;
            if (D_8010D644 >= D_8010D692) {
                gPopupState = POPUP_STATE_CHOOSING;
                gPopupMenu->result = PopupMenu_SelectedIndex + 1;
                return PopupMenu_SelectedIndex + 1;
            }
            break;
        case POPUP_STATE_ALREADY_HAVE_PARTNER_BEGIN:
            gPopupState = POPUP_STATE_ALREADY_HAVE_PARTNER_SHOW;
            gPopupMenu->result = POPUP_RESULT_MINUS_1;
            return 0;
        case POPUP_STATE_ALREADY_HAVE_PARTNER_SHOW:
            set_window_update(WINDOW_ID_14, WINDOW_UPDATE_HIDE);
            set_window_update(WINDOW_ID_19, WINDOW_UPDATE_HIDE);
            if (PopupNotBattle) {
                set_window_update(WINDOW_ID_21, WINDOW_UPDATE_HIDE);
            }
            width = get_msg_width(MSG_Menus_006B, 0) + 23;
            set_window_properties(WINDOW_ID_BATTLE_POPUP, 160 - (width / 2), 80, width, 40, WINDOW_PRIORITY_20, popup_draw_already_have_partner, NULL, -1);
            set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_SHOW);
            D_8010D644 = 60;
            gPopupState = POPUP_STATE_ALREADY_HAVE_PARTNER_AWAIT;
            return 0;
        case POPUP_STATE_ALREADY_HAVE_PARTNER_AWAIT:
            if (gGameStatusPtr->pressedButtons[0] & (BUTTON_A | BUTTON_B | BUTTON_C_RIGHT)) {
                D_8010D644 = 0;
            }
            if (D_8010D644 != 0) {
                D_8010D644--;
                return 0;
            }
            set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_HIDE);
            set_window_update(WINDOW_ID_14, WINDOW_UPDATE_SHOW);
            set_window_update(WINDOW_ID_19, WINDOW_UPDATE_SHOW);
            if (PopupNotBattle) {
                set_window_update(WINDOW_ID_21, WINDOW_UPDATE_SHOW);
            }
            gPopupState = POPUP_STATE_CHOOSING;
            gPopupMenu->result = POPUP_RESULT_CHOOSING;
            break;
        case POPUP_STATE_CANCEL_DIP:
            hud_element_set_tint(PopupMenu_EmptybarHEID, 160, 160, 160);
            hud_element_set_tint(PopupMenu_EntryIconHEID, 160, 160, 160);
            hud_element_set_tint(PopupMenu_CursorHEID, 160, 160, 160);
            hud_element_set_tint(PopupMenu_UpArrowHEID, 160, 160, 160);
            hud_element_set_tint(PopupMenu_DownArrowHEID, 160, 160, 160);
            hud_element_set_script(PopupMenu_CursorHEID, &HES_HandPointer);

            if (gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE) {
                hud_element_set_tint(PopupMenu_TitleIconHEID, 160, 160, 160);
                hud_element_set_tint(PopupMenu_TimesHEID, 160, 160, 160);
            }
            if (gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) {
                hud_element_set_tint(PopupMenu_TitleIconHEID, 160, 160, 160);
                hud_element_set_tint(PopupMenu_TimesHEID, 160, 160, 160);
            }
            if (gPopupMenu->popupType == POPUP_MENU_SWITCH_PARTNER || gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) {
                hud_element_set_tint(PopupMenu_PartnerLevelHEID, 160, 160, 160);
            }
            if (gPopupMenu->popupType == POPUP_MENU_SELL_ITEM) {
                hud_element_set_tint(PopupMenu_TitleIconHEID, 160, 160, 160);
            }

            switch (gPopupMenu->popupType) {
                case POPUP_MENU_USE_ITEM:
                case POPUP_MENU_THROW_AWAY_ITEM:
                case POPUP_MENU_TRADE_FOR_BADGE:
                case POPUP_MENU_SELL_ITEM:
                case POPUP_MENU_CHECK_ITEM:
                case POPUP_MENU_CLAIM_ITEM:
                case POPUP_MENU_READ_LETTER:
                case POPUP_MENU_TAKE_FROM_CHEST:
                case POPUP_MENU_USEKEY:
                    set_window_update(WINDOW_ID_14, WINDOW_UPDATE_HIDE);
                    set_window_update(WINDOW_ID_19, WINDOW_UPDATE_HIDE);
                    break;
                case POPUP_MENU_SWITCH_PARTNER:
                case POPUP_MENU_UPGRADE_PARTNER:
                    set_window_update(WINDOW_ID_14, WINDOW_UPDATE_HIDE);
                    set_window_update(WINDOW_ID_19, WINDOW_UPDATE_HIDE);
                    break;
                case POPUP_MENU_READ_DIARY_PAGE:
                case POPUP_MENU_READ_POSTCARD:
                case POPUP_MENU_POST_OFFICE:
                    set_window_update(WINDOW_ID_14, WINDOW_UPDATE_HIDE);
                    break;
            }

            D_8010D690 = MSG_PAL_0D;
            if (PopupDipMode == 1) {
                msgID = MSG_Menus_0068;
            } else {
                msgID = MSG_Menus_0069;
            }
            width = get_msg_width(msgID, 0) + 23;
            set_window_properties(WINDOW_ID_21, 160 - (width / 2), 76, width, 32, WINDOW_PRIORITY_19, func_800F4C1C, NULL, -1);
            set_window_update(WINDOW_ID_21, WINDOW_UPDATE_SHOW);
            D_8010D6A0 = msg_get_printer_for_msg(MSG_Choice_001D, &D_8010D6A4);
            msg_printer_set_origin_pos(D_8010D6A0, 160, 144);
            gPopupState = POPUP_STATE_CANCEL_DIP_AWAIT_CHOICE;
            break;
        case POPUP_STATE_CANCEL_DIP_AWAIT_CHOICE:
            if (D_8010D6A4 == 1) {
                set_window_update(WINDOW_ID_21, WINDOW_UPDATE_HIDE);
                switch (D_8010D6A0->currentOption) {
                    case 0:
                        gPopupState = POPUP_STATE_CANCEL_DIP_ACCEPT;
                        break;
                    case 1:
                        gPopupState = POPUP_STATE_CANCEL_DIP_DECLINE;
                        break;
                }
            }
            break;
        case POPUP_STATE_CANCEL_DIP_ACCEPT:
            gPopupState = POPUP_STATE_MINUS_3;
            break;
        case POPUP_STATE_CANCEL_DIP_DECLINE:
            hud_element_set_tint(PopupMenu_EmptybarHEID, 255, 255, 255);
            hud_element_set_tint(PopupMenu_EntryIconHEID, 255, 255, 255);
            hud_element_set_tint(PopupMenu_CursorHEID, 255, 255, 255);
            hud_element_set_tint(PopupMenu_UpArrowHEID, 255, 255, 255);
            hud_element_set_tint(PopupMenu_DownArrowHEID, 255, 255, 255);
            if (gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE) {
                hud_element_set_tint(PopupMenu_TitleIconHEID, 160, 160, 160);
                hud_element_set_tint(PopupMenu_TimesHEID, 160, 160, 160);
            }
            if (gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) {
                hud_element_set_tint(PopupMenu_TitleIconHEID, 160, 160, 160);
                hud_element_set_tint(PopupMenu_TimesHEID, 160, 160, 160);
            }
            if (gPopupMenu->popupType == POPUP_MENU_SWITCH_PARTNER || gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) {
                hud_element_set_tint(PopupMenu_PartnerLevelHEID, 160, 160, 160);
            }
            if (gPopupMenu->popupType == POPUP_MENU_SELL_ITEM) {
                hud_element_set_tint(PopupMenu_TitleIconHEID, 160, 160, 160);
            }
            hud_element_set_script(PopupMenu_CursorHEID, &HES_HandPointer);

            switch (gPopupMenu->popupType) {
                case POPUP_MENU_USE_ITEM:
                case POPUP_MENU_THROW_AWAY_ITEM:
                case POPUP_MENU_TRADE_FOR_BADGE:
                case POPUP_MENU_SELL_ITEM:
                case POPUP_MENU_CHECK_ITEM:
                case POPUP_MENU_CLAIM_ITEM:
                case POPUP_MENU_READ_LETTER:
                case POPUP_MENU_TAKE_FROM_CHEST:
                case POPUP_MENU_USEKEY:
                    set_window_update(WINDOW_ID_14, WINDOW_UPDATE_SHOW);
                    set_window_update(WINDOW_ID_19, WINDOW_UPDATE_SHOW);
                    break;
                case POPUP_MENU_SWITCH_PARTNER:
                case POPUP_MENU_UPGRADE_PARTNER:
                    set_window_update(WINDOW_ID_14, WINDOW_UPDATE_SHOW);
                    set_window_update(WINDOW_ID_19, WINDOW_UPDATE_SHOW);
                    break;
                case POPUP_MENU_READ_DIARY_PAGE:
                case POPUP_MENU_READ_POSTCARD:
                case POPUP_MENU_POST_OFFICE:
                    set_window_update(WINDOW_ID_14, WINDOW_UPDATE_SHOW);
                    break;
            }
            D_8010D690 = MSG_PAL_STANDARD;
            gPopupState = POPUP_STATE_CHOOSING;
            break;
    }
    gPopupMenu->result = POPUP_RESULT_CHOOSING;
    return 0;
}