// File: 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 %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movl $0x0, -0x4(%rbp)
movq $0x0, -0x10(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x3d20
movl $0x10, %edi
callq 0x3160
movq %rax, -0x88(%rbp)
jmp 0x3436
movb $0x1, -0x5a(%rbp)
leaq -0x59(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x3290
movq -0x90(%rbp), %rdx
leaq 0x1bba(%rip), %rsi      # 0x5012
leaq -0x58(%rbp), %rdi
callq 0x3d40
jmp 0x3463
movq -0x88(%rbp), %rdi
xorl %esi, %esi
leaq -0x58(%rbp), %rdx
callq 0x3140
jmp 0x3477
movq -0x88(%rbp), %rax
movb $0x0, -0x5a(%rbp)
movq %rax, -0x10(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x30c0
leaq -0x59(%rbp), %rdi
callq 0x31a0
jmp 0x3523
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x34f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x34ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x30c0
leaq -0x59(%rbp), %rdi
callq 0x31a0
testb $0x1, -0x5a(%rbp)
jne 0x34df
jmp 0x34f0
movq -0x88(%rbp), %rdi
movl $0x10, %esi
callq 0x3170
jmp 0x34f2
movl -0x34(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x3863
movq -0x30(%rbp), %rdi
callq 0x3090
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movl $0x1, %edi
callq 0x31e0
movq -0x10(%rbp), %rdi
callq 0x3880
movb %al, -0x91(%rbp)
jmp 0x3534
movb -0x91(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x358d
jmp 0x3822
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x3863
movq -0x30(%rbp), %rdi
callq 0x3090
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl $0x2, -0x74(%rbp)
callq 0x3270
jmp 0x358f
jmp 0x35b1
movl -0x74(%rbp), %eax
subl $0x2, %eax
je 0x3822
jmp 0x384e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x3863
movb $-0x40, -0x75(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x75(%rbp), %rsi
callq 0x3df0
jmp 0x35c4
movb $0x5, -0x76(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x76(%rbp), %rsi
callq 0x3df0
jmp 0x35d7
movq -0x10(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x3e20
jmp 0x35e6
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x3230
jmp 0x35f2
xorl %eax, %eax
movl %eax, %esi
leaq -0x28(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x3e50
movq -0xa0(%rbp), %rdi
movb $-0xf, (%rax)
movl $0x1, %esi
callq 0x3e50
movq -0xa0(%rbp), %rsi
movb $0x3c, (%rax)
movq -0x10(%rbp), %rdi
callq 0x3e20
jmp 0x362f
xorl %eax, %eax
movl %eax, %esi
leaq -0x28(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x3e50
movq -0xa8(%rbp), %rdi
movb $-0x50, (%rax)
movl $0x1, %esi
callq 0x3e50
movq -0xa8(%rbp), %rdi
movb $0x7, (%rax)
movb $0x64, -0x77(%rbp)
leaq -0x77(%rbp), %rsi
callq 0x3df0
jmp 0x3670
movq -0x10(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x3e20
jmp 0x367f
xorl %eax, %eax
movl %eax, %esi
leaq -0x28(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x3e50
movq -0xb0(%rbp), %rdi
movb $-0x70, (%rax)
movl $0x1, %esi
callq 0x3e50
movq -0xb0(%rbp), %rdi
movb $0x40, (%rax)
movl $0x2, %esi
callq 0x3e50
movq -0xb0(%rbp), %rsi
movb $0x5a, (%rax)
movq -0x10(%rbp), %rdi
callq 0x3e20
jmp 0x36d0
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x3230
jmp 0x36dc
xorl %eax, %eax
movl %eax, %esi
leaq -0x28(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x3e50
movq -0xb8(%rbp), %rdi
movb $-0x80, (%rax)
movl $0x1, %esi
callq 0x3e50
movq -0xb8(%rbp), %rdi
movb $0x40, (%rax)
movl $0x2, %esi
callq 0x3e50
movq -0xb8(%rbp), %rsi
movb $0x28, (%rax)
movq -0x10(%rbp), %rdi
callq 0x3e20
jmp 0x372d
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x3230
jmp 0x3739
xorl %eax, %eax
movl %eax, %esi
leaq -0x28(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x3e50
movq -0xc0(%rbp), %rdi
movb $-0x50, (%rax)
movl $0x1, %esi
callq 0x3e50
movq -0xc0(%rbp), %rdi
movb $0x7, (%rax)
movl $0x2, %esi
callq 0x3e50
movq -0xc0(%rbp), %rsi
movb $0x28, (%rax)
movq -0x10(%rbp), %rdi
callq 0x3e20
jmp 0x378a
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x3230
jmp 0x3796
xorl %eax, %eax
movl %eax, %esi
leaq -0x28(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x3e50
movq -0xc8(%rbp), %rdi
movb $-0x10, (%rax)
movl $0x1, %esi
callq 0x3e50
movq -0xc8(%rbp), %rdi
movb $0x43, (%rax)
movl $0x2, %esi
callq 0x3e50
movq -0xc8(%rbp), %rdi
movb $0x4, (%rax)
movb $0x3, -0x78(%rbp)
leaq -0x78(%rbp), %rsi
callq 0x3df0
jmp 0x37eb
movb $0x2, -0x79(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x79(%rbp), %rsi
callq 0x3df0
jmp 0x37fe
movb $-0x9, -0x7a(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x7a(%rbp), %rsi
callq 0x3df0
jmp 0x3811
movq -0x10(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x3e20
jmp 0x3820
jmp 0x3822
movq -0x10(%rbp), %rax
movq %rax, -0xd0(%rbp)
cmpq $0x0, %rax
je 0x3840
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movl $0x0, -0x4(%rbp)
movl $0x1, -0x74(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x3e70
movl -0x4(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x3e70
movq -0x30(%rbp), %rdi
callq 0x3280
nopw %cs:(%rax,%rax)