### RAW ASSEMBLY INSTRUCTIONS:

glabel create_audio_system
/* 25F00 8004AB00 27BDFFC0 */  addiu     $sp, $sp, -0x40
/* 25F04 8004AB04 AFB00030 */  sw        $s0, 0x30($sp)
/* 25F08 8004AB08 3C10800E */  lui       $s0, %hi(nuAuHeap)
/* 25F0C 8004AB0C 26109248 */  addiu     $s0, $s0, %lo(nuAuHeap)
/* 25F10 8004AB10 0200202D */  daddu     $a0, $s0, $zero
/* 25F14 8004AB14 3C05801B */  lui       $a1, %hi(AuHeapBase)
/* 25F18 8004AB18 24A5A000 */  addiu     $a1, $a1, %lo(AuHeapBase)
/* 25F1C 8004AB1C 3C060005 */  lui       $a2, (0x56000 >> 16)
/* 25F20 8004AB20 24020001 */  addiu     $v0, $zero, 0x1
/* 25F24 8004AB24 AFBF003C */  sw        $ra, 0x3C($sp)
/* 25F28 8004AB28 AFB20038 */  sw        $s2, 0x38($sp)
/* 25F2C 8004AB2C AFB10034 */  sw        $s1, 0x34($sp)
/* 25F30 8004AB30 3C018008 */  lui       $at, %hi(nuAuTaskStop)
/* 25F34 8004AB34 A0228180 */  sb        $v0, %lo(nuAuTaskStop)($at)
/* 25F38 8004AB38 3C018008 */  lui       $at, %hi(nuAuPreNMI)
/* 25F3C 8004AB3C A0208170 */  sb        $zero, %lo(nuAuPreNMI)($at)
/* 25F40 8004AB40 0C015FC8 */  jal       alHeapInit
/* 25F44 8004AB44 34C66000 */   ori      $a2, $a2, (0x56000 & 0xFFFF)
/* 25F48 8004AB48 24047D00 */  addiu     $a0, $zero, 0x7D00
/* 25F4C 8004AB4C 24020018 */  addiu     $v0, $zero, 0x18
/* 25F50 8004AB50 AFA20018 */  sw        $v0, 0x18($sp)
/* 25F54 8004AB54 24020004 */  addiu     $v0, $zero, 0x4
/* 25F58 8004AB58 0C018558 */  jal       osAiSetFrequency
/* 25F5C 8004AB5C AFA2001C */   sw       $v0, 0x1C($sp)
/* 25F60 8004AB60 3C03800E */  lui       $v1, %hi(D_800DAAB8)
/* 25F64 8004AB64 8C63AAB8 */  lw        $v1, %lo(D_800DAAB8)($v1)
/* 25F68 8004AB68 00620018 */  mult      $v1, $v0
/* 25F6C 8004AB6C 00001812 */  mflo      $v1
/* 25F70 8004AB70 2464003B */  addiu     $a0, $v1, 0x3B
/* 25F74 8004AB74 3C038888 */  lui       $v1, (0x88888889 >> 16)
/* 25F78 8004AB78 34638889 */  ori       $v1, $v1, (0x88888889 & 0xFFFF)
/* 25F7C 8004AB7C 00830019 */  multu     $a0, $v1
/* 25F80 8004AB80 0000882D */  daddu     $s1, $zero, $zero
/* 25F84 8004AB84 3C12800A */  lui       $s2, %hi(AlCmdListBuffers)
/* 25F88 8004AB88 26523510 */  addiu     $s2, $s2, %lo(AlCmdListBuffers)
/* 25F8C 8004AB8C AFA20020 */  sw        $v0, 0x20($sp)
/* 25F90 8004AB90 00001810 */  mfhi      $v1
/* 25F94 8004AB94 3C02B216 */  lui       $v0, (0xB21642C9 >> 16)
/* 25F98 8004AB98 344242C9 */  ori       $v0, $v0, (0xB21642C9 & 0xFFFF)
/* 25F9C 8004AB9C 00031942 */  srl       $v1, $v1, 5
/* 25FA0 8004ABA0 00620019 */  multu     $v1, $v0
/* 25FA4 8004ABA4 A3A00024 */  sb        $zero, 0x24($sp)
/* 25FA8 8004ABA8 AFB0002C */  sw        $s0, 0x2C($sp)
/* 25FAC 8004ABAC 3C028005 */  lui       $v0, %hi(nuAuDmaNew)
/* 25FB0 8004ABB0 2442B224 */  addiu     $v0, $v0, %lo(nuAuDmaNew)
/* 25FB4 8004ABB4 AFA20028 */  sw        $v0, 0x28($sp)
/* 25FB8 8004ABB8 00001810 */  mfhi      $v1
/* 25FBC 8004ABBC 000319C2 */  srl       $v1, $v1, 7
/* 25FC0 8004ABC0 24630001 */  addiu     $v1, $v1, 0x1
/* 25FC4 8004ABC4 00031040 */  sll       $v0, $v1, 1
/* 25FC8 8004ABC8 00431021 */  addu      $v0, $v0, $v1
/* 25FCC 8004ABCC 000210C0 */  sll       $v0, $v0, 3
/* 25FD0 8004ABD0 00431023 */  subu      $v0, $v0, $v1
/* 25FD4 8004ABD4 000210C0 */  sll       $v0, $v0, 3
/* 25FD8 8004ABD8 3C01800A */  lui       $at, %hi(AlFrameSize)
/* 25FDC 8004ABDC AC223634 */  sw        $v0, %lo(AlFrameSize)($at)
/* 25FE0 8004ABE0 2442FF48 */  addiu     $v0, $v0, -0xB8
/* 25FE4 8004ABE4 3C01800A */  lui       $at, %hi(AlMinFrameSize)
/* 25FE8 8004ABE8 AC223638 */  sw        $v0, %lo(AlMinFrameSize)($at)
.L8004ABEC:
/* 25FEC 8004ABEC 24050001 */  addiu     $a1, $zero, 0x1
/* 25FF0 8004ABF0 24064000 */  addiu     $a2, $zero, 0x4000
/* 25FF4 8004ABF4 8FA4002C */  lw        $a0, 0x2C($sp)
/* 25FF8 8004ABF8 0C015FE4 */  jal       alHeapAlloc
/* 25FFC 8004ABFC 02258821 */   addu     $s1, $s1, $a1
/* 26000 8004AC00 AE420000 */  sw        $v0, 0x0($s2)
/* 26004 8004AC04 2E220003 */  sltiu     $v0, $s1, 0x3
/* 26008 8004AC08 1440FFF8 */  bnez      $v0, .L8004ABEC
/* 2600C 8004AC0C 26520004 */   addiu    $s2, $s2, 0x4
/* 26010 8004AC10 0000882D */  daddu     $s1, $zero, $zero
/* 26014 8004AC14 24090002 */  addiu     $t1, $zero, 0x2
/* 26018 8004AC18 3C08800E */  lui       $t0, %hi(rspbootUcodeBuffer)
/* 2601C 8004AC1C 25089780 */  addiu     $t0, $t0, %lo(rspbootUcodeBuffer)
/* 26020 8004AC20 24070100 */  addiu     $a3, $zero, 0x100
/* 26024 8004AC24 3C068007 */  lui       $a2, %hi(D_800731A0)
/* 26028 8004AC28 24C631A0 */  addiu     $a2, $a2, %lo(D_800731A0)
/* 2602C 8004AC2C 3C058009 */  lui       $a1, %hi(D_80097A80)
/* 26030 8004AC30 24A57A80 */  addiu     $a1, $a1, %lo(D_80097A80)
/* 26034 8004AC34 24040800 */  addiu     $a0, $zero, 0x800
/* 26038 8004AC38 3C03800A */  lui       $v1, %hi(nuAuTasks)
/* 2603C 8004AC3C 24633520 */  addiu     $v1, $v1, %lo(nuAuTasks)
.L8004AC40:
/* 26040 8004AC40 AC600000 */  sw        $zero, 0x0($v1)
/* 26044 8004AC44 AC600054 */  sw        $zero, 0x54($v1)
/* 26048 8004AC48 AC690010 */  sw        $t1, 0x10($v1)
/* 2604C 8004AC4C AC680018 */  sw        $t0, 0x18($v1)
/* 26050 8004AC50 AC67001C */  sw        $a3, 0x1C($v1)
/* 26054 8004AC54 AC660020 */  sw        $a2, 0x20($v1)
/* 26058 8004AC58 AC650028 */  sw        $a1, 0x28($v1)
/* 2605C 8004AC5C AC64002C */  sw        $a0, 0x2C($v1)
/* 26060 8004AC60 AC600030 */  sw        $zero, 0x30($v1)
/* 26064 8004AC64 AC600034 */  sw        $zero, 0x34($v1)
/* 26068 8004AC68 AC600038 */  sw        $zero, 0x38($v1)
/* 2606C 8004AC6C AC60003C */  sw        $zero, 0x3C($v1)
/* 26070 8004AC70 AC600048 */  sw        $zero, 0x48($v1)
/* 26074 8004AC74 AC60004C */  sw        $zero, 0x4C($v1)
/* 26078 8004AC78 26310001 */  addiu     $s1, $s1, 0x1
/* 2607C 8004AC7C 2E220003 */  sltiu     $v0, $s1, 0x3
/* 26080 8004AC80 1440FFEF */  bnez      $v0, .L8004AC40
/* 26084 8004AC84 24630058 */   addiu    $v1, $v1, 0x58
/* 26088 8004AC88 0000882D */  daddu     $s1, $zero, $zero
/* 2608C 8004AC8C 3C10800A */  lui       $s0, %hi(D_800A3628)
/* 26090 8004AC90 26103628 */  addiu     $s0, $s0, %lo(D_800A3628)
.L8004AC94:
/* 26094 8004AC94 24050001 */  addiu     $a1, $zero, 0x1
/* 26098 8004AC98 02258821 */  addu      $s1, $s1, $a1
/* 2609C 8004AC9C 3C06800A */  lui       $a2, %hi(AlFrameSize)
/* 260A0 8004ACA0 8CC63634 */  lw        $a2, %lo(AlFrameSize)($a2)
/* 260A4 8004ACA4 8FA4002C */  lw        $a0, 0x2C($sp)
/* 260A8 8004ACA8 0C015FE4 */  jal       alHeapAlloc
/* 260AC 8004ACAC 00063080 */   sll      $a2, $a2, 2
/* 260B0 8004ACB0 AE020000 */  sw        $v0, 0x0($s0)
/* 260B4 8004ACB4 2E220003 */  sltiu     $v0, $s1, 0x3
/* 260B8 8004ACB8 1440FFF6 */  bnez      $v0, .L8004AC94
/* 260BC 8004ACBC 26100004 */   addiu    $s0, $s0, 0x4
/* 260C0 8004ACC0 0000882D */  daddu     $s1, $zero, $zero
/* 260C4 8004ACC4 3C02800A */  lui       $v0, %hi(nuAuDmaBufList)
/* 260C8 8004ACC8 24423BE0 */  addiu     $v0, $v0, %lo(nuAuDmaBufList)
/* 260CC 8004ACCC 0040802D */  daddu     $s0, $v0, $zero
/* 260D0 8004ACD0 26120014 */  addiu     $s2, $s0, 0x14
/* 260D4 8004ACD4 AE000004 */  sw        $zero, 0x4($s0)
/* 260D8 8004ACD8 AE000000 */  sw        $zero, 0x0($s0)
.L8004ACDC:
/* 260DC 8004ACDC 0240202D */  daddu     $a0, $s2, $zero
/* 260E0 8004ACE0 0C012CFB */  jal       alLink
/* 260E4 8004ACE4 0200282D */   daddu    $a1, $s0, $zero
/* 260E8 8004ACE8 24050001 */  addiu     $a1, $zero, 0x1
/* 260EC 8004ACEC 24060500 */  addiu     $a2, $zero, 0x500
/* 260F0 8004ACF0 26520014 */  addiu     $s2, $s2, 0x14
/* 260F4 8004ACF4 8FA4002C */  lw        $a0, 0x2C($sp)
/* 260F8 8004ACF8 0C015FE4 */  jal       alHeapAlloc
/* 260FC 8004ACFC 02258821 */   addu     $s1, $s1, $a1
/* 26100 8004AD00 AE020010 */  sw        $v0, 0x10($s0)
/* 26104 8004AD04 2E220031 */  sltiu     $v0, $s1, 0x31
/* 26108 8004AD08 1440FFF4 */  bnez      $v0, .L8004ACDC
/* 2610C 8004AD0C 26100014 */   addiu    $s0, $s0, 0x14
/* 26110 8004AD10 24050001 */  addiu     $a1, $zero, 0x1
/* 26114 8004AD14 8FA4002C */  lw        $a0, 0x2C($sp)
/* 26118 8004AD18 0C015FE4 */  jal       alHeapAlloc
/* 2611C 8004AD1C 24060500 */   addiu    $a2, $zero, 0x500
/* 26120 8004AD20 3C04800A */  lui       $a0, %hi(nuAuDmaMesgQ)
/* 26124 8004AD24 24843640 */  addiu     $a0, $a0, %lo(nuAuDmaMesgQ)
/* 26128 8004AD28 3C05800A */  lui       $a1, %hi(nuAuDmaMesgBuf)
/* 2612C 8004AD2C 24A53658 */  addiu     $a1, $a1, %lo(nuAuDmaMesgBuf)
/* 26130 8004AD30 00111880 */  sll       $v1, $s1, 2
/* 26134 8004AD34 00711821 */  addu      $v1, $v1, $s1
/* 26138 8004AD38 00031880 */  sll       $v1, $v1, 2
/* 2613C 8004AD3C 3C01800A */  lui       $at, %hi(D_800A3BF0)
/* 26140 8004AD40 00230821 */  addu      $at, $at, $v1
/* 26144 8004AD44 AC223BF0 */  sw        $v0, %lo(D_800A3BF0)($at)
/* 26148 8004AD48 0C019560 */  jal       osCreateMesgQueue
/* 2614C 8004AD4C 24060032 */   addiu    $a2, $zero, 0x32
/* 26150 8004AD50 3C04800C */  lui       $a0, %hi(auSynDriver)
/* 26154 8004AD54 248491A0 */  addiu     $a0, $a0, %lo(auSynDriver)
/* 26158 8004AD58 3C028005 */  lui       $v0, %hi(nuAuPreNMIProc)
/* 2615C 8004AD5C 2442B328 */  addiu     $v0, $v0, %lo(nuAuPreNMIProc)
/* 26160 8004AD60 3C018008 */  lui       $at, %hi(nuAuPreNMIFunc)
/* 26164 8004AD64 AC228174 */  sw        $v0, %lo(nuAuPreNMIFunc)($at)
/* 26168 8004AD68 0C015894 */  jal       au_driver_init
/* 2616C 8004AD6C 27A50018 */   addiu    $a1, $sp, 0x18
/* 26170 8004AD70 8FA40020 */  lw        $a0, 0x20($sp)
/* 26174 8004AD74 0C014B97 */  jal       au_engine_init
/* 26178 8004AD78 00000000 */   nop
/* 2617C 8004AD7C 3C10800A */  lui       $s0, %hi(nuAuMgrThread)
/* 26180 8004AD80 26100F58 */  addiu     $s0, $s0, %lo(nuAuMgrThread)
/* 26184 8004AD84 0200202D */  daddu     $a0, $s0, $zero
/* 26188 8004AD88 24050003 */  addiu     $a1, $zero, 0x3
/* 2618C 8004AD8C 3C068005 */  lui       $a2, %hi(nuAuMgr)
/* 26190 8004AD90 24C6AE08 */  addiu     $a2, $a2, %lo(nuAuMgr)
/* 26194 8004AD94 3C02800A */  lui       $v0, %hi(AlCmdListBuffers)
/* 26198 8004AD98 24423510 */  addiu     $v0, $v0, %lo(AlCmdListBuffers)
/* 2619C 8004AD9C AFA20010 */  sw        $v0, 0x10($sp)
/* 261A0 8004ADA0 24020046 */  addiu     $v0, $zero, 0x46
/* 261A4 8004ADA4 0000382D */  daddu     $a3, $zero, $zero
/* 261A8 8004ADA8 0C019798 */  jal       osCreateThread
/* 261AC 8004ADAC AFA20014 */   sw       $v0, 0x14($sp)
/* 261B0 8004ADB0 0C019808 */  jal       osStartThread
/* 261B4 8004ADB4 0200202D */   daddu    $a0, $s0, $zero
/* 261B8 8004ADB8 8FBF003C */  lw        $ra, 0x3C($sp)
/* 261BC 8004ADBC 8FB20038 */  lw        $s2, 0x38($sp)
/* 261C0 8004ADC0 8FB10034 */  lw        $s1, 0x34($sp)
/* 261C4 8004ADC4 8FB00030 */  lw        $s0, 0x30($sp)
/* 261C8 8004ADC8 03E00008 */  jr        $ra
/* 261CC 8004ADCC 27BD0040 */   addiu    $sp, $sp, 0x40

### DECOMPILED C INSTRUCTIONS:

