### RAW ASSEMBLY INSTRUCTIONS:

glabel sleep_bubble_appendGfx
/* 35CEE0 E0052460 27BDFF28 */  addiu     $sp, $sp, -0xD8
/* 35CEE4 E0052464 3C05DB06 */  lui       $a1, (0xDB060024 >> 16)
/* 35CEE8 E0052468 3C07800A */  lui       $a3, %hi(gMainGfxPos)
/* 35CEEC E005246C 24E7A66C */  addiu     $a3, $a3, %lo(gMainGfxPos)
/* 35CEF0 E0052470 34A50024 */  ori       $a1, $a1, (0xDB060024 & 0xFFFF)
/* 35CEF4 E0052474 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 35CEF8 E0052478 AFBF00C4 */  sw        $ra, 0xC4($sp)
/* 35CEFC E005247C AFBE00C0 */  sw        $fp, 0xC0($sp)
/* 35CF00 E0052480 AFB700BC */  sw        $s7, 0xBC($sp)
/* 35CF04 E0052484 AFB600B8 */  sw        $s6, 0xB8($sp)
/* 35CF08 E0052488 AFB500B4 */  sw        $s5, 0xB4($sp)
/* 35CF0C E005248C AFB400B0 */  sw        $s4, 0xB0($sp)
/* 35CF10 E0052490 AFB300AC */  sw        $s3, 0xAC($sp)
/* 35CF14 E0052494 AFB200A8 */  sw        $s2, 0xA8($sp)
/* 35CF18 E0052498 AFB100A4 */  sw        $s1, 0xA4($sp)
/* 35CF1C E005249C AFB000A0 */  sw        $s0, 0xA0($sp)
/* 35CF20 E00524A0 F7B600D0 */  sdc1      $f22, 0xD0($sp)
/* 35CF24 E00524A4 F7B400C8 */  sdc1      $f20, 0xC8($sp)
/* 35CF28 E00524A8 8CE60000 */  lw        $a2, 0x0($a3)
/* 35CF2C E00524AC 8C88000C */  lw        $t0, 0xC($a0)
/* 35CF30 E00524B0 00C0182D */  daddu     $v1, $a2, $zero
/* 35CF34 E00524B4 24C60008 */  addiu     $a2, $a2, 0x8
/* 35CF38 E00524B8 AC620000 */  sw        $v0, 0x0($v1)
/* 35CF3C E00524BC AC600004 */  sw        $zero, 0x4($v1)
/* 35CF40 E00524C0 ACC50000 */  sw        $a1, 0x0($a2)
/* 35CF44 E00524C4 8C820010 */  lw        $v0, 0x10($a0)
/* 35CF48 E00524C8 ACE60000 */  sw        $a2, 0x0($a3)
/* 35CF4C E00524CC 8C42001C */  lw        $v0, 0x1C($v0)
/* 35CF50 E00524D0 3C038000 */  lui       $v1, (0x80000000 >> 16)
/* 35CF54 E00524D4 00431021 */  addu      $v0, $v0, $v1
/* 35CF58 E00524D8 ACC20004 */  sw        $v0, 0x4($a2)
/* 35CF5C E00524DC 8D0A001C */  lw        $t2, 0x1C($t0)
/* 35CF60 E00524E0 24C20008 */  addiu     $v0, $a2, 0x8
/* 35CF64 E00524E4 AFAA0098 */  sw        $t2, 0x98($sp)
/* 35CF68 E00524E8 15400009 */  bnez      $t2, .LE0052510
/* 35CF6C E00524EC ACE20000 */   sw       $v0, 0x0($a3)
/* 35CF70 E00524F0 24C20010 */  addiu     $v0, $a2, 0x10
/* 35CF74 E00524F4 ACE20000 */  sw        $v0, 0x0($a3)
/* 35CF78 E00524F8 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 35CF7C E00524FC ACC20008 */  sw        $v0, 0x8($a2)
/* 35CF80 E0052500 3C020900 */  lui       $v0, %hi(D_09000440_4154A0)
/* 35CF84 E0052504 24420440 */  addiu     $v0, $v0, %lo(D_09000440_4154A0)
/* 35CF88 E0052508 08014955 */  j         .LE0052554
/* 35CF8C E005250C ACC2000C */   sw       $v0, 0xC($a2)
.LE0052510:
/* 35CF90 E0052510 8FAA0098 */  lw        $t2, 0x98($sp)
/* 35CF94 E0052514 24020001 */  addiu     $v0, $zero, 0x1
/* 35CF98 E0052518 15420008 */  bne       $t2, $v0, .LE005253C
/* 35CF9C E005251C 24C20010 */   addiu    $v0, $a2, 0x10
/* 35CFA0 E0052520 ACE20000 */  sw        $v0, 0x0($a3)
/* 35CFA4 E0052524 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 35CFA8 E0052528 ACC20008 */  sw        $v0, 0x8($a2)
/* 35CFAC E005252C 3C020900 */  lui       $v0, %hi(D_09000390_4153F0)
/* 35CFB0 E0052530 24420390 */  addiu     $v0, $v0, %lo(D_09000390_4153F0)
/* 35CFB4 E0052534 08014955 */  j         .LE0052554
/* 35CFB8 E0052538 ACC2000C */   sw       $v0, 0xC($a2)
.LE005253C:
/* 35CFBC E005253C ACE20000 */  sw        $v0, 0x0($a3)
/* 35CFC0 E0052540 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 35CFC4 E0052544 ACC20008 */  sw        $v0, 0x8($a2)
/* 35CFC8 E0052548 3C020900 */  lui       $v0, %hi(D_090002E0_415340)
/* 35CFCC E005254C 244202E0 */  addiu     $v0, $v0, %lo(D_090002E0_415340)
/* 35CFD0 E0052550 ACC2000C */  sw        $v0, 0xC($a2)
.LE0052554:
/* 35CFD4 E0052554 27A40018 */  addiu     $a0, $sp, 0x18
/* 35CFD8 E0052558 3C120001 */  lui       $s2, (0x11630 >> 16)
/* 35CFDC E005255C 36521630 */  ori       $s2, $s2, (0x11630 & 0xFFFF)
/* 35CFE0 E0052560 0000982D */  daddu     $s3, $zero, $zero
/* 35CFE4 E0052564 3C02800A */  lui       $v0, %hi(gDisplayContext)
/* 35CFE8 E0052568 2442A674 */  addiu     $v0, $v0, %lo(gDisplayContext)
/* 35CFEC E005256C 0040B82D */  daddu     $s7, $v0, $zero
/* 35CFF0 E0052570 3C028007 */  lui       $v0, %hi(gMatrixListPos)
/* 35CFF4 E0052574 244241F0 */  addiu     $v0, $v0, %lo(gMatrixListPos)
/* 35CFF8 E0052578 0040B02D */  daddu     $s6, $v0, $zero
/* 35CFFC E005257C 3C1E0001 */  lui       $fp, (0x11630 >> 16)
/* 35D000 E0052580 37DE1630 */  ori       $fp, $fp, (0x11630 & 0xFFFF)
/* 35D004 E0052584 3C02800A */  lui       $v0, %hi(gMainGfxPos)
/* 35D008 E0052588 2442A66C */  addiu     $v0, $v0, %lo(gMainGfxPos)
/* 35D00C E005258C 0040A82D */  daddu     $s5, $v0, $zero
/* 35D010 E0052590 8D050004 */  lw        $a1, 0x4($t0)
/* 35D014 E0052594 8D060008 */  lw        $a2, 0x8($t0)
/* 35D018 E0052598 8D07000C */  lw        $a3, 0xC($t0)
/* 35D01C E005259C 0C080108 */  jal       shim_guTranslateF
/* 35D020 E00525A0 0100A02D */   daddu    $s4, $t0, $zero
/* 35D024 E00525A4 27A40018 */  addiu     $a0, $sp, 0x18
/* 35D028 E00525A8 96C50000 */  lhu       $a1, 0x0($s6)
/* 35D02C E00525AC 8EE20000 */  lw        $v0, 0x0($s7)
/* 35D030 E00525B0 00052980 */  sll       $a1, $a1, 6
/* 35D034 E00525B4 00B22821 */  addu      $a1, $a1, $s2
/* 35D038 E00525B8 0C080118 */  jal       shim_guMtxF2L
/* 35D03C E00525BC 00452821 */   addu     $a1, $v0, $a1
/* 35D040 E00525C0 3C02DA38 */  lui       $v0, (0xDA380002 >> 16)
/* 35D044 E00525C4 34420002 */  ori       $v0, $v0, (0xDA380002 & 0xFFFF)
/* 35D048 E00525C8 3C050100 */  lui       $a1, (0x1001002 >> 16)
/* 35D04C E00525CC 34A51002 */  ori       $a1, $a1, (0x1001002 & 0xFFFF)
/* 35D050 E00525D0 3C110900 */  lui       $s1, %hi(D_09000190_4151F0)
/* 35D054 E00525D4 26310190 */  addiu     $s1, $s1, %lo(D_09000190_4151F0)
/* 35D058 E00525D8 4480A000 */  mtc1      $zero, $f20
/* 35D05C E00525DC 8EA80000 */  lw        $t0, 0x0($s5)
/* 35D060 E00525E0 96C90000 */  lhu       $t1, 0x0($s6)
/* 35D064 E00525E4 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 35D068 E00525E8 4481B000 */  mtc1      $at, $f22
/* 35D06C E00525EC 0100202D */  daddu     $a0, $t0, $zero
/* 35D070 E00525F0 25080008 */  addiu     $t0, $t0, 0x8
/* 35D074 E00525F4 AC820000 */  sw        $v0, 0x0($a0)
/* 35D078 E00525F8 3122FFFF */  andi      $v0, $t1, 0xFFFF
/* 35D07C E00525FC 00021180 */  sll       $v0, $v0, 6
/* 35D080 E0052600 00521021 */  addu      $v0, $v0, $s2
/* 35D084 E0052604 25290001 */  addiu     $t1, $t1, 0x1
/* 35D088 E0052608 4406A000 */  mfc1      $a2, $f20
/* 35D08C E005260C 8EE30000 */  lw        $v1, 0x0($s7)
/* 35D090 E0052610 4407A000 */  mfc1      $a3, $f20
/* 35D094 E0052614 00621821 */  addu      $v1, $v1, $v0
/* 35D098 E0052618 AC830004 */  sw        $v1, 0x4($a0)
/* 35D09C E005261C AD050000 */  sw        $a1, 0x0($t0)
/* 35D0A0 E0052620 AD110004 */  sw        $s1, 0x4($t0)
/* 35D0A4 E0052624 E7B60010 */  swc1      $f22, 0x10($sp)
/* 35D0A8 E0052628 8E850010 */  lw        $a1, 0x10($s4)
/* 35D0AC E005262C 27A40018 */  addiu     $a0, $sp, 0x18
/* 35D0B0 E0052630 AEA80000 */  sw        $t0, 0x0($s5)
/* 35D0B4 E0052634 25080008 */  addiu     $t0, $t0, 0x8
/* 35D0B8 E0052638 A6C90000 */  sh        $t1, 0x0($s6)
/* 35D0BC E005263C 0C080104 */  jal       shim_guRotateF
/* 35D0C0 E0052640 AEA80000 */   sw       $t0, 0x0($s5)
/* 35D0C4 E0052644 27A40018 */  addiu     $a0, $sp, 0x18
/* 35D0C8 E0052648 96C50000 */  lhu       $a1, 0x0($s6)
/* 35D0CC E005264C 8EE20000 */  lw        $v0, 0x0($s7)
/* 35D0D0 E0052650 00052980 */  sll       $a1, $a1, 6
/* 35D0D4 E0052654 00B22821 */  addu      $a1, $a1, $s2
/* 35D0D8 E0052658 0C080118 */  jal       shim_guMtxF2L
/* 35D0DC E005265C 00452821 */   addu     $a1, $v0, $a1
/* 35D0E0 E0052660 3C03DA38 */  lui       $v1, (0xDA380001 >> 16)
/* 35D0E4 E0052664 34630001 */  ori       $v1, $v1, (0xDA380001 & 0xFFFF)
/* 35D0E8 E0052668 27A40018 */  addiu     $a0, $sp, 0x18
/* 35D0EC E005266C 8EA20000 */  lw        $v0, 0x0($s5)
/* 35D0F0 E0052670 4406A000 */  mfc1      $a2, $f20
/* 35D0F4 E0052674 96C80000 */  lhu       $t0, 0x0($s6)
/* 35D0F8 E0052678 0040482D */  daddu     $t1, $v0, $zero
/* 35D0FC E005267C 24420008 */  addiu     $v0, $v0, 0x8
/* 35D100 E0052680 AEA20000 */  sw        $v0, 0x0($s5)
/* 35D104 E0052684 AD230000 */  sw        $v1, 0x0($t1)
/* 35D108 E0052688 3103FFFF */  andi      $v1, $t0, 0xFFFF
/* 35D10C E005268C 00031980 */  sll       $v1, $v1, 6
/* 35D110 E0052690 00721821 */  addu      $v1, $v1, $s2
/* 35D114 E0052694 8EE20000 */  lw        $v0, 0x0($s7)
/* 35D118 E0052698 3C058007 */  lui       $a1, %hi(gCurrentCameraID)
/* 35D11C E005269C 8CA57410 */  lw        $a1, %lo(gCurrentCameraID)($a1)
/* 35D120 E00526A0 00431021 */  addu      $v0, $v0, $v1
/* 35D124 E00526A4 AD220004 */  sw        $v0, 0x4($t1)
/* 35D128 E00526A8 00051080 */  sll       $v0, $a1, 2
/* 35D12C E00526AC 00451021 */  addu      $v0, $v0, $a1
/* 35D130 E00526B0 00021080 */  sll       $v0, $v0, 2
/* 35D134 E00526B4 00451023 */  subu      $v0, $v0, $a1
/* 35D138 E00526B8 000218C0 */  sll       $v1, $v0, 3
/* 35D13C E00526BC 00431021 */  addu      $v0, $v0, $v1
/* 35D140 E00526C0 000210C0 */  sll       $v0, $v0, 3
/* 35D144 E00526C4 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 35D148 E00526C8 00220821 */  addu      $at, $at, $v0
/* 35D14C E00526CC C4201DEC */  lwc1      $f0, %lo(gCameras + 0x6C)($at)
/* 35D150 E00526D0 4407B000 */  mfc1      $a3, $f22
/* 35D154 E00526D4 46000007 */  neg.s     $f0, $f0
/* 35D158 E00526D8 44050000 */  mfc1      $a1, $f0
/* 35D15C E00526DC 25080001 */  addiu     $t0, $t0, 0x1
/* 35D160 E00526E0 A6C80000 */  sh        $t0, 0x0($s6)
/* 35D164 E00526E4 0C080104 */  jal       shim_guRotateF
/* 35D168 E00526E8 E7B40010 */   swc1     $f20, 0x10($sp)
/* 35D16C E00526EC 27B00058 */  addiu     $s0, $sp, 0x58
/* 35D170 E00526F0 8E8500C4 */  lw        $a1, 0xC4($s4)
/* 35D174 E00526F4 8E8600C8 */  lw        $a2, 0xC8($s4)
/* 35D178 E00526F8 4407A000 */  mfc1      $a3, $f20
/* 35D17C E00526FC 0C080108 */  jal       shim_guTranslateF
/* 35D180 E0052700 0200202D */   daddu    $a0, $s0, $zero
/* 35D184 E0052704 0200202D */  daddu     $a0, $s0, $zero
/* 35D188 E0052708 27A50018 */  addiu     $a1, $sp, 0x18
/* 35D18C E005270C 0C080114 */  jal       shim_guMtxCatF
/* 35D190 E0052710 00A0302D */   daddu    $a2, $a1, $zero
/* 35D194 E0052714 27A40018 */  addiu     $a0, $sp, 0x18
/* 35D198 E0052718 96C50000 */  lhu       $a1, 0x0($s6)
/* 35D19C E005271C 8EE20000 */  lw        $v0, 0x0($s7)
/* 35D1A0 E0052720 00052980 */  sll       $a1, $a1, 6
/* 35D1A4 E0052724 00B22821 */  addu      $a1, $a1, $s2
/* 35D1A8 E0052728 0C080118 */  jal       shim_guMtxF2L
/* 35D1AC E005272C 00452821 */   addu     $a1, $v0, $a1
/* 35D1B0 E0052730 3C060100 */  lui       $a2, (0x1001004 >> 16)
/* 35D1B4 E0052734 34C61004 */  ori       $a2, $a2, (0x1001004 & 0xFFFF)
/* 35D1B8 E0052738 8EA40000 */  lw        $a0, 0x0($s5)
/* 35D1BC E005273C 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 35D1C0 E0052740 0080282D */  daddu     $a1, $a0, $zero
/* 35D1C4 E0052744 24840008 */  addiu     $a0, $a0, 0x8
/* 35D1C8 E0052748 AEA40000 */  sw        $a0, 0x0($s5)
/* 35D1CC E005274C 96C20000 */  lhu       $v0, 0x0($s6)
/* 35D1D0 E0052750 2631FFF0 */  addiu     $s1, $s1, -0x10
/* 35D1D4 E0052754 ACA30000 */  sw        $v1, 0x0($a1)
/* 35D1D8 E0052758 24430001 */  addiu     $v1, $v0, 0x1
/* 35D1DC E005275C 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 35D1E0 E0052760 00021180 */  sll       $v0, $v0, 6
/* 35D1E4 E0052764 A6C30000 */  sh        $v1, 0x0($s6)
/* 35D1E8 E0052768 8EE30000 */  lw        $v1, 0x0($s7)
/* 35D1EC E005276C 00521021 */  addu      $v0, $v0, $s2
/* 35D1F0 E0052770 00621821 */  addu      $v1, $v1, $v0
/* 35D1F4 E0052774 24820008 */  addiu     $v0, $a0, 0x8
/* 35D1F8 E0052778 ACA30004 */  sw        $v1, 0x4($a1)
/* 35D1FC E005277C AEA20000 */  sw        $v0, 0x0($s5)
/* 35D200 E0052780 AC860000 */  sw        $a2, 0x0($a0)
/* 35D204 E0052784 AC910004 */  sw        $s1, 0x4($a0)
.LE0052788:
/* 35D208 E0052788 27A40018 */  addiu     $a0, $sp, 0x18
/* 35D20C E005278C 0000382D */  daddu     $a3, $zero, $zero
/* 35D210 E0052790 8E850024 */  lw        $a1, 0x24($s4)
/* 35D214 E0052794 8E860028 */  lw        $a2, 0x28($s4)
/* 35D218 E0052798 0C080108 */  jal       shim_guTranslateF
/* 35D21C E005279C 26940008 */   addiu    $s4, $s4, 0x8
/* 35D220 E00527A0 27A40018 */  addiu     $a0, $sp, 0x18
/* 35D224 E00527A4 96C50000 */  lhu       $a1, 0x0($s6)
/* 35D228 E00527A8 8EE20000 */  lw        $v0, 0x0($s7)
/* 35D22C E00527AC 00052980 */  sll       $a1, $a1, 6
/* 35D230 E00527B0 00BE2821 */  addu      $a1, $a1, $fp
/* 35D234 E00527B4 0C080118 */  jal       shim_guMtxF2L
/* 35D238 E00527B8 00452821 */   addu     $a1, $v0, $a1
/* 35D23C E00527BC 3C080100 */  lui       $t0, (0x1001000 >> 16)
/* 35D240 E00527C0 35081000 */  ori       $t0, $t0, (0x1001000 & 0xFFFF)
/* 35D244 E00527C4 3C09D838 */  lui       $t1, (0xD8380002 >> 16)
/* 35D248 E00527C8 35290002 */  ori       $t1, $t1, (0xD8380002 & 0xFFFF)
/* 35D24C E00527CC 26640003 */  addiu     $a0, $s3, 0x3
/* 35D250 E00527D0 00133100 */  sll       $a2, $s3, 4
/* 35D254 E00527D4 26730001 */  addiu     $s3, $s3, 0x1
/* 35D258 E00527D8 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 35D25C E00527DC 3084007F */  andi      $a0, $a0, 0x7F
/* 35D260 E00527E0 8EA50000 */  lw        $a1, 0x0($s5)
/* 35D264 E00527E4 00042040 */  sll       $a0, $a0, 1
/* 35D268 E00527E8 00A0382D */  daddu     $a3, $a1, $zero
/* 35D26C E00527EC 24A50008 */  addiu     $a1, $a1, 0x8
/* 35D270 E00527F0 AEA50000 */  sw        $a1, 0x0($s5)
/* 35D274 E00527F4 96C20000 */  lhu       $v0, 0x0($s6)
/* 35D278 E00527F8 00882025 */  or        $a0, $a0, $t0
/* 35D27C E00527FC ACE30000 */  sw        $v1, 0x0($a3)
/* 35D280 E0052800 24430001 */  addiu     $v1, $v0, 0x1
/* 35D284 E0052804 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 35D288 E0052808 00021180 */  sll       $v0, $v0, 6
/* 35D28C E005280C A6C30000 */  sh        $v1, 0x0($s6)
/* 35D290 E0052810 8EE30000 */  lw        $v1, 0x0($s7)
/* 35D294 E0052814 005E1021 */  addu      $v0, $v0, $fp
/* 35D298 E0052818 00621821 */  addu      $v1, $v1, $v0
/* 35D29C E005281C 24A20008 */  addiu     $v0, $a1, 0x8
/* 35D2A0 E0052820 ACE30004 */  sw        $v1, 0x4($a3)
/* 35D2A4 E0052824 AEA20000 */  sw        $v0, 0x0($s5)
/* 35D2A8 E0052828 3C020900 */  lui       $v0, %hi(D_090001A0_415200)
/* 35D2AC E005282C 244201A0 */  addiu     $v0, $v0, %lo(D_090001A0_415200)
/* 35D2B0 E0052830 00C23021 */  addu      $a2, $a2, $v0
/* 35D2B4 E0052834 24A20010 */  addiu     $v0, $a1, 0x10
/* 35D2B8 E0052838 24030040 */  addiu     $v1, $zero, 0x40
/* 35D2BC E005283C ACA40000 */  sw        $a0, 0x0($a1)
/* 35D2C0 E0052840 ACA60004 */  sw        $a2, 0x4($a1)
/* 35D2C4 E0052844 AEA20000 */  sw        $v0, 0x0($s5)
/* 35D2C8 E0052848 2A620014 */  slti      $v0, $s3, 0x14
/* 35D2CC E005284C ACA90008 */  sw        $t1, 0x8($a1)
/* 35D2D0 E0052850 1440FFCD */  bnez      $v0, .LE0052788
/* 35D2D4 E0052854 ACA3000C */   sw       $v1, 0xC($a1)
/* 35D2D8 E0052858 3C06800A */  lui       $a2, %hi(gMainGfxPos)
/* 35D2DC E005285C 24C6A66C */  addiu     $a2, $a2, %lo(gMainGfxPos)
/* 35D2E0 E0052860 8CC50000 */  lw        $a1, 0x0($a2)
/* 35D2E4 E0052864 00A0102D */  daddu     $v0, $a1, $zero
/* 35D2E8 E0052868 24A50008 */  addiu     $a1, $a1, 0x8
/* 35D2EC E005286C ACC50000 */  sw        $a1, 0x0($a2)
/* 35D2F0 E0052870 AC490000 */  sw        $t1, 0x0($v0)
/* 35D2F4 E0052874 AC430004 */  sw        $v1, 0x4($v0)
/* 35D2F8 E0052878 24A20008 */  addiu     $v0, $a1, 0x8
/* 35D2FC E005287C ACC20000 */  sw        $v0, 0x0($a2)
/* 35D300 E0052880 ACA90000 */  sw        $t1, 0x0($a1)
/* 35D304 E0052884 ACA30004 */  sw        $v1, 0x4($a1)
/* 35D308 E0052888 8FAA0098 */  lw        $t2, 0x98($sp)
/* 35D30C E005288C 29420064 */  slti      $v0, $t2, 0x64
/* 35D310 E0052890 1040001F */  beqz      $v0, .LE0052910
/* 35D314 E0052894 3C03052A */   lui      $v1, (0x52A0402 >> 16)
/* 35D318 E0052898 34630402 */  ori       $v1, $v1, (0x52A0402 & 0xFFFF)
/* 35D31C E005289C 0000982D */  daddu     $s3, $zero, $zero
/* 35D320 E00528A0 00C0402D */  daddu     $t0, $a2, $zero
/* 35D324 E00528A4 3C090500 */  lui       $t1, (0x5000002 >> 16)
/* 35D328 E00528A8 35290002 */  ori       $t1, $t1, (0x5000002 & 0xFFFF)
/* 35D32C E00528AC 24070006 */  addiu     $a3, $zero, 0x6
/* 35D330 E00528B0 24060004 */  addiu     $a2, $zero, 0x4
/* 35D334 E00528B4 24A20010 */  addiu     $v0, $a1, 0x10
/* 35D338 E00528B8 AD020000 */  sw        $v0, 0x0($t0)
/* 35D33C E00528BC ACA30008 */  sw        $v1, 0x8($a1)
/* 35D340 E00528C0 ACA0000C */  sw        $zero, 0xC($a1)
.LE00528C4:
/* 35D344 E00528C4 30E400FF */  andi      $a0, $a3, 0xFF
/* 35D348 E00528C8 24E70002 */  addiu     $a3, $a3, 0x2
/* 35D34C E00528CC 30C300FF */  andi      $v1, $a2, 0xFF
/* 35D350 E00528D0 24C60002 */  addiu     $a2, $a2, 0x2
/* 35D354 E00528D4 26730001 */  addiu     $s3, $s3, 0x1
/* 35D358 E00528D8 00031C00 */  sll       $v1, $v1, 16
/* 35D35C E00528DC 00042200 */  sll       $a0, $a0, 8
/* 35D360 E00528E0 00641825 */  or        $v1, $v1, $a0
/* 35D364 E00528E4 8D020000 */  lw        $v0, 0x0($t0)
/* 35D368 E00528E8 00691825 */  or        $v1, $v1, $t1
/* 35D36C E00528EC 0040282D */  daddu     $a1, $v0, $zero
/* 35D370 E00528F0 24420008 */  addiu     $v0, $v0, 0x8
/* 35D374 E00528F4 AD020000 */  sw        $v0, 0x0($t0)
/* 35D378 E00528F8 2A620013 */  slti      $v0, $s3, 0x13
/* 35D37C E00528FC ACA30000 */  sw        $v1, 0x0($a1)
/* 35D380 E0052900 1440FFF0 */  bnez      $v0, .LE00528C4
/* 35D384 E0052904 ACA00004 */   sw       $zero, 0x4($a1)
/* 35D388 E0052908 08014A67 */  j         .LE005299C
/* 35D38C E005290C 00000000 */   nop
.LE0052910:
/* 35D390 E0052910 3C030500 */  lui       $v1, (0x5000204 >> 16)
/* 35D394 E0052914 34630204 */  ori       $v1, $v1, (0x5000204 & 0xFFFF)
/* 35D398 E0052918 3C040500 */  lui       $a0, (0x5002A02 >> 16)
/* 35D39C E005291C 34842A02 */  ori       $a0, $a0, (0x5002A02 & 0xFFFF)
/* 35D3A0 E0052920 0000982D */  daddu     $s3, $zero, $zero
/* 35D3A4 E0052924 00C0402D */  daddu     $t0, $a2, $zero
/* 35D3A8 E0052928 3C090500 */  lui       $t1, (0x5000002 >> 16)
/* 35D3AC E005292C 35290002 */  ori       $t1, $t1, (0x5000002 & 0xFFFF)
/* 35D3B0 E0052930 24070006 */  addiu     $a3, $zero, 0x6
/* 35D3B4 E0052934 24060004 */  addiu     $a2, $zero, 0x4
/* 35D3B8 E0052938 24A20010 */  addiu     $v0, $a1, 0x10
/* 35D3BC E005293C AD020000 */  sw        $v0, 0x0($t0)
/* 35D3C0 E0052940 24A20018 */  addiu     $v0, $a1, 0x18
/* 35D3C4 E0052944 ACA30008 */  sw        $v1, 0x8($a1)
/* 35D3C8 E0052948 ACA0000C */  sw        $zero, 0xC($a1)
/* 35D3CC E005294C AD020000 */  sw        $v0, 0x0($t0)
/* 35D3D0 E0052950 ACA40010 */  sw        $a0, 0x10($a1)
/* 35D3D4 E0052954 ACA00014 */  sw        $zero, 0x14($a1)
.LE0052958:
/* 35D3D8 E0052958 30E400FF */  andi      $a0, $a3, 0xFF
/* 35D3DC E005295C 24E70002 */  addiu     $a3, $a3, 0x2
/* 35D3E0 E0052960 30C300FF */  andi      $v1, $a2, 0xFF
/* 35D3E4 E0052964 24C60002 */  addiu     $a2, $a2, 0x2
/* 35D3E8 E0052968 26730001 */  addiu     $s3, $s3, 0x1
/* 35D3EC E005296C 00031C00 */  sll       $v1, $v1, 16
/* 35D3F0 E0052970 00042200 */  sll       $a0, $a0, 8
/* 35D3F4 E0052974 00641825 */  or        $v1, $v1, $a0
/* 35D3F8 E0052978 8D020000 */  lw        $v0, 0x0($t0)
/* 35D3FC E005297C 00691825 */  or        $v1, $v1, $t1
/* 35D400 E0052980 0040282D */  daddu     $a1, $v0, $zero
/* 35D404 E0052984 24420008 */  addiu     $v0, $v0, 0x8
/* 35D408 E0052988 AD020000 */  sw        $v0, 0x0($t0)
/* 35D40C E005298C 2A620013 */  slti      $v0, $s3, 0x13
/* 35D410 E0052990 ACA30000 */  sw        $v1, 0x0($a1)
/* 35D414 E0052994 1440FFF0 */  bnez      $v0, .LE0052958
/* 35D418 E0052998 ACA00004 */   sw       $zero, 0x4($a1)
.LE005299C:
/* 35D41C E005299C 8FBF00C4 */  lw        $ra, 0xC4($sp)
/* 35D420 E00529A0 8FBE00C0 */  lw        $fp, 0xC0($sp)
/* 35D424 E00529A4 8FB700BC */  lw        $s7, 0xBC($sp)
/* 35D428 E00529A8 8FB600B8 */  lw        $s6, 0xB8($sp)
/* 35D42C E00529AC 8FB500B4 */  lw        $s5, 0xB4($sp)
/* 35D430 E00529B0 8FB400B0 */  lw        $s4, 0xB0($sp)
/* 35D434 E00529B4 8FB300AC */  lw        $s3, 0xAC($sp)
/* 35D438 E00529B8 8FB200A8 */  lw        $s2, 0xA8($sp)
/* 35D43C E00529BC 8FB100A4 */  lw        $s1, 0xA4($sp)
/* 35D440 E00529C0 8FB000A0 */  lw        $s0, 0xA0($sp)
/* 35D444 E00529C4 D7B600D0 */  ldc1      $f22, 0xD0($sp)
/* 35D448 E00529C8 D7B400C8 */  ldc1      $f20, 0xC8($sp)
/* 35D44C E00529CC 03E00008 */  jr        $ra
/* 35D450 E00529D0 27BD00D8 */   addiu    $sp, $sp, 0xD8
/* 35D454 E00529D4 00000000 */  nop
/* 35D458 E00529D8 00000000 */  nop
/* 35D45C E00529DC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void sleep_bubble_appendGfx(void* effect) {
    SleepBubbleFXData* data = ((EffectInstance*)effect)->data.sleepBubble;
    Matrix4f sp18, sp58;
    s32 timeLeft;
    s32 i;

    gDPPipeSync(gMainGfxPos++);
    gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));

    timeLeft = data->timeLeft;
    if (timeLeft == 0) {
        gSPDisplayList(gMainGfxPos++, D_09000440_35D950);
    } else if (timeLeft == 1) {
        gSPDisplayList(gMainGfxPos++, D_09000390_35D8A0);
    } else {
        gSPDisplayList(gMainGfxPos++, D_090002E0_35D7F0);
    }

    shim_guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z);
    shim_guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);

    gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++],
              G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
    gSPVertex(gMainGfxPos++, &D_09000180_35D690[1], 1, 0);

    shim_guRotateF(sp18, data->unk_10, 0.0f, 0.0f, 1.0f);
    shim_guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);
    gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++],
              G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
    shim_guRotateF(sp18, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f);
    shim_guTranslateF(sp58, data->unk_C4, data->unk_C8, 0.0f);
    shim_guMtxCatF(sp58, sp18, sp18);
    shim_guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);

    gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++],
              G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
    gSPVertex(gMainGfxPos++, &D_09000180_35D690[0], 1, 1);

    for (i = 0; i < ARRAY_COUNT(data->points); i++) {
        shim_guTranslateF(sp18, data->points[i].x, data->points[i].y, 0.0f);
        shim_guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);
        gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++],
                  G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
        gSPVertex(gMainGfxPos++, &D_09000180_35D690[i + 2], 1, i + 2);
        gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    }

    gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);

    if (timeLeft < 100) {
        gSP1Triangle(gMainGfxPos++, 21, 2, 1, 0);

        for (i = 0; i < ARRAY_COUNT(data->points) - 1; i++) {
            gSP1Triangle(gMainGfxPos++, i + 2, i + 3, 1, 0);
        }
    } else {
        gSP1Triangle(gMainGfxPos++, 0, 1, 2, 0);
        gSP1Triangle(gMainGfxPos++, 0, 21, 1, 0);

        for (i = 0; i < ARRAY_COUNT(data->points) - 1; i++) {
            gSP1Triangle(gMainGfxPos++, i + 2, i + 3, 1, 0);
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel render_hud_elements_backUI
/* D8910 80142210 27BDFAB0 */  addiu     $sp, $sp, -0x550
/* D8914 80142214 3C038016 */  lui       $v1, %hi(D_80159180)
/* D8918 80142218 24639180 */  addiu     $v1, $v1, %lo(D_80159180)
/* D891C 8014221C AFBF054C */  sw        $ra, 0x54C($sp)
/* D8920 80142220 AFBE0548 */  sw        $fp, 0x548($sp)
/* D8924 80142224 AFB70544 */  sw        $s7, 0x544($sp)
/* D8928 80142228 AFB60540 */  sw        $s6, 0x540($sp)
/* D892C 8014222C AFB5053C */  sw        $s5, 0x53C($sp)
/* D8930 80142230 AFB40538 */  sw        $s4, 0x538($sp)
/* D8934 80142234 AFB30534 */  sw        $s3, 0x534($sp)
/* D8938 80142238 AFB20530 */  sw        $s2, 0x530($sp)
/* D893C 8014223C AFB1052C */  sw        $s1, 0x52C($sp)
/* D8940 80142240 AFB00528 */  sw        $s0, 0x528($sp)
/* D8944 80142244 8C620000 */  lw        $v0, 0x0($v1)
/* D8948 80142248 24420001 */  addiu     $v0, $v0, 0x1
/* D894C 8014224C AC620000 */  sw        $v0, 0x0($v1)
/* D8950 80142250 28420003 */  slti      $v0, $v0, 0x3
/* D8954 80142254 50400001 */  beql      $v0, $zero, .L8014225C
/* D8958 80142258 AC600000 */   sw       $zero, 0x0($v1)
.L8014225C:
/* D895C 8014225C 0000F02D */  daddu     $fp, $zero, $zero
/* D8960 80142260 03C0B82D */  daddu     $s7, $fp, $zero
/* D8964 80142264 3C075021 */  lui       $a3, (0x50210080 >> 16)
/* D8968 80142268 34E70080 */  ori       $a3, $a3, (0x50210080 & 0xFFFF)
/* D896C 8014226C 27A60028 */  addiu     $a2, $sp, 0x28
/* D8970 80142270 3C03800A */  lui       $v1, %hi(gMainGfxPos)
/* D8974 80142274 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
/* D8978 80142278 8C620000 */  lw        $v0, 0x0($v1)
/* D897C 8014227C 3C058015 */  lui       $a1, %hi(gHudElements)
/* D8980 80142280 8CA57960 */  lw        $a1, %lo(gHudElements)($a1)
/* D8984 80142284 0040202D */  daddu     $a0, $v0, $zero
/* D8988 80142288 24420008 */  addiu     $v0, $v0, 0x8
/* D898C 8014228C AC620000 */  sw        $v0, 0x0($v1)
/* D8990 80142290 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* D8994 80142294 AC820000 */  sw        $v0, 0x0($a0)
/* D8998 80142298 3C020015 */  lui       $v0, %hi(D_14F078)
/* D899C 8014229C 2442F078 */  addiu     $v0, $v0, %lo(D_14F078)
/* D89A0 801422A0 AC820004 */  sw        $v0, 0x4($a0)
.L801422A4:
/* D89A4 801422A4 8CB00000 */  lw        $s0, 0x0($a1)
/* D89A8 801422A8 52000014 */  beql      $s0, $zero, .L801422FC
/* D89AC 801422AC 26F70001 */   addiu    $s7, $s7, 0x1
/* D89B0 801422B0 8E030000 */  lw        $v1, 0x0($s0)
/* D89B4 801422B4 50600011 */  beql      $v1, $zero, .L801422FC
/* D89B8 801422B8 26F70001 */   addiu    $s7, $s7, 0x1
/* D89BC 801422BC 30620002 */  andi      $v0, $v1, 0x2
/* D89C0 801422C0 5440000E */  bnel      $v0, $zero, .L801422FC
/* D89C4 801422C4 26F70001 */   addiu    $s7, $s7, 0x1
/* D89C8 801422C8 00671024 */  and       $v0, $v1, $a3
/* D89CC 801422CC 5440000B */  bnel      $v0, $zero, .L801422FC
/* D89D0 801422D0 26F70001 */   addiu    $s7, $s7, 0x1
/* D89D4 801422D4 30620040 */  andi      $v0, $v1, 0x40
/* D89D8 801422D8 54400008 */  bnel      $v0, $zero, .L801422FC
/* D89DC 801422DC 26F70001 */   addiu    $s7, $s7, 0x1
/* D89E0 801422E0 82020045 */  lb        $v0, 0x45($s0)
/* D89E4 801422E4 04420005 */  bltzl     $v0, .L801422FC
/* D89E8 801422E8 26F70001 */   addiu    $s7, $s7, 0x1
/* D89EC 801422EC ACD70000 */  sw        $s7, 0x0($a2)
/* D89F0 801422F0 24C60004 */  addiu     $a2, $a2, 0x4
/* D89F4 801422F4 27DE0001 */  addiu     $fp, $fp, 0x1
/* D89F8 801422F8 26F70001 */  addiu     $s7, $s7, 0x1
.L801422FC:
/* D89FC 801422FC 2AE20140 */  slti      $v0, $s7, 0x140
/* D8A00 80142300 1440FFE8 */  bnez      $v0, .L801422A4
/* D8A04 80142304 24A50004 */   addiu    $a1, $a1, 0x4
/* D8A08 80142308 27C2FFFF */  addiu     $v0, $fp, -0x1
/* D8A0C 8014230C 18400024 */  blez      $v0, .L801423A0
/* D8A10 80142310 0000B82D */   daddu    $s7, $zero, $zero
/* D8A14 80142314 3C0D8015 */  lui       $t5, %hi(gHudElements)
/* D8A18 80142318 25AD7960 */  addiu     $t5, $t5, %lo(gHudElements)
/* D8A1C 8014231C 27AC0028 */  addiu     $t4, $sp, 0x28
/* D8A20 80142320 0180582D */  daddu     $t3, $t4, $zero
.L80142324:
/* D8A24 80142324 26E80001 */  addiu     $t0, $s7, 0x1
/* D8A28 80142328 011E102A */  slt       $v0, $t0, $fp
/* D8A2C 8014232C 50400018 */  beql      $v0, $zero, .L80142390
/* D8A30 80142330 26F70001 */   addiu    $s7, $s7, 0x1
/* D8A34 80142334 0160502D */  daddu     $t2, $t3, $zero
/* D8A38 80142338 8DA90000 */  lw        $t1, 0x0($t5)
/* D8A3C 8014233C 00081080 */  sll       $v0, $t0, 2
/* D8A40 80142340 004C3021 */  addu      $a2, $v0, $t4
.L80142344:
/* D8A44 80142344 8D470000 */  lw        $a3, 0x0($t2)
/* D8A48 80142348 8CC50000 */  lw        $a1, 0x0($a2)
/* D8A4C 8014234C 00071880 */  sll       $v1, $a3, 2
/* D8A50 80142350 00691821 */  addu      $v1, $v1, $t1
/* D8A54 80142354 00051080 */  sll       $v0, $a1, 2
/* D8A58 80142358 00491021 */  addu      $v0, $v0, $t1
/* D8A5C 8014235C 8C630000 */  lw        $v1, 0x0($v1)
/* D8A60 80142360 8C440000 */  lw        $a0, 0x0($v0)
/* D8A64 80142364 80620044 */  lb        $v0, 0x44($v1)
/* D8A68 80142368 80830044 */  lb        $v1, 0x44($a0)
/* D8A6C 8014236C 0043102A */  slt       $v0, $v0, $v1
/* D8A70 80142370 10400003 */  beqz      $v0, .L80142380
/* D8A74 80142374 25080001 */   addiu    $t0, $t0, 0x1
/* D8A78 80142378 AD450000 */  sw        $a1, 0x0($t2)
/* D8A7C 8014237C ACC70000 */  sw        $a3, 0x0($a2)
.L80142380:
/* D8A80 80142380 011E102A */  slt       $v0, $t0, $fp
/* D8A84 80142384 1440FFEF */  bnez      $v0, .L80142344
/* D8A88 80142388 24C60004 */   addiu    $a2, $a2, 0x4
/* D8A8C 8014238C 26F70001 */  addiu     $s7, $s7, 0x1
.L80142390:
/* D8A90 80142390 27C2FFFF */  addiu     $v0, $fp, -0x1
/* D8A94 80142394 02E2102A */  slt       $v0, $s7, $v0
/* D8A98 80142398 1440FFE2 */  bnez      $v0, .L80142324
/* D8A9C 8014239C 256B0004 */   addiu    $t3, $t3, 0x4
.L801423A0:
/* D8AA0 801423A0 1BC000D2 */  blez      $fp, .L801426EC
/* D8AA4 801423A4 0000B82D */   daddu    $s7, $zero, $zero
/* D8AA8 801423A8 00171080 */  sll       $v0, $s7, 2
.L801423AC:
/* D8AAC 801423AC 03A21021 */  addu      $v0, $sp, $v0
/* D8AB0 801423B0 8C420028 */  lw        $v0, 0x28($v0)
/* D8AB4 801423B4 3C038015 */  lui       $v1, %hi(gHudElements)
/* D8AB8 801423B8 8C637960 */  lw        $v1, %lo(gHudElements)($v1)
/* D8ABC 801423BC 00021080 */  sll       $v0, $v0, 2
/* D8AC0 801423C0 00431021 */  addu      $v0, $v0, $v1
/* D8AC4 801423C4 8C500000 */  lw        $s0, 0x0($v0)
/* D8AC8 801423C8 8E020004 */  lw        $v0, 0x4($s0)
/* D8ACC 801423CC 104000C7 */  beqz      $v0, .L801426EC
/* D8AD0 801423D0 00000000 */   nop
/* D8AD4 801423D4 8E030000 */  lw        $v1, 0x0($s0)
/* D8AD8 801423D8 30620100 */  andi      $v0, $v1, 0x100
/* D8ADC 801423DC 1440005B */  bnez      $v0, .L8014254C
/* D8AE0 801423E0 3C0E0010 */   lui      $t6, (0x100000 >> 16)
/* D8AE4 801423E4 006E1024 */  and       $v0, $v1, $t6
/* D8AE8 801423E8 1440000B */  bnez      $v0, .L80142418
/* D8AEC 801423EC 00000000 */   nop
/* D8AF0 801423F0 82030046 */  lb        $v1, 0x46($s0)
/* D8AF4 801423F4 3C0E8015 */  lui       $t6, %hi(gHudElementSizes)
/* D8AF8 801423F8 25CEEFCC */  addiu     $t6, $t6, %lo(gHudElementSizes)
/* D8AFC 801423FC 00031040 */  sll       $v0, $v1, 1
/* D8B00 80142400 00431021 */  addu      $v0, $v0, $v1
/* D8B04 80142404 00021040 */  sll       $v0, $v0, 1
/* D8B08 80142408 004E1021 */  addu      $v0, $v0, $t6
/* D8B0C 8014240C 84560000 */  lh        $s6, 0x0($v0)
/* D8B10 80142410 08050908 */  j         .L80142420
/* D8B14 80142414 84550002 */   lh       $s5, 0x2($v0)
.L80142418:
/* D8B18 80142418 9216004E */  lbu       $s6, 0x4E($s0)
/* D8B1C 8014241C 9215004F */  lbu       $s5, 0x4F($s0)
.L80142420:
/* D8B20 80142420 8E030000 */  lw        $v1, 0x0($s0)
/* D8B24 80142424 30620010 */  andi      $v0, $v1, 0x10
/* D8B28 80142428 14400013 */  bnez      $v0, .L80142478
/* D8B2C 8014242C 3C0E0010 */   lui      $t6, (0x100000 >> 16)
/* D8B30 80142430 006E1024 */  and       $v0, $v1, $t6
/* D8B34 80142434 1440000C */  bnez      $v0, .L80142468
/* D8B38 80142438 00000000 */   nop
/* D8B3C 8014243C 82030045 */  lb        $v1, 0x45($s0)
/* D8B40 80142440 3C0E8015 */  lui       $t6, %hi(gHudElementSizes)
/* D8B44 80142444 25CEEFCC */  addiu     $t6, $t6, %lo(gHudElementSizes)
/* D8B48 80142448 00031040 */  sll       $v0, $v1, 1
/* D8B4C 8014244C 00431021 */  addu      $v0, $v0, $v1
/* D8B50 80142450 00021040 */  sll       $v0, $v0, 1
/* D8B54 80142454 004E1021 */  addu      $v0, $v0, $t6
/* D8B58 80142458 84510000 */  lh        $s1, 0x0($v0)
/* D8B5C 8014245C 84520002 */  lh        $s2, 0x2($v0)
/* D8B60 80142460 08050921 */  j         .L80142484
/* D8B64 80142464 00111023 */   negu     $v0, $s1
.L80142468:
/* D8B68 80142468 92110050 */  lbu       $s1, 0x50($s0)
/* D8B6C 8014246C 92120051 */  lbu       $s2, 0x51($s0)
/* D8B70 80142470 08050921 */  j         .L80142484
/* D8B74 80142474 00111023 */   negu     $v0, $s1
.L80142478:
/* D8B78 80142478 92110048 */  lbu       $s1, 0x48($s0)
/* D8B7C 8014247C 92120049 */  lbu       $s2, 0x49($s0)
/* D8B80 80142480 00111023 */  negu      $v0, $s1
.L80142484:
/* D8B84 80142484 00021FC2 */  srl       $v1, $v0, 31
/* D8B88 80142488 00431021 */  addu      $v0, $v0, $v1
/* D8B8C 8014248C 00029843 */  sra       $s3, $v0, 1
/* D8B90 80142490 00121023 */  negu      $v0, $s2
/* D8B94 80142494 00021FC2 */  srl       $v1, $v0, 31
/* D8B98 80142498 00431021 */  addu      $v0, $v0, $v1
/* D8B9C 8014249C 0002A043 */  sra       $s4, $v0, 1
/* D8BA0 801424A0 8E030000 */  lw        $v1, 0x0($s0)
/* D8BA4 801424A4 30620800 */  andi      $v0, $v1, 0x800
/* D8BA8 801424A8 14400026 */  bnez      $v0, .L80142544
/* D8BAC 801424AC 3C0E2000 */   lui      $t6, (0x20000000 >> 16)
/* D8BB0 801424B0 006E1024 */  and       $v0, $v1, $t6
/* D8BB4 801424B4 10400012 */  beqz      $v0, .L80142500
/* D8BB8 801424B8 0200202D */   daddu    $a0, $s0, $zero
/* D8BBC 801424BC 02C0282D */  daddu     $a1, $s6, $zero
/* D8BC0 801424C0 02A0302D */  daddu     $a2, $s5, $zero
/* D8BC4 801424C4 00113C00 */  sll       $a3, $s1, 16
/* D8BC8 801424C8 00073C03 */  sra       $a3, $a3, 16
/* D8BCC 801424CC 00121400 */  sll       $v0, $s2, 16
/* D8BD0 801424D0 00021403 */  sra       $v0, $v0, 16
/* D8BD4 801424D4 AFA20010 */  sw        $v0, 0x10($sp)
/* D8BD8 801424D8 00131400 */  sll       $v0, $s3, 16
/* D8BDC 801424DC 00021403 */  sra       $v0, $v0, 16
/* D8BE0 801424E0 AFA20014 */  sw        $v0, 0x14($sp)
/* D8BE4 801424E4 00141400 */  sll       $v0, $s4, 16
/* D8BE8 801424E8 00021403 */  sra       $v0, $v0, 16
/* D8BEC 801424EC 240E0001 */  addiu     $t6, $zero, 0x1
/* D8BF0 801424F0 AFA20018 */  sw        $v0, 0x18($sp)
/* D8BF4 801424F4 AFAE001C */  sw        $t6, 0x1C($sp)
/* D8BF8 801424F8 0C04FDC1 */  jal       hud_element_draw_rect
/* D8BFC 801424FC AFAE0020 */   sw       $t6, 0x20($sp)
.L80142500:
/* D8C00 80142500 0200202D */  daddu     $a0, $s0, $zero
/* D8C04 80142504 02C0282D */  daddu     $a1, $s6, $zero
/* D8C08 80142508 02A0302D */  daddu     $a2, $s5, $zero
/* D8C0C 8014250C 00113C00 */  sll       $a3, $s1, 16
/* D8C10 80142510 00073C03 */  sra       $a3, $a3, 16
/* D8C14 80142514 00121400 */  sll       $v0, $s2, 16
/* D8C18 80142518 00021403 */  sra       $v0, $v0, 16
/* D8C1C 8014251C AFA20010 */  sw        $v0, 0x10($sp)
/* D8C20 80142520 00131400 */  sll       $v0, $s3, 16
/* D8C24 80142524 00021403 */  sra       $v0, $v0, 16
/* D8C28 80142528 AFA20014 */  sw        $v0, 0x14($sp)
/* D8C2C 8014252C 00141400 */  sll       $v0, $s4, 16
/* D8C30 80142530 00021403 */  sra       $v0, $v0, 16
/* D8C34 80142534 240E0001 */  addiu     $t6, $zero, 0x1
/* D8C38 80142538 AFA20018 */  sw        $v0, 0x18($sp)
/* D8C3C 8014253C 080509B5 */  j         .L801426D4
/* D8C40 80142540 AFAE001C */   sw       $t6, 0x1C($sp)
.L80142544:
/* D8C44 80142544 08050993 */  j         .L8014264C
/* D8C48 80142548 006E1024 */   and      $v0, $v1, $t6
.L8014254C:
/* D8C4C 8014254C 006E1024 */  and       $v0, $v1, $t6
/* D8C50 80142550 1440000B */  bnez      $v0, .L80142580
/* D8C54 80142554 00000000 */   nop
/* D8C58 80142558 82030046 */  lb        $v1, 0x46($s0)
/* D8C5C 8014255C 3C0E8015 */  lui       $t6, %hi(gHudElementSizes)
/* D8C60 80142560 25CEEFCC */  addiu     $t6, $t6, %lo(gHudElementSizes)
/* D8C64 80142564 00031040 */  sll       $v0, $v1, 1
/* D8C68 80142568 00431021 */  addu      $v0, $v0, $v1
/* D8C6C 8014256C 00021040 */  sll       $v0, $v0, 1
/* D8C70 80142570 004E1021 */  addu      $v0, $v0, $t6
/* D8C74 80142574 84560000 */  lh        $s6, 0x0($v0)
/* D8C78 80142578 08050962 */  j         .L80142588
/* D8C7C 8014257C 84550002 */   lh       $s5, 0x2($v0)
.L80142580:
/* D8C80 80142580 9216004E */  lbu       $s6, 0x4E($s0)
/* D8C84 80142584 9215004F */  lbu       $s5, 0x4F($s0)
.L80142588:
/* D8C88 80142588 C6000028 */  lwc1      $f0, 0x28($s0)
/* D8C8C 8014258C C606002C */  lwc1      $f6, 0x2C($s0)
/* D8C90 80142590 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* D8C94 80142594 44811000 */  mtc1      $at, $f2
/* D8C98 80142598 46000307 */  neg.s     $f12, $f0
/* D8C9C 8014259C 46026302 */  mul.s     $f12, $f12, $f2
/* D8CA0 801425A0 00000000 */  nop
/* D8CA4 801425A4 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* D8CA8 801425A8 44814000 */  mtc1      $at, $f8
/* D8CAC 801425AC 3C014480 */  lui       $at, (0x44800000 >> 16)
/* D8CB0 801425B0 44815000 */  mtc1      $at, $f10
/* D8CB4 801425B4 4600038D */  trunc.w.s $f14, $f0
/* D8CB8 801425B8 44117000 */  mfc1      $s1, $f14
/* D8CBC 801425BC 4600338D */  trunc.w.s $f14, $f6
/* D8CC0 801425C0 44127000 */  mfc1      $s2, $f14
/* D8CC4 801425C4 46003187 */  neg.s     $f6, $f6
/* D8CC8 801425C8 46023182 */  mul.s     $f6, $f6, $f2
/* D8CCC 801425CC 00000000 */  nop
/* D8CD0 801425D0 44912000 */  mtc1      $s1, $f4
/* D8CD4 801425D4 00000000 */  nop
/* D8CD8 801425D8 46802120 */  cvt.s.w   $f4, $f4
/* D8CDC 801425DC 44960000 */  mtc1      $s6, $f0
/* D8CE0 801425E0 00000000 */  nop
/* D8CE4 801425E4 46800020 */  cvt.s.w   $f0, $f0
/* D8CE8 801425E8 46002103 */  div.s     $f4, $f4, $f0
/* D8CEC 801425EC 46044103 */  div.s     $f4, $f8, $f4
/* D8CF0 801425F0 460A2102 */  mul.s     $f4, $f4, $f10
/* D8CF4 801425F4 00000000 */  nop
/* D8CF8 801425F8 44921000 */  mtc1      $s2, $f2
/* D8CFC 801425FC 00000000 */  nop
/* D8D00 80142600 468010A0 */  cvt.s.w   $f2, $f2
/* D8D04 80142604 44950000 */  mtc1      $s5, $f0
/* D8D08 80142608 00000000 */  nop
/* D8D0C 8014260C 46800020 */  cvt.s.w   $f0, $f0
/* D8D10 80142610 46001083 */  div.s     $f2, $f2, $f0
/* D8D14 80142614 46024083 */  div.s     $f2, $f8, $f2
/* D8D18 80142618 460A1082 */  mul.s     $f2, $f2, $f10
/* D8D1C 8014261C 00000000 */  nop
/* D8D20 80142620 8E020000 */  lw        $v0, 0x0($s0)
/* D8D24 80142624 4600638D */  trunc.w.s $f14, $f12
/* D8D28 80142628 44137000 */  mfc1      $s3, $f14
/* D8D2C 8014262C 4600338D */  trunc.w.s $f14, $f6
/* D8D30 80142630 44147000 */  mfc1      $s4, $f14
/* D8D34 80142634 4600238D */  trunc.w.s $f14, $f4
/* D8D38 80142638 E60E0034 */  swc1      $f14, 0x34($s0)
/* D8D3C 8014263C 4600138D */  trunc.w.s $f14, $f2
/* D8D40 80142640 E60E0038 */  swc1      $f14, 0x38($s0)
/* D8D44 80142644 3C0E2000 */  lui       $t6, (0x20000000 >> 16)
/* D8D48 80142648 004E1024 */  and       $v0, $v0, $t6
.L8014264C:
/* D8D4C 8014264C 10400012 */  beqz      $v0, .L80142698
/* D8D50 80142650 0200202D */   daddu    $a0, $s0, $zero
/* D8D54 80142654 02C0282D */  daddu     $a1, $s6, $zero
/* D8D58 80142658 02A0302D */  daddu     $a2, $s5, $zero
/* D8D5C 8014265C 00113C00 */  sll       $a3, $s1, 16
/* D8D60 80142660 00073C03 */  sra       $a3, $a3, 16
/* D8D64 80142664 00121400 */  sll       $v0, $s2, 16
/* D8D68 80142668 00021403 */  sra       $v0, $v0, 16
/* D8D6C 8014266C AFA20010 */  sw        $v0, 0x10($sp)
/* D8D70 80142670 00131400 */  sll       $v0, $s3, 16
/* D8D74 80142674 00021403 */  sra       $v0, $v0, 16
/* D8D78 80142678 AFA20014 */  sw        $v0, 0x14($sp)
/* D8D7C 8014267C 00141400 */  sll       $v0, $s4, 16
/* D8D80 80142680 00021403 */  sra       $v0, $v0, 16
/* D8D84 80142684 240E0001 */  addiu     $t6, $zero, 0x1
/* D8D88 80142688 AFA20018 */  sw        $v0, 0x18($sp)
/* D8D8C 8014268C AFA0001C */  sw        $zero, 0x1C($sp)
/* D8D90 80142690 0C04FDC1 */  jal       hud_element_draw_rect
/* D8D94 80142694 AFAE0020 */   sw       $t6, 0x20($sp)
.L80142698:
/* D8D98 80142698 0200202D */  daddu     $a0, $s0, $zero
/* D8D9C 8014269C 02C0282D */  daddu     $a1, $s6, $zero
/* D8DA0 801426A0 02A0302D */  daddu     $a2, $s5, $zero
/* D8DA4 801426A4 00113C00 */  sll       $a3, $s1, 16
/* D8DA8 801426A8 00073C03 */  sra       $a3, $a3, 16
/* D8DAC 801426AC 00121400 */  sll       $v0, $s2, 16
/* D8DB0 801426B0 00021403 */  sra       $v0, $v0, 16
/* D8DB4 801426B4 AFA20010 */  sw        $v0, 0x10($sp)
/* D8DB8 801426B8 00131400 */  sll       $v0, $s3, 16
/* D8DBC 801426BC 00021403 */  sra       $v0, $v0, 16
/* D8DC0 801426C0 AFA20014 */  sw        $v0, 0x14($sp)
/* D8DC4 801426C4 00141400 */  sll       $v0, $s4, 16
/* D8DC8 801426C8 00021403 */  sra       $v0, $v0, 16
/* D8DCC 801426CC AFA20018 */  sw        $v0, 0x18($sp)
/* D8DD0 801426D0 AFA0001C */  sw        $zero, 0x1C($sp)
.L801426D4:
/* D8DD4 801426D4 0C04FDC1 */  jal       hud_element_draw_rect
/* D8DD8 801426D8 AFA00020 */   sw       $zero, 0x20($sp)
/* D8DDC 801426DC 26F70001 */  addiu     $s7, $s7, 0x1
/* D8DE0 801426E0 02FE102A */  slt       $v0, $s7, $fp
/* D8DE4 801426E4 1440FF31 */  bnez      $v0, .L801423AC
/* D8DE8 801426E8 00171080 */   sll      $v0, $s7, 2
.L801426EC:
/* D8DEC 801426EC 8FBF054C */  lw        $ra, 0x54C($sp)
/* D8DF0 801426F0 8FBE0548 */  lw        $fp, 0x548($sp)
/* D8DF4 801426F4 8FB70544 */  lw        $s7, 0x544($sp)
/* D8DF8 801426F8 8FB60540 */  lw        $s6, 0x540($sp)
/* D8DFC 801426FC 8FB5053C */  lw        $s5, 0x53C($sp)
/* D8E00 80142700 8FB40538 */  lw        $s4, 0x538($sp)
/* D8E04 80142704 8FB30534 */  lw        $s3, 0x534($sp)
/* D8E08 80142708 8FB20530 */  lw        $s2, 0x530($sp)
/* D8E0C 8014270C 8FB1052C */  lw        $s1, 0x52C($sp)
/* D8E10 80142710 8FB00528 */  lw        $s0, 0x528($sp)
/* D8E14 80142714 03E00008 */  jr        $ra
/* D8E18 80142718 27BD0550 */   addiu    $sp, $sp, 0x550

