// File: /workspace/github_cpp_makefile_star2_O3/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 $0x1c8, %rsp            # imm = 0x1C8
movq %rcx, 0x20(%rsp)
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, 0xd8(%rsp)
movslq (%rdx), %rsi
movl $0x1, %edi
callq 0x4200
movq %rax, 0x98(%rsp)
movq %rbx, 0x28(%rsp)
movq 0x30(%rbx), %rbx
testq %rbx, %rbx
je 0xed28
movsd 0x1124d(%rip), %xmm7    # 0x1f520
leaq 0x50(%rsp), %r12
leaq 0x30(%rsp), %rbp
movq 0x10(%rbx), %rax
movupd (%rax), %xmm5
movsd 0x10(%rax), %xmm4
movups 0x18(%rax), %xmm0
movaps %xmm0, 0xc0(%rsp)
movsd 0x28(%rax), %xmm0
movsd %xmm0, 0x70(%rsp)
movq 0x8(%r14), %rax
movl (%r14), %ecx
testl %ecx, %ecx
movsd %xmm4, 0x10(%rsp)
movapd %xmm5, (%rsp)
jle 0xe416
movapd %xmm5, %xmm6
unpckhpd %xmm5, %xmm6            # xmm6 = xmm6[1],xmm5[1]
movq %rax, %r15
movapd %xmm6, 0x80(%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 0x111ac(%rip), %xmm0    # 0x1f508
ja 0xe3fd
xorl %edi, %edi
cmpl $0x0, 0x30(%r15)
setg %dil
xorl %esi, %esi
callq 0xa91d
movslq 0x30(%r15), %rcx
testq %rcx, %rcx
jle 0xe41b
movq 0x38(%r15), %rax
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rcx
movsd 0x11183(%rip), %xmm0    # 0x1f518
movsd 0x11173(%rip), %xmm1    # 0x1f510
movsd 0x10(%rsp), %xmm4
movapd (%rsp), %xmm5
movapd 0x80(%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 0xe3b1
subsd %xmm0, %xmm1
movsd 0x11130(%rip), %xmm7    # 0x1f520
ucomisd %xmm1, %xmm7
movq 0x8(%r14), %rax
movl (%r14), %ecx
jae 0xe42a
addq $0x40, %r15
movslq %ecx, %rdx
shlq $0x6, %rdx
addq %rax, %rdx
cmpq %rdx, %r15
jb 0xe32f
jmp 0xe42a
movq %rax, %r15
jmp 0xe42a
movq 0x8(%r14), %rax
movl (%r14), %ecx
movsd 0x110f6(%rip), %xmm7    # 0x1f520
movslq %ecx, %rcx
shlq $0x6, %rcx
addq %rax, %rcx
cmpq %rcx, %r15
jae 0xe45c
cmpb $0x1, 0x30(%rbx)
jne 0xe5fe
subq %rax, %r15
sarq $0x6, %r15
movq 0x98(%rsp), %rax
movb $0x1, (%rax,%r15)
jmp 0xe5fe
xorl %edi, %edi
cmpl $0x0, 0x20(%r14)
setg %dil
xorl %esi, %esi
callq 0xa91d
movslq 0x20(%r14), %rcx
testq %rcx, %rcx
jle 0xe55e
movq 0x28(%r14), %rax
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rcx
movapd (%rsp), %xmm11
movapd %xmm11, %xmm0
unpckhpd %xmm11, %xmm0           # xmm0 = xmm0[1],xmm11[1]
xorl %edx, %edx
movsd 0x11077(%rip), %xmm1    # 0x1f518
movsd 0x1107f(%rip), %xmm7    # 0x1f528
movsd 0xb0(%rsp), %xmm8
movapd 0xa0(%rsp), %xmm9
movsd 0x10(%rsp), %xmm10
movsd (%rax,%rdx), %xmm2
movapd %xmm2, %xmm3
mulsd %xmm11, %xmm3
testq %rdx, %rdx
je 0xe519
movsd 0x8(%rax,%rdx), %xmm4
movsd 0x10(%rax,%rdx), %xmm5
movapd %xmm0, %xmm6
mulsd %xmm4, %xmm6
addsd %xmm6, %xmm3
movapd %xmm5, %xmm6
mulsd %xmm10, %xmm6
addsd %xmm3, %xmm6
movapd %xmm1, %xmm3
addsd %xmm7, %xmm3
ucomisd %xmm6, %xmm3
jbe 0xe547
unpcklpd %xmm4, %xmm2            # xmm2 = xmm2[0],xmm4[0]
movapd %xmm5, %xmm8
movapd %xmm6, %xmm1
jmp 0xe542
movsd 0x8(%rax), %xmm4
movsd 0x10(%rax), %xmm8
movapd %xmm0, %xmm1
mulsd %xmm4, %xmm1
addsd %xmm1, %xmm3
movapd %xmm8, %xmm1
mulsd %xmm10, %xmm1
addsd %xmm3, %xmm1
unpcklpd %xmm4, %xmm2            # xmm2 = xmm2[0],xmm4[0]
movapd %xmm2, %xmm9
leaq (%rax,%rdx), %rsi
addq $0x18, %rsi
addq $0x18, %rdx
cmpq %rcx, %rsi
jb 0xe4c4
jmp 0xe57f
movsd 0xb0(%rsp), %xmm8
movapd 0xa0(%rsp), %xmm9
movsd 0x10(%rsp), %xmm10
movapd (%rsp), %xmm11
movapd %xmm11, 0x50(%rsp)
movsd %xmm10, 0x60(%rsp)
cmpb $0x1, 0x30(%rbx)
movsd %xmm8, 0xb0(%rsp)
movapd %xmm9, 0xa0(%rsp)
jne 0xe5bc
movaps 0xc0(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movsd 0x70(%rsp), %xmm0
jmp 0xe5db
movapd 0xc0(%rsp), %xmm0
subpd %xmm9, %xmm0
movapd %xmm0, 0x30(%rsp)
movsd 0x70(%rsp), %xmm0
subsd %xmm8, %xmm0
movsd %xmm0, 0x40(%rsp)
movq 0x20(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rdx
movl $0x1, %ecx
callq 0xe214
movsd 0x10f22(%rip), %xmm7    # 0x1f520
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0xe2dd
movq 0x28(%rsp), %rax
movq 0x30(%rax), %r12
testq %r12, %r12
je 0xed28
xorl %ebp, %ebp
movsd 0xdaf1(%rip), %xmm8     # 0x1c118
movapd 0x10e70(%rip), %xmm9    # 0x1f4a0
movapd 0x10e77(%rip), %xmm10   # 0x1f4b0
movapd 0x10cae(%rip), %xmm11   # 0x1f2f0
xorl %r13d, %r13d
movq 0x18(%r12), %rcx
movl 0x8(%rcx), %eax
testl %eax, %eax
je 0xed15
xorl %ebx, %ebx
movq 0x10(%r12), %rdx
movupd (%rdx), %xmm14
movapd %xmm14, 0x130(%rsp)
movsd 0x10(%rdx), %xmm0
movsd %xmm0, 0x140(%rsp)
movq 0x10(%rcx), %rcx
leaq (%rbx,%rbx,2), %rdx
incq %rbx
movl %eax, %eax
cmpq %rax, %rbx
movl $0x0, %eax
cmovneq %rbx, %rax
leaq (%rax,%rax,2), %rax
movupd (%rcx,%rax,8), %xmm13
movupd %xmm13, 0x178(%rsp)
movsd 0x10(%rcx,%rax,8), %xmm4
movsd %xmm4, 0x188(%rsp)
movsd 0x10(%rcx,%rdx,8), %xmm1
movsd %xmm1, 0x1a0(%rsp)
movapd %xmm13, 0x160(%rsp)
movsd %xmm4, 0x170(%rsp)
movupd (%rcx,%rdx,8), %xmm3
movapd %xmm3, 0x190(%rsp)
movapd %xmm3, %xmm2
subpd %xmm13, %xmm2
movupd %xmm2, 0x1a8(%rsp)
movsd %xmm4, 0x80(%rsp)
subsd %xmm4, %xmm1
movsd %xmm1, 0x1b8(%rsp)
movq 0x28(%rsp), %rax
movq 0x30(%rax), %rax
testq %rax, %rax
je 0xecaf
xorl %ecx, %ecx
movq 0x18(%rax), %rsi
movl 0x8(%rsi), %edx
testl %edx, %edx
je 0xe818
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 %ebp, %r10d
leaq (%r10,%r10,2), %r11
movsd (%rsi,%r11,8), %xmm4
subsd %xmm3, %xmm4
andpd %xmm11, %xmm4
ucomisd %xmm7, %xmm4
ja 0xe80f
movslq %r9d, %r9
leaq (%r9,%r9,2), %r10
leaq (%rdi,%r10,8), %r9
leaq (%rdi,%r11,8), %r15
xorl %r11d, %r11d
cmpq $0x2, %r11
je 0xe7a8
movsd (%r15,%r11,8), %xmm4
subsd 0x198(%rsp,%r11,8), %xmm4
andpd %xmm11, %xmm4
incq %r11
ucomisd %xmm7, %xmm4
jbe 0xe77b
decq %r11
cmpq $0x2, %r11
jb 0xe80f
movsd (%rsi,%r10,8), %xmm4
subsd %xmm13, %xmm4
andpd %xmm11, %xmm4
ucomisd %xmm7, %xmm4
ja 0xe80f
xorl %r10d, %r10d
cmpq $0x2, %r10
je 0xe7ee
movsd (%r9,%r10,8), %xmm4
subsd 0x180(%rsp,%r10,8), %xmm4
andpd %xmm11, %xmm4
incq %r10
ucomisd %xmm7, %xmm4
jbe 0xe7c1
decq %r10
cmpq $0x2, %r10
jb 0xe80f
movq 0x10(%rax), %r9
movups (%r9), %xmm4
movups %xmm4, 0x148(%rsp)
movsd 0x10(%r9), %xmm4
movsd %xmm4, 0x158(%rsp)
incl %ecx
cmpl %edx, %r8d
jne 0xe73b
movq (%rax), %rax
testq %rax, %rax
jne 0xe721
cmpl $0x1, %ecx
jne 0xecaf
movsd 0x158(%rsp), %xmm3
movupd 0x148(%rsp), %xmm15
movapd %xmm15, %xmm4
unpckhpd %xmm15, %xmm4           # xmm4 = xmm4[1],xmm15[1]
mulsd %xmm0, %xmm4
movapd %xmm14, %xmm12
unpckhpd %xmm14, %xmm12          # xmm12 = xmm12[1],xmm14[1]
mulsd %xmm3, %xmm12
subsd %xmm4, %xmm12
movapd %xmm3, %xmm5
unpcklpd %xmm15, %xmm5           # xmm5 = xmm5[0],xmm15[0]
mulpd %xmm14, %xmm5
movapd %xmm0, %xmm4
unpcklpd %xmm14, %xmm4           # xmm4 = xmm4[0],xmm14[0]
mulpd %xmm15, %xmm4
subpd %xmm5, %xmm4
movapd %xmm4, %xmm5
mulsd %xmm4, %xmm5
movapd %xmm12, %xmm6
mulsd %xmm12, %xmm6
addsd %xmm5, %xmm6
movapd %xmm4, %xmm5
unpckhpd %xmm4, %xmm5            # xmm5 = xmm5[1],xmm4[1]
mulsd %xmm5, %xmm5
addsd %xmm6, %xmm5
sqrtsd %xmm5, %xmm5
ucomisd %xmm5, %xmm8
ja 0xecaa
movapd %xmm2, %xmm6
mulpd %xmm2, %xmm6
unpckhpd %xmm6, %xmm6            # xmm6 = xmm6[1,1]
mulsd %xmm2, %xmm2
addsd %xmm6, %xmm2
mulsd %xmm1, %xmm1
addsd %xmm2, %xmm1
xorps %xmm6, %xmm6
sqrtsd %xmm1, %xmm6
divsd %xmm5, %xmm12
unpcklpd %xmm5, %xmm5            # xmm5 = xmm5[0,0]
divpd %xmm5, %xmm4
movapd %xmm4, 0x1b0(%rsp)
mulsd %xmm6, %xmm12
movsd %xmm12, 0x1a8(%rsp)
movl 0x10(%r14), %eax
testl %eax, %eax
jle 0xecaa
unpcklpd %xmm6, %xmm6            # xmm6 = xmm6[0,0]
mulpd %xmm4, %xmm6
movapd %xmm6, %xmm1
mulsd %xmm6, %xmm1
movapd %xmm12, %xmm2
mulsd %xmm12, %xmm2
addsd %xmm1, %xmm2
movapd %xmm6, %xmm1
unpckhpd %xmm6, %xmm1            # xmm1 = xmm1[1],xmm6[1]
mulsd %xmm1, %xmm1
addsd %xmm2, %xmm1
sqrtsd %xmm1, %xmm1
xorl %edx, %edx
ucomisd %xmm1, %xmm8
seta %sil
xorpd %xmm2, %xmm2
ja 0xe957
movapd %xmm12, %xmm2
divsd %xmm1, %xmm2
movq 0x18(%r14), %rcx
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
movapd %xmm2, %xmm4
movapd %xmm6, %xmm2
divpd %xmm1, %xmm2
movb %sil, %dl
movd %edx, %xmm1
pshufd $0x0, %xmm1, %xmm5      # xmm5 = xmm1[0,0,0,0]
pslld $0x1f, %xmm5
psrad $0x1f, %xmm5
pandn %xmm2, %xmm5
movdqa %xmm5, %xmm2
movapd %xmm4, 0x70(%rsp)
shufpd $0x1, %xmm4, %xmm2      # xmm2 = xmm2[1],xmm4[0]
movapd 0x10944(%rip), %xmm1    # 0x1f2e0
xorpd %xmm1, %xmm2
movapd %xmm2, 0xb0(%rsp)
movdqa %xmm5, 0xc0(%rsp)
pxor %xmm1, %xmm5
movdqa %xmm5, 0xa0(%rsp)
movapd %xmm6, %xmm1
shufpd $0x1, %xmm0, %xmm1      # xmm1 = xmm1[1],xmm0[0]
movapd %xmm1, 0x10(%rsp)
movapd %xmm12, %xmm0
unpcklpd %xmm14, %xmm0           # xmm0 = xmm0[0],xmm14[0]
movapd %xmm0, (%rsp)
movsd %xmm6, %xmm14           # xmm14 = xmm6[0],xmm14[1]
unpcklpd %xmm15, %xmm12          # xmm12 = xmm12[0],xmm15[0]
movsd %xmm6, %xmm15           # xmm15 = xmm6[0],xmm15[1]
shufpd $0x1, %xmm3, %xmm6      # xmm6 = xmm6[1],xmm3[0]
movq %rcx, %r15
movapd %xmm14, 0x120(%rsp)
movapd %xmm13, 0x110(%rsp)
movapd %xmm15, 0x100(%rsp)
movapd %xmm12, 0xf0(%rsp)
movapd %xmm6, 0xe0(%rsp)
movsd 0x78(%r15), %xmm1
movsd 0x80(%r15), %xmm2
movsd 0x88(%r15), %xmm0
movsd (%r15), %xmm3
movsd 0x8(%r15), %xmm4
movsd 0x10(%r15), %xmm5
unpcklpd %xmm2, %xmm4            # xmm4 = xmm4[0],xmm2[0]
mulpd %xmm14, %xmm4
unpcklpd %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0]
mulpd (%rsp), %xmm3
addpd %xmm4, %xmm3
unpcklpd %xmm0, %xmm5            # xmm5 = xmm5[0],xmm0[0]
mulpd 0x10(%rsp), %xmm5
addpd %xmm3, %xmm5
cmplepd %xmm9, %xmm5
movmskpd %xmm5, %edx
testb $0x2, %dl
jne 0xec8c
movsd 0x18(%r15), %xmm3
movsd 0x20(%r15), %xmm4
unpcklpd %xmm2, %xmm4            # xmm4 = xmm4[0],xmm2[0]
mulpd %xmm15, %xmm4
unpcklpd %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0]
mulpd %xmm12, %xmm3
addpd %xmm4, %xmm3
movsd 0x28(%r15), %xmm4
unpcklpd %xmm0, %xmm4            # xmm4 = xmm4[0],xmm0[0]
mulpd %xmm6, %xmm4
addpd %xmm3, %xmm4
movapd %xmm10, %xmm3
cmplepd %xmm4, %xmm3
movmskpd %xmm3, %esi
movl %esi, %edi
shrb %dil
jne 0xec8c
testb $0x1, %dl
jne 0xec8c
testb $0x1, %sil
jne 0xec8c
movapd %xmm2, %xmm3
mulsd %xmm2, %xmm3
movapd %xmm1, %xmm4
mulsd %xmm1, %xmm4
addsd %xmm3, %xmm4
movapd %xmm0, %xmm3
mulsd %xmm0, %xmm3
addsd %xmm4, %xmm3
xorps %xmm4, %xmm4
sqrtsd %xmm3, %xmm4
xorl %edx, %edx
ucomisd %xmm4, %xmm8
seta %sil
xorpd %xmm3, %xmm3
ja 0xeb25
divsd %xmm4, %xmm2
movapd %xmm2, %xmm3
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
unpcklpd %xmm4, %xmm4            # xmm4 = xmm4[0,0]
divpd %xmm4, %xmm0
movb %sil, %dl
movd %edx, %xmm1
pshufd $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
pslld $0x1f, %xmm1
psrad $0x1f, %xmm1
pandn %xmm0, %xmm1
movapd 0x70(%rsp), %xmm2
mulsd %xmm3, %xmm2
unpcklpd %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0]
mulpd 0xb0(%rsp), %xmm3
movapd 0xc0(%rsp), %xmm0
mulpd %xmm1, %xmm0
addpd %xmm3, %xmm0
pshufd $0xee, %xmm1, %xmm1     # xmm1 = xmm1[2,3,2,3]
mulsd 0xa0(%rsp), %xmm1
addsd %xmm2, %xmm1
movapd %xmm0, %xmm2
mulpd %xmm0, %xmm2
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
movapd %xmm0, %xmm3
mulsd %xmm0, %xmm3
addsd %xmm2, %xmm3
movapd %xmm1, %xmm2
mulsd %xmm1, %xmm2
addsd %xmm3, %xmm2
sqrtsd %xmm2, %xmm2
ucomisd %xmm2, %xmm8
jbe 0xebcc
xorpd %xmm0, %xmm0
movapd %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
jmp 0xec8c
divsd %xmm2, %xmm1
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
divpd %xmm2, %xmm0
movsd %xmm1, 0x60(%rsp)
movapd %xmm0, 0x50(%rsp)
movupd 0x30(%r15), %xmm0
movapd %xmm13, %xmm1
subpd %xmm0, %xmm1
movapd %xmm1, 0x30(%rsp)
movsd 0x80(%rsp), %xmm0
subsd 0x40(%r15), %xmm0
movsd %xmm0, 0x40(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movl $0x1, %ecx
callq 0xe214
movapd 0xe0(%rsp), %xmm6
movapd 0xf0(%rsp), %xmm12
movapd 0x100(%rsp), %xmm15
movapd 0x110(%rsp), %xmm13
movapd 0x120(%rsp), %xmm14
movapd 0x1068f(%rip), %xmm11   # 0x1f2f0
movapd 0x10846(%rip), %xmm10   # 0x1f4b0
movapd 0x1082d(%rip), %xmm9    # 0x1f4a0
movsd 0xd49c(%rip), %xmm8     # 0x1c118
movsd 0x1089c(%rip), %xmm7    # 0x1f520
movq 0x18(%r14), %rcx
movl 0x10(%r14), %eax
addq $0x90, %r15
movslq %eax, %rdx
leaq (%rdx,%rdx,8), %rdx
shlq $0x4, %rdx
addq %rcx, %rdx
cmpq %rdx, %r15
jb 0xea25
movl %r13d, %r15d
jmp 0xecff
movb $0x1, %r15b
testb $0x1, %r13b
jne 0xecff
movq 0xd8(%rsp), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
leaq 0x1094c(%rip), %rdi     # 0x1f618
xorl %eax, %eax
callq 0xa4d6
movapd 0x10614(%rip), %xmm11   # 0x1f2f0
movapd 0x107cb(%rip), %xmm10   # 0x1f4b0
movapd 0x107b2(%rip), %xmm9    # 0x1f4a0
movsd 0xd421(%rip), %xmm8     # 0x1c118
movsd 0x10821(%rip), %xmm7    # 0x1f520
movq 0x18(%r12), %rcx
movl 0x8(%rcx), %eax
movl %r15d, %r13d
cmpq %rax, %rbx
jb 0xe657
jmp 0xed18
movl %r13d, %r15d
movq (%r12), %r12
movl %r15d, %r13d
testq %r12, %r12
jne 0xe645
movl (%r14), %edx
testl %edx, %edx
movq 0x98(%rsp), %r15
jle 0xef17
movq 0x8(%r14), %rax
leaq 0xf0ba(%rip), %rcx      # 0x1de00
movaps (%rcx), %xmm0
movaps %xmm0, 0x80(%rsp)
movsd 0x10(%rcx), %xmm0
movsd %xmm0, 0x70(%rsp)
leaq 0x50(%rsp), %r12
leaq 0x30(%rsp), %r13
movsd 0x107b9(%rip), %xmm9    # 0x1f528
movq %rax, %rbx
movq 0x28(%rsp), %rcx
movq 0x30(%rcx), %rcx
testq %rcx, %rcx
movapd 0x10(%rsp), %xmm10
movsd (%rsp), %xmm11
je 0xef00
movsd 0x1077f(%rip), %xmm0    # 0x1f518
movq 0x18(%rcx), %rdx
movl 0x8(%rdx), %esi
testq %rsi, %rsi
je 0xee4f
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 0xee19
movapd %xmm5, %xmm11
ja 0xee20
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 0xedcd
jmp 0xee53
movapd %xmm0, %xmm6
movq (%rcx), %rcx
movapd %xmm6, %xmm0
testq %rcx, %rcx
jne 0xed99
movupd (%rbx), %xmm0
movapd 0x80(%rsp), %xmm1
subpd %xmm0, %xmm1
movapd %xmm1, 0x50(%rsp)
movsd 0x70(%rsp), %xmm0
subsd 0x10(%rbx), %xmm0
movsd %xmm0, 0x60(%rsp)
movq %rbx, %rcx
subq %rax, %rcx
sarq $0x6, %rcx
cmpb $0x1, (%r15,%rcx)
movapd %xmm10, 0x10(%rsp)
movsd %xmm11, (%rsp)
jne 0xeeb7
movapd %xmm10, 0x30(%rsp)
movapd %xmm11, %xmm0
jmp 0xeed5
movupd 0x18(%rbx), %xmm0
movapd %xmm10, %xmm1
subpd %xmm0, %xmm1
movapd %xmm1, 0x30(%rsp)
movapd %xmm11, %xmm0
subsd 0x28(%rbx), %xmm0
movsd %xmm0, 0x40(%rsp)
movq 0x20(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
movl $0x1, %ecx
callq 0xe214
movq 0x8(%r14), %rax
movl (%r14), %edx
movsd 0x10628(%rip), %xmm9    # 0x1f528
addq $0x40, %rbx
movslq %edx, %rcx
shlq $0x6, %rcx
addq %rax, %rcx
cmpq %rcx, %rbx
jb 0xed72
movq %r15, %rdi
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4390