LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/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 0x12f6
leaq 0x20(%rax), %rdx
cmpq %rdx, %rcx
je 0x12f5
addq $0x40, %rax
cmpq %rax, %rcx
je 0x12f5
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 0x1fcb(%rip), %rdi      # 0x32c9
leaq 0x1d20(%rip), %rsi      # 0x3025
leaq 0x1fec(%rip), %rcx      # 0x32f8
movl $0x1f5, %edx            # imm = 0x1F5
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
movq %r8, 0x28(%rsp)
movq %rsi, %r15
movq %rdi, 0x30(%rsp)
movq 0x8(%rdi), %rsi
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x1412
addq $0x30, %rsi
xorl %ebp, %ebp
cmpq %rcx, (%rsi)
jae 0x135c
incq %rbp
addq $0x10, %rsi
cmpq %rbp, %rax
jne 0x1348
movq %rax, %rbp
movq %rax, %rcx
subq %rbp, %rcx
movq %rcx, 0x18(%rsp)
jbe 0x1438
movq %rax, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
leaq -0x1(%rdx), %rax
movq %rax, 0x20(%rsp)
movq %rbp, %r12
shlq $0x4, %r12
addq $0x30, %r12
xorl %r14d, %r14d
movq %rbp, %rbx
leaq (%r14,%rbp), %rsi
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdi
cmpq %rsi, 0x8(%rdi)
jbe 0x1477
movq 0x28(%rsp), %rax
cmpq %rax, (%rdi,%r12)
ja 0x143d
callq 0x1496
movq %rax, %r13
movq (%r15), %rax
movq 0x8(%r15), %rdi
leaq 0x1(%rax), %rcx
movq %rcx, (%r15)
leaq 0x8(,%rax,8), %rsi
callq 0x1100
movq %rax, 0x8(%r15)
movq (%r15), %rcx
movq %r13, -0x8(%rax,%rcx,8)
cmpq %r14, 0x20(%rsp)
je 0x1447
incq %r14
incq %rbx
addq $0x10, %r12
cmpq %r14, 0x18(%rsp)
jne 0x1391
movq 0x8(%rsp), %rax
movq %rax, %rbp
movq 0x18(%rsp), %r14
movq 0x10(%rsp), %rdx
jmp 0x1457
xorl %eax, %eax
testb $0x1, (%rsi)
jne 0x1468
leaq 0x1c4d(%rip), %rdi      # 0x306d
leaq 0x1bfe(%rip), %rsi      # 0x3025
leaq 0x1c6a(%rip), %rcx      # 0x3098
movl $0x384, %edx            # imm = 0x384
callq 0x10b0
xorl %r14d, %r14d
jmp 0x1457
movq %rsi, %rbp
movq 0x10(%rsp), %rdx
jmp 0x1452
movq %rbx, %rbp
movq 0x10(%rsp), %rdx
movq %rdx, %r14
movq 0x8(%rsp), %rax
cmpq %rax, %rbp
sete %al
cmpq %rdx, %r14
setb %cl
andb %al, %cl
movzbl %cl, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1ea1(%rip), %rdi      # 0x331f
leaq 0x1ba0(%rip), %rsi      # 0x3025
leaq 0x1ec1(%rip), %rcx      # 0x334d
movl $0x148, %edx            # imm = 0x148
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O1/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 0x14ad
cmpq %rsi, 0x8(%rdi)
jbe 0x14cc
shlq $0x4, %rsi
movq 0x28(%rdi,%rsi), %rax
popq %rcx
retq
leaq 0x1ed0(%rip), %rdi      # 0x3384
leaq 0x1b6a(%rip), %rsi      # 0x3025
leaq 0x1ee0(%rip), %rcx      # 0x33a2
movl $0x156, %edx            # imm = 0x156
callq 0x10b0
leaq 0x1e62(%rip), %rdi      # 0x3335
leaq 0x1b4b(%rip), %rsi      # 0x3025
leaq 0x1ec1(%rip), %rcx      # 0x33a2
movl $0x157, %edx            # imm = 0x157
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O1/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 0x154f
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1591
leaq 0x20(%rbx), %r14
movq 0x20(%rbx), %r15
cmpq %r14, %r15
je 0x156d
movq -0x8(%r15), %rsi
movq %rbx, %rdi
callq 0x1591
movq (%r15), %r15
jmp 0x1557
leaq 0x40(%rbx), %r14
movq 0x40(%rbx), %r15
cmpq %r14, %r15
je 0x158b
movq -0x8(%r15), %rsi
movq %rbx, %rdi
callq 0x1591
movq (%r15), %r15
jmp 0x1575
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x15b2
movq 0x60(%rbx), %rax
movq (%rax,%r14,8), %rax
addq $0x8, %rax
jmp 0x15b6
movq 0x18(%rbx), %rax
movq (%rax), %r12
movq 0x18(%rbx), %rax
movq (%rax), %rax
movq 0x10(%rax), %r15
movq %rbx, %rdi
callq 0x1f83
movl 0x8(%rbx), %edi
imulq %r15, %r14
movq %r14, %rsi
xorl %edx, %edx
callq 0x10a0
cmpq %r14, %rax
jne 0x1601
movl 0x8(%rbx), %edi
movq %r12, %rsi
movq %r15, %rdx
callq 0x1070
cmpq %r15, %rax
jne 0x1620
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x1dd3(%rip), %rdi      # 0x33db
leaq 0x1a16(%rip), %rsi      # 0x3025
leaq 0x1ddc(%rip), %rcx      # 0x33f2
movl $0x445, %edx            # imm = 0x445
callq 0x10b0
leaq 0x1df0(%rip), %rdi      # 0x3417
leaq 0x19f7(%rip), %rsi      # 0x3025
leaq 0x1dbd(%rip), %rcx      # 0x33f2
movl $0x447, %edx            # imm = 0x447
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O1/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 0x17e9
movq %rax, %r14
movq %rax, %rdi
callq 0x12b9
movq 0x8(%r14), %rbp
testb $0x4, (%rbp)
je 0x176d
movq 0x8(%rbp), %rdx
testq %rdx, %rdx
je 0x169a
leaq 0x30(%rbp), %rcx
xorl %eax, %eax
cmpq %r15, (%rcx)
jae 0x169c
incq %rax
addq $0x10, %rcx
cmpq %rax, %rdx
jne 0x1684
movq %rdx, %rax
jmp 0x169c
xorl %eax, %eax
subq %rax, %rdx
shlq $0x4, %rax
leaq (%rax,%rbp), %rsi
addq $0x28, %rsi
leaq (%rax,%rbp), %r13
addq $0x38, %r13
shlq $0x4, %rdx
movq %r13, %rdi
callq 0x1110
movq %r12, -0x10(%r13)
movq %r15, -0x8(%r13)
incq 0x8(%rbp)
movq (%r14), %rcx
movq 0x8(%r14), %rdx
movq 0x8(%rdx), %rax
movq 0x58(%rcx), %rcx
cmpq %rcx, %rax
jbe 0x1750
movl (%rdx), %ebp
testb $0x4, %bpl
je 0x17ab
incq %rcx
cmpq %rax, %rcx
jne 0x17ca
movq %rsp, %rsi
movq %r14, %rdi
callq 0x1fcb
movq %rax, %r15
movq (%r14), %r12
testb $0x1, %bpl
jne 0x1728
movq 0x8(%r14), %rax
movq 0x10(%rax), %rsi
testq %rsi, %rsi
je 0x173c
movq %r12, %rdi
callq 0x25a5
movq %rax, %rsi
jmp 0x173e
movq (%rsp), %rsi
movq %r12, %rdi
movq %r14, %rdx
movq %r15, %rcx
callq 0x2151
jmp 0x1750
xorl %esi, %esi
movq (%rsp), %r8
movq %r12, %rdi
movq %r14, %rdx
movq %r15, %rcx
callq 0x21c0
movq 0x8(%r14), %rax
movq 0x8(%rax), %rax
cmpq 0x58(%rbx), %rax
ja 0x178c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1c10(%rip), %rdi      # 0x3384
leaq 0x18aa(%rip), %rsi      # 0x3025
leaq 0x1cd1(%rip), %rcx      # 0x3453
movl $0x1ad, %edx            # imm = 0x1AD
callq 0x10b0
leaq 0x19aa(%rip), %rdi      # 0x313d
leaq 0x188b(%rip), %rsi      # 0x3025
leaq 0x19c8(%rip), %rcx      # 0x3169
movl $0x4ab, %edx            # imm = 0x4AB
callq 0x10b0
leaq 0x1ce2(%rip), %rdi      # 0x3494
leaq 0x186c(%rip), %rsi      # 0x3025
leaq 0x1cff(%rip), %rcx      # 0x34bf
movl $0x345, %edx            # imm = 0x345
callq 0x10b0
leaq 0x1d13(%rip), %rdi      # 0x34e4
leaq 0x184d(%rip), %rsi      # 0x3025
leaq 0x1ce0(%rip), %rcx      # 0x34bf
movl $0x346, %edx            # imm = 0x346
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O1/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 %rbx
movq %rsi, %rbx
movq %rdi, %rax
movq 0x8(%rax), %rcx
testb $0x4, (%rcx)
jne 0x182a
movq 0x8(%rcx), %rdx
testq %rdx, %rdx
je 0x181e
addq $0x30, %rcx
xorl %esi, %esi
cmpq %rbx, (%rcx)
jae 0x1820
incq %rsi
addq $0x10, %rcx
cmpq %rsi, %rdx
jne 0x1808
movq %rdx, %rsi
jmp 0x1820
xorl %esi, %esi
movq %rax, %rdi
callq 0x1dd1
jmp 0x17f0
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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
movl $0x10, %edi
callq 0x10f0
movq %rax, %r12
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq 0x10(%r13), %rdi
movq %r14, %rsi
callq 0x17e9
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 0x1316
movl %eax, %ebp
movq 0x8(%r13), %rax
movq 0x20(%rax), %rsi
testq %rsi, %rsi
je 0x189d
movq (%r13), %rdi
callq 0x25a5
movq %rax, %r13
jmp 0x18a0
xorl %r13d, %r13d
testq %r13, %r13
je 0x18a9
testl %ebp, %ebp
jne 0x1865
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_O1/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 0x1533
movq 0x18(%rbx), %r14
movq (%r14), %rdi
cmpq $0x0, 0x28(%rdi)
je 0x1bd1
movl $0x1, %r15d
movq 0x60(%rbx), %rax
movq (%rax,%r15,8), %r14
testq %r14, %r14
je 0x1bc1
movq 0x8(%r14), %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
incq %r15
movq 0x18(%rbx), %r14
movq (%r14), %rdi
cmpq 0x28(%rdi), %r15
jbe 0x1ba3
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_O1/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 0x1df8
cmpq %rsi, 0x8(%rax)
jb 0x1e17
shlq $0x4, %rsi
movq 0x28(%rax,%rsi), %rsi
testq %rsi, %rsi
je 0x1e36
movq (%rdi), %rdi
popq %rax
jmp 0x25a5
leaq 0x1205(%rip), %rdi      # 0x3004
leaq 0x121f(%rip), %rsi      # 0x3025
leaq 0x1abe(%rip), %rcx      # 0x38cb
movl $0x16f, %edx            # imm = 0x16F
callq 0x10b0
leaq 0x1aec(%rip), %rdi      # 0x390a
leaq 0x1200(%rip), %rsi      # 0x3025
leaq 0x1a9f(%rip), %rcx      # 0x38cb
movl $0x170, %edx            # imm = 0x170
callq 0x10b0
leaq 0x174f(%rip), %rdi      # 0x358c
leaq 0x11e1(%rip), %rsi      # 0x3025
leaq 0x1a4c(%rip), %rcx      # 0x3897
movl $0x267, %edx            # imm = 0x267
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O1/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 0x1abc(%rip), %rdi      # 0x3923
callq 0x1060
movq 0x18(%rbx), %rax
movq (%rax), %rax
movq 0x8(%rax), %rsi
leaq 0x13e3(%rip), %rdi      # 0x3261
xorl %eax, %eax
callq 0x1090
movq 0x18(%rbx), %rax
movq (%rax), %rax
movq 0x10(%rax), %rsi
leaq 0x13d9(%rip), %rdi      # 0x3270
xorl %eax, %eax
callq 0x1090
movq 0x18(%rbx), %rax
movq (%rax), %rax
movq 0x20(%rax), %rsi
leaq 0x13cf(%rip), %rdi      # 0x327f
xorl %eax, %eax
callq 0x1090
movq 0x18(%rbx), %rax
movq (%rax), %rax
movq 0x28(%rax), %rsi
leaq 0x13c5(%rip), %rdi      # 0x328e
xorl %eax, %eax
callq 0x1090
movq 0x18(%rbx), %rax
movq (%rax), %rax
movq 0x18(%rax), %rsi
leaq 0x13bb(%rip), %rdi      # 0x329d
xorl %eax, %eax
callq 0x1090
movq 0x10(%rbx), %rdi
callq 0x1bfc
leaq 0x13b3(%rip), %rdi      # 0x32ac
xorl %eax, %eax
callq 0x1090
leaq 0x20(%rbx), %r15
movq 0x20(%rbx), %r12
cmpq %r15, %r12
je 0x1f2c
leaq 0x13a3(%rip), %r14      # 0x32b7
movq -0x8(%r12), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1090
movq (%r12), %r12
cmpq %r15, %r12
jne 0x1f14
movl $0xa, %edi
callq 0x1040
leaq 0x137f(%rip), %rdi      # 0x32bc
xorl %eax, %eax
callq 0x1090
movq 0x40(%rbx), %r15
addq $0x40, %rbx
cmpq %rbx, %r15
je 0x1f6e
leaq 0x135f(%rip), %r14      # 0x32b7
movq -0x8(%r15), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1090
movq (%r15), %r15
cmpq %rbx, %r15
jne 0x1f58
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1040
// File: /workspace/github_c_makefile_star2_O1/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 0x2113
movq %rsi, %rbp
movq 0x50(%rdi), %r13
movl (%rax), %r14d
andl $0x4, %r14d
shrl %r14d
addq $0x2, %r14
movq %r14, %rsi
callq 0x23b0
movq %rax, %r15
movq 0x8(%rbx), %rax
cmpq %r13, 0x8(%rax)
jbe 0x2132
movq %r13, %r12
shlq $0x4, %r12
movq 0x30(%rax,%r12), %rcx
movq %rcx, (%rbp)
movq 0x20(%rax), %rsi
testq %rsi, %rsi
je 0x2045
movq (%rbx), %rdi
callq 0x25a5
movq %rax, %rsi
jmp 0x2047
xorl %esi, %esi
movq %r15, %rdi
callq 0x2462
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2462
leaq 0x1(%r13), %rbp
movq 0x8(%r15), %rdi
movq 0x8(%rbx), %rax
movl (%rdi), %edx
addl %edx, %edx
andl $0x8, %edx
orq %r12, %rdx
xorq $0x8, %rdx
addq $0x28, %rdi
movq %rbp, %rcx
shlq $0x4, %rcx
leaq (%rax,%rcx), %rsi
addq $0x28, %rsi
callq 0x10e0
movq 0x8(%rbx), %rax
testb $0x4, (%rax)
jne 0x20ba
xorl %r12d, %r12d
leaq (%r12,%rbp), %rsi
movq %rbx, %rdi
callq 0x1dd1
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x24ff
incq %r12
cmpq %r13, %r12
jbe 0x2098
movq 0x8(%r15), %rax
movq %r13, 0x8(%rax)
movq %r15, %rdi
callq 0x12b9
movq 0x8(%rbx), %rax
btl $0x2, (%rax)
adcq $0x0, %r13
movq %r13, 0x8(%rax)
movq %rbx, %rdi
callq 0x12b9
movq %rbx, %rdi
callq 0x12b9
movq %r15, %rdi
callq 0x12b9
movq 0x8(%rbx), %rax
movq %r14, (%rax)
movq %rbx, %rdi
callq 0x12b9
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1409(%rip), %rdi      # 0x3523
leaq 0xf04(%rip), %rsi       # 0x3025
leaq 0x1427(%rip), %rcx      # 0x354f
movl $0x2f3, %edx            # imm = 0x2F3
callq 0x10b0
leaq 0x11e6(%rip), %rdi      # 0x331f
leaq 0xee5(%rip), %rsi       # 0x3025
leaq 0x1206(%rip), %rcx      # 0x334d
movl $0x148, %edx            # imm = 0x148
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movl $0x1, %esi
callq 0x23b0
movq %rax, %r13
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0x2552
movq 0x8(%r13), %rax
movq $0x1, 0x8(%rax)
movq %r13, %rdi
callq 0x12b9
movq %r13, 0x10(%r12)
movq 0x10(%r13), %rax
movq 0x18(%r12), %rcx
movl $0x1, 0x8(%rcx)
movq (%rcx), %rcx
movq %rax, 0x18(%rcx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %r13
movq (%r13), %rax
movq 0x10(%rax), %r15
leaq 0x10(%r15), %rdi
callq 0x10f0
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)
movl $0x30, %edi
callq 0x10f0
movl $0x1, 0x8(%r13)
movq (%r13), %rcx
incq 0x20(%rcx)
movq %rax, %r14
movq 0x28(%rcx), %rsi
incq %rsi
movq %rsi, 0x28(%rcx)
movq %rsi, 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 0x249d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x249c
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 0x12b9
movq %rbx, %rdi
popq %rbx
jmp 0x12b9
retq
// File: /workspace/github_c_makefile_star2_O1/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
movq 0x28(%rax), %rax
cmpq %rsi, %rax
jb 0x24e0
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
jne 0x24d2
movq 0x60(%r15), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x1100
movq %rax, 0x60(%r15)
movq 0x60(%r15), %rax
movq %rbx, (%rax,%r14,8)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1098(%rip), %rdi      # 0x357f
leaq 0xb37(%rip), %rsi       # 0x3025
leaq 0x109d(%rip), %rcx      # 0x3592
movl $0x403, %edx            # imm = 0x403
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O1/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 0x25e2
movq %rsi, %rbx
movq %rdi, %r14
movq 0x60(%rdi), %rax
cmpq $0x0, (%rax,%rsi,8)
jne 0x25d2
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2601
movq 0x60(%r14), %rax
movq (%rax,%rbx,8), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0xf96(%rip), %rdi       # 0x357f
leaq 0xa35(%rip), %rsi       # 0x3025
leaq 0x11ae(%rip), %rcx      # 0x37a5
movl $0x411, %edx            # imm = 0x411
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O1/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 0x10f0
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x10c0
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x267e
movl $0x30, %edi
callq 0x10f0
movq %rax, %r15
movq %r12, 0x8(%rax)
movq %rbx, 0x10(%rax)
movq %r14, (%rax)
movq $0x0, 0x28(%rax)
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x249d
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x26a1
movq 0x18(%r15), %rax
movq (%rax), %rax
movq 0x10(%rax), %r14
jmp 0x26a7
movl $0x30, %r14d
movq %r15, %rdi
callq 0x1f83
movl 0x8(%r15), %edi
imulq %r14, %r12
movq %r12, %rsi
xorl %edx, %edx
callq 0x10a0
cmpq %r12, %rax
jne 0x26e6
movl 0x8(%r15), %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x10d0
cmpq %r14, %rax
jne 0x2705
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0xcee(%rip), %rdi       # 0x33db
leaq 0x931(%rip), %rsi       # 0x3025
leaq 0x10d4(%rip), %rcx      # 0x37cf
movl $0x430, %edx            # imm = 0x430
callq 0x10b0
leaq 0xd0b(%rip), %rdi       # 0x3417
leaq 0x912(%rip), %rsi       # 0x3025
leaq 0x10b5(%rip), %rcx      # 0x37cf
movl $0x432, %edx            # imm = 0x432
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq $0x1, 0x30(%rsp)
leaq 0x11ff(%rip), %rax      # 0x393e
movq %rax, 0x20(%rsp)
movq $0x3, 0x28(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x18c3
movq %rax, %rbx
leaq 0x11f3(%rip), %rdi      # 0x3962
callq 0x1060
movl $0xa, %r12d
leaq 0x11c7(%rip), %r14      # 0x3948
callq 0x1140
cltq
imulq $0x51eb851f, %rax, %rcx # imm = 0x51EB851F
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x25, %rcx
addl %edx, %ecx
imull $0x64, %ecx, %ecx
subl %ecx, %eax
movslq %eax, %r15
movq %rbx, %rdi
movq %r15, %rsi
movq %r15, %rdx
callq 0x163f
movq %r14, %rdi
movq %r15, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1090
decq %r12
jne 0x2781
leaq 0x11bc(%rip), %rdi      # 0x398a
callq 0x1060
leaq 0x1182(%rip), %rdi      # 0x395c
xorl %eax, %eax
callq 0x1090
movq %rbx, %rdi
callq 0x1e55
leaq 0x11a7(%rip), %rdi      # 0x3997
callq 0x1060
movq %rbx, %rdi
callq 0x1b82
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/S01den[P]Lost_CavernRL/main.c
// Function: quit
void quit()
{
	clrtoeol();
	refresh();
	getch();
	endwin();
}

// Assembly:
pushq %rbx
movq 0xea3f(%rip), %rbx      # 0x13ff0
movq (%rbx), %rdi
callq 0x1150
movq (%rbx), %rdi
callq 0x1100
movq (%rbx), %rdi
callq 0x11e0
popq %rbx
jmp 0x1140
nop
// File: /workspace/github_c_makefile_star2_O1/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:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jle 0x57d0
movl %ecx, %ecx
addq $0x8, %rdi
xorl %r8d, %r8d
cmpl %esi, -0x8(%rdi)
jne 0x57c4
cmpl %edx, -0x4(%rdi)
jne 0x57c4
cmpl $0x0, (%rdi)
jg 0x57d1
incq %r8
addq $0x38, %rdi
cmpq %r8, %rcx
jne 0x57b5
retq
movl %r8d, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/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
cltq
imulq $0x55555556, %rax, %rcx # imm = 0x55555556
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
addl %edx, %ecx
leal (%rcx,%rcx,2), %ecx
subl %ecx, %eax
movslq %ebp, %rcx
imulq $0x38, %rcx, %r12
movslq 0x14(%rbx,%r12), %rcx
imulq $0x55555556, %rcx, %rcx # imm = 0x55555556
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
addl %edx, %ecx
leal (%rax,%rcx), %ebp
incl %ebp
movq 0x30(%rbx,%r12), %r15
callq 0x11d0
leal 0x3(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
andl $-0x4, %ecx
subl %ecx, %eax
cltq
leaq 0x95ea(%rip), %rcx      # 0xff14
movslq (%rcx,%rax,4), %r8
addq %rcx, %r8
leaq 0x9737(%rip), %rdx      # 0x1006f
movl $0x64, %esi
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_O1/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, %r14d
movl %ecx, %ebp
movl %edx, %r12d
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x8db2(%rip), %rcx      # 0x101f6
movl %ebp, %esi
movl %r8d, %edx
movq %r15, %r8
xorl %eax, %eax
callq 0x1070
testl %r12d, %r12d
jle 0x751a
movl %r12d, (%rsp)
shll $0x8, %r14d
movzwl %r14w, %esi
movq %rbx, %rdi
movl %esi, 0x4(%rsp)
xorl %edx, %edx
callq 0x11c0
movq %r15, %rdi
callq 0x10f0
movq %rax, %r12
addl $0xe, %r12d
movq %r15, %rdi
callq 0x10f0
addq $0x4, %rax
cmpq %r12, %rax
ja 0x74d9
movl (%rsp), %r13d
movl %r12d, %r14d
subq %rax, %r12
addq %r12, %r12
leaq (%r12,%r12,4), %rax
cmpq %r13, %rax
ja 0x74c2
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
leaq 0x7d43(%rip), %rcx      # 0xf1fe
xorl %eax, %eax
callq 0x1070
decl %r14d
movq %r15, %rdi
callq 0x10f0
addq $0x4, %rax
movq %r14, %r12
cmpq %r14, %rax
jbe 0x749d
movq %rbx, %rdi
movl 0x4(%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 0x8cf3(%rip), %rcx      # 0x101fb
movq %rbx, %rdi
movl %ebp, %esi
movl (%rsp), %r8d
xorl %eax, %eax
callq 0x1070
jmp 0x7547
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x11c0
movq %r15, %rdi
callq 0x10f0
leal 0x10(%rax), %edx
leaq 0x8cc7(%rip), %rcx      # 0x10202
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_O1/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
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
subq $0x8, %rsp
xorl %eax, %eax
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %rax
pushq %rax
pushq %rax
callq 0x1120
addq $0x20, %rsp
leaq 0x8c6c(%rip), %rcx      # 0x10208
movl $0x1, %r13d
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x1070
testl %ebp, %ebp
jle 0x7668
movl %ebp, %eax
imulq $0x38, %rax, %rbp
leaq 0x8b11(%rip), %r15      # 0x100dc
xorl %r12d, %r12d
cmpl $0x0, 0x20(%r14,%r12)
jle 0x765b
cmpl $0x1, 0xc(%r14,%r12)
jne 0x765b
cmpl $0x0, 0x8(%r14,%r12)
jle 0x765b
movq %rbx, %rdi
movl $0x20000, %esi          # imm = 0x20000
xorl %edx, %edx
callq 0x11c0
leal 0x2(%r13), %esi
movq 0x30(%r14,%r12), %r8
movslq 0x20(%r14,%r12), %rax
movslq (%r15,%rax,4), %r9
addq %r15, %r9
movq %rbx, %rdi
movl $0x5, %edx
leaq 0x8bf5(%rip), %rcx      # 0x10212
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(%r13), %ecx
movq %rbx, %rdi
leaq 0x8b41(%rip), %rsi      # 0x10187
movl $0x2, %r8d
movl $0xf9, %r9d
callq 0x7424
addl $0x3, %r13d
addq $0x38, %r12
cmpq %r12, %rbp
jne 0x75ce
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1100
// File: /workspace/github_c_makefile_star2_O1/S01den[P]Lost_CavernRL/interface.c
// Function: printWeapon
void printWeapon(WINDOW *win, Weapons weaponHold)
{
	wborder(win, '|', '|', '-', '-', '+', '+', '+', '+');
	mvwprintw(win,1,1,"WEAPON :");
	wattron(win,A_UNDERLINE);
	mvwprintw(win,2,(30-strlen(weaponHold.name))/2,"%s",weaponHold.name);
	wattroff(win,A_UNDERLINE);

	if(weaponHold.type > 0)
	{
		printBar(win,"AMMO",weaponHold.state,4,2,247);
		mvwprintw(win,5,2,"RANGE: %d",weaponHold.range);
	}
	else if(weaponHold.indice != 3)
	{
		printBar(win,"STATE",weaponHold.state,4,2,247);
	}

	mvwprintw(win,6,2,"DAMAGES: %d",weaponHold.degat);

	wrefresh(win);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x20(%rsp), %r15
subq $0x8, %rsp
movl $0x2b, %eax
movl $0x7c, %esi
movl $0x7c, %edx
movl $0x2d, %ecx
movl $0x2d, %r8d
movl $0x2b, %r9d
pushq %rax
pushq %rax
pushq %rax
callq 0x1120
addq $0x20, %rsp
leaq 0x8b58(%rip), %rcx      # 0x1021a
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
movl $0x20000, %esi          # imm = 0x20000
xorl %edx, %edx
callq 0x11c0
movq (%r15), %r14
movq %r14, %rdi
callq 0x10f0
movl $0x1e, %edx
subq %rax, %rdx
shrq %rdx
leaq 0x8bfb(%rip), %rcx      # 0x102fd
movq %rbx, %rdi
movl $0x2, %esi
movq %r14, %r8
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
movl $0x20000, %esi          # imm = 0x20000
xorl %edx, %edx
callq 0x1060
cmpl $0x0, 0x24(%r15)
jle 0x776f
movl 0x1c(%r15), %edx
leaq 0x8aee(%rip), %rsi      # 0x10223
movq %rbx, %rdi
movl $0x4, %ecx
movl $0x2, %r8d
movl $0xf7, %r9d
callq 0x7424
movl 0x20(%r15), %r8d
leaq 0x8acf(%rip), %rcx      # 0x10228
movq %rbx, %rdi
movl $0x5, %esi
movl $0x2, %edx
xorl %eax, %eax
callq 0x1070
jmp 0x779a
cmpl $0x3, 0x2c(%r15)
je 0x779a
movl 0x1c(%r15), %edx
leaq 0x8ab1(%rip), %rsi      # 0x10232
movq %rbx, %rdi
movl $0x4, %ecx
movl $0x2, %r8d
movl $0xf7, %r9d
callq 0x7424
movl 0x10(%r15), %r8d
leaq 0x8a93(%rip), %rcx      # 0x10238
movq %rbx, %rdi
movl $0x6, %esi
movl $0x2, %edx
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x1100
// File: /workspace/github_c_makefile_star2_O1/S01den[P]Lost_CavernRL/interface.c
// Function: setMessage
void setMessage(WINDOW *win, char message[], int colorPair)
{
	wborder(win, '|', '|', '-', '-', '+', '+', '+', '+');
	wattron(win,A_UNDERLINE);
	mvwprintw(win,1,1,"MESSAGES:");
	wattroff(win,A_UNDERLINE);

	if(colorPair != 0)
	{
		wattron(win,COLOR_PAIR(colorPair));
		mvwprintw(win,2,1,message);
		wattroff(win,COLOR_PAIR(colorPair));	
	}
	else
	{
		mvwprintw(win,2,1,message);
	}

	wrefresh(win);	
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
subq $0x8, %rsp
movl $0x2b, %eax
movl $0x7c, %esi
movl $0x7c, %edx
movl $0x2d, %ecx
movl $0x2d, %r8d
movl $0x2b, %r9d
pushq %rax
pushq %rax
pushq %rax
callq 0x1120
addq $0x20, %rsp
movq %rbx, %rdi
movl $0x20000, %esi          # imm = 0x20000
xorl %edx, %edx
callq 0x11c0
leaq 0x85be(%rip), %rcx      # 0x1037a
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
movl $0x20000, %esi          # imm = 0x20000
xorl %edx, %edx
callq 0x1060
testl %ebp, %ebp
je 0x7e1a
shll $0x8, %ebp
movzwl %bp, %ebp
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x11c0
movq %rbx, %rdi
movl $0x2, %esi
movl $0x1, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x1060
jmp 0x7e31
movq %rbx, %rdi
movl $0x2, %esi
movl $0x1, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x1100
// File: /workspace/github_c_makefile_star2_O1/S01den[P]Lost_CavernRL/interface.c
// Function: printArmor
void printArmor(WINDOW *win, Armor armor)
{
	wborder(win, '|', '|', '-', '-', '+', '+', '+', '+');
	mvwprintw(win,1,1,"ARMOR :");
	wattron(win,A_UNDERLINE);
	mvwprintw(win,2,(30-strlen(armor.name))/2,"%s",armor.name);
	wattroff(win,A_UNDERLINE);

	if(armor.indice != 10)
		printBar(win,"STATE",armor.state,4,2,247);
	
	mvwprintw(win,6,2,"RESISTANCE: %d",armor.resistance);

	wrefresh(win);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x20(%rsp), %r15
subq $0x8, %rsp
movl $0x2b, %eax
movl $0x7c, %esi
movl $0x7c, %edx
movl $0x2d, %ecx
movl $0x2d, %r8d
movl $0x2b, %r9d
pushq %rax
pushq %rax
pushq %rax
callq 0x1120
addq $0x20, %rsp
leaq 0x8503(%rip), %rcx      # 0x10384
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
movl $0x20000, %esi          # imm = 0x20000
xorl %edx, %edx
callq 0x11c0
movq (%r15), %r14
movq %r14, %rdi
callq 0x10f0
movl $0x1e, %edx
subq %rax, %rdx
shrq %rdx
leaq 0x843c(%rip), %rcx      # 0x102fd
movq %rbx, %rdi
movl $0x2, %esi
movq %r14, %r8
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
movl $0x20000, %esi          # imm = 0x20000
xorl %edx, %edx
callq 0x1060
cmpl $0xa, 0x20(%r15)
je 0x7f0d
movl 0x18(%r15), %edx
leaq 0x833e(%rip), %rsi      # 0x10232
movq %rbx, %rdi
movl $0x4, %ecx
movl $0x2, %r8d
movl $0xf7, %r9d
callq 0x7424
movl 0x14(%r15), %r8d
leaq 0x8474(%rip), %rcx      # 0x1038c
movq %rbx, %rdi
movl $0x6, %esi
movl $0x2, %edx
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x1100
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/S01den[P]Lost_CavernRL/item.c
// Function: shuffleDrugs
void shuffleDrugs(Map map[LONGUEUR][LARGEUR], Drug drugs[], int nbrDrugs, int *nbrDrugsInFloor)
{
	srand(time(NULL));

	int i = 0;

	*nbrDrugsInFloor = rand()%nbrDrugs+4;
	for(i = 0; i < *nbrDrugsInFloor; i++)
	{
		int indiceDrug = rand()%NBR_DRUGS;
		drugs[i].color = indiceDrug+COLOR_DRUGS;
		drugs[i].indice = i;
		drugs[i].type = indiceDrug;
		drugs[i].poisoned = rand()%4;
		drugs[i].discovered = 0;

		int posX = 0;
		int posY = 0;

		while(posX == 0 || posY == 0 || posX == LONGUEUR || posY == LARGEUR)
		{
			posX = rand()%LONGUEUR;
			posY = rand()%LARGEUR;
		}

		drugs[i].x = posX;
		drugs[i].y = posY;
		map[posX][posY].content = DRUG;
	}

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, (%rsp)
xorl %edi, %edi
callq 0x1210
movl %eax, %edi
callq 0x1170
callq 0x11d0
cltd
idivl %ebp
leal 0x4(%rdx), %eax
movl %eax, (%rbx)
cmpl $-0x3, %edx
jl 0x8074
xorl %r12d, %r12d
callq 0x11d0
cltq
imulq $-0x6db6db6d, %rax, %rcx # imm = 0x92492493
shrq $0x20, %rcx
addl %eax, %ecx
movl %ecx, %edx
shrl $0x1f, %edx
sarl $0x2, %ecx
addl %edx, %ecx
leal (,%rcx,8), %edx
subl %edx, %ecx
leal (%rax,%rcx), %edx
addl %ecx, %eax
addl $0x32, %eax
leaq (%r12,%r12,8), %rcx
leaq (%rcx,%rcx,2), %rbp
addq %r12, %rbp
leaq (%r14,%rbp), %r13
movl %eax, 0x8(%r14,%rbp)
movl %r12d, 0xc(%r14,%rbp)
movl %edx, (%r14,%rbp)
callq 0x11d0
leal 0x3(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
andl $-0x4, %ecx
subl %ecx, %eax
movl %eax, 0x4(%r14,%rbp)
movl $0x0, 0x10(%r14,%rbp)
callq 0x11d0
movslq %eax, %rbp
imulq $-0x2df2df2d, %rbp, %rax # imm = 0xD20D20D3
shrq $0x20, %rax
addl %ebp, %eax
movl %eax, %ecx
shrl $0x1f, %ecx
sarl $0x5, %eax
addl %ecx, %eax
imull $0x27, %eax, %r15d
callq 0x11d0
cltq
imulq $0x7e07e07f, %rax, %rcx # imm = 0x7E07E07F
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x26, %rcx
addl %edx, %ecx
movl %ecx, %edx
shll $0x7, %edx
subl %r15d, %ebp
leal (%rdx,%rcx,2), %ecx
sete %dl
subl %ecx, %eax
sete %cl
orb %dl, %cl
jne 0x7fe6
movl %ebp, 0x14(%r13)
movl %eax, 0x18(%r13)
movslq %ebp, %rcx
cltq
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq (%rsp), %rcx
leaq (%rax,%rax,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rax, %rdx
movl $0x5, (%rcx,%rdx)
incq %r12
movslq (%rbx), %rax
cmpq %rax, %r12
jl 0x7f7a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/S01den[P]Lost_CavernRL/item.c
// Function: testDrug
int testDrug(Drug drugList[], int x, int y, int nbrDrugsInFloor)
{
	int ret = -1;
	int i = 0;

	for(i = 0; i < nbrDrugsInFloor; i++)
	{
		if(drugList[i].x == x && drugList[i].y == y)
		{
			ret = i;
			break;
		}
	}

	return ret;
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jle 0x80aa
movl %ecx, %ecx
addq $0x18, %rdi
xorl %r8d, %r8d
cmpl %esi, -0x4(%rdi)
jne 0x809e
cmpl %edx, (%rdi)
je 0x80ab
incq %r8
addq $0x1c, %rdi
cmpq %r8, %rcx
jne 0x8095
retq
movl %r8d, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/S01den[P]Lost_CavernRL/item.c
// Function: testWeapon
int testWeapon(Weapons weapons[],int x, int y, int nbrWeapons)
{
	int ret = -1;
	int i = 0;

	for(i = 0; i < nbrWeapons; i++)
	{
		if(weapons[i].x == x && weapons[i].y == y)
		{
			ret = i;
			break;
		}
	}


	return ret;
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jle 0x80d6
movl %ecx, %ecx
addq $0x38, %rdi
xorl %r8d, %r8d
cmpl %esi, -0x4(%rdi)
jne 0x80ca
cmpl %edx, (%rdi)
je 0x80d7
incq %r8
addq $0x40, %rdi
cmpq %r8, %rcx
jne 0x80c1
retq
movl %r8d, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/S01den[P]Lost_CavernRL/item.c
// Function: testArmor
int testArmor(Armor armor[],int x, int y, int nbrArmors)
{
	int ret = -1;
	int i = 0;

	for(i = 0; i < nbrArmors; i++)
	{
		if(armor[i].x == x && armor[i].y == y)
		{
			ret = i;
			break;
		}
	}


	return ret;
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jle 0x8102
movl %ecx, %ecx
addq $0x2c, %rdi
xorl %r8d, %r8d
cmpl %esi, -0x4(%rdi)
jne 0x80f6
cmpl %edx, (%rdi)
je 0x8103
incq %r8
addq $0x30, %rdi
cmpq %r8, %rcx
jne 0x80ed
retq
movl %r8d, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/S01den[P]Lost_CavernRL/map.c
// Function: initMap
void initMap(Map map[LONGUEUR][LARGEUR], WINDOW *win)
{
	wclear(win);
	box(win,0,0);
	
	int i,j = 0;

	for(i = 0; i < LARGEUR; i++)
	{
		for(j = 0; j < LONGUEUR; j++)
		{
			map[j][i].content = 0;
			map[j][i].seen = 0;
			map[j][i].effect = 0;
			map[j][i].typeEnnemy = 0;
			map[j][i].typePnj = -1;
			map[j][i].trap = 0;
		}
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x1030
subq $0x8, %rsp
xorl %r15d, %r15d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %r15
pushq %r15
pushq %r15
callq 0x1120
addq $0x20, %rsp
xorps %xmm0, %xmm0
movl $0x18, %eax
movups %xmm0, -0x18(%rbx,%rax)
movl $0xffffffff, -0x8(%rbx,%rax) # imm = 0xFFFFFFFF
movl $0x0, (%rbx,%rax)
addq $0xe38, %rax            # imm = 0xE38
cmpq $0x22aa0, %rax          # imm = 0x22AA0
jne 0x91aa
incq %r15
addq $0x1c, %rbx
cmpq $0x82, %r15
jne 0x91a5
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/S01den[P]Lost_CavernRL/map.c
// Function: destroyWall
void destroyWall(Map map[LONGUEUR][LARGEUR], int x, int y, Weapons *weaponHold, int *gem)
{	
	if(x != 0 && x != LONGUEUR && y != 0 && y != LARGEUR)
	{
		if(map[x][y].resistance-weaponHold->degat > 0)
		{
			map[x][y].resistance -= weaponHold->degat;
			if(weaponHold->type == 0)
				weaponHold->state -= map[x][y].resistance/5+3;
			else
				weaponHold->state--;
		}
		else
		{
			map[x][y].resistance = 0;
			if(map[x][y].effect == 4) // if the player breaks a gem
			{
				(*gem)++;
				map[x][y].content = FLOOR;
			}
			else
			{
				if(rand()%100 <= 90)
					map[x][y].content = FLOOR;
				else
				{
					map[x][y].content = MINES;
					map[x][y].trap = 2;
				}
			}
		}
	}
}

// Assembly:
cmpl $0x82, %edx
je 0x92a7
testl %esi, %esi
je 0x92a7
cmpl $0x27, %esi
je 0x92a7
testl %edx, %edx
je 0x92a7
pushq %rbx
movslq %esi, %rax
movslq %edx, %rdx
imulq $0xe38, %rax, %rax      # imm = 0xE38
addq %rax, %rdi
leaq (%rdx,%rdx,8), %rax
leaq (%rax,%rax,2), %rax
addq %rdx, %rax
leaq (%rdi,%rax), %rbx
movl 0x14(%rdi,%rax), %eax
subl 0x10(%rcx), %eax
jle 0x923e
movl %eax, 0x14(%rbx)
cmpl $0x0, 0x24(%rcx)
je 0x9250
decl 0x1c(%rcx)
jmp 0x92a6
movl $0x0, 0x14(%rbx)
cmpl $0x4, 0x4(%rbx)
jne 0x926c
incl (%r8)
jmp 0x9291
movl %eax, %eax
movl $0xcccccccd, %edx       # imm = 0xCCCCCCCD
imulq %rax, %rdx
shrq $0x22, %rdx
movl 0x1c(%rcx), %eax
subl %edx, %eax
addl $-0x3, %eax
movl %eax, 0x1c(%rcx)
jmp 0x92a6
callq 0x11d0
cltq
imulq $0x51eb851f, %rax, %rcx # imm = 0x51EB851F
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x25, %rcx
addl %edx, %ecx
imull $0x64, %ecx, %ecx
subl %ecx, %eax
cmpl $0x5a, %eax
jg 0x9299
movl $0x1, (%rbx)
jmp 0x92a6
movl $0x4, (%rbx)
movl $0x2, 0x18(%rbx)
popq %rbx
retq