// File: /workspace/github_c_makefile_star2_O3/attractivechaos[P]rb-eval/./rb.hpp
// Function: rbtree_t<unsigned int, rbnode_map_t<unsigned int, int>, int_cmp>::insert(unsigned int const&, int*)
inline node_t *insert(const key_t &item, int *is_present) {
		node_t *pa[RB_MAX_HEIGHT], *p, *n;
		unsigned char da[RB_MAX_HEIGHT];
		int k, dir;
		pa[0] = (node_t*)&root;
		da[0] = 0;
		k = 1; *is_present = 0;
		for (p = root; p; p = p->rb_link[dir]) {
			int cmp = __cmp(item, p->key);
			if (cmp == 0) {
				*is_present = 1;
				return p;
			}
			pa[k] = p;
			da[k++] = dir = cmp > 0;
		}
		n = pa[k - 1]->rb_link[da[k - 1]] = (node_t*)malloc(sizeof(node_t));
		n->key = item;
		n->rb_link[0] = n->rb_link[1] = 0;
		n->color = RB_RED;
		++generation;
		while (k >= 3 && pa[k - 1]->color == RB_RED) {
			if (da[k - 2] == 0) {
				node_t *y = pa[k - 2]->rb_link[1];
				if (y && y->color == RB_RED) {
					pa[k - 1]->color = y->color = RB_BLACK;
					pa[k - 2]->color = RB_RED;
					k -= 2;
				} else {
					node_t *x;
					if (da[k - 1] == 0) y = pa[k - 1];
					else {
						x = pa[k - 1];
						y = x->rb_link[1];
						x->rb_link[1] = y->rb_link[0];
						y->rb_link[0] = x;
						pa[k - 2]->rb_link[0] = y;
					}
					x = pa[k - 2];
					x->color = RB_RED;
					y->color = RB_BLACK;
					x->rb_link[0] = y->rb_link[1];
					y->rb_link[1] = x;
					pa[k - 3]->rb_link[da[k - 3]] = y;
					break;
				}
			} else {
				node_t *y = pa[k - 2]->rb_link[0];
				if (y && y->color == RB_RED) {
					pa[k - 1]->color = y->color = RB_BLACK;
					pa[k - 2]->color = RB_RED;
					k -= 2;
				} else {
					node_t *x;
					if (da[k - 1] == 1) y = pa[k - 1];
					else {
						x = pa[k - 1];
						y = x->rb_link[0];
						x->rb_link[0] = y->rb_link[1];
						y->rb_link[1] = x;
						pa[k - 2]->rb_link[1] = y;
					}
					x = pa[k - 2];
					x->color = RB_RED;
					y->color = RB_BLACK;
					x->rb_link[1] = y->rb_link[0];
					y->rb_link[0] = x;
					pa[k - 3]->rb_link[da[k - 3]] = y;
					break;
				}
			}
		}
		root->color = RB_BLACK;
		return n;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
movq %r14, 0x30(%rsp)
movb $0x0, (%rsp)
movl $0x0, (%rdx)
movq 0x8(%rdi), %rax
movl (%rsi), %ebp
testq %rax, %rax
je 0x1366
movl $0x1, %ecx
xorl %esi, %esi
cmpl 0x10(%rax), %ebp
seta %sil
sbbl $0x0, %esi
je 0x1401
movq %rax, 0x30(%rsp,%rcx,8)
leaq 0x1(%rcx), %r15
xorl %edi, %edi
testl %esi, %esi
setg (%rsp,%rcx)
setg %dil
movq (%rax,%rdi,8), %rax
movq %r15, %rcx
testq %rax, %rax
jne 0x1331
jmp 0x136c
movl $0x1, %r15d
movl $0x20, %edi
callq 0x1060
movslq %r15d, %rcx
movq 0x28(%rsp,%rcx,8), %rdx
movzbl -0x1(%rsp,%rcx), %esi
movq %rax, (%rdx,%rsi,8)
movl %ebp, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movb $0x1, 0x18(%rax)
incq 0x10(%rbx)
cmpl $0x3, %ecx
jl 0x147a
movl %r15d, %ecx
xorl %edi, %edi
movq 0x28(%rsp,%rcx,8), %rdx
cmpb $0x1, 0x18(%rdx)
jne 0x147a
cmpb $0x0, -0x2(%rsp,%rcx)
movq 0x20(%rsp,%rcx,8), %rsi
je 0x13d2
movq (%rsi), %r8
testq %r8, %r8
je 0x1409
cmpb $0x1, 0x18(%r8)
je 0x13e2
jmp 0x1409
movq 0x8(%rsi), %r8
testq %r8, %r8
je 0x1439
cmpb $0x1, 0x18(%r8)
jne 0x1439
addq $0x18, %r8
addq $-0x2, %rcx
movb %dil, (%r8)
movb %dil, 0x18(%rdx)
movb $0x1, 0x18(%rsi)
leaq 0x2(%rcx), %rdx
cmpq $0x4, %rdx
ja 0x13a6
jmp 0x147a
movl $0x1, (%rdx)
jmp 0x1481
cmpb $0x1, -0x1(%rsp,%rcx)
je 0x1425
movq (%rdx), %rdi
movq 0x8(%rdi), %r8
movq %r8, (%rdx)
movq %rdx, 0x8(%rdi)
movq %rdi, 0x8(%rsi)
movq %rdi, %rdx
movb $0x1, 0x18(%rsi)
movb $0x0, 0x18(%rdx)
movq (%rdx), %rdi
movq %rdi, 0x8(%rsi)
movq %rdx, %rdi
jmp 0x1467
cmpb $0x0, -0x1(%rsp,%rcx)
je 0x1454
movq 0x8(%rdx), %rdi
movq (%rdi), %r8
movq %r8, 0x8(%rdx)
movq %rdx, (%rdi)
movq %rdi, (%rsi)
movq %rdi, %rdx
movb $0x1, 0x18(%rsi)
movb $0x0, 0x18(%rdx)
leaq 0x8(%rdx), %rdi
movq 0x8(%rdx), %r8
movq %r8, (%rsi)
movq %rsi, (%rdi)
addl $-0x3, %ecx
movq 0x30(%rsp,%rcx,8), %rsi
movzbl (%rsp,%rcx), %ecx
movq %rdx, (%rsi,%rcx,8)
movq (%r14), %rcx
movb $0x0, 0x18(%rcx)
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop