// File: /workspace/github_cpp_makefile_star2_O1/andrakis[P]alisp/contrib/linenoise-ng/src/linenoise.cpp
// Function: InputBuffer::completeLine(PromptBase&)
int InputBuffer::completeLine(PromptBase& pi) {
  linenoiseCompletions lc;
  char32_t c = 0;

  // completionCallback() expects a parsable entity, so find the previous break
  // character and
  // extract a copy to parse.  we also handle the case where tab is hit while
  // not at end-of-line.
  int startIndex = pos;
  while (--startIndex >= 0) {
    if (strchr(breakChars, buf32[startIndex])) {
      break;
    }
  }
  ++startIndex;
  int itemLength = pos - startIndex;
  Utf32String unicodeCopy(&buf32[startIndex], itemLength);
  Utf8String parseItem(unicodeCopy);

  // get a list of completions
  completionCallback(parseItem.get(), &lc);

  // if no completions, we are done
  if (lc.completionStrings.size() == 0) {
    beep();
    freeCompletions(&lc);
    return 0;
  }

  // at least one completion
  int longestCommonPrefix = 0;
  int displayLength = 0;
  if (lc.completionStrings.size() == 1) {
    longestCommonPrefix = static_cast<int>(lc.completionStrings[0].length());
  } else {
    bool keepGoing = true;
    while (keepGoing) {
      for (size_t j = 0; j < lc.completionStrings.size() - 1; ++j) {
        char32_t c1 = lc.completionStrings[j][longestCommonPrefix];
        char32_t c2 = lc.completionStrings[j + 1][longestCommonPrefix];
        if ((0 == c1) || (0 == c2) || (c1 != c2)) {
          keepGoing = false;
          break;
        }
      }
      if (keepGoing) {
        ++longestCommonPrefix;
      }
    }
  }
  if (lc.completionStrings.size() != 1) {  // beep if ambiguous
    beep();
  }

  // if we can extend the item, extend it and return to main loop
  if (longestCommonPrefix > itemLength) {
    displayLength = len + longestCommonPrefix - itemLength;
    if (displayLength > buflen) {
      longestCommonPrefix -= displayLength - buflen;  // don't overflow buffer
      displayLength = buflen;                         // truncate the insertion
      beep();                                         // and make a noise
    }
    Utf32String displayText(displayLength + 1);
    memcpy(displayText.get(), buf32, sizeof(char32_t) * startIndex);
    memcpy(&displayText[startIndex], &lc.completionStrings[0][0],
           sizeof(char32_t) * longestCommonPrefix);
    int tailIndex = startIndex + longestCommonPrefix;
    memcpy(&displayText[tailIndex], &buf32[pos],
           sizeof(char32_t) * (displayLength - tailIndex + 1));
    copyString32(buf32, displayText.get(), displayLength);
    pos = startIndex + longestCommonPrefix;
    len = displayLength;
    refreshLine(pi);
    return 0;
  }

  // we can't complete any further, wait for second tab
  do {
    c = linenoiseReadChar();
    c = cleanupCtrl(c);
  } while (c == static_cast<char32_t>(-1));

  // if any character other than tab, pass it to the main loop
  if (c != ctrlChar('I')) {
    freeCompletions(&lc);
    return c;
  }

  // we got a second tab, maybe show list of possible completions
  bool showCompletions = true;
  bool onNewLine = false;
  if (lc.completionStrings.size() > completionCountCutoff) {
    int savePos =
        pos;  // move cursor to EOL to avoid overwriting the command line
    pos = len;
    refreshLine(pi);
    pos = savePos;
    printf("\nDisplay all %u possibilities? (y or n)",
           static_cast<unsigned int>(lc.completionStrings.size()));
    fflush(stdout);
    onNewLine = true;
    while (c != 'y' && c != 'Y' && c != 'n' && c != 'N' && c != ctrlChar('C')) {
      do {
        c = linenoiseReadChar();
        c = cleanupCtrl(c);
      } while (c == static_cast<char32_t>(-1));
    }
    switch (c) {
      case 'n':
      case 'N':
        showCompletions = false;
        freeCompletions(&lc);
        break;
      case ctrlChar('C'):
        showCompletions = false;
        freeCompletions(&lc);
        if (write(1, "^C", 2) == -1) return -1;  // Display the ^C we got
        c = 0;
        break;
    }
  }

  // if showing the list, do it the way readline does it
  bool stopList = false;
  if (showCompletions) {
    int longestCompletion = 0;
    for (size_t j = 0; j < lc.completionStrings.size(); ++j) {
      itemLength = static_cast<int>(lc.completionStrings[j].length());
      if (itemLength > longestCompletion) {
        longestCompletion = itemLength;
      }
    }
    longestCompletion += 2;
    int columnCount = pi.promptScreenColumns / longestCompletion;
    if (columnCount < 1) {
      columnCount = 1;
    }
    if (!onNewLine) {  // skip this if we showed "Display all %d possibilities?"
      int savePos =
          pos;  // move cursor to EOL to avoid overwriting the command line
      pos = len;
      refreshLine(pi);
      pos = savePos;
    }
    size_t pauseRow = getScreenRows() - 1;
    size_t rowCount =
        (lc.completionStrings.size() + columnCount - 1) / columnCount;
    for (size_t row = 0; row < rowCount; ++row) {
      if (row == pauseRow) {
        printf("\n--More--");
        fflush(stdout);
        c = 0;
        bool doBeep = false;
        while (c != ' ' && c != '\r' && c != '\n' && c != 'y' && c != 'Y' &&
               c != 'n' && c != 'N' && c != 'q' && c != 'Q' &&
               c != ctrlChar('C')) {
          if (doBeep) {
            beep();
          }
          doBeep = true;
          do {
            c = linenoiseReadChar();
            c = cleanupCtrl(c);
          } while (c == static_cast<char32_t>(-1));
        }
        switch (c) {
          case ' ':
          case 'y':
          case 'Y':
            printf("\r        \r");
            pauseRow += getScreenRows() - 1;
            break;
          case '\r':
          case '\n':
            printf("\r        \r");
            ++pauseRow;
            break;
          case 'n':
          case 'N':
          case 'q':
          case 'Q':
            printf("\r        \r");
            stopList = true;
            break;
          case ctrlChar('C'):
            if (write(1, "^C", 2) == -1) return -1;  // Display the ^C we got
            stopList = true;
            break;
        }
      } else {
        printf("\n");
      }
      if (stopList) {
        break;
      }
      for (int column = 0; column < columnCount; ++column) {
        size_t index = (column * rowCount) + row;
        if (index < lc.completionStrings.size()) {
          itemLength = static_cast<int>(lc.completionStrings[index].length());
          fflush(stdout);
          if (write32(1, lc.completionStrings[index].get(), itemLength) == -1)
            return -1;
          if (((column + 1) * rowCount) + row < lc.completionStrings.size()) {
            for (int k = itemLength; k < longestCompletion; ++k) {
              printf(" ");
            }
          }
        }
      }
    }
    fflush(stdout);
    freeCompletions(&lc);
  }

  // display the prompt on a new line, then redisplay the input buffer
  if (!stopList || c == ctrlChar('C')) {
    if (write(1, "\n", 1) == -1) return 0;
  }
  if (!pi.write()) return 0;
#ifndef _WIN32
  // we have to generate our own newline on line wrap on Linux
  if (pi.promptIndentation == 0 && pi.promptExtraLines > 0)
    if (write(1, "\n", 1) == -1) return 0;
#endif
  pi.promptCursorRowOffset = pi.promptExtraLines;
  refreshLine(pi);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, 0x28(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movl 0x18(%rdi), %r14d
movq %rdi, 0x20(%rsp)
movq (%rdi), %r12
movl %r14d, %ebp
sarl $0x1f, %ebp
andl %r14d, %ebp
leal 0x1(%r14), %ebx
leaq 0x1149f(%rip), %r15     # 0x21ae0
movq %r14, %r13
testl %r13d, %r13d
jle 0x10667
movl -0x4(%r12,%r13,4), %esi
decq %r13
movl $0x18, %edx
movq %r15, %rdi
callq 0x7390
decl %ebx
testq %rax, %rax
je 0x10644
jmp 0x10669
movl %ebp, %ebx
subl %ebx, %r14d
movq 0x20(%rsp), %rax
movq (%rax), %rbp
movslq %r14d, %r15
movq %r15, 0x58(%rsp)
movq $0x0, 0x60(%rsp)
leaq 0x4(,%r15,4), %rax
cmpl $-0x1, %r15d
movq $-0x1, %r12
cmovgeq %rax, %r12
movq %r12, %rdi
callq 0x7030
movq %rax, %r13
movslq %ebx, %rax
movq %rax, 0x30(%rsp)
leaq (%rbp,%rax,4), %rbp
movq %r13, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x7200
leaq 0x58(%rsp), %r12
movq %r13, 0x8(%r12)
shlq $0x2, %r15
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x72a0
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0x14398
movq 0x40(%rsp), %rdi
movq %rsp, %rsi
callq *0x1f278(%rip)          # 0x2f970
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rax, %rdx
subq %rcx, %rdx
subq %rcx, %rax
je 0x1071a
cmpq $0x10, %rax
jne 0x10769
movl (%rcx), %r13d
jmp 0x107d1
movq 0x1e8af(%rip), %rbx     # 0x2efd0
movq (%rbx), %rsi
movl $0x7, %edi
callq 0x7430
movq (%rbx), %rdi
callq 0x73e0
movq (%rsp), %rbx
movq 0x8(%rsp), %r14
xorl %ebp, %ebp
cmpq %rbx, %r14
je 0x10a21
movq %rbx, %r15
movq 0x8(%r15), %rdi
testq %rdi, %rdi
je 0x1075b
callq 0x7480
addq $0x10, %r15
cmpq %r14, %r15
jne 0x1074d
jmp 0x10a1c
sarq $0x4, %rdx
addq $0x18, %rcx
xorl %esi, %esi
movb $0x1, %dil
xorl %r13d, %r13d
movl %r13d, %r13d
movq %rcx, %r9
movq %rdx, %r8
decq %r8
je 0x107be
movq -0x10(%r9), %r10
movq (%r9), %r11
addq $0x10, %r9
movl (%r10,%r13,4), %r10d
movl (%r11,%r13,4), %r11d
testl %r10d, %r10d
setne %bpl
testl %r11d, %r11d
setne %r15b
cmpl %r11d, %r10d
sete %r10b
andb %r15b, %r10b
movzbl %dil, %edi
testb %r10b, %bpl
cmovel %esi, %edi
jne 0x10782
movl %edi, %r8d
andb $0x1, %r8b
movzbl %r8b, %r8d
addl %r8d, %r13d
testb %r8b, %r8b
jne 0x10779
cmpq $0x10, %rax
je 0x107f3
movq 0x1e7f2(%rip), %r15     # 0x2efd0
movq (%r15), %rsi
movl $0x7, %edi
callq 0x7430
movq (%r15), %rdi
callq 0x73e0
movl %r13d, %eax
subl %r14d, %eax
jle 0x10835
movq 0x20(%rsp), %rcx
addl 0x14(%rcx), %eax
movl 0x10(%rcx), %ebp
cmpl %ebp, %eax
jle 0x1090b
subl %eax, %r13d
addl %ebp, %r13d
movq 0x1e7b5(%rip), %r14     # 0x2efd0
movq (%r14), %rsi
movl $0x7, %edi
callq 0x7430
movq (%r14), %rdi
callq 0x73e0
jmp 0x1090d
movq 0x28(%rsp), %r13
callq 0x10fc5
movl %eax, %edi
callq 0x1114a
cmpl $-0x1, %eax
je 0x1083a
movl %eax, %ebp
cmpl $0x9, %eax
jne 0x109f4
movq 0x8(%rsp), %rbx
subq (%rsp), %rbx
cmpq $0x641, %rbx            # imm = 0x641
jb 0x10a58
movq 0x20(%rsp), %r14
movl 0x14(%r14), %eax
movl 0x18(%r14), %ebp
movl %eax, 0x18(%r14)
movq %r14, %rdi
movq %r13, %rsi
callq 0x1012c
movl %ebp, 0x18(%r14)
movq 0x8(%rsp), %rsi
subq (%rsp), %rsi
shrq $0x4, %rsi
leaq 0x11299(%rip), %rdi     # 0x21b39
xorl %eax, %eax
callq 0x7070
movq 0x1e6d2(%rip), %rax     # 0x2ef80
movq (%rax), %rdi
callq 0x73e0
movl $0x9, %r15d
cmpl $0x58, %r15d
jle 0x108e1
cmpl $0x59, %r15d
je 0x10a65
cmpl $0x6e, %r15d
je 0x10a6f
cmpl $0x79, %r15d
jne 0x108f5
jmp 0x10a65
cmpl $0x3, %r15d
je 0x10aa8
cmpl $0x4e, %r15d
je 0x10a6f
callq 0x10fc5
movl %eax, %edi
callq 0x1114a
cmpl $-0x1, %eax
je 0x108f5
movl %eax, %r15d
jmp 0x108bc
movl %eax, %ebp
movl %ebp, 0x38(%rsp)
movslq %ebp, %r14
leaq 0x4(,%r14,4), %rax
cmpl $-0x1, %r14d
movq $-0x1, %r12
cmovgeq %rax, %r12
movq %r12, %rdi
callq 0x7030
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x7200
movq 0x20(%rsp), %rax
movq (%rax), %r12
movq 0x30(%rsp), %rbp
leaq (,%rbp,4), %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x72a0
leaq (%r15,%rbp,4), %rdi
movq (%rsp), %rax
movq 0x8(%rax), %rsi
movslq %r13d, %r13
leaq (,%r13,4), %rdx
callq 0x72a0
addl %ebx, %r13d
movq 0x20(%rsp), %rbx
movslq %r13d, %rax
leaq (%r15,%rax,4), %rdi
movslq 0x18(%rbx), %rcx
leaq (%r12,%rcx,4), %rsi
movl 0x38(%rsp), %ebp
movl %ebp, %ecx
subl %eax, %ecx
incl %ecx
movslq %ecx, %rdx
shlq $0x2, %rdx
callq 0x72a0
testl %ebp, %ebp
movl %ebp, %edx
je 0x109cc
xorl %eax, %eax
movl (%r15,%rax,4), %ecx
testl %ecx, %ecx
je 0x109cc
movl %ecx, (%r12)
addq $0x4, %r12
incq %rax
cmpq %rax, %r14
jne 0x109b4
movl $0x0, (%r12)
movl %r13d, 0x18(%rbx)
movl %edx, 0x14(%rbx)
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
callq 0x1012c
movq %r15, %rdi
callq 0x7480
xorl %ebp, %ebp
jmp 0x10a21
movq (%rsp), %rbx
movq 0x8(%rsp), %r14
cmpq %rbx, %r14
je 0x10a21
movq %rbx, %r15
movq 0x8(%r15), %rdi
testq %rdi, %rdi
je 0x10a13
callq 0x7480
addq $0x10, %r15
cmpq %r14, %r15
jne 0x10a05
movq %rbx, 0x8(%rsp)
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x10a30
callq 0x7480
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x10a3f
callq 0x7480
movq %rsp, %rdi
callq 0x14e22
movl %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x9, %r15d
movb $0x1, %al
jmp 0x10b0d
movb $0x1, %r14b
movb $0x1, %al
jmp 0x10aff
movq (%rsp), %r12
movq 0x8(%rsp), %r13
movb $0x1, %r14b
cmpq %r12, %r13
je 0x10a9f
movq %r12, %rbp
movq 0x8(%rbp), %rdi
testq %rdi, %rdi
je 0x10a91
callq 0x7480
addq $0x10, %rbp
cmpq %r13, %rbp
jne 0x10a83
movq %r12, 0x8(%rsp)
xorl %eax, %eax
movq 0x28(%rsp), %r13
jmp 0x10aff
movq (%rsp), %r14
movq 0x8(%rsp), %r15
cmpq %r14, %r15
je 0x10ad6
movq %r14, %r12
movq 0x8(%r12), %rdi
testq %rdi, %rdi
je 0x10ac8
callq 0x7480
addq $0x10, %r12
cmpq %r15, %r12
jne 0x10ab9
movq %r14, 0x8(%rsp)
leaq 0x11084(%rip), %rsi     # 0x21b61
movl $0x2, %edx
movl $0x1, %edi
callq 0x7130
xorl %ecx, %ecx
cmpq $-0x1, %rax
setne %r14b
sete %cl
leal (%rcx,%rcx,2), %r15d
xorl %eax, %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %r14b, %r14b
je 0x10a21
testb %al, %al
je 0x10b44
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
subq %rax, %rcx
je 0x10b4c
sarq $0x4, %rcx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %ebp, %ebp
movl %ebp, %edx
movl (%rax), %ebp
cmpl %ebp, %edx
cmovgl %edx, %ebp
addq $0x10, %rax
decq %rcx
jne 0x10b2d
addl $0x2, %ebp
jmp 0x10b51
xorl %r12d, %r12d
jmp 0x10eb3
movl $0x2, %ebp
movl 0x34(%r13), %eax
cltd
idivl %ebp
cmpl $0x2, %eax
movl $0x1, %r14d
cmovgel %eax, %r14d
cmpq $0x640, %rbx            # imm = 0x640
ja 0x10b92
movq 0x20(%rsp), %r12
movl 0x14(%r12), %eax
movl 0x18(%r12), %ebx
movl %eax, 0x18(%r12)
movq %r12, %rdi
movq %r13, %rsi
callq 0x1012c
movl %ebx, 0x18(%r12)
xorl %r12d, %r12d
leaq 0x48(%rsp), %rdx
movl $0x5413, %esi           # imm = 0x5413
movl $0x1, %edi
xorl %eax, %eax
callq 0x74e0
movl %eax, %ecx
movq 0x8(%rsp), %rax
subq (%rsp), %rax
sarq $0x4, %rax
movl %r14d, %edi
leaq (%rdi,%rax), %rsi
decq %rsi
movq %rsi, %rax
xorl %edx, %edx
divq %rdi
movb $0x1, %dl
movq %rdi, 0x38(%rsp)
cmpq %rdi, %rsi
jb 0x10e63
leaq 0x48(%rsp), %rdx
movzwl (%rdx), %edx
cmpl $-0x1, %ecx
movl $0x18, %ecx
cmovel %ecx, %edx
subl $0x1, %edx
movl $0x17, %ecx
cmovbl %ecx, %edx
movslq %edx, %r14
cmpq $0x1, %rax
movq %rax, 0x30(%rsp)
adcq $0x0, %rax
movq %rax, 0x68(%rsp)
xorl %ebx, %ebx
xorl %r12d, %r12d
cmpq %r14, %rbx
jne 0x10cd7
xorl %r15d, %r15d
leaq 0x10f3d(%rip), %rdi     # 0x21b64
xorl %eax, %eax
callq 0x7070
movq 0x1e34b(%rip), %rax     # 0x2ef80
movq (%rax), %rdi
callq 0x73e0
xorl %eax, %eax
cmpl $0x1f, %r15d
jle 0x10c7e
leal -0x4e(%r15), %ecx
cmpl $0x2b, %ecx
ja 0x10c76
movabsq $0x900000009, %rdx      # imm = 0x900000009
btq %rcx, %rdx
jb 0x10ce3
movabsq $0x80000000800, %rdx    # imm = 0x80000000800
btq %rcx, %rdx
jb 0x10cf8
cmpl $0x20, %r15d
jne 0x10c9c
jmp 0x10cf8
cmpl $0x3, %r15d
je 0x10e28
cmpl $0xa, %r15d
je 0x10d3e
cmpl $0xd, %r15d
je 0x10d3e
testb $0x1, %al
je 0x10cbc
movq 0x1e329(%rip), %r15     # 0x2efd0
movq (%r15), %rsi
movl $0x7, %edi
callq 0x7430
movq (%r15), %rdi
callq 0x73e0
callq 0x10fc5
movl %eax, %edi
callq 0x1114a
cmpl $-0x1, %eax
je 0x10cbc
movl %eax, %r15d
movb $0x1, %al
jmp 0x10c3f
movl $0xa, %edi
callq 0x74c0
jmp 0x10d59
leaq 0x10e84(%rip), %rdi     # 0x21b6e
xorl %eax, %eax
callq 0x7070
movb $0x1, %al
movb $0x1, %r12b
jmp 0x10d51
leaq 0x10e6f(%rip), %rdi     # 0x21b6e
xorl %eax, %eax
callq 0x7070
movl $0x5413, %esi           # imm = 0x5413
movl $0x1, %edi
leaq 0x48(%rsp), %rdx
xorl %eax, %eax
callq 0x74e0
cmpl $-0x1, %eax
movzwl 0x48(%rsp), %eax
movl $0x18, %ecx
cmovel %ecx, %eax
subl $0x1, %eax
movl $0x17, %ecx
cmovbl %ecx, %eax
cltq
addq %rax, %r14
jmp 0x10d4f
leaq 0x10e29(%rip), %rdi     # 0x21b6e
xorl %eax, %eax
callq 0x7070
incq %r14
movb $0x1, %al
testb %al, %al
je 0x10f46
testb $0x1, %r12b
jne 0x10f3f
movq %r14, 0x70(%rsp)
movq %r12, 0x50(%rsp)
xorl %r14d, %r14d
movq 0x30(%rsp), %r12
imulq %r14, %r12
addq %rbx, %r12
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
subq %rax, %rcx
sarq $0x4, %rcx
cmpq %rcx, %r12
jae 0x10df8
shlq $0x4, %r12
movl (%rax,%r12), %r13d
movq 0x1e1e0(%rip), %rax     # 0x2ef80
movq (%rax), %rdi
callq 0x73e0
movq (%rsp), %rax
movq 0x8(%rax,%r12), %rdi
movl %r13d, %esi
callq 0x10581
cmpl $-0x1, %eax
je 0x10e57
leaq 0x1(%r14), %rax
imulq 0x30(%rsp), %rax
addq %rbx, %rax
movq 0x8(%rsp), %rcx
subq (%rsp), %rcx
sarq $0x4, %rcx
cmpq %rcx, %rax
jae 0x10df8
movl %ebp, %r12d
subl %r13d, %r12d
jle 0x10df8
movl $0x20, %edi
callq 0x74c0
decl %r12d
jne 0x10de9
incq %r14
cmpq 0x38(%rsp), %r14
jne 0x10d70
incq %rbx
cmpq 0x68(%rsp), %rbx
movq 0x28(%rsp), %r13
movq 0x50(%rsp), %r12
movq 0x70(%rsp), %r14
jne 0x10c14
jmp 0x10f3f
movl $0x2, %edx
movl $0x1, %edi
leaq 0x10d28(%rip), %rsi     # 0x21b61
callq 0x7130
cmpq $-0x1, %rax
setne %al
movzbl %r12b, %r12d
movl $0x1, %ecx
cmovnel %ecx, %r12d
jmp 0x10d51
xorl %edx, %edx
movq 0x28(%rsp), %r13
movq 0x50(%rsp), %r12
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %dl, %dl
je 0x10a21
movq 0x1e109(%rip), %rax     # 0x2ef80
movq (%rax), %rdi
callq 0x73e0
movq (%rsp), %rbx
movq 0x8(%rsp), %r14
cmpq %rbx, %r14
je 0x10eb3
movq %r12, %rbp
movq %rbx, %r12
movq 0x8(%r12), %rdi
testq %rdi, %rdi
je 0x10ea2
callq 0x7480
addq $0x10, %r12
cmpq %r14, %r12
jne 0x10e93
movq %rbx, 0x8(%rsp)
movq %rbp, %r12
testb $0x1, %r12b
je 0x10ebf
cmpl $0x3, %r15d
jne 0x10edf
leaq 0x10d60(%rip), %rsi     # 0x21c26
movl $0x1, %edx
movl $0x1, %edi
callq 0x7130
cmpq $-0x1, %rax
je 0x109f0
movq 0x8(%r13), %rdi
movl 0x1c(%r13), %esi
callq 0x10581
xorl %ebp, %ebp
cmpl $-0x1, %eax
je 0x10a21
cmpl $0x0, 0x24(%r13)
jne 0x10f25
cmpl $0x0, 0x20(%r13)
jle 0x10f25
leaq 0x10d1a(%rip), %rsi     # 0x21c26
movl $0x1, %edx
movl $0x1, %edi
callq 0x7130
cmpq $-0x1, %rax
je 0x10a21
movl 0x20(%r13), %eax
movl %eax, 0x30(%r13)
movq 0x20(%rsp), %rdi
movq %r13, %rsi
callq 0x1012c
jmp 0x10a21
movb $0x1, %dl
jmp 0x10e63
xorl %edx, %edx
jmp 0x10e63
jmp 0x10f76
jmp 0x10f76
jmp 0x10f76
jmp 0x10f76
movq %rax, %rbx
movq %r15, %rdi
callq 0x7480
jmp 0x10f79
jmp 0x10f76
jmp 0x10f76
jmp 0x10f76
movq %rax, %rbx
jmp 0x10f88
movq %rax, %rbx
jmp 0x10f97
jmp 0x10f76
jmp 0x10f76
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x10f88
callq 0x7480
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x10f97
callq 0x7480
movq %rsp, %rdi
callq 0x14e22
movq %rbx, %rdi
callq 0x7620