// File: /workspace/github_cpp_makefile_star2_O3/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 $0x78, %rsp
movq %rdi, %rbx
movslq 0x18(%rdi), %rax
leaq (%rax,%rax,4), %r14
shlq $0x2, %r14
addq 0x2fd03(%rip), %r14     # 0x46fe8
movl $0x20, %edi
callq 0x42e0
movq %rax, %r12
movss 0x2373a(%rip), %xmm0    # 0x3aa34
movq %rax, %rdi
movq %r14, 0x8(%rsp)
movq %r14, %rsi
callq 0xc54a
movl 0x18(%rbx), %edi
leaq 0x3c(%rsp), %rsi
callq 0x2fb8e
movl $0x20, %edi
callq 0x42e0
movq %rax, %r15
movl 0x8(%r12), %esi
movq %rax, %rdi
callq 0xc1a6
movq %r15, 0x160(%rbx)
cmpl $0x0, 0x8(%r12)
je 0x17395
xorl %r14d, %r14d
leaq 0x3c(%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 0x2f8b3
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 0x1734b
movq 0x160(%rbx), %r15
movss 0x23697(%rip), %xmm0    # 0x3aa34
movq %r15, %rdi
callq 0xc628
movq $0x0, 0x168(%rbx)
movl $0x3f800000, 0x170(%rbx) # imm = 0x3F800000
leaq 0x3c(%rsp), %rdi
callq 0x2fb32
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
jbe 0x173e3
movss 0x170(%rbx), %xmm0
xorps 0x1fca5(%rip), %xmm0    # 0x37080
movss %xmm0, 0x170(%rbx)
movl $0x0, 0x174(%rbx)
leaq 0xec(%rbx), %r14
xorl %r15d, %r15d
movq 0x160(%rbx), %rdi
cmpl $0x0, 0x8(%rdi)
je 0x17421
leaq (%r14,%r15), %rsi
xorl %edx, %edx
movss 0x23622(%rip), %xmm0    # 0x3aa34
callq 0xcf28
addq $0x14, %r15
cmpq $0x50, %r15
jne 0x173f7
movl $0x20, %edi
callq 0x42e0
movq %rax, %r15
movq 0x160(%rbx), %rax
movl 0x8(%rax), %esi
movq %r15, %rdi
callq 0xc1a6
movq %r15, 0x140(%rbx)
movq 0x160(%rbx), %rax
cmpl $0x0, 0x8(%rax)
je 0x17498
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 0x2f8b3
incq %r13
movq 0x160(%rbx), %rax
movl 0x8(%rax), %ecx
addq $0xc, %r14
cmpq %rcx, %r13
jb 0x1745e
movq 0x140(%rbx), %r15
movss 0x23594(%rip), %xmm0    # 0x3aa34
movq %r15, %rdi
callq 0xc628
movsd 0x168(%rbx), %xmm0
movsd %xmm0, 0x148(%rbx)
movss 0x170(%rbx), %xmm0
movss %xmm0, 0x150(%rbx)
leaq 0x54(%rbx), %rdi
movq %rdi, 0x28(%rsp)
callq 0x2fb32
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
jbe 0x174f5
movss 0x150(%rbx), %xmm0
xorps 0x1fb93(%rip), %xmm0    # 0x37080
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 0x4400
movq %rax, 0x180(%rbx)
xorl %edi, %edi
testq %rax, %rax
setne %dil
movl $0x1, %esi
callq 0xa6ed
cmpw $0x0, 0x8(%r14)
jle 0x17c4c
movq %r14, %rdi
leaq 0x1e32eca(%rip), %r14   # 0x1e4a420
leaq 0x21343b3(%rip), %r13   # 0x214b910
xorl %r15d, %r15d
movq 0x180(%rbx), %rbp
movslq 0x17c(%rbx), %rax
imulq $0xa8, %rax, %rcx
movslq 0x4(%rdi), %rax
movslq %r15d, %rdx
addq %rdx, %rax
movl (%r14,%rax,4), %eax
movl %eax, %esi
negl %esi
cmovsl %eax, %esi
movl %esi, (%rbp,%rcx)
movslq 0x4(%rdi), %rax
addq %rdx, %rax
movl (%r14,%rax,4), %eax
shrl $0x1f, %eax
movl %eax, 0x4(%rbp,%rcx)
imulq $0xb0, %rsi, %rsi
cmpb $0x1, 0x39(%rsi,%r13)
jne 0x17c3c
addq %rcx, %rbp
addq %r13, %rsi
movq (%rsi,%rax,8), %rcx
subq 0x2fa24(%rip), %rcx     # 0x46fe8
sarq $0x2, %rcx
movabsq $-0x3333333333333333, %rdx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rdx, %rcx
movslq 0x18(%rbx), %rdx
cmpq %rdx, %rcx
je 0x175fb
leaq 0x238f9(%rip), %rdi     # 0x3aedf
xorl %eax, %eax
movq %rsi, %r12
callq 0x9f34
movq %r12, %rsi
movq 0x8(%rsp), %rdi
movl 0x4(%rbp), %eax
movl $0x1, %ecx
subl %eax, %ecx
movslq %ecx, %r8
movq (%rsi,%r8,8), %rcx
subq 0x2f9d8(%rip), %rcx     # 0x46fe8
shrq $0x2, %rcx
imull $0xcccccccd, %ecx, %ecx # imm = 0xCCCCCCCD
movl %ecx, 0x8(%rbp)
cmpl %ecx, 0x18(%rbx)
je 0x17c3c
movq %rsi, 0x30(%rsp)
movslq %eax, %rcx
movb $0x0, 0xc(%rbp)
movslq (%rbp), %rax
shlq $0x2, %rax
addq 0x2f97f(%rip), %rax     # 0x46fc0
movq %rcx, 0x10(%rsp)
movzwl (%rax,%rcx,2), %ecx
leaq (%rcx,%rcx,2), %rcx
leaq 0x1018dab(%rip), %rdx   # 0x1030400
leaq (%rdx,%rcx,4), %rsi
movq %r8, 0x18(%rsp)
movzwl (%rax,%r8,2), %eax
leaq (%rax,%rax,2), %rax
leaq (%rdx,%rax,4), %r12
leaq 0x3c(%rsp), %rdi
movq %rsi, 0x20(%rsp)
leaq 0x6c(%rsp), %r14
movq %r14, %rdx
callq 0x2f8b3
leaq 0x10(%rbp), %rdx
movq 0x28(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x2f8b3
xorl %eax, %eax
movl %eax, 0x18(%rbp)
leaq 0x3c(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x2f8b3
leaq 0x1c(%rbp), %rdx
movq %r13, %rdi
movq %r14, %rsi
callq 0x2f8b3
xorl %eax, %eax
movl %eax, 0x24(%rbp)
movss 0x1c(%rbp), %xmm5
movss 0x10(%rbp), %xmm1
movaps %xmm5, %xmm0
subss %xmm1, %xmm0
movss %xmm0, 0x28(%rbp)
movss 0x20(%rbp), %xmm7
movsd 0x14(%rbp), %xmm4
movss 0x20(%rbp), %xmm2
subps %xmm4, %xmm2
movaps %xmm2, %xmm3
shufps $0x55, %xmm2, %xmm3     # xmm3 = xmm3[1,1],xmm2[1,1]
movlps %xmm2, 0x2c(%rbp)
movaps %xmm2, %xmm6
mulss %xmm2, %xmm6
movaps %xmm0, %xmm8
mulss %xmm0, %xmm8
addss %xmm6, %xmm8
mulss %xmm3, %xmm3
addss %xmm8, %xmm3
cvtss2sd %xmm3, %xmm3
xorps %xmm6, %xmm6
sqrtsd %xmm3, %xmm6
movsd 0x1f9f5(%rip), %xmm3    # 0x37118
ucomisd %xmm6, %xmm3
jbe 0x17735
xorps %xmm2, %xmm2
xorps %xmm0, %xmm0
xorpd %xmm3, %xmm3
jmp 0x17757
cvtss2sd %xmm0, %xmm0
divsd %xmm6, %xmm0
cvtsd2ss %xmm0, %xmm0
cvtps2pd %xmm2, %xmm2
xorps %xmm3, %xmm3
cvtsd2ss %xmm6, %xmm3
unpcklpd %xmm6, %xmm6            # xmm6 = xmm6[0,0]
divpd %xmm6, %xmm2
cvtpd2ps %xmm2, %xmm2
movlpd %xmm2, 0x2c(%rbp)
movss %xmm0, 0x28(%rbp)
xorps %xmm6, %xmm6
cvtss2sd %xmm3, %xmm6
movsd 0x22e87(%rip), %xmm8    # 0x3a5f8
ucomisd %xmm6, %xmm8
movq 0x8(%rsp), %rdi
leaq 0x1e32c9e(%rip), %r14   # 0x1e4a420
leaq 0x2134187(%rip), %r13   # 0x214b910
movapd 0x2336e(%rip), %xmm13   # 0x3ab00
movss 0x1f909(%rip), %xmm14   # 0x370a4
xorps %xmm15, %xmm15
movq 0x30(%rsp), %rdx
movq 0x18(%rsp), %rcx
jae 0x17c3c
movq 0x10(%rsp), %rax
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
leaq (%rdx,%rax), %rsi
addq $0x50, %rsi
leaq (%rcx,%rcx,2), %rax
shlq $0x4, %rax
leaq (%rdx,%rax), %r12
addq $0x50, %r12
movaps %xmm4, %xmm6
shufps $0x0, %xmm4, %xmm6      # xmm6 = xmm6[0,0],xmm4[0,0]
movss %xmm7, %xmm6            # xmm6 = xmm7[0],xmm6[1,2,3]
unpcklps %xmm1, %xmm5            # xmm5 = xmm5[0],xmm1[0],xmm5[1],xmm1[1]
movaps %xmm4, %xmm7
xorpd %xmm8, %xmm8
shufps $0x1, %xmm8, %xmm7      # xmm7 = xmm7[1,0],xmm8[0,0]
shufps $0xe2, %xmm8, %xmm7     # xmm7 = xmm7[2,0],xmm8[2,3]
xorl %eax, %eax
movsd 0x232f1(%rip), %xmm10   # 0x3aaf0
movaps %xmm10, %xmm8
movss 0x9c(%rbx,%rax), %xmm10
movss 0xa0(%rbx,%rax), %xmm11
movss 0xa4(%rbx,%rax), %xmm9
movss 0xa8(%rbx,%rax), %xmm12
shufps $0x0, %xmm11, %xmm11    # xmm11 = xmm11[0,0,0,0]
mulps %xmm6, %xmm11
shufps $0x0, %xmm10, %xmm10    # xmm10 = xmm10[0,0,0,0]
mulps %xmm5, %xmm10
addps %xmm11, %xmm10
shufps $0x0, %xmm9, %xmm9      # xmm9 = xmm9[0,0,0,0]
mulps %xmm7, %xmm9
addps %xmm10, %xmm9
shufps $0x0, %xmm12, %xmm12    # xmm12 = xmm12[0,0,0,0]
subps %xmm12, %xmm9
cvtps2pd %xmm9, %xmm10
cmpnlepd %xmm13, %xmm10
movmskpd %xmm10, %ecx
movaps %xmm14, %xmm10
testl %ecx, %ecx
je 0x178cc
movaps %xmm9, %xmm11
shufps $0x55, %xmm9, %xmm11    # xmm11 = xmm11[1,1],xmm9[1,1]
ucomiss %xmm11, %xmm15
jbe 0x1789b
movaps %xmm11, %xmm10
subss %xmm9, %xmm10
divss %xmm10, %xmm11
movaps %xmm8, %xmm9
maxss %xmm11, %xmm9
movss %xmm9, %xmm8            # xmm8 = xmm9[0],xmm8[1,2,3]
jmp 0x178c8
ucomiss %xmm9, %xmm15
jbe 0x178c8
movaps %xmm11, %xmm10
subss %xmm9, %xmm10
divss %xmm10, %xmm11
movaps %xmm8, %xmm10
shufps $0x55, %xmm8, %xmm10    # xmm10 = xmm10[1,1],xmm8[1,1]
minss %xmm11, %xmm10
movlhps %xmm8, %xmm10           # xmm10 = xmm10[0],xmm8[0]
shufps $0xe2, %xmm8, %xmm10    # xmm10 = xmm10[2,0],xmm8[2,3]
jmp 0x178cc
movaps %xmm8, %xmm10
addq $0x14, %rax
cmpq $0x50, %rax
jne 0x177ff
movaps %xmm10, %xmm5
shufps $0x55, %xmm10, %xmm5    # xmm5 = xmm5[1,1],xmm10[1,1]
subss %xmm10, %xmm5
mulss %xmm3, %xmm5
cvtss2sd %xmm5, %xmm5
movsd 0x22d00(%rip), %xmm6    # 0x3a5f8
ucomisd %xmm5, %xmm6
jae 0x17c3c
shufps $0x0, %xmm3, %xmm3      # xmm3 = xmm3[0,0,0,0]
mulps %xmm10, %xmm3
movaps %xmm3, %xmm7
shufps $0x54, %xmm3, %xmm7     # xmm7 = xmm7[0,1],xmm3[1,1]
movapd %xmm2, %xmm8
shufps $0x55, %xmm2, %xmm8     # xmm8 = xmm8[1,1],xmm2[1,1]
movaps %xmm3, %xmm6
mulss %xmm0, %xmm6
addss %xmm1, %xmm6
movss %xmm6, 0x10(%rbp)
mulss %xmm2, %xmm3
addss %xmm4, %xmm3
movss %xmm3, 0x14(%rbp)
movaps %xmm0, %xmm5
shufps $0xd4, %xmm2, %xmm5     # xmm5 = xmm5[0,1],xmm2[1,3]
movaps %xmm5, %xmm9
shufps $0x42, %xmm2, %xmm9     # xmm9 = xmm9[2,0],xmm2[0,1]
mulps %xmm7, %xmm9
shufps $0xd4, %xmm4, %xmm1     # xmm1 = xmm1[0,1],xmm4[1,3]
shufps $0x42, %xmm4, %xmm1     # xmm1 = xmm1[2,0],xmm4[0,1]
addps %xmm9, %xmm1
movups %xmm1, 0x18(%rbp)
movb 0x20(%rbx), %al
movb %al, 0x34(%rbp)
movss 0x84(%rbx), %xmm11
movss 0x88(%rbx), %xmm10
movss 0x8c(%rbx), %xmm9
movaps %xmm2, %xmm4
mulss %xmm3, %xmm4
movaps %xmm6, %xmm12
mulss %xmm0, %xmm12
addss %xmm4, %xmm12
movaps %xmm1, %xmm7
mulss %xmm8, %xmm7
addss %xmm12, %xmm7
movaps %xmm2, %xmm4
shufps $0x0, %xmm2, %xmm4      # xmm4 = xmm4[0,0],xmm2[0,0]
movaps %xmm1, %xmm12
unpckhpd %xmm1, %xmm12           # xmm12 = xmm12[1],xmm1[1]
movaps %xmm1, %xmm13
shufps $0xaa, %xmm1, %xmm13    # xmm13 = xmm13[2,2],xmm1[2,2]
movss %xmm10, %xmm13          # xmm13 = xmm10[0],xmm13[1,2,3]
mulps %xmm4, %xmm13
movaps %xmm1, %xmm4
movss %xmm11, %xmm4           # xmm4 = xmm11[0],xmm4[1,2,3]
movaps %xmm0, %xmm14
shufps $0x0, %xmm0, %xmm14     # xmm14 = xmm14[0,0],xmm0[0,0]
mulps %xmm4, %xmm14
addps %xmm13, %xmm14
movss %xmm9, %xmm12           # xmm12 = xmm9[0],xmm12[1,2,3]
mulps %xmm8, %xmm12
addps %xmm14, %xmm12
movaps %xmm12, %xmm4
shufps $0x55, %xmm12, %xmm4    # xmm4 = xmm4[1,1],xmm12[1,1]
minss %xmm4, %xmm12
movaps %xmm7, %xmm4
maxss %xmm12, %xmm4
subss %xmm7, %xmm4
movaps %xmm4, %xmm7
mulss %xmm0, %xmm7
addss %xmm6, %xmm7
movaps %xmm4, %xmm6
mulss %xmm2, %xmm6
addss %xmm3, %xmm6
mulss %xmm8, %xmm4
addss %xmm1, %xmm4
subss %xmm11, %xmm7
subss %xmm10, %xmm6
subss %xmm9, %xmm4
movaps %xmm7, %xmm1
mulss %xmm7, %xmm1
cvtss2sd %xmm1, %xmm1
movaps %xmm6, %xmm3
mulss %xmm6, %xmm3
cvtss2sd %xmm3, %xmm3
addsd %xmm1, %xmm3
movaps %xmm4, %xmm1
mulss %xmm4, %xmm1
cvtss2sd %xmm1, %xmm1
addsd %xmm3, %xmm1
sqrtsd %xmm1, %xmm1
cvtsd2ss %xmm1, %xmm1
movss %xmm1, 0x38(%rbp)
shufps $0x52, %xmm2, %xmm5     # xmm5 = xmm5[2,0],xmm2[1,1]
movss 0x148(%rbx), %xmm3
movsd 0x14c(%rbx), %xmm8
mulps %xmm8, %xmm5
movaps %xmm3, %xmm1
shufps $0xd4, %xmm8, %xmm1     # xmm1 = xmm1[0,1],xmm8[1,3]
shufps $0x52, %xmm8, %xmm1     # xmm1 = xmm1[2,0],xmm8[1,1]
mulps %xmm2, %xmm1
subps %xmm5, %xmm1
mulss %xmm2, %xmm3
mulss %xmm8, %xmm0
subss %xmm3, %xmm0
movaps %xmm1, %xmm2
mulps %xmm1, %xmm2
shufps $0x55, %xmm2, %xmm2     # xmm2 = xmm2[1,1,1,1]
movaps %xmm1, %xmm3
mulss %xmm1, %xmm3
addss %xmm2, %xmm3
movaps %xmm0, %xmm2
mulss %xmm0, %xmm2
addss %xmm3, %xmm2
cvtss2sd %xmm2, %xmm2
sqrtsd %xmm2, %xmm2
movsd 0x1f64a(%rip), %xmm3    # 0x37118
ucomisd %xmm2, %xmm3
movq %rsi, 0x10(%rsp)
jbe 0x17ae1
xorps %xmm1, %xmm1
xorps %xmm0, %xmm0
jmp 0x17b00
cvtps2pd %xmm1, %xmm1
movapd %xmm2, %xmm3
unpcklpd %xmm2, %xmm3            # xmm3 = xmm3[0],xmm2[0]
divpd %xmm3, %xmm1
cvtpd2ps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm0
divsd %xmm2, %xmm0
cvtsd2ss %xmm0, %xmm0
mulss %xmm1, %xmm7
shufps $0x55, %xmm1, %xmm1     # xmm1 = xmm1[1,1,1,1]
mulss %xmm1, %xmm6
addss %xmm7, %xmm6
mulss %xmm0, %xmm4
addss %xmm6, %xmm4
movss %xmm4, 0x3c(%rbp)
xorps %xmm0, %xmm0
cvtss2sd 0x1c(%rbx), %xmm0
movsd %xmm0, 0x18(%rsp)
movss 0x34(%rdx), %xmm0
minss 0x1f56c(%rip), %xmm0    # 0x370a4
cvtss2sd %xmm0, %xmm0
callq 0x42b0
addsd 0x18(%rsp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x40(%rbp)
movss 0x20(%r12), %xmm0
movss %xmm0, 0x44(%rbp)
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movsd 0x1f5ad(%rip), %xmm2    # 0x37118
ucomisd %xmm1, %xmm2
jae 0x17c02
movss 0x1f527(%rip), %xmm1    # 0x370a4
divss %xmm0, %xmm1
cvtss2sd %xmm1, %xmm1
movsd 0x1f58b(%rip), %xmm2    # 0x37118
ucomisd %xmm1, %xmm2
jae 0x17c02
movq %r12, %rax
addss 0x227e2(%rip), %xmm0    # 0x3a380
andps 0x2279b(%rip), %xmm0    # 0x3a340
cvtss2sd %xmm0, %xmm0
movsd 0x22eff(%rip), %xmm1    # 0x3aab0
ucomisd %xmm0, %xmm1
ja 0x17bbb
movb $0x0, 0x34(%rbp)
movq 0x10(%rsp), %r12
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups 0x20(%r12), %xmm2
movups %xmm2, 0x68(%rbp)
movups %xmm1, 0x58(%rbp)
movups %xmm0, 0x48(%rbp)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm0, 0x78(%rbp)
movups %xmm1, 0x88(%rbp)
movups %xmm2, 0x98(%rbp)
incl 0x17c(%rbx)
jmp 0x17c37
movl 0x18(%rbx), %edx
movl 0x8(%rbp), %ecx
movq 0x20(%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 0x231ab(%rip), %rsi     # 0x3addb
movb $0x3, %al
callq 0xa446
movq 0x8(%rsp), %rdi
incl %r15d
movswl 0x8(%rdi), %eax
cmpl %eax, %r15d
jl 0x17560
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x17c5d
movq %rax, %rbx
movl $0x20, %esi
movq %r15, %rdi
jmp 0x17c75
movq %rax, %rbx
movl $0x20, %esi
movq %r12, %rdi
callq 0x42f0
movq %rbx, %rdi
callq 0x4580