// File: /workspace/github_cpp_makefile_star2_O3/DimitriDaSilva[P]42_ft_containers/containers/utils/red_black_tree.hpp
// Function: ft::red_black_tree<int, int, ft::less<int>, std::allocator<ft::red_black_tree_node<int>>>::fix_double_black(ft::red_black_tree_node<int>*)
void
		fix_double_black(node_pointer node)
		{
			node_pointer parent;
			node_pointer sibling;

			// Base case of recursion: if DB is root, nothing to do
			if (node == _root)
				return;

			parent = node->parent;

			// Get double black's sibling. If it's a double black, it
			// necessarily has one
			if (parent->left == node)
				sibling = parent->right;
			else
				sibling = parent->left;

			// Case: DB's sibling is black and its children are black
			if (sibling->color == black
					&& sibling->left->color == black
					&& sibling->right->color == black)
			{
				// DB gives blackness to parent and sibling
				// gets mad (ie becomes red)
				if (parent->color == red)
				{
					parent->color = black;
					sibling->color = red;
				}
				else if (parent->color == black)
				{
					sibling->color = red;
					// If parent is already black it carries double-blackness
					fix_double_black(parent);
				}
			}
			// Case: DB's sibling is red
			else if (sibling->color == red)
			{
				parent->color = red;
				sibling->color = black;

				// Rotate towards the direction of the node we want to delete
				if (parent->left == node)
					rotate_left(sibling);
				else
					rotate_right(sibling);

				// Double black case still exists but the sibling of the node
				// we want to delete has changed
				fix_double_black(node);
			}
			// Case: DB's sibling is black and nearest sibling's child is red
			// and furthest from DB is black
			else if (sibling->color == black
					&& ((sibling == parent->right
						&& sibling->left->color == red
						&& sibling->right->color == black)
						|| (sibling == parent->left
							&& sibling->left->color == black
							&& sibling->right->color == red)))
			{
				if (sibling == parent->right)
				{
					swap_color(sibling, sibling->left);
					rotate_right(sibling->left);
				}
				else
				{
					swap_color(sibling, sibling->right);
					rotate_left(sibling->right);
				}

				// Double black case still exists but the sibling of the node
				// we want to delete has changed
				fix_double_black(node);
			}
			// Case: DB's sibling is black and furthest sibling's child is red
			else if (sibling->color == black
					&& ((sibling == parent->right
						&& sibling->right->color == red)
						|| (sibling == parent->left
							&& sibling->left->color == red)))
			{
				swap_color(parent, sibling);

				// Rotate parent towards DB
				if (sibling == parent->right)
				{
					rotate_left(sibling);
					sibling->right->color = black;
				}
				else
				{
					rotate_right(sibling);
					sibling->left->color = black;
				}
			}
		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
cmpq %rsi, 0x8(%rdi)
je 0xd292
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rsi), %rax
movq 0x10(%rax), %rcx
movq %rcx, %rsi
cmpq %r14, %rcx
jne 0xd135
movq 0x18(%rax), %rsi
movq %rsi, -0x18(%rbp)
movl 0x20(%rsi), %edx
testl %edx, %edx
je 0xd187
cmpl $0x1, %edx
jne 0xd292
movq 0x10(%rsi), %r8
movl 0x20(%r8), %edx
cmpl $0x1, %edx
jne 0xd1a8
movq 0x18(%rsi), %rdi
cmpl $0x1, 0x20(%rdi)
jne 0xd1c7
movl 0x20(%rax), %ecx
cmpl $0x1, %ecx
je 0xd29b
testl %ecx, %ecx
jne 0xd292
movl $0x1, 0x20(%rax)
movl $0x0, 0x20(%rsi)
jmp 0xd292
movl $0x0, 0x20(%rax)
movl $0x1, 0x20(%rsi)
leaq -0x18(%rbp), %rsi
movq %rbx, %rdi
cmpq %r14, %rcx
je 0xd1b2
callq 0x92f6
jmp 0xd1b7
cmpq 0x18(%rax), %rsi
je 0xd1d1
xorl %edi, %edi
jmp 0xd1e3
callq 0x928c
movq %rbx, %rdi
movq %r14, %rsi
callq 0xd106
jmp 0xd292
cmpq 0x18(%rax), %rsi
sete %dil
jmp 0xd1e3
movb $0x1, %dil
testl %edx, %edx
jne 0xd1e3
movq 0x18(%rsi), %r9
cmpl $0x1, 0x20(%r9)
je 0xd24f
cmpl $0x1, %edx
setne %r9b
cmpq %rcx, %rsi
setne %r10b
orb %r9b, %r10b
jne 0xd201
movq 0x18(%rsi), %r9
cmpl $0x0, 0x20(%r9)
je 0xd24a
testb %dil, %dil
je 0xd211
movq 0x18(%rsi), %r8
cmpl $0x0, 0x20(%r8)
je 0xd268
cmpq %rcx, %rsi
setne %cl
testl %edx, %edx
setne %dl
orb %cl, %dl
jne 0xd292
movl 0x20(%rax), %ecx
movl %ecx, 0x20(%rsi)
movl $0x1, 0x20(%rax)
testb %dil, %dil
jne 0xd275
leaq -0x18(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x92f6
movq (%r14), %rax
movq 0x10(%rax), %rax
jmp 0xd28b
testb %dil, %dil
je 0xd2aa
movl $0x1, 0x20(%r8)
movl %edx, 0x20(%rsi)
addq $0x10, %rsi
movq %rbx, %rdi
callq 0x92f6
jmp 0xd2c5
movl 0x20(%rax), %ecx
movl %ecx, 0x20(%rsi)
movl $0x1, 0x20(%rax)
leaq -0x18(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x928c
movq (%r14), %rax
movq 0x18(%rax), %rax
movl $0x1, 0x20(%rax)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl $0x0, 0x20(%rsi)
movq %rbx, %rdi
movq %rax, %rsi
jmp 0xd2cb
movl $0x1, 0x20(%r9)
movl $0x0, 0x20(%rsi)
addq $0x18, %rsi
movq %rbx, %rdi
callq 0x928c
movq %rbx, %rdi
movq %r14, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0xd106