// File: /workspace/github_cpp_makefile_star2_O3/andrakis[P]alisp/contrib/linenoise-ng/src/linenoise.cpp
// Function: DynamicPrompt::DynamicPrompt(PromptBase&, int)
DynamicPrompt(PromptBase& pi, int initialDirection)
      : searchTextLen(0), direction(initialDirection) {
    promptScreenColumns = pi.promptScreenColumns;
    promptCursorRowOffset = 0;
    Utf32String emptyString(1);
    searchText = emptyString;
    const Utf32String* basePrompt =
        (direction > 0) ? &forwardSearchBasePrompt : &reverseSearchBasePrompt;
    size_t promptStartLength = basePrompt->length();
    promptChars =
        static_cast<int>(promptStartLength + endSearchBasePrompt.length());
    promptBytes = promptChars;
    promptLastLinePosition = promptChars;  // TODO fix this, we are asssuming
                                           // that the history prompt won't wrap
                                           // (!)
    promptPreviousLen = promptChars;
    Utf32String tempUnicode(promptChars + 1);
    memcpy(tempUnicode.get(), basePrompt->get(),
           sizeof(char32_t) * promptStartLength);
    memcpy(&tempUnicode[promptStartLength], endSearchBasePrompt.get(),
           sizeof(char32_t) * (endSearchBasePrompt.length() + 1));
    tempUnicode.initFromBuffer();
    promptText = tempUnicode;
    calculateScreenPosition(0, 0, pi.promptScreenColumns, promptChars,
                            promptIndentation, promptExtraLines);
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movl $0x4, %edi
callq 0x7030
xorl %r14d, %r14d
movl %r14d, (%rax)
movq %rax, 0x8(%rbx)
movl %r14d, 0x2c(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rbx)
movl $0x4, %edi
callq 0x7030
movl %r14d, (%rax)
movq %rax, 0x48(%rbx)
movl %r14d, 0x58(%rbx)
movl %ebp, 0x5c(%rbx)
movl 0x34(%r15), %eax
movl %eax, 0x34(%rbx)
movl %r14d, 0x30(%rbx)
movq $0x0, 0x28(%rsp)
movl $0x4, %edi
callq 0x7030
movq %r15, 0x10(%rsp)
leaq 0x40(%rbx), %rdi
movl $0x0, (%rax)
leaq 0x28(%rsp), %rsi
movq %rax, 0x8(%rsi)
callq 0x142ba
movl 0x5c(%rbx), %eax
movl %eax, 0x4(%rsp)
testl %eax, %eax
leaq 0x1a67c(%rip), %rcx     # 0x2e600
leaq 0x1a685(%rip), %rbp     # 0x2e610
movq %rbp, %rax
cmovgq %rcx, %rax
movq (%rax), %r14
movq 0x1a684(%rip), %rax     # 0x2e620
movq %rax, 0x8(%rsp)
addq %r14, %rax
movl %eax, 0x18(%rbx)
movl %eax, 0x1c(%rbx)
movl %eax, 0x28(%rbx)
movl %eax, 0x38(%rbx)
leaq 0x4(,%rax,4), %rcx
movabsq $0x3fffffffc, %r12      # imm = 0x3FFFFFFFC
andq %rcx, %r12
cmpl $-0x1, %eax
movq $-0x1, %r13
cmovlq %r13, %r12
movq %r12, %rdi
callq 0x7030
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x7200
cmpl $0x0, 0x4(%rsp)
movq %r15, 0x20(%rsp)
leaq 0x1a604(%rip), %rax     # 0x2e600
cmovgq %rax, %rbp
movq 0x8(%rbp), %rsi
leaq (,%r14,4), %rdx
movq %r15, %rdi
callq 0x72b0
leaq (%r15,%r14,4), %rdi
movq 0x1a609(%rip), %rsi     # 0x2e628
movq 0x8(%rsp), %rax
leaq 0x4(,%rax,4), %rdx
callq 0x72b0
cmpl $0x0, 0x4(%r15,%r13,4)
leaq 0x1(%r13), %r13
jne 0x14031
leaq 0x18(%rsp), %rsi
movq %r13, (%rsi)
movq %rbx, %rdi
callq 0x142ba
movq 0x10(%rsp), %rax
movl 0x34(%rax), %eax
movl 0x18(%rbx), %esi
movq $0x0, 0x20(%rbx)
testl %esi, %esi
jle 0x1407e
xorl %ecx, %ecx
cmpl %eax, %esi
movl %eax, %edx
cmovll %esi, %edx
incl %ecx
subl %edx, %esi
jg 0x14066
movl %edx, 0x24(%rbx)
leal -0x1(%rcx), %esi
movl %esi, 0x20(%rbx)
jmp 0x14085
xorl %edx, %edx
movl $0x1, %ecx
cmpl %eax, %edx
jne 0x14093
movl $0x0, 0x24(%rbx)
movl %ecx, 0x20(%rbx)
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x140a2
callq 0x7490
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x140b1
callq 0x7490
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x140d9
callq 0x7490
jmp 0x140d9
jmp 0x140d6
movq %rax, %r14
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x140ed
callq 0x7490
jmp 0x140ed
movq %rax, %r14
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x14100
callq 0x7490
jmp 0x14100
movq %rax, %r14
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x1410e
callq 0x7490
movq %r14, %rdi
callq 0x7630