// File: /workspace/github_cpp_makefile_star2_O1/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 0x2896
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x20f0
jmp 0x2896
leaq 0x98(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x955(%rip), %rsi       # 0x305f
leaq 0x95b(%rip), %rdx       # 0x306c
leaq 0x88(%rsp), %rdi
callq 0x29ea
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 0x291a
movq 0x98(%rsp), %rsi
jmp 0x2912
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 0x28f9
movl $0x0, 0x4(%rsp)
xorl %edx, %edx
leaq 0x8(%rsp), %r15
movq 0x281d(%rip), %r13      # 0x4fd0
leaq 0x8fd(%rip), %r12       # 0x30b7
movq (%r14), %rax
movq %r15, %rdi
movq %r14, %rsi
callq *0x18(%rax)
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x2120
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x27ef
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x20f0
movl $0xf, %edx
movq %r13, %rdi
leaq 0x894(%rip), %rsi       # 0x3092
callq 0x2100
movl 0x4(%rsp), %esi
movq %r13, %rdi
callq 0x2070
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2100
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %rbx, %rdi
callq 0x2100
movb $0xa, 0x8(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2100
movl 0x4(%rsp), %edx
incl %edx
movl %edx, 0x4(%rsp)
cmpl %ebp, %edx
jb 0x27ba
movq 0x276e(%rip), %rbx      # 0x4fd0
leaq 0x839(%rip), %r15       # 0x30a2
movq 0x2770(%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 0x2875
movq 0x2733(%rip), %rdi      # 0x4fd0
leaq 0x816(%rip), %rsi       # 0x30ba
movl $0x1, %edx
callq 0x2100
movl 0x4(%rsp), %ebx
leaq 0x78(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x79d(%rip), %rsi       # 0x305f
leaq 0x7a3(%rip), %rdx       # 0x306c
leaq 0x68(%rsp), %rdi
callq 0x29ea
movq (%r14), %rax
leaq 0x68(%rsp), %rdx
movq %r14, %rdi
movl %ebx, %esi
callq *(%rax)
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x28f9
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x20f0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
leaq 0x58(%rsp), %rbx
je 0x291a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x20f0
movq 0x48(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2931
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 0x29a6
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r15, %rdi
je 0x29c5
movq 0x98(%rsp), %rsi
jmp 0x29bd
jmp 0x299b
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x29a9
movq 0x78(%rsp), %rsi
jmp 0x2991
jmp 0x29a6
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x29a9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x20f0
jmp 0x29a9
movq %rax, %rbx
jmp 0x29c5
jmp 0x29a6
jmp 0x29a6
jmp 0x29a6
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x29c5
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x20f0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x29e1
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x20f0
movq %rbx, %rdi
callq 0x2180
nop