// File: FreeSlave[P]vhlt/hlbsp/solidbsp.cpp
// Function: BuildSurfaceTree_r(surfacetree_t*, surfacetreenode_s*)
void BuildSurfaceTree_r (surfacetree_t *tree, surfacetreenode_t *node)
{
	node->size = node->leaffaces->size ();
#ifdef HLCSG_HLBSP_SOLIDHINT
	node->size_discardable = 0;
#endif
	if (node->size == 0)
	{
		node->isleaf = true;
		return;
	}

	VectorFill (node->mins, BOGUS_RANGE);
	VectorFill (node->maxs, -BOGUS_RANGE);
	for (std::vector< face_t * >::iterator i = node->leaffaces->begin (); i != node->leaffaces->end (); ++i)
	{
		face_t *f = *i;
		for (int x = 0; x < f->numpoints; x++)
		{
			VectorCompareMinimum (node->mins, f->pts[x], node->mins);
			VectorCompareMaximum (node->maxs, f->pts[x], node->maxs);
		}
#ifdef HLCSG_HLBSP_SOLIDHINT
		if (f->facestyle == face_discardable)
		{
			node->size_discardable++;
		}
#endif
	}

	int bestaxis = -1;
	{
		vec_t bestdelta = 0;
		for (int k = 0; k < 3; k++)
		{
			if (node->maxs[k] - node->mins[k] > bestdelta + ON_EPSILON)
			{
				bestaxis = k;
				bestdelta = node->maxs[k] - node->mins[k];
			}
		}
	}
	if (node->size <= 5 || tree->dontbuild == true || bestaxis == -1)
	{
		node->isleaf = true;
		return;
	}

	node->isleaf = false;
	vec_t dist, dist1, dist2;
	dist = (node->mins[bestaxis] + node->maxs[bestaxis]) / 2;
	dist1 = (3 * node->mins[bestaxis] + node->maxs[bestaxis]) / 4;
	dist2 = (node->mins[bestaxis] + 3 * node->maxs[bestaxis]) / 4;
	// Each child node is at most 3/4 the size of the parent node.
	// Most faces should be passed to a child node, faces left in the parent node are the ones whose dimensions are large enough to be comparable to the dimension of the parent node.
	node->nodefaces = new std::vector< face_t * >;
#ifdef HLCSG_HLBSP_SOLIDHINT
	node->nodefaces_discardablesize = 0;
#endif
	node->children[0] = (surfacetreenode_t *)malloc (sizeof (surfacetreenode_t));
	node->children[0]->leaffaces = new std::vector< face_t * >;
	node->children[1] = (surfacetreenode_t *)malloc (sizeof (surfacetreenode_t));
	node->children[1]->leaffaces = new std::vector< face_t * >;
	for (std::vector< face_t * >::iterator i = node->leaffaces->begin (); i != node->leaffaces->end (); ++i)
	{
		face_t *f = *i;
		vec_t low = BOGUS_RANGE;
		vec_t high = -BOGUS_RANGE;
		for (int x = 0; x < f->numpoints; x++)
		{
			low = qmin (low, f->pts[x][bestaxis]);
			high = qmax (high, f->pts[x][bestaxis]);
		}
		if (low < dist1 + ON_EPSILON && high > dist2 - ON_EPSILON)
		{
			node->nodefaces->push_back (f);
#ifdef HLCSG_HLBSP_SOLIDHINT
			if (f->facestyle == face_discardable)
			{
				node->nodefaces_discardablesize++;
			}
#endif
		}
		else if (low >= dist1 && high <= dist2)
		{
			if ((low + high) / 2 > dist)
			{
				node->children[0]->leaffaces->push_back (f);
			}
			else
			{
				node->children[1]->leaffaces->push_back (f);
			}
		}
		else if (low >= dist1)
		{
			node->children[0]->leaffaces->push_back (f);
		}
		else if (high <= dist2)
		{
			node->children[1]->leaffaces->push_back (f);
		}
	}
	if (node->children[0]->leaffaces->size () == node->leaffaces->size () || node->children[1]->leaffaces->size () == node->leaffaces->size ())
	{
		Warning ("BuildSurfaceTree_r: didn't split node with bound (%f,%f,%f)-(%f,%f,%f)", node->mins[0], node->mins[1], node->mins[2], node->maxs[0], node->maxs[1], node->maxs[2]);
		delete node->children[0]->leaffaces;
		delete node->children[1]->leaffaces;
		free (node->children[0]);
		free (node->children[1]);
		delete node->nodefaces;
		node->isleaf = true;
		return;
	}
	delete node->leaffaces;
	BuildSurfaceTree_r (tree, node->children[0]);
	BuildSurfaceTree_r (tree, node->children[1]);
}

