// File: /workspace/github_cpp_makefile_star2_O2/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, %rbx
movq 0x2a25(%rip), %rdi      # 0x4fd0
leaq 0xa75(%rip), %rsi       # 0x3027
callq 0x2120
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x2a11(%rip), %rdi      # 0x4fe0
leaq 0x48(%rsp), %rsi
callq 0x2030
leaq 0xa7d(%rip), %rsi       # 0x305d
leaq 0x48(%rsp), %rdi
callq 0x2885
testb %al, %al
je 0x262c
leaq 0xa6a(%rip), %rsi       # 0x305f
leaq 0x88(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x284a
movq (%rbx), %rax
leaq 0x88(%rsp), %rsi
movq %rbx, %rdi
callq *0x8(%rax)
leaq 0x88(%rsp), %rdi
callq 0x2090
movb $0x1, %bl
jmp 0x27d5
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
andl $0x0, 0x4(%rsp)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movl %eax, %r14d
testl %eax, %eax
setne 0x3(%rsp)
je 0x26a7
cmpl $0x1, %r14d
jne 0x26c7
movq 0x296c(%rip), %rdi      # 0x4fd0
leaq 0xa1d(%rip), %rsi       # 0x3088
callq 0x2120
movq %rax, %r14
movq (%rbx), %rax
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq *0x18(%rax)
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2100
movq %rax, %rdi
callq 0x20a0
leaq 0x8(%rsp), %rdi
callq 0x2090
jmp 0x2781
movq 0x2922(%rip), %rdi      # 0x4fd0
leaq 0x9b8(%rip), %rsi       # 0x306d
callq 0x2120
movq %rax, %rdi
callq 0x20a0
jmp 0x27c7
xorl %r15d, %r15d
leaq 0x8(%rsp), %r12
leaq 0x28(%rsp), %r13
pushq $0xa
popq %rbp
movl %r15d, 0x4(%rsp)
cmpl %r14d, %r15d
jae 0x274a
movq (%rbx), %rax
movq %r12, %rdi
movq %rbx, %rsi
movl %r15d, %edx
callq *0x18(%rax)
movq %r13, %rdi
movq %r12, %rsi
callq 0x2170
movq %r12, %rdi
callq 0x2090
movq 0x28c6(%rip), %rdi      # 0x4fd0
leaq 0x981(%rip), %rsi       # 0x3092
callq 0x2120
movq %rax, %rdi
movq %r15, %rsi
callq 0x20c0
movq %rax, %rdi
leaq 0x98c(%rip), %rsi       # 0x30b7
callq 0x2120
movq %rax, %rdi
movq %r13, %rsi
callq 0x2100
movq %rax, %rdi
movl %ebp, %esi
callq 0x2150
incq %r15
jmp 0x26d7
movq 0x287f(%rip), %r15      # 0x4fd0
leaq 0x94a(%rip), %r12       # 0x30a2
movq 0x2881(%rip), %r13      # 0x4fe0
leaq 0x4(%rsp), %rbp
movq %r15, %rdi
movq %r12, %rsi
callq 0x2120
movq %r13, %rdi
movq %rbp, %rsi
callq 0x21c0
cmpl %r14d, 0x4(%rsp)
jae 0x2764
movq 0x2848(%rip), %rdi      # 0x4fd0
leaq 0x92b(%rip), %rsi       # 0x30ba
callq 0x2120
movl 0x4(%rsp), %ebp
leaq 0x8c0(%rip), %rsi       # 0x305f
leaq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x284a
movq (%rbx), %rax
leaq 0x68(%rsp), %rdx
movq %rbx, %rdi
movl %ebp, %esi
callq *(%rax)
leaq 0x68(%rsp), %rdi
callq 0x2090
leaq 0x28(%rsp), %rdi
callq 0x2090
movb 0x3(%rsp), %bl
leaq 0x48(%rsp), %rdi
callq 0x2090
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x282a
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
jmp 0x2809
jmp 0x282a
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2090
jmp 0x282d
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
jmp 0x2832
jmp 0x281f
movq %rax, %rbx
jmp 0x2837
jmp 0x282a
jmp 0x282a
jmp 0x282a
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x2090
leaq 0x48(%rsp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x21d0
nop