// File: /workspace/github_c_makefile_star2_O0/theovosse[P]llgen/avl3.c
// Function: Reorder
static TREE Reorder(TREE node)
{
	short int lDepth = (node->left == 0? 0: node->left->depth);
	short int rDepth = (node->right == 0? 0: node->right->depth);
	TREE n1;
	TREE n2;

	if (lDepth > rDepth + 1)
	{
		n1 = node->left;
		n2 = n1->right;
		if (n2 == 0 || n2->depth < n1->depth - 1)
		{
			node->left = n2;
			n1->right = node;
			node->depth = NDepth(node);
			n1->depth = NDepth(n1);
			return (n1);
		}
		else
		{
			node->left = n2->right;
			n1->right = n2->left;
			n2->right = node;
			n2->left = n1;
			node->depth = NDepth(node);
			n1->depth = NDepth(n1);
			n2->depth = NDepth(n2);
			return (n2);
		}
	}
	else if (rDepth > lDepth + 1)
	{
		n1 = node->right;
		n2 = n1->left;
		if (n2 == 0 || n2->depth < n1->depth - 1)
		{
			node->right = n2;
			n1->left = node;
			node->depth = NDepth(node);
			n1->depth = NDepth(n1);
			return (n1);
		}
		else
		{
			node->right = n2->left;
			n1->left = n2->right;
			n2->left = node;
			n2->right = n1;
			node->depth = NDepth(node);
			n1->depth = NDepth(n1);
			n2->depth = NDepth(n2);
			return (n2);
		}
	}
	node->depth = (lDepth > rDepth? lDepth: rDepth) + 1;
	return (node);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x10e7e
xorl %eax, %eax
movl %eax, -0x2c(%rbp)
jmp 0x10e8c
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x30(%rax), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movw %ax, -0x12(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x10ea5
xorl %eax, %eax
movl %eax, -0x30(%rbp)
jmp 0x10eb3
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x30(%rax), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movw %ax, -0x14(%rbp)
movswl -0x12(%rbp), %eax
movswl -0x14(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jle 0x10fc5
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x10f01
movq -0x28(%rbp), %rax
movl 0x30(%rax), %eax
movq -0x20(%rbp), %rcx
movl 0x30(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x10f4a
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rdi
callq 0x10cf0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x20(%rbp), %rdi
callq 0x10cf0
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x11100
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rdi
callq 0x10cf0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x20(%rbp), %rdi
callq 0x10cf0
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x28(%rbp), %rdi
callq 0x10cf0
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x11100
movswl -0x14(%rbp), %eax
movswl -0x12(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jle 0x110cd
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x1100c
movq -0x28(%rbp), %rax
movl 0x30(%rax), %eax
movq -0x20(%rbp), %rcx
movl 0x30(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x11055
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rdi
callq 0x10cf0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x20(%rbp), %rdi
callq 0x10cf0
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x11100
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rdi
callq 0x10cf0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x20(%rbp), %rdi
callq 0x10cf0
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x28(%rbp), %rdi
callq 0x10cf0
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x11100
jmp 0x110cf
movswl -0x12(%rbp), %eax
movswl -0x14(%rbp), %ecx
cmpl %ecx, %eax
jle 0x110e4
movswl -0x12(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0x110eb
movswl -0x14(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)