// File: /workspace/github_cpp_makefile_star2_O1/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 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movl $0x0, 0x4(%rsp)
movq (%rdi), %rax
callq *0x10(%rax)
movl %eax, %ebx
testl %eax, %eax
je 0x2c8e
cmpl $0x1, %ebx
jne 0x2cd1
movq 0x33c7(%rip), %rdi      # 0x5fd0
leaq 0x15b5(%rip), %rsi      # 0x41c5
movl $0x9, %edx
callq 0x2120
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 0x3395(%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 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2e10
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2110
jmp 0x2e10
movq 0x333b(%rip), %r14      # 0x5fd0
leaq 0x1513(%rip), %rsi      # 0x41af
movl $0x3, %edx
movq %r14, %rdi
callq 0x2120
testq %r15, %r15
je 0x2e75
movq %r15, %rdi
callq 0x2060
movq 0x330f(%rip), %rdi      # 0x5fd0
movq %r15, %rsi
movq %rax, %rdx
callq 0x2120
jmp 0x2e8d
movl $0x0, 0x4(%rsp)
xorl %edx, %edx
leaq 0x8(%rsp), %r12
movq 0x32e9(%rip), %rbp      # 0x5fd0
movq (%r14), %rax
movq %r12, %rdi
movq %r14, %rsi
callq *0x18(%rax)
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x2140
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2d1c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2110
movl $0x2, %edx
movq %rbp, %rdi
leaq 0x14a4(%rip), %rsi      # 0x41cf
callq 0x2120
testq %r15, %r15
je 0x2d4d
movq %r15, %rdi
callq 0x2060
movq %rbp, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x2120
jmp 0x2d65
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 0x145e(%rip), %rsi      # 0x41d2
callq 0x2120
movl 0x4(%rsp), %esi
movq %rbp, %rdi
callq 0x2080
movq %rax, %r13
movl $0x2, %edx
movq %rax, %rdi
leaq 0x1458(%rip), %rsi      # 0x41ef
callq 0x2120
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %r13, %rdi
callq 0x2120
movb $0xa, 0x8(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2120
movl 0x4(%rsp), %edx
incl %edx
movl %edx, 0x4(%rsp)
cmpl %ebx, %edx
jb 0x2ce7
movq 0x31f4(%rip), %r15      # 0x5fd0
leaq 0x13f7(%rip), %r12      # 0x41da
movq 0x31f6(%rip), %r13      # 0x5fe0
leaq 0x4(%rsp), %rbp
movl $0x17, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x2120
movq %r13, %rdi
movq %rbp, %rsi
callq 0x21d0
cmpl %ebx, 0x4(%rsp)
jae 0x2def
movq 0x31b9(%rip), %rdi      # 0x5fd0
leaq 0x129a(%rip), %rsi      # 0x40b8
movl $0x1, %edx
callq 0x2120
movl 0x4(%rsp), %ebp
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x13b6(%rip), %rsi      # 0x41f2
leaq 0x13bb(%rip), %rdx      # 0x41fe
leaq 0x48(%rsp), %rdi
callq 0x3318
movq (%r14), %rax
leaq 0x48(%rsp), %rdx
movq %r14, %rdi
movl %ebp, %esi
callq *(%rax)
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ed3
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2110
jmp 0x2ed3
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x21b0
movq 0x313c(%rip), %r14      # 0x5fd0
leaq 0x1318(%rip), %rsi      # 0x41b3
movl $0x11, %edx
movq %r14, %rdi
callq 0x2120
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq 0x310a(%rip), %rdi      # 0x5fd0
callq 0x2030
movq %rax, %rdi
callq 0x2090
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2eef
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2110
testl %ebx, %ebx
setne %al
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2f41
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x2f44
movq 0x58(%rsp), %rsi
jmp 0x2f31
jmp 0x2f41
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2f44
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2110
jmp 0x2f44
jmp 0x2f41
jmp 0x2f41
jmp 0x2f41
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2f60
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2110
movq %rbx, %rdi
callq 0x21e0