void create_audio_system(void) {
    u32 i;
    u32 outputRate, frameSize;
    ALConfig config;

    nuAuTaskStop = NU_AU_TASK_RUN;
    nuAuPreNMI = 0;
    alHeapInit(&nuAuHeap, AuHeapBase, AUDIO_HEAP_SIZE);
    config.num_pvoice = 24;
    config.num_bus = 4;
    outputRate = osAiSetFrequency(32000);
    frameSize = (nusched.retraceCount * outputRate + 59) / 60;
    config.outputRate = outputRate;
    config.unk_0C = 0;
    config.heap = &nuAuHeap;
    config.dmaNew = nuAuDmaNew;
    AlFrameSize = ((frameSize / AUDIO_SAMPLES) + 1) * AUDIO_SAMPLES;
    AlMinFrameSize = AlFrameSize - AUDIO_SAMPLES;

    for (i = 0; i < ARRAY_COUNT(AlCmdListBuffers); i++) {
        AlCmdListBuffers[i] = alHeapAlloc(config.heap, 1, AUDIO_COMMAND_LIST_BUFFER_SIZE);
    }

    for (i = 0; i < ARRAY_COUNT(nuAuTasks); i++) {
        nuAuTasks[i].next = NULL;
        nuAuTasks[i].msg = 0;
        nuAuTasks[i].list.t.type = M_AUDTASK;
#if VERSION_IQUE
        nuAuTasks[i].list.t.ucode_boot = (u64*) rspbootTextStart;
        nuAuTasks[i].list.t.ucode_boot_size = (u32) rspbootTextEnd - (u32) rspbootTextStart;
#else
        nuAuTasks[i].list.t.ucode_boot = rspbootUcodeBuffer;
        nuAuTasks[i].list.t.ucode_boot_size = 0x100;
#endif
        nuAuTasks[i].list.t.ucode = n_aspMain_text_bin;
        nuAuTasks[i].list.t.ucode_data = n_aspMain_data_bin;
        nuAuTasks[i].list.t.ucode_data_size = SP_UCODE_DATA_SIZE;
        nuAuTasks[i].list.t.dram_stack = NULL;
        nuAuTasks[i].list.t.dram_stack_size = 0;
        nuAuTasks[i].list.t.output_buff = NULL;
        nuAuTasks[i].list.t.output_buff_size = 0;
        nuAuTasks[i].list.t.yield_data_ptr = NULL;
        nuAuTasks[i].list.t.yield_data_size = 0;
    }

    for (i = 0; i < ARRAY_COUNT(D_800A3628); i++) {
        D_800A3628[i] = alHeapAlloc(config.heap, 1, AlFrameSize * 4);
    }

    nuAuDmaBufList[0].node.next = nuAuDmaBufList[0].node.prev = NULL;
    for (i = 0; i < ARRAY_COUNT(nuAuDmaBufList) - 1; i++) {
        alLink(&nuAuDmaBufList[i+1].node, &nuAuDmaBufList[i].node);
        nuAuDmaBufList[i].ptr = alHeapAlloc(config.heap, 1, 0x500);
    }
    nuAuDmaBufList[i].ptr = alHeapAlloc(config.heap, 1, 0x500);

    osCreateMesgQueue(&nuAuDmaMesgQ, nuAuDmaMesgBuf, 50);
    nuAuPreNMIFunc = nuAuPreNMIProc;
    au_driver_init(&auSynDriver, &config);
    au_engine_init(config.outputRate);
    osCreateThread(&nuAuMgrThread, NU_MAIN_THREAD_ID, nuAuMgr, NULL, &AuStack[NU_AU_STACK_SIZE / sizeof(u64)], NU_AU_MGR_THREAD_PRI); //why main thread?
    osStartThread(&nuAuMgrThread);
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel au_sfx_update_main
/* 26B48 8004B748 27BDFFC0 */  addiu     $sp, $sp, -0x40
/* 26B4C 8004B74C AFB40030 */  sw        $s4, 0x30($sp)
/* 26B50 8004B750 0080A02D */  daddu     $s4, $a0, $zero
/* 26B54 8004B754 AFBF0038 */  sw        $ra, 0x38($sp)
/* 26B58 8004B758 AFB50034 */  sw        $s5, 0x34($sp)
/* 26B5C 8004B75C AFB3002C */  sw        $s3, 0x2C($sp)
/* 26B60 8004B760 AFB20028 */  sw        $s2, 0x28($sp)
/* 26B64 8004B764 AFB10024 */  sw        $s1, 0x24($sp)
/* 26B68 8004B768 AFB00020 */  sw        $s0, 0x20($sp)
/* 26B6C 8004B76C 8E820030 */  lw        $v0, 0x30($s4)
/* 26B70 8004B770 8E830168 */  lw        $v1, 0x168($s4)
/* 26B74 8004B774 24420001 */  addiu     $v0, $v0, 0x1
/* 26B78 8004B778 10600004 */  beqz      $v1, .L8004B78C
/* 26B7C 8004B77C AE820030 */   sw       $v0, 0x30($s4)
/* 26B80 8004B780 0C01352F */  jal       au_sfx_reset_players
/* 26B84 8004B784 00000000 */   nop
/* 26B88 8004B788 AE800168 */  sw        $zero, 0x168($s4)
.L8004B78C:
/* 26B8C 8004B78C 0280802D */  daddu     $s0, $s4, $zero
.L8004B790:
/* 26B90 8004B790 92030090 */  lbu       $v1, 0x90($s0)
/* 26B94 8004B794 10600035 */  beqz      $v1, .L8004B86C
/* 26B98 8004B798 2C620002 */   sltiu    $v0, $v1, 0x2
/* 26B9C 8004B79C 10400033 */  beqz      $v0, .L8004B86C
/* 26BA0 8004B7A0 00031040 */   sll      $v0, $v1, 1
/* 26BA4 8004B7A4 00431021 */  addu      $v0, $v0, $v1
/* 26BA8 8004B7A8 00021040 */  sll       $v0, $v0, 1
/* 26BAC 8004B7AC 3C038008 */  lui       $v1, %hi(D_8007836A)
/* 26BB0 8004B7B0 2463836A */  addiu     $v1, $v1, %lo(D_8007836A)
/* 26BB4 8004B7B4 00433021 */  addu      $a2, $v0, $v1
/* 26BB8 8004B7B8 94C20002 */  lhu       $v0, 0x2($a2)
/* 26BBC 8004B7BC 10400020 */  beqz      $v0, .L8004B840
/* 26BC0 8004B7C0 0000882D */   daddu    $s1, $zero, $zero
/* 26BC4 8004B7C4 0040282D */  daddu     $a1, $v0, $zero
/* 26BC8 8004B7C8 0200202D */  daddu     $a0, $s0, $zero
/* 26BCC 8004B7CC 0280182D */  daddu     $v1, $s4, $zero
.L8004B7D0:
/* 26BD0 8004B7D0 94620202 */  lhu       $v0, 0x202($v1)
/* 26BD4 8004B7D4 54450015 */  bnel      $v0, $a1, .L8004B82C
/* 26BD8 8004B7D8 26310001 */   addiu    $s1, $s1, 0x1
/* 26BDC 8004B7DC 94C20000 */  lhu       $v0, 0x0($a2)
/* 26BE0 8004B7E0 A7A00012 */  sh        $zero, 0x12($sp)
/* 26BE4 8004B7E4 A7A00016 */  sh        $zero, 0x16($sp)
/* 26BE8 8004B7E8 A7A20010 */  sh        $v0, 0x10($sp)
/* 26BEC 8004B7EC 90C20004 */  lbu       $v0, 0x4($a2)
/* 26BF0 8004B7F0 30420001 */  andi      $v0, $v0, 0x1
/* 26BF4 8004B7F4 50400008 */  beql      $v0, $zero, .L8004B818
/* 26BF8 8004B7F8 A7A00014 */   sh       $zero, 0x14($sp)
/* 26BFC 8004B7FC 90820093 */  lbu       $v0, 0x93($a0)
/* 26C00 8004B800 50400005 */  beql      $v0, $zero, .L8004B818
/* 26C04 8004B804 A7A00014 */   sh       $zero, 0x14($sp)
/* 26C08 8004B808 90820093 */  lbu       $v0, 0x93($a0)
/* 26C0C 8004B80C 00021200 */  sll       $v0, $v0, 8
/* 26C10 8004B810 244200FF */  addiu     $v0, $v0, 0xFF
/* 26C14 8004B814 A7A20014 */  sh        $v0, 0x14($sp)
.L8004B818:
/* 26C18 8004B818 A3A00018 */  sb        $zero, 0x18($sp)
/* 26C1C 8004B81C 0280202D */  daddu     $a0, $s4, $zero
/* 26C20 8004B820 27A50010 */  addiu     $a1, $sp, 0x10
/* 26C24 8004B824 08012E19 */  j         .L8004B864
/* 26C28 8004B828 0000302D */   daddu    $a2, $zero, $zero
.L8004B82C:
/* 26C2C 8004B82C 2E220008 */  sltiu     $v0, $s1, 0x8
/* 26C30 8004B830 1440FFE7 */  bnez      $v0, .L8004B7D0
/* 26C34 8004B834 246300AC */   addiu    $v1, $v1, 0xAC
/* 26C38 8004B838 08012E1C */  j         .L8004B870
/* 26C3C 8004B83C AE000090 */   sw       $zero, 0x90($s0)
.L8004B840:
/* 26C40 8004B840 0280202D */  daddu     $a0, $s4, $zero
/* 26C44 8004B844 27A50010 */  addiu     $a1, $sp, 0x10
/* 26C48 8004B848 94C20000 */  lhu       $v0, 0x0($a2)
/* 26C4C 8004B84C 0000302D */  daddu     $a2, $zero, $zero
/* 26C50 8004B850 A7A00012 */  sh        $zero, 0x12($sp)
/* 26C54 8004B854 A7A00014 */  sh        $zero, 0x14($sp)
/* 26C58 8004B858 A7A00016 */  sh        $zero, 0x16($sp)
/* 26C5C 8004B85C A3A00018 */  sb        $zero, 0x18($sp)
/* 26C60 8004B860 A7A20010 */  sh        $v0, 0x10($sp)
.L8004B864:
/* 26C64 8004B864 0C012E9D */  jal       au_sfx_load_sound
/* 26C68 8004B868 00000000 */   nop
.L8004B86C:
/* 26C6C 8004B86C AE000090 */  sw        $zero, 0x90($s0)
.L8004B870:
/* 26C70 8004B870 26100004 */  addiu     $s0, $s0, 0x4
/* 26C74 8004B874 26820010 */  addiu     $v0, $s4, 0x10
/* 26C78 8004B878 0202102B */  sltu      $v0, $s0, $v0
/* 26C7C 8004B87C 1440FFC4 */  bnez      $v0, .L8004B790
/* 26C80 8004B880 0000902D */   daddu    $s2, $zero, $zero
/* 26C84 8004B884 24130001 */  addiu     $s3, $zero, 0x1
/* 26C88 8004B888 241100A0 */  addiu     $s1, $zero, 0xA0
/* 26C8C 8004B88C 0280802D */  daddu     $s0, $s4, $zero
.L8004B890:
/* 26C90 8004B890 960200A0 */  lhu       $v0, 0xA0($s0)
/* 26C94 8004B894 10400009 */  beqz      $v0, .L8004B8BC
/* 26C98 8004B898 0280202D */   daddu    $a0, $s4, $zero
/* 26C9C 8004B89C 27A50010 */  addiu     $a1, $sp, 0x10
/* 26CA0 8004B8A0 02913021 */  addu      $a2, $s4, $s1
/* 26CA4 8004B8A4 A7B30010 */  sh        $s3, 0x10($sp)
/* 26CA8 8004B8A8 A7A00012 */  sh        $zero, 0x12($sp)
/* 26CAC 8004B8AC A7A00014 */  sh        $zero, 0x14($sp)
/* 26CB0 8004B8B0 A7A00016 */  sh        $zero, 0x16($sp)
/* 26CB4 8004B8B4 0C012E9D */  jal       au_sfx_load_sound
/* 26CB8 8004B8B8 A3A00018 */   sb       $zero, 0x18($sp)
.L8004B8BC:
/* 26CBC 8004B8BC A60000A0 */  sh        $zero, 0xA0($s0)
/* 26CC0 8004B8C0 26310006 */  addiu     $s1, $s1, 0x6
/* 26CC4 8004B8C4 26520001 */  addiu     $s2, $s2, 0x1
/* 26CC8 8004B8C8 2E420004 */  sltiu     $v0, $s2, 0x4
/* 26CCC 8004B8CC 1440FFF0 */  bnez      $v0, .L8004B890
/* 26CD0 8004B8D0 26100006 */   addiu    $s0, $s0, 0x6
/* 26CD4 8004B8D4 92820164 */  lbu       $v0, 0x164($s4)
/* 26CD8 8004B8D8 92830163 */  lbu       $v1, 0x163($s4)
/* 26CDC 8004B8DC 0043A823 */  subu      $s5, $v0, $v1
/* 26CE0 8004B8E0 06A20001 */  bltzl     $s5, .L8004B8E8
/* 26CE4 8004B8E4 26B50010 */   addiu    $s5, $s5, 0x10
.L8004B8E8:
/* 26CE8 8004B8E8 26A2FFFF */  addiu     $v0, $s5, -0x1
/* 26CEC 8004B8EC 2C42000F */  sltiu     $v0, $v0, 0xF
/* 26CF0 8004B8F0 10400033 */  beqz      $v0, .L8004B9C0
/* 26CF4 8004B8F4 0060882D */   daddu    $s1, $v1, $zero
/* 26CF8 8004B8F8 12A0002F */  beqz      $s5, .L8004B9B8
/* 26CFC 8004B8FC 0000902D */   daddu    $s2, $zero, $zero
/* 26D00 8004B900 00111080 */  sll       $v0, $s1, 2
/* 26D04 8004B904 00511021 */  addu      $v0, $v0, $s1
/* 26D08 8004B908 00021040 */  sll       $v0, $v0, 1
/* 26D0C 8004B90C 245300C2 */  addiu     $s3, $v0, 0xC2
/* 26D10 8004B910 02938021 */  addu      $s0, $s4, $s3
.L8004B914:
/* 26D14 8004B914 96030000 */  lhu       $v1, 0x0($s0)
/* 26D18 8004B918 306223FF */  andi      $v0, $v1, 0x23FF
/* 26D1C 8004B91C 1040001B */  beqz      $v0, .L8004B98C
/* 26D20 8004B920 30628000 */   andi     $v0, $v1, 0x8000
/* 26D24 8004B924 10400005 */  beqz      $v0, .L8004B93C
/* 26D28 8004B928 3065FFFF */   andi     $a1, $v1, 0xFFFF
/* 26D2C 8004B92C 0C0130A9 */  jal       au_sfx_stop_by_id
/* 26D30 8004B930 0280202D */   daddu    $a0, $s4, $zero
/* 26D34 8004B934 08012E64 */  j         .L8004B990
/* 26D38 8004B938 A6000000 */   sh       $zero, 0x0($s0)
.L8004B93C:
/* 26D3C 8004B93C 30621C00 */  andi      $v0, $v1, 0x1C00
/* 26D40 8004B940 14400007 */  bnez      $v0, .L8004B960
/* 26D44 8004B944 30620C00 */   andi     $v0, $v1, 0xC00
/* 26D48 8004B948 0280202D */  daddu     $a0, $s4, $zero
/* 26D4C 8004B94C 0200282D */  daddu     $a1, $s0, $zero
/* 26D50 8004B950 0C012E9D */  jal       au_sfx_load_sound
/* 26D54 8004B954 0000302D */   daddu    $a2, $zero, $zero
/* 26D58 8004B958 08012E64 */  j         .L8004B990
/* 26D5C 8004B95C A6000000 */   sh       $zero, 0x0($s0)
.L8004B960:
/* 26D60 8004B960 10400004 */  beqz      $v0, .L8004B974
/* 26D64 8004B964 00000000 */   nop
/* 26D68 8004B968 96050000 */  lhu       $a1, 0x0($s0)
/* 26D6C 8004B96C 0C01309A */  jal       au_sfx_set_triggers
/* 26D70 8004B970 0280202D */   daddu    $a0, $s4, $zero
.L8004B974:
/* 26D74 8004B974 96020000 */  lhu       $v0, 0x0($s0)
/* 26D78 8004B978 30421000 */  andi      $v0, $v0, 0x1000
/* 26D7C 8004B97C 10400003 */  beqz      $v0, .L8004B98C
/* 26D80 8004B980 0280202D */   daddu    $a0, $s4, $zero
/* 26D84 8004B984 0C0130D6 */  jal       au_sfx_set_modifiers
/* 26D88 8004B988 0200282D */   daddu    $a1, $s0, $zero
.L8004B98C:
/* 26D8C 8004B98C A6000000 */  sh        $zero, 0x0($s0)
.L8004B990:
/* 26D90 8004B990 26310001 */  addiu     $s1, $s1, 0x1
/* 26D94 8004B994 2E220010 */  sltiu     $v0, $s1, 0x10
/* 26D98 8004B998 14400003 */  bnez      $v0, .L8004B9A8
/* 26D9C 8004B99C 2673000A */   addiu    $s3, $s3, 0xA
/* 26DA0 8004B9A0 241300C2 */  addiu     $s3, $zero, 0xC2
/* 26DA4 8004B9A4 0000882D */  daddu     $s1, $zero, $zero
.L8004B9A8:
/* 26DA8 8004B9A8 26520001 */  addiu     $s2, $s2, 0x1
/* 26DAC 8004B9AC 0255102B */  sltu      $v0, $s2, $s5
/* 26DB0 8004B9B0 1440FFD8 */  bnez      $v0, .L8004B914
/* 26DB4 8004B9B4 02938021 */   addu     $s0, $s4, $s3
.L8004B9B8:
/* 26DB8 8004B9B8 92820164 */  lbu       $v0, 0x164($s4)
/* 26DBC 8004B9BC A2820163 */  sb        $v0, 0x163($s4)
.L8004B9C0:
/* 26DC0 8004B9C0 8FBF0038 */  lw        $ra, 0x38($sp)
/* 26DC4 8004B9C4 8FB50034 */  lw        $s5, 0x34($sp)
/* 26DC8 8004B9C8 8FB40030 */  lw        $s4, 0x30($sp)
/* 26DCC 8004B9CC 8FB3002C */  lw        $s3, 0x2C($sp)
/* 26DD0 8004B9D0 8FB20028 */  lw        $s2, 0x28($sp)
/* 26DD4 8004B9D4 8FB10024 */  lw        $s1, 0x24($sp)
/* 26DD8 8004B9D8 8FB00020 */  lw        $s0, 0x20($sp)
/* 26DDC 8004B9DC 03E00008 */  jr        $ra
/* 26DE0 8004B9E0 27BD0040 */   addiu    $sp, $sp, 0x40

### DECOMPILED C INSTRUCTIONS:

void au_sfx_update_main(SoundManager* manager) {
    SoundSFXEntry newEntry;
    SoundSFXEntry* sfxEntry;
    u32 i, j, k;
    s32 count;

    manager->playCounter++;
    if (manager->resetPending) {
        au_sfx_reset_players(manager);
        manager->resetPending = FALSE;
    }

    // sounds started by special seq command FF-05
    for (i = 0; i < ARRAY_COUNT(manager->bgmSounds); i++) {
        k = manager->bgmSounds[i].unk_0;
        if (k == 0) {
            // do nothing
        } else if (k < 2) {
            AlUnkGemini* unkData = &D_80078370[k-1];
            u16 sound2 = unkData->sound2;
            if (sound2 != 0) {
                for (j = 0; j < ARRAY_COUNT(manager->players); j++) {
                    if (manager->players[j].currentSoundID == sound2) {
                        newEntry.soundID = unkData->sound1;
                        newEntry.upperSoundID = 0;
                        newEntry.pitchShift = 0;
                        if ((unkData->flags & 1) && (manager->bgmSounds[i].volume != 0)) {
                            newEntry.volume = (manager->bgmSounds[i].volume << 8) + 0xFF;
                        } else {
                            newEntry.volume = 0;
                        }
                        newEntry.pan = 0;
                        au_sfx_load_sound(manager, &newEntry, NULL);
                        break;
                    }
                }
            } else {
                newEntry.soundID = unkData->sound1;
                newEntry.upperSoundID = 0;
                newEntry.volume = 0;
                newEntry.pitchShift = 0;
                newEntry.pan = 0;
                au_sfx_load_sound(manager, &newEntry, NULL);
            }
        }
        manager->bgmSounds[i].s32 = 0;
    }

    // sounds started from sef command 17
    for (i = 0; i < ARRAY_COUNT(manager->customCmdList); i++) {
        if (manager->customCmdList[i].data[0] != 0) {
            newEntry.soundID = 1;
            newEntry.upperSoundID = 0;
            newEntry.volume = 0;
            newEntry.pitchShift = 0;
            newEntry.pan = 0;
            au_sfx_load_sound(manager, &newEntry, &manager->customCmdList[i]);
        }
        manager->customCmdList[i].data[0] = 0;
    }

    count = manager->sfxQueueNextPos - manager->sfxQueuePosOffset;
    if (count < 0) {
        count += ARRAY_COUNT(manager->soundQueue);
    }
    j = manager->sfxQueuePosOffset;
    if (count > 0 && count < ARRAY_COUNT(manager->soundQueue)) {
        for (i = 0; i < count; i++) {
            sfxEntry = &manager->soundQueue[j];
            if (sfxEntry->soundID & SOUND_ID_LOWER) {
                if (sfxEntry->soundID & SOUND_ID_STOP) {
                    au_sfx_stop_by_id(manager, sfxEntry->soundID);
                } else if (!(sfxEntry->soundID & (SOUND_ID_ADJUST | SOUND_ID_TRIGGER_MASK))) {
                    au_sfx_load_sound(manager, sfxEntry, NULL);
                } else {
                    if (sfxEntry->soundID & SOUND_ID_TRIGGER_MASK) {
                        au_sfx_set_triggers(manager, sfxEntry->soundID);
                    }
                    if (sfxEntry->soundID & SOUND_ID_ADJUST) {
                        au_sfx_set_modifiers(manager, sfxEntry);
                    }
                }
            }
            sfxEntry->soundID = 0;

            j++;
            if (j >= ARRAY_COUNT(manager->soundQueue)) {
                j = 0;
            }
        }
        manager->sfxQueuePosOffset = manager->sfxQueueNextPos;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel entity_WoodenCrate_setupGfx
/* 109DCC 802E854C 27BDFE80 */  addiu     $sp, $sp, -0x180
/* 109DD0 802E8550 AFBE0148 */  sw        $fp, 0x148($sp)
/* 109DD4 802E8554 0000F02D */  daddu     $fp, $zero, $zero
/* 109DD8 802E8558 27A80098 */  addiu     $t0, $sp, 0x98
/* 109DDC 802E855C AFB5013C */  sw        $s5, 0x13C($sp)
/* 109DE0 802E8560 27B500D8 */  addiu     $s5, $sp, 0xD8
/* 109DE4 802E8564 AFB40138 */  sw        $s4, 0x138($sp)
/* 109DE8 802E8568 27B40058 */  addiu     $s4, $sp, 0x58
/* 109DEC 802E856C AFA8011C */  sw        $t0, 0x11C($sp)
/* 109DF0 802E8570 3C080001 */  lui       $t0, (0x11630 >> 16)
/* 109DF4 802E8574 AFB1012C */  sw        $s1, 0x12C($sp)
/* 109DF8 802E8578 3C11800A */  lui       $s1, %hi(gMainGfxPos)
/* 109DFC 802E857C 8E31A66C */  lw        $s1, %lo(gMainGfxPos)($s1)
/* 109E00 802E8580 35081630 */  ori       $t0, $t0, (0x11630 & 0xFFFF)
/* 109E04 802E8584 AFBF014C */  sw        $ra, 0x14C($sp)
/* 109E08 802E8588 AFB70144 */  sw        $s7, 0x144($sp)
/* 109E0C 802E858C AFB60140 */  sw        $s6, 0x140($sp)
/* 109E10 802E8590 AFB30134 */  sw        $s3, 0x134($sp)
/* 109E14 802E8594 AFB20130 */  sw        $s2, 0x130($sp)
/* 109E18 802E8598 AFB00128 */  sw        $s0, 0x128($sp)
/* 109E1C 802E859C F7BE0178 */  sdc1      $f30, 0x178($sp)
/* 109E20 802E85A0 F7BC0170 */  sdc1      $f28, 0x170($sp)
/* 109E24 802E85A4 F7BA0168 */  sdc1      $f26, 0x168($sp)
/* 109E28 802E85A8 F7B80160 */  sdc1      $f24, 0x160($sp)
/* 109E2C 802E85AC F7B60158 */  sdc1      $f22, 0x158($sp)
/* 109E30 802E85B0 F7B40150 */  sdc1      $f20, 0x150($sp)
/* 109E34 802E85B4 0C04417A */  jal       get_entity_by_index
/* 109E38 802E85B8 AFA80120 */   sw       $t0, 0x120($sp)
/* 109E3C 802E85BC 0040B82D */  daddu     $s7, $v0, $zero
/* 109E40 802E85C0 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
/* 109E44 802E85C4 4481D000 */  mtc1      $at, $f26
/* 109E48 802E85C8 3C013B80 */  lui       $at, (0x3B800000 >> 16)
/* 109E4C 802E85CC 4481C000 */  mtc1      $at, $f24
/* 109E50 802E85D0 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 109E54 802E85D4 4481B000 */  mtc1      $at, $f22
/* 109E58 802E85D8 8EE20040 */  lw        $v0, 0x40($s7)
/* 109E5C 802E85DC 4480A000 */  mtc1      $zero, $f20
/* 109E60 802E85E0 C6E00048 */  lwc1      $f0, 0x48($s7)
/* 109E64 802E85E4 0040902D */  daddu     $s2, $v0, $zero
/* 109E68 802E85E8 0240982D */  daddu     $s3, $s2, $zero
/* 109E6C 802E85EC 2630FFFC */  addiu     $s0, $s1, -0x4
/* 109E70 802E85F0 46000007 */  neg.s     $f0, $f0
/* 109E74 802E85F4 E7A00118 */  swc1      $f0, 0x118($sp)
/* 109E78 802E85F8 C6E0004C */  lwc1      $f0, 0x4C($s7)
/* 109E7C 802E85FC C6E20050 */  lwc1      $f2, 0x50($s7)
/* 109E80 802E8600 8E560008 */  lw        $s6, 0x8($s2)
/* 109E84 802E8604 46000787 */  neg.s     $f30, $f0
/* 109E88 802E8608 46001707 */  neg.s     $f28, $f2
.L802E860C:
/* 109E8C 802E860C 82420010 */  lb        $v0, 0x10($s2)
/* 109E90 802E8610 28420002 */  slti      $v0, $v0, 0x2
/* 109E94 802E8614 1040000F */  beqz      $v0, .L802E8654
/* 109E98 802E8618 3C03E200 */   lui      $v1, (0xE200001C >> 16)
/* 109E9C 802E861C 26100008 */  addiu     $s0, $s0, 0x8
/* 109EA0 802E8620 3463001C */  ori       $v1, $v1, (0xE200001C & 0xFFFF)
/* 109EA4 802E8624 3C020055 */  lui       $v0, (0x552078 >> 16)
/* 109EA8 802E8628 34422078 */  ori       $v0, $v0, (0x552078 & 0xFFFF)
/* 109EAC 802E862C AE03FFFC */  sw        $v1, -0x4($s0)
/* 109EB0 802E8630 AE020000 */  sw        $v0, 0x0($s0)
/* 109EB4 802E8634 26100008 */  addiu     $s0, $s0, 0x8
/* 109EB8 802E8638 26310010 */  addiu     $s1, $s1, 0x10
/* 109EBC 802E863C 3C03FC12 */  lui       $v1, (0xFC121824 >> 16)
/* 109EC0 802E8640 34631824 */  ori       $v1, $v1, (0xFC121824 & 0xFFFF)
/* 109EC4 802E8644 3C02FF33 */  lui       $v0, (0xFF33FFFF >> 16)
/* 109EC8 802E8648 3442FFFF */  ori       $v0, $v0, (0xFF33FFFF & 0xFFFF)
/* 109ECC 802E864C 080BA1A1 */  j         .L802E8684
/* 109ED0 802E8650 AE03FFFC */   sw       $v1, -0x4($s0)
.L802E8654:
/* 109ED4 802E8654 26100008 */  addiu     $s0, $s0, 0x8
/* 109ED8 802E8658 3C03FCFF */  lui       $v1, (0xFCFFC3FF >> 16)
/* 109EDC 802E865C 3463C3FF */  ori       $v1, $v1, (0xFCFFC3FF & 0xFFFF)
/* 109EE0 802E8660 3C02FF30 */  lui       $v0, (0xFF30FE7F >> 16)
/* 109EE4 802E8664 3442FE7F */  ori       $v0, $v0, (0xFF30FE7F & 0xFFFF)
/* 109EE8 802E8668 AE03FFFC */  sw        $v1, -0x4($s0)
/* 109EEC 802E866C AE020000 */  sw        $v0, 0x0($s0)
/* 109EF0 802E8670 26100008 */  addiu     $s0, $s0, 0x8
/* 109EF4 802E8674 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 109EF8 802E8678 AE02FFFC */  sw        $v0, -0x4($s0)
/* 109EFC 802E867C 92420034 */  lbu       $v0, 0x34($s2)
/* 109F00 802E8680 26310010 */  addiu     $s1, $s1, 0x10
.L802E8684:
/* 109F04 802E8684 AE020000 */  sw        $v0, 0x0($s0)
/* 109F08 802E8688 8FA50118 */  lw        $a1, 0x118($sp)
/* 109F0C 802E868C 4406F000 */  mfc1      $a2, $f30
/* 109F10 802E8690 4407E000 */  mfc1      $a3, $f28
/* 109F14 802E8694 0C019E40 */  jal       guTranslateF
/* 109F18 802E8698 27A40018 */   addiu    $a0, $sp, 0x18
/* 109F1C 802E869C 92420058 */  lbu       $v0, 0x58($s2)
/* 109F20 802E86A0 44820000 */  mtc1      $v0, $f0
/* 109F24 802E86A4 00000000 */  nop
/* 109F28 802E86A8 46800020 */  cvt.s.w   $f0, $f0
/* 109F2C 802E86AC 461A0002 */  mul.s     $f0, $f0, $f26
/* 109F30 802E86B0 00000000 */  nop
/* 109F34 802E86B4 46180002 */  mul.s     $f0, $f0, $f24
/* 109F38 802E86B8 00000000 */  nop
/* 109F3C 802E86BC 4406B000 */  mfc1      $a2, $f22
/* 109F40 802E86C0 4407A000 */  mfc1      $a3, $f20
/* 109F44 802E86C4 8FA4011C */  lw        $a0, 0x11C($sp)
/* 109F48 802E86C8 44050000 */  mfc1      $a1, $f0
/* 109F4C 802E86CC 0C019EC8 */  jal       guRotateF
/* 109F50 802E86D0 E7B40010 */   swc1     $f20, 0x10($sp)
/* 109F54 802E86D4 9242007C */  lbu       $v0, 0x7C($s2)
/* 109F58 802E86D8 44820000 */  mtc1      $v0, $f0
/* 109F5C 802E86DC 00000000 */  nop
/* 109F60 802E86E0 46800020 */  cvt.s.w   $f0, $f0
/* 109F64 802E86E4 461A0002 */  mul.s     $f0, $f0, $f26
/* 109F68 802E86E8 00000000 */  nop
/* 109F6C 802E86EC 26100008 */  addiu     $s0, $s0, 0x8
/* 109F70 802E86F0 26310018 */  addiu     $s1, $s1, 0x18
/* 109F74 802E86F4 46180002 */  mul.s     $f0, $f0, $f24
/* 109F78 802E86F8 00000000 */  nop
/* 109F7C 802E86FC 27DE0001 */  addiu     $fp, $fp, 0x1
/* 109F80 802E8700 02A0202D */  daddu     $a0, $s5, $zero
/* 109F84 802E8704 4406A000 */  mfc1      $a2, $f20
/* 109F88 802E8708 4407B000 */  mfc1      $a3, $f22
/* 109F8C 802E870C 44050000 */  mfc1      $a1, $f0
/* 109F90 802E8710 26520001 */  addiu     $s2, $s2, 0x1
/* 109F94 802E8714 0C019EC8 */  jal       guRotateF
/* 109F98 802E8718 E7B40010 */   swc1     $f20, 0x10($sp)
/* 109F9C 802E871C 02A0282D */  daddu     $a1, $s5, $zero
/* 109FA0 802E8720 8FA4011C */  lw        $a0, 0x11C($sp)
/* 109FA4 802E8724 0C019D80 */  jal       guMtxCatF
/* 109FA8 802E8728 02A0302D */   daddu    $a2, $s5, $zero
/* 109FAC 802E872C 02A0202D */  daddu     $a0, $s5, $zero
/* 109FB0 802E8730 27A50018 */  addiu     $a1, $sp, 0x18
/* 109FB4 802E8734 0C019D80 */  jal       guMtxCatF
/* 109FB8 802E8738 00A0302D */   daddu    $a2, $a1, $zero
/* 109FBC 802E873C 0280202D */  daddu     $a0, $s4, $zero
/* 109FC0 802E8740 8E650154 */  lw        $a1, 0x154($s3)
/* 109FC4 802E8744 8E6601E4 */  lw        $a2, 0x1E4($s3)
/* 109FC8 802E8748 8E670274 */  lw        $a3, 0x274($s3)
/* 109FCC 802E874C 0C019E40 */  jal       guTranslateF
/* 109FD0 802E8750 26730004 */   addiu    $s3, $s3, 0x4
/* 109FD4 802E8754 27A40018 */  addiu     $a0, $sp, 0x18
/* 109FD8 802E8758 0280282D */  daddu     $a1, $s4, $zero
/* 109FDC 802E875C 0C019D80 */  jal       guMtxCatF
/* 109FE0 802E8760 0280302D */   daddu    $a2, $s4, $zero
/* 109FE4 802E8764 0280202D */  daddu     $a0, $s4, $zero
/* 109FE8 802E8768 3C058007 */  lui       $a1, %hi(gMatrixListPos)
/* 109FEC 802E876C 94A541F0 */  lhu       $a1, %lo(gMatrixListPos)($a1)
/* 109FF0 802E8770 3C02800A */  lui       $v0, %hi(gDisplayContext)
/* 109FF4 802E8774 8C42A674 */  lw        $v0, %lo(gDisplayContext)($v0)
/* 109FF8 802E8778 8FA80120 */  lw        $t0, 0x120($sp)
/* 109FFC 802E877C 00052980 */  sll       $a1, $a1, 6
/* 10A000 802E8780 00A82821 */  addu      $a1, $a1, $t0
/* 10A004 802E8784 0C019D40 */  jal       guMtxF2L
/* 10A008 802E8788 00452821 */   addu     $a1, $v0, $a1
/* 10A00C 802E878C 3C05D838 */  lui       $a1, (0xD8380002 >> 16)
/* 10A010 802E8790 34A50002 */  ori       $a1, $a1, (0xD8380002 & 0xFFFF)
/* 10A014 802E8794 3C028007 */  lui       $v0, %hi(gMatrixListPos)
/* 10A018 802E8798 944241F0 */  lhu       $v0, %lo(gMatrixListPos)($v0)
/* 10A01C 802E879C 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 10A020 802E87A0 AE03FFFC */  sw        $v1, -0x4($s0)
/* 10A024 802E87A4 8FA80120 */  lw        $t0, 0x120($sp)
/* 10A028 802E87A8 24430001 */  addiu     $v1, $v0, 0x1
/* 10A02C 802E87AC 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 10A030 802E87B0 00021180 */  sll       $v0, $v0, 6
/* 10A034 802E87B4 3C018007 */  lui       $at, %hi(gMatrixListPos)
/* 10A038 802E87B8 A42341F0 */  sh        $v1, %lo(gMatrixListPos)($at)
/* 10A03C 802E87BC 3C03800A */  lui       $v1, %hi(gDisplayContext)
/* 10A040 802E87C0 8C63A674 */  lw        $v1, %lo(gDisplayContext)($v1)
/* 10A044 802E87C4 00481021 */  addu      $v0, $v0, $t0
/* 10A048 802E87C8 00621821 */  addu      $v1, $v1, $v0
/* 10A04C 802E87CC AE030000 */  sw        $v1, 0x0($s0)
/* 10A050 802E87D0 96C40002 */  lhu       $a0, 0x2($s6)
/* 10A054 802E87D4 26D60004 */  addiu     $s6, $s6, 0x4
/* 10A058 802E87D8 26100008 */  addiu     $s0, $s0, 0x8
/* 10A05C 802E87DC 8EE30044 */  lw        $v1, 0x44($s7)
/* 10A060 802E87E0 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 10A064 802E87E4 AE02FFFC */  sw        $v0, -0x4($s0)
/* 10A068 802E87E8 24020040 */  addiu     $v0, $zero, 0x40
/* 10A06C 802E87EC 00641821 */  addu      $v1, $v1, $a0
/* 10A070 802E87F0 AE030000 */  sw        $v1, 0x0($s0)
/* 10A074 802E87F4 26100008 */  addiu     $s0, $s0, 0x8
/* 10A078 802E87F8 AE020000 */  sw        $v0, 0x0($s0)
/* 10A07C 802E87FC 2BC20023 */  slti      $v0, $fp, 0x23
/* 10A080 802E8800 1440FF82 */  bnez      $v0, .L802E860C
/* 10A084 802E8804 AE05FFFC */   sw       $a1, -0x4($s0)
/* 10A088 802E8808 8FBF014C */  lw        $ra, 0x14C($sp)
/* 10A08C 802E880C 8FBE0148 */  lw        $fp, 0x148($sp)
/* 10A090 802E8810 8FB70144 */  lw        $s7, 0x144($sp)
/* 10A094 802E8814 8FB60140 */  lw        $s6, 0x140($sp)
/* 10A098 802E8818 8FB5013C */  lw        $s5, 0x13C($sp)
/* 10A09C 802E881C 8FB40138 */  lw        $s4, 0x138($sp)
/* 10A0A0 802E8820 8FB30134 */  lw        $s3, 0x134($sp)
/* 10A0A4 802E8824 8FB20130 */  lw        $s2, 0x130($sp)
/* 10A0A8 802E8828 3C01800A */  lui       $at, %hi(gMainGfxPos)
/* 10A0AC 802E882C AC31A66C */  sw        $s1, %lo(gMainGfxPos)($at)
/* 10A0B0 802E8830 8FB1012C */  lw        $s1, 0x12C($sp)
/* 10A0B4 802E8834 8FB00128 */  lw        $s0, 0x128($sp)
/* 10A0B8 802E8838 D7BE0178 */  ldc1      $f30, 0x178($sp)
/* 10A0BC 802E883C D7BC0170 */  ldc1      $f28, 0x170($sp)
/* 10A0C0 802E8840 D7BA0168 */  ldc1      $f26, 0x168($sp)
/* 10A0C4 802E8844 D7B80160 */  ldc1      $f24, 0x160($sp)
/* 10A0C8 802E8848 D7B60158 */  ldc1      $f22, 0x158($sp)
/* 10A0CC 802E884C D7B40150 */  ldc1      $f20, 0x150($sp)
/* 10A0D0 802E8850 03E00008 */  jr        $ra
/* 10A0D4 802E8854 27BD0180 */   addiu    $sp, $sp, 0x180

### DECOMPILED C INSTRUCTIONS:

void entity_WoodenCrate_setupGfx(s32 entityIndex) {
    s32 i;
    Matrix4f mtxTransInv;
    Matrix4f mtx;
    Matrix4f mtxRotX;
    Matrix4f mtxRotY;
    f32 x_inv;
    f32 y_inv;
    f32 z_inv;
    Gfx* gfxPos = gMainGfxPos;
    Entity* entity = get_entity_by_index(entityIndex);
    WoodenCrateData* data = entity->dataBuf.crate;
    Gfx* fragmentDlist;
    Gfx** gfx = data->fragmentsGfx;

    x_inv = -entity->position.x;
    y_inv = -entity->position.y;
    z_inv = -entity->position.z;

    for (i = 0; i < 35; i++) {
        if (data->fragmentRebounds[i] < 2) {
            gDPSetRenderMode(gfxPos++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
            gDPSetCombineMode(gfxPos++, G_CC_MODULATEIA, G_CC_MODULATEIA);
        } else {
            gDPSetCombineMode(gfxPos++, PM_CC_11, PM_CC_12);
            gDPSetPrimColor(gfxPos++, 0, 0, 0, 0, 0, data->fragmentMoveAngle[i]);
        }

        guTranslateF(mtxTransInv, x_inv, y_inv, z_inv);
        guRotateF(mtxRotX, data->fragmentRotX[i] * 360.0f / 256, 1.0f, 0.0f, 0.0f);
        guRotateF(mtxRotY, data->fragmentRotY[i] * 360.0f / 256, 0.0f, 1.0f, 0.0f);
        guMtxCatF(mtxRotX, mtxRotY, mtxRotY);
        guMtxCatF(mtxRotY, mtxTransInv, mtxTransInv);
        guTranslateF(mtx, data->fragmentPosX[i], data->fragmentPosY[i], data->fragmentPosZ[i]);
        guMtxCatF(mtxTransInv, mtx, mtx);
        guMtxF2L(mtx, &gDisplayContext->matrixStack[gMatrixListPos]);

        gSPMatrix(gfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
        fragmentDlist = ENTITY_ADDR(entity, Gfx*, *gfx++);
        gSPDisplayList(gfxPos++, fragmentDlist);
        gSPPopMatrix(gfxPos++, G_MTX_MODELVIEW);
    }

    gMainGfxPos = gfxPos;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel au_bgm_update_main
/* 28910 8004D510 27BDFFD8 */  addiu     $sp, $sp, -0x28
/* 28914 8004D514 AFB10014 */  sw        $s1, 0x14($sp)
/* 28918 8004D518 0080882D */  daddu     $s1, $a0, $zero
/* 2891C 8004D51C AFB3001C */  sw        $s3, 0x1C($sp)
/* 28920 8004D520 0000982D */  daddu     $s3, $zero, $zero
/* 28924 8004D524 2406FFFF */  addiu     $a2, $zero, -0x1
/* 28928 8004D528 AFBF0020 */  sw        $ra, 0x20($sp)
/* 2892C 8004D52C AFB20018 */  sw        $s2, 0x18($sp)
/* 28930 8004D530 AFB00010 */  sw        $s0, 0x10($sp)
/* 28934 8004D534 8E220014 */  lw        $v0, 0x14($s1)
/* 28938 8004D538 92230258 */  lbu       $v1, 0x258($s1)
/* 2893C 8004D53C 24420001 */  addiu     $v0, $v0, 0x1
/* 28940 8004D540 1060008D */  beqz      $v1, .L8004D778
/* 28944 8004D544 AE220014 */   sw       $v0, 0x14($s1)
/* 28948 8004D548 2C620008 */  sltiu     $v0, $v1, 0x8
/* 2894C 8004D54C 10400023 */  beqz      $v0, .L8004D5DC
/* 28950 8004D550 0263102B */   sltu     $v0, $s3, $v1
/* 28954 8004D554 92240259 */  lbu       $a0, 0x259($s1)
/* 28958 8004D558 10400015 */  beqz      $v0, .L8004D5B0
/* 2895C 8004D55C 0260282D */   daddu    $a1, $s3, $zero
/* 28960 8004D560 0060382D */  daddu     $a3, $v1, $zero
/* 28964 8004D564 308200FF */  andi      $v0, $a0, 0xFF
.L8004D568:
/* 28968 8004D568 00021080 */  sll       $v0, $v0, 2
/* 2896C 8004D56C 02221021 */  addu      $v0, $s1, $v0
/* 28970 8004D570 8C430238 */  lw        $v1, 0x238($v0)
/* 28974 8004D574 10600009 */  beqz      $v1, .L8004D59C
/* 28978 8004D578 2C620010 */   sltiu    $v0, $v1, 0x10
/* 2897C 8004D57C 10400003 */  beqz      $v0, .L8004D58C
/* 28980 8004D580 24840001 */   addiu    $a0, $a0, 0x1
/* 28984 8004D584 30660003 */  andi      $a2, $v1, 0x3
/* 28988 8004D588 00039882 */  srl       $s3, $v1, 2
.L8004D58C:
/* 2898C 8004D58C 308200FF */  andi      $v0, $a0, 0xFF
/* 28990 8004D590 2C420008 */  sltiu     $v0, $v0, 0x8
/* 28994 8004D594 50400001 */  beql      $v0, $zero, .L8004D59C
/* 28998 8004D598 0000202D */   daddu    $a0, $zero, $zero
.L8004D59C:
/* 2899C 8004D59C 24A50001 */  addiu     $a1, $a1, 0x1
/* 289A0 8004D5A0 30A200FF */  andi      $v0, $a1, 0xFF
/* 289A4 8004D5A4 0047102B */  sltu      $v0, $v0, $a3
/* 289A8 8004D5A8 1440FFEF */  bnez      $v0, .L8004D568
/* 289AC 8004D5AC 308200FF */   andi     $v0, $a0, 0xFF
.L8004D5B0:
/* 289B0 8004D5B0 9223025A */  lbu       $v1, 0x25A($s1)
/* 289B4 8004D5B4 92220259 */  lbu       $v0, 0x259($s1)
/* 289B8 8004D5B8 00622023 */  subu      $a0, $v1, $v0
/* 289BC 8004D5BC 04820001 */  bltzl     $a0, .L8004D5C4
/* 289C0 8004D5C0 24840008 */   addiu    $a0, $a0, 0x8
.L8004D5C4:
/* 289C4 8004D5C4 92220258 */  lbu       $v0, 0x258($s1)
/* 289C8 8004D5C8 9223025A */  lbu       $v1, 0x25A($s1)
/* 289CC 8004D5CC 00441023 */  subu      $v0, $v0, $a0
/* 289D0 8004D5D0 A2220258 */  sb        $v0, 0x258($s1)
/* 289D4 8004D5D4 08013578 */  j         .L8004D5E0
/* 289D8 8004D5D8 A2230259 */   sb       $v1, 0x259($s1)
.L8004D5DC:
/* 289DC 8004D5DC A2200258 */  sb        $zero, 0x258($s1)
.L8004D5E0:
/* 289E0 8004D5E0 2402FFFF */  addiu     $v0, $zero, -0x1
/* 289E4 8004D5E4 10C20064 */  beq       $a2, $v0, .L8004D778
/* 289E8 8004D5E8 00000000 */   nop
/* 289EC 8004D5EC 10C00058 */  beqz      $a2, .L8004D750
/* 289F0 8004D5F0 00000000 */   nop
/* 289F4 8004D5F4 96220058 */  lhu       $v0, 0x58($s1)
/* 289F8 8004D5F8 10C2005F */  beq       $a2, $v0, .L8004D778
/* 289FC 8004D5FC 3C030002 */   lui      $v1, (0x2625A >> 16)
/* 28A00 8004D600 3463625A */  ori       $v1, $v1, (0x2625A & 0xFFFF)
/* 28A04 8004D604 30C200FF */  andi      $v0, $a2, 0xFF
/* 28A08 8004D608 A6220058 */  sh        $v0, 0x58($s1)
/* 28A0C 8004D60C A622005A */  sh        $v0, 0x5A($s1)
/* 28A10 8004D610 24020003 */  addiu     $v0, $zero, 0x3
/* 28A14 8004D614 A2220221 */  sb        $v0, 0x221($s1)
/* 28A18 8004D618 24020002 */  addiu     $v0, $zero, 0x2
/* 28A1C 8004D61C 14C20004 */  bne       $a2, $v0, .L8004D630
/* 28A20 8004D620 AE230008 */   sw       $v1, 0x8($s1)
/* 28A24 8004D624 8E220000 */  lw        $v0, 0x0($s1)
/* 28A28 8004D628 0801358E */  j         .L8004D638
/* 28A2C 8004D62C 8C500060 */   lw       $s0, 0x60($v0)
.L8004D630:
/* 28A30 8004D630 8E220000 */  lw        $v0, 0x0($s1)
/* 28A34 8004D634 8C50005C */  lw        $s0, 0x5C($v0)
.L8004D638:
/* 28A38 8004D638 8E220074 */  lw        $v0, 0x74($s1)
/* 28A3C 8004D63C 0220202D */  daddu     $a0, $s1, $zero
/* 28A40 8004D640 AE300064 */  sw        $s0, 0x64($s1)
/* 28A44 8004D644 90420000 */  lbu       $v0, 0x0($v0)
/* 28A48 8004D648 3C050002 */  lui       $a1, (0x2625A >> 16)
/* 28A4C 8004D64C 30420007 */  andi      $v0, $v0, 0x7
/* 28A50 8004D650 3C068008 */  lui       $a2, %hi(D_80078510)
/* 28A54 8004D654 00C23021 */  addu      $a2, $a2, $v0
/* 28A58 8004D658 90C68510 */  lbu       $a2, %lo(D_80078510)($a2)
/* 28A5C 8004D65C 0C013A20 */  jal       func_8004E880
/* 28A60 8004D660 34A5625A */   ori      $a1, $a1, (0x2625A & 0xFFFF)
/* 28A64 8004D664 26120010 */  addiu     $s2, $s0, 0x10
/* 28A68 8004D668 00131040 */  sll       $v0, $s3, 1
/* 28A6C 8004D66C 02421021 */  addu      $v0, $s2, $v0
/* 28A70 8004D670 94420004 */  lhu       $v0, 0x4($v0)
/* 28A74 8004D674 14400003 */  bnez      $v0, .L8004D684
/* 28A78 8004D678 00021080 */   sll      $v0, $v0, 2
/* 28A7C 8004D67C 96020014 */  lhu       $v0, 0x14($s0)
/* 28A80 8004D680 00021080 */  sll       $v0, $v0, 2
.L8004D684:
/* 28A84 8004D684 00501021 */  addu      $v0, $v0, $s0
/* 28A88 8004D688 AE22006C */  sw        $v0, 0x6C($s1)
/* 28A8C 8004D68C AE220068 */  sw        $v0, 0x68($s1)
/* 28A90 8004D690 9602001C */  lhu       $v0, 0x1C($s0)
/* 28A94 8004D694 10400020 */  beqz      $v0, .L8004D718
/* 28A98 8004D698 00021080 */   sll      $v0, $v0, 2
/* 28A9C 8004D69C 8E230064 */  lw        $v1, 0x64($s1)
/* 28AA0 8004D6A0 00431021 */  addu      $v0, $v0, $v1
/* 28AA4 8004D6A4 AE220078 */  sw        $v0, 0x78($s1)
/* 28AA8 8004D6A8 9202001F */  lbu       $v0, 0x1F($s0)
/* 28AAC 8004D6AC A222021C */  sb        $v0, 0x21C($s1)
/* 28AB0 8004D6B0 304200FF */  andi      $v0, $v0, 0xFF
/* 28AB4 8004D6B4 1040000C */  beqz      $v0, .L8004D6E8
/* 28AB8 8004D6B8 0000182D */   daddu    $v1, $zero, $zero
/* 28ABC 8004D6BC 0220282D */  daddu     $a1, $s1, $zero
/* 28AC0 8004D6C0 0060202D */  daddu     $a0, $v1, $zero
.L8004D6C4:
/* 28AC4 8004D6C4 8E220078 */  lw        $v0, 0x78($s1)
/* 28AC8 8004D6C8 24630001 */  addiu     $v1, $v1, 0x1
/* 28ACC 8004D6CC 00441021 */  addu      $v0, $v0, $a0
/* 28AD0 8004D6D0 ACA20080 */  sw        $v0, 0x80($a1)
/* 28AD4 8004D6D4 24A50004 */  addiu     $a1, $a1, 0x4
/* 28AD8 8004D6D8 9222021C */  lbu       $v0, 0x21C($s1)
/* 28ADC 8004D6DC 0062102B */  sltu      $v0, $v1, $v0
/* 28AE0 8004D6E0 1440FFF8 */  bnez      $v0, .L8004D6C4
/* 28AE4 8004D6E4 2484000C */   addiu    $a0, $a0, 0xC
.L8004D6E8:
/* 28AE8 8004D6E8 2C62000C */  sltiu     $v0, $v1, 0xC
/* 28AEC 8004D6EC 1040000C */  beqz      $v0, .L8004D720
/* 28AF0 8004D6F0 00031080 */   sll      $v0, $v1, 2
/* 28AF4 8004D6F4 00512021 */  addu      $a0, $v0, $s1
.L8004D6F8:
/* 28AF8 8004D6F8 8E220080 */  lw        $v0, 0x80($s1)
/* 28AFC 8004D6FC 24630001 */  addiu     $v1, $v1, 0x1
/* 28B00 8004D700 AC820080 */  sw        $v0, 0x80($a0)
/* 28B04 8004D704 2C62000C */  sltiu     $v0, $v1, 0xC
/* 28B08 8004D708 1440FFFB */  bnez      $v0, .L8004D6F8
/* 28B0C 8004D70C 24840004 */   addiu    $a0, $a0, 0x4
/* 28B10 8004D710 080135C8 */  j         .L8004D720
/* 28B14 8004D714 00000000 */   nop
.L8004D718:
/* 28B18 8004D718 AE200078 */  sw        $zero, 0x78($s1)
/* 28B1C 8004D71C A220021C */  sb        $zero, 0x21C($s1)
.L8004D720:
/* 28B20 8004D720 96420010 */  lhu       $v0, 0x10($s2)
/* 28B24 8004D724 10400007 */  beqz      $v0, .L8004D744
/* 28B28 8004D728 00021080 */   sll      $v0, $v0, 2
/* 28B2C 8004D72C 8E230064 */  lw        $v1, 0x64($s1)
/* 28B30 8004D730 00431021 */  addu      $v0, $v0, $v1
/* 28B34 8004D734 AE22007C */  sw        $v0, 0x7C($s1)
/* 28B38 8004D738 92420013 */  lbu       $v0, 0x13($s2)
/* 28B3C 8004D73C 080135DE */  j         .L8004D778
/* 28B40 8004D740 A222021D */   sb       $v0, 0x21D($s1)
.L8004D744:
/* 28B44 8004D744 AE20007C */  sw        $zero, 0x7C($s1)
/* 28B48 8004D748 080135DE */  j         .L8004D778
/* 28B4C 8004D74C A220021D */   sb       $zero, 0x21D($s1)
.L8004D750:
/* 28B50 8004D750 96220058 */  lhu       $v0, 0x58($s1)
/* 28B54 8004D754 10400006 */  beqz      $v0, .L8004D770
/* 28B58 8004D758 24020004 */   addiu    $v0, $zero, 0x4
/* 28B5C 8004D75C A2220221 */  sb        $v0, 0x221($s1)
/* 28B60 8004D760 24020001 */  addiu     $v0, $zero, 0x1
/* 28B64 8004D764 AE220010 */  sw        $v0, 0x10($s1)
/* 28B68 8004D768 080135DE */  j         .L8004D778
/* 28B6C 8004D76C AE220008 */   sw       $v0, 0x8($s1)
.L8004D770:
/* 28B70 8004D770 0C0136AA */  jal       au_bgm_stop_player
/* 28B74 8004D774 0220202D */   daddu    $a0, $s1, $zero
.L8004D778:
/* 28B78 8004D778 8FBF0020 */  lw        $ra, 0x20($sp)
/* 28B7C 8004D77C 8FB3001C */  lw        $s3, 0x1C($sp)
/* 28B80 8004D780 8FB20018 */  lw        $s2, 0x18($sp)
/* 28B84 8004D784 8FB10014 */  lw        $s1, 0x14($sp)
/* 28B88 8004D788 8FB00010 */  lw        $s0, 0x10($sp)
/* 28B8C 8004D78C 03E00008 */  jr        $ra
/* 28B90 8004D790 27BD0028 */   addiu    $sp, $sp, 0x28

### DECOMPILED C INSTRUCTIONS:

void au_bgm_update_main(BGMPlayer* player) {
    BGMHeader* bgmFile;
    BGMFileInfo* bgmData;
    s32 unkType;
    u32 segmentID;
    s32 segmentOffset;
    u32 value;
    s32 delta;
    u8 var_a1;
    u8 pos;
    u32 i;

    segmentID = 0;
    unkType = -1;
    player->updateCounter++;

    if (player->unk_258 != 0) {
        if (player->unk_258 < ARRAY_COUNT(player->unk_238)) {
            pos = player->unk_259;
            for (var_a1 = 0; var_a1 < player->unk_258; var_a1++) {
                value = player->unk_238[pos];
                if (value != 0) {
                    if (value < 16) {
                        unkType = value & 3;
                        segmentID = value >> 2;
                    }
                    pos++;
                    if (pos >= ARRAY_COUNT(player->unk_238)) {
                        pos = 0;
                    }
                }
            }
            delta = player->unk_25A - player->unk_259;
            if (delta < 0) {
                delta += ARRAY_COUNT(player->unk_238);
            }
            player->unk_258 -= delta;
            player->unk_259 = player->unk_25A;
        } else {
            player->unk_258 = 0;
        }
        if (unkType != -1) {
            if (unkType != 0) {
                if (unkType != player->unk_58) {
                    player->unk_58 = unkType & 0xFF;
                    player->unk_5A = unkType & 0xFF;
                    player->masterState = BGM_PLAY_STATE_INIT;
                    player->nextUpdateStep = BGM_SAMPLE_RATE;
                    if (unkType == 2) {
                        bgmFile = player->globals->dataBGM[1];
                    } else {
                        bgmFile = player->globals->dataBGM[0];
                    }
                    player->bgmFile = bgmFile;
                    bgmData = &bgmFile->info;
                    func_8004E880(player, BGM_SAMPLE_RATE, BgmDivisors[((u8*)player->unk_74)[0] & 7]); //TODO revise unk_74 typing

                    segmentOffset = bgmData->segments[segmentID];
                    if (segmentOffset == 0) {
                        segmentOffset = bgmData->segments[0];
                    }
                    player->segmentStartPos = AU_FILE_RELATIVE(bgmFile, segmentOffset << 2);
                    player->segmentReadPos = AU_FILE_RELATIVE(bgmFile, segmentOffset << 2);

                    if (bgmData->drums != 0) {
                        player->drumsInfo = AU_FILE_RELATIVE(player->bgmFile, bgmData->drums << 2);
                        player->bgmDrumCount = bgmData->drumCount;
                        for (i = 0; i < player->bgmDrumCount; i++) {
                            BGMDrumInfo* drum = &player->drumsInfo[i];
                            player->drums[i] = drum;
                        }
                        for (; i < 12; i++) {
                            player->drums[i] = player->drums[0];
                        }
                    } else {
                        player->drumsInfo = NULL;
                        player->bgmDrumCount = 0;
                    }

                    if (bgmData->instruments != 0) {
                        player->instrumentsInfo = AU_FILE_RELATIVE(player->bgmFile, bgmData->instruments << 2);
                        player->bgmInstrumentCount = bgmData->instrumentCount;
                        return;
                    }
                    player->instrumentsInfo = NULL;
                    player->bgmInstrumentCount = 0;
                }
            } else {
                if (player->unk_58 != 0) {
                    player->masterState = BGM_PLAY_STATE_STOP;
                    player->nextUpdateCounter = 1;
                    player->nextUpdateStep = 1;
                } else {
                    au_bgm_stop_player(player);
                }
            }
        }
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel draw_content_pickup_item_header
/* CCE3C 8013673C 27BDFFD0 */  addiu     $sp, $sp, -0x30
/* CCE40 80136740 AFB1001C */  sw        $s1, 0x1C($sp)
/* CCE44 80136744 0080882D */  daddu     $s1, $a0, $zero
/* CCE48 80136748 AFB20020 */  sw        $s2, 0x20($sp)
/* CCE4C 8013674C 00A0902D */  daddu     $s2, $a1, $zero
/* CCE50 80136750 AFB30024 */  sw        $s3, 0x24($sp)
/* CCE54 80136754 3C048008 */  lui       $a0, %hi(gItemTable)
/* CCE58 80136758 248478E0 */  addiu     $a0, $a0, %lo(gItemTable)
/* CCE5C 8013675C AFBF0028 */  sw        $ra, 0x28($sp)
/* CCE60 80136760 AFB00018 */  sw        $s0, 0x18($sp)
/* CCE64 80136764 86230018 */  lh        $v1, 0x18($s1)
/* CCE68 80136768 9222001A */  lbu       $v0, 0x1A($s1)
/* CCE6C 8013676C 00031940 */  sll       $v1, $v1, 5
/* CCE70 80136770 00642021 */  addu      $a0, $v1, $a0
/* CCE74 80136774 2442FFFE */  addiu     $v0, $v0, -0x2
/* CCE78 80136778 00021600 */  sll       $v0, $v0, 24
/* CCE7C 8013677C 00021E03 */  sra       $v1, $v0, 24
/* CCE80 80136780 2C62000D */  sltiu     $v0, $v1, 0xD
/* CCE84 80136784 1040008B */  beqz      $v0, .L801369B4
/* CCE88 80136788 00C0982D */   daddu    $s3, $a2, $zero
/* CCE8C 8013678C 00031080 */  sll       $v0, $v1, 2
/* CCE90 80136790 3C018015 */  lui       $at, %hi(jtbl_80150E60)
/* CCE94 80136794 00220821 */  addu      $at, $at, $v0
/* CCE98 80136798 8C220E60 */  lw        $v0, %lo(jtbl_80150E60)($at)
/* CCE9C 8013679C 00400008 */  jr        $v0
/* CCEA0 801367A0 00000000 */   nop
glabel .L801367A4
/* CCEA4 801367A4 94820018 */  lhu       $v0, 0x18($a0)
/* CCEA8 801367A8 30420040 */  andi      $v0, $v0, 0x40
/* CCEAC 801367AC 1440001C */  bnez      $v0, .L80136820
/* CCEB0 801367B0 3C030400 */   lui      $v1, (0x4000000 >> 16)
/* CCEB4 801367B4 8E220000 */  lw        $v0, 0x0($s1)
/* CCEB8 801367B8 00431024 */  and       $v0, $v0, $v1
/* CCEBC 801367BC 10400005 */  beqz      $v0, .L801367D4
/* CCEC0 801367C0 3C10001D */   lui      $s0, (0x1D0058 >> 16)
/* CCEC4 801367C4 96220006 */  lhu       $v0, 0x6($s1)
/* CCEC8 801367C8 30420004 */  andi      $v0, $v0, 0x4
/* CCECC 801367CC 50400002 */  beql      $v0, $zero, .L801367D8
/* CCED0 801367D0 3610005A */   ori      $s0, $s0, (0x1D005A & 0xFFFF)
.L801367D4:
/* CCED4 801367D4 36100058 */  ori       $s0, $s0, (0x1D0058 & 0xFFFF)
.L801367D8:
/* CCED8 801367D8 8C840000 */  lw        $a0, 0x0($a0)
/* CCEDC 801367DC 0C0496CF */  jal       set_message_msg
/* CCEE0 801367E0 0000282D */   daddu    $a1, $zero, $zero
/* CCEE4 801367E4 96230006 */  lhu       $v1, 0x6($s1)
/* CCEE8 801367E8 30620010 */  andi      $v0, $v1, 0x10
/* CCEEC 801367EC 10400003 */  beqz      $v0, .L801367FC
/* CCEF0 801367F0 30620020 */   andi     $v0, $v1, 0x20
/* CCEF4 801367F4 3C10001D */  lui       $s0, (0x1D005D >> 16)
/* CCEF8 801367F8 3610005D */  ori       $s0, $s0, (0x1D005D & 0xFFFF)
.L801367FC:
/* CCEFC 801367FC 10400003 */  beqz      $v0, .L8013680C
/* CCF00 80136800 30620040 */   andi     $v0, $v1, 0x40
/* CCF04 80136804 3C10001D */  lui       $s0, (0x1D005E >> 16)
/* CCF08 80136808 3610005E */  ori       $s0, $s0, (0x1D005E & 0xFFFF)
.L8013680C:
/* CCF0C 8013680C 1040001E */  beqz      $v0, .L80136888
/* CCF10 80136810 00000000 */   nop
/* CCF14 80136814 3C10001D */  lui       $s0, (0x1D005C >> 16)
/* CCF18 80136818 0804DA22 */  j         .L80136888
/* CCF1C 8013681C 3610005C */   ori      $s0, $s0, (0x1D005C & 0xFFFF)
.L80136820:
/* CCF20 80136820 8E220000 */  lw        $v0, 0x0($s1)
/* CCF24 80136824 00431024 */  and       $v0, $v0, $v1
/* CCF28 80136828 10400005 */  beqz      $v0, .L80136840
/* CCF2C 8013682C 3C10001D */   lui      $s0, (0x1D0059 >> 16)
/* CCF30 80136830 96220006 */  lhu       $v0, 0x6($s1)
/* CCF34 80136834 30420004 */  andi      $v0, $v0, 0x4
/* CCF38 80136838 50400002 */  beql      $v0, $zero, .L80136844
/* CCF3C 8013683C 3610005B */   ori      $s0, $s0, (0x1D005B & 0xFFFF)
.L80136840:
/* CCF40 80136840 36100059 */  ori       $s0, $s0, (0x1D0059 & 0xFFFF)
.L80136844:
/* CCF44 80136844 96230006 */  lhu       $v1, 0x6($s1)
/* CCF48 80136848 30620010 */  andi      $v0, $v1, 0x10
/* CCF4C 8013684C 10400003 */  beqz      $v0, .L8013685C
/* CCF50 80136850 30620020 */   andi     $v0, $v1, 0x20
/* CCF54 80136854 3C10001D */  lui       $s0, (0x1D005D >> 16)
/* CCF58 80136858 3610005D */  ori       $s0, $s0, (0x1D005D & 0xFFFF)
.L8013685C:
/* CCF5C 8013685C 10400003 */  beqz      $v0, .L8013686C
/* CCF60 80136860 30620040 */   andi     $v0, $v1, 0x40
/* CCF64 80136864 3C10001D */  lui       $s0, (0x1D005E >> 16)
/* CCF68 80136868 3610005E */  ori       $s0, $s0, (0x1D005E & 0xFFFF)
.L8013686C:
/* CCF6C 8013686C 10400003 */  beqz      $v0, .L8013687C
/* CCF70 80136870 00000000 */   nop
/* CCF74 80136874 3C10001D */  lui       $s0, (0x1D005C >> 16)
/* CCF78 80136878 3610005C */  ori       $s0, $s0, (0x1D005C & 0xFFFF)
.L8013687C:
/* CCF7C 8013687C 8C840000 */  lw        $a0, 0x0($a0)
/* CCF80 80136880 0C0496CF */  jal       set_message_msg
/* CCF84 80136884 0000282D */   daddu    $a1, $zero, $zero
.L80136888:
/* CCF88 80136888 0C04992C */  jal       get_msg_lines
/* CCF8C 8013688C 0200202D */   daddu    $a0, $s0, $zero
/* CCF90 80136890 2442FFFF */  addiu     $v0, $v0, -0x1
/* CCF94 80136894 86250018 */  lh        $a1, 0x18($s1)
/* CCF98 80136898 00021040 */  sll       $v0, $v0, 1
/* CCF9C 8013689C 00051940 */  sll       $v1, $a1, 5
/* CCFA0 801368A0 3C048008 */  lui       $a0, %hi(gItemTable + 0x18)
/* CCFA4 801368A4 00832021 */  addu      $a0, $a0, $v1
/* CCFA8 801368A8 948478F8 */  lhu       $a0, %lo(gItemTable + 0x18)($a0)
/* CCFAC 801368AC 3C068015 */  lui       $a2, %hi(PickupMessageWindowYOffsets)
/* CCFB0 801368B0 00C23021 */  addu      $a2, $a2, $v0
/* CCFB4 801368B4 84C6C6E4 */  lh        $a2, %lo(PickupMessageWindowYOffsets)($a2)
/* CCFB8 801368B8 30830040 */  andi      $v1, $a0, 0x40
/* CCFBC 801368BC 5460000E */  bnel      $v1, $zero, .L801368F8
/* CCFC0 801368C0 0200202D */   daddu    $a0, $s0, $zero
/* CCFC4 801368C4 30820008 */  andi      $v0, $a0, 0x8
/* CCFC8 801368C8 5440000B */  bnel      $v0, $zero, .L801368F8
/* CCFCC 801368CC 0200202D */   daddu    $a0, $s0, $zero
/* CCFD0 801368D0 2402015C */  addiu     $v0, $zero, 0x15C
/* CCFD4 801368D4 10A20007 */  beq       $a1, $v0, .L801368F4
/* CCFD8 801368D8 30820020 */   andi     $v0, $a0, 0x20
/* CCFDC 801368DC 14400006 */  bnez      $v0, .L801368F8
/* CCFE0 801368E0 0200202D */   daddu    $a0, $s0, $zero
/* CCFE4 801368E4 96220006 */  lhu       $v0, 0x6($s1)
/* CCFE8 801368E8 30420030 */  andi      $v0, $v0, 0x30
/* CCFEC 801368EC 1040000B */  beqz      $v0, .L8013691C
/* CCFF0 801368F0 26450028 */   addiu    $a1, $s2, 0x28
.L801368F4:
/* CCFF4 801368F4 0200202D */  daddu     $a0, $s0, $zero
.L801368F8:
/* CCFF8 801368F8 2645000F */  addiu     $a1, $s2, 0xF
/* CCFFC 801368FC 02663021 */  addu      $a2, $s3, $a2
/* CD000 80136900 240700FF */  addiu     $a3, $zero, 0xFF
/* CD004 80136904 2402002F */  addiu     $v0, $zero, 0x2F
/* CD008 80136908 AFA20010 */  sw        $v0, 0x10($sp)
/* CD00C 8013690C 0C04993B */  jal       draw_msg
/* CD010 80136910 AFA00014 */   sw       $zero, 0x14($sp)
/* CD014 80136914 0804DA6D */  j         .L801369B4
/* CD018 80136918 00000000 */   nop
.L8013691C:
/* CD01C 8013691C 02663021 */  addu      $a2, $s3, $a2
/* CD020 80136920 240700FF */  addiu     $a3, $zero, 0xFF
/* CD024 80136924 2402002F */  addiu     $v0, $zero, 0x2F
/* CD028 80136928 AFA20010 */  sw        $v0, 0x10($sp)
/* CD02C 8013692C 0C04993B */  jal       draw_msg
/* CD030 80136930 AFA00014 */   sw       $zero, 0x14($sp)
/* CD034 80136934 96220006 */  lhu       $v0, 0x6($s1)
/* CD038 80136938 30420030 */  andi      $v0, $v0, 0x30
/* CD03C 8013693C 1440001D */  bnez      $v0, .L801369B4
/* CD040 80136940 26450014 */   addiu    $a1, $s2, 0x14
/* CD044 80136944 0804DA65 */  j         .L80136994
/* CD048 80136948 00000000 */   nop
glabel .L8013694C
/* CD04C 8013694C 3C028015 */  lui       $v0, %hi(D_801568EC)
/* CD050 80136950 8C4268EC */  lw        $v0, %lo(D_801568EC)($v0)
/* CD054 80136954 00021140 */  sll       $v0, $v0, 5
/* CD058 80136958 3C048008 */  lui       $a0, %hi(gItemTable)
/* CD05C 8013695C 00822021 */  addu      $a0, $a0, $v0
/* CD060 80136960 8C8478E0 */  lw        $a0, %lo(gItemTable)($a0)
/* CD064 80136964 0C0496CF */  jal       set_message_msg
/* CD068 80136968 0000282D */   daddu    $a1, $zero, $zero
/* CD06C 8013696C 3C04001D */  lui       $a0, (0x1D005F >> 16)
/* CD070 80136970 3484005F */  ori       $a0, $a0, (0x1D005F & 0xFFFF)
/* CD074 80136974 26450028 */  addiu     $a1, $s2, 0x28
/* CD078 80136978 26660004 */  addiu     $a2, $s3, 0x4
/* CD07C 8013697C 240700FF */  addiu     $a3, $zero, 0xFF
/* CD080 80136980 2402002F */  addiu     $v0, $zero, 0x2F
/* CD084 80136984 AFA20010 */  sw        $v0, 0x10($sp)
/* CD088 80136988 0C04993B */  jal       draw_msg
/* CD08C 8013698C AFA00014 */   sw       $zero, 0x14($sp)
/* CD090 80136990 26450014 */  addiu     $a1, $s2, 0x14
.L80136994:
/* CD094 80136994 3C108015 */  lui       $s0, %hi(ItemPickupIconID)
/* CD098 80136998 261068E0 */  addiu     $s0, $s0, %lo(ItemPickupIconID)
/* CD09C 8013699C 8E040000 */  lw        $a0, 0x0($s0)
/* CD0A0 801369A0 0C051261 */  jal       hud_element_set_render_pos
/* CD0A4 801369A4 26660014 */   addiu    $a2, $s3, 0x14
/* CD0A8 801369A8 8E040000 */  lw        $a0, 0x0($s0)
/* CD0AC 801369AC 0C0511F1 */  jal       hud_element_draw_next
/* CD0B0 801369B0 00000000 */   nop
glabel .L801369B4
/* CD0B4 801369B4 8FBF0028 */  lw        $ra, 0x28($sp)
/* CD0B8 801369B8 8FB30024 */  lw        $s3, 0x24($sp)
/* CD0BC 801369BC 8FB20020 */  lw        $s2, 0x20($sp)
/* CD0C0 801369C0 8FB1001C */  lw        $s1, 0x1C($sp)
/* CD0C4 801369C4 8FB00018 */  lw        $s0, 0x18($sp)
/* CD0C8 801369C8 03E00008 */  jr        $ra
/* CD0CC 801369CC 27BD0030 */   addiu    $sp, $sp, 0x30

### DECOMPILED C INSTRUCTIONS:

void draw_content_pickup_item_header(ItemEntity* item, s32 posX, s32 posY) {
    ItemData* itemData = &gItemTable[item->itemID];
    s32 itemMsg;
    s32 offsetY;

    switch (item->state) {
        case ITEM_PICKUP_STATE_SHOW_GOT_ITEM:
        case ITEM_PICKUP_STATE_HIDE_GOT_ITEM:
        case ITEM_PICKUP_STATE_SHOW_TOO_MANY:
        case ITEM_PICKUP_STATE_HIDE_TOO_MANY:
            if (!(itemData->typeFlags & ITEM_TYPE_FLAG_BADGE)) {
                if (!(item->flags & ITEM_ENTITY_FLAG_4000000) || (item->pickupMsgFlags & ITEM_PICKUP_FLAG_UNKNOWN)) {
                    itemMsg = MSG_Menus_0058;
                } else {
                    itemMsg = MSG_Menus_005A;
                }
                set_message_msg(itemData->nameMsg, 0);

                if (item->pickupMsgFlags & ITEM_PICKUP_FLAG_1_COIN) {
                    itemMsg = MSG_Menus_005D;
                }
                if (item->pickupMsgFlags & ITEM_PICKUP_FLAG_3_STAR_PIECES) {
                    itemMsg = MSG_Menus_005E;
                }
                if (item->pickupMsgFlags & ITEM_PICKUP_FLAG_UNIQUE) {
                    itemMsg = MSG_Menus_005C;
                }
            } else {
                if (!(item->flags & ITEM_ENTITY_FLAG_4000000) || (item->pickupMsgFlags & ITEM_PICKUP_FLAG_UNKNOWN)) {
                    itemMsg = MSG_Menus_0059;
                } else {
                    itemMsg = MSG_Menus_005B;
                }

                if (item->pickupMsgFlags & ITEM_PICKUP_FLAG_1_COIN) {
                    itemMsg = MSG_Menus_005D;
                }
                if (item->pickupMsgFlags & ITEM_PICKUP_FLAG_3_STAR_PIECES) {
                    itemMsg = MSG_Menus_005E;
                }
                if (item->pickupMsgFlags & ITEM_PICKUP_FLAG_UNIQUE) {
                    itemMsg = MSG_Menus_005C;
                }

                set_message_msg(itemData->nameMsg, 0);
            }

            offsetY = PickupMessageWindowYOffsets[get_msg_lines(itemMsg) - 1];

            if ((gItemTable[item->itemID].typeFlags & ITEM_TYPE_FLAG_BADGE)
                || (gItemTable[item->itemID].typeFlags & ITEM_TYPE_FLAG_KEY)
                || item->itemID == ITEM_STAR_PIECE
                || (gItemTable[item->itemID].typeFlags & ITEM_TYPE_FLAG_GEAR)
                || (item->pickupMsgFlags & (ITEM_PICKUP_FLAG_1_COIN | ITEM_PICKUP_FLAG_3_STAR_PIECES))
            ) {
                draw_msg(itemMsg, posX + 15, posY + offsetY, 255, MSG_PAL_2F, 0);
            } else {
                draw_msg(itemMsg, posX + 40, posY + offsetY, 255, MSG_PAL_2F, 0);
                if (!(item->pickupMsgFlags & (ITEM_PICKUP_FLAG_1_COIN | ITEM_PICKUP_FLAG_3_STAR_PIECES))) {
                    hud_element_set_render_pos(ItemPickupIconID, posX + 20, posY + 20);
                    hud_element_draw_next(ItemPickupIconID);
                }
            }
            break;
        case ITEM_PICKUP_STATE_SHOW_THREW_AWAY:
        case ITEM_PICKUP_STATE_HIDE_THREW_AWAY:
            set_message_msg(gItemTable[D_801568EC].nameMsg, 0);
            draw_msg(MSG_Menus_005F, posX + 40, posY + 4, 255, MSG_PAL_2F, 0);
            hud_element_set_render_pos(ItemPickupIconID, posX + 20, posY + 20);
            hud_element_draw_next(ItemPickupIconID);
            break;
    }
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel entity_shattering_setupGfx
/* 104424 802E2BA4 27BDFE80 */  addiu     $sp, $sp, -0x180
/* 104428 802E2BA8 AFB20130 */  sw        $s2, 0x130($sp)
/* 10442C 802E2BAC 3C12800A */  lui       $s2, %hi(gMainGfxPos)
/* 104430 802E2BB0 8E52A66C */  lw        $s2, %lo(gMainGfxPos)($s2)
/* 104434 802E2BB4 F7BA0168 */  sdc1      $f26, 0x168($sp)
/* 104438 802E2BB8 3C0143B4 */  lui       $at, (0x43B40000 >> 16)
/* 10443C 802E2BBC 4481D000 */  mtc1      $at, $f26
/* 104440 802E2BC0 AFB70144 */  sw        $s7, 0x144($sp)
/* 104444 802E2BC4 0000B82D */  daddu     $s7, $zero, $zero
/* 104448 802E2BC8 F7B80160 */  sdc1      $f24, 0x160($sp)
/* 10444C 802E2BCC 3C013B80 */  lui       $at, (0x3B800000 >> 16)
/* 104450 802E2BD0 4481C000 */  mtc1      $at, $f24
/* 104454 802E2BD4 27A80098 */  addiu     $t0, $sp, 0x98
/* 104458 802E2BD8 AFB60140 */  sw        $s6, 0x140($sp)
/* 10445C 802E2BDC 27B600D8 */  addiu     $s6, $sp, 0xD8
/* 104460 802E2BE0 AFB5013C */  sw        $s5, 0x13C($sp)
/* 104464 802E2BE4 27B50058 */  addiu     $s5, $sp, 0x58
/* 104468 802E2BE8 AFA80120 */  sw        $t0, 0x120($sp)
/* 10446C 802E2BEC 3C080001 */  lui       $t0, (0x11630 >> 16)
/* 104470 802E2BF0 F7B60158 */  sdc1      $f22, 0x158($sp)
/* 104474 802E2BF4 3C013F80 */  lui       $at, (0x3F800000 >> 16)
/* 104478 802E2BF8 4481B000 */  mtc1      $at, $f22
/* 10447C 802E2BFC 35081630 */  ori       $t0, $t0, (0x11630 & 0xFFFF)
/* 104480 802E2C00 AFBF014C */  sw        $ra, 0x14C($sp)
/* 104484 802E2C04 AFBE0148 */  sw        $fp, 0x148($sp)
/* 104488 802E2C08 AFB40138 */  sw        $s4, 0x138($sp)
/* 10448C 802E2C0C AFB30134 */  sw        $s3, 0x134($sp)
/* 104490 802E2C10 AFB1012C */  sw        $s1, 0x12C($sp)
/* 104494 802E2C14 AFB00128 */  sw        $s0, 0x128($sp)
/* 104498 802E2C18 F7BE0178 */  sdc1      $f30, 0x178($sp)
/* 10449C 802E2C1C F7BC0170 */  sdc1      $f28, 0x170($sp)
/* 1044A0 802E2C20 F7B40150 */  sdc1      $f20, 0x150($sp)
/* 1044A4 802E2C24 0C04417A */  jal       get_entity_by_index
/* 1044A8 802E2C28 AFA80124 */   sw       $t0, 0x124($sp)
/* 1044AC 802E2C2C AFA2011C */  sw        $v0, 0x11C($sp)
/* 1044B0 802E2C30 8C540040 */  lw        $s4, 0x40($v0)
/* 1044B4 802E2C34 4480A000 */  mtc1      $zero, $f20
/* 1044B8 802E2C38 C4400048 */  lwc1      $f0, 0x48($v0)
/* 1044BC 802E2C3C 0280982D */  daddu     $s3, $s4, $zero
/* 1044C0 802E2C40 2651FFFC */  addiu     $s1, $s2, -0x4
/* 1044C4 802E2C44 46000007 */  neg.s     $f0, $f0
/* 1044C8 802E2C48 E7A00118 */  swc1      $f0, 0x118($sp)
/* 1044CC 802E2C4C C440004C */  lwc1      $f0, 0x4C($v0)
/* 1044D0 802E2C50 C4420050 */  lwc1      $f2, 0x50($v0)
/* 1044D4 802E2C54 8E9E0034 */  lw        $fp, 0x34($s4)
/* 1044D8 802E2C58 46000787 */  neg.s     $f30, $f0
/* 1044DC 802E2C5C 46001707 */  neg.s     $f28, $f2
.L802E2C60:
/* 1044E0 802E2C60 8683003C */  lh        $v1, 0x3C($s4)
/* 1044E4 802E2C64 240200FF */  addiu     $v0, $zero, 0xFF
/* 1044E8 802E2C68 1462000F */  bne       $v1, $v0, .L802E2CA8
/* 1044EC 802E2C6C 26310008 */   addiu    $s1, $s1, 0x8
/* 1044F0 802E2C70 3C03E200 */  lui       $v1, (0xE200001C >> 16)
/* 1044F4 802E2C74 3463001C */  ori       $v1, $v1, (0xE200001C & 0xFFFF)
/* 1044F8 802E2C78 3C020055 */  lui       $v0, (0x552078 >> 16)
/* 1044FC 802E2C7C 34422078 */  ori       $v0, $v0, (0x552078 & 0xFFFF)
/* 104500 802E2C80 AE23FFFC */  sw        $v1, -0x4($s1)
/* 104504 802E2C84 AE220000 */  sw        $v0, 0x0($s1)
/* 104508 802E2C88 26310008 */  addiu     $s1, $s1, 0x8
/* 10450C 802E2C8C 26520010 */  addiu     $s2, $s2, 0x10
/* 104510 802E2C90 3C03FC12 */  lui       $v1, (0xFC121824 >> 16)
/* 104514 802E2C94 34631824 */  ori       $v1, $v1, (0xFC121824 & 0xFFFF)
/* 104518 802E2C98 3C02FF33 */  lui       $v0, (0xFF33FFFF >> 16)
/* 10451C 802E2C9C 3442FFFF */  ori       $v0, $v0, (0xFF33FFFF & 0xFFFF)
/* 104520 802E2CA0 080B8B35 */  j         .L802E2CD4
/* 104524 802E2CA4 AE23FFFC */   sw       $v1, -0x4($s1)
.L802E2CA8:
/* 104528 802E2CA8 3C03FCFF */  lui       $v1, (0xFCFFC3FF >> 16)
/* 10452C 802E2CAC 3463C3FF */  ori       $v1, $v1, (0xFCFFC3FF & 0xFFFF)
/* 104530 802E2CB0 3C02FF30 */  lui       $v0, (0xFF30FE7F >> 16)
/* 104534 802E2CB4 3442FE7F */  ori       $v0, $v0, (0xFF30FE7F & 0xFFFF)
/* 104538 802E2CB8 AE23FFFC */  sw        $v1, -0x4($s1)
/* 10453C 802E2CBC AE220000 */  sw        $v0, 0x0($s1)
/* 104540 802E2CC0 26310008 */  addiu     $s1, $s1, 0x8
/* 104544 802E2CC4 3C02FA00 */  lui       $v0, (0xFA000000 >> 16)
/* 104548 802E2CC8 AE22FFFC */  sw        $v0, -0x4($s1)
/* 10454C 802E2CCC 9282003D */  lbu       $v0, 0x3D($s4)
/* 104550 802E2CD0 26520010 */  addiu     $s2, $s2, 0x10
.L802E2CD4:
/* 104554 802E2CD4 AE220000 */  sw        $v0, 0x0($s1)
/* 104558 802E2CD8 8FA50118 */  lw        $a1, 0x118($sp)
/* 10455C 802E2CDC 4406F000 */  mfc1      $a2, $f30
/* 104560 802E2CE0 4407E000 */  mfc1      $a3, $f28
/* 104564 802E2CE4 0C019E40 */  jal       guTranslateF
/* 104568 802E2CE8 27A40018 */   addiu    $a0, $sp, 0x18
/* 10456C 802E2CEC 02978021 */  addu      $s0, $s4, $s7
/* 104570 802E2CF0 9202008B */  lbu       $v0, 0x8B($s0)
/* 104574 802E2CF4 44820000 */  mtc1      $v0, $f0
/* 104578 802E2CF8 00000000 */  nop
/* 10457C 802E2CFC 46800020 */  cvt.s.w   $f0, $f0
/* 104580 802E2D00 461A0002 */  mul.s     $f0, $f0, $f26
/* 104584 802E2D04 00000000 */  nop
/* 104588 802E2D08 46180002 */  mul.s     $f0, $f0, $f24
/* 10458C 802E2D0C 00000000 */  nop
/* 104590 802E2D10 4406B000 */  mfc1      $a2, $f22
/* 104594 802E2D14 4407A000 */  mfc1      $a3, $f20
/* 104598 802E2D18 8FA40120 */  lw        $a0, 0x120($sp)
/* 10459C 802E2D1C 44050000 */  mfc1      $a1, $f0
/* 1045A0 802E2D20 0C019EC8 */  jal       guRotateF
/* 1045A4 802E2D24 E7B40010 */   swc1     $f20, 0x10($sp)
/* 1045A8 802E2D28 920200A4 */  lbu       $v0, 0xA4($s0)
/* 1045AC 802E2D2C 44820000 */  mtc1      $v0, $f0
/* 1045B0 802E2D30 00000000 */  nop
/* 1045B4 802E2D34 46800020 */  cvt.s.w   $f0, $f0
/* 1045B8 802E2D38 461A0002 */  mul.s     $f0, $f0, $f26
/* 1045BC 802E2D3C 00000000 */  nop
/* 1045C0 802E2D40 26310008 */  addiu     $s1, $s1, 0x8
/* 1045C4 802E2D44 46180002 */  mul.s     $f0, $f0, $f24
/* 1045C8 802E2D48 00000000 */  nop
/* 1045CC 802E2D4C 26520018 */  addiu     $s2, $s2, 0x18
/* 1045D0 802E2D50 26F70001 */  addiu     $s7, $s7, 0x1
/* 1045D4 802E2D54 4406A000 */  mfc1      $a2, $f20
/* 1045D8 802E2D58 4407B000 */  mfc1      $a3, $f22
/* 1045DC 802E2D5C 44050000 */  mfc1      $a1, $f0
/* 1045E0 802E2D60 02C0202D */  daddu     $a0, $s6, $zero
/* 1045E4 802E2D64 0C019EC8 */  jal       guRotateF
/* 1045E8 802E2D68 E7B40010 */   swc1     $f20, 0x10($sp)
/* 1045EC 802E2D6C 02C0282D */  daddu     $a1, $s6, $zero
/* 1045F0 802E2D70 8FA40120 */  lw        $a0, 0x120($sp)
/* 1045F4 802E2D74 0C019D80 */  jal       guMtxCatF
/* 1045F8 802E2D78 02C0302D */   daddu    $a2, $s6, $zero
/* 1045FC 802E2D7C 02C0202D */  daddu     $a0, $s6, $zero
/* 104600 802E2D80 27A50018 */  addiu     $a1, $sp, 0x18
/* 104604 802E2D84 0C019D80 */  jal       guMtxCatF
/* 104608 802E2D88 00A0302D */   daddu    $a2, $a1, $zero
/* 10460C 802E2D8C 02A0202D */  daddu     $a0, $s5, $zero
/* 104610 802E2D90 8E6500C0 */  lw        $a1, 0xC0($s3)
/* 104614 802E2D94 8E660124 */  lw        $a2, 0x124($s3)
/* 104618 802E2D98 8E670188 */  lw        $a3, 0x188($s3)
/* 10461C 802E2D9C 0C019E40 */  jal       guTranslateF
/* 104620 802E2DA0 26730004 */   addiu    $s3, $s3, 0x4
/* 104624 802E2DA4 27A40018 */  addiu     $a0, $sp, 0x18
/* 104628 802E2DA8 02A0282D */  daddu     $a1, $s5, $zero
/* 10462C 802E2DAC 0C019D80 */  jal       guMtxCatF
/* 104630 802E2DB0 02A0302D */   daddu    $a2, $s5, $zero
/* 104634 802E2DB4 02A0202D */  daddu     $a0, $s5, $zero
/* 104638 802E2DB8 3C058007 */  lui       $a1, %hi(gMatrixListPos)
/* 10463C 802E2DBC 94A541F0 */  lhu       $a1, %lo(gMatrixListPos)($a1)
/* 104640 802E2DC0 3C02800A */  lui       $v0, %hi(gDisplayContext)
/* 104644 802E2DC4 8C42A674 */  lw        $v0, %lo(gDisplayContext)($v0)
/* 104648 802E2DC8 8FA80124 */  lw        $t0, 0x124($sp)
/* 10464C 802E2DCC 00052980 */  sll       $a1, $a1, 6
/* 104650 802E2DD0 00A82821 */  addu      $a1, $a1, $t0
/* 104654 802E2DD4 0C019D40 */  jal       guMtxF2L
/* 104658 802E2DD8 00452821 */   addu     $a1, $v0, $a1
/* 10465C 802E2DDC 3C05D838 */  lui       $a1, (0xD8380002 >> 16)
/* 104660 802E2DE0 34A50002 */  ori       $a1, $a1, (0xD8380002 & 0xFFFF)
/* 104664 802E2DE4 3C028007 */  lui       $v0, %hi(gMatrixListPos)
/* 104668 802E2DE8 944241F0 */  lhu       $v0, %lo(gMatrixListPos)($v0)
/* 10466C 802E2DEC 3C03DA38 */  lui       $v1, (0xDA380000 >> 16)
/* 104670 802E2DF0 AE23FFFC */  sw        $v1, -0x4($s1)
/* 104674 802E2DF4 8FA80124 */  lw        $t0, 0x124($sp)
/* 104678 802E2DF8 24430001 */  addiu     $v1, $v0, 0x1
/* 10467C 802E2DFC 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 104680 802E2E00 00021180 */  sll       $v0, $v0, 6
/* 104684 802E2E04 3C018007 */  lui       $at, %hi(gMatrixListPos)
/* 104688 802E2E08 A42341F0 */  sh        $v1, %lo(gMatrixListPos)($at)
/* 10468C 802E2E0C 3C03800A */  lui       $v1, %hi(gDisplayContext)
/* 104690 802E2E10 8C63A674 */  lw        $v1, %lo(gDisplayContext)($v1)
/* 104694 802E2E14 00481021 */  addu      $v0, $v0, $t0
/* 104698 802E2E18 00621821 */  addu      $v1, $v1, $v0
/* 10469C 802E2E1C AE230000 */  sw        $v1, 0x0($s1)
/* 1046A0 802E2E20 97C40002 */  lhu       $a0, 0x2($fp)
/* 1046A4 802E2E24 27DE0004 */  addiu     $fp, $fp, 0x4
/* 1046A8 802E2E28 8FA8011C */  lw        $t0, 0x11C($sp)
/* 1046AC 802E2E2C 26310008 */  addiu     $s1, $s1, 0x8
/* 1046B0 802E2E30 8D030044 */  lw        $v1, 0x44($t0)
/* 1046B4 802E2E34 3C02DE00 */  lui       $v0, (0xDE000000 >> 16)
/* 1046B8 802E2E38 AE22FFFC */  sw        $v0, -0x4($s1)
/* 1046BC 802E2E3C 24020040 */  addiu     $v0, $zero, 0x40
/* 1046C0 802E2E40 00641821 */  addu      $v1, $v1, $a0
/* 1046C4 802E2E44 AE230000 */  sw        $v1, 0x0($s1)
/* 1046C8 802E2E48 26310008 */  addiu     $s1, $s1, 0x8
/* 1046CC 802E2E4C AE220000 */  sw        $v0, 0x0($s1)
/* 1046D0 802E2E50 2AE20018 */  slti      $v0, $s7, 0x18
/* 1046D4 802E2E54 1440FF82 */  bnez      $v0, .L802E2C60
/* 1046D8 802E2E58 AE25FFFC */   sw       $a1, -0x4($s1)
/* 1046DC 802E2E5C 8FBF014C */  lw        $ra, 0x14C($sp)
/* 1046E0 802E2E60 8FBE0148 */  lw        $fp, 0x148($sp)
/* 1046E4 802E2E64 8FB70144 */  lw        $s7, 0x144($sp)
/* 1046E8 802E2E68 8FB60140 */  lw        $s6, 0x140($sp)
/* 1046EC 802E2E6C 8FB5013C */  lw        $s5, 0x13C($sp)
/* 1046F0 802E2E70 8FB40138 */  lw        $s4, 0x138($sp)
/* 1046F4 802E2E74 8FB30134 */  lw        $s3, 0x134($sp)
/* 1046F8 802E2E78 3C01800A */  lui       $at, %hi(gMainGfxPos)
/* 1046FC 802E2E7C AC32A66C */  sw        $s2, %lo(gMainGfxPos)($at)
/* 104700 802E2E80 8FB20130 */  lw        $s2, 0x130($sp)
/* 104704 802E2E84 8FB1012C */  lw        $s1, 0x12C($sp)
/* 104708 802E2E88 8FB00128 */  lw        $s0, 0x128($sp)
/* 10470C 802E2E8C D7BE0178 */  ldc1      $f30, 0x178($sp)
/* 104710 802E2E90 D7BC0170 */  ldc1      $f28, 0x170($sp)
/* 104714 802E2E94 D7BA0168 */  ldc1      $f26, 0x168($sp)
/* 104718 802E2E98 D7B80160 */  ldc1      $f24, 0x160($sp)
/* 10471C 802E2E9C D7B60158 */  ldc1      $f22, 0x158($sp)
/* 104720 802E2EA0 D7B40150 */  ldc1      $f20, 0x150($sp)
/* 104724 802E2EA4 03E00008 */  jr        $ra
/* 104728 802E2EA8 27BD0180 */   addiu    $sp, $sp, 0x180
/* 10472C 802E2EAC 00000000 */  nop

### DECOMPILED C INSTRUCTIONS:

void entity_shattering_setupGfx(s32 entityIndex) {
    s32 i;
    Matrix4f mtxTransInv;
    Matrix4f mtx;
    Matrix4f mtxRotX;
    Matrix4f mtxRotY;
    f32 x_inv;
    f32 y_inv;
    f32 z_inv;
    Gfx* gfxPos = gMainGfxPos;
    Entity* entity = get_entity_by_index(entityIndex);
    ShatteringBlockData* data = entity->dataBuf.shatteringBlock;
    Gfx* fragmentDlist;
    Gfx** gfx = data->fragmentDisplayLists;

    x_inv = -entity->position.x;
    y_inv = -entity->position.y;
    z_inv = -entity->position.z;

    for (i = 0; i < 24; i++) {
        if (data->alpha == 255) {
            gDPSetRenderMode(gfxPos++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
            gDPSetCombineMode(gfxPos++, G_CC_MODULATEIA, G_CC_MODULATEIA);
        } else {
            gDPSetCombineMode(gfxPos++, PM_CC_11, PM_CC_12);
            gDPSetPrimColor(gfxPos++, 0, 0, 0, 0, 0, data->alpha);
        }

        guTranslateF(mtxTransInv, x_inv, y_inv, z_inv);
        guRotateF(mtxRotX, data->fragmentRotX[i] * 360.0f / 256, 1.0f, 0.0f, 0.0f);
        guRotateF(mtxRotY, data->fragmentRotY[i] * 360.0f / 256, 0.0f, 1.0f, 0.0f);
        guMtxCatF(mtxRotX, mtxRotY, mtxRotY);
        guMtxCatF(mtxRotY, mtxTransInv, mtxTransInv);
        guTranslateF(mtx, data->fragmentPosX[i], data->fragmentPosY[i], data->fragmentPosZ[i]);
        guMtxCatF(mtxTransInv, mtx, mtx);
        guMtxF2L(mtx, &gDisplayContext->matrixStack[gMatrixListPos]);

        gSPMatrix(gfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
        fragmentDlist = ENTITY_ADDR(entity, Gfx*, *gfx++);
        gSPDisplayList(gfxPos++, fragmentDlist);
        gSPPopMatrix(gfxPos++, G_MTX_MODELVIEW);
    }

    gMainGfxPos = gfxPos;
}


### RAW ASSEMBLY INSTRUCTIONS:

glabel entity_SaveBlock_setupGfx
/* 102660 802E0DE0 27BDFF28 */  addiu     $sp, $sp, -0xD8
/* 102664 802E0DE4 AFB000A8 */  sw        $s0, 0xA8($sp)
/* 102668 802E0DE8 3C10800A */  lui       $s0, %hi(gMainGfxPos)
/* 10266C 802E0DEC 8E10A66C */  lw        $s0, %lo(gMainGfxPos)($s0)
/* 102670 802E0DF0 AFBF00CC */  sw        $ra, 0xCC($sp)
/* 102674 802E0DF4 AFBE00C8 */  sw        $fp, 0xC8($sp)
/* 102678 802E0DF8 AFB700C4 */  sw        $s7, 0xC4($sp)
/* 10267C 802E0DFC AFB600C0 */  sw        $s6, 0xC0($sp)
/* 102680 802E0E00 AFB500BC */  sw        $s5, 0xBC($sp)
/* 102684 802E0E04 AFB400B8 */  sw        $s4, 0xB8($sp)
/* 102688 802E0E08 AFB300B4 */  sw        $s3, 0xB4($sp)
/* 10268C 802E0E0C AFB200B0 */  sw        $s2, 0xB0($sp)
/* 102690 802E0E10 AFB100AC */  sw        $s1, 0xAC($sp)
/* 102694 802E0E14 F7B400D0 */  sdc1      $f20, 0xD0($sp)
/* 102698 802E0E18 0C04417A */  jal       get_entity_by_index
/* 10269C 802E0E1C 3C170001 */   lui      $s7, (0x11630 >> 16)
/* 1026A0 802E0E20 27A40018 */  addiu     $a0, $sp, 0x18
/* 1026A4 802E0E24 36F71630 */  ori       $s7, $s7, (0x11630 & 0xFFFF)
/* 1026A8 802E0E28 3C0DE200 */  lui       $t5, (0xE200001C >> 16)
/* 1026AC 802E0E2C 35AD001C */  ori       $t5, $t5, (0xE200001C & 0xFFFF)
/* 1026B0 802E0E30 AFAD0098 */  sw        $t5, 0x98($sp)
/* 1026B4 802E0E34 3C0DFCFF */  lui       $t5, (0xFCFFB3FF >> 16)
/* 1026B8 802E0E38 35ADB3FF */  ori       $t5, $t5, (0xFCFFB3FF & 0xFFFF)
/* 1026BC 802E0E3C AFAD009C */  sw        $t5, 0x9C($sp)
/* 1026C0 802E0E40 3C0DFF2C */  lui       $t5, (0xFF2CFE7F >> 16)
/* 1026C4 802E0E44 35ADFE7F */  ori       $t5, $t5, (0xFF2CFE7F & 0xFFFF)
/* 1026C8 802E0E48 AFAD00A0 */  sw        $t5, 0xA0($sp)
/* 1026CC 802E0E4C 3C0DD838 */  lui       $t5, (0xD8380000 >> 16)
/* 1026D0 802E0E50 0040B02D */  daddu     $s6, $v0, $zero
/* 1026D4 802E0E54 3C140A00 */  lui       $s4, %hi(D_0A003260_E94AF0)
/* 1026D8 802E0E58 26943260 */  addiu     $s4, $s4, %lo(D_0A003260_E94AF0)
/* 1026DC 802E0E5C 3294FFFF */  andi      $s4, $s4, 0xFFFF
/* 1026E0 802E0E60 AFAD00A4 */  sw        $t5, 0xA4($sp)
/* 1026E4 802E0E64 8EC50044 */  lw        $a1, 0x44($s6)
/* 1026E8 802E0E68 8ED20040 */  lw        $s2, 0x40($s6)
/* 1026EC 802E0E6C 0C019D60 */  jal       guMtxL2F
/* 1026F0 802E0E70 00B42821 */   addu     $a1, $a1, $s4
/* 1026F4 802E0E74 27B10058 */  addiu     $s1, $sp, 0x58
/* 1026F8 802E0E78 C7A0004C */  lwc1      $f0, 0x4C($sp)
/* 1026FC 802E0E7C 3C014148 */  lui       $at, (0x41480000 >> 16)
/* 102700 802E0E80 4481A000 */  mtc1      $at, $f20
/* 102704 802E0E84 44801000 */  mtc1      $zero, $f2
/* 102708 802E0E88 8FAD00A4 */  lw        $t5, 0xA4($sp)
/* 10270C 802E0E8C 3C073F80 */  lui       $a3, (0x3F800000 >> 16)
/* 102710 802E0E90 46140000 */  add.s     $f0, $f0, $f20
/* 102714 802E0E94 35AD0002 */  ori       $t5, $t5, 0x2
/* 102718 802E0E98 AFAD00A4 */  sw        $t5, 0xA4($sp)
/* 10271C 802E0E9C E7A0004C */  swc1      $f0, 0x4C($sp)
/* 102720 802E0EA0 86420004 */  lh        $v0, 0x4($s2)
/* 102724 802E0EA4 44061000 */  mfc1      $a2, $f2
/* 102728 802E0EA8 44822000 */  mtc1      $v0, $f4
/* 10272C 802E0EAC 00000000 */  nop
/* 102730 802E0EB0 46802120 */  cvt.s.w   $f4, $f4
/* 102734 802E0EB4 44052000 */  mfc1      $a1, $f4
/* 102738 802E0EB8 0220202D */  daddu     $a0, $s1, $zero
/* 10273C 802E0EBC 0C019EC8 */  jal       guRotateF
/* 102740 802E0EC0 AFA60010 */   sw       $a2, 0x10($sp)
/* 102744 802E0EC4 0220202D */  daddu     $a0, $s1, $zero
/* 102748 802E0EC8 27A50018 */  addiu     $a1, $sp, 0x18
/* 10274C 802E0ECC 0C019D80 */  jal       guMtxCatF
/* 102750 802E0ED0 0220302D */   daddu    $a2, $s1, $zero
/* 102754 802E0ED4 0220202D */  daddu     $a0, $s1, $zero
/* 102758 802E0ED8 3C138007 */  lui       $s3, %hi(gMatrixListPos)
/* 10275C 802E0EDC 267341F0 */  addiu     $s3, $s3, %lo(gMatrixListPos)
/* 102760 802E0EE0 3C15800A */  lui       $s5, %hi(gDisplayContext)
/* 102764 802E0EE4 26B5A674 */  addiu     $s5, $s5, %lo(gDisplayContext)
/* 102768 802E0EE8 96650000 */  lhu       $a1, 0x0($s3)
/* 10276C 802E0EEC 8EA20000 */  lw        $v0, 0x0($s5)
/* 102770 802E0EF0 00052980 */  sll       $a1, $a1, 6
/* 102774 802E0EF4 00B72821 */  addu      $a1, $a1, $s7
/* 102778 802E0EF8 0C019D40 */  jal       guMtxF2L
/* 10277C 802E0EFC 00452821 */   addu     $a1, $v0, $a1
/* 102780 802E0F00 0200382D */  daddu     $a3, $s0, $zero
/* 102784 802E0F04 26100008 */  addiu     $s0, $s0, 0x8
/* 102788 802E0F08 0200402D */  daddu     $t0, $s0, $zero
/* 10278C 802E0F0C 26100008 */  addiu     $s0, $s0, 0x8
/* 102790 802E0F10 3C0C0050 */  lui       $t4, (0x504B50 >> 16)
/* 102794 802E0F14 358C4B50 */  ori       $t4, $t4, (0x504B50 & 0xFFFF)
/* 102798 802E0F18 0200302D */  daddu     $a2, $s0, $zero
/* 10279C 802E0F1C 26100008 */  addiu     $s0, $s0, 0x8
/* 1027A0 802E0F20 0200482D */  daddu     $t1, $s0, $zero
/* 1027A4 802E0F24 26100008 */  addiu     $s0, $s0, 0x8
/* 1027A8 802E0F28 0200502D */  daddu     $t2, $s0, $zero
/* 1027AC 802E0F2C 26100008 */  addiu     $s0, $s0, 0x8
/* 1027B0 802E0F30 0200582D */  daddu     $t3, $s0, $zero
/* 1027B4 802E0F34 26100008 */  addiu     $s0, $s0, 0x8
/* 1027B8 802E0F38 0220202D */  daddu     $a0, $s1, $zero
/* 1027BC 802E0F3C 96650000 */  lhu       $a1, 0x0($s3)
/* 1027C0 802E0F40 3C0DDA38 */  lui       $t5, (0xDA380000 >> 16)
/* 1027C4 802E0F44 ACED0000 */  sw        $t5, 0x0($a3)
/* 1027C8 802E0F48 8EA30000 */  lw        $v1, 0x0($s5)
/* 1027CC 802E0F4C 30A2FFFF */  andi      $v0, $a1, 0xFFFF
/* 1027D0 802E0F50 00021180 */  sll       $v0, $v0, 6
/* 1027D4 802E0F54 00571021 */  addu      $v0, $v0, $s7
/* 1027D8 802E0F58 00621821 */  addu      $v1, $v1, $v0
/* 1027DC 802E0F5C ACE30004 */  sw        $v1, 0x4($a3)
/* 1027E0 802E0F60 8FAD0098 */  lw        $t5, 0x98($sp)
/* 1027E4 802E0F64 241E0040 */  addiu     $fp, $zero, 0x40
/* 1027E8 802E0F68 AD0C0004 */  sw        $t4, 0x4($t0)
/* 1027EC 802E0F6C AD0D0000 */  sw        $t5, 0x0($t0)
/* 1027F0 802E0F70 8FAD009C */  lw        $t5, 0x9C($sp)
/* 1027F4 802E0F74 3C020A00 */  lui       $v0, %hi(D_0A0034E0_E94D70)
/* 1027F8 802E0F78 244234E0 */  addiu     $v0, $v0, %lo(D_0A0034E0_E94D70)
/* 1027FC 802E0F7C ACCD0000 */  sw        $t5, 0x0($a2)
/* 102800 802E0F80 8FAD00A0 */  lw        $t5, 0xA0($sp)
/* 102804 802E0F84 24A50001 */  addiu     $a1, $a1, 0x1
/* 102808 802E0F88 ACCD0004 */  sw        $t5, 0x4($a2)
/* 10280C 802E0F8C 3C0DFA00 */  lui       $t5, (0xFA000000 >> 16)
/* 102810 802E0F90 AD2D0000 */  sw        $t5, 0x0($t1)
/* 102814 802E0F94 240D0080 */  addiu     $t5, $zero, 0x80
/* 102818 802E0F98 AD2D0004 */  sw        $t5, 0x4($t1)
/* 10281C 802E0F9C 3C0DDE00 */  lui       $t5, (0xDE000000 >> 16)
/* 102820 802E0FA0 AD4D0000 */  sw        $t5, 0x0($t2)
/* 102824 802E0FA4 AD420004 */  sw        $v0, 0x4($t2)
/* 102828 802E0FA8 8FAD00A4 */  lw        $t5, 0xA4($sp)
/* 10282C 802E0FAC 3C020A00 */  lui       $v0, %hi(D_0A0034F0_E94D80)
/* 102830 802E0FB0 244234F0 */  addiu     $v0, $v0, %lo(D_0A0034F0_E94D80)
/* 102834 802E0FB4 AD7E0004 */  sw        $fp, 0x4($t3)
/* 102838 802E0FB8 AD6D0000 */  sw        $t5, 0x0($t3)
/* 10283C 802E0FBC 8ED20044 */  lw        $s2, 0x44($s6)
/* 102840 802E0FC0 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 102844 802E0FC4 A6650000 */  sh        $a1, 0x0($s3)
/* 102848 802E0FC8 02542821 */  addu      $a1, $s2, $s4
/* 10284C 802E0FCC 0C019D60 */  jal       guMtxL2F
/* 102850 802E0FD0 02429021 */   addu     $s2, $s2, $v0
/* 102854 802E0FD4 0200182D */  daddu     $v1, $s0, $zero
/* 102858 802E0FD8 26100008 */  addiu     $s0, $s0, 0x8
/* 10285C 802E0FDC 0220202D */  daddu     $a0, $s1, $zero
/* 102860 802E0FE0 96650000 */  lhu       $a1, 0x0($s3)
/* 102864 802E0FE4 C7A0008C */  lwc1      $f0, 0x8C($sp)
/* 102868 802E0FE8 8EA20000 */  lw        $v0, 0x0($s5)
/* 10286C 802E0FEC 00052980 */  sll       $a1, $a1, 6
/* 102870 802E0FF0 00B72821 */  addu      $a1, $a1, $s7
/* 102874 802E0FF4 46140000 */  add.s     $f0, $f0, $f20
/* 102878 802E0FF8 00452821 */  addu      $a1, $v0, $a1
/* 10287C 802E0FFC 3C02E700 */  lui       $v0, (0xE7000000 >> 16)
/* 102880 802E1000 E7A0008C */  swc1      $f0, 0x8C($sp)
/* 102884 802E1004 AC620000 */  sw        $v0, 0x0($v1)
/* 102888 802E1008 0C019D40 */  jal       guMtxF2L
/* 10288C 802E100C AC600004 */   sw       $zero, 0x4($v1)
/* 102890 802E1010 0200402D */  daddu     $t0, $s0, $zero
/* 102894 802E1014 26100008 */  addiu     $s0, $s0, 0x8
/* 102898 802E1018 0200482D */  daddu     $t1, $s0, $zero
/* 10289C 802E101C 26100008 */  addiu     $s0, $s0, 0x8
/* 1028A0 802E1020 3C0A0050 */  lui       $t2, (0x5041D8 >> 16)
/* 1028A4 802E1024 0200202D */  daddu     $a0, $s0, $zero
/* 1028A8 802E1028 26100008 */  addiu     $s0, $s0, 0x8
/* 1028AC 802E102C 0200282D */  daddu     $a1, $s0, $zero
/* 1028B0 802E1030 26100008 */  addiu     $s0, $s0, 0x8
/* 1028B4 802E1034 0200302D */  daddu     $a2, $s0, $zero
/* 1028B8 802E1038 26100008 */  addiu     $s0, $s0, 0x8
/* 1028BC 802E103C 0200382D */  daddu     $a3, $s0, $zero
/* 1028C0 802E1040 26100008 */  addiu     $s0, $s0, 0x8
/* 1028C4 802E1044 96620000 */  lhu       $v0, 0x0($s3)
/* 1028C8 802E1048 3C0DDA38 */  lui       $t5, (0xDA380000 >> 16)
/* 1028CC 802E104C AD0D0000 */  sw        $t5, 0x0($t0)
/* 1028D0 802E1050 3C01800A */  lui       $at, %hi(gMainGfxPos)
/* 1028D4 802E1054 AC30A66C */  sw        $s0, %lo(gMainGfxPos)($at)
/* 1028D8 802E1058 24430001 */  addiu     $v1, $v0, 0x1
/* 1028DC 802E105C 3042FFFF */  andi      $v0, $v0, 0xFFFF
/* 1028E0 802E1060 00021180 */  sll       $v0, $v0, 6
/* 1028E4 802E1064 A6630000 */  sh        $v1, 0x0($s3)
/* 1028E8 802E1068 8EA30000 */  lw        $v1, 0x0($s5)
/* 1028EC 802E106C 00571021 */  addu      $v0, $v0, $s7
/* 1028F0 802E1070 00621821 */  addu      $v1, $v1, $v0
/* 1028F4 802E1074 AD030004 */  sw        $v1, 0x4($t0)
/* 1028F8 802E1078 8FAD0098 */  lw        $t5, 0x98($sp)
/* 1028FC 802E107C 354A41D8 */  ori       $t2, $t2, (0x5041D8 & 0xFFFF)
/* 102900 802E1080 AD2D0000 */  sw        $t5, 0x0($t1)
/* 102904 802E1084 AD2A0004 */  sw        $t2, 0x4($t1)
/* 102908 802E1088 8FAD009C */  lw        $t5, 0x9C($sp)
/* 10290C 802E108C AC8D0000 */  sw        $t5, 0x0($a0)
/* 102910 802E1090 8FAD00A0 */  lw        $t5, 0xA0($sp)
/* 102914 802E1094 AC8D0004 */  sw        $t5, 0x4($a0)
/* 102918 802E1098 3C0DFA00 */  lui       $t5, (0xFA000000 >> 16)
/* 10291C 802E109C ACAD0000 */  sw        $t5, 0x0($a1)
/* 102920 802E10A0 240D0080 */  addiu     $t5, $zero, 0x80
/* 102924 802E10A4 ACAD0004 */  sw        $t5, 0x4($a1)
/* 102928 802E10A8 3C0DDE00 */  lui       $t5, (0xDE000000 >> 16)
/* 10292C 802E10AC ACCD0000 */  sw        $t5, 0x0($a2)
/* 102930 802E10B0 ACD20004 */  sw        $s2, 0x4($a2)
/* 102934 802E10B4 8FAD00A4 */  lw        $t5, 0xA4($sp)
/* 102938 802E10B8 ACED0000 */  sw        $t5, 0x0($a3)
/* 10293C 802E10BC ACFE0004 */  sw        $fp, 0x4($a3)
/* 102940 802E10C0 8FBF00CC */  lw        $ra, 0xCC($sp)
/* 102944 802E10C4 8FBE00C8 */  lw        $fp, 0xC8($sp)
/* 102948 802E10C8 8FB700C4 */  lw        $s7, 0xC4($sp)
/* 10294C 802E10CC 8FB600C0 */  lw        $s6, 0xC0($sp)
/* 102950 802E10D0 8FB500BC */  lw        $s5, 0xBC($sp)
/* 102954 802E10D4 8FB400B8 */  lw        $s4, 0xB8($sp)
/* 102958 802E10D8 8FB300B4 */  lw        $s3, 0xB4($sp)
/* 10295C 802E10DC 8FB200B0 */  lw        $s2, 0xB0($sp)
/* 102960 802E10E0 8FB100AC */  lw        $s1, 0xAC($sp)
/* 102964 802E10E4 8FB000A8 */  lw        $s0, 0xA8($sp)
/* 102968 802E10E8 D7B400D0 */  ldc1      $f20, 0xD0($sp)
/* 10296C 802E10EC 03E00008 */  jr        $ra
/* 102970 802E10F0 27BD00D8 */   addiu    $sp, $sp, 0xD8

### DECOMPILED C INSTRUCTIONS:

void entity_SaveBlock_setupGfx(s32 index) {
    Gfx* gfxPos = gMainGfxPos;
    Entity* entity = get_entity_by_index(index);
    SaveBlockData* blockData = entity->dataBuf.saveBlock;
    Matrix4f sp18;
    Matrix4f sp58;
    Gfx* dlist;

    guMtxL2F(sp18, ENTITY_ADDR(entity, Mtx*, &Entity_SaveBlock_Mtx));
    sp18[3][1] += 12.5f;
    guRotateF(sp58, blockData->angle, 0.0f, 1.0f, 0.0f);
    guMtxCatF(sp58, sp18, sp58);
    guMtxF2L(sp58, &gDisplayContext->matrixStack[gMatrixListPos]);

    gSPMatrix(gfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
    gDPSetRenderMode(gfxPos++, G_RM_ZB_CLD_SURF, G_RM_ZB_CLD_SURF2);
    gDPSetCombineMode(gfxPos++, PM_CC_01, PM_CC_02);
    gDPSetPrimColor(gfxPos++, 0, 0, 0, 0, 0, 128);
    gSPDisplayList(gfxPos++, Entity_SaveBlock_RenderContent);
    gSPPopMatrix(gfxPos++, G_MTX_MODELVIEW);

    dlist = ENTITY_ADDR(entity, Gfx*, Entity_SaveBlock_RenderBlock);
    guMtxL2F(sp58, ENTITY_ADDR(entity, Mtx*, &Entity_SaveBlock_Mtx));
    sp58[3][1] += 12.5f;
    gDPPipeSync(gfxPos++);
    guMtxF2L(sp58, &gDisplayContext->matrixStack[gMatrixListPos]);

    gSPMatrix(gfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
    gDPSetRenderMode(gfxPos++, G_RM_AA_XLU_SURF | Z_CMP, G_RM_AA_XLU_SURF2 | Z_CMP);
    gDPSetCombineMode(gfxPos++, PM_CC_01, PM_CC_02);
    gDPSetPrimColor(gfxPos++, 0, 0, 0, 0, 0, 128);
    gSPDisplayList(gfxPos++, dlist);
    gSPPopMatrix(gfxPos++, G_MTX_MODELVIEW);

    gMainGfxPos = gfxPos;
}