// File: /workspace/github_cpp_makefile_star2_O1/FreeSlave[P]vhlt/hlcsg/brush.cpp
// Function: ExpandBrush(brush_s*, int)
void ExpandBrush(brush_t* brush, const int hullnum)
{
#ifdef HLCSG_HULLBRUSH
	const hullshape_t *hs = &g_defaulthulls[hullnum];
	{ // look up the name of its hull shape in g_hullshapes[]
		const char *name = brush->hullshapes[hullnum];
		if (name && *name)
		{
			bool found = false;
			for (int i = 0; i < g_numhullshapes; i++)
			{
				const hullshape_t *s = &g_hullshapes[i];
				if (!strcmp (name, s->id))
				{
					if (found)
					{
						Warning ("Entity %i, Brush %i: Found several info_hullshape entities with the same name '%s'.",
#ifdef HLCSG_COUNT_NEW
							brush->originalentitynum, brush->originalbrushnum,
#else
							brush->entitynum, brush->brushnum,
#endif
							name);
					}
					hs = s;
					found = true;
				}
			}
			if (!found)
			{
				Error ("Entity %i, Brush %i: Couldn't find info_hullshape entity '%s'.",
#ifdef HLCSG_COUNT_NEW
					brush->originalentitynum, brush->originalbrushnum,
#else
					brush->entitynum, brush->brushnum,
#endif
					name);
			}
		}
	}

	if (!hs->disabled)
	{
		if (hs->numbrushes == 0)
		{
			return; // leave this hull of this brush empty (noclip)
		}
		ExpandBrushWithHullBrush (brush, &brush->hulls[0], hs->brushes[0], &brush->hulls[hullnum]);

		return;
	}
#endif
	//for looping through the faces and constructing the hull
	bface_t* current_face;
	plane_t* current_plane;
	brushhull_t* hull;
	vec3_t	origin, normal;

	//for non-axial bevel testing
	Winding* winding;
	bface_t* other_face;
	plane_t* other_plane;
	Winding* other_winding;
	vec3_t  edge_start, edge_end, edge, bevel_edge;
	unsigned int counter, counter2, dir;
	bool start_found,end_found;
	bool axialbevel[last_axial+1][2] = { {false,false}, {false,false}, {false,false} };

	bool warned = false;

	hull = &brush->hulls[hullnum];

	// step 1: for collision between player vertex and brush face. --vluzacn
	for(current_face = brush->hulls[0].faces; current_face; current_face = current_face->next)
	{
		current_plane = current_face->plane;

		//don't bother adding axial planes,
		//they're defined by adding the bounding box anyway
		if(current_plane->type <= last_axial)
		{
			//flag case where bounding box shouldn't expand
#ifdef HLCSG_CUSTOMHULL
			if (current_face->bevel)
#else
			if((g_texinfo[current_face->texinfo].flags & TEX_BEVEL))
#endif
			{
				switch(current_plane->type)
				{
				case plane_x:
					axialbevel[plane_x][(current_plane->normal[0] > 0 ? 1 : 0)] = true;
					break;
				case plane_y:
					axialbevel[plane_y][(current_plane->normal[1] > 0 ? 1 : 0)] = true;
					break;
				case plane_z:
					axialbevel[plane_z][(current_plane->normal[2] > 0 ? 1 : 0)] = true;
					break;
				}
			}
			continue;
		}

		//add the offset non-axial plane to the expanded hull
        VectorCopy(current_plane->origin, origin);
        VectorCopy(current_plane->normal, normal);

		//old code multiplied offset by normal -- this led to post-csg "sticky" walls where a
		//slope met an axial plane from the next brush since the offset from the slope would be less
		//than the full offset for the axial plane -- the discontinuity also contributes to increased
		//clipnodes.  If the normal is zero along an axis, shifting the origin in that direction won't
		//change the plane number, so I don't explicitly test that case.  The old method is still used if
		//preciseclip is turned off to allow backward compatability -- some of the improperly beveled edges
		//grow using the new origins, and might cause additional problems.

#ifdef HLCSG_CUSTOMHULL
		if (current_face->bevel)
#else
		if((g_texinfo[current_face->texinfo].flags & TEX_BEVEL))
#endif
		{
			//don't adjust origin - we'll correct g_texinfo's flags in a later step
		}
#ifdef HLCSG_CLIPTYPEPRECISE_EPSILON_FIX
		// The old offset will generate an extremely small gap when the normal is close to axis, causing epsilon errors (ambiguous leafnode content, player falling into ground, etc.).
		// For example: with the old shifting method, slopes with angle arctan(1/8) and arctan(1/64) will result in gaps of 0.0299 unit and 0.000488 unit respectively, which are smaller than ON_EPSILON, while in both 'simple' cliptype and the new method, the gaps are 2.0 units and 0.25 unit, which are good.
		// This also reduce the number of clipnodes used for cliptype precise.
		// The maximum difference in height between the old offset and the new offset is 0.86 unit for standing player and 6.9 units for ducking player. (when FLOOR_Z = 0.7)
		// And another reason not to use the old offset is that the old offset is quite wierd. It might appears at first glance that it regards the player as an ellipse, but in fact it isn't, and the player's feet may even sink slightly into the ground theoretically for slopes of certain angles.
		else if (g_cliptype == clip_precise && normal[2] > FLOOR_Z)
		{
			origin[0] += 0;
			origin[1] += 0;
			origin[2] += g_hull_size[hullnum][1][2];
		}
		else if (g_cliptype == clip_legacy || g_cliptype == clip_normalized)
#else
		else if(g_cliptype == clip_legacy || (g_cliptype == clip_precise && (normal[2] > FLOOR_Z)) || g_cliptype == clip_normalized)
#endif
		{
			if(normal[0])
			{ origin[0] += normal[0] * (normal[0] > 0 ? g_hull_size[hullnum][1][0] : -g_hull_size[hullnum][0][0]); }
			if(normal[1])
			{ origin[1] += normal[1] * (normal[1] > 0 ? g_hull_size[hullnum][1][1] : -g_hull_size[hullnum][0][1]); }
			if(normal[2])
			{ origin[2] += normal[2] * (normal[2] > 0 ? g_hull_size[hullnum][1][2] : -g_hull_size[hullnum][0][2]); }
		}
		else
		{
			origin[0] += g_hull_size[hullnum][(normal[0] > 0 ? 1 : 0)][0];
			origin[1] += g_hull_size[hullnum][(normal[1] > 0 ? 1 : 0)][1];
			origin[2] += g_hull_size[hullnum][(normal[2] > 0 ? 1 : 0)][2];
		}

		AddHullPlane(hull,normal,origin,false);
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rdi, %r15
movl %esi, 0x2c(%rsp)
movslq %esi, %rbx
leaq (%rbx,%rbx,2), %rcx
leaq 0x30bd61c(%rip), %rax   # 0x30cc950
movq %rcx, 0x80(%rsp)
leaq (%rax,%rcx,8), %r12
movq 0x38(%rdi,%rbx,8), %r14
testq %r14, %r14
movq %rdi, 0x8(%rsp)
je 0xf3ea
cmpb $0x0, (%r14)
je 0xf3ea
cmpl $0x0, 0x30bd64c(%rip)   # 0x30cc9b0
jle 0xf3be
leaq 0x30bd653(%rip), %r13   # 0x30cc9c0
xorl %ebp, %ebp
xorl %r15d, %r15d
movq (%r13), %rsi
movq %r14, %rdi
callq 0x4450
testl %eax, %eax
jne 0xf3a9
testb $0x1, %bpl
je 0xf3a3
movq 0x8(%rsp), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
leaq 0x102d0(%rip), %rdi     # 0x1f669
movq %r14, %rcx
xorl %eax, %eax
callq 0xa612
movb $0x1, %bpl
movq %r13, %r12
incq %r15
movslq 0x30bd5fd(%rip), %rax   # 0x30cc9b0
addq $0x18, %r13
cmpq %rax, %r15
jl 0xf372
jmp 0xf3c0
xorl %ebp, %ebp
testb $0x1, %bpl
je 0xf3cd
movq 0x8(%rsp), %r15
jmp 0xf3ea
movq 0x8(%rsp), %r15
movl (%r15), %esi
movl 0x4(%r15), %edx
leaq 0x102dd(%rip), %rdi     # 0x1f6bd
movq %r14, %rcx
xorl %eax, %eax
callq 0xa2a0
cmpb $0x0, 0x8(%r12)
je 0x100d4
movw $0x0, 0x4(%rsp)
movl $0x0, (%rsp)
imulq $0x38, %rbx, %rax
addq %r15, %rax
addq $0x60, %rax
movq %rax, 0x88(%rsp)
movq 0x90(%r15), %rbx
testq %rbx, %rbx
je 0xf6c9
movq 0x80(%rsp), %r14
shlq $0x4, %r14
leaq 0x19f36(%rip), %rax     # 0x29370
leaq (%rax,%r14), %rcx
movq %rcx, 0xb0(%rsp)
leaq (%rax,%r14), %rcx
addq $0x18, %rcx
movq %rcx, 0x70(%rsp)
leaq 0x28(%rax,%r14), %rax
movq %rax, 0x60(%rsp)
xorpd %xmm5, %xmm5
leaq 0x30(%rsp), %r12
leaq 0x20bd4d3(%rip), %rbp   # 0x20cc940
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
addq 0x18b1e(%rip), %r14     # 0x27f98
movq 0x10(%rbx), %rax
movl 0x38(%rax), %ecx
cmpl $0x2, %ecx
jg 0xf4c0
cmpb $0x1, 0x30(%rbx)
jne 0xf6bd
cmpl $0x2, %ecx
je 0xf56f
cmpl $0x1, %ecx
je 0xf557
testl %ecx, %ecx
jne 0xf6bd
movsd (%rax), %xmm0
xorl %eax, %eax
ucomisd %xmm5, %xmm0
seta %al
movb $0x1, (%rsp,%rax)
jmp 0xf6bd
movupd 0x18(%rax), %xmm2
movapd %xmm2, 0x30(%rsp)
movsd 0x28(%rax), %xmm0
movsd %xmm0, 0x40(%rsp)
movupd (%rax), %xmm3
movapd %xmm3, 0x10(%rsp)
movsd 0x10(%rax), %xmm1
movsd %xmm1, 0x20(%rsp)
cmpb $0x0, 0x30(%rbx)
jne 0xf672
leaq 0x19f6c(%rip), %rax     # 0x29468
movl (%rax), %eax
cmpl $0x3, %eax
jne 0xf529
ucomisd 0x10045(%rip), %xmm1    # 0x1f550
jbe 0xf529
addpd 0xffcb(%rip), %xmm2     # 0x1f4e0
movapd %xmm2, 0x30(%rsp)
movq 0x60(%rsp), %rax
addsd (%rax), %xmm0
jmp 0xf5d0
cmpl $0x4, %eax
je 0xf533
cmpl $0x1, %eax
jne 0xf587
ucomisd %xmm5, %xmm3
jne 0xf53f
jnp 0xf5fb
ucomisd %xmm5, %xmm3
jbe 0xf5d9
movq 0x70(%rsp), %rax
movsd (%rax), %xmm4
jmp 0xf5ed
movsd 0x8(%rax), %xmm0
xorl %eax, %eax
ucomisd %xmm5, %xmm0
seta %al
movb $0x1, 0x2(%rsp,%rax)
jmp 0xf6bd
movsd 0x10(%rax), %xmm0
xorl %eax, %eax
ucomisd %xmm5, %xmm0
seta %al
movb $0x1, 0x4(%rsp,%rax)
jmp 0xf6bd
xorl %eax, %eax
ucomisd %xmm5, %xmm3
seta %al
leaq (%rax,%rax,2), %rax
unpckhpd %xmm3, %xmm3            # xmm3 = xmm3[1,1]
xorl %ecx, %ecx
ucomisd %xmm5, %xmm3
seta %cl
leaq (%rcx,%rcx,2), %rcx
movsd (%r14,%rax,8), %xmm3
movhpd 0x8(%r14,%rcx,8), %xmm3 # xmm3 = xmm3[0],mem[0]
addpd %xmm3, %xmm2
movapd %xmm2, 0x30(%rsp)
xorl %eax, %eax
ucomisd %xmm5, %xmm1
seta %al
leaq (%rax,%rax,2), %rax
addsd 0x10(%r14,%rax,8), %xmm0
movapd %xmm0, %xmm1
jmp 0xf66c
movq 0xb0(%rsp), %rax
movsd (%rax), %xmm4
xorpd 0xfd13(%rip), %xmm4     # 0x1f300
mulsd %xmm3, %xmm4
addsd %xmm2, %xmm4
movsd %xmm4, 0x30(%rsp)
unpckhpd %xmm3, %xmm3            # xmm3 = xmm3[1,1]
ucomisd %xmm5, %xmm3
jne 0xf607
jnp 0xf63d
ucomisd %xmm5, %xmm3
jbe 0xf619
movq 0x70(%rsp), %rax
movsd 0x8(%rax), %xmm4
jmp 0xf62b
movq 0x70(%rsp), %rax
movsd -0x10(%rax), %xmm4
xorpd 0xfcd5(%rip), %xmm4     # 0x1f300
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
mulsd %xmm4, %xmm3
addsd %xmm2, %xmm3
movsd %xmm3, 0x38(%rsp)
ucomisd %xmm5, %xmm1
jne 0xf645
jnp 0xf672
jbe 0xf652
movq 0x60(%rsp), %rax
movsd (%rax), %xmm2
jmp 0xf664
movq 0x70(%rsp), %rax
movsd -0x8(%rax), %xmm2
xorpd 0xfc9c(%rip), %xmm2     # 0x1f300
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rsp)
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0xdf10
movl %eax, %r13d
movl $0x68, %edi
callq 0x4994
xorpd %xmm5, %xmm5
movl %r13d, 0x8(%rax)
movslq %r13d, %rcx
shlq $0x6, %rcx
addq %rbp, %rcx
movq %rcx, 0x10(%rax)
movq 0x88(%rsp), %rdx
movq 0x30(%rdx), %rcx
movq %rcx, (%rax)
movl %r15d, 0x28(%rax)
movq %rax, 0x30(%rdx)
movl %r15d, 0x20(%rax)
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0xf47a
movq 0x8(%rsp), %r13
leaq 0x60(%r13), %rax
movq %rax, 0xc0(%rsp)
leaq 0x19d87(%rip), %rax     # 0x29468
movl (%rax), %eax
decl %eax
cmpl $0x2, %eax
movl 0x2c(%rsp), %ebp
ja 0xfe07
movq 0x90(%r13), %r15
testq %r15, %r15
je 0xfe07
movq 0x80(%rsp), %rax
shlq $0x4, %rax
leaq 0x19c5b(%rip), %rcx     # 0x29370
leaq (%rcx,%rax), %rdx
movq %rdx, 0xa0(%rsp)
leaq (%rcx,%rax), %rdx
addq $0x18, %rdx
movq %rdx, 0x48(%rsp)
addq %rcx, %rax
addq $0x28, %rax
movq %rax, 0xa8(%rsp)
xorl %r12d, %r12d
movsd 0xfe00(%rip), %xmm2     # 0x1f548
movsd 0xc9c0(%rip), %xmm4     # 0x1c110
movapd 0xfbb8(%rip), %xmm5     # 0x1f310
movl $0x1, %ebx
movsd 0xfddb(%rip), %xmm6     # 0x1f540
movq 0x18(%r15), %rcx
movl 0x8(%rcx), %eax
testl %eax, %eax
je 0xfdfb
movq 0x10(%r15), %rdx
movq %rdx, 0x60(%rsp)
xorl %edx, %edx
movq %rcx, 0x50(%rsp)
movq 0x10(%rcx), %rcx
movq %rdx, %rsi
leaq (%rdx,%rdx,2), %rdx
movupd (%rcx,%rdx,8), %xmm7
movapd %xmm7, 0x180(%rsp)
movsd 0x10(%rcx,%rdx,8), %xmm0
incq %rsi
movl %eax, %eax
cmpq %rax, %rsi
movq %rsi, 0x58(%rsp)
movl %esi, %eax
movl $0x0, %edx
cmovneq %rax, %rdx
movaps %xmm0, 0x90(%rsp)
movsd %xmm0, 0x190(%rsp)
leaq (%rdx,%rdx,2), %rax
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, 0x160(%rsp)
movupd 0x8(%rcx,%rax,8), %xmm8
movupd %xmm8, 0x168(%rsp)
movq 0x90(%r13), %rax
testq %rax, %rax
je 0xf92c
movapd %xmm0, %xmm1
subsd %xmm7, %xmm1
movapd %xmm1, 0x70(%rsp)
movapd %xmm7, %xmm1
shufpd $0x1, 0x90(%rsp), %xmm1 # xmm1 = xmm1[1],mem[0]
subpd %xmm1, %xmm8
cmpq %r15, %rax
je 0xf920
movq 0x18(%rax), %rcx
movl 0x8(%rcx), %esi
testl %esi, %esi
je 0xf920
xorl %edx, %edx
xorl %edi, %edi
xorl %r8d, %r8d
movl %r8d, %r9d
testb $0x1, %dil
jne 0xf8a1
movq 0x10(%rcx), %r10
leaq (%r9,%r9,2), %r11
movsd (%r10,%r11,8), %xmm1
subsd %xmm7, %xmm1
andpd %xmm5, %xmm1
ucomisd %xmm6, %xmm1
ja 0xf8a1
leaq (%r10,%r11,8), %r10
addq $0x8, %r10
xorl %r14d, %r14d
movq %r14, %r11
cmpq $0x2, %r14
je 0xf896
movsd (%r10,%r11,8), %xmm1
subsd 0x188(%rsp,%r11,8), %xmm1
andpd %xmm5, %xmm1
leaq 0x1(%r11), %r14
ucomisd %xmm6, %xmm1
jbe 0xf86f
cmpq $0x2, %r11
movzbl %dil, %edi
cmovael %ebx, %edi
testb $0x1, %dl
jne 0xf8fe
movq 0x10(%rcx), %r10
leaq (%r9,%r9,2), %r9
movsd (%r10,%r9,8), %xmm1
subsd %xmm0, %xmm1
andpd %xmm5, %xmm1
ucomisd %xmm6, %xmm1
ja 0xf8fe
leaq (%r10,%r9,8), %r9
addq $0x8, %r9
xorl %r11d, %r11d
movq %r11, %r10
cmpq $0x2, %r11
je 0xf8f4
movsd (%r9,%r10,8), %xmm1
subsd 0x168(%rsp,%r10,8), %xmm1
andpd %xmm5, %xmm1
leaq 0x1(%r10), %r11
ucomisd %xmm6, %xmm1
jbe 0xf8cd
cmpq $0x2, %r10
movzbl %dl, %edx
cmovael %ebx, %edx
testb $0x1, %dil
je 0xf909
testb $0x1, %dl
jne 0xf915
incl %r8d
cmpl %esi, %r8d
jb 0xf83f
testb $0x1, %dil
je 0xf920
testb $0x1, %dl
jne 0xf991
movq (%rax), %rax
testq %rax, %rax
jne 0xf820
cmpl $0x1, %ebp
jne 0xfde5
testb $0x1, %r12b
movq 0x50(%rsp), %rcx
movq 0x58(%rsp), %rdx
jne 0xfdef
movl (%r13), %esi
movl 0x4(%r13), %edx
leaq 0xfcd0(%rip), %rdi      # 0x1f628
xorl %eax, %eax
callq 0xa612
movq 0x58(%rsp), %rdx
movq 0x50(%rsp), %rcx
movsd 0xfbcf(%rip), %xmm6     # 0x1f540
movapd 0xf997(%rip), %xmm5     # 0x1f310
movsd 0xc78f(%rip), %xmm4     # 0x1c110
movsd 0xfbbf(%rip), %xmm2     # 0x1f548
movb $0x1, %r12b
jmp 0xfdef
movq %r12, 0xc8(%rsp)
movq 0x10(%rax), %rbp
movapd %xmm8, %xmm1
shufpd $0x1, 0x70(%rsp), %xmm1 # xmm1 = xmm1[1],mem[0]
movapd 0xf94f(%rip), %xmm0     # 0x1f300
xorpd %xmm0, %xmm1
movapd %xmm1, 0xb0(%rsp)
movapd %xmm8, %xmm1
xorpd %xmm0, %xmm1
movapd %xmm1, 0x150(%rsp)
movapd %xmm7, %xmm0
addpd 0xfb04(%rip), %xmm0     # 0x1f4e0
movapd %xmm0, 0x120(%rsp)
movapd %xmm7, %xmm0
unpckhpd %xmm7, %xmm0            # xmm0 = xmm0[1],xmm7[1]
movapd %xmm0, 0x110(%rsp)
movl $0x2, %r12d
xorl %r14d, %r14d
movapd %xmm7, 0x100(%rsp)
movapd %xmm8, 0xf0(%rsp)
movq %r12, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rcx
movq 0x60(%rsp), %rax
movsd (%rax,%r14,8), %xmm0
movsd (%rbp,%r14,8), %xmm1
mulsd %xmm0, %xmm1
ucomisd %xmm1, %xmm2
jbe 0xfdc4
movq %rdx, %r13
xorl %eax, %eax
xorpd %xmm3, %xmm3
ucomisd %xmm3, %xmm0
seta %al
leaq 0xfa97(%rip), %rcx      # 0x1f4f0
movsd (%rcx,%rax,8), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, 0xd0(%rsp)
movq $0x0, 0xe0(%rsp)
movsd %xmm0, 0xd0(%rsp,%r14,8)
movsd 0xd0(%rsp), %xmm9
movupd 0xd8(%rsp), %xmm10
movapd %xmm10, %xmm0
mulpd 0xb0(%rsp), %xmm0
movapd 0x70(%rsp), %xmm1
mulsd %xmm10, %xmm1
shufpd $0x1, %xmm9, %xmm10     # xmm10 = xmm10[1],xmm9[0]
mulpd %xmm8, %xmm10
addpd %xmm0, %xmm10
movapd %xmm10, 0x10(%rsp)
mulsd 0x150(%rsp), %xmm9
addsd %xmm1, %xmm9
movsd %xmm9, 0x20(%rsp)
movapd %xmm10, %xmm0
mulpd %xmm10, %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
movapd %xmm10, %xmm1
mulsd %xmm10, %xmm1
addsd %xmm0, %xmm1
movapd %xmm9, %xmm0
mulsd %xmm9, %xmm0
addsd %xmm1, %xmm0
ucomisd %xmm3, %xmm0
jb 0xfb11
sqrtsd %xmm0, %xmm0
jmp 0xfb71
movapd %xmm9, 0x140(%rsp)
movapd %xmm10, 0x130(%rsp)
callq 0x4260
movapd 0x130(%rsp), %xmm10
movapd 0x140(%rsp), %xmm9
movapd 0xf0(%rsp), %xmm8
movapd 0x100(%rsp), %xmm7
movsd 0xf9e7(%rip), %xmm6     # 0x1f540
movapd 0xf7af(%rip), %xmm5     # 0x1f310
movsd 0xc5a7(%rip), %xmm4     # 0x1c110
movsd 0xf9d7(%rip), %xmm2     # 0x1f548
ucomisd %xmm0, %xmm4
jbe 0xfb8c
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
jmp 0xfba8
divsd %xmm0, %xmm9
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
divpd %xmm0, %xmm10
movapd %xmm10, 0x10(%rsp)
movsd %xmm9, 0x20(%rsp)
leaq 0x1(%r14), %rax
cmpq $0x2, %r14
movl $0x0, %ecx
cmovneq %rax, %rcx
movsd 0x10(%rsp,%rcx,8), %xmm0
andpd %xmm5, %xmm0
ucomisd %xmm0, %xmm4
jae 0xfdc4
shlq $0x2, %r13
andq $-0x8, %r13
leaq (,%r13,2), %rax
addq %r13, %rax
leaq 0x20(%rsp), %rcx
subq %rax, %rcx
movsd (%rcx,%r14,8), %xmm0
andpd %xmm5, %xmm0
ucomisd %xmm0, %xmm4
jae 0xfdc4
movapd %xmm7, 0x30(%rsp)
movaps 0x90(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
leaq 0x19851(%rip), %rax     # 0x29468
movl (%rax), %eax
movsd 0x20(%rsp), %xmm0
cmpl $0x3, %eax
jne 0xfc4c
ucomisd 0xf924(%rip), %xmm0     # 0x1f550
jbe 0xfc4c
movaps 0x120(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movq 0xa8(%rsp), %rax
movsd (%rax), %xmm0
jmp 0xfd66
movsd 0x10(%rsp), %xmm1
cmpl $0x1, %eax
jne 0xfc74
ucomisd 0xf651(%rip), %xmm1     # 0x1f2b0
jne 0xfc67
jnp 0xfcef
jbe 0xfccd
movq 0x48(%rsp), %rax
movsd (%rax), %xmm2
jmp 0xfce1
xorl %eax, %eax
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm1
seta %al
leaq (%rax,%rax,2), %rax
movsd 0x18(%rsp), %xmm1
xorl %ecx, %ecx
ucomisd %xmm2, %xmm1
seta %cl
leaq (%rcx,%rcx,2), %rcx
movq 0xa0(%rsp), %rdx
movsd (%rdx,%rax,8), %xmm1
movhpd 0x8(%rdx,%rcx,8), %xmm1 # xmm1 = xmm1[0],mem[0]
addpd %xmm7, %xmm1
xorl %eax, %eax
ucomisd %xmm2, %xmm0
seta %al
movapd %xmm1, 0x30(%rsp)
leaq (%rax,%rax,2), %rax
movsd 0x10(%rdx,%rax,8), %xmm0
jmp 0xfd66
movq 0xa0(%rsp), %rax
movsd (%rax), %xmm2
xorpd 0xf61f(%rip), %xmm2     # 0x1f300
mulsd %xmm2, %xmm1
addsd %xmm7, %xmm1
movsd %xmm1, 0x30(%rsp)
movsd 0x18(%rsp), %xmm1
ucomisd 0xf5b3(%rip), %xmm1     # 0x1f2b0
jne 0xfd01
jnp 0xfd34
jbe 0xfd0f
movq 0x48(%rsp), %rax
movsd 0x8(%rax), %xmm2
jmp 0xfd21
movq 0x48(%rsp), %rax
movsd -0x10(%rax), %xmm2
xorpd 0xf5df(%rip), %xmm2     # 0x1f300
mulsd %xmm2, %xmm1
addsd 0x110(%rsp), %xmm1
movsd %xmm1, 0x38(%rsp)
ucomisd 0xf574(%rip), %xmm0     # 0x1f2b0
jne 0xfd40
jnp 0xfd75
jbe 0xfd50
movq 0xa8(%rsp), %rax
movsd (%rax), %xmm1
jmp 0xfd62
movq 0x48(%rsp), %rax
movsd -0x8(%rax), %xmm1
xorpd 0xf59e(%rip), %xmm1     # 0x1f300
mulsd %xmm1, %xmm0
addsd 0x90(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movq 0x88(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movl $0x1, %ecx
callq 0xe45c
movsd 0xf7af(%rip), %xmm2     # 0x1f548
movsd 0xc36f(%rip), %xmm4     # 0x1c110
movapd 0xf567(%rip), %xmm5     # 0x1f310
movsd 0xf78f(%rip), %xmm6     # 0x1f540
movapd 0x100(%rsp), %xmm7
movapd 0xf0(%rsp), %xmm8
incq %r14
incq %r12
cmpq $0x3, %r14
jne 0xfa12
movq 0x8(%rsp), %r13
movl 0x2c(%rsp), %ebp
movq 0xc8(%rsp), %r12
movq 0x50(%rsp), %rcx
movq 0x58(%rsp), %rdx
movl 0x8(%rcx), %eax
cmpq %rax, %rdx
jb 0xf784
movq (%r15), %r15
testq %r15, %r15
jne 0xf765
movq 0x80(%rsp), %rbx
shlq $0x4, %rbx
leaq 0x19556(%rip), %rax     # 0x29370
movupd 0x60(%r13), %xmm0
addpd (%rax,%rbx), %xmm0
leaq 0x30(%rsp), %r15
movapd %xmm0, (%r15)
movsd 0x70(%r13), %xmm0
addsd 0x10(%rax,%rbx), %xmm0
movsd %xmm0, 0x10(%r15)
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
xorpd %xmm0, %xmm0
cmpb $0x0, (%rsp)
movupd %xmm0, 0x8(%rdi)
movq %r15, %rsi
movq 0xc0(%rsp), %r12
cmovneq %r12, %rsi
callq 0xdf10
movl %eax, %ebp
movl $0x68, %edi
callq 0x4994
movl %ebp, 0x8(%rax)
movslq %ebp, %rcx
shlq $0x6, %rcx
leaq 0x20bcaaf(%rip), %rdx   # 0x20cc940
addq %rdx, %rcx
movq %rcx, 0x10(%rax)
movq 0x88(%rsp), %r14
movq 0x30(%r14), %rcx
movq %rcx, (%rax)
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl %r13d, 0x28(%rax)
movq %rax, 0x30(%r14)
movl %r13d, 0x20(%rax)
xorpd %xmm0, %xmm0
movhpd 0xf3fb(%rip), %xmm0     # xmm0 = xmm0[0],mem[0]
movapd %xmm0, 0x60(%rsp)
cmpb $0x0, 0x2(%rsp)
leaq 0x10(%rsp), %rdi
movapd %xmm0, (%rdi)
movq %r15, %rsi
cmovneq %r12, %rsi
callq 0xdf10
movl %eax, %ebp
movl $0x68, %edi
callq 0x4994
movl %ebp, 0x8(%rax)
movslq %ebp, %rcx
shlq $0x6, %rcx
leaq 0x20bca3e(%rip), %rdx   # 0x20cc940
addq %rdx, %rcx
movq %rcx, 0x10(%rax)
movq 0x30(%r14), %rcx
movq %rcx, (%rax)
movl %r13d, 0x28(%rax)
movq %rax, 0x30(%r14)
movl %r13d, 0x20(%rax)
leaq 0x10(%rsp), %rdi
movaps 0x60(%rsp), %xmm0
movups %xmm0, 0x8(%rdi)
cmpb $0x0, 0x4(%rsp)
cmoveq %r15, %r12
movq %rdi, %r13
movq %r12, %rsi
callq 0xdf10
movl %eax, %ebp
movl $0x68, %edi
callq 0x4994
movl %ebp, 0x8(%rax)
movslq %ebp, %rcx
shlq $0x6, %rcx
leaq 0x20bc9e5(%rip), %rdx   # 0x20cc940
addq %rdx, %rcx
movq %rcx, 0x10(%rax)
movq 0x30(%r14), %rcx
movq %rcx, (%rax)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %ecx, 0x28(%rax)
movq %rax, 0x30(%r14)
movl %ecx, 0x20(%rax)
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq $0x0, 0x10(%r13)
movq 0x8(%rsp), %rax
leaq 0x78(%rax), %rbp
movupd 0x78(%rax), %xmm0
movq %rax, %rcx
leaq 0x193d2(%rip), %rax     # 0x29370
movupd 0x18(%rax,%rbx), %xmm1
addpd %xmm0, %xmm1
movapd %xmm1, (%r15)
movsd 0x88(%rcx), %xmm0
addsd 0x28(%rax,%rbx), %xmm0
movsd %xmm0, 0x10(%r15)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
cmpb $0x0, 0x1(%rsp)
movq %rax, (%r13)
movq %r15, %rsi
cmovneq %rbp, %rsi
movq %r13, %rdi
callq 0xdf10
movl %eax, %ebx
movl $0x68, %edi
callq 0x4994
movl %ebx, 0x8(%rax)
movslq %ebx, %rcx
shlq $0x6, %rcx
leaq 0x20bc940(%rip), %rdx   # 0x20cc940
addq %rdx, %rcx
movq %rcx, 0x10(%rax)
movq 0x30(%r14), %rcx
movq %rcx, (%rax)
movl %r12d, 0x28(%rax)
movq %rax, 0x30(%r14)
movl %r12d, 0x20(%rax)
xorpd %xmm0, %xmm0
movhpd 0xf0d2(%rip), %xmm0     # xmm0 = xmm0[0],mem[0]
movapd %xmm0, 0x60(%rsp)
cmpb $0x0, 0x3(%rsp)
movapd %xmm0, (%r13)
movq %r15, %rsi
cmovneq %rbp, %rsi
movq %r13, %rdi
callq 0xdf10
movl %eax, %ebx
movl $0x68, %edi
callq 0x4994
movl %ebx, 0x8(%rax)
movslq %ebx, %rcx
shlq $0x6, %rcx
leaq 0x20bc8dd(%rip), %rdx   # 0x20cc940
addq %rdx, %rcx
movq %rcx, 0x10(%rax)
movq 0x30(%r14), %rcx
movq %rcx, (%rax)
movl %r12d, 0x28(%rax)
movq %rax, 0x30(%r14)
movl %r12d, 0x20(%rax)
movaps 0x60(%rsp), %xmm0
movups %xmm0, 0x8(%r13)
cmpb $0x0, 0x5(%rsp)
cmovneq %rbp, %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0xdf10
movl %eax, %ebx
movl $0x68, %edi
callq 0x4994
movl %ebx, 0x8(%rax)
movslq %ebx, %rcx
shlq $0x6, %rcx
leaq 0x20bc888(%rip), %rdx   # 0x20cc940
addq %rdx, %rcx
movq %rcx, 0x10(%rax)
movq 0x30(%r14), %rcx
movq %rcx, (%rax)
movl %r12d, 0x28(%rax)
movq %rax, 0x30(%r14)
movl %r12d, 0x20(%rax)
jmp 0x1010d
cmpl $0x0, 0xc(%r12)
je 0x1010d
leaq 0x60(%r15), %rsi
movq 0x10(%r12), %rax
movq (%rax), %rdx
imulq $0x38, %rbx, %rax
leaq (%r15,%rax), %rcx
addq $0x60, %rcx
movq %r15, %rdi
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe4c8
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq