### RAW ASSEMBLY INSTRUCTIONS:

glabel basic_ai_wander
/* 24AB8 800496B8 27BDFFA0 */  addiu     $sp, $sp, -0x60
/* 24ABC 800496BC AFB3004C */  sw        $s3, 0x4C($sp)
/* 24AC0 800496C0 0080982D */  daddu     $s3, $a0, $zero
/* 24AC4 800496C4 AFB40050 */  sw        $s4, 0x50($sp)
/* 24AC8 800496C8 00A0A02D */  daddu     $s4, $a1, $zero
/* 24ACC 800496CC AFBF0058 */  sw        $ra, 0x58($sp)
/* 24AD0 800496D0 AFB50054 */  sw        $s5, 0x54($sp)
/* 24AD4 800496D4 AFB20048 */  sw        $s2, 0x48($sp)
/* 24AD8 800496D8 AFB10044 */  sw        $s1, 0x44($sp)
/* 24ADC 800496DC AFB00040 */  sw        $s0, 0x40($sp)
/* 24AE0 800496E0 8E710148 */  lw        $s1, 0x148($s3)
/* 24AE4 800496E4 00C0902D */  daddu     $s2, $a2, $zero
/* 24AE8 800496E8 86240008 */  lh        $a0, 0x8($s1)
/* 24AEC 800496EC 0C00EABB */  jal       get_npc_unsafe
/* 24AF0 800496F0 0000A82D */   daddu    $s5, $zero, $zero
/* 24AF4 800496F4 8E830014 */  lw        $v1, 0x14($s4)
/* 24AF8 800496F8 0460005D */  bltz      $v1, .L80049870
/* 24AFC 800496FC 0040802D */   daddu    $s0, $v0, $zero
/* 24B00 80049700 8E620074 */  lw        $v0, 0x74($s3)
/* 24B04 80049704 1C400059 */  bgtz      $v0, .L8004986C
/* 24B08 80049708 2442FFFF */   addiu    $v0, $v0, -0x1
/* 24B0C 8004970C 0240202D */  daddu     $a0, $s2, $zero
/* 24B10 80049710 AE630074 */  sw        $v1, 0x74($s3)
/* 24B14 80049714 AFA00010 */  sw        $zero, 0x10($sp)
/* 24B18 80049718 8E86000C */  lw        $a2, 0xC($s4)
/* 24B1C 8004971C 8E870010 */  lw        $a3, 0x10($s4)
/* 24B20 80049720 0C01242D */  jal       basic_ai_check_player_dist
/* 24B24 80049724 0220282D */   daddu    $a1, $s1, $zero
/* 24B28 80049728 1040004E */  beqz      $v0, .L80049864
/* 24B2C 8004972C 00000000 */   nop
/* 24B30 80049730 C60C0038 */  lwc1      $f12, 0x38($s0)
/* 24B34 80049734 3C02800F */  lui       $v0, %hi(gPlayerStatusPtr)
/* 24B38 80049738 8C427B30 */  lw        $v0, %lo(gPlayerStatusPtr)($v0)
/* 24B3C 8004973C C60E0040 */  lwc1      $f14, 0x40($s0)
/* 24B40 80049740 C602003C */  lwc1      $f2, 0x3C($s0)
/* 24B44 80049744 46006006 */  mov.s     $f0, $f12
/* 24B48 80049748 8C460028 */  lw        $a2, 0x28($v0)
/* 24B4C 8004974C 8C470030 */  lw        $a3, 0x30($v0)
/* 24B50 80049750 46007106 */  mov.s     $f4, $f14
/* 24B54 80049754 E7A00028 */  swc1      $f0, 0x28($sp)
/* 24B58 80049758 E7A2002C */  swc1      $f2, 0x2C($sp)
/* 24B5C 8004975C 0C00A720 */  jal       atan2
/* 24B60 80049760 E7A40030 */   swc1     $f4, 0x30($sp)
/* 24B64 80049764 C6820018 */  lwc1      $f2, 0x18($s4)
/* 24B68 80049768 E7A00038 */  swc1      $f0, 0x38($sp)
/* 24B6C 8004976C E7A00014 */  swc1      $f0, 0x14($sp)
/* 24B70 80049770 E7A20010 */  swc1      $f2, 0x10($sp)
/* 24B74 80049774 860200A8 */  lh        $v0, 0xA8($s0)
/* 24B78 80049778 27A50028 */  addiu     $a1, $sp, 0x28
/* 24B7C 8004977C 44820000 */  mtc1      $v0, $f0
/* 24B80 80049780 00000000 */  nop
/* 24B84 80049784 46800020 */  cvt.s.w   $f0, $f0
/* 24B88 80049788 E7A00018 */  swc1      $f0, 0x18($sp)
/* 24B8C 8004978C 860200A6 */  lh        $v0, 0xA6($s0)
/* 24B90 80049790 27A6002C */  addiu     $a2, $sp, 0x2C
/* 24B94 80049794 44820000 */  mtc1      $v0, $f0
/* 24B98 80049798 00000000 */  nop
/* 24B9C 8004979C 46800020 */  cvt.s.w   $f0, $f0
/* 24BA0 800497A0 E7A0001C */  swc1      $f0, 0x1C($sp)
/* 24BA4 800497A4 8E040080 */  lw        $a0, 0x80($s0)
/* 24BA8 800497A8 0C037711 */  jal       npc_test_move_simple_with_slipping
/* 24BAC 800497AC 27A70030 */   addiu    $a3, $sp, 0x30
/* 24BB0 800497B0 1440002C */  bnez      $v0, .L80049864
/* 24BB4 800497B4 0200202D */   daddu    $a0, $s0, $zero
/* 24BB8 800497B8 240502F4 */  addiu     $a1, $zero, 0x2F4
/* 24BBC 800497BC C7A00038 */  lwc1      $f0, 0x38($sp)
/* 24BC0 800497C0 3C060020 */  lui       $a2, (0x200000 >> 16)
/* 24BC4 800497C4 0C012530 */  jal       ai_enemy_play_sound
/* 24BC8 800497C8 E600000C */   swc1     $f0, 0xC($s0)
/* 24BCC 800497CC 02A0202D */  daddu     $a0, $s5, $zero
/* 24BD0 800497D0 0200282D */  daddu     $a1, $s0, $zero
/* 24BD4 800497D4 0000302D */  daddu     $a2, $zero, $zero
/* 24BD8 800497D8 84A300A8 */  lh        $v1, 0xA8($a1)
/* 24BDC 800497DC 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 24BE0 800497E0 44810000 */  mtc1      $at, $f0
/* 24BE4 800497E4 3C014000 */  lui       $at, (0x40000000 >> 16)
/* 24BE8 800497E8 44811000 */  mtc1      $at, $f2
/* 24BEC 800497EC 3C01C1A0 */  lui       $at, (0xC1A00000 >> 16)
/* 24BF0 800497F0 44812000 */  mtc1      $at, $f4
/* 24BF4 800497F4 2402000F */  addiu     $v0, $zero, 0xF
/* 24BF8 800497F8 AFA2001C */  sw        $v0, 0x1C($sp)
/* 24BFC 800497FC 44833000 */  mtc1      $v1, $f6
/* 24C00 80049800 00000000 */  nop
/* 24C04 80049804 468031A0 */  cvt.s.w   $f6, $f6
/* 24C08 80049808 44073000 */  mfc1      $a3, $f6
/* 24C0C 8004980C 27A20034 */  addiu     $v0, $sp, 0x34
/* 24C10 80049810 AFA20020 */  sw        $v0, 0x20($sp)
/* 24C14 80049814 E7A00010 */  swc1      $f0, 0x10($sp)
/* 24C18 80049818 E7A20014 */  swc1      $f2, 0x14($sp)
/* 24C1C 8004981C 0C01BFA4 */  jal       fx_emote
/* 24C20 80049820 E7A40018 */   swc1     $f4, 0x18($sp)
/* 24C24 80049824 2403FFBF */  addiu     $v1, $zero, -0x41
/* 24C28 80049828 8E2200B0 */  lw        $v0, 0xB0($s1)
/* 24C2C 8004982C 8E240018 */  lw        $a0, 0x18($s1)
/* 24C30 80049830 00431024 */  and       $v0, $v0, $v1
/* 24C34 80049834 2403FFDF */  addiu     $v1, $zero, -0x21
/* 24C38 80049838 00431024 */  and       $v0, $v0, $v1
/* 24C3C 8004983C AE2200B0 */  sw        $v0, 0xB0($s1)
/* 24C40 80049840 9482002A */  lhu       $v0, 0x2A($a0)
/* 24C44 80049844 30420001 */  andi      $v0, $v0, 0x1
/* 24C48 80049848 10400003 */  beqz      $v0, .L80049858
/* 24C4C 8004984C 2402000A */   addiu    $v0, $zero, 0xA
/* 24C50 80049850 080126C8 */  j         .L80049B20
/* 24C54 80049854 AE620070 */   sw       $v0, 0x70($s3)
.L80049858:
/* 24C58 80049858 2402000C */  addiu     $v0, $zero, 0xC
/* 24C5C 8004985C 080126C8 */  j         .L80049B20
/* 24C60 80049860 AE620070 */   sw       $v0, 0x70($s3)
.L80049864:
/* 24C64 80049864 8E620074 */  lw        $v0, 0x74($s3)
/* 24C68 80049868 2442FFFF */  addiu     $v0, $v0, -0x1
.L8004986C:
/* 24C6C 8004986C AE620074 */  sw        $v0, 0x74($s3)
.L80049870:
/* 24C70 80049870 8E2300D0 */  lw        $v1, 0xD0($s1)
/* 24C74 80049874 C6000040 */  lwc1      $f0, 0x40($s0)
/* 24C78 80049878 C4620000 */  lwc1      $f2, 0x0($v1)
/* 24C7C 8004987C 468010A0 */  cvt.s.w   $f2, $f2
/* 24C80 80049880 C4640008 */  lwc1      $f4, 0x8($v1)
/* 24C84 80049884 46802120 */  cvt.s.w   $f4, $f4
/* 24C88 80049888 E7A00010 */  swc1      $f0, 0x10($sp)
/* 24C8C 8004988C 8E2200D0 */  lw        $v0, 0xD0($s1)
/* 24C90 80049890 44051000 */  mfc1      $a1, $f2
/* 24C94 80049894 C440000C */  lwc1      $f0, 0xC($v0)
/* 24C98 80049898 46800020 */  cvt.s.w   $f0, $f0
/* 24C9C 8004989C E7A00014 */  swc1      $f0, 0x14($sp)
/* 24CA0 800498A0 8E2200D0 */  lw        $v0, 0xD0($s1)
/* 24CA4 800498A4 44062000 */  mfc1      $a2, $f4
/* 24CA8 800498A8 C4400010 */  lwc1      $f0, 0x10($v0)
/* 24CAC 800498AC 46800020 */  cvt.s.w   $f0, $f0
/* 24CB0 800498B0 E7A00018 */  swc1      $f0, 0x18($sp)
/* 24CB4 800498B4 8C640018 */  lw        $a0, 0x18($v1)
/* 24CB8 800498B8 0C0123F5 */  jal       is_point_within_region
/* 24CBC 800498BC 8E070038 */   lw       $a3, 0x38($s0)
/* 24CC0 800498C0 10400064 */  beqz      $v0, .L80049A54
/* 24CC4 800498C4 00000000 */   nop
/* 24CC8 800498C8 8E060038 */  lw        $a2, 0x38($s0)
/* 24CCC 800498CC 8E2200D0 */  lw        $v0, 0xD0($s1)
/* 24CD0 800498D0 8E070040 */  lw        $a3, 0x40($s0)
/* 24CD4 800498D4 C44C0000 */  lwc1      $f12, 0x0($v0)
/* 24CD8 800498D8 46806320 */  cvt.s.w   $f12, $f12
/* 24CDC 800498DC C44E0008 */  lwc1      $f14, 0x8($v0)
/* 24CE0 800498E0 0C00A7B5 */  jal       dist2D
/* 24CE4 800498E4 468073A0 */   cvt.s.w  $f14, $f14
/* 24CE8 800498E8 C6020018 */  lwc1      $f2, 0x18($s0)
/* 24CEC 800498EC 4600103C */  c.lt.s    $f2, $f0
/* 24CF0 800498F0 00000000 */  nop
/* 24CF4 800498F4 45000057 */  bc1f      .L80049A54
/* 24CF8 800498F8 00000000 */   nop
/* 24CFC 800498FC 8E2300B0 */  lw        $v1, 0xB0($s1)
/* 24D00 80049900 30620020 */  andi      $v0, $v1, 0x20
/* 24D04 80049904 14400002 */  bnez      $v0, .L80049910
/* 24D08 80049908 34620060 */   ori      $v0, $v1, 0x60
/* 24D0C 8004990C AE2200B0 */  sw        $v0, 0xB0($s1)
.L80049910:
/* 24D10 80049910 8E2200B0 */  lw        $v0, 0xB0($s1)
/* 24D14 80049914 30420040 */  andi      $v0, $v0, 0x40
/* 24D18 80049918 10400013 */  beqz      $v0, .L80049968
/* 24D1C 8004991C 00000000 */   nop
/* 24D20 80049920 C60C0038 */  lwc1      $f12, 0x38($s0)
/* 24D24 80049924 8E2200D0 */  lw        $v0, 0xD0($s1)
/* 24D28 80049928 C60E0040 */  lwc1      $f14, 0x40($s0)
/* 24D2C 8004992C C4460000 */  lwc1      $f6, 0x0($v0)
/* 24D30 80049930 468031A0 */  cvt.s.w   $f6, $f6
/* 24D34 80049934 44063000 */  mfc1      $a2, $f6
/* 24D38 80049938 C4460008 */  lwc1      $f6, 0x8($v0)
/* 24D3C 8004993C 468031A0 */  cvt.s.w   $f6, $f6
/* 24D40 80049940 44073000 */  mfc1      $a3, $f6
/* 24D44 80049944 0C00A720 */  jal       atan2
/* 24D48 80049948 00000000 */   nop
/* 24D4C 8004994C 0C00A6C9 */  jal       clamp_angle
/* 24D50 80049950 46000306 */   mov.s    $f12, $f0
/* 24D54 80049954 E600000C */  swc1      $f0, 0xC($s0)
/* 24D58 80049958 8E2200B0 */  lw        $v0, 0xB0($s1)
/* 24D5C 8004995C 2403FFBF */  addiu     $v1, $zero, -0x41
/* 24D60 80049960 00431024 */  and       $v0, $v0, $v1
/* 24D64 80049964 AE2200B0 */  sw        $v0, 0xB0($s1)
.L80049968:
/* 24D68 80049968 C6000018 */  lwc1      $f0, 0x18($s0)
/* 24D6C 8004996C C6020038 */  lwc1      $f2, 0x38($s0)
/* 24D70 80049970 46000021 */  cvt.d.s   $f0, $f0
/* 24D74 80049974 E7A20028 */  swc1      $f2, 0x28($sp)
/* 24D78 80049978 C602003C */  lwc1      $f2, 0x3C($s0)
/* 24D7C 8004997C C6040040 */  lwc1      $f4, 0x40($s0)
/* 24D80 80049980 46200000 */  add.d     $f0, $f0, $f0
/* 24D84 80049984 E7A2002C */  swc1      $f2, 0x2C($sp)
/* 24D88 80049988 E7A40030 */  swc1      $f4, 0x30($sp)
/* 24D8C 8004998C 46200020 */  cvt.s.d   $f0, $f0
/* 24D90 80049990 E7A00010 */  swc1      $f0, 0x10($sp)
/* 24D94 80049994 C600000C */  lwc1      $f0, 0xC($s0)
/* 24D98 80049998 E7A00014 */  swc1      $f0, 0x14($sp)
/* 24D9C 8004999C 860200A8 */  lh        $v0, 0xA8($s0)
/* 24DA0 800499A0 27A50028 */  addiu     $a1, $sp, 0x28
/* 24DA4 800499A4 44820000 */  mtc1      $v0, $f0
/* 24DA8 800499A8 00000000 */  nop
/* 24DAC 800499AC 46800020 */  cvt.s.w   $f0, $f0
/* 24DB0 800499B0 E7A00018 */  swc1      $f0, 0x18($sp)
/* 24DB4 800499B4 860200A6 */  lh        $v0, 0xA6($s0)
/* 24DB8 800499B8 27A6002C */  addiu     $a2, $sp, 0x2C
/* 24DBC 800499BC 44820000 */  mtc1      $v0, $f0
/* 24DC0 800499C0 00000000 */  nop
/* 24DC4 800499C4 46800020 */  cvt.s.w   $f0, $f0
/* 24DC8 800499C8 E7A0001C */  swc1      $f0, 0x1C($sp)
/* 24DCC 800499CC 8E040080 */  lw        $a0, 0x80($s0)
/* 24DD0 800499D0 0C037711 */  jal       npc_test_move_simple_with_slipping
/* 24DD4 800499D4 27A70030 */   addiu    $a3, $sp, 0x30
/* 24DD8 800499D8 10400026 */  beqz      $v0, .L80049A74
/* 24DDC 800499DC 24150001 */   addiu    $s5, $zero, 0x1
/* 24DE0 800499E0 C60C0038 */  lwc1      $f12, 0x38($s0)
/* 24DE4 800499E4 8E2200D0 */  lw        $v0, 0xD0($s1)
/* 24DE8 800499E8 C60E0040 */  lwc1      $f14, 0x40($s0)
/* 24DEC 800499EC C4460000 */  lwc1      $f6, 0x0($v0)
/* 24DF0 800499F0 468031A0 */  cvt.s.w   $f6, $f6
/* 24DF4 800499F4 44063000 */  mfc1      $a2, $f6
/* 24DF8 800499F8 C4460008 */  lwc1      $f6, 0x8($v0)
/* 24DFC 800499FC 468031A0 */  cvt.s.w   $f6, $f6
/* 24E00 80049A00 44073000 */  mfc1      $a3, $f6
/* 24E04 80049A04 0C00A720 */  jal       atan2
/* 24E08 80049A08 00000000 */   nop
/* 24E0C 80049A0C 0C00A6C9 */  jal       clamp_angle
/* 24E10 80049A10 46000306 */   mov.s    $f12, $f0
/* 24E14 80049A14 0200202D */  daddu     $a0, $s0, $zero
/* 24E18 80049A18 27A60038 */  addiu     $a2, $sp, 0x38
/* 24E1C 80049A1C 0000382D */  daddu     $a3, $zero, $zero
/* 24E20 80049A20 2403FFBF */  addiu     $v1, $zero, -0x41
/* 24E24 80049A24 E7A00038 */  swc1      $f0, 0x38($sp)
/* 24E28 80049A28 8E2200B0 */  lw        $v0, 0xB0($s1)
/* 24E2C 80049A2C 3C0540A0 */  lui       $a1, (0x40A00000 >> 16)
/* 24E30 80049A30 00431024 */  and       $v0, $v0, $v1
/* 24E34 80049A34 AE2200B0 */  sw        $v0, 0xB0($s1)
/* 24E38 80049A38 AFA00010 */  sw        $zero, 0x10($sp)
/* 24E3C 80049A3C 0C0129E1 */  jal       ai_check_fwd_collisions
/* 24E40 80049A40 AFA00014 */   sw       $zero, 0x14($sp)
/* 24E44 80049A44 C7A00038 */  lwc1      $f0, 0x38($sp)
/* 24E48 80049A48 E600000C */  swc1      $f0, 0xC($s0)
/* 24E4C 80049A4C 0801269D */  j         .L80049A74
/* 24E50 80049A50 24150001 */   addiu    $s5, $zero, 0x1
.L80049A54:
/* 24E54 80049A54 8E2300B0 */  lw        $v1, 0xB0($s1)
/* 24E58 80049A58 30620020 */  andi      $v0, $v1, 0x20
/* 24E5C 80049A5C 10400005 */  beqz      $v0, .L80049A74
/* 24E60 80049A60 2402FFDF */   addiu    $v0, $zero, -0x21
/* 24E64 80049A64 00621024 */  and       $v0, $v1, $v0
/* 24E68 80049A68 2403FFBF */  addiu     $v1, $zero, -0x41
/* 24E6C 80049A6C 00431024 */  and       $v0, $v0, $v1
/* 24E70 80049A70 AE2200B0 */  sw        $v0, 0xB0($s1)
.L80049A74:
/* 24E74 80049A74 8E2200D0 */  lw        $v0, 0xD0($s1)
/* 24E78 80049A78 8C43000C */  lw        $v1, 0xC($v0)
/* 24E7C 80049A7C 8C420010 */  lw        $v0, 0x10($v0)
/* 24E80 80049A80 00621825 */  or        $v1, $v1, $v0
/* 24E84 80049A84 00751825 */  or        $v1, $v1, $s5
/* 24E88 80049A88 10600008 */  beqz      $v1, .L80049AAC
/* 24E8C 80049A8C 00000000 */   nop
/* 24E90 80049A90 8602008C */  lh        $v0, 0x8C($s0)
/* 24E94 80049A94 14400022 */  bnez      $v0, .L80049B20
/* 24E98 80049A98 00000000 */   nop
/* 24E9C 80049A9C 8E050018 */  lw        $a1, 0x18($s0)
/* 24EA0 80049AA0 8E06000C */  lw        $a2, 0xC($s0)
/* 24EA4 80049AA4 0C00EA95 */  jal       npc_move_heading
/* 24EA8 80049AA8 0200202D */   daddu    $a0, $s0, $zero
.L80049AAC:
/* 24EAC 80049AAC 8E820004 */  lw        $v0, 0x4($s4)
/* 24EB0 80049AB0 1840001B */  blez      $v0, .L80049B20
/* 24EB4 80049AB4 00000000 */   nop
/* 24EB8 80049AB8 9602008E */  lhu       $v0, 0x8E($s0)
/* 24EBC 80049ABC 2442FFFF */  addiu     $v0, $v0, -0x1
/* 24EC0 80049AC0 A602008E */  sh        $v0, 0x8E($s0)
/* 24EC4 80049AC4 00021400 */  sll       $v0, $v0, 16
/* 24EC8 80049AC8 1C400015 */  bgtz      $v0, .L80049B20
/* 24ECC 80049ACC 240403E8 */   addiu    $a0, $zero, 0x3E8
/* 24ED0 80049AD0 24020002 */  addiu     $v0, $zero, 0x2
/* 24ED4 80049AD4 0C00A67F */  jal       rand_int
/* 24ED8 80049AD8 AE620070 */   sw       $v0, 0x70($s3)
/* 24EDC 80049ADC 3C035555 */  lui       $v1, (0x55555556 >> 16)
/* 24EE0 80049AE0 34635556 */  ori       $v1, $v1, (0x55555556 & 0xFFFF)
/* 24EE4 80049AE4 00430018 */  mult      $v0, $v1
/* 24EE8 80049AE8 000227C3 */  sra       $a0, $v0, 31
/* 24EEC 80049AEC 00004010 */  mfhi      $t0
/* 24EF0 80049AF0 01042023 */  subu      $a0, $t0, $a0
/* 24EF4 80049AF4 00041840 */  sll       $v1, $a0, 1
/* 24EF8 80049AF8 00641821 */  addu      $v1, $v1, $a0
/* 24EFC 80049AFC 00431023 */  subu      $v0, $v0, $v1
/* 24F00 80049B00 24420002 */  addiu     $v0, $v0, 0x2
/* 24F04 80049B04 AE620074 */  sw        $v0, 0x74($s3)
/* 24F08 80049B08 8E82002C */  lw        $v0, 0x2C($s4)
/* 24F0C 80049B0C 58400004 */  blezl     $v0, .L80049B20
/* 24F10 80049B10 AE600070 */   sw       $zero, 0x70($s3)
/* 24F14 80049B14 8E820008 */  lw        $v0, 0x8($s4)
/* 24F18 80049B18 58400001 */  blezl     $v0, .L80049B20
/* 24F1C 80049B1C AE600070 */   sw       $zero, 0x70($s3)
.L80049B20:
/* 24F20 80049B20 8FBF0058 */  lw        $ra, 0x58($sp)
/* 24F24 80049B24 8FB50054 */  lw        $s5, 0x54($sp)
/* 24F28 80049B28 8FB40050 */  lw        $s4, 0x50($sp)
/* 24F2C 80049B2C 8FB3004C */  lw        $s3, 0x4C($sp)
/* 24F30 80049B30 8FB20048 */  lw        $s2, 0x48($sp)
/* 24F34 80049B34 8FB10044 */  lw        $s1, 0x44($sp)
/* 24F38 80049B38 8FB00040 */  lw        $s0, 0x40($sp)
/* 24F3C 80049B3C 03E00008 */  jr        $ra
/* 24F40 80049B40 27BD0060 */   addiu    $sp, $sp, 0x60

