// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %r14
movq 0x2a0c(%rip), %rdi      # 0x4fd0
leaq 0xa5c(%rip), %rsi       # 0x3027
movl $0x35, %edx
callq 0x2100
leaq 0x58(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq $0x0, -0x8(%rbx)
movb $0x0, (%rbx)
movq 0x29f0(%rip), %rdi      # 0x4fe0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x20d0
movsbl %al, %edx
movq 0x29d5(%rip), %rdi      # 0x4fe0
leaq 0x48(%rsp), %rsi
callq 0x21a0
leaq 0xa41(%rip), %rsi       # 0x305d
leaq 0x48(%rsp), %rdi
callq 0x2040
testl %eax, %eax
je 0x26f7
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movl $0x0, 0x4(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
movl %eax, %ebp
testl %eax, %eax
setne 0x3(%rsp)
je 0x2752
cmpl $0x1, %ebp
jne 0x279d
movq 0x295e(%rip), %rdi      # 0x4fd0
leaq 0xa0f(%rip), %rsi       # 0x3088
movl $0x9, %edx
callq 0x2100
movq (%r14), %rax
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x18(%rax)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x292c(%rip), %rdi      # 0x4fd0
callq 0x2100
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2080
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2895
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x20f0
jmp 0x2895
leaq 0x98(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x955(%rip), %rsi       # 0x305f
leaq 0x95b(%rip), %rdx       # 0x306c
leaq 0x88(%rsp), %rdi
callq 0x29e8
movq (%r14), %rax
leaq 0x88(%rsp), %rsi
movq %r14, %rdi
callq *0x8(%rax)
movq 0x88(%rsp), %rdi
movb $0x1, 0x3(%rsp)
cmpq %r15, %rdi
je 0x2919
movq 0x98(%rsp), %rsi
jmp 0x2911
movq 0x2877(%rip), %rbx      # 0x4fd0
leaq 0x90d(%rip), %rsi       # 0x306d
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x2100
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x20d0
movsbl %al, %esi
movq 0x2845(%rip), %rdi      # 0x4fd0
callq 0x2030
movq %rax, %rdi
callq 0x2080
jmp 0x28f8
movl $0x0, 0x4(%rsp)
xorl %r15d, %r15d
leaq 0x8(%rsp), %r12
movq 0x281c(%rip), %rbx      # 0x4fd0
movq (%r14), %rax
movq %r12, %rdi
movq %r14, %rsi
movl %r15d, %edx
callq *0x18(%rax)
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x2120
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x27ec
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x20f0
movl $0xf, %edx
movq %rbx, %rdi
leaq 0x897(%rip), %rsi       # 0x3092
callq 0x2100
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2070
movq %rax, %r13
movl $0x2, %edx
movq %rax, %rdi
leaq 0x89a(%rip), %rsi       # 0x30b7
callq 0x2100
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %r13, %rdi
callq 0x2100
movb $0xa, 0x8(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2100
incq %r15
movl %r15d, 0x4(%rsp)
cmpl %ebp, %r15d
jb 0x27b4
movq 0x276f(%rip), %rbx      # 0x4fd0
leaq 0x83a(%rip), %r15       # 0x30a2
movq 0x2771(%rip), %r12      # 0x4fe0
leaq 0x4(%rsp), %r13
movl $0x17, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2100
movq %r12, %rdi
movq %r13, %rsi
callq 0x2170
cmpl %ebp, 0x4(%rsp)
jae 0x2874
movq 0x2734(%rip), %rdi      # 0x4fd0
leaq 0x817(%rip), %rsi       # 0x30ba
movl $0x1, %edx
callq 0x2100
movl 0x4(%rsp), %ebx
leaq 0x78(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x79e(%rip), %rsi       # 0x305f
leaq 0x7a4(%rip), %rdx       # 0x306c
leaq 0x68(%rsp), %rdi
callq 0x29e8
movq (%r14), %rax
leaq 0x68(%rsp), %rdx
movq %r14, %rdi
movl %ebx, %esi
callq *(%rax)
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x28f8
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x20f0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
leaq 0x58(%rsp), %rbx
je 0x2919
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x20f0
movq 0x48(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2930
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x20f0
movb 0x3(%rsp), %al
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x29a5
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r15, %rdi
je 0x29c4
movq 0x98(%rsp), %rsi
jmp 0x29bc
jmp 0x299a
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x29a8
movq 0x78(%rsp), %rsi
jmp 0x2990
jmp 0x29a5
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x29a8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x20f0
jmp 0x29a8
movq %rax, %rbx
jmp 0x29c4
jmp 0x29a5
jmp 0x29a5
jmp 0x29a5
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x29c4
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x20f0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x29e0
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x20f0
movq %rbx, %rdi
callq 0x2180