### RAW ASSEMBLY INSTRUCTIONS:

glabel peach_star_beam_update
/* 3E5658 E010C198 27BDFFA0 */  addiu     $sp, $sp, -0x60
/* 3E565C E010C19C AFBF0028 */  sw        $ra, 0x28($sp)
/* 3E5660 E010C1A0 AFB50024 */  sw        $s5, 0x24($sp)
/* 3E5664 E010C1A4 AFB40020 */  sw        $s4, 0x20($sp)
/* 3E5668 E010C1A8 AFB3001C */  sw        $s3, 0x1C($sp)
/* 3E566C E010C1AC AFB20018 */  sw        $s2, 0x18($sp)
/* 3E5670 E010C1B0 AFB10014 */  sw        $s1, 0x14($sp)
/* 3E5674 E010C1B4 AFB00010 */  sw        $s0, 0x10($sp)
/* 3E5678 E010C1B8 F7BE0058 */  sdc1      $f30, 0x58($sp)
/* 3E567C E010C1BC F7BC0050 */  sdc1      $f28, 0x50($sp)
/* 3E5680 E010C1C0 F7BA0048 */  sdc1      $f26, 0x48($sp)
/* 3E5684 E010C1C4 F7B80040 */  sdc1      $f24, 0x40($sp)
/* 3E5688 E010C1C8 F7B60038 */  sdc1      $f22, 0x38($sp)
/* 3E568C E010C1CC F7B40030 */  sdc1      $f20, 0x30($sp)
/* 3E5690 E010C1D0 8C830000 */  lw        $v1, 0x0($a0)
/* 3E5694 E010C1D4 8C91000C */  lw        $s1, 0xC($a0)
/* 3E5698 E010C1D8 30620010 */  andi      $v0, $v1, 0x10
/* 3E569C E010C1DC 10400005 */  beqz      $v0, .LE010C1F4
/* 3E56A0 E010C1E0 2402FFEF */   addiu    $v0, $zero, -0x11
/* 3E56A4 E010C1E4 00621024 */  and       $v0, $v1, $v0
/* 3E56A8 E010C1E8 AC820000 */  sw        $v0, 0x0($a0)
/* 3E56AC E010C1EC 24020010 */  addiu     $v0, $zero, 0x10
/* 3E56B0 E010C1F0 AE220010 */  sw        $v0, 0x10($s1)
.LE010C1F4:
/* 3E56B4 E010C1F4 8E230010 */  lw        $v1, 0x10($s1)
/* 3E56B8 E010C1F8 286203E8 */  slti      $v0, $v1, 0x3E8
/* 3E56BC E010C1FC 10400002 */  beqz      $v0, .LE010C208
/* 3E56C0 E010C200 2462FFFF */   addiu    $v0, $v1, -0x1
/* 3E56C4 E010C204 AE220010 */  sw        $v0, 0x10($s1)
.LE010C208:
/* 3E56C8 E010C208 8E220014 */  lw        $v0, 0x14($s1)
/* 3E56CC E010C20C 8E230010 */  lw        $v1, 0x10($s1)
/* 3E56D0 E010C210 24420001 */  addiu     $v0, $v0, 0x1
/* 3E56D4 E010C214 04610005 */  bgez      $v1, .LE010C22C
/* 3E56D8 E010C218 AE220014 */   sw       $v0, 0x14($s1)
/* 3E56DC E010C21C 0C080128 */  jal       shim_remove_effect
/* 3E56E0 E010C220 00000000 */   nop
/* 3E56E4 E010C224 080430C6 */  j         .LE010C318
/* 3E56E8 E010C228 00000000 */   nop
.LE010C22C:
/* 3E56EC E010C22C 0000982D */  daddu     $s3, $zero, $zero
/* 3E56F0 E010C230 3C159249 */  lui       $s5, (0x92492493 >> 16)
/* 3E56F4 E010C234 36B52493 */  ori       $s5, $s5, (0x92492493 & 0xFFFF)
/* 3E56F8 E010C238 2412FE98 */  addiu     $s2, $zero, -0x168
/* 3E56FC E010C23C 2414005C */  addiu     $s4, $zero, 0x5C
/* 3E5700 E010C240 C63C0048 */  lwc1      $f28, 0x48($s1)
/* 3E5704 E010C244 C6200044 */  lwc1      $f0, 0x44($s1)
/* 3E5708 E010C248 C6220040 */  lwc1      $f2, 0x40($s1)
/* 3E570C E010C24C C63A004C */  lwc1      $f26, 0x4C($s1)
/* 3E5710 E010C250 46020000 */  add.s     $f0, $f0, $f2
/* 3E5714 E010C254 C6380050 */  lwc1      $f24, 0x50($s1)
/* 3E5718 E010C258 C6360054 */  lwc1      $f22, 0x54($s1)
/* 3E571C E010C25C 46000786 */  mov.s     $f30, $f0
/* 3E5720 E010C260 E63E0044 */  swc1      $f30, 0x44($s1)
.LE010C264:
/* 3E5724 E010C264 16600007 */  bnez      $s3, .LE010C284
/* 3E5728 E010C268 02348021 */   addu     $s0, $s1, $s4
/* 3E572C E010C26C E61A0004 */  swc1      $f26, 0x4($s0)
/* 3E5730 E010C270 C6200058 */  lwc1      $f0, 0x58($s1)
/* 3E5734 E010C274 4600C000 */  add.s     $f0, $f24, $f0
/* 3E5738 E010C278 E616000C */  swc1      $f22, 0xC($s0)
/* 3E573C E010C27C 080430B8 */  j         .LE010C2E0
/* 3E5740 E010C280 E6000008 */   swc1     $f0, 0x8($s0)
.LE010C284:
/* 3E5744 E010C284 02550018 */  mult      $s2, $s5
/* 3E5748 E010C288 00121FC3 */  sra       $v1, $s2, 31
/* 3E574C E010C28C 00002810 */  mfhi      $a1
/* 3E5750 E010C290 00B21021 */  addu      $v0, $a1, $s2
/* 3E5754 E010C294 00021083 */  sra       $v0, $v0, 2
/* 3E5758 E010C298 00431023 */  subu      $v0, $v0, $v1
/* 3E575C E010C29C 4482A000 */  mtc1      $v0, $f20
/* 3E5760 E010C2A0 00000000 */  nop
/* 3E5764 E010C2A4 4680A520 */  cvt.s.w   $f20, $f20
/* 3E5768 E010C2A8 4614F500 */  add.s     $f20, $f30, $f20
/* 3E576C E010C2AC 0C080140 */  jal       shim_sin_deg
/* 3E5770 E010C2B0 4600A306 */   mov.s    $f12, $f20
/* 3E5774 E010C2B4 4600E002 */  mul.s     $f0, $f28, $f0
/* 3E5778 E010C2B8 00000000 */  nop
/* 3E577C E010C2BC 4600D000 */  add.s     $f0, $f26, $f0
/* 3E5780 E010C2C0 4600A306 */  mov.s     $f12, $f20
/* 3E5784 E010C2C4 E6180008 */  swc1      $f24, 0x8($s0)
/* 3E5788 E010C2C8 0C080144 */  jal       shim_cos_deg
/* 3E578C E010C2CC E6000004 */   swc1     $f0, 0x4($s0)
/* 3E5790 E010C2D0 4600E002 */  mul.s     $f0, $f28, $f0
/* 3E5794 E010C2D4 00000000 */  nop
/* 3E5798 E010C2D8 4600B000 */  add.s     $f0, $f22, $f0
/* 3E579C E010C2DC E600000C */  swc1      $f0, 0xC($s0)
.LE010C2E0:
/* 3E57A0 E010C2E0 8E020000 */  lw        $v0, 0x0($s0)
/* 3E57A4 E010C2E4 30420002 */  andi      $v0, $v0, 0x2
/* 3E57A8 E010C2E8 14400007 */  bnez      $v0, .LE010C308
/* 3E57AC E010C2EC 26520168 */   addiu    $s2, $s2, 0x168
/* 3E57B0 E010C2F0 C6000004 */  lwc1      $f0, 0x4($s0)
/* 3E57B4 E010C2F4 C6020008 */  lwc1      $f2, 0x8($s0)
/* 3E57B8 E010C2F8 C604000C */  lwc1      $f4, 0xC($s0)
/* 3E57BC E010C2FC E6000010 */  swc1      $f0, 0x10($s0)
/* 3E57C0 E010C300 E6020014 */  swc1      $f2, 0x14($s0)
/* 3E57C4 E010C304 E6040018 */  swc1      $f4, 0x18($s0)
.LE010C308:
/* 3E57C8 E010C308 26730001 */  addiu     $s3, $s3, 0x1
/* 3E57CC E010C30C 2A620008 */  slti      $v0, $s3, 0x8
/* 3E57D0 E010C310 1440FFD4 */  bnez      $v0, .LE010C264
/* 3E57D4 E010C314 2694001C */   addiu    $s4, $s4, 0x1C
.LE010C318:
/* 3E57D8 E010C318 8FBF0028 */  lw        $ra, 0x28($sp)
/* 3E57DC E010C31C 8FB50024 */  lw        $s5, 0x24($sp)
/* 3E57E0 E010C320 8FB40020 */  lw        $s4, 0x20($sp)
/* 3E57E4 E010C324 8FB3001C */  lw        $s3, 0x1C($sp)
/* 3E57E8 E010C328 8FB20018 */  lw        $s2, 0x18($sp)
/* 3E57EC E010C32C 8FB10014 */  lw        $s1, 0x14($sp)
/* 3E57F0 E010C330 8FB00010 */  lw        $s0, 0x10($sp)
/* 3E57F4 E010C334 D7BE0058 */  ldc1      $f30, 0x58($sp)
/* 3E57F8 E010C338 D7BC0050 */  ldc1      $f28, 0x50($sp)
/* 3E57FC E010C33C D7BA0048 */  ldc1      $f26, 0x48($sp)
/* 3E5800 E010C340 D7B80040 */  ldc1      $f24, 0x40($sp)
/* 3E5804 E010C344 D7B60038 */  ldc1      $f22, 0x38($sp)
/* 3E5808 E010C348 D7B40030 */  ldc1      $f20, 0x30($sp)
/* 3E580C E010C34C 03E00008 */  jr        $ra
/* 3E5810 E010C350 27BD0060 */   addiu    $sp, $sp, 0x60

### DECOMPILED C INSTRUCTIONS:

