// File: /workspace/github_cpp_makefile_star2_O2/tobias93[P]piano/rtmidi_build/tests/midiclock.cpp
// Function: bool choosePort<RtMidiIn>(RtMidiIn*, char const*)
bool choosePort( RT *rtmidi, const char *dir )
{
  std::string portName;
  unsigned int i = 0, nPorts = rtmidi->getPortCount();
  if ( nPorts == 0 ) {
    std::cout << "No " << dir << " 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 << "  " << dir << " 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 $0x68, %rsp
movq %rsi, %r15
movq %rdi, %r14
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
andl $0x0, 0x4(%rsp)
movq (%rdi), %rax
callq *0x10(%rax)
movl %eax, %ebx
testl %eax, %eax
je 0x2a4c
cmpl $0x1, %ebx
jne 0x2a86
movq 0x35c7(%rip), %rdi      # 0x5fd0
leaq 0x17ff(%rip), %rsi      # 0x420f
callq 0x2120
movq %rax, %r15
movq (%r14), %rax
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq *0x18(%rax)
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x2100
movq %rax, %rdi
callq 0x2090
leaq 0x8(%rsp), %rdi
callq 0x2080
jmp 0x2b5e
movq 0x357d(%rip), %rdi      # 0x5fd0
leaq 0x179f(%rip), %rsi      # 0x41f9
callq 0x2120
movq %rax, %rdi
movq %r15, %rsi
callq 0x2120
leaq 0x178c(%rip), %rsi      # 0x41fd
movq %rax, %rdi
callq 0x2120
movq %rax, %rdi
callq 0x2090
jmp 0x2ba4
xorl %r12d, %r12d
leaq 0x8(%rsp), %r13
leaq 0x48(%rsp), %rbp
movl %r12d, 0x4(%rsp)
cmpl %ebx, %r12d
jae 0x2b28
movq (%r14), %rax
movq %r13, %rdi
movq %r14, %rsi
movl %r12d, %edx
callq *0x18(%rax)
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2170
movq %r13, %rdi
callq 0x2080
movq 0x3506(%rip), %rdi      # 0x5fd0
leaq 0x1748(%rip), %rsi      # 0x4219
callq 0x2120
movq %rax, %rdi
movq %r15, %rsi
callq 0x2120
movq %rax, %rdi
leaq 0x1731(%rip), %rsi      # 0x421c
callq 0x2120
movq %rax, %rdi
movq %r12, %rsi
callq 0x20b0
movq %rax, %rdi
leaq 0x1734(%rip), %rsi      # 0x4239
callq 0x2120
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2100
movq %rax, %rdi
pushq $0xa
popq %rsi
callq 0x2150
incq %r12
jmp 0x2a93
movq 0x34a1(%rip), %r15      # 0x5fd0
leaq 0x16ee(%rip), %r12      # 0x4224
movq 0x34a3(%rip), %r13      # 0x5fe0
leaq 0x4(%rsp), %rbp
movq %r15, %rdi
movq %r12, %rsi
callq 0x2120
movq %r13, %rdi
movq %rbp, %rsi
callq 0x21f0
cmpl %ebx, 0x4(%rsp)
jae 0x2b42
movq 0x346b(%rip), %rdi      # 0x5fd0
leaq 0x154c(%rip), %rsi      # 0x40b8
callq 0x2120
movl 0x4(%rsp), %ebp
leaq 0x16c0(%rip), %rsi      # 0x423c
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x297e
movq (%r14), %rax
leaq 0x28(%rsp), %rdx
movq %r14, %rdi
movl %ebp, %esi
callq *(%rax)
leaq 0x28(%rsp), %rdi
callq 0x2080
testl %ebx, %ebx
setne %bl
leaq 0x48(%rsp), %rdi
callq 0x2080
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2be7
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0x2bda
jmp 0x2be7
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2080
jmp 0x2bea
jmp 0x2be7
jmp 0x2be7
jmp 0x2be7
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2200