### RAW ASSEMBLY INSTRUCTIONS:

glabel spr_draw_player_sprite
/* 100D30 802DDC40 27BDFFB0 */  addiu     $sp, $sp, -0x50
/* 100D34 802DDC44 308A00FF */  andi      $t2, $a0, 0xFF
/* 100D38 802DDC48 000A1040 */  sll       $v0, $t2, 1
/* 100D3C 802DDC4C 004A1021 */  addu      $v0, $v0, $t2
/* 100D40 802DDC50 00021080 */  sll       $v0, $v0, 2
/* 100D44 802DDC54 2403FFFF */  addiu     $v1, $zero, -0x1
/* 100D48 802DDC58 AFBF0040 */  sw        $ra, 0x40($sp)
/* 100D4C 802DDC5C AFB7003C */  sw        $s7, 0x3C($sp)
/* 100D50 802DDC60 AFB60038 */  sw        $s6, 0x38($sp)
/* 100D54 802DDC64 AFB50034 */  sw        $s5, 0x34($sp)
/* 100D58 802DDC68 AFB40030 */  sw        $s4, 0x30($sp)
/* 100D5C 802DDC6C AFB3002C */  sw        $s3, 0x2C($sp)
/* 100D60 802DDC70 AFB20028 */  sw        $s2, 0x28($sp)
/* 100D64 802DDC74 AFB10024 */  sw        $s1, 0x24($sp)
/* 100D68 802DDC78 AFB00020 */  sw        $s0, 0x20($sp)
/* 100D6C 802DDC7C F7B40048 */  sdc1      $f20, 0x48($sp)
/* 100D70 802DDC80 3C09802E */  lui       $t1, %hi(D_802DF58C)
/* 100D74 802DDC84 01224821 */  addu      $t1, $t1, $v0
/* 100D78 802DDC88 8D29F58C */  lw        $t1, %lo(D_802DF58C)($t1)
/* 100D7C 802DDC8C 8FB70060 */  lw        $s7, 0x60($sp)
/* 100D80 802DDC90 11230080 */  beq       $t1, $v1, .L802DDE94
/* 100D84 802DDC94 0000102D */   daddu    $v0, $zero, $zero
/* 100D88 802DDC98 00091403 */  sra       $v0, $t1, 16
/* 100D8C 802DDC9C 304200FF */  andi      $v0, $v0, 0xFF
/* 100D90 802DDCA0 2443FFFF */  addiu     $v1, $v0, -0x1
/* 100D94 802DDCA4 00031080 */  sll       $v0, $v1, 2
/* 100D98 802DDCA8 3C08802E */  lui       $t0, %hi(spr_playerSprites)
/* 100D9C 802DDCAC 01024021 */  addu      $t0, $t0, $v0
/* 100DA0 802DDCB0 8D08F548 */  lw        $t0, %lo(spr_playerSprites)($t0)
/* 100DA4 802DDCB4 3C01802E */  lui       $at, %hi(D_802DF57C)
/* 100DA8 802DDCB8 AC23F57C */  sw        $v1, %lo(D_802DF57C)($at)
/* 100DAC 802DDCBC 11000053 */  beqz      $t0, .L802DDE0C
/* 100DB0 802DDCC0 312200FF */   andi     $v0, $t1, 0xFF
/* 100DB4 802DDCC4 8D140000 */  lw        $s4, 0x0($t0)
/* 100DB8 802DDCC8 25080004 */  addiu     $t0, $t0, 0x4
/* 100DBC 802DDCCC 00021080 */  sll       $v0, $v0, 2
/* 100DC0 802DDCD0 01021021 */  addu      $v0, $t0, $v0
/* 100DC4 802DDCD4 8C52000C */  lw        $s2, 0xC($v0)
/* 100DC8 802DDCD8 3C020100 */  lui       $v0, (0x1000000 >> 16)
/* 100DCC 802DDCDC 01221024 */  and       $v0, $t1, $v0
/* 100DD0 802DDCE0 8D160000 */  lw        $s6, 0x0($t0)
/* 100DD4 802DDCE4 10400013 */  beqz      $v0, .L802DDD34
/* 100DD8 802DDCE8 24020005 */   addiu    $v0, $zero, 0x5
/* 100DDC 802DDCEC 10620009 */  beq       $v1, $v0, .L802DDD14
/* 100DE0 802DDCF0 28620006 */   slti     $v0, $v1, 0x6
/* 100DE4 802DDCF4 10400005 */  beqz      $v0, .L802DDD0C
/* 100DE8 802DDCF8 24020009 */   addiu    $v0, $zero, 0x9
/* 100DEC 802DDCFC 10600005 */  beqz      $v1, .L802DDD14
/* 100DF0 802DDD00 3C024000 */   lui      $v0, (0x40000000 >> 16)
/* 100DF4 802DDD04 080B774F */  j         .L802DDD3C
/* 100DF8 802DDD08 00821024 */   and      $v0, $a0, $v0
.L802DDD0C:
/* 100DFC 802DDD0C 1462000A */  bne       $v1, $v0, .L802DDD38
/* 100E00 802DDD10 3C024000 */   lui      $v0, (0x40000000 >> 16)
.L802DDD14:
/* 100E04 802DDD14 24630001 */  addiu     $v1, $v1, 0x1
/* 100E08 802DDD18 00031080 */  sll       $v0, $v1, 2
/* 100E0C 802DDD1C 3C14802E */  lui       $s4, %hi(spr_playerSprites)
/* 100E10 802DDD20 0282A021 */  addu      $s4, $s4, $v0
/* 100E14 802DDD24 8E94F548 */  lw        $s4, %lo(spr_playerSprites)($s4)
/* 100E18 802DDD28 3C01802E */  lui       $at, %hi(D_802DF57C)
/* 100E1C 802DDD2C AC23F57C */  sw        $v1, %lo(D_802DF57C)($at)
/* 100E20 802DDD30 8E940000 */  lw        $s4, 0x0($s4)
.L802DDD34:
/* 100E24 802DDD34 3C024000 */  lui       $v0, (0x40000000 >> 16)
.L802DDD38:
/* 100E28 802DDD38 00821024 */  and       $v0, $a0, $v0
.L802DDD3C:
/* 100E2C 802DDD3C 14400019 */  bnez      $v0, .L802DDDA4
/* 100E30 802DDD40 24A2FFA5 */   addiu    $v0, $a1, -0x5B
/* 100E34 802DDD44 3C03800A */  lui       $v1, %hi(gCurrentCamID)
/* 100E38 802DDD48 8463A634 */  lh        $v1, %lo(gCurrentCamID)($v1)
/* 100E3C 802DDD4C 00031080 */  sll       $v0, $v1, 2
/* 100E40 802DDD50 00431021 */  addu      $v0, $v0, $v1
/* 100E44 802DDD54 00021080 */  sll       $v0, $v0, 2
/* 100E48 802DDD58 00431023 */  subu      $v0, $v0, $v1
/* 100E4C 802DDD5C 000218C0 */  sll       $v1, $v0, 3
/* 100E50 802DDD60 00431021 */  addu      $v0, $v0, $v1
/* 100E54 802DDD64 000210C0 */  sll       $v0, $v0, 3
/* 100E58 802DDD68 3C01800B */  lui       $at, %hi(gCameras + 0x6C)
/* 100E5C 802DDD6C 00220821 */  addu      $at, $at, $v0
/* 100E60 802DDD70 C4201DEC */  lwc1      $f0, %lo(gCameras + 0x6C)($at)
/* 100E64 802DDD74 46000007 */  neg.s     $f0, $f0
/* 100E68 802DDD78 4600008D */  trunc.w.s $f2, $f0
/* 100E6C 802DDD7C 44021000 */  mfc1      $v0, $f2
/* 100E70 802DDD80 00000000 */  nop
/* 100E74 802DDD84 00A22821 */  addu      $a1, $a1, $v0
/* 100E78 802DDD88 28A20169 */  slti      $v0, $a1, 0x169
/* 100E7C 802DDD8C 50400001 */  beql      $v0, $zero, .L802DDD94
/* 100E80 802DDD90 24A5FE98 */   addiu    $a1, $a1, -0x168
.L802DDD94:
/* 100E84 802DDD94 28A2FE98 */  slti      $v0, $a1, -0x168
/* 100E88 802DDD98 54400001 */  bnel      $v0, $zero, .L802DDDA0
/* 100E8C 802DDD9C 24A50168 */   addiu    $a1, $a1, 0x168
.L802DDDA0:
/* 100E90 802DDDA0 24A2FFA5 */  addiu     $v0, $a1, -0x5B
.L802DDDA4:
/* 100E94 802DDDA4 2C4200B4 */  sltiu     $v0, $v0, 0xB4
/* 100E98 802DDDA8 14400004 */  bnez      $v0, .L802DDDBC
/* 100E9C 802DDDAC 24A2010E */   addiu    $v0, $a1, 0x10E
/* 100EA0 802DDDB0 2C4200B4 */  sltiu     $v0, $v0, 0xB4
/* 100EA4 802DDDB4 10400005 */  beqz      $v0, .L802DDDCC
/* 100EA8 802DDDB8 3C021000 */   lui      $v0, (0x10000000 >> 16)
.L802DDDBC:
/* 100EAC 802DDDBC 3C01BFC0 */  lui       $at, (0xBFC00000 >> 16)
/* 100EB0 802DDDC0 4481A000 */  mtc1      $at, $f20
/* 100EB4 802DDDC4 080B7775 */  j         .L802DDDD4
/* 100EB8 802DDDC8 3C021000 */   lui      $v0, (0x10000000 >> 16)
.L802DDDCC:
/* 100EBC 802DDDCC 3C013FC0 */  lui       $at, (0x3FC00000 >> 16)
/* 100EC0 802DDDD0 4481A000 */  mtc1      $at, $f20
.L802DDDD4:
/* 100EC4 802DDDD4 00821024 */  and       $v0, $a0, $v0
/* 100EC8 802DDDD8 10400004 */  beqz      $v0, .L802DDDEC
/* 100ECC 802DDDDC 00000000 */   nop
/* 100ED0 802DDDE0 44800000 */  mtc1      $zero, $f0
/* 100ED4 802DDDE4 00000000 */  nop
/* 100ED8 802DDDE8 46140501 */  sub.s     $f20, $f0, $f20
.L802DDDEC:
/* 100EDC 802DDDEC 3C02802E */  lui       $v0, %hi(D_802DFEA0)
/* 100EE0 802DDDF0 2442FEA0 */  addiu     $v0, $v0, %lo(D_802DFEA0)
/* 100EE4 802DDDF4 AC400000 */  sw        $zero, 0x0($v0)
/* 100EE8 802DDDF8 AC450004 */  sw        $a1, 0x4($v0)
/* 100EEC 802DDDFC 04810005 */  bgez      $a0, .L802DDE14
/* 100EF0 802DDE00 AC400008 */   sw       $zero, 0x8($v0)
/* 100EF4 802DDE04 14C00004 */  bnez      $a2, .L802DDE18
/* 100EF8 802DDE08 30D300FF */   andi     $s3, $a2, 0xFF
.L802DDE0C:
/* 100EFC 802DDE0C 080B77A5 */  j         .L802DDE94
/* 100F00 802DDE10 0000102D */   daddu    $v0, $zero, $zero
.L802DDE14:
/* 100F04 802DDE14 241300FF */  addiu     $s3, $zero, 0xFF
.L802DDE18:
/* 100F08 802DDE18 000A1040 */  sll       $v0, $t2, 1
/* 100F0C 802DDE1C 004A1021 */  addu      $v0, $v0, $t2
/* 100F10 802DDE20 00021080 */  sll       $v0, $v0, 2
/* 100F14 802DDE24 3C10802E */  lui       $s0, %hi(spr_playerCurrentAnimInfo)
/* 100F18 802DDE28 02028021 */  addu      $s0, $s0, $v0
/* 100F1C 802DDE2C 8E10F588 */  lw        $s0, %lo(spr_playerCurrentAnimInfo)($s0)
/* 100F20 802DDE30 3C022000 */  lui       $v0, (0x20000000 >> 16)
/* 100F24 802DDE34 00821024 */  and       $v0, $a0, $v0
/* 100F28 802DDE38 54400001 */  bnel      $v0, $zero, .L802DDE40
/* 100F2C 802DDE3C 00E0B02D */   daddu    $s6, $a3, $zero
.L802DDE40:
/* 100F30 802DDE40 8E030000 */  lw        $v1, 0x0($s0)
/* 100F34 802DDE44 2402FFFF */  addiu     $v0, $zero, -0x1
/* 100F38 802DDE48 10620011 */  beq       $v1, $v0, .L802DDE90
/* 100F3C 802DDE4C 3C150800 */   lui      $s5, (0x8000000 >> 16)
/* 100F40 802DDE50 0040882D */  daddu     $s1, $v0, $zero
.L802DDE54:
/* 100F44 802DDE54 8E050000 */  lw        $a1, 0x0($s0)
/* 100F48 802DDE58 02752025 */  or        $a0, $s3, $s5
/* 100F4C 802DDE5C AFB60010 */  sw        $s6, 0x10($sp)
/* 100F50 802DDE60 E7B40014 */  swc1      $f20, 0x14($sp)
/* 100F54 802DDE64 AFB70018 */  sw        $s7, 0x18($sp)
/* 100F58 802DDE68 8E460000 */  lw        $a2, 0x0($s2)
/* 100F5C 802DDE6C 0C0B73B7 */  jal       spr_draw_component
/* 100F60 802DDE70 0280382D */   daddu    $a3, $s4, $zero
/* 100F64 802DDE74 8E420000 */  lw        $v0, 0x0($s2)
/* 100F68 802DDE78 10510002 */  beq       $v0, $s1, .L802DDE84
/* 100F6C 802DDE7C 26100004 */   addiu    $s0, $s0, 0x4
/* 100F70 802DDE80 26520004 */  addiu     $s2, $s2, 0x4
.L802DDE84:
/* 100F74 802DDE84 8E020000 */  lw        $v0, 0x0($s0)
/* 100F78 802DDE88 1451FFF2 */  bne       $v0, $s1, .L802DDE54
/* 100F7C 802DDE8C 00000000 */   nop
.L802DDE90:
/* 100F80 802DDE90 24020001 */  addiu     $v0, $zero, 0x1
.L802DDE94:
/* 100F84 802DDE94 8FBF0040 */  lw        $ra, 0x40($sp)
/* 100F88 802DDE98 8FB7003C */  lw        $s7, 0x3C($sp)
/* 100F8C 802DDE9C 8FB60038 */  lw        $s6, 0x38($sp)
/* 100F90 802DDEA0 8FB50034 */  lw        $s5, 0x34($sp)
/* 100F94 802DDEA4 8FB40030 */  lw        $s4, 0x30($sp)
/* 100F98 802DDEA8 8FB3002C */  lw        $s3, 0x2C($sp)
/* 100F9C 802DDEAC 8FB20028 */  lw        $s2, 0x28($sp)
/* 100FA0 802DDEB0 8FB10024 */  lw        $s1, 0x24($sp)
/* 100FA4 802DDEB4 8FB00020 */  lw        $s0, 0x20($sp)
/* 100FA8 802DDEB8 D7B40048 */  ldc1      $f20, 0x48($sp)
/* 100FAC 802DDEBC 03E00008 */  jr        $ra
/* 100FB0 802DDEC0 27BD0050 */   addiu    $sp, $sp, 0x50

### DECOMPILED C INSTRUCTIONS:

