LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: cuckoo_del
bool
cuckoo_del(struct cuckoo * const map, const struct kv * const key)
{
  const u64 hash2[2] = {cuckoo_hash(key, 0), cuckoo_hash(key, 1), };
  const u64 pkey = kvmap_pkey(key->hash);

  cuckoo_lock_two(map, key);
  for (u64 x = 0; x < 2; x++) {
    struct __kvmap_slot * const slot = cuckoo_hash_slot(map, hash2[x]);
    for (u64 k = 0; k < 8; k++) {
      if (slot->e[k].pkey == pkey) {
        const struct kv * const curr = __u64_to_ptr(slot->e[k].ptr);
        if (kv_keymatch(key, curr)) {
          kvmap_put_entry(&(map->mm), &(slot->e[k]), NULL);
          cuckoo_unlock_two(map, key);
          return true;
        }
      }
    }
  }
  cuckoo_unlock_two(map, key);
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r15
movq (%rsi), %rax
movq %rax, -0x60(%rbp)
rorxq $0x2d, %rax, %rcx
movq %rcx, -0x58(%rbp)
movq %rax, %rcx
shrq $0x20, %rcx
xorq %rax, %rcx
movq %rcx, %r14
shrq $0x10, %r14
xorq %rcx, %r14
callq 0xe0a9
movq %r15, %rdi
leaq 0x10118(%r15), %rax
movq %rax, -0x40(%rbp)
leaq 0x10(%rbx), %rax
movq %rax, -0x48(%rbp)
movb $0x1, %r15b
xorl %eax, %eax
movq %rdi, -0x38(%rbp)
movb %r15b, -0x29(%rbp)
movq %rax, -0x50(%rbp)
movq -0x60(%rbp,%rax,8), %r15
movq 0x100d8(%rdi), %rax
testq %rax, %rax
je 0xe762
movq %r15, %rcx
shrq $0x6, %rcx
movl %ecx, %edx
andl $0x3ff, %edx            # imm = 0x3FF
cmpq %rdx, (%rax)
jbe 0xe762
shrl $0x6, %edx
shrxq %rcx, 0x10(%rax,%rdx,8), %rax
andl $0x1, %eax
jmp 0xe764
xorl %eax, %eax
leaq (%rax,%rax,2), %r13
movq -0x40(%rbp), %rax
movq 0x10(%rax,%r13,8), %r12
cmpq $0x0, (%rax,%r13,8)
je 0xe7ec
leaq (%rax,%r13,8), %rax
bzhiq %r12, %r15, %r12
shlq $0x6, %r12
addq (%rax), %r12
xorl %r15d, %r15d
movq (%r12,%r15,8), %r13
movl %r14d, %eax
xorw %r13w, %ax
jne 0xe7c8
cmpq $0x10000, %r13          # imm = 0x10000
jb 0xe7c8
shrq $0x10, %r13
movq (%rbx), %rax
cmpq (%r13), %rax
jne 0xe7c8
movl 0x8(%rbx), %edx
cmpl 0x8(%r13), %edx
jne 0xe7c8
leaq 0x10(%r13), %rsi
movq -0x48(%rbp), %rdi
callq 0x63d0
testl %eax, %eax
je 0xe7f7
incq %r15
cmpq $0x8, %r15
jne 0xe78b
movq -0x50(%rbp), %rcx
leaq 0x1(%rcx), %rax
testq %rcx, %rcx
sete %r15b
movq -0x38(%rbp), %rdi
je 0xe726
jmp 0xe81d
callq 0x66ef
movq -0x40(%rbp), %rax
jmp 0xe778
movq -0x38(%rbp), %rdi
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0xe811
movq 0x18(%rdi), %rsi
movq %r13, %rdi
callq *%rax
movq -0x38(%rbp), %rdi
movq $0x0, (%r12,%r15,8)
movb -0x29(%rbp), %r15b
movq %rbx, %rsi
callq 0xe140
andb $0x1, %r15b
movl %r15d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: cuckoo_clean
void
cuckoo_clean(struct cuckoo * const map)
{
  mutexlock_lock(&(map->expand_lock));
  for (u64 i = 0; i < KVMAP_HLOCK_NR; i++) {
    spinlock_lock(&(map->hlocks[i]));
  }
  for (u64 x = 0; x < 2; x++) {
    if (map->levels[x].table == NULL) continue;
    const u64 nr_slots = UINT64_C(1) << map->levels[x].power;
    for (u64 j = 0; j < nr_slots; j++) {
      struct __kvmap_slot * const slot = &(map->levels[x].table[j]);
      for (u64 k = 0; k < 8; k++) {
        if (slot->e[k].ptr) {
          kvmap_put_entry(&(map->mm), &(slot->e[k]), NULL);
        }
      }
    }
    pages_unmap(map->levels[x].table, map->levels[x].alloc_size);
    map->levels[x].table = NULL;
  }
  cuckoo_init(map);
  for (u64 i = 0; i < KVMAP_HLOCK_NR; i++) {
    spinlock_unlock(&(map->hlocks[i]));
  }
  mutexlock_unlock(&(map->expand_lock));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
leaq 0x10050(%rdi), %rbx
movq %rbx, %rdi
callq 0x65f0
cmpl $0xb, %eax
je 0xe856
movq %rbx, -0x38(%rbp)
testl %eax, %eax
jne 0xe993
movl $0x50, %ebx
leaq (%r14,%rbx), %rdi
callq 0x6050
cmpl $0x23, %eax
je 0xe993
addq $0x40, %rbx
cmpq $0x10050, %rbx          # imm = 0x10050
jne 0xe874
leaq 0x10118(%r14), %rcx
xorl %edx, %edx
movq %rcx, -0x40(%rbp)
leaq (%rdx,%rdx,2), %rax
cmpq $0x0, (%rcx,%rax,8)
je 0xe93b
movq %rdx, -0x48(%rbp)
leaq (%rcx,%rax,8), %rax
movq %rax, -0x30(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
xorl %r15d, %r15d
xorl %r12d, %r12d
movq -0x30(%rbp), %rax
movq (%rax), %rbx
addq %r15, %rbx
xorl %r13d, %r13d
movq (%rbx,%r13,8), %rdi
cmpq $0x10000, %rdi          # imm = 0x10000
jb 0xe8fe
movq 0x10(%r14), %rax
testq %rax, %rax
je 0xe8f6
shrq $0x10, %rdi
movq 0x18(%r14), %rsi
callq *%rax
movq $0x0, (%rbx,%r13,8)
incq %r13
cmpq $0x8, %r13
jne 0xe8d6
incq %r12
movq -0x50(%rbp), %rax
shrxq %rax, %r12, %rax
addq $0x40, %r15
testq %rax, %rax
je 0xe8c9
movq -0x30(%rbp), %rbx
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x6410
movq $0x0, (%rbx)
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rdx
leaq 0x1(%rdx), %rax
testq %rdx, %rdx
movq %rax, %rdx
je 0xe8a0
movq %r14, %rdi
callq 0xddb5
addq $0x50, %r14
xorl %ebx, %ebx
leaq (%r14,%rbx), %rdi
callq 0x6320
addq $0x40, %rbx
cmpq $0x10000, %rbx          # imm = 0x10000
jne 0xe959
movq -0x38(%rbp), %rbx
movq %rbx, %rdi
callq 0x6390
cmpl $0xb, %eax
je 0xe973
testl %eax, %eax
jne 0xe993
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
callq 0x6530
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: cuckoo_destroy
void
cuckoo_destroy(struct cuckoo * const map)
{
  cuckoo_clean(map);
  for (u64 x = 0; x < 2; x++) {
    if (map->levels[x].table) {
      pages_unmap(map->levels[x].table, map->levels[x].alloc_size);
    }
  }
  free(map->bm);
  free(map);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0xe83b
movl $0x10120, %r14d         # imm = 0x10120
movq -0x8(%rbx,%r14), %rdi
testq %rdi, %rdi
je 0xe9c2
movq (%rbx,%r14), %rsi
callq 0x6410
addq $0x18, %r14
cmpq $0x10138, %r14          # imm = 0x10138
je 0xe9af
movq 0x100d8(%rbx), %rdi
callq 0x6060
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x6060
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: cuckoo_fprint
void
cuckoo_fprint(struct cuckoo * const map, FILE * const out)
{
  mutexlock_lock(&(map->expand_lock));
  for (u64 x = 0; x < 2; x++) {
    if (map->levels[x].table == NULL) continue;
    const u64 power = map->levels[x].power;
    const u64 nr_slots = KVMAP_SLOTS_OF(power);
    const u64 nr_entries = nr_slots * 8;
    fprintf(out, "CUCKOO POWER %"PRIu64" ENTRY %"PRIu64"\n", power, nr_entries);
  }
  mutexlock_unlock(&(map->expand_lock));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
leaq 0x10050(%rdi), %rbx
movq %rbx, %rdi
callq 0x65f0
cmpl $0xb, %eax
je 0xea02
testl %eax, %eax
jne 0xea71
movq $-0x18, %r13
leaq 0x6b03(%rip), %r12      # 0x15524
cmpq $0x0, 0x10130(%r15,%r13)
je 0xea4b
movq 0x10140(%r15,%r13), %rdx
movl $0x8, %eax
shlxq %rdx, %rax, %rcx
movq %r14, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x6300
addq $0x18, %r13
je 0xea21
movq %rbx, %rdi
callq 0x6390
cmpl $0xb, %eax
je 0xea51
testl %eax, %eax
jne 0xea71
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
callq 0x6530
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: cuckoo_iter_create
struct cuckoo_iter *
cuckoo_iter_create(struct cuckoo * const map)
{
  struct cuckoo_iter * const iter = (typeof(iter))malloc(sizeof(*iter));
  if (iter == NULL) {
    return NULL;
  }
  mutexlock_lock(&(map->expand_lock));
  for (u64 i = 0; i < KVMAP_HLOCK_NR; i++) {
    spinlock_lock(&(map->hlocks[i]));
  }
  iter->map = map;
  iter->level = map->levels[0].table ? &map->levels[0] : &map->levels[1];
  iter->j = 0;
  iter->k = 0;
  return iter;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x20, %edi
callq 0x63a0
testq %rax, %rax
je 0xeafc
movq %rax, %rbx
leaq 0x10050(%r14), %r15
movq %r15, %rdi
callq 0x65f0
cmpl $0xb, %eax
je 0xea9e
testl %eax, %eax
jne 0xeb0c
movl $0x50, %r15d
leaq (%r14,%r15), %rdi
callq 0x6050
cmpl $0x23, %eax
je 0xeb0c
addq $0x40, %r15
cmpq $0x10050, %r15          # imm = 0x10050
jne 0xeab5
movq %r14, (%rbx)
leaq 0x10118(%r14), %rax
cmpq $0x0, 0x10118(%r14)
leaq 0x10130(%r14), %rcx
cmoveq %rcx, %rax
movq %rax, 0x8(%rbx)
vxorps %xmm0, %xmm0, %xmm0
vmovups %xmm0, 0x10(%rbx)
jmp 0xeafe
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
callq 0x6530
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: cuckoo_iter_next
struct kv *
cuckoo_iter_next(struct cuckoo_iter * const iter, struct kv * const out)
{
  u64 j = iter->j;
  u64 k = iter->k;
  struct __cuckoo_level * const level= iter->level;

  const u64 nr = KVMAP_SLOTS_OF(level->power);
  if (j >= nr) return NULL;
  while ((j < nr) && (level->table[j].e[k].ptr == 0)) {
    k++;
    if (k == 8) {
      j++;
      k = 0;
    }
  }
  struct kv * ret = NULL;
  if (j < nr) {
    struct kv * kv = __u64_to_ptr(level->table[j].e[k].ptr);
    ret = kv_dup2(kv, out);
    k++;
    if (k == 8) {
      k = 0;
      j++;
    }
  }
  iter->j = j;
  iter->k = k;
  return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %r13
movb 0x10(%rax), %cl
movl $0x1, %edx
shlxq %rcx, %rdx, %rcx
cmpq %rcx, %r13
jae 0xeb7c
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %r12
movq (%rax), %rdx
xorl %eax, %eax
movq %r13, %rsi
shlq $0x6, %rsi
addq %rdx, %rsi
movq (%rsi,%r12,8), %r15
cmpq $0xffff, %r15           # imm = 0xFFFF
ja 0xeb80
incq %r12
xorl %esi, %esi
cmpq $0x8, %r12
sete %sil
cmoveq %rax, %r12
addq %rsi, %r13
cmpq %rcx, %r13
jb 0xeb4a
jmp 0xebd2
xorl %eax, %eax
jmp 0xebda
shrq $0x10, %r15
movl 0x8(%r15), %eax
movl 0xc(%r15), %ecx
leaq (%rax,%rcx), %rdx
addq $0x10, %rdx
testq %r14, %r14
jne 0xebaf
movq %rdx, %rdi
movq %rdx, %r14
callq 0x63a0
movq %r14, %rdx
movq %rax, %r14
testq %rax, %rax
je 0xebba
movq %r14, %rdi
movq %r15, %rsi
callq 0x6340
incq %r12
xorl %eax, %eax
xorl %ecx, %ecx
cmpq $0x8, %r12
sete %cl
cmoveq %rax, %r12
addq %rcx, %r13
movq %r14, %rax
movq %r13, 0x10(%rbx)
movq %r12, 0x18(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: cuckoo_iter_destroy
void
cuckoo_iter_destroy(struct cuckoo_iter * const iter)
{
  struct cuckoo * const map = iter->map;
  for (u64 i = 0; i < KVMAP_HLOCK_NR; i++) {
    spinlock_unlock(&(map->hlocks[i]));
  }
  mutexlock_unlock(&(map->expand_lock));
  free(iter);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
leaq 0x50(%r14), %r15
xorl %r12d, %r12d
leaq (%r15,%r12), %rdi
callq 0x6320
addq $0x40, %r12
cmpq $0x10000, %r12          # imm = 0x10000
jne 0xec01
addq $0x10050, %r14          # imm = 0x10050
movq %r14, %rdi
callq 0x6390
cmpl $0xb, %eax
je 0xec1e
testl %eax, %eax
jne 0xec3f
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x6060
xorl %edi, %edi
callq 0x6530
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: skiplist_create_f
struct skiplist *
skiplist_create_f(const struct kvmap_mm * const mm, kv_compare_func comp)
{
  struct skiplist * const head = (typeof(head))malloc(sizeof(*head));
  memset(head, 0, sizeof(*head));
  head->mm = mm ? (*mm) : __kvmap_mm_default;
  head->comp = comp;
  head->height = 1;
  head->factors[0] = 1.0;
  const double factor = 0.25;
  const double mul = fabs(factor) > 0.5 ? 0.5 : fabs(factor);
  for (u64 i = 1; i < 64; i++) {
    head->factors[i] = head->factors[i-1] * mul;
  }
  return head;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
movl $0x468, %edi            # imm = 0x468
callq 0x63a0
movq %rax, %rbx
movl $0x468, %edx            # imm = 0x468
movq %rax, %rdi
xorl %esi, %esi
callq 0x6210
testq %r15, %r15
je 0xed2b
vmovups (%r15), %ymm0
vmovups 0x20(%r15), %ymm1
vmovups 0x30(%r15), %ymm2
vmovups %ymm2, 0x30(%rbx)
vmovups %ymm1, 0x20(%rbx)
jmp 0xed4d
vmovups 0xd085(%rip), %ymm0     # 0x1bdb8
vmovups %ymm0, 0x30(%rbx)
vmovups 0xd068(%rip), %ymm0     # 0x1bda8
vmovups %ymm0, 0x20(%rbx)
vmovups 0xd03b(%rip), %ymm0     # 0x1bd88
vmovups %ymm0, (%rbx)
movq %r14, 0x50(%rbx)
movq $0x1, 0x258(%rbx)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x58(%rbx)
vmovsd 0x6302(%rip), %xmm0     # 0x15078
movl $0xc, %eax
vmovsd 0x6335(%rip), %xmm1     # 0x150b8
vmulsd %xmm1, %xmm0, %xmm0
vmovsd %xmm0, (%rbx,%rax,8)
incq %rax
cmpq $0x4b, %rax
jne 0xed83
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
vzeroupper
retq
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: skiplist_probe
bool
skiplist_probe(struct skiplist * const list, const struct kv * const key)
{
  u64 h = list->height - 1;
  struct skipnode * left = &(list->n0);
  struct skipnode * right = NULL;
  while (h) {
    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) {
        if (list->mm.hf) list->mm.hf(curr, list->mm.hp);
        return true;
      } else if (cmp < 0) {
        break;
      } else {
        left = right;
      }
    }
    h--;
  }
  const u64 pkey = kvmap_pkey(key->hash);
  if (left) left = left->next[0];
  while (left && (left != right)) {
    struct kv * const curr = __u64_to_ptr(left->e.ptr);
    if (kvmap_pkey(curr->hash) == pkey) {
      if (kv_keymatch(curr, key)) {
        if (list->mm.hf) list->mm.hf(curr, list->mm.hp);
        return true;
      }
    }
    left = left->next[0];
  }
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, -0x30(%rbp)
movq 0x258(%rdi), %r14
leaq 0x260(%rdi), %r13
decq %r14
movq %rdi, -0x38(%rbp)
je 0xf0fd
movq %rdi, %rbx
movq $0x0, -0x40(%rbp)
movq 0x8(%r13,%r14,8), %rax
testq %rax, %rax
je 0xf0f2
movq %rax, -0x40(%rbp)
movq (%rax), %r12
cmpq $0xffff, %r12           # imm = 0xFFFF
jbe 0xf0d9
shrq $0x10, %r12
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq *0x50(%rbx)
testl %eax, %eax
je 0xf0ac
movl %eax, %r15d
js 0xf0a2
movq -0x40(%rbp), %r13
sarl $0x1f, %r15d
andl $0x5, %r15d
jmp 0xf0c4
movq 0x20(%rbx), %rax
movl $0x1, %r15d
testq %rax, %rax
je 0xf0c4
movq 0x28(%rbx), %rsi
movq %r12, %rdi
callq *%rax
testl %r15d, %r15d
jne 0xf0e4
movq 0x8(%r13,%r14,8), %rax
testq %rax, %rax
movq -0x38(%rbp), %rbx
jne 0xf077
jmp 0xf0f2
callq 0x66ef
movq -0x38(%rbp), %rbx
jmp 0xf087
cmpl $0x5, %r15d
movq -0x38(%rbp), %rbx
jne 0xf1b0
decq %r14
jne 0xf06d
jmp 0xf105
movq $0x0, -0x40(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, %r14
shrq $0x20, %r14
xorq %rax, %r14
testq %r13, %r13
je 0xf121
movq 0x8(%r13), %rbx
jmp 0xf123
xorl %ebx, %ebx
movq -0x30(%rbp), %rax
leaq 0x10(%rax), %r15
testq %rbx, %rbx
setne %cl
cmpq -0x40(%rbp), %rbx
setne %al
andb %cl, %al
cmpb $0x1, %al
jne 0xf1b2
movq (%rbx), %r12
shrq $0x10, %r12
movq (%r12), %rax
movq %rax, %rcx
shrq $0x20, %rcx
xorl %eax, %ecx
movl %ecx, %edx
xorl %r14d, %edx
shrl $0x10, %edx
xorl %r14d, %edx
xorw %cx, %dx
jne 0xf18a
movq -0x30(%rbp), %rcx
cmpq (%rcx), %rax
jne 0xf18a
movl 0x8(%r12), %edx
movq -0x30(%rbp), %rax
cmpl 0x8(%rax), %edx
jne 0xf18a
leaq 0x10(%r12), %rdi
movq %r15, %rsi
callq 0x63d0
testl %eax, %eax
je 0xf196
movq 0x8(%rbx), %rbx
movb $0x1, %al
testb %al, %al
jne 0xf12b
jmp 0xf1b0
movq -0x38(%rbp), %rcx
movq 0x20(%rcx), %rax
testq %rax, %rax
je 0xf1ac
movq 0x28(%rcx), %rsi
movq %r12, %rdi
callq *%rax
xorl %eax, %eax
jmp 0xf190
movb $0x1, %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, -0x38(%rbp)
movq 0x258(%rdi), %rbx
movq %rdi, -0x30(%rbp)
leaq 0x260(%rdi), %r13
leaq -0x1(%rbx), %rax
cmpq $0x3f, %rax
ja 0xf51c
movq %rax, %rbx
xorl %r14d, %r14d
movq 0x8(%r13,%rbx,8), %r12
testq %r12, %r12
je 0xf504
movq (%r12), %r15
cmpq $0xffff, %r15           # imm = 0xFFFF
jbe 0xf4fd
shrq $0x10, %r15
movq -0x38(%rbp), %rdi
movq %r15, %rsi
movq -0x30(%rbp), %rax
callq *0x50(%rax)
testl %eax, %eax
cmoveq %r12, %r14
cmovgq %r12, %r13
jg 0xf4c6
jmp 0xf504
callq 0x66ef
jmp 0xf4dd
leaq -0x1(%rbx), %rax
testq %r14, %r14
sete %r15b
cmpq $0x3f, %rax
ja 0xf522
testq %r14, %r14
je 0xf4c0
jmp 0xf522
movb $0x1, %r15b
xorl %r14d, %r14d
testb %r15b, %r15b
jne 0xf5c0
movq %rsp, %r12
leaq 0x1(%rbx), %rax
movq %rsp, %rcx
leaq 0x17(,%rbx,8), %rdx
andq $-0x10, %rdx
subq %rdx, %rcx
movq %rcx, %rsp
cmpq $0x3f, %rbx
ja 0xf56a
movq %r13, %rdx
movq %rdx, %r13
movq 0x8(%rdx,%rbx,8), %rdx
cmpq %r14, %rdx
jne 0xf550
movq %r13, (%rcx,%rbx,8)
decq %rbx
cmpq $0x40, %rbx
jb 0xf54d
testq %rax, %rax
je 0xf587
xorl %edx, %edx
movq 0x8(%r14,%rdx,8), %rsi
movq (%rcx,%rdx,8), %rdi
movq %rsi, 0x8(%rdi,%rdx,8)
incq %rdx
cmpq %rdx, %rax
jne 0xf571
movq (%r14), %rdi
cmpq $0x10000, %rdi          # imm = 0x10000
jb 0xf5ae
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
testq %rax, %rax
je 0xf5ae
shrq $0x10, %rdi
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rsi
callq *%rax
movq $0x0, (%r14)
movq %r14, %rdi
callq 0x6060
movq %r12, %rsp
xorb $0x1, %r15b
movl %r15d, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: skiplist_clean
void
skiplist_clean(struct skiplist * const list)
{
  struct skipnode * iter = list->n0.next[0];
  while (iter) {
    struct skipnode * const next = iter->next[0];
    kvmap_put_entry(&(list->mm), &(iter->e), NULL);
    free(iter);
    iter = next;
  }
  for (u64 i = 0; i < 64; i++) {
    list->n0.next[i] = NULL;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x268(%rdi), %rbx
movq 0x268(%rdi), %r12
testq %r12, %r12
je 0xf633
movq %rdi, %r14
movq %r12, %r15
movq (%r12), %rdi
movq 0x8(%r12), %r12
cmpq $0x10000, %rdi          # imm = 0x10000
jb 0xf61f
movq 0x10(%r14), %rax
testq %rax, %rax
je 0xf61f
shrq $0x10, %rdi
movq 0x18(%r14), %rsi
callq *%rax
movq $0x0, (%r15)
movq %r15, %rdi
callq 0x6060
testq %r12, %r12
jne 0xf5f7
movl $0x200, %edx            # imm = 0x200
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x6210
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: skiplist_fprint
void
skiplist_fprint(struct skiplist * const list, FILE * const out)
{
  struct skipnode * iter = list->n0.next[0];
  u64 count = 0;
  while (iter) {
    count++;
    iter = iter->next[0];
  }
  fprintf(out, "%s count %"PRIu64" height %"PRIu64"\n", __func__, count, list->height);
}

// Assembly:
movq %rsi, %rax
movq 0x268(%rdi), %rdx
testq %rdx, %rdx
je 0xf68a
pushq %rbp
movq %rsp, %rbp
xorl %ecx, %ecx
incq %rcx
movq 0x8(%rdx), %rdx
testq %rdx, %rdx
jne 0xf67b
popq %rbp
jmp 0xf68c
xorl %ecx, %ecx
movq 0x258(%rdi), %r8
leaq 0x5ea6(%rip), %rsi      # 0x15540
leaq 0x5eb8(%rip), %rdx      # 0x15559
movq %rax, %rdi
xorl %eax, %eax
jmp 0x6300
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: skiplist_head
struct kv *
skiplist_head(struct skiplist * const list, struct kv * const out)
{
  if (list->n0.next[0] == NULL) return NULL;
  struct kv * const curr = __u64_to_ptr(list->n0.next[0]->e.ptr);
  struct kv * const ret = kv_dup2(curr, out);
  return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0x268(%rdi), %rax
testq %rax, %rax
je 0xf6ca
movq (%rax), %rbx
cmpq $0x10000, %rbx          # imm = 0x10000
jae 0xf6d4
xorl %esi, %esi
movq %rsi, %rax
popq %rbx
popq %r14
popq %rbp
retq
shrq $0x10, %rbx
movl 0x8(%rbx), %eax
movl 0xc(%rbx), %ecx
leaq (%rax,%rcx), %r14
addq $0x10, %r14
testq %rsi, %rsi
jne 0xf6fb
movq %r14, %rdi
callq 0x63a0
movq %rax, %rsi
testq %rax, %rax
je 0xf6cc
movq %rsi, %rdi
movq %rbx, %rsi
movq %r14, %rdx
popq %rbx
popq %r14
popq %rbp
jmp 0x6340
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: skiplist_tail
struct kv *
skiplist_tail(struct skiplist * const list, struct kv * const out)
{
  if (list->n0.next[0] == NULL) return NULL;
  u64 i = list->height - 1;
  struct skipnode * iter = &(list->n0);
  while (i) {
    while (iter->next[i]) iter = iter->next[i];
    i--;
  }
  while (iter->next[0]) iter = iter->next[0];
  struct kv * const curr = __u64_to_ptr(iter->e.ptr);
  struct kv * const ret = kv_dup2(curr, out);
  return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
cmpq $0x0, 0x268(%rdi)
je 0xf75b
movq 0x258(%rdi), %rax
addq $0x260, %rdi            # imm = 0x260
decq %rax
je 0xf743
movq %rdi, %rcx
movq %rcx, %rdi
movq 0x8(%rcx,%rax,8), %rcx
testq %rcx, %rcx
jne 0xf734
jmp 0xf72c
movq %rdi, %rax
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
jne 0xf743
movq (%rax), %rbx
cmpq $0x10000, %rbx          # imm = 0x10000
jae 0xf765
xorl %esi, %esi
movq %rsi, %rax
popq %rbx
popq %r14
popq %rbp
retq
shrq $0x10, %rbx
movl 0x8(%rbx), %eax
movl 0xc(%rbx), %ecx
leaq (%rax,%rcx), %r14
addq $0x10, %r14
testq %rsi, %rsi
jne 0xf78c
movq %r14, %rdi
callq 0x63a0
movq %rax, %rsi
testq %rax, %rax
je 0xf75d
movq %rsi, %rdi
movq %rbx, %rsi
movq %r14, %rdx
popq %rbx
popq %r14
popq %rbp
jmp 0x6340
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: skiplist_iter_create
struct skiplist_iter *
skiplist_iter_create(struct skiplist * const list)
{
  struct skiplist_iter * const iter = malloc(sizeof(*iter));
  iter->iter = list->n0.next[0];
  iter->list = list;
  return iter;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x10, %edi
callq 0x63a0
movq 0x268(%rbx), %rcx
movq %rcx, (%rax)
movq %rbx, 0x8(%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: skiplist_iter_next
struct kv *
skiplist_iter_next(struct skiplist_iter * const iter, struct kv * const out)
{
  if (iter->iter == NULL) return NULL;
  struct kv * const curr = __u64_to_ptr(iter->iter->e.ptr);
  struct kv * const ret = kv_dup2(curr, out);
  iter->iter = iter->iter->next[0];
  return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq (%rdi), %rax
testq %rax, %rax
je 0xf7ec
movq %rdi, %r14
movq (%rax), %r15
cmpq $0x10000, %r15          # imm = 0x10000
jae 0xf7f0
xorl %ebx, %ebx
jmp 0xf82a
xorl %ebx, %ebx
jmp 0xf834
movq %rsi, %rbx
shrq $0x10, %r15
movl 0x8(%r15), %eax
movl 0xc(%r15), %ecx
leaq (%rax,%rcx), %r12
addq $0x10, %r12
testq %rsi, %rsi
jne 0xf81c
movq %r12, %rdi
callq 0x63a0
movq %rax, %rbx
testq %rax, %rax
je 0xf82a
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x6340
movq (%r14), %rax
movq 0x8(%rax), %rax
movq %rax, (%r14)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: chainmap_create
struct chainmap *
chainmap_create(const struct kvmap_mm * const mm)
{
  struct chainmap * const map = (typeof(map))malloc(sizeof(*map));
  debug_assert(map);
  memset(map, 0, sizeof(*map));
  map->mm = mm ? (*mm) : __kvmap_mm_default;
  atomic_store(&(map->nr_kv), 0);
  map->fixed_power = 0;
  //if (map->fixed_power && (map->fixed_power < KVMAP_MIN_LEVEL)) {
  //  map->fixed_power = KVMAP_MIN_LEVEL;
  //}
  map->power = map->fixed_power ? map->fixed_power : KVMAP_MIN_LEVEL;
  map->trigger = UINT64_C(2) << map->power;
  const u64 table_size = sizeof(map->table[0]) * (UINT64_C(1) << map->power);
  map->table = (typeof(map->table))pages_alloc_best(table_size, true, &(map->alloc_size));
  mutexlock_init(&(map->expand_lock));
  for (u64 i = 0; i < KVMAP_HLOCK_NR; i++) {
    spinlock_init(&(map->hlocks[i]));
  }
  return map;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
movl $0x10138, %edi          # imm = 0x10138
callq 0x63a0
movq %rax, %rbx
testq %rax, %rax
je 0xf9f9
movl $0x10138, %edx          # imm = 0x10138
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6210
testq %r14, %r14
je 0xf932
vmovups (%r14), %ymm0
vmovups 0x20(%r14), %ymm1
vmovups 0x30(%r14), %ymm2
vmovups %ymm2, 0x30(%rbx)
vmovups %ymm1, 0x20(%rbx)
jmp 0xf954
vmovups 0xc47e(%rip), %ymm0     # 0x1bdb8
vmovups %ymm0, 0x30(%rbx)
vmovups 0xc461(%rip), %ymm0     # 0x1bda8
vmovups %ymm0, 0x20(%rbx)
vmovups 0xc434(%rip), %ymm0     # 0x1bd88
vmovups %ymm0, (%rbx)
xorl %eax, %eax
xchgq %rax, 0x88(%rbx)
xorl %r14d, %r14d
movq %r14, 0xc8(%rbx)
movq $0x10, 0xd0(%rbx)
movq $0x20000, 0xd8(%rbx) # imm = 0x20000
movl $0x80000, %esi          # imm = 0x80000
xorl %edi, %edi
movl $0x3, %edx
movl $0x2022, %ecx           # imm = 0x2022
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
vzeroupper
callq 0x6190
cmpq $-0x1, %rax
cmoveq %r14, %rax
testq %rax, %rax
je 0xf9bb
movq $0x80000, 0xf0(%rbx) # imm = 0x80000
movq %rax, 0xe8(%rbx)
leaq 0xf8(%rbx), %rdi
xorl %esi, %esi
callq 0x65d0
movl $0x138, %r14d           # imm = 0x138
leaq (%rbx,%r14), %rdi
movl $0x1, %esi
callq 0x62e0
addq $0x40, %r14
cmpq $0x10138, %r14          # imm = 0x10138
jne 0xf9d6
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
callq 0x66ef
jmp 0xf901
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: chainmap_get
struct kv *
chainmap_get(struct chainmap * const map, const struct kv * const key, struct kv * const out)
{
  const u64 hash = key->hash;
  const u64 lidx = kvmap_hlocks_index(hash);
  const u64 pkey = kvmap_pkey(hash);
  spinlock_lock(&(map->hlocks[lidx]));
  const u64 cid = (hash >> KVMAP_BASE_LEVEL) & ((UINT64_C(1) << map->power) - UINT64_C(1));
  struct chainnode * iter = map->table[cid];
  while (iter) {
    if (iter->e.pkey == pkey) {
      const struct kv * const curr = __u64_to_ptr(iter->e.ptr);
      if (kv_keymatch(key, curr)) {
        if (map->mm.hf) map->mm.hf(curr, map->mm.hp);
        struct kv * const ret = kv_dup2(curr, out);
        spinlock_unlock(&(map->hlocks[lidx]));
        return ret;
      }
    }
    iter = iter->next;
  }
  spinlock_unlock(&(map->hlocks[lidx]));
  return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, -0x48(%rbp)
movq %rdi, %r15
movq %rsi, -0x30(%rbp)
movq (%rsi), %rbx
movq %rbx, %r14
shrq $0x6, %r14
movl %r14d, %eax
andl $0x3ff, %eax            # imm = 0x3FF
shll $0x6, %eax
addq %rax, %rdi
addq $0x138, %rdi            # imm = 0x138
movq %rdi, -0x38(%rbp)
callq 0x6050
cmpl $0x23, %eax
je 0xfb85
movb 0xd0(%r15), %al
bzhiq %rax, %r14, %rax
movq %r15, -0x50(%rbp)
movq 0xe8(%r15), %rcx
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0xfb68
movq %rbx, %rax
shrq $0x20, %rax
xorq %rbx, %rax
movq %rax, %r15
shrq $0x10, %r15
xorq %rax, %r15
movq -0x30(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x40(%rbp)
movq (%r14), %r12
movl %r15d, %eax
xorw %r12w, %ax
jne 0xfb5b
movq %r12, %r13
shrq $0x10, %r13
cmpq $0x10000, %r12          # imm = 0x10000
jb 0xfae4
movq -0x30(%rbp), %rcx
movq (%rcx), %rax
cmpq (%r13), %rax
jne 0xfae4
movl 0x8(%rcx), %edx
cmpl 0x8(%r13), %edx
jne 0xfae4
leaq 0x10(%r13), %rsi
movq %rdi, %rbx
movq -0x40(%rbp), %rdi
callq 0x63d0
movq %rbx, %rdi
testl %eax, %eax
sete %bl
jmp 0xfae6
xorl %ebx, %ebx
testb %bl, %bl
je 0xfb57
movq -0x50(%rbp), %rcx
movq 0x20(%rcx), %rax
testq %rax, %rax
je 0xfb00
movq 0x28(%rcx), %rsi
movq %r13, %rdi
callq *%rax
cmpq $0x10000, %r12          # imm = 0x10000
jae 0xfb0e
xorl %r12d, %r12d
jmp 0xfb4b
movl 0x8(%r13), %eax
movl 0xc(%r13), %ecx
leaq (%rax,%rcx), %rdx
addq $0x10, %rdx
movq -0x48(%rbp), %rcx
movq %rcx, %r12
testq %rcx, %rcx
jne 0xfb40
movq %rdx, %rdi
movq %rdx, %r12
callq 0x63a0
movq %r12, %rdx
movq %rax, %r12
testq %rax, %rax
je 0xfb4b
movq %r12, %rdi
movq %r13, %rsi
callq 0x6340
movq -0x38(%rbp), %rdi
callq 0x6320
movq %r12, %rdi
testb %bl, %bl
jne 0xfb73
movq 0x8(%r14), %r14
testq %r14, %r14
jne 0xfa94
movq -0x38(%rbp), %rdi
callq 0x6320
xorl %edi, %edi
movq %rdi, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
callq 0x6530
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: chainmap_probe
bool
chainmap_probe(struct chainmap * const map, const struct kv * const key)
{
  const u64 hash = key->hash;
  const u64 lidx = kvmap_hlocks_index(hash);
  const u64 pkey = kvmap_pkey(hash);
  spinlock_lock(&(map->hlocks[lidx]));
  const u64 cid = (hash >> KVMAP_BASE_LEVEL) & ((UINT64_C(1) << map->power) - UINT64_C(1));
  struct chainnode * iter = map->table[cid];
  while (iter) {
    if (iter->e.pkey == pkey) {
      const struct kv * const curr = __u64_to_ptr(iter->e.ptr);
      if (kv_keymatch(key, curr)) {
        if (map->mm.hf) map->mm.hf(curr, map->mm.hp);
        spinlock_unlock(&(map->hlocks[lidx]));
        return true;
      }
    }
    iter = iter->next;
  }
  spinlock_unlock(&(map->hlocks[lidx]));
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r13
movq %rsi, -0x30(%rbp)
movq (%rsi), %rbx
movq %rbx, %r14
shrq $0x6, %r14
movl %r14d, %eax
andl $0x3ff, %eax            # imm = 0x3FF
shll $0x6, %eax
addq %rax, %rdi
addq $0x138, %rdi            # imm = 0x138
movq %rdi, -0x38(%rbp)
callq 0x6050
cmpl $0x23, %eax
je 0xfcb9
movb 0xd0(%r13), %al
bzhiq %rax, %r14, %rax
movq 0xe8(%r13), %rcx
movq (%rcx,%rax,8), %r15
testq %r15, %r15
setne %r12b
je 0xfc9a
movq %r13, -0x48(%rbp)
movq %rbx, %rax
shrq $0x20, %rax
xorq %rbx, %rax
movq %rax, %rbx
shrq $0x10, %rbx
xorq %rax, %rbx
movq -0x30(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x40(%rbp)
movq (%r15), %rax
movl %ebx, %ecx
xorw %ax, %cx
jne 0xfc8d
movq %rax, %r13
shrq $0x10, %r13
cmpq $0x10000, %rax          # imm = 0x10000
jb 0xfc61
movq -0x30(%rbp), %rcx
movq (%rcx), %rax
cmpq (%r13), %rax
jne 0xfc61
movl 0x8(%rcx), %edx
cmpl 0x8(%r13), %edx
jne 0xfc61
leaq 0x10(%r13), %rsi
movq -0x40(%rbp), %rdi
callq 0x63d0
testl %eax, %eax
sete %r14b
jmp 0xfc64
xorl %r14d, %r14d
testb %r14b, %r14b
je 0xfc8d
movq -0x48(%rbp), %rcx
movq 0x20(%rcx), %rax
testq %rax, %rax
je 0xfc7f
movq 0x28(%rcx), %rsi
movq %r13, %rdi
callq *%rax
movq -0x38(%rbp), %rdi
callq 0x6320
testb %r14b, %r14b
jne 0xfca3
movq 0x8(%r15), %r15
testq %r15, %r15
setne %r12b
jne 0xfc1d
movq -0x38(%rbp), %rdi
callq 0x6320
andb $0x1, %r12b
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
callq 0x6530
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: chainmap_del
bool
chainmap_del(struct chainmap * const map, const struct kv * const key)
{
  const u64 hash = key->hash;
  const u64 lidx = kvmap_hlocks_index(hash);
  const u64 pkey = kvmap_pkey(hash);
  spinlock_lock(&(map->hlocks[lidx]));
  const u64 cid = (hash >> KVMAP_BASE_LEVEL) & ((UINT64_C(1) << map->power) - UINT64_C(1));
  struct chainnode ** piter = &(map->table[cid]);
  while (*piter) {
    struct chainnode * const iter = *piter;
    if (iter->e.pkey == pkey) {
      const struct kv * const curr = __u64_to_ptr(iter->e.ptr);
      if (kv_keymatch(key, curr)) {
        kvmap_put_entry(&(map->mm), &(iter->e), NULL);
        *piter = iter->next;
        free(iter);
        atomic_fetch_sub(&(map->nr_kv), 1);
        spinlock_unlock(&(map->hlocks[lidx]));
        return true;
      }
    }
    piter = &(iter->next);
  }
  spinlock_unlock(&(map->hlocks[lidx]));
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r12
movq (%rsi), %r15
movq %r15, %r14
shrq $0x6, %r14
movl %r14d, %eax
andl $0x3ff, %eax            # imm = 0x3FF
shll $0x6, %eax
addq %rax, %rdi
addq $0x138, %rdi            # imm = 0x138
movq %rdi, -0x38(%rbp)
callq 0x6050
cmpl $0x23, %eax
je 0x1009d
movq %r15, %rax
shrq $0x20, %rax
xorq %r15, %rax
movq %rax, %r15
shrq $0x10, %r15
xorq %rax, %r15
movb 0xd0(%r12), %al
bzhiq %rax, %r14, %r14
shlq $0x3, %r14
movq %r12, -0x30(%rbp)
addq 0xe8(%r12), %r14
leaq 0x10(%rbx), %rax
movq %rax, -0x40(%rbp)
movq (%r14), %r12
testq %r12, %r12
je 0x1007f
movq (%r12), %r13
movl %r15d, %eax
xorw %r13w, %ax
jne 0x10027
cmpq $0x10000, %r13          # imm = 0x10000
jb 0x10027
shrq $0x10, %r13
movq (%rbx), %rax
cmpq (%r13), %rax
jne 0x10027
movl 0x8(%rbx), %edx
cmpl 0x8(%r13), %edx
jne 0x10027
leaq 0x10(%r13), %rsi
movq -0x40(%rbp), %rdi
callq 0x63d0
testl %eax, %eax
je 0x10034
leaq 0x8(%r12), %r14
movb $0x1, %al
testb %al, %al
jne 0xffde
jmp 0x10088
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x1004e
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rsi
movq %r13, %rdi
callq *%rax
movq $0x0, (%r12)
movq 0x8(%r12), %rax
movq %rax, (%r14)
movq %r12, %rdi
callq 0x6060
movq -0x30(%rbp), %rax
lock
decq 0x88(%rax)
movq -0x38(%rbp), %rdi
callq 0x6320
xorl %eax, %eax
jmp 0x1002e
movq -0x38(%rbp), %rdi
callq 0x6320
testq %r12, %r12
setne %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
callq 0x6530
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: chainmap_clean
inline void
chainmap_clean(struct chainmap * const map)
{
  mutexlock_lock(&(map->expand_lock));
  for (u64 i = 0; i < KVMAP_HLOCK_NR; i++) {
    spinlock_lock(&(map->hlocks[i]));
  }
  const u64 nr = UINT64_C(1) << map->power;
  for (u64 i = 0; i < nr; i++) {
    struct chainnode * iter = map->table[i];
    while (iter) {
      kvmap_put_entry(&(map->mm), &(iter->e), NULL);
      atomic_fetch_sub(&(map->nr_kv), 1);
      struct chainnode * const next = iter->next;
      free(iter);
      iter = next;
    }
    map->table[i] = NULL;
  }
  for (u64 i = 0; i < KVMAP_HLOCK_NR; i++) {
    spinlock_unlock(&(map->hlocks[i]));
  }
  mutexlock_unlock(&(map->expand_lock));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
leaq 0xf8(%rdi), %rbx
movq %rbx, %rdi
callq 0x65f0
cmpl $0xb, %eax
je 0x100bf
testl %eax, %eax
jne 0x101be
leaq 0x138(%r14), %r12
xorl %r15d, %r15d
leaq (%r12,%r15), %rdi
callq 0x6050
cmpl $0x23, %eax
je 0x101be
addq $0x40, %r15
cmpq $0x10000, %r15          # imm = 0x10000
jne 0x100de
movq %rbx, -0x30(%rbp)
movq 0xd0(%r14), %rax
movq %rax, -0x38(%rbp)
xorl %r13d, %r13d
movq 0xe8(%r14), %rax
movq (%rax,%r13,8), %r15
testq %r15, %r15
je 0x10161
movq (%r15), %rdi
cmpq $0x10000, %rdi          # imm = 0x10000
jb 0x1013e
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x1013e
shrq $0x10, %rdi
movq 0x18(%r14), %rsi
callq *%rax
movq $0x0, (%r15)
lock
decq 0x88(%r14)
movq 0x8(%r15), %rbx
movq %r15, %rdi
callq 0x6060
movq %rbx, %r15
testq %rbx, %rbx
jne 0x1011f
movq 0xe8(%r14), %rax
movq $0x0, (%rax,%r13,8)
incq %r13
movq -0x38(%rbp), %rax
shrxq %rax, %r13, %rax
testq %rax, %rax
je 0x1010f
xorl %r14d, %r14d
leaq (%r12,%r14), %rdi
callq 0x6320
addq $0x40, %r14
cmpq $0x10000, %r14          # imm = 0x10000
jne 0x10184
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
callq 0x6390
cmpl $0xb, %eax
je 0x1019e
testl %eax, %eax
jne 0x101be
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
callq 0x6530
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: chainmap_iter_create
struct chainmap_iter *
chainmap_iter_create(struct chainmap * const map)
{
  mutexlock_lock(&(map->expand_lock));
  for (u64 i = 0; i < KVMAP_HLOCK_NR; i++) {
    spinlock_lock(&(map->hlocks[i]));
  }
  struct chainmap_iter * const iter = (typeof(iter))malloc(sizeof(*iter));
  iter->map = map;
  u64 cid = 0;
  while (map->table[cid] == NULL) cid++;
  iter->curr = map->table[cid];
  iter->cid = cid;
  return iter;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0xf8(%rdi), %r14
movq %r14, %rdi
callq 0x65f0
cmpl $0xb, %eax
je 0x1022c
testl %eax, %eax
jne 0x10293
movl $0x138, %r14d           # imm = 0x138
leaq (%rbx,%r14), %rdi
callq 0x6050
cmpl $0x23, %eax
je 0x10293
addq $0x40, %r14
cmpq $0x10138, %r14          # imm = 0x10138
jne 0x10243
movl $0x18, %edi
callq 0x63a0
movq %rbx, (%rax)
movq 0xe8(%rbx), %rdx
movq $-0x1, %rcx
movq 0x8(%rdx,%rcx,8), %rsi
incq %rcx
testq %rsi, %rsi
je 0x10279
movq %rsi, 0x10(%rax)
movq %rcx, 0x8(%rax)
popq %rbx
popq %r14
popq %rbp
retq
xorl %edi, %edi
callq 0x6530
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: chainmap_iter_next
struct kv *
chainmap_iter_next(struct chainmap_iter * const iter, struct kv * const out)
{
  struct chainnode * curr = iter->curr;
  if (iter->curr == NULL) return NULL;
  struct kv * const ret = kv_dup2(__u64_to_ptr(curr->e.ptr), out);
  curr = curr->next;
  if (curr == NULL) {
    const u64 dirsize = UINT64_C(1) << iter->map->power;
    for (u64 cid = iter->cid + 1; cid < dirsize; cid++) {
      if (iter->map->table[cid]) {
        curr = iter->map->table[cid];
        iter->cid = cid;
        break;
      }
    }
  }
  iter->curr = curr;
  return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x10(%rdi), %r13
testq %r13, %r13
je 0x102c5
movq %rdi, %r14
movq (%r13), %r15
cmpq $0x10000, %r15          # imm = 0x10000
jae 0x102c9
xorl %ebx, %ebx
jmp 0x10303
xorl %ebx, %ebx
jmp 0x10343
movq %rsi, %rbx
shrq $0x10, %r15
movl 0x8(%r15), %eax
movl 0xc(%r15), %ecx
leaq (%rax,%rcx), %r12
addq $0x10, %r12
testq %rsi, %rsi
jne 0x102f5
movq %r12, %rdi
callq 0x63a0
movq %rax, %rbx
testq %rax, %rax
je 0x10303
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x6340
movq 0x8(%r13), %rsi
testq %rsi, %rsi
jne 0x1033f
movq (%r14), %rcx
movq 0x8(%r14), %rax
movq 0xd0(%rcx), %rdx
incq %rax
shrxq %rdx, %rax, %rsi
testq %rsi, %rsi
jne 0x1033d
movq 0xe8(%rcx), %rsi
movq (%rsi,%rax,8), %rsi
testq %rsi, %rsi
je 0x1031a
movq %rax, 0x8(%r14)
jmp 0x1033f
xorl %esi, %esi
movq %rsi, 0x10(%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: chainmap_iter_destroy
void
chainmap_iter_destroy(struct chainmap_iter * const iter)
{
  struct chainmap * const map = iter->map;
  for (u64 i = 0; i < KVMAP_HLOCK_NR; i++) {
    spinlock_unlock(&(map->hlocks[i]));
  }
  mutexlock_unlock(&(map->expand_lock));
  free(iter);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
leaq 0x138(%r14), %r15
xorl %r12d, %r12d
leaq (%r15,%r12), %rdi
callq 0x6320
addq $0x40, %r12
cmpq $0x10000, %r12          # imm = 0x10000
jne 0x10370
addq $0xf8, %r14
movq %r14, %rdi
callq 0x6390
cmpl $0xb, %eax
je 0x1038d
testl %eax, %eax
jne 0x103ae
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x6060
xorl %edi, %edi
callq 0x6530
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: bptree_create
struct bptree *
bptree_create(const struct kvmap_mm * const mm)
{
  debug_assert(sizeof(struct bpnode) < PGSZ);
  struct bptree * const tree = (typeof(tree))malloc(sizeof(*tree));
  if (tree == NULL) return NULL;
  tree->mm = mm ? (*mm) : __kvmap_mm_default;
  struct bpnode * const root = bptree_alloc_node(true);
  if (root == NULL) {
    free(tree);
    return NULL;
  }
  root->nr = 1;
  tree->root = root;
  return tree;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
movl $0x58, %edi
callq 0x63a0
testq %rax, %rax
je 0x1048a
movq %rax, %rbx
testq %r14, %r14
je 0x1048e
vmovups (%r14), %ymm0
vmovups 0x20(%r14), %ymm1
vmovups 0x30(%r14), %ymm2
vmovups %ymm2, 0x30(%rbx)
vmovups %ymm1, 0x20(%rbx)
jmp 0x104b0
xorl %ebx, %ebx
jmp 0x104f0
vmovups 0xb922(%rip), %ymm0     # 0x1bdb8
vmovups %ymm0, 0x30(%rbx)
vmovups 0xb905(%rip), %ymm0     # 0x1bda8
vmovups %ymm0, 0x20(%rbx)
vmovups 0xb8d8(%rip), %ymm0     # 0x1bd88
vmovups %ymm0, (%rbx)
xorl %r14d, %r14d
movl $0x1000, %esi           # imm = 0x1000
xorl %edi, %edi
movl $0x3, %edx
movl $0x2022, %ecx           # imm = 0x2022
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
vzeroupper
callq 0x6190
cmpq $-0x1, %rax
cmoveq %r14, %rax
movb $0x1, (%rax)
movq $0x1, 0x8(%rax)
movq %rax, 0x50(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: bptree_get_rec
static struct kv *
bptree_get_rec(struct bptree * const tree, struct bpnode * const node, const struct kv * const key, struct kv * const out)
{
  debug_assert(node);
  if (node->leaf) {
    return bptree_get_leaf(tree, node, key, out);
  } else {
    const u64 subidx = bptree_intm_locate(node, key);
    return bptree_get_rec(tree, node->iarray[subidx].sub, key, out);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
testq %r15, %r15
je 0x10545
cmpb $0x1, (%r15)
je 0x1054c
movq %r15, %rdi
movq %r12, %rsi
callq 0x10c50
shlq $0x4, %rax
movq 0x28(%r15,%rax), %r15
jmp 0x10524
callq 0x66ef
jmp 0x10529
leaq -0x28(%rbp), %rdi
movq %r12, (%rdi)
movq 0x8(%r15), %rdx
addq $0x20, %r15
leaq -0x498f(%rip), %r8      # 0xbbd3
movl $0x8, %ecx
movq %r15, %rsi
callq 0x6560
testq %rax, %rax
je 0x105cb
movq %rax, %r15
movq (%rax), %rdi
testq %rdi, %rdi
je 0x105cb
movq 0x20(%r14), %rax
testq %rax, %rax
je 0x1058e
movq 0x28(%r14), %rsi
callq *%rax
movq (%r15), %r14
testq %r14, %r14
je 0x105cb
movl 0x8(%r14), %eax
movl 0xc(%r14), %ecx
leaq (%rax,%rcx), %r15
addq $0x10, %r15
testq %rbx, %rbx
jne 0x105bb
movq %r15, %rdi
callq 0x63a0
movq %rax, %rbx
testq %rax, %rax
je 0x105cd
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x6340
jmp 0x105cd
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: bptree_probe_rec
static bool
bptree_probe_rec(struct bptree * const tree, struct bpnode * const node, const struct kv * const key)
{
  debug_assert(node);
  if (node->leaf) {
    return bptree_probe_leaf(tree, node, key);
  } else {
    const u64 subidx = bptree_intm_locate(node, key);
    return bptree_probe_rec(tree, node->iarray[subidx].sub, key);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
testq %r14, %r14
je 0x1061f
cmpb $0x1, (%r14)
je 0x10626
movq %r14, %rdi
movq %r15, %rsi
callq 0x10c50
shlq $0x4, %rax
movq 0x28(%r14,%rax), %r14
jmp 0x105fe
callq 0x66ef
jmp 0x10603
leaq -0x20(%rbp), %rdi
movq %r15, (%rdi)
movq 0x8(%r14), %rdx
addq $0x20, %r14
leaq -0x4a69(%rip), %r8      # 0xbbd3
movl $0x8, %ecx
movq %r14, %rsi
callq 0x6560
testq %rax, %rax
je 0x1066a
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1066a
movq 0x20(%rbx), %rax
movb $0x1, %r14b
testq %rax, %rax
je 0x1066d
movq 0x28(%rbx), %rsi
callq *%rax
jmp 0x1066d
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: bptree_raw_balance_leaf
bool
bptree_raw_balance_leaf(struct bpnode * const left, struct bpnode * const right)
{
  const u64 nr_r = (left->nr + right->nr) >> 1;
  const u64 nr_l = (left->nr + right->nr) - nr_r;
  if (nr_l == left->nr) {
    return false;
  } else if (nr_l < left->nr) { // shift right
    const u64 rmore = nr_r - right->nr;
    memmove(&(right->karray[rmore]), &(right->karray[0]), sizeof(right->karray[0]) * right->nr);
    memmove(&(right->karray[0]), &(left->karray[nr_l]), sizeof(right->karray[0]) * rmore);
  } else { // shift left
    const u64 rless = nr_l - left->nr;
    memmove(&(left->karray[left->nr]), &(right->karray[0]), sizeof(right->karray[0]) * rless);
    memmove(&(right->karray[0]), &(right->karray[rless]), sizeof(right->karray[0]) * nr_r);
  }
  left->nr = nr_l;
  right->nr = nr_r;
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x8(%rdi), %r13
movq 0x8(%rsi), %rdx
leaq (%rdx,%r13), %r15
movq %r15, %r14
shrq %r14
subq %r14, %r15
movq %r15, %r12
subq %r13, %r12
je 0x10730
movq %rsi, %rbx
movq %rdi, -0x38(%rbp)
jae 0x106ee
movq %r14, %r12
subq %rdx, %r12
leaq 0x20(%rbx), %rsi
movq %rsi, -0x30(%rbp)
leaq (%rbx,%r12,8), %rdi
addq $0x20, %rdi
shlq $0x3, %rdx
callq 0x6450
movq -0x38(%rbp), %rax
leaq (%rax,%r15,8), %rsi
addq $0x20, %rsi
shlq $0x3, %r12
movq -0x30(%rbp), %rdi
movq %r12, %rdx
jmp 0x1071f
leaq (%rdi,%r13,8), %rdi
addq $0x20, %rdi
leaq 0x20(%rbx), %rsi
movq %rsi, -0x30(%rbp)
leaq (,%r12,8), %rdx
callq 0x6450
leaq (%rbx,%r12,8), %rsi
addq $0x20, %rsi
leaq (,%r14,8), %rdx
movq -0x30(%rbp), %rdi
callq 0x6450
movq -0x38(%rbp), %rax
movq %r15, 0x8(%rax)
movq %r14, 0x8(%rbx)
cmpq %r13, %r15
setne %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: bptree_raw_balance_intm
bool
bptree_raw_balance_intm(struct bpnode * const left, struct bpnode * const right)
{
  const u64 nr_r = (left->nr + right->nr) >> 1;
  const u64 nr_l = (left->nr + right->nr) - nr_r;
  if (nr_l == left->nr) {
    return false;
  } else if (nr_l < left->nr) { // shift right
    const u64 rmore = nr_r - right->nr;
    memmove(&(right->iarray[rmore]), &(right->iarray[0]), sizeof(right->iarray[0]) * right->nr);
    memmove(&(right->iarray[0]), &(left->iarray[nr_l]), sizeof(right->iarray[0]) * rmore);
  } else { // shift left
    const u64 rless = nr_l - left->nr;
    memmove(&(left->iarray[left->nr]), &(right->iarray[0]), sizeof(right->iarray[0]) * rless);
    memmove(&(right->iarray[0]), &(right->iarray[rless]), sizeof(right->iarray[0]) * nr_r);
  }
  left->nr = nr_l;
  right->nr = nr_r;
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x8(%rdi), %r13
movq 0x8(%rsi), %rdx
leaq (%rdx,%r13), %r12
movq %r12, %r14
shrq %r14
subq %r14, %r12
movq %r12, %r15
subq %r13, %r15
je 0x10805
movq %rsi, %rbx
movq %rdi, -0x38(%rbp)
jae 0x107bf
movq %r14, %r15
subq %rdx, %r15
leaq 0x20(%rbx), %rsi
movq %rsi, -0x30(%rbp)
shlq $0x4, %r15
leaq (%rbx,%r15), %rdi
addq $0x20, %rdi
shlq $0x4, %rdx
callq 0x6450
movq %r12, %rax
shlq $0x4, %rax
movq -0x38(%rbp), %rcx
leaq (%rcx,%rax), %rsi
addq $0x20, %rsi
movq -0x30(%rbp), %rdi
movq %r15, %rdx
jmp 0x107f4
movq %r13, %rax
shlq $0x4, %rax
addq %rax, %rdi
addq $0x20, %rdi
leaq 0x20(%rbx), %rsi
movq %rsi, -0x30(%rbp)
shlq $0x4, %r15
movq %r15, %rdx
callq 0x6450
leaq (%rbx,%r15), %rsi
addq $0x20, %rsi
movq %r14, %rdx
shlq $0x4, %rdx
movq -0x30(%rbp), %rdi
callq 0x6450
movq -0x38(%rbp), %rax
movq %r12, 0x8(%rax)
movq %r14, 0x8(%rbx)
cmpq %r13, %r12
setne %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq