### RAW ASSEMBLY INSTRUCTIONS:

glabel update_input
/* 3C74 80028874 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* 3C78 80028878 AFB20018 */  sw        $s2, 0x18($sp)
/* 3C7C 8002887C 3C128007 */  lui       $s2, %hi(gGameStatusPtr)
/* 3C80 80028880 2652419C */  addiu     $s2, $s2, %lo(gGameStatusPtr)
/* 3C84 80028884 AFBF001C */  sw        $ra, 0x1C($sp)
/* 3C88 80028888 AFB10014 */  sw        $s1, 0x14($sp)
/* 3C8C 8002888C AFB00010 */  sw        $s0, 0x10($sp)
/* 3C90 80028890 8E420000 */  lw        $v0, 0x0($s2)
/* 3C94 80028894 90420073 */  lbu       $v0, 0x73($v0)
/* 3C98 80028898 3C11800A */  lui       $s1, %hi(D_8009A5B8)
/* 3C9C 8002889C 2631A5B8 */  addiu     $s1, $s1, %lo(D_8009A5B8)
/* 3CA0 800288A0 30420001 */  andi      $v0, $v0, 0x1
/* 3CA4 800288A4 10400005 */  beqz      $v0, .L800288BC
/* 3CA8 800288A8 0000802D */   daddu    $s0, $zero, $zero
/* 3CAC 800288AC 24100001 */  addiu     $s0, $zero, 0x1
/* 3CB0 800288B0 0220202D */  daddu     $a0, $s1, $zero
/* 3CB4 800288B4 0C017D94 */  jal       nuContDataGet
/* 3CB8 800288B8 0000282D */   daddu    $a1, $zero, $zero
.L800288BC:
/* 3CBC 800288BC 8E430000 */  lw        $v1, 0x0($s2)
/* 3CC0 800288C0 80620071 */  lb        $v0, 0x71($v1)
/* 3CC4 800288C4 10400015 */  beqz      $v0, .L8002891C
/* 3CC8 800288C8 28420002 */   slti     $v0, $v0, 0x2
/* 3CCC 800288CC 10400008 */  beqz      $v0, .L800288F0
/* 3CD0 800288D0 00000000 */   nop
/* 3CD4 800288D4 96220000 */  lhu       $v0, 0x0($s1)
/* 3CD8 800288D8 3042F000 */  andi      $v0, $v0, 0xF000
/* 3CDC 800288DC 10400004 */  beqz      $v0, .L800288F0
/* 3CE0 800288E0 0200102D */   daddu    $v0, $s0, $zero
/* 3CE4 800288E4 10400002 */  beqz      $v0, .L800288F0
/* 3CE8 800288E8 24020002 */   addiu    $v0, $zero, 0x2
/* 3CEC 800288EC A0620071 */  sb        $v0, 0x71($v1)
.L800288F0:
/* 3CF0 800288F0 3C048007 */  lui       $a0, %hi(gGameStatusPtr)
/* 3CF4 800288F4 2484419C */  addiu     $a0, $a0, %lo(gGameStatusPtr)
/* 3CF8 800288F8 8C830000 */  lw        $v1, 0x0($a0)
/* 3CFC 800288FC 94620068 */  lhu       $v0, 0x68($v1)
/* 3D00 80028900 A6220000 */  sh        $v0, 0x0($s1)
/* 3D04 80028904 9062006A */  lbu       $v0, 0x6A($v1)
/* 3D08 80028908 8C830000 */  lw        $v1, 0x0($a0)
/* 3D0C 8002890C A2220002 */  sb        $v0, 0x2($s1)
/* 3D10 80028910 9062006B */  lbu       $v0, 0x6B($v1)
/* 3D14 80028914 24100001 */  addiu     $s0, $zero, 0x1
/* 3D18 80028918 A2220003 */  sb        $v0, 0x3($s1)
.L8002891C:
/* 3D1C 8002891C 0200102D */  daddu     $v0, $s0, $zero
/* 3D20 80028920 10400166 */  beqz      $v0, .L80028EBC
/* 3D24 80028924 00000000 */   nop
/* 3D28 80028928 92230003 */  lbu       $v1, 0x3($s1)
/* 3D2C 8002892C 92220002 */  lbu       $v0, 0x2($s1)
/* 3D30 80028930 00031E00 */  sll       $v1, $v1, 24
/* 3D34 80028934 00033E03 */  sra       $a3, $v1, 24
/* 3D38 80028938 00021600 */  sll       $v0, $v0, 24
/* 3D3C 8002893C 18400007 */  blez      $v0, .L8002895C
/* 3D40 80028940 00022E03 */   sra      $a1, $v0, 24
/* 3D44 80028944 24A2FFFC */  addiu     $v0, $a1, -0x4
/* 3D48 80028948 0040282D */  daddu     $a1, $v0, $zero
/* 3D4C 8002894C 00021400 */  sll       $v0, $v0, 16
/* 3D50 80028950 0441000B */  bgez      $v0, .L80028980
/* 3D54 80028954 00071400 */   sll      $v0, $a3, 16
/* 3D58 80028958 0000282D */  daddu     $a1, $zero, $zero
.L8002895C:
/* 3D5C 8002895C 00051400 */  sll       $v0, $a1, 16
/* 3D60 80028960 04410007 */  bgez      $v0, .L80028980
/* 3D64 80028964 00071400 */   sll      $v0, $a3, 16
/* 3D68 80028968 24A20004 */  addiu     $v0, $a1, 0x4
/* 3D6C 8002896C 0040282D */  daddu     $a1, $v0, $zero
/* 3D70 80028970 00021400 */  sll       $v0, $v0, 16
/* 3D74 80028974 5C400001 */  bgtzl     $v0, .L8002897C
/* 3D78 80028978 0000282D */   daddu    $a1, $zero, $zero
.L8002897C:
/* 3D7C 8002897C 00071400 */  sll       $v0, $a3, 16
.L80028980:
/* 3D80 80028980 18400006 */  blez      $v0, .L8002899C
/* 3D84 80028984 24E2FFFC */   addiu    $v0, $a3, -0x4
/* 3D88 80028988 0040382D */  daddu     $a3, $v0, $zero
/* 3D8C 8002898C 00021400 */  sll       $v0, $v0, 16
/* 3D90 80028990 04410009 */  bgez      $v0, .L800289B8
/* 3D94 80028994 00000000 */   nop
/* 3D98 80028998 0000382D */  daddu     $a3, $zero, $zero
.L8002899C:
/* 3D9C 8002899C 00071400 */  sll       $v0, $a3, 16
/* 3DA0 800289A0 04410005 */  bgez      $v0, .L800289B8
/* 3DA4 800289A4 24E20004 */   addiu    $v0, $a3, 0x4
/* 3DA8 800289A8 0040382D */  daddu     $a3, $v0, $zero
/* 3DAC 800289AC 00021400 */  sll       $v0, $v0, 16
/* 3DB0 800289B0 5C400001 */  bgtzl     $v0, .L800289B8
/* 3DB4 800289B4 0000382D */   daddu    $a3, $zero, $zero
.L800289B8:
/* 3DB8 800289B8 3C038007 */  lui       $v1, %hi(gGameStatusPtr)
/* 3DBC 800289BC 2463419C */  addiu     $v1, $v1, %lo(gGameStatusPtr)
/* 3DC0 800289C0 8C620000 */  lw        $v0, 0x0($v1)
/* 3DC4 800289C4 A0450040 */  sb        $a1, 0x40($v0)
/* 3DC8 800289C8 8C620000 */  lw        $v0, 0x0($v1)
/* 3DCC 800289CC A0470044 */  sb        $a3, 0x44($v0)
/* 3DD0 800289D0 00051400 */  sll       $v0, $a1, 16
/* 3DD4 800289D4 00023403 */  sra       $a2, $v0, 16
/* 3DD8 800289D8 28C20021 */  slti      $v0, $a2, 0x21
/* 3DDC 800289DC 96240000 */  lhu       $a0, 0x0($s1)
/* 3DE0 800289E0 1440001B */  bnez      $v0, .L80028A50
/* 3DE4 800289E4 0000402D */   daddu    $t0, $zero, $zero
/* 3DE8 800289E8 24080001 */  addiu     $t0, $zero, 0x1
/* 3DEC 800289EC 8C620000 */  lw        $v0, 0x0($v1)
/* 3DF0 800289F0 3C030008 */  lui       $v1, (0x80000 >> 16)
/* 3DF4 800289F4 8C420030 */  lw        $v0, 0x30($v0)
/* 3DF8 800289F8 00431024 */  and       $v0, $v0, $v1
/* 3DFC 800289FC 14400005 */  bnez      $v0, .L80028A14
/* 3E00 80028A00 00832025 */   or       $a0, $a0, $v1
/* 3E04 80028A04 3C01800A */  lui       $at, %hi(D_8009A6A0)
/* 3E08 80028A08 A425A6A0 */  sh        $a1, %lo(D_8009A6A0)($at)
/* 3E0C 80028A0C 0800A295 */  j         .L80028A54
/* 3E10 80028A10 00051400 */   sll      $v0, $a1, 16
.L80028A14:
/* 3E14 80028A14 3C02800A */  lui       $v0, %hi(D_8009A6A4)
/* 3E18 80028A18 8442A6A4 */  lh        $v0, %lo(D_8009A6A4)($v0)
/* 3E1C 80028A1C 14400006 */  bnez      $v0, .L80028A38
/* 3E20 80028A20 00000000 */   nop
/* 3E24 80028A24 3C03800A */  lui       $v1, %hi(D_8009A6A0)
/* 3E28 80028A28 2463A6A0 */  addiu     $v1, $v1, %lo(D_8009A6A0)
/* 3E2C 80028A2C 84620000 */  lh        $v0, 0x0($v1)
/* 3E30 80028A30 0800A292 */  j         .L80028A48
/* 3E34 80028A34 0046102A */   slt      $v0, $v0, $a2
.L80028A38:
/* 3E38 80028A38 3C03800A */  lui       $v1, %hi(D_8009A6A0)
/* 3E3C 80028A3C 2463A6A0 */  addiu     $v1, $v1, %lo(D_8009A6A0)
/* 3E40 80028A40 84620000 */  lh        $v0, 0x0($v1)
/* 3E44 80028A44 00C2102A */  slt       $v0, $a2, $v0
.L80028A48:
/* 3E48 80028A48 54400001 */  bnel      $v0, $zero, .L80028A50
/* 3E4C 80028A4C A4650000 */   sh       $a1, 0x0($v1)
.L80028A50:
/* 3E50 80028A50 00051400 */  sll       $v0, $a1, 16
.L80028A54:
/* 3E54 80028A54 00023403 */  sra       $a2, $v0, 16
/* 3E58 80028A58 28C2FFE0 */  slti      $v0, $a2, -0x20
/* 3E5C 80028A5C 1040001D */  beqz      $v0, .L80028AD4
/* 3E60 80028A60 0100102D */   daddu    $v0, $t0, $zero
/* 3E64 80028A64 24080001 */  addiu     $t0, $zero, 0x1
/* 3E68 80028A68 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 3E6C 80028A6C 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 3E70 80028A70 3C030004 */  lui       $v1, (0x40000 >> 16)
/* 3E74 80028A74 8C420030 */  lw        $v0, 0x30($v0)
/* 3E78 80028A78 00431024 */  and       $v0, $v0, $v1
/* 3E7C 80028A7C 14400005 */  bnez      $v0, .L80028A94
/* 3E80 80028A80 00832025 */   or       $a0, $a0, $v1
/* 3E84 80028A84 3C01800A */  lui       $at, %hi(D_8009A6A0)
/* 3E88 80028A88 A425A6A0 */  sh        $a1, %lo(D_8009A6A0)($at)
/* 3E8C 80028A8C 0800A2B5 */  j         .L80028AD4
/* 3E90 80028A90 0100102D */   daddu    $v0, $t0, $zero
.L80028A94:
/* 3E94 80028A94 3C02800A */  lui       $v0, %hi(D_8009A6A4)
/* 3E98 80028A98 8442A6A4 */  lh        $v0, %lo(D_8009A6A4)($v0)
/* 3E9C 80028A9C 14400006 */  bnez      $v0, .L80028AB8
/* 3EA0 80028AA0 00000000 */   nop
/* 3EA4 80028AA4 3C03800A */  lui       $v1, %hi(D_8009A6A0)
/* 3EA8 80028AA8 2463A6A0 */  addiu     $v1, $v1, %lo(D_8009A6A0)
/* 3EAC 80028AAC 84620000 */  lh        $v0, 0x0($v1)
/* 3EB0 80028AB0 0800A2B2 */  j         .L80028AC8
/* 3EB4 80028AB4 00C2102A */   slt      $v0, $a2, $v0
.L80028AB8:
/* 3EB8 80028AB8 3C03800A */  lui       $v1, %hi(D_8009A6A0)
/* 3EBC 80028ABC 2463A6A0 */  addiu     $v1, $v1, %lo(D_8009A6A0)
/* 3EC0 80028AC0 84620000 */  lh        $v0, 0x0($v1)
/* 3EC4 80028AC4 0046102A */  slt       $v0, $v0, $a2
.L80028AC8:
/* 3EC8 80028AC8 54400001 */  bnel      $v0, $zero, .L80028AD0
/* 3ECC 80028ACC A4650000 */   sh       $a1, 0x0($v1)
.L80028AD0:
/* 3ED0 80028AD0 0100102D */  daddu     $v0, $t0, $zero
.L80028AD4:
/* 3ED4 80028AD4 14400005 */  bnez      $v0, .L80028AEC
/* 3ED8 80028AD8 00071400 */   sll      $v0, $a3, 16
/* 3EDC 80028ADC 3C01800A */  lui       $at, %hi(D_8009A6A4)
/* 3EE0 80028AE0 A420A6A4 */  sh        $zero, %lo(D_8009A6A4)($at)
/* 3EE4 80028AE4 3C01800A */  lui       $at, %hi(D_8009A6A0)
/* 3EE8 80028AE8 A425A6A0 */  sh        $a1, %lo(D_8009A6A0)($at)
.L80028AEC:
/* 3EEC 80028AEC 00023403 */  sra       $a2, $v0, 16
/* 3EF0 80028AF0 28C20021 */  slti      $v0, $a2, 0x21
/* 3EF4 80028AF4 1440001C */  bnez      $v0, .L80028B68
/* 3EF8 80028AF8 0000402D */   daddu    $t0, $zero, $zero
/* 3EFC 80028AFC 24080001 */  addiu     $t0, $zero, 0x1
/* 3F00 80028B00 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 3F04 80028B04 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 3F08 80028B08 3C030001 */  lui       $v1, (0x10000 >> 16)
/* 3F0C 80028B0C 8C420030 */  lw        $v0, 0x30($v0)
/* 3F10 80028B10 00431024 */  and       $v0, $v0, $v1
/* 3F14 80028B14 14400005 */  bnez      $v0, .L80028B2C
/* 3F18 80028B18 00832025 */   or       $a0, $a0, $v1
/* 3F1C 80028B1C 3C01800A */  lui       $at, %hi(D_8009A6A2)
/* 3F20 80028B20 A427A6A2 */  sh        $a3, %lo(D_8009A6A2)($at)
/* 3F24 80028B24 0800A2DB */  j         .L80028B6C
/* 3F28 80028B28 00071400 */   sll      $v0, $a3, 16
.L80028B2C:
/* 3F2C 80028B2C 3C02800A */  lui       $v0, %hi(D_8009A6A6)
/* 3F30 80028B30 8442A6A6 */  lh        $v0, %lo(D_8009A6A6)($v0)
/* 3F34 80028B34 14400006 */  bnez      $v0, .L80028B50
/* 3F38 80028B38 00000000 */   nop
/* 3F3C 80028B3C 3C03800A */  lui       $v1, %hi(D_8009A6A2)
/* 3F40 80028B40 2463A6A2 */  addiu     $v1, $v1, %lo(D_8009A6A2)
/* 3F44 80028B44 84620000 */  lh        $v0, 0x0($v1)
/* 3F48 80028B48 0800A2D8 */  j         .L80028B60
/* 3F4C 80028B4C 0046102A */   slt      $v0, $v0, $a2
.L80028B50:
/* 3F50 80028B50 3C03800A */  lui       $v1, %hi(D_8009A6A2)
/* 3F54 80028B54 2463A6A2 */  addiu     $v1, $v1, %lo(D_8009A6A2)
/* 3F58 80028B58 84620000 */  lh        $v0, 0x0($v1)
/* 3F5C 80028B5C 00C2102A */  slt       $v0, $a2, $v0
.L80028B60:
/* 3F60 80028B60 54400001 */  bnel      $v0, $zero, .L80028B68
/* 3F64 80028B64 A4670000 */   sh       $a3, 0x0($v1)
.L80028B68:
/* 3F68 80028B68 00071400 */  sll       $v0, $a3, 16
.L80028B6C:
/* 3F6C 80028B6C 00023403 */  sra       $a2, $v0, 16
/* 3F70 80028B70 28C2FFE0 */  slti      $v0, $a2, -0x20
/* 3F74 80028B74 1040002B */  beqz      $v0, .L80028C24
/* 3F78 80028B78 0100102D */   daddu    $v0, $t0, $zero
/* 3F7C 80028B7C 24080001 */  addiu     $t0, $zero, 0x1
/* 3F80 80028B80 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 3F84 80028B84 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 3F88 80028B88 3C030002 */  lui       $v1, (0x20000 >> 16)
/* 3F8C 80028B8C 8C420030 */  lw        $v0, 0x30($v0)
/* 3F90 80028B90 00431024 */  and       $v0, $v0, $v1
/* 3F94 80028B94 14400005 */  bnez      $v0, .L80028BAC
/* 3F98 80028B98 00832025 */   or       $a0, $a0, $v1
/* 3F9C 80028B9C 3C01800A */  lui       $at, %hi(D_8009A6A2)
/* 3FA0 80028BA0 A427A6A2 */  sh        $a3, %lo(D_8009A6A2)($at)
/* 3FA4 80028BA4 0800A309 */  j         .L80028C24
/* 3FA8 80028BA8 0100102D */   daddu    $v0, $t0, $zero
.L80028BAC:
/* 3FAC 80028BAC 3C02800A */  lui       $v0, %hi(D_8009A6A6)
/* 3FB0 80028BB0 8442A6A6 */  lh        $v0, %lo(D_8009A6A6)($v0)
/* 3FB4 80028BB4 14400014 */  bnez      $v0, .L80028C08
/* 3FB8 80028BB8 00000000 */   nop
/* 3FBC 80028BBC 3C03800A */  lui       $v1, %hi(D_8009A6A2)
/* 3FC0 80028BC0 2463A6A2 */  addiu     $v1, $v1, %lo(D_8009A6A2)
/* 3FC4 80028BC4 84620000 */  lh        $v0, 0x0($v1)
/* 3FC8 80028BC8 0800A306 */  j         .L80028C18
/* 3FCC 80028BCC 00C2102A */   slt      $v0, $a2, $v0
.L80028BD0:
/* 3FD0 80028BD0 8CA30000 */  lw        $v1, 0x0($a1)
/* 3FD4 80028BD4 8CA40030 */  lw        $a0, 0x30($a1)
/* 3FD8 80028BD8 2402FFFF */  addiu     $v0, $zero, -0x1
/* 3FDC 80028BDC A4A20060 */  sh        $v0, 0x60($a1)
/* 3FE0 80028BE0 8CA20000 */  lw        $v0, 0x0($a1)
/* 3FE4 80028BE4 00641826 */  xor       $v1, $v1, $a0
/* 3FE8 80028BE8 94A40048 */  lhu       $a0, 0x48($a1)
/* 3FEC 80028BEC ACA30020 */  sw        $v1, 0x20($a1)
/* 3FF0 80028BF0 00621824 */  and       $v1, $v1, $v0
/* 3FF4 80028BF4 ACA30020 */  sw        $v1, 0x20($a1)
/* 3FF8 80028BF8 0800A3AB */  j         .L80028EAC
/* 3FFC 80028BFC A4A40058 */   sh       $a0, 0x58($a1)
.L80028C00:
/* 4000 80028C00 0800A3AB */  j         .L80028EAC
/* 4004 80028C04 ACA00020 */   sw       $zero, 0x20($a1)
.L80028C08:
/* 4008 80028C08 3C03800A */  lui       $v1, %hi(D_8009A6A2)
/* 400C 80028C0C 2463A6A2 */  addiu     $v1, $v1, %lo(D_8009A6A2)
/* 4010 80028C10 84620000 */  lh        $v0, 0x0($v1)
/* 4014 80028C14 0046102A */  slt       $v0, $v0, $a2
.L80028C18:
/* 4018 80028C18 54400001 */  bnel      $v0, $zero, .L80028C20
/* 401C 80028C1C A4670000 */   sh       $a3, 0x0($v1)
.L80028C20:
/* 4020 80028C20 0100102D */  daddu     $v0, $t0, $zero
.L80028C24:
/* 4024 80028C24 14400005 */  bnez      $v0, .L80028C3C
/* 4028 80028C28 00051400 */   sll      $v0, $a1, 16
/* 402C 80028C2C 3C01800A */  lui       $at, %hi(D_8009A6A6)
/* 4030 80028C30 A420A6A6 */  sh        $zero, %lo(D_8009A6A6)($at)
/* 4034 80028C34 3C01800A */  lui       $at, %hi(D_8009A6A2)
/* 4038 80028C38 A427A6A2 */  sh        $a3, %lo(D_8009A6A2)($at)
.L80028C3C:
/* 403C 80028C3C 00023403 */  sra       $a2, $v0, 16
/* 4040 80028C40 28C20021 */  slti      $v0, $a2, 0x21
/* 4044 80028C44 1440001C */  bnez      $v0, .L80028CB8
/* 4048 80028C48 00051400 */   sll      $v0, $a1, 16
/* 404C 80028C4C 3C08800A */  lui       $t0, %hi(D_8009A6A4)
/* 4050 80028C50 2508A6A4 */  addiu     $t0, $t0, %lo(D_8009A6A4)
/* 4054 80028C54 85030000 */  lh        $v1, 0x0($t0)
/* 4058 80028C58 24020001 */  addiu     $v0, $zero, 0x1
/* 405C 80028C5C 1462000A */  bne       $v1, $v0, .L80028C88
/* 4060 80028C60 00000000 */   nop
/* 4064 80028C64 3C02800A */  lui       $v0, %hi(D_8009A6A0)
/* 4068 80028C68 8442A6A0 */  lh        $v0, %lo(D_8009A6A0)($v0)
/* 406C 80028C6C 00C21023 */  subu      $v0, $a2, $v0
/* 4070 80028C70 28420011 */  slti      $v0, $v0, 0x11
/* 4074 80028C74 14400004 */  bnez      $v0, .L80028C88
/* 4078 80028C78 3C02FFF7 */   lui      $v0, (0xFFF7FFFF >> 16)
/* 407C 80028C7C 3442FFFF */  ori       $v0, $v0, (0xFFF7FFFF & 0xFFFF)
/* 4080 80028C80 00822024 */  and       $a0, $a0, $v0
/* 4084 80028C84 A5000000 */  sh        $zero, 0x0($t0)
.L80028C88:
/* 4088 80028C88 3C03800A */  lui       $v1, %hi(D_8009A6A0)
/* 408C 80028C8C 8463A6A0 */  lh        $v1, %lo(D_8009A6A0)($v1)
/* 4090 80028C90 00051400 */  sll       $v0, $a1, 16
/* 4094 80028C94 00021403 */  sra       $v0, $v0, 16
/* 4098 80028C98 00621823 */  subu      $v1, $v1, $v0
/* 409C 80028C9C 28630011 */  slti      $v1, $v1, 0x11
/* 40A0 80028CA0 14600005 */  bnez      $v1, .L80028CB8
/* 40A4 80028CA4 00051400 */   sll      $v0, $a1, 16
/* 40A8 80028CA8 24020001 */  addiu     $v0, $zero, 0x1
/* 40AC 80028CAC 3C01800A */  lui       $at, %hi(D_8009A6A4)
/* 40B0 80028CB0 A422A6A4 */  sh        $v0, %lo(D_8009A6A4)($at)
/* 40B4 80028CB4 00051400 */  sll       $v0, $a1, 16
.L80028CB8:
/* 40B8 80028CB8 00023403 */  sra       $a2, $v0, 16
/* 40BC 80028CBC 28C2FFE0 */  slti      $v0, $a2, -0x20
/* 40C0 80028CC0 1040001B */  beqz      $v0, .L80028D30
/* 40C4 80028CC4 24020001 */   addiu    $v0, $zero, 0x1
/* 40C8 80028CC8 3C08800A */  lui       $t0, %hi(D_8009A6A4)
/* 40CC 80028CCC 2508A6A4 */  addiu     $t0, $t0, %lo(D_8009A6A4)
/* 40D0 80028CD0 85030000 */  lh        $v1, 0x0($t0)
/* 40D4 80028CD4 1462000C */  bne       $v1, $v0, .L80028D08
/* 40D8 80028CD8 00051400 */   sll      $v0, $a1, 16
/* 40DC 80028CDC 3C02800A */  lui       $v0, %hi(D_8009A6A0)
/* 40E0 80028CE0 8442A6A0 */  lh        $v0, %lo(D_8009A6A0)($v0)
/* 40E4 80028CE4 00461023 */  subu      $v0, $v0, $a2
/* 40E8 80028CE8 28420011 */  slti      $v0, $v0, 0x11
/* 40EC 80028CEC 14400006 */  bnez      $v0, .L80028D08
/* 40F0 80028CF0 00051400 */   sll      $v0, $a1, 16
/* 40F4 80028CF4 3C02FFFB */  lui       $v0, (0xFFFBFFFF >> 16)
/* 40F8 80028CF8 3442FFFF */  ori       $v0, $v0, (0xFFFBFFFF & 0xFFFF)
/* 40FC 80028CFC 00822024 */  and       $a0, $a0, $v0
/* 4100 80028D00 A5000000 */  sh        $zero, 0x0($t0)
/* 4104 80028D04 00051400 */  sll       $v0, $a1, 16
.L80028D08:
/* 4108 80028D08 3C03800A */  lui       $v1, %hi(D_8009A6A0)
/* 410C 80028D0C 8463A6A0 */  lh        $v1, %lo(D_8009A6A0)($v1)
/* 4110 80028D10 00021403 */  sra       $v0, $v0, 16
/* 4114 80028D14 00431023 */  subu      $v0, $v0, $v1
/* 4118 80028D18 28420011 */  slti      $v0, $v0, 0x11
/* 411C 80028D1C 14400005 */  bnez      $v0, .L80028D34
/* 4120 80028D20 00071400 */   sll      $v0, $a3, 16
/* 4124 80028D24 24020001 */  addiu     $v0, $zero, 0x1
/* 4128 80028D28 3C01800A */  lui       $at, %hi(D_8009A6A4)
/* 412C 80028D2C A422A6A4 */  sh        $v0, %lo(D_8009A6A4)($at)
.L80028D30:
/* 4130 80028D30 00071400 */  sll       $v0, $a3, 16
.L80028D34:
/* 4134 80028D34 00022C03 */  sra       $a1, $v0, 16
/* 4138 80028D38 28A20021 */  slti      $v0, $a1, 0x21
/* 413C 80028D3C 1440001C */  bnez      $v0, .L80028DB0
/* 4140 80028D40 00071400 */   sll      $v0, $a3, 16
/* 4144 80028D44 3C06800A */  lui       $a2, %hi(D_8009A6A6)
/* 4148 80028D48 24C6A6A6 */  addiu     $a2, $a2, %lo(D_8009A6A6)
/* 414C 80028D4C 84C30000 */  lh        $v1, 0x0($a2)
/* 4150 80028D50 24020001 */  addiu     $v0, $zero, 0x1
/* 4154 80028D54 1462000A */  bne       $v1, $v0, .L80028D80
/* 4158 80028D58 00000000 */   nop
/* 415C 80028D5C 3C02800A */  lui       $v0, %hi(D_8009A6A2)
/* 4160 80028D60 8442A6A2 */  lh        $v0, %lo(D_8009A6A2)($v0)
/* 4164 80028D64 00A21023 */  subu      $v0, $a1, $v0
/* 4168 80028D68 28420011 */  slti      $v0, $v0, 0x11
/* 416C 80028D6C 14400004 */  bnez      $v0, .L80028D80
/* 4170 80028D70 3C02FFFE */   lui      $v0, (0xFFFEFFFF >> 16)
/* 4174 80028D74 3442FFFF */  ori       $v0, $v0, (0xFFFEFFFF & 0xFFFF)
/* 4178 80028D78 00822024 */  and       $a0, $a0, $v0
/* 417C 80028D7C A4C00000 */  sh        $zero, 0x0($a2)
.L80028D80:
/* 4180 80028D80 3C03800A */  lui       $v1, %hi(D_8009A6A2)
/* 4184 80028D84 8463A6A2 */  lh        $v1, %lo(D_8009A6A2)($v1)
/* 4188 80028D88 00071400 */  sll       $v0, $a3, 16
/* 418C 80028D8C 00021403 */  sra       $v0, $v0, 16
/* 4190 80028D90 00621823 */  subu      $v1, $v1, $v0
/* 4194 80028D94 28630011 */  slti      $v1, $v1, 0x11
/* 4198 80028D98 14600005 */  bnez      $v1, .L80028DB0
/* 419C 80028D9C 00071400 */   sll      $v0, $a3, 16
/* 41A0 80028DA0 24020001 */  addiu     $v0, $zero, 0x1
/* 41A4 80028DA4 3C01800A */  lui       $at, %hi(D_8009A6A6)
/* 41A8 80028DA8 A422A6A6 */  sh        $v0, %lo(D_8009A6A6)($at)
/* 41AC 80028DAC 00071400 */  sll       $v0, $a3, 16
.L80028DB0:
/* 41B0 80028DB0 00022C03 */  sra       $a1, $v0, 16
/* 41B4 80028DB4 28A2FFE0 */  slti      $v0, $a1, -0x20
/* 41B8 80028DB8 1040001A */  beqz      $v0, .L80028E24
/* 41BC 80028DBC 24020001 */   addiu    $v0, $zero, 0x1
/* 41C0 80028DC0 3C06800A */  lui       $a2, %hi(D_8009A6A6)
/* 41C4 80028DC4 24C6A6A6 */  addiu     $a2, $a2, %lo(D_8009A6A6)
/* 41C8 80028DC8 84C30000 */  lh        $v1, 0x0($a2)
/* 41CC 80028DCC 1462000C */  bne       $v1, $v0, .L80028E00
/* 41D0 80028DD0 00071400 */   sll      $v0, $a3, 16
/* 41D4 80028DD4 3C02800A */  lui       $v0, %hi(D_8009A6A2)
/* 41D8 80028DD8 8442A6A2 */  lh        $v0, %lo(D_8009A6A2)($v0)
/* 41DC 80028DDC 00451023 */  subu      $v0, $v0, $a1
/* 41E0 80028DE0 28420011 */  slti      $v0, $v0, 0x11
/* 41E4 80028DE4 14400006 */  bnez      $v0, .L80028E00
/* 41E8 80028DE8 00071400 */   sll      $v0, $a3, 16
/* 41EC 80028DEC 3C02FFFD */  lui       $v0, (0xFFFDFFFF >> 16)
/* 41F0 80028DF0 3442FFFF */  ori       $v0, $v0, (0xFFFDFFFF & 0xFFFF)
/* 41F4 80028DF4 00822024 */  and       $a0, $a0, $v0
/* 41F8 80028DF8 A4C00000 */  sh        $zero, 0x0($a2)
/* 41FC 80028DFC 00071400 */  sll       $v0, $a3, 16
.L80028E00:
/* 4200 80028E00 3C03800A */  lui       $v1, %hi(D_8009A6A2)
/* 4204 80028E04 8463A6A2 */  lh        $v1, %lo(D_8009A6A2)($v1)
/* 4208 80028E08 00021403 */  sra       $v0, $v0, 16
/* 420C 80028E0C 00431023 */  subu      $v0, $v0, $v1
/* 4210 80028E10 28420011 */  slti      $v0, $v0, 0x11
/* 4214 80028E14 14400003 */  bnez      $v0, .L80028E24
/* 4218 80028E18 24020001 */   addiu    $v0, $zero, 0x1
/* 421C 80028E1C 3C01800A */  lui       $at, %hi(D_8009A6A6)
/* 4220 80028E20 A422A6A6 */  sh        $v0, %lo(D_8009A6A6)($at)
.L80028E24:
/* 4224 80028E24 3C058007 */  lui       $a1, %hi(gGameStatusPtr)
/* 4228 80028E28 8CA5419C */  lw        $a1, %lo(gGameStatusPtr)($a1)
/* 422C 80028E2C 8CA20030 */  lw        $v0, 0x30($a1)
/* 4230 80028E30 ACA40000 */  sw        $a0, 0x0($a1)
/* 4234 80028E34 0080182D */  daddu     $v1, $a0, $zero
/* 4238 80028E38 00821026 */  xor       $v0, $a0, $v0
/* 423C 80028E3C ACA20010 */  sw        $v0, 0x10($a1)
/* 4240 80028E40 00431024 */  and       $v0, $v0, $v1
/* 4244 80028E44 1060FF6E */  beqz      $v1, .L80028C00
/* 4248 80028E48 ACA20010 */   sw       $v0, 0x10($a1)
/* 424C 80028E4C 8CA20030 */  lw        $v0, 0x30($a1)
/* 4250 80028E50 5443FF5F */  bnel      $v0, $v1, .L80028BD0
/* 4254 80028E54 ACA30020 */   sw       $v1, 0x20($a1)
/* 4258 80028E58 84A20060 */  lh        $v0, 0x60($a1)
/* 425C 80028E5C 94A30060 */  lhu       $v1, 0x60($a1)
/* 4260 80028E60 04400008 */  bltz      $v0, .L80028E84
/* 4264 80028E64 2462FFFF */   addiu    $v0, $v1, -0x1
/* 4268 80028E68 A4A20060 */  sh        $v0, 0x60($a1)
/* 426C 80028E6C 00021400 */  sll       $v0, $v0, 16
/* 4270 80028E70 1440FF63 */  bnez      $v0, .L80028C00
/* 4274 80028E74 0080102D */   daddu    $v0, $a0, $zero
/* 4278 80028E78 94A30050 */  lhu       $v1, 0x50($a1)
/* 427C 80028E7C 0800A3AA */  j         .L80028EA8
/* 4280 80028E80 ACA20020 */   sw       $v0, 0x20($a1)
.L80028E84:
/* 4284 80028E84 94A20058 */  lhu       $v0, 0x58($a1)
/* 4288 80028E88 2442FFFF */  addiu     $v0, $v0, -0x1
/* 428C 80028E8C A4A20058 */  sh        $v0, 0x58($a1)
/* 4290 80028E90 00021400 */  sll       $v0, $v0, 16
/* 4294 80028E94 54400005 */  bnel      $v0, $zero, .L80028EAC
/* 4298 80028E98 ACA00020 */   sw       $zero, 0x20($a1)
/* 429C 80028E9C 8CA20000 */  lw        $v0, 0x0($a1)
/* 42A0 80028EA0 94A30050 */  lhu       $v1, 0x50($a1)
/* 42A4 80028EA4 ACA20020 */  sw        $v0, 0x20($a1)
.L80028EA8:
/* 42A8 80028EA8 A4A30060 */  sh        $v1, 0x60($a1)
.L80028EAC:
/* 42AC 80028EAC 3C038007 */  lui       $v1, %hi(gGameStatusPtr)
/* 42B0 80028EB0 8C63419C */  lw        $v1, %lo(gGameStatusPtr)($v1)
/* 42B4 80028EB4 8C620000 */  lw        $v0, 0x0($v1)
/* 42B8 80028EB8 AC620030 */  sw        $v0, 0x30($v1)
.L80028EBC:
/* 42BC 80028EBC 8FBF001C */  lw        $ra, 0x1C($sp)
/* 42C0 80028EC0 8FB20018 */  lw        $s2, 0x18($sp)
/* 42C4 80028EC4 8FB10014 */  lw        $s1, 0x14($sp)
/* 42C8 80028EC8 8FB00010 */  lw        $s0, 0x10($sp)
/* 42CC 80028ECC 03E00008 */  jr        $ra
/* 42D0 80028ED0 27BD0020 */   addiu    $sp, $sp, 0x20
/* 42D4 80028ED4 00000000 */  nop
/* 42D8 80028ED8 00000000 */  nop
/* 42DC 80028EDC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void update_input(void) {
    OSContPad* contData = &D_8009A5B8;
    s16 handleInput = FALSE;
    s16 cond1;
    s32 buttons;
    s16 stickX;
    s16 stickY;

    if (gGameStatusPtr->contBitPattern & 1) {
        handleInput = TRUE;
        nuContDataGet(contData, 0);
    }

    if (gGameStatusPtr->demoState != DEMO_STATE_NONE) {
        if (gGameStatusPtr->demoState < DEMO_STATE_CHANGE_MAP
            && (contData->button & (BUTTON_A | BUTTON_B | BUTTON_Z | BUTTON_START))
            && handleInput
        ) {
            gGameStatusPtr->demoState = DEMO_STATE_CHANGE_MAP;
        }
        contData->button = gGameStatusPtr->demoButtonInput;
        contData->stick_x = gGameStatusPtr->demoStickX;
        contData->stick_y = gGameStatusPtr->demoStickY;
        handleInput = TRUE;
    }

    if (!handleInput) {
        return;
    }

    stickX = contData->stick_x;
    stickY = contData->stick_y;
    if (stickX > 0) {
        stickX -= 4;
        if (stickX < 0) {
            stickX = 0;
        }
    }
    if (stickX < 0) {
        stickX += 4;
        if (stickX > 0) {
            stickX = 0;
        }
    }

    if (stickY > 0) {
        stickY -= 4;
        if (stickY < 0) {
            stickY = 0;
        }
    }
    if (stickY < 0) {
        stickY += 4;
        if (stickY > 0) {
            stickY = 0;
        }
    }

    gGameStatusPtr->stickX[0] = stickX;
    gGameStatusPtr->stickY[0] = stickY;

    buttons = contData->button;
    cond1 = FALSE;
    if (stickX > 0x20) {
        cond1 = TRUE;
        buttons |= BUTTON_STICK_RIGHT;
        if (!(gGameStatusPtr->prevButtons[0] & BUTTON_STICK_RIGHT)) {
            D_8009A6A0 = stickX;
        } else if (D_8009A6A4 == 0) {
            if (D_8009A6A0 < stickX) {
                D_8009A6A0 = stickX;
            }
        } else {
            if (D_8009A6A0 > stickX) {
                D_8009A6A0 = stickX;
            }
        }
    }

    if (stickX < -0x20) {
        cond1 = TRUE;
        buttons |= BUTTON_STICK_LEFT;
        if (!(gGameStatusPtr->prevButtons[0] & BUTTON_STICK_LEFT)) {
            D_8009A6A0 = stickX;
        } else if (D_8009A6A4 == 0) {
            if (D_8009A6A0 > stickX) {
                D_8009A6A0 = stickX;
            }
        } else {
            if (D_8009A6A0 < stickX)
            {
                D_8009A6A0 = stickX;
            }
        }
    }

    if (!cond1) {
        D_8009A6A4 = 0;
        D_8009A6A0 = stickX;
    }

    cond1 = FALSE;
    if (stickY > 0x20) {
        cond1 = TRUE;
        buttons |= BUTTON_STICK_UP;
        if (!(gGameStatusPtr->prevButtons[0] & BUTTON_STICK_UP)) {
            D_8009A6A2 = stickY;
        } else if (D_8009A6A6 == 0) {
            if (D_8009A6A2 < stickY) {
                D_8009A6A2 = stickY;
            }
        } else {
            if (D_8009A6A2 > stickY) {
                D_8009A6A2 = stickY;
            }
        }
    }

    if (stickY < -0x20) {
        cond1 = TRUE;
        buttons |= BUTTON_STICK_DOWN;
        if (!(gGameStatusPtr->prevButtons[0] & BUTTON_STICK_DOWN)) {
            D_8009A6A2 = stickY;
        } else if (D_8009A6A6 == 0) {
            if (D_8009A6A2 > stickY) {
                D_8009A6A2 = stickY;
            }
        } else {
            if (D_8009A6A2 < stickY) {
                D_8009A6A2 = stickY;
            }
        }
    }

    if (!cond1) {
        D_8009A6A6 = 0;
        D_8009A6A2 = stickY;
    }

    if (stickX > 0x20) {
        if (D_8009A6A4 == 1 && stickX - D_8009A6A0 > 0x10) {
            buttons &= ~BUTTON_STICK_RIGHT;
            D_8009A6A4 = 0;
        }
        if (D_8009A6A0 - stickX > 0x10) {
            D_8009A6A4 = 1;
        }
    }

    if (stickX < -0x20) {
        if (D_8009A6A4 == 1 && D_8009A6A0 - stickX > 0x10) {
            buttons &= ~BUTTON_STICK_LEFT;
            D_8009A6A4 = 0;
        }
        if (stickX - D_8009A6A0 > 0x10) {
            D_8009A6A4 = 1;
        }
    }

    if (stickY > 0x20) {
        if (D_8009A6A6 == 1 && stickY - D_8009A6A2 > 0x10) {
            buttons &= ~BUTTON_STICK_UP;
            D_8009A6A6 = 0;
        }
        if (D_8009A6A2 - stickY > 0x10) {
            D_8009A6A6 = 1;
        }
    }

    if (stickY < -0x20) {
        if (D_8009A6A6 == 1 && D_8009A6A2 - stickY > 0x10) {
            buttons &= ~BUTTON_STICK_DOWN;
            D_8009A6A6 = 0;
        }
        if (stickY - D_8009A6A2 > 0x10) {
            D_8009A6A6 = 1;
        }
    }

    gGameStatusPtr->currentButtons[0] = buttons;
    gGameStatusPtr->pressedButtons[0] = gGameStatusPtr->currentButtons[0] ^ gGameStatusPtr->prevButtons[0];
    gGameStatusPtr->pressedButtons[0] &= gGameStatusPtr->currentButtons[0];
    do {
        if (gGameStatusPtr->currentButtons[0] == 0) {
            gGameStatusPtr->heldButtons[0] = 0;
        } else if (gGameStatusPtr->prevButtons[0] != gGameStatusPtr->currentButtons[0]) {
            gGameStatusPtr->heldButtons[0] = gGameStatusPtr->currentButtons[0];
            gGameStatusPtr->unk_60 = -1;
            gGameStatusPtr->heldButtons[0] = gGameStatusPtr->currentButtons[0] ^ gGameStatusPtr->prevButtons[0];
            gGameStatusPtr->heldButtons[0] &= gGameStatusPtr->currentButtons[0];
            gGameStatusPtr->unk_58 = gGameStatusPtr->unk_48[0];
        } else {
            if (gGameStatusPtr->unk_60 >= 0) {
                gGameStatusPtr->unk_60--;
                if (gGameStatusPtr->unk_60 != 0) {
                    gGameStatusPtr->heldButtons[0] = 0;
                } else {
                    gGameStatusPtr->heldButtons[0] = gGameStatusPtr->currentButtons[0];
                    gGameStatusPtr->unk_60 = gGameStatusPtr->unk_50[0];
                }
            } else {
                gGameStatusPtr->unk_58--;
                if (gGameStatusPtr->unk_58 != 0) {
                    gGameStatusPtr->heldButtons[0] = 0;
                } else {
                    gGameStatusPtr->heldButtons[0] = gGameStatusPtr->currentButtons[0];
                    gGameStatusPtr->unk_60 = gGameStatusPtr->unk_50[0];
                }
            }
        }
    } while (0);

    gGameStatusPtr->prevButtons[0] = gGameStatusPtr->currentButtons[0];
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_8021835C
/* 59EA3C 8021835C 27BDFF78 */  addiu     $sp, $sp, -0x88
glabel b_area_mim_mim_01_UnkFogFunc2
/* 59EA40 80218360 3C038023 */  lui       $v1, %hi(b_area_kzn2_VineRenderState)
/* 59EA44 80218364 8C63B550 */  lw        $v1, %lo(b_area_kzn2_VineRenderState)($v1)
D_80218368:
/* 59EA48 80218368 2402FFFF */  addiu     $v0, $zero, -0x1
.L8021836C:
/* 59EA4C 8021836C AFBF0054 */  sw        $ra, 0x54($sp)
.L80218370:
/* 59EA50 80218370 AFBE0050 */  sw        $fp, 0x50($sp)
.L80218374:
/* 59EA54 80218374 AFB7004C */  sw        $s7, 0x4C($sp)
glabel func_80218378
/* 59EA58 80218378 AFB60048 */  sw        $s6, 0x48($sp)
glabel b_area_trd_part_2_PlayLandOnTowerFX
/* 59EA5C 8021837C AFB50044 */  sw        $s5, 0x44($sp)
glabel dup_b_area_flo_SetAbsoluteStatusOffsets
/* 59EA60 80218380 AFB40040 */  sw        $s4, 0x40($sp)
glabel b_area_tik2_UnfadeBackgroundToBlack
/* 59EA64 80218384 AFB3003C */  sw        $s3, 0x3C($sp)
.L80218388:
/* 59EA68 80218388 AFB20038 */  sw        $s2, 0x38($sp)
glabel func_8021838C
/* 59EA6C 8021838C AFB10034 */  sw        $s1, 0x34($sp)
D_80218390:
/* 59EA70 80218390 AFB00030 */  sw        $s0, 0x30($sp)
/* 59EA74 80218394 F7BE0080 */  sdc1      $f30, 0x80($sp)
b_area_iwa_Formation_07:
/* 59EA78 80218398 F7BC0078 */  sdc1      $f28, 0x78($sp)
/* 59EA7C 8021839C F7BA0070 */  sdc1      $f26, 0x70($sp)
glabel func_802183A0
/* 59EA80 802183A0 F7B80068 */  sdc1      $f24, 0x68($sp)
glabel func_802183A4_660AF4
/* 59EA84 802183A4 F7B60060 */  sdc1      $f22, 0x60($sp)
glabel b_area_jan2_white_magikoopa_GetSelectedMoveID
/* 59EA88 802183A8 1062012F */  beq       $v1, $v0, .L80218868_59EF48
.L802183AC:
/* 59EA8C 802183AC F7B40058 */   sdc1     $f20, 0x58($sp)
.L802183B0:
/* 59EA90 802183B0 14600059 */  bnez      $v1, .L80218518_59EBF8
.L802183B4:
/* 59EA94 802183B4 0000382D */   daddu    $a3, $zero, $zero
/* 59EA98 802183B8 3C108023 */  lui       $s0, %hi(b_area_kzn2_VineData)
/* 59EA9C 802183BC 2610ADD0 */  addiu     $s0, $s0, %lo(b_area_kzn2_VineData)
D_802183C0:
/* 59EAA0 802183C0 3C0142B4 */  lui       $at, (0x42B40000 >> 16)
.L802183C4:
/* 59EAA4 802183C4 4481E000 */  mtc1      $at, $f28
.L802183C8:
/* 59EAA8 802183C8 3C014334 */  lui       $at, (0x43340000 >> 16)
D_802183CC:
/* 59EAAC 802183CC 4481D000 */  mtc1      $at, $f26
/* 59EAB0 802183D0 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
glabel func_802183D4
/* 59EAB4 802183D4 4481A000 */  mtc1      $at, $f20
.L802183D8:
/* 59EAB8 802183D8 3C01C334 */  lui       $at, (0xC3340000 >> 16)
glabel func_802183DC
/* 59EABC 802183DC 4481B000 */  mtc1      $at, $f22
glabel b_area_dig_IsSaveVar123
/* 59EAC0 802183E0 24020001 */  addiu     $v0, $zero, 0x1
.L802183E4:
/* 59EAC4 802183E4 10E20011 */  beq       $a3, $v0, .L8021842C
b_area_omo2_general_guy_ActorParts:
/* 59EAC8 802183E8 28E20002 */   slti     $v0, $a3, 0x2
glabel func_802183EC_6DC18C
/* 59EACC 802183EC 50400005 */  beql      $v0, $zero, func_80218404
.L802183F0:
/* 59EAD0 802183F0 24020002 */   addiu    $v0, $zero, 0x2
.L802183F4:
/* 59EAD4 802183F4 10E00009 */  beqz      $a3, .L8021841C
glabel b_area_hos_magikoopa_UnkFunc52
/* 59EAD8 802183F8 00000000 */   nop
/* 59EADC 802183FC 0808621A */  j         .L80218868_59EF48
.L80218400:
/* 59EAE0 80218400 00000000 */   nop
glabel func_80218404
/* 59EAE4 80218404 10E2000B */  beq       $a3, $v0, .L80218434_59EB14
.L80218408:
/* 59EAE8 80218408 24020003 */   addiu    $v0, $zero, 0x3
glabel func_8021840C
/* 59EAEC 8021840C 10E2000A */  beq       $a3, $v0, b_area_kpa4_GetSelectedMoveID
glabel b_area_omo_anti_guy_SetAbsoluteStatusOffsets
/* 59EAF0 80218410 24140005 */   addiu    $s4, $zero, 0x5
D_80218414:
/* 59EAF4 80218414 0808621A */  j         .L80218868_59EF48
.L80218418:
/* 59EAF8 80218418 00000000 */   nop
.L8021841C:
/* 59EAFC 8021841C 3C014120 */  lui       $at, (0x41200000 >> 16)
.L80218420:
/* 59EB00 80218420 4481C000 */  mtc1      $at, $f24
D_80218424:
/* 59EB04 80218424 08086110 */  j         func_80218440_5CEAD0
glabel func_80218428
/* 59EB08 80218428 24140009 */   addiu    $s4, $zero, 0x9
.L8021842C:
/* 59EB0C 8021842C 0808610E */  j         b_area_kpa4_GetSelectedMoveID
glabel b_area_dig_UpdateSunPos
/* 59EB10 80218430 24140007 */   addiu    $s4, $zero, 0x7
.L80218434_59EB14:
/* 59EB14 80218434 24140007 */  addiu     $s4, $zero, 0x7
glabel b_area_kpa4_GetSelectedMoveID
/* 59EB18 80218438 3C014100 */  lui       $at, (0x41000000 >> 16)
.L8021843C:
/* 59EB1C 8021843C 4481C000 */  mtc1      $at, $f24
glabel func_80218440_5CEAD0
/* 59EB20 80218440 0000882D */  daddu     $s1, $zero, $zero
.L80218444:
/* 59EB24 80218444 AE140090 */  sw        $s4, 0x90($s0)
/* 59EB28 80218448 1A800027 */  blez      $s4, b_area_kpa_GetSelectedMoveID
glabel b_area_flo_MediGuySpriteRotationFunc
/* 59EB2C 8021844C E6180094 */   swc1     $f24, 0x94($s0)
glabel b_area_kzn_medi_guy_SetAbsoluteStatusOffsets
/* 59EB30 80218450 2685FFFF */  addiu     $a1, $s4, -0x1
.L80218454:
/* 59EB34 80218454 0200182D */  daddu     $v1, $s0, $zero
glabel dup3_b_area_pra_GetSelectedMoveID
/* 59EB38 80218458 24040004 */  addiu     $a0, $zero, 0x4
D_8021845C:
/* 59EB3C 8021845C 3C013FE0 */  lui       $at, (0x3FE00000 >> 16)
.L80218460:
/* 59EB40 80218460 44814800 */  mtc1      $at, $f9
glabel b_area_kpa4_SetAbsoluteStatusOffsets
/* 59EB44 80218464 44804000 */  mtc1      $zero, $f8
.L80218468:
/* 59EB48 80218468 3C018023 */  lui       $at, %hi(D_8022AC40_45A080)
/* 59EB4C 8021846C D426AC40 */  ldc1      $f6, %lo(D_8022AC40_45A080)($at)
.L80218470:
/* 59EB50 80218470 16250004 */  bne       $s1, $a1, func_80218484
D_80218474:
/* 59EB54 80218474 02041021 */   addu     $v0, $s0, $a0
D_80218478:
/* 59EB58 80218478 C460006C */  lwc1      $f0, 0x6C($v1)
/* 59EB5C 8021847C 08086134 */  j         .L802184D0_59EBB0
glabel dup_b_area_tik_ArcsinDeg
/* 59EB60 80218480 461C0000 */   add.s    $f0, $f0, $f28
glabel func_80218484
/* 59EB64 80218484 C460006C */  lwc1      $f0, 0x6C($v1)
/* 59EB68 80218488 C444006C */  lwc1      $f4, 0x6C($v0)
glabel func_8021848C
/* 59EB6C 8021848C 46002081 */  sub.s     $f2, $f4, $f0
glabel func_80218490_557870
/* 59EB70 80218490 4602D03C */  c.lt.s    $f26, $f2
D_80218494:
/* 59EB74 80218494 00000000 */  nop
/* 59EB78 80218498 45000003 */  bc1f      .L802184A8
glabel func_8021849C_6DC23C
/* 59EB7C 8021849C 00000000 */   nop
glabel b_area_jan2_white_magikoopa_StartRumbleWithParams
/* 59EB80 802184A0 0808612E */  j         .L802184B8_59EB98
.L802184A4:
/* 59EB84 802184A4 46140000 */   add.s    $f0, $f0, $f20
.L802184A8:
/* 59EB88 802184A8 4616103C */  c.lt.s    $f2, $f22
D_802184AC:
/* 59EB8C 802184AC 00000000 */  nop
D_802184B0:
/* 59EB90 802184B0 45030001 */  bc1tl     .L802184B8_59EB98
D_802184B4:
/* 59EB94 802184B4 46142100 */   add.s    $f4, $f4, $f20
.L802184B8_59EB98:
/* 59EB98 802184B8 46040000 */  add.s     $f0, $f0, $f4
/* 59EB9C 802184BC 46000021 */  cvt.d.s   $f0, $f0
func_802184C0_47F570:
/* 59EBA0 802184C0 46280002 */  mul.d     $f0, $f0, $f8
glabel func_802184C4
/* 59EBA4 802184C4 00000000 */  nop
/* 59EBA8 802184C8 46260000 */  add.d     $f0, $f0, $f6
glabel b_area_isk_part_1_ChompChainUpdate
/* 59EBAC 802184CC 46200020 */  cvt.s.d   $f0, $f0
.L802184D0_59EBB0:
/* 59EBB0 802184D0 E460006C */  swc1      $f0, 0x6C($v1)
glabel b_area_sam2_monstar_StartRumbleWithParams
/* 59EBB4 802184D4 24630004 */  addiu     $v1, $v1, 0x4
.L802184D8:
/* 59EBB8 802184D8 26310001 */  addiu     $s1, $s1, 0x1
glabel func_802184DC
/* 59EBBC 802184DC 0234102A */  slt       $v0, $s1, $s4
glabel func_802184E0
/* 59EBC0 802184E0 1440FFE3 */  bnez      $v0, .L80218470
glabel dup_b_area_tik2_SpitInk
/* 59EBC4 802184E4 24840004 */   addiu    $a0, $a0, 0x4
glabel b_area_kpa_GetSelectedMoveID
/* 59EBC8 802184E8 0200202D */  daddu     $a0, $s0, $zero
D_802184EC:
/* 59EBCC 802184EC 0C086016 */  jal       b_area_pra2_crystal_king_CosInterpMinMax
glabel func_802184F0
/* 59EBD0 802184F0 AFA70028 */   sw       $a3, 0x28($sp)
.L802184F4:
/* 59EBD4 802184F4 8FA70028 */  lw        $a3, 0x28($sp)
glabel b_area_jan2_white_magikoopa_UnkFunc52
/* 59EBD8 802184F8 24E70001 */  addiu     $a3, $a3, 0x1
D_802184FC:
/* 59EBDC 802184FC 28E20004 */  slti      $v0, $a3, 0x4
glabel func_80218500
/* 59EBE0 80218500 1440FFB7 */  bnez      $v0, b_area_dig_IsSaveVar123
.L80218504:
/* 59EBE4 80218504 261001E0 */   addiu    $s0, $s0, 0x1E0
/* 59EBE8 80218508 24020001 */  addiu     $v0, $zero, 0x1
.L8021850C:
/* 59EBEC 8021850C 3C018023 */  lui       $at, %hi(b_area_kzn2_VineRenderState)
b_area_trd_part_2_green_ninja_koopa_GetKoopaBrosWithState:
/* 59EBF0 80218510 AC22B550 */  sw        $v0, %lo(b_area_kzn2_VineRenderState)($at)
glabel dup2_b_area_kpa_SetAbsoluteStatusOffsets
/* 59EBF4 80218514 0000382D */  daddu     $a3, $zero, $zero
.L80218518_59EBF8:
/* 59EBF8 80218518 3C02800A */  lui       $v0, %hi(gMainGfxPos)
glabel b_area_kzn_medi_guy_MediGuySpriteRotationFunc
/* 59EBFC 8021851C 2442A66C */  addiu     $v0, $v0, %lo(gMainGfxPos)
/* 59EC00 80218520 0040402D */  daddu     $t0, $v0, $zero
.L80218524:
/* 59EC04 80218524 3C090100 */  lui       $t1, (0x1004008 >> 16)
D_80218528:
/* 59EC08 80218528 35294008 */  ori       $t1, $t1, (0x1004008 & 0xFFFF)
glabel func_8021852C
/* 59EC0C 8021852C AFA90018 */  sw        $t1, 0x18($sp)
glabel b_area_kpa4_StartRumbleWithParams
/* 59EC10 80218530 3C090602 */  lui       $t1, (0x6020004 >> 16)
b_area_sbk_pokey_init_80218534:
/* 59EC14 80218534 35290004 */  ori       $t1, $t1, (0x6020004 & 0xFFFF)
b_area_trd_part_1_Formation_03:
/* 59EC18 80218538 3C158023 */  lui       $s5, %hi(b_area_kzn2_VineData)
D_8021853C:
/* 59EC1C 8021853C 26B5ADD0 */  addiu     $s5, $s5, %lo(b_area_kzn2_VineData)
.L80218540:
/* 59EC20 80218540 AFA9001C */  sw        $t1, 0x1C($sp)
.L80218544:
/* 59EC24 80218544 8D030000 */  lw        $v1, 0x0($t0)
D_80218548:
/* 59EC28 80218548 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 59EC2C 8021854C 0060202D */  daddu     $a0, $v1, $zero
glabel b_area_kkj_SetLightningBoltPurple
/* 59EC30 80218550 24630008 */  addiu     $v1, $v1, 0x8
/* 59EC34 80218554 AD030000 */  sw        $v1, 0x0($t0)
glabel func_80218558
/* 59EC38 80218558 AC820000 */  sw        $v0, 0x0($a0)
glabel func_8021855C
/* 59EC3C 8021855C 24620008 */  addiu     $v0, $v1, 0x8
glabel b_area_flo_ShrinkActor
/* 59EC40 80218560 AC800004 */  sw        $zero, 0x4($a0)
D_80218564:
/* 59EC44 80218564 AD020000 */  sw        $v0, 0x0($t0)
/* 59EC48 80218568 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
.L8021856C:
/* 59EC4C 8021856C AC620000 */  sw        $v0, 0x0($v1)
D_80218570:
/* 59EC50 80218570 3C028022 */  lui       $v0, %hi(D_8021CF40)
D_80218574:
/* 59EC54 80218574 2442CF40 */  addiu     $v0, $v0, %lo(D_8021CF40)
/* 59EC58 80218578 AC620004 */  sw        $v0, 0x4($v1)
.L8021857C:
/* 59EC5C 8021857C 0000882D */  daddu     $s1, $zero, $zero
glabel b_area_dig_GetModelPos
/* 59EC60 80218580 3C02DE01 */  lui       $v0, (0xDE010000 >> 16)
b_area_mim_forest_fuzzy_handleEvent_80218584:
/* 59EC64 80218584 C6B80094 */  lwc1      $f24, 0x94($s5)
glabel b_area_kpa4_UnkFunc52
/* 59EC68 80218588 8D040000 */  lw        $a0, 0x0($t0)
b_area_omo2_general_guy_init:
/* 59EC6C 8021858C 8EB40090 */  lw        $s4, 0x90($s5)
.L80218590:
/* 59EC70 80218590 24890008 */  addiu     $t1, $a0, 0x8
.L80218594:
/* 59EC74 80218594 AFA90010 */  sw        $t1, 0x10($sp)
/* 59EC78 80218598 8EA601DC */  lw        $a2, 0x1DC($s5)
.L8021859C:
/* 59EC7C 8021859C 0120982D */  daddu     $s3, $t1, $zero
.L802185A0:
/* 59EC80 802185A0 AC820000 */  sw        $v0, 0x0($a0)
/* 59EC84 802185A4 00061940 */  sll       $v1, $a2, 5
glabel b_area_pra_UnkFunc52
/* 59EC88 802185A8 24620008 */  addiu     $v0, $v1, 0x8
glabel b_area_omo_medi_guy_MediGuySpriteRotationFunc
/* 59EC8C 802185AC 00821021 */  addu      $v0, $a0, $v0
glabel func_802185B0
/* 59EC90 802185B0 01231821 */  addu      $v1, $t1, $v1
.L802185B4:
/* 59EC94 802185B4 AC820004 */  sw        $v0, 0x4($a0)
D_802185B8:
/* 59EC98 802185B8 18C00088 */  blez      $a2, .L802187DC
glabel b_area_jan2_white_magikoopa_GetBootsHammerLevel
/* 59EC9C 802185BC AD030000 */   sw       $v1, 0x0($t0)
D_802185C0:
/* 59ECA0 802185C0 2682FFFF */  addiu     $v0, $s4, -0x1
D_802185C4:
/* 59ECA4 802185C4 00021080 */  sll       $v0, $v0, 2
.L802185C8:
/* 59ECA8 802185C8 02A21021 */  addu      $v0, $s5, $v0
/* 59ECAC 802185CC AFA20014 */  sw        $v0, 0x14($sp)
glabel func_802185D0
/* 59ECB0 802185D0 0220282D */  daddu     $a1, $s1, $zero
glabel func_802185D4_5CEC64
/* 59ECB4 802185D4 0220F02D */  daddu     $fp, $s1, $zero
/* 59ECB8 802185D8 0220B82D */  daddu     $s7, $s1, $zero
glabel func_802185DC
/* 59ECBC 802185DC 0220B02D */  daddu     $s6, $s1, $zero
glabel b_area_dig_IsGameStatusUnkAA_1
/* 59ECC0 802185E0 02A0902D */  daddu     $s2, $s5, $zero
/* 59ECC4 802185E4 24900016 */  addiu     $s0, $a0, 0x16
.L802185E8_447A28:
/* 59ECC8 802185E8 44911000 */  mtc1      $s1, $f2
.L802185EC:
/* 59ECCC 802185EC 00000000 */  nop
/* 59ECD0 802185F0 468010A0 */  cvt.s.w   $f2, $f2
.L802185F4:
/* 59ECD4 802185F4 44940000 */  mtc1      $s4, $f0
.L802185F8:
/* 59ECD8 802185F8 00000000 */  nop
.L802185FC:
/* 59ECDC 802185FC 46800020 */  cvt.s.w   $f0, $f0
.L80218600:
/* 59ECE0 80218600 46001082 */  mul.s     $f2, $f2, $f0
.L80218604:
/* 59ECE4 80218604 00000000 */  nop
glabel b_area_dig_Add1Coin
/* 59ECE8 80218608 44860000 */  mtc1      $a2, $f0
glabel dup_b_area_tik_CalculateRotationZ
/* 59ECEC 8021860C 00000000 */  nop
.L80218610:
/* 59ECF0 80218610 46800020 */  cvt.s.w   $f0, $f0
.L80218614:
/* 59ECF4 80218614 C65A0098 */  lwc1      $f26, 0x98($s2)
glabel b_area_arn_hyper_cleft_SetSpinSmashable
/* 59ECF8 80218618 C65C009C */  lwc1      $f28, 0x9C($s2)
glabel func_8021861C
/* 59ECFC 8021861C C65E00A0 */  lwc1      $f30, 0xA0($s2)
glabel func_80218620
/* 59ED00 80218620 46001083 */  div.s     $f2, $f2, $f0
.L80218624:
/* 59ED04 80218624 4600128D */  trunc.w.s $f10, $f2
glabel func_80218628
/* 59ED08 80218628 44045000 */  mfc1      $a0, $f10
.L8021862C:
/* 59ED0C 8021862C 00000000 */  nop
glabel b_area_dig_SetDemoBattleBeginDelay
/* 59ED10 80218630 44840000 */  mtc1      $a0, $f0
D_80218634:
/* 59ED14 80218634 00000000 */  nop
glabel b_area_kpa_UnkFunc52
/* 59ED18 80218638 46800020 */  cvt.s.w   $f0, $f0
.L8021863C:
/* 59ED1C 8021863C 24830001 */  addiu     $v1, $a0, 0x1
.L80218640:
/* 59ED20 80218640 0074102A */  slt       $v0, $v1, $s4
glabel func_80218644_6DE404
/* 59ED24 80218644 14400005 */  bnez      $v0, .L8021865C_59ED3C
.L80218648:
/* 59ED28 80218648 46001181 */   sub.s    $f6, $f2, $f0
glabel func_8021864C
/* 59ED2C 8021864C 8FA90014 */  lw        $t1, 0x14($sp)
.L80218650:
/* 59ED30 80218650 C536006C */  lwc1      $f22, 0x6C($t1)
.L80218654:
/* 59ED34 80218654 080861BA */  j         func_802186E8
D_80218658:
/* 59ED38 80218658 4600B306 */   mov.s    $f12, $f22
.L8021865C_59ED3C:
/* 59ED3C 8021865C 00031080 */  sll       $v0, $v1, 2
.L80218660:
/* 59ED40 80218660 02A21021 */  addu      $v0, $s5, $v0
b_area_jan_spear_guy_IdleAnimations_80218664:
/* 59ED44 80218664 C444006C */  lwc1      $f4, 0x6C($v0)
.L80218668:
/* 59ED48 80218668 00041080 */  sll       $v0, $a0, 2
glabel func_8021866C
/* 59ED4C 8021866C 02A21021 */  addu      $v0, $s5, $v0
glabel func_80218670
/* 59ED50 80218670 C44C006C */  lwc1      $f12, 0x6C($v0)
glabel func_80218674
/* 59ED54 80218674 460C2081 */  sub.s     $f2, $f4, $f12
.L80218678:
/* 59ED58 80218678 3C014334 */  lui       $at, (0x43340000 >> 16)
.L8021867C:
/* 59ED5C 8021867C 44810000 */  mtc1      $at, $f0
glabel dup2_b_area_tik2_StartRumbleWithParams
/* 59ED60 80218680 00000000 */  nop
D_80218684:
/* 59ED64 80218684 4602003C */  c.lt.s    $f0, $f2
D_80218688:
/* 59ED68 80218688 00000000 */  nop
glabel b_area_kmr_part_2_blue_goomba_2_CalculateRotationZ
/* 59ED6C 8021868C 45000006 */  bc1f      .L802186A8_48D848
glabel func_80218690
/* 59ED70 80218690 00000000 */   nop
.L80218694:
/* 59ED74 80218694 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
func_80218698:
/* 59ED78 80218698 44815000 */  mtc1      $at, $f10
/* 59ED7C 8021869C 00000000 */  nop
glabel dup2_b_area_kpa2_RemoveChillOut
/* 59ED80 802186A0 460A2101 */  sub.s     $f4, $f4, $f10
/* 59ED84 802186A4 460C2081 */  sub.s     $f2, $f4, $f12
.L802186A8_48D848:
/* 59ED88 802186A8 3C01C334 */  lui       $at, (0xC3340000 >> 16)
.L802186AC:
/* 59ED8C 802186AC 44810000 */  mtc1      $at, $f0
D_802186B0:
/* 59ED90 802186B0 00000000 */  nop
.L802186B4:
/* 59ED94 802186B4 4600103C */  c.lt.s    $f2, $f0
glabel func_802186B8
/* 59ED98 802186B8 00000000 */  nop
D_802186BC:
/* 59ED9C 802186BC 45020006 */  bc1fl     func_802186D8_609188
glabel b_area_pra2_sam_04_UnkModelStuff_func1
/* 59EDA0 802186C0 460C2001 */   sub.s    $f0, $f4, $f12
/* 59EDA4 802186C4 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
glabel func_802186C8
/* 59EDA8 802186C8 44815000 */  mtc1      $at, $f10
.L802186CC:
/* 59EDAC 802186CC 00000000 */  nop
glabel func_802186D0_69F8D0
/* 59EDB0 802186D0 460A2100 */  add.s     $f4, $f4, $f10
glabel func_802186D4
/* 59EDB4 802186D4 460C2001 */  sub.s     $f0, $f4, $f12
glabel func_802186D8_609188
/* 59EDB8 802186D8 46060002 */  mul.s     $f0, $f0, $f6
.L802186DC:
/* 59EDBC 802186DC 00000000 */  nop
glabel func_802186E0_6DE4A0
/* 59EDC0 802186E0 460C0580 */  add.s     $f22, $f0, $f12
glabel dup2_b_area_flo_SetAbsoluteStatusOffsets
/* 59EDC4 802186E4 4600B306 */  mov.s     $f12, $f22
glabel func_802186E8
/* 59EDC8 802186E8 AFA50020 */  sw        $a1, 0x20($sp)
b_area_nok_spiked_goomba_CalculateRotationZ:
/* 59EDCC 802186EC AFA60024 */  sw        $a2, 0x24($sp)
glabel b_area_omo3_ArcsinDeg
/* 59EDD0 802186F0 AFA70028 */  sw        $a3, 0x28($sp)
/* 59EDD4 802186F4 0C00A8BB */  jal       sin_deg
D_802186F8:
/* 59EDD8 802186F8 AFA8002C */   sw       $t0, 0x2C($sp)
glabel func_802186FC
/* 59EDDC 802186FC 46180502 */  mul.s     $f20, $f0, $f24
glabel b_area_kpa_UnkSfxFunc
/* 59EDE0 80218700 00000000 */  nop
/* 59EDE4 80218704 0C00A8D4 */  jal       cos_deg
/* 59EDE8 80218708 4600B306 */   mov.s    $f12, $f22
D_8021870C:
/* 59EDEC 8021870C 46000007 */  neg.s     $f0, $f0
b_area_iwa_cleft_DefenseTable_80218710:
/* 59EDF0 80218710 46180002 */  mul.s     $f0, $f0, $f24
glabel b_area_sam2_paragoomba_CalculateRotationZ
/* 59EDF4 80218714 00000000 */  nop
/* 59EDF8 80218718 4614D100 */  add.s     $f4, $f26, $f20
/* 59EDFC 8021871C 4600E080 */  add.s     $f2, $f28, $f0
D_80218720:
/* 59EE00 80218720 4614D501 */  sub.s     $f20, $f26, $f20
.L80218724:
/* 59EE04 80218724 2652000C */  addiu     $s2, $s2, 0xC
/* 59EE08 80218728 26310001 */  addiu     $s1, $s1, 0x1
D_8021872C:
/* 59EE0C 8021872C 4600E001 */  sub.s     $f0, $f28, $f0
D_80218730:
/* 59EE10 80218730 4600228D */  trunc.w.s $f10, $f4
.L80218734:
/* 59EE14 80218734 44025000 */  mfc1      $v0, $f10
.L80218738:
/* 59EE18 80218738 00000000 */  nop
/* 59EE1C 8021873C A6620000 */  sh        $v0, 0x0($s3)
D_80218740:
/* 59EE20 80218740 4600128D */  trunc.w.s $f10, $f2
b_area_kmr_part_3_paragoomba2_CalculateRotationZ:
/* 59EE24 80218744 44025000 */  mfc1      $v0, $f10
.L80218748:
/* 59EE28 80218748 4600F28D */  trunc.w.s $f10, $f30
/* 59EE2C 8021874C 44035000 */  mfc1      $v1, $f10
.L80218750:
/* 59EE30 80218750 26730010 */  addiu     $s3, $s3, 0x10
.L80218754:
/* 59EE34 80218754 A602FFF4 */  sh        $v0, -0xC($s0)
glabel dup2_b_area_tik_ArcsinDeg
/* 59EE38 80218758 A603FFF6 */  sh        $v1, -0xA($s0)
glabel SpawnFallingRock
/* 59EE3C 8021875C A616FFFA */  sh        $s6, -0x6($s0)
.L80218760:
/* 59EE40 80218760 A600FFFC */  sh        $zero, -0x4($s0)
/* 59EE44 80218764 A217FFFE */  sb        $s7, -0x2($s0)
/* 59EE48 80218768 A21EFFFF */  sb        $fp, -0x1($s0)
glabel func_8021876C
/* 59EE4C 8021876C 8FA50020 */  lw        $a1, 0x20($sp)
glabel func_80218770_6DE530
/* 59EE50 80218770 4600A28D */  trunc.w.s $f10, $f20
glabel func_80218774_5CEE04
/* 59EE54 80218774 44025000 */  mfc1      $v0, $f10
/* 59EE58 80218778 A2050000 */  sb        $a1, 0x0($s0)
D_8021877C:
/* 59EE5C 8021877C 26100010 */  addiu     $s0, $s0, 0x10
glabel b_area_kmr_part_2_blue_goomba_2_DivActorLevel4
/* 59EE60 80218780 A6620000 */  sh        $v0, 0x0($s3)
D_80218784:
/* 59EE64 80218784 4600028D */  trunc.w.s $f10, $f0
glabel func_80218788
/* 59EE68 80218788 44025000 */  mfc1      $v0, $f10
glabel func_8021878C
/* 59EE6C 8021878C 00000000 */  nop
.L80218790:
/* 59EE70 80218790 A602FFF4 */  sh        $v0, -0xC($s0)
/* 59EE74 80218794 24020400 */  addiu     $v0, $zero, 0x400
.L80218798:
/* 59EE78 80218798 A603FFF6 */  sh        $v1, -0xA($s0)
.L8021879C:
/* 59EE7C 8021879C A616FFFA */  sh        $s6, -0x6($s0)
.L802187A0:
/* 59EE80 802187A0 A602FFFC */  sh        $v0, -0x4($s0)
/* 59EE84 802187A4 A217FFFE */  sb        $s7, -0x2($s0)
/* 59EE88 802187A8 A21EFFFF */  sb        $fp, -0x1($s0)
glabel func_802187AC
/* 59EE8C 802187AC A2050000 */  sb        $a1, 0x0($s0)
glabel dup_b_area_tik3_UnkFunc56
/* 59EE90 802187B0 26100010 */  addiu     $s0, $s0, 0x10
glabel func_802187B4
/* 59EE94 802187B4 26730010 */  addiu     $s3, $s3, 0x10
.L802187B8:
/* 59EE98 802187B8 24A5001E */  addiu     $a1, $a1, 0x1E
b_area_trd_part_1_Formation_0B:
/* 59EE9C 802187BC 27DE0078 */  addiu     $fp, $fp, 0x78
.L802187C0:
/* 59EEA0 802187C0 26F70032 */  addiu     $s7, $s7, 0x32
.L802187C4:
/* 59EEA4 802187C4 8FA60024 */  lw        $a2, 0x24($sp)
glabel dup4_b_area_pra_GetSelectedMoveID
/* 59EEA8 802187C8 8FA70028 */  lw        $a3, 0x28($sp)
b_area_jan2_putrid_piranha_ActorParts:
/* 59EEAC 802187CC 8FA8002C */  lw        $t0, 0x2C($sp)
.L802187D0:
/* 59EEB0 802187D0 0226102A */  slt       $v0, $s1, $a2
/* 59EEB4 802187D4 1440FF84 */  bnez      $v0, .L802185E8_447A28
/* 59EEB8 802187D8 26D60140 */   addiu    $s6, $s6, 0x140
.L802187DC:
/* 59EEBC 802187DC 24C5FFFF */  addiu     $a1, $a2, -0x1
glabel b_area_nok_koopa_troopa_SetAbsoluteStatusOffsets
/* 59EEC0 802187E0 18A00014 */  blez      $a1, .L80218834_4B1A24
.L802187E4:
/* 59EEC4 802187E4 0000882D */   daddu    $s1, $zero, $zero
/* 59EEC8 802187E8 3C060002 */  lui       $a2, (0x20406 >> 16)
D_802187EC:
/* 59EECC 802187EC 34C60406 */  ori       $a2, $a2, (0x20406 & 0xFFFF)
glabel func_802187F0_6DE5B0
/* 59EED0 802187F0 8FA40010 */  lw        $a0, 0x10($sp)
glabel dup2_b_area_pra_SetAbsoluteStatusOffsets
/* 59EED4 802187F4 8D030000 */  lw        $v1, 0x0($t0)
/* 59EED8 802187F8 26310001 */  addiu     $s1, $s1, 0x1
.L802187FC:
/* 59EEDC 802187FC 0060102D */  daddu     $v0, $v1, $zero
/* 59EEE0 80218800 24630008 */  addiu     $v1, $v1, 0x8
glabel dup_b_area_tik2_UnfadeBackgroundToBlack
/* 59EEE4 80218804 AC440004 */  sw        $a0, 0x4($v0)
glabel func_80218808
/* 59EEE8 80218808 AD030000 */  sw        $v1, 0x0($t0)
.L8021880C:
/* 59EEEC 8021880C 8FA90018 */  lw        $t1, 0x18($sp)
glabel b_area_sam2_gray_magikoopa_ShrinkActor
/* 59EEF0 80218810 24840020 */  addiu     $a0, $a0, 0x20
.L80218814:
/* 59EEF4 80218814 AC490000 */  sw        $t1, 0x0($v0)
D_80218818:
/* 59EEF8 80218818 24620008 */  addiu     $v0, $v1, 0x8
/* 59EEFC 8021881C AD020000 */  sw        $v0, 0x0($t0)
.L80218820:
/* 59EF00 80218820 8FA9001C */  lw        $t1, 0x1C($sp)
/* 59EF04 80218824 0225102A */  slt       $v0, $s1, $a1
D_80218828:
/* 59EF08 80218828 AC660004 */  sw        $a2, 0x4($v1)
/* 59EF0C 8021882C 1440FFF1 */  bnez      $v0, dup2_b_area_pra_SetAbsoluteStatusOffsets
.L80218830:
/* 59EF10 80218830 AC690000 */   sw       $t1, 0x0($v1)
.L80218834_4B1A24:
/* 59EF14 80218834 24E70001 */  addiu     $a3, $a3, 0x1
D_80218838:
/* 59EF18 80218838 28E20004 */  slti      $v0, $a3, 0x4
/* 59EF1C 8021883C 1440FF4F */  bnez      $v0, .L8021857C
glabel func_80218840
/* 59EF20 80218840 26B501E0 */   addiu    $s5, $s5, 0x1E0
.L80218844:
/* 59EF24 80218844 3C03800A */  lui       $v1, %hi(gMainGfxPos)
.L80218848:
/* 59EF28 80218848 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
D_8021884C:
/* 59EF2C 8021884C 8C620000 */  lw        $v0, 0x0($v1)
glabel func_80218850_4EFCF0
/* 59EF30 80218850 0040202D */  daddu     $a0, $v0, $zero
/* 59EF34 80218854 24420008 */  addiu     $v0, $v0, 0x8
.L80218858:
/* 59EF38 80218858 AC620000 */  sw        $v0, 0x0($v1)
.L8021885C:
/* 59EF3C 8021885C 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
.L80218860:
/* 59EF40 80218860 AC820000 */  sw        $v0, 0x0($a0)
D_80218864:
/* 59EF44 80218864 AC800004 */  sw        $zero, 0x4($a0)
.L80218868_59EF48:
/* 59EF48 80218868 8FBF0054 */  lw        $ra, 0x54($sp)
/* 59EF4C 8021886C 8FBE0050 */  lw        $fp, 0x50($sp)
/* 59EF50 80218870 8FB7004C */  lw        $s7, 0x4C($sp)
D_80218874:
/* 59EF54 80218874 8FB60048 */  lw        $s6, 0x48($sp)
.L80218878:
/* 59EF58 80218878 8FB50044 */  lw        $s5, 0x44($sp)
glabel b_area_omo3_CalculateRotationZ
/* 59EF5C 8021887C 8FB40040 */  lw        $s4, 0x40($sp)
glabel func_80218880
/* 59EF60 80218880 8FB3003C */  lw        $s3, 0x3C($sp)
glabel func_80218884
/* 59EF64 80218884 8FB20038 */  lw        $s2, 0x38($sp)
.L80218888:
/* 59EF68 80218888 8FB10034 */  lw        $s1, 0x34($sp)
/* 59EF6C 8021888C 8FB00030 */  lw        $s0, 0x30($sp)
glabel dup_b_area_dig_SetDemoBattleBeginDelay
/* 59EF70 80218890 D7BE0080 */  ldc1      $f30, 0x80($sp)
.L80218894:
/* 59EF74 80218894 D7BC0078 */  ldc1      $f28, 0x78($sp)
/* 59EF78 80218898 D7BA0070 */  ldc1      $f26, 0x70($sp)
/* 59EF7C 8021889C D7B80068 */  ldc1      $f24, 0x68($sp)
.L802188A0:
/* 59EF80 802188A0 D7B60060 */  ldc1      $f22, 0x60($sp)
.L802188A4:
/* 59EF84 802188A4 D7B40058 */  ldc1      $f20, 0x58($sp)
glabel b_area_flo2_UnkBackgroundFunc3
/* 59EF88 802188A8 03E00008 */  jr        $ra
.L802188AC:
/* 59EF8C 802188AC 27BD0088 */   addiu    $sp, $sp, 0x88

