// File: /workspace/github_cpp_makefile_star2_O2/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
callq 0x11d20
andl $0x0, 0x20(%rbx)
andl $0x0, 0x28(%rbx)
andl $0x0, 0x38(%rbx)
movl %ebp, 0x34(%rbx)
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x1184c
movq 0x10(%rsp), %r15
pushq $0x1
popq %rdi
callq 0x75f0
movl 0x20(%rbx), %ecx
movl 0x34(%rbx), %edx
xorl %r14d, %r14d
movq %r15, %r9
xorl %esi, %esi
movq %r9, %rdi
movq %r15, %r8
movl (%r15), %r9d
cmpl $0xa, %r9d
je 0x12133
testl %r9d, %r9d
je 0x12158
cmpl $0x20, %r9d
setb %r10b
leal -0x7f(%r9), %r11d
cmpl $0x21, %r11d
setb %r11b
orb %r10b, %r11b
je 0x1208e
cmpl $0x1b, %r9d
jne 0x120b1
testl %eax, %eax
je 0x120c0
movl $0x1b, (%rdi)
leaq 0x4(%rdi), %r9
leaq 0x4(%r8), %r15
cmpl $0x5b, 0x4(%r8)
jne 0x12002
movl $0x5b, 0x4(%rdi)
addq $0x8, %rdi
addq $0x8, %r8
movq %r8, %r15
movq %rdi, %r9
movl (%r15), %edi
cmpl $0x3b, %edi
je 0x12081
testl %edi, %edi
je 0x12002
leal -0x30(%rdi), %r8d
cmpl $0x9, %r8d
ja 0x120f7
movl %edi, (%r9)
addq $0x4, %r9
addq $0x4, %r15
jmp 0x1206b
movl %r9d, (%rdi)
addq $0x4, %rdi
addq $0x4, %r8
incl %r14d
incl %esi
movq %r8, %r15
movq %rdi, %r9
cmpl %edx, %esi
jl 0x12002
jmp 0x12144
addq $0x4, %r8
movq %r8, %r15
movq %rdi, %r9
jmp 0x12002
leaq 0x4(%r8), %r15
cmpl $0x5b, 0x4(%r8)
movq %rdi, %r9
jne 0x12002
addq $0x8, %r8
movq %r8, %r15
movl (%r15), %r8d
cmpl $0x3b, %r8d
je 0x120f1
testl %r8d, %r8d
je 0x12114
leal -0x30(%r8), %r9d
cmpl $0x9, %r9d
ja 0x12119
addq $0x4, %r15
jmp 0x120d9
cmpl $0x6d, %edi
jne 0x12002
movl $0x6d, (%r9)
addq $0x4, %r9
addq $0x4, %r15
jmp 0x12002
xorl %r9d, %r9d
jmp 0x12128
xorl %r9d, %r9d
cmpl $0x6d, %r8d
sete %r9b
shll $0x2, %r9d
addq %r9, %r15
movq %rdi, %r9
jmp 0x12002
movl $0xa, (%rdi)
addq $0x4, %rdi
addq $0x4, %r8
incl %r14d
incl %ecx
movl %ecx, 0x20(%rbx)
movl %r14d, 0x28(%rbx)
movq %r8, %r15
movq %rdi, %r9
jmp 0x12000
andl $0x0, (%rdi)
movl %r14d, 0x18(%rbx)
leaq 0x8(%rsp), %rsi
subq 0x8(%rsi), %rdi
shrq $0x2, %rdi
movl %edi, 0x1c(%rbx)
movq %rbx, %rdi
callq 0x11d46
subl 0x28(%rbx), %r14d
movl %r14d, 0x24(%rbx)
movl 0x20(%rbx), %eax
movl %eax, 0x30(%rbx)
leaq 0x8(%rsp), %rdi
callq 0x118be
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x118be
jmp 0x121ac
movq %rax, %r14
movq %rbx, %rdi
callq 0x118be
movq %r14, %rdi
callq 0x7600