// File: /workspace/github_cpp_makefile_star2_O1/tobias93[P]piano/rtmidi_build/tests/qmidiin.cpp
// Function: main
int main( int argc, char *argv[] )
{
  RtMidiIn *midiin = 0;
  std::vector<unsigned char> message;
  int nBytes, i;
  double stamp;

  // Minimal command-line check.
  if ( argc > 2 ) usage();

  // RtMidiIn constructor
  try {
    midiin = new RtMidiIn();
  }
  catch ( RtMidiError &error ) {
    error.printMessage();
    exit( EXIT_FAILURE );
  }

  // Check available ports vs. specified.
  unsigned int port = 0;
  unsigned int nPorts = midiin->getPortCount();
  if ( argc == 2 ) port = (unsigned int) atoi( argv[1] );
  if ( port >= nPorts ) {
    delete midiin;
    std::cout << "Invalid port specifier!\n";
    usage();
  }

  try {
    midiin->openPort( port );
  }
  catch ( RtMidiError &error ) {
    error.printMessage();
    goto cleanup;
  }

  // Don't ignore sysex, timing, or active sensing messages.
  midiin->ignoreTypes( false, false, false );

  // Install an interrupt handler function.
  done = false;
  (void) signal(SIGINT, finish);

  // Periodically check input queue.
  std::cout << "Reading MIDI from port " << midiin->getPortName() << " ... quit with Ctrl-C.\n";
  while ( !done ) {
    stamp = midiin->getMessage( &message );
    nBytes = message.size();
    for ( i=0; i<nBytes; i++ )
      std::cout << "Byte " << i << " = " << (int)message[i] << ", ";
    if ( nBytes > 0 )
      std::cout << "stamp = " << stamp << std::endl;

    // Sleep for 10 milliseconds.
    SLEEP( 10 );
  }

  // Clean up
 cleanup:
  delete midiin;

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
cmpl $0x3, %edi
jge 0x25ac
movq %rsi, %r14
movl %edi, %ebp
movl $0x10, %edi
callq 0x20d0
movq %rax, 0x8(%rsp)
leaq 0x88(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0xd05(%rip), %rsi       # 0x3050
leaq 0xd11(%rip), %rdx       # 0x3063
leaq 0x78(%rsp), %rdi
callq 0x270e
leaq 0x78(%rsp), %rdx
movq 0x8(%rsp), %rdi
xorl %esi, %esi
movl $0x64, %ecx
callq 0x2070
movq 0x78(%rsp), %rdi
cmpq %rbx, %rdi
je 0x238c
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x20e0
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movl %eax, %ebx
xorl %r15d, %r15d
cmpl $0x2, %ebp
jne 0x23ad
movq 0x8(%r14), %rdi
callq 0x2140
movl %eax, %r15d
cmpl %ebx, %r15d
jae 0x25b1
leaq 0x68(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0xcb7(%rip), %rsi       # 0x307d
leaq 0xcbc(%rip), %rdx       # 0x3089
leaq 0x58(%rsp), %rdi
callq 0x270e
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
leaq 0x58(%rsp), %rdx
movl %r15d, %esi
callq *(%rax)
movq 0x58(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2400
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x20e0
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq *0x48(%rax)
movb $0x0, 0x2cd6(%rip)      # 0x50f2
leaq 0x2e3(%rip), %rsi       # 0x2706
movl $0x2, %edi
callq 0x2100
movq 0x2ba4(%rip), %rdi      # 0x4fd8
leaq 0xc4f(%rip), %rsi       # 0x308a
movl $0x17, %edx
callq 0x20f0
movq 0x8(%rsp), %rsi
movq (%rsi), %rax
leaq 0x38(%rsp), %rdi
xorl %edx, %edx
callq *0x18(%rax)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq 0x2b70(%rip), %rdi      # 0x4fd8
callq 0x20f0
leaq 0xc2e(%rip), %rsi       # 0x30a2
movl $0x17, %edx
movq %rax, %rdi
callq 0x20f0
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x249c
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x20e0
movq 0x2b35(%rip), %r15      # 0x4fd8
leaq 0xc16(%rip), %rbp       # 0x30c0
cmpb $0x0, 0x2c41(%rip)      # 0x50f2
jne 0x2623
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2090
movsd %xmm0, 0x30(%rsp)
movq 0x18(%rsp), %r13
subq 0x10(%rsp), %r13
testl %r13d, %r13d
jle 0x254c
movl %r13d, %r12d
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
xorl %r14d, %r14d
movl $0x5, %edx
movq %r15, %rdi
leaq 0xbbf(%rip), %rsi       # 0x30ba
callq 0x20f0
movq %r15, %rdi
movl %r14d, %esi
callq 0x2170
movq %rax, %rbx
movl $0x3, %edx
movq %rax, %rdi
leaq 0xbab(%rip), %rsi       # 0x30c8
callq 0x20f0
movq 0x10(%rsp), %rax
movzbl (%rax,%r14), %esi
movq %rbx, %rdi
callq 0x2170
movl $0x2, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x20f0
incq %r14
cmpq %r14, %r12
jne 0x24ec
testl %r13d, %r13d
jle 0x259d
movl $0x8, %edx
movq %r15, %rdi
leaq 0xb63(%rip), %rsi       # 0x30c3
callq 0x20f0
movq %r15, %rdi
movsd 0x30(%rsp), %xmm0
callq 0x2150
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x20b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2050
movl $0x2710, %edi           # imm = 0x2710
callq 0x2120
jmp 0x24aa
callq 0x22cc
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movq 0x2a15(%rip), %rdi      # 0x4fd8
leaq 0xa9a(%rip), %rsi       # 0x3064
movl $0x18, %edx
callq 0x20f0
callq 0x22cc
jmp 0x26e4
movq %rdx, %r15
movq %rax, %r14
movq 0x58(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2603
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x20e0
jmp 0x2603
movq %rdx, %r15
movq %rax, %r14
cmpl $0x1, %r15d
jne 0x26e7
movq %r14, %rdi
callq 0x2040
movq (%rax), %rcx
movq %rax, %rdi
callq *0x18(%rcx)
callq 0x2160
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2645
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x20e0
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x26e4
movq %rdx, %r15
movq %rax, %r14
movq 0x78(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2686
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x20e0
jmp 0x2686
movq %rdx, %r15
movq %rax, %r14
movl $0x10, %esi
movq 0x8(%rsp), %rdi
callq 0x20e0
jmp 0x269d
movq %rdx, %r15
movq %rax, %r14
cmpl $0x1, %r15d
jne 0x26e7
movq %r14, %rdi
callq 0x2040
movq (%rax), %rcx
movq %rax, %rdi
callq *0x18(%rcx)
movl $0x1, %edi
callq 0x2110
jmp 0x26e4
movq %rax, %r14
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x26e7
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x20e0
jmp 0x26e7
jmp 0x26e4
jmp 0x26e4
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x26fe
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x20e0
movq %r14, %rdi
callq 0x2180