// File: /workspace/github_c_makefile_star2_O0/CarlosLunaMota[P]BinaryTrees/BinaryTrees.c
// Function: print_sp_subtree
static void print_sp_subtree(const sp_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_sp_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_sp_subtree(node->left, NO, new_indent, print_node);
    }

    // Free memory:
    free(new_indent);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1040
movq %rax, %rdi
shlq $0x0, %rdi
addq $0x6, %rdi
callq 0x10a0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x15e0d
jmp 0x15e2c
leaq 0x10d6(%rip), %rdi      # 0x16eea
leaq 0x3e1(%rip), %rsi       # 0x161fc
movl $0x15c3, %edx           # imm = 0x15C3
leaq 0x12c5(%rip), %rcx      # 0x170ec
callq 0x1060
movq -0x8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x15e93
cmpl $0x1, -0xc(%rbp)
jne 0x15e5c
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x1103(%rip), %rsi      # 0x16f4f
leaq 0x1101(%rip), %rcx      # 0x16f54
movb $0x0, %al
callq 0x10c0
jmp 0x15e79
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x10e4(%rip), %rsi      # 0x16f4f
leaq 0x10e9(%rip), %rcx      # 0x16f5b
movb $0x0, %al
callq 0x10c0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x28(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl $0x1, %esi
callq 0x15dd0
cmpl $0x0, -0xc(%rbp)
je 0x15eb7
movq 0x4138(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
leaq 0x10b4(%rip), %rsi      # 0x16f62
movb $0x0, %al
callq 0x1080
jmp 0x15ed3
movq 0x411a(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
leaq 0x109e(%rip), %rsi      # 0x16f6a
movb $0x0, %al
callq 0x1080
cmpq $0x0, -0x20(%rbp)
jne 0x15ef4
movq 0x40f7(%rip), %rax      # 0x19fd8
movq (%rax), %rdi
leaq 0x7db(%rip), %rsi       # 0x166c6
movb $0x0, %al
callq 0x1080
jmp 0x15f01
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
leaq 0x1c9(%rip), %rdi       # 0x160d1
movb $0x0, %al
callq 0x1050
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x15f73
cmpl $0x1, -0xc(%rbp)
jne 0x15f3f
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x1020(%rip), %rsi      # 0x16f4f
leaq 0x1025(%rip), %rcx      # 0x16f5b
movb $0x0, %al
callq 0x10c0
jmp 0x15f5c
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x1001(%rip), %rsi      # 0x16f4f
leaq 0xfff(%rip), %rcx       # 0x16f54
movb $0x0, %al
callq 0x10c0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x28(%rbp), %rdx
movq -0x20(%rbp), %rcx
xorl %esi, %esi
callq 0x15dd0
movq -0x28(%rbp), %rdi
callq 0x10e0
addq $0x30, %rsp
popq %rbp
retq