### DECOMPILED C INSTRUCTIONS:

void render_hud_elements_backUI(void) {
    s32 i, count, j;
    s32 sortedElements[ARRAY_COUNT(*gHudElements)];
    s32 el1, el2;
    s32 texSizeX, texSizeY;
    s32 drawSizeX, drawSizeY, offsetX, offsetY;
    HudElement* hudElement;

    D_80159180++;
    if (D_80159180 > 2) {
        D_80159180 = 0;
    }
    gSPDisplayList(gMainGfxPos++, VIRTUAL_TO_PHYSICAL(gHudElementsDLBackUI));

    count = 0;
    for (i = 0; i < ARRAY_COUNT(*gHudElements); i++) {
        hudElement = (*gHudElements)[i];
        if (hudElement != NULL) {
            s32 flags = hudElement->flags;
            if (flags && !(flags & HUD_ELEMENT_FLAG_DISABLED)) {
                if (!(flags & (HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_TRANSFORM | HUD_ELEMENT_FLAG_200000 | HUD_ELEMENT_FLAG_10000000 | HUD_ELEMENT_FLAG_40000000))) {
                    if (!(flags & HUD_ELEMENT_FLAG_FRONTUI) && hudElement->drawSizePreset >= 0) {
                        sortedElements[count++] = i;
                    }
                }
            }
        }
    }

    for (i = 0; i < count - 1; i++) {
        for (j = i + 1; j < count; j++) {
            el1 = sortedElements[i];
            el2 = sortedElements[j];
            if ((*gHudElements)[el1]->worldPosOffset.z < (*gHudElements)[el2]->worldPosOffset.z) {
                sortedElements[i] = el2;
                sortedElements[j] = el1;
            }
        }
    }

    for (i = 0; i < count; i++) {
        hudElement = (*gHudElements)[sortedElements[i]];

        if (hudElement->readPos == NULL) {
            break;
        }

        if (!(hudElement->flags & HUD_ELEMENT_FLAG_FIXEDSCALE)) {
            if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
                texSizeX = gHudElementSizes[hudElement->tileSizePreset].width;
                texSizeY = gHudElementSizes[hudElement->tileSizePreset].height;
            } else {
                texSizeX = hudElement->customImageSize.x;
                texSizeY = hudElement->customImageSize.y;
            }

            if (!(hudElement->flags & HUD_ELEMENT_FLAG_SCALED)) {
                if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
                    drawSizeX = gHudElementSizes[hudElement->drawSizePreset].width;
                    drawSizeY = gHudElementSizes[hudElement->drawSizePreset].height;
                    offsetX = -drawSizeX / 2;
                    offsetY = -drawSizeY / 2;
                } else {
                    // TODO find better match
                    do {
                    drawSizeX = hudElement->customDrawSize.x;
                    drawSizeY = hudElement->customDrawSize.y;
                    offsetX = -drawSizeX / 2;
                    } while (0);
                    offsetY = -drawSizeY / 2;

                }
            } else {
                drawSizeX = hudElement->sizeX;
                drawSizeY = hudElement->sizeY;
                offsetX = -drawSizeX / 2;
                offsetY = -drawSizeY / 2;
            }

            if (!(hudElement->flags & HUD_ELEMENT_FLAG_REPEATED)) {
                if (hudElement->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
                    hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, TRUE, TRUE);
                }
                hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, TRUE, FALSE);
            } else {
                if (hudElement->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
                    hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, TRUE);
                }
                hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, FALSE);
            }
        } else {
            f32 xScaled, yScaled;

            if (!(hudElement->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
                texSizeX = gHudElementSizes[hudElement->tileSizePreset].width;
                texSizeY = gHudElementSizes[hudElement->tileSizePreset].height;
            } else {
                texSizeX = hudElement->customImageSize.x;
                texSizeY = hudElement->customImageSize.y;
            }

            drawSizeX = hudElement->unkImgScale[0];
            drawSizeY = hudElement->unkImgScale[1];

            offsetX = -hudElement->unkImgScale[0] / 2;
            offsetY = -hudElement->unkImgScale[1] / 2;

            xScaled = (f32) drawSizeX / (f32) texSizeX;
            yScaled = (f32) drawSizeY / (f32) texSizeY;

            xScaled = 1.0f / xScaled;
            yScaled = 1.0f / yScaled;

            hudElement->widthScale = X10(xScaled);
            hudElement->heightScale = X10(yScaled);

            if (hudElement->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
                hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, TRUE);
            }
            hud_element_draw_rect(hudElement, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, FALSE);
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel lightning_appendGfx
/* 36E7B8 E006C5E8 27BDFF18 */  addiu     $sp, $sp, -0xE8
/* 36E7BC E006C5EC 3C05DB06 */  lui       $a1, (0xDB060024 >> 16)
/* 36E7C0 E006C5F0 AFB400C0 */  sw        $s4, 0xC0($sp)
/* 36E7C4 E006C5F4 3C14800A */  lui       $s4, %hi(gMainGfxPos)
/* 36E7C8 E006C5F8 2694A66C */  addiu     $s4, $s4, %lo(gMainGfxPos)
/* 36E7CC E006C5FC AFBF00D4 */  sw        $ra, 0xD4($sp)
/* 36E7D0 E006C600 AFBE00D0 */  sw        $fp, 0xD0($sp)
/* 36E7D4 E006C604 AFB700CC */  sw        $s7, 0xCC($sp)
/* 36E7D8 E006C608 AFB600C8 */  sw        $s6, 0xC8($sp)
/* 36E7DC E006C60C AFB500C4 */  sw        $s5, 0xC4($sp)
/* 36E7E0 E006C610 AFB300BC */  sw        $s3, 0xBC($sp)
/* 36E7E4 E006C614 AFB200B8 */  sw        $s2, 0xB8($sp)
/* 36E7E8 E006C618 AFB100B4 */  sw        $s1, 0xB4($sp)
/* 36E7EC E006C61C AFB000B0 */  sw        $s0, 0xB0($sp)
/* 36E7F0 E006C620 F7B600E0 */  sdc1      $f22, 0xE0($sp)
/* 36E7F4 E006C624 F7B400D8 */  sdc1      $f20, 0xD8($sp)
/* 36E7F8 E006C628 8E860000 */  lw        $a2, 0x0($s4)
/* 36E7FC E006C62C 8C93000C */  lw        $s3, 0xC($a0)
/* 36E800 E006C630 00C0182D */  daddu     $v1, $a2, $zero
/* 36E804 E006C634 8E750000 */  lw        $s5, 0x0($s3)
/* 36E808 E006C638 24C60008 */  addiu     $a2, $a2, 0x8
/* 36E80C E006C63C AE860000 */  sw        $a2, 0x0($s4)
/* 36E810 E006C640 8E670018 */  lw        $a3, 0x18($s3)
/* 36E814 E006C644 00151080 */  sll       $v0, $s5, 2
/* 36E818 E006C648 3C0AE007 */  lui       $t2, (0xE0070000 >> 16)
/* 36E81C E006C64C 01425021 */  addu      $t2, $t2, $v0
/* 36E820 E006C650 8D4ACB60 */  lw        $t2, -0x34A0($t2)
/* 36E824 E006C654 34A50024 */  ori       $a1, $a1, (0xDB060024 & 0xFFFF)
/* 36E828 E006C658 AFAA00A4 */  sw        $t2, 0xA4($sp)
/* 36E82C E006C65C 3C08E007 */  lui       $t0, (0xE0070000 >> 16)
/* 36E830 E006C660 01024021 */  addu      $t0, $t0, $v0
/* 36E834 E006C664 8D08CB78 */  lw        $t0, -0x3488($t0)
/* 36E838 E006C668 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 36E83C E006C66C AC620000 */  sw        $v0, 0x0($v1)
/* 36E840 E006C670 AC600004 */  sw        $zero, 0x4($v1)
/* 36E844 E006C674 ACC50000 */  sw        $a1, 0x0($a2)
/* 36E848 E006C678 8C830010 */  lw        $v1, 0x10($a0)
/* 36E84C E006C67C 24C20008 */  addiu     $v0, $a2, 0x8
/* 36E850 E006C680 AE820000 */  sw        $v0, 0x0($s4)
/* 36E854 E006C684 8C62001C */  lw        $v0, 0x1C($v1)
/* 36E858 E006C688 3C038000 */  lui       $v1, (0x80000000 >> 16)
/* 36E85C E006C68C 00431021 */  addu      $v0, $v0, $v1
/* 36E860 E006C690 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 36E864 E006C694 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 36E868 E006C698 3C04800B */  lui       $a0, %hi(gCameras)
/* 36E86C E006C69C 24841D80 */  addiu     $a0, $a0, %lo(gCameras)
/* 36E870 E006C6A0 ACC20004 */  sw        $v0, 0x4($a2)
/* 36E874 E006C6A4 00031080 */  sll       $v0, $v1, 2
/* 36E878 E006C6A8 00431021 */  addu      $v0, $v0, $v1
/* 36E87C E006C6AC 00021080 */  sll       $v0, $v0, 2
/* 36E880 E006C6B0 00431023 */  subu      $v0, $v0, $v1
/* 36E884 E006C6B4 000218C0 */  sll       $v1, $v0, 3
/* 36E888 E006C6B8 00431021 */  addu      $v0, $v0, $v1
/* 36E88C E006C6BC 000210C0 */  sll       $v0, $v0, 3
/* 36E890 E006C6C0 00441821 */  addu      $v1, $v0, $a0
/* 36E894 E006C6C4 24020001 */  addiu     $v0, $zero, 0x1
/* 36E898 E006C6C8 16A20004 */  bne       $s5, $v0, .LE006C6DC
/* 36E89C E006C6CC 3C02DE00 */   lui      $v0, (0xDE000000 >> 16)
/* 36E8A0 E006C6D0 28E20012 */  slti      $v0, $a3, 0x12
/* 36E8A4 E006C6D4 14400111 */  bnez      $v0, .LE006CB1C
/* 36E8A8 E006C6D8 3C02DE00 */   lui      $v0, (0xDE000000 >> 16)
.LE006C6DC:
/* 36E8AC E006C6DC ACC20008 */  sw        $v0, 0x8($a2)
/* 36E8B0 E006C6E0 ACC8000C */  sw        $t0, 0xC($a2)
/* 36E8B4 E006C6E4 C666001C */  lwc1      $f6, 0x1C($s3)
/* 36E8B8 E006C6E8 3C014080 */  lui       $at, (0x40800000 >> 16)
/* 36E8BC E006C6EC 44814000 */  mtc1      $at, $f8
/* 36E8C0 E006C6F0 00000000 */  nop
/* 36E8C4 E006C6F4 46083182 */  mul.s     $f6, $f6, $f8
/* 36E8C8 E006C6F8 00000000 */  nop
/* 36E8CC E006C6FC C6640020 */  lwc1      $f4, 0x20($s3)
/* 36E8D0 E006C700 46082102 */  mul.s     $f4, $f4, $f8
/* 36E8D4 E006C704 00000000 */  nop
/* 36E8D8 E006C708 C6620024 */  lwc1      $f2, 0x24($s3)
/* 36E8DC E006C70C 46081082 */  mul.s     $f2, $f2, $f8
/* 36E8E0 E006C710 00000000 */  nop
/* 36E8E4 E006C714 24C20010 */  addiu     $v0, $a2, 0x10
/* 36E8E8 E006C718 AE820000 */  sw        $v0, 0x0($s4)
/* 36E8EC E006C71C C6600028 */  lwc1      $f0, 0x28($s3)
/* 36E8F0 E006C720 46080002 */  mul.s     $f0, $f0, $f8
/* 36E8F4 E006C724 00000000 */  nop
/* 36E8F8 E006C728 2AA20003 */  slti      $v0, $s5, 0x3
/* 36E8FC E006C72C 4600328D */  trunc.w.s $f10, $f6
/* 36E900 E006C730 44165000 */  mfc1      $s6, $f10
/* 36E904 E006C734 4600228D */  trunc.w.s $f10, $f4
/* 36E908 E006C738 44175000 */  mfc1      $s7, $f10
/* 36E90C E006C73C 4600128D */  trunc.w.s $f10, $f2
/* 36E910 E006C740 441E5000 */  mfc1      $fp, $f10
/* 36E914 E006C744 4600028D */  trunc.w.s $f10, $f0
/* 36E918 E006C748 E7AA00A8 */  swc1      $f10, 0xA8($sp)
/* 36E91C E006C74C 10400057 */  beqz      $v0, .LE006C8AC
/* 36E920 E006C750 27A40020 */   addiu    $a0, $sp, 0x20
/* 36E924 E006C754 06A00056 */  bltz      $s5, .LE006C8B0
/* 36E928 E006C758 3C120001 */   lui      $s2, (0x11630 >> 16)
/* 36E92C E006C75C 27A500A0 */  addiu     $a1, $sp, 0xA0
/* 36E930 E006C760 3C0641F0 */  lui       $a2, (0x41F00000 >> 16)
/* 36E934 E006C764 8462000A */  lh        $v0, 0xA($v1)
/* 36E938 E006C768 8463000C */  lh        $v1, 0xC($v1)
/* 36E93C E006C76C 3C014680 */  lui       $at, (0x46800000 >> 16)
/* 36E940 E006C770 44811000 */  mtc1      $at, $f2
/* 36E944 E006C774 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 36E948 E006C778 44812000 */  mtc1      $at, $f4
/* 36E94C E006C77C 44823000 */  mtc1      $v0, $f6
/* 36E950 E006C780 00000000 */  nop
/* 36E954 E006C784 468031A0 */  cvt.s.w   $f6, $f6
/* 36E958 E006C788 44830000 */  mtc1      $v1, $f0
/* 36E95C E006C78C 00000000 */  nop
/* 36E960 E006C790 46800020 */  cvt.s.w   $f0, $f0
/* 36E964 E006C794 46003183 */  div.s     $f6, $f6, $f0
/* 36E968 E006C798 44073000 */  mfc1      $a3, $f6
/* 36E96C E006C79C 36521630 */  ori       $s2, $s2, (0x11630 & 0xFFFF)
/* 36E970 E006C7A0 E7A80010 */  swc1      $f8, 0x10($sp)
/* 36E974 E006C7A4 E7A20014 */  swc1      $f2, 0x14($sp)
/* 36E978 E006C7A8 0C080160 */  jal       shim_guPerspectiveF
/* 36E97C E006C7AC E7A40018 */   swc1     $f4, 0x18($sp)
/* 36E980 E006C7B0 27A40020 */  addiu     $a0, $sp, 0x20
/* 36E984 E006C7B4 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* 36E988 E006C7B8 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* 36E98C E006C7BC 3C11800A */  lui       $s1, %hi(gDisplayContext)
/* 36E990 E006C7C0 2631A674 */  addiu     $s1, $s1, %lo(gDisplayContext)
/* 36E994 E006C7C4 96050000 */  lhu       $a1, 0x0($s0)
/* 36E998 E006C7C8 8E220000 */  lw        $v0, 0x0($s1)
/* 36E99C E006C7CC 00052980 */  sll       $a1, $a1, 6
/* 36E9A0 E006C7D0 00B22821 */  addu      $a1, $a1, $s2
/* 36E9A4 E006C7D4 0C080118 */  jal       shim_guMtxF2L
/* 36E9A8 E006C7D8 00452821 */   addu     $a1, $v0, $a1
/* 36E9AC E006C7DC 3C02DA38 */  lui       $v0, (0xDA380007 >> 16)
/* 36E9B0 E006C7E0 34420007 */  ori       $v0, $v0, (0xDA380007 & 0xFFFF)
/* 36E9B4 E006C7E4 27A40020 */  addiu     $a0, $sp, 0x20
/* 36E9B8 E006C7E8 8E880000 */  lw        $t0, 0x0($s4)
/* 36E9BC E006C7EC 3C07C3FA */  lui       $a3, (0xC3FA0000 >> 16)
/* 36E9C0 E006C7F0 96090000 */  lhu       $t1, 0x0($s0)
/* 36E9C4 E006C7F4 0100282D */  daddu     $a1, $t0, $zero
/* 36E9C8 E006C7F8 ACA20000 */  sw        $v0, 0x0($a1)
/* 36E9CC E006C7FC 3122FFFF */  andi      $v0, $t1, 0xFFFF
/* 36E9D0 E006C800 00021180 */  sll       $v0, $v0, 6
/* 36E9D4 E006C804 00521021 */  addu      $v0, $v0, $s2
/* 36E9D8 E006C808 8E230000 */  lw        $v1, 0x0($s1)
/* 36E9DC E006C80C 25080008 */  addiu     $t0, $t0, 0x8
/* 36E9E0 E006C810 00621821 */  addu      $v1, $v1, $v0
/* 36E9E4 E006C814 ACA30004 */  sw        $v1, 0x4($a1)
/* 36E9E8 E006C818 8E650004 */  lw        $a1, 0x4($s3)
/* 36E9EC E006C81C 8E660008 */  lw        $a2, 0x8($s3)
/* 36E9F0 E006C820 25290001 */  addiu     $t1, $t1, 0x1
/* 36E9F4 E006C824 AE880000 */  sw        $t0, 0x0($s4)
/* 36E9F8 E006C828 0C080108 */  jal       shim_guTranslateF
/* 36E9FC E006C82C A6090000 */   sh       $t1, 0x0($s0)
/* 36EA00 E006C830 27A40020 */  addiu     $a0, $sp, 0x20
/* 36EA04 E006C834 96050000 */  lhu       $a1, 0x0($s0)
/* 36EA08 E006C838 8E220000 */  lw        $v0, 0x0($s1)
/* 36EA0C E006C83C 00052980 */  sll       $a1, $a1, 6
/* 36EA10 E006C840 00B22821 */  addu      $a1, $a1, $s2
/* 36EA14 E006C844 0C080118 */  jal       shim_guMtxF2L
/* 36EA18 E006C848 00452821 */   addu     $a1, $v0, $a1
/* 36EA1C E006C84C 3C03DA38 */  lui       $v1, (0xDA380002 >> 16)
/* 36EA20 E006C850 34630002 */  ori       $v1, $v1, (0xDA380002 & 0xFFFF)
/* 36EA24 E006C854 3C06FF2F */  lui       $a2, (0xFF2FC6FF >> 16)
/* 36EA28 E006C858 34C6C6FF */  ori       $a2, $a2, (0xFF2FC6FF & 0xFFFF)
/* 36EA2C E006C85C 8E840000 */  lw        $a0, 0x0($s4)
/* 36EA30 E006C860 96020000 */  lhu       $v0, 0x0($s0)
/* 36EA34 E006C864 0080282D */  daddu     $a1, $a0, $zero
/* 36EA38 E006C868 24840008 */  addiu     $a0, $a0, 0x8
/* 36EA3C E006C86C AE840000 */  sw        $a0, 0x0($s4)
/* 36EA40 E006C870 ACA30000 */  sw        $v1, 0x0($a1)
/* 36EA44 E006C874 24430001 */  addiu     $v1, $v0, 0x1
/* 36EA48 E006C878 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 36EA4C E006C87C 00021180 */  sll       $v0, $v0, 6
/* 36EA50 E006C880 A6030000 */  sh        $v1, 0x0($s0)
/* 36EA54 E006C884 8E230000 */  lw        $v1, 0x0($s1)
/* 36EA58 E006C888 00521021 */  addu      $v0, $v0, $s2
/* 36EA5C E006C88C 00621821 */  addu      $v1, $v1, $v0
/* 36EA60 E006C890 24820008 */  addiu     $v0, $a0, 0x8
/* 36EA64 E006C894 ACA30004 */  sw        $v1, 0x4($a1)
/* 36EA68 E006C898 AE820000 */  sw        $v0, 0x0($s4)
/* 36EA6C E006C89C 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 36EA70 E006C8A0 AC820000 */  sw        $v0, 0x0($a0)
/* 36EA74 E006C8A4 0801B27A */  j         .LE006C9E8
/* 36EA78 E006C8A8 AC860004 */   sw       $a2, 0x4($a0)
.LE006C8AC:
/* 36EA7C E006C8AC 3C120001 */  lui       $s2, (0x11630 >> 16)
.LE006C8B0:
/* 36EA80 E006C8B0 8E650004 */  lw        $a1, 0x4($s3)
/* 36EA84 E006C8B4 8E660008 */  lw        $a2, 0x8($s3)
/* 36EA88 E006C8B8 8E67000C */  lw        $a3, 0xC($s3)
/* 36EA8C E006C8BC 0C080108 */  jal       shim_guTranslateF
/* 36EA90 E006C8C0 36521630 */   ori      $s2, $s2, (0x11630 & 0xFFFF)
/* 36EA94 E006C8C4 27B00060 */  addiu     $s0, $sp, 0x60
/* 36EA98 E006C8C8 4480A000 */  mtc1      $zero, $f20
/* 36EA9C E006C8CC 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 36EAA0 E006C8D0 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 36EAA4 E006C8D4 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 36EAA8 E006C8D8 4481B000 */  mtc1      $at, $f22
/* 36EAAC E006C8DC 00031080 */  sll       $v0, $v1, 2
/* 36EAB0 E006C8E0 00431021 */  addu      $v0, $v0, $v1
/* 36EAB4 E006C8E4 00021080 */  sll       $v0, $v0, 2
/* 36EAB8 E006C8E8 00431023 */  subu      $v0, $v0, $v1
/* 36EABC E006C8EC 000218C0 */  sll       $v1, $v0, 3
/* 36EAC0 E006C8F0 00431021 */  addu      $v0, $v0, $v1
/* 36EAC4 E006C8F4 000210C0 */  sll       $v0, $v0, 3
/* 36EAC8 E006C8F8 4406A000 */  mfc1      $a2, $f20
/* 36EACC E006C8FC 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 36EAD0 E006C900 00220821 */  addu      $at, $at, $v0
/* 36EAD4 E006C904 C4201DEC */  lwc1      $f0, %lo(gCameras + 0x6C)($at)
/* 36EAD8 E006C908 4407B000 */  mfc1      $a3, $f22
/* 36EADC E006C90C 46000007 */  neg.s     $f0, $f0
/* 36EAE0 E006C910 44050000 */  mfc1      $a1, $f0
/* 36EAE4 E006C914 0200202D */  daddu     $a0, $s0, $zero
/* 36EAE8 E006C918 0C080104 */  jal       shim_guRotateF
/* 36EAEC E006C91C E7B40010 */   swc1     $f20, 0x10($sp)
/* 36EAF0 E006C920 0200202D */  daddu     $a0, $s0, $zero
/* 36EAF4 E006C924 27A50020 */  addiu     $a1, $sp, 0x20
/* 36EAF8 E006C928 0C080114 */  jal       shim_guMtxCatF
/* 36EAFC E006C92C 00A0302D */   daddu    $a2, $a1, $zero
/* 36EB00 E006C930 0200202D */  daddu     $a0, $s0, $zero
/* 36EB04 E006C934 4405A000 */  mfc1      $a1, $f20
/* 36EB08 E006C938 4407B000 */  mfc1      $a3, $f22
/* 36EB0C E006C93C 0C080108 */  jal       shim_guTranslateF
/* 36EB10 E006C940 00A0302D */   daddu    $a2, $a1, $zero
/* 36EB14 E006C944 0200202D */  daddu     $a0, $s0, $zero
/* 36EB18 E006C948 27A50020 */  addiu     $a1, $sp, 0x20
/* 36EB1C E006C94C 0C080114 */  jal       shim_guMtxCatF
/* 36EB20 E006C950 00A0302D */   daddu    $a2, $a1, $zero
/* 36EB24 E006C954 27A40020 */  addiu     $a0, $sp, 0x20
/* 36EB28 E006C958 3C108007 */  lui       $s0, %hi(gMatrixListPos)
/* 36EB2C E006C95C 261041F0 */  addiu     $s0, $s0, %lo(gMatrixListPos)
/* 36EB30 E006C960 3C11800A */  lui       $s1, %hi(gDisplayContext)
/* 36EB34 E006C964 2631A674 */  addiu     $s1, $s1, %lo(gDisplayContext)
/* 36EB38 E006C968 96050000 */  lhu       $a1, 0x0($s0)
/* 36EB3C E006C96C 8E220000 */  lw        $v0, 0x0($s1)
/* 36EB40 E006C970 00052980 */  sll       $a1, $a1, 6
/* 36EB44 E006C974 00B22821 */  addu      $a1, $a1, $s2
/* 36EB48 E006C978 0C080118 */  jal       shim_guMtxF2L
/* 36EB4C E006C97C 00452821 */   addu     $a1, $v0, $a1
/* 36EB50 E006C980 3C03DA38 */  lui       $v1, (0xDA380002 >> 16)
/* 36EB54 E006C984 3C05800A */  lui       $a1, %hi(gMainGfxPos)
/* 36EB58 E006C988 24A5A66C */  addiu     $a1, $a1, %lo(gMainGfxPos)
/* 36EB5C E006C98C 34630002 */  ori       $v1, $v1, (0xDA380002 & 0xFFFF)
/* 36EB60 E006C990 8CA40000 */  lw        $a0, 0x0($a1)
/* 36EB64 E006C994 96020000 */  lhu       $v0, 0x0($s0)
/* 36EB68 E006C998 0080302D */  daddu     $a2, $a0, $zero
/* 36EB6C E006C99C 24840008 */  addiu     $a0, $a0, 0x8
/* 36EB70 E006C9A0 ACA40000 */  sw        $a0, 0x0($a1)
/* 36EB74 E006C9A4 ACC30000 */  sw        $v1, 0x0($a2)
/* 36EB78 E006C9A8 24430001 */  addiu     $v1, $v0, 0x1
/* 36EB7C E006C9AC 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 36EB80 E006C9B0 00021180 */  sll       $v0, $v0, 6
/* 36EB84 E006C9B4 A6030000 */  sh        $v1, 0x0($s0)
/* 36EB88 E006C9B8 8E230000 */  lw        $v1, 0x0($s1)
/* 36EB8C E006C9BC 00521021 */  addu      $v0, $v0, $s2
/* 36EB90 E006C9C0 00621821 */  addu      $v1, $v1, $v0
/* 36EB94 E006C9C4 24820008 */  addiu     $v0, $a0, 0x8
/* 36EB98 E006C9C8 ACC30004 */  sw        $v1, 0x4($a2)
/* 36EB9C E006C9CC ACA20000 */  sw        $v0, 0x0($a1)
/* 36EBA0 E006C9D0 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 36EBA4 E006C9D4 AC820000 */  sw        $v0, 0x0($a0)
/* 36EBA8 E006C9D8 92620013 */  lbu       $v0, 0x13($s3)
/* 36EBAC E006C9DC 3C03FFFF */  lui       $v1, (0xFFFF0000 >> 16)
/* 36EBB0 E006C9E0 00431025 */  or        $v0, $v0, $v1
/* 36EBB4 E006C9E4 AC820004 */  sw        $v0, 0x4($a0)
.LE006C9E8:
/* 36EBB8 E006C9E8 3C06D838 */  lui       $a2, (0xD8380002 >> 16)
/* 36EBBC E006C9EC 3C08800A */  lui       $t0, %hi(gMainGfxPos)
/* 36EBC0 E006C9F0 2508A66C */  addiu     $t0, $t0, %lo(gMainGfxPos)
/* 36EBC4 E006C9F4 34C60002 */  ori       $a2, $a2, (0xD8380002 & 0xFFFF)
/* 36EBC8 E006C9F8 32C30FFF */  andi      $v1, $s6, 0xFFF
/* 36EBCC E006C9FC 00031B00 */  sll       $v1, $v1, 12
/* 36EBD0 E006CA00 32E20FFF */  andi      $v0, $s7, 0xFFF
/* 36EBD4 E006CA04 3C05F200 */  lui       $a1, (0xF2000000 >> 16)
/* 36EBD8 E006CA08 00451025 */  or        $v0, $v0, $a1
/* 36EBDC E006CA0C 00621825 */  or        $v1, $v1, $v0
/* 36EBE0 E006CA10 26C203FC */  addiu     $v0, $s6, 0x3FC
/* 36EBE4 E006CA14 30420FFF */  andi      $v0, $v0, 0xFFF
/* 36EBE8 E006CA18 8D070000 */  lw        $a3, 0x0($t0)
/* 36EBEC E006CA1C 00021300 */  sll       $v0, $v0, 12
/* 36EBF0 E006CA20 00E0202D */  daddu     $a0, $a3, $zero
/* 36EBF4 E006CA24 24E70008 */  addiu     $a3, $a3, 0x8
/* 36EBF8 E006CA28 AD070000 */  sw        $a3, 0x0($t0)
/* 36EBFC E006CA2C AC830000 */  sw        $v1, 0x0($a0)
/* 36EC00 E006CA30 26E3007C */  addiu     $v1, $s7, 0x7C
/* 36EC04 E006CA34 30630FFF */  andi      $v1, $v1, 0xFFF
/* 36EC08 E006CA38 00431025 */  or        $v0, $v0, $v1
/* 36EC0C E006CA3C AC820004 */  sw        $v0, 0x4($a0)
/* 36EC10 E006CA40 24E20008 */  addiu     $v0, $a3, 0x8
/* 36EC14 E006CA44 33C30FFF */  andi      $v1, $fp, 0xFFF
/* 36EC18 E006CA48 00031B00 */  sll       $v1, $v1, 12
/* 36EC1C E006CA4C AD020000 */  sw        $v0, 0x0($t0)
/* 36EC20 E006CA50 8FAA00A8 */  lw        $t2, 0xA8($sp)
/* 36EC24 E006CA54 3C040100 */  lui       $a0, (0x1000000 >> 16)
/* 36EC28 E006CA58 31420FFF */  andi      $v0, $t2, 0xFFF
/* 36EC2C E006CA5C 00451025 */  or        $v0, $v0, $a1
/* 36EC30 E006CA60 00621825 */  or        $v1, $v1, $v0
/* 36EC34 E006CA64 27C203FC */  addiu     $v0, $fp, 0x3FC
/* 36EC38 E006CA68 30420FFF */  andi      $v0, $v0, 0xFFF
/* 36EC3C E006CA6C 00021300 */  sll       $v0, $v0, 12
/* 36EC40 E006CA70 ACE30000 */  sw        $v1, 0x0($a3)
/* 36EC44 E006CA74 2543007C */  addiu     $v1, $t2, 0x7C
/* 36EC48 E006CA78 30630FFF */  andi      $v1, $v1, 0xFFF
/* 36EC4C E006CA7C 00641825 */  or        $v1, $v1, $a0
/* 36EC50 E006CA80 00431025 */  or        $v0, $v0, $v1
/* 36EC54 E006CA84 ACE20004 */  sw        $v0, 0x4($a3)
/* 36EC58 E006CA88 24E20010 */  addiu     $v0, $a3, 0x10
/* 36EC5C E006CA8C AD020000 */  sw        $v0, 0x0($t0)
/* 36EC60 E006CA90 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 36EC64 E006CA94 ACE20008 */  sw        $v0, 0x8($a3)
/* 36EC68 E006CA98 24E20018 */  addiu     $v0, $a3, 0x18
/* 36EC6C E006CA9C 8FAA00A4 */  lw        $t2, 0xA4($sp)
/* 36EC70 E006CAA0 3C05E700 */  lui       $a1, (0xE7000000 >> 16)
/* 36EC74 E006CAA4 ACEA000C */  sw        $t2, 0xC($a3)
/* 36EC78 E006CAA8 AD020000 */  sw        $v0, 0x0($t0)
/* 36EC7C E006CAAC 24E20020 */  addiu     $v0, $a3, 0x20
/* 36EC80 E006CAB0 ACE50010 */  sw        $a1, 0x10($a3)
/* 36EC84 E006CAB4 ACE00014 */  sw        $zero, 0x14($a3)
/* 36EC88 E006CAB8 AD020000 */  sw        $v0, 0x0($t0)
/* 36EC8C E006CABC 24020040 */  addiu     $v0, $zero, 0x40
/* 36EC90 E006CAC0 ACE2001C */  sw        $v0, 0x1C($a3)
/* 36EC94 E006CAC4 2AA20003 */  slti      $v0, $s5, 0x3
/* 36EC98 E006CAC8 1040000E */  beqz      $v0, .LE006CB04
/* 36EC9C E006CACC ACE60018 */   sw       $a2, 0x18($a3)
/* 36ECA0 E006CAD0 3C04DA38 */  lui       $a0, (0xDA380007 >> 16)
/* 36ECA4 E006CAD4 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 36ECA8 E006CAD8 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 36ECAC E006CADC 24E20028 */  addiu     $v0, $a3, 0x28
/* 36ECB0 E006CAE0 AD020000 */  sw        $v0, 0x0($t0)
/* 36ECB4 E006CAE4 3C02800A */  lui       $v0, %hi(gDisplayContext)
/* 36ECB8 E006CAE8 8C42A674 */  lw        $v0, %lo(gDisplayContext)($v0)
/* 36ECBC E006CAEC 34840007 */  ori       $a0, $a0, (0xDA380007 & 0xFFFF)
/* 36ECC0 E006CAF0 ACE40020 */  sw        $a0, 0x20($a3)
/* 36ECC4 E006CAF4 00031980 */  sll       $v1, $v1, 6
/* 36ECC8 E006CAF8 24630030 */  addiu     $v1, $v1, 0x30
/* 36ECCC E006CAFC 00431021 */  addu      $v0, $v0, $v1
/* 36ECD0 E006CB00 ACE20024 */  sw        $v0, 0x24($a3)
.LE006CB04:
/* 36ECD4 E006CB04 8D020000 */  lw        $v0, 0x0($t0)
/* 36ECD8 E006CB08 0040182D */  daddu     $v1, $v0, $zero
/* 36ECDC E006CB0C 24420008 */  addiu     $v0, $v0, 0x8
/* 36ECE0 E006CB10 AD020000 */  sw        $v0, 0x0($t0)
/* 36ECE4 E006CB14 AC650000 */  sw        $a1, 0x0($v1)
/* 36ECE8 E006CB18 AC600004 */  sw        $zero, 0x4($v1)
.LE006CB1C:
/* 36ECEC E006CB1C 8FBF00D4 */  lw        $ra, 0xD4($sp)
/* 36ECF0 E006CB20 8FBE00D0 */  lw        $fp, 0xD0($sp)
/* 36ECF4 E006CB24 8FB700CC */  lw        $s7, 0xCC($sp)
/* 36ECF8 E006CB28 8FB600C8 */  lw        $s6, 0xC8($sp)
/* 36ECFC E006CB2C 8FB500C4 */  lw        $s5, 0xC4($sp)
/* 36ED00 E006CB30 8FB400C0 */  lw        $s4, 0xC0($sp)
/* 36ED04 E006CB34 8FB300BC */  lw        $s3, 0xBC($sp)
/* 36ED08 E006CB38 8FB200B8 */  lw        $s2, 0xB8($sp)
/* 36ED0C E006CB3C 8FB100B4 */  lw        $s1, 0xB4($sp)
/* 36ED10 E006CB40 8FB000B0 */  lw        $s0, 0xB0($sp)
/* 36ED14 E006CB44 D7B600E0 */  ldc1      $f22, 0xE0($sp)
/* 36ED18 E006CB48 D7B400D8 */  ldc1      $f20, 0xD8($sp)
/* 36ED1C E006CB4C 03E00008 */  jr        $ra
/* 36ED20 E006CB50 27BD00E8 */   addiu    $sp, $sp, 0xE8
/* 36ED24 E006CB54 00000000 */  nop
/* 36ED28 E006CB58 00000000 */  nop
/* 36ED2C E006CB5C 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void lightning_appendGfx(void* effect) {
    LightningFXData* data = ((EffectInstance*)effect)->data.lightning;
    s32 unk_00 = data->unk_00;
    s32 unk_18 = data->unk_18;
    Gfx* dlist = D_E006CB60[unk_00];
    Gfx* dlist2 = D_E006CB78[unk_00];
    Camera* camera = &gCameras[gCurrentCameraID];
    Matrix4f sp20;
    Matrix4f sp60;
    u16 perspNorm;

    gDPPipeSync(gMainGfxPos++);
    gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));

    if (unk_00 != 1 || unk_18 >= 18) {
        s32 ult2;
        s32 uls2;
        s32 uls;
        s32 ult;
        f32* unk_28; // TODO required to match

        gSPDisplayList(gMainGfxPos++, dlist2);

        uls = data->unk_1C * 4.0f;
        ult = data->unk_20 * 4.0f;
        uls2 = data->unk_24 * 4.0f;
        unk_28 = &data->unk_28; // TODO dumb pointer temp required to match
        ult2 = *(unk_28) * 4.0f;

        switch (unk_00) {
            case 0:
            case 1:
            case 2:
                shim_guPerspectiveF(sp20, &perspNorm, 30.0f, (f32) camera->viewportW / (f32) camera->viewportH, 4.0f, 16384.0f, 1.0f);
                shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);

                gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);

                shim_guTranslateF(sp20, data->unk_04, data->unk_08, -500.0f);
                shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);

                gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
                gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 47, 198, 255);
                break;
            default:
                shim_guTranslateF(sp20, data->unk_04, data->unk_08, data->unk_0C);
                shim_guRotateF(sp60, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f);
                shim_guMtxCatF(sp60, sp20, sp20);
                shim_guTranslateF(sp60, 0.0f, 0.0f, 1.0f);
                shim_guMtxCatF(sp60, sp20, sp20);
                shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);

                gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
                gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 0, data->unk_10);
                break;
        }

        gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE, uls, ult, uls + 1020, ult + 124);
        gDPSetTileSize(gMainGfxPos++, 1, uls2, ult2, uls2 + 1020, ult2 + 124);
        gSPDisplayList(gMainGfxPos++, dlist);
        gDPPipeSync(gMainGfxPos++);
        gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);

        if (unk_00 < 3) {
            gSPMatrix(gMainGfxPos++, &gDisplayContext->camPerspMatrix[gCurrentCameraID], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
        }

        gDPPipeSync(gMainGfxPos++);
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel draw_hud_element_internal
/* DA998 80144298 27BDFFB8 */  addiu     $sp, $sp, -0x48
/* DA99C 8014429C 2402F7FF */  addiu     $v0, $zero, -0x801
/* DA9A0 801442A0 00822024 */  and       $a0, $a0, $v0
/* DA9A4 801442A4 3C028015 */  lui       $v0, %hi(gHudElements)
/* DA9A8 801442A8 8C427960 */  lw        $v0, %lo(gHudElements)($v0)
/* DA9AC 801442AC 00042080 */  sll       $a0, $a0, 2
/* DA9B0 801442B0 AFBF0044 */  sw        $ra, 0x44($sp)
/* DA9B4 801442B4 AFB60040 */  sw        $s6, 0x40($sp)
/* DA9B8 801442B8 AFB5003C */  sw        $s5, 0x3C($sp)
/* DA9BC 801442BC AFB40038 */  sw        $s4, 0x38($sp)
/* DA9C0 801442C0 AFB30034 */  sw        $s3, 0x34($sp)
/* DA9C4 801442C4 AFB20030 */  sw        $s2, 0x30($sp)
/* DA9C8 801442C8 AFB1002C */  sw        $s1, 0x2C($sp)
/* DA9CC 801442CC AFB00028 */  sw        $s0, 0x28($sp)
/* DA9D0 801442D0 00822021 */  addu      $a0, $a0, $v0
/* DA9D4 801442D4 8C900000 */  lw        $s0, 0x0($a0)
/* DA9D8 801442D8 8E030000 */  lw        $v1, 0x0($s0)
/* DA9DC 801442DC 10600128 */  beqz      $v1, .L80144780
/* DA9E0 801442E0 30620002 */   andi     $v0, $v1, 0x2
/* DA9E4 801442E4 14400126 */  bnez      $v0, .L80144780
/* DA9E8 801442E8 3C021020 */   lui      $v0, (0x10200000 >> 16)
/* DA9EC 801442EC 00621024 */  and       $v0, $v1, $v0
/* DA9F0 801442F0 14400123 */  bnez      $v0, .L80144780
/* DA9F4 801442F4 00000000 */   nop
/* DA9F8 801442F8 82020045 */  lb        $v0, 0x45($s0)
/* DA9FC 801442FC 04400120 */  bltz      $v0, .L80144780
/* DAA00 80144300 24020001 */   addiu    $v0, $zero, 0x1
/* DAA04 80144304 10A2005E */  beq       $a1, $v0, .L80144480
/* DAA08 80144308 30620100 */   andi     $v0, $v1, 0x100
/* DAA0C 8014430C 14A0000E */  bnez      $a1, .L80144348
/* DAA10 80144310 3C06E300 */   lui      $a2, (0xE3000A01 >> 16)
/* DAA14 80144314 3C06ED03 */  lui       $a2, (0xED030050 >> 16)
/* DAA18 80144318 34C60050 */  ori       $a2, $a2, (0xED030050 & 0xFFFF)
/* DAA1C 8014431C 3C05004D */  lui       $a1, (0x4D0370 >> 16)
/* DAA20 80144320 3C04800A */  lui       $a0, %hi(gMainGfxPos)
/* DAA24 80144324 2484A66C */  addiu     $a0, $a0, %lo(gMainGfxPos)
/* DAA28 80144328 8C820000 */  lw        $v0, 0x0($a0)
/* DAA2C 8014432C 34A50370 */  ori       $a1, $a1, (0x4D0370 & 0xFFFF)
/* DAA30 80144330 0040182D */  daddu     $v1, $v0, $zero
/* DAA34 80144334 24420008 */  addiu     $v0, $v0, 0x8
/* DAA38 80144338 AC820000 */  sw        $v0, 0x0($a0)
/* DAA3C 8014433C AC660000 */  sw        $a2, 0x0($v1)
/* DAA40 80144340 AC650004 */  sw        $a1, 0x4($v1)
/* DAA44 80144344 3C06E300 */  lui       $a2, (0xE3000A01 >> 16)
.L80144348:
/* DAA48 80144348 34C60A01 */  ori       $a2, $a2, (0xE3000A01 & 0xFFFF)
/* DAA4C 8014434C 3C07E300 */  lui       $a3, (0xE3000C00 >> 16)
/* DAA50 80144350 34E70C00 */  ori       $a3, $a3, (0xE3000C00 & 0xFFFF)
/* DAA54 80144354 3C08E300 */  lui       $t0, (0xE3000F00 >> 16)
/* DAA58 80144358 35080F00 */  ori       $t0, $t0, (0xE3000F00 & 0xFFFF)
/* DAA5C 8014435C 3C09E300 */  lui       $t1, (0xE3000D01 >> 16)
/* DAA60 80144360 35290D01 */  ori       $t1, $t1, (0xE3000D01 & 0xFFFF)
/* DAA64 80144364 3C0AE300 */  lui       $t2, (0xE3001402 >> 16)
/* DAA68 80144368 354A1402 */  ori       $t2, $t2, (0xE3001402 & 0xFFFF)
/* DAA6C 8014436C 3C0BE300 */  lui       $t3, (0xE3001700 >> 16)
/* DAA70 80144370 356B1700 */  ori       $t3, $t3, (0xE3001700 & 0xFFFF)
/* DAA74 80144374 3C0CE200 */  lui       $t4, (0xE2001E01 >> 16)
/* DAA78 80144378 358C1E01 */  ori       $t4, $t4, (0xE2001E01 & 0xFFFF)
/* DAA7C 8014437C 3C0DE300 */  lui       $t5, (0xE3001801 >> 16)
/* DAA80 80144380 35AD1801 */  ori       $t5, $t5, (0xE3001801 & 0xFFFF)
/* DAA84 80144384 3C0EE300 */  lui       $t6, (0xE3001A01 >> 16)
/* DAA88 80144388 35CE1A01 */  ori       $t6, $t6, (0xE3001A01 & 0xFFFF)
/* DAA8C 8014438C 3C0FD700 */  lui       $t7, (0xD7000002 >> 16)
/* DAA90 80144390 3C04800A */  lui       $a0, %hi(gMainGfxPos)
/* DAA94 80144394 2484A66C */  addiu     $a0, $a0, %lo(gMainGfxPos)
/* DAA98 80144398 35EF0002 */  ori       $t7, $t7, (0xD7000002 & 0xFFFF)
/* DAA9C 8014439C 8C820000 */  lw        $v0, 0x0($a0)
/* DAAA0 801443A0 3C03E700 */  lui       $v1, (0xE7000000 >> 16)
/* DAAA4 801443A4 0040282D */  daddu     $a1, $v0, $zero
/* DAAA8 801443A8 24420008 */  addiu     $v0, $v0, 0x8
/* DAAAC 801443AC AC820000 */  sw        $v0, 0x0($a0)
/* DAAB0 801443B0 ACA30000 */  sw        $v1, 0x0($a1)
/* DAAB4 801443B4 24430008 */  addiu     $v1, $v0, 0x8
/* DAAB8 801443B8 ACA00004 */  sw        $zero, 0x4($a1)
/* DAABC 801443BC AC830000 */  sw        $v1, 0x0($a0)
/* DAAC0 801443C0 24430010 */  addiu     $v1, $v0, 0x10
/* DAAC4 801443C4 AC460000 */  sw        $a2, 0x0($v0)
/* DAAC8 801443C8 AC400004 */  sw        $zero, 0x4($v0)
/* DAACC 801443CC AC830000 */  sw        $v1, 0x0($a0)
/* DAAD0 801443D0 24430018 */  addiu     $v1, $v0, 0x18
/* DAAD4 801443D4 AC470008 */  sw        $a3, 0x8($v0)
/* DAAD8 801443D8 AC40000C */  sw        $zero, 0xC($v0)
/* DAADC 801443DC AC830000 */  sw        $v1, 0x0($a0)
/* DAAE0 801443E0 24430020 */  addiu     $v1, $v0, 0x20
/* DAAE4 801443E4 AC480010 */  sw        $t0, 0x10($v0)
/* DAAE8 801443E8 AC400014 */  sw        $zero, 0x14($v0)
/* DAAEC 801443EC AC830000 */  sw        $v1, 0x0($a0)
/* DAAF0 801443F0 24430028 */  addiu     $v1, $v0, 0x28
/* DAAF4 801443F4 AC490018 */  sw        $t1, 0x18($v0)
/* DAAF8 801443F8 AC40001C */  sw        $zero, 0x1C($v0)
/* DAAFC 801443FC AC830000 */  sw        $v1, 0x0($a0)
/* DAB00 80144400 24030C00 */  addiu     $v1, $zero, 0xC00
/* DAB04 80144404 AC430024 */  sw        $v1, 0x24($v0)
/* DAB08 80144408 24430030 */  addiu     $v1, $v0, 0x30
/* DAB0C 8014440C AC4A0020 */  sw        $t2, 0x20($v0)
/* DAB10 80144410 AC830000 */  sw        $v1, 0x0($a0)
/* DAB14 80144414 24430038 */  addiu     $v1, $v0, 0x38
/* DAB18 80144418 AC4B0028 */  sw        $t3, 0x28($v0)
/* DAB1C 8014441C AC40002C */  sw        $zero, 0x2C($v0)
/* DAB20 80144420 AC830000 */  sw        $v1, 0x0($a0)
/* DAB24 80144424 24430040 */  addiu     $v1, $v0, 0x40
/* DAB28 80144428 AC4C0030 */  sw        $t4, 0x30($v0)
/* DAB2C 8014442C AC400034 */  sw        $zero, 0x34($v0)
/* DAB30 80144430 AC830000 */  sw        $v1, 0x0($a0)
/* DAB34 80144434 24430048 */  addiu     $v1, $v0, 0x48
/* DAB38 80144438 AC400038 */  sw        $zero, 0x38($v0)
/* DAB3C 8014443C AC40003C */  sw        $zero, 0x3C($v0)
/* DAB40 80144440 AC830000 */  sw        $v1, 0x0($a0)
/* DAB44 80144444 240300C0 */  addiu     $v1, $zero, 0xC0
/* DAB48 80144448 AC430044 */  sw        $v1, 0x44($v0)
/* DAB4C 8014444C 24430050 */  addiu     $v1, $v0, 0x50
/* DAB50 80144450 AC4D0040 */  sw        $t5, 0x40($v0)
/* DAB54 80144454 AC830000 */  sw        $v1, 0x0($a0)
/* DAB58 80144458 24030030 */  addiu     $v1, $zero, 0x30
/* DAB5C 8014445C AC4E0048 */  sw        $t6, 0x48($v0)
/* DAB60 80144460 AC43004C */  sw        $v1, 0x4C($v0)
/* DAB64 80144464 24430058 */  addiu     $v1, $v0, 0x58
/* DAB68 80144468 AC830000 */  sw        $v1, 0x0($a0)
/* DAB6C 8014446C 2403FFFF */  addiu     $v1, $zero, -0x1
/* DAB70 80144470 AC4F0050 */  sw        $t7, 0x50($v0)
/* DAB74 80144474 AC430054 */  sw        $v1, 0x54($v0)
/* DAB78 80144478 8E030000 */  lw        $v1, 0x0($s0)
/* DAB7C 8014447C 30620100 */  andi      $v0, $v1, 0x100
.L80144480:
/* DAB80 80144480 1440005B */  bnez      $v0, .L801445F0
/* DAB84 80144484 3C020010 */   lui      $v0, (0x100000 >> 16)
/* DAB88 80144488 00621024 */  and       $v0, $v1, $v0
/* DAB8C 8014448C 1440000B */  bnez      $v0, .L801444BC
/* DAB90 80144490 00000000 */   nop
/* DAB94 80144494 82040046 */  lb        $a0, 0x46($s0)
/* DAB98 80144498 3C038015 */  lui       $v1, %hi(gHudElementSizes)
/* DAB9C 8014449C 2463EFCC */  addiu     $v1, $v1, %lo(gHudElementSizes)
/* DABA0 801444A0 00041040 */  sll       $v0, $a0, 1
/* DABA4 801444A4 00441021 */  addu      $v0, $v0, $a0
/* DABA8 801444A8 00021040 */  sll       $v0, $v0, 1
/* DABAC 801444AC 00431021 */  addu      $v0, $v0, $v1
/* DABB0 801444B0 84560000 */  lh        $s6, 0x0($v0)
/* DABB4 801444B4 08051131 */  j         .L801444C4
/* DABB8 801444B8 84550002 */   lh       $s5, 0x2($v0)
.L801444BC:
/* DABBC 801444BC 9216004E */  lbu       $s6, 0x4E($s0)
/* DABC0 801444C0 9215004F */  lbu       $s5, 0x4F($s0)
.L801444C4:
/* DABC4 801444C4 8E030000 */  lw        $v1, 0x0($s0)
/* DABC8 801444C8 30620010 */  andi      $v0, $v1, 0x10
/* DABCC 801444CC 14400013 */  bnez      $v0, .L8014451C
/* DABD0 801444D0 3C020010 */   lui      $v0, (0x100000 >> 16)
/* DABD4 801444D4 00621024 */  and       $v0, $v1, $v0
/* DABD8 801444D8 1440000C */  bnez      $v0, .L8014450C
/* DABDC 801444DC 00000000 */   nop
/* DABE0 801444E0 82020045 */  lb        $v0, 0x45($s0)
/* DABE4 801444E4 3C048015 */  lui       $a0, %hi(gHudElementSizes)
/* DABE8 801444E8 2484EFCC */  addiu     $a0, $a0, %lo(gHudElementSizes)
/* DABEC 801444EC 00021840 */  sll       $v1, $v0, 1
/* DABF0 801444F0 00621821 */  addu      $v1, $v1, $v0
/* DABF4 801444F4 00031840 */  sll       $v1, $v1, 1
/* DABF8 801444F8 00641821 */  addu      $v1, $v1, $a0
/* DABFC 801444FC 84710000 */  lh        $s1, 0x0($v1)
/* DAC00 80144500 84720002 */  lh        $s2, 0x2($v1)
/* DAC04 80144504 0805114A */  j         .L80144528
/* DAC08 80144508 00111023 */   negu     $v0, $s1
.L8014450C:
/* DAC0C 8014450C 92110050 */  lbu       $s1, 0x50($s0)
/* DAC10 80144510 92120051 */  lbu       $s2, 0x51($s0)
/* DAC14 80144514 0805114A */  j         .L80144528
/* DAC18 80144518 00111023 */   negu     $v0, $s1
.L8014451C:
/* DAC1C 8014451C 92110048 */  lbu       $s1, 0x48($s0)
/* DAC20 80144520 92120049 */  lbu       $s2, 0x49($s0)
/* DAC24 80144524 00111023 */  negu      $v0, $s1
.L80144528:
/* DAC28 80144528 00021FC2 */  srl       $v1, $v0, 31
/* DAC2C 8014452C 00431021 */  addu      $v0, $v0, $v1
/* DAC30 80144530 00029843 */  sra       $s3, $v0, 1
/* DAC34 80144534 00121023 */  negu      $v0, $s2
/* DAC38 80144538 00021FC2 */  srl       $v1, $v0, 31
/* DAC3C 8014453C 00431021 */  addu      $v0, $v0, $v1
/* DAC40 80144540 0002A043 */  sra       $s4, $v0, 1
/* DAC44 80144544 8E030000 */  lw        $v1, 0x0($s0)
/* DAC48 80144548 30620800 */  andi      $v0, $v1, 0x800
/* DAC4C 8014454C 14400026 */  bnez      $v0, .L801445E8
/* DAC50 80144550 3C022000 */   lui      $v0, (0x20000000 >> 16)
/* DAC54 80144554 00621024 */  and       $v0, $v1, $v0
/* DAC58 80144558 10400012 */  beqz      $v0, .L801445A4
/* DAC5C 8014455C 0200202D */   daddu    $a0, $s0, $zero
/* DAC60 80144560 02C0282D */  daddu     $a1, $s6, $zero
/* DAC64 80144564 02A0302D */  daddu     $a2, $s5, $zero
/* DAC68 80144568 00113C00 */  sll       $a3, $s1, 16
/* DAC6C 8014456C 00073C03 */  sra       $a3, $a3, 16
/* DAC70 80144570 00121400 */  sll       $v0, $s2, 16
/* DAC74 80144574 00021403 */  sra       $v0, $v0, 16
/* DAC78 80144578 AFA20010 */  sw        $v0, 0x10($sp)
/* DAC7C 8014457C 00131400 */  sll       $v0, $s3, 16
/* DAC80 80144580 00021403 */  sra       $v0, $v0, 16
/* DAC84 80144584 AFA20014 */  sw        $v0, 0x14($sp)
/* DAC88 80144588 00141400 */  sll       $v0, $s4, 16
/* DAC8C 8014458C 00021403 */  sra       $v0, $v0, 16
/* DAC90 80144590 AFA20018 */  sw        $v0, 0x18($sp)
/* DAC94 80144594 24020001 */  addiu     $v0, $zero, 0x1
/* DAC98 80144598 AFA2001C */  sw        $v0, 0x1C($sp)
/* DAC9C 8014459C 0C04FDC1 */  jal       hud_element_draw_rect
/* DACA0 801445A0 AFA20020 */   sw       $v0, 0x20($sp)
.L801445A4:
/* DACA4 801445A4 0200202D */  daddu     $a0, $s0, $zero
/* DACA8 801445A8 02C0282D */  daddu     $a1, $s6, $zero
/* DACAC 801445AC 02A0302D */  daddu     $a2, $s5, $zero
/* DACB0 801445B0 00113C00 */  sll       $a3, $s1, 16
/* DACB4 801445B4 00073C03 */  sra       $a3, $a3, 16
/* DACB8 801445B8 00121400 */  sll       $v0, $s2, 16
/* DACBC 801445BC 00021403 */  sra       $v0, $v0, 16
/* DACC0 801445C0 AFA20010 */  sw        $v0, 0x10($sp)
/* DACC4 801445C4 00131400 */  sll       $v0, $s3, 16
/* DACC8 801445C8 00021403 */  sra       $v0, $v0, 16
/* DACCC 801445CC AFA20014 */  sw        $v0, 0x14($sp)
/* DACD0 801445D0 00141400 */  sll       $v0, $s4, 16
/* DACD4 801445D4 00021403 */  sra       $v0, $v0, 16
/* DACD8 801445D8 AFA20018 */  sw        $v0, 0x18($sp)
/* DACDC 801445DC 24020001 */  addiu     $v0, $zero, 0x1
/* DACE0 801445E0 080511DE */  j         .L80144778
/* DACE4 801445E4 AFA2001C */   sw       $v0, 0x1C($sp)
.L801445E8:
/* DACE8 801445E8 080511BC */  j         .L801446F0
/* DACEC 801445EC 00621024 */   and      $v0, $v1, $v0
.L801445F0:
/* DACF0 801445F0 00621024 */  and       $v0, $v1, $v0
/* DACF4 801445F4 1440000C */  bnez      $v0, .L80144628
/* DACF8 801445F8 3C032000 */   lui      $v1, (0x20000000 >> 16)
/* DACFC 801445FC 82040046 */  lb        $a0, 0x46($s0)
/* DAD00 80144600 3C038015 */  lui       $v1, %hi(gHudElementSizes)
/* DAD04 80144604 2463EFCC */  addiu     $v1, $v1, %lo(gHudElementSizes)
/* DAD08 80144608 00041040 */  sll       $v0, $a0, 1
/* DAD0C 8014460C 00441021 */  addu      $v0, $v0, $a0
/* DAD10 80144610 00021040 */  sll       $v0, $v0, 1
/* DAD14 80144614 00431021 */  addu      $v0, $v0, $v1
/* DAD18 80144618 84560000 */  lh        $s6, 0x0($v0)
/* DAD1C 8014461C 84550002 */  lh        $s5, 0x2($v0)
/* DAD20 80144620 0805118C */  j         .L80144630
/* DAD24 80144624 3C032000 */   lui      $v1, (0x20000000 >> 16)
.L80144628:
/* DAD28 80144628 9216004E */  lbu       $s6, 0x4E($s0)
/* DAD2C 8014462C 9215004F */  lbu       $s5, 0x4F($s0)
.L80144630:
/* DAD30 80144630 C6000028 */  lwc1      $f0, 0x28($s0)
/* DAD34 80144634 C606002C */  lwc1      $f6, 0x2C($s0)
/* DAD38 80144638 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* DAD3C 8014463C 44811000 */  mtc1      $at, $f2
/* DAD40 80144640 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* DAD44 80144644 44815000 */  mtc1      $at, $f10
/* DAD48 80144648 46000207 */  neg.s     $f8, $f0
/* DAD4C 8014464C 46024202 */  mul.s     $f8, $f8, $f2
/* DAD50 80144650 00000000 */  nop
/* DAD54 80144654 3C014480 */  lui       $at, (0x44800000 >> 16)
/* DAD58 80144658 44816000 */  mtc1      $at, $f12
/* DAD5C 8014465C 8E020000 */  lw        $v0, 0x0($s0)
/* DAD60 80144660 4600038D */  trunc.w.s $f14, $f0
/* DAD64 80144664 44117000 */  mfc1      $s1, $f14
/* DAD68 80144668 4600338D */  trunc.w.s $f14, $f6
/* DAD6C 8014466C 44127000 */  mfc1      $s2, $f14
/* DAD70 80144670 46003187 */  neg.s     $f6, $f6
/* DAD74 80144674 46023182 */  mul.s     $f6, $f6, $f2
/* DAD78 80144678 00000000 */  nop
/* DAD7C 8014467C 44912000 */  mtc1      $s1, $f4
/* DAD80 80144680 00000000 */  nop
/* DAD84 80144684 46802120 */  cvt.s.w   $f4, $f4
/* DAD88 80144688 44960000 */  mtc1      $s6, $f0
/* DAD8C 8014468C 00000000 */  nop
/* DAD90 80144690 46800020 */  cvt.s.w   $f0, $f0
/* DAD94 80144694 46002103 */  div.s     $f4, $f4, $f0
/* DAD98 80144698 46045103 */  div.s     $f4, $f10, $f4
/* DAD9C 8014469C 460C2102 */  mul.s     $f4, $f4, $f12
/* DADA0 801446A0 00000000 */  nop
/* DADA4 801446A4 44920000 */  mtc1      $s2, $f0
/* DADA8 801446A8 00000000 */  nop
/* DADAC 801446AC 46800020 */  cvt.s.w   $f0, $f0
/* DADB0 801446B0 44951000 */  mtc1      $s5, $f2
/* DADB4 801446B4 00000000 */  nop
/* DADB8 801446B8 468010A0 */  cvt.s.w   $f2, $f2
/* DADBC 801446BC 46020003 */  div.s     $f0, $f0, $f2
/* DADC0 801446C0 46005003 */  div.s     $f0, $f10, $f0
/* DADC4 801446C4 460C0002 */  mul.s     $f0, $f0, $f12
/* DADC8 801446C8 00000000 */  nop
/* DADCC 801446CC 00431024 */  and       $v0, $v0, $v1
/* DADD0 801446D0 4600438D */  trunc.w.s $f14, $f8
/* DADD4 801446D4 44137000 */  mfc1      $s3, $f14
/* DADD8 801446D8 4600338D */  trunc.w.s $f14, $f6
/* DADDC 801446DC 44147000 */  mfc1      $s4, $f14
/* DADE0 801446E0 4600238D */  trunc.w.s $f14, $f4
/* DADE4 801446E4 E60E0034 */  swc1      $f14, 0x34($s0)
/* DADE8 801446E8 4600038D */  trunc.w.s $f14, $f0
/* DADEC 801446EC E60E0038 */  swc1      $f14, 0x38($s0)
.L801446F0:
/* DADF0 801446F0 10400012 */  beqz      $v0, .L8014473C
/* DADF4 801446F4 0200202D */   daddu    $a0, $s0, $zero
/* DADF8 801446F8 02C0282D */  daddu     $a1, $s6, $zero
/* DADFC 801446FC 02A0302D */  daddu     $a2, $s5, $zero
/* DAE00 80144700 00113C00 */  sll       $a3, $s1, 16
/* DAE04 80144704 00073C03 */  sra       $a3, $a3, 16
/* DAE08 80144708 00121400 */  sll       $v0, $s2, 16
/* DAE0C 8014470C 00021403 */  sra       $v0, $v0, 16
/* DAE10 80144710 AFA20010 */  sw        $v0, 0x10($sp)
/* DAE14 80144714 00131400 */  sll       $v0, $s3, 16
/* DAE18 80144718 00021403 */  sra       $v0, $v0, 16
/* DAE1C 8014471C AFA20014 */  sw        $v0, 0x14($sp)
/* DAE20 80144720 00141400 */  sll       $v0, $s4, 16
/* DAE24 80144724 00021403 */  sra       $v0, $v0, 16
/* DAE28 80144728 AFA20018 */  sw        $v0, 0x18($sp)
/* DAE2C 8014472C 24020001 */  addiu     $v0, $zero, 0x1
/* DAE30 80144730 AFA0001C */  sw        $zero, 0x1C($sp)
/* DAE34 80144734 0C04FDC1 */  jal       hud_element_draw_rect
/* DAE38 80144738 AFA20020 */   sw       $v0, 0x20($sp)
.L8014473C:
/* DAE3C 8014473C 0200202D */  daddu     $a0, $s0, $zero
/* DAE40 80144740 02C0282D */  daddu     $a1, $s6, $zero
/* DAE44 80144744 02A0302D */  daddu     $a2, $s5, $zero
/* DAE48 80144748 00113C00 */  sll       $a3, $s1, 16
/* DAE4C 8014474C 00073C03 */  sra       $a3, $a3, 16
/* DAE50 80144750 00121400 */  sll       $v0, $s2, 16
/* DAE54 80144754 00021403 */  sra       $v0, $v0, 16
/* DAE58 80144758 AFA20010 */  sw        $v0, 0x10($sp)
/* DAE5C 8014475C 00131400 */  sll       $v0, $s3, 16
/* DAE60 80144760 00021403 */  sra       $v0, $v0, 16
/* DAE64 80144764 AFA20014 */  sw        $v0, 0x14($sp)
/* DAE68 80144768 00141400 */  sll       $v0, $s4, 16
/* DAE6C 8014476C 00021403 */  sra       $v0, $v0, 16
/* DAE70 80144770 AFA20018 */  sw        $v0, 0x18($sp)
/* DAE74 80144774 AFA0001C */  sw        $zero, 0x1C($sp)
.L80144778:
/* DAE78 80144778 0C04FDC1 */  jal       hud_element_draw_rect
/* DAE7C 8014477C AFA00020 */   sw       $zero, 0x20($sp)
.L80144780:
/* DAE80 80144780 8FBF0044 */  lw        $ra, 0x44($sp)
/* DAE84 80144784 8FB60040 */  lw        $s6, 0x40($sp)
/* DAE88 80144788 8FB5003C */  lw        $s5, 0x3C($sp)
/* DAE8C 8014478C 8FB40038 */  lw        $s4, 0x38($sp)
/* DAE90 80144790 8FB30034 */  lw        $s3, 0x34($sp)
/* DAE94 80144794 8FB20030 */  lw        $s2, 0x30($sp)
/* DAE98 80144798 8FB1002C */  lw        $s1, 0x2C($sp)
/* DAE9C 8014479C 8FB00028 */  lw        $s0, 0x28($sp)
/* DAEA0 801447A0 03E00008 */  jr        $ra
/* DAEA4 801447A4 27BD0048 */   addiu    $sp, $sp, 0x48

### DECOMPILED C INSTRUCTIONS:

void draw_hud_element_internal(s32 id, s32 clipMode) {
    HudElement* elem = (*gHudElements)[id & ~HUD_ELEMENT_BATTLE_ID_MASK];
    s32 texSizeX, texSizeY;
    s32 drawSizeX, drawSizeY;
    s32 offsetX, offsetY;
    s32 preset;

    if (elem->flags && !(elem->flags & HUD_ELEMENT_FLAG_DISABLED)) {
        if (!(elem->flags & (HUD_ELEMENT_FLAG_200000 | HUD_ELEMENT_FLAG_10000000)) && (elem->drawSizePreset >= 0)) {
            if (clipMode != HUD_ELEMENT_DRAW_NEXT) {
                if (clipMode == HUD_ELEMENT_DRAW_FIRST_WITH_CLIPPING) {
                    gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 12, 20, SCREEN_WIDTH - 12, SCREEN_HEIGHT - 20);
                }
                gDPPipeSync(gMainGfxPos++);
                gDPSetCycleType(gMainGfxPos++, G_CYC_1CYCLE);
                gDPSetTexturePersp(gMainGfxPos++, G_TP_NONE);
                gDPSetTextureLOD(gMainGfxPos++, G_TL_TILE);
                gDPSetTextureDetail(gMainGfxPos++, G_TD_CLAMP);
                gDPSetTextureConvert(gMainGfxPos++, G_TC_FILT);
                gDPSetCombineKey(gMainGfxPos++, G_CK_NONE);
                gDPSetAlphaCompare(gMainGfxPos++, G_AC_NONE);
                gDPNoOp(gMainGfxPos++);
                gDPSetColorDither(gMainGfxPos++, G_CD_DISABLE);
                gDPSetAlphaDither(gMainGfxPos++, G_AD_DISABLE);
                gSPTexture(gMainGfxPos++, -1, -1, 0, G_TX_RENDERTILE, G_ON);
            }

            if (!(elem->flags & HUD_ELEMENT_FLAG_FIXEDSCALE)) {
                if (!(elem->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
                    preset = elem->tileSizePreset;
                    texSizeX = gHudElementSizes[preset].width;
                    texSizeY = gHudElementSizes[preset].height;
                } else {
                    texSizeX = elem->customImageSize.x;
                    texSizeY = elem->customImageSize.y;
                }

                if (!(elem->flags & HUD_ELEMENT_FLAG_SCALED)) {
                    if (!(elem->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
                        drawSizeX = gHudElementSizes[elem->drawSizePreset].width;
                        drawSizeY = gHudElementSizes[elem->drawSizePreset].height;
                    } else {
                        drawSizeX = elem->customDrawSize.x;
                        drawSizeY = elem->customDrawSize.y;
                    }
                } else {
                    drawSizeX = elem->sizeX;
                    drawSizeY = elem->sizeY;
                }

                do {
                    offsetX = -drawSizeX / 2;
                    offsetY = -drawSizeY / 2;
                } while (0); // required to match

                if (!(elem->flags & HUD_ELEMENT_FLAG_REPEATED)) {
                    if (elem->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
                        hud_element_draw_rect(elem, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, TRUE, TRUE);
                    }
                    hud_element_draw_rect(elem, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, TRUE, FALSE);
                } else {
                    if (elem->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
                        hud_element_draw_rect(elem, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, TRUE);
                    }
                    hud_element_draw_rect(elem, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, FALSE);
                }
            } else {
                f32 xScaled, yScaled;

                if (!(elem->flags & HUD_ELEMENT_FLAG_CUSTOM_SIZE)) {
                    preset = elem->tileSizePreset;
                    texSizeX = gHudElementSizes[preset].width;
                    texSizeY = gHudElementSizes[preset].height;
                } else {
                    texSizeX = elem->customImageSize.x;
                    texSizeY = elem->customImageSize.y;
                }

                drawSizeX = elem->unkImgScale[0];
                drawSizeY = elem->unkImgScale[1];

                offsetX = -elem->unkImgScale[0] / 2;
                offsetY = -elem->unkImgScale[1] / 2;

                xScaled = (f32) drawSizeX / (f32) texSizeX;
                yScaled = (f32) drawSizeY / (f32) texSizeY;

                xScaled = 1.0f / xScaled;
                yScaled = 1.0f / yScaled;

                elem->widthScale = X10(xScaled);
                elem->heightScale = X10(yScaled);

                if (elem->flags & HUD_ELEMENT_FLAG_DROP_SHADOW) {
                    hud_element_draw_rect(elem, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, TRUE);
                }
                hud_element_draw_rect(elem, texSizeX, texSizeY, drawSizeX, drawSizeY, offsetX, offsetY, FALSE, FALSE);
            }
        }
    }
}