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

  // Minimal command-line check.
  if ( argc != 2 ) usage();
  nBytes = (unsigned int) atoi( argv[1] );

  // RtMidiOut and RtMidiIn constructors
  try {
    midiout = new RtMidiOut();
    midiin = new RtMidiIn();
  }
  catch ( RtMidiError &error ) {
    error.printMessage();
    goto cleanup;
  }

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

  try {
    if ( chooseMidiPort( midiin ) == false ) goto cleanup;
    if ( chooseMidiPort( midiout ) == false ) goto cleanup;
  }
  catch ( RtMidiError &error ) {
    error.printMessage();
    goto cleanup;
  }

  midiin->setCallback( &mycallback );

  message.push_back( 0xF6 );
  midiout->sendMessage( &message );
  SLEEP( 500 ); // pause a little

  // Create a long sysex message of numbered bytes and send it out ... twice.
  for ( int n=0; n<2; n++ ) {
    message.clear();
    message.push_back( 240 );
    for ( i=0; i<nBytes; i++ )
      message.push_back( i % 128 );
    message.push_back( 247 );
    midiout->sendMessage( &message );

    SLEEP( 500 ); // pause a little
  }

  // Clean up
 cleanup:
  delete midiout;
  delete midiin;

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
cmpl $0x2, %edi
jne 0x26e4
movq 0x8(%rsi), %rdi
callq 0x21b0
movl %eax, %ebp
xorl %ebx, %ebx
movl $0x10, %edi
callq 0x2110
movq %rax, %rbx
leaq 0x58(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xb5c(%rip), %rsi       # 0x3067
leaq 0xb69(%rip), %rdx       # 0x307b
leaq 0x48(%rsp), %rdi
callq 0x2d0a
leaq 0x48(%rsp), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x20e0
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x2542
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2120
movl $0x10, %edi
callq 0x2110
movq %rax, 0x8(%rsp)
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0xb1b(%rip), %rsi       # 0x307c
leaq 0xb27(%rip), %rdx       # 0x308f
leaq 0x28(%rsp), %rdi
callq 0x2d0a
leaq 0x28(%rsp), %rdx
movq 0x8(%rsp), %rdi
xorl %esi, %esi
movl $0x64, %ecx
callq 0x20b0
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x259f
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2120
movq 0x8(%rsp), %r14
movq 0x8(%r14), %rdi
movq (%rdi), %rax
xorl %esi, %esi
movl $0x1, %edx
movl $0x1, %ecx
callq *0x48(%rax)
movq %r14, %rdi
callq 0x27da
testb %al, %al
je 0x26a0
movq %rbx, %rdi
callq 0x27da
testb %al, %al
je 0x26a0
movq 0x8(%r14), %rdi
leaq -0x24c(%rip), %rsi      # 0x2399
xorl %edx, %edx
callq 0x2040
leaq 0x7(%rsp), %rsi
movb $-0xa, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0x2d9a
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
leaq 0x10(%rsp), %rsi
callq *0x48(%rax)
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x2180
xorl %r13d, %r13d
leaq 0x10(%rsp), %r15
leaq 0x7(%rsp), %r12
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
je 0x2635
movq %rax, 0x18(%rsp)
movb $-0x10, 0x7(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x2d9a
testl %ebp, %ebp
je 0x2668
xorl %r14d, %r14d
movl %r14d, %eax
andb $0x7f, %al
movb %al, 0x7(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x2d9a
incl %r14d
cmpl %r14d, %ebp
jne 0x264c
movb $-0x9, 0x7(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x2d9a
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *0x48(%rax)
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x2180
leal 0x1(%r13), %eax
testl %r13d, %r13d
movl %eax, %r13d
je 0x2624
movq 0x8(%rsp), %r14
testq %rbx, %rbx
je 0x26ae
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x40(%rax)
testq %r14, %r14
je 0x26bc
movq (%r14), %rax
movq %r14, %rdi
callq *0x40(%rax)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x26d3
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x236c
jmp 0x27b8
movq %rdx, %r12
movq %rax, %r15
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x2713
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2120
jmp 0x2713
movq %rdx, %r12
movq %rax, %r15
movl $0x10, %esi
movq 0x8(%rsp), %rdi
callq 0x2120
jmp 0x278a
movq %rdx, %r12
movq %rax, %r15
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x2749
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2120
jmp 0x2749
movq %rdx, %r12
movq %rax, %r15
movl $0x10, %esi
movq %rbx, %rdi
callq 0x2120
xorl %ebx, %ebx
jmp 0x278a
movq %rax, %r15
cmpl $0x1, %edx
jne 0x27bb
movq %r15, %rdi
callq 0x2060
movq (%rax), %rcx
movq %rax, %rdi
callq *0x18(%rcx)
callq 0x21e0
movq 0x8(%rsp), %r14
jmp 0x26a0
jmp 0x27b8
movq %rdx, %r12
movq %rax, %r15
cmpl $0x1, %r12d
jne 0x27bb
movq %r15, %rdi
callq 0x2060
movq (%rax), %rcx
movq %rax, %rdi
callq *0x18(%rcx)
callq 0x21e0
xorl %r14d, %r14d
jmp 0x26a0
jmp 0x27b8
jmp 0x27b8
jmp 0x27b8
jmp 0x27b8
jmp 0x27b8
movq %rax, %r15
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x27d2
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
movq %r15, %rdi
callq 0x2210