### RAW ASSEMBLY INSTRUCTIONS:

glabel func_8003646C
/* 1186C 8003646C 27BDFFE8 */  addiu     $sp, $sp, -0x18
/* 11870 80036470 AFB00010 */  sw        $s0, 0x10($sp)
/* 11874 80036474 3C10800A */  lui       $s0, %hi(gMapTransitionState)
/* 11878 80036478 26100944 */  addiu     $s0, $s0, %lo(gMapTransitionState)
/* 1187C 8003647C 24020002 */  addiu     $v0, $zero, 0x2
/* 11880 80036480 AFBF0014 */  sw        $ra, 0x14($sp)
/* 11884 80036484 86030000 */  lh        $v1, 0x0($s0)
/* 11888 80036488 96070000 */  lhu       $a3, 0x0($s0)
/* 1188C 8003648C 1062001A */  beq       $v1, $v0, .L800364F8
/* 11890 80036490 28620003 */   slti     $v0, $v1, 0x3
/* 11894 80036494 10400005 */  beqz      $v0, .L800364AC
/* 11898 80036498 24020001 */   addiu    $v0, $zero, 0x1
/* 1189C 8003649C 1062000A */  beq       $v1, $v0, .L800364C8
/* 118A0 800364A0 00000000 */   nop
/* 118A4 800364A4 0800D984 */  j         .L80036610
/* 118A8 800364A8 00000000 */   nop
.L800364AC:
/* 118AC 800364AC 24020003 */  addiu     $v0, $zero, 0x3
/* 118B0 800364B0 1062002A */  beq       $v1, $v0, .L8003655C
/* 118B4 800364B4 24020004 */   addiu    $v0, $zero, 0x4
/* 118B8 800364B8 1062003C */  beq       $v1, $v0, .L800365AC
/* 118BC 800364BC 00000000 */   nop
/* 118C0 800364C0 0800D984 */  j         .L80036610
/* 118C4 800364C4 00000000 */   nop
.L800364C8:
/* 118C8 800364C8 3C03800A */  lui       $v1, %hi(gOverrideFlags)
/* 118CC 800364CC 2463A650 */  addiu     $v1, $v1, %lo(gOverrideFlags)
/* 118D0 800364D0 8C620000 */  lw        $v0, 0x0($v1)
/* 118D4 800364D4 34420008 */  ori       $v0, $v0, 0x8
/* 118D8 800364D8 0C018028 */  jal       nuContRmbForceStop
/* 118DC 800364DC AC620000 */   sw       $v0, 0x0($v1)
/* 118E0 800364E0 96020000 */  lhu       $v0, 0x0($s0)
/* 118E4 800364E4 24030004 */  addiu     $v1, $zero, 0x4
/* 118E8 800364E8 3C01800A */  lui       $at, %hi(gMapTransitionStateTime)
/* 118EC 800364EC A4230946 */  sh        $v1, %lo(gMapTransitionStateTime)($at)
/* 118F0 800364F0 0800D955 */  j         .L80036554
/* 118F4 800364F4 24420001 */   addiu    $v0, $v0, 0x1
.L800364F8:
/* 118F8 800364F8 3C04800A */  lui       $a0, %hi(gMapTransitionStateTime)
/* 118FC 800364FC 24840946 */  addiu     $a0, $a0, %lo(gMapTransitionStateTime)
/* 11900 80036500 84820000 */  lh        $v0, 0x0($a0)
/* 11904 80036504 94830000 */  lhu       $v1, 0x0($a0)
/* 11908 80036508 10400003 */  beqz      $v0, .L80036518
/* 1190C 8003650C 2462FFFF */   addiu    $v0, $v1, -0x1
/* 11910 80036510 0800D984 */  j         .L80036610
/* 11914 80036514 A4820000 */   sh       $v0, 0x0($a0)
.L80036518:
/* 11918 80036518 3C038007 */  lui       $v1, %hi(gGameStatusPtr)
/* 1191C 8003651C 2463419C */  addiu     $v1, $v1, %lo(gGameStatusPtr)
/* 11920 80036520 8C620000 */  lw        $v0, 0x0($v1)
/* 11924 80036524 A0400070 */  sb        $zero, 0x70($v0)
/* 11928 80036528 8C620000 */  lw        $v0, 0x0($v1)
/* 1192C 8003652C A0400078 */  sb        $zero, 0x78($v0)
/* 11930 80036530 8C620000 */  lw        $v0, 0x0($v1)
/* 11934 80036534 84440086 */  lh        $a0, 0x86($v0)
/* 11938 80036538 8445008C */  lh        $a1, 0x8C($v0)
/* 1193C 8003653C 0C0169BD */  jal       load_map_by_IDs
/* 11940 80036540 0000302D */   daddu    $a2, $zero, $zero
/* 11944 80036544 0C018030 */  jal       nuContRmbForceStopEnd
/* 11948 80036548 00000000 */   nop
/* 1194C 8003654C 96020000 */  lhu       $v0, 0x0($s0)
/* 11950 80036550 24420001 */  addiu     $v0, $v0, 0x1
.L80036554:
/* 11954 80036554 0800D984 */  j         .L80036610
/* 11958 80036558 A6020000 */   sh       $v0, 0x0($s0)
.L8003655C:
/* 1195C 8003655C 0C00F949 */  jal       update_encounters
/* 11960 80036560 00000000 */   nop
/* 11964 80036564 0C00E64C */  jal       update_npcs
/* 11968 80036568 00000000 */   nop
/* 1196C 8003656C 3C028007 */  lui       $v0, %hi(gGameStatusPtr)
/* 11970 80036570 8C42419C */  lw        $v0, %lo(gGameStatusPtr)($v0)
/* 11974 80036574 0C0B1059 */  jal       does_script_exist
/* 11978 80036578 8C44006C */   lw       $a0, 0x6C($v0)
/* 1197C 8003657C 1440002C */  bnez      $v0, .L80036630
/* 11980 80036580 00000000 */   nop
/* 11984 80036584 3C05800A */  lui       $a1, %hi(gOverrideFlags)
/* 11988 80036588 24A5A650 */  addiu     $a1, $a1, %lo(gOverrideFlags)
/* 1198C 8003658C 2404FFF7 */  addiu     $a0, $zero, -0x9
/* 11990 80036590 8CA20000 */  lw        $v0, 0x0($a1)
/* 11994 80036594 96030000 */  lhu       $v1, 0x0($s0)
/* 11998 80036598 00441024 */  and       $v0, $v0, $a0
/* 1199C 8003659C 24630001 */  addiu     $v1, $v1, 0x1
/* 119A0 800365A0 ACA20000 */  sw        $v0, 0x0($a1)
/* 119A4 800365A4 0800D984 */  j         .L80036610
/* 119A8 800365A8 A6030000 */   sh       $v1, 0x0($s0)
.L800365AC:
/* 119AC 800365AC 3C06800A */  lui       $a2, %hi(gMapTransitionAlpha)
/* 119B0 800365B0 24C60940 */  addiu     $a2, $a2, %lo(gMapTransitionAlpha)
/* 119B4 800365B4 94C20000 */  lhu       $v0, 0x0($a2)
/* 119B8 800365B8 3C03800A */  lui       $v1, %hi(gMapTransitionFadeRate)
/* 119BC 800365BC 94630942 */  lhu       $v1, %lo(gMapTransitionFadeRate)($v1)
/* 119C0 800365C0 00431023 */  subu      $v0, $v0, $v1
/* 119C4 800365C4 A4C20000 */  sh        $v0, 0x0($a2)
/* 119C8 800365C8 00021400 */  sll       $v0, $v0, 16
/* 119CC 800365CC 04410008 */  bgez      $v0, .L800365F0
/* 119D0 800365D0 240400FF */   addiu    $a0, $zero, 0xFF
/* 119D4 800365D4 3C05BF80 */  lui       $a1, (0xBF800000 >> 16)
/* 119D8 800365D8 24E20001 */  addiu     $v0, $a3, 0x1
/* 119DC 800365DC A4C00000 */  sh        $zero, 0x0($a2)
/* 119E0 800365E0 0C04DF62 */  jal       set_screen_overlay_params_front
/* 119E4 800365E4 A6020000 */   sh       $v0, 0x0($s0)
/* 119E8 800365E8 0C00CD3C */  jal       set_game_mode
/* 119EC 800365EC 24040004 */   addiu    $a0, $zero, 0x4
.L800365F0:
/* 119F0 800365F0 0C00E64C */  jal       update_npcs
/* 119F4 800365F4 00000000 */   nop
/* 119F8 800365F8 0C037DD0 */  jal       update_player
/* 119FC 800365FC 00000000 */   nop
/* 11A00 80036600 0C016754 */  jal       update_effects
/* 11A04 80036604 00000000 */   nop
/* 11A08 80036608 0C00B500 */  jal       update_cameras
/* 11A0C 8003660C 00000000 */   nop
.L80036610:
/* 11A10 80036610 3C02800A */  lui       $v0, %hi(gMapTransitionAlpha)
/* 11A14 80036614 84420940 */  lh        $v0, %lo(gMapTransitionAlpha)($v0)
/* 11A18 80036618 44820000 */  mtc1      $v0, $f0
/* 11A1C 8003661C 00000000 */  nop
/* 11A20 80036620 46800020 */  cvt.s.w   $f0, $f0
/* 11A24 80036624 44050000 */  mfc1      $a1, $f0
/* 11A28 80036628 0C04DF62 */  jal       set_screen_overlay_params_front
/* 11A2C 8003662C 0000202D */   daddu    $a0, $zero, $zero
.L80036630:
/* 11A30 80036630 8FBF0014 */  lw        $ra, 0x14($sp)
/* 11A34 80036634 8FB00010 */  lw        $s0, 0x10($sp)
/* 11A38 80036638 03E00008 */  jr        $ra
/* 11A3C 8003663C 27BD0018 */   addiu    $sp, $sp, 0x18

### DECOMPILED C INSTRUCTIONS:

void func_8003646C(void) {
    switch (gMapTransitionState) {
        case 1:
            gOverrideFlags |= GLOBAL_OVERRIDES_8;
            nuContRmbForceStop();
            gMapTransitionStateTime = 4;
            gMapTransitionState++;
            break;
        case 2:
            if (gMapTransitionStateTime != 0) {
                gMapTransitionStateTime--;
            } else {
                gGameStatusPtr->isBattle = FALSE;
                gGameStatusPtr->disableScripts = FALSE;
                load_map_by_IDs(gGameStatusPtr->areaID, gGameStatusPtr->mapID, 0);
                nuContRmbForceStopEnd();
                gMapTransitionState++;
            }
            break;
        case 3:
            update_encounters();
            update_npcs();
            if (!does_script_exist(gGameStatusPtr->mainScriptID)) {
                gOverrideFlags &= ~GLOBAL_OVERRIDES_8;
                gMapTransitionState++;
                break;
            }
            return;
        case 4:
            gMapTransitionAlpha -= gMapTransitionFadeRate;
            if (gMapTransitionAlpha < 0) {
                gMapTransitionAlpha = 0;
                gMapTransitionState++;
                set_screen_overlay_params_front(OVERLAY_NONE, -1.0f);
                set_game_mode(GAME_MODE_CHANGE_MAP);
            }
            update_npcs();
            update_player();
            update_effects();
            update_cameras();
            break;
    }

    set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, gMapTransitionAlpha);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel footprint_appendGfx
