### RAW ASSEMBLY INSTRUCTIONS:

glabel lightning_update
/* 36E470 E006C2A0 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 36E474 E006C2A4 AFBF0020 */  sw        $ra, 0x20($sp)
/* 36E478 E006C2A8 AFB3001C */  sw        $s3, 0x1C($sp)
/* 36E47C E006C2AC AFB20018 */  sw        $s2, 0x18($sp)
/* 36E480 E006C2B0 AFB10014 */  sw        $s1, 0x14($sp)
/* 36E484 E006C2B4 AFB00010 */  sw        $s0, 0x10($sp)
/* 36E488 E006C2B8 8C830000 */  lw        $v1, 0x0($a0)
/* 36E48C E006C2BC 8C90000C */  lw        $s0, 0xC($a0)
/* 36E490 E006C2C0 30620010 */  andi      $v0, $v1, 0x10
/* 36E494 E006C2C4 10400004 */  beqz      $v0, .LE006C2D8
/* 36E498 E006C2C8 2402FFEF */   addiu    $v0, $zero, -0x11
/* 36E49C E006C2CC 00621024 */  and       $v0, $v1, $v0
/* 36E4A0 E006C2D0 AC820000 */  sw        $v0, 0x0($a0)
/* 36E4A4 E006C2D4 AE000014 */  sw        $zero, 0x14($s0)
.LE006C2D8:
/* 36E4A8 E006C2D8 8E030014 */  lw        $v1, 0x14($s0)
/* 36E4AC E006C2DC 8E120000 */  lw        $s2, 0x0($s0)
/* 36E4B0 E006C2E0 28620064 */  slti      $v0, $v1, 0x64
/* 36E4B4 E006C2E4 10400002 */  beqz      $v0, .LE006C2F0
/* 36E4B8 E006C2E8 2462FFFF */   addiu    $v0, $v1, -0x1
/* 36E4BC E006C2EC AE020014 */  sw        $v0, 0x14($s0)
.LE006C2F0:
/* 36E4C0 E006C2F0 8E020018 */  lw        $v0, 0x18($s0)
/* 36E4C4 E006C2F4 8E050014 */  lw        $a1, 0x14($s0)
/* 36E4C8 E006C2F8 24420001 */  addiu     $v0, $v0, 0x1
/* 36E4CC E006C2FC 04A10010 */  bgez      $a1, .LE006C340
/* 36E4D0 E006C300 AE020018 */   sw       $v0, 0x18($s0)
/* 36E4D4 E006C304 0C080128 */  jal       shim_remove_effect
/* 36E4D8 E006C308 00000000 */   nop
/* 36E4DC E006C30C 8E040048 */  lw        $a0, 0x48($s0)
/* 36E4E0 E006C310 10800004 */  beqz      $a0, .LE006C324
/* 36E4E4 E006C314 00000000 */   nop
/* 36E4E8 E006C318 0C080128 */  jal       shim_remove_effect
/* 36E4EC E006C31C 00000000 */   nop
/* 36E4F0 E006C320 AE000048 */  sw        $zero, 0x48($s0)
.LE006C324:
/* 36E4F4 E006C324 8E040044 */  lw        $a0, 0x44($s0)
/* 36E4F8 E006C328 10800096 */  beqz      $a0, .LE006C584
/* 36E4FC E006C32C 00000000 */   nop
/* 36E500 E006C330 0C080128 */  jal       shim_remove_effect
/* 36E504 E006C334 00000000 */   nop
/* 36E508 E006C338 0801B161 */  j         .LE006C584
/* 36E50C E006C33C AE000044 */   sw       $zero, 0x44($s0)
.LE006C340:
/* 36E510 E006C340 00A0982D */  daddu     $s3, $a1, $zero
/* 36E514 E006C344 8E040044 */  lw        $a0, 0x44($s0)
/* 36E518 E006C348 10800007 */  beqz      $a0, .LE006C368
/* 36E51C E006C34C 0040882D */   daddu    $s1, $v0, $zero
/* 36E520 E006C350 2A220012 */  slti      $v0, $s1, 0x12
/* 36E524 E006C354 14400005 */  bnez      $v0, .LE006C36C
/* 36E528 E006C358 2A420003 */   slti     $v0, $s2, 0x3
/* 36E52C E006C35C 0C080128 */  jal       shim_remove_effect
/* 36E530 E006C360 00000000 */   nop
/* 36E534 E006C364 AE000044 */  sw        $zero, 0x44($s0)
.LE006C368:
/* 36E538 E006C368 2A420003 */  slti      $v0, $s2, 0x3
.LE006C36C:
/* 36E53C E006C36C 14400003 */  bnez      $v0, .LE006C37C
/* 36E540 E006C370 2A220007 */   slti     $v0, $s1, 0x7
/* 36E544 E006C374 10400074 */  beqz      $v0, .LE006C548
/* 36E548 E006C378 2A420003 */   slti     $v0, $s2, 0x3
.LE006C37C:
/* 36E54C E006C37C C600001C */  lwc1      $f0, 0x1C($s0)
/* 36E550 E006C380 C602002C */  lwc1      $f2, 0x2C($s0)
/* 36E554 E006C384 46020080 */  add.s     $f2, $f0, $f2
/* 36E558 E006C388 44800000 */  mtc1      $zero, $f0
/* 36E55C E006C38C 00000000 */  nop
/* 36E560 E006C390 4600103C */  c.lt.s    $f2, $f0
/* 36E564 E006C394 00000000 */  nop
/* 36E568 E006C398 45000005 */  bc1f      .LE006C3B0
/* 36E56C E006C39C E602001C */   swc1     $f2, 0x1C($s0)
/* 36E570 E006C3A0 3C014380 */  lui       $at, (0x43800000 >> 16)
/* 36E574 E006C3A4 44810000 */  mtc1      $at, $f0
/* 36E578 E006C3A8 0801B0F4 */  j         .LE006C3D0
/* 36E57C E006C3AC 46001000 */   add.s    $f0, $f2, $f0
.LE006C3B0:
/* 36E580 E006C3B0 3C014380 */  lui       $at, (0x43800000 >> 16)
/* 36E584 E006C3B4 44810000 */  mtc1      $at, $f0
/* 36E588 E006C3B8 00000000 */  nop
/* 36E58C E006C3BC 4602003C */  c.lt.s    $f0, $f2
/* 36E590 E006C3C0 00000000 */  nop
/* 36E594 E006C3C4 45000003 */  bc1f      .LE006C3D4
/* 36E598 E006C3C8 00000000 */   nop
/* 36E59C E006C3CC 46001001 */  sub.s     $f0, $f2, $f0
.LE006C3D0:
/* 36E5A0 E006C3D0 E600001C */  swc1      $f0, 0x1C($s0)
.LE006C3D4:
/* 36E5A4 E006C3D4 8E02003C */  lw        $v0, 0x3C($s0)
/* 36E5A8 E006C3D8 14400002 */  bnez      $v0, .LE006C3E4
/* 36E5AC E006C3DC 0222001A */   div      $zero, $s1, $v0
/* 36E5B0 E006C3E0 0007000D */  break     7
.LE006C3E4:
/* 36E5B4 E006C3E4 2401FFFF */  addiu     $at, $zero, -0x1
/* 36E5B8 E006C3E8 14410004 */  bne       $v0, $at, .LE006C3FC
/* 36E5BC E006C3EC 3C018000 */   lui      $at, (0x80000000 >> 16)
/* 36E5C0 E006C3F0 16210002 */  bne       $s1, $at, .LE006C3FC
/* 36E5C4 E006C3F4 00000000 */   nop
/* 36E5C8 E006C3F8 0006000D */  break     6
.LE006C3FC:
/* 36E5CC E006C3FC 00001810 */  mfhi      $v1
/* 36E5D0 E006C400 14600017 */  bnez      $v1, .LE006C460
/* 36E5D4 E006C404 00000000 */   nop
/* 36E5D8 E006C408 C6000020 */  lwc1      $f0, 0x20($s0)
/* 36E5DC E006C40C C6020030 */  lwc1      $f2, 0x30($s0)
/* 36E5E0 E006C410 46020080 */  add.s     $f2, $f0, $f2
/* 36E5E4 E006C414 44800000 */  mtc1      $zero, $f0
/* 36E5E8 E006C418 00000000 */  nop
/* 36E5EC E006C41C 4600103C */  c.lt.s    $f2, $f0
/* 36E5F0 E006C420 00000000 */  nop
/* 36E5F4 E006C424 45000005 */  bc1f      .LE006C43C
/* 36E5F8 E006C428 E6020020 */   swc1     $f2, 0x20($s0)
/* 36E5FC E006C42C 3C014280 */  lui       $at, (0x42800000 >> 16)
/* 36E600 E006C430 44810000 */  mtc1      $at, $f0
/* 36E604 E006C434 0801B117 */  j         .LE006C45C
/* 36E608 E006C438 46001000 */   add.s    $f0, $f2, $f0
.LE006C43C:
/* 36E60C E006C43C 3C014280 */  lui       $at, (0x42800000 >> 16)
/* 36E610 E006C440 44810000 */  mtc1      $at, $f0
/* 36E614 E006C444 00000000 */  nop
/* 36E618 E006C448 4602003C */  c.lt.s    $f0, $f2
/* 36E61C E006C44C 00000000 */  nop
/* 36E620 E006C450 45000003 */  bc1f      .LE006C460
/* 36E624 E006C454 00000000 */   nop
/* 36E628 E006C458 46001001 */  sub.s     $f0, $f2, $f0
.LE006C45C:
/* 36E62C E006C45C E6000020 */  swc1      $f0, 0x20($s0)
.LE006C460:
/* 36E630 E006C460 8E020040 */  lw        $v0, 0x40($s0)
/* 36E634 E006C464 14400002 */  bnez      $v0, .LE006C470
/* 36E638 E006C468 0222001A */   div      $zero, $s1, $v0
/* 36E63C E006C46C 0007000D */  break     7
.LE006C470:
/* 36E640 E006C470 2401FFFF */  addiu     $at, $zero, -0x1
/* 36E644 E006C474 14410004 */  bne       $v0, $at, .LE006C488
/* 36E648 E006C478 3C018000 */   lui      $at, (0x80000000 >> 16)
/* 36E64C E006C47C 16210002 */  bne       $s1, $at, .LE006C488
/* 36E650 E006C480 00000000 */   nop
/* 36E654 E006C484 0006000D */  break     6
.LE006C488:
/* 36E658 E006C488 00001810 */  mfhi      $v1
/* 36E65C E006C48C 14600017 */  bnez      $v1, .LE006C4EC
/* 36E660 E006C490 00000000 */   nop
/* 36E664 E006C494 C6000024 */  lwc1      $f0, 0x24($s0)
/* 36E668 E006C498 C6020034 */  lwc1      $f2, 0x34($s0)
/* 36E66C E006C49C 46020080 */  add.s     $f2, $f0, $f2
/* 36E670 E006C4A0 44800000 */  mtc1      $zero, $f0
/* 36E674 E006C4A4 00000000 */  nop
/* 36E678 E006C4A8 4600103C */  c.lt.s    $f2, $f0
/* 36E67C E006C4AC 00000000 */  nop
/* 36E680 E006C4B0 45000005 */  bc1f      .LE006C4C8
/* 36E684 E006C4B4 E6020024 */   swc1     $f2, 0x24($s0)
/* 36E688 E006C4B8 3C014380 */  lui       $at, (0x43800000 >> 16)
/* 36E68C E006C4BC 44810000 */  mtc1      $at, $f0
/* 36E690 E006C4C0 0801B13A */  j         .LE006C4E8
/* 36E694 E006C4C4 46001000 */   add.s    $f0, $f2, $f0
.LE006C4C8:
/* 36E698 E006C4C8 3C014380 */  lui       $at, (0x43800000 >> 16)
/* 36E69C E006C4CC 44810000 */  mtc1      $at, $f0
/* 36E6A0 E006C4D0 00000000 */  nop
/* 36E6A4 E006C4D4 4602003C */  c.lt.s    $f0, $f2
/* 36E6A8 E006C4D8 00000000 */  nop
/* 36E6AC E006C4DC 45000003 */  bc1f      .LE006C4EC
/* 36E6B0 E006C4E0 00000000 */   nop
/* 36E6B4 E006C4E4 46001001 */  sub.s     $f0, $f2, $f0
.LE006C4E8:
/* 36E6B8 E006C4E8 E6000024 */  swc1      $f0, 0x24($s0)
.LE006C4EC:
/* 36E6BC E006C4EC C6000028 */  lwc1      $f0, 0x28($s0)
/* 36E6C0 E006C4F0 C6020038 */  lwc1      $f2, 0x38($s0)
/* 36E6C4 E006C4F4 46020080 */  add.s     $f2, $f0, $f2
/* 36E6C8 E006C4F8 44800000 */  mtc1      $zero, $f0
/* 36E6CC E006C4FC 00000000 */  nop
/* 36E6D0 E006C500 4600103C */  c.lt.s    $f2, $f0
/* 36E6D4 E006C504 00000000 */  nop
/* 36E6D8 E006C508 45000005 */  bc1f      .LE006C520
/* 36E6DC E006C50C E6020028 */   swc1     $f2, 0x28($s0)
/* 36E6E0 E006C510 3C014280 */  lui       $at, (0x42800000 >> 16)
/* 36E6E4 E006C514 44810000 */  mtc1      $at, $f0
/* 36E6E8 E006C518 0801B150 */  j         .LE006C540
/* 36E6EC E006C51C 46001000 */   add.s    $f0, $f2, $f0
.LE006C520:
/* 36E6F0 E006C520 3C014280 */  lui       $at, (0x42800000 >> 16)
/* 36E6F4 E006C524 44810000 */  mtc1      $at, $f0
/* 36E6F8 E006C528 00000000 */  nop
/* 36E6FC E006C52C 4602003C */  c.lt.s    $f0, $f2
/* 36E700 E006C530 00000000 */  nop
/* 36E704 E006C534 45000004 */  bc1f      .LE006C548
/* 36E708 E006C538 2A420003 */   slti     $v0, $s2, 0x3
/* 36E70C E006C53C 46001001 */  sub.s     $f0, $f2, $f0
.LE006C540:
/* 36E710 E006C540 E6000028 */  swc1      $f0, 0x28($s0)
/* 36E714 E006C544 2A420003 */  slti      $v0, $s2, 0x3
.LE006C548:
/* 36E718 E006C548 14400007 */  bnez      $v0, .LE006C568
/* 36E71C E006C54C 2A62000A */   slti     $v0, $s3, 0xA
/* 36E720 E006C550 2A220007 */  slti      $v0, $s1, 0x7
/* 36E724 E006C554 1440000B */  bnez      $v0, .LE006C584
/* 36E728 E006C558 00000000 */   nop
/* 36E72C E006C55C 8E020010 */  lw        $v0, 0x10($s0)
/* 36E730 E006C560 0801B15E */  j         .LE006C578
/* 36E734 E006C564 2442FFF3 */   addiu    $v0, $v0, -0xD
.LE006C568:
/* 36E738 E006C568 10400006 */  beqz      $v0, .LE006C584
/* 36E73C E006C56C 00000000 */   nop
/* 36E740 E006C570 8E020010 */  lw        $v0, 0x10($s0)
/* 36E744 E006C574 2442FFE7 */  addiu     $v0, $v0, -0x19
.LE006C578:
/* 36E748 E006C578 04410002 */  bgez      $v0, .LE006C584
/* 36E74C E006C57C AE020010 */   sw       $v0, 0x10($s0)
/* 36E750 E006C580 AE000010 */  sw        $zero, 0x10($s0)
.LE006C584:
/* 36E754 E006C584 8FBF0020 */  lw        $ra, 0x20($sp)
/* 36E758 E006C588 8FB3001C */  lw        $s3, 0x1C($sp)
/* 36E75C E006C58C 8FB20018 */  lw        $s2, 0x18($sp)
/* 36E760 E006C590 8FB10014 */  lw        $s1, 0x14($sp)
/* 36E764 E006C594 8FB00010 */  lw        $s0, 0x10($sp)
/* 36E768 E006C598 03E00008 */  jr        $ra
/* 36E76C E006C59C 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

void lightning_update(EffectInstance* effect) {
    LightningFXData* data = effect->data.lightning;
    s32 unk_00;

    if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
        effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
        data->unk_14 = 0;
    }

    unk_00 = data->unk_00;

    if (data->unk_14 < 100) {
        data->unk_14--;
    }

    data->unk_18++;

    if (data->unk_14 < 0) {
        shim_remove_effect(effect);

        if (data->unk_48 != NULL) {
            shim_remove_effect(data->unk_48);
            data->unk_48 = NULL;
        }

        if (data->unk_44 != NULL) {
            shim_remove_effect(data->unk_44);
            data->unk_44 = NULL;
        }
    } else {
        s32 unk_14 = data->unk_14;
        s32 unk_18 = data->unk_18;

        if (data->unk_44 != NULL && unk_18 >= 18) {
            shim_remove_effect(data->unk_44);
            data->unk_44 = NULL;
        }

        if (unk_00 < 3 || unk_18 < 7) {
            data->unk_1C += data->unk_2C;
            if (data->unk_1C < 0.0f) {
                data->unk_1C += 256.0f;
            } else if (data->unk_1C > 256.0f) {
                data->unk_1C -= 256.0f;
            }

            if (unk_18 % data->unk_3C == 0) {
                data->unk_20 += data->unk_30;
                if (data->unk_20 < 0.0f) {
                    data->unk_20 += 64.0f;
                } else if (data->unk_20 > 64.0f) {
                    data->unk_20 -= 64.0f;
                }
            }

            if (unk_18 % data->unk_40 == 0) {
                data->unk_24 += data->unk_34;
                if (data->unk_24 < 0.0f) {
                    data->unk_24 += 256.0f;
                } else if (data->unk_24 > 256.0f) {
                    data->unk_24 -= 256.0f;
                }
            }

            data->unk_28 += data->unk_38;
            if (data->unk_28 < 0.0f) {
                data->unk_28 += 64.0f;
            }
            else if (data->unk_28 > 64.0f) {
                data->unk_28 -= 64.0f;
            }
        }

        if (unk_00 >= 3) {
            if (unk_18 >= 7) {
                data->unk_10 -= 13;
                if (data->unk_10 < 0) {
                    data->unk_10 = 0;
                }
            }
        } else if (unk_14 < 10) {
            data->unk_10 -= 25;
            if (data->unk_10 < 0) {
                data->unk_10 = 0;
            }
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel pink_sparkles_main
/* 412730 E0124000 27BDFF90 */  addiu     $sp, $sp, -0x70
/* 412734 E0124004 F7B40050 */  sdc1      $f20, 0x50($sp)
/* 412738 E0124008 4485A000 */  mtc1      $a1, $f20
/* 41273C E012400C F7B60058 */  sdc1      $f22, 0x58($sp)
/* 412740 E0124010 4486B000 */  mtc1      $a2, $f22
/* 412744 E0124014 AFA40070 */  sw        $a0, 0x70($sp)
/* 412748 E0124018 27A40010 */  addiu     $a0, $sp, 0x10
/* 41274C E012401C F7B80060 */  sdc1      $f24, 0x60($sp)
/* 412750 E0124020 4487C000 */  mtc1      $a3, $f24
/* 412754 E0124024 3C02E012 */  lui       $v0, %hi(pink_sparkles_init)
/* 412758 E0124028 244242FC */  addiu     $v0, $v0, %lo(pink_sparkles_init)
/* 41275C E012402C AFA20018 */  sw        $v0, 0x18($sp)
/* 412760 E0124030 3C02E012 */  lui       $v0, %hi(pink_sparkles_update)
/* 412764 E0124034 24424304 */  addiu     $v0, $v0, %lo(pink_sparkles_update)
/* 412768 E0124038 AFA2001C */  sw        $v0, 0x1C($sp)
/* 41276C E012403C 3C02E012 */  lui       $v0, %hi(pink_sparkles_render)
/* 412770 E0124040 2442448C */  addiu     $v0, $v0, %lo(pink_sparkles_render)
/* 412774 E0124044 AFA20020 */  sw        $v0, 0x20($sp)
/* 412778 E0124048 24020084 */  addiu     $v0, $zero, 0x84
/* 41277C E012404C AFBF004C */  sw        $ra, 0x4C($sp)
/* 412780 E0124050 AFBE0048 */  sw        $fp, 0x48($sp)
/* 412784 E0124054 AFB70044 */  sw        $s7, 0x44($sp)
/* 412788 E0124058 AFB60040 */  sw        $s6, 0x40($sp)
/* 41278C E012405C AFB5003C */  sw        $s5, 0x3C($sp)
/* 412790 E0124060 AFB40038 */  sw        $s4, 0x38($sp)
/* 412794 E0124064 AFB30034 */  sw        $s3, 0x34($sp)
/* 412798 E0124068 AFB20030 */  sw        $s2, 0x30($sp)
/* 41279C E012406C AFB1002C */  sw        $s1, 0x2C($sp)
/* 4127A0 E0124070 AFB00028 */  sw        $s0, 0x28($sp)
/* 4127A4 E0124074 F7BA0068 */  sdc1      $f26, 0x68($sp)
/* 4127A8 E0124078 AFA00010 */  sw        $zero, 0x10($sp)
/* 4127AC E012407C AFA00024 */  sw        $zero, 0x24($sp)
/* 4127B0 E0124080 0C080124 */  jal       shim_create_effect_instance
/* 4127B4 E0124084 AFA20014 */   sw       $v0, 0x14($sp)
/* 4127B8 E0124088 2404115C */  addiu     $a0, $zero, 0x115C
/* 4127BC E012408C 24170065 */  addiu     $s7, $zero, 0x65
/* 4127C0 E0124090 0040F02D */  daddu     $fp, $v0, $zero
/* 4127C4 E0124094 0C08012C */  jal       shim_general_heap_malloc
/* 4127C8 E0124098 AFD70008 */   sw       $s7, 0x8($fp)
/* 4127CC E012409C 0040882D */  daddu     $s1, $v0, $zero
/* 4127D0 E01240A0 16200003 */  bnez      $s1, .LE01240B0
/* 4127D4 E01240A4 AFD1000C */   sw       $s1, 0xC($fp)
.LE01240A8:
/* 4127D8 E01240A8 0804902A */  j         .LE01240A8
/* 4127DC E01240AC 00000000 */   nop
.LE01240B0:
/* 4127E0 E01240B0 24020050 */  addiu     $v0, $zero, 0x50
/* 4127E4 E01240B4 24120001 */  addiu     $s2, $zero, 0x1
/* 4127E8 E01240B8 E6340004 */  swc1      $f20, 0x4($s1)
/* 4127EC E01240BC E6360008 */  swc1      $f22, 0x8($s1)
/* 4127F0 E01240C0 E638000C */  swc1      $f24, 0xC($s1)
/* 4127F4 E01240C4 AE200020 */  sw        $zero, 0x20($s1)
/* 4127F8 E01240C8 8FA80070 */  lw        $t0, 0x70($sp)
/* 4127FC E01240CC 3C01E012 */  lui       $at, (0xE0124C00 >> 16)
/* 412800 E01240D0 D4384C00 */  ldc1      $f24, (0xE0124C00 & 0xFFFF)($at)
/* 412804 E01240D4 3C01E012 */  lui       $at, (0xE0124C08 >> 16)
/* 412808 E01240D8 D4364C08 */  ldc1      $f22, (0xE0124C08 & 0xFFFF)($at)
/* 41280C E01240DC 0000A82D */  daddu     $s5, $zero, $zero
/* 412810 E01240E0 AE22001C */  sw        $v0, 0x1C($s1)
/* 412814 E01240E4 AE280000 */  sw        $t0, 0x0($s1)
/* 412818 E01240E8 2631002C */  addiu     $s1, $s1, 0x2C
/* 41281C E01240EC C7BA0084 */  lwc1      $f26, 0x84($sp)
/* 412820 E01240F0 0000982D */  daddu     $s3, $zero, $zero
.LE01240F4:
/* 412824 E01240F4 2408000F */  addiu     $t0, $zero, 0xF
/* 412828 E01240F8 01151023 */  subu      $v0, $t0, $s5
/* 41282C E01240FC 0002B100 */  sll       $s6, $v0, 4
/* 412830 E0124100 2414FFF0 */  addiu     $s4, $zero, -0x10
/* 412834 E0124104 26300020 */  addiu     $s0, $s1, 0x20
.LE0124108:
/* 412838 E0124108 8FA80070 */  lw        $t0, 0x70($sp)
/* 41283C E012410C 02761021 */  addu      $v0, $s3, $s6
/* 412840 E0124110 00081A00 */  sll       $v1, $t0, 8
/* 412844 E0124114 00431021 */  addu      $v0, $v0, $v1
/* 412848 E0124118 3C08E012 */  lui       $t0, %hi(D_E01248C0)
/* 41284C E012411C 250848C0 */  addiu     $t0, $t0, %lo(D_E01248C0)
/* 412850 E0124120 00481021 */  addu      $v0, $v0, $t0
/* 412854 E0124124 80430000 */  lb        $v1, 0x0($v0)
/* 412858 E0124128 2402002E */  addiu     $v0, $zero, 0x2E
/* 41285C E012412C 50620049 */  beql      $v1, $v0, .LE0124254
/* 412860 E0124130 26730001 */   addiu    $s3, $s3, 0x1
/* 412864 E0124134 0C080138 */  jal       shim_rand_int
/* 412868 E0124138 24040014 */   addiu    $a0, $zero, 0x14
/* 41286C E012413C 2442FFF6 */  addiu     $v0, $v0, -0xA
/* 412870 E0124140 44820000 */  mtc1      $v0, $f0
/* 412874 E0124144 00000000 */  nop
/* 412878 E0124148 46800021 */  cvt.d.w   $f0, $f0
/* 41287C E012414C 46380002 */  mul.d     $f0, $f0, $f24
/* 412880 E0124150 00000000 */  nop
/* 412884 E0124154 4494A000 */  mtc1      $s4, $f20
/* 412888 E0124158 00000000 */  nop
/* 41288C E012415C 4680A521 */  cvt.d.w   $f20, $f20
/* 412890 E0124160 4620A500 */  add.d     $f20, $f20, $f0
/* 412894 E0124164 4600D306 */  mov.s     $f12, $f26
/* 412898 E0124168 0C080144 */  jal       shim_cos_deg
/* 41289C E012416C 4620A520 */   cvt.s.d  $f20, $f20
/* 4128A0 E0124170 4600A002 */  mul.s     $f0, $f20, $f0
/* 4128A4 E0124174 00000000 */  nop
/* 4128A8 E0124178 24040014 */  addiu     $a0, $zero, 0x14
/* 4128AC E012417C 0C080138 */  jal       shim_rand_int
/* 4128B0 E0124180 E600FFE4 */   swc1     $f0, -0x1C($s0)
/* 4128B4 E0124184 2442FFF6 */  addiu     $v0, $v0, -0xA
/* 4128B8 E0124188 44821000 */  mtc1      $v0, $f2
/* 4128BC E012418C 00000000 */  nop
/* 4128C0 E0124190 468010A1 */  cvt.d.w   $f2, $f2
/* 4128C4 E0124194 46381082 */  mul.d     $f2, $f2, $f24
/* 4128C8 E0124198 00000000 */  nop
/* 4128CC E012419C 00151040 */  sll       $v0, $s5, 1
/* 4128D0 E01241A0 44820000 */  mtc1      $v0, $f0
/* 4128D4 E01241A4 00000000 */  nop
/* 4128D8 E01241A8 46800021 */  cvt.d.w   $f0, $f0
/* 4128DC E01241AC 46220000 */  add.d     $f0, $f0, $f2
/* 4128E0 E01241B0 4600D306 */  mov.s     $f12, $f26
/* 4128E4 E01241B4 46200020 */  cvt.s.d   $f0, $f0
/* 4128E8 E01241B8 0C080140 */  jal       shim_sin_deg
/* 4128EC E01241BC E600FFE8 */   swc1     $f0, -0x18($s0)
/* 4128F0 E01241C0 C602FFE4 */  lwc1      $f2, -0x1C($s0)
/* 4128F4 E01241C4 460010A1 */  cvt.d.s   $f2, $f2
/* 4128F8 E01241C8 46361082 */  mul.d     $f2, $f2, $f22
/* 4128FC E01241CC 00000000 */  nop
/* 412900 E01241D0 4600A502 */  mul.s     $f20, $f20, $f0
/* 412904 E01241D4 00000000 */  nop
/* 412908 E01241D8 C600FFE8 */  lwc1      $f0, -0x18($s0)
/* 41290C E01241DC 46000021 */  cvt.d.s   $f0, $f0
/* 412910 E01241E0 46360002 */  mul.d     $f0, $f0, $f22
/* 412914 E01241E4 00000000 */  nop
/* 412918 E01241E8 2404000A */  addiu     $a0, $zero, 0xA
/* 41291C E01241EC E614FFEC */  swc1      $f20, -0x14($s0)
/* 412920 E01241F0 462010A0 */  cvt.s.d   $f2, $f2
/* 412924 E01241F4 46200020 */  cvt.s.d   $f0, $f0
/* 412928 E01241F8 E602FFF0 */  swc1      $f2, -0x10($s0)
/* 41292C E01241FC 0C080138 */  jal       shim_rand_int
/* 412930 E0124200 E600FFF4 */   swc1     $f0, -0xC($s0)
/* 412934 E0124204 3C01E012 */  lui       $at, (0xE0124C10 >> 16)
/* 412938 E0124208 D4224C10 */  ldc1      $f2, (0xE0124C10 & 0xFFFF)($at)
/* 41293C E012420C 44820000 */  mtc1      $v0, $f0
/* 412940 E0124210 00000000 */  nop
/* 412944 E0124214 46800021 */  cvt.d.w   $f0, $f0
/* 412948 E0124218 46220002 */  mul.d     $f0, $f0, $f2
/* 41294C E012421C 00000000 */  nop
/* 412950 E0124220 26520001 */  addiu     $s2, $s2, 0x1
/* 412954 E0124224 2631002C */  addiu     $s1, $s1, 0x2C
/* 412958 E0124228 24040007 */  addiu     $a0, $zero, 0x7
/* 41295C E012422C 46200020 */  cvt.s.d   $f0, $f0
/* 412960 E0124230 0C080138 */  jal       shim_rand_int
/* 412964 E0124234 E600FFF8 */   swc1     $f0, -0x8($s0)
/* 412968 E0124238 2442001E */  addiu     $v0, $v0, 0x1E
/* 41296C E012423C AE02FFFC */  sw        $v0, -0x4($s0)
/* 412970 E0124240 AE000000 */  sw        $zero, 0x0($s0)
/* 412974 E0124244 0257102A */  slt       $v0, $s2, $s7
/* 412978 E0124248 1040001B */  beqz      $v0, .LE01242B8
/* 41297C E012424C 2610002C */   addiu    $s0, $s0, 0x2C
/* 412980 E0124250 26730001 */  addiu     $s3, $s3, 0x1
.LE0124254:
/* 412984 E0124254 2A620010 */  slti      $v0, $s3, 0x10
/* 412988 E0124258 1440FFAB */  bnez      $v0, .LE0124108
/* 41298C E012425C 26940002 */   addiu    $s4, $s4, 0x2
/* 412990 E0124260 0257102A */  slt       $v0, $s2, $s7
/* 412994 E0124264 10400014 */  beqz      $v0, .LE01242B8
/* 412998 E0124268 26B50001 */   addiu    $s5, $s5, 0x1
/* 41299C E012426C 2AA20010 */  slti      $v0, $s5, 0x10
/* 4129A0 E0124270 5440FFA0 */  bnel      $v0, $zero, .LE01240F4
/* 4129A4 E0124274 0000982D */   daddu    $s3, $zero, $zero
/* 4129A8 E0124278 44800000 */  mtc1      $zero, $f0
/* 4129AC E012427C 2404FFFF */  addiu     $a0, $zero, -0x1
/* 4129B0 E0124280 26230020 */  addiu     $v1, $s1, 0x20
.LE0124284:
/* 4129B4 E0124284 26520001 */  addiu     $s2, $s2, 0x1
/* 4129B8 E0124288 E4600004 */  swc1      $f0, 0x4($v1)
/* 4129BC E012428C E460FFF8 */  swc1      $f0, -0x8($v1)
/* 4129C0 E0124290 E460FFF4 */  swc1      $f0, -0xC($v1)
/* 4129C4 E0124294 E460FFF0 */  swc1      $f0, -0x10($v1)
/* 4129C8 E0124298 E460FFEC */  swc1      $f0, -0x14($v1)
/* 4129CC E012429C E460FFE8 */  swc1      $f0, -0x18($v1)
/* 4129D0 E01242A0 E460FFE4 */  swc1      $f0, -0x1C($v1)
/* 4129D4 E01242A4 AC64FFFC */  sw        $a0, -0x4($v1)
/* 4129D8 E01242A8 AC600000 */  sw        $zero, 0x0($v1)
/* 4129DC E01242AC 0257102A */  slt       $v0, $s2, $s7
/* 4129E0 E01242B0 1440FFF4 */  bnez      $v0, .LE0124284
/* 4129E4 E01242B4 2463002C */   addiu    $v1, $v1, 0x2C
.LE01242B8:
/* 4129E8 E01242B8 03C0102D */  daddu     $v0, $fp, $zero
/* 4129EC E01242BC 8FBF004C */  lw        $ra, 0x4C($sp)
/* 4129F0 E01242C0 8FBE0048 */  lw        $fp, 0x48($sp)
/* 4129F4 E01242C4 8FB70044 */  lw        $s7, 0x44($sp)
/* 4129F8 E01242C8 8FB60040 */  lw        $s6, 0x40($sp)
/* 4129FC E01242CC 8FB5003C */  lw        $s5, 0x3C($sp)
/* 412A00 E01242D0 8FB40038 */  lw        $s4, 0x38($sp)
/* 412A04 E01242D4 8FB30034 */  lw        $s3, 0x34($sp)
/* 412A08 E01242D8 8FB20030 */  lw        $s2, 0x30($sp)
/* 412A0C E01242DC 8FB1002C */  lw        $s1, 0x2C($sp)
/* 412A10 E01242E0 8FB00028 */  lw        $s0, 0x28($sp)
/* 412A14 E01242E4 D7BA0068 */  ldc1      $f26, 0x68($sp)
/* 412A18 E01242E8 D7B80060 */  ldc1      $f24, 0x60($sp)
/* 412A1C E01242EC D7B60058 */  ldc1      $f22, 0x58($sp)
/* 412A20 E01242F0 D7B40050 */  ldc1      $f20, 0x50($sp)
/* 412A24 E01242F4 03E00008 */  jr        $ra
/* 412A28 E01242F8 27BD0070 */   addiu    $sp, $sp, 0x70

