### RAW ASSEMBLY INSTRUCTIONS:

glabel spawn_drops
/* 23680 80048280 27BDFF68 */  addiu     $sp, $sp, -0x98
/* 23684 80048284 AFA40098 */  sw        $a0, 0x98($sp)
/* 23688 80048288 8FA80098 */  lw        $t0, 0x98($sp)
/* 2368C 8004828C AFBF0064 */  sw        $ra, 0x64($sp)
/* 23690 80048290 AFBE0060 */  sw        $fp, 0x60($sp)
/* 23694 80048294 AFB7005C */  sw        $s7, 0x5C($sp)
/* 23698 80048298 AFB60058 */  sw        $s6, 0x58($sp)
/* 2369C 8004829C AFB50054 */  sw        $s5, 0x54($sp)
/* 236A0 800482A0 AFB40050 */  sw        $s4, 0x50($sp)
/* 236A4 800482A4 AFB3004C */  sw        $s3, 0x4C($sp)
/* 236A8 800482A8 AFB20048 */  sw        $s2, 0x48($sp)
/* 236AC 800482AC AFB10044 */  sw        $s1, 0x44($sp)
/* 236B0 800482B0 AFB00040 */  sw        $s0, 0x40($sp)
/* 236B4 800482B4 F7BE0090 */  sdc1      $f30, 0x90($sp)
/* 236B8 800482B8 F7BC0088 */  sdc1      $f28, 0x88($sp)
/* 236BC 800482BC F7BA0080 */  sdc1      $f26, 0x80($sp)
/* 236C0 800482C0 F7B80078 */  sdc1      $f24, 0x78($sp)
/* 236C4 800482C4 F7B60070 */  sdc1      $f22, 0x70($sp)
/* 236C8 800482C8 F7B40068 */  sdc1      $f20, 0x68($sp)
/* 236CC 800482CC AFA0002C */  sw        $zero, 0x2C($sp)
/* 236D0 800482D0 84840008 */  lh        $a0, 0x8($a0)
/* 236D4 800482D4 8D0800D4 */  lw        $t0, 0xD4($t0)
/* 236D8 800482D8 0000902D */  daddu     $s2, $zero, $zero
/* 236DC 800482DC 0C00EABB */  jal       get_npc_unsafe
/* 236E0 800482E0 AFA80020 */   sw       $t0, 0x20($sp)
/* 236E4 800482E4 0040802D */  daddu     $s0, $v0, $zero
/* 236E8 800482E8 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 236EC 800482EC 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 236F0 800482F0 3C04800B */  lui       $a0, %hi(gCameras)
/* 236F4 800482F4 24841D80 */  addiu     $a0, $a0, %lo(gCameras)
/* 236F8 800482F8 00031080 */  sll       $v0, $v1, 2
/* 236FC 800482FC 00431021 */  addu      $v0, $v0, $v1
/* 23700 80048300 00021080 */  sll       $v0, $v0, 2
/* 23704 80048304 00431023 */  subu      $v0, $v0, $v1
/* 23708 80048308 000218C0 */  sll       $v1, $v0, 3
/* 2370C 8004830C 00431021 */  addu      $v0, $v0, $v1
/* 23710 80048310 000210C0 */  sll       $v0, $v0, 3
/* 23714 80048314 00448821 */  addu      $s1, $v0, $a0
.L80048318:
/* 23718 80048318 0C044181 */  jal       get_shadow_by_index
/* 2371C 8004831C 0240202D */   daddu    $a0, $s2, $zero
/* 23720 80048320 14400004 */  bnez      $v0, .L80048334
/* 23724 80048324 26520001 */   addiu    $s2, $s2, 0x1
/* 23728 80048328 8FA8002C */  lw        $t0, 0x2C($sp)
/* 2372C 8004832C 25080001 */  addiu     $t0, $t0, 0x1
/* 23730 80048330 AFA8002C */  sw        $t0, 0x2C($sp)
.L80048334:
/* 23734 80048334 2A42003C */  slti      $v0, $s2, 0x3C
/* 23738 80048338 1440FFF7 */  bnez      $v0, .L80048318
/* 2373C 8004833C 0000F02D */   daddu    $fp, $zero, $zero
/* 23740 80048340 C620006C */  lwc1      $f0, 0x6C($s1)
/* 23744 80048344 3C0142B4 */  lui       $at, (0x42B40000 >> 16)
/* 23748 80048348 44816000 */  mtc1      $at, $f12
/* 2374C 8004834C 3C038015 */  lui       $v1, %hi(gLastRenderTaskCount)
/* 23750 80048350 8C63B7F0 */  lw        $v1, %lo(gLastRenderTaskCount)($v1)
/* 23754 80048354 240200F6 */  addiu     $v0, $zero, 0xF6
/* 23758 80048358 AFA00024 */  sw        $zero, 0x24($sp)
/* 2375C 8004835C 460C0300 */  add.s     $f12, $f0, $f12
/* 23760 80048360 00431023 */  subu      $v0, $v0, $v1
/* 23764 80048364 0C00A6C9 */  jal       clamp_angle
/* 23768 80048368 AFA20028 */   sw       $v0, 0x28($sp)
/* 2376C 8004836C 4600010D */  trunc.w.s $f4, $f0
/* 23770 80048370 44162000 */  mfc1      $s6, $f4
/* 23774 80048374 960200A8 */  lhu       $v0, 0xA8($s0)
/* 23778 80048378 8FA80020 */  lw        $t0, 0x20($sp)
/* 2377C 8004837C C602003C */  lwc1      $f2, 0x3C($s0)
/* 23780 80048380 00021400 */  sll       $v0, $v0, 16
/* 23784 80048384 00021C03 */  sra       $v1, $v0, 16
/* 23788 80048388 000217C2 */  srl       $v0, $v0, 31
/* 2378C 8004838C 00621821 */  addu      $v1, $v1, $v0
/* 23790 80048390 00031843 */  sra       $v1, $v1, 1
/* 23794 80048394 44830000 */  mtc1      $v1, $f0
/* 23798 80048398 00000000 */  nop
/* 2379C 8004839C 46800020 */  cvt.s.w   $f0, $f0
/* 237A0 800483A0 46001080 */  add.s     $f2, $f2, $f0
/* 237A4 800483A4 91110001 */  lbu       $s1, 0x1($t0)
/* 237A8 800483A8 03C0B82D */  daddu     $s7, $fp, $zero
/* 237AC 800483AC E7A20038 */  swc1      $f2, 0x38($sp)
/* 237B0 800483B0 C6040038 */  lwc1      $f4, 0x38($s0)
/* 237B4 800483B4 E7A40034 */  swc1      $f4, 0x34($sp)
/* 237B8 800483B8 C61E0040 */  lwc1      $f30, 0x40($s0)
/* 237BC 800483BC 0C00A67F */  jal       rand_int
/* 237C0 800483C0 24040064 */   addiu    $a0, $zero, 0x64
/* 237C4 800483C4 0051102A */  slt       $v0, $v0, $s1
/* 237C8 800483C8 10400061 */  beqz      $v0, .L80048550
/* 237CC 800483CC 03C0902D */   daddu    $s2, $fp, $zero
/* 237D0 800483D0 03C0202D */  daddu     $a0, $fp, $zero
/* 237D4 800483D4 24050002 */  addiu     $a1, $zero, 0x2
/* 237D8 800483D8 8FA30020 */  lw        $v1, 0x20($sp)
.L800483DC:
/* 237DC 800483DC 84620002 */  lh        $v0, 0x2($v1)
/* 237E0 800483E0 10400009 */  beqz      $v0, .L80048408
/* 237E4 800483E4 24630006 */   addiu    $v1, $v1, 0x6
/* 237E8 800483E8 8FA80020 */  lw        $t0, 0x20($sp)
/* 237EC 800483EC 26520001 */  addiu     $s2, $s2, 0x1
/* 237F0 800483F0 01051021 */  addu      $v0, $t0, $a1
/* 237F4 800483F4 84420002 */  lh        $v0, 0x2($v0)
/* 237F8 800483F8 00822021 */  addu      $a0, $a0, $v0
/* 237FC 800483FC 2A420008 */  slti      $v0, $s2, 0x8
/* 23800 80048400 1440FFF6 */  bnez      $v0, .L800483DC
/* 23804 80048404 24A50006 */   addiu    $a1, $a1, 0x6
.L80048408:
/* 23808 80048408 0C00A67F */  jal       rand_int
/* 2380C 8004840C 0000A82D */   daddu    $s5, $zero, $zero
/* 23810 80048410 0040882D */  daddu     $s1, $v0, $zero
/* 23814 80048414 02A0902D */  daddu     $s2, $s5, $zero
/* 23818 80048418 24140004 */  addiu     $s4, $zero, 0x4
/* 2381C 8004841C 8FB00020 */  lw        $s0, 0x20($sp)
/* 23820 80048420 24130002 */  addiu     $s3, $zero, 0x2
/* 23824 80048424 AFA00030 */  sw        $zero, 0x30($sp)
.L80048428:
/* 23828 80048428 86020002 */  lh        $v0, 0x2($s0)
/* 2382C 8004842C 10400017 */  beqz      $v0, .L8004848C
/* 23830 80048430 00000000 */   nop
/* 23834 80048434 8FA80020 */  lw        $t0, 0x20($sp)
/* 23838 80048438 01131021 */  addu      $v0, $t0, $s3
/* 2383C 8004843C 01141821 */  addu      $v1, $t0, $s4
/* 23840 80048440 84420002 */  lh        $v0, 0x2($v0)
/* 23844 80048444 84640002 */  lh        $a0, 0x2($v1)
/* 23848 80048448 18800005 */  blez      $a0, .L80048460
/* 2384C 8004844C 02A2A821 */   addu     $s5, $s5, $v0
/* 23850 80048450 0C05152F */  jal       get_global_flag
/* 23854 80048454 24840714 */   addiu    $a0, $a0, 0x714
/* 23858 80048458 54400007 */  bnel      $v0, $zero, .L80048478
/* 2385C 8004845C 26940006 */   addiu    $s4, $s4, 0x6
.L80048460:
/* 23860 80048460 02B1102A */  slt       $v0, $s5, $s1
/* 23864 80048464 54400004 */  bnel      $v0, $zero, .L80048478
/* 23868 80048468 26940006 */   addiu    $s4, $s4, 0x6
/* 2386C 8004846C 86100002 */  lh        $s0, 0x2($s0)
/* 23870 80048470 08012123 */  j         .L8004848C
/* 23874 80048474 AFB00030 */   sw       $s0, 0x30($sp)
.L80048478:
/* 23878 80048478 26730006 */  addiu     $s3, $s3, 0x6
/* 2387C 8004847C 26520001 */  addiu     $s2, $s2, 0x1
/* 23880 80048480 2A420008 */  slti      $v0, $s2, 0x8
/* 23884 80048484 1440FFE8 */  bnez      $v0, .L80048428
/* 23888 80048488 26100006 */   addiu    $s0, $s0, 0x6
.L8004848C:
/* 2388C 8004848C 8FA80098 */  lw        $t0, 0x98($sp)
/* 23890 80048490 8FA80030 */  lw        $t0, 0x30($sp)
/* 23894 80048494 1100002E */  beqz      $t0, .L80048550
/* 23898 80048498 24020004 */   addiu    $v0, $zero, 0x4
/* 2389C 8004849C 0100202D */  daddu     $a0, $t0, $zero
/* 238A0 800484A0 00171840 */  sll       $v1, $s7, 1
/* 238A4 800484A4 00771821 */  addu      $v1, $v1, $s7
/* 238A8 800484A8 AFA20010 */  sw        $v0, 0x10($sp)
/* 238AC 800484AC 00431004 */  sllv      $v0, $v1, $v0
/* 238B0 800484B0 00431023 */  subu      $v0, $v0, $v1
/* 238B4 800484B4 000210C0 */  sll       $v0, $v0, 3
/* 238B8 800484B8 8FA50034 */  lw        $a1, 0x34($sp)
/* 238BC 800484BC 8FA60038 */  lw        $a2, 0x38($sp)
/* 238C0 800484C0 4407F000 */  mfc1      $a3, $f30
/* 238C4 800484C4 8FA80024 */  lw        $t0, 0x24($sp)
/* 238C8 800484C8 02C21021 */  addu      $v0, $s6, $v0
/* 238CC 800484CC AFA20018 */  sw        $v0, 0x18($sp)
/* 238D0 800484D0 AFA0001C */  sw        $zero, 0x1C($sp)
/* 238D4 800484D4 0C04C4FD */  jal       make_item_entity
/* 238D8 800484D8 AFA80014 */   sw       $t0, 0x14($sp)
/* 238DC 800484DC 44960000 */  mtc1      $s6, $f0
/* 238E0 800484E0 00000000 */  nop
/* 238E4 800484E4 46800021 */  cvt.d.w   $f0, $f0
/* 238E8 800484E8 27DE0001 */  addiu     $fp, $fp, 0x1
/* 238EC 800484EC 2BC2000C */  slti      $v0, $fp, 0xC
/* 238F0 800484F0 3C01403E */  lui       $at, (0x403E0000 >> 16)
/* 238F4 800484F4 44811800 */  mtc1      $at, $f3
/* 238F8 800484F8 44801000 */  mtc1      $zero, $f2
/* 238FC 800484FC 8FA80024 */  lw        $t0, 0x24($sp)
/* 23900 80048500 46220000 */  add.d     $f0, $f0, $f2
/* 23904 80048504 25080002 */  addiu     $t0, $t0, 0x2
/* 23908 80048508 AFA80024 */  sw        $t0, 0x24($sp)
/* 2390C 8004850C 4620010D */  trunc.w.d $f4, $f0
/* 23910 80048510 44162000 */  mfc1      $s6, $f4
/* 23914 80048514 14400004 */  bnez      $v0, .L80048528
/* 23918 80048518 00121040 */   sll      $v0, $s2, 1
/* 2391C 8004851C 26F70001 */  addiu     $s7, $s7, 0x1
/* 23920 80048520 0017B0C0 */  sll       $s6, $s7, 3
/* 23924 80048524 0000F02D */  daddu     $fp, $zero, $zero
.L80048528:
/* 23928 80048528 00521021 */  addu      $v0, $v0, $s2
/* 2392C 8004852C 24420002 */  addiu     $v0, $v0, 0x2
/* 23930 80048530 8FA80020 */  lw        $t0, 0x20($sp)
/* 23934 80048534 00021040 */  sll       $v0, $v0, 1
/* 23938 80048538 01021021 */  addu      $v0, $t0, $v0
/* 2393C 8004853C 84440002 */  lh        $a0, 0x2($v0)
/* 23940 80048540 04800003 */  bltz      $a0, .L80048550
/* 23944 80048544 00000000 */   nop
/* 23948 80048548 0C051514 */  jal       set_global_flag
/* 2394C 8004854C 24840715 */   addiu    $a0, $a0, 0x715
.L80048550:
/* 23950 80048550 3C02800B */  lui       $v0, %hi(gCurrentEncounter + 0x13)
/* 23954 80048554 80420F23 */  lb        $v0, %lo(gCurrentEncounter + 0x13)($v0)
/* 23958 80048558 10400026 */  beqz      $v0, .L800485F4
/* 2395C 8004855C 24040093 */   addiu    $a0, $zero, 0x93
/* 23960 80048560 24020004 */  addiu     $v0, $zero, 0x4
/* 23964 80048564 00171840 */  sll       $v1, $s7, 1
/* 23968 80048568 00771821 */  addu      $v1, $v1, $s7
/* 2396C 8004856C AFA20010 */  sw        $v0, 0x10($sp)
/* 23970 80048570 00431004 */  sllv      $v0, $v1, $v0
/* 23974 80048574 00431023 */  subu      $v0, $v0, $v1
/* 23978 80048578 000210C0 */  sll       $v0, $v0, 3
/* 2397C 8004857C 8FA50034 */  lw        $a1, 0x34($sp)
/* 23980 80048580 8FA60038 */  lw        $a2, 0x38($sp)
/* 23984 80048584 4407F000 */  mfc1      $a3, $f30
/* 23988 80048588 8FA80024 */  lw        $t0, 0x24($sp)
/* 2398C 8004858C 02C21021 */  addu      $v0, $s6, $v0
/* 23990 80048590 3C01800B */  lui       $at, %hi(gCurrentEncounter + 0x13)
/* 23994 80048594 A0200F23 */  sb        $zero, %lo(gCurrentEncounter + 0x13)($at)
/* 23998 80048598 AFA20018 */  sw        $v0, 0x18($sp)
/* 2399C 8004859C AFA0001C */  sw        $zero, 0x1C($sp)
/* 239A0 800485A0 0C04C4FD */  jal       make_item_entity
/* 239A4 800485A4 AFA80014 */   sw       $t0, 0x14($sp)
/* 239A8 800485A8 44960000 */  mtc1      $s6, $f0
/* 239AC 800485AC 00000000 */  nop
/* 239B0 800485B0 46800021 */  cvt.d.w   $f0, $f0
/* 239B4 800485B4 27DE0001 */  addiu     $fp, $fp, 0x1
/* 239B8 800485B8 2BC2000C */  slti      $v0, $fp, 0xC
/* 239BC 800485BC 3C01403E */  lui       $at, (0x403E0000 >> 16)
/* 239C0 800485C0 44811800 */  mtc1      $at, $f3
/* 239C4 800485C4 44801000 */  mtc1      $zero, $f2
/* 239C8 800485C8 8FA80024 */  lw        $t0, 0x24($sp)
/* 239CC 800485CC 46220000 */  add.d     $f0, $f0, $f2
/* 239D0 800485D0 25080002 */  addiu     $t0, $t0, 0x2
/* 239D4 800485D4 AFA80024 */  sw        $t0, 0x24($sp)
/* 239D8 800485D8 4620010D */  trunc.w.d $f4, $f0
/* 239DC 800485DC 44162000 */  mfc1      $s6, $f4
/* 239E0 800485E0 14400005 */  bnez      $v0, .L800485F8
/* 239E4 800485E4 0000882D */   daddu    $s1, $zero, $zero
/* 239E8 800485E8 26F70001 */  addiu     $s7, $s7, 0x1
/* 239EC 800485EC 0017B0C0 */  sll       $s6, $s7, 3
/* 239F0 800485F0 0000F02D */  daddu     $fp, $zero, $zero
.L800485F4:
/* 239F4 800485F4 0000882D */  daddu     $s1, $zero, $zero
.L800485F8:
/* 239F8 800485F8 0220902D */  daddu     $s2, $s1, $zero
/* 239FC 800485FC 24150006 */  addiu     $s5, $zero, 0x6
/* 23A00 80048600 24140004 */  addiu     $s4, $zero, 0x4
/* 23A04 80048604 8FB00020 */  lw        $s0, 0x20($sp)
/* 23A08 80048608 3C0146FF */  lui       $at, (0x46FFFE00 >> 16)
/* 23A0C 8004860C 3421FE00 */  ori       $at, $at, (0x46FFFE00 & 0xFFFF)
/* 23A10 80048610 4481D000 */  mtc1      $at, $f26
/* 23A14 80048614 3C0142C8 */  lui       $at, (0x42C80000 >> 16)
/* 23A18 80048618 4481E000 */  mtc1      $at, $f28
/* 23A1C 8004861C 3C028011 */  lui       $v0, %hi(gPlayerData + 0x2)
/* 23A20 80048620 8042F292 */  lb        $v0, %lo(gPlayerData + 0x2)($v0)
/* 23A24 80048624 3C038011 */  lui       $v1, %hi(gPlayerData + 0x3)
/* 23A28 80048628 8063F293 */  lb        $v1, %lo(gPlayerData + 0x3)($v1)
/* 23A2C 8004862C 24130002 */  addiu     $s3, $zero, 0x2
/* 23A30 80048630 AFA00030 */  sw        $zero, 0x30($sp)
/* 23A34 80048634 44821000 */  mtc1      $v0, $f2
/* 23A38 80048638 00000000 */  nop
/* 23A3C 8004863C 468010A0 */  cvt.s.w   $f2, $f2
/* 23A40 80048640 44830000 */  mtc1      $v1, $f0
/* 23A44 80048644 00000000 */  nop
/* 23A48 80048648 46800020 */  cvt.s.w   $f0, $f0
/* 23A4C 8004864C 46001603 */  div.s     $f24, $f2, $f0
.L80048650:
/* 23A50 80048650 8FA80020 */  lw        $t0, 0x20($sp)
/* 23A54 80048654 86030032 */  lh        $v1, 0x32($s0)
/* 23A58 80048658 01131021 */  addu      $v0, $t0, $s3
/* 23A5C 8004865C 4483B000 */  mtc1      $v1, $f22
/* 23A60 80048660 00000000 */  nop
/* 23A64 80048664 4680B5A0 */  cvt.s.w   $f22, $f22
/* 23A68 80048668 461AB583 */  div.s     $f22, $f22, $f26
/* 23A6C 8004866C 84420032 */  lh        $v0, 0x32($v0)
/* 23A70 80048670 4616C03E */  c.le.s    $f24, $f22
/* 23A74 80048674 4482A000 */  mtc1      $v0, $f20
/* 23A78 80048678 00000000 */  nop
/* 23A7C 8004867C 4680A520 */  cvt.s.w   $f20, $f20
/* 23A80 80048680 45000034 */  bc1f      .L80048754
/* 23A84 80048684 461AA503 */   div.s    $f20, $f20, $f26
/* 23A88 80048688 0C00A67F */  jal       rand_int
/* 23A8C 8004868C 24040064 */   addiu    $a0, $zero, 0x64
/* 23A90 80048690 461CA082 */  mul.s     $f2, $f20, $f28
/* 23A94 80048694 00000000 */  nop
/* 23A98 80048698 44820000 */  mtc1      $v0, $f0
/* 23A9C 8004869C 00000000 */  nop
/* 23AA0 800486A0 46800020 */  cvt.s.w   $f0, $f0
/* 23AA4 800486A4 4602003E */  c.le.s    $f0, $f2
/* 23AA8 800486A8 00000000 */  nop
/* 23AAC 800486AC 4502002A */  bc1fl     .L80048758
/* 23AB0 800486B0 26B50008 */   addiu    $s5, $s5, 0x8
/* 23AB4 800486B4 0000802D */  daddu     $s0, $zero, $zero
/* 23AB8 800486B8 8FA80020 */  lw        $t0, 0x20($sp)
/* 23ABC 800486BC 44900000 */  mtc1      $s0, $f0
/* 23AC0 800486C0 00000000 */  nop
/* 23AC4 800486C4 46800020 */  cvt.s.w   $f0, $f0
/* 23AC8 800486C8 01141021 */  addu      $v0, $t0, $s4
/* 23ACC 800486CC 01151821 */  addu      $v1, $t0, $s5
/* 23AD0 800486D0 84420032 */  lh        $v0, 0x32($v0)
/* 23AD4 800486D4 84630032 */  lh        $v1, 0x32($v1)
/* 23AD8 800486D8 4482B000 */  mtc1      $v0, $f22
/* 23ADC 800486DC 00000000 */  nop
/* 23AE0 800486E0 4680B5A0 */  cvt.s.w   $f22, $f22
/* 23AE4 800486E4 4483A000 */  mtc1      $v1, $f20
/* 23AE8 800486E8 00000000 */  nop
/* 23AEC 800486EC 4680A520 */  cvt.s.w   $f20, $f20
/* 23AF0 800486F0 4616003C */  c.lt.s    $f0, $f22
/* 23AF4 800486F4 00000000 */  nop
/* 23AF8 800486F8 4500001D */  bc1f      .L80048770
/* 23AFC 800486FC 461AA503 */   div.s    $f20, $f20, $f26
.L80048700:
/* 23B00 80048700 0C00A67F */  jal       rand_int
/* 23B04 80048704 24040064 */   addiu    $a0, $zero, 0x64
/* 23B08 80048708 461CA082 */  mul.s     $f2, $f20, $f28
/* 23B0C 8004870C 00000000 */  nop
/* 23B10 80048710 44820000 */  mtc1      $v0, $f0
/* 23B14 80048714 00000000 */  nop
/* 23B18 80048718 46800020 */  cvt.s.w   $f0, $f0
/* 23B1C 8004871C 4602003E */  c.le.s    $f0, $f2
/* 23B20 80048720 00000000 */  nop
/* 23B24 80048724 45030001 */  bc1tl     .L8004872C
/* 23B28 80048728 26310001 */   addiu    $s1, $s1, 0x1
.L8004872C:
/* 23B2C 8004872C 26100001 */  addiu     $s0, $s0, 0x1
/* 23B30 80048730 44900000 */  mtc1      $s0, $f0
/* 23B34 80048734 00000000 */  nop
/* 23B38 80048738 46800020 */  cvt.s.w   $f0, $f0
/* 23B3C 8004873C 4616003C */  c.lt.s    $f0, $f22
/* 23B40 80048740 00000000 */  nop
/* 23B44 80048744 4500000A */  bc1f      .L80048770
/* 23B48 80048748 00000000 */   nop
/* 23B4C 8004874C 080121C0 */  j         .L80048700
/* 23B50 80048750 00000000 */   nop
.L80048754:
/* 23B54 80048754 26B50008 */  addiu     $s5, $s5, 0x8
.L80048758:
/* 23B58 80048758 26940008 */  addiu     $s4, $s4, 0x8
/* 23B5C 8004875C 26730008 */  addiu     $s3, $s3, 0x8
/* 23B60 80048760 26520001 */  addiu     $s2, $s2, 0x1
/* 23B64 80048764 2A420008 */  slti      $v0, $s2, 0x8
/* 23B68 80048768 1440FFB9 */  bnez      $v0, .L80048650
/* 23B6C 8004876C 26100008 */   addiu    $s0, $s0, 0x8
.L80048770:
/* 23B70 80048770 0C03A752 */  jal       is_ability_active
/* 23B74 80048774 2404002B */   addiu    $a0, $zero, 0x2B
/* 23B78 80048778 10400005 */  beqz      $v0, .L80048790
/* 23B7C 8004877C 00000000 */   nop
/* 23B80 80048780 0C00A67F */  jal       rand_int
/* 23B84 80048784 24040002 */   addiu    $a0, $zero, 0x2
/* 23B88 80048788 26230001 */  addiu     $v1, $s1, 0x1
/* 23B8C 8004878C 00628821 */  addu      $s1, $v1, $v0
.L80048790:
/* 23B90 80048790 8FA80098 */  lw        $t0, 0x98($sp)
/* 23B94 80048794 8D020000 */  lw        $v0, 0x0($t0)
/* 23B98 80048798 3C030080 */  lui       $v1, (0x800000 >> 16)
/* 23B9C 8004879C 00431024 */  and       $v0, $v0, $v1
/* 23BA0 800487A0 54400001 */  bnel      $v0, $zero, .L800487A8
/* 23BA4 800487A4 0000882D */   daddu    $s1, $zero, $zero
.L800487A8:
/* 23BA8 800487A8 12200002 */  beqz      $s1, .L800487B4
/* 23BAC 800487AC 24080156 */   addiu    $t0, $zero, 0x156
/* 23BB0 800487B0 AFA80030 */  sw        $t0, 0x30($sp)
.L800487B4:
/* 23BB4 800487B4 8FA80028 */  lw        $t0, 0x28($sp)
/* 23BB8 800487B8 00111040 */  sll       $v0, $s1, 1
/* 23BBC 800487BC 0102102A */  slt       $v0, $t0, $v0
/* 23BC0 800487C0 10400004 */  beqz      $v0, .L800487D4
/* 23BC4 800487C4 000817C2 */   srl      $v0, $t0, 31
/* 23BC8 800487C8 01021021 */  addu      $v0, $t0, $v0
/* 23BCC 800487CC 00028843 */  sra       $s1, $v0, 1
/* 23BD0 800487D0 8FA80028 */  lw        $t0, 0x28($sp)
.L800487D4:
/* 23BD4 800487D4 00111040 */  sll       $v0, $s1, 1
/* 23BD8 800487D8 01024023 */  subu      $t0, $t0, $v0
/* 23BDC 800487DC AFA80028 */  sw        $t0, 0x28($sp)
/* 23BE0 800487E0 8FA8002C */  lw        $t0, 0x2C($sp)
/* 23BE4 800487E4 0111102A */  slt       $v0, $t0, $s1
/* 23BE8 800487E8 54400002 */  bnel      $v0, $zero, .L800487F4
/* 23BEC 800487EC 0100882D */   daddu    $s1, $t0, $zero
/* 23BF0 800487F0 8FA8002C */  lw        $t0, 0x2C($sp)
.L800487F4:
/* 23BF4 800487F4 0000902D */  daddu     $s2, $zero, $zero
/* 23BF8 800487F8 01114023 */  subu      $t0, $t0, $s1
/* 23BFC 800487FC 1A200029 */  blez      $s1, .L800488A4
/* 23C00 80048800 AFA8002C */   sw       $t0, 0x2C($sp)
/* 23C04 80048804 24130004 */  addiu     $s3, $zero, 0x4
/* 23C08 80048808 3C01403E */  lui       $at, (0x403E0000 >> 16)
/* 23C0C 8004880C 4481A800 */  mtc1      $at, $f21
/* 23C10 80048810 4480A000 */  mtc1      $zero, $f20
/* 23C14 80048814 00171840 */  sll       $v1, $s7, 1
/* 23C18 80048818 00771821 */  addu      $v1, $v1, $s7
/* 23C1C 8004881C 02631004 */  sllv      $v0, $v1, $s3
/* 23C20 80048820 00431023 */  subu      $v0, $v0, $v1
/* 23C24 80048824 000280C0 */  sll       $s0, $v0, 3
.L80048828:
/* 23C28 80048828 8FA50034 */  lw        $a1, 0x34($sp)
/* 23C2C 8004882C 8FA60038 */  lw        $a2, 0x38($sp)
/* 23C30 80048830 4407F000 */  mfc1      $a3, $f30
/* 23C34 80048834 8FA40030 */  lw        $a0, 0x30($sp)
/* 23C38 80048838 8FA80024 */  lw        $t0, 0x24($sp)
/* 23C3C 8004883C 02D01021 */  addu      $v0, $s6, $s0
/* 23C40 80048840 AFB30010 */  sw        $s3, 0x10($sp)
/* 23C44 80048844 AFA20018 */  sw        $v0, 0x18($sp)
/* 23C48 80048848 AFA0001C */  sw        $zero, 0x1C($sp)
/* 23C4C 8004884C 0C04C4FD */  jal       make_item_entity
/* 23C50 80048850 AFA80014 */   sw       $t0, 0x14($sp)
/* 23C54 80048854 44960000 */  mtc1      $s6, $f0
/* 23C58 80048858 00000000 */  nop
/* 23C5C 8004885C 46800021 */  cvt.d.w   $f0, $f0
/* 23C60 80048860 27DE0001 */  addiu     $fp, $fp, 0x1
/* 23C64 80048864 2BC2000C */  slti      $v0, $fp, 0xC
/* 23C68 80048868 8FA80024 */  lw        $t0, 0x24($sp)
/* 23C6C 8004886C 46340000 */  add.d     $f0, $f0, $f20
/* 23C70 80048870 25080002 */  addiu     $t0, $t0, 0x2
/* 23C74 80048874 AFA80024 */  sw        $t0, 0x24($sp)
/* 23C78 80048878 4620010D */  trunc.w.d $f4, $f0
/* 23C7C 8004887C 44162000 */  mfc1      $s6, $f4
/* 23C80 80048880 14400005 */  bnez      $v0, .L80048898
/* 23C84 80048884 26520001 */   addiu    $s2, $s2, 0x1
/* 23C88 80048888 0000F02D */  daddu     $fp, $zero, $zero
/* 23C8C 8004888C 26100168 */  addiu     $s0, $s0, 0x168
/* 23C90 80048890 26F70001 */  addiu     $s7, $s7, 0x1
/* 23C94 80048894 0017B0C0 */  sll       $s6, $s7, 3
.L80048898:
/* 23C98 80048898 0251102A */  slt       $v0, $s2, $s1
/* 23C9C 8004889C 1440FFE2 */  bnez      $v0, .L80048828
/* 23CA0 800488A0 00000000 */   nop
.L800488A4:
/* 23CA4 800488A4 0000882D */  daddu     $s1, $zero, $zero
/* 23CA8 800488A8 0220902D */  daddu     $s2, $s1, $zero
/* 23CAC 800488AC 24150006 */  addiu     $s5, $zero, 0x6
/* 23CB0 800488B0 24140004 */  addiu     $s4, $zero, 0x4
/* 23CB4 800488B4 8FB00020 */  lw        $s0, 0x20($sp)
/* 23CB8 800488B8 3C0146FF */  lui       $at, (0x46FFFE00 >> 16)
/* 23CBC 800488BC 3421FE00 */  ori       $at, $at, (0x46FFFE00 & 0xFFFF)
/* 23CC0 800488C0 4481D000 */  mtc1      $at, $f26
/* 23CC4 800488C4 3C0142C8 */  lui       $at, (0x42C80000 >> 16)
/* 23CC8 800488C8 4481E000 */  mtc1      $at, $f28
/* 23CCC 800488CC 3C028011 */  lui       $v0, %hi(gPlayerData + 0x5)
/* 23CD0 800488D0 8042F295 */  lb        $v0, %lo(gPlayerData + 0x5)($v0)
/* 23CD4 800488D4 3C038011 */  lui       $v1, %hi(gPlayerData + 0x6)
/* 23CD8 800488D8 8063F296 */  lb        $v1, %lo(gPlayerData + 0x6)($v1)
/* 23CDC 800488DC 24130002 */  addiu     $s3, $zero, 0x2
/* 23CE0 800488E0 AFA00030 */  sw        $zero, 0x30($sp)
/* 23CE4 800488E4 44821000 */  mtc1      $v0, $f2
/* 23CE8 800488E8 00000000 */  nop
/* 23CEC 800488EC 468010A0 */  cvt.s.w   $f2, $f2
/* 23CF0 800488F0 44830000 */  mtc1      $v1, $f0
/* 23CF4 800488F4 00000000 */  nop
/* 23CF8 800488F8 46800020 */  cvt.s.w   $f0, $f0
/* 23CFC 800488FC 46001603 */  div.s     $f24, $f2, $f0
.L80048900:
/* 23D00 80048900 8FA80020 */  lw        $t0, 0x20($sp)
/* 23D04 80048904 86030072 */  lh        $v1, 0x72($s0)
/* 23D08 80048908 01131021 */  addu      $v0, $t0, $s3
/* 23D0C 8004890C 4483B000 */  mtc1      $v1, $f22
/* 23D10 80048910 00000000 */  nop
/* 23D14 80048914 4680B5A0 */  cvt.s.w   $f22, $f22
/* 23D18 80048918 461AB583 */  div.s     $f22, $f22, $f26
/* 23D1C 8004891C 84420072 */  lh        $v0, 0x72($v0)
/* 23D20 80048920 4616C03E */  c.le.s    $f24, $f22
/* 23D24 80048924 4482A000 */  mtc1      $v0, $f20
/* 23D28 80048928 00000000 */  nop
/* 23D2C 8004892C 4680A520 */  cvt.s.w   $f20, $f20
/* 23D30 80048930 45000034 */  bc1f      .L80048A04
/* 23D34 80048934 461AA503 */   div.s    $f20, $f20, $f26
/* 23D38 80048938 0C00A67F */  jal       rand_int
/* 23D3C 8004893C 24040064 */   addiu    $a0, $zero, 0x64
/* 23D40 80048940 461CA082 */  mul.s     $f2, $f20, $f28
/* 23D44 80048944 00000000 */  nop
/* 23D48 80048948 44820000 */  mtc1      $v0, $f0
/* 23D4C 8004894C 00000000 */  nop
/* 23D50 80048950 46800020 */  cvt.s.w   $f0, $f0
/* 23D54 80048954 4602003E */  c.le.s    $f0, $f2
/* 23D58 80048958 00000000 */  nop
/* 23D5C 8004895C 4502002A */  bc1fl     .L80048A08
/* 23D60 80048960 26B50008 */   addiu    $s5, $s5, 0x8
/* 23D64 80048964 0000802D */  daddu     $s0, $zero, $zero
/* 23D68 80048968 8FA80020 */  lw        $t0, 0x20($sp)
/* 23D6C 8004896C 44900000 */  mtc1      $s0, $f0
/* 23D70 80048970 00000000 */  nop
/* 23D74 80048974 46800020 */  cvt.s.w   $f0, $f0
/* 23D78 80048978 01141021 */  addu      $v0, $t0, $s4
/* 23D7C 8004897C 01151821 */  addu      $v1, $t0, $s5
/* 23D80 80048980 84420072 */  lh        $v0, 0x72($v0)
/* 23D84 80048984 84630072 */  lh        $v1, 0x72($v1)
/* 23D88 80048988 4482B000 */  mtc1      $v0, $f22
/* 23D8C 8004898C 00000000 */  nop
/* 23D90 80048990 4680B5A0 */  cvt.s.w   $f22, $f22
/* 23D94 80048994 4483A000 */  mtc1      $v1, $f20
/* 23D98 80048998 00000000 */  nop
/* 23D9C 8004899C 4680A520 */  cvt.s.w   $f20, $f20
/* 23DA0 800489A0 4616003C */  c.lt.s    $f0, $f22
/* 23DA4 800489A4 00000000 */  nop
/* 23DA8 800489A8 4500001D */  bc1f      .L80048A20
/* 23DAC 800489AC 461AA503 */   div.s    $f20, $f20, $f26
.L800489B0:
/* 23DB0 800489B0 0C00A67F */  jal       rand_int
/* 23DB4 800489B4 24040064 */   addiu    $a0, $zero, 0x64
/* 23DB8 800489B8 461CA082 */  mul.s     $f2, $f20, $f28
/* 23DBC 800489BC 00000000 */  nop
/* 23DC0 800489C0 44820000 */  mtc1      $v0, $f0
/* 23DC4 800489C4 00000000 */  nop
/* 23DC8 800489C8 46800020 */  cvt.s.w   $f0, $f0
/* 23DCC 800489CC 4602003E */  c.le.s    $f0, $f2
/* 23DD0 800489D0 00000000 */  nop
/* 23DD4 800489D4 45030001 */  bc1tl     .L800489DC
/* 23DD8 800489D8 26310001 */   addiu    $s1, $s1, 0x1
.L800489DC:
/* 23DDC 800489DC 26100001 */  addiu     $s0, $s0, 0x1
/* 23DE0 800489E0 44900000 */  mtc1      $s0, $f0
/* 23DE4 800489E4 00000000 */  nop
/* 23DE8 800489E8 46800020 */  cvt.s.w   $f0, $f0
/* 23DEC 800489EC 4616003C */  c.lt.s    $f0, $f22
/* 23DF0 800489F0 00000000 */  nop
/* 23DF4 800489F4 4500000A */  bc1f      .L80048A20
/* 23DF8 800489F8 00000000 */   nop
/* 23DFC 800489FC 0801226C */  j         .L800489B0
/* 23E00 80048A00 00000000 */   nop
.L80048A04:
/* 23E04 80048A04 26B50008 */  addiu     $s5, $s5, 0x8
.L80048A08:
/* 23E08 80048A08 26940008 */  addiu     $s4, $s4, 0x8
/* 23E0C 80048A0C 26730008 */  addiu     $s3, $s3, 0x8
/* 23E10 80048A10 26520001 */  addiu     $s2, $s2, 0x1
/* 23E14 80048A14 2A420008 */  slti      $v0, $s2, 0x8
/* 23E18 80048A18 1440FFB9 */  bnez      $v0, .L80048900
/* 23E1C 80048A1C 26100008 */   addiu    $s0, $s0, 0x8
.L80048A20:
/* 23E20 80048A20 0C03A752 */  jal       is_ability_active
/* 23E24 80048A24 2404002C */   addiu    $a0, $zero, 0x2C
/* 23E28 80048A28 10400005 */  beqz      $v0, .L80048A40
/* 23E2C 80048A2C 00000000 */   nop
/* 23E30 80048A30 0C00A67F */  jal       rand_int
/* 23E34 80048A34 24040002 */   addiu    $a0, $zero, 0x2
/* 23E38 80048A38 26230001 */  addiu     $v1, $s1, 0x1
/* 23E3C 80048A3C 00628821 */  addu      $s1, $v1, $v0
.L80048A40:
/* 23E40 80048A40 8FA80098 */  lw        $t0, 0x98($sp)
/* 23E44 80048A44 8D020000 */  lw        $v0, 0x0($t0)
/* 23E48 80048A48 3C030080 */  lui       $v1, (0x800000 >> 16)
/* 23E4C 80048A4C 00431024 */  and       $v0, $v0, $v1
/* 23E50 80048A50 54400001 */  bnel      $v0, $zero, .L80048A58
/* 23E54 80048A54 0000882D */   daddu    $s1, $zero, $zero
.L80048A58:
/* 23E58 80048A58 12200002 */  beqz      $s1, .L80048A64
/* 23E5C 80048A5C 2408015B */   addiu    $t0, $zero, 0x15B
/* 23E60 80048A60 AFA80030 */  sw        $t0, 0x30($sp)
.L80048A64:
/* 23E64 80048A64 8FA80028 */  lw        $t0, 0x28($sp)
/* 23E68 80048A68 00111040 */  sll       $v0, $s1, 1
/* 23E6C 80048A6C 0102102A */  slt       $v0, $t0, $v0
/* 23E70 80048A70 10400004 */  beqz      $v0, .L80048A84
/* 23E74 80048A74 000817C2 */   srl      $v0, $t0, 31
/* 23E78 80048A78 01021021 */  addu      $v0, $t0, $v0
/* 23E7C 80048A7C 00028843 */  sra       $s1, $v0, 1
/* 23E80 80048A80 8FA80028 */  lw        $t0, 0x28($sp)
.L80048A84:
/* 23E84 80048A84 00111040 */  sll       $v0, $s1, 1
/* 23E88 80048A88 01024023 */  subu      $t0, $t0, $v0
/* 23E8C 80048A8C AFA80028 */  sw        $t0, 0x28($sp)
/* 23E90 80048A90 8FA8002C */  lw        $t0, 0x2C($sp)
/* 23E94 80048A94 0111102A */  slt       $v0, $t0, $s1
/* 23E98 80048A98 54400002 */  bnel      $v0, $zero, .L80048AA4
/* 23E9C 80048A9C 0100882D */   daddu    $s1, $t0, $zero
/* 23EA0 80048AA0 8FA8002C */  lw        $t0, 0x2C($sp)
.L80048AA4:
/* 23EA4 80048AA4 0000902D */  daddu     $s2, $zero, $zero
/* 23EA8 80048AA8 01114023 */  subu      $t0, $t0, $s1
/* 23EAC 80048AAC 1A200029 */  blez      $s1, .L80048B54
/* 23EB0 80048AB0 AFA8002C */   sw       $t0, 0x2C($sp)
/* 23EB4 80048AB4 24130004 */  addiu     $s3, $zero, 0x4
/* 23EB8 80048AB8 3C01403E */  lui       $at, (0x403E0000 >> 16)
/* 23EBC 80048ABC 4481A800 */  mtc1      $at, $f21
/* 23EC0 80048AC0 4480A000 */  mtc1      $zero, $f20
/* 23EC4 80048AC4 00171840 */  sll       $v1, $s7, 1
/* 23EC8 80048AC8 00771821 */  addu      $v1, $v1, $s7
/* 23ECC 80048ACC 02631004 */  sllv      $v0, $v1, $s3
/* 23ED0 80048AD0 00431023 */  subu      $v0, $v0, $v1
/* 23ED4 80048AD4 000280C0 */  sll       $s0, $v0, 3
.L80048AD8:
/* 23ED8 80048AD8 8FA50034 */  lw        $a1, 0x34($sp)
/* 23EDC 80048ADC 8FA60038 */  lw        $a2, 0x38($sp)
/* 23EE0 80048AE0 4407F000 */  mfc1      $a3, $f30
/* 23EE4 80048AE4 8FA40030 */  lw        $a0, 0x30($sp)
/* 23EE8 80048AE8 8FA80024 */  lw        $t0, 0x24($sp)
/* 23EEC 80048AEC 02D01021 */  addu      $v0, $s6, $s0
/* 23EF0 80048AF0 AFB30010 */  sw        $s3, 0x10($sp)
/* 23EF4 80048AF4 AFA20018 */  sw        $v0, 0x18($sp)
/* 23EF8 80048AF8 AFA0001C */  sw        $zero, 0x1C($sp)
/* 23EFC 80048AFC 0C04C4FD */  jal       make_item_entity
/* 23F00 80048B00 AFA80014 */   sw       $t0, 0x14($sp)
/* 23F04 80048B04 44960000 */  mtc1      $s6, $f0
/* 23F08 80048B08 00000000 */  nop
/* 23F0C 80048B0C 46800021 */  cvt.d.w   $f0, $f0
/* 23F10 80048B10 27DE0001 */  addiu     $fp, $fp, 0x1
/* 23F14 80048B14 2BC2000C */  slti      $v0, $fp, 0xC
/* 23F18 80048B18 8FA80024 */  lw        $t0, 0x24($sp)
/* 23F1C 80048B1C 46340000 */  add.d     $f0, $f0, $f20
/* 23F20 80048B20 25080002 */  addiu     $t0, $t0, 0x2
/* 23F24 80048B24 AFA80024 */  sw        $t0, 0x24($sp)
/* 23F28 80048B28 4620010D */  trunc.w.d $f4, $f0
/* 23F2C 80048B2C 44162000 */  mfc1      $s6, $f4
/* 23F30 80048B30 14400005 */  bnez      $v0, .L80048B48
/* 23F34 80048B34 26520001 */   addiu    $s2, $s2, 0x1
/* 23F38 80048B38 0000F02D */  daddu     $fp, $zero, $zero
/* 23F3C 80048B3C 26100168 */  addiu     $s0, $s0, 0x168
/* 23F40 80048B40 26F70001 */  addiu     $s7, $s7, 0x1
/* 23F44 80048B44 0017B0C0 */  sll       $s6, $s7, 3
.L80048B48:
/* 23F48 80048B48 0251102A */  slt       $v0, $s2, $s1
/* 23F4C 80048B4C 1440FFE2 */  bnez      $v0, .L80048AD8
/* 23F50 80048B50 00000000 */   nop
.L80048B54:
/* 23F54 80048B54 24080157 */  addiu     $t0, $zero, 0x157
/* 23F58 80048B58 AFA80030 */  sw        $t0, 0x30($sp)
/* 23F5C 80048B5C 8FA80020 */  lw        $t0, 0x20($sp)
/* 23F60 80048B60 851000B2 */  lh        $s0, 0xB2($t0)
/* 23F64 80048B64 850400B4 */  lh        $a0, 0xB4($t0)
/* 23F68 80048B68 0090102A */  slt       $v0, $a0, $s0
/* 23F6C 80048B6C 10400003 */  beqz      $v0, .L80048B7C
/* 23F70 80048B70 0200882D */   daddu    $s1, $s0, $zero
/* 23F74 80048B74 0080802D */  daddu     $s0, $a0, $zero
/* 23F78 80048B78 0220202D */  daddu     $a0, $s1, $zero
.L80048B7C:
/* 23F7C 80048B7C 06010003 */  bgez      $s0, .L80048B8C
/* 23F80 80048B80 00908823 */   subu     $s1, $a0, $s0
/* 23F84 80048B84 080122E5 */  j         .L80048B94
/* 23F88 80048B88 00902023 */   subu     $a0, $a0, $s0
.L80048B8C:
/* 23F8C 80048B8C 12200005 */  beqz      $s1, .L80048BA4
/* 23F90 80048B90 0220202D */   daddu    $a0, $s1, $zero
.L80048B94:
/* 23F94 80048B94 0C00A67F */  jal       rand_int
/* 23F98 80048B98 00000000 */   nop
/* 23F9C 80048B9C 080122EA */  j         .L80048BA8
/* 23FA0 80048BA0 00508821 */   addu     $s1, $v0, $s0
.L80048BA4:
/* 23FA4 80048BA4 0200882D */  daddu     $s1, $s0, $zero
.L80048BA8:
/* 23FA8 80048BA8 06220001 */  bltzl     $s1, .L80048BB0
/* 23FAC 80048BAC 0000882D */   daddu    $s1, $zero, $zero
.L80048BB0:
/* 23FB0 80048BB0 3C02800B */  lui       $v0, %hi(gCurrentEncounter + 0xE)
/* 23FB4 80048BB4 84420F1E */  lh        $v0, %lo(gCurrentEncounter + 0xE)($v0)
/* 23FB8 80048BB8 24040019 */  addiu     $a0, $zero, 0x19
/* 23FBC 80048BBC 0C03A752 */  jal       is_ability_active
/* 23FC0 80048BC0 02228821 */   addu     $s1, $s1, $v0
/* 23FC4 80048BC4 10400007 */  beqz      $v0, .L80048BE4
/* 23FC8 80048BC8 00000000 */   nop
/* 23FCC 80048BCC 3C02800B */  lui       $v0, %hi(gCurrentEncounter + 0xC)
/* 23FD0 80048BD0 90420F1C */  lbu       $v0, %lo(gCurrentEncounter + 0xC)($v0)
/* 23FD4 80048BD4 3C01800B */  lui       $at, %hi(gCurrentEncounter + 0xC)
/* 23FD8 80048BD8 A0200F1C */  sb        $zero, %lo(gCurrentEncounter + 0xC)($at)
/* 23FDC 80048BDC 00021042 */  srl       $v0, $v0, 1
/* 23FE0 80048BE0 02228821 */  addu      $s1, $s1, $v0
.L80048BE4:
/* 23FE4 80048BE4 3C02800B */  lui       $v0, %hi(gCurrentEncounter + 0xB)
/* 23FE8 80048BE8 80420F1B */  lb        $v0, %lo(gCurrentEncounter + 0xB)($v0)
/* 23FEC 80048BEC 10400004 */  beqz      $v0, .L80048C00
/* 23FF0 80048BF0 00111040 */   sll      $v0, $s1, 1
/* 23FF4 80048BF4 3C01800B */  lui       $at, %hi(gCurrentEncounter + 0xB)
/* 23FF8 80048BF8 A0200F1B */  sb        $zero, %lo(gCurrentEncounter + 0xB)($at)
/* 23FFC 80048BFC 02228821 */  addu      $s1, $s1, $v0
.L80048C00:
/* 24000 80048C00 0C03A752 */  jal       is_ability_active
/* 24004 80048C04 24040010 */   addiu    $a0, $zero, 0x10
/* 24008 80048C08 54400001 */  bnel      $v0, $zero, .L80048C10
/* 2400C 80048C0C 00118840 */   sll      $s1, $s1, 1
.L80048C10:
/* 24010 80048C10 2A220015 */  slti      $v0, $s1, 0x15
/* 24014 80048C14 50400001 */  beql      $v0, $zero, .L80048C1C
/* 24018 80048C18 24110014 */   addiu    $s1, $zero, 0x14
.L80048C1C:
/* 2401C 80048C1C 8FA80098 */  lw        $t0, 0x98($sp)
/* 24020 80048C20 8D020000 */  lw        $v0, 0x0($t0)
/* 24024 80048C24 3C030080 */  lui       $v1, (0x800000 >> 16)
/* 24028 80048C28 00431024 */  and       $v0, $v0, $v1
/* 2402C 80048C2C 54400001 */  bnel      $v0, $zero, .L80048C34
/* 24030 80048C30 0000882D */   daddu    $s1, $zero, $zero
.L80048C34:
/* 24034 80048C34 8FA80028 */  lw        $t0, 0x28($sp)
/* 24038 80048C38 00111040 */  sll       $v0, $s1, 1
/* 2403C 80048C3C 0102102A */  slt       $v0, $t0, $v0
/* 24040 80048C40 10400003 */  beqz      $v0, .L80048C50
/* 24044 80048C44 000817C2 */   srl      $v0, $t0, 31
/* 24048 80048C48 01021021 */  addu      $v0, $t0, $v0
/* 2404C 80048C4C 00028843 */  sra       $s1, $v0, 1
.L80048C50:
/* 24050 80048C50 8FA8002C */  lw        $t0, 0x2C($sp)
/* 24054 80048C54 0111102A */  slt       $v0, $t0, $s1
/* 24058 80048C58 54400001 */  bnel      $v0, $zero, .L80048C60
/* 2405C 80048C5C 0100882D */   daddu    $s1, $t0, $zero
.L80048C60:
/* 24060 80048C60 1A200029 */  blez      $s1, .L80048D08
/* 24064 80048C64 0000902D */   daddu    $s2, $zero, $zero
/* 24068 80048C68 24130004 */  addiu     $s3, $zero, 0x4
/* 2406C 80048C6C 3C01403E */  lui       $at, (0x403E0000 >> 16)
/* 24070 80048C70 4481A800 */  mtc1      $at, $f21
/* 24074 80048C74 4480A000 */  mtc1      $zero, $f20
/* 24078 80048C78 00171840 */  sll       $v1, $s7, 1
/* 2407C 80048C7C 00771821 */  addu      $v1, $v1, $s7
/* 24080 80048C80 02631004 */  sllv      $v0, $v1, $s3
/* 24084 80048C84 00431023 */  subu      $v0, $v0, $v1
/* 24088 80048C88 000280C0 */  sll       $s0, $v0, 3
.L80048C8C:
/* 2408C 80048C8C 8FA50034 */  lw        $a1, 0x34($sp)
/* 24090 80048C90 8FA60038 */  lw        $a2, 0x38($sp)
/* 24094 80048C94 4407F000 */  mfc1      $a3, $f30
/* 24098 80048C98 8FA40030 */  lw        $a0, 0x30($sp)
/* 2409C 80048C9C 8FA80024 */  lw        $t0, 0x24($sp)
/* 240A0 80048CA0 02D01021 */  addu      $v0, $s6, $s0
/* 240A4 80048CA4 AFB30010 */  sw        $s3, 0x10($sp)
/* 240A8 80048CA8 AFA20018 */  sw        $v0, 0x18($sp)
/* 240AC 80048CAC AFA0001C */  sw        $zero, 0x1C($sp)
/* 240B0 80048CB0 0C04C4FD */  jal       make_item_entity
/* 240B4 80048CB4 AFA80014 */   sw       $t0, 0x14($sp)
/* 240B8 80048CB8 44960000 */  mtc1      $s6, $f0
/* 240BC 80048CBC 00000000 */  nop
/* 240C0 80048CC0 46800021 */  cvt.d.w   $f0, $f0
/* 240C4 80048CC4 27DE0001 */  addiu     $fp, $fp, 0x1
/* 240C8 80048CC8 2BC2000C */  slti      $v0, $fp, 0xC
/* 240CC 80048CCC 8FA80024 */  lw        $t0, 0x24($sp)
/* 240D0 80048CD0 46340000 */  add.d     $f0, $f0, $f20
/* 240D4 80048CD4 25080002 */  addiu     $t0, $t0, 0x2
/* 240D8 80048CD8 AFA80024 */  sw        $t0, 0x24($sp)
/* 240DC 80048CDC 4620010D */  trunc.w.d $f4, $f0
/* 240E0 80048CE0 44162000 */  mfc1      $s6, $f4
/* 240E4 80048CE4 14400005 */  bnez      $v0, .L80048CFC
/* 240E8 80048CE8 26520001 */   addiu    $s2, $s2, 0x1
/* 240EC 80048CEC 0000F02D */  daddu     $fp, $zero, $zero
/* 240F0 80048CF0 26100168 */  addiu     $s0, $s0, 0x168
/* 240F4 80048CF4 26F70001 */  addiu     $s7, $s7, 0x1
/* 240F8 80048CF8 0017B0C0 */  sll       $s6, $s7, 3
.L80048CFC:
/* 240FC 80048CFC 0251102A */  slt       $v0, $s2, $s1
/* 24100 80048D00 1440FFE2 */  bnez      $v0, .L80048C8C
/* 24104 80048D04 00000000 */   nop
.L80048D08:
/* 24108 80048D08 8FBF0064 */  lw        $ra, 0x64($sp)
/* 2410C 80048D0C 8FBE0060 */  lw        $fp, 0x60($sp)
/* 24110 80048D10 8FB7005C */  lw        $s7, 0x5C($sp)
/* 24114 80048D14 8FB60058 */  lw        $s6, 0x58($sp)
/* 24118 80048D18 8FB50054 */  lw        $s5, 0x54($sp)
/* 2411C 80048D1C 8FB40050 */  lw        $s4, 0x50($sp)
/* 24120 80048D20 8FB3004C */  lw        $s3, 0x4C($sp)
/* 24124 80048D24 8FB20048 */  lw        $s2, 0x48($sp)
/* 24128 80048D28 8FB10044 */  lw        $s1, 0x44($sp)
/* 2412C 80048D2C 8FB00040 */  lw        $s0, 0x40($sp)
/* 24130 80048D30 D7BE0090 */  ldc1      $f30, 0x90($sp)
/* 24134 80048D34 D7BC0088 */  ldc1      $f28, 0x88($sp)
/* 24138 80048D38 D7BA0080 */  ldc1      $f26, 0x80($sp)
/* 2413C 80048D3C D7B80078 */  ldc1      $f24, 0x78($sp)
/* 24140 80048D40 D7B60070 */  ldc1      $f22, 0x70($sp)
/* 24144 80048D44 D7B40068 */  ldc1      $f20, 0x68($sp)
/* 24148 80048D48 03E00008 */  jr        $ra
/* 2414C 80048D4C 27BD0098 */   addiu    $sp, $sp, 0x98

### DECOMPILED C INSTRUCTIONS:

void spawn_drops(Enemy* enemy) {
    PlayerData* playerData = &gPlayerData;
    EncounterStatus* encounter = &gCurrentEncounter;
    EnemyDropsFlat* drops = (EnemyDropsFlat*) enemy->drops; // TODO: unify EnemyDrops / EnemyDropsFlat
    Npc* npc = get_npc_unsafe(enemy->npcID);
    Camera* camera = &gCameras[gCurrentCameraID];
    s32 pickupDelay;
    s32 availableRenderTasks;
    s32 availableShadows;
    s32 itemToDrop;
    f32 x, y, z;
    f32 threshold;
    f32 chance;
    f32 attempts;
    f32 fraction;
    s32 maxCoinBonus;
    s32 minCoinBonus;
    s32 tempMax;
    s32 spawnCounter;
    s32 dropCount;
    s32 totalWeight;
    s32 angle;
    s32 angleMult;
    s32 i, j;
    s32 flags;

    availableShadows = 0;
    for (i = 0; i < MAX_SHADOWS; i++) {
        if (get_shadow_by_index(i) == NULL) {
            availableShadows++;
        }
    }

    spawnCounter = 0;
    availableRenderTasks = 256 - 10 - gLastRenderTaskCount;
    angle = clamp_angle(camera->currentYaw + 90.0f);
    x = npc->pos.x;
    y = npc->pos.y + (npc->collisionHeight / 2);
    z = npc->pos.z;

    angleMult = 0;
    pickupDelay = 0;

    dropCount = drops->itemDropChance;
    if (drops->itemDropChance > rand_int(100)) {
        tempMax = 0;

        for (i = 0; i < 8; i++) {
            if (drops->itemDrops[3 * i] != 0) {
                tempMax += drops->itemDrops[3 * i + 1];
            } else {
                break;
            }
        }

        totalWeight = 0;
        dropCount = rand_int(tempMax);
        itemToDrop = ITEM_NONE;

        for (i = 0; i < 8; i++) {
            if (drops->itemDrops[3 * i] == 0) {
                break;
            }

            totalWeight += drops->itemDrops[3 * i + 1];
            if (drops->itemDrops[3 * i + 2] > 0) {
                if (get_global_flag(EVT_INDEX_OF_GAME_FLAG(GF_Unused_NPC_6C) + drops->itemDrops[3 * i + 2])) {
                    continue;
                }
            }

            if (totalWeight >= dropCount) {
                itemToDrop = drops->itemDrops[3 * i];
                do { } while (0); // TODO required to match
                break;
            }
        }

        // TODO this bullshit is required to match
        flags = enemy->flags;
        if (flags) {
            flags = 0;
        }

        if (itemToDrop != ITEM_NONE) {
            make_item_entity(itemToDrop, x, y, z, ITEM_SPAWN_MODE_BATTLE_REWARD, pickupDelay, angle + angleMult * 360, 0);
            spawnCounter++;
            pickupDelay += 2;
            angle += 30.0;
            if (spawnCounter >= 12) {
                angleMult++;
                angle = angleMult * 8;
                spawnCounter = 0;
            }

            if (drops->itemDrops[3 * i + 2] >= 0) {
                set_global_flag(EVT_INDEX_OF_GAME_FLAG(GF_SpawnedItemDrop_00) + drops->itemDrops[3 * i + 2]);
            }
        }
    }

    if (encounter->dropWhackaBump) {
        encounter->dropWhackaBump = FALSE;
        make_item_entity(ITEM_WHACKAS_BUMP, x, y, z, ITEM_SPAWN_MODE_BATTLE_REWARD, pickupDelay, angle + angleMult * 360, 0);
        spawnCounter++;
        pickupDelay += 2;
        angle += 30.0;
        if (spawnCounter >= 12) {
            angleMult++;
            angle = angleMult * 8;
            spawnCounter = 0;
        }
    }

    dropCount = 0;
    itemToDrop = ITEM_NONE;
    fraction = playerData->curHP / (f32) playerData->curMaxHP;

    for (i = 0; i < 8; i++) {
        attempts  = drops->heartDrops[4 * i];
        threshold = drops->heartDrops[4 * i + 1];
        attempts  /= 32767.0f;
        threshold /= 32767.0f;

        if (fraction <= attempts && rand_int(100) <= threshold * 100.0f) {
            attempts = drops->heartDrops[4 * i + 2];
            chance = drops->heartDrops[4 * i + 3];
            chance /= 32767.0f;
            for (j = 0; j < attempts; j++) {
                if (rand_int(100) <= chance * 100.0f) {
                    dropCount++;
                }
            }
            break;
        }
    }

    if (is_ability_active(ABILITY_HEART_FINDER) != 0) {
        dropCount += 1 + rand_int(2);
    }
    if (enemy->flags & ENEMY_FLAG_NO_DROPS) {
        dropCount = 0;
    }
    if (dropCount != 0) {
        itemToDrop = ITEM_HEART;
    }
    if (dropCount * 2 > availableRenderTasks) {
        dropCount = availableRenderTasks / 2;
    }
    availableRenderTasks -= 2 * dropCount;
    if (dropCount > availableShadows) {
        dropCount = availableShadows;
    }

    availableShadows -= dropCount;

    for (i = 0; i < dropCount; i++) {
        make_item_entity(itemToDrop, x, y, z, ITEM_SPAWN_MODE_BATTLE_REWARD, pickupDelay, angle + (angleMult * 360), 0);
        spawnCounter++;
        pickupDelay += 2;
        angle += 30.0;
        if (spawnCounter >= 12) {
            spawnCounter = 0;
            angleMult++;
            angle = angleMult * 8;
        }
    }

    dropCount = 0;
    itemToDrop = ITEM_NONE;
    fraction = playerData->curFP / (f32) playerData->curMaxFP;

    for (i = 0; i < 8; i++) {
        attempts  = drops->flowerDrops[4 * i + 0];
        threshold = drops->flowerDrops[4 * i + 1];
        attempts  /= 32767.0f;
        threshold /= 32767.0f;

        if (fraction <= attempts && rand_int(100) <= threshold * 100.0f) {
            attempts = drops->flowerDrops[4 * i + 2];
            chance = drops->flowerDrops[4 * i + 3];
            chance /= 32767.0f;
            for (j = 0; j < attempts; j++) {
                if (rand_int(100) <= chance * 100.0f) {
                    dropCount++;
                }
            }
            break;
        }
    }

    if (is_ability_active(ABILITY_FLOWER_FINDER) != 0) {
        dropCount += 1 + rand_int(2);
    }
    if (enemy->flags & ENEMY_FLAG_NO_DROPS) {
        dropCount = 0;
    }
    if (dropCount != 0) {
        itemToDrop = ITEM_FLOWER_POINT;
    }
    if (dropCount * 2 > availableRenderTasks) {
        dropCount = availableRenderTasks / 2;
    }
    availableRenderTasks -= 2 * dropCount;
    if (dropCount > availableShadows) {
        dropCount = availableShadows;
    }

    availableShadows -= dropCount;

    for (i = 0; i < dropCount; i++) {
        make_item_entity(itemToDrop, x, y, z, ITEM_SPAWN_MODE_BATTLE_REWARD, pickupDelay, angle + (angleMult * 360), 0);
        spawnCounter++;
        pickupDelay += 2;
        angle += 30.0;
        if (spawnCounter >= 12) {
            spawnCounter = 0;
            angleMult++;
            angle = angleMult * 8;
        }
    }

    itemToDrop = ITEM_COIN;
    do {} while (0);
    minCoinBonus = drops->minCoinBonus;
    tempMax = drops->maxCoinBonus;

    if (drops->maxCoinBonus < drops->minCoinBonus) {
        dropCount = minCoinBonus;
        minCoinBonus = tempMax;
        tempMax = dropCount;
    }

    if (minCoinBonus < 0) {
        dropCount = rand_int(tempMax - minCoinBonus) + minCoinBonus;
    } else {
        dropCount = tempMax - minCoinBonus;
        if (dropCount != 0) {
            dropCount = rand_int(dropCount) + minCoinBonus;
        } else {
            dropCount = minCoinBonus;
        }
    }

    if (dropCount < 0) {
        dropCount = 0;
    }
    dropCount = dropCount + encounter->coinsEarned;

    if (is_ability_active(ABILITY_PAY_OFF) != 0) {
        dropCount += encounter->damageTaken / 2;
        encounter->damageTaken = 0;
    }
    if (encounter->hasMerleeCoinBonus) {
        encounter->hasMerleeCoinBonus = FALSE;
        dropCount *= 3;
    }
    if (is_ability_active(ABILITY_MONEY_MONEY) != 0) {
        dropCount *= 2;
    }
    if (dropCount > 20) {
        dropCount = 20;
    }
    if (enemy->flags & ENEMY_FLAG_NO_DROPS) {
        dropCount = 0;
    }
    if (dropCount * 2 > availableRenderTasks) {
        dropCount = availableRenderTasks / 2;
    }
    availableRenderTasks -= 2 * dropCount;

    if (dropCount > availableShadows) {
        dropCount = availableShadows;
    }

    for (i = 0; i < dropCount; i++) {
        make_item_entity(itemToDrop, x, y, z, ITEM_SPAWN_MODE_BATTLE_REWARD, pickupDelay, angle + (angleMult * 360), 0);
        spawnCounter++;
        pickupDelay += 2;
        angle = angle + 30.0;
        if (spawnCounter >= 12) {
            spawnCounter = 0;
            angleMult++;
            angle = angleMult * 8;
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel ShowShopOwnerDialog
/* 7E1A50 80280BD0 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 7E1A54 80280BD4 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 7E1A58 80280BD8 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 7E1A5C 80280BDC AFB10014 */  sw        $s1, 0x14($sp)
/* 7E1A60 80280BE0 AFB20018 */  sw        $s2, 0x18($sp)
/* 7E1A64 80280BE4 3C128011 */  lui       $s2, %hi(gPlayerData)
/* 7E1A68 80280BE8 2652F290 */  addiu     $s2, $s2, %lo(gPlayerData)
/* 7E1A6C 80280BEC AFBF0020 */  sw        $ra, 0x20($sp)
/* 7E1A70 80280BF0 AFB3001C */  sw        $s3, 0x1C($sp)
/* 7E1A74 80280BF4 AFB00010 */  sw        $s0, 0x10($sp)
/* 7E1A78 80280BF8 8C500144 */  lw        $s0, 0x144($v0)
/* 7E1A7C 80280BFC 10A00006 */  beqz      $a1, .L80280C18
/* 7E1A80 80280C00 0080882D */   daddu    $s1, $a0, $zero
/* 7E1A84 80280C04 0C0A0000 */  jal       shop_owner_begin_speech
/* 7E1A88 80280C08 24040004 */   addiu    $a0, $zero, 0x4
/* 7E1A8C 80280C0C AE220074 */  sw        $v0, 0x74($s1)
/* 7E1A90 80280C10 24020004 */  addiu     $v0, $zero, 0x4
/* 7E1A94 80280C14 AE220070 */  sw        $v0, 0x70($s1)
.L80280C18:
/* 7E1A98 80280C18 8E230070 */  lw        $v1, 0x70($s1)
/* 7E1A9C 80280C1C 24130020 */  addiu     $s3, $zero, 0x20
/* 7E1AA0 80280C20 10730117 */  beq       $v1, $s3, .L80281080
/* 7E1AA4 80280C24 28620021 */   slti     $v0, $v1, 0x21
/* 7E1AA8 80280C28 10400027 */  beqz      $v0, .L80280CC8
/* 7E1AAC 80280C2C 24020007 */   addiu    $v0, $zero, 0x7
/* 7E1AB0 80280C30 1062018C */  beq       $v1, $v0, .L80281264
/* 7E1AB4 80280C34 28620008 */   slti     $v0, $v1, 0x8
/* 7E1AB8 80280C38 10400011 */  beqz      $v0, .L80280C80
/* 7E1ABC 80280C3C 24020003 */   addiu    $v0, $zero, 0x3
/* 7E1AC0 80280C40 106200D9 */  beq       $v1, $v0, .L80280FA8
/* 7E1AC4 80280C44 28620004 */   slti     $v0, $v1, 0x4
/* 7E1AC8 80280C48 10400007 */  beqz      $v0, .L80280C68
/* 7E1ACC 80280C4C 24020004 */   addiu    $v0, $zero, 0x4
/* 7E1AD0 80280C50 106001DC */  beqz      $v1, .L802813C4
/* 7E1AD4 80280C54 24020002 */   addiu    $v0, $zero, 0x2
/* 7E1AD8 80280C58 106200AF */  beq       $v1, $v0, .L80280F18
/* 7E1ADC 80280C5C 0000102D */   daddu    $v0, $zero, $zero
/* 7E1AE0 80280C60 080A0506 */  j         .L80281418
/* 7E1AE4 80280C64 00000000 */   nop
.L80280C68:
/* 7E1AE8 80280C68 1062003F */  beq       $v1, $v0, .L80280D68
/* 7E1AEC 80280C6C 24020005 */   addiu    $v0, $zero, 0x5
/* 7E1AF0 80280C70 1062012B */  beq       $v1, $v0, .L80281120
/* 7E1AF4 80280C74 0000102D */   daddu    $v0, $zero, $zero
/* 7E1AF8 80280C78 080A0506 */  j         .L80281418
/* 7E1AFC 80280C7C 00000000 */   nop
.L80280C80:
/* 7E1B00 80280C80 2402000C */  addiu     $v0, $zero, 0xC
/* 7E1B04 80280C84 10620108 */  beq       $v1, $v0, .L802810A8
/* 7E1B08 80280C88 2862000D */   slti     $v0, $v1, 0xD
/* 7E1B0C 80280C8C 10400007 */  beqz      $v0, .L80280CAC
/* 7E1B10 80280C90 24020009 */   addiu    $v0, $zero, 0x9
/* 7E1B14 80280C94 106201CB */  beq       $v1, $v0, .L802813C4
/* 7E1B18 80280C98 2402000A */   addiu    $v0, $zero, 0xA
/* 7E1B1C 80280C9C 106201D1 */  beq       $v1, $v0, .L802813E4
/* 7E1B20 80280CA0 0000102D */   daddu    $v0, $zero, $zero
/* 7E1B24 80280CA4 080A0506 */  j         .L80281418
/* 7E1B28 80280CA8 00000000 */   nop
.L80280CAC:
/* 7E1B2C 80280CAC 24020015 */  addiu     $v0, $zero, 0x15
/* 7E1B30 80280CB0 106200A0 */  beq       $v1, $v0, .L80280F34
/* 7E1B34 80280CB4 2402001F */   addiu    $v0, $zero, 0x1F
/* 7E1B38 80280CB8 106200C5 */  beq       $v1, $v0, .L80280FD0
/* 7E1B3C 80280CBC 0000102D */   daddu    $v0, $zero, $zero
/* 7E1B40 80280CC0 080A0506 */  j         .L80281418
/* 7E1B44 80280CC4 00000000 */   nop
.L80280CC8:
/* 7E1B48 80280CC8 24020047 */  addiu     $v0, $zero, 0x47
/* 7E1B4C 80280CCC 1062016F */  beq       $v1, $v0, .L8028128C
/* 7E1B50 80280CD0 28620048 */   slti     $v0, $v1, 0x48
/* 7E1B54 80280CD4 10400012 */  beqz      $v0, D_80280D20
/* 7E1B58 80280CD8 24020033 */   addiu    $v0, $zero, 0x33
/* 7E1B5C 80280CDC 10620117 */  beq       $v1, $v0, .L8028113C
BattleCam_IsFrozen:
/* 7E1B60 80280CE0 28620034 */   slti     $v0, $v1, 0x34
BattleCam_CurrentPresetID:
/* 7E1B64 80280CE4 10400007 */  beqz      $v0, D_80280D04
CamPreset_B:
/* 7E1B68 80280CE8 24020029 */   addiu    $v0, $zero, 0x29
/* 7E1B6C 80280CEC 10620027 */  beq       $v1, $v0, .L80280D8C
/* 7E1B70 80280CF0 2402002A */   addiu    $v0, $zero, 0x2A
/* 7E1B74 80280CF4 106201B3 */  beq       $v1, $v0, .L802813C4
/* 7E1B78 80280CF8 0000102D */   daddu    $v0, $zero, $zero
/* 7E1B7C 80280CFC 080A0506 */  j         .L80281418
/* 7E1B80 80280D00 00000000 */   nop
D_80280D04:
/* 7E1B84 80280D04 24020034 */  addiu     $v0, $zero, 0x34
/* 7E1B88 80280D08 10620133 */  beq       $v1, $v0, .L802811D8
/* 7E1B8C 80280D0C 24020035 */   addiu    $v0, $zero, 0x35
/* 7E1B90 80280D10 1062013B */  beq       $v1, $v0, .L80281200
/* 7E1B94 80280D14 0000102D */   daddu    $v0, $zero, $zero
/* 7E1B98 80280D18 080A0506 */  j         .L80281418
/* 7E1B9C 80280D1C 00000000 */   nop
D_80280D20:
/* 7E1BA0 80280D20 240200C9 */  addiu     $v0, $zero, 0xC9
/* 7E1BA4 80280D24 10620072 */  beq       $v1, $v0, .L80280EF0
/* 7E1BA8 80280D28 286200CA */   slti     $v0, $v1, 0xCA
/* 7E1BAC 80280D2C 10400007 */  beqz      $v0, .L80280D4C
/* 7E1BB0 80280D30 24020048 */   addiu    $v0, $zero, 0x48
/* 7E1BB4 80280D34 1062017E */  beq       $v1, $v0, .L80281330
/* 7E1BB8 80280D38 24020049 */   addiu    $v0, $zero, 0x49
CamPreset_G:
/* 7E1BBC 80280D3C 1062018C */  beq       $v1, $v0, .L80281370
/* 7E1BC0 80280D40 0000102D */   daddu    $v0, $zero, $zero
/* 7E1BC4 80280D44 080A0506 */  j         .L80281418
/* 7E1BC8 80280D48 00000000 */   nop
.L80280D4C:
/* 7E1BCC 80280D4C 240201F5 */  addiu     $v0, $zero, 0x1F5
/* 7E1BD0 80280D50 106200EA */  beq       $v1, $v0, .L802810FC
/* 7E1BD4 80280D54 240202BD */   addiu    $v0, $zero, 0x2BD
CamPreset_I:
/* 7E1BD8 80280D58 10620138 */  beq       $v1, $v0, .L8028123C
/* 7E1BDC 80280D5C 0000102D */   daddu    $v0, $zero, $zero
/* 7E1BE0 80280D60 080A0506 */  j         .L80281418
/* 7E1BE4 80280D64 00000000 */   nop
.L80280D68:
/* 7E1BE8 80280D68 0C0B1059 */  jal       does_script_exist
/* 7E1BEC 80280D6C 8E240074 */   lw       $a0, 0x74($s1)
/* 7E1BF0 80280D70 144001A9 */  bnez      $v0, .L80281418
CamPreset_H:
/* 7E1BF4 80280D74 0000102D */   daddu    $v0, $zero, $zero
/* 7E1BF8 80280D78 3C04001E */  lui       $a0, (0x1E0003 >> 16)
/* 7E1BFC 80280D7C 34840003 */  ori       $a0, $a0, (0x1E0003 & 0xFFFF)
/* 7E1C00 80280D80 26250078 */  addiu     $a1, $s1, 0x78
/* 7E1C04 80280D84 080A04D5 */  j         .L80281354
/* 7E1C08 80280D88 24020029 */   addiu    $v0, $zero, 0x29
.L80280D8C:
/* 7E1C0C 80280D8C 8E240078 */  lw        $a0, 0x78($s1)
CamPreset_N:
/* 7E1C10 80280D90 24020001 */  addiu     $v0, $zero, 0x1
/* 7E1C14 80280D94 148201A0 */  bne       $a0, $v0, .L80281418
/* 7E1C18 80280D98 0000102D */   daddu    $v0, $zero, $zero
/* 7E1C1C 80280D9C 3C028028 */  lui       $v0, %hi(D_80286538)
/* 7E1C20 80280DA0 8C426538 */  lw        $v0, %lo(D_80286538)($v0)
/* 7E1C24 80280DA4 904304E8 */  lbu       $v1, 0x4E8($v0)
/* 7E1C28 80280DA8 10640012 */  beq       $v1, $a0, .L80280DF4
EVS_BattleCam_Default:
/* 7E1C2C 80280DAC 28620002 */   slti     $v0, $v1, 0x2
/* 7E1C30 80280DB0 10400005 */  beqz      $v0, D_80280DC8
/* 7E1C34 80280DB4 24020002 */   addiu    $v0, $zero, 0x2
/* 7E1C38 80280DB8 10600009 */  beqz      $v1, .L80280DE0
/* 7E1C3C 80280DBC 00000000 */   nop
/* 7E1C40 80280DC0 080A03B6 */  j         .L80280ED8
/* 7E1C44 80280DC4 00000000 */   nop
D_80280DC8:
/* 7E1C48 80280DC8 10620018 */  beq       $v1, $v0, .L80280E2C
/* 7E1C4C 80280DCC 24020003 */   addiu    $v0, $zero, 0x3
/* 7E1C50 80280DD0 1062002D */  beq       $v1, $v0, .L80280E88
/* 7E1C54 80280DD4 00000000 */   nop
/* 7E1C58 80280DD8 080A03B6 */  j         .L80280ED8
/* 7E1C5C 80280DDC 00000000 */   nop
.L80280DE0:
/* 7E1C60 80280DE0 0C0A005F */  jal       shop_owner_continue_speech
CamPreset_E:
/* 7E1C64 80280DE4 24040005 */   addiu    $a0, $zero, 0x5
/* 7E1C68 80280DE8 AE220074 */  sw        $v0, 0x74($s1)
/* 7E1C6C 80280DEC 080A0505 */  j         .L80281414
/* 7E1C70 80280DF0 AE200070 */   sw       $zero, 0x70($s1)
.L80280DF4:
/* 7E1C74 80280DF4 0C039D7B */  jal       get_item_count
/* 7E1C78 80280DF8 00000000 */   nop
/* 7E1C7C 80280DFC 14400005 */  bnez      $v0, .L80280E14
CamPreset_J:
/* 7E1C80 80280E00 00000000 */   nop
/* 7E1C84 80280E04 0C0A005F */  jal       shop_owner_continue_speech
/* 7E1C88 80280E08 24040006 */   addiu    $a0, $zero, 0x6
/* 7E1C8C 80280E0C 080A04EE */  j         .L802813B8
/* 7E1C90 80280E10 AE220074 */   sw       $v0, 0x74($s1)
.L80280E14:
/* 7E1C94 80280E14 0C0A005F */  jal       shop_owner_continue_speech
/* 7E1C98 80280E18 24040007 */   addiu    $a0, $zero, 0x7
CamPreset_K:
/* 7E1C9C 80280E1C AE220074 */  sw        $v0, 0x74($s1)
/* 7E1CA0 80280E20 240200C9 */  addiu     $v0, $zero, 0xC9
/* 7E1CA4 80280E24 080A0505 */  j         .L80281414
/* 7E1CA8 80280E28 AE220070 */   sw       $v0, 0x70($s1)
.L80280E2C:
/* 7E1CAC 80280E2C 0C039D7B */  jal       get_item_count
/* 7E1CB0 80280E30 00000000 */   nop
/* 7E1CB4 80280E34 14400005 */  bnez      $v0, .L80280E4C
CamPreset_L:
/* 7E1CB8 80280E38 00000000 */   nop
/* 7E1CBC 80280E3C 0C0A005F */  jal       shop_owner_continue_speech
/* 7E1CC0 80280E40 2404000C */   addiu    $a0, $zero, 0xC
/* 7E1CC4 80280E44 080A04EE */  j         .L802813B8
/* 7E1CC8 80280E48 AE220074 */   sw       $v0, 0x74($s1)
.L80280E4C:
/* 7E1CCC 80280E4C 0C039E12 */  jal       get_stored_empty_count
/* 7E1CD0 80280E50 00000000 */   nop
CamPreset_A:
/* 7E1CD4 80280E54 14400005 */  bnez      $v0, .L80280E6C
/* 7E1CD8 80280E58 00000000 */   nop
/* 7E1CDC 80280E5C 0C0A005F */  jal       shop_owner_continue_speech
/* 7E1CE0 80280E60 2404000D */   addiu    $a0, $zero, 0xD
/* 7E1CE4 80280E64 080A04EE */  j         .L802813B8
/* 7E1CE8 80280E68 AE220074 */   sw       $v0, 0x74($s1)
.L80280E6C:
/* 7E1CEC 80280E6C 0C039E12 */  jal       get_stored_empty_count
/* 7E1CF0 80280E70 00000000 */   nop
/* 7E1CF4 80280E74 2404000E */  addiu     $a0, $zero, 0xE
/* 7E1CF8 80280E78 0C0A0082 */  jal       shop_owner_continue_speech_with_quantity
/* 7E1CFC 80280E7C 0040282D */   daddu    $a1, $v0, $zero
/* 7E1D00 80280E80 080A048C */  j         .L80281230
/* 7E1D04 80280E84 AE220074 */   sw       $v0, 0x74($s1)
.L80280E88:
/* 7E1D08 80280E88 0C039E05 */  jal       get_stored_count
/* 7E1D0C 80280E8C 00000000 */   nop
/* 7E1D10 80280E90 14400005 */  bnez      $v0, .L80280EA8
/* 7E1D14 80280E94 00000000 */   nop
/* 7E1D18 80280E98 0C0A005F */  jal       shop_owner_continue_speech
/* 7E1D1C 80280E9C 24040011 */   addiu    $a0, $zero, 0x11
/* 7E1D20 80280EA0 080A04EE */  j         .L802813B8
/* 7E1D24 80280EA4 AE220074 */   sw       $v0, 0x74($s1)
.L80280EA8:
/* 7E1D28 80280EA8 0C039D88 */  jal       get_item_empty_count
/* 7E1D2C 80280EAC 00000000 */   nop
/* 7E1D30 80280EB0 14400005 */  bnez      $v0, .L80280EC8
/* 7E1D34 80280EB4 00000000 */   nop
EVS_OnBattleInit:
/* 7E1D38 80280EB8 0C0A005F */  jal       shop_owner_continue_speech
/* 7E1D3C 80280EBC 24040012 */   addiu    $a0, $zero, 0x12
/* 7E1D40 80280EC0 080A04EE */  j         .L802813B8
/* 7E1D44 80280EC4 AE220074 */   sw       $v0, 0x74($s1)
.L80280EC8:
/* 7E1D48 80280EC8 0C0A005F */  jal       shop_owner_continue_speech
/* 7E1D4C 80280ECC 24040013 */   addiu    $a0, $zero, 0x13
/* 7E1D50 80280ED0 080A04E8 */  j         .L802813A0
/* 7E1D54 80280ED4 AE220074 */   sw       $v0, 0x74($s1)
.L80280ED8:
/* 7E1D58 80280ED8 0C0A00D7 */  jal       shop_owner_end_speech
/* 7E1D5C 80280EDC 00000000 */   nop
/* 7E1D60 80280EE0 AE220074 */  sw        $v0, 0x74($s1)
/* 7E1D64 80280EE4 2402002A */  addiu     $v0, $zero, 0x2A
/* 7E1D68 80280EE8 080A0505 */  j         .L80281414
/* 7E1D6C 80280EEC AE220070 */   sw       $v0, 0x70($s1)
.L80280EF0:
/* 7E1D70 80280EF0 8E240074 */  lw        $a0, 0x74($s1)
/* 7E1D74 80280EF4 0C0B1059 */  jal       does_script_exist
/* 7E1D78 80280EF8 00000000 */   nop
/* 7E1D7C 80280EFC 14400146 */  bnez      $v0, .L80281418
/* 7E1D80 80280F00 0000102D */   daddu    $v0, $zero, $zero
/* 7E1D84 80280F04 0C0A0255 */  jal       shop_open_item_select_popup
/* 7E1D88 80280F08 0000202D */   daddu    $a0, $zero, $zero
/* 7E1D8C 80280F0C 24020002 */  addiu     $v0, $zero, 0x2
/* 7E1D90 80280F10 080A0505 */  j         .L80281414
/* 7E1D94 80280F14 AE220070 */   sw       $v0, 0x70($s1)
.L80280F18:
/* 7E1D98 80280F18 0C0A02B1 */  jal       shop_update_item_select_popup
/* 7E1D9C 80280F1C 2604000C */   addiu    $a0, $s0, 0xC
/* 7E1DA0 80280F20 24030001 */  addiu     $v1, $zero, 0x1
/* 7E1DA4 80280F24 1443013C */  bne       $v0, $v1, .L80281418
/* 7E1DA8 80280F28 0000102D */   daddu    $v0, $zero, $zero
/* 7E1DAC 80280F2C 080A049F */  j         .L8028127C
/* 7E1DB0 80280F30 24020015 */   addiu    $v0, $zero, 0x15
.L80280F34:
/* 7E1DB4 80280F34 8E220074 */  lw        $v0, 0x74($s1)
/* 7E1DB8 80280F38 1C4000D7 */  bgtz      $v0, .L80281298
/* 7E1DBC 80280F3C 2442FFFF */   addiu    $v0, $v0, -0x1
/* 7E1DC0 80280F40 0C0A02D1 */  jal       shop_close_item_select_popup
/* 7E1DC4 80280F44 00000000 */   nop
/* 7E1DC8 80280F48 8E02000C */  lw        $v0, 0xC($s0)
/* 7E1DCC 80280F4C 04400012 */  bltz      $v0, .L80280F98
/* 7E1DD0 80280F50 00021040 */   sll      $v0, $v0, 1
/* 7E1DD4 80280F54 00521021 */  addu      $v0, $v0, $s2
/* 7E1DD8 80280F58 844401B4 */  lh        $a0, 0x1B4($v0)
/* 7E1DDC 80280F5C 3C028008 */  lui       $v0, %hi(gItemTable)
/* 7E1DE0 80280F60 244278E0 */  addiu     $v0, $v0, %lo(gItemTable)
/* 7E1DE4 80280F64 00048140 */  sll       $s0, $a0, 5
/* 7E1DE8 80280F68 0C0A02DE */  jal       shop_get_sell_price
/* 7E1DEC 80280F6C 02028021 */   addu     $s0, $s0, $v0
/* 7E1DF0 80280F70 24040008 */  addiu     $a0, $zero, 0x8
/* 7E1DF4 80280F74 0040302D */  daddu     $a2, $v0, $zero
/* 7E1DF8 80280F78 8E050000 */  lw        $a1, 0x0($s0)
/* 7E1DFC 80280F7C 0C0A0022 */  jal       shop_owner_buy_dialog
/* 7E1E00 80280F80 2407FFFF */   addiu    $a3, $zero, -0x1
/* 7E1E04 80280F84 0C03A546 */  jal       show_coin_counter
/* 7E1E08 80280F88 AE220074 */   sw       $v0, 0x74($s1)
/* 7E1E0C 80280F8C 24020003 */  addiu     $v0, $zero, 0x3
/* 7E1E10 80280F90 080A0505 */  j         .L80281414
/* 7E1E14 80280F94 AE220070 */   sw       $v0, 0x70($s1)
.L80280F98:
/* 7E1E18 80280F98 0C0A0000 */  jal       shop_owner_begin_speech
/* 7E1E1C 80280F9C 24040016 */   addiu    $a0, $zero, 0x16
/* 7E1E20 80280FA0 080A04EE */  j         .L802813B8
/* 7E1E24 80280FA4 AE220074 */   sw       $v0, 0x74($s1)
.L80280FA8:
/* 7E1E28 80280FA8 8E240074 */  lw        $a0, 0x74($s1)
/* 7E1E2C 80280FAC 0C0B1059 */  jal       does_script_exist
/* 7E1E30 80280FB0 00000000 */   nop
/* 7E1E34 80280FB4 14400118 */  bnez      $v0, .L80281418
/* 7E1E38 80280FB8 0000102D */   daddu    $v0, $zero, $zero
/* 7E1E3C 80280FBC 3C04001E */  lui       $a0, (0x1E0002 >> 16)
D_80280FC0:
/* 7E1E40 80280FC0 34840002 */  ori       $a0, $a0, (0x1E0002 & 0xFFFF)
/* 7E1E44 80280FC4 26250078 */  addiu     $a1, $s1, 0x78
/* 7E1E48 80280FC8 080A04D5 */  j         .L80281354
/* 7E1E4C 80280FCC 2402001F */   addiu    $v0, $zero, 0x1F
.L80280FD0:
/* 7E1E50 80280FD0 8E230078 */  lw        $v1, 0x78($s1)
/* 7E1E54 80280FD4 24020001 */  addiu     $v0, $zero, 0x1
/* 7E1E58 80280FD8 1462010F */  bne       $v1, $v0, .L80281418
/* 7E1E5C 80280FDC 0000102D */   daddu    $v0, $zero, $zero
/* 7E1E60 80280FE0 3C028028 */  lui       $v0, %hi(D_80286538)
/* 7E1E64 80280FE4 8C426538 */  lw        $v0, %lo(D_80286538)($v0)
/* 7E1E68 80280FE8 904204E8 */  lbu       $v0, 0x4E8($v0)
/* 7E1E6C 80280FEC 1440001D */  bnez      $v0, .L80281064
/* 7E1E70 80280FF0 00000000 */   nop
/* 7E1E74 80280FF4 8E02000C */  lw        $v0, 0xC($s0)
/* 7E1E78 80280FF8 00021040 */  sll       $v0, $v0, 1
/* 7E1E7C 80280FFC 00521021 */  addu      $v0, $v0, $s2
/* 7E1E80 80281000 0C0A02DE */  jal       shop_get_sell_price
/* 7E1E84 80281004 844401B4 */   lh       $a0, 0x1B4($v0)
/* 7E1E88 80281008 0C03A830 */  jal       add_coins
/* 7E1E8C 8028100C 0040202D */   daddu    $a0, $v0, $zero
/* 7E1E90 80281010 8E02000C */  lw        $v0, 0xC($s0)
/* 7E1E94 80281014 00021040 */  sll       $v0, $v0, 1
/* 7E1E98 80281018 00521021 */  addu      $v0, $v0, $s2
/* 7E1E9C 8028101C 0C039D7B */  jal       get_item_count
/* 7E1EA0 80281020 A44001B4 */   sh       $zero, 0x1B4($v0)
/* 7E1EA4 80281024 14400009 */  bnez      $v0, .L8028104C
/* 7E1EA8 80281028 00000000 */   nop
/* 7E1EAC 8028102C 0C0A00B4 */  jal       shop_owner_reset_speech
/* 7E1EB0 80281030 2404000B */   addiu    $a0, $zero, 0xB
/* 7E1EB4 80281034 AE220074 */  sw        $v0, 0x74($s1)
/* 7E1EB8 80281038 24020009 */  addiu     $v0, $zero, 0x9
/* 7E1EBC 8028103C 0C03A5A6 */  jal       hide_coin_counter
/* 7E1EC0 80281040 AE220070 */   sw       $v0, 0x70($s1)
/* 7E1EC4 80281044 080A0506 */  j         .L80281418
/* 7E1EC8 80281048 0000102D */   daddu    $v0, $zero, $zero
.L8028104C:
/* 7E1ECC 8028104C 0C0A00B4 */  jal       shop_owner_reset_speech
/* 7E1ED0 80281050 2404000A */   addiu    $a0, $zero, 0xA
/* 7E1ED4 80281054 AE220074 */  sw        $v0, 0x74($s1)
/* 7E1ED8 80281058 24020020 */  addiu     $v0, $zero, 0x20
/* 7E1EDC 8028105C 080A0505 */  j         .L80281414
/* 7E1EE0 80281060 AE220070 */   sw       $v0, 0x70($s1)
.L80281064:
/* 7E1EE4 80281064 0C0A00B4 */  jal       shop_owner_reset_speech
/* 7E1EE8 80281068 24040009 */   addiu    $a0, $zero, 0x9
/* 7E1EEC 8028106C AE220074 */  sw        $v0, 0x74($s1)
/* 7E1EF0 80281070 0C03A5A6 */  jal       hide_coin_counter
/* 7E1EF4 80281074 AE330070 */   sw       $s3, 0x70($s1)
/* 7E1EF8 80281078 080A0506 */  j         .L80281418
/* 7E1EFC 8028107C 0000102D */   daddu    $v0, $zero, $zero
.L80281080:
/* 7E1F00 80281080 8E240074 */  lw        $a0, 0x74($s1)
/* 7E1F04 80281084 0C0B1059 */  jal       does_script_exist
/* 7E1F08 80281088 00000000 */   nop
/* 7E1F0C 8028108C 144000E2 */  bnez      $v0, .L80281418
/* 7E1F10 80281090 0000102D */   daddu    $v0, $zero, $zero
/* 7E1F14 80281094 3C04001E */  lui       $a0, (0x1E0004 >> 16)
/* 7E1F18 80281098 34840004 */  ori       $a0, $a0, (0x1E0004 & 0xFFFF)
/* 7E1F1C 8028109C 26250078 */  addiu     $a1, $s1, 0x78
/* 7E1F20 802810A0 080A04D5 */  j         .L80281354
/* 7E1F24 802810A4 2402000C */   addiu    $v0, $zero, 0xC
.L802810A8:
/* 7E1F28 802810A8 8E230078 */  lw        $v1, 0x78($s1)
/* 7E1F2C 802810AC 24020001 */  addiu     $v0, $zero, 0x1
/* 7E1F30 802810B0 146200D9 */  bne       $v1, $v0, .L80281418
/* 7E1F34 802810B4 0000102D */   daddu    $v0, $zero, $zero
/* 7E1F38 802810B8 3C028028 */  lui       $v0, %hi(D_80286538)
/* 7E1F3C 802810BC 8C426538 */  lw        $v0, %lo(D_80286538)($v0)
/* 7E1F40 802810C0 904204E8 */  lbu       $v0, 0x4E8($v0)
/* 7E1F44 802810C4 14400009 */  bnez      $v0, .L802810EC
/* 7E1F48 802810C8 00000000 */   nop
/* 7E1F4C 802810CC 0C0A00D7 */  jal       shop_owner_end_speech
/* 7E1F50 802810D0 00000000 */   nop
/* 7E1F54 802810D4 AE220074 */  sw        $v0, 0x74($s1)
/* 7E1F58 802810D8 240200C9 */  addiu     $v0, $zero, 0xC9
/* 7E1F5C 802810DC 0C03A5B2 */  jal       hide_coin_counter_immediately
/* 7E1F60 802810E0 AE220070 */   sw       $v0, 0x70($s1)
/* 7E1F64 802810E4 080A0506 */  j         .L80281418
/* 7E1F68 802810E8 0000102D */   daddu    $v0, $zero, $zero
.L802810EC:
/* 7E1F6C 802810EC 0C03A5B2 */  jal       hide_coin_counter_immediately
/* 7E1F70 802810F0 00000000 */   nop
/* 7E1F74 802810F4 080A04EB */  j         .L802813AC
/* 7E1F78 802810F8 00000000 */   nop
.L802810FC:
/* 7E1F7C 802810FC 0C0B1059 */  jal       does_script_exist
/* 7E1F80 80281100 8E240074 */   lw       $a0, 0x74($s1)
bActorNames:
/* 7E1F84 80281104 144000C4 */  bnez      $v0, .L80281418
/* 7E1F88 80281108 0000102D */   daddu    $v0, $zero, $zero
/* 7E1F8C 8028110C 0C0A0255 */  jal       shop_open_item_select_popup
/* 7E1F90 80281110 24040001 */   addiu    $a0, $zero, 0x1
/* 7E1F94 80281114 24020005 */  addiu     $v0, $zero, 0x5
/* 7E1F98 80281118 080A0505 */  j         .L80281414
/* 7E1F9C 8028111C AE220070 */   sw       $v0, 0x70($s1)
.L80281120:
/* 7E1FA0 80281120 0C0A02B1 */  jal       shop_update_item_select_popup
/* 7E1FA4 80281124 2604000C */   addiu    $a0, $s0, 0xC
/* 7E1FA8 80281128 24030001 */  addiu     $v1, $zero, 0x1
/* 7E1FAC 8028112C 144300BA */  bne       $v0, $v1, .L80281418
/* 7E1FB0 80281130 0000102D */   daddu    $v0, $zero, $zero
/* 7E1FB4 80281134 080A049F */  j         .L8028127C
/* 7E1FB8 80281138 24020033 */   addiu    $v0, $zero, 0x33
.L8028113C:
/* 7E1FBC 8028113C 8E220074 */  lw        $v0, 0x74($s1)
/* 7E1FC0 80281140 1C400055 */  bgtz      $v0, .L80281298
/* 7E1FC4 80281144 2442FFFF */   addiu    $v0, $v0, -0x1
/* 7E1FC8 80281148 0C0A02D1 */  jal       shop_close_item_select_popup
/* 7E1FCC 8028114C 00000000 */   nop
/* 7E1FD0 80281150 8E02000C */  lw        $v0, 0xC($s0)
/* 7E1FD4 80281154 0440001C */  bltz      $v0, .L802811C8
/* 7E1FD8 80281158 00021040 */   sll      $v0, $v0, 1
/* 7E1FDC 8028115C 00521021 */  addu      $v0, $v0, $s2
/* 7E1FE0 80281160 0C039DF1 */  jal       store_item
/* 7E1FE4 80281164 844401B4 */   lh       $a0, 0x1B4($v0)
/* 7E1FE8 80281168 04400005 */  bltz      $v0, .L80281180
/* 7E1FEC 8028116C 00000000 */   nop
/* 7E1FF0 80281170 8E02000C */  lw        $v0, 0xC($s0)
/* 7E1FF4 80281174 00021040 */  sll       $v0, $v0, 1
/* 7E1FF8 80281178 00521021 */  addu      $v0, $v0, $s2
/* 7E1FFC 8028117C A44001B4 */  sh        $zero, 0x1B4($v0)
.L80281180:
/* 7E2000 80281180 0C039D7B */  jal       get_item_count
/* 7E2004 80281184 00000000 */   nop
/* 7E2008 80281188 10400005 */  beqz      $v0, .L802811A0
/* 7E200C 8028118C 00000000 */   nop
/* 7E2010 80281190 0C039E12 */  jal       get_stored_empty_count
/* 7E2014 80281194 00000000 */   nop
/* 7E2018 80281198 14400005 */  bnez      $v0, .L802811B0
/* 7E201C 8028119C 00000000 */   nop
.L802811A0:
/* 7E2020 802811A0 0C0A0000 */  jal       shop_owner_begin_speech
/* 7E2024 802811A4 2404000F */   addiu    $a0, $zero, 0xF
/* 7E2028 802811A8 080A04EE */  j         .L802813B8
/* 7E202C 802811AC AE220074 */   sw       $v0, 0x74($s1)
.L802811B0:
/* 7E2030 802811B0 0C0A0000 */  jal       shop_owner_begin_speech
/* 7E2034 802811B4 24040010 */   addiu    $a0, $zero, 0x10
/* 7E2038 802811B8 AE220074 */  sw        $v0, 0x74($s1)
/* 7E203C 802811BC 24020034 */  addiu     $v0, $zero, 0x34
/* 7E2040 802811C0 080A0505 */  j         .L80281414
/* 7E2044 802811C4 AE220070 */   sw       $v0, 0x70($s1)
.L802811C8:
/* 7E2048 802811C8 0C0A0000 */  jal       shop_owner_begin_speech
/* 7E204C 802811CC 24040016 */   addiu    $a0, $zero, 0x16
/* 7E2050 802811D0 080A04EE */  j         .L802813B8
/* 7E2054 802811D4 AE220074 */   sw       $v0, 0x74($s1)
.L802811D8:
/* 7E2058 802811D8 8E240074 */  lw        $a0, 0x74($s1)
/* 7E205C 802811DC 0C0B1059 */  jal       does_script_exist
/* 7E2060 802811E0 00000000 */   nop
/* 7E2064 802811E4 1440008C */  bnez      $v0, .L80281418
/* 7E2068 802811E8 0000102D */   daddu    $v0, $zero, $zero
/* 7E206C 802811EC 3C04001E */  lui       $a0, (0x1E0005 >> 16)
/* 7E2070 802811F0 34840005 */  ori       $a0, $a0, (0x1E0005 & 0xFFFF)
/* 7E2074 802811F4 26250078 */  addiu     $a1, $s1, 0x78
/* 7E2078 802811F8 080A04D5 */  j         .L80281354
/* 7E207C 802811FC 24020035 */   addiu    $v0, $zero, 0x35
.L80281200:
/* 7E2080 80281200 8E230078 */  lw        $v1, 0x78($s1)
/* 7E2084 80281204 24020001 */  addiu     $v0, $zero, 0x1
/* 7E2088 80281208 14620083 */  bne       $v1, $v0, .L80281418
/* 7E208C 8028120C 0000102D */   daddu    $v0, $zero, $zero
/* 7E2090 80281210 3C028028 */  lui       $v0, %hi(D_80286538)
/* 7E2094 80281214 8C426538 */  lw        $v0, %lo(D_80286538)($v0)
/* 7E2098 80281218 904204E8 */  lbu       $v0, 0x4E8($v0)
/* 7E209C 8028121C 14400063 */  bnez      $v0, .L802813AC
/* 7E20A0 80281220 00000000 */   nop
/* 7E20A4 80281224 0C0A00D7 */  jal       shop_owner_end_speech
/* 7E20A8 80281228 00000000 */   nop
/* 7E20AC 8028122C AE220074 */  sw        $v0, 0x74($s1)
.L80281230:
/* 7E20B0 80281230 240201F5 */  addiu     $v0, $zero, 0x1F5
/* 7E20B4 80281234 080A0505 */  j         .L80281414
/* 7E20B8 80281238 AE220070 */   sw       $v0, 0x70($s1)
.L8028123C:
/* 7E20BC 8028123C 8E240074 */  lw        $a0, 0x74($s1)
/* 7E20C0 80281240 0C0B1059 */  jal       does_script_exist
/* 7E20C4 80281244 00000000 */   nop
/* 7E20C8 80281248 14400073 */  bnez      $v0, .L80281418
/* 7E20CC 8028124C 0000102D */   daddu    $v0, $zero, $zero
/* 7E20D0 80281250 0C0A0255 */  jal       shop_open_item_select_popup
/* 7E20D4 80281254 24040002 */   addiu    $a0, $zero, 0x2
/* 7E20D8 80281258 24020007 */  addiu     $v0, $zero, 0x7
/* 7E20DC 8028125C 080A0505 */  j         .L80281414
/* 7E20E0 80281260 AE220070 */   sw       $v0, 0x70($s1)
.L80281264:
/* 7E20E4 80281264 0C0A02B1 */  jal       shop_update_item_select_popup
/* 7E20E8 80281268 2604000C */   addiu    $a0, $s0, 0xC
/* 7E20EC 8028126C 24030001 */  addiu     $v1, $zero, 0x1
/* 7E20F0 80281270 14430069 */  bne       $v0, $v1, .L80281418
/* 7E20F4 80281274 0000102D */   daddu    $v0, $zero, $zero
/* 7E20F8 80281278 24020047 */  addiu     $v0, $zero, 0x47
.L8028127C:
/* 7E20FC 8028127C AE220070 */  sw        $v0, 0x70($s1)
/* 7E2100 80281280 2402000F */  addiu     $v0, $zero, 0xF
/* 7E2104 80281284 080A0505 */  j         .L80281414
/* 7E2108 80281288 AE220074 */   sw       $v0, 0x74($s1)
.L8028128C:
/* 7E210C 8028128C 8E220074 */  lw        $v0, 0x74($s1)
/* 7E2110 80281290 18400003 */  blez      $v0, .L802812A0
/* 7E2114 80281294 2442FFFF */   addiu    $v0, $v0, -0x1
.L80281298:
/* 7E2118 80281298 080A0505 */  j         .L80281414
/* 7E211C 8028129C AE220074 */   sw       $v0, 0x74($s1)
.L802812A0:
/* 7E2120 802812A0 0C0A02D1 */  jal       shop_close_item_select_popup
/* 7E2124 802812A4 00000000 */   nop
/* 7E2128 802812A8 8E02000C */  lw        $v0, 0xC($s0)
/* 7E212C 802812AC 0440001C */  bltz      $v0, .L80281320
/* 7E2130 802812B0 00021040 */   sll      $v0, $v0, 1
/* 7E2134 802812B4 00521021 */  addu      $v0, $v0, $s2
/* 7E2138 802812B8 0C039D5D */  jal       add_item
/* 7E213C 802812BC 844401C8 */   lh       $a0, 0x1C8($v0)
/* 7E2140 802812C0 04400005 */  bltz      $v0, .L802812D8
/* 7E2144 802812C4 00000000 */   nop
/* 7E2148 802812C8 8E02000C */  lw        $v0, 0xC($s0)
/* 7E214C 802812CC 00021040 */  sll       $v0, $v0, 1
/* 7E2150 802812D0 00521021 */  addu      $v0, $v0, $s2
/* 7E2154 802812D4 A44001C8 */  sh        $zero, 0x1C8($v0)
.L802812D8:
/* 7E2158 802812D8 0C039D88 */  jal       get_item_empty_count
/* 7E215C 802812DC 00000000 */   nop
/* 7E2160 802812E0 10400005 */  beqz      $v0, .L802812F8
/* 7E2164 802812E4 00000000 */   nop
/* 7E2168 802812E8 0C039E05 */  jal       get_stored_count
/* 7E216C 802812EC 00000000 */   nop
/* 7E2170 802812F0 14400005 */  bnez      $v0, .L80281308
/* 7E2174 802812F4 00000000 */   nop
.L802812F8:
/* 7E2178 802812F8 0C0A0000 */  jal       shop_owner_begin_speech
/* 7E217C 802812FC 24040014 */   addiu    $a0, $zero, 0x14
/* 7E2180 80281300 080A04EE */  j         .L802813B8
/* 7E2184 80281304 AE220074 */   sw       $v0, 0x74($s1)
.L80281308:
/* 7E2188 80281308 0C0A0000 */  jal       shop_owner_begin_speech
/* 7E218C 8028130C 24040015 */   addiu    $a0, $zero, 0x15
/* 7E2190 80281310 AE220074 */  sw        $v0, 0x74($s1)
/* 7E2194 80281314 24020048 */  addiu     $v0, $zero, 0x48
/* 7E2198 80281318 080A0505 */  j         .L80281414
/* 7E219C 8028131C AE220070 */   sw       $v0, 0x70($s1)
.L80281320:
/* 7E21A0 80281320 0C0A0000 */  jal       shop_owner_begin_speech
/* 7E21A4 80281324 24040016 */   addiu    $a0, $zero, 0x16
/* 7E21A8 80281328 080A04EE */  j         .L802813B8
/* 7E21AC 8028132C AE220074 */   sw       $v0, 0x74($s1)
.L80281330:
/* 7E21B0 80281330 8E240074 */  lw        $a0, 0x74($s1)
/* 7E21B4 80281334 0C0B1059 */  jal       does_script_exist
/* 7E21B8 80281338 00000000 */   nop
/* 7E21BC 8028133C 14400036 */  bnez      $v0, .L80281418
/* 7E21C0 80281340 0000102D */   daddu    $v0, $zero, $zero
/* 7E21C4 80281344 3C04001E */  lui       $a0, (0x1E0005 >> 16)
/* 7E21C8 80281348 34840005 */  ori       $a0, $a0, (0x1E0005 & 0xFFFF)
/* 7E21CC 8028134C 26250078 */  addiu     $a1, $s1, 0x78
/* 7E21D0 80281350 24020049 */  addiu     $v0, $zero, 0x49
.L80281354:
/* 7E21D4 80281354 AE220070 */  sw        $v0, 0x70($s1)
/* 7E21D8 80281358 0C049640 */  jal       msg_get_printer_for_msg
/* 7E21DC 8028135C AE200078 */   sw       $zero, 0x78($s1)
/* 7E21E0 80281360 3C018028 */  lui       $at, %hi(D_80286538)
/* 7E21E4 80281364 AC226538 */  sw        $v0, %lo(D_80286538)($at)
/* 7E21E8 80281368 080A0506 */  j         .L80281418
/* 7E21EC 8028136C 0000102D */   daddu    $v0, $zero, $zero
.L80281370:
/* 7E21F0 80281370 8E230078 */  lw        $v1, 0x78($s1)
/* 7E21F4 80281374 24020001 */  addiu     $v0, $zero, 0x1
/* 7E21F8 80281378 14620027 */  bne       $v1, $v0, .L80281418
/* 7E21FC 8028137C 0000102D */   daddu    $v0, $zero, $zero
/* 7E2200 80281380 3C028028 */  lui       $v0, %hi(D_80286538)
/* 7E2204 80281384 8C426538 */  lw        $v0, %lo(D_80286538)($v0)
/* 7E2208 80281388 904204E8 */  lbu       $v0, 0x4E8($v0)
/* 7E220C 8028138C 14400007 */  bnez      $v0, .L802813AC
/* 7E2210 80281390 00000000 */   nop
/* 7E2214 80281394 0C0A00D7 */  jal       shop_owner_end_speech
/* 7E2218 80281398 00000000 */   nop
/* 7E221C 8028139C AE220074 */  sw        $v0, 0x74($s1)
.L802813A0:
/* 7E2220 802813A0 240202BD */  addiu     $v0, $zero, 0x2BD
/* 7E2224 802813A4 080A0505 */  j         .L80281414
/* 7E2228 802813A8 AE220070 */   sw       $v0, 0x70($s1)
.L802813AC:
/* 7E222C 802813AC 0C0A00B4 */  jal       shop_owner_reset_speech
/* 7E2230 802813B0 24040016 */   addiu    $a0, $zero, 0x16
/* 7E2234 802813B4 AE220074 */  sw        $v0, 0x74($s1)
.L802813B8:
/* 7E2238 802813B8 24020009 */  addiu     $v0, $zero, 0x9
/* 7E223C 802813BC 080A0505 */  j         .L80281414
/* 7E2240 802813C0 AE220070 */   sw       $v0, 0x70($s1)
.L802813C4:
/* 7E2244 802813C4 8E240074 */  lw        $a0, 0x74($s1)
/* 7E2248 802813C8 0C0B1059 */  jal       does_script_exist
/* 7E224C 802813CC 00000000 */   nop
/* 7E2250 802813D0 14400011 */  bnez      $v0, .L80281418
/* 7E2254 802813D4 0000102D */   daddu    $v0, $zero, $zero
/* 7E2258 802813D8 2402000A */  addiu     $v0, $zero, 0xA
/* 7E225C 802813DC 080A0505 */  j         .L80281414
/* 7E2260 802813E0 AE220070 */   sw       $v0, 0x70($s1)
.L802813E4:
/* 7E2264 802813E4 8E020010 */  lw        $v0, 0x10($s0)
/* 7E2268 802813E8 10400006 */  beqz      $v0, .L80281404
/* 7E226C 802813EC 00000000 */   nop
/* 7E2270 802813F0 8C440014 */  lw        $a0, 0x14($v0)
/* 7E2274 802813F4 10800003 */  beqz      $a0, .L80281404
/* 7E2278 802813F8 24050001 */   addiu    $a1, $zero, 0x1
/* 7E227C 802813FC 0C0B0CF8 */  jal       start_script
/* 7E2280 80281400 0000302D */   daddu    $a2, $zero, $zero
.L80281404:
/* 7E2284 80281404 0C03A5E3 */  jal       open_status_bar_short
/* 7E2288 80281408 00000000 */   nop
/* 7E228C 8028140C 080A0506 */  j         .L80281418
/* 7E2290 80281410 24020001 */   addiu    $v0, $zero, 0x1
.L80281414:
/* 7E2294 80281414 0000102D */  daddu     $v0, $zero, $zero
.L80281418:
/* 7E2298 80281418 8FBF0020 */  lw        $ra, 0x20($sp)
/* 7E229C 8028141C 8FB3001C */  lw        $s3, 0x1C($sp)
/* 7E22A0 80281420 8FB20018 */  lw        $s2, 0x18($sp)
/* 7E22A4 80281424 8FB10014 */  lw        $s1, 0x14($sp)
/* 7E22A8 80281428 8FB00010 */  lw        $s0, 0x10($sp)
/* 7E22AC 8028142C 03E00008 */  jr        $ra
/* 7E22B0 80281430 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

API_CALLABLE(ShowShopOwnerDialog) {
    GameStatus* gameStatus = gGameStatusPtr;
    PlayerData* playerData = &gPlayerData;
    Shop* shop = gameStatus->mapShop;

    static MessagePrintState* D_80286538;

    enum {
        DIALOG_STATE_DONE_INSTRUCTIONS          = 0,
        DIALOG_STATE_AWAIT_GREETING             = 4,
        DIALOG_STATE_AWAIT_MAIN_MENU            = 41,
        DIALOG_STATE_CLOSED_MAIN_MENU           = 42,
        DIALOG_STATE_CLOSED_SUBMENU             = 9,
        DIALOG_STATE_DONE                       = 10,
        // selling
        DIALOG_STATE_INIT_SELL_CHOICE           = 201,
        DIALOG_STATE_AWAIT_SELL_CHOICE          = 2,
        DIALOG_STATE_INIT_SELL_CONFIRM          = 21,
        DIALOG_STATE_AWAIT_SELL_CONFIRM         = 3,
        DIALOG_STATE_HANDLE_SELL_CHOICE         = 31,
        DIALOG_STATE_INIT_SELL_MORE_CHOICE      = 32,
        DIALOG_STATE_AWAIT_SELL_MORE_CHOICE     = 12,
        // checking
        DIALOG_STATE_INIT_CHECK_CHOICE          = 501,
        DIALOG_STATE_AWAIT_CHECK_CHOICE         = 5,
        DIALOG_STATE_HANDLE_CHECK_CHOICE        = 51,
        DIALOG_STATE_INIT_CHECK_MORE_CHOICE     = 52,
        DIALOG_STATE_AWAIT_CHECK_MORE_CHOICE    = 53,
        // claiming
        DIALOG_STATE_INIT_CLAIM_CHOICE          = 701,
        DIALOG_STATE_AWAIT_CLAIM_CHOICE         = 7,
        DIALOG_STATE_HANDLE_CLAIM_CHOICE        = 71,
        DIALOG_STATE_INIT_CLAIM_MORE_CHOICE     = 72,
        DIALOG_STATE_AWAIT_CLAIM_MORE_CHOICE    = 73,
    };

    if (isInitialCall) {
        script->functionTemp[1] = shop_owner_begin_speech(SHOP_MSG_GREETING);
        script->functionTemp[0] = DIALOG_STATE_AWAIT_GREETING;
    }

    switch (script->functionTemp[0]) {
        case DIALOG_STATE_AWAIT_GREETING:
            if (!does_script_exist(script->functionTemp[1])) {
                script->functionTemp[0] = DIALOG_STATE_AWAIT_MAIN_MENU;
                script->functionTemp[2] = 0;
                D_80286538 = msg_get_printer_for_msg(MSG_Choice_0003, &script->functionTemp[2]);
            }
            break;
        case DIALOG_STATE_AWAIT_MAIN_MENU:
            if (script->functionTemp[2] == 1) {
                switch (D_80286538->currentOption) {
                    case 0:
                        script->functionTemp[1] = shop_owner_continue_speech(SHOP_MSG_INSTRUCTIONS);
                        script->functionTemp[0] = DIALOG_STATE_DONE_INSTRUCTIONS;
                        break;
                    case 1:
                        if (get_item_count() == 0) {
                            script->functionTemp[1] = shop_owner_continue_speech(SHOP_MSG_NOTHING_TO_SELL);
                            script->functionTemp[0] = DIALOG_STATE_CLOSED_SUBMENU;
                        } else {
                            script->functionTemp[1] = shop_owner_continue_speech(SHOP_MSG_SELL_WHICH);
                            script->functionTemp[0] = DIALOG_STATE_INIT_SELL_CHOICE;
                        }
                        break;
                    case 2:
                        if (get_item_count() == 0) {
                            script->functionTemp[1] = shop_owner_continue_speech(SHOP_MSG_NOTHING_TO_CHECK);
                            script->functionTemp[0] = DIALOG_STATE_CLOSED_SUBMENU;
                            break;
                        }
                        if (get_stored_empty_count() == 0) {
                            script->functionTemp[1] = shop_owner_continue_speech(SHOP_MSG_NO_CHECK_ROOM);
                            script->functionTemp[0] = DIALOG_STATE_CLOSED_SUBMENU;
                            break;
                        }
                        script->functionTemp[1] = shop_owner_continue_speech_with_quantity(SHOP_MSG_CHECK_WHICH, get_stored_empty_count());
                        script->functionTemp[0] = DIALOG_STATE_INIT_CHECK_CHOICE;
                        break;
                    case 3:
                        if (get_stored_count() == 0) {
                            script->functionTemp[1] = shop_owner_continue_speech(SHOP_MSG_NOTHING_TO_CLAIM);
                            script->functionTemp[0] = DIALOG_STATE_CLOSED_SUBMENU;
                            break;
                        }
                        if (get_item_empty_count() == 0) {
                            script->functionTemp[1] = shop_owner_continue_speech(SHOP_MSG_NO_CLAIM_ROOM);
                            script->functionTemp[0] = DIALOG_STATE_CLOSED_SUBMENU;
                            break;
                        }
                        script->functionTemp[1] = shop_owner_continue_speech(SHOP_MSG_CLAIM_WHICH);
                        script->functionTemp[0] = DIALOG_STATE_INIT_CLAIM_CHOICE;
                        break;
                    default:
                        script->functionTemp[1] = shop_owner_end_speech();
                        script->functionTemp[0] = DIALOG_STATE_CLOSED_MAIN_MENU;
                        break;
                }
            }
            break;
        case DIALOG_STATE_INIT_SELL_CHOICE:
            if (!does_script_exist(script->functionTemp[1])) {
                shop_open_item_select_popup(0);
                script->functionTemp[0] = DIALOG_STATE_AWAIT_SELL_CHOICE;
            }
            break;
        case DIALOG_STATE_AWAIT_SELL_CHOICE:
            if (shop_update_item_select_popup(&shop->selectedStoreItemSlot) == 1) {
                script->functionTemp[0] = DIALOG_STATE_INIT_SELL_CONFIRM;
                script->functionTemp[1] = 15;
            }
            break;
        case DIALOG_STATE_INIT_SELL_CONFIRM:
            if (script->functionTemp[1] > 0) {
                script->functionTemp[1]--;
                break;
            }
            shop_close_item_select_popup();
            if (shop->selectedStoreItemSlot >= 0) {
                ItemData* itemData = &gItemTable[playerData->invItems[shop->selectedStoreItemSlot]];
                script->functionTemp[1] = shop_owner_buy_dialog(SHOP_MSG_SELL_CONFIRM, itemData->nameMsg, shop_get_sell_price(playerData->invItems[shop->selectedStoreItemSlot]), -1);
                show_coin_counter();
                script->functionTemp[0] = DIALOG_STATE_AWAIT_SELL_CONFIRM;
            } else {
                script->functionTemp[1] = shop_owner_begin_speech(SHOP_MSG_FAREWELL);
                script->functionTemp[0] = DIALOG_STATE_CLOSED_SUBMENU;
            }
            break;
        case DIALOG_STATE_AWAIT_SELL_CONFIRM:
            if (!does_script_exist(script->functionTemp[1])) {
                script->functionTemp[0] = DIALOG_STATE_HANDLE_SELL_CHOICE;
                script->functionTemp[2] = 0;
                D_80286538 = msg_get_printer_for_msg(MSG_Choice_0002, &script->functionTemp[2]);
            }
            break;
        case DIALOG_STATE_HANDLE_SELL_CHOICE:
            if (script->functionTemp[2] == 1) {
                if (D_80286538->currentOption == 0) {
                    add_coins(shop_get_sell_price(playerData->invItems[shop->selectedStoreItemSlot]));
                    playerData->invItems[shop->selectedStoreItemSlot] = 0;
                    if (get_item_count() == 0) {
                        script->functionTemp[1] = shop_owner_reset_speech(SHOP_MSG_SELL_THANKS);
                        script->functionTemp[0] = DIALOG_STATE_CLOSED_SUBMENU;
                        hide_coin_counter();
                    } else {
                        script->functionTemp[1] = shop_owner_reset_speech(SHOP_MSG_SELL_MORE);
                        script->functionTemp[0] = DIALOG_STATE_INIT_SELL_MORE_CHOICE;
                    }
                } else {
                    script->functionTemp[1] = shop_owner_reset_speech(SHOP_MSG_SELL_CANCEL);
                    script->functionTemp[0] = DIALOG_STATE_INIT_SELL_MORE_CHOICE;
                    hide_coin_counter();
                }
            }
            break;
        case DIALOG_STATE_INIT_SELL_MORE_CHOICE:
            if (!does_script_exist(script->functionTemp[1])) {
                script->functionTemp[0] = DIALOG_STATE_AWAIT_SELL_MORE_CHOICE;
                script->functionTemp[2] = 0;
                D_80286538 = msg_get_printer_for_msg(MSG_Choice_0004, &script->functionTemp[2]);
            }
            break;
        case DIALOG_STATE_AWAIT_SELL_MORE_CHOICE:
            if (script->functionTemp[2] == 1) {
                if (D_80286538->currentOption == 0) {
                    script->functionTemp[1] = shop_owner_end_speech();
                    script->functionTemp[0] = DIALOG_STATE_INIT_SELL_CHOICE;
                    hide_coin_counter_immediately();
                } else {
                    hide_coin_counter_immediately();
                    script->functionTemp[1] = shop_owner_reset_speech(22);
                    script->functionTemp[0] = DIALOG_STATE_CLOSED_SUBMENU;
                }
            }
            break;
        case DIALOG_STATE_INIT_CHECK_CHOICE:
            if (does_script_exist(script->functionTemp[1]) == 0) {
                shop_open_item_select_popup(1);
                script->functionTemp[0] = DIALOG_STATE_AWAIT_CHECK_CHOICE;
            }
            break;
        case DIALOG_STATE_AWAIT_CHECK_CHOICE:
            if (shop_update_item_select_popup(&shop->selectedStoreItemSlot) == 1) {
                script->functionTemp[0] = DIALOG_STATE_HANDLE_CHECK_CHOICE;
                script->functionTemp[1] = 15;
            }
            break;
        case DIALOG_STATE_HANDLE_CHECK_CHOICE:
            if (script->functionTemp[1] > 0) {
                script->functionTemp[1]--;
                break;
            }
            shop_close_item_select_popup();
            if (shop->selectedStoreItemSlot >= 0) {
                if (store_item(playerData->invItems[shop->selectedStoreItemSlot]) >= 0) {
                    playerData->invItems[shop->selectedStoreItemSlot] = 0;
                }

                if ((get_item_count() == 0) || (get_stored_empty_count() == 0)) {
                    script->functionTemp[1] = shop_owner_begin_speech(SHOP_MSG_CHECK_ACCEPTED);
                    script->functionTemp[0] = DIALOG_STATE_CLOSED_SUBMENU;
                } else {
                    script->functionTemp[1] = shop_owner_begin_speech(SHOP_MSG_CHECK_MORE);
                    script->functionTemp[0] = DIALOG_STATE_INIT_CHECK_MORE_CHOICE;
                }
            } else {
                script->functionTemp[1] = shop_owner_begin_speech(SHOP_MSG_FAREWELL);
                script->functionTemp[0] = DIALOG_STATE_CLOSED_SUBMENU;
            }
            break;
        case DIALOG_STATE_INIT_CHECK_MORE_CHOICE:
            if (!does_script_exist(script->functionTemp[1])) {
                script->functionTemp[0] = DIALOG_STATE_AWAIT_CHECK_MORE_CHOICE;
                script->functionTemp[2] = 0;
                D_80286538 = msg_get_printer_for_msg(MSG_Choice_0005, &script->functionTemp[2]);
            }
            break;
        case DIALOG_STATE_AWAIT_CHECK_MORE_CHOICE:
            if (script->functionTemp[2] == 1) {
                if (D_80286538->currentOption == 0) {
                    script->functionTemp[1] = shop_owner_end_speech();
                    script->functionTemp[0] = DIALOG_STATE_INIT_CHECK_CHOICE;
                } else {
                    script->functionTemp[1] = shop_owner_reset_speech(SHOP_MSG_FAREWELL);
                    script->functionTemp[0] = DIALOG_STATE_CLOSED_SUBMENU;
                }
            }
            break;
        case DIALOG_STATE_INIT_CLAIM_CHOICE:
            if (!does_script_exist(script->functionTemp[1])) {
                shop_open_item_select_popup(2);
                script->functionTemp[0] = DIALOG_STATE_AWAIT_CLAIM_CHOICE;
            }
            break;
        case DIALOG_STATE_AWAIT_CLAIM_CHOICE:
            if (shop_update_item_select_popup(&shop->selectedStoreItemSlot) == 1) {
                script->functionTemp[0] = DIALOG_STATE_HANDLE_CLAIM_CHOICE;
                script->functionTemp[1] = 15;
            }
            break;
        case DIALOG_STATE_HANDLE_CLAIM_CHOICE:
            if (script->functionTemp[1] > 0) {
                script->functionTemp[1]--;
                break;
            }
            shop_close_item_select_popup();
            if (shop->selectedStoreItemSlot >= 0) {
                if (add_item(playerData->storedItems[shop->selectedStoreItemSlot]) >= 0) {
                    playerData->storedItems[shop->selectedStoreItemSlot] = 0;
                }

                if (get_item_empty_count() == 0 || get_stored_count() == 0) {
                    script->functionTemp[1] = shop_owner_begin_speech(SHOP_MSG_CLAIM_ACCEPTED);
                    script->functionTemp[0] = DIALOG_STATE_CLOSED_SUBMENU;
                } else {
                    script->functionTemp[1] = shop_owner_begin_speech(SHOP_MSG_CLAIM_MORE);
                    script->functionTemp[0] = DIALOG_STATE_INIT_CLAIM_MORE_CHOICE;
                }
            } else {
                script->functionTemp[1] = shop_owner_begin_speech(SHOP_MSG_FAREWELL);
                script->functionTemp[0] = DIALOG_STATE_CLOSED_SUBMENU;
            }
            break;
        case DIALOG_STATE_INIT_CLAIM_MORE_CHOICE:
            if (!does_script_exist(script->functionTemp[1])) {
                script->functionTemp[0] = DIALOG_STATE_AWAIT_CLAIM_MORE_CHOICE;
                script->functionTemp[2] = 0;
                D_80286538 = msg_get_printer_for_msg(MSG_Choice_0005, &script->functionTemp[2]);
            }
            break;
        case DIALOG_STATE_AWAIT_CLAIM_MORE_CHOICE:
            if (script->functionTemp[2] == 1) {
                if (D_80286538->currentOption == 0) {
                    script->functionTemp[1] = shop_owner_end_speech();
                    script->functionTemp[0] = DIALOG_STATE_INIT_CLAIM_CHOICE;
                } else {
                    script->functionTemp[1] = shop_owner_reset_speech(SHOP_MSG_FAREWELL);
                    script->functionTemp[0] = DIALOG_STATE_CLOSED_SUBMENU;
                }
            }
            break;
        case DIALOG_STATE_DONE_INSTRUCTIONS:
        case DIALOG_STATE_CLOSED_SUBMENU:
        case DIALOG_STATE_CLOSED_MAIN_MENU:
            if (!does_script_exist(script->functionTemp[1])) {
                script->functionTemp[0] = DIALOG_STATE_DONE;
            }
            break;
        case DIALOG_STATE_DONE:
            if (shop->owner != NULL) {
                if (shop->owner->onTalkEvt != 0) {
                    start_script(shop->owner->onTalkEvt, EVT_PRIORITY_1, 0);
                }
            }
            open_status_bar_short();
            return ApiStatus_DONE1;
    }
    return ApiStatus_BLOCK;
}