s32 spr_draw_player_sprite(s32 spriteInstanceID, s32 yaw, s32 alphaIn, PAL_PTR* paletteList, Matrix4f mtx) {
    s32 instanceIdx = spriteInstanceID & 0xFF;
    s32 animID = spr_playerCurrentAnimInfo[instanceIdx].animID;
    SpriteRasterCacheEntry** rasters;
    PAL_PTR* palettes;
    SpriteAnimComponent** animComponents;
    SpriteComponent** components;
    f32 zscale;
    u32 alpha;
    u32* spriteData;
    s32 spriteId;
    s32 spriteIdBackFacing;

    if (animID == ANIM_LIST_END) {
        return FALSE;
    }

    D_802DF57C = spriteId = ((animID >> 0x10) & 0xFF) - 1;
    spriteData = (u32*)spr_playerSprites[spriteId];
    if (spriteData == NULL) {
        return FALSE;
    }

    // TODO: fake match or not?
    rasters = (SpriteRasterCacheEntry**)*spriteData++;
    palettes = (PAL_PTR*)*spriteData++;
    spriteData++;
    spriteData++;
    animComponents = (SpriteAnimComponent**)spriteData[animID & 0xFF];

    if (animID & SPRITE_ID_BACK_FACING) {
        switch (spriteId) {
            case 0:
            case 5:
            case 9:
                spriteIdBackFacing = spriteId + 1;
                // TODO find better match
                rasters = (SpriteRasterCacheEntry**)spr_playerSprites[spriteIdBackFacing];
                D_802DF57C = spriteIdBackFacing;
                rasters = (SpriteRasterCacheEntry**)*rasters;
                break;
        }
    }

    if (!(spriteInstanceID & DRAW_SPRITE_OVERRIDE_YAW)) {
        yaw += (s32)-gCameras[gCurrentCamID].currentYaw;
        if (yaw > 360) {
            yaw -= 360;
        }
        if (yaw < -360) {
            yaw += 360;
        }
    }

    if (yaw > 90 && yaw <= 270 || yaw >= -270 && yaw < -90) {
        zscale = -1.5f;
    } else {
        zscale = 1.5f;
    }

    if (spriteInstanceID & DRAW_SPRITE_UPSIDE_DOWN) {
        zscale = 0.0f - zscale;
    }

    D_802DFEA0[0] = 0;
    D_802DFEA0[1] = yaw;
    D_802DFEA0[2] = 0;

    if (spriteInstanceID & DRAW_SPRITE_OVERRIDE_ALPHA) {
        alpha = alphaIn & 0xFF;
        if (alphaIn == 0) {
            return FALSE;
        }
    } else {
        alpha = 255;
    }

    components = spr_playerCurrentAnimInfo[instanceIdx].componentList;
    if (spriteInstanceID & DRAW_SPRITE_OVERRIDE_PALETTES) {
        palettes = paletteList;
    }

    while (*components != PTR_LIST_END) {
        spr_draw_component(alpha | DRAW_SPRITE_USE_PLAYER_RASTERS, *components++, *animComponents, rasters, palettes, zscale, mtx);
        if (*animComponents != PTR_LIST_END) {
            animComponents++;
        }
    }

    return TRUE;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel npc_do_other_npc_collision
/* 1440C 8003900C 27BDFFA0 */  addiu     $sp, $sp, -0x60
/* 14410 80039010 AFB1001C */  sw        $s1, 0x1C($sp)
/* 14414 80039014 0080882D */  daddu     $s1, $a0, $zero
/* 14418 80039018 AFBF0028 */  sw        $ra, 0x28($sp)
/* 1441C 8003901C AFB30024 */  sw        $s3, 0x24($sp)
/* 14420 80039020 AFB20020 */  sw        $s2, 0x20($sp)
/* 14424 80039024 AFB00018 */  sw        $s0, 0x18($sp)
/* 14428 80039028 F7BE0058 */  sdc1      $f30, 0x58($sp)
/* 1442C 8003902C F7BC0050 */  sdc1      $f28, 0x50($sp)
/* 14430 80039030 F7BA0048 */  sdc1      $f26, 0x48($sp)
/* 14434 80039034 F7B80040 */  sdc1      $f24, 0x40($sp)
/* 14438 80039038 F7B60038 */  sdc1      $f22, 0x38($sp)
/* 1443C 8003903C F7B40030 */  sdc1      $f20, 0x30($sp)
/* 14440 80039040 8E230000 */  lw        $v1, 0x0($s1)
/* 14444 80039044 30620100 */  andi      $v0, $v1, 0x100
/* 14448 80039048 14400096 */  bnez      $v0, .L800392A4
/* 1444C 8003904C 3C02FDFF */   lui      $v0, (0xFDFFFFFF >> 16)
/* 14450 80039050 3442FFFF */  ori       $v0, $v0, (0xFDFFFFFF & 0xFFFF)
/* 14454 80039054 0000902D */  daddu     $s2, $zero, $zero
/* 14458 80039058 3C130400 */  lui       $s3, (0x4000000 >> 16)
/* 1445C 8003905C C63E0038 */  lwc1      $f30, 0x38($s1)
/* 14460 80039060 C626003C */  lwc1      $f6, 0x3C($s1)
/* 14464 80039064 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* 14468 80039068 44811000 */  mtc1      $at, $f2
/* 1446C 8003906C 00621024 */  and       $v0, $v1, $v0
/* 14470 80039070 E7A60010 */  swc1      $f6, 0x10($sp)
/* 14474 80039074 AE220000 */  sw        $v0, 0x0($s1)
/* 14478 80039078 862200A6 */  lh        $v0, 0xA6($s1)
/* 1447C 8003907C C63C0040 */  lwc1      $f28, 0x40($s1)
/* 14480 80039080 44820000 */  mtc1      $v0, $f0
/* 14484 80039084 00000000 */  nop
/* 14488 80039088 46800020 */  cvt.s.w   $f0, $f0
/* 1448C 8003908C 46020002 */  mul.s     $f0, $f0, $f2
/* 14490 80039090 00000000 */  nop
/* 14494 80039094 E7A00014 */  swc1      $f0, 0x14($sp)
.L80039098:
/* 14498 80039098 0C00E2B7 */  jal       get_npc_by_index
/* 1449C 8003909C 0240202D */   daddu    $a0, $s2, $zero
/* 144A0 800390A0 0040802D */  daddu     $s0, $v0, $zero
/* 144A4 800390A4 5200007A */  beql      $s0, $zero, .L80039290
/* 144A8 800390A8 26520001 */   addiu    $s2, $s2, 0x1
/* 144AC 800390AC 52300078 */  beql      $s1, $s0, .L80039290
/* 144B0 800390B0 26520001 */   addiu    $s2, $s2, 0x1
/* 144B4 800390B4 8E030000 */  lw        $v1, 0x0($s0)
/* 144B8 800390B8 50600075 */  beql      $v1, $zero, .L80039290
/* 144BC 800390BC 26520001 */   addiu    $s2, $s2, 0x1
/* 144C0 800390C0 3C028000 */  lui       $v0, (0x80000100 >> 16)
/* 144C4 800390C4 34420100 */  ori       $v0, $v0, (0x80000100 & 0xFFFF)
/* 144C8 800390C8 00621024 */  and       $v0, $v1, $v0
/* 144CC 800390CC 54400070 */  bnel      $v0, $zero, .L80039290
/* 144D0 800390D0 26520001 */   addiu    $s2, $s2, 0x1
/* 144D4 800390D4 860200A8 */  lh        $v0, 0xA8($s0)
/* 144D8 800390D8 C602003C */  lwc1      $f2, 0x3C($s0)
/* 144DC 800390DC 44820000 */  mtc1      $v0, $f0
/* 144E0 800390E0 00000000 */  nop
/* 144E4 800390E4 46800020 */  cvt.s.w   $f0, $f0
/* 144E8 800390E8 46001000 */  add.s     $f0, $f2, $f0
/* 144EC 800390EC C7A60010 */  lwc1      $f6, 0x10($sp)
/* 144F0 800390F0 4606003C */  c.lt.s    $f0, $f6
/* 144F4 800390F4 00000000 */  nop
/* 144F8 800390F8 45030065 */  bc1tl     .L80039290
/* 144FC 800390FC 26520001 */   addiu    $s2, $s2, 0x1
/* 14500 80039100 862200A8 */  lh        $v0, 0xA8($s1)
/* 14504 80039104 44820000 */  mtc1      $v0, $f0
/* 14508 80039108 00000000 */  nop
/* 1450C 8003910C 46800020 */  cvt.s.w   $f0, $f0
/* 14510 80039110 46003000 */  add.s     $f0, $f6, $f0
/* 14514 80039114 4602003C */  c.lt.s    $f0, $f2
/* 14518 80039118 00000000 */  nop
/* 1451C 8003911C 4503005C */  bc1tl     .L80039290
/* 14520 80039120 26520001 */   addiu    $s2, $s2, 0x1
/* 14524 80039124 C6140038 */  lwc1      $f20, 0x38($s0)
/* 14528 80039128 461EA581 */  sub.s     $f22, $f20, $f30
/* 1452C 8003912C 4616B082 */  mul.s     $f2, $f22, $f22
/* 14530 80039130 00000000 */  nop
/* 14534 80039134 C61A0040 */  lwc1      $f26, 0x40($s0)
/* 14538 80039138 461CD101 */  sub.s     $f4, $f26, $f28
/* 1453C 8003913C 46042002 */  mul.s     $f0, $f4, $f4
/* 14540 80039140 00000000 */  nop
/* 14544 80039144 860200A6 */  lh        $v0, 0xA6($s0)
/* 14548 80039148 46001300 */  add.s     $f12, $f2, $f0
/* 1454C 8003914C 3C013F00 */  lui       $at, (0x3F000000 >> 16)
/* 14550 80039150 44811000 */  mtc1      $at, $f2
/* 14554 80039154 44820000 */  mtc1      $v0, $f0
/* 14558 80039158 00000000 */  nop
/* 1455C 8003915C 46800020 */  cvt.s.w   $f0, $f0
/* 14560 80039160 46020582 */  mul.s     $f22, $f0, $f2
/* 14564 80039164 00000000 */  nop
/* 14568 80039168 46006104 */  sqrt.s    $f4, $f12
/* 1456C 8003916C 46042032 */  c.eq.s    $f4, $f4
/* 14570 80039170 00000000 */  nop
/* 14574 80039174 45010004 */  bc1t      .L80039188
/* 14578 80039178 00000000 */   nop
/* 1457C 8003917C 0C0187BC */  jal       sqrtf
/* 14580 80039180 00000000 */   nop
/* 14584 80039184 46000106 */  mov.s     $f4, $f0
.L80039188:
/* 14588 80039188 C7A60014 */  lwc1      $f6, 0x14($sp)
/* 1458C 8003918C 46163000 */  add.s     $f0, $f6, $f22
/* 14590 80039190 46002606 */  mov.s     $f24, $f4
/* 14594 80039194 4618003E */  c.le.s    $f0, $f24
/* 14598 80039198 00000000 */  nop
/* 1459C 8003919C 4503003C */  bc1tl     .L80039290
/* 145A0 800391A0 26520001 */   addiu    $s2, $s2, 0x1
/* 145A4 800391A4 8E220000 */  lw        $v0, 0x0($s1)
/* 145A8 800391A8 00531024 */  and       $v0, $v0, $s3
/* 145AC 800391AC 10400005 */  beqz      $v0, .L800391C4
/* 145B0 800391B0 0000182D */   daddu    $v1, $zero, $zero
/* 145B4 800391B4 3C028011 */  lui       $v0, %hi(gPartnerStatus)
/* 145B8 800391B8 8042EBB0 */  lb        $v0, %lo(gPartnerStatus)($v0)
/* 145BC 800391BC 0800E479 */  j         .L800391E4
/* 145C0 800391C0 2C430001 */   sltiu    $v1, $v0, 0x1
.L800391C4:
/* 145C4 800391C4 8E020000 */  lw        $v0, 0x0($s0)
/* 145C8 800391C8 00531024 */  and       $v0, $v0, $s3
/* 145CC 800391CC 50400005 */  beql      $v0, $zero, .L800391E4
/* 145D0 800391D0 24030001 */   addiu    $v1, $zero, 0x1
/* 145D4 800391D4 3C028011 */  lui       $v0, %hi(gPartnerStatus)
/* 145D8 800391D8 8042EBB0 */  lb        $v0, %lo(gPartnerStatus)($v0)
/* 145DC 800391DC 50400001 */  beql      $v0, $zero, .L800391E4
/* 145E0 800391E0 24030001 */   addiu    $v1, $zero, 0x1
.L800391E4:
/* 145E4 800391E4 10600025 */  beqz      $v1, .L8003927C
/* 145E8 800391E8 00000000 */   nop
/* 145EC 800391EC 4600A306 */  mov.s     $f12, $f20
/* 145F0 800391F0 4406F000 */  mfc1      $a2, $f30
/* 145F4 800391F4 4407E000 */  mfc1      $a3, $f28
/* 145F8 800391F8 0C00A720 */  jal       atan2
/* 145FC 800391FC 4600D386 */   mov.s    $f14, $f26
/* 14600 80039200 3C0140C9 */  lui       $at, (0x40C90FD0 >> 16)
/* 14604 80039204 34210FD0 */  ori       $at, $at, (0x40C90FD0 & 0xFFFF)
/* 14608 80039208 44811000 */  mtc1      $at, $f2
/* 1460C 8003920C 00000000 */  nop
/* 14610 80039210 46020502 */  mul.s     $f20, $f0, $f2
/* 14614 80039214 00000000 */  nop
/* 14618 80039218 C7A60014 */  lwc1      $f6, 0x14($sp)
/* 1461C 8003921C 46163000 */  add.s     $f0, $f6, $f22
/* 14620 80039220 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
/* 14624 80039224 44811000 */  mtc1      $at, $f2
/* 14628 80039228 46180601 */  sub.s     $f24, $f0, $f24
/* 1462C 8003922C 4602A503 */  div.s     $f20, $f20, $f2
/* 14630 80039230 0C00A85B */  jal       sin_rad
/* 14634 80039234 4600A306 */   mov.s    $f12, $f20
/* 14638 80039238 4600C582 */  mul.s     $f22, $f24, $f0
/* 1463C 8003923C 00000000 */  nop
/* 14640 80039240 0C00A874 */  jal       cos_rad
/* 14644 80039244 4600A306 */   mov.s    $f12, $f20
/* 14648 80039248 4600C087 */  neg.s     $f2, $f24
/* 1464C 8003924C 46001102 */  mul.s     $f4, $f2, $f0
/* 14650 80039250 00000000 */  nop
/* 14654 80039254 3C013DCC */  lui       $at, (0x3DCCCCCD >> 16)
/* 14658 80039258 3421CCCD */  ori       $at, $at, (0x3DCCCCCD & 0xFFFF)
/* 1465C 8003925C 44813000 */  mtc1      $at, $f6
/* 14660 80039260 00000000 */  nop
/* 14664 80039264 4606B002 */  mul.s     $f0, $f22, $f6
/* 14668 80039268 00000000 */  nop
/* 1466C 8003926C 46062082 */  mul.s     $f2, $f4, $f6
/* 14670 80039270 00000000 */  nop
/* 14674 80039274 4600F780 */  add.s     $f30, $f30, $f0
/* 14678 80039278 4602E700 */  add.s     $f28, $f28, $f2
.L8003927C:
/* 1467C 8003927C 8E220000 */  lw        $v0, 0x0($s1)
/* 14680 80039280 3C030200 */  lui       $v1, (0x2000000 >> 16)
/* 14684 80039284 00431025 */  or        $v0, $v0, $v1
/* 14688 80039288 AE220000 */  sw        $v0, 0x0($s1)
/* 1468C 8003928C 26520001 */  addiu     $s2, $s2, 0x1
.L80039290:
/* 14690 80039290 2A420040 */  slti      $v0, $s2, 0x40
/* 14694 80039294 1440FF80 */  bnez      $v0, .L80039098
/* 14698 80039298 00000000 */   nop
/* 1469C 8003929C E63E0038 */  swc1      $f30, 0x38($s1)
/* 146A0 800392A0 E63C0040 */  swc1      $f28, 0x40($s1)
.L800392A4:
/* 146A4 800392A4 8FBF0028 */  lw        $ra, 0x28($sp)
/* 146A8 800392A8 8FB30024 */  lw        $s3, 0x24($sp)
/* 146AC 800392AC 8FB20020 */  lw        $s2, 0x20($sp)
/* 146B0 800392B0 8FB1001C */  lw        $s1, 0x1C($sp)
/* 146B4 800392B4 8FB00018 */  lw        $s0, 0x18($sp)
/* 146B8 800392B8 D7BE0058 */  ldc1      $f30, 0x58($sp)
/* 146BC 800392BC D7BC0050 */  ldc1      $f28, 0x50($sp)
/* 146C0 800392C0 D7BA0048 */  ldc1      $f26, 0x48($sp)
/* 146C4 800392C4 D7B80040 */  ldc1      $f24, 0x40($sp)
/* 146C8 800392C8 D7B60038 */  ldc1      $f22, 0x38($sp)
/* 146CC 800392CC D7B40030 */  ldc1      $f20, 0x30($sp)
/* 146D0 800392D0 03E00008 */  jr        $ra
/* 146D4 800392D4 27BD0060 */   addiu    $sp, $sp, 0x60

### DECOMPILED C INSTRUCTIONS:

void npc_do_other_npc_collision(Npc* npc) {
    Npc* otherNpc;
    f32 angle;
    f32 thisX, thisY, thisZ;
    f32 thisBuf;
    f32 otherX, otherZ;
    f32 otherBuf;
    f32 xDiff, zDiff;
    f32 dist;
    s32 collision;
    s32 i;

    if (!(npc->flags & NPC_FLAG_IGNORE_PLAYER_COLLISION)) {
        npc->flags &= ~NPC_FLAG_COLLIDING_WITH_NPC;
        thisBuf = npc->collisionDiameter * 0.5f;
        thisX = npc->pos.x;
        thisY = npc->pos.y;
        thisZ = npc->pos.z;

        for (i = 0; i < MAX_NPCS; i++) {
            otherNpc = get_npc_by_index(i);
            if (otherNpc != NULL && npc != otherNpc) {
                if (otherNpc->flags != 0 && !(otherNpc->flags & (NPC_FLAG_SUSPENDED | NPC_FLAG_IGNORE_PLAYER_COLLISION))) {
                    if (!(otherNpc->pos.y + otherNpc->collisionHeight < thisY) &&
                        !(thisY + npc->collisionHeight < otherNpc->pos.y))
                    {
                        otherX = otherNpc->pos.x;
                        xDiff = otherX - thisX;
                        otherZ = otherNpc->pos.z;
                        zDiff = otherZ - thisZ;
                        otherBuf = otherNpc->collisionDiameter * 0.5f;
                        dist = sqrtf(SQ(xDiff) + SQ(zDiff));

                        if (!(thisBuf + otherBuf <= dist)) {
                            collision = FALSE;
                            if (npc->flags & NPC_FLAG_PARTNER) {
                                collision = gPartnerStatus.partnerActionState == PARTNER_ACTION_NONE;
                            } else if (!(otherNpc->flags & NPC_FLAG_PARTNER) ||
                                        gPartnerStatus.partnerActionState == PARTNER_ACTION_NONE)
                            {
                                collision = TRUE;
                            }

                            if (collision) {
                                angle = DEG_TO_RAD(atan2(otherX, otherZ, thisX, thisZ));
                                dist = (thisBuf + otherBuf) - dist;
                                xDiff = dist * sin_rad(angle);
                                zDiff = -dist * cos_rad(angle);
                                thisX += xDiff * 0.1f;
                                thisZ += zDiff * 0.1f;
                            }
                            npc->flags |= NPC_FLAG_COLLIDING_WITH_NPC;
                        }
                    }
                }
            }
        }
        npc->pos.x = thisX;
        npc->pos.z = thisZ;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel PlayerRunToGoal
/* 1A2544 80273C64 27BDFFB8 */  addiu     $sp, $sp, -0x48
/* 1A2548 80273C68 AFB00018 */  sw        $s0, 0x18($sp)
/* 1A254C 80273C6C 3C10800E */  lui       $s0, %hi(gBattleStatus + 0xD8)
/* 1A2550 80273C70 8E10C148 */  lw        $s0, %lo(gBattleStatus + 0xD8)($s0)
/* 1A2554 80273C74 AFB20020 */  sw        $s2, 0x20($sp)
/* 1A2558 80273C78 0080902D */  daddu     $s2, $a0, $zero
/* 1A255C 80273C7C AFBF0024 */  sw        $ra, 0x24($sp)
/* 1A2560 80273C80 AFB1001C */  sw        $s1, 0x1C($sp)
/* 1A2564 80273C84 F7BA0040 */  sdc1      $f26, 0x40($sp)
/* 1A2568 80273C88 F7B80038 */  sdc1      $f24, 0x38($sp)
/* 1A256C 80273C8C F7B60030 */  sdc1      $f22, 0x30($sp)
/* 1A2570 80273C90 F7B40028 */  sdc1      $f20, 0x28($sp)
/* 1A2574 80273C94 8E43000C */  lw        $v1, 0xC($s2)
/* 1A2578 80273C98 10A00002 */  beqz      $a1, .L80273CA4
/* 1A257C 80273C9C 2611000C */   addiu    $s1, $s0, 0xC
/* 1A2580 80273CA0 AE400070 */  sw        $zero, 0x70($s2)
.L80273CA4:
/* 1A2584 80273CA4 8E420070 */  lw        $v0, 0x70($s2)
/* 1A2588 80273CA8 14400041 */  bnez      $v0, .L80273DB0
/* 1A258C 80273CAC 00000000 */   nop
/* 1A2590 80273CB0 8C650000 */  lw        $a1, 0x0($v1)
/* 1A2594 80273CB4 0C0B1EAF */  jal       evt_get_variable
/* 1A2598 80273CB8 0240202D */   daddu    $a0, $s2, $zero
/* 1A259C 80273CBC C6180018 */  lwc1      $f24, 0x18($s0)
/* 1A25A0 80273CC0 C61A0020 */  lwc1      $f26, 0x20($s0)
/* 1A25A4 80273CC4 C6000144 */  lwc1      $f0, 0x144($s0)
/* 1A25A8 80273CC8 C614014C */  lwc1      $f20, 0x14C($s0)
/* 1A25AC 80273CCC 4406C000 */  mfc1      $a2, $f24
/* 1A25B0 80273CD0 4407D000 */  mfc1      $a3, $f26
/* 1A25B4 80273CD4 A6020070 */  sh        $v0, 0x70($s0)
/* 1A25B8 80273CD8 E600000C */  swc1      $f0, 0xC($s0)
/* 1A25BC 80273CDC C6000148 */  lwc1      $f0, 0x148($s0)
/* 1A25C0 80273CE0 C616000C */  lwc1      $f22, 0xC($s0)
/* 1A25C4 80273CE4 4600A386 */  mov.s     $f14, $f20
/* 1A25C8 80273CE8 E6140014 */  swc1      $f20, 0x14($s0)
/* 1A25CC 80273CEC 4600B306 */  mov.s     $f12, $f22
/* 1A25D0 80273CF0 0C00A720 */  jal       atan2
/* 1A25D4 80273CF4 E6000010 */   swc1     $f0, 0x10($s0)
/* 1A25D8 80273CF8 4600B306 */  mov.s     $f12, $f22
/* 1A25DC 80273CFC 4406C000 */  mfc1      $a2, $f24
/* 1A25E0 80273D00 4407D000 */  mfc1      $a3, $f26
/* 1A25E4 80273D04 4600A386 */  mov.s     $f14, $f20
/* 1A25E8 80273D08 0C00A7B5 */  jal       dist2D
/* 1A25EC 80273D0C E6000054 */   swc1     $f0, 0x54($s0)
/* 1A25F0 80273D10 86020070 */  lh        $v0, 0x70($s0)
/* 1A25F4 80273D14 46000086 */  mov.s     $f2, $f0
/* 1A25F8 80273D18 14400018 */  bnez      $v0, .L80273D7C
/* 1A25FC 80273D1C E6020058 */   swc1     $f2, 0x58($s0)
/* 1A2600 80273D20 C600004C */  lwc1      $f0, 0x4C($s0)
/* 1A2604 80273D24 46001003 */  div.s     $f0, $f2, $f0
/* 1A2608 80273D28 4600020D */  trunc.w.s $f8, $f0
/* 1A260C 80273D2C 44024000 */  mfc1      $v0, $f8
/* 1A2610 80273D30 00000000 */  nop
/* 1A2614 80273D34 A6020070 */  sh        $v0, 0x70($s0)
/* 1A2618 80273D38 00021400 */  sll       $v0, $v0, 16
/* 1A261C 80273D3C 14400002 */  bnez      $v0, .L80273D48
/* 1A2620 80273D40 24020001 */   addiu    $v0, $zero, 0x1
/* 1A2624 80273D44 A6020070 */  sh        $v0, 0x70($s0)
.L80273D48:
/* 1A2628 80273D48 86020070 */  lh        $v0, 0x70($s0)
/* 1A262C 80273D4C C602004C */  lwc1      $f2, 0x4C($s0)
/* 1A2630 80273D50 44823000 */  mtc1      $v0, $f6
/* 1A2634 80273D54 00000000 */  nop
/* 1A2638 80273D58 468031A0 */  cvt.s.w   $f6, $f6
/* 1A263C 80273D5C 46023102 */  mul.s     $f4, $f6, $f2
/* 1A2640 80273D60 00000000 */  nop
/* 1A2644 80273D64 C6000058 */  lwc1      $f0, 0x58($s0)
/* 1A2648 80273D68 46040001 */  sub.s     $f0, $f0, $f4
/* 1A264C 80273D6C 46060003 */  div.s     $f0, $f0, $f6
/* 1A2650 80273D70 46001080 */  add.s     $f2, $f2, $f0
/* 1A2654 80273D74 0809CF64 */  j         .L80273D90
/* 1A2658 80273D78 E602004C */   swc1     $f2, 0x4C($s0)
.L80273D7C:
/* 1A265C 80273D7C 44820000 */  mtc1      $v0, $f0
/* 1A2660 80273D80 00000000 */  nop
/* 1A2664 80273D84 46800020 */  cvt.s.w   $f0, $f0
/* 1A2668 80273D88 46001003 */  div.s     $f0, $f2, $f0
/* 1A266C 80273D8C E600004C */  swc1      $f0, 0x4C($s0)
.L80273D90:
/* 1A2670 80273D90 860201B4 */  lh        $v0, 0x1B4($s0)
/* 1A2674 80273D94 24420001 */  addiu     $v0, $v0, 0x1
/* 1A2678 80273D98 44820000 */  mtc1      $v0, $f0
/* 1A267C 80273D9C 00000000 */  nop
/* 1A2680 80273DA0 46800020 */  cvt.s.w   $f0, $f0
/* 1A2684 80273DA4 24020001 */  addiu     $v0, $zero, 0x1
/* 1A2688 80273DA8 E620004C */  swc1      $f0, 0x4C($s1)
/* 1A268C 80273DAC AE420070 */  sw        $v0, 0x70($s2)
.L80273DB0:
/* 1A2690 80273DB0 8E250040 */  lw        $a1, 0x40($s1)
/* 1A2694 80273DB4 8E260048 */  lw        $a2, 0x48($s1)
/* 1A2698 80273DB8 0C09904A */  jal       add_xz_vec3f
/* 1A269C 80273DBC 0220202D */   daddu    $a0, $s1, $zero
/* 1A26A0 80273DC0 C6200000 */  lwc1      $f0, 0x0($s1)
/* 1A26A4 80273DC4 E6000144 */  swc1      $f0, 0x144($s0)
/* 1A26A8 80273DC8 C6200004 */  lwc1      $f0, 0x4($s1)
/* 1A26AC 80273DCC E6000148 */  swc1      $f0, 0x148($s0)
/* 1A26B0 80273DD0 C6200008 */  lwc1      $f0, 0x8($s1)
/* 1A26B4 80273DD4 E600014C */  swc1      $f0, 0x14C($s0)
/* 1A26B8 80273DD8 C6220040 */  lwc1      $f2, 0x40($s1)
/* 1A26BC 80273DDC 3C014080 */  lui       $at, (0x40800000 >> 16)
/* 1A26C0 80273DE0 44810000 */  mtc1      $at, $f0
/* 1A26C4 80273DE4 00000000 */  nop
/* 1A26C8 80273DE8 4600103C */  c.lt.s    $f2, $f0
/* 1A26CC 80273DEC 00000000 */  nop
/* 1A26D0 80273DF0 45000007 */  bc1f      .L80273E10
/* 1A26D4 80273DF4 0000202D */   daddu    $a0, $zero, $zero
/* 1A26D8 80273DF8 C600018C */  lwc1      $f0, 0x18C($s0)
/* 1A26DC 80273DFC E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A26E0 80273E00 8E050144 */  lw        $a1, 0x144($s0)
/* 1A26E4 80273E04 8E060148 */  lw        $a2, 0x148($s0)
/* 1A26E8 80273E08 0809CF8A */  j         .L80273E28
/* 1A26EC 80273E0C 8E07014C */   lw       $a3, 0x14C($s0)
.L80273E10:
/* 1A26F0 80273E10 C600018C */  lwc1      $f0, 0x18C($s0)
/* 1A26F4 80273E14 E7A00010 */  swc1      $f0, 0x10($sp)
/* 1A26F8 80273E18 8E050144 */  lw        $a1, 0x144($s0)
/* 1A26FC 80273E1C 8E060148 */  lw        $a2, 0x148($s0)
/* 1A2700 80273E20 8E07014C */  lw        $a3, 0x14C($s0)
/* 1A2704 80273E24 24040001 */  addiu     $a0, $zero, 0x1
.L80273E28:
/* 1A2708 80273E28 0C0990BC */  jal       play_movement_dust_effects
/* 1A270C 80273E2C 00000000 */   nop
/* 1A2710 80273E30 C622004C */  lwc1      $f2, 0x4C($s1)
/* 1A2714 80273E34 C6200040 */  lwc1      $f0, 0x40($s1)
/* 1A2718 80273E38 46001080 */  add.s     $f2, $f2, $f0
/* 1A271C 80273E3C E622004C */  swc1      $f2, 0x4C($s1)
/* 1A2720 80273E40 860201B4 */  lh        $v0, 0x1B4($s0)
/* 1A2724 80273E44 44820000 */  mtc1      $v0, $f0
/* 1A2728 80273E48 00000000 */  nop
/* 1A272C 80273E4C 46800020 */  cvt.s.w   $f0, $f0
/* 1A2730 80273E50 4602003C */  c.lt.s    $f0, $f2
/* 1A2734 80273E54 00000000 */  nop
/* 1A2738 80273E58 45000013 */  bc1f      .L80273EA8
/* 1A273C 80273E5C 00000000 */   nop
/* 1A2740 80273E60 92020135 */  lbu       $v0, 0x135($s0)
/* 1A2744 80273E64 24420001 */  addiu     $v0, $v0, 0x1
/* 1A2748 80273E68 A2020135 */  sb        $v0, 0x135($s0)
/* 1A274C 80273E6C AE20004C */  sw        $zero, 0x4C($s1)
/* 1A2750 80273E70 92020135 */  lbu       $v0, 0x135($s0)
/* 1A2754 80273E74 30420001 */  andi      $v0, $v0, 0x1
/* 1A2758 80273E78 10400004 */  beqz      $v0, .L80273E8C
/* 1A275C 80273E7C 24040141 */   addiu    $a0, $zero, 0x141
/* 1A2760 80273E80 C600014C */  lwc1      $f0, 0x14C($s0)
/* 1A2764 80273E84 0809CFA6 */  j         .L80273E98
/* 1A2768 80273E88 E7A00010 */   swc1     $f0, 0x10($sp)
.L80273E8C:
/* 1A276C 80273E8C C600014C */  lwc1      $f0, 0x14C($s0)
/* 1A2770 80273E90 24040142 */  addiu     $a0, $zero, 0x142
/* 1A2774 80273E94 E7A00010 */  swc1      $f0, 0x10($sp)
.L80273E98:
/* 1A2778 80273E98 8E060144 */  lw        $a2, 0x144($s0)
/* 1A277C 80273E9C 8E070148 */  lw        $a3, 0x148($s0)
/* 1A2780 80273EA0 0C052757 */  jal       sfx_play_sound_at_position
/* 1A2784 80273EA4 0000282D */   daddu    $a1, $zero, $zero
.L80273EA8:
/* 1A2788 80273EA8 96220064 */  lhu       $v0, 0x64($s1)
/* 1A278C 80273EAC 2442FFFF */  addiu     $v0, $v0, -0x1
/* 1A2790 80273EB0 A6220064 */  sh        $v0, 0x64($s1)
/* 1A2794 80273EB4 00021400 */  sll       $v0, $v0, 16
/* 1A2798 80273EB8 1C400006 */  bgtz      $v0, .L80273ED4
/* 1A279C 80273EBC 0000102D */   daddu    $v0, $zero, $zero
/* 1A27A0 80273EC0 C620000C */  lwc1      $f0, 0xC($s1)
/* 1A27A4 80273EC4 E6000144 */  swc1      $f0, 0x144($s0)
/* 1A27A8 80273EC8 C6200014 */  lwc1      $f0, 0x14($s1)
/* 1A27AC 80273ECC 24020002 */  addiu     $v0, $zero, 0x2
/* 1A27B0 80273ED0 E600014C */  swc1      $f0, 0x14C($s0)
.L80273ED4:
/* 1A27B4 80273ED4 8FBF0024 */  lw        $ra, 0x24($sp)
/* 1A27B8 80273ED8 8FB20020 */  lw        $s2, 0x20($sp)
/* 1A27BC 80273EDC 8FB1001C */  lw        $s1, 0x1C($sp)
/* 1A27C0 80273EE0 8FB00018 */  lw        $s0, 0x18($sp)
/* 1A27C4 80273EE4 D7BA0040 */  ldc1      $f26, 0x40($sp)
/* 1A27C8 80273EE8 D7B80038 */  ldc1      $f24, 0x38($sp)
/* 1A27CC 80273EEC D7B60030 */  ldc1      $f22, 0x30($sp)
/* 1A27D0 80273EF0 D7B40028 */  ldc1      $f20, 0x28($sp)
/* 1A27D4 80273EF4 03E00008 */  jr        $ra
/* 1A27D8 80273EF8 27BD0048 */   addiu    $sp, $sp, 0x48

### DECOMPILED C INSTRUCTIONS:

ApiStatus PlayerRunToGoal(Evt* script, s32 isInitialCall) {
    BattleStatus* battleStatus = &gBattleStatus;
    Bytecode* args = script->ptrReadPos;
    Actor* player = battleStatus->playerActor;
    ActorState* playerState = &player->state;
    f32 currentX, currentZ, goalX, goalZ;

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

    if (!script->functionTemp[0]) {
        player->state.moveTime = evt_get_variable(script, *args++);
        player->state.currentPos.x = player->currentPos.x;
        player->state.currentPos.y = player->currentPos.y;
        player->state.currentPos.z = player->currentPos.z;

        goalX = player->state.goalPos.x;
        goalZ = player->state.goalPos.z;
        currentX = player->state.currentPos.x;
        currentZ = player->state.currentPos.z;

        player->state.angle = atan2(currentX, currentZ, goalX, goalZ);
        player->state.distance = dist2D(currentX, currentZ, goalX, goalZ);
        if (player->state.moveTime == 0) {
            player->state.moveTime = player->state.distance / player->state.speed;
            if (player->state.moveTime == 0) {
                player->state.moveTime = 1;
            }
            player->state.speed += (player->state.distance - (player->state.moveTime * player->state.speed)) / player->state.moveTime;
        } else {
            player->state.speed = player->state.distance / player->state.moveTime;
        }
        playerState->distance = player->actorTypeData1b[0] + 1;
        script->functionTemp[0] = TRUE;
    }

    add_xz_vec3f(&playerState->currentPos, playerState->speed, playerState->angle);

    player->currentPos.x = playerState->currentPos.x;
    player->currentPos.y = playerState->currentPos.y;
    player->currentPos.z = playerState->currentPos.z;

    if (playerState->speed < 4.0f) {
        play_movement_dust_effects(0, player->currentPos.x, player->currentPos.y, player->currentPos.z, player->yaw);
    } else {
        play_movement_dust_effects(1, player->currentPos.x, player->currentPos.y, player->currentPos.z, player->yaw);
    }

    playerState->distance += playerState->speed;
    if (playerState->distance > player->actorTypeData1b[0]) {
        player->footStepCounter++;
        playerState->distance = 0.0f;
        if ((player->footStepCounter % 2) != 0) {
            sfx_play_sound_at_position(SOUND_STEP_NORMAL1, SOUND_SPACE_MODE_0, player->currentPos.x, player->currentPos.y, player->currentPos.z);
        } else {
            sfx_play_sound_at_position(SOUND_STEP_NORMAL2, SOUND_SPACE_MODE_0, player->currentPos.x, player->currentPos.y, player->currentPos.z);
        }
    }

    playerState->moveTime--;

    if (playerState->moveTime <= 0) {
        player->currentPos.x = playerState->goalPos.x;
        player->currentPos.z = playerState->goalPos.z;
        return ApiStatus_DONE2;
    }
    return ApiStatus_BLOCK;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel state_step_end_battle
/* EFC0 80033BC0 27BDFFD0 */  addiu     $sp, $sp, -0x30
/* EFC4 80033BC4 AFB30024 */  sw        $s3, 0x24($sp)
/* EFC8 80033BC8 3C138011 */  lui       $s3, %hi(gPlayerStatus)
/* EFCC 80033BCC 2673EFC8 */  addiu     $s3, $s3, %lo(gPlayerStatus)
/* EFD0 80033BD0 3C06800A */  lui       $a2, %hi(D_800A0900)
/* EFD4 80033BD4 24C60900 */  addiu     $a2, $a2, %lo(D_800A0900)
/* EFD8 80033BD8 AFBF0028 */  sw        $ra, 0x28($sp)
/* EFDC 80033BDC AFB20020 */  sw        $s2, 0x20($sp)
/* EFE0 80033BE0 AFB1001C */  sw        $s1, 0x1C($sp)
/* EFE4 80033BE4 AFB00018 */  sw        $s0, 0x18($sp)
/* EFE8 80033BE8 80C20000 */  lb        $v0, 0x0($a2)
/* EFEC 80033BEC 90C30000 */  lbu       $v1, 0x0($a2)
/* EFF0 80033BF0 04400095 */  bltz      $v0, .L80033E48
/* EFF4 80033BF4 2462FFFF */   addiu    $v0, $v1, -0x1
/* EFF8 80033BF8 A0C20000 */  sb        $v0, 0x0($a2)
/* EFFC 80033BFC 00021600 */  sll       $v0, $v0, 24
/* F000 80033C00 14400091 */  bnez      $v0, .L80033E48
/* F004 80033C04 24050003 */   addiu    $a1, $zero, 0x3
/* F008 80033C08 3C048007 */  lui       $a0, %hi(bFrameBuffers)
/* F00C 80033C0C 248478A0 */  addiu     $a0, $a0, %lo(bFrameBuffers)
/* F010 80033C10 2402FFFF */  addiu     $v0, $zero, -0x1
/* F014 80033C14 0C017CBC */  jal       nuGfxSetCfb
/* F018 80033C18 A0C20000 */   sb       $v0, 0x0($a2)
/* F01C 80033C1C 3C04800A */  lui       $a0, %hi(gOverrideFlags)
/* F020 80033C20 2484A650 */  addiu     $a0, $a0, %lo(gOverrideFlags)
/* F024 80033C24 8C820000 */  lw        $v0, 0x0($a0)
/* F028 80033C28 2403FFF7 */  addiu     $v1, $zero, -0x9
/* F02C 80033C2C 00431024 */  and       $v0, $v0, $v1
/* F030 80033C30 0C018030 */  jal       nuContRmbForceStopEnd
/* F034 80033C34 AC820000 */   sw       $v0, 0x0($a0)
/* F038 80033C38 0C05260E */  jal       sfx_stop_env_sounds
/* F03C 80033C3C 00000000 */   nop
/* F040 80033C40 0C016AFA */  jal       get_current_map_settings
/* F044 80033C44 00000000 */   nop
/* F048 80033C48 3C108007 */  lui       $s0, %hi(gGameStatusPtr)
/* F04C 80033C4C 2610419C */  addiu     $s0, $s0, %lo(gGameStatusPtr)
/* F050 80033C50 8E040000 */  lw        $a0, 0x0($s0)
/* F054 80033C54 0040902D */  daddu     $s2, $v0, $zero
/* F058 80033C58 84830086 */  lh        $v1, 0x86($a0)
/* F05C 80033C5C 8482008C */  lh        $v0, 0x8C($a0)
/* F060 80033C60 00031900 */  sll       $v1, $v1, 4
/* F064 80033C64 3C018009 */  lui       $at, %hi(gAreas + 0x4)
/* F068 80033C68 00230821 */  addu      $at, $at, $v1
/* F06C 80033C6C 8C2334F4 */  lw        $v1, %lo(gAreas + 0x4)($at)
/* F070 80033C70 00021140 */  sll       $v0, $v0, 5
/* F074 80033C74 0C0902AA */  jal       func_80240AA8
/* F078 80033C78 00628821 */   addu     $s1, $v1, $v0
/* F07C 80033C7C 8E020000 */  lw        $v0, 0x0($s0)
/* F080 80033C80 0C016BE1 */  jal       func_8005AF84
/* F084 80033C84 A0400070 */   sb       $zero, 0x70($v0)
/* F088 80033C88 0C00AB37 */  jal       func_8002ACDC
/* F08C 80033C8C 00000000 */   nop
/* F090 80033C90 0C05259C */  jal       sfx_clear_env_sounds
/* F094 80033C94 24040001 */   addiu    $a0, $zero, 0x1
/* F098 80033C98 8E030000 */  lw        $v1, 0x0($s0)
/* F09C 80033C9C 9062007E */  lbu       $v0, 0x7E($v1)
/* F0A0 80033CA0 304200FE */  andi      $v0, $v0, 0xFE
/* F0A4 80033CA4 0C00AB28 */  jal       battle_heap_create
/* F0A8 80033CA8 A062007E */   sb       $v0, 0x7E($v1)
/* F0AC 80033CAC 8E020000 */  lw        $v0, 0x0($s0)
/* F0B0 80033CB0 0C0B763E */  jal       spr_init_sprites
/* F0B4 80033CB4 80440084 */   lb       $a0, 0x84($v0)
/* F0B8 80033CB8 0C0457FA */  jal       init_model_data
/* F0BC 80033CBC 00000000 */   nop
/* F0C0 80033CC0 0C05203C */  jal       init_sprite_shading_data
/* F0C4 80033CC4 00000000 */   nop
/* F0C8 80033CC8 0C048316 */  jal       init_entity_models
/* F0CC 80033CCC 00000000 */   nop
/* F0D0 80033CD0 0C0478C4 */  jal       reset_animator_list
/* F0D4 80033CD4 00000000 */   nop
/* F0D8 80033CD8 0C048C45 */  jal       init_worker_list
/* F0DC 80033CDC 00000000 */   nop
/* F0E0 80033CE0 0000202D */  daddu     $a0, $zero, $zero
/* F0E4 80033CE4 0C0514BA */  jal       hud_element_set_aux_cache
/* F0E8 80033CE8 0080282D */   daddu    $a1, $a0, $zero
/* F0EC 80033CEC 0C0504C0 */  jal       init_hud_element_list
/* F0F0 80033CF0 00000000 */   nop
/* F0F4 80033CF4 0C04C433 */  jal       init_item_entity_list
/* F0F8 80033CF8 00000000 */   nop
/* F0FC 80033CFC 0C0B0CBB */  jal       init_script_list
/* F100 80033D00 00000000 */   nop
/* F104 80033D04 0C00E14B */  jal       init_npc_list
/* F108 80033D08 00000000 */   nop
/* F10C 80033D0C 0C044396 */  jal       init_entity_data
/* F110 80033D10 00000000 */   nop
/* F114 80033D14 0C0515CA */  jal       init_trigger_list
/* F118 80033D18 00000000 */   nop
/* F11C 80033D1C 8E020000 */  lw        $v0, 0x0($s0)
/* F120 80033D20 904200AA */  lbu       $v0, 0xAA($v0)
/* F124 80033D24 30420001 */  andi      $v0, $v0, 0x1
/* F128 80033D28 10400008 */  beqz      $v0, .L80033D4C
/* F12C 80033D2C 00000000 */   nop
/* F130 80033D30 0C00EC6C */  jal       npc_reload_all
/* F134 80033D34 00000000 */   nop
/* F138 80033D38 3C02800A */  lui       $v0, %hi(D_800A0904)
/* F13C 80033D3C 8C420904 */  lw        $v0, %lo(D_800A0904)($v0)
/* F140 80033D40 24040011 */  addiu     $a0, $zero, 0x11
/* F144 80033D44 0800CF90 */  j         .L80033E40
/* F148 80033D48 AE620004 */   sw       $v0, 0x4($s3)
.L80033D4C:
/* F14C 80033D4C 3C028011 */  lui       $v0, %hi(gPlayerData)
/* F150 80033D50 2442F290 */  addiu     $v0, $v0, %lo(gPlayerData)
/* F154 80033D54 0C03AC80 */  jal       partner_init_after_battle
/* F158 80033D58 80440012 */   lb       $a0, 0x12($v0)
/* F15C 80033D5C 0C0169B0 */  jal       load_map_script_lib
/* F160 80033D60 00000000 */   nop
/* F164 80033D64 3C04800E */  lui       $a0, %hi(wMapShapeName)
/* F168 80033D68 24849230 */  addiu     $a0, $a0, %lo(wMapShapeName)
/* F16C 80033D6C 0C016B3A */  jal       load_asset_by_name
/* F170 80033D70 27A50010 */   addiu    $a1, $sp, 0x10
/* F174 80033D74 0040802D */  daddu     $s0, $v0, $zero
/* F178 80033D78 3C058021 */  lui       $a1, %hi(gMapShapeData)
/* F17C 80033D7C 24A50000 */  addiu     $a1, $a1, %lo(gMapShapeData)
/* F180 80033D80 0C01BB7C */  jal       decode_yay0
/* F184 80033D84 0200202D */   daddu    $a0, $s0, $zero
/* F188 80033D88 0C00AB1E */  jal       general_heap_free
/* F18C 80033D8C 0200202D */   daddu    $a0, $s0, $zero
/* F190 80033D90 0C016BE5 */  jal       initialize_collision
/* F194 80033D94 00000000 */   nop
/* F198 80033D98 0C016C16 */  jal       restore_map_collision_data
/* F19C 80033D9C 00000000 */   nop
/* F1A0 80033DA0 8E240008 */  lw        $a0, 0x8($s1)
/* F1A4 80033DA4 10800004 */  beqz      $a0, .L80033DB8
/* F1A8 80033DA8 00000000 */   nop
/* F1AC 80033DAC 8E25000C */  lw        $a1, 0xC($s1)
/* F1B0 80033DB0 0C00A5CF */  jal       dma_copy
/* F1B4 80033DB4 8E260010 */   lw       $a2, 0x10($s1)
.L80033DB8:
/* F1B8 80033DB8 0C05175C */  jal       load_map_bg
/* F1BC 80033DBC 8E240014 */   lw       $a0, 0x14($s1)
/* F1C0 80033DC0 8E440038 */  lw        $a0, 0x38($s2)
/* F1C4 80033DC4 50800005 */  beql      $a0, $zero, .L80033DDC
/* F1C8 80033DC8 24040128 */   addiu    $a0, $zero, 0x128
/* F1CC 80033DCC 0C05178A */  jal       read_background_size
/* F1D0 80033DD0 00000000 */   nop
/* F1D4 80033DD4 0800CF7B */  j         .L80033DEC
/* F1D8 80033DD8 00000000 */   nop
.L80033DDC:
/* F1DC 80033DDC 240500C8 */  addiu     $a1, $zero, 0xC8
/* F1E0 80033DE0 2406000C */  addiu     $a2, $zero, 0xC
/* F1E4 80033DE4 0C05179C */  jal       set_background_size
/* F1E8 80033DE8 24070014 */   addiu    $a3, $zero, 0x14
.L80033DEC:
/* F1EC 80033DEC 3C04800B */  lui       $a0, %hi(wMapTexName)
/* F1F0 80033DF0 24840CF0 */  addiu     $a0, $a0, %lo(wMapTexName)
/* F1F4 80033DF4 0C016B74 */  jal       get_asset_offset
/* F1F8 80033DF8 27A50010 */   addiu    $a1, $sp, 0x10
/* F1FC 80033DFC 8E440000 */  lw        $a0, 0x0($s2)
/* F200 80033E00 8FA60010 */  lw        $a2, 0x10($sp)
/* F204 80033E04 0C045709 */  jal       load_model_textures
/* F208 80033E08 0040282D */   daddu    $a1, $v0, $zero
/* F20C 80033E0C 0C04584B */  jal       calculate_model_sizes
/* F210 80033E10 00000000 */   nop
/* F214 80033E14 0C00EC6C */  jal       npc_reload_all
/* F218 80033E18 00000000 */   nop
/* F21C 80033E1C 3C02800A */  lui       $v0, %hi(D_800A0904)
/* F220 80033E20 8C420904 */  lw        $v0, %lo(D_800A0904)($v0)
/* F224 80033E24 3C04800A */  lui       $a0, %hi(D_800A0908)
/* F228 80033E28 8C840908 */  lw        $a0, %lo(D_800A0908)($a0)
/* F22C 80033E2C 10800003 */  beqz      $a0, .L80033E3C
/* F230 80033E30 AE620004 */   sw       $v0, 0x4($s3)
/* F234 80033E34 0C009C22 */  jal       set_time_freeze_mode
/* F238 80033E38 00000000 */   nop
.L80033E3C:
/* F23C 80033E3C 24040004 */  addiu     $a0, $zero, 0x4
.L80033E40:
/* F240 80033E40 0C00CD3C */  jal       set_game_mode
/* F244 80033E44 00000000 */   nop
.L80033E48:
/* F248 80033E48 8FBF0028 */  lw        $ra, 0x28($sp)
/* F24C 80033E4C 8FB30024 */  lw        $s3, 0x24($sp)
/* F250 80033E50 8FB20020 */  lw        $s2, 0x20($sp)
/* F254 80033E54 8FB1001C */  lw        $s1, 0x1C($sp)
/* F258 80033E58 8FB00018 */  lw        $s0, 0x18($sp)
/* F25C 80033E5C 03E00008 */  jr        $ra
/* F260 80033E60 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

void state_step_end_battle(void) {
    PlayerStatus* playerStatus = &gPlayerStatus;
    PlayerData* playerData = &gPlayerData;

    if (D_800A0900 >= 0) {
        D_800A0900--;
        if (D_800A0900 == 0) {
            MapSettings* mapSettings;
            MapConfig* mapConfig;

            D_800A0900 = -1;
            nuGfxSetCfb(bFrameBuffers, 3);
            gOverrideFlags &= ~GLOBAL_OVERRIDES_8;
            nuContRmbForceStopEnd();
            sfx_stop_env_sounds();
            mapSettings = get_current_map_settings();
            mapConfig = &gAreas[gGameStatusPtr->areaID].maps[gGameStatusPtr->mapID];
            btl_restore_world_cameras();
            gGameStatusPtr->isBattle = FALSE;
            func_8005AF84();
            func_8002ACDC();
            sfx_clear_env_sounds(1);
            gGameStatusPtr->peachFlags &= ~PEACH_STATUS_FLAG_IS_PEACH;
            battle_heap_create();
            spr_init_sprites(gGameStatusPtr->playerSpriteSet);
            init_model_data();
            init_sprite_shading_data();
            init_entity_models();
            reset_animator_list();
            init_worker_list();
            hud_element_set_aux_cache(0, 0);
            init_hud_element_list();
            init_item_entity_list();
            init_script_list();
            init_npc_list();
            init_entity_data();
            init_trigger_list();

            if (gGameStatusPtr->demoFlags & 1) {
                npc_reload_all();
                playerStatus->animFlags = D_800A0904;
                set_game_mode(GAME_MODE_DEMO);
            } else {
                void* mapShape;
                u32 sizeTemp;

                partner_init_after_battle(playerData->currentPartner);
                load_map_script_lib();
                mapShape = load_asset_by_name(wMapShapeName, &sizeTemp);
                decode_yay0(mapShape, &gMapShapeData);
                general_heap_free(mapShape);
                initialize_collision();
                restore_map_collision_data();

                if (mapConfig->dmaStart != NULL) {
                    dma_copy(mapConfig->dmaStart, mapConfig->dmaEnd, mapConfig->dmaDest);
                }

                load_map_bg(mapConfig->bgName);
                if (mapSettings->background != NULL) {
                    read_background_size(mapSettings->background);
                } else {
                    set_background_size(296, 200, 12, 20);
                }

                load_model_textures(mapSettings->modelTreeRoot, get_asset_offset(wMapTexName, &sizeTemp), sizeTemp);
                calculate_model_sizes();
                npc_reload_all();

                playerStatus->animFlags = D_800A0904;
                if (D_800A0908 != 0) {
                    set_time_freeze_mode(D_800A0908);
                }
                set_game_mode(GAME_MODE_CHANGE_MAP);
            }
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_802616F4
/* 18FFD4 802616F4 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 18FFD8 802616F8 AFB20020 */  sw        $s2, 0x20($sp)
/* 18FFDC 802616FC 0080902D */  daddu     $s2, $a0, $zero
/* 18FFE0 80261700 AFB00018 */  sw        $s0, 0x18($sp)
/* 18FFE4 80261704 00A0802D */  daddu     $s0, $a1, $zero
/* 18FFE8 80261708 2404FFF6 */  addiu     $a0, $zero, -0xA
/* 18FFEC 8026170C AFBF0024 */  sw        $ra, 0x24($sp)
/* 18FFF0 80261710 0C00EABB */  jal       get_npc_unsafe
/* 18FFF4 80261714 AFB1001C */   sw       $s1, 0x1C($sp)
/* 18FFF8 80261718 12000024 */  beqz      $s0, .L802617AC
/* 18FFFC 8026171C 0040882D */   daddu    $s1, $v0, $zero
/* 190000 80261720 AE400074 */  sw        $zero, 0x74($s2)
/* 190004 80261724 C622003C */  lwc1      $f2, 0x3C($s1)
/* 190008 80261728 3C013ECC */  lui       $at, (0x3ECCCCCD >> 16)
/* 19000C 8026172C 3421CCCD */  ori       $at, $at, (0x3ECCCCCD & 0xFFFF)
/* 190010 80261730 44810000 */  mtc1      $at, $f0
/* 190014 80261734 AFA00014 */  sw        $zero, 0x14($sp)
/* 190018 80261738 E7A00010 */  swc1      $f0, 0x10($sp)
/* 19001C 8026173C 8E250038 */  lw        $a1, 0x38($s1)
/* 190020 80261740 8E26003C */  lw        $a2, 0x3C($s1)
/* 190024 80261744 8E270040 */  lw        $a3, 0x40($s1)
/* 190028 80261748 3C01802A */  lui       $at, %hi(D_8029FB94)
/* 19002C 8026174C E422FB94 */  swc1      $f2, %lo(D_8029FB94)($at)
/* 190030 80261750 0C01C5D4 */  jal       fx_energy_orb_wave
/* 190034 80261754 0000202D */   daddu    $a0, $zero, $zero
/* 190038 80261758 3C013727 */  lui       $at, (0x3727C5AC >> 16)
/* 19003C 8026175C 3421C5AC */  ori       $at, $at, (0x3727C5AC & 0xFFFF)
/* 190040 80261760 44810000 */  mtc1      $at, $f0
/* 190044 80261764 AFA00014 */  sw        $zero, 0x14($sp)
/* 190048 80261768 E7A00010 */  swc1      $f0, 0x10($sp)
/* 19004C 8026176C 8E250038 */  lw        $a1, 0x38($s1)
/* 190050 80261770 8E26003C */  lw        $a2, 0x3C($s1)
/* 190054 80261774 8E270040 */  lw        $a3, 0x40($s1)
/* 190058 80261778 3C01802A */  lui       $at, %hi(BattleMerleeOrbEffect)
/* 19005C 8026177C AC22FB98 */  sw        $v0, %lo(BattleMerleeOrbEffect)($at)
/* 190060 80261780 0C01C5D4 */  jal       fx_energy_orb_wave
/* 190064 80261784 24040003 */   addiu    $a0, $zero, 0x3
/* 190068 80261788 3C01802A */  lui       $at, %hi(BattleMerleeWaveEffect)
/* 19006C 8026178C AC22FB9C */  sw        $v0, %lo(BattleMerleeWaveEffect)($at)
/* 190070 80261790 2402000C */  addiu     $v0, $zero, 0xC
/* 190074 80261794 3C01802A */  lui       $at, %hi(D_8029FBA4)
/* 190078 80261798 A420FBA4 */  sh        $zero, %lo(D_8029FBA4)($at)
/* 19007C 8026179C 3C01802A */  lui       $at, %hi(D_8029FB90)
/* 190080 802617A0 AC22FB90 */  sw        $v0, %lo(D_8029FB90)($at)
/* 190084 802617A4 0C05272D */  jal       sfx_play_sound
/* 190088 802617A8 24042074 */   addiu    $a0, $zero, 0x2074
.L802617AC:
/* 19008C 802617AC 3C0140C9 */  lui       $at, (0x40C90FD0 >> 16)
/* 190090 802617B0 34210FD0 */  ori       $at, $at, (0x40C90FD0 & 0xFFFF)
/* 190094 802617B4 44810000 */  mtc1      $at, $f0
/* 190098 802617B8 C64C0074 */  lwc1      $f12, 0x74($s2)
/* 19009C 802617BC 46806320 */  cvt.s.w   $f12, $f12
/* 1900A0 802617C0 46006302 */  mul.s     $f12, $f12, $f0
/* 1900A4 802617C4 00000000 */  nop
/* 1900A8 802617C8 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
/* 1900AC 802617CC 44810000 */  mtc1      $at, $f0
/* 1900B0 802617D0 0C00A85B */  jal       sin_rad
/* 1900B4 802617D4 46006303 */   div.s    $f12, $f12, $f0
/* 1900B8 802617D8 3C014040 */  lui       $at, (0x40400000 >> 16)
/* 1900BC 802617DC 44811000 */  mtc1      $at, $f2
/* 1900C0 802617E0 00000000 */  nop
/* 1900C4 802617E4 46020002 */  mul.s     $f0, $f0, $f2
/* 1900C8 802617E8 00000000 */  nop
/* 1900CC 802617EC 3C01802A */  lui       $at, %hi(D_8029FB94)
/* 1900D0 802617F0 C422FB94 */  lwc1      $f2, %lo(D_8029FB94)($at)
/* 1900D4 802617F4 46001080 */  add.s     $f2, $f2, $f0
/* 1900D8 802617F8 E622003C */  swc1      $f2, 0x3C($s1)
/* 1900DC 802617FC 8E420074 */  lw        $v0, 0x74($s2)
/* 1900E0 80261800 2442000A */  addiu     $v0, $v0, 0xA
/* 1900E4 80261804 44826000 */  mtc1      $v0, $f12
/* 1900E8 80261808 00000000 */  nop
/* 1900EC 8026180C 46806320 */  cvt.s.w   $f12, $f12
/* 1900F0 80261810 0C00A6C9 */  jal       clamp_angle
/* 1900F4 80261814 AE420074 */   sw       $v0, 0x74($s2)
/* 1900F8 80261818 4600018D */  trunc.w.s $f6, $f0
/* 1900FC 8026181C E6460074 */  swc1      $f6, 0x74($s2)
/* 190100 80261820 3C05802A */  lui       $a1, %hi(BattleMerleeOrbEffect)
/* 190104 80261824 8CA5FB98 */  lw        $a1, %lo(BattleMerleeOrbEffect)($a1)
/* 190108 80261828 C6200038 */  lwc1      $f0, 0x38($s1)
/* 19010C 8026182C 3C014180 */  lui       $at, (0x41800000 >> 16)
D_80261830:
/* 190110 80261830 44811000 */  mtc1      $at, $f2
/* 190114 80261834 8CA2000C */  lw        $v0, 0xC($a1)
/* 190118 80261838 E4400004 */  swc1      $f0, 0x4($v0)
/* 19011C 8026183C C620003C */  lwc1      $f0, 0x3C($s1)
/* 190120 80261840 46020000 */  add.s     $f0, $f0, $f2
/* 190124 80261844 3C08802A */  lui       $t0, %hi(BattleMerleeWaveEffect)
/* 190128 80261848 2508FB9C */  addiu     $t0, $t0, %lo(BattleMerleeWaveEffect)
/* 19012C 8026184C E4400008 */  swc1      $f0, 0x8($v0)
/* 190130 80261850 C6200040 */  lwc1      $f0, 0x40($s1)
/* 190134 80261854 8D040000 */  lw        $a0, 0x0($t0)
/* 190138 80261858 E440000C */  swc1      $f0, 0xC($v0)
/* 19013C 8026185C 8C82000C */  lw        $v0, 0xC($a0)
/* 190140 80261860 C6200038 */  lwc1      $f0, 0x38($s1)
/* 190144 80261864 E4400004 */  swc1      $f0, 0x4($v0)
/* 190148 80261868 C620003C */  lwc1      $f0, 0x3C($s1)
/* 19014C 8026186C 46020000 */  add.s     $f0, $f0, $f2
/* 190150 80261870 3C0140A0 */  lui       $at, (0x40A00000 >> 16)
/* 190154 80261874 44811000 */  mtc1      $at, $f2
/* 190158 80261878 E4400008 */  swc1      $f0, 0x8($v0)
/* 19015C 8026187C C6200040 */  lwc1      $f0, 0x40($s1)
D_80261880:
/* 190160 80261880 46020000 */  add.s     $f0, $f0, $f2
/* 190164 80261884 3C07802A */  lui       $a3, %hi(D_8029FBA4)
/* 190168 80261888 24E7FBA4 */  addiu     $a3, $a3, %lo(D_8029FBA4)
/* 19016C 8026188C E440000C */  swc1      $f0, 0xC($v0)
/* 190170 80261890 84E30000 */  lh        $v1, 0x0($a3)
/* 190174 80261894 24060002 */  addiu     $a2, $zero, 0x2
/* 190178 80261898 14660011 */  bne       $v1, $a2, .L802618E0
/* 19017C 8026189C 24020001 */   addiu    $v0, $zero, 0x1
/* 190180 802618A0 8CA2000C */  lw        $v0, 0xC($a1)
/* 190184 802618A4 3C013727 */  lui       $at, (0x3727C5AC >> 16)
/* 190188 802618A8 3421C5AC */  ori       $at, $at, (0x3727C5AC & 0xFFFF)
/* 19018C 802618AC 44810000 */  mtc1      $at, $f0
/* 190190 802618B0 00000000 */  nop
/* 190194 802618B4 E4400030 */  swc1      $f0, 0x30($v0)
/* 190198 802618B8 8C82000C */  lw        $v0, 0xC($a0)
/* 19019C 802618BC E4400030 */  swc1      $f0, 0x30($v0)
/* 1901A0 802618C0 8CA20000 */  lw        $v0, 0x0($a1)
/* 1901A4 802618C4 34420010 */  ori       $v0, $v0, 0x10
/* 1901A8 802618C8 ACA20000 */  sw        $v0, 0x0($a1)
/* 1901AC 802618CC 8C830000 */  lw        $v1, 0x0($a0)
/* 1901B0 802618D0 24020001 */  addiu     $v0, $zero, 0x1
/* 1901B4 802618D4 34630010 */  ori       $v1, $v1, 0x10
/* 1901B8 802618D8 08098667 */  j         .L8026199C
/* 1901BC 802618DC AC830000 */   sw       $v1, 0x0($a0)
.L802618E0:
/* 1901C0 802618E0 1462002E */  bne       $v1, $v0, .L8026199C
/* 1901C4 802618E4 0000102D */   daddu    $v0, $zero, $zero
/* 1901C8 802618E8 8CA2000C */  lw        $v0, 0xC($a1)
/* 1901CC 802618EC C4400030 */  lwc1      $f0, 0x30($v0)
/* 1901D0 802618F0 3C01802A */  lui       $at, %hi(D_8029D590)
/* 1901D4 802618F4 D422D590 */  ldc1      $f2, %lo(D_8029D590)($at)
/* 1901D8 802618F8 46000021 */  cvt.d.s   $f0, $f0
/* 1901DC 802618FC 46220000 */  add.d     $f0, $f0, $f2
/* 1901E0 80261900 3C01400C */  lui       $at, (0x400C0000 >> 16)
/* 1901E4 80261904 44812800 */  mtc1      $at, $f5
/* 1901E8 80261908 44802000 */  mtc1      $zero, $f4
/* 1901EC 8026190C 46200020 */  cvt.s.d   $f0, $f0
/* 1901F0 80261910 460000A1 */  cvt.d.s   $f2, $f0
/* 1901F4 80261914 4622203C */  c.lt.d    $f4, $f2
/* 1901F8 80261918 00000000 */  nop
/* 1901FC 8026191C 45000005 */  bc1f      .L80261934
/* 190200 80261920 E4400030 */   swc1     $f0, 0x30($v0)
/* 190204 80261924 3C014060 */  lui       $at, (0x40600000 >> 16)
/* 190208 80261928 44810000 */  mtc1      $at, $f0
/* 19020C 8026192C 00000000 */  nop
/* 190210 80261930 E4400030 */  swc1      $f0, 0x30($v0)
.L80261934:
/* 190214 80261934 3C03802A */  lui       $v1, %hi(D_8029FB90)
/* 190218 80261938 2463FB90 */  addiu     $v1, $v1, %lo(D_8029FB90)
/* 19021C 8026193C 8C620000 */  lw        $v0, 0x0($v1)
/* 190220 80261940 10400003 */  beqz      $v0, .L80261950
/* 190224 80261944 2442FFFF */   addiu    $v0, $v0, -0x1
/* 190228 80261948 08098666 */  j         .L80261998
/* 19022C 8026194C AC620000 */   sw       $v0, 0x0($v1)
.L80261950:
/* 190230 80261950 8D020000 */  lw        $v0, 0x0($t0)
/* 190234 80261954 8C42000C */  lw        $v0, 0xC($v0)
/* 190238 80261958 C4400030 */  lwc1      $f0, 0x30($v0)
/* 19023C 8026195C 3C013FE0 */  lui       $at, (0x3FE00000 >> 16)
/* 190240 80261960 44811800 */  mtc1      $at, $f3
/* 190244 80261964 44801000 */  mtc1      $zero, $f2
/* 190248 80261968 46000021 */  cvt.d.s   $f0, $f0
/* 19024C 8026196C 46220000 */  add.d     $f0, $f0, $f2
/* 190250 80261970 3C014014 */  lui       $at, (0x40140000 >> 16)
/* 190254 80261974 44812800 */  mtc1      $at, $f5
/* 190258 80261978 44802000 */  mtc1      $zero, $f4
/* 19025C 8026197C 46200020 */  cvt.s.d   $f0, $f0
/* 190260 80261980 460000A1 */  cvt.d.s   $f2, $f0
/* 190264 80261984 4622203C */  c.lt.d    $f4, $f2
/* 190268 80261988 00000000 */  nop
/* 19026C 8026198C 45000002 */  bc1f      .L80261998
/* 190270 80261990 E4400030 */   swc1     $f0, 0x30($v0)
/* 190274 80261994 A4E60000 */  sh        $a2, 0x0($a3)
.L80261998:
/* 190278 80261998 0000102D */  daddu     $v0, $zero, $zero
.L8026199C:
/* 19027C 8026199C 8FBF0024 */  lw        $ra, 0x24($sp)
/* 190280 802619A0 8FB20020 */  lw        $s2, 0x20($sp)
/* 190284 802619A4 8FB1001C */  lw        $s1, 0x1C($sp)
/* 190288 802619A8 8FB00018 */  lw        $s0, 0x18($sp)
/* 19028C 802619AC 03E00008 */  jr        $ra
/* 190290 802619B0 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

API_CALLABLE(BattleMerleeUpdateFX) {
    Npc* merlee = get_npc_unsafe(NPC_BTL_MERLEE);
    EnergyOrbWaveFXData* data;

    if (isInitialCall) {
        script->functionTemp[1] = 0;
        D_8029FB94 = merlee->pos.y;
        BattleMerleeOrbEffect = fx_energy_orb_wave(0, merlee->pos.x, merlee->pos.y, merlee->pos.z, 0.4f, 0);
        BattleMerleeWaveEffect = fx_energy_orb_wave(3, merlee->pos.x, merlee->pos.y, merlee->pos.z, 0.00001f, 0);
        D_8029FBA4 = 0;
        D_8029FB90 = 12;
        sfx_play_sound(SOUND_2074);
    }
    merlee->pos.y = D_8029FB94 + (sin_rad(DEG_TO_RAD(script->functionTemp[1])) * 3.0f);

    script->functionTemp[1] += 10;
    script->functionTemp[1] = clamp_angle(script->functionTemp[1]);

    data = BattleMerleeOrbEffect->data.energyOrbWave;
    data->pos.x = merlee->pos.x;
    data->pos.y = merlee->pos.y + 16.0f;
    data->pos.z = merlee->pos.z;

    data = BattleMerleeWaveEffect->data.energyOrbWave;
    data->pos.x = merlee->pos.x;
    data->pos.y = merlee->pos.y + 16.0f;
    data->pos.z = merlee->pos.z + 5.0f;

    if (D_8029FBA4 == 2) {
        BattleMerleeOrbEffect->data.energyOrbWave->scale = 0.00001f;
        BattleMerleeWaveEffect->data.energyOrbWave->scale = 0.00001f;
        BattleMerleeOrbEffect->flags |= FX_INSTANCE_FLAG_DISMISS;
        BattleMerleeWaveEffect->flags |= FX_INSTANCE_FLAG_DISMISS;
        return ApiStatus_DONE1;
    }

    if (D_8029FBA4 == 1) {
        data = BattleMerleeOrbEffect->data.energyOrbWave;
        data->scale += 0.35;
        if (data->scale > 3.5) {
            data->scale = 3.5f;
        }

        if (D_8029FB90 != 0) {
            D_8029FB90--;
        } else {
            data = BattleMerleeWaveEffect->data.energyOrbWave;
            data->scale += 0.5;
            if (data->scale > 5.0) {
                D_8029FBA4 = 2;
            }
        }
    }
    return ApiStatus_BLOCK;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel draw_msg
/* BCBEC 801264EC 27BDFA58 */  addiu     $sp, $sp, -0x5A8
/* BCBF0 801264F0 8FA205BC */  lw        $v0, 0x5BC($sp)
/* BCBF4 801264F4 AFB7059C */  sw        $s7, 0x59C($sp)
/* BCBF8 801264F8 8FB705B8 */  lw        $s7, 0x5B8($sp)
/* BCBFC 801264FC AFB00580 */  sw        $s0, 0x580($sp)
/* BCC00 80126500 0080802D */  daddu     $s0, $a0, $zero
/* BCC04 80126504 AFBE05A0 */  sw        $fp, 0x5A0($sp)
/* BCC08 80126508 00E0F02D */  daddu     $fp, $a3, $zero
/* BCC0C 8012650C AFB60598 */  sw        $s6, 0x598($sp)
/* BCC10 80126510 0000B02D */  daddu     $s6, $zero, $zero
/* BCC14 80126514 AFB20588 */  sw        $s2, 0x588($sp)
/* BCC18 80126518 02C0902D */  daddu     $s2, $s6, $zero
/* BCC1C 8012651C AFB40590 */  sw        $s4, 0x590($sp)
/* BCC20 80126520 0000A02D */  daddu     $s4, $zero, $zero
/* BCC24 80126524 AFB3058C */  sw        $s3, 0x58C($sp)
/* BCC28 80126528 0280982D */  daddu     $s3, $s4, $zero
/* BCC2C 8012652C AFBF05A4 */  sw        $ra, 0x5A4($sp)
/* BCC30 80126530 AFB50594 */  sw        $s5, 0x594($sp)
/* BCC34 80126534 AFB10584 */  sw        $s1, 0x584($sp)
/* BCC38 80126538 AFA505AC */  sw        $a1, 0x5AC($sp)
/* BCC3C 8012653C AFA605B0 */  sw        $a2, 0x5B0($sp)
/* BCC40 80126540 12000087 */  beqz      $s0, .L80126760
/* BCC44 80126544 0040A82D */   daddu    $s5, $v0, $zero
/* BCC48 80126548 30420001 */  andi      $v0, $v0, 0x1
/* BCC4C 8012654C 10400003 */  beqz      $v0, .L8012655C
/* BCC50 80126550 2BC200FF */   slti     $v0, $fp, 0xFF
/* BCC54 80126554 24160002 */  addiu     $s6, $zero, 0x2
/* BCC58 80126558 24130001 */  addiu     $s3, $zero, 0x1
.L8012655C:
/* BCC5C 8012655C 54400001 */  bnel      $v0, $zero, .L80126564
/* BCC60 80126560 36D60001 */   ori      $s6, $s6, 0x1
.L80126564:
/* BCC64 80126564 27B10020 */  addiu     $s1, $sp, 0x20
/* BCC68 80126568 0220202D */  daddu     $a0, $s1, $zero
/* BCC6C 8012656C 24050001 */  addiu     $a1, $zero, 0x1
/* BCC70 80126570 0C0495A9 */  jal       initialize_printer
/* BCC74 80126574 0000302D */   daddu    $a2, $zero, $zero
/* BCC78 80126578 06010003 */  bgez      $s0, .L80126588
/* BCC7C 8012657C 00000000 */   nop
/* BCC80 80126580 08049975 */  j         .L801265D4
/* BCC84 80126584 AFB00020 */   sw       $s0, 0x20($sp)
.L80126588:
/* BCC88 80126588 0C00AB0A */  jal       general_heap_malloc
/* BCC8C 8012658C 24040400 */   addiu    $a0, $zero, 0x400
/* BCC90 80126590 0040A02D */  daddu     $s4, $v0, $zero
/* BCC94 80126594 0200202D */  daddu     $a0, $s0, $zero
/* BCC98 80126598 0C049601 */  jal       dma_load_msg
/* BCC9C 8012659C 0280282D */   daddu    $a1, $s4, $zero
/* BCCA0 801265A0 0000282D */  daddu     $a1, $zero, $zero
/* BCCA4 801265A4 27B00578 */  addiu     $s0, $sp, 0x578
/* BCCA8 801265A8 0200302D */  daddu     $a2, $s0, $zero
/* BCCAC 801265AC AFB40020 */  sw        $s4, 0x20($sp)
/* BCCB0 801265B0 AFA00010 */  sw        $zero, 0x10($sp)
/* BCCB4 801265B4 AFA00014 */  sw        $zero, 0x14($sp)
/* BCCB8 801265B8 AFA00018 */  sw        $zero, 0x18($sp)
/* BCCBC 801265BC AFB3001C */  sw        $s3, 0x1C($sp)
/* BCCC0 801265C0 0280202D */  daddu     $a0, $s4, $zero
/* BCCC4 801265C4 0C0497DA */  jal       get_msg_properties
/* BCCC8 801265C8 00A0382D */   daddu    $a3, $a1, $zero
/* BCCCC 801265CC 96020002 */  lhu       $v0, 0x2($s0)
/* BCCD0 801265D0 A7A20558 */  sh        $v0, 0x558($sp)
.L801265D4:
/* BCCD4 801265D4 06E00011 */  bltz      $s7, .L8012661C
/* BCCD8 801265D8 26450001 */   addiu    $a1, $s2, 0x1
/* BCCDC 801265DC 24A40001 */  addiu     $a0, $a1, 0x1
/* BCCE0 801265E0 3242FFFF */  andi      $v0, $s2, 0xFFFF
/* BCCE4 801265E4 02221021 */  addu      $v0, $s1, $v0
/* BCCE8 801265E8 240300FF */  addiu     $v1, $zero, 0xFF
/* BCCEC 801265EC A0430010 */  sb        $v1, 0x10($v0)
/* BCCF0 801265F0 30A2FFFF */  andi      $v0, $a1, 0xFFFF
/* BCCF4 801265F4 02221021 */  addu      $v0, $s1, $v0
/* BCCF8 801265F8 24030004 */  addiu     $v1, $zero, 0x4
/* BCCFC 801265FC 3084FFFF */  andi      $a0, $a0, 0xFFFF
/* BCD00 80126600 02242021 */  addu      $a0, $s1, $a0
/* BCD04 80126604 A0430010 */  sb        $v1, 0x10($v0)
/* BCD08 80126608 A0970010 */  sb        $s7, 0x10($a0)
/* BCD0C 8012660C 96220004 */  lhu       $v0, 0x4($s1)
/* BCD10 80126610 24B20002 */  addiu     $s2, $a1, 0x2
/* BCD14 80126614 24420003 */  addiu     $v0, $v0, 0x3
/* BCD18 80126618 A6220004 */  sh        $v0, 0x4($s1)
.L8012661C:
/* BCD1C 8012661C 32A20002 */  andi      $v0, $s5, 0x2
/* BCD20 80126620 10400012 */  beqz      $v0, .L8012666C
/* BCD24 80126624 26450001 */   addiu    $a1, $s2, 0x1
/* BCD28 80126628 24A40001 */  addiu     $a0, $a1, 0x1
/* BCD2C 8012662C 3242FFFF */  andi      $v0, $s2, 0xFFFF
/* BCD30 80126630 02221021 */  addu      $v0, $s1, $v0
/* BCD34 80126634 240300FF */  addiu     $v1, $zero, 0xFF
/* BCD38 80126638 A0430010 */  sb        $v1, 0x10($v0)
/* BCD3C 8012663C 30A2FFFF */  andi      $v0, $a1, 0xFFFF
/* BCD40 80126640 02221021 */  addu      $v0, $s1, $v0
/* BCD44 80126644 2403001C */  addiu     $v1, $zero, 0x1C
/* BCD48 80126648 3084FFFF */  andi      $a0, $a0, 0xFFFF
/* BCD4C 8012664C 02242021 */  addu      $a0, $s1, $a0
/* BCD50 80126650 A0430010 */  sb        $v1, 0x10($v0)
/* BCD54 80126654 24020008 */  addiu     $v0, $zero, 0x8
/* BCD58 80126658 A0820010 */  sb        $v0, 0x10($a0)
/* BCD5C 8012665C 96220004 */  lhu       $v0, 0x4($s1)
/* BCD60 80126660 24B20002 */  addiu     $s2, $a1, 0x2
/* BCD64 80126664 24420003 */  addiu     $v0, $v0, 0x3
/* BCD68 80126668 A6220004 */  sh        $v0, 0x4($s1)
.L8012666C:
/* BCD6C 8012666C 32A20004 */  andi      $v0, $s5, 0x4
/* BCD70 80126670 10400012 */  beqz      $v0, .L801266BC
/* BCD74 80126674 26450001 */   addiu    $a1, $s2, 0x1
/* BCD78 80126678 24A40001 */  addiu     $a0, $a1, 0x1
/* BCD7C 8012667C 3242FFFF */  andi      $v0, $s2, 0xFFFF
/* BCD80 80126680 02221021 */  addu      $v0, $s1, $v0
/* BCD84 80126684 240300FF */  addiu     $v1, $zero, 0xFF
/* BCD88 80126688 A0430010 */  sb        $v1, 0x10($v0)
/* BCD8C 8012668C 30A2FFFF */  andi      $v0, $a1, 0xFFFF
/* BCD90 80126690 02221021 */  addu      $v0, $s1, $v0
/* BCD94 80126694 2403001C */  addiu     $v1, $zero, 0x1C
/* BCD98 80126698 3084FFFF */  andi      $a0, $a0, 0xFFFF
/* BCD9C 8012669C 02242021 */  addu      $a0, $s1, $a0
/* BCDA0 801266A0 A0430010 */  sb        $v1, 0x10($v0)
/* BCDA4 801266A4 24020009 */  addiu     $v0, $zero, 0x9
/* BCDA8 801266A8 A0820010 */  sb        $v0, 0x10($a0)
/* BCDAC 801266AC 96220004 */  lhu       $v0, 0x4($s1)
/* BCDB0 801266B0 24B20002 */  addiu     $s2, $a1, 0x2
/* BCDB4 801266B4 24420003 */  addiu     $v0, $v0, 0x3
/* BCDB8 801266B8 A6220004 */  sh        $v0, 0x4($s1)
.L801266BC:
/* BCDBC 801266BC 32A20008 */  andi      $v0, $s5, 0x8
/* BCDC0 801266C0 10400011 */  beqz      $v0, .L80126708
/* BCDC4 801266C4 26440001 */   addiu    $a0, $s2, 0x1
/* BCDC8 801266C8 24850001 */  addiu     $a1, $a0, 0x1
/* BCDCC 801266CC 3242FFFF */  andi      $v0, $s2, 0xFFFF
/* BCDD0 801266D0 02221021 */  addu      $v0, $s1, $v0
/* BCDD4 801266D4 240300FF */  addiu     $v1, $zero, 0xFF
/* BCDD8 801266D8 3084FFFF */  andi      $a0, $a0, 0xFFFF
/* BCDDC 801266DC 02242021 */  addu      $a0, $s1, $a0
/* BCDE0 801266E0 A0430010 */  sb        $v1, 0x10($v0)
/* BCDE4 801266E4 2402001C */  addiu     $v0, $zero, 0x1C
/* BCDE8 801266E8 30A5FFFF */  andi      $a1, $a1, 0xFFFF
/* BCDEC 801266EC 02252821 */  addu      $a1, $s1, $a1
/* BCDF0 801266F0 A0820010 */  sb        $v0, 0x10($a0)
/* BCDF4 801266F4 2402000E */  addiu     $v0, $zero, 0xE
glabel func_801266F8
/* BCDF8 801266F8 A0A20010 */  sb        $v0, 0x10($a1)
/* BCDFC 801266FC 96220004 */  lhu       $v0, 0x4($s1)
/* BCE00 80126700 24420003 */  addiu     $v0, $v0, 0x3
/* BCE04 80126704 A6220004 */  sh        $v0, 0x4($s1)
.L80126708:
/* BCE08 80126708 0220202D */  daddu     $a0, $s1, $zero
/* BCE0C 8012670C 24052710 */  addiu     $a1, $zero, 0x2710
/* BCE10 80126710 0C04915C */  jal       msg_copy_to_print_buffer
/* BCE14 80126714 24060001 */   addiu    $a2, $zero, 0x1
/* BCE18 80126718 0220202D */  daddu     $a0, $s1, $zero
/* BCE1C 8012671C 0000382D */  daddu     $a3, $zero, $zero
/* BCE20 80126720 8FA805AC */  lw        $t0, 0x5AC($sp)
/* BCE24 80126724 32C2FFFF */  andi      $v0, $s6, 0xFFFF
/* BCE28 80126728 AFA20014 */  sw        $v0, 0x14($sp)
/* BCE2C 8012672C 33C200FF */  andi      $v0, $fp, 0xFF
/* BCE30 80126730 AFA00010 */  sw        $zero, 0x10($sp)
glabel func_80126734
/* BCE34 80126734 AFA20018 */  sw        $v0, 0x18($sp)
/* BCE38 80126738 00082C00 */  sll       $a1, $t0, 16
/* BCE3C 8012673C 8FA805B0 */  lw        $t0, 0x5B0($sp)
/* BCE40 80126740 00052C03 */  sra       $a1, $a1, 16
/* BCE44 80126744 00083400 */  sll       $a2, $t0, 16
/* BCE48 80126748 0C049F64 */  jal       appendGfx_message
/* BCE4C 8012674C 00063403 */   sra      $a2, $a2, 16
/* BCE50 80126750 12800003 */  beqz      $s4, .L80126760
/* BCE54 80126754 00000000 */   nop
/* BCE58 80126758 0C00AB1E */  jal       general_heap_free
/* BCE5C 8012675C 0280202D */   daddu    $a0, $s4, $zero
.L80126760:
/* BCE60 80126760 8FBF05A4 */  lw        $ra, 0x5A4($sp)
/* BCE64 80126764 8FBE05A0 */  lw        $fp, 0x5A0($sp)
/* BCE68 80126768 8FB7059C */  lw        $s7, 0x59C($sp)
/* BCE6C 8012676C 8FB60598 */  lw        $s6, 0x598($sp)
/* BCE70 80126770 8FB50594 */  lw        $s5, 0x594($sp)
/* BCE74 80126774 8FB40590 */  lw        $s4, 0x590($sp)
/* BCE78 80126778 8FB3058C */  lw        $s3, 0x58C($sp)
/* BCE7C 8012677C 8FB20588 */  lw        $s2, 0x588($sp)
/* BCE80 80126780 8FB10584 */  lw        $s1, 0x584($sp)
/* BCE84 80126784 8FB00580 */  lw        $s0, 0x580($sp)
/* BCE88 80126788 03E00008 */  jr        $ra
/* BCE8C 8012678C 27BD05A8 */   addiu    $sp, $sp, 0x5A8

### DECOMPILED C INSTRUCTIONS:

void draw_msg(s32 msgID, s32 posX, s32 posY, s32 opacity, s32 palette, u8 style) {
    MessagePrintState stackPrinter;
    MessagePrintState* printer;
    u16 bufferPos;
    s8* mallocSpace;
    s32 charset;
    u16 flags;
    s32 width;

    flags = 0;
    bufferPos = 0;
    mallocSpace = NULL;
    charset = 0;

    if (msgID != 0) {
        if (style & DRAW_MSG_STYLE_MENU) {
            flags = 2;
            charset = 1;
        }

        if (opacity < 0xFF) {
            flags |= 1;
        }

        printer = &stackPrinter;
        initialize_printer(printer, 1, 0);

        if (msgID < 0) {
            printer->srcBuffer = (u8*)msgID;
        } else {
            mallocSpace = general_heap_malloc(0x400);
            dma_load_msg(msgID, mallocSpace);
            printer->srcBuffer = mallocSpace;
            get_msg_properties((s32) printer->srcBuffer, 0, &width, 0, 0, 0, 0, charset);
            printer->msgWidth = width;
        }

        if (palette >= 0) {
            printer->printBuffer[bufferPos++] = MSG_CHAR_PRINT_FUNCTION;
            printer->printBuffer[bufferPos++] = MSG_PRINT_FUNC_COLOR;
            printer->printBuffer[bufferPos++] = palette;
            printer->printBufferPos += 3;
        }

        if (style & DRAW_MSG_STYLE_WAVY) {
            printer->printBuffer[bufferPos++] = MSG_CHAR_PRINT_FUNCTION;
            printer->printBuffer[bufferPos++] = MSG_PRINT_FUNC_START_FX;
            printer->printBuffer[bufferPos++] = MSG_FX_GLOBAL_WAVE;
            printer->printBufferPos += 3;
        }

        if (style & DRAW_MSG_STYLE_RAINBOW) {
            printer->printBuffer[bufferPos++] = MSG_CHAR_PRINT_FUNCTION;
            printer->printBuffer[bufferPos++] = MSG_PRINT_FUNC_START_FX;
            printer->printBuffer[bufferPos++] = MSG_FX_GLOBAL_RAINBOW;
            printer->printBufferPos += 3;
        }

        if (style & DRAW_MSG_STYLE_DROP_SHADOW) {
            printer->printBuffer[bufferPos++] = MSG_CHAR_PRINT_FUNCTION;
            printer->printBuffer[bufferPos++] = MSG_PRINT_FUNC_START_FX;
            printer->printBuffer[bufferPos++] = MSG_FX_DROP_SHADOW;
            printer->printBufferPos += 3;
        }

        msg_copy_to_print_buffer(printer, 10000, 1);
        appendGfx_message(printer, (s16)posX, (s16)posY, 0, 0, flags, opacity & 0xFF);

        if (mallocSpace != NULL) {
            general_heap_free(mallocSpace);
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel func_E010E000
/* 3EB4E0 E010E000 14A00004 */  bnez      $a1, .LE010E014
/* 3EB4E4 E010E004 8C83001C */   lw       $v1, 0x1C($a0)
/* 3EB4E8 E010E008 C4860004 */  lwc1      $f6, 0x4($a0)
/* 3EB4EC E010E00C 08043807 */  j         .LE010E01C
/* 3EB4F0 E010E010 C4840008 */   lwc1     $f4, 0x8($a0)
.LE010E014:
/* 3EB4F4 E010E014 C4860010 */  lwc1      $f6, 0x10($a0)
/* 3EB4F8 E010E018 C4840014 */  lwc1      $f4, 0x14($a0)
.LE010E01C:
/* 3EB4FC E010E01C 10C000C1 */  beqz      $a2, .LE010E324
/* 3EB500 E010E020 00000000 */   nop
/* 3EB504 E010E024 8CC20000 */  lw        $v0, 0x0($a2)
/* 3EB508 E010E028 104000B5 */  beqz      $v0, .LE010E300
/* 3EB50C E010E02C 00035080 */   sll      $t2, $v1, 2
/* 3EB510 E010E030 3C08800A */  lui       $t0, %hi(gMainGfxPos)
/* 3EB514 E010E034 2508A66C */  addiu     $t0, $t0, %lo(gMainGfxPos)
/* 3EB518 E010E038 3C014080 */  lui       $at, (0x40800000 >> 16)
/* 3EB51C E010E03C 44814000 */  mtc1      $at, $f8
/* 3EB520 E010E040 24C70006 */  addiu     $a3, $a2, 0x6
.LE010E044:
/* 3EB524 E010E044 8D040000 */  lw        $a0, 0x0($t0)
/* 3EB528 E010E048 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 3EB52C E010E04C 0080182D */  daddu     $v1, $a0, $zero
/* 3EB530 E010E050 AC620000 */  sw        $v0, 0x0($v1)
/* 3EB534 E010E054 8CC20000 */  lw        $v0, 0x0($a2)
/* 3EB538 E010E058 24840008 */  addiu     $a0, $a0, 0x8
/* 3EB53C E010E05C AC620004 */  sw        $v0, 0x4($v1)
/* 3EB540 E010E060 84E2FFFE */  lh        $v0, -0x2($a3)
/* 3EB544 E010E064 3C03F200 */  lui       $v1, (0xF2000000 >> 16)
/* 3EB548 E010E068 2442FE80 */  addiu     $v0, $v0, -0x180
/* 3EB54C E010E06C 01421023 */  subu      $v0, $t2, $v0
/* 3EB550 E010E070 00021080 */  sll       $v0, $v0, 2
/* 3EB554 E010E074 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3EB558 E010E078 00021300 */  sll       $v0, $v0, 12
/* 3EB55C E010E07C 00431025 */  or        $v0, $v0, $v1
/* 3EB560 E010E080 AC820000 */  sw        $v0, 0x0($a0)
/* 3EB564 E010E084 84E2FFFE */  lh        $v0, -0x2($a3)
/* 3EB568 E010E088 3C030100 */  lui       $v1, (0x1000000 >> 16)
/* 3EB56C E010E08C 01421023 */  subu      $v0, $t2, $v0
/* 3EB570 E010E090 244201FF */  addiu     $v0, $v0, 0x1FF
/* 3EB574 E010E094 00021080 */  sll       $v0, $v0, 2
/* 3EB578 E010E098 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3EB57C E010E09C 00021300 */  sll       $v0, $v0, 12
/* 3EB580 E010E0A0 00431025 */  or        $v0, $v0, $v1
/* 3EB584 E010E0A4 AC820004 */  sw        $v0, 0x4($a0)
/* 3EB588 E010E0A8 84E2FFFE */  lh        $v0, -0x2($a3)
/* 3EB58C E010E0AC 44821000 */  mtc1      $v0, $f2
/* 3EB590 E010E0B0 00000000 */  nop
/* 3EB594 E010E0B4 468010A0 */  cvt.s.w   $f2, $f2
/* 3EB598 E010E0B8 46023080 */  add.s     $f2, $f6, $f2
/* 3EB59C E010E0BC 84E20002 */  lh        $v0, 0x2($a3)
/* 3EB5A0 E010E0C0 44820000 */  mtc1      $v0, $f0
/* 3EB5A4 E010E0C4 00000000 */  nop
/* 3EB5A8 E010E0C8 46800020 */  cvt.s.w   $f0, $f0
/* 3EB5AC E010E0CC 46001080 */  add.s     $f2, $f2, $f0
/* 3EB5B0 E010E0D0 AD040000 */  sw        $a0, 0x0($t0)
/* 3EB5B4 E010E0D4 24820008 */  addiu     $v0, $a0, 0x8
/* 3EB5B8 E010E0D8 46081082 */  mul.s     $f2, $f2, $f8
/* 3EB5BC E010E0DC 00000000 */  nop
/* 3EB5C0 E010E0E0 24840010 */  addiu     $a0, $a0, 0x10
/* 3EB5C4 E010E0E4 AD020000 */  sw        $v0, 0x0($t0)
/* 3EB5C8 E010E0E8 AD040000 */  sw        $a0, 0x0($t0)
/* 3EB5CC E010E0EC 0040202D */  daddu     $a0, $v0, $zero
/* 3EB5D0 E010E0F0 4600128D */  trunc.w.s $f10, $f2
/* 3EB5D4 E010E0F4 44025000 */  mfc1      $v0, $f10
/* 3EB5D8 E010E0F8 00000000 */  nop
/* 3EB5DC E010E0FC 00021400 */  sll       $v0, $v0, 16
/* 3EB5E0 E010E100 00021403 */  sra       $v0, $v0, 16
/* 3EB5E4 E010E104 18400005 */  blez      $v0, .LE010E11C
/* 3EB5E8 E010E108 30420FFF */   andi     $v0, $v0, 0xFFF
/* 3EB5EC E010E10C 00021300 */  sll       $v0, $v0, 12
/* 3EB5F0 E010E110 3C03E400 */  lui       $v1, (0xE4000000 >> 16)
/* 3EB5F4 E010E114 08043848 */  j         .LE010E120
/* 3EB5F8 E010E118 00431825 */   or       $v1, $v0, $v1
.LE010E11C:
/* 3EB5FC E010E11C 3C03E400 */  lui       $v1, (0xE4000000 >> 16)
.LE010E120:
/* 3EB600 E010E120 84E20000 */  lh        $v0, 0x0($a3)
/* 3EB604 E010E124 44820000 */  mtc1      $v0, $f0
/* 3EB608 E010E128 00000000 */  nop
/* 3EB60C E010E12C 46800020 */  cvt.s.w   $f0, $f0
/* 3EB610 E010E130 84E20004 */  lh        $v0, 0x4($a3)
/* 3EB614 E010E134 46002000 */  add.s     $f0, $f4, $f0
/* 3EB618 E010E138 44821000 */  mtc1      $v0, $f2
/* 3EB61C E010E13C 00000000 */  nop
/* 3EB620 E010E140 468010A0 */  cvt.s.w   $f2, $f2
/* 3EB624 E010E144 46020000 */  add.s     $f0, $f0, $f2
/* 3EB628 E010E148 46080002 */  mul.s     $f0, $f0, $f8
/* 3EB62C E010E14C 00000000 */  nop
/* 3EB630 E010E150 4600028D */  trunc.w.s $f10, $f0
/* 3EB634 E010E154 44025000 */  mfc1      $v0, $f10
/* 3EB638 E010E158 00000000 */  nop
/* 3EB63C E010E15C 00021400 */  sll       $v0, $v0, 16
/* 3EB640 E010E160 00021403 */  sra       $v0, $v0, 16
/* 3EB644 E010E164 18400002 */  blez      $v0, .LE010E170
/* 3EB648 E010E168 30420FFF */   andi     $v0, $v0, 0xFFF
/* 3EB64C E010E16C 00621825 */  or        $v1, $v1, $v0
.LE010E170:
/* 3EB650 E010E170 AC830000 */  sw        $v1, 0x0($a0)
/* 3EB654 E010E174 84E2FFFE */  lh        $v0, -0x2($a3)
/* 3EB658 E010E178 44820000 */  mtc1      $v0, $f0
/* 3EB65C E010E17C 00000000 */  nop
/* 3EB660 E010E180 46800020 */  cvt.s.w   $f0, $f0
/* 3EB664 E010E184 46003000 */  add.s     $f0, $f6, $f0
/* 3EB668 E010E188 46080002 */  mul.s     $f0, $f0, $f8
/* 3EB66C E010E18C 00000000 */  nop
/* 3EB670 E010E190 4600028D */  trunc.w.s $f10, $f0
/* 3EB674 E010E194 44025000 */  mfc1      $v0, $f10
/* 3EB678 E010E198 00000000 */  nop
/* 3EB67C E010E19C 00021400 */  sll       $v0, $v0, 16
/* 3EB680 E010E1A0 00021403 */  sra       $v0, $v0, 16
/* 3EB684 E010E1A4 18400004 */  blez      $v0, .LE010E1B8
/* 3EB688 E010E1A8 24850004 */   addiu    $a1, $a0, 0x4
/* 3EB68C E010E1AC 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3EB690 E010E1B0 0804386F */  j         .LE010E1BC
/* 3EB694 E010E1B4 00021B00 */   sll      $v1, $v0, 12
.LE010E1B8:
/* 3EB698 E010E1B8 0000182D */  daddu     $v1, $zero, $zero
.LE010E1BC:
/* 3EB69C E010E1BC 84E20000 */  lh        $v0, 0x0($a3)
/* 3EB6A0 E010E1C0 44820000 */  mtc1      $v0, $f0
/* 3EB6A4 E010E1C4 00000000 */  nop
/* 3EB6A8 E010E1C8 46800020 */  cvt.s.w   $f0, $f0
/* 3EB6AC E010E1CC 46002000 */  add.s     $f0, $f4, $f0
/* 3EB6B0 E010E1D0 46080002 */  mul.s     $f0, $f0, $f8
/* 3EB6B4 E010E1D4 00000000 */  nop
/* 3EB6B8 E010E1D8 4600028D */  trunc.w.s $f10, $f0
/* 3EB6BC E010E1DC 44025000 */  mfc1      $v0, $f10
/* 3EB6C0 E010E1E0 00000000 */  nop
/* 3EB6C4 E010E1E4 00021400 */  sll       $v0, $v0, 16
/* 3EB6C8 E010E1E8 00021403 */  sra       $v0, $v0, 16
/* 3EB6CC E010E1EC 18400003 */  blez      $v0, .LE010E1FC
/* 3EB6D0 E010E1F0 0060202D */   daddu    $a0, $v1, $zero
/* 3EB6D4 E010E1F4 30420FFF */  andi      $v0, $v0, 0xFFF
/* 3EB6D8 E010E1F8 00822025 */  or        $a0, $a0, $v0
.LE010E1FC:
/* 3EB6DC E010E1FC 8D030000 */  lw        $v1, 0x0($t0)
/* 3EB6E0 E010E200 3C02E100 */  lui       $v0, (0xE1000000 >> 16)
/* 3EB6E4 E010E204 ACA40000 */  sw        $a0, 0x0($a1)
/* 3EB6E8 E010E208 0060202D */  daddu     $a0, $v1, $zero
/* 3EB6EC E010E20C AC820000 */  sw        $v0, 0x0($a0)
/* 3EB6F0 E010E210 84E2FFFE */  lh        $v0, -0x2($a3)
/* 3EB6F4 E010E214 44820000 */  mtc1      $v0, $f0
/* 3EB6F8 E010E218 00000000 */  nop
/* 3EB6FC E010E21C 46800020 */  cvt.s.w   $f0, $f0
/* 3EB700 E010E220 46003000 */  add.s     $f0, $f6, $f0
/* 3EB704 E010E224 46080002 */  mul.s     $f0, $f0, $f8
/* 3EB708 E010E228 00000000 */  nop
/* 3EB70C E010E22C 24630008 */  addiu     $v1, $v1, 0x8
/* 3EB710 E010E230 24890004 */  addiu     $t1, $a0, 0x4
/* 3EB714 E010E234 4600028D */  trunc.w.s $f10, $f0
/* 3EB718 E010E238 44025000 */  mfc1      $v0, $f10
/* 3EB71C E010E23C 00000000 */  nop
/* 3EB720 E010E240 00021400 */  sll       $v0, $v0, 16
/* 3EB724 E010E244 00021403 */  sra       $v0, $v0, 16
/* 3EB728 E010E248 04410007 */  bgez      $v0, .LE010E268
/* 3EB72C E010E24C AD030000 */   sw       $v1, 0x0($t0)
/* 3EB730 E010E250 000210C0 */  sll       $v0, $v0, 3
/* 3EB734 E010E254 5C400001 */  bgtzl     $v0, .LE010E25C
/* 3EB738 E010E258 0000102D */   daddu    $v0, $zero, $zero
.LE010E25C:
/* 3EB73C E010E25C 00021023 */  negu      $v0, $v0
/* 3EB740 E010E260 0804389B */  j         .LE010E26C
/* 3EB744 E010E264 00021C00 */   sll      $v1, $v0, 16
.LE010E268:
/* 3EB748 E010E268 0000182D */  daddu     $v1, $zero, $zero
.LE010E26C:
/* 3EB74C E010E26C 84E20000 */  lh        $v0, 0x0($a3)
/* 3EB750 E010E270 44820000 */  mtc1      $v0, $f0
/* 3EB754 E010E274 00000000 */  nop
/* 3EB758 E010E278 46800020 */  cvt.s.w   $f0, $f0
/* 3EB75C E010E27C 46002000 */  add.s     $f0, $f4, $f0
/* 3EB760 E010E280 46080082 */  mul.s     $f2, $f0, $f8
/* 3EB764 E010E284 00000000 */  nop
/* 3EB768 E010E288 44800000 */  mtc1      $zero, $f0
/* 3EB76C E010E28C 00000000 */  nop
/* 3EB770 E010E290 4600103C */  c.lt.s    $f2, $f0
/* 3EB774 E010E294 00000000 */  nop
/* 3EB778 E010E298 4500000C */  bc1f      .LE010E2CC
/* 3EB77C E010E29C 3C050400 */   lui      $a1, (0x4000400 >> 16)
/* 3EB780 E010E2A0 4600128D */  trunc.w.s $f10, $f2
/* 3EB784 E010E2A4 44025000 */  mfc1      $v0, $f10
/* 3EB788 E010E2A8 00000000 */  nop
/* 3EB78C E010E2AC 00021400 */  sll       $v0, $v0, 16
/* 3EB790 E010E2B0 00021343 */  sra       $v0, $v0, 13
/* 3EB794 E010E2B4 5C400001 */  bgtzl     $v0, .LE010E2BC
/* 3EB798 E010E2B8 0000102D */   daddu    $v0, $zero, $zero
.LE010E2BC:
/* 3EB79C E010E2BC 00021023 */  negu      $v0, $v0
/* 3EB7A0 E010E2C0 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 3EB7A4 E010E2C4 00621825 */  or        $v1, $v1, $v0
/* 3EB7A8 E010E2C8 3C050400 */  lui       $a1, (0x4000400 >> 16)
.LE010E2CC:
/* 3EB7AC E010E2CC 34A50400 */  ori       $a1, $a1, (0x4000400 & 0xFFFF)
/* 3EB7B0 E010E2D0 24E7000C */  addiu     $a3, $a3, 0xC
/* 3EB7B4 E010E2D4 24C6000C */  addiu     $a2, $a2, 0xC
/* 3EB7B8 E010E2D8 8D040000 */  lw        $a0, 0x0($t0)
/* 3EB7BC E010E2DC 3C02F100 */  lui       $v0, (0xF1000000 >> 16)
/* 3EB7C0 E010E2E0 AD230000 */  sw        $v1, 0x0($t1)
/* 3EB7C4 E010E2E4 0080182D */  daddu     $v1, $a0, $zero
/* 3EB7C8 E010E2E8 AC620000 */  sw        $v0, 0x0($v1)
/* 3EB7CC E010E2EC AC650004 */  sw        $a1, 0x4($v1)
/* 3EB7D0 E010E2F0 8CC20000 */  lw        $v0, 0x0($a2)
/* 3EB7D4 E010E2F4 24840008 */  addiu     $a0, $a0, 0x8
/* 3EB7D8 E010E2F8 1440FF52 */  bnez      $v0, .LE010E044
/* 3EB7DC E010E2FC AD040000 */   sw       $a0, 0x0($t0)
.LE010E300:
/* 3EB7E0 E010E300 3C03800A */  lui       $v1, %hi(gMainGfxPos)
/* 3EB7E4 E010E304 2463A66C */  addiu     $v1, $v1, %lo(gMainGfxPos)
/* 3EB7E8 E010E308 8C620000 */  lw        $v0, 0x0($v1)
/* 3EB7EC E010E30C 0040202D */  daddu     $a0, $v0, $zero
/* 3EB7F0 E010E310 24420008 */  addiu     $v0, $v0, 0x8
/* 3EB7F4 E010E314 AC620000 */  sw        $v0, 0x0($v1)
/* 3EB7F8 E010E318 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 3EB7FC E010E31C AC820000 */  sw        $v0, 0x0($a0)
/* 3EB800 E010E320 AC800004 */  sw        $zero, 0x4($a0)
.LE010E324:
/* 3EB804 E010E324 03E00008 */  jr        $ra
/* 3EB808 E010E328 00000000 */   nop

### DECOMPILED C INSTRUCTIONS:

void func_E010E000(ChapterChangeFXData* data, s32 arg1, UnkStruct* arg2) {
    s32 unk_1C = data->lifetime;
    UnkStruct* it;
    f32 posX;
    f32 posY;
    s32 temp;

    if (arg1 == 0) {
        posX = data->chapterPos.x;
        posY = data->chapterPos.y;
    } else {
        posX = data->endOfPos.x;
        posY = data->endOfPos.y;
    }

    if (arg2 != NULL) {
        for (it = arg2; it->displayList != NULL; it++) {
            gSPDisplayList(gMainGfxPos++, it->displayList);

            temp = it->x - 384;
            gDPSetTileSize(gMainGfxPos++, 1, (unk_1C * 4 - temp) * 4, 0, (unk_1C * 4 - it->x + 511) * 4, 0);
            gSPScisTextureRectangle(gMainGfxPos++,
                (posX + it->x) * 4,
                (posY + it->y) * 4,
                (posX + it->x + it->width) * 4,
                (posY + it->y + it->height) * 4,
                G_TX_RENDERTILE, 0, 0, 1024, 1024);
        }

        gDPPipeSync(gMainGfxPos++);
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel PartnerAfflictEnemy
/* 1AE8E4 80280004 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 1AE8E8 80280008 AFB20018 */  sw        $s2, 0x18($sp)
/* 1AE8EC 8028000C 0080902D */  daddu     $s2, $a0, $zero
/* 1AE8F0 80280010 AFBF0024 */  sw        $ra, 0x24($sp)
/* 1AE8F4 80280014 AFB40020 */  sw        $s4, 0x20($sp)
/* 1AE8F8 80280018 AFB3001C */  sw        $s3, 0x1C($sp)
/* 1AE8FC 8028001C AFB10014 */  sw        $s1, 0x14($sp)
/* 1AE900 80280020 AFB00010 */  sw        $s0, 0x10($sp)
/* 1AE904 80280024 8E440148 */  lw        $a0, 0x148($s2)
/* 1AE908 80280028 0C09A75B */  jal       get_actor
/* 1AE90C 8028002C 8E50000C */   lw       $s0, 0xC($s2)
/* 1AE910 80280030 8E140000 */  lw        $s4, 0x0($s0)
/* 1AE914 80280034 26100004 */  addiu     $s0, $s0, 0x4
/* 1AE918 80280038 8E030000 */  lw        $v1, 0x0($s0)
/* 1AE91C 8028003C 26100004 */  addiu     $s0, $s0, 0x4
/* 1AE920 80280040 0240202D */  daddu     $a0, $s2, $zero
/* 1AE924 80280044 3C11800E */  lui       $s1, %hi(gBattleStatus)
/* 1AE928 80280048 2631C070 */  addiu     $s1, $s1, %lo(gBattleStatus)
/* 1AE92C 8028004C 0040982D */  daddu     $s3, $v0, $zero
/* 1AE930 80280050 AE230188 */  sw        $v1, 0x188($s1)
/* 1AE934 80280054 8E030000 */  lw        $v1, 0x0($s0)
/* 1AE938 80280058 26100004 */  addiu     $s0, $s0, 0x4
/* 1AE93C 8028005C AE23018C */  sw        $v1, 0x18C($s1)
/* 1AE940 80280060 8E030000 */  lw        $v1, 0x0($s0)
/* 1AE944 80280064 26100004 */  addiu     $s0, $s0, 0x4
/* 1AE948 80280068 AE230190 */  sw        $v1, 0x190($s1)
/* 1AE94C 8028006C 8E050000 */  lw        $a1, 0x0($s0)
/* 1AE950 80280070 0C0B1EAF */  jal       evt_get_variable
/* 1AE954 80280074 26100004 */   addiu    $s0, $s0, 0x4
/* 1AE958 80280078 8E230190 */  lw        $v1, 0x190($s1)
/* 1AE95C 8028007C 0240202D */  daddu     $a0, $s2, $zero
/* 1AE960 80280080 00621825 */  or        $v1, $v1, $v0
/* 1AE964 80280084 AE230190 */  sw        $v1, 0x190($s1)
glabel shop_owner_buy_dialog
/* 1AE968 80280088 8E050000 */  lw        $a1, 0x0($s0)
/* 1AE96C 8028008C 0C0B1EAF */  jal       evt_get_variable
/* 1AE970 80280090 26100004 */   addiu    $s0, $s0, 0x4
/* 1AE974 80280094 A622017E */  sh        $v0, 0x17E($s1)
/* 1AE978 80280098 A2200198 */  sb        $zero, 0x198($s1)
/* 1AE97C 8028009C 8E100000 */  lw        $s0, 0x0($s0)
/* 1AE980 802800A0 24020030 */  addiu     $v0, $zero, 0x30
/* 1AE984 802800A4 32030030 */  andi      $v1, $s0, 0x30
/* 1AE988 802800A8 54620004 */  bnel      $v1, $v0, .L802800BC
/* 1AE98C 802800AC 32020010 */   andi     $v0, $s0, 0x10
/* 1AE990 802800B0 8E220000 */  lw        $v0, 0x0($s1)
/* 1AE994 802800B4 080A003F */  j         .L802800FC
/* 1AE998 802800B8 34420030 */   ori      $v0, $v0, 0x30
.L802800BC:
/* 1AE99C 802800BC 10400004 */  beqz      $v0, .L802800D0
/* 1AE9A0 802800C0 2403FFDF */   addiu    $v1, $zero, -0x21
/* 1AE9A4 802800C4 8E220000 */  lw        $v0, 0x0($s1)
/* 1AE9A8 802800C8 080A003E */  j         .L802800F8
/* 1AE9AC 802800CC 34420010 */   ori      $v0, $v0, 0x10
.L802800D0:
/* 1AE9B0 802800D0 32020020 */  andi      $v0, $s0, 0x20
/* 1AE9B4 802800D4 10400005 */  beqz      $v0, .L802800EC
/* 1AE9B8 802800D8 2403FFEF */   addiu    $v1, $zero, -0x11
/* 1AE9BC 802800DC 8E220000 */  lw        $v0, 0x0($s1)
/* 1AE9C0 802800E0 00431024 */  and       $v0, $v0, $v1
/* 1AE9C4 802800E4 080A003F */  j         .L802800FC
/* 1AE9C8 802800E8 34420020 */   ori      $v0, $v0, 0x20
.L802800EC:
/* 1AE9CC 802800EC 8E220000 */  lw        $v0, 0x0($s1)
/* 1AE9D0 802800F0 00431024 */  and       $v0, $v0, $v1
/* 1AE9D4 802800F4 2403FFDF */  addiu     $v1, $zero, -0x21
.L802800F8:
/* 1AE9D8 802800F8 00431024 */  and       $v0, $v0, $v1
.L802800FC:
/* 1AE9DC 802800FC AE220000 */  sw        $v0, 0x0($s1)
/* 1AE9E0 80280100 32020040 */  andi      $v0, $s0, 0x40
/* 1AE9E4 80280104 10400007 */  beqz      $v0, .L80280124
/* 1AE9E8 80280108 2404FFBF */   addiu    $a0, $zero, -0x41
/* 1AE9EC 8028010C 3C03800E */  lui       $v1, %hi(gBattleStatus)
/* 1AE9F0 80280110 2463C070 */  addiu     $v1, $v1, %lo(gBattleStatus)
.L80280114:
/* 1AE9F4 80280114 8C620000 */  lw        $v0, 0x0($v1)
/* 1AE9F8 80280118 34420040 */  ori       $v0, $v0, 0x40
.L8028011C:
/* 1AE9FC 8028011C 080A004E */  j         .L80280138
/* 1AEA00 80280120 AC620000 */   sw       $v0, 0x0($v1)
.L80280124:
/* 1AEA04 80280124 3C02800E */  lui       $v0, %hi(gBattleStatus)
/* 1AEA08 80280128 2442C070 */  addiu     $v0, $v0, %lo(gBattleStatus)
/* 1AEA0C 8028012C 8C430000 */  lw        $v1, 0x0($v0)
/* 1AEA10 80280130 00641824 */  and       $v1, $v1, $a0
/* 1AEA14 80280134 AC430000 */  sw        $v1, 0x0($v0)
.L80280138:
/* 1AEA18 80280138 32020200 */  andi      $v0, $s0, 0x200
/* 1AEA1C 8028013C 10400007 */  beqz      $v0, .L8028015C
/* 1AEA20 80280140 2404FDFF */   addiu    $a0, $zero, -0x201
/* 1AEA24 80280144 3C03800E */  lui       $v1, %hi(gBattleStatus)
/* 1AEA28 80280148 2463C070 */  addiu     $v1, $v1, %lo(gBattleStatus)
/* 1AEA2C 8028014C 8C620000 */  lw        $v0, 0x0($v1)
/* 1AEA30 80280150 34420200 */  ori       $v0, $v0, 0x200
/* 1AEA34 80280154 080A005C */  j         .L80280170
/* 1AEA38 80280158 AC620000 */   sw       $v0, 0x0($v1)
.L8028015C:
/* 1AEA3C 8028015C 3C02800E */  lui       $v0, %hi(gBattleStatus)
/* 1AEA40 80280160 2442C070 */  addiu     $v0, $v0, %lo(gBattleStatus)
/* 1AEA44 80280164 8C430000 */  lw        $v1, 0x0($v0)
/* 1AEA48 80280168 00641824 */  and       $v1, $v1, $a0
/* 1AEA4C 8028016C AC430000 */  sw        $v1, 0x0($v0)
.L80280170:
/* 1AEA50 80280170 32020080 */  andi      $v0, $s0, 0x80
/* 1AEA54 80280174 10400007 */  beqz      $v0, .L80280194
/* 1AEA58 80280178 2404FF7F */   addiu    $a0, $zero, -0x81
glabel shop_owner_continue_speech
/* 1AEA5C 8028017C 3C03800E */  lui       $v1, %hi(gBattleStatus)
/* 1AEA60 80280180 2463C070 */  addiu     $v1, $v1, %lo(gBattleStatus)
/* 1AEA64 80280184 8C620000 */  lw        $v0, 0x0($v1)
/* 1AEA68 80280188 34420080 */  ori       $v0, $v0, 0x80
/* 1AEA6C 8028018C 080A006A */  j         .L802801A8
/* 1AEA70 80280190 AC620000 */   sw       $v0, 0x0($v1)
.L80280194:
/* 1AEA74 80280194 3C02800E */  lui       $v0, %hi(gBattleStatus)
/* 1AEA78 80280198 2442C070 */  addiu     $v0, $v0, %lo(gBattleStatus)
/* 1AEA7C 8028019C 8C430000 */  lw        $v1, 0x0($v0)
/* 1AEA80 802801A0 00641824 */  and       $v1, $v1, $a0
/* 1AEA84 802801A4 AC430000 */  sw        $v1, 0x0($v0)
.L802801A8:
/* 1AEA88 802801A8 32020800 */  andi      $v0, $s0, 0x800
/* 1AEA8C 802801AC 10400007 */  beqz      $v0, .L802801CC
/* 1AEA90 802801B0 2404F7FF */   addiu    $a0, $zero, -0x801
/* 1AEA94 802801B4 3C03800E */  lui       $v1, %hi(gBattleStatus)
/* 1AEA98 802801B8 2463C070 */  addiu     $v1, $v1, %lo(gBattleStatus)
/* 1AEA9C 802801BC 8C620000 */  lw        $v0, 0x0($v1)
/* 1AEAA0 802801C0 34420800 */  ori       $v0, $v0, 0x800
/* 1AEAA4 802801C4 080A0078 */  j         .L802801E0
/* 1AEAA8 802801C8 AC620000 */   sw       $v0, 0x0($v1)
.L802801CC:
/* 1AEAAC 802801CC 3C02800E */  lui       $v0, %hi(gBattleStatus)
/* 1AEAB0 802801D0 2442C070 */  addiu     $v0, $v0, %lo(gBattleStatus)
/* 1AEAB4 802801D4 8C430000 */  lw        $v1, 0x0($v0)
/* 1AEAB8 802801D8 00641824 */  and       $v1, $v1, $a0
/* 1AEABC 802801DC AC430000 */  sw        $v1, 0x0($v0)
.L802801E0:
/* 1AEAC0 802801E0 96620428 */  lhu       $v0, 0x428($s3)
/* 1AEAC4 802801E4 92230193 */  lbu       $v1, 0x193($s1)
/* 1AEAC8 802801E8 A62201A0 */  sh        $v0, 0x1A0($s1)
/* 1AEACC 802801EC 92620426 */  lbu       $v0, 0x426($s3)
/* 1AEAD0 802801F0 A2230194 */  sb        $v1, 0x194($s1)
/* 1AEAD4 802801F4 306300FF */  andi      $v1, $v1, 0xFF
/* 1AEAD8 802801F8 A22201A2 */  sb        $v0, 0x1A2($s1)
/* 1AEADC 802801FC 240200FF */  addiu     $v0, $zero, 0xFF
/* 1AEAE0 80280200 50620001 */  beql      $v1, $v0, shop_owner_continue_speech_with_quantity
/* 1AEAE4 80280204 A2200194 */   sb       $zero, 0x194($s1)
glabel shop_owner_continue_speech_with_quantity
/* 1AEAE8 80280208 8E220190 */  lw        $v0, 0x190($s1)
/* 1AEAEC 8028020C 30420F00 */  andi      $v0, $v0, 0xF00
/* 1AEAF0 80280210 00021203 */  sra       $v0, $v0, 8
/* 1AEAF4 80280214 0C09F8CA */  jal       calc_partner_damage_enemy
/* 1AEAF8 80280218 A2220195 */   sb       $v0, 0x195($s1)
/* 1AEAFC 8028021C 0440000B */  bltz      $v0, .L8028024C
/* 1AEB00 80280220 0240202D */   daddu    $a0, $s2, $zero
/* 1AEB04 80280224 0280282D */  daddu     $a1, $s4, $zero
/* 1AEB08 80280228 0C0B2026 */  jal       evt_set_variable
/* 1AEB0C 8028022C 0040302D */   daddu    $a2, $v0, $zero
/* 1AEB10 80280230 0C0B1069 */  jal       does_script_exist_by_ref
/* 1AEB14 80280234 0240202D */   daddu    $a0, $s2, $zero
/* 1AEB18 80280238 0040182D */  daddu     $v1, $v0, $zero
/* 1AEB1C 8028023C 10600004 */  beqz      $v1, .L80280250
/* 1AEB20 80280240 240200FF */   addiu    $v0, $zero, 0xFF
/* 1AEB24 80280244 080A0094 */  j         .L80280250
/* 1AEB28 80280248 24020002 */   addiu    $v0, $zero, 0x2
.L8028024C:
/* 1AEB2C 8028024C 240200FF */  addiu     $v0, $zero, 0xFF
.L80280250:
/* 1AEB30 80280250 8FBF0024 */  lw        $ra, 0x24($sp)
/* 1AEB34 80280254 8FB40020 */  lw        $s4, 0x20($sp)
/* 1AEB38 80280258 8FB3001C */  lw        $s3, 0x1C($sp)
/* 1AEB3C 8028025C 8FB20018 */  lw        $s2, 0x18($sp)
/* 1AEB40 80280260 8FB10014 */  lw        $s1, 0x14($sp)
/* 1AEB44 80280264 8FB00010 */  lw        $s0, 0x10($sp)
.L80280268:
/* 1AEB48 80280268 03E00008 */  jr        $ra
/* 1AEB4C 8028026C 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

ApiStatus PartnerAfflictEnemy(Evt* script, s32 isInitialCall) {
    BattleStatus* battleStatus = &gBattleStatus;
    Bytecode* args = script->ptrReadPos;
    Actor* actor = get_actor(script->owner1.enemyID);
    s32 returnValue = *args++;
    s32 flags;
    u8 statusChance;
    s32 damageResult;

    battleStatus->currentAttackElement = *args++;
    battleStatus->currentAttackEventSuppression = *args++;
    battleStatus->currentAttackStatus = *args++;
    battleStatus->currentAttackStatus |= evt_get_variable(script, *args++);
    battleStatus->currentAttackDamage = evt_get_variable(script, *args++);
    battleStatus->powerBounceCounter = 0;
    flags = *args++;

    if ((flags & (BS_FLAGS1_10 | BS_FLAGS1_SP_EVT_ACTIVE)) == (BS_FLAGS1_10 | BS_FLAGS1_SP_EVT_ACTIVE)) {
        battleStatus->flags1 |= BS_FLAGS1_10;
        battleStatus->flags1 |= BS_FLAGS1_SP_EVT_ACTIVE;
    } else if (flags & BS_FLAGS1_10) {
        battleStatus->flags1 |= BS_FLAGS1_10;
        battleStatus->flags1 &= ~BS_FLAGS1_SP_EVT_ACTIVE;
    } else if (flags & BS_FLAGS1_SP_EVT_ACTIVE) {
        battleStatus->flags1 &= ~BS_FLAGS1_10;
        battleStatus->flags1 |= BS_FLAGS1_SP_EVT_ACTIVE;
    } else {
        battleStatus->flags1 &= ~BS_FLAGS1_10;
        battleStatus->flags1 &= ~BS_FLAGS1_SP_EVT_ACTIVE;
    }

    if (flags & BS_FLAGS1_40) {
        gBattleStatus.flags1 |= BS_FLAGS1_40;
    } else {
        gBattleStatus.flags1 &= ~BS_FLAGS1_40;
    }
    if (flags & BS_FLAGS1_200) {
        gBattleStatus.flags1 |= BS_FLAGS1_200;
    } else {
        gBattleStatus.flags1 &= ~BS_FLAGS1_200;
    }
    if (flags & BS_FLAGS1_80) {
        gBattleStatus.flags1 |= BS_FLAGS1_80;
    } else {
        gBattleStatus.flags1 &= ~BS_FLAGS1_80;
    }
    if (flags & BS_FLAGS1_FORCE_HIT_IMMUNE) {
        gBattleStatus.flags1 |= BS_FLAGS1_FORCE_HIT_IMMUNE;
    } else {
        gBattleStatus.flags1 &= ~BS_FLAGS1_FORCE_HIT_IMMUNE;
    }

    statusChance = battleStatus->currentAttackStatus;
    battleStatus->currentTargetID = actor->targetActorID;
    battleStatus->currentTargetPart = actor->targetPartIndex;
    battleStatus->statusChance = statusChance;

    if (statusChance == STATUS_KEY_NEVER) {
        battleStatus->statusChance = 0;
    }

    battleStatus->statusDuration = (battleStatus->currentAttackStatus & 0xF00) >> 8;
    damageResult = calc_partner_damage_enemy();

    if (damageResult < 0) {
        return ApiStatus_FINISH;
    }

    evt_set_variable(script, returnValue, damageResult);

    if (!does_script_exist_by_ref(script)) {
        return ApiStatus_FINISH;
    }

    return ApiStatus_DONE2;
}