// File: /workspace/github_cpp_makefile_star2_O3/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
movl 0x4(%rsi), %ecx
cmpl $0x1, %ecx
je 0x2683
testl %ecx, %ecx
jne 0x27ec
cmpq $0x0, 0x10(%rax)
jne 0x27ec
cmpq $0x0, 0x18(%rax)
jne 0x27ec
movq 0x8(%rax), %rcx
cmpq %rax, 0x10(%rcx)
je 0x26d0
movq $0x0, 0x18(%rcx)
jmp 0x26d8
movq %rdi, %rbx
movq 0x10(%rax), %rcx
movq %rcx, %rdi
testq %rcx, %rcx
jne 0x269d
cmpq $0x0, 0x18(%rax)
je 0x26e3
movq 0x18(%rax), %rdi
cmpl $0x0, 0x4(%rdi)
jne 0x280b
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
movq $0x0, 0x10(%rcx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpq %rax, (%rbx)
je 0x2708
movq 0x8(%rax), %r14
testq %r14, %r14
je 0x282a
movq 0x10(%r14), %r15
cmpq %rax, %r15
je 0x271e
movq $0x0, 0x18(%r14)
jmp 0x272a
movl $0x20, %esi
movq %rax, %rdi
callq 0x10e0
movq $0x0, (%rbx)
jmp 0x26d8
movq $0x0, 0x10(%r14)
movq 0x18(%r14), %r15
movl $0x20, %esi
movq %rax, %rdi
callq 0x10e0
testq %r15, %r15
je 0x2849
cmpl $0x1, 0x4(%r15)
jne 0x2755
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
jmp 0x27dd
cmpq 0x18(%r14), %r15
movl $0x1, 0x4(%r15)
movl $0x0, 0x4(%r14)
movq 0x8(%r14), %rax
je 0x27a4
movq 0x18(%r15), %rcx
movq %rcx, 0x10(%r14)
movq %r14, 0x18(%r15)
movq %r15, 0x8(%r14)
movq %rbx, %rcx
testq %rax, %rax
je 0x2797
leaq 0x10(%rax), %rdx
leaq 0x18(%rax), %rcx
cmpq %r14, 0x10(%rax)
cmoveq %rdx, %rcx
movq %r15, (%rcx)
movq %rax, 0x8(%r15)
movq 0x10(%r14), %rdx
jmp 0x27d7
movq 0x10(%r15), %rcx
movq %rcx, 0x18(%r14)
movq %r14, 0x10(%r15)
movq %r15, 0x8(%r14)
movq %rbx, %rcx
testq %rax, %rax
je 0x27cc
leaq 0x10(%rax), %rdx
leaq 0x18(%rax), %rcx
cmpq %r14, 0x10(%rax)
cmoveq %rdx, %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 0x2868
leaq 0x925(%rip), %rdi       # 0x3118
leaq 0x8d9(%rip), %rsi       # 0x30d3
leaq 0x8db(%rip), %rcx       # 0x30dc
movl $0x126, %edx            # imm = 0x126
callq 0x1080
leaq 0x92a(%rip), %rdi       # 0x313c
leaq 0x8ba(%rip), %rsi       # 0x30d3
leaq 0x8bc(%rip), %rcx       # 0x30dc
movl $0x128, %edx            # imm = 0x128
callq 0x1080
leaq 0x885(%rip), %rdi       # 0x30b6
leaq 0x89b(%rip), %rsi       # 0x30d3
leaq 0x89d(%rip), %rcx       # 0x30dc
movl $0x109, %edx            # imm = 0x109
callq 0x1080
leaq 0x8ba(%rip), %rdi       # 0x310a
leaq 0x87c(%rip), %rsi       # 0x30d3
leaq 0x87e(%rip), %rcx       # 0x30dc
movl $0x114, %edx            # imm = 0x114
callq 0x1080