/* 32F958 E00183D8 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* 32F95C E00183DC 0080602D */  daddu     $t4, $a0, $zero
/* 32F960 E00183E0 3C05DB06 */  lui       $a1, (0xDB060024 >> 16)
/* 32F964 E00183E4 34A50024 */  ori       $a1, $a1, (0xDB060024 & 0xFFFF)
/* 32F968 E00183E8 3C06800A */  lui       $a2, %hi(gMainGfxPos)
/* 32F96C E00183EC 24C6A66C */  addiu     $a2, $a2, %lo(gMainGfxPos)
/* 32F970 E00183F0 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 32F974 E00183F4 AFB7001C */  sw        $s7, 0x1C($sp)
/* 32F978 E00183F8 AFB60018 */  sw        $s6, 0x18($sp)
/* 32F97C E00183FC AFB50014 */  sw        $s5, 0x14($sp)
/* 32F980 E0018400 AFB40010 */  sw        $s4, 0x10($sp)
/* 32F984 E0018404 AFB3000C */  sw        $s3, 0xC($sp)
/* 32F988 E0018408 AFB20008 */  sw        $s2, 0x8($sp)
/* 32F98C E001840C AFB10004 */  sw        $s1, 0x4($sp)
/* 32F990 E0018410 AFB00000 */  sw        $s0, 0x0($sp)
/* 32F994 E0018414 8CC40000 */  lw        $a0, 0x0($a2)
/* 32F998 E0018418 8D88000C */  lw        $t0, 0xC($t4)
/* 32F99C E001841C 0080182D */  daddu     $v1, $a0, $zero
/* 32F9A0 E0018420 24840008 */  addiu     $a0, $a0, 0x8
/* 32F9A4 E0018424 AC620000 */  sw        $v0, 0x0($v1)
/* 32F9A8 E0018428 AC600004 */  sw        $zero, 0x4($v1)
/* 32F9AC E001842C AC850000 */  sw        $a1, 0x0($a0)
/* 32F9B0 E0018430 8D820010 */  lw        $v0, 0x10($t4)
/* 32F9B4 E0018434 0000482D */  daddu     $t1, $zero, $zero
/* 32F9B8 E0018438 ACC40000 */  sw        $a0, 0x0($a2)
/* 32F9BC E001843C 8C42001C */  lw        $v0, 0x1C($v0)
/* 32F9C0 E0018440 3C038000 */  lui       $v1, (0x80000000 >> 16)
/* 32F9C4 E0018444 00431021 */  addu      $v0, $v0, $v1
/* 32F9C8 E0018448 AC820004 */  sw        $v0, 0x4($a0)
/* 32F9CC E001844C 8D820008 */  lw        $v0, 0x8($t4)
/* 32F9D0 E0018450 24840008 */  addiu     $a0, $a0, 0x8
/* 32F9D4 E0018454 1840004A */  blez      $v0, .LE0018580
/* 32F9D8 E0018458 ACC40000 */   sw       $a0, 0x0($a2)
/* 32F9DC E001845C 3C0F800A */  lui       $t7, %hi(gDisplayContext)
/* 32F9E0 E0018460 25EFA674 */  addiu     $t7, $t7, %lo(gDisplayContext)
/* 32F9E4 E0018464 3C0D8007 */  lui       $t5, %hi(gMatrixListPos)
/* 32F9E8 E0018468 25AD41F0 */  addiu     $t5, $t5, %lo(gMatrixListPos)
/* 32F9EC E001846C 3C0B0001 */  lui       $t3, (0x11630 >> 16)
/* 32F9F0 E0018470 356B1630 */  ori       $t3, $t3, (0x11630 & 0xFFFF)
/* 32F9F4 E0018474 00C0502D */  daddu     $t2, $a2, $zero
/* 32F9F8 E0018478 3C13FA00 */  lui       $s3, (0xFA000000 >> 16)
/* 32F9FC E001847C 3C197060 */  lui       $t9, (0x70601800 >> 16)
/* 32FA00 E0018480 37391800 */  ori       $t9, $t9, (0x70601800 & 0xFFFF)
/* 32FA04 E0018484 3C12DA38 */  lui       $s2, (0xDA380000 >> 16)
/* 32FA08 E0018488 3C11DE00 */  lui       $s1, (0xDE000000 >> 16)
/* 32FA0C E001848C 3C18D838 */  lui       $t8, (0xD8380002 >> 16)
/* 32FA10 E0018490 37180002 */  ori       $t8, $t8, (0xD8380002 & 0xFFFF)
/* 32FA14 E0018494 24100040 */  addiu     $s0, $zero, 0x40
/* 32FA18 E0018498 25070070 */  addiu     $a3, $t0, 0x70
.LE001849C:
/* 32FA1C E001849C 8D020000 */  lw        $v0, 0x0($t0)
/* 32FA20 E00184A0 50400032 */  beql      $v0, $zero, .LE001856C
/* 32FA24 E00184A4 25290001 */   addiu    $t1, $t1, 0x1
/* 32FA28 E00184A8 3C0E0900 */  lui       $t6, %hi(D_09000240_4152A0)
/* 32FA2C E00184AC 25CE0240 */  addiu     $t6, $t6, %lo(D_09000240_4152A0)
/* 32FA30 E00184B0 25040030 */  addiu     $a0, $t0, 0x30
/* 32FA34 E00184B4 00E0282D */  daddu     $a1, $a3, $zero
/* 32FA38 E00184B8 95A20000 */  lhu       $v0, 0x0($t5)
/* 32FA3C E00184BC 8DE30000 */  lw        $v1, 0x0($t7)
/* 32FA40 E00184C0 00021180 */  sll       $v0, $v0, 6
/* 32FA44 E00184C4 00621821 */  addu      $v1, $v1, $v0
/* 32FA48 E00184C8 006B1821 */  addu      $v1, $v1, $t3
.LE00184CC:
/* 32FA4C E00184CC 8C940000 */  lw        $s4, 0x0($a0)
/* 32FA50 E00184D0 8C950004 */  lw        $s5, 0x4($a0)
/* 32FA54 E00184D4 8C960008 */  lw        $s6, 0x8($a0)
/* 32FA58 E00184D8 8C97000C */  lw        $s7, 0xC($a0)
/* 32FA5C E00184DC AC740000 */  sw        $s4, 0x0($v1)
/* 32FA60 E00184E0 AC750004 */  sw        $s5, 0x4($v1)
/* 32FA64 E00184E4 AC760008 */  sw        $s6, 0x8($v1)
/* 32FA68 E00184E8 AC77000C */  sw        $s7, 0xC($v1)
/* 32FA6C E00184EC 24840010 */  addiu     $a0, $a0, 0x10
/* 32FA70 E00184F0 1485FFF6 */  bne       $a0, $a1, .LE00184CC
/* 32FA74 E00184F4 24630010 */   addiu    $v1, $v1, 0x10
/* 32FA78 E00184F8 8D440000 */  lw        $a0, 0x0($t2)
/* 32FA7C E00184FC 0080302D */  daddu     $a2, $a0, $zero
/* 32FA80 E0018500 24840008 */  addiu     $a0, $a0, 0x8
/* 32FA84 E0018504 AD440000 */  sw        $a0, 0x0($t2)
/* 32FA88 E0018508 ACD30000 */  sw        $s3, 0x0($a2)
/* 32FA8C E001850C 90E5FF98 */  lbu       $a1, -0x68($a3)
/* 32FA90 E0018510 95A30000 */  lhu       $v1, 0x0($t5)
/* 32FA94 E0018514 24820008 */  addiu     $v0, $a0, 0x8
/* 32FA98 E0018518 AD420000 */  sw        $v0, 0x0($t2)
/* 32FA9C E001851C 24620001 */  addiu     $v0, $v1, 0x1
/* 32FAA0 E0018520 A5A20000 */  sh        $v0, 0x0($t5)
/* 32FAA4 E0018524 24820010 */  addiu     $v0, $a0, 0x10
/* 32FAA8 E0018528 AD420000 */  sw        $v0, 0x0($t2)
/* 32FAAC E001852C 24820018 */  addiu     $v0, $a0, 0x18
/* 32FAB0 E0018530 00B92825 */  or        $a1, $a1, $t9
/* 32FAB4 E0018534 3063FFFF */  andi      $v1, $v1, 0xFFFF
/* 32FAB8 E0018538 00031980 */  sll       $v1, $v1, 6
/* 32FABC E001853C AD420000 */  sw        $v0, 0x0($t2)
/* 32FAC0 E0018540 ACC50004 */  sw        $a1, 0x4($a2)
/* 32FAC4 E0018544 AC920000 */  sw        $s2, 0x0($a0)
/* 32FAC8 E0018548 8DE20000 */  lw        $v0, 0x0($t7)
/* 32FACC E001854C 006B1821 */  addu      $v1, $v1, $t3
/* 32FAD0 E0018550 AC910008 */  sw        $s1, 0x8($a0)
/* 32FAD4 E0018554 AC8E000C */  sw        $t6, 0xC($a0)
/* 32FAD8 E0018558 AC980010 */  sw        $t8, 0x10($a0)
/* 32FADC E001855C AC900014 */  sw        $s0, 0x14($a0)
/* 32FAE0 E0018560 00431021 */  addu      $v0, $v0, $v1
/* 32FAE4 E0018564 AC820004 */  sw        $v0, 0x4($a0)
/* 32FAE8 E0018568 25290001 */  addiu     $t1, $t1, 0x1
.LE001856C:
/* 32FAEC E001856C 24E70098 */  addiu     $a3, $a3, 0x98
/* 32FAF0 E0018570 8D820008 */  lw        $v0, 0x8($t4)
/* 32FAF4 E0018574 0122102A */  slt       $v0, $t1, $v0
/* 32FAF8 E0018578 1440FFC8 */  bnez      $v0, .LE001849C
/* 32FAFC E001857C 25080098 */   addiu    $t0, $t0, 0x98
.LE0018580:
/* 32FB00 E0018580 3C03800A */  lui       $v1, %hi(gMainGfxPos)
/* 32FB04 E0018584 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
/* 32FB08 E0018588 8C620000 */  lw        $v0, 0x0($v1)
/* 32FB0C E001858C 0040202D */  daddu     $a0, $v0, $zero
/* 32FB10 E0018590 24420008 */  addiu     $v0, $v0, 0x8
/* 32FB14 E0018594 AC620000 */  sw        $v0, 0x0($v1)
/* 32FB18 E0018598 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 32FB1C E001859C AC820000 */  sw        $v0, 0x0($a0)
/* 32FB20 E00185A0 AC800004 */  sw        $zero, 0x4($a0)
/* 32FB24 E00185A4 8FB7001C */  lw        $s7, 0x1C($sp)
/* 32FB28 E00185A8 8FB60018 */  lw        $s6, 0x18($sp)
/* 32FB2C E00185AC 8FB50014 */  lw        $s5, 0x14($sp)
/* 32FB30 E00185B0 8FB40010 */  lw        $s4, 0x10($sp)
/* 32FB34 E00185B4 8FB3000C */  lw        $s3, 0xC($sp)
/* 32FB38 E00185B8 8FB20008 */  lw        $s2, 0x8($sp)
/* 32FB3C E00185BC 8FB10004 */  lw        $s1, 0x4($sp)
/* 32FB40 E00185C0 8FB00000 */  lw        $s0, 0x0($sp)
/* 32FB44 E00185C4 03E00008 */  jr        $ra
/* 32FB48 E00185C8 27BD0020 */   addiu    $sp, $sp, 0x20
/* 32FB4C E00185CC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void footprint_appendGfx(void* effect) {
    EffectInstance* effectTemp = effect;
    FootprintFXData* part = effectTemp->data.footprint;
    s32 i;

    gDPPipeSync(gMainGfxPos++);
    gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->graphics->data));

    for (i = 0; i < effectTemp->numParts; i++, part++) {
        if (part->alive) {
            Gfx* dlist = D_09000240_32FD90;

            gDisplayContext->matrixStack[gMatrixListPos] = part->mtx;

            gDPSetPrimColor(gMainGfxPos++, 0, 0, 112, 96, 24, part->alpha);
            gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++],
                        G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
            gSPDisplayList(gMainGfxPos++, dlist);
            gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
        }
    }
    gDPPipeSync(gMainGfxPos++);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel recover_main
/* 3812C0 E0080000 27BDFFA8 */  addiu     $sp, $sp, -0x58
/* 3812C4 E0080004 F7B40040 */  sdc1      $f20, 0x40($sp)
/* 3812C8 E0080008 4485A000 */  mtc1      $a1, $f20
/* 3812CC E008000C F7B60048 */  sdc1      $f22, 0x48($sp)
/* 3812D0 E0080010 4486B000 */  mtc1      $a2, $f22
/* 3812D4 E0080014 AFB30034 */  sw        $s3, 0x34($sp)
/* 3812D8 E0080018 0080982D */  daddu     $s3, $a0, $zero
/* 3812DC E008001C F7B80050 */  sdc1      $f24, 0x50($sp)
/* 3812E0 E0080020 4487C000 */  mtc1      $a3, $f24
/* 3812E4 E0080024 27A40010 */  addiu     $a0, $sp, 0x10
/* 3812E8 E0080028 AFB00028 */  sw        $s0, 0x28($sp)
/* 3812EC E008002C 8FB00068 */  lw        $s0, 0x68($sp)
/* 3812F0 E0080030 3C02E008 */  lui       $v0, %hi(recover_init)
/* 3812F4 E0080034 244201C8 */  addiu     $v0, $v0, %lo(recover_init)
/* 3812F8 E0080038 AFA20018 */  sw        $v0, 0x18($sp)
/* 3812FC E008003C 3C02E008 */  lui       $v0, %hi(recover_update)
/* 381300 E0080040 244201D0 */  addiu     $v0, $v0, %lo(recover_update)
/* 381304 E0080044 AFA2001C */  sw        $v0, 0x1C($sp)
/* 381308 E0080048 3C02E008 */  lui       $v0, %hi(recover_render)
/* 38130C E008004C 24420424 */  addiu     $v0, $v0, %lo(recover_render)
/* 381310 E0080050 AFA20020 */  sw        $v0, 0x20($sp)
/* 381314 E0080054 3C02E008 */  lui       $v0, %hi(func_E008042C)
/* 381318 E0080058 2442042C */  addiu     $v0, $v0, %lo(func_E008042C)
/* 38131C E008005C AFA20024 */  sw        $v0, 0x24($sp)
/* 381320 E0080060 24020040 */  addiu     $v0, $zero, 0x40
/* 381324 E0080064 AFBF0038 */  sw        $ra, 0x38($sp)
/* 381328 E0080068 AFB20030 */  sw        $s2, 0x30($sp)
/* 38132C E008006C AFB1002C */  sw        $s1, 0x2C($sp)
/* 381330 E0080070 AFA00010 */  sw        $zero, 0x10($sp)
/* 381334 E0080074 0C080124 */  jal       shim_create_effect_instance
/* 381338 E0080078 AFA20014 */   sw       $v0, 0x14($sp)
/* 38133C E008007C 24040090 */  addiu     $a0, $zero, 0x90
/* 381340 E0080080 24120002 */  addiu     $s2, $zero, 0x2
/* 381344 E0080084 0040882D */  daddu     $s1, $v0, $zero
/* 381348 E0080088 0C08012C */  jal       shim_general_heap_malloc
/* 38134C E008008C AE320008 */   sw       $s2, 0x8($s1)
/* 381350 E0080090 0040182D */  daddu     $v1, $v0, $zero
/* 381354 E0080094 14600003 */  bnez      $v1, .LE00800A4
/* 381358 E0080098 AE23000C */   sw       $v1, 0xC($s1)
.LE008009C:
/* 38135C E008009C 08020027 */  j         .LE008009C
/* 381360 E00800A0 00000000 */   nop
.LE00800A4:
/* 381364 E00800A4 2402002E */  addiu     $v0, $zero, 0x2E
/* 381368 E00800A8 AC730000 */  sw        $s3, 0x0($v1)
/* 38136C E00800AC E4740004 */  swc1      $f20, 0x4($v1)
/* 381370 E00800B0 E4760008 */  swc1      $f22, 0x8($v1)
/* 381374 E00800B4 E478000C */  swc1      $f24, 0xC($v1)
/* 381378 E00800B8 AC62002C */  sw        $v0, 0x2C($v1)
/* 38137C E00800BC 06010005 */  bgez      $s0, .LE00800D4
/* 381380 E00800C0 AC600030 */   sw       $zero, 0x30($v1)
/* 381384 E00800C4 24020001 */  addiu     $v0, $zero, 0x1
/* 381388 E00800C8 AC620044 */  sw        $v0, 0x44($v1)
/* 38138C E00800CC 08020036 */  j         .LE00800D8
/* 381390 E00800D0 00108023 */   negu     $s0, $s0
.LE00800D4:
/* 381394 E00800D4 AC600044 */  sw        $zero, 0x44($v1)
.LE00800D8:
/* 381398 E00800D8 AC700040 */  sw        $s0, 0x40($v1)
/* 38139C E00800DC 24050001 */  addiu     $a1, $zero, 0x1
/* 3813A0 E00800E0 00B2102A */  slt       $v0, $a1, $s2
/* 3813A4 E00800E4 1040002D */  beqz      $v0, .LE008019C
/* 3813A8 E00800E8 24630048 */   addiu    $v1, $v1, 0x48
/* 3813AC E00800EC 00A0382D */  daddu     $a3, $a1, $zero
/* 3813B0 E00800F0 3C013FB3 */  lui       $at, (0x3FB33333 >> 16)
/* 3813B4 E00800F4 34213333 */  ori       $at, $at, (0x3FB33333 & 0xFFFF)
/* 3813B8 E00800F8 44811000 */  mtc1      $at, $f2
/* 3813BC E00800FC 240600FF */  addiu     $a2, $zero, 0xFF
/* 3813C0 E0080100 24640028 */  addiu     $a0, $v1, 0x28
.LE0080104:
/* 3813C4 E0080104 AC80FFDC */  sw        $zero, -0x24($a0)
/* 3813C8 E0080108 AC80FFE0 */  sw        $zero, -0x20($a0)
/* 3813CC E008010C AC80FFE4 */  sw        $zero, -0x1C($a0)
/* 3813D0 E0080110 AC80FFFC */  sw        $zero, -0x4($a0)
/* 3813D4 E0080114 AC80FFE8 */  sw        $zero, -0x18($a0)
/* 3813D8 E0080118 AC80FFF0 */  sw        $zero, -0x10($a0)
/* 3813DC E008011C AC80FFF8 */  sw        $zero, -0x8($a0)
/* 3813E0 E0080120 14A70007 */  bne       $a1, $a3, .LE0080140
/* 3813E4 E0080124 AC80FFF4 */   sw       $zero, -0xC($a0)
/* 3813E8 E0080128 AC80FFDC */  sw        $zero, -0x24($a0)
/* 3813EC E008012C AC80000C */  sw        $zero, 0xC($a0)
/* 3813F0 E0080130 AC800010 */  sw        $zero, 0x10($a0)
/* 3813F4 E0080134 AC800014 */  sw        $zero, 0x14($a0)
/* 3813F8 E0080138 08020061 */  j         .LE0080184
/* 3813FC E008013C E482FFEC */   swc1     $f2, -0x14($a0)
.LE0080140:
/* 381400 E0080140 30A30001 */  andi      $v1, $a1, 0x1
/* 381404 E0080144 00031840 */  sll       $v1, $v1, 1
/* 381408 E0080148 2463FFFF */  addiu     $v1, $v1, -0x1
/* 38140C E008014C 24A2FFFF */  addiu     $v0, $a1, -0x1
/* 381410 E0080150 00021043 */  sra       $v0, $v0, 1
/* 381414 E0080154 00620018 */  mult      $v1, $v0
/* 381418 E0080158 24A2000A */  addiu     $v0, $a1, 0xA
/* 38141C E008015C E482FFEC */  swc1      $f2, -0x14($a0)
/* 381420 E0080160 AC82000C */  sw        $v0, 0xC($a0)
/* 381424 E0080164 AC800010 */  sw        $zero, 0x10($a0)
/* 381428 E0080168 AC800014 */  sw        $zero, 0x14($a0)
/* 38142C E008016C 00004012 */  mflo      $t0
/* 381430 E0080170 00081080 */  sll       $v0, $t0, 2
/* 381434 E0080174 44820000 */  mtc1      $v0, $f0
/* 381438 E0080178 00000000 */  nop
/* 38143C E008017C 46800020 */  cvt.s.w   $f0, $f0
/* 381440 E0080180 E480FFDC */  swc1      $f0, -0x24($a0)
.LE0080184:
/* 381444 E0080184 24A50001 */  addiu     $a1, $a1, 0x1
/* 381448 E0080188 AC800004 */  sw        $zero, 0x4($a0)
/* 38144C E008018C AC860000 */  sw        $a2, 0x0($a0)
/* 381450 E0080190 00B2102A */  slt       $v0, $a1, $s2
/* 381454 E0080194 1440FFDB */  bnez      $v0, .LE0080104
/* 381458 E0080198 24840048 */   addiu    $a0, $a0, 0x48
.LE008019C:
/* 38145C E008019C 0220102D */  daddu     $v0, $s1, $zero
/* 381460 E00801A0 8FBF0038 */  lw        $ra, 0x38($sp)
/* 381464 E00801A4 8FB30034 */  lw        $s3, 0x34($sp)
/* 381468 E00801A8 8FB20030 */  lw        $s2, 0x30($sp)
/* 38146C E00801AC 8FB1002C */  lw        $s1, 0x2C($sp)
/* 381470 E00801B0 8FB00028 */  lw        $s0, 0x28($sp)
/* 381474 E00801B4 D7B80050 */  ldc1      $f24, 0x50($sp)
/* 381478 E00801B8 D7B60048 */  ldc1      $f22, 0x48($sp)
/* 38147C E00801BC D7B40040 */  ldc1      $f20, 0x40($sp)
/* 381480 E00801C0 03E00008 */  jr        $ra
/* 381484 E00801C4 27BD0058 */   addiu    $sp, $sp, 0x58

