// File: tobias93[P]piano/rtmidi_build/tests/midiprobe.cpp
// Function: main
int main()
{
  // Create an api map.
  std::map<int, std::string> apiMap;
  apiMap[RtMidi::MACOSX_CORE] = "OS-X CoreMidi";
  apiMap[RtMidi::WINDOWS_MM] = "Windows MultiMedia";
  apiMap[RtMidi::UNIX_JACK] = "Jack Client";
  apiMap[RtMidi::LINUX_ALSA] = "Linux ALSA";
  apiMap[RtMidi::RTMIDI_DUMMY] = "RtMidi Dummy";

  std::vector< RtMidi::Api > apis;
  RtMidi :: getCompiledApi( apis );

  std::cout << "\nCompiled APIs:\n";
  for ( unsigned int i=0; i<apis.size(); i++ )
    std::cout << "  " << apiMap[ apis[i] ] << std::endl;

  RtMidiIn  *midiin = 0;
  RtMidiOut *midiout = 0;

  try {

    // RtMidiIn constructor ... exception possible
    midiin = new RtMidiIn();

    std::cout << "\nCurrent input API: " << apiMap[ midiin->getCurrentApi() ] << std::endl;

    // Check inputs.
    unsigned int nPorts = midiin->getPortCount();
    std::cout << "\nThere are " << nPorts << " MIDI input sources available.\n";

    for ( unsigned i=0; i<nPorts; i++ ) {
      std::string portName = midiin->getPortName(i);
      std::cout << "  Input Port #" << i+1 << ": " << portName << '\n';
    }

    // RtMidiOut constructor ... exception possible
    midiout = new RtMidiOut();

    std::cout << "\nCurrent output API: " << apiMap[ midiout->getCurrentApi() ] << std::endl;

    // Check outputs.
    nPorts = midiout->getPortCount();
    std::cout << "\nThere are " << nPorts << " MIDI output ports available.\n";

    for ( unsigned i=0; i<nPorts; i++ ) {
      std::string portName = midiout->getPortName(i);
      std::cout << "  Output Port #" << i+1 << ": " << portName << std::endl;
    }
    std::cout << std::endl;

  } catch ( RtMidiError &error ) {
    error.printMessage();
  }

  delete midiin;
  delete midiout;

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movl $0x0, -0x4(%rbp)
leaq -0x38(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0x3c90
movq -0x148(%rbp), %rdi
movl $0x1, -0x3c(%rbp)
leaq -0x3c(%rbp), %rsi
callq 0x3cb0
movq %rax, -0x140(%rbp)
jmp 0x3422
movq -0x140(%rbp), %rdi
leaq 0x2bd4(%rip), %rsi      # 0x6004
callq 0x3210
jmp 0x3437
movl $0x4, -0x50(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3cb0
movq %rax, -0x150(%rbp)
jmp 0x3454
movq -0x150(%rbp), %rdi
leaq 0x2bb0(%rip), %rsi      # 0x6012
callq 0x3210
jmp 0x3469
movl $0x3, -0x54(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x54(%rbp), %rsi
callq 0x3cb0
movq %rax, -0x158(%rbp)
jmp 0x3486
movq -0x158(%rbp), %rdi
leaq 0x2b91(%rip), %rsi      # 0x6025
callq 0x3210
jmp 0x349b
movl $0x2, -0x58(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x3cb0
movq %rax, -0x160(%rbp)
jmp 0x34b8
movq -0x160(%rbp), %rdi
leaq 0x2b6b(%rip), %rsi      # 0x6031
callq 0x3210
jmp 0x34cd
movl $0x5, -0x5c(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x5c(%rbp), %rsi
callq 0x3cb0
movq %rax, -0x168(%rbp)
jmp 0x34ea
movq -0x168(%rbp), %rdi
leaq 0x2b44(%rip), %rsi      # 0x603c
callq 0x3210
jmp 0x34ff
leaq -0x78(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0x3d90
movq -0x170(%rbp), %rdi
callq 0x3030
movq 0x5ab6(%rip), %rdi      # 0x8fd8
leaq 0x2b20(%rip), %rsi      # 0x6049
callq 0x3150
jmp 0x3530
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movq %rax, -0x178(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x3db0
movq %rax, %rcx
movq -0x178(%rbp), %rax
cmpq %rcx, %rax
jae 0x3605
movq 0x5a74(%rip), %rdi      # 0x8fd8
leaq 0x2aef(%rip), %rsi      # 0x605a
callq 0x3150
movq %rax, -0x180(%rbp)
jmp 0x3579
movl -0x7c(%rbp), %eax
movl %eax, %esi
leaq -0x78(%rbp), %rdi
callq 0x3dd0
movl (%rax), %eax
movl %eax, -0x80(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x3cb0
movq %rax, -0x188(%rbp)
jmp 0x35a2
movq -0x188(%rbp), %rsi
movq -0x180(%rbp), %rdi
callq 0x3130
movq %rax, -0x190(%rbp)
jmp 0x35be
movq -0x190(%rbp), %rdi
movq 0x59fc(%rip), %rsi      # 0x8fc8
callq 0x3190
jmp 0x35d3
jmp 0x35d5
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x3537
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3c73
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3c6a
movq $0x0, -0x88(%rbp)
movq $0x0, -0x90(%rbp)
movl $0x10, %edi
callq 0x3160
movq %rax, -0x198(%rbp)
jmp 0x362e
movb $0x1, -0xb2(%rbp)
leaq -0xb1(%rbp), %rdi
movq %rdi, -0x1a0(%rbp)
callq 0x3270
movq -0x1a0(%rbp), %rdx
leaq 0x2a07(%rip), %rsi      # 0x605d
leaq -0xb0(%rbp), %rdi
callq 0x3df0
jmp 0x3664
movq -0x198(%rbp), %rdi
xorl %esi, %esi
leaq -0xb0(%rbp), %rdx
movl $0x64, %ecx
callq 0x30e0
jmp 0x3680
movq -0x198(%rbp), %rax
movb $0x0, -0xb2(%rbp)
movq %rax, -0x88(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x30a0
leaq -0xb1(%rbp), %rdi
callq 0x31b0
movq 0x5924(%rip), %rdi      # 0x8fd8
leaq 0x29b6(%rip), %rsi      # 0x6071
callq 0x3150
movq %rax, -0x1a8(%rbp)
jmp 0x36c9
movq -0x88(%rbp), %rdi
callq 0x3ea0
movl %eax, -0xb8(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3cb0
movq %rax, -0x1b0(%rbp)
jmp 0x36f4
movq -0x1b0(%rbp), %rsi
movq -0x1a8(%rbp), %rdi
callq 0x3130
movq %rax, -0x1b8(%rbp)
jmp 0x3710
movq -0x1b8(%rbp), %rdi
movq 0x58aa(%rip), %rsi      # 0x8fc8
callq 0x3190
jmp 0x3725
movq -0x88(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movl %eax, -0x1bc(%rbp)
jmp 0x373d
movl -0x1bc(%rbp), %eax
movl %eax, -0xbc(%rbp)
movq 0x5888(%rip), %rdi      # 0x8fd8
leaq 0x292f(%rip), %rsi      # 0x6086
callq 0x3150
movq %rax, -0x1c8(%rbp)
jmp 0x3765
movq -0x1c8(%rbp), %rdi
movl -0xbc(%rbp), %esi
callq 0x3200
movq %rax, -0x1d0(%rbp)
jmp 0x3780
movq -0x1d0(%rbp), %rdi
leaq 0x2904(%rip), %rsi      # 0x6092
callq 0x3150
jmp 0x3795
movl $0x0, -0xc0(%rbp)
movl -0xc0(%rbp), %eax
cmpl -0xbc(%rbp), %eax
jae 0x38f5
movq -0x88(%rbp), %rsi
movl -0xc0(%rbp), %edx
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq -0xe0(%rbp), %rdi
callq *%rax
jmp 0x37d0
movq 0x5801(%rip), %rdi      # 0x8fd8
leaq 0x28d4(%rip), %rsi      # 0x60b2
callq 0x3150
movq %rax, -0x1d8(%rbp)
jmp 0x37ec
movq -0x1d8(%rbp), %rdi
movl -0xc0(%rbp), %esi
incl %esi
callq 0x3200
movq %rax, -0x1e0(%rbp)
jmp 0x3809
movq -0x1e0(%rbp), %rdi
leaq 0x286c(%rip), %rsi      # 0x6083
callq 0x3150
movq %rax, -0x1e8(%rbp)
jmp 0x3825
movq -0x1e8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x3130
movq %rax, -0x1f0(%rbp)
jmp 0x3841
movq -0x1f0(%rbp), %rdi
movl $0xa, %esi
callq 0x31e0
jmp 0x3854
leaq -0xe0(%rbp), %rdi
callq 0x30a0
movl -0xc0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc0(%rbp)
jmp 0x379f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3bb3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x38ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x30a0
leaq -0xb1(%rbp), %rdi
callq 0x31b0
testb $0x1, -0xb2(%rbp)
jne 0x38c2
jmp 0x38d3
movq -0x198(%rbp), %rdi
movl $0x10, %esi
callq 0x3170
jmp 0x3bb3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x30a0
jmp 0x3bb3
movl $0x10, %edi
callq 0x3160
movq %rax, -0x1f8(%rbp)
jmp 0x3908
movb $0x1, -0x102(%rbp)
leaq -0x101(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0x3270
movq -0x200(%rbp), %rdx
leaq 0x2791(%rip), %rsi      # 0x60c1
leaq -0x100(%rbp), %rdi
callq 0x3df0
jmp 0x393e
movq -0x1f8(%rbp), %rdi
xorl %esi, %esi
leaq -0x100(%rbp), %rdx
callq 0x3140
jmp 0x3955
movq -0x1f8(%rbp), %rax
movb $0x0, -0x102(%rbp)
movq %rax, -0x90(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x30a0
leaq -0x101(%rbp), %rdi
callq 0x31b0
movq 0x564f(%rip), %rdi      # 0x8fd8
leaq 0x2746(%rip), %rsi      # 0x60d6
callq 0x3150
movq %rax, -0x208(%rbp)
jmp 0x399e
movq -0x90(%rbp), %rdi
callq 0x3ee0
movl %eax, -0x108(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x3cb0
movq %rax, -0x210(%rbp)
jmp 0x39c9
movq -0x210(%rbp), %rsi
movq -0x208(%rbp), %rdi
callq 0x3130
movq %rax, -0x218(%rbp)
jmp 0x39e5
movq -0x218(%rbp), %rdi
movq 0x55d5(%rip), %rsi      # 0x8fc8
callq 0x3190
jmp 0x39fa
movq -0x90(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movl %eax, -0x21c(%rbp)
jmp 0x3a12
movl -0x21c(%rbp), %eax
movl %eax, -0xbc(%rbp)
movq 0x55b3(%rip), %rdi      # 0x8fd8
leaq 0x265a(%rip), %rsi      # 0x6086
callq 0x3150
movq %rax, -0x228(%rbp)
jmp 0x3a3a
movq -0x228(%rbp), %rdi
movl -0xbc(%rbp), %esi
callq 0x3200
movq %rax, -0x230(%rbp)
jmp 0x3a55
movq -0x230(%rbp), %rdi
leaq 0x2689(%rip), %rsi      # 0x60ec
callq 0x3150
jmp 0x3a6a
movl $0x0, -0x10c(%rbp)
movl -0x10c(%rbp), %eax
cmpl -0xbc(%rbp), %eax
jae 0x3c53
movq -0x90(%rbp), %rsi
movl -0x10c(%rbp), %edx
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq -0x130(%rbp), %rdi
callq *%rax
jmp 0x3aa5
movq 0x552c(%rip), %rdi      # 0x8fd8
leaq 0x2658(%rip), %rsi      # 0x610b
callq 0x3150
movq %rax, -0x238(%rbp)
jmp 0x3ac1
movq -0x238(%rbp), %rdi
movl -0x10c(%rbp), %esi
incl %esi
callq 0x3200
movq %rax, -0x240(%rbp)
jmp 0x3ade
movq -0x240(%rbp), %rdi
leaq 0x2597(%rip), %rsi      # 0x6083
callq 0x3150
movq %rax, -0x248(%rbp)
jmp 0x3afa
movq -0x248(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x3130
movq %rax, -0x250(%rbp)
jmp 0x3b16
movq -0x250(%rbp), %rdi
movq 0x54a4(%rip), %rsi      # 0x8fc8
callq 0x3190
jmp 0x3b2b
leaq -0x130(%rbp), %rdi
callq 0x30a0
movl -0x10c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c(%rbp)
jmp 0x3a74
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3b71
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x30a0
leaq -0x101(%rbp), %rdi
callq 0x31b0
testb $0x1, -0x102(%rbp)
jne 0x3b88
jmp 0x3b99
movq -0x1f8(%rbp), %rdi
movl $0x10, %esi
callq 0x3170
jmp 0x3bb3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x30a0
movl -0x4c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x3c6a
movq -0x48(%rbp), %rdi
callq 0x3080
movq %rax, -0x138(%rbp)
movq -0x138(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
callq 0x3250
jmp 0x3bea
jmp 0x3bec
movq -0x88(%rbp), %rax
movq %rax, -0x258(%rbp)
cmpq $0x0, %rax
je 0x3c0d
movq -0x258(%rbp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movq -0x90(%rbp), %rax
movq %rax, -0x260(%rbp)
cmpq $0x0, %rax
je 0x3c2e
movq -0x260(%rbp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movl $0x0, -0x4(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x3f20
leaq -0x38(%rbp), %rdi
callq 0x3f80
movl -0x4(%rbp), %eax
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
movq 0x537e(%rip), %rdi      # 0x8fd8
movq 0x5367(%rip), %rsi      # 0x8fc8
callq 0x3190
jmp 0x3c68
jmp 0x3bec
leaq -0x78(%rbp), %rdi
callq 0x3f20
leaq -0x38(%rbp), %rdi
callq 0x3f80
movq -0x48(%rbp), %rdi
callq 0x3260
nopw %cs:(%rax,%rax)
nop