// File: /workspace/github_c_makefile_star2_O0/jonof[P]jfaudiolib/src/midi.c
// Function: MIDI_ProcessNextTick
static int _MIDI_ProcessNextTick
   (
   void
   )

   {
   int   event;
   int   channel;
   int   command;
   track *Track;
   int   tracknum;
   int   status;
   int   c1 = 0;
   int   c2 = 0;
   int   TimeSet = FALSE;

   Track = _MIDI_TrackPtr;
   tracknum = 0;
   while( ( tracknum < _MIDI_NumTracks ) && ( Track != NULL ) )
      {
      while ( ( Track->active ) && ( Track->delay == 0 ) )
         {
         GET_NEXT_EVENT( Track, event );

         if ( GET_MIDI_COMMAND( event ) == MIDI_SPECIAL )
            {
            switch( event )
               {
               case MIDI_SYSEX :
               case MIDI_SYSEX_CONTINUE :
                  _MIDI_SysEx( Track );
                  break;

               case MIDI_META_EVENT :
                  _MIDI_MetaEvent( Track );
                  break;
               }

            if ( Track->active )
               {
               Track->delay = _MIDI_ReadDelta( Track );
               }

            continue;
            }

         if ( event & MIDI_RUNNING_STATUS )
            {
            Track->RunningStatus = event;
            }
         else
            {
            event = Track->RunningStatus;
            Track->pos--;
            }

         channel = GET_MIDI_CHANNEL( event );
         command = GET_MIDI_COMMAND( event );

         if ( _MIDI_CommandLengths[ command ] > 0 )
            {
            GET_NEXT_EVENT( Track, c1 );
            if ( _MIDI_CommandLengths[ command ] > 1 )
               {
               GET_NEXT_EVENT( Track, c2 );
               }
            }

         if ( _MIDI_RerouteFunctions[ channel ] != NULL )
            {
            status = _MIDI_RerouteFunctions[ channel ]( event, c1, c2 );

            if ( status == MIDI_DONT_PLAY )
               {
               Track->delay = _MIDI_ReadDelta( Track );
               continue;
               }
            }

         switch ( command )
            {
            case MIDI_NOTE_OFF :
               break;

            case MIDI_NOTE_ON :
               break;

            case MIDI_POLY_AFTER_TCH :
               if ( _MIDI_Funcs->PolyAftertouch )
                  {
                  _MIDI_Funcs->PolyAftertouch( channel, c1, c2 );
                  }
               break;

            case MIDI_CONTROL_CHANGE :
               TimeSet = _MIDI_InterpretControllerInfo( Track, TimeSet,
                  channel, c1, c2 );
               break;

            case MIDI_PROGRAM_CHANGE :
               if ( ( _MIDI_Funcs->ProgramChange ) &&
                  ( !Track->EMIDI_ProgramChange ) )
                  {
                  _MIDI_Funcs->ProgramChange( channel, c1 );
                  }
               break;

            case MIDI_AFTER_TOUCH :
               if ( _MIDI_Funcs->ChannelAftertouch )
                  {
                  _MIDI_Funcs->ChannelAftertouch( channel, c1 );
                  }
               break;

            case MIDI_PITCH_BEND :
               if ( _MIDI_Funcs->PitchBend )
                  {
                  _MIDI_Funcs->PitchBend( channel, c1, c2 );
                  }
               break;

            default :
               break;
            }

         Track->delay = _MIDI_ReadDelta( Track );
         }

      Track->delay--;
      Track++;
      tracknum++;

      if ( _MIDI_ActiveTracks == 0 )
         {
         break;
         }
      }

   _MIDI_AdvanceTick();

   return( TimeSet );
   }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq 0x12bac(%rip), %rax     # 0x1f0c0
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %ecx
xorl %eax, %eax
cmpl 0x12b9e(%rip), %ecx     # 0x1f0c8
movb %al, -0x2d(%rbp)
jge 0xc53a
cmpq $0x0, -0x18(%rbp)
setne %al
movb %al, -0x2d(%rbp)
movb -0x2d(%rbp), %al
testb $0x1, %al
jne 0xc546
jmp 0xc82f
jmp 0xc548
movq -0x18(%rbp), %rax
movswl 0x14(%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x2e(%rbp)
je 0xc568
movq -0x18(%rbp), %rax
cmpl $0x0, 0x10(%rax)
sete %al
movb %al, -0x2e(%rbp)
movb -0x2e(%rbp), %al
testb $0x1, %al
jne 0xc574
jmp 0xc7fb
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
movl %eax, -0x4(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movl -0x4(%rbp), %eax
sarl $0x4, %eax
cmpl $0xf, %eax
jne 0xc5fa
movl -0x4(%rbp), %eax
movl %eax, -0x34(%rbp)
subl $0xf0, %eax
je 0xc5c4
jmp 0xc5ac
movl -0x34(%rbp), %eax
subl $0xf7, %eax
je 0xc5c4
jmp 0xc5b8
movl -0x34(%rbp), %eax
subl $0xff, %eax
je 0xc5cf
jmp 0xc5d8
movq -0x18(%rbp), %rdi
callq 0xcb70
jmp 0xc5d8
movq -0x18(%rbp), %rdi
callq 0xcc30
movq -0x18(%rbp), %rax
cmpw $0x0, 0x14(%rax)
je 0xc5f5
movq -0x18(%rbp), %rdi
callq 0xcaf0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0xc548
movl -0x4(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0xc617
movl -0x4(%rbp), %eax
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0x16(%rax)
jmp 0xc632
movq -0x18(%rbp), %rax
movswl 0x16(%rax), %eax
movl %eax, -0x4(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
movl -0x4(%rbp), %eax
andl $0xf, %eax
movl %eax, -0x8(%rbp)
movl -0x4(%rbp), %eax
sarl $0x4, %eax
movl %eax, -0xc(%rbp)
movslq -0xc(%rbp), %rcx
leaq 0x33f1(%rip), %rax      # 0xfa40
cmpl $0x0, (%rax,%rcx,4)
jle 0xc6a4
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movslq -0xc(%rbp), %rcx
leaq 0x33c2(%rip), %rax      # 0xfa40
cmpl $0x1, (%rax,%rcx,4)
jle 0xc6a2
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
jmp 0xc6a4
movslq -0x8(%rbp), %rcx
leaq 0x12931(%rip), %rax     # 0x1efe0
cmpq $0x0, (%rax,%rcx,8)
je 0xc6f2
movslq -0x8(%rbp), %rcx
leaq 0x1291f(%rip), %rax     # 0x1efe0
movq (%rax,%rcx,8), %rax
movl -0x4(%rbp), %edi
movl -0x24(%rbp), %esi
movl -0x28(%rbp), %edx
callq *%rax
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jne 0xc6f0
movq -0x18(%rbp), %rdi
callq 0xcaf0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0xc548
jmp 0xc6f2
movl -0xc(%rbp), %eax
addl $-0x8, %eax
movl %eax, %ecx
movq %rcx, -0x40(%rbp)
subl $0x6, %eax
ja 0xc7e2
movq -0x40(%rbp), %rax
leaq 0x3132(%rip), %rcx      # 0xf844
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0xc7e4
jmp 0xc7e4
movq 0x1297c(%rip), %rax     # 0x1f0a8
cmpq $0x0, 0x10(%rax)
je 0xc749
movq 0x1296e(%rip), %rax     # 0x1f0a8
movq 0x10(%rax), %rax
movl -0x8(%rbp), %edi
movl -0x24(%rbp), %esi
movl -0x28(%rbp), %edx
callq *%rax
jmp 0xc7e4
movq -0x18(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl -0x8(%rbp), %edx
movl -0x24(%rbp), %ecx
movl -0x28(%rbp), %r8d
callq 0xcdb0
movl %eax, -0x2c(%rbp)
jmp 0xc7e4
movq 0x12938(%rip), %rax     # 0x1f0a8
cmpq $0x0, 0x20(%rax)
je 0xc797
movq -0x18(%rbp), %rax
cmpb $0x0, 0x171(%rax)
jne 0xc797
movq 0x1291d(%rip), %rax     # 0x1f0a8
movq 0x20(%rax), %rax
movl -0x8(%rbp), %edi
movl -0x24(%rbp), %esi
callq *%rax
jmp 0xc7e4
movq 0x12908(%rip), %rax     # 0x1f0a8
cmpq $0x0, 0x28(%rax)
je 0xc7ba
movq 0x128fa(%rip), %rax     # 0x1f0a8
movq 0x28(%rax), %rax
movl -0x8(%rbp), %edi
movl -0x24(%rbp), %esi
callq *%rax
jmp 0xc7e4
movq 0x128e5(%rip), %rax     # 0x1f0a8
cmpq $0x0, 0x30(%rax)
je 0xc7e0
movq 0x128d7(%rip), %rax     # 0x1f0a8
movq 0x30(%rax), %rax
movl -0x8(%rbp), %edi
movl -0x24(%rbp), %esi
movl -0x28(%rbp), %edx
callq *%rax
jmp 0xc7e4
jmp 0xc7e4
movq -0x18(%rbp), %rdi
callq 0xcaf0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0xc548
movq -0x18(%rbp), %rax
movl 0x10(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x18(%rbp), %rax
addq $0x178, %rax            # imm = 0x178
movq %rax, -0x18(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, 0x128c6(%rip)     # 0x1f0ec
jne 0xc82a
jmp 0xc82f
jmp 0xc51f
callq 0xd370
movl -0x2c(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)