// File: planaria[P]cb_tree/./include/cb_tree/detail/cb_tree_base.hpp
// Function: cb_tree::detail::cb_tree_base<cb_tree::cb_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::unique_ptr<counter, std::default_delete<counter>>, cb_tree::cb_key_traits<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, void>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::unique_ptr<counter, std::default_delete<counter>>>>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::unique_ptr<counter, std::default_delete<counter>>>, cb_tree::cb_key_traits<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, void>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::unique_ptr<counter, std::default_delete<counter>>>>>::erase(cb_tree::detail::cb_iterator<cb_tree::detail::cb_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::unique_ptr<counter, std::default_delete<counter>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::unique_ptr<counter, std::default_delete<counter>>>>>, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::unique_ptr<counter, std::default_delete<counter>>> const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::unique_ptr<counter, std::default_delete<counter>>> const&, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::unique_ptr<counter, std::default_delete<counter>>> const*>)
iterator erase(const_iterator it)
			{
				assert(it != end());

				node_pointer node = it.node();
				node_pointer next = node->next_leaf();

				node->destroy_value(node_allocator());
				--size_;

				if (node == begin_node())
					begin_node() = next;

				do
				{
					if (!node->left() && !node->right())
					{
						if (node->is_left_child())
							node->parent()->left() = nullptr;
						else
							node->parent()->right() = nullptr;

						node_pointer parent = node->parent();
						destroy_node(node);
						node = parent;
					}
					else if (!node->left())
					{
						if (node->is_left_child())
							node->parent()->left() = node->right();
						else
							node->parent()->right() = node->right();

						node->right()->parent() = node->parent();

						destroy_node(node);
						break;
					}
					else if (!node->right())
					{
						if (node->is_left_child())
							node->parent()->left() = node->left();
						else
							node->parent()->right() = node->left();

						node->left()->parent() = node->parent();

						destroy_node(node);
						break;
					}
				} while (!node->leaf());

				return iterator(next);
			}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rsi, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movq %rdi, -0x40(%rbp)
callq 0x18eb0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rsi
leaq -0x10(%rbp), %rdi
callq 0x19280
testb $0x1, %al
jne 0x18f17
jmp 0x18f19
jmp 0x18f38
leaq 0x9579c(%rip), %rdi     # 0xae6bc
leaq 0x92166(%rip), %rsi     # 0xab08d
movl $0x152, %edx            # imm = 0x152
leaq 0x95795(%rip), %rcx     # 0xae6c8
callq 0xc3b0
leaq -0x10(%rbp), %rdi
callq 0x192f0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x18390
movq -0x40(%rbp), %rdi
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
callq 0x17cc0
movq -0x50(%rbp), %rdi
movq %rax, %rsi
callq 0x19310
movq -0x40(%rbp), %rdi
movq 0x18(%rdi), %rax
addq $-0x1, %rax
movq %rax, 0x18(%rdi)
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
callq 0x16eb0
movq %rax, %rcx
movq -0x48(%rbp), %rax
cmpq (%rcx), %rax
jne 0x18fb0
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rax
movq %rax, -0x58(%rbp)
callq 0x16eb0
movq -0x58(%rbp), %rcx
movq %rcx, (%rax)
jmp 0x18fb2
movq -0x28(%rbp), %rdi
callq 0x16ef0
cmpq $0x0, (%rax)
jne 0x1903b
movq -0x28(%rbp), %rdi
callq 0x17d90
cmpq $0x0, (%rax)
jne 0x1903b
movq -0x28(%rbp), %rdi
callq 0x17db0
testb $0x1, %al
jne 0x18fdf
jmp 0x18ff9
movq -0x28(%rbp), %rdi
callq 0x17b70
movq (%rax), %rdi
callq 0x16ef0
movq $0x0, (%rax)
jmp 0x19011
movq -0x28(%rbp), %rdi
callq 0x17b70
movq (%rax), %rdi
callq 0x17d90
movq $0x0, (%rax)
movq -0x28(%rbp), %rdi
callq 0x17b70
movq -0x40(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rsi
callq 0x17e20
movq -0x38(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x1919e
movq -0x28(%rbp), %rdi
callq 0x16ef0
cmpq $0x0, (%rax)
jne 0x190e9
movq -0x28(%rbp), %rdi
callq 0x17db0
testb $0x1, %al
jne 0x1905d
jmp 0x19087
movq -0x28(%rbp), %rdi
callq 0x17d90
movq (%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rdi
callq 0x17b70
movq (%rax), %rdi
callq 0x16ef0
movq -0x60(%rbp), %rcx
movq %rcx, (%rax)
jmp 0x190af
movq -0x28(%rbp), %rdi
callq 0x17d90
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rdi
callq 0x17b70
movq (%rax), %rdi
callq 0x17d90
movq -0x68(%rbp), %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rdi
callq 0x17b70
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rdi
callq 0x17d90
movq (%rax), %rdi
callq 0x17b70
movq -0x70(%rbp), %rcx
movq -0x40(%rbp), %rdi
movq %rcx, (%rax)
movq -0x28(%rbp), %rsi
callq 0x17e20
jmp 0x191b3
movq -0x28(%rbp), %rdi
callq 0x17d90
cmpq $0x0, (%rax)
jne 0x1919a
movq -0x28(%rbp), %rdi
callq 0x17db0
testb $0x1, %al
jne 0x1910b
jmp 0x19135
movq -0x28(%rbp), %rdi
callq 0x16ef0
movq (%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x28(%rbp), %rdi
callq 0x17b70
movq (%rax), %rdi
callq 0x16ef0
movq -0x78(%rbp), %rcx
movq %rcx, (%rax)
jmp 0x1915d
movq -0x28(%rbp), %rdi
callq 0x16ef0
movq (%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x28(%rbp), %rdi
callq 0x17b70
movq (%rax), %rdi
callq 0x17d90
movq -0x80(%rbp), %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rdi
callq 0x17b70
movq (%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x28(%rbp), %rdi
callq 0x16ef0
movq (%rax), %rdi
callq 0x17b70
movq -0x88(%rbp), %rcx
movq -0x40(%rbp), %rdi
movq %rcx, (%rax)
movq -0x28(%rbp), %rsi
callq 0x17e20
jmp 0x191b3
jmp 0x1919c
jmp 0x1919e
jmp 0x191a0
movq -0x28(%rbp), %rdi
callq 0x17bb0
xorb $-0x1, %al
testb $0x1, %al
jne 0x18fb2
movq -0x30(%rbp), %rsi
leaq -0x8(%rbp), %rdi
callq 0x17c00
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)