// File: 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
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x68(%rbp)
callq 0x245d0
movq -0x68(%rbp), %rdi
addq $0x40, %rdi
movq %rdi, -0x60(%rbp)
callq 0x23b80
jmp 0x240c6
movq -0x68(%rbp), %rax
movl $0x0, 0x58(%rax)
movl -0x14(%rbp), %ecx
movl %ecx, 0x5c(%rax)
movq -0x10(%rbp), %rcx
movl 0x34(%rcx), %ecx
movl %ecx, 0x34(%rax)
movl $0x0, 0x30(%rax)
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x23e40
jmp 0x240f8
movq -0x68(%rbp), %rdi
addq $0x40, %rdi
leaq -0x38(%rbp), %rsi
callq 0x24640
jmp 0x2410b
movq -0x68(%rbp), %rax
movl 0x5c(%rax), %eax
testl %eax, %eax
leaq 0x338f5(%rip), %rcx     # 0x57a10
leaq 0x338fe(%rip), %rax     # 0x57a20
cmovgq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x23df0
movq %rax, -0x48(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x6c(%rbp)
leaq 0x338ec(%rip), %rdi     # 0x57a30
callq 0x23df0
movl -0x6c(%rbp), %ecx
movq %rax, %rdx
movq -0x68(%rbp), %rax
addl %edx, %ecx
movl %ecx, 0x18(%rax)
movl 0x18(%rax), %ecx
movl %ecx, 0x1c(%rax)
movl 0x18(%rax), %ecx
movl %ecx, 0x28(%rax)
movl 0x18(%rax), %ecx
movl %ecx, 0x38(%rax)
movl 0x18(%rax), %esi
incl %esi
leaq -0x58(%rbp), %rdi
callq 0x23e40
jmp 0x2417a
leaq -0x58(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0x23ec0
movq %rax, -0x98(%rbp)
movq -0x40(%rbp), %rdi
callq 0x23ec0
movq -0x98(%rbp), %rdi
movq %rax, %rsi
movq -0x48(%rbp), %rdx
shlq $0x2, %rdx
callq 0x8360
movq -0x78(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x23e10
movq %rax, -0x88(%rbp)
leaq 0x33867(%rip), %rdi     # 0x57a30
movq %rdi, -0x90(%rbp)
callq 0x23ec0
movq -0x90(%rbp), %rdi
movq %rax, -0x80(%rbp)
callq 0x23df0
movq -0x88(%rbp), %rdi
movq -0x80(%rbp), %rsi
leaq 0x4(,%rax,4), %rdx
callq 0x8360
movq -0x78(%rbp), %rdi
callq 0x24600
jmp 0x24208
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x24640
jmp 0x24217
movq -0x68(%rbp), %r9
movq -0x10(%rbp), %rax
movl 0x34(%rax), %edx
movl 0x18(%r9), %ecx
movq %r9, %r8
addq $0x24, %r8
addq $0x20, %r9
xorl %esi, %esi
movl %esi, %edi
callq 0x1d7f0
leaq -0x58(%rbp), %rdi
callq 0x23b50
leaq -0x38(%rbp), %rdi
callq 0x23b50
addq $0xa0, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x242a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x2429d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x24294
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x23b50
leaq -0x38(%rbp), %rdi
callq 0x23b50
movq -0x60(%rbp), %rdi
callq 0x23b50
movq -0x68(%rbp), %rdi
callq 0x24700
movq -0x20(%rbp), %rdi
callq 0x87b0
nopl (%rax,%rax)