LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/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 0x7901
movq (%rdi), %rax
testq %rax, %rax
je 0x78fd
movq %rax, %rcx
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0x78ec
movq (%rcx), %rax
jmp 0x78ff
xorl %eax, %eax
popq %rcx
retq
leaq 0x597b(%rip), %rdi      # 0xd283
leaq 0x58fe(%rip), %rsi      # 0xd20d
leaq 0x5aab(%rip), %rcx      # 0xd3c1
movl $0x191, %edx            # imm = 0x191
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/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 0x7943
movq (%rdi), %rax
testq %rax, %rax
je 0x793f
movq %rax, %rcx
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x792e
movq (%rcx), %rax
jmp 0x7941
xorl %eax, %eax
popq %rcx
retq
leaq 0x5939(%rip), %rdi      # 0xd283
leaq 0x58bc(%rip), %rsi      # 0xd20d
leaq 0x5a8c(%rip), %rcx      # 0xd3e4
movl $0x1a6, %edx            # imm = 0x1A6
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x79f0
movq %rsi, %rbx
testq %rsi, %rsi
je 0x7a0f
movq %rdi, %r14
xorl %r15d, %r15d
pushq $0x8
popq %r12
pushq $0x10
popq %rbp
movq %rdi, %r13
movq (%r13), %r13
testq %r13, %r13
je 0x79d5
movq (%r13), %rsi
movq %rbx, %rdi
callq *0x8(%r14)
testl %eax, %eax
js 0x79b0
movq %rbp, %rax
movq %r13, %rcx
jne 0x79b6
jmp 0x79be
movq %r12, %rax
movq %r15, %rcx
addq %rax, %r13
movq %rcx, %r15
jmp 0x798e
movq 0x8(%r13), %rax
testq %rax, %rax
je 0x79d5
movq %rax, %r15
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x79c7
jmp 0x79da
testq %r15, %r15
je 0x79df
movq (%r15), %rax
jmp 0x79e1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x588c(%rip), %rdi      # 0xd283
leaq 0x580f(%rip), %rsi      # 0xd20d
leaq 0x5a02(%rip), %rcx      # 0xd407
movl $0x1bf, %edx            # imm = 0x1BF
callq 0x1080
leaq 0x58ec(%rip), %rdi      # 0xd302
leaq 0x57f0(%rip), %rsi      # 0xd20d
leaq 0x59e3(%rip), %rcx      # 0xd407
movl $0x1c0, %edx            # imm = 0x1C0
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x7aba
movq %rsi, %rbx
testq %rsi, %rsi
je 0x7ad9
movq %rdi, %r14
xorl %r15d, %r15d
pushq $0x8
popq %r12
pushq $0x10
popq %rbp
movq %rdi, %r13
movq (%r13), %r13
testq %r13, %r13
je 0x7a9f
movq (%r13), %rsi
movq %rbx, %rdi
callq *0x8(%r14)
movq %r12, %rcx
movq %r13, %rdx
testl %eax, %eax
js 0x7a80
je 0x7a88
movq %rbp, %rcx
movq %r15, %rdx
addq %rcx, %r13
movq %rdx, %r15
jmp 0x7a5a
movq 0x10(%r13), %rax
testq %rax, %rax
je 0x7a9f
movq %rax, %r15
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0x7a91
jmp 0x7aa4
testq %r15, %r15
je 0x7aa9
movq (%r15), %rax
jmp 0x7aab
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x57c2(%rip), %rdi      # 0xd283
leaq 0x5745(%rip), %rsi      # 0xd20d
leaq 0x596a(%rip), %rcx      # 0xd439
movl $0x1ec, %edx            # imm = 0x1EC
callq 0x1080
leaq 0x5822(%rip), %rdi      # 0xd302
leaq 0x5726(%rip), %rsi      # 0xd20d
leaq 0x594b(%rip), %rcx      # 0xd439
movl $0x1ed, %edx            # imm = 0x1ED
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/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 0x7c5c
movq (%rdi), %rcx
testq %rcx, %rcx
je 0x7c55
xorl %eax, %eax
movq %rax, %rdx
movq %rcx, %rax
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
jne 0x7c27
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 0x7c57
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
retq
leaq 0x5620(%rip), %rdi      # 0xd283
leaq 0x55a3(%rip), %rsi      # 0xd20d
leaq 0x5828(%rip), %rcx      # 0xd499
movl $0x277, %edx            # imm = 0x277
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/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 0x7cc0
movq (%rdi), %rcx
testq %rcx, %rcx
je 0x7cb9
xorl %eax, %eax
movq %rax, %rdx
movq %rcx, %rax
movq 0x10(%rcx), %rcx
testq %rcx, %rcx
jne 0x7c8b
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 0x7cbb
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
retq
leaq 0x55bc(%rip), %rdi      # 0xd283
leaq 0x553f(%rip), %rsi      # 0xd20d
leaq 0x57e8(%rip), %rcx      # 0xd4bd
movl $0x29b, %edx            # imm = 0x29B
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/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 0x7d33
movq %rsi, %rbx
movq (%rdi), %r14
andq $0x0, (%rdi)
testq %r14, %r14
je 0x7d2d
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x7d12
movq 0x10(%rax), %rcx
movq %r14, 0x10(%rax)
movq %rcx, 0x8(%r14)
movq %rax, %r14
jmp 0x7cf3
movq 0x10(%r14), %r15
testq %rbx, %rbx
je 0x7d20
movq (%r14), %rdi
callq *%rbx
movq %r14, %rdi
callq 0x1120
movq %r15, %r14
jmp 0x7cf3
popq %rbx
popq %r14
popq %r15
retq
leaq 0x5549(%rip), %rdi      # 0xd283
leaq 0x54cc(%rip), %rsi      # 0xd20d
leaq 0x5799(%rip), %rcx      # 0xd4e1
movl $0x2cc, %edx            # imm = 0x2CC
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/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 0x8d6e
cmpq $0x0, 0x8(%rdi)
je 0x8d83
movq (%rdi), %rsi
testq %rsi, %rsi
je 0x8d69
xorl %edx, %edx
xorl %ecx, %ecx
popq %rax
jmp 0x8da3
pushq $0x1
popq %rax
jmp 0x8da1
movq 0x8283(%rip), %rax      # 0x10ff8
movq (%rax), %rcx
leaq 0x490d(%rip), %rdi      # 0xd68c
pushq $0x1f
jmp 0x8d96
movq 0x826e(%rip), %rax      # 0x10ff8
movq (%rax), %rcx
leaq 0x4918(%rip), %rdi      # 0xd6ac
pushq $0x2a
popq %rsi
pushq $0x1
popq %rdx
callq 0x1100
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x8dca
movq (%r15), %rsi
movq %r12, %rdi
callq *0x8(%r14)
testl %eax, %eax
jns 0x8e18
testq %rbx, %rbx
je 0x8ddd
movq (%r15), %rdi
movq %rbx, %rsi
callq *0x8(%r14)
testl %eax, %eax
jns 0x8e18
movq 0x8(%r15), %rsi
testq %rsi, %rsi
je 0x8df8
movq (%r15), %rcx
movq %r14, %rdi
movq %r12, %rdx
callq 0x8da3
testl %eax, %eax
je 0x8e34
movq 0x10(%r15), %rsi
testq %rsi, %rsi
je 0x8e13
movq (%r15), %rdx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x8da3
testl %eax, %eax
je 0x8e34
pushq $0x1
popq %rax
jmp 0x8e36
movq 0x81d9(%rip), %rax      # 0x10ff8
movq (%rax), %rcx
leaq 0x5094(%rip), %rdi      # 0xdebd
pushq $0x30
popq %rsi
pushq $0x1
popq %rdx
callq 0x1100
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x8ee5
movq %rdi, %r14
movq (%rdi), %rax
testq %rax, %rax
je 0x8ee5
movq %rsi, %rbx
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0x8e7d
leaq 0x50e7(%rip), %rdx      # 0xdf59
pushq $0x1
popq %rsi
movq %rbx, %rcx
callq 0x8ef9
movq 0x8154(%rip), %r15      # 0x10fd8
movq (%r15), %rcx
leaq 0x50db(%rip), %rdi      # 0xdf69
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
callq 0x1100
testq %rbx, %rbx
je 0x8ea8
movq (%r14), %rax
movq (%rax), %rdi
callq *%rbx
jmp 0x8ebd
movq (%r15), %rcx
leaq 0x4825(%rip), %rdi      # 0xd6d7
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
callq 0x1100
movq (%r15), %rsi
pushq $0xa
popq %rdi
callq 0x1090
movq (%r14), %rax
movq 0x8(%rax), %rdi
testq %rdi, %rdi
je 0x8ee5
leaq 0x507e(%rip), %rdx      # 0xdf59
xorl %esi, %esi
movq %rbx, %rcx
callq 0x8ef9
movq 0x80ec(%rip), %rax      # 0x10fd8
movq (%rax), %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x10e0
// File: /workspace/github_c_makefile_star2_O2/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 0x9018
movq %rax, %r15
cmpq $0x0, 0x10(%r14)
je 0x8f6e
cmpl $0x1, %ebp
leaq 0x501b(%rip), %rax      # 0xdf58
leaq 0x501b(%rip), %rcx      # 0xdf5f
cmoveq %rax, %rcx
leaq 0x5004(%rip), %rsi      # 0xdf53
movq %r15, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x10f0
movq 0x10(%r14), %rdi
pushq $0x1
popq %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x8ef9
testl %ebp, %ebp
movq 0x8061(%rip), %r13      # 0x10fd8
movq (%r13), %rdi
leaq 0x4fec(%rip), %rax      # 0xdf6e
leaq 0x4fdd(%rip), %rsi      # 0xdf66
cmoveq %rax, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x10b0
testq %rbx, %rbx
je 0x8fa3
movq (%r14), %rdi
callq *%rbx
jmp 0x8fb9
movq (%r13), %rcx
leaq 0x4729(%rip), %rdi      # 0xd6d7
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
callq 0x1100
pushq $0xa
popq %rdi
callq 0x1030
cmpq $0x0, 0x8(%r14)
je 0x9002
cmpl $0x1, %ebp
leaq 0x4f8d(%rip), %rax      # 0xdf5f
leaq 0x4f7f(%rip), %rcx      # 0xdf58
cmoveq %rax, %rcx
leaq 0x4f6f(%rip), %rsi      # 0xdf53
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 0x8ef9
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1120
leaq 0x4ecf(%rip), %rdi      # 0xdeee
leaq 0x41e7(%rip), %rsi      # 0xd20d
leaq 0x4ed4(%rip), %rcx      # 0xdf01
movl $0x83a, %edx            # imm = 0x83A
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/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 0x9084
movq %rdi, %r14
pushq $0x10
popq %rdi
callq 0x10d0
movq %rax, %rbx
testq %rax, %rax
je 0x9066
andq $0x0, (%rbx)
movq %r14, 0x8(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x7f8b(%rip), %rax      # 0x10ff8
movq (%rax), %rcx
leaq 0x469e(%rip), %rdi      # 0xd715
pushq $0x2d
popq %rsi
pushq $0x1
popq %rdx
callq 0x1100
jmp 0x905b
leaq 0x4175(%rip), %rdi      # 0xd200
leaq 0x417b(%rip), %rsi      # 0xd20d
leaq 0x4642(%rip), %rcx      # 0xd6db
movl $0x8aa, %edx            # imm = 0x8AA
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/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 0x9153
movq %rdi, %r14
movq 0x8(%rdi), %rdi
callq 0x9037
movq %rax, %rbx
testq %rax, %rax
je 0x9148
movq (%r14), %r14
testq %r14, %r14
jne 0x90eb
xorl %r14d, %r14d
jmp 0x9143
movq %rax, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
testq %rdx, %rdx
jne 0x90d8
movq %r14, 0x10(%rcx)
movq %rax, %r14
movq 0x8(%r14), %rax
testq %rax, %rax
jne 0x90d5
jmp 0x9143
movq (%r14), %rsi
movq %rbx, %rdi
callq 0x9172
movq 0x10(%r14), %rax
movl $0x0, %r14d
testq %rax, %rax
je 0x9143
movq 0x8(%rax), %rcx
testq %rcx, %rcx
je 0x9140
movq %rcx, %rsi
movq %rsi, %rdx
movq 0x10(%rsi), %rsi
testq %rsi, %rsi
je 0x912d
cmpq %rax, %rsi
jne 0x911c
testq %rsi, %rsi
jne 0x913b
movq %rax, 0x10(%rdx)
movq %rcx, %rax
jmp 0x9110
andq $0x0, 0x10(%rdx)
movq %rax, %r14
testq %r14, %r14
jne 0x90f6
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x4129(%rip), %rdi      # 0xd283
leaq 0x40ac(%rip), %rsi      # 0xd20d
leaq 0x45db(%rip), %rcx      # 0xd743
movl $0x8c7, %edx            # imm = 0x8C7
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/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 0x9829
movq (%rdi), %rax
testq %rax, %rax
je 0x9825
movq %rax, %rcx
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0x9814
movq (%rcx), %rax
jmp 0x9827
xorl %eax, %eax
popq %rcx
retq
leaq 0x3a53(%rip), %rdi      # 0xd283
leaq 0x39d6(%rip), %rsi      # 0xd20d
leaq 0x4029(%rip), %rcx      # 0xd867
movl $0xa77, %edx            # imm = 0xA77
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/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 0x986b
movq (%rdi), %rax
testq %rax, %rax
je 0x9867
movq %rax, %rcx
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x9856
movq (%rcx), %rax
jmp 0x9869
xorl %eax, %eax
popq %rcx
retq
leaq 0x3a11(%rip), %rdi      # 0xd283
leaq 0x3994(%rip), %rsi      # 0xd20d
leaq 0x400a(%rip), %rcx      # 0xd88a
movl $0xa8c, %edx            # imm = 0xA8C
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x9918
movq %rsi, %rbx
testq %rsi, %rsi
je 0x9937
movq %rdi, %r14
xorl %r15d, %r15d
pushq $0x8
popq %r12
pushq $0x10
popq %rbp
movq %rdi, %r13
movq (%r13), %r13
testq %r13, %r13
je 0x98fd
movq (%r13), %rsi
movq %rbx, %rdi
callq *0x8(%r14)
testl %eax, %eax
js 0x98d8
movq %rbp, %rax
movq %r13, %rcx
jne 0x98de
jmp 0x98e6
movq %r12, %rax
movq %r15, %rcx
addq %rax, %r13
movq %rcx, %r15
jmp 0x98b6
movq 0x8(%r13), %rax
testq %rax, %rax
je 0x98fd
movq %rax, %r15
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x98ef
jmp 0x9902
testq %r15, %r15
je 0x9907
movq (%r15), %rax
jmp 0x9909
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3964(%rip), %rdi      # 0xd283
leaq 0x38e7(%rip), %rsi      # 0xd20d
leaq 0x3f80(%rip), %rcx      # 0xd8ad
movl $0xaa5, %edx            # imm = 0xAA5
callq 0x1080
leaq 0x39c4(%rip), %rdi      # 0xd302
leaq 0x38c8(%rip), %rsi      # 0xd20d
leaq 0x3f61(%rip), %rcx      # 0xd8ad
movl $0xaa6, %edx            # imm = 0xAA6
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x99e2
movq %rsi, %rbx
testq %rsi, %rsi
je 0x9a01
movq %rdi, %r14
xorl %r15d, %r15d
pushq $0x8
popq %r12
pushq $0x10
popq %rbp
movq %rdi, %r13
movq (%r13), %r13
testq %r13, %r13
je 0x99c7
movq (%r13), %rsi
movq %rbx, %rdi
callq *0x8(%r14)
movq %r12, %rcx
movq %r13, %rdx
testl %eax, %eax
js 0x99a8
je 0x99b0
movq %rbp, %rcx
movq %r15, %rdx
addq %rcx, %r13
movq %rdx, %r15
jmp 0x9982
movq 0x10(%r13), %rax
testq %rax, %rax
je 0x99c7
movq %rax, %r15
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0x99b9
jmp 0x99cc
testq %r15, %r15
je 0x99d1
movq (%r15), %rax
jmp 0x99d3
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x389a(%rip), %rdi      # 0xd283
leaq 0x381d(%rip), %rsi      # 0xd20d
leaq 0x3ee8(%rip), %rcx      # 0xd8df
movl $0xad2, %edx            # imm = 0xAD2
callq 0x1080
leaq 0x38fa(%rip), %rdi      # 0xd302
leaq 0x37fe(%rip), %rsi      # 0xd20d
leaq 0x3ec9(%rip), %rcx      # 0xd8df
movl $0xad3, %edx            # imm = 0xAD3
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/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 0xa203
movq %rsi, %rbx
movq (%rdi), %r14
andq $0x0, (%rdi)
testq %r14, %r14
je 0xa1fd
movq 0x8(%r14), %rax
testq %rax, %rax
je 0xa1e2
movq 0x10(%rax), %rcx
movq %r14, 0x10(%rax)
movq %rcx, 0x8(%r14)
movq %rax, %r14
jmp 0xa1c3
movq 0x10(%r14), %r15
testq %rbx, %rbx
je 0xa1f0
movq (%r14), %rdi
callq *%rbx
movq %r14, %rdi
callq 0x1120
movq %r15, %r14
jmp 0xa1c3
popq %rbx
popq %r14
popq %r15
retq
leaq 0x3079(%rip), %rdi      # 0xd283
leaq 0x2ffc(%rip), %rsi      # 0xd20d
leaq 0x376f(%rip), %rcx      # 0xd987
movl $0xd26, %edx            # imm = 0xD26
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/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 0xada0
cmpq $0x0, 0x8(%rdi)
je 0xadb5
movq (%rdi), %rsi
testq %rsi, %rsi
je 0xad9b
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xadd5
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
setne %al
jmp 0xadd3
pushq $0x1
popq %rax
jmp 0xadd3
movq 0x6251(%rip), %rax      # 0x10ff8
movq (%rax), %rcx
leaq 0x2cf8(%rip), %rdi      # 0xdaa9
pushq $0x1f
jmp 0xadc8
movq 0x623c(%rip), %rax      # 0x10ff8
movq (%rax), %rcx
leaq 0x2d03(%rip), %rdi      # 0xdac9
pushq $0x2a
popq %rsi
pushq $0x1
popq %rdx
callq 0x1100
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/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 0xafa9
movq %rdi, %r14
movq (%rdi), %rax
testq %rax, %rax
je 0xafa9
movq %rsi, %rbx
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0xaf23
leaq 0x3044(%rip), %rdx      # 0xdf59
pushq $0x1
popq %rsi
movq %rbx, %rcx
callq 0xafbd
movq (%r14), %rax
cmpb $0x1, 0x18(%rax)
movq 0x60aa(%rip), %r15      # 0x10fd8
movq (%r15), %rcx
leaq 0x311f(%rip), %rax      # 0xe057
leaq 0x302a(%rip), %rdi      # 0xdf69
cmoveq %rax, %rdi
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
callq 0x1100
movq (%r14), %rax
testq %rbx, %rbx
je 0xaf5d
movq (%rax), %rdi
callq *%rbx
jmp 0xaf81
cmpb $0x1, 0x18(%rax)
movq (%r15), %rcx
jne 0xaf6f
leaq 0x276a(%rip), %rdi      # 0xd6d7
jmp 0xaf76
leaq 0x2b7e(%rip), %rdi      # 0xdaf4
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
callq 0x1100
movq (%r15), %rsi
pushq $0xa
popq %rdi
callq 0x1090
movq (%r14), %rax
movq 0x8(%rax), %rdi
testq %rdi, %rdi
je 0xafa9
leaq 0x2fba(%rip), %rdx      # 0xdf59
xorl %esi, %esi
movq %rbx, %rcx
callq 0xafbd
movq 0x6028(%rip), %rax      # 0x10fd8
movq (%rax), %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x10e0
// File: /workspace/github_c_makefile_star2_O2/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 0xb197
movq %rdi, %r14
pushq $0x10
popq %rdi
callq 0x10d0
movq %rax, %rbx
testq %rax, %rax
je 0xb179
andq $0x0, (%rbx)
movq %r14, 0x8(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x5e78(%rip), %rax      # 0x10ff8
movq (%rax), %rcx
leaq 0x29a8(%rip), %rdi      # 0xdb32
pushq $0x2d
popq %rsi
pushq $0x1
popq %rdx
callq 0x1100
jmp 0xb16e
leaq 0x2062(%rip), %rdi      # 0xd200
leaq 0x2068(%rip), %rsi      # 0xd20d
leaq 0x294c(%rip), %rcx      # 0xdaf8
movl $0x121f, %edx           # imm = 0x121F
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/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 0xb200
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0xb14a
movq %rax, %r14
movq %rbx, %rdi
callq 0xb21f
movq %rax, %r15
testq %rax, %rax
je 0xb1f7
movq %r14, %rdi
movq %r15, %rsi
callq 0xb261
movq %rbx, %rdi
movq %r15, %rsi
callq 0xb322
jmp 0xb1d7
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x207c(%rip), %rdi      # 0xd283
leaq 0x1fff(%rip), %rsi      # 0xd20d
leaq 0x294b(%rip), %rcx      # 0xdb60
movl $0x123b, %edx           # imm = 0x123B
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: sp_tree_min
void *sp_tree_min(sp_tree *tree) {

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

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

    // General case: Move the smallest element to the root
    splay_left(tree);

    // And return a pointer to its data:
    return tree->root->data;
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0xb242
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0xb23e
movq %rbx, %rdi
callq 0xb6bc
movq (%rbx), %rax
movq (%rax), %rax
jmp 0xb240
xorl %eax, %eax
popq %rbx
retq
leaq 0x203a(%rip), %rdi      # 0xd283
leaq 0x1fbd(%rip), %rsi      # 0xd20d
leaq 0x2a21(%rip), %rcx      # 0xdc78
movl $0x1322, %edx           # imm = 0x1322
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: sp_tree_insert_max
void *sp_tree_insert_max(sp_tree *tree, void *data) {

    sp_node *old_root;
    void    *old_data;
    int      comp = 1;
    
    // Sanity Checks:
    assert(tree != NULL);
    assert(data != NULL);

    // General case: Splay data to the root
    splay_right(tree);
    old_root = tree->root;

    // Compare the current root with data:
    if (old_root != NULL) { comp = (tree->comp)(data, old_root->data); }

    // If data is in the tree: overwrite it!
    if (comp == 0) {
        old_data = tree->root->data;
        tree->root->data = data;
        return old_data;
    }

    // Otherwise insert a new node as a root and link the previous root to it:
    tree->root = (sp_node *) malloc(sizeof(sp_node));
    if (tree->root == NULL) {
        fprintf(stderr, "ERROR: Unable to allocate sp_node\n");
        tree->root = old_root;
    } else {
        tree->root->data  = data;
        tree->root->left  = old_root;
        tree->root->right = NULL;
    }

    // Data was not here!
    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0xb2e4
movq %rsi, %r14
testq %rsi, %rsi
je 0xb303
movq %rdi, %rbx
callq 0xb717
movq (%rbx), %r15
testq %r15, %r15
je 0xb294
movq (%r15), %rsi
movq %r14, %rdi
callq *0x8(%rbx)
testl %eax, %eax
je 0xb2b4
pushq $0x18
popq %rdi
callq 0x10d0
movq %rax, (%rbx)
testq %rax, %rax
je 0xb2c3
movq %r14, (%rax)
movq %r15, 0x8(%rax)
andq $0x0, 0x10(%rax)
xorl %eax, %eax
jmp 0xb2bd
movq (%rbx), %rcx
movq (%rcx), %rax
movq %r14, (%rcx)
popq %rbx
popq %r14
popq %r15
retq
movq 0x5d2e(%rip), %rax      # 0x10ff8
movq (%rax), %rcx
leaq 0x28d5(%rip), %rdi      # 0xdba9
pushq $0x22
popq %rsi
pushq $0x1
popq %rdx
callq 0x1100
movq %r15, (%rbx)
jmp 0xb2b0
leaq 0x1f98(%rip), %rdi      # 0xd283
leaq 0x1f1b(%rip), %rsi      # 0xd20d
leaq 0x28ff(%rip), %rcx      # 0xdbf8
movl $0x12d7, %edx           # imm = 0x12D7
callq 0x1080
leaq 0x1ff8(%rip), %rdi      # 0xd302
leaq 0x1efc(%rip), %rsi      # 0xd20d
leaq 0x28e0(%rip), %rcx      # 0xdbf8
movl $0x12d8, %edx           # imm = 0x12D8
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: sp_tree_next
void *sp_tree_next(sp_tree *tree, const void *data) {

    sp_node *old_root;
    int      comp;

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

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

    // Trivial case: null data == return minimum
    if (data == NULL) {
        splay_left(tree);
        return tree->root->data;
    }

    // General case: Splay data to the root
    splay(tree, data);

    // Take a look at the current root:
    comp = (tree->comp)(tree->root->data, data);

    // If its smaller or equal we must find the successor in the right subtree:
    if (comp <= 0) {
        if (tree->root->right == NULL) { return NULL; }
        else {
            old_root   = tree->root;
            tree->root = tree->root->right;
            old_root->right = NULL;
            splay_left(tree);
            tree->root->left = old_root;
        }
    }

    // Predecessor is at root now:
    return tree->root->data;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xb38c
movq %rsi, %r14
testq %rsi, %rsi
je 0xb3ab
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0xb382
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb500
movq (%rbx), %rax
movq (%rax), %rdi
movq %r14, %rsi
callq *0x8(%rbx)
movq (%rbx), %r14
testl %eax, %eax
jg 0xb37d
movq 0x10(%r14), %rax
testq %rax, %rax
je 0xb382
movq %rax, (%rbx)
andq $0x0, 0x10(%r14)
movq %rbx, %rdi
callq 0xb6bc
movq (%rbx), %rax
movq %r14, 0x8(%rax)
movq %rax, %r14
movq (%r14), %rax
jmp 0xb384
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x1ef0(%rip), %rdi      # 0xd283
leaq 0x1e73(%rip), %rsi      # 0xd20d
leaq 0x293d(%rip), %rcx      # 0xdcde
movl $0x1378, %edx           # imm = 0x1378
callq 0x1080
leaq 0x1f50(%rip), %rdi      # 0xd302
leaq 0x1e54(%rip), %rsi      # 0xd20d
leaq 0x291e(%rip), %rcx      # 0xdcde
movl $0x1379, %edx           # imm = 0x1379
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: sp_tree_search
void *sp_tree_search(sp_tree *tree, const void *data) {

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

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

    // General case: Splay data to the root
    splay(tree, data);

    // If data is in the tree return a pointer to it:
    if ((tree->comp)(data, tree->root->data) == 0) { return tree->root->data; }

    // Not found:
    return NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xb7e8
movq %rsi, %r14
testq %rsi, %rsi
je 0xb807
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0xb7d6
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb500
movq (%rbx), %rax
movq (%rax), %rsi
movq %r14, %rdi
callq *0x8(%rbx)
testl %eax, %eax
je 0xb7da
xorl %eax, %eax
jmp 0xb7e0
movq (%rbx), %rax
movq (%rax), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x1a94(%rip), %rdi      # 0xd283
leaq 0x1a17(%rip), %rsi      # 0xd20d
leaq 0x244d(%rip), %rcx      # 0xdc4a
movl $0x130c, %edx           # imm = 0x130C
callq 0x1080
leaq 0x1af4(%rip), %rdi      # 0xd302
leaq 0x19f8(%rip), %rsi      # 0xd20d
leaq 0x242e(%rip), %rcx      # 0xdc4a
movl $0x130d, %edx           # imm = 0x130D
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: sp_tree_max
void *sp_tree_max(sp_tree *tree) {

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

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

    // General case: Move the biggest element to the root
    splay_right(tree);

    // And return a pointer to its data:
    return tree->root->data;
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0xb849
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0xb845
movq %rbx, %rdi
callq 0xb717
movq (%rbx), %rax
movq (%rax), %rax
jmp 0xb847
xorl %eax, %eax
popq %rbx
retq
leaq 0x1a33(%rip), %rdi      # 0xd283
leaq 0x19b6(%rip), %rsi      # 0xd20d
leaq 0x2437(%rip), %rcx      # 0xdc95
movl $0x1334, %edx           # imm = 0x1334
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: sp_tree_prev
void *sp_tree_prev(sp_tree *tree, const void *data) {

    sp_node *old_root;
    int      comp;

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

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

    // Trivial case: null data == return maximum
    if (data == NULL) {
        splay_right(tree);
        return tree->root->data;
    }

    // General case: Splay data to the root
    splay(tree, data);

    // Take a look at the current root:
    comp = (tree->comp)(tree->root->data, data);

    // If its bigger or equal we must find the predecessor in the left subtree:    
    if (comp >= 0) {
        if (tree->root->left == NULL) { return NULL; }
        else {
            old_root   = tree->root;
            tree->root = tree->root->left;
            old_root->left = NULL;
            splay_right(tree);
            tree->root->right = old_root;
        }
    }

    // Predecessor is at root now:
    return tree->root->data;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xb8d2
movq %rsi, %r14
testq %rsi, %rsi
je 0xb8f1
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0xb8c8
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb500
movq (%rbx), %rax
movq (%rax), %rdi
movq %r14, %rsi
callq *0x8(%rbx)
movq (%rbx), %r14
testl %eax, %eax
js 0xb8c3
movq 0x8(%r14), %rax
testq %rax, %rax
je 0xb8c8
movq %rax, (%rbx)
andq $0x0, 0x8(%r14)
movq %rbx, %rdi
callq 0xb717
movq (%rbx), %rax
movq %r14, 0x10(%rax)
movq %rax, %r14
movq (%r14), %rax
jmp 0xb8ca
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x19aa(%rip), %rdi      # 0xd283
leaq 0x192d(%rip), %rsi      # 0xd20d
leaq 0x23cb(%rip), %rcx      # 0xdcb2
movl $0x134b, %edx           # imm = 0x134B
callq 0x1080
leaq 0x1a0a(%rip), %rdi      # 0xd302
leaq 0x190e(%rip), %rsi      # 0xd20d
leaq 0x23ac(%rip), %rcx      # 0xdcb2
movl $0x134c, %edx           # imm = 0x134C
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: sp_tree_remove
void *sp_tree_remove(sp_tree *tree, const void *data) {

    sp_node *old_root;
    void    *old_data = NULL;

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

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

        // Splay the data to the root:
        splay(tree, data);

        // If it is here: remove it!
        if ((tree->comp)(tree->root->data, data) == 0) {
            old_root = tree->root;
            old_data = tree->root->data;
            if (tree->root->right == NULL) { tree->root = tree->root->left; }
            else {
                tree->root = tree->root->right;
                splay_left(tree);
                tree->root->left = old_root->left;
            }
            free(old_root);
        }
    }

    // Return
    return old_data;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0xb98e
movq %rsi, %r14
testq %rsi, %rsi
je 0xb9ad
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0xb94a
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb500
movq (%rbx), %rax
movq (%rax), %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testl %eax, %eax
je 0xb94f
xorl %r14d, %r14d
jmp 0xb985
movq (%rbx), %r15
movq (%r15), %r14
movq 0x10(%r15), %rax
testq %rax, %rax
je 0xb976
movq %rax, (%rbx)
movq %rbx, %rdi
callq 0xb6bc
movq 0x8(%r15), %rax
movq (%rbx), %rcx
movq %rax, 0x8(%rcx)
jmp 0xb97d
movq 0x8(%r15), %rax
movq %rax, (%rbx)
movq %r15, %rdi
callq 0x1120
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x18ee(%rip), %rdi      # 0xd283
leaq 0x1871(%rip), %rsi      # 0xd20d
leaq 0x2367(%rip), %rcx      # 0xdd0a
movl $0x13a8, %edx           # imm = 0x13A8
callq 0x1080
leaq 0x194e(%rip), %rdi      # 0xd302
leaq 0x1852(%rip), %rsi      # 0xd20d
leaq 0x2348(%rip), %rcx      # 0xdd0a
movl $0x13a9, %edx           # imm = 0x13A9
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: sp_tree_remove_min
void *sp_tree_remove_min(sp_tree *tree) {

    sp_node *old_root;
    void    *old_data;

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

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

        // Splay the smallest node to the root:
        splay_left(tree);

        // Remove it!
        old_root   = tree->root;
        old_data   = tree->root->data;
        tree->root = tree->root->right;
        free(old_root);
    }

    // Return
    return old_data;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xba08
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0xb9fa
movq %rbx, %rdi
callq 0xb6bc
movq (%rbx), %rdi
movq (%rdi), %r14
movq 0x10(%rdi), %rax
movq %rax, (%rbx)
callq 0x1120
jmp 0xb9fd
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x1874(%rip), %rdi      # 0xd283
leaq 0x17f7(%rip), %rsi      # 0xd20d
leaq 0x231b(%rip), %rcx      # 0xdd38
movl $0x13cc, %edx           # imm = 0x13CC
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: sp_tree_remove_max
void *sp_tree_remove_max(sp_tree *tree) {

    sp_node *old_root;
    void    *old_data;

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

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

        // Splay the biggest node to the root:
        splay_right(tree);

        // Remove it!
        old_root   = tree->root;
        old_data   = tree->root->data;
        tree->root = tree->root->left;
        free(old_root);
    }

    // Return
    return old_data;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xba63
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0xba55
movq %rbx, %rdi
callq 0xb717
movq (%rbx), %rdi
movq (%rdi), %r14
movq 0x8(%rdi), %rax
movq %rax, (%rbx)
callq 0x1120
jmp 0xba58
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x1819(%rip), %rdi      # 0xd283
leaq 0x179c(%rip), %rsi      # 0xd20d
leaq 0x22e4(%rip), %rcx      # 0xdd5c
movl $0x13e9, %edx           # imm = 0x13E9
callq 0x1080