// File: /workspace/github_cpp_makefile_star2_O1/andrakis[P]alisp/contrib/linenoise-ng/src/linenoise.cpp
// Function: PromptInfo::PromptInfo(char const*, int)
PromptInfo(const char* textPtr, int columns) {
    promptExtraLines = 0;
    promptLastLinePosition = 0;
    promptPreviousLen = 0;
    promptScreenColumns = columns;
    Utf32String tempUnicode(textPtr);

    // strip control characters from the prompt -- we do allow newline
    char32_t* pIn = tempUnicode.get();
    char32_t* pOut = pIn;

    int len = 0;
    int x = 0;

    bool const strip = (isatty(1) == 0);

    while (*pIn) {
      char32_t c = *pIn;
      if ('\n' == c || !isControlChar(c)) {
        *pOut = c;
        ++pOut;
        ++pIn;
        ++len;
        if ('\n' == c || ++x >= promptScreenColumns) {
          x = 0;
          ++promptExtraLines;
          promptLastLinePosition = len;
        }
      } else if (c == '\x1b') {
        if (strip) {
          // jump over control chars
          ++pIn;
          if (*pIn == '[') {
            ++pIn;
            while (*pIn && ((*pIn == ';') || ((*pIn >= '0' && *pIn <= '9')))) {
              ++pIn;
            }
            if (*pIn == 'm') {
              ++pIn;
            }
          }
        } else {
          // copy control chars
          *pOut = *pIn;
          ++pOut;
          ++pIn;
          if (*pIn == '[') {
            *pOut = *pIn;
            ++pOut;
            ++pIn;
            while (*pIn && ((*pIn == ';') || ((*pIn >= '0' && *pIn <= '9')))) {
              *pOut = *pIn;
              ++pOut;
              ++pIn;
            }
            if (*pIn == 'm') {
              *pOut = *pIn;
              ++pOut;
              ++pIn;
            }
          }
        }
      } else {
        ++pIn;
      }
    }
    *pOut = 0;
    promptChars = len;
    promptBytes = static_cast<int>(pOut - tempUnicode.get());
    promptText = tempUnicode;

    promptIndentation = len - promptLastLinePosition;
    promptCursorRowOffset = promptExtraLines;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movl $0x4, %edi
callq 0x7030
xorl %r15d, %r15d
movl %r15d, (%rax)
movq %rax, 0x8(%rbx)
movl %r15d, 0x20(%rbx)
movq $0x0, 0x28(%rbx)
movl %r15d, 0x38(%rbx)
movl %ebp, 0x34(%rbx)
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x142cc
movq 0x10(%rsp), %r14
movl $0x1, %edi
callq 0x7610
movl (%r14), %r9d
testl %r9d, %r9d
je 0x14c7c
movl 0x20(%rbx), %ecx
movl 0x34(%rbx), %edx
xorl %edi, %edi
xorl %r15d, %r15d
movq %r14, %rsi
cmpl $0xa, %r9d
je 0x14be9
cmpl $0x20, %r9d
setb %r8b
leal -0x7f(%r9), %r10d
cmpl $0x21, %r10d
setb %r10b
orb %r8b, %r10b
je 0x14be9
cmpl $0x1b, %r9d
jne 0x14c3c
testl %eax, %eax
je 0x14c10
movl %r9d, (%r14)
cmpl $0x5b, 0x4(%rsi)
jne 0x14c38
movl $0x5b, 0x4(%r14)
addq $0x8, %r14
addq $0x8, %rsi
movq %r14, %r8
movl (%rsi), %r9d
cmpl $0x3b, %r9d
je 0x14bdc
testl %r9d, %r9d
je 0x14c43
leal -0x30(%r9), %r10d
cmpl $0x9, %r10d
ja 0x14c65
movl %r9d, (%r8)
addq $0x4, %r8
addq $0x4, %rsi
jmp 0x14bc0
leaq 0x4(%r14), %r8
addq $0x4, %rsi
incl %r15d
movl %r9d, (%r14)
cmpl $0xa, %r9d
je 0x14c03
incl %edi
cmpl %edx, %edi
jl 0x14c43
incl %ecx
movl %ecx, 0x20(%rbx)
movl %r15d, 0x28(%rbx)
xorl %edi, %edi
jmp 0x14c43
cmpl $0x5b, 0x4(%rsi)
jne 0x14c3c
addq $0x8, %rsi
movl (%rsi), %r8d
cmpl $0x3b, %r8d
je 0x14c32
testl %r8d, %r8d
je 0x14c54
leal -0x30(%r8), %r9d
cmpl $0x9, %r9d
ja 0x14c54
addq $0x4, %rsi
jmp 0x14c1a
addq $0x4, %r14
addq $0x4, %rsi
movq %r14, %r8
movl (%rsi), %r9d
movq %r8, %r14
testl %r9d, %r9d
jne 0x14b73
jmp 0x14c7f
xorl %r9d, %r9d
cmpl $0x6d, %r8d
sete %r9b
leaq (%rsi,%r9,4), %rsi
jmp 0x14c40
cmpl $0x6d, %r9d
jne 0x14c43
movl $0x6d, (%r8)
addq $0x4, %r8
addq $0x4, %rsi
jmp 0x14c43
movq %r14, %r8
movl $0x0, (%r8)
movl %r15d, 0x18(%rbx)
leaq 0x8(%rsp), %rsi
subq 0x8(%rsi), %r8
shrq $0x2, %r8
movl %r8d, 0x1c(%rbx)
movq %rbx, %rdi
callq 0x147da
subl 0x28(%rbx), %r15d
movl %r15d, 0x24(%rbx)
movl 0x20(%rbx), %eax
movl %eax, 0x30(%rbx)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x14cc0
callq 0x7480
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x14ce2
callq 0x7480
jmp 0x14ce2
movq %rax, %r14
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x14cf0
callq 0x7480
movq %r14, %rdi
callq 0x7620