### RAW ASSEMBLY INSTRUCTIONS:

glabel btl_update
/* 16CD18 8023E438 27BDFFC8 */  addiu     $sp, $sp, -0x38
/* 16CD1C 8023E43C AFB00028 */  sw        $s0, 0x28($sp)
/* 16CD20 8023E440 3C10800E */  lui       $s0, %hi(gBattleStatus)
/* 16CD24 8023E444 2610C070 */  addiu     $s0, $s0, %lo(gBattleStatus)
/* 16CD28 8023E448 2402FFFF */  addiu     $v0, $zero, -0x1
/* 16CD2C 8023E44C AFBF0034 */  sw        $ra, 0x34($sp)
/* 16CD30 8023E450 AFB20030 */  sw        $s2, 0x30($sp)
/* 16CD34 8023E454 AFB1002C */  sw        $s1, 0x2C($sp)
/* 16CD38 8023E458 8E040224 */  lw        $a0, 0x224($s0)
/* 16CD3C 8023E45C 8E1200DC */  lw        $s2, 0xDC($s0)
/* 16CD40 8023E460 10820028 */  beq       $a0, $v0, .L8023E504
/* 16CD44 8023E464 3C030008 */   lui      $v1, (0x80000 >> 16)
/* 16CD48 8023E468 8E020000 */  lw        $v0, 0x0($s0)
/* 16CD4C 8023E46C 00431024 */  and       $v0, $v0, $v1
/* 16CD50 8023E470 10400014 */  beqz      $v0, .L8023E4C4
/* 16CD54 8023E474 00000000 */   nop
/* 16CD58 8023E478 3C038007 */  lui       $v1, %hi(gGameStatusPtr)
/* 16CD5C 8023E47C 8C63419C */  lw        $v1, %lo(gGameStatusPtr)($v1)
/* 16CD60 8023E480 80620081 */  lb        $v0, 0x81($v1)
/* 16CD64 8023E484 1040000F */  beqz      $v0, .L8023E4C4
/* 16CD68 8023E488 00000000 */   nop
/* 16CD6C 8023E48C 8C620004 */  lw        $v0, 0x4($v1)
/* 16CD70 8023E490 00441024 */  and       $v0, $v0, $a0
/* 16CD74 8023E494 AE020210 */  sw        $v0, 0x210($s0)
/* 16CD78 8023E498 8C620014 */  lw        $v0, 0x14($v1)
/* 16CD7C 8023E49C 00441024 */  and       $v0, $v0, $a0
/* 16CD80 8023E4A0 AE020214 */  sw        $v0, 0x214($s0)
/* 16CD84 8023E4A4 8C620024 */  lw        $v0, 0x24($v1)
/* 16CD88 8023E4A8 00441024 */  and       $v0, $v0, $a0
/* 16CD8C 8023E4AC AE020218 */  sw        $v0, 0x218($s0)
/* 16CD90 8023E4B0 80620041 */  lb        $v0, 0x41($v1)
/* 16CD94 8023E4B4 AE02021C */  sw        $v0, 0x21C($s0)
/* 16CD98 8023E4B8 80620045 */  lb        $v0, 0x45($v1)
/* 16CD9C 8023E4BC 0808F941 */  j         .L8023E504
/* 16CDA0 8023E4C0 AE020220 */   sw       $v0, 0x220($s0)
.L8023E4C4:
/* 16CDA4 8023E4C4 3C048007 */  lui       $a0, %hi(gGameStatusPtr)
/* 16CDA8 8023E4C8 8C84419C */  lw        $a0, %lo(gGameStatusPtr)($a0)
/* 16CDAC 8023E4CC 8E030224 */  lw        $v1, 0x224($s0)
/* 16CDB0 8023E4D0 8C820000 */  lw        $v0, 0x0($a0)
/* 16CDB4 8023E4D4 00431024 */  and       $v0, $v0, $v1
/* 16CDB8 8023E4D8 AE020210 */  sw        $v0, 0x210($s0)
/* 16CDBC 8023E4DC 8C820010 */  lw        $v0, 0x10($a0)
/* 16CDC0 8023E4E0 00431024 */  and       $v0, $v0, $v1
/* 16CDC4 8023E4E4 AE020214 */  sw        $v0, 0x214($s0)
/* 16CDC8 8023E4E8 8C820020 */  lw        $v0, 0x20($a0)
/* 16CDCC 8023E4EC 00431024 */  and       $v0, $v0, $v1
/* 16CDD0 8023E4F0 AE020218 */  sw        $v0, 0x218($s0)
/* 16CDD4 8023E4F4 80820040 */  lb        $v0, 0x40($a0)
/* 16CDD8 8023E4F8 AE02021C */  sw        $v0, 0x21C($s0)
/* 16CDDC 8023E4FC 80820044 */  lb        $v0, 0x44($a0)
/* 16CDE0 8023E500 AE020220 */  sw        $v0, 0x220($s0)
.L8023E504:
/* 16CDE4 8023E504 27A40010 */  addiu     $a0, $sp, 0x10
/* 16CDE8 8023E508 0C08F800 */  jal       get_dpad_input_radial
/* 16CDEC 8023E50C 27A50014 */   addiu    $a1, $sp, 0x14
/* 16CDF0 8023E510 C7A00010 */  lwc1      $f0, 0x10($sp)
/* 16CDF4 8023E514 82020431 */  lb        $v0, 0x431($s0)
/* 16CDF8 8023E518 8E030214 */  lw        $v1, 0x214($s0)
/* 16CDFC 8023E51C 4600010D */  trunc.w.s $f4, $f0
/* 16CE00 8023E520 E6040228 */  swc1      $f4, 0x228($s0)
/* 16CE04 8023E524 00021080 */  sll       $v0, $v0, 2
/* 16CE08 8023E528 C7A00014 */  lwc1      $f0, 0x14($sp)
/* 16CE0C 8023E52C 02021021 */  addu      $v0, $s0, $v0
/* 16CE10 8023E530 4600010D */  trunc.w.s $f4, $f0
/* 16CE14 8023E534 E604022C */  swc1      $f4, 0x22C($s0)
/* 16CE18 8023E538 AC430330 */  sw        $v1, 0x330($v0)
/* 16CE1C 8023E53C 82020431 */  lb        $v0, 0x431($s0)
/* 16CE20 8023E540 8E030210 */  lw        $v1, 0x210($s0)
/* 16CE24 8023E544 00021080 */  sll       $v0, $v0, 2
/* 16CE28 8023E548 02021021 */  addu      $v0, $s0, $v0
/* 16CE2C 8023E54C AC430230 */  sw        $v1, 0x230($v0)
/* 16CE30 8023E550 92020431 */  lbu       $v0, 0x431($s0)
/* 16CE34 8023E554 24420001 */  addiu     $v0, $v0, 0x1
/* 16CE38 8023E558 A2020431 */  sb        $v0, 0x431($s0)
/* 16CE3C 8023E55C 00021600 */  sll       $v0, $v0, 24
/* 16CE40 8023E560 00021603 */  sra       $v0, $v0, 24
/* 16CE44 8023E564 28420040 */  slti      $v0, $v0, 0x40
/* 16CE48 8023E568 50400001 */  beql      $v0, $zero, .L8023E570
/* 16CE4C 8023E56C A2000431 */   sb       $zero, 0x431($s0)
.L8023E570:
/* 16CE50 8023E570 8E0200B4 */  lw        $v0, 0xB4($s0)
/* 16CE54 8023E574 10400003 */  beqz      $v0, .L8023E584
/* 16CE58 8023E578 00000000 */   nop
/* 16CE5C 8023E57C 0040F809 */  jalr      $v0
/* 16CE60 8023E580 00000000 */   nop
.L8023E584:
/* 16CE64 8023E584 82030095 */  lb        $v1, 0x95($s0)
/* 16CE68 8023E588 10600005 */  beqz      $v1, .L8023E5A0
/* 16CE6C 8023E58C 24110001 */   addiu    $s1, $zero, 0x1
/* 16CE70 8023E590 3C02800E */  lui       $v0, %hi(gBattleState)
/* 16CE74 8023E594 8C42C068 */  lw        $v0, %lo(gBattleState)($v0)
/* 16CE78 8023E598 10620092 */  beq       $v1, $v0, .L8023E7E4
/* 16CE7C 8023E59C 00000000 */   nop
.L8023E5A0:
/* 16CE80 8023E5A0 3C02800E */  lui       $v0, %hi(gBattleState)
/* 16CE84 8023E5A4 8C42C068 */  lw        $v0, %lo(gBattleState)($v0)
/* 16CE88 8023E5A8 24430001 */  addiu     $v1, $v0, 0x1
/* 16CE8C 8023E5AC 2C620025 */  sltiu     $v0, $v1, 0x25
/* 16CE90 8023E5B0 1040008C */  beqz      $v0, .L8023E7E4
/* 16CE94 8023E5B4 00031080 */   sll      $v0, $v1, 2
/* 16CE98 8023E5B8 3C01802A */  lui       $at, %hi(jtbl_8029C960)
/* 16CE9C 8023E5BC 00220821 */  addu      $at, $at, $v0
/* 16CEA0 8023E5C0 8C22C960 */  lw        $v0, %lo(jtbl_8029C960)($at)
/* 16CEA4 8023E5C4 00400008 */  jr        $v0
/* 16CEA8 8023E5C8 00000000 */   nop
glabel .L8023E5CC
/* 16CEAC 8023E5CC 0C090486 */  jal       func_80241218
/* 16CEB0 8023E5D0 0000882D */   daddu    $s1, $zero, $zero
/* 16CEB4 8023E5D4 0808F9F9 */  j         .L8023E7E4
/* 16CEB8 8023E5D8 00000000 */   nop
glabel .L8023E5DC
/* 16CEBC 8023E5DC 0C090809 */  jal       func_80242024
/* 16CEC0 8023E5E0 00000000 */   nop
/* 16CEC4 8023E5E4 0808F9F9 */  j         .L8023E7E4
/* 16CEC8 8023E5E8 00000000 */   nop
glabel .L8023E5EC
/* 16CECC 8023E5EC 0C090AEC */  jal       D_80242BB0
/* 16CED0 8023E5F0 00000000 */   nop
/* 16CED4 8023E5F4 0808F9F9 */  j         .L8023E7E4
/* 16CED8 8023E5F8 00000000 */   nop
glabel .L8023E5FC
/* 16CEDC 8023E5FC 0C090BF8 */  jal       D_80242FE0
/* 16CEE0 8023E600 00000000 */   nop
/* 16CEE4 8023E604 0808F9F9 */  j         .L8023E7E4
/* 16CEE8 8023E608 00000000 */   nop
glabel .L8023E60C
/* 16CEEC 8023E60C 0C0906C5 */  jal       D_80241B14
/* 16CEF0 8023E610 00000000 */   nop
/* 16CEF4 8023E614 0808F9F9 */  j         .L8023E7E4
/* 16CEF8 8023E618 00000000 */   nop
glabel .L8023E61C
/* 16CEFC 8023E61C 0C090E76 */  jal       func_802439D8
/* 16CF00 8023E620 00000000 */   nop
/* 16CF04 8023E624 0808F9F9 */  j         .L8023E7E4
/* 16CF08 8023E628 00000000 */   nop
glabel .L8023E62C
/* 16CF0C 8023E62C 0C090AB2 */  jal       dgb_15_pad_2AC8
/* 16CF10 8023E630 00000000 */   nop
/* 16CF14 8023E634 0808F9F9 */  j         .L8023E7E4
/* 16CF18 8023E638 00000000 */   nop
glabel .L8023E63C
/* 16CF1C 8023E63C 0C090BC0 */  jal       D_80242F00
/* 16CF20 8023E640 00000000 */   nop
/* 16CF24 8023E644 0808F9F9 */  j         .L8023E7E4
/* 16CF28 8023E648 00000000 */   nop
glabel .L8023E64C
/* 16CF2C 8023E64C 0C090E46 */  jal       dgb_09_pad_3918
/* 16CF30 8023E650 00000000 */   nop
/* 16CF34 8023E654 0808F9F9 */  j         .L8023E7E4
/* 16CF38 8023E658 00000000 */   nop
glabel .L8023E65C
/* 16CF3C 8023E65C 0C0A9662 */  jal       func_802A5988_7AD328
/* 16CF40 8023E660 00000000 */   nop
/* 16CF44 8023E664 0808F9F9 */  j         .L8023E7E4
/* 16CF48 8023E668 00000000 */   nop
glabel .L8023E66C
/* 16CF4C 8023E66C 0C0AA072 */  jal       func_802A81C8_7AFB68
/* 16CF50 8023E670 00000000 */   nop
/* 16CF54 8023E674 0808F9F9 */  j         .L8023E7E4
/* 16CF58 8023E678 00000000 */   nop
glabel .L8023E67C
/* 16CF5C 8023E67C 0C0AA82E */  jal       func_802AA0B8_7B1A58
/* 16CF60 8023E680 00000000 */   nop
/* 16CF64 8023E684 0808F9F9 */  j         .L8023E7E4
/* 16CF68 8023E688 00000000 */   nop
glabel .L8023E68C
/* 16CF6C 8023E68C 0C0AA6D1 */  jal       func_802A9B44_7B14E4
/* 16CF70 8023E690 00000000 */   nop
/* 16CF74 8023E694 0808F9F9 */  j         .L8023E7E4
/* 16CF78 8023E698 00000000 */   nop
glabel .L8023E69C
/* 16CF7C 8023E69C 0C0AA9A2 */  jal       func_802AA688_7B2028
/* 16CF80 8023E6A0 00000000 */   nop
/* 16CF84 8023E6A4 0808F9F9 */  j         .L8023E7E4
/* 16CF88 8023E6A8 00000000 */   nop
glabel .L8023E6AC
/* 16CF8C 8023E6AC 0C0916B4 */  jal       D_80245AD0
/* 16CF90 8023E6B0 00000000 */   nop
/* 16CF94 8023E6B4 0808F9F9 */  j         .L8023E7E4
/* 16CF98 8023E6B8 00000000 */   nop
glabel .L8023E6BC
/* 16CF9C 8023E6BC 0C091EC1 */  jal       func_80247B04
/* 16CFA0 8023E6C0 00000000 */   nop
/* 16CFA4 8023E6C4 0808F9F9 */  j         .L8023E7E4
/* 16CFA8 8023E6C8 00000000 */   nop
glabel .L8023E6CC
/* 16CFAC 8023E6CC 0C091914 */  jal       func_80246450
/* 16CFB0 8023E6D0 00000000 */   nop
/* 16CFB4 8023E6D4 0808F9F9 */  j         .L8023E7E4
/* 16CFB8 8023E6D8 00000000 */   nop
glabel .L8023E6DC
/* 16CFBC 8023E6DC 0C091C87 */  jal       func_8024721C
/* 16CFC0 8023E6E0 00000000 */   nop
/* 16CFC4 8023E6E4 0808F9F9 */  j         .L8023E7E4
/* 16CFC8 8023E6E8 00000000 */   nop
glabel .L8023E6EC
/* 16CFCC 8023E6EC 0C091D5C */  jal       func_80247570
/* 16CFD0 8023E6F0 00000000 */   nop
/* 16CFD4 8023E6F4 0808F9F9 */  j         .L8023E7E4
/* 16CFD8 8023E6F8 00000000 */   nop
glabel .L8023E6FC
/* 16CFDC 8023E6FC 0C092064 */  jal       func_80248190
/* 16CFE0 8023E700 00000000 */   nop
/* 16CFE4 8023E704 0808F9F9 */  j         .L8023E7E4
/* 16CFE8 8023E708 00000000 */   nop
glabel .L8023E70C
/* 16CFEC 8023E70C 0C091CAB */  jal       D_802472AC
/* 16CFF0 8023E710 00000000 */   nop
/* 16CFF4 8023E714 0808F9F9 */  j         .L8023E7E4
/* 16CFF8 8023E718 00000000 */   nop
glabel .L8023E71C
/* 16CFFC 8023E71C 0C091ACD */  jal       func_80246B34
/* 16D000 8023E720 00000000 */   nop
/* 16D004 8023E724 0808F9F9 */  j         .L8023E7E4
/* 16D008 8023E728 00000000 */   nop
glabel .L8023E72C
/* 16D00C 8023E72C 0C091002 */  jal       func_80244008
/* 16D010 8023E730 00000000 */   nop
/* 16D014 8023E734 0808F9F9 */  j         .L8023E7E4
/* 16D018 8023E738 00000000 */   nop
glabel .L8023E73C
/* 16D01C 8023E73C 0C091294 */  jal       D_80244A50
/* 16D020 8023E740 00000000 */   nop
/* 16D024 8023E744 0808F9F9 */  j         .L8023E7E4
/* 16D028 8023E748 00000000 */   nop
glabel .L8023E74C
/* 16D02C 8023E74C 0C0915BE */  jal       func_802456F8
/* 16D030 8023E750 00000000 */   nop
/* 16D034 8023E754 0808F9F9 */  j         .L8023E7E4
/* 16D038 8023E758 00000000 */   nop
glabel .L8023E75C
/* 16D03C 8023E75C 0C0913C0 */  jal       D_80244F00
/* 16D040 8023E760 00000000 */   nop
/* 16D044 8023E764 0808F9F9 */  j         .L8023E7E4
/* 16D048 8023E768 00000000 */   nop
glabel .L8023E76C
/* 16D04C 8023E76C 0C09138E */  jal       func_80244E38
/* 16D050 8023E770 00000000 */   nop
/* 16D054 8023E774 0808F9F9 */  j         .L8023E7E4
/* 16D058 8023E778 00000000 */   nop
glabel .L8023E77C
/* 16D05C 8023E77C 0C091510 */  jal       func_80245440
/* 16D060 8023E780 00000000 */   nop
/* 16D064 8023E784 0808F9F9 */  j         .L8023E7E4
/* 16D068 8023E788 00000000 */   nop
glabel .L8023E78C
/* 16D06C 8023E78C 0C090FF7 */  jal       func_80243FDC
/* 16D070 8023E790 00000000 */   nop
/* 16D074 8023E794 0808F9F9 */  j         .L8023E7E4
/* 16D078 8023E798 00000000 */   nop
glabel .L8023E79C
/* 16D07C 8023E79C 0C0911C4 */  jal       func_80244710
/* 16D080 8023E7A0 00000000 */   nop
/* 16D084 8023E7A4 0808F9F9 */  j         .L8023E7E4
/* 16D088 8023E7A8 00000000 */   nop
glabel .L8023E7AC
/* 16D08C 8023E7AC 0C092198 */  jal       func_80248660
/* 16D090 8023E7B0 00000000 */   nop
/* 16D094 8023E7B4 0808F9F9 */  j         .L8023E7E4
/* 16D098 8023E7B8 00000000 */   nop
glabel .L8023E7BC
/* 16D09C 8023E7BC 0C0AACCC */  jal       func_802AB330_7B2CD0
/* 16D0A0 8023E7C0 00000000 */   nop
/* 16D0A4 8023E7C4 0808F9F9 */  j         .L8023E7E4
/* 16D0A8 8023E7C8 00000000 */   nop
glabel .L8023E7CC
/* 16D0AC 8023E7CC 0C097864 */  jal       func_8025E190
/* 16D0B0 8023E7D0 00000000 */   nop
/* 16D0B4 8023E7D4 0808F9F9 */  j         .L8023E7E4
/* 16D0B8 8023E7D8 00000000 */   nop
glabel .L8023E7DC
/* 16D0BC 8023E7DC 0C0922C2 */  jal       func_80248B08
/* 16D0C0 8023E7E0 0000882D */   daddu    $s1, $zero, $zero
glabel .L8023E7E4
/* 16D0C4 8023E7E4 96020090 */  lhu       $v0, 0x90($s0)
/* 16D0C8 8023E7E8 24030028 */  addiu     $v1, $zero, 0x28
/* 16D0CC 8023E7EC 24420001 */  addiu     $v0, $v0, 0x1
/* 16D0D0 8023E7F0 A6020090 */  sh        $v0, 0x90($s0)
/* 16D0D4 8023E7F4 00021400 */  sll       $v0, $v0, 16
/* 16D0D8 8023E7F8 00021403 */  sra       $v0, $v0, 16
/* 16D0DC 8023E7FC 14430003 */  bne       $v0, $v1, .L8023E80C
/* 16D0E0 8023E800 00000000 */   nop
/* 16D0E4 8023E804 0C093DF2 */  jal       func_8024F7C8
/* 16D0E8 8023E808 00000000 */   nop
.L8023E80C:
/* 16D0EC 8023E80C 0C0999A1 */  jal       update_damage_popups
/* 16D0F0 8023E810 00000000 */   nop
/* 16D0F4 8023E814 0C099A5E */  jal       update_action_ratings
/* 16D0F8 8023E818 00000000 */   nop
/* 16D0FC 8023E81C 0C099AC5 */  jal       update_health_bars
/* 16D100 8023E820 00000000 */   nop
/* 16D104 8023E824 0C093B92 */  jal       func_8024EE48
/* 16D108 8023E828 00000000 */   nop
/* 16D10C 8023E82C 0C08F901 */  jal       update_actor_shadows
/* 16D110 8023E830 00000000 */   nop
/* 16D114 8023E834 82030432 */  lb        $v1, 0x432($s0)
/* 16D118 8023E838 2402FFFE */  addiu     $v0, $zero, -0x2
/* 16D11C 8023E83C 10620089 */  beq       $v1, $v0, .L8023EA64
/* 16D120 8023E840 27A50018 */   addiu    $a1, $sp, 0x18
/* 16D124 8023E844 24040001 */  addiu     $a0, $zero, 0x1
/* 16D128 8023E848 0C04DF70 */  jal       get_screen_overlay_params
/* 16D12C 8023E84C 27A6001C */   addiu    $a2, $sp, 0x1C
/* 16D130 8023E850 82020432 */  lb        $v0, 0x432($s0)
/* 16D134 8023E854 1840002C */  blez      $v0, .L8023E908
/* 16D138 8023E858 24040001 */   addiu    $a0, $zero, 0x1
/* 16D13C 8023E85C 0000282D */  daddu     $a1, $zero, $zero
/* 16D140 8023E860 00A0302D */  daddu     $a2, $a1, $zero
/* 16D144 8023E864 0C04DF84 */  jal       set_screen_overlay_color
/* 16D148 8023E868 00A0382D */   daddu    $a3, $a1, $zero
/* 16D14C 8023E86C 16400003 */  bnez      $s2, .L8023E87C
/* 16D150 8023E870 00000000 */   nop
/* 16D154 8023E874 0808FA56 */  j         .L8023E958
/* 16D158 8023E878 3C054357 */   lui      $a1, (0x43570000 >> 16)
.L8023E87C:
/* 16D15C 8023E87C 3C028011 */  lui       $v0, %hi(gPlayerData)
/* 16D160 8023E880 2442F290 */  addiu     $v0, $v0, %lo(gPlayerData)
/* 16D164 8023E884 80430012 */  lb        $v1, 0x12($v0)
/* 16D168 8023E888 24020006 */  addiu     $v0, $zero, 0x6
/* 16D16C 8023E88C 1462000F */  bne       $v1, $v0, .L8023E8CC
/* 16D170 8023E890 00000000 */   nop
/* 16D174 8023E894 C7A0001C */  lwc1      $f0, 0x1C($sp)
/* 16D178 8023E898 3C014120 */  lui       $at, (0x41200000 >> 16)
/* 16D17C 8023E89C 44811000 */  mtc1      $at, $f2
/* 16D180 8023E8A0 00000000 */  nop
/* 16D184 8023E8A4 46020001 */  sub.s     $f0, $f0, $f2
/* 16D188 8023E8A8 44801000 */  mtc1      $zero, $f2
/* 16D18C 8023E8AC 00000000 */  nop
/* 16D190 8023E8B0 4602003C */  c.lt.s    $f0, $f2
/* 16D194 8023E8B4 00000000 */  nop
/* 16D198 8023E8B8 45000002 */  bc1f      .L8023E8C4
/* 16D19C 8023E8BC E7A0001C */   swc1     $f0, 0x1C($sp)
/* 16D1A0 8023E8C0 E7A2001C */  swc1      $f2, 0x1C($sp)
.L8023E8C4:
/* 16D1A4 8023E8C4 0808FA56 */  j         .L8023E958
/* 16D1A8 8023E8C8 8FA5001C */   lw       $a1, 0x1C($sp)
.L8023E8CC:
/* 16D1AC 8023E8CC C7A0001C */  lwc1      $f0, 0x1C($sp)
/* 16D1B0 8023E8D0 3C014120 */  lui       $at, (0x41200000 >> 16)
/* 16D1B4 8023E8D4 44811000 */  mtc1      $at, $f2
/* 16D1B8 8023E8D8 00000000 */  nop
/* 16D1BC 8023E8DC 46020000 */  add.s     $f0, $f0, $f2
/* 16D1C0 8023E8E0 3C014357 */  lui       $at, (0x43570000 >> 16)
/* 16D1C4 8023E8E4 44811000 */  mtc1      $at, $f2
/* 16D1C8 8023E8E8 00000000 */  nop
/* 16D1CC 8023E8EC 4600103C */  c.lt.s    $f2, $f0
/* 16D1D0 8023E8F0 00000000 */  nop
/* 16D1D4 8023E8F4 45000002 */  bc1f      .L8023E900
/* 16D1D8 8023E8F8 E7A0001C */   swc1     $f0, 0x1C($sp)
/* 16D1DC 8023E8FC E7A2001C */  swc1      $f2, 0x1C($sp)
.L8023E900:
/* 16D1E0 8023E900 0808FA56 */  j         .L8023E958
/* 16D1E4 8023E904 8FA5001C */   lw       $a1, 0x1C($sp)
.L8023E908:
/* 16D1E8 8023E908 04410015 */  bgez      $v0, .L8023E960
/* 16D1EC 8023E90C 00000000 */   nop
/* 16D1F0 8023E910 C7A2001C */  lwc1      $f2, 0x1C($sp)
/* 16D1F4 8023E914 3C014120 */  lui       $at, (0x41200000 >> 16)
/* 16D1F8 8023E918 44810000 */  mtc1      $at, $f0
/* 16D1FC 8023E91C 00000000 */  nop
/* 16D200 8023E920 46001081 */  sub.s     $f2, $f2, $f0
/* 16D204 8023E924 44800000 */  mtc1      $zero, $f0
/* 16D208 8023E928 00000000 */  nop
/* 16D20C 8023E92C 4600103C */  c.lt.s    $f2, $f0
/* 16D210 8023E930 00000000 */  nop
/* 16D214 8023E934 45000007 */  bc1f      .L8023E954
/* 16D218 8023E938 E7A2001C */   swc1     $f2, 0x1C($sp)
/* 16D21C 8023E93C 3C05BF80 */  lui       $a1, (0xBF800000 >> 16)
/* 16D220 8023E940 240400FF */  addiu     $a0, $zero, 0xFF
/* 16D224 8023E944 0C04DF69 */  jal       set_screen_overlay_params_back
/* 16D228 8023E948 E7A0001C */   swc1     $f0, 0x1C($sp)
/* 16D22C 8023E94C 0808FA58 */  j         .L8023E960
/* 16D230 8023E950 A2000432 */   sb       $zero, 0x432($s0)
.L8023E954:
/* 16D234 8023E954 44051000 */  mfc1      $a1, $f2
.L8023E958:
/* 16D238 8023E958 0C04DF69 */  jal       set_screen_overlay_params_back
/* 16D23C 8023E95C 0000202D */   daddu    $a0, $zero, $zero
.L8023E960:
/* 16D240 8023E960 16200005 */  bnez      $s1, .L8023E978
/* 16D244 8023E964 2402FFFF */   addiu    $v0, $zero, -0x1
/* 16D248 8023E968 3C038028 */  lui       $v1, %hi(D_802809F6)
/* 16D24C 8023E96C 846309F6 */  lh        $v1, %lo(D_802809F6)($v1)
/* 16D250 8023E970 1062003C */  beq       $v1, $v0, .L8023EA64
/* 16D254 8023E974 00000000 */   nop
.L8023E978:
/* 16D258 8023E978 3C108028 */  lui       $s0, %hi(D_802809F6)
/* 16D25C 8023E97C 261009F6 */  addiu     $s0, $s0, %lo(D_802809F6)
/* 16D260 8023E980 2402FFFF */  addiu     $v0, $zero, -0x1
/* 16D264 8023E984 86040000 */  lh        $a0, 0x0($s0)
/* 16D268 8023E988 96030000 */  lhu       $v1, 0x0($s0)
/* 16D26C 8023E98C 14820014 */  bne       $a0, $v0, .L8023E9E0
/* 16D270 8023E990 240500FF */   addiu    $a1, $zero, 0xFF
/* 16D274 8023E994 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 16D278 8023E998 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 16D27C 8023E99C 80430071 */  lb        $v1, 0x71($v0)
/* 16D280 8023E9A0 24020002 */  addiu     $v0, $zero, 0x2
/* 16D284 8023E9A4 1462002F */  bne       $v1, $v0, .L8023EA64
/* 16D288 8023E9A8 27A50020 */   addiu    $a1, $sp, 0x20
/* 16D28C 8023E9AC 0000202D */  daddu     $a0, $zero, $zero
/* 16D290 8023E9B0 0C04DF70 */  jal       get_screen_overlay_params
/* 16D294 8023E9B4 27A60024 */   addiu    $a2, $sp, 0x24
/* 16D298 8023E9B8 93A30020 */  lbu       $v1, 0x20($sp)
/* 16D29C 8023E9BC 240200FF */  addiu     $v0, $zero, 0xFF
/* 16D2A0 8023E9C0 14620028 */  bne       $v1, $v0, .L8023EA64
/* 16D2A4 8023E9C4 00000000 */   nop
/* 16D2A8 8023E9C8 A6000000 */  sh        $zero, 0x0($s0)
/* 16D2AC 8023E9CC 0000202D */  daddu     $a0, $zero, $zero
/* 16D2B0 8023E9D0 0C04DF62 */  jal       set_screen_overlay_params_front
/* 16D2B4 8023E9D4 0000282D */   daddu    $a1, $zero, $zero
/* 16D2B8 8023E9D8 0808FA99 */  j         .L8023EA64
/* 16D2BC 8023E9DC 00000000 */   nop
.L8023E9E0:
/* 16D2C0 8023E9E0 1485000A */  bne       $a0, $a1, .L8023EA0C
/* 16D2C4 8023E9E4 2462000A */   addiu    $v0, $v1, 0xA
/* 16D2C8 8023E9E8 3C03800E */  lui       $v1, %hi(gBattleState)
/* 16D2CC 8023E9EC 8C63C068 */  lw        $v1, %lo(gBattleState)($v1)
/* 16D2D0 8023E9F0 24020023 */  addiu     $v0, $zero, 0x23
/* 16D2D4 8023E9F4 1062001B */  beq       $v1, $v0, .L8023EA64
/* 16D2D8 8023E9F8 00000000 */   nop
/* 16D2DC 8023E9FC 0C090464 */  jal       func_80241190
/* 16D2E0 8023EA00 0040202D */   daddu    $a0, $v0, $zero
/* 16D2E4 8023EA04 0808FA99 */  j         .L8023EA64
/* 16D2E8 8023EA08 00000000 */   nop
.L8023EA0C:
/* 16D2EC 8023EA0C A6020000 */  sh        $v0, 0x0($s0)
/* 16D2F0 8023EA10 00021400 */  sll       $v0, $v0, 16
/* 16D2F4 8023EA14 00021403 */  sra       $v0, $v0, 16
/* 16D2F8 8023EA18 28420100 */  slti      $v0, $v0, 0x100
/* 16D2FC 8023EA1C 50400001 */  beql      $v0, $zero, .L8023EA24
/* 16D300 8023EA20 A6050000 */   sh       $a1, 0x0($s0)
.L8023EA24:
/* 16D304 8023EA24 86020000 */  lh        $v0, 0x0($s0)
/* 16D308 8023EA28 44822000 */  mtc1      $v0, $f4
/* 16D30C 8023EA2C 00000000 */  nop
/* 16D310 8023EA30 46802120 */  cvt.s.w   $f4, $f4
/* 16D314 8023EA34 44052000 */  mfc1      $a1, $f4
/* 16D318 8023EA38 0C04DF62 */  jal       set_screen_overlay_params_front
/* 16D31C 8023EA3C 0000202D */   daddu    $a0, $zero, $zero
/* 16D320 8023EA40 0000202D */  daddu     $a0, $zero, $zero
/* 16D324 8023EA44 240500D0 */  addiu     $a1, $zero, 0xD0
/* 16D328 8023EA48 00A0302D */  daddu     $a2, $a1, $zero
/* 16D32C 8023EA4C 0C04DF84 */  jal       set_screen_overlay_color
/* 16D330 8023EA50 00A0382D */   daddu    $a3, $a1, $zero
/* 16D334 8023EA54 0C00CDF4 */  jal       intro_logos_set_fade_alpha
/* 16D338 8023EA58 240400FF */   addiu    $a0, $zero, 0xFF
/* 16D33C 8023EA5C 0C00CDF8 */  jal       intro_logos_set_fade_color
/* 16D340 8023EA60 240400E0 */   addiu    $a0, $zero, 0xE0
glabel .L8023EA64
/* 16D344 8023EA64 8FBF0034 */  lw        $ra, 0x34($sp)
/* 16D348 8023EA68 8FB20030 */  lw        $s2, 0x30($sp)
/* 16D34C 8023EA6C 8FB1002C */  lw        $s1, 0x2C($sp)
/* 16D350 8023EA70 8FB00028 */  lw        $s0, 0x28($sp)
/* 16D354 8023EA74 03E00008 */  jr        $ra
/* 16D358 8023EA78 27BD0038 */   addiu    $sp, $sp, 0x38