### DECOMPILED C INSTRUCTIONS:

EffectInstance* recover_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg4) {
    EffectBlueprint bp;
    EffectInstance* effect;
    RecoverFXData* part;
    s32 numParts = 2;
    s32 i;

    bp.init = recover_init;
    bp.update = recover_update;
    bp.renderWorld = recover_render;
    bp.renderUI = func_E008042C;
    bp.unk_00 = 0;
    bp.effectID = EFFECT_RECOVER;

    effect = shim_create_effect_instance(&bp);
    effect->numParts = numParts;
    part = effect->data.recover = shim_general_heap_malloc(numParts * sizeof(*part));
    ASSERT(effect->data.recover != NULL);

    part->unk_00 = arg0;
    part->unk_04 = arg1;
    part->unk_08 = arg2;
    part->unk_0C = arg3;
    part->unk_2C = 46;
    part->unk_30 = 0;
    if (arg4 < 0) {
        part->unk_44 = 1;
        arg4 = -arg4;
    } else {
        part->unk_44 = 0;
    }
    part->unk_40 = arg4;

    part++;
    for (i = 1; i < numParts; i++, part++) {
        part->unk_04 = 0.0f;
        part->unk_08 = 0;
        part->unk_0C = 0;
        part->unk_24 = 0;
        part->unk_10 = 0;
        part->unk_18 = 0;
        part->unk_20 = 0;
        part->unk_1C = 0;
        if (i == 1) {
            part->unk_04 = 0.0f;
            part->unk_34 = 0;
            part->unk_38 = 0;
            part->unk_3C = 0;
            part->unk_14 = 1.4f;
        } else {
            part->unk_14 = 1.4f;
            part->unk_34 = i + 10;
            part->unk_38 = 0;
            part->unk_3C = 0;
            part->unk_04 = ((i & 1) * 2 - 1) * ((i - 1) >> 1) * 4;
        }
        part->unk_2C = 0;
        part->unk_28 = 255;
    }

    return effect;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_802D7690
/* FC040 802D7690 27BDFFA8 */  addiu     $sp, $sp, -0x58
/* FC044 802D7694 AFB20020 */  sw        $s2, 0x20($sp)
/* FC048 802D7698 0080902D */  daddu     $s2, $a0, $zero
/* FC04C 802D769C AFB1001C */  sw        $s1, 0x1C($sp)
/* FC050 802D76A0 00A0882D */  daddu     $s1, $a1, $zero
/* FC054 802D76A4 AFBF0024 */  sw        $ra, 0x24($sp)
/* FC058 802D76A8 AFB00018 */  sw        $s0, 0x18($sp)
/* FC05C 802D76AC F7BE0050 */  sdc1      $f30, 0x50($sp)
/* FC060 802D76B0 F7BC0048 */  sdc1      $f28, 0x48($sp)
/* FC064 802D76B4 F7BA0040 */  sdc1      $f26, 0x40($sp)
/* FC068 802D76B8 F7B80038 */  sdc1      $f24, 0x38($sp)
/* FC06C 802D76BC F7B60030 */  sdc1      $f22, 0x30($sp)
/* FC070 802D76C0 F7B40028 */  sdc1      $f20, 0x28($sp)
/* FC074 802D76C4 8E50000C */  lw        $s0, 0xC($s2)
/* FC078 802D76C8 8E050000 */  lw        $a1, 0x0($s0)
/* FC07C 802D76CC 0C0B210B */  jal       evt_get_float_variable
/* FC080 802D76D0 26100004 */   addiu    $s0, $s0, 0x4
/* FC084 802D76D4 8E050000 */  lw        $a1, 0x0($s0)
/* FC088 802D76D8 26100004 */  addiu     $s0, $s0, 0x4
/* FC08C 802D76DC 0240202D */  daddu     $a0, $s2, $zero
/* FC090 802D76E0 0C0B210B */  jal       evt_get_float_variable
/* FC094 802D76E4 E7A00010 */   swc1     $f0, 0x10($sp)
/* FC098 802D76E8 8E050000 */  lw        $a1, 0x0($s0)
/* FC09C 802D76EC 26100004 */  addiu     $s0, $s0, 0x4
/* FC0A0 802D76F0 0240202D */  daddu     $a0, $s2, $zero
/* FC0A4 802D76F4 0C0B210B */  jal       evt_get_float_variable
/* FC0A8 802D76F8 46000786 */   mov.s    $f30, $f0
/* FC0AC 802D76FC 8E050000 */  lw        $a1, 0x0($s0)
/* FC0B0 802D7700 26100004 */  addiu     $s0, $s0, 0x4
/* FC0B4 802D7704 0240202D */  daddu     $a0, $s2, $zero
/* FC0B8 802D7708 0C0B210B */  jal       evt_get_float_variable
/* FC0BC 802D770C E7A00014 */   swc1     $f0, 0x14($sp)
/* FC0C0 802D7710 8E050000 */  lw        $a1, 0x0($s0)
/* FC0C4 802D7714 26100004 */  addiu     $s0, $s0, 0x4
/* FC0C8 802D7718 0240202D */  daddu     $a0, $s2, $zero
/* FC0CC 802D771C 0C0B210B */  jal       evt_get_float_variable
/* FC0D0 802D7720 46000586 */   mov.s    $f22, $f0
/* FC0D4 802D7724 0240202D */  daddu     $a0, $s2, $zero
/* FC0D8 802D7728 8E050000 */  lw        $a1, 0x0($s0)
/* FC0DC 802D772C 0C0B1EAF */  jal       evt_get_variable
/* FC0E0 802D7730 46000706 */   mov.s    $f28, $f0
/* FC0E4 802D7734 12200002 */  beqz      $s1, .L802D7740
/* FC0E8 802D7738 0040802D */   daddu    $s0, $v0, $zero
/* FC0EC 802D773C AE400070 */  sw        $zero, 0x70($s2)
.L802D7740:
/* FC0F0 802D7740 0C00A67F */  jal       rand_int
/* FC0F4 802D7744 2404000A */   addiu    $a0, $zero, 0xA
/* FC0F8 802D7748 2442FFFB */  addiu     $v0, $v0, -0x5
/* FC0FC 802D774C 4482D000 */  mtc1      $v0, $f26
/* FC100 802D7750 00000000 */  nop
/* FC104 802D7754 4680D6A0 */  cvt.s.w   $f26, $f26
/* FC108 802D7758 0C00A67F */  jal       rand_int
/* FC10C 802D775C 2404000A */   addiu    $a0, $zero, 0xA
/* FC110 802D7760 461AD082 */  mul.s     $f2, $f26, $f26
/* FC114 802D7764 00000000 */  nop
/* FC118 802D7768 2442FFFB */  addiu     $v0, $v0, -0x5
/* FC11C 802D776C 4482C000 */  mtc1      $v0, $f24
/* FC120 802D7770 00000000 */  nop
/* FC124 802D7774 4680C620 */  cvt.s.w   $f24, $f24
/* FC128 802D7778 4618C102 */  mul.s     $f4, $f24, $f24
/* FC12C 802D777C 00000000 */  nop
/* FC130 802D7780 3C0140C9 */  lui       $at, (0x40C90FD0 >> 16)
/* FC134 802D7784 34210FD0 */  ori       $at, $at, (0x40C90FD0 & 0xFFFF)
/* FC138 802D7788 4481A000 */  mtc1      $at, $f20
/* FC13C 802D778C 00000000 */  nop
/* FC140 802D7790 4614B502 */  mul.s     $f20, $f22, $f20
/* FC144 802D7794 00000000 */  nop
/* FC148 802D7798 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
/* FC14C 802D779C 44810000 */  mtc1      $at, $f0
/* FC150 802D77A0 3C01C000 */  lui       $at, (0xC0000000 >> 16)
/* FC154 802D77A4 4481B000 */  mtc1      $at, $f22
/* FC158 802D77A8 46041080 */  add.s     $f2, $f2, $f4
/* FC15C 802D77AC 4600A503 */  div.s     $f20, $f20, $f0
/* FC160 802D77B0 3C0140A0 */  lui       $at, (0x40A00000 >> 16)
/* FC164 802D77B4 44810000 */  mtc1      $at, $f0
/* FC168 802D77B8 4600A306 */  mov.s     $f12, $f20
/* FC16C 802D77BC 46001083 */  div.s     $f2, $f2, $f0
/* FC170 802D77C0 0C00A85B */  jal       sin_rad
/* FC174 802D77C4 4602B581 */   sub.s    $f22, $f22, $f2
/* FC178 802D77C8 4600A306 */  mov.s     $f12, $f20
/* FC17C 802D77CC 0C00A874 */  jal       cos_rad
/* FC180 802D77D0 46000506 */   mov.s    $f20, $f0
/* FC184 802D77D4 461CA502 */  mul.s     $f20, $f20, $f28
/* FC188 802D77D8 00000000 */  nop
/* FC18C 802D77DC 46000007 */  neg.s     $f0, $f0
/* FC190 802D77E0 461C0002 */  mul.s     $f0, $f0, $f28
/* FC194 802D77E4 00000000 */  nop
/* FC198 802D77E8 C6420070 */  lwc1      $f2, 0x70($s2)
/* FC19C 802D77EC 468010A0 */  cvt.s.w   $f2, $f2
/* FC1A0 802D77F0 4602A502 */  mul.s     $f20, $f20, $f2
/* FC1A4 802D77F4 00000000 */  nop
/* FC1A8 802D77F8 46020002 */  mul.s     $f0, $f0, $f2
/* FC1AC 802D77FC 00000000 */  nop
/* FC1B0 802D7800 3C014178 */  lui       $at, (0x41780000 >> 16)
/* FC1B4 802D7804 44811000 */  mtc1      $at, $f2
/* FC1B8 802D7808 00000000 */  nop
/* FC1BC 802D780C 4602F080 */  add.s     $f2, $f30, $f2
/* FC1C0 802D7810 46161080 */  add.s     $f2, $f2, $f22
/* FC1C4 802D7814 C7A60010 */  lwc1      $f6, 0x10($sp)
/* FC1C8 802D7818 44051000 */  mfc1      $a1, $f2
/* FC1CC 802D781C 44901000 */  mtc1      $s0, $f2
/* FC1D0 802D7820 00000000 */  nop
/* FC1D4 802D7824 468010A0 */  cvt.s.w   $f2, $f2
/* FC1D8 802D7828 4602A503 */  div.s     $f20, $f20, $f2
/* FC1DC 802D782C 46143500 */  add.s     $f20, $f6, $f20
/* FC1E0 802D7830 C7A60014 */  lwc1      $f6, 0x14($sp)
/* FC1E4 802D7834 46020003 */  div.s     $f0, $f0, $f2
/* FC1E8 802D7838 46003000 */  add.s     $f0, $f6, $f0
/* FC1EC 802D783C 46180000 */  add.s     $f0, $f0, $f24
/* FC1F0 802D7840 461AA500 */  add.s     $f20, $f20, $f26
/* FC1F4 802D7844 44060000 */  mfc1      $a2, $f0
/* FC1F8 802D7848 4600A18D */  trunc.w.s $f6, $f20
/* FC1FC 802D784C 44043000 */  mfc1      $a0, $f6
/* FC200 802D7850 0C01BF2C */  jal       fx_cloud_trail
/* FC204 802D7854 0000382D */   daddu    $a3, $zero, $zero
/* FC208 802D7858 8E430070 */  lw        $v1, 0x70($s2)
/* FC20C 802D785C 24630001 */  addiu     $v1, $v1, 0x1
/* FC210 802D7860 0070102A */  slt       $v0, $v1, $s0
/* FC214 802D7864 38420001 */  xori      $v0, $v0, 0x1
/* FC218 802D7868 AE430070 */  sw        $v1, 0x70($s2)
/* FC21C 802D786C 8FBF0024 */  lw        $ra, 0x24($sp)
/* FC220 802D7870 8FB20020 */  lw        $s2, 0x20($sp)
/* FC224 802D7874 8FB1001C */  lw        $s1, 0x1C($sp)
/* FC228 802D7878 8FB00018 */  lw        $s0, 0x18($sp)
/* FC22C 802D787C D7BE0050 */  ldc1      $f30, 0x50($sp)
/* FC230 802D7880 D7BC0048 */  ldc1      $f28, 0x48($sp)
/* FC234 802D7884 D7BA0040 */  ldc1      $f26, 0x40($sp)
/* FC238 802D7888 D7B80038 */  ldc1      $f24, 0x38($sp)
/* FC23C 802D788C D7B60030 */  ldc1      $f22, 0x30($sp)
/* FC240 802D7890 D7B40028 */  ldc1      $f20, 0x28($sp)
/* FC244 802D7894 00021040 */  sll       $v0, $v0, 1
/* FC248 802D7898 03E00008 */  jr        $ra
/* FC24C 802D789C 27BD0058 */   addiu    $sp, $sp, 0x58

### DECOMPILED C INSTRUCTIONS:

ApiStatus func_802D7690(Evt* script, s32 isInitialCall) {
    Bytecode* args = script->ptrReadPos;
    f32 posX = evt_get_float_variable(script, *args++);
    f32 posY = evt_get_float_variable(script, *args++);
    f32 posZ = evt_get_float_variable(script, *args++);
    f32 angle = evt_get_float_variable(script, *args++);
    f32 magnitude = evt_get_float_variable(script, *args++);
    s32 duration = evt_get_variable(script, *args++);
    f32 offsetX, offsetY, offsetZ;
    f32 sinA, cosA;

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

    offsetX = rand_int(10) - 5;
    offsetZ = rand_int(10) - 5;
    offsetY = -2.0f - ((SQ(offsetX) + SQ(offsetZ)) / 5.0f);
    sinA = sin_rad(DEG_TO_RAD(angle));
    cosA = cos_rad(DEG_TO_RAD(angle));
    fx_cloud_trail(
        posX + ((sinA * magnitude * script->functionTemp[0]) / duration) + offsetX,
        posY + 15.5f + offsetY,
        posZ + ((-cosA * magnitude * script->functionTemp[0]) / duration) + offsetZ,
        0.0f
    );

    script->functionTemp[0]++;
    if (script->functionTemp[0] < duration) {
        return ApiStatus_BLOCK;
    } else {
        return ApiStatus_DONE2;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_802490A8
/* 13C3E8 802490A8 3C038027 */  lui       $v1, %hi(gPauseBadgesCurrentPage)
/* 13C3EC 802490AC 8C630280 */  lw        $v1, %lo(gPauseBadgesCurrentPage)($v1)
/* 13C3F0 802490B0 3C098027 */  lui       $t1, %hi(gPauseBadgesSelectedIndex)
/* 13C3F4 802490B4 8D290378 */  lw        $t1, %lo(gPauseBadgesSelectedIndex)($t1)
/* 13C3F8 802490B8 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* 13C3FC 802490BC AFBF001C */  sw        $ra, 0x1C($sp)
/* 13C400 802490C0 AFB20018 */  sw        $s2, 0x18($sp)
/* 13C404 802490C4 AFB10014 */  sw        $s1, 0x14($sp)
/* 13C408 802490C8 AFB00010 */  sw        $s0, 0x10($sp)
/* 13C40C 802490CC 00031040 */  sll       $v0, $v1, 1
/* 13C410 802490D0 00431021 */  addu      $v0, $v0, $v1
/* 13C414 802490D4 00021080 */  sll       $v0, $v0, 2
/* 13C418 802490D8 3C018027 */  lui       $at, %hi(D_8027028A)
/* 13C41C 802490DC 00220821 */  addu      $at, $at, $v0
/* 13C420 802490E0 9022028A */  lbu       $v0, %lo(D_8027028A)($at)
/* 13C424 802490E4 3C038027 */  lui       $v1, %hi(gPausePressedButtons)
/* 13C428 802490E8 8C6300C4 */  lw        $v1, %lo(gPausePressedButtons)($v1)
/* 13C42C 802490EC 14400002 */  bnez      $v0, .L802490F8
/* 13C430 802490F0 0122001A */   div      $zero, $t1, $v0
/* 13C434 802490F4 0007000D */  break     7
.L802490F8:
/* 13C438 802490F8 2401FFFF */  addiu     $at, $zero, -0x1
/* 13C43C 802490FC 14410004 */  bne       $v0, $at, .L80249110
/* 13C440 80249100 3C018000 */   lui      $at, (0x80000000 >> 16)
/* 13C444 80249104 15210002 */  bne       $t1, $at, .L80249110
/* 13C448 80249108 00000000 */   nop
.L8024910C:
/* 13C44C 8024910C 0006000D */  break     6
.L80249110:
/* 13C450 80249110 00002812 */  mflo      $a1
/* 13C454 80249114 00004010 */  mfhi      $t0
/* 13C458 80249118 30628000 */  andi      $v0, $v1, 0x8000
/* 13C45C 8024911C 1040003F */  beqz      $v0, .L8024921C
/* 13C460 80249120 00000000 */   nop
/* 13C464 80249124 3C128027 */  lui       $s2, (0x80270000 >> 16)

### DECOMPILED C INSTRUCTIONS:

void pause_badges_handle_input(MenuPanel* panel) {
    s32 selectedIndex = gPauseBadgesSelectedIndex;
    s32 numCols = gPauseBadgesPages[gPauseBadgesCurrentPage].numCols;

    s32 selectedCol = selectedIndex % numCols;
    s32 selectedRow = selectedIndex / numCols;

    if (gPausePressedButtons & BUTTON_A) {
        s16 badgeID;

        if (gPauseBadgesShowNotEnoughBP != 0) {
            gPauseBadgesShowNotEnoughBP = 0;
        } else if (gPauseBadgesLevel == 0) {
            if (gPauseBadgesItemIds[selectedIndex] == BADGE_NONE_STANDIN) {
                sfx_play_sound(SOUND_MENU_ERROR);
            } else {
                gPauseBadgesLevel = 1;
                sfx_play_sound(SOUND_MENU_NEXT);
            }
        } else {
            badgeID = gPauseBadgesItemIds[selectedIndex];
            switch (pause_badges_try_equip(badgeID)) {
                case EQUIP_RESULT_ALREADY_EQUIPPED:
                    sfx_play_sound(SOUND_MENU_BADGE_UNEQUIP);
                    pause_badges_try_remove(badgeID);
                    break;
                case EQUIP_RESULT_NOT_ENOUGH_BP:
                    sfx_play_sound(SOUND_MENU_ERROR);
                    gPauseBadgesShowNotEnoughBP = 1;
                    break;
                case EQUIP_RESULT_TOO_MANY_BADGES:
                    sfx_play_sound(SOUND_MENU_ERROR);
                    gPauseBadgesShowNotEnoughBP = 2;
                    break;
                case EQUIP_RESULT_SUCCESS:
                    sfx_play_sound(SOUND_MENU_BADGE_EQUIP);
                    break;
            }
        }
        return;
    }

    if ((gPausePressedButtons != 0) || (gPauseHeldButtons != 0)) {
        gPauseBadgesShowNotEnoughBP = 0;
    }

    if (gPauseBadgesNumItems != 0) {
        if (gPauseBadgesLevel == 0) {
            s32 oldTab = gPauseBadgesCurrentTab;

            if (gPauseHeldButtons & (BUTTON_STICK_UP | BUTTON_STICK_DOWN)) {
                gPauseBadgesCurrentTab ^= 1;
            }
            if (oldTab != gPauseBadgesCurrentTab) {
                sfx_play_sound(SOUND_MENU_CHANGE_TAB);
                pause_badges_load_badges(gPauseBadgesCurrentTab);
            }
        } else {
            s32 heldButtons = gPauseHeldButtons;
            s32 heldButtons2;
            u8 newPageNumCols;

            if (heldButtons & (BUTTON_STICK_UP | BUTTON_Z)) {
                if (heldButtons & BUTTON_STICK_UP) {
                    selectedRow -= 1;
                    if (selectedRow < 0) {
                        selectedRow = 0;
                    }
                    if (selectedRow < gPauseBadgesPages[gPauseBadgesCurrentPage].listStart) {
                        gPauseBadgesCurrentPage -= 1;
                    }
                } else {
                    // Z button press
                    gPauseBadgesCurrentPage -= 1;
                    if (gPauseBadgesCurrentPage < 0) {
                        gPauseBadgesCurrentPage = 0;
                    }
                    selectedRow = gPauseBadgesPages[gPauseBadgesCurrentPage].listStart;
                }
            }

            // Need to re-read button state here for strange regalloc reasons
            heldButtons2 = gPauseHeldButtons;
            if (heldButtons2 & (BUTTON_STICK_DOWN | BUTTON_R)) {
                if (heldButtons2 & BUTTON_STICK_DOWN) {
                    PauseItemPage* page = &gPauseBadgesPages[gPauseBadgesCurrentPage];

                    selectedRow += 1;
                    if (selectedRow >= (page->listStart + page->numRows)) {
                        gPauseBadgesCurrentPage += 1;
                        if (!gPauseBadgesPages[gPauseBadgesCurrentPage].enabled) {
                            gPauseBadgesCurrentPage -= 1;
                            selectedRow -= 1;
                        }
                    }
                } else {
                    // R button press
                    PauseItemPage* newPage;

                    gPauseBadgesCurrentPage++;
                    newPage = &gPauseBadgesPages[gPauseBadgesCurrentPage];

                    if (!newPage->enabled) {
                        gPauseBadgesCurrentPage -= 1;
                    } else {
                        selectedRow = newPage->listStart;
                    }
                }
            }

            newPageNumCols = gPauseBadgesPages[gPauseBadgesCurrentPage].numCols;
            if (gPauseBadgesItemIds[selectedRow * newPageNumCols] != BADGE_NONE_STANDIN) {
                if (gPauseHeldButtons & BUTTON_STICK_LEFT) {
                    selectedCol -= 1;
                    if (selectedCol < 0) {
                        selectedCol = newPageNumCols - 1;
                    }
                } else if (gPauseHeldButtons & BUTTON_STICK_RIGHT) {
                    selectedCol += 1;
                    if (selectedCol >= newPageNumCols) {
                        selectedCol = 0;
                    }
                }
            } else {
                selectedCol = 0;
            }
            gPauseBadgesSelectedIndex = selectedCol + (selectedRow * gPauseBadgesPages[gPauseBadgesCurrentPage].numCols);
            if (gPauseBadgesSelectedIndex != selectedIndex) {
                sfx_play_sound(SOUND_MENU_CHANGE_SELECTION);
            }
            gPauseBadgesSelectedItem = gPauseBadgesItemIds[gPauseBadgesSelectedIndex];
        }
    }

    if (gPauseBadgesLevel == 1) {
        s32 itemID = gPauseBadgesSelectedItem;

        if (((itemID != BADGE_NONE_STANDIN) && (itemID != BADGE_INVALID) && (itemID != 0))) {
            gPauseCurrentDescMsg = gItemTable[itemID].fullDescMsg;
        } else {
            gPauseCurrentDescMsg = MSG_NONE;
            gPauseCurrentDescIconScript = NULL;
        }
    } else {
        gPauseCurrentDescMsg = pause_get_menu_msg(gPauseBadgesCurrentTab == 0 ? PAUSE_MSG_BAGDE_DESC_ALL : PAUSE_MSG_BAGDE_DESC_ACTIVE);
        gPauseCurrentDescIconScript = NULL;
    }

    if (gPausePressedButtons & BUTTON_B) {
        if (gPauseBadgesLevel == 0) {
            sfx_play_sound(SOUND_MENU_BACK);
            gPauseMenuCurrentTab = 0;
        } else {
            sfx_play_sound(SOUND_MENU_BACK);
            gPauseBadgesLevel = 0;
            enforce_hpfp_limits();
            if (gPauseBadgesCurrentTab == 1) {
                pause_badges_load_badges(TRUE);
            }
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel cloud_trail_update
/* 32F058 E0016228 27BDFFC8 */  addiu     $sp, $sp, -0x38
/* 32F05C E001622C AFB40020 */  sw        $s4, 0x20($sp)
/* 32F060 E0016230 0080A02D */  daddu     $s4, $a0, $zero
/* 32F064 E0016234 AFB20018 */  sw        $s2, 0x18($sp)
/* 32F068 E0016238 0000902D */  daddu     $s2, $zero, $zero
/* 32F06C E001623C AFB3001C */  sw        $s3, 0x1C($sp)
/* 32F070 E0016240 AFBF0024 */  sw        $ra, 0x24($sp)
/* 32F074 E0016244 AFB10014 */  sw        $s1, 0x14($sp)
/* 32F078 E0016248 AFB00010 */  sw        $s0, 0x10($sp)
/* 32F07C E001624C F7B60030 */  sdc1      $f22, 0x30($sp)
/* 32F080 E0016250 F7B40028 */  sdc1      $f20, 0x28($sp)
/* 32F084 E0016254 8E820008 */  lw        $v0, 0x8($s4)
/* 32F088 E0016258 8E91000C */  lw        $s1, 0xC($s4)
/* 32F08C E001625C 1840005E */  blez      $v0, .LE00163D8
/* 32F090 E0016260 0240982D */   daddu    $s3, $s2, $zero
/* 32F094 E0016264 26300038 */  addiu     $s0, $s1, 0x38
/* 32F098 E0016268 3C01E001 */  lui       $at, (0xE0016730 >> 16)
/* 32F09C E001626C D4346730 */  ldc1      $f20, (0xE0016730 & 0xFFFF)($at)
/* 32F0A0 E0016270 4480B000 */  mtc1      $zero, $f22
.LE0016274:
/* 32F0A4 E0016274 8E220000 */  lw        $v0, 0x0($s1)
/* 32F0A8 E0016278 50400052 */  beql      $v0, $zero, .LE00163C4
/* 32F0AC E001627C 26520001 */   addiu    $s2, $s2, 0x1
/* 32F0B0 E0016280 9602FFCE */  lhu       $v0, -0x32($s0)
/* 32F0B4 E0016284 2442FFFF */  addiu     $v0, $v0, -0x1
/* 32F0B8 E0016288 A602FFCE */  sh        $v0, -0x32($s0)
/* 32F0BC E001628C 00021400 */  sll       $v0, $v0, 16
/* 32F0C0 E0016290 1C400003 */  bgtz      $v0, .LE00162A0
/* 32F0C4 E0016294 00000000 */   nop
/* 32F0C8 E0016298 080058F0 */  j         .LE00163C0
/* 32F0CC E001629C AE200000 */   sw       $zero, 0x0($s1)
.LE00162A0:
/* 32F0D0 E00162A0 C600FFF8 */  lwc1      $f0, -0x8($s0)
/* 32F0D4 E00162A4 3C014140 */  lui       $at, (0x41400000 >> 16)
/* 32F0D8 E00162A8 44816000 */  mtc1      $at, $f12
/* 32F0DC E00162AC 0C08013C */  jal       shim_clamp_angle
/* 32F0E0 E00162B0 460C0300 */   add.s    $f12, $f0, $f12
/* 32F0E4 E00162B4 46000306 */  mov.s     $f12, $f0
/* 32F0E8 E00162B8 0C080140 */  jal       shim_sin_deg
/* 32F0EC E00162BC E60CFFF8 */   swc1     $f12, -0x8($s0)
/* 32F0F0 E00162C0 46000021 */  cvt.d.s   $f0, $f0
/* 32F0F4 E00162C4 46340002 */  mul.d     $f0, $f0, $f20
/* 32F0F8 E00162C8 00000000 */  nop
/* 32F0FC E00162CC C602FFF0 */  lwc1      $f2, -0x10($s0)
/* 32F100 E00162D0 460010A1 */  cvt.d.s   $f2, $f2
/* 32F104 E00162D4 46201080 */  add.d     $f2, $f2, $f0
/* 32F108 E00162D8 C60CFFF8 */  lwc1      $f12, -0x8($s0)
/* 32F10C E00162DC 462010A0 */  cvt.s.d   $f2, $f2
/* 32F110 E00162E0 0C080144 */  jal       shim_cos_deg
/* 32F114 E00162E4 E602FFE4 */   swc1     $f2, -0x1C($s0)
/* 32F118 E00162E8 46000021 */  cvt.d.s   $f0, $f0
/* 32F11C E00162EC 46340002 */  mul.d     $f0, $f0, $f20
/* 32F120 E00162F0 00000000 */  nop
/* 32F124 E00162F4 C602FFF4 */  lwc1      $f2, -0xC($s0)
/* 32F128 E00162F8 460010A1 */  cvt.d.s   $f2, $f2
/* 32F12C E00162FC 46201080 */  add.d     $f2, $f2, $f0
/* 32F130 E0016300 24130001 */  addiu     $s3, $zero, 0x1
/* 32F134 E0016304 9602FFCC */  lhu       $v0, -0x34($s0)
/* 32F138 E0016308 462010A0 */  cvt.s.d   $f2, $f2
/* 32F13C E001630C 1440000B */  bnez      $v0, .LE001633C
/* 32F140 E0016310 E602FFE8 */   swc1     $f2, -0x18($s0)
/* 32F144 E0016314 24030005 */  addiu     $v1, $zero, 0x5
/* 32F148 E0016318 8602FFCE */  lh        $v0, -0x32($s0)
/* 32F14C E001631C 14430007 */  bne       $v0, $v1, .LE001633C
/* 32F150 E0016320 9604FFCE */   lhu      $a0, -0x32($s0)
/* 32F154 E0016324 3C028011 */  lui       $v0, %hi(gPlayerStatus + 0xB4)
/* 32F158 E0016328 8042F07C */  lb        $v0, %lo(gPlayerStatus + 0xB4)($v0)
/* 32F15C E001632C 14400003 */  bnez      $v0, .LE001633C
/* 32F160 E0016330 00931021 */   addu     $v0, $a0, $s3
/* 32F164 E0016334 080058FA */  j         .LE00163E8
/* 32F168 E0016338 A602FFCE */   sh       $v0, -0x32($s0)
.LE001633C:
/* 32F16C E001633C C604FFF4 */  lwc1      $f4, -0xC($s0)
/* 32F170 E0016340 3C01E001 */  lui       $at, (0xE0016738 >> 16)
/* 32F174 E0016344 D4206738 */  ldc1      $f0, (0xE0016738 & 0xFFFF)($at)
/* 32F178 E0016348 46002121 */  cvt.d.s   $f4, $f4
/* 32F17C E001634C 46202102 */  mul.d     $f4, $f4, $f0
/* 32F180 E0016350 00000000 */  nop
/* 32F184 E0016354 9202FFD0 */  lbu       $v0, -0x30($s0)
/* 32F188 E0016358 C6080004 */  lwc1      $f8, 0x4($s0)
/* 32F18C E001635C C6020008 */  lwc1      $f2, 0x8($s0)
/* 32F190 E0016360 C6060000 */  lwc1      $f6, 0x0($s0)
/* 32F194 E0016364 2442FFF1 */  addiu     $v0, $v0, -0xF
/* 32F198 E0016368 46024200 */  add.s     $f8, $f8, $f2
/* 32F19C E001636C C600FFF0 */  lwc1      $f0, -0x10($s0)
/* 32F1A0 E0016370 3C01E001 */  lui       $at, (0xE0016740 >> 16)
/* 32F1A4 E0016374 D4226740 */  ldc1      $f2, (0xE0016740 & 0xFFFF)($at)
/* 32F1A8 E0016378 46000021 */  cvt.d.s   $f0, $f0
/* 32F1AC E001637C 46220000 */  add.d     $f0, $f0, $f2
/* 32F1B0 E0016380 A202FFD0 */  sb        $v0, -0x30($s0)
/* 32F1B4 E0016384 C602FFD8 */  lwc1      $f2, -0x28($s0)
/* 32F1B8 E0016388 46083180 */  add.s     $f6, $f6, $f8
/* 32F1BC E001638C E6080004 */  swc1      $f8, 0x4($s0)
/* 32F1C0 E0016390 46200020 */  cvt.s.d   $f0, $f0
/* 32F1C4 E0016394 E600FFF0 */  swc1      $f0, -0x10($s0)
/* 32F1C8 E0016398 46061080 */  add.s     $f2, $f2, $f6
/* 32F1CC E001639C E6060000 */  swc1      $f6, 0x0($s0)
/* 32F1D0 E00163A0 46003006 */  mov.s     $f0, $f6
/* 32F1D4 E00163A4 4616003C */  c.lt.s    $f0, $f22
/* 32F1D8 E00163A8 E602FFD8 */  swc1      $f2, -0x28($s0)
/* 32F1DC E00163AC 46202120 */  cvt.s.d   $f4, $f4
/* 32F1E0 E00163B0 45000003 */  bc1f      .LE00163C0
/* 32F1E4 E00163B4 E604FFF4 */   swc1     $f4, -0xC($s0)
/* 32F1E8 E00163B8 E6160004 */  swc1      $f22, 0x4($s0)
/* 32F1EC E00163BC E6160000 */  swc1      $f22, 0x0($s0)
.LE00163C0:
/* 32F1F0 E00163C0 26520001 */  addiu     $s2, $s2, 0x1
.LE00163C4:
/* 32F1F4 E00163C4 26100050 */  addiu     $s0, $s0, 0x50
/* 32F1F8 E00163C8 8E820008 */  lw        $v0, 0x8($s4)
/* 32F1FC E00163CC 0242102A */  slt       $v0, $s2, $v0
/* 32F200 E00163D0 1440FFA8 */  bnez      $v0, .LE0016274
/* 32F204 E00163D4 26310050 */   addiu    $s1, $s1, 0x50
.LE00163D8:
/* 32F208 E00163D8 16600003 */  bnez      $s3, .LE00163E8
/* 32F20C E00163DC 00000000 */   nop
/* 32F210 E00163E0 0C080128 */  jal       shim_remove_effect
/* 32F214 E00163E4 0280202D */   daddu    $a0, $s4, $zero
.LE00163E8:
/* 32F218 E00163E8 8FBF0024 */  lw        $ra, 0x24($sp)
/* 32F21C E00163EC 8FB40020 */  lw        $s4, 0x20($sp)
/* 32F220 E00163F0 8FB3001C */  lw        $s3, 0x1C($sp)
/* 32F224 E00163F4 8FB20018 */  lw        $s2, 0x18($sp)
/* 32F228 E00163F8 8FB10014 */  lw        $s1, 0x14($sp)
/* 32F22C E00163FC 8FB00010 */  lw        $s0, 0x10($sp)
/* 32F230 E0016400 D7B60030 */  ldc1      $f22, 0x30($sp)
/* 32F234 E0016404 D7B40028 */  ldc1      $f20, 0x28($sp)
/* 32F238 E0016408 03E00008 */  jr        $ra
/* 32F23C E001640C 27BD0038 */   addiu    $sp, $sp, 0x38

### DECOMPILED C INSTRUCTIONS:

void cloud_trail_update(EffectInstance* effect) {
    CloudTrailFXData* part = effect->data.cloudTrail;
    s32 cond = FALSE;
    s32 i;

    for (i = 0; i < effect->numParts; i++, part++) {
        if (part->alive) {
            part->lifetime--;
            if (part->lifetime <= 0) {
                part->alive = FALSE;
            } else {
                cond = TRUE;
                part->unk_30 = shim_clamp_angle(part->unk_30 + 12.0f);
                part->unk_1C = part->unk_28 + shim_sin_deg(part->unk_30) * 0.1;
                part->unk_20 = part->unk_2C + shim_cos_deg(part->unk_30) * 0.1;

                if (part->unk_04 == 0 && (part->lifetime == 5 && gPlayerStatus.actionState == ACTION_STATE_IDLE)) {
                    part->lifetime++;
                    return;
                }

                part->alpha -= 15;
                part->unk_3C += part->unk_40;
                part->unk_38 += part->unk_3C;
                part->unk_10 += part->unk_38;
                part->unk_28 += 0.14;
                part->unk_2C *= 0.94;

                if (part->unk_38 < 0.0f) {
                    part->unk_3C = 0.0f;
                    part->unk_38 = 0.0f;
                }
            }
        }
    }

    if (!cond) {
        shim_remove_effect(effect);
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel ResetActorSounds
/* 19E118 8026F838 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 19E11C 8026F83C AFB20018 */  sw        $s2, 0x18($sp)
/* 19E120 8026F840 0080902D */  daddu     $s2, $a0, $zero
/* 19E124 8026F844 AFBF0020 */  sw        $ra, 0x20($sp)
/* 19E128 8026F848 AFB3001C */  sw        $s3, 0x1C($sp)
/* 19E12C 8026F84C AFB10014 */  sw        $s1, 0x14($sp)
/* 19E130 8026F850 AFB00010 */  sw        $s0, 0x10($sp)
/* 19E134 8026F854 8E50000C */  lw        $s0, 0xC($s2)
/* 19E138 8026F858 8E050000 */  lw        $a1, 0x0($s0)
/* 19E13C 8026F85C 0C0B1EAF */  jal       evt_get_variable
/* 19E140 8026F860 26100004 */   addiu    $s0, $s0, 0x4
/* 19E144 8026F864 0040882D */  daddu     $s1, $v0, $zero
/* 19E148 8026F868 2402FF81 */  addiu     $v0, $zero, -0x7F
/* 19E14C 8026F86C 16220002 */  bne       $s1, $v0, .L8026F878
/* 19E150 8026F870 00000000 */   nop
/* 19E154 8026F874 8E510148 */  lw        $s1, 0x148($s2)
.L8026F878:
/* 19E158 8026F878 8E050000 */  lw        $a1, 0x0($s0)
/* 19E15C 8026F87C 26100004 */  addiu     $s0, $s0, 0x4
/* 19E160 8026F880 0C0B1EAF */  jal       evt_get_variable
/* 19E164 8026F884 0240202D */   daddu    $a0, $s2, $zero
/* 19E168 8026F888 8E050000 */  lw        $a1, 0x0($s0)
/* 19E16C 8026F88C 26100004 */  addiu     $s0, $s0, 0x4
/* 19E170 8026F890 0240202D */  daddu     $a0, $s2, $zero
/* 19E174 8026F894 0C0B1EAF */  jal       evt_get_variable
/* 19E178 8026F898 0040982D */   daddu    $s3, $v0, $zero
/* 19E17C 8026F89C 8E050000 */  lw        $a1, 0x0($s0)
/* 19E180 8026F8A0 0C0B1EAF */  jal       evt_get_variable
/* 19E184 8026F8A4 0240202D */   daddu    $a0, $s2, $zero
/* 19E188 8026F8A8 0C09A75B */  jal       get_actor
/* 19E18C 8026F8AC 0220202D */   daddu    $a0, $s1, $zero
/* 19E190 8026F8B0 0040202D */  daddu     $a0, $v0, $zero
/* 19E194 8026F8B4 2E620006 */  sltiu     $v0, $s3, 0x6
/* 19E198 8026F8B8 10400049 */  beqz      $v0, D_8026F9E0
/* 19E19C 8026F8BC 00131080 */   sll      $v0, $s3, 2
/* 19E1A0 8026F8C0 3C01802A */  lui       $at, %hi(jtbl_8029D7D8)
/* 19E1A4 8026F8C4 00220821 */  addu      $at, $at, $v0
/* 19E1A8 8026F8C8 8C22D7D8 */  lw        $v0, %lo(jtbl_8029D7D8)($at)
/* 19E1AC 8026F8CC 00400008 */  jr        $v0
/* 19E1B0 8026F8D0 00000000 */   nop
gPauseDLLabels:
/* 19E1B4 8026F8D4 90830136 */  lbu       $v1, 0x136($a0)
/* 19E1B8 8026F8D8 000310C0 */  sll       $v0, $v1, 3
/* 19E1BC 8026F8DC 00431023 */  subu      $v0, $v0, $v1
/* 19E1C0 8026F8E0 00021080 */  sll       $v0, $v0, 2
/* 19E1C4 8026F8E4 3C018028 */  lui       $at, %hi(bActorSoundTable)
/* 19E1C8 8026F8E8 00220821 */  addu      $at, $at, $v0
/* 19E1CC 8026F8EC 8C221468 */  lw        $v0, %lo(bActorSoundTable)($at)
/* 19E1D0 8026F8F0 AC82019C */  sw        $v0, 0x19C($a0)
/* 19E1D4 8026F8F4 000310C0 */  sll       $v0, $v1, 3
/* 19E1D8 8026F8F8 00431023 */  subu      $v0, $v0, $v1
/* 19E1DC 8026F8FC 00021080 */  sll       $v0, $v0, 2
gPauseWS_0:
/* 19E1E0 8026F900 3C018028 */  lui       $at, %hi(bActorSoundTable + 0x4)
/* 19E1E4 8026F904 00220821 */  addu      $at, $at, $v0
/* 19E1E8 8026F908 8C22146C */  lw        $v0, %lo(bActorSoundTable + 0x4)($at)
/* 19E1EC 8026F90C 0809BE78 */  j         D_8026F9E0
/* 19E1F0 8026F910 AC8201A0 */   sw       $v0, 0x1A0($a0)
glabel .L8026F914
/* 19E1F4 8026F914 90830136 */  lbu       $v1, 0x136($a0)
/* 19E1F8 8026F918 000310C0 */  sll       $v0, $v1, 3
/* 19E1FC 8026F91C 00431023 */  subu      $v0, $v0, $v1
/* 19E200 8026F920 00021080 */  sll       $v0, $v0, 2
/* 19E204 8026F924 3C018028 */  lui       $at, %hi(bActorSoundTable + 0x8)
/* 19E208 8026F928 00220821 */  addu      $at, $at, $v0
/* 19E20C 8026F92C 8C221470 */  lw        $v0, %lo(bActorSoundTable + 0x8)($at)
/* 19E210 8026F930 AC8201A4 */  sw        $v0, 0x1A4($a0)
/* 19E214 8026F934 000310C0 */  sll       $v0, $v1, 3
gPauseWS_1:
/* 19E218 8026F938 00431023 */  subu      $v0, $v0, $v1
/* 19E21C 8026F93C 00021080 */  sll       $v0, $v0, 2
/* 19E220 8026F940 3C018028 */  lui       $at, %hi(bActorSoundTable + 0xC)
/* 19E224 8026F944 00220821 */  addu      $at, $at, $v0
/* 19E228 8026F948 8C221474 */  lw        $v0, %lo(bActorSoundTable + 0xC)($at)
/* 19E22C 8026F94C 0809BE78 */  j         D_8026F9E0
/* 19E230 8026F950 AC8201A8 */   sw       $v0, 0x1A8($a0)
glabel .L8026F954
/* 19E234 8026F954 90820136 */  lbu       $v0, 0x136($a0)
/* 19E238 8026F958 000218C0 */  sll       $v1, $v0, 3
/* 19E23C 8026F95C 00621823 */  subu      $v1, $v1, $v0
/* 19E240 8026F960 00031880 */  sll       $v1, $v1, 2
/* 19E244 8026F964 3C028028 */  lui       $v0, %hi(bActorSoundTable + 0x10)
/* 19E248 8026F968 00431021 */  addu      $v0, $v0, $v1
/* 19E24C 8026F96C 8C421478 */  lw        $v0, %lo(bActorSoundTable + 0x10)($v0)
gPauseWS_2:
/* 19E250 8026F970 0809BE78 */  j         D_8026F9E0
/* 19E254 8026F974 AC8201AC */   sw       $v0, 0x1AC($a0)
glabel .L8026F978
/* 19E258 8026F978 90820136 */  lbu       $v0, 0x136($a0)
/* 19E25C 8026F97C 000218C0 */  sll       $v1, $v0, 3
/* 19E260 8026F980 00621823 */  subu      $v1, $v1, $v0
/* 19E264 8026F984 00031880 */  sll       $v1, $v1, 2
/* 19E268 8026F988 3C028028 */  lui       $v0, %hi(bActorSoundTable + 0x14)
/* 19E26C 8026F98C 00431021 */  addu      $v0, $v0, $v1
/* 19E270 8026F990 8C42147C */  lw        $v0, %lo(bActorSoundTable + 0x14)($v0)
/* 19E274 8026F994 0809BE78 */  j         D_8026F9E0
/* 19E278 8026F998 AC8201B0 */   sw       $v0, 0x1B0($a0)
glabel .L8026F99C
/* 19E27C 8026F99C 90820136 */  lbu       $v0, 0x136($a0)
/* 19E280 8026F9A0 000218C0 */  sll       $v1, $v0, 3
/* 19E284 8026F9A4 00621823 */  subu      $v1, $v1, $v0
gPauseWS_3:
/* 19E288 8026F9A8 00031880 */  sll       $v1, $v1, 2
/* 19E28C 8026F9AC 3C028028 */  lui       $v0, %hi(bActorSoundTable + 0x18)
/* 19E290 8026F9B0 00431021 */  addu      $v0, $v0, $v1
/* 19E294 8026F9B4 94421480 */  lhu       $v0, %lo(bActorSoundTable + 0x18)($v0)
/* 19E298 8026F9B8 0809BE78 */  j         D_8026F9E0
/* 19E29C 8026F9BC A48201B4 */   sh       $v0, 0x1B4($a0)
glabel .L8026F9C0
/* 19E2A0 8026F9C0 90820136 */  lbu       $v0, 0x136($a0)
/* 19E2A4 8026F9C4 000218C0 */  sll       $v1, $v0, 3
/* 19E2A8 8026F9C8 00621823 */  subu      $v1, $v1, $v0
/* 19E2AC 8026F9CC 00031880 */  sll       $v1, $v1, 2
/* 19E2B0 8026F9D0 3C028028 */  lui       $v0, %hi(bActorSoundTable + 0x1A)
/* 19E2B4 8026F9D4 00431021 */  addu      $v0, $v0, $v1
/* 19E2B8 8026F9D8 94421482 */  lhu       $v0, %lo(bActorSoundTable + 0x1A)($v0)
/* 19E2BC 8026F9DC A48201B6 */  sh        $v0, 0x1B6($a0)
D_8026F9E0:
/* 19E2C0 8026F9E0 8FBF0020 */  lw        $ra, 0x20($sp)
/* 19E2C4 8026F9E4 8FB3001C */  lw        $s3, 0x1C($sp)
/* 19E2C8 8026F9E8 8FB20018 */  lw        $s2, 0x18($sp)
/* 19E2CC 8026F9EC 8FB10014 */  lw        $s1, 0x14($sp)
D_8026F9F0:
/* 19E2D0 8026F9F0 8FB00010 */  lw        $s0, 0x10($sp)
/* 19E2D4 8026F9F4 24020002 */  addiu     $v0, $zero, 0x2
/* 19E2D8 8026F9F8 03E00008 */  jr        $ra
/* 19E2DC 8026F9FC 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

ApiStatus ResetActorSounds(Evt* script, s32 isInitialCall) {
    Bytecode* args = script->ptrReadPos;
    s32 actorID = evt_get_variable(script, *args++);
    Actor* actor;
    s32 temp_s3;

    if (actorID == ACTOR_SELF) {
        actorID = script->owner1.actorID;
    }

    temp_s3 = evt_get_variable(script, *args++);
    evt_get_variable(script, *args++);
    evt_get_variable(script, *args++);
    actor = get_actor(actorID);

    switch (temp_s3) {
        case 0:
            actor->actorTypeData1[0] = bActorSoundTable[actor->actorType].walk[0];
            actor->actorTypeData1[1] = bActorSoundTable[actor->actorType].walk[1];
            break;
        case 1:
            actor->actorTypeData1[2] = bActorSoundTable[actor->actorType].fly[0];
            actor->actorTypeData1[3] = bActorSoundTable[actor->actorType].fly[1];
            break;
        case 2:
            actor->actorTypeData1[4] = bActorSoundTable[actor->actorType].jump;
            break;
        case 3:
            actor->actorTypeData1[5] = bActorSoundTable[actor->actorType].hurt;
            break;
        case 4:
            actor->actorTypeData1b[0] = bActorSoundTable[actor->actorType].delay[0];
            break;
        case 5:
            actor->actorTypeData1b[1] = bActorSoundTable[actor->actorType].delay[1];
            break;
    }

    return ApiStatus_DONE2;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel set_screen_overlay_center_worldpos
/* CE5C0 80137EC0 27BDFFB0 */  addiu     $sp, $sp, -0x50
/* CE5C4 80137EC4 AFB1003C */  sw        $s1, 0x3C($sp)
/* CE5C8 80137EC8 0080882D */  daddu     $s1, $a0, $zero
/* CE5CC 80137ECC AFB20040 */  sw        $s2, 0x40($sp)
/* CE5D0 80137ED0 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* CE5D4 80137ED4 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* CE5D8 80137ED8 3C04800B */  lui       $a0, %hi(gCameras)
/* CE5DC 80137EDC 24841D80 */  addiu     $a0, $a0, %lo(gCameras)
/* CE5E0 80137EE0 AFBF0044 */  sw        $ra, 0x44($sp)
/* CE5E4 80137EE4 AFB00038 */  sw        $s0, 0x38($sp)
/* CE5E8 80137EE8 F7B40048 */  sdc1      $f20, 0x48($sp)
/* CE5EC 80137EEC 00031080 */  sll       $v0, $v1, 2
/* CE5F0 80137EF0 00431021 */  addu      $v0, $v0, $v1
/* CE5F4 80137EF4 00021080 */  sll       $v0, $v0, 2
/* CE5F8 80137EF8 00431023 */  subu      $v0, $v0, $v1
/* CE5FC 80137EFC 000218C0 */  sll       $v1, $v0, 3
/* CE600 80137F00 00431021 */  addu      $v0, $v0, $v1
/* CE604 80137F04 000210C0 */  sll       $v0, $v0, 3
/* CE608 80137F08 00448021 */  addu      $s0, $v0, $a0
/* CE60C 80137F0C 2A220002 */  slti      $v0, $s1, 0x2
/* CE610 80137F10 10400069 */  beqz      $v0, .L801380B8
/* CE614 80137F14 00A0902D */   daddu    $s2, $a1, $zero
/* CE618 80137F18 06200067 */  bltz      $s1, .L801380B8
/* CE61C 80137F1C 27A20028 */   addiu    $v0, $sp, 0x28
/* CE620 80137F20 AFA20014 */  sw        $v0, 0x14($sp)
/* CE624 80137F24 27A2002C */  addiu     $v0, $sp, 0x2C
/* CE628 80137F28 AFA20018 */  sw        $v0, 0x18($sp)
/* CE62C 80137F2C 27A20030 */  addiu     $v0, $sp, 0x30
/* CE630 80137F30 AFA2001C */  sw        $v0, 0x1C($sp)
/* CE634 80137F34 27A20034 */  addiu     $v0, $sp, 0x34
/* CE638 80137F38 44866000 */  mtc1      $a2, $f12
/* CE63C 80137F3C 00000000 */  nop
/* CE640 80137F40 46806320 */  cvt.s.w   $f12, $f12
/* CE644 80137F44 44056000 */  mfc1      $a1, $f12
/* CE648 80137F48 44876000 */  mtc1      $a3, $f12
/* CE64C 80137F4C 00000000 */  nop
/* CE650 80137F50 46806320 */  cvt.s.w   $f12, $f12
/* CE654 80137F54 44066000 */  mfc1      $a2, $f12
/* CE658 80137F58 C7AC0060 */  lwc1      $f12, 0x60($sp)
/* CE65C 80137F5C 46806320 */  cvt.s.w   $f12, $f12
/* CE660 80137F60 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* CE664 80137F64 4481A000 */  mtc1      $at, $f20
/* CE668 80137F68 44076000 */  mfc1      $a3, $f12
/* CE66C 80137F6C 260400D4 */  addiu     $a0, $s0, 0xD4
/* CE670 80137F70 AFA20020 */  sw        $v0, 0x20($sp)
/* CE674 80137F74 0C00A588 */  jal       transform_point
/* CE678 80137F78 E7B40010 */   swc1     $f20, 0x10($sp)
/* CE67C 80137F7C C7A00034 */  lwc1      $f0, 0x34($sp)
/* CE680 80137F80 C7AA0028 */  lwc1      $f10, 0x28($sp)
/* CE684 80137F84 4600A503 */  div.s     $f20, $f20, $f0
/* CE688 80137F88 46145282 */  mul.s     $f10, $f10, $f20
/* CE68C 80137F8C 00000000 */  nop
/* CE690 80137F90 8602000A */  lh        $v0, 0xA($s0)
/* CE694 80137F94 44820000 */  mtc1      $v0, $f0
/* CE698 80137F98 00000000 */  nop
/* CE69C 80137F9C 46800020 */  cvt.s.w   $f0, $f0
/* CE6A0 80137FA0 46005102 */  mul.s     $f4, $f10, $f0
/* CE6A4 80137FA4 00000000 */  nop
/* CE6A8 80137FA8 46002100 */  add.s     $f4, $f4, $f0
/* CE6AC 80137FAC 3C013FE0 */  lui       $at, (0x3FE00000 >> 16)
/* CE6B0 80137FB0 44813800 */  mtc1      $at, $f7
/* CE6B4 80137FB4 44803000 */  mtc1      $zero, $f6
/* CE6B8 80137FB8 46002121 */  cvt.d.s   $f4, $f4
/* CE6BC 80137FBC 46262102 */  mul.d     $f4, $f4, $f6
/* CE6C0 80137FC0 00000000 */  nop
/* CE6C4 80137FC4 C7A8002C */  lwc1      $f8, 0x2C($sp)
/* CE6C8 80137FC8 4600A007 */  neg.s     $f0, $f20
/* CE6CC 80137FCC 46004202 */  mul.s     $f8, $f8, $f0
/* CE6D0 80137FD0 00000000 */  nop
/* CE6D4 80137FD4 8602000C */  lh        $v0, 0xC($s0)
/* CE6D8 80137FD8 44820000 */  mtc1      $v0, $f0
/* CE6DC 80137FDC 00000000 */  nop
/* CE6E0 80137FE0 46800020 */  cvt.s.w   $f0, $f0
/* CE6E4 80137FE4 46004082 */  mul.s     $f2, $f8, $f0
/* CE6E8 80137FE8 00000000 */  nop
/* CE6EC 80137FEC 46001080 */  add.s     $f2, $f2, $f0
/* CE6F0 80137FF0 460010A1 */  cvt.d.s   $f2, $f2
/* CE6F4 80137FF4 46261082 */  mul.d     $f2, $f2, $f6
/* CE6F8 80137FF8 00000000 */  nop
/* CE6FC 80137FFC E7B40034 */  swc1      $f20, 0x34($sp)
/* CE700 80138000 C7A60030 */  lwc1      $f6, 0x30($sp)
/* CE704 80138004 8602000E */  lh        $v0, 0xE($s0)
/* CE708 80138008 46143182 */  mul.s     $f6, $f6, $f20
/* CE70C 8013800C 00000000 */  nop
/* CE710 80138010 E7AA0028 */  swc1      $f10, 0x28($sp)
/* CE714 80138014 E7A8002C */  swc1      $f8, 0x2C($sp)
/* CE718 80138018 44820000 */  mtc1      $v0, $f0
/* CE71C 8013801C 00000000 */  nop
/* CE720 80138020 46800021 */  cvt.d.w   $f0, $f0
/* CE724 80138024 86020010 */  lh        $v0, 0x10($s0)
/* CE728 80138028 46202100 */  add.d     $f4, $f4, $f0
/* CE72C 8013802C 44820000 */  mtc1      $v0, $f0
/* CE730 80138030 00000000 */  nop
/* CE734 80138034 46800021 */  cvt.d.w   $f0, $f0
/* CE738 80138038 46202120 */  cvt.s.d   $f4, $f4
/* CE73C 8013803C 46201080 */  add.d     $f2, $f2, $f0
/* CE740 80138040 E7A40028 */  swc1      $f4, 0x28($sp)
/* CE744 80138044 E7A60030 */  swc1      $f6, 0x30($sp)
/* CE748 80138048 462010A0 */  cvt.s.d   $f2, $f2
/* CE74C 8013804C 12400006 */  beqz      $s2, .L80138068
/* CE750 80138050 E7A2002C */   swc1     $f2, 0x2C($sp)
/* CE754 80138054 24020001 */  addiu     $v0, $zero, 0x1
/* CE758 80138058 1242000E */  beq       $s2, $v0, .L80138094
/* CE75C 8013805C 00111040 */   sll      $v0, $s1, 1
/* CE760 80138060 0804E02E */  j         .L801380B8
/* CE764 80138064 00000000 */   nop
.L80138068:
/* CE768 80138068 3C038016 */  lui       $v1, %hi(ScreenOverlays)
/* CE76C 8013806C 2463C790 */  addiu     $v1, $v1, %lo(ScreenOverlays)
/* CE770 80138070 00111040 */  sll       $v0, $s1, 1
/* CE774 80138074 00511021 */  addu      $v0, $v0, $s1
/* CE778 80138078 000210C0 */  sll       $v0, $v0, 3
/* CE77C 8013807C 00431021 */  addu      $v0, $v0, $v1
/* CE780 80138080 4600230D */  trunc.w.s $f12, $f4
/* CE784 80138084 E44C0004 */  swc1      $f12, 0x4($v0)
/* CE788 80138088 4600130D */  trunc.w.s $f12, $f2
/* CE78C 8013808C 0804E02E */  j         .L801380B8
/* CE790 80138090 E44C0008 */   swc1     $f12, 0x8($v0)
.L80138094:
/* CE794 80138094 3C038016 */  lui       $v1, %hi(ScreenOverlays)
/* CE798 80138098 2463C790 */  addiu     $v1, $v1, %lo(ScreenOverlays)
/* CE79C 8013809C 00511021 */  addu      $v0, $v0, $s1
/* CE7A0 801380A0 000210C0 */  sll       $v0, $v0, 3
/* CE7A4 801380A4 00431021 */  addu      $v0, $v0, $v1
/* CE7A8 801380A8 4600230D */  trunc.w.s $f12, $f4
/* CE7AC 801380AC E44C000C */  swc1      $f12, 0xC($v0)
/* CE7B0 801380B0 4600130D */  trunc.w.s $f12, $f2
/* CE7B4 801380B4 E44C0010 */  swc1      $f12, 0x10($v0)
.L801380B8:
/* CE7B8 801380B8 8FBF0044 */  lw        $ra, 0x44($sp)
/* CE7BC 801380BC 8FB20040 */  lw        $s2, 0x40($sp)
/* CE7C0 801380C0 8FB1003C */  lw        $s1, 0x3C($sp)
/* CE7C4 801380C4 8FB00038 */  lw        $s0, 0x38($sp)
/* CE7C8 801380C8 D7B40048 */  ldc1      $f20, 0x48($sp)
/* CE7CC 801380CC 03E00008 */  jr        $ra
/* CE7D0 801380D0 27BD0050 */   addiu    $sp, $sp, 0x50

### DECOMPILED C INSTRUCTIONS:

void set_screen_overlay_center_worldpos(s32 layer, s32 posIdx, s32 worldPosX, s32 worldPosY, s32 worldPosZ) {
    Camera* camera = &gCameras[gCurrentCameraID];
    f32 tx, ty, tz, tw;

    switch (layer) {
        case SCREEN_LAYER_FRONT:
        case SCREEN_LAYER_BACK:
            transform_point(camera->perspectiveMatrix, worldPosX, worldPosY, worldPosZ, 1.0f, &tx, &ty, &tz, &tw);
            tw = 1.0f / tw;
            tx *= tw;
            ty *= -tw;
            tz *= tw;
            tx = (((tx * camera->viewportW) + camera->viewportW) * 0.5) + camera->viewportStartX;
            ty = (((ty * camera->viewportH) + camera->viewportH) * 0.5) + camera->viewportStartY;

            switch (posIdx) {
                case 0:
                    ScreenOverlays[layer].screenPos[0][0] = tx;
                    ScreenOverlays[layer].screenPos[0][1] = ty;
                    break;
                case 1:
                    ScreenOverlays[layer].screenPos[1][0] = tx;
                    ScreenOverlays[layer].screenPos[1][1] = ty;
                    break;
            }
            break;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel nuAuDmaCallBack
/* 26474 8004B074 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 26478 8004B078 AFB3001C */  sw        $s3, 0x1C($sp)
/* 2647C 8004B07C 0080982D */  daddu     $s3, $a0, $zero
/* 26480 8004B080 30E700FF */  andi      $a3, $a3, 0xFF
/* 26484 8004B084 AFBF0020 */  sw        $ra, 0x20($sp)
/* 26488 8004B088 AFB20018 */  sw        $s2, 0x18($sp)
/* 2648C 8004B08C AFB10014 */  sw        $s1, 0x14($sp)
/* 26490 8004B090 14E00005 */  bnez      $a3, .L8004B0A8
/* 26494 8004B094 AFB00010 */   sw       $s0, 0x10($sp)
/* 26498 8004B098 0C0187A4 */  jal       osVirtualToPhysical
/* 2649C 8004B09C 00000000 */   nop
/* 264A0 8004B0A0 08012C82 */  j         .L8004B208
/* 264A4 8004B0A4 00000000 */   nop
.L8004B0A8:
/* 264A8 8004B0A8 0000802D */  daddu     $s0, $zero, $zero
/* 264AC 8004B0AC 3C11800A */  lui       $s1, %hi(D_800A3BD4)
/* 264B0 8004B0B0 8E313BD4 */  lw        $s1, %lo(D_800A3BD4)($s1)
/* 264B4 8004B0B4 1220000B */  beqz      $s1, .L8004B0E4
/* 264B8 8004B0B8 02652821 */   addu     $a1, $s3, $a1
.L8004B0BC:
/* 264BC 8004B0BC 8E220008 */  lw        $v0, 0x8($s1)
/* 264C0 8004B0C0 24430500 */  addiu     $v1, $v0, 0x500
/* 264C4 8004B0C4 0262102B */  sltu      $v0, $s3, $v0
/* 264C8 8004B0C8 14400006 */  bnez      $v0, .L8004B0E4
/* 264CC 8004B0CC 0065102A */   slt      $v0, $v1, $a1
/* 264D0 8004B0D0 1040001F */  beqz      $v0, .L8004B150
/* 264D4 8004B0D4 0220802D */   daddu    $s0, $s1, $zero
/* 264D8 8004B0D8 8E310000 */  lw        $s1, 0x0($s1)
/* 264DC 8004B0DC 1620FFF7 */  bnez      $s1, .L8004B0BC
/* 264E0 8004B0E0 00000000 */   nop
.L8004B0E4:
/* 264E4 8004B0E4 3C12800A */  lui       $s2, %hi(nuAuDmaState)
/* 264E8 8004B0E8 26523BD0 */  addiu     $s2, $s2, %lo(nuAuDmaState)
/* 264EC 8004B0EC 8E510008 */  lw        $s1, 0x8($s2)
/* 264F0 8004B0F0 16200006 */  bnez      $s1, .L8004B10C
/* 264F4 8004B0F4 0220202D */   daddu    $a0, $s1, $zero
/* 264F8 8004B0F8 8E440004 */  lw        $a0, 0x4($s2)
/* 264FC 8004B0FC 0C0187A4 */  jal       osVirtualToPhysical
/* 26500 8004B100 00000000 */   nop
/* 26504 8004B104 08012C82 */  j         .L8004B208
/* 26508 8004B108 00000000 */   nop
.L8004B10C:
/* 2650C 8004B10C 8E220000 */  lw        $v0, 0x0($s1)
/* 26510 8004B110 0C012D03 */  jal       alUnlink
/* 26514 8004B114 AE420008 */   sw       $v0, 0x8($s2)
/* 26518 8004B118 12000005 */  beqz      $s0, .L8004B130
/* 2651C 8004B11C 0220202D */   daddu    $a0, $s1, $zero
/* 26520 8004B120 0C012CFB */  jal       alLink
/* 26524 8004B124 0200282D */   daddu    $a1, $s0, $zero
/* 26528 8004B128 08012C61 */  j         .L8004B184
/* 2652C 8004B12C 00000000 */   nop
.L8004B130:
/* 26530 8004B130 8E450004 */  lw        $a1, 0x4($s2)
/* 26534 8004B134 10A00010 */  beqz      $a1, .L8004B178
/* 26538 8004B138 00A0802D */   daddu    $s0, $a1, $zero
/* 2653C 8004B13C AE510004 */  sw        $s1, 0x4($s2)
/* 26540 8004B140 AE300000 */  sw        $s0, 0x0($s1)
/* 26544 8004B144 AE200004 */  sw        $zero, 0x4($s1)
/* 26548 8004B148 08012C61 */  j         .L8004B184
/* 2654C 8004B14C AE110004 */   sw       $s1, 0x4($s0)
.L8004B150:
/* 26550 8004B150 8E240010 */  lw        $a0, 0x10($s1)
/* 26554 8004B154 8E220008 */  lw        $v0, 0x8($s1)
/* 26558 8004B158 3C038008 */  lui       $v1, %hi(nuAuFrameCounter)
/* 2655C 8004B15C 8C63817C */  lw        $v1, %lo(nuAuFrameCounter)($v1)
/* 26560 8004B160 00932021 */  addu      $a0, $a0, $s3
/* 26564 8004B164 00822023 */  subu      $a0, $a0, $v0
/* 26568 8004B168 0C0187A4 */  jal       osVirtualToPhysical
/* 2656C 8004B16C AE23000C */   sw       $v1, 0xC($s1)
/* 26570 8004B170 08012C82 */  j         .L8004B208
/* 26574 8004B174 00000000 */   nop
.L8004B178:
/* 26578 8004B178 AE510004 */  sw        $s1, 0x4($s2)
/* 2657C 8004B17C AE200000 */  sw        $zero, 0x0($s1)
/* 26580 8004B180 AE200004 */  sw        $zero, 0x4($s1)
.L8004B184:
/* 26584 8004B184 3C048008 */  lui       $a0, %hi(nuAuDmaNext)
/* 26588 8004B188 24848178 */  addiu     $a0, $a0, %lo(nuAuDmaNext)
/* 2658C 8004B18C 32700001 */  andi      $s0, $s3, 0x1
/* 26590 8004B190 02709823 */  subu      $s3, $s3, $s0
/* 26594 8004B194 3C02800A */  lui       $v0, %hi(nuAuDmaIOMesgBuf)
/* 26598 8004B198 24423720 */  addiu     $v0, $v0, %lo(nuAuDmaIOMesgBuf)
/* 2659C 8004B19C 8C830000 */  lw        $v1, 0x0($a0)
/* 265A0 8004B1A0 8E320010 */  lw        $s2, 0x10($s1)
/* 265A4 8004B1A4 0000302D */  daddu     $a2, $zero, $zero
/* 265A8 8004B1A8 AE330008 */  sw        $s3, 0x8($s1)
/* 265AC 8004B1AC 00032840 */  sll       $a1, $v1, 1
/* 265B0 8004B1B0 00A32821 */  addu      $a1, $a1, $v1
/* 265B4 8004B1B4 000528C0 */  sll       $a1, $a1, 3
/* 265B8 8004B1B8 00A22821 */  addu      $a1, $a1, $v0
/* 265BC 8004B1BC 3C028008 */  lui       $v0, %hi(nuAuFrameCounter)
/* 265C0 8004B1C0 8C42817C */  lw        $v0, %lo(nuAuFrameCounter)($v0)
/* 265C4 8004B1C4 24630001 */  addiu     $v1, $v1, 0x1
/* 265C8 8004B1C8 AE22000C */  sw        $v0, 0xC($s1)
/* 265CC 8004B1CC AC830000 */  sw        $v1, 0x0($a0)
/* 265D0 8004B1D0 A0A00002 */  sb        $zero, 0x2($a1)
/* 265D4 8004B1D4 3C04800A */  lui       $a0, %hi(nuPiCartHandle)
/* 265D8 8004B1D8 8C84A638 */  lw        $a0, %lo(nuPiCartHandle)($a0)
/* 265DC 8004B1DC 3C02800A */  lui       $v0, %hi(nuAuDmaMesgQ)
/* 265E0 8004B1E0 24423640 */  addiu     $v0, $v0, %lo(nuAuDmaMesgQ)
/* 265E4 8004B1E4 ACA20004 */  sw        $v0, 0x4($a1)
/* 265E8 8004B1E8 24020500 */  addiu     $v0, $zero, 0x500
/* 265EC 8004B1EC ACB20008 */  sw        $s2, 0x8($a1)
/* 265F0 8004B1F0 ACB3000C */  sw        $s3, 0xC($a1)
/* 265F4 8004B1F4 0C018388 */  jal       osEPiStartDma
/* 265F8 8004B1F8 ACA20010 */   sw       $v0, 0x10($a1)
/* 265FC 8004B1FC 0C0187A4 */  jal       osVirtualToPhysical
/* 26600 8004B200 0240202D */   daddu    $a0, $s2, $zero
/* 26604 8004B204 00501021 */  addu      $v0, $v0, $s0
.L8004B208:
/* 26608 8004B208 8FBF0020 */  lw        $ra, 0x20($sp)
/* 2660C 8004B20C 8FB3001C */  lw        $s3, 0x1C($sp)
/* 26610 8004B210 8FB20018 */  lw        $s2, 0x18($sp)
/* 26614 8004B214 8FB10014 */  lw        $s1, 0x14($sp)
/* 26618 8004B218 8FB00010 */  lw        $s0, 0x10($sp)
/* 2661C 8004B21C 03E00008 */  jr        $ra
/* 26620 8004B220 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

s32 nuAuDmaCallBack(s32 addr, s32 len, void *state, u8 arg3) {
    NUDMABuffer* dmaPtr;
    NUDMABuffer* freeBuffer;
    OSIoMesg* mesg;
    s32 delta;
    u32 startAddr;
    s32 addrEnd, buffEnd;
    NUDMABuffer* lastDmaPtr;

    if (arg3 == 0) {
        return osVirtualToPhysical((void*)addr);
    }

    lastDmaPtr = NULL;
    dmaPtr = nuAuDmaState.firstUsed;
    addrEnd = addr + len;

    while (dmaPtr != NULL) {
        startAddr = dmaPtr->startAddr;
        buffEnd = dmaPtr->startAddr + 0x500;
        if (addr >= startAddr && buffEnd >= addrEnd) {
            dmaPtr->frameCnt = nuAuFrameCounter;
            freeBuffer = (NUDMABuffer*)(dmaPtr->ptr + addr - dmaPtr->startAddr);
            return osVirtualToPhysical(freeBuffer);
        } else if (addr < startAddr) {
            break;
        }
        lastDmaPtr = dmaPtr;
        dmaPtr = (NUDMABuffer*)dmaPtr->node.next;
    }

    dmaPtr = nuAuDmaState.firstFree;
    if (dmaPtr == NULL) {
        return osVirtualToPhysical(nuAuDmaState.firstUsed);
    }

    nuAuDmaState.firstFree = (NUDMABuffer*)dmaPtr->node.next;
    alUnlink(&dmaPtr->node);

    if (lastDmaPtr != NULL) {
        alLink(&dmaPtr->node, &lastDmaPtr->node);
    } else if (nuAuDmaState.firstUsed != NULL){
        lastDmaPtr = nuAuDmaState.firstUsed;
        nuAuDmaState.firstUsed = dmaPtr;
        dmaPtr->node.next = &lastDmaPtr->node;
        dmaPtr->node.prev = NULL;
        lastDmaPtr->node.prev = &dmaPtr->node;
    } else {
        nuAuDmaState.firstUsed = dmaPtr;
        dmaPtr->node.next = NULL;
        dmaPtr->node.prev = NULL;
    }

    freeBuffer = (NUDMABuffer*)dmaPtr->ptr;
    delta = addr & 1;
    addr -= delta;
    dmaPtr->startAddr = addr;
    dmaPtr->frameCnt = nuAuFrameCounter;

    mesg = &nuAuDmaIOMesgBuf[nuAuDmaNext++];
    mesg->hdr.pri = OS_MESG_PRI_NORMAL;
    mesg->hdr.retQueue = &nuAuDmaMesgQ;
    mesg->dramAddr = freeBuffer;
    mesg->devAddr = addr;
    mesg->size = 0x500;
    osEPiStartDma(nuPiCartHandle, mesg, 0);
    return osVirtualToPhysical(freeBuffer) + delta;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel radiating_energy_orb_update
/* 3A0104 E009E1E4 27BDFFB8 */  addiu     $sp, $sp, -0x48
/* 3A0108 E009E1E8 AFB20018 */  sw        $s2, 0x18($sp)
/* 3A010C E009E1EC 0080902D */  daddu     $s2, $a0, $zero
/* 3A0110 E009E1F0 AFBF001C */  sw        $ra, 0x1C($sp)
/* 3A0114 E009E1F4 AFB10014 */  sw        $s1, 0x14($sp)
/* 3A0118 E009E1F8 AFB00010 */  sw        $s0, 0x10($sp)
/* 3A011C E009E1FC F7BC0040 */  sdc1      $f28, 0x40($sp)
/* 3A0120 E009E200 F7BA0038 */  sdc1      $f26, 0x38($sp)
/* 3A0124 E009E204 F7B80030 */  sdc1      $f24, 0x30($sp)
/* 3A0128 E009E208 F7B60028 */  sdc1      $f22, 0x28($sp)
/* 3A012C E009E20C F7B40020 */  sdc1      $f20, 0x20($sp)
/* 3A0130 E009E210 8E430000 */  lw        $v1, 0x0($s2)
/* 3A0134 E009E214 8E45000C */  lw        $a1, 0xC($s2)
/* 3A0138 E009E218 30620010 */  andi      $v0, $v1, 0x10
/* 3A013C E009E21C 10400005 */  beqz      $v0, .LE009E234
/* 3A0140 E009E220 2402FFEF */   addiu    $v0, $zero, -0x11
/* 3A0144 E009E224 00621024 */  and       $v0, $v1, $v0
/* 3A0148 E009E228 AE420000 */  sw        $v0, 0x0($s2)
/* 3A014C E009E22C 2402001E */  addiu     $v0, $zero, 0x1E
/* 3A0150 E009E230 ACA20018 */  sw        $v0, 0x18($a1)
.LE009E234:
/* 3A0154 E009E234 8CA30018 */  lw        $v1, 0x18($a1)
/* 3A0158 E009E238 28620064 */  slti      $v0, $v1, 0x64
/* 3A015C E009E23C 10400002 */  beqz      $v0, .LE009E248
/* 3A0160 E009E240 2462FFFF */   addiu    $v0, $v1, -0x1
/* 3A0164 E009E244 ACA20018 */  sw        $v0, 0x18($a1)
.LE009E248:
/* 3A0168 E009E248 8CA2001C */  lw        $v0, 0x1C($a1)
/* 3A016C E009E24C 8CA40018 */  lw        $a0, 0x18($a1)
/* 3A0170 E009E250 24430001 */  addiu     $v1, $v0, 0x1
/* 3A0174 E009E254 04810005 */  bgez      $a0, .LE009E26C
/* 3A0178 E009E258 ACA3001C */   sw       $v1, 0x1C($a1)
/* 3A017C E009E25C 0C080128 */  jal       shim_remove_effect
/* 3A0180 E009E260 0240202D */   daddu    $a0, $s2, $zero
/* 3A0184 E009E264 080278EC */  j         .LE009E3B0
/* 3A0188 E009E268 00000000 */   nop
.LE009E26C:
/* 3A018C E009E26C 28620015 */  slti      $v0, $v1, 0x15
/* 3A0190 E009E270 10400003 */  beqz      $v0, .LE009E280
/* 3A0194 E009E274 00031040 */   sll      $v0, $v1, 1
/* 3A0198 E009E278 080278A4 */  j         .LE009E290
/* 3A019C E009E27C 00431021 */   addu     $v0, $v0, $v1
.LE009E280:
/* 3A01A0 E009E280 28820014 */  slti      $v0, $a0, 0x14
/* 3A01A4 E009E284 10400004 */  beqz      $v0, .LE009E298
/* 3A01A8 E009E288 00041040 */   sll      $v0, $a0, 1
/* 3A01AC E009E28C 00441021 */  addu      $v0, $v0, $a0
.LE009E290:
/* 3A01B0 E009E290 00021080 */  sll       $v0, $v0, 2
/* 3A01B4 E009E294 ACA20014 */  sw        $v0, 0x14($a1)
.LE009E298:
/* 3A01B8 E009E298 8E420008 */  lw        $v0, 0x8($s2)
/* 3A01BC E009E29C 24110001 */  addiu     $s1, $zero, 0x1
/* 3A01C0 E009E2A0 0222102A */  slt       $v0, $s1, $v0
/* 3A01C4 E009E2A4 10400042 */  beqz      $v0, .LE009E3B0
/* 3A01C8 E009E2A8 24A50034 */   addiu    $a1, $a1, 0x34
/* 3A01CC E009E2AC 24B00020 */  addiu     $s0, $a1, 0x20
/* 3A01D0 E009E2B0 3C01428C */  lui       $at, (0x428C0000 >> 16)
/* 3A01D4 E009E2B4 4481E000 */  mtc1      $at, $f28
/* 3A01D8 E009E2B8 3C0142B4 */  lui       $at, (0x42B40000 >> 16)
/* 3A01DC E009E2BC 4481D000 */  mtc1      $at, $f26
/* 3A01E0 E009E2C0 3C014120 */  lui       $at, (0x41200000 >> 16)
/* 3A01E4 E009E2C4 4481C000 */  mtc1      $at, $f24
/* 3A01E8 E009E2C8 3C01437F */  lui       $at, (0x437F0000 >> 16)
/* 3A01EC E009E2CC 4481B000 */  mtc1      $at, $f22
/* 3A01F0 E009E2D0 3C01E00A */  lui       $at, (0xE00A0000 >> 16)
/* 3A01F4 E009E2D4 D434EE10 */  ldc1      $f20, -0x11F0($at)
.LE009E2D8:
/* 3A01F8 E009E2D8 C60C000C */  lwc1      $f12, 0xC($s0)
/* 3A01FC E009E2DC 461C6301 */  sub.s     $f12, $f12, $f28
/* 3A0200 E009E2E0 461A6302 */  mul.s     $f12, $f12, $f26
/* 3A0204 E009E2E4 00000000 */  nop
/* 3A0208 E009E2E8 0C080144 */  jal       shim_cos_deg
/* 3A020C E009E2EC 46186303 */   div.s    $f12, $f12, $f24
/* 3A0210 E009E2F0 46160002 */  mul.s     $f0, $f0, $f22
/* 3A0214 E009E2F4 00000000 */  nop
/* 3A0218 E009E2F8 C604000C */  lwc1      $f4, 0xC($s0)
/* 3A021C E009E2FC C6020010 */  lwc1      $f2, 0x10($s0)
/* 3A0220 E009E300 46022100 */  add.s     $f4, $f4, $f2
/* 3A0224 E009E304 3C0142A0 */  lui       $at, (0x42A00000 >> 16)
/* 3A0228 E009E308 44811000 */  mtc1      $at, $f2
/* 3A022C E009E30C E604000C */  swc1      $f4, 0xC($s0)
/* 3A0230 E009E310 4604103C */  c.lt.s    $f2, $f4
/* 3A0234 E009E314 4600018D */  trunc.w.s $f6, $f0
/* 3A0238 E009E318 E606FFF4 */  swc1      $f6, -0xC($s0)
/* 3A023C E009E31C 4500001F */  bc1f      .LE009E39C
/* 3A0240 E009E320 2404000F */   addiu    $a0, $zero, 0xF
/* 3A0244 E009E324 3C014270 */  lui       $at, (0x42700000 >> 16)
/* 3A0248 E009E328 44810000 */  mtc1      $at, $f0
/* 3A024C E009E32C 0C080138 */  jal       shim_rand_int
/* 3A0250 E009E330 E600000C */   swc1     $f0, 0xC($s0)
/* 3A0254 E009E334 44820000 */  mtc1      $v0, $f0
/* 3A0258 E009E338 00000000 */  nop
/* 3A025C E009E33C 46800021 */  cvt.d.w   $f0, $f0
/* 3A0260 E009E340 46340002 */  mul.d     $f0, $f0, $f20
/* 3A0264 E009E344 00000000 */  nop
/* 3A0268 E009E348 3C01E00A */  lui       $at, (0xE00A0000 >> 16)
/* 3A026C E009E34C D422EE18 */  ldc1      $f2, -0x11E8($at)
/* 3A0270 E009E350 46220000 */  add.d     $f0, $f0, $f2
/* 3A0274 E009E354 2404000A */  addiu     $a0, $zero, 0xA
/* 3A0278 E009E358 46200020 */  cvt.s.d   $f0, $f0
/* 3A027C E009E35C 0C080138 */  jal       shim_rand_int
/* 3A0280 E009E360 E6000008 */   swc1     $f0, 0x8($s0)
/* 3A0284 E009E364 44820000 */  mtc1      $v0, $f0
/* 3A0288 E009E368 00000000 */  nop
/* 3A028C E009E36C 46800021 */  cvt.d.w   $f0, $f0
/* 3A0290 E009E370 46340002 */  mul.d     $f0, $f0, $f20
/* 3A0294 E009E374 00000000 */  nop
/* 3A0298 E009E378 46340000 */  add.d     $f0, $f0, $f20
/* 3A029C E009E37C 24040168 */  addiu     $a0, $zero, 0x168
/* 3A02A0 E009E380 46200020 */  cvt.s.d   $f0, $f0
/* 3A02A4 E009E384 0C080138 */  jal       shim_rand_int
/* 3A02A8 E009E388 E6000010 */   swc1     $f0, 0x10($s0)
/* 3A02AC E009E38C 44820000 */  mtc1      $v0, $f0
/* 3A02B0 E009E390 00000000 */  nop
/* 3A02B4 E009E394 46800020 */  cvt.s.w   $f0, $f0
/* 3A02B8 E009E398 E6000000 */  swc1      $f0, 0x0($s0)
.LE009E39C:
/* 3A02BC E009E39C 26310001 */  addiu     $s1, $s1, 0x1
/* 3A02C0 E009E3A0 8E420008 */  lw        $v0, 0x8($s2)
/* 3A02C4 E009E3A4 0222102A */  slt       $v0, $s1, $v0
/* 3A02C8 E009E3A8 1440FFCB */  bnez      $v0, .LE009E2D8
/* 3A02CC E009E3AC 26100034 */   addiu    $s0, $s0, 0x34
.LE009E3B0:
/* 3A02D0 E009E3B0 8FBF001C */  lw        $ra, 0x1C($sp)
/* 3A02D4 E009E3B4 8FB20018 */  lw        $s2, 0x18($sp)
/* 3A02D8 E009E3B8 8FB10014 */  lw        $s1, 0x14($sp)
/* 3A02DC E009E3BC 8FB00010 */  lw        $s0, 0x10($sp)
/* 3A02E0 E009E3C0 D7BC0040 */  ldc1      $f28, 0x40($sp)
/* 3A02E4 E009E3C4 D7BA0038 */  ldc1      $f26, 0x38($sp)
/* 3A02E8 E009E3C8 D7B80030 */  ldc1      $f24, 0x30($sp)
/* 3A02EC E009E3CC D7B60028 */  ldc1      $f22, 0x28($sp)
/* 3A02F0 E009E3D0 D7B40020 */  ldc1      $f20, 0x20($sp)
/* 3A02F4 E009E3D4 03E00008 */  jr        $ra
/* 3A02F8 E009E3D8 27BD0048 */   addiu    $sp, $sp, 0x48

### DECOMPILED C INSTRUCTIONS:

void radiating_energy_orb_update(EffectInstance* effect) {
    RadiatingEnergyOrbFXData* part = effect->data.radiatingEnergyOrb;
    s32 unk_18;
    s32 unk_1C;
    s32 i;

    if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
        effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
        part->unk_18 = 30;
    }

    if (part->unk_18 < 100) {
        part->unk_18--;
    }

    part->unk_1C++;

    if (part->unk_18 < 0) {
        shim_remove_effect(effect);
        return;
    }

    unk_18 = part->unk_18;
    unk_1C = part->unk_1C;

    if (unk_1C < 21) {
        part->unk_14 = unk_1C * 12;
    } else if (unk_18 < 20) {
        part->unk_14 = unk_18 * 12;
    }

    part++;
    for (i = 1; i < effect->numParts; i++, part++) {
        part->unk_14 = shim_cos_deg((part->unk_2C - 70.0f) * 90.0f / 10.0f) * 255.0f;
        part->unk_2C += part->unk_30;
        if (part->unk_2C > 80.0f) {
            part->unk_2C = 60.0f;
            part->unk_28 = shim_rand_int(15) * 0.1 + 0.4;
            part->unk_30 = shim_rand_int(10) * 0.1 + 0.1;
            part->unk_20 = shim_rand_int(360);
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_8024DB1C
/* 140E5C 8024DB1C 27BDFF60 */  addiu     $sp, $sp, -0xA0
/* 140E60 8024DB20 AFB7008C */  sw        $s7, 0x8C($sp)
/* 140E64 8024DB24 0000B82D */  daddu     $s7, $zero, $zero
/* 140E68 8024DB28 3C02800A */  lui       $v0, %hi(gMainGfxPos)
/* 140E6C 8024DB2C 2442A66C */  addiu     $v0, $v0, %lo(gMainGfxPos)
/* 140E70 8024DB30 AFB10074 */  sw        $s1, 0x74($sp)
/* 140E74 8024DB34 0040882D */  daddu     $s1, $v0, $zero
/* 140E78 8024DB38 AFB40080 */  sw        $s4, 0x80($sp)
/* 140E7C 8024DB3C 3C14F548 */  lui       $s4, (0xF5485000 >> 16)
/* 140E80 8024DB40 3C018027 */  lui       $at, %hi(gPauseMapCameraY)
/* 140E84 8024DB44 C4200708 */  lwc1      $f0, %lo(gPauseMapCameraY)($at)
/* 140E88 8024DB48 36945000 */  ori       $s4, $s4, (0xF5485000 & 0xFFFF)
/* 140E8C 8024DB4C AFBE0090 */  sw        $fp, 0x90($sp)
/* 140E90 8024DB50 3C1EE700 */  lui       $fp, (0xE7000000 >> 16)
/* 140E94 8024DB54 AFB50084 */  sw        $s5, 0x84($sp)
/* 140E98 8024DB58 AFA500A4 */  sw        $a1, 0xA4($sp)
/* 140E9C 8024DB5C 24B5001A */  addiu     $s5, $a1, 0x1A
/* 140EA0 8024DB60 AFB60088 */  sw        $s6, 0x88($sp)
/* 140EA4 8024DB64 24B60104 */  addiu     $s6, $a1, 0x104
/* 140EA8 8024DB68 AFB20078 */  sw        $s2, 0x78($sp)
/* 140EAC 8024DB6C 24120004 */  addiu     $s2, $zero, 0x4
/* 140EB0 8024DB70 AFB3007C */  sw        $s3, 0x7C($sp)
/* 140EB4 8024DB74 24130016 */  addiu     $s3, $zero, 0x16
/* 140EB8 8024DB78 AFB00070 */  sw        $s0, 0x70($sp)
/* 140EBC 8024DB7C 02E0802D */  daddu     $s0, $s7, $zero
/* 140EC0 8024DB80 AFBF0094 */  sw        $ra, 0x94($sp)
/* 140EC4 8024DB84 F7B40098 */  sdc1      $f20, 0x98($sp)
/* 140EC8 8024DB88 AFA600A8 */  sw        $a2, 0xA8($sp)
/* 140ECC 8024DB8C AFA700AC */  sw        $a3, 0xAC($sp)
/* 140ED0 8024DB90 8E220000 */  lw        $v0, 0x0($s1)
/* 140ED4 8024DB94 4600018D */  trunc.w.s $f6, $f0
/* 140ED8 8024DB98 E7A60054 */  swc1      $f6, 0x54($sp)
/* 140EDC 8024DB9C 3C018027 */  lui       $at, %hi(gPauseMapCameraX)
/* 140EE0 8024DBA0 C4200704 */  lwc1      $f0, %lo(gPauseMapCameraX)($at)
/* 140EE4 8024DBA4 0040202D */  daddu     $a0, $v0, $zero
/* 140EE8 8024DBA8 4600018D */  trunc.w.s $f6, $f0
/* 140EEC 8024DBAC E7A60050 */  swc1      $f6, 0x50($sp)
D_8024DBB0_C0B430:
/* 140EF0 8024DBB0 8FAF0050 */  lw        $t7, 0x50($sp)
/* 140EF4 8024DBB4 24420008 */  addiu     $v0, $v0, 0x8
/* 140EF8 8024DBB8 000F1823 */  negu      $v1, $t7
/* 140EFC 8024DBBC 00031940 */  sll       $v1, $v1, 5

### DECOMPILED C INSTRUCTIONS:

void pause_map_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
    s32 cameraX = gPauseMapCameraX;
    s32 cameraY = gPauseMapCameraY;
    s32 i, j;
    s32 tileHeight;
    s32 x1, y1, x2, y2;
    s32 x1a, y1a, x2a, y2a;
    s32 posX, posY;
    s32 ult;
    PauseMapSpace* mapSpace;
    s32 camX, camY;
    s32 pathX, pathY;
    s32 currentTab;
    s32 offset, offsetLeft, offsetRight, offsetUp, offsetDown;
    s32 mapULX, mapULY;
    s32 bigPointX, bigPointY;
    Vec2b* path;
    s32 pathLength;

    gSPDisplayList(gMainGfxPos++, gPauseDLWorldMap);
    ult = -cameraX * 32;
    for (i = 0; i < 60; i++) {
        if (4 * i + 4 < 111) {
            tileHeight = 4;
        } else {
            tileHeight = 111 - 4 * i;
        }

        gDPLoadTextureTile(gMainGfxPos++, pause_world_map_png, G_IM_FMT_CI, G_IM_SIZ_8b, 320, 320,
                        0, i * 4 - cameraY, 319, i * 4 + tileHeight - 1 - cameraY, 0,
                        G_TX_CLAMP, G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
        pause_draw_rect((baseX + 26) * 4, (baseY + 22 + 4 * i) * 4, (baseX + 260) * 4,
        (baseY + 22 + i * 4 + tileHeight) * 4, 0, ult, (-cameraY + i * 4) * 32, 0x400, 0x400);
        gDPPipeSync(gMainGfxPos++);

        if (4 * i + 4 >= 110) {
            break;
        }
    }

    gSPDisplayList(gMainGfxPos++, gPauseDLPathPoints);

    x1 = baseX + 26;
    y1 = baseY + 22;
    x2 = baseX + 260;
    y2 = baseY + 132;

    if (x1 <= 0) {
        x1 = 1;
    }
    if (y1 <= 0) {
        y1 = 1;
    }

    if (x2 <= 0 || y2 <= 0 || x1 >= SCREEN_WIDTH - 1 || y1 >= SCREEN_HEIGHT - 1) {
        return;
    }

    if (x2 >= SCREEN_WIDTH - 1) {
        x2 = SCREEN_WIDTH - 1;
    }
    if (y2 >= SCREEN_HEIGHT - 1) {
        y2 = SCREEN_HEIGHT - 1;
    }

    gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, x1, y1, x2, y2);

    mapSpace = gPauseMapSpaces;
    camX = cameraX + baseX;
    camY = cameraY + baseY;
    for (i = 0; i < ARRAY_COUNT(gPauseMapSpaces); i++, mapSpace++) {
        posX = mapSpace->pos.x;
        posY = mapSpace->pos.y;

        if (evt_get_variable(NULL, GF_MAP_ToadTown + i) == 0) {
            continue;
        }

        if (i != gPauseMapCursorCurrentOption) {
            gDPSetPrimColor(gMainGfxPos++, 0, 0, 220, 80, 30, 255);
        } else {
            gDPSetPrimColor(gMainGfxPos++, 0, 0, (gGameStatusPtr->frameCounter * 10) % 120 + 120,
                                                   (gGameStatusPtr->frameCounter * 10) % 120 + 120,
                                                   (gGameStatusPtr->frameCounter * 10) % 120, 255);
        }

        bigPointX = camX + 26 + posX;
        bigPointY = camY + 22 + posY;
        pause_draw_rect((bigPointX - 8) * 4, (bigPointY - 8) * 4, (bigPointX + 8) * 4, (bigPointY + 8) * 4, 0, 0, 0, 0x400, 0x400);
        gDPPipeSync(gMainGfxPos++);
        gDPSetPrimColor(gMainGfxPos++, 0, 0, 230, 190, 180, 255);

        pathLength = mapSpace->pathLength;
        path = mapSpace->path;
        if (path) {
            pathX = 0;
            pathY = 0;
            for (j = 0; j < pathLength; j++, path++) {
                pathX += path->x;
                pathY += path->y;
                pause_draw_rect((camX + 26 + posX + pathX - 8) * 4, (camY + 22 + posY + pathY - 8) * 4, (camX + 26 + posX + pathX + 8) * 4, (camY + 22 + posY + pathY + 8) * 4, 1, 0, 0, 0x400, 0x400);
            }
        }
    }

    mapULX = baseX + 26 + cameraX;
    mapULY = baseY + 22 + cameraY;
    hud_element_set_render_pos(gPauseMapIconIDs[0], mapULX + gPauseMapMarioX, mapULY + gPauseMapMarioY - 7);
    hud_element_draw_without_clipping(gPauseMapIconIDs[0]);

    currentTab = gPauseMenuCurrentTab;
    if (currentTab == 6) {
        pause_set_cursor_pos(WINDOW_ID_PAUSE_MAP, mapULX + gPauseMapTargetX - 8.0f, mapULY + gPauseMapTargetY);

        if (gPauseMenuCurrentTab == currentTab) {
            offset = gPauseMapArrowWobble[gGameStatusPtr->frameCounter % 12];
            offsetLeft = offset;
            offsetRight = offset;
            offsetUp = offset;
            offsetDown = offset;

            gSPDisplayList(gMainGfxPos++, gPauseDLArrows);

            if (!(gPauseMapCameraX < 0.0f)) {
                offsetLeft = 0;
            }
            pause_map_draw_border_arrows(0, baseX + 26 - offsetLeft, baseY + height / 2 - 8);

            if (!(gPauseMapCameraX > -86.0f)) {
                offsetRight = 0;
            }
            pause_map_draw_border_arrows(1, baseX + width - 50 + offsetRight, baseY + height / 2 - 8);

            if (!(gPauseMapCameraY < 0.0f)) {
                offsetUp = 0;
            }
            pause_map_draw_border_arrows(2, baseX + width / 2 - 8, baseY + 24 - offsetUp);

            if (!(gPauseMapCameraY > -210.0f)) {
                offsetDown = 0;
            }
            pause_map_draw_border_arrows(3, baseX + width / 2 - 8, baseY + height - 44 + offsetDown);
        }
    }
    {
        s32 x1, y1, x2, y2;

        x1 = baseX + 18;
        y1 = baseY + 14;
        x2 = baseX + 268;
        y2 = baseY + 140;

        if (x1 <= 0) {
            x1 = 1;
        }
        if (y1 <= 0) {
            y1 = 1;
        }

        if (x2 <= 0 || y2 <= 0 || x1 >= SCREEN_WIDTH - 1 || y1 >= SCREEN_HEIGHT - 1) {
            return;
        }

        if (x2 >= SCREEN_WIDTH - 1) {
            x2 = SCREEN_WIDTH - 1;
        }
        if (y2 >= SCREEN_HEIGHT - 1) {
            y2 = SCREEN_HEIGHT - 1;
        }

        gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, x1, y1, x2, y2);
    }
    draw_box(0, &gPauseWS_27, baseX + 18, baseY + 14, 0, 250, 126, opacity, darkening, 1.0f, 1.0f, 0, 0, 0, 0, 0, 0, width, height, 0);
}