LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/ranbenbasat[P]RHHH/prng.c
// Function: prng_stabledbn
double prng_stabledbn(prng_type * prng, double alpha) {

  // From 'stable distributions', John Nolan, manuscript, p24
  // we set beta = 0 by analogy with the normal and cauchy case
  // identical to the above routine, but returns a double instead
  // of a long double (you'll see this a lot...)

  double theta, W, holder, left, right;

  theta=PI*(prng_float(prng) - 0.5);
  W = -log(prng_float(prng)); // takes natural log

  //  printf("theta %Lf, W = %Lf \n", theta, W);

  // some notes on Nolan's notes:
  // if beta == 0 then c(alpha,beta)=1; theta_0 = 0
  // expression reduces to sin alpha.theta / (cos theta) ^1/alpha
  //  * (cos (theta - alpha theta)/W) ^(1-alpha)/alpha
  left = (sin(alpha*theta)/pow(cos(theta), 1.0/alpha));
  right= pow(cos(theta*(1.0 - alpha))/W, ((1.0-alpha)/alpha));
  holder=left*right;
  return(holder);
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movsd %xmm0, 0x38(%rsp)
movq 0x40(%rsp), %rdi
callq 0x3f20
cvtss2sd %xmm0, %xmm1
movsd 0xd3b(%rip), %xmm0      # 0x5030
subsd %xmm0, %xmm1
movsd 0xe7f(%rip), %xmm0      # 0x5180
mulsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x40(%rsp), %rdi
callq 0x3f20
cvtss2sd %xmm0, %xmm0
callq 0x10c0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x38(%rsp), %xmm0
mulsd 0x30(%rsp), %xmm0
callq 0x1170
movsd %xmm0, 0x8(%rsp)
movsd 0x30(%rsp), %xmm0
callq 0x10d0
movsd 0xca3(%rip), %xmm1      # 0x5008
divsd 0x38(%rsp), %xmm1
callq 0x1070
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x30(%rsp), %xmm0
movsd 0xc77(%rip), %xmm1      # 0x5008
subsd 0x38(%rsp), %xmm1
mulsd %xmm1, %xmm0
callq 0x10d0
divsd 0x28(%rsp), %xmm0
movsd 0xc5a(%rip), %xmm1      # 0x5008
subsd 0x38(%rsp), %xmm1
divsd 0x38(%rsp), %xmm1
callq 0x1070
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
mulsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x20(%rsp), %xmm0
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ranbenbasat[P]RHHH/prng.c
// Function: prng_altstab
double prng_altstab(prng_type * prng, double p)
{
  double u,v,result;

  u=prng_float(prng);
  v=prng_float(prng);
  result=pow(u,p);
  // result=exp(p*log(u));
  if (v<0.5) result=-result;
  return(result);
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movsd %xmm0, 0x18(%rsp)
movq 0x20(%rsp), %rdi
callq 0x3f20
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x20(%rsp), %rdi
callq 0x3f20
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
callq 0x1070
movsd %xmm0, (%rsp)
movsd 0xb9b(%rip), %xmm0      # 0x5030
ucomisd 0x8(%rsp), %xmm0
jbe 0x44be
movsd (%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, (%rsp)
movsd (%rsp), %xmm0
addq $0x28, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ranbenbasat[P]RHHH/prng.c
// Function: prng_stable
double prng_stable(prng_type * prng, double alpha) {

  // wrapper for the stable distributions above:
  // call the appropriate routine based on the value of alpha given
  // initialising it with the seed in idum

  // randinit must be called before entering this procedure for
  // the first time since it uses the random generators


  if (alpha==2.0)
    return(prng_normal(prng));
  else if (alpha==1.0)
    return(prng_cauchy(prng));
  else if (alpha<0.01)
    return(prng_altstab(prng,-50.0));
  else return (prng_stabledbn(prng,alpha));
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
movsd 0x10(%rsp), %xmm0
movsd 0xb23(%rip), %xmm1      # 0x5010
ucomisd %xmm1, %xmm0
jne 0x4507
jp 0x4507
movq 0x18(%rsp), %rdi
callq 0x4170
movsd %xmm0, 0x20(%rsp)
jmp 0x4579
movsd 0x10(%rsp), %xmm0
movsd 0xaf3(%rip), %xmm1      # 0x5008
ucomisd %xmm1, %xmm0
jne 0x4539
jp 0x4539
movq 0x18(%rsp), %rdi
callq 0x43f0
fstpl 0x8(%rsp)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
jmp 0x4579
movsd 0xc4f(%rip), %xmm0      # 0x5190
ucomisd 0x10(%rsp), %xmm0
jbe 0x4563
movq 0x18(%rsp), %rdi
movsd 0xc42(%rip), %xmm0      # 0x5198
callq 0x4440
movsd %xmm0, 0x20(%rsp)
jmp 0x4579
movq 0x18(%rsp), %rdi
movsd 0x10(%rsp), %xmm0
callq 0x42d0
movsd %xmm0, 0x20(%rsp)
movsd 0x20(%rsp), %xmm0
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ranbenbasat[P]RHHH/prng.c
// Function: zeta
double zeta(long n, double theta)
{

  // the zeta function, used by the below zipf function
  // (this is not often called from outside this library)
  // ... but have made it public now to speed things up

  int i;
  double ans=0.0;

  for (i=1; i <= n; i++)
    ans += pow(1./(double)i, theta);
  return(ans);
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movsd %xmm0, 0x18(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movl $0x1, 0x14(%rsp)
movslq 0x14(%rsp), %rax
cmpq 0x20(%rsp), %rax
jg 0x45f2
cvtsi2sdl 0x14(%rsp), %xmm1
movsd 0xa3e(%rip), %xmm0      # 0x5008
divsd %xmm1, %xmm0
movsd 0x18(%rsp), %xmm1
callq 0x1070
addsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x45b0
movsd 0x8(%rsp), %xmm0
addq $0x28, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/ranbenbasat[P]RHHH/prng.c
// Function: fastzipf
double fastzipf(double theta, long n, double zetan, prng_type * prng) {

  // this draws values from the zipf distribution
  // this is mainly useful for test generation purposes
  // n is range, theta is skewness parameter
  // theta = 0 gives uniform dbn,
  // theta > 1 gives highly skewed dbn.
  // original code due to Flip Korn, used with permission

	double alpha;
	double eta;
	double u;
	double uz;
	long double val;

  // randinit must be called before entering this procedure for
  // the first time since it uses the random generators

	alpha = 1. / (1. - theta);
	eta = (1. - pow(2./((double) n), 1. - theta)) 
	  / (1. - zeta(2.,theta)/zetan);

	u = prng_float(prng);
	uz = u * zetan;
	if (uz < 1.) val = 1;
	else if (uz < (1. + pow(0.5, theta))) val = 2;
	else val = 1 + (int64__t)(n * pow(eta*u - eta + 1., alpha));

	return(val);
}

// Assembly:
subq $0x88, %rsp
movsd %xmm0, 0x80(%rsp)
movq %rdi, 0x78(%rsp)
movsd %xmm1, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movsd 0x9e0(%rip), %xmm1      # 0x5008
subsd 0x80(%rsp), %xmm1
movsd 0x9cf(%rip), %xmm0      # 0x5008
divsd %xmm1, %xmm0
movsd %xmm0, 0x60(%rsp)
cvtsi2sdq 0x78(%rsp), %xmm1
movsd 0x9be(%rip), %xmm0      # 0x5010
divsd %xmm1, %xmm0
movsd 0x9aa(%rip), %xmm1      # 0x5008
subsd 0x80(%rsp), %xmm1
callq 0x1070
movaps %xmm0, %xmm1
movsd 0x991(%rip), %xmm0      # 0x5008
subsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x80(%rsp), %xmm0
movl $0x2, %edi
callq 0x4590
movaps %xmm0, %xmm2
movsd 0x18(%rsp), %xmm0
divsd 0x70(%rsp), %xmm2
movsd 0x95d(%rip), %xmm1      # 0x5008
subsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x58(%rsp)
movq 0x68(%rsp), %rdi
callq 0x3f20
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x50(%rsp)
movsd 0x50(%rsp), %xmm0
mulsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movsd 0x921(%rip), %xmm0      # 0x5008
ucomisd 0x48(%rsp), %xmm0
jbe 0x46fa
fld1
fstpt 0x30(%rsp)
jmp 0x47a2
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x80(%rsp), %xmm1
movsd 0x919(%rip), %xmm0      # 0x5030
callq 0x1070
movsd 0x10(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x8db(%rip), %xmm0      # 0x5008
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x4743
flds 0xa67(%rip)             # 0x51a4
fstpt 0x30(%rsp)
jmp 0x47a0
cvtsi2sdq 0x78(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x58(%rsp), %xmm1
movsd 0x50(%rsp), %xmm2
movaps %xmm1, %xmm0
mulsd %xmm2, %xmm0
subsd %xmm1, %xmm0
movsd 0x899(%rip), %xmm1      # 0x5008
addsd %xmm1, %xmm0
movsd 0x60(%rsp), %xmm1
callq 0x1070
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
incq %rax
movq %rax, 0x28(%rsp)
fildll 0x28(%rsp)
fstpt 0x30(%rsp)
jmp 0x47a2
fldt 0x30(%rsp)
fstpl 0x20(%rsp)
movsd 0x20(%rsp), %xmm0
addq $0x88, %rsp
retq
// File: /workspace/github_c_makefile_star2_O0/vi[P]simple_cbor_stream_parse/dump_scsp_events.c
// Function: q_bytestring_chunk
SCSP_INT q_bytestring_chunk (SCSP_USERDATA userdata, const uint8_t* buf, size_t len) {
    int i;
    printf("bytestring_chunk(\"");
    for (i=0; i<len; ++i) {
        printf("\\x%02X", (int)buf[i]);
    }
    printf("\")\n");
    fflush(stdout);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq 0x1dbf(%rip), %rdi      # 0x302a
movb $0x0, %al
callq 0x1050
movl $0x0, -0x1c(%rbp)
movslq -0x1c(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x12a8
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzbl (%rax,%rcx), %esi
leaq 0x1da7(%rip), %rdi      # 0x303d
movb $0x0, %al
callq 0x1050
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1279
leaq 0x1d95(%rip), %rdi      # 0x3044
movb $0x0, %al
callq 0x1050
movq 0x3d1b(%rip), %rax      # 0x4fd8
movq (%rax), %rdi
callq 0x1080
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/vi[P]simple_cbor_stream_parse/dump_scsp_events.c
// Function: q_string_chunk
SCSP_INT q_string_chunk (SCSP_USERDATA userdata, const uint8_t* buf, size_t len) {
    int i;
    printf("string_chunk(\"");
    for (i=0; i<len; ++i) {
        printf("\\x%02X", (int)buf[i]);
    }
    printf("\")\n");
    fflush(stdout);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq 0x1cc3(%rip), %rdi      # 0x302e
movb $0x0, %al
callq 0x1050
movl $0x0, -0x1c(%rbp)
movslq -0x1c(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x13a8
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzbl (%rax,%rcx), %esi
leaq 0x1ca7(%rip), %rdi      # 0x303d
movb $0x0, %al
callq 0x1050
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1379
leaq 0x1c95(%rip), %rdi      # 0x3044
movb $0x0, %al
callq 0x1050
movq 0x3c1b(%rip), %rax      # 0x4fd8
movq (%rax), %rdi
callq 0x1080
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/vi[P]simple_cbor_stream_parse/dump_scsp_events.c
// Function: main
int main(int argc, char* argv[]) {
    if (argc != 2) {
        printf("Usage: dump_scsp_events {filename|-}\n");
        return 1;
    }
    int f;
    if (argv[1][0] == '-' && argv[1][1] == '\0') {
        f = 0;
    } else {
        f = open(argv[1], O_RDONLY);
        if (f == -1) {
            perror("open");
            return 2;
        }
    }
    
    if ( -1 == scsp_parse_from_fd(f, &q_callbacks, NULL) ) {
        fprintf(stderr, "Error reading CBOR\n");
        return 4;
    }
    
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x2, -0x8(%rbp)
je 0x1706
leaq 0x1a00(%rip), %rdi      # 0x30f3
movb $0x0, %al
callq 0x1050
movl $0x1, -0x4(%rbp)
jmp 0x17ab
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x1730
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
jne 0x1730
movl $0x0, -0x14(%rbp)
jmp 0x1761
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %esi, %esi
movb $0x0, %al
callq 0x10a0
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jne 0x175f
leaq 0x19c8(%rip), %rdi      # 0x3119
callq 0x10b0
movl $0x2, -0x4(%rbp)
jmp 0x17ab
jmp 0x1761
movl -0x14(%rbp), %edi
leaq 0x390d(%rip), %rsi      # 0x5078
xorl %eax, %eax
movl %eax, %edx
callq 0x2cb0
movq %rax, %rcx
movq $-0x1, %rax
cmpq %rcx, %rax
jne 0x17a4
movq 0x386e(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0x198a(%rip), %rsi      # 0x311e
movb $0x0, %al
callq 0x1070
movl $0x4, -0x4(%rbp)
jmp 0x17ab
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O0/vi[P]simple_cbor_stream_parse/scsp.c
// Function: decode_half
static double decode_half(const unsigned char *halfp) {
     int half = (halfp[0] << 8) + halfp[1];
     int exp = (half >> 10) & 0x1f;
     int mant = half & 0x3ff;
     double val;
     if (exp == 0) val = ldexp(mant, -24);
     else if (exp != 31) val = ldexp(mant + 1024, exp - 25);
     else val = mant == 0 ? INFINITY : NAN;
     return half & 0x8000 ? -val : val;
   }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movzbl (%rax), %eax
shll $0x8, %eax
movq -0x8(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
sarl $0xa, %eax
andl $0x1f, %eax
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
andl $0x3ff, %eax            # imm = 0x3FF
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x10(%rbp)
jne 0x2c06
cvtsi2sdl -0x14(%rbp), %xmm0
movl $0xffffffe8, %edi       # imm = 0xFFFFFFE8
callq 0x1040
movsd %xmm0, -0x20(%rbp)
jmp 0x2c66
cmpl $0x1f, -0x10(%rbp)
je 0x2c2a
movl -0x14(%rbp), %eax
addl $0x400, %eax            # imm = 0x400
cvtsi2sd %eax, %xmm0
movl -0x10(%rbp), %edi
subl $0x19, %edi
callq 0x1040
movsd %xmm0, -0x20(%rbp)
jmp 0x2c64
movl -0x14(%rbp), %eax
movss 0x77b(%rip), %xmm0      # 0x33b0
movss 0x777(%rip), %xmm1      # 0x33b4
movss %xmm1, -0x28(%rbp)
cmpl $0x0, %eax
movss %xmm0, -0x24(%rbp)
je 0x2c56
movss -0x28(%rbp), %xmm0
movss %xmm0, -0x24(%rbp)
movss -0x24(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
jmp 0x2c66
movl -0xc(%rbp), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
je 0x2c96
movsd -0x20(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x2ca0
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x30(%rbp), %xmm0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/vi[P]simple_cbor_stream_parse/scsp.c
// Function: scsp_parse_from_fd
SCSP_INT SCSP_EXPORT scsp_parse_from_fd(
            int fd, 
            struct scsp_callbacks* callbacks,
            SCSP_USERDATA userdata)
{
    struct scsp_state     ss;
    ss.cur_depth = 0;
    uint8_t buf[8092];
    
    size_t read_cursor = 0;
    for(;;) {
        size_t len = read(fd, buf+read_cursor, (sizeof buf) - read_cursor);
        if (len == -1) {
            if (errno == EINTR) continue;
            if (errno == EAGAIN) { usleep(100000); continue; }
            return -1;
        }
        if (len == 0) break;
        
        len += read_cursor;
        read_cursor=0;
        
        size_t write_cursor = 0;
        while(write_cursor < len) {
            int ret2 = scsp_parse_lowlevel(&ss, callbacks, userdata, buf+write_cursor, len-write_cursor);
            if (ret2 == -1) {
                return -1;
            }
            if (ret2 == 0) {
                memmove(buf, buf+write_cursor, len-write_cursor);
                read_cursor = len-write_cursor;
                break;
            }
            write_cursor += ret2;
        }
        //fflush(stdout);
    }
    return read_cursor;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20f0, %rsp           # imm = 0x20F0
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq $0x0, -0x128(%rbp)
movq $0x0, -0x20d8(%rbp)
movl -0xc(%rbp), %edi
leaq -0x20d0(%rbp), %rsi
addq -0x20d8(%rbp), %rsi
movl $0x1f9c, %edx           # imm = 0x1F9C
subq -0x20d8(%rbp), %rdx
callq 0x1060
movq %rax, -0x20e0(%rbp)
cmpq $-0x1, -0x20e0(%rbp)
jne 0x2d3e
callq 0x1030
cmpl $0x4, (%rax)
jne 0x2d1b
jmp 0x2cdc
callq 0x1030
cmpl $0xb, (%rax)
jne 0x2d31
movl $0x186a0, %edi          # imm = 0x186A0
callq 0x10c0
jmp 0x2cdc
movq $-0x1, -0x8(%rbp)
jmp 0x2e47
cmpq $0x0, -0x20e0(%rbp)
jne 0x2d4d
jmp 0x2e3c
movq -0x20d8(%rbp), %rax
addq -0x20e0(%rbp), %rax
movq %rax, -0x20e0(%rbp)
movq $0x0, -0x20d8(%rbp)
movq $0x0, -0x20e8(%rbp)
movq -0x20e8(%rbp), %rax
cmpq -0x20e0(%rbp), %rax
jae 0x2e37
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x20d0(%rbp), %rcx
addq -0x20e8(%rbp), %rcx
movq -0x20e0(%rbp), %r8
subq -0x20e8(%rbp), %r8
leaq -0x128(%rbp), %rdi
callq 0x17c0
movl %eax, -0x20ec(%rbp)
cmpl $-0x1, -0x20ec(%rbp)
jne 0x2dd5
movq $-0x1, -0x8(%rbp)
jmp 0x2e47
cmpl $0x0, -0x20ec(%rbp)
jne 0x2e1d
leaq -0x20d0(%rbp), %rdi
leaq -0x20d0(%rbp), %rsi
addq -0x20e8(%rbp), %rsi
movq -0x20e0(%rbp), %rdx
subq -0x20e8(%rbp), %rdx
callq 0x1090
movq -0x20e0(%rbp), %rax
subq -0x20e8(%rbp), %rax
movq %rax, -0x20d8(%rbp)
jmp 0x2e37
movslq -0x20ec(%rbp), %rax
addq -0x20e8(%rbp), %rax
movq %rax, -0x20e8(%rbp)
jmp 0x2d78
jmp 0x2cdc
movq -0x20d8(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20f0, %rsp           # imm = 0x20F0
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/vi[P]simple_cbor_stream_parse/scsp.c
// Function: scsp_parse_from_memory
SCSP_INT SCSP_EXPORT scsp_parse_from_memory(
            const void *buffer,
            size_t count,
            struct scsp_callbacks* callbacks,
            SCSP_USERDATA userdata)
{
    struct scsp_state     ss;
    ss.cur_depth = 0;
    
    const uint8_t *buf = (const uint8_t*)buffer;
    
    size_t write_cursor = 0;
    while(write_cursor < count) {
        int ret2 = scsp_parse_lowlevel(&ss, callbacks, userdata, buf+write_cursor, count-write_cursor);
        if (ret2 == -1) {
            return -1;
        }
        if (ret2 == 0) {
            break;
        }
        write_cursor += ret2;
    }
    
    return count - write_cursor;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq $0x0, -0x130(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x138(%rbp)
movq $0x0, -0x140(%rbp)
movq -0x140(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x2f11
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x138(%rbp), %rcx
addq -0x140(%rbp), %rcx
movq -0x18(%rbp), %r8
subq -0x140(%rbp), %r8
leaq -0x130(%rbp), %rdi
callq 0x17c0
movl %eax, -0x144(%rbp)
cmpl $-0x1, -0x144(%rbp)
jne 0x2eef
movq $-0x1, -0x8(%rbp)
jmp 0x2f20
cmpl $0x0, -0x144(%rbp)
jne 0x2efa
jmp 0x2f11
movslq -0x144(%rbp), %rax
addq -0x140(%rbp), %rax
movq %rax, -0x140(%rbp)
jmp 0x2e9c
movq -0x18(%rbp), %rax
subq -0x140(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/CkTD[P]btree/btree.c
// Function: bt_node_blk_none_leaf_make_space
void bt_node_blk_none_leaf_make_space(BTreeNodeBlk *blk, uint64_t index)
{
    char *src;
    char *dest;
    uint64_t n;

    assert(!(blk->type & BT_NODE_TYPE_LEAF));
    src = (char *)blk + sizeof(BTreeNodeBlk) + index * sizeof(uint64_t) * 2;
    dest = src + sizeof(uint64_t) * 2;
    n = (blk->key_counts - index) *  2 * sizeof(uint64_t) + sizeof(uint64_t);
    
    memmove(dest, src, n);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
andq $0x4, %rax
cmpq $0x0, %rax
jne 0x1253
jmp 0x1272
leaq 0x2daa(%rip), %rdi      # 0x4004
leaq 0x2dc4(%rip), %rsi      # 0x4025
movl $0x1c2, %edx            # imm = 0x1C2
leaq 0x2dc0(%rip), %rcx      # 0x402d
callq 0x1090
movq -0x8(%rbp), %rax
addq $0x28, %rax
movq -0x10(%rbp), %rcx
shlq $0x3, %rcx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
subq -0x10(%rbp), %rax
shlq %rax
shlq $0x3, %rax
addq $0x8, %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x10f0
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/CkTD[P]btree/btree.c
// Function: bt_node_marked_dirty
static void bt_node_marked_dirty(BTreeNode *node)
{
    assert(node->state != &node->tree->deleted_node_chain);

    if(node->state == &node->tree->new_node_chain)
        return;
    if(node->state == &node->tree->dirty_node_chain)
        return;
    
    node->state = &node->tree->dirty_node_chain;
    list_add(&node->chain, &node->tree->dirty_node_chain);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
addq $0x30, %rcx
cmpq %rcx, %rax
je 0x13a6
jmp 0x13c5
leaq 0x2f38(%rip), %rdi      # 0x42e5
leaq 0x2c71(%rip), %rsi      # 0x4025
movl $0x1f5, %edx            # imm = 0x1F5
leaq 0x2f54(%rip), %rcx      # 0x4314
callq 0x1090
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
addq $0x20, %rcx
cmpq %rcx, %rax
jne 0x13df
jmp 0x1424
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
addq $0x40, %rcx
cmpq %rcx, %rax
jne 0x13f9
jmp 0x1424
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x40, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rdi
addq $0x18, %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rsi
addq $0x40, %rsi
callq 0x27a0
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/CkTD[P]btree/btree.c
// Function: bt_node_leaf_fetch_values
int bt_node_leaf_fetch_values(BTreeNode *leaf, BTreeValues *values, uint64_t limit, uint64_t key_min, uint64_t key_max)
{
    uint64_t count;
    uint64_t index;
    uint64_t keys_in_node;
    uint64_t k, v;

    count = 0;
    keys_in_node = bt_node_blk_get_key_count(leaf->blk);

    // empty tree!
    if(keys_in_node == 0)
    {
        assert(bt_node_get_type(leaf) & BT_NODE_TYPE_ROOT);
        return 0;
    }

    index = bt_node_blk_leaf_search(leaf->blk, key_min);

    for(; index < keys_in_node; index ++)
    {
        k = bt_node_blk_get_key(leaf->blk, index);
        if(k > key_max)
            break;
        v = bt_node_blk_get_value(leaf->blk, index);
        bt_values_put_value(values, v);

        count ++;
        if(count == limit)
            break;
    }

    if((index == keys_in_node) && (count < limit))
        return 1;
    else
        return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x1570
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x14aa
movq -0x10(%rbp), %rdi
callq 0x12f0
andl $0x1, %eax
cmpl $0x0, %eax
je 0x147f
jmp 0x149e
leaq 0x2be7(%rip), %rdi      # 0x406d
leaq 0x2b98(%rip), %rsi      # 0x4025
movl $0x384, %edx            # imm = 0x384
leaq 0x2bff(%rip), %rcx      # 0x4098
callq 0x1090
movl $0x0, -0x4(%rbp)
jmp 0x1558
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x1590
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0x1534
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x40(%rbp), %rsi
callq 0x1600
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x30(%rbp), %rax
jbe 0x14ea
jmp 0x1534
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x40(%rbp), %rsi
callq 0x1670
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x1700
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0x1524
jmp 0x1534
jmp 0x1526
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x14bf
movq -0x40(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0x1551
movq -0x38(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x1551
movl $0x1, -0x4(%rbp)
jmp 0x1558
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/CkTD[P]btree/btree.c
// Function: bt_node_blk_leaf_search
static uint64_t bt_node_blk_leaf_search(BTreeNodeBlk *blk, uint64_t key)
{
    uint64_t pos;

    pos = 0;
                                                            // not <= here. we want index of *key* tha equal to key
    while (pos < blk->key_counts && bt_node_blk_get_key(blk, pos) < key)
        pos ++;

    return pos;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rdx
xorl %eax, %eax
cmpq 0x8(%rdx), %rcx
movb %al, -0x19(%rbp)
jae 0x15d2
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1600
cmpq -0x10(%rbp), %rax
setb %al
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %al
testb $0x1, %al
jne 0x15db
jmp 0x15e9
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x15a8
movq -0x18(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/CkTD[P]btree/btree.c
// Function: bt_node_blk_get_value
static uint64_t bt_node_blk_get_value(BTreeNodeBlk *blk, uint64_t index)
{
    assert(blk->type & BT_NODE_TYPE_LEAF);
    assert(index < blk->key_counts);
    return *(uint64_t *)
            ((char *)blk + sizeof(BTreeNodeBlk) + sizeof(uint64_t) * (index * 2));

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
andq $0x4, %rax
cmpq $0x0, %rax
je 0x1693
jmp 0x16b2
leaq 0x2d06(%rip), %rdi      # 0x43a0
leaq 0x2984(%rip), %rsi      # 0x4025
movl $0x156, %edx            # imm = 0x156
leaq 0x2d11(%rip), %rcx      # 0x43be
callq 0x1090
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x16c2
jmp 0x16e1
leaq 0x2c88(%rip), %rdi      # 0x4351
leaq 0x2955(%rip), %rsi      # 0x4025
movl $0x157, %edx            # imm = 0x157
leaq 0x2ce2(%rip), %rcx      # 0x43be
callq 0x1090
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
shlq %rcx
shlq $0x3, %rcx
movq 0x28(%rax,%rcx), %rax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/CkTD[P]btree/btree.c
// Function: bt_flush
void bt_flush(BTree *bt)
{
    BTreeNode *node;

    if(bt->meta->dirty)
        bt_store_blk(bt, 0);

    list_for_each_entry(node, &bt->new_node_chain, chain)
        bt_store_blk(bt, bt_node_get_blkid(node));

    list_for_each_entry(node, &bt->dirty_node_chain, chain)
        bt_store_blk(bt, bt_node_get_blkid(node));

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
cmpl $0x0, 0x8(%rax)
je 0x1847
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1960
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x18(%rbp)
xorl %eax, %eax
movq %rax, %rcx
addq $0x18, %rcx
subq %rcx, %rax
addq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
addq $0x18, %rax
movq -0x8(%rbp), %rcx
addq $0x20, %rcx
cmpq %rcx, %rax
je 0x18cb
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
callq 0x12d0
movq -0x58(%rbp), %rdi
movq %rax, %rsi
callq 0x1960
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
xorl %eax, %eax
movq %rax, %rcx
addq $0x18, %rcx
subq %rcx, %rax
addq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x186f
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x38(%rbp)
xorl %eax, %eax
movq %rax, %rcx
addq $0x18, %rcx
subq %rcx, %rax
addq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
addq $0x18, %rax
movq -0x8(%rbp), %rcx
addq $0x40, %rcx
cmpq %rcx, %rax
je 0x194f
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
callq 0x12d0
movq -0x60(%rbp), %rdi
movq %rax, %rsi
callq 0x1960
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x48(%rbp)
xorl %eax, %eax
movq %rax, %rcx
addq $0x18, %rcx
subq %rcx, %rax
addq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x18f3
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/CkTD[P]btree/btree.c
// Function: bt_store_blk
static void bt_store_blk(BTree *bt, uint64_t blkid)
{
    ssize_t   rtv;
    uint64_t  blksize;
    void     *blk;

    if(blkid == 0)
        blk = (void *)bt->meta->blk;
    else
        blk = (void *)bt->blkid_to_node[blkid]->blk;
    

    blksize = bt_get_blksize(bt);
    bt_open_file(bt);
    rtv = lseek(bt->file_fd, blkid * blksize, SEEK_SET);
    assert(rtv == blkid * blksize);
    rtv = write(bt->file_fd, blk, blksize);
    assert(rtv == blksize);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x1988
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x19a0
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2810
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2830
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edi
movq -0x10(%rbp), %rsi
imulq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1080
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
imulq -0x20(%rbp), %rcx
cmpq %rcx, %rax
jne 0x19e5
jmp 0x1a04
leaq 0x2a0b(%rip), %rdi      # 0x43f7
leaq 0x2632(%rip), %rsi      # 0x4025
movl $0x445, %edx            # imm = 0x445
leaq 0x2a0f(%rip), %rcx      # 0x440e
callq 0x1090
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x1050
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0x1a28
jmp 0x1a47
leaq 0x2a04(%rip), %rdi      # 0x4433
leaq 0x25ef(%rip), %rsi      # 0x4025
movl $0x447, %edx            # imm = 0x447
leaq 0x29cc(%rip), %rcx      # 0x440e
callq 0x1090
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/CkTD[P]btree/btree.c
// Function: bt_node_search
static BTreeNode *bt_node_search(BTreeNode *node, uint64_t key)
{
    uint64_t i, key_count;

    if(bt_node_get_type(node) & BT_NODE_TYPE_LEAF)
        return node;

    key_count = bt_node_get_key_count(node);
    for(i = 0; i < key_count; i++)
    {
        if (key <= bt_node_get_key(node, i))
        {
            return bt_node_search(bt_node_get_child(node, i), key);
        }
    }
    return bt_node_search(bt_node_get_child(node, i), key);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x12f0
andl $0x4, %eax
cmpl $0x0, %eax
je 0x1afe
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1b8a
movq -0x10(%rbp), %rdi
callq 0x1c10
movq %rax, -0x28(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x1b6d
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x2530
movq %rax, %rcx
movq -0x30(%rbp), %rax
cmpq %rcx, %rax
ja 0x1b5d
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x24c0
movq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0x1ad0
movq %rax, -0x8(%rbp)
jmp 0x1b8a
jmp 0x1b5f
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1b13
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x24c0
movq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0x1ad0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/CkTD[P]btree/btree.c
// Function: bt_node_leaf_insert
static void bt_node_leaf_insert(BTreeNode *leaf, uint64_t key, uint64_t value)
{
    bt_node_marked_dirty(leaf);
    bt_node_blk_leaf_insert(leaf->blk, key, value);    
    if(bt_node_get_key_count(leaf) > bt_get_max_keys(leaf->tree))
    {
        // The bucket is full, do split before insert.
        bt_node_leaf_split(leaf);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1380
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x28c0
movq -0x8(%rbp), %rdi
callq 0x1c10
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x29a0
movq %rax, %rcx
movq -0x20(%rbp), %rax
cmpq %rcx, %rax
jbe 0x1c00
movq -0x8(%rbp), %rdi
callq 0x29c0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/CkTD[P]btree/btree.c
// Function: bt_search_range
BTreeValues *bt_search_range(BTree *bt, uint64_t limit, uint64_t key_min, uint64_t key_max)
{
    BTreeNode   *leaf;
    BTreeValues *values;
    int          remind;
    int          b_continue;

    values = bt_values_new();
    leaf = bt_node_search(bt->root, key_min);

    do
    {
        remind = limit - bt_values_get_count(values);
        b_continue = bt_node_leaf_fetch_values(leaf, values, remind, key_min, key_max);

        leaf = bt_node_get_right_sibling(leaf);
        if(leaf == NULL)
            break;

    } while (b_continue);

    return values;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
callq 0x39b0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x1ad0
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rdi
callq 0x17a0
movq %rax, %rcx
movq -0x40(%rbp), %rax
subq %rcx, %rax
movl %eax, -0x34(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movslq -0x34(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x1430
movl %eax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
callq 0x1cd0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x1cb6
jmp 0x1cbe
jmp 0x1cb8
cmpl $0x0, -0x38(%rbp)
jne 0x1c66
movq -0x30(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/CkTD[P]btree/btree.c
// Function: bt_node_get_right_sibling
static BTreeNode *bt_node_get_right_sibling(BTreeNode *node)
{
    uint64_t blkid;

    blkid = bt_node_blk_get_right_sibling_blkid(node->blk);
    if (blkid == 0)
        return NULL;
        
    return bt_get_node(node->tree, blkid);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x39f0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x1cfe
movq $0x0, -0x8(%rbp)
jmp 0x1d12
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x3770
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/CkTD[P]btree/btree.c
// Function: bt_open
BTree * bt_open(BTreeOpenFlag flag)
{
    assert(flag.file);
    if(access(flag.file, F_OK) != -1)
    {
        if(flag.error_if_exist)
            return NULL;
        return bt_new_from_file(flag.file);
    }
    else
    {
        // file not exist!
        if(!flag.create_if_missing)
            return NULL;
        if(flag.order % 2 != 1 || flag.order < 3)
            return NULL;
        return bt_new_empty(flag.file, flag.order);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, (%rax)
je 0x1d68
jmp 0x1d87
leaq 0x2426(%rip), %rdi      # 0x4195
leaq 0x22af(%rip), %rsi      # 0x4025
movl $0x4cd, %edx            # imm = 0x4CD
leaq 0x241d(%rip), %rcx      # 0x419f
callq 0x1090
movq -0x10(%rbp), %rax
movq (%rax), %rdi
xorl %esi, %esi
callq 0x1110
cmpl $-0x1, %eax
je 0x1dc0
movq -0x10(%rbp), %rax
cmpl $0x0, 0x14(%rax)
je 0x1dae
movq $0x0, -0x8(%rbp)
jmp 0x1e0f
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x1e20
movq %rax, -0x8(%rbp)
jmp 0x1e0f
movq -0x10(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x1dd4
movq $0x0, -0x8(%rbp)
jmp 0x1e0f
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
andq $0x1, %rax
cmpq $0x1, %rax
jne 0x1df1
movq -0x10(%rbp), %rax
cmpq $0x3, 0x8(%rax)
jae 0x1dfb
movq $0x0, -0x8(%rbp)
jmp 0x1e0f
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x1f70
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/CkTD[P]btree/btree.c
// Function: bt_new_from_file
static BTree *bt_new_from_file(const char *file)
{
    BTree    *bt;
    uint64_t  order;
    
    bt = (BTree *)malloc(sizeof(BTree));
    INIT_LIST_HEAD(&bt->deleted_node_chain);
    INIT_LIST_HEAD(&bt->new_node_chain);
    INIT_LIST_HEAD(&bt->dirty_node_chain);
    bt->file_path = (char *)malloc(strlen(file) + 1);
    strcpy(bt->file_path, file);
    bt->file_fd = -1;
    bt_load_meta(bt);
    order = bt_get_order(bt);
    bt->max_keys = order - 1;
    bt->min_keys = order / 2;
    // node blk id start from 1
    bt->blkid_to_node = (BTreeNode **)malloc(sizeof(BTreeNode *) * (bt_get_max_blkid(bt) + 1));
    memset(bt->blkid_to_node, 0, sizeof(BTreeNode *)*(bt_get_max_blkid(bt) + 1));

    bt_load_root(bt);

    return bt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl $0x68, %edi
callq 0x10d0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rcx
addq $0x30, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rcx
addq $0x30, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
jmp 0x1e5c
movq -0x10(%rbp), %rcx
addq $0x20, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rcx
addq $0x20, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0x1e7e
movq -0x10(%rbp), %rcx
addq $0x40, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x10(%rbp), %rcx
addq $0x40, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x8(%rbp), %rdi
callq 0x1060
movq %rax, %rdi
addq $0x1, %rdi
callq 0x10d0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rsi
callq 0x1040
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rdi
callq 0x3a10
movq -0x10(%rbp), %rdi
callq 0x2780
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rcx
subq $0x1, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x18(%rbp), %rcx
shrq %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x10(%rbp), %rdi
callq 0x21c0
movq %rax, %rdi
addq $0x1, %rdi
shlq $0x3, %rdi
callq 0x10d0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x21c0
movq -0x20(%rbp), %rdi
movq %rax, %rdx
addq $0x1, %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x10a0
movq -0x10(%rbp), %rdi
callq 0x3a40
movq -0x10(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/CkTD[P]btree/btree.c
// Function: bt_new_empty
static BTree *bt_new_empty(const char *file, uint64_t order)
{
    uint64_t      blksize;
    BTree        *bt;
    
    bt = (BTree *)malloc(sizeof(BTree));
 
    INIT_LIST_HEAD(&bt->deleted_node_chain);
    INIT_LIST_HEAD(&bt->new_node_chain);
    INIT_LIST_HEAD(&bt->dirty_node_chain);

    bt->file_path = (char *)malloc(strlen(file) + 1);
    strcpy(bt->file_path, file);
    bt->file_fd = -1;
    bt->max_keys = order - 1;
    bt->min_keys = order / 2;

    blksize = sizeof(BTreeNodeBlk) + (order * 2 - 1) * sizeof(uint64_t);
    assert(blksize >= sizeof(BTreeMetaBlk));

    bt->meta = bt_meta_new_empty(order, blksize);

    bt->blkid_to_node = (BTreeNode **)malloc(sizeof(BTreeNode *) * (bt_get_max_blkid(bt) + 1));
    memset(bt->blkid_to_node, 0, bt_get_max_blkid(bt) + 1);

    bt->root = bt_node_new_empty(bt, BT_NODE_TYPE_LEAF | BT_NODE_TYPE_ROOT);

    return bt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x68, %edi
callq 0x10d0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rcx
addq $0x30, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x20(%rbp), %rcx
addq $0x30, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x38(%rax)
jmp 0x1fb0
movq -0x20(%rbp), %rcx
addq $0x20, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rcx
addq $0x20, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0x1fd2
movq -0x20(%rbp), %rcx
addq $0x40, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x20(%rbp), %rcx
addq $0x40, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x8(%rbp), %rdi
callq 0x1060
movq %rax, %rdi
addq $0x1, %rdi
callq 0x10d0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rsi
callq 0x1040
movq -0x20(%rbp), %rax
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rcx
subq $0x1, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x10(%rbp), %rcx
shrq %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x10(%rbp), %rax
shlq %rax
subq $0x1, %rax
shlq $0x3, %rax
addq $0x28, %rax
movq %rax, -0x18(%rbp)
cmpq $0x30, -0x18(%rbp)
jb 0x206b
jmp 0x208a
leaq 0x282e(%rip), %rdi      # 0x48a0
leaq 0x1fac(%rip), %rsi      # 0x4025
movl $0x489, %edx            # imm = 0x489
leaq 0x283b(%rip), %rcx      # 0x48c0
callq 0x1090
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x3bb0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rdi
callq 0x21c0
movq %rax, %rdi
addq $0x1, %rdi
shlq $0x3, %rdi
callq 0x10d0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x21c0
movq -0x28(%rbp), %rdi
movq %rax, %rdx
addq $0x1, %rdx
xorl %esi, %esi
callq 0x10a0
movq -0x20(%rbp), %rdi
movl $0x5, %esi
callq 0x2e40
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/CkTD[P]btree/btree.c
// Function: bt_close
void bt_close(BTree *bt)
{
    uint64_t i;

    // flush tree to disk
    bt_flush(bt);

    // destory loaded node
    for(i = 1; i <= bt_get_max_blkid(bt); i++)
    {
        if(bt->blkid_to_node[i])
            bt_node_destory(bt->blkid_to_node[i]);
    }
    // destory meta     
    bt_meta_destory(bt->meta);


    free(bt->blkid_to_node);
    free(bt->file_path);
    free(bt);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1820
movq $0x1, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x21c0
movq %rax, %rcx
movq -0x18(%rbp), %rax
cmpq %rcx, %rax
ja 0x2182
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x2172
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x21e0
jmp 0x2174
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x212d
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x2210
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x1030
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x1030
movq -0x8(%rbp), %rdi
callq 0x1030
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/CkTD[P]btree/btree.c
// Function: bt_node_blk_leaf_insert
static void bt_node_blk_leaf_insert(BTreeNodeBlk *blk, uint64_t key, uint64_t value)
{
    uint64_t  pos;
    char     *src;
    char     *dest;
    uint64_t  n;

    assert(blk->type & BT_NODE_TYPE_LEAF);

    pos = bt_node_blk_leaf_search(blk, key);
    
    src = (char *)blk + sizeof(BTreeNodeBlk) + pos * sizeof(uint64_t) * 2;
    dest = src + 2 *sizeof(uint64_t);
    n = (blk->key_counts - pos) * 2 * sizeof(uint64_t);
    memmove(dest, src, n);

    *(uint64_t *)src = value;
    *((uint64_t *)(src) + 1) = key;

    blk->key_counts += 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
andq $0x4, %rax
cmpq $0x0, %rax
je 0x28e7
jmp 0x2906
leaq 0x1ab2(%rip), %rdi      # 0x43a0
leaq 0x1730(%rip), %rsi      # 0x4025
movl $0x1ad, %edx            # imm = 0x1AD
leaq 0x1b6e(%rip), %rcx      # 0x446f
callq 0x1090
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1590
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
addq $0x28, %rax
movq -0x20(%rbp), %rcx
shlq $0x3, %rcx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
subq -0x20(%rbp), %rax
shlq %rax
shlq $0x3, %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x10f0
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/CkTD[P]btree/btree.c
// Function: bt_node_leaf_split
static void bt_node_leaf_split(BTreeNode *node)
{
    uint64_t      split_key;
    uint64_t      type;
    BTreeNode    *new;

    assert(bt_node_get_type(node) & BT_NODE_TYPE_LEAF);
    assert(bt_get_max_keys(node->tree) + 1 == bt_node_get_key_count(node));
    
    type = bt_node_get_type(node);
    new = bt_node_cut(node, &split_key);

    if (type & BT_NODE_TYPE_ROOT)
    {
        // Root is the only leaf node
        bt_node_new_root_with_one_key(node->tree, split_key, node, new);
    }
    else
    {
        bt_node_none_leaf_insert(node->tree, bt_node_get_parent(node), node, new, split_key);
    } 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x12f0
andl $0x4, %eax
cmpl $0x0, %eax
je 0x29df
jmp 0x29fe
leaq 0x1aca(%rip), %rdi      # 0x44b0
leaq 0x1638(%rip), %rsi      # 0x4025
movl $0x345, %edx            # imm = 0x345
leaq 0x1ae2(%rip), %rcx      # 0x44db
callq 0x1090
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x29a0
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1c10
movq %rax, %rcx
movq -0x28(%rbp), %rax
cmpq %rcx, %rax
jne 0x2a29
jmp 0x2a48
leaq 0x1ad0(%rip), %rdi      # 0x4500
leaq 0x15ee(%rip), %rsi      # 0x4025
movl $0x346, %edx            # imm = 0x346
leaq 0x1a98(%rip), %rcx      # 0x44db
callq 0x1090
movq -0x8(%rbp), %rdi
callq 0x12f0
cltq
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x2ad0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x2a90
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x8(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x2be0
jmp 0x2abc
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2dd0
movq -0x30(%rbp), %rdi
movq %rax, %rsi
movq -0x8(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %r8
callq 0x2c60
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)