// File: /workspace/github_cpp_makefile_star2_O3/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 $0x78, %rsp
movq %rsi, %r15
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movl $0x0, 0xc(%rsp)
movq (%rdi), %rax
movq %rdi, 0x10(%rsp)
callq *0x10(%rax)
movl %eax, %r14d
testl %eax, %eax
je 0x2c70
cmpl $0x1, %r14d
jne 0x2cb3
movq 0x33e7(%rip), %rdi      # 0x5fd0
leaq 0x15d5(%rip), %rsi      # 0x41c5
movl $0x9, %edx
callq 0x2120
movq 0x10(%rsp), %rsi
movq (%rsi), %rax
leaq 0x18(%rsp), %rdi
xorl %edx, %edx
callq *0x18(%rax)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x33b3(%rip), %rdi      # 0x5fd0
callq 0x2120
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2090
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2df7
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2110
jmp 0x2df7
movq 0x3359(%rip), %rbx      # 0x5fd0
leaq 0x1531(%rip), %rsi      # 0x41af
movl $0x3, %edx
movq %rbx, %rdi
callq 0x2120
testq %r15, %r15
je 0x2e5e
movq %r15, %rdi
callq 0x2060
movq 0x332d(%rip), %rdi      # 0x5fd0
movq %r15, %rsi
movq %rax, %rdx
callq 0x2120
jmp 0x2e75
movl $0x0, 0xc(%rsp)
xorl %r12d, %r12d
leaq 0x18(%rsp), %r13
movq 0x3306(%rip), %rbp      # 0x5fd0
movq 0x10(%rsp), %rsi
movq (%rsi), %rax
movq %r13, %rdi
movl %r12d, %edx
callq *0x18(%rax)
leaq 0x38(%rsp), %rdi
movq %r13, %rsi
callq 0x2140
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x2d04
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2110
movl $0x2, %edx
movq %rbp, %rdi
leaq 0x14bc(%rip), %rsi      # 0x41cf
callq 0x2120
testq %r15, %r15
je 0x2d35
movq %r15, %rdi
callq 0x2060
movq %rbp, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x2120
jmp 0x2d4d
movq (%rbp), %rax
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %rdi
movl 0x20(%rbp,%rax), %esi
orl $0x1, %esi
callq 0x21b0
movl $0x7, %edx
movq %rbp, %rdi
leaq 0x1476(%rip), %rsi      # 0x41d2
callq 0x2120
movq %rbp, %rdi
movq %r12, %rsi
callq 0x2080
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
leaq 0x1471(%rip), %rsi      # 0x41ef
callq 0x2120
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq %rbx, %rdi
callq 0x2120
movb $0xa, 0x18(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x2120
incq %r12
movl %r12d, 0xc(%rsp)
cmpl %r14d, %r12d
jb 0x2cca
movq 0x320e(%rip), %r15      # 0x5fd0
leaq 0x1411(%rip), %r12      # 0x41da
movq 0x3210(%rip), %r13      # 0x5fe0
leaq 0xc(%rsp), %rbp
movl $0x17, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x2120
movq %r13, %rdi
movq %rbp, %rsi
callq 0x21d0
cmpl %r14d, 0xc(%rsp)
jae 0x2dd5
movq 0x31d2(%rip), %rdi      # 0x5fd0
leaq 0x12b3(%rip), %rsi      # 0x40b8
movl $0x1, %edx
callq 0x2120
movl 0xc(%rsp), %ebx
leaq 0x68(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x13cf(%rip), %rsi      # 0x41f2
leaq 0x13d4(%rip), %rdx      # 0x41fe
leaq 0x58(%rsp), %rdi
callq 0x330e
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
leaq 0x58(%rsp), %rdx
movl %ebx, %esi
callq *(%rax)
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ebb
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x2110
jmp 0x2ebb
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x21b0
movq 0x3154(%rip), %rbx      # 0x5fd0
leaq 0x1330(%rip), %rsi      # 0x41b3
movl $0x11, %edx
movq %rbx, %rdi
callq 0x2120
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq 0x3122(%rip), %rdi      # 0x5fd0
callq 0x2030
movq %rax, %rdi
callq 0x2090
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x2ed7
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2110
testl %r14d, %r14d
setne %al
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2f2a
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0x2f2d
movq 0x68(%rsp), %rsi
jmp 0x2f1a
jmp 0x2f2a
movq %rax, %rbx
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2f2d
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2110
jmp 0x2f2d
jmp 0x2f2a
jmp 0x2f2a
jmp 0x2f2a
movq %rax, %rbx
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x2f49
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2110
movq %rbx, %rdi
callq 0x21e0