### DECOMPILED C INSTRUCTIONS:

void basic_ai_wander_init(Evt* script, MobileAISettings* npcAISettings, EnemyDetectVolume* territory) {
    Enemy* enemy = script->owner1.enemy;
    Npc* npc = get_npc_unsafe(enemy->npcID);

    // chose a random direction and move time
    npc->duration = (npcAISettings->moveTime / 2) + rand_int((npcAISettings->moveTime / 2) + 1);
    npc->yaw = clamp_angle(npc->yaw + rand_int(60) - 30.0f);
    npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_WALK];
    script->functionTemp[1] = 0;

    if (enemy->territory->wander.moveSpeedOverride < 0) {
        npc->moveSpeed = npcAISettings->moveSpeed;
    } else {
        npc->moveSpeed = enemy->territory->wander.moveSpeedOverride / 32767.0;
    }

    enemy->aiFlags &= ~ENEMY_AI_FLAG_40;
    enemy->aiFlags &= ~ENEMY_AI_FLAG_20;
    script->AI_TEMP_STATE = AI_STATE_WANDER;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel JumpWithBounce
/* 1A8008 80279728 27BDFFA8 */  addiu     $sp, $sp, -0x58
/* 1A800C 8027972C AFB20020 */  sw        $s2, 0x20($sp)
/* 1A8010 80279730 0080902D */  daddu     $s2, $a0, $zero
/* 1A8014 80279734 AFBF0024 */  sw        $ra, 0x24($sp)
/* 1A8018 80279738 AFB1001C */  sw        $s1, 0x1C($sp)
/* 1A801C 8027973C AFB00018 */  sw        $s0, 0x18($sp)
/* 1A8020 80279740 F7BE0050 */  sdc1      $f30, 0x50($sp)
/* 1A8024 80279744 F7BC0048 */  sdc1      $f28, 0x48($sp)
/* 1A8028 80279748 F7BA0040 */  sdc1      $f26, 0x40($sp)
/* 1A802C 8027974C F7B80038 */  sdc1      $f24, 0x38($sp)
/* 1A8030 80279750 F7B60030 */  sdc1      $f22, 0x30($sp)
/* 1A8034 80279754 F7B40028 */  sdc1      $f20, 0x28($sp)
/* 1A8038 80279758 8E51000C */  lw        $s1, 0xC($s2)
/* 1A803C 8027975C 54A00001 */  bnel      $a1, $zero, .L80279764
/* 1A8040 80279760 AE400070 */   sw       $zero, 0x70($s2)
.L80279764:
/* 1A8044 80279764 8E420070 */  lw        $v0, 0x70($s2)
/* 1A8048 80279768 14400079 */  bnez      $v0, .L80279950
/* 1A804C 8027976C 24040002 */   addiu    $a0, $zero, 0x2
/* 1A8050 80279770 8E250000 */  lw        $a1, 0x0($s1)
/* 1A8054 80279774 26310004 */  addiu     $s1, $s1, 0x4
/* 1A8058 80279778 0C0B1EAF */  jal       evt_get_variable
/* 1A805C 8027977C 0240202D */   daddu    $a0, $s2, $zero
/* 1A8060 80279780 0040202D */  daddu     $a0, $v0, $zero
/* 1A8064 80279784 2402FF81 */  addiu     $v0, $zero, -0x7F
/* 1A8068 80279788 14820002 */  bne       $a0, $v0, .L80279794
/* 1A806C 8027978C 00000000 */   nop
/* 1A8070 80279790 8E440148 */  lw        $a0, 0x148($s2)
.L80279794:
/* 1A8074 80279794 0C09A75B */  jal       get_actor
/* 1A8078 80279798 00000000 */   nop
/* 1A807C 8027979C 0040802D */  daddu     $s0, $v0, $zero
/* 1A8080 802797A0 AE500074 */  sw        $s0, 0x74($s2)
/* 1A8084 802797A4 8E250000 */  lw        $a1, 0x0($s1)
/* 1A8088 802797A8 26310004 */  addiu     $s1, $s1, 0x4
/* 1A808C 802797AC 0C0B1EAF */  jal       evt_get_variable
/* 1A8090 802797B0 0240202D */   daddu    $a0, $s2, $zero
/* 1A8094 802797B4 A6020070 */  sh        $v0, 0x70($s0)
/* 1A8098 802797B8 8E250000 */  lw        $a1, 0x0($s1)
/* 1A809C 802797BC 0C0B210B */  jal       evt_get_float_variable
/* 1A80A0 802797C0 0240202D */   daddu    $a0, $s2, $zero
/* 1A80A4 802797C4 C6020148 */  lwc1      $f2, 0x148($s0)
/* 1A80A8 802797C8 C61A0018 */  lwc1      $f26, 0x18($s0)
/* 1A80AC 802797CC C61C0020 */  lwc1      $f28, 0x20($s0)
/* 1A80B0 802797D0 C614014C */  lwc1      $f20, 0x14C($s0)
/* 1A80B4 802797D4 C618001C */  lwc1      $f24, 0x1C($s0)
/* 1A80B8 802797D8 2611000C */  addiu     $s1, $s0, 0xC
/* 1A80BC 802797DC E600005C */  swc1      $f0, 0x5C($s0)
/* 1A80C0 802797E0 E6020010 */  swc1      $f2, 0x10($s0)
/* 1A80C4 802797E4 46001786 */  mov.s     $f30, $f2
/* 1A80C8 802797E8 4406D000 */  mfc1      $a2, $f26
/* 1A80CC 802797EC 4407E000 */  mfc1      $a3, $f28
/* 1A80D0 802797F0 C6020144 */  lwc1      $f2, 0x144($s0)
/* 1A80D4 802797F4 4600A386 */  mov.s     $f14, $f20
/* 1A80D8 802797F8 E6140014 */  swc1      $f20, 0x14($s0)
/* 1A80DC 802797FC E602000C */  swc1      $f2, 0xC($s0)
/* 1A80E0 80279800 46001586 */  mov.s     $f22, $f2
/* 1A80E4 80279804 0C00A720 */  jal       atan2
/* 1A80E8 80279808 4600B306 */   mov.s    $f12, $f22
/* 1A80EC 8027980C 4600B306 */  mov.s     $f12, $f22
/* 1A80F0 80279810 4600A386 */  mov.s     $f14, $f20
/* 1A80F4 80279814 4406D000 */  mfc1      $a2, $f26
/* 1A80F8 80279818 4407E000 */  mfc1      $a3, $f28
/* 1A80FC 8027981C 461EC781 */  sub.s     $f30, $f24, $f30
/* 1A8100 80279820 0C00A7B5 */  jal       dist2D
/* 1A8104 80279824 E6000054 */   swc1     $f0, 0x54($s0)
/* 1A8108 80279828 86020070 */  lh        $v0, 0x70($s0)
/* 1A810C 8027982C 46000106 */  mov.s     $f4, $f0
/* 1A8110 80279830 14400012 */  bnez      $v0, .L8027987C
/* 1A8114 80279834 E6040058 */   swc1     $f4, 0x58($s0)
/* 1A8118 80279838 C600004C */  lwc1      $f0, 0x4C($s0)
/* 1A811C 8027983C C602004C */  lwc1      $f2, 0x4C($s0)
/* 1A8120 80279840 46002003 */  div.s     $f0, $f4, $f0
/* 1A8124 80279844 4600028D */  trunc.w.s $f10, $f0
/* 1A8128 80279848 44035000 */  mfc1      $v1, $f10
/* 1A812C 8027984C 00000000 */  nop
/* 1A8130 80279850 00031400 */  sll       $v0, $v1, 16
/* 1A8134 80279854 00021403 */  sra       $v0, $v0, 16
/* 1A8138 80279858 44820000 */  mtc1      $v0, $f0
/* 1A813C 8027985C 00000000 */  nop
/* 1A8140 80279860 46800020 */  cvt.s.w   $f0, $f0
/* 1A8144 80279864 46020002 */  mul.s     $f0, $f0, $f2
/* 1A8148 80279868 00000000 */  nop
/* 1A814C 8027986C 46002086 */  mov.s     $f2, $f4
/* 1A8150 80279870 A6030070 */  sh        $v1, 0x70($s0)
/* 1A8154 80279874 0809E62C */  j         .L802798B0
/* 1A8158 80279878 46001201 */   sub.s    $f8, $f2, $f0
.L8027987C:
/* 1A815C 8027987C 44821000 */  mtc1      $v0, $f2
/* 1A8160 80279880 00000000 */  nop
/* 1A8164 80279884 468010A0 */  cvt.s.w   $f2, $f2
/* 1A8168 80279888 86020070 */  lh        $v0, 0x70($s0)
/* 1A816C 8027988C 46022083 */  div.s     $f2, $f4, $f2
/* 1A8170 80279890 44820000 */  mtc1      $v0, $f0
/* 1A8174 80279894 00000000 */  nop
/* 1A8178 80279898 46800020 */  cvt.s.w   $f0, $f0
/* 1A817C 8027989C 46020002 */  mul.s     $f0, $f0, $f2
/* 1A8180 802798A0 00000000 */  nop
/* 1A8184 802798A4 C6040058 */  lwc1      $f4, 0x58($s0)
/* 1A8188 802798A8 E602004C */  swc1      $f2, 0x4C($s0)
/* 1A818C 802798AC 46002201 */  sub.s     $f8, $f4, $f0
.L802798B0:
/* 1A8190 802798B0 86220064 */  lh        $v0, 0x64($s1)
/* 1A8194 802798B4 14400003 */  bnez      $v0, .L802798C4
/* 1A8198 802798B8 00000000 */   nop
/* 1A819C 802798BC 0809E6A9 */  j         .L80279AA4
/* 1A81A0 802798C0 24020002 */   addiu    $v0, $zero, 0x2
.L802798C4:
/* 1A81A4 802798C4 C622003C */  lwc1      $f2, 0x3C($s1)
/* 1A81A8 802798C8 44823000 */  mtc1      $v0, $f6
/* 1A81AC 802798CC 00000000 */  nop
/* 1A81B0 802798D0 468031A0 */  cvt.s.w   $f6, $f6
/* 1A81B4 802798D4 46061082 */  mul.s     $f2, $f2, $f6
/* 1A81B8 802798D8 00000000 */  nop
/* 1A81BC 802798DC 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* 1A81C0 802798E0 44810000 */  mtc1      $at, $f0
/* 1A81C4 802798E4 00000000 */  nop
/* 1A81C8 802798E8 46001082 */  mul.s     $f2, $f2, $f0
/* 1A81CC 802798EC 00000000 */  nop
/* 1A81D0 802798F0 86220064 */  lh        $v0, 0x64($s1)
/* 1A81D4 802798F4 C6240040 */  lwc1      $f4, 0x40($s1)
/* 1A81D8 802798F8 44820000 */  mtc1      $v0, $f0
/* 1A81DC 802798FC 00000000 */  nop
/* 1A81E0 80279900 46800020 */  cvt.s.w   $f0, $f0
/* 1A81E4 80279904 46004003 */  div.s     $f0, $f8, $f0
/* 1A81E8 80279908 46002100 */  add.s     $f4, $f4, $f0
/* 1A81EC 8027990C 4606F183 */  div.s     $f6, $f30, $f6
/* 1A81F0 80279910 46061080 */  add.s     $f2, $f2, $f6
/* 1A81F4 80279914 E6240040 */  swc1      $f4, 0x40($s1)
/* 1A81F8 80279918 E6220044 */  swc1      $f2, 0x44($s1)
/* 1A81FC 8027991C 8E0201AC */  lw        $v0, 0x1AC($s0)
/* 1A8200 80279920 10400009 */  beqz      $v0, .L80279948
/* 1A8204 80279924 24020001 */   addiu    $v0, $zero, 0x1
/* 1A8208 80279928 C600014C */  lwc1      $f0, 0x14C($s0)
/* 1A820C 8027992C E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A8210 80279930 8E0401AC */  lw        $a0, 0x1AC($s0)
/* 1A8214 80279934 8E060144 */  lw        $a2, 0x144($s0)
/* 1A8218 80279938 8E070148 */  lw        $a3, 0x148($s0)
/* 1A821C 8027993C 0C052757 */  jal       sfx_play_sound_at_position
/* 1A8220 80279940 0000282D */   daddu    $a1, $zero, $zero
/* 1A8224 80279944 24020001 */  addiu     $v0, $zero, 0x1
.L80279948:
/* 1A8228 80279948 AE420070 */  sw        $v0, 0x70($s2)
/* 1A822C 8027994C 24040002 */  addiu     $a0, $zero, 0x2
.L80279950:
/* 1A8230 80279950 8E500074 */  lw        $s0, 0x74($s2)
/* 1A8234 80279954 8E430070 */  lw        $v1, 0x70($s2)
/* 1A8238 80279958 1064002D */  beq       $v1, $a0, .L80279A10
/* 1A823C 8027995C 2611000C */   addiu    $s1, $s0, 0xC
/* 1A8240 80279960 28620003 */  slti      $v0, $v1, 0x3
/* 1A8244 80279964 10400005 */  beqz      $v0, .L8027997C
/* 1A8248 80279968 24020001 */   addiu    $v0, $zero, 0x1
/* 1A824C 8027996C 10620008 */  beq       $v1, $v0, .L80279990
/* 1A8250 80279970 00000000 */   nop
/* 1A8254 80279974 0809E6A2 */  j         .L80279A88
/* 1A8258 80279978 00000000 */   nop
.L8027997C:
/* 1A825C 8027997C 24020003 */  addiu     $v0, $zero, 0x3
/* 1A8260 80279980 10620048 */  beq       $v1, $v0, .L80279AA4
/* 1A8264 80279984 24020002 */   addiu    $v0, $zero, 0x2
/* 1A8268 80279988 0809E6A2 */  j         .L80279A88
/* 1A826C 8027998C 00000000 */   nop
.L80279990:
/* 1A8270 80279990 C6000050 */  lwc1      $f0, 0x50($s0)
/* 1A8274 80279994 C6040010 */  lwc1      $f4, 0x10($s0)
/* 1A8278 80279998 46000086 */  mov.s     $f2, $f0
/* 1A827C 8027999C 46002100 */  add.s     $f4, $f4, $f0
/* 1A8280 802799A0 C6000048 */  lwc1      $f0, 0x48($s0)
/* 1A8284 802799A4 46001081 */  sub.s     $f2, $f2, $f0
/* 1A8288 802799A8 44800000 */  mtc1      $zero, $f0
/* 1A828C 802799AC E6040010 */  swc1      $f4, 0x10($s0)
/* 1A8290 802799B0 4600103C */  c.lt.s    $f2, $f0
/* 1A8294 802799B4 00000000 */  nop
/* 1A8298 802799B8 4500000F */  bc1f      .L802799F8
/* 1A829C 802799BC E6020050 */   swc1     $f2, 0x50($s0)
/* 1A82A0 802799C0 C600001C */  lwc1      $f0, 0x1C($s0)
/* 1A82A4 802799C4 46002086 */  mov.s     $f2, $f4
/* 1A82A8 802799C8 4600103C */  c.lt.s    $f2, $f0
/* 1A82AC 802799CC 00000000 */  nop
/* 1A82B0 802799D0 45000009 */  bc1f      .L802799F8
/* 1A82B4 802799D4 00000000 */   nop
/* 1A82B8 802799D8 C6020050 */  lwc1      $f2, 0x50($s0)
/* 1A82BC 802799DC C604005C */  lwc1      $f4, 0x5C($s0)
/* 1A82C0 802799E0 C6000048 */  lwc1      $f0, 0x48($s0)
/* 1A82C4 802799E4 46041083 */  div.s     $f2, $f2, $f4
/* 1A82C8 802799E8 46000007 */  neg.s     $f0, $f0
/* 1A82CC 802799EC E6000048 */  swc1      $f0, 0x48($s0)
/* 1A82D0 802799F0 E6020050 */  swc1      $f2, 0x50($s0)
/* 1A82D4 802799F4 AE440070 */  sw        $a0, 0x70($s2)
.L802799F8:
/* 1A82D8 802799F8 8E250040 */  lw        $a1, 0x40($s1)
/* 1A82DC 802799FC 8E260048 */  lw        $a2, 0x48($s1)
/* 1A82E0 80279A00 0C09904A */  jal       add_xz_vec3f
/* 1A82E4 80279A04 0220202D */   daddu    $a0, $s1, $zero
/* 1A82E8 80279A08 0809E6A2 */  j         .L80279A88
/* 1A82EC 80279A0C 00000000 */   nop
.L80279A10:
/* 1A82F0 80279A10 C6000050 */  lwc1      $f0, 0x50($s0)
/* 1A82F4 80279A14 C6040010 */  lwc1      $f4, 0x10($s0)
/* 1A82F8 80279A18 46000086 */  mov.s     $f2, $f0
/* 1A82FC 80279A1C 46002100 */  add.s     $f4, $f4, $f0
/* 1A8300 80279A20 C6000048 */  lwc1      $f0, 0x48($s0)
/* 1A8304 80279A24 46001081 */  sub.s     $f2, $f2, $f0
/* 1A8308 80279A28 44800000 */  mtc1      $zero, $f0
/* 1A830C 80279A2C E6040010 */  swc1      $f4, 0x10($s0)
/* 1A8310 80279A30 4602003C */  c.lt.s    $f0, $f2
/* 1A8314 80279A34 00000000 */  nop
/* 1A8318 80279A38 45000009 */  bc1f      .L80279A60
/* 1A831C 80279A3C E6020050 */   swc1     $f2, 0x50($s0)
/* 1A8320 80279A40 C602001C */  lwc1      $f2, 0x1C($s0)
/* 1A8324 80279A44 46002006 */  mov.s     $f0, $f4
/* 1A8328 80279A48 4600103C */  c.lt.s    $f2, $f0
/* 1A832C 80279A4C 00000000 */  nop
/* 1A8330 80279A50 45000003 */  bc1f      .L80279A60
/* 1A8334 80279A54 24020003 */   addiu    $v0, $zero, 0x3
/* 1A8338 80279A58 E6020010 */  swc1      $f2, 0x10($s0)
/* 1A833C 80279A5C AE420070 */  sw        $v0, 0x70($s2)
.L80279A60:
/* 1A8340 80279A60 8E250040 */  lw        $a1, 0x40($s1)
/* 1A8344 80279A64 8E260048 */  lw        $a2, 0x48($s1)
/* 1A8348 80279A68 0C09904A */  jal       add_xz_vec3f
/* 1A834C 80279A6C 0220202D */   daddu    $a0, $s1, $zero
/* 1A8350 80279A70 C6200000 */  lwc1      $f0, 0x0($s1)
/* 1A8354 80279A74 E6000144 */  swc1      $f0, 0x144($s0)
/* 1A8358 80279A78 C6200004 */  lwc1      $f0, 0x4($s1)
/* 1A835C 80279A7C E6000148 */  swc1      $f0, 0x148($s0)
/* 1A8360 80279A80 C6200008 */  lwc1      $f0, 0x8($s1)
/* 1A8364 80279A84 E600014C */  swc1      $f0, 0x14C($s0)
.L80279A88:
/* 1A8368 80279A88 C6200000 */  lwc1      $f0, 0x0($s1)
/* 1A836C 80279A8C E6000144 */  swc1      $f0, 0x144($s0)
/* 1A8370 80279A90 C6200004 */  lwc1      $f0, 0x4($s1)
/* 1A8374 80279A94 E6000148 */  swc1      $f0, 0x148($s0)
/* 1A8378 80279A98 C6200008 */  lwc1      $f0, 0x8($s1)
/* 1A837C 80279A9C 0000102D */  daddu     $v0, $zero, $zero
/* 1A8380 80279AA0 E600014C */  swc1      $f0, 0x14C($s0)
.L80279AA4:
/* 1A8384 80279AA4 8FBF0024 */  lw        $ra, 0x24($sp)
/* 1A8388 80279AA8 8FB20020 */  lw        $s2, 0x20($sp)
/* 1A838C 80279AAC 8FB1001C */  lw        $s1, 0x1C($sp)
/* 1A8390 80279AB0 8FB00018 */  lw        $s0, 0x18($sp)
/* 1A8394 80279AB4 D7BE0050 */  ldc1      $f30, 0x50($sp)
/* 1A8398 80279AB8 D7BC0048 */  ldc1      $f28, 0x48($sp)
/* 1A839C 80279ABC D7BA0040 */  ldc1      $f26, 0x40($sp)
/* 1A83A0 80279AC0 D7B80038 */  ldc1      $f24, 0x38($sp)
/* 1A83A4 80279AC4 D7B60030 */  ldc1      $f22, 0x30($sp)
/* 1A83A8 80279AC8 D7B40028 */  ldc1      $f20, 0x28($sp)
/* 1A83AC 80279ACC 03E00008 */  jr        $ra
/* 1A83B0 80279AD0 27BD0058 */   addiu    $sp, $sp, 0x58

