### RAW ASSEMBLY INSTRUCTIONS:

glabel func_80248BF4
/* 169454 80248BF4 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* 169458 80248BF8 AFB00010 */  sw        $s0, 0x10($sp)
.L80248BFC:
/* 16945C 80248BFC 0080802D */  daddu     $s0, $a0, $zero
D_80248C00:
/* 169460 80248C00 3C038025 */  lui       $v1, %hi(D_8024C08C)
D_80248C04:
/* 169464 80248C04 8C63C08C */  lw        $v1, %lo(D_8024C08C)($v1)
/* 169468 80248C08 3C020004 */  lui       $v0, (0x40000 >> 16)
glabel .L80248C0C
/* 16946C 80248C0C AFBF0018 */  sw        $ra, 0x18($sp)
/* 169470 80248C10 AFB10014 */  sw        $s1, 0x14($sp)
/* 169474 80248C14 92050003 */  lbu       $a1, 0x3($s0)
/* 169478 80248C18 00621024 */  and       $v0, $v1, $v0
/* 16947C 80248C1C 1040000A */  beqz      $v0, .L80248C48
/* 169480 80248C20 3C020008 */   lui      $v0, (0x80000 >> 16)
/* 169484 80248C24 92020001 */  lbu       $v0, 0x1($s0)
D_80248C28:
/* 169488 80248C28 2442FFFF */  addiu     $v0, $v0, -0x1
D_80248C2C:
/* 16948C 80248C2C A2020001 */  sb        $v0, 0x1($s0)
D_80248C30:
/* 169490 80248C30 00021600 */  sll       $v0, $v0, 24
D_80248C34:
/* 169494 80248C34 04410026 */  bgez      $v0, D_80248CD0
/* 169498 80248C38 00000000 */   nop
/* 16949C 80248C3C 92020005 */  lbu       $v0, 0x5($s0)
/* 1694A0 80248C40 08092333 */  j         .L80248CCC
/* 1694A4 80248C44 2442FFFF */   addiu    $v0, $v0, -0x1
.L80248C48:
/* 1694A8 80248C48 00621024 */  and       $v0, $v1, $v0
.L80248C4C:
/* 1694AC 80248C4C 10400020 */  beqz      $v0, D_80248CD0
/* 1694B0 80248C50 00000000 */   nop
/* 1694B4 80248C54 92020001 */  lbu       $v0, 0x1($s0)
D_80248C58:
/* 1694B8 80248C58 82030005 */  lb        $v1, 0x5($s0)
/* 1694BC 80248C5C 24420001 */  addiu     $v0, $v0, 0x1
/* 1694C0 80248C60 A2020001 */  sb        $v0, 0x1($s0)
/* 1694C4 80248C64 00021600 */  sll       $v0, $v0, 24
/* 1694C8 80248C68 00021603 */  sra       $v0, $v0, 24
D_80248C6C:
/* 1694CC 80248C6C 0043102A */  slt       $v0, $v0, $v1
D_80248C70:
/* 1694D0 80248C70 50400001 */  beql      $v0, $zero, .L80248C78
/* 1694D4 80248C74 A2000001 */   sb       $zero, 0x1($s0)
.L80248C78:
/* 1694D8 80248C78 82020006 */  lb        $v0, 0x6($s0)
/* 1694DC 80248C7C 82030002 */  lb        $v1, 0x2($s0)
/* 1694E0 80248C80 2442FFFF */  addiu     $v0, $v0, -0x1
D_80248C84:
/* 1694E4 80248C84 14620012 */  bne       $v1, $v0, D_80248CD0
/* 1694E8 80248C88 00000000 */   nop
/* 1694EC 80248C8C 82020001 */  lb        $v0, 0x1($s0)
glabel .L80248C90
/* 1694F0 80248C90 92030001 */  lbu       $v1, 0x1($s0)
D_80248C94:
/* 1694F4 80248C94 2842000B */  slti      $v0, $v0, 0xB
/* 1694F8 80248C98 14400003 */  bnez      $v0, .L80248CA8
/* 1694FC 80248C9C 2462FFF8 */   addiu    $v0, $v1, -0x8
/* 169500 80248CA0 08092334 */  j         D_80248CD0
/* 169504 80248CA4 A2000001 */   sb       $zero, 0x1($s0)
.L80248CA8:
/* 169508 80248CA8 304200FF */  andi      $v0, $v0, 0xFF
glabel .L80248CAC
/* 16950C 80248CAC 2C420002 */  sltiu     $v0, $v0, 0x2
D_80248CB0:
/* 169510 80248CB0 14400006 */  bnez      $v0, .L80248CCC
/* 169514 80248CB4 2402000A */   addiu    $v0, $zero, 0xA
.L80248CB8:
/* 169518 80248CB8 2462FFFB */  addiu     $v0, $v1, -0x5
/* 16951C 80248CBC 304200FF */  andi      $v0, $v0, 0xFF
.L80248CC0:
/* 169520 80248CC0 2C420002 */  sltiu     $v0, $v0, 0x2
/* 169524 80248CC4 10400002 */  beqz      $v0, D_80248CD0
D_80248CC8:
/* 169528 80248CC8 24020007 */   addiu    $v0, $zero, 0x7
.L80248CCC:
/* 16952C 80248CCC A2020001 */  sb        $v0, 0x1($s0)
D_80248CD0:
/* 169530 80248CD0 3C038025 */  lui       $v1, %hi(D_8024C08C)
D_80248CD4:
/* 169534 80248CD4 8C63C08C */  lw        $v1, %lo(D_8024C08C)($v1)
/* 169538 80248CD8 3C020001 */  lui       $v0, (0x10000 >> 16)
D_80248CDC:
/* 16953C 80248CDC 00621024 */  and       $v0, $v1, $v0
/* 169540 80248CE0 1040000B */  beqz      $v0, .L80248D10
/* 169544 80248CE4 3C020002 */   lui      $v0, (0x20000 >> 16)
/* 169548 80248CE8 92020002 */  lbu       $v0, 0x2($s0)
.L80248CEC:
/* 16954C 80248CEC 2442FFFF */  addiu     $v0, $v0, -0x1
D_80248CF0:
/* 169550 80248CF0 A2020002 */  sb        $v0, 0x2($s0)
/* 169554 80248CF4 00021600 */  sll       $v0, $v0, 24
/* 169558 80248CF8 04410011 */  bgez      $v0, .L80248D40
/* 16955C 80248CFC 00000000 */   nop
/* 169560 80248D00 92020006 */  lbu       $v0, 0x6($s0)
/* 169564 80248D04 2442FFFF */  addiu     $v0, $v0, -0x1
D_80248D08:
/* 169568 80248D08 08092350 */  j         .L80248D40
/* 16956C 80248D0C A2020002 */   sb       $v0, 0x2($s0)
.L80248D10:
/* 169570 80248D10 00621024 */  and       $v0, $v1, $v0
/* 169574 80248D14 1040000A */  beqz      $v0, .L80248D40
D_80248D18:
/* 169578 80248D18 00000000 */   nop
/* 16957C 80248D1C 92020002 */  lbu       $v0, 0x2($s0)
.L80248D20:
/* 169580 80248D20 82030006 */  lb        $v1, 0x6($s0)
D_80248D24:
/* 169584 80248D24 24420001 */  addiu     $v0, $v0, 0x1
D_80248D28:
/* 169588 80248D28 A2020002 */  sb        $v0, 0x2($s0)
/* 16958C 80248D2C 00021600 */  sll       $v0, $v0, 24
/* 169590 80248D30 00021603 */  sra       $v0, $v0, 24
D_80248D34:
/* 169594 80248D34 0043102A */  slt       $v0, $v0, $v1
/* 169598 80248D38 50400001 */  beql      $v0, $zero, .L80248D40
D_80248D3C:
/* 16959C 80248D3C A2000002 */   sb       $zero, 0x2($s0)
.L80248D40:
/* 1695A0 80248D40 82020006 */  lb        $v0, 0x6($s0)
/* 1695A4 80248D44 82030002 */  lb        $v1, 0x2($s0)
/* 1695A8 80248D48 2442FFFF */  addiu     $v0, $v0, -0x1
D_80248D4C:
/* 1695AC 80248D4C 14620012 */  bne       $v1, $v0, .L80248D98
/* 1695B0 80248D50 00000000 */   nop
D_80248D54:
/* 1695B4 80248D54 82020001 */  lb        $v0, 0x1($s0)
/* 1695B8 80248D58 92030001 */  lbu       $v1, 0x1($s0)
.L80248D5C:
/* 1695BC 80248D5C 2842000B */  slti      $v0, $v0, 0xB
D_80248D60:
/* 1695C0 80248D60 14400003 */  bnez      $v0, .L80248D70
/* 1695C4 80248D64 2462FFF8 */   addiu    $v0, $v1, -0x8
/* 1695C8 80248D68 08092365 */  j         .L80248D94
/* 1695CC 80248D6C 2402000A */   addiu    $v0, $zero, 0xA
.L80248D70:
/* 1695D0 80248D70 304200FF */  andi      $v0, $v0, 0xFF
/* 1695D4 80248D74 2C420002 */  sltiu     $v0, $v0, 0x2
glabel func_80248D78
/* 1695D8 80248D78 14400006 */  bnez      $v0, .L80248D94
/* 1695DC 80248D7C 24020007 */   addiu    $v0, $zero, 0x7
/* 1695E0 80248D80 2462FFFB */  addiu     $v0, $v1, -0x5
/* 1695E4 80248D84 304200FF */  andi      $v0, $v0, 0xFF
/* 1695E8 80248D88 2C420002 */  sltiu     $v0, $v0, 0x2
D_80248D8C:
/* 1695EC 80248D8C 10400002 */  beqz      $v0, .L80248D98
D_80248D90:
/* 1695F0 80248D90 24020004 */   addiu    $v0, $zero, 0x4
.L80248D94:
/* 1695F4 80248D94 A2020001 */  sb        $v0, 0x1($s0)
.L80248D98:
/* 1695F8 80248D98 82020004 */  lb        $v0, 0x4($s0)
/* 1695FC 80248D9C 82030005 */  lb        $v1, 0x5($s0)
/* 169600 80248DA0 00430018 */  mult      $v0, $v1
/* 169604 80248DA4 00003812 */  mflo      $a3
/* 169608 80248DA8 82020006 */  lb        $v0, 0x6($s0)
/* 16960C 80248DAC 00000000 */  nop
/* 169610 80248DB0 00E20018 */  mult      $a3, $v0
/* 169614 80248DB4 00002012 */  mflo      $a0
/* 169618 80248DB8 82020002 */  lb        $v0, 0x2($s0)
.L80248DBC:
/* 16961C 80248DBC 00000000 */  nop
/* 169620 80248DC0 00620018 */  mult      $v1, $v0
.L80248DC4:
/* 169624 80248DC4 00001012 */  mflo      $v0
D_80248DC8:
/* 169628 80248DC8 00821821 */  addu      $v1, $a0, $v0
/* 16962C 80248DCC 82040001 */  lb        $a0, 0x1($s0)
glabel func_80248DD0
/* 169630 80248DD0 8E020008 */  lw        $v0, 0x8($s0)
/* 169634 80248DD4 00641821 */  addu      $v1, $v1, $a0
D_80248DD8:
/* 169638 80248DD8 00431021 */  addu      $v0, $v0, $v1
/* 16963C 80248DDC 90420000 */  lbu       $v0, 0x0($v0)
/* 169640 80248DE0 A2020003 */  sb        $v0, 0x3($s0)
glabel func_80248DE4
/* 169644 80248DE4 304200FF */  andi      $v0, $v0, 0xFF
/* 169648 80248DE8 10A20003 */  beq       $a1, $v0, .L80248DF8
.L80248DEC:
/* 16964C 80248DEC 00000000 */   nop
/* 169650 80248DF0 0C05272D */  jal       sfx_play_sound
/* 169654 80248DF4 24042102 */   addiu    $a0, $zero, 0x2102
.L80248DF8:
/* 169658 80248DF8 3C028025 */  lui       $v0, %hi(D_8024C084)
/* 16965C 80248DFC 8C42C084 */  lw        $v0, %lo(D_8024C084)($v0)
.L80248E00:
/* 169660 80248E00 30428000 */  andi      $v0, $v0, 0x8000
/* 169664 80248E04 1040009A */  beqz      $v0, dgb_01_img2_png
/* 169668 80248E08 00000000 */   nop
/* 16966C 80248E0C 92020003 */  lbu       $v0, 0x3($s0)
/* 169670 80248E10 2443FF3A */  addiu     $v1, $v0, -0xC6
/* 169674 80248E14 2C620005 */  sltiu     $v0, $v1, 0x5
.L80248E18:
/* 169678 80248E18 1040006D */  beqz      $v0, .L80248FD0
/* 16967C 80248E1C 00031080 */   sll      $v0, $v1, 2
/* 169680 80248E20 3C018025 */  lui       $at, %hi(jtbl_8024C060)
/* 169684 80248E24 00220821 */  addu      $at, $at, $v0
/* 169688 80248E28 8C22C060 */  lw        $v0, %lo(jtbl_8024C060)($at)
/* 16968C 80248E2C 00400008 */  jr        $v0
D_80248E30:
/* 169690 80248E30 00000000 */   nop
glabel .L80248E34
/* 169694 80248E34 0C05272D */  jal       sfx_play_sound
/* 169698 80248E38 24042103 */   addiu    $a0, $zero, 0x2103
/* 16969C 80248E3C 3C048025 */  lui       $a0, %hi(D_8024C090)
.L80248E40:
/* 1696A0 80248E40 2484C090 */  addiu     $a0, $a0, %lo(D_8024C090)
/* 1696A4 80248E44 80820000 */  lb        $v0, 0x0($a0)
/* 1696A8 80248E48 24050008 */  addiu     $a1, $zero, 0x8
/* 1696AC 80248E4C 14450002 */  bne       $v0, $a1, .L80248E58
/* 1696B0 80248E50 24020007 */   addiu    $v0, $zero, 0x7
.L80248E54:
/* 1696B4 80248E54 A0820000 */  sb        $v0, 0x0($a0)
.L80248E58:
/* 1696B8 80248E58 80830000 */  lb        $v1, 0x0($a0)
/* 1696BC 80248E5C 08092402 */  j         .L80249008
/* 1696C0 80248E60 240200F7 */   addiu    $v0, $zero, 0xF7
glabel .L80248E64
/* 1696C4 80248E64 82020004 */  lb        $v0, 0x4($s0)
/* 1696C8 80248E68 24110001 */  addiu     $s1, $zero, 0x1
/* 1696CC 80248E6C 10510071 */  beq       $v0, $s1, .L80249034
/* 1696D0 80248E70 00000000 */   nop
/* 1696D4 80248E74 0C05272D */  jal       sfx_play_sound
/* 1696D8 80248E78 24042105 */   addiu    $a0, $zero, 0x2105
.L80248E7C:
/* 1696DC 80248E7C 82050001 */  lb        $a1, 0x1($s0)
/* 1696E0 80248E80 82060002 */  lb        $a2, 0x2($s0)
/* 1696E4 80248E84 0200202D */  daddu     $a0, $s0, $zero
/* 1696E8 80248E88 080923AD */  j         .L80248EB4
/* 1696EC 80248E8C A2110004 */   sb       $s1, 0x4($s0)
glabel .L80248E90
/* 1696F0 80248E90 82020004 */  lb        $v0, 0x4($s0)
/* 1696F4 80248E94 10400067 */  beqz      $v0, .L80249034
/* 1696F8 80248E98 00000000 */   nop
/* 1696FC 80248E9C 0C05272D */  jal       sfx_play_sound
/* 169700 80248EA0 24042105 */   addiu    $a0, $zero, 0x2105
/* 169704 80248EA4 82050001 */  lb        $a1, 0x1($s0)
/* 169708 80248EA8 82060002 */  lb        $a2, 0x2($s0)
/* 16970C 80248EAC 0200202D */  daddu     $a0, $s0, $zero
/* 169710 80248EB0 A2000004 */  sb        $zero, 0x4($s0)
.L80248EB4:
/* 169714 80248EB4 0C090B65 */  jal       func_80242D94
/* 169718 80248EB8 00000000 */   nop
D_80248EBC:
/* 16971C 80248EBC 3C058025 */  lui       $a1, %hi(func_80248170)
/* 169720 80248EC0 24A58170 */  addiu     $a1, $a1, %lo(func_80248170)
/* 169724 80248EC4 0C051F9F */  jal       set_window_update
/* 169728 80248EC8 24040031 */   addiu    $a0, $zero, 0x31
/* 16972C 80248ECC 0809240D */  j         .L80249034
/* 169730 80248ED0 00000000 */   nop
glabel .L80248ED4
/* 169734 80248ED4 0000182D */  daddu     $v1, $zero, $zero
/* 169738 80248ED8 3C058025 */  lui       $a1, %hi(D_8024C110)
.L80248EDC:
/* 16973C 80248EDC 24A5C110 */  addiu     $a1, $a1, %lo(D_8024C110)
/* 169740 80248EE0 240400F7 */  addiu     $a0, $zero, 0xF7
/* 169744 80248EE4 00651021 */  addu      $v0, $v1, $a1
.L80248EE8:
/* 169748 80248EE8 90420000 */  lbu       $v0, 0x0($v0)
/* 16974C 80248EEC 14440006 */  bne       $v0, $a0, .L80248F08
/* 169750 80248EF0 24020008 */   addiu    $v0, $zero, 0x8
/* 169754 80248EF4 24630001 */  addiu     $v1, $v1, 0x1
/* 169758 80248EF8 28620008 */  slti      $v0, $v1, 0x8
/* 16975C 80248EFC 1440FFFA */  bnez      $v0, .L80248EE8
/* 169760 80248F00 00651021 */   addu     $v0, $v1, $a1
/* 169764 80248F04 24020008 */  addiu     $v0, $zero, 0x8
.L80248F08:
/* 169768 80248F08 14620005 */  bne       $v1, $v0, D_80248F20
/* 16976C 80248F0C 00000000 */   nop
/* 169770 80248F10 0C05272D */  jal       sfx_play_sound
/* 169774 80248F14 2404021D */   addiu    $a0, $zero, 0x21D
D_80248F18:
/* 169778 80248F18 0809240D */  j         .L80249034
/* 16977C 80248F1C 00000000 */   nop
D_80248F20:
/* 169780 80248F20 0C05272D */  jal       sfx_play_sound
/* 169784 80248F24 240400C9 */   addiu    $a0, $zero, 0xC9
D_80248F28:
/* 169788 80248F28 3C058024 */  lui       $a1, %hi(func_80243CCC)
/* 16978C 80248F2C 24A53CCC */  addiu     $a1, $a1, %lo(func_80243CCC)
/* 169790 80248F30 0C051F9F */  jal       set_window_update
/* 169794 80248F34 24040032 */   addiu    $a0, $zero, 0x32
/* 169798 80248F38 3C048016 */  lui       $a0, %hi(gWindows)
/* 16979C 80248F3C 24849D50 */  addiu     $a0, $a0, %lo(gWindows)
/* 1697A0 80248F40 24020079 */  addiu     $v0, $zero, 0x79
/* 1697A4 80248F44 A482064E */  sh        $v0, 0x64E($a0)
D_80248F48:
/* 1697A8 80248F48 24020045 */  addiu     $v0, $zero, 0x45
/* 1697AC 80248F4C A4820650 */  sh        $v0, 0x650($a0)
/* 1697B0 80248F50 2402002C */  addiu     $v0, $zero, 0x2C
.L80248F54:
/* 1697B4 80248F54 80830643 */  lb        $v1, 0x643($a0)
/* 1697B8 80248F58 A4820652 */  sh        $v0, 0x652($a0)
/* 1697BC 80248F5C 2402FFFF */  addiu     $v0, $zero, -0x1
D_80248F60:
/* 1697C0 80248F60 1062000B */  beq       $v1, $v0, D_80248F90
/* 1697C4 80248F64 2485064C */   addiu    $a1, $a0, 0x64C
/* 1697C8 80248F68 00031140 */  sll       $v0, $v1, 5
/* 1697CC 80248F6C 00441021 */  addu      $v0, $v0, $a0
D_80248F70:
/* 1697D0 80248F70 94420010 */  lhu       $v0, 0x10($v0)
/* 1697D4 80248F74 00021400 */  sll       $v0, $v0, 16
/* 1697D8 80248F78 00021C03 */  sra       $v1, $v0, 16
.L80248F7C:
/* 1697DC 80248F7C 000217C2 */  srl       $v0, $v0, 31
.L80248F80:
/* 1697E0 80248F80 00621821 */  addu      $v1, $v1, $v0
.L80248F84:
/* 1697E4 80248F84 00031843 */  sra       $v1, $v1, 1
/* 1697E8 80248F88 080923E7 */  j         .L80248F9C
/* 1697EC 80248F8C 2463FFDE */   addiu    $v1, $v1, -0x22
D_80248F90:
/* 1697F0 80248F90 2403007E */  addiu     $v1, $zero, 0x7E
/* 1697F4 80248F94 3C048016 */  lui       $a0, %hi(gWindows)
/* 1697F8 80248F98 24849D50 */  addiu     $a0, $a0, %lo(gWindows)
.L80248F9C:
/* 1697FC 80248F9C 2402FFBA */  addiu     $v0, $zero, -0x46
/* 169800 80248FA0 A4A30000 */  sh        $v1, 0x0($a1)
/* 169804 80248FA4 A48205CE */  sh        $v0, 0x5CE($a0)
/* 169808 80248FA8 240200A4 */  addiu     $v0, $zero, 0xA4
/* 16980C 80248FAC A48205D0 */  sh        $v0, 0x5D0($a0)
/* 169810 80248FB0 2402003E */  addiu     $v0, $zero, 0x3E
/* 169814 80248FB4 808305C3 */  lb        $v1, 0x5C3($a0)
/* 169818 80248FB8 A48205D2 */  sh        $v0, 0x5D2($a0)
/* 16981C 80248FBC 2402FFFF */  addiu     $v0, $zero, -0x1
glabel func_80248FC0
/* 169820 80248FC0 146200BD */  bne       $v1, $v0, .L802492B8
/* 169824 80248FC4 248705CC */   addiu    $a3, $a0, 0x5CC
/* 169828 80248FC8 080924B9 */  j         .L802492E4
.L80248FCC:
/* 16982C 80248FCC 2403004E */   addiu    $v1, $zero, 0x4E
.L80248FD0:
/* 169830 80248FD0 0C05272D */  jal       sfx_play_sound
/* 169834 80248FD4 24042103 */   addiu    $a0, $zero, 0x2103
/* 169838 80248FD8 3C048025 */  lui       $a0, %hi(D_8024C090)
/* 16983C 80248FDC 2484C090 */  addiu     $a0, $a0, %lo(D_8024C090)
/* 169840 80248FE0 80830000 */  lb        $v1, 0x0($a0)
/* 169844 80248FE4 24050008 */  addiu     $a1, $zero, 0x8
/* 169848 80248FE8 14650006 */  bne       $v1, $a1, .L80249004
/* 16984C 80248FEC 00000000 */   nop
dgb_01_img1_gfx:
/* 169850 80248FF0 92020003 */  lbu       $v0, 0x3($s0)
/* 169854 80248FF4 3C018025 */  lui       $at, %hi(D_8024C117)
/* 169858 80248FF8 A022C117 */  sb        $v0, %lo(D_8024C117)($at)
/* 16985C 80248FFC 0809240D */  j         .L80249034
/* 169860 80249000 00000000 */   nop
.L80249004:
/* 169864 80249004 92020003 */  lbu       $v0, 0x3($s0)
.L80249008:
/* 169868 80249008 3C018025 */  lui       $at, %hi(D_8024C110)
/* 16986C 8024900C 00230821 */  addu      $at, $at, $v1
/* 169870 80249010 A022C110 */  sb        $v0, %lo(D_8024C110)($at)
/* 169874 80249014 90820000 */  lbu       $v0, 0x0($a0)
/* 169878 80249018 24420001 */  addiu     $v0, $v0, 0x1
.L8024901C:
/* 16987C 8024901C A0820000 */  sb        $v0, 0x0($a0)
/* 169880 80249020 00021600 */  sll       $v0, $v0, 24
/* 169884 80249024 00021603 */  sra       $v0, $v0, 24
/* 169888 80249028 28420009 */  slti      $v0, $v0, 0x9
.L8024902C:
/* 16988C 8024902C 50400001 */  beql      $v0, $zero, .L80249034
/* 169890 80249030 A0850000 */   sb       $a1, 0x0($a0)
glabel .L80249034
/* 169894 80249034 92020003 */  lbu       $v0, 0x3($s0)
/* 169898 80249038 24420039 */  addiu     $v0, $v0, 0x39
D_8024903C:
/* 16989C 8024903C 304200FF */  andi      $v0, $v0, 0xFF
/* 1698A0 80249040 2C420003 */  sltiu     $v0, $v0, 0x3
/* 1698A4 80249044 1440000A */  bnez      $v0, dgb_01_img2_png
/* 1698A8 80249048 24020008 */   addiu    $v0, $zero, 0x8
/* 1698AC 8024904C 3C038025 */  lui       $v1, %hi(D_8024C090)
/* 1698B0 80249050 8063C090 */  lb        $v1, %lo(D_8024C090)($v1)
/* 1698B4 80249054 14620006 */  bne       $v1, $v0, dgb_01_img2_png
/* 1698B8 80249058 0200202D */   daddu    $a0, $s0, $zero
/* 1698BC 8024905C 82050005 */  lb        $a1, 0x5($s0)
/* 1698C0 80249060 82060006 */  lb        $a2, 0x6($s0)
.L80249064:
/* 1698C4 80249064 24A5FFFD */  addiu     $a1, $a1, -0x3
/* 1698C8 80249068 0C090B65 */  jal       func_80242D94
D_8024906C:
/* 1698CC 8024906C 24C6FFFF */   addiu    $a2, $a2, -0x1
dgb_01_img2_png:
/* 1698D0 80249070 3C038025 */  lui       $v1, %hi(D_8024C084)
/* 1698D4 80249074 8C63C084 */  lw        $v1, %lo(D_8024C084)($v1)
/* 1698D8 80249078 30624000 */  andi      $v0, $v1, 0x4000
/* 1698DC 8024907C 14400006 */  bnez      $v0, .L80249098
/* 1698E0 80249080 30628000 */   andi     $v0, $v1, 0x8000
/* 1698E4 80249084 1040004B */  beqz      $v0, .L802491B4
/* 1698E8 80249088 240200C9 */   addiu    $v0, $zero, 0xC9
.L8024908C:
/* 1698EC 8024908C 92030003 */  lbu       $v1, 0x3($s0)
/* 1698F0 80249090 14620048 */  bne       $v1, $v0, .L802491B4
/* 1698F4 80249094 00000000 */   nop
.L80249098:
/* 1698F8 80249098 0C05272D */  jal       sfx_play_sound
D_8024909C:
/* 1698FC 8024909C 24042104 */   addiu    $a0, $zero, 0x2104
/* 169900 802490A0 3C038025 */  lui       $v1, %hi(D_8024C090)
/* 169904 802490A4 2463C090 */  addiu     $v1, $v1, %lo(D_8024C090)
glabel func_802490A8
/* 169908 802490A8 90620000 */  lbu       $v0, 0x0($v1)
/* 16990C 802490AC 2442FFFF */  addiu     $v0, $v0, -0x1
/* 169910 802490B0 A0620000 */  sb        $v0, 0x0($v1)
/* 169914 802490B4 00021600 */  sll       $v0, $v0, 24
/* 169918 802490B8 00021603 */  sra       $v0, $v0, 24
/* 16991C 802490BC 04430031 */  bgezl     $v0, .L80249184
/* 169920 802490C0 0040182D */   daddu    $v1, $v0, $zero
/* 169924 802490C4 24040030 */  addiu     $a0, $zero, 0x30
/* 169928 802490C8 3C108024 */  lui       $s0, %hi(D_80243628)
/* 16992C 802490CC 26103628 */  addiu     $s0, $s0, %lo(D_80243628)
/* 169930 802490D0 0200282D */  daddu     $a1, $s0, $zero
/* 169934 802490D4 0C051F9F */  jal       set_window_update
/* 169938 802490D8 A0600000 */   sb       $zero, 0x0($v1)
/* 16993C 802490DC 24040031 */  addiu     $a0, $zero, 0x31
/* 169940 802490E0 0C051F9F */  jal       set_window_update
/* 169944 802490E4 0200282D */   daddu    $a1, $s0, $zero
/* 169948 802490E8 2404002D */  addiu     $a0, $zero, 0x2D
/* 16994C 802490EC 3C108024 */  lui       $s0, %hi(func_8024381C)
/* 169950 802490F0 2610381C */  addiu     $s0, $s0, %lo(func_8024381C)
/* 169954 802490F4 0C051F9F */  jal       set_window_update
.L802490F8:
/* 169958 802490F8 0200282D */   daddu    $a1, $s0, $zero
/* 16995C 802490FC 24040033 */  addiu     $a0, $zero, 0x33
/* 169960 80249100 0C051F9F */  jal       set_window_update
/* 169964 80249104 0200282D */   daddu    $a1, $s0, $zero
/* 169968 80249108 24040034 */  addiu     $a0, $zero, 0x34
.L8024910C:
/* 16996C 8024910C 0C051F9F */  jal       set_window_update
.L80249110:
/* 169970 80249110 0200282D */   daddu    $a1, $s0, $zero
/* 169974 80249114 24040035 */  addiu     $a0, $zero, 0x35
/* 169978 80249118 0C051F9F */  jal       set_window_update
/* 16997C 8024911C 0200282D */   daddu    $a1, $s0, $zero
/* 169980 80249120 24040036 */  addiu     $a0, $zero, 0x36
/* 169984 80249124 0C051F9F */  jal       set_window_update
flo_00_pad_9128:
/* 169988 80249128 0200282D */   daddu    $a1, $s0, $zero
/* 16998C 8024912C 24040037 */  addiu     $a0, $zero, 0x37
D_80249130:
/* 169990 80249130 0C051F9F */  jal       set_window_update
/* 169994 80249134 0200282D */   daddu    $a1, $s0, $zero
.L80249138:
/* 169998 80249138 24040035 */  addiu     $a0, $zero, 0x35
/* 16999C 8024913C 0C051F9F */  jal       set_window_update
.L80249140:
/* 1699A0 80249140 0200282D */   daddu    $a1, $s0, $zero
/* 1699A4 80249144 24040038 */  addiu     $a0, $zero, 0x38
/* 1699A8 80249148 0C051F9F */  jal       set_window_update
/* 1699AC 8024914C 0200282D */   daddu    $a1, $s0, $zero
/* 1699B0 80249150 24040039 */  addiu     $a0, $zero, 0x39
/* 1699B4 80249154 0C051F9F */  jal       set_window_update
D_80249158:
/* 1699B8 80249158 0200282D */   daddu    $a1, $s0, $zero
/* 1699BC 8024915C 2404003A */  addiu     $a0, $zero, 0x3A
/* 1699C0 80249160 0C051F9F */  jal       set_window_update
/* 1699C4 80249164 0200282D */   daddu    $a1, $s0, $zero
D_80249168:
/* 1699C8 80249168 2404003B */  addiu     $a0, $zero, 0x3B
/* 1699CC 8024916C 0C051F9F */  jal       set_window_update
/* 1699D0 80249170 0200282D */   daddu    $a1, $s0, $zero
/* 1699D4 80249174 3C018025 */  lui       $at, %hi(D_8024C098_C09918)
/* 1699D8 80249178 A020C098 */  sb        $zero, %lo(D_8024C098_C09918)($at)
.L8024917C:
/* 1699DC 8024917C 080924C4 */  j         .L80249310
/* 1699E0 80249180 00000000 */   nop
.L80249184:
/* 1699E4 80249184 28620008 */  slti      $v0, $v1, 0x8
/* 1699E8 80249188 1040000A */  beqz      $v0, .L802491B4
D_8024918C:
/* 1699EC 8024918C 00000000 */   nop
.L80249190:
/* 1699F0 80249190 3C058025 */  lui       $a1, %hi(D_8024C110)
/* 1699F4 80249194 24A5C110 */  addiu     $a1, $a1, %lo(D_8024C110)
/* 1699F8 80249198 240400F7 */  addiu     $a0, $zero, 0xF7
D_8024919C:
/* 1699FC 8024919C 00651021 */  addu      $v0, $v1, $a1
.L802491A0:
/* 169A00 802491A0 A0440000 */  sb        $a0, 0x0($v0)
/* 169A04 802491A4 24630001 */  addiu     $v1, $v1, 0x1
/* 169A08 802491A8 28620008 */  slti      $v0, $v1, 0x8
/* 169A0C 802491AC 1440FFFC */  bnez      $v0, .L802491A0
D_802491B0:
/* 169A10 802491B0 00651021 */   addu     $v0, $v1, $a1
.L802491B4:
/* 169A14 802491B4 3C028025 */  lui       $v0, %hi(D_8024C084)
D_802491B8:
/* 169A18 802491B8 8C42C084 */  lw        $v0, %lo(D_8024C084)($v0)
/* 169A1C 802491BC 30421000 */  andi      $v0, $v0, 0x1000
D_802491C0:
/* 169A20 802491C0 10400053 */  beqz      $v0, .L80249310
/* 169A24 802491C4 0000182D */   daddu    $v1, $zero, $zero
D_802491C8:
/* 169A28 802491C8 3C058025 */  lui       $a1, %hi(D_8024C110)
.L802491CC:
/* 169A2C 802491CC 24A5C110 */  addiu     $a1, $a1, %lo(D_8024C110)
D_802491D0:
/* 169A30 802491D0 240400F7 */  addiu     $a0, $zero, 0xF7
/* 169A34 802491D4 00651021 */  addu      $v0, $v1, $a1
D_802491D8:
/* 169A38 802491D8 90420000 */  lbu       $v0, 0x0($v0)
/* 169A3C 802491DC 14440006 */  bne       $v0, $a0, D_802491F8_EC2048
D_802491E0:
/* 169A40 802491E0 24020008 */   addiu    $v0, $zero, 0x8
.L802491E4:
/* 169A44 802491E4 24630001 */  addiu     $v1, $v1, 0x1
/* 169A48 802491E8 28620008 */  slti      $v0, $v1, 0x8
/* 169A4C 802491EC 1440FFFA */  bnez      $v0, D_802491D8
D_802491F0_EC2040:
/* 169A50 802491F0 00651021 */   addu     $v0, $v1, $a1
/* 169A54 802491F4 24020008 */  addiu     $v0, $zero, 0x8
D_802491F8_EC2048:
/* 169A58 802491F8 14620005 */  bne       $v1, $v0, .L80249210
.L802491FC:
/* 169A5C 802491FC 00000000 */   nop
jtbl_80249200:
/* 169A60 80249200 0C05272D */  jal       sfx_play_sound
/* 169A64 80249204 2404021D */   addiu    $a0, $zero, 0x21D
/* 169A68 80249208 080924C4 */  j         .L80249310
.L8024920C:
/* 169A6C 8024920C 00000000 */   nop
.L80249210:
/* 169A70 80249210 0C05272D */  jal       sfx_play_sound
/* 169A74 80249214 240400C9 */   addiu    $a0, $zero, 0xC9
/* 169A78 80249218 3C058024 */  lui       $a1, %hi(func_80243CCC)
.L8024921C:
/* 169A7C 8024921C 24A53CCC */  addiu     $a1, $a1, %lo(func_80243CCC)
/* 169A80 80249220 0C051F9F */  jal       set_window_update
/* 169A84 80249224 24040032 */   addiu    $a0, $zero, 0x32
/* 169A88 80249228 3C048016 */  lui       $a0, %hi(gWindows)
/* 169A8C 8024922C 24849D50 */  addiu     $a0, $a0, %lo(gWindows)
/* 169A90 80249230 24020079 */  addiu     $v0, $zero, 0x79
.L80249234:
/* 169A94 80249234 A482064E */  sh        $v0, 0x64E($a0)
/* 169A98 80249238 24020045 */  addiu     $v0, $zero, 0x45
.L8024923C:
/* 169A9C 8024923C A4820650 */  sh        $v0, 0x650($a0)
/* 169AA0 80249240 2402002C */  addiu     $v0, $zero, 0x2C
/* 169AA4 80249244 80830643 */  lb        $v1, 0x643($a0)
/* 169AA8 80249248 A4820652 */  sh        $v0, 0x652($a0)
/* 169AAC 8024924C 2402FFFF */  addiu     $v0, $zero, -0x1
/* 169AB0 80249250 1062000B */  beq       $v1, $v0, .L80249280
/* 169AB4 80249254 2485064C */   addiu    $a1, $a0, 0x64C
D_80249258:
/* 169AB8 80249258 00031140 */  sll       $v0, $v1, 5
/* 169ABC 8024925C 00441021 */  addu      $v0, $v0, $a0
/* 169AC0 80249260 94420010 */  lhu       $v0, 0x10($v0)
/* 169AC4 80249264 00021400 */  sll       $v0, $v0, 16
/* 169AC8 80249268 00021C03 */  sra       $v1, $v0, 16
/* 169ACC 8024926C 000217C2 */  srl       $v0, $v0, 31
/* 169AD0 80249270 00621821 */  addu      $v1, $v1, $v0
.L80249274:
/* 169AD4 80249274 00031843 */  sra       $v1, $v1, 1
/* 169AD8 80249278 080924A3 */  j         .L8024928C
/* 169ADC 8024927C 2463FFDE */   addiu    $v1, $v1, -0x22
.L80249280:
/* 169AE0 80249280 2403007E */  addiu     $v1, $zero, 0x7E
.L80249284:
/* 169AE4 80249284 3C048016 */  lui       $a0, %hi(gWindows)
/* 169AE8 80249288 24849D50 */  addiu     $a0, $a0, %lo(gWindows)
.L8024928C:
/* 169AEC 8024928C 2402FFBA */  addiu     $v0, $zero, -0x46
.L80249290:
/* 169AF0 80249290 A4A30000 */  sh        $v1, 0x0($a1)
/* 169AF4 80249294 A48205CE */  sh        $v0, 0x5CE($a0)
/* 169AF8 80249298 240200A4 */  addiu     $v0, $zero, 0xA4
/* 169AFC 8024929C A48205D0 */  sh        $v0, 0x5D0($a0)
/* 169B00 802492A0 2402003E */  addiu     $v0, $zero, 0x3E
/* 169B04 802492A4 808305C3 */  lb        $v1, 0x5C3($a0)
/* 169B08 802492A8 A48205D2 */  sh        $v0, 0x5D2($a0)
.L802492AC:
/* 169B0C 802492AC 2402FFFF */  addiu     $v0, $zero, -0x1
/* 169B10 802492B0 1062000B */  beq       $v1, $v0, .L802492E0
.L802492B4:
/* 169B14 802492B4 248705CC */   addiu    $a3, $a0, 0x5CC
.L802492B8:
/* 169B18 802492B8 00031140 */  sll       $v0, $v1, 5
/* 169B1C 802492BC 00441021 */  addu      $v0, $v0, $a0
/* 169B20 802492C0 94420010 */  lhu       $v0, 0x10($v0)
/* 169B24 802492C4 00021400 */  sll       $v0, $v0, 16
/* 169B28 802492C8 00021C03 */  sra       $v1, $v0, 16
/* 169B2C 802492CC 000217C2 */  srl       $v0, $v0, 31
/* 169B30 802492D0 00621821 */  addu      $v1, $v1, $v0
/* 169B34 802492D4 00031843 */  sra       $v1, $v1, 1
.L802492D8:
/* 169B38 802492D8 080924B9 */  j         .L802492E4
/* 169B3C 802492DC 2463FFAE */   addiu    $v1, $v1, -0x52
.L802492E0:
/* 169B40 802492E0 2403004E */  addiu     $v1, $zero, 0x4E
.L802492E4:
/* 169B44 802492E4 0000282D */  daddu     $a1, $zero, $zero
/* 169B48 802492E8 00A0302D */  daddu     $a2, $a1, $zero
/* 169B4C 802492EC A4E30000 */  sh        $v1, 0x0($a3)
/* 169B50 802492F0 3C048025 */  lui       $a0, %hi(D_80249B88)
/* 169B54 802492F4 8C849B88 */  lw        $a0, %lo(D_80249B88)($a0)
/* 169B58 802492F8 24020001 */  addiu     $v0, $zero, 0x1
/* 169B5C 802492FC 3C018025 */  lui       $at, %hi(D_8024C098_C09918)
/* 169B60 80249300 A022C098 */  sb        $v0, %lo(D_8024C098_C09918)($at)
/* 169B64 80249304 24020002 */  addiu     $v0, $zero, 0x2
/* 169B68 80249308 0C090B65 */  jal       func_80242D94
/* 169B6C 8024930C A0820004 */   sb       $v0, 0x4($a0)
.L80249310:
/* 169B70 80249310 8FBF0018 */  lw        $ra, 0x18($sp)
/* 169B74 80249314 8FB10014 */  lw        $s1, 0x14($sp)
/* 169B78 80249318 8FB00010 */  lw        $s0, 0x10($sp)
/* 169B7C 8024931C 03E00008 */  jr        $ra
/* 169B80 80249320 27BD0020 */   addiu    $sp, $sp, 0x20

