// File: /workspace/github_c_makefile_star2_O0/wuxb45[P]SLB/lib1.c
// Function: skiplist_del
bool
skiplist_del(struct skiplist * const list, const struct kv * const key)
{
  u64 h = list->height - 1;
  struct skipnode * left = &(list->n0);
  struct skipnode * right = NULL;
  struct skipnode * del = NULL;
  while ((h < 64) && (del == NULL)) {
    while (left->next[h]) {
      right = left->next[h];
      struct kv * const curr = __u64_to_ptr(right->e.ptr);
      debug_assert(curr);
      const int cmp = list->comp(key, curr);
      if (cmp == 0) {
        del = right;
        break;
      } else if (cmp < 0) {
        break;
      } else {
        left = right;
      }
    }
    h--;
  }

  if (del == NULL) {
    return false;
  }
  h++;
  const u64 depth = h+1;
  struct skipnode *path[depth];
  while (h < 64) {
    while (left->next[h] != del) {
      left = left->next[h];
    }
    path[h] = left;
    h--;
  }
  for (u64 i = 0; i < depth; i++) {
    path[i]->next[i] = del->next[i];
  }
  kvmap_put_entry(&(list->mm), &(del->e), NULL);
  free(del);
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x258(%rax), %rax
subq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
addq $0x260, %rax            # imm = 0x260
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
xorl %eax, %eax
cmpq $0x40, -0x20(%rbp)
movb %al, -0x69(%rbp)
jae 0x1243b
cmpq $0x0, -0x38(%rbp)
sete %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0x12447
jmp 0x124de
jmp 0x12449
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq $0x0, 0x8(%rax,%rcx,8)
je 0x124cd
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rdi
shrq $0x10, %rdi
callq 0xf220
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
setne %al
movzbl %al, %edi
andl $0x1, %edi
callq 0x7640
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x18(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq *%rax
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jne 0x124b6
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x124cd
cmpl $0x0, -0x44(%rbp)
jge 0x124be
jmp 0x124cd
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x124c8
jmp 0x12449
movq -0x20(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x12424
cmpq $0x0, -0x38(%rbp)
jne 0x124ee
movb $0x0, -0x1(%rbp)
jmp 0x125e0
movq -0x20(%rbp), %rax
incq %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
incq %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rsp, %rcx
movq %rcx, -0x58(%rbp)
leaq 0xf(,%rax,8), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x78(%rbp)
movq %rcx, %rsp
movq %rax, -0x60(%rbp)
cmpq $0x40, -0x20(%rbp)
jae 0x12579
jmp 0x12535
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
cmpq -0x38(%rbp), %rax
je 0x1255b
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
jmp 0x12535
movq -0x78(%rbp), %rax
movq -0x28(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x20(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1252c
movq $0x0, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0x125bb
movq -0x78(%rbp), %rax
movq -0x38(%rbp), %rcx
movq -0x68(%rbp), %rdx
movq 0x8(%rcx,%rdx,8), %rdx
movq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x68(%rbp), %rcx
movq %rdx, 0x8(%rax,%rcx,8)
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x12581
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x11390
movq -0x38(%rbp), %rdi
callq 0x6060
movb $0x1, -0x1(%rbp)
movq -0x58(%rbp), %rax
movq %rax, %rsp
movb -0x1(%rbp), %al
andb $0x1, %al
movq %rbp, %rsp
popq %rbp
retq
nopw (%rax,%rax)