// File: /workspace/github_c_makefile_star2_O3/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:
movq 0x10(%rdi), %rax
xorl %edx, %edx
movl $0x0, %esi
testq %rax, %rax
je 0xc104
movswl 0x30(%rax), %esi
movq 0x18(%rdi), %rcx
testq %rcx, %rcx
je 0xc111
movswl 0x30(%rcx), %edx
leal 0x1(%rdx), %r8d
cmpl %r8d, %esi
jle 0xc170
movq 0x18(%rax), %rcx
xorl %edx, %edx
movl $0x0, %esi
testq %rcx, %rcx
je 0xc13d
movl 0x30(%rcx), %esi
movl 0x30(%rax), %r8d
decl %r8d
cmpl %r8d, %esi
jge 0xc1df
movq %rcx, 0x10(%rdi)
movq %rdi, 0x18(%rax)
movq 0x18(%rdi), %rcx
testq %rcx, %rcx
je 0xc151
movl 0x30(%rcx), %edx
cmpl %edx, %esi
cmovgl %esi, %edx
incl %edx
movl %edx, 0x30(%rdi)
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0xc25f
movl 0x30(%rcx), %ecx
jmp 0xc2d4
leal 0x1(%rsi), %eax
cmpl %eax, %edx
jle 0xc1d1
movq 0x10(%rcx), %rax
testq %rax, %rax
je 0xc18e
movl 0x30(%rcx), %edx
decl %edx
cmpl %edx, 0x30(%rax)
jge 0xc263
movq %rax, 0x18(%rdi)
movq %rdi, 0x10(%rcx)
movq 0x10(%rdi), %r8
xorl %edx, %edx
movl $0x0, %esi
testq %r8, %r8
je 0xc1aa
movl 0x30(%r8), %esi
testq %rax, %rax
je 0xc1b2
movl 0x30(%rax), %edx
cmpl %edx, %esi
cmovgl %esi, %edx
incl %edx
movl %edx, 0x30(%rdi)
movq 0x18(%rcx), %rax
testq %rax, %rax
je 0xc2df
movl 0x30(%rax), %eax
jmp 0xc2e1
cmpl %edx, %esi
cmovgl %esi, %edx
incl %edx
movl %edx, 0x30(%rdi)
movq %rdi, %rax
retq
movq 0x18(%rcx), %rdx
movq %rdx, 0x10(%rdi)
movq 0x10(%rcx), %rdx
movq %rdx, 0x18(%rax)
movq %rdi, 0x18(%rcx)
movq %rax, 0x10(%rcx)
movq 0x10(%rdi), %r8
xorl %edx, %edx
movl $0x0, %esi
testq %r8, %r8
je 0xc20b
movl 0x30(%r8), %esi
movq 0x18(%rdi), %r8
testq %r8, %r8
je 0xc218
movl 0x30(%r8), %edx
cmpl %edx, %esi
cmovgl %esi, %edx
incl %edx
movl %edx, 0x30(%rdi)
movq 0x10(%rax), %r8
xorl %edx, %edx
movl $0x0, %esi
testq %r8, %r8
je 0xc236
movl 0x30(%r8), %esi
movq 0x18(%rax), %r8
testq %r8, %r8
je 0xc243
movl 0x30(%r8), %edx
cmpl %edx, %esi
cmovgl %esi, %edx
incl %edx
movl %edx, 0x30(%rax)
movl 0x30(%rdi), %eax
cmpl %eax, %edx
cmovlel %eax, %edx
incl %edx
movl %edx, 0x30(%rcx)
jmp 0xc2eb
xorl %ecx, %ecx
jmp 0xc2d4
movq 0x10(%rax), %rdx
movq %rdx, 0x18(%rdi)
movq 0x18(%rax), %rdx
movq %rdx, 0x10(%rcx)
movq %rdi, 0x10(%rax)
movq %rcx, 0x18(%rax)
movq 0x10(%rdi), %r8
xorl %edx, %edx
movl $0x0, %esi
testq %r8, %r8
je 0xc28f
movl 0x30(%r8), %esi
movq 0x18(%rdi), %r8
testq %r8, %r8
je 0xc29c
movl 0x30(%r8), %edx
cmpl %edx, %esi
cmovgl %esi, %edx
incl %edx
movl %edx, 0x30(%rdi)
movq 0x10(%rcx), %r8
xorl %edx, %edx
movl $0x0, %esi
testq %r8, %r8
je 0xc2ba
movl 0x30(%r8), %esi
movq 0x18(%rcx), %r8
testq %r8, %r8
je 0xc2c7
movl 0x30(%r8), %edx
cmpl %edx, %esi
cmovgl %esi, %edx
incl %edx
movl %edx, 0x30(%rcx)
movl 0x30(%rdi), %ecx
cmpl %edx, %ecx
cmovgl %ecx, %edx
incl %edx
movl %edx, 0x30(%rax)
retq
xorl %eax, %eax
cmpl %eax, %edx
cmovgl %edx, %eax
incl %eax
movl %eax, 0x30(%rcx)
movq %rcx, %rax
retq
nop