// File: /workspace/github_cpp_makefile_star2_O3/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 0x26f4
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 0xb47(%rip), %rsi       # 0x3067
leaq 0xb54(%rip), %rdx       # 0x307b
leaq 0x48(%rsp), %rdi
callq 0x2d3a
leaq 0x48(%rsp), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x20e0
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x2557
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 0xb06(%rip), %rsi       # 0x307c
leaq 0xb12(%rip), %rdx       # 0x308f
leaq 0x28(%rsp), %rdi
callq 0x2d3a
leaq 0x28(%rsp), %rdx
movq 0x8(%rsp), %rdi
xorl %esi, %esi
movl $0x64, %ecx
callq 0x20b0
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x25b4
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 0x27f3
testb %al, %al
je 0x26b5
movq %rbx, %rdi
callq 0x27f3
testb %al, %al
je 0x26b5
movq 0x8(%r14), %rdi
leaq -0x261(%rip), %rsi      # 0x2399
xorl %edx, %edx
callq 0x2040
leaq 0x7(%rsp), %rsi
movb $-0xa, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0x2dd0
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
leaq 0x10(%rsp), %rsi
callq *0x48(%rax)
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x2180
movb $0x1, %r13b
leaq 0x10(%rsp), %r15
leaq 0x7(%rsp), %r12
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
je 0x264a
movq %rax, 0x18(%rsp)
movb $-0x10, 0x7(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x2dd0
testl %ebp, %ebp
je 0x267d
xorl %r14d, %r14d
movl %r14d, %eax
andb $0x7f, %al
movb %al, 0x7(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x2dd0
incl %r14d
cmpl %r14d, %ebp
jne 0x2661
movb $-0x9, 0x7(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x2dd0
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *0x48(%rax)
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x2180
testb $0x1, %r13b
movl $0x0, %r13d
jne 0x2639
movq 0x8(%rsp), %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x40(%rax)
testq %r14, %r14
je 0x26cc
movq (%r14), %rax
movq %r14, %rdi
callq *0x40(%rax)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x26e3
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 0x27d1
movq %rdx, %r12
movq %rax, %r15
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x2723
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2120
jmp 0x2723
movq %rdx, %r12
movq %rax, %r15
movl $0x10, %esi
movq 0x8(%rsp), %rdi
callq 0x2120
jmp 0x279a
movq %rdx, %r12
movq %rax, %r15
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x2759
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2120
jmp 0x2759
movq %rdx, %r12
movq %rax, %r15
movl $0x10, %esi
movq %rbx, %rdi
callq 0x2120
xorl %ebx, %ebx
jmp 0x279a
movq %rax, %r15
cmpl $0x1, %edx
jne 0x27d4
movq %r15, %rdi
callq 0x2060
movq (%rax), %rcx
movq %rax, %rdi
callq *0x18(%rcx)
callq 0x21e0
movq 0x8(%rsp), %r14
jmp 0x26b5
jmp 0x27d1
movq %rdx, %r12
movq %rax, %r15
cmpl $0x1, %r12d
jne 0x27d4
movq %r15, %rdi
callq 0x2060
movq (%rax), %rcx
movq %rax, %rdi
callq *0x18(%rcx)
callq 0x21e0
testq %rbx, %rbx
je 0x26cc
xorl %r14d, %r14d
jmp 0x26b5
jmp 0x27d1
jmp 0x27d1
jmp 0x27d1
jmp 0x27d1
jmp 0x27d1
movq %rax, %r15
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x27eb
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2120
movq %r15, %rdi
callq 0x2210