// File: /workspace/github_cpp_makefile_star2_O2/tobias93[P]piano/rtmidi_build/tests/cmidiin.cpp
// Function: chooseMidiPort(RtMidiIn*)
bool chooseMidiPort( RtMidiIn *rtmidi )
{
  std::cout << "\nWould you like to open a virtual input 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 input 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 << "  Input port #" << i << ": " << portName << '\n';
    }

    do {
      std::cout << "\nChoose a port number: ";
      std::cin >> i;
    } while ( i >= nPorts );
    std::getline( std::cin, keyHit );  // used to clear out stdin
  }

  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 0x2a64(%rip), %rdi      # 0x4fd0
leaq 0xb34(%rip), %rsi       # 0x30a7
callq 0x2100
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x2a50(%rip), %rdi      # 0x4fe0
leaq 0x28(%rsp), %rsi
callq 0x2030
leaq 0xb3b(%rip), %rsi       # 0x30dc
leaq 0x28(%rsp), %rdi
callq 0x286d
testb %al, %al
je 0x25ed
leaq 0xb28(%rip), %rsi       # 0x30de
leaq 0x88(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x2828
movq (%rbx), %rax
leaq 0x88(%rsp), %rsi
movq %rbx, %rdi
callq *0x8(%rax)
leaq 0x88(%rsp), %rdi
callq 0x2080
movb $0x1, %bl
jmp 0x2796
leaq 0x58(%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 0x266a
cmpl $0x1, %r14d
jne 0x268a
movq 0x29ab(%rip), %rdi      # 0x4fd0
leaq 0xad9(%rip), %rsi       # 0x3105
callq 0x2100
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 0x20f0
movq %rax, %rdi
callq 0x2090
leaq 0x8(%rsp), %rdi
callq 0x2080
xorl %ebp, %ebp
jmp 0x2759
movq 0x295f(%rip), %rdi      # 0x4fd0
leaq 0xa73(%rip), %rsi       # 0x30eb
callq 0x2100
movq %rax, %rdi
callq 0x2090
jmp 0x2788
xorl %r15d, %r15d
leaq 0x8(%rsp), %r12
leaq 0x48(%rsp), %r13
pushq $0xa
popq %rbp
movl %r15d, 0x4(%rsp)
cmpl %r14d, %r15d
jae 0x270d
movq (%rbx), %rax
movq %r12, %rdi
movq %rbx, %rsi
movl %r15d, %edx
callq *0x18(%rax)
movq %r13, %rdi
movq %r12, %rsi
callq 0x2150
movq %r12, %rdi
callq 0x2080
movq 0x2903(%rip), %rdi      # 0x4fd0
leaq 0xa3b(%rip), %rsi       # 0x310f
callq 0x2100
movq %rax, %rdi
movq %r15, %rsi
callq 0x20a0
movq %rax, %rdi
leaq 0xa45(%rip), %rsi       # 0x3133
callq 0x2100
movq %rax, %rdi
movq %r13, %rsi
callq 0x20f0
movq %rax, %rdi
movl %ebp, %esi
callq 0x2130
incq %r15
jmp 0x269a
movq 0x28bc(%rip), %r15      # 0x4fd0
leaq 0xa03(%rip), %r12       # 0x311e
movq 0x28be(%rip), %r13      # 0x4fe0
leaq 0x4(%rsp), %rbp
movq %r15, %rdi
movq %r12, %rsi
callq 0x2100
movq %r13, %rdi
movq %rbp, %rsi
callq 0x21c0
cmpl %r14d, 0x4(%rsp)
jae 0x2727
movq 0x2895(%rip), %rdi      # 0x4fe0
leaq 0x28(%rsp), %rsi
callq 0x2030
movl 0x4(%rsp), %ebp
leaq 0x97e(%rip), %rsi       # 0x30de
leaq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x2828
movq (%rbx), %rax
leaq 0x68(%rsp), %rdx
movq %rbx, %rdi
movl %ebp, %esi
callq *(%rax)
leaq 0x68(%rsp), %rdi
callq 0x2080
leaq 0x48(%rsp), %rdi
callq 0x2080
movb 0x3(%rsp), %bl
leaq 0x28(%rsp), %rdi
callq 0x2080
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x27eb
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
jmp 0x27ca
jmp 0x27eb
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2080
jmp 0x27ee
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
jmp 0x27f3
jmp 0x27e0
movq %rax, %rbx
jmp 0x27f8
jmp 0x27eb
jmp 0x27eb
jmp 0x27eb
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x2080
leaq 0x28(%rsp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x21d0