// File: /workspace/github_cpp_makefile_star2_O2/tobias93[P]piano/rtmidi_build/tests/midiout.cpp
// Function: main
int main( void )
{
  RtMidiOut *midiout = 0;
  std::vector<unsigned char> message;

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

  // Call function to select port.
  try {
    if ( chooseMidiPort( midiout ) == false ) goto cleanup;
  }
  catch ( RtMidiError &error ) {
    error.printMessage();
    goto cleanup;
  }

  // Send out a series of MIDI messages.

  // Program change: 192, 5
  message.push_back( 192 );
  message.push_back( 5 );
  midiout->sendMessage( &message );

  SLEEP( 500 );

  message[0] = 0xF1;
  message[1] = 60;
  midiout->sendMessage( &message );

  // Control Change: 176, 7, 100 (volume)
  message[0] = 176;
  message[1] = 7;
  message.push_back( 100 );
  midiout->sendMessage( &message );

  // Note On: 144, 64, 90
  message[0] = 144;
  message[1] = 64;
  message[2] = 90;
  midiout->sendMessage( &message );

  SLEEP( 500 );

  // Note Off: 128, 64, 40
  message[0] = 128;
  message[1] = 64;
  message[2] = 40;
  midiout->sendMessage( &message );

  SLEEP( 500 );

  // Control Change: 176, 7, 40
  message[0] = 176;
  message[1] = 7;
  message[2] = 40;
  midiout->sendMessage( &message );

  SLEEP( 500 );

  // Sysex: 240, 67, 4, 3, 2, 247
  message[0] = 240;
  message[1] = 67;
  message[2] = 4;
  message.push_back( 3 );
  message.push_back( 2 );
  message.push_back( 247 );
  midiout->sendMessage( &message );

  // Clean up
 cleanup:
  delete midiout;

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
pushq $0x10
popq %rdi
callq 0x2130
movq %rax, %rbx
leaq 0xccd(%rip), %rsi       # 0x3012
leaq 0x30(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x284a
leaq 0x30(%rsp), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2110
leaq 0x30(%rsp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x2590
testb %al, %al
je 0x24e4
leaq 0xf(%rsp), %rsi
movb $-0x40, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0x2960
leaq 0xf(%rsp), %rsi
movb $0x5, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0x2960
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
leaq 0x10(%rsp), %rsi
callq *0x48(%rax)
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x2180
leaq 0x10(%rsp), %rsi
movq (%rsi), %rax
movb $-0xf, (%rax)
movq (%rsi), %rax
movb $0x3c, 0x1(%rax)
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
callq *0x48(%rax)
leaq 0x10(%rsp), %rdi
movq (%rdi), %rax
movb $-0x50, (%rax)
movq (%rdi), %rax
movb $0x7, 0x1(%rax)
leaq 0xf(%rsp), %rsi
movb $0x64, (%rsi)
callq 0x2960
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
leaq 0x10(%rsp), %rsi
callq *0x48(%rax)
leaq 0x10(%rsp), %rsi
movq (%rsi), %rax
movb $-0x70, (%rax)
movq (%rsi), %rax
movb $0x40, 0x1(%rax)
movq (%rsi), %rax
movb $0x5a, 0x2(%rax)
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
callq *0x48(%rax)
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x2180
leaq 0x10(%rsp), %rsi
movq (%rsi), %rax
movb $-0x80, (%rax)
movq (%rsi), %rax
movb $0x40, 0x1(%rax)
movq (%rsi), %rax
movb $0x28, 0x2(%rax)
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
callq *0x48(%rax)
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x2180
leaq 0x10(%rsp), %rsi
movq (%rsi), %rax
movb $-0x50, (%rax)
movq (%rsi), %rax
movb $0x7, 0x1(%rax)
movq (%rsi), %rax
movb $0x28, 0x2(%rax)
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
callq *0x48(%rax)
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x2180
leaq 0x10(%rsp), %rdi
movq (%rdi), %rax
movb $-0x10, (%rax)
movq (%rdi), %rax
movb $0x43, 0x1(%rax)
movq (%rdi), %rax
movb $0x4, 0x2(%rax)
leaq 0xf(%rsp), %rsi
movb $0x3, (%rsi)
callq 0x2960
leaq 0xf(%rsp), %rsi
movb $0x2, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0x2960
leaq 0xf(%rsp), %rsi
movb $-0x9, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0x2960
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
leaq 0x10(%rsp), %rsi
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x40(%rax)
leaq 0x10(%rsp), %rdi
callq 0x289e
xorl %eax, %eax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x257b
jmp 0x257b
jmp 0x257b
jmp 0x257b
jmp 0x257b
jmp 0x257b
movq %rax, %r14
cmpl $0x1, %edx
jne 0x257e
movq %r14, %rdi
callq 0x2070
movq (%rax), %rcx
movq %rax, %rdi
callq *0x18(%rcx)
callq 0x21b0
jmp 0x24e4
jmp 0x257b
movq %rdx, %r15
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x2090
jmp 0x2549
movq %rdx, %r15
movq %rax, %r14
pushq $0x10
popq %rsi
movq %rbx, %rdi
callq 0x2140
jmp 0x255c
movq %rdx, %r15
movq %rax, %r14
cmpl $0x1, %r15d
jne 0x257e
movq %r14, %rdi
callq 0x2070
movq (%rax), %rcx
movq %rax, %rdi
callq *0x18(%rcx)
pushq $0x1
popq %rdi
callq 0x2160
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x289e
movq %r14, %rdi
callq 0x21d0