// File: /workspace/github_cpp_makefile_star2_O1/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 %r12
pushq %rbx
subq $0x48, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xcfc(%rip), %rsi       # 0x3012
leaq 0xd09(%rip), %rdx       # 0x3026
leaq 0x28(%rsp), %rdi
callq 0x29ea
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x20c0
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x234d
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x20f0
movq %rbx, %rdi
callq 0x25a9
testb %al, %al
je 0x24c4
leaq 0xf(%rsp), %rsi
movb $-0x40, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0x2a7a
leaq 0xf(%rsp), %rsi
movb $0x5, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0x2a7a
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
leaq 0x10(%rsp), %rsi
callq *0x48(%rax)
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x2130
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 0x2a7a
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 0x2130
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 0x2130
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 0x2130
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 0x2a7a
leaq 0xf(%rsp), %rsi
movb $0x2, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0x2a7a
leaq 0xf(%rsp), %rsi
movb $-0x9, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0x2a7a
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
leaq 0x10(%rsp), %rsi
callq *0x48(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x40(%rax)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x24e4
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x20f0
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x2587
jmp 0x2587
jmp 0x2587
jmp 0x2587
jmp 0x2587
jmp 0x2587
movq %rax, %r14
cmpl $0x1, %edx
jne 0x258a
movq %r14, %rdi
callq 0x2050
movq (%rax), %rcx
movq %rax, %rdi
callq *0x18(%rcx)
callq 0x2160
jmp 0x24c4
jmp 0x2587
movq %rdx, %r15
movq %rax, %r14
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x2551
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x20f0
jmp 0x2551
movq %rdx, %r15
movq %rax, %r14
movl $0x10, %esi
movq %rbx, %rdi
callq 0x20f0
jmp 0x2566
movq %rdx, %r15
movq %rax, %r14
cmpl $0x1, %r15d
jne 0x258a
movq %r14, %rdi
callq 0x2050
movq (%rax), %rcx
movq %rax, %rdi
callq *0x18(%rcx)
movl $0x1, %edi
callq 0x2110
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x25a1
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x20f0
movq %r14, %rdi
callq 0x2180