// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
incq %rcx
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
incq %rcx
movq %rcx, 0x8(%rax)
movl -0xc(%rbp), %eax
movl %eax, -0x1c(%rbp)
subl $0x2f, %eax
je 0xcc9a
jmp 0xcc83
movl -0x1c(%rbp), %eax
subl $0x51, %eax
je 0xccb8
jmp 0xcc8d
movl -0x1c(%rbp), %eax
subl $0x58, %eax
je 0xccf0
jmp 0xcd88
movq -0x8(%rbp), %rax
movw $0x0, 0x14(%rax)
movl 0x12442(%rip), %eax     # 0x1f0ec
addl $-0x1, %eax
movl %eax, 0x12439(%rip)     # 0x1f0ec
jmp 0xcd88
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movl $0x3, %esi
callq 0xb620
movslq %eax, %rcx
movl $0x3938700, %eax        # imm = 0x3938700
cqto
idivq %rcx
movl %eax, -0x18(%rbp)
cmpl $0x0, 0x123d7(%rip)     # 0x1f0b8
je 0xcceb
movl -0x18(%rbp), %edi
callq 0xc020
jmp 0xcd88
cmpl $0x0, 0x123fd(%rip)     # 0x1f0f4
jg 0xcd02
cmpl $0x1, 0x8f64(%rip)      # 0x15c64
jle 0xcd11
movl 0x8f60(%rip), %eax      # 0x15c68
addl $0x1, %eax
movl %eax, 0x8f57(%rip)      # 0x15c68
movl $0x0, 0x123d9(%rip)     # 0x1f0f4
movl $0x1, 0x8f3f(%rip)      # 0x15c64
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
movl %eax, 0x1244a(%rip)     # 0x1f180
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movzbl 0x1(%rax), %eax
movl %eax, -0x14(%rbp)
movl $0x1, 0x12439(%rip)     # 0x1f188
cmpl $0x0, -0x14(%rbp)
jle 0xcd72
movl 0x1242d(%rip), %eax     # 0x1f188
addl 0x12427(%rip), %eax     # 0x1f188
movl %eax, 0x12421(%rip)     # 0x1f188
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xcd4f
movl 0x12368(%rip), %eax     # 0x1f0e0
shll $0x2, %eax
cltd
idivl 0x12406(%rip)           # 0x1f188
movl %eax, 0x123fc(%rip)     # 0x1f184
movl -0x10(%rbp), %edx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
movslq %edx, %rdx
addq %rdx, %rcx
movq %rcx, 0x8(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)