// File: 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
movq %rsp, %rbp
subq $0x90, %rsp
movb %cl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
andb $0x1, %al
movb %al, -0x15(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x24780
jmp 0x249f6
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
leaq -0x28(%rbp), %rdi
callq 0x23c90
movq -0x60(%rbp), %rax
cmpl $0x1, 0x30(%rax)
jne 0x24942
movq -0x60(%rbp), %rax
cmpl $0x0, (%rax)
jle 0x24942
movq -0x60(%rbp), %rdi
movsbl 0x8(%rdi), %eax
movl %eax, -0x2c(%rbp)
addq $0x18, %rdi
movslq -0x2c(%rbp), %rsi
callq 0x23dd0
movq %rax, %rdi
callq 0x23df0
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl -0x14(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %esi
incl %esi
leaq -0x48(%rbp), %rdi
callq 0x23e40
jmp 0x247e9
testb $0x1, -0x15(%rbp)
je 0x2486a
leaq -0x48(%rbp), %rdi
callq 0x23ec0
movq -0x60(%rbp), %rdi
movq %rax, -0x70(%rbp)
addq $0x18, %rdi
movslq -0x2c(%rbp), %rsi
callq 0x23dd0
movq %rax, %rdi
callq 0x23ec0
movq -0x70(%rbp), %rdi
movq %rax, %rsi
movslq -0x30(%rbp), %rdx
shlq $0x2, %rdx
callq 0x8360
movslq -0x30(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x23e10
movq %rax, -0x68(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x23ec0
movq -0x68(%rbp), %rdi
movq %rax, %rsi
movslq -0x14(%rbp), %rdx
shlq $0x2, %rdx
callq 0x8360
jmp 0x248d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x249ff
leaq -0x48(%rbp), %rdi
callq 0x23ec0
movq %rax, -0x80(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x23ec0
movq -0x80(%rbp), %rdi
movq %rax, %rsi
movslq -0x14(%rbp), %rdx
shlq $0x2, %rdx
callq 0x8360
movslq -0x14(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x23e10
movq -0x60(%rbp), %rdi
movq %rax, -0x78(%rbp)
addq $0x18, %rdi
movslq -0x2c(%rbp), %rsi
callq 0x23dd0
movq %rax, %rdi
callq 0x23ec0
movq -0x78(%rbp), %rdi
movq %rax, %rsi
movslq -0x30(%rbp), %rdx
shlq $0x2, %rdx
callq 0x8360
movslq -0x34(%rbp), %rsi
leaq -0x48(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0x23e10
movq -0x88(%rbp), %rdi
movl $0x0, (%rax)
callq 0x24600
movq -0x60(%rbp), %rdi
addq $0x18, %rdi
movslq -0x2c(%rbp), %rsi
callq 0x23dd0
movq -0x88(%rbp), %rsi
movq %rax, %rdi
callq 0x24640
jmp 0x2491a
leaq -0x48(%rbp), %rdi
callq 0x23b50
jmp 0x249ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x23b50
jmp 0x249ff
movq -0x60(%rbp), %rax
cmpl $0xa, (%rax)
jge 0x24992
movq -0x60(%rbp), %rax
cmpl $0x0, (%rax)
jle 0x24972
movq -0x60(%rbp), %rax
movq %rax, %rdi
addq $0x8, %rdi
addq $0x1, %rdi
movq %rax, %rsi
addq $0x8, %rsi
movslq (%rax), %rdx
callq 0x8710
movq -0x60(%rbp), %rdi
movb (%rdi), %al
movb %al, 0x8(%rdi)
movl (%rdi), %eax
incl %eax
movl %eax, (%rdi)
addq $0x18, %rdi
leaq -0x28(%rbp), %rsi
callq 0x259f0
jmp 0x24990
jmp 0x249e2
movq -0x60(%rbp), %rdi
movsbl 0x11(%rdi), %eax
movl %eax, -0x58(%rbp)
addq $0x18, %rdi
movslq -0x58(%rbp), %rsi
callq 0x23dd0
movq %rax, %rdi
leaq -0x28(%rbp), %rsi
callq 0x24640
jmp 0x249b8
movq -0x60(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
addq $0x1, %rcx
movq %rax, %rsi
addq $0x8, %rsi
movq (%rsi), %rdx
movb 0x8(%rsi), %sil
movb %sil, 0x8(%rcx)
movq %rdx, (%rcx)
movl -0x58(%rbp), %ecx
movb %cl, 0x8(%rax)
movq -0x60(%rbp), %rax
movl $0x0, 0x4(%rax)
leaq -0x28(%rbp), %rdi
callq 0x23b50
addq $0x90, %rsp
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x23b50
movq -0x50(%rbp), %rdi
callq 0x87b0
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)