// File: /workspace/github_cpp_makefile_star2_O1/FreeSlave[P]vhlt/hlrad/lightmap.cpp
// Function: ChopFrag(samplefrag_s*)
void ChopFrag (samplefrag_t *frag)
	// fill winding, windingplane, mywinding, mywindingplane, numedges, edges
{
	// get the shape of the fragment by clipping the face using the boundaries
	dface_t *f;
	Winding *facewinding;
	matrix_t worldtotex;
	const vec3_t v_up = {0, 0, 1};

	f = &g_dfaces[frag->facenum];
	facewinding = new Winding (*f);

	TranslateWorldToTex (frag->facenum, worldtotex);
	frag->mywinding = new Winding (facewinding->m_NumPoints);
	for (int x = 0; x < facewinding->m_NumPoints; x++)
	{
		ApplyMatrix (worldtotex, facewinding->m_Points[x], frag->mywinding->m_Points[x]);
		frag->mywinding->m_Points[x][2] = 0.0;
	}
	frag->mywinding->RemoveColinearPoints ();
	VectorCopy (v_up, frag->mywindingplane.normal); // this is the same as applying the worldtotex matrix to the faceplane
	if (CalcMatrixSign (worldtotex) < 0.0)
	{
		frag->mywindingplane.normal[2] *= -1;
	}
	frag->mywindingplane.dist = 0.0;

	for (int x = 0; x < 4 && frag->mywinding->m_NumPoints > 0; x++)
	{
		frag->mywinding->Clip (frag->myrect.planes[x], false);
	}

	frag->winding = new Winding (frag->mywinding->m_NumPoints);
	for (int x = 0; x < frag->mywinding->m_NumPoints; x++)
	{
		ApplyMatrix (frag->mycoordtocoord, frag->mywinding->m_Points[x], frag->winding->m_Points[x]);
	}
	frag->winding->RemoveColinearPoints ();
	VectorCopy (frag->mywindingplane.normal, frag->windingplane.normal);
	if (CalcMatrixSign (frag->mycoordtocoord) < 0.0)
	{
		frag->windingplane.normal[2] *= -1;
	}
	frag->windingplane.dist = 0.0;

	delete facewinding;

	// find the edges where the fragment can grow in the future
	frag->numedges = 0;
	frag->edges = (samplefragedge_t *)malloc (f->numedges * sizeof (samplefragedge_t));
	hlassume (frag->edges != NULL, assume_NoMemory);
	for (int i = 0; i < f->numedges; i++)
	{
		samplefragedge_t *e;
		edgeshare_t *es;
		dedge_t *de;
		dvertex_t *dv1;
		dvertex_t *dv2;
		vec_t frac1, frac2;
		vec_t edgelen;
		vec_t dot, dot1, dot2;
		vec3_t tmp, v, normal;
		const matrix_t *m;
		const matrix_t *m_inverse;
		
		e = &frag->edges[frag->numedges];

		// some basic info
		e->edgenum = abs (g_dsurfedges[f->firstedge + i]);
		e->edgeside = (g_dsurfedges[f->firstedge + i] < 0? 1: 0);
		es = &g_edgeshare[e->edgenum];
		if (!es->smooth)
		{
			continue;
		}
		if (es->faces[e->edgeside] - g_dfaces != frag->facenum)
		{
			Error ("internal error 1 in GrowSingleSampleFrag");
		}
		m = &es->textotex[e->edgeside];
		m_inverse = &es->textotex[1-e->edgeside];
		e->nextfacenum = es->faces[1-e->edgeside] - g_dfaces;
		if (e->nextfacenum == frag->facenum)
		{
			continue; // an invalid edge (usually very short)
		}
		e->tried = false; // because the frag hasn't been linked into the list yet

		// translate the edge points from world to the texture plane of the original frag
		//   so the distances are able to be compared among edges from different frags
		de = &g_dedges[e->edgenum];
		dv1 = &g_dvertexes[de->v[e->edgeside]];
		dv2 = &g_dvertexes[de->v[1-e->edgeside]];
		ApplyMatrix (worldtotex, dv1->point, tmp);
		ApplyMatrix (frag->mycoordtocoord, tmp, e->point1);
		e->point1[2] = 0.0;
		ApplyMatrix (worldtotex, dv2->point, tmp);
		ApplyMatrix (frag->mycoordtocoord, tmp, e->point2);
		e->point2[2] = 0.0;
		VectorSubtract (e->point2, e->point1, e->direction);
		edgelen = VectorNormalize (e->direction);
		if (edgelen <= ON_EPSILON)
		{
			continue;
		}

		// clip the edge
		frac1 = 0;
		frac2 = 1;
		for (int x = 0; x < 4; x++)
		{
			vec_t dot1;
			vec_t dot2;

			dot1 = DotProduct (e->point1, frag->rect.planes[x].normal) - frag->rect.planes[x].dist;
			dot2 = DotProduct (e->point2, frag->rect.planes[x].normal) - frag->rect.planes[x].dist;
			if (dot1 <= ON_EPSILON && dot2 <= ON_EPSILON)
			{
				frac1 = 1;
				frac2 = 0;
			}
			else if (dot1 < 0)
			{
				frac1 = qmax (frac1, dot1 / (dot1 - dot2));
			}
			else if (dot2 < 0)
			{
				frac2 = qmin (frac2, dot1 / (dot1 - dot2));
			}
		}
		if (edgelen * (frac2 - frac1) <= ON_EPSILON)
		{
			continue;
		}
		VectorMA (e->point1, edgelen * frac2, e->direction, e->point2);
		VectorMA (e->point1, edgelen * frac1, e->direction, e->point1);

		// calculate the distance, etc., which are used to determine its priority
		e->noseam = frag->noseam;
		dot = DotProduct (frag->origin, e->direction);
		dot1 = DotProduct (e->point1, e->direction);
		dot2 = DotProduct (e->point2, e->direction);
		dot = qmax (dot1, qmin (dot, dot2));
		VectorMA (e->point1, dot - dot1, e->direction, v);
		VectorSubtract (v, frag->origin, v);
		e->distance = VectorLength (v);
		CrossProduct (e->direction, frag->windingplane.normal, normal);
		VectorNormalize (normal); // points inward
		e->distancereduction = DotProduct (v, normal);
		e->flippedangle = frag->flippedangle + acos (qmin (es->cos_normals_angle, 1.0));

		// calculate the matrix
		e->ratio = (*m_inverse).v[2][2];
		if (e->ratio <= NORMAL_EPSILON || (1 / e->ratio) <= NORMAL_EPSILON)
		{
			Developer (DEVELOPER_LEVEL_SPAM, "TranslateTexToTex failed on face %d and %d @(%f,%f,%f)", frag->facenum, e->nextfacenum, dv1->point[0], dv1->point[1], dv1->point[2]);
			continue;
		}

		if (fabs (e->ratio - 1) < 0.005)
		{
			e->prevtonext = *m;
			e->nexttoprev = *m_inverse;
		}
		else
		{
			e->noseam = false;
			e->prevtonext = *m;
			e->nexttoprev = *m_inverse;
		}

		frag->numedges++;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %rbx
movslq 0x18(%rdi), %rax
leaq (%rax,%rax,4), %r14
shlq $0x2, %r14
addq 0x30395(%rip), %r14     # 0x47fe0
movl $0x20, %edi
callq 0x42f0
movq %rax, %r12
movss 0x23e24(%rip), %xmm0    # 0x3ba84
movq %rax, %rdi
movq %r14, 0x8(%rsp)
movq %r14, %rsi
callq 0xc700
movl 0x18(%rbx), %edi
leaq 0x7c(%rsp), %rsi
callq 0x30c1e
movl $0x20, %edi
callq 0x42f0
movq %rax, %r15
movl 0x8(%r12), %esi
movq %rax, %rdi
callq 0xc372
movq %r15, 0x160(%rbx)
cmpl $0x0, 0x8(%r12)
je 0x17cf4
xorl %r14d, %r14d
leaq 0x7c(%rsp), %r15
xorl %r13d, %r13d
movq 0x10(%r12), %rsi
addq %r14, %rsi
movq 0x160(%rbx), %rax
movq 0x10(%rax), %rdx
addq %r14, %rdx
movq %r15, %rdi
callq 0x30943
movq 0x160(%rbx), %rax
movq 0x10(%rax), %rax
movl $0x0, 0x8(%rax,%r14)
incq %r13
movl 0x8(%r12), %eax
addq $0xc, %r14
cmpq %rax, %r13
jb 0x17cb1
movq 0x160(%rbx), %rdi
movss 0x23d81(%rip), %xmm0    # 0x3ba84
callq 0xc7de
movq $0x0, 0x168(%rbx)
movl $0x3f800000, 0x170(%rbx) # imm = 0x3F800000
leaq 0x7c(%rsp), %rdi
callq 0x30bc2
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
jbe 0x17d46
movss 0x170(%rbx), %xmm0
xorps 0x20352(%rip), %xmm0    # 0x38090
movss %xmm0, 0x170(%rbx)
movl $0x0, 0x174(%rbx)
leaq 0xec(%rbx), %r14
xorl %r15d, %r15d
movq 0x160(%rbx), %rdi
cmpl $0x0, 0x8(%rdi)
je 0x17d84
leaq (%r14,%r15), %rsi
xorl %edx, %edx
movss 0x23d0f(%rip), %xmm0    # 0x3ba84
callq 0xd0d2
addq $0x14, %r15
cmpq $0x50, %r15
jne 0x17d5a
movl $0x20, %edi
callq 0x42f0
movq %rax, %r15
movq 0x160(%rbx), %rax
movl 0x8(%rax), %esi
movq %r15, %rdi
callq 0xc372
movq %r15, 0x140(%rbx)
movq 0x160(%rbx), %rax
cmpl $0x0, 0x8(%rax)
je 0x17df4
leaq 0x54(%rbx), %r15
xorl %r14d, %r14d
xorl %r13d, %r13d
movq 0x10(%rax), %rsi
addq %r14, %rsi
movq 0x140(%rbx), %rax
movq 0x10(%rax), %rdx
addq %r14, %rdx
movq %r15, %rdi
callq 0x30943
incq %r13
movq 0x160(%rbx), %rax
movl 0x8(%rax), %ecx
addq $0xc, %r14
cmpq %rcx, %r13
jb 0x17dc1
movq 0x140(%rbx), %rdi
movss 0x23c81(%rip), %xmm0    # 0x3ba84
callq 0xc7de
movsd 0x168(%rbx), %xmm0
movsd %xmm0, 0x148(%rbx)
movss 0x170(%rbx), %xmm0
movss %xmm0, 0x150(%rbx)
leaq 0x54(%rbx), %rdi
movq %rdi, 0x38(%rsp)
callq 0x30bc2
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
jbe 0x17e55
movss 0x150(%rbx), %xmm0
xorps 0x20243(%rip), %xmm0    # 0x38090
movss %xmm0, 0x150(%rbx)
xorl %r14d, %r14d
movl %r14d, 0x154(%rbx)
movq (%r12), %rax
movq %r12, %rdi
callq *0x8(%rax)
movl %r14d, 0x17c(%rbx)
movq 0x8(%rsp), %r14
movswq 0x8(%r14), %rax
imulq $0xa8, %rax, %rdi
callq 0x4410
movq %rax, 0x180(%rbx)
xorl %edi, %edi
testq %rax, %rax
setne %dil
movl $0x1, %esi
callq 0xa7c9
cmpw $0x0, 0x8(%r14)
jle 0x18614
movq %r14, %rsi
leaq 0x1e3356a(%rip), %r13   # 0x1e4b420
leaq 0x2134a53(%rip), %rdi   # 0x214c910
xorl %r15d, %r15d
movq 0x180(%rbx), %rbp
movslq 0x17c(%rbx), %rax
imulq $0xa8, %rax, %r14
movslq 0x4(%rsi), %rax
movslq %r15d, %rcx
addq %rcx, %rax
movl (%r13,%rax,4), %eax
movl %eax, %edx
negl %edx
cmovsl %eax, %edx
movl %edx, (%rbp,%r14)
movslq 0x4(%rsi), %rax
addq %rcx, %rax
movl (%r13,%rax,4), %eax
shrl $0x1f, %eax
movl %eax, 0x4(%rbp,%r14)
imulq $0xb0, %rdx, %rdx
cmpb $0x1, 0x39(%rdx,%rdi)
jne 0x18604
addq %rdi, %rdx
movq (%rdx,%rax,8), %rax
subq 0x300bc(%rip), %rax     # 0x47fe0
sarq $0x2, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rcx, %rax
movslq 0x18(%rbx), %rcx
cmpq %rcx, %rax
je 0x17f5f
leaq 0x24019(%rip), %rdi     # 0x3bf5f
xorl %eax, %eax
movq %rdx, %r12
callq 0xa01c
movq %r12, %rdx
leaq 0x21349b6(%rip), %rdi   # 0x214c910
movq 0x8(%rsp), %rsi
addq %r14, %rbp
movslq 0x4(%rbp), %rcx
movl $0x1, %r14d
subq %rcx, %r14
movq (%rdx,%r14,8), %rax
subq 0x30066(%rip), %rax     # 0x47fe0
shrq $0x2, %rax
imull $0xcccccccd, %eax, %eax # imm = 0xCCCCCCCD
movl %eax, 0x8(%rbp)
cmpl %eax, 0x18(%rbx)
je 0x18604
movq %rdx, (%rsp)
movb $0x0, 0xc(%rbp)
movslq (%rbp), %rax
shlq $0x2, %rax
addq 0x30011(%rip), %rax     # 0x47fb8
movq %rcx, 0x20(%rsp)
movzwl (%rax,%rcx,2), %ecx
leaq (%rcx,%rcx,2), %rcx
leaq 0x1019445(%rip), %rdx   # 0x1031400
leaq (%rdx,%rcx,4), %rsi
movzwl (%rax,%r14,2), %eax
leaq (%rax,%rax,2), %rax
leaq (%rdx,%rax,4), %rax
movq %rax, 0x10(%rsp)
leaq 0x7c(%rsp), %rdi
movq %rsi, 0x30(%rsp)
leaq 0xac(%rsp), %r12
movq %r12, %rdx
callq 0x30943
leaq 0x10(%rbp), %rdx
movq 0x38(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x30943
xorl %eax, %eax
movl %eax, 0x18(%rbp)
leaq 0x7c(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %r12, %rdx
callq 0x30943
leaq 0x1c(%rbp), %rdx
movq %r13, %rdi
movq %r12, %rsi
callq 0x30943
xorl %eax, %eax
movl %eax, 0x24(%rbp)
movsd 0x10(%rbp), %xmm0
movsd 0x1c(%rbp), %xmm1
subps %xmm0, %xmm1
movlps %xmm1, 0x28(%rbp)
xorps %xmm0, %xmm0
subss 0x18(%rbp), %xmm0
movss %xmm0, 0x30(%rbp)
movaps %xmm1, %xmm2
mulps %xmm1, %xmm2
shufps $0x55, %xmm2, %xmm2     # xmm2 = xmm2[1,1,1,1]
mulss %xmm1, %xmm1
addss %xmm2, %xmm1
mulss %xmm0, %xmm0
addss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd 0x2329a(%rip), %xmm0    # 0x3b308
jb 0x18076
sqrtsd %xmm0, %xmm0
jmp 0x1807b
callq 0x4240
movsd 0x2008d(%rip), %xmm1    # 0x38110
ucomisd %xmm0, %xmm1
movq 0x8(%rsp), %rsi
leaq 0x1e3338d(%rip), %r13   # 0x1e4b420
leaq 0x2134876(%rip), %rdi   # 0x214c910
xorps %xmm9, %xmm9
movapd 0x23aa9(%rip), %xmm10   # 0x3bb50
movss 0x20088(%rip), %xmm11   # 0x38138
movq (%rsp), %rcx
movq 0x20(%rsp), %rax
jbe 0x180cf
movl $0x0, 0x30(%rbp)
movq $0x0, 0x28(%rbp)
xorps %xmm0, %xmm0
jmp 0x18101
cvtps2pd 0x28(%rbp), %xmm1
movapd %xmm0, %xmm2
unpcklpd %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
divpd %xmm2, %xmm1
cvtpd2ps %xmm1, %xmm1
movlpd %xmm1, 0x28(%rbp)
xorps %xmm1, %xmm1
cvtss2sd 0x30(%rbp), %xmm1
divsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm1
movss %xmm1, 0x30(%rbp)
cvtsd2ss %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movsd 0x23538(%rip), %xmm2    # 0x3b648
ucomisd %xmm1, %xmm2
jae 0x18604
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
leaq (%rcx,%rax), %rdx
addq $0x50, %rdx
leaq (%r14,%r14,2), %rax
shlq $0x4, %rax
leaq (%rcx,%rax), %r12
addq $0x50, %r12
movss 0x24(%rbp), %xmm1
movss 0x10(%rbp), %xmm3
movss 0x14(%rbp), %xmm4
movss 0x18(%rbp), %xmm2
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movss 0x1c(%rbp), %xmm2
unpcklps %xmm3, %xmm2            # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
movss 0x20(%rbp), %xmm3
unpcklps %xmm4, %xmm3            # xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
xorl %eax, %eax
movsd 0x239d5(%rip), %xmm6    # 0x3bb40
movaps %xmm6, %xmm4
movss 0x9c(%rbx,%rax), %xmm6
movss 0xa0(%rbx,%rax), %xmm7
movss 0xa4(%rbx,%rax), %xmm5
movss 0xa8(%rbx,%rax), %xmm8
shufps $0x0, %xmm7, %xmm7      # xmm7 = xmm7[0,0,0,0]
mulps %xmm3, %xmm7
shufps $0x0, %xmm6, %xmm6      # xmm6 = xmm6[0,0,0,0]
mulps %xmm2, %xmm6
addps %xmm7, %xmm6
shufps $0x0, %xmm5, %xmm5      # xmm5 = xmm5[0,0,0,0]
mulps %xmm1, %xmm5
addps %xmm6, %xmm5
shufps $0x0, %xmm8, %xmm8      # xmm8 = xmm8[0,0,0,0]
subps %xmm8, %xmm5
cvtps2pd %xmm5, %xmm6
cmpnlepd %xmm10, %xmm6
movmskpd %xmm6, %ecx
movaps %xmm11, %xmm6
testl %ecx, %ecx
je 0x18219
movaps %xmm5, %xmm7
shufps $0x55, %xmm5, %xmm7     # xmm7 = xmm7[1,1],xmm5[1,1]
ucomiss %xmm7, %xmm9
jbe 0x181f1
movaps %xmm7, %xmm6
subss %xmm5, %xmm6
divss %xmm6, %xmm7
movaps %xmm4, %xmm5
maxss %xmm7, %xmm5
movss %xmm5, %xmm4            # xmm4 = xmm5[0],xmm4[1,2,3]
jmp 0x18216
ucomiss %xmm5, %xmm9
jbe 0x18216
movaps %xmm7, %xmm6
subss %xmm5, %xmm6
divss %xmm6, %xmm7
movaps %xmm4, %xmm6
shufps $0x55, %xmm4, %xmm6     # xmm6 = xmm6[1,1],xmm4[1,1]
minss %xmm7, %xmm6
movlhps %xmm4, %xmm6            # xmm6 = xmm6[0],xmm4[0]
shufps $0xe2, %xmm4, %xmm6     # xmm6 = xmm6[2,0],xmm4[2,3]
jmp 0x18219
movaps %xmm4, %xmm6
addq $0x14, %rax
cmpq $0x50, %rax
jne 0x1816b
movaps %xmm6, %xmm1
shufps $0x55, %xmm6, %xmm1     # xmm1 = xmm1[1,1],xmm6[1,1]
subss %xmm6, %xmm1
mulss %xmm0, %xmm1
cvtss2sd %xmm1, %xmm1
movsd 0x23406(%rip), %xmm2    # 0x3b648
ucomisd %xmm1, %xmm2
jae 0x18604
shufps $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
mulps %xmm6, %xmm0
movaps %xmm0, %xmm1
shufps $0x40, %xmm0, %xmm1     # xmm1 = xmm1[0,0],xmm0[0,1]
movss 0x28(%rbp), %xmm13
movsd 0x14(%rbp), %xmm3
movsd 0x2c(%rbp), %xmm12
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
mulps %xmm12, %xmm0
addps %xmm3, %xmm0
movlps %xmm0, 0x20(%rbp)
movaps %xmm13, %xmm4
shufps $0x40, %xmm12, %xmm4    # xmm4 = xmm4[0,0],xmm12[0,1]
shufps $0x78, %xmm4, %xmm4     # xmm4 = xmm4[0,2,3,1]
mulps %xmm1, %xmm4
movss 0x10(%rbp), %xmm2
shufps $0x40, %xmm3, %xmm2     # xmm2 = xmm2[0,0],xmm3[0,1]
shufps $0x78, %xmm2, %xmm2     # xmm2 = xmm2[0,2,3,1]
addps %xmm4, %xmm2
movups %xmm2, 0x10(%rbp)
movb 0x20(%rbx), %al
movb %al, 0x34(%rbp)
movss 0x84(%rbx), %xmm3
movss 0x88(%rbx), %xmm1
movaps %xmm12, %xmm4
mulss %xmm1, %xmm4
movaps %xmm3, %xmm6
mulss %xmm13, %xmm6
addss %xmm4, %xmm6
movss 0x8c(%rbx), %xmm4
movaps %xmm12, %xmm5
shufps $0x55, %xmm12, %xmm5    # xmm5 = xmm5[1,1],xmm12[1,1]
movaps %xmm4, %xmm8
mulss %xmm5, %xmm8
addss %xmm6, %xmm8
movaps %xmm2, %xmm6
shufps $0x55, %xmm2, %xmm6     # xmm6 = xmm6[1,1],xmm2[1,1]
movaps %xmm12, %xmm7
mulss %xmm6, %xmm7
movaps %xmm2, %xmm9
mulss %xmm13, %xmm9
addss %xmm7, %xmm9
movaps %xmm2, %xmm7
unpckhpd %xmm2, %xmm7            # xmm7 = xmm7[1],xmm2[1]
movaps %xmm7, %xmm10
mulss %xmm5, %xmm10
addss %xmm9, %xmm10
movaps %xmm12, %xmm9
mulss %xmm0, %xmm9
movaps %xmm2, %xmm11
shufps $0xff, %xmm2, %xmm11    # xmm11 = xmm11[3,3],xmm2[3,3]
mulss %xmm13, %xmm11
addss %xmm9, %xmm11
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
mulss %xmm5, %xmm0
addss %xmm11, %xmm0
minss %xmm0, %xmm8
movaps %xmm10, %xmm9
maxss %xmm8, %xmm9
subss %xmm10, %xmm9
mulss %xmm9, %xmm13
addss %xmm2, %xmm13
mulss %xmm9, %xmm12
addss %xmm6, %xmm12
mulss %xmm5, %xmm9
addss %xmm7, %xmm9
subss %xmm3, %xmm13
subss %xmm1, %xmm12
subss %xmm4, %xmm9
movaps %xmm13, 0x10(%rsp)
movaps %xmm13, %xmm0
mulss %xmm13, %xmm0
cvtss2sd %xmm0, %xmm0
movaps %xmm12, 0x20(%rsp)
movaps %xmm12, %xmm1
mulss %xmm12, %xmm1
cvtss2sd %xmm1, %xmm1
addsd %xmm0, %xmm1
movaps %xmm9, 0x60(%rsp)
movaps %xmm9, %xmm0
mulss %xmm9, %xmm0
cvtss2sd %xmm0, %xmm0
addsd %xmm1, %xmm0
ucomisd 0x22f3d(%rip), %xmm0    # 0x3b308
jb 0x183d6
movq %rdx, %r14
sqrtsd %xmm0, %xmm0
jmp 0x183de
movq %rdx, %r14
callq 0x4240
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x38(%rbp)
movss 0x148(%rbx), %xmm0
movss 0x28(%rbp), %xmm4
movsd 0x2c(%rbp), %xmm1
movsd 0x14c(%rbx), %xmm2
movaps %xmm4, %xmm3
shufps $0xd4, %xmm1, %xmm3     # xmm3 = xmm3[0,1],xmm1[1,3]
shufps $0x52, %xmm1, %xmm3     # xmm3 = xmm3[2,0],xmm1[1,1]
mulps %xmm2, %xmm3
movaps %xmm0, %xmm5
shufps $0xd4, %xmm2, %xmm5     # xmm5 = xmm5[0,1],xmm2[1,3]
shufps $0x52, %xmm2, %xmm5     # xmm5 = xmm5[2,0],xmm2[1,1]
mulps %xmm1, %xmm5
subps %xmm3, %xmm5
mulss %xmm1, %xmm0
mulss %xmm2, %xmm4
subss %xmm0, %xmm4
movaps %xmm5, %xmm0
mulps %xmm5, %xmm0
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movaps %xmm5, %xmm1
mulss %xmm5, %xmm1
addss %xmm0, %xmm1
movaps %xmm4, %xmm0
mulss %xmm4, %xmm0
addss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd 0x22eb0(%rip), %xmm0    # 0x3b308
jb 0x18460
sqrtsd %xmm0, %xmm0
jmp 0x18479
movaps %xmm4, 0x50(%rsp)
movaps %xmm5, 0x40(%rsp)
callq 0x4240
movaps 0x40(%rsp), %xmm5
movaps 0x50(%rsp), %xmm4
movq (%rsp), %rax
movsd 0x1fc8b(%rip), %xmm1    # 0x38110
ucomisd %xmm0, %xmm1
jbe 0x18494
xorpd %xmm1, %xmm1
xorps %xmm0, %xmm0
jmp 0x184b9
cvtps2pd %xmm5, %xmm1
movapd %xmm0, %xmm2
unpcklpd %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
divpd %xmm2, %xmm1
cvtpd2ps %xmm1, %xmm1
xorps %xmm2, %xmm2
cvtss2sd %xmm4, %xmm2
divsd %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsd2ss %xmm2, %xmm0
movaps 0x10(%rsp), %xmm3
mulss %xmm1, %xmm3
shufps $0x55, %xmm1, %xmm1     # xmm1 = xmm1[1,1,1,1]
movaps 0x20(%rsp), %xmm2
mulss %xmm1, %xmm2
addss %xmm3, %xmm2
movaps 0x60(%rsp), %xmm1
mulss %xmm0, %xmm1
addss %xmm2, %xmm1
movss %xmm1, 0x3c(%rbp)
xorps %xmm0, %xmm0
cvtss2sd 0x1c(%rbx), %xmm0
movsd %xmm0, (%rsp)
movss 0x34(%rax), %xmm0
minss 0x1fc39(%rip), %xmm0    # 0x38138
cvtss2sd %xmm0, %xmm0
callq 0x42c0
addsd (%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x40(%rbp)
movss 0x20(%r12), %xmm0
movss %xmm0, 0x44(%rbp)
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movsd 0x1fbdf(%rip), %xmm2    # 0x38110
ucomisd %xmm1, %xmm2
jae 0x185c3
movss 0x1fbf5(%rip), %xmm1    # 0x38138
divss %xmm0, %xmm1
cvtss2sd %xmm1, %xmm1
movsd 0x1fbbd(%rip), %xmm2    # 0x38110
ucomisd %xmm1, %xmm2
jae 0x185c3
addss 0x22e0f(%rip), %xmm0    # 0x3b370
andps 0x22dd8(%rip), %xmm0    # 0x3b340
cvtss2sd %xmm0, %xmm0
movsd 0x2358c(%rip), %xmm1    # 0x3bb00
ucomisd %xmm0, %xmm1
ja 0x1857e
movb $0x0, 0x34(%rbp)
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups %xmm2, 0x68(%rbp)
movups %xmm1, 0x58(%rbp)
movups %xmm0, 0x48(%rbp)
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups 0x20(%r12), %xmm2
movups %xmm0, 0x78(%rbp)
movups %xmm1, 0x88(%rbp)
movups %xmm2, 0x98(%rbp)
incl 0x17c(%rbx)
jmp 0x185f8
movl 0x18(%rbx), %edx
movl 0x8(%rbp), %ecx
movq 0x30(%rsp), %rax
xorps %xmm0, %xmm0
cvtss2sd (%rax), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x4(%rax), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x8(%rax), %xmm2
movl $0x5, %edi
leaq 0x2386a(%rip), %rsi     # 0x3be5b
movb $0x3, %al
callq 0xa52e
movq 0x8(%rsp), %rsi
leaq 0x213430c(%rip), %rdi   # 0x214c910
incl %r15d
movswl 0x8(%rsi), %eax
cmpl %eax, %r15d
jl 0x17ec0
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x18628
movq %rax, %rbx
movq %r15, %r12
jmp 0x18633
movq %rax, %rbx
movl $0x20, %esi
movq %r12, %rdi
callq 0x4300
movq %rbx, %rdi
callq 0x4590