### DECOMPILED C INSTRUCTIONS:

void btl_update(void) {
    BattleStatus* battleStatus = &gBattleStatus;
    PlayerData* playerData = &gPlayerData;
    Actor* partner = battleStatus->partnerActor;
    f32 dpadAngle;
    f32 dpadMagnitude;
    s32 cond;

    if (battleStatus->inputBitmask != -1) {
        if ((battleStatus->flags1 & BS_FLAGS1_PARTNER_ACTING) && gGameStatusPtr->multiplayerEnabled != 0) {
            s32 inputBitmask = battleStatus->inputBitmask;

            battleStatus->currentButtonsDown = gGameStatusPtr->currentButtons[1] & inputBitmask;
            battleStatus->currentButtonsPressed = gGameStatusPtr->pressedButtons[1] & inputBitmask;
            battleStatus->currentButtonsHeld = gGameStatusPtr->heldButtons[1] & inputBitmask;
            battleStatus->stickX = gGameStatusPtr->stickX[1];
            battleStatus->stickY = gGameStatusPtr->stickY[1];
        } else {
            s32 inputBitmask2 = battleStatus->inputBitmask;

            battleStatus->currentButtonsDown = gGameStatusPtr->currentButtons[0] & inputBitmask2;
            battleStatus->currentButtonsPressed = gGameStatusPtr->pressedButtons[0] & inputBitmask2;
            battleStatus->currentButtonsHeld = gGameStatusPtr->heldButtons[0] & inputBitmask2;
            battleStatus->stickX = gGameStatusPtr->stickX[0];
            battleStatus->stickY = gGameStatusPtr->stickY[0];
        }
    }

    get_dpad_input_radial(&dpadAngle, &dpadMagnitude);
    battleStatus->dpadX = dpadAngle;
    battleStatus->dpadY = dpadMagnitude;
    battleStatus->pushInputBuffer[battleStatus->inputBufferPos] = battleStatus->currentButtonsPressed;
    battleStatus->holdInputBuffer[battleStatus->inputBufferPos] = battleStatus->currentButtonsDown;

    battleStatus->inputBufferPos++;
    if (battleStatus->inputBufferPos >= ARRAY_COUNT(battleStatus->pushInputBuffer)) {
        battleStatus->inputBufferPos = 0;
    }

    if (battleStatus->preUpdateCallback != NULL) {
        battleStatus->preUpdateCallback();
    }

    cond = TRUE;
    if (battleStatus->unk_95 == 0 || battleStatus->unk_95 != gBattleState) {
        switch (gBattleState) {
            case BATTLE_STATE_NEGATIVE_1:
            case BATTLE_STATE_0:
                return;
            case BATTLE_STATE_NORMAL_START:
                btl_state_update_normal_start();
                cond = FALSE;
                break;
            case BATTLE_STATE_BEGIN_PLAYER_TURN:
                btl_state_update_begin_player_turn();
                break;
            case BATTLE_STATE_BEGIN_PARTNER_TURN:
                btl_state_update_begin_partner_turn();
                break;
            case BATTLE_STATE_9:
                btl_state_update_9();
                break;
            case BATTLE_STATE_BEGIN_TURN:
                btl_state_update_begin_turn();
                break;
            case BATTLE_STATE_END_TURN:
                btl_state_update_end_turn();
                break;
            case BATTLE_STATE_SWITCH_TO_PLAYER:
                btl_state_update_switch_to_player();
                break;
            case BATTLE_STATE_SWITCH_TO_PARTNER:
                btl_state_update_switch_to_partner();
                break;
            case BATTLE_STATE_PREPARE_MENU:
                btl_state_update_prepare_menu();
                break;
            case BATTLE_STATE_PLAYER_MENU:
                btl_state_update_player_menu();
                break;
            case BATTLE_STATE_PARTNER_MENU:
                btl_state_update_partner_menu();
                break;
            case BATTLE_STATE_TWINK_MENU:
                btl_state_update_twink_menu();
                break;
            case BATTLE_STATE_PEACH_MENU:
                btl_state_update_peach_menu();
                break;
            case BATTLE_STATE_SELECT_TARGET:
                btl_state_update_select_target();
                break;
            case BATTLE_STATE_PLAYER_MOVE:
                btl_state_update_player_move();
                break;
            case BATTLE_STATE_FIRST_STRIKE:
                btl_state_update_first_strike();
                break;
            case BATTLE_STATE_END_PLAYER_TURN:
                btl_state_update_end_player_turn();
                break;
            case BATTLE_STATE_END_PARTNER_TURN:
                btl_state_update_end_partner_turn();
                break;
            case BATTLE_STATE_ENEMY_MOVE:
                btl_state_update_enemy_move();
                break;
            case BATTLE_STATE_PARTNER_FIRST_STRIKE:
                btl_state_update_partner_striking_first();
                break;
            case BATTLE_STATE_NEXT_ENEMY:
                btl_state_update_next_enemy();
                break;
            case BATTLE_STATE_PARTNER_MOVE:
                btl_state_update_partner_move();
                break;
            case BATTLE_STATE_VICTORY:
                btl_state_update_victory();
                break;
            case BATTLE_STATE_END_BATTLE:
                btl_state_update_end_battle();
                break;
            case BATTLE_STATE_CHANGE_PARTNER:
                btl_state_update_change_partner();
                break;
            case BATTLE_STATE_RUN_AWAY:
                btl_state_update_run_away();
                break;
            case BATTLE_STATE_DEFEND:
                btl_state_update_defend();
                break;
            case BATTLE_STATE_DEFEAT:
                btl_state_update_defeat();
                break;
            case BATTLE_STATE_28:
                btl_state_update_1C();
                break;
            case BATTLE_STATE_END_TRAINING_BATTLE:
                btl_state_update_end_training_battle();
                break;
            case BATTLE_STATE_ENEMY_FIRST_STRIKE:
                btl_state_update_enemy_striking_first();
                break;
            case BATTLE_STATE_34:
                btl_state_update_22();
                break;
            case BATTLE_STATE_CELEBRATION:
                btl_state_update_celebration();
                break;
            case BATTLE_STATE_END_DEMO_BATTLE:
                btl_state_update_end_demo_battle();
                cond = FALSE;
                break;
        }
    }

    battleStatus->unk_90++;
    if (battleStatus->unk_90 == 40) {
        btl_bonk_cleanup();
    }

    update_damage_popups();
    update_action_ratings();
    update_health_bars();
    btl_popup_messages_update();
    update_actor_shadows();

    if (battleStatus->darknessMode != BTL_DARKNESS_STATE_LOCKED) {
        u8 paramType;
        f32 paramAmount;

        get_screen_overlay_params(SCREEN_LAYER_BACK, &paramType, &paramAmount);

        if (battleStatus->darknessMode > BTL_DARKNESS_STATE_NONE) {
            set_screen_overlay_color(SCREEN_LAYER_BACK, 0, 0, 0);
            if (partner == NULL) {
                set_screen_overlay_params_back(OVERLAY_SCREEN_COLOR, 215.0f);
            } else if (playerData->currentPartner == PARTNER_WATT) {
                paramAmount -= 10.0f;
                if (paramAmount < 0.0f) {
                    paramAmount = 0.0f;
                }
                set_screen_overlay_params_back(OVERLAY_SCREEN_COLOR, paramAmount);
            } else {
                paramAmount += 10.0f;
                if (paramAmount > 215.0f) {
                    paramAmount = 215.0f;
                }
                set_screen_overlay_params_back(OVERLAY_SCREEN_COLOR, paramAmount);
            }
        } else if (battleStatus->darknessMode < BTL_DARKNESS_STATE_NONE) {
            paramAmount -= 10.0f;
            if (paramAmount < 0.0f) {
                paramAmount = 0.0f;
                set_screen_overlay_params_back(OVERLAY_NONE, -1.0f);
                battleStatus->darknessMode = BTL_DARKNESS_STATE_NONE;
            } else {
                set_screen_overlay_params_back(OVERLAY_SCREEN_COLOR, paramAmount);
            }
        }

        if (cond || D_802809F6 != -1) {
            if (D_802809F6 == -1) {
                if (gGameStatusPtr->demoState == DEMO_STATE_CHANGE_MAP) {
                    u8 paramType;
                    f32 paramAmount;

                    get_screen_overlay_params(SCREEN_LAYER_FRONT, &paramType, &paramAmount);
                    if (paramType == (u8) OVERLAY_NONE) {
                        D_802809F6 = 0;
                        set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, 0.0f);
                    }
                }
            } else if (D_802809F6 == 255) {
                if (gBattleState != BATTLE_STATE_END_DEMO_BATTLE) {
                    btl_set_state(BATTLE_STATE_END_DEMO_BATTLE);
                }
            } else {
                D_802809F6 += 10;
                if (D_802809F6 > 255) {
                    D_802809F6 = 255;
                }

                set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, D_802809F6);
                set_screen_overlay_color(SCREEN_LAYER_FRONT, 208, 208, 208);
                intro_logos_set_fade_alpha(255);
                intro_logos_set_fade_color(224);
            }
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel is_point_visible
/* B36BC 8011CFBC 44860000 */  mtc1      $a2, $f0
/* B36C0 8011CFC0 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* B36C4 8011CFC4 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* B36C8 8011CFC8 27BDFF88 */  addiu     $sp, $sp, -0x78
/* B36CC 8011CFCC AFB00040 */  sw        $s0, 0x40($sp)
/* B36D0 8011CFD0 8FB00088 */  lw        $s0, 0x88($sp)
/* B36D4 8011CFD4 AFB10044 */  sw        $s1, 0x44($sp)
/* B36D8 8011CFD8 8FB1008C */  lw        $s1, 0x8C($sp)
/* B36DC 8011CFDC 3C04800B */  lui       $a0, %hi(gCameras)
/* B36E0 8011CFE0 24841D80 */  addiu     $a0, $a0, %lo(gCameras)
/* B36E4 8011CFE4 AFBF0064 */  sw        $ra, 0x64($sp)
/* B36E8 8011CFE8 AFBE0060 */  sw        $fp, 0x60($sp)
/* B36EC 8011CFEC AFB7005C */  sw        $s7, 0x5C($sp)
/* B36F0 8011CFF0 AFB60058 */  sw        $s6, 0x58($sp)
/* B36F4 8011CFF4 AFB50054 */  sw        $s5, 0x54($sp)
/* B36F8 8011CFF8 AFB40050 */  sw        $s4, 0x50($sp)
/* B36FC 8011CFFC AFB3004C */  sw        $s3, 0x4C($sp)
/* B3700 8011D000 AFB20048 */  sw        $s2, 0x48($sp)
/* B3704 8011D004 F7B60070 */  sdc1      $f22, 0x70($sp)
/* B3708 8011D008 F7B40068 */  sdc1      $f20, 0x68($sp)
/* B370C 8011D00C 00031080 */  sll       $v0, $v1, 2
/* B3710 8011D010 00431021 */  addu      $v0, $v0, $v1
/* B3714 8011D014 00021080 */  sll       $v0, $v0, 2
/* B3718 8011D018 00431023 */  subu      $v0, $v0, $v1
/* B371C 8011D01C 000218C0 */  sll       $v1, $v0, 3
/* B3720 8011D020 00431021 */  addu      $v0, $v0, $v1
/* B3724 8011D024 000210C0 */  sll       $v0, $v0, 3
/* B3728 8011D028 0044F021 */  addu      $fp, $v0, $a0
/* B372C 8011D02C 28E20010 */  slti      $v0, $a3, 0x10
/* B3730 8011D030 104001AF */  beqz      $v0, .L8011D6F0
/* B3734 8011D034 AFA70084 */   sw       $a3, 0x84($sp)
/* B3738 8011D038 27C400D4 */  addiu     $a0, $fp, 0xD4
/* B373C 8011D03C 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* B3740 8011D040 4481A000 */  mtc1      $at, $f20
/* B3744 8011D044 44056000 */  mfc1      $a1, $f12
/* B3748 8011D048 44067000 */  mfc1      $a2, $f14
/* B374C 8011D04C 44070000 */  mfc1      $a3, $f0
/* B3750 8011D050 27A20028 */  addiu     $v0, $sp, 0x28
/* B3754 8011D054 AFA20014 */  sw        $v0, 0x14($sp)
/* B3758 8011D058 27A2002C */  addiu     $v0, $sp, 0x2C
/* B375C 8011D05C AFA20018 */  sw        $v0, 0x18($sp)
/* B3760 8011D060 27A20030 */  addiu     $v0, $sp, 0x30
/* B3764 8011D064 AFA2001C */  sw        $v0, 0x1C($sp)
/* B3768 8011D068 27A20034 */  addiu     $v0, $sp, 0x34
/* B376C 8011D06C AFA20020 */  sw        $v0, 0x20($sp)
/* B3770 8011D070 0C00A588 */  jal       transform_point
/* B3774 8011D074 E7B40010 */   swc1     $f20, 0x10($sp)
/* B3778 8011D078 C7A00034 */  lwc1      $f0, 0x34($sp)
/* B377C 8011D07C 44809000 */  mtc1      $zero, $f18
/* B3780 8011D080 00000000 */  nop
/* B3784 8011D084 46120032 */  c.eq.s    $f0, $f18
/* B3788 8011D088 00000000 */  nop
/* B378C 8011D08C 45000004 */  bc1f      .L8011D0A0
/* B3790 8011D090 24020001 */   addiu    $v0, $zero, 0x1
/* B3794 8011D094 E6120000 */  swc1      $f18, 0x0($s0)
/* B3798 8011D098 080475BD */  j         .L8011D6F4
/* B379C 8011D09C E6320000 */   swc1     $f18, 0x0($s1)
.L8011D0A0:
/* B37A0 8011D0A0 C7AC0030 */  lwc1      $f12, 0x30($sp)
/* B37A4 8011D0A4 4600A383 */  div.s     $f14, $f20, $f0
/* B37A8 8011D0A8 460E6302 */  mul.s     $f12, $f12, $f14
/* B37AC 8011D0AC 00000000 */  nop
/* B37B0 8011D0B0 46146080 */  add.s     $f2, $f12, $f20
/* B37B4 8011D0B4 3C013FE0 */  lui       $at, (0x3FE00000 >> 16)
/* B37B8 8011D0B8 44814800 */  mtc1      $at, $f9
/* B37BC 8011D0BC 44804000 */  mtc1      $zero, $f8
/* B37C0 8011D0C0 460010A1 */  cvt.d.s   $f2, $f2
/* B37C4 8011D0C4 46281082 */  mul.d     $f2, $f2, $f8
/* B37C8 8011D0C8 00000000 */  nop
/* B37CC 8011D0CC C7B00028 */  lwc1      $f16, 0x28($sp)
/* B37D0 8011D0D0 460E8402 */  mul.s     $f16, $f16, $f14
/* B37D4 8011D0D4 00000000 */  nop
/* B37D8 8011D0D8 87C2000A */  lh        $v0, 0xA($fp)
/* B37DC 8011D0DC 44820000 */  mtc1      $v0, $f0
/* B37E0 8011D0E0 00000000 */  nop
/* B37E4 8011D0E4 46800020 */  cvt.s.w   $f0, $f0
/* B37E8 8011D0E8 46008102 */  mul.s     $f4, $f16, $f0
/* B37EC 8011D0EC 00000000 */  nop
/* B37F0 8011D0F0 46002100 */  add.s     $f4, $f4, $f0
/* B37F4 8011D0F4 46002121 */  cvt.d.s   $f4, $f4
/* B37F8 8011D0F8 46282102 */  mul.d     $f4, $f4, $f8
/* B37FC 8011D0FC 00000000 */  nop
/* B3800 8011D100 C7A6002C */  lwc1      $f6, 0x2C($sp)
/* B3804 8011D104 46007007 */  neg.s     $f0, $f14
/* B3808 8011D108 46003182 */  mul.s     $f6, $f6, $f0
/* B380C 8011D10C 00000000 */  nop
/* B3810 8011D110 87C2000C */  lh        $v0, 0xC($fp)
/* B3814 8011D114 44825000 */  mtc1      $v0, $f10
/* B3818 8011D118 00000000 */  nop
/* B381C 8011D11C 468052A0 */  cvt.s.w   $f10, $f10
/* B3820 8011D120 460A3002 */  mul.s     $f0, $f6, $f10
/* B3824 8011D124 00000000 */  nop
/* B3828 8011D128 E7AE0034 */  swc1      $f14, 0x34($sp)
/* B382C 8011D12C E7B00028 */  swc1      $f16, 0x28($sp)
/* B3830 8011D130 E7AC0030 */  swc1      $f12, 0x30($sp)
/* B3834 8011D134 460A0000 */  add.s     $f0, $f0, $f10
/* B3838 8011D138 E7A6002C */  swc1      $f6, 0x2C($sp)
/* B383C 8011D13C 462010A0 */  cvt.s.d   $f2, $f2
/* B3840 8011D140 46000021 */  cvt.d.s   $f0, $f0
/* B3844 8011D144 46280002 */  mul.d     $f0, $f0, $f8
/* B3848 8011D148 00000000 */  nop
/* B384C 8011D14C E7A20030 */  swc1      $f2, 0x30($sp)
/* B3850 8011D150 87C2000E */  lh        $v0, 0xE($fp)
/* B3854 8011D154 44821000 */  mtc1      $v0, $f2
/* B3858 8011D158 00000000 */  nop
/* B385C 8011D15C 468010A0 */  cvt.s.w   $f2, $f2
/* B3860 8011D160 46202120 */  cvt.s.d   $f4, $f4
/* B3864 8011D164 E7A40028 */  swc1      $f4, 0x28($sp)
/* B3868 8011D168 87C20010 */  lh        $v0, 0x10($fp)
/* B386C 8011D16C 46022100 */  add.s     $f4, $f4, $f2
/* B3870 8011D170 44821000 */  mtc1      $v0, $f2
/* B3874 8011D174 00000000 */  nop
/* B3878 8011D178 468010A0 */  cvt.s.w   $f2, $f2
/* B387C 8011D17C 46200020 */  cvt.s.d   $f0, $f0
/* B3880 8011D180 46020080 */  add.s     $f2, $f0, $f2
/* B3884 8011D184 E7A40028 */  swc1      $f4, 0x28($sp)
/* B3888 8011D188 E7A0002C */  swc1      $f0, 0x2C($sp)
/* B388C 8011D18C E7A2002C */  swc1      $f2, 0x2C($sp)
/* B3890 8011D190 E6040000 */  swc1      $f4, 0x0($s0)
/* B3894 8011D194 C7A0002C */  lwc1      $f0, 0x2C($sp)
/* B3898 8011D198 E6200000 */  swc1      $f0, 0x0($s1)
/* B389C 8011D19C 8FA80084 */  lw        $t0, 0x84($sp)
/* B38A0 8011D1A0 05010005 */  bgez      $t0, .L8011D1B8
/* B38A4 8011D1A4 24020001 */   addiu    $v0, $zero, 0x1
/* B38A8 8011D1A8 C7A00030 */  lwc1      $f0, 0x30($sp)
/* B38AC 8011D1AC 4600903C */  c.lt.s    $f18, $f0
/* B38B0 8011D1B0 080475BA */  j         .L8011D6E8
/* B38B4 8011D1B4 00000000 */   nop
.L8011D1B8:
/* B38B8 8011D1B8 C7A40028 */  lwc1      $f4, 0x28($sp)
/* B38BC 8011D1BC 4604903E */  c.le.s    $f18, $f4
/* B38C0 8011D1C0 00000000 */  nop
/* B38C4 8011D1C4 45000143 */  bc1f      .L8011D6D4
/* B38C8 8011D1C8 00000000 */   nop
/* B38CC 8011D1CC C7A2002C */  lwc1      $f2, 0x2C($sp)
/* B38D0 8011D1D0 4602903E */  c.le.s    $f18, $f2
/* B38D4 8011D1D4 00000000 */  nop
/* B38D8 8011D1D8 4500013E */  bc1f      .L8011D6D4
/* B38DC 8011D1DC 00000000 */   nop
/* B38E0 8011D1E0 3C0143A0 */  lui       $at, (0x43A00000 >> 16)
/* B38E4 8011D1E4 44810000 */  mtc1      $at, $f0
/* B38E8 8011D1E8 00000000 */  nop
/* B38EC 8011D1EC 4600203C */  c.lt.s    $f4, $f0
/* B38F0 8011D1F0 00000000 */  nop
/* B38F4 8011D1F4 45000137 */  bc1f      .L8011D6D4
/* B38F8 8011D1F8 00000000 */   nop
/* B38FC 8011D1FC 3C014370 */  lui       $at, (0x43700000 >> 16)
/* B3900 8011D200 44810000 */  mtc1      $at, $f0
/* B3904 8011D204 00000000 */  nop
/* B3908 8011D208 4600103C */  c.lt.s    $f2, $f0
/* B390C 8011D20C 00000000 */  nop
/* B3910 8011D210 45000130 */  bc1f      .L8011D6D4
/* B3914 8011D214 3C05FD10 */   lui      $a1, (0xFD10013F >> 16)
/* B3918 8011D218 3C11800A */  lui       $s1, %hi(gMainGfxPos)
/* B391C 8011D21C 2631A66C */  addiu     $s1, $s1, %lo(gMainGfxPos)
/* B3920 8011D220 34A5013F */  ori       $a1, $a1, (0xFD10013F & 0xFFFF)
/* B3924 8011D224 4600158D */  trunc.w.s $f22, $f2
/* B3928 8011D228 4402B000 */  mfc1      $v0, $f22
/* B392C 8011D22C 00000000 */  nop
/* B3930 8011D230 00022080 */  sll       $a0, $v0, 2
/* B3934 8011D234 00822021 */  addu      $a0, $a0, $v0
/* B3938 8011D238 000421C0 */  sll       $a0, $a0, 7
/* B393C 8011D23C 3C13E700 */  lui       $s3, (0xE7000000 >> 16)
/* B3940 8011D240 8E320000 */  lw        $s2, 0x0($s1)
/* B3944 8011D244 3C02800A */  lui       $v0, %hi(nuGfxZBuffer)
/* B3948 8011D248 8C42A5DC */  lw        $v0, %lo(nuGfxZBuffer)($v0)
/* B394C 8011D24C 0240182D */  daddu     $v1, $s2, $zero
/* B3950 8011D250 26520008 */  addiu     $s2, $s2, 0x8
/* B3954 8011D254 00442021 */  addu      $a0, $v0, $a0
/* B3958 8011D258 26420008 */  addiu     $v0, $s2, 0x8
/* B395C 8011D25C AE320000 */  sw        $s2, 0x0($s1)
/* B3960 8011D260 AC730000 */  sw        $s3, 0x0($v1)
/* B3964 8011D264 AC600004 */  sw        $zero, 0x4($v1)
/* B3968 8011D268 AE220000 */  sw        $v0, 0x0($s1)
/* B396C 8011D26C 0C0187A4 */  jal       osVirtualToPhysical
/* B3970 8011D270 AE450000 */   sw       $a1, 0x0($s2)
/* B3974 8011D274 3C06F510 */  lui       $a2, (0xF5100200 >> 16)
/* B3978 8011D278 34C60200 */  ori       $a2, $a2, (0xF5100200 & 0xFFFF)
/* B397C 8011D27C 3C030700 */  lui       $v1, (0x7000090 >> 16)
/* B3980 8011D280 34630090 */  ori       $v1, $v1, (0x7000090 & 0xFFFF)
/* B3984 8011D284 3C18FF10 */  lui       $t8, (0xFF10013F >> 16)
/* B3988 8011D288 3718013F */  ori       $t8, $t8, (0xFF10013F & 0xFFFF)
/* B398C 8011D28C 3C07E300 */  lui       $a3, (0xE3000A01 >> 16)
/* B3990 8011D290 34E70A01 */  ori       $a3, $a3, (0xE3000A01 & 0xFFFF)
/* B3994 8011D294 3C0AE200 */  lui       $t2, (0xE200001C >> 16)
/* B3998 8011D298 354A001C */  ori       $t2, $t2, (0xE200001C & 0xFFFF)
/* B399C 8011D29C 3C080F0A */  lui       $t0, (0xF0A4000 >> 16)
/* B39A0 8011D2A0 35084000 */  ori       $t0, $t0, (0xF0A4000 & 0xFFFF)
/* B39A4 8011D2A4 3C0BFCFF */  lui       $t3, (0xFCFFFFFF >> 16)
/* B39A8 8011D2A8 356BFFFF */  ori       $t3, $t3, (0xFCFFFFFF & 0xFFFF)
/* B39AC 8011D2AC 3C09FFFC */  lui       $t1, (0xFFFCF279 >> 16)
/* B39B0 8011D2B0 3529F279 */  ori       $t1, $t1, (0xFFFCF279 & 0xFFFF)
/* B39B4 8011D2B4 3C0CE300 */  lui       $t4, (0xE3001201 >> 16)
/* B39B8 8011D2B8 358C1201 */  ori       $t4, $t4, (0xE3001201 & 0xFFFF)
/* B39BC 8011D2BC 3C0DE300 */  lui       $t5, (0xE3000C00 >> 16)
/* B39C0 8011D2C0 35AD0C00 */  ori       $t5, $t5, (0xE3000C00 & 0xFFFF)
/* B39C4 8011D2C4 3C0ED700 */  lui       $t6, (0xD7000002 >> 16)
/* B39C8 8011D2C8 35CE0002 */  ori       $t6, $t6, (0xD7000002 & 0xFFFF)
/* B39CC 8011D2CC 3C0FE300 */  lui       $t7, (0xE3001001 >> 16)
/* B39D0 8011D2D0 35EF1001 */  ori       $t7, $t7, (0xE3001001 & 0xFFFF)
/* B39D4 8011D2D4 3C15E300 */  lui       $s5, (0xE3000D01 >> 16)
/* B39D8 8011D2D8 36B50D01 */  ori       $s5, $s5, (0xE3000D01 & 0xFFFF)
/* B39DC 8011D2DC 3C16E300 */  lui       $s6, (0xE3000F00 >> 16)
/* B39E0 8011D2E0 36D60F00 */  ori       $s6, $s6, (0xE3000F00 & 0xFFFF)
/* B39E4 8011D2E4 3C17E400 */  lui       $s7, (0xE4000004 >> 16)
/* B39E8 8011D2E8 36F70004 */  ori       $s7, $s7, (0xE4000004 & 0xFFFF)
/* B39EC 8011D2EC 3C190400 */  lui       $t9, (0x4000400 >> 16)
/* B39F0 8011D2F0 AFA80038 */  sw        $t0, 0x38($sp)
/* B39F4 8011D2F4 8E300000 */  lw        $s0, 0x0($s1)
/* B39F8 8011D2F8 3C148015 */  lui       $s4, %hi(depthCopyBuffer)
/* B39FC 8011D2FC 26943380 */  addiu     $s4, $s4, %lo(depthCopyBuffer)
/* B3A00 8011D300 AE420004 */  sw        $v0, 0x4($s2)
/* B3A04 8011D304 3C12ED00 */  lui       $s2, (0xED000000 >> 16)
/* B3A08 8011D308 37390400 */  ori       $t9, $t9, (0x4000400 & 0xFFFF)
/* B3A0C 8011D30C 0200102D */  daddu     $v0, $s0, $zero
/* B3A10 8011D310 26100008 */  addiu     $s0, $s0, 0x8
/* B3A14 8011D314 AE300000 */  sw        $s0, 0x0($s1)
/* B3A18 8011D318 AC460000 */  sw        $a2, 0x0($v0)
/* B3A1C 8011D31C AC430004 */  sw        $v1, 0x4($v0)
/* B3A20 8011D320 26020008 */  addiu     $v0, $s0, 0x8
/* B3A24 8011D324 AE220000 */  sw        $v0, 0x0($s1)
/* B3A28 8011D328 3C02E600 */  lui       $v0, (0xE6000000 >> 16)
/* B3A2C 8011D32C AE020000 */  sw        $v0, 0x0($s0)
/* B3A30 8011D330 AE000004 */  sw        $zero, 0x4($s0)
/* B3A34 8011D334 C7A00028 */  lwc1      $f0, 0x28($sp)
/* B3A38 8011D338 26020010 */  addiu     $v0, $s0, 0x10
/* B3A3C 8011D33C AE220000 */  sw        $v0, 0x0($s1)
/* B3A40 8011D340 3C02F400 */  lui       $v0, (0xF4000000 >> 16)
/* B3A44 8011D344 4600058D */  trunc.w.s $f22, $f0
/* B3A48 8011D348 4405B000 */  mfc1      $a1, $f22
/* B3A4C 8011D34C 00000000 */  nop
/* B3A50 8011D350 00052080 */  sll       $a0, $a1, 2
/* B3A54 8011D354 30840FFF */  andi      $a0, $a0, 0xFFF
/* B3A58 8011D358 00042300 */  sll       $a0, $a0, 12
/* B3A5C 8011D35C 00821025 */  or        $v0, $a0, $v0
/* B3A60 8011D360 24A30003 */  addiu     $v1, $a1, 0x3
/* B3A64 8011D364 00031880 */  sll       $v1, $v1, 2
/* B3A68 8011D368 30630FFF */  andi      $v1, $v1, 0xFFF
/* B3A6C 8011D36C 00031B00 */  sll       $v1, $v1, 12
/* B3A70 8011D370 AE020008 */  sw        $v0, 0x8($s0)
/* B3A74 8011D374 3C020700 */  lui       $v0, (0x7000000 >> 16)
/* B3A78 8011D378 00621025 */  or        $v0, $v1, $v0
/* B3A7C 8011D37C AE02000C */  sw        $v0, 0xC($s0)
/* B3A80 8011D380 26020018 */  addiu     $v0, $s0, 0x18
/* B3A84 8011D384 AE220000 */  sw        $v0, 0x0($s1)
/* B3A88 8011D388 26020020 */  addiu     $v0, $s0, 0x20
/* B3A8C 8011D38C AE130010 */  sw        $s3, 0x10($s0)
/* B3A90 8011D390 AE000014 */  sw        $zero, 0x14($s0)
/* B3A94 8011D394 AE220000 */  sw        $v0, 0x0($s1)
/* B3A98 8011D398 24020090 */  addiu     $v0, $zero, 0x90
/* B3A9C 8011D39C AE02001C */  sw        $v0, 0x1C($s0)
/* B3AA0 8011D3A0 26020028 */  addiu     $v0, $s0, 0x28
/* B3AA4 8011D3A4 AE060018 */  sw        $a2, 0x18($s0)
/* B3AA8 8011D3A8 AE220000 */  sw        $v0, 0x0($s1)
/* B3AAC 8011D3AC 3C02F200 */  lui       $v0, (0xF2000000 >> 16)
/* B3AB0 8011D3B0 00822025 */  or        $a0, $a0, $v0
/* B3AB4 8011D3B4 26020030 */  addiu     $v0, $s0, 0x30
/* B3AB8 8011D3B8 AE040020 */  sw        $a0, 0x20($s0)
/* B3ABC 8011D3BC AE030024 */  sw        $v1, 0x24($s0)
/* B3AC0 8011D3C0 AE220000 */  sw        $v0, 0x0($s1)
/* B3AC4 8011D3C4 26020038 */  addiu     $v0, $s0, 0x38
/* B3AC8 8011D3C8 AE130028 */  sw        $s3, 0x28($s0)
/* B3ACC 8011D3CC AE00002C */  sw        $zero, 0x2C($s0)
/* B3AD0 8011D3D0 AE220000 */  sw        $v0, 0x0($s1)
/* B3AD4 8011D3D4 26020040 */  addiu     $v0, $s0, 0x40
/* B3AD8 8011D3D8 AE180030 */  sw        $t8, 0x30($s0)
/* B3ADC 8011D3DC AE140034 */  sw        $s4, 0x34($s0)
/* B3AE0 8011D3E0 AE220000 */  sw        $v0, 0x0($s1)
/* B3AE4 8011D3E4 26020048 */  addiu     $v0, $s0, 0x48
/* B3AE8 8011D3E8 AE130038 */  sw        $s3, 0x38($s0)
/* B3AEC 8011D3EC AE00003C */  sw        $zero, 0x3C($s0)
/* B3AF0 8011D3F0 AE220000 */  sw        $v0, 0x0($s1)
/* B3AF4 8011D3F4 26020050 */  addiu     $v0, $s0, 0x50
/* B3AF8 8011D3F8 AE070040 */  sw        $a3, 0x40($s0)
/* B3AFC 8011D3FC AE000044 */  sw        $zero, 0x44($s0)
/* B3B00 8011D400 AE220000 */  sw        $v0, 0x0($s1)
/* B3B04 8011D404 AE0A0048 */  sw        $t2, 0x48($s0)
/* B3B08 8011D408 8FA80038 */  lw        $t0, 0x38($sp)
/* B3B0C 8011D40C 26020058 */  addiu     $v0, $s0, 0x58
/* B3B10 8011D410 AE08004C */  sw        $t0, 0x4C($s0)
/* B3B14 8011D414 AE220000 */  sw        $v0, 0x0($s1)
/* B3B18 8011D418 26020060 */  addiu     $v0, $s0, 0x60
/* B3B1C 8011D41C AE0B0050 */  sw        $t3, 0x50($s0)
/* B3B20 8011D420 AE090054 */  sw        $t1, 0x54($s0)
/* B3B24 8011D424 AE220000 */  sw        $v0, 0x0($s1)
/* B3B28 8011D428 26020068 */  addiu     $v0, $s0, 0x68
/* B3B2C 8011D42C AE0C0058 */  sw        $t4, 0x58($s0)
/* B3B30 8011D430 AE00005C */  sw        $zero, 0x5C($s0)
/* B3B34 8011D434 AE220000 */  sw        $v0, 0x0($s1)
/* B3B38 8011D438 26020070 */  addiu     $v0, $s0, 0x70
/* B3B3C 8011D43C AE0D0060 */  sw        $t5, 0x60($s0)
/* B3B40 8011D440 AE000064 */  sw        $zero, 0x64($s0)
/* B3B44 8011D444 AE220000 */  sw        $v0, 0x0($s1)
/* B3B48 8011D448 2402FFFF */  addiu     $v0, $zero, -0x1
/* B3B4C 8011D44C AE02006C */  sw        $v0, 0x6C($s0)
/* B3B50 8011D450 26020078 */  addiu     $v0, $s0, 0x78
/* B3B54 8011D454 AE0E0068 */  sw        $t6, 0x68($s0)
/* B3B58 8011D458 AE220000 */  sw        $v0, 0x0($s1)
/* B3B5C 8011D45C 26020080 */  addiu     $v0, $s0, 0x80
/* B3B60 8011D460 AE0F0070 */  sw        $t7, 0x70($s0)
/* B3B64 8011D464 AE000074 */  sw        $zero, 0x74($s0)
/* B3B68 8011D468 AE220000 */  sw        $v0, 0x0($s1)
/* B3B6C 8011D46C 26020088 */  addiu     $v0, $s0, 0x88
/* B3B70 8011D470 AE150078 */  sw        $s5, 0x78($s0)
/* B3B74 8011D474 AE00007C */  sw        $zero, 0x7C($s0)
/* B3B78 8011D478 AE220000 */  sw        $v0, 0x0($s1)
/* B3B7C 8011D47C 26020090 */  addiu     $v0, $s0, 0x90
/* B3B80 8011D480 AE160080 */  sw        $s6, 0x80($s0)
/* B3B84 8011D484 AE000084 */  sw        $zero, 0x84($s0)
/* B3B88 8011D488 AE220000 */  sw        $v0, 0x0($s1)
/* B3B8C 8011D48C 26020098 */  addiu     $v0, $s0, 0x98
/* B3B90 8011D490 AE220000 */  sw        $v0, 0x0($s1)
/* B3B94 8011D494 8FA80084 */  lw        $t0, 0x84($sp)
/* B3B98 8011D498 3C014080 */  lui       $at, (0x40800000 >> 16)
/* B3B9C 8011D49C 4481A000 */  mtc1      $at, $f20
/* B3BA0 8011D4A0 25030001 */  addiu     $v1, $t0, 0x1
/* B3BA4 8011D4A4 00031080 */  sll       $v0, $v1, 2
/* B3BA8 8011D4A8 30420FFF */  andi      $v0, $v0, 0xFFF
/* B3BAC 8011D4AC 00021300 */  sll       $v0, $v0, 12
/* B3BB0 8011D4B0 00571025 */  or        $v0, $v0, $s7
/* B3BB4 8011D4B4 AE020090 */  sw        $v0, 0x90($s0)
/* B3BB8 8011D4B8 00081080 */  sll       $v0, $t0, 2
/* B3BBC 8011D4BC 30420FFF */  andi      $v0, $v0, 0xFFF
/* B3BC0 8011D4C0 00021300 */  sll       $v0, $v0, 12
/* B3BC4 8011D4C4 AE020094 */  sw        $v0, 0x94($s0)
/* B3BC8 8011D4C8 260200A0 */  addiu     $v0, $s0, 0xA0
/* B3BCC 8011D4CC AE220000 */  sw        $v0, 0x0($s1)
/* B3BD0 8011D4D0 3C02E100 */  lui       $v0, (0xE1000000 >> 16)
/* B3BD4 8011D4D4 AE020098 */  sw        $v0, 0x98($s0)
/* B3BD8 8011D4D8 C7A00084 */  lwc1      $f0, 0x84($sp)
/* B3BDC 8011D4DC 46800020 */  cvt.s.w   $f0, $f0
/* B3BE0 8011D4E0 46140002 */  mul.s     $f0, $f0, $f20
/* B3BE4 8011D4E4 00000000 */  nop
/* B3BE8 8011D4E8 00052D40 */  sll       $a1, $a1, 21
/* B3BEC 8011D4EC 260200A8 */  addiu     $v0, $s0, 0xA8
/* B3BF0 8011D4F0 AE05009C */  sw        $a1, 0x9C($s0)
/* B3BF4 8011D4F4 AE220000 */  sw        $v0, 0x0($s1)
/* B3BF8 8011D4F8 4600058D */  trunc.w.s $f22, $f0
/* B3BFC 8011D4FC 4402B000 */  mfc1      $v0, $f22
/* B3C00 8011D500 44830000 */  mtc1      $v1, $f0
/* B3C04 8011D504 00000000 */  nop
/* B3C08 8011D508 46800020 */  cvt.s.w   $f0, $f0
/* B3C0C 8011D50C 46140002 */  mul.s     $f0, $f0, $f20
/* B3C10 8011D510 00000000 */  nop
/* B3C14 8011D514 30420FFF */  andi      $v0, $v0, 0xFFF
/* B3C18 8011D518 00021300 */  sll       $v0, $v0, 12
/* B3C1C 8011D51C 00521025 */  or        $v0, $v0, $s2
/* B3C20 8011D520 AE020088 */  sw        $v0, 0x88($s0)
/* B3C24 8011D524 4600058D */  trunc.w.s $f22, $f0
/* B3C28 8011D528 4402B000 */  mfc1      $v0, $f22
/* B3C2C 8011D52C 00000000 */  nop
/* B3C30 8011D530 30420FFF */  andi      $v0, $v0, 0xFFF
/* B3C34 8011D534 00021300 */  sll       $v0, $v0, 12
/* B3C38 8011D538 34420004 */  ori       $v0, $v0, 0x4
/* B3C3C 8011D53C AE02008C */  sw        $v0, 0x8C($s0)
/* B3C40 8011D540 3C02F100 */  lui       $v0, (0xF1000000 >> 16)
/* B3C44 8011D544 AE0200A0 */  sw        $v0, 0xA0($s0)
/* B3C48 8011D548 3C04800A */  lui       $a0, %hi(nuGfxCfb_ptr)
/* B3C4C 8011D54C 8C84A64C */  lw        $a0, %lo(nuGfxCfb_ptr)($a0)
/* B3C50 8011D550 260200B0 */  addiu     $v0, $s0, 0xB0
/* B3C54 8011D554 AE1900A4 */  sw        $t9, 0xA4($s0)
/* B3C58 8011D558 AE220000 */  sw        $v0, 0x0($s1)
/* B3C5C 8011D55C 260200B8 */  addiu     $v0, $s0, 0xB8
/* B3C60 8011D560 AE1300A8 */  sw        $s3, 0xA8($s0)
/* B3C64 8011D564 AE0000AC */  sw        $zero, 0xAC($s0)
/* B3C68 8011D568 AE220000 */  sw        $v0, 0x0($s1)
/* B3C6C 8011D56C 0C0187A4 */  jal       osVirtualToPhysical
/* B3C70 8011D570 AE1800B0 */   sw       $t8, 0xB0($s0)
/* B3C74 8011D574 8E240000 */  lw        $a0, 0x0($s1)
/* B3C78 8011D578 AE0200B4 */  sw        $v0, 0xB4($s0)
/* B3C7C 8011D57C 0080102D */  daddu     $v0, $a0, $zero
/* B3C80 8011D580 AC530000 */  sw        $s3, 0x0($v0)
/* B3C84 8011D584 AC400004 */  sw        $zero, 0x4($v0)
/* B3C88 8011D588 87C2000E */  lh        $v0, 0xE($fp)
/* B3C8C 8011D58C 44820000 */  mtc1      $v0, $f0
/* B3C90 8011D590 00000000 */  nop
/* B3C94 8011D594 46800020 */  cvt.s.w   $f0, $f0
/* B3C98 8011D598 46140002 */  mul.s     $f0, $f0, $f20
/* B3C9C 8011D59C 00000000 */  nop
/* B3CA0 8011D5A0 87C20010 */  lh        $v0, 0x10($fp)
/* B3CA4 8011D5A4 44821000 */  mtc1      $v0, $f2
/* B3CA8 8011D5A8 00000000 */  nop
/* B3CAC 8011D5AC 468010A0 */  cvt.s.w   $f2, $f2
/* B3CB0 8011D5B0 46141082 */  mul.s     $f2, $f2, $f20
/* B3CB4 8011D5B4 00000000 */  nop
/* B3CB8 8011D5B8 24840008 */  addiu     $a0, $a0, 0x8
/* B3CBC 8011D5BC 4600058D */  trunc.w.s $f22, $f0
/* B3CC0 8011D5C0 4403B000 */  mfc1      $v1, $f22
/* B3CC4 8011D5C4 00000000 */  nop
/* B3CC8 8011D5C8 30630FFF */  andi      $v1, $v1, 0xFFF
/* B3CCC 8011D5CC 00031B00 */  sll       $v1, $v1, 12
/* B3CD0 8011D5D0 4600158D */  trunc.w.s $f22, $f2
/* B3CD4 8011D5D4 4402B000 */  mfc1      $v0, $f22
/* B3CD8 8011D5D8 00000000 */  nop
/* B3CDC 8011D5DC 30420FFF */  andi      $v0, $v0, 0xFFF
/* B3CE0 8011D5E0 00521025 */  or        $v0, $v0, $s2
/* B3CE4 8011D5E4 00621825 */  or        $v1, $v1, $v0
/* B3CE8 8011D5E8 AC830000 */  sw        $v1, 0x0($a0)
/* B3CEC 8011D5EC 87C2000E */  lh        $v0, 0xE($fp)
/* B3CF0 8011D5F0 87C3000A */  lh        $v1, 0xA($fp)
/* B3CF4 8011D5F4 00431021 */  addu      $v0, $v0, $v1
/* B3CF8 8011D5F8 44821000 */  mtc1      $v0, $f2
/* B3CFC 8011D5FC 00000000 */  nop
/* B3D00 8011D600 468010A0 */  cvt.s.w   $f2, $f2
/* B3D04 8011D604 46141082 */  mul.s     $f2, $f2, $f20
/* B3D08 8011D608 00000000 */  nop
/* B3D0C 8011D60C 87C20010 */  lh        $v0, 0x10($fp)
/* B3D10 8011D610 87C3000C */  lh        $v1, 0xC($fp)
/* B3D14 8011D614 00431021 */  addu      $v0, $v0, $v1
/* B3D18 8011D618 44820000 */  mtc1      $v0, $f0
/* B3D1C 8011D61C 00000000 */  nop
/* B3D20 8011D620 46800020 */  cvt.s.w   $f0, $f0
/* B3D24 8011D624 46140002 */  mul.s     $f0, $f0, $f20
/* B3D28 8011D628 00000000 */  nop
/* B3D2C 8011D62C AE240000 */  sw        $a0, 0x0($s1)
/* B3D30 8011D630 4600158D */  trunc.w.s $f22, $f2
/* B3D34 8011D634 4402B000 */  mfc1      $v0, $f22
/* B3D38 8011D638 00000000 */  nop
/* B3D3C 8011D63C 30420FFF */  andi      $v0, $v0, 0xFFF
/* B3D40 8011D640 00021300 */  sll       $v0, $v0, 12
/* B3D44 8011D644 4600058D */  trunc.w.s $f22, $f0
/* B3D48 8011D648 4403B000 */  mfc1      $v1, $f22
/* B3D4C 8011D64C 00000000 */  nop
/* B3D50 8011D650 30630FFF */  andi      $v1, $v1, 0xFFF
/* B3D54 8011D654 00431025 */  or        $v0, $v0, $v1
/* B3D58 8011D658 AC820004 */  sw        $v0, 0x4($a0)
/* B3D5C 8011D65C 8FA80084 */  lw        $t0, 0x84($sp)
/* B3D60 8011D660 3C0146FF */  lui       $at, (0x46FF8000 >> 16)
/* B3D64 8011D664 34218000 */  ori       $at, $at, (0x46FF8000 & 0xFFFF)
/* B3D68 8011D668 44810000 */  mtc1      $at, $f0
/* B3D6C 8011D66C 00081040 */  sll       $v0, $t0, 1
/* B3D70 8011D670 00541021 */  addu      $v0, $v0, $s4
/* B3D74 8011D674 94420000 */  lhu       $v0, 0x0($v0)
/* B3D78 8011D678 24840008 */  addiu     $a0, $a0, 0x8
/* B3D7C 8011D67C AE240000 */  sw        $a0, 0x0($s1)
/* B3D80 8011D680 3C048015 */  lui       $a0, %hi(depthFloatLookupTable)
/* B3D84 8011D684 2484B7A8 */  addiu     $a0, $a0, %lo(depthFloatLookupTable)
/* B3D88 8011D688 C7A20030 */  lwc1      $f2, 0x30($sp)
/* B3D8C 8011D68C 00021B42 */  srl       $v1, $v0, 13
/* B3D90 8011D690 30421FFF */  andi      $v0, $v0, 0x1FFF
/* B3D94 8011D694 00021082 */  srl       $v0, $v0, 2
/* B3D98 8011D698 000318C0 */  sll       $v1, $v1, 3
/* B3D9C 8011D69C 00641821 */  addu      $v1, $v1, $a0
/* B3DA0 8011D6A0 46001082 */  mul.s     $f2, $f2, $f0
/* B3DA4 8011D6A4 00000000 */  nop
/* B3DA8 8011D6A8 8C640000 */  lw        $a0, 0x0($v1)
/* B3DAC 8011D6AC 8C630004 */  lw        $v1, 0x4($v1)
/* B3DB0 8011D6B0 00821004 */  sllv      $v0, $v0, $a0
/* B3DB4 8011D6B4 00431021 */  addu      $v0, $v0, $v1
/* B3DB8 8011D6B8 000210C2 */  srl       $v0, $v0, 3
/* B3DBC 8011D6BC 4600158D */  trunc.w.s $f22, $f2
/* B3DC0 8011D6C0 4403B000 */  mfc1      $v1, $f22
/* B3DC4 8011D6C4 00000000 */  nop
/* B3DC8 8011D6C8 0043102B */  sltu      $v0, $v0, $v1
/* B3DCC 8011D6CC 14400009 */  bnez      $v0, .L8011D6F4
/* B3DD0 8011D6D0 0000102D */   daddu    $v0, $zero, $zero
.L8011D6D4:
/* B3DD4 8011D6D4 C7A20030 */  lwc1      $f2, 0x30($sp)
/* B3DD8 8011D6D8 44800000 */  mtc1      $zero, $f0
/* B3DDC 8011D6DC 24020001 */  addiu     $v0, $zero, 0x1
/* B3DE0 8011D6E0 4602003C */  c.lt.s    $f0, $f2
/* B3DE4 8011D6E4 00000000 */  nop
.L8011D6E8:
/* B3DE8 8011D6E8 45010002 */  bc1t      .L8011D6F4
/* B3DEC 8011D6EC 00000000 */   nop
.L8011D6F0:
/* B3DF0 8011D6F0 0000102D */  daddu     $v0, $zero, $zero
.L8011D6F4:
/* B3DF4 8011D6F4 8FBF0064 */  lw        $ra, 0x64($sp)
/* B3DF8 8011D6F8 8FBE0060 */  lw        $fp, 0x60($sp)
/* B3DFC 8011D6FC 8FB7005C */  lw        $s7, 0x5C($sp)
/* B3E00 8011D700 8FB60058 */  lw        $s6, 0x58($sp)
/* B3E04 8011D704 8FB50054 */  lw        $s5, 0x54($sp)
/* B3E08 8011D708 8FB40050 */  lw        $s4, 0x50($sp)
/* B3E0C 8011D70C 8FB3004C */  lw        $s3, 0x4C($sp)
/* B3E10 8011D710 8FB20048 */  lw        $s2, 0x48($sp)
/* B3E14 8011D714 8FB10044 */  lw        $s1, 0x44($sp)
/* B3E18 8011D718 8FB00040 */  lw        $s0, 0x40($sp)
/* B3E1C 8011D71C D7B60070 */  ldc1      $f22, 0x70($sp)
/* B3E20 8011D720 D7B40068 */  ldc1      $f20, 0x68($sp)
/* B3E24 8011D724 03E00008 */  jr        $ra
/* B3E28 8011D728 27BD0078 */   addiu    $sp, $sp, 0x78

### DECOMPILED C INSTRUCTIONS:

s32 is_point_visible(f32 x, f32 y, f32 z, s32 depthQueryID, f32* screenX, f32* screenY) {
    Camera* camera = &gCameras[gCurrentCameraID];
    f32 outX;
    f32 outY;
    f32 outZ;
    f32 outW;

    s32 depthExponent;
    s32 depthMantissa;
    u32 shiftedMantissa, mantissaBias;
    u32 decodedDepth;
    s32 scaledDepth;

    // If an invalid depth query id was provided, return false.
    if (depthQueryID >= ARRAY_COUNT(depthCopyBuffer)) {
        return FALSE;
    }
    // Transform the point into clip space.
    transform_point(camera->perspectiveMatrix, x, y, z, 1.0f, &outX, &outY, &outZ, &outW);
    if (outW == 0.0f) {
        *screenX = 0.0f;
        *screenY = 0.0f;
        return TRUE;
    }
    // Perform the perspective divide (divide xyz by w) to convert to normalized device coords.
    // Normalized device coords have a range of (-1, 1) on each axis.
    outW = 1.0f / outW;
    outX *= outW;
    outY *= -outW;
    outZ *= outW;
    // Perform the viewport transform for x and y (convert normalized device coords to viewport coords).
    // Viewport coords have a range of (0, Width) for x and (0, Height) for y.
    outX = (outX * camera->viewportW + camera->viewportW) * 0.5;
    outX += camera->viewportStartX;
    outY = (outY * camera->viewportH + camera->viewportH) * 0.5;
    outY += camera->viewportStartY;
    // Convert depth from (-1, 1) to (0, 1).
    outZ = (outZ + 1.0f) * 0.5;
    // Write out the calculated x and y values.
    *screenX = outX;
    *screenY = outY;
    // If a depth query wasn't requested, simply check if the point is within the view frustum.
    if (depthQueryID < 0) {
        return outZ > 0.0f;
    }
    if (outX >= 0.0f && outY >= 0.0f && outX < 320.0f && outY < 240.0f) {
        gDPPipeSync(gMainGfxPos++);
        // Load a 4x1 pixel tile of the depth buffer
        gDPLoadTextureTile(gMainGfxPos++, osVirtualToPhysical(&nuGfxZBuffer[(s32) outY * 320]), G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, 1,
            (s32) outX, 0, (s32) outX + 3, 0,
            0,
            G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
            9, G_TX_NOMASK,
            G_TX_NOLOD, G_TX_NOLOD);
        gDPPipeSync(gMainGfxPos++);
        // Set the current color image to the buffer where copied depth values are stored.
        gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, depthCopyBuffer);
        gDPPipeSync(gMainGfxPos++);
        // Set up 1 cycle mode and all other relevant othermode params.
        // One cycle mode must be used here because only one pixel is copied, and copy mode only supports multiples of 4 pixels.
        gDPSetCycleType(gMainGfxPos++, G_CYC_1CYCLE);
        gDPSetRenderMode(gMainGfxPos++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
        gDPSetCombineMode(gMainGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA);
        gDPSetTextureFilter(gMainGfxPos++, G_TF_POINT);
        gDPSetTexturePersp(gMainGfxPos++, G_TP_NONE);
        gSPTexture(gMainGfxPos++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
        gDPSetTextureLUT(gMainGfxPos++, G_TT_NONE);
        gDPSetTextureDetail(gMainGfxPos++, G_TD_CLAMP);
        gDPSetTextureLOD(gMainGfxPos++, G_TL_TILE);
        // Adjust the scissor to only draw to the specified pixel.
        gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, depthQueryID, 0, depthQueryID + 1, 1);
        // Draw a texrect to copy one pixel of the loaded depth tile to the output buffer.
        gSPTextureRectangle(gMainGfxPos++, depthQueryID << 2, 0 << 2, (depthQueryID + 1) << 2, 1 << 2, G_TX_RENDERTILE, (s32) outX << 5, 0, 1 << 10, 1 << 10);
        // Sync and swap the color image back to the current framebuffer.
        gDPPipeSync(gMainGfxPos++);
        gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, osVirtualToPhysical(nuGfxCfb_ptr));
        gDPPipeSync(gMainGfxPos++);
        // Reconfigure the frame's normal scissor.
        gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, camera->viewportStartX, camera->viewportStartY, camera->viewportStartX + camera->viewportW, camera->viewportStartY + camera->viewportH);

        // The following code will use last frame's depth value, since the copy that was just written won't be executed until the current frame is drawn.

        // Extract the exponent and mantissa from the depth buffer value.
        depthExponent = depthCopyBuffer[depthQueryID] >> DEPTH_EXPONENT_SHIFT;
        depthMantissa = (depthCopyBuffer[depthQueryID] & (DEPTH_MANTISSA_MASK | DEPTH_DZ_MASK)) >> DEPTH_MANTISSA_SHIFT;
        // Convert the exponent and mantissa into a fixed-point value.
        shiftedMantissa = depthMantissa << depthFloatLookupTable[depthExponent].shift;
        mantissaBias = depthFloatLookupTable[depthExponent].bias;
        // Remove the 3 fractional bits of precision.
        decodedDepth = (shiftedMantissa + mantissaBias) >> 3;
        // Convert the calculated screen depth into viewport depth.
        scaledDepth = outZ * MAX_VIEWPORT_DEPTH;
        if (decodedDepth < scaledDepth) {
            return FALSE;
        }
    }
    return outZ > 0.0f;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel update_all_status_icons
