// File: /workspace/github_cpp_makefile_star2_O2/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)
andq $0x0, 0x20(%rsp)
cmpl $0x2, %edi
jne 0x267d
movq 0x8(%rsi), %rdi
callq 0x21f0
movl %eax, %ebp
xorl %r13d, %r13d
pushq $0x10
popq %rdi
callq 0x2150
movq %rax, %rbx
leaq 0xb7e(%rip), %rsi       # 0x3067
leaq 0x48(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x2a72
leaq 0x48(%rsp), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2130
leaq 0x48(%rsp), %rdi
callq 0x20a0
pushq $0x10
popq %rdi
movq %rbx, %r13
callq 0x2150
movq %rax, 0x8(%rsp)
leaq 0xb54(%rip), %rsi       # 0x307c
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x2a72
leaq 0x28(%rsp), %rdx
pushq $0x64
popq %rcx
movq 0x8(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x20f0
leaq 0x28(%rsp), %rdi
callq 0x20a0
movq 0x8(%r14), %rdi
movq (%rdi), %rax
pushq $0x1
popq %rcx
xorl %esi, %esi
movl %ecx, %edx
callq *0x48(%rax)
movq %r14, %rdi
callq 0x2754
testb %al, %al
je 0x264b
movq %rbx, %rdi
callq 0x2754
testb %al, %al
je 0x264b
leaq -0x1c7(%rip), %rsi      # 0x23c9
movq %r14, %rdi
xorl %edx, %edx
callq 0x2aae
leaq 0x7(%rsp), %rsi
movb $-0xa, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0x2bd6
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
leaq 0x10(%rsp), %rsi
callq *0x48(%rax)
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x21c0
xorl %r13d, %r13d
leaq 0x10(%rsp), %r15
leaq 0x7(%rsp), %r12
cmpl $0x2, %r13d
je 0x2646
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
je 0x25e9
movq %rax, 0x18(%rsp)
movb $-0x10, 0x7(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x2bd6
xorl %r14d, %r14d
cmpl %r14d, %ebp
je 0x261a
movl %r14d, %eax
andb $0x7f, %al
movb %al, 0x7(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x2bd6
incl %r14d
jmp 0x25fc
movb $-0x9, 0x7(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x2bd6
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *0x48(%rax)
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x21c0
incl %r13d
jmp 0x25d2
movq 0x8(%rsp), %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x40(%rax)
testq %r14, %r14
je 0x2662
movq (%r14), %rax
movq %r14, %rdi
callq *0x40(%rax)
leaq 0x10(%rsp), %rdi
callq 0x2af8
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x239c
jmp 0x273f
movq %rdx, %r12
movq %rax, %r15
leaq 0x28(%rsp), %rdi
callq 0x20a0
jmp 0x269f
movq %rdx, %r12
movq %rax, %r15
pushq $0x10
popq %rsi
movq 0x8(%rsp), %rdi
callq 0x2160
jmp 0x2708
movq %rdx, %r12
movq %rax, %r15
leaq 0x48(%rsp), %rdi
callq 0x20a0
jmp 0x26c6
movq %rdx, %r12
movq %rax, %r15
pushq $0x10
popq %rsi
movq %rbx, %rdi
callq 0x2160
xorl %ebx, %ebx
jmp 0x2708
movq %rax, %r15
cmpl $0x1, %edx
jne 0x2742
movq %r15, %rdi
callq 0x2080
movq (%rax), %rcx
movq %rax, %rdi
callq *0x18(%rcx)
callq 0x2220
movq 0x8(%rsp), %r14
jmp 0x264b
jmp 0x273f
movq %rdx, %r12
movq %rax, %r15
movq %r13, %rbx
cmpl $0x1, %r12d
jne 0x2742
movq %r15, %rdi
callq 0x2080
movq (%rax), %rcx
movq %rax, %rdi
callq *0x18(%rcx)
callq 0x2220
testq %rbx, %rbx
je 0x2662
xorl %r14d, %r14d
jmp 0x264b
jmp 0x273f
jmp 0x273f
jmp 0x273f
jmp 0x273f
jmp 0x273f
movq %rax, %r15
leaq 0x10(%rsp), %rdi
callq 0x2af8
movq %r15, %rdi
callq 0x2250