### DECOMPILED C INSTRUCTIONS:

void func_8021835C_59EA3C(void* data) {
    Vtx_t* vtxBuffer;
    Vtx_t* vtx;

    f32 boneLength;
    s32 boneCount;

    f32 angle;
    f32 nextAngle;
    f32 curAngle1;
    f32 curAngle2;

    f32 alphaCoord;
    f32 alphaFrac;
    s32 nearest;

    s32 numPoints;
    s32 i, j;

    f32 deltaX, deltaY;
    f32 posX, posY, posZ;

    if (N(VineRenderState) == -1) {
        return;
    }

    if (N(VineRenderState) == 0) {
        for (i = 0; i < NUM_VINES; i++) {
            LavaPiranhaVine* vine = &N(VineData)[i];

            switch (i) {
                default:
                    return;
                case 0:
                    boneCount = 9;
                    boneLength = 10.0f;
                    break;
                case 1:
                    boneCount = 7;
                    boneLength = 8.0f;
                    break;
                case 2:
                    boneCount = 7;
                    boneLength = 8.0f;
                    break;
                case 3:
                    boneCount = 5;
                    boneLength = 8.0f;
                    break;
            }

            vine->boneCount = boneCount;
            vine->boneLength = boneLength;

            for (j = 0; j < boneCount; j++) {
                if (j == (boneCount - 1)) {
                    vine->boneRot[j] += 90.0f;
                } else {
                    curAngle1 = vine->boneRot[j];
                    nextAngle = vine->boneRot[j + 1];
                    if (nextAngle - curAngle1 > 180.0f) {
                        curAngle1 += 360.0f;
                    } else if (nextAngle - curAngle1 < -180.0f) {
                        nextAngle += 360.0f;
                    }
                    // average cur and next angles
                    vine->boneRot[j] = ((curAngle1 + nextAngle) / 2.0) + 90.0;
                }
            }

            N(make_vine_interpolation)(vine);
        }

        N(VineRenderState) = 1;
    }

    gDPPipeSync(gMainGfxPos++);
    gSPDisplayList(gMainGfxPos++, D_8021CF40_5A3620);

    for (i = 0; i < NUM_VINES; i++) {
        LavaPiranhaVine* vine = &N(VineData)[i];

        boneLength = vine->boneLength;
        boneCount = vine->boneCount;
        numPoints = vine->numPoints;

        // we'll build the vertex data and place it in the display list, so jump forward
        // here and leave space behind for the gSPBranchList command followed by two vertices
        // for each point in numPoints

        vtxBuffer = (Vtx_t*)(gMainGfxPos + 1);
        gSPBranchList(gMainGfxPos, &gMainGfxPos[1 + 2 * (2 * numPoints)]);
        vtx = (Vtx_t*) (++gMainGfxPos);
        gMainGfxPos = &gMainGfxPos[2 * (2 * numPoints)];

        for (j = 0; j < numPoints; j++) {
            posX = vine->points[j].x;
            posY = vine->points[j].y;
            posZ = vine->points[j].z;

            alphaCoord = ((f32) j * boneCount) / numPoints;
            nearest = (s32) alphaCoord;
            alphaFrac = alphaCoord - (f32)nearest;

            if (nearest + 1 >= boneCount) {
                angle = vine->boneRot[boneCount - 1];
            } else {
                curAngle2 = vine->boneRot[nearest];
                nextAngle = vine->boneRot[nearest + 1];
                if (nextAngle - curAngle2 > 180.0f) {
                    nextAngle -= 360.0f;
                }
                if (nextAngle - curAngle2 < -180.0f) {
                    nextAngle += 360.0f;
                }
                angle = ((nextAngle - curAngle2) * alphaFrac) + curAngle2;
            }

            deltaX =  sin_deg(angle) * boneLength;
            deltaY = -cos_deg(angle) * boneLength;

            vtx->ob[0] = posX + deltaX;
            vtx->ob[1] = posY + deltaY;
            vtx->ob[2] = posZ;
            vtx->tc[0] = j * 0x140;
            vtx->tc[1] = 0;
            vtx->cn[0] = j * 50;
            vtx->cn[1] = j * 120;
            vtx->cn[2] = j * 30;
            vtx++;

            vtx->ob[0] = posX - deltaX;
            vtx->ob[1] = posY - deltaY;
            vtx->ob[2] = posZ;
            vtx->tc[0] = j * 0x140;
            vtx->tc[1] = 0x400;
            vtx->cn[0] = j * 50;
            vtx->cn[1] = j * 120;
            vtx->cn[2] = j * 30;
            vtx++;
        }

        for (j = 0; j < numPoints - 1; j++) {
            gSPVertex(gMainGfxPos++, &vtxBuffer[2*j], 4, 0);
            gSP2Triangles(gMainGfxPos++, 1, 0, 2, 0, 1, 2, 3, 0);
        }
    }

    gDPPipeSync(gMainGfxPos++);
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_802AA0B8_7B1A58
/* 41EE48 802AA0B8 3C03800E */  lui       $v1, %hi(gBattleSubState)
/* 41EE4C 802AA0BC 8C63C4DC */  lw        $v1, %lo(gBattleSubState)($v1)
/* 41EE50 802AA0C0 27BDFFC8 */  addiu     $sp, $sp, -0x38
/* 41EE54 802AA0C4 AFB20018 */  sw        $s2, 0x18($sp)
D_802AA0C8_7B1A68:
/* 41EE58 802AA0C8 3C12800E */  lui       $s2, %hi(gBattleStatus)
/* 41EE5C 802AA0CC 2652C070 */  addiu     $s2, $s2, %lo(gBattleStatus)
/* 41EE60 802AA0D0 AFBF001C */  sw        $ra, 0x1C($sp)
/* 41EE64 802AA0D4 AFB10014 */  sw        $s1, 0x14($sp)
glabel func_802AA0D8
/* 41EE68 802AA0D8 AFB00010 */  sw        $s0, 0x10($sp)
/* 41EE6C 802AA0DC F7B80030 */  sdc1      $f24, 0x30($sp)
/* 41EE70 802AA0E0 F7B60028 */  sdc1      $f22, 0x28($sp)
/* 41EE74 802AA0E4 F7B40020 */  sdc1      $f20, 0x20($sp)
/* 41EE78 802AA0E8 8E5000D8 */  lw        $s0, 0xD8($s2)
/* 41EE7C 802AA0EC 8E5100DC */  lw        $s1, 0xDC($s2)
D_802AA0F0_7B1A90:
/* 41EE80 802AA0F0 2C62000C */  sltiu     $v0, $v1, 0xC
/* 41EE84 802AA0F4 10400149 */  beqz      $v0, .L802AA61C_7B1FBC
/* 41EE88 802AA0F8 00031080 */   sll      $v0, $v1, 2
/* 41EE8C 802AA0FC 3C01802B */  lui       $at, %hi(jtbl_802ACC08_7B45A8)
/* 41EE90 802AA100 00220821 */  addu      $at, $at, $v0
/* 41EE94 802AA104 8C22CC08 */  lw        $v0, %lo(jtbl_802ACC08_7B45A8)($at)
/* 41EE98 802AA108 00400008 */  jr        $v0
/* 41EE9C 802AA10C 00000000 */   nop
glabel .L802AA110_7B1AB0
/* 41EEA0 802AA110 82030210 */  lb        $v1, 0x210($s0)
/* 41EEA4 802AA114 38620006 */  xori      $v0, $v1, 0x6
D_802AA118_7B1AB8:
/* 41EEA8 802AA118 2C440001 */  sltiu     $a0, $v0, 0x1
/* 41EEAC 802AA11C 24020003 */  addiu     $v0, $zero, 0x3
/* 41EEB0 802AA120 50620001 */  beql      $v1, $v0, .L802AA128_7B1AC8
/* 41EEB4 802AA124 24040001 */   addiu    $a0, $zero, 0x1
.L802AA128_7B1AC8:
/* 41EEB8 802AA128 24120004 */  addiu     $s2, $zero, 0x4
/* 41EEBC 802AA12C 50720001 */  beql      $v1, $s2, .L802AA134_7B1AD4
/* 41EEC0 802AA130 24040001 */   addiu    $a0, $zero, 0x1
.L802AA134_7B1AD4:
/* 41EEC4 802AA134 24020005 */  addiu     $v0, $zero, 0x5
/* 41EEC8 802AA138 50620001 */  beql      $v1, $v0, .L802AA140_7B1AE0
/* 41EECC 802AA13C 24040001 */   addiu    $a0, $zero, 0x1
.L802AA140_7B1AE0:
/* 41EED0 802AA140 24020007 */  addiu     $v0, $zero, 0x7
/* 41EED4 802AA144 50620001 */  beql      $v1, $v0, .L802AA14C_7B1AEC
/* 41EED8 802AA148 24040001 */   addiu    $a0, $zero, 0x1
.L802AA14C_7B1AEC:
/* 41EEDC 802AA14C 24020008 */  addiu     $v0, $zero, 0x8
/* 41EEE0 802AA150 50620001 */  beql      $v1, $v0, .L802AA158_7B1AF8
/* 41EEE4 802AA154 24040001 */   addiu    $a0, $zero, 0x1
.L802AA158_7B1AF8:
/* 41EEE8 802AA158 82030214 */  lb        $v1, 0x214($s0)
/* 41EEEC 802AA15C 2402000C */  addiu     $v0, $zero, 0xC
D_802AA160_7B1B00:
/* 41EEF0 802AA160 50620001 */  beql      $v1, $v0, .L802AA168_7B1B08
/* 41EEF4 802AA164 24040001 */   addiu    $a0, $zero, 0x1
.L802AA168_7B1B08:
/* 41EEF8 802AA168 82030216 */  lb        $v1, 0x216($s0)
/* 41EEFC 802AA16C 2402000D */  addiu     $v0, $zero, 0xD
/* 41EF00 802AA170 50620001 */  beql      $v1, $v0, .L802AA178_7B1B18
/* 41EF04 802AA174 24040001 */   addiu    $a0, $zero, 0x1
.L802AA178_7B1B18:
/* 41EF08 802AA178 10800005 */  beqz      $a0, .L802AA190_7B1B30
/* 41EF0C 802AA17C 00000000 */   nop
D_802AA180_7B1B20:
/* 41EF10 802AA180 0C090464 */  jal       func_80241190
/* 41EF14 802AA184 24040016 */   addiu    $a0, $zero, 0x16
/* 41EF18 802AA188 080AA987 */  j         .L802AA61C_7B1FBC
/* 41EF1C 802AA18C 00000000 */   nop
.L802AA190_7B1B30:
/* 41EF20 802AA190 0C093903 */  jal       func_8024E40C
/* 41EF24 802AA194 24040002 */   addiu    $a0, $zero, 0x2
/* 41EF28 802AA198 0C093936 */  jal       D_8024E4D8_C0BD58
/* 41EF2C 802AA19C 2404000A */   addiu    $a0, $zero, 0xA
D_802AA1A0_7B1B40:
/* 41EF30 802AA1A0 3C02800E */  lui       $v0, %hi(gBattleStatus)
/* 41EF34 802AA1A4 8C42C070 */  lw        $v0, %lo(gBattleStatus)($v0)
/* 41EF38 802AA1A8 3C030010 */  lui       $v1, (0x100000 >> 16)
/* 41EF3C 802AA1AC 00431024 */  and       $v0, $v0, $v1
/* 41EF40 802AA1B0 14400118 */  bnez      $v0, .L802AA614_7B1FB4
/* 41EF44 802AA1B4 2402000B */   addiu    $v0, $zero, 0xB
D_802AA1B8_7B1B58:
/* 41EF48 802AA1B8 C6000138 */  lwc1      $f0, 0x138($s0)
/* 41EF4C 802AA1BC C6020140 */  lwc1      $f2, 0x140($s0)
/* 41EF50 802AA1C0 E600000C */  swc1      $f0, 0xC($s0)
/* 41EF54 802AA1C4 E6020014 */  swc1      $f2, 0x14($s0)
/* 41EF58 802AA1C8 C6200138 */  lwc1      $f0, 0x138($s1)
/* 41EF5C 802AA1CC E6000018 */  swc1      $f0, 0x18($s0)
/* 41EF60 802AA1D0 C6200140 */  lwc1      $f0, 0x140($s1)
/* 41EF64 802AA1D4 2402000A */  addiu     $v0, $zero, 0xA
/* 41EF68 802AA1D8 3C01800E */  lui       $at, %hi(gBattleSubState)
/* 41EF6C 802AA1DC AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
D_802AA1E0_7B1B80:
/* 41EF70 802AA1E0 A6120070 */  sh        $s2, 0x70($s0)
/* 41EF74 802AA1E4 AE000054 */  sw        $zero, 0x54($s0)
/* 41EF78 802AA1E8 080AA987 */  j         .L802AA61C_7B1FBC
/* 41EF7C 802AA1EC E6000020 */   swc1     $f0, 0x20($s0)
glabel .L802AA1F0_7B1B90
/* 41EF80 802AA1F0 86020070 */  lh        $v0, 0x70($s0)
/* 41EF84 802AA1F4 10400022 */  beqz      $v0, D_802AA280_7B1C20
/* 41EF88 802AA1F8 00000000 */   nop
/* 41EF8C 802AA1FC C6000018 */  lwc1      $f0, 0x18($s0)
/* 41EF90 802AA200 C6080144 */  lwc1      $f8, 0x144($s0)
/* 41EF94 802AA204 C6020020 */  lwc1      $f2, 0x20($s0)
D_802AA208_7B1BA8:
/* 41EF98 802AA208 46080001 */  sub.s     $f0, $f0, $f8
/* 41EF9C 802AA20C C604014C */  lwc1      $f4, 0x14C($s0)
/* 41EFA0 802AA210 46041081 */  sub.s     $f2, $f2, $f4
/* 41EFA4 802AA214 44823000 */  mtc1      $v0, $f6
/* 41EFA8 802AA218 00000000 */  nop
/* 41EFAC 802AA21C 468031A0 */  cvt.s.w   $f6, $f6
/* 41EFB0 802AA220 46060003 */  div.s     $f0, $f0, $f6
/* 41EFB4 802AA224 46004200 */  add.s     $f8, $f8, $f0
/* 41EFB8 802AA228 46003006 */  mov.s     $f0, $f6
/* 41EFBC 802AA22C 46061083 */  div.s     $f2, $f2, $f6
D_802AA230_7B1BD0:
/* 41EFC0 802AA230 C600000C */  lwc1      $f0, 0xC($s0)
/* 41EFC4 802AA234 46022100 */  add.s     $f4, $f4, $f2
/* 41EFC8 802AA238 E6080144 */  swc1      $f8, 0x144($s0)
/* 41EFCC 802AA23C E604014C */  swc1      $f4, 0x14C($s0)
/* 41EFD0 802AA240 C6240144 */  lwc1      $f4, 0x144($s1)
/* 41EFD4 802AA244 46040001 */  sub.s     $f0, $f0, $f4
/* 41EFD8 802AA248 46003086 */  mov.s     $f2, $f6
/* 41EFDC 802AA24C 46060003 */  div.s     $f0, $f0, $f6
/* 41EFE0 802AA250 46002100 */  add.s     $f4, $f4, $f0
/* 41EFE4 802AA254 E6240144 */  swc1      $f4, 0x144($s1)
D_802AA258_7B1BF8:
/* 41EFE8 802AA258 C6000014 */  lwc1      $f0, 0x14($s0)
/* 41EFEC 802AA25C C624014C */  lwc1      $f4, 0x14C($s1)
/* 41EFF0 802AA260 86020070 */  lh        $v0, 0x70($s0)
/* 41EFF4 802AA264 46040001 */  sub.s     $f0, $f0, $f4
/* 41EFF8 802AA268 44821000 */  mtc1      $v0, $f2
/* 41EFFC 802AA26C 00000000 */  nop
/* 41F000 802AA270 468010A0 */  cvt.s.w   $f2, $f2
/* 41F004 802AA274 46020003 */  div.s     $f0, $f0, $f2
/* 41F008 802AA278 46002100 */  add.s     $f4, $f4, $f0
/* 41F00C 802AA27C E624014C */  swc1      $f4, 0x14C($s1)
D_802AA280_7B1C20:
/* 41F010 802AA280 C60C0054 */  lwc1      $f12, 0x54($s0)
/* 41F014 802AA284 3C0140C9 */  lui       $at, (0x40C90FD0 >> 16)
/* 41F018 802AA288 34210FD0 */  ori       $at, $at, (0x40C90FD0 & 0xFFFF)
/* 41F01C 802AA28C 4481B000 */  mtc1      $at, $f22
/* 41F020 802AA290 00000000 */  nop
/* 41F024 802AA294 46166302 */  mul.s     $f12, $f12, $f22
/* 41F028 802AA298 00000000 */  nop
/* 41F02C 802AA29C 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
D_802AA2A0_7B1C40:
/* 41F030 802AA2A0 4481C000 */  mtc1      $at, $f24
/* 41F034 802AA2A4 3C014180 */  lui       $at, (0x41800000 >> 16)
D_802AA2A8_7B1C48:
/* 41F038 802AA2A8 4481A000 */  mtc1      $at, $f20
/* 41F03C 802AA2AC 0C00A85B */  jal       sin_rad
/* 41F040 802AA2B0 46186303 */   div.s    $f12, $f12, $f24
/* 41F044 802AA2B4 46140002 */  mul.s     $f0, $f0, $f20
/* 41F048 802AA2B8 00000000 */  nop
/* 41F04C 802AA2BC C602014C */  lwc1      $f2, 0x14C($s0)
/* 41F050 802AA2C0 46001080 */  add.s     $f2, $f2, $f0
/* 41F054 802AA2C4 C60C0054 */  lwc1      $f12, 0x54($s0)
/* 41F058 802AA2C8 46006307 */  neg.s     $f12, $f12
/* 41F05C 802AA2CC 0C00A6C9 */  jal       clamp_angle
D_802AA2D0_7B1C70:
/* 41F060 802AA2D0 E602014C */   swc1     $f2, 0x14C($s0)
/* 41F064 802AA2D4 C60C0054 */  lwc1      $f12, 0x54($s0)
/* 41F068 802AA2D8 46166302 */  mul.s     $f12, $f12, $f22
/* 41F06C 802AA2DC 00000000 */  nop
/* 41F070 802AA2E0 E600018C */  swc1      $f0, 0x18C($s0)
/* 41F074 802AA2E4 0C00A85B */  jal       sin_rad
/* 41F078 802AA2E8 46186303 */   div.s    $f12, $f12, $f24
/* 41F07C 802AA2EC 46140002 */  mul.s     $f0, $f0, $f20
/* 41F080 802AA2F0 00000000 */  nop
/* 41F084 802AA2F4 C622014C */  lwc1      $f2, 0x14C($s1)
D_802AA2F8_7B1C98:
/* 41F088 802AA2F8 46001081 */  sub.s     $f2, $f2, $f0
/* 41F08C 802AA2FC E622014C */  swc1      $f2, 0x14C($s1)
/* 41F090 802AA300 C60C0054 */  lwc1      $f12, 0x54($s0)
/* 41F094 802AA304 0C00A6C9 */  jal       clamp_angle
/* 41F098 802AA308 46006307 */   neg.s    $f12, $f12
/* 41F09C 802AA30C E620018C */  swc1      $f0, 0x18C($s1)
/* 41F0A0 802AA310 C6000054 */  lwc1      $f0, 0x54($s0)
/* 41F0A4 802AA314 3C0142B4 */  lui       $at, (0x42B40000 >> 16)
/* 41F0A8 802AA318 44811000 */  mtc1      $at, $f2
/* 41F0AC 802AA31C 86020070 */  lh        $v0, 0x70($s0)
D_802AA320_7B1CC0:
/* 41F0B0 802AA320 46020000 */  add.s     $f0, $f0, $f2
/* 41F0B4 802AA324 96030070 */  lhu       $v1, 0x70($s0)
/* 41F0B8 802AA328 10400004 */  beqz      $v0, .L802AA33C_7B1CDC
/* 41F0BC 802AA32C E6000054 */   swc1     $f0, 0x54($s0)
/* 41F0C0 802AA330 2462FFFF */  addiu     $v0, $v1, -0x1
/* 41F0C4 802AA334 080AA987 */  j         .L802AA61C_7B1FBC
/* 41F0C8 802AA338 A6020070 */   sh       $v0, 0x70($s0)
.L802AA33C_7B1CDC:
/* 41F0CC 802AA33C C6000018 */  lwc1      $f0, 0x18($s0)
/* 41F0D0 802AA340 C6020020 */  lwc1      $f2, 0x20($s0)
/* 41F0D4 802AA344 C604000C */  lwc1      $f4, 0xC($s0)
D_802AA348_7B1CE8:
/* 41F0D8 802AA348 E6000144 */  swc1      $f0, 0x144($s0)
/* 41F0DC 802AA34C E602014C */  swc1      $f2, 0x14C($s0)
/* 41F0E0 802AA350 E6240144 */  swc1      $f4, 0x144($s1)
/* 41F0E4 802AA354 C6000014 */  lwc1      $f0, 0x14($s0)
/* 41F0E8 802AA358 E620014C */  swc1      $f0, 0x14C($s1)
/* 41F0EC 802AA35C C6000144 */  lwc1      $f0, 0x144($s0)
/* 41F0F0 802AA360 C602014C */  lwc1      $f2, 0x14C($s0)
/* 41F0F4 802AA364 E6000138 */  swc1      $f0, 0x138($s0)
/* 41F0F8 802AA368 E6020140 */  swc1      $f2, 0x140($s0)
/* 41F0FC 802AA36C C6200144 */  lwc1      $f0, 0x144($s1)
/* 41F100 802AA370 C622014C */  lwc1      $f2, 0x14C($s1)
D_802AA374_7B1D14:
/* 41F104 802AA374 3C04800E */  lui       $a0, %hi(gBattleStatus)
/* 41F108 802AA378 2484C070 */  addiu     $a0, $a0, %lo(gBattleStatus)
/* 41F10C 802AA37C E6200138 */  swc1      $f0, 0x138($s1)
/* 41F110 802AA380 E6220140 */  swc1      $f2, 0x140($s1)
/* 41F114 802AA384 8C820000 */  lw        $v0, 0x0($a0)
/* 41F118 802AA388 3C030010 */  lui       $v1, (0x100000 >> 16)
/* 41F11C 802AA38C 00431025 */  or        $v0, $v0, $v1
/* 41F120 802AA390 AC820000 */  sw        $v0, 0x0($a0)
glabel .L802AA394_7B1D34
/* 41F124 802AA394 3C03800E */  lui       $v1, %hi(gBattleStatus)
/* 41F128 802AA398 2463C070 */  addiu     $v1, $v1, %lo(gBattleStatus)
D_802AA39C_7B1D3C:
/* 41F12C 802AA39C 8C620000 */  lw        $v0, 0x0($v1)
/* 41F130 802AA3A0 3C04FBFF */  lui       $a0, (0xFBFFFFFF >> 16)
/* 41F134 802AA3A4 34420002 */  ori       $v0, $v0, 0x2
/* 41F138 802AA3A8 AC620000 */  sw        $v0, 0x0($v1)
/* 41F13C 802AA3AC 8E020000 */  lw        $v0, 0x0($s0)
/* 41F140 802AA3B0 3484FFFF */  ori       $a0, $a0, (0xFBFFFFFF & 0xFFFF)
/* 41F144 802AA3B4 00441024 */  and       $v0, $v0, $a0
/* 41F148 802AA3B8 3C040800 */  lui       $a0, (0x8000000 >> 16)
/* 41F14C 802AA3BC 00441025 */  or        $v0, $v0, $a0
D_802AA3C0_7B1D60:
/* 41F150 802AA3C0 12200006 */  beqz      $s1, .L802AA3DC_7B1D7C
D_802AA3C4_7B1D64:
/* 41F154 802AA3C4 AE020000 */   sw       $v0, 0x0($s0)
/* 41F158 802AA3C8 8E220000 */  lw        $v0, 0x0($s1)
/* 41F15C 802AA3CC 3C030400 */  lui       $v1, (0x4000000 >> 16)
/* 41F160 802AA3D0 00431025 */  or        $v0, $v0, $v1
/* 41F164 802AA3D4 00441025 */  or        $v0, $v0, $a0
/* 41F168 802AA3D8 AE220000 */  sw        $v0, 0x0($s1)
.L802AA3DC_7B1D7C:
/* 41F16C 802AA3DC 24020008 */  addiu     $v0, $zero, 0x8
D_802AA3E0_7B1D80:
/* 41F170 802AA3E0 3C07802B */  lui       $a3, %hi(BattleMenu_OptionEnabled)
/* 41F174 802AA3E4 24E7D0D0 */  addiu     $a3, $a3, %lo(BattleMenu_OptionEnabled)
/* 41F178 802AA3E8 A640017C */  sh        $zero, 0x17C($s2)
D_802AA3EC_7B1D8C:
/* 41F17C 802AA3EC 3C01802B */  lui       $at, %hi(battle_menu_submenuIDs)
/* 41F180 802AA3F0 AC22D0B8 */  sw        $v0, %lo(battle_menu_submenuIDs)($at)
/* 41F184 802AA3F4 24020001 */  addiu     $v0, $zero, 0x1
/* 41F188 802AA3F8 3C08802B */  lui       $t0, %hi(battle_menu_isMessageDisabled)
/* 41F18C 802AA3FC 2508D0E8 */  addiu     $t0, $t0, %lo(battle_menu_isMessageDisabled)
/* 41F190 802AA400 3C06802B */  lui       $a2, %hi(D_802AB72C_7B30CC)
/* 41F194 802AA404 24C6B72C */  addiu     $a2, $a2, %lo(D_802AB72C_7B30CC)
/* 41F198 802AA408 3C05802B */  lui       $a1, %hi(BattleMenu_HudScripts)
/* 41F19C 802AA40C 24A5D078 */  addiu     $a1, $a1, %lo(BattleMenu_HudScripts)
/* 41F1A0 802AA410 ACE20000 */  sw        $v0, 0x0($a3)
D_802AA414_7B1DB4:
/* 41F1A4 802AA414 AD000000 */  sw        $zero, 0x0($t0)
/* 41F1A8 802AA418 8CC30000 */  lw        $v1, 0x0($a2)
/* 41F1AC 802AA41C 96420070 */  lhu       $v0, 0x70($s2)
/* 41F1B0 802AA420 3C04802B */  lui       $a0, %hi(D_802AB734_7B30D4)
/* 41F1B4 802AA424 8C84B734 */  lw        $a0, %lo(D_802AB734_7B30D4)($a0)
/* 41F1B8 802AA428 30420100 */  andi      $v0, $v0, 0x100
/* 41F1BC 802AA42C ACA30000 */  sw        $v1, 0x0($a1)
/* 41F1C0 802AA430 3C01802B */  lui       $at, %hi(BattleMenu_TitleMessages)
/* 41F1C4 802AA434 AC24D090 */  sw        $a0, %lo(BattleMenu_TitleMessages)($at)
/* 41F1C8 802AA438 14400006 */  bnez      $v0, .L802AA454_7B1DF4
D_802AA43C_7B1DDC:
/* 41F1CC 802AA43C 0000882D */   daddu    $s1, $zero, $zero
/* 41F1D0 802AA440 ACE00000 */  sw        $zero, 0x0($a3)
/* 41F1D4 802AA444 8CC30004 */  lw        $v1, 0x4($a2)
/* 41F1D8 802AA448 24020048 */  addiu     $v0, $zero, 0x48
/* 41F1DC 802AA44C AD020000 */  sw        $v0, 0x0($t0)
/* 41F1E0 802AA450 ACA30000 */  sw        $v1, 0x0($a1)
.L802AA454_7B1DF4:
/* 41F1E4 802AA454 0C0AA829 */  jal       func_802AA0A4_7B1A44
/* 41F1E8 802AA458 24100001 */   addiu    $s0, $zero, 0x1
/* 41F1EC 802AA45C 10400005 */  beqz      $v0, .L802AA474_7B1E14
/* 41F1F0 802AA460 24020002 */   addiu    $v0, $zero, 0x2
D_802AA464_7B1E04:
/* 41F1F4 802AA464 3C01802B */  lui       $at, %hi(BattleMenu_ShowSwapIcons)
/* 41F1F8 802AA468 AC30D104 */  sw        $s0, %lo(BattleMenu_ShowSwapIcons)($at)
/* 41F1FC 802AA46C 080AA920 */  j         .L802AA480_7B1E20
/* 41F200 802AA470 00511023 */   subu     $v0, $v0, $s1
.L802AA474_7B1E14:
/* 41F204 802AA474 3C01802B */  lui       $at, %hi(BattleMenu_ShowSwapIcons)
/* 41F208 802AA478 AC20D104 */  sw        $zero, %lo(BattleMenu_ShowSwapIcons)($at)
/* 41F20C 802AA47C 00511023 */  subu      $v0, $v0, $s1
.L802AA480_7B1E20:
/* 41F210 802AA480 3C01802B */  lui       $at, %hi(BattleMenu_NumOptions)
/* 41F214 802AA484 AC30D0AC */  sw        $s0, %lo(BattleMenu_NumOptions)($at)
/* 41F218 802AA488 3C01802B */  lui       $at, %hi(D_802AD0A8)
D_802AA48C_7B1E2C:
/* 41F21C 802AA48C AC20D0A8 */  sw        $zero, %lo(D_802AD0A8)($at)
/* 41F220 802AA490 3C01802B */  lui       $at, %hi(D_802AD0B0)
/* 41F224 802AA494 AC20D0B0 */  sw        $zero, %lo(D_802AD0B0)($at)
/* 41F228 802AA498 3C01802B */  lui       $at, %hi(D_802AD100)
/* 41F22C 802AA49C AC22D100 */  sw        $v0, %lo(D_802AD100)($at)
/* 41F230 802AA4A0 0C0A8400 */  jal       func_802A1000_7A89A0
/* 41F234 802AA4A4 00000000 */   nop
/* 41F238 802AA4A8 24020008 */  addiu     $v0, $zero, 0x8
/* 41F23C 802AA4AC 3C01802B */  lui       $at, %hi(D_802ACC60)
/* 41F240 802AA4B0 AC22CC60 */  sw        $v0, %lo(D_802ACC60)($at)
D_802AA4B4_7B1E54:
/* 41F244 802AA4B4 080AA985 */  j         .L802AA614_7B1FB4
/* 41F248 802AA4B8 24020001 */   addiu    $v0, $zero, 0x1
glabel .L802AA4BC_7B1E5C
/* 41F24C 802AA4BC 24040100 */  addiu     $a0, $zero, 0x100
/* 41F250 802AA4C0 0000282D */  daddu     $a1, $zero, $zero
/* 41F254 802AA4C4 3C060020 */  lui       $a2, (0x200001 >> 16)
/* 41F258 802AA4C8 0C098F3F */  jal       set_animation
/* 41F25C 802AA4CC 34C60001 */   ori      $a2, $a2, (0x200001 & 0xFFFF)
/* 41F260 802AA4D0 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41F264 802AA4D4 00000000 */   nop
/* 41F268 802AA4D8 3C11802B */  lui       $s1, %hi(D_802ACC60)
D_802AA4DC_7B1E7C:
/* 41F26C 802AA4DC 2631CC60 */  addiu     $s1, $s1, %lo(D_802ACC60)
/* 41F270 802AA4E0 8E230000 */  lw        $v1, 0x0($s1)
/* 41F274 802AA4E4 10600004 */  beqz      $v1, .L802AA4F8_7B1E98
/* 41F278 802AA4E8 0040802D */   daddu    $s0, $v0, $zero
/* 41F27C 802AA4EC 2462FFFF */  addiu     $v0, $v1, -0x1
/* 41F280 802AA4F0 080AA987 */  j         .L802AA61C_7B1FBC
/* 41F284 802AA4F4 AE220000 */   sw       $v0, 0x0($s1)
.L802AA4F8_7B1E98:
/* 41F288 802AA4F8 12000048 */  beqz      $s0, .L802AA61C_7B1FBC
/* 41F28C 802AA4FC 24040100 */   addiu    $a0, $zero, 0x100
D_802AA500_7B1EA0:
/* 41F290 802AA500 0000282D */  daddu     $a1, $zero, $zero
D_802AA504_7B1EA4:
/* 41F294 802AA504 3C060020 */  lui       $a2, (0x200008 >> 16)
/* 41F298 802AA508 0C098F3F */  jal       set_animation
/* 41F29C 802AA50C 34C60008 */   ori      $a2, $a2, (0x200008 & 0xFFFF)
/* 41F2A0 802AA510 2602FFFF */  addiu     $v0, $s0, -0x1
/* 41F2A4 802AA514 00021080 */  sll       $v0, $v0, 2
/* 41F2A8 802AA518 3C01802B */  lui       $at, %hi(D_802AD0BB)
/* 41F2AC 802AA51C 00220821 */  addu      $at, $at, $v0
D_802AA520_7B1EC0:
/* 41F2B0 802AA520 9022D0BB */  lbu       $v0, %lo(D_802AD0BB)($at)
/* 41F2B4 802AA524 0C0A840C */  jal       func_802A1030_7A89D0
/* 41F2B8 802AA528 A2420048 */   sb       $v0, 0x48($s2)
D_802AA52C_7B1ECC:
/* 41F2BC 802AA52C 24020008 */  addiu     $v0, $zero, 0x8
/* 41F2C0 802AA530 AE220000 */  sw        $v0, 0x0($s1)
/* 41F2C4 802AA534 24020004 */  addiu     $v0, $zero, 0x4
/* 41F2C8 802AA538 3C01802B */  lui       $at, %hi(D_802ACC6C)
/* 41F2CC 802AA53C AC22CC6C */  sw        $v0, %lo(D_802ACC6C)($at)
/* 41F2D0 802AA540 080AA985 */  j         .L802AA614_7B1FB4
/* 41F2D4 802AA544 24020002 */   addiu    $v0, $zero, 0x2
glabel .L802AA548_7B1EE8
/* 41F2D8 802AA548 0C0A846C */  jal       func_802A11B0_7A8B50
/* 41F2DC 802AA54C 00000000 */   nop
/* 41F2E0 802AA550 10400032 */  beqz      $v0, .L802AA61C_7B1FBC
D_802AA554_7B1EF4:
/* 41F2E4 802AA554 24040011 */   addiu    $a0, $zero, 0x11
/* 41F2E8 802AA558 24020004 */  addiu     $v0, $zero, 0x4
/* 41F2EC 802AA55C A642006C */  sh        $v0, 0x6C($s2)
/* 41F2F0 802AA560 24020005 */  addiu     $v0, $zero, 0x5
/* 41F2F4 802AA564 A642006E */  sh        $v0, 0x6E($s2)
/* 41F2F8 802AA568 24020008 */  addiu     $v0, $zero, 0x8
/* 41F2FC 802AA56C A2420178 */  sb        $v0, 0x178($s2)
/* 41F300 802AA570 3C038009 */  lui       $v1, %hi(D_8008FA8C)
/* 41F304 802AA574 8C63FA8C */  lw        $v1, %lo(D_8008FA8C)($v1)
/* 41F308 802AA578 24020082 */  addiu     $v0, $zero, 0x82
D_802AA57C_7B1F1C:
/* 41F30C 802AA57C A642017C */  sh        $v0, 0x17C($s2)
/* 41F310 802AA580 A640017A */  sh        $zero, 0x17A($s2)
/* 41F314 802AA584 0C090464 */  jal       func_80241190
/* 41F318 802AA588 AE430184 */   sw       $v1, 0x184($s2)
/* 41F31C 802AA58C 080AA987 */  j         .L802AA61C_7B1FBC
/* 41F320 802AA590 00000000 */   nop
glabel .L802AA594_7B1F34
/* 41F324 802AA594 0C0A8414 */  jal       func_802A1050_7A89F0
/* 41F328 802AA598 00000000 */   nop
/* 41F32C 802AA59C 24020001 */  addiu     $v0, $zero, 0x1
/* 41F330 802AA5A0 3C01800E */  lui       $at, %hi(gBattleSubState)
D_802AA5A4_7B1F44:
/* 41F334 802AA5A4 AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
/* 41F338 802AA5A8 0C0AA82E */  jal       func_802AA0B8_7B1A58
/* 41F33C 802AA5AC 00000000 */   nop
/* 41F340 802AA5B0 0C0AA82E */  jal       func_802AA0B8_7B1A58
/* 41F344 802AA5B4 00000000 */   nop
/* 41F348 802AA5B8 080AA987 */  j         .L802AA61C_7B1FBC
/* 41F34C 802AA5BC 00000000 */   nop
glabel .L802AA5C0_7B1F60
/* 41F350 802AA5C0 0C0A842E */  jal       func_802A10B8_7A8A58
/* 41F354 802AA5C4 00000000 */   nop
/* 41F358 802AA5C8 080AA987 */  j         .L802AA61C_7B1FBC
D_802AA5CC_7B1F6C:
/* 41F35C 802AA5CC 00000000 */   nop
glabel .L802AA5D0_7B1F70
/* 41F360 802AA5D0 24040050 */  addiu     $a0, $zero, 0x50
/* 41F364 802AA5D4 2405003C */  addiu     $a1, $zero, 0x3C
/* 41F368 802AA5D8 0C093E81 */  jal       func_8024FA04
/* 41F36C 802AA5DC 0000302D */   daddu    $a2, $zero, $zero
/* 41F370 802AA5E0 24020001 */  addiu     $v0, $zero, 0x1
/* 41F374 802AA5E4 3C01802B */  lui       $at, %hi(D_802AD607)
/* 41F378 802AA5E8 A022D607 */  sb        $v0, %lo(D_802AD607)($at)
/* 41F37C 802AA5EC 080AA985 */  j         .L802AA614_7B1FB4
/* 41F380 802AA5F0 24020009 */   addiu    $v0, $zero, 0x9
glabel .L802AA5F4_7B1F94
/* 41F384 802AA5F4 0C093EAD */  jal       func_8024FAB4
/* 41F388 802AA5F8 00000000 */   nop
/* 41F38C 802AA5FC 14400007 */  bnez      $v0, .L802AA61C_7B1FBC
/* 41F390 802AA600 24020001 */   addiu    $v0, $zero, 0x1
/* 41F394 802AA604 3C01802B */  lui       $at, %hi(D_802AD607)
/* 41F398 802AA608 A020D607 */  sb        $zero, %lo(D_802AD607)($at)
/* 41F39C 802AA60C 3C01802B */  lui       $at, %hi(D_802ACC60)
/* 41F3A0 802AA610 AC20CC60 */  sw        $zero, %lo(D_802ACC60)($at)
.L802AA614_7B1FB4:
/* 41F3A4 802AA614 3C01800E */  lui       $at, %hi(gBattleSubState)
/* 41F3A8 802AA618 AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
glabel .L802AA61C_7B1FBC
/* 41F3AC 802AA61C 8FBF001C */  lw        $ra, 0x1C($sp)
/* 41F3B0 802AA620 8FB20018 */  lw        $s2, 0x18($sp)
/* 41F3B4 802AA624 8FB10014 */  lw        $s1, 0x14($sp)
/* 41F3B8 802AA628 8FB00010 */  lw        $s0, 0x10($sp)
/* 41F3BC 802AA62C D7B80030 */  ldc1      $f24, 0x30($sp)
/* 41F3C0 802AA630 D7B60028 */  ldc1      $f22, 0x28($sp)
/* 41F3C4 802AA634 D7B40020 */  ldc1      $f20, 0x20($sp)
/* 41F3C8 802AA638 03E00008 */  jr        $ra
/* 41F3CC 802AA63C 27BD0038 */   addiu    $sp, $sp, 0x38

### DECOMPILED C INSTRUCTIONS:

void btl_state_update_twink_menu(void) {
    BattleStatus* battleStatus = &gBattleStatus;
    Actor* player = battleStatus->playerActor;
    Actor* partner = battleStatus->partnerActor;
    s32 s1;
    s32 selection;
    s32 var_v0_2;
    s32 shouldSkipTurn;
    s32 initialPos;
    s32 entryIdx;

    switch (gBattleSubState) {
        case BTL_SUBSTATE_TWINK_MENU_INIT:
            shouldSkipTurn = FALSE;
            if (player->debuff == STATUS_KEY_SLEEP) {
                shouldSkipTurn = TRUE;
            }
            if (player->debuff == STATUS_KEY_FEAR) {
                shouldSkipTurn = TRUE;
            }
            if (player->debuff == STATUS_KEY_DIZZY) {
                shouldSkipTurn = TRUE;
            }
            if (player->debuff == STATUS_KEY_PARALYZE) {
                shouldSkipTurn = TRUE;
            }
            if (player->debuff == STATUS_KEY_FROZEN) {
                shouldSkipTurn = TRUE;
            }
            if (player->debuff == STATUS_KEY_STOP) {
                shouldSkipTurn = TRUE;
            }
            if (player->stoneStatus == STATUS_KEY_STONE) {
                shouldSkipTurn = TRUE;
            }
            if (player->koStatus == STATUS_KEY_DAZE) {
                shouldSkipTurn = TRUE;
            }

            if (shouldSkipTurn) {
                btl_set_state(BATTLE_STATE_END_PLAYER_TURN);
                break;
            }

            btl_cam_use_preset(BTL_CAM_DEFAULT);
            btl_cam_move(10);
            if (!(gBattleStatus.flags1 & BS_FLAGS1_PLAYER_IN_BACK)) {
                player->state.currentPos.x = player->homePos.x;
                player->state.currentPos.z = player->homePos.z;
                player->state.goalPos.x = partner->homePos.x;
                player->state.goalPos.z = partner->homePos.z;
                gBattleSubState = BTL_SUBSTATE_TWINK_MENU_PERFORM_SWAP;
                player->state.moveTime = 4;
                player->state.angle = 0.0f;
                break;
            }
            gBattleSubState = BTL_SUBSTATE_TWINK_MENU_CREATE_MAIN_MENU;
            break;
        case BTL_SUBSTATE_TWINK_MENU_PERFORM_SWAP:
            if (player->state.moveTime != 0) {
                player->currentPos.x += (player->state.goalPos.x - player->currentPos.x) / player->state.moveTime;
                player->currentPos.z += (player->state.goalPos.z - player->currentPos.z) / player->state.moveTime;
                partner->currentPos.x += (player->state.currentPos.x - partner->currentPos.x) / player->state.moveTime;
                partner->currentPos.z += (player->state.currentPos.z - partner->currentPos.z) / player->state.moveTime;
            }
            player->currentPos.z += sin_rad((player->state.angle * TAU) / 360.0f) * 16.0f;
            player->yaw = clamp_angle(-player->state.angle);
            partner->currentPos.z -= sin_rad((player->state.angle * TAU) / 360.0f) * 16.0f;
            partner->yaw = clamp_angle(-player->state.angle);
            player->state.angle += 90.0f;
            if (player->state.moveTime != 0) {
                player->state.moveTime--;
                break;
            }
            player->currentPos.x = player->state.goalPos.x;
            player->currentPos.z = player->state.goalPos.z;
            partner->currentPos.x = player->state.currentPos.x;
            partner->currentPos.z = player->state.currentPos.z;
            player->homePos.x = player->currentPos.x;
            player->homePos.z = player->currentPos.z;
            partner->homePos.x = partner->currentPos.x;
            partner->homePos.z = partner->currentPos.z;
            gBattleStatus.flags1 |= BS_FLAGS1_PLAYER_IN_BACK;
        case BTL_SUBSTATE_TWINK_MENU_CREATE_MAIN_MENU:
            gBattleStatus.flags1 |= BS_FLAGS1_MENU_OPEN;
            player->flags &= ~ACTOR_FLAG_4000000;
            player->flags |= ACTOR_FLAG_8000000;
            if (partner != NULL) {
                partner->flags |= ACTOR_FLAG_4000000;
                partner->flags |= ACTOR_FLAG_8000000;
            }

            entryIdx = 0;
            battleStatus->selectedMoveID = MOVE_NONE;
            battle_menu_submenuIDs[entryIdx] = BTL_MENU_TYPE_STAR_POWERS;
            BattleMenu_OptionEnabled[entryIdx] = TRUE;
            battle_menu_isMessageDisabled[entryIdx] = 0;
            BattleMenu_HudScripts[entryIdx] = battle_menu_TwinkStarPowerHudScripts.enabled;
            BattleMenu_TitleMessages[entryIdx] = D_802AB734[entryIdx];
            if (!(battleStatus->enabledMenusFlags & BTL_MENU_ENABLED_STAR_POWERS)) {
                BattleMenu_OptionEnabled[entryIdx] = FALSE;
                battle_menu_isMessageDisabled[entryIdx] = BTL_MSG_CANT_SELECT_NOW;
                BattleMenu_HudScripts[entryIdx] = battle_menu_TwinkStarPowerHudScripts.disabled;
            }

            initialPos = 0;
            entryIdx++;

            if (btl_menu_show_switch_to_peach()) {
                BattleMenu_ShowSwapIcons = TRUE;
            } else {
                BattleMenu_ShowSwapIcons = FALSE;
            }
            BattleMenu_NumOptions = entryIdx;
            D_802AD0A8 = 0;
            D_802AD0B0 = initialPos;
            D_802AD100 = 2 - initialPos;

            btl_main_menu_init();
            D_802ACC60 = 8;
            gBattleSubState = BTL_SUBSTATE_TWINK_MENU_CHOOSE_CATEGORY;
            break;
        case BTL_SUBSTATE_TWINK_MENU_CHOOSE_CATEGORY:
            set_animation(ACTOR_PARTNER, 0, ANIM_Twink_Idle);
            selection = btl_main_menu_update();
            if (D_802ACC60 != 0) {
                D_802ACC60--;
                break;
            }
            if (selection != 0) {
                set_animation(ACTOR_PARTNER, 0, ANIM_Twink_Angry);
                battleStatus->currentSubmenu = battle_menu_submenuIDs[selection - 1];
                func_802A1030();
                D_802ACC60 = 8;
                D_802ACC6C = 4;
                gBattleSubState = BTL_SUBSTATE_TWINK_MENU_CHOOSE_TARGET;
            }
            break;
        case BTL_SUBSTATE_TWINK_MENU_CHOOSE_TARGET:
            if (btl_main_menu_update() != 0) {
                battleStatus->cancelTargetMenuSubstate = BTL_SUBSTATE_TWINK_MENU_TARGET_CANCEL;
                battleStatus->acceptTargetMenuSubstate = BTL_SUBSTATE_TWINK_MENU_TARGET_CHOSEN;
                battleStatus->moveCategory = BTL_MENU_TYPE_STAR_POWERS;
                battleStatus->selectedMoveID = MOVE_TWINK_DASH;
                battleStatus->moveArgument = 0;
                battleStatus->currentTargetListFlags = gMoveTable[MOVE_TWINK_DASH].flags;
                btl_set_state(BATTLE_STATE_SELECT_TARGET);
            }
            break;
        case BTL_SUBSTATE_TWINK_MENU_TARGET_CANCEL:
            func_802A1050();
            gBattleSubState = BTL_SUBSTATE_TWINK_MENU_CHOOSE_CATEGORY;
            btl_state_update_twink_menu();
            btl_state_update_twink_menu();
            break;
        case BTL_SUBSTATE_TWINK_MENU_TARGET_CHOSEN:
            btl_main_menu_destroy();
            break;
        case BTL_SUBSTATE_TWINK_MENU_SHOW_CANT_SWITCH:
            btl_show_variable_battle_message(BTL_MSG_CANT_SWITCH, 60, 0);
            D_802AD607 = 1;
            gBattleSubState = BTL_SUBSTATE_TWINK_MENU_AWAIT_CANT_SWITCH_POPUP;
            break;
        case BTL_SUBSTATE_TWINK_MENU_AWAIT_CANT_SWITCH_POPUP:
            if (!btl_is_popup_displayed()) {
                D_802AD607 = 0;
                D_802ACC60 = 0;
                gBattleSubState = BTL_SUBSTATE_TWINK_MENU_CHOOSE_CATEGORY;
            }
            break;
    }
}