// File: /workspace/github_cpp_makefile_star2_O1/DRSY[P]MyRBTree/main.cpp
// Function: RBTree::remove(int)
bool remove(int value) {
        NodePtr_t node_to_remove = findNodeToRemove(value);
        if(!node_to_remove) {
            std::cerr << red("Value to be removed not in the tree\n");
            return false;
        }
        if(!isfull(node_to_remove)) {
            remove_atleastonenull(node_to_remove);
            return true;
        }
        else {
            // find successor node first
            NodePtr_t successor_node = findSuccessor(node_to_remove);
            node_to_remove->value = successor_node->value;
            successor_node->color = node_to_remove->color;
            remove_atleastonenull(successor_node); // successor's left is NULL
            return true;
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq (%rdi), %rax
testq %rax, %rax
je 0x1790
movl (%rax), %ecx
cmpl %esi, %ecx
jne 0x177f
movq %rax, %rbx
jmp 0x178a
setle %dl
movzbl %dl, %edx
movq 0x10(%rax,%rdx,8), %rax
cmpl %esi, %ecx
jne 0x176f
jmp 0x1792
xorl %ebx, %ebx
testq %rbx, %rbx
je 0x17cc
cmpq $0x0, 0x10(%rbx)
je 0x17bf
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x17bf
movq %rax, %rsi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x17a7
movl (%rsi), %eax
movl %eax, (%rbx)
movl 0x4(%rbx), %eax
movl %eax, 0x4(%rsi)
jmp 0x17c2
movq %rbx, %rsi
callq 0x266a
jmp 0x1a1d
leaq -0xb8(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x1826(%rip), %rsi      # 0x3004
leaq 0x1826(%rip), %rdx      # 0x300b
leaq -0xc8(%rbp), %rdi
callq 0x207a
leaq -0x98(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x188e(%rip), %rsi      # 0x3091
leaq 0x18ab(%rip), %rdx      # 0x30b5
leaq -0xa8(%rbp), %rdi
callq 0x207a
movq -0xc8(%rbp), %rcx
movq -0xc0(%rbp), %r8
movq -0xa0(%rbp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r14, %rcx
je 0x1840
movq -0xb8(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x185f
movl $0xf, %esi
cmpq %r15, -0xa8(%rbp)
je 0x185a
movq -0x98(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x1874
movq -0xa8(%rbp), %rsi
leaq -0xc8(%rbp), %rdi
callq 0x1040
jmp 0x1884
leaq -0xa8(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x10f0
leaq -0x38(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x18a5
movq %rsi, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x18ab
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x40(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq -0x78(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x1759(%rip), %rsi      # 0x3030
leaq 0x1756(%rip), %rdx      # 0x3034
leaq -0x88(%rbp), %rdi
callq 0x207a
leaq -0x38(%rbp), %r13
movq -0x10(%r13), %rcx
movq -0x8(%r13), %r8
movq -0x80(%rbp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r13, %rcx
je 0x190c
movq -0x38(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x1928
movl $0xf, %esi
cmpq %r12, -0x88(%rbp)
je 0x1923
movq -0x78(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x193a
movq -0x88(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x1040
jmp 0x194a
leaq -0x88(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x10f0
leaq -0x58(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x196b
movq %rsi, -0x68(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x58(%rbp)
jmp 0x1971
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x60(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq 0x3654(%rip), %rdi      # 0x4ff0
callq 0x1100
leaq -0x58(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19ba
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x10e0
movq -0x88(%rbp), %rdi
cmpq %r12, %rdi
je 0x19d2
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x10e0
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x19e7
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x10e0
movq -0xa8(%rbp), %rdi
cmpq %r15, %rdi
je 0x1a02
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x10e0
movq -0xc8(%rbp), %rdi
cmpq %r14, %rdi
je 0x1a1d
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x10e0
testq %rbx, %rbx
setne %al
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x58(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1a56
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x10e0
jmp 0x1a56
movq %rax, %rbx
movq -0x88(%rbp), %rdi
cmpq %r12, %rdi
je 0x1a73
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x10e0
jmp 0x1a73
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1a91
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x10e0
jmp 0x1a91
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r15, %rdi
je 0x1ab1
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x10e0
jmp 0x1ab1
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
cmpq %r14, %rdi
je 0x1acc
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x10e0
movq %rbx, %rdi
callq 0x1160