### RAW ASSEMBLY INSTRUCTIONS:

glabel au_amb_player_update
/* 2C834 80051434 27BDFF90 */  addiu     $sp, $sp, -0x70
/* 2C838 80051438 AFB5005C */  sw        $s5, 0x5C($sp)
/* 2C83C 8005143C 00A0A82D */  daddu     $s5, $a1, $zero
/* 2C840 80051440 AFB00048 */  sw        $s0, 0x48($sp)
/* 2C844 80051444 0000802D */  daddu     $s0, $zero, $zero
/* 2C848 80051448 27A50010 */  addiu     $a1, $sp, 0x10
/* 2C84C 8005144C AFBF006C */  sw        $ra, 0x6C($sp)
/* 2C850 80051450 AFBE0068 */  sw        $fp, 0x68($sp)
/* 2C854 80051454 AFB70064 */  sw        $s7, 0x64($sp)
/* 2C858 80051458 AFB60060 */  sw        $s6, 0x60($sp)
/* 2C85C 8005145C AFB40058 */  sw        $s4, 0x58($sp)
/* 2C860 80051460 AFB30054 */  sw        $s3, 0x54($sp)
/* 2C864 80051464 AFB20050 */  sw        $s2, 0x50($sp)
/* 2C868 80051468 AFB1004C */  sw        $s1, 0x4C($sp)
/* 2C86C 8005146C AFA40070 */  sw        $a0, 0x70($sp)
/* 2C870 80051470 8C880000 */  lw        $t0, 0x0($a0)
/* 2C874 80051474 27A40020 */  addiu     $a0, $sp, 0x20
/* 2C878 80051478 A3A00034 */  sb        $zero, 0x34($sp)
/* 2C87C 8005147C AFA80030 */  sw        $t0, 0x30($sp)
.L80051480:
/* 2C880 80051480 00B01021 */  addu      $v0, $a1, $s0
/* 2C884 80051484 00901821 */  addu      $v1, $a0, $s0
/* 2C888 80051488 26100001 */  addiu     $s0, $s0, 0x1
/* 2C88C 8005148C A0400000 */  sb        $zero, 0x0($v0)
/* 2C890 80051490 2E020010 */  sltiu     $v0, $s0, 0x10
/* 2C894 80051494 1440FFFA */  bnez      $v0, .L80051480
/* 2C898 80051498 A0600000 */   sb       $zero, 0x0($v1)
/* 2C89C 8005149C 92A20043 */  lbu       $v0, 0x43($s5)
/* 2C8A0 800514A0 24100001 */  addiu     $s0, $zero, 0x1
/* 2C8A4 800514A4 14500005 */  bne       $v0, $s0, .L800514BC
/* 2C8A8 800514A8 00000000 */   nop
/* 2C8AC 800514AC 8FA40070 */  lw        $a0, 0x70($sp)
/* 2C8B0 800514B0 0C01487A */  jal       au_amb_player_stop
/* 2C8B4 800514B4 02A0282D */   daddu    $a1, $s5, $zero
/* 2C8B8 800514B8 A2A00043 */  sb        $zero, 0x43($s5)
.L800514BC:
/* 2C8BC 800514BC 96A20040 */  lhu       $v0, 0x40($s5)
/* 2C8C0 800514C0 10400024 */  beqz      $v0, .L80051554
/* 2C8C4 800514C4 0000B02D */   daddu    $s6, $zero, $zero
/* 2C8C8 800514C8 8EA20038 */  lw        $v0, 0x38($s5)
/* 2C8CC 800514CC 8EA4003C */  lw        $a0, 0x3C($s5)
/* 2C8D0 800514D0 96A30040 */  lhu       $v1, 0x40($s5)
/* 2C8D4 800514D4 00441021 */  addu      $v0, $v0, $a0
/* 2C8D8 800514D8 2463FFFF */  addiu     $v1, $v1, -0x1
/* 2C8DC 800514DC A6A30040 */  sh        $v1, 0x40($s5)
/* 2C8E0 800514E0 3063FFFF */  andi      $v1, $v1, 0xFFFF
/* 2C8E4 800514E4 14600018 */  bnez      $v1, .L80051548
/* 2C8E8 800514E8 AEA20038 */   sw       $v0, 0x38($s5)
/* 2C8EC 800514EC 92A20042 */  lbu       $v0, 0x42($s5)
/* 2C8F0 800514F0 92A30026 */  lbu       $v1, 0x26($s5)
/* 2C8F4 800514F4 00021600 */  sll       $v0, $v0, 24
/* 2C8F8 800514F8 10600013 */  beqz      $v1, .L80051548
/* 2C8FC 800514FC AEA20038 */   sw       $v0, 0x38($s5)
/* 2C900 80051500 1470000D */  bne       $v1, $s0, .L80051538
/* 2C904 80051504 24020002 */   addiu    $v0, $zero, 0x2
/* 2C908 80051508 3C028008 */  lui       $v0, %hi(D_80078520)
/* 2C90C 8005150C 24428520 */  addiu     $v0, $v0, %lo(D_80078520)
/* 2C910 80051510 AEA20008 */  sw        $v0, 0x8($s5)
/* 2C914 80051514 08014552 */  j         .L80051548
/* 2C918 80051518 AEA30018 */   sw       $v1, 0x18($s5)
.L8005151C:
/* 2C91C 8005151C 8FA40070 */  lw        $a0, 0x70($sp)
/* 2C920 80051520 02A0282D */  daddu     $a1, $s5, $zero
/* 2C924 80051524 AEA00008 */  sw        $zero, 0x8($s5)
/* 2C928 80051528 0C01487A */  jal       au_amb_player_stop
/* 2C92C 8005152C AEA00020 */   sw       $zero, 0x20($s5)
/* 2C930 80051530 0801482F */  j         .L800520BC
/* 2C934 80051534 00000000 */   nop
.L80051538:
/* 2C938 80051538 14620004 */  bne       $v1, $v0, .L8005154C
/* 2C93C 8005153C 24080001 */   addiu    $t0, $zero, 0x1
/* 2C940 80051540 24020003 */  addiu     $v0, $zero, 0x3
/* 2C944 80051544 A2A20024 */  sb        $v0, 0x24($s5)
.L80051548:
/* 2C948 80051548 24080001 */  addiu     $t0, $zero, 0x1
.L8005154C:
/* 2C94C 8005154C A3A80034 */  sb        $t0, 0x34($sp)
/* 2C950 80051550 0000B02D */  daddu     $s6, $zero, $zero
.L80051554:
/* 2C954 80051554 27A80020 */  addiu     $t0, $sp, 0x20
/* 2C958 80051558 AFA80038 */  sw        $t0, 0x38($sp)
/* 2C95C 8005155C 241E0044 */  addiu     $fp, $zero, 0x44
.L80051560:
/* 2C960 80051560 02BE9821 */  addu      $s3, $s5, $fp
/* 2C964 80051564 86620014 */  lh        $v0, 0x14($s3)
/* 2C968 80051568 96630014 */  lhu       $v1, 0x14($s3)
/* 2C96C 8005156C 10400042 */  beqz      $v0, .L80051678
/* 2C970 80051570 2462FFFF */   addiu    $v0, $v1, -0x1
/* 2C974 80051574 A6620014 */  sh        $v0, 0x14($s3)
/* 2C978 80051578 00021400 */  sll       $v0, $v0, 16
/* 2C97C 8005157C 10400005 */  beqz      $v0, .L80051594
/* 2C980 80051580 00000000 */   nop
/* 2C984 80051584 8E62000C */  lw        $v0, 0xC($s3)
/* 2C988 80051588 8E630010 */  lw        $v1, 0x10($s3)
/* 2C98C 8005158C 08014567 */  j         .L8005159C
/* 2C990 80051590 00431021 */   addu     $v0, $v0, $v1
.L80051594:
/* 2C994 80051594 86620016 */  lh        $v0, 0x16($s3)
/* 2C998 80051598 00021400 */  sll       $v0, $v0, 16
.L8005159C:
/* 2C99C 8005159C AE62000C */  sw        $v0, 0xC($s3)
/* 2C9A0 800515A0 00162400 */  sll       $a0, $s6, 16
/* 2C9A4 800515A4 8EB00030 */  lw        $s0, 0x30($s5)
/* 2C9A8 800515A8 8EA30014 */  lw        $v1, 0x14($s5)
/* 2C9AC 800515AC 8EA20034 */  lw        $v0, 0x34($s5)
/* 2C9B0 800515B0 0202102B */  sltu      $v0, $s0, $v0
/* 2C9B4 800515B4 10400030 */  beqz      $v0, .L80051678
/* 2C9B8 800515B8 0064B821 */   addu     $s7, $v1, $a0
/* 2C9BC 800515BC 001010C0 */  sll       $v0, $s0, 3
/* 2C9C0 800515C0 00501021 */  addu      $v0, $v0, $s0
/* 2C9C4 800515C4 000210C0 */  sll       $v0, $v0, 3
/* 2C9C8 800515C8 24541320 */  addiu     $s4, $v0, 0x1320
.L800515CC:
/* 2C9CC 800515CC 8EA20030 */  lw        $v0, 0x30($s5)
/* 2C9D0 800515D0 8FA80070 */  lw        $t0, 0x70($sp)
/* 2C9D4 800515D4 02021023 */  subu      $v0, $s0, $v0
/* 2C9D8 800515D8 000210C0 */  sll       $v0, $v0, 3
/* 2C9DC 800515DC 244207B4 */  addiu     $v0, $v0, 0x7B4
/* 2C9E0 800515E0 01029021 */  addu      $s2, $t0, $v0
/* 2C9E4 800515E4 8E420000 */  lw        $v0, 0x0($s2)
/* 2C9E8 800515E8 3C08FFFF */  lui       $t0, (0xFFFF0000 >> 16)
/* 2C9EC 800515EC 00481024 */  and       $v0, $v0, $t0
/* 2C9F0 800515F0 1457001C */  bne       $v0, $s7, .L80051664
/* 2C9F4 800515F4 00000000 */   nop
/* 2C9F8 800515F8 8FA80030 */  lw        $t0, 0x30($sp)
/* 2C9FC 800515FC 01148821 */  addu      $s1, $t0, $s4
/* 2CA00 80051600 8FA80070 */  lw        $t0, 0x70($sp)
/* 2CA04 80051604 92230045 */  lbu       $v1, 0x45($s1)
/* 2CA08 80051608 91020022 */  lbu       $v0, 0x22($t0)
/* 2CA0C 8005160C 14620015 */  bne       $v1, $v0, .L80051664
/* 2CA10 80051610 24080009 */   addiu    $t0, $zero, 0x9
/* 2CA14 80051614 12C80013 */  beq       $s6, $t0, .L80051664
/* 2CA18 80051618 00000000 */   nop
/* 2CA1C 8005161C 86420004 */  lh        $v0, 0x4($s2)
/* 2CA20 80051620 8664000C */  lh        $a0, 0xC($s3)
/* 2CA24 80051624 0C014E3E */  jal       au_compute_pitch_ratio
/* 2CA28 80051628 00442021 */   addu     $a0, $v0, $a0
/* 2CA2C 8005162C 8E620000 */  lw        $v0, 0x0($s3)
/* 2CA30 80051630 C4420020 */  lwc1      $f2, 0x20($v0)
/* 2CA34 80051634 46020002 */  mul.s     $f0, $f0, $f2
/* 2CA38 80051638 00000000 */  nop
/* 2CA3C 8005163C 92220043 */  lbu       $v0, 0x43($s1)
/* 2CA40 80051640 34420008 */  ori       $v0, $v0, 0x8
/* 2CA44 80051644 A2220043 */  sb        $v0, 0x43($s1)
/* 2CA48 80051648 E6200004 */  swc1      $f0, 0x4($s1)
/* 2CA4C 8005164C 8EA20030 */  lw        $v0, 0x30($s5)
/* 2CA50 80051650 8FA80038 */  lw        $t0, 0x38($sp)
/* 2CA54 80051654 02021023 */  subu      $v0, $s0, $v0
/* 2CA58 80051658 01021021 */  addu      $v0, $t0, $v0
/* 2CA5C 8005165C 24080001 */  addiu     $t0, $zero, 0x1
/* 2CA60 80051660 A0480000 */  sb        $t0, 0x0($v0)
.L80051664:
/* 2CA64 80051664 8EA20034 */  lw        $v0, 0x34($s5)
/* 2CA68 80051668 26100001 */  addiu     $s0, $s0, 0x1
/* 2CA6C 8005166C 0202102B */  sltu      $v0, $s0, $v0
/* 2CA70 80051670 1440FFD6 */  bnez      $v0, .L800515CC
/* 2CA74 80051674 26940048 */   addiu    $s4, $s4, 0x48
.L80051678:
/* 2CA78 80051678 26D60001 */  addiu     $s6, $s6, 0x1
/* 2CA7C 8005167C 2EC2000A */  sltiu     $v0, $s6, 0xA
/* 2CA80 80051680 1440FFB7 */  bnez      $v0, .L80051560
/* 2CA84 80051684 27DE0028 */   addiu    $fp, $fp, 0x28
/* 2CA88 80051688 0000B02D */  daddu     $s6, $zero, $zero
/* 2CA8C 8005168C 3C06FFFF */  lui       $a2, (0xFFFF0000 >> 16)
/* 2CA90 80051690 24050044 */  addiu     $a1, $zero, 0x44
.L80051694:
/* 2CA94 80051694 02A59821 */  addu      $s3, $s5, $a1
/* 2CA98 80051698 86620020 */  lh        $v0, 0x20($s3)
/* 2CA9C 8005169C 96630020 */  lhu       $v1, 0x20($s3)
/* 2CAA0 800516A0 1040003F */  beqz      $v0, .L800517A0
/* 2CAA4 800516A4 2462FFFF */   addiu    $v0, $v1, -0x1
/* 2CAA8 800516A8 A6620020 */  sh        $v0, 0x20($s3)
/* 2CAAC 800516AC 00021400 */  sll       $v0, $v0, 16
/* 2CAB0 800516B0 10400005 */  beqz      $v0, .L800516C8
/* 2CAB4 800516B4 00000000 */   nop
/* 2CAB8 800516B8 8E620018 */  lw        $v0, 0x18($s3)
/* 2CABC 800516BC 8E63001C */  lw        $v1, 0x1C($s3)
/* 2CAC0 800516C0 080145B4 */  j         .L800516D0
/* 2CAC4 800516C4 00431021 */   addu     $v0, $v0, $v1
.L800516C8:
/* 2CAC8 800516C8 86620022 */  lh        $v0, 0x22($s3)
/* 2CACC 800516CC 00021400 */  sll       $v0, $v0, 16
.L800516D0:
/* 2CAD0 800516D0 AE620018 */  sw        $v0, 0x18($s3)
/* 2CAD4 800516D4 00162400 */  sll       $a0, $s6, 16
/* 2CAD8 800516D8 8EB00030 */  lw        $s0, 0x30($s5)
/* 2CADC 800516DC 8EA30014 */  lw        $v1, 0x14($s5)
/* 2CAE0 800516E0 8EA20034 */  lw        $v0, 0x34($s5)
/* 2CAE4 800516E4 0202102B */  sltu      $v0, $s0, $v0
/* 2CAE8 800516E8 1040002D */  beqz      $v0, .L800517A0
/* 2CAEC 800516EC 0064B821 */   addu     $s7, $v1, $a0
/* 2CAF0 800516F0 001010C0 */  sll       $v0, $s0, 3
/* 2CAF4 800516F4 00501021 */  addu      $v0, $v0, $s0
/* 2CAF8 800516F8 000210C0 */  sll       $v0, $v0, 3
/* 2CAFC 800516FC 24441320 */  addiu     $a0, $v0, 0x1320
.L80051700:
/* 2CB00 80051700 8EA20030 */  lw        $v0, 0x30($s5)
/* 2CB04 80051704 8FA80070 */  lw        $t0, 0x70($sp)
/* 2CB08 80051708 02021023 */  subu      $v0, $s0, $v0
/* 2CB0C 8005170C 000210C0 */  sll       $v0, $v0, 3
/* 2CB10 80051710 244207B4 */  addiu     $v0, $v0, 0x7B4
/* 2CB14 80051714 01029021 */  addu      $s2, $t0, $v0
/* 2CB18 80051718 8E420000 */  lw        $v0, 0x0($s2)
/* 2CB1C 8005171C 00461024 */  and       $v0, $v0, $a2
/* 2CB20 80051720 1457001A */  bne       $v0, $s7, .L8005178C
/* 2CB24 80051724 00000000 */   nop
/* 2CB28 80051728 8FA80030 */  lw        $t0, 0x30($sp)
/* 2CB2C 8005172C 01048821 */  addu      $s1, $t0, $a0
/* 2CB30 80051730 8FA80070 */  lw        $t0, 0x70($sp)
/* 2CB34 80051734 92230045 */  lbu       $v1, 0x45($s1)
/* 2CB38 80051738 91020022 */  lbu       $v0, 0x22($t0)
/* 2CB3C 8005173C 14620013 */  bne       $v1, $v0, .L8005178C
/* 2CB40 80051740 00000000 */   nop
/* 2CB44 80051744 92430001 */  lbu       $v1, 0x1($s2)
/* 2CB48 80051748 00031080 */  sll       $v0, $v1, 2
/* 2CB4C 8005174C 00431021 */  addu      $v0, $v0, $v1
/* 2CB50 80051750 000210C0 */  sll       $v0, $v0, 3
/* 2CB54 80051754 00559821 */  addu      $s3, $v0, $s5
/* 2CB58 80051758 82A30038 */  lb        $v1, 0x38($s5)
/* 2CB5C 8005175C 8662005C */  lh        $v0, 0x5C($s3)
/* 2CB60 80051760 00620018 */  mult      $v1, $v0
/* 2CB64 80051764 00004012 */  mflo      $t0
/* 2CB68 80051768 82420006 */  lb        $v0, 0x6($s2)
/* 2CB6C 8005176C 00000000 */  nop
/* 2CB70 80051770 01020018 */  mult      $t0, $v0
/* 2CB74 80051774 9222003D */  lbu       $v0, 0x3D($s1)
/* 2CB78 80051778 34420020 */  ori       $v0, $v0, 0x20
/* 2CB7C 8005177C A222003D */  sb        $v0, 0x3D($s1)
/* 2CB80 80051780 00004012 */  mflo      $t0
/* 2CB84 80051784 00081383 */  sra       $v0, $t0, 14
/* 2CB88 80051788 A6220040 */  sh        $v0, 0x40($s1)
.L8005178C:
/* 2CB8C 8005178C 8EA20034 */  lw        $v0, 0x34($s5)
/* 2CB90 80051790 26100001 */  addiu     $s0, $s0, 0x1
/* 2CB94 80051794 0202102B */  sltu      $v0, $s0, $v0
/* 2CB98 80051798 1440FFD9 */  bnez      $v0, .L80051700
/* 2CB9C 8005179C 24840048 */   addiu    $a0, $a0, 0x48
.L800517A0:
/* 2CBA0 800517A0 26D60001 */  addiu     $s6, $s6, 0x1
/* 2CBA4 800517A4 2EC2000A */  sltiu     $v0, $s6, 0xA
/* 2CBA8 800517A8 1440FFBA */  bnez      $v0, .L80051694
/* 2CBAC 800517AC 24A50028 */   addiu    $a1, $a1, 0x28
/* 2CBB0 800517B0 8EA20018 */  lw        $v0, 0x18($s5)
/* 2CBB4 800517B4 2442FFFF */  addiu     $v0, $v0, -0x1
/* 2CBB8 800517B8 1C400240 */  bgtz      $v0, .L800520BC
/* 2CBBC 800517BC AEA20018 */   sw       $v0, 0x18($s5)
/* 2CBC0 800517C0 1440023E */  bnez      $v0, .L800520BC
/* 2CBC4 800517C4 00000000 */   nop
/* 2CBC8 800517C8 241E0001 */  addiu     $fp, $zero, 0x1
/* 2CBCC 800517CC 27A80010 */  addiu     $t0, $sp, 0x10
/* 2CBD0 800517D0 AFA80040 */  sw        $t0, 0x40($sp)
/* 2CBD4 800517D4 27A80020 */  addiu     $t0, $sp, 0x20
/* 2CBD8 800517D8 AFA8003C */  sw        $t0, 0x3C($sp)
.L800517DC:
/* 2CBDC 800517DC 0C014874 */  jal       au_amb_read_next
/* 2CBE0 800517E0 02A0202D */   daddu    $a0, $s5, $zero
/* 2CBE4 800517E4 0040802D */  daddu     $s0, $v0, $zero
/* 2CBE8 800517E8 00101600 */  sll       $v0, $s0, 24
/* 2CBEC 800517EC 0440000E */  bltz      $v0, .L80051828
/* 2CBF0 800517F0 320300FF */   andi     $v1, $s0, 0xFF
/* 2CBF4 800517F4 1060FF49 */  beqz      $v1, .L8005151C
/* 2CBF8 800517F8 2C620078 */   sltiu    $v0, $v1, 0x78
/* 2CBFC 800517FC 5440022C */  bnel      $v0, $zero, .L800520B0
/* 2CC00 80051800 AEA30018 */   sw       $v1, 0x18($s5)
/* 2CC04 80051804 0C014874 */  jal       au_amb_read_next
/* 2CC08 80051808 02A0202D */   daddu    $a0, $s5, $zero
/* 2CC0C 8005180C 32030007 */  andi      $v1, $s0, 0x7
/* 2CC10 80051810 00031A00 */  sll       $v1, $v1, 8
/* 2CC14 80051814 304200FF */  andi      $v0, $v0, 0xFF
/* 2CC18 80051818 00621821 */  addu      $v1, $v1, $v0
/* 2CC1C 8005181C 24630078 */  addiu     $v1, $v1, 0x78
/* 2CC20 80051820 0801482C */  j         .L800520B0
/* 2CC24 80051824 AEA30018 */   sw       $v1, 0x18($s5)
.L80051828:
/* 2CC28 80051828 0C014874 */  jal       au_amb_read_next
/* 2CC2C 8005182C 02A0202D */   daddu    $a0, $s5, $zero
/* 2CC30 80051830 3216000F */  andi      $s6, $s0, 0xF
/* 2CC34 80051834 00161880 */  sll       $v1, $s6, 2
/* 2CC38 80051838 00761821 */  addu      $v1, $v1, $s6
/* 2CC3C 8005183C 000318C0 */  sll       $v1, $v1, 3
/* 2CC40 80051840 24630044 */  addiu     $v1, $v1, 0x44
/* 2CC44 80051844 02A39821 */  addu      $s3, $s5, $v1
/* 2CC48 80051848 0040B82D */  daddu     $s7, $v0, $zero
/* 2CC4C 8005184C 320300F0 */  andi      $v1, $s0, 0xF0
/* 2CC50 80051850 240200B0 */  addiu     $v0, $zero, 0xB0
/* 2CC54 80051854 1062018E */  beq       $v1, $v0, .L80051E90
/* 2CC58 80051858 286200B1 */   slti     $v0, $v1, 0xB1
/* 2CC5C 8005185C 1040000E */  beqz      $v0, .L80051898
/* 2CC60 80051860 24020090 */   addiu    $v0, $zero, 0x90
/* 2CC64 80051864 10620047 */  beq       $v1, $v0, .L80051984
/* 2CC68 80051868 28620091 */   slti     $v0, $v1, 0x91
/* 2CC6C 8005186C 10400005 */  beqz      $v0, .L80051884
/* 2CC70 80051870 24020080 */   addiu    $v0, $zero, 0x80
/* 2CC74 80051874 10620011 */  beq       $v1, $v0, .L800518BC
/* 2CC78 80051878 00000000 */   nop
/* 2CC7C 8005187C 0801482C */  j         .L800520B0
/* 2CC80 80051880 00000000 */   nop
.L80051884:
/* 2CC84 80051884 240200A0 */  addiu     $v0, $zero, 0xA0
/* 2CC88 80051888 10620111 */  beq       $v1, $v0, .L80051CD0
/* 2CC8C 8005188C 32E20080 */   andi     $v0, $s7, 0x80
/* 2CC90 80051890 0801482C */  j         .L800520B0
/* 2CC94 80051894 00000000 */   nop
.L80051898:
/* 2CC98 80051898 240200E0 */  addiu     $v0, $zero, 0xE0
/* 2CC9C 8005189C 106201C8 */  beq       $v1, $v0, .L80051FC0
/* 2CCA0 800518A0 286200E1 */   slti     $v0, $v1, 0xE1
/* 2CCA4 800518A4 10400202 */  beqz      $v0, .L800520B0
/* 2CCA8 800518A8 240200C0 */   addiu    $v0, $zero, 0xC0
/* 2CCAC 800518AC 106201B7 */  beq       $v1, $v0, .L80051F8C
/* 2CCB0 800518B0 00000000 */   nop
/* 2CCB4 800518B4 0801482C */  j         .L800520B0
/* 2CCB8 800518B8 00000000 */   nop
.L800518BC:
/* 2CCBC 800518BC 92A20025 */  lbu       $v0, 0x25($s5)
/* 2CCC0 800518C0 144001FB */  bnez      $v0, .L800520B0
/* 2CCC4 800518C4 00161400 */   sll      $v0, $s6, 16
/* 2CCC8 800518C8 8EB00030 */  lw        $s0, 0x30($s5)
/* 2CCCC 800518CC 8EA40014 */  lw        $a0, 0x14($s5)
/* 2CCD0 800518D0 8EA30034 */  lw        $v1, 0x34($s5)
/* 2CCD4 800518D4 00822021 */  addu      $a0, $a0, $v0
/* 2CCD8 800518D8 32E200FF */  andi      $v0, $s7, 0xFF
/* 2CCDC 800518DC 00021200 */  sll       $v0, $v0, 8
/* 2CCE0 800518E0 0203182B */  sltu      $v1, $s0, $v1
/* 2CCE4 800518E4 106001F2 */  beqz      $v1, .L800520B0
/* 2CCE8 800518E8 0082B821 */   addu     $s7, $a0, $v0
/* 2CCEC 800518EC 001010C0 */  sll       $v0, $s0, 3
/* 2CCF0 800518F0 00501021 */  addu      $v0, $v0, $s0
/* 2CCF4 800518F4 000210C0 */  sll       $v0, $v0, 3
/* 2CCF8 800518F8 24441320 */  addiu     $a0, $v0, 0x1320
.L800518FC:
/* 2CCFC 800518FC 8EA20030 */  lw        $v0, 0x30($s5)
/* 2CD00 80051900 8FA80070 */  lw        $t0, 0x70($sp)
/* 2CD04 80051904 02021023 */  subu      $v0, $s0, $v0
/* 2CD08 80051908 000210C0 */  sll       $v0, $v0, 3
/* 2CD0C 8005190C 01021821 */  addu      $v1, $t0, $v0
/* 2CD10 80051910 8C6207B4 */  lw        $v0, 0x7B4($v1)
/* 2CD14 80051914 1457000C */  bne       $v0, $s7, .L80051948
/* 2CD18 80051918 00000000 */   nop
/* 2CD1C 8005191C 8FA80030 */  lw        $t0, 0x30($sp)
/* 2CD20 80051920 A07E07B7 */  sb        $fp, 0x7B7($v1)
/* 2CD24 80051924 01048821 */  addu      $s1, $t0, $a0
/* 2CD28 80051928 8FA80070 */  lw        $t0, 0x70($sp)
/* 2CD2C 8005192C 92230045 */  lbu       $v1, 0x45($s1)
/* 2CD30 80051930 91020022 */  lbu       $v0, 0x22($t0)
/* 2CD34 80051934 14620004 */  bne       $v1, $v0, .L80051948
/* 2CD38 80051938 00000000 */   nop
/* 2CD3C 8005193C 9222003D */  lbu       $v0, 0x3D($s1)
/* 2CD40 80051940 34420010 */  ori       $v0, $v0, 0x10
/* 2CD44 80051944 A222003D */  sb        $v0, 0x3D($s1)
.L80051948:
/* 2CD48 80051948 8EA20034 */  lw        $v0, 0x34($s5)
/* 2CD4C 8005194C 26100001 */  addiu     $s0, $s0, 0x1
/* 2CD50 80051950 0202102B */  sltu      $v0, $s0, $v0
/* 2CD54 80051954 1440FFE9 */  bnez      $v0, .L800518FC
/* 2CD58 80051958 24840048 */   addiu    $a0, $a0, 0x48
/* 2CD5C 8005195C 0801482C */  j         .L800520B0
/* 2CD60 80051960 00000000 */   nop
.L80051964:
/* 2CD64 80051964 0C014E31 */  jal       au_reset_voice
/* 2CD68 80051968 320500FF */   andi     $a1, $s0, 0xFF
/* 2CD6C 8005196C 0801468F */  j         .L80051A3C
/* 2CD70 80051970 00000000 */   nop
.L80051974:
/* 2CD74 80051974 0C014E31 */  jal       au_reset_voice
/* 2CD78 80051978 320500FF */   andi     $a1, $s0, 0xFF
/* 2CD7C 8005197C 080146A8 */  j         .L80051AA0
/* 2CD80 80051980 00000000 */   nop
.L80051984:
/* 2CD84 80051984 0C014874 */  jal       au_amb_read_next
/* 2CD88 80051988 02A0202D */   daddu    $a0, $s5, $zero
/* 2CD8C 8005198C 92A30025 */  lbu       $v1, 0x25($s5)
/* 2CD90 80051990 146001C7 */  bnez      $v1, .L800520B0
/* 2CD94 80051994 0040A02D */   daddu    $s4, $v0, $zero
/* 2CD98 80051998 8EB00030 */  lw        $s0, 0x30($s5)
/* 2CD9C 8005199C 8EA40034 */  lw        $a0, 0x34($s5)
/* 2CDA0 800519A0 0204102B */  sltu      $v0, $s0, $a0
/* 2CDA4 800519A4 10400012 */  beqz      $v0, .L800519F0
/* 2CDA8 800519A8 001010C0 */   sll      $v0, $s0, 3
/* 2CDAC 800519AC 00501021 */  addu      $v0, $v0, $s0
/* 2CDB0 800519B0 000210C0 */  sll       $v0, $v0, 3
/* 2CDB4 800519B4 24431320 */  addiu     $v1, $v0, 0x1320
/* 2CDB8 800519B8 8FA80030 */  lw        $t0, 0x30($sp)
.L800519BC:
/* 2CDBC 800519BC 01038821 */  addu      $s1, $t0, $v1
/* 2CDC0 800519C0 92220045 */  lbu       $v0, 0x45($s1)
/* 2CDC4 800519C4 10400005 */  beqz      $v0, .L800519DC
/* 2CDC8 800519C8 00000000 */   nop
/* 2CDCC 800519CC 26100001 */  addiu     $s0, $s0, 0x1
/* 2CDD0 800519D0 0204102B */  sltu      $v0, $s0, $a0
/* 2CDD4 800519D4 1440FFF9 */  bnez      $v0, .L800519BC
/* 2CDD8 800519D8 24630048 */   addiu    $v1, $v1, 0x48
.L800519DC:
/* 2CDDC 800519DC 8EA20034 */  lw        $v0, 0x34($s5)
/* 2CDE0 800519E0 0202102B */  sltu      $v0, $s0, $v0
/* 2CDE4 800519E4 14400032 */  bnez      $v0, .L80051AB0
/* 2CDE8 800519E8 00000000 */   nop
/* 2CDEC 800519EC 8EB00030 */  lw        $s0, 0x30($s5)
.L800519F0:
/* 2CDF0 800519F0 8EA30034 */  lw        $v1, 0x34($s5)
/* 2CDF4 800519F4 0203102B */  sltu      $v0, $s0, $v1
/* 2CDF8 800519F8 10400014 */  beqz      $v0, .L80051A4C
/* 2CDFC 800519FC 001010C0 */   sll      $v0, $s0, 3
/* 2CE00 80051A00 0060202D */  daddu     $a0, $v1, $zero
/* 2CE04 80051A04 00501021 */  addu      $v0, $v0, $s0
/* 2CE08 80051A08 000210C0 */  sll       $v0, $v0, 3
/* 2CE0C 80051A0C 8FA80070 */  lw        $t0, 0x70($sp)
/* 2CE10 80051A10 24431320 */  addiu     $v1, $v0, 0x1320
/* 2CE14 80051A14 91050022 */  lbu       $a1, 0x22($t0)
/* 2CE18 80051A18 8FA80030 */  lw        $t0, 0x30($sp)
.L80051A1C:
/* 2CE1C 80051A1C 01038821 */  addu      $s1, $t0, $v1
/* 2CE20 80051A20 92220045 */  lbu       $v0, 0x45($s1)
/* 2CE24 80051A24 5045FFCF */  beql      $v0, $a1, .L80051964
/* 2CE28 80051A28 0220202D */   daddu    $a0, $s1, $zero
/* 2CE2C 80051A2C 26100001 */  addiu     $s0, $s0, 0x1
/* 2CE30 80051A30 0204102B */  sltu      $v0, $s0, $a0
/* 2CE34 80051A34 1440FFF9 */  bnez      $v0, .L80051A1C
/* 2CE38 80051A38 24630048 */   addiu    $v1, $v1, 0x48
.L80051A3C:
/* 2CE3C 80051A3C 8EA20034 */  lw        $v0, 0x34($s5)
/* 2CE40 80051A40 0202102B */  sltu      $v0, $s0, $v0
/* 2CE44 80051A44 1440001A */  bnez      $v0, .L80051AB0
/* 2CE48 80051A48 00000000 */   nop
.L80051A4C:
/* 2CE4C 80051A4C 8EB00030 */  lw        $s0, 0x30($s5)
/* 2CE50 80051A50 8EA30034 */  lw        $v1, 0x34($s5)
/* 2CE54 80051A54 0203102B */  sltu      $v0, $s0, $v1
/* 2CE58 80051A58 10400195 */  beqz      $v0, .L800520B0
/* 2CE5C 80051A5C 001010C0 */   sll      $v0, $s0, 3
/* 2CE60 80051A60 0060202D */  daddu     $a0, $v1, $zero
/* 2CE64 80051A64 00501021 */  addu      $v0, $v0, $s0
/* 2CE68 80051A68 000210C0 */  sll       $v0, $v0, 3
/* 2CE6C 80051A6C 8FA80070 */  lw        $t0, 0x70($sp)
/* 2CE70 80051A70 24431320 */  addiu     $v1, $v0, 0x1320
/* 2CE74 80051A74 91050022 */  lbu       $a1, 0x22($t0)
/* 2CE78 80051A78 8FA80030 */  lw        $t0, 0x30($sp)
.L80051A7C:
/* 2CE7C 80051A7C 01038821 */  addu      $s1, $t0, $v1
/* 2CE80 80051A80 92220045 */  lbu       $v0, 0x45($s1)
/* 2CE84 80051A84 0045102B */  sltu      $v0, $v0, $a1
/* 2CE88 80051A88 5440FFBA */  bnel      $v0, $zero, .L80051974
/* 2CE8C 80051A8C 0220202D */   daddu    $a0, $s1, $zero
/* 2CE90 80051A90 26100001 */  addiu     $s0, $s0, 0x1
/* 2CE94 80051A94 0204102B */  sltu      $v0, $s0, $a0
/* 2CE98 80051A98 1440FFF8 */  bnez      $v0, .L80051A7C
/* 2CE9C 80051A9C 24630048 */   addiu    $v1, $v1, 0x48
.L80051AA0:
/* 2CEA0 80051AA0 8EA20034 */  lw        $v0, 0x34($s5)
/* 2CEA4 80051AA4 0202102B */  sltu      $v0, $s0, $v0
/* 2CEA8 80051AA8 10400181 */  beqz      $v0, .L800520B0
/* 2CEAC 80051AAC 00000000 */   nop
.L80051AB0:
/* 2CEB0 80051AB0 8EA20030 */  lw        $v0, 0x30($s5)
/* 2CEB4 80051AB4 8FA80040 */  lw        $t0, 0x40($sp)
/* 2CEB8 80051AB8 02021023 */  subu      $v0, $s0, $v0
/* 2CEBC 80051ABC 01021021 */  addu      $v0, $t0, $v0
/* 2CEC0 80051AC0 A05E0000 */  sb        $fp, 0x0($v0)
/* 2CEC4 80051AC4 8EA20030 */  lw        $v0, 0x30($s5)
/* 2CEC8 80051AC8 8FA8003C */  lw        $t0, 0x3C($sp)
/* 2CECC 80051ACC 02021023 */  subu      $v0, $s0, $v0
/* 2CED0 80051AD0 01021021 */  addu      $v0, $t0, $v0
/* 2CED4 80051AD4 A05E0000 */  sb        $fp, 0x0($v0)
/* 2CED8 80051AD8 8EA20030 */  lw        $v0, 0x30($s5)
/* 2CEDC 80051ADC 8FA80070 */  lw        $t0, 0x70($sp)
/* 2CEE0 80051AE0 8EA30014 */  lw        $v1, 0x14($s5)
/* 2CEE4 80051AE4 02021023 */  subu      $v0, $s0, $v0
/* 2CEE8 80051AE8 000210C0 */  sll       $v0, $v0, 3
/* 2CEEC 80051AEC 244207B4 */  addiu     $v0, $v0, 0x7B4
/* 2CEF0 80051AF0 01029021 */  addu      $s2, $t0, $v0
/* 2CEF4 80051AF4 00161400 */  sll       $v0, $s6, 16
/* 2CEF8 80051AF8 00621821 */  addu      $v1, $v1, $v0
/* 2CEFC 80051AFC 32E200FF */  andi      $v0, $s7, 0xFF
/* 2CF00 80051B00 00021200 */  sll       $v0, $v0, 8
/* 2CF04 80051B04 00621821 */  addu      $v1, $v1, $v0
/* 2CF08 80051B08 AE430000 */  sw        $v1, 0x0($s2)
/* 2CF0C 80051B0C 92620026 */  lbu       $v0, 0x26($s3)
/* 2CF10 80051B10 30420001 */  andi      $v0, $v0, 0x1
/* 2CF14 80051B14 50400002 */  beql      $v0, $zero, .L80051B20
/* 2CF18 80051B18 A2400007 */   sb       $zero, 0x7($s2)
/* 2CF1C 80051B1C A25E0007 */  sb        $fp, 0x7($s2)
.L80051B20:
/* 2CF20 80051B20 24080009 */  addiu     $t0, $zero, 0x9
/* 2CF24 80051B24 12C80033 */  beq       $s6, $t0, .L80051BF4
/* 2CF28 80051B28 32E3007F */   andi     $v1, $s7, 0x7F
/* 2CF2C 80051B2C 92620026 */  lbu       $v0, 0x26($s3)
/* 2CF30 80051B30 30420001 */  andi      $v0, $v0, 0x1
/* 2CF34 80051B34 50400002 */  beql      $v0, $zero, .L80051B40
/* 2CF38 80051B38 A2400007 */   sb       $zero, 0x7($s2)
/* 2CF3C 80051B3C A25E0007 */  sb        $fp, 0x7($s2)
.L80051B40:
/* 2CF40 80051B40 3284007F */  andi      $a0, $s4, 0x7F
/* 2CF44 80051B44 8E620000 */  lw        $v0, 0x0($s3)
/* 2CF48 80051B48 32E3007F */  andi      $v1, $s7, 0x7F
/* 2CF4C 80051B4C 9445001E */  lhu       $a1, 0x1E($v0)
/* 2CF50 80051B50 00031040 */  sll       $v0, $v1, 1
/* 2CF54 80051B54 00431021 */  addu      $v0, $v0, $v1
/* 2CF58 80051B58 000210C0 */  sll       $v0, $v0, 3
/* 2CF5C 80051B5C 00431021 */  addu      $v0, $v0, $v1
/* 2CF60 80051B60 00021080 */  sll       $v0, $v0, 2
/* 2CF64 80051B64 A2440006 */  sb        $a0, 0x6($s2)
/* 2CF68 80051B68 00451023 */  subu      $v0, $v0, $a1
/* 2CF6C 80051B6C A6420004 */  sh        $v0, 0x4($s2)
/* 2CF70 80051B70 82A30038 */  lb        $v1, 0x38($s5)
/* 2CF74 80051B74 86620018 */  lh        $v0, 0x18($s3)
/* 2CF78 80051B78 00620018 */  mult      $v1, $v0
/* 2CF7C 80051B7C 00004012 */  mflo      $t0
/* 2CF80 80051B80 00000000 */  nop
/* 2CF84 80051B84 00000000 */  nop
/* 2CF88 80051B88 01040018 */  mult      $t0, $a0
/* 2CF8C 80051B8C 00004012 */  mflo      $t0
/* 2CF90 80051B90 00081383 */  sra       $v0, $t0, 14
/* 2CF94 80051B94 A6220040 */  sh        $v0, 0x40($s1)
/* 2CF98 80051B98 86420004 */  lh        $v0, 0x4($s2)
/* 2CF9C 80051B9C 8664000C */  lh        $a0, 0xC($s3)
/* 2CFA0 80051BA0 0C014E3E */  jal       au_compute_pitch_ratio
/* 2CFA4 80051BA4 00442021 */   addu     $a0, $v0, $a0
/* 2CFA8 80051BA8 8E620000 */  lw        $v0, 0x0($s3)
/* 2CFAC 80051BAC C4420020 */  lwc1      $f2, 0x20($v0)
/* 2CFB0 80051BB0 46020002 */  mul.s     $f0, $f0, $f2
/* 2CFB4 80051BB4 00000000 */  nop
/* 2CFB8 80051BB8 E6200004 */  swc1      $f0, 0x4($s1)
/* 2CFBC 80051BBC 92620024 */  lbu       $v0, 0x24($s3)
/* 2CFC0 80051BC0 A222000E */  sb        $v0, 0xE($s1)
/* 2CFC4 80051BC4 92620025 */  lbu       $v0, 0x25($s3)
/* 2CFC8 80051BC8 A222000F */  sb        $v0, 0xF($s1)
/* 2CFCC 80051BCC 8E620000 */  lw        $v0, 0x0($s3)
/* 2CFD0 80051BD0 AE220000 */  sw        $v0, 0x0($s1)
/* 2CFD4 80051BD4 8FA80070 */  lw        $t0, 0x70($sp)
/* 2CFD8 80051BD8 91020023 */  lbu       $v0, 0x23($t0)
/* 2CFDC 80051BDC A2220010 */  sb        $v0, 0x10($s1)
/* 2CFE0 80051BE0 8E620004 */  lw        $v0, 0x4($s3)
/* 2CFE4 80051BE4 AE220014 */  sw        $v0, 0x14($s1)
/* 2CFE8 80051BE8 8E620008 */  lw        $v0, 0x8($s3)
/* 2CFEC 80051BEC 0801472D */  j         .L80051CB4
/* 2CFF0 80051BF0 AE220018 */   sw       $v0, 0x18($s1)
.L80051BF4:
/* 2CFF4 80051BF4 A2400007 */  sb        $zero, 0x7($s2)
/* 2CFF8 80051BF8 8FA80070 */  lw        $t0, 0x70($sp)
/* 2CFFC 80051BFC 00031040 */  sll       $v0, $v1, 1
/* 2D000 80051C00 8D040000 */  lw        $a0, 0x0($t0)
/* 2D004 80051C04 00431021 */  addu      $v0, $v0, $v1
/* 2D008 80051C08 8C900054 */  lw        $s0, 0x54($a0)
/* 2D00C 80051C0C 00021080 */  sll       $v0, $v0, 2
/* 2D010 80051C10 02028021 */  addu      $s0, $s0, $v0
/* 2D014 80051C14 96060000 */  lhu       $a2, 0x0($s0)
/* 2D018 80051C18 26270014 */  addiu     $a3, $s1, 0x14
/* 2D01C 80051C1C 00062A02 */  srl       $a1, $a2, 8
/* 2D020 80051C20 0C014EFA */  jal       au_get_instrument
/* 2D024 80051C24 30C600FF */   andi     $a2, $a2, 0xFF
/* 2D028 80051C28 AE220000 */  sw        $v0, 0x0($s1)
/* 2D02C 80051C2C 96030002 */  lhu       $v1, 0x2($s0)
/* 2D030 80051C30 9442001E */  lhu       $v0, 0x1E($v0)
/* 2D034 80051C34 00621823 */  subu      $v1, $v1, $v0
/* 2D038 80051C38 A6430004 */  sh        $v1, 0x4($s2)
/* 2D03C 80051C3C 92030004 */  lbu       $v1, 0x4($s0)
/* 2D040 80051C40 3282007F */  andi      $v0, $s4, 0x7F
/* 2D044 80051C44 00430018 */  mult      $v0, $v1
/* 2D048 80051C48 00004012 */  mflo      $t0
/* 2D04C 80051C4C 000819C3 */  sra       $v1, $t0, 7
/* 2D050 80051C50 A2430006 */  sb        $v1, 0x6($s2)
/* 2D054 80051C54 82A40038 */  lb        $a0, 0x38($s5)
/* 2D058 80051C58 86620018 */  lh        $v0, 0x18($s3)
/* 2D05C 80051C5C 00820018 */  mult      $a0, $v0
/* 2D060 80051C60 00004012 */  mflo      $t0
/* 2D064 80051C64 00031E00 */  sll       $v1, $v1, 24
/* 2D068 80051C68 00031E03 */  sra       $v1, $v1, 24
/* 2D06C 80051C6C 01030018 */  mult      $t0, $v1
/* 2D070 80051C70 00004012 */  mflo      $t0
/* 2D074 80051C74 00081383 */  sra       $v0, $t0, 14
/* 2D078 80051C78 A6220040 */  sh        $v0, 0x40($s1)
/* 2D07C 80051C7C 0C014E3E */  jal       au_compute_pitch_ratio
/* 2D080 80051C80 86440004 */   lh       $a0, 0x4($s2)
/* 2D084 80051C84 8E220000 */  lw        $v0, 0x0($s1)
/* 2D088 80051C88 C4420020 */  lwc1      $f2, 0x20($v0)
/* 2D08C 80051C8C 46020002 */  mul.s     $f0, $f0, $f2
/* 2D090 80051C90 00000000 */  nop
/* 2D094 80051C94 E6200004 */  swc1      $f0, 0x4($s1)
/* 2D098 80051C98 92020005 */  lbu       $v0, 0x5($s0)
/* 2D09C 80051C9C A222000E */  sb        $v0, 0xE($s1)
/* 2D0A0 80051CA0 92020006 */  lbu       $v0, 0x6($s0)
/* 2D0A4 80051CA4 A222000F */  sb        $v0, 0xF($s1)
/* 2D0A8 80051CA8 8FA80070 */  lw        $t0, 0x70($sp)
/* 2D0AC 80051CAC 91020023 */  lbu       $v0, 0x23($t0)
/* 2D0B0 80051CB0 A2220010 */  sb        $v0, 0x10($s1)
.L80051CB4:
/* 2D0B4 80051CB4 24020002 */  addiu     $v0, $zero, 0x2
/* 2D0B8 80051CB8 A2220043 */  sb        $v0, 0x43($s1)
/* 2D0BC 80051CBC 8FA80070 */  lw        $t0, 0x70($sp)
/* 2D0C0 80051CC0 91020022 */  lbu       $v0, 0x22($t0)
/* 2D0C4 80051CC4 A2220045 */  sb        $v0, 0x45($s1)
/* 2D0C8 80051CC8 0801482C */  j         .L800520B0
/* 2D0CC 80051CCC A2220044 */   sb       $v0, 0x44($s1)
.L80051CD0:
/* 2D0D0 80051CD0 1040002C */  beqz      $v0, .L80051D84
/* 2D0D4 80051CD4 32E2007F */   andi     $v0, $s7, 0x7F
/* 2D0D8 80051CD8 00162400 */  sll       $a0, $s6, 16
/* 2D0DC 80051CDC A2620024 */  sb        $v0, 0x24($s3)
/* 2D0E0 80051CE0 8EB00030 */  lw        $s0, 0x30($s5)
/* 2D0E4 80051CE4 8EA30014 */  lw        $v1, 0x14($s5)
/* 2D0E8 80051CE8 8EA20034 */  lw        $v0, 0x34($s5)
/* 2D0EC 80051CEC 0202102B */  sltu      $v0, $s0, $v0
/* 2D0F0 80051CF0 104000EF */  beqz      $v0, .L800520B0
/* 2D0F4 80051CF4 0064B821 */   addu     $s7, $v1, $a0
/* 2D0F8 80051CF8 001010C0 */  sll       $v0, $s0, 3
/* 2D0FC 80051CFC 00501021 */  addu      $v0, $v0, $s0
/* 2D100 80051D00 000210C0 */  sll       $v0, $v0, 3
/* 2D104 80051D04 24441320 */  addiu     $a0, $v0, 0x1320
.L80051D08:
/* 2D108 80051D08 8EA20030 */  lw        $v0, 0x30($s5)
/* 2D10C 80051D0C 8FA80070 */  lw        $t0, 0x70($sp)
/* 2D110 80051D10 02021023 */  subu      $v0, $s0, $v0
/* 2D114 80051D14 000210C0 */  sll       $v0, $v0, 3
/* 2D118 80051D18 00489021 */  addu      $s2, $v0, $t0
/* 2D11C 80051D1C 8E4207B4 */  lw        $v0, 0x7B4($s2)
/* 2D120 80051D20 3C08FFFF */  lui       $t0, (0xFFFF0000 >> 16)
/* 2D124 80051D24 00481024 */  and       $v0, $v0, $t0
/* 2D128 80051D28 1457000F */  bne       $v0, $s7, .L80051D68
/* 2D12C 80051D2C 00000000 */   nop
/* 2D130 80051D30 8FA80030 */  lw        $t0, 0x30($sp)
/* 2D134 80051D34 01048821 */  addu      $s1, $t0, $a0
/* 2D138 80051D38 8FA80070 */  lw        $t0, 0x70($sp)
/* 2D13C 80051D3C 92230045 */  lbu       $v1, 0x45($s1)
/* 2D140 80051D40 91020022 */  lbu       $v0, 0x22($t0)
/* 2D144 80051D44 14620008 */  bne       $v1, $v0, .L80051D68
/* 2D148 80051D48 24080009 */   addiu    $t0, $zero, 0x9
/* 2D14C 80051D4C 12C80006 */  beq       $s6, $t0, .L80051D68
/* 2D150 80051D50 00000000 */   nop
/* 2D154 80051D54 92220043 */  lbu       $v0, 0x43($s1)
/* 2D158 80051D58 92630024 */  lbu       $v1, 0x24($s3)
/* 2D15C 80051D5C 34420010 */  ori       $v0, $v0, 0x10
/* 2D160 80051D60 A223000E */  sb        $v1, 0xE($s1)
/* 2D164 80051D64 A2220043 */  sb        $v0, 0x43($s1)
.L80051D68:
/* 2D168 80051D68 8EA20034 */  lw        $v0, 0x34($s5)
/* 2D16C 80051D6C 26100001 */  addiu     $s0, $s0, 0x1
/* 2D170 80051D70 0202102B */  sltu      $v0, $s0, $v0
/* 2D174 80051D74 1440FFE4 */  bnez      $v0, .L80051D08
/* 2D178 80051D78 24840048 */   addiu    $a0, $a0, 0x48
/* 2D17C 80051D7C 0801482C */  j         .L800520B0
/* 2D180 80051D80 00000000 */   nop
.L80051D84:
/* 2D184 80051D84 00171E00 */  sll       $v1, $s7, 24
/* 2D188 80051D88 10600005 */  beqz      $v1, .L80051DA0
/* 2D18C 80051D8C AE630018 */   sw       $v1, 0x18($s3)
/* 2D190 80051D90 3C0200FF */  lui       $v0, (0xFFFFFF >> 16)
/* 2D194 80051D94 3442FFFF */  ori       $v0, $v0, (0xFFFFFF & 0xFFFF)
/* 2D198 80051D98 00621025 */  or        $v0, $v1, $v0
/* 2D19C 80051D9C AE620018 */  sw        $v0, 0x18($s3)
.L80051DA0:
/* 2D1A0 80051DA0 00162400 */  sll       $a0, $s6, 16
/* 2D1A4 80051DA4 8EB00030 */  lw        $s0, 0x30($s5)
/* 2D1A8 80051DA8 8EA30014 */  lw        $v1, 0x14($s5)
/* 2D1AC 80051DAC 8EA20034 */  lw        $v0, 0x34($s5)
/* 2D1B0 80051DB0 0202102B */  sltu      $v0, $s0, $v0
/* 2D1B4 80051DB4 104000BE */  beqz      $v0, .L800520B0
/* 2D1B8 80051DB8 0064B821 */   addu     $s7, $v1, $a0
/* 2D1BC 80051DBC 001010C0 */  sll       $v0, $s0, 3
/* 2D1C0 80051DC0 00501021 */  addu      $v0, $v0, $s0
/* 2D1C4 80051DC4 000210C0 */  sll       $v0, $v0, 3
/* 2D1C8 80051DC8 24441320 */  addiu     $a0, $v0, 0x1320
.L80051DCC:
/* 2D1CC 80051DCC 8EA20030 */  lw        $v0, 0x30($s5)
/* 2D1D0 80051DD0 8FA80070 */  lw        $t0, 0x70($sp)
/* 2D1D4 80051DD4 02021023 */  subu      $v0, $s0, $v0
/* 2D1D8 80051DD8 000210C0 */  sll       $v0, $v0, 3
/* 2D1DC 80051DDC 244207B4 */  addiu     $v0, $v0, 0x7B4
/* 2D1E0 80051DE0 01029021 */  addu      $s2, $t0, $v0
/* 2D1E4 80051DE4 8E420000 */  lw        $v0, 0x0($s2)
/* 2D1E8 80051DE8 3C08FFFF */  lui       $t0, (0xFFFF0000 >> 16)
/* 2D1EC 80051DEC 00481024 */  and       $v0, $v0, $t0
/* 2D1F0 80051DF0 14570020 */  bne       $v0, $s7, .L80051E74
/* 2D1F4 80051DF4 00000000 */   nop
/* 2D1F8 80051DF8 8FA80030 */  lw        $t0, 0x30($sp)
/* 2D1FC 80051DFC 01048821 */  addu      $s1, $t0, $a0
/* 2D200 80051E00 8FA80070 */  lw        $t0, 0x70($sp)
/* 2D204 80051E04 92230045 */  lbu       $v1, 0x45($s1)
/* 2D208 80051E08 91020022 */  lbu       $v0, 0x22($t0)
/* 2D20C 80051E0C 14620019 */  bne       $v1, $v0, .L80051E74
/* 2D210 80051E10 00000000 */   nop
/* 2D214 80051E14 82A30038 */  lb        $v1, 0x38($s5)
/* 2D218 80051E18 86620018 */  lh        $v0, 0x18($s3)
/* 2D21C 80051E1C 00620018 */  mult      $v1, $v0
/* 2D220 80051E20 00004012 */  mflo      $t0
/* 2D224 80051E24 82420006 */  lb        $v0, 0x6($s2)
/* 2D228 80051E28 00000000 */  nop
/* 2D22C 80051E2C 01020018 */  mult      $t0, $v0
/* 2D230 80051E30 00004012 */  mflo      $t0
/* 2D234 80051E34 00081383 */  sra       $v0, $t0, 14
/* 2D238 80051E38 A6220040 */  sh        $v0, 0x40($s1)
/* 2D23C 80051E3C 8EA20030 */  lw        $v0, 0x30($s5)
/* 2D240 80051E40 8FA80040 */  lw        $t0, 0x40($sp)
/* 2D244 80051E44 02021023 */  subu      $v0, $s0, $v0
/* 2D248 80051E48 01021021 */  addu      $v0, $t0, $v0
/* 2D24C 80051E4C 90420000 */  lbu       $v0, 0x0($v0)
/* 2D250 80051E50 14400008 */  bnez      $v0, .L80051E74
/* 2D254 80051E54 00000000 */   nop
/* 2D258 80051E58 9222003D */  lbu       $v0, 0x3D($s1)
/* 2D25C 80051E5C 34420020 */  ori       $v0, $v0, 0x20
/* 2D260 80051E60 A222003D */  sb        $v0, 0x3D($s1)
/* 2D264 80051E64 8EA20030 */  lw        $v0, 0x30($s5)
/* 2D268 80051E68 02021023 */  subu      $v0, $s0, $v0
/* 2D26C 80051E6C 01021021 */  addu      $v0, $t0, $v0
/* 2D270 80051E70 A05E0000 */  sb        $fp, 0x0($v0)
.L80051E74:
/* 2D274 80051E74 8EA20034 */  lw        $v0, 0x34($s5)
/* 2D278 80051E78 26100001 */  addiu     $s0, $s0, 0x1
/* 2D27C 80051E7C 0202102B */  sltu      $v0, $s0, $v0
/* 2D280 80051E80 1440FFD2 */  bnez      $v0, .L80051DCC
/* 2D284 80051E84 24840048 */   addiu    $a0, $a0, 0x48
/* 2D288 80051E88 0801482C */  j         .L800520B0
/* 2D28C 80051E8C 00000000 */   nop
.L80051E90:
/* 2D290 80051E90 0C014874 */  jal       au_amb_read_next
/* 2D294 80051E94 02A0202D */   daddu    $a0, $s5, $zero
/* 2D298 80051E98 0040A02D */  daddu     $s4, $v0, $zero
/* 2D29C 80051E9C 32E300FF */  andi      $v1, $s7, 0xFF
/* 2D2A0 80051EA0 24020067 */  addiu     $v0, $zero, 0x67
/* 2D2A4 80051EA4 10620013 */  beq       $v1, $v0, .L80051EF4
/* 2D2A8 80051EA8 28620068 */   slti     $v0, $v1, 0x68
/* 2D2AC 80051EAC 10400005 */  beqz      $v0, .L80051EC4
/* 2D2B0 80051EB0 24020066 */   addiu    $v0, $zero, 0x66
/* 2D2B4 80051EB4 1062000A */  beq       $v1, $v0, .L80051EE0
/* 2D2B8 80051EB8 32820001 */   andi     $v0, $s4, 0x1
/* 2D2BC 80051EBC 0801482C */  j         .L800520B0
/* 2D2C0 80051EC0 00000000 */   nop
.L80051EC4:
/* 2D2C4 80051EC4 24020068 */  addiu     $v0, $zero, 0x68
/* 2D2C8 80051EC8 10620027 */  beq       $v1, $v0, .L80051F68
/* 2D2CC 80051ECC 24020069 */   addiu    $v0, $zero, 0x69
/* 2D2D0 80051ED0 10620027 */  beq       $v1, $v0, .L80051F70
/* 2D2D4 80051ED4 328300FF */   andi     $v1, $s4, 0xFF
/* 2D2D8 80051ED8 0801482C */  j         .L800520B0
/* 2D2DC 80051EDC 00000000 */   nop
.L80051EE0:
/* 2D2E0 80051EE0 00021080 */  sll       $v0, $v0, 2
/* 2D2E4 80051EE4 8EA30008 */  lw        $v1, 0x8($s5)
/* 2D2E8 80051EE8 02A21021 */  addu      $v0, $s5, $v0
/* 2D2EC 80051EEC 0801482C */  j         .L800520B0
/* 2D2F0 80051EF0 AC43000C */   sw       $v1, 0xC($v0)
.L80051EF4:
/* 2D2F4 80051EF4 3282007C */  andi      $v0, $s4, 0x7C
/* 2D2F8 80051EF8 00022882 */  srl       $a1, $v0, 2
/* 2D2FC 80051EFC 10A00013 */  beqz      $a1, .L80051F4C
/* 2D300 80051F00 32840001 */   andi     $a0, $s4, 0x1
/* 2D304 80051F04 02A41821 */  addu      $v1, $s5, $a0
/* 2D308 80051F08 9062002C */  lbu       $v0, 0x2C($v1)
/* 2D30C 80051F0C 10400009 */  beqz      $v0, .L80051F34
/* 2D310 80051F10 2442FFFF */   addiu    $v0, $v0, -0x1
/* 2D314 80051F14 A062002C */  sb        $v0, 0x2C($v1)
/* 2D318 80051F18 304200FF */  andi      $v0, $v0, 0xFF
/* 2D31C 80051F1C 10400064 */  beqz      $v0, .L800520B0
/* 2D320 80051F20 00041080 */   sll      $v0, $a0, 2
/* 2D324 80051F24 02A21021 */  addu      $v0, $s5, $v0
/* 2D328 80051F28 8C42000C */  lw        $v0, 0xC($v0)
/* 2D32C 80051F2C 0801482C */  j         .L800520B0
/* 2D330 80051F30 AEA20008 */   sw       $v0, 0x8($s5)
.L80051F34:
/* 2D334 80051F34 00041080 */  sll       $v0, $a0, 2
/* 2D338 80051F38 02A21021 */  addu      $v0, $s5, $v0
/* 2D33C 80051F3C 8C42000C */  lw        $v0, 0xC($v0)
/* 2D340 80051F40 AEA20008 */  sw        $v0, 0x8($s5)
/* 2D344 80051F44 0801482C */  j         .L800520B0
/* 2D348 80051F48 A065002C */   sb       $a1, 0x2C($v1)
.L80051F4C:
/* 2D34C 80051F4C 00041080 */  sll       $v0, $a0, 2
/* 2D350 80051F50 02A21021 */  addu      $v0, $s5, $v0
/* 2D354 80051F54 8C42000C */  lw        $v0, 0xC($v0)
/* 2D358 80051F58 AEA20008 */  sw        $v0, 0x8($s5)
/* 2D35C 80051F5C 02A41021 */  addu      $v0, $s5, $a0
/* 2D360 80051F60 0801482C */  j         .L800520B0
/* 2D364 80051F64 A040002C */   sb       $zero, 0x2C($v0)
.L80051F68:
/* 2D368 80051F68 0801482C */  j         .L800520B0
/* 2D36C 80051F6C A2740025 */   sb       $s4, 0x25($s3)
.L80051F70:
/* 2D370 80051F70 24020001 */  addiu     $v0, $zero, 0x1
/* 2D374 80051F74 1462004E */  bne       $v1, $v0, .L800520B0
/* 2D378 80051F78 00000000 */   nop
/* 2D37C 80051F7C 92620026 */  lbu       $v0, 0x26($s3)
/* 2D380 80051F80 34420001 */  ori       $v0, $v0, 0x1
/* 2D384 80051F84 0801482C */  j         .L800520B0
/* 2D388 80051F88 A2620026 */   sb       $v0, 0x26($s3)
.L80051F8C:
/* 2D38C 80051F8C 0C014874 */  jal       au_amb_read_next
/* 2D390 80051F90 02A0202D */   daddu    $a0, $s5, $zero
/* 2D394 80051F94 24080009 */  addiu     $t0, $zero, 0x9
/* 2D398 80051F98 12C80045 */  beq       $s6, $t0, .L800520B0
/* 2D39C 80051F9C 0040A02D */   daddu    $s4, $v0, $zero
/* 2D3A0 80051FA0 32E500FF */  andi      $a1, $s7, 0xFF
/* 2D3A4 80051FA4 8FA80070 */  lw        $t0, 0x70($sp)
/* 2D3A8 80051FA8 328600FF */  andi      $a2, $s4, 0xFF
/* 2D3AC 80051FAC 8D040000 */  lw        $a0, 0x0($t0)
/* 2D3B0 80051FB0 0C014EFA */  jal       au_get_instrument
/* 2D3B4 80051FB4 26670004 */   addiu    $a3, $s3, 0x4
/* 2D3B8 80051FB8 0801482C */  j         .L800520B0
/* 2D3BC 80051FBC AE620000 */   sw       $v0, 0x0($s3)
.L80051FC0:
/* 2D3C0 80051FC0 0C014874 */  jal       au_amb_read_next
/* 2D3C4 80051FC4 02A0202D */   daddu    $a0, $s5, $zero
/* 2D3C8 80051FC8 00171E00 */  sll       $v1, $s7, 24
/* 2D3CC 80051FCC 304200FF */  andi      $v0, $v0, 0xFF
/* 2D3D0 80051FD0 00021400 */  sll       $v0, $v0, 16
/* 2D3D4 80051FD4 00621821 */  addu      $v1, $v1, $v0
/* 2D3D8 80051FD8 00162400 */  sll       $a0, $s6, 16
/* 2D3DC 80051FDC AE63000C */  sw        $v1, 0xC($s3)
/* 2D3E0 80051FE0 8EB00030 */  lw        $s0, 0x30($s5)
/* 2D3E4 80051FE4 8EA30014 */  lw        $v1, 0x14($s5)
/* 2D3E8 80051FE8 8EA20034 */  lw        $v0, 0x34($s5)
/* 2D3EC 80051FEC 0202102B */  sltu      $v0, $s0, $v0
/* 2D3F0 80051FF0 1040002F */  beqz      $v0, .L800520B0
/* 2D3F4 80051FF4 0064B821 */   addu     $s7, $v1, $a0
/* 2D3F8 80051FF8 001010C0 */  sll       $v0, $s0, 3
/* 2D3FC 80051FFC 00501021 */  addu      $v0, $v0, $s0
/* 2D400 80052000 000210C0 */  sll       $v0, $v0, 3
/* 2D404 80052004 24541320 */  addiu     $s4, $v0, 0x1320
.L80052008:
/* 2D408 80052008 8EA20030 */  lw        $v0, 0x30($s5)
/* 2D40C 8005200C 8FA80070 */  lw        $t0, 0x70($sp)
/* 2D410 80052010 02021023 */  subu      $v0, $s0, $v0
/* 2D414 80052014 000210C0 */  sll       $v0, $v0, 3
/* 2D418 80052018 244207B4 */  addiu     $v0, $v0, 0x7B4
/* 2D41C 8005201C 01029021 */  addu      $s2, $t0, $v0
/* 2D420 80052020 8E420000 */  lw        $v0, 0x0($s2)
/* 2D424 80052024 3C08FFFF */  lui       $t0, (0xFFFF0000 >> 16)
/* 2D428 80052028 00481024 */  and       $v0, $v0, $t0
/* 2D42C 8005202C 1457001B */  bne       $v0, $s7, .L8005209C
/* 2D430 80052030 00000000 */   nop
/* 2D434 80052034 8FA80030 */  lw        $t0, 0x30($sp)
/* 2D438 80052038 01148821 */  addu      $s1, $t0, $s4
/* 2D43C 8005203C 8FA80070 */  lw        $t0, 0x70($sp)
/* 2D440 80052040 92230045 */  lbu       $v1, 0x45($s1)
/* 2D444 80052044 91020022 */  lbu       $v0, 0x22($t0)
/* 2D448 80052048 14620014 */  bne       $v1, $v0, .L8005209C
/* 2D44C 8005204C 24080009 */   addiu    $t0, $zero, 0x9
/* 2D450 80052050 12C80012 */  beq       $s6, $t0, .L8005209C
/* 2D454 80052054 00000000 */   nop
/* 2D458 80052058 86420004 */  lh        $v0, 0x4($s2)
/* 2D45C 8005205C 8664000C */  lh        $a0, 0xC($s3)
/* 2D460 80052060 0C014E3E */  jal       au_compute_pitch_ratio
/* 2D464 80052064 00442021 */   addu     $a0, $v0, $a0
/* 2D468 80052068 8E620000 */  lw        $v0, 0x0($s3)
/* 2D46C 8005206C C4420020 */  lwc1      $f2, 0x20($v0)
/* 2D470 80052070 46020002 */  mul.s     $f0, $f0, $f2
/* 2D474 80052074 00000000 */  nop
/* 2D478 80052078 92220043 */  lbu       $v0, 0x43($s1)
/* 2D47C 8005207C 34420008 */  ori       $v0, $v0, 0x8
/* 2D480 80052080 A2220043 */  sb        $v0, 0x43($s1)
/* 2D484 80052084 E6200004 */  swc1      $f0, 0x4($s1)
/* 2D488 80052088 8EA20030 */  lw        $v0, 0x30($s5)
/* 2D48C 8005208C 8FA8003C */  lw        $t0, 0x3C($sp)
/* 2D490 80052090 02021023 */  subu      $v0, $s0, $v0
/* 2D494 80052094 01021021 */  addu      $v0, $t0, $v0
/* 2D498 80052098 A05E0000 */  sb        $fp, 0x0($v0)
.L8005209C:
/* 2D49C 8005209C 8EA20034 */  lw        $v0, 0x34($s5)
/* 2D4A0 800520A0 26100001 */  addiu     $s0, $s0, 0x1
/* 2D4A4 800520A4 0202102B */  sltu      $v0, $s0, $v0
/* 2D4A8 800520A8 1440FFD7 */  bnez      $v0, .L80052008
/* 2D4AC 800520AC 26940048 */   addiu    $s4, $s4, 0x48
.L800520B0:
/* 2D4B0 800520B0 8EA20018 */  lw        $v0, 0x18($s5)
/* 2D4B4 800520B4 1040FDC9 */  beqz      $v0, .L800517DC
/* 2D4B8 800520B8 00000000 */   nop
.L800520BC:
/* 2D4BC 800520BC 93A20034 */  lbu       $v0, 0x34($sp)
/* 2D4C0 800520C0 10400037 */  beqz      $v0, .L800521A0
/* 2D4C4 800520C4 00000000 */   nop
/* 2D4C8 800520C8 8EB00030 */  lw        $s0, 0x30($s5)
/* 2D4CC 800520CC 8EA20034 */  lw        $v0, 0x34($s5)
/* 2D4D0 800520D0 0202102B */  sltu      $v0, $s0, $v0
/* 2D4D4 800520D4 10400032 */  beqz      $v0, .L800521A0
/* 2D4D8 800520D8 001010C0 */   sll      $v0, $s0, 3
/* 2D4DC 800520DC 3C07FF00 */  lui       $a3, (0xFF000000 >> 16)
/* 2D4E0 800520E0 27A60010 */  addiu     $a2, $sp, 0x10
/* 2D4E4 800520E4 00501021 */  addu      $v0, $v0, $s0
/* 2D4E8 800520E8 000210C0 */  sll       $v0, $v0, 3
/* 2D4EC 800520EC 24451320 */  addiu     $a1, $v0, 0x1320
.L800520F0:
/* 2D4F0 800520F0 8EA20030 */  lw        $v0, 0x30($s5)
/* 2D4F4 800520F4 8FA80070 */  lw        $t0, 0x70($sp)
/* 2D4F8 800520F8 02022023 */  subu      $a0, $s0, $v0
/* 2D4FC 800520FC 000410C0 */  sll       $v0, $a0, 3
/* 2D500 80052100 244207B4 */  addiu     $v0, $v0, 0x7B4
/* 2D504 80052104 01029021 */  addu      $s2, $t0, $v0
/* 2D508 80052108 8E420000 */  lw        $v0, 0x0($s2)
/* 2D50C 8005210C 8EA30014 */  lw        $v1, 0x14($s5)
/* 2D510 80052110 00471024 */  and       $v0, $v0, $a3
/* 2D514 80052114 1443001D */  bne       $v0, $v1, .L8005218C
/* 2D518 80052118 00000000 */   nop
/* 2D51C 8005211C 8FA80030 */  lw        $t0, 0x30($sp)
/* 2D520 80052120 01058821 */  addu      $s1, $t0, $a1
/* 2D524 80052124 8FA80070 */  lw        $t0, 0x70($sp)
/* 2D528 80052128 92230045 */  lbu       $v1, 0x45($s1)
/* 2D52C 8005212C 91020022 */  lbu       $v0, 0x22($t0)
/* 2D530 80052130 14620016 */  bne       $v1, $v0, .L8005218C
/* 2D534 80052134 00C41021 */   addu     $v0, $a2, $a0
/* 2D538 80052138 90420000 */  lbu       $v0, 0x0($v0)
/* 2D53C 8005213C 14400013 */  bnez      $v0, .L8005218C
/* 2D540 80052140 00000000 */   nop
/* 2D544 80052144 92430001 */  lbu       $v1, 0x1($s2)
/* 2D548 80052148 00031080 */  sll       $v0, $v1, 2
/* 2D54C 8005214C 00431021 */  addu      $v0, $v0, $v1
/* 2D550 80052150 000210C0 */  sll       $v0, $v0, 3
/* 2D554 80052154 00559821 */  addu      $s3, $v0, $s5
/* 2D558 80052158 82A30038 */  lb        $v1, 0x38($s5)
/* 2D55C 8005215C 8662005C */  lh        $v0, 0x5C($s3)
/* 2D560 80052160 00620018 */  mult      $v1, $v0
/* 2D564 80052164 00004012 */  mflo      $t0
/* 2D568 80052168 82420006 */  lb        $v0, 0x6($s2)
/* 2D56C 8005216C 00000000 */  nop
/* 2D570 80052170 01020018 */  mult      $t0, $v0
/* 2D574 80052174 9222003D */  lbu       $v0, 0x3D($s1)
/* 2D578 80052178 34420020 */  ori       $v0, $v0, 0x20
/* 2D57C 8005217C A222003D */  sb        $v0, 0x3D($s1)
/* 2D580 80052180 00004012 */  mflo      $t0
/* 2D584 80052184 00081383 */  sra       $v0, $t0, 14
/* 2D588 80052188 A6220040 */  sh        $v0, 0x40($s1)
.L8005218C:
/* 2D58C 8005218C 8EA20034 */  lw        $v0, 0x34($s5)
/* 2D590 80052190 26100001 */  addiu     $s0, $s0, 0x1
/* 2D594 80052194 0202102B */  sltu      $v0, $s0, $v0
/* 2D598 80052198 1440FFD5 */  bnez      $v0, .L800520F0
/* 2D59C 8005219C 24A50048 */   addiu    $a1, $a1, 0x48
.L800521A0:
/* 2D5A0 800521A0 8FBF006C */  lw        $ra, 0x6C($sp)
/* 2D5A4 800521A4 8FBE0068 */  lw        $fp, 0x68($sp)
/* 2D5A8 800521A8 8FB70064 */  lw        $s7, 0x64($sp)
/* 2D5AC 800521AC 8FB60060 */  lw        $s6, 0x60($sp)
/* 2D5B0 800521B0 8FB5005C */  lw        $s5, 0x5C($sp)
/* 2D5B4 800521B4 8FB40058 */  lw        $s4, 0x58($sp)
/* 2D5B8 800521B8 8FB30054 */  lw        $s3, 0x54($sp)
/* 2D5BC 800521BC 8FB20050 */  lw        $s2, 0x50($sp)
/* 2D5C0 800521C0 8FB1004C */  lw        $s1, 0x4C($sp)
/* 2D5C4 800521C4 8FB00048 */  lw        $s0, 0x48($sp)
/* 2D5C8 800521C8 03E00008 */  jr        $ra
/* 2D5CC 800521CC 27BD0070 */   addiu    $sp, $sp, 0x70

### DECOMPILED C INSTRUCTIONS:

void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
    u8 isVolumeChanged[16];
    u8 isPitchChanged[16];
    AuGlobals* globals;
    u8 fadeVolChanged;
    AmbienceVoiceState* voiceState;
    AuVoice* voice;
    BGMDrumInfo* drum;
    u32 trackIdx;
    s32 temp;
    s32 i;
    u16 bankPatch;
    u32 count;
    s32 loopId;
    u8 op, arg1, arg2;
    AmbienceTrack* track;

    globals = manager->globals;
    fadeVolChanged = FALSE;
    for (i = 0; i < 16U; i++) { // required to use unsigned literal
        isVolumeChanged[i] = FALSE;
        isPitchChanged[i] = FALSE;
    }

    if (player->resetRequired == TRUE) {
        au_amb_player_stop(manager, player);
        player->resetRequired = FALSE;
    }

    if (player->fadeTime != 0) {
        player->fadeVolume += player->fadeStep;
        player->fadeTime--;
        if (player->fadeTime == 0) {
            player->fadeVolume = player->fadeGoal << 0x18;
            if (player->fadeSettingsType == AMB_FADE_IN) {
                // do nothing
            } else if (player->fadeSettingsType == AMB_FADE_OUT) {
                player->mseqReadPos = BlankMseqData;
                player->delay = 1;
            } else if (player->fadeSettingsType == AMB_FADE_OUT_PAUSING) {
                player->mode = AMB_MODE_PAUSING;
            }
        }
        fadeVolChanged = TRUE;
    }

    // update pitch
    for (trackIdx = 0; trackIdx < ARRAY_COUNT(player->tracks); trackIdx++) {
        track = &player->tracks[trackIdx];
        if (track->tuneLerp.time != 0) {
            track->tuneLerp.time--;
            if (track->tuneLerp.time != 0) {
                track->tuneLerp.current += track->tuneLerp.step;
            } else {
                track->tuneLerp.current = track->tuneLerp.goal << 0x10;
            }

            temp = player->id.all + (trackIdx << 0x10);
            for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
                voiceState = &manager->voiceStates[i - player->firstVoiceIdx];
                // update all voices belonging to current track
                if ((voiceState->info.all & 0xFFFF0000) == temp) {
                    voice = &globals->voices[i];
                    if (voice->priority == manager->priority && trackIdx != TRACK_ID_DRUM) {
                        voice->pitchRatio = au_compute_pitch_ratio(voiceState->pitch + (track->tuneLerp.current >> 0x10)) * track->instrument->pitchRatio;
                        voice->syncFlags |= AU_VOICE_SYNC_FLAG_PITCH;
                        isPitchChanged[i - player->firstVoiceIdx] = TRUE;
                    }
                }
            }
        }
    }

    // update volume
    for (trackIdx = 0; trackIdx < ARRAY_COUNT(player->tracks); trackIdx++) {
        track = &player->tracks[trackIdx];
        if (track->volumeLerp.time != 0) {
            track->volumeLerp.time--;
            if (track->volumeLerp.time != 0) {
                track->volumeLerp.current += track->volumeLerp.step;
            } else {
                track->volumeLerp.current = track->volumeLerp.goal << 0x10;
            }

            temp = player->id.all + (trackIdx << 0x10);
            for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
                voiceState = &manager->voiceStates[i - player->firstVoiceIdx];
                // update all voices belonging to current track
                if ((voiceState->info.all & 0xFFFF0000) == temp) {
                    voice = &globals->voices[i];
                    if (voice->priority == manager->priority) {
                        track = &player->tracks[voiceState->info.trackIndex];
                        voice->clientVolume = ((player->fadeVolume >> 0x18) * (track->volumeLerp.current >> 0x10) * voiceState->volume) >> 0xE;
                        voice->envelopeFlags |= AU_VOICE_ENV_FLAG_VOL_CHANGED;
                    }
                }
            }
        }
    }

    player->delay--;
    if (player->delay <= 0) {
        while (player->delay == 0) {
            op = au_amb_read_next(player);
            if ((s8)op >= 0) {
                if (op == 0) {
                    // stop
                    player->mseqReadPos = NULL;
                    player->mseqName = 0;
                    au_amb_player_stop(manager, player);
                    break;
                }
                if (op >= 0x78) {
                    // long delay
                    player->delay = ((op & 7) << 8) + au_amb_read_next(player) + 0x78;
                } else {
                    //short delay
                    player->delay = op;
                }
                continue;
            }

            // op >= 0x80
            // op & 0xF0 : command
            // op & 0xF : track index

            arg1 = au_amb_read_next(player);
            trackIdx = op & 0xF;
            track = &player->tracks[trackIdx];

            switch (op & 0xF0) {
                case MSEQ_CMD_80_STOP_SOUND:
                    // arg1: sound index
                    if (player->playState == AMB_PLAYER_PLAYING) {
                        temp = player->id.all + (trackIdx << 0x10) + (arg1 << 8);
                        for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
                            if (manager->voiceStates[i - player->firstVoiceIdx].info.all == temp) {
                                manager->voiceStates[i - player->firstVoiceIdx].info.released = 1;
                                voice = &globals->voices[i];
                                if (voice->priority == manager->priority) {
                                    voice->envelopeFlags |= AU_VOICE_ENV_FLAG_KEY_RELEASED;
                                }
                            }
                        }
                    }
                    break;
                case MSEQ_CMD_90_PLAY_SOUND:
                    // arg1: pitch or drum sound id
                    // arg2: volume
                    arg2 = au_amb_read_next(player);
                    if (player->playState == AMB_PLAYER_PLAYING) {
                        // find free voice
                        for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
                            voice = &globals->voices[i];
                            if (voice->priority == AU_PRIORITY_FREE) {
                                break;
                            }
                        }
                        if (i >= player->lastVoiceIdx) {
                            // use another ambience voice
                            for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
                                voice = &globals->voices[i];
                                if (voice->priority == manager->priority) {
                                    au_reset_voice(voice, i);
                                    break;
                                }
                            }
                        }
                        if (i >= player->lastVoiceIdx) {
                            // try stealing voice with lower priority
                            for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
                                voice = &globals->voices[i];
                                if (voice->priority < manager->priority) {
                                    au_reset_voice(voice, i);
                                    break;
                                }
                            }
                        }
                        if (i < player->lastVoiceIdx) {
                            isVolumeChanged[i - player->firstVoiceIdx] = TRUE;
                            isPitchChanged[i - player->firstVoiceIdx] = TRUE;
                            voiceState = &manager->voiceStates[i - player->firstVoiceIdx];
                            // set playerIndex, trackIndex and tune
                            voiceState->info.all = player->id.all + (trackIdx << 0x10) + (arg1 << 8);
                            if (track->flags & 1) {
                                voiceState->isResumable = TRUE;
                            } else {
                                voiceState->isResumable = FALSE;
                            }
                            if (trackIdx != TRACK_ID_DRUM) {
                                if (track->flags & 1) {
                                    voiceState->isResumable = TRUE;
                                } else {
                                    voiceState->isResumable = FALSE;
                                }

                                voiceState->pitch = (arg1 & 0x7F) * 100 - track->instrument->keyBase;
                                voiceState->volume = arg2 & 0x7F;
                                voice->clientVolume = ((player->fadeVolume >> 0x18) * (track->volumeLerp.current >> 0x10) * voiceState->volume) >> 0xE;
                                voice->pitchRatio = au_compute_pitch_ratio(voiceState->pitch + (track->tuneLerp.current >> 0x10)) * track->instrument->pitchRatio;
                                voice->pan = track->pan;
                                voice->reverb = track->reverb;
                                voice->instrument = track->instrument;
                                voice->busId = manager->busId;
                                voice->envelope.cmdListPress = track->envelope.cmdListPress;
                                voice->envelope.cmdListRelease = track->envelope.cmdListRelease;
                            } else {
                                voiceState->isResumable = FALSE;
                                drum = &manager->globals->dataPER->drums[arg1 & 0x7F];
                                bankPatch = drum->bankPatch;
                                voice->instrument = au_get_instrument(manager->globals, bankPatch >> 8, bankPatch & 0xFF, &voice->envelope);
                                voiceState->pitch = drum->keyBase - voice->instrument->keyBase;
                                voiceState->volume = ((arg2 & 0x7F) * drum->volume) >> 7;
                                voice->clientVolume = ((player->fadeVolume >> 0x18) * (track->volumeLerp.current >> 0x10) * voiceState->volume) >> 0xE;
                                voice->pitchRatio = au_compute_pitch_ratio(voiceState->pitch) * voice->instrument->pitchRatio;
                                voice->pan = drum->pan;
                                voice->reverb = drum->reverb;
                                voice->busId = manager->busId;
                            }
                            voice->syncFlags = AU_VOICE_SYNC_FLAG_ALL;
                            voice->priority = manager->priority;
                            voice->clientPriority = voice->priority;
                        }
                    }
                    break;
                case MSEQ_CMD_A0_SET_VOLUME_PAN:
                    // higher bit: set pan (1) or volume (0)
                    // lower 7 bits: value
                    if (arg1 & 0x80) {
                        track->pan = arg1 & 0x7F;
                        temp = player->id.all + (trackIdx << 0x10);
                        for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
                            voiceState = &manager->voiceStates[i - player->firstVoiceIdx];
                            if ((voiceState->info.all & 0xFFFF0000) == temp) {
                                voice = &globals->voices[i];
                                if (voice->priority == manager->priority && trackIdx != TRACK_ID_DRUM) {
                                    voice->pan = track->pan;
                                    voice->syncFlags |= AU_VOICE_SYNC_FLAG_PAN_FXMIX;
                                }
                            }
                        }
                    } else {
                        track->volumeLerp.current = arg1 << 0x18;
                        if (track->volumeLerp.current != 0) {
                            track->volumeLerp.current |= 0xFFFFFF;
                        }
                        temp = player->id.all + (trackIdx << 0x10);
                        for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
                            voiceState = &manager->voiceStates[i - player->firstVoiceIdx];
                            if ((voiceState->info.all & 0xFFFF0000) == temp) {
                                voice = &globals->voices[i];
                                if (voice->priority == manager->priority) {
                                    voice->clientVolume = ((player->fadeVolume >> 0x18) * (track->volumeLerp.current >> 0x10) * voiceState->volume) >> 0xE;
                                    if (!isVolumeChanged[i - player->firstVoiceIdx]) {
                                        voice->envelopeFlags |= AU_VOICE_ENV_FLAG_VOL_CHANGED;
                                        isVolumeChanged[i - player->firstVoiceIdx] = TRUE;
                                    }
                                }
                            }
                        }
                    }
                    break;
                case MSEQ_CMD_B0_MULTI:
                    // arg1: sub command
                    // arg2: depends on sub command
                    arg2 = au_amb_read_next(player);
                    switch (arg1) {
                        case MSEQ_CMD_SUB_66_START_LOOP:
                            // arg2: loop id
                            player->loopStartPos[arg2 & 1] = player->mseqReadPos;
                            break;
                        case MSEQ_CMD_SUB_67_END_LOOP:
                            // arg2 lower bit: loop id
                            // (arg2 & 0x7C) >> 2: loop count
                            loopId = arg2 & 1;
                            count = (arg2 & 0x7C) >> 2;
                            if (count != 0) {
                                if (player->loopCount[loopId] != 0) {
                                    player->loopCount[loopId]--;
                                    // if it's the last iteration then don't jump to the loop start
                                    if (player->loopCount[loopId] != 0) {
                                        player->mseqReadPos = player->loopStartPos[loopId];
                                    }
                                } else {
                                    // first iteration, set loop counter
                                    player->mseqReadPos = player->loopStartPos[loopId];
                                    player->loopCount[loopId] = count;
                                }
                            } else {
                                // infinite loop
                                player->mseqReadPos = player->loopStartPos[loopId];
                                player->loopCount[loopId] = 0;
                            }
                            break;
                        case MSEQ_CMD_SUB_68_SET_REVERB:
                            track->reverb = arg2;
                            break;
                        case MSEQ_CMD_SUB_69_SET_RESUMABLE:
                            if (arg2 == 1) {
                                track->flags |= 1;
                            }
                            break;
                    }
                    break;
                case MSEQ_CMD_C0_SET_INSTRUMENT:
                    // arg1: bank
                    // arg2: patch
                    arg2 = au_amb_read_next(player);
                    if (trackIdx != TRACK_ID_DRUM) {
                        track->instrument = au_get_instrument(manager->globals, arg1, arg2, &track->envelope);
                    }
                    break;
                case MSEQ_CMD_E0_TUNING:
                    // arg1: coarse tune
                    // arg2: fine tune
                    track->tuneLerp.current = (arg1 << 0x18) + (au_amb_read_next(player) << 0x10);
                    temp = player->id.all + (trackIdx << 0x10);
                    for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
                        voiceState = &manager->voiceStates[i - player->firstVoiceIdx];
                        if ((voiceState->info.all & 0xFFFF0000) == temp) {
                            voice = &globals->voices[i];
                            if (voice->priority == manager->priority && trackIdx != TRACK_ID_DRUM) {
                                voice->pitchRatio = au_compute_pitch_ratio(voiceState->pitch + (track->tuneLerp.current >> 0x10)) * track->instrument->pitchRatio;
                                voice->syncFlags |= AU_VOICE_SYNC_FLAG_PITCH;
                                isPitchChanged[i - player->firstVoiceIdx] = 1;
                            }
                        }
                    }
                    break;
                case 0xF0: // required to match
                    break;
            }
        }
    }
    if (fadeVolChanged) {
        for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
            voiceState = &manager->voiceStates[i - player->firstVoiceIdx];
            // update all voices belonging to this player
            if ((voiceState->info.all & 0xFF000000) == player->id.all) {
                voice = &globals->voices[i];
                if (voice->priority == manager->priority && !isVolumeChanged[i - player->firstVoiceIdx]) {
                    track = &player->tracks[voiceState->info.trackIndex];
                    voice->clientVolume = ((player->fadeVolume >> 0x18) * (track->volumeLerp.current >> 0x10) * voiceState->volume) >> 0xE;
                    voice->envelopeFlags |= AU_VOICE_ENV_FLAG_VOL_CHANGED;
                }
            }
        }
    }
}