LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/mix.c
// Function: MV_Mix8BitStereo16
void MV_Mix8BitStereo16( unsigned int position, unsigned int rate,
                        char *start, unsigned int length )
{
    signed char *source = (signed char *) start + 1;
    unsigned char *dest = (unsigned char *) MV_MixDestination;
    int sample0, sample1;
    
    while (length--) {
        sample0 = source[(position >> 16) << 1];
        sample1 = sample0;
        position += rate;
        
        sample0 = MV_LeftVolume[sample0 + 128] + *dest;
        sample1 = MV_RightVolume[sample1 + 128] + *(dest + MV_RightChannelOffset);
        sample0 = MV_HarshClipTable[sample0 + 128];
        sample1 = MV_HarshClipTable[sample1 + 128];
        
        *dest = sample0 & 255;
        *(dest + MV_RightChannelOffset) = sample1 & 255;
        
        dest += MV_SampleSize;
    }
    
    MV_MixPosition = position;
    MV_MixDestination = (char *) dest;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0x12dff(%rip), %rax     # 0x18528
movq (%rax), %r8
leaq 0x11d15(%rip), %r9      # 0x17448
leaq 0x11d06(%rip), %r10     # 0x17440
leaq 0x12d3b(%rip), %r11     # 0x1847c
leaq 0x12dd8(%rip), %rbx     # 0x18520
leaq 0x9ad1(%rip), %r14      # 0xf220
subl $0x1, %ecx
jb 0x57b2
movl %edi, %r15d
shrl $0x10, %r15d
movsbq 0x1(%rdx,%r15,2), %r15
addl %esi, %edi
movq (%r9), %r12
movswq 0x100(%r12,%r15,2), %r12
movzbl (%r8), %r13d
movq (%r10), %rbp
movswq 0x100(%rbp,%r15,2), %r15
movslq (%r11), %rbp
movzbl (%r8,%rbp), %ebp
movq (%rbx), %rax
addq %rax, %r12
movb 0x80(%r13,%r12), %r12b
addq %rax, %r15
movb 0x80(%rbp,%r15), %al
movb %r12b, (%r8)
movslq (%r11), %r15
movb %al, (%r8,%r15)
movslq (%r14), %rax
addq %rax, %r8
jmp 0x574f
leaq 0x12d77(%rip), %rax     # 0x18530
movl %edi, (%rax)
leaq 0x12d66(%rip), %rax     # 0x18528
movq %r8, (%rax)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/mix.c
// Function: MV_Mix16BitStereo16
void MV_Mix16BitStereo16( unsigned int position, unsigned int rate,
                         char *start, unsigned int length )
{
    unsigned short *source = (unsigned short *) start;
    short *dest = (short *) MV_MixDestination;
    int sample0l, sample0h, sample0;
    int sample1l, sample1h, sample1;
    
    while (length--) {
        sample0 = source[position >> 16];
#ifdef BIGENDIAN
        sample0l = sample0 >> 8;
        sample0h = (sample0 & 255) ^ 128;
#else
        sample0l = sample0 & 255;
        sample0h = (sample0 >> 8) ^ 128;
#endif
        sample1l = sample0l;
        sample1h = sample0h;
        position += rate;
        
        sample0l = MV_LeftVolume[sample0l] >> 8;
        sample0h = MV_LeftVolume[sample0h];
        sample1l = MV_RightVolume[sample1l] >> 8;
        sample1h = MV_RightVolume[sample1h];
        sample0 = sample0l + sample0h + 128 + *dest;
        sample1 = sample1l + sample1h + 128 + *(dest + MV_RightChannelOffset/2);
        if (sample0 < -32768) sample0 = -32768;
        else if (sample0 > 32767) sample0 = 32767;
        if (sample1 < -32768) sample1 = -32768;
        else if (sample1 > 32767) sample1 = 32767;
        
        *dest = (short) sample0;
        *(dest + MV_RightChannelOffset/2) = (short) sample1;
        
        dest += MV_SampleSize / 2;
    }
    
    MV_MixPosition = position;
    MV_MixDestination = (char *) dest;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, -0x8(%rsp)
leaq 0x12d42(%rip), %rax     # 0x18528
movq (%rax), %r10
leaq 0x11c58(%rip), %rax     # 0x17448
movq (%rax), %r11
leaq 0x11c46(%rip), %rax     # 0x17440
movq (%rax), %rbx
leaq 0x12c78(%rip), %rax     # 0x1847c
movl (%rax), %eax
movl $0x2, %r9d
cltd
idivl %r9d
movslq %eax, %r14
leaq 0x9a06(%rip), %rax      # 0xf220
movl (%rax), %eax
cltd
idivl %r9d
cltq
addq %rax, %rax
movl $0x80, %edx
movl $0xffff8001, %ebp       # imm = 0xFFFF8001
subl $0x1, %ecx
jb 0x58d5
movl %edi, %r9d
shrl $0x10, %r9d
movq -0x8(%rsp), %r8
movzwl (%r8,%r9,2), %r12d
movzbl %r12b, %r13d
addl %r13d, %r13d
movsbl 0x1(%r11,%r13), %r9d
shrl $0x7, %r12d
andl $-0x2, %r12d
xorl $0x100, %r12d           # imm = 0x100
movswl (%r11,%r12), %r8d
movswl (%r10), %r15d
addl %r9d, %r15d
addl %r8d, %r15d
addl %edx, %r15d
movl $0x7fff, %r9d           # imm = 0x7FFF
cmpl %r9d, %r15d
jl 0x5888
movl $0x7fff, %r15d          # imm = 0x7FFF
cmpl %ebp, %r15d
jge 0x5893
movl $0xffff8000, %r15d      # imm = 0xFFFF8000
movsbl 0x1(%rbx,%r13), %r8d
movswl (%rbx,%r12), %r13d
movswl (%r10,%r14,2), %r12d
addl %r8d, %r12d
addl %r13d, %r12d
addl %edx, %r12d
cmpl %r9d, %r12d
jl 0x58b7
movl $0x7fff, %r12d          # imm = 0x7FFF
cmpl %ebp, %r12d
jge 0x58c2
movl $0xffff8000, %r12d      # imm = 0xFFFF8000
addl %esi, %edi
movw %r15w, (%r10)
movw %r12w, (%r10,%r14,2)
addq %rax, %r10
jmp 0x582f
leaq 0x12c54(%rip), %rax     # 0x18530
movl %edi, (%rax)
leaq 0x12c43(%rip), %rax     # 0x18528
movq %r10, (%rax)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/mixst.c
// Function: MV_Mix8BitMono8Stereo
void MV_Mix8BitMono8Stereo( unsigned int position, unsigned int rate,
                    char *start, unsigned int length )
{
    unsigned char *source = (unsigned char *) start;
    unsigned char *dest = (unsigned char *) MV_MixDestination;
    int sample0, sample1;
    
    while (length--) {
        sample0 = source[(position >> 16) << 1];
        sample1 = source[((position >> 16) << 1) + 1];
        position += rate;
        
        sample0 = (MV_LeftVolume[sample0] + MV_LeftVolume[sample1]) / 2 + *dest;
        sample0 = MV_HarshClipTable[sample0 + 128];
        
        *dest = sample0 & 255;
        
        dest += MV_SampleSize;
    }
    
    MV_MixPosition = position;
    MV_MixDestination = (char *) dest;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r8
leaq 0x12b7b(%rip), %r9      # 0x18528
movq (%r9), %r10
leaq 0x11a91(%rip), %r11     # 0x17448
movl $0x2, %ebx
leaq 0x12b5d(%rip), %r14     # 0x18520
leaq 0x9856(%rip), %r15      # 0xf220
subl $0x1, %ecx
jb 0x5a19
movl %edi, %eax
shrl $0xf, %eax
movl %eax, %edx
andl $-0x2, %edx
movzbl (%r8,%rdx), %edx
orq $0x1, %rax
movzbl (%r8,%rax), %eax
addl %esi, %edi
movq (%r11), %r12
movswl (%r12,%rdx,2), %edx
movswl (%r12,%rax,2), %eax
addl %edx, %eax
cltd
idivl %ebx
movzbl (%r10), %edx
cltq
addq %rdx, %rax
movq (%r14), %rdx
movb 0x80(%rdx,%rax), %al
movb %al, (%r10)
movslq (%r15), %rax
addq %rax, %r10
jmp 0x59ca
leaq 0x12b10(%rip), %rax     # 0x18530
movl %edi, (%rax)
movq %r10, (%r9)
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/mixst.c
// Function: MV_Mix8BitStereo8Stereo
void MV_Mix8BitStereo8Stereo( unsigned int position, unsigned int rate,
                      char *start, unsigned int length )
{
    unsigned char *source = (unsigned char *) start;
    unsigned char *dest = (unsigned char *) MV_MixDestination;
    int sample0, sample1;
    
    while (length--) {
        sample0 = source[(position >> 16) << 1];
        sample1 = source[((position >> 16) << 1) + 1];
        position += rate;
        
        sample0 = MV_LeftVolume[sample0] + *dest;
        sample1 = MV_RightVolume[sample1] + *(dest + MV_RightChannelOffset);
        sample0 = MV_HarshClipTable[sample0 + 128];
        sample1 = MV_HarshClipTable[sample1 + 128];
        
        *dest = sample0 & 255;
        *(dest + MV_RightChannelOffset) = sample1 & 255;
        
        dest += MV_SampleSize;
    }
    
    MV_MixPosition = position;
    MV_MixDestination = (char *) dest;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0x12aea(%rip), %rax     # 0x18528
movq (%rax), %r8
leaq 0x11a00(%rip), %r9      # 0x17448
leaq 0x119f1(%rip), %r10     # 0x17440
leaq 0x12a26(%rip), %r11     # 0x1847c
leaq 0x12ac3(%rip), %rbx     # 0x18520
leaq 0x97bc(%rip), %r14      # 0xf220
subl $0x1, %ecx
jb 0x5ad0
movl %edi, %r15d
shrl $0xf, %r15d
movl %r15d, %r12d
andl $-0x2, %r12d
movzbl (%rdx,%r12), %r12d
orq $0x1, %r15
movzbl (%rdx,%r15), %r15d
addl %esi, %edi
movq (%r9), %r13
movswq (%r13,%r12,2), %r12
movzbl (%r8), %r13d
movq (%r10), %rbp
movswq (%rbp,%r15,2), %r15
movslq (%r11), %rbp
movzbl (%r8,%rbp), %ebp
movq (%rbx), %rax
addq %rax, %r12
movb 0x80(%r13,%r12), %r12b
addq %rax, %r15
movb 0x80(%rbp,%r15), %al
movb %r12b, (%r8)
movslq (%r11), %r15
movb %al, (%r8,%r15)
movslq (%r14), %rax
addq %rax, %r8
jmp 0x5a64
leaq 0x12a59(%rip), %rax     # 0x18530
movl %edi, (%rax)
leaq 0x12a48(%rip), %rax     # 0x18528
movq %r8, (%rax)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/mixst.c
// Function: MV_Mix16BitMono8Stereo
void MV_Mix16BitMono8Stereo( unsigned int position, unsigned int rate,
                     char *start, unsigned int length )
{
    unsigned char *source = (unsigned char *) start;
    short *dest = (short *) MV_MixDestination;
    int sample0, sample1;
    
    while (length--) {
        sample0 = source[(position >> 16) << 1];
        sample1 = source[((position >> 16) << 1) + 1];
        position += rate;
        
        sample0 = (MV_LeftVolume[sample0] + MV_LeftVolume[sample1]) / 2 + *dest;
        if (sample0 < -32768) sample0 = -32768;
        else if (sample0 > 32767) sample0 = 32767;
        
        *dest = (short) sample0;
        
        dest += MV_SampleSize / 2;
    }
    
    MV_MixPosition = position;
    MV_MixDestination = (char *) dest;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %r8
leaq 0x12a2c(%rip), %r9      # 0x18528
movq (%r9), %r10
leaq 0x11942(%rip), %rax     # 0x17448
movq (%rax), %r11
leaq 0x9710(%rip), %rax      # 0xf220
movl (%rax), %eax
movl $0x2, %ebx
cltd
idivl %ebx
movslq %eax, %r14
addq %r14, %r14
subl $0x1, %ecx
jb 0x5b70
movl %edi, %eax
shrl $0xf, %eax
movl %eax, %edx
andl $-0x2, %edx
movzbl (%r8,%rdx), %edx
orq $0x1, %rax
movzbl (%r8,%rax), %eax
movswl (%r11,%rdx,2), %edx
movswl (%r11,%rax,2), %eax
addl %edx, %eax
cltd
idivl %ebx
movzwl (%r10), %edx
leal (%rax,%rdx), %ebp
movswl %bp, %ebp
sarl $0xf, %ebp
xorl $0xffff8000, %ebp       # imm = 0xFFFF8000
addw %dx, %ax
cmovol %ebp, %eax
addl %esi, %edi
movw %ax, (%r10)
addq %r14, %r10
jmp 0x5b20
leaq 0x129b9(%rip), %rax     # 0x18530
movl %edi, (%rax)
movq %r10, (%r9)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/mixst.c
// Function: MV_Mix16BitStereo8Stereo
void MV_Mix16BitStereo8Stereo( unsigned int position, unsigned int rate,
                       char *start, unsigned int length )
{
    unsigned char *source = (unsigned char *) start;
    short *dest = (short *) MV_MixDestination;
    int sample0, sample1;
    
    while (length--) {
        sample0 = source[(position >> 16) << 1];
        sample1 = source[((position >> 16) << 1) + 1];
        position += rate;
        
        sample0 = MV_LeftVolume[sample0] + *dest;
        sample1 = MV_RightVolume[sample1] + *(dest + MV_RightChannelOffset / 2);
        if (sample0 < -32768) sample0 = -32768;
        else if (sample0 > 32767) sample0 = 32767;
        if (sample1 < -32768) sample1 = -32768;
        else if (sample1 > 32767) sample1 = 32767;
        
        *dest = (short) sample0;
        *(dest + MV_RightChannelOffset/2) = (short) sample1;
        
        dest += MV_SampleSize / 2;
    }
    
    MV_MixPosition = position;
    MV_MixDestination = (char *) dest;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r8
leaq 0x12993(%rip), %r9      # 0x18528
movq (%r9), %r10
leaq 0x118a9(%rip), %rax     # 0x17448
movq (%rax), %r11
leaq 0x11897(%rip), %rax     # 0x17440
movq (%rax), %rbx
leaq 0x128c9(%rip), %rax     # 0x1847c
movl (%rax), %eax
movl $0x2, %ebp
cltd
idivl %ebp
movslq %eax, %r14
leaq 0x9659(%rip), %rax      # 0xf220
movl (%rax), %eax
cltd
idivl %ebp
cltq
addq %rax, %rax
movl $0xffff8000, %edx       # imm = 0xFFFF8000
subl $0x1, %ecx
jb 0x5c42
movl %edi, %r12d
shrl $0xf, %r12d
movq %r12, %r15
orq $0x1, %r15
movzbl (%r8,%r15), %r15d
movzwl (%rbx,%r15,2), %r15d
movzwl (%r10,%r14,2), %r13d
leal (%r15,%r13), %ebp
movswl %bp, %ebp
sarl $0xf, %ebp
xorl %edx, %ebp
addw %r13w, %r15w
cmovol %ebp, %r15d
andl $-0x2, %r12d
movzbl (%r8,%r12), %r12d
movzwl (%r11,%r12,2), %r12d
movzwl (%r10), %r13d
leal (%r12,%r13), %ebp
movswl %bp, %ebp
sarl $0xf, %ebp
xorl %edx, %ebp
addw %r13w, %r12w
cmovol %ebp, %r12d
addl %esi, %edi
movw %r12w, (%r10)
movw %r15w, (%r10,%r14,2)
addq %rax, %r10
jmp 0x5bd6
leaq 0x128e7(%rip), %rax     # 0x18530
movl %edi, (%rax)
movq %r10, (%r9)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/mixst.c
// Function: MV_Mix16BitMono16Stereo
void MV_Mix16BitMono16Stereo( unsigned int position, unsigned int rate,
                       char *start, unsigned int length )
{
    unsigned short *source = (unsigned short *) start;
    short *dest = (short *) MV_MixDestination;
    int sample0l, sample0h, sample0;
    int sample1l, sample1h, sample1;
    
    while (length--) {
        sample0 = source[(position >> 16) << 1];
        sample1 = source[((position >> 16) << 1) + 1];
#ifdef BIGENDIAN
        sample0l = sample0 >> 8;
        sample0h = (sample0 & 255) ^ 128;
        sample1l = sample1 >> 8;
        sample1h = (sample1 & 255) ^ 128;
#else
        sample0l = sample0 & 255;
        sample0h = (sample0 >> 8) ^ 128;
        sample1l = sample1 & 255;
        sample1h = (sample1 >> 8) ^ 128;
#endif
        position += rate;
        
        sample0l = MV_LeftVolume[sample0l] >> 8;
        sample0h = MV_LeftVolume[sample0h];
        sample0 = sample0l + sample0h + 128;
        sample1l = MV_LeftVolume[sample1l] >> 8;
        sample1h = MV_LeftVolume[sample1h];
        sample1 = sample1l + sample1h + 128;
        
        sample0 = (sample0 + sample1) / 2 + *dest;
        if (sample0 < -32768) sample0 = -32768;
        else if (sample0 > 32767) sample0 = 32767;
        
        *dest = (short) sample0;
        
        dest += MV_SampleSize / 2;
    }
    
    MV_MixPosition = position;
    MV_MixDestination = (char *) dest;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r8
leaq 0x128bb(%rip), %r9      # 0x18528
movq (%r9), %r10
leaq 0x117d1(%rip), %rax     # 0x17448
movq (%rax), %r11
leaq 0x959f(%rip), %rax      # 0xf220
movl (%rax), %eax
movl $0x2, %ebx
cltd
idivl %ebx
movslq %eax, %r14
addq %r14, %r14
movl $0xff, %ebp
movl $0x100, %r15d           # imm = 0x100
subl $0x1, %ecx
jb 0x5d30
movl %edi, %eax
shrl $0xe, %eax
movl %eax, %edx
andl $-0x4, %edx
movzwl (%r8,%rdx), %edx
orl $0x2, %eax
andl $-0x2, %eax
movzwl (%r8,%rax), %r12d
movl %edx, %eax
andl %ebp, %eax
movl %r12d, %r13d
andl %ebp, %r13d
movsbl 0x1(%r11,%rax,2), %eax
shrl $0x7, %edx
andl $-0x2, %edx
xorl %r15d, %edx
movswl (%r11,%rdx), %edx
addl %eax, %edx
movsbl 0x1(%r11,%r13,2), %eax
shrl $0x7, %r12d
andl $-0x2, %r12d
xorl %r15d, %r12d
movswl (%r11,%r12), %r12d
addl %edx, %r12d
addl %r15d, %eax
addl %r12d, %eax
cltd
idivl %ebx
movswl (%r10), %edx
addl %eax, %edx
movl $0x7fff, %eax           # imm = 0x7FFF
cmpl %eax, %edx
jl 0x5d15
movl $0x7fff, %edx           # imm = 0x7FFF
cmpl $0xffff8001, %edx       # imm = 0xFFFF8001
jge 0x5d22
movl $0xffff8000, %edx       # imm = 0xFFFF8000
addl %esi, %edi
movw %dx, (%r10)
addq %r14, %r10
jmp 0x5c9c
leaq 0x127f9(%rip), %rax     # 0x18530
movl %edi, (%rax)
movq %r10, (%r9)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/mixst.c
// Function: MV_Mix8BitMono16Stereo
void MV_Mix8BitMono16Stereo( unsigned int position, unsigned int rate,
                      char *start, unsigned int length )
{
    signed char *source = (signed char *) start + 1;
    unsigned char *dest = (unsigned char *) MV_MixDestination;
    int sample0, sample1;
    
    while (length--) {
        sample0 = source[(position >> 16) << 2];
        sample1 = source[((position >> 16) << 2) + 2];
        position += rate;
        
        sample0 = MV_LeftVolume[sample0 + 128];
        sample1 = MV_LeftVolume[sample1 + 128];
        sample0 = (sample0 + sample1) / 2 + *dest;
        sample0 = MV_HarshClipTable[sample0 + 128];
        
        *dest = sample0 & 255;
        
        dest += MV_SampleSize;
    }
    
    MV_MixPosition = position;
    MV_MixDestination = (char *) dest;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r8
leaq 0x127d0(%rip), %r9      # 0x18528
movq (%r9), %r10
leaq 0x116e6(%rip), %r11     # 0x17448
movl $0x2, %ebx
leaq 0x127b2(%rip), %r14     # 0x18520
leaq 0x94ab(%rip), %r15      # 0xf220
subl $0x1, %ecx
jb 0x5dc5
movl %edi, %eax
shrl $0x10, %eax
movsbq 0x1(%r8,%rax,4), %rdx
movsbq 0x3(%r8,%rax,4), %rax
addl %esi, %edi
movq (%r11), %r12
movswl 0x100(%r12,%rdx,2), %edx
movswl 0x100(%r12,%rax,2), %eax
addl %edx, %eax
cltd
idivl %ebx
movzbl (%r10), %edx
cltq
addq %rdx, %rax
movq (%r14), %rdx
movb 0x80(%rdx,%rax), %al
movb %al, (%r10)
movslq (%r15), %rax
addq %rax, %r10
jmp 0x5d75
leaq 0x12764(%rip), %rax     # 0x18530
movl %edi, (%rax)
movq %r10, (%r9)
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/mixst.c
// Function: MV_Mix8BitStereo16Stereo
void MV_Mix8BitStereo16Stereo( unsigned int position, unsigned int rate,
                        char *start, unsigned int length )
{
    signed char *source = (signed char *) start + 1;
    unsigned char *dest = (unsigned char *) MV_MixDestination;
    int sample0, sample1;
    
    while (length--) {
        sample0 = source[(position >> 16) << 2];
        sample1 = source[((position >> 16) << 2) + 2];
        position += rate;
        
        sample0 = MV_LeftVolume[sample0 + 128] + *dest;
        sample1 = MV_RightVolume[sample1 + 128] + *(dest + MV_RightChannelOffset);
        sample0 = MV_HarshClipTable[sample0 + 128];
        sample1 = MV_HarshClipTable[sample1 + 128];
        
        *dest = sample0 & 255;
        *(dest + MV_RightChannelOffset) = sample1 & 255;
        
        dest += MV_SampleSize;
    }
    
    MV_MixPosition = position;
    MV_MixDestination = (char *) dest;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0x1273e(%rip), %rax     # 0x18528
movq (%rax), %r8
leaq 0x11654(%rip), %r9      # 0x17448
leaq 0x11645(%rip), %r10     # 0x17440
leaq 0x1267a(%rip), %r11     # 0x1847c
leaq 0x12717(%rip), %rbx     # 0x18520
leaq 0x9410(%rip), %r14      # 0xf220
subl $0x1, %ecx
jb 0x5e79
movl %edi, %r15d
shrl $0x10, %r15d
movsbq 0x1(%rdx,%r15,4), %r12
movsbq 0x3(%rdx,%r15,4), %r15
addl %esi, %edi
movq (%r9), %r13
movswq 0x100(%r13,%r12,2), %r12
movzbl (%r8), %r13d
movq (%r10), %rbp
movswq 0x100(%rbp,%r15,2), %r15
movslq (%r11), %rbp
movzbl (%r8,%rbp), %ebp
movq (%rbx), %rax
addq %rax, %r12
movb 0x80(%r13,%r12), %r12b
addq %rax, %r15
movb 0x80(%rbp,%r15), %al
movb %r12b, (%r8)
movslq (%r11), %r15
movb %al, (%r8,%r15)
movslq (%r14), %rax
addq %rax, %r8
jmp 0x5e10
leaq 0x126b0(%rip), %rax     # 0x18530
movl %edi, (%rax)
leaq 0x1269f(%rip), %rax     # 0x18528
movq %r8, (%rax)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/vorbis.c
// Function: MV_PlayVorbis3D
int MV_PlayVorbis3D
(
 char *ptr,
 unsigned int ptrlength,
 int  pitchoffset,
 int  angle,
 int  distance,
 int  priority,
 unsigned int callbackval
 )

{
   int left;
   int right;
   int mid;
   int volume;
   int status;
   
   if ( !MV_Installed )
   {
      MV_SetErrorCode( MV_NotInstalled );
      return( MV_Error );
   }
   
   if ( distance < 0 )
   {
      distance  = -distance;
      angle    += MV_NumPanPositions / 2;
   }
   
   volume = MIX_VOLUME( distance );
   
   // Ensure angle is within 0 - 31
   angle &= MV_MaxPanPosition;
   
   left  = MV_PanTable[ angle ][ volume ].left;
   right = MV_PanTable[ angle ][ volume ].right;
   mid   = max( 0, 255 - distance );
   
   status = MV_PlayVorbis( ptr, ptrlength, pitchoffset, mid, left, right, priority,
                           callbackval );
   
   return( status );
}

// Assembly:
movl %r9d, %eax
leaq 0x928e(%rip), %r9       # 0xf2e0
cmpl $0x0, (%r9)
je 0x60ca
pushq %rbx
movl 0x10(%rsp), %r11d
movl %r8d, %r9d
negl %r9d
cmovsl %r8d, %r9d
shrl $0x1b, %r8d
andl $-0x10, %r8d
addl %ecx, %r8d
movl $0xff, %ecx
movl %r9d, %ebx
subl %ecx, %ebx
cmovael %ecx, %r9d
negl %ebx
leaq 0x9192(%rip), %rcx      # 0xf21c
movl (%rcx), %ecx
incl %ecx
imull %r9d, %ecx
sarl $0x8, %ecx
andl $0x1f, %r8d
movslq %ecx, %rcx
shll $0x7, %r8d
addq 0x8f21(%rip), %r8       # 0xefc8
movzbl (%r8,%rcx,2), %r10d
movzbl 0x1(%r8,%rcx,2), %r9d
xorl %ecx, %ecx
testl %ebx, %ebx
cmovgl %ebx, %ecx
movl %r10d, %r8d
pushq %r11
pushq %rax
callq 0x60db
addq $0x10, %rsp
popq %rbx
retq
leaq 0x9213(%rip), %rax      # 0xf2e4
movl $0x2, (%rax)
pushq $-0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/vorbis.c
// Function: MV_ReleaseVorbisVoice
void MV_ReleaseVorbisVoice( VoiceNode * voice )
{
   vorbis_data * vd = (vorbis_data *) voice->extra;
   
   if (voice->wavetype != Vorbis) {
      return;
   }
   
   ov_clear(&vd->vf);
   free(vd);
   
   voice->extra = 0;
}

// Assembly:
cmpl $0x4, 0x10(%rdi)
jne 0x64e0
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x88(%rdi), %r14
leaq 0x18(%r14), %rdi
callq 0x2100
movq %r14, %rdi
callq 0x2280
andq $0x0, 0x88(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/vorbis.c
// Function: read_vorbis
static size_t read_vorbis(void * ptr, size_t size, size_t nmemb, void * datasource)
{
   vorbis_data * vorb = (vorbis_data *) datasource;
   size_t nread = 0;
   size_t bytes, woffset = 0;

   errno = 0;

   if (vorb->length == vorb->pos) {
      return 0;
   }
   
   for (; nmemb > 0; nmemb--, nread++) {
      bytes = vorb->length - vorb->pos;
      if (size < bytes) {
         bytes = size;
      }

      memcpy((char *)ptr + woffset, vorb->ptr + vorb->pos, bytes);
      vorb->pos += bytes;
      woffset += bytes;

      if (vorb->length == vorb->pos) {
         nread++;
         break;
      }
   }
   
   return nread;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, (%rsp)
callq 0x2040
andl $0x0, (%rax)
movq 0x8(%r14), %rax
movq 0x10(%r14), %rsi
cmpq %rsi, %rax
jne 0x6512
xorl %ebx, %ebx
jmp 0x6564
pushq $-0x1
popq %rbp
xorl %r12d, %r12d
leaq (%rbx,%rbp), %rcx
cmpq $-0x1, %rcx
je 0x6564
subq %rsi, %rax
cmpq %r15, %rax
movq %rax, %r13
cmovaeq %r15, %r13
movq (%rsp), %rax
leaq (%rax,%r12), %rdi
addq (%r14), %rsi
movq %r13, %rdx
callq 0x2180
movq 0x10(%r14), %rsi
addq %r13, %rsi
movq %rsi, 0x10(%r14)
movq 0x8(%r14), %rax
cmpq %rsi, %rax
je 0x655e
addq %r13, %r12
decq %rbp
jmp 0x6518
negq %rbp
movq %rbp, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/music.c
// Function: MUSIC_Init
int MUSIC_Init
   (
   int SoundCard,
   const char *params
   )

   {
   int i;
   int status;
   int mincard, maxcard, card;

   for( i = 0; i < 128; i++ )
      {
      MIDI_PatchMap[ i ] = i;
      }

   if (SoundCard == ASS_AutoDetect)
      {
      mincard = ASS_NoSound + 1;
      maxcard = ASS_NumSoundCards - 1;
      }
   else if (SoundCard < 0 || SoundCard >= ASS_NumSoundCards)
      {
      MUSIC_ErrorCode = MUSIC_InvalidCard;
      return MUSIC_Error;
      }
   else
      {
      mincard = SoundCard;
      maxcard = SoundCard;
      }

   for (card = mincard; card <= maxcard; card++)
      {
      if (!SoundDriver_IsMIDISupported(card))
         {
         continue;
         }
      else if (SoundCard == ASS_AutoDetect)
         {
         ASS_Message("MUSIC_Init: trying %s\n", SoundDriver_GetName(card));
         }

      ASS_MIDISoundDriver = card;
      status = SoundDriver_MIDI_Init(&MUSIC_MidiFunctions, params);
      if (status == MUSIC_Ok)
         {
         MIDI_SetMidiFuncs( &MUSIC_MidiFunctions );
         return MUSIC_Ok;
         }
      }

   if (SoundCard == ASS_AutoDetect)
      {
      // A failure to autodetect falls back to no sound.
      ASS_MIDISoundDriver = ASS_NoSound;
      MIDI_SetMidiFuncs( &MUSIC_MidiFunctions );
      return MUSIC_Ok;
      }

   MUSIC_ErrorCode = MUSIC_DriverError;
   return MUSIC_Error;
   }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %ebx
xorl %eax, %eax
leaq 0x120bd(%rip), %rcx     # 0x186d0
cmpq $0x80, %rax
je 0x6623
movb %al, (%rcx,%rax)
incq %rax
jmp 0x6613
cmpl $-0x2, %ebx
jne 0x6631
pushq $0x6
popq %r13
pushq $0x1
popq %rbp
jmp 0x6647
movl %ebx, %ebp
movl %ebx, %r13d
cmpl $0x7, %ebx
jb 0x6647
movl $0x2, 0x11ef3(%rip)     # 0x18538
jmp 0x66bb
leaq 0x8bca(%rip), %r15      # 0xf218
leaq 0x11eeb(%rip), %r12     # 0x18540
cmpl %r13d, %ebp
ja 0x6698
movl %ebp, %edi
callq 0x2af6
testl %eax, %eax
je 0x6694
cmpl $-0x2, %ebx
jne 0x6682
movl %ebp, %edi
callq 0x2b07
leaq 0x3657(%rip), %rdi      # 0x9ccf
movq %rax, %rsi
xorl %eax, %eax
callq 0x813d
movl %ebp, (%r15)
movq %r12, %rdi
movq %r14, %rsi
callq 0x2d76
testl %eax, %eax
je 0x66a1
incl %ebp
jmp 0x6655
cmpl $-0x2, %ebx
jne 0x66b1
andl $0x0, (%r15)
leaq 0x11e98(%rip), %rdi     # 0x18540
callq 0x6c2f
xorl %eax, %eax
jmp 0x66be
movl $0x1, 0x11e7d(%rip)     # 0x18538
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/midi.c
// Function: MIDI_AllNotesOff
int MIDI_AllNotesOff
   (
   void
   )

   {
   int channel;

   SoundDriver_MIDI_Lock();

   for( channel = 0; channel < NUM_MIDI_CHANNELS; channel++ )
      {
      _MIDI_SendControlChange( channel, MIDI_HOLD1, 0 );
      _MIDI_SendControlChange( channel, MIDI_SOSTENUTO, 0 );   // TURRICAN's recommendation
      _MIDI_SendControlChange( channel, MIDI_ALL_NOTES_OFF, 0 );
      _MIDI_SendControlChange( channel, MIDI_ALL_SOUNDS_OFF, 0 );
      }

   SoundDriver_MIDI_Unlock();

   return( MIDI_Ok );
   }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
callq 0x2e02
xorl %ebx, %ebx
pushq $0x40
popq %rbp
pushq $0x42
popq %r14
pushq $0x7b
popq %r15
pushq $0x78
popq %r12
cmpl $0x10, %ebx
je 0x6813
movl %ebx, %edi
movl %ebp, %esi
xorl %edx, %edx
callq 0x6823
movl %ebx, %edi
movl %r14d, %esi
xorl %edx, %edx
callq 0x6823
movl %ebx, %edi
movl %r15d, %esi
xorl %edx, %edx
callq 0x6823
movl %ebx, %edi
movl %r12d, %esi
xorl %edx, %edx
callq 0x6823
incl %ebx
jmp 0x67db
callq 0x2e1e
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/midi.c
// Function: MIDI_SendControlChange
static int _MIDI_SendControlChange
   (
   int channel,
   int c1,
   int c2
   )

   {
   int status;

   if ( _MIDI_RerouteFunctions[ channel ] != NULL )
      {
      status = _MIDI_RerouteFunctions[ channel ]( 0xB0 + channel,
         c1, c2 );
      if ( status == MIDI_DONT_PLAY )
         {
         return( MIDI_Ok );
         }
      }

   if ( _MIDI_Funcs == NULL )
      {
      return( MIDI_Error );
      }

   if ( _MIDI_Funcs->ControlChange == NULL )
      {
      return( MIDI_Error );
      }

   _MIDI_Funcs->ControlChange( channel, c1, c2 );

   return( MIDI_Ok );
   }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebx
movl %esi, %ebp
movl %edi, %r14d
movslq %edi, %rax
leaq 0x11d78(%rip), %rcx     # 0x185b0
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x6852
leal 0xb0(%r14), %edi
movl %ebp, %esi
movl %ebx, %edx
callq *%rax
testl %eax, %eax
je 0x6874
movq 0x11e1f(%rip), %rax     # 0x18678
testq %rax, %rax
je 0x6874
movq 0x18(%rax), %rax
testq %rax, %rax
je 0x6874
movl %r14d, %edi
movl %ebp, %esi
movl %ebx, %edx
popq %rbx
popq %r14
popq %rbp
jmpq *%rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/midi.c
// Function: MIDI_SetUserChannelVolume
void MIDI_SetUserChannelVolume
   (
   int channel,
   int volume
   )

   {
   // Convert channel from 1-16 to 0-15
   channel--;

   volume = max( 0, volume );
   volume = min( volume, 256 );

   if ( ( channel >= 0 ) && ( channel < NUM_MIDI_CHANNELS ) )
      {
      _MIDI_UserChannelVolume[ channel ] = volume;

      SoundDriver_MIDI_Lock();
      _MIDI_SetChannelVolume( channel, _MIDI_ChannelVolume[ channel ] );
      SoundDriver_MIDI_Unlock();
      }
   }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
decl %ebx
cmpl $0xf, %ebx
ja 0x68c8
xorl %eax, %eax
testl %esi, %esi
cmovgl %esi, %eax
movl $0x100, %ecx            # imm = 0x100
cmpl %ecx, %eax
cmovgel %ecx, %eax
movl %ebx, %r14d
leaq 0x89cf(%rip), %rcx      # 0xf270
movl %eax, (%rcx,%r14,4)
callq 0x2e02
leaq 0x11d7f(%rip), %rax     # 0x18630
movl (%rax,%r14,4), %esi
movl %ebx, %edi
callq 0x68d0
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2e1e
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/midi.c
// Function: MIDI_SetChannelVolume
static void _MIDI_SetChannelVolume
   (
   int channel,
   int volume
   )

   {
   int status;
   int remotevolume;

   _MIDI_ChannelVolume[ channel ] = volume;

   if ( _MIDI_RerouteFunctions[ channel ] != NULL )
      {
      remotevolume = volume * _MIDI_TotalVolume;
      remotevolume *= _MIDI_UserChannelVolume[ channel ];
      remotevolume /= MIDI_MaxVolume;
      remotevolume >>= 8;

      status = _MIDI_RerouteFunctions[ channel ]( 0xB0 + channel,
         MIDI_VOLUME, remotevolume );
      if ( status == MIDI_DONT_PLAY )
         {
         return;
         }
      }

   if ( _MIDI_Funcs == NULL )
      {
      return;
      }

   if ( _MIDI_Funcs->ControlChange == NULL )
      {
      return;
      }

   // For user volume
   volume *= _MIDI_UserChannelVolume[ channel ];

   if ( _MIDI_Funcs->SetVolume == NULL )
      {
      volume *= _MIDI_TotalVolume;
      volume /= MIDI_MaxVolume;
      }

   // For user volume
   volume >>= 8;

   _MIDI_Funcs->ControlChange( channel, MIDI_VOLUME, volume );
   }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movl %edi, %ebx
movslq %edi, %r14
leaq 0x11d4e(%rip), %rax     # 0x18630
movl %esi, (%rax,%r14,4)
leaq 0x11cc3(%rip), %rax     # 0x185b0
movq (%rax,%r14,8), %rcx
testq %rcx, %rcx
je 0x6928
movl 0x89b4(%rip), %eax      # 0xf2b0
imull %ebp, %eax
leaq 0x896a(%rip), %rdx      # 0xf270
imull (%rdx,%r14,4), %eax
movl $0xff, %esi
cltd
idivl %esi
sarl $0x8, %eax
leal 0xb0(%r14), %edi
pushq $0x7
popq %rsi
movl %eax, %edx
callq *%rcx
testl %eax, %eax
je 0x6973
movq 0x11d49(%rip), %rax     # 0x18678
testq %rax, %rax
je 0x6973
movq 0x18(%rax), %rcx
testq %rcx, %rcx
je 0x6973
leaq 0x892c(%rip), %rdx      # 0xf270
imull (%rdx,%r14,4), %ebp
cmpq $0x0, 0x48(%rax)
jne 0x6963
imull 0x8959(%rip), %ebp      # 0xf2b0
movl $0xff, %esi
movl %ebp, %eax
cltd
idivl %esi
movl %eax, %ebp
sarl $0x8, %ebp
pushq $0x7
popq %rsi
movl %ebx, %edi
movl %ebp, %edx
popq %rbx
popq %r14
popq %rbp
jmpq *%rcx
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/midi.c
// Function: MIDI_Reset
int MIDI_Reset
   (
   void
   )

   {
   int channel;

   MIDI_AllNotesOff();

   ASS_Sleep(50);
   
   SoundDriver_MIDI_Lock();

   for( channel = 0; channel < NUM_MIDI_CHANNELS; channel++ )
      {
      _MIDI_SendControlChange( channel, MIDI_RESET_ALL_CONTROLLERS, 0 );
      _MIDI_SendControlChange( channel, MIDI_RPN_MSB, MIDI_PITCHBEND_MSB );
      _MIDI_SendControlChange( channel, MIDI_RPN_LSB, MIDI_PITCHBEND_LSB );
      _MIDI_SendControlChange( channel, MIDI_DATAENTRY_MSB, 2 ); /* Pitch Bend Sensitivity MSB */
      _MIDI_SendControlChange( channel, MIDI_DATAENTRY_LSB, 0 ); /* Pitch Bend Sensitivity LSB */
      _MIDI_ChannelVolume[ channel ] = GENMIDI_DefaultVolume;
      _MIDI_SendControlChange( channel, MIDI_PAN, 64 );  // begin TURRICAN's recommendation
      _MIDI_SendControlChange( channel, MIDI_REVERB, 40 );
      _MIDI_SendControlChange( channel, MIDI_CHORUS, 0 );
      _MIDI_SendControlChange( channel, MIDI_BANK_SELECT_MSB, 0 );
      _MIDI_SendControlChange( channel, MIDI_BANK_SELECT_LSB, 0 );
      _MIDI_SendProgramChange( channel, 0 ); // end TURRICAN's recommendation
      }

   _MIDI_SendGSReset();
   _MIDI_SendChannelVolumes();

   SoundDriver_MIDI_Unlock();

   Reset = TRUE;

   return( MIDI_Ok );
   }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x67bd
pushq $0x32
popq %rdi
callq 0x8107
callq 0x2e02
leaq 0x11bb9(%rip), %r15     # 0x185b0
leaq 0x11c32(%rip), %r12     # 0x18630
xorl %ebx, %ebx
pushq $0x28
popq %r13
pushq $0x5d
popq %rbp
pushq $0x20
popq %r14
cmpq $0x10, %rbx
je 0x6adb
movl %ebx, %edi
pushq $0x79
popq %rsi
xorl %edx, %edx
callq 0x6823
movl %ebx, %edi
pushq $0x64
popq %rsi
xorl %edx, %edx
callq 0x6823
movl %ebx, %edi
pushq $0x65
popq %rsi
xorl %edx, %edx
callq 0x6823
movl %ebx, %edi
pushq $0x6
popq %rsi
pushq $0x2
popq %rdx
callq 0x6823
movl %ebx, %edi
pushq $0x26
popq %rsi
xorl %edx, %edx
callq 0x6823
movl $0x64, (%r12)
movl %ebx, %edi
pushq $0xa
popq %rsi
pushq $0x40
popq %rdx
callq 0x6823
movl %ebx, %edi
pushq $0x5b
popq %rsi
movl %r13d, %edx
callq 0x6823
movl %ebx, %edi
movl %ebp, %esi
xorl %edx, %edx
callq 0x6823
movl %ebx, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x6823
movl %ebx, %edi
movl %r14d, %esi
xorl %edx, %edx
callq 0x6823
movq (%r15), %rax
testq %rax, %rax
je 0x6ab0
movl %ebx, %edi
orl $0xc0, %edi
xorl %esi, %esi
xorl %edx, %edx
callq *%rax
testl %eax, %eax
je 0x6acb
movq 0x11bc1(%rip), %rax     # 0x18678
testq %rax, %rax
je 0x6acb
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x6acb
movl %ebx, %edi
xorl %esi, %esi
callq *%rax
incq %rbx
addq $0x8, %r15
addq $0x4, %r12
jmp 0x6a0b
movq 0x11b96(%rip), %rax     # 0x18678
movq 0x58(%rax), %rax
testq %rax, %rax
je 0x6aff
leaq 0x32de(%rip), %rdi      # 0x9dd0
pushq $0xb
popq %rsi
callq *%rax
pushq $0x32
popq %rdi
callq 0x8107
callq 0x69a5
callq 0x2e1e
movb $0x1, 0x11b60(%rip)     # 0x18670
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/midi.c
// Function: MIDI_SetVolume
int MIDI_SetVolume
   (
   int volume
   )

   {
   int i;

   if ( _MIDI_Funcs == NULL )
      {
      return( MIDI_NullMidiModule );
      }

   volume = min( MIDI_MaxVolume, volume );
   volume = max( 0, volume );

   _MIDI_TotalVolume = volume;

   SoundDriver_MIDI_Lock();

   if ( _MIDI_Funcs->SetVolume )
      {
      _MIDI_Funcs->SetVolume( volume );

      for( i = 0; i < NUM_MIDI_CHANNELS; i++ )
         {
         if ( _MIDI_RerouteFunctions[ i ] != NULL )
            {
            _MIDI_SetChannelVolume( i, _MIDI_ChannelVolume[ i ] );
            }
         }
      }
   else
      {
      _MIDI_SendChannelVolumes();
      }

   SoundDriver_MIDI_Unlock();

   return( MIDI_Ok );
   }

// Assembly:
cmpq $0x0, 0x11b4f(%rip)     # 0x18678
je 0x6b93
pushq %r15
pushq %r14
pushq %rbx
movl $0xff, %eax
cmpl %eax, %edi
cmovll %edi, %eax
xorl %ebx, %ebx
testl %eax, %eax
cmovgl %eax, %ebx
movl %ebx, 0x8769(%rip)      # 0xf2b0
callq 0x2e02
movq 0x11b25(%rip), %rax     # 0x18678
movq 0x48(%rax), %rax
testq %rax, %rax
je 0x6b97
movl %ebx, %edi
callq *%rax
leaq 0x11ac9(%rip), %r14     # 0x18630
leaq 0x11a42(%rip), %r15     # 0x185b0
xorl %ebx, %ebx
cmpq $0x10, %rbx
je 0x6b9c
cmpq $0x0, (%r15)
je 0x6b86
movl (%r14), %esi
movl %ebx, %edi
callq 0x68d0
incq %rbx
addq $0x4, %r14
addq $0x8, %r15
jmp 0x6b70
pushq $0x1
popq %rax
retq
callq 0x69a5
callq 0x2e1e
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/midi.c
// Function: MIDI_ResetTracks
static void _MIDI_ResetTracks
   (
   void
   )

   {
   int    i;
   track *ptr;

   _MIDI_Tick = 0;
   _MIDI_Beat = 1;
   _MIDI_Measure = 1;
   _MIDI_Time = 0;
   _MIDI_BeatsPerMeasure = 4;
   _MIDI_TicksPerBeat = _MIDI_Division;
   _MIDI_TimeBase = 4;

   _MIDI_PositionInTicks = 0;
   _MIDI_ActiveTracks    = 0;
   _MIDI_Context         = 0;

   ptr = _MIDI_TrackPtr;
   for( i = 0; i < _MIDI_NumTracks; i++ )
      {
      ptr->pos                    = ptr->start;
      ptr->delay                  = _MIDI_ReadDelta( ptr );
      ptr->active                 = ptr->EMIDI_IncludeTrack;
      ptr->RunningStatus          = 0;
      ptr->currentcontext         = 0;
      ptr->context[ 0 ].loopstart = ptr->start;
      ptr->context[ 0 ].loopcount = 0;

      if ( ptr->active )
         {
         _MIDI_ActiveTracks++;
         }

      ptr++;
      }
   }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
andl $0x0, 0x11a09(%rip)     # 0x186c0
pushq $0x1
popq %rax
movl %eax, 0x85f4(%rip)      # 0xf2b4
movl %eax, 0x85f2(%rip)      # 0xf2b8
andl $0x0, 0x119ef(%rip)     # 0x186bc
pushq $0x4
popq %rax
andl $0x0, 0x119dd(%rip)     # 0x186b4
movl %eax, 0x11a73(%rip)     # 0x18750
andl $0x0, 0x119d4(%rip)     # 0x186b8
movl 0x119c2(%rip), %ecx     # 0x186ac
andl $0x0, 0x1198f(%rip)     # 0x18680
movl %ecx, 0x11a5d(%rip)     # 0x18754
movl %eax, 0x11a5b(%rip)     # 0x18758
movq 0x1198c(%rip), %rbx     # 0x18690
movl 0x1198e(%rip), %ebp     # 0x18698
xorl %r14d, %r14d
testl %ebp, %ebp
cmovlel %r14d, %ebp
subl $0x1, %ebp
jb 0x6d5d
movq (%rbx), %rax
movq %rax, 0x8(%rbx)
movq %rbx, %rdi
callq 0x7b70
movl %eax, 0x10(%rbx)
movsbl 0x170(%rbx), %eax
andl $0x0, 0x16(%rbx)
andw $0x0, 0x30(%rbx)
movw %ax, 0x14(%rbx)
movq (%rbx), %rcx
movq %rcx, 0x28(%rbx)
testw %ax, %ax
je 0x6d54
incl %r14d
movl %r14d, 0x11964(%rip)    # 0x186b8
addq $0x178, %rbx            # imm = 0x178
jmp 0x6d13
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/midi.c
// Function: MIDI_SetTempo
void MIDI_SetTempo
   (
   int tempo
   )

   {
   int tickspersecond;

   MIDI_Tempo = tempo;
   SoundDriver_MIDI_SetTempo(tempo, _MIDI_Division);

   tickspersecond = ( tempo * _MIDI_Division ) / 60;
   _MIDI_FPSecondsPerTick = ( 1 << TIME_PRECISION ) / tickspersecond;
   }

// Assembly:
pushq %rbx
movl %edi, %ebx
movl %edi, 0x7de8(%rip)      # 0xf260
movl 0x1122e(%rip), %esi     # 0x186ac
callq 0x2de6
imull 0x11222(%rip), %ebx     # 0x186ac
pushq $0x3c
popq %rcx
movl %ebx, %eax
cltd
idivl %ecx
movl %eax, %ecx
movl $0x10000, %eax          # imm = 0x10000
xorl %edx, %edx
idivl %ecx
movl %eax, 0x1120d(%rip)     # 0x186b0
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/midi.c
// Function: MIDI_SetSongPosition
void MIDI_SetSongPosition
   (
   int measure,
   int beat,
   int tick
   )

   {
   unsigned int pos;

   if ( !_MIDI_SongLoaded )
      {
      return;
      }

   MIDI_PauseSong();

   pos = RELATIVE_BEAT( measure, beat, tick );

   if ( pos < RELATIVE_BEAT( _MIDI_Measure, _MIDI_Beat, _MIDI_Tick ) )
      {
      SoundDriver_MIDI_Lock();
      _MIDI_ResetTracks();
      SoundDriver_MIDI_Unlock();

      MIDI_Reset();
      }

   SoundDriver_MIDI_Lock();
   while( RELATIVE_BEAT( _MIDI_Measure, _MIDI_Beat, _MIDI_Tick ) < pos )
      {
      if ( _MIDI_ProcessNextTick() )
         {
         break;
         }
      if ( _MIDI_ActiveTracks == 0 )
         {
         _MIDI_ResetTracks();
         if ( !_MIDI_Loop )
            {
            SoundDriver_MIDI_Unlock();
            return;
            }
         break;
         }
      }
   SoundDriver_MIDI_Unlock();

   MIDI_SetVolume( _MIDI_TotalVolume );
   MIDI_ContinueSong();
   }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
cmpb $0x1, 0x10c5b(%rip)     # 0x18688
jne 0x7adf
movl %edx, %r14d
movl %esi, %ebp
movl %edi, %ebx
callq 0x6c11
shll $0x9, %ebp
shll $0x10, %ebx
addl %r14d, %ebx
addl %ebp, %ebx
movl 0x7864(%rip), %eax      # 0xf2b4
shll $0x9, %eax
addl 0x10c67(%rip), %eax     # 0x186c0
movl 0x7859(%rip), %ecx      # 0xf2b8
shll $0x10, %ecx
addl %eax, %ecx
cmpl %ecx, %ebx
jae 0x7a7c
callq 0x2e02
callq 0x6cac
callq 0x2e1e
callq 0x69d3
callq 0x2e02
movl 0x782d(%rip), %eax      # 0xf2b4
shll $0x9, %eax
addl 0x10c30(%rip), %eax     # 0x186c0
movl 0x7822(%rip), %ecx      # 0xf2b8
shll $0x10, %ecx
addl %eax, %ecx
cmpl %ebx, %ecx
jae 0x7abf
callq 0x7787
testl %eax, %eax
jne 0x7abf
cmpl $0x0, 0x10c09(%rip)     # 0x186b8
jne 0x7a81
callq 0x6cac
cmpl $0x0, 0x10bc7(%rip)     # 0x18684
je 0x7ae4
callq 0x2e1e
movl 0x77e6(%rip), %edi      # 0xf2b0
callq 0x6b21
cmpb $0x1, 0x10bb2(%rip)     # 0x18688
jne 0x7adf
movb $0x1, 0x10bad(%rip)     # 0x1868c
popq %rbx
popq %r14
popq %rbp
retq
popq %rbx
popq %r14
popq %rbp
jmp 0x2e1e
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/midi.c
// Function: MIDI_GetSongPosition
void MIDI_GetSongPosition
   (
   songposition *pos
   )

   {
   unsigned int mil;
   unsigned int sec;

   mil = ( _MIDI_Time & ( ( 1 << TIME_PRECISION ) - 1 ) ) * 1000;
   sec = _MIDI_Time >> TIME_PRECISION;
   pos->milliseconds = ( mil >> TIME_PRECISION ) + ( sec * 1000 );
   pos->tickposition = _MIDI_PositionInTicks;
   pos->measure      = _MIDI_Measure;
   pos->beat         = _MIDI_Beat;
   pos->tick         = _MIDI_Tick;
   }

// Assembly:
movl 0x10bc9(%rip), %eax     # 0x186bc
movzwl %ax, %ecx
imull $0x3e8, %ecx, %ecx      # imm = 0x3E8
shrl $0x10, %eax
shrl $0x10, %ecx
imull $0x3e8, %eax, %eax      # imm = 0x3E8
addl %ecx, %eax
movl %eax, 0x4(%rdi)
movl 0x10ba1(%rip), %eax     # 0x186b4
movl %eax, (%rdi)
movl 0x779d(%rip), %eax      # 0xf2b8
movl %eax, 0x8(%rdi)
movl 0x7790(%rip), %eax      # 0xf2b4
movl %eax, 0xc(%rdi)
movl 0x10b93(%rip), %eax     # 0x186c0
movl %eax, 0x10(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/midi.c
// Function: MIDI_SysEx
static void _MIDI_SysEx
   (
   track *Track
   )

   {
   int length;

   length = _MIDI_ReadDelta( Track );
   
   if (_MIDI_Funcs->SysEx && _MIDI_SongLoaded)
      {
      unsigned char *msg;
      
      msg = (unsigned char *)alloca(length + 1);
      
      msg[0] = MIDI_SYSEX;
      memcpy(&msg[1], Track->pos, length);

      // only send a sysex if it's not a GS reset
      if (memcmp(msg, _GSResetSysex, sizeof(_GSResetSysex)))
         {
         _MIDI_Funcs->SysEx(msg, length + 1);
         }
      }

   Track->pos += length;
   }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x7b70
movl %eax, %r14d
movq 0x10ab4(%rip), %rax     # 0x18678
movq 0x58(%rax), %r13
testq %r13, %r13
je 0x7c29
testb $0x1, 0x10ab4(%rip)     # 0x18688
je 0x7c29
movq %rsp, %rax
movslq %r14d, %r15
leaq 0x10(%r15), %rcx
andq $-0x10, %rcx
movq %rax, %r12
subq %rcx, %r12
movq %r12, %rsp
negq %rcx
movb $-0x10, (%rax,%rcx)
leaq 0x1(%r12), %rdi
movq 0x8(%rbx), %rsi
movq %r15, %rdx
callq 0x2180
leaq 0x21c4(%rip), %rsi      # 0x9dd0
pushq $0xb
popq %rdx
movq %r12, %rdi
callq 0x2200
testl %eax, %eax
je 0x7c2c
incl %r14d
movq %r12, %rdi
movl %r14d, %esi
callq *%r13
jmp 0x7c2c
movslq %r14d, %r15
addq %r15, 0x8(%rbx)
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/midi.c
// Function: MIDI_MetaEvent
static void _MIDI_MetaEvent
   (
   track *Track
   )

   {
   int   command;
   int   length;
   int   denominator;
   int   tempo;

   GET_NEXT_EVENT( Track, command );
   GET_NEXT_EVENT( Track, length );

   switch( command )
      {
      case MIDI_END_OF_TRACK :
         Track->active = FALSE;

         _MIDI_ActiveTracks--;
         break;

      case MIDI_TEMPO_CHANGE :
         tempo = 60000000L / _MIDI_ReadNumber( Track->pos, 3 );
         if (_MIDI_SongLoaded)
            {
            MIDI_SetTempo( tempo );
            }
         break;

      case MIDI_TIME_SIGNATURE :
         if ( ( _MIDI_Tick > 0 ) || ( _MIDI_Beat > 1 ) )
            {
            _MIDI_Measure++;
            }

         _MIDI_Tick = 0;
         _MIDI_Beat = 1;

         _MIDI_BeatsPerMeasure = (int)*Track->pos;
         denominator = (int)*( Track->pos + 1 );
         _MIDI_TimeBase = 1;
         while( denominator > 0 )
            {
            _MIDI_TimeBase += _MIDI_TimeBase;
            denominator--;
            }
         _MIDI_TicksPerBeat = ( _MIDI_Division * 4 ) / _MIDI_TimeBase;
         break;
      }

   Track->pos += length;
   }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movzbl (%rax), %ecx
leaq 0x1(%rax), %rdx
leaq 0x2(%rax), %r14
movq %rdx, 0x8(%rdi)
movzbl 0x1(%rax), %r15d
movq %r14, 0x8(%rdi)
cmpl $0x58, %ecx
je 0x7cb2
cmpl $0x51, %ecx
je 0x7c86
cmpl $0x2f, %ecx
jne 0x7d10
andw $0x0, 0x14(%rbx)
decl 0x10a37(%rip)           # 0x186b8
jmp 0x7d10
pushq $0x3
popq %rsi
movq %r14, %rdi
callq 0x7301
cmpb $0x1, 0x109f0(%rip)     # 0x18688
jne 0x7d10
movl %eax, %ecx
movl $0x3938700, %eax        # imm = 0x3938700
xorl %edx, %edx
idivl %ecx
movl %eax, %edi
callq 0x746f
movq 0x8(%rbx), %r14
jmp 0x7d10
cmpl $0x0, 0x10a07(%rip)     # 0x186c0
jg 0x7cc4
cmpl $0x2, 0x75f2(%rip)      # 0xf2b4
jl 0x7cca
incl 0x75ee(%rip)            # 0xf2b8
andl $0x0, 0x109ef(%rip)     # 0x186c0
pushq $0x1
popq %rcx
movl %ecx, 0x75da(%rip)      # 0xf2b4
movzbl 0x2(%rax), %edx
movl %edx, 0x10a6c(%rip)     # 0x18750
movzbl 0x3(%rax), %eax
movl %ecx, 0x10a6a(%rip)     # 0x18758
testl %eax, %eax
jle 0x7cfe
addl %ecx, %ecx
movl %ecx, 0x10a5e(%rip)     # 0x18758
decl %eax
jmp 0x7cee
movl 0x109a8(%rip), %eax     # 0x186ac
shll $0x2, %eax
cltd
idivl %ecx
movl %eax, 0x10a44(%rip)     # 0x18754
addq %r15, %r14
movq %r14, 0x8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/midi.c
// Function: MIDI_AdvanceTick
static void _MIDI_AdvanceTick
   (
   void
   )

   {
   _MIDI_PositionInTicks++;
   _MIDI_Time += _MIDI_FPSecondsPerTick;

   _MIDI_Tick++;
   while( _MIDI_Tick > _MIDI_TicksPerBeat )
      {
      _MIDI_Tick -= _MIDI_TicksPerBeat;
      _MIDI_Beat++;
      }
   while( _MIDI_Beat > _MIDI_BeatsPerMeasure )
      {
      _MIDI_Beat -= _MIDI_BeatsPerMeasure;
      _MIDI_Measure++;
      }
   }

// Assembly:
incl 0x1067c(%rip)           # 0x186b4
movl 0x10672(%rip), %eax     # 0x186b0
addl %eax, 0x10678(%rip)     # 0x186bc
movl 0x10676(%rip), %edx     # 0x186c0
incl %edx
movl %edx, 0x1066e(%rip)     # 0x186c0
movl 0x106fc(%rip), %ecx     # 0x18754
movl 0x7256(%rip), %eax      # 0xf2b4
movl %ecx, %esi
negl %esi
movl %edx, %edi
subl %ecx, %edi
jle 0x807c
addl %esi, %edx
movl %edx, 0x10650(%rip)     # 0x186c0
incl %eax
movl %eax, 0x723c(%rip)      # 0xf2b4
movl %edi, %edx
jmp 0x8064
movl 0x106ce(%rip), %ecx     # 0x18750
movl 0x7230(%rip), %edx      # 0xf2b8
incl %edx
movl %ecx, %esi
negl %esi
movl %eax, %edi
subl %ecx, %edi
jle 0x80a8
addl %esi, %eax
movl %eax, 0x7218(%rip)      # 0xf2b4
movl %edx, 0x7216(%rip)      # 0xf2b8
incl %edx
movl %edi, %eax
jmp 0x8090
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/jonof[P]jfaudiolib/src/driver_sdl.c
// Function: SDLDrv_PCM_Shutdown
void SDLDrv_PCM_Shutdown(void)
{
    if (!Initialised) {
        return;
    }

    if (StartedSDLInit & SDL_INIT_AUDIO) {
        SDL_QuitSubSystem(SDL_INIT_AUDIO);
        StartedSDLInit &= ~SDL_INIT_AUDIO;
    }

    if (StartedSDLInit == 0x80000000) {
        SDL_Quit();
        StartedSDLInit = 0;
    }

    StartedSDL &= ~SDL_INIT_AUDIO;
}

// Assembly:
cmpb $0x1, 0x102f9(%rip)     # 0x18764
jne 0x84aa
pushq %rax
movl 0x102f4(%rip), %eax     # 0x18768
testb $0x10, %al
je 0x848f
pushq $0x10
popq %rdi
callq 0x2250
movl 0x102e2(%rip), %eax     # 0x18768
andl $-0x11, %eax
movl %eax, 0x102d9(%rip)     # 0x18768
negl %eax
jno 0x849f
callq 0x2060
andl $0x0, 0x102c9(%rip)     # 0x18768
andb $-0x11, 0x102c6(%rip)   # 0x1876c
addq $0x8, %rsp
retq