### DECOMPILED C INSTRUCTIONS:

EffectInstance* pink_sparkles_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5) {
    EffectBlueprint bp;
    EffectInstance* effect;
    PinkSparklesFXData* part;
    s32 numParts = 101;
    s32 count;
    f32 angle;
    s32 i;
    s32 j;

    bp.init = pink_sparkles_init;
    bp.update = pink_sparkles_update;
    bp.renderWorld = pink_sparkles_render;
    bp.unk_00 = 0;
    bp.renderUI = NULL;
    bp.effectID = EFFECT_PINK_SPARKLES;

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

    part->unk_04 = arg1;
    part->unk_08 = arg2;
    part->unk_0C = arg3;
    part->unk_20 = 0;
    part->unk_00 = arg0;
    part->unk_1C = 80;

    part++;
    angle = arg5;
    count = 1;

    for (i = 0; i < 16; i++) {
        for (j = 0; j < 16; j++) {
            if (D_E01248C0[j + (15 - i) * 16 + arg0 * 256] != 46) {
                f32 temp_f20 = j * 2 - 16 + (shim_rand_int(20) - 10) * 0.1;

                part->unk_04 = temp_f20 * shim_cos_deg(angle);
                part->unk_08 = i * 2 + (shim_rand_int(20) - 10) * 0.1;
                part->unk_0C = temp_f20 * shim_sin_deg(angle);
                part->unk_10 = part->unk_04 * 0.04;
                part->unk_14 = part->unk_08 * 0.04;
                part->unk_18 = shim_rand_int(10) * 0.001;
                part->unk_1C = shim_rand_int(7) + 30;
                part->unk_20 = 0;

                count++;
                part++;

                if (count >= numParts) {
                    break;
                }
            }
        }

        if (count >= numParts) {
            break;
        }
    }

    for (; count < numParts; count++, part++) {
        part->unk_04 = part->unk_08 = part->unk_0C =
            part->unk_10 = part->unk_14 = part->unk_18 =
            part->unk_24 = 0.0f;
        part->unk_1C = -1;
        part->unk_20 = 0;
    };

    return effect;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel firework_rocket_update
/* 3E452C E010A18C 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 3E4530 E010A190 AFBF001C */  sw        $ra, 0x1C($sp)
/* 3E4534 E010A194 AFB20018 */  sw        $s2, 0x18($sp)
/* 3E4538 E010A198 AFB10014 */  sw        $s1, 0x14($sp)
/* 3E453C E010A19C AFB00010 */  sw        $s0, 0x10($sp)
/* 3E4540 E010A1A0 F7B40020 */  sdc1      $f20, 0x20($sp)
/* 3E4544 E010A1A4 8C830000 */  lw        $v1, 0x0($a0)
/* 3E4548 E010A1A8 8C91000C */  lw        $s1, 0xC($a0)
/* 3E454C E010A1AC 30620010 */  andi      $v0, $v1, 0x10
/* 3E4550 E010A1B0 10400005 */  beqz      $v0, .LE010A1C8
/* 3E4554 E010A1B4 2402FFEF */   addiu    $v0, $zero, -0x11
/* 3E4558 E010A1B8 00621024 */  and       $v0, $v1, $v0
/* 3E455C E010A1BC AC820000 */  sw        $v0, 0x0($a0)
/* 3E4560 E010A1C0 24020010 */  addiu     $v0, $zero, 0x10
/* 3E4564 E010A1C4 AE22001C */  sw        $v0, 0x1C($s1)
.LE010A1C8:
/* 3E4568 E010A1C8 8E23001C */  lw        $v1, 0x1C($s1)
/* 3E456C E010A1CC 286203E8 */  slti      $v0, $v1, 0x3E8
/* 3E4570 E010A1D0 10400002 */  beqz      $v0, .LE010A1DC
/* 3E4574 E010A1D4 2462FFFF */   addiu    $v0, $v1, -0x1
/* 3E4578 E010A1D8 AE22001C */  sw        $v0, 0x1C($s1)
.LE010A1DC:
/* 3E457C E010A1DC 8E220020 */  lw        $v0, 0x20($s1)
/* 3E4580 E010A1E0 8E25001C */  lw        $a1, 0x1C($s1)
/* 3E4584 E010A1E4 24420001 */  addiu     $v0, $v0, 0x1
/* 3E4588 E010A1E8 04A10005 */  bgez      $a1, .LE010A200
/* 3E458C E010A1EC AE220020 */   sw       $v0, 0x20($s1)
/* 3E4590 E010A1F0 0C080128 */  jal       shim_remove_effect
/* 3E4594 E010A1F4 00000000 */   nop
/* 3E4598 E010A1F8 08042921 */  j         .LE010A484
/* 3E459C E010A1FC 00000000 */   nop
.LE010A200:
/* 3E45A0 E010A200 0040902D */  daddu     $s2, $v0, $zero
/* 3E45A4 E010A204 28A20020 */  slti      $v0, $a1, 0x20
/* 3E45A8 E010A208 10400002 */  beqz      $v0, .LE010A214
/* 3E45AC E010A20C 000510C0 */   sll      $v0, $a1, 3
/* 3E45B0 E010A210 AE220030 */  sw        $v0, 0x30($s1)
.LE010A214:
/* 3E45B4 E010A214 8E23004C */  lw        $v1, 0x4C($s1)
/* 3E45B8 E010A218 24020001 */  addiu     $v0, $zero, 0x1
/* 3E45BC E010A21C 1462002F */  bne       $v1, $v0, .LE010A2DC
/* 3E45C0 E010A220 24020020 */   addiu    $v0, $zero, 0x20
/* 3E45C4 E010A224 C6260044 */  lwc1      $f6, 0x44($s1)
/* 3E45C8 E010A228 C6240048 */  lwc1      $f4, 0x48($s1)
/* 3E45CC E010A22C 46062101 */  sub.s     $f4, $f4, $f6
/* 3E45D0 E010A230 3C01E011 */  lui       $at, (0xE0110000 >> 16)
/* 3E45D4 E010A234 D420AF90 */  ldc1      $f0, -0x5070($at)
/* 3E45D8 E010A238 46002121 */  cvt.d.s   $f4, $f4
/* 3E45DC E010A23C 46202102 */  mul.d     $f4, $f4, $f0
/* 3E45E0 E010A240 00000000 */  nop
/* 3E45E4 E010A244 3C013F73 */  lui       $at, (0x3F733333 >> 16)
/* 3E45E8 E010A248 34213333 */  ori       $at, $at, (0x3F733333 & 0xFFFF)
/* 3E45EC E010A24C 44818000 */  mtc1      $at, $f16
/* 3E45F0 E010A250 C62E0010 */  lwc1      $f14, 0x10($s1)
/* 3E45F4 E010A254 46107382 */  mul.s     $f14, $f14, $f16
/* 3E45F8 E010A258 00000000 */  nop
/* 3E45FC E010A25C C62C0018 */  lwc1      $f12, 0x18($s1)
/* 3E4600 E010A260 46106302 */  mul.s     $f12, $f12, $f16
/* 3E4604 E010A264 00000000 */  nop
/* 3E4608 E010A268 C62A0004 */  lwc1      $f10, 0x4($s1)
/* 3E460C E010A26C C6200010 */  lwc1      $f0, 0x10($s1)
/* 3E4610 E010A270 C6280008 */  lwc1      $f8, 0x8($s1)
/* 3E4614 E010A274 46005280 */  add.s     $f10, $f10, $f0
/* 3E4618 E010A278 C6200014 */  lwc1      $f0, 0x14($s1)
/* 3E461C E010A27C C622000C */  lwc1      $f2, 0xC($s1)
/* 3E4620 E010A280 46004200 */  add.s     $f8, $f8, $f0
/* 3E4624 E010A284 C6200018 */  lwc1      $f0, 0x18($s1)
/* 3E4628 E010A288 46001080 */  add.s     $f2, $f2, $f0
/* 3E462C E010A28C C6200014 */  lwc1      $f0, 0x14($s1)
/* 3E4630 E010A290 460031A1 */  cvt.d.s   $f6, $f6
/* 3E4634 E010A294 E62E0010 */  swc1      $f14, 0x10($s1)
/* 3E4638 E010A298 E62C0018 */  swc1      $f12, 0x18($s1)
/* 3E463C E010A29C 46100002 */  mul.s     $f0, $f0, $f16
/* 3E4640 E010A2A0 00000000 */  nop
/* 3E4644 E010A2A4 E62A0004 */  swc1      $f10, 0x4($s1)
/* 3E4648 E010A2A8 E6280008 */  swc1      $f8, 0x8($s1)
/* 3E464C E010A2AC E622000C */  swc1      $f2, 0xC($s1)
/* 3E4650 E010A2B0 3C01E011 */  lui       $at, (0xE0110000 >> 16)
/* 3E4654 E010A2B4 D422AF98 */  ldc1      $f2, -0x5068($at)
/* 3E4658 E010A2B8 46243180 */  add.d     $f6, $f6, $f4
/* 3E465C E010A2BC E6200014 */  swc1      $f0, 0x14($s1)
/* 3E4660 E010A2C0 46000021 */  cvt.d.s   $f0, $f0
/* 3E4664 E010A2C4 46220001 */  sub.d     $f0, $f0, $f2
/* 3E4668 E010A2C8 462031A0 */  cvt.s.d   $f6, $f6
/* 3E466C E010A2CC E6260044 */  swc1      $f6, 0x44($s1)
/* 3E4670 E010A2D0 46200020 */  cvt.s.d   $f0, $f0
/* 3E4674 E010A2D4 08042921 */  j         .LE010A484
/* 3E4678 E010A2D8 E6200014 */   swc1     $f0, 0x14($s1)
.LE010A2DC:
/* 3E467C E010A2DC 00521023 */  subu      $v0, $v0, $s2
/* 3E4680 E010A2E0 4482A000 */  mtc1      $v0, $f20
/* 3E4684 E010A2E4 00000000 */  nop
/* 3E4688 E010A2E8 4680A520 */  cvt.s.w   $f20, $f20
/* 3E468C E010A2EC 32440003 */  andi      $a0, $s2, 0x3
/* 3E4690 E010A2F0 00048080 */  sll       $s0, $a0, 2
/* 3E4694 E010A2F4 02308021 */  addu      $s0, $s1, $s0
/* 3E4698 E010A2F8 00121840 */  sll       $v1, $s2, 1
/* 3E469C E010A2FC C6200010 */  lwc1      $f0, 0x10($s1)
/* 3E46A0 E010A300 00721821 */  addu      $v1, $v1, $s2
/* 3E46A4 E010A304 46140002 */  mul.s     $f0, $f0, $f20
/* 3E46A8 E010A308 00000000 */  nop
/* 3E46AC E010A30C 00031100 */  sll       $v0, $v1, 4
/* 3E46B0 E010A310 00431023 */  subu      $v0, $v0, $v1
/* 3E46B4 E010A314 C6220004 */  lwc1      $f2, 0x4($s1)
/* 3E46B8 E010A318 00021040 */  sll       $v0, $v0, 1
/* 3E46BC E010A31C 46001081 */  sub.s     $f2, $f2, $f0
/* 3E46C0 E010A320 00021143 */  sra       $v0, $v0, 5
/* 3E46C4 E010A324 44826000 */  mtc1      $v0, $f12
/* 3E46C8 E010A328 00000000 */  nop
/* 3E46CC E010A32C 46806320 */  cvt.s.w   $f12, $f12
/* 3E46D0 E010A330 0C080140 */  jal       shim_sin_deg
/* 3E46D4 E010A334 E6020050 */   swc1     $f2, 0x50($s0)
/* 3E46D8 E010A338 C6260014 */  lwc1      $f6, 0x14($s1)
/* 3E46DC E010A33C 46143182 */  mul.s     $f6, $f6, $f20
/* 3E46E0 E010A340 00000000 */  nop
/* 3E46E4 E010A344 3C0142A0 */  lui       $at, (0x42A00000 >> 16)
/* 3E46E8 E010A348 44812000 */  mtc1      $at, $f4
/* 3E46EC E010A34C 00000000 */  nop
/* 3E46F0 E010A350 46040002 */  mul.s     $f0, $f0, $f4
/* 3E46F4 E010A354 00000000 */  nop
/* 3E46F8 E010A358 C6220008 */  lwc1      $f2, 0x8($s1)
/* 3E46FC E010A35C 46061081 */  sub.s     $f2, $f2, $f6
/* 3E4700 E010A360 46002101 */  sub.s     $f4, $f4, $f0
/* 3E4704 E010A364 46041081 */  sub.s     $f2, $f2, $f4
/* 3E4708 E010A368 E6020060 */  swc1      $f2, 0x60($s0)
/* 3E470C E010A36C C6200018 */  lwc1      $f0, 0x18($s1)
/* 3E4710 E010A370 46140002 */  mul.s     $f0, $f0, $f20
/* 3E4714 E010A374 00000000 */  nop
/* 3E4718 E010A378 C622000C */  lwc1      $f2, 0xC($s1)
/* 3E471C E010A37C 46001081 */  sub.s     $f2, $f2, $f0
/* 3E4720 E010A380 2404000A */  addiu     $a0, $zero, 0xA
/* 3E4724 E010A384 0C080138 */  jal       shim_rand_int
/* 3E4728 E010A388 E6020070 */   swc1     $f2, 0x70($s0)
/* 3E472C E010A38C 2442FFFB */  addiu     $v0, $v0, -0x5
/* 3E4730 E010A390 3C013DCC */  lui       $at, (0x3DCCCCCD >> 16)
/* 3E4734 E010A394 3421CCCD */  ori       $at, $at, (0x3DCCCCCD & 0xFFFF)
/* 3E4738 E010A398 4481A000 */  mtc1      $at, $f20
/* 3E473C E010A39C 44820000 */  mtc1      $v0, $f0
/* 3E4740 E010A3A0 00000000 */  nop
/* 3E4744 E010A3A4 46800020 */  cvt.s.w   $f0, $f0
/* 3E4748 E010A3A8 46140002 */  mul.s     $f0, $f0, $f20
/* 3E474C E010A3AC 00000000 */  nop
/* 3E4750 E010A3B0 2404000A */  addiu     $a0, $zero, 0xA
/* 3E4754 E010A3B4 0C080138 */  jal       shim_rand_int
/* 3E4758 E010A3B8 E6000080 */   swc1     $f0, 0x80($s0)
/* 3E475C E010A3BC 2442FFFB */  addiu     $v0, $v0, -0x5
/* 3E4760 E010A3C0 44820000 */  mtc1      $v0, $f0
/* 3E4764 E010A3C4 00000000 */  nop
/* 3E4768 E010A3C8 46800020 */  cvt.s.w   $f0, $f0
/* 3E476C E010A3CC 46140002 */  mul.s     $f0, $f0, $f20
/* 3E4770 E010A3D0 00000000 */  nop
/* 3E4774 E010A3D4 2404000A */  addiu     $a0, $zero, 0xA
/* 3E4778 E010A3D8 0C080138 */  jal       shim_rand_int
/* 3E477C E010A3DC E6000090 */   swc1     $f0, 0x90($s0)
/* 3E4780 E010A3E0 0000202D */  daddu     $a0, $zero, $zero
/* 3E4784 E010A3E4 2442FFFB */  addiu     $v0, $v0, -0x5
/* 3E4788 E010A3E8 44820000 */  mtc1      $v0, $f0
/* 3E478C E010A3EC 00000000 */  nop
/* 3E4790 E010A3F0 46800020 */  cvt.s.w   $f0, $f0
/* 3E4794 E010A3F4 46140002 */  mul.s     $f0, $f0, $f20
/* 3E4798 E010A3F8 00000000 */  nop
/* 3E479C E010A3FC 2A45001B */  slti      $a1, $s2, 0x1B
/* 3E47A0 E010A400 3C01E011 */  lui       $at, (0xE0110000 >> 16)
/* 3E47A4 E010A404 D42AAFA0 */  ldc1      $f10, -0x5060($at)
/* 3E47A8 E010A408 3C01C47A */  lui       $at, (0xC47A0000 >> 16)
/* 3E47AC E010A40C 44816000 */  mtc1      $at, $f12
/* 3E47B0 E010A410 0220182D */  daddu     $v1, $s1, $zero
/* 3E47B4 E010A414 E60000A0 */  swc1      $f0, 0xA0($s0)
.LE010A418:
/* 3E47B8 E010A418 C4660050 */  lwc1      $f6, 0x50($v1)
/* 3E47BC E010A41C C4600080 */  lwc1      $f0, 0x80($v1)
/* 3E47C0 E010A420 C4640070 */  lwc1      $f4, 0x70($v1)
/* 3E47C4 E010A424 46003180 */  add.s     $f6, $f6, $f0
/* 3E47C8 E010A428 C46200A0 */  lwc1      $f2, 0xA0($v1)
/* 3E47CC E010A42C C4680060 */  lwc1      $f8, 0x60($v1)
/* 3E47D0 E010A430 46022100 */  add.s     $f4, $f4, $f2
/* 3E47D4 E010A434 C4600090 */  lwc1      $f0, 0x90($v1)
/* 3E47D8 E010A438 46004200 */  add.s     $f8, $f8, $f0
/* 3E47DC E010A43C 46000021 */  cvt.d.s   $f0, $f0
/* 3E47E0 E010A440 462A0001 */  sub.d     $f0, $f0, $f10
/* 3E47E4 E010A444 E4660050 */  swc1      $f6, 0x50($v1)
/* 3E47E8 E010A448 E4640070 */  swc1      $f4, 0x70($v1)
/* 3E47EC E010A44C 46200020 */  cvt.s.d   $f0, $f0
/* 3E47F0 E010A450 E4680060 */  swc1      $f8, 0x60($v1)
/* 3E47F4 E010A454 14A00002 */  bnez      $a1, .LE010A460
/* 3E47F8 E010A458 E4600090 */   swc1     $f0, 0x90($v1)
/* 3E47FC E010A45C E46C0060 */  swc1      $f12, 0x60($v1)
.LE010A460:
/* 3E4800 E010A460 24840001 */  addiu     $a0, $a0, 0x1
/* 3E4804 E010A464 28820004 */  slti      $v0, $a0, 0x4
/* 3E4808 E010A468 1440FFEB */  bnez      $v0, .LE010A418
/* 3E480C E010A46C 24630004 */   addiu    $v1, $v1, 0x4
/* 3E4810 E010A470 2A420020 */  slti      $v0, $s2, 0x20
/* 3E4814 E010A474 14400003 */  bnez      $v0, .LE010A484
/* 3E4818 E010A478 24020001 */   addiu    $v0, $zero, 0x1
/* 3E481C E010A47C AE22004C */  sw        $v0, 0x4C($s1)
/* 3E4820 E010A480 AE220020 */  sw        $v0, 0x20($s1)
.LE010A484:
/* 3E4824 E010A484 8FBF001C */  lw        $ra, 0x1C($sp)
/* 3E4828 E010A488 8FB20018 */  lw        $s2, 0x18($sp)
/* 3E482C E010A48C 8FB10014 */  lw        $s1, 0x14($sp)
/* 3E4830 E010A490 8FB00010 */  lw        $s0, 0x10($sp)
/* 3E4834 E010A494 D7B40020 */  ldc1      $f20, 0x20($sp)
/* 3E4838 E010A498 03E00008 */  jr        $ra
/* 3E483C E010A49C 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

void firework_rocket_update(EffectInstance* effect) {
    FireworkRocketFXData* data = effect->data.fireworkRocket;
    f32 factor;
    s32 lifeTime;
    s32 i;

    if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
        effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
        data->timeLeft = 16;
    }

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

    data->lifeTime++;

    if (data->timeLeft < 0) {
        shim_remove_effect(effect);
        return;
    }

    lifeTime = data->lifeTime;

    if (data->timeLeft < 32) {
        data->minBlurAlpha = data->timeLeft * 8;
    }

    if (data->isExploded == TRUE) {
        factor = 0.95f;
        data->pos.x += data->velocity.x;
        data->pos.y += data->velocity.y;
        data->pos.z += data->velocity.z;
        data->velocity.x *= factor;
        data->velocity.y *= factor;
        data->velocity.z *= factor;
        data->radius += (data->maxRadius - data->radius) * 0.11;
        data->velocity.y -= 0.15;
        return;
    }

    i = lifeTime & 3;
    data->rocketX[i] = data->pos.x - data->velocity.x * (32 - lifeTime);
    data->rocketY[i] = data->pos.y - data->velocity.y * (32 - lifeTime)
        - (80.0f - shim_sin_deg((s32)(lifeTime * 90) >> 5) * 80.0f);
    data->rocketZ[i] = data->pos.z - data->velocity.z * (32 - lifeTime);
    data->rocketVelocityX[i] = (shim_rand_int(10) - 5) * 0.1f;
    data->rocketVelocityY[i] = (shim_rand_int(10) - 5) * 0.1f;
    data->rocketVelocityZ[i] = (shim_rand_int(10) - 5) * 0.1f;

    for (i = 0; i < 4; i++) {
        data->rocketX[i] += data->rocketVelocityX[i];
        data->rocketY[i] += data->rocketVelocityY[i];
        data->rocketZ[i] += data->rocketVelocityZ[i];
        data->rocketVelocityY[i] -= 0.15;
        if (lifeTime >= 27) {
            data->rocketY[i] = NPC_DISPOSE_POS_Y;
        }
    }

    if (lifeTime >= 32) {
        data->isExploded = TRUE;
        data->lifeTime = 1;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel __osInitialize_common
/* 45B08 8006A708 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* 45B0C 8006A70C 24020001 */  addiu     $v0, $zero, 0x1
/* 45B10 8006A710 AFBF0018 */  sw        $ra, 0x18($sp)
/* 45B14 8006A714 3C01800A */  lui       $at, %hi(__osFinalrom)
/* 45B18 8006A718 0C01B19C */  jal       __osGetSR
/* 45B1C 8006A71C AC22A660 */   sw       $v0, %lo(__osFinalrom)($at)
/* 45B20 8006A720 3C042000 */  lui       $a0, (0x20000000 >> 16)
/* 45B24 8006A724 0C01B1A8 */  jal       __osSetSR
/* 45B28 8006A728 00442025 */   or       $a0, $v0, $a0
/* 45B2C 8006A72C 3C040100 */  lui       $a0, (0x1000800 >> 16)
/* 45B30 8006A730 0C01B1A4 */  jal       __osSetFpcCsr
/* 45B34 8006A734 34840800 */   ori      $a0, $a0, (0x1000800 & 0xFFFF)
/* 45B38 8006A738 0C01B1AC */  jal       __osSetWatchLo
/* 45B3C 8006A73C 3C040490 */   lui      $a0, (0x4900000 >> 16)
/* 45B40 8006A740 3C041FC0 */  lui       $a0, (0x1FC007FC >> 16)
.L8006A744:
/* 45B44 8006A744 348407FC */  ori       $a0, $a0, (0x1FC007FC & 0xFFFF)
/* 45B48 8006A748 0C01B1F0 */  jal       __osSiRawReadIo
/* 45B4C 8006A74C 27A50010 */   addiu    $a1, $sp, 0x10
/* 45B50 8006A750 1440FFFC */  bnez      $v0, .L8006A744
/* 45B54 8006A754 3C041FC0 */   lui      $a0, (0x1FC007FC >> 16)
.L8006A758:
/* 45B58 8006A758 8FA50010 */  lw        $a1, 0x10($sp)
/* 45B5C 8006A75C 3C041FC0 */  lui       $a0, (0x1FC007FC >> 16)
/* 45B60 8006A760 348407FC */  ori       $a0, $a0, (0x1FC007FC & 0xFFFF)
/* 45B64 8006A764 0C01B204 */  jal       __osSiRawWriteIo
/* 45B68 8006A768 34A50008 */   ori      $a1, $a1, 0x8
/* 45B6C 8006A76C 1440FFFA */  bnez      $v0, .L8006A758
/* 45B70 8006A770 00000000 */   nop
/* 45B74 8006A774 3C028007 */  lui       $v0, %hi(__osExceptionPreamble)
/* 45B78 8006A778 2442A9F0 */  addiu     $v0, $v0, %lo(__osExceptionPreamble)
/* 45B7C 8006A77C 3C068000 */  lui       $a2, %hi(func_80000000)
/* 45B80 8006A780 8C430000 */  lw        $v1, 0x0($v0)
/* 45B84 8006A784 8C440004 */  lw        $a0, 0x4($v0)
/* 45B88 8006A788 8C450008 */  lw        $a1, 0x8($v0)
/* 45B8C 8006A78C ACC30000 */  sw        $v1, %lo(func_80000000)($a2)
/* 45B90 8006A790 ACC40004 */  sw        $a0, %lo(D_80000004)($a2)
/* 45B94 8006A794 ACC50008 */  sw        $a1, %lo(D_80000008)($a2)
/* 45B98 8006A798 8C43000C */  lw        $v1, 0xC($v0)
/* 45B9C 8006A79C ACC3000C */  sw        $v1, %lo(D_8000000C)($a2)
/* 45BA0 8006A7A0 3C068000 */  lui       $a2, (0x80000080 >> 16)
/* 45BA4 8006A7A4 34C60080 */  ori       $a2, $a2, (0x80000080 & 0xFFFF)
/* 45BA8 8006A7A8 8C430000 */  lw        $v1, 0x0($v0)
/* 45BAC 8006A7AC 8C440004 */  lw        $a0, 0x4($v0)
/* 45BB0 8006A7B0 8C450008 */  lw        $a1, 0x8($v0)
/* 45BB4 8006A7B4 ACC30000 */  sw        $v1, 0x0($a2)
/* 45BB8 8006A7B8 ACC40004 */  sw        $a0, 0x4($a2)
/* 45BBC 8006A7BC ACC50008 */  sw        $a1, 0x8($a2)
/* 45BC0 8006A7C0 8C43000C */  lw        $v1, 0xC($v0)
/* 45BC4 8006A7C4 ACC3000C */  sw        $v1, 0xC($a2)
/* 45BC8 8006A7C8 3C068000 */  lui       $a2, (0x80000100 >> 16)
/* 45BCC 8006A7CC 34C60100 */  ori       $a2, $a2, (0x80000100 & 0xFFFF)
/* 45BD0 8006A7D0 8C430000 */  lw        $v1, 0x0($v0)
/* 45BD4 8006A7D4 8C440004 */  lw        $a0, 0x4($v0)
/* 45BD8 8006A7D8 8C450008 */  lw        $a1, 0x8($v0)
/* 45BDC 8006A7DC ACC30000 */  sw        $v1, 0x0($a2)
/* 45BE0 8006A7E0 ACC40004 */  sw        $a0, 0x4($a2)
/* 45BE4 8006A7E4 ACC50008 */  sw        $a1, 0x8($a2)
/* 45BE8 8006A7E8 8C43000C */  lw        $v1, 0xC($v0)
/* 45BEC 8006A7EC ACC3000C */  sw        $v1, 0xC($a2)
/* 45BF0 8006A7F0 3C068000 */  lui       $a2, (0x80000180 >> 16)
/* 45BF4 8006A7F4 34C60180 */  ori       $a2, $a2, (0x80000180 & 0xFFFF)
/* 45BF8 8006A7F8 8C430000 */  lw        $v1, 0x0($v0)
/* 45BFC 8006A7FC 8C440004 */  lw        $a0, 0x4($v0)
/* 45C00 8006A800 8C450008 */  lw        $a1, 0x8($v0)
/* 45C04 8006A804 ACC30000 */  sw        $v1, 0x0($a2)
/* 45C08 8006A808 ACC40004 */  sw        $a0, 0x4($a2)
/* 45C0C 8006A80C ACC50008 */  sw        $a1, 0x8($a2)
/* 45C10 8006A810 8C43000C */  lw        $v1, 0xC($v0)
/* 45C14 8006A814 ACC3000C */  sw        $v1, 0xC($a2)
/* 45C18 8006A818 3C048000 */  lui       $a0, (0x80000000 >> 16)
/* 45C1C 8006A81C 0C018614 */  jal       osWritebackDCache
/* 45C20 8006A820 24050190 */   addiu    $a1, $zero, 0x190
/* 45C24 8006A824 3C048000 */  lui       $a0, (0x80000000 >> 16)
/* 45C28 8006A828 0C0185F4 */  jal       osInvalICache
/* 45C2C 8006A82C 24050190 */   addiu    $a1, $zero, 0x190
/* 45C30 8006A830 3C05A460 */  lui       $a1, (0xA4600014 >> 16)
/* 45C34 8006A834 34A50014 */  ori       $a1, $a1, (0xA4600014 & 0xFFFF)
/* 45C38 8006A838 3C06A460 */  lui       $a2, (0xA4600018 >> 16)
/* 45C3C 8006A83C 34C60018 */  ori       $a2, $a2, (0xA4600018 & 0xFFFF)
/* 45C40 8006A840 3C07A460 */  lui       $a3, (0xA460001C >> 16)
/* 45C44 8006A844 34E7001C */  ori       $a3, $a3, (0xA460001C & 0xFFFF)
/* 45C48 8006A848 3C08A460 */  lui       $t0, (0xA4600020 >> 16)
/* 45C4C 8006A84C 35080020 */  ori       $t0, $t0, (0xA4600020 & 0xFFFF)
/* 45C50 8006A850 3C09A460 */  lui       $t1, (0xA4600024 >> 16)
/* 45C54 8006A854 35290024 */  ori       $t1, $t1, (0xA4600024 & 0xFFFF)
/* 45C58 8006A858 3C04A460 */  lui       $a0, (0xA4600028 >> 16)
/* 45C5C 8006A85C 34840028 */  ori       $a0, $a0, (0xA4600028 & 0xFFFF)
/* 45C60 8006A860 3C03A460 */  lui       $v1, (0xA460002C >> 16)
/* 45C64 8006A864 3463002C */  ori       $v1, $v1, (0xA460002C & 0xFFFF)
/* 45C68 8006A868 3C02A460 */  lui       $v0, (0xA4600030 >> 16)
/* 45C6C 8006A86C 34420030 */  ori       $v0, $v0, (0xA4600030 & 0xFFFF)
/* 45C70 8006A870 8CA50000 */  lw        $a1, 0x0($a1)
/* 45C74 8006A874 8CC60000 */  lw        $a2, 0x0($a2)
/* 45C78 8006A878 8CE70000 */  lw        $a3, 0x0($a3)
/* 45C7C 8006A87C 8D080000 */  lw        $t0, 0x0($t0)
/* 45C80 8006A880 8D290000 */  lw        $t1, 0x0($t1)
/* 45C84 8006A884 8C840000 */  lw        $a0, 0x0($a0)
/* 45C88 8006A888 8C630000 */  lw        $v1, 0x0($v1)
/* 45C8C 8006A88C 8C4A0000 */  lw        $t2, 0x0($v0)
/* 45C90 8006A890 24020007 */  addiu     $v0, $zero, 0x7
/* 45C94 8006A894 3C01800B */  lui       $at, %hi(D_800B451C)
/* 45C98 8006A898 A022451C */  sb        $v0, %lo(D_800B451C)($at)
/* 45C9C 8006A89C 3C01800B */  lui       $at, %hi(D_800B1B0C)
/* 45CA0 8006A8A0 A0221B0C */  sb        $v0, %lo(D_800B1B0C)($at)
/* 45CA4 8006A8A4 3C01800B */  lui       $at, %hi(D_800B451D)
/* 45CA8 8006A8A8 A025451D */  sb        $a1, %lo(D_800B451D)($at)
/* 45CAC 8006A8AC 3C01800B */  lui       $at, %hi(D_800B4520)
/* 45CB0 8006A8B0 A0264520 */  sb        $a2, %lo(D_800B4520)($at)
/* 45CB4 8006A8B4 3C01800B */  lui       $at, %hi(D_800B451E)
/* 45CB8 8006A8B8 A027451E */  sb        $a3, %lo(D_800B451E)($at)
/* 45CBC 8006A8BC 3C01800B */  lui       $at, %hi(D_800B451F)
/* 45CC0 8006A8C0 A028451F */  sb        $t0, %lo(D_800B451F)($at)
/* 45CC4 8006A8C4 3C01800B */  lui       $at, %hi(D_800B1B0D)
/* 45CC8 8006A8C8 A0291B0D */  sb        $t1, %lo(D_800B1B0D)($at)
/* 45CCC 8006A8CC 3C01800B */  lui       $at, %hi(D_800B1B10)
/* 45CD0 8006A8D0 A0241B10 */  sb        $a0, %lo(D_800B1B10)($at)
/* 45CD4 8006A8D4 3C01800B */  lui       $at, %hi(D_800B1B0E)
/* 45CD8 8006A8D8 A0231B0E */  sb        $v1, %lo(D_800B1B0E)($at)
/* 45CDC 8006A8DC 3C01800B */  lui       $at, %hi(D_800B1B0F)
/* 45CE0 8006A8E0 0C019A58 */  jal       osUnmapTLBAll
/* 45CE4 8006A8E4 A02A1B0F */   sb       $t2, %lo(D_800B1B0F)($at)
/* 45CE8 8006A8E8 0C01B28C */  jal       osMapTLBRdb
/* 45CEC 8006A8EC 00000000 */   nop
/* 45CF0 8006A8F0 3C028009 */  lui       $v0, %hi(D_800958F0)
/* 45CF4 8006A8F4 8C4258F0 */  lw        $v0, %lo(D_800958F0)($v0)
/* 45CF8 8006A8F8 3C038009 */  lui       $v1, %hi(D_800958F4)
/* 45CFC 8006A8FC 8C6358F4 */  lw        $v1, %lo(D_800958F4)($v1)
/* 45D00 8006A900 00022040 */  sll       $a0, $v0, 1
/* 45D04 8006A904 000337C2 */  srl       $a2, $v1, 31
/* 45D08 8006A908 00862025 */  or        $a0, $a0, $a2
/* 45D0C 8006A90C 00032840 */  sll       $a1, $v1, 1
/* 45D10 8006A910 00A32821 */  addu      $a1, $a1, $v1
/* 45D14 8006A914 00A3302B */  sltu      $a2, $a1, $v1
/* 45D18 8006A918 00822021 */  addu      $a0, $a0, $v0
/* 45D1C 8006A91C 00862021 */  addu      $a0, $a0, $a2
/* 45D20 8006A920 24060000 */  addiu     $a2, $zero, 0x0
/* 45D24 8006A924 0C01B8C4 */  jal       __udivdi3
/* 45D28 8006A928 24070004 */   addiu    $a3, $zero, 0x4
/* 45D2C 8006A92C 3C048000 */  lui       $a0, %hi(osResetType)
/* 45D30 8006A930 8C84030C */  lw        $a0, %lo(osResetType)($a0)
/* 45D34 8006A934 3C018009 */  lui       $at, %hi(D_800958F0)
/* 45D38 8006A938 AC2258F0 */  sw        $v0, %lo(D_800958F0)($at)
/* 45D3C 8006A93C 3C018009 */  lui       $at, %hi(D_800958F4)
/* 45D40 8006A940 14800005 */  bnez      $a0, .L8006A958
/* 45D44 8006A944 AC2358F4 */   sw       $v1, %lo(D_800958F4)($at)
/* 45D48 8006A948 3C048000 */  lui       $a0, %hi(osAppNMIBuffer)
/* 45D4C 8006A94C 2484031C */  addiu     $a0, $a0, %lo(osAppNMIBuffer)
/* 45D50 8006A950 0C01925C */  jal       bzero
/* 45D54 8006A954 24050040 */   addiu    $a1, $zero, 0x40
.L8006A958:
/* 45D58 8006A958 3C038000 */  lui       $v1, %hi(osTvType)
/* 45D5C 8006A95C 8C630300 */  lw        $v1, %lo(osTvType)($v1)
/* 45D60 8006A960 54600004 */  bnel      $v1, $zero, .L8006A974
/* 45D64 8006A964 24020002 */   addiu    $v0, $zero, 0x2
/* 45D68 8006A968 3C0202F5 */  lui       $v0, (0x2F5B2D2 >> 16)
/* 45D6C 8006A96C 0801AA62 */  j         .L8006A988
/* 45D70 8006A970 3442B2D2 */   ori      $v0, $v0, (0x2F5B2D2 & 0xFFFF)
.L8006A974:
/* 45D74 8006A974 14620003 */  bne       $v1, $v0, .L8006A984
/* 45D78 8006A978 3C0202E6 */   lui      $v0, (0x2E6D354 >> 16)
/* 45D7C 8006A97C 0801AA62 */  j         .L8006A988
/* 45D80 8006A980 3442025C */   ori      $v0, $v0, (0x2E6025C & 0xFFFF)
.L8006A984:
/* 45D84 8006A984 3442D354 */  ori       $v0, $v0, (0x2E6D354 & 0xFFFF)
.L8006A988:
/* 45D88 8006A988 3C018009 */  lui       $at, %hi(D_800958F8)
/* 45D8C 8006A98C 0C01B198 */  jal       __osGetCause
/* 45D90 8006A990 AC2258F8 */   sw       $v0, %lo(D_800958F8)($at)
/* 45D94 8006A994 30421000 */  andi      $v0, $v0, 0x1000
/* 45D98 8006A998 10400003 */  beqz      $v0, .L8006A9A8
/* 45D9C 8006A99C 3C03A450 */   lui      $v1, (0xA4500008 >> 16)
.L8006A9A0:
/* 45DA0 8006A9A0 0801AA68 */  j         .L8006A9A0
/* 45DA4 8006A9A4 00000000 */   nop
.L8006A9A8:
/* 45DA8 8006A9A8 34630008 */  ori       $v1, $v1, (0xA4500008 & 0xFFFF)
/* 45DAC 8006A9AC 3C04A450 */  lui       $a0, (0xA4500010 >> 16)
/* 45DB0 8006A9B0 34840010 */  ori       $a0, $a0, (0xA4500010 & 0xFFFF)
/* 45DB4 8006A9B4 3C05A450 */  lui       $a1, (0xA4500014 >> 16)
/* 45DB8 8006A9B8 34A50014 */  ori       $a1, $a1, (0xA4500014 & 0xFFFF)
/* 45DBC 8006A9BC 24020001 */  addiu     $v0, $zero, 0x1
/* 45DC0 8006A9C0 AC620000 */  sw        $v0, 0x0($v1)
/* 45DC4 8006A9C4 24023FFF */  addiu     $v0, $zero, 0x3FFF
/* 45DC8 8006A9C8 AC820000 */  sw        $v0, 0x0($a0)
/* 45DCC 8006A9CC 2402000F */  addiu     $v0, $zero, 0xF
/* 45DD0 8006A9D0 ACA20000 */  sw        $v0, 0x0($a1)
/* 45DD4 8006A9D4 8FBF0018 */  lw        $ra, 0x18($sp)
/* 45DD8 8006A9D8 03E00008 */  jr        $ra
/* 45DDC 8006A9DC 27BD0020 */   addiu    $sp, $sp, 0x20

### DECOMPILED C INSTRUCTIONS:

void __osInitialize_common() {
    u32 pifdata;

#ifdef _FINALROM
    __osFinalrom = TRUE;
#endif

    __osSetSR(__osGetSR() | SR_CU1);    //enable fpu
    __osSetFpcCsr(FPCSR_FS | FPCSR_EV); //flush denorm to zero, enable invalid operation
    __osSetWatchLo(0x4900000);

    while (__osSiRawReadIo(PIF_RAM_END - 3, &pifdata)) { //last byte of joychannel ram
        ;
    }
    while (__osSiRawWriteIo(PIF_RAM_END - 3, pifdata | 8)) {
        ; //todo: magic contant
    }
    *(__osExceptionVector *)UT_VEC = __osExceptionPreamble;
    *(__osExceptionVector *)XUT_VEC = __osExceptionPreamble;
    *(__osExceptionVector *)ECC_VEC = __osExceptionPreamble;
    *(__osExceptionVector *)E_VEC = __osExceptionPreamble;
    osWritebackDCache((void *)UT_VEC, E_VEC - UT_VEC + sizeof(__osExceptionVector));
    osInvalICache((void *)UT_VEC, E_VEC - UT_VEC + sizeof(__osExceptionVector));
    __createSpeedParam();
    osUnmapTLBAll();
    osMapTLBRdb();
    osClockRate = osClockRate * 3 / 4;

    if (osResetType == 0 ) { // cold reset
        bzero(osAppNMIBuffer, OS_APP_NMI_BUFSIZE);
    }

    if (osTvType == OS_TV_PAL) {
        osViClock = VI_PAL_CLOCK;
    } else if (osTvType == OS_TV_MPAL) {
        osViClock = VI_MPAL_CLOCK;
    } else {
        osViClock = VI_NTSC_CLOCK;
    }

    // Wait until there are no RCP interrupts
    if (__osGetCause() & CAUSE_IP5) {
        while (TRUE) {
            ;
        }
    }

    IO_WRITE(AI_CONTROL_REG, AI_CONTROL_DMA_ON);
    IO_WRITE(AI_DACRATE_REG, AI_MAX_DAC_RATE - 1);
    IO_WRITE(AI_BITRATE_REG, AI_MAX_BIT_RATE - 1);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel reset_player_status
/* 7B50C 800E205C 27BDFFE8 */  addiu     $sp, $sp, -0x18
/* 7B510 800E2060 2402FFFF */  addiu     $v0, $zero, -0x1
/* 7B514 800E2064 3C058011 */  lui       $a1, %hi(D_8010C92C)
/* 7B518 800E2068 24A5C92C */  addiu     $a1, $a1, %lo(D_8010C92C)
/* 7B51C 800E206C AFB00010 */  sw        $s0, 0x10($sp)
/* 7B520 800E2070 3C108011 */  lui       $s0, %hi(gPlayerStatus)
/* 7B524 800E2074 2610EFC8 */  addiu     $s0, $s0, %lo(gPlayerStatus)
/* 7B528 800E2078 3C018011 */  lui       $at, %hi(PeachDisguiseNpcIndex)
/* 7B52C 800E207C AC22C96C */  sw        $v0, %lo(PeachDisguiseNpcIndex)($at)
/* 7B530 800E2080 24020001 */  addiu     $v0, $zero, 0x1
/* 7B534 800E2084 AFBF0014 */  sw        $ra, 0x14($sp)
/* 7B538 800E2088 3C018011 */  lui       $at, %hi(TweesterTouchingPartner)
/* 7B53C 800E208C AC20C954 */  sw        $zero, %lo(TweesterTouchingPartner)($at)
/* 7B540 800E2090 3C018011 */  lui       $at, %hi(PulseStoneNotificationCallback)
/* 7B544 800E2094 AC20C920 */  sw        $zero, %lo(PulseStoneNotificationCallback)($at)
/* 7B548 800E2098 3C018011 */  lui       $at, %hi(TalkNotificationCallback)
/* 7B54C 800E209C AC20C940 */  sw        $zero, %lo(TalkNotificationCallback)($at)
/* 7B550 800E20A0 3C018011 */  lui       $at, %hi(InteractNotificationCallback)
/* 7B554 800E20A4 AC20C958 */  sw        $zero, %lo(InteractNotificationCallback)($at)
/* 7B558 800E20A8 ACA00000 */  sw        $zero, 0x0($a1)
/* 7B55C 800E20AC 3C018011 */  lui       $at, %hi(PrevPlayerDirection)
/* 7B560 800E20B0 AC20C95C */  sw        $zero, %lo(PrevPlayerDirection)($at)
/* 7B564 800E20B4 3C018011 */  lui       $at, %hi(D_8010C980)
/* 7B568 800E20B8 AC20C980 */  sw        $zero, %lo(D_8010C980)($at)
/* 7B56C 800E20BC 3C01800F */  lui       $at, %hi(PrevPlayerCamRelativeYaw)
/* 7B570 800E20C0 AC207B40 */  sw        $zero, %lo(PrevPlayerCamRelativeYaw)($at)
/* 7B574 800E20C4 3C01800F */  lui       $at, %hi(D_800F7B44)
/* 7B578 800E20C8 AC207B44 */  sw        $zero, %lo(D_800F7B44)($at)
/* 7B57C 800E20CC 3C018011 */  lui       $at, %hi(D_8010C938)
/* 7B580 800E20D0 AC20C938 */  sw        $zero, %lo(D_8010C938)($at)
/* 7B584 800E20D4 3C018011 */  lui       $at, %hi(D_8010C990)
/* 7B588 800E20D8 AC20C990 */  sw        $zero, %lo(D_8010C990)($at)
/* 7B58C 800E20DC A202000D */  sb        $v0, 0xD($s0)
/* 7B590 800E20E0 2402000D */  addiu     $v0, $zero, 0xD
/* 7B594 800E20E4 3C048007 */  lui       $a0, %hi(gGameStatusPtr)
/* 7B598 800E20E8 2484419C */  addiu     $a0, $a0, %lo(gGameStatusPtr)
/* 7B59C 800E20EC A20200BE */  sb        $v0, 0xBE($s0)
/* 7B5A0 800E20F0 8C830000 */  lw        $v1, 0x0($a0)
/* 7B5A4 800E20F4 240200FF */  addiu     $v0, $zero, 0xFF
/* 7B5A8 800E20F8 A202000E */  sb        $v0, 0xE($s0)
/* 7B5AC 800E20FC A202000F */  sb        $v0, 0xF($s0)
/* 7B5B0 800E2100 9062007E */  lbu       $v0, 0x7E($v1)
/* 7B5B4 800E2104 304200F7 */  andi      $v0, $v0, 0xF7
/* 7B5B8 800E2108 A062007E */  sb        $v0, 0x7E($v1)
/* 7B5BC 800E210C 8C830000 */  lw        $v1, 0x0($a0)
/* 7B5C0 800E2110 9062007E */  lbu       $v0, 0x7E($v1)
/* 7B5C4 800E2114 304200EF */  andi      $v0, $v0, 0xEF
/* 7B5C8 800E2118 A062007E */  sb        $v0, 0x7E($v1)
/* 7B5CC 800E211C 8C840000 */  lw        $a0, 0x0($a0)
/* 7B5D0 800E2120 9082007E */  lbu       $v0, 0x7E($a0)
/* 7B5D4 800E2124 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 7B5D8 800E2128 44811000 */  mtc1      $at, $f2
/* 7B5DC 800E212C 30420001 */  andi      $v0, $v0, 0x1
/* 7B5E0 800E2130 1040000F */  beqz      $v0, .L800E2170
/* 7B5E4 800E2134 24020037 */   addiu    $v0, $zero, 0x37
/* 7B5E8 800E2138 A60200B0 */  sh        $v0, 0xB0($s0)
/* 7B5EC 800E213C 8E020004 */  lw        $v0, 0x4($s0)
/* 7B5F0 800E2140 24030026 */  addiu     $v1, $zero, 0x26
/* 7B5F4 800E2144 A60300B2 */  sh        $v1, 0xB2($s0)
/* 7B5F8 800E2148 34421000 */  ori       $v0, $v0, 0x1000
/* 7B5FC 800E214C AE020004 */  sw        $v0, 0x4($s0)
/* 7B600 800E2150 9082007E */  lbu       $v0, 0x7E($a0)
/* 7B604 800E2154 30420002 */  andi      $v0, $v0, 0x2
/* 7B608 800E2158 1040000A */  beqz      $v0, .L800E2184
/* 7B60C 800E215C 24020002 */   addiu    $v0, $zero, 0x2
/* 7B610 800E2160 ACA20000 */  sw        $v0, 0x0($a1)
/* 7B614 800E2164 9082007F */  lbu       $v0, 0x7F($a0)
/* 7B618 800E2168 08038861 */  j         .L800E2184
/* 7B61C 800E216C A202000C */   sb       $v0, 0xC($s0)
.L800E2170:
/* 7B620 800E2170 24020025 */  addiu     $v0, $zero, 0x25
/* 7B624 800E2174 A60200B0 */  sh        $v0, 0xB0($s0)
/* 7B628 800E2178 2402001A */  addiu     $v0, $zero, 0x1A
/* 7B62C 800E217C A60200B2 */  sh        $v0, 0xB2($s0)
/* 7B630 800E2180 A0800080 */  sb        $zero, 0x80($a0)
.L800E2184:
/* 7B634 800E2184 3C02800F */  lui       $v0, %hi(D_800F7B70)
/* 7B638 800E2188 24427B70 */  addiu     $v0, $v0, %lo(D_800F7B70)
/* 7B63C 800E218C C4400000 */  lwc1      $f0, 0x0($v0)
/* 7B640 800E2190 46020002 */  mul.s     $f0, $f0, $f2
/* 7B644 800E2194 00000000 */  nop
/* 7B648 800E2198 24420004 */  addiu     $v0, $v0, 0x4
/* 7B64C 800E219C E6000058 */  swc1      $f0, 0x58($s0)
/* 7B650 800E21A0 C4400000 */  lwc1      $f0, 0x0($v0)
/* 7B654 800E21A4 46020002 */  mul.s     $f0, $f0, $f2
/* 7B658 800E21A8 00000000 */  nop
/* 7B65C 800E21AC E600005C */  swc1      $f0, 0x5C($s0)
/* 7B660 800E21B0 C4400004 */  lwc1      $f0, 0x4($v0)
/* 7B664 800E21B4 46020002 */  mul.s     $f0, $f0, $f2
/* 7B668 800E21B8 00000000 */  nop
/* 7B66C 800E21BC 0000202D */  daddu     $a0, $zero, $zero
/* 7B670 800E21C0 0C039769 */  jal       set_action_state
/* 7B674 800E21C4 E600006C */   swc1     $f0, 0x6C($s0)
/* 7B678 800E21C8 3C068007 */  lui       $a2, %hi(gGameStatusPtr)
/* 7B67C 800E21CC 8CC6419C */  lw        $a2, %lo(gGameStatusPtr)($a2)
/* 7B680 800E21D0 AE000054 */  sw        $zero, 0x54($s0)
/* 7B684 800E21D4 AE000080 */  sw        $zero, 0x80($s0)
/* 7B688 800E21D8 AE000064 */  sw        $zero, 0x64($s0)
/* 7B68C 800E21DC AE000088 */  sw        $zero, 0x88($s0)
/* 7B690 800E21E0 AE0000B8 */  sw        $zero, 0xB8($s0)
/* 7B694 800E21E4 A60000C0 */  sh        $zero, 0xC0($s0)
/* 7B698 800E21E8 AE000028 */  sw        $zero, 0x28($s0)
/* 7B69C 800E21EC AE00002C */  sw        $zero, 0x2C($s0)
/* 7B6A0 800E21F0 AE000030 */  sw        $zero, 0x30($s0)
/* 7B6A4 800E21F4 AE000084 */  sw        $zero, 0x84($s0)
/* 7B6A8 800E21F8 AE000090 */  sw        $zero, 0x90($s0)
/* 7B6AC 800E21FC AE000094 */  sw        $zero, 0x94($s0)
/* 7B6B0 800E2200 AE000098 */  sw        $zero, 0x98($s0)
/* 7B6B4 800E2204 AE00009C */  sw        $zero, 0x9C($s0)
/* 7B6B8 800E2208 84C30086 */  lh        $v1, 0x86($a2)
/* 7B6BC 800E220C 84C2008C */  lh        $v0, 0x8C($a2)
/* 7B6C0 800E2210 00031900 */  sll       $v1, $v1, 4
/* 7B6C4 800E2214 3C018009 */  lui       $at, %hi(gAreas + 0x4)
/* 7B6C8 800E2218 00230821 */  addu      $at, $at, $v1
/* 7B6CC 800E221C 8C2334F4 */  lw        $v1, %lo(gAreas + 0x4)($at)
/* 7B6D0 800E2220 00021140 */  sll       $v0, $v0, 5
/* 7B6D4 800E2224 00431021 */  addu      $v0, $v0, $v1
/* 7B6D8 800E2228 8C440004 */  lw        $a0, 0x4($v0)
/* 7B6DC 800E222C 8C850014 */  lw        $a1, 0x14($a0)
/* 7B6E0 800E2230 10A0001B */  beqz      $a1, .L800E22A0
/* 7B6E4 800E2234 00000000 */   nop
/* 7B6E8 800E2238 84C3008E */  lh        $v1, 0x8E($a2)
/* 7B6EC 800E223C 8C820018 */  lw        $v0, 0x18($a0)
/* 7B6F0 800E2240 0062102A */  slt       $v0, $v1, $v0
/* 7B6F4 800E2244 10400016 */  beqz      $v0, .L800E22A0
/* 7B6F8 800E2248 00031100 */   sll      $v0, $v1, 4
/* 7B6FC 800E224C 00451021 */  addu      $v0, $v0, $a1
/* 7B700 800E2250 C4400000 */  lwc1      $f0, 0x0($v0)
/* 7B704 800E2254 E6000028 */  swc1      $f0, 0x28($s0)
/* 7B708 800E2258 84C2008E */  lh        $v0, 0x8E($a2)
/* 7B70C 800E225C 8C830014 */  lw        $v1, 0x14($a0)
/* 7B710 800E2260 00021100 */  sll       $v0, $v0, 4
/* 7B714 800E2264 00431021 */  addu      $v0, $v0, $v1
/* 7B718 800E2268 C4400004 */  lwc1      $f0, 0x4($v0)
/* 7B71C 800E226C E600002C */  swc1      $f0, 0x2C($s0)
/* 7B720 800E2270 84C2008E */  lh        $v0, 0x8E($a2)
/* 7B724 800E2274 8C830014 */  lw        $v1, 0x14($a0)
/* 7B728 800E2278 00021100 */  sll       $v0, $v0, 4
/* 7B72C 800E227C 00431021 */  addu      $v0, $v0, $v1
/* 7B730 800E2280 C4400008 */  lwc1      $f0, 0x8($v0)
/* 7B734 800E2284 E6000030 */  swc1      $f0, 0x30($s0)
/* 7B738 800E2288 84C2008E */  lh        $v0, 0x8E($a2)
/* 7B73C 800E228C 8C830014 */  lw        $v1, 0x14($a0)
/* 7B740 800E2290 00021100 */  sll       $v0, $v0, 4
/* 7B744 800E2294 00431021 */  addu      $v0, $v0, $v1
/* 7B748 800E2298 C440000C */  lwc1      $f0, 0xC($v0)
/* 7B74C 800E229C E6000084 */  swc1      $f0, 0x84($s0)
.L800E22A0:
/* 7B750 800E22A0 C6000028 */  lwc1      $f0, 0x28($s0)
/* 7B754 800E22A4 C602002C */  lwc1      $f2, 0x2C($s0)
/* 7B758 800E22A8 C6040030 */  lwc1      $f4, 0x30($s0)
/* 7B75C 800E22AC 3C02800B */  lui       $v0, %hi(gCameras)
/* 7B760 800E22B0 24421D80 */  addiu     $v0, $v0, %lo(gCameras)
/* 7B764 800E22B4 E4400060 */  swc1      $f0, 0x60($v0)
/* 7B768 800E22B8 E4420064 */  swc1      $f2, 0x64($v0)
/* 7B76C 800E22BC 0C039668 */  jal       phys_reset_spin_history
/* 7B770 800E22C0 E4440068 */   swc1     $f4, 0x68($v0)
/* 7B774 800E22C4 3C048011 */  lui       $a0, %hi(gPlayerSpinState)
/* 7B778 800E22C8 2484F250 */  addiu     $a0, $a0, %lo(gPlayerSpinState)
/* 7B77C 800E22CC 0C00A580 */  jal       mem_clear
/* 7B780 800E22D0 24050034 */   addiu    $a1, $zero, 0x34
/* 7B784 800E22D4 8FBF0014 */  lw        $ra, 0x14($sp)
/* 7B788 800E22D8 8FB00010 */  lw        $s0, 0x10($sp)
/* 7B78C 800E22DC 03E00008 */  jr        $ra
/* 7B790 800E22E0 27BD0018 */   addiu    $sp, $sp, 0x18

### DECOMPILED C INSTRUCTIONS:

void reset_player_status(void) {
    PlayerStatus* playerStatus = &gPlayerStatus;
    MapSettings* mapSettings;
    f32 one;
    f32* floatsTemp;

    PeachDisguiseNpcIndex = -1;
    TweesterTouchingPartner = NULL;
    PulseStoneNotificationCallback = NULL;
    TalkNotificationCallback = NULL;
    InteractNotificationCallback = NULL;
    D_8010C92C = 0;
    PrevPlayerDirection = 0;
    D_8010C980 = 0;
    PrevPlayerCamRelativeYaw = 0;
    D_800F7B44 = 0;
    D_8010C938 = 0;
    D_8010C990 = 0.0f;
    playerStatus->availableDisguiseType = 1;
    playerStatus->renderMode = RENDER_MODE_ALPHATEST;

    playerStatus->alpha1 = 255;
    playerStatus->alpha2 = 255;
    gGameStatusPtr->peachFlags &= ~PEACH_STATUS_FLAG_8;
    gGameStatusPtr->peachFlags &= ~PEACH_STATUS_FLAG_DEPRESSED;

    one = 1.0f;

    if (gGameStatusPtr->peachFlags & PEACH_STATUS_FLAG_IS_PEACH) {
        playerStatus->colliderHeight = 55;
        playerStatus->colliderDiameter = 38;
        playerStatus->animFlags |= PA_FLAG_USING_PEACH_PHYSICS;

        if (gGameStatusPtr->peachFlags & PEACH_STATUS_FLAG_DISGUISED) {
            D_8010C92C = 2;
            playerStatus->peachDisguise = gGameStatusPtr->peachDisguise;
        }
    } else {
        playerStatus->colliderHeight = 37;
        playerStatus->colliderDiameter = 26;
        gGameStatusPtr->peachBakingIngredient = 0;
    }

    // TODO required to match
    floatsTemp = &(&D_800F7B74)[-1]; // index of 0 does not work
    playerStatus->walkSpeed = *floatsTemp++ * one;
    playerStatus->runSpeed = *floatsTemp++ * one;
    playerStatus->maxJumpSpeed = *floatsTemp++ * one;

    set_action_state(ACTION_STATE_IDLE);

    playerStatus->currentSpeed = 0.0f;
    playerStatus->targetYaw = 0.0f;
    playerStatus->overlapPushAmount = 0.0f;
    playerStatus->overlapPushYaw = 0.0f;
    playerStatus->anim = 0;
    playerStatus->timeInAir = 0;
    playerStatus->position.x = 0.0f;
    playerStatus->position.y = 0.0f;
    playerStatus->position.z = 0.0f;
    playerStatus->currentYaw = 0.0f;
    playerStatus->flipYaw[CAM_DEFAULT] = 0.0f;
    playerStatus->flipYaw[CAM_BATTLE] = 0.0f;
    playerStatus->flipYaw[CAM_TATTLE] = 0.0f;
    playerStatus->flipYaw[CAM_3] = 0.0f;

    mapSettings = gAreas[gGameStatusPtr->areaID].maps[gGameStatusPtr->mapID].settings;

    if (mapSettings->entryList != NULL) {
        if (gGameStatusPtr->entryID < mapSettings->entryCount) {
            playerStatus->position.x = (*mapSettings->entryList)[gGameStatusPtr->entryID].x;
            playerStatus->position.y = (*mapSettings->entryList)[gGameStatusPtr->entryID].y;
            playerStatus->position.z = (*mapSettings->entryList)[gGameStatusPtr->entryID].z;
            playerStatus->currentYaw = (*mapSettings->entryList)[gGameStatusPtr->entryID].yaw;
        }
    }

    gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x;
    gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y;
    gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z;

    phys_reset_spin_history();
    mem_clear(&gPlayerSpinState, sizeof(gPlayerSpinState));
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel breaking_junk_appendGfx
/* 40389C E011849C 27BDFF30 */  addiu     $sp, $sp, -0xD0
/* 4038A0 E01184A0 AFB700BC */  sw        $s7, 0xBC($sp)
/* 4038A4 E01184A4 0080B82D */  daddu     $s7, $a0, $zero
/* 4038A8 E01184A8 3C05DB06 */  lui       $a1, (0xDB060024 >> 16)
/* 4038AC E01184AC 3C06800A */  lui       $a2, %hi(gMainGfxPos)
/* 4038B0 E01184B0 24C6A66C */  addiu     $a2, $a2, %lo(gMainGfxPos)
/* 4038B4 E01184B4 34A50024 */  ori       $a1, $a1, (0xDB060024 & 0xFFFF)
/* 4038B8 E01184B8 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 4038BC E01184BC AFBF00C4 */  sw        $ra, 0xC4($sp)
/* 4038C0 E01184C0 AFBE00C0 */  sw        $fp, 0xC0($sp)
/* 4038C4 E01184C4 AFB600B8 */  sw        $s6, 0xB8($sp)
/* 4038C8 E01184C8 AFB500B4 */  sw        $s5, 0xB4($sp)
/* 4038CC E01184CC AFB400B0 */  sw        $s4, 0xB0($sp)
/* 4038D0 E01184D0 AFB300AC */  sw        $s3, 0xAC($sp)
/* 4038D4 E01184D4 AFB200A8 */  sw        $s2, 0xA8($sp)
/* 4038D8 E01184D8 AFB100A4 */  sw        $s1, 0xA4($sp)
/* 4038DC E01184DC AFB000A0 */  sw        $s0, 0xA0($sp)
/* 4038E0 E01184E0 F7B400C8 */  sdc1      $f20, 0xC8($sp)
/* 4038E4 E01184E4 8CC40000 */  lw        $a0, 0x0($a2)
/* 4038E8 E01184E8 8EE7000C */  lw        $a3, 0xC($s7)
/* 4038EC E01184EC 0080182D */  daddu     $v1, $a0, $zero
/* 4038F0 E01184F0 84FE0032 */  lh        $fp, 0x32($a3)
/* 4038F4 E01184F4 24840008 */  addiu     $a0, $a0, 0x8
/* 4038F8 E01184F8 AC620000 */  sw        $v0, 0x0($v1)
/* 4038FC E01184FC AC600004 */  sw        $zero, 0x4($v1)
/* 403900 E0118500 AC850000 */  sw        $a1, 0x0($a0)
/* 403904 E0118504 8EE20010 */  lw        $v0, 0x10($s7)
/* 403908 E0118508 0000882D */  daddu     $s1, $zero, $zero
/* 40390C E011850C ACC40000 */  sw        $a0, 0x0($a2)
/* 403910 E0118510 8C43001C */  lw        $v1, 0x1C($v0)
/* 403914 E0118514 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 403918 E0118518 AC820008 */  sw        $v0, 0x8($a0)
/* 40391C E011851C 3C028000 */  lui       $v0, (0x80000000 >> 16)
/* 403920 E0118520 00621821 */  addu      $v1, $v1, $v0
/* 403924 E0118524 AC830004 */  sw        $v1, 0x4($a0)
/* 403928 E0118528 3C03E012 */  lui       $v1, (0xE0120000 >> 16)
/* 40392C E011852C 8C6387C0 */  lw        $v1, -0x7840($v1)
/* 403930 E0118530 24820008 */  addiu     $v0, $a0, 0x8
/* 403934 E0118534 ACC20000 */  sw        $v0, 0x0($a2)
/* 403938 E0118538 AC83000C */  sw        $v1, 0xC($a0)
/* 40393C E011853C 8EE20008 */  lw        $v0, 0x8($s7)
/* 403940 E0118540 24840010 */  addiu     $a0, $a0, 0x10
/* 403944 E0118544 18400084 */  blez      $v0, .LE0118758
/* 403948 E0118548 ACC40000 */   sw       $a0, 0x0($a2)
/* 40394C E011854C 4480A000 */  mtc1      $zero, $f20
/* 403950 E0118550 27B40060 */  addiu     $s4, $sp, 0x60
/* 403954 E0118554 3C16800A */  lui       $s6, %hi(gDisplayContext)
/* 403958 E0118558 26D6A674 */  addiu     $s6, $s6, %lo(gDisplayContext)
/* 40395C E011855C 3C158007 */  lui       $s5, %hi(gMatrixListPos)
/* 403960 E0118560 26B541F0 */  addiu     $s5, $s5, %lo(gMatrixListPos)
/* 403964 E0118564 3C130001 */  lui       $s3, (0x11630 >> 16)
/* 403968 E0118568 36731630 */  ori       $s3, $s3, (0x11630 & 0xFFFF)
/* 40396C E011856C 00C0902D */  daddu     $s2, $a2, $zero
/* 403970 E0118570 24F0003A */  addiu     $s0, $a3, 0x3A
.LE0118574:
/* 403974 E0118574 3C0A800B */  lui       $t2, %hi(gCameras)
/* 403978 E0118578 254A1D80 */  addiu     $t2, $t2, %lo(gCameras)
/* 40397C E011857C 4405A000 */  mfc1      $a1, $f20
/* 403980 E0118580 3C038007 */  lui       $v1, %hi(gCurrentCameraID)
/* 403984 E0118584 8C637410 */  lw        $v1, %lo(gCurrentCameraID)($v1)
/* 403988 E0118588 C600FFEA */  lwc1      $f0, -0x16($s0)
/* 40398C E011858C 3C013FE0 */  lui       $at, (0x3FE00000 >> 16)
/* 403990 E0118590 44811800 */  mtc1      $at, $f3
/* 403994 E0118594 44801000 */  mtc1      $zero, $f2
/* 403998 E0118598 00031080 */  sll       $v0, $v1, 2
/* 40399C E011859C 00431021 */  addu      $v0, $v0, $v1
/* 4039A0 E01185A0 46000021 */  cvt.d.s   $f0, $f0
/* 4039A4 E01185A4 00021080 */  sll       $v0, $v0, 2
/* 4039A8 E01185A8 46220002 */  mul.d     $f0, $f0, $f2
/* 4039AC E01185AC 00000000 */  nop
/* 4039B0 E01185B0 00431023 */  subu      $v0, $v0, $v1
/* 4039B4 E01185B4 000218C0 */  sll       $v1, $v0, 3
/* 4039B8 E01185B8 00431021 */  addu      $v0, $v0, $v1
/* 4039BC E01185BC 000210C0 */  sll       $v0, $v0, 3
/* 4039C0 E01185C0 004A1021 */  addu      $v0, $v0, $t2
/* 4039C4 E01185C4 C442006C */  lwc1      $f2, 0x6C($v0)
/* 4039C8 E01185C8 4407A000 */  mfc1      $a3, $f20
/* 4039CC E01185CC 46001087 */  neg.s     $f2, $f2
/* 4039D0 E01185D0 44061000 */  mfc1      $a2, $f2
/* 4039D4 E01185D4 46200020 */  cvt.s.d   $f0, $f0
/* 4039D8 E01185D8 E7A00010 */  swc1      $f0, 0x10($sp)
/* 4039DC E01185DC C600FFCA */  lwc1      $f0, -0x36($s0)
/* 4039E0 E01185E0 E7A00014 */  swc1      $f0, 0x14($sp)
/* 4039E4 E01185E4 C600FFCE */  lwc1      $f0, -0x32($s0)
/* 4039E8 E01185E8 E7A00018 */  swc1      $f0, 0x18($sp)
/* 4039EC E01185EC C600FFD2 */  lwc1      $f0, -0x2E($s0)
/* 4039F0 E01185F0 27A40020 */  addiu     $a0, $sp, 0x20
/* 4039F4 E01185F4 0C080180 */  jal       shim_guPositionF
/* 4039F8 E01185F8 E7A0001C */   swc1     $f0, 0x1C($sp)
/* 4039FC E01185FC 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 403A00 E0118600 44810000 */  mtc1      $at, $f0
/* 403A04 E0118604 4406A000 */  mfc1      $a2, $f20
/* 403A08 E0118608 4407A000 */  mfc1      $a3, $f20
/* 403A0C E011860C E7A00010 */  swc1      $f0, 0x10($sp)
/* 403A10 E0118610 8E05FFEE */  lw        $a1, -0x12($s0)
/* 403A14 E0118614 0C080104 */  jal       shim_guRotateF
/* 403A18 E0118618 0280202D */   daddu    $a0, $s4, $zero
/* 403A1C E011861C 0280202D */  daddu     $a0, $s4, $zero
/* 403A20 E0118620 27A50020 */  addiu     $a1, $sp, 0x20
/* 403A24 E0118624 0C080114 */  jal       shim_guMtxCatF
/* 403A28 E0118628 00A0302D */   daddu    $a2, $a1, $zero
/* 403A2C E011862C 27A40020 */  addiu     $a0, $sp, 0x20
/* 403A30 E0118630 96A50000 */  lhu       $a1, 0x0($s5)
/* 403A34 E0118634 8EC20000 */  lw        $v0, 0x0($s6)
/* 403A38 E0118638 00052980 */  sll       $a1, $a1, 6
/* 403A3C E011863C 00B32821 */  addu      $a1, $a1, $s3
/* 403A40 E0118640 0C080118 */  jal       shim_guMtxF2L
/* 403A44 E0118644 00452821 */   addu     $a1, $v0, $a1
/* 403A48 E0118648 3C02DA38 */  lui       $v0, (0xDA380002 >> 16)
/* 403A4C E011864C 34420002 */  ori       $v0, $v0, (0xDA380002 & 0xFFFF)
/* 403A50 E0118650 3C09D838 */  lui       $t1, (0xD8380002 >> 16)
/* 403A54 E0118654 35290002 */  ori       $t1, $t1, (0xD8380002 & 0xFFFF)
/* 403A58 E0118658 32280003 */  andi      $t0, $s1, 0x3
/* 403A5C E011865C 26310001 */  addiu     $s1, $s1, 0x1
/* 403A60 E0118660 00084080 */  sll       $t0, $t0, 2
/* 403A64 E0118664 8E440000 */  lw        $a0, 0x0($s2)
/* 403A68 E0118668 96A30000 */  lhu       $v1, 0x0($s5)
/* 403A6C E011866C 0080282D */  daddu     $a1, $a0, $zero
/* 403A70 E0118670 24840008 */  addiu     $a0, $a0, 0x8
/* 403A74 E0118674 AE440000 */  sw        $a0, 0x0($s2)
/* 403A78 E0118678 ACA20000 */  sw        $v0, 0x0($a1)
/* 403A7C E011867C 24620001 */  addiu     $v0, $v1, 0x1
/* 403A80 E0118680 3063FFFF */  andi      $v1, $v1, 0xFFFF
/* 403A84 E0118684 00031980 */  sll       $v1, $v1, 6
/* 403A88 E0118688 A6A20000 */  sh        $v0, 0x0($s5)
/* 403A8C E011868C 8EC20000 */  lw        $v0, 0x0($s6)
/* 403A90 E0118690 00731821 */  addu      $v1, $v1, $s3
/* 403A94 E0118694 00431021 */  addu      $v0, $v0, $v1
/* 403A98 E0118698 ACA20004 */  sw        $v0, 0x4($a1)
/* 403A9C E011869C 24820008 */  addiu     $v0, $a0, 0x8
/* 403AA0 E01186A0 AE420000 */  sw        $v0, 0x0($s2)
/* 403AA4 E01186A4 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 403AA8 E01186A8 AC820000 */  sw        $v0, 0x0($a0)
/* 403AAC E01186AC 9203FFF3 */  lbu       $v1, -0xD($s0)
/* 403AB0 E01186B0 9205FFF5 */  lbu       $a1, -0xB($s0)
/* 403AB4 E01186B4 9206FFF7 */  lbu       $a2, -0x9($s0)
/* 403AB8 E01186B8 24820010 */  addiu     $v0, $a0, 0x10
/* 403ABC E01186BC AE420000 */  sw        $v0, 0x0($s2)
/* 403AC0 E01186C0 3C02FB00 */  lui       $v0, (0xFB000000 >> 16)
/* 403AC4 E01186C4 AC820008 */  sw        $v0, 0x8($a0)
/* 403AC8 E01186C8 33C200FF */  andi      $v0, $fp, 0xFF
/* 403ACC E01186CC 00031E00 */  sll       $v1, $v1, 24
/* 403AD0 E01186D0 00052C00 */  sll       $a1, $a1, 16
/* 403AD4 E01186D4 00651825 */  or        $v1, $v1, $a1
/* 403AD8 E01186D8 00063200 */  sll       $a2, $a2, 8
/* 403ADC E01186DC 00661825 */  or        $v1, $v1, $a2
/* 403AE0 E01186E0 00621825 */  or        $v1, $v1, $v0
/* 403AE4 E01186E4 AC830004 */  sw        $v1, 0x4($a0)
/* 403AE8 E01186E8 9203FFFB */  lbu       $v1, -0x5($s0)
/* 403AEC E01186EC 9205FFFD */  lbu       $a1, -0x3($s0)
/* 403AF0 E01186F0 9206FFFF */  lbu       $a2, -0x1($s0)
/* 403AF4 E01186F4 92070001 */  lbu       $a3, 0x1($s0)
/* 403AF8 E01186F8 2610003C */  addiu     $s0, $s0, 0x3C
/* 403AFC E01186FC 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 403B00 E0118700 AC820010 */  sw        $v0, 0x10($a0)
/* 403B04 E0118704 00031E00 */  sll       $v1, $v1, 24
/* 403B08 E0118708 00052C00 */  sll       $a1, $a1, 16
/* 403B0C E011870C 00651825 */  or        $v1, $v1, $a1
/* 403B10 E0118710 00063200 */  sll       $a2, $a2, 8
/* 403B14 E0118714 00661825 */  or        $v1, $v1, $a2
/* 403B18 E0118718 00671825 */  or        $v1, $v1, $a3
/* 403B1C E011871C AC83000C */  sw        $v1, 0xC($a0)
/* 403B20 E0118720 3C03E012 */  lui       $v1, (0xE0120000 >> 16)
/* 403B24 E0118724 00681821 */  addu      $v1, $v1, $t0
/* 403B28 E0118728 8C6387B0 */  lw        $v1, -0x7850($v1)
/* 403B2C E011872C 24820018 */  addiu     $v0, $a0, 0x18
/* 403B30 E0118730 AE420000 */  sw        $v0, 0x0($s2)
/* 403B34 E0118734 24020040 */  addiu     $v0, $zero, 0x40
/* 403B38 E0118738 AC890018 */  sw        $t1, 0x18($a0)
/* 403B3C E011873C AC82001C */  sw        $v0, 0x1C($a0)
/* 403B40 E0118740 AC830014 */  sw        $v1, 0x14($a0)
/* 403B44 E0118744 8EE20008 */  lw        $v0, 0x8($s7)
/* 403B48 E0118748 24840020 */  addiu     $a0, $a0, 0x20
/* 403B4C E011874C 0222102A */  slt       $v0, $s1, $v0
/* 403B50 E0118750 1440FF88 */  bnez      $v0, .LE0118574
/* 403B54 E0118754 AE440000 */   sw       $a0, 0x0($s2)
.LE0118758:
/* 403B58 E0118758 3C03800A */  lui       $v1, %hi(gMainGfxPos)
/* 403B5C E011875C 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
/* 403B60 E0118760 8C620000 */  lw        $v0, 0x0($v1)
/* 403B64 E0118764 0040202D */  daddu     $a0, $v0, $zero
/* 403B68 E0118768 24420008 */  addiu     $v0, $v0, 0x8
/* 403B6C E011876C AC620000 */  sw        $v0, 0x0($v1)
/* 403B70 E0118770 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 403B74 E0118774 AC820000 */  sw        $v0, 0x0($a0)
/* 403B78 E0118778 AC800004 */  sw        $zero, 0x4($a0)
/* 403B7C E011877C 8FBF00C4 */  lw        $ra, 0xC4($sp)
/* 403B80 E0118780 8FBE00C0 */  lw        $fp, 0xC0($sp)
/* 403B84 E0118784 8FB700BC */  lw        $s7, 0xBC($sp)
/* 403B88 E0118788 8FB600B8 */  lw        $s6, 0xB8($sp)
/* 403B8C E011878C 8FB500B4 */  lw        $s5, 0xB4($sp)
/* 403B90 E0118790 8FB400B0 */  lw        $s4, 0xB0($sp)
/* 403B94 E0118794 8FB300AC */  lw        $s3, 0xAC($sp)
/* 403B98 E0118798 8FB200A8 */  lw        $s2, 0xA8($sp)
/* 403B9C E011879C 8FB100A4 */  lw        $s1, 0xA4($sp)
/* 403BA0 E01187A0 8FB000A0 */  lw        $s0, 0xA0($sp)
/* 403BA4 E01187A4 D7B400C8 */  ldc1      $f20, 0xC8($sp)
/* 403BA8 E01187A8 03E00008 */  jr        $ra
/* 403BAC E01187AC 27BD00D0 */   addiu    $sp, $sp, 0xD0

### DECOMPILED C INSTRUCTIONS:

void breaking_junk_appendGfx(void* effect) {
    Matrix4f sp20, sp60;
    BreakingJunkFXData* data = ((EffectInstance*)effect)->data.breakingJunk;
    s32 alpha = data->primA;
    s32 i;

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

    for (i = 0; i < ((EffectInstance*)effect)->numParts; i++, data++) {
        shim_guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, data->scale * 0.5, data->pos.x, data->pos.y, data->pos.z);
        shim_guRotateF(sp60, data->rot, 0.0f, 0.0f, 1.0f);
        shim_guMtxCatF(sp60, sp20, sp20);
        shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]);
        gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
        gDPSetPrimColor(gMainGfxPos++, 0, 0, data->primR, data->primG, data->primB, alpha);
        gDPSetEnvColor(gMainGfxPos++, data->envR, data->envG, data->envB, data->envA);
        gSPDisplayList(gMainGfxPos++, D_E01187B0[(u32)i % ARRAY_COUNT(D_E01187B0)]);
        gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    }

    gDPPipeSync(gMainGfxPos++);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel __osRepairPackId
/* 44BB8 800697B8 27BDFF80 */  addiu     $sp, $sp, -0x80
/* 44BBC 800697BC AFB10064 */  sw        $s1, 0x64($sp)
/* 44BC0 800697C0 00808821 */  addu      $s1, $a0, $zero
/* 44BC4 800697C4 AFB50074 */  sw        $s5, 0x74($sp)
/* 44BC8 800697C8 00A0A821 */  addu      $s5, $a1, $zero
/* 44BCC 800697CC AFB3006C */  sw        $s3, 0x6C($sp)
/* 44BD0 800697D0 00C09821 */  addu      $s3, $a2, $zero
/* 44BD4 800697D4 2402FFFF */  addiu     $v0, $zero, -0x1
/* 44BD8 800697D8 AFBF007C */  sw        $ra, 0x7C($sp)
/* 44BDC 800697DC AFB60078 */  sw        $s6, 0x78($sp)
/* 44BE0 800697E0 AFB40070 */  sw        $s4, 0x70($sp)
/* 44BE4 800697E4 AFB20068 */  sw        $s2, 0x68($sp)
/* 44BE8 800697E8 AFB00060 */  sw        $s0, 0x60($sp)
/* 44BEC 800697EC 0C019680 */  jal       osGetCount
/* 44BF0 800697F0 AE620000 */   sw       $v0, 0x0($s3)
/* 44BF4 800697F4 AE620004 */  sw        $v0, 0x4($s3)
/* 44BF8 800697F8 8EA20008 */  lw        $v0, 0x8($s5)
/* 44BFC 800697FC 8EA3000C */  lw        $v1, 0xC($s5)
/* 44C00 80069800 AE620008 */  sw        $v0, 0x8($s3)
/* 44C04 80069804 AE63000C */  sw        $v1, 0xC($s3)
/* 44C08 80069808 8EA20010 */  lw        $v0, 0x10($s5)
/* 44C0C 8006980C 8EA30014 */  lw        $v1, 0x14($s5)
/* 44C10 80069810 AE620010 */  sw        $v0, 0x10($s3)
/* 44C14 80069814 AE630014 */  sw        $v1, 0x14($s3)
/* 44C18 80069818 92220065 */  lbu       $v0, 0x65($s1)
/* 44C1C 8006981C 10400006 */  beqz      $v0, .L80069838
/* 44C20 80069820 00009021 */   addu     $s2, $zero, $zero
/* 44C24 80069824 02202021 */  addu      $a0, $s1, $zero
/* 44C28 80069828 0C01A5B4 */  jal       __osPfsSelectBank
/* 44C2C 8006982C 00002821 */   addu     $a1, $zero, $zero
/* 44C30 80069830 14400092 */  bnez      $v0, .L80069A7C
/* 44C34 80069834 00000000 */   nop
.L80069838:
/* 44C38 80069838 27B40018 */  addiu     $s4, $sp, 0x18
/* 44C3C 8006983C 27B60038 */  addiu     $s6, $sp, 0x38
/* 44C40 80069840 02202021 */  addu      $a0, $s1, $zero
.L80069844:
/* 44C44 80069844 0C01A5B4 */  jal       __osPfsSelectBank
/* 44C48 80069848 324500FF */   andi     $a1, $s2, 0xFF
/* 44C4C 8006984C 1440008B */  bnez      $v0, .L80069A7C
/* 44C50 80069850 00003021 */   addu     $a2, $zero, $zero
/* 44C54 80069854 8E240004 */  lw        $a0, 0x4($s1)
/* 44C58 80069858 8E250008 */  lw        $a1, 0x8($s1)
/* 44C5C 8006985C 0C01A874 */  jal       __osContRamRead
/* 44C60 80069860 27A70018 */   addiu    $a3, $sp, 0x18
/* 44C64 80069864 14400085 */  bnez      $v0, .L80069A7C
/* 44C68 80069868 26830001 */   addiu    $v1, $s4, 0x1
/* 44C6C 8006986C 36420080 */  ori       $v0, $s2, 0x80
/* 44C70 80069870 A3A20018 */  sb        $v0, 0x18($sp)
/* 44C74 80069874 26840020 */  addiu     $a0, $s4, 0x20
.L80069878:
/* 44C78 80069878 90620000 */  lbu       $v0, 0x0($v1)
/* 44C7C 8006987C 00021027 */  nor       $v0, $zero, $v0
/* 44C80 80069880 A0620000 */  sb        $v0, 0x0($v1)
/* 44C84 80069884 24630001 */  addiu     $v1, $v1, 0x1
/* 44C88 80069888 0064102A */  slt       $v0, $v1, $a0
/* 44C8C 8006988C 1440FFFA */  bnez      $v0, .L80069878
/* 44C90 80069890 00003021 */   addu     $a2, $zero, $zero
/* 44C94 80069894 AFA00010 */  sw        $zero, 0x10($sp)
/* 44C98 80069898 8E240004 */  lw        $a0, 0x4($s1)
/* 44C9C 8006989C 8E250008 */  lw        $a1, 0x8($s1)
/* 44CA0 800698A0 0C01A8F0 */  jal       osContRamWrite
/* 44CA4 800698A4 27A70018 */   addiu    $a3, $sp, 0x18
/* 44CA8 800698A8 14400074 */  bnez      $v0, .L80069A7C
/* 44CAC 800698AC 00003021 */   addu     $a2, $zero, $zero
/* 44CB0 800698B0 8E240004 */  lw        $a0, 0x4($s1)
/* 44CB4 800698B4 8E250008 */  lw        $a1, 0x8($s1)
/* 44CB8 800698B8 0C01A874 */  jal       __osContRamRead
/* 44CBC 800698BC 27A70038 */   addiu    $a3, $sp, 0x38
/* 44CC0 800698C0 1440006E */  bnez      $v0, .L80069A7C
/* 44CC4 800698C4 00008021 */   addu     $s0, $zero, $zero
/* 44CC8 800698C8 02802821 */  addu      $a1, $s4, $zero
/* 44CCC 800698CC 02C02021 */  addu      $a0, $s6, $zero
.L800698D0:
/* 44CD0 800698D0 90830000 */  lbu       $v1, 0x0($a0)
/* 44CD4 800698D4 90A20000 */  lbu       $v0, 0x0($a1)
/* 44CD8 800698D8 14620007 */  bne       $v1, $v0, .L800698F8
/* 44CDC 800698DC 24020020 */   addiu    $v0, $zero, 0x20
/* 44CE0 800698E0 24A50001 */  addiu     $a1, $a1, 0x1
/* 44CE4 800698E4 26100001 */  addiu     $s0, $s0, 0x1
/* 44CE8 800698E8 2A020020 */  slti      $v0, $s0, 0x20
/* 44CEC 800698EC 1440FFF8 */  bnez      $v0, .L800698D0
/* 44CF0 800698F0 24840001 */   addiu    $a0, $a0, 0x1
/* 44CF4 800698F4 24020020 */  addiu     $v0, $zero, 0x20
.L800698F8:
/* 44CF8 800698F8 16020015 */  bne       $s0, $v0, .L80069950
/* 44CFC 800698FC 00000000 */   nop
/* 44D00 80069900 1A40000F */  blez      $s2, .L80069940
/* 44D04 80069904 02202021 */   addu     $a0, $s1, $zero
/* 44D08 80069908 0C01A5B4 */  jal       __osPfsSelectBank
/* 44D0C 8006990C 00002821 */   addu     $a1, $zero, $zero
/* 44D10 80069910 1440005A */  bnez      $v0, .L80069A7C
/* 44D14 80069914 00003021 */   addu     $a2, $zero, $zero
/* 44D18 80069918 8E240004 */  lw        $a0, 0x4($s1)
/* 44D1C 8006991C 8E250008 */  lw        $a1, 0x8($s1)
/* 44D20 80069920 0C01A874 */  jal       __osContRamRead
/* 44D24 80069924 02803821 */   addu     $a3, $s4, $zero
/* 44D28 80069928 14400054 */  bnez      $v0, .L80069A7C
/* 44D2C 8006992C 00000000 */   nop
/* 44D30 80069930 93A30018 */  lbu       $v1, 0x18($sp)
/* 44D34 80069934 24020080 */  addiu     $v0, $zero, 0x80
/* 44D38 80069938 14620005 */  bne       $v1, $v0, .L80069950
/* 44D3C 8006993C 00000000 */   nop
.L80069940:
/* 44D40 80069940 26520001 */  addiu     $s2, $s2, 0x1
/* 44D44 80069944 2A42003E */  slti      $v0, $s2, 0x3E
/* 44D48 80069948 1440FFBE */  bnez      $v0, .L80069844
/* 44D4C 8006994C 02202021 */   addu     $a0, $s1, $zero
.L80069950:
/* 44D50 80069950 92220065 */  lbu       $v0, 0x65($s1)
/* 44D54 80069954 10400005 */  beqz      $v0, .L8006996C
/* 44D58 80069958 02202021 */   addu     $a0, $s1, $zero
/* 44D5C 8006995C 0C01A5B4 */  jal       __osPfsSelectBank
/* 44D60 80069960 00002821 */   addu     $a1, $zero, $zero
/* 44D64 80069964 14400045 */  bnez      $v0, .L80069A7C
/* 44D68 80069968 00000000 */   nop
.L8006996C:
/* 44D6C 8006996C 96A20018 */  lhu       $v0, 0x18($s5)
/* 44D70 80069970 2666001E */  addiu     $a2, $s3, 0x1E
/* 44D74 80069974 02602021 */  addu      $a0, $s3, $zero
/* 44D78 80069978 0012182A */  slt       $v1, $zero, $s2
/* 44D7C 8006997C A272001A */  sb        $s2, 0x1A($s3)
/* 44D80 80069980 3042FFFE */  andi      $v0, $v0, 0xFFFE
/* 44D84 80069984 00621825 */  or        $v1, $v1, $v0
/* 44D88 80069988 A6630018 */  sh        $v1, 0x18($s3)
/* 44D8C 8006998C 92A2001B */  lbu       $v0, 0x1B($s5)
/* 44D90 80069990 2665001C */  addiu     $a1, $s3, 0x1C
/* 44D94 80069994 00A03821 */  addu      $a3, $a1, $zero
/* 44D98 80069998 A660001E */  sh        $zero, 0x1E($s3)
/* 44D9C 8006999C A660001C */  sh        $zero, 0x1C($s3)
/* 44DA0 800699A0 A262001B */  sb        $v0, 0x1B($s3)
.L800699A4:
/* 44DA4 800699A4 94830000 */  lhu       $v1, 0x0($a0)
/* 44DA8 800699A8 94A20000 */  lhu       $v0, 0x0($a1)
/* 44DAC 800699AC 00431021 */  addu      $v0, $v0, $v1
/* 44DB0 800699B0 A4A20000 */  sh        $v0, 0x0($a1)
/* 44DB4 800699B4 94C20000 */  lhu       $v0, 0x0($a2)
/* 44DB8 800699B8 24840002 */  addiu     $a0, $a0, 0x2
/* 44DBC 800699BC 00031827 */  nor       $v1, $zero, $v1
/* 44DC0 800699C0 00431021 */  addu      $v0, $v0, $v1
/* 44DC4 800699C4 A4C20000 */  sh        $v0, 0x0($a2)
/* 44DC8 800699C8 0087102B */  sltu      $v0, $a0, $a3
/* 44DCC 800699CC 1440FFF5 */  bnez      $v0, .L800699A4
/* 44DD0 800699D0 00008021 */   addu     $s0, $zero, $zero
/* 44DD4 800699D4 24140001 */  addiu     $s4, $zero, 0x1
/* 44DD8 800699D8 27B20018 */  addiu     $s2, $sp, 0x18
/* 44DDC 800699DC 24020001 */  addiu     $v0, $zero, 0x1
/* 44DE0 800699E0 A7A20058 */  sh        $v0, 0x58($sp)
/* 44DE4 800699E4 24020003 */  addiu     $v0, $zero, 0x3
/* 44DE8 800699E8 A7A2005A */  sh        $v0, 0x5A($sp)
/* 44DEC 800699EC 24020004 */  addiu     $v0, $zero, 0x4
/* 44DF0 800699F0 A7A2005C */  sh        $v0, 0x5C($sp)
/* 44DF4 800699F4 24020006 */  addiu     $v0, $zero, 0x6
/* 44DF8 800699F8 A7A2005E */  sh        $v0, 0x5E($sp)
.L800699FC:
/* 44DFC 800699FC 96460040 */  lhu       $a2, 0x40($s2)
/* 44E00 80069A00 AFB40010 */  sw        $s4, 0x10($sp)
/* 44E04 80069A04 8E240004 */  lw        $a0, 0x4($s1)
/* 44E08 80069A08 8E250008 */  lw        $a1, 0x8($s1)
/* 44E0C 80069A0C 0C01A8F0 */  jal       osContRamWrite
/* 44E10 80069A10 02603821 */   addu     $a3, $s3, $zero
/* 44E14 80069A14 14400019 */  bnez      $v0, .L80069A7C
/* 44E18 80069A18 26100001 */   addiu    $s0, $s0, 0x1
/* 44E1C 80069A1C 2A020004 */  slti      $v0, $s0, 0x4
/* 44E20 80069A20 1440FFF6 */  bnez      $v0, .L800699FC
/* 44E24 80069A24 26520002 */   addiu    $s2, $s2, 0x2
/* 44E28 80069A28 8E240004 */  lw        $a0, 0x4($s1)
/* 44E2C 80069A2C 8E250008 */  lw        $a1, 0x8($s1)
/* 44E30 80069A30 24060001 */  addiu     $a2, $zero, 0x1
/* 44E34 80069A34 0C01A874 */  jal       __osContRamRead
/* 44E38 80069A38 27A70018 */   addiu    $a3, $sp, 0x18
/* 44E3C 80069A3C 10400005 */  beqz      $v0, .L80069A54
/* 44E40 80069A40 02603021 */   addu     $a2, $s3, $zero
/* 44E44 80069A44 0801A69F */  j         .L80069A7C
/* 44E48 80069A48 00000000 */   nop
.L80069A4C:
/* 44E4C 80069A4C 0801A69F */  j         .L80069A7C
/* 44E50 80069A50 2402000B */   addiu    $v0, $zero, 0xB
.L80069A54:
/* 44E54 80069A54 27A40018 */  addiu     $a0, $sp, 0x18
/* 44E58 80069A58 24C50020 */  addiu     $a1, $a2, 0x20
.L80069A5C:
/* 44E5C 80069A5C 90830000 */  lbu       $v1, 0x0($a0)
/* 44E60 80069A60 90C20000 */  lbu       $v0, 0x0($a2)
/* 44E64 80069A64 1462FFF9 */  bne       $v1, $v0, .L80069A4C
/* 44E68 80069A68 24C60001 */   addiu    $a2, $a2, 0x1
/* 44E6C 80069A6C 00C5102A */  slt       $v0, $a2, $a1
/* 44E70 80069A70 1440FFFA */  bnez      $v0, .L80069A5C
/* 44E74 80069A74 24840001 */   addiu    $a0, $a0, 0x1
/* 44E78 80069A78 00001021 */  addu      $v0, $zero, $zero
.L80069A7C:
/* 44E7C 80069A7C 8FBF007C */  lw        $ra, 0x7C($sp)
/* 44E80 80069A80 8FB60078 */  lw        $s6, 0x78($sp)
/* 44E84 80069A84 8FB50074 */  lw        $s5, 0x74($sp)
/* 44E88 80069A88 8FB40070 */  lw        $s4, 0x70($sp)
/* 44E8C 80069A8C 8FB3006C */  lw        $s3, 0x6C($sp)
/* 44E90 80069A90 8FB20068 */  lw        $s2, 0x68($sp)
/* 44E94 80069A94 8FB10064 */  lw        $s1, 0x64($sp)
/* 44E98 80069A98 8FB00060 */  lw        $s0, 0x60($sp)
/* 44E9C 80069A9C 03E00008 */  jr        $ra
/* 44EA0 80069AA0 27BD0080 */   addiu    $sp, $sp, 0x80

### DECOMPILED C INSTRUCTIONS:

s32 __osRepairPackId(OSPfs *pfs, __OSPackId *badid, __OSPackId *newid) {
    s32 ret;
    u8 temp[BLOCKSIZE];
    u8 comp[BLOCKSIZE];
    u8 mask;
    int i;
    int j;
    u16 index[4];

    //ret = 0;
    //mask = 0;

    newid->repaired = -1;
    newid->random = osGetCount();
    newid->serial_mid = badid->serial_mid;
    newid->serial_low = badid->serial_low;
    j = 0;
    SET_ACTIVEBANK_TO_ZERO;

    do {
        ERRCK(__osPfsSelectBank(pfs, j))
        ERRCK(__osContRamRead(pfs->queue, pfs->channel, 0, temp));
        temp[0] = j | 0x80;
        for (i = 1; i < ARRAY_COUNT(temp); i++) {
            temp[i] = ~temp[i];
        }

        ERRCK(__osContRamWrite(pfs->queue, pfs->channel, 0, temp, FALSE));
        ERRCK(__osContRamRead(pfs->queue, pfs->channel, 0, comp));

        for (i = 0; i < ARRAY_COUNT(temp); i++) {
            if (comp[i] != temp[i]) {
                break;
            }
        }
        if (i != ARRAY_COUNT(temp)) {
            break;
        }
        if (j > 0) {
            ERRCK(__osPfsSelectBank(pfs, 0));
            ERRCK(__osContRamRead(pfs->queue, pfs->channel, 0, (u8*)temp));
            if (temp[0] != 128) {
                break; //TODO: remove magic constant
            }
        }
        j++;
    } while (j < PFS_MAX_BANKS);

    SET_ACTIVEBANK_TO_ZERO;
    if (j > 0) {
        mask = 1;
    } else {
        mask = 0;
    }
    newid->deviceid = (badid->deviceid & (u16)~1) | mask;
    newid->banks = j;
    newid->version = badid->version;
    __osIdCheckSum((u16*)newid, &newid->checksum, &newid->inverted_checksum);
    index[0] = PFS_ID_0AREA;
    index[1] = PFS_ID_1AREA;
    index[2] = PFS_ID_2AREA;
    index[3] = PFS_ID_3AREA;
    for (i = 0; i < ARRAY_COUNT(index); i++) {
        ERRCK(__osContRamWrite(pfs->queue, pfs->channel, index[i], (u8*)newid, TRUE));
    }
    ERRCK(__osContRamRead(pfs->queue, pfs->channel, 1, (u8*)temp));
    for (i = 0; i < ARRAY_COUNT(temp); i++) {
        if (temp[i] != ((u8 *)newid)[i]) {
            return PFS_ERR_DEVICE;
        }
    }
    return 0;
}