// File: /workspace/github_cpp_makefile_star2_O1/DRSY[P]MyRBTree/main.cpp
// Function: RBTree::remove_atleastonenull(Node*)
void remove_atleastonenull(NodePtr_t node_to_remove) {
        // red leaf node
        if(isred(node_to_remove) && isleaf(node_to_remove)) {
            auto father = node_to_remove->father;
            if(node_to_remove==father->left)
                father->left = NULL;
            else
                father->right = NULL;
        }
        // black leaf node
        else if(isblack(node_to_remove) && isleaf(node_to_remove)) {
            if(node_to_remove==this->root) {delete node_to_remove; this->root=NULL;return;}
            assert(node_to_remove->father!=NULL);
            NodePtr_t father = node_to_remove->father;
            NodePtr_t brother = NULL;
            if(node_to_remove==father->left) {
                father->left = NULL;
                brother = father->right;
            }else {
                father->right = NULL;
                brother = father->left;
            }
            delete node_to_remove;
            assert(brother!=NULL);
            if(brother->color==Color::black) {
                black_black(father, brother);
            }else if(brother==father->right) {
                brother->color = Color::black;
                father->color = Color::red;
                rotate_left(father, brother);
                black_black(father, father->right);
            }
            else{
                brother->color = Color::black;
                father->color = Color::red;
                rotate_right(brother, father);
                black_black(father, father->left);
            }
        }
        // black node with one red leaf node
        else {
            assert(node_to_remove->color==Color::black);
            NodePtr_t child = (node_to_remove->left)?node_to_remove->left:node_to_remove->right;
            assert(isred(child));
            node_to_remove->value = child->value;
            if(child==node_to_remove->left)  node_to_remove->left=NULL;
            else  node_to_remove->right=NULL;
            delete child;
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rax
movq %rdi, %rbx
movl 0x4(%rsi), %ecx
testl %ecx, %ecx
jne 0x2693
cmpq $0x0, 0x10(%rax)
jne 0x2693
cmpq $0x0, 0x18(%rax)
je 0x271c
cmpl $0x1, %ecx
jne 0x2846
cmpq $0x0, 0x10(%rax)
jne 0x26aa
cmpq $0x0, 0x18(%rax)
je 0x26f6
cmpl $0x1, %ecx
jne 0x2846
movq 0x10(%rax), %rcx
movq %rcx, %rdi
testq %rcx, %rcx
jne 0x26c3
movq 0x18(%rax), %rdi
cmpl $0x0, 0x4(%rdi)
jne 0x2865
movl (%rdi), %edx
movl %edx, (%rax)
xorl %edx, %edx
cmpq %rcx, %rdi
setne %dl
movq $0x0, 0x10(%rax,%rdx,8)
movl $0x20, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x10e0
cmpq %rax, (%rbx)
je 0x2737
movq 0x8(%rax), %r14
testq %r14, %r14
je 0x2884
cmpq %rax, 0x10(%r14)
je 0x2755
leaq 0x10(%r14), %rcx
movq $0x0, 0x18(%r14)
jmp 0x2761
movq 0x8(%rax), %rcx
cmpq %rax, 0x10(%rcx)
je 0x27d5
movq $0x0, 0x18(%rcx)
jmp 0x27dd
testq %rax, %rax
je 0x2749
movl $0x20, %esi
movq %rax, %rdi
callq 0x10e0
movq $0x0, (%rbx)
jmp 0x27dd
movq $0x0, 0x10(%r14)
leaq 0x18(%r14), %rcx
movq (%rcx), %r15
testq %rax, %rax
je 0x2776
movl $0x20, %esi
movq %rax, %rdi
callq 0x10e0
testq %r15, %r15
je 0x28a3
cmpl $0x1, 0x4(%r15)
jne 0x2794
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
jmp 0x2837
cmpq 0x18(%r14), %r15
movl $0x1, 0x4(%r15)
movl $0x0, 0x4(%r14)
movq 0x8(%r14), %rax
je 0x27e8
movq 0x18(%r15), %rcx
movq %rcx, 0x10(%r14)
movq %r14, 0x18(%r15)
movq %r15, 0x8(%r14)
testq %rax, %rax
je 0x280f
leaq 0x10(%rax), %rdx
leaq 0x18(%rax), %rcx
cmpq %r14, 0x10(%rax)
cmoveq %rdx, %rcx
jmp 0x2814
movq $0x0, 0x10(%rcx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r15), %rcx
movq %rcx, 0x18(%r14)
movq %r14, 0x10(%r15)
movq %r15, 0x8(%r14)
testq %rax, %rax
je 0x2821
leaq 0x10(%rax), %rdx
leaq 0x18(%rax), %rcx
cmpq %r14, 0x10(%rax)
cmoveq %rdx, %rcx
jmp 0x2826
xorl %eax, %eax
movq %rbx, %rcx
movq %r15, (%rcx)
movq %rax, 0x8(%r15)
movq 0x10(%r14), %rdx
jmp 0x2831
xorl %eax, %eax
movq %rbx, %rcx
movq %r15, (%rcx)
movq %rax, 0x8(%r15)
movq 0x18(%r14), %rdx
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x28c2
leaq 0x8cb(%rip), %rdi       # 0x3118
leaq 0x87f(%rip), %rsi       # 0x30d3
leaq 0x881(%rip), %rcx       # 0x30dc
movl $0x126, %edx            # imm = 0x126
callq 0x1080
leaq 0x8d0(%rip), %rdi       # 0x313c
leaq 0x860(%rip), %rsi       # 0x30d3
leaq 0x862(%rip), %rcx       # 0x30dc
movl $0x128, %edx            # imm = 0x128
callq 0x1080
leaq 0x82b(%rip), %rdi       # 0x30b6
leaq 0x841(%rip), %rsi       # 0x30d3
leaq 0x843(%rip), %rcx       # 0x30dc
movl $0x109, %edx            # imm = 0x109
callq 0x1080
leaq 0x860(%rip), %rdi       # 0x310a
leaq 0x822(%rip), %rsi       # 0x30d3
leaq 0x824(%rip), %rcx       # 0x30dc
movl $0x114, %edx            # imm = 0x114
callq 0x1080