LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/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 $0x38, %rsp
movq %rdi, %r14
addq $0x10050, %rdi          # imm = 0x10050
movq %rdi, -0x38(%rbp)
callq 0x6b46
leaq 0x50(%r14), %rax
movq %rax, -0x30(%rbp)
pushq $0x50
popq %rbx
cmpq $0x10050, %rbx          # imm = 0x10050
je 0xcd7b
leaq (%r14,%rbx), %rdi
callq 0x6afb
addq $0x40, %rbx
jmp 0xcd63
leaq 0x10118(%r14), %rax
xorl %ecx, %ecx
movq %rax, -0x40(%rbp)
cmpq $0x2, %rcx
je 0xce21
imulq $0x18, %rcx, %r12
cmpq $0x0, (%rax,%r12)
je 0xce19
movq %rcx, -0x48(%rbp)
addq %rax, %r12
movq 0x10(%r12), %rax
movq %rax, -0x58(%rbp)
xorl %ebx, %ebx
xorl %r13d, %r13d
movq %r12, -0x50(%rbp)
movq -0x58(%rbp), %rax
shrxq %rax, %r13, %rax
movq (%r12), %r15
testq %rax, %rax
jne 0xcdff
addq %rbx, %r15
xorl %r12d, %r12d
cmpq $0x40, %r12
je 0xcdf2
cmpq $0x10000, (%r15,%r12)   # imm = 0x10000
jb 0xcdec
leaq (%r15,%r12), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0xccb2
addq $0x8, %r12
jmp 0xcdce
incq %r13
addq $0x40, %rbx
movq -0x50(%rbp), %r12
jmp 0xcdb6
movq 0x8(%r12), %rsi
movq %r15, %rdi
callq 0x6410
andq $0x0, (%r12)
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
incq %rcx
jmp 0xcd88
movq %r14, %rdi
callq 0xc63b
xorl %ebx, %ebx
movq -0x30(%rbp), %r14
cmpq $0x10000, %rbx          # imm = 0x10000
je 0xce47
leaq (%r14,%rbx), %rdi
callq 0x6320
addq $0x40, %rbx
jmp 0xce2f
movq -0x38(%rbp), %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6ba1
// File: /workspace/github_c_makefile_star2_O2/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 0xcd34
movl $0x10120, %r14d         # imm = 0x10120
cmpq $0x10150, %r14          # imm = 0x10150
je 0xce95
movq -0x8(%rbx,%r14), %rdi
testq %rdi, %rdi
je 0xce8f
movq (%rbx,%r14), %rsi
callq 0x6410
addq $0x18, %r14
jmp 0xce73
movq 0x100d8(%rbx), %rdi
callq 0x6060
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x6060
// File: /workspace/github_c_makefile_star2_O2/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, %rbx
movq %rdi, %r15
addq $0x10050, %rdi          # imm = 0x10050
movq %rdi, -0x30(%rbp)
callq 0x6b46
pushq $0x8
popq %r13
leaq 0x5658(%rip), %r12      # 0x12534
xorl %r14d, %r14d
cmpq $0x30, %r14
je 0xcf10
cmpq $0x0, 0x10118(%r15,%r14)
je 0xcf0a
movq 0x10128(%r15,%r14), %rdx
shlxq %rdx, %r13, %rcx
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x6300
addq $0x18, %r14
jmp 0xcedf
movq -0x30(%rbp), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6ba1
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x20
popq %rdi
callq 0x63a0
movq %rax, %rbx
testq %rax, %rax
je 0xcf96
leaq 0x10050(%r14), %rdi
callq 0x6b46
pushq $0x50
popq %r15
cmpq $0x10050, %r15          # imm = 0x10050
je 0xcf6c
leaq (%r14,%r15), %rdi
callq 0x6afb
addq $0x40, %r15
jmp 0xcf54
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)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
pushq %rax
movq 0x8(%rdi), %rcx
movq 0x10(%rdi), %r14
movb 0x10(%rcx), %al
pushq $0x1
popq %rdx
shlxq %rax, %rdx, %rdx
cmpq %rdx, %r14
jae 0xd007
movq %rdi, %rbx
movq 0x18(%rdi), %r15
xorl %eax, %eax
cmpq %rdx, %r14
jae 0xd029
movq %r14, %rdi
shlq $0x6, %rdi
addq (%rcx), %rdi
movq (%rdi,%r15,8), %rdi
cmpq $0xffff, %rdi           # imm = 0xFFFF
ja 0xd00b
incq %r15
xorl %edi, %edi
cmpq $0x8, %r15
sete %dil
movl $0x0, %r8d
cmoveq %r8, %r15
addq %rdi, %r14
jmp 0xcfcf
xorl %eax, %eax
jmp 0xd031
shrq $0x10, %rdi
callq 0xaa68
incq %r15
xorl %ecx, %ecx
xorl %edx, %edx
cmpq $0x8, %r15
sete %dl
cmoveq %rcx, %r15
addq %rdx, %r14
movq %r14, 0x10(%rbx)
movq %r15, 0x18(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
cmpq $0x10000, %r12          # imm = 0x10000
je 0xd06c
leaq (%r15,%r12), %rdi
callq 0x6320
addq $0x40, %r12
jmp 0xd054
addq $0x10050, %r14          # imm = 0x10050
movq %r14, %rdi
callq 0x6ba1
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x6060
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x1
popq %rdi
movl $0x468, %esi            # imm = 0x468
callq 0x62d0
testq %r14, %r14
je 0xd15c
vmovups (%r14), %ymm0
vmovups 0x20(%r14), %ymm1
vmovups 0x30(%r14), %ymm2
vmovups %ymm2, 0x30(%rax)
vmovups %ymm1, 0x20(%rax)
jmp 0xd17e
vmovups 0xbc54(%rip), %ymm0     # 0x18db8
vmovups %ymm0, 0x30(%rax)
vmovups 0xbc37(%rip), %ymm0     # 0x18da8
vmovups %ymm0, 0x20(%rax)
vmovups 0xbc0a(%rip), %ymm0     # 0x18d88
vmovups %ymm0, (%rax)
movq %rbx, 0x50(%rax)
movq $0x1, 0x258(%rax)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x58(%rax)
vmovsd 0x4ed1(%rip), %xmm0     # 0x12078
pushq $0xc
popq %rcx
vmovsd 0x4f06(%rip), %xmm1     # 0x120b8
cmpq $0x4b, %rcx
je 0xd1c6
vmulsd %xmm1, %xmm0, %xmm0
vmovsd %xmm0, (%rax,%rcx,8)
incq %rcx
jmp 0xd1b2
popq %rbx
popq %r14
popq %rbp
vzeroupper
retq
// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/lib1.c
// Function: skiplist_get
struct kv *
skiplist_get(struct skiplist * const list, const struct kv * const key, struct kv * const out)
{
  u64 i = list->height - 1;
  struct skipnode * left = &(list->n0);
  struct skipnode * right = NULL;
  while (i) {
    while (left->next[i]) {
      right = left->next[i];
      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);
        struct kv * const ret = kv_dup2(curr, out);
        return ret;
      } else if (cmp < 0) {
        break;
      } else {
        left = right;
      }
    }
    i--;
  }
  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);
        struct kv * const ret = kv_dup2(curr, out);
        return ret;
      }
    }
    left = left->next[0];
  }
  return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, -0x40(%rbp)
movq %rsi, -0x30(%rbp)
movq 0x258(%rdi), %r15
movq %rdi, -0x38(%rbp)
leaq 0x260(%rdi), %rbx
xorl %r12d, %r12d
movq %r15, %r14
decq %r14
je 0xd288
movq %rbx, %r13
movq (%rbx,%r15,8), %rbx
testq %rbx, %rbx
je 0xd250
movq (%rbx), %r12
cmpq $0xffff, %r12           # imm = 0xFFFF
ja 0xd232
callq 0x6e43
shrq $0x10, %r12
movq -0x30(%rbp), %rdi
movq %r12, %rsi
movq -0x38(%rbp), %rax
callq *0x50(%rax)
testl %eax, %eax
je 0xd258
movq %rbx, %r12
jns 0xd215
movq %rbx, %r12
movq %r13, %rbx
movq %r14, %r15
jmp 0xd20d
movq -0x38(%rbp), %rcx
movq 0x20(%rcx), %rax
testq %rax, %rax
je 0xd26e
movq 0x28(%rcx), %rsi
movq %r12, %rdi
callq *%rax
movq %r12, %rdi
movq -0x40(%rbp), %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xaa68
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, %r15
shrq $0x20, %r15
xorq %rax, %r15
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0xd2f8
cmpq %r12, %rbx
je 0xd2f8
movq (%rbx), %r14
shrq $0x10, %r14
movq (%r14), %rax
movq %rax, %rcx
shrq $0x20, %rcx
xorl %eax, %ecx
movl %ecx, %eax
xorl %r15d, %eax
shrl $0x10, %eax
xorl %r15d, %eax
xorw %cx, %ax
jne 0xd299
movq %r14, %rdi
movq -0x30(%rbp), %rsi
callq 0xab0c
testb %al, %al
je 0xd299
movq -0x38(%rbp), %rcx
movq 0x20(%rcx), %rax
testq %rax, %rax
je 0xd2f0
movq 0x28(%rcx), %rsi
movq %r14, %rdi
callq *%rax
movq %r14, %rdi
jmp 0xd271
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
movq %rdi, -0x38(%rbp)
leaq 0x260(%rdi), %r15
xorl %r12d, %r12d
movq %r14, %rbx
decq %rbx
je 0xd3a9
movq %r15, %r13
movq (%r15,%r14,8), %r15
testq %r15, %r15
je 0xd376
movq (%r15), %r12
cmpq $0xffff, %r12           # imm = 0xFFFF
ja 0xd358
callq 0x6e43
shrq $0x10, %r12
movq -0x30(%rbp), %rdi
movq %r12, %rsi
movq -0x38(%rbp), %rax
callq *0x50(%rax)
testl %eax, %eax
je 0xd37e
movq %r15, %r12
jns 0xd33b
movq %r15, %r12
movq %r13, %r15
movq %rbx, %r14
jmp 0xd333
movq -0x38(%rbp), %rcx
movq 0x20(%rcx), %rax
movb $0x1, %r13b
testq %rax, %rax
je 0xd397
movq 0x28(%rcx), %rsi
movq %r12, %rdi
callq *%rax
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, %r14
shrq $0x20, %r14
xorq %rax, %r14
xorl %r13d, %r13d
movq 0x8(%r15), %r15
testq %r15, %r15
je 0xd397
cmpq %r12, %r15
je 0xd397
movq (%r15), %rbx
shrq $0x10, %rbx
movq (%rbx), %rax
movq %rax, %rcx
shrq $0x20, %rcx
xorl %eax, %ecx
movl %ecx, %eax
xorl %r14d, %eax
shrl $0x10, %eax
xorl %r14d, %eax
xorw %cx, %ax
jne 0xd3bd
movq %rbx, %rdi
movq -0x30(%rbp), %rsi
callq 0xab0c
testb %al, %al
je 0xd3bd
movq -0x38(%rbp), %rcx
movq 0x20(%rcx), %rax
movb $0x1, %r13b
testq %rax, %rax
je 0xd397
movq 0x28(%rcx), %rsi
movq %rbx, %rdi
jmp 0xd395
// File: /workspace/github_c_makefile_star2_O2/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, -0x40(%rbp)
movq 0x258(%rdi), %rax
movq %rdi, -0x38(%rbp)
leaq 0x260(%rdi), %r13
leaq 0x1(%rax), %rcx
movq %rcx, -0x30(%rbp)
xorl %ebx, %ebx
leaq -0x1(%rax), %r14
cmpq $0x3f, %r14
ja 0xd5f2
testq %rbx, %rbx
jne 0xd5f2
xorl %ebx, %ebx
movq 0x8(%r13,%r14,8), %r15
testq %r15, %r15
je 0xd5e9
movq (%r15), %r12
cmpq $0xffff, %r12           # imm = 0xFFFF
ja 0xd5cb
callq 0x6e43
shrq $0x10, %r12
movq -0x40(%rbp), %rdi
movq %r12, %rsi
movq -0x38(%rbp), %rax
callq *0x50(%rax)
testl %eax, %eax
cmoveq %r15, %rbx
cmovgq %r15, %r13
jg 0xd5b0
decq -0x30(%rbp)
movq %r14, %rax
jmp 0xd59f
testq %rbx, %rbx
je 0xd665
movq %rsp, %r15
movq %rsp, %rcx
leaq 0x17(,%rax,8), %rdx
andq $-0x10, %rdx
subq %rdx, %rcx
movq %rcx, %rsp
movq -0x30(%rbp), %rdi
movq %r13, %rdx
cmpq $0x3f, %rax
ja 0xd632
movq %rdx, %r13
movq 0x8(%rdx,%rax,8), %rdx
cmpq %rbx, %rdx
jne 0xd61c
movq %r13, (%rcx,%rax,8)
decq %rax
jmp 0xd613
xorl %eax, %eax
cmpq %rax, %rdi
je 0xd64c
movq 0x8(%rbx,%rax,8), %rdx
movq (%rcx,%rax,8), %rsi
movq %rdx, 0x8(%rsi,%rax,8)
incq %rax
jmp 0xd634
movq -0x38(%rbp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0xccb2
movq %rbx, %rdi
callq 0x6060
movq %r15, %rsp
testq %rbx, %rbx
setne %al
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
pushq %rax
movq %rdi, %rbx
movq 0x268(%rdi), %r14
testq %r14, %r14
je 0xd6b1
movq 0x8(%r14), %r15
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xccb2
movq %r14, %rdi
callq 0x6060
movq %r15, %r14
jmp 0xd68e
xorl %eax, %eax
cmpq $0x40, %rax
je 0xd6c7
andq $0x0, 0x268(%rbx,%rax,8)
incq %rax
jmp 0xd6b3
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
movq %rsp, %rbp
movq %rsi, %rax
leaq 0x268(%rdi), %rdx
xorl %ecx, %ecx
movq (%rdx), %rdx
testq %rdx, %rdx
je 0xd70f
incq %rcx
addq $0x8, %rdx
jmp 0xd6fe
movq 0x258(%rdi), %r8
leaq 0x4e33(%rip), %rsi      # 0x12550
leaq 0x4e45(%rip), %rdx      # 0x12569
movq %rax, %rdi
xorl %eax, %eax
popq %rbp
jmp 0x6300
// File: /workspace/github_c_makefile_star2_O2/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:
cmpq $0x0, 0x268(%rdi)
je 0xd79c
pushq %rbp
movq %rsp, %rbp
movq 0x258(%rdi), %rax
addq $0x260, %rdi            # imm = 0x260
decq %rax
je 0xd783
movq %rdi, %rcx
movq %rcx, %rdi
movq 0x8(%rcx,%rax,8), %rcx
testq %rcx, %rcx
jne 0xd774
jmp 0xd76c
movq %rdi, %rax
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
jne 0xd783
movq (%rax), %rdi
shrq $0x10, %rdi
popq %rbp
jmp 0xaa68
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x10
popq %rdi
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_O2/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:
movq (%rdi), %rax
testq %rax, %rax
je 0xd7f3
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rax), %rdi
shrq $0x10, %rdi
callq 0xaa68
movq (%rbx), %rcx
movq 0x8(%rcx), %rcx
movq %rcx, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %rdi
movl $0x10138, %esi          # imm = 0x10138
callq 0x62d0
movq %rax, %rbx
testq %rax, %rax
jne 0xd8b9
callq 0x6e43
testq %r14, %r14
je 0xd8db
vmovups (%r14), %ymm0
vmovups 0x20(%r14), %ymm1
vmovups 0x30(%r14), %ymm2
vmovups %ymm2, 0x30(%rbx)
vmovups %ymm1, 0x20(%rbx)
jmp 0xd8fd
vmovups 0xb4d5(%rip), %ymm0     # 0x18db8
vmovups %ymm0, 0x30(%rbx)
vmovups 0xb4b8(%rip), %ymm0     # 0x18da8
vmovups %ymm0, 0x20(%rbx)
vmovups 0xb48b(%rip), %ymm0     # 0x18d88
vmovups %ymm0, (%rbx)
xorl %eax, %eax
xchgq %rax, 0x88(%rbx)
andq $0x0, 0xc8(%rbx)
movq $0x10, 0xd0(%rbx)
movq $0x20000, 0xd8(%rbx) # imm = 0x20000
leaq 0xf0(%rbx), %rdx
pushq $0x1
popq %rsi
movl $0x80000, %edi          # imm = 0x80000
vzeroupper
callq 0x7c29
movq %rax, 0xe8(%rbx)
leaq 0xf8(%rbx), %rdi
callq 0x6b3a
movl $0x138, %r14d           # imm = 0x138
cmpq $0x10138, %r14          # imm = 0x10138
je 0xd970
leaq (%rbx,%r14), %rdi
callq 0x6aec
addq $0x40, %r14
jmp 0xd958
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 $0x18, %rsp
movq %rdx, -0x30(%rbp)
movq %rsi, %r12
movq %rdi, %r15
movq (%rsi), %rax
movq %rax, %rcx
shrq $0x20, %rcx
xorq %rax, %rcx
movq %rax, %rbx
shrq $0x6, %rbx
movl %ebx, %eax
andl $0x3ff, %eax            # imm = 0x3FF
movq %rcx, %r14
shrq $0x10, %r14
xorq %rcx, %r14
shll $0x6, %eax
addq %rax, %rdi
addq $0x138, %rdi            # imm = 0x138
movq %rdi, -0x38(%rbp)
callq 0x6afb
movb 0xd0(%r15), %al
bzhiq %rax, %rbx, %r13
shlq $0x3, %r13
addq 0xe8(%r15), %r13
movq (%r13), %r13
testq %r13, %r13
je 0xda13
movq (%r13), %rbx
movl %r14d, %eax
xorw %bx, %ax
jne 0xda0d
shrq $0x10, %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0xab0c
testb %al, %al
jne 0xda17
addq $0x8, %r13
jmp 0xd9e5
xorl %ebx, %ebx
jmp 0xda38
movq 0x20(%r15), %rax
testq %rax, %rax
je 0xda29
movq 0x28(%r15), %rsi
movq %rbx, %rdi
callq *%rax
movq %rbx, %rdi
movq -0x30(%rbp), %rsi
callq 0xaa68
movq %rax, %rbx
movq -0x38(%rbp), %rdi
callq 0x6320
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rax
movq %rax, %rcx
shrq $0x20, %rcx
xorq %rax, %rcx
movq %rax, %r15
shrq $0x6, %r15
movl %r15d, %eax
andl $0x3ff, %eax            # imm = 0x3FF
movq %rcx, %r13
shrq $0x10, %r13
xorq %rcx, %r13
shll $0x6, %eax
addq %rax, %rdi
addq $0x138, %rdi            # imm = 0x138
movq %rdi, -0x30(%rbp)
callq 0x6afb
movb 0xd0(%rbx), %al
bzhiq %rax, %r15, %r15
shlq $0x3, %r15
addq 0xe8(%rbx), %r15
movq (%r15), %r15
testq %r15, %r15
je 0xdaf8
movq (%r15), %r12
movl %r13d, %eax
xorw %r12w, %ax
jne 0xdae0
shrq $0x10, %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0xab0c
testb %al, %al
jne 0xdae6
addq $0x8, %r15
jmp 0xdab9
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0xdaf8
movq 0x28(%rbx), %rsi
movq %r12, %rdi
callq *%rax
testq %r15, %r15
setne %bl
movq -0x30(%rbp), %rdi
callq 0x6320
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rax
movq %rax, %rcx
shrq $0x20, %rcx
xorq %rax, %rcx
movq %rax, %r15
shrq $0x6, %r15
movl %r15d, %eax
andl $0x3ff, %eax            # imm = 0x3FF
movq %rcx, %r13
shrq $0x10, %r13
xorq %rcx, %r13
shll $0x6, %eax
addq %rax, %rdi
addq $0x138, %rdi            # imm = 0x138
movq %rdi, -0x30(%rbp)
callq 0x6afb
movb 0xd0(%rbx), %al
bzhiq %rax, %r15, %r15
shlq $0x3, %r15
addq 0xe8(%rbx), %r15
movq (%r15), %r12
testq %r12, %r12
je 0xdd5d
movq (%r12), %rsi
movl %r13d, %eax
xorw %si, %ax
jne 0xdd2f
shrq $0x10, %rsi
movq %r14, %rdi
callq 0xab0c
testb %al, %al
jne 0xdd38
addq $0x8, %r12
movq %r12, %r15
jmp 0xdd0b
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0xccb2
movq 0x8(%r12), %rax
movq %rax, (%r15)
movq %r12, %rdi
callq 0x6060
lock
decq 0x88(%rbx)
testq %r12, %r12
setne %bl
movq -0x30(%rbp), %rdi
callq 0x6320
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
addq $0xf8, %rdi
movq %rdi, -0x38(%rbp)
callq 0x6b46
leaq 0x138(%r14), %rax
movq %rax, -0x30(%rbp)
movl $0x138, %ebx            # imm = 0x138
cmpq $0x10138, %rbx          # imm = 0x10138
je 0xddc9
leaq (%r14,%rbx), %rdi
callq 0x6afb
addq $0x40, %rbx
jmp 0xddb1
movq 0xd0(%r14), %r13
xorl %ebx, %ebx
shrxq %r13, %rbx, %rax
testq %rax, %rax
jne 0xde23
movq 0xe8(%r14), %rax
movq (%rax,%rbx,8), %r15
testq %r15, %r15
je 0xde12
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0xccb2
lock
decq 0x88(%r14)
movq 0x8(%r15), %r12
movq %r15, %rdi
callq 0x6060
movq %r12, %r15
jmp 0xdde7
movq 0xe8(%r14), %rax
andq $0x0, (%rax,%rbx,8)
incq %rbx
jmp 0xddd2
xorl %ebx, %ebx
movq -0x30(%rbp), %r14
cmpq $0x10000, %rbx          # imm = 0x10000
je 0xde41
leaq (%r14,%rbx), %rdi
callq 0x6320
addq $0x40, %rbx
jmp 0xde29
movq -0x38(%rbp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6ba1
// File: /workspace/github_c_makefile_star2_O2/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
addq $0xf8, %rdi
callq 0x6b46
movl $0x138, %r14d           # imm = 0x138
cmpq $0x10138, %r14          # imm = 0x10138
je 0xdee2
leaq (%rbx,%r14), %rdi
callq 0x6afb
addq $0x40, %r14
jmp 0xdeca
pushq $0x18
popq %rdi
callq 0x63a0
movq %rbx, (%rax)
movq 0xe8(%rbx), %rdx
pushq $-0x1
popq %rcx
movq 0x8(%rdx,%rcx,8), %rsi
incq %rcx
testq %rsi, %rsi
je 0xdef7
movq %rsi, 0x10(%rax)
movq %rcx, 0x8(%rax)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
movq 0x10(%rdi), %r14
testq %r14, %r14
je 0xdf6a
movq %rdi, %rbx
movq (%r14), %rdi
shrq $0x10, %rdi
callq 0xaa68
movq 0x8(%r14), %rdi
testq %rdi, %rdi
jne 0xdf70
movq (%rbx), %rdx
movq 0x8(%rbx), %rcx
movq 0xd0(%rdx), %rsi
incq %rcx
shrxq %rsi, %rcx, %rdi
testq %rdi, %rdi
jne 0xdf6e
movq 0xe8(%rdx), %rdi
movq (%rdi,%rcx,8), %rdi
testq %rdi, %rdi
je 0xdf47
movq %rcx, 0x8(%rbx)
jmp 0xdf70
xorl %eax, %eax
jmp 0xdf74
xorl %edi, %edi
movq %rdi, 0x10(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
cmpq $0x10000, %r12          # imm = 0x10000
je 0xdfac
leaq (%r15,%r12), %rdi
callq 0x6320
addq $0x40, %r12
jmp 0xdf94
addq $0xf8, %r14
movq %r14, %rdi
callq 0x6ba1
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x6060
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x58
popq %rdi
callq 0x63a0
testq %rax, %rax
je 0xe0e8
movq %rax, %rbx
testq %r14, %r14
je 0xe09c
vmovups (%r14), %ymm0
vmovups 0x20(%r14), %ymm1
vmovups 0x30(%r14), %ymm2
vmovups %ymm2, 0x30(%rbx)
vmovups %ymm1, 0x20(%rbx)
jmp 0xe0be
vmovups 0xad14(%rip), %ymm0     # 0x18db8
vmovups %ymm0, 0x30(%rbx)
vmovups 0xacf7(%rip), %ymm0     # 0x18da8
vmovups %ymm0, 0x20(%rbx)
vmovups 0xacca(%rip), %ymm0     # 0x18d88
vmovups %ymm0, (%rbx)
pushq $0x1
popq %rdi
vzeroupper
callq 0xe0f2
testq %rax, %rax
je 0xe0e0
movq $0x1, 0x8(%rax)
movq %rax, 0x50(%rbx)
jmp 0xe0ea
movq %rbx, %rdi
callq 0x6060
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0xe2f7
movq %rsi, %rbx
movq %rdi, -0x38(%rbp)
jae 0xe2b5
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 0xe2e6
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_O2/wuxb45[P]SLB/lib1.c
// Function: bptree_set
bool
bptree_set(struct bptree * const tree, const struct kv * const kv0)
{
  const struct kv * const kv = kv_alloc_dup(kv0, &(tree->mm));
  if (kv == NULL) return false;

  if ((tree->root->leaf) && (tree->root->nr == BPTREE_LEAF_FO)) {
    bptree_split_root_leaf(tree);
  }
  if (tree->root->leaf) {
    return bptree_set_leaf(tree, tree->root, kv);
  }
  // intm
  if (tree->root->nr == BPTREE_INTM_FO) {
    bptree_split_root_intm(tree);
  }
  const u64 subidx = bptree_intm_locate(tree->root, kv);
  return bptree_set_rec(tree, tree->root, subidx, kv);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r13
movq %rsi, %rdi
movq %r13, %rsi
callq 0xba29
movq %rax, %rbx
testq %rax, %rax
je 0xe5f6
movq 0x50(%r13), %r14
movb (%r14), %al
cmpb $0x1, %al
jne 0xe47f
cmpq $0x1f4, 0x8(%r14)       # imm = 0x1F4
jne 0xe47f
pushq $0x1
popq %rdi
callq 0xe0f2
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0xe242
xorl %edi, %edi
callq 0xe0f2
movq %rax, %r12
movq 0x20(%r14), %rdi
callq 0xaa2b
movq %r12, %rdi
xorl %esi, %esi
movq %rax, %rdx
movq %r14, %rcx
callq 0x10e68
movq 0x20(%r15), %rdi
callq 0xaa2b
pushq $0x1
popq %rsi
movq %r12, %rdi
movq %rax, %rdx
movq %r15, %rcx
callq 0x10e68
movq %r12, 0x50(%r13)
movb (%r12), %al
movq %r12, %r14
testb $0x1, %al
je 0xe48e
movq %r13, %rdi
movq %r14, %rsi
jmp 0xe5ee
cmpq $0xfa, 0x8(%r14)
movq %r13, -0x38(%rbp)
jne 0xe4f5
xorl %edi, %edi
callq 0xe0f2
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0xe30c
xorl %edi, %edi
callq 0xe0f2
movq %rax, %r12
movq 0x20(%r14), %rdi
callq 0xaa2b
movq %r12, %rdi
xorl %esi, %esi
movq %rax, %rdx
movq %r14, %rcx
callq 0x10e68
movq 0x20(%r15), %rdi
callq 0xaa2b
pushq $0x1
popq %rsi
movq %r12, %rdi
movq %rax, %rdx
movq %r15, %rcx
callq 0x10e68
movq %r12, 0x50(%r13)
movq %r12, %r14
movq %r14, %rdi
movq %rbx, -0x30(%rbp)
movq %rbx, %rsi
callq 0xe724
movq %rax, %r13
leaq 0x20(%r14), %rbx
cmpb $0x0, (%r14)
je 0xe516
callq 0x6e43
movq %r13, %rax
shlq $0x4, %rax
leaq (%rbx,%rax), %r12
addq $0x8, %r12
movq (%r12), %r15
movq 0x8(%r15), %rax
cmpb $0x1, (%r15)
jne 0xe56a
cmpq $0x1f4, %rax            # imm = 0x1F4
jne 0xe5e3
cmpq $0xfa, 0x8(%r14)
jb 0xe552
callq 0x6e43
movq (%r12), %r15
pushq $0x1
popq %rdi
callq 0xe0f2
movq %rax, %r12
movq %r15, %rdi
movq %rax, %rsi
callq 0xe242
jmp 0xe59a
cmpq $0xfa, %rax
jne 0xe5cc
cmpq $0xfa, 0x8(%r14)
jb 0xe585
callq 0x6e43
movq (%r12), %r15
xorl %edi, %edi
callq 0xe0f2
movq %rax, %r12
movq %r15, %rdi
movq %rax, %rsi
callq 0xe30c
incq %r13
movq 0x20(%r12), %rdi
callq 0xaa2b
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
movq %r12, %rcx
callq 0x10e68
movq %r14, %rdi
movq -0x30(%rbp), %rsi
callq 0xe724
movq %rax, %r13
jmp 0xe50b
movq %r15, %rdi
movq -0x30(%rbp), %rsi
callq 0xe724
movq %rax, %r13
movq %r15, %r14
jmp 0xe507
movq -0x38(%rbp), %rdi
movq %r15, %rsi
movq -0x30(%rbp), %rbx
movq %rbx, %rdx
callq 0xe60b
testq %rbx, %rbx
setne %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/lib1.c
// Function: bptree_set_leaf
static bool
bptree_set_leaf(struct bptree * const tree, struct bpnode * const leaf, const struct kv * const kv)
{
  debug_assert(leaf->nr < BPTREE_LEAF_FO);

  const u64 idx = bptree_leaf_locate(leaf, kv);
  if (kv_keymatch(kv, leaf->karray[idx])) {
    struct kv * const victim = (typeof(victim))(leaf->karray[idx]);
    if (victim && tree->mm.xf) tree->mm.xf(victim, kv, tree->mm.xp);
    else if (victim && tree->mm.rf) tree->mm.rf(victim, tree->mm.rp);
    leaf->karray[idx] = kv;
  } else {
    const u64 insert = idx + 1;
    bptree_raw_insert_leaf(leaf, insert, kv);
  }
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, -0x30(%rbp)
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rsi), %r12
cmpq $0x1f4, %r12            # imm = 0x1F4
jb 0xe63c
callq 0x6e43
movq 0x8(%r14), %r12
movq %rbx, -0x40(%rbp)
cmpq $0x2, %r12
movq %r12, -0x38(%rbp)
jae 0xe64f
xorl %r15d, %r15d
jmp 0xe684
xorl %r13d, %r13d
leaq -0x1(%r12), %rbx
cmpq %rbx, %r13
jae 0xe681
leaq (%r12,%r13), %r15
shrq %r15
movq 0x20(%r14,%r15,8), %rsi
movq -0x30(%rbp), %rdi
callq 0xab8c
testl %eax, %eax
js 0xe67c
movq %r15, %r13
jne 0xe657
jmp 0xe684
movq %r15, %r12
jmp 0xe652
movq %rbx, %r15
leaq 0x20(%r14), %r12
movq 0x20(%r14,%r15,8), %r13
movq -0x30(%rbp), %rdi
movq %r13, %rsi
callq 0xab0c
testb %al, %al
je 0xe6be
testq %r13, %r13
movq -0x40(%rbp), %rcx
je 0xe70d
movq 0x40(%rcx), %rax
testq %rax, %rax
je 0xe6fb
movq 0x48(%rcx), %rdx
movq %r13, %rdi
movq -0x30(%rbp), %rsi
callq *%rax
jmp 0xe70d
leaq 0x1(%r15), %rbx
movq -0x38(%rbp), %rdx
cmpq %rbx, %rdx
jae 0xe6d4
callq 0x6e43
movq 0x8(%r14), %rdx
leaq (%r12,%r15,8), %rdi
addq $0x10, %rdi
leaq (%r12,%rbx,8), %rsi
subq %rbx, %rdx
shlq $0x3, %rdx
callq 0x6450
movq -0x30(%rbp), %rax
movq %rax, 0x28(%r14,%r15,8)
incq 0x8(%r14)
jmp 0xe715
movq 0x10(%rcx), %rax
testq %rax, %rax
je 0xe70d
movq 0x18(%rcx), %rsi
movq %r13, %rdi
callq *%rax
movq -0x30(%rbp), %rax
movq %rax, (%r12,%r15,8)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/lib1.c
// Function: bptree_intm_locate
static u64
bptree_intm_locate(struct bpnode * const node, const struct kv * const key)
{
  if (node->nr < 2) {
    return 0;
  }
  u64 l = 0;
  u64 r = node->nr - 1;
  while (l < r) {
    const u64 m = (l + r + 1) >> 1;
    const int cmp = kv_keycompare(key, node->iarray[m].key);
    if (cmp < 0) {
      r = m - 1;
    } else if (cmp > 0) {
      l = m;
    } else {
      return m;
    }
  }
  return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, -0x30(%rbp)
movq 0x8(%rdi), %r12
cmpq $0x2, %r12
jae 0xe745
xorl %r15d, %r15d
jmp 0xe787
movq %rdi, %r14
addq $0x20, %r14
xorl %r13d, %r13d
leaq -0x1(%r12), %rbx
cmpq %rbx, %r13
jae 0xe784
leaq (%r12,%r13), %r15
shrq %r15
movq %r15, %rax
shlq $0x4, %rax
movq (%r14,%rax), %rsi
movq -0x30(%rbp), %rdi
callq 0xab8c
testl %eax, %eax
js 0xe77f
movq %r15, %r13
jne 0xe754
jmp 0xe787
movq %r15, %r12
jmp 0xe74f
movq %rbx, %r15
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/lib1.c
// Function: bptree_clean_rec
void
bptree_clean_rec(struct bptree * const tree, struct bpnode * const node)
{
  if (node->leaf) {
    for (u64 i = 0; i < node->nr; i++) {
      struct kv * const victim = (typeof(victim))(node->karray[i]);
      if (victim && tree->mm.rf) tree->mm.rf(victim, tree->mm.rp);
    }
  } else {
    for (u64 i = 0; i < node->nr; i++) {
      struct kv * const victim = (typeof(victim))(node->iarray[i].key);
      free(victim);
      bptree_clean_rec(tree, node->iarray[i].sub);
    }
  }
  pages_unmap(node, PGSZ);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x0, (%rsi)
je 0xe800
xorl %r15d, %r15d
cmpq 0x8(%rbx), %r15
jae 0xe82a
movq 0x20(%rbx,%r15,8), %rdi
testq %rdi, %rdi
je 0xe7fb
movq 0x10(%r14), %rax
testq %rax, %rax
je 0xe7fb
movq 0x18(%r14), %rsi
callq *%rax
incq %r15
jmp 0xe7dc
leaq 0x28(%rbx), %r15
xorl %r12d, %r12d
cmpq 0x8(%rbx), %r12
jae 0xe82a
movq -0x8(%r15), %rdi
callq 0x6060
movq (%r15), %rsi
movq %r14, %rdi
callq 0xe7c3
incq %r12
addq $0x10, %r15
jmp 0xe807
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x6410
// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/lib1.c
// Function: bptree_iter_create
struct bptree_iter *
bptree_iter_create(struct bptree * const tree)
{
  struct bptree_iter * const iter = (typeof(iter))malloc(sizeof(*iter));
  struct bpnode * node = tree->root;
  while (node->leaf == false) {
    node = node->iarray[0].sub;
  }
  u64 i = 1;
  while (i >= node->nr) {
    i = 0;
    node = node->next;
  }
  iter->curr = node;
  iter->i = i;
  debug_assert(node->karray[0] == NULL);
  return iter;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
pushq $0x10
popq %rdi
callq 0x63a0
movq %rax, %rbx
addq $0x50, %r14
movq (%r14), %rax
leaq 0x28(%rax), %r14
cmpb $0x0, (%rax)
je 0xe8b5
pushq $0x1
popq %rcx
cmpq 0x8(%rax), %rcx
jb 0xe8d2
movq 0x10(%rax), %rax
xorl %ecx, %ecx
jmp 0xe8c4
movq %rax, (%rbx)
movq %rcx, 0x8(%rbx)
cmpq $0x0, 0x20(%rax)
je 0xe8e5
callq 0x6e43
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/lib1.c
// Function: bptree_iter_next
struct kv *
bptree_iter_next(struct bptree_iter * const iter, struct kv * const out)
{
  struct bpnode * curr = iter->curr;
  if (curr == NULL) {
    return NULL;
  }
  debug_assert(curr->nr);
  u64 i = iter->i;
  struct kv * const ret = kv_dup2(curr->karray[i], out);
  i++;
  if (i >= curr->nr) {
    i = 0;
    curr = curr->next;
    iter->curr = curr;
  }
  iter->i = i;
  return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq (%rdi), %r15
testq %r15, %r15
je 0xe93c
movq %rsi, %r14
movq %rdi, %rbx
cmpq $0x0, 0x8(%r15)
jne 0xe912
callq 0x6e43
movq 0x8(%rbx), %r12
movq 0x20(%r15,%r12,8), %rdi
movq %r14, %rsi
callq 0xaa68
incq %r12
cmpq 0x8(%r15), %r12
jb 0xe936
movq 0x10(%r15), %rcx
movq %rcx, (%rbx)
xorl %r12d, %r12d
movq %r12, 0x8(%rbx)
jmp 0xe93e
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/lib1.c
// Function: tcpmap_create
struct tcpmap *
tcpmap_create(const char * const host, const int port)
{
  struct stream2 * const s = stream2_create(host, port);
  if (s == NULL) {
    return NULL;
  }

  struct tcpmap * const tcpmap = (typeof(tcpmap))malloc(sizeof(*tcpmap));
  tcpmap->stream2 = s;
  tcpmap->ok = true;
  return tcpmap;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
callq 0xa6b3
testq %rax, %rax
je 0xea0a
movq %rax, %rbx
pushq $0x10
popq %rdi
callq 0x63a0
movq %rbx, (%rax)
movb $0x1, 0x8(%rax)
jmp 0xea0c
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/lib1.c
// Function: tcpmap_get
struct kv *
tcpmap_get(struct tcpmap * const map, const struct kv * const key, struct kv * const out)
{
  bool ret = false;
  const bool req = __tcpmap_request('G', map, key, &ret);
  if (req == false || ret == false) {
    return NULL;
  }

  struct kv head = {};
  if (fread(&head, sizeof(head), 1, map->stream2->r) != 1) {
    map->ok = false;
    return NULL;
  }
  const bool alloc = (out == NULL) ? true : false;
  struct kv * const kv = alloc ? (typeof(kv))malloc(kv_size(&head)) : out;
  if (kv == NULL) {
    return NULL;
  }
  memcpy(kv, &head, sizeof(head));
  if (fread(kv->kv, kv->klen + kv->vlen, 1, map->stream2->r) != 1) {
    map->ok = false;
    if (alloc) free(kv);
    return NULL;
  }
  return kv;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %rdx
movq %rdi, %r14
leaq -0x19(%rbp), %rcx
movb $0x0, (%rcx)
pushq $0x47
popq %rdi
movq %r14, %rsi
callq 0xeaec
xorl %r15d, %r15d
testb %al, %al
je 0xeade
cmpb $0x0, -0x19(%rbp)
je 0xeade
vxorps %xmm0, %xmm0, %xmm0
leaq -0x30(%rbp), %rdi
vmovaps %xmm0, (%rdi)
movq (%r14), %rax
movq 0x8(%rax), %rcx
pushq $0x10
popq %rsi
pushq $0x1
popq %rdx
callq 0x60f0
cmpq $0x1, %rax
jne 0xead6
movq %rbx, %r15
testq %rbx, %rbx
jne 0xea97
movl -0x28(%rbp), %eax
movl -0x24(%rbp), %ecx
leaq (%rax,%rcx), %rdi
addq $0x10, %rdi
callq 0x63a0
movq %rax, %r15
testq %rax, %rax
je 0xeadb
vmovaps -0x30(%rbp), %xmm0
vmovups %xmm0, (%r15)
leaq 0x10(%r15), %rdi
movl 0xc(%r15), %esi
addl 0x8(%r15), %esi
movq (%r14), %rax
movq 0x8(%rax), %rcx
pushq $0x1
popq %rdx
callq 0x60f0
cmpq $0x1, %rax
je 0xeade
movb $0x0, 0x8(%r14)
testq %rbx, %rbx
jne 0xeadb
movq %r15, %rdi
callq 0x6060
jmp 0xeadb
movb $0x0, 0x8(%r14)
xorl %r15d, %r15d
movq %r15, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq