// File: /workspace/github_cpp_makefile_star2_O1/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 0x14abd
movl %edx, %r13d
movq %rdi, %rbx
movl %ecx, 0xc(%rsp)
movslq %edx, %r14
movq %r14, 0x10(%rsp)
xorl %eax, %eax
movq %rax, 0x18(%rsp)
movq %rsi, (%rsp)
leaq 0x4(,%r14,4), %r15
cmpl $-0x1, %edx
movq $-0x1, %rax
cmovlq %rax, %r15
movq %r15, %rdi
callq 0x7030
movq %rax, %rbp
movq %rax, 0x18(%rsp)
leaq (,%r14,4), %r12
subq %r12, %r15
movl $0x0, %eax
cmovbq %rax, %r15
leaq (,%r14,4), %rdi
addq %rbp, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x7200
movq %rbp, %rdi
movq (%rsp), %rsi
movq %r12, 0x38(%rsp)
movq %r12, %rdx
callq 0x72a0
movl (%rbx), %eax
cmpl $0x1, 0x30(%rbx)
sete %cl
testl %eax, %eax
setg %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x149cc
movsbq 0x8(%rbx), %r15
movq 0x18(%rbx), %r12
shlq $0x4, %r15
movq (%r12,%r15), %rax
movq %rax, 0x30(%rsp)
addl %eax, %r13d
movslq %r13d, %rax
leaq 0x4(,%rax,4), %rbp
movq %rax, 0x40(%rsp)
cmpl $-0x1, %eax
movq $-0x1, %rax
cmovlq %rax, %rbp
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq %rbp, %rdi
callq 0x7030
movq %rax, %r13
addq %r15, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0x7200
movq %r13, 0x28(%rsp)
cmpb $0x0, 0xc(%rsp)
je 0x14a39
movq 0x8(%r12), %rsi
movslq 0x30(%rsp), %r14
leaq (,%r14,4), %rdx
movq %r13, %rdi
callq 0x72a0
leaq (,%r14,4), %rdi
addq %r13, %rdi
movq (%rsp), %rsi
movq 0x38(%rsp), %rdx
jmp 0x14a63
movl %eax, %r14d
cmpl $0x9, %r14d
jg 0x14a04
testl %r14d, %r14d
jle 0x149ea
leaq 0x8(%rbx), %rsi
leaq 0x9(%rbx), %rdi
movq %r14, %rdx
callq 0x75b0
movb %r14b, 0x8(%rbx)
leal 0x1(%r14), %eax
movl %eax, (%rbx)
leaq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0x15080
jmp 0x14a30
movsbq 0x11(%rbx), %r14
movq %r14, %rdi
shlq $0x4, %rdi
addq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0x147da
movb 0x10(%rbx), %al
movb %al, 0x11(%rbx)
movq 0x8(%rbx), %rax
movq %rax, 0x9(%rbx)
movb %r14b, 0x8(%rbx)
movl $0x0, 0x4(%rbx)
jmp 0x14aae
movq %r13, %rdi
movq (%rsp), %rsi
movq 0x38(%rsp), %rdx
callq 0x72a0
leaq (,%r14,4), %rdi
addq %r13, %rdi
movq 0x8(%r12), %rsi
movslq 0x30(%rsp), %rdx
shlq $0x2, %rdx
callq 0x72a0
movq 0x28(%rsp), %rax
movq 0x40(%rsp), %rcx
movl $0x0, (%rax,%rcx,4)
movq $-0x1, %rcx
cmpl $0x0, 0x4(%rax,%rcx,4)
leaq 0x1(%rcx), %rcx
jne 0x14a80
leaq 0x20(%rsp), %rsi
movq %rcx, (%rsi)
addq 0x18(%rbx), %r15
movq %r15, %rdi
callq 0x147da
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x14aae
callq 0x7480
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x14abd
callq 0x7480
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x14ae4
jmp 0x14ae4
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x14ae7
callq 0x7480
jmp 0x14ae7
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x14af6
callq 0x7480
movq %rbx, %rdi
callq 0x7620