### DECOMPILED C INSTRUCTIONS:

void filemenu_choose_name_handle_input(MenuPanel* menu) {
    s32 oldSelected = menu->selected;
    MenuPanel* newMenu;
    MenuPanel* newMenu2;
    s32 temp;
    s32 i;

    if (filemenu_heldButtons & BUTTON_STICK_LEFT) {
        menu->col--;
        if (menu->col < 0) {
            menu->col = menu->numCols - 1;
        }
    } else if (filemenu_heldButtons & BUTTON_STICK_RIGHT) {
        menu->col++;
        if (menu->col >= menu->numCols) {
            menu->col = 0;
        }
        if (menu->row == menu->numRows - 1) {
            if (menu->col > 10) {
                menu->col = 0;
            } else if (menu->col == 8 || menu->col == 9) {
                menu->col = 10;
            } else if (menu->col == 5 || menu->col == 6) {
                menu->col = 7;
            }
        }
    }

    if (filemenu_heldButtons & BUTTON_STICK_UP) {
        menu->row--;
        if (menu->row < 0) {
            menu->row = menu->numRows - 1;
        }
    } else if (filemenu_heldButtons & BUTTON_STICK_DOWN) {
        menu->row++;
        if (menu->row >= menu->numRows) {
            menu->row = 0;
        }
    }

    if (menu->row == menu->numRows - 1) {
        if (menu->col > 10) {
            menu->col = 10;
        } else if (menu->col == 8 || menu->col == 9) {
            menu->col = 7;
        } else if (menu->col == 5 || menu->col == 6) {
            menu->col = 4;
        }
    }

    menu->selected = MENU_PANEL_SELECTED_GRID_DATA(menu);
    if (oldSelected != menu->selected) {
        sfx_play_sound(SOUND_2102);
    }

    if (filemenu_pressedButtons & BUTTON_A) {
        switch (menu->selected) {
            case 0xC6:
                sfx_play_sound(SOUND_2103);
                if (filemenu_filename_pos == ARRAY_COUNT(filemenu_filename)) {
                    filemenu_filename_pos = ARRAY_COUNT(filemenu_filename) - 1;
                }
                filemenu_filename[filemenu_filename_pos] = 0xF7;
                filemenu_filename_pos++;
                if (filemenu_filename_pos > ARRAY_COUNT(filemenu_filename)) {
                    filemenu_filename_pos = ARRAY_COUNT(filemenu_filename);
                }
                break;
            case 0xC9:
                break;
            case 0xC7:
                if (menu->page != 1) {
                    sfx_play_sound(SOUND_2105);
                    menu->page = 1;
                    filemenu_set_selected(menu, menu->col, menu->row);
                    set_window_update(WINDOW_ID_FILEMENU_KEYBOARD, (s32)filemenu_update_change_layout);
                }
                break;
            case 0xC8:
                if (menu->page != 0) {
                    sfx_play_sound(SOUND_2105);
                    menu->page = 0;
                    filemenu_set_selected(menu, menu->col, menu->row);
                    set_window_update(WINDOW_ID_FILEMENU_KEYBOARD, (s32)filemenu_update_change_layout);
                }
                break;
            case 0xCA:
                for (i = 0; i < ARRAY_COUNT(filemenu_filename); i++) {
                    if (filemenu_filename[i] != 0xF7) {
                        break;
                    }
                }
                if (i == ARRAY_COUNT(filemenu_filename)) {
                    sfx_play_sound(SOUND_MENU_ERROR);
                    break;
                }

                sfx_play_sound(SOUND_MENU_NEXT);
                set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, (s32) filemenu_update_show_name_confirm);
                gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].pos.y = 121;
                gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].width = 69;
                gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].height = 44;
                gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].pos.x = ((gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].parent != -1)
                                               ? (gWindows[gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].parent].width / 2)
                                               : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].width / 2;

                gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].pos.y = -70;
                gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width = 164;
                gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].height = 62;
                gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].pos.x = ((gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent != -1)
                                               ? (gWindows[gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent].width / 2)
                                               : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width / 2;

                filemenu_currentMenu = 1;
                newMenu = filemenu_menus[filemenu_currentMenu];
                newMenu->page = 2;
                filemenu_set_selected(newMenu, 0, 0);
                return;
            default:
                sfx_play_sound(SOUND_2103);
                if (filemenu_filename_pos == ARRAY_COUNT(filemenu_filename)) {
                    filemenu_filename[7] = menu->selected;
                } else {
                    filemenu_filename[filemenu_filename_pos] = menu->selected;
                    filemenu_filename_pos++;
                    if (filemenu_filename_pos > ARRAY_COUNT(filemenu_filename)) {
                        filemenu_filename_pos = ARRAY_COUNT(filemenu_filename);
                    }
                }
                break;
        }

        if (menu->selected != 0xC7 && menu->selected != 0xC8 && menu->selected != 0xC9 &&
            filemenu_filename_pos == ARRAY_COUNT(filemenu_filename)) {
            filemenu_set_selected(menu, menu->numCols - 3, menu->numRows - 1);
        }
    }

    if ((filemenu_pressedButtons & BUTTON_B) || ((filemenu_pressedButtons & BUTTON_A) && menu->selected == 0xC9)) {
        sfx_play_sound(SOUND_2104);
        filemenu_filename_pos--;
        if (filemenu_filename_pos < 0) {
            filemenu_filename_pos = 0;
            set_window_update(WINDOW_ID_FILEMENU_CREATEFILE_HEADER, (s32) &filemenu_update_hidden_name_input);
            set_window_update(WINDOW_ID_FILEMENU_KEYBOARD, (s32) &filemenu_update_hidden_name_input);
            set_window_update(WINDOW_ID_FILEMENU_TITLE, (s32) &filemenu_update_show_with_rotation);
            set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32) &filemenu_update_show_with_rotation);
            set_window_update(WINDOW_ID_FILEMENU_MONO, (s32) &filemenu_update_show_with_rotation);
            set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32) &filemenu_update_show_with_rotation);
            set_window_update(WINDOW_ID_FILEMENU_OPTION_CENTER, (s32) &filemenu_update_show_with_rotation);
            set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32) &filemenu_update_show_with_rotation);
            set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32) &filemenu_update_show_with_rotation);
            set_window_update(WINDOW_ID_FILEMENU_FILE0_INFO, (s32) &filemenu_update_show_with_rotation);
            set_window_update(WINDOW_ID_FILEMENU_FILE1_INFO, (s32) &filemenu_update_show_with_rotation);
            set_window_update(WINDOW_ID_FILEMENU_FILE2_INFO, (s32) &filemenu_update_show_with_rotation);
            set_window_update(WINDOW_ID_FILEMENU_FILE3_INFO, (s32) &filemenu_update_show_with_rotation);
            filemenu_currentMenu = 0;
            return;
        }

        for (i = filemenu_filename_pos; i < ARRAY_COUNT(filemenu_filename); i++) {
            filemenu_filename[i] = 0xF7;
        }
    }

    if (filemenu_pressedButtons & BUTTON_START) {
        for (i = 0; i < ARRAY_COUNT(filemenu_filename); i++) {
            if (filemenu_filename[i] != 0xF7) {
                break;
            }
        }
        if (i == ARRAY_COUNT(filemenu_filename)) {
            sfx_play_sound(SOUND_MENU_ERROR);
            return;

        }

        sfx_play_sound(SOUND_MENU_NEXT);
        set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, (s32) filemenu_update_show_name_confirm);

        gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].pos.y = 121;
        gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].width = 69;
        gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].height = 44;
        gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].pos.x = ((gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].parent != -1)
                            ? (gWindows[gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].parent].width / 2)
                            : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].width / 2;

        gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].pos.y = -70;
        gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width = 164;
        gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].height = 62;
        gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].pos.x = ((gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent != -1)
                            ? (gWindows[gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent].width / 2)
                            : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width / 2;

        newMenu2 = filemenu_menus[1];
        filemenu_currentMenu = 1;
        newMenu2->page = 2;
        filemenu_set_selected(newMenu2, 0, 0);
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel make_item_entity
/* C7AF4 801313F4 27BDFFC8 */  addiu     $sp, $sp, -0x38
/* C7AF8 801313F8 AFB20028 */  sw        $s2, 0x28($sp)
/* C7AFC 801313FC 0080902D */  daddu     $s2, $a0, $zero
/* C7B00 80131400 AFB10024 */  sw        $s1, 0x24($sp)
/* C7B04 80131404 8FB10054 */  lw        $s1, 0x54($sp)
/* C7B08 80131408 3C02F8D8 */  lui       $v0, (0xF8D8F200 >> 16)
/* C7B0C 8013140C AFB3002C */  sw        $s3, 0x2C($sp)
/* C7B10 80131410 8FB30048 */  lw        $s3, 0x48($sp)
/* C7B14 80131414 3442F200 */  ori       $v0, $v0, (0xF8D8F200 & 0xFFFF)
/* C7B18 80131418 AFBF0034 */  sw        $ra, 0x34($sp)
/* C7B1C 8013141C AFB40030 */  sw        $s4, 0x30($sp)
/* C7B20 80131420 AFB00020 */  sw        $s0, 0x20($sp)
/* C7B24 80131424 AFA5003C */  sw        $a1, 0x3C($sp)
/* C7B28 80131428 AFA60040 */  sw        $a2, 0x40($sp)
/* C7B2C 8013142C 0051102A */  slt       $v0, $v0, $s1
/* C7B30 80131430 14400004 */  bnez      $v0, .L80131444
/* C7B34 80131434 AFA70044 */   sw       $a3, 0x44($sp)
/* C7B38 80131438 3C0207BF */  lui       $v0, (0x7BFA480 >> 16)
/* C7B3C 8013143C 3442A480 */  ori       $v0, $v0, (0x7BFA480 & 0xFFFF)
/* C7B40 80131440 02228821 */  addu      $s1, $s1, $v0
.L80131444:
/* C7B44 80131444 1A20000C */  blez      $s1, .L80131478
/* C7B48 80131448 2E620017 */   sltiu    $v0, $s3, 0x17
/* C7B4C 8013144C 1040000A */  beqz      $v0, .L80131478
/* C7B50 80131450 00131080 */   sll      $v0, $s3, 2
/* C7B54 80131454 3C018015 */  lui       $at, %hi(jtbl_80150A98)
/* C7B58 80131458 00220821 */  addu      $at, $at, $v0
/* C7B5C 8013145C 8C220A98 */  lw        $v0, %lo(jtbl_80150A98)($at)
/* C7B60 80131460 00400008 */  jr        $v0
/* C7B64 80131464 00000000 */   nop
glabel .L80131468
/* C7B68 80131468 0C05152F */  jal       get_global_flag
/* C7B6C 8013146C 0220202D */   daddu    $a0, $s1, $zero
/* C7B70 80131470 14400180 */  bnez      $v0, .L80131A74
/* C7B74 80131474 2402FFFF */   addiu    $v0, $zero, -0x1
glabel .L80131478
/* C7B78 80131478 0000182D */  daddu     $v1, $zero, $zero
/* C7B7C 8013147C 3C048015 */  lui       $a0, %hi(gCurrentItemEntities)
/* C7B80 80131480 8C8465A0 */  lw        $a0, %lo(gCurrentItemEntities)($a0)
.L80131484:
/* C7B84 80131484 8C820000 */  lw        $v0, 0x0($a0)
/* C7B88 80131488 10400006 */  beqz      $v0, .L801314A4
/* C7B8C 8013148C 28620100 */   slti     $v0, $v1, 0x100
/* C7B90 80131490 24630001 */  addiu     $v1, $v1, 0x1
/* C7B94 80131494 28620100 */  slti      $v0, $v1, 0x100
/* C7B98 80131498 1440FFFA */  bnez      $v0, .L80131484
/* C7B9C 8013149C 24840004 */   addiu    $a0, $a0, 0x4
/* C7BA0 801314A0 28620100 */  slti      $v0, $v1, 0x100
.L801314A4:
/* C7BA4 801314A4 54400003 */  bnel      $v0, $zero, .L801314B4
/* C7BA8 801314A8 2404005C */   addiu    $a0, $zero, 0x5C
.L801314AC:
/* C7BAC 801314AC 0804C52B */  j         .L801314AC
/* C7BB0 801314B0 00000000 */   nop
.L801314B4:
/* C7BB4 801314B4 0C00AB39 */  jal       heap_malloc
/* C7BB8 801314B8 0060A02D */   daddu    $s4, $v1, $zero
/* C7BBC 801314BC 00142080 */  sll       $a0, $s4, 2
/* C7BC0 801314C0 3C038015 */  lui       $v1, %hi(gCurrentItemEntities)
/* C7BC4 801314C4 8C6365A0 */  lw        $v1, %lo(gCurrentItemEntities)($v1)
/* C7BC8 801314C8 3C058015 */  lui       $a1, %hi(ItemEntitiesCreated)
/* C7BCC 801314CC 24A512F8 */  addiu     $a1, $a1, %lo(ItemEntitiesCreated)
/* C7BD0 801314D0 00832021 */  addu      $a0, $a0, $v1
/* C7BD4 801314D4 8CA30000 */  lw        $v1, 0x0($a1)
/* C7BD8 801314D8 0040802D */  daddu     $s0, $v0, $zero
/* C7BDC 801314DC AC900000 */  sw        $s0, 0x0($a0)
/* C7BE0 801314E0 24630001 */  addiu     $v1, $v1, 0x1
/* C7BE4 801314E4 16000003 */  bnez      $s0, .L801314F4
/* C7BE8 801314E8 ACA30000 */   sw       $v1, 0x0($a1)
.L801314EC:
/* C7BEC 801314EC 0804C53B */  j         .L801314EC
/* C7BF0 801314F0 00000000 */   nop
.L801314F4:
/* C7BF4 801314F4 00121402 */  srl       $v0, $s2, 16
/* C7BF8 801314F8 3042000F */  andi      $v0, $v0, 0xF
/* C7BFC 801314FC 24030005 */  addiu     $v1, $zero, 0x5
/* C7C00 80131500 14430003 */  bne       $v0, $v1, .L80131510
/* C7C04 80131504 A202001D */   sb       $v0, 0x1D($s0)
/* C7C08 80131508 2402FFFF */  addiu     $v0, $zero, -0x1
/* C7C0C 8013150C A202001D */  sb        $v0, 0x1D($s0)
.L80131510:
/* C7C10 80131510 3252FFFF */  andi      $s2, $s2, 0xFFFF
/* C7C14 80131514 A213001B */  sb        $s3, 0x1B($s0)
/* C7C18 80131518 A200001A */  sb        $zero, 0x1A($s0)
/* C7C1C 8013151C C7A2003C */  lwc1      $f2, 0x3C($sp)
/* C7C20 80131520 C7A40040 */  lwc1      $f4, 0x40($sp)
/* C7C24 80131524 C7A60044 */  lwc1      $f6, 0x44($sp)
/* C7C28 80131528 24020097 */  addiu     $v0, $zero, 0x97
/* C7C2C 8013152C AE020000 */  sw        $v0, 0x0($s0)
/* C7C30 80131530 A6000006 */  sh        $zero, 0x6($s0)
/* C7C34 80131534 A6110004 */  sh        $s1, 0x4($s0)
/* C7C38 80131538 A6120018 */  sh        $s2, 0x18($s0)
/* C7C3C 8013153C AE000014 */  sw        $zero, 0x14($s0)
/* C7C40 80131540 8FA2004C */  lw        $v0, 0x4C($sp)
/* C7C44 80131544 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* C7C48 80131548 44810000 */  mtc1      $at, $f0
/* C7C4C 8013154C 8E030000 */  lw        $v1, 0x0($s0)
/* C7C50 80131550 A202001C */  sb        $v0, 0x1C($s0)
/* C7C54 80131554 8FA20050 */  lw        $v0, 0x50($sp)
/* C7C58 80131558 34644000 */  ori       $a0, $v1, 0x4000
/* C7C5C 8013155C E6020008 */  swc1      $f2, 0x8($s0)
/* C7C60 80131560 E604000C */  swc1      $f4, 0xC($s0)
/* C7C64 80131564 E6060010 */  swc1      $f6, 0x10($s0)
/* C7C68 80131568 E6000030 */  swc1      $f0, 0x30($s0)
/* C7C6C 8013156C AE040000 */  sw        $a0, 0x0($s0)
/* C7C70 80131570 A602001E */  sh        $v0, 0x1E($s0)
/* C7C74 80131574 2402FFFF */  addiu     $v0, $zero, -0x1
/* C7C78 80131578 A6020020 */  sh        $v0, 0x20($s0)
/* C7C7C 8013157C 24020001 */  addiu     $v0, $zero, 0x1
/* C7C80 80131580 A202002E */  sb        $v0, 0x2E($s0)
/* C7C84 80131584 2402D8F1 */  addiu     $v0, $zero, -0x270F
/* C7C88 80131588 A6020034 */  sh        $v0, 0x34($s0)
/* C7C8C 8013158C A6020036 */  sh        $v0, 0x36($s0)
/* C7C90 80131590 A6020038 */  sh        $v0, 0x38($s0)
/* C7C94 80131594 00121140 */  sll       $v0, $s2, 5
/* C7C98 80131598 3C018008 */  lui       $at, %hi(gItemTable + 0x18)
/* C7C9C 8013159C 00220821 */  addu      $at, $at, $v0
/* C7CA0 801315A0 942278F8 */  lhu       $v0, %lo(gItemTable + 0x18)($at)
/* C7CA4 801315A4 2403001E */  addiu     $v1, $zero, 0x1E
/* C7CA8 801315A8 3C018015 */  lui       $at, %hi(D_801565A6)
/* C7CAC 801315AC A42365A6 */  sh        $v1, %lo(D_801565A6)($at)
/* C7CB0 801315B0 30421000 */  andi      $v0, $v0, 0x1000
/* C7CB4 801315B4 10400005 */  beqz      $v0, .L801315CC
/* C7CB8 801315B8 3C020004 */   lui      $v0, (0x40000 >> 16)
/* C7CBC 801315BC 00821025 */  or        $v0, $a0, $v0
/* C7CC0 801315C0 2403BFFF */  addiu     $v1, $zero, -0x4001
/* C7CC4 801315C4 00431024 */  and       $v0, $v0, $v1
/* C7CC8 801315C8 AE020000 */  sw        $v0, 0x0($s0)
.L801315CC:
/* C7CCC 801315CC 3C048015 */  lui       $a0, %hi(ItemEntityAlternatingSpawn)
/* C7CD0 801315D0 24845D84 */  addiu     $a0, $a0, %lo(ItemEntityAlternatingSpawn)
/* C7CD4 801315D4 8C820000 */  lw        $v0, 0x0($a0)
/* C7CD8 801315D8 10400005 */  beqz      $v0, .L801315F0
/* C7CDC 801315DC 3C030002 */   lui      $v1, (0x20000 >> 16)
/* C7CE0 801315E0 8E020000 */  lw        $v0, 0x0($s0)
/* C7CE4 801315E4 00431025 */  or        $v0, $v0, $v1
/* C7CE8 801315E8 AE020000 */  sw        $v0, 0x0($s0)
/* C7CEC 801315EC 8C820000 */  lw        $v0, 0x0($a0)
.L801315F0:
/* C7CF0 801315F0 24030001 */  addiu     $v1, $zero, 0x1
/* C7CF4 801315F4 00621823 */  subu      $v1, $v1, $v0
/* C7CF8 801315F8 AC830000 */  sw        $v1, 0x0($a0)
/* C7CFC 801315FC 8203001B */  lb        $v1, 0x1B($s0)
/* C7D00 80131600 2C62001C */  sltiu     $v0, $v1, 0x1C
/* C7D04 80131604 104000C1 */  beqz      $v0, .L8013190C
/* C7D08 80131608 00031080 */   sll      $v0, $v1, 2
/* C7D0C 8013160C 3C018015 */  lui       $at, %hi(jtbl_80150AF8)
/* C7D10 80131610 00220821 */  addu      $at, $at, $v0
/* C7D14 80131614 8C220AF8 */  lw        $v0, %lo(jtbl_80150AF8)($at)
/* C7D18 80131618 00400008 */  jr        $v0
/* C7D1C 8013161C 00000000 */   nop
glabel .L80131620
/* C7D20 80131620 8E020000 */  lw        $v0, 0x0($s0)
/* C7D24 80131624 0804C640 */  j         .L80131900
/* C7D28 80131628 3C038000 */   lui      $v1, (0x80000000 >> 16)
glabel .L8013162C
/* C7D2C 8013162C 8E020000 */  lw        $v0, 0x0($s0)
/* C7D30 80131630 0804C640 */  j         .L80131900
/* C7D34 80131634 3C030080 */   lui      $v1, (0x800000 >> 16)
glabel .L80131638
/* C7D38 80131638 8E020000 */  lw        $v0, 0x0($s0)
/* C7D3C 8013163C 0804C640 */  j         .L80131900
/* C7D40 80131640 3C030010 */   lui      $v1, (0x100000 >> 16)
glabel .L80131644
/* C7D44 80131644 24020003 */  addiu     $v0, $zero, 0x3
/* C7D48 80131648 A202001B */  sb        $v0, 0x1B($s0)
/* C7D4C 8013164C 8E020000 */  lw        $v0, 0x0($s0)
/* C7D50 80131650 3C030080 */  lui       $v1, (0x800000 >> 16)
/* C7D54 80131654 00431025 */  or        $v0, $v0, $v1
/* C7D58 80131658 0804C640 */  j         .L80131900
/* C7D5C 8013165C 3C030001 */   lui      $v1, (0x10000 >> 16)
glabel .L80131660
/* C7D60 80131660 3C020080 */  lui       $v0, (0x800600 >> 16)
/* C7D64 80131664 34420600 */  ori       $v0, $v0, (0x800600 & 0xFFFF)
/* C7D68 80131668 8E030000 */  lw        $v1, 0x0($s0)
/* C7D6C 8013166C 0804C635 */  j         .L801318D4
/* C7D70 80131670 24040003 */   addiu    $a0, $zero, 0x3
glabel .L80131674
/* C7D74 80131674 3C020080 */  lui       $v0, (0x800400 >> 16)
/* C7D78 80131678 34420400 */  ori       $v0, $v0, (0x800400 & 0xFFFF)
/* C7D7C 8013167C 8E030000 */  lw        $v1, 0x0($s0)
/* C7D80 80131680 0804C635 */  j         .L801318D4
/* C7D84 80131684 24040003 */   addiu    $a0, $zero, 0x3
glabel .L80131688
/* C7D88 80131688 3C020080 */  lui       $v0, (0x800800 >> 16)
/* C7D8C 8013168C 34420800 */  ori       $v0, $v0, (0x800800 & 0xFFFF)
/* C7D90 80131690 8E030000 */  lw        $v1, 0x0($s0)
/* C7D94 80131694 0804C635 */  j         .L801318D4
/* C7D98 80131698 24040003 */   addiu    $a0, $zero, 0x3
glabel .L8013169C
/* C7D9C 8013169C 3C020080 */  lui       $v0, (0x800A00 >> 16)
/* C7DA0 801316A0 34420A00 */  ori       $v0, $v0, (0x800A00 & 0xFFFF)
/* C7DA4 801316A4 8E030000 */  lw        $v1, 0x0($s0)
/* C7DA8 801316A8 0804C635 */  j         .L801318D4
/* C7DAC 801316AC 24040003 */   addiu    $a0, $zero, 0x3
glabel .L801316B0
/* C7DB0 801316B0 3C020080 */  lui       $v0, (0x800200 >> 16)
/* C7DB4 801316B4 34420200 */  ori       $v0, $v0, (0x800200 & 0xFFFF)
/* C7DB8 801316B8 8E030000 */  lw        $v1, 0x0($s0)
/* C7DBC 801316BC 0804C635 */  j         .L801318D4
/* C7DC0 801316C0 24040003 */   addiu    $a0, $zero, 0x3
glabel .L801316C4
/* C7DC4 801316C4 3C040080 */  lui       $a0, (0x800400 >> 16)
/* C7DC8 801316C8 34840400 */  ori       $a0, $a0, (0x800400 & 0xFFFF)
/* C7DCC 801316CC 8E020000 */  lw        $v0, 0x0($s0)
/* C7DD0 801316D0 24030003 */  addiu     $v1, $zero, 0x3
/* C7DD4 801316D4 A203001B */  sb        $v1, 0x1B($s0)
/* C7DD8 801316D8 0804C63F */  j         .L801318FC
/* C7DDC 801316DC 3C034000 */   lui      $v1, (0x40000000 >> 16)
glabel .L801316E0
/* C7DE0 801316E0 3C050080 */  lui       $a1, (0x800400 >> 16)
/* C7DE4 801316E4 34A50400 */  ori       $a1, $a1, (0x800400 & 0xFFFF)
/* C7DE8 801316E8 3C044000 */  lui       $a0, (0x40000200 >> 16)
/* C7DEC 801316EC 34840200 */  ori       $a0, $a0, (0x40000200 & 0xFFFF)
/* C7DF0 801316F0 8E020000 */  lw        $v0, 0x0($s0)
/* C7DF4 801316F4 24030003 */  addiu     $v1, $zero, 0x3
/* C7DF8 801316F8 A203001B */  sb        $v1, 0x1B($s0)
/* C7DFC 801316FC 00451025 */  or        $v0, $v0, $a1
/* C7E00 80131700 0804C641 */  j         .L80131904
/* C7E04 80131704 00441025 */   or       $v0, $v0, $a0
glabel .L80131708
/* C7E08 80131708 8E020000 */  lw        $v0, 0x0($s0)
/* C7E0C 8013170C 0804C640 */  j         .L80131900
/* C7E10 80131710 3C030080 */   lui      $v1, (0x800000 >> 16)
glabel .L80131714
/* C7E14 80131714 3C020080 */  lui       $v0, (0x800600 >> 16)
/* C7E18 80131718 34420600 */  ori       $v0, $v0, (0x800600 & 0xFFFF)
/* C7E1C 8013171C 8E030000 */  lw        $v1, 0x0($s0)
/* C7E20 80131720 0804C635 */  j         .L801318D4
/* C7E24 80131724 2404000C */   addiu    $a0, $zero, 0xC
glabel .L80131728
/* C7E28 80131728 3C020080 */  lui       $v0, (0x800400 >> 16)
/* C7E2C 8013172C 34420400 */  ori       $v0, $v0, (0x800400 & 0xFFFF)
/* C7E30 80131730 8E030000 */  lw        $v1, 0x0($s0)
/* C7E34 80131734 0804C635 */  j         .L801318D4
/* C7E38 80131738 2404000C */   addiu    $a0, $zero, 0xC
glabel .L8013173C
/* C7E3C 8013173C 3C020080 */  lui       $v0, (0x800800 >> 16)
/* C7E40 80131740 34420800 */  ori       $v0, $v0, (0x800800 & 0xFFFF)
/* C7E44 80131744 8E030000 */  lw        $v1, 0x0($s0)
/* C7E48 80131748 0804C635 */  j         .L801318D4
/* C7E4C 8013174C 2404000C */   addiu    $a0, $zero, 0xC
glabel .L80131750
/* C7E50 80131750 3C020080 */  lui       $v0, (0x802000 >> 16)
/* C7E54 80131754 8E030000 */  lw        $v1, 0x0($s0)
/* C7E58 80131758 34422000 */  ori       $v0, $v0, (0x802000 & 0xFFFF)
/* C7E5C 8013175C 00621825 */  or        $v1, $v1, $v0
/* C7E60 80131760 0804C636 */  j         .L801318D8
/* C7E64 80131764 3C021000 */   lui      $v0, (0x10000000 >> 16)
glabel .L80131768
/* C7E68 80131768 3C040080 */  lui       $a0, (0x802600 >> 16)
/* C7E6C 8013176C 34842600 */  ori       $a0, $a0, (0x802600 & 0xFFFF)
/* C7E70 80131770 8E020000 */  lw        $v0, 0x0($s0)
/* C7E74 80131774 24030010 */  addiu     $v1, $zero, 0x10
/* C7E78 80131778 A203001B */  sb        $v1, 0x1B($s0)
/* C7E7C 8013177C 0804C63F */  j         .L801318FC
/* C7E80 80131780 3C031000 */   lui      $v1, (0x10000000 >> 16)
glabel .L80131784
/* C7E84 80131784 3C040080 */  lui       $a0, (0x802400 >> 16)
/* C7E88 80131788 34842400 */  ori       $a0, $a0, (0x802400 & 0xFFFF)
/* C7E8C 8013178C 8E020000 */  lw        $v0, 0x0($s0)
/* C7E90 80131790 24030010 */  addiu     $v1, $zero, 0x10
/* C7E94 80131794 A203001B */  sb        $v1, 0x1B($s0)
/* C7E98 80131798 0804C63F */  j         .L801318FC
/* C7E9C 8013179C 3C031000 */   lui      $v1, (0x10000000 >> 16)
glabel .L801317A0
/* C7EA0 801317A0 3C040080 */  lui       $a0, (0x802200 >> 16)
/* C7EA4 801317A4 34842200 */  ori       $a0, $a0, (0x802200 & 0xFFFF)
/* C7EA8 801317A8 8E020000 */  lw        $v0, 0x0($s0)
/* C7EAC 801317AC 24030010 */  addiu     $v1, $zero, 0x10
/* C7EB0 801317B0 A203001B */  sb        $v1, 0x1B($s0)
/* C7EB4 801317B4 0804C63F */  j         .L801318FC
/* C7EB8 801317B8 3C031000 */   lui      $v1, (0x10000000 >> 16)
glabel .L801317BC
/* C7EBC 801317BC 3C030080 */  lui       $v1, (0x801000 >> 16)
/* C7EC0 801317C0 34631000 */  ori       $v1, $v1, (0x801000 & 0xFFFF)
/* C7EC4 801317C4 8E020000 */  lw        $v0, 0x0($s0)
/* C7EC8 801317C8 3C013F4C */  lui       $at, (0x3F4CCCCD >> 16)
/* C7ECC 801317CC 3421CCCD */  ori       $at, $at, (0x3F4CCCCD & 0xFFFF)
/* C7ED0 801317D0 44810000 */  mtc1      $at, $f0
/* C7ED4 801317D4 00431025 */  or        $v0, $v0, $v1
/* C7ED8 801317D8 AE020000 */  sw        $v0, 0x0($s0)
/* C7EDC 801317DC 34424000 */  ori       $v0, $v0, 0x4000
/* C7EE0 801317E0 0804C641 */  j         .L80131904
/* C7EE4 801317E4 E6000030 */   swc1     $f0, 0x30($s0)
glabel .L801317E8
/* C7EE8 801317E8 3C030080 */  lui       $v1, (0x801000 >> 16)
/* C7EEC 801317EC 34631000 */  ori       $v1, $v1, (0x801000 & 0xFFFF)
/* C7EF0 801317F0 8E020000 */  lw        $v0, 0x0($s0)
/* C7EF4 801317F4 3C013F4C */  lui       $at, (0x3F4CCCCD >> 16)
/* C7EF8 801317F8 3421CCCD */  ori       $at, $at, (0x3F4CCCCD & 0xFFFF)
/* C7EFC 801317FC 44810000 */  mtc1      $at, $f0
/* C7F00 80131800 00431025 */  or        $v0, $v0, $v1
/* C7F04 80131804 3C030001 */  lui       $v1, (0x14000 >> 16)
/* C7F08 80131808 00431025 */  or        $v0, $v0, $v1
/* C7F0C 8013180C AE020000 */  sw        $v0, 0x0($s0)
/* C7F10 80131810 0040182D */  daddu     $v1, $v0, $zero
/* C7F14 80131814 0804C628 */  j         .L801318A0
/* C7F18 80131818 24020017 */   addiu    $v0, $zero, 0x17
glabel .L8013181C
/* C7F1C 8013181C 3C030080 */  lui       $v1, (0x801000 >> 16)
/* C7F20 80131820 34631000 */  ori       $v1, $v1, (0x801000 & 0xFFFF)
/* C7F24 80131824 8E020000 */  lw        $v0, 0x0($s0)
/* C7F28 80131828 3C013F4C */  lui       $at, (0x3F4CCCCD >> 16)
/* C7F2C 8013182C 3421CCCD */  ori       $at, $at, (0x3F4CCCCD & 0xFFFF)
/* C7F30 80131830 44810000 */  mtc1      $at, $f0
/* C7F34 80131834 00431025 */  or        $v0, $v0, $v1
/* C7F38 80131838 3C030040 */  lui       $v1, (0x404000 >> 16)
/* C7F3C 8013183C 00431025 */  or        $v0, $v0, $v1
/* C7F40 80131840 AE020000 */  sw        $v0, 0x0($s0)
/* C7F44 80131844 0040182D */  daddu     $v1, $v0, $zero
/* C7F48 80131848 0804C628 */  j         .L801318A0
/* C7F4C 8013184C 24020017 */   addiu    $v0, $zero, 0x17
glabel .L80131850
/* C7F50 80131850 3C030080 */  lui       $v1, (0x804000 >> 16)
/* C7F54 80131854 8E020000 */  lw        $v0, 0x0($s0)
/* C7F58 80131858 3C013F4C */  lui       $at, (0x3F4CCCCD >> 16)
/* C7F5C 8013185C 3421CCCD */  ori       $at, $at, (0x3F4CCCCD & 0xFFFF)
/* C7F60 80131860 44810000 */  mtc1      $at, $f0
/* C7F64 80131864 00431025 */  or        $v0, $v0, $v1
/* C7F68 80131868 AE020000 */  sw        $v0, 0x0($s0)
/* C7F6C 8013186C 0040182D */  daddu     $v1, $v0, $zero
/* C7F70 80131870 0804C628 */  j         .L801318A0
/* C7F74 80131874 24020003 */   addiu    $v0, $zero, 0x3
glabel .L80131878
/* C7F78 80131878 3C030080 */  lui       $v1, (0x808000 >> 16)
/* C7F7C 8013187C 34638000 */  ori       $v1, $v1, (0x808000 & 0xFFFF)
/* C7F80 80131880 8E020000 */  lw        $v0, 0x0($s0)
/* C7F84 80131884 3C013F4C */  lui       $at, (0x3F4CCCCD >> 16)
/* C7F88 80131888 3421CCCD */  ori       $at, $at, (0x3F4CCCCD & 0xFFFF)
/* C7F8C 8013188C 44810000 */  mtc1      $at, $f0
/* C7F90 80131890 00431025 */  or        $v0, $v0, $v1
/* C7F94 80131894 AE020000 */  sw        $v0, 0x0($s0)
/* C7F98 80131898 0040182D */  daddu     $v1, $v0, $zero
/* C7F9C 8013189C 24020014 */  addiu     $v0, $zero, 0x14
.L801318A0:
/* C7FA0 801318A0 34634000 */  ori       $v1, $v1, (0x804000 & 0xFFFF)
/* C7FA4 801318A4 A202001B */  sb        $v0, 0x1B($s0)
/* C7FA8 801318A8 E6000030 */  swc1      $f0, 0x30($s0)
/* C7FAC 801318AC 0804C642 */  j         .L80131908
/* C7FB0 801318B0 AE030000 */   sw       $v1, 0x0($s0)
glabel .L801318B4
/* C7FB4 801318B4 3C030080 */  lui       $v1, (0x808200 >> 16)
/* C7FB8 801318B8 8E020000 */  lw        $v0, 0x0($s0)
/* C7FBC 801318BC 0804C640 */  j         .L80131900
/* C7FC0 801318C0 34638200 */   ori      $v1, $v1, (0x808200 & 0xFFFF)
glabel .L801318C4
/* C7FC4 801318C4 3C020080 */  lui       $v0, (0x808600 >> 16)
/* C7FC8 801318C8 34428600 */  ori       $v0, $v0, (0x808600 & 0xFFFF)
/* C7FCC 801318CC 8E030000 */  lw        $v1, 0x0($s0)
/* C7FD0 801318D0 24040014 */  addiu     $a0, $zero, 0x14
.L801318D4:
/* C7FD4 801318D4 A204001B */  sb        $a0, 0x1B($s0)
.L801318D8:
/* C7FD8 801318D8 00621825 */  or        $v1, $v1, $v0
/* C7FDC 801318DC 0804C642 */  j         .L80131908
/* C7FE0 801318E0 AE030000 */   sw       $v1, 0x0($s0)
glabel .L801318E4
/* C7FE4 801318E4 3C040080 */  lui       $a0, (0x800600 >> 16)
/* C7FE8 801318E8 34840600 */  ori       $a0, $a0, (0x800600 & 0xFFFF)
/* C7FEC 801318EC 8E020000 */  lw        $v0, 0x0($s0)
/* C7FF0 801318F0 24030003 */  addiu     $v1, $zero, 0x3
/* C7FF4 801318F4 A203001B */  sb        $v1, 0x1B($s0)
/* C7FF8 801318F8 3C030100 */  lui       $v1, (0x1000000 >> 16)
.L801318FC:
/* C7FFC 801318FC 00441025 */  or        $v0, $v0, $a0
.L80131900:
/* C8000 80131900 00431025 */  or        $v0, $v0, $v1
.L80131904:
/* C8004 80131904 AE020000 */  sw        $v0, 0x0($s0)
.L80131908:
/* C8008 80131908 8203001B */  lb        $v1, 0x1B($s0)
.L8013190C:
/* C800C 8013190C 2C620015 */  sltiu     $v0, $v1, 0x15
/* C8010 80131910 1040003E */  beqz      $v0, .L80131A0C
/* C8014 80131914 00031080 */   sll      $v0, $v1, 2
/* C8018 80131918 3C018015 */  lui       $at, %hi(jtbl_80150B68)
/* C801C 8013191C 00220821 */  addu      $at, $at, $v0
/* C8020 80131920 8C220B68 */  lw        $v0, %lo(jtbl_80150B68)($at)
/* C8024 80131924 00400008 */  jr        $v0
/* C8028 80131928 00000000 */   nop
glabel .L8013192C
/* C802C 8013192C 8E050008 */  lw        $a1, 0x8($s0)
/* C8030 80131930 8E06000C */  lw        $a2, 0xC($s0)
/* C8034 80131934 8E070010 */  lw        $a3, 0x10($s0)
/* C8038 80131938 0C044898 */  jal       create_shadow_type
/* C803C 8013193C 0000202D */   daddu    $a0, $zero, $zero
/* C8040 80131940 00022400 */  sll       $a0, $v0, 16
/* C8044 80131944 00042403 */  sra       $a0, $a0, 16
/* C8048 80131948 0C044181 */  jal       get_shadow_by_index
/* C804C 8013194C A6020020 */   sh       $v0, 0x20($s0)
/* C8050 80131950 0040882D */  daddu     $s1, $v0, $zero
/* C8054 80131954 8203001B */  lb        $v1, 0x1B($s0)
/* C8058 80131958 24020014 */  addiu     $v0, $zero, 0x14
/* C805C 8013195C 14620004 */  bne       $v1, $v0, .L80131970
/* C8060 80131960 3C040002 */   lui      $a0, (0x20000 >> 16)
/* C8064 80131964 8E220000 */  lw        $v0, 0x0($s1)
/* C8068 80131968 34420001 */  ori       $v0, $v0, 0x1
/* C806C 8013196C AE220000 */  sw        $v0, 0x0($s1)
.L80131970:
/* C8070 80131970 27A5003C */  addiu     $a1, $sp, 0x3C
/* C8074 80131974 27A60040 */  addiu     $a2, $sp, 0x40
/* C8078 80131978 27A70044 */  addiu     $a3, $sp, 0x44
/* C807C 8013197C 27A20018 */  addiu     $v0, $sp, 0x18
/* C8080 80131980 C6080008 */  lwc1      $f8, 0x8($s0)
/* C8084 80131984 C600000C */  lwc1      $f0, 0xC($s0)
/* C8088 80131988 3C014140 */  lui       $at, (0x41400000 >> 16)
/* C808C 8013198C 44811000 */  mtc1      $at, $f2
/* C8090 80131990 C6040010 */  lwc1      $f4, 0x10($s0)
/* C8094 80131994 3C01447A */  lui       $at, (0x447A0000 >> 16)
/* C8098 80131998 44813000 */  mtc1      $at, $f6
/* C809C 8013199C 46020000 */  add.s     $f0, $f0, $f2
/* C80A0 801319A0 E7A8003C */  swc1      $f8, 0x3C($sp)
/* C80A4 801319A4 E7A40044 */  swc1      $f4, 0x44($sp)
/* C80A8 801319A8 E7A00040 */  swc1      $f0, 0x40($sp)
/* C80AC 801319AC E7A60018 */  swc1      $f6, 0x18($sp)
/* C80B0 801319B0 0C0372DF */  jal       npc_raycast_down_sides
/* C80B4 801319B4 AFA20010 */   sw       $v0, 0x10($sp)
/* C80B8 801319B8 C7A0003C */  lwc1      $f0, 0x3C($sp)
/* C80BC 801319BC C7A20040 */  lwc1      $f2, 0x40($sp)
/* C80C0 801319C0 C7A40044 */  lwc1      $f4, 0x44($sp)
/* C80C4 801319C4 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* C80C8 801319C8 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* C80CC 801319CC E6200010 */  swc1      $f0, 0x10($s1)
/* C80D0 801319D0 E6220014 */  swc1      $f2, 0x14($s1)
/* C80D4 801319D4 E6240018 */  swc1      $f4, 0x18($s1)
/* C80D8 801319D8 C7A20018 */  lwc1      $f2, 0x18($sp)
/* C80DC 801319DC 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* C80E0 801319E0 44810000 */  mtc1      $at, $f0
/* C80E4 801319E4 C444011C */  lwc1      $f4, 0x11C($v0)
/* C80E8 801319E8 46001082 */  mul.s     $f2, $f2, $f0
/* C80EC 801319EC 00000000 */  nop
/* C80F0 801319F0 AE20002C */  sw        $zero, 0x2C($s1)
/* C80F4 801319F4 E6240028 */  swc1      $f4, 0x28($s1)
/* C80F8 801319F8 C4400124 */  lwc1      $f0, 0x124($v0)
/* C80FC 801319FC 44051000 */  mfc1      $a1, $f2
/* C8100 80131A00 0220202D */  daddu     $a0, $s1, $zero
/* C8104 80131A04 0C044A17 */  jal       set_standard_shadow_scale
/* C8108 80131A08 E4800030 */   swc1     $f0, 0x30($a0)
glabel .L80131A0C
/* C810C 80131A0C 9202001C */  lbu       $v0, 0x1C($s0)
/* C8110 80131A10 10400003 */  beqz      $v0, .L80131A20
/* C8114 80131A14 00000000 */   nop
/* C8118 80131A18 0C04C3DC */  jal       hide_item_entity
/* C811C 80131A1C 0200202D */   daddu    $a0, $s0, $zero
.L80131A20:
/* C8120 80131A20 0C04C44A */  jal       item_entity_load
/* C8124 80131A24 0200202D */   daddu    $a0, $s0, $zero
/* C8128 80131A28 86030018 */  lh        $v1, 0x18($s0)
/* C812C 80131A2C 24020157 */  addiu     $v0, $zero, 0x157
/* C8130 80131A30 14620009 */  bne       $v1, $v0, .L80131A58
/* C8134 80131A34 2402015C */   addiu    $v0, $zero, 0x15C
/* C8138 80131A38 3C058010 */  lui       $a1, %hi(SparkleScript_Coin)
/* C813C 80131A3C 24A54AC0 */  addiu     $a1, $a1, %lo(SparkleScript_Coin)
/* C8140 80131A40 0C04C27C */  jal       sparkle_script_init
/* C8144 80131A44 0200202D */   daddu    $a0, $s0, $zero
/* C8148 80131A48 0C04C2B3 */  jal       sparkle_script_update
/* C814C 80131A4C 0200202D */   daddu    $a0, $s0, $zero
/* C8150 80131A50 86030018 */  lh        $v1, 0x18($s0)
/* C8154 80131A54 2402015C */  addiu     $v0, $zero, 0x15C
.L80131A58:
/* C8158 80131A58 14620006 */  bne       $v1, $v0, .L80131A74
/* C815C 80131A5C 0280102D */   daddu    $v0, $s4, $zero
/* C8160 80131A60 8E020000 */  lw        $v0, 0x0($s0)
/* C8164 80131A64 2403FF7F */  addiu     $v1, $zero, -0x81
/* C8168 80131A68 00431024 */  and       $v0, $v0, $v1
/* C816C 80131A6C AE020000 */  sw        $v0, 0x0($s0)
/* C8170 80131A70 0280102D */  daddu     $v0, $s4, $zero
.L80131A74:
/* C8174 80131A74 8FBF0034 */  lw        $ra, 0x34($sp)
/* C8178 80131A78 8FB40030 */  lw        $s4, 0x30($sp)
/* C817C 80131A7C 8FB3002C */  lw        $s3, 0x2C($sp)
/* C8180 80131A80 8FB20028 */  lw        $s2, 0x28($sp)
/* C8184 80131A84 8FB10024 */  lw        $s1, 0x24($sp)
/* C8188 80131A88 8FB00020 */  lw        $s0, 0x20($sp)
/* C818C 80131A8C 03E00008 */  jr        $ra
/* C8190 80131A90 27BD0038 */   addiu    $sp, $sp, 0x38

### DECOMPILED C INSTRUCTIONS:

s32 make_item_entity(s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode, s32 pickupDelay, s32 angle, s32 pickupFlagIndex) {
    s32 i;
    s32 id;
    ItemEntity* item;
    f32 hitDepth;
    Shadow* shadow;

    if (pickupFlagIndex <= EVT_GAME_FLAG_CUTOFF) {
        pickupFlagIndex = EVT_INDEX_OF_GAME_FLAG(pickupFlagIndex);
    }

    if (pickupFlagIndex > 0) {
        switch (itemSpawnMode) {
            case ITEM_SPAWN_MODE_KEY:
            case ITEM_SPAWN_MODE_TOSS_NEVER_VANISH:
            case ITEM_SPAWN_MODE_TOSS:
            case ITEM_SPAWN_MODE_TOSS_SPAWN_ONCE:
            case ITEM_SPAWN_MODE_TOSS_SPAWN_ONCE_NEVER_VANISH:
            case ITEM_SPAWN_MODE_ITEM_BLOCK_ITEM:
            case ITEM_SPAWN_MODE_ITEM_BLOCK_BADGE:
            case ITEM_SPAWN_MODE_FALL_NEVER_VANISH:
            case ITEM_SPAWN_MODE_FALL:
            case ITEM_SPAWN_MODE_FALL_SPAWN_ONCE:
            case ITEM_SPAWN_MODE_FIXED_NEVER_VANISH:
            case ITEM_SPAWN_MODE_FIXED:
            case ITEM_SPAWN_MODE_ITEM_BLOCK_COIN:
            case ITEM_SPAWN_MODE_TOSS_HIGHER_NEVER_VANISH:
                if (get_global_flag(pickupFlagIndex) != 0) {
                    return -1;
                }
                break;
        }
    }

    for (i = 0; i < MAX_ITEM_ENTITIES; i++) {
        if (gCurrentItemEntities[i] == NULL) {
            break;
        }
    }

    ASSERT(i < MAX_ITEM_ENTITIES);

    id = i;
    gCurrentItemEntities[id] = item = heap_malloc(sizeof(*item));
    ItemEntitiesCreated++;
    ASSERT(item != NULL);

    item->renderGroup = (itemID & 0xF0000) >> 16;
    if (item->renderGroup == VIS_GROUP_5) {
        item->renderGroup = -1;
    }

    item->spawnType = itemSpawnMode;
    item->state = ITEM_PHYSICS_STATE_INIT;
    item->position.x = x;
    item->position.y = y;
    item->position.z = z;

    itemID &= 0xFFFF;

    item->flags = ITEM_ENTITY_FLAG_80 | ITEM_ENTITY_FLAG_10 | ITEM_ENTITY_FLAG_CAM2 | ITEM_ENTITY_FLAG_CAM1 | ITEM_ENTITY_FLAG_CAM0;
    item->pickupMsgFlags = 0;
    item->boundVar = pickupFlagIndex;
    item->itemID = itemID;
    item->physicsData = NULL;
    item->pickupDelay = pickupDelay;
    item->scale = 1.0f;
    item->spawnAngle = angle;
    item->shadowIndex = -1;
    item->nextUpdate = 1;
    item->lastPos.x = -9999;
    item->lastPos.y = -9999;
    item->lastPos.z = -9999;
    D_801565A6 = 30;

    item->flags |= ITEM_ENTITY_RESIZABLE;
    if (gItemTable[itemID].typeFlags & ITEM_TYPE_FLAG_ENTITY_FULLSIZE) {
        item->flags |= ITEM_ENTITY_FLAG_40000;
        item->flags &= ~ITEM_ENTITY_RESIZABLE;
    }

    if (ItemEntityAlternatingSpawn != 0) {
        item->flags |= ITEM_ENTITY_FLAG_20000;
    }

    ItemEntityAlternatingSpawn = 1 - ItemEntityAlternatingSpawn;

    switch (item->spawnType) {
        case ITEM_SPAWN_MODE_KEY:
            item->flags |= ITEM_ENTITY_FLAG_SAVE_ON_RECEIPT;
            break;
        case ITEM_SPAWN_MODE_DECORATION:
        case ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            break;
        case ITEM_SPAWN_MODE_INVISIBLE:
            item->flags |= ITEM_ENTITY_FLAG_100000;
            break;
        case ITEM_SPAWN_MODE_BATTLE_REWARD:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_TOSS_LOWER;
            item->spawnType = ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS;
            break;
        case ITEM_SPAWN_MODE_TOSS_NEVER_VANISH:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_SAVE_ON_TOUCH;
            item->flags |= ITEM_ENTITY_FLAG_NEVER_VANISH;
            item->spawnType = ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS;
            break;
        case ITEM_SPAWN_MODE_TOSS:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_SAVE_ON_TOUCH;
            item->spawnType = ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS;
            break;
        case ITEM_SPAWN_MODE_TOSS_SPAWN_ONCE:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_800;
            item->spawnType = ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS;
            break;
        case ITEM_SPAWN_MODE_TOSS_SPAWN_ONCE_NEVER_VANISH:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_800;
            item->flags |= ITEM_ENTITY_FLAG_NEVER_VANISH;
            item->spawnType = ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS;
            break;
        case ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS_NEVER_VANISH:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_NEVER_VANISH;
            item->spawnType = ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS;
            break;
        case ITEM_SPAWN_MODE_ITEM_BLOCK_ITEM:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_SAVE_ON_TOUCH;
            item->flags |= ITEM_ENTITY_FLAG_ANGLE_RELATIVE_VELOCITY;
            item->spawnType = ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS;
            break;
        case ITEM_SPAWN_MODE_ITEM_BLOCK_BADGE:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_SAVE_ON_TOUCH;
            item->flags |= ITEM_ENTITY_FLAG_ANGLE_RELATIVE_VELOCITY;
            item->flags |= ITEM_ENTITY_FLAG_NEVER_VANISH;
            item->spawnType = ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS;
            break;
        case ITEM_SPAWN_MODE_FALL_SPAWN_ALWAYS:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            break;
        case ITEM_SPAWN_MODE_FALL_NEVER_VANISH:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_SAVE_ON_TOUCH;
            item->flags |= ITEM_ENTITY_FLAG_NEVER_VANISH;
            item->spawnType = ITEM_SPAWN_MODE_FALL_SPAWN_ALWAYS;
            break;
        case ITEM_SPAWN_MODE_FALL:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_SAVE_ON_TOUCH;
            item->spawnType = ITEM_SPAWN_MODE_FALL_SPAWN_ALWAYS;
            break;
        case ITEM_SPAWN_MODE_FALL_SPAWN_ONCE:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_800;
            item->spawnType = ITEM_SPAWN_MODE_FALL_SPAWN_ALWAYS;
            break;
        case ITEM_SPAWN_MODE_FIXED_SPAWN_ALWAYS:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_NO_GRAVITY;
            item->flags |= ITEM_ENTITY_FLAG_NO_MOTION;
            break;
        case ITEM_SPAWN_MODE_FIXED_NEVER_VANISH:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_NO_GRAVITY;
            item->flags |= ITEM_ENTITY_FLAG_SAVE_ON_TOUCH;
            item->flags |= ITEM_ENTITY_FLAG_NEVER_VANISH;
            item->flags |= ITEM_ENTITY_FLAG_NO_MOTION;
            item->spawnType = ITEM_SPAWN_MODE_FIXED_SPAWN_ALWAYS;
            break;
        case ITEM_SPAWN_MODE_FIXED:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_NO_GRAVITY;
            item->flags |= ITEM_ENTITY_FLAG_SAVE_ON_TOUCH;
            item->flags |= ITEM_ENTITY_FLAG_NO_MOTION;
            item->spawnType = ITEM_SPAWN_MODE_FIXED_SPAWN_ALWAYS;
            break;
        case ITEM_SPAWN_MODE_FIXED_SPAWN_ALWAYS_NEVER_VANISH:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_NO_GRAVITY;
            item->flags |= ITEM_ENTITY_FLAG_NEVER_VANISH;
            item->flags |= ITEM_ENTITY_FLAG_NO_MOTION;
            item->spawnType = ITEM_SPAWN_MODE_FIXED_SPAWN_ALWAYS;
            break;
        case ITEM_SPAWN_MODE_TOSS_FADE1:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_1000;
            item->scale = 0.8f;
            item->flags |= ITEM_ENTITY_RESIZABLE;
            break;
        case ITEM_SPAWN_MODE_TOSS_FADE2:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_1000;
            item->flags |= ITEM_ENTITY_FLAG_TOSS_LOWER;
            item->spawnType = ITEM_SPAWN_MODE_TOSS_FADE1;
            item->scale = 0.8f;
            item->flags |= ITEM_ENTITY_RESIZABLE;
            break;
        case ITEM_SPAWN_MODE_TOSS_FADE3:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_1000;
            item->flags |= ITEM_ENTITY_FLAG_400000;
            item->spawnType = ITEM_SPAWN_MODE_TOSS_FADE1;
            item->scale = 0.8f;
            item->flags |= ITEM_ENTITY_RESIZABLE;
            break;
        case ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS_SMALL:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->spawnType = ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS;
            item->scale = 0.8f;
            item->flags |= ITEM_ENTITY_RESIZABLE;
            break;
        case ITEM_SPAWN_MODE_UNKNOWN_1B:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_8000;
            item->spawnType = ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS;
            item->scale = 0.8f;
            item->flags |= ITEM_ENTITY_RESIZABLE;
            break;
        case ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS:
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_8000;
            item->flags |= ITEM_ENTITY_FLAG_NEVER_VANISH;
            break;
        case ITEM_SPAWN_MODE_ITEM_BLOCK_COIN:
            item->spawnType = ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS;
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_8000;
            item->flags |= ITEM_ENTITY_FLAG_SAVE_ON_TOUCH;
            item->flags |= ITEM_ENTITY_FLAG_NEVER_VANISH;
            break;
        case ITEM_SPAWN_MODE_TOSS_HIGHER_NEVER_VANISH:
            item->spawnType = ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS;
            item->flags |= ITEM_ENTITY_FLAG_800000;
            item->flags |= ITEM_ENTITY_FLAG_SAVE_ON_TOUCH;
            item->flags |= ITEM_ENTITY_FLAG_NEVER_VANISH;
            item->flags |= ITEM_ENTITY_FLAG_TOSS_HIGHER;
            break;
    }

    switch (item->spawnType) {
        case ITEM_SPAWN_MODE_KEY:
        case ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS:
        case ITEM_SPAWN_MODE_FALL_SPAWN_ALWAYS:
        case ITEM_SPAWN_MODE_FIXED_SPAWN_ALWAYS:
        case ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS:
            item->shadowIndex = create_shadow_type(0, item->position.x, item->position.y, item->position.z);
            shadow = get_shadow_by_index(item->shadowIndex);

            if (item->spawnType == ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS) {
                shadow->flags |= ENTITY_FLAG_HIDDEN;
            }

            x = item->position.x;
            y = item->position.y + 12.0f;
            z = item->position.z;
            hitDepth = 1000.0f;
            npc_raycast_down_sides(COLLISION_CHANNEL_20000, &x, &y, &z, &hitDepth);
            shadow->position.x = x;
            shadow->position.y = y;
            shadow->position.z = z;
            shadow->rotation.x = gGameStatusPtr->playerGroundTraceAngles.x;
            shadow->rotation.y = 0.0f;
            shadow->rotation.z = gGameStatusPtr->playerGroundTraceAngles.z;
            set_standard_shadow_scale(shadow, hitDepth * 0.5f);
            break;
    }

    if (item->pickupDelay != 0) {
        hide_item_entity(item);
    }

    item_entity_load(item);

    if (item->itemID == ITEM_COIN) {
        sparkle_script_init(item, &SparkleScript_Coin);
        sparkle_script_update(item);
    }

    if (item->itemID == ITEM_STAR_PIECE) {
        item->flags &= ~ITEM_ENTITY_FLAG_80;
    }

    return id;
}