/* 21430 80046030 27BDFFC8 */  addiu     $sp, $sp, -0x38
/* 21434 80046034 AFB40020 */  sw        $s4, 0x20($sp)
/* 21438 80046038 3C14800A */  lui       $s4, %hi(D_800A0F44)
/* 2143C 8004603C 8E940F44 */  lw        $s4, %lo(D_800A0F44)($s4)
/* 21440 80046040 AFB50024 */  sw        $s5, 0x24($sp)
/* 21444 80046044 0000A82D */  daddu     $s5, $zero, $zero
/* 21448 80046048 AFB20018 */  sw        $s2, 0x18($sp)
/* 2144C 8004604C 24120001 */  addiu     $s2, $zero, 0x1
/* 21450 80046050 AFB3001C */  sw        $s3, 0x1C($sp)
/* 21454 80046054 24130002 */  addiu     $s3, $zero, 0x2
/* 21458 80046058 AFB60028 */  sw        $s6, 0x28($sp)
/* 2145C 8004605C 24160002 */  addiu     $s6, $zero, 0x2
/* 21460 80046060 AFB7002C */  sw        $s7, 0x2C($sp)
/* 21464 80046064 24170014 */  addiu     $s7, $zero, 0x14
/* 21468 80046068 AFBF0030 */  sw        $ra, 0x30($sp)
/* 2146C 8004606C AFB10014 */  sw        $s1, 0x14($sp)
/* 21470 80046070 AFB00010 */  sw        $s0, 0x10($sp)
/* 21474 80046074 26910085 */  addiu     $s1, $s4, 0x85
.L80046078:
/* 21478 80046078 8E820000 */  lw        $v0, 0x0($s4)
/* 2147C 8004607C 50400149 */  beql      $v0, $zero, .L800465A4
/* 21480 80046080 26B50001 */   addiu    $s5, $s5, 0x1
/* 21484 80046084 8222FFB5 */  lb        $v0, -0x4B($s1)
/* 21488 80046088 1452003A */  bne       $v0, $s2, .L80046174
/* 2148C 8004608C 00000000 */   nop
/* 21490 80046090 9222FFB3 */  lbu       $v0, -0x4D($s1)
/* 21494 80046094 2442FFFD */  addiu     $v0, $v0, -0x3
/* 21498 80046098 00021600 */  sll       $v0, $v0, 24
/* 2149C 8004609C 00021E03 */  sra       $v1, $v0, 24
/* 214A0 800460A0 2C620008 */  sltiu     $v0, $v1, 0x8
/* 214A4 800460A4 10400026 */  beqz      $v0, .L80046140
/* 214A8 800460A8 00031080 */   sll      $v0, $v1, 2
/* 214AC 800460AC 3C01800A */  lui       $at, %hi(jtbl_800986C8)
/* 214B0 800460B0 00220821 */  addu      $at, $at, $v0
/* 214B4 800460B4 8C2286C8 */  lw        $v0, %lo(jtbl_800986C8)($at)
/* 214B8 800460B8 00400008 */  jr        $v0
/* 214BC 800460BC 00000000 */   nop
glabel .L800460C0
/* 214C0 800460C0 3C048010 */  lui       $a0, %hi(HES_AsleepBegin)
/* 214C4 800460C4 24844CC4 */  addiu     $a0, $a0, %lo(HES_AsleepBegin)
/* 214C8 800460C8 08011852 */  j         .L80046148
/* 214CC 800460CC 00000000 */   nop
glabel .L800460D0
/* 214D0 800460D0 3C048010 */  lui       $a0, %hi(HES_ParalyzedBegin)
/* 214D4 800460D4 2484551C */  addiu     $a0, $a0, %lo(HES_ParalyzedBegin)
/* 214D8 800460D8 08011852 */  j         .L80046148
/* 214DC 800460DC 00000000 */   nop
glabel .L800460E0
/* 214E0 800460E0 3C048010 */  lui       $a0, %hi(HES_DizzyBegin)
/* 214E4 800460E4 24845900 */  addiu     $a0, $a0, %lo(HES_DizzyBegin)
/* 214E8 800460E8 08011852 */  j         .L80046148
/* 214EC 800460EC 00000000 */   nop
glabel .L800460F0
/* 214F0 800460F0 3C048010 */  lui       $a0, %hi(HES_WeakenedLoop)
/* 214F4 800460F4 248462A0 */  addiu     $a0, $a0, %lo(HES_WeakenedLoop)
/* 214F8 800460F8 08011852 */  j         .L80046148
/* 214FC 800460FC 00000000 */   nop
glabel .L80046100
/* 21500 80046100 3C048010 */  lui       $a0, %hi(HES_StoppedBegin)
/* 21504 80046104 24846610 */  addiu     $a0, $a0, %lo(HES_StoppedBegin)
/* 21508 80046108 08011852 */  j         .L80046148
/* 2150C 8004610C 00000000 */   nop
glabel .L80046110
/* 21510 80046110 3C048010 */  lui       $a0, %hi(HES_PoisonedBegin)
/* 21514 80046114 24845C54 */  addiu     $a0, $a0, %lo(HES_PoisonedBegin)
/* 21518 80046118 08011852 */  j         .L80046148
/* 2151C 8004611C 00000000 */   nop
glabel .L80046120
/* 21520 80046120 3C048010 */  lui       $a0, %hi(HES_ShrunkBegin)
/* 21524 80046124 24846964 */  addiu     $a0, $a0, %lo(HES_ShrunkBegin)
/* 21528 80046128 08011852 */  j         .L80046148
/* 2152C 8004612C 00000000 */   nop
glabel .L80046130
/* 21530 80046130 3C048010 */  lui       $a0, %hi(HES_FrozenBegin)
/* 21534 80046134 24845FA8 */  addiu     $a0, $a0, %lo(HES_FrozenBegin)
/* 21538 80046138 08011852 */  j         .L80046148
/* 2153C 8004613C 00000000 */   nop
.L80046140:
/* 21540 80046140 3C048008 */  lui       $a0, %hi(HES_Item_Present)
/* 21544 80046144 248404F0 */  addiu     $a0, $a0, %lo(HES_Item_Present)
.L80046148:
/* 21548 80046148 0C050529 */  jal       hud_element_create
/* 2154C 8004614C 00000000 */   nop
/* 21550 80046150 AE22FFBB */  sw        $v0, -0x45($s1)
/* 21554 80046154 0040802D */  daddu     $s0, $v0, $zero
/* 21558 80046158 0200202D */  daddu     $a0, $s0, $zero
/* 2155C 8004615C 0C051280 */  jal       hud_element_set_flags
/* 21560 80046160 24050002 */   addiu    $a1, $zero, 0x2
/* 21564 80046164 0200202D */  daddu     $a0, $s0, $zero
/* 21568 80046168 0C051280 */  jal       hud_element_set_flags
/* 2156C 8004616C 24050080 */   addiu    $a1, $zero, 0x80
/* 21570 80046170 A233FFB5 */  sb        $s3, -0x4B($s1)
.L80046174:
/* 21574 80046174 8223FFB6 */  lb        $v1, -0x4A($s1)
/* 21578 80046178 10720007 */  beq       $v1, $s2, .L80046198
/* 2157C 8004617C 28620002 */   slti     $v0, $v1, 0x2
/* 21580 80046180 1440004C */  bnez      $v0, .L800462B4
/* 21584 80046184 00000000 */   nop
/* 21588 80046188 10760040 */  beq       $v1, $s6, .L8004628C
/* 2158C 8004618C 00000000 */   nop
/* 21590 80046190 080118AD */  j         .L800462B4
/* 21594 80046194 00000000 */   nop
.L80046198:
/* 21598 80046198 9222FFB4 */  lbu       $v0, -0x4C($s1)
/* 2159C 8004619C 2442FFFD */  addiu     $v0, $v0, -0x3
/* 215A0 800461A0 00021600 */  sll       $v0, $v0, 24
/* 215A4 800461A4 00021E03 */  sra       $v1, $v0, 24
/* 215A8 800461A8 2C620008 */  sltiu     $v0, $v1, 0x8
/* 215AC 800461AC 1040002E */  beqz      $v0, .L80046268
/* 215B0 800461B0 00031080 */   sll      $v0, $v1, 2
/* 215B4 800461B4 3C01800A */  lui       $at, %hi(jtbl_800986E8)
/* 215B8 800461B8 00220821 */  addu      $at, $at, $v0
/* 215BC 800461BC 8C2286E8 */  lw        $v0, %lo(jtbl_800986E8)($at)
/* 215C0 800461C0 00400008 */  jr        $v0
/* 215C4 800461C4 00000000 */   nop
glabel .L800461C8
/* 215C8 800461C8 8E24FFBF */  lw        $a0, -0x41($s1)
/* 215CC 800461CC 3C058010 */  lui       $a1, %hi(HES_AsleepEnd)
/* 215D0 800461D0 24A54E64 */  addiu     $a1, $a1, %lo(HES_AsleepEnd)
/* 215D4 800461D4 0801189D */  j         .L80046274
/* 215D8 800461D8 00000000 */   nop
glabel .L800461DC
/* 215DC 800461DC 8E24FFBF */  lw        $a0, -0x41($s1)
/* 215E0 800461E0 3C058010 */  lui       $a1, %hi(HES_ParalyzedEnd)
/* 215E4 800461E4 24A5574C */  addiu     $a1, $a1, %lo(HES_ParalyzedEnd)
/* 215E8 800461E8 0801189D */  j         .L80046274
/* 215EC 800461EC 00000000 */   nop
glabel .L800461F0
/* 215F0 800461F0 8E24FFBF */  lw        $a0, -0x41($s1)
/* 215F4 800461F4 3C058010 */  lui       $a1, %hi(HES_DizzyEnd)
/* 215F8 800461F8 24A55AA0 */  addiu     $a1, $a1, %lo(HES_DizzyEnd)
/* 215FC 800461FC 0801189D */  j         .L80046274
/* 21600 80046200 00000000 */   nop
glabel .L80046204
/* 21604 80046204 8E24FFBF */  lw        $a0, -0x41($s1)
/* 21608 80046208 3C058010 */  lui       $a1, %hi(HES_WeakenedLoop)
/* 2160C 8004620C 24A562A0 */  addiu     $a1, $a1, %lo(HES_WeakenedLoop)
/* 21610 80046210 0801189D */  j         .L80046274
/* 21614 80046214 00000000 */   nop
glabel .L80046218
/* 21618 80046218 8E24FFBF */  lw        $a0, -0x41($s1)
/* 2161C 8004621C 3C058010 */  lui       $a1, %hi(HES_StoppedEnd)
/* 21620 80046220 24A567B0 */  addiu     $a1, $a1, %lo(HES_StoppedEnd)
/* 21624 80046224 0801189D */  j         .L80046274
/* 21628 80046228 00000000 */   nop
glabel .L8004622C
/* 2162C 8004622C 8E24FFBF */  lw        $a0, -0x41($s1)
/* 21630 80046230 3C058010 */  lui       $a1, %hi(HES_PoisonedEnd)
/* 21634 80046234 24A55DF4 */  addiu     $a1, $a1, %lo(HES_PoisonedEnd)
/* 21638 80046238 0801189D */  j         .L80046274
/* 2163C 8004623C 00000000 */   nop
glabel .L80046240
/* 21640 80046240 8E24FFBF */  lw        $a0, -0x41($s1)
/* 21644 80046244 3C058010 */  lui       $a1, %hi(HES_ShrunkEnd)
/* 21648 80046248 24A56B04 */  addiu     $a1, $a1, %lo(HES_ShrunkEnd)
/* 2164C 8004624C 0801189D */  j         .L80046274
/* 21650 80046250 00000000 */   nop
glabel .L80046254
/* 21654 80046254 8E24FFBF */  lw        $a0, -0x41($s1)
/* 21658 80046258 3C058010 */  lui       $a1, %hi(HES_FrozenEnd)
/* 2165C 8004625C 24A56148 */  addiu     $a1, $a1, %lo(HES_FrozenEnd)
/* 21660 80046260 0801189D */  j         .L80046274
/* 21664 80046264 00000000 */   nop
.L80046268:
/* 21668 80046268 8E24FFBF */  lw        $a0, -0x41($s1)
/* 2166C 8004626C 3C058008 */  lui       $a1, %hi(HES_Item_Present)
/* 21670 80046270 24A504F0 */  addiu     $a1, $a1, %lo(HES_Item_Present)
.L80046274:
/* 21674 80046274 0C0511FF */  jal       hud_element_set_script
/* 21678 80046278 00000000 */   nop
/* 2167C 8004627C 2402000A */  addiu     $v0, $zero, 0xA
/* 21680 80046280 A222FFB8 */  sb        $v0, -0x48($s1)
/* 21684 80046284 080118AD */  j         .L800462B4
/* 21688 80046288 A233FFB6 */   sb       $s3, -0x4A($s1)
.L8004628C:
/* 2168C 8004628C 8222FFB8 */  lb        $v0, -0x48($s1)
/* 21690 80046290 9223FFB8 */  lbu       $v1, -0x48($s1)
/* 21694 80046294 10400003 */  beqz      $v0, .L800462A4
/* 21698 80046298 2462FFFF */   addiu    $v0, $v1, -0x1
/* 2169C 8004629C 080118AD */  j         .L800462B4
/* 216A0 800462A0 A222FFB8 */   sb       $v0, -0x48($s1)
.L800462A4:
/* 216A4 800462A4 8E24FFBF */  lw        $a0, -0x41($s1)
/* 216A8 800462A8 0C05123D */  jal       hud_element_free
/* 216AC 800462AC A220FFB4 */   sb       $zero, -0x4C($s1)
/* 216B0 800462B0 A220FFB6 */  sb        $zero, -0x4A($s1)
.L800462B4:
/* 216B4 800462B4 8222FFC5 */  lb        $v0, -0x3B($s1)
/* 216B8 800462B8 14520013 */  bne       $v0, $s2, .L80046308
/* 216BC 800462BC 2402000B */   addiu    $v0, $zero, 0xB
/* 216C0 800462C0 8223FFC3 */  lb        $v1, -0x3D($s1)
/* 216C4 800462C4 3C048008 */  lui       $a0, %hi(HES_Item_Present)
/* 216C8 800462C8 248404F0 */  addiu     $a0, $a0, %lo(HES_Item_Present)
/* 216CC 800462CC 14620003 */  bne       $v1, $v0, .L800462DC
/* 216D0 800462D0 00000000 */   nop
/* 216D4 800462D4 3C048010 */  lui       $a0, %hi(HES_ElectrifiedBegin)
/* 216D8 800462D8 248450A8 */  addiu     $a0, $a0, %lo(HES_ElectrifiedBegin)
.L800462DC:
/* 216DC 800462DC 0C050529 */  jal       hud_element_create
/* 216E0 800462E0 00000000 */   nop
/* 216E4 800462E4 AE22FFCB */  sw        $v0, -0x35($s1)
/* 216E8 800462E8 0040802D */  daddu     $s0, $v0, $zero
/* 216EC 800462EC 0200202D */  daddu     $a0, $s0, $zero
/* 216F0 800462F0 0C051280 */  jal       hud_element_set_flags
/* 216F4 800462F4 24050002 */   addiu    $a1, $zero, 0x2
/* 216F8 800462F8 0200202D */  daddu     $a0, $s0, $zero
/* 216FC 800462FC 0C051280 */  jal       hud_element_set_flags
/* 21700 80046300 24050080 */   addiu    $a1, $zero, 0x80
/* 21704 80046304 A233FFC5 */  sb        $s3, -0x3B($s1)
.L80046308:
/* 21708 80046308 8223FFC6 */  lb        $v1, -0x3A($s1)
/* 2170C 8004630C 10720007 */  beq       $v1, $s2, .L8004632C
/* 21710 80046310 28620002 */   slti     $v0, $v1, 0x2
/* 21714 80046314 14400020 */  bnez      $v0, .L80046398
/* 21718 80046318 00000000 */   nop
/* 2171C 8004631C 10760014 */  beq       $v1, $s6, .L80046370
/* 21720 80046320 00000000 */   nop
/* 21724 80046324 080118E6 */  j         .L80046398
/* 21728 80046328 00000000 */   nop
.L8004632C:
/* 2172C 8004632C 8223FFC4 */  lb        $v1, -0x3C($s1)
/* 21730 80046330 2402000B */  addiu     $v0, $zero, 0xB
/* 21734 80046334 14620006 */  bne       $v1, $v0, .L80046350
/* 21738 80046338 00000000 */   nop
/* 2173C 8004633C 8E24FFCF */  lw        $a0, -0x31($s1)
/* 21740 80046340 3C058010 */  lui       $a1, %hi(HES_ElectrifiedEnd)
/* 21744 80046344 24A552D8 */  addiu     $a1, $a1, %lo(HES_ElectrifiedEnd)
/* 21748 80046348 080118D7 */  j         .L8004635C
/* 2174C 8004634C 00000000 */   nop
.L80046350:
/* 21750 80046350 8E24FFCF */  lw        $a0, -0x31($s1)
/* 21754 80046354 3C058008 */  lui       $a1, %hi(HES_Item_Present)
/* 21758 80046358 24A504F0 */  addiu     $a1, $a1, %lo(HES_Item_Present)
.L8004635C:
/* 2175C 8004635C 0C0511FF */  jal       hud_element_set_script
/* 21760 80046360 00000000 */   nop
/* 21764 80046364 A237FFC8 */  sb        $s7, -0x38($s1)
/* 21768 80046368 080118E6 */  j         .L80046398
/* 2176C 8004636C A233FFC6 */   sb       $s3, -0x3A($s1)
.L80046370:
/* 21770 80046370 8222FFC8 */  lb        $v0, -0x38($s1)
/* 21774 80046374 9223FFC8 */  lbu       $v1, -0x38($s1)
/* 21778 80046378 10400003 */  beqz      $v0, .L80046388
/* 2177C 8004637C 2462FFFF */   addiu    $v0, $v1, -0x1
/* 21780 80046380 080118E6 */  j         .L80046398
/* 21784 80046384 A222FFC8 */   sb       $v0, -0x38($s1)
.L80046388:
/* 21788 80046388 8E24FFCF */  lw        $a0, -0x31($s1)
/* 2178C 8004638C 0C05123D */  jal       hud_element_free
/* 21790 80046390 A220FFC4 */   sb       $zero, -0x3C($s1)
/* 21794 80046394 A220FFC6 */  sb        $zero, -0x3A($s1)
.L80046398:
/* 21798 80046398 8222FFD5 */  lb        $v0, -0x2B($s1)
/* 2179C 8004639C 14520013 */  bne       $v0, $s2, .L800463EC
/* 217A0 800463A0 2402000E */   addiu    $v0, $zero, 0xE
/* 217A4 800463A4 8223FFD3 */  lb        $v1, -0x2D($s1)
/* 217A8 800463A8 3C048008 */  lui       $a0, %hi(HES_Item_Present)
/* 217AC 800463AC 248404F0 */  addiu     $a0, $a0, %lo(HES_Item_Present)
/* 217B0 800463B0 14620003 */  bne       $v1, $v0, .L800463C0
/* 217B4 800463B4 00000000 */   nop
/* 217B8 800463B8 3C048010 */  lui       $a0, %hi(HES_TransparentBegin)
/* 217BC 800463BC 24846CD8 */  addiu     $a0, $a0, %lo(HES_TransparentBegin)
.L800463C0:
/* 217C0 800463C0 0C050529 */  jal       hud_element_create
/* 217C4 800463C4 00000000 */   nop
/* 217C8 800463C8 AE22FFDB */  sw        $v0, -0x25($s1)
/* 217CC 800463CC 0040802D */  daddu     $s0, $v0, $zero
/* 217D0 800463D0 0200202D */  daddu     $a0, $s0, $zero
/* 217D4 800463D4 0C051280 */  jal       hud_element_set_flags
/* 217D8 800463D8 24050002 */   addiu    $a1, $zero, 0x2
/* 217DC 800463DC 0200202D */  daddu     $a0, $s0, $zero
/* 217E0 800463E0 0C051280 */  jal       hud_element_set_flags
/* 217E4 800463E4 24050080 */   addiu    $a1, $zero, 0x80
/* 217E8 800463E8 A233FFD5 */  sb        $s3, -0x2B($s1)
.L800463EC:
/* 217EC 800463EC 8223FFD6 */  lb        $v1, -0x2A($s1)
/* 217F0 800463F0 10720007 */  beq       $v1, $s2, .L80046410
/* 217F4 800463F4 28620002 */   slti     $v0, $v1, 0x2
/* 217F8 800463F8 14400020 */  bnez      $v0, .L8004647C
/* 217FC 800463FC 00000000 */   nop
/* 21800 80046400 10760014 */  beq       $v1, $s6, .L80046454
/* 21804 80046404 00000000 */   nop
/* 21808 80046408 0801191F */  j         .L8004647C
/* 2180C 8004640C 00000000 */   nop
.L80046410:
/* 21810 80046410 8223FFD4 */  lb        $v1, -0x2C($s1)
/* 21814 80046414 2402000E */  addiu     $v0, $zero, 0xE
/* 21818 80046418 14620006 */  bne       $v1, $v0, .L80046434
/* 2181C 8004641C 00000000 */   nop
/* 21820 80046420 8E24FFDF */  lw        $a0, -0x21($s1)
/* 21824 80046424 3C058010 */  lui       $a1, %hi(HES_TransparentEnd)
/* 21828 80046428 24A56E98 */  addiu     $a1, $a1, %lo(HES_TransparentEnd)
/* 2182C 8004642C 08011910 */  j         .L80046440
/* 21830 80046430 00000000 */   nop
.L80046434:
/* 21834 80046434 8E24FFDF */  lw        $a0, -0x21($s1)
/* 21838 80046438 3C058008 */  lui       $a1, %hi(HES_Item_Present)
/* 2183C 8004643C 24A504F0 */  addiu     $a1, $a1, %lo(HES_Item_Present)
.L80046440:
/* 21840 80046440 0C0511FF */  jal       hud_element_set_script
/* 21844 80046444 00000000 */   nop
/* 21848 80046448 A237FFD8 */  sb        $s7, -0x28($s1)
/* 2184C 8004644C 0801191F */  j         .L8004647C
/* 21850 80046450 A233FFD6 */   sb       $s3, -0x2A($s1)
.L80046454:
/* 21854 80046454 8222FFD8 */  lb        $v0, -0x28($s1)
/* 21858 80046458 9223FFD8 */  lbu       $v1, -0x28($s1)
/* 2185C 8004645C 10400003 */  beqz      $v0, .L8004646C
/* 21860 80046460 2462FFFF */   addiu    $v0, $v1, -0x1
/* 21864 80046464 0801191F */  j         .L8004647C
/* 21868 80046468 A222FFD8 */   sb       $v0, -0x28($s1)
.L8004646C:
/* 2186C 8004646C 8E24FFDF */  lw        $a0, -0x21($s1)
/* 21870 80046470 0C05123D */  jal       hud_element_free
/* 21874 80046474 A220FFD4 */   sb       $zero, -0x2C($s1)
/* 21878 80046478 A220FFD6 */  sb        $zero, -0x2A($s1)
.L8004647C:
/* 2187C 8004647C 8222FFE5 */  lb        $v0, -0x1B($s1)
/* 21880 80046480 1452000E */  bne       $v0, $s2, .L800464BC
/* 21884 80046484 00000000 */   nop
/* 21888 80046488 3C048010 */  lui       $a0, %hi(HES_WeakenedBegin)
/* 2188C 8004648C 248462DC */  addiu     $a0, $a0, %lo(HES_WeakenedBegin)
/* 21890 80046490 0C050529 */  jal       hud_element_create
/* 21894 80046494 00000000 */   nop
/* 21898 80046498 0040802D */  daddu     $s0, $v0, $zero
/* 2189C 8004649C 0040202D */  daddu     $a0, $v0, $zero
/* 218A0 800464A0 24050002 */  addiu     $a1, $zero, 0x2
/* 218A4 800464A4 0C051280 */  jal       hud_element_set_flags
/* 218A8 800464A8 AE30FFEB */   sw       $s0, -0x15($s1)
/* 218AC 800464AC 0200202D */  daddu     $a0, $s0, $zero
/* 218B0 800464B0 0C051280 */  jal       hud_element_set_flags
/* 218B4 800464B4 24050080 */   addiu    $a1, $zero, 0x80
/* 218B8 800464B8 A233FFE5 */  sb        $s3, -0x1B($s1)
.L800464BC:
/* 218BC 800464BC 8223FFE6 */  lb        $v1, -0x1A($s1)
/* 218C0 800464C0 10720007 */  beq       $v1, $s2, .L800464E0
/* 218C4 800464C4 28620002 */   slti     $v0, $v1, 0x2
/* 218C8 800464C8 14400017 */  bnez      $v0, .L80046528
/* 218CC 800464CC 00000000 */   nop
/* 218D0 800464D0 1076000B */  beq       $v1, $s6, .L80046500
/* 218D4 800464D4 00000000 */   nop
/* 218D8 800464D8 0801194A */  j         .L80046528
/* 218DC 800464DC 00000000 */   nop
.L800464E0:
/* 218E0 800464E0 8E24FFEF */  lw        $a0, -0x11($s1)
/* 218E4 800464E4 3C058010 */  lui       $a1, %hi(HES_WeakenedEnd)
/* 218E8 800464E8 24A5645C */  addiu     $a1, $a1, %lo(HES_WeakenedEnd)
/* 218EC 800464EC 0C0511FF */  jal       hud_element_set_script
/* 218F0 800464F0 00000000 */   nop
/* 218F4 800464F4 A237FFE8 */  sb        $s7, -0x18($s1)
/* 218F8 800464F8 0801194A */  j         .L80046528
/* 218FC 800464FC A233FFE6 */   sb       $s3, -0x1A($s1)
.L80046500:
/* 21900 80046500 8222FFE8 */  lb        $v0, -0x18($s1)
/* 21904 80046504 9223FFE8 */  lbu       $v1, -0x18($s1)
/* 21908 80046508 10400003 */  beqz      $v0, .L80046518
/* 2190C 8004650C 2462FFFF */   addiu    $v0, $v1, -0x1
/* 21910 80046510 0801194A */  j         .L80046528
/* 21914 80046514 A222FFE8 */   sb       $v0, -0x18($s1)
.L80046518:
/* 21918 80046518 8E24FFEF */  lw        $a0, -0x11($s1)
/* 2191C 8004651C 0C05123D */  jal       hud_element_free
/* 21920 80046520 A220FFE4 */   sb       $zero, -0x1C($s1)
/* 21924 80046524 A220FFE6 */  sb        $zero, -0x1A($s1)
.L80046528:
/* 21928 80046528 8222FFF4 */  lb        $v0, -0xC($s1)
/* 2192C 8004652C 1040000D */  beqz      $v0, .L80046564
/* 21930 80046530 00000000 */   nop
/* 21934 80046534 1452000B */  bne       $v0, $s2, .L80046564
/* 21938 80046538 00000000 */   nop
/* 2193C 8004653C 8E30FFFB */  lw        $s0, -0x5($s1)
/* 21940 80046540 0C051235 */  jal       get_hud_element
/* 21944 80046544 0200202D */   daddu    $a0, $s0, $zero
/* 21948 80046548 8C420000 */  lw        $v0, 0x0($v0)
/* 2194C 8004654C 30420004 */  andi      $v0, $v0, 0x4
/* 21950 80046550 10400004 */  beqz      $v0, .L80046564
/* 21954 80046554 00000000 */   nop
/* 21958 80046558 0C05123D */  jal       hud_element_free
/* 2195C 8004655C 0200202D */   daddu    $a0, $s0, $zero
/* 21960 80046560 A220FFF4 */  sb        $zero, -0xC($s1)
.L80046564:
/* 21964 80046564 82220000 */  lb        $v0, 0x0($s1)
/* 21968 80046568 5040000E */  beql      $v0, $zero, .L800465A4
/* 2196C 8004656C 26B50001 */   addiu    $s5, $s5, 0x1
/* 21970 80046570 5452000C */  bnel      $v0, $s2, .L800465A4
/* 21974 80046574 26B50001 */   addiu    $s5, $s5, 0x1
/* 21978 80046578 8E300007 */  lw        $s0, 0x7($s1)
/* 2197C 8004657C 0C051235 */  jal       get_hud_element
/* 21980 80046580 0200202D */   daddu    $a0, $s0, $zero
/* 21984 80046584 8C420000 */  lw        $v0, 0x0($v0)
/* 21988 80046588 30420004 */  andi      $v0, $v0, 0x4
/* 2198C 8004658C 50400005 */  beql      $v0, $zero, .L800465A4
/* 21990 80046590 26B50001 */   addiu    $s5, $s5, 0x1
/* 21994 80046594 0C05123D */  jal       hud_element_free
/* 21998 80046598 0200202D */   daddu    $a0, $s0, $zero
/* 2199C 8004659C A2200000 */  sb        $zero, 0x0($s1)
/* 219A0 800465A0 26B50001 */  addiu     $s5, $s5, 0x1
.L800465A4:
/* 219A4 800465A4 263100B0 */  addiu     $s1, $s1, 0xB0
/* 219A8 800465A8 2AA20040 */  slti      $v0, $s5, 0x40
/* 219AC 800465AC 1440FEB2 */  bnez      $v0, .L80046078
/* 219B0 800465B0 269400B0 */   addiu    $s4, $s4, 0xB0
/* 219B4 800465B4 8FBF0030 */  lw        $ra, 0x30($sp)
/* 219B8 800465B8 8FB7002C */  lw        $s7, 0x2C($sp)
/* 219BC 800465BC 8FB60028 */  lw        $s6, 0x28($sp)
/* 219C0 800465C0 8FB50024 */  lw        $s5, 0x24($sp)
/* 219C4 800465C4 8FB40020 */  lw        $s4, 0x20($sp)
/* 219C8 800465C8 8FB3001C */  lw        $s3, 0x1C($sp)
/* 219CC 800465CC 8FB20018 */  lw        $s2, 0x18($sp)
/* 219D0 800465D0 8FB10014 */  lw        $s1, 0x14($sp)
/* 219D4 800465D4 8FB00010 */  lw        $s0, 0x10($sp)
/* 219D8 800465D8 03E00008 */  jr        $ra
/* 219DC 800465DC 27BD0038 */   addiu    $sp, $sp, 0x38

