// File: /workspace/github_cpp_makefile_star2_O3/andrakis[P]alisp/contrib/linenoise-ng/src/linenoise.cpp
// Function: KillRing::kill(char32_t const*, int, bool)
void kill(const char32_t* text, int textLen, bool forward) {
    if (textLen == 0) {
      return;
    }
    Utf32String killedText(text, textLen);
    if (lastAction == actionKill && size > 0) {
      int slot = indexToSlot[0];
      int currentLen = static_cast<int>(theRing[slot].length());
      int resultLen = currentLen + textLen;
      Utf32String temp(resultLen + 1);
      if (forward) {
        memcpy(temp.get(), theRing[slot].get(), currentLen * sizeof(char32_t));
        memcpy(&temp[currentLen], killedText.get(), textLen * sizeof(char32_t));
      } else {
        memcpy(temp.get(), killedText.get(), textLen * sizeof(char32_t));
        memcpy(&temp[textLen], theRing[slot].get(),
               currentLen * sizeof(char32_t));
      }
      temp[resultLen] = 0;
      temp.initFromBuffer();
      theRing[slot] = temp;
    } else {
      if (size < capacity) {
        if (size > 0) {
          memmove(&indexToSlot[1], &indexToSlot[0], size);
        }
        indexToSlot[0] = size;
        size++;
        theRing.push_back(killedText);
      } else {
        int slot = indexToSlot[capacity - 1];
        theRing[slot] = killedText;
        memmove(&indexToSlot[1], &indexToSlot[0], capacity - 1);
        indexToSlot[0] = slot;
      }
      index = 0;
    }
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
testl %edx, %edx
je 0x14587
movl %edx, %r13d
movq %rsi, %rbx
movq %rdi, %r14
movl %ecx, 0xc(%rsp)
movslq %edx, %r12
movq %r12, 0x18(%rsp)
leal 0x1(%r13), %ebp
shlq $0x2, %rbp
cmpl $-0x1, %edx
movq $-0x1, %rax
cmovlq %rax, %rbp
movq %rbp, %rdi
callq 0x7030
movq %rbx, (%rsp)
movq %rax, %r15
movq %rax, 0x20(%rsp)
leaq (,%r12,4), %rbx
xorl %edx, %edx
subq %rbx, %rbp
cmovaeq %rbp, %rdx
movq %r12, 0x28(%rsp)
leaq (%rax,%r12,4), %rdi
xorl %esi, %esi
callq 0x7200
movq %r15, 0x30(%rsp)
movq %r15, %rdi
movq (%rsp), %rsi
movq %rbx, 0x10(%rsp)
movq %rbx, %rdx
callq 0x72b0
movl (%r14), %eax
cmpl $0x1, 0x30(%r14)
sete %cl
testl %eax, %eax
setg %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x14496
movsbq 0x8(%r14), %r12
movq 0x18(%r14), %r14
shlq $0x4, %r12
movq (%r14,%r12), %r15
leal (%r15,%r13), %ebx
leal (%r15,%r13), %ebp
incl %ebp
shlq $0x2, %rbp
cmpl $-0x1, %ebx
movq $-0x1, %rax
cmovlq %rax, %rbp
movq %rbp, %rdi
callq 0x7030
movq %rax, %r13
addq %r12, %r14
movq %rax, %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0x7200
movq %r13, 0x40(%rsp)
cmpb $0x0, 0xc(%rsp)
movq %r14, %r12
je 0x1450d
movq 0x8(%r12), %rsi
movslq %r15d, %r14
leaq (,%r14,4), %rdx
movq %r13, %rdi
callq 0x72b0
leaq (,%r14,4), %rdi
addq %r13, %rdi
movq (%rsp), %rsi
movq 0x10(%rsp), %rdx
jmp 0x1453a
movl %eax, %ebx
cmpl $0x9, %ebx
jg 0x144cb
testl %ebx, %ebx
jle 0x144b1
leaq 0x8(%r14), %rsi
leaq 0x9(%r14), %rdi
movq %rbx, %rdx
callq 0x75c0
movb %bl, 0x8(%r14)
leal 0x1(%rbx), %eax
movl %eax, (%r14)
leaq 0x18(%r14), %rdi
leaq 0x18(%rsp), %rsi
callq 0x14b8c
jmp 0x144f9
movsbq 0x11(%r14), %rbx
movq %rbx, %rdi
shlq $0x4, %rdi
addq 0x18(%r14), %rdi
leaq 0x18(%rsp), %rsi
callq 0x142ba
movb 0x10(%r14), %al
movb %al, 0x11(%r14)
movq 0x8(%r14), %rax
movq %rax, 0x9(%r14)
movb %bl, 0x8(%r14)
movl $0x0, 0x4(%r14)
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
jne 0x14582
jmp 0x14587
movq %r13, %rdi
movq (%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x72b0
movq 0x28(%rsp), %rax
leaq (,%rax,4), %rdi
addq %r13, %rdi
movq 0x8(%r12), %rsi
movslq %r15d, %rdx
shlq $0x2, %rdx
callq 0x72b0
movslq %ebx, %rax
movl $0x0, (%r13,%rax,4)
movq $-0x1, %rax
cmpl $0x0, 0x4(%r13,%rax,4)
leaq 0x1(%rax), %rax
jne 0x14552
leaq 0x38(%rsp), %rsi
movq %rax, (%rsi)
movq %r12, %rdi
callq 0x142ba
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x1457d
callq 0x7490
movq 0x30(%rsp), %rdi
callq 0x7490
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x145ae
jmp 0x145ae
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x145b1
callq 0x7490
jmp 0x145b1
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x145c0
callq 0x7490
movq %rbx, %rdi
callq 0x7630