// File: /workspace/github_cpp_makefile_star2_O2/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 $0x28, %rsp
testl %edx, %edx
je 0x11f55
movl %ecx, %ebp
movl %edx, %r15d
movq %rdi, %rbx
leaq 0x18(%rsp), %rdi
callq 0x11930
movl (%rbx), %eax
cmpl $0x1, 0x30(%rbx)
sete %cl
testl %eax, %eax
setg %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x11e7f
movsbq 0x8(%rbx), %r14
movq 0x18(%rbx), %rax
shlq $0x4, %r14
movq (%rax,%r14), %r12
leal (%r12,%r15), %esi
incl %esi
leaq 0x8(%rsp), %rdi
callq 0x119cc
leal (%r12,%r15), %r13d
movq 0x10(%rsp), %rdi
testb %bpl, %bpl
je 0x11ee9
movq 0x18(%rbx), %rax
movq 0x8(%rax,%r14), %rsi
movslq %r12d, %r12
shlq $0x2, %r12
movq %r12, %rdx
callq 0x7290
addq 0x10(%rsp), %r12
movq 0x20(%rsp), %rsi
movslq %r15d, %rdx
shlq $0x2, %rdx
movq %r12, %rdi
jmp 0x11f15
movl %eax, %r14d
cmpl $0x9, %r14d
jg 0x11eb7
testl %r14d, %r14d
jle 0x11e9d
leaq 0x8(%rbx), %rsi
leaq 0x9(%rbx), %rdi
movq %r14, %rdx
callq 0x7590
movb %r14b, 0x8(%rbx)
leal 0x1(%r14), %eax
movl %eax, (%rbx)
leaq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %rsi
callq 0x1256c
jmp 0x11ee3
movsbq 0x11(%rbx), %r14
movq %r14, %rdi
shlq $0x4, %rdi
addq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %rsi
callq 0x11d46
movb 0x10(%rbx), %al
movb %al, 0x11(%rbx)
movq 0x8(%rbx), %rax
movq %rax, 0x9(%rbx)
movb %r14b, 0x8(%rbx)
andl $0x0, 0x4(%rbx)
jmp 0x11f4b
movq 0x20(%rsp), %rsi
movslq %r15d, %r15
shlq $0x2, %r15
movq %r15, %rdx
callq 0x7290
addq 0x10(%rsp), %r15
movq 0x18(%rbx), %rax
movq 0x8(%rax,%r14), %rsi
movslq %r12d, %rdx
shlq $0x2, %rdx
movq %r15, %rdi
callq 0x7290
movslq %r13d, %rax
leaq 0x8(%rsp), %r15
movq 0x8(%r15), %rcx
andl $0x0, (%rcx,%rax,4)
movq %r15, %rdi
callq 0x11d30
addq 0x18(%rbx), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x11d46
leaq 0x8(%rsp), %rdi
callq 0x118be
leaq 0x18(%rsp), %rdi
callq 0x118be
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x11f77
jmp 0x11f77
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x118be
jmp 0x11f7a
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x118be
movq %rbx, %rdi
callq 0x7600