### DECOMPILED C INSTRUCTIONS:

void update_all_status_icons(void* data) {
    PopupMessage* popup = data;
    HudStatusIcon* icon;
    int i;
    s32 elementID;

    for (i = 0, icon = D_800A0F44; i < MAX_ICONS; i++, icon++) {
        if (icon->flags == 0) {
            continue;
        }

        if (icon->status1.activeTask == STATUS_ICON_TASK_LOAD) {
            switch (icon->status1.active) {
                case STATUS_KEY_SLEEP:
                    elementID = icon->status1.activeElementID = hud_element_create(&HES_AsleepBegin);
                    break;
                case STATUS_KEY_PARALYZE:
                    elementID = icon->status1.activeElementID = hud_element_create(&HES_ParalyzedBegin);
                    break;
                case STATUS_KEY_DIZZY:
                    elementID = icon->status1.activeElementID = hud_element_create(&HES_DizzyBegin);
                    break;
                case STATUS_KEY_FEAR:
                    elementID = icon->status1.activeElementID = hud_element_create(&HES_WeakenedLoop);
                    break;
                case STATUS_KEY_STOP:
                    elementID = icon->status1.activeElementID = hud_element_create(&HES_StoppedBegin);
                    break;
                case STATUS_KEY_POISON:
                    elementID = icon->status1.activeElementID = hud_element_create(&HES_PoisonedBegin);
                    break;
                case STATUS_KEY_SHRINK:
                    elementID = icon->status1.activeElementID = hud_element_create(&HES_ShrunkBegin);
                    break;
                case STATUS_KEY_FROZEN:
                    elementID = icon->status1.activeElementID = hud_element_create(&HES_FrozenBegin);
                    break;
                default:
                    elementID = icon->status1.activeElementID = hud_element_create(&HES_Item_Present);
                    break;
            }
            hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_DISABLED);
            hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80);
            icon->status1.activeTask = STATUS_ICON_TASK_DRAW;
        }

        switch (icon->status1.removingTask) {
            case STATUS_ICON_TASK_NONE:
                break;
            case STATUS_ICON_TASK_LOAD:
                switch (icon->status1.removing) {
                    case STATUS_KEY_SLEEP:
                        hud_element_set_script(icon->status1.removingElementID, &HES_AsleepEnd);
                        break;
                    case STATUS_KEY_PARALYZE:
                        hud_element_set_script(icon->status1.removingElementID, &HES_ParalyzedEnd);
                        break;
                    case STATUS_KEY_DIZZY:
                        hud_element_set_script(icon->status1.removingElementID, &HES_DizzyEnd);
                        break;
                    case STATUS_KEY_FEAR:
                        hud_element_set_script(icon->status1.removingElementID, &HES_WeakenedLoop);
                        break;
                    case STATUS_KEY_STOP:
                        hud_element_set_script(icon->status1.removingElementID, &HES_StoppedEnd);
                        break;
                    case STATUS_KEY_POISON:
                        hud_element_set_script(icon->status1.removingElementID, &HES_PoisonedEnd);
                        break;
                    case STATUS_KEY_SHRINK:
                        hud_element_set_script(icon->status1.removingElementID, &HES_ShrunkEnd);
                        break;
                    case STATUS_KEY_FROZEN:
                        hud_element_set_script(icon->status1.removingElementID, &HES_FrozenEnd);
                        break;
                    default:
                        hud_element_set_script(icon->status1.removingElementID, &HES_Item_Present);
                        break;
                }

                icon->status1.frameCounter = 10;
                icon->status1.removingTask = STATUS_ICON_TASK_DRAW;
                break;

            case STATUS_ICON_TASK_DRAW:
                if (icon->status1.frameCounter != 0) {
                    icon->status1.frameCounter--;
                } else {
                    icon->status1.removing = 0;
                    hud_element_free(icon->status1.removingElementID);
                    icon->status1.removingTask = STATUS_ICON_TASK_NONE;
                }
                break;
        }

        if (icon->status2.activeTask == STATUS_ICON_TASK_LOAD) {
            switch (icon->status2.active) {
                case STATUS_KEY_STATIC:
                    elementID = icon->status2.activeElementID = hud_element_create(&HES_ElectrifiedBegin);
                    break;
                default:
                    elementID = icon->status2.activeElementID = hud_element_create(&HES_Item_Present);
                    break;
            }

            hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_DISABLED);
            hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80);
            icon->status2.activeTask = STATUS_ICON_TASK_DRAW;
        }

        switch (icon->status2.removingTask) {
            case STATUS_ICON_TASK_NONE:
                break;
            case STATUS_ICON_TASK_LOAD:
                switch (icon->status2.removing) {
                    case STATUS_KEY_STATIC:
                        hud_element_set_script(icon->status2.removingElementID, &HES_ElectrifiedEnd);
                        break;
                    default:
                        hud_element_set_script(icon->status2.removingElementID, &HES_Item_Present);
                        break;
                }

                icon->status2.frameCounter = 20;
                icon->status2.removingTask = STATUS_ICON_TASK_DRAW;
                break;
            case STATUS_ICON_TASK_DRAW:
                if (icon->status2.frameCounter != 0) {
                    icon->status2.frameCounter--;
                } else {
                    icon->status2.removing = 0;
                    hud_element_free(icon->status2.removingElementID);
                    icon->status2.removingTask = STATUS_ICON_TASK_NONE;
                }
                break;
        }

        if (icon->status3.activeTask == STATUS_ICON_TASK_LOAD) {
            switch (icon->status3.active) {
                case STATUS_KEY_TRANSPARENT:
                    elementID = icon->status3.activeElementID = hud_element_create(&HES_TransparentBegin);
                    break;
                default:
                    elementID = icon->status3.activeElementID = hud_element_create(&HES_Item_Present);
                    break;
            }

            hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_DISABLED);
            hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80);
            icon->status3.activeTask = STATUS_ICON_TASK_DRAW;
        }

        switch (icon->status3.removingTask) {
            case STATUS_ICON_TASK_NONE:
                break;
            case STATUS_ICON_TASK_LOAD:
                switch (icon->status3.removing) {
                    case STATUS_KEY_TRANSPARENT:
                        hud_element_set_script(icon->status3.removingElementID, &HES_TransparentEnd);
                        break;
                    default:
                        hud_element_set_script(icon->status3.removingElementID, &HES_Item_Present);
                        break;
                }

                icon->status3.frameCounter = 20;
                icon->status3.removingTask = STATUS_ICON_TASK_DRAW;
                break;
            case STATUS_ICON_TASK_DRAW:
                if (icon->status3.frameCounter != 0) {
                    icon->status3.frameCounter--;
                } else {
                    icon->status3.removing = 0;
                    hud_element_free(icon->status3.removingElementID);
                    icon->status3.removingTask = STATUS_ICON_TASK_NONE;
                }
                break;
        }

        if (icon->status4.activeTask == STATUS_ICON_TASK_LOAD) {
            elementID = icon->status4.activeElementID = hud_element_create(&HES_WeakenedBegin);
            hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_DISABLED);
            hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80);
            icon->status4.activeTask = STATUS_ICON_TASK_DRAW;
        }

        switch (icon->status4.removingTask) {
            case STATUS_ICON_TASK_NONE:
                break;
            case STATUS_ICON_TASK_LOAD:
                hud_element_set_script(icon->status4.removingElementID, &HES_WeakenedEnd);
                icon->status4.frameCounter = 20;
                icon->status4.removingTask = STATUS_ICON_TASK_DRAW;
                break;
            case STATUS_ICON_TASK_DRAW:
                if (icon->status4.frameCounter != 0) {
                    icon->status4.frameCounter--;
                } else {
                    icon->status4.removing = 0;
                    hud_element_free(icon->status4.removingElementID);
                    icon->status4.removingTask = STATUS_ICON_TASK_NONE;
                }
                break;
        }

        if (icon->boostJump.removing) {
            if (icon->boostJump.removing == 1) {
                s32 index = icon->prevIndexBoostJump;

                if (get_hud_element(index)->flags & HUD_ELEMENT_FLAG_ANIMATION_FINISHED) {
                    hud_element_free(index);
                    icon->boostJump.removing = 0;
                }
            }
        }

        if (icon->boostHammer.removing) {
            if (icon->boostHammer.removing == 1) {
                s32 index = icon->prevIndexBoostHammer;

                if (get_hud_element(index)->flags & HUD_ELEMENT_FLAG_ANIMATION_FINISHED) {
                    hud_element_free(index);
                    icon->boostHammer.removing = 0;
                }
            }
        }
    }
}