// File: cjc12[P]ezSTL/src/../include/rbtree.h
// Function: ezSTL::rbtree<int, ezSTL::less<int>, ezSTL::allocator<ezSTL::__rbtree_node<int>>>::insert(int const&)
void rbtree<T, Compare, Alloc>::insert(const value_type& v) {
		// z : node to be inserted
		link_type z = Alloc().allocate();
		Alloc().construct(z, v);
		// y : parent node of z
		link_type y = nullptr;
		// x : node used to find proper position
		link_type x = root();
		// find the proper position to insert
		while (x != nullptr) {
			y = x;
			if (cmp(v, x->data))
				x = x->left;
			else if(cmp(x->data, v))
				x = x->right;
			// if v == x->data , renew it
			else {
				x->data = v;
				return;
			}
		}
		z->parent = y;
		// if it is an empty tree
		if (y == nullptr) {
			header.node->parent = z;
			header.node->left = z;
			header.node->right = z;
			z->parent = header.node;
		}
		else if (cmp(v, y->data))
			y->left = z;
		else y->right = z;
		// fix up
		insert_fixup(z);
		// adjust header: left and right
		if (empty() || cmp(v, leftmost()->data))
			header.node->left = z;
		if (empty() || cmp(rightmost()->data, v))
			header.node->right = z;
		++__size;
	}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x6f(%rsp), %rdi
movl $0x1, %esi
callq 0x12080
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x78(%rsp), %rsi
leaq 0x40(%rsp), %rdi
callq 0x12560
movq 0x20(%rsp), %rsi
leaq 0x6e(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x12530
movq 0x28(%rsp), %rdi
movq $0x0, 0x38(%rsp)
callq 0x12390
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
je 0xd3ff
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rax
movq %rax, 0x38(%rsp)
addq $0x10, %rdi
movq 0x78(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq $0x20, %rdx
callq 0x11ff0
testb $0x1, %al
jne 0xd3a2
jmp 0xd3b2
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x30(%rsp)
jmp 0xd3fa
movq 0x28(%rsp), %rdi
addq $0x10, %rdi
movq 0x30(%rsp), %rsi
addq $0x20, %rsi
movq 0x78(%rsp), %rdx
callq 0x11ff0
testb $0x1, %al
jne 0xd3d4
jmp 0xd3e4
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x30(%rsp)
jmp 0xd3f8
movq 0x78(%rsp), %rax
movl (%rax), %ecx
movq 0x30(%rsp), %rax
movl %ecx, 0x20(%rax)
jmp 0xd55b
jmp 0xd3fa
jmp 0xd36a
movq 0x38(%rsp), %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x8(%rax)
cmpq $0x0, 0x38(%rsp)
jne 0xd450
movq 0x28(%rsp), %rax
movq 0x70(%rsp), %rdx
movq 0x8(%rax), %rcx
movq %rdx, 0x8(%rcx)
movq 0x70(%rsp), %rdx
movq 0x8(%rax), %rcx
movq %rdx, 0x10(%rcx)
movq 0x70(%rsp), %rdx
movq 0x8(%rax), %rcx
movq %rdx, 0x18(%rcx)
movq 0x8(%rax), %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0x8(%rax)
jmp 0xd492
movq 0x28(%rsp), %rdi
addq $0x10, %rdi
movq 0x78(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq $0x20, %rdx
callq 0x11ff0
testb $0x1, %al
jne 0xd472
jmp 0xd482
movq 0x70(%rsp), %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x10(%rax)
jmp 0xd490
movq 0x70(%rsp), %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x18(%rax)
jmp 0xd492
movq 0x28(%rsp), %rdi
movq 0x70(%rsp), %rsi
callq 0x125a0
movq 0x28(%rsp), %rdi
callq 0x120b0
testb $0x1, %al
jne 0xd4eb
movq 0x28(%rsp), %rdi
movq %rdi, %rax
addq $0x10, %rax
movq %rax, 0x10(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x18(%rsp)
callq 0x12350
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %rax, %rdx
addq $0x20, %rdx
callq 0x11ff0
testb $0x1, %al
jne 0xd4eb
jmp 0xd4fd
movq 0x28(%rsp), %rax
movq 0x70(%rsp), %rcx
movq 0x8(%rax), %rax
movq %rcx, 0x10(%rax)
movq 0x28(%rsp), %rdi
callq 0x120b0
testb $0x1, %al
jne 0xd53d
movq 0x28(%rsp), %rdi
movq %rdi, %rax
addq $0x10, %rax
movq %rax, 0x8(%rsp)
callq 0x127e0
movq 0x8(%rsp), %rdi
movq %rax, %rsi
addq $0x20, %rsi
movq 0x78(%rsp), %rdx
callq 0x11ff0
testb $0x1, %al
jne 0xd53d
jmp 0xd54f
movq 0x28(%rsp), %rax
movq 0x70(%rsp), %rcx
movq 0x8(%rax), %rax
movq %rcx, 0x18(%rax)
movq 0x28(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
addq $0x88, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)