// Assembly:
subq $0x118, %rsp            # imm = 0x118
movq %rdi, 0x110(%rsp)
movq %rsi, 0x108(%rsp)
movq 0x108(%rsp), %rax
movq 0x60(%rax), %rdi
callq 0x2e3e0
movl %eax, %ecx
movq 0x108(%rsp), %rax
movl %ecx, (%rax)
movq 0x108(%rsp), %rax
movl $0x0, 0x4(%rax)
movq 0x108(%rsp), %rax
cmpl $0x0, (%rax)
jne 0x29861
movq 0x108(%rsp), %rax
movb $0x1, 0x38(%rax)
jmp 0x2a4ce
movq 0x108(%rsp), %rax
movsd 0xfd97(%rip), %xmm0     # 0x39608
movsd %xmm0, 0x8(%rax)
movq 0x108(%rsp), %rax
movsd 0xfd82(%rip), %xmm0     # 0x39608
movsd %xmm0, 0x10(%rax)
movq 0x108(%rsp), %rax
movsd 0xfd6d(%rip), %xmm0     # 0x39608
movsd %xmm0, 0x18(%rax)
movq 0x108(%rsp), %rax
movsd 0x10d60(%rip), %xmm0    # 0x3a610
movsd %xmm0, 0x20(%rax)
movq 0x108(%rsp), %rax
movsd 0x10d4b(%rip), %xmm0    # 0x3a610
movsd %xmm0, 0x28(%rax)
movq 0x108(%rsp), %rax
movsd 0x10d36(%rip), %xmm0    # 0x3a610
movsd %xmm0, 0x30(%rax)
movq 0x108(%rsp), %rax
movq 0x60(%rax), %rdi
callq 0x2e400
movq %rax, 0x100(%rsp)
movq 0x108(%rsp), %rax
movq 0x60(%rax), %rdi
callq 0x2e470
movq %rax, 0xf8(%rsp)
leaq 0x100(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x2e430
testb $0x1, %al
jne 0x2992f
jmp 0x29cbb
leaq 0x100(%rsp), %rdi
callq 0x2e4a0
movq (%rax), %rax
movq %rax, 0xf0(%rsp)
movl $0x0, 0xec(%rsp)
movl 0xec(%rsp), %eax
movq 0xf0(%rsp), %rcx
cmpl 0x2c(%rcx), %eax
jge 0x29c88
movq 0x108(%rsp), %rax
movsd 0x8(%rax), %xmm1
movq 0xf0(%rsp), %rax
addq $0x38, %rax
movslq 0xec(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x299b4
movq 0x108(%rsp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x88(%rsp)
jmp 0x299dc
movq 0xf0(%rsp), %rax
addq $0x38, %rax
movslq 0xec(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x88(%rsp)
movsd 0x88(%rsp), %xmm0
movq 0x108(%rsp), %rax
movsd %xmm0, 0x8(%rax)
movq 0x108(%rsp), %rax
movsd 0x10(%rax), %xmm1
movq 0xf0(%rsp), %rax
addq $0x38, %rax
movslq 0xec(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd 0x8(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x29a3d
movq 0x108(%rsp), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x80(%rsp)
jmp 0x29a66
movq 0xf0(%rsp), %rax
addq $0x38, %rax
movslq 0xec(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x80(%rsp)
movsd 0x80(%rsp), %xmm0
movq 0x108(%rsp), %rax
movsd %xmm0, 0x10(%rax)
movq 0x108(%rsp), %rax
movsd 0x18(%rax), %xmm1
movq 0xf0(%rsp), %rax
addq $0x38, %rax
movslq 0xec(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x29ac4
movq 0x108(%rsp), %rax
movsd 0x18(%rax), %xmm0
movsd %xmm0, 0x78(%rsp)
jmp 0x29aea
movq 0xf0(%rsp), %rax
addq $0x38, %rax
movslq 0xec(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x78(%rsp)
movsd 0x78(%rsp), %xmm0
movq 0x108(%rsp), %rax
movsd %xmm0, 0x18(%rax)
movq 0x108(%rsp), %rax
movsd 0x20(%rax), %xmm0
movq 0xf0(%rsp), %rax
addq $0x38, %rax
movslq 0xec(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
ucomisd (%rax), %xmm0
jbe 0x29b40
movq 0x108(%rsp), %rax
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x70(%rsp)
jmp 0x29b65
movq 0xf0(%rsp), %rax
addq $0x38, %rax
movslq 0xec(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x70(%rsp)
movsd 0x70(%rsp), %xmm0
movq 0x108(%rsp), %rax
movsd %xmm0, 0x20(%rax)
movq 0x108(%rsp), %rax
movsd 0x28(%rax), %xmm0
movq 0xf0(%rsp), %rax
addq $0x38, %rax
movslq 0xec(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
ucomisd 0x8(%rax), %xmm0
jbe 0x29bbc
movq 0x108(%rsp), %rax
movsd 0x28(%rax), %xmm0
movsd %xmm0, 0x68(%rsp)
jmp 0x29be2
movq 0xf0(%rsp), %rax
addq $0x38, %rax
movslq 0xec(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0x68(%rsp), %xmm0
movq 0x108(%rsp), %rax
movsd %xmm0, 0x28(%rax)
movq 0x108(%rsp), %rax
movsd 0x30(%rax), %xmm0
movq 0xf0(%rsp), %rax
addq $0x38, %rax
movslq 0xec(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
ucomisd 0x10(%rax), %xmm0
jbe 0x29c39
movq 0x108(%rsp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
jmp 0x29c5f
movq 0xf0(%rsp), %rax
addq $0x38, %rax
movslq 0xec(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
movsd 0x60(%rsp), %xmm0
movq 0x108(%rsp), %rax
movsd %xmm0, 0x30(%rax)
movl 0xec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xec(%rsp)
jmp 0x29952
movq 0xf0(%rsp), %rax
cmpl $0x4, 0x30(%rax)
jne 0x29ca7
movq 0x108(%rsp), %rax
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4(%rax)
jmp 0x29ca9
leaq 0x100(%rsp), %rdi
callq 0x2e4b0
jmp 0x298f8
movl $0xffffffff, 0xe8(%rsp) # imm = 0xFFFFFFFF
xorps %xmm0, %xmm0
movsd %xmm0, 0xe0(%rsp)
movl $0x0, 0xdc(%rsp)
cmpl $0x3, 0xdc(%rsp)
jge 0x29d89
movq 0x108(%rsp), %rax
movslq 0xdc(%rsp), %rcx
movsd 0x20(%rax,%rcx,8), %xmm0
movq 0x108(%rsp), %rax
movslq 0xdc(%rsp), %rcx
subsd 0x8(%rax,%rcx,8), %xmm0
movsd 0xf8e1(%rip), %xmm1     # 0x39600
addsd 0xe0(%rsp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x29d71
movl 0xdc(%rsp), %eax
movl %eax, 0xe8(%rsp)
movq 0x108(%rsp), %rax
movslq 0xdc(%rsp), %rcx
movsd 0x20(%rax,%rcx,8), %xmm0
movq 0x108(%rsp), %rax
movslq 0xdc(%rsp), %rcx
subsd 0x8(%rax,%rcx,8), %xmm0
movsd %xmm0, 0xe0(%rsp)
jmp 0x29d73
movl 0xdc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xdc(%rsp)
jmp 0x29cdd
movq 0x108(%rsp), %rax
cmpl $0x5, (%rax)
jle 0x29db4
movq 0x110(%rsp), %rax
movb (%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
je 0x29db4
cmpl $-0x1, 0xe8(%rsp)
jne 0x29dc5
movq 0x108(%rsp), %rax
movb $0x1, 0x38(%rax)
jmp 0x2a4ce
movq 0x108(%rsp), %rax
movb $0x0, 0x38(%rax)
movq 0x108(%rsp), %rax
movslq 0xe8(%rsp), %rcx
movsd 0x8(%rax,%rcx,8), %xmm0
movq 0x108(%rsp), %rax
movslq 0xe8(%rsp), %rcx
addsd 0x20(%rax,%rcx,8), %xmm0
movsd 0x10203(%rip), %xmm1    # 0x3a008
divsd %xmm1, %xmm0
movsd %xmm0, 0xd0(%rsp)
movq 0x108(%rsp), %rax
movslq 0xe8(%rsp), %rcx
movsd 0x8(%rax,%rcx,8), %xmm0
movq 0x108(%rsp), %rax
movslq 0xe8(%rsp), %rcx
movsd 0x20(%rax,%rcx,8), %xmm1
movsd 0x11a7a(%rip), %xmm2    # 0x3b8c0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x11a62(%rip), %xmm1    # 0x3b8b8
divsd %xmm1, %xmm0
movsd %xmm0, 0xc8(%rsp)
movq 0x108(%rsp), %rax
movslq 0xe8(%rsp), %rcx
movsd 0x8(%rax,%rcx,8), %xmm1
movq 0x108(%rsp), %rax
movslq 0xe8(%rsp), %rcx
movsd 0x20(%rax,%rcx,8), %xmm0
movsd 0x11a29(%rip), %xmm2    # 0x3b8c0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x11a11(%rip), %xmm1    # 0x3b8b8
divsd %xmm1, %xmm0
movsd %xmm0, 0xc0(%rsp)
movl $0x18, %edi
callq 0x42f0
movq %rax, %rdi
movq %rdi, 0x48(%rsp)
callq 0x2e4d0
movq 0x48(%rsp), %rcx
movq 0x108(%rsp), %rax
movq %rcx, 0x50(%rax)
movq 0x108(%rsp), %rax
movl $0x0, 0x58(%rax)
movl $0x68, %edi
callq 0x43e0
movq %rax, %rcx
movq 0x108(%rsp), %rax
movq %rcx, 0x40(%rax)
movl $0x18, %edi
callq 0x42f0
movq %rax, %rdi
movq %rdi, 0x50(%rsp)
callq 0x2e4d0
movq 0x50(%rsp), %rcx
movq 0x108(%rsp), %rax
movq 0x40(%rax), %rax
movq %rcx, 0x60(%rax)
movl $0x68, %edi
callq 0x43e0
movq %rax, %rcx
movq 0x108(%rsp), %rax
movq %rcx, 0x48(%rax)
movl $0x18, %edi
callq 0x42f0
movq %rax, %rdi
movq %rdi, 0x58(%rsp)
callq 0x2e4d0
movq 0x58(%rsp), %rcx
movq 0x108(%rsp), %rax
movq 0x48(%rax), %rax
movq %rcx, 0x60(%rax)
movq 0x108(%rsp), %rax
movq 0x60(%rax), %rdi
callq 0x2e400
movq %rax, 0xb8(%rsp)
movq 0x108(%rsp), %rax
movq 0x60(%rax), %rdi
callq 0x2e470
movq %rax, 0xb0(%rsp)
leaq 0xb8(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x2e430
testb $0x1, %al
jne 0x29fc5
jmp 0x2a2d4
leaq 0xb8(%rsp), %rdi
callq 0x2e4a0
movq (%rax), %rax
movq %rax, 0xa8(%rsp)
movsd 0xf623(%rip), %xmm0     # 0x39608
movsd %xmm0, 0xa0(%rsp)
movsd 0x1061a(%rip), %xmm0    # 0x3a610
movsd %xmm0, 0x98(%rsp)
movl $0x0, 0x94(%rsp)
movl 0x94(%rsp), %eax
movq 0xa8(%rsp), %rcx
cmpl 0x2c(%rcx), %eax
jge 0x2a13e
movsd 0xa0(%rsp), %xmm1
movq 0xa8(%rsp), %rax
addq $0x38, %rax
movslq 0x94(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq 0xe8(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x2a06a
movsd 0xa0(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
jmp 0x2a098
movq 0xa8(%rsp), %rax
addq $0x38, %rax
movslq 0x94(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq 0xe8(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0xa0(%rsp)
movsd 0x98(%rsp), %xmm0
movq 0xa8(%rsp), %rax
addq $0x38, %rax
movslq 0x94(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq 0xe8(%rsp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x2a0eb
movsd 0x98(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
jmp 0x2a119
movq 0xa8(%rsp), %rax
addq $0x38, %rax
movslq 0x94(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq 0xe8(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x98(%rsp)
movl 0x94(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x94(%rsp)
jmp 0x2a00a
movsd 0xa0(%rsp), %xmm1
movsd 0xf4b1(%rip), %xmm0     # 0x39600
addsd 0xc8(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x2a1bf
movsd 0x98(%rsp), %xmm0
movsd 0xc0(%rsp), %xmm1
movsd 0xf488(%rip), %xmm2     # 0x39600
subsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x2a1bf
movq 0x108(%rsp), %rax
movq 0x50(%rax), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x2e4e0
movq 0xa8(%rsp), %rax
cmpl $0x4, 0x30(%rax)
jne 0x2a1ba
movq 0x108(%rsp), %rax
movl 0x58(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x58(%rax)
jmp 0x2a2c0
movsd 0xa0(%rsp), %xmm0
ucomisd 0xc8(%rsp), %xmm0
jb 0x2a252
movsd 0x98(%rsp), %xmm1
movsd 0xc0(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x2a252
movsd 0xa0(%rsp), %xmm0
addsd 0x98(%rsp), %xmm0
movsd 0xfe03(%rip), %xmm1     # 0x3a008
divsd %xmm1, %xmm0
ucomisd 0xd0(%rsp), %xmm0
jbe 0x2a233
movq 0x108(%rsp), %rax
movq 0x40(%rax), %rax
movq 0x60(%rax), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x2e4e0
jmp 0x2a250
movq 0x108(%rsp), %rax
movq 0x48(%rax), %rax
movq 0x60(%rax), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x2e4e0
jmp 0x2a2be
movsd 0xa0(%rsp), %xmm0
ucomisd 0xc8(%rsp), %xmm0
jb 0x2a285
movq 0x108(%rsp), %rax
movq 0x40(%rax), %rax
movq 0x60(%rax), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x2e4e0
jmp 0x2a2bc
movsd 0x98(%rsp), %xmm1
movsd 0xc0(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x2a2ba
movq 0x108(%rsp), %rax
movq 0x48(%rax), %rax
movq 0x60(%rax), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x2e4e0
jmp 0x2a2bc
jmp 0x2a2be
jmp 0x2a2c0
jmp 0x2a2c2
leaq 0xb8(%rsp), %rdi
callq 0x2e4b0
jmp 0x29f8e
movq 0x108(%rsp), %rax
movq 0x40(%rax), %rax
movq 0x60(%rax), %rdi
callq 0x2e3e0
movq %rax, 0x30(%rsp)
movq 0x108(%rsp), %rax
movq 0x60(%rax), %rdi
callq 0x2e3e0
movq %rax, %rcx
movq 0x30(%rsp), %rax
cmpq %rcx, %rax
je 0x2a348
movq 0x108(%rsp), %rax
movq 0x48(%rax), %rax
movq 0x60(%rax), %rdi
callq 0x2e3e0
movq %rax, 0x28(%rsp)
movq 0x108(%rsp), %rax
movq 0x60(%rax), %rdi
callq 0x2e3e0
movq %rax, %rcx
movq 0x28(%rsp), %rax
cmpq %rcx, %rax
jne 0x2a46c
movq 0x108(%rsp), %rax
movsd 0x8(%rax), %xmm0
movq 0x108(%rsp), %rax
movsd 0x10(%rax), %xmm1
movq 0x108(%rsp), %rax
movsd 0x18(%rax), %xmm2
movq 0x108(%rsp), %rax
movsd 0x20(%rax), %xmm3
movq 0x108(%rsp), %rax
movsd 0x28(%rax), %xmm4
movq 0x108(%rsp), %rax
movsd 0x30(%rax), %xmm5
leaq 0x11633(%rip), %rdi     # 0x3b9d0
movb $0x6, %al
callq 0xb980
movq 0x108(%rsp), %rax
movq 0x40(%rax), %rax
movq 0x60(%rax), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, %rax
je 0x2a3d8
movq 0x20(%rsp), %rdi
callq 0x2e550
movq 0x20(%rsp), %rdi
movl $0x18, %esi
callq 0x4300
movq 0x108(%rsp), %rax
movq 0x48(%rax), %rax
movq 0x60(%rax), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, %rax
je 0x2a40c
movq 0x18(%rsp), %rdi
callq 0x2e550
movq 0x18(%rsp), %rdi
movl $0x18, %esi
callq 0x4300
movq 0x108(%rsp), %rax
movq 0x40(%rax), %rdi
callq 0x4370
movq 0x108(%rsp), %rax
movq 0x48(%rax), %rdi
callq 0x4370
movq 0x108(%rsp), %rax
movq 0x50(%rax), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x2a45e
movq 0x10(%rsp), %rdi
callq 0x2e550
movq 0x10(%rsp), %rdi
movl $0x18, %esi
callq 0x4300
movq 0x108(%rsp), %rax
movb $0x1, 0x38(%rax)
jmp 0x2a4ce
movq 0x108(%rsp), %rax
movq 0x60(%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x2a49c
movq 0x8(%rsp), %rdi
callq 0x2e550
movq 0x8(%rsp), %rdi
movl $0x18, %esi
callq 0x4300
movq 0x110(%rsp), %rdi
movq 0x108(%rsp), %rax
movq 0x40(%rax), %rsi
callq 0x29800
movq 0x110(%rsp), %rdi
movq 0x108(%rsp), %rax
movq 0x48(%rax), %rsi
callq 0x29800
addq $0x118, %rsp            # imm = 0x118
retq
nopw %cs:(%rax,%rax)