// File: tobias93[P]piano/rtmidi_build/tests/midiout.cpp
// Function: chooseMidiPort(RtMidiOut*)
bool chooseMidiPort( RtMidiOut *rtmidi )
{
  std::cout << "\nWould you like to open a virtual output port? [y/N] ";

  std::string keyHit;
  std::getline( std::cin, keyHit );
  if ( keyHit == "y" ) {
    rtmidi->openVirtualPort();
    return true;
  }

  std::string portName;
  unsigned int i = 0, nPorts = rtmidi->getPortCount();
  if ( nPorts == 0 ) {
    std::cout << "No output ports available!" << std::endl;
    return false;
  }

  if ( nPorts == 1 ) {
    std::cout << "\nOpening " << rtmidi->getPortName() << std::endl;
  }
  else {
    for ( i=0; i<nPorts; i++ ) {
      portName = rtmidi->getPortName(i);
      std::cout << "  Output port #" << i << ": " << portName << '\n';
    }

    do {
      std::cout << "\nChoose a port number: ";
      std::cin >> i;
    } while ( i >= nPorts );
  }

  std::cout << "\n";
  rtmidi->openPort( i );

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x10(%rbp)
movq 0x373a(%rip), %rdi      # 0x6fd0
leaq 0x178a(%rip), %rsi      # 0x5027
callq 0x3150
leaq -0x30(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x3220
movq -0x100(%rbp), %rsi
movq 0x3720(%rip), %rdi      # 0x6fe0
callq 0x3050
jmp 0x38c7
leaq 0x178f(%rip), %rsi      # 0x505d
leaq -0x30(%rbp), %rdi
callq 0x3ed0
movb %al, -0x101(%rbp)
jmp 0x38df
movb -0x101(%rbp), %al
testb $0x1, %al
jne 0x38ee
jmp 0x399c
movq -0x10(%rbp), %rax
movq %rax, -0x118(%rbp)
leaq -0x61(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x3290
movq -0x110(%rbp), %rdx
leaq 0x1748(%rip), %rsi      # 0x505f
leaq -0x60(%rbp), %rdi
callq 0x3d40
jmp 0x3922
movq -0x118(%rbp), %rdi
movq (%rdi), %rax
movq 0x8(%rax), %rax
leaq -0x60(%rbp), %rsi
callq *%rax
jmp 0x3938
leaq -0x60(%rbp), %rdi
callq 0x30c0
leaq -0x61(%rbp), %rdi
callq 0x31a0
movb $0x1, -0x1(%rbp)
movl $0x1, -0x68(%rbp)
jmp 0x3cf0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x3d07
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x398e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x30c0
leaq -0x61(%rbp), %rdi
callq 0x31a0
jmp 0x3d07
leaq -0x88(%rbp), %rdi
callq 0x3220
movl $0x0, -0x8c(%rbp)
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movl %eax, -0x11c(%rbp)
jmp 0x39c7
movl -0x11c(%rbp), %eax
movl %eax, -0x90(%rbp)
cmpl $0x0, -0x90(%rbp)
jne 0x3a2e
movq 0x35ed(%rip), %rdi      # 0x6fd0
leaq 0x1683(%rip), %rsi      # 0x506d
callq 0x3150
movq %rax, -0x128(%rbp)
jmp 0x39f8
movq -0x128(%rbp), %rdi
movq 0x35ba(%rip), %rsi      # 0x6fc0
callq 0x3180
jmp 0x3a0d
movb $0x0, -0x1(%rbp)
movl $0x1, -0x68(%rbp)
jmp 0x3cd4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x3ce2
cmpl $0x1, -0x90(%rbp)
jne 0x3ace
movq 0x358e(%rip), %rdi      # 0x6fd0
leaq 0x163f(%rip), %rsi      # 0x5088
callq 0x3150
movq %rax, -0x130(%rbp)
jmp 0x3a57
movq -0x10(%rbp), %rsi
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq -0xb0(%rbp), %rdi
xorl %edx, %edx
callq *%rax
jmp 0x3a6f
movq -0x130(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x3130
movq %rax, -0x138(%rbp)
jmp 0x3a8b
movq -0x138(%rbp), %rdi
movq 0x3527(%rip), %rsi      # 0x6fc0
callq 0x3180
jmp 0x3aa0
leaq -0xb0(%rbp), %rdi
callq 0x30c0
jmp 0x3c02
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x30c0
jmp 0x3ce2
movl $0x0, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0x90(%rbp), %eax
jae 0x3bc4
movq -0x10(%rbp), %rsi
movl -0x8c(%rbp), %edx
movq (%rsi), %rax
movq 0x18(%rax), %rax
leaq -0xd0(%rbp), %rdi
callq *%rax
jmp 0x3b06
leaq -0x88(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
movq %rsi, -0x148(%rbp)
callq 0x31f0
movq -0x148(%rbp), %rdi
callq 0x30c0
movq 0x349d(%rip), %rdi      # 0x6fd0
leaq 0x1558(%rip), %rsi      # 0x5092
callq 0x3150
movq %rax, -0x140(%rbp)
jmp 0x3b48
movq -0x140(%rbp), %rdi
movl -0x8c(%rbp), %esi
callq 0x3210
movq %rax, -0x150(%rbp)
jmp 0x3b63
movq -0x150(%rbp), %rdi
leaq 0x1546(%rip), %rsi      # 0x50b7
callq 0x3150
movq %rax, -0x158(%rbp)
jmp 0x3b7f
movq -0x158(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x3130
movq %rax, -0x160(%rbp)
jmp 0x3b9b
movq -0x160(%rbp), %rdi
movl $0xa, %esi
callq 0x31d0
jmp 0x3bae
jmp 0x3bb0
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x3ad8
jmp 0x3bc6
movq 0x3403(%rip), %rdi      # 0x6fd0
leaq 0x14ce(%rip), %rsi      # 0x50a2
callq 0x3150
jmp 0x3bdb
movq 0x33fe(%rip), %rdi      # 0x6fe0
leaq -0x8c(%rbp), %rsi
callq 0x3030
jmp 0x3bf0
jmp 0x3bf2
movl -0x8c(%rbp), %eax
cmpl -0x90(%rbp), %eax
jae 0x3bc6
jmp 0x3c02
movq 0x33c7(%rip), %rdi      # 0x6fd0
leaq 0x14aa(%rip), %rsi      # 0x50ba
callq 0x3150
jmp 0x3c17
movq -0x10(%rbp), %rax
movq %rax, -0x178(%rbp)
movl -0x8c(%rbp), %eax
movl %eax, -0x16c(%rbp)
leaq -0xf1(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x3290
movq -0x168(%rbp), %rdx
leaq 0x1410(%rip), %rsi      # 0x505f
leaq -0xf0(%rbp), %rdi
callq 0x3d40
jmp 0x3c5d
movl -0x16c(%rbp), %esi
movq -0x178(%rbp), %rdi
movq (%rdi), %rax
movq (%rax), %rax
leaq -0xf0(%rbp), %rdx
callq *%rax
jmp 0x3c7b
leaq -0xf0(%rbp), %rdi
callq 0x30c0
leaq -0xf1(%rbp), %rdi
callq 0x31a0
movb $0x1, -0x1(%rbp)
movl $0x1, -0x68(%rbp)
jmp 0x3cd4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x3cc6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x30c0
leaq -0xf1(%rbp), %rdi
callq 0x31a0
jmp 0x3ce2
leaq -0x88(%rbp), %rdi
callq 0x30c0
jmp 0x3cf0
leaq -0x88(%rbp), %rdi
callq 0x30c0
jmp 0x3d07
leaq -0x30(%rbp), %rdi
callq 0x30c0
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x30c0
movq -0x38(%rbp), %rdi
callq 0x3280
nopl (%rax)