// File: /workspace/github_cpp_makefile_star2_O1/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 0xd675
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rsi), %rsi
movq 0x10(%rsi), %rdx
movq %rdx, %rax
cmpq %r14, %rdx
jne 0xd561
movq 0x18(%rsi), %rax
movq %rax, -0x18(%rbp)
movl 0x20(%rax), %ecx
cmpl $0x1, %ecx
jne 0xd5a8
movq 0x10(%rax), %rdi
cmpl $0x1, 0x20(%rdi)
jne 0xd5a8
movq 0x18(%rax), %rdi
cmpl $0x1, 0x20(%rdi)
jne 0xd5a8
movl 0x20(%rsi), %ecx
cmpl $0x1, %ecx
je 0xd67e
testl %ecx, %ecx
jne 0xd675
movl $0x1, 0x20(%rsi)
movl $0x0, 0x20(%rax)
jmp 0xd675
cmpl $0x1, %ecx
je 0xd5d9
testl %ecx, %ecx
jne 0xd617
movl $0x0, 0x20(%rsi)
movl $0x1, 0x20(%rax)
leaq -0x18(%rbp), %rsi
movq %rbx, %rdi
cmpq %r14, %rdx
je 0xd665
callq 0x9536
jmp 0xd66a
movq 0x18(%rsi), %rdi
cmpq %rdi, %rax
jne 0xd5fc
movq 0x10(%rax), %r8
cmpl $0x0, 0x20(%r8)
jne 0xd5fc
movq 0x18(%rax), %r8
cmpl $0x1, 0x20(%r8)
je 0xd68a
cmpq %rdx, %rax
jne 0xd617
movq 0x10(%rax), %r8
cmpl $0x1, 0x20(%r8)
jne 0xd617
movq 0x18(%rax), %r8
cmpl $0x0, 0x20(%r8)
je 0xd68a
cmpl $0x1, %ecx
jne 0xd675
movq 0x18(%rsi), %rdi
cmpq %rdi, %rax
jne 0xd630
movq 0x18(%rax), %r8
cmpl $0x0, 0x20(%r8)
je 0xd63f
cmpq %rdx, %rax
jne 0xd675
movq 0x10(%rax), %rdx
cmpl $0x0, 0x20(%rdx)
jne 0xd675
movl 0x20(%rsi), %edx
movl %edx, 0x20(%rax)
movl %ecx, 0x20(%rsi)
leaq -0x18(%rbp), %r14
cmpq %rdi, %rax
je 0xd6aa
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9536
movq (%r14), %rax
movq 0x10(%rax), %rax
jmp 0xd6bc
callq 0x94cc
movq %rbx, %rdi
movq %r14, %rsi
callq 0xd532
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl $0x0, 0x20(%rax)
movq %rbx, %rdi
jmp 0xd6e4
cmpq %rdi, %rax
je 0xd6c5
leaq 0x18(%rax), %rsi
movq 0x18(%rax), %rdx
movl 0x20(%rdx), %edi
movl %ecx, 0x20(%rdx)
movl %edi, 0x20(%rax)
movq %rbx, %rdi
callq 0x94cc
jmp 0xd6de
movq %rbx, %rdi
movq %r14, %rsi
callq 0x94cc
movq (%r14), %rax
movq 0x18(%rax), %rax
movl $0x1, 0x20(%rax)
jmp 0xd675
leaq 0x10(%rax), %rsi
movq 0x10(%rax), %rdx
movl 0x20(%rdx), %edi
movl %ecx, 0x20(%rdx)
movl %edi, 0x20(%rax)
movq %rbx, %rdi
callq 0x9536
movq %rbx, %rdi
movq %r14, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0xd532
nop