// File: /workspace/github_cpp_makefile_star2_O2/andrakis[P]alisp/contrib/linenoise-ng/src/linenoise.cpp
// Function: InputBuffer::incrementalHistorySearch(PromptBase&, int)
int InputBuffer::incrementalHistorySearch(PromptBase& pi, int startChar) {
  size_t bufferSize;
  size_t ucharCount = 0;

  // if not already recalling, add the current line to the history list so we
  // don't have to
  // special case it
  if (historyIndex == historyLen - 1) {
    free(history[historyLen - 1]);
    bufferSize = sizeof(char32_t) * len + 1;
    unique_ptr<char[]> tempBuffer(new char[bufferSize]);
    copyString32to8(tempBuffer.get(), bufferSize, buf32);
    history[historyLen - 1] = strdup8(tempBuffer.get());
  }
  int historyLineLength = len;
  int historyLinePosition = pos;
  char32_t emptyBuffer[1];
  char emptyWidths[1];
  InputBuffer empty(emptyBuffer, emptyWidths, 1);
  empty.refreshLine(pi);  // erase the old input first
  DynamicPrompt dp(pi, (startChar == ctrlChar('R')) ? -1 : 1);

  dp.promptPreviousLen = pi.promptPreviousLen;
  dp.promptPreviousInputLen = pi.promptPreviousInputLen;
  dynamicRefresh(dp, buf32, historyLineLength,
                 historyLinePosition);  // draw user's text with our prompt

  // loop until we get an exit character
  int c = 0;
  bool keepLooping = true;
  bool useSearchedLine = true;
  bool searchAgain = false;
  char32_t* activeHistoryLine = 0;
  while (keepLooping) {
    c = linenoiseReadChar();
    c = cleanupCtrl(c);  // convert CTRL + <char> into normal ctrl

    switch (c) {
      // these characters keep the selected text but do not execute it
      case ctrlChar('A'):  // ctrl-A, move cursor to start of line
      case HOME_KEY:
      case ctrlChar('B'):  // ctrl-B, move cursor left by one character
      case LEFT_ARROW_KEY:
      case META + 'b':  // meta-B, move cursor left by one word
      case META + 'B':
      case CTRL + LEFT_ARROW_KEY:
      case META + LEFT_ARROW_KEY:  // Emacs allows Meta, bash & readline don't
      case ctrlChar('D'):
      case META + 'd':  // meta-D, kill word to right of cursor
      case META + 'D':
      case ctrlChar('E'):  // ctrl-E, move cursor to end of line
      case END_KEY:
      case ctrlChar('F'):  // ctrl-F, move cursor right by one character
      case RIGHT_ARROW_KEY:
      case META + 'f':  // meta-F, move cursor right by one word
      case META + 'F':
      case CTRL + RIGHT_ARROW_KEY:
      case META + RIGHT_ARROW_KEY:  // Emacs allows Meta, bash & readline don't
      case META + ctrlChar('H'):
      case ctrlChar('J'):
      case ctrlChar('K'):  // ctrl-K, kill from cursor to end of line
      case ctrlChar('M'):
      case ctrlChar('N'):  // ctrl-N, recall next line in history
      case ctrlChar('P'):  // ctrl-P, recall previous line in history
      case DOWN_ARROW_KEY:
      case UP_ARROW_KEY:
      case ctrlChar('T'):  // ctrl-T, transpose characters
      case ctrlChar(
          'U'):  // ctrl-U, kill all characters to the left of the cursor
      case ctrlChar('W'):
      case META + 'y':  // meta-Y, "yank-pop", rotate popped text
      case META + 'Y':
      case 127:
      case DELETE_KEY:
      case META + '<':  // start of history
      case PAGE_UP_KEY:
      case META + '>':  // end of history
      case PAGE_DOWN_KEY:
        keepLooping = false;
        break;

      // these characters revert the input line to its previous state
      case ctrlChar('C'):  // ctrl-C, abort this line
      case ctrlChar('G'):
      case ctrlChar('L'):  // ctrl-L, clear screen and redisplay line
        keepLooping = false;
        useSearchedLine = false;
        if (c != ctrlChar('L')) {
          c = -1;  // ctrl-C and ctrl-G just abort the search and do nothing
                   // else
        }
        break;

      // these characters stay in search mode and update the display
      case ctrlChar('S'):
      case ctrlChar('R'):
        if (dp.searchTextLen ==
            0) {  // if no current search text, recall previous text
          if (previousSearchText.length()) {
            dp.updateSearchText(previousSearchText.get());
          }
        }
        if ((dp.direction == 1 && c == ctrlChar('R')) ||
            (dp.direction == -1 && c == ctrlChar('S'))) {
          dp.direction = 0 - dp.direction;  // reverse direction
          dp.updateSearchPrompt();          // change the prompt
        } else {
          searchAgain = true;  // same direction, search again
        }
        break;

// job control is its own thing
#ifndef _WIN32
      case ctrlChar('Z'):  // ctrl-Z, job control
        disableRawMode();  // Returning to Linux (whatever) shell, leave raw
                           // mode
        raise(SIGSTOP);    // Break out in mid-line
        enableRawMode();   // Back from Linux shell, re-enter raw mode
        {
          bufferSize = historyLineLength + 1;
          unique_ptr<char32_t[]> tempUnicode(new char32_t[bufferSize]);
          copyString8to32(tempUnicode.get(), bufferSize, ucharCount,
                          history[historyIndex]);
          dynamicRefresh(dp, tempUnicode.get(), historyLineLength,
                         historyLinePosition);
        }
        continue;
        break;
#endif

      // these characters update the search string, and hence the selected input
      // line
      case ctrlChar('H'):  // backspace/ctrl-H, delete char to left of cursor
        if (dp.searchTextLen > 0) {
          unique_ptr<char32_t[]> tempUnicode(new char32_t[dp.searchTextLen]);
          --dp.searchTextLen;
          dp.searchText[dp.searchTextLen] = 0;
          copyString32(tempUnicode.get(), dp.searchText.get(),
                       dp.searchTextLen);
          dp.updateSearchText(tempUnicode.get());
        } else {
          beep();
        }
        break;

      case ctrlChar('Y'):  // ctrl-Y, yank killed text
        break;

      default:
        if (!isControlChar(c) && c <= 0x0010FFFF) {  // not an action character
          unique_ptr<char32_t[]> tempUnicode(
              new char32_t[dp.searchTextLen + 2]);
          copyString32(tempUnicode.get(), dp.searchText.get(),
                       dp.searchTextLen);
          tempUnicode[dp.searchTextLen] = c;
          tempUnicode[dp.searchTextLen + 1] = 0;
          dp.updateSearchText(tempUnicode.get());
        } else {
          beep();
        }
    }  // switch

    // if we are staying in search mode, search now
    if (keepLooping) {
      bufferSize = historyLineLength + 1;
      if (activeHistoryLine) {
        delete[] activeHistoryLine;
        activeHistoryLine = nullptr;
      }
      activeHistoryLine = new char32_t[bufferSize];
      copyString8to32(activeHistoryLine, bufferSize, ucharCount,
                      history[historyIndex]);
      if (dp.searchTextLen > 0) {
        bool found = false;
        int historySearchIndex = historyIndex;
        int lineLength = static_cast<int>(ucharCount);
        int lineSearchPos = historyLinePosition;
        if (searchAgain) {
          lineSearchPos += dp.direction;
        }
        searchAgain = false;
        while (true) {
          while ((dp.direction > 0) ? (lineSearchPos < lineLength)
                                    : (lineSearchPos >= 0)) {
            if (strncmp32(dp.searchText.get(),
                          &activeHistoryLine[lineSearchPos],
                          dp.searchTextLen) == 0) {
              found = true;
              break;
            }
            lineSearchPos += dp.direction;
          }
          if (found) {
            historyIndex = historySearchIndex;
            historyLineLength = lineLength;
            historyLinePosition = lineSearchPos;
            break;
          } else if ((dp.direction > 0) ? (historySearchIndex < historyLen - 1)
                                        : (historySearchIndex > 0)) {
            historySearchIndex += dp.direction;
            bufferSize = strlen8(history[historySearchIndex]) + 1;
            delete[] activeHistoryLine;
            activeHistoryLine = nullptr;
            activeHistoryLine = new char32_t[bufferSize];
            copyString8to32(activeHistoryLine, bufferSize, ucharCount,
                            history[historySearchIndex]);
            lineLength = static_cast<int>(ucharCount);
            lineSearchPos =
                (dp.direction > 0) ? 0 : (lineLength - dp.searchTextLen);
          } else {
            beep();
            break;
          }
        };  // while
      }
      if (activeHistoryLine) {
        delete[] activeHistoryLine;
        activeHistoryLine = nullptr;
      }
      bufferSize = historyLineLength + 1;
      activeHistoryLine = new char32_t[bufferSize];
      copyString8to32(activeHistoryLine, bufferSize, ucharCount,
                      history[historyIndex]);
      dynamicRefresh(dp, activeHistoryLine, historyLineLength,
                     historyLinePosition);  // draw user's text with our prompt
    }
  }  // while

  // leaving history search, restore previous prompt, maybe make searched line
  // current
  PromptBase pb;
  pb.promptChars = pi.promptIndentation;
  pb.promptBytes = pi.promptBytes;
  Utf32String tempUnicode(pb.promptBytes + 1);

  copyString32(tempUnicode.get(), &pi.promptText[pi.promptLastLinePosition],
               pb.promptBytes - pi.promptLastLinePosition);
  tempUnicode.initFromBuffer();
  pb.promptText = tempUnicode;
  pb.promptExtraLines = 0;
  pb.promptIndentation = pi.promptIndentation;
  pb.promptLastLinePosition = 0;
  pb.promptPreviousInputLen = historyLineLength;
  pb.promptCursorRowOffset = dp.promptCursorRowOffset;
  pb.promptScreenColumns = pi.promptScreenColumns;
  pb.promptPreviousLen = dp.promptChars;
  if (useSearchedLine && activeHistoryLine) {
    historyRecallMostRecent = true;
    copyString32(buf32, activeHistoryLine, buflen + 1);
    len = historyLineLength;
    pos = historyLinePosition;
  }
  if (activeHistoryLine) {
    delete[] activeHistoryLine;
    activeHistoryLine = nullptr;
  }
  dynamicRefresh(pb, buf32, len,
                 pos);  // redraw the original prompt with current input
  pi.promptPreviousInputLen = len;
  pi.promptCursorRowOffset = pi.promptExtraLines + pb.promptCursorRowOffset;
  previousSearchText =
      dp.searchText;  // save search text for possible reuse on ctrl-R ctrl-R
  return c;           // pass a character or -1 back to main loop
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movl %edx, %ebx
movq %rsi, %r12
movq %rdi, %r14
andq $0x0, 0x20(%rsp)
movslq 0x1cac0(%rip), %rax     # 0x2b978
movl 0x1caaa(%rip), %ecx     # 0x2b968
decl %ecx
cmpl %ecx, %eax
jne 0xef33
movq 0x1ca95(%rip), %rcx     # 0x2b960
movq (%rcx,%rax,8), %rdi
callq 0x73c0
movslq 0x14(%r14), %rax
movq %r14, %r13
leaq 0x1(,%rax,4), %r14
movq %r14, %rdi
callq 0x7030
movq %rax, 0x80(%rsp)
movq %r13, %r15
movq (%r13), %rdx
movq %rax, %rdi
movq %r14, %rsi
callq 0xf70e
leaq 0x80(%rsp), %r14
movq (%r14), %rdi
callq 0x7630
movq 0x1ca44(%rip), %rcx     # 0x2b960
movslq 0x1ca45(%rip), %rdx     # 0x2b968
movq %rax, -0x8(%rcx,%rdx,8)
movq %r14, %rdi
callq 0x11a32
movq %r15, %r14
movl 0x14(%r14), %r13d
movl 0x18(%r14), %ebp
leaq 0x104(%rsp), %rax
leaq 0x108(%rsp), %rdi
movq %rax, (%rdi)
leaq 0xf(%rsp), %rcx
movq %rcx, 0x8(%rdi)
andq $0x0, 0x10(%rdi)
andl $0x0, 0x18(%rdi)
andl $0x0, (%rax)
movq %r12, %rsi
callq 0xe072
xorl %eax, %eax
cmpl $0x12, %ebx
setne %al
leal -0x1(,%rax,2), %edx
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x11a4c
movl 0x38(%r12), %eax
movl %eax, 0x38(%rbx)
movq %r12, %r15
movl 0x2c(%r12), %eax
movl %eax, 0x2c(%rbx)
movq %r14, 0xe8(%rsp)
movq (%r14), %rsi
movq %rbx, %rdi
movl %r13d, %r12d
movl %r13d, %edx
movl %ebp, 0x8(%rsp)
movl %ebp, %ecx
callq 0xf730
movb $0x1, %r14b
xorl %r13d, %r13d
movb $0x1, %al
movl %eax, 0x2c(%rsp)
movl $0x0, 0x18(%rsp)
xorl %ebx, %ebx
movl %r12d, %ebp
movl %ebp, 0x4(%rsp)
movslq %ebp, %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x30(%rsp)
cmpl $-0x1, %eax
leaq 0x4(,%rax,4), %r12
movq %r12, 0x78(%rsp)
pushq $-0x1
popq %rax
cmovlq %rax, %r12
movl %r13d, %ebp
movq %r15, %r13
testb $0x1, %r14b
je 0xf53a
callq 0xec30
movl %eax, %edi
callq 0xeda5
movl %eax, %r13d
leal -0x1(%r13), %eax
cmpl $0x19, %eax
ja 0xf0a6
leaq 0xd922(%rip), %rcx      # 0x1c950
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0xf928
pushq $0x13
popq %rdi
callq 0x7300
callq 0xf955
movq %r12, %rdi
callq 0x7030
movq %rax, 0x38(%rsp)
movq 0x1c903(%rip), %rcx     # 0x2b960
movslq 0x1c914(%rip), %rdx     # 0x2b978
movq (%rcx,%rdx,8), %rcx
movq %rax, %rdi
movq 0x30(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x113ea
movq %r15, %r13
movq 0x38(%rsp), %rsi
leaq 0x80(%rsp), %rdi
movl 0x4(%rsp), %edx
movl 0x8(%rsp), %ecx
callq 0xf730
leaq 0x38(%rsp), %rdi
callq 0x11d06
jmp 0xf005
leal -0x4000003c(%r13), %eax
cmpl $0x3d, %eax
jbe 0xf157
cmpl $0x7f, %r13d
je 0xf185
cmpl $0x10200000, %r13d      # imm = 0x10200000
je 0xf185
cmpl $0x10400000, %r13d      # imm = 0x10400000
je 0xf185
cmpl $0x10600000, %r13d      # imm = 0x10600000
je 0xf185
cmpl $0x10800000, %r13d      # imm = 0x10800000
je 0xf185
cmpl $0x10a00000, %r13d      # imm = 0x10A00000
je 0xf185
cmpl $0x10c00000, %r13d      # imm = 0x10C00000
je 0xf185
cmpl $0x10e00000, %r13d      # imm = 0x10E00000
je 0xf185
cmpl $0x11000000, %r13d      # imm = 0x11000000
je 0xf185
cmpl $0x11200000, %r13d      # imm = 0x11200000
je 0xf185
cmpl $0x30600000, %r13d      # imm = 0x30600000
je 0xf185
cmpl $0x30800000, %r13d      # imm = 0x30800000
je 0xf185
cmpl $0x40000008, %r13d      # imm = 0x40000008
je 0xf185
cmpl $0x50600000, %r13d      # imm = 0x50600000
je 0xf185
cmpl $0x50800000, %r13d      # imm = 0x50800000
je 0xf185
jmp 0xf1fc
movabsq $0x2000054020000545, %rcx # imm = 0x2000054020000545
btq %rax, %rcx
jb 0xf185
jmp 0xf0b6
xorl %eax, %eax
cmpl $0xc, %r13d
setne %al
negl %eax
orl $0xc, %eax
movl $0x0, 0x2c(%rsp)
movl %eax, %r13d
xorl %r14d, %r14d
jmp 0xefff
cmpl $0x0, 0xd8(%rsp)
movl 0x4(%rsp), %ebp
jne 0xf1b9
cmpq $0x0, 0x1c76d(%rip)     # 0x2b910
je 0xf1b9
movq 0x1c76c(%rip), %rsi     # 0x2b918
leaq 0x80(%rsp), %rdi
callq 0x11bbc
movl 0xdc(%rsp), %eax
movl %eax, %ecx
xorl $0x1, %ecx
movl %r13d, %edx
xorl $0x12, %edx
orl %ecx, %edx
je 0xf1e1
movl %eax, %ecx
notl %ecx
movl %r13d, %edx
xorl $0x13, %edx
orl %ecx, %edx
jne 0xf4bd
negl %eax
movl %eax, 0xdc(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x11c14
jmp 0xf2e5
cmpl $0x10ffff, %r13d        # imm = 0x10FFFF
jg 0xf2dc
cmpl $0x20, %r13d
jb 0xf2dc
movl %r13d, %eax
addl $-0x7f, %eax
cmpl $0x21, %eax
jb 0xf2dc
movslq 0xd8(%rsp), %rbp
cmpq $-0x2, %rbp
leaq 0x8(,%rbp,4), %rdi
pushq $-0x1
popq %rax
cmovlq %rax, %rdi
callq 0x7030
movq %rax, 0x38(%rsp)
movq 0xc8(%rsp), %rsi
movq %rax, %rdi
movq %rbp, %rdx
callq 0xec15
movslq 0xd8(%rsp), %rax
movq 0x38(%rsp), %rsi
movl %r13d, (%rsi,%rax,4)
andl $0x0, 0x4(%rsi,%rax,4)
leaq 0x80(%rsp), %rdi
callq 0x11bbc
jmp 0xf2d0
movslq 0xd8(%rsp), %rbp
testq %rbp, %rbp
jle 0xf2dc
leaq (,%rbp,4), %rdi
callq 0x7030
movq %rax, 0x38(%rsp)
decl %ebp
movl %ebp, 0xd8(%rsp)
movq 0xc8(%rsp), %rsi
andl $0x0, (%rsi,%rbp,4)
movq %rax, %rdi
movq %rbp, %rdx
callq 0xec15
movq 0x38(%rsp), %rsi
leaq 0x80(%rsp), %rdi
callq 0x11bbc
leaq 0x38(%rsp), %rdi
callq 0x11d06
jmp 0xf2e1
callq 0xebf9
movl 0x4(%rsp), %ebp
testq %rbx, %rbx
je 0xf2f2
movq %rbx, %rdi
callq 0x7440
movq %r12, %rdi
callq 0x7030
movq %rax, %rbx
movq 0x1c65c(%rip), %rax     # 0x2b960
movslq 0x1c66d(%rip), %rcx     # 0x2b978
movq (%rax,%rcx,8), %rcx
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x113ea
movl 0xd8(%rsp), %ecx
testl %ecx, %ecx
jle 0xf4d9
movl 0x1c642(%rip), %eax     # 0x2b978
movl %eax, 0x10(%rsp)
movl 0x20(%rsp), %ebp
movl 0xdc(%rsp), %eax
testb $0x1, 0x18(%rsp)
movl $0x0, %edx
cmovnel %eax, %edx
addl 0x8(%rsp), %edx
movq 0xc8(%rsp), %rsi
movslq %ecx, %rdi
movslq %edx, %rcx
movslq %eax, %r8
movslq %ebp, %rdx
leaq (%rbx,%rcx,4), %r9
leaq (,%r8,4), %r10
xorl %r11d, %r11d
cmpq %rdx, %rcx
setl %r11b
xorl %r12d, %r12d
testq %rcx, %rcx
setns %r12b
testl %eax, %eax
cmovgl %r11d, %r12d
cmpb $0x1, %r12b
jne 0xf3c2
xorl %r11d, %r11d
cmpq %r11, %rdi
je 0xf495
movl (%rsi,%r11,4), %r12d
testl %r12d, %r12d
je 0xf495
cmpl (%r9,%r11,4), %r12d
jne 0xf3ba
incq %r11
jmp 0xf399
addq %r8, %rcx
addq %r10, %r9
jmp 0xf376
testl %eax, %eax
jle 0xf3dd
movl 0x1c59c(%rip), %ecx     # 0x2b968
decl %ecx
movl 0x10(%rsp), %r12d
cmpl %ecx, %r12d
jl 0xf3eb
jmp 0xf4c8
movl 0x10(%rsp), %r12d
testl %r12d, %r12d
jle 0xf4c8
addl %eax, %r12d
movq 0x1c56b(%rip), %rax     # 0x2b960
movslq %r12d, %rcx
movq %rcx, 0x10(%rsp)
movq (%rax,%rcx,8), %rdi
callq 0x7170
movq %rax, 0x18(%rsp)
leaq 0x1(%rax), %rbp
movq %rbx, %rdi
callq 0x7440
movq %rbp, 0xe0(%rsp)
shrq $0x3e, %rbp
movq 0x18(%rsp), %rcx
leaq 0x4(,%rcx,4), %rcx
negq %rbp
movl $0x0, %edi
sbbq %rdi, %rdi
orq %rcx, %rdi
callq 0x7030
movq %rax, %rbx
movq 0x1c513(%rip), %rax     # 0x2b960
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rcx
movq %rbx, %rdi
movq 0xe0(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x113ea
movl %r12d, 0x10(%rsp)
movl 0x20(%rsp), %ebp
movl 0xd8(%rsp), %ecx
movl 0xdc(%rsp), %eax
movl %ebp, %edx
subl %ecx, %edx
testl %eax, %eax
movl $0x0, %esi
cmovgl %esi, %edx
jmp 0xf356
movl 0x10(%rsp), %eax
movl %eax, 0x1c4d9(%rip)     # 0x2b978
leaq 0x4(,%rdx,4), %r12
incq %rdx
movl $0x0, 0x18(%rsp)
movq %rdx, 0x30(%rsp)
movl %ecx, 0x8(%rsp)
jmp 0xf4de
movb $0x1, %al
movl %eax, 0x18(%rsp)
jmp 0xf2e5
callq 0xebf9
movl $0x0, 0x18(%rsp)
movl 0x4(%rsp), %ebp
movq 0x78(%rsp), %r12
movq %rbx, %rdi
callq 0x7440
cmpl $-0x1, %ebp
pushq $-0x1
popq %rax
cmovlq %rax, %r12
movq %r12, %rdi
callq 0x7030
movq %rax, %rbx
movq 0x1c45e(%rip), %rax     # 0x2b960
movslq 0x1c46f(%rip), %rcx     # 0x2b978
movq (%rax,%rcx,8), %rcx
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x113ea
leaq 0x80(%rsp), %rdi
movq %rbx, %rsi
movl %ebp, %edx
movl 0x8(%rsp), %ecx
callq 0xf730
jmp 0xefd8
leaq 0x38(%rsp), %rdi
callq 0x11d20
movl 0x24(%r13), %eax
movl %eax, 0x50(%rsp)
movl 0x1c(%r13), %esi
movl %esi, 0x54(%rsp)
incl %esi
leaq 0xf0(%rsp), %rdi
callq 0x119cc
leaq 0xf0(%rsp), %r14
movslq 0x28(%r13), %rax
leaq (,%rax,4), %rsi
addq 0x8(%r13), %rsi
movq 0x8(%r14), %rdi
leaq 0x38(%rsp), %r12
movslq 0x1c(%r12), %rdx
subq %rax, %rdx
callq 0xec15
movq %r14, %rdi
callq 0x11d30
movq %r12, %rdi
movq %r14, %rsi
callq 0x11d46
movq 0xe8(%rsp), %r14
andl $0x0, 0x58(%rsp)
movl 0x24(%r13), %eax
movl %eax, 0x5c(%rsp)
andl $0x0, 0x60(%rsp)
movl 0x4(%rsp), %r15d
movl %r15d, 0x64(%rsp)
movl 0x98(%rsp), %eax
movl 0xb0(%rsp), %ecx
movl %ecx, 0x68(%rsp)
movl 0x34(%r13), %ecx
movl %ecx, 0x6c(%rsp)
movl %eax, 0x70(%rsp)
testq %rbx, %rbx
sete %al
movl 0x2c(%rsp), %ecx
notb %cl
orb %al, %cl
testb $0x1, %cl
jne 0xf620
movb $0x1, 0x1c37c(%rip)     # 0x2b97c
movq (%r14), %rdi
movslq 0x10(%r14), %rdx
incq %rdx
movq %rbx, %rsi
callq 0xec15
movl %r15d, 0x14(%r14)
movl 0x8(%rsp), %eax
movl %eax, 0x18(%r14)
jmp 0xf625
testq %rbx, %rbx
je 0xf62d
movq %rbx, %rdi
callq 0x7440
movq (%r14), %rsi
movl 0x14(%r14), %edx
movl 0x18(%r14), %ecx
leaq 0x38(%rsp), %rdi
callq 0xf730
movl 0x14(%r14), %eax
movl %eax, 0x2c(%r13)
movl 0x68(%rsp), %eax
addl 0x20(%r13), %eax
movl %eax, 0x30(%r13)
leaq 0xc0(%rsp), %rsi
leaq 0x1c2ab(%rip), %rdi     # 0x2b910
callq 0x11d46
leaq 0xf0(%rsp), %rdi
callq 0x118be
leaq 0x38(%rsp), %rdi
callq 0x118be
leaq 0x80(%rsp), %rdi
callq 0x11dc8
movl %ebp, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xf6f6
jmp 0xf6f6
jmp 0xf6e7
jmp 0xf6e7
jmp 0xf6f6
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x11a32
jmp 0xf706
movq %rax, %rbx
jmp 0xf6d7
jmp 0xf6f6
jmp 0xf6f6
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x118be
leaq 0x38(%rsp), %rdi
callq 0x118be
jmp 0xf6f9
jmp 0xf6f6
jmp 0xf6f6
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x11d06
jmp 0xf6f9
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x11dc8
movq %rbx, %rdi
callq 0x7600