// File: /workspace/github_cpp_makefile_star2_O3/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 $0x178, %rsp            # imm = 0x178
movl %esi, 0x84(%rsp)
movslq %esi, %rbx
leaq (%rbx,%rbx,2), %rcx
leaq 0x30bd9ea(%rip), %rax   # 0x30cc940
movq %rcx, 0x70(%rsp)
leaq (%rax,%rcx,8), %r12
movq %rdi, 0x10(%rsp)
movq 0x38(%rdi,%rbx,8), %r14
testq %r14, %r14
je 0xf008
cmpb $0x0, (%r14)
je 0xf008
movl 0x30bda1d(%rip), %r15d  # 0x30cc9a0
testl %r15d, %r15d
jle 0xefed
movq %rbx, 0x40(%rsp)
leaq 0x30bda1c(%rip), %r13   # 0x30cc9b0
xorl %ebx, %ebx
xorl %ebp, %ebp
movq (%r13), %rsi
movq %r14, %rdi
callq 0x4440
testl %eax, %eax
jne 0xefd4
testb $0x1, %bl
je 0xefcf
movq 0x10(%rsp), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
leaq 0x1069b(%rip), %rdi     # 0x1f659
movq %r14, %rcx
xorl %eax, %eax
callq 0xa4d6
movl 0x30bd9d1(%rip), %r15d  # 0x30cc9a0
movb $0x1, %bl
movq %r13, %r12
incq %rbp
movslq %r15d, %rax
addq $0x18, %r13
cmpq %rax, %rbp
jl 0xef98
testb $0x1, %bl
movq 0x40(%rsp), %rbx
jne 0xf008
movq 0x10(%rsp), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
leaq 0x106af(%rip), %rdi     # 0x1f6ad
movq %r14, %rcx
xorl %eax, %eax
callq 0xa164
cmpb $0x0, 0x8(%r12)
je 0xfc11
movw $0x0, 0x4(%rsp)
movl $0x0, (%rsp)
imulq $0x38, %rbx, %rax
movq 0x10(%rsp), %rcx
addq %rcx, %rax
addq $0x60, %rax
movq %rax, 0x78(%rsp)
movq 0x90(%rcx), %rbx
testq %rbx, %rbx
je 0xf2af
movq 0x70(%rsp), %r14
shlq $0x4, %r14
leaq 0x1a309(%rip), %rax     # 0x29360
leaq (%rax,%r14), %rbp
addq $0x18, %rbp
addq %r14, %rax
movq %rax, 0x40(%rsp)
xorpd %xmm5, %xmm5
leaq 0x20(%rsp), %r12
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
addq 0x18f1b(%rip), %r14     # 0x27f98
movq 0x10(%rbx), %rax
movl 0x38(%rax), %ecx
cmpl $0x2, %ecx
jg 0xf0c3
cmpb $0x1, 0x30(%rbx)
jne 0xf2a3
cmpl $0x2, %ecx
je 0xf16a
cmpl $0x1, %ecx
je 0xf152
testl %ecx, %ecx
jne 0xf2a3
movsd (%rax), %xmm0
xorl %eax, %eax
ucomisd %xmm5, %xmm0
seta %al
movb $0x1, (%rsp,%rax)
jmp 0xf2a3
movupd 0x18(%rax), %xmm2
movapd %xmm2, 0x20(%rsp)
movsd 0x28(%rax), %xmm0
movsd %xmm0, 0x30(%rsp)
movupd (%rax), %xmm3
movapd %xmm3, 0x50(%rsp)
movsd 0x10(%rax), %xmm1
movsd %xmm1, 0x60(%rsp)
cmpb $0x0, 0x30(%rbx)
jne 0xf254
leaq 0x1a359(%rip), %rax     # 0x29458
movl (%rax), %eax
cmpl $0x3, %eax
jne 0xf128
ucomisd 0x10422(%rip), %xmm1    # 0x1f530
jbe 0xf128
addpd 0x103a8(%rip), %xmm2    # 0x1f4c0
movapd %xmm2, 0x20(%rsp)
addsd 0x10(%rbp), %xmm0
jmp 0xf1cb
cmpl $0x4, %eax
je 0xf132
cmpl $0x1, %eax
jne 0xf182
ucomisd %xmm5, %xmm3
jne 0xf13e
jnp 0xf1f0
ucomisd %xmm5, %xmm3
jbe 0xf1d1
movsd (%rbp), %xmm4
jmp 0xf1e2
movsd 0x8(%rax), %xmm0
xorl %eax, %eax
ucomisd %xmm5, %xmm0
seta %al
movb $0x1, 0x2(%rsp,%rax)
jmp 0xf2a3
movsd 0x10(%rax), %xmm0
xorl %eax, %eax
ucomisd %xmm5, %xmm0
seta %al
movb $0x1, 0x4(%rsp,%rax)
jmp 0xf2a3
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, 0x20(%rsp)
xorl %eax, %eax
ucomisd %xmm5, %xmm1
seta %al
leaq (%rax,%rax,2), %rax
addsd 0x10(%r14,%rax,8), %xmm0
movapd %xmm0, %xmm1
jmp 0xf24e
movq 0x40(%rsp), %rax
movsd (%rax), %xmm4
xorpd 0x100fe(%rip), %xmm4    # 0x1f2e0
mulsd %xmm3, %xmm4
addsd %xmm2, %xmm4
movsd %xmm4, 0x20(%rsp)
unpckhpd %xmm3, %xmm3            # xmm3 = xmm3[1,1]
ucomisd %xmm5, %xmm3
jne 0xf1fc
jnp 0xf228
ucomisd %xmm5, %xmm3
jbe 0xf209
movsd 0x8(%rbp), %xmm4
jmp 0xf216
movsd -0x10(%rbp), %xmm4
xorpd 0x100ca(%rip), %xmm4    # 0x1f2e0
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
mulsd %xmm4, %xmm3
addsd %xmm2, %xmm3
movsd %xmm3, 0x28(%rsp)
ucomisd %xmm5, %xmm1
jne 0xf230
jnp 0xf254
jbe 0xf239
movsd 0x10(%rbp), %xmm2
jmp 0xf246
movsd -0x8(%rbp), %xmm2
xorpd 0x1009a(%rip), %xmm2    # 0x1f2e0
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x30(%rsp)
leaq 0x50(%rsp), %rdi
movq %r12, %rsi
callq 0xdd08
movl %eax, %r13d
movl $0x68, %edi
callq 0x4974
xorpd %xmm5, %xmm5
movl %r13d, 0x8(%rax)
movslq %r13d, %rcx
shlq $0x6, %rcx
leaq 0x20bd6ac(%rip), %rdx   # 0x20cc930
addq %rdx, %rcx
movq %rcx, 0x10(%rax)
movq 0x78(%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 0xf07d
movq 0x10(%rsp), %rax
addq $0x60, %rax
movq %rax, 0x90(%rsp)
leaq 0x1a191(%rip), %rax     # 0x29458
movl (%rax), %eax
decl %eax
cmpl $0x2, %eax
ja 0xf94e
movq 0x10(%rsp), %rax
movq 0x90(%rax), %r12
testq %r12, %r12
je 0xf94e
movq 0x70(%rsp), %rax
shlq $0x4, %rax
leaq 0x1a067(%rip), %rcx     # 0x29360
leaq (%rcx,%rax), %rdx
movq %rdx, 0x88(%rsp)
addq %rcx, %rax
addq $0x18, %rax
movq %rax, 0x8(%rsp)
xorpd %xmm5, %xmm5
movsd 0x1020b(%rip), %xmm6    # 0x1f528
movsd 0xcdf3(%rip), %xmm7     # 0x1c118
movapd 0xffc2(%rip), %xmm8     # 0x1f2f0
movl $0x1, %r15d
movsd 0x101e3(%rip), %xmm9    # 0x1f520
movq $0x0, 0x40(%rsp)
movq 0x18(%r12), %rcx
movl 0x8(%rcx), %eax
testl %eax, %eax
je 0xf941
movq 0x10(%r12), %r13
xorl %ebp, %ebp
movq %rcx, 0x98(%rsp)
movq 0x10(%rcx), %rcx
leaq (,%rbp,2), %rdx
addq %rbp, %rdx
movupd (%rcx,%rdx,8), %xmm10
movapd %xmm10, 0x160(%rsp)
movsd 0x10(%rcx,%rdx,8), %xmm11
incq %rbp
movl %eax, %eax
cmpq %rax, %rbp
movl $0x0, %eax
cmovneq %rbp, %rax
movsd %xmm11, 0x170(%rsp)
leaq (%rax,%rax,2), %rax
movupd (%rcx,%rax,8), %xmm0
movapd %xmm0, 0x140(%rsp)
movsd 0x10(%rcx,%rax,8), %xmm12
movsd %xmm12, 0x150(%rsp)
movq 0x10(%rsp), %rax
movq 0x90(%rax), %rax
testq %rax, %rax
je 0xf52f
movapd %xmm10, %xmm1
unpckhpd %xmm10, %xmm1           # xmm1 = xmm1[1],xmm10[1]
movapd %xmm1, 0xd0(%rsp)
movapd %xmm0, %xmm13
subpd %xmm10, %xmm13
movapd %xmm13, %xmm14
unpckhpd %xmm13, %xmm14          # xmm14 = xmm14[1],xmm13[1]
unpcklpd %xmm0, %xmm12           # xmm12 = xmm12[0],xmm0[0]
movapd %xmm11, %xmm1
unpcklpd %xmm10, %xmm1           # xmm1 = xmm1[0],xmm10[0]
subpd %xmm1, %xmm12
cmpq %r12, %rax
je 0xf523
movq 0x18(%rax), %rcx
movl 0x8(%rcx), %esi
testl %esi, %esi
je 0xf523
xorl %edx, %edx
xorl %edi, %edi
xorl %r8d, %r8d
movl %r8d, %r9d
testb $0x1, %dil
jne 0xf49f
movq 0x10(%rcx), %r10
leaq (%r9,%r9,2), %r11
movsd (%r10,%r11,8), %xmm1
subsd %xmm10, %xmm1
andpd %xmm8, %xmm1
ucomisd %xmm9, %xmm1
ja 0xf49f
leaq (%r10,%r11,8), %r10
addq $0x8, %r10
xorl %ebx, %ebx
movq %rbx, %r11
cmpq $0x2, %rbx
je 0xf493
movsd (%r10,%r11,8), %xmm1
subsd 0x168(%rsp,%r11,8), %xmm1
andpd %xmm8, %xmm1
leaq 0x1(%r11), %rbx
ucomisd %xmm9, %xmm1
jbe 0xf46a
cmpq $0x2, %r11
movzbl %dil, %edi
cmovael %r15d, %edi
testb $0x1, %dl
jne 0xf501
movq 0x10(%rcx), %r10
leaq (%r9,%r9,2), %r9
movsd (%r10,%r9,8), %xmm1
subsd %xmm0, %xmm1
andpd %xmm8, %xmm1
ucomisd %xmm9, %xmm1
ja 0xf501
leaq (%r10,%r9,8), %r9
addq $0x8, %r9
xorl %r11d, %r11d
movq %r11, %r10
cmpq $0x2, %r11
je 0xf4f6
movsd (%r9,%r10,8), %xmm1
subsd 0x148(%rsp,%r10,8), %xmm1
andpd %xmm8, %xmm1
leaq 0x1(%r10), %r11
ucomisd %xmm9, %xmm1
jbe 0xf4cd
cmpq $0x2, %r10
movzbl %dl, %edx
cmovael %r15d, %edx
testb $0x1, %dil
je 0xf50c
testb $0x1, %dl
jne 0xf518
incl %r8d
cmpl %esi, %r8d
jb 0xf438
testb $0x1, %dil
je 0xf523
testb $0x1, %dl
jne 0xf5a0
movq (%rax), %rax
testq %rax, %rax
jne 0xf419
cmpl $0x1, 0x84(%rsp)
setne %al
orb 0x40(%rsp), %al
testb $0x1, %al
jne 0xf587
movq 0x10(%rsp), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
leaq 0x100c5(%rip), %rdi     # 0x1f618
xorl %eax, %eax
callq 0xa4d6
movsd 0xffbd(%rip), %xmm9     # 0x1f520
movapd 0xfd84(%rip), %xmm8     # 0x1f2f0
movsd 0xcba4(%rip), %xmm7     # 0x1c118
movsd 0xffac(%rip), %xmm6     # 0x1f528
xorpd %xmm5, %xmm5
movb $0x1, %al
movq %rax, 0x40(%rsp)
movq 0x98(%rsp), %rcx
movl 0x8(%rcx), %eax
cmpq %rax, %rbp
jb 0xf365
jmp 0xf941
movq 0x10(%rax), %rbx
movapd %xmm12, %xmm15
movapd 0xfd2f(%rip), %xmm0     # 0x1f2e0
xorpd %xmm0, %xmm15
movhlps %xmm12, %xmm13          # xmm13 = xmm12[1],xmm13[1]
xorps %xmm0, %xmm13
movapd %xmm10, %xmm0
addpd %xmm5, %xmm0
movapd %xmm0, 0xc0(%rsp)
xorl %eax, %eax
xorl %esi, %esi
movaps %xmm12, 0x110(%rsp)
movaps %xmm13, 0x100(%rsp)
movapd %xmm14, 0xf0(%rsp)
movapd %xmm15, 0xe0(%rsp)
movapd %xmm10, 0x130(%rsp)
movapd %xmm11, 0x120(%rsp)
movsd (%r13,%rax,8), %xmm1
movsd (%rbx,%rax,8), %xmm0
mulsd %xmm1, %xmm0
ucomisd %xmm0, %xmm6
jbe 0xf78d
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
ucomisd %xmm0, %xmm1
seta %cl
leaq 0xfe94(%rip), %rdx      # 0x1f4d0
movsd (%rdx,%rcx,8), %xmm1
movapd %xmm5, 0xa0(%rsp)
movq %rsi, 0xb0(%rsp)
movsd %xmm1, 0xa0(%rsp,%rax,8)
movsd 0xb0(%rsp), %xmm3
movapd 0xa0(%rsp), %xmm2
movapd %xmm2, %xmm4
unpckhpd %xmm2, %xmm4            # xmm4 = xmm4[1],xmm2[1]
mulsd %xmm15, %xmm4
movapd %xmm14, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm4, %xmm1
unpcklpd %xmm2, %xmm3            # xmm3 = xmm3[0],xmm2[0]
mulpd %xmm13, %xmm3
mulpd %xmm12, %xmm2
addpd %xmm3, %xmm2
movapd %xmm2, %xmm3
mulsd %xmm2, %xmm3
movapd %xmm1, %xmm4
mulsd %xmm1, %xmm4
addsd %xmm3, %xmm4
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
mulsd %xmm3, %xmm3
addsd %xmm4, %xmm3
sqrtsd %xmm3, %xmm3
xorl %ecx, %ecx
ucomisd %xmm3, %xmm7
seta %dl
ja 0xf6d4
divsd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpcklpd %xmm3, %xmm3            # xmm3 = xmm3[0,0]
divpd %xmm3, %xmm2
movb %dl, %cl
movd %ecx, %xmm1
pshufd $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
pslld $0x1f, %xmm1
psrad $0x1f, %xmm1
pandn %xmm2, %xmm1
movdqu %xmm1, 0x58(%rsp)
movsd %xmm0, 0x50(%rsp)
leaq 0x1(%rax), %r14
cmpq $0x2, %rax
movl %r14d, %ecx
cmoveq %rsi, %rcx
movsd 0x50(%rsp,%rcx,8), %xmm2
andpd %xmm8, %xmm2
ucomisd %xmm2, %xmm7
jae 0xf793
leal -0x1(%rax), %ecx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rcx
movsd 0x50(%rsp,%rcx,8), %xmm2
andpd %xmm8, %xmm2
ucomisd %xmm2, %xmm7
jae 0xf793
movapd %xmm10, 0x20(%rsp)
movsd %xmm11, 0x30(%rsp)
leaq 0x19d02(%rip), %rax     # 0x29458
movl (%rax), %eax
movdqa %xmm1, %xmm2
punpckhqdq %xmm1, %xmm2    # xmm2 = xmm2[1],xmm1[1]
cmpl $0x3, %eax
jne 0xf7a5
ucomisd 0xfdc3(%rip), %xmm2     # 0x1f530
jbe 0xf7a5
movapd 0xc0(%rsp), %xmm0
movapd %xmm0, 0x20(%rsp)
movq 0x8(%rsp), %rax
movsd 0x10(%rax), %xmm2
jmp 0xf8b6
incq %rax
movq %rax, %r14
movq %r14, %rax
cmpq $0x3, %r14
jne 0xf60e
jmp 0xf587
cmpl $0x1, %eax
jne 0xf7c7
ucomisd 0xfd86(%rip), %xmm0     # 0x1f538
jne 0xf7ba
jnp 0xf843
jbe 0xf820
movq 0x8(%rsp), %rax
movsd (%rax), %xmm3
jmp 0xf834
xorl %eax, %eax
ucomisd 0xfd67(%rip), %xmm0     # 0x1f538
seta %al
leaq (%rax,%rax,2), %rax
xorpd %xmm0, %xmm0
cmpltpd %xmm1, %xmm0
movmskpd %xmm0, %ecx
movl %ecx, %edx
shrb %dl
andl $0x1, %ecx
leaq (%rcx,%rcx,2), %rcx
movq 0x88(%rsp), %rsi
movsd (%rsi,%rax,8), %xmm0
movhpd 0x8(%rsi,%rcx,8), %xmm0 # xmm0 = xmm0[0],mem[0]
addpd %xmm10, %xmm0
movapd %xmm0, 0x20(%rsp)
movzbl %dl, %eax
leaq (%rax,%rax,2), %rax
movsd 0x10(%rsi,%rax,8), %xmm2
jmp 0xf8b6
movq 0x88(%rsp), %rax
movsd (%rax), %xmm3
xorpd 0xfaac(%rip), %xmm3     # 0x1f2e0
mulsd %xmm3, %xmm0
addsd %xmm10, %xmm0
movsd %xmm0, 0x20(%rsp)
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0xf84f
jnp 0xf88a
ucomisd %xmm0, %xmm1
jbe 0xf861
movq 0x8(%rsp), %rax
movsd 0x8(%rax), %xmm0
jmp 0xf873
movq 0x8(%rsp), %rax
movsd -0x10(%rax), %xmm0
xorpd 0xfa6d(%rip), %xmm0     # 0x1f2e0
mulsd %xmm0, %xmm1
addsd 0xd0(%rsp), %xmm1
movsd %xmm1, 0x28(%rsp)
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm2
jne 0xf892
jnp 0xf8c1
jbe 0xf8a0
movq 0x8(%rsp), %rax
movsd 0x10(%rax), %xmm0
jmp 0xf8b2
movq 0x8(%rsp), %rax
movsd -0x8(%rax), %xmm0
xorpd 0xfa2e(%rip), %xmm0     # 0x1f2e0
mulsd %xmm0, %xmm2
addsd %xmm11, %xmm2
movsd %xmm2, 0x30(%rsp)
movq 0x78(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movl $0x1, %ecx
callq 0xe214
movapd 0x120(%rsp), %xmm11
movapd 0x130(%rsp), %xmm10
xorl %esi, %esi
xorpd %xmm5, %xmm5
movsd 0xfc2c(%rip), %xmm6     # 0x1f528
movsd 0xc814(%rip), %xmm7     # 0x1c118
movapd 0xf9e3(%rip), %xmm8     # 0x1f2f0
movsd 0xfc0a(%rip), %xmm9     # 0x1f520
movaps 0x110(%rsp), %xmm12
movaps 0x100(%rsp), %xmm13
movapd 0xf0(%rsp), %xmm14
movapd 0xe0(%rsp), %xmm15
jmp 0xf793
movq (%r12), %r12
testq %r12, %r12
jne 0xf346
movq 0x70(%rsp), %r14
shlq $0x4, %r14
leaq 0x19a02(%rip), %rax     # 0x29360
movq 0x10(%rsp), %rbx
movupd 0x60(%rbx), %xmm0
addpd (%rax,%r14), %xmm0
leaq 0x20(%rsp), %r15
movapd %xmm0, (%r15)
movsd 0x70(%rbx), %xmm0
addsd 0x10(%rax,%r14), %xmm0
movsd %xmm0, 0x10(%r15)
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
leaq 0x50(%rsp), %rdi
movq %rax, (%rdi)
xorpd %xmm0, %xmm0
cmpb $0x0, (%rsp)
movupd %xmm0, 0x8(%rdi)
movq %r15, %rsi
movq 0x90(%rsp), %r12
cmovneq %r12, %rsi
callq 0xdd08
movl %eax, %ebp
movl $0x68, %edi
callq 0x4974
movl %ebp, 0x8(%rax)
movslq %ebp, %rcx
shlq $0x6, %rcx
leaq 0x20bcf56(%rip), %rdx   # 0x20cc930
addq %rdx, %rcx
movq %rcx, 0x10(%rax)
movq 0x78(%rsp), %r13
movq 0x30(%r13), %rcx
movq %rcx, (%rax)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %ecx, 0x28(%rax)
movq %rax, 0x30(%r13)
movl %ecx, 0x20(%rax)
xorpd %xmm0, %xmm0
movhpd 0xf8a0(%rip), %xmm0     # xmm0 = xmm0[0],mem[0]
movapd %xmm0, 0x40(%rsp)
cmpb $0x0, 0x2(%rsp)
leaq 0x50(%rsp), %rdi
movapd %xmm0, (%rdi)
movq %r15, %rsi
cmovneq %r12, %rsi
callq 0xdd08
movl %eax, %ebp
movl $0x68, %edi
callq 0x4974
movl %ebp, 0x8(%rax)
movslq %ebp, %rcx
shlq $0x6, %rcx
leaq 0x20bceeb(%rip), %rdx   # 0x20cc930
addq %rdx, %rcx
movq %rcx, 0x10(%rax)
movq 0x30(%r13), %rcx
movq %rcx, (%rax)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %ecx, 0x28(%rax)
movq %rax, 0x30(%r13)
movl %ecx, 0x20(%rax)
leaq 0x50(%rsp), %rdi
movaps 0x40(%rsp), %xmm0
movups %xmm0, 0x8(%rdi)
cmpb $0x0, 0x4(%rsp)
cmoveq %r15, %r12
movq %r12, %rsi
callq 0xdd08
movl %eax, %ebp
movl $0x68, %edi
callq 0x4974
movl %ebp, 0x8(%rax)
movslq %ebp, %rcx
shlq $0x6, %rcx
leaq 0x20bce92(%rip), %r12   # 0x20cc930
addq %r12, %rcx
movq %rcx, 0x10(%rax)
movq 0x30(%r13), %rcx
movq %rcx, (%rax)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %ecx, 0x28(%rax)
movq %rax, 0x30(%r13)
movl %ecx, 0x20(%rax)
leaq 0x50(%rsp), %rdi
movq $0x0, 0x10(%rdi)
leaq 0x78(%rbx), %rbp
movupd 0x78(%rbx), %xmm0
leaq 0x19888(%rip), %rax     # 0x29360
movupd 0x18(%rax,%r14), %xmm1
addpd %xmm0, %xmm1
movapd %xmm1, (%r15)
movsd 0x88(%rbx), %xmm0
addsd 0x28(%rax,%r14), %xmm0
movsd %xmm0, 0x10(%r15)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
cmpb $0x0, 0x1(%rsp)
movq %rax, (%rdi)
movq %r15, %rsi
cmovneq %rbp, %rsi
callq 0xdd08
movl %eax, %ebx
movl $0x68, %edi
callq 0x4974
movl %ebx, 0x8(%rax)
movslq %ebx, %rcx
shlq $0x6, %rcx
movq %r12, %r14
addq %r12, %rcx
movq %rcx, 0x10(%rax)
movq 0x30(%r13), %rcx
movq %rcx, (%rax)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %ecx, 0x28(%rax)
movq %rax, 0x30(%r13)
movl %ecx, 0x20(%rax)
xorpd %xmm0, %xmm0
movhpd 0xf58b(%rip), %xmm0     # xmm0 = xmm0[0],mem[0]
movapd %xmm0, 0x10(%rsp)
cmpb $0x0, 0x3(%rsp)
leaq 0x50(%rsp), %rdi
movapd %xmm0, (%rdi)
movq %r15, %rsi
cmovneq %rbp, %rsi
movq %rdi, %r12
callq 0xdd08
movl %eax, %ebx
movl $0x68, %edi
callq 0x4974
movl %ebx, 0x8(%rax)
movslq %ebx, %rcx
shlq $0x6, %rcx
addq %r14, %rcx
movq %rcx, 0x10(%rax)
movq 0x30(%r13), %rcx
movq %rcx, (%rax)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %ecx, 0x28(%rax)
movq %rax, 0x30(%r13)
movl %ecx, 0x20(%rax)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movaps 0x10(%rsp), %xmm0
movups %xmm0, 0x8(%r12)
cmpb $0x0, 0x5(%rsp)
cmovneq %rbp, %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0xdd08
movl %eax, %ebx
movl $0x68, %edi
callq 0x4974
movl %ebx, 0x8(%rax)
movslq %ebx, %rcx
shlq $0x6, %rcx
leaq 0x20bcd3b(%rip), %rdx   # 0x20cc930
addq %rdx, %rcx
movq %rcx, 0x10(%rax)
movq 0x30(%r13), %rcx
movq %rcx, (%rax)
movl %r14d, 0x28(%rax)
movq %rax, 0x30(%r13)
movl %r14d, 0x20(%rax)
jmp 0xfc4c
cmpl $0x0, 0xc(%r12)
je 0xfc4c
movq 0x10(%rsp), %rdi
leaq 0x60(%rdi), %rsi
movq 0x10(%r12), %rax
movq (%rax), %rdx
imulq $0x38, %rbx, %rax
leaq (%rdi,%rax), %rcx
addq $0x60, %rcx
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe280
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq