LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/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 0x13947(%rip), %rax     # 0x19518
movq (%rax), %r8
testl %ecx, %ecx
je 0x5c5f
leaq 0x12855(%rip), %r9      # 0x18438
leaq 0x12846(%rip), %r10     # 0x18430
leaq 0x1387b(%rip), %r11     # 0x1946c
leaq 0x13918(%rip), %rbx     # 0x19510
leaq 0xa611(%rip), %r14      # 0x10210
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
decl %ecx
jne 0x5bff
leaq 0x138ba(%rip), %rax     # 0x19520
movl %edi, (%rax)
leaq 0x138a9(%rip), %rax     # 0x19518
movq %r8, (%rax)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %rbx
leaq 0x136af(%rip), %rax     # 0x19518
movq (%rax), %r8
testl %ecx, %ecx
je 0x5eda
leaq 0x125c1(%rip), %r9      # 0x18438
leaq 0x13692(%rip), %r10     # 0x19510
leaq 0xa38b(%rip), %r11      # 0x10210
movl %edi, %ebx
shrl $0xf, %ebx
movl %ebx, %r14d
andl $-0x2, %r14d
movzbl (%rdx,%r14), %r14d
orq $0x1, %rbx
movzbl (%rdx,%rbx), %ebx
addl %esi, %edi
movq (%r9), %r15
movswl (%r15,%r14,2), %ebp
movswl (%r15,%rbx,2), %ebx
addl %ebp, %ebx
movl %ebx, %ebp
shrl $0x1f, %ebp
addl %ebx, %ebp
sarl %ebp
movzbl (%r8), %ebx
movslq %ebp, %r14
addq %rbx, %r14
movq (%r10), %rbx
movb 0x80(%rbx,%r14), %bl
movb %bl, (%r8)
movslq (%r11), %rbx
addq %rbx, %r8
decl %ecx
jne 0x5e85
leaq 0x1363f(%rip), %rcx     # 0x19520
movl %edi, (%rcx)
movq %r8, (%rax)
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x1361a(%rip), %rax     # 0x19518
movq (%rax), %r8
testl %ecx, %ecx
je 0x5f95
leaq 0x12528(%rip), %r9      # 0x18438
leaq 0x12519(%rip), %r10     # 0x18430
leaq 0x1354e(%rip), %r11     # 0x1946c
leaq 0x135eb(%rip), %rbx     # 0x19510
leaq 0xa2e4(%rip), %r14      # 0x10210
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
decl %ecx
jne 0x5f2c
leaq 0x13584(%rip), %rax     # 0x19520
movl %edi, (%rax)
leaq 0x13573(%rip), %rax     # 0x19518
movq %r8, (%rax)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
leaq 0x1355c(%rip), %rax     # 0x19518
movq (%rax), %r8
testl %ecx, %ecx
je 0x604e
leaq 0x1246a(%rip), %r9      # 0x18438
movq (%r9), %r9
leaq 0xa238(%rip), %r10      # 0x10210
movl (%r10), %r10d
movl %r10d, %r11d
shrl $0x1f, %r11d
addl %r10d, %r11d
sarl %r11d
movslq %r11d, %r10
addq %r10, %r10
movl %edi, %r11d
shrl $0xf, %r11d
movl %r11d, %ebx
andl $-0x2, %ebx
movzbl (%rdx,%rbx), %ebx
orq $0x1, %r11
movzbl (%rdx,%r11), %r11d
movswl (%r9,%rbx,2), %ebx
movswl (%r9,%r11,2), %r11d
addl %ebx, %r11d
movl %r11d, %ebx
shrl $0x1f, %ebx
addl %r11d, %ebx
shrl %ebx
movzwl (%r8), %r11d
leal (%rbx,%r11), %ebp
movswl %bp, %ebp
sarl $0xf, %ebp
xorl $0xffff8000, %ebp       # imm = 0xFFFF8000
addw %r11w, %bx
cmovol %ebp, %ebx
addl %esi, %edi
leaq (%r8,%r10), %r11
movw %bx, (%r8)
movq %r11, %r8
decl %ecx
jne 0x5fee
jmp 0x6051
movq %r8, %r11
leaq 0x134c8(%rip), %rcx     # 0x19520
movl %edi, (%rcx)
movq %r11, (%rax)
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %rbx
leaq 0x1329c(%rip), %rax     # 0x19518
movq (%rax), %r8
testl %ecx, %ecx
je 0x62ed
leaq 0x121ae(%rip), %r9      # 0x18438
leaq 0x1327f(%rip), %r10     # 0x19510
leaq 0x9f78(%rip), %r11      # 0x10210
movl %edi, %ebx
shrl $0x10, %ebx
movsbq 0x1(%rdx,%rbx,4), %r14
movsbq 0x3(%rdx,%rbx,4), %rbx
addl %esi, %edi
movq (%r9), %r15
movswl 0x100(%r15,%r14,2), %ebp
movswl 0x100(%r15,%rbx,2), %ebx
addl %ebp, %ebx
movl %ebx, %ebp
shrl $0x1f, %ebp
addl %ebx, %ebp
sarl %ebp
movzbl (%r8), %ebx
movslq %ebp, %r14
addq %rbx, %r14
movq (%r10), %rbx
movb 0x80(%rbx,%r14), %bl
movb %bl, (%r8)
movslq (%r11), %rbx
addq %rbx, %r8
decl %ecx
jne 0x6298
leaq 0x1322c(%rip), %rcx     # 0x19520
movl %edi, (%rcx)
movq %r8, (%rax)
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x13207(%rip), %rax     # 0x19518
movq (%rax), %r8
testl %ecx, %ecx
je 0x63a5
leaq 0x12115(%rip), %r9      # 0x18438
leaq 0x12106(%rip), %r10     # 0x18430
leaq 0x1313b(%rip), %r11     # 0x1946c
leaq 0x131d8(%rip), %rbx     # 0x19510
leaq 0x9ed1(%rip), %r14      # 0x10210
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
decl %ecx
jne 0x633f
leaq 0x13174(%rip), %rax     # 0x19520
movl %edi, (%rax)
leaq 0x13163(%rip), %rax     # 0x19518
movq %r8, (%rax)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %edx, %r10d
leaq 0x9d12(%rip), %rdx      # 0x102d0
cmpl $0x0, (%rdx)
je 0x6647
pushq %r14
pushq %rbx
pushq %rax
movl %r9d, %eax
movl 0x20(%rsp), %r11d
movl %r8d, %edx
negl %edx
cmovsl %r8d, %edx
shrl $0x1b, %r8d
andl $-0x10, %r8d
addl %ecx, %r8d
movl $0xff, %ecx
movl %edx, %ebx
subl %ecx, %ebx
cmovael %ecx, %edx
negl %ebx
leaq 0x9c10(%rip), %rcx      # 0x1020c
movl (%rcx), %ecx
incl %ecx
imull %edx, %ecx
sarl $0x8, %ecx
andl $0x1f, %r8d
movslq %ecx, %rcx
shll $0x7, %r8d
addq 0x99b0(%rip), %r8       # 0xffc8
movzbl (%r8,%rcx,2), %r14d
movzbl 0x1(%r8,%rcx,2), %ecx
xorl %r9d, %r9d
testl %ebx, %ebx
cmovgl %ebx, %r9d
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %r10d, %r8d
pushq %r11
pushq %rax
pushq %rcx
pushq %r14
callq 0x6686
addq $0x28, %rsp
popq %rbx
popq %r14
retq
leaq 0x9c86(%rip), %rax      # 0x102d4
movl $0x2, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x6a59
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x88(%rdi), %r14
leaq 0x18(%r14), %rdi
callq 0x2100
movq %r14, %rdi
callq 0x2270
movq $0x0, 0x88(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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
movl $0x0, (%rax)
movq 0x8(%r14), %rax
movq 0x10(%r14), %rsi
cmpq %rsi, %rax
sete %cl
testq %rbx, %rbx
sete %dl
orb %cl, %dl
je 0x6a99
xorl %ebx, %ebx
jmp 0x6af2
movq $-0x1, %rbp
xorl %r12d, %r12d
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 0x6aec
addq %r13, %r12
leaq (%rbx,%rbp), %rcx
decq %rcx
decq %rbp
cmpq $-0x1, %rcx
jne 0x6aa3
jmp 0x6af2
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_O3/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
movdqa 0x4145(%rip), %xmm0     # 0xacf0
xorl %eax, %eax
leaq 0x12b0c(%rip), %rcx     # 0x196c0
movdqa 0x4144(%rip), %xmm1     # 0xad00
movdqa %xmm0, (%rcx,%rax)
addq $0x10, %rax
paddb %xmm1, %xmm0
cmpq $0x80, %rax
jne 0x6bbc
cmpl $-0x2, %ebx
jne 0x6be3
movl $0x6, %r13d
movl $0x1, %ebp
jmp 0x6bf9
movl %ebx, %ebp
movl %ebx, %r13d
cmpl $0x7, %ebx
jb 0x6bf9
movl $0x2, 0x12931(%rip)     # 0x19528
jmp 0x6c71
incl %r13d
leaq 0x9605(%rip), %r15      # 0x10208
leaq 0x12926(%rip), %r12     # 0x19530
movl %ebp, %edi
callq 0x2b6e
testl %eax, %eax
je 0x6c44
cmpl $-0x2, %ebx
jne 0x6c32
movl %ebp, %edi
callq 0x2b7f
leaq 0x413b(%rip), %rdi      # 0xad63
movq %rax, %rsi
xorl %eax, %eax
callq 0x8b10
movl %ebp, (%r15)
movq %r12, %rdi
movq %r14, %rsi
callq 0x2df4
testl %eax, %eax
je 0x6c57
incl %ebp
cmpl %ebp, %r13d
jne 0x6c0a
cmpl $-0x2, %ebx
jne 0x6c67
movl $0x0, (%r15)
leaq 0x128d2(%rip), %rdi     # 0x19530
callq 0x7228
xorl %eax, %eax
jmp 0x6c76
movl $0x1, 0x128b7(%rip)     # 0x19528
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
callq 0x2e80
xorl %ebx, %ebx
movl %ebx, %edi
movl $0x40, %esi
xorl %edx, %edx
callq 0x6dc9
movl %ebx, %edi
movl $0x42, %esi
xorl %edx, %edx
callq 0x6dc9
movl %ebx, %edi
movl $0x7b, %esi
xorl %edx, %edx
callq 0x6dc9
movl %ebx, %edi
movl $0x78, %esi
xorl %edx, %edx
callq 0x6dc9
incl %ebx
cmpl $0x10, %ebx
jne 0x6d81
callq 0x2e9c
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x127c2(%rip), %rcx     # 0x195a0
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x6df8
leal 0xb0(%r14), %edi
movl %ebp, %esi
movl %ebx, %edx
callq *%rax
testl %eax, %eax
je 0x6e1a
movq 0x12869(%rip), %rax     # 0x19668
testq %rax, %rax
je 0x6e1a
movq 0x18(%rax), %rax
testq %rax, %rax
je 0x6e1a
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_O3/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 0x6e6e
xorl %eax, %eax
testl %esi, %esi
cmovgl %esi, %eax
movl $0x100, %ecx            # imm = 0x100
cmpl %ecx, %eax
cmovgel %ecx, %eax
movl %ebx, %r14d
leaq 0x9419(%rip), %rcx      # 0x10260
movl %eax, (%rcx,%r14,4)
callq 0x2e80
leaq 0x127c9(%rip), %rax     # 0x19620
movl (%rax,%r14,4), %esi
movl %ebx, %edi
callq 0x6e76
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2e9c
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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, %ebx
movl %edi, %ebp
movslq %edi, %r14
leaq 0x12798(%rip), %rax     # 0x19620
movl %esi, (%rax,%r14,4)
leaq 0x1270d(%rip), %rax     # 0x195a0
movq (%rax,%r14,8), %rax
testq %rax, %rax
je 0x6ee0
movl 0x93fe(%rip), %ecx      # 0x102a0
imull %ebx, %ecx
leaq 0x93b4(%rip), %rdx      # 0x10260
imull (%rdx,%r14,4), %ecx
movslq %ecx, %rdx
imulq $-0x7f7f7f7f, %rdx, %rcx # imm = 0x80808081
shrq $0x20, %rcx
addl %ecx, %edx
movl %edx, %ecx
shrl $0x1f, %ecx
sarl $0x7, %edx
addl %ecx, %edx
sarl $0x8, %edx
leal 0xb0(%r14), %edi
movl $0x7, %esi
callq *%rax
testl %eax, %eax
je 0x6f3b
movq 0x12781(%rip), %rcx     # 0x19668
testq %rcx, %rcx
je 0x6f3b
movq 0x18(%rcx), %rax
testq %rax, %rax
je 0x6f3b
leaq 0x9364(%rip), %rdx      # 0x10260
imull (%rdx,%r14,4), %ebx
cmpq $0x0, 0x48(%rcx)
jne 0x6f29
imull 0x9391(%rip), %ebx      # 0x102a0
movslq %ebx, %rbx
imulq $-0x7f7f7f7f, %rbx, %rcx # imm = 0x80808081
shrq $0x20, %rcx
addl %ecx, %ebx
movl %ebx, %ecx
shrl $0x1f, %ecx
sarl $0x7, %ebx
addl %ecx, %ebx
sarl $0x8, %ebx
movl %ebp, %edi
movl $0x7, %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_O3/jonof[P]jfaudiolib/src/midi.c
// Function: MIDI_ResetUserChannelVolume
void MIDI_ResetUserChannelVolume
   (
   void
   )

   {
   int channel;

   for( channel = 0; channel < NUM_MIDI_CHANNELS; channel++ )
      {
      _MIDI_UserChannelVolume[ channel ] = 256;
      }

   SoundDriver_MIDI_Lock();
   _MIDI_SendChannelVolumes();
   SoundDriver_MIDI_Unlock();
   }

// Assembly:
xorl %eax, %eax
leaq 0x9317(%rip), %rcx      # 0x10260
movaps 0x3e30(%rip), %xmm0     # 0xad80
movaps %xmm0, (%rax,%rcx)
addq $0x10, %rax
cmpq $0x40, %rax
jne 0x6f50
pushq %r14
pushq %rbx
pushq %rax
callq 0x2e80
leaq 0x126b2(%rip), %r14     # 0x19620
xorl %ebx, %ebx
movl (%r14), %esi
movl %ebx, %edi
callq 0x6e76
incq %rbx
addq $0x4, %r14
cmpq $0x10, %rbx
jne 0x6f70
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2e9c
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
callq 0x6d79
movl $0x32, %edi
callq 0x8ac4
callq 0x2e80
leaq 0x1266d(%rip), %r14     # 0x19620
leaq 0x125e6(%rip), %r15     # 0x195a0
xorl %ebx, %ebx
movl %ebx, %edi
movl $0x79, %esi
xorl %edx, %edx
callq 0x6dc9
movl %ebx, %edi
movl $0x64, %esi
xorl %edx, %edx
callq 0x6dc9
movl %ebx, %edi
movl $0x65, %esi
xorl %edx, %edx
callq 0x6dc9
movl %ebx, %edi
movl $0x6, %esi
movl $0x2, %edx
callq 0x6dc9
movl %ebx, %edi
movl $0x26, %esi
xorl %edx, %edx
callq 0x6dc9
movl $0x64, (%r14)
movl %ebx, %edi
movl $0xa, %esi
movl $0x40, %edx
callq 0x6dc9
movl %ebx, %edi
movl $0x5b, %esi
movl $0x28, %edx
callq 0x6dc9
movl %ebx, %edi
movl $0x5d, %esi
xorl %edx, %edx
callq 0x6dc9
movl %ebx, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x6dc9
movl %ebx, %edi
movl $0x20, %esi
xorl %edx, %edx
callq 0x6dc9
movq (%r15), %rax
testq %rax, %rax
je 0x706f
movl %ebx, %edi
orl $0xc0, %edi
xorl %esi, %esi
xorl %edx, %edx
callq *%rax
testl %eax, %eax
je 0x708a
movq 0x125f2(%rip), %rax     # 0x19668
testq %rax, %rax
je 0x708a
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x708a
movl %ebx, %edi
xorl %esi, %esi
callq *%rax
incq %rbx
addq $0x4, %r14
addq $0x8, %r15
cmpq $0x10, %rbx
jne 0x6fbc
movq 0x125c2(%rip), %rax     # 0x19668
movq 0x58(%rax), %rax
testq %rax, %rax
je 0x70c7
leaq 0x3dba(%rip), %rdi      # 0xae70
movl $0xb, %esi
callq *%rax
movl $0x32, %edi
callq 0x8ac4
leaq 0x12552(%rip), %r14     # 0x19620
xorl %ebx, %ebx
movl (%r14), %esi
movl %ebx, %edi
callq 0x6e76
incq %rbx
addq $0x4, %r14
cmpq $0x10, %rbx
jne 0x70d0
callq 0x2e9c
movb $0x1, 0x1256d(%rip)     # 0x19660
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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, 0x12565(%rip)     # 0x19668
je 0x716d
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, 0x917f(%rip)      # 0x102a0
callq 0x2e80
movq 0x1253b(%rip), %rax     # 0x19668
movq 0x48(%rax), %rax
testq %rax, %rax
je 0x7173
movl %ebx, %edi
callq *%rax
leaq 0x124df(%rip), %r14     # 0x19620
leaq 0x12458(%rip), %r15     # 0x195a0
xorl %ebx, %ebx
cmpq $0x0, (%r15)
je 0x715a
movl (%r14), %esi
movl %ebx, %edi
callq 0x6e76
incq %rbx
addq $0x4, %r14
addq $0x8, %r15
cmpq $0x10, %rbx
jne 0x714a
jmp 0x7193
movl $0x1, %eax
retq
leaq 0x124a6(%rip), %r14     # 0x19620
xorl %ebx, %ebx
movl (%r14), %esi
movl %ebx, %edi
callq 0x6e76
incq %rbx
addq $0x4, %r14
cmpq $0x10, %rbx
jne 0x717c
callq 0x2e9c
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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:
xorl %eax, %eax
movl %eax, 0x12408(%rip)     # 0x196b0
movl $0x1, %ecx
movl %ecx, 0x8ff1(%rip)      # 0x102a4
movl %ecx, 0x8fef(%rip)      # 0x102a8
movl %eax, 0x123ed(%rip)     # 0x196ac
movl $0x4, %ecx
movl %ecx, 0x12476(%rip)     # 0x19740
movl 0x123cc(%rip), %edx     # 0x1969c
movl %edx, 0x1246e(%rip)     # 0x19744
movl %ecx, 0x1246c(%rip)     # 0x19748
movl %eax, 0x123c2(%rip)     # 0x196a4
movl %eax, 0x123c0(%rip)     # 0x196a8
movl %eax, 0x12382(%rip)     # 0x19670
movl 0x12394(%rip), %ecx     # 0x19688
testl %ecx, %ecx
jle 0x7381
movq 0x1237d(%rip), %rdx     # 0x19680
xorl %esi, %esi
movq (%rdx), %rdi
movq %rdi, 0x8(%rdx)
movzbl (%rdi), %r8d
leaq 0x1(%rdi), %r9
movq %r9, 0x8(%rdx)
testb %r8b, %r8b
jns 0x7344
andl $0x7f, %r8d
leaq 0x2(%rdi), %r9
movzbl -0x1(%r9), %r10d
movq %r9, 0x8(%rdx)
shll $0x7, %r8d
movl %r10d, %r11d
andl $0x7f, %r11d
orl %r11d, %r8d
incq %r9
testb %r10b, %r10b
js 0x7325
movl %r8d, 0x10(%rdx)
movsbl 0x170(%rdx), %r8d
movw %r8w, 0x14(%rdx)
movl $0x0, 0x16(%rdx)
movq %rdi, 0x28(%rdx)
movw $0x0, 0x30(%rdx)
testw %r8w, %r8w
je 0x7374
incl %esi
movl %esi, 0x12334(%rip)     # 0x196a8
addq $0x178, %rdx            # imm = 0x178
incl %eax
cmpl %ecx, %eax
jne 0x7305
retq
// File: /workspace/github_c_makefile_star2_O3/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, 0x862f(%rip)      # 0x10250
movl 0x11a75(%rip), %esi     # 0x1969c
callq 0x2e64
imull 0x11a69(%rip), %ebx     # 0x1969c
movslq %ebx, %rcx
imulq $-0x77777777, %rcx, %rax # imm = 0x88888889
shrq $0x20, %rax
addl %eax, %ecx
movl %ecx, %eax
shrl $0x1f, %eax
sarl $0x5, %ecx
addl %eax, %ecx
movl $0x10000, %eax          # imm = 0x10000
xorl %edx, %edx
idivl %ecx
movl %eax, 0x11a44(%rip)     # 0x196a0
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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, 0x1131d(%rip)     # 0x19678
jne 0x8414
movl %edx, %r14d
movl %esi, %ebp
movl %edi, %ebx
movb $0x0, 0x1130d(%rip)     # 0x1967c
callq 0x6d79
shll $0x9, %ebp
shll $0x10, %ebx
addl %r14d, %ebx
addl %ebp, %ebx
movl 0x7f1f(%rip), %eax      # 0x102a4
shll $0x9, %eax
addl 0x11322(%rip), %eax     # 0x196b0
movl 0x7f14(%rip), %ecx      # 0x102a8
shll $0x10, %ecx
addl %eax, %ecx
cmpl %ecx, %ebx
jae 0x83b1
callq 0x2e80
callq 0x72a0
callq 0x2e9c
callq 0x6f93
callq 0x2e80
movl 0x7ee8(%rip), %eax      # 0x102a4
shll $0x9, %eax
addl 0x112eb(%rip), %eax     # 0x196b0
movl 0x7edd(%rip), %ecx      # 0x102a8
shll $0x10, %ecx
addl %eax, %ecx
cmpl %ebx, %ecx
jae 0x83f4
callq 0x7ff5
testl %eax, %eax
jne 0x83f4
cmpl $0x0, 0x112c4(%rip)     # 0x196a8
jne 0x83b6
callq 0x72a0
cmpl $0x0, 0x11282(%rip)     # 0x19674
je 0x8419
callq 0x2e9c
movl 0x7ea1(%rip), %edi      # 0x102a0
callq 0x70fb
cmpb $0x1, 0x1126d(%rip)     # 0x19678
jne 0x8414
movb $0x1, 0x11268(%rip)     # 0x1967c
popq %rbx
popq %r14
popq %rbp
retq
popq %rbx
popq %r14
popq %rbp
jmp 0x2e9c
// File: /workspace/github_c_makefile_star2_O3/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 0x11284(%rip), %eax     # 0x196ac
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 0x1125c(%rip), %eax     # 0x196a4
movl %eax, (%rdi)
movl 0x7e58(%rip), %eax      # 0x102a8
movl %eax, 0x8(%rdi)
movl 0x7e4b(%rip), %eax      # 0x102a4
movl %eax, 0xc(%rdi)
movl 0x1124e(%rip), %eax     # 0x196b0
movl %eax, 0x10(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/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
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movzbl (%r14), %r15d
incq %r14
movq %r14, 0x8(%rdi)
testb %r15b, %r15b
jns 0x84ef
andl $0x7f, %r15d
movzbl (%r14), %eax
incq %r14
movq %r14, 0x8(%rbx)
shll $0x7, %r15d
movl %eax, %ecx
andl $0x7f, %ecx
orl %ecx, %r15d
testb %al, %al
js 0x84d4
movq 0x11172(%rip), %rax     # 0x19668
movq 0x58(%rax), %rax
testq %rax, %rax
je 0x8578
testb $0x1, 0x11172(%rip)     # 0x19678
je 0x8578
movq %rax, -0x38(%rbp)
movq %rsp, %r13
movq %r13, -0x40(%rbp)
movslq %r15d, %rdx
leaq 0x10(%rdx), %r12
andq $-0x10, %r12
subq %r12, %r13
movq %r13, %rsp
movb $-0x10, (%r13)
leaq 0x1(%r13), %rdi
movq %r14, %rsi
movq %rdx, -0x30(%rbp)
callq 0x2180
movabsq $0x7f004012421041f0, %rax # imm = 0x7F004012421041F0
xorq (%r13), %rax
negq %r12
movabsq $-0x8beff80ffbfedbe, %rcx # imm = 0xF741007F00401242
movq -0x40(%rbp), %rdx
xorq 0x3(%rdx,%r12), %rcx
orq %rax, %rcx
je 0x8572
incl %r15d
movq %r13, %rdi
movl %r15d, %esi
callq *-0x38(%rbp)
movq 0x8(%rbx), %r14
movq -0x30(%rbp), %rax
jmp 0x857b
movslq %r15d, %rax
addq %r14, %rax
movq %rax, 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_O3/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 %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movzbl (%rax), %edx
leaq 0x1(%rax), %rsi
leaq 0x2(%rax), %rcx
movq %rsi, 0x8(%rdi)
movzbl 0x1(%rax), %r14d
movq %rcx, 0x8(%rdi)
cmpl $0x2f, %edx
je 0x86b2
cmpl $0x58, %edx
je 0x8648
cmpl $0x51, %edx
jne 0x86be
xorl %eax, %eax
xorl %esi, %esi
movl %esi, %edx
shll $0x8, %edx
movzbl (%rcx,%rax), %esi
orl %edx, %esi
incq %rax
cmpq $0x3, %rax
jne 0x85d3
cmpb $0x1, 0x1108a(%rip)     # 0x19678
jne 0x86be
movl $0x3938700, %eax        # imm = 0x3938700
xorl %edx, %edx
idivl %esi
movl %eax, %ebp
movl %eax, 0x7c4b(%rip)      # 0x10250
movl 0x11091(%rip), %esi     # 0x1969c
movl %eax, %edi
callq 0x2e64
imull 0x11083(%rip), %ebp     # 0x1969c
movslq %ebp, %rcx
imulq $-0x77777777, %rcx, %rax # imm = 0x88888889
shrq $0x20, %rax
addl %eax, %ecx
movl %ecx, %eax
shrl $0x1f, %eax
sarl $0x5, %ecx
addl %eax, %ecx
movl $0x10000, %eax          # imm = 0x10000
xorl %edx, %edx
idivl %ecx
movl %eax, 0x1105e(%rip)     # 0x196a0
movq 0x8(%rbx), %rcx
jmp 0x86be
cmpl $0x0, 0x11061(%rip)     # 0x196b0
jg 0x865a
cmpl $0x2, 0x7c4c(%rip)      # 0x102a4
jl 0x8660
incl 0x7c48(%rip)            # 0x102a8
movl $0x0, 0x11046(%rip)     # 0x196b0
movl $0x1, %esi
movl %esi, 0x7c2f(%rip)      # 0x102a4
movzbl 0x2(%rax), %edx
movl %edx, 0x110c1(%rip)     # 0x19740
movzbl 0x3(%rax), %eax
movl %esi, 0x110bf(%rip)     # 0x19748
testl %eax, %eax
je 0x869e
incl %eax
addl %esi, %esi
decl %eax
cmpl $0x1, %eax
ja 0x868f
movl %esi, 0x110aa(%rip)     # 0x19748
movl 0x10ff8(%rip), %eax     # 0x1969c
shll $0x2, %eax
cltd
idivl %esi
movl %eax, 0x11094(%rip)     # 0x19744
jmp 0x86be
movw $0x0, 0x14(%rbx)
decl 0x10fea(%rip)           # 0x196a8
addq %r14, %rcx
movq %rcx, 0x8(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x10c90(%rip)           # 0x196a4
movl 0x10c86(%rip), %eax     # 0x196a0
addl %eax, 0x10c8c(%rip)     # 0x196ac
movl 0x10c8a(%rip), %esi     # 0x196b0
leal 0x1(%rsi), %ecx
movl %ecx, 0x10c81(%rip)     # 0x196b0
movl 0x10d0f(%rip), %edx     # 0x19744
movl 0x7869(%rip), %eax      # 0x102a4
cmpl %edx, %esi
jl 0x8a53
subl %edx, %ecx
incl %eax
cmpl %edx, %ecx
jg 0x8a3f
movl %ecx, 0x10c63(%rip)     # 0x196b0
movl %eax, 0x7851(%rip)      # 0x102a4
movl 0x10ce7(%rip), %ecx     # 0x19740
cmpl %ecx, %eax
jle 0x8a77
movl 0x7845(%rip), %edx      # 0x102a8
subl %ecx, %eax
incl %edx
cmpl %ecx, %eax
jg 0x8a63
movl %eax, 0x7833(%rip)      # 0x102a4
movl %edx, 0x7831(%rip)      # 0x102a8
retq
// File: /workspace/github_c_makefile_star2_O3/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, 0x108ea(%rip)     # 0x19754
jne 0x8eae
pushq %rax
movl 0x108e5(%rip), %eax     # 0x19758
testb $0x10, %al
je 0x8e90
movl $0x10, %edi
callq 0x2240
movl 0x108d1(%rip), %eax     # 0x19758
andl $-0x11, %eax
movl %eax, 0x108c8(%rip)     # 0x19758
negl %eax
jno 0x8ea3
callq 0x2060
movl $0x0, 0x108b5(%rip)     # 0x19758
andb $-0x11, 0x108b2(%rip)   # 0x1975c
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jfaudiolib/src/driver_sdl.c
// Function: fillData
static void fillData(void * userdata, Uint8 * ptr, int remaining)
{
    int len;
    char *sptr;

    (void)userdata;

    while (remaining > 0) {
        if (MixBufferUsed == MixBufferSize) {
            MixCallBack();
            
            MixBufferUsed = 0;
            MixBufferCurrent++;
            if (MixBufferCurrent >= MixBufferCount) {
                MixBufferCurrent -= MixBufferCount;
            }
        }
        
        while (remaining > 0 && MixBufferUsed < MixBufferSize) {
            sptr = MixBuffer + (MixBufferCurrent * MixBufferSize) + MixBufferUsed;
            
            len = MixBufferSize - MixBufferUsed;
            if (remaining < len) {
                len = remaining;
            }
            
            memcpy(ptr, sptr, len);
            
            ptr += len;
            MixBufferUsed += len;
            remaining -= len;
        }
    }
}

// Assembly:
testl %edx, %edx
jle 0x8f74
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movl 0x108ae(%rip), %r12d    # 0x1977c
movl 0x1089c(%rip), %ebp     # 0x19770
cmpl %ebp, %r12d
jne 0x8f08
callq *0x108a1(%rip)          # 0x19780
movl $0x0, 0x10893(%rip)     # 0x1977c
movl 0x10889(%rip), %eax     # 0x19778
incl %eax
movl %eax, 0x10881(%rip)     # 0x19778
xorl %r12d, %r12d
subl 0x10874(%rip), %eax     # 0x19774
jl 0x8f08
movl %eax, 0x10870(%rip)     # 0x19778
movl 0x10862(%rip), %ebp     # 0x19770
cmpl %ebp, %r12d
jge 0x8f5e
movslq %ebp, %rax
movslq 0x1085b(%rip), %r13     # 0x19778
imulq %rax, %r13
addq 0x10840(%rip), %r13     # 0x19768
movslq %r12d, %r12
leaq (%r12,%r13), %rsi
movl %ebp, %eax
subl %r12d, %eax
cmpl %eax, %ebx
cmovll %ebx, %eax
movslq %eax, %r15
movq %r14, %rdi
movq %r15, %rdx
callq 0x2180
addq %r15, %r14
addl %r15d, %r12d
subl %r15d, %ebx
jle 0x8f57
cmpl %ebp, %r12d
jl 0x8f28
movl %r12d, 0x1081e(%rip)    # 0x1977c
testl %ebx, %ebx
jg 0x8ed4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jfaudiolib/src/driver_sdl.c
// Function: SDLDrv_PCM_BeginPlayback
int SDLDrv_PCM_BeginPlayback(char *BufferStart, int BufferSize,
						int NumDivisions, void ( *CallBackFunc )( void ) )
{
    if (!Initialised) {
        ErrorCode = SDLErr_Uninitialised;
        return SDLErr_Error;
    }
    
    if (Playing) {
        SDLDrv_PCM_StopPlayback();
    }

    MixBuffer = BufferStart;
    MixBufferSize = BufferSize;
    MixBufferCount = NumDivisions;
    MixBufferCurrent = 0;
    MixBufferUsed = 0;
    MixCallBack = CallBackFunc;
    
    // prime the buffer
    MixCallBack();

    SDL_PauseAudio(0);
    
    Playing = 1;
    
    return SDLErr_Ok;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpb $0x0, 0x107d1(%rip)     # 0x19754
je 0x8fe5
movq %rcx, %rbx
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
cmpb $0x1, 0x107c9(%rip)     # 0x19760
jne 0x8faa
movl $0x1, %edi
callq 0x2170
movb $0x0, 0x107b6(%rip)     # 0x19760
movq %r15, 0x107b7(%rip)     # 0x19768
movl %r14d, 0x107b8(%rip)    # 0x19770
movl %ebp, 0x107b6(%rip)     # 0x19774
xorl %ebp, %ebp
movl %ebp, 0x107b2(%rip)     # 0x19778
movl %ebp, 0x107b0(%rip)     # 0x1977c
movq %rbx, 0x107ad(%rip)     # 0x19780
callq *%rbx
xorl %edi, %edi
callq 0x2170
movb $0x1, 0x1077d(%rip)     # 0x19760
jmp 0x8ff4
movl $0x1, 0x10761(%rip)     # 0x19750
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jfaudiolib/src/driver_alsa.c
// Function: ALSADrv_MIDI_Shutdown
void ALSADrv_MIDI_Shutdown(void)
{
    ALSADrv_MIDI_HaltPlayback();
    
    if (seq_queue >= 0) {
        snd_seq_free_queue(seq, seq_queue);
    }
    if (seq_port >= 0) {
        snd_seq_delete_simple_port(seq, seq_port);
    }
    if (seq) {
        snd_seq_close(seq);
    }
    seq_queue = -1;
    seq_port = -1;
    seq = 0;
}

// Assembly:
pushq %rax
callq 0x9711
movl 0x7043(%rip), %esi      # 0x102bc
testl %esi, %esi
js 0x9289
movq 0x1050c(%rip), %rdi     # 0x19790
callq 0x2140
movl 0x7029(%rip), %esi      # 0x102b8
testl %esi, %esi
js 0x929f
movq 0x104f6(%rip), %rdi     # 0x19790
callq 0x2330
movq 0x104ea(%rip), %rdi     # 0x19790
testq %rdi, %rdi
je 0x92b0
callq 0x22b0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0x7001(%rip)      # 0x102bc
movl %eax, 0x6ff7(%rip)      # 0x102b8
movq $0x0, 0x104c4(%rip) # 0x19790
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jfaudiolib/src/driver_alsa.c
// Function: Func_NoteOff
static void Func_NoteOff( int channel, int key, int velocity )
{
    snd_seq_event_t ev;
    snd_seq_ev_clear(&ev);
    snd_seq_ev_set_noteoff(&ev, channel, key, velocity);
    sequence_event(&ev);
}

// Assembly:
subq $0x28, %rsp
xorps %xmm0, %xmm0
movq %rsp, %rax
movaps %xmm0, (%rax)
movups %xmm0, 0xc(%rax)
movw $0x7, (%rax)
movb %dil, 0x10(%rax)
movb %sil, 0x11(%rax)
movb %dl, 0x12(%rax)
movw $0xfdfe, 0xe(%rax)      # imm = 0xFDFE
movb 0x6fbd(%rip), %cl       # 0x102b8
movb %cl, 0xd(%rax)
movl 0x104b8(%rip), %ecx     # 0x197bc
movl %ecx, 0x4(%rax)
movb 0x6faf(%rip), %cl       # 0x102bc
movb %cl, 0x3(%rax)
movq 0x10479(%rip), %rdi     # 0x19790
movq %rax, %rsi
callq 0x2260
testl %eax, %eax
js 0x9353
movq 0x10466(%rip), %rdi     # 0x19790
callq 0x2380
testl %eax, %eax
jg 0x9323
jns 0x9345
leaq 0x1f90(%rip), %rdi      # 0xb2cc
movl %eax, %esi
xorl %eax, %eax
callq 0x8b10
movq 0x10444(%rip), %rdi     # 0x19790
callq 0x2070
jmp 0x9363
leaq 0x1fe7(%rip), %rdi      # 0xb341
movl %eax, %esi
xorl %eax, %eax
callq 0x8b10
addq $0x28, %rsp
retq