LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: rgen_new_uniform
struct rgen *
rgen_new_uniform(const u64 min, const u64 max)
{
  struct rgen * const gi = (typeof(gi))calloc(1, sizeof(*gi));
  gi->unit_u64 = max > UINT32_MAX ? true : false;
  gi->gen.uniform.min = min;
  gi->gen.uniform.max = max;
  gi->gen.uniform.interval = (double)(max - min);

  gi->type = GEN_UNIFORM;
  gi->next_wait = gen_uniform;
  gi->next_nowait = gen_uniform;
  return gi;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl $0x1, %edi
movl $0x220, %esi            # imm = 0x220
callq 0x62d0
movq %rbx, %rcx
shrq $0x20, %rcx
setne 0x14(%rax)
movq %r14, 0x18(%rax)
movq %rbx, 0x20(%rax)
subq %r14, %rbx
vcvtusi2sd %rbx, %xmm0, %xmm0
vmovsd %xmm0, 0x28(%rax)
movl $0xb, 0x10(%rax)
leaq 0xb5(%rip), %rcx        # 0xa5cd
movq %rcx, (%rax)
movq %rcx, 0x8(%rax)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: rgen_new_trace32
struct rgen *
rgen_new_trace32(const char * const filename)
{
  struct rgen * const gi = (typeof(gi))calloc(1, sizeof(*gi));
  gi->gen.trace32.fin = fopen(filename, "rb");
  if (gi->gen.trace32.fin == NULL) {
    free(gi);
    return NULL;
  }
  gi->gen.trace32.idx = 0;
  gi->gen.trace32.max = fread(gi->gen.trace32.buf, sizeof(u32), 32, gi->gen.trace32.fin);
  if (gi->gen.trace32.max == 0) {
    free(gi);
    return NULL;
  }
  posix_fadvise(fileno(gi->gen.trace32.fin), 0, 0, POSIX_FADV_SEQUENTIAL);
  gi->type = GEN_TRACE32;
  gi->next_wait = gen_trace32;
  gi->next_nowait = gen_trace32;
  return gi;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
movl $0x1, %edi
movl $0x220, %esi            # imm = 0x220
callq 0x62d0
movq %rax, %rbx
leaq 0x9c02(%rip), %rsi      # 0x14285
movq %r14, %rdi
callq 0x6480
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0xa6e6
movq %rbx, %rdi
addq $0x30, %rdi
movl $0x4, %esi
movl $0x20, %edx
movq %rax, %rcx
callq 0x60f0
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0xa6e6
movq 0x18(%rbx), %rdi
callq 0x6370
movl %eax, %edi
xorl %esi, %esi
xorl %edx, %edx
movl $0x2, %ecx
callq 0x6260
movl $0xc, 0x10(%rbx)
leaq 0x1b(%rip), %rax        # 0xa6f8
movq %rax, (%rbx)
movq %rax, 0x8(%rbx)
jmp 0xa6f0
movq %rbx, %rdi
callq 0x6060
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: gen_trace32
static u64
gen_trace32(struct rgen * const gi)
{
  if (gi->gen.trace32.idx >= gi->gen.trace32.max) {
    if (feof(gi->gen.trace32.fin)) rewind(gi->gen.trace32.fin);
    gi->gen.trace32.idx = 0;
    gi->gen.trace32.max = fread(gi->gen.trace32.buf, sizeof(u32), 32, gi->gen.trace32.fin);
  }
  const u64 r = gi->gen.trace32.buf[gi->gen.trace32.idx];
  gi->gen.trace32.idx++;
  return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdi), %rcx
cmpq 0x28(%rdi), %rcx
jb 0xa748
movq 0x18(%rbx), %rdi
callq 0x6330
testl %eax, %eax
je 0xa721
movq 0x18(%rbx), %rdi
callq 0x61c0
movq $0x0, 0x20(%rbx)
leaq 0x30(%rbx), %rdi
movq 0x18(%rbx), %rcx
movl $0x4, %esi
movl $0x20, %edx
callq 0x60f0
movq %rax, 0x28(%rbx)
movq 0x20(%rbx), %rcx
movl 0x30(%rbx,%rcx,4), %eax
incq %rcx
movq %rcx, 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: rgen_destroy
void
rgen_destroy(struct rgen * const gen)
{
  if (gen == NULL) return;
  if (gen->async_worker) {
    struct rgen_worker_info * const info = &(gen->wi);
    atomic_store(&(info->running), false);
    pthread_join(info->thread, NULL);
    rgen_clean_async_buffers(info);
  }
  if (gen->type == GEN_TRACE32) {
    fclose(gen->gen.trace32.fin);
  }
  free(gen);
}

// Assembly:
testq %rdi, %rdi
je 0xa7e5
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x1, 0x15(%rdi)
jne 0xa7c2
xorl %eax, %eax
xchgb %al, 0x1c8(%rbx)
movq 0x1c0(%rbx), %rdi
xorl %esi, %esi
callq 0x65a0
movq 0x110(%rbx), %rdi
testq %rdi, %rdi
je 0xa7c2
movq 0x118(%rbx), %rsi
callq 0x6410
vxorps %xmm0, %xmm0, %xmm0
vmovups %ymm0, 0xf0(%rbx)
movq $0x0, 0x110(%rbx)
cmpl $0xc, 0x10(%rbx)
jne 0xa7d4
movq 0x18(%rbx), %rdi
vzeroupper
callq 0x6140
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
vzeroupper
jmp 0x6060
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: rgen_dup
struct rgen *
rgen_dup(struct rgen * const gen0)
{
  if (gen0->async_worker) {
    return NULL;
  }
  struct rgen * const gen = (typeof(gen))malloc(sizeof(*gen));
  memcpy(gen, gen0, sizeof(*gen));
  struct rgen_worker_info * const info = &(gen->wi);
  memset(info, 0, sizeof(*info));
  if (gen->type == GEN_TRACE32) {
    FILE * const f2 = fdopen(dup(fileno(gen0->gen.trace32.fin)), "rb");
    posix_fadvise(fileno(f2), 0, 0, POSIX_FADV_SEQUENTIAL);
    gen->gen.trace32.fin = f2;
    gen->gen.trace32.idx = 0;
    gen->gen.trace32.max = 0;
  }
  return gen;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
cmpb $0x0, 0x15(%rdi)
je 0xab6f
xorl %ebx, %ebx
jmp 0xabee
movq %rdi, %r14
movl $0x220, %edi            # imm = 0x220
callq 0x63a0
movq %rax, %rbx
movl $0xf0, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x6340
leaq 0xf0(%rbx), %rdi
movl $0x130, %edx            # imm = 0x130
xorl %esi, %esi
callq 0x6210
cmpl $0xc, 0x10(%rbx)
jne 0xabee
movq 0x18(%r14), %rdi
callq 0x6370
movl %eax, %edi
callq 0x61f0
leaq 0x96c6(%rip), %rsi      # 0x14285
movl %eax, %edi
callq 0x6400
movq %rax, %r14
movq %rax, %rdi
callq 0x6370
movl %eax, %edi
xorl %esi, %esi
xorl %edx, %edx
movl $0x2, %ecx
callq 0x6260
movq %r14, 0x18(%rbx)
vxorps %xmm0, %xmm0, %xmm0
vmovups %xmm0, 0x20(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: rgen_async_convert
bool
rgen_async_convert(struct rgen * const gen, const u64 cpu)
{
  if (gen->async_worker) {
    return false; // already converted
  }
  struct rgen_worker_info * const info = &(gen->wi);
  memset(info, 0, sizeof(*info));
  info->real_next = gen->next_wait;
  const u64 g = UINT64_C(1) << 30;
  const u64 usize = gen->unit_u64 ? sizeof(u64) : sizeof(u32);
  info->mem = pages_alloc_best(g, true, &(info->alloc_size));
  info->buffer_nr = g / (RGEN_ASYNC_BUFFER_NR * usize);
  info->cpu = cpu;
  atomic_store(&(info->running), true);
  for (u64 j = 0; j < RGEN_ASYNC_BUFFER_NR; j++) {
    info->buffers_u64[j] = (u64 *)(&(info->mem[j * info->buffer_nr * usize]));
    atomic_store(&(info->avail[j]), false);
  }
  gen->next_wait = rgen_async_next_wait;
  gen->next_nowait = rgen_async_next_nowait;
  if (thread_create_at(cpu, &(info->thread), rgen_worker, gen) == 0) {
    char thname[32];
    sprintf(thname, "rgen_async_%"PRIu64, cpu);
    pthread_setname_np(info->thread, thname);
    info->reader_id = 0;
    info->i = 0;
    gen->async_worker = true;
    return true;
  } else {
    rgen_clean_async_buffers(info);
    return false;
  }
}

// Assembly:
cmpb $0x0, 0x15(%rdi)
je 0xabff
xorl %eax, %eax
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xf0(%rdi), %r14
movl $0x130, %edx            # imm = 0x130
movq %r14, %rdi
xorl %esi, %esi
callq 0x6210
movq (%rbx), %rax
movq %rax, 0x1a8(%rbx)
movzbl 0x14(%rbx), %r13d
leaq 0x118(%rbx), %r12
movl $0x40000000, %edi       # imm = 0x40000000
movl $0x1, %esi
movq %r12, %rdx
callq 0x82a0
movq %rax, 0x110(%rbx)
movl %r13d, %eax
xorb $0x1, %al
movzbl %al, %eax
shll $0x19, %eax
addq $0x2000000, %rax        # imm = 0x2000000
movq %rax, 0x1b0(%rbx)
movq %r15, 0x1b8(%rbx)
movb $0x1, %al
xchgb %al, 0x1c8(%rbx)
orq $0x2, %r13
xorl %eax, %eax
movq 0x1b0(%rbx), %rcx
imulq %rax, %rcx
shlxq %r13, %rcx, %rcx
addq 0x110(%rbx), %rcx
movq %rcx, 0xf0(%rbx,%rax,8)
xorl %ecx, %ecx
xchgb %cl, 0x160(%rbx,%rax)
incq %rax
cmpq $0x4, %rax
jne 0xac88
leaq 0xa0(%rip), %rax        # 0xad60
movq %rax, (%rbx)
leaq 0x129(%rip), %rax       # 0xadf3
movq %rax, 0x8(%rbx)
leaq 0x1c0(%rbx), %rsi
leaq 0x163(%rip), %rdx       # 0xae3f
movq %r15, %rdi
movq %rbx, %rcx
callq 0x80dc
testl %eax, %eax
je 0xad15
movq 0x110(%rbx), %rdi
testq %rdi, %rdi
je 0xad11
movq (%r12), %rsi
callq 0x6410
vxorps %xmm0, %xmm0, %xmm0
vmovups %ymm0, (%r14)
movq $0x0, 0x20(%r14)
xorl %eax, %eax
jmp 0xad4e
leaq 0x96f1(%rip), %rsi      # 0x1440d
leaq -0x50(%rbp), %r14
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x6520
movq 0x1c0(%rbx), %rdi
movq %r14, %rsi
callq 0x61d0
vxorps %xmm0, %xmm0, %xmm0
vmovups %xmm0, 0x210(%rbx)
movb $0x1, 0x15(%rbx)
movb $0x1, %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
vzeroupper
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: rgen_async_next_wait
static u64
rgen_async_next_wait(struct rgen * const gen)
{
  struct rgen_worker_info * const info = &(gen->wi);
  u64 i = info->i;
  if (i == 0) rgen_async_wait(gen);

  const u64 id0 = info->reader_id;
  const u64 r = gen->unit_u64 ? info->buffers_u64[id0][i] : info->buffers_u32[id0][i];
  i++;
  if (i >= info->buffer_nr) {
    atomic_store(&(info->avail[id0]), false);
    info->reader_id = (id0 + 1) % RGEN_ASYNC_BUFFER_NR;
    i = 0;
  }
  info->i = i;
  return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x218(%rdi), %r14
testq %r14, %r14
je 0xadce
movq 0x210(%rbx), %rcx
movq 0xf0(%rbx,%rcx,8), %rax
cmpb $0x1, 0x14(%rbx)
jne 0xad94
movq (%rax,%r14,8), %rax
jmp 0xad98
movl (%rax,%r14,4), %eax
incq %r14
cmpq 0x1b0(%rbx), %r14
jb 0xadbc
xorl %edx, %edx
xchgb %dl, 0x160(%rbx,%rcx)
xorl %r14d, %r14d
incl %ecx
andl $0x3, %ecx
movq %rcx, 0x210(%rbx)
movq %r14, 0x218(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x0, 0x15(%rbx)
je 0xad79
movq 0x210(%rbx), %r15
movb 0x160(%rbx,%r15), %al
testb $0x1, %al
jne 0xad79
movl $0x1, %edi
callq 0x6600
jmp 0xaddb
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: rgen_async_next_nowait
static u64
rgen_async_next_nowait(struct rgen * const gen)
{
  struct rgen_worker_info * const info = &(gen->wi);
  u64 i = info->i;

  const u64 id0 = info->reader_id;
  const u64 r = gen->unit_u64 ? info->buffers_u64[id0][i] : info->buffers_u32[id0][i];
  i++;
  if (i >= info->buffer_nr) {
    info->reader_id = (id0 + 1) % RGEN_ASYNC_BUFFER_NR;
    i = 0;
  }
  info->i = i;
  return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x218(%rdi), %rdx
movq 0x210(%rdi), %rcx
movq 0xf0(%rdi,%rcx,8), %rax
cmpb $0x1, 0x14(%rdi)
jne 0xae19
movq (%rax,%rdx,8), %rax
jmp 0xae1c
movl (%rax,%rdx,4), %eax
incq %rdx
cmpq 0x1b0(%rdi), %rdx
jb 0xae36
incl %ecx
andl $0x3, %ecx
movq %rcx, 0x210(%rdi)
xorl %edx, %edx
movq %rdx, 0x218(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: rgen_worker
static void *
rgen_worker(void * const ptr)
{
  struct rgen * const gen = (typeof(gen))ptr;
  struct rgen_worker_info * const info = &(gen->wi);
  const u64 cpu = info->cpu;
  srandom_u64((cpu + 3) * 97);
  const u64 nr = info->buffer_nr;
  while (true) {
    for (u64 i = 0; i < RGEN_ASYNC_BUFFER_NR; i++) {
      while (atomic_load(&(info->avail[i])) == true) {
        usleep(10);
        if (atomic_load(&(info->running)) == false) {
          return NULL;
        }
      }
      if (gen->unit_u64) {
        u64 * const buf64 = info->buffers_u64[i];
        for (u64 j = 0; j < nr; j++) {
          buf64[j] = info->real_next(gen);
        }
      } else {
        u32 * const buf32 = info->buffers_u32[i];
        for (u64 j = 0; j < nr; j++) {
          buf32[j] = (u32)(info->real_next(gen));
        }
      }
      atomic_thread_fence(memory_order_seq_cst);
      atomic_store(&(info->avail[i]), true);
    }
  }
  return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
imulq $0x61, 0x1b8(%rdi), %rax
addq $0x123, %rax            # imm = 0x123
jne 0xae7f
leaq -0x38(%rbp), %r14
movl $0x4, %edi
movq %r14, %rsi
callq 0x6110
imulq $0x3b9aca00, (%r14), %rax # imm = 0x3B9ACA00
addq 0x8(%r14), %rax
movq %rax, %rcx
shrq $0xc, %rcx
xorq %rax, %rcx
movq %rcx, %rax
shlq $0x19, %rax
xorq %rcx, %rax
movq %rax, %rcx
shrq $0x1b, %rcx
xorq %rax, %rcx
movabsq $0x2545f4914f6cdd1d, %rax # imm = 0x2545F4914F6CDD1D
imulq %rcx, %rax
movq %rax, %fs:-0x8
movq 0x1b0(%rbx), %r14
xorl %r15d, %r15d
movb 0x160(%rbx,%r15), %al
testb $0x1, %al
je 0xaee0
movl $0xa, %edi
callq 0x6600
movb 0x1c8(%rbx), %al
testb $0x1, %al
jne 0xaebe
jmp 0xaf4c
movq 0xf0(%rbx,%r15,8), %r12
cmpb $0x1, 0x14(%rbx)
jne 0xaf0d
testq %r14, %r14
je 0xaf2a
xorl %r13d, %r13d
movq %rbx, %rdi
callq *0x1a8(%rbx)
movq %rax, (%r12,%r13,8)
incq %r13
cmpq %r13, %r14
jne 0xaef6
jmp 0xaf2a
testq %r14, %r14
je 0xaf2a
xorl %r13d, %r13d
movq %rbx, %rdi
callq *0x1a8(%rbx)
movl %eax, (%r12,%r13,4)
incq %r13
cmpq %r13, %r14
jne 0xaf15
mfence
movb $0x1, %al
xchgb %al, 0x160(%rbx,%r15)
incq %r15
cmpq $0x4, %r15
movl $0x0, %eax
cmoveq %rax, %r15
jmp 0xaebe
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_O3/wuxb45[P]SLB/lib1.c
// Function: rcu_read_ref
void *
rcu_read_ref(struct rcu_node * const node)
{
  do {
    for (u64 i = 0; i < 2; i++) {
      u64 x = node->x[i];
      if (x & RCU_VALID_MASK) {
        const bool r = atomic_compare_exchange_strong(&(node->x[i]), &x, x + 1);
        if (r == true) {
          return (void *)(x >> RCU_VALUE_SHIFT);
        }
      }
    }
  } while (true);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb $0x1, %cl
xorl %edx, %edx
movq (%rdi,%rdx,8), %rax
testw %ax, %ax
jns 0xafb6
leaq 0x1(%rax), %rsi
lock
cmpxchgq %rsi, (%rdi,%rdx,8)
je 0xafc1
movzbl %cl, %edx
xorb $0x1, %cl
andl $0x1, %edx
jmp 0xafa1
shrq $0x10, %rax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: rcu_read_unref
void
rcu_read_unref(struct rcu_node * const node, void * ptr)
{
  for (u64 i = 0; i < 2; i++) {
    const u64 x = node->x[i];
    if ((x >> RCU_VALUE_SHIFT) == ((u64)ptr)) {
      bool r = false;
      do {
        u64 xx = node->x[i];
        debug_assert(xx & RCU_COUNT_MASK);
        r = atomic_compare_exchange_strong(&(node->x[i]), &xx, xx - 1);
      } while (r == false);
      return;
    }
  }
  debug_assert(false);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb $0x1, %al
xorl %r15d, %r15d
movq (%rbx,%r15,8), %rcx
shrq $0x10, %rcx
cmpq %rsi, %rcx
je 0xb00b
movl $0x1, %r15d
testb $0x1, %al
movl $0x0, %eax
jne 0xafd9
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x66ef
callq 0x66ef
jmp 0xb018
movq (%rbx,%r15,8), %r14
testl $0x7fff, %r14d          # imm = 0x7FFF
je 0xb004
leaq -0x1(%r14), %rcx
movq %r14, %rax
lock
cmpxchgq %rcx, (%rbx,%r15,8)
jne 0xb00b
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: rcu_update
void
rcu_update(struct rcu_node * const node, void * ptr)
{
  for (u64 i = 0; i < 2; i++) {
    const u64 x = node->x[i];
    if ((x & RCU_VALID_MASK) == 0) {
      debug_assert((node->x[1-i] >> RCU_VALUE_SHIFT) != ((u64)ptr));
      const u64 xx = (((u64)ptr) << RCU_VALUE_SHIFT) | RCU_VALID_MASK;
      atomic_store(&(node->x[i]), xx);
      atomic_thread_fence(memory_order_seq_cst);
      __rcu_gc(&(node->x[1-i]));
      return;
    }
  }
  debug_assert(false);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movb $0x1, %al
xorl %r15d, %r15d
movq (%rbx,%r15,8), %rcx
testw %cx, %cx
jns 0xb06d
movl $0x1, %r15d
testb $0x1, %al
movl $0x0, %eax
jne 0xb048
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x66ef
movq %r15, %r12
xorq $0x1, %r12
movq (%rbx,%r12,8), %rax
shrq $0x10, %rax
cmpq %r14, %rax
je 0xb0bf
shlq $0x10, %r14
orq $0x8000, %r14           # imm = 0x8000
xchgq %r14, (%rbx,%r15,8)
mfence
movq (%rbx,%r12,8), %rax
movq %rax, %rcx
andq $-0x8001, %rcx          # imm = 0xFFFF7FFF
lock
cmpxchgq %rcx, (%rbx,%r12,8)
jne 0xb093
mfence
movq (%rbx,%r12,8), %rax
shlq $0x31, %rax
jne 0xb0ac
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x66ef
jmp 0xb081
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: server_create
struct server *
server_create(const char * const host, const int port, void*(*worker)(void*), void * const priv)
{
  char portstr[6];
  snprintf(portstr, 6, "%d", port);
  struct addrinfo info0 = {.ai_family = AF_INET, .ai_socktype = SOCK_STREAM};
  struct addrinfo *info = NULL;
  if (getaddrinfo(host, portstr, &info0, &info) != 0) return NULL;
  int fd = -1;

  for (struct addrinfo * p = info; p != NULL; p = p->ai_next) {
    fd = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
    if (fd < 0) continue;
    int one = 1;
    (void)setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
    if (bind(fd, p->ai_addr, p->ai_addrlen) != 0) break;
    if (listen(fd, 64) != 0) break;
    struct server * const server = malloc(sizeof(*server));
    server->running = true;
    server->fd = fd;
    server->worker = worker;
    server->priv = priv;
    if (pthread_create(&(server->pt), NULL, __server_master, server) != 0) {
      free(server);
      break;
    }
    freeaddrinfo(info);
    return server;
  }
  if (fd >= 0) {
    close(fd);
  }
  if (info) {
    freeaddrinfo(info);
  }
  return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, -0x38(%rbp)
movq %rdx, %r14
movl %esi, %ecx
movq %rdi, %r12
leaq 0x9104(%rip), %rdx      # 0x141ee
xorl %r15d, %r15d
leaq -0x42(%rbp), %r13
movl $0x6, %esi
movq %r13, %rdi
xorl %eax, %eax
callq 0x61e0
vxorps %xmm0, %xmm0, %xmm0
leaq -0x80(%rbp), %rdx
vmovups %ymm0, (%rdx)
vmovups %ymm0, 0x10(%rdx)
movabsq $0x100000002, %rax      # imm = 0x100000002
movq %rax, 0x4(%rdx)
leaq -0x30(%rbp), %rbx
movq $0x0, (%rbx)
movq %r12, %rdi
movq %r13, %rsi
movq %rbx, %rcx
vzeroupper
callq 0x6590
testl %eax, %eax
setne %al
movq (%rbx), %rbx
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0xb213
movl 0x4(%rbx), %edi
movl 0x8(%rbx), %esi
movl 0xc(%rbx), %edx
callq 0x6620
testl %eax, %eax
jns 0xb171
movq 0x28(%rbx), %rbx
testq %rbx, %rbx
jne 0xb151
jmp 0xb202
movl %eax, %r12d
leaq -0x3c(%rbp), %rcx
movl $0x1, (%rcx)
movl %eax, %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x6100
movq 0x18(%rbx), %rsi
movl 0x10(%rbx), %edx
movl %r12d, %edi
callq 0x6420
testl %eax, %eax
jne 0xb1fa
movl %r12d, %edi
movl $0x40, %esi
callq 0x63c0
testl %eax, %eax
jne 0xb1fa
movl $0x20, %edi
callq 0x63a0
movq %rax, %r15
movb $0x1, 0x4(%rax)
movl %r12d, (%rax)
movq %r14, 0x10(%rax)
movq -0x38(%rbp), %rax
movq %rax, 0x18(%r15)
leaq 0x8(%r15), %rdi
leaq 0x4c(%rip), %rdx        # 0xb230
xorl %esi, %esi
movq %r15, %rcx
callq 0x6430
testl %eax, %eax
je 0xb225
movq %r15, %rdi
callq 0x6060
movl %r12d, %edi
callq 0x6220
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0xb210
callq 0x6610
xorl %r15d, %r15d
movq %r15, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x6610
jmp 0xb213
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: _server_master
static void *
__server_master(void * const ptr)
{
  const u64 nr_cores = process_affinity_core_count();
  u64 * const cores = (typeof(cores))calloc(nr_cores, sizeof(cores[0]));
  const u64 nr_cores1 = process_affinity_core_list(nr_cores, cores);
  u64 next_core_id = 0;

  struct server * const server = (typeof(server))ptr;
  while (server->running) {
    const int cli = accept(server->fd, NULL, NULL);
    if (cli < 0) {
      if (errno == EINTR) continue;
      break;
    }
    pthread_t worker;
    struct server_wi * const wi = (typeof(wi))malloc(sizeof(*wi));
    wi->server = server;
    wi->s2.r = fdopen(dup(cli), "rb");
    wi->s2.w = fdopen(cli, "wb");
    wi->priv = server->priv;
    const int r = thread_create_at(cores[next_core_id], &worker, server->worker, wi);
    if (r != 0) {
      fclose(wi->s2.r);
      fclose(wi->s2.w);
      free(wi);
    } else {
      next_core_id = (next_core_id + 1) % nr_cores1;
    }
  }
  close(server->fd);
  return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
callq 0x7b67
movq %rax, %r15
movl $0x8, %esi
movq %rax, %rdi
callq 0x62d0
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
callq 0x7bdf
movq %rax, %r13
xorl %r12d, %r12d
cmpb $0x1, 0x4(%rbx)
jne 0xb333
movl (%rbx), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x64b0
testl %eax, %eax
jns 0xb295
callq 0x6090
cmpl $0x4, (%rax)
je 0xb26d
jmp 0xb333
movl %eax, %r15d
movq %r13, -0x30(%rbp)
movl $0x20, %edi
callq 0x63a0
movq %rax, %r13
movq %rbx, (%rax)
movl %r15d, %edi
callq 0x61f0
movl %eax, %edi
leaq 0x8fc8(%rip), %rsi      # 0x14285
callq 0x6400
movq %rax, 0x10(%r13)
movl %r15d, %edi
leaq 0x914c(%rip), %rsi      # 0x1441c
callq 0x6400
movq %rax, 0x8(%r13)
movq 0x18(%rbx), %rax
movq %rax, 0x18(%r13)
movq (%r14,%r12,8), %rdi
movq 0x10(%rbx), %rdx
leaq -0x38(%rbp), %rsi
movq %r13, %rcx
callq 0x80dc
testl %eax, %eax
je 0xb31c
movq 0x10(%r13), %rdi
callq 0x6140
movq 0x8(%r13), %rdi
callq 0x6140
movq %r13, %rdi
callq 0x6060
movq -0x30(%rbp), %r13
jmp 0xb26d
incq %r12
movq %r12, %rax
xorl %edx, %edx
movq -0x30(%rbp), %r13
divq %r13
movq %rdx, %r12
jmp 0xb26d
movl (%rbx), %edi
callq 0x6220
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_O3/wuxb45[P]SLB/lib1.c
// Function: stream2_create
struct stream2 *
stream2_create(const char * const host, const int port)
{
  char portstr[6];
  snprintf(portstr, 6, "%d", port);
  struct addrinfo info0 = {.ai_family = AF_INET, .ai_socktype = SOCK_STREAM};
  struct addrinfo *info = NULL;
  if (getaddrinfo(host, portstr, &info0, &info) != 0) return NULL;

  for (struct addrinfo * p = info; p != NULL; p = p->ai_next) {
    const int fd = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
    if (fd < 0) continue;
    int one = 1;
    (void)setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
    if (connect(fd, p->ai_addr, p->ai_addrlen) != 0) {
      close(fd);
      continue;
    }
    freeaddrinfo(info);
    struct stream2 * const stream2 = (typeof(stream2))malloc(sizeof(*stream2));
    stream2->w = fdopen(dup(fd), "wb");
    stream2->r= fdopen(fd, "rb");
    return stream2;
  }
  if (info) freeaddrinfo(info);
  return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movl %esi, %ecx
movq %rdi, %r14
leaq 0x8e09(%rip), %rdx      # 0x141ee
xorl %ebx, %ebx
leaq -0x36(%rbp), %r15
movl $0x6, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x61e0
vxorps %xmm0, %xmm0, %xmm0
leaq -0x70(%rbp), %rdx
vmovups %ymm0, (%rdx)
vmovups %ymm0, 0x10(%rdx)
movabsq $0x100000002, %rax      # imm = 0x100000002
movq %rax, 0x4(%rdx)
leaq -0x30(%rbp), %r12
movq $0x0, (%r12)
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rcx
vzeroupper
callq 0x6590
testl %eax, %eax
setne %al
movq (%r12), %r15
testq %r15, %r15
sete %cl
orb %al, %cl
jne 0xb503
leaq -0x24(%rbp), %rbx
movl 0x4(%r15), %edi
movl 0x8(%r15), %esi
movl 0xc(%r15), %edx
callq 0x6620
testl %eax, %eax
js 0xb4a6
movl %eax, %r14d
movl $0x1, -0x24(%rbp)
movl %eax, %edi
movl $0x1, %esi
movl $0x2, %edx
movq %rbx, %rcx
movl $0x4, %r8d
callq 0x6100
movq 0x18(%r15), %rsi
movl 0x10(%r15), %edx
movl %r14d, %edi
callq 0x6540
testl %eax, %eax
je 0xb4c1
movl %r14d, %edi
callq 0x6220
movq 0x28(%r15), %r15
testq %r15, %r15
jne 0xb451
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0xb4bd
callq 0x6610
xorl %ebx, %ebx
jmp 0xb503
movq -0x30(%rbp), %rdi
callq 0x6610
movl $0x10, %edi
callq 0x63a0
movq %rax, %rbx
movl %r14d, %edi
callq 0x61f0
leaq 0x8f36(%rip), %rsi      # 0x1441c
movl %eax, %edi
callq 0x6400
movq %rax, (%rbx)
leaq 0x8d8e(%rip), %rsi      # 0x14285
movl %r14d, %edi
callq 0x6400
movq %rax, 0x8(%rbx)
movq %rbx, %rax
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: kv_dup
inline struct kv *
kv_dup(const struct kv * const kv)
{
  if (kv == NULL) return NULL;

  const size_t sz = kv_size(kv);
  struct kv * const new = (typeof(new))malloc(sz);
  if (new) {
    memcpy(new, kv, sz);
  }
  return new;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0xb830
movq %rdi, %rbx
movl 0x8(%rdi), %eax
movl 0xc(%rdi), %ecx
leaq (%rax,%rcx), %r14
addq $0x10, %r14
movq %r14, %rdi
callq 0x63a0
testq %rax, %rax
je 0xb830
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
popq %rbx
popq %r14
popq %rbp
jmp 0x6340
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: kv_dup_key
inline struct kv *
kv_dup_key(const struct kv * const kv)
{
  if (kv == NULL) return NULL;

  const size_t sz = key_size(kv);
  struct kv * const new = (typeof(new))malloc(sz);
  if (new) {
    memcpy(new, kv, sz);
  }
  return new;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0xb86d
movq %rdi, %rbx
movl 0x8(%rdi), %r14d
addq $0x10, %r14
movq %r14, %rdi
callq 0x63a0
testq %rax, %rax
je 0xb86d
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
popq %rbx
popq %r14
popq %rbp
jmp 0x6340
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: kv_dup2
inline struct kv *
kv_dup2(const struct kv * const from, struct kv * const to)
{
  if (from == NULL) return NULL;

  const size_t sz = kv_size(from);
  if (to) {
    memcpy(to, from, sz);
    return to;
  } else {
    struct kv * const new = (typeof(new))malloc(sz);
    if (new) {
      memcpy(new, from, sz);
    }
    return new;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0xb8b8
movq %rdi, %rbx
movl 0x8(%rdi), %eax
movl 0xc(%rdi), %ecx
leaq (%rax,%rcx), %r14
addq $0x10, %r14
testq %rsi, %rsi
jne 0xb8a6
movq %r14, %rdi
callq 0x63a0
movq %rax, %rsi
testq %rax, %rax
je 0xb8b8
movq %rsi, %rdi
movq %rbx, %rsi
movq %r14, %rdx
popq %rbx
popq %r14
popq %rbp
jmp 0x6340
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: kv_dup2_key
inline struct kv *
kv_dup2_key(const struct kv * const from, struct kv * const to)
{
  if (from == NULL) return NULL;

  const size_t sz = key_size(from);
  if (to) {
    memcpy(to, from, sz);
    return to;
  } else {
    struct kv * const new = (typeof(new))malloc(sz);
    if (new) {
      memcpy(new, from, sz);
    }
    return new;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0xb8fd
movq %rdi, %rbx
movl 0x8(%rdi), %r14d
addq $0x10, %r14
testq %rsi, %rsi
jne 0xb8eb
movq %r14, %rdi
callq 0x63a0
movq %rax, %rsi
testq %rax, %rax
je 0xb8fd
movq %rsi, %rdi
movq %rbx, %rsi
movq %r14, %rdx
popq %rbx
popq %r14
popq %rbp
jmp 0x6340
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: kv_keycompare
int
kv_keycompare(const struct kv * const kv1, const struct kv * const kv2)
{
  if (kv1 == NULL) {
    return (kv2 == NULL) ? 0 : -1;
  } else if (kv2 == NULL) {
    return 1;
  }
  const u32 len = kv1->klen < kv2->klen ? kv1->klen : kv2->klen;
  const int cmp = memcmp(kv1->kv, kv2->kv, (size_t)len);
  if (cmp == 0) {
    if (kv1->klen < kv2->klen) {
      return -1;
    } else if (kv1->klen > kv2->klen) {
      return 1;
    } else {
      return 0;
    }
  } else {
    return cmp;
  }
}

// Assembly:
testq %rdi, %rdi
je 0xb9e6
testq %rsi, %rsi
je 0xb9ee
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl 0x8(%rdi), %ebx
movl 0x8(%rsi), %r14d
cmpl %r14d, %ebx
setb %r15b
movl %r14d, %edx
cmovbl %ebx, %edx
addq $0x10, %rdi
addq $0x10, %rsi
callq 0x62a0
movl %eax, %ecx
testl %eax, %eax
setne %dl
orb %r15b, %dl
xorl %eax, %eax
cmpl $0x1, %ecx
sbbl %eax, %eax
testb %dl, %dl
je 0xb9f4
orl %ecx, %eax
jmp 0xb9fc
xorl %eax, %eax
negq %rsi
sbbl %eax, %eax
retq
movl $0x1, %eax
retq
xorl %eax, %eax
cmpl %r14d, %ebx
seta %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: kvmap_api_helper_map
static int
kvmap_api_helper_map(int argc, char ** const argv, struct kvmap_api ** const out, struct kvmap_mm * const mm)
{
  if (argc < 1) {
    return -1;
  }
  struct kvmap_api * tmp = NULL;
  int used = 0;
  if (strcmp("kvmap2", argv[0]) == 0) {
    tmp = kvmap2_api_create(kvmap2_create(mm));
    used = 1;
  } else if (strcmp("cuckoo", argv[0]) == 0) {
    tmp = cuckoo_api_create(cuckoo_create(mm));
    used = 1;
  } else if (strcmp("skiplist", argv[0]) == 0) {
    tmp = skiplist_api_create(skiplist_create(mm));
    used = 1;
  } else if (strcmp("chainmap", argv[0]) == 0) {
    tmp = chainmap_api_create(chainmap_create(mm));
    used = 1;
  } else if (strcmp("bptree", argv[0]) == 0) {
    tmp = bptree_api_create(bptree_create(mm));
    used = 1;
  } else if (strcmp("tcpmap", argv[0]) == 0) {
    if (argc < 3) return -1;
    tmp = tcpmap_api_create(tcpmap_create(argv[1], atoi(argv[2])));
    used = 3;
  }
  if (used > 0 && tmp) {
    *out = tmp;
    return used;
  } else {
    return -1;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %r12d
movq (%rsi), %r13
leaq 0x8a7a(%rip), %rdi      # 0x1473b
movq %r13, %rsi
callq 0x62f0
testl %eax, %eax
je 0xbd7e
leaq 0x8a6a(%rip), %rdi      # 0x14742
movq %r13, %rsi
callq 0x62f0
testl %eax, %eax
je 0xbd90
leaq 0x8a5a(%rip), %rdi      # 0x14749
movq %r13, %rsi
callq 0x62f0
testl %eax, %eax
je 0xbda2
leaq 0x8a4c(%rip), %rdi      # 0x14752
movq %r13, %rsi
callq 0x62f0
testl %eax, %eax
je 0xbdbb
leaq 0x8a3e(%rip), %rdi      # 0x1475b
movq %r13, %rsi
callq 0x62f0
testl %eax, %eax
je 0xbdcd
leaq 0x8a2e(%rip), %rdi      # 0x14762
movq %r13, %rsi
callq 0x62f0
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x3, %r12d
jl 0xbdf4
testl %ecx, %ecx
jne 0xbdf4
movq 0x8(%r14), %r15
movq 0x10(%r14), %rdi
callq 0x64e0
movq %r15, %rdi
movl %eax, %esi
callq 0x10d99
movq %rax, %rdi
callq 0x1105b
movq %rax, %rcx
movl $0x3, %eax
jmp 0xbde5
movq %r15, %rdi
callq 0xc120
movq %rax, %rdi
callq 0xdb18
jmp 0xbddd
movq %r15, %rdi
callq 0xdbaf
movq %rax, %rdi
callq 0xea6d
jmp 0xbddd
leaq -0x411(%rip), %rsi      # 0xb998
movq %r15, %rdi
callq 0xeb04
movq %rax, %rdi
callq 0xf51b
jmp 0xbddd
movq %r15, %rdi
callq 0xf5b2
movq %rax, %rdi
callq 0x1002e
jmp 0xbddd
movq %r15, %rdi
callq 0x100c5
movq %rax, %rdi
callq 0x10d02
movq %rax, %rcx
movl $0x1, %eax
testq %rcx, %rcx
je 0xbdef
movq %rcx, (%rbx)
jmp 0xbdf4
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: icache_create
struct icache *
icache_create(const struct kvmap_mm * const mm, const u64 nr_mb)
{
  debug_assert(ICACHE_ENTRY_NR == 15 || ICACHE_ENTRY_NR == 7);
  debug_assert((sizeof(struct __icache_slot) % 64) == 0);
  debug_assert((sizeof(struct __icache_hist) % 8) == 0);

  struct icache * const cache = (typeof(cache))malloc(sizeof(*cache));
  memset(cache, 0, sizeof(*cache));
  cache->mm = mm ? (*mm) : __kvmap_mm_default;
  for (u64 i = 0; i < KVMAP_HLOCK_NR; i++) {
    spinlock_init(&(cache->hlocks[i]));
  }
  const u64 table_size = nr_mb << 20;
  const u64 nr_slots = table_size / sizeof(cache->table[0]);
  struct __icache_slot * const table = pages_alloc_best(table_size, false, &(cache->slots_alloc_size));
  if (table == NULL) {
    free(cache);
    return NULL;
  }
  debug_assert(nr_slots % KVMAP_HLOCK_NR == 0);
  cache->table = table;
  cache->nr_slots = nr_slots;

  const u64 nr_hists = nr_slots * 16;
  const u64 hists_size = nr_hists * sizeof(cache->hists[0]);
  struct __icache_hist * const hists = pages_alloc_best(hists_size, false, &(cache->hists_alloc_size));
  if (hists == NULL) {
    pages_unmap(table, cache->slots_alloc_size);
    free(cache);
    return NULL;
  }

  cache->nr_hists = nr_hists;
  cache->hists = hists;
  return cache;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, %edi
movl $0x10158, %esi          # imm = 0x10158
callq 0x62d0
movq %rax, %rbx
testq %r15, %r15
je 0xbe48
vmovups (%r15), %ymm0
vmovups 0x20(%r15), %ymm1
vmovups 0x30(%r15), %ymm2
vmovups %ymm2, 0x30(%rbx)
vmovups %ymm1, 0x20(%rbx)
jmp 0xbe6a
vmovups 0xdf68(%rip), %ymm0     # 0x19db8
vmovups %ymm0, 0x30(%rbx)
vmovups 0xdf4b(%rip), %ymm0     # 0x19da8
vmovups %ymm0, 0x20(%rbx)
vmovups 0xdf1e(%rip), %ymm0     # 0x19d88
vmovups %ymm0, (%rbx)
movl $0xe0, %r15d
leaq (%rbx,%r15), %rdi
movl $0x1, %esi
vzeroupper
callq 0x62e0
addq $0x40, %r15
cmpq $0x100e0, %r15          # imm = 0x100E0
jne 0xbe74
movq %r14, %r15
shlq $0x14, %r15
leaq 0x10128(%rbx), %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x82a0
testq %rax, %rax
je 0xbf07
movq %rax, %r12
movq %r15, %rax
shrq $0x6, %rax
movq %r12, 0x10130(%rbx)
movq %rax, 0x10120(%rbx)
shlq $0x16, %r14
movq %rbx, %rdx
addq $0x10140, %rdx          # imm = 0x10140
movq %r14, %rdi
xorl %esi, %esi
callq 0x82a0
testq %rax, %rax
je 0xbef8
shrq $0x2, %r15
movq %r15, 0x10138(%rbx)
movq %rax, 0x10148(%rbx)
jmp 0xbf11
movq 0x10128(%rbx), %rsi
movq %r12, %rdi
callq 0x6410
movq %rbx, %rdi
callq 0x6060
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: icache_wrap_mm
inline void
icache_wrap_mm(struct icache * const cache, struct kvmap_mm * const mm)
{
  cache->map_mm = *mm;
  if (mm->rf) {
    mm->rf = __icache_kv_retire_cb;
    mm->rp = cache;
    mm->uf = __icache_kv_uncache_cb;
    mm->up = cache;
  }
  mm->hf = __icache_kv_hit_cb;
  mm->hp = cache;
  mm->xf = __icache_kv_refresh_cb;
  mm->xp = cache;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
vmovups (%rsi), %ymm0
vmovups 0x20(%rsi), %ymm1
vmovups 0x30(%rsi), %ymm2
vmovups %ymm2, 0x80(%rdi)
vmovups %ymm1, 0x70(%rdi)
vmovups %ymm0, 0x50(%rdi)
cmpq $0x0, 0x10(%rsi)
je 0xbf66
leaq 0x5c42(%rip), %rax      # 0x11b91
movq %rax, 0x10(%rsi)
movq %rdi, 0x18(%rsi)
leaq 0x5ce6(%rip), %rax      # 0x11c44
movq %rax, 0x30(%rsi)
movq %rdi, 0x38(%rsi)
leaq 0x5d90(%rip), %rax      # 0x11cfd
movq %rax, 0x20(%rsi)
movq %rdi, 0x28(%rsi)
leaq 0x5d94(%rip), %rax      # 0x11d10
movq %rax, 0x40(%rsi)
movq %rdi, 0x48(%rsi)
popq %rbp
vzeroupper
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: icache_destroy
void
icache_destroy(struct icache * const cache)
{
  icache_clean(cache);
  pages_unmap(cache->table, cache->slots_alloc_size);
  pages_unmap(cache->hists, cache->hists_alloc_size);
  if (cache->map_api) {
    kvmap_api_destroy(cache->map_api);
  }
  free(cache);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x11497
movq 0x10128(%rbx), %rsi
movq 0x10130(%rbx), %rdi
callq 0x6410
movq 0x10140(%rbx), %rsi
movq 0x10148(%rbx), %rdi
callq 0x6410
movq 0x10150(%rbx), %r14
testq %r14, %r14
je 0xbfd9
movq (%r14), %rdi
callq *0x30(%r14)
movq %r14, %rdi
callq 0x6060
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x6060
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: kvmap2_create
struct kvmap2 *
kvmap2_create(const struct kvmap_mm * const mm)
{
  struct kvmap2 * const map2 = calloc(1, sizeof(*map2));
  map2->mm = mm ? (*mm) : __kvmap_mm_default;
  map2->sz_shift = 5;
  map2->maps[0] = kvmap1_create(mm, 0);
  map2->maps[1] = kvmap1_create(mm, 19);
  return map2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x1, %edi
movl $0x68, %esi
callq 0x62d0
movq %rax, %rbx
testq %r14, %r14
je 0xc17d
vmovups (%r14), %ymm0
vmovups 0x20(%r14), %ymm1
vmovups 0x30(%r14), %ymm2
vmovups %ymm2, 0x30(%rbx)
vmovups %ymm1, 0x20(%rbx)
vmovups %ymm0, (%rbx)
movq %r14, %rdi
xorl %esi, %esi
vzeroupper
callq 0xc1dc
movq %rax, %r15
movl $0x13, %esi
movq %r14, %rdi
jmp 0xc1b9
vmovups 0xdc33(%rip), %ymm0     # 0x19db8
vmovups %ymm0, 0x30(%rbx)
vmovups 0xdc16(%rip), %ymm0     # 0x19da8
vmovups %ymm0, 0x20(%rbx)
vmovups 0xdbe9(%rip), %ymm0     # 0x19d88
vmovups %ymm0, (%rbx)
xorl %edi, %edi
xorl %esi, %esi
vzeroupper
callq 0xc1dc
movq %rax, %r15
movl $0x13, %esi
xorl %edi, %edi
callq 0xc1dc
movq $0x5, 0x50(%rbx)
movq %r15, 0x58(%rbx)
movq %rax, 0x60(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: kvmap1_create
static struct kvmap1 *
kvmap1_create(const struct kvmap_mm * const mm, const u64 hash_rotate)
{
  struct kvmap1 * const map = xalloc(64, sizeof(*map));
  memset(map, 0, sizeof(*map));

  map->mm = mm ? (*mm) : __kvmap_mm_default;
  map->hash_rotate = hash_rotate;

  for (u64 j = 0; j < KVMAP_HLOCK_NR; j++) {
    spinlock_init(&(map->hlocks[j]));
  }
  spinlock_init(&(map->split_lock));

  kvmap1_init(map);
  return map;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
leaq -0x20(%rbp), %rdi
movl $0x40, %esi
movl $0x10928, %edx          # imm = 0x10928
callq 0x6570
xorl %ebx, %ebx
testl %eax, %eax
jne 0xc209
movq -0x20(%rbp), %rbx
movl $0x10928, %edx          # imm = 0x10928
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6210
testq %r15, %r15
je 0xc23a
vmovups (%r15), %ymm0
vmovups 0x20(%r15), %ymm1
vmovups 0x30(%r15), %ymm2
vmovups %ymm2, 0x30(%rbx)
vmovups %ymm1, 0x20(%rbx)
jmp 0xc25c
vmovups 0xdb76(%rip), %ymm0     # 0x19db8
vmovups %ymm0, 0x30(%rbx)
vmovups 0xdb59(%rip), %ymm0     # 0x19da8
vmovups %ymm0, 0x20(%rbx)
vmovups 0xdb2c(%rip), %ymm0     # 0x19d88
vmovups %ymm0, (%rbx)
movq %r14, 0x50(%rbx)
movl $0xe8, %r14d
leaq (%rbx,%r14), %rdi
movl $0x1, %esi
vzeroupper
callq 0x62e0
addq $0x40, %r14
cmpq $0x100e8, %r14          # imm = 0x100E8
jne 0xc26a
leaq 0x100e8(%rbx), %rdi
movl $0x1, %esi
callq 0x62e0
movl $0x10, %eax
movq %rax, 0x58(%rbx)
movq %rax, 0x60(%rbx)
movq %rax, 0x68(%rbx)
leaq 0x10338(%rbx), %rdx
movl $0x400000, %edi         # imm = 0x400000
movl $0x1, %esi
callq 0x82a0
movq %rax, %r15
movq %rax, 0x10328(%rbx)
movl $0x1, %edi
movl $0x2010, %esi           # imm = 0x2010
callq 0x62d0
movq %rax, %r14
movq $0x10000, (%rax)        # imm = 0x10000
xorl %eax, %eax
xchgq %rax, 0x8(%r14)
movq %r14, 0x10330(%rbx)
testq %r15, %r15
je 0xc324
leaq 0x10(%r14), %rdi
movq (%r14), %r15
leaq 0x3f(%r15), %rdx
shrq $0x3, %rdx
andq $-0x8, %rdx
movl $0xff, %esi
callq 0x6210
xchgq %r15, 0x8(%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x66ef
movq 0x10330(%rbx), %r14
testq %r14, %r14
jne 0xc2f5
callq 0x66ef
movq 0x10330(%rbx), %r14
jmp 0xc2f5
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: kvmap2_get
struct kv *
kvmap2_get(struct kvmap2 * const map2, const struct kv * const key, struct kv * const out)
{
  u64 i = UINT64_MAX;
  u64 j = UINT64_MAX;
  u64 k = UINT64_MAX;
  kvmap1_lock_hash(map2->maps[0], key);
  for (u64 x = 0; x < 2; x++) {
    struct kvmap1 * const map = map2->maps[x];
    if (kvmap1_locate_key(map, key, &i, &j, &k)) {
      struct kv * const curr = __u64_to_ptr(map->levels[i].table[j].e[k].ptr);
      if (map2->mm.hf) map2->mm.hf(curr, map2->mm.hp);
      struct kv * const ret = kv_dup2(curr, out);
      kvmap1_unlock_hash(map2->maps[x], key);
      return ret;
    }
    if (x == 0) {
      kvmap1_lock_hash(map2->maps[1], key);
    }
    kvmap1_unlock_hash(map2->maps[x], key);
  }
  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 %rsi, %r14
movq %rdi, %r15
movq $-0x1, %rax
movq %rax, -0x40(%rbp)
movq %rax, -0x38(%rbp)
movq %rax, -0x30(%rbp)
movq 0x58(%rdi), %rax
movq (%rsi), %rdx
movb 0x50(%rax), %cl
rolq %cl, %rdx
andl $0xffc0, %edx           # imm = 0xFFC0
leaq (%rax,%rdx), %rdi
addq $0xe8, %rdi
callq 0x6050
cmpl $0x23, %eax
je 0xc4f2
movb $0x1, %bl
xorl %r13d, %r13d
movq 0x58(%r15,%r13,8), %r12
movq %r12, %rdi
movq %r14, %rsi
leaq -0x40(%rbp), %rdx
leaq -0x38(%rbp), %rcx
leaq -0x30(%rbp), %r8
callq 0xc4f9
testb %al, %al
jne 0xc436
testb $0x1, %bl
je 0xc47c
movq 0x60(%r15), %rax
movq (%r14), %rdx
movb 0x50(%rax), %cl
rolq %cl, %rdx
andl $0xffc0, %edx           # imm = 0xFFC0
leaq (%rax,%rdx), %rdi
addq $0xe8, %rdi
callq 0x6050
cmpl $0x23, %eax
je 0xc4f2
movq 0x58(%r15,%r13,8), %rax
movq (%r14), %rdx
movb 0x50(%rax), %cl
rolq %cl, %rdx
andl $0xffc0, %edx           # imm = 0xFFC0
leaq (%rax,%rdx), %rdi
addq $0xe8, %rdi
callq 0x6320
movl $0x1, %r13d
testb $0x1, %bl
movl $0x0, %ebx
jne 0xc3a2
xorl %ebx, %ebx
jmp 0xc4e0
movq -0x40(%rbp), %rax
shlq $0x5, %rax
movq -0x38(%rbp), %rcx
shlq $0x6, %rcx
addq 0x10128(%r12,%rax), %rcx
movq -0x30(%rbp), %rax
movq (%rcx,%rax,8), %r12
movq %r12, %rbx
shrq $0x10, %rbx
movq 0x20(%r15), %rax
testq %rax, %rax
je 0xc46f
movq 0x28(%r15), %rsi
movq %rbx, %rdi
callq *%rax
cmpq $0x10000, %r12          # imm = 0x10000
jae 0xc480
xorl %ebx, %ebx
jmp 0xc4bb
xorl %ebx, %ebx
jmp 0xc4c0
movl 0x8(%rbx), %eax
movl 0xc(%rbx), %ecx
leaq (%rax,%rcx), %rdx
addq $0x10, %rdx
movq -0x48(%rbp), %r12
testq %r12, %r12
jne 0xc4ad
movq %rdx, %rdi
movq %rdx, %r12
callq 0x63a0
movq %r12, %rdx
movq %rax, %r12
testq %rax, %rax
je 0xc478
movq %r12, %rdi
movq %rbx, %rsi
callq 0x6340
movq %r12, %rbx
movq 0x58(%r15,%r13,8), %r12
movq (%r14), %rax
movb 0x50(%r12), %cl
rolq %cl, %rax
andl $0xffc0, %eax           # imm = 0xFFC0
leaq (%r12,%rax), %rdi
addq $0xe8, %rdi
callq 0x6320
movq %rbx, %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_O3/wuxb45[P]SLB/lib1.c
// Function: kvmap1_locate_key
static bool
kvmap1_locate_key(const struct kvmap1 * const map, const struct kv * const key,
    u64 * const out_level, u64 * const out_index, u64 * const out_entry)
{
  const u64 hash = bits_rotl_u64(key->hash, map->hash_rotate);
  const u64 pkey = kvmap_pkey(hash);
  kvmap1_locate_level(map, hash, out_level, out_index);
  const struct __kvmap_slot * const slot = &(map->levels[*out_level].table[*out_index]);
  u64 used = 0;
  for (u64 k = 0; k < 8; k++) {
    if (slot->e[k].ptr) {
      used++;
      if (slot->e[k].pkey == pkey) {
        const struct kv * const curr = __u64_to_ptr(slot->e[k].ptr);
        if (kv_keymatch(key, curr)) {
          *out_entry = k;
          return true;
        }
      }
    }
  }
  *out_entry = used;
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, -0x38(%rbp)
movq %rcx, %rax
movq %rsi, -0x30(%rbp)
movq (%rsi), %rsi
movb 0x50(%rdi), %cl
rolq %cl, %rsi
movq %rsi, %rcx
shrq $0x20, %rcx
xorq %rsi, %rcx
movq %rcx, %r13
shrq $0x10, %r13
xorq %rcx, %r13
movq 0x68(%rdi), %rcx
movq 0x60(%rdi), %r8
cmpq %r8, %rcx
jb 0xc59e
leaq 0x10128(%rdi), %r9
leaq -0x1(%rcx), %r10
movq %rcx, %r11
bzhiq %r11, %rsi, %rbx
movq %r11, %r14
shlq $0x5, %r14
movq 0x8(%r9,%r14), %r14
cmpq %rbx, (%r14)
jbe 0xc575
movq %rbx, %r15
shrq $0x6, %r15
movq 0x10(%r14,%r15,8), %r14
btq %rbx, %r14
jb 0xc598
cmpq %rcx, %r11
jae 0xc57f
decq %r11
jmp 0xc591
movq %r10, %rbx
cmpq 0x58(%rdi), %r11
je 0xc58e
incq %r11
movq %r11, %rbx
movq %rbx, %r11
cmpq %r8, %r11
jae 0xc54d
jmp 0xc59e
movq %r11, (%rdx)
movq %rbx, (%rax)
movq (%rdx), %rcx
shlq $0x5, %rcx
movq (%rax), %rbx
shlq $0x6, %rbx
addq 0x10128(%rdi,%rcx), %rbx
movq -0x30(%rbp), %rcx
leaq 0x10(%rcx), %rax
movq %rax, -0x40(%rbp)
movb $0x1, %r12b
xorl %r15d, %r15d
xorl %r14d, %r14d
movq (%rbx,%r15,8), %rsi
cmpq $0x10000, %rsi          # imm = 0x10000
jb 0xc60a
incq %r14
movl %r13d, %eax
xorw %si, %ax
jne 0xc60a
shrq $0x10, %rsi
movq (%rcx), %rax
cmpq (%rsi), %rax
jne 0xc60a
movl 0x8(%rcx), %edx
cmpl 0x8(%rsi), %edx
jne 0xc60a
addq $0x10, %rsi
movq -0x40(%rbp), %rdi
callq 0x63d0
movq -0x30(%rbp), %rcx
testl %eax, %eax
je 0xc63c
cmpq $0x7, %r15
leaq 0x1(%r15), %rax
setb %r12b
movq %rax, %r15
cmpq $0x8, %rax
jne 0xc5c9
movq -0x38(%rbp), %rax
movq %r14, (%rax)
andb $0x1, %r12b
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %r14
jmp 0xc61f
// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: kvmap2_probe
bool
kvmap2_probe(struct kvmap2 * const map2, const struct kv * const key)
{
  u64 i = UINT64_MAX;
  u64 j = UINT64_MAX;
  u64 k = UINT64_MAX;
  kvmap1_lock_hash(map2->maps[0], key);
  for (u64 x = 0; x < 2; x++) {
    struct kvmap1 * const map = map2->maps[x];
    if (kvmap1_locate_key(map, key, &i, &j, &k)) {
      struct kv * const curr = __u64_to_ptr(map->levels[i].table[j].e[k].ptr);
      if (map2->mm.hf) map2->mm.hf(curr, map2->mm.hp);
      kvmap1_unlock_hash(map2->maps[x], key);
      return true;
    }
    if (x == 0) {
      kvmap1_lock_hash(map2->maps[1], key);
    }
    kvmap1_unlock_hash(map2->maps[x], key);
  }
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r13
movq %rdi, %r15
movq $-0x1, %rax
movq %rax, -0x48(%rbp)
movq %rax, -0x40(%rbp)
movq %rax, -0x38(%rbp)
movq 0x58(%rdi), %rax
movq (%rsi), %rdx
movb 0x50(%rax), %cl
rolq %cl, %rdx
andl $0xffc0, %edx           # imm = 0xFFC0
leaq (%rax,%rdx), %rdi
addq $0xe8, %rdi
callq 0x6050
cmpl $0x23, %eax
je 0xc7a4
movb $0x1, %bl
xorl %r12d, %r12d
movq %r13, %rsi
movq %r15, %r14
movq 0x58(%r15,%r12,8), %r13
movq %r13, %rdi
movq %rsi, %r15
leaq -0x48(%rbp), %rdx
leaq -0x40(%rbp), %rcx
leaq -0x38(%rbp), %r8
callq 0xc4f9
movb %al, -0x29(%rbp)
testb %al, %al
jne 0xc73b
testb $0x1, %bl
je 0xc773
movq 0x60(%r14), %rax
movq %r15, %r13
movq (%r15), %rdx
movb 0x50(%rax), %cl
rolq %cl, %rdx
andl $0xffc0, %edx           # imm = 0xFFC0
leaq (%rax,%rdx), %rdi
addq $0xe8, %rdi
callq 0x6050
cmpl $0x23, %eax
je 0xc7a4
movq 0x58(%r14,%r12,8), %rax
movq (%r13), %rdx
movb 0x50(%rax), %cl
rolq %cl, %rdx
andl $0xffc0, %edx           # imm = 0xFFC0
leaq (%rax,%rdx), %rdi
addq $0xe8, %rdi
callq 0x6320
movl $0x1, %r12d
testb $0x1, %bl
movl $0x0, %ebx
movq %r14, %r15
jne 0xc69c
jmp 0xc792
movq 0x20(%r14), %rax
testq %rax, %rax
je 0xc773
movq -0x48(%rbp), %rcx
shlq $0x5, %rcx
movq -0x40(%rbp), %rdx
shlq $0x6, %rdx
addq 0x10128(%r13,%rcx), %rdx
movq -0x38(%rbp), %rcx
movq (%rdx,%rcx,8), %rdi
shrq $0x10, %rdi
movq 0x28(%r14), %rsi
callq *%rax
movq 0x58(%r14,%r12,8), %r13
movq (%r15), %rax
movb 0x50(%r13), %cl
rolq %cl, %rax
andl $0xffc0, %eax           # imm = 0xFFC0
leaq (%rax,%r13), %rdi
addq $0xe8, %rdi
callq 0x6320
movb -0x29(%rbp), %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
callq 0x6530