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

  gi->type = GEN_CONSTANT;
  gi->next_wait = gen_constant;
  gi->next_nowait = gen_constant;
  return gi;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x1
popq %rdi
movl $0x220, %esi            # imm = 0x220
callq 0x62d0
movq %rbx, %rcx
shrq $0x20, %rcx
setne 0x14(%rax)
movq %rbx, 0x18(%rax)
leaq 0xe(%rip), %rcx         # 0x9264
movq %rcx, (%rax)
movq %rcx, 0x8(%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/lib1.c
// Function: rgen_new_counter
struct rgen *
rgen_new_counter(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.counter.counter = 0;
  gi->gen.counter.base = min;
  gi->gen.counter.modulus = max - min + 1;

  gi->type = GEN_COUNTER;
  gi->next_wait = gen_counter;
  gi->next_nowait = gen_counter;
  return gi;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x1
popq %rdi
movl $0x220, %esi            # imm = 0x220
callq 0x62d0
movq %rbx, %rcx
shrq $0x20, %rcx
setne 0x14(%rax)
xorl %ecx, %ecx
xchgq %rcx, 0x18(%rax)
movq %r14, 0x20(%rax)
subq %r14, %rbx
incq %rbx
movq %rbx, 0x28(%rax)
movl $0x1, 0x10(%rax)
leaq 0xc(%rip), %rcx         # 0x92c1
movq %rcx, (%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: rgen_new_counter_unsafe
struct rgen *
rgen_new_counter_unsafe(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.counter.counter_unsafe = 0;
  gi->gen.counter.base = min;
  gi->gen.counter.modulus = max - min + 1;

  gi->type = GEN_COUNTER_UNSAFE;
  gi->next_wait = gen_counter_unsafe;
  gi->next_nowait = gen_counter_unsafe;
  return gi;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x1
popq %rdi
movl $0x220, %esi            # imm = 0x220
callq 0x62d0
movq %rbx, %rcx
shrq $0x20, %rcx
setne 0x14(%rax)
movq %r14, 0x20(%rax)
subq %r14, %rbx
incq %rbx
movq %rbx, 0x28(%rax)
movl $0x2, 0x10(%rax)
leaq 0xc(%rip), %rcx         # 0x9331
movq %rcx, (%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: rgen_new_skipinc
struct rgen *
rgen_new_skipinc(const u64 min, const u64 max, const u64 inc)
{
  struct rgen * const gi = (typeof(gi))calloc(1, sizeof(*gi));
  gi->unit_u64 = max > UINT32_MAX ? true : false;
  gi->gen.skipinc.counter = 0;
  gi->gen.skipinc.base = min;
  gi->gen.skipinc.modulus = max - min + 1;
  gi->gen.skipinc.inc = inc;

  gi->type = GEN_SKIPINC;
  gi->next_wait = gen_skipinc;
  gi->next_nowait = gen_skipinc;
  return gi;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
pushq $0x1
popq %rdi
movl $0x220, %esi            # imm = 0x220
callq 0x62d0
movq %r14, %rcx
shrq $0x20, %rcx
setne 0x14(%rax)
xorl %ecx, %ecx
xchgq %rcx, 0x18(%rax)
movq %r15, 0x20(%rax)
subq %r15, %r14
incq %r14
movq %r14, 0x28(%rax)
movq %rbx, 0x30(%rax)
movl $0x3, 0x10(%rax)
leaq 0x12(%rip), %rcx        # 0x93b0
movq %rcx, (%rax)
movq %rcx, 0x8(%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: rgen_new_skipinc_unsafe
struct rgen *
rgen_new_skipinc_unsafe(const u64 min, const u64 max, const u64 inc)
{
  struct rgen * const gi = (typeof(gi))calloc(1, sizeof(*gi));
  gi->unit_u64 = max > UINT32_MAX ? true : false;
  gi->gen.skipinc.counter_unsafe = 0;
  gi->gen.skipinc.base = min;
  gi->gen.skipinc.modulus = max - min + 1;
  gi->gen.skipinc.inc = inc;

  gi->type = GEN_SKIPINC_UNSAFE;
  gi->next_wait = gen_skipinc_unsafe;
  gi->next_nowait = gen_skipinc_unsafe;
  return gi;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
pushq $0x1
popq %rdi
movl $0x220, %esi            # imm = 0x220
callq 0x62d0
movq %r14, %rcx
shrq $0x20, %rcx
setne 0x14(%rax)
movq %r15, 0x20(%rax)
subq %r15, %r14
incq %r14
movq %r14, 0x28(%rax)
movq %rbx, 0x30(%rax)
movl $0x4, 0x10(%rax)
leaq 0x12(%rip), %rcx        # 0x942a
movq %rcx, (%rax)
movq %rcx, 0x8(%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: rgen_new_reducer
struct rgen *
rgen_new_reducer(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.reducer.counter = 0;
  gi->gen.reducer.base = max;
  gi->gen.reducer.modulus = max - min + 1;

  gi->type = GEN_REDUCER;
  gi->next_wait = gen_reducer;
  gi->next_nowait = gen_reducer;
  return gi;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x1
popq %rdi
movl $0x220, %esi            # imm = 0x220
callq 0x62d0
movq %rbx, %rcx
shrq $0x20, %rcx
setne 0x14(%rax)
xorl %ecx, %ecx
xchgq %rcx, 0x18(%rax)
movq %rbx, 0x20(%rax)
subq %r14, %rbx
incq %rbx
movq %rbx, 0x28(%rax)
movl $0x5, 0x10(%rax)
leaq 0xc(%rip), %rcx         # 0x949f
movq %rcx, (%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: rgen_new_reducer_unsafe
struct rgen *
rgen_new_reducer_unsafe(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.reducer.counter_unsafe = 0;
  gi->gen.reducer.base = max;
  gi->gen.reducer.modulus = max - min + 1;

  gi->type = GEN_REDUCER_UNSAFE;
  gi->next_wait = gen_reducer_unsafe;
  gi->next_nowait = gen_reducer_unsafe;
  return gi;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x1
popq %rdi
movl $0x220, %esi            # imm = 0x220
callq 0x62d0
movq %rbx, %rcx
shrq $0x20, %rcx
setne 0x14(%rax)
movq %rbx, 0x20(%rax)
subq %r14, %rbx
incq %rbx
movq %rbx, 0x28(%rax)
movl $0x6, 0x10(%rax)
leaq 0xc(%rip), %rcx         # 0x9512
movq %rcx, (%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: rgen_new_zipfian
struct rgen *
rgen_new_zipfian(const u64 min, const u64 max)
{
  struct rgen * const gi = (typeof(gi))calloc(1, sizeof(*gi));
  gi->unit_u64 = max > UINT32_MAX ? true : false;
  struct rgen_zipfian * const gz = &(gi->gen.zipfian);

  const u64 items = max - min + 1;
  gz->nr_items = items;
  gz->nr_items_d = (double)items;
  gz->base = min;
  gz->base1 = min + 1lu;
  gz->theta = ZIPFIAN_CONSTANT;
  gz->quick1 = 1.0 + pow(0.5, gz->theta);
  const double zeta2theta = zeta(2, ZIPFIAN_CONSTANT);
  gz->alpha = 1.0 / (1.0 - ZIPFIAN_CONSTANT);
  const double zetan = zeta(items, ZIPFIAN_CONSTANT);
  gz->zetan = zetan;
  gz->eta = (1.0 - pow(2.0 / (double)items, 1.0 - ZIPFIAN_CONSTANT)) / (1.0 - (zeta2theta / zetan));
  gz->quick2 = 1.0 - gz->eta;
  gz->min = min;
  gz->max = max;

  gi->type = GEN_ZIPFIAN;
  gi->next_wait = gen_zipfian;
  gi->next_nowait = gen_zipfian;
  return gi;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x1
popq %rdi
movl $0x220, %esi            # imm = 0x220
callq 0x62d0
movq %rax, %r15
movq %rbx, %rax
shrq $0x20, %rax
setne 0x14(%r15)
movq %rbx, %r12
subq %r14, %r12
incq %r12
movq %r12, 0x18(%r15)
vcvtusi2sd %r12, %xmm0, %xmm0
vmovsd %xmm0, -0x38(%rbp)
vmovsd %xmm0, 0x38(%r15)
movq %r14, 0x20(%r15)
leaq 0x1(%r14), %rax
movq %rax, 0x28(%r15)
movabsq $0x3fefae147ae147ae, %rax # imm = 0x3FEFAE147AE147AE
movq %rax, 0x60(%r15)
movabsq $0x3ff80e3eb6202786, %rax # imm = 0x3FF80E3EB6202786
movq %rax, 0x30(%r15)
pushq $0x2
popq %rdi
callq 0x964f
vmovsd %xmm0, -0x30(%rbp)
movabsq $0x4058fffffffffffa, %rax # imm = 0x4058FFFFFFFFFFFA
movq %rax, 0x48(%r15)
movq %r12, %rdi
callq 0x964f
vmovsd %xmm0, -0x28(%rbp)
vmovsd %xmm0, 0x40(%r15)
vmovsd 0x8ab7(%rip), %xmm0     # 0x12098
vdivsd -0x38(%rbp), %xmm0, %xmm0
vmovsd 0x8ab2(%rip), %xmm1     # 0x120a0
callq 0x6130
vmovsd 0x8a7d(%rip), %xmm1     # 0x12078
vsubsd %xmm0, %xmm1, %xmm0
vmovsd -0x30(%rbp), %xmm2
vdivsd -0x28(%rbp), %xmm2, %xmm2
vsubsd %xmm2, %xmm1, %xmm2
vdivsd %xmm2, %xmm0, %xmm0
vmovsd %xmm0, 0x58(%r15)
vsubsd %xmm0, %xmm1, %xmm0
vmovsd %xmm0, 0x50(%r15)
movq %r14, 0x68(%r15)
movq %rbx, 0x70(%r15)
movl $0x8, 0x10(%r15)
leaq 0x12a(%rip), %rax       # 0x9762
movq %rax, (%r15)
movq %rax, 0x8(%r15)
movq %r15, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/lib1.c
// Function: zeta
static double
zeta(const u64 n, const double theta)
{
  //assert(theta == 0.99);
  const u64 zlid0 = n / zetalist_step;
  const u64 zlid = (zlid0 > zetalist_count) ? zetalist_count : zlid0;
  const double sum0 = zetalist_double[zlid];
  const u64 start = zlid * zetalist_step;
  const u64 count = n - start;
  const double sum1 = zeta_range(start, count, theta);
  return sum0 + sum1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rax
shrq $0x28, %rax
cmpq $0x10, %rax
pushq $0x10
popq %r14
cmovbq %rax, %r14
leaq 0x95c7(%rip), %rax      # 0x12c40
vmovsd (%rax,%r14,8), %xmm0
vmovsd %xmm0, -0x28(%rbp)
shlq $0x28, %r14
movq %rdi, %r15
subq %r14, %r15
cmpq $0xffff, %r15           # imm = 0xFFFF
ja 0x96ee
movq %rdi, %rbx
incq %r14
negq %rbx
vxorpd %xmm0, %xmm0, %xmm0
leaq (%rbx,%r14), %rax
cmpq $0x1, %rax
je 0x974f
vmovsd %xmm0, -0x20(%rbp)
vcvtusi2sd %r14, %xmm2, %xmm0
vmovsd 0x89e3(%rip), %xmm1     # 0x120a8
callq 0x6130
vmovsd 0x89a6(%rip), %xmm1     # 0x12078
vdivsd %xmm0, %xmm1, %xmm0
vmovsd -0x20(%rbp), %xmm1
vaddsd %xmm0, %xmm1, %xmm1
vmovsd %xmm1, -0x20(%rbp)
vmovsd -0x20(%rbp), %xmm0
incq %r14
jmp 0x96a4
callq 0x760d
movq %rax, %rbx
testq %rax, %rax
jne 0x9700
callq 0x6e43
leaq -0xa8(%rbp), %rdi
andq $0x0, -0x30(%rdi)
movq %rbx, -0x28(%rdi)
movq %r14, -0x20(%rdi)
movq %r15, -0x18(%rdi)
movabsq $0x3fefae147ae147ae, %rax # imm = 0x3FEFAE147AE147AE
movq %rax, -0x10(%rdi)
andq $0x0, -0x8(%rdi)
callq 0x6aec
leaq 0x6f1e(%rip), %rsi      # 0x10655
leaq -0xd8(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rdx
callq 0x7a73
vmovsd 0x28(%r14), %xmm0
vaddsd -0x28(%rbp), %xmm0, %xmm0
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/lib1.c
// Function: gen_zipfian
static u64
gen_zipfian(struct rgen * const gi)
{
  // simplified: no increamental update
  const struct rgen_zipfian * const gz = &(gi->gen.zipfian);
  const double u = random_double();
  const double uz = u * gz->zetan;
  if (uz < 1.0) {
    return gz->base;
  } else if (uz < gz->quick1) {
    return gz->base1;
  }
  //const double x = gz->nr_items_d * pow(gz->eta * (u - 1.0) + 1.0, gz->alpha);
  const double x = gz->nr_items_d * pow((gz->eta * u) + gz->quick2, gz->alpha);
  const u64 ret = gz->base + (u64)x;
  return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x916e
vmulsd 0x40(%rbx), %xmm0, %xmm1
vmovsd 0x88fb(%rip), %xmm2     # 0x12078
vucomisd %xmm1, %xmm2
jbe 0x9789
movq 0x20(%rbx), %rax
jmp 0x97cc
vmovsd 0x30(%rbx), %xmm2
vucomisd %xmm1, %xmm2
jbe 0x979a
movq 0x28(%rbx), %rax
jmp 0x97cc
vmovsd 0x58(%rbx), %xmm2
vfmadd213sd 0x50(%rbx), %xmm0, %xmm2 # xmm2 = (xmm0 * xmm2) + mem
vmovsd 0x38(%rbx), %xmm0
vmovsd %xmm0, -0x10(%rbp)
vmovsd 0x48(%rbx), %xmm1
vmovapd %xmm2, %xmm0
callq 0x6130
vmulsd -0x10(%rbp), %xmm0, %xmm0
vcvttsd2usi %xmm0, %rax
addq 0x20(%rbx), %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/lib1.c
// Function: rgen_new_xzipfian
struct rgen *
rgen_new_xzipfian(const u64 min, const u64 max)
{
  struct rgen * gi = rgen_new_zipfian(min, max);
  gi->unit_u64 = max > UINT32_MAX ? true : false;
  gi->type = GEN_XZIPFIAN;
  gi->next_wait = gen_xzipfian;
  gi->next_nowait = gen_xzipfian;
  return gi;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
callq 0x9534
shrq $0x20, %rbx
setne 0x14(%rax)
movl $0x9, 0x10(%rax)
leaq 0xe(%rip), %rcx         # 0x9805
movq %rcx, (%rax)
movq %rcx, 0x8(%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/lib1.c
// Function: rgen_new_unizipf
struct rgen *
rgen_new_unizipf(const u64 min, const u64 max, const u64 ufactor)
{
  const u64 nr = max - min + 1;
  if (ufactor == 1lu) { // covers both special gens
    return rgen_new_zipfian(min, max);
  } else if ((ufactor == 0) || ((nr / ufactor) <= 1lu)) {
    return rgen_new_uniform(min, max);
  }
  const u64 znr = nr / ufactor;
  struct rgen * gi = rgen_new_zipfian(0, znr - 1);
  gi->unit_u64 = max > UINT32_MAX ? true : false;
  gi->gen.unizipf.ufactor = ufactor;
  gi->gen.unizipf.min = min;
  gi->gen.unizipf.max = max;
  gi->next_wait = gen_unizipf;
  gi->next_nowait = gen_unizipf;
  return gi;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
testq %rdx, %rdx
je 0x9887
movq %rdx, %r15
cmpq $0x1, %rdx
jne 0x9873
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x9534
movq %rbx, %rax
subq %r14, %rax
incq %rax
xorl %edx, %edx
divq %r15
cmpq $0x1, %rax
ja 0x989c
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x98df
decq %rax
xorl %edi, %edi
movq %rax, %rsi
callq 0x9534
movq %rbx, %rcx
shrq $0x20, %rcx
setne 0x14(%rax)
movq %r15, 0x78(%rax)
movq %r14, 0x80(%rax)
movq %rbx, 0x88(%rax)
leaq 0x67(%rip), %rcx        # 0x9934
movq %rcx, (%rax)
movq %rcx, 0x8(%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: 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
pushq $0x1
popq %rdi
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 0x40(%rip), %rcx        # 0x9968
movq %rcx, (%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: 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
pushq $0x1
popq %rdi
movl $0x220, %esi            # imm = 0x220
callq 0x62d0
movq %rax, %rbx
leaq 0x88d8(%rip), %rsi      # 0x12285
movq %r14, %rdi
callq 0x6480
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0x9a0a
movq %rbx, %rdi
addq $0x30, %rdi
pushq $0x4
popq %rsi
pushq $0x20
popq %rdx
movq %rax, %rcx
callq 0x60f0
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0x9a0a
movq 0x18(%rbx), %rdi
callq 0x6370
pushq $0x2
popq %rcx
movl %eax, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x6260
movl $0xc, 0x10(%rbx)
leaq 0x1b(%rip), %rax        # 0x9a1c
movq %rax, (%rbx)
movq %rax, 0x8(%rbx)
jmp 0x9a14
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: 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 0x9a65
movq 0x18(%rbx), %rdi
callq 0x6330
testl %eax, %eax
je 0x9a45
movq 0x18(%rbx), %rdi
callq 0x61c0
andq $0x0, 0x20(%rbx)
leaq 0x30(%rbx), %rdi
movq 0x18(%rbx), %rcx
pushq $0x4
popq %rsi
pushq $0x20
popq %rdx
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_O2/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 0x9adb
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpb $0x1, 0x15(%rdi)
jne 0x9ac0
xorl %eax, %eax
xchgb %al, 0x1c8(%rbx)
leaq 0xf0(%rbx), %r14
movq 0x1c0(%rbx), %rdi
xorl %esi, %esi
callq 0x65a0
movq %r14, %rdi
callq 0x9adc
cmpl $0xc, 0x10(%rbx)
jne 0x9acf
movq 0x18(%rbx), %rdi
callq 0x6140
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x6060
retq
// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/lib1.c
// Function: rgen_clean_async_buffers
static inline void
rgen_clean_async_buffers(struct rgen_worker_info * const info)
{
  if (info->mem == NULL) return;
  pages_unmap(info->mem, info->alloc_size);
  info->mem = NULL;
  for (u64 j = 0; j < RGEN_ASYNC_BUFFER_NR; j++) {
    info->buffers_u64[j] = NULL;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
testq %rdi, %rdi
je 0x9b0e
movq 0x28(%rbx), %rsi
callq 0x6410
andq $0x0, 0x20(%rbx)
xorl %eax, %eax
cmpq $0x4, %rax
je 0x9b0e
andq $0x0, (%rbx,%rax,8)
incq %rax
jmp 0x9afe
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/lib1.c
// Function: rgen_helper_message
void
rgen_helper_message(void)
{
  fprintf(stderr, "%s Usage: rgen <type> ...\n", __func__);
  fprintf(stderr, "%s example: rgen unizipf <min> <max> <ufactor>\n", __func__);
  fprintf(stderr, "%s example: rgen uniform <min> <max>\n", __func__);
  fprintf(stderr, "%s example: rgen zipfian <min> <max>\n", __func__);
  fprintf(stderr, "%s example: rgen counter <min> <max>\n", __func__);
  fprintf(stderr, "%s example: rgen reducer <min> <max>\n", __func__);
  fprintf(stderr, "%s example: rgen skipinc <min> <max> <inc>\n", __func__);
  fprintf(stderr, "%s example: rgen trace32 <filename>\n", __func__);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0xf4d5(%rip), %r14      # 0x18ff8
movq (%r14), %rdi
leaq 0x875b(%rip), %rsi      # 0x12288
leaq 0x876f(%rip), %rbx      # 0x122a3
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6300
movq (%r14), %rdi
leaq 0x876f(%rip), %rsi      # 0x122b7
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6300
movq (%r14), %rdi
leaq 0x878b(%rip), %rsi      # 0x122e7
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6300
movq (%r14), %rdi
leaq 0x879d(%rip), %rsi      # 0x1230d
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6300
movq (%r14), %rdi
leaq 0x87af(%rip), %rsi      # 0x12333
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6300
movq (%r14), %rdi
leaq 0x87c1(%rip), %rsi      # 0x12359
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6300
movq (%r14), %rdi
leaq 0x87d3(%rip), %rsi      # 0x1237f
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6300
movq (%r14), %rdi
leaq 0x87eb(%rip), %rsi      # 0x123ab
movq %rbx, %rdx
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x6300
// File: /workspace/github_c_makefile_star2_O2/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 0x9f10
xorl %ebx, %ebx
jmp 0x9f8d
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 0x9f8d
movq 0x18(%r14), %rdi
callq 0x6370
movl %eax, %edi
callq 0x61f0
leaq 0x8325(%rip), %rsi      # 0x12285
movl %eax, %edi
callq 0x6400
movq %rax, %r14
movq %rax, %rdi
callq 0x6370
pushq $0x2
popq %rcx
movl %eax, %edi
xorl %esi, %esi
xorl %edx, %edx
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_O2/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 0x9f9e
xorl %eax, %eax
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xf0(%rdi), %r15
xorl %r12d, %r12d
movl $0x130, %edx            # imm = 0x130
movq %r15, %rdi
xorl %esi, %esi
callq 0x6210
movq (%rbx), %rax
movq %rax, 0x1a8(%rbx)
movzbl 0x14(%rbx), %r13d
leaq 0x118(%rbx), %rdx
pushq $0x1
popq %rsi
movl $0x40000000, %edi       # imm = 0x40000000
callq 0x7c29
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 %r14, 0x1b8(%rbx)
movb $0x1, %al
xchgb %al, 0x1c8(%rbx)
orq $0x2, %r13
cmpq $0x4, %r12
je 0xa057
movq 0x1b0(%rbx), %rax
imulq %r12, %rax
shlxq %r13, %rax, %rax
addq 0x110(%rbx), %rax
movq %rax, 0xf0(%rbx,%r12,8)
xorl %eax, %eax
xchgb %al, 0x160(%rbx,%r12)
incq %r12
jmp 0xa023
leaq 0x7f(%rip), %rax        # 0xa0dd
movq %rax, (%rbx)
leaq 0xe2(%rip), %rax        # 0xa14a
movq %rax, 0x8(%rbx)
leaq 0x1c0(%rbx), %rsi
leaq 0x11c(%rip), %rdx       # 0xa196
movq %r14, %rdi
movq %rbx, %rcx
callq 0x7ac3
testl %eax, %eax
je 0xa095
movq %r15, %rdi
callq 0x9adc
xorl %eax, %eax
jmp 0xa0ce
leaq 0x8371(%rip), %rsi      # 0x1240d
leaq -0x50(%rbp), %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x6520
movq 0x1c0(%rbx), %rdi
movq %r15, %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
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
movq %rdi, %rbx
movq 0x218(%rdi), %r14
testq %r14, %r14
jne 0xa0fb
movq %rbx, %rdi
callq 0x9e86
movq 0x210(%rbx), %rcx
movq 0xf0(%rbx,%rcx,8), %rax
cmpb $0x1, 0x14(%rbx)
jne 0xa116
movq (%rax,%r14,8), %rax
jmp 0xa11a
movl (%rax,%r14,4), %eax
incq %r14
cmpq 0x1b0(%rbx), %r14
jb 0xa13e
xorl %edx, %edx
xchgb %dl, 0x160(%rbx,%rcx)
xorl %r14d, %r14d
incl %ecx
andl $0x3, %ecx
movq %rcx, 0x210(%rbx)
movq %r14, 0x218(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0xa170
movq (%rax,%rdx,8), %rax
jmp 0xa173
movl (%rax,%rdx,4), %eax
incq %rdx
cmpq 0x1b0(%rdi), %rdx
jb 0xa18d
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_O2/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
pushq %rax
movq %rdi, %rbx
imulq $0x61, 0x1b8(%rdi), %rdi
addq $0x123, %rdi            # imm = 0x123
callq 0x915a
movq 0x1b0(%rbx), %r15
xorl %eax, %eax
pushq $0xa
popq %r14
movq %rax, %r12
movl $0x0, %eax
cmpq $0x4, %r12
je 0xa1c8
movb 0x160(%rbx,%r12), %al
testb $0x1, %al
je 0xa1f6
movl %r14d, %edi
callq 0x6600
movb 0x1c8(%rbx), %al
testb $0x1, %al
jne 0xa1d6
jmp 0xa252
movq 0xf0(%rbx,%r12,8), %r13
cmpb $0x0, 0x14(%rbx)
je 0xa21f
xorl %r14d, %r14d
cmpq %r14, %r15
je 0xa23a
movq %rbx, %rdi
callq *0x1a8(%rbx)
movq %rax, (%r13,%r14,8)
incq %r14
jmp 0xa207
xorl %r14d, %r14d
cmpq %r14, %r15
je 0xa23a
movq %rbx, %rdi
callq *0x1a8(%rbx)
movl %eax, (%r13,%r14,4)
incq %r14
jmp 0xa222
mfence
movb $0x1, %al
xchgb %al, 0x160(%rbx,%r12)
incq %r12
movq %r12, %rax
jmp 0xa1c4
xorl %eax, %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: 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
xorl %eax, %eax
movq %rax, %rcx
movl $0x0, %eax
cmpq $0x2, %rcx
je 0xa2a3
movq (%rdi,%rcx,8), %rax
testw %ax, %ax
jns 0xa2c6
leaq 0x1(%rax), %rdx
lock
cmpxchgq %rdx, (%rdi,%rcx,8)
je 0xa2ce
incq %rcx
movq %rcx, %rax
jmp 0xa2a3
shrq $0x10, %rax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
xorl %r15d, %r15d
cmpq $0x2, %r15
je 0xa327
movq (%rbx,%r15,8), %rax
shrq $0x10, %rax
cmpq %rsi, %rax
je 0xa2fc
incq %r15
jmp 0xa2e4
movq (%rbx,%r15,8), %r14
testw $0x7fff, %r14w          # imm = 0x7FFF
jne 0xa30d
callq 0x6e43
leaq -0x1(%r14), %rcx
movq %r14, %rax
lock
cmpxchgq %rcx, (%rbx,%r15,8)
jne 0xa2fc
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x6e43
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %r15
movq %rdi, %r12
cmpq $-0x1, %r15
je 0xa366
movq (%r12), %rax
testw %ax, %ax
jns 0xa373
addq $0x8, %r12
decq %r15
jmp 0xa34e
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x6e43
movq (%rbx,%r15,8), %rax
shrq $0x10, %rax
cmpq %r14, %rax
jne 0xa385
callq 0x6e43
shlq $0x10, %r14
orq $0x8000, %r14           # imm = 0x8000
xchgq %r14, (%r12)
mfence
movq (%rbx,%r15,8), %rax
movq %rax, %rcx
andq $-0x8001, %rcx          # imm = 0xFFFF7FFF
lock
cmpxchgq %rcx, (%rbx,%r15,8)
jne 0xa397
mfence
movq (%rbx,%r15,8), %rax
shlq $0x31, %rax
jne 0xa3b0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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, %r15
leaq 0x7e07(%rip), %rdx      # 0x121ee
xorl %r12d, %r12d
leaq -0x42(%rbp), %rbx
pushq $0x6
popq %rsi
movq %rbx, %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), %r13
andq $0x0, (%r13)
movq %r15, %rdi
movq %rbx, %rsi
movq %r13, %rcx
vzeroupper
callq 0x6590
testl %eax, %eax
jne 0xa4fd
movq -0x38(%rbp), %rbx
movq (%r13), %r13
testq %r13, %r13
je 0xa4ec
movl 0x4(%r13), %edi
movl 0x8(%r13), %esi
movl 0xc(%r13), %edx
callq 0x6620
testl %eax, %eax
jns 0xa468
addq $0x28, %r13
jmp 0xa440
movl %eax, %r15d
leaq -0x3c(%rbp), %rcx
movl $0x1, (%rcx)
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
pushq $0x4
popq %r8
movl %eax, %edi
callq 0x6100
movq 0x18(%r13), %rsi
movl 0x10(%r13), %edx
movl %r15d, %edi
callq 0x6420
testl %eax, %eax
jne 0xa4e4
pushq $0x40
popq %rsi
movl %r15d, %edi
callq 0x63c0
testl %eax, %eax
jne 0xa4e4
pushq $0x20
popq %rdi
callq 0x63a0
movq %rax, %r12
movb $0x1, 0x4(%rax)
movl %r15d, (%rax)
movq %r14, 0x10(%rax)
movq %rbx, 0x18(%rax)
leaq 0x8(%rax), %rdi
leaq 0x4c(%rip), %rdx        # 0xa51a
xorl %esi, %esi
movq %rax, %rcx
callq 0x6430
testl %eax, %eax
je 0xa50f
movq %r12, %rdi
callq 0x6060
movl %r15d, %edi
callq 0x6220
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0xa4fa
callq 0x6610
xorl %r12d, %r12d
movq %r12, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x6610
jmp 0xa4fd
// File: /workspace/github_c_makefile_star2_O2/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 0x760d
movq %rax, %r15
pushq $0x8
popq %rsi
movq %rax, %rdi
callq 0x62d0
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
callq 0x76b2
movq %rax, %r12
xorl %r13d, %r13d
cmpb $0x1, 0x4(%rbx)
jne 0xa61e
movl (%rbx), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x64b0
testl %eax, %eax
jns 0xa57d
callq 0x6090
cmpl $0x4, (%rax)
je 0xa555
jmp 0xa61e
movl %eax, %r15d
movq %r12, -0x30(%rbp)
pushq $0x20
popq %rdi
callq 0x63a0
movq %rax, %r12
movq %rbx, (%rax)
movl %r15d, %edi
callq 0x61f0
movl %eax, %edi
leaq 0x7ce2(%rip), %rsi      # 0x12285
callq 0x6400
movq %rax, 0x10(%r12)
movl %r15d, %edi
leaq 0x7e65(%rip), %rsi      # 0x1241c
callq 0x6400
movq %rax, 0x8(%r12)
movq 0x18(%rbx), %rax
movq %rax, 0x18(%r12)
movq (%r14,%r13,8), %rdi
movq 0x10(%rbx), %rdx
leaq -0x38(%rbp), %rsi
movq %r12, %rcx
callq 0x7ac3
testl %eax, %eax
je 0xa607
movq 0x10(%r12), %rdi
callq 0x6140
movq 0x8(%r12), %rdi
callq 0x6140
movq %r12, %rdi
callq 0x6060
movq -0x30(%rbp), %r12
jmp 0xa555
incq %r13
movq %r13, %rax
xorl %edx, %edx
movq -0x30(%rbp), %r12
divq %r12
movq %rdx, %r13
jmp 0xa555
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_O2/wuxb45[P]SLB/lib1.c
// Function: server_destroy
void
server_destroy(struct server * const server)
{
  server->running = false;
  shutdown(server->fd, SHUT_RDWR);
  pthread_join(server->pt, NULL);
  free(server);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb $0x0, 0x4(%rdi)
movl (%rdi), %edi
pushq $0x2
popq %rsi
callq 0x6160
movq 0x8(%rbx), %rdi
xorl %esi, %esi
callq 0x65a0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x6060
// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %ecx
movq %rdi, %r15
leaq 0x7b1e(%rip), %rdx      # 0x121ee
xorl %r14d, %r14d
leaq -0x3e(%rbp), %r12
pushq $0x6
popq %rsi
movq %r12, %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 -0x38(%rbp), %rbx
andq $0x0, (%rbx)
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rcx
vzeroupper
callq 0x6590
testl %eax, %eax
jne 0xa7db
pushq $0x2
popq %r12
leaq -0x2c(%rbp), %r13
pushq $0x4
popq %r14
movq (%rbx), %rbx
testq %rbx, %rbx
je 0xa788
movl 0x4(%rbx), %edi
movl 0x8(%rbx), %esi
movl 0xc(%rbx), %edx
callq 0x6620
testl %eax, %eax
js 0xa782
movl %eax, %r15d
movl $0x1, -0x2c(%rbp)
movl %eax, %edi
pushq $0x1
popq %rsi
movl %r12d, %edx
movq %r13, %rcx
movl %r14d, %r8d
callq 0x6100
movq 0x18(%rbx), %rsi
movl 0x10(%rbx), %edx
movl %r15d, %edi
callq 0x6540
testl %eax, %eax
je 0xa79b
movl %r15d, %edi
callq 0x6220
addq $0x28, %rbx
jmp 0xa730
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0xa796
callq 0x6610
xorl %r14d, %r14d
jmp 0xa7db
movq -0x38(%rbp), %rdi
callq 0x6610
pushq $0x10
popq %rdi
callq 0x63a0
movq %rax, %r14
movl %r15d, %edi
callq 0x61f0
leaq 0x7c5e(%rip), %rsi      # 0x1241c
movl %eax, %edi
callq 0x6400
movq %rax, (%r14)
leaq 0x7ab6(%rip), %rsi      # 0x12285
movl %r15d, %edi
callq 0x6400
movq %rax, 0x8(%r14)
movq %r14, %rax
addq $0x48, %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: kv_refill
inline void
kv_refill(struct kv * const kv, const void * const key, const u32 klen, const void * const value, const u32 vlen)
{
  if (kv) {
    kv->klen = klen;
    kv->vlen = vlen;
    memcpy(&(kv->kv[0]), key, klen);
    memcpy(&(kv->kv[klen]), value, vlen);
    kv_update_hash(kv);
  }
}

// Assembly:
testq %rdi, %rdi
je 0xa917
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r8d, %r15d
movq %rcx, %r14
movq %rdi, %rbx
movl %edx, 0x8(%rdi)
movl %r8d, 0xc(%rdi)
addq $0x10, %rdi
movl %edx, %r12d
movq %r12, %rdx
callq 0x6340
leaq (%rbx,%r12), %rdi
addq $0x10, %rdi
movl %r15d, %edx
movq %r14, %rsi
callq 0x6340
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xa8a6
retq
// File: /workspace/github_c_makefile_star2_O2/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 0xaa24
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 0xaa24
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_O2/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 0xaa61
movq %rdi, %rbx
movl 0x8(%rdi), %r14d
addq $0x10, %r14
movq %r14, %rdi
callq 0x63a0
testq %rax, %rax
je 0xaa61
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_O2/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 0xaaac
movq %rdi, %rbx
movl 0x8(%rdi), %eax
movl 0xc(%rdi), %ecx
leaq (%rax,%rcx), %r14
addq $0x10, %r14
testq %rsi, %rsi
jne 0xaa9a
movq %r14, %rdi
callq 0x63a0
movq %rax, %rsi
testq %rax, %rax
je 0xaaac
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_O2/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 0xaaf1
movq %rdi, %rbx
movl 0x8(%rdi), %r14d
addq $0x10, %r14
testq %rsi, %rsi
jne 0xaadf
movq %r14, %rdi
callq 0x63a0
movq %rax, %rsi
testq %rax, %rax
je 0xaaf1
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_O2/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 0xabda
testq %rsi, %rsi
je 0xabe2
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 0xabe6
orl %ecx, %eax
jmp 0xabee
xorl %eax, %eax
negq %rsi
sbbl %eax, %eax
retq
pushq $0x1
popq %rax
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_O2/wuxb45[P]SLB/lib1.c
// Function: kvmap_api_helper_message
void
kvmap_api_helper_message(void)
{
  fprintf(stderr, "%s Usage: api <cache-mb> <map-type> <param1> ...\n", __func__);
  fprintf(stderr, "%s example: api 0 kvmap2\n", __func__);
  fprintf(stderr, "%s example: api 0 cuckoo\n", __func__);
  fprintf(stderr, "%s example: api 0 skiplist\n", __func__);
  fprintf(stderr, "%s example: api 0 chainmap\n", __func__);
  fprintf(stderr, "%s example: api 0 bptree\n", __func__);
  fprintf(stderr, "%s example: api 0 tcpmap <host> <port>\n", __func__);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0xe36b(%rip), %r14      # 0x18ff8
movq (%r14), %rdi
leaq 0x7788(%rip), %rsi      # 0x1241f
leaq 0x77b3(%rip), %rbx      # 0x12451
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6300
movq (%r14), %rdi
leaq 0x77b8(%rip), %rsi      # 0x1246a
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6300
movq (%r14), %rdi
leaq 0x77be(%rip), %rsi      # 0x12484
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6300
movq (%r14), %rdi
leaq 0x77c4(%rip), %rsi      # 0x1249e
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6300
movq (%r14), %rdi
leaq 0x77cc(%rip), %rsi      # 0x124ba
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6300
movq (%r14), %rdi
leaq 0x77d4(%rip), %rsi      # 0x124d6
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6300
movq (%r14), %rdi
leaq 0x77da(%rip), %rsi      # 0x124f0
movq %rbx, %rdx
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x6300