// File: /workspace/github_cpp_makefile_star2_O1/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 $0x48, %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)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movl $0x4, %edi
callq 0x7030
movq %r15, 0x40(%rsp)
leaq 0x40(%rbx), %rdi
movl $0x0, (%rax)
leaq 0x20(%rsp), %rsi
movq %rax, 0x8(%rsi)
callq 0x147da
movl 0x5c(%rbx), %eax
movl %eax, 0xc(%rsp)
testl %eax, %eax
leaq 0x1b447(%rip), %rcx     # 0x2f8e0
leaq 0x1b450(%rip), %r13     # 0x2f8f0
movq %r13, %rax
cmovgq %rcx, %rax
movq (%rax), %r14
movq 0x1b44f(%rip), %rax     # 0x2f900
movq %rax, 0x38(%rsp)
addq %r14, %rax
movl %eax, 0x18(%rbx)
movl %eax, 0x1c(%rbx)
movl %eax, 0x28(%rbx)
movl %eax, 0x38(%rbx)
movq %rax, %rcx
shlq $0x20, %rcx
movabsq $0x100000000, %r12      # imm = 0x100000000
addq %rcx, %r12
sarq $0x1e, %r12
cmpl $-0x1, %eax
movq $-0x1, %rbp
cmovlq %rbp, %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq %r12, %rdi
callq 0x7030
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x7200
cmpl $0x0, 0xc(%rsp)
movq %r15, 0x18(%rsp)
leaq 0x1b3c4(%rip), %rax     # 0x2f8e0
cmovgq %rax, %r13
movq 0x8(%r13), %rsi
leaq (,%r14,4), %rdx
movq %r15, %rdi
callq 0x72a0
leaq (%r15,%r14,4), %rdi
movq 0x1b3c9(%rip), %rsi     # 0x2f908
movq 0x38(%rsp), %rax
leaq 0x4(,%rax,4), %rdx
callq 0x72a0
cmpl $0x0, 0x4(%r15,%rbp,4)
leaq 0x1(%rbp), %rbp
jne 0x14551
leaq 0x10(%rsp), %rsi
movq %rbp, (%rsi)
movq %rbx, %rdi
callq 0x147da
movq 0x40(%rsp), %rax
movl 0x34(%rax), %eax
movl 0x18(%rbx), %ecx
movq $0x0, 0x20(%rbx)
testl %ecx, %ecx
jle 0x1459c
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpl %eax, %ecx
movl %eax, %esi
cmovll %ecx, %esi
incl %edx
subl %esi, %ecx
jg 0x14589
movl %esi, 0x24(%rbx)
movl %edx, 0x20(%rbx)
cmpl %eax, 0x24(%rbx)
jne 0x145ab
movl $0x0, 0x24(%rbx)
incl 0x20(%rbx)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x145ba
callq 0x7480
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x145c9
callq 0x7480
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x145f1
callq 0x7480
jmp 0x145f1
jmp 0x145ee
movq %rax, %r14
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x14605
callq 0x7480
jmp 0x14605
movq %rax, %r14
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x14618
callq 0x7480
jmp 0x14618
movq %rax, %r14
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x14626
callq 0x7480
movq %r14, %rdi
callq 0x7620