LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/ugobas[P]tnm/random3.c
// Function: Norm_var_2
float Norm_var_2(){
  // Draws squared Gaussian variable z^2 with Box-Muller transform method
  float U1=RandomFloating();
  float U2=RandomFloating();
  float c=cos(TWOPI*U2);
  return(-2*log(U1)*c*c);
}

// Assembly:
pushq %rax
callq 0x50647
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x4(%rsp)
callq 0x50647
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0xdd58(%rip), %xmm0     # 0x5e488
callq 0x2130
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rsp)
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rsp), %xmm0
callq 0x2120
mulsd 0x6c44(%rip), %xmm0     # 0x57398
cvtss2sd (%rsp), %xmm1
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: new_bs_tree
bs_tree *new_bs_tree(int (* comp) (const void *, const void *)) {

    // Sanity check:
    assert(comp != NULL);

    // Allocate memory:
    bs_tree *tree = (bs_tree *) malloc(sizeof(bs_tree));
    if (tree == NULL) {
        fprintf(stderr, "ERROR: Unable to allocate memory for bs_tree\n");
    }

    // Initialize the empty tree:
    else {
        tree->root = NULL;
        tree->comp = comp;
    }

    return tree;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x78df
movq %rdi, %rbx
movl $0x10, %edi
callq 0x10d0
movq %rax, %r14
testq %rax, %rax
je 0x78d8
movq $0x0, (%r14)
movq %rbx, 0x8(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x1130
jmp 0x78cd
leaq 0x691a(%rip), %rdi      # 0xe200
leaq 0x6920(%rip), %rsi      # 0xe20d
leaq 0x6927(%rip), %rcx      # 0xe21b
movl $0x52, %edx
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: bs_tree_insert
void *bs_tree_insert(bs_tree *tree, void *data) {

    bs_node *node;
    bs_node *new_node;
    void    *old_data;
    int      comp;

    // Sanity Checks:
    assert(tree != NULL);
    assert(data != NULL);

    // Avoid the trivial case: empty tree
    node = NULL;
    if (tree->root != NULL) {

        // Search for the correct place to insert data:
        node = tree->root;
        for (;;) {

            // Compare data:
            comp = (tree->comp)(data, node->data);

            // Data is smaller:
            if (comp < 0) {
                if (node->left == NULL) { break; }
                else { node = node->left; }
            }

            // Data is bigger:
            else if (comp > 0) {
                if (node->right == NULL) { break; }
                else { node = node->right; }
            }

            // Data is already there: overwrite it!
            else {
                old_data   = node->data;
                node->data = data;
                return old_data;
            }
        }
    }

    // Insert the new node here:
    new_node = (bs_node *) malloc(sizeof(bs_node));
    if (new_node == NULL) {
        fprintf(stderr, "ERROR: Unable to allocate bs_node\n");
    } else {
        new_node->data  = data;
        new_node->left  = NULL;
        new_node->right = NULL;
    }

    if (node == NULL)  { tree->root  = new_node; }
    else if (comp < 0) { node->left  = new_node; }
    else               { node->right = new_node; }

    // Data was not here!
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x7acf
movq %rsi, %r14
testq %rsi, %rsi
je 0x7aee
movq %rdi, %rbx
movq (%rdi), %rax
testq %rax, %rax
je 0x7a76
movq %rax, %r12
movq (%rax), %rsi
movq %r14, %rdi
callq *0x8(%rbx)
movl %eax, %ebp
shrl $0x1f, %ebp
testl %eax, %eax
js 0x7a6a
je 0x7aae
movq 0x10(%r12), %rax
jmp 0x7a6f
movq 0x8(%r12), %rax
testq %rax, %rax
jne 0x7a4c
jmp 0x7a7b
xorl %r12d, %r12d
xorl %ebp, %ebp
movl $0x18, %edi
callq 0x10d0
movq %rax, %r15
testq %rax, %rax
je 0x7ac8
movq %r14, (%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%r15)
testq %r12, %r12
je 0x7aa9
testb %bpl, %bpl
je 0x7ab8
movq %r15, 0x8(%r12)
jmp 0x7abd
movq %r15, (%rbx)
jmp 0x7abd
movq (%r12), %rax
movq %r14, (%r12)
jmp 0x7abf
movq %r15, 0x10(%r12)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x1168
jmp 0x7a98
leaq 0x67ad(%rip), %rdi      # 0xe283
leaq 0x6730(%rip), %rsi      # 0xe20d
leaq 0x67f6(%rip), %rcx      # 0xe2da
movl $0xc2, %edx
callq 0x1080
leaq 0x680d(%rip), %rdi      # 0xe302
leaq 0x6711(%rip), %rsi      # 0xe20d
leaq 0x67d7(%rip), %rcx      # 0xe2da
movl $0xc3, %edx
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: bs_tree_insert_min
void *bs_tree_insert_min(bs_tree *tree, void *data) {

    bs_node *node;
    bs_node *new_node;
    void    *old_data;

    // Sanity Checks:
    assert(tree != NULL);
    assert(data != NULL);

    // Trivial case:
    if (tree->root == NULL) { node = NULL; }

    // General case:
    else {
        node = tree->root;
        while (node->left != NULL) { node = node->left; }

        // If "data" is already there: overwrite it & return!
        if ((tree->comp)(data, node->data) == 0) {
            old_data   = node->data;
            node->data = data;
            return old_data;
        }
    }

    // Finally: Insert the new node here
    new_node = (bs_node *) malloc(sizeof(bs_node));
    if (new_node == NULL) {
        fprintf(stderr, "ERROR: Unable to allocate bs_node\n");
    } else {
        new_node->data  = data;
        new_node->left  = NULL;
        new_node->right = NULL;
    }
    if (node == NULL) { tree->root = new_node; }
    else              { node->left = new_node; }

    // Data was not here!
    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x7b99
movq %rsi, %r14
testq %rsi, %rsi
je 0x7bb8
movq %rdi, %rbx
movq (%rdi), %rax
testq %rax, %rax
je 0x7b55
movq %rax, %r12
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0x7b31
movq (%r12), %rsi
movq %r14, %rdi
callq *0x8(%rbx)
testl %eax, %eax
jne 0x7b58
movq (%r12), %rax
movq %r14, (%r12)
jmp 0x7b86
xorl %r12d, %r12d
movl $0x18, %edi
callq 0x10d0
movq %rax, %r15
testq %rax, %rax
je 0x7b92
movq %r14, (%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%r15)
testq %r12, %r12
je 0x7b81
movq %r15, 0x8(%r12)
jmp 0x7b84
movq %r15, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x1184
jmp 0x7b75
leaq 0x66e3(%rip), %rdi      # 0xe283
leaq 0x6666(%rip), %rsi      # 0xe20d
leaq 0x6761(%rip), %rcx      # 0xe30f
movl $0x109, %edx            # imm = 0x109
callq 0x1080
leaq 0x6743(%rip), %rdi      # 0xe302
leaq 0x6647(%rip), %rsi      # 0xe20d
leaq 0x6742(%rip), %rcx      # 0xe30f
movl $0x10a, %edx            # imm = 0x10A
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: bs_tree_insert_max
void *bs_tree_insert_max(bs_tree *tree, void *data) {

    bs_node *node;
    bs_node *new_node;
    void    *old_data;

    // Sanity Checks:
    assert(tree != NULL);
    assert(data != NULL);

    // Trivial case:
    if (tree->root == NULL) { node = NULL; }

    // General case:
    else {
        node = tree->root;
        while (node->right != NULL) { node = node->right; }

        // If "data" is already there: overwrite it & return!
        if ((tree->comp)(data, node->data) == 0) {
            old_data   = node->data;
            node->data = data;
            return old_data;
        }
    }

    // Finally: Insert the new node here
    new_node = (bs_node *) malloc(sizeof(bs_node));
    if (new_node == NULL) {
        fprintf(stderr, "ERROR: Unable to allocate bs_node\n");
    } else {
        new_node->data  = data;
        new_node->left  = NULL;
        new_node->right = NULL;
    }
    if (node == NULL) { tree->root  = new_node; }
    else              { node->right = new_node; }

    // Data was not here!
    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x7c63
movq %rsi, %r14
testq %rsi, %rsi
je 0x7c82
movq %rdi, %rbx
movq (%rdi), %rax
testq %rax, %rax
je 0x7c1f
movq %rax, %r12
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x7bfb
movq (%r12), %rsi
movq %r14, %rdi
callq *0x8(%rbx)
testl %eax, %eax
jne 0x7c22
movq (%r12), %rax
movq %r14, (%r12)
jmp 0x7c50
xorl %r12d, %r12d
movl $0x18, %edi
callq 0x10d0
movq %rax, %r15
testq %rax, %rax
je 0x7c5c
movq %r14, (%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%r15)
testq %r12, %r12
je 0x7c4b
movq %r15, 0x10(%r12)
jmp 0x7c4e
movq %r15, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x11a0
jmp 0x7c3f
leaq 0x6619(%rip), %rdi      # 0xe283
leaq 0x659c(%rip), %rsi      # 0xe20d
leaq 0x66c3(%rip), %rcx      # 0xe33b
movl $0x13e, %edx            # imm = 0x13E
callq 0x1080
leaq 0x6679(%rip), %rdi      # 0xe302
leaq 0x657d(%rip), %rsi      # 0xe20d
leaq 0x66a4(%rip), %rcx      # 0xe33b
movl $0x13f, %edx            # imm = 0x13F
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: bs_tree_search
void *bs_tree_search(const bs_tree *tree, const void *data) {

    bs_node *node;
    int      comp;

    // Sanity Checks:
    assert(tree != NULL);
    assert(data != NULL);

    // Search:
    node = tree->root;
    while (node != NULL) {
        comp = (tree->comp)(data, node->data);      // compare data
        if      (comp < 0) { node = node->left;  }  // data is smaller
        else if (comp > 0) { node = node->right; }  // data is bigger
        else               { return node->data;  }  // found!
    }

    // Not found:
    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x7d29
movq %rsi, %rbx
testq %rsi, %rsi
je 0x7d48
movq %rdi, %r14
movq (%rdi), %r12
xorl %r15d, %r15d
testq %r12, %r12
je 0x7d1a
movq (%r12), %rsi
movq %rbx, %rdi
callq *0x8(%r14)
testl %eax, %eax
js 0x7d0b
movl $0x10, %eax
jne 0x7d10
jmp 0x7d16
movl $0x8, %eax
movq (%r12,%rax), %r12
jmp 0x7cee
movq (%r12), %r15
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x6553(%rip), %rdi      # 0xe283
leaq 0x64d6(%rip), %rsi      # 0xe20d
leaq 0x664f(%rip), %rcx      # 0xe38d
movl $0x179, %edx            # imm = 0x179
callq 0x1080
leaq 0x65b3(%rip), %rdi      # 0xe302
leaq 0x64b7(%rip), %rsi      # 0xe20d
leaq 0x6630(%rip), %rcx      # 0xe38d
movl $0x17a, %edx            # imm = 0x17A
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: bs_tree_min
void *bs_tree_min(const bs_tree *tree) {

    bs_node *node;

    // Sanity check:
    assert(tree != NULL);

    // Trivial case: empty tree
    if (tree->root == NULL) { return NULL; }

    // General case: Find the smallest node
    node = tree->root;
    while (node->left != NULL) { node = node->left; }

    // Return a pointer to the data:
    return node->data;
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x7d8a
movq (%rdi), %rax
testq %rax, %rax
je 0x7d86
movq %rax, %rcx
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0x7d75
movq (%rcx), %rax
jmp 0x7d88
xorl %eax, %eax
popq %rcx
retq
leaq 0x64f2(%rip), %rdi      # 0xe283
leaq 0x6475(%rip), %rsi      # 0xe20d
leaq 0x6622(%rip), %rcx      # 0xe3c1
movl $0x191, %edx            # imm = 0x191
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: bs_tree_max
void *bs_tree_max(const bs_tree *tree) {

    bs_node *node;

    // Sanity check:
    assert(tree != NULL);

    // Trivial case: empty tree
    if (tree->root == NULL) { return NULL; }

    // General case: Find the biggest node
    node = tree->root;
    while (node->right != NULL) { node = node->right; }

    // Return a pointer to the data:
    return node->data;
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x7dcc
movq (%rdi), %rax
testq %rax, %rax
je 0x7dc8
movq %rax, %rcx
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x7db7
movq (%rcx), %rax
jmp 0x7dca
xorl %eax, %eax
popq %rcx
retq
leaq 0x64b0(%rip), %rdi      # 0xe283
leaq 0x6433(%rip), %rsi      # 0xe20d
leaq 0x6603(%rip), %rcx      # 0xe3e4
movl $0x1a6, %edx            # imm = 0x1A6
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: bs_tree_prev
void *bs_tree_prev(const bs_tree *tree, const void *data) {

    bs_node *node;
    bs_node *pred;
    int      comp;

    // Sanity Checks:
    assert(tree != NULL);
    assert(data != NULL);

    // Search:
    pred = NULL;
    node = tree->root;
    while (node != NULL) {

        // Compare data:
        comp = (tree->comp)(data, node->data);

        // Data is smaller:
        if (comp < 0) { node = node->left; }

        // Data is bigger:
        else if (comp > 0) {
            pred = node;
            node = node->right;
        }

        // We have found the node:
        else if (node->left != NULL) {
            pred = node->left;
            while (pred->right != NULL) { pred = pred->right; }
            break;
        } else { break; }
    }

    // Return predecesor:
    if (pred == NULL) { return NULL; }
    return pred->data;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x7e71
movq %rsi, %rbx
testq %rsi, %rsi
je 0x7e90
movq %rdi, %r14
movq (%rdi), %r15
testq %r15, %r15
je 0x7e42
xorl %r12d, %r12d
movq (%r15), %rsi
movq %rbx, %rdi
callq *0x8(%r14)
testl %eax, %eax
js 0x7e2c
movl $0x10, %ecx
movq %r15, %rax
jne 0x7e34
jmp 0x7e5c
movl $0x8, %ecx
movq %r12, %rax
movq (%r15,%rcx), %r15
movq %rax, %r12
testq %r15, %r15
jne 0x7e12
jmp 0x7e44
xorl %eax, %eax
testq %rax, %rax
je 0x7e4e
movq (%rax), %rax
jmp 0x7e50
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x8(%r15), %rcx
movq %r12, %rax
testq %rcx, %rcx
je 0x7e44
movq %rcx, %rax
movq 0x10(%rcx), %rcx
jmp 0x7e63
leaq 0x640b(%rip), %rdi      # 0xe283
leaq 0x638e(%rip), %rsi      # 0xe20d
leaq 0x6581(%rip), %rcx      # 0xe407
movl $0x1bf, %edx            # imm = 0x1BF
callq 0x1080
leaq 0x646b(%rip), %rdi      # 0xe302
leaq 0x636f(%rip), %rsi      # 0xe20d
leaq 0x6562(%rip), %rcx      # 0xe407
movl $0x1c0, %edx            # imm = 0x1C0
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: bs_tree_next
void *bs_tree_next(const bs_tree *tree, const void *data) {

    bs_node *node;
    bs_node *succ;
    int      comp;

    // Sanity Checks:
    assert(tree != NULL);
    assert(data != NULL);

    // Search:
    succ = NULL;
    node = tree->root;
    while (node != NULL) {

        // Compare data:
        comp = (tree->comp)(data, node->data);

        // Data is smaller:
        if (comp < 0) {
            succ = node;
            node = node->left;
        }

        // Data is bigger:
        else if (comp > 0) { node = node->right; }

        // We have found the node:
        else if (node->right != NULL) {
            succ = node->right;
            while (succ->left != NULL) { succ = succ->left; }
            break;
        } else { break; }
    }

    // Return succesor:
    if (succ == NULL) { return NULL; }
    return succ->data;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x7f29
movq %rsi, %rbx
testq %rsi, %rsi
je 0x7f48
movq %rdi, %r14
movq (%rdi), %r12
xorl %r15d, %r15d
testq %r12, %r12
je 0x7f11
movq (%r12), %rsi
movq %rbx, %rdi
callq *0x8(%r14)
testl %eax, %eax
js 0x7ef2
addq $0x10, %r12
testl %eax, %eax
je 0x7eff
movq %r12, %rax
jmp 0x7efa
leaq 0x8(%r12), %rax
movq %r12, %r15
movq (%rax), %r12
jmp 0x7ed1
movq (%r12), %rax
testq %rax, %rax
je 0x7f11
movq %rax, %r15
movq 0x8(%rax), %rax
jmp 0x7f03
testq %r15, %r15
je 0x7f1b
movq (%r15), %rax
jmp 0x7f1d
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x6353(%rip), %rdi      # 0xe283
leaq 0x62d6(%rip), %rsi      # 0xe20d
leaq 0x64fb(%rip), %rcx      # 0xe439
movl $0x1ec, %edx            # imm = 0x1EC
callq 0x1080
leaq 0x63b3(%rip), %rdi      # 0xe302
leaq 0x62b7(%rip), %rsi      # 0xe20d
leaq 0x64dc(%rip), %rcx      # 0xe439
movl $0x1ed, %edx            # imm = 0x1ED
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: bs_tree_remove_min
void *bs_tree_remove_min(bs_tree *tree) {

    bs_node *node;
    bs_node *parent;
    void    *old_data;

    // Sanity check:
    assert(tree != NULL);

    // Avoid trivial case: empty tree
    old_data = NULL;
    if (tree->root != NULL) {

        // General case: Find the smallest node
        parent = NULL;
        node   = tree->root;
        while (node->left != NULL) {
            parent = node;
            node   = node->left;
        }
        old_data = node->data;

        // Remove Node:
        if (parent != NULL) { parent->left = node->right; }
        else                { tree->root   = node->right; }
        free(node);
    }
    return old_data;
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x80d6
movq (%rdi), %rcx
testq %rcx, %rcx
je 0x80cf
xorl %eax, %eax
movq %rax, %rdx
movq %rcx, %rax
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
jne 0x80a1
movq (%rax), %rbx
movq 0x10(%rax), %rcx
leaq 0x8(%rdx), %rsi
testq %rdx, %rdx
cmoveq %rdi, %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x1120
jmp 0x80d1
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
retq
leaq 0x61a6(%rip), %rdi      # 0xe283
leaq 0x6129(%rip), %rsi      # 0xe20d
leaq 0x63ae(%rip), %rcx      # 0xe499
movl $0x277, %edx            # imm = 0x277
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: bs_tree_remove_max
void *bs_tree_remove_max(bs_tree *tree) {

    bs_node *node;
    bs_node *parent;
    void        *old_data;

    // Sanity check:
    assert(tree != NULL);

    // Avoid trivial case: empty tree
    old_data = NULL;
    if (tree->root != NULL) {

        // General case: Find the biggest node
        parent = NULL;
        node   = tree->root;
        while (node->right != NULL) {
            parent = node;
            node   = node->right;
        }
        old_data = node->data;

        // Remove Node:
        if (parent != NULL) { parent->right = node->left; }
        else                { tree->root    = node->left; }
        free(node);
    }
    return old_data;
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x813a
movq (%rdi), %rcx
testq %rcx, %rcx
je 0x8133
xorl %eax, %eax
movq %rax, %rdx
movq %rcx, %rax
movq 0x10(%rcx), %rcx
testq %rcx, %rcx
jne 0x8105
movq (%rax), %rbx
movq 0x8(%rax), %rcx
leaq 0x10(%rdx), %rsi
testq %rdx, %rdx
cmoveq %rdi, %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0x1120
jmp 0x8135
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
retq
leaq 0x6142(%rip), %rdi      # 0xe283
leaq 0x60c5(%rip), %rsi      # 0xe20d
leaq 0x636e(%rip), %rcx      # 0xe4bd
movl $0x29b, %edx            # imm = 0x29B
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: bs_tree_remove_all
void bs_tree_remove_all(bs_tree *tree, void (* free_data) (void *)) {

    bs_node *root;
    bs_node *left;
    bs_node *right;

    // Sanity check:
    assert(tree != NULL);

    // Initialize:
    root = tree->root;
    tree->root = NULL;

    // While the tree is not empty:
    while (root != NULL) {

        // Unravel the tree: Rotate right "root" & "left"
        if (root->left != NULL) {
            left        = root->left;
            right       = left->right;
            left->right = root;
            root->left  = right;
            root        = left;

        // Erase the current "root" node:
        } else {
            right = root->right;
            if (free_data != NULL) { free_data(root->data); }
            free(root);
            root = right;
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x81b0
movq (%rdi), %r14
movq $0x0, (%rdi)
testq %r14, %r14
je 0x81aa
movq %rsi, %rbx
movq 0x8(%r14), %r15
testq %r15, %r15
je 0x818c
movq 0x10(%r15), %rax
movq %r14, 0x10(%r15)
movq %rax, 0x8(%r14)
jmp 0x81a2
movq 0x10(%r14), %r15
testq %rbx, %rbx
je 0x819a
movq (%r14), %rdi
callq *%rbx
movq %r14, %rdi
callq 0x1120
movq %r15, %r14
testq %r15, %r15
jne 0x8175
popq %rbx
popq %r14
popq %r15
retq
leaq 0x60cc(%rip), %rdi      # 0xe283
leaq 0x604f(%rip), %rsi      # 0xe20d
leaq 0x631c(%rip), %rcx      # 0xe4e1
movl $0x2cc, %edx            # imm = 0x2CC
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: is_bs_tree
int is_bs_tree(const bs_tree *tree) {

    // Basic Sanity Checks:
    if (tree == NULL) {
        fprintf(stderr, "ERROR: NULL pointer to bs_tree\n");
        return NO;
    }
    if (tree->comp == NULL) {
        fprintf(stderr, "ERROR: NULL comparing function in bs_tree\n");
        return NO;
    }

    // Trivial Case: empty tree
    if (tree->root == NULL) { return YES; }

    // General Case:
    return is_bs_subtree(tree, tree->root, NULL, NULL);
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x944f
cmpq $0x0, 0x8(%rdi)
je 0x9456
movq (%rdi), %rsi
testq %rsi, %rsi
je 0x9448
xorl %edx, %edx
xorl %ecx, %ecx
popq %rax
jmp 0x945f
movl $0x1, %eax
jmp 0x945d
callq 0x12b8
jmp 0x945b
callq 0x129c
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: is_bs_subtree
static int is_bs_subtree(const bs_tree *tree, const bs_node *node,
                         const void *min, const void *max) {

    // Make sure that node is (strictly) between specified limits:
    if (min != NULL && (tree->comp)(min, node->data) >= 0) {
        fprintf(stderr,"ERROR: Symmetric order not satisfied in bs_tree\n");
        return NO;
    }
    if (max != NULL && (tree->comp)(node->data, max) >= 0) {
        fprintf(stderr,"ERROR: Symmetric order not satisfied in bs_tree\n");
        return NO;
    }

    // Check recursively the left subtree of node:
    if (node->left != NULL) {
        if (is_bs_subtree(tree, node->left, min, node->data) == NO) {
            return NO;
        }
    }

    // Check recursively the right subtree of node:
    if (node->right != NULL) {
        if (is_bs_subtree(tree, node->right, node->data, max) == NO) {
            return NO;
        }
    }

    // All test are fine:
    return YES;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
testq %rdx, %rdx
je 0x9486
movq (%r15), %rsi
movq %r12, %rdi
callq *0x8(%r14)
testl %eax, %eax
jns 0x94d6
testq %rbx, %rbx
je 0x9499
movq (%r15), %rdi
movq %rbx, %rsi
callq *0x8(%r14)
testl %eax, %eax
jns 0x94dd
movq 0x8(%r15), %rsi
testq %rsi, %rsi
je 0x94b4
movq (%r15), %rcx
movq %r14, %rdi
movq %r12, %rdx
callq 0x945f
testl %eax, %eax
je 0x94e2
movq 0x10(%r15), %rsi
testq %rsi, %rsi
je 0x94cf
movq (%r15), %rdx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x945f
testl %eax, %eax
je 0x94e2
movl $0x1, %eax
jmp 0x94e4
callq 0x12d4
jmp 0x94e2
callq 0x12f0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: print_bs_tree
void print_bs_tree(const bs_tree *tree, void (* print_node) (const void *)) {

    // Avoid the trivial cases:
    if (tree != NULL && tree->root != NULL) {

        // Print right subtree recursively:
        if (tree->root->right != NULL) {
            print_bs_subtree(tree->root->right, YES, "     ", print_node);
        }

        // Print current node:
        fprintf(stdout, "----");
        if (print_node == NULL) { fprintf(stdout, "(#)"); }
        else     { print_node(tree->root->data); }
        fprintf(stdout, "\n");

        // Print left subtree recursively:
        if (tree->root->left != NULL) {
            print_bs_subtree(tree->root->left, NO, "     ", print_node);
        }
    }

    // Empty the "stdout" buffer:
    fflush(stdout);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x959f
movq %rdi, %r14
movq (%rdi), %rax
testq %rax, %rax
je 0x959f
movq %rsi, %rbx
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0x952d
leaq 0x5a39(%rip), %rdx      # 0xef59
movl $0x1, %esi
movq %rbx, %rcx
callq 0x95b3
movq 0x8aa4(%rip), %r15      # 0x11fd8
movq (%r15), %rcx
leaq 0x5a2b(%rip), %rdi      # 0xef69
movl $0x4, %esi
movl $0x1, %edx
callq 0x1100
testq %rbx, %rbx
je 0x955c
movq (%r14), %rax
movq (%rax), %rdi
callq *%rbx
jmp 0x9575
movq (%r15), %rcx
leaq 0x5171(%rip), %rdi      # 0xe6d7
movl $0x3, %esi
movl $0x1, %edx
callq 0x1100
movq (%r15), %rsi
movl $0xa, %edi
callq 0x1090
movq (%r14), %rax
movq 0x8(%rax), %rdi
testq %rdi, %rdi
je 0x959f
leaq 0x59c4(%rip), %rdx      # 0xef59
xorl %esi, %esi
movq %rbx, %rcx
callq 0x95b3
movq 0x8a32(%rip), %rax      # 0x11fd8
movq (%rax), %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x10e0
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: print_bs_subtree
static void print_bs_subtree(const bs_node *node, const int is_right,
                             char *indent, void (* print_node) (const void *)) {

    // Allocate memory:
    char *new_indent = (char *) malloc((6+strlen(indent)*sizeof(char)));
    assert(new_indent != NULL);

    // Print right subtree recursively:
    if (node->right != NULL) {
        if (is_right == YES) { sprintf(new_indent, "%s%s", indent, "      "); }
        else                 { sprintf(new_indent, "%s%s", indent, "|     "); }
        print_bs_subtree(node->right, YES, new_indent, print_node);
    }

    // Print current node:
    if (is_right) { fprintf(stdout, "%s,----",indent); }
    else          { fprintf(stdout, "%s`----",indent); }
    if (print_node == NULL)  { fprintf(stdout, "(#)"); }
    else                     { print_node(node->data); }
    printf("\n");

    // Print left subtree recursively:
    if (node->left != NULL) {
        if (is_right == YES) { sprintf(new_indent, "%s%s", indent, "|     "); }
        else                 { sprintf(new_indent, "%s%s", indent, "      "); }
        print_bs_subtree(node->left, NO, new_indent, print_node);
    }

    // Free memory:
    free(new_indent);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r14
movq %rdx, %rdi
callq 0x1060
leaq 0x6(%rax), %rdi
callq 0x10d0
testq %rax, %rax
je 0x96da
movq %rax, %r15
cmpq $0x0, 0x10(%r14)
je 0x962a
cmpl $0x1, %ebp
leaq 0x5961(%rip), %rax      # 0xef58
leaq 0x5961(%rip), %rcx      # 0xef5f
cmoveq %rax, %rcx
leaq 0x594a(%rip), %rsi      # 0xef53
movq %r15, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x10f0
movq 0x10(%r14), %rdi
movl $0x1, %esi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x95b3
testl %ebp, %ebp
movq 0x89a5(%rip), %r13      # 0x11fd8
movq (%r13), %rdi
leaq 0x5930(%rip), %rax      # 0xef6e
leaq 0x5921(%rip), %rsi      # 0xef66
cmoveq %rax, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x10b0
testq %rbx, %rbx
je 0x965f
movq (%r14), %rdi
callq *%rbx
jmp 0x9679
movq (%r13), %rcx
leaq 0x506d(%rip), %rdi      # 0xe6d7
movl $0x3, %esi
movl $0x1, %edx
callq 0x1100
movl $0xa, %edi
callq 0x1030
cmpq $0x0, 0x8(%r14)
je 0x96c4
cmpl $0x1, %ebp
leaq 0x58cb(%rip), %rax      # 0xef5f
leaq 0x58bd(%rip), %rcx      # 0xef58
cmoveq %rax, %rcx
leaq 0x58ad(%rip), %rsi      # 0xef53
movq %r15, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x10f0
movq 0x8(%r14), %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x95b3
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1120
leaq 0x580d(%rip), %rdi      # 0xeeee
leaq 0x4b25(%rip), %rsi      # 0xe20d
leaq 0x5812(%rip), %rcx      # 0xef01
movl $0x83a, %edx            # imm = 0x83A
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: new_rb_tree
rb_tree *new_rb_tree(int (* comp) (const void *, const void *)) {

    // Sanity check:
    assert(comp != NULL);

    // Allocate memory:
    rb_tree *tree = (rb_tree *) malloc(sizeof(rb_tree));
    if (tree == NULL) {
        fprintf(stderr, "ERROR: Unable to allocate memory for rb_tree\n");
    }

    // Initialize the empty tree:
    else {
        tree->root = NULL;
        tree->comp = comp;
    }

    return tree;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x9734
movq %rdi, %rbx
movl $0x10, %edi
callq 0x10d0
movq %rax, %r14
testq %rax, %rax
je 0x972d
movq $0x0, (%r14)
movq %rbx, 0x8(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x130c
jmp 0x9722
leaq 0x4ac5(%rip), %rdi      # 0xe200
leaq 0x4acb(%rip), %rsi      # 0xe20d
leaq 0x4f92(%rip), %rcx      # 0xe6db
movl $0x8aa, %edx            # imm = 0x8AA
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: rb_tree_copy
rb_tree *rb_tree_copy(const rb_tree *tree) {

    rb_tree *new_tree = NULL;
    rb_node *pred;
    rb_node *node;
    void    *data;
    
    // Sanity check:
    assert(tree != NULL);
    
    // Create a new tree:
    new_tree = new_rb_tree(tree->comp);
    if (new_tree == NULL) { return NULL; }

    // Go to the smallest element of tree while right-threading your path:
    node = tree->root;
    if (node != NULL) {
        while (node->left != NULL) {
            pred = node->left;
            while (pred->right != NULL) { pred = pred->right; }
            pred->right = node;
            node        = node->left;
        }
    }

    // Insert all data from tree into new_tree:
    while (node != NULL) {

        // insert node->data in new_tree ///////////////////////////////////////
        data = node->data;
        data = rb_tree_insert_max(new_tree, data);
        assert(data == NULL);
        ////////////////////////////////////////////////////////////////////////

        // advance node ////////////////////////////////////////////////////////
        node = node->right;
        if (node != NULL) {
            while (node->left != NULL) {
                pred = node->left;
                while (pred->right != NULL && pred->right != node) {
                    pred = pred->right;
                }
                if (pred->right == NULL) {
                    pred->right = node;
                    node        = node->left;
                } else {
                    pred->right = NULL;
                    break;
                }
            }
        }
        ////////////////////////////////////////////////////////////////////////
    }
    
    // Return the new_tree:
    return new_tree;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x97b2
movq %rdi, %r14
movq 0x8(%rdi), %rdi
callq 0x96f9
testq %rax, %rax
je 0x97a5
movq %rax, %rbx
movq (%r14), %rax
testq %rax, %rax
je 0x97d1
movq 0x8(%rax), %rcx
testq %rcx, %rcx
je 0x97d6
movq %rcx, %r14
movq %rcx, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
testq %rdx, %rdx
jne 0x9787
movq %rax, 0x10(%rcx)
movq 0x8(%r14), %rcx
movq %r14, %rax
testq %rcx, %rcx
jne 0x9781
jmp 0x9810
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x4aca(%rip), %rdi      # 0xe283
leaq 0x4a4d(%rip), %rsi      # 0xe20d
leaq 0x4f7c(%rip), %rcx      # 0xe743
movl $0x8c7, %edx            # imm = 0x8C7
callq 0x1080
xorl %r14d, %r14d
jmp 0x9810
movq %rax, %r14
jmp 0x9810
movq 0x8(%rax), %rcx
testq %rcx, %rcx
je 0x97d6
movq %rcx, %r14
movq %rcx, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
testq %rdx, %rdx
je 0x97fb
cmpq %rax, %rdx
jne 0x97ea
testq %rdx, %rdx
jne 0x982b
movq %rax, 0x10(%rcx)
movq 0x8(%r14), %rcx
movq %r14, %rax
testq %rcx, %rcx
jne 0x97e4
testq %r14, %r14
je 0x97a7
movq (%r14), %rsi
movq %rbx, %rdi
callq 0x9835
movq 0x10(%r14), %rax
testq %rax, %rax
jne 0x97db
jmp 0x97d1
movq $0x0, 0x10(%rcx)
jmp 0x97d6
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: rb_tree_min
void *rb_tree_min(const rb_tree *tree) {

    rb_node *node;

    // Sanity check:
    assert(tree != NULL);

    // Trivial case: empty tree
    if (tree->root == NULL) { return NULL; }

    // General case: Find the smallest node
    node = tree->root;
    while (node->left != NULL) { node = node->left; }

    // Return a pointer to the data:
    return node->data;
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x9e9f
movq (%rdi), %rax
testq %rax, %rax
je 0x9e9b
movq %rax, %rcx
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0x9e8a
movq (%rcx), %rax
jmp 0x9e9d
xorl %eax, %eax
popq %rcx
retq
leaq 0x43dd(%rip), %rdi      # 0xe283
leaq 0x4360(%rip), %rsi      # 0xe20d
leaq 0x49b3(%rip), %rcx      # 0xe867
movl $0xa77, %edx            # imm = 0xA77
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: rb_tree_max
void *rb_tree_max(const rb_tree *tree) {

    rb_node *node;

    // Sanity check:
    assert(tree != NULL);

    // Trivial case: empty tree
    if (tree->root == NULL) { return NULL; }

    // General case: Find the biggest node
    node = tree->root;
    while (node->right != NULL) { node = node->right; }

    // Return a pointer to the data:
    return node->data;
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x9ee1
movq (%rdi), %rax
testq %rax, %rax
je 0x9edd
movq %rax, %rcx
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x9ecc
movq (%rcx), %rax
jmp 0x9edf
xorl %eax, %eax
popq %rcx
retq
leaq 0x439b(%rip), %rdi      # 0xe283
leaq 0x431e(%rip), %rsi      # 0xe20d
leaq 0x4994(%rip), %rcx      # 0xe88a
movl $0xa8c, %edx            # imm = 0xA8C
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: rb_tree_prev
void *rb_tree_prev(const rb_tree *tree, const void *data) {

    rb_node *node;
    rb_node *pred;
    int      comp;

    // Sanity Checks:
    assert(tree != NULL);
    assert(data != NULL);

    // Search:
    pred = NULL;
    node = tree->root;
    while (node != NULL) {

        // Compare data:
        comp = (tree->comp)(data, node->data);

        // Data is smaller:
        if (comp < 0) { node = node->left; }

        // Data is bigger:
        else if (comp > 0) {
            pred = node;
            node = node->right;
        }

        // We have found the node:
        else if (node->left != NULL) {
            pred = node->left;
            while (pred->right != NULL) { pred = pred->right; }
            break;
        } else { break; }
    }

    // Return predecesor:
    if (pred == NULL) { return NULL; }
    return pred->data;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x9f86
movq %rsi, %rbx
testq %rsi, %rsi
je 0x9fa5
movq %rdi, %r14
movq (%rdi), %r15
testq %r15, %r15
je 0x9f57
xorl %r12d, %r12d
movq (%r15), %rsi
movq %rbx, %rdi
callq *0x8(%r14)
testl %eax, %eax
js 0x9f41
movl $0x10, %ecx
movq %r15, %rax
jne 0x9f49
jmp 0x9f71
movl $0x8, %ecx
movq %r12, %rax
movq (%r15,%rcx), %r15
movq %rax, %r12
testq %r15, %r15
jne 0x9f27
jmp 0x9f59
xorl %eax, %eax
testq %rax, %rax
je 0x9f63
movq (%rax), %rax
jmp 0x9f65
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x8(%r15), %rcx
movq %r12, %rax
testq %rcx, %rcx
je 0x9f59
movq %rcx, %rax
movq 0x10(%rcx), %rcx
jmp 0x9f78
leaq 0x42f6(%rip), %rdi      # 0xe283
leaq 0x4279(%rip), %rsi      # 0xe20d
leaq 0x4912(%rip), %rcx      # 0xe8ad
movl $0xaa5, %edx            # imm = 0xAA5
callq 0x1080
leaq 0x4356(%rip), %rdi      # 0xe302
leaq 0x425a(%rip), %rsi      # 0xe20d
leaq 0x48f3(%rip), %rcx      # 0xe8ad
movl $0xaa6, %edx            # imm = 0xAA6
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: rb_tree_next
void *rb_tree_next(const rb_tree *tree, const void *data) {

    rb_node *node;
    rb_node *succ;
    int      comp;

    // Sanity Checks:
    assert(tree != NULL);
    assert(data != NULL);

    // Search:
    succ = NULL;
    node = tree->root;
    while (node != NULL) {

        // Compare data:
        comp = (tree->comp)(data, node->data);

        // Data is smaller:
        if (comp < 0) {
            succ = node;
            node = node->left;
        }

        // Data is bigger:
        else if (comp > 0) { node = node->right; }

        // We have found the node:
        else if (node->right != NULL) {
            succ = node->right;
            while (succ->left != NULL) { succ = succ->left; }
            break;
        } else { break; }
    }

    // Return succesor:
    if (succ == NULL) { return NULL; }
    return succ->data;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xa03e
movq %rsi, %rbx
testq %rsi, %rsi
je 0xa05d
movq %rdi, %r14
movq (%rdi), %r12
xorl %r15d, %r15d
testq %r12, %r12
je 0xa026
movq (%r12), %rsi
movq %rbx, %rdi
callq *0x8(%r14)
testl %eax, %eax
js 0xa007
addq $0x10, %r12
testl %eax, %eax
je 0xa014
movq %r12, %rax
jmp 0xa00f
leaq 0x8(%r12), %rax
movq %r12, %r15
movq (%rax), %r12
jmp 0x9fe6
movq (%r12), %rax
testq %rax, %rax
je 0xa026
movq %rax, %r15
movq 0x8(%rax), %rax
jmp 0xa018
testq %r15, %r15
je 0xa030
movq (%r15), %rax
jmp 0xa032
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x423e(%rip), %rdi      # 0xe283
leaq 0x41c1(%rip), %rsi      # 0xe20d
leaq 0x488c(%rip), %rcx      # 0xe8df
movl $0xad2, %edx            # imm = 0xAD2
callq 0x1080
leaq 0x429e(%rip), %rdi      # 0xe302
leaq 0x41a2(%rip), %rsi      # 0xe20d
leaq 0x486d(%rip), %rcx      # 0xe8df
movl $0xad3, %edx            # imm = 0xAD3
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: rb_tree_remove_all
void rb_tree_remove_all(rb_tree *tree, void (* free_data) (void *)) {

    rb_node *root;
    rb_node *left;
    rb_node *right;

    // Sanity check:
    assert(tree != NULL);

    // Initialize:
    root = tree->root;
    tree->root = NULL;

    // While the tree is not empty:
    while (root != NULL) {

        // Unravel the tree: Rotate right "root" & "left"
        if (root->left != NULL) {
            left        = root->left;
            right       = left->right;
            left->right = root;
            root->left  = right;
            root        = left;

        // Erase the current "root" node:
        } else {
            right = root->right;
            if (free_data != NULL) { free_data(root->data); }
            free(root);
            root = right;
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0xa84b
movq (%rdi), %r14
movq $0x0, (%rdi)
testq %r14, %r14
je 0xa845
movq %rsi, %rbx
movq 0x8(%r14), %r15
testq %r15, %r15
je 0xa827
movq 0x10(%r15), %rax
movq %r14, 0x10(%r15)
movq %rax, 0x8(%r14)
jmp 0xa83d
movq 0x10(%r14), %r15
testq %rbx, %rbx
je 0xa835
movq (%r14), %rdi
callq *%rbx
movq %r14, %rdi
callq 0x1120
movq %r15, %r14
testq %r15, %r15
jne 0xa810
popq %rbx
popq %r14
popq %r15
retq
leaq 0x3a31(%rip), %rdi      # 0xe283
leaq 0x39b4(%rip), %rsi      # 0xe20d
leaq 0x4127(%rip), %rcx      # 0xe987
movl $0xd26, %edx            # imm = 0xD26
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: is_rb_tree
int is_rb_tree(const rb_tree *tree) {

    // Basic Sanity Checks:
    if (tree == NULL) {
        fprintf(stderr, "ERROR: NULL pointer to rb_tree\n");
        return NO;
    }
    if (tree->comp == NULL) {
        fprintf(stderr, "ERROR: NULL comparing function in rb_tree\n");
        return NO;
    }

    // Trivial Case: empty tree
    if (tree->root == NULL) { return YES; }

    // General Case:
    if (is_rb_subtree(tree, tree->root, NULL, NULL) == -1) { return NO;  }
    else                                                   { return YES; }
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0xb5f2
cmpq $0x0, 0x8(%rdi)
je 0xb5f9
movq (%rdi), %rsi
testq %rsi, %rsi
je 0xb5eb
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xb602
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
setne %al
jmp 0xb600
movl $0x1, %eax
jmp 0xb600
callq 0x1398
jmp 0xb5fe
callq 0x137c
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: is_rb_subtree
static int is_rb_subtree(const rb_tree *tree, const rb_node *node,
                         const void *min, const void *max) {

    int left_height  = 0;
    int right_height = 0;

    // Make sure that node is (strictly) between specified limits:
    if (min != NULL && (tree->comp)(min, node->data) >= 0) {
        fprintf(stderr, "ERROR: Symmetric order not satisfied in rb_tree\n");
        return -1;
    }
    if (max != NULL && (tree->comp)(node->data, max) >= 0) {
        fprintf(stderr, "ERROR: Symmetric order not satisfied in rb_tree\n");
        return -1;
    }

    // Check for RED violations:
    if (node->color == RED) {
        if (node->left  != NULL && node->left->color  == RED) {
            fprintf(stderr, "ERROR: Two RED nodes in a row in rb_tree\n");
            return -1;
        }
        if (node->right != NULL && node->right->color == RED) {
            fprintf(stderr, "ERROR: Two RED nodes in a row in rb_tree\n");
            return -1;
        }
    }

    // Check recursively the left subtree of node:
    if (node->left != NULL) {
        left_height = is_rb_subtree(tree, node->left, min, node->data);
        if (left_height == -1) { return -1; }
    }

    // Check recursively the right subtree of node:
    if (node->right != NULL) {
        right_height = is_rb_subtree(tree, node->right, node->data, max);
        if (right_height == -1) { return -1; }
    }

    // Check for BLACK violations:
    if (left_height != right_height) {
        fprintf(stderr, "ERROR: Different BLACK height in rb_tree\n");
        return -1;
    }
    
    // Return Black-Height of "node":
    if (node->color == RED){ return left_height; }
    return left_height+1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r15
testq %rdx, %rdx
je 0xb630
movq (%rbx), %rsi
movq %r12, %rdi
callq *0x8(%r15)
testl %eax, %eax
jns 0xb6c2
testq %r14, %r14
je 0xb647
movq (%rbx), %rdi
movq %r14, %rsi
callq *0x8(%r15)
testl %eax, %eax
jns 0xb6c9
cmpb $0x1, 0x18(%rbx)
jne 0xb66b
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0xb65c
cmpb $0x1, 0x18(%rax)
je 0xb6d7
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0xb66b
cmpb $0x1, 0x18(%rax)
je 0xb6de
movq 0x8(%rbx), %rsi
xorl %r13d, %r13d
movl $0x0, %ebp
testq %rsi, %rsi
je 0xb691
movq (%rbx), %rcx
movq %r15, %rdi
movq %r12, %rdx
callq 0xb602
movl %eax, %ebp
cmpl $-0x1, %eax
je 0xb6e3
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0xb6b0
movq (%rbx), %rdx
movq %r15, %rdi
movq %r14, %rcx
callq 0xb602
movl %eax, %r13d
cmpl $-0x1, %eax
je 0xb6e3
cmpl %r13d, %ebp
jne 0xb6d0
xorl %eax, %eax
cmpb $0x1, 0x18(%rbx)
setne %al
addl %eax, %ebp
jmp 0xb6e8
callq 0x13b4
jmp 0xb6e3
callq 0x13d0
jmp 0xb6e3
callq 0x1424
jmp 0xb6e3
callq 0x13ec
jmp 0xb6e3
callq 0x1408
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: print_rb_tree
void print_rb_tree(const rb_tree *tree, void (* print_node) (const void *)) {

    // Avoid the trivial cases:
    if (tree != NULL && tree->root != NULL) {

        // Print right subtree recursively:
        if (tree->root->right != NULL) {
            print_rb_subtree(tree->root->right, YES, "     ", print_node);
        }

        // Print current node:
        if (tree->root->color == RED) { fprintf(stdout, "===="); }
        else                          { fprintf(stdout, "----"); }
        if (print_node == NULL) {
            if (tree->root->color == RED) { fprintf(stdout, "(#)"); }
            else                          { fprintf(stdout, "( )"); }
        } else { print_node(tree->root->data); }
        fprintf(stdout, "\n");

        // Print left subtree recursively:
        if (tree->root->left != NULL) {
            print_rb_subtree(tree->root->left, NO, "     ", print_node);
        }
    }

    // Empty the "stdout" buffer:
    fflush(stdout);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0xb7c9
movq %rdi, %r14
movq (%rdi), %rax
testq %rax, %rax
je 0xb7c9
movq %rsi, %rbx
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0xb736
leaq 0x3830(%rip), %rdx      # 0xef59
movl $0x1, %esi
movq %rbx, %rcx
callq 0xb7dd
movq (%r14), %rax
cmpb $0x1, 0x18(%rax)
movq 0x6894(%rip), %r15      # 0x11fd8
movq (%r15), %rcx
leaq 0x3909(%rip), %rax      # 0xf057
leaq 0x3814(%rip), %rdi      # 0xef69
cmoveq %rax, %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x1100
movq (%r14), %rax
testq %rbx, %rbx
je 0xb777
movq (%rax), %rdi
callq *%rbx
jmp 0xb79f
cmpb $0x1, 0x18(%rax)
movq (%r15), %rcx
jne 0xb789
leaq 0x2f50(%rip), %rdi      # 0xe6d7
jmp 0xb790
leaq 0x3364(%rip), %rdi      # 0xeaf4
movl $0x3, %esi
movl $0x1, %edx
callq 0x1100
movq (%r15), %rsi
movl $0xa, %edi
callq 0x1090
movq (%r14), %rax
movq 0x8(%rax), %rdi
testq %rdi, %rdi
je 0xb7c9
leaq 0x379a(%rip), %rdx      # 0xef59
xorl %esi, %esi
movq %rbx, %rcx
callq 0xb7dd
movq 0x6808(%rip), %rax      # 0x11fd8
movq (%rax), %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x10e0
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: new_sp_tree
sp_tree *new_sp_tree(int (* comp) (const void *, const void *)) {

    // Sanity check:
    assert(comp != NULL);

    // Allocate memory:
    sp_tree *tree = (sp_tree *) malloc(sizeof(sp_tree));
    if (tree == NULL) {
        fprintf(stderr, "ERROR: Unable to allocate memory for sp_tree\n");
    }

    // Initialize the empty tree:
    else {
        tree->root = NULL;
        tree->comp = comp;
    }

    return tree;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xb9ad
movq %rdi, %rbx
movl $0x10, %edi
callq 0x10d0
movq %rax, %r14
testq %rax, %rax
je 0xb9a6
movq $0x0, (%r14)
movq %rbx, 0x8(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x1440
jmp 0xb99b
leaq 0x284c(%rip), %rdi      # 0xe200
leaq 0x2852(%rip), %rsi      # 0xe20d
leaq 0x3136(%rip), %rcx      # 0xeaf8
movl $0x121f, %edx           # imm = 0x121F
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: sp_tree_copy
sp_tree *sp_tree_copy(sp_tree *tree) {

    sp_tree *new_tree;
    void    *data;
    
    // Sanity check:
    assert(tree != NULL);
    
    // Create a new tree:
    new_tree = new_sp_tree(tree->comp);
    if (tree == NULL) { return NULL; }

    // Get the smallest element of tree:
    data = sp_tree_min(tree);

    // Insert all data from tree into new_tree:
    while (data != NULL) {

        // insert data in new_tree:
        sp_tree_insert_max(new_tree, data);

        // advance data:
        data = sp_tree_next(tree, data);
    }

    // Return the resulting tree:
    return new_tree;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0xba1c
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0xb972
movq %rax, %r14
movq %rbx, %rdi
callq 0xba3b
testq %rax, %rax
je 0xba13
movq %rax, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0xbac9
movq %rbx, %rdi
movq %r15, %rsi
callq 0xbbdf
movq %rax, %r15
testq %rax, %rax
jne 0xb9f5
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x2860(%rip), %rdi      # 0xe283
leaq 0x27e3(%rip), %rsi      # 0xe20d
leaq 0x312f(%rip), %rcx      # 0xeb60
movl $0x123b, %edx           # imm = 0x123B
callq 0x1080