// File: /workspace/github_cpp_makefile_star2_O1/tobias93[P]piano/rtmidi_build/tests/sysextest.cpp
// Function: chooseMidiPort(RtMidi*)
bool chooseMidiPort( RtMidi *rtmidi )
{
  bool isInput = false;
  if ( typeid( *rtmidi ) == typeid( RtMidiIn ) )
    isInput = true;

  if ( isInput )
    std::cout << "\nWould you like to open a virtual input port? [y/N] ";
  else
    std::cout << "\nWould you like to open a virtual output 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 ) {
    if ( isInput )
      std::cout << "No input ports available!" << std::endl;
    else
      std::cout << "No output 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);
      if ( isInput )
        std::cout << "  Input port #" << i << ": " << portName << '\n';
      else
        std::cout << "  Output port #" << i << ": " << portName << '\n';
    }

    do {
      std::cout << "\nChoose a port number: ";
      std::cin >> i;
    } while ( i >= nPorts );
  }

  std::cout << std::endl;
  rtmidi->openPort( i );

  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
testq %rdi, %rdi
je 0x2c63
movq %rdi, %rbx
movq (%rdi), %rax
movq -0x8(%rax), %rax
movq 0x8(%rax), %rdi
movq 0x27af(%rip), %rax      # 0x4fb8
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x281b
cmpb $0x2a, (%rdi)
jne 0x2820
xorl %ebp, %ebp
jmp 0x282b
movb $0x1, %bpl
jmp 0x282b
callq 0x2170
testl %eax, %eax
sete %bpl
movq 0x279e(%rip), %rdi      # 0x4fd0
testb %bpl, %bpl
je 0x2845
leaq 0x852(%rip), %rsi       # 0x3090
movl $0x34, %edx
jmp 0x2851
leaq 0x879(%rip), %rsi       # 0x30c5
movl $0x35, %edx
callq 0x2140
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x276f(%rip), %rdi      # 0x4fe0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %edx
movq 0x2754(%rip), %rdi      # 0x4fe0
leaq 0x48(%rsp), %rsi
callq 0x2230
leaq 0x85e(%rip), %rsi       # 0x30fb
leaq 0x48(%rsp), %rdi
callq 0x2050
testl %eax, %eax
je 0x297a
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movl $0x0, 0x4(%rsp)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movl %eax, %r14d
testl %eax, %eax
setne 0x3(%rsp)
je 0x29de
cmpl $0x1, %r14d
jne 0x2a3e
movq 0x26db(%rip), %rdi      # 0x4fd0
leaq 0x83d(%rip), %rsi       # 0x3139
movl $0x9, %edx
callq 0x2140
movq (%rbx), %rax
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq *0x18(%rax)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x26a9(%rip), %rdi      # 0x4fd0
callq 0x2140
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2090
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b9b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2120
jmp 0x2b9b
leaq 0x98(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x770(%rip), %rsi       # 0x30fd
leaq 0x76f(%rip), %rdx       # 0x3103
leaq 0x88(%rsp), %rdi
callq 0x2d0a
movq (%rbx), %rax
leaq 0x88(%rsp), %rsi
movq %rbx, %rdi
callq *0x8(%rax)
movq 0x88(%rsp), %rdi
movb $0x1, 0x3(%rsp)
cmpq %r14, %rdi
je 0x29d4
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x2120
leaq 0x58(%rsp), %rbx
jmp 0x2c36
leaq 0x71f(%rip), %rax       # 0x3104
leaq 0x732(%rip), %rsi       # 0x311e
testb %bpl, %bpl
cmovneq %rax, %rsi
movzbl %bpl, %eax
movl $0x1a, %edx
subq %rax, %rdx
movq 0x25ca(%rip), %rbx      # 0x4fd0
movq %rbx, %rdi
callq 0x2140
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq 0x25a4(%rip), %rdi      # 0x4fd0
callq 0x2030
movq %rax, %rdi
callq 0x2090
jmp 0x2c15
movl $0x0, 0x4(%rsp)
xorl %edx, %edx
leaq 0x8(%rsp), %r15
movq 0x257c(%rip), %r13      # 0x4fd0
movq (%rbx), %rax
movq %r15, %rdi
movq %rbx, %rsi
callq *0x18(%rax)
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x2160
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2a89
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2120
testb %bpl, %bpl
je 0x2aee
movl $0xe, %edx
movq %r13, %rdi
leaq 0x6a6(%rip), %rsi       # 0x3143
callq 0x2140
movl 0x4(%rsp), %esi
movq %r13, %rdi
callq 0x2080
movq %rax, %r12
movl $0x2, %edx
movq %rax, %rdi
leaq 0x6b7(%rip), %rsi       # 0x3177
callq 0x2140
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %r12, %rdi
callq 0x2140
movb $0xa, 0x8(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2140
jmp 0x2b4c
movl $0xf, %edx
movq %r13, %rdi
leaq 0x655(%rip), %rsi       # 0x3152
callq 0x2140
movl 0x4(%rsp), %esi
movq %r13, %rdi
callq 0x2080
movq %rax, %r12
movl $0x2, %edx
movq %rax, %rdi
leaq 0x657(%rip), %rsi       # 0x3177
callq 0x2140
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %r12, %rdi
callq 0x2140
movb $0xa, 0x8(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2140
movl 0x4(%rsp), %edx
incl %edx
movl %edx, 0x4(%rsp)
cmpl %r14d, %edx
jb 0x2a54
movq 0x246a(%rip), %r15      # 0x4fd0
leaq 0x5f5(%rip), %r12       # 0x3162
movq 0x246c(%rip), %r13      # 0x4fe0
leaq 0x4(%rsp), %rbp
movl $0x17, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x2140
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2200
cmpl %r14d, 0x4(%rsp)
jae 0x2b79
movq 0x242e(%rip), %rdi      # 0x4fd0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq 0x2413(%rip), %rdi      # 0x4fd0
callq 0x2030
movq %rax, %rdi
callq 0x2090
movl 0x4(%rsp), %ebp
leaq 0x78(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x51f(%rip), %rsi       # 0x30fd
leaq 0x51e(%rip), %rdx       # 0x3103
leaq 0x68(%rsp), %rdi
callq 0x2d0a
movq (%rbx), %rax
leaq 0x68(%rsp), %rdx
movq %rbx, %rdi
movl %ebp, %esi
callq *(%rax)
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x2c15
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2120
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
leaq 0x58(%rsp), %rbx
je 0x2c36
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2120
movq 0x48(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2c4d
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2120
movb 0x3(%rsp), %al
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2130
jmp 0x2cc7
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x2ce6
movq 0x98(%rsp), %rsi
jmp 0x2cde
jmp 0x2cbc
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x2cca
movq 0x78(%rsp), %rsi
jmp 0x2cb2
jmp 0x2cc7
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2cca
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2120
jmp 0x2cca
movq %rax, %rbx
jmp 0x2ce6
jmp 0x2cc7
jmp 0x2cc7
jmp 0x2cc7
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2ce6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2120
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x2d02
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2120
movq %rbx, %rdi
callq 0x2210