// File: /workspace/github_cpp_makefile_star2_O1/FreeSlave[P]vhlt/hlcsg/brush.cpp
// Function: ExpandBrushWithHullBrush(brush_s const*, brushhull_t const*, hullbrush_t const*, brushhull_t*)
void ExpandBrushWithHullBrush (const brush_t *brush, const brushhull_t *hull0, const hullbrush_t *hb, brushhull_t *hull)
{
	const hullbrushface_t *hbf;
	const hullbrushedge_t *hbe;
	const hullbrushvertex_t *hbv;
	bface_t *f;
	vec3_t normal;
	vec3_t origin;
	bool *axialbevel;
	bool warned;

	axialbevel = (bool *)malloc (hb->numfaces * sizeof (bool));
	memset (axialbevel, 0, hb->numfaces * sizeof (bool));
	warned = false;
	
	// check for collisions of face-vertex type. face-edge type is also permitted. face-face type is excluded.
	for (f = hull0->faces; f; f = f->next)
	{
		hullbrushface_t brushface;
		VectorCopy (f->plane->normal, brushface.normal);
		VectorCopy (f->plane->origin, brushface.point);

		// check for coplanar hull brush face
		for (hbf = hb->faces; hbf < hb->faces + hb->numfaces; hbf++)
		{
			if (-DotProduct (hbf->normal, brushface.normal) < 1 - ON_EPSILON)
			{
				continue;
			}
			// now test precisely
			vec_t dotmin;
			vec_t dotmax;
			dotmin = BOGUS_RANGE;
			dotmax = -BOGUS_RANGE;
			hlassume (hbf->numvertexes >= 1, assume_first);
			for (vec3_t *v = hbf->vertexes; v < hbf->vertexes + hbf->numvertexes; v++)
			{
				vec_t dot;
				dot = DotProduct (*v, brushface.normal);
				dotmin = qmin (dotmin, dot);
				dotmax = qmax (dotmax, dot);
			}
			if (dotmax - dotmin <= EQUAL_EPSILON)
			{
				break;
			}
		}
		if (hbf < hb->faces + hb->numfaces)
		{
			if (f->bevel)
			{
				axialbevel[hbf - hb->faces] = true;
			}
			continue; // the same plane will be added in the last stage
		}
		
		// find the impact point
		vec3_t bestvertex;
		vec_t bestdist;
		bestdist = BOGUS_RANGE;
		hlassume (hb->numvertexes >= 1, assume_first);
		for (hbv = hb->vertexes; hbv < hb->vertexes + hb->numvertexes; hbv++)
		{
			if (hbv == hb->vertexes || DotProduct (hbv->point, brushface.normal) < bestdist - NORMAL_EPSILON)
			{
				bestdist = DotProduct (hbv->point, brushface.normal);
				VectorCopy (hbv->point, bestvertex);
			}
		}

		// add hull plane for this face
		VectorCopy (brushface.normal, normal);
		if (f->bevel)
		{
			VectorCopy (brushface.point, origin);
		}
		else
		{
			VectorSubtract (brushface.point, bestvertex, origin);
		}
		AddHullPlane (hull, normal, origin, true);
	}

	// check for edge-edge type. edge-face type and face-edge type are excluded.
	for (f = hull0->faces; f; f = f->next)
	{
		for (int i = 0; i < f->w->m_NumPoints; i++) // for each edge in f
		{
			hullbrushedge_t brushedge;
			VectorCopy (f->plane->normal, brushedge.normals[0]);
			VectorCopy (f->w->m_Points[(i + 1) % f->w->m_NumPoints], brushedge.vertexes[0]);
			VectorCopy (f->w->m_Points[i], brushedge.vertexes[1]);
			VectorCopy (brushedge.vertexes[0], brushedge.point);
			VectorSubtract (brushedge.vertexes[1], brushedge.vertexes[0], brushedge.delta);

			// fill brushedge.normals[1]
			int found;
			found = 0;
			for (bface_t *f2 = hull0->faces; f2; f2 = f2->next)
			{
				for (int j = 0; j < f2->w->m_NumPoints; j++)
				{
					if (VectorCompare (f2->w->m_Points[(j + 1) % f2->w->m_NumPoints], brushedge.vertexes[1]) &&
						VectorCompare (f2->w->m_Points[j], brushedge.vertexes[0]))
					{
						VectorCopy (f2->plane->normal, brushedge.normals[1]);
						found++;
					}
				}
			}
			if (found != 1)
			{
				if (!warned)
				{
					Warning("Illegal Brush (edge without opposite face): Entity %i, Brush %i\n",
#ifdef HLCSG_COUNT_NEW
						brush->originalentitynum, brush->originalbrushnum
#else
						brush->entitynum, brush->brushnum
#endif
						);
					warned = true;
				}
				continue;
			}

			// make sure the math is accurate
			vec_t len;
			len = VectorLength (brushedge.delta);
			CrossProduct (brushedge.normals[0], brushedge.normals[1], brushedge.delta);
			if (!VectorNormalize (brushedge.delta))
			{
				continue;
			}
			VectorScale (brushedge.delta, len, brushedge.delta);

			// check for each edge in the hullbrush
			for (hbe = hb->edges; hbe < hb->edges + hb->numedges; hbe++)
			{
				vec_t dot[4];
				dot[0] = DotProduct (hbe->delta, brushedge.normals[0]);
				dot[1] = DotProduct (hbe->delta, brushedge.normals[1]);
				dot[2] = DotProduct (brushedge.delta, hbe->normals[0]);
				dot[3] = DotProduct (brushedge.delta, hbe->normals[1]);
				if (dot[0] <= ON_EPSILON || dot[1] >= -ON_EPSILON || dot[2] <= ON_EPSILON || dot[3] >= -ON_EPSILON)
				{
					continue;
				}

				// in the outer loop, each edge in the brush will be iterated twice (once from f and once from the corresponding f2)
				// but since brushedge.delta are exactly the opposite between the two iterations
				// only one of them can reach here
				vec3_t e1;
				vec3_t e2;
				VectorCopy (brushedge.delta, e1);
				VectorNormalize (e1);
				VectorCopy (hbe->delta, e2);
				VectorNormalize (e2);
				CrossProduct (e1, e2, normal);
				if (!VectorNormalize (normal))
				{
					continue;
				}
				VectorSubtract (brushedge.point, hbe->point, origin);
				AddHullPlane (hull, normal, origin, true);
			}
		}
	}

	// check for vertex-face type. edge-face type and face-face type are permitted.
	for (hbf = hb->faces; hbf < hb->faces + hb->numfaces; hbf++)
	{
		// find the impact point
		vec3_t bestvertex;
		vec_t bestdist;
		bestdist = BOGUS_RANGE;
		if (!hull0->faces)
		{
			continue;
		}
		for (f = hull0->faces; f; f = f->next)
		{
			for (vec3_t *v = f->w->m_Points; v < f->w->m_Points + f->w->m_NumPoints; v++)
			{
				if (DotProduct (*v, hbf->normal) < bestdist - NORMAL_EPSILON)
				{
					bestdist = DotProduct (*v, hbf->normal);
					VectorCopy (*v, bestvertex);
				}
			}
		}

		// add hull plane for this face
		VectorSubtract (vec3_origin, hbf->normal, normal);
		if (axialbevel[hbf - hb->faces])
		{
			VectorCopy (bestvertex, origin);
		}
		else
		{
			VectorSubtract (bestvertex, hbf->point, origin);
		}
		AddHullPlane (hull, normal, origin, true);
	}

	free (axialbevel);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq %rcx, 0x90(%rsp)
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, 0xf0(%rsp)
movslq (%rdx), %r12
movq %r12, %rdi
callq 0x4430
movq %rax, 0xb0(%rsp)
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x41c0
movq %rbx, 0x98(%rsp)
movq 0x30(%rbx), %rbx
testq %rbx, %rbx
je 0xe7fa
leaq 0x70(%rsp), %r12
leaq 0x50(%rsp), %rbp
movq 0x10(%rbx), %rax
movupd (%rax), %xmm5
movsd 0x10(%rax), %xmm4
movups 0x18(%rax), %xmm0
movaps %xmm0, 0x20(%rsp)
movsd 0x28(%rax), %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x8(%r14), %r15
cmpl $0x0, (%r14)
movsd %xmm4, (%rsp)
movapd %xmm5, 0x10(%rsp)
jle 0xe652
movapd %xmm5, %xmm6
unpckhpd %xmm5, %xmm6            # xmm6 = xmm6[1],xmm5[1]
movapd %xmm6, 0x40(%rsp)
movsd 0x8(%r15), %xmm0
mulsd %xmm6, %xmm0
movsd (%r15), %xmm1
mulsd %xmm5, %xmm1
addsd %xmm0, %xmm1
movsd 0x10(%r15), %xmm0
mulsd %xmm4, %xmm0
addsd %xmm1, %xmm0
ucomisd 0x10f85(%rip), %xmm0    # 0x1f528
ja 0xe63a
xorl %edi, %edi
cmpl $0x0, 0x30(%r15)
setg %dil
xorl %esi, %esi
callq 0xaa4d
movslq 0x30(%r15), %rcx
testq %rcx, %rcx
jle 0xe652
movq 0x38(%r15), %rax
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rcx
movsd 0x10f5c(%rip), %xmm0    # 0x1f538
movsd 0x10f4c(%rip), %xmm1    # 0x1f530
movsd (%rsp), %xmm4
movapd 0x10(%rsp), %xmm5
movapd 0x40(%rsp), %xmm6
movsd 0x8(%rax), %xmm2
mulsd %xmm6, %xmm2
movsd (%rax), %xmm3
mulsd %xmm5, %xmm3
addsd %xmm2, %xmm3
movsd 0x10(%rax), %xmm2
mulsd %xmm4, %xmm2
addsd %xmm3, %xmm2
minsd %xmm2, %xmm0
maxsd %xmm2, %xmm1
addq $0x18, %rax
cmpq %rcx, %rax
jb 0xe5f5
subsd %xmm0, %xmm1
movsd 0x10f0c(%rip), %xmm0    # 0x1f540
ucomisd %xmm1, %xmm0
jae 0xe652
addq $0x40, %r15
movslq (%r14), %rax
shlq $0x6, %rax
addq 0x8(%r14), %rax
cmpq %rax, %r15
jb 0xe576
movq 0x8(%r14), %rax
movslq (%r14), %rcx
shlq $0x6, %rcx
addq %rax, %rcx
cmpq %rcx, %r15
jae 0xe688
cmpb $0x1, 0x30(%rbx)
jne 0xe7ee
subq %rax, %r15
sarq $0x6, %r15
movq 0xb0(%rsp), %rax
movb $0x1, (%rax,%r15)
jmp 0xe7ee
xorl %edi, %edi
cmpl $0x0, 0x20(%r14)
setg %dil
xorl %esi, %esi
callq 0xaa4d
movslq 0x20(%r14), %rcx
testq %rcx, %rcx
jle 0xe760
movq 0x28(%r14), %rax
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rcx
movapd 0x10(%rsp), %xmm7
movapd %xmm7, %xmm0
unpckhpd %xmm7, %xmm0            # xmm0 = xmm0[1],xmm7[1]
xorl %edx, %edx
movsd 0x10e6d(%rip), %xmm1    # 0x1f538
movapd 0xa0(%rsp), %xmm4
movsd 0xd0(%rsp), %xmm5
movsd (%rsp), %xmm6
testq %rdx, %rdx
je 0xe71e
movsd 0x8(%rax,%rdx), %xmm2
mulsd %xmm0, %xmm2
movsd (%rax,%rdx), %xmm3
mulsd %xmm7, %xmm3
addsd %xmm2, %xmm3
movsd 0x10(%rax,%rdx), %xmm2
mulsd %xmm6, %xmm2
addsd %xmm3, %xmm2
movapd %xmm1, %xmm3
addsd 0x10e30(%rip), %xmm3    # 0x1f548
ucomisd %xmm2, %xmm3
jbe 0xe74d
movupd (%rax,%rdx), %xmm4
movapd %xmm7, %xmm1
mulpd %xmm4, %xmm1
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
movapd %xmm4, %xmm2
mulsd %xmm7, %xmm2
addsd %xmm1, %xmm2
movsd 0x10(%rax,%rdx), %xmm5
movapd %xmm5, %xmm1
mulsd %xmm6, %xmm1
addsd %xmm2, %xmm1
leaq (%rax,%rdx), %rsi
addq $0x18, %rsi
addq $0x18, %rdx
cmpq %rcx, %rsi
jb 0xe6e2
jmp 0xe77d
movapd 0xa0(%rsp), %xmm4
movsd 0xd0(%rsp), %xmm5
movsd (%rsp), %xmm6
movapd 0x10(%rsp), %xmm7
movapd %xmm7, 0x70(%rsp)
movsd %xmm6, 0x80(%rsp)
cmpb $0x1, 0x30(%rbx)
movapd %xmm4, 0xa0(%rsp)
movsd %xmm5, 0xd0(%rsp)
jne 0xe7b6
movaps 0x20(%rsp), %xmm0
movaps %xmm0, 0x50(%rsp)
movsd 0x30(%rsp), %xmm0
jmp 0xe7d0
movapd 0x20(%rsp), %xmm0
subpd %xmm4, %xmm0
movapd %xmm0, 0x50(%rsp)
movsd 0x30(%rsp), %xmm0
subsd %xmm5, %xmm0
movsd %xmm0, 0x60(%rsp)
movq 0x90(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rdx
movl $0x1, %ecx
callq 0xe45c
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0xe52e
movq 0x98(%rsp), %rax
movq 0x30(%rax), %rbp
testq %rbp, %rbp
je 0xf105
xorl %r13d, %r13d
movapd 0x10af6(%rip), %xmm5    # 0x1f310
movsd 0x10d1e(%rip), %xmm6    # 0x1f540
movq $0x0, 0xb8(%rsp)
movq 0x18(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0xf0f8
xorl %r12d, %r12d
movq 0x10(%rbp), %rax
movsd (%rax), %xmm7
movsd %xmm7, 0x110(%rsp)
movups 0x8(%rax), %xmm0
movaps %xmm0, (%rsp)
movups %xmm0, 0x118(%rsp)
movq 0x18(%rbp), %rsi
movq 0x10(%rsi), %rcx
leaq (%r12,%r12,2), %rdi
incq %r12
movl %r12d, %eax
xorl %edx, %edx
divl 0x8(%rsi)
leaq (%rdx,%rdx,2), %rax
movsd (%rcx,%rax,8), %xmm3
movsd %xmm3, 0x158(%rsp)
movq 0x18(%rbp), %rcx
movq 0x10(%rcx), %rsi
movl %r12d, %eax
xorl %edx, %edx
divl 0x8(%rcx)
leaq (%rdx,%rdx,2), %rax
movsd 0x8(%rsi,%rax,8), %xmm2
movsd %xmm2, 0x160(%rsp)
movq 0x18(%rbp), %rcx
movq 0x10(%rcx), %rsi
movl %r12d, %eax
xorl %edx, %edx
divl 0x8(%rcx)
leaq (%rdx,%rdx,2), %rax
movsd 0x10(%rsi,%rax,8), %xmm4
movsd %xmm4, 0x168(%rsp)
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movsd 0x10(%rax,%rdi,8), %xmm0
movsd %xmm0, 0x180(%rsp)
movsd %xmm3, 0x140(%rsp)
movsd %xmm2, 0x148(%rsp)
movsd %xmm4, 0x150(%rsp)
movupd (%rax,%rdi,8), %xmm1
movupd %xmm1, 0x170(%rsp)
unpcklpd %xmm2, %xmm3            # xmm3 = xmm3[0],xmm2[0]
movapd %xmm3, 0x1e0(%rsp)
subpd %xmm3, %xmm1
movupd %xmm1, 0x188(%rsp)
movsd %xmm4, 0x108(%rsp)
subsd %xmm4, %xmm0
movsd %xmm0, 0x198(%rsp)
movq 0x98(%rsp), %rax
movq 0x30(%rax), %rax
testq %rax, %rax
je 0xeaa1
movsd 0x158(%rsp), %xmm2
movsd 0x170(%rsp), %xmm3
xorl %ecx, %ecx
movq 0x18(%rax), %rsi
movl 0x8(%rsi), %edx
testl %edx, %edx
je 0xea5b
movq 0x10(%rsi), %rsi
leaq 0x8(%rsi), %rdi
xorl %r8d, %r8d
movl %r8d, %r9d
leal 0x1(%r9), %r8d
cmpl %edx, %r8d
movl %r8d, %r10d
cmovel %r13d, %r10d
leaq (%r10,%r10,2), %r11
movsd (%rsi,%r11,8), %xmm4
subsd %xmm3, %xmm4
andpd %xmm5, %xmm4
ucomisd %xmm6, %xmm4
ja 0xea52
movslq %r9d, %r9
leaq (%r9,%r9,2), %r10
leaq (%rdi,%r10,8), %r9
leaq (%rdi,%r11,8), %r11
xorl %ebx, %ebx
movq %rbx, %r15
cmpq $0x2, %rbx
je 0xe9e7
movsd (%r11,%r15,8), %xmm4
subsd 0x178(%rsp,%r15,8), %xmm4
andpd %xmm5, %xmm4
leaq 0x1(%r15), %rbx
ucomisd %xmm6, %xmm4
jbe 0xe9c0
cmpq $0x2, %r15
jb 0xea52
movsd (%rsi,%r10,8), %xmm4
subsd %xmm2, %xmm4
andpd %xmm5, %xmm4
ucomisd %xmm6, %xmm4
ja 0xea52
xorl %r11d, %r11d
movq %r11, %r10
cmpq $0x2, %r11
je 0xea2b
movsd (%r9,%r10,8), %xmm4
subsd 0x160(%rsp,%r10,8), %xmm4
andpd %xmm5, %xmm4
leaq 0x1(%r10), %r11
ucomisd %xmm6, %xmm4
jbe 0xea04
cmpq $0x2, %r10
jb 0xea52
movq 0x10(%rax), %r9
movups (%r9), %xmm4
movups %xmm4, 0x128(%rsp)
movsd 0x10(%r9), %xmm4
movsd %xmm4, 0x138(%rsp)
incl %ecx
cmpl %edx, %r8d
jne 0xe982
movq (%rax), %rax
testq %rax, %rax
jne 0xe968
cmpl $0x1, %ecx
jne 0xeaa1
movapd %xmm1, %xmm2
mulpd %xmm1, %xmm2
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
mulsd %xmm1, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
ucomisd 0x10820(%rip), %xmm0    # 0x1f2b0
movapd %xmm7, 0x40(%rsp)
jb 0xeae9
xorps %xmm2, %xmm2
sqrtsd %xmm0, %xmm2
jmp 0xeaf8
testb $0x1, 0xb8(%rsp)
jne 0xf0e8
movq 0xf0(%rsp), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
leaq 0x10b65(%rip), %rdi     # 0x1f628
xorl %eax, %eax
callq 0xa612
movsd 0x10a6e(%rip), %xmm6    # 0x1f540
movapd 0x10836(%rip), %xmm5    # 0x1f310
movb $0x1, %al
movq %rax, 0xb8(%rsp)
jmp 0xf0e8
callq 0x4260
movapd 0x40(%rsp), %xmm7
movapd %xmm0, %xmm2
movapd (%rsp), %xmm1
movapd %xmm1, %xmm0
shufpd $0x1, %xmm7, %xmm0      # xmm0 = xmm0[1],xmm7[0]
movsd 0x128(%rsp), %xmm8
movupd 0x130(%rsp), %xmm3
mulpd %xmm3, %xmm0
movapd %xmm3, %xmm4
shufpd $0x1, %xmm8, %xmm4      # xmm4 = xmm4[1],xmm8[0]
mulpd %xmm1, %xmm4
subpd %xmm0, %xmm4
movupd %xmm4, 0x188(%rsp)
movapd %xmm8, %xmm0
mulsd %xmm1, %xmm0
movapd %xmm7, %xmm9
movapd %xmm3, 0x10(%rsp)
mulsd %xmm3, %xmm9
subsd %xmm0, %xmm9
movsd %xmm9, 0x198(%rsp)
movapd %xmm4, %xmm0
mulpd %xmm4, %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
movapd %xmm4, %xmm1
mulsd %xmm4, %xmm1
addsd %xmm0, %xmm1
movapd %xmm9, %xmm0
mulsd %xmm9, %xmm0
addsd %xmm1, %xmm0
ucomisd 0x10722(%rip), %xmm0    # 0x1f2b0
jb 0xeb96
sqrtsd %xmm0, %xmm0
jmp 0xebe1
movapd %xmm2, 0xc0(%rsp)
movapd %xmm8, 0x30(%rsp)
movapd %xmm4, 0x20(%rsp)
movapd %xmm9, 0xa0(%rsp)
callq 0x4260
movapd 0xa0(%rsp), %xmm9
movapd 0x20(%rsp), %xmm4
movapd 0x30(%rsp), %xmm8
movapd 0x40(%rsp), %xmm7
movapd 0xc0(%rsp), %xmm2
movapd 0x10727(%rip), %xmm5    # 0x1f310
movsd 0x1094f(%rip), %xmm6    # 0x1f540
movsd 0xd517(%rip), %xmm1     # 0x1c110
ucomisd %xmm0, %xmm1
ja 0xec25
movapd %xmm0, %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
divpd %xmm1, %xmm4
movupd %xmm4, 0x188(%rsp)
divsd %xmm0, %xmm9
movsd %xmm9, 0x198(%rsp)
jmp 0xec3d
leaq 0x188(%rsp), %rax
xorpd %xmm1, %xmm1
movupd %xmm1, (%rax)
movq $0x0, 0x10(%rax)
movsd 0xd4cb(%rip), %xmm1     # 0x1c110
ucomisd %xmm0, %xmm1
ja 0xf0e8
movsd 0x188(%rsp), %xmm3
mulsd %xmm2, %xmm3
movsd %xmm3, 0x188(%rsp)
movupd 0x190(%rsp), %xmm0
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
mulpd %xmm0, %xmm2
movupd %xmm2, 0x190(%rsp)
cmpl $0x0, 0x10(%r14)
jle 0xf0e8
movq 0x18(%r14), %r15
movapd %xmm2, %xmm0
mulsd %xmm2, %xmm0
movapd %xmm3, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm0, %xmm1
movapd %xmm2, %xmm4
unpckhpd %xmm2, %xmm4            # xmm4 = xmm4[1],xmm2[1]
mulsd %xmm4, %xmm4
addsd %xmm1, %xmm4
movapd %xmm3, %xmm0
unpcklpd %xmm7, %xmm0            # xmm0 = xmm0[0],xmm7[0]
movapd %xmm0, 0x40(%rsp)
movapd %xmm3, 0x1a0(%rsp)
unpcklpd %xmm8, %xmm3            # xmm3 = xmm3[0],xmm8[0]
movapd %xmm3, 0xa0(%rsp)
movapd %xmm2, %xmm1
movapd (%rsp), %xmm0
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movapd %xmm1, 0x30(%rsp)
movhlps %xmm2, %xmm0            # xmm0 = xmm2[1],xmm0[1]
movaps %xmm0, (%rsp)
movaps %xmm2, %xmm1
movaps 0x10(%rsp), %xmm0
movlhps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movaps %xmm1, 0xd0(%rsp)
movaps %xmm2, 0xc0(%rsp)
movhlps %xmm2, %xmm0            # xmm0 = xmm2[1],xmm0[1]
movaps %xmm0, 0x10(%rsp)
movapd %xmm4, 0x1b0(%rsp)
xorps %xmm0, %xmm0
sqrtsd %xmm4, %xmm0
movsd %xmm0, 0x100(%rsp)
movsd 0x80(%r15), %xmm0
movsd (%r15), %xmm3
movsd 0x8(%r15), %xmm2
movsd 0x10(%r15), %xmm4
unpcklpd %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
mulpd 0x30(%rsp), %xmm2
movsd 0x78(%r15), %xmm1
unpcklpd %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0]
mulpd 0x40(%rsp), %xmm3
addpd %xmm2, %xmm3
movsd 0x88(%r15), %xmm2
unpcklpd %xmm2, %xmm4            # xmm4 = xmm4[0],xmm2[0]
mulpd (%rsp), %xmm4
addpd %xmm3, %xmm4
cmplepd 0x1073c(%rip), %xmm4    # 0x1f4c0
movmskpd %xmm4, %eax
testb $0x2, %al
jne 0xf0c8
movsd 0x18(%r15), %xmm3
movsd 0x20(%r15), %xmm4
unpcklpd %xmm0, %xmm4            # xmm4 = xmm4[0],xmm0[0]
mulpd 0xd0(%rsp), %xmm4
unpcklpd %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0]
mulpd 0xa0(%rsp), %xmm3
addpd %xmm4, %xmm3
movsd 0x28(%r15), %xmm0
unpcklpd %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0]
mulpd 0x10(%rsp), %xmm0
addpd %xmm3, %xmm0
movapd 0x106fa(%rip), %xmm1    # 0x1f4d0
cmplepd %xmm0, %xmm1
movmskpd %xmm1, %ecx
movl %ecx, %edx
shrb %dl
jne 0xf0c8
testb $0x1, %al
jne 0xf0c8
testb $0x1, %cl
jne 0xf0c8
movapd 0x1b0(%rsp), %xmm0
ucomisd 0x104a5(%rip), %xmm0    # 0x1f2b0
movsd 0x100(%rsp), %xmm8
jae 0xee2a
movapd 0x1b0(%rsp), %xmm0
callq 0x4260
movapd %xmm0, %xmm8
movapd %xmm8, %xmm7
cmpltsd 0xd2d8(%rip), %xmm7     # 0x1c110
movsd 0x78(%r15), %xmm6
movsd 0x80(%r15), %xmm9
movsd 0x88(%r15), %xmm5
movapd %xmm9, %xmm0
mulsd %xmm9, %xmm0
movapd %xmm6, %xmm1
mulsd %xmm6, %xmm1
addsd %xmm0, %xmm1
movapd %xmm5, %xmm0
mulsd %xmm5, %xmm0
addsd %xmm1, %xmm0
ucomisd 0x10436(%rip), %xmm0    # 0x1f2b0
jb 0xee82
sqrtsd %xmm0, %xmm0
jmp 0xeedf
movapd %xmm7, 0x20(%rsp)
movapd %xmm5, 0xe0(%rsp)
movapd %xmm6, 0x1d0(%rsp)
movapd %xmm8, 0x1c0(%rsp)
movsd %xmm9, 0xf8(%rsp)
callq 0x4260
movsd 0xf8(%rsp), %xmm9
movapd 0x1c0(%rsp), %xmm8
movapd 0x1d0(%rsp), %xmm6
movapd 0xe0(%rsp), %xmm5
movapd 0x20(%rsp), %xmm7
movapd 0xc0(%rsp), %xmm4
movapd 0x1a0(%rsp), %xmm3
xorl %edx, %edx
movsd 0xd215(%rip), %xmm1     # 0x1c110
ucomisd %xmm8, %xmm1
seta %sil
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %cl
xorpd %xmm1, %xmm1
xorpd %xmm2, %xmm2
ja 0xef21
divsd %xmm0, %xmm9
movapd %xmm9, %xmm2
divsd %xmm8, %xmm3
andnpd %xmm3, %xmm7
unpcklpd %xmm8, %xmm8            # xmm8 = xmm8[0,0]
divpd %xmm8, %xmm4
movb %sil, %dl
movd %edx, %xmm3
pshufd $0x0, %xmm3, %xmm3      # xmm3 = xmm3[0,0,0,0]
pslld $0x1f, %xmm3
psrad $0x1f, %xmm3
pandn %xmm4, %xmm3
unpcklpd %xmm6, %xmm5            # xmm5 = xmm5[0],xmm6[0]
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
divpd %xmm0, %xmm5
movb %cl, %al
movd %eax, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
pslld $0x1f, %xmm0
psrad $0x1f, %xmm0
pandn %xmm5, %xmm0
movdqa %xmm3, %xmm8
pshufd $0xee, %xmm0, %xmm4     # xmm4 = xmm0[2,3,2,3]
mulsd %xmm3, %xmm4
shufpd $0x1, %xmm7, %xmm3      # xmm3 = xmm3[1],xmm7[0]
mulsd %xmm2, %xmm7
unpcklpd %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
mulpd %xmm3, %xmm2
mulpd %xmm0, %xmm8
subpd %xmm2, %xmm8
movapd %xmm8, 0x70(%rsp)
subsd %xmm4, %xmm7
movsd %xmm7, 0x80(%rsp)
movapd %xmm8, %xmm0
mulpd %xmm8, %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
movapd %xmm8, %xmm2
mulsd %xmm8, %xmm2
addsd %xmm0, %xmm2
movapd %xmm7, %xmm0
mulsd %xmm7, %xmm0
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jb 0xefe4
sqrtsd %xmm0, %xmm0
jmp 0xf009
movapd %xmm7, 0x20(%rsp)
movapd %xmm8, 0xe0(%rsp)
callq 0x4260
movapd 0xe0(%rsp), %xmm8
movapd 0x20(%rsp), %xmm7
movapd 0x102ff(%rip), %xmm5    # 0x1f310
movsd 0x10527(%rip), %xmm6    # 0x1f540
movsd 0xd0ef(%rip), %xmm1     # 0x1c110
ucomisd %xmm0, %xmm1
ja 0xf04a
movapd %xmm0, %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
divpd %xmm1, %xmm8
movapd %xmm8, 0x70(%rsp)
divsd %xmm0, %xmm7
movsd %xmm7, 0x80(%rsp)
jmp 0xf060
xorpd %xmm1, %xmm1
movapd %xmm1, 0x70(%rsp)
movq $0x0, 0x80(%rsp)
movsd 0xd0a8(%rip), %xmm1     # 0x1c110
ucomisd %xmm0, %xmm1
ja 0xf0c8
movupd 0x30(%r15), %xmm0
movapd 0x1e0(%rsp), %xmm1
subpd %xmm0, %xmm1
movapd %xmm1, 0x50(%rsp)
movsd 0x108(%rsp), %xmm0
subsd 0x40(%r15), %xmm0
movsd %xmm0, 0x60(%rsp)
movq 0x90(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movl $0x1, %ecx
callq 0xe45c
movsd 0x10480(%rip), %xmm6    # 0x1f540
movapd 0x10248(%rip), %xmm5    # 0x1f310
addq $0x90, %r15
movslq 0x10(%r14), %rax
leaq (%rax,%rax,8), %rax
shlq $0x4, %rax
addq 0x18(%r14), %rax
cmpq %rax, %r15
jb 0xed2d
movq 0x18(%rbp), %rax
movl 0x8(%rax), %eax
cmpq %rax, %r12
jb 0xe83f
movq (%rbp), %rbp
testq %rbp, %rbp
jne 0xe82e
cmpl $0x0, (%r14)
movq 0xb0(%rsp), %r15
jle 0xf2f5
movq 0x8(%r14), %rax
leaq 0xecee(%rip), %rcx      # 0x1de10
movaps (%rcx), %xmm0
movaps %xmm0, 0x40(%rsp)
movsd 0x10(%rcx), %xmm0
movsd %xmm0, 0x30(%rsp)
leaq 0x70(%rsp), %r12
leaq 0x50(%rsp), %r13
movsd 0x10400(%rip), %xmm9    # 0x1f548
movq %rax, %rbx
movq 0x98(%rsp), %rcx
movq 0x30(%rcx), %rcx
testq %rcx, %rcx
movapd (%rsp), %xmm10
movsd 0x10(%rsp), %xmm11
je 0xf2da
movsd 0x103c3(%rip), %xmm0    # 0x1f538
movq 0x18(%rcx), %rdx
movl 0x8(%rdx), %esi
testq %rsi, %rsi
je 0xf22b
movq 0x10(%rdx), %rdx
leaq (%rsi,%rsi,2), %rsi
leaq (%rdx,%rsi,8), %rsi
movsd (%rbx), %xmm1
movsd 0x8(%rbx), %xmm2
movsd 0x10(%rbx), %xmm3
movapd %xmm11, %xmm5
movapd %xmm10, %xmm4
movupd (%rdx), %xmm10
movapd %xmm10, %xmm6
unpckhpd %xmm10, %xmm6           # xmm6 = xmm6[1],xmm10[1]
mulsd %xmm2, %xmm6
movapd %xmm10, %xmm8
mulsd %xmm1, %xmm8
addsd %xmm6, %xmm8
movsd 0x10(%rdx), %xmm11
movapd %xmm11, %xmm7
mulsd %xmm3, %xmm7
addsd %xmm8, %xmm7
movapd %xmm0, %xmm8
addsd %xmm9, %xmm8
ucomisd %xmm7, %xmm8
ja 0xf1f5
movapd %xmm5, %xmm11
ja 0xf1fc
movapd %xmm4, %xmm10
movapd %xmm7, %xmm6
cmpltsd %xmm8, %xmm6
andpd %xmm6, %xmm7
andnpd %xmm0, %xmm6
orpd %xmm7, %xmm6
addq $0x18, %rdx
movapd %xmm6, %xmm0
movapd %xmm11, %xmm5
movapd %xmm10, %xmm4
cmpq %rsi, %rdx
jb 0xf1a9
jmp 0xf22f
movapd %xmm0, %xmm6
movq (%rcx), %rcx
movapd %xmm6, %xmm0
testq %rcx, %rcx
jne 0xf175
movupd (%rbx), %xmm0
movapd 0x40(%rsp), %xmm1
subpd %xmm0, %xmm1
movapd %xmm1, 0x70(%rsp)
movsd 0x30(%rsp), %xmm0
subsd 0x10(%rbx), %xmm0
movsd %xmm0, 0x80(%rsp)
movq %rbx, %rcx
subq %rax, %rcx
sarq $0x6, %rcx
cmpb $0x1, (%r15,%rcx)
movapd %xmm10, (%rsp)
movsd %xmm11, 0x10(%rsp)
jne 0xf295
movapd %xmm10, 0x50(%rsp)
movsd %xmm11, 0x60(%rsp)
jmp 0xf2b9
movupd 0x18(%rbx), %xmm0
movapd %xmm10, %xmm1
subpd %xmm0, %xmm1
movapd %xmm1, 0x50(%rsp)
movapd %xmm11, %xmm0
subsd 0x28(%rbx), %xmm0
movsd %xmm0, 0x60(%rsp)
movq 0x90(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
movl $0x1, %ecx
callq 0xe45c
movsd 0x1026e(%rip), %xmm9    # 0x1f548
addq $0x40, %rbx
movq 0x8(%r14), %rax
movslq (%r14), %rcx
shlq $0x6, %rcx
addq %rax, %rcx
cmpq %rcx, %rbx
jb 0xf14b
movq %r15, %rdi
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x43a0