// File: /workspace/github_cpp_makefile_star2_O3/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 0x29fe(%rip), %rdi      # 0x4fd0
leaq 0xace(%rip), %rsi       # 0x30a7
movl $0x34, %edx
callq 0x2110
leaq 0x58(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq $0x0, -0x8(%rbx)
movb $0x0, (%rbx)
movq 0x29e2(%rip), %rdi      # 0x4fe0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x20d0
movsbl %al, %edx
movq 0x29c7(%rip), %rdi      # 0x4fe0
leaq 0x48(%rsp), %rsi
callq 0x21d0
leaq 0xab2(%rip), %rsi       # 0x30dc
leaq 0x48(%rsp), %rdi
callq 0x2050
testl %eax, %eax
je 0x2703
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 0x275e
cmpl $0x1, %ebp
jne 0x27a9
movq 0x2950(%rip), %rdi      # 0x4fd0
leaq 0xa7e(%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 0x291e(%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 0x26fc
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2100
xorl %ebx, %ebx
jmp 0x28cd
leaq 0x98(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x9c8(%rip), %rsi       # 0x30de
leaq 0x9cd(%rip), %rdx       # 0x30ea
leaq 0x88(%rsp), %rdi
callq 0x2a04
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 0x2935
movq 0x98(%rsp), %rsi
jmp 0x292d
movq 0x286b(%rip), %rbx      # 0x4fd0
leaq 0x97f(%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 0x2839(%rip), %rdi      # 0x4fd0
callq 0x2030
movq %rax, %rdi
callq 0x2080
jmp 0x2914
movl $0x0, 0x4(%rsp)
xorl %r15d, %r15d
leaq 0x8(%rsp), %r12
movq 0x2810(%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 0x2130
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x27f8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2100
movl $0xe, %edx
movq %rbx, %rdi
leaq 0x908(%rip), %rsi       # 0x310f
callq 0x2110
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2070
movq %rax, %r13
movl $0x2, %edx
movq %rax, %rdi
leaq 0x90a(%rip), %rsi       # 0x3133
callq 0x2110
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %r13, %rdi
callq 0x2110
movb $0xa, 0x8(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2110
incq %r15
movl %r15d, 0x4(%rsp)
cmpl %ebp, %r15d
jb 0x27c0
movq 0x2763(%rip), %r15      # 0x4fd0
leaq 0x8aa(%rip), %r12       # 0x311e
movq 0x2765(%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 0x2880
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x20d0
movsbl %al, %edx
movq 0x2721(%rip), %rdi      # 0x4fe0
leaq 0x48(%rsp), %rsi
callq 0x21d0
movl 0x4(%rsp), %ebx
leaq 0x78(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x801(%rip), %rsi       # 0x30de
leaq 0x806(%rip), %rdx       # 0x30ea
leaq 0x68(%rsp), %rdi
callq 0x2a04
movq (%r14), %rax
leaq 0x68(%rsp), %rdx
movq %r14, %rdi
movl %ebx, %esi
callq *(%rax)
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x2914
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2100
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
leaq 0x58(%rsp), %rbx
je 0x2935
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2100
movq 0x48(%rsp), %rdi
cmpq %rbx, %rdi
je 0x294c
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 0x29c1
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r15, %rdi
je 0x29e0
movq 0x98(%rsp), %rsi
jmp 0x29d8
jmp 0x29b6
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x29c4
movq 0x78(%rsp), %rsi
jmp 0x29ac
jmp 0x29c1
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x29c4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2100
jmp 0x29c4
movq %rax, %rbx
jmp 0x29e0
jmp 0x29c1
jmp 0x29c1
jmp 0x29c1
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x29e0
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2100
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x29fc
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2100
movq %rbx, %rdi
callq 0x21b0