void peach_star_beam_update(EffectInstance* effect) {
    PeachStarBeamFXData* data = effect->data.peachStarBeam;
    f32 rotationAngle;
    f32 radius;
    f32 centerX;
    f32 centerY;
    f32 centerZ;
    f32 spiritAngle;
    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;
    }

    data->rotationAngle += data->rotationSpeed;
    rotationAngle = data->rotationAngle;
    radius = data->circleRadius;
    centerX = data->circleCenter.x;
    centerY = data->circleCenter.y;
    centerZ = data->circleCenter.z;

    for (i = 0; i < ARRAY_COUNT(data->spirits); i++) {
        PeachStarBeamSpirit* part = &data->spirits[i];

        if (i == 0) {
            part->pos.x = centerX;
            part->pos.y = centerY + data->twinkYOffset;
            part->pos.z = centerZ;
        } else {
            spiritAngle = rotationAngle + ((-360 + (360 * i)) / 7);
            part->pos.x = centerX + radius * shim_sin_deg(spiritAngle);
            part->pos.y = centerY;
            part->pos.z = centerZ + radius * shim_cos_deg(spiritAngle);
        }
        if (!(part->flags & 2)) {
            part->lockedPos.x = part->pos.x;
            part->lockedPos.y = part->pos.y;
            part->lockedPos.z = part->pos.z;
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_8011B950
/* B2050 8011B950 3084FFFF */  andi      $a0, $a0, 0xFFFF
/* B2054 8011B954 3C0A800A */  lui       $t2, %hi(mdl_currentModelTreeNodeInfo)
/* B2058 8011B958 8D4AA5F4 */  lw        $t2, %lo(mdl_currentModelTreeNodeInfo)($t2)
/* B205C 8011B95C 00041080 */  sll       $v0, $a0, 2
/* B2060 8011B960 004A4021 */  addu      $t0, $v0, $t2
/* B2064 8011B964 91030000 */  lbu       $v1, 0x0($t0)
/* B2068 8011B968 286200FF */  slti      $v0, $v1, 0xFF
/* B206C 8011B96C 10400004 */  beqz      $v0, .L8011B980
/* B2070 8011B970 2409FFFF */   addiu    $t1, $zero, -0x1
/* B2074 8011B974 0060482D */  daddu     $t1, $v1, $zero
/* B2078 8011B978 08046E74 */  j         .L8011B9D0
/* B207C 8011B97C 0120582D */   daddu    $t3, $t1, $zero
.L8011B980:
/* B2080 8011B980 2484FFFF */  addiu     $a0, $a0, -0x1
/* B2084 8011B984 910C0001 */  lbu       $t4, 0x1($t0)
/* B2088 8011B988 04800011 */  bltz      $a0, .L8011B9D0
/* B208C 8011B98C 00041080 */   sll      $v0, $a0, 2
/* B2090 8011B990 240DFFFF */  addiu     $t5, $zero, -0x1
/* B2094 8011B994 004A4021 */  addu      $t0, $v0, $t2
.L8011B998:
/* B2098 8011B998 91020001 */  lbu       $v0, 0x1($t0)
/* B209C 8011B99C 0182102A */  slt       $v0, $t4, $v0
/* B20A0 8011B9A0 1040000C */  beqz      $v0, .L8011B9D4
/* B20A4 8011B9A4 0000502D */   daddu    $t2, $zero, $zero
/* B20A8 8011B9A8 91030000 */  lbu       $v1, 0x0($t0)
/* B20AC 8011B9AC 286200FF */  slti      $v0, $v1, 0xFF
/* B20B0 8011B9B0 50400005 */  beql      $v0, $zero, .L8011B9C8
/* B20B4 8011B9B4 2484FFFF */   addiu    $a0, $a0, -0x1
/* B20B8 8011B9B8 512D0001 */  beql      $t1, $t5, .L8011B9C0
/* B20BC 8011B9BC 0060482D */   daddu    $t1, $v1, $zero
.L8011B9C0:
/* B20C0 8011B9C0 0060582D */  daddu     $t3, $v1, $zero
/* B20C4 8011B9C4 2484FFFF */  addiu     $a0, $a0, -0x1
.L8011B9C8:
/* B20C8 8011B9C8 0481FFF3 */  bgez      $a0, .L8011B998
/* B20CC 8011B9CC 2508FFFC */   addiu    $t0, $t0, -0x4
.L8011B9D0:
/* B20D0 8011B9D0 0000502D */  daddu     $t2, $zero, $zero
.L8011B9D4:
/* B20D4 8011B9D4 04A10003 */  bgez      $a1, .L8011B9E4
/* B20D8 8011B9D8 0140402D */   daddu    $t0, $t2, $zero
/* B20DC 8011B9DC 2408000F */  addiu     $t0, $zero, 0xF
/* B20E0 8011B9E0 0140282D */  daddu     $a1, $t2, $zero
.L8011B9E4:
/* B20E4 8011B9E4 04C10004 */  bgez      $a2, .L8011B9F8
/* B20E8 8011B9E8 00061100 */   sll      $v0, $a2, 4
/* B20EC 8011B9EC 240A00F0 */  addiu     $t2, $zero, 0xF0
/* B20F0 8011B9F0 0000302D */  daddu     $a2, $zero, $zero
/* B20F4 8011B9F4 00061100 */  sll       $v0, $a2, 4
.L8011B9F8:
/* B20F8 8011B9F8 14E00015 */  bnez      $a3, .L8011BA50
/* B20FC 8011B9FC 00A22821 */   addu     $a1, $a1, $v0
/* B2100 8011BA00 0160202D */  daddu     $a0, $t3, $zero
/* B2104 8011BA04 0124102A */  slt       $v0, $t1, $a0
/* B2108 8011BA08 1440000F */  bnez      $v0, .L8011BA48
/* B210C 8011BA0C 010A3021 */   addu     $a2, $t0, $t2
/* B2110 8011BA10 3C078015 */  lui       $a3, %hi(gCurrentModels)
/* B2114 8011BA14 24E712CC */  addiu     $a3, $a3, %lo(gCurrentModels)
.L8011BA18:
/* B2118 8011BA18 8CE30000 */  lw        $v1, 0x0($a3)
/* B211C 8011BA1C 00041080 */  sll       $v0, $a0, 2
/* B2120 8011BA20 00431021 */  addu      $v0, $v0, $v1
/* B2124 8011BA24 8C430000 */  lw        $v1, 0x0($v0)
/* B2128 8011BA28 906200A5 */  lbu       $v0, 0xA5($v1)
/* B212C 8011BA2C 24840001 */  addiu     $a0, $a0, 0x1
/* B2130 8011BA30 00461024 */  and       $v0, $v0, $a2
/* B2134 8011BA34 00451021 */  addu      $v0, $v0, $a1
/* B2138 8011BA38 A06200A5 */  sb        $v0, 0xA5($v1)
/* B213C 8011BA3C 0124102A */  slt       $v0, $t1, $a0
/* B2140 8011BA40 1040FFF5 */  beqz      $v0, .L8011BA18
/* B2144 8011BA44 00000000 */   nop
.L8011BA48:
/* B2148 8011BA48 03E00008 */  jr        $ra
/* B214C 8011BA4C 00000000 */   nop
.L8011BA50:
/* B2150 8011BA50 19600010 */  blez      $t3, .L8011BA94
/* B2154 8011BA54 0000202D */   daddu    $a0, $zero, $zero
/* B2158 8011BA58 3C078015 */  lui       $a3, %hi(gCurrentModels)
/* B215C 8011BA5C 24E712CC */  addiu     $a3, $a3, %lo(gCurrentModels)
/* B2160 8011BA60 010A3021 */  addu      $a2, $t0, $t2
.L8011BA64:
/* B2164 8011BA64 8CE30000 */  lw        $v1, 0x0($a3)
/* B2168 8011BA68 00041080 */  sll       $v0, $a0, 2
/* B216C 8011BA6C 00431021 */  addu      $v0, $v0, $v1
/* B2170 8011BA70 8C430000 */  lw        $v1, 0x0($v0)
/* B2174 8011BA74 906200A5 */  lbu       $v0, 0xA5($v1)
/* B2178 8011BA78 24840001 */  addiu     $a0, $a0, 0x1
/* B217C 8011BA7C 00461024 */  and       $v0, $v0, $a2
/* B2180 8011BA80 00451021 */  addu      $v0, $v0, $a1
/* B2184 8011BA84 A06200A5 */  sb        $v0, 0xA5($v1)
/* B2188 8011BA88 008B102A */  slt       $v0, $a0, $t3
/* B218C 8011BA8C 1440FFF5 */  bnez      $v0, .L8011BA64
/* B2190 8011BA90 00000000 */   nop
.L8011BA94:
/* B2194 8011BA94 25240001 */  addiu     $a0, $t1, 0x1
/* B2198 8011BA98 28820100 */  slti      $v0, $a0, 0x100
/* B219C 8011BA9C 1040FFEA */  beqz      $v0, .L8011BA48
/* B21A0 8011BAA0 010A3021 */   addu     $a2, $t0, $t2
/* B21A4 8011BAA4 3C078015 */  lui       $a3, %hi(gCurrentModels)
/* B21A8 8011BAA8 24E712CC */  addiu     $a3, $a3, %lo(gCurrentModels)
.L8011BAAC:
/* B21AC 8011BAAC 8CE30000 */  lw        $v1, 0x0($a3)
/* B21B0 8011BAB0 00041080 */  sll       $v0, $a0, 2
/* B21B4 8011BAB4 00431021 */  addu      $v0, $v0, $v1
/* B21B8 8011BAB8 8C430000 */  lw        $v1, 0x0($v0)
/* B21BC 8011BABC 10600005 */  beqz      $v1, .L8011BAD4
/* B21C0 8011BAC0 24840001 */   addiu    $a0, $a0, 0x1
/* B21C4 8011BAC4 906200A5 */  lbu       $v0, 0xA5($v1)
/* B21C8 8011BAC8 00461024 */  and       $v0, $v0, $a2
/* B21CC 8011BACC 00451021 */  addu      $v0, $v0, $a1
/* B21D0 8011BAD0 A06200A5 */  sb        $v0, 0xA5($v1)
.L8011BAD4:
/* B21D4 8011BAD4 28820100 */  slti      $v0, $a0, 0x100
/* B21D8 8011BAD8 1440FFF4 */  bnez      $v0, .L8011BAAC
/* B21DC 8011BADC 00000000 */   nop
/* B21E0 8011BAE0 03E00008 */  jr        $ra
/* B21E4 8011BAE4 00000000 */   nop

### DECOMPILED C INSTRUCTIONS:

void func_8011B950(u16 treeIndex, s32 customGfxIndex, s32 fogType, s32 arg3) {
    s32 maxGroupIndex = -1;
    s32 i;
    s32 minGroupIndex;
    s32 modelIndex = (*mdl_currentModelTreeNodeInfo)[treeIndex].modelIndex;
    s32 siblingIndex;
    s32 maskLow, maskHigh, newIndex;

    if (modelIndex < MAX_MODELS - 1) {
        minGroupIndex = maxGroupIndex = modelIndex;
    } else {
        s32 treeDepth = (*mdl_currentModelTreeNodeInfo)[treeIndex].treeDepth;
        for (i = treeIndex - 1; i >= 0; i--) {
            if ((*mdl_currentModelTreeNodeInfo)[i].treeDepth <= treeDepth) {
                break;
            }

            siblingIndex = (*mdl_currentModelTreeNodeInfo)[i].modelIndex;

            if (siblingIndex < MAX_MODELS - 1) {
                if (maxGroupIndex == -1) {
                    maxGroupIndex = siblingIndex;
                }
                minGroupIndex = siblingIndex;
            }
        }
    }

    maskLow = maskHigh = 0;

    if (customGfxIndex < 0) {
        maskLow = 0xF;
        customGfxIndex = 0;
    }

    if (fogType < 0) {
        maskHigh = 0xF0;
        fogType = 0;
    }

    newIndex = customGfxIndex + (fogType << 4);

    if (arg3 == 0) {
        for (i = minGroupIndex; i <= maxGroupIndex; i++) {
            Model* model = (*gCurrentModels)[i];
            model->customGfxIndex = (model->customGfxIndex & (maskLow + maskHigh)) + newIndex;
        }
    } else {
        for (i = 0; i < minGroupIndex; i++) {
            Model* model = (*gCurrentModels)[i];
            model->customGfxIndex = (model->customGfxIndex & (maskLow + maskHigh)) + newIndex;
        }
        for (i = maxGroupIndex + 1; i < MAX_MODELS; i++) {
            Model* model = (*gCurrentModels)[i];
            if (model != NULL) {
                model->customGfxIndex = (model->customGfxIndex & (maskLow + maskHigh)) + newIndex;
            }
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel get_screen_coords
/* 9938 8002E538 27BDFFB0 */  addiu     $sp, $sp, -0x50
/* 993C 8002E53C AFB20040 */  sw        $s2, 0x40($sp)
/* 9940 8002E540 8FB20060 */  lw        $s2, 0x60($sp)
/* 9944 8002E544 AFB30044 */  sw        $s3, 0x44($sp)
/* 9948 8002E548 8FB30064 */  lw        $s3, 0x64($sp)
/* 994C 8002E54C AFB1003C */  sw        $s1, 0x3C($sp)
/* 9950 8002E550 8FB10068 */  lw        $s1, 0x68($sp)
/* 9954 8002E554 27A20028 */  addiu     $v0, $sp, 0x28
/* 9958 8002E558 AFA20014 */  sw        $v0, 0x14($sp)
/* 995C 8002E55C 27A2002C */  addiu     $v0, $sp, 0x2C
/* 9960 8002E560 AFA20018 */  sw        $v0, 0x18($sp)
/* 9964 8002E564 27A20030 */  addiu     $v0, $sp, 0x30
/* 9968 8002E568 AFA2001C */  sw        $v0, 0x1C($sp)
/* 996C 8002E56C 27A20034 */  addiu     $v0, $sp, 0x34
/* 9970 8002E570 3C08800B */  lui       $t0, %hi(gCameras)
/* 9974 8002E574 25081D80 */  addiu     $t0, $t0, %lo(gCameras)
/* 9978 8002E578 AFA20020 */  sw        $v0, 0x20($sp)
/* 997C 8002E57C 00041080 */  sll       $v0, $a0, 2
/* 9980 8002E580 00441021 */  addu      $v0, $v0, $a0
/* 9984 8002E584 00021080 */  sll       $v0, $v0, 2
/* 9988 8002E588 00441023 */  subu      $v0, $v0, $a0
/* 998C 8002E58C 000218C0 */  sll       $v1, $v0, 3
/* 9990 8002E590 00431021 */  addu      $v0, $v0, $v1
/* 9994 8002E594 000210C0 */  sll       $v0, $v0, 3
/* 9998 8002E598 AFB00038 */  sw        $s0, 0x38($sp)
/* 999C 8002E59C 00488021 */  addu      $s0, $v0, $t0
/* 99A0 8002E5A0 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 99A4 8002E5A4 44810000 */  mtc1      $at, $f0
/* 99A8 8002E5A8 260400D4 */  addiu     $a0, $s0, 0xD4
/* 99AC 8002E5AC AFBF0048 */  sw        $ra, 0x48($sp)
/* 99B0 8002E5B0 0C00A588 */  jal       transform_point
/* 99B4 8002E5B4 E7A00010 */   swc1     $f0, 0x10($sp)
/* 99B8 8002E5B8 C7A00030 */  lwc1      $f0, 0x30($sp)
/* 99BC 8002E5BC 3C01459C */  lui       $at, (0x459C4000 >> 16)
/* 99C0 8002E5C0 34214000 */  ori       $at, $at, (0x459C4000 & 0xFFFF)
/* 99C4 8002E5C4 44811000 */  mtc1      $at, $f2
/* 99C8 8002E5C8 00000000 */  nop
/* 99CC 8002E5CC 46020000 */  add.s     $f0, $f0, $f2
/* 99D0 8002E5D0 4600020D */  trunc.w.s $f8, $f0
/* 99D4 8002E5D4 44024000 */  mfc1      $v0, $f8
/* 99D8 8002E5D8 00000000 */  nop
/* 99DC 8002E5DC 04410003 */  bgez      $v0, .L8002E5EC
/* 99E0 8002E5E0 AE220000 */   sw       $v0, 0x0($s1)
/* 99E4 8002E5E4 0800B97F */  j         .L8002E5FC
/* 99E8 8002E5E8 AE200000 */   sw       $zero, 0x0($s1)
.L8002E5EC:
/* 99EC 8002E5EC 28422711 */  slti      $v0, $v0, 0x2711
/* 99F0 8002E5F0 14400002 */  bnez      $v0, .L8002E5FC
/* 99F4 8002E5F4 24022710 */   addiu    $v0, $zero, 0x2710
/* 99F8 8002E5F8 AE220000 */  sw        $v0, 0x0($s1)
.L8002E5FC:
/* 99FC 8002E5FC C7A20034 */  lwc1      $f2, 0x34($sp)
/* 9A00 8002E600 3C01800A */  lui       $at, %hi(D_80098200)
/* 9A04 8002E604 D4208200 */  ldc1      $f0, %lo(D_80098200)($at)
/* 9A08 8002E608 460010A1 */  cvt.d.s   $f2, $f2
/* 9A0C 8002E60C 4620103C */  c.lt.d    $f2, $f0
/* 9A10 8002E610 00000000 */  nop
/* 9A14 8002E614 4500000B */  bc1f      .L8002E644
/* 9A18 8002E618 00000000 */   nop
/* 9A1C 8002E61C 3C01800A */  lui       $at, %hi(D_80098208)
/* 9A20 8002E620 D4208208 */  ldc1      $f0, %lo(D_80098208)($at)
/* 9A24 8002E624 4622003C */  c.lt.d    $f0, $f2
/* 9A28 8002E628 00000000 */  nop
/* 9A2C 8002E62C 45000005 */  bc1f      .L8002E644
/* 9A30 8002E630 00000000 */   nop
/* 9A34 8002E634 AE400000 */  sw        $zero, 0x0($s2)
/* 9A38 8002E638 AE600000 */  sw        $zero, 0x0($s3)
/* 9A3C 8002E63C 0800B9CE */  j         .L8002E738
/* 9A40 8002E640 AE200000 */   sw       $zero, 0x0($s1)
.L8002E644:
/* 9A44 8002E644 C7A00034 */  lwc1      $f0, 0x34($sp)
/* 9A48 8002E648 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 9A4C 8002E64C 44812000 */  mtc1      $at, $f4
/* 9A50 8002E650 C7A20028 */  lwc1      $f2, 0x28($sp)
/* 9A54 8002E654 9603000A */  lhu       $v1, 0xA($s0)
/* 9A58 8002E658 46002103 */  div.s     $f4, $f4, $f0
/* 9A5C 8002E65C 46041082 */  mul.s     $f2, $f2, $f4
/* 9A60 8002E660 00000000 */  nop
/* 9A64 8002E664 00031C00 */  sll       $v1, $v1, 16
/* 9A68 8002E668 00031403 */  sra       $v0, $v1, 16
/* 9A6C 8002E66C 44820000 */  mtc1      $v0, $f0
/* 9A70 8002E670 00000000 */  nop
/* 9A74 8002E674 46800020 */  cvt.s.w   $f0, $f0
/* 9A78 8002E678 46001082 */  mul.s     $f2, $f2, $f0
/* 9A7C 8002E67C 00000000 */  nop
/* 9A80 8002E680 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* 9A84 8002E684 44813000 */  mtc1      $at, $f6
/* 9A88 8002E688 00000000 */  nop
/* 9A8C 8002E68C 46061082 */  mul.s     $f2, $f2, $f6
/* 9A90 8002E690 00000000 */  nop
/* 9A94 8002E694 00031FC2 */  srl       $v1, $v1, 31
/* 9A98 8002E698 00431021 */  addu      $v0, $v0, $v1
/* 9A9C 8002E69C 00021043 */  sra       $v0, $v0, 1
/* 9AA0 8002E6A0 44820000 */  mtc1      $v0, $f0
/* 9AA4 8002E6A4 00000000 */  nop
/* 9AA8 8002E6A8 46800020 */  cvt.s.w   $f0, $f0
/* 9AAC 8002E6AC 46020000 */  add.s     $f0, $f0, $f2
/* 9AB0 8002E6B0 E7A40034 */  swc1      $f4, 0x34($sp)
/* 9AB4 8002E6B4 8603000E */  lh        $v1, 0xE($s0)
/* 9AB8 8002E6B8 4600020D */  trunc.w.s $f8, $f0
/* 9ABC 8002E6BC 44024000 */  mfc1      $v0, $f8
/* 9AC0 8002E6C0 00000000 */  nop
/* 9AC4 8002E6C4 00431021 */  addu      $v0, $v0, $v1
/* 9AC8 8002E6C8 AE420000 */  sw        $v0, 0x0($s2)
/* 9ACC 8002E6CC C7A2002C */  lwc1      $f2, 0x2C($sp)
/* 9AD0 8002E6D0 C7A00034 */  lwc1      $f0, 0x34($sp)
/* 9AD4 8002E6D4 9603000C */  lhu       $v1, 0xC($s0)
/* 9AD8 8002E6D8 46001082 */  mul.s     $f2, $f2, $f0
/* 9ADC 8002E6DC 00000000 */  nop
/* 9AE0 8002E6E0 00031C00 */  sll       $v1, $v1, 16
/* 9AE4 8002E6E4 00031403 */  sra       $v0, $v1, 16
/* 9AE8 8002E6E8 44820000 */  mtc1      $v0, $f0
/* 9AEC 8002E6EC 00000000 */  nop
/* 9AF0 8002E6F0 46800020 */  cvt.s.w   $f0, $f0
/* 9AF4 8002E6F4 46001082 */  mul.s     $f2, $f2, $f0
/* 9AF8 8002E6F8 00000000 */  nop
/* 9AFC 8002E6FC 46061082 */  mul.s     $f2, $f2, $f6
/* 9B00 8002E700 00000000 */  nop
/* 9B04 8002E704 00031FC2 */  srl       $v1, $v1, 31
/* 9B08 8002E708 00431021 */  addu      $v0, $v0, $v1
/* 9B0C 8002E70C 00021043 */  sra       $v0, $v0, 1
/* 9B10 8002E710 44820000 */  mtc1      $v0, $f0
/* 9B14 8002E714 00000000 */  nop
/* 9B18 8002E718 46800020 */  cvt.s.w   $f0, $f0
/* 9B1C 8002E71C 46020001 */  sub.s     $f0, $f0, $f2
/* 9B20 8002E720 86030010 */  lh        $v1, 0x10($s0)
/* 9B24 8002E724 4600020D */  trunc.w.s $f8, $f0
/* 9B28 8002E728 44024000 */  mfc1      $v0, $f8
/* 9B2C 8002E72C 00000000 */  nop
/* 9B30 8002E730 00431021 */  addu      $v0, $v0, $v1
/* 9B34 8002E734 AE620000 */  sw        $v0, 0x0($s3)
.L8002E738:
/* 9B38 8002E738 8FBF0048 */  lw        $ra, 0x48($sp)
/* 9B3C 8002E73C 8FB30044 */  lw        $s3, 0x44($sp)
/* 9B40 8002E740 8FB20040 */  lw        $s2, 0x40($sp)
/* 9B44 8002E744 8FB1003C */  lw        $s1, 0x3C($sp)
/* 9B48 8002E748 8FB00038 */  lw        $s0, 0x38($sp)
/* 9B4C 8002E74C 03E00008 */  jr        $ra
/* 9B50 8002E750 27BD0050 */   addiu    $sp, $sp, 0x50

### DECOMPILED C INSTRUCTIONS:

void get_screen_coords(s32 camID, f32 x, f32 y, f32 z, s32* screenX, s32* screenY, s32* screenZ) {
    Camera* camera = &gCameras[camID];
    f32 tW;
    f32 tZ;
    f32 tY;
    f32 tX;

    transform_point(camera->perspectiveMatrix, x, y, z, 1.0f, &tX, &tY, &tZ, &tW);

    *screenZ = tZ + 5000.0f;
    if (*screenZ < 0) {
        *screenZ = 0;
    } else if (*screenZ > 10000) {
        *screenZ = 10000;
    }

    if (tW < 0.01 && tW > -0.01) {
        *screenX = 0;
        *screenY = 0;
        *screenZ = 0;
    } else {
        tW = 1.0f / tW;
        *screenX = (s32) ((camera->viewportW / 2) + (tX * tW * camera->viewportW * 0.5f)) + camera->viewportStartX;
        *screenY = (s32) ((camera->viewportH / 2) - (tY * tW * camera->viewportH * 0.5f)) + camera->viewportStartY;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel sweat_main
/* 35BFD0 E0050000 27BDFF58 */  addiu     $sp, $sp, -0xA8
/* 35BFD4 E0050004 F7B80090 */  sdc1      $f24, 0x90($sp)
/* 35BFD8 E0050008 4485C000 */  mtc1      $a1, $f24
/* 35BFDC E005000C F7BA0098 */  sdc1      $f26, 0x98($sp)
/* 35BFE0 E0050010 4486D000 */  mtc1      $a2, $f26
/* 35BFE4 E0050014 AFB20078 */  sw        $s2, 0x78($sp)
/* 35BFE8 E0050018 0080902D */  daddu     $s2, $a0, $zero
/* 35BFEC E005001C F7BC00A0 */  sdc1      $f28, 0xA0($sp)
/* 35BFF0 E0050020 4487E000 */  mtc1      $a3, $f28
/* 35BFF4 E0050024 27A40018 */  addiu     $a0, $sp, 0x18
/* 35BFF8 E0050028 F7B60088 */  sdc1      $f22, 0x88($sp)
/* 35BFFC E005002C C7B600BC */  lwc1      $f22, 0xBC($sp)
/* 35C000 E0050030 3C02E005 */  lui       $v0, %hi(sweat_init)
/* 35C004 E0050034 244201D0 */  addiu     $v0, $v0, %lo(sweat_init)
/* 35C008 E0050038 AFA20020 */  sw        $v0, 0x20($sp)
/* 35C00C E005003C 3C02E005 */  lui       $v0, %hi(sweat_update)
/* 35C010 E0050040 244201D8 */  addiu     $v0, $v0, %lo(sweat_update)
/* 35C014 E0050044 AFA20024 */  sw        $v0, 0x24($sp)
/* 35C018 E0050048 3C02E005 */  lui       $v0, %hi(sweat_render)
/* 35C01C E005004C 244202C4 */  addiu     $v0, $v0, %lo(sweat_render)
/* 35C020 E0050050 AFA20028 */  sw        $v0, 0x28($sp)
/* 35C024 E0050054 24020028 */  addiu     $v0, $zero, 0x28
/* 35C028 E0050058 AFBF007C */  sw        $ra, 0x7C($sp)
/* 35C02C E005005C AFB10074 */  sw        $s1, 0x74($sp)
/* 35C030 E0050060 AFB00070 */  sw        $s0, 0x70($sp)
/* 35C034 E0050064 F7B40080 */  sdc1      $f20, 0x80($sp)
/* 35C038 E0050068 AFA00018 */  sw        $zero, 0x18($sp)
/* 35C03C E005006C AFA0002C */  sw        $zero, 0x2C($sp)
/* 35C040 E0050070 0C080124 */  jal       shim_create_effect_instance
/* 35C044 E0050074 AFA2001C */   sw       $v0, 0x1C($sp)
/* 35C048 E0050078 24040028 */  addiu     $a0, $zero, 0x28
/* 35C04C E005007C 24030001 */  addiu     $v1, $zero, 0x1
/* 35C050 E0050080 0040802D */  daddu     $s0, $v0, $zero
/* 35C054 E0050084 0C08012C */  jal       shim_general_heap_malloc
/* 35C058 E0050088 AE030008 */   sw       $v1, 0x8($s0)
/* 35C05C E005008C 0040882D */  daddu     $s1, $v0, $zero
/* 35C060 E0050090 16200003 */  bnez      $s1, .LE00500A0
/* 35C064 E0050094 AE02000C */   sw       $v0, 0xC($s0)
.LE0050098:
/* 35C068 E0050098 08014026 */  j         .LE0050098
/* 35C06C E005009C 00000000 */   nop
.LE00500A0:
/* 35C070 E00500A0 3C108007 */  lui       $s0, %hi(gCurrentCameraID)
/* 35C074 E00500A4 26107410 */  addiu     $s0, $s0, %lo(gCurrentCameraID)
/* 35C078 E00500A8 8E030000 */  lw        $v1, 0x0($s0)
/* 35C07C E00500AC AE320000 */  sw        $s2, 0x0($s1)
/* 35C080 E00500B0 00031080 */  sll       $v0, $v1, 2
/* 35C084 E00500B4 00431021 */  addu      $v0, $v0, $v1
/* 35C088 E00500B8 00021080 */  sll       $v0, $v0, 2
/* 35C08C E00500BC 00431023 */  subu      $v0, $v0, $v1
/* 35C090 E00500C0 000218C0 */  sll       $v1, $v0, 3
/* 35C094 E00500C4 00431021 */  addu      $v0, $v0, $v1
/* 35C098 E00500C8 000210C0 */  sll       $v0, $v0, 3
/* 35C09C E00500CC 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 35C0A0 E00500D0 00220821 */  addu      $at, $at, $v0
/* 35C0A4 E00500D4 C42C1DEC */  lwc1      $f12, %lo(gCameras + 0x6C)($at)
/* 35C0A8 E00500D8 0C080140 */  jal       shim_sin_deg
/* 35C0AC E00500DC 00000000 */   nop
/* 35C0B0 E00500E0 8E030000 */  lw        $v1, 0x0($s0)
/* 35C0B4 E00500E4 00031080 */  sll       $v0, $v1, 2
/* 35C0B8 E00500E8 00431021 */  addu      $v0, $v0, $v1
/* 35C0BC E00500EC 00021080 */  sll       $v0, $v0, 2
/* 35C0C0 E00500F0 00431023 */  subu      $v0, $v0, $v1
/* 35C0C4 E00500F4 000218C0 */  sll       $v1, $v0, 3
/* 35C0C8 E00500F8 00431021 */  addu      $v0, $v0, $v1
/* 35C0CC E00500FC 000210C0 */  sll       $v0, $v0, 3
/* 35C0D0 E0050100 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 35C0D4 E0050104 00220821 */  addu      $at, $at, $v0
/* 35C0D8 E0050108 C42C1DEC */  lwc1      $f12, %lo(gCameras + 0x6C)($at)
/* 35C0DC E005010C 0C080144 */  jal       shim_cos_deg
/* 35C0E0 E0050110 46000506 */   mov.s    $f20, $f0
/* 35C0E4 E0050114 27A40030 */  addiu     $a0, $sp, 0x30
/* 35C0E8 E0050118 0000382D */  daddu     $a3, $zero, $zero
/* 35C0EC E005011C 4600B107 */  neg.s     $f4, $f22
/* 35C0F0 E0050120 4406A000 */  mfc1      $a2, $f20
/* 35C0F4 E0050124 44052000 */  mfc1      $a1, $f4
/* 35C0F8 E0050128 46000007 */  neg.s     $f0, $f0
/* 35C0FC E005012C 0C080104 */  jal       shim_guRotateF
/* 35C100 E0050130 E7A00010 */   swc1     $f0, 0x10($sp)
/* 35C104 E0050134 3C014180 */  lui       $at, (0x41800000 >> 16)
/* 35C108 E0050138 44810000 */  mtc1      $at, $f0
/* 35C10C E005013C C7A200B8 */  lwc1      $f2, 0xB8($sp)
/* 35C110 E0050140 46001080 */  add.s     $f2, $f2, $f0
/* 35C114 E0050144 C7A00040 */  lwc1      $f0, 0x40($sp)
/* 35C118 E0050148 46020002 */  mul.s     $f0, $f0, $f2
/* 35C11C E005014C 00000000 */  nop
/* 35C120 E0050150 4600C000 */  add.s     $f0, $f24, $f0
/* 35C124 E0050154 E6200004 */  swc1      $f0, 0x4($s1)
/* 35C128 E0050158 C7A00044 */  lwc1      $f0, 0x44($sp)
/* 35C12C E005015C 46020002 */  mul.s     $f0, $f0, $f2
/* 35C130 E0050160 00000000 */  nop
/* 35C134 E0050164 4600D000 */  add.s     $f0, $f26, $f0
/* 35C138 E0050168 E6200008 */  swc1      $f0, 0x8($s1)
/* 35C13C E005016C C7A00048 */  lwc1      $f0, 0x48($sp)
/* 35C140 E0050170 46020002 */  mul.s     $f0, $f0, $f2
/* 35C144 E0050174 00000000 */  nop
/* 35C148 E0050178 4600E000 */  add.s     $f0, $f28, $f0
/* 35C14C E005017C E620000C */  swc1      $f0, 0xC($s1)
/* 35C150 E0050180 C7A00040 */  lwc1      $f0, 0x40($sp)
/* 35C154 E0050184 E6200018 */  swc1      $f0, 0x18($s1)
/* 35C158 E0050188 C7A00044 */  lwc1      $f0, 0x44($sp)
/* 35C15C E005018C E620001C */  swc1      $f0, 0x1C($s1)
/* 35C160 E0050190 C7A00048 */  lwc1      $f0, 0x48($sp)
/* 35C164 E0050194 E6360010 */  swc1      $f22, 0x10($s1)
/* 35C168 E0050198 8FA200C0 */  lw        $v0, 0xC0($sp)
/* 35C16C E005019C AE220024 */  sw        $v0, 0x24($s1)
/* 35C170 E00501A0 E6200020 */  swc1      $f0, 0x20($s1)
/* 35C174 E00501A4 8FBF007C */  lw        $ra, 0x7C($sp)
/* 35C178 E00501A8 8FB20078 */  lw        $s2, 0x78($sp)
/* 35C17C E00501AC 8FB10074 */  lw        $s1, 0x74($sp)
/* 35C180 E00501B0 8FB00070 */  lw        $s0, 0x70($sp)
/* 35C184 E00501B4 D7BC00A0 */  ldc1      $f28, 0xA0($sp)
/* 35C188 E00501B8 D7BA0098 */  ldc1      $f26, 0x98($sp)
/* 35C18C E00501BC D7B80090 */  ldc1      $f24, 0x90($sp)
/* 35C190 E00501C0 D7B60088 */  ldc1      $f22, 0x88($sp)
/* 35C194 E00501C4 D7B40080 */  ldc1      $f20, 0x80($sp)
/* 35C198 E00501C8 03E00008 */  jr        $ra
/* 35C19C E00501CC 27BD00A8 */   addiu    $sp, $sp, 0xA8

### DECOMPILED C INSTRUCTIONS:

void sweat_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, s32 timeLeft) {
    EffectBlueprint effectBp;
    EffectInstance* effect;
    SweatFXData* data;
    Matrix4f matrix;
    f32 temp_f2;
    s32 numParts = 1;

    effectBp.init = (void*)sweat_init;
    effectBp.update = sweat_update;
    effectBp.renderWorld = sweat_render;
    effectBp.unk_00 = 0;
    effectBp.renderUI = NULL;
    effectBp.effectID = EFFECT_SWEAT;

    effect = shim_create_effect_instance(&effectBp);
    effect->numParts = numParts;

    data = effect->data.sweat = shim_general_heap_malloc(numParts * sizeof(*data));
    ASSERT(data != NULL);

    data->unk_00 = arg0;
    shim_guRotateF(matrix, -arg5, shim_sin_deg(gCameras[gCurrentCameraID].currentYaw), 0.0f, -shim_cos_deg(gCameras[gCurrentCameraID].currentYaw));
    temp_f2 = arg4 + 16.0f;
    data->pos.x = arg1 + (matrix[1][0] * temp_f2);
    data->pos.y = arg2 + (matrix[1][1] * temp_f2);
    data->pos.z = arg3 + (matrix[1][2] * temp_f2);
    data->unk_18 = matrix[1][0];
    data->unk_1C = matrix[1][1];
    data->unk_20 = matrix[1][2];
    data->unk_10 = arg5;
    data->timeLeft = timeLeft;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel imgfx_mesh_make_grid
/* D2748 8013C048 0080582D */  daddu     $t3, $a0, $zero
/* D274C 8013C04C 3C098015 */  lui       $t1, %hi(imgfx_vtxCount)
/* D2750 8013C050 2529EE14 */  addiu     $t1, $t1, %lo(imgfx_vtxCount)
/* D2754 8013C054 0000402D */  daddu     $t0, $zero, $zero
/* D2758 8013C058 91660004 */  lbu       $a2, 0x4($t3)
/* D275C 8013C05C 44804000 */  mtc1      $zero, $f8
/* D2760 8013C060 95220000 */  lhu       $v0, 0x0($t1)
/* D2764 8013C064 3C038015 */  lui       $v1, %hi(imgfx_vtxBuf)
/* D2768 8013C068 8C636950 */  lw        $v1, %lo(imgfx_vtxBuf)($v1)
/* D276C 8013C06C 3C0A8015 */  lui       $t2, %hi(ImgFXCurrentTexturePtr)
/* D2770 8013C070 254AEE10 */  addiu     $t2, $t2, %lo(ImgFXCurrentTexturePtr)
/* D2774 8013C074 A5620008 */  sh        $v0, 0x8($t3)
/* D2778 8013C078 95220000 */  lhu       $v0, 0x0($t1)
/* D277C 8013C07C 8D450000 */  lw        $a1, 0x0($t2)
/* D2780 8013C080 00021100 */  sll       $v0, $v0, 4
/* D2784 8013C084 00623821 */  addu      $a3, $v1, $v0
/* D2788 8013C088 84A4000E */  lh        $a0, 0xE($a1)
/* D278C 8013C08C 94A20008 */  lhu       $v0, 0x8($a1)
/* D2790 8013C090 91630003 */  lbu       $v1, 0x3($t3)
/* D2794 8013C094 44843000 */  mtc1      $a0, $f6
/* D2798 8013C098 00000000 */  nop
/* D279C 8013C09C 468031A0 */  cvt.s.w   $f6, $f6
/* D27A0 8013C0A0 44821000 */  mtc1      $v0, $f2
/* D27A4 8013C0A4 00000000 */  nop
/* D27A8 8013C0A8 468010A0 */  cvt.s.w   $f2, $f2
/* D27AC 8013C0AC 44830000 */  mtc1      $v1, $f0
/* D27B0 8013C0B0 00000000 */  nop
/* D27B4 8013C0B4 46800020 */  cvt.s.w   $f0, $f0
/* D27B8 8013C0B8 46001283 */  div.s     $f10, $f2, $f0
/* D27BC 8013C0BC 94A2000A */  lhu       $v0, 0xA($a1)
/* D27C0 8013C0C0 44860000 */  mtc1      $a2, $f0
/* D27C4 8013C0C4 00000000 */  nop
/* D27C8 8013C0C8 46800020 */  cvt.s.w   $f0, $f0
/* D27CC 8013C0CC 44821000 */  mtc1      $v0, $f2
/* D27D0 8013C0D0 00000000 */  nop
/* D27D4 8013C0D4 468010A0 */  cvt.s.w   $f2, $f2
/* D27D8 8013C0D8 00C8102A */  slt       $v0, $a2, $t0
/* D27DC 8013C0DC 1440004B */  bnez      $v0, .L8013C20C
/* D27E0 8013C0E0 46001083 */   div.s    $f2, $f2, $f0
/* D27E4 8013C0E4 0140282D */  daddu     $a1, $t2, $zero
/* D27E8 8013C0E8 0120602D */  daddu     $t4, $t1, $zero
.L8013C0EC:
/* D27EC 8013C0EC 1506000B */  bne       $t0, $a2, .L8013C11C
/* D27F0 8013C0F0 0000302D */   daddu    $a2, $zero, $zero
/* D27F4 8013C0F4 8CA20000 */  lw        $v0, 0x0($a1)
/* D27F8 8013C0F8 9443000A */  lhu       $v1, 0xA($v0)
/* D27FC 8013C0FC 8442000E */  lh        $v0, 0xE($v0)
/* D2800 8013C100 44834000 */  mtc1      $v1, $f8
/* D2804 8013C104 00000000 */  nop
/* D2808 8013C108 46804220 */  cvt.s.w   $f8, $f8
/* D280C 8013C10C 00431023 */  subu      $v0, $v0, $v1
/* D2810 8013C110 44823000 */  mtc1      $v0, $f6
/* D2814 8013C114 00000000 */  nop
/* D2818 8013C118 468031A0 */  cvt.s.w   $f6, $f6
.L8013C11C:
/* D281C 8013C11C 8CA20000 */  lw        $v0, 0x0($a1)
/* D2820 8013C120 44802000 */  mtc1      $zero, $f4
/* D2824 8013C124 8442000C */  lh        $v0, 0xC($v0)
/* D2828 8013C128 91630003 */  lbu       $v1, 0x3($t3)
/* D282C 8013C12C 44820000 */  mtc1      $v0, $f0
/* D2830 8013C130 00000000 */  nop
/* D2834 8013C134 46800020 */  cvt.s.w   $f0, $f0
/* D2838 8013C138 0066102A */  slt       $v0, $v1, $a2
/* D283C 8013C13C 5440002E */  bnel      $v0, $zero, .L8013C1F8
/* D2840 8013C140 46023181 */   sub.s    $f6, $f6, $f2
/* D2844 8013C144 4600330D */  trunc.w.s $f12, $f6
/* D2848 8013C148 440A6000 */  mfc1      $t2, $f12
/* D284C 8013C14C 4600430D */  trunc.w.s $f12, $f8
/* D2850 8013C150 44026000 */  mfc1      $v0, $f12
/* D2854 8013C154 00000000 */  nop
/* D2858 8013C158 24420100 */  addiu     $v0, $v0, 0x100
/* D285C 8013C15C 00024940 */  sll       $t1, $v0, 5
/* D2860 8013C160 24E4000A */  addiu     $a0, $a3, 0xA
.L8013C164:
/* D2864 8013C164 14C3000B */  bne       $a2, $v1, .L8013C194
/* D2868 8013C168 00000000 */   nop
/* D286C 8013C16C 8CA20000 */  lw        $v0, 0x0($a1)
/* D2870 8013C170 94430008 */  lhu       $v1, 0x8($v0)
/* D2874 8013C174 8442000C */  lh        $v0, 0xC($v0)
/* D2878 8013C178 44832000 */  mtc1      $v1, $f4
/* D287C 8013C17C 00000000 */  nop
/* D2880 8013C180 46802120 */  cvt.s.w   $f4, $f4
/* D2884 8013C184 00431021 */  addu      $v0, $v0, $v1
/* D2888 8013C188 44820000 */  mtc1      $v0, $f0
/* D288C 8013C18C 00000000 */  nop
/* D2890 8013C190 46800020 */  cvt.s.w   $f0, $f0
.L8013C194:
/* D2894 8013C194 4600030D */  trunc.w.s $f12, $f0
/* D2898 8013C198 44026000 */  mfc1      $v0, $f12
/* D289C 8013C19C 00000000 */  nop
/* D28A0 8013C1A0 A4E20000 */  sh        $v0, 0x0($a3)
/* D28A4 8013C1A4 4600230D */  trunc.w.s $f12, $f4
/* D28A8 8013C1A8 44026000 */  mfc1      $v0, $f12
/* D28AC 8013C1AC 00000000 */  nop
/* D28B0 8013C1B0 24420100 */  addiu     $v0, $v0, 0x100
/* D28B4 8013C1B4 00021140 */  sll       $v0, $v0, 5
/* D28B8 8013C1B8 A48AFFF8 */  sh        $t2, -0x8($a0)
/* D28BC 8013C1BC A480FFFA */  sh        $zero, -0x6($a0)
/* D28C0 8013C1C0 A482FFFE */  sh        $v0, -0x2($a0)
/* D28C4 8013C1C4 A4890000 */  sh        $t1, 0x0($a0)
/* D28C8 8013C1C8 24840010 */  addiu     $a0, $a0, 0x10
/* D28CC 8013C1CC 24E70010 */  addiu     $a3, $a3, 0x10
/* D28D0 8013C1D0 24C60001 */  addiu     $a2, $a2, 0x1
/* D28D4 8013C1D4 95820000 */  lhu       $v0, 0x0($t4)
/* D28D8 8013C1D8 460A0000 */  add.s     $f0, $f0, $f10
/* D28DC 8013C1DC 24420001 */  addiu     $v0, $v0, 0x1
/* D28E0 8013C1E0 A5820000 */  sh        $v0, 0x0($t4)
/* D28E4 8013C1E4 91630003 */  lbu       $v1, 0x3($t3)
/* D28E8 8013C1E8 0066102A */  slt       $v0, $v1, $a2
/* D28EC 8013C1EC 1040FFDD */  beqz      $v0, .L8013C164
/* D28F0 8013C1F0 460A2100 */   add.s    $f4, $f4, $f10
/* D28F4 8013C1F4 46023181 */  sub.s     $f6, $f6, $f2
.L8013C1F8:
/* D28F8 8013C1F8 25080001 */  addiu     $t0, $t0, 0x1
/* D28FC 8013C1FC 91660004 */  lbu       $a2, 0x4($t3)
/* D2900 8013C200 00C8102A */  slt       $v0, $a2, $t0
/* D2904 8013C204 1040FFB9 */  beqz      $v0, .L8013C0EC
/* D2908 8013C208 46024200 */   add.s    $f8, $f8, $f2
.L8013C20C:
/* D290C 8013C20C 3C028015 */  lui       $v0, %hi(imgfx_vtxCount)
/* D2910 8013C210 9442EE14 */  lhu       $v0, %lo(imgfx_vtxCount)($v0)
/* D2914 8013C214 2442FFFF */  addiu     $v0, $v0, -0x1
/* D2918 8013C218 03E00008 */  jr        $ra
/* D291C 8013C21C A562000A */   sh       $v0, 0xA($t3)

### DECOMPILED C INSTRUCTIONS:

void imgfx_mesh_make_grid(ImgFXState* state) {
    f32 divSizeX;
    f32 divSizeY;
    f32 posX;
    f32 posY;
    f32 texU;
    f32 texV;
    Vtx* vtx;
    s32 i;

    state->firstVtxIdx = imgfx_vtxCount;
    divSizeX = ImgFXCurrentTexturePtr->tex.width / (f32) state->subdivX;
    divSizeY = ImgFXCurrentTexturePtr->tex.height / (f32) state->subdivY;
    posY = ImgFXCurrentTexturePtr->tex.yOffset;
    texV = 0.0f;
    vtx = &imgfx_vtxBuf[imgfx_vtxCount];

    for (i = 0; i <= state->subdivY; i++) {
        s32 j;

        if (i == state->subdivY) {
            texV = ImgFXCurrentTexturePtr->tex.height;
            posY = ImgFXCurrentTexturePtr->tex.yOffset - ImgFXCurrentTexturePtr->tex.height;
        }

        posX = ImgFXCurrentTexturePtr->tex.xOffset;
        texU = 0.0f;
        for (j = 0; j <= state->subdivX; vtx++, j++) {
            if (j == state->subdivX) {
                texU = ImgFXCurrentTexturePtr->tex.width;
                posX = ImgFXCurrentTexturePtr->tex.xOffset + ImgFXCurrentTexturePtr->tex.width;
            }
            vtx->n.ob[0] = posX;
            vtx->n.ob[1] = posY;
            vtx->n.ob[2] = 0;
            vtx->n.tc[0] = ((s32) texU + 256) * 32;
            vtx->n.tc[1] = ((s32) texV + 256) * 32;
            imgfx_vtxCount++;
            posX += divSizeX;
            texU += divSizeX;
        }
        posY -= divSizeY;
        texV += divSizeY;
    }
    state->lastVtxIdx = imgfx_vtxCount - 1;
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_8025950C
/* 187DEC 8025950C 27BDFFD0 */  addiu     $sp, $sp, -0x30
/* 187DF0 80259510 AFB1001C */  sw        $s1, 0x1C($sp)
/* 187DF4 80259514 0080882D */  daddu     $s1, $a0, $zero
/* 187DF8 80259518 AFB20020 */  sw        $s2, 0x20($sp)
/* 187DFC 8025951C 00A0902D */  daddu     $s2, $a1, $zero
/* 187E00 80259520 AFB30024 */  sw        $s3, 0x24($sp)
/* 187E04 80259524 00C0982D */  daddu     $s3, $a2, $zero
/* 187E08 80259528 240600FF */  addiu     $a2, $zero, 0xFF
/* 187E0C 8025952C AFBF0028 */  sw        $ra, 0x28($sp)
/* 187E10 80259530 AFB00018 */  sw        $s0, 0x18($sp)
/* 187E14 80259534 86230098 */  lh        $v1, 0x98($s1)
/* 187E18 80259538 8E3000C0 */  lw        $s0, 0xC0($s1)
/* 187E1C 8025953C 0066102A */  slt       $v0, $v1, $a2
/* 187E20 80259540 10400003 */  beqz      $v0, .L80259550
/* 187E24 80259544 0000382D */   daddu    $a3, $zero, $zero
/* 187E28 80259548 3C078000 */  lui       $a3, (0x80000000 >> 16)
/* 187E2C 8025954C 0060302D */  daddu     $a2, $v1, $zero
.L80259550:
/* 187E30 80259550 8E220000 */  lw        $v0, 0x0($s1)
/* 187E34 80259554 30420100 */  andi      $v0, $v0, 0x100
/* 187E38 80259558 1040000C */  beqz      $v0, .L8025958C
/* 187E3C 8025955C 3C038080 */   lui      $v1, (0x80808081 >> 16)
/* 187E40 80259560 34638081 */  ori       $v1, $v1, (0x80808081 & 0xFFFF)
/* 187E44 80259564 00061100 */  sll       $v0, $a2, 4
/* 187E48 80259568 00461023 */  subu      $v0, $v0, $a2
/* 187E4C 8025956C 000210C0 */  sll       $v0, $v0, 3
/* 187E50 80259570 00430018 */  mult      $v0, $v1
/* 187E54 80259574 3C078000 */  lui       $a3, (0x80000000 >> 16)
/* 187E58 80259578 00004010 */  mfhi      $t0
/* 187E5C 8025957C 01021821 */  addu      $v1, $t0, $v0
/* 187E60 80259580 000319C3 */  sra       $v1, $v1, 7
/* 187E64 80259584 000217C3 */  sra       $v0, $v0, 31
/* 187E68 80259588 00623023 */  subu      $a2, $v1, $v0
.L8025958C:
/* 187E6C 8025958C 92020768 */  lbu       $v0, 0x768($s0)
/* 187E70 80259590 1040003F */  beqz      $v0, .L80259690
/* 187E74 80259594 0240282D */   daddu    $a1, $s2, $zero
/* 187E78 80259598 96240088 */  lhu       $a0, 0x88($s1)
/* 187E7C 8025959C 0C0B7A90 */  jal       spr_get_npc_palettes
/* 187E80 802595A0 00000000 */   nop
/* 187E84 802595A4 AE0206D0 */  sw        $v0, 0x6D0($s0)
/* 187E88 802595A8 0040202D */  daddu     $a0, $v0, $zero
/* 187E8C 802595AC A20006CD */  sb        $zero, 0x6CD($s0)
/* 187E90 802595B0 8C830000 */  lw        $v1, 0x0($a0)
/* 187E94 802595B4 2402FFFF */  addiu     $v0, $zero, -0x1
/* 187E98 802595B8 1062000C */  beq       $v1, $v0, .L802595EC
/* 187E9C 802595BC 00000000 */   nop
/* 187EA0 802595C0 0080182D */  daddu     $v1, $a0, $zero
/* 187EA4 802595C4 0040202D */  daddu     $a0, $v0, $zero
.L802595C8:
/* 187EA8 802595C8 920206CD */  lbu       $v0, 0x6CD($s0)
/* 187EAC 802595CC 24420001 */  addiu     $v0, $v0, 0x1
/* 187EB0 802595D0 A20206CD */  sb        $v0, 0x6CD($s0)
/* 187EB4 802595D4 00021600 */  sll       $v0, $v0, 24
/* 187EB8 802595D8 00021583 */  sra       $v0, $v0, 22
/* 187EBC 802595DC 00431021 */  addu      $v0, $v0, $v1
/* 187EC0 802595E0 8C420000 */  lw        $v0, 0x0($v0)
/* 187EC4 802595E4 1444FFF8 */  bne       $v0, $a0, .L802595C8
/* 187EC8 802595E8 00000000 */   nop
.L802595EC:
/* 187ECC 802595EC 820206CD */  lb        $v0, 0x6CD($s0)
/* 187ED0 802595F0 18400016 */  blez      $v0, .L8025964C
/* 187ED4 802595F4 0000302D */   daddu    $a2, $zero, $zero
.L802595F8:
/* 187ED8 802595F8 8E0206D0 */  lw        $v0, 0x6D0($s0)
/* 187EDC 802595FC 00061880 */  sll       $v1, $a2, 2
/* 187EE0 80259600 00621821 */  addu      $v1, $v1, $v0
/* 187EE4 80259604 00061140 */  sll       $v0, $a2, 5
/* 187EE8 80259608 8C630000 */  lw        $v1, 0x0($v1)
/* 187EEC 8025960C 10600009 */  beqz      $v1, .L80259634
/* 187EF0 80259610 02022821 */   addu     $a1, $s0, $v0
/* 187EF4 80259614 0000202D */  daddu     $a0, $zero, $zero
.L80259618:
/* 187EF8 80259618 94620000 */  lhu       $v0, 0x0($v1)
/* 187EFC 8025961C 24630002 */  addiu     $v1, $v1, 0x2
/* 187F00 80259620 24840001 */  addiu     $a0, $a0, 0x1
/* 187F04 80259624 A4A20000 */  sh        $v0, 0x0($a1)
/* 187F08 80259628 28820010 */  slti      $v0, $a0, 0x10
/* 187F0C 8025962C 1440FFFA */  bnez      $v0, .L80259618
/* 187F10 80259630 24A50002 */   addiu    $a1, $a1, 0x2
.L80259634:
/* 187F14 80259634 820206CD */  lb        $v0, 0x6CD($s0)
/* 187F18 80259638 24C60001 */  addiu     $a2, $a2, 0x1
/* 187F1C 8025963C 00C2102A */  slt       $v0, $a2, $v0
/* 187F20 80259640 1440FFED */  bnez      $v0, .L802595F8
/* 187F24 80259644 00000000 */   nop
/* 187F28 80259648 820206CD */  lb        $v0, 0x6CD($s0)
.L8025964C:
/* 187F2C 8025964C 1840000A */  blez      $v0, .L80259678
/* 187F30 80259650 0000302D */   daddu    $a2, $zero, $zero
/* 187F34 80259654 0200202D */  daddu     $a0, $s0, $zero
/* 187F38 80259658 0200182D */  daddu     $v1, $s0, $zero
.L8025965C:
/* 187F3C 8025965C AC6406D4 */  sw        $a0, 0x6D4($v1)
/* 187F40 80259660 24840020 */  addiu     $a0, $a0, 0x20
/* 187F44 80259664 820206CD */  lb        $v0, 0x6CD($s0)
/* 187F48 80259668 24C60001 */  addiu     $a2, $a2, 0x1
/* 187F4C 8025966C 00C2102A */  slt       $v0, $a2, $v0
/* 187F50 80259670 1440FFFA */  bnez      $v0, .L8025965C
/* 187F54 80259674 24630004 */   addiu    $v1, $v1, 0x4
.L80259678:
/* 187F58 80259678 0220202D */  daddu     $a0, $s1, $zero
/* 187F5C 8025967C 0240282D */  daddu     $a1, $s2, $zero
/* 187F60 80259680 0C0965B0 */  jal       func_802596C0
/* 187F64 80259684 0260302D */   daddu    $a2, $s3, $zero
/* 187F68 80259688 080965A9 */  j         .L802596A4
/* 187F6C 8025968C 00000000 */   nop
.L80259690:
/* 187F70 80259690 8E240084 */  lw        $a0, 0x84($s1)
/* 187F74 80259694 AFB30010 */  sw        $s3, 0x10($sp)
/* 187F78 80259698 00872025 */  or        $a0, $a0, $a3
/* 187F7C 8025969C 0C0B78F6 */  jal       spr_draw_npc_sprite
/* 187F80 802596A0 0000382D */   daddu    $a3, $zero, $zero
.L802596A4:
/* 187F84 802596A4 8FBF0028 */  lw        $ra, 0x28($sp)
/* 187F88 802596A8 8FB30024 */  lw        $s3, 0x24($sp)
/* 187F8C 802596AC 8FB20020 */  lw        $s2, 0x20($sp)
/* 187F90 802596B0 8FB1001C */  lw        $s1, 0x1C($sp)
/* 187F94 802596B4 8FB00018 */  lw        $s0, 0x18($sp)
/* 187F98 802596B8 03E00008 */  jr        $ra
/* 187F9C 802596BC 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

void func_8025950C(ActorPart* part, s32 yaw, Matrix4f mtx) {
    DecorationTable* decor = part->decorationTable;
    s32 opacity = 255;
    s32 idMask = 0;
    PAL_PTR dest;
    PAL_PTR src;
    s32 i, j;

    if (part->opacity < 255) {
        idMask = DRAW_SPRITE_OVERRIDE_ALPHA;
        opacity = part->opacity;
    }
    if (part->flags & ACTOR_PART_FLAG_100) {
        idMask = DRAW_SPRITE_OVERRIDE_ALPHA;
        opacity = (opacity * 120) / 255;
    }

    if (decor->unk_768 != 0) {
        decor->originalPalettesList = spr_get_npc_palettes(part->currentAnimation >> 0x10);
        decor->originalPalettesCount = 0;
        while (decor->originalPalettesList[decor->originalPalettesCount] != (PAL_PTR) -1) {
            decor->originalPalettesCount++;
        }

        for (i = 0; i < decor->originalPalettesCount; i++) {
            src = decor->originalPalettesList[i];
            dest = decor->copiedPalettes[0][i];
            if (src != NULL) {
                for (j = 0; j < ARRAY_COUNT(decor->copiedPalettes[0][i]); j++) {
                    *dest = *src;
                    src++;
                    dest++;
                }
            }
        }

        for (i = 0; i < decor->originalPalettesCount; i++) {
            decor->adjustedPalettes[i] = decor->copiedPalettes[0][i];
        }

        func_802596C0(part, yaw, mtx);
    } else {
        spr_draw_npc_sprite(part->spriteInstanceID | idMask, yaw, opacity, NULL, mtx);
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_E00828B4
/* 385EF4 E00828B4 27BDFFC8 */  addiu     $sp, $sp, -0x38
/* 385EF8 E00828B8 AFB50024 */  sw        $s5, 0x24($sp)
/* 385EFC E00828BC 0080A82D */  daddu     $s5, $a0, $zero
/* 385F00 E00828C0 3C06DB06 */  lui       $a2, (0xDB060024 >> 16)
/* 385F04 E00828C4 34C60024 */  ori       $a2, $a2, (0xDB060024 & 0xFFFF)
/* 385F08 E00828C8 AFB20018 */  sw        $s2, 0x18($sp)
/* 385F0C E00828CC 24120001 */  addiu     $s2, $zero, 0x1
/* 385F10 E00828D0 AFB00010 */  sw        $s0, 0x10($sp)
/* 385F14 E00828D4 3C10800A */  lui       $s0, %hi(gMainGfxPos)
/* 385F18 E00828D8 2610A66C */  addiu     $s0, $s0, %lo(gMainGfxPos)
/* 385F1C E00828DC 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 385F20 E00828E0 AFBF0034 */  sw        $ra, 0x34($sp)
/* 385F24 E00828E4 AFBE0030 */  sw        $fp, 0x30($sp)
/* 385F28 E00828E8 AFB7002C */  sw        $s7, 0x2C($sp)
/* 385F2C E00828EC AFB60028 */  sw        $s6, 0x28($sp)
/* 385F30 E00828F0 AFB40020 */  sw        $s4, 0x20($sp)
/* 385F34 E00828F4 AFB3001C */  sw        $s3, 0x1C($sp)
/* 385F38 E00828F8 AFB10014 */  sw        $s1, 0x14($sp)
/* 385F3C E00828FC 8E050000 */  lw        $a1, 0x0($s0)
/* 385F40 E0082900 8EB1000C */  lw        $s1, 0xC($s5)
/* 385F44 E0082904 00A0182D */  daddu     $v1, $a1, $zero
/* 385F48 E0082908 24A50008 */  addiu     $a1, $a1, 0x8
/* 385F4C E008290C 0220202D */  daddu     $a0, $s1, $zero
/* 385F50 E0082910 AE050000 */  sw        $a1, 0x0($s0)
/* 385F54 E0082914 AC620000 */  sw        $v0, 0x0($v1)
/* 385F58 E0082918 AC600004 */  sw        $zero, 0x4($v1)
/* 385F5C E008291C ACA60000 */  sw        $a2, 0x0($a1)
/* 385F60 E0082920 8EA30010 */  lw        $v1, 0x10($s5)
/* 385F64 E0082924 24A20008 */  addiu     $v0, $a1, 0x8
/* 385F68 E0082928 AE020000 */  sw        $v0, 0x0($s0)
/* 385F6C E008292C 8C62001C */  lw        $v0, 0x1C($v1)
/* 385F70 E0082930 3C038000 */  lui       $v1, (0x80000000 >> 16)
/* 385F74 E0082934 00431021 */  addu      $v0, $v0, $v1
/* 385F78 E0082938 0C020960 */  jal       func_E0082580
/* 385F7C E008293C ACA20004 */   sw       $v0, 0x4($a1)
/* 385F80 E0082940 8E360038 */  lw        $s6, 0x38($s1)
/* 385F84 E0082944 8E330000 */  lw        $s3, 0x0($s1)
/* 385F88 E0082948 8EA20008 */  lw        $v0, 0x8($s5)
/* 385F8C E008294C 0242102A */  slt       $v0, $s2, $v0
/* 385F90 E0082950 10400030 */  beqz      $v0, .LE0082A14
/* 385F94 E0082954 26310048 */   addiu    $s1, $s1, 0x48
/* 385F98 E0082958 0240F02D */  daddu     $fp, $s2, $zero
/* 385F9C E008295C 3C14DE00 */  lui       $s4, (0xDE000000 >> 16)
/* 385FA0 E0082960 3C170900 */  lui       $s7, %hi(D_09002198_40F428)
/* 385FA4 E0082964 26F72198 */  addiu     $s7, $s7, %lo(D_09002198_40F428)
.LE0082968:
/* 385FA8 E0082968 1EC00003 */  bgtz      $s6, .LE0082978
/* 385FAC E008296C 2407000A */   addiu    $a3, $zero, 0xA
/* 385FB0 E0082970 56670024 */  bnel      $s3, $a3, .LE0082A04
/* 385FB4 E0082974 26520001 */   addiu    $s2, $s2, 0x1
.LE0082978:
/* 385FB8 E0082978 167E0008 */  bne       $s3, $fp, .LE008299C
/* 385FBC E008297C 00000000 */   nop
/* 385FC0 E0082980 8E020000 */  lw        $v0, 0x0($s0)
/* 385FC4 E0082984 0040182D */  daddu     $v1, $v0, $zero
/* 385FC8 E0082988 24420008 */  addiu     $v0, $v0, 0x8
/* 385FCC E008298C AE020000 */  sw        $v0, 0x0($s0)
/* 385FD0 E0082990 AC740000 */  sw        $s4, 0x0($v1)
/* 385FD4 E0082994 08020A6F */  j         .LE00829BC
/* 385FD8 E0082998 AC770004 */   sw       $s7, 0x4($v1)
.LE008299C:
/* 385FDC E008299C 8E020000 */  lw        $v0, 0x0($s0)
/* 385FE0 E00829A0 0040182D */  daddu     $v1, $v0, $zero
/* 385FE4 E00829A4 24420008 */  addiu     $v0, $v0, 0x8
/* 385FE8 E00829A8 AE020000 */  sw        $v0, 0x0($s0)
/* 385FEC E00829AC 3C020900 */  lui       $v0, %hi(D_09002100_40F390)
/* 385FF0 E00829B0 24422100 */  addiu     $v0, $v0, %lo(D_09002100_40F390)
/* 385FF4 E00829B4 AC740000 */  sw        $s4, 0x0($v1)
/* 385FF8 E00829B8 AC620004 */  sw        $v0, 0x4($v1)
.LE00829BC:
/* 385FFC E00829BC 0C0209B1 */  jal       func_E00826C4
/* 386000 E00829C0 0220202D */   daddu    $a0, $s1, $zero
/* 386004 E00829C4 3C05D838 */  lui       $a1, (0xD8380002 >> 16)
/* 386008 E00829C8 34A50002 */  ori       $a1, $a1, (0xD8380002 & 0xFFFF)
/* 38600C E00829CC 8E030000 */  lw        $v1, 0x0($s0)
/* 386010 E00829D0 3C020900 */  lui       $v0, %hi(D_09002230_40F4C0)
/* 386014 E00829D4 24422230 */  addiu     $v0, $v0, %lo(D_09002230_40F4C0)
/* 386018 E00829D8 0060202D */  daddu     $a0, $v1, $zero
/* 38601C E00829DC 24630008 */  addiu     $v1, $v1, 0x8
/* 386020 E00829E0 AE030000 */  sw        $v1, 0x0($s0)
/* 386024 E00829E4 AC820004 */  sw        $v0, 0x4($a0)
/* 386028 E00829E8 24620008 */  addiu     $v0, $v1, 0x8
/* 38602C E00829EC AC940000 */  sw        $s4, 0x0($a0)
/* 386030 E00829F0 AE020000 */  sw        $v0, 0x0($s0)
/* 386034 E00829F4 24020040 */  addiu     $v0, $zero, 0x40
/* 386038 E00829F8 AC650000 */  sw        $a1, 0x0($v1)
/* 38603C E00829FC AC620004 */  sw        $v0, 0x4($v1)
/* 386040 E0082A00 26520001 */  addiu     $s2, $s2, 0x1
.LE0082A04:
/* 386044 E0082A04 8EA20008 */  lw        $v0, 0x8($s5)
/* 386048 E0082A08 0242102A */  slt       $v0, $s2, $v0
/* 38604C E0082A0C 1440FFD6 */  bnez      $v0, .LE0082968
/* 386050 E0082A10 26310048 */   addiu    $s1, $s1, 0x48
.LE0082A14:
/* 386054 E0082A14 3C03D838 */  lui       $v1, (0xD8380002 >> 16)
/* 386058 E0082A18 3C04800A */  lui       $a0, %hi(gMainGfxPos)
/* 38605C E0082A1C 2484A66C */  addiu     $a0, $a0, %lo(gMainGfxPos)
/* 386060 E0082A20 8C820000 */  lw        $v0, 0x0($a0)
/* 386064 E0082A24 34630002 */  ori       $v1, $v1, (0xD8380002 & 0xFFFF)
/* 386068 E0082A28 0040282D */  daddu     $a1, $v0, $zero
/* 38606C E0082A2C 24420008 */  addiu     $v0, $v0, 0x8
/* 386070 E0082A30 AC820000 */  sw        $v0, 0x0($a0)
/* 386074 E0082A34 ACA30000 */  sw        $v1, 0x0($a1)
/* 386078 E0082A38 24030040 */  addiu     $v1, $zero, 0x40
/* 38607C E0082A3C ACA30004 */  sw        $v1, 0x4($a1)
/* 386080 E0082A40 24430008 */  addiu     $v1, $v0, 0x8
/* 386084 E0082A44 AC830000 */  sw        $v1, 0x0($a0)
/* 386088 E0082A48 3C03E700 */  lui       $v1, (0xE7000000 >> 16)
/* 38608C E0082A4C AC430000 */  sw        $v1, 0x0($v0)
/* 386090 E0082A50 AC400004 */  sw        $zero, 0x4($v0)
/* 386094 E0082A54 8FBF0034 */  lw        $ra, 0x34($sp)
/* 386098 E0082A58 8FBE0030 */  lw        $fp, 0x30($sp)
/* 38609C E0082A5C 8FB7002C */  lw        $s7, 0x2C($sp)
/* 3860A0 E0082A60 8FB60028 */  lw        $s6, 0x28($sp)
/* 3860A4 E0082A64 8FB50024 */  lw        $s5, 0x24($sp)
/* 3860A8 E0082A68 8FB40020 */  lw        $s4, 0x20($sp)
/* 3860AC E0082A6C 8FB3001C */  lw        $s3, 0x1C($sp)
/* 3860B0 E0082A70 8FB20018 */  lw        $s2, 0x18($sp)
/* 3860B4 E0082A74 8FB10014 */  lw        $s1, 0x14($sp)
/* 3860B8 E0082A78 8FB00010 */  lw        $s0, 0x10($sp)
/* 3860BC E0082A7C 03E00008 */  jr        $ra
/* 3860C0 E0082A80 27BD0038 */   addiu    $sp, $sp, 0x38

### DECOMPILED C INSTRUCTIONS:

void func_E00828B4(EffectInstance* effect) {
    DisableXFXData* data = effect->data.disableX;
    s32 type;
    s32 unk_38;
    s32 i;

    gDPPipeSync(gMainGfxPos++);
    gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->graphics->data));
    func_E0082580(data);
    unk_38 = data->unk_38;
    type = data->type;

    data++;
    for (i = 1; i < effect->numParts; i++, data++) {
        if (unk_38 > 0 || type == 10) {
            if (type == 1) {
                gSPDisplayList(gMainGfxPos++, D_09002198_388548);
            } else {
                gSPDisplayList(gMainGfxPos++, D_09002100_3884B0);
            }
            func_E00826C4(data);
            gSPDisplayList(gMainGfxPos++, D_09002230_3885E0);
            gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
        }
    }
    gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
    gDPPipeSync(gMainGfxPos++);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel create_standard_popup_menu
/* 8E2F0 800F4E40 27BDFFE8 */  addiu     $sp, $sp, -0x18
/* 8E2F4 800F4E44 AFB00010 */  sw        $s0, 0x10($sp)
/* 8E2F8 800F4E48 AFBF0014 */  sw        $ra, 0x14($sp)
/* 8E2FC 800F4E4C 0C03A635 */  jal       func_800E98D4
/* 8E300 800F4E50 0080802D */   daddu    $s0, $a0, $zero
/* 8E304 800F4E54 3C018011 */  lui       $at, %hi(D_8010D69A)
/* 8E308 800F4E58 A022D69A */  sb        $v0, %lo(D_8010D69A)($at)
/* 8E30C 800F4E5C 0C03A625 */  jal       status_bar_ignore_changes
/* 8E310 800F4E60 00000000 */   nop
/* 8E314 800F4E64 0C03A5E3 */  jal       open_status_bar_short
/* 8E318 800F4E68 00000000 */   nop
/* 8E31C 800F4E6C 3C048011 */  lui       $a0, %hi(PopupDipMode)
/* 8E320 800F4E70 2484D699 */  addiu     $a0, $a0, %lo(PopupDipMode)
/* 8E324 800F4E74 3C068011 */  lui       $a2, %hi(PopupNotDipping)
/* 8E328 800F4E78 24C6D698 */  addiu     $a2, $a2, %lo(PopupNotDipping)
/* 8E32C 800F4E7C 3C018011 */  lui       $at, %hi(gPopupMenu)
/* 8E330 800F4E80 AC30D69C */  sw        $s0, %lo(gPopupMenu)($at)
/* 8E334 800F4E84 A600032C */  sh        $zero, 0x32C($s0)
/* 8E338 800F4E88 AE00031C */  sw        $zero, 0x31C($s0)
/* 8E33C 800F4E8C AE000320 */  sw        $zero, 0x320($s0)
/* 8E340 800F4E90 A0800000 */  sb        $zero, 0x0($a0)
/* 8E344 800F4E94 8E030318 */  lw        $v1, 0x318($s0)
/* 8E348 800F4E98 24050001 */  addiu     $a1, $zero, 0x1
/* 8E34C 800F4E9C 28620064 */  slti      $v0, $v1, 0x64
/* 8E350 800F4EA0 1440000C */  bnez      $v0, .L800F4ED4
/* 8E354 800F4EA4 A0C50000 */   sb       $a1, 0x0($a2)
/* 8E358 800F4EA8 2462FF9C */  addiu     $v0, $v1, -0x64
/* 8E35C 800F4EAC AE020318 */  sw        $v0, 0x318($s0)
/* 8E360 800F4EB0 0040182D */  daddu     $v1, $v0, $zero
/* 8E364 800F4EB4 28620064 */  slti      $v0, $v1, 0x64
/* 8E368 800F4EB8 14400005 */  bnez      $v0, .L800F4ED0
/* 8E36C 800F4EBC A0850000 */   sb       $a1, 0x0($a0)
/* 8E370 800F4EC0 2462FF9C */  addiu     $v0, $v1, -0x64
/* 8E374 800F4EC4 AE020318 */  sw        $v0, 0x318($s0)
/* 8E378 800F4EC8 24020002 */  addiu     $v0, $zero, 0x2
/* 8E37C 800F4ECC A0820000 */  sb        $v0, 0x0($a0)
.L800F4ED0:
/* 8E380 800F4ED0 A0C00000 */  sb        $zero, 0x0($a2)
.L800F4ED4:
/* 8E384 800F4ED4 3C058011 */  lui       $a1, %hi(gPopupMenu)
/* 8E388 800F4ED8 8CA5D69C */  lw        $a1, %lo(gPopupMenu)($a1)
/* 8E38C 800F4EDC 24020001 */  addiu     $v0, $zero, 0x1
/* 8E390 800F4EE0 3C018011 */  lui       $at, %hi(PopupNotBattle)
/* 8E394 800F4EE4 A022D68E */  sb        $v0, %lo(PopupNotBattle)($at)
/* 8E398 800F4EE8 24020006 */  addiu     $v0, $zero, 0x6
/* 8E39C 800F4EEC 3C018011 */  lui       $at, %hi(PopupMenu_MaxDisplayableEntryCount)
/* 8E3A0 800F4EF0 A022D68F */  sb        $v0, %lo(PopupMenu_MaxDisplayableEntryCount)($at)
/* 8E3A4 800F4EF4 8CA20328 */  lw        $v0, 0x328($a1)
/* 8E3A8 800F4EF8 8CA40324 */  lw        $a0, 0x324($a1)
/* 8E3AC 800F4EFC 3C038011 */  lui       $v1, %hi(PopupMenu_SelectedIndex)
/* 8E3B0 800F4F00 2463D648 */  addiu     $v1, $v1, %lo(PopupMenu_SelectedIndex)
/* 8E3B4 800F4F04 3C018011 */  lui       $at, %hi(gPopupState)
/* 8E3B8 800F4F08 AC20D640 */  sw        $zero, %lo(gPopupState)($at)
/* 8E3BC 800F4F0C AC620000 */  sw        $v0, 0x0($v1)
/* 8E3C0 800F4F10 0044102A */  slt       $v0, $v0, $a0
/* 8E3C4 800F4F14 14400002 */  bnez      $v0, .L800F4F20
/* 8E3C8 800F4F18 2482FFFF */   addiu    $v0, $a0, -0x1
/* 8E3CC 800F4F1C AC620000 */  sw        $v0, 0x0($v1)
.L800F4F20:
/* 8E3D0 800F4F20 8C620000 */  lw        $v0, 0x0($v1)
/* 8E3D4 800F4F24 3C048011 */  lui       $a0, %hi(PopupMenu_DisplayedEntryCount)
/* 8E3D8 800F4F28 2484D656 */  addiu     $a0, $a0, %lo(PopupMenu_DisplayedEntryCount)
/* 8E3DC 800F4F2C 3C018011 */  lui       $at, %hi(PopupMenu_FirstDisplayIndex)
/* 8E3E0 800F4F30 A020D654 */  sb        $zero, %lo(PopupMenu_FirstDisplayIndex)($at)
/* 8E3E4 800F4F34 3C018011 */  lui       $at, %hi(PopupMenu_PrevSelectedIndex)
/* 8E3E8 800F4F38 AC22D64C */  sw        $v0, %lo(PopupMenu_PrevSelectedIndex)($at)
/* 8E3EC 800F4F3C 90A20327 */  lbu       $v0, 0x327($a1)
/* 8E3F0 800F4F40 24030006 */  addiu     $v1, $zero, 0x6
/* 8E3F4 800F4F44 A0820000 */  sb        $v0, 0x0($a0)
/* 8E3F8 800F4F48 00021600 */  sll       $v0, $v0, 24
/* 8E3FC 800F4F4C 00021603 */  sra       $v0, $v0, 24
/* 8E400 800F4F50 0062102A */  slt       $v0, $v1, $v0
/* 8E404 800F4F54 54400001 */  bnel      $v0, $zero, .L800F4F5C
/* 8E408 800F4F58 A0830000 */   sb       $v1, 0x0($a0)
.L800F4F5C:
/* 8E40C 800F4F5C 8CA20324 */  lw        $v0, 0x324($a1)
/* 8E410 800F4F60 3C048011 */  lui       $a0, %hi(PopupMenu_LastDisplayIndex)
/* 8E414 800F4F64 2484D655 */  addiu     $a0, $a0, %lo(PopupMenu_LastDisplayIndex)
/* 8E418 800F4F68 28420006 */  slti      $v0, $v0, 0x6
/* 8E41C 800F4F6C 10400003 */  beqz      $v0, .L800F4F7C
/* 8E420 800F4F70 A0830000 */   sb       $v1, 0x0($a0)
/* 8E424 800F4F74 90A20327 */  lbu       $v0, 0x327($a1)
/* 8E428 800F4F78 A0820000 */  sb        $v0, 0x0($a0)
.L800F4F7C:
/* 8E42C 800F4F7C 240200FF */  addiu     $v0, $zero, 0xFF
/* 8E430 800F4F80 3C018011 */  lui       $at, %hi(PopupMenu_Alpha)
/* 8E434 800F4F84 AC22D650 */  sw        $v0, %lo(PopupMenu_Alpha)($at)
/* 8E438 800F4F88 24020004 */  addiu     $v0, $zero, 0x4
/* 8E43C 800F4F8C 3C04800F */  lui       $a0, %hi(popup_menu_update)
/* 8E440 800F4F90 24841A10 */  addiu     $a0, $a0, %lo(popup_menu_update)
/* 8E444 800F4F94 3C018011 */  lui       $at, %hi(D_8010D691)
/* 8E448 800F4F98 A022D691 */  sb        $v0, %lo(D_8010D691)($at)
/* 8E44C 800F4F9C 3C018011 */  lui       $at, %hi(D_8010D692)
/* 8E450 800F4FA0 A023D692 */  sb        $v1, %lo(D_8010D692)($at)
/* 8E454 800F4FA4 0C048C8F */  jal       create_worker_frontUI
/* 8E458 800F4FA8 0000282D */   daddu    $a1, $zero, $zero
/* 8E45C 800F4FAC 8FBF0014 */  lw        $ra, 0x14($sp)
/* 8E460 800F4FB0 8FB00010 */  lw        $s0, 0x10($sp)
/* 8E464 800F4FB4 3C018011 */  lui       $at, %hi(gPopupWorker)
/* 8E468 800F4FB8 AC22D694 */  sw        $v0, %lo(gPopupWorker)($at)
/* 8E46C 800F4FBC 03E00008 */  jr        $ra
/* 8E470 800F4FC0 27BD0018 */   addiu    $sp, $sp, 0x18

### DECOMPILED C INSTRUCTIONS:

void create_standard_popup_menu(PopupMenu* popup) {
    PopupMenu* otherPopup;
    s8 entryCount;
    s32 initialPos;
    s32 numEntries;

    D_8010D69A = func_800E98D4();
    status_bar_ignore_changes();
    open_status_bar_short();
    gPopupMenu = popup;
    popup->result = POPUP_RESULT_CHOOSING;
    popup->dipMode = 0;
    popup->titleNumber = 0;
    PopupDipMode = 0;
    PopupNotDipping = TRUE;
    if (popup->popupType >= POPUP_MENU_DOUBLE_DIP) {
        popup->popupType -= POPUP_MENU_DOUBLE_DIP;
        PopupDipMode = 1;
        if (popup->popupType >= POPUP_MENU_DOUBLE_DIP) {
            popup->popupType -= POPUP_MENU_DOUBLE_DIP;
            PopupDipMode = 2;
        }
        PopupNotDipping = FALSE;
    }

    PopupNotBattle = TRUE;
    PopupMenu_MaxDisplayableEntryCount = 6;
    gPopupState = POPUP_STATE_INIT;

    initialPos = gPopupMenu->initialPos;
    numEntries = gPopupMenu->numEntries;
    PopupMenu_SelectedIndex = initialPos;
    if (initialPos >= numEntries) {
        PopupMenu_SelectedIndex = numEntries - 1;
    }
    PopupMenu_FirstDisplayIndex = 0;
    PopupMenu_PrevSelectedIndex = PopupMenu_SelectedIndex;

    entryCount = gPopupMenu->numEntries;
    PopupMenu_DisplayedEntryCount = entryCount;
    if (PopupMenu_MaxDisplayableEntryCount < entryCount) {
        PopupMenu_DisplayedEntryCount = 6;
    }

    PopupMenu_LastDisplayIndex = 6;
    if (gPopupMenu->numEntries < PopupMenu_MaxDisplayableEntryCount) {
        PopupMenu_LastDisplayIndex = gPopupMenu->numEntries;
    }

    PopupMenu_Alpha = 255;
    D_8010D691 = 4;
    D_8010D692 = 6;
    gPopupWorker = create_worker_frontUI((void (*) (void)) popup_menu_update, NULL);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel water_splash_update
/* 3BC304 E00BE3A4 27BDFFE0 */  addiu     $sp, $sp, -0x20
/* 3BC308 E00BE3A8 AFBF0010 */  sw        $ra, 0x10($sp)
/* 3BC30C E00BE3AC F7B40018 */  sdc1      $f20, 0x18($sp)
/* 3BC310 E00BE3B0 8C850000 */  lw        $a1, 0x0($a0)
/* 3BC314 E00BE3B4 8C83000C */  lw        $v1, 0xC($a0)
/* 3BC318 E00BE3B8 30A20010 */  andi      $v0, $a1, 0x10
/* 3BC31C E00BE3BC 8C660000 */  lw        $a2, 0x0($v1)
/* 3BC320 E00BE3C0 10400005 */  beqz      $v0, .LE00BE3D8
/* 3BC324 E00BE3C4 2402FFEF */   addiu    $v0, $zero, -0x11
/* 3BC328 E00BE3C8 00A21024 */  and       $v0, $a1, $v0
/* 3BC32C E00BE3CC AC820000 */  sw        $v0, 0x0($a0)
/* 3BC330 E00BE3D0 24020010 */  addiu     $v0, $zero, 0x10
/* 3BC334 E00BE3D4 AC62001C */  sw        $v0, 0x1C($v1)
.LE00BE3D8:
/* 3BC338 E00BE3D8 8C65001C */  lw        $a1, 0x1C($v1)
/* 3BC33C E00BE3DC 28A203E8 */  slti      $v0, $a1, 0x3E8
/* 3BC340 E00BE3E0 10400002 */  beqz      $v0, .LE00BE3EC
/* 3BC344 E00BE3E4 24A2FFFF */   addiu    $v0, $a1, -0x1
/* 3BC348 E00BE3E8 AC62001C */  sw        $v0, 0x1C($v1)
.LE00BE3EC:
/* 3BC34C E00BE3EC 8C620020 */  lw        $v0, 0x20($v1)
/* 3BC350 E00BE3F0 8C65001C */  lw        $a1, 0x1C($v1)
/* 3BC354 E00BE3F4 24420001 */  addiu     $v0, $v0, 0x1
/* 3BC358 E00BE3F8 04A10005 */  bgez      $a1, .LE00BE410
/* 3BC35C E00BE3FC AC620020 */   sw       $v0, 0x20($v1)
/* 3BC360 E00BE400 0C080128 */  jal       shim_remove_effect
/* 3BC364 E00BE404 00000000 */   nop
/* 3BC368 E00BE408 0802F95A */  j         .LE00BE568
/* 3BC36C E00BE40C 00000000 */   nop
.LE00BE410:
/* 3BC370 E00BE410 28A20004 */  slti      $v0, $a1, 0x4
/* 3BC374 E00BE414 10400002 */  beqz      $v0, .LE00BE420
/* 3BC378 E00BE418 00051180 */   sll      $v0, $a1, 6
/* 3BC37C E00BE41C AC620030 */  sw        $v0, 0x30($v1)
.LE00BE420:
/* 3BC380 E00BE420 8C820008 */  lw        $v0, 0x8($a0)
/* 3BC384 E00BE424 24050001 */  addiu     $a1, $zero, 0x1
/* 3BC388 E00BE428 00A2102A */  slt       $v0, $a1, $v0
/* 3BC38C E00BE42C 1040004E */  beqz      $v0, .LE00BE568
/* 3BC390 E00BE430 24630038 */   addiu    $v1, $v1, 0x38
/* 3BC394 E00BE434 24080002 */  addiu     $t0, $zero, 0x2
/* 3BC398 E00BE438 24070003 */  addiu     $a3, $zero, 0x3
/* 3BC39C E00BE43C 24630034 */  addiu     $v1, $v1, 0x34
/* 3BC3A0 E00BE440 3C01E00C */  lui       $at, (0xE00C0000 >> 16)
/* 3BC3A4 E00BE444 D42AEB00 */  ldc1      $f10, -0x1500($at)
/* 3BC3A8 E00BE448 3C01E00C */  lui       $at, (0xE00C0000 >> 16)
/* 3BC3AC E00BE44C D432EB08 */  ldc1      $f18, -0x14F8($at)
/* 3BC3B0 E00BE450 3C01E00C */  lui       $at, (0xE00C0000 >> 16)
/* 3BC3B4 E00BE454 D430EB10 */  ldc1      $f16, -0x14F0($at)
/* 3BC3B8 E00BE458 3C01E00C */  lui       $at, (0xE00C0000 >> 16)
/* 3BC3BC E00BE45C D42EEB18 */  ldc1      $f14, -0x14E8($at)
/* 3BC3C0 E00BE460 3C01E00C */  lui       $at, (0xE00C0000 >> 16)
/* 3BC3C4 E00BE464 D42CEB20 */  ldc1      $f12, -0x14E0($at)
.LE00BE468:
/* 3BC3C8 E00BE468 C464FFFC */  lwc1      $f4, -0x4($v1)
/* 3BC3CC E00BE46C 46802121 */  cvt.d.w   $f4, $f4
/* 3BC3D0 E00BE470 462A2102 */  mul.d     $f4, $f4, $f10
/* 3BC3D4 E00BE474 00000000 */  nop
/* 3BC3D8 E00BE478 C468FFD0 */  lwc1      $f8, -0x30($v1)
/* 3BC3DC E00BE47C C460FFDC */  lwc1      $f0, -0x24($v1)
/* 3BC3E0 E00BE480 C466FFD4 */  lwc1      $f6, -0x2C($v1)
/* 3BC3E4 E00BE484 46004200 */  add.s     $f8, $f8, $f0
/* 3BC3E8 E00BE488 C460FFE0 */  lwc1      $f0, -0x20($v1)
/* 3BC3EC E00BE48C C462FFD8 */  lwc1      $f2, -0x28($v1)
/* 3BC3F0 E00BE490 46003180 */  add.s     $f6, $f6, $f0
/* 3BC3F4 E00BE494 C460FFE4 */  lwc1      $f0, -0x1C($v1)
/* 3BC3F8 E00BE498 46001080 */  add.s     $f2, $f2, $f0
/* 3BC3FC E00BE49C E468FFD0 */  swc1      $f8, -0x30($v1)
/* 3BC400 E00BE4A0 E466FFD4 */  swc1      $f6, -0x2C($v1)
/* 3BC404 E00BE4A4 E462FFD8 */  swc1      $f2, -0x28($v1)
/* 3BC408 E00BE4A8 4620250D */  trunc.w.d $f20, $f4
/* 3BC40C E00BE4AC 14C80006 */  bne       $a2, $t0, .LE00BE4C8
/* 3BC410 E00BE4B0 E474FFFC */   swc1     $f20, -0x4($v1)
/* 3BC414 E00BE4B4 C460FFE0 */  lwc1      $f0, -0x20($v1)
/* 3BC418 E00BE4B8 46000021 */  cvt.d.s   $f0, $f0
/* 3BC41C E00BE4BC 46320000 */  add.d     $f0, $f0, $f18
/* 3BC420 E00BE4C0 46200020 */  cvt.s.d   $f0, $f0
/* 3BC424 E00BE4C4 E460FFE0 */  swc1      $f0, -0x20($v1)
.LE00BE4C8:
/* 3BC428 E00BE4C8 C464FFDC */  lwc1      $f4, -0x24($v1)
/* 3BC42C E00BE4CC 46002121 */  cvt.d.s   $f4, $f4
/* 3BC430 E00BE4D0 462A2102 */  mul.d     $f4, $f4, $f10
/* 3BC434 E00BE4D4 00000000 */  nop
/* 3BC438 E00BE4D8 C462FFE4 */  lwc1      $f2, -0x1C($v1)
/* 3BC43C E00BE4DC 460010A1 */  cvt.d.s   $f2, $f2
/* 3BC440 E00BE4E0 462A1082 */  mul.d     $f2, $f2, $f10
/* 3BC444 E00BE4E4 00000000 */  nop
/* 3BC448 E00BE4E8 C460FFE0 */  lwc1      $f0, -0x20($v1)
/* 3BC44C E00BE4EC 46000021 */  cvt.d.s   $f0, $f0
/* 3BC450 E00BE4F0 46300000 */  add.d     $f0, $f0, $f16
/* 3BC454 E00BE4F4 46200020 */  cvt.s.d   $f0, $f0
/* 3BC458 E00BE4F8 E460FFE0 */  swc1      $f0, -0x20($v1)
/* 3BC45C E00BE4FC 46000021 */  cvt.d.s   $f0, $f0
/* 3BC460 E00BE500 462A0002 */  mul.d     $f0, $f0, $f10
/* 3BC464 E00BE504 00000000 */  nop
/* 3BC468 E00BE508 46202120 */  cvt.s.d   $f4, $f4
/* 3BC46C E00BE50C 462010A0 */  cvt.s.d   $f2, $f2
/* 3BC470 E00BE510 E464FFDC */  swc1      $f4, -0x24($v1)
/* 3BC474 E00BE514 E462FFE4 */  swc1      $f2, -0x1C($v1)
/* 3BC478 E00BE518 46200020 */  cvt.s.d   $f0, $f0
/* 3BC47C E00BE51C 14C70007 */  bne       $a2, $a3, .LE00BE53C
/* 3BC480 E00BE520 E460FFE0 */   swc1     $f0, -0x20($v1)
/* 3BC484 E00BE524 C4600000 */  lwc1      $f0, 0x0($v1)
/* 3BC488 E00BE528 46000021 */  cvt.d.s   $f0, $f0
/* 3BC48C E00BE52C 462E0002 */  mul.d     $f0, $f0, $f14
/* 3BC490 E00BE530 00000000 */  nop
/* 3BC494 E00BE534 0802F954 */  j         .LE00BE550
/* 3BC498 E00BE538 46200020 */   cvt.s.d  $f0, $f0
.LE00BE53C:
/* 3BC49C E00BE53C C4600000 */  lwc1      $f0, 0x0($v1)
/* 3BC4A0 E00BE540 46000021 */  cvt.d.s   $f0, $f0
/* 3BC4A4 E00BE544 462C0002 */  mul.d     $f0, $f0, $f12
/* 3BC4A8 E00BE548 00000000 */  nop
/* 3BC4AC E00BE54C 46200020 */  cvt.s.d   $f0, $f0
.LE00BE550:
/* 3BC4B0 E00BE550 E4600000 */  swc1      $f0, 0x0($v1)
/* 3BC4B4 E00BE554 24A50001 */  addiu     $a1, $a1, 0x1
/* 3BC4B8 E00BE558 8C820008 */  lw        $v0, 0x8($a0)
/* 3BC4BC E00BE55C 00A2102A */  slt       $v0, $a1, $v0
/* 3BC4C0 E00BE560 1440FFC1 */  bnez      $v0, .LE00BE468
/* 3BC4C4 E00BE564 24630038 */   addiu    $v1, $v1, 0x38
.LE00BE568:
/* 3BC4C8 E00BE568 8FBF0010 */  lw        $ra, 0x10($sp)
/* 3BC4CC E00BE56C D7B40018 */  ldc1      $f20, 0x18($sp)
/* 3BC4D0 E00BE570 03E00008 */  jr        $ra
/* 3BC4D4 E00BE574 27BD0020 */   addiu    $sp, $sp, 0x20

### DECOMPILED C INSTRUCTIONS:

void water_splash_update(EffectInstance *effect) {
    WaterSplashFXData *part;
    s32 temp_a1_3;
    s32 temp_a2;
    s32 i;

    part = effect->data.waterSplash;
    temp_a2 = part->unk_00;
    if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
        effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
        part->unk_1C = 0x10;
    }

    if (part->unk_1C < 1000) {
        part->unk_1C--;
    }

    temp_a1_3 = part->unk_1C;
    part->unk_20++;
    if (temp_a1_3 < 0) {
        shim_remove_effect(effect);
        return;
    }

    if (temp_a1_3 < 4) {
        part->unk_30 = temp_a1_3 * 64;
    }

    part++;
    for (i = 1; i < effect->numParts; i++, part++) {
        part->unk_04.x += part->unk_10.x;
        part->unk_04.y += part->unk_10.y;
        part->unk_04.z += part->unk_10.z;
        part->unk_30 *= 0.98;
        if (temp_a2 == 2) {
            part->unk_10.y += -0.8;
        }
        part->unk_10.y += -0.1;
        part->unk_10.x *= 0.98;
        part->unk_10.y *= 0.98;
        part->unk_10.z *= 0.98;
        if (temp_a2 == 3) {
            part->unk_34 *= 1.2;
        } else {
            part->unk_34 *= 0.9;
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel purple_ring_update
/* 352840 E003E400 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 352844 E003E404 AFBF0010 */  sw        $ra, 0x10($sp)
/* 352848 E003E408 F7B60020 */  sdc1      $f22, 0x20($sp)
/* 35284C E003E40C F7B40018 */  sdc1      $f20, 0x18($sp)
/* 352850 E003E410 8C83000C */  lw        $v1, 0xC($a0)
/* 352854 E003E414 8C62006C */  lw        $v0, 0x6C($v1)
/* 352858 E003E418 2442FFFF */  addiu     $v0, $v0, -0x1
/* 35285C E003E41C AC62006C */  sw        $v0, 0x6C($v1)
/* 352860 E003E420 8C620070 */  lw        $v0, 0x70($v1)
/* 352864 E003E424 8C65006C */  lw        $a1, 0x6C($v1)
/* 352868 E003E428 24420001 */  addiu     $v0, $v0, 0x1
/* 35286C E003E42C 04A10005 */  bgez      $a1, .LE003E444
/* 352870 E003E430 AC620070 */   sw       $v0, 0x70($v1)
/* 352874 E003E434 0C080128 */  jal       shim_remove_effect
/* 352878 E003E438 00000000 */   nop
/* 35287C E003E43C 0800F978 */  j         .LE003E5E0
/* 352880 E003E440 00000000 */   nop
.LE003E444:
/* 352884 E003E444 8C820008 */  lw        $v0, 0x8($a0)
/* 352888 E003E448 18400065 */  blez      $v0, .LE003E5E0
/* 35288C E003E44C 0000302D */   daddu    $a2, $zero, $zero
/* 352890 E003E450 28A80006 */  slti      $t0, $a1, 0x6
/* 352894 E003E454 240900FF */  addiu     $t1, $zero, 0xFF
/* 352898 E003E458 28A70005 */  slti      $a3, $a1, 0x5
/* 35289C E003E45C 24650064 */  addiu     $a1, $v1, 0x64
/* 3528A0 E003E460 3C01E004 */  lui       $at, (0xE0040000 >> 16)
/* 3528A4 E003E464 D434E878 */  ldc1      $f20, -0x1788($at)
/* 3528A8 E003E468 3C01E004 */  lui       $at, (0xE0040000 >> 16)
/* 3528AC E003E46C D42EE880 */  ldc1      $f14, -0x1780($at)
/* 3528B0 E003E470 3C01E004 */  lui       $at, (0xE0040000 >> 16)
/* 3528B4 E003E474 D432E888 */  ldc1      $f18, -0x1778($at)
/* 3528B8 E003E478 3C01E004 */  lui       $at, (0xE0040000 >> 16)
/* 3528BC E003E47C D42CE890 */  ldc1      $f12, -0x1770($at)
/* 3528C0 E003E480 3C01E004 */  lui       $at, (0xE0040000 >> 16)
/* 3528C4 E003E484 D430E898 */  ldc1      $f16, -0x1768($at)
.LE003E488:
/* 3528C8 E003E488 15000020 */  bnez      $t0, .LE003E50C
/* 3528CC E003E48C 00000000 */   nop
/* 3528D0 E003E490 C4A2FFAC */  lwc1      $f2, -0x54($a1)
/* 3528D4 E003E494 460010A1 */  cvt.d.s   $f2, $f2
/* 3528D8 E003E498 462E1082 */  mul.d     $f2, $f2, $f14
/* 3528DC E003E49C 00000000 */  nop
/* 3528E0 E003E4A0 C4A0FFB0 */  lwc1      $f0, -0x50($a1)
/* 3528E4 E003E4A4 46000021 */  cvt.d.s   $f0, $f0
/* 3528E8 E003E4A8 462E0002 */  mul.d     $f0, $f0, $f14
/* 3528EC E003E4AC 00000000 */  nop
/* 3528F0 E003E4B0 C4A4FFB4 */  lwc1      $f4, -0x4C($a1)
/* 3528F4 E003E4B4 46002121 */  cvt.d.s   $f4, $f4
/* 3528F8 E003E4B8 462E2102 */  mul.d     $f4, $f4, $f14
/* 3528FC E003E4BC 00000000 */  nop
/* 352900 E003E4C0 8CA30004 */  lw        $v1, 0x4($a1)
/* 352904 E003E4C4 01231023 */  subu      $v0, $t1, $v1
/* 352908 E003E4C8 44823000 */  mtc1      $v0, $f6
/* 35290C E003E4CC 00000000 */  nop
/* 352910 E003E4D0 468031A1 */  cvt.d.w   $f6, $f6
/* 352914 E003E4D4 46343182 */  mul.d     $f6, $f6, $f20
/* 352918 E003E4D8 00000000 */  nop
/* 35291C E003E4DC 462010A0 */  cvt.s.d   $f2, $f2
/* 352920 E003E4E0 46200020 */  cvt.s.d   $f0, $f0
/* 352924 E003E4E4 E4A0FFB0 */  swc1      $f0, -0x50($a1)
/* 352928 E003E4E8 44830000 */  mtc1      $v1, $f0
/* 35292C E003E4EC 00000000 */  nop
/* 352930 E003E4F0 46800021 */  cvt.d.w   $f0, $f0
/* 352934 E003E4F4 46202120 */  cvt.s.d   $f4, $f4
/* 352938 E003E4F8 46260000 */  add.d     $f0, $f0, $f6
/* 35293C E003E4FC E4A2FFAC */  swc1      $f2, -0x54($a1)
/* 352940 E003E500 E4A4FFB4 */  swc1      $f4, -0x4C($a1)
/* 352944 E003E504 4620058D */  trunc.w.d $f22, $f0
/* 352948 E003E508 E4B60004 */  swc1      $f22, 0x4($a1)
.LE003E50C:
/* 35294C E003E50C 10E00019 */  beqz      $a3, .LE003E574
/* 352950 E003E510 00000000 */   nop
/* 352954 E003E514 C4A60004 */  lwc1      $f6, 0x4($a1)
/* 352958 E003E518 468031A1 */  cvt.d.w   $f6, $f6
/* 35295C E003E51C 46323182 */  mul.d     $f6, $f6, $f18
/* 352960 E003E520 00000000 */  nop
/* 352964 E003E524 C4A4FFAC */  lwc1      $f4, -0x54($a1)
/* 352968 E003E528 46002121 */  cvt.d.s   $f4, $f4
/* 35296C E003E52C 462C2102 */  mul.d     $f4, $f4, $f12
/* 352970 E003E530 00000000 */  nop
/* 352974 E003E534 C4A2FFB0 */  lwc1      $f2, -0x50($a1)
/* 352978 E003E538 460010A1 */  cvt.d.s   $f2, $f2
/* 35297C E003E53C 462C1082 */  mul.d     $f2, $f2, $f12
/* 352980 E003E540 00000000 */  nop
/* 352984 E003E544 C4A0FFB4 */  lwc1      $f0, -0x4C($a1)
/* 352988 E003E548 46000021 */  cvt.d.s   $f0, $f0
/* 35298C E003E54C 462C0002 */  mul.d     $f0, $f0, $f12
/* 352990 E003E550 00000000 */  nop
/* 352994 E003E554 4620358D */  trunc.w.d $f22, $f6
/* 352998 E003E558 E4B60004 */  swc1      $f22, 0x4($a1)
/* 35299C E003E55C 46202120 */  cvt.s.d   $f4, $f4
/* 3529A0 E003E560 462010A0 */  cvt.s.d   $f2, $f2
/* 3529A4 E003E564 46200020 */  cvt.s.d   $f0, $f0
/* 3529A8 E003E568 E4A4FFAC */  swc1      $f4, -0x54($a1)
/* 3529AC E003E56C E4A2FFB0 */  swc1      $f2, -0x50($a1)
/* 3529B0 E003E570 E4A0FFB4 */  swc1      $f0, -0x4C($a1)
.LE003E574:
/* 3529B4 E003E574 C4A20000 */  lwc1      $f2, 0x0($a1)
/* 3529B8 E003E578 460010A1 */  cvt.d.s   $f2, $f2
/* 3529BC E003E57C 46301082 */  mul.d     $f2, $f2, $f16
/* 3529C0 E003E580 00000000 */  nop
/* 3529C4 E003E584 C4AAFFA0 */  lwc1      $f10, -0x60($a1)
/* 3529C8 E003E588 C4A0FFAC */  lwc1      $f0, -0x54($a1)
/* 3529CC E003E58C C4A8FFA4 */  lwc1      $f8, -0x5C($a1)
/* 3529D0 E003E590 46005280 */  add.s     $f10, $f10, $f0
/* 3529D4 E003E594 C4A0FFB0 */  lwc1      $f0, -0x50($a1)
/* 3529D8 E003E598 C4A4FFA8 */  lwc1      $f4, -0x58($a1)
/* 3529DC E003E59C 46004200 */  add.s     $f8, $f8, $f0
/* 3529E0 E003E5A0 C4A0FFB4 */  lwc1      $f0, -0x4C($a1)
/* 3529E4 E003E5A4 C4A6FFFC */  lwc1      $f6, -0x4($a1)
/* 3529E8 E003E5A8 46002100 */  add.s     $f4, $f4, $f0
/* 3529EC E003E5AC C4A0FFF8 */  lwc1      $f0, -0x8($a1)
/* 3529F0 E003E5B0 24C60001 */  addiu     $a2, $a2, 0x1
/* 3529F4 E003E5B4 E4AAFFA0 */  swc1      $f10, -0x60($a1)
/* 3529F8 E003E5B8 46060000 */  add.s     $f0, $f0, $f6
/* 3529FC E003E5BC E4A8FFA4 */  swc1      $f8, -0x5C($a1)
/* 352A00 E003E5C0 E4A4FFA8 */  swc1      $f4, -0x58($a1)
/* 352A04 E003E5C4 E4A0FFF8 */  swc1      $f0, -0x8($a1)
/* 352A08 E003E5C8 462010A0 */  cvt.s.d   $f2, $f2
/* 352A0C E003E5CC E4A20000 */  swc1      $f2, 0x0($a1)
/* 352A10 E003E5D0 8C820008 */  lw        $v0, 0x8($a0)
/* 352A14 E003E5D4 00C2102A */  slt       $v0, $a2, $v0
/* 352A18 E003E5D8 1440FFAB */  bnez      $v0, .LE003E488
/* 352A1C E003E5DC 24A5007C */   addiu    $a1, $a1, 0x7C
.LE003E5E0:
/* 352A20 E003E5E0 8FBF0010 */  lw        $ra, 0x10($sp)
/* 352A24 E003E5E4 D7B60020 */  ldc1      $f22, 0x20($sp)
/* 352A28 E003E5E8 D7B40018 */  ldc1      $f20, 0x18($sp)
/* 352A2C E003E5EC 03E00008 */  jr        $ra
/* 352A30 E003E5F0 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

void purple_ring_update(EffectInstance* effect) {
    PurpleRingFXData* part = effect->data.purpleRing;
    s32 unk_6C;
    s32 i;

    part->unk_6C--;
    part->unk_70++;

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

    unk_6C = part->unk_6C;

    for (i = 0; i < effect->numParts; i++, part++) {
        if (unk_6C >= 6) {
            part->unk_68 += (255 - part->unk_68) * 0.3;
            part->unk_10 *= 0.8;
            part->unk_14 *= 0.8;
            part->unk_18 *= 0.8;
        }
        if (unk_6C < 5) {
            part->unk_68 *= 0.6;
            part->unk_10 *= 0.7;
            part->unk_14 *= 0.7;
            part->unk_18 *= 0.7;
        }
        part->unk_04 += part->unk_10;
        part->unk_08 += part->unk_14;
        part->unk_0C += part->unk_18;
        part->unk_5C += part->unk_60;
        part->unk_64 *= 1.05;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel kill_enemy
/* 19BAC 8003E7AC 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 19BB0 8003E7B0 AFB00010 */  sw        $s0, 0x10($sp)
/* 19BB4 8003E7B4 0080802D */  daddu     $s0, $a0, $zero
/* 19BB8 8003E7B8 AFBF0020 */  sw        $ra, 0x20($sp)
/* 19BBC 8003E7BC AFB3001C */  sw        $s3, 0x1C($sp)
/* 19BC0 8003E7C0 AFB20018 */  sw        $s2, 0x18($sp)
/* 19BC4 8003E7C4 AFB10014 */  sw        $s1, 0x14($sp)
/* 19BC8 8003E7C8 82020004 */  lb        $v0, 0x4($s0)
/* 19BCC 8003E7CC 00021080 */  sll       $v0, $v0, 2
/* 19BD0 8003E7D0 3C13800B */  lui       $s3, %hi(gCurrentEncounter + 0x28)
/* 19BD4 8003E7D4 02629821 */  addu      $s3, $s3, $v0
/* 19BD8 8003E7D8 8E730F38 */  lw        $s3, %lo(gCurrentEncounter + 0x28)($s3)
/* 19BDC 8003E7DC 8E640000 */  lw        $a0, 0x0($s3)
/* 19BE0 8003E7E0 3C12800B */  lui       $s2, %hi(gCurrentEncounter)
/* 19BE4 8003E7E4 26520F10 */  addiu     $s2, $s2, %lo(gCurrentEncounter)
/* 19BE8 8003E7E8 18800009 */  blez      $a0, .L8003E810
/* 19BEC 8003E7EC 0000882D */   daddu    $s1, $zero, $zero
/* 19BF0 8003E7F0 0260182D */  daddu     $v1, $s3, $zero
.L8003E7F4:
/* 19BF4 8003E7F4 8C620004 */  lw        $v0, 0x4($v1)
/* 19BF8 8003E7F8 10500005 */  beq       $v0, $s0, .L8003E810
/* 19BFC 8003E7FC 00000000 */   nop
/* 19C00 8003E800 26310001 */  addiu     $s1, $s1, 0x1
/* 19C04 8003E804 0224102A */  slt       $v0, $s1, $a0
/* 19C08 8003E808 1440FFFA */  bnez      $v0, .L8003E7F4
/* 19C0C 8003E80C 24630004 */   addiu    $v1, $v1, 0x4
.L8003E810:
/* 19C10 8003E810 8E020034 */  lw        $v0, 0x34($s0)
/* 19C14 8003E814 10400003 */  beqz      $v0, .L8003E824
/* 19C18 8003E818 00000000 */   nop
/* 19C1C 8003E81C 0C0B102B */  jal       kill_script_by_ID
/* 19C20 8003E820 8E04004C */   lw       $a0, 0x4C($s0)
.L8003E824:
/* 19C24 8003E824 8E020038 */  lw        $v0, 0x38($s0)
/* 19C28 8003E828 10400003 */  beqz      $v0, .L8003E838
/* 19C2C 8003E82C 00000000 */   nop
/* 19C30 8003E830 0C0B102B */  jal       kill_script_by_ID
/* 19C34 8003E834 8E040050 */   lw       $a0, 0x50($s0)
.L8003E838:
/* 19C38 8003E838 8E02003C */  lw        $v0, 0x3C($s0)
/* 19C3C 8003E83C 10400003 */  beqz      $v0, .L8003E84C
/* 19C40 8003E840 00000000 */   nop
/* 19C44 8003E844 0C0B102B */  jal       kill_script_by_ID
/* 19C48 8003E848 8E040054 */   lw       $a0, 0x54($s0)
.L8003E84C:
/* 19C4C 8003E84C 8E020040 */  lw        $v0, 0x40($s0)
/* 19C50 8003E850 10400003 */  beqz      $v0, .L8003E860
/* 19C54 8003E854 00000000 */   nop
/* 19C58 8003E858 0C0B102B */  jal       kill_script_by_ID
/* 19C5C 8003E85C 8E040058 */   lw       $a0, 0x58($s0)
.L8003E860:
/* 19C60 8003E860 8E020044 */  lw        $v0, 0x44($s0)
/* 19C64 8003E864 10400003 */  beqz      $v0, .L8003E874
/* 19C68 8003E868 00000000 */   nop
/* 19C6C 8003E86C 0C0B102B */  jal       kill_script_by_ID
/* 19C70 8003E870 8E04005C */   lw       $a0, 0x5C($s0)
.L8003E874:
/* 19C74 8003E874 8E020048 */  lw        $v0, 0x48($s0)
/* 19C78 8003E878 10400003 */  beqz      $v0, .L8003E888
/* 19C7C 8003E87C 00000000 */   nop
/* 19C80 8003E880 0C0B102B */  jal       kill_script_by_ID
/* 19C84 8003E884 8E040060 */   lw       $a0, 0x60($s0)
.L8003E888:
/* 19C88 8003E888 86040008 */  lh        $a0, 0x8($s0)
/* 19C8C 8003E88C AE000020 */  sw        $zero, 0x20($s0)
/* 19C90 8003E890 AE000024 */  sw        $zero, 0x24($s0)
/* 19C94 8003E894 AE000028 */  sw        $zero, 0x28($s0)
/* 19C98 8003E898 AE00002C */  sw        $zero, 0x2C($s0)
/* 19C9C 8003E89C 0C00EABB */  jal       get_npc_unsafe
/* 19CA0 8003E8A0 AE000030 */   sw       $zero, 0x30($s0)
/* 19CA4 8003E8A4 0C00E273 */  jal       free_npc
/* 19CA8 8003E8A8 0040202D */   daddu    $a0, $v0, $zero
/* 19CAC 8003E8AC 8E040064 */  lw        $a0, 0x64($s0)
/* 19CB0 8003E8B0 50800004 */  beql      $a0, $zero, .L8003E8C4
/* 19CB4 8003E8B4 0000202D */   daddu    $a0, $zero, $zero
/* 19CB8 8003E8B8 0C00AB4B */  jal       heap_free
/* 19CBC 8003E8BC 00000000 */   nop
/* 19CC0 8003E8C0 0000202D */  daddu     $a0, $zero, $zero
.L8003E8C4:
/* 19CC4 8003E8C4 0260182D */  daddu     $v1, $s3, $zero
.L8003E8C8:
/* 19CC8 8003E8C8 8C620004 */  lw        $v0, 0x4($v1)
/* 19CCC 8003E8CC 50500001 */  beql      $v0, $s0, .L8003E8D4
/* 19CD0 8003E8D0 AC600004 */   sw       $zero, 0x4($v1)
.L8003E8D4:
/* 19CD4 8003E8D4 24840001 */  addiu     $a0, $a0, 0x1
/* 19CD8 8003E8D8 28820010 */  slti      $v0, $a0, 0x10
/* 19CDC 8003E8DC 1440FFFA */  bnez      $v0, .L8003E8C8
/* 19CE0 8003E8E0 24630004 */   addiu    $v1, $v1, 0x4
/* 19CE4 8003E8E4 8E030000 */  lw        $v1, 0x0($s0)
/* 19CE8 8003E8E8 30620004 */  andi      $v0, $v1, 0x4
/* 19CEC 8003E8EC 1440000E */  bnez      $v0, .L8003E928
/* 19CF0 8003E8F0 30620008 */   andi     $v0, $v1, 0x8
/* 19CF4 8003E8F4 10400004 */  beqz      $v0, .L8003E908
/* 19CF8 8003E8F8 30620001 */   andi     $v0, $v1, 0x1
/* 19CFC 8003E8FC 8E42008C */  lw        $v0, 0x8C($s2)
/* 19D00 8003E900 16020009 */  bne       $s0, $v0, .L8003E928
/* 19D04 8003E904 30620001 */   andi     $v0, $v1, 0x1
.L8003E908:
/* 19D08 8003E908 14400007 */  bnez      $v0, .L8003E928
/* 19D0C 8003E90C 30620010 */   andi     $v0, $v1, 0x10
/* 19D10 8003E910 14400005 */  bnez      $v0, .L8003E928
/* 19D14 8003E914 00000000 */   nop
/* 19D18 8003E918 86650048 */  lh        $a1, 0x48($s3)
/* 19D1C 8003E91C 82440020 */  lb        $a0, 0x20($s2)
/* 19D20 8003E920 0C00F8B8 */  jal       COPY_set_defeated
/* 19D24 8003E924 00B12821 */   addu     $a1, $a1, $s1
.L8003E928:
/* 19D28 8003E928 0C00AB4B */  jal       heap_free
/* 19D2C 8003E92C 0200202D */   daddu    $a0, $s0, $zero
/* 19D30 8003E930 8FBF0020 */  lw        $ra, 0x20($sp)
/* 19D34 8003E934 8FB3001C */  lw        $s3, 0x1C($sp)
/* 19D38 8003E938 8FB20018 */  lw        $s2, 0x18($sp)
/* 19D3C 8003E93C 8FB10014 */  lw        $s1, 0x14($sp)
/* 19D40 8003E940 8FB00010 */  lw        $s0, 0x10($sp)
/* 19D44 8003E944 03E00008 */  jr        $ra
/* 19D48 8003E948 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

void kill_enemy(Enemy* enemy) {
    EncounterStatus* encounterStatus = &gCurrentEncounter;
    Encounter* encounter = encounterStatus->encounterList[enemy->encounterIndex];
    s32 i;
    s32 j;

    for (i = 0; i < encounter->count; i++) {
        Enemy* currentEnemy = encounter->enemy[i];
        if (currentEnemy == enemy) {
            break;
        }
    }

    if (enemy->initScript != NULL) {
        kill_script_by_ID(enemy->initScriptID);
    }
    if (enemy->interactScript != NULL) {
        kill_script_by_ID(enemy->interactScriptID);
    }
    if (enemy->aiScript != NULL) {
        kill_script_by_ID(enemy->aiScriptID);
    }
    if (enemy->hitScript != NULL) {
        kill_script_by_ID(enemy->hitScriptID);
    }
    if (enemy->auxScript != NULL) {
        kill_script_by_ID(enemy->auxScriptID);
    }
    if (enemy->defeatScript != NULL) {
        kill_script_by_ID(enemy->defeatScriptID);
    }

    enemy->interactBytecode = NULL;
    enemy->aiBytecode = NULL;
    enemy->hitBytecode = NULL;
    enemy->auxBytecode = NULL;
    enemy->defeatBytecode = NULL;

    free_npc(get_npc_unsafe(enemy->npcID));

    if (enemy->unk_64 != NULL) {
        heap_free(enemy->unk_64);
    }

    for (j = 0; j < ARRAY_COUNT(encounter->enemy); j++) {
        if (encounter->enemy[j] == enemy) {
            encounter->enemy[j] = NULL;
        }
    }

    do {
        if (!(enemy->flags & ENEMY_FLAG_4)
            && (!(enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) || (enemy == encounterStatus->currentEnemy))
            && !(enemy->flags & ENEMY_FLAG_PASSIVE)
        ) {
            if (!(enemy->flags & ENEMY_FLAG_FLED)) {
                COPY_set_defeated(encounterStatus->mapID, encounter->encounterID + i);
            }
        }
    } while (0); // required to match

    heap_free(enemy);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel set_model_group_visibility
/* B1EC0 8011B7C0 3084FFFF */  andi      $a0, $a0, 0xFFFF
/* B1EC4 8011B7C4 3C0A800A */  lui       $t2, %hi(mdl_currentModelTreeNodeInfo)
/* B1EC8 8011B7C8 8D4AA5F4 */  lw        $t2, %lo(mdl_currentModelTreeNodeInfo)($t2)
/* B1ECC 8011B7CC 00041080 */  sll       $v0, $a0, 2
/* B1ED0 8011B7D0 004A3821 */  addu      $a3, $v0, $t2
/* B1ED4 8011B7D4 90E30000 */  lbu       $v1, 0x0($a3)
/* B1ED8 8011B7D8 286200FF */  slti      $v0, $v1, 0xFF
/* B1EDC 8011B7DC 10400004 */  beqz      $v0, .L8011B7F0
/* B1EE0 8011B7E0 2408FFFF */   addiu    $t0, $zero, -0x1
/* B1EE4 8011B7E4 0060402D */  daddu     $t0, $v1, $zero
/* B1EE8 8011B7E8 08046E10 */  j         .L8011B840
/* B1EEC 8011B7EC 0100482D */   daddu    $t1, $t0, $zero
.L8011B7F0:
/* B1EF0 8011B7F0 2484FFFF */  addiu     $a0, $a0, -0x1
/* B1EF4 8011B7F4 90EB0001 */  lbu       $t3, 0x1($a3)
/* B1EF8 8011B7F8 04800011 */  bltz      $a0, .L8011B840
/* B1EFC 8011B7FC 00041080 */   sll      $v0, $a0, 2
/* B1F00 8011B800 240CFFFF */  addiu     $t4, $zero, -0x1
/* B1F04 8011B804 004A3821 */  addu      $a3, $v0, $t2
.L8011B808:
/* B1F08 8011B808 90E20001 */  lbu       $v0, 0x1($a3)
/* B1F0C 8011B80C 0162102A */  slt       $v0, $t3, $v0
/* B1F10 8011B810 1040000C */  beqz      $v0, .L8011B844
/* B1F14 8011B814 28C20002 */   slti     $v0, $a2, 0x2
/* B1F18 8011B818 90E30000 */  lbu       $v1, 0x0($a3)
/* B1F1C 8011B81C 286200FF */  slti      $v0, $v1, 0xFF
/* B1F20 8011B820 50400005 */  beql      $v0, $zero, .L8011B838
/* B1F24 8011B824 2484FFFF */   addiu    $a0, $a0, -0x1
/* B1F28 8011B828 510C0001 */  beql      $t0, $t4, .L8011B830
/* B1F2C 8011B82C 0060402D */   daddu    $t0, $v1, $zero
.L8011B830:
/* B1F30 8011B830 0060482D */  daddu     $t1, $v1, $zero
/* B1F34 8011B834 2484FFFF */  addiu     $a0, $a0, -0x1
.L8011B838:
/* B1F38 8011B838 0481FFF3 */  bgez      $a0, .L8011B808
/* B1F3C 8011B83C 24E7FFFC */   addiu    $a3, $a3, -0x4
.L8011B840:
/* B1F40 8011B840 28C20002 */  slti      $v0, $a2, 0x2
.L8011B844:
/* B1F44 8011B844 10400016 */  beqz      $v0, .L8011B8A0
/* B1F48 8011B848 0120202D */   daddu    $a0, $t1, $zero
/* B1F4C 8011B84C 0104102A */  slt       $v0, $t0, $a0
/* B1F50 8011B850 14400011 */  bnez      $v0, .L8011B898
/* B1F54 8011B854 00054827 */   nor      $t1, $zero, $a1
/* B1F58 8011B858 3C038015 */  lui       $v1, %hi(gCurrentModels)
/* B1F5C 8011B85C 8C6312CC */  lw        $v1, %lo(gCurrentModels)($v1)
/* B1F60 8011B860 00041080 */  sll       $v0, $a0, 2
/* B1F64 8011B864 00433821 */  addu      $a3, $v0, $v1
.L8011B868:
/* B1F68 8011B868 10C00004 */  beqz      $a2, .L8011B87C
/* B1F6C 8011B86C 8CE30000 */   lw       $v1, 0x0($a3)
/* B1F70 8011B870 94620000 */  lhu       $v0, 0x0($v1)
/* B1F74 8011B874 08046E21 */  j         .L8011B884
/* B1F78 8011B878 00491024 */   and      $v0, $v0, $t1
.L8011B87C:
/* B1F7C 8011B87C 94620000 */  lhu       $v0, 0x0($v1)
/* B1F80 8011B880 00451025 */  or        $v0, $v0, $a1
.L8011B884:
/* B1F84 8011B884 A4620000 */  sh        $v0, 0x0($v1)
/* B1F88 8011B888 24840001 */  addiu     $a0, $a0, 0x1
/* B1F8C 8011B88C 0104102A */  slt       $v0, $t0, $a0
/* B1F90 8011B890 1040FFF5 */  beqz      $v0, .L8011B868
/* B1F94 8011B894 24E70004 */   addiu    $a3, $a3, 0x4
.L8011B898:
/* B1F98 8011B898 03E00008 */  jr        $ra
/* B1F9C 8011B89C 00000000 */   nop
.L8011B8A0:
/* B1FA0 8011B8A0 19200011 */  blez      $t1, .L8011B8E8
/* B1FA4 8011B8A4 0000202D */   daddu    $a0, $zero, $zero
/* B1FA8 8011B8A8 240B0003 */  addiu     $t3, $zero, 0x3
/* B1FAC 8011B8AC 00055027 */  nor       $t2, $zero, $a1
/* B1FB0 8011B8B0 3C078015 */  lui       $a3, %hi(gCurrentModels)
/* B1FB4 8011B8B4 8CE712CC */  lw        $a3, %lo(gCurrentModels)($a3)
.L8011B8B8:
/* B1FB8 8011B8B8 14CB0004 */  bne       $a2, $t3, .L8011B8CC
/* B1FBC 8011B8BC 8CE30000 */   lw       $v1, 0x0($a3)
/* B1FC0 8011B8C0 94620000 */  lhu       $v0, 0x0($v1)
/* B1FC4 8011B8C4 08046E35 */  j         .L8011B8D4
/* B1FC8 8011B8C8 004A1024 */   and      $v0, $v0, $t2
.L8011B8CC:
/* B1FCC 8011B8CC 94620000 */  lhu       $v0, 0x0($v1)
/* B1FD0 8011B8D0 00451025 */  or        $v0, $v0, $a1
.L8011B8D4:
/* B1FD4 8011B8D4 A4620000 */  sh        $v0, 0x0($v1)
/* B1FD8 8011B8D8 24840001 */  addiu     $a0, $a0, 0x1
/* B1FDC 8011B8DC 0089102A */  slt       $v0, $a0, $t1
/* B1FE0 8011B8E0 1440FFF5 */  bnez      $v0, .L8011B8B8
/* B1FE4 8011B8E4 24E70004 */   addiu    $a3, $a3, 0x4
.L8011B8E8:
/* B1FE8 8011B8E8 25040001 */  addiu     $a0, $t0, 0x1
/* B1FEC 8011B8EC 28820100 */  slti      $v0, $a0, 0x100
/* B1FF0 8011B8F0 1040FFE9 */  beqz      $v0, .L8011B898
/* B1FF4 8011B8F4 24090003 */   addiu    $t1, $zero, 0x3
/* B1FF8 8011B8F8 00054027 */  nor       $t0, $zero, $a1
/* B1FFC 8011B8FC 3C038015 */  lui       $v1, %hi(gCurrentModels)
/* B2000 8011B900 8C6312CC */  lw        $v1, %lo(gCurrentModels)($v1)
/* B2004 8011B904 00041080 */  sll       $v0, $a0, 2
/* B2008 8011B908 00433821 */  addu      $a3, $v0, $v1
.L8011B90C:
/* B200C 8011B90C 8CE30000 */  lw        $v1, 0x0($a3)
/* B2010 8011B910 5060000A */  beql      $v1, $zero, .L8011B93C
/* B2014 8011B914 24840001 */   addiu    $a0, $a0, 0x1
/* B2018 8011B918 14C90004 */  bne       $a2, $t1, .L8011B92C
/* B201C 8011B91C 00000000 */   nop
/* B2020 8011B920 94620000 */  lhu       $v0, 0x0($v1)
/* B2024 8011B924 08046E4D */  j         .L8011B934
/* B2028 8011B928 00481024 */   and      $v0, $v0, $t0
.L8011B92C:
/* B202C 8011B92C 94620000 */  lhu       $v0, 0x0($v1)
/* B2030 8011B930 00451025 */  or        $v0, $v0, $a1
.L8011B934:
/* B2034 8011B934 A4620000 */  sh        $v0, 0x0($v1)
/* B2038 8011B938 24840001 */  addiu     $a0, $a0, 0x1
.L8011B93C:
/* B203C 8011B93C 28820100 */  slti      $v0, $a0, 0x100
/* B2040 8011B940 1440FFF2 */  bnez      $v0, .L8011B90C
/* B2044 8011B944 24E70004 */   addiu    $a3, $a3, 0x4
/* B2048 8011B948 03E00008 */  jr        $ra
/* B204C 8011B94C 00000000 */   nop

### DECOMPILED C INSTRUCTIONS:

void set_model_group_visibility(u16 treeIndex, s32 flags, s32 mode) {
    s32 maxGroupIndex = -1;
    s32 minGroupIndex;
    s32 modelIndex = (*mdl_currentModelTreeNodeInfo)[treeIndex].modelIndex;
    s32 siblingIndex;
    s32 i;

    if (modelIndex < MAX_MODELS - 1) {
        minGroupIndex = maxGroupIndex = modelIndex;
    } else {
        s32 treeDepth = (*mdl_currentModelTreeNodeInfo)[treeIndex].treeDepth;
        for (i = treeIndex - 1; i >= 0; i--) {
            if ((*mdl_currentModelTreeNodeInfo)[i].treeDepth <= treeDepth) {
                break;
            }

            siblingIndex = (*mdl_currentModelTreeNodeInfo)[i].modelIndex;

            if (siblingIndex < MAX_MODELS - 1) {
                if (maxGroupIndex == -1) {
                    maxGroupIndex = siblingIndex;
                }
                minGroupIndex = siblingIndex;
            }
        }
    }

    if (mode < 2) {
        for (i = minGroupIndex; i <= maxGroupIndex; i++) {
            Model* model = (*gCurrentModels)[i];
            if (mode != MODEL_GROUP_HIDDEN) {
                model->flags &= ~flags;
            } else {
                model->flags |= flags;
            }
        }
    } else {
        for (i = 0; i < minGroupIndex; i++) {
            Model* model = (*gCurrentModels)[i];
            if (mode == MODEL_GROUP_OTHERS_VISIBLE) {
                model->flags &= ~flags;
            } else {
                model->flags |= flags;
            }
        }
        for (i = maxGroupIndex + 1; i < MAX_MODELS; i++) {
            Model* model = (*gCurrentModels)[i];
            if (model != NULL) {
                if (mode == MODEL_GROUP_OTHERS_VISIBLE) {
                    model->flags &= ~flags;
                } else {
                    model->flags |= flags;
                }
            }
        }
    }
}