// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/rbtree.c
// Function: rb_insert
void rb_insert(struct rb_node *node, struct rb_tree *tree)
{
	struct rb_node *p = rb_parent(node);

	while (rb_red(p)) {
		struct rb_node *g = rb_parent(p);

		if (p == g->left) {
			struct rb_node *r = g->right;

			if (rb_red(r)) {
				rb_set_red(g);
				rb_set_black(p);
				rb_set_black(r);
				node = g;
				p = rb_parent(node);
				continue;
			}

			if (node == p->right) {
				rb_rotate_left(p, tree);
				p = node;
			}
			rb_rotate_right(g, tree);
			rb_set_black(p);
			rb_set_red(g);
			break;
		} else {
			struct rb_node *l = g->left;

			if (rb_red(l)) {
				rb_set_red(g);
				rb_set_black(p);
				rb_set_black(l);
				node = g;
				p = rb_parent(node);
				continue;
			}

			if (node == p->left) {
				rb_rotate_right(p, tree);
				p = node;
			}
			rb_rotate_left(g, tree);
			rb_set_black(p);
			rb_set_red(g);
			break;
		}
	}
	rb_set_black(tree->root);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0xffffffff8010b510
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0xffffffff8010b760
testb $0x1, %al
jne 0xffffffff8010b5ff
jmp 0xffffffff8010b741
movq -0x18(%rbp), %rdi
callq 0xffffffff8010b510
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq (%rcx), %rax
jne 0xffffffff8010b6b1
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0xffffffff8010b760
testb $0x1, %al
jne 0xffffffff8010b638
jmp 0xffffffff8010b66a
movq -0x20(%rbp), %rdi
callq 0xffffffff8010b7a0
movq -0x18(%rbp), %rdi
callq 0xffffffff8010b7c0
movq -0x28(%rbp), %rdi
callq 0xffffffff8010b7c0
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0xffffffff8010b510
movq %rax, -0x18(%rbp)
jmp 0xffffffff8010b5ed
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0xffffffff8010b68d
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xffffffff8010b7e0
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xffffffff8010b8a0
movq -0x18(%rbp), %rdi
callq 0xffffffff8010b7c0
movq -0x20(%rbp), %rdi
callq 0xffffffff8010b7a0
jmp 0xffffffff8010b741
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0xffffffff8010b760
testb $0x1, %al
jne 0xffffffff8010b6cb
jmp 0xffffffff8010b700
movq -0x20(%rbp), %rdi
callq 0xffffffff8010b7a0
movq -0x18(%rbp), %rdi
callq 0xffffffff8010b7c0
movq -0x30(%rbp), %rdi
callq 0xffffffff8010b7c0
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0xffffffff8010b510
movq %rax, -0x18(%rbp)
jmp 0xffffffff8010b5ed
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jne 0xffffffff8010b722
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xffffffff8010b8a0
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xffffffff8010b7e0
movq -0x18(%rbp), %rdi
callq 0xffffffff8010b7c0
movq -0x20(%rbp), %rdi
callq 0xffffffff8010b7a0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xffffffff8010b7c0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)