### DECOMPILED C INSTRUCTIONS:

ApiStatus JumpWithBounce(Evt* script, s32 isInitialCall) {
    Bytecode* args = script->ptrReadPos;
    Actor* actor;
    ActorState* actorState;
    s32 actorID;
    f32 posX, posY, posZ;
    f32 goalX, goalY, goalZ;
    f32 moveDist;

    if (isInitialCall) {
        script->functionTemp[0] = FALSE;
    }

    if (!script->functionTemp[0]) {
        actorID = evt_get_variable(script, *args++);
        if (actorID == ACTOR_SELF) {
            actorID = script->owner1.enemyID;
        }
        script->functionTempPtr[1] = actor = get_actor(actorID);
        actorState = &actor->state;

        actorState->moveTime = evt_get_variable(script, *args++);
        actorState->bounceDivisor = evt_get_float_variable(script, *args++);

        actorState->currentPos.x = actor->currentPos.x;
        actorState->currentPos.y = actor->currentPos.y;
        actorState->currentPos.z = actor->currentPos.z;

        posX = actorState->currentPos.x;
        posY = actorState->currentPos.y;
        posZ = actorState->currentPos.z;
        goalX = actorState->goalPos.x;
        goalZ = actorState->goalPos.z;
        goalY = actorState->goalPos.y;
        actorState->angle = atan2(posX, posZ, goalX, goalZ);
        actorState->distance = dist2D(posX, posZ, goalX, goalZ);

        // make relative
        posX = (goalX - posX);
        posY = (goalY - posY);
        posZ = (goalZ - posZ);

        if (actorState->moveTime == 0) {
            actorState->moveTime = (s32) (actorState->distance / actorState->speed);
            moveDist = actorState->distance - (actorState->moveTime * actorState->speed);
        } else {
            actorState->speed = actorState->distance / actorState->moveTime;
            moveDist = actorState->distance - (actorState->moveTime * actorState->speed);
        }

        if (actorState->moveTime == 0) {
            return ApiStatus_DONE2;
        }

        actorState->velocity = (actorState->acceleration * actorState->moveTime * 0.5f) + (posY / actorState->moveTime);
        actorState->speed += moveDist / actorState->moveTime;

        if (actor->actorTypeData1[4] != 0) {
            sfx_play_sound_at_position(actor->actorTypeData1[4], SOUND_SPACE_MODE_0, actor->currentPos.x, actor->currentPos.y, actor->currentPos.z);
        }
        script->functionTemp[0] = TRUE;
    }

    actor = script->functionTempPtr[1];
    actorState = &actor->state;

    switch (script->functionTemp[0]) {
        case 1:
            actorState->currentPos.y += actorState->velocity;
            actorState->velocity -= actorState->acceleration;
            if ((actorState->velocity < 0.0f) && (actorState->currentPos.y < actorState->goalPos.y)) {
                actorState->acceleration = -actorState->acceleration;
                actorState->velocity /= actorState->bounceDivisor;
                script->functionTemp[0] = 2;
            }
            add_xz_vec3f(&actorState->currentPos, actorState->speed, actorState->angle);
            break;
        case 2:
            actorState->currentPos.y += actorState->velocity;
            actorState->velocity -= actorState->acceleration;
            if (actorState->velocity > 0.0f) {
                if (actorState->goalPos.y < actorState->currentPos.y) {
                    actorState->currentPos.y = actorState->goalPos.y;
                    script->functionTemp[0] = 3;
                }
            }
            add_xz_vec3f(&actorState->currentPos, actorState->speed, actorState->angle);
            actor->currentPos.x = actorState->currentPos.x;
            actor->currentPos.y = actorState->currentPos.y;
            actor->currentPos.z = actorState->currentPos.z;
            break;

        case 3:
            return ApiStatus_DONE2;
    }

    actor->currentPos.x = actorState->currentPos.x;
    actor->currentPos.y = actorState->currentPos.y;
    actor->currentPos.z = actorState->currentPos.z;
    return ApiStatus_BLOCK;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel walking_dust_appendGfx
/* 32C398 E000E288 27BDFF38 */  addiu     $sp, $sp, -0xC8
/* 32C39C E000E28C AFB700B4 */  sw        $s7, 0xB4($sp)
/* 32C3A0 E000E290 0080B82D */  daddu     $s7, $a0, $zero
/* 32C3A4 E000E294 AFBF00BC */  sw        $ra, 0xBC($sp)
/* 32C3A8 E000E298 AFBE00B8 */  sw        $fp, 0xB8($sp)
/* 32C3AC E000E29C AFB600B0 */  sw        $s6, 0xB0($sp)
/* 32C3B0 E000E2A0 AFB500AC */  sw        $s5, 0xAC($sp)
/* 32C3B4 E000E2A4 AFB400A8 */  sw        $s4, 0xA8($sp)
/* 32C3B8 E000E2A8 AFB300A4 */  sw        $s3, 0xA4($sp)
/* 32C3BC E000E2AC AFB200A0 */  sw        $s2, 0xA0($sp)
/* 32C3C0 E000E2B0 AFB1009C */  sw        $s1, 0x9C($sp)
/* 32C3C4 E000E2B4 AFB00098 */  sw        $s0, 0x98($sp)
/* 32C3C8 E000E2B8 F7B400C0 */  sdc1      $f20, 0xC0($sp)
/* 32C3CC E000E2BC 8EE7000C */  lw        $a3, 0xC($s7)
/* 32C3D0 E000E2C0 3C1E0900 */  lui       $fp, %hi(D_09002B40_40FDD0)
/* 32C3D4 E000E2C4 27DE2B40 */  addiu     $fp, $fp, %lo(D_09002B40_40FDD0)
/* 32C3D8 E000E2C8 94EB0004 */  lhu       $t3, 0x4($a3)
/* 32C3DC E000E2CC 8CEC0074 */  lw        $t4, 0x74($a3)
/* 32C3E0 E000E2D0 15600005 */  bnez      $t3, .LE000E2E8
/* 32C3E4 E000E2D4 0000682D */   daddu    $t5, $zero, $zero
/* 32C3E8 E000E2D8 3C1E0900 */  lui       $fp, %hi(D_09002B20_40FDB0)
/* 32C3EC E000E2DC 27DE2B20 */  addiu     $fp, $fp, %lo(D_09002B20_40FDB0)
/* 32C3F0 E000E2E0 1160000A */  beqz      $t3, .LE000E30C
/* 32C3F4 E000E2E4 00000000 */   nop
.LE000E2E8:
/* 32C3F8 E000E2E8 3C0A0900 */  lui       $t2, %hi(D_09002950_40FBE0)
/* 32C3FC E000E2EC 254A2950 */  addiu     $t2, $t2, %lo(D_09002950_40FBE0)
/* 32C400 E000E2F0 24020001 */  addiu     $v0, $zero, 0x1
/* 32C404 E000E2F4 15620007 */  bne       $t3, $v0, .LE000E314
/* 32C408 E000E2F8 00000000 */   nop
/* 32C40C E000E2FC 3C0A0900 */  lui       $t2, %hi(D_09002868_40FAF8)
/* 32C410 E000E300 254A2868 */  addiu     $t2, $t2, %lo(D_09002868_40FAF8)
/* 32C414 E000E304 080038C5 */  j         .LE000E314
/* 32C418 E000E308 00000000 */   nop
.LE000E30C:
/* 32C41C E000E30C 3C0A0900 */  lui       $t2, %hi(D_09002780_40FA10)
/* 32C420 E000E310 254A2780 */  addiu     $t2, $t2, %lo(D_09002780_40FA10)
.LE000E314:
/* 32C424 E000E314 8CE3006C */  lw        $v1, 0x6C($a3)
/* 32C428 E000E318 14600004 */  bnez      $v1, .LE000E32C
/* 32C42C E000E31C 24020001 */   addiu    $v0, $zero, 0x1
/* 32C430 E000E320 24020006 */  addiu     $v0, $zero, 0x6
/* 32C434 E000E324 11820006 */  beq       $t4, $v0, .LE000E340
/* 32C438 E000E328 24020001 */   addiu    $v0, $zero, 0x1
.LE000E32C:
/* 32C43C E000E32C 14620006 */  bne       $v1, $v0, .LE000E348
/* 32C440 E000E330 3C04DB06 */   lui      $a0, (0xDB060024 >> 16)
/* 32C444 E000E334 24020007 */  addiu     $v0, $zero, 0x7
/* 32C448 E000E338 15820004 */  bne       $t4, $v0, .LE000E34C
/* 32C44C E000E33C 34840024 */   ori      $a0, $a0, (0xDB060024 & 0xFFFF)
.LE000E340:
/* 32C450 E000E340 240D0001 */  addiu     $t5, $zero, 0x1
/* 32C454 E000E344 3C04DB06 */  lui       $a0, (0xDB060024 >> 16)
.LE000E348:
/* 32C458 E000E348 34840024 */  ori       $a0, $a0, (0xDB060024 & 0xFFFF)
.LE000E34C:
/* 32C45C E000E34C 3C05E6DE */  lui       $a1, (0xE6DEDE6E >> 16)
/* 32C460 E000E350 34A5DE6E */  ori       $a1, $a1, (0xE6DEDE6E & 0xFFFF)
/* 32C464 E000E354 3C08800A */  lui       $t0, %hi(gMainGfxPos)
/* 32C468 E000E358 2508A66C */  addiu     $t0, $t0, %lo(gMainGfxPos)
/* 32C46C E000E35C 24090020 */  addiu     $t1, $zero, 0x20
/* 32C470 E000E360 8D060000 */  lw        $a2, 0x0($t0)
/* 32C474 E000E364 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 32C478 E000E368 00C0182D */  daddu     $v1, $a2, $zero
/* 32C47C E000E36C 24C60008 */  addiu     $a2, $a2, 0x8
/* 32C480 E000E370 AD060000 */  sw        $a2, 0x0($t0)
/* 32C484 E000E374 AC620000 */  sw        $v0, 0x0($v1)
/* 32C488 E000E378 24C20008 */  addiu     $v0, $a2, 0x8
/* 32C48C E000E37C AC600004 */  sw        $zero, 0x4($v1)
/* 32C490 E000E380 AD020000 */  sw        $v0, 0x0($t0)
/* 32C494 E000E384 24C20010 */  addiu     $v0, $a2, 0x10
/* 32C498 E000E388 ACC40000 */  sw        $a0, 0x0($a2)
/* 32C49C E000E38C AD020000 */  sw        $v0, 0x0($t0)
/* 32C4A0 E000E390 24C20018 */  addiu     $v0, $a2, 0x18
/* 32C4A4 E000E394 AD020000 */  sw        $v0, 0x0($t0)
/* 32C4A8 E000E398 8EE30010 */  lw        $v1, 0x10($s7)
/* 32C4AC E000E39C 00C91021 */  addu      $v0, $a2, $t1
/* 32C4B0 E000E3A0 AD020000 */  sw        $v0, 0x0($t0)
/* 32C4B4 E000E3A4 8C63001C */  lw        $v1, 0x1C($v1)
/* 32C4B8 E000E3A8 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 32C4BC E000E3AC ACC20008 */  sw        $v0, 0x8($a2)
/* 32C4C0 E000E3B0 3C02FB00 */  lui       $v0, (0xFB000000 >> 16)
/* 32C4C4 E000E3B4 ACC20010 */  sw        $v0, 0x10($a2)
/* 32C4C8 E000E3B8 2402007F */  addiu     $v0, $zero, 0x7F
/* 32C4CC E000E3BC ACC20014 */  sw        $v0, 0x14($a2)
/* 32C4D0 E000E3C0 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 32C4D4 E000E3C4 ACC20018 */  sw        $v0, 0x18($a2)
/* 32C4D8 E000E3C8 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 32C4DC E000E3CC ACCA000C */  sw        $t2, 0xC($a2)
/* 32C4E0 E000E3D0 ACC5001C */  sw        $a1, 0x1C($a2)
/* 32C4E4 E000E3D4 00621821 */  addu      $v1, $v1, $v0
/* 32C4E8 E000E3D8 15600002 */  bnez      $t3, .LE000E3E4
/* 32C4EC E000E3DC ACC30004 */   sw       $v1, 0x4($a2)
/* 32C4F0 E000E3E0 24090018 */  addiu     $t1, $zero, 0x18
.LE000E3E4:
/* 32C4F4 E000E3E4 01890018 */  mult      $t4, $t1
/* 32C4F8 E000E3E8 24C20028 */  addiu     $v0, $a2, 0x28
/* 32C4FC E000E3EC 3C0BF200 */  lui       $t3, (0xF2000000 >> 16)
/* 32C500 E000E3F0 AD020000 */  sw        $v0, 0x0($t0)
/* 32C504 E000E3F4 00002812 */  mflo      $a1
/* 32C508 E000E3F8 00051080 */  sll       $v0, $a1, 2
/* 32C50C E000E3FC 30420FFF */  andi      $v0, $v0, 0xFFF
/* 32C510 E000E400 00021300 */  sll       $v0, $v0, 12
/* 32C514 E000E404 004B1025 */  or        $v0, $v0, $t3
/* 32C518 E000E408 00A92021 */  addu      $a0, $a1, $t1
/* 32C51C E000E40C 2483FFFF */  addiu     $v1, $a0, -0x1
/* 32C520 E000E410 00031880 */  sll       $v1, $v1, 2
/* 32C524 E000E414 30630FFF */  andi      $v1, $v1, 0xFFF
/* 32C528 E000E418 00031B00 */  sll       $v1, $v1, 12
/* 32C52C E000E41C ACC20020 */  sw        $v0, 0x20($a2)
/* 32C530 E000E420 2522FFFF */  addiu     $v0, $t1, -0x1
/* 32C534 E000E424 00021080 */  sll       $v0, $v0, 2
/* 32C538 E000E428 304A0FFF */  andi      $t2, $v0, 0xFFF
/* 32C53C E000E42C 006A1825 */  or        $v1, $v1, $t2
/* 32C540 E000E430 11A00010 */  beqz      $t5, .LE000E474
/* 32C544 E000E434 ACC30024 */   sw       $v1, 0x24($a2)
/* 32C548 E000E438 24C20030 */  addiu     $v0, $a2, 0x30
/* 32C54C E000E43C AD020000 */  sw        $v0, 0x0($t0)
/* 32C550 E000E440 00041080 */  sll       $v0, $a0, 2
/* 32C554 E000E444 30420FFF */  andi      $v0, $v0, 0xFFF
/* 32C558 E000E448 00021300 */  sll       $v0, $v0, 12
/* 32C55C E000E44C 004B1025 */  or        $v0, $v0, $t3
/* 32C560 E000E450 ACC20028 */  sw        $v0, 0x28($a2)
/* 32C564 E000E454 00091040 */  sll       $v0, $t1, 1
/* 32C568 E000E458 00A21021 */  addu      $v0, $a1, $v0
/* 32C56C E000E45C 2442FFFF */  addiu     $v0, $v0, -0x1
/* 32C570 E000E460 00021080 */  sll       $v0, $v0, 2
/* 32C574 E000E464 30420FFF */  andi      $v0, $v0, 0xFFF
/* 32C578 E000E468 00021300 */  sll       $v0, $v0, 12
/* 32C57C E000E46C 0800392C */  j         .LE000E4B0
/* 32C580 E000E470 3C030100 */   lui      $v1, (0x1000000 >> 16)
.LE000E474:
/* 32C584 E000E474 24C20030 */  addiu     $v0, $a2, 0x30
/* 32C588 E000E478 AD020000 */  sw        $v0, 0x0($t0)
/* 32C58C E000E47C 00041080 */  sll       $v0, $a0, 2
/* 32C590 E000E480 30420FFF */  andi      $v0, $v0, 0xFFF
/* 32C594 E000E484 00021300 */  sll       $v0, $v0, 12
/* 32C598 E000E488 004B1025 */  or        $v0, $v0, $t3
/* 32C59C E000E48C ACC20028 */  sw        $v0, 0x28($a2)
/* 32C5A0 E000E490 00091040 */  sll       $v0, $t1, 1
/* 32C5A4 E000E494 00A21021 */  addu      $v0, $a1, $v0
/* 32C5A8 E000E498 2442FFFF */  addiu     $v0, $v0, -0x1
/* 32C5AC E000E49C 00021080 */  sll       $v0, $v0, 2
/* 32C5B0 E000E4A0 30420FFF */  andi      $v0, $v0, 0xFFF
/* 32C5B4 E000E4A4 00021300 */  sll       $v0, $v0, 12
/* 32C5B8 E000E4A8 3C030100 */  lui       $v1, (0x1000000 >> 16)
/* 32C5BC E000E4AC 01431825 */  or        $v1, $t2, $v1
.LE000E4B0:
/* 32C5C0 E000E4B0 00431025 */  or        $v0, $v0, $v1
/* 32C5C4 E000E4B4 ACC2002C */  sw        $v0, 0x2C($a2)
/* 32C5C8 E000E4B8 8EE20008 */  lw        $v0, 0x8($s7)
/* 32C5CC E000E4BC 18400051 */  blez      $v0, .LE000E604
/* 32C5D0 E000E4C0 0000882D */   daddu    $s1, $zero, $zero
/* 32C5D4 E000E4C4 27B40058 */  addiu     $s4, $sp, 0x58
/* 32C5D8 E000E4C8 4480A000 */  mtc1      $zero, $f20
/* 32C5DC E000E4CC 3C16800A */  lui       $s6, %hi(gDisplayContext)
/* 32C5E0 E000E4D0 26D6A674 */  addiu     $s6, $s6, %lo(gDisplayContext)
/* 32C5E4 E000E4D4 3C158007 */  lui       $s5, %hi(gMatrixListPos)
/* 32C5E8 E000E4D8 26B541F0 */  addiu     $s5, $s5, %lo(gMatrixListPos)
/* 32C5EC E000E4DC 3C130001 */  lui       $s3, (0x11630 >> 16)
/* 32C5F0 E000E4E0 36731630 */  ori       $s3, $s3, (0x11630 & 0xFFFF)
/* 32C5F4 E000E4E4 3C12800A */  lui       $s2, %hi(gMainGfxPos)
/* 32C5F8 E000E4E8 2652A66C */  addiu     $s2, $s2, %lo(gMainGfxPos)
/* 32C5FC E000E4EC 24F00010 */  addiu     $s0, $a3, 0x10
.LE000E4F0:
/* 32C600 E000E4F0 27A40018 */  addiu     $a0, $sp, 0x18
/* 32C604 E000E4F4 26310001 */  addiu     $s1, $s1, 0x1
/* 32C608 E000E4F8 8E05FFF8 */  lw        $a1, -0x8($s0)
/* 32C60C E000E4FC 8E06FFFC */  lw        $a2, -0x4($s0)
/* 32C610 E000E500 8E070000 */  lw        $a3, 0x0($s0)
/* 32C614 E000E504 0C080108 */  jal       shim_guTranslateF
/* 32C618 E000E508 26100078 */   addiu    $s0, $s0, 0x78
/* 32C61C E000E50C 3C0E800B */  lui       $t6, %hi(gCameras)
/* 32C620 E000E510 25CE1D80 */  addiu     $t6, $t6, %lo(gCameras)
/* 32C624 E000E514 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 32C628 E000E518 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 32C62C E000E51C 4406A000 */  mfc1      $a2, $f20
/* 32C630 E000E520 00031080 */  sll       $v0, $v1, 2
/* 32C634 E000E524 00431021 */  addu      $v0, $v0, $v1
/* 32C638 E000E528 00021080 */  sll       $v0, $v0, 2
/* 32C63C E000E52C 00431023 */  subu      $v0, $v0, $v1
/* 32C640 E000E530 000218C0 */  sll       $v1, $v0, 3
/* 32C644 E000E534 00431021 */  addu      $v0, $v0, $v1
/* 32C648 E000E538 000210C0 */  sll       $v0, $v0, 3
/* 32C64C E000E53C 004E1021 */  addu      $v0, $v0, $t6
/* 32C650 E000E540 C440006C */  lwc1      $f0, 0x6C($v0)
/* 32C654 E000E544 3C073F80 */  lui       $a3, (0x3F800000 >> 16)
/* 32C658 E000E548 46000007 */  neg.s     $f0, $f0
/* 32C65C E000E54C 44050000 */  mfc1      $a1, $f0
/* 32C660 E000E550 0280202D */  daddu     $a0, $s4, $zero
/* 32C664 E000E554 0C080104 */  jal       shim_guRotateF
/* 32C668 E000E558 E7B40010 */   swc1     $f20, 0x10($sp)
/* 32C66C E000E55C 0280202D */  daddu     $a0, $s4, $zero
/* 32C670 E000E560 27A50018 */  addiu     $a1, $sp, 0x18
/* 32C674 E000E564 0C080114 */  jal       shim_guMtxCatF
/* 32C678 E000E568 00A0302D */   daddu    $a2, $a1, $zero
/* 32C67C E000E56C 27A40018 */  addiu     $a0, $sp, 0x18
/* 32C680 E000E570 96A50000 */  lhu       $a1, 0x0($s5)
/* 32C684 E000E574 8EC20000 */  lw        $v0, 0x0($s6)
/* 32C688 E000E578 00052980 */  sll       $a1, $a1, 6
/* 32C68C E000E57C 00B32821 */  addu      $a1, $a1, $s3
/* 32C690 E000E580 0C080118 */  jal       shim_guMtxF2L
/* 32C694 E000E584 00452821 */   addu     $a1, $v0, $a1
/* 32C698 E000E588 3C02DA38 */  lui       $v0, (0xDA380002 >> 16)
/* 32C69C E000E58C 34420002 */  ori       $v0, $v0, (0xDA380002 & 0xFFFF)
/* 32C6A0 E000E590 3C06D838 */  lui       $a2, (0xD8380002 >> 16)
/* 32C6A4 E000E594 34C60002 */  ori       $a2, $a2, (0xD8380002 & 0xFFFF)
/* 32C6A8 E000E598 8E440000 */  lw        $a0, 0x0($s2)
/* 32C6AC E000E59C 96A30000 */  lhu       $v1, 0x0($s5)
/* 32C6B0 E000E5A0 0080282D */  daddu     $a1, $a0, $zero
/* 32C6B4 E000E5A4 24840008 */  addiu     $a0, $a0, 0x8
/* 32C6B8 E000E5A8 AE440000 */  sw        $a0, 0x0($s2)
/* 32C6BC E000E5AC ACA20000 */  sw        $v0, 0x0($a1)
/* 32C6C0 E000E5B0 24620001 */  addiu     $v0, $v1, 0x1
/* 32C6C4 E000E5B4 3063FFFF */  andi      $v1, $v1, 0xFFFF
/* 32C6C8 E000E5B8 00031980 */  sll       $v1, $v1, 6
/* 32C6CC E000E5BC A6A20000 */  sh        $v0, 0x0($s5)
/* 32C6D0 E000E5C0 8EC20000 */  lw        $v0, 0x0($s6)
/* 32C6D4 E000E5C4 00731821 */  addu      $v1, $v1, $s3
/* 32C6D8 E000E5C8 00431021 */  addu      $v0, $v0, $v1
/* 32C6DC E000E5CC ACA20004 */  sw        $v0, 0x4($a1)
/* 32C6E0 E000E5D0 24820008 */  addiu     $v0, $a0, 0x8
/* 32C6E4 E000E5D4 AE420000 */  sw        $v0, 0x0($s2)
/* 32C6E8 E000E5D8 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 32C6EC E000E5DC AC820000 */  sw        $v0, 0x0($a0)
/* 32C6F0 E000E5E0 24020040 */  addiu     $v0, $zero, 0x40
/* 32C6F4 E000E5E4 AC9E0004 */  sw        $fp, 0x4($a0)
/* 32C6F8 E000E5E8 AC860008 */  sw        $a2, 0x8($a0)
/* 32C6FC E000E5EC AC82000C */  sw        $v0, 0xC($a0)
/* 32C700 E000E5F0 8EE20008 */  lw        $v0, 0x8($s7)
/* 32C704 E000E5F4 24840010 */  addiu     $a0, $a0, 0x10
/* 32C708 E000E5F8 0222102A */  slt       $v0, $s1, $v0
/* 32C70C E000E5FC 1440FFBC */  bnez      $v0, .LE000E4F0
/* 32C710 E000E600 AE440000 */   sw       $a0, 0x0($s2)
.LE000E604:
/* 32C714 E000E604 3C03800A */  lui       $v1, %hi(gMainGfxPos)
/* 32C718 E000E608 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
/* 32C71C E000E60C 8C620000 */  lw        $v0, 0x0($v1)
/* 32C720 E000E610 0040202D */  daddu     $a0, $v0, $zero
/* 32C724 E000E614 24420008 */  addiu     $v0, $v0, 0x8
/* 32C728 E000E618 AC620000 */  sw        $v0, 0x0($v1)
/* 32C72C E000E61C 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 32C730 E000E620 AC820000 */  sw        $v0, 0x0($a0)
/* 32C734 E000E624 AC800004 */  sw        $zero, 0x4($a0)
/* 32C738 E000E628 8FBF00BC */  lw        $ra, 0xBC($sp)
/* 32C73C E000E62C 8FBE00B8 */  lw        $fp, 0xB8($sp)
/* 32C740 E000E630 8FB700B4 */  lw        $s7, 0xB4($sp)
/* 32C744 E000E634 8FB600B0 */  lw        $s6, 0xB0($sp)
/* 32C748 E000E638 8FB500AC */  lw        $s5, 0xAC($sp)
/* 32C74C E000E63C 8FB400A8 */  lw        $s4, 0xA8($sp)
/* 32C750 E000E640 8FB300A4 */  lw        $s3, 0xA4($sp)
/* 32C754 E000E644 8FB200A0 */  lw        $s2, 0xA0($sp)
/* 32C758 E000E648 8FB1009C */  lw        $s1, 0x9C($sp)
/* 32C75C E000E64C 8FB00098 */  lw        $s0, 0x98($sp)
/* 32C760 E000E650 D7B400C0 */  ldc1      $f20, 0xC0($sp)
/* 32C764 E000E654 03E00008 */  jr        $ra
/* 32C768 E000E658 27BD00C8 */   addiu    $sp, $sp, 0xC8
/* 32C76C E000E65C 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void walking_dust_appendGfx(void* effect) {
    EffectInstance* effectTemp = effect;
    WalkingDustFXData* data = effectTemp->data.walkingDust;
    s32 temp_t3 = data->unk_04;
    s32 temp_t4 = data->unk_74;
    s32 cond = FALSE;
    Matrix4f sp18;
    Matrix4f sp58;
    s32 temp_a0;
    s32 temp_lo;
    Gfx* dlist;
    Gfx* dlist2;
    s32 phi_t1;
    s32 i;

    if (temp_t3 == 0) {
        dlist2 = D_09002B20_32B9C0;
    } else {
        dlist2 = D_09002B40_32B9E0;
    }

    switch (temp_t3) {
        case 1:
            dlist = D_09002868_32B708;
            break;
        default:
            dlist = D_09002950_32B7F0;
            break;
        case 0:
            dlist = D_09002780_32B620;
            break;
    }

    if ((data->unk_6C == 0 && temp_t4 == 6) || (data->unk_6C == 1 && temp_t4 == 7)) {
        cond = TRUE;
    }

    gDPPipeSync(gMainGfxPos++);
    gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->graphics->data));
    gSPDisplayList(gMainGfxPos++, dlist);
    gDPSetEnvColor(gMainGfxPos++, 0, 0, 0, 127);
    gDPSetPrimColor(gMainGfxPos++, 0, 0, 230, 222, 222, 110);

    if (temp_t3 == 0) {
        phi_t1 = 24;
    } else {
        phi_t1 = 32;
    }

    temp_lo = temp_t4 * phi_t1;
    temp_a0 = temp_lo + phi_t1;

    gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE, temp_lo * 4, 0, (temp_a0 - 1) * 4, ((phi_t1 - 1) * 4));

    if (cond) {
        gDPSetTileSize(gMainGfxPos++, 1, temp_a0 * 4, 0, ((temp_lo + (phi_t1 * 2)) - 1) * 4, 0);
    } else {
        gDPSetTileSize(gMainGfxPos++, 1, temp_a0 * 4, 0, ((temp_lo + (phi_t1 * 2)) - 1) * 4, (phi_t1 - 1) * 4);
    }

    for (i = 0; i < effectTemp->numParts; i++, data++) {
        shim_guTranslateF(sp18, data->unk_08, data->unk_0C, data->unk_10);
        shim_guRotateF(sp58, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f);
        shim_guMtxCatF(sp58, sp18, sp18);
        shim_guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]);
        gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++],
                  G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
        gSPDisplayList(gMainGfxPos++, dlist2);
        gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    }
    gDPPipeSync(gMainGfxPos++);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel state_step_demo
/* 134F4 800380F4 27BDFFD0 */  addiu     $sp, $sp, -0x30
/* 134F8 800380F8 3C058007 */  lui       $a1, %hi(gGameStatusPtr)
/* 134FC 800380FC 8CA5419C */  lw        $a1, %lo(gGameStatusPtr)($a1)
/* 13500 80038100 3C048007 */  lui       $a0, %hi(DemoScenes)
/* 13504 80038104 24847AE0 */  addiu     $a0, $a0, %lo(DemoScenes)
/* 13508 80038108 AFBF002C */  sw        $ra, 0x2C($sp)
/* 1350C 8003810C AFB20028 */  sw        $s2, 0x28($sp)
/* 13510 80038110 AFB10024 */  sw        $s1, 0x24($sp)
/* 13514 80038114 AFB00020 */  sw        $s0, 0x20($sp)
/* 13518 80038118 80A30072 */  lb        $v1, 0x72($a1)
/* 1351C 8003811C 3C128011 */  lui       $s2, %hi(gPlayerData)
/* 13520 80038120 2652F290 */  addiu     $s2, $s2, %lo(gPlayerData)
/* 13524 80038124 00031040 */  sll       $v0, $v1, 1
/* 13528 80038128 00431021 */  addu      $v0, $v0, $v1
/* 1352C 8003812C 00021080 */  sll       $v0, $v0, 2
/* 13530 80038130 00448821 */  addu      $s1, $v0, $a0
/* 13534 80038134 24020004 */  addiu     $v0, $zero, 0x4
/* 13538 80038138 80A40071 */  lb        $a0, 0x71($a1)
/* 1353C 8003813C 96230000 */  lhu       $v1, 0x0($s1)
/* 13540 80038140 50820001 */  beql      $a0, $v0, .L80038148
/* 13544 80038144 24030003 */   addiu    $v1, $zero, 0x3
.L80038148:
/* 13548 80038148 24020005 */  addiu     $v0, $zero, 0x5
/* 1354C 8003814C 50820001 */  beql      $a0, $v0, .L80038154
/* 13550 80038150 24030004 */   addiu    $v1, $zero, 0x4
.L80038154:
/* 13554 80038154 00031400 */  sll       $v0, $v1, 16
/* 13558 80038158 00021C03 */  sra       $v1, $v0, 16
/* 1355C 8003815C 2C620005 */  sltiu     $v0, $v1, 0x5
/* 13560 80038160 104000AC */  beqz      $v0, .L80038414
/* 13564 80038164 00031080 */   sll      $v0, $v1, 2
/* 13568 80038168 3C01800A */  lui       $at, %hi(jtbl_80098460)
/* 1356C 8003816C 00220821 */  addu      $at, $at, $v0
/* 13570 80038170 8C228460 */  lw        $v0, %lo(jtbl_80098460)($at)
/* 13574 80038174 00400008 */  jr        $v0
/* 13578 80038178 00000000 */   nop
glabel .L8003817C
/* 1357C 8003817C 0C00CDF4 */  jal       intro_logos_set_fade_alpha
/* 13580 80038180 240400FF */   addiu    $a0, $zero, 0xFF
/* 13584 80038184 0C00CDF8 */  jal       intro_logos_set_fade_color
/* 13588 80038188 240400E0 */   addiu    $a0, $zero, 0xE0
/* 1358C 8003818C 3C108007 */  lui       $s0, %hi(gGameStatusPtr)
/* 13590 80038190 2610419C */  addiu     $s0, $s0, %lo(gGameStatusPtr)
/* 13594 80038194 8E030000 */  lw        $v1, 0x0($s0)
/* 13598 80038198 24020003 */  addiu     $v0, $zero, 0x3
/* 1359C 8003819C A06200AC */  sb        $v0, 0xAC($v1)
/* 135A0 800381A0 3C03800A */  lui       $v1, %hi(gOverrideFlags)
/* 135A4 800381A4 2463A650 */  addiu     $v1, $v1, %lo(gOverrideFlags)
/* 135A8 800381A8 8C620000 */  lw        $v0, 0x0($v1)
/* 135AC 800381AC 34420008 */  ori       $v0, $v0, 0x8
/* 135B0 800381B0 0C00CE1D */  jal       intro_logos_update_fade
/* 135B4 800381B4 AC620000 */   sw       $v0, 0x0($v1)
/* 135B8 800381B8 8E030000 */  lw        $v1, 0x0($s0)
/* 135BC 800381BC 24020005 */  addiu     $v0, $zero, 0x5
/* 135C0 800381C0 0800E105 */  j         .L80038414
/* 135C4 800381C4 A0620071 */   sb       $v0, 0x71($v1)
glabel .L800381C8
/* 135C8 800381C8 3C108007 */  lui       $s0, %hi(gGameStatusPtr)
/* 135CC 800381CC 2610419C */  addiu     $s0, $s0, %lo(gGameStatusPtr)
/* 135D0 800381D0 8E040000 */  lw        $a0, 0x0($s0)
/* 135D4 800381D4 808200AC */  lb        $v0, 0xAC($a0)
/* 135D8 800381D8 908300AC */  lbu       $v1, 0xAC($a0)
/* 135DC 800381DC 10400006 */  beqz      $v0, .L800381F8
/* 135E0 800381E0 2462FFFF */   addiu    $v0, $v1, -0x1
/* 135E4 800381E4 A08200AC */  sb        $v0, 0xAC($a0)
/* 135E8 800381E8 8E020000 */  lw        $v0, 0x0($s0)
/* 135EC 800381EC 804200AC */  lb        $v0, 0xAC($v0)
/* 135F0 800381F0 14400094 */  bnez      $v0, .L80038444
/* 135F4 800381F4 00000000 */   nop
.L800381F8:
/* 135F8 800381F8 8E020000 */  lw        $v0, 0x0($s0)
/* 135FC 800381FC A0400072 */  sb        $zero, 0x72($v0)
/* 13600 80038200 8E020000 */  lw        $v0, 0x0($s0)
/* 13604 80038204 A0400071 */  sb        $zero, 0x71($v0)
/* 13608 80038208 8E020000 */  lw        $v0, 0x0($s0)
/* 1360C 8003820C 0C015881 */  jal       enable_sounds
/* 13610 80038210 A040007E */   sb       $zero, 0x7E($v0)
/* 13614 80038214 8E020000 */  lw        $v0, 0x0($s0)
/* 13618 80038218 A0400070 */  sb        $zero, 0x70($v0)
/* 1361C 8003821C 8E020000 */  lw        $v0, 0x0($s0)
/* 13620 80038220 A0400076 */  sb        $zero, 0x76($v0)
/* 13624 80038224 8E020000 */  lw        $v0, 0x0($s0)
/* 13628 80038228 A0400078 */  sb        $zero, 0x78($v0)
/* 1362C 8003822C 8E020000 */  lw        $v0, 0x0($s0)
/* 13630 80038230 3C04800A */  lui       $a0, %hi(gOverrideFlags)
/* 13634 80038234 2484A650 */  addiu     $a0, $a0, %lo(gOverrideFlags)
/* 13638 80038238 A040007D */  sb        $zero, 0x7D($v0)
/* 1363C 8003823C 8C820000 */  lw        $v0, 0x0($a0)
/* 13640 80038240 2403FFF7 */  addiu     $v1, $zero, -0x9
/* 13644 80038244 00431024 */  and       $v0, $v0, $v1
/* 13648 80038248 0C00AB00 */  jal       general_heap_create
/* 1364C 8003824C AC820000 */   sw       $v0, 0x0($a0)
/* 13650 80038250 0C047624 */  jal       clear_render_tasks
/* 13654 80038254 00000000 */   nop
/* 13658 80038258 0C048C2E */  jal       clear_worker_list
/* 1365C 8003825C 00000000 */   nop
/* 13660 80038260 0C0B0C77 */  jal       clear_script_list
/* 13664 80038264 00000000 */   nop
/* 13668 80038268 0C00B7BD */  jal       create_cameras_a
/* 1366C 8003826C 00000000 */   nop
/* 13670 80038270 0C0B763E */  jal       spr_init_sprites
/* 13674 80038274 0000202D */   daddu    $a0, $zero, $zero
/* 13678 80038278 0C0482EC */  jal       clear_entity_models
/* 1367C 8003827C 00000000 */   nop
/* 13680 80038280 0C047889 */  jal       clear_animator_list
/* 13684 80038284 00000000 */   nop
/* 13688 80038288 0C045751 */  jal       clear_model_data
/* 1368C 8003828C 00000000 */   nop
/* 13690 80038290 0C052010 */  jal       clear_sprite_shading_data
/* 13694 80038294 00000000 */   nop
/* 13698 80038298 0C05177E */  jal       reset_background_settings
/* 1369C 8003829C 00000000 */   nop
/* 136A0 800382A0 0C050440 */  jal       hud_element_clear_cache
/* 136A4 800382A4 00000000 */   nop
/* 136A8 800382A8 0C0515A0 */  jal       clear_trigger_data
/* 136AC 800382AC 00000000 */   nop
/* 136B0 800382B0 0C048D9D */  jal       clear_printers
/* 136B4 800382B4 00000000 */   nop
/* 136B8 800382B8 0C04432E */  jal       clear_entity_data
/* 136BC 800382BC 0000202D */   daddu    $a0, $zero, $zero
/* 136C0 800382C0 0C04E042 */  jal       clear_screen_overlays
/* 136C4 800382C4 00000000 */   nop
/* 136C8 800382C8 0C037F14 */  jal       clear_player_status
/* 136CC 800382CC 00000000 */   nop
/* 136D0 800382D0 0C00E12F */  jal       clear_npcs
/* 136D4 800382D4 00000000 */   nop
/* 136D8 800382D8 0C039CE8 */  jal       clear_player_data
/* 136DC 800382DC 00000000 */   nop
/* 136E0 800382E0 0C01CACC */  jal       reset_battle_status
/* 136E4 800382E4 00000000 */   nop
/* 136E8 800382E8 0C00F8CE */  jal       init_encounter_status
/* 136EC 800382EC 00000000 */   nop
/* 136F0 800382F0 0C016727 */  jal       clear_effect_data
/* 136F4 800382F4 00000000 */   nop
/* 136F8 800382F8 0C04C3FC */  jal       clear_item_entity_data
/* 136FC 800382FC 00000000 */   nop
/* 13700 80038300 0C0514C8 */  jal       clear_saved_variables
/* 13704 80038304 00000000 */   nop
/* 13708 80038308 0C016BE5 */  jal       initialize_collision
/* 1370C 8003830C 00000000 */   nop
/* 13710 80038310 0C00CD3C */  jal       set_game_mode
/* 13714 80038314 24040002 */   addiu    $a0, $zero, 0x2
/* 13718 80038318 0800E111 */  j         .L80038444
/* 1371C 8003831C 00000000 */   nop
glabel .L80038320
/* 13720 80038320 27A50018 */  addiu     $a1, $sp, 0x18
/* 13724 80038324 8E240008 */  lw        $a0, 0x8($s1)
/* 13728 80038328 0C016AFE */  jal       get_map_IDs_by_name
/* 1372C 8003832C 27A6001A */   addiu    $a2, $sp, 0x1A
/* 13730 80038330 0000202D */  daddu     $a0, $zero, $zero
/* 13734 80038334 2405001D */  addiu     $a1, $zero, 0x1D
/* 13738 80038338 3C108007 */  lui       $s0, %hi(gGameStatusPtr)
/* 1373C 8003833C 2610419C */  addiu     $s0, $s0, %lo(gGameStatusPtr)
/* 13740 80038340 8E020000 */  lw        $v0, 0x0($s0)
/* 13744 80038344 97A30018 */  lhu       $v1, 0x18($sp)
/* 13748 80038348 97A7001A */  lhu       $a3, 0x1A($sp)
/* 1374C 8003834C 24060014 */  addiu     $a2, $zero, 0x14
/* 13750 80038350 A4430086 */  sh        $v1, 0x86($v0)
/* 13754 80038354 A447008C */  sh        $a3, 0x8C($v0)
/* 13758 80038358 96230002 */  lhu       $v1, 0x2($s1)
/* 1375C 8003835C 2407FEFA */  addiu     $a3, $zero, -0x106
/* 13760 80038360 A040007E */  sb        $zero, 0x7E($v0)
/* 13764 80038364 0800E0EE */  j         .L800383B8
/* 13768 80038368 A443008E */   sh       $v1, 0x8E($v0)
glabel .L8003836C
/* 1376C 8003836C 27A50018 */  addiu     $a1, $sp, 0x18
/* 13770 80038370 8E240008 */  lw        $a0, 0x8($s1)
/* 13774 80038374 0C016AFE */  jal       get_map_IDs_by_name
/* 13778 80038378 27A6001A */   addiu    $a2, $sp, 0x1A
/* 1377C 8003837C 0000202D */  daddu     $a0, $zero, $zero
/* 13780 80038380 2405001D */  addiu     $a1, $zero, 0x1D
/* 13784 80038384 24060014 */  addiu     $a2, $zero, 0x14
/* 13788 80038388 3C108007 */  lui       $s0, %hi(gGameStatusPtr)
/* 1378C 8003838C 2610419C */  addiu     $s0, $s0, %lo(gGameStatusPtr)
/* 13790 80038390 8E030000 */  lw        $v1, 0x0($s0)
/* 13794 80038394 97A20018 */  lhu       $v0, 0x18($sp)
/* 13798 80038398 97A8001A */  lhu       $t0, 0x1A($sp)
/* 1379C 8003839C 2407FEFA */  addiu     $a3, $zero, -0x106
/* 137A0 800383A0 A4620086 */  sh        $v0, 0x86($v1)
/* 137A4 800383A4 A468008C */  sh        $t0, 0x8C($v1)
/* 137A8 800383A8 96280002 */  lhu       $t0, 0x2($s1)
/* 137AC 800383AC 24020001 */  addiu     $v0, $zero, 0x1
/* 137B0 800383B0 A062007E */  sb        $v0, 0x7E($v1)
/* 137B4 800383B4 A468008E */  sh        $t0, 0x8E($v1)
.L800383B8:
/* 137B8 800383B8 92230005 */  lbu       $v1, 0x5($s1)
/* 137BC 800383BC 240200B1 */  addiu     $v0, $zero, 0xB1
/* 137C0 800383C0 AFA20010 */  sw        $v0, 0x10($sp)
/* 137C4 800383C4 0C00B8C5 */  jal       set_cam_viewport
/* 137C8 800383C8 A2430012 */   sb       $v1, 0x12($s2)
/* 137CC 800383CC 0000202D */  daddu     $a0, $zero, $zero
/* 137D0 800383D0 3C05F5DE */  lui       $a1, (0xF5DE0180 >> 16)
/* 137D4 800383D4 82260006 */  lb        $a2, 0x6($s1)
/* 137D8 800383D8 0C0B2026 */  jal       evt_set_variable
/* 137DC 800383DC 34A50180 */   ori      $a1, $a1, (0xF5DE0180 & 0xFFFF)
/* 137E0 800383E0 8E020000 */  lw        $v0, 0x0($s0)
/* 137E4 800383E4 80420072 */  lb        $v0, 0x72($v0)
/* 137E8 800383E8 14400002 */  bnez      $v0, .L800383F4
/* 137EC 800383EC 24040002 */   addiu    $a0, $zero, 0x2
/* 137F0 800383F0 24040003 */  addiu     $a0, $zero, 0x3
.L800383F4:
/* 137F4 800383F4 0C04E0A8 */  jal       set_map_transition_effect
/* 137F8 800383F8 00000000 */   nop
/* 137FC 800383FC 0C00CD3C */  jal       set_game_mode
/* 13800 80038400 24040003 */   addiu    $a0, $zero, 0x3
/* 13804 80038404 0800E105 */  j         .L80038414
/* 13808 80038408 00000000 */   nop
glabel .L8003840C
/* 1380C 8003840C 0C01CB85 */  jal       load_demo_battle
/* 13810 80038410 96240002 */   lhu      $a0, 0x2($s1)
.L80038414:
/* 13814 80038414 3C048007 */  lui       $a0, %hi(gGameStatusPtr)
/* 13818 80038418 2484419C */  addiu     $a0, $a0, %lo(gGameStatusPtr)
/* 1381C 8003841C 8C830000 */  lw        $v1, 0x0($a0)
/* 13820 80038420 90620072 */  lbu       $v0, 0x72($v1)
/* 13824 80038424 24420001 */  addiu     $v0, $v0, 0x1
/* 13828 80038428 A0620072 */  sb        $v0, 0x72($v1)
/* 1382C 8003842C 8C840000 */  lw        $a0, 0x0($a0)
/* 13830 80038430 80820072 */  lb        $v0, 0x72($a0)
/* 13834 80038434 28420013 */  slti      $v0, $v0, 0x13
/* 13838 80038438 14400002 */  bnez      $v0, .L80038444
/* 1383C 8003843C 24020012 */   addiu    $v0, $zero, 0x12
/* 13840 80038440 A0820072 */  sb        $v0, 0x72($a0)
.L80038444:
/* 13844 80038444 8FBF002C */  lw        $ra, 0x2C($sp)
/* 13848 80038448 8FB20028 */  lw        $s2, 0x28($sp)
/* 1384C 8003844C 8FB10024 */  lw        $s1, 0x24($sp)
/* 13850 80038450 8FB00020 */  lw        $s0, 0x20($sp)
/* 13854 80038454 03E00008 */  jr        $ra
/* 13858 80038458 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

void state_step_demo(void) {
    PlayerData* playerData = &gPlayerData;
    DemoSceneData* demoSceneData = &DemoScenes[gGameStatusPtr->nextDemoScene];
    s16 mode = demoSceneData->sceneType;
    s16 mapID;
    s16 areaID;

    if (gGameStatusPtr->demoState == DEMO_STATE_4) {
        mode = DEMO_SCENE_DONE;
    }
    if (gGameStatusPtr->demoState == DEMO_STATE_DONE) {
        mode = DEMO_SCENE_EXIT;
    }

    switch (mode) {
        case DEMO_SCENE_DONE:
            intro_logos_set_fade_alpha(255);
            intro_logos_set_fade_color(224);
            gGameStatusPtr->introState = INTRO_STATE_3;
            gOverrideFlags |= GLOBAL_OVERRIDES_8;
            intro_logos_update_fade();
            gGameStatusPtr->demoState = DEMO_STATE_DONE;
            break;
        case DEMO_SCENE_EXIT:
            if (gGameStatusPtr->introState != INTRO_STATE_0) {
                gGameStatusPtr->introState--;
            }

            if (gGameStatusPtr->introState == INTRO_STATE_0) {
                gGameStatusPtr->nextDemoScene = 0;
                gGameStatusPtr->demoState = DEMO_STATE_NONE;
                gGameStatusPtr->peachFlags = 0;
                enable_sounds();
                gGameStatusPtr->isBattle = FALSE;
                gGameStatusPtr->unk_76 = 0;
                gGameStatusPtr->disableScripts = FALSE;
                gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE;
                gOverrideFlags &= ~GLOBAL_OVERRIDES_8;
                general_heap_create();
                clear_render_tasks();
                clear_worker_list();
                clear_script_list();
                create_cameras_a();
                spr_init_sprites(PLAYER_SPRITES_MARIO_WORLD);
                clear_entity_models();
                clear_animator_list();
                clear_model_data();
                clear_sprite_shading_data();
                reset_background_settings();
                hud_element_clear_cache();
                clear_trigger_data();
                clear_printers();
                clear_entity_data(0);
                clear_screen_overlays();
                clear_player_status();
                clear_npcs();
                clear_player_data();
                reset_battle_status();
                init_encounter_status();
                clear_effect_data();
                clear_item_entity_data();
                clear_saved_variables();
                initialize_collision();
                set_game_mode(GAME_MODE_TITLE_SCREEN);
            }
            return;
        case DEMO_SCENE_WORLD:
            get_map_IDs_by_name(demoSceneData->mapName, &areaID, &mapID);
            gGameStatusPtr->areaID = areaID;
            gGameStatusPtr->mapID = mapID;
            gGameStatusPtr->entryID = demoSceneData->index;
            gGameStatusPtr->peachFlags = 0;
            playerData->currentPartner = demoSceneData->partnerID;
            set_cam_viewport(0, 29, 20, -262, 177);
            evt_set_variable(NULL, GB_StoryProgress, demoSceneData->storyProgress);

            if (gGameStatusPtr->nextDemoScene == 0) {
                set_map_transition_effect(TRANSITION_END_DEMO_SCENE_WHITE);
            } else {
                set_map_transition_effect(TRANSITION_END_DEMO_SCENE_BLACK);
            }

            set_game_mode(GAME_MODE_ENTER_DEMO_WORLD);
            break;
        case DEMO_SCENE_PEACH:
            get_map_IDs_by_name(demoSceneData->mapName, &areaID, &mapID);
            gGameStatusPtr->areaID = areaID;
            gGameStatusPtr->mapID = mapID;
            gGameStatusPtr->entryID = demoSceneData->index;
            gGameStatusPtr->peachFlags = PEACH_STATUS_FLAG_IS_PEACH;
            playerData->currentPartner = demoSceneData->partnerID;
            set_cam_viewport(0, 29, 20, -262, 177);
            evt_set_variable(NULL, GB_StoryProgress, demoSceneData->storyProgress);

            if (gGameStatusPtr->nextDemoScene == 0) {
                set_map_transition_effect(TRANSITION_END_DEMO_SCENE_WHITE);
            } else {
                set_map_transition_effect(TRANSITION_END_DEMO_SCENE_BLACK);
            }

            set_game_mode(GAME_MODE_ENTER_DEMO_WORLD);
            break;
        case DEMO_SCENE_BATTLE:
            load_demo_battle(demoSceneData->index);
            break;
    }

    gGameStatusPtr->nextDemoScene++;
    if (gGameStatusPtr->nextDemoScene > LAST_DEMO_SCENE_IDX) {
        gGameStatusPtr->nextDemoScene = LAST_DEMO_SCENE_IDX;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel water_block_update
/* 3B5E2C E00B413C 27BDFFB8 */  addiu     $sp, $sp, -0x48
/* 3B5E30 E00B4140 AFB20020 */  sw        $s2, 0x20($sp)
/* 3B5E34 E00B4144 0080902D */  daddu     $s2, $a0, $zero
/* 3B5E38 E00B4148 AFBF0024 */  sw        $ra, 0x24($sp)
/* 3B5E3C E00B414C AFB1001C */  sw        $s1, 0x1C($sp)
/* 3B5E40 E00B4150 AFB00018 */  sw        $s0, 0x18($sp)
/* 3B5E44 E00B4154 F7BA0040 */  sdc1      $f26, 0x40($sp)
/* 3B5E48 E00B4158 F7B80038 */  sdc1      $f24, 0x38($sp)
/* 3B5E4C E00B415C F7B60030 */  sdc1      $f22, 0x30($sp)
/* 3B5E50 E00B4160 F7B40028 */  sdc1      $f20, 0x28($sp)
/* 3B5E54 E00B4164 8E430000 */  lw        $v1, 0x0($s2)
/* 3B5E58 E00B4168 8E51000C */  lw        $s1, 0xC($s2)
/* 3B5E5C E00B416C 30620010 */  andi      $v0, $v1, 0x10
/* 3B5E60 E00B4170 8E240000 */  lw        $a0, 0x0($s1)
/* 3B5E64 E00B4174 1040000B */  beqz      $v0, .LE00B41A4
/* 3B5E68 E00B4178 24020001 */   addiu    $v0, $zero, 0x1
/* 3B5E6C E00B417C 14820005 */  bne       $a0, $v0, .LE00B4194
/* 3B5E70 E00B4180 2402FFEF */   addiu    $v0, $zero, -0x11
/* 3B5E74 E00B4184 00621024 */  and       $v0, $v1, $v0
/* 3B5E78 E00B4188 AE420000 */  sw        $v0, 0x0($s2)
/* 3B5E7C E00B418C 0802D068 */  j         .LE00B41A0
/* 3B5E80 E00B4190 24020004 */   addiu    $v0, $zero, 0x4
.LE00B4194:
/* 3B5E84 E00B4194 00621024 */  and       $v0, $v1, $v0
/* 3B5E88 E00B4198 AE420000 */  sw        $v0, 0x0($s2)
/* 3B5E8C E00B419C 24020010 */  addiu     $v0, $zero, 0x10
.LE00B41A0:
/* 3B5E90 E00B41A0 AE220010 */  sw        $v0, 0x10($s1)
.LE00B41A4:
/* 3B5E94 E00B41A4 8E230010 */  lw        $v1, 0x10($s1)
/* 3B5E98 E00B41A8 286203E8 */  slti      $v0, $v1, 0x3E8
/* 3B5E9C E00B41AC 10400002 */  beqz      $v0, .LE00B41B8
/* 3B5EA0 E00B41B0 2462FFFF */   addiu    $v0, $v1, -0x1
/* 3B5EA4 E00B41B4 AE220010 */  sw        $v0, 0x10($s1)
.LE00B41B8:
/* 3B5EA8 E00B41B8 3C030004 */  lui       $v1, (0x4F1A0 >> 16)
/* 3B5EAC E00B41BC 8E220014 */  lw        $v0, 0x14($s1)
/* 3B5EB0 E00B41C0 3463F1A0 */  ori       $v1, $v1, (0x4F1A0 & 0xFFFF)
/* 3B5EB4 E00B41C4 24420001 */  addiu     $v0, $v0, 0x1
/* 3B5EB8 E00B41C8 0062182A */  slt       $v1, $v1, $v0
/* 3B5EBC E00B41CC 10600003 */  beqz      $v1, .LE00B41DC
/* 3B5EC0 E00B41D0 AE220014 */   sw       $v0, 0x14($s1)
/* 3B5EC4 E00B41D4 24020100 */  addiu     $v0, $zero, 0x100
/* 3B5EC8 E00B41D8 AE220014 */  sw        $v0, 0x14($s1)
.LE00B41DC:
/* 3B5ECC E00B41DC 8E230010 */  lw        $v1, 0x10($s1)
/* 3B5ED0 E00B41E0 04610020 */  bgez      $v1, .LE00B4264
/* 3B5ED4 E00B41E4 24020001 */   addiu    $v0, $zero, 0x1
/* 3B5ED8 E00B41E8 1482001A */  bne       $a0, $v0, .LE00B4254
/* 3B5EDC E00B41EC 00000000 */   nop
/* 3B5EE0 E00B41F0 0C080150 */  jal       shim_load_effect
/* 3B5EE4 E00B41F4 2404005F */   addiu    $a0, $zero, 0x5F
/* 3B5EE8 E00B41F8 C6200008 */  lwc1      $f0, 0x8($s1)
/* 3B5EEC E00B41FC 3C0141C0 */  lui       $at, (0x41C00000 >> 16)
/* 3B5EF0 E00B4200 4481B000 */  mtc1      $at, $f22
/* 3B5EF4 E00B4204 3C014000 */  lui       $at, (0x40000000 >> 16)
/* 3B5EF8 E00B4208 4481A000 */  mtc1      $at, $f20
/* 3B5EFC E00B420C 2410001E */  addiu     $s0, $zero, 0x1E
/* 3B5F00 E00B4210 AFB00014 */  sw        $s0, 0x14($sp)
/* 3B5F04 E00B4214 46160000 */  add.s     $f0, $f0, $f22
/* 3B5F08 E00B4218 E7B40010 */  swc1      $f20, 0x10($sp)
/* 3B5F0C E00B421C 8E250004 */  lw        $a1, 0x4($s1)
/* 3B5F10 E00B4220 8E27000C */  lw        $a3, 0xC($s1)
/* 3B5F14 E00B4224 44060000 */  mfc1      $a2, $f0
/* 3B5F18 E00B4228 0C02F800 */  jal       water_splash_main
/* 3B5F1C E00B422C 0000202D */   daddu    $a0, $zero, $zero
/* 3B5F20 E00B4230 C6200008 */  lwc1      $f0, 0x8($s1)
/* 3B5F24 E00B4234 E7B40010 */  swc1      $f20, 0x10($sp)
/* 3B5F28 E00B4238 AFB00014 */  sw        $s0, 0x14($sp)
/* 3B5F2C E00B423C 46160000 */  add.s     $f0, $f0, $f22
/* 3B5F30 E00B4240 8E250004 */  lw        $a1, 0x4($s1)
/* 3B5F34 E00B4244 8E27000C */  lw        $a3, 0xC($s1)
/* 3B5F38 E00B4248 44060000 */  mfc1      $a2, $f0
/* 3B5F3C E00B424C 0C02F800 */  jal       water_splash_main
/* 3B5F40 E00B4250 24040001 */   addiu    $a0, $zero, 0x1
.LE00B4254:
/* 3B5F44 E00B4254 0C080128 */  jal       shim_remove_effect
/* 3B5F48 E00B4258 0240202D */   daddu    $a0, $s2, $zero
/* 3B5F4C E00B425C 0802D141 */  j         .LE00B4504
/* 3B5F50 E00B4260 00000000 */   nop
.LE00B4264:
/* 3B5F54 E00B4264 8E300014 */  lw        $s0, 0x14($s1)
/* 3B5F58 E00B4268 1480000B */  bnez      $a0, .LE00B4298
/* 3B5F5C E00B426C 2A020004 */   slti     $v0, $s0, 0x4
/* 3B5F60 E00B4270 28620010 */  slti      $v0, $v1, 0x10
/* 3B5F64 E00B4274 10400003 */  beqz      $v0, .LE00B4284
/* 3B5F68 E00B4278 00031100 */   sll      $v0, $v1, 4
/* 3B5F6C E00B427C AE220024 */  sw        $v0, 0x24($s1)
/* 3B5F70 E00B4280 AE220028 */  sw        $v0, 0x28($s1)
.LE00B4284:
/* 3B5F74 E00B4284 2A020010 */  slti      $v0, $s0, 0x10
/* 3B5F78 E00B4288 10400008 */  beqz      $v0, .LE00B42AC
/* 3B5F7C E00B428C 00101100 */   sll      $v0, $s0, 4
/* 3B5F80 E00B4290 0802D0A9 */  j         .LE00B42A4
/* 3B5F84 E00B4294 2442000F */   addiu    $v0, $v0, 0xF
.LE00B4298:
/* 3B5F88 E00B4298 10400004 */  beqz      $v0, .LE00B42AC
/* 3B5F8C E00B429C 00101180 */   sll      $v0, $s0, 6
/* 3B5F90 E00B42A0 2442003F */  addiu     $v0, $v0, 0x3F
.LE00B42A4:
/* 3B5F94 E00B42A4 AE220024 */  sw        $v0, 0x24($s1)
/* 3B5F98 E00B42A8 AE220028 */  sw        $v0, 0x28($s1)
.LE00B42AC:
/* 3B5F9C E00B42AC 00101040 */  sll       $v0, $s0, 1
/* 3B5FA0 E00B42B0 00501021 */  addu      $v0, $v0, $s0
/* 3B5FA4 E00B42B4 00021040 */  sll       $v0, $v0, 1
/* 3B5FA8 E00B42B8 00501021 */  addu      $v0, $v0, $s0
/* 3B5FAC E00B42BC 44826000 */  mtc1      $v0, $f12
/* 3B5FB0 E00B42C0 00000000 */  nop
/* 3B5FB4 E00B42C4 0C080140 */  jal       shim_sin_deg
/* 3B5FB8 E00B42C8 46806320 */   cvt.s.w  $f12, $f12
/* 3B5FBC E00B42CC 4490A000 */  mtc1      $s0, $f20
/* 3B5FC0 E00B42D0 00000000 */  nop
/* 3B5FC4 E00B42D4 4680A520 */  cvt.s.w   $f20, $f20
/* 3B5FC8 E00B42D8 3C01E00B */  lui       $at, (0xE00B4ED0 >> 16)
/* 3B5FCC E00B42DC D4224ED0 */  ldc1      $f2, (0xE00B4ED0 & 0xFFFF)($at)
/* 3B5FD0 E00B42E0 4600A521 */  cvt.d.s   $f20, $f20
/* 3B5FD4 E00B42E4 4622A502 */  mul.d     $f20, $f20, $f2
/* 3B5FD8 E00B42E8 00000000 */  nop
/* 3B5FDC E00B42EC 3C014200 */  lui       $at, (0x42000000 >> 16)
/* 3B5FE0 E00B42F0 4481C000 */  mtc1      $at, $f24
/* 3B5FE4 E00B42F4 00000000 */  nop
/* 3B5FE8 E00B42F8 46180002 */  mul.s     $f0, $f0, $f24
/* 3B5FEC E00B42FC 00000000 */  nop
/* 3B5FF0 E00B4300 3C0140C0 */  lui       $at, (0x40C00000 >> 16)
/* 3B5FF4 E00B4304 44816000 */  mtc1      $at, $f12
/* 3B5FF8 E00B4308 4620A520 */  cvt.s.d   $f20, $f20
/* 3B5FFC E00B430C 460CA302 */  mul.s     $f12, $f20, $f12
/* 3B6000 E00B4310 00000000 */  nop
/* 3B6004 E00B4314 3C0142FE */  lui       $at, (0x42FE0000 >> 16)
/* 3B6008 E00B4318 44811000 */  mtc1      $at, $f2
/* 3B600C E00B431C 00000000 */  nop
/* 3B6010 E00B4320 46020000 */  add.s     $f0, $f0, $f2
/* 3B6014 E00B4324 4600038D */  trunc.w.s $f14, $f0
/* 3B6018 E00B4328 0C080140 */  jal       shim_sin_deg
/* 3B601C E00B432C E62E001C */   swc1     $f14, 0x1C($s1)
/* 3B6020 E00B4330 4600A306 */  mov.s     $f12, $f20
/* 3B6024 E00B4334 0C080140 */  jal       shim_sin_deg
/* 3B6028 E00B4338 46000586 */   mov.s    $f22, $f0
/* 3B602C E00B433C 4614A300 */  add.s     $f12, $f20, $f20
/* 3B6030 E00B4340 0C080144 */  jal       shim_cos_deg
/* 3B6034 E00B4344 46000686 */   mov.s    $f26, $f0
/* 3B6038 E00B4348 4600A306 */  mov.s     $f12, $f20
/* 3B603C E00B434C 0C080144 */  jal       shim_cos_deg
/* 3B6040 E00B4350 46000506 */   mov.s    $f20, $f0
/* 3B6044 E00B4354 4618B582 */  mul.s     $f22, $f22, $f24
/* 3B6048 E00B4358 00000000 */  nop
/* 3B604C E00B435C 4618A502 */  mul.s     $f20, $f20, $f24
/* 3B6050 E00B4360 00000000 */  nop
/* 3B6054 E00B4364 46180002 */  mul.s     $f0, $f0, $f24
/* 3B6058 E00B4368 00000000 */  nop
/* 3B605C E00B436C 461AB582 */  mul.s     $f22, $f22, $f26
/* 3B6060 E00B4370 00000000 */  nop
/* 3B6064 E00B4374 3C014380 */  lui       $at, (0x43800000 >> 16)
/* 3B6068 E00B4378 44811000 */  mtc1      $at, $f2
/* 3B606C E00B437C 00000000 */  nop
/* 3B6070 E00B4380 4602B580 */  add.s     $f22, $f22, $f2
/* 3B6074 E00B4384 C6220034 */  lwc1      $f2, 0x34($s1)
/* 3B6078 E00B4388 3C01E00B */  lui       $at, (0xE00B4ED8 >> 16)
/* 3B607C E00B438C D4244ED8 */  ldc1      $f4, (0xE00B4ED8 & 0xFFFF)($at)
/* 3B6080 E00B4390 460010A1 */  cvt.d.s   $f2, $f2
/* 3B6084 E00B4394 46241080 */  add.d     $f2, $f2, $f4
/* 3B6088 E00B4398 4614B580 */  add.s     $f22, $f22, $f20
/* 3B608C E00B439C 3C014300 */  lui       $at, (0x43000000 >> 16)
/* 3B6090 E00B43A0 44812000 */  mtc1      $at, $f4
/* 3B6094 E00B43A4 4600B580 */  add.s     $f22, $f22, $f0
/* 3B6098 E00B43A8 462010A0 */  cvt.s.d   $f2, $f2
/* 3B609C E00B43AC E6220034 */  swc1      $f2, 0x34($s1)
/* 3B60A0 E00B43B0 4602203E */  c.le.s    $f4, $f2
/* 3B60A4 E00B43B4 00000000 */  nop
/* 3B60A8 E00B43B8 45000002 */  bc1f      .LE00B43C4
/* 3B60AC E00B43BC E6360030 */   swc1     $f22, 0x30($s1)
/* 3B60B0 E00B43C0 AE200034 */  sw        $zero, 0x34($s1)
.LE00B43C4:
/* 3B60B4 E00B43C4 0000902D */  daddu     $s2, $zero, $zero
/* 3B60B8 E00B43C8 0220802D */  daddu     $s0, $s1, $zero
.LE00B43CC:
/* 3B60BC E00B43CC 8E020088 */  lw        $v0, 0x88($s0)
/* 3B60C0 E00B43D0 24420001 */  addiu     $v0, $v0, 0x1
/* 3B60C4 E00B43D4 04400047 */  bltz      $v0, .LE00B44F4
/* 3B60C8 E00B43D8 AE020088 */   sw       $v0, 0x88($s0)
/* 3B60CC E00B43DC 1440001E */  bnez      $v0, .LE00B4458
/* 3B60D0 E00B43E0 2404000A */   addiu    $a0, $zero, 0xA
/* 3B60D4 E00B43E4 3C014370 */  lui       $at, (0x43700000 >> 16)
/* 3B60D8 E00B43E8 44810000 */  mtc1      $at, $f0
/* 3B60DC E00B43EC AE000038 */  sw        $zero, 0x38($s0)
/* 3B60E0 E00B43F0 0C080138 */  jal       shim_rand_int
/* 3B60E4 E00B43F4 E6000048 */   swc1     $f0, 0x48($s0)
/* 3B60E8 E00B43F8 2442FFFB */  addiu     $v0, $v0, -0x5
/* 3B60EC E00B43FC 3C01E00B */  lui       $at, (0xE00B4EE0 >> 16)
/* 3B60F0 E00B4400 D4224EE0 */  ldc1      $f2, (0xE00B4EE0 & 0xFFFF)($at)
/* 3B60F4 E00B4404 44820000 */  mtc1      $v0, $f0
/* 3B60F8 E00B4408 00000000 */  nop
/* 3B60FC E00B440C 46800021 */  cvt.d.w   $f0, $f0
/* 3B6100 E00B4410 46220002 */  mul.d     $f0, $f0, $f2
/* 3B6104 E00B4414 00000000 */  nop
/* 3B6108 E00B4418 2404000A */  addiu     $a0, $zero, 0xA
/* 3B610C E00B441C 46200020 */  cvt.s.d   $f0, $f0
/* 3B6110 E00B4420 0C080138 */  jal       shim_rand_int
/* 3B6114 E00B4424 E6000058 */   swc1     $f0, 0x58($s0)
/* 3B6118 E00B4428 2404000A */  addiu     $a0, $zero, 0xA
/* 3B611C E00B442C 24420002 */  addiu     $v0, $v0, 0x2
/* 3B6120 E00B4430 44820000 */  mtc1      $v0, $f0
/* 3B6124 E00B4434 00000000 */  nop
/* 3B6128 E00B4438 46800020 */  cvt.s.w   $f0, $f0
/* 3B612C E00B443C 0C080138 */  jal       shim_rand_int
/* 3B6130 E00B4440 E6000068 */   swc1     $f0, 0x68($s0)
/* 3B6134 E00B4444 24420001 */  addiu     $v0, $v0, 0x1
/* 3B6138 E00B4448 44820000 */  mtc1      $v0, $f0
/* 3B613C E00B444C 00000000 */  nop
/* 3B6140 E00B4450 46800020 */  cvt.s.w   $f0, $f0
/* 3B6144 E00B4454 E6000078 */  swc1      $f0, 0x78($s0)
.LE00B4458:
/* 3B6148 E00B4458 C6060058 */  lwc1      $f6, 0x58($s0)
/* 3B614C E00B445C 3C01E00B */  lui       $at, (0xE00B4EE8 >> 16)
/* 3B6150 E00B4460 D4204EE8 */  ldc1      $f0, (0xE00B4EE8 & 0xFFFF)($at)
/* 3B6154 E00B4464 460031A1 */  cvt.d.s   $f6, $f6
/* 3B6158 E00B4468 46203182 */  mul.d     $f6, $f6, $f0
/* 3B615C E00B446C 00000000 */  nop
/* 3B6160 E00B4470 C6040068 */  lwc1      $f4, 0x68($s0)
/* 3B6164 E00B4474 3C014120 */  lui       $at, (0x41200000 >> 16)
/* 3B6168 E00B4478 44811000 */  mtc1      $at, $f2
/* 3B616C E00B447C 00000000 */  nop
/* 3B6170 E00B4480 46041081 */  sub.s     $f2, $f2, $f4
/* 3B6174 E00B4484 3C01E00B */  lui       $at, (0xE00B4EF0 >> 16)
/* 3B6178 E00B4488 D4204EF0 */  ldc1      $f0, (0xE00B4EF0 & 0xFFFF)($at)
/* 3B617C E00B448C 460010A1 */  cvt.d.s   $f2, $f2
/* 3B6180 E00B4490 46201082 */  mul.d     $f2, $f2, $f0
/* 3B6184 E00B4494 00000000 */  nop
/* 3B6188 E00B4498 C6080048 */  lwc1      $f8, 0x48($s0)
/* 3B618C E00B449C C60A0058 */  lwc1      $f10, 0x58($s0)
/* 3B6190 E00B44A0 46002006 */  mov.s     $f0, $f4
/* 3B6194 E00B44A4 46004200 */  add.s     $f8, $f8, $f0
/* 3B6198 E00B44A8 C6000038 */  lwc1      $f0, 0x38($s0)
/* 3B619C E00B44AC 460A0000 */  add.s     $f0, $f0, $f10
/* 3B61A0 E00B44B0 E6080048 */  swc1      $f8, 0x48($s0)
/* 3B61A4 E00B44B4 46004286 */  mov.s     $f10, $f8
/* 3B61A8 E00B44B8 3C0143F0 */  lui       $at, (0x43F00000 >> 16)
/* 3B61AC E00B44BC 44814000 */  mtc1      $at, $f8
/* 3B61B0 E00B44C0 46002121 */  cvt.d.s   $f4, $f4
/* 3B61B4 E00B44C4 460A403C */  c.lt.s    $f8, $f10
/* 3B61B8 E00B44C8 E6000038 */  swc1      $f0, 0x38($s0)
/* 3B61BC E00B44CC 46222100 */  add.d     $f4, $f4, $f2
/* 3B61C0 E00B44D0 462031A0 */  cvt.s.d   $f6, $f6
/* 3B61C4 E00B44D4 E6060058 */  swc1      $f6, 0x58($s0)
/* 3B61C8 E00B44D8 46202120 */  cvt.s.d   $f4, $f4
/* 3B61CC E00B44DC 45000005 */  bc1f      .LE00B44F4
/* 3B61D0 E00B44E0 E6040068 */   swc1     $f4, 0x68($s0)
/* 3B61D4 E00B44E4 0C080138 */  jal       shim_rand_int
/* 3B61D8 E00B44E8 2404000A */   addiu    $a0, $zero, 0xA
/* 3B61DC E00B44EC 00021027 */  nor       $v0, $zero, $v0
/* 3B61E0 E00B44F0 AE020088 */  sw        $v0, 0x88($s0)
.LE00B44F4:
/* 3B61E4 E00B44F4 26520001 */  addiu     $s2, $s2, 0x1
/* 3B61E8 E00B44F8 2A420004 */  slti      $v0, $s2, 0x4
/* 3B61EC E00B44FC 1440FFB3 */  bnez      $v0, .LE00B43CC
/* 3B61F0 E00B4500 26100004 */   addiu    $s0, $s0, 0x4
.LE00B4504:
/* 3B61F4 E00B4504 8FBF0024 */  lw        $ra, 0x24($sp)
/* 3B61F8 E00B4508 8FB20020 */  lw        $s2, 0x20($sp)
/* 3B61FC E00B450C 8FB1001C */  lw        $s1, 0x1C($sp)
/* 3B6200 E00B4510 8FB00018 */  lw        $s0, 0x18($sp)
/* 3B6204 E00B4514 D7BA0040 */  ldc1      $f26, 0x40($sp)
/* 3B6208 E00B4518 D7B80038 */  ldc1      $f24, 0x38($sp)
/* 3B620C E00B451C D7B60030 */  ldc1      $f22, 0x30($sp)
/* 3B6210 E00B4520 D7B40028 */  ldc1      $f20, 0x28($sp)
/* 3B6214 E00B4524 03E00008 */  jr        $ra
/* 3B6218 E00B4528 27BD0048 */   addiu    $sp, $sp, 0x48

### DECOMPILED C INSTRUCTIONS:

void water_block_update(EffectInstance* effect) {
    WaterBlockFXData *data;
    f32 temp_f20;
    s32 temp_a0;
    s32 temp_s0;
    s32 temp_v1_3;
    s32 i;

    data = effect->data.waterBlock;
    temp_a0 = data->unk_00;
    if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
        if (temp_a0 == 1) {
            effect->flags = effect->flags & ~FX_INSTANCE_FLAG_DISMISS;
            data->unk_10 = 4;
        } else {
            effect->flags = effect->flags & ~FX_INSTANCE_FLAG_DISMISS;
            data->unk_10 = 16;
        }
    }

    if (data->unk_10 < 1000) {
        data->unk_10--;
    }

    data->unk_14++;
    if (data->unk_14 > 324000) {
        data->unk_14 = 256;
    }

    temp_v1_3 = data->unk_10;
    if (temp_v1_3 < 0) {
        if (temp_a0 == 1) {
            shim_load_effect(EFFECT_WATER_SPLASH);
            water_splash_main(0, data->pos.x, data->pos.y + 24.0f, data->pos.z, 2.0f, 0x1E);
            water_splash_main(1, data->pos.x, data->pos.y + 24.0f, data->pos.z, 2.0f, 0x1E);
        }
        shim_remove_effect(effect);
        return;
    }
    temp_s0 = data->unk_14;
    if (temp_a0 == 0) {
        if (temp_v1_3 < 16) {
            data->unk_24 = temp_v1_3 * 16;
            data->unk_28 = temp_v1_3 * 16;
        }
        if (temp_s0 < 16) {
            data->unk_24 = (temp_s0 * 16) + 15;
            data->unk_28 = (temp_s0 * 16) + 15;
        }
    } else if (temp_s0 < 4) {
        data->unk_24 = (temp_s0 * 64) + 63;
        data->unk_28 = (temp_s0 * 64) + 63;
    }

    data->unk_1C = shim_sin_deg((temp_s0 * 6) + temp_s0) * 32.0f + 127.0f;
    temp_f20 = (f32)temp_s0 * 0.01;
    data->unk_30 = (shim_sin_deg(temp_f20 * 6.0f) * 32.0f * shim_sin_deg(temp_f20)) + 256.0f + (shim_cos_deg(2.0f * temp_f20) * 32.0f) + (shim_cos_deg(temp_f20) * 32.0f);
    data->unk_34 += 0.2;
    if (data->unk_34 >= 128.0f) {
        data->unk_34 = 0.0f;
    }

    for (i = 0; i < NUM_WATER_BLOCK_COMPONENTS; i++) {
        data->unk_88[i]++;
        if (data->unk_88[i] >= 0) {
            if (data->unk_88[i] == 0) {
                data->unk_38[i] = 0.0f;
                data->unk_48[i] = 240.0f;
                data->unk_58[i] = (shim_rand_int(10) - 5) * 0.2;
                data->unk_68[i] = shim_rand_int(10) + 2;
                data->unk_78[i] = shim_rand_int(10) + 1;
            }
            data->unk_48[i] += data->unk_68[i];
            data->unk_38[i] += data->unk_58[i];
            data->unk_58[i] *= 0.97;
            data->unk_68[i] += (10.0f - data->unk_68[i]) * 0.1;
            if (data->unk_48[i] > 480.0f) {
                data->unk_88[i] = ~shim_rand_int(10);
            }
        }
    }
}