// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/mdsprite.c
// Function: voxdraw
int voxdraw (voxmodel *m, spritetype *tspr, int method)
{
	point3d m0, a0;
	float f, g, k0, k1, k2, k3, k4, k5, k6, k7, mat[16], omat[16], pc[4];
	struct polymostdrawpolycall draw;

	//updateanimation((md2model *)m,tspr);
	if ((tspr->cstat&48)==32) return 0;

	m0.x = m->scale;
	m0.y = m->scale;
	m0.z = m->scale;
	a0.x = a0.y = 0; a0.z = m->zadd*m->scale;

	//if (globalorientation&8) //y-flipping
	//{
	//   m0.z = -m0.z; a0.z = -a0.z;
	//      //Add height of 1st frame (use same frame to prevent animation bounce)
	//   a0.z += m->zsiz*m->scale;
	//}
	//if (globalorientation&4) { m0.y = -m0.y; a0.y = -a0.y; } //x-flipping

	f = ((float)tspr->xrepeat)*(256.0/320.0)/64.0*m->bscale;
	m0.x *= f; a0.x *= f; f = -f;
	m0.y *= f; a0.y *= f;
	f = ((float)tspr->yrepeat)/64.0*m->bscale;
	m0.z *= f; a0.z *= f;

	k0 = tspr->z;
	if (globalorientation&128) k0 += (float)((tilesizy[tspr->picnum]*tspr->yrepeat)<<1);

	f = (65536.0*512.0)/((float)xdimen*viewingrange);
	g = 32.0/((float)xdimen*gxyaspect);
	m0.y *= f; a0.y = (((float)(tspr->x-globalposx))/  1024.0 + a0.y)*f;
	m0.x *=-f; a0.x = (((float)(tspr->y-globalposy))/ -1024.0 + a0.x)*-f;
	m0.z *= g; a0.z = (((float)(k0     -globalposz))/-16384.0 + a0.z)*g;

	k0 = ((float)(tspr->x-globalposx))*f/1024.0;
	k1 = ((float)(tspr->y-globalposy))*f/1024.0;
	f = gcosang2*gshang;
	g = gsinang2*gshang;
	k4 = (float)sintable[(tspr->ang+spriteext[tspr->owner].angoff+1024)&2047] / 16384.0;
	k5 = (float)sintable[(tspr->ang+spriteext[tspr->owner].angoff+ 512)&2047] / 16384.0;
	k2 = k0*(1-k4)+k1*k5;
	k3 = k1*(1-k4)-k0*k5;
	k6 = f*gstang - gsinang*gctang; k7 = g*gstang + gcosang*gctang;
	mat[0] = k4*k6 + k5*k7; mat[4] = gchang*gstang; mat[ 8] = k4*k7 - k5*k6; mat[12] = k2*k6 + k3*k7;
	k6 = f*gctang + gsinang*gstang; k7 = g*gctang - gcosang*gstang;
	mat[1] = k4*k6 + k5*k7; mat[5] = gchang*gctang; mat[ 9] = k4*k7 - k5*k6; mat[13] = k2*k6 + k3*k7;
	k6 =           gcosang2*gchang; k7 =           gsinang2*gchang;
	mat[2] = k4*k6 + k5*k7; mat[6] =-gshang;        mat[10] = k4*k7 - k5*k6; mat[14] = k2*k6 + k3*k7;

	mat[12] += a0.y*mat[0] + a0.z*mat[4] + a0.x*mat[ 8];
	mat[13] += a0.y*mat[1] + a0.z*mat[5] + a0.x*mat[ 9];
	mat[14] += a0.y*mat[2] + a0.z*mat[6] + a0.x*mat[10];

		//Mirrors
	if (grhalfxdown10x < 0) { mat[0] = -mat[0]; mat[4] = -mat[4]; mat[8] = -mat[8]; mat[12] = -mat[12]; }

//------------
	//bit 10 is an ugly hack in game.c\animatesprites telling MD2SPRITE
	//to use Z-buffer hacks to hide overdraw problems with the shadows
	if (tspr->cstat&1024)
	{
		glfunc.glDepthFunc(GL_LESS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS
#if (USE_OPENGL == USE_GLES2)
		glfunc.glDepthRangef(0.f,0.9999f);
#else
		glfunc.glDepthRange(0.0,0.9999);
#endif
	}
	if ((grhalfxdown10x >= 0) /*^ ((globalorientation&8) != 0) ^ ((globalorientation&4) != 0)*/) glfunc.glFrontFace(GL_CW); else glfunc.glFrontFace(GL_CCW);
	glfunc.glEnable(GL_CULL_FACE);
	glfunc.glCullFace(GL_BACK);

	pc[0] = pc[1] = pc[2] = ((float)(numpalookups-min(max(globalshade+m->shadeoff,0),numpalookups)))/((float)numpalookups);
	pc[0] *= (float)hictinting[globalpal].r / 255.0;
	pc[1] *= (float)hictinting[globalpal].g / 255.0;
	pc[2] *= (float)hictinting[globalpal].b / 255.0;
	if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; } else pc[3] = 1.0;
	if (tspr->cstat&2) glfunc.glEnable(GL_BLEND); else glfunc.glDisable(GL_BLEND);
//------------

		//transform to Build coords
	memcpy(omat,mat,sizeof(omat));
	f = 1.f/64.f;
	g = m0.x*f; mat[0] *= g; mat[1] *= g; mat[2] *= g;
	g = m0.y*f; mat[4] = omat[8]*g; mat[5] = omat[9]*g; mat[6] = omat[10]*g;
	g =-m0.z*f; mat[8] = omat[4]*g; mat[9] = omat[5]*g; mat[10] = omat[6]*g;
	mat[12] -= (m->xpiv*mat[0] + m->ypiv*mat[4] + (m->zpiv+m->zsiz*.5)*mat[ 8]);
	mat[13] -= (m->xpiv*mat[1] + m->ypiv*mat[5] + (m->zpiv+m->zsiz*.5)*mat[ 9]);
	mat[14] -= (m->xpiv*mat[2] + m->ypiv*mat[6] + (m->zpiv+m->zsiz*.5)*mat[10]);
	mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f;

	if (!m->texid[globalpal]) {
		m->texid[globalpal] = gloadtex(m->mytex,m->mytexx,m->mytexy,m->is8bit,globalpal);
	}

	draw.texture0 = m->texid[globalpal];
	draw.texture1 = 0;
	draw.alphacut = 0.32;
	draw.colour.r = pc[0];
	draw.colour.g = pc[1];
	draw.colour.b = pc[2];
	draw.colour.a = pc[3];
	draw.fogcolour.r = (float)palookupfog[gfogpalnum].r / 63.f;
	draw.fogcolour.g = (float)palookupfog[gfogpalnum].g / 63.f;
	draw.fogcolour.b = (float)palookupfog[gfogpalnum].b / 63.f;
	draw.fogcolour.a = 1.f;
	draw.fogdensity = gfogdensity;

	if (method & 1) {
		draw.projection = &grotatespriteprojmat[0][0];
	} else {
		draw.projection = &gdrawroomsprojmat[0][0];
	}
	draw.modelview = mat;

	if (!m->vertexbuf || !m->indexbuf) {
		voxloadbufs(m);
	}
	draw.indexcount = m->indexcount;
	draw.indexbuffer = m->indexbuf;
	draw.elementbuffer = m->vertexbuf;
	draw.elementcount = 0;
	draw.elementvbo = NULL;
	polymost_drawpoly_glcall(GL_TRIANGLES, &draw);

//------------
	glfunc.glDisable(GL_CULL_FACE);
	glfunc.glFrontFace(GL_CCW);
	if (tspr->cstat&1024)
	{
		glfunc.glDepthFunc(GL_LEQUAL); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS
#if (USE_OPENGL == USE_GLES2)
		glfunc.glDepthRangef(0.f,0.99999f);
#else
		glfunc.glDepthRange(0.0,0.99999);
#endif
	}
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movzwl 0xc(%rsi), %eax
movl %eax, %ecx
andl $0x30, %ecx
xorl %r15d, %r15d
cmpw $0x20, %cx
je 0x5905b
movl %edx, %ebp
movq %rdi, %r14
movss 0x8(%rdi), %xmm1
movss 0x10(%rdi), %xmm3
movzbl 0x14(%rsi), %ecx
cvtsi2sd %ecx, %xmm0
movaps %xmm1, 0xb0(%rsp)
mulss %xmm1, %xmm3
mulsd 0x172b8(%rip), %xmm0    # 0x6f680
movsd 0x17e00(%rip), %xmm1    # 0x701d0
mulsd %xmm1, %xmm0
cvtss2sd 0xc(%rdi), %xmm4
mulsd %xmm4, %xmm0
cvtsd2ss %xmm0, %xmm6
xorps %xmm2, %xmm2
mulss %xmm6, %xmm2
movss 0x17d94(%rip), %xmm0    # 0x70184
movzbl 0x15(%rsi), %ecx
cvtsi2sd %ecx, %xmm5
mulsd %xmm1, %xmm5
mulsd %xmm4, %xmm5
cvtsd2ss %xmm5, %xmm1
mulss %xmm6, %xmm0
cvtsi2ssl 0x8(%rsi), %xmm4
mulss %xmm1, %xmm3
leaq 0x3b0be8(%rip), %rdx    # 0x409000
testb $-0x80, (%rdx)
movaps %xmm6, 0x20(%rsp)
movss %xmm1, 0x38(%rsp)
je 0x58445
movswq 0xe(%rsi), %rdx
leaq 0x3a23ac(%rip), %rdi    # 0x3fa7e0
movswl (%rdi,%rdx,2), %edx
imull %edx, %ecx
addl %ecx, %ecx
cvtsi2ss %ecx, %xmm1
addss %xmm1, %xmm4
leaq 0x453e4(%rip), %rcx     # 0x9d830
cvtsi2ssl (%rcx), %xmm1
leaq 0x3708f9(%rip), %rcx    # 0x3c8d50
cvtsi2ssl (%rcx), %xmm5
mulss %xmm1, %xmm5
movss 0x17d20(%rip), %xmm8    # 0x70188
divss %xmm5, %xmm8
cvtss2sd %xmm1, %xmm1
leaq 0x59f748(%rip), %rcx    # 0x5f7bc0
mulsd (%rcx), %xmm1
movsd 0x1715c(%rip), %xmm5    # 0x6f5e0
divsd %xmm1, %xmm5
cvtsd2ss %xmm5, %xmm7
leaq 0x1db5bd(%rip), %rcx    # 0x233a50
movl (%rsi), %edx
subl (%rcx), %edx
movl 0x4(%rsi), %ecx
cvtsi2ss %edx, %xmm10
cvtss2sd %xmm10, %xmm1
movsd 0x13ab4(%rip), %xmm5    # 0x6bf60
mulsd %xmm5, %xmm1
cvtss2sd %xmm0, %xmm0
addsd %xmm1, %xmm0
cvtss2sd %xmm8, %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x50(%rsp)
movaps %xmm8, %xmm0
leaq 0x1db582(%rip), %rdx    # 0x233a54
subl (%rdx), %ecx
xorps 0x15ff5(%rip), %xmm0    # 0x6e4d0
cvtsi2ss %ecx, %xmm9
cvtss2sd %xmm9, %xmm6
mulsd %xmm5, %xmm6
cvtss2sd %xmm2, %xmm5
subsd %xmm6, %xmm5
leaq 0x20c568(%rip), %rcx    # 0x264a60
cvtsi2ssl (%rcx), %xmm6
movaps %xmm0, 0xd0(%rsp)
cvtss2sd %xmm0, %xmm0
mulsd %xmm5, %xmm0
movsd %xmm0, 0x10(%rsp)
subss %xmm6, %xmm4
cvtss2sd %xmm4, %xmm5
movsd 0x17cb6(%rip), %xmm4    # 0x701d8
mulsd %xmm4, %xmm5
cvtss2sd %xmm3, %xmm3
subsd %xmm5, %xmm3
movss %xmm7, 0x30(%rsp)
cvtss2sd %xmm7, %xmm5
mulsd %xmm3, %xmm5
mulss %xmm8, %xmm10
movss 0x17c43(%rip), %xmm3    # 0x7018c
mulss %xmm3, %xmm10
movaps %xmm8, 0x40(%rsp)
mulss %xmm8, %xmm9
mulss %xmm3, %xmm9
leaq 0x59b443(%rip), %rcx    # 0x5f39a8
movsd (%rcx), %xmm1
leaq 0x59b5d0(%rip), %rcx    # 0x5f3b40
movsd (%rcx), %xmm0
movapd %xmm0, 0xc0(%rsp)
movzwl 0x1c(%rsi), %ecx
movq %rsi, 0x68(%rsp)
movswq 0x1e(%rsi), %rdx
imulq $0xc, %rdx, %rdx
leaq 0x2cd71a(%rip), %rsi    # 0x325cb0
movzwl 0x6(%rsi,%rdx), %edx
leal (%rdx,%rcx), %esi
movl $0x7ff, %edi            # imm = 0x7FF
andl %edi, %esi
xorl $0x400, %esi            # imm = 0x400
leaq 0x36f79e(%rip), %r8     # 0x3c7d50
movswl (%r8,%rsi,2), %esi
cvtsi2sd %esi, %xmm6
mulsd %xmm4, %xmm6
cvtsd2ss %xmm6, %xmm7
addl %edx, %ecx
addl $0x200, %ecx            # imm = 0x200
andl %edi, %ecx
movswl (%r8,%rcx,2), %ecx
cvtsi2sd %ecx, %xmm6
leaq 0x59b3db(%rip), %rcx    # 0x5f39b8
mulsd %xmm4, %xmm6
cvtsd2ss %xmm6, %xmm8
movss 0x139e6(%rip), %xmm6    # 0x6bfd4
movss %xmm6, 0x8(%rsp)
subss %xmm7, %xmm6
movaps %xmm10, %xmm4
mulss %xmm6, %xmm4
mulss %xmm9, %xmm6
mulss %xmm8, %xmm9
addss %xmm9, %xmm4
movsd (%rcx), %xmm9
mulss %xmm8, %xmm10
subss %xmm10, %xmm6
movapd %xmm0, %xmm10
unpcklpd %xmm0, %xmm10           # xmm10 = xmm10[0],xmm0[0]
movapd %xmm9, %xmm14
unpcklpd %xmm1, %xmm14           # xmm14 = xmm14[0],xmm1[0]
mulpd %xmm10, %xmm14
leaq 0x59b50a(%rip), %rdx    # 0x5f3b48
leaq 0x59b37b(%rip), %rcx    # 0x5f39c0
movsd (%rcx), %xmm11
movapd 0x1474d(%rip), %xmm10   # 0x6cda0
xorpd %xmm11, %xmm10
leaq 0x59b351(%rip), %rcx    # 0x5f39b0
movsd (%rdx), %xmm13
mulsd %xmm13, %xmm11
movsd (%rcx), %xmm15
movapd %xmm13, %xmm2
movapd %xmm13, %xmm12
mulsd %xmm15, %xmm13
unpcklpd %xmm10, %xmm15          # xmm15 = xmm15[0],xmm10[0]
leaq 0x59b49f(%rip), %rcx    # 0x5f3b28
movsd (%rcx), %xmm10
movapd %xmm10, %xmm0
unpcklpd %xmm10, %xmm0           # xmm0 = xmm0[0],xmm10[0]
mulpd %xmm0, %xmm15
cvtpd2ps %xmm14, %xmm0
cvtps2pd %xmm0, %xmm0
unpcklpd %xmm12, %xmm12          # xmm12 = xmm12[0,0]
mulpd %xmm0, %xmm12
addpd %xmm15, %xmm12
movaps %xmm8, %xmm15
xorps 0x15e10(%rip), %xmm15   # 0x6e4d0
cvtpd2ps %xmm12, %xmm14
movaps %xmm8, %xmm12
unpcklps %xmm15, %xmm12          # xmm12 = xmm12[0],xmm15[0],xmm12[1],xmm15[1]
shufps $0xe1, %xmm12, %xmm12   # xmm12 = xmm12[1,0,2,3]
movapd %xmm14, %xmm15
shufps $0xe1, %xmm14, %xmm15   # xmm15 = xmm15[1,0],xmm14[2,3]
mulps %xmm12, %xmm15
shufps $0x0, %xmm7, %xmm7      # xmm7 = xmm7[0,0,0,0]
movaps %xmm7, %xmm3
mulps %xmm14, %xmm3
addps %xmm15, %xmm3
movaps %xmm6, %xmm12
mulss %xmm14, %xmm12
shufps $0x55, %xmm14, %xmm14   # xmm14 = xmm14[1,1,1,1]
mulss %xmm4, %xmm14
addss %xmm12, %xmm14
movapd %xmm0, %xmm12
unpckhpd %xmm0, %xmm12           # xmm12 = xmm12[1],xmm0[1]
mulsd %xmm10, %xmm12
addsd %xmm11, %xmm12
mulsd %xmm10, %xmm0
subsd %xmm13, %xmm0
leaq 0x59b3f4(%rip), %rcx    # 0x5f3b20
movsd (%rcx), %xmm11
mulsd %xmm11, %xmm1
unpcklpd %xmm1, %xmm12           # xmm12 = xmm12[0],xmm1[0]
mulsd %xmm11, %xmm2
mulsd %xmm11, %xmm10
mulsd %xmm11, %xmm9
movaps %xmm3, %xmm11
unpcklpd %xmm9, %xmm0            # xmm0 = xmm0[0],xmm9[0]
cvtpd2ps %xmm12, %xmm12
cvtpd2ps %xmm0, %xmm9
shufps $0x0, %xmm8, %xmm8      # xmm8 = xmm8[0,0,0,0]
movaps %xmm8, %xmm0
mulps %xmm9, %xmm0
movaps %xmm7, %xmm15
mulps %xmm12, %xmm15
addps %xmm0, %xmm15
cvtsd2ss 0x50(%rsp), %xmm1
cvtsd2ss %xmm5, %xmm5
mulps %xmm12, %xmm8
mulps %xmm9, %xmm7
subps %xmm8, %xmm7
cvtsd2ss %xmm2, %xmm3
movaps %xmm11, %xmm0
shufps $0x55, %xmm11, %xmm0    # xmm0 = xmm0[1,1],xmm11[1,1]
movaps %xmm5, %xmm2
mulss %xmm3, %xmm2
mulss %xmm1, %xmm0
addss %xmm2, %xmm0
cvtsd2ss 0x10(%rsp), %xmm8
movaps %xmm8, %xmm13
mulss %xmm11, %xmm13
addss %xmm0, %xmm13
addss %xmm14, %xmm13
shufps $0x0, %xmm6, %xmm6      # xmm6 = xmm6[0,0,0,0]
mulps %xmm9, %xmm6
shufps $0x0, %xmm4, %xmm4      # xmm4 = xmm4[0,0,0,0]
mulps %xmm12, %xmm4
addps %xmm6, %xmm4
movaps 0x15cf4(%rip), %xmm6    # 0x6e4d0
cvtsd2ss 0xc0(%rsp), %xmm12
cvtsd2ss %xmm10, %xmm9
xorps %xmm6, %xmm12
movaps %xmm9, %xmm0
unpcklps %xmm12, %xmm0           # xmm0 = xmm0[0],xmm12[0],xmm0[1],xmm12[1]
shufps $0x0, %xmm5, %xmm5      # xmm5 = xmm5[0,0,0,0]
mulps %xmm0, %xmm5
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
mulps %xmm15, %xmm1
addps %xmm5, %xmm1
shufps $0x0, %xmm8, %xmm8      # xmm8 = xmm8[0,0,0,0]
mulps %xmm7, %xmm8
addps %xmm1, %xmm8
leaq 0x59b383(%rip), %rbx    # 0x5f3ba0
movsd (%rbx), %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
addps %xmm4, %xmm8
movaps 0x15c9d(%rip), %xmm4    # 0x6e4d0
movaps 0x20(%rsp), %xmm2
xorps %xmm2, %xmm4
movss %xmm9, 0x84(%rsp)
movlps %xmm15, 0x74(%rsp)
movss %xmm12, 0x88(%rsp)
movaps %xmm7, 0x50(%rsp)
movlps %xmm7, 0x94(%rsp)
movlps %xmm8, 0xa4(%rsp)
movaps %xmm8, 0xc0(%rsp)
movaps %xmm15, 0x190(%rsp)
movaps %xmm9, 0x180(%rsp)
movaps %xmm12, 0x170(%rsp)
jbe 0x588e1
xorps %xmm6, %xmm11
pshufd $0x55, %xmm11, %xmm0    # xmm0 = xmm11[1,1,1,1]
movd %xmm0, 0x70(%rsp)
xorps %xmm6, %xmm3
movaps %xmm3, 0xf0(%rsp)
movss %xmm3, 0x80(%rsp)
movaps %xmm11, 0x100(%rsp)
movss %xmm11, 0x90(%rsp)
xorps %xmm6, %xmm13
movaps %xmm13, 0xe0(%rsp)
movss %xmm13, 0xa0(%rsp)
jmp 0x588fb
movaps %xmm13, 0xe0(%rsp)
movaps %xmm3, 0xf0(%rsp)
movaps %xmm11, 0x100(%rsp)
movaps 0xb0(%rsp), %xmm0
mulss %xmm0, %xmm2
mulss %xmm0, %xmm4
btl $0xa, %eax
jae 0x5894e
leaq 0x59ae28(%rip), %r15    # 0x5f3740
movl $0x201, %edi            # imm = 0x201
movaps %xmm2, 0x20(%rsp)
movaps %xmm4, 0x10(%rsp)
callq *0x98(%r15)
movsd 0x178aa(%rip), %xmm1    # 0x701e0
xorps %xmm0, %xmm0
callq *0xa8(%r15)
movaps 0x10(%rsp), %xmm4
movaps 0x20(%rsp), %xmm2
movsd (%rbx), %xmm1
mulss 0x40(%rsp), %xmm4
movaps %xmm4, 0x10(%rsp)
mulss 0xd0(%rsp), %xmm2
movaps %xmm2, 0x20(%rsp)
xorl %ebx, %ebx
xorps %xmm0, %xmm0
ucomisd %xmm0, %xmm1
leaq 0x59adc9(%rip), %r15    # 0x5f3740
movl $0x0, %edi
adcl $0x900, %edi            # imm = 0x900
callq *0x28(%r15)
movl $0xb44, %edi            # imm = 0xB44
callq *0x40(%r15)
movl $0x405, %edi            # imm = 0x405
callq *0x20(%r15)
leaq 0x3b4e8d(%rip), %rax    # 0x40d82c
movl 0x4(%r14), %ecx
addl (%rax), %ecx
leaq 0x3b4e7c(%rip), %rax    # 0x40d828
testl %ecx, %ecx
cmovlel %ebx, %ecx
movswl (%rax), %eax
cmpl %eax, %ecx
cmovgel %eax, %ecx
cvtsi2ss %eax, %xmm0
subl %ecx, %eax
cvtsi2ss %eax, %xmm1
divss %xmm0, %xmm1
leaq 0x3b0636(%rip), %r15    # 0x409004
movslq (%r15), %rax
leaq 0x5e9248(%rip), %rcx    # 0x641c20
movd (%rcx,%rax,4), %xmm0
xorps %xmm2, %xmm2
punpcklbw %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3],xmm0[4],xmm2[4],xmm0[5],xmm2[5],xmm0[6],xmm2[6],xmm0[7],xmm2[7]
punpcklwd %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3]
cvtdq2pd %xmm0, %xmm2
divpd 0x169cc(%rip), %xmm2    # 0x6f3c0
cvtss2sd %xmm1, %xmm1
movzbl 0x2(%rcx,%rax,4), %eax
cvtsi2sd %eax, %xmm0
divsd 0x1358f(%rip), %xmm0    # 0x6bf98
mulsd %xmm1, %xmm0
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm2, %xmm1
movq 0x68(%rsp), %rbx
movzwl 0xc(%rbx), %eax
testb $0x2, %al
je 0x58a3d
xorl %ecx, %ecx
btl $0x9, %eax
setae %cl
leaq 0x177b6(%rip), %rdx     # 0x701e8
movss (%rdx,%rcx,4), %xmm2
movss %xmm2, 0x8(%rsp)
cvtpd2ps %xmm1, %xmm1
movapd %xmm1, 0x40(%rsp)
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xd0(%rsp)
xorl %ecx, %ecx
testb $0x2, %al
sete %cl
movl $0xbe2, %edi            # imm = 0xBE2
leaq 0x59acd9(%rip), %rax    # 0x5f3740
callq *0x40(%rax,%rcx,8)
movss 0x1771d(%rip), %xmm1    # 0x70190
movaps 0x20(%rsp), %xmm7
mulss %xmm1, %xmm7
movaps 0x100(%rsp), %xmm9
movaps %xmm9, %xmm0
shufps $0x55, %xmm9, %xmm0     # xmm0 = xmm0[1,1],xmm9[1,1]
mulss %xmm7, %xmm0
movss %xmm0, 0x70(%rsp)
shufps $0x0, %xmm7, %xmm7      # xmm7 = xmm7[0,0,0,0]
mulps 0x190(%rsp), %xmm7
movlps %xmm7, 0x74(%rsp)
movaps 0x10(%rsp), %xmm11
mulss %xmm1, %xmm11
mulss %xmm11, %xmm9
movss %xmm9, 0x80(%rsp)
shufps $0x0, %xmm11, %xmm11    # xmm11 = xmm11[0,0,0,0]
mulps 0x50(%rsp), %xmm11
movlps %xmm11, 0x84(%rsp)
movaps 0xb0(%rsp), %xmm6
xorps 0x159ea(%rip), %xmm6    # 0x6e4d0
mulss 0x38(%rsp), %xmm6
mulss 0x30(%rsp), %xmm6
mulss %xmm1, %xmm6
movaps %xmm6, %xmm1
mulss 0x170(%rsp), %xmm1
movss %xmm1, 0x98(%rsp)
movss 0x64(%r14), %xmm4
movss 0x68(%r14), %xmm5
cvtss2sd 0x6c(%r14), %xmm3
cvtsi2sdl 0x60(%r14), %xmm2
mulsd 0x16a35(%rip), %xmm2    # 0x6f560
addsd %xmm3, %xmm2
movaps 0xc0(%rsp), %xmm8
movaps 0xe0(%rsp), %xmm3
unpcklps %xmm8, %xmm3            # xmm3 = xmm3[0],xmm8[0],xmm3[1],xmm8[1]
cvtps2pd %xmm3, %xmm3
shufps $0x0, %xmm6, %xmm6      # xmm6 = xmm6[0,0,0,0]
movaps 0xf0(%rsp), %xmm10
unpcklps 0x180(%rsp), %xmm10     # xmm10 = xmm10[0],mem[0],xmm10[1],mem[1]
mulps %xmm6, %xmm10
movss %xmm10, 0x90(%rsp)
movaps %xmm10, %xmm6
shufps $0x55, %xmm10, %xmm6    # xmm6 = xmm6[1,1],xmm10[1,1]
movss %xmm6, 0x94(%rsp)
movaps %xmm11, %xmm6
shufps $0x0, %xmm11, %xmm6     # xmm6 = xmm6[0,0],xmm11[0,0]
movss %xmm9, %xmm6            # xmm6 = xmm9[0],xmm6[1,2,3]
shufps $0x55, %xmm11, %xmm11   # xmm11 = xmm11[1,1,1,1]
mulss %xmm5, %xmm11
shufps $0x0, %xmm5, %xmm5      # xmm5 = xmm5[0,0,0,0]
mulps %xmm6, %xmm5
movaps %xmm7, %xmm6
shufps $0x55, %xmm7, %xmm7     # xmm7 = xmm7[1,1,1,1]
mulss %xmm4, %xmm7
shufps $0x0, %xmm4, %xmm4      # xmm4 = xmm4[0,0,0,0]
shufps $0x0, %xmm6, %xmm6      # xmm6 = xmm6[0,0,0,0]
movss %xmm0, %xmm6            # xmm6 = xmm0[0],xmm6[1,2,3]
mulps %xmm4, %xmm6
addps %xmm5, %xmm6
cvtps2pd %xmm6, %xmm0
cvtps2pd %xmm10, %xmm4
cvtss2sd %xmm1, %xmm1
mulsd %xmm2, %xmm1
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
mulpd %xmm4, %xmm2
addpd %xmm0, %xmm2
subpd %xmm2, %xmm3
cvtpd2ps %xmm3, %xmm0
movlpd %xmm0, 0xa0(%rsp)
addss %xmm11, %xmm7
cvtss2sd %xmm7, %xmm0
addsd %xmm0, %xmm1
shufps $0x55, %xmm8, %xmm8     # xmm8 = xmm8[1,1,1,1]
cvtss2sd %xmm8, %xmm0
subsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xa8(%rsp)
andl $0x0, 0x9c(%rsp)
andl $0x0, 0x8c(%rsp)
andl $0x0, 0x7c(%rsp)
movl $0x3f800000, 0xac(%rsp) # imm = 0x3F800000
movq 0x18(%r14), %rax
movslq (%r15), %r8
movl (%rax,%r8,4), %eax
testl %eax, %eax
jne 0x58c65
movq 0x48(%r14), %rdi
movl 0x50(%r14), %esi
movl 0x54(%r14), %edx
movl 0x70(%r14), %ecx
callq 0x56bd5
movq 0x18(%r14), %rcx
movslq (%r15), %rdx
movl %eax, (%rcx,%rdx,4)
movq 0x18(%r14), %rax
movslq (%r15), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x118(%rsp)
movabsq $0x3ea3d70a00000000, %rax # imm = 0x3EA3D70A00000000
movq %rax, 0x11c(%rsp)
movaps 0x40(%rsp), %xmm0
movlps %xmm0, 0x124(%rsp)
movss 0xd0(%rsp), %xmm0
movss %xmm0, 0x12c(%rsp)
movss 0x8(%rsp), %xmm0
movss %xmm0, 0x130(%rsp)
leaq 0x59acc5(%rip), %rax    # 0x5f3978
movslq (%rax), %rax
leaq 0x3d68f3(%rip), %rcx    # 0x42f5b0
movd (%rcx,%rax,4), %xmm0
xorpd %xmm1, %xmm1
punpcklbw %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7]
punpcklwd %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
cvtdq2ps %xmm0, %xmm0
divps 0x166d8(%rip), %xmm0    # 0x6f3b0
movlps %xmm0, 0x134(%rsp)
movzbl 0x2(%rcx,%rax,4), %eax
cvtsi2ss %eax, %xmm0
divss 0x16627(%rip), %xmm0    # 0x6f318
movss %xmm0, 0x13c(%rsp)
movl $0x3f800000, 0x140(%rsp) # imm = 0x3F800000
leaq 0x59ac70(%rip), %rax    # 0x5f397c
movss (%rax), %xmm0
movss %xmm0, 0x144(%rsp)
testb $0x1, %bpl
jne 0x58d28
leaq 0x59ad3a(%rip), %rax    # 0x5f3a60
jmp 0x58d2f
leaq 0x59ad71(%rip), %rax    # 0x5f3aa0
movq %rax, 0x150(%rsp)
leaq 0x70(%rsp), %rax
movq %rax, 0x148(%rsp)
movl 0x74(%r14), %eax
testl %eax, %eax
je 0x58d58
movl 0x78(%r14), %ecx
testl %ecx, %ecx
jne 0x58ff4
cvtsi2ssl 0x50(%r14), %xmm0
movss 0x1326e(%rip), %xmm1    # 0x6bfd4
movaps %xmm1, %xmm2
divss %xmm0, %xmm2
movss %xmm2, 0x50(%rsp)
cvtsi2ssl 0x54(%r14), %xmm0
leaq 0x74(%r14), %rax
movq %rax, 0xb0(%rsp)
divss %xmm0, %xmm1
movss %xmm1, 0x40(%rsp)
movsd 0x17409(%rip), %xmm0    # 0x701a0
movsd %xmm0, (%rsp)
movslq 0x28(%r14), %rbx
imulq $0x6, %rbx, %rcx
movq %rcx, 0x38(%rsp)
movq %rcx, %rdi
addq %rcx, %rdi
movq %rdi, 0x30(%rsp)
callq 0x69a0
movq %rax, %r15
imulq $0x50, %rbx, %rdi
movq %rdi, 0x8(%rsp)
callq 0x69a0
movss 0x50(%rsp), %xmm2
movss 0x40(%rsp), %xmm1
movq %rax, %rsi
xorl %eax, %eax
testl %ebx, %ebx
movl $0x0, %ecx
cmovgl %ebx, %ecx
movq %rcx, 0x20(%rsp)
movq %rsi, 0x10(%rsp)
xorl %edi, %edi
xorl %r8d, %r8d
xorl %r9d, %r9d
cmpq 0x20(%rsp), %rdi
je 0x58f55
movq %r14, %rcx
movq 0x20(%r14), %r10
imulq $0x28, %rdi, %rdx
movzwl (%r10,%rdx), %ebp
movzwl 0x14(%r10,%rdx), %r11d
addl %ebp, %r11d
movzwl 0x2(%r10,%rdx), %r13d
movzwl 0x16(%r10,%rdx), %ebp
addl %r13d, %ebp
movzwl 0x4(%r10,%rdx), %r12d
movzwl 0x18(%r10,%rdx), %r13d
addl %r12d, %r13d
movw %r8w, (%r15,%r9,2)
movl %r8d, %edx
orl $0x1, %edx
movw %dx, 0x2(%r15,%r9,2)
movl %r8d, %edx
orl $0x2, %edx
movw %dx, 0x4(%r15,%r9,2)
movw %r8w, 0x6(%r15,%r9,2)
movw %dx, 0x8(%r15,%r9,2)
movl %r8d, %edx
orl $0x3, %edx
movw %dx, 0xa(%r15,%r9,2)
addq %rax, %r10
pushq $0x8
popq %rdx
cmpq $0x30, %rdx
je 0x58f3a
movzwl -0x2(%r10,%rdx), %r12d
cvtsi2ss %r12d, %xmm0
mulss %xmm2, %xmm0
movss %xmm0, -0x4(%rsi,%rdx,2)
movzwl (%r10,%rdx), %r12d
cvtsi2ss %r12d, %xmm0
mulss %xmm1, %xmm0
movss %xmm0, (%rsi,%rdx,2)
movzwl -0x8(%r10,%rdx), %r12d
cvtsi2ss %r12d, %xmm0
addl %r12d, %r12d
xorl %r14d, %r14d
xorl %ebx, %ebx
cmpl %r12d, %r11d
seta %r14b
subss (%rsp,%r14,4), %xmm0
setb %bl
addss (%rsp,%rbx,4), %xmm0
movss %xmm0, -0x10(%rsi,%rdx,2)
movzwl -0x6(%r10,%rdx), %ebx
cvtsi2ss %ebx, %xmm0
addl %ebx, %ebx
xorl %r14d, %r14d
xorl %r12d, %r12d
cmpl %ebx, %ebp
seta %r14b
subss (%rsp,%r14,4), %xmm0
setb %r12b
addss (%rsp,%r12,4), %xmm0
movss %xmm0, -0xc(%rsi,%rdx,2)
movzwl -0x4(%r10,%rdx), %ebx
cvtsi2ss %ebx, %xmm0
addl %ebx, %ebx
xorl %r14d, %r14d
xorl %r12d, %r12d
cmpl %ebx, %r13d
seta %r14b
subss (%rsp,%r14,4), %xmm0
setb %r12b
addss (%rsp,%r12,4), %xmm0
movss %xmm0, -0x8(%rsi,%rdx,2)
addq $0xa, %rdx
jmp 0x58e74
addq $0x6, %r9
addq $0x4, %r8
incq %rdi
addq $0x50, %rsi
addq $0x28, %rax
movq %rcx, %r14
jmp 0x58df7
leaq 0x78(%r14), %rsi
pushq $0x1
popq %rbp
movl %ebp, %edi
leaq 0x59a7db(%rip), %rbx    # 0x5f3740
callq *0x118(%rbx)
movl 0x78(%r14), %esi
movl $0x8893, %edi           # imm = 0x8893
callq *0xf8(%rbx)
movl $0x8893, %edi           # imm = 0x8893
movq 0x30(%rsp), %rsi
movq %r15, %rdx
movl $0x88e4, %ecx           # imm = 0x88E4
callq *0x100(%rbx)
movq 0x38(%rsp), %rax
movl %eax, 0x7c(%r14)
movl %ebp, %edi
movq 0xb0(%rsp), %rsi
callq *0x118(%rbx)
movl 0x74(%r14), %esi
movl $0x8892, %edi           # imm = 0x8892
callq *0xf8(%rbx)
movl $0x8892, %edi           # imm = 0x8892
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %r12
movq %r12, %rdx
movl $0x88e4, %ecx           # imm = 0x88E4
callq *0x100(%rbx)
movq %r15, %rdi
callq 0x61c0
movq %r12, %rdi
callq 0x61c0
movl 0x74(%r14), %eax
movl 0x78(%r14), %ecx
movq 0x68(%rsp), %rbx
movl 0x7c(%r14), %edx
leaq 0x118(%rsp), %rsi
movl %edx, 0x44(%rsi)
movl %ecx, 0x40(%rsi)
movl %eax, 0x48(%rsi)
andl $0x0, 0x4c(%rsi)
andq $0x0, 0x50(%rsi)
pushq $0x4
popq %rdi
callq 0x4727b
movl $0xb44, %edi            # imm = 0xB44
leaq 0x59a71a(%rip), %r14    # 0x5f3740
callq *0x48(%r14)
movl $0x901, %edi            # imm = 0x901
callq *0x28(%r14)
pushq $0x1
popq %r15
testb $0x4, 0xd(%rbx)
je 0x5905b
movl $0x203, %edi            # imm = 0x203
callq *0x98(%r14)
movsd 0x16567(%rip), %xmm1    # 0x6f5b8
xorps %xmm0, %xmm0
callq *0xa8(%r14)
movl %r15d, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq