LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/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:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movsd %xmm0, 0x10(%rsp)
movq %rdi, %rbx
xorl %r14d, %r14d
testq %rdi, %rdi
cmovleq %r14, %rbx
xorps %xmm0, %xmm0
cmpq %r14, %rbx
je 0x2a66
incq %r14
cvtsi2sd %r14d, %xmm1
movsd %xmm0, 0x8(%rsp)
movsd 0x5c9(%rip), %xmm0      # 0x3008
divsd %xmm1, %xmm0
movsd 0x10(%rsp), %xmm1
callq 0x1090
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x8(%rsp), %xmm0
jmp 0x2a24
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbx
subq $0x50, %rsp
movq %rsi, %rbx
movsd %xmm1, 0x8(%rsp)
movapd %xmm0, 0x10(%rsp)
movsd 0x57e(%rip), %xmm1      # 0x3008
cvtsi2sd %rdi, %xmm2
subsd %xmm0, %xmm1
movsd 0x70d(%rip), %xmm0      # 0x31a8
movsd %xmm2, 0x48(%rsp)
divsd %xmm2, %xmm0
movsd %xmm1, 0x40(%rsp)
callq 0x1090
movsd %xmm0, 0x38(%rsp)
pushq $0x2
popq %rdi
movaps 0x10(%rsp), %xmm0
callq 0x2a07
movsd %xmm0, 0x30(%rsp)
movq %rbx, %rdi
callq 0x26a7
movsd 0x52f(%rip), %xmm1      # 0x3008
cvtss2sd %xmm0, %xmm0
movaps %xmm0, %xmm2
mulsd 0x8(%rsp), %xmm2
ucomisd %xmm2, %xmm1
jbe 0x2af5
movapd %xmm1, %xmm0
jmp 0x2b8a
movsd %xmm0, 0x28(%rsp)
movapd 0x10(%rsp), %xmm0
xorpd 0x6d7(%rip), %xmm0      # 0x31e0
movsd %xmm2, 0x10(%rsp)
callq 0x1040
addsd 0x4ec(%rip), %xmm0      # 0x3008
ucomisd 0x10(%rsp), %xmm0
movsd 0x67e(%rip), %xmm0      # 0x31a8
ja 0x2b8a
movsd 0x4d4(%rip), %xmm2      # 0x3008
movapd %xmm2, %xmm1
divsd 0x40(%rsp), %xmm1
movapd %xmm2, %xmm3
subsd 0x38(%rsp), %xmm3
movsd 0x30(%rsp), %xmm0
divsd 0x8(%rsp), %xmm0
subsd %xmm0, %xmm2
divsd %xmm2, %xmm3
movsd 0x28(%rsp), %xmm0
mulsd %xmm3, %xmm0
subsd %xmm3, %xmm0
addsd 0x496(%rip), %xmm0      # 0x3008
callq 0x1090
mulsd 0x48(%rsp), %xmm0
cvttsd2si %xmm0, %rax
incq %rax
cvtsi2sd %rax, %xmm0
addq $0x50, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
leaq 0x1df5(%rip), %rdi      # 0x302a
xorl %eax, %eax
callq 0x1060
leaq 0x1dfa(%rip), %r15      # 0x303d
xorl %r12d, %r12d
cmpq %r12, %rbx
je 0x125f
movzbl (%r14,%r12), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1060
incq %r12
jmp 0x1246
leaq 0x1e67(%rip), %rdi      # 0x30cd
callq 0x1050
movq 0x3d66(%rip), %rax      # 0x4fd8
movq (%rax), %rdi
callq 0x1080
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
leaq 0x1d4f(%rip), %rdi      # 0x302e
xorl %eax, %eax
callq 0x1060
leaq 0x1d50(%rip), %r15      # 0x303d
xorl %r12d, %r12d
cmpq %r12, %rbx
je 0x1309
movzbl (%r14,%r12), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1060
incq %r12
jmp 0x12f0
leaq 0x1dbd(%rip), %rdi      # 0x30cd
callq 0x1050
movq 0x3cbc(%rip), %rax      # 0x4fd8
movq (%rax), %rdi
callq 0x1080
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
cmpl $0x2, %edi
jne 0x1519
movq 0x8(%rsi), %rdi
cmpb $0x2d, (%rdi)
jne 0x14d3
cmpb $0x0, 0x1(%rdi)
je 0x152c
xorl %esi, %esi
xorl %eax, %eax
callq 0x10a0
movl %eax, %edi
cmpl $-0x1, %eax
je 0x1530
leaq 0x3b96(%rip), %rsi      # 0x5080
xorl %ebx, %ebx
xorl %edx, %edx
callq 0x1ed2
cmpq $-0x1, %rax
jne 0x1528
movq 0x3af8(%rip), %rax      # 0x4ff8
movq (%rax), %rcx
leaq 0x1b9d(%rip), %rdi      # 0x30a7
pushq $0x13
popq %rsi
pushq $0x1
popq %rdx
callq 0x10c0
pushq $0x4
jmp 0x1527
leaq 0x1be5(%rip), %rdi      # 0x3105
callq 0x1050
pushq $0x1
popq %rbx
movl %ebx, %eax
popq %rbx
retq
xorl %edi, %edi
jmp 0x14e3
leaq 0x1b6b(%rip), %rdi      # 0x30a2
callq 0x10b0
pushq $0x2
jmp 0x1527
// File: /workspace/github_c_makefile_star2_O2/vi[P]simple_cbor_stream_parse/scsp.c
// Function: scsp_closeelements
SCSP_INT static scsp_closeelements(
                struct scsp_state* state, 
                struct scsp_callbacks* callbacks,
                SCSP_USERDATA userdata) {
    while (state->cur_depth > 0) {
        struct scsp_stack_entry* se1 = &state->stack[state->cur_depth- 1];
        if (se1->remaining >= 0) {
            if (se1->remaining == 0) {
                SCSP_DEBUG("internal error: remaining=0?\n");
                return -1;
            }
            se1->remaining -= 1;
            if (se1->remaining == 0) {
                switch(se1->type) {
                    case ']': 
                    case '[':
                         CALLBACK0(array_closed);
                         break;
                    case '{': 
                    case '}':
                        CALLBACK0(map_closed);
                        break;
                    case 'B':
                        CALLBACK0(bytestring_closed);
                        break;
                    case 'S':
                        CALLBACK0(string_closed);
                        break;
                    case 'b':
                    case 's':
                        SCSP_DEBUG("interal error 5\n");
                        return -1;
                    default: {
                        SCSP_DEBUG("internal error: se->type=%c ?\n", se1->type);
                        return -1;
                    }
                }
                state->cur_depth -= 1;
                continue;
            }
        } else {
            if (se1->type == '}') {
                if (se1->remaining == -1) {
                    se1->remaining = -2;
                } else {
                    se1->remaining = -1;
                }
            }
        }
        break;
    }
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movq (%rdi), %rax
leaq 0x8(%rdi), %r13
pushq $-0x1
popq %rbx
testq %rax, %rax
jle 0x1ec3
shlq $0x4, %rax
addq %r13, %rax
addq $-0x10, %rax
movq 0x8(%rax), %rcx
testq %rcx, %rcx
js 0x1eae
je 0x1ec5
decq %rcx
movq %rcx, 0x8(%rax)
jne 0x1ec3
movzbl (%rax), %eax
cmpl $0x42, %eax
je 0x1e88
cmpl $0x53, %eax
je 0x1e8e
cmpl $0x5b, %eax
je 0x1e7c
cmpl $0x7d, %eax
je 0x1e82
cmpl $0x7b, %eax
je 0x1e82
cmpl $0x5d, %eax
jne 0x1ec5
movq 0x48(%r15), %rax
jmp 0x1e92
movq 0x68(%r15), %rax
jmp 0x1e92
movq 0x18(%r15), %rax
jmp 0x1e92
movq 0x30(%r15), %rax
testq %rax, %rax
je 0x1ea1
movq %r14, %rdi
callq *%rax
testq %rax, %rax
js 0x1ec5
movq (%r12), %rax
decq %rax
movq %rax, (%r12)
jmp 0x1e33
cmpb $0x7d, (%rax)
jne 0x1ec3
xorl %edx, %edx
cmpq $-0x1, %rcx
sete %dl
notq %rdx
movq %rdx, 0x8(%rax)
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20b8, %rsp           # imm = 0x20B8
movq %rdx, (%rsp)
movq %rsi, %r15
leaq 0x8(%rsp), %rax
andq $0x0, (%rax)
movl %edi, %ebp
xorl %r13d, %r13d
leaq (%rsp,%r13), %r12
addq $0x110, %r12            # imm = 0x110
movl $0x1f9c, %ebx           # imm = 0x1F9C
subq %r13, %rbx
movl %ebp, %edi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x1070
cmpq $-0x1, %rax
jne 0x1f3b
callq 0x1030
movl (%rax), %eax
cmpl $0x4, %eax
je 0x1f0b
cmpl $0xb, %eax
jne 0x1fa0
movl $0x186a0, %edi          # imm = 0x186A0
callq 0x10d0
jmp 0x1f0b
movq %rax, %r14
testq %rax, %rax
je 0x1f9b
addq %r13, %r14
xorl %r12d, %r12d
movq %r14, %r13
subq %r12, %r13
jbe 0x1ef5
leaq (%rsp,%r12), %rbx
addq $0x110, %rbx            # imm = 0x110
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
movq (%rsp), %rdx
movq %rbx, %rcx
movq %r13, %r8
callq 0x1540
cmpl $-0x1, %eax
je 0x1fa0
testl %eax, %eax
je 0x1f83
cltq
addq %rax, %r12
jmp 0x1f49
leaq 0x110(%rsp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x1090
jmp 0x1ef8
movq %r13, %rax
jmp 0x1fa3
pushq $-0x1
popq %rax
addq $0x20b8, %rsp           # imm = 0x20B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movq %rsp, %rax
andq $0x0, (%rax)
xorl %r13d, %r13d
movq %r15, %rbp
subq %r13, %rbp
jbe 0x2012
leaq (%r12,%r13), %rcx
movq %r15, %rbp
subq %r13, %rbp
movq %rsp, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %rbp, %r8
callq 0x1540
cmpl $-0x1, %eax
je 0x200f
testl %eax, %eax
je 0x2012
cltq
addq %rax, %r13
jmp 0x1fdc
pushq $-0x1
popq %rbp
movq %rbp, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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:
testb $0x4, (%rdi)
jne 0x1291
movq %rsi, %rcx
shlq $0x4, %rcx
leaq (%rdi,%rcx), %rax
addq $0x28, %rax
addq %rdi, %rcx
addq $0x38, %rcx
movq 0x8(%rdi), %rdx
subq %rsi, %rdx
shlq $0x4, %rdx
orq $0x8, %rdx
movq %rcx, %rdi
movq %rax, %rsi
jmp 0x1120
pushq %rax
leaq 0x1d6b(%rip), %rdi      # 0x3004
leaq 0x1d85(%rip), %rsi      # 0x3025
leaq 0x1d86(%rip), %rcx      # 0x302d
movl $0x1c2, %edx            # imm = 0x1C2
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O2/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:
movq (%rdi), %rax
movq 0x28(%rdi), %rcx
leaq 0x30(%rax), %rdx
cmpq %rdx, %rcx
je 0x1306
leaq 0x20(%rax), %rdx
cmpq %rdx, %rcx
je 0x1305
addq $0x40, %rax
cmpq %rax, %rcx
je 0x1305
movq %rax, 0x28(%rdi)
leaq 0x18(%rdi), %rcx
movq (%rax), %rdx
movq %rcx, 0x8(%rdx)
movq %rdx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
movq %rcx, (%rax)
retq
pushq %rax
leaq 0x1fbb(%rip), %rdi      # 0x32c9
leaq 0x1d10(%rip), %rsi      # 0x3025
leaq 0x1fdc(%rip), %rcx      # 0x32f8
movl $0x1f5, %edx            # imm = 0x1F5
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, 0x10(%rsp)
movq %rdi, %r13
movq 0x8(%rdi), %rdi
movq 0x8(%rdi), %rbx
testq %rbx, %rbx
je 0x13d5
movq %rdx, %r14
movq %rsi, %r15
movq %rcx, %rsi
callq 0x1427
movq %rax, 0x8(%rsp)
movq %r14, (%rsp)
leaq -0x1(%r14), %r12
xorl %r14d, %r14d
movq 0x8(%rsp), %rax
leaq (%rax,%r14), %rbp
cmpq %rbx, %rbp
jae 0x13cc
movq 0x8(%r13), %rdi
movq %rbp, %rsi
callq 0x1459
cmpq 0x10(%rsp), %rax
ja 0x13cc
movq 0x8(%r13), %rdi
movq %rbp, %rsi
callq 0x1489
movq %rax, %rbp
movq (%r15), %rax
movq 0x8(%r15), %rdi
leaq 0x1(%rax), %rcx
movq %rcx, (%r15)
leaq 0x8(,%rax,8), %rsi
callq 0x1110
movq %rax, 0x8(%r15)
movq (%r15), %rcx
movq %rbp, -0x8(%rax,%rcx,8)
cmpq %r14, %r12
je 0x13fb
incq %r14
jmp 0x136b
movq %r14, %rax
movq (%rsp), %rdx
jmp 0x1402
xorl %eax, %eax
testb $0x1, (%rdi)
jne 0x1418
leaq 0x1c8a(%rip), %rdi      # 0x306d
leaq 0x1c3b(%rip), %rsi      # 0x3025
leaq 0x1ca7(%rip), %rcx      # 0x3098
movl $0x384, %edx            # imm = 0x384
callq 0x10b0
movq (%rsp), %rdx
movq %rdx, %rax
subq 0x8(%rsp), %rbx
cmpq %r14, %rbx
sete %cl
cmpq %rdx, %rax
setb %al
andb %cl, %al
movzbl %al, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r15
xorl %r14d, %r14d
cmpq 0x8(%r15), %r14
jae 0x1450
movq %r15, %rdi
movq %r14, %rsi
callq 0x1459
cmpq %rbx, %rax
jae 0x1450
incq %r14
jmp 0x1435
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rax
testb $0x4, (%rdi)
je 0x14a0
cmpq %rsi, 0x8(%rdi)
jbe 0x14bf
shlq $0x4, %rsi
movq 0x28(%rdi,%rsi), %rax
popq %rcx
retq
leaq 0x1edd(%rip), %rdi      # 0x3384
leaq 0x1b77(%rip), %rsi      # 0x3025
leaq 0x1eed(%rip), %rcx      # 0x33a2
movl $0x156, %edx            # imm = 0x156
callq 0x10b0
leaq 0x1e6f(%rip), %rdi      # 0x3335
leaq 0x1b58(%rip), %rsi      # 0x3025
leaq 0x1ece(%rip), %rcx      # 0x33a2
movl $0x157, %edx            # imm = 0x157
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rax
cmpl $0x0, 0x8(%rax)
je 0x1542
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1582
leaq 0x20(%rbx), %r14
movq %r14, %r15
movq (%r15), %r15
cmpq %r14, %r15
je 0x155f
movq -0x8(%r15), %rsi
movq %rbx, %rdi
callq 0x1582
jmp 0x1549
leaq 0x40(%rbx), %r14
movq %r14, %r15
movq (%r15), %r15
cmpq %r14, %r15
je 0x157c
movq -0x8(%r15), %rsi
movq %rbx, %rdi
callq 0x1582
jmp 0x1566
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
testq %rsi, %rsi
je 0x15a7
movq 0x18(%rbx), %rax
movq 0x60(%rbx), %rcx
movq (%rcx,%r14,8), %rcx
addq $0x8, %rcx
jmp 0x15ae
movq 0x18(%rbx), %rax
movq %rax, %rcx
movq (%rcx), %r12
movq (%rax), %rax
movq 0x10(%rax), %r15
movq %rbx, %rdi
callq 0x1edf
movl 0x8(%rbx), %edi
imulq %r15, %r14
movq %r14, %rsi
xorl %edx, %edx
callq 0x10a0
cmpq %r14, %rax
jne 0x15f5
movl 0x8(%rbx), %edi
movq %r12, %rsi
movq %r15, %rdx
callq 0x1070
cmpq %r15, %rax
jne 0x1614
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x1ddf(%rip), %rdi      # 0x33db
leaq 0x1a22(%rip), %rsi      # 0x3025
leaq 0x1de8(%rip), %rcx      # 0x33f2
movl $0x445, %edx            # imm = 0x445
callq 0x10b0
leaq 0x1dfc(%rip), %rdi      # 0x3417
leaq 0x1a03(%rip), %rsi      # 0x3025
leaq 0x1dc9(%rip), %rcx      # 0x33f2
movl $0x447, %edx            # imm = 0x447
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O2/CkTD[P]btree/btree.c
// Function: bt_insert
void bt_insert(BTree *bt, uint64_t key, uint64_t value)
{
    BTreeNode  *leaf;

    leaf = bt_node_search(bt->root, key);
    bt_node_leaf_insert(leaf, key, value);   
    
    assert(bt_node_get_key_count(leaf) <= bt->max_keys);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
callq 0x17b5
movq %rax, %r14
movq %rax, %rdi
callq 0x12c9
movq 0x8(%r14), %r13
testb $0x4, (%r13)
je 0x1739
movq %r13, %rdi
movq %r15, %rsi
callq 0x1427
movq 0x8(%r13), %rdx
subq %rax, %rdx
shlq $0x4, %rax
leaq (%rax,%r13), %rsi
addq $0x28, %rsi
leaq (%rax,%r13), %rbp
addq $0x38, %rbp
shlq $0x4, %rdx
movq %rbp, %rdi
callq 0x1120
movq %r12, -0x10(%rbp)
movq %r15, -0x8(%rbp)
incq 0x8(%r13)
movq (%r14), %rcx
movq 0x8(%r14), %rdx
movq 0x8(%rdx), %rax
movq 0x58(%rcx), %rcx
cmpq %rcx, %rax
jbe 0x1724
movl (%rdx), %ebp
testb $0x4, %bpl
je 0x1777
incq %rcx
cmpq %rax, %rcx
jne 0x1796
movq %rsp, %rsi
movq %r14, %rdi
callq 0x1f24
movq %rax, %r15
movq (%r14), %r12
testb $0x1, %bpl
jne 0x170a
movq %r14, %rdi
callq 0x22cd
movq (%rsp), %r8
movq %r12, %rdi
movq %rax, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x20df
jmp 0x171c
movq (%rsp), %rsi
movq %r12, %rdi
movq %r14, %rdx
movq %r15, %rcx
callq 0x2070
movq 0x8(%r14), %rax
movq 0x8(%rax), %rax
cmpq 0x58(%rbx), %rax
ja 0x1758
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1c44(%rip), %rdi      # 0x3384
leaq 0x18de(%rip), %rsi      # 0x3025
leaq 0x1d05(%rip), %rcx      # 0x3453
movl $0x1ad, %edx            # imm = 0x1AD
callq 0x10b0
leaq 0x19de(%rip), %rdi      # 0x313d
leaq 0x18bf(%rip), %rsi      # 0x3025
leaq 0x19fc(%rip), %rcx      # 0x3169
movl $0x4ab, %edx            # imm = 0x4AB
callq 0x10b0
leaq 0x1d16(%rip), %rdi      # 0x3494
leaq 0x18a0(%rip), %rsi      # 0x3025
leaq 0x1d33(%rip), %rcx      # 0x34bf
movl $0x345, %edx            # imm = 0x345
callq 0x10b0
leaq 0x1d47(%rip), %rdi      # 0x34e4
leaq 0x1881(%rip), %rsi      # 0x3025
leaq 0x1d14(%rip), %rcx      # 0x34bf
movl $0x346, %edx            # imm = 0x346
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%r14), %rax
testb $0x4, (%rax)
jne 0x1800
movq 0x8(%rax), %r15
xorl %r12d, %r12d
cmpq %r12, %r15
je 0x17f0
movq %r14, %rdi
movq %r12, %rsi
callq 0x1db4
cmpq %rbx, %rax
jae 0x17ed
incq %r12
jmp 0x17d3
movq %r12, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x1d30
movq %rax, %r14
jmp 0x17c3
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r13
pushq $0x1
popq %rdi
pushq $0x10
popq %rsi
callq 0x10e0
movq %rax, %r12
movq 0x10(%r13), %rdi
movq %r14, %rsi
callq 0x17b5
movq %rax, %r13
movl %r15d, %eax
subl (%r12), %eax
movslq %eax, %rdx
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rcx
movq %rbx, %r8
callq 0x1326
movl %eax, %ebp
movq %r13, %rdi
callq 0x1886
testq %rax, %rax
je 0x1874
movq %rax, %r13
testl %ebp, %ebp
jne 0x1843
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x1526
pushq $0x1
popq %r15
movq 0x18(%rbx), %r14
movq (%r14), %rdi
cmpq 0x28(%rdi), %r15
ja 0x1b72
movq 0x60(%rbx), %rax
movq (%rax,%r15,8), %r14
testq %r14, %r14
je 0x1b6d
movq 0x8(%r14), %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
incq %r15
jmp 0x1b42
callq 0x1030
movq %r14, %rdi
callq 0x1030
movq 0x60(%rbx), %rdi
callq 0x1030
movq (%rbx), %rdi
callq 0x1030
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O2/CkTD[P]btree/btree.c
// Function: bt_node_get_child
static BTreeNode *bt_node_get_child(BTreeNode *node, uint64_t index)
{
    uint64_t blkid;
    blkid = bt_node_blk_get_child_blkid(node->blk, index);
    assert(blkid);

    return bt_get_node(node->tree, blkid);
}

// Assembly:
pushq %rax
movq 0x8(%rdi), %rax
testb $0x4, (%rax)
jne 0x1d57
cmpq %rsi, 0x8(%rax)
jb 0x1d76
shlq $0x4, %rsi
movq 0x28(%rax,%rsi), %rsi
testq %rsi, %rsi
je 0x1d95
movq (%rdi), %rdi
popq %rax
jmp 0x24f2
leaq 0x12a6(%rip), %rdi      # 0x3004
leaq 0x12c0(%rip), %rsi      # 0x3025
leaq 0x1b5f(%rip), %rcx      # 0x38cb
movl $0x16f, %edx            # imm = 0x16F
callq 0x10b0
leaq 0x1b8d(%rip), %rdi      # 0x390a
leaq 0x12a1(%rip), %rsi      # 0x3025
leaq 0x1b40(%rip), %rcx      # 0x38cb
movl $0x170, %edx            # imm = 0x170
callq 0x10b0
leaq 0x17f0(%rip), %rdi      # 0x358c
leaq 0x1282(%rip), %rsi      # 0x3025
leaq 0x1aed(%rip), %rcx      # 0x3897
movl $0x267, %edx            # imm = 0x267
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O2/CkTD[P]btree/btree.c
// Function: bt_print
void bt_print(BTree *bt)
{
    printf("---------- Meta ----------\n");
    printf("order:    %lu\n", bt_get_order(bt));
    printf("blksize:  %lu\n", bt->meta->blk->blk_size);
    printf("blkcount: %lu\n", bt->meta->blk->blk_counts);
    printf("maxblkid: %lu\n", bt->meta->blk->max_blkid);
    printf("rootblk:  %lu\n", bt->meta->blk->root_blkid);
    bt_node_print(bt->root);

    BTreeNode *node;

    printf("new blks: ");
    list_for_each_entry(node, &bt->new_node_chain, chain)
    {
        printf("%lu ",node->blkid);
    }
    printf("\n");

    printf("dirty blks: ");
    list_for_each_entry(node, &bt->dirty_node_chain, chain)
    {
        printf("%lu ",node->blkid);
    }
    printf("\n");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1b54(%rip), %rdi      # 0x3923
callq 0x1060
movq 0x18(%rbx), %rax
movq (%rax), %rax
movq 0x8(%rax), %rsi
leaq 0x147b(%rip), %rdi      # 0x3261
xorl %eax, %eax
callq 0x1090
movq 0x18(%rbx), %rax
movq (%rax), %rax
movq 0x10(%rax), %rsi
leaq 0x1471(%rip), %rdi      # 0x3270
xorl %eax, %eax
callq 0x1090
movq 0x18(%rbx), %rax
movq (%rax), %rax
movq 0x20(%rax), %rsi
leaq 0x1467(%rip), %rdi      # 0x327f
xorl %eax, %eax
callq 0x1090
movq 0x18(%rbx), %rax
movq (%rax), %rax
movq 0x28(%rax), %rsi
leaq 0x145d(%rip), %rdi      # 0x328e
xorl %eax, %eax
callq 0x1090
movq 0x18(%rbx), %rax
movq (%rax), %rax
movq 0x18(%rax), %rsi
leaq 0x1453(%rip), %rdi      # 0x329d
xorl %eax, %eax
callq 0x1090
movq 0x10(%rbx), %rdi
callq 0x1b9d
leaq 0x144b(%rip), %rdi      # 0x32ac
xorl %eax, %eax
callq 0x1090
leaq 0x20(%rbx), %r15
leaq 0x1444(%rip), %r14      # 0x32b7
movq %r15, %r12
movq (%r12), %r12
cmpq %r15, %r12
je 0x1e90
movq -0x8(%r12), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1090
jmp 0x1e76
pushq $0xa
popq %rdi
callq 0x1040
leaq 0x141d(%rip), %rdi      # 0x32bc
xorl %eax, %eax
callq 0x1090
addq $0x40, %rbx
leaq 0x1406(%rip), %r14      # 0x32b7
movq %rbx, %r15
movq (%r15), %r15
cmpq %rbx, %r15
je 0x1ecc
movq -0x8(%r15), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1090
jmp 0x1eb4
pushq $0xa
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1040
// File: /workspace/github_c_makefile_star2_O2/CkTD[P]btree/btree.c
// Function: bt_node_cut
static BTreeNode *bt_node_cut(BTreeNode *node, uint64_t *split_key)
{
    BTree        *tree;
    uint64_t      type;
    BTreeNode    *new;
    uint64_t      min_keys, max_keys;

    tree = node->tree;
    min_keys = bt_get_min_keys(tree);
    max_keys = bt_get_max_keys(tree);

    assert(bt_node_get_key_count(node) == max_keys + 1);

    if(bt_node_get_type(node) & BT_NODE_TYPE_LEAF)
    {
        type = BT_NODE_TYPE_LEAF;
    }
    else
    {
        type = BT_NODE_TYPE_INTERNAL;
    }

    new = bt_node_new_empty(tree, type);
    *split_key = bt_node_get_key(node, min_keys);
    // not link internal node in same layer?
    //if(bt_node_get_type(node) & BT_NODE_TYPE_LEAF)
    //{
        bt_node_link_sibling(new, bt_node_get_right_sibling(node));
        bt_node_link_sibling(node, new);
    //}
    bt_node_move_half_content(new, node, min_keys);
 

    bt_node_set_type(node, type);
    return new;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
movq 0x8(%rbx), %rax
movq 0x58(%rdi), %rcx
incq %rcx
cmpq %rcx, 0x8(%rax)
jne 0x2051
movq %rsi, %r13
movq 0x50(%rdi), %r12
movl (%rax), %r14d
andl $0x4, %r14d
shrl %r14d
addq $0x2, %r14
movq %r14, %rsi
callq 0x22e5
movq %rax, %r15
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1db4
movq %rax, (%r13)
movq %rbx, %rdi
callq 0x1886
movq %r15, %rdi
movq %rax, %rsi
callq 0x23a6
movq %rbx, %rdi
movq %r15, %rsi
callq 0x23a6
leaq 0x1(%r12), %rbp
movq 0x8(%r15), %rdi
movq 0x8(%rbx), %rax
movq %r12, %rcx
shlq $0x4, %rcx
movl (%rdi), %edx
andl $0x4, %edx
leaq (%rcx,%rdx,2), %rdx
xorq $0x8, %rdx
addq $0x28, %rdi
movq %rbp, %rcx
shlq $0x4, %rcx
leaq (%rax,%rcx), %rsi
addq $0x28, %rsi
callq 0x10f0
movq 0x8(%rbx), %rax
testb $0x4, (%rax)
jne 0x2002
xorl %r13d, %r13d
cmpq %r12, %r13
ja 0x2002
movq %rbp, %rsi
addq %r13, %rsi
movq %rbx, %rdi
callq 0x1d30
movq %r15, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x243f
incq %r13
jmp 0x1fdc
movq %r15, %rdi
movq %r12, %rsi
callq 0x2492
movq 0x8(%rbx), %rax
btl $0x2, (%rax)
adcq $0x0, %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2492
movq %rbx, %rdi
callq 0x12c9
movq %r15, %rdi
callq 0x12c9
movq %rbx, %rdi
movl %r14d, %esi
callq 0x12bd
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x14cb(%rip), %rdi      # 0x3523
leaq 0xfc6(%rip), %rsi       # 0x3025
leaq 0x14e9(%rip), %rcx      # 0x354f
movl $0x2f3, %edx            # imm = 0x2F3
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O2/CkTD[P]btree/btree.c
// Function: bt_node_new_root_with_one_key
static BTreeNode *bt_node_new_root_with_one_key(BTree *bt, uint64_t split_key, BTreeNode *left, BTreeNode *right)
{
    BTreeNode    *new_root;

    new_root = bt_node_new_empty(bt, BT_NODE_TYPE_ROOT);

    bt_node_set_key_and_link(new_root, 0, split_key, left, right);
    bt_node_set_key_count(new_root , 1);

    bt->root = new_root;
    bt_set_root_blkid(bt, new_root->blkid);

    return new_root;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
pushq $0x1
popq %r13
movq %r13, %rsi
callq 0x22e5
movq %rax, %rbp
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0x249f
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2492
movq %rbp, 0x10(%r12)
movq 0x10(%rbp), %rax
movq 0x18(%r12), %rcx
movl $0x1, 0x8(%rcx)
movq (%rcx), %rcx
movq %rax, 0x18(%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/CkTD[P]btree/btree.c
// Function: bt_node_new_empty
static BTreeNode *bt_node_new_empty(BTree *tree, uint64_t type)
{
    BTreeNode    *node;
    BTreeNodeBlk *blk;

    blk = bt_node_blk_new_empty(bt_get_blksize(tree), type);
    node = (BTreeNode *)malloc(sizeof(BTreeNode));
    node->blkid = bt_next_blkid(tree);
    node->blk = blk;
    node->tree = tree;
    node->state = NULL;
    bt_node_marked_new(node); // init state and chain

    bt_set_node(tree, node->blkid, node);
    
    return node;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %r13
movq (%r13), %rbp
movq 0x10(%rbp), %r15
leaq 0x10(%r15), %rdi
callq 0x1100
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x10c0
movq %r14, (%r12)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%r12)
movups %xmm0, 0x18(%r12)
pushq $0x30
popq %rdi
callq 0x1100
movq %rax, %r14
movl $0x1, 0x8(%r13)
movdqu 0x20(%rbp), %xmm0
pcmpeqd %xmm1, %xmm1
psubq %xmm1, %xmm0
movdqu %xmm0, 0x20(%rbp)
pshufd $0xee, %xmm0, %xmm0     # xmm0 = xmm0[2,3,2,3]
movq %xmm0, %rsi
movq %xmm0, 0x10(%rax)
movq %r12, 0x8(%rax)
movq %rbx, (%rax)
leaq 0x20(%rbx), %rax
movq %rax, 0x28(%r14)
leaq 0x18(%r14), %rcx
movq 0x20(%rbx), %rdx
movq %rcx, 0x8(%rdx)
movq %rdx, 0x18(%r14)
movq %rax, 0x20(%r14)
movq %rcx, 0x20(%rbx)
movq %rbx, %rdi
movq %r14, %rdx
callq 0x23e1
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/CkTD[P]btree/btree.c
// Function: bt_node_link_sibling
static void bt_node_link_sibling(BTreeNode *left, BTreeNode *right)
{
    if (!left || !right)
        return;

    bt_node_blk_link_sibling(left->blk, right->blk, left->blkid, right->blkid);

    bt_node_marked_dirty(left);
    bt_node_marked_dirty(right);
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x23e0
pushq %rbx
movq %rsi, %rbx
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
movq 0x8(%rsi), %rdx
movq 0x10(%rsi), %rsi
movq %rsi, 0x20(%rax)
movq %rcx, 0x18(%rdx)
callq 0x12c9
movq %rbx, %rdi
popq %rbx
jmp 0x12c9
retq
// File: /workspace/github_c_makefile_star2_O2/CkTD[P]btree/btree.c
// Function: bt_set_node
static void bt_set_node(BTree *bt, uint64_t blkid, BTreeNode *node)
{

    uint64_t max_blkid;
    max_blkid = bt_get_max_blkid(bt);

    assert(blkid <= max_blkid);


    // TODO....  only realloc if really needed
    if(blkid == max_blkid)
        bt->blkid_to_node = (BTreeNode **)realloc(bt->blkid_to_node, sizeof(BTreeNode *) * (max_blkid + 1));
    bt->blkid_to_node[blkid] = node;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x18(%rdi), %rax
movq (%rax), %rax
cmpq %rsi, 0x28(%rax)
jb 0x2420
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x60(%rdi), %rax
jne 0x2416
leaq 0x8(,%r14,8), %rsi
movq %rax, %rdi
callq 0x1110
movq %rax, 0x60(%r15)
movq %rbx, (%rax,%r14,8)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1158(%rip), %rdi      # 0x357f
leaq 0xbf7(%rip), %rsi       # 0x3025
leaq 0x115d(%rip), %rcx      # 0x3592
movl $0x403, %edx            # imm = 0x403
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O2/CkTD[P]btree/btree.c
// Function: bt_get_node
static BTreeNode *bt_get_node(BTree *bt, uint64_t blkid)
{
    uint64_t max_blkid;
    max_blkid = bt_get_max_blkid(bt);

    assert(blkid <= max_blkid);

    // TODO....  only realloc if really needed
    if (bt->blkid_to_node[blkid] == NULL)
        bt_node_new_from_file(bt, blkid);

    return bt->blkid_to_node[blkid];
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x18(%rdi), %rax
movq (%rax), %rax
cmpq %rsi, 0x28(%rax)
jb 0x2531
movq %rsi, %rbx
movq %rdi, %r14
movq 0x60(%rdi), %rax
movq (%rax,%rsi,8), %rax
testq %rax, %rax
jne 0x2529
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2550
movq 0x60(%r14), %rax
movq (%rax,%rbx,8), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x1047(%rip), %rdi      # 0x357f
leaq 0xae6(%rip), %rsi       # 0x3025
leaq 0x125f(%rip), %rcx      # 0x37a5
movl $0x411, %edx            # imm = 0x411
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O2/CkTD[P]btree/btree.c
// Function: bt_node_new_from_file
static BTreeNode *bt_node_new_from_file(BTree *bt, uint64_t blkid)
{
    BTreeNode    *node;
    BTreeNodeBlk *blk;
    blk =  bt_node_blk_new_from_file(bt, blkid);
    node = (BTreeNode *)malloc(sizeof(BTreeNode));
    node->blk = blk;
    node->blkid = blkid;
    node->tree = bt;
    node->state = NULL;     // clean node.

    bt_set_node(bt, blkid, node);

    return node;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rdi), %rax
movq (%rax), %rax
movq 0x10(%rax), %r15
leaq 0x10(%r15), %rdi
callq 0x1100
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x10c0
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x25c8
pushq $0x30
popq %rdi
callq 0x1100
movq %rax, %r15
movq %r12, 0x8(%rax)
movq %rbx, 0x10(%rax)
movq %r14, (%rax)
andq $0x0, 0x28(%rax)
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x23e1
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/CkTD[P]btree/btree.c
// Function: bt_load_blk
static void bt_load_blk(BTree *bt, void *dst, uint64_t blkid)
{
    ssize_t   rtv;
    uint64_t  blksize;

    // when load Meta block, blksize is unknown
    if (blkid == 0)
        blksize = sizeof(BTreeMetaBlk);
    else
        blksize = bt_get_blksize(bt);
    
    bt_open_file(bt);
    rtv = lseek(bt->file_fd, blkid * blksize, SEEK_SET);
    assert(rtv == blkid * blksize);
    rtv = read(bt->file_fd, dst, blksize);
    assert(rtv == blksize);

}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r15
testq %rdx, %rdx
je 0x25eb
movq 0x18(%r15), %rax
movq (%rax), %rax
movq 0x10(%rax), %r14
jmp 0x25ef
pushq $0x30
popq %r14
movq %r15, %rdi
callq 0x1edf
movl 0x8(%r15), %edi
imulq %r14, %r12
movq %r12, %rsi
xorl %edx, %edx
callq 0x10a0
cmpq %r12, %rax
jne 0x262e
movl 0x8(%r15), %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x10d0
cmpq %r14, %rax
jne 0x264d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0xda6(%rip), %rdi       # 0x33db
leaq 0x9e9(%rip), %rsi       # 0x3025
leaq 0x118c(%rip), %rcx      # 0x37cf
movl $0x430, %edx            # imm = 0x430
callq 0x10b0
leaq 0xdc3(%rip), %rdi       # 0x3417
leaq 0x9ca(%rip), %rsi       # 0x3025
leaq 0x116d(%rip), %rcx      # 0x37cf
movl $0x432, %edx            # imm = 0x432
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O2/CkTD[P]btree/btree_test1.c
// Function: main
int main()
{
    uint64_t       k, n;
    BTree         *bt;
    BTreeOpenFlag  flag;

    flag.create_if_missing = 1;
    flag.error_if_exist = 0;
    flag.file = "./test.bt";
    flag.order = 3;

    bt = bt_open(flag);
    
//    printf("Tree order: %lu\n", flag.order);
//    printf("Empty tree:\n");
//    bt_print(bt);

    printf("插入10 个随机的 key/value pair...\n");
    for(k=0;k<10;k++)
    {
        n = rand() % 100;
        bt_insert(bt, n, n);
        printf("\tinsert (%ld, %ld)\n", n, n);
    }
    printf("Insert done.\n");
   
    printf("Tree:");
    bt_print(bt);

    printf("Search done.\n");
    bt_close(bt);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq $0x1, 0x28(%rsp)
leaq 0x12b6(%rip), %rax      # 0x393e
movq %rax, 0x18(%rsp)
movq $0x3, 0x20(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x18(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x18a6
movq %rax, %rbx
leaq 0x12aa(%rip), %rdi      # 0x3962
callq 0x1060
pushq $0xa
popq %r12
pushq $0x64
popq %rbp
leaq 0x127d(%rip), %r14      # 0x3948
subq $0x1, %r12
jb 0x26fc
callq 0x1150
cltd
idivl %ebp
movslq %edx, %r15
movq %rbx, %rdi
movq %r15, %rsi
movq %r15, %rdx
callq 0x1633
movq %r14, %rdi
movq %r15, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1090
jmp 0x26cb
leaq 0x1287(%rip), %rdi      # 0x398a
callq 0x1060
leaq 0x124d(%rip), %rdi      # 0x395c
xorl %eax, %eax
callq 0x1090
movq %rbx, %rdi
callq 0x1dbd
leaq 0x1272(%rip), %rdi      # 0x3997
callq 0x1060
movq %rbx, %rdi
callq 0x1b31
xorl %eax, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/S01den[P]Lost_CavernRL/main.c
// Function: quit
void quit()
{
	clrtoeol();
	refresh();
	getch();
	endwin();
}

// Assembly:
pushq %rbx
movq 0xe1ee(%rip), %rbx      # 0x12ff0
movq (%rbx), %rdi
callq 0x1150
movq (%rbx), %rdi
callq 0x1100
movq (%rbx), %rdi
callq 0x11e0
popq %rbx
jmp 0x1140
// File: /workspace/github_c_makefile_star2_O2/S01den[P]Lost_CavernRL/ennemy.c
// Function: testEnnemyOnPos
int testEnnemyOnPos(Ennemy ennemies[], int x, int y, int nbrEnnemies)
{
	int ret = -1;
	int i = 0;

	for(i = 0; i < nbrEnnemies; i++)
	{
		if(ennemies[i].x == x && ennemies[i].y == y && ennemies[i].life > 0)
		{
			ret = i;
			break;
		}
	}

	return ret;
}

// Assembly:
xorl %r8d, %r8d
testl %ecx, %ecx
cmovlel %r8d, %ecx
addq $0x8, %rdi
pushq $-0x1
popq %rax
cmpq %r8, %rcx
je 0x4fca
cmpl %esi, -0x8(%rdi)
jne 0x4fbe
cmpl %edx, -0x4(%rdi)
jne 0x4fbe
cmpl $0x0, (%rdi)
jg 0x4fc7
incq %r8
addq $0x38, %rdi
jmp 0x4faa
movl %r8d, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/S01den[P]Lost_CavernRL/ennemy.c
// Function: repair
void repair(Ennemy ennemies[], int indice, int *colorPrint, char messagePrint[])
{
	*colorPrint = 197; // RED LIKE BLOOOOOOOD
	char *body[] = {"HEAD","CORE","ARMS","LEGS"};
	int heal = rand()%3+1+ennemies[indice].agility/3;
	snprintf(messagePrint,100,"%s IS REPARING HIS %s (+%d LP)",ennemies[indice].name,body[rand()%4],heal);
	ennemies[indice].life += heal;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r14
movl %esi, %ebp
movq %rdi, %rbx
movl $0xc5, (%rdx)
callq 0x11d0
pushq $0x3
popq %rsi
cltd
idivl %esi
movl %edx, %ecx
movslq %ebp, %rax
imulq $0x38, %rax, %r12
movl 0x14(%rbx,%r12), %eax
cltd
idivl %esi
leal (%rcx,%rax), %ebp
incl %ebp
movq 0x30(%rbx,%r12), %r15
callq 0x11d0
pushq $0x4
popq %rcx
cltd
idivl %ecx
movslq %edx, %rax
leaq 0x80a5(%rip), %rcx      # 0xdf30
movslq (%rcx,%rax,4), %r8
addq %rcx, %r8
leaq 0x81f2(%rip), %rdx      # 0xe08b
pushq $0x64
popq %rsi
movq %r14, %rdi
movq %r15, %rcx
movl %ebp, %r9d
xorl %eax, %eax
callq 0x1050
addl %ebp, 0x8(%rbx,%r12)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/S01den[P]Lost_CavernRL/interface.c
// Function: printBar
void printBar(WINDOW *win, char name[15],int attribute, int x, int y, int colorpair)
{
	unsigned int i = 0;
	mvwprintw(win,x,y,"%s: ",name);

	if(attribute > 0)
	{
		wattron(win,COLOR_PAIR(colorpair));
		for(i = 14+strlen(name); i >= strlen(name)+4; i--)
		{
			// 1 case = 10 pv
			if((i-(strlen(name)+4))*10 <= attribute)
			{
				mvwprintw(win,x,i," ");
			}
		}
		wattroff(win,COLOR_PAIR(colorpair));

		wattron(win,A_BOLD);
		mvwprintw(win,x,strlen(name)+16,"(%d)  ",attribute);
		wattroff(win,A_BOLD);
	}
	else
	{
		wattron(win,A_BOLD);
		mvwprintw(win,x,strlen(name)+16,"(0)  ");
		wattroff(win,A_BOLD);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %r12d
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x7b73(%rip), %rcx      # 0xe212
movl %ebp, %esi
movl %r8d, %edx
movq %r15, %r8
xorl %eax, %eax
callq 0x1070
testl %r14d, %r14d
jle 0x6762
shll $0x8, %r12d
movzwl %r12w, %esi
movq %rbx, %rdi
movl %esi, (%rsp)
xorl %edx, %edx
callq 0x11c0
movq %r15, %rdi
callq 0x10f0
movq %rax, %r13
addl $0xe, %r13d
movl %r14d, 0x4(%rsp)
movl %r14d, %r14d
leaq 0x6b14(%rip), %r12      # 0xd1fe
movl %r13d, %r13d
movq %r15, %rdi
callq 0x10f0
addq $0x4, %rax
movq %r13, %rcx
subq %rax, %rcx
jb 0x6721
imulq $0xa, %rcx, %rax
cmpq %r14, %rax
ja 0x671c
movq %rbx, %rdi
movl %ebp, %esi
movl %r13d, %edx
movq %r12, %rcx
xorl %eax, %eax
callq 0x1070
decl %r13d
jmp 0x66ea
movq %rbx, %rdi
movl (%rsp), %esi
xorl %edx, %edx
callq 0x1060
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x11c0
movq %r15, %rdi
callq 0x10f0
leal 0x10(%rax), %edx
leaq 0x7ac8(%rip), %rcx      # 0xe217
movq %rbx, %rdi
movl %ebp, %esi
movl 0x4(%rsp), %r8d
xorl %eax, %eax
callq 0x1070
jmp 0x678f
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x11c0
movq %r15, %rdi
callq 0x10f0
leal 0x10(%rax), %edx
leaq 0x7a9b(%rip), %rcx      # 0xe21e
movq %rbx, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1060
// File: /workspace/github_c_makefile_star2_O2/S01den[P]Lost_CavernRL/interface.c
// Function: printEnnemy
void printEnnemy(WINDOW *win, Ennemy ennemies[], int nbrEnnemyFloor)
{
	box(win,0,0);
	char *classeEnnemy[] = {"???","DROID","SENTRY","GUARDIAN","GUARDIAN"};
	int i = 0;
	int c = 1;
	mvwprintw(win,1,1,"ENEMIES :");
	for(i = 0; i < nbrEnnemyFloor; i++)
	{
		if(ennemies[i].type > 0 && ennemies[i].seen == 1 && ennemies[i].life > 0)
		{
			wattron(win,A_UNDERLINE);
			mvwprintw(win,c+2,5,"%s (%s)",ennemies[i].name,classeEnnemy[ennemies[i].type]);
			wattroff(win,A_UNDERLINE);
			printBar(win,"LIFE",ennemies[i].life,c+4,2,249);
			c+=3;
		}
		/*else
		{
			break;
		}*/
	}

	wrefresh(win);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r12d
movq %rsi, %r14
movq %rdi, %rbx
andl $0x0, 0x10(%rsp)
andl $0x0, 0x8(%rsp)
andl $0x0, (%rsp)
xorl %r13d, %r13d
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1120
leaq 0x7a38(%rip), %rcx      # 0xe224
pushq $0x1
popq %r15
movq %rbx, %rdi
movl %r15d, %esi
movl %r15d, %edx
xorl %eax, %eax
callq 0x1070
testl %r12d, %r12d
cmovlel %r13d, %r12d
imulq $0x38, %r12, %rbp
leaq 0x78e6(%rip), %r13      # 0xe0f8
xorl %r12d, %r12d
cmpq %r12, %rbp
je 0x68ad
cmpl $0x0, 0x20(%r14,%r12)
jle 0x68a4
cmpl $0x1, 0xc(%r14,%r12)
jne 0x68a4
cmpl $0x0, 0x8(%r14,%r12)
jle 0x68a4
movq %rbx, %rdi
movl $0x20000, %esi          # imm = 0x20000
xorl %edx, %edx
callq 0x11c0
leal 0x2(%r15), %esi
movq 0x30(%r14,%r12), %r8
movslq 0x20(%r14,%r12), %rax
movslq (%r13,%rax,4), %r9
addq %r13, %r9
movq %rbx, %rdi
pushq $0x5
popq %rdx
leaq 0x79c6(%rip), %rcx      # 0xe22e
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
movl $0x20000, %esi          # imm = 0x20000
xorl %edx, %edx
callq 0x1060
movl 0x8(%r14,%r12), %edx
leal 0x4(%r15), %ecx
movq %rbx, %rdi
leaq 0x7912(%rip), %rsi      # 0xe1a3
pushq $0x2
popq %r8
movl $0xf9, %r9d
callq 0x667f
addl $0x3, %r15d
addq $0x38, %r12
jmp 0x6815
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1100