// File: /workspace/github_cpp_makefile_star2_O1/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, %r14
movq 0x2a13(%rip), %rdi      # 0x4fd0
leaq 0xae3(%rip), %rsi       # 0x30a7
movl $0x34, %edx
callq 0x2110
leaq 0x58(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq $0x0, -0x8(%rbx)
movb $0x0, (%rbx)
movq 0x29f7(%rip), %rdi      # 0x4fe0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x20d0
movsbl %al, %edx
movq 0x29dc(%rip), %rdi      # 0x4fe0
leaq 0x48(%rsp), %rsi
callq 0x21d0
leaq 0xac7(%rip), %rsi       # 0x30dc
leaq 0x48(%rsp), %rdi
callq 0x2050
testl %eax, %eax
je 0x26f0
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 0x274b
cmpl $0x1, %ebp
jne 0x2796
movq 0x2965(%rip), %rdi      # 0x4fd0
leaq 0xa93(%rip), %rsi       # 0x3105
movl $0x9, %edx
callq 0x2110
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 0x2933(%rip), %rdi      # 0x4fd0
callq 0x2110
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 0x28b7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2100
jmp 0x28b7
leaq 0x98(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x9db(%rip), %rsi       # 0x30de
leaq 0x9e0(%rip), %rdx       # 0x30ea
leaq 0x88(%rsp), %rdi
callq 0x29f2
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 0x2923
movq 0x98(%rsp), %rsi
jmp 0x291b
movq 0x287e(%rip), %rbx      # 0x4fd0
leaq 0x992(%rip), %rsi       # 0x30eb
movl $0x19, %edx
movq %rbx, %rdi
callq 0x2110
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x20d0
movsbl %al, %esi
movq 0x284c(%rip), %rdi      # 0x4fd0
callq 0x2030
movq %rax, %rdi
callq 0x2080
jmp 0x2902
movl $0x0, 0x4(%rsp)
xorl %edx, %edx
leaq 0x8(%rsp), %r15
movq 0x2824(%rip), %r13      # 0x4fd0
leaq 0x980(%rip), %r12       # 0x3133
movq (%r14), %rax
movq %r15, %rdi
movq %r14, %rsi
callq *0x18(%rax)
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x2130
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x27e8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2100
movl $0xe, %edx
movq %r13, %rdi
leaq 0x918(%rip), %rsi       # 0x310f
callq 0x2110
movl 0x4(%rsp), %esi
movq %r13, %rdi
callq 0x2070
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2110
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %rbx, %rdi
callq 0x2110
movb $0xa, 0x8(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2110
movl 0x4(%rsp), %edx
incl %edx
movl %edx, 0x4(%rsp)
cmpl %ebp, %edx
jb 0x27b3
movq 0x2775(%rip), %r15      # 0x4fd0
leaq 0x8bc(%rip), %r12       # 0x311e
movq 0x2777(%rip), %rbx      # 0x4fe0
leaq 0x4(%rsp), %r13
movl $0x17, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x2110
movq %rbx, %rdi
movq %r13, %rsi
callq 0x21a0
cmpl %ebp, 0x4(%rsp)
jae 0x286e
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x20d0
movsbl %al, %edx
movq 0x2733(%rip), %rdi      # 0x4fe0
leaq 0x48(%rsp), %rsi
callq 0x21d0
movl 0x4(%rsp), %ebx
leaq 0x78(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x813(%rip), %rsi       # 0x30de
leaq 0x818(%rip), %rdx       # 0x30ea
leaq 0x68(%rsp), %rdi
callq 0x29f2
movq (%r14), %rax
leaq 0x68(%rsp), %rdx
movq %r14, %rdi
movl %ebx, %esi
callq *(%rax)
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x2902
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2100
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
leaq 0x58(%rsp), %rbx
je 0x2923
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2100
movq 0x48(%rsp), %rdi
cmpq %rbx, %rdi
je 0x293a
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2100
movb 0x3(%rsp), %al
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x29af
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r15, %rdi
je 0x29ce
movq 0x98(%rsp), %rsi
jmp 0x29c6
jmp 0x29a4
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x29b2
movq 0x78(%rsp), %rsi
jmp 0x299a
jmp 0x29af
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x29b2
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2100
jmp 0x29b2
movq %rax, %rbx
jmp 0x29ce
jmp 0x29af
jmp 0x29af
jmp 0x29af
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x29ce
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2100
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x29ea
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2100
movq %rbx, %rdi
callq 0x21b0