// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/polymost.c
// Function: polymost_drawrooms
void polymost_drawrooms (void)
{
	int i, j, n, n2, closest;
	double ox, oy, oz, ox2, oy2, oz2, r, px[6], py[6], pz[6], px2[6], py2[6], pz2[6], sx[6], sy[6];
	static unsigned char tempbuf[MAXWALLS];

	if (!rendmode) return;

	frameoffset = frameplace + windowy1*bytesperline + windowx1;

#if USE_OPENGL
	if (rendmode == 3)
	{
		resizeglcheck();

		//glfunc.glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
		glfunc.glEnable(GL_DEPTH_TEST);
		glfunc.glDepthFunc(GL_ALWAYS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS

		//glfunc.glPolygonOffset(1,1); //Supposed to make sprites pasted on walls or floors not disappear
#if (USE_OPENGL == USE_GLES2)
		glfunc.glDepthRangef(0.00001f,1.f); //<- this is more widely supported than glPolygonOffset
#else
		glfunc.glDepthRange(0.00001,1.0); //<- this is more widely supported than glPolygonOffset
#endif

		 //Enable this for OpenGL red-blue glasses mode :)
		if (glredbluemode)
		{
			static int grbfcnt = 0; grbfcnt++;
			if (redblueclearcnt < numpages) { redblueclearcnt++; glfunc.glColorMask(1,1,1,1); glfunc.glClear(GL_COLOR_BUFFER_BIT); }
			if (grbfcnt&1)
			{
				glfunc.glViewport(windowx1-16,yres-(windowy2+1),windowx2-(windowx1-16)+1,windowy2-windowy1+1);
				glfunc.glColorMask(1,0,0,1);
				globalposx += singlobalang/1024;
				globalposy -= cosglobalang/1024;
			}
			else
			{
				glfunc.glViewport(windowx1,yres-(windowy2+1),windowx2+16-windowx1+1,windowy2-windowy1+1);
				glfunc.glColorMask(0,1,1,1);
				globalposx -= singlobalang/1024;
				globalposy += cosglobalang/1024;
			}
		}
	}
#endif

		//Polymost supports true look up/down :) Here, we convert horizon to angle.
		//gchang&gshang are cos&sin of this angle (respectively)
	gyxscale = ((double)xdimenscale)/131072.0;
	gxyaspect = ((double)xyaspect*(double)viewingrange)*(5.0/(65536.0*262144.0));
	gviewxrange = ((double)viewingrange)*((double)xdimen)/(32768.0*1024.0);
	gcosang = ((double)cosglobalang)/262144.0;
	gsinang = ((double)singlobalang)/262144.0;
	gcosang2 = gcosang*((double)viewingrange)/65536.0;
	gsinang2 = gsinang*((double)viewingrange)/65536.0;
	ghalfx = (double)halfxdimen; grhalfxdown10 = 1.0/(((double)ghalfx)*1024);
	ghoriz = (double)globalhoriz;

	gvisibility = ((float)globalvisibility)*gxyaspect*FOGSCALE;

		//global cos/sin height angle
	r = (double)((ydimen>>1)-ghoriz);
	gshang = r/sqrt(r*r+ghalfx*ghalfx);
	gchang = sqrt(1.0-gshang*gshang);
	ghoriz = (double)(ydimen>>1);

	  //global cos/sin tilt angle
	gctang = cos(gtang);
	gstang = sin(gtang);
	if (fabs(gstang) < .001) //This hack avoids nasty precision bugs in domost()
		{ gstang = 0; if (gctang > 0) gctang = 1.0; else gctang = -1.0; }

	if (inpreparemirror)
		gstang = -gstang;

		//Generate viewport trapezoid (for handling screen up/down)
	px[0] = px[3] = 0-1; px[1] = px[2] = windowx2+1-windowx1+2;
	py[0] = py[1] = 0-1; py[2] = py[3] = windowy2+1-windowy1+2; n = 4;
	for(i=0;i<n;i++)
	{
		ox = px[i]-ghalfx; oy = py[i]-ghoriz; oz = ghalfx;

			//Tilt rotation (backwards)
		ox2 = ox*gctang + oy*gstang;
		oy2 = oy*gctang - ox*gstang;
		oz2 = oz;

			//Up/down rotation (backwards)
		px[i] = ox2;
		py[i] = oy2*gchang + oz2*gshang;
		pz[i] = oz2*gchang - oy2*gshang;
	}

		//Clip to SCISDIST plane
	n2 = 0;
	for(i=0;i<n;i++)
	{
		j = i+1; if (j >= n) j = 0;
		if (pz[i] >= SCISDIST) { px2[n2] = px[i]; py2[n2] = py[i]; pz2[n2] = pz[i]; n2++; }
		if ((pz[i] >= SCISDIST) != (pz[j] >= SCISDIST))
		{
			r = (SCISDIST-pz[i])/(pz[j]-pz[i]);
			px2[n2] = (px[j]-px[i])*r + px[i];
			py2[n2] = (py[j]-py[i])*r + py[i];
			pz2[n2] = SCISDIST; n2++;
		}
	}
	if (n2 < 3) return;
	for(i=0;i<n2;i++)
	{
		r = ghalfx / pz2[i];
		sx[i] = px2[i]*r + ghalfx;
		sy[i] = py2[i]*r + ghoriz;
	}
	initmosts(sx,sy,n2);

	if (searchit == 2)
	{
		short hitsect, hitwall, hitsprite;
		int vx, vy, vz, hitx, hity, hitz;

		ox2 = searchx-ghalfx; oy2 = searchy-ghoriz; oz2 = ghalfx;

			//Tilt rotation
		ox = ox2*gctang + oy2*gstang;
		oy = oy2*gctang - ox2*gstang;
		oz = oz2;

			//Up/down rotation
		ox2 = oz*gchang - oy*gshang;
		oy2 = ox;
		oz2 = oy*gchang + oz*gshang;

			//Standard Left/right rotation
		vx = (int)(ox2*((float)cosglobalang) - oy2*((float)singlobalang));
		vy = (int)(ox2*((float)singlobalang) + oy2*((float)cosglobalang));
		vz = (int)(oz2*16384.0);

		hitallsprites = 1;
		hitscan(globalposx,globalposy,globalposz,globalcursectnum, //Start position
			vx>>12,vy>>12,vz>>8,&hitsect,&hitwall,&hitsprite,&hitx,&hity,&hitz,0xffff0030);
		hitallsprites = 0;

		searchsector = hitsect;
		if (hitwall >= 0)
		{
			searchwall = hitwall; searchstat = 0;
			if (wall[hitwall].nextwall >= 0)
			{
				int cz, fz;
				getzsofslope(wall[hitwall].nextsector,hitx,hity,&cz,&fz);
				if (hitz > fz)
				{
					if (wall[hitwall].cstat&2) //'2' bottoms of walls
						searchwall = wall[hitwall].nextwall;
				}
				else if ((hitz > cz) && (wall[hitwall].cstat&(16+32))) //masking or 1-way
					searchstat = 4;
			}
		}
		else if (hitsprite >= 0) { searchwall = hitsprite; searchstat = 3; }
		else
		{
			int cz, fz;
			getzsofslope(hitsect,hitx,hity,&cz,&fz);
			if ((hitz<<1) < cz+fz) searchstat = 1; else searchstat = 2;
			//if (vz < 0) searchstat = 1; else searchstat = 2; //Won't work for slopes :/
		}
		searchit = 0;
	}

	numscans = numbunches = 0;

	if (globalcursectnum >= MAXSECTORS)
		globalcursectnum -= MAXSECTORS;
	else
	{
		i = globalcursectnum;
		updatesector(globalposx,globalposy,&globalcursectnum);
		if (globalcursectnum < 0) globalcursectnum = i;
	}

	polymost_scansector(globalcursectnum);

	if (inpreparemirror)
	{
		grhalfxdown10x = -grhalfxdown10;
		inpreparemirror = 0;
		polymost_drawalls(0);
		numbunches--;
		bunchfirst[0] = bunchfirst[numbunches];
		bunchlast[0] = bunchlast[numbunches];
	}
	else
		grhalfxdown10x = grhalfxdown10;

	while (numbunches > 0)
	{
		memset(tempbuf,0,numbunches+3); tempbuf[0] = 1;

		closest = 0;              //Almost works, but not quite :(
		for(i=1;i<numbunches;i++)
		{
			j = polymost_bunchfront(i,closest); if (j < 0) continue;
			tempbuf[i] = 1;
			if (!j) { tempbuf[closest] = 1; closest = i; }
		}
		for(i=0;i<numbunches;i++) //Double-check
		{
			if (tempbuf[i]) continue;
			j = polymost_bunchfront(i,closest); if (j < 0) continue;
			tempbuf[i] = 1;
			if (!j) { tempbuf[closest] = 1; closest = i; i = 0; }
		}

		polymost_drawalls(closest);

		if (automapping)
		{
			for(j=bunchfirst[closest];j>=0;j=p2[j])
				show2dwall[thewall[j]>>3] |= pow2char[thewall[j]&7];
		}

		numbunches--;
		bunchfirst[closest] = bunchfirst[numbunches];
		bunchlast[closest] = bunchlast[numbunches];
	}
#if USE_OPENGL
	if (rendmode == 3)
	{
		glfunc.glDepthFunc(GL_LEQUAL); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS

		//glfunc.glPolygonOffset(0,0);
#if (USE_OPENGL == USE_GLES2)
		glfunc.glDepthRangef(0.f,0.99999f); //<- this is more widely supported than glPolygonOffset
#else
		glfunc.glDepthRange(0.0,0.99999); //<- this is more widely supported than glPolygonOffset
#endif
	}
#endif
}

// Assembly:
movl 0x5a6ef7(%rip), %eax    # 0x5fa950
testl %eax, %eax
je 0x54997
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
leaq 0x12a637(%rip), %rcx    # 0x17e0b0
leaq 0x380100(%rip), %r12    # 0x3d3b80
movslq (%r12), %rdx
leaq 0x12a7f9(%rip), %rsi    # 0x17e284
movslq (%rsi), %rsi
imulq %rdx, %rsi
addq (%rcx), %rsi
leaq 0x37e2d4(%rip), %r13    # 0x3d1d70
movslq (%r13), %rcx
addq %rsi, %rcx
leaq 0x383ce6(%rip), %rdx    # 0x3d7790
movq %rcx, (%rdx)
cmpl $0x3, %eax
jne 0x53c56
callq 0x50a75
leaq 0x5a6c7e(%rip), %rbx    # 0x5fa740
movl $0xb71, %edi            # imm = 0xB71
callq *0x40(%rbx)
movl $0x207, %edi            # imm = 0x207
callq *0x98(%rbx)
movsd 0x26d63(%rip), %xmm0    # 0x7a840
movsd 0x220db(%rip), %xmm1    # 0x75bc0
callq *0xa8(%rbx)
cmpl $0x0, 0x5a6e8e(%rip)    # 0x5fa980
je 0x53c56
movl 0x5ab0b2(%rip), %ecx    # 0x5febb0
incl %ecx
movl %ecx, 0x5ab0aa(%rip)    # 0x5febb0
movl 0x5a6f40(%rip), %eax    # 0x5faa4c
leaq 0x3cf36d(%rip), %rdx    # 0x422e80
cmpl (%rdx), %eax
jge 0x53b44
incl %eax
movl %eax, 0x5a6f2d(%rip)    # 0x5faa4c
movl $0x1, %edi
movl $0x1, %esi
movl $0x1, %edx
movl $0x1, %ecx
callq *0x10(%rbx)
movl $0x4000, %edi           # imm = 0x4000
callq *0x8(%rbx)
movl 0x5ab06c(%rip), %ecx    # 0x5febb0
movq 0x80(%rbx), %rax
movl (%r13), %edi
leaq 0x504de(%rip), %rdx     # 0xa4034
testb $0x1, %cl
jne 0x53bd4
leaq 0x3b4482(%rip), %rcx    # 0x407fe4
movl (%rcx), %ecx
movl %ecx, %esi
notl %esi
addl (%rdx), %esi
leaq 0x3b446f(%rip), %rdx    # 0x407fe0
movl (%rdx), %edx
subl %edi, %edx
addl $0x11, %edx
subl (%r12), %ecx
incl %ecx
callq *%rax
xorl %edi, %edi
movl $0x1, %esi
movl $0x1, %edx
movl $0x1, %ecx
callq *0x10(%rbx)
leaq 0x21bedd(%rip), %rax    # 0x26fa78
movl (%rax), %ecx
movl $0x3ff, %eax            # imm = 0x3FF
leal (%rcx,%rax), %edx
testl %ecx, %ecx
cmovnsl %ecx, %edx
sarl $0xa, %edx
leaq 0x1e6e9c(%rip), %rcx    # 0x23aa50
subl %edx, (%rcx)
leaq 0x21beb3(%rip), %rcx    # 0x26fa70
movl (%rcx), %ecx
addl %ecx, %eax
testl %ecx, %ecx
cmovnsl %ecx, %eax
sarl $0xa, %eax
leaq 0x1e6e84(%rip), %rcx    # 0x23aa54
addl (%rcx), %eax
jmp 0x53c4d
leaq 0x3b4409(%rip), %rcx    # 0x407fe4
movl (%rcx), %ecx
movl %ecx, %esi
notl %esi
addl (%rdx), %esi
leaq 0x3b43f6(%rip), %rdx    # 0x407fe0
movl (%rdx), %edx
subl %edi, %edx
addl $-0x10, %edi
addl $0x11, %edx
subl (%r12), %ecx
incl %ecx
callq *%rax
movl $0x1, %edi
xorl %esi, %esi
xorl %edx, %edx
movl $0x1, %ecx
callq *0x10(%rbx)
leaq 0x21be64(%rip), %rax    # 0x26fa78
movl (%rax), %eax
movl $0x3ff, %ecx            # imm = 0x3FF
leal (%rax,%rcx), %edx
testl %eax, %eax
cmovnsl %eax, %edx
sarl $0xa, %edx
leaq 0x1e6e23(%rip), %rax    # 0x23aa50
addl %edx, (%rax)
leaq 0x21be3a(%rip), %rax    # 0x26fa70
movl (%rax), %eax
addl %eax, %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
sarl $0xa, %ecx
leaq 0x1e6e0b(%rip), %rax    # 0x23aa54
movl (%rax), %eax
subl %ecx, %eax
leaq 0x1e6e00(%rip), %rcx    # 0x23aa54
movl %eax, (%rcx)
leaq 0x227e3b(%rip), %rax    # 0x27ba98
cvtsi2sdl (%rax), %xmm2
mulsd 0x26bdf(%rip), %xmm2    # 0x7a848
leaq 0x309c48(%rip), %rax    # 0x35d8b8
xorps %xmm0, %xmm0
cvtsi2sdl (%rax), %xmm0
leaq 0x37c0d2(%rip), %rax    # 0x3cfd50
xorps %xmm1, %xmm1
cvtsi2sdl (%rax), %xmm1
mulsd %xmm1, %xmm0
mulsd 0x26bbf(%rip), %xmm0    # 0x7a850
movsd %xmm2, 0x5aaf1f(%rip)   # 0x5febb8
leaq 0x50b90(%rip), %rax     # 0xa4830
xorps %xmm2, %xmm2
cvtsi2sdl (%rax), %xmm2
movsd %xmm0, 0x5aaf11(%rip)   # 0x5febc0
mulsd %xmm1, %xmm2
mulsd 0x26b9d(%rip), %xmm2    # 0x7a858
movsd %xmm2, 0x5aaf05(%rip)   # 0x5febc8
leaq 0x21bda6(%rip), %rbx    # 0x26fa70
xorps %xmm2, %xmm2
cvtsi2sdl (%rbx), %xmm2
movsd 0x26b87(%rip), %xmm3    # 0x7a860
mulsd %xmm3, %xmm2
movsd %xmm2, 0x5a6ccb(%rip)   # 0x5fa9b0
leaq 0x21bd8c(%rip), %r14    # 0x26fa78
cvtsi2sdl (%r14), %xmm4
mulsd %xmm3, %xmm4
movsd %xmm4, 0x5a6cc3(%rip)   # 0x5fa9c0
mulsd %xmm1, %xmm2
movsd 0x21377(%rip), %xmm3    # 0x75080
mulsd %xmm3, %xmm2
movsd %xmm2, 0x5a6c93(%rip)   # 0x5fa9a8
mulsd %xmm1, %xmm4
mulsd %xmm3, %xmm4
movsd %xmm4, 0x5a6c93(%rip)   # 0x5fa9b8
leaq 0x3c5138(%rip), %rax    # 0x418e64
xorps %xmm1, %xmm1
cvtsi2sdl (%rax), %xmm1
movsd %xmm1, 0x5a6df5(%rip)   # 0x5fab30
movsd 0x2339d(%rip), %xmm2    # 0x770e0
mulsd %xmm1, %xmm2
movsd 0x21e71(%rip), %xmm4    # 0x75bc0
movapd %xmm4, %xmm3
divsd %xmm2, %xmm3
movsd %xmm3, 0x5a6e49(%rip)   # 0x5faba8
leaq 0x227d36(%rip), %rax    # 0x27ba9c
xorps %xmm2, %xmm2
cvtsi2sdl (%rax), %xmm2
leaq 0x37afcc(%rip), %rax    # 0x3ced40
xorps %xmm3, %xmm3
cvtsi2ssl (%rax), %xmm3
cvtss2sd %xmm3, %xmm3
mulsd %xmm0, %xmm3
mulsd 0x26add(%rip), %xmm3    # 0x7a868
movsd %xmm3, 0x5aae3d(%rip)   # 0x5febd0
leaq 0x227cfa(%rip), %r15    # 0x27ba94
movl (%r15), %eax
sarl %eax
xorps %xmm3, %xmm3
cvtsi2sd %eax, %xmm3
subsd %xmm2, %xmm3
mulsd %xmm1, %xmm1
movapd %xmm3, %xmm0
mulsd %xmm3, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
divsd %xmm0, %xmm3
movsd %xmm3, 0x5a6d76(%rip)   # 0x5fab40
mulsd %xmm3, %xmm3
movapd %xmm4, %xmm0
subsd %xmm3, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x53de6
sqrtsd %xmm0, %xmm0
jmp 0x53deb
callq 0x64c0
movl (%r15), %eax
sarl %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd %xmm0, 0x5a6d21(%rip)   # 0x5fab20
movsd %xmm1, 0x5a6d31(%rip)   # 0x5fab38
xorps %xmm0, %xmm0
cvtss2sd 0x5a6b46(%rip), %xmm0   # 0x5fa958
callq 0x6a10
movsd %xmm0, 0x5a6d09(%rip)   # 0x5fab28
xorps %xmm0, %xmm0
cvtss2sd 0x5a6b2e(%rip), %xmm0   # 0x5fa958
callq 0x6390
movaps %xmm0, %xmm5
movaps %xmm0, %xmm1
andps 0x26834(%rip), %xmm1    # 0x7a670
movsd %xmm0, 0x5a6d04(%rip)   # 0x5fab48
movsd 0x26a24(%rip), %xmm2    # 0x7a870
ucomisd %xmm1, %xmm2
jbe 0x53e85
movsd 0x5a6cce(%rip), %xmm1   # 0x5fab28
xorps %xmm5, %xmm5
xorl %eax, %eax
ucomisd %xmm5, %xmm1
seta %al
movq $0x0, 0x5a6cd7(%rip) # 0x5fab48
leaq 0x26808(%rip), %rcx     # 0x7a680
movsd (%rcx,%rax,8), %xmm1
movsd %xmm1, 0x5a6ca3(%rip)   # 0x5fab28
leaq 0x164bb2(%rip), %r15    # 0x1b8a3e
cmpb $0x0, (%r15)
je 0x53ea0
xorps 0x24197(%rip), %xmm5    # 0x78030
movlps %xmm5, 0x5a6ca8(%rip)   # 0x5fab48
leaq 0x3b4139(%rip), %rax    # 0x407fe0
movl (%rax), %eax
subl (%r13), %eax
movabsq $-0x4010000000000000, %rcx # imm = 0xBFF0000000000000
movq %rcx, 0x98(%rsp)
addl $0x3, %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movq %rcx, 0x80(%rsp)
movsd %xmm1, 0x90(%rsp)
movsd %xmm1, 0x88(%rsp)
movaps 0x267a6(%rip), %xmm1    # 0x7a690
leaq 0x3b40f3(%rip), %rax    # 0x407fe4
movl (%rax), %eax
subl (%r12), %eax
movaps %xmm1, 0xb0(%rsp)
addl $0x3, %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd %xmm1, 0xc8(%rsp)
movsd %xmm1, 0xc0(%rsp)
movsd 0x5a6c0d(%rip), %xmm1   # 0x5fab30
movsd 0x5a6c0d(%rip), %xmm6   # 0x5fab38
movsd 0x5a6bf4(%rip), %xmm10  # 0x5fab28
movsd 0x5a6be3(%rip), %xmm11  # 0x5fab20
movsd 0x5a6bfb(%rip), %xmm4   # 0x5fab40
movapd %xmm1, %xmm2
mulsd %xmm4, %xmm2
movapd %xmm1, %xmm7
unpcklpd %xmm1, %xmm7            # xmm7 = xmm7[0],xmm1[0]
movapd %xmm6, %xmm8
unpcklpd %xmm6, %xmm8            # xmm8 = xmm8[0],xmm6[0]
movaps %xmm5, %xmm0
movlhps %xmm5, %xmm0            # xmm0 = xmm0[0],xmm5[0]
movapd %xmm10, 0xe0(%rsp)
unpcklpd %xmm10, %xmm10          # xmm10 = xmm10[0,0]
movapd %xmm11, 0xf0(%rsp)
unpcklpd %xmm11, %xmm11          # xmm11 = xmm11[0,0]
movapd %xmm2, %xmm12
unpcklpd %xmm2, %xmm12           # xmm12 = xmm12[0],xmm2[0]
movapd %xmm4, %xmm13
unpcklpd %xmm4, %xmm13           # xmm13 = xmm13[0],xmm4[0]
xorl %eax, %eax
movapd 0x80(%rsp,%rax,8), %xmm14
subpd %xmm7, %xmm14
movapd 0xb0(%rsp,%rax,8), %xmm15
subpd %xmm8, %xmm15
movapd %xmm15, %xmm3
mulpd %xmm0, %xmm3
movapd %xmm0, %xmm9
mulpd %xmm14, %xmm9
mulpd %xmm10, %xmm14
addpd %xmm3, %xmm14
mulpd %xmm10, %xmm15
subpd %xmm9, %xmm15
movapd %xmm14, 0x80(%rsp,%rax,8)
movapd %xmm13, %xmm3
mulpd %xmm15, %xmm3
mulpd %xmm11, %xmm15
addpd %xmm12, %xmm15
movapd %xmm15, 0xb0(%rsp,%rax,8)
movapd %xmm7, %xmm9
mulpd %xmm11, %xmm9
subpd %xmm3, %xmm9
movapd %xmm9, 0x190(%rsp,%rax,8)
addq $0x2, %rax
cmpq $0x4, %rax
jne 0x53f99
xorl %edx, %edx
movsd 0x21b89(%rip), %xmm7    # 0x75bc0
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
xorl %eax, %eax
movsd 0x21b74(%rip), %xmm10   # 0x75bc0
movsd 0x190(%rsp,%rdx,8), %xmm8
ucomisd %xmm10, %xmm8
jb 0x5408f
movsd 0x80(%rsp,%rdx,8), %xmm0
cltq
movsd %xmm0, 0x160(%rsp,%rax,8)
movsd 0xb0(%rsp,%rdx,8), %xmm0
movsd %xmm0, 0x130(%rsp,%rax,8)
movsd %xmm8, 0x100(%rsp,%rax,8)
incl %eax
leaq 0x1(%rdx), %rsi
cmpq $0x3, %rdx
movl $0x0, %edi
cmovneq %rsi, %rdi
movsd 0x190(%rsp,%rdi,8), %xmm9
movapd %xmm7, %xmm0
cmpnlepd %xmm9, %xmm0
movapd %xmm7, %xmm3
cmplepd %xmm8, %xmm3
xorpd %xmm0, %xmm3
movd %xmm3, %r8d
testb $0x1, %r8b
jne 0x54141
movapd %xmm10, %xmm0
subsd %xmm8, %xmm0
subsd %xmm8, %xmm9
divsd %xmm9, %xmm0
movsd 0x80(%rsp,%rdi,8), %xmm3
movsd 0x80(%rsp,%rdx,8), %xmm8
subsd %xmm8, %xmm3
mulsd %xmm0, %xmm3
addsd %xmm8, %xmm3
cltq
movsd %xmm3, 0x160(%rsp,%rax,8)
movsd 0xb0(%rsp,%rdi,8), %xmm3
movsd 0xb0(%rsp,%rdx,8), %xmm8
subsd %xmm8, %xmm3
mulsd %xmm0, %xmm3
addsd %xmm8, %xmm3
movsd %xmm3, 0x130(%rsp,%rax,8)
movq %rcx, 0x100(%rsp,%rax,8)
incl %eax
movq %rsi, %rdx
cmpq $0x4, %rsi
jne 0x5404c
cmpl $0x3, %eax
jl 0x54986
movl %eax, %ecx
xorl %edx, %edx
movapd %xmm1, %xmm0
divsd 0x100(%rsp,%rdx,8), %xmm0
movsd 0x160(%rsp,%rdx,8), %xmm3
mulsd %xmm0, %xmm3
addsd %xmm1, %xmm3
movsd %xmm3, 0x50(%rsp,%rdx,8)
mulsd 0x130(%rsp,%rdx,8), %xmm0
addsd %xmm6, %xmm0
movsd %xmm0, 0x20(%rsp,%rdx,8)
incq %rdx
cmpq %rdx, %rcx
jne 0x5415b
movsd 0x50(%rsp), %xmm0
xorl %edx, %edx
ucomisd 0x58(%rsp), %xmm0
leal -0x1(%rax), %esi
seta %dl
movq %rsi, %rdi
movl %edx, %ecx
movsd 0x50(%rsp,%rcx,8), %xmm0
ucomisd 0x50(%rsp,%rdi,8), %xmm0
movl %edi, %ecx
ja 0x541c5
movl %edx, %ecx
leaq -0x1(%rdi), %r8
movl %ecx, %edx
cmpq $0x2, %rdi
movq %r8, %rdi
ja 0x541b1
movl %ecx, %edx
xorps %xmm0, %xmm0
cvtsd2ss 0x50(%rsp,%rdx,8), %xmm0
movss %xmm0, 0x5baa21(%rip)   # 0x60ec08
xorps %xmm0, %xmm0
cvtsd2ss 0x20(%rsp,%rdx,8), %xmm0
movss %xmm0, 0x5baa1c(%rip)   # 0x60ec14
movss %xmm0, 0x5baa0c(%rip)   # 0x60ec0c
leal 0x1(%rcx), %edi
xorl %r8d, %r8d
cmpl %eax, %edi
cmovgel %r8d, %edi
leal -0x1(%rcx), %r9d
testl %ecx, %ecx
cmovlel %esi, %r9d
movl $0x2, %edx
leaq 0x5ba9be(%rip), %rcx    # 0x60ebe0
movl %edi, %r11d
movsd 0x50(%rsp,%r11,8), %xmm8
movl %r9d, %r10d
movsd 0x50(%rsp,%r10,8), %xmm7
ucomisd %xmm8, %xmm7
jbe 0x542d7
cmpl $0x2, %edx
jl 0x54261
leal -0x1(%rdx), %r12d
leaq (%r12,%r12,4), %r13
xorps %xmm0, %xmm0
cvtss2sd (%rcx,%r13,8), %xmm0
ucomisd %xmm8, %xmm0
jb 0x54261
movl %r12d, %edx
movslq %edx, %rdx
leaq (%rdx,%rdx,4), %r12
movapd %xmm8, %xmm0
movhpd 0x20(%rsp,%r11,8), %xmm0 # xmm0 = xmm0[0],mem[0]
cvtpd2ps %xmm0, %xmm0
movlpd %xmm0, (%rcx,%r12,8)
leal 0x1(%r9), %r11d
cmpl %eax, %r11d
cmovgel %r8d, %r11d
movsd 0x50(%rsp,%r11,8), %xmm0
subsd %xmm0, %xmm8
movsd 0x20(%rsp,%r10,8), %xmm3
movsd 0x20(%rsp,%r11,8), %xmm9
subsd %xmm9, %xmm3
mulsd %xmm8, %xmm3
subsd %xmm0, %xmm7
divsd %xmm7, %xmm3
addsd %xmm9, %xmm3
xorps %xmm0, %xmm0
cvtsd2ss %xmm3, %xmm0
movss %xmm0, 0xc(%rcx,%r12,8)
incl %edx
incl %edi
cmpl %eax, %edi
cmovgel %r8d, %edi
jmp 0x543d0
ucomisd %xmm7, %xmm8
jbe 0x5436c
cmpl $0x2, %edx
jl 0x54301
leal -0x1(%rdx), %r12d
leaq (%r12,%r12,4), %r13
xorps %xmm0, %xmm0
cvtss2sd (%rcx,%r13,8), %xmm0
ucomisd %xmm7, %xmm0
jb 0x54301
movl %r12d, %edx
leal -0x1(%rdi), %r12d
testl %edi, %edi
cmovlel %esi, %r12d
movsd 0x50(%rsp,%r12,8), %xmm0
movapd %xmm7, %xmm3
subsd %xmm0, %xmm3
movsd 0x20(%rsp,%r11,8), %xmm9
movsd 0x20(%rsp,%r12,8), %xmm10
subsd %xmm10, %xmm9
mulsd %xmm3, %xmm9
xorps %xmm3, %xmm3
cvtsd2ss 0x20(%rsp,%r10,8), %xmm3
movslq %edx, %rdx
leaq (%rdx,%rdx,4), %r10
subsd %xmm0, %xmm8
divsd %xmm8, %xmm9
addsd %xmm10, %xmm9
unpcklpd %xmm9, %xmm7            # xmm7 = xmm7[0],xmm9[0]
cvtpd2ps %xmm7, %xmm0
movss %xmm3, 0xc(%rcx,%r10,8)
movlpd %xmm0, (%rcx,%r10,8)
incl %edx
jmp 0x543c5
cmpl $0x2, %edx
jl 0x5438c
leal -0x1(%rdx), %r12d
leaq (%r12,%r12,4), %r13
xorps %xmm0, %xmm0
cvtss2sd (%rcx,%r13,8), %xmm0
ucomisd %xmm8, %xmm0
jb 0x5438c
movl %r12d, %edx
movslq %edx, %rdx
movhpd 0x20(%rsp,%r11,8), %xmm8 # xmm8 = xmm8[0],mem[0]
cvtpd2ps %xmm8, %xmm0
leaq (%rdx,%rdx,4), %r11
xorps %xmm3, %xmm3
cvtsd2ss 0x20(%rsp,%r10,8), %xmm3
movlpd %xmm0, (%rcx,%r11,8)
movss %xmm3, 0xc(%rcx,%r11,8)
incl %edx
incl %edi
cmpl %eax, %edi
cmovgel %r8d, %edi
cmpl %r9d, %edi
je 0x543e3
testl %r9d, %r9d
leal -0x1(%r9), %r9d
cmovlel %esi, %r9d
cmpl %r9d, %edi
jne 0x54222
movl %edi, %r10d
movsd 0x50(%rsp,%r10,8), %xmm7
leal -0x1(%rdx), %eax
cltq
leaq (%rax,%rax,4), %rax
xorps %xmm0, %xmm0
cvtss2sd (%rcx,%rax,8), %xmm0
ucomisd %xmm0, %xmm7
jbe 0x54425
xorps %xmm0, %xmm0
cvtsd2ss %xmm7, %xmm0
movslq %edx, %rax
leaq (%rax,%rax,4), %rax
xorps %xmm3, %xmm3
cvtsd2ss 0x20(%rsp,%r10,8), %xmm3
movss %xmm0, (%rcx,%rax,8)
movss %xmm3, 0xc(%rcx,%rax,8)
movss %xmm3, 0x4(%rcx,%rax,8)
incl %edx
movl %edx, %eax
testl %edx, %edx
jle 0x54466
leaq 0x5ba7e2(%rip), %rsi    # 0x60ec14
xorl %edi, %edi
leaq 0x1(%rdi), %r8
movss -0x8(%rsi), %xmm0
movss (%rsi), %xmm3
movss %xmm0, -0x2c(%rsi)
movl %edi, -0x14(%rsi)
movss %xmm3, -0x24(%rsi)
movl %edi, -0x10(%rsi)
movl %r8d, -0x20(%rsi)
decl %edi
movl %edi, -0x1c(%rsi)
addq $0x28, %rsi
movq %r8, %rdi
cmpq %r8, %rax
jne 0x54434
leal -0x1(%rdx), %esi
movslq %esi, %rdi
leaq (%rdi,%rdi,4), %r8
movl $0x0, 0x14(%rcx,%r8,8)
movl %edi, 0x5ba779(%rip)    # 0x60ebf8
movl %edx, 0x5e275b(%rip)    # 0x636be0
cmpl $0x1000, %edx           # imm = 0x1000
jge 0x544b4
movslq %edx, %rax
leaq (%rax,%rax,4), %rdi
leaq (%rcx,%rdi,8), %rdi
addq $0x18, %rdi
leal 0x2(%rsi), %r8d
movl %r8d, -0x4(%rdi)
movl %esi, (%rdi)
incl %esi
addq $0x28, %rdi
cmpl $0xfff, %esi            # imm = 0xFFF
jne 0x5449c
movl %edx, 0x5e2712(%rip)    # 0x636bcc
leaq (%rax,%rax,4), %rax
movl $0xfff, 0x18(%rcx,%rax,8) # imm = 0xFFF
leaq 0x344603(%rip), %r12    # 0x398ad0
cmpw $0x2, (%r12)
jne 0x54743
leaq 0x50760(%rip), %rax     # 0xa4c40
xorps %xmm7, %xmm7
cvtsi2sdl (%rax), %xmm7
leaq 0x3c497a(%rip), %rax    # 0x418e68
xorps %xmm8, %xmm8
cvtsi2sdl (%rax), %xmm8
subsd %xmm1, %xmm7
subsd %xmm6, %xmm8
movapd %xmm8, %xmm0
mulsd %xmm5, %xmm0
mulsd %xmm7, %xmm5
movapd 0xe0(%rsp), %xmm3
mulsd %xmm3, %xmm7
addsd %xmm0, %xmm7
mulsd %xmm3, %xmm8
subsd %xmm5, %xmm8
mulsd %xmm8, %xmm4
movapd 0xf0(%rsp), %xmm0
mulsd %xmm0, %xmm1
subsd %xmm4, %xmm1
mulsd %xmm0, %xmm8
xorps %xmm0, %xmm0
cvtsi2ssl (%rbx), %xmm0
cvtss2sd %xmm0, %xmm0
xorps %xmm3, %xmm3
cvtsi2ssl (%r14), %xmm3
cvtss2sd %xmm3, %xmm3
movapd %xmm7, %xmm4
mulsd %xmm3, %xmm4
movapd %xmm1, %xmm5
mulsd %xmm0, %xmm5
subsd %xmm4, %xmm5
cvttsd2si %xmm5, %r8d
addsd %xmm2, %xmm8
mulsd %xmm0, %xmm7
mulsd %xmm3, %xmm1
addsd %xmm7, %xmm1
cvttsd2si %xmm1, %r9d
mulsd 0x22b2e(%rip), %xmm8    # 0x770c0
cvttsd2si %xmm8, %eax
leaq 0x16449a(%rip), %rbx    # 0x1b8a38
movl $0x1, (%rbx)
leaq 0x1e64a5(%rip), %rcx    # 0x23aa50
movl (%rcx), %edi
leaq 0x1e64a0(%rip), %rcx    # 0x23aa54
movl (%rcx), %esi
leaq 0x2174a3(%rip), %rcx    # 0x26ba60
movl (%rcx), %edx
leaq 0x37a786(%rip), %rcx    # 0x3ced4c
movswl (%rcx), %ecx
sarl $0xc, %r8d
sarl $0xc, %r9d
sarl $0x8, %eax
leaq 0xc(%rsp), %r10
leaq 0x10(%rsp), %r11
leaq 0x14(%rsp), %r13
leaq 0x6(%rsp), %rbp
leaq 0x4(%rsp), %r14
leaq 0x1e(%rsp), %r15
pushq $-0xffd0                # imm = 0xFFFF0030
pushq %r10
pushq %r11
pushq %r13
pushq %rbp
pushq %r14
pushq %r15
pushq %rax
callq 0x37287
addq $0x40, %rsp
movl $0x0, (%rbx)
movzwl (%r15), %ecx
leaq 0x4018d3(%rip), %rax    # 0x455ef0
movw %cx, (%rax)
movswq (%r14), %rax
testq %rax, %rax
js 0x546b5
leaq 0x4018be(%rip), %r13    # 0x455ef2
movw %ax, (%r13)
leaq 0x344492(%rip), %rbp    # 0x398ad2
movw $0x0, (%rbp)
shlq $0x5, %rax
leaq 0x1643ff(%rip), %r14    # 0x1b8a50
cmpw $0x0, 0xa(%r14,%rax)
leaq 0x1643df(%rip), %r15    # 0x1b8a3e
js 0x5473c
movswl 0xc(%r14,%rax), %edi
movl 0x14(%rsp), %esi
movl 0x10(%rsp), %edx
leaq 0x8(%rsp), %rcx
leaq 0x18(%rsp), %rbx
movq %rbx, %r8
callq 0x26766
movl 0xc(%rsp), %eax
cmpl (%rbx), %eax
jle 0x546d7
movswq 0x4(%rsp), %rax
shlq $0x5, %rax
testb $0x2, 0xe(%r14,%rax)
je 0x5473c
addq %rax, %r14
movzwl 0xa(%r14), %eax
movw %ax, (%r13)
jmp 0x5473c
movzwl 0x6(%rsp), %eax
testw %ax, %ax
js 0x546f7
leaq 0x40182c(%rip), %rcx    # 0x455ef2
movw %ax, (%rcx)
leaq 0x344402(%rip), %rax    # 0x398ad2
movw $0x3, (%rax)
jmp 0x54735
cmpl 0x8(%rsp), %eax
jle 0x5473c
movswq 0x4(%rsp), %rax
shlq $0x5, %rax
testb $0x30, 0xe(%r14,%rax)
je 0x5473c
movw $0x4, (%rbp)
jmp 0x5473c
movl 0x14(%rsp), %esi
movl 0x10(%rsp), %edx
movswl %cx, %edi
leaq 0x8(%rsp), %rbx
leaq 0x18(%rsp), %r14
movq %rbx, %rcx
movq %r14, %r8
callq 0x26766
movl 0xc(%rsp), %eax
addl %eax, %eax
movl (%r14), %ecx
addl (%rbx), %ecx
xorl %edx, %edx
cmpl %ecx, %eax
setge %dl
incl %edx
leaq 0x3443a0(%rip), %rax    # 0x398ad2
movw %dx, (%rax)
leaq 0x164302(%rip), %r15    # 0x1b8a3e
movw $0x0, (%r12)
leaq 0x383052(%rip), %r12    # 0x3d779c
xorl %eax, %eax
movw %ax, (%r12)
leaq 0x383042(%rip), %rcx    # 0x3d779a
movw %ax, (%rcx)
leaq 0x37a5ea(%rip), %rbx    # 0x3ced4c
movswl (%rbx), %r14d
cmpl $0x1000, %r14d          # imm = 0x1000
jl 0x54778
addl $0xfffff000, %r14d      # imm = 0xFFFFF000
jmp 0x5479a
leaq 0x1e62d1(%rip), %rax    # 0x23aa50
movl (%rax), %edi
leaq 0x1e62cc(%rip), %rax    # 0x23aa54
movl (%rax), %esi
movq %rbx, %rdx
callq 0x2668d
movzwl (%rbx), %eax
testw %ax, %ax
jns 0x547a1
movw %r14w, (%rbx)
movl %r14d, %eax
movswl %ax, %edi
callq 0x54998
cmpb $0x0, (%r15)
movsd 0x5a63f3(%rip), %xmm0   # 0x5faba8
je 0x547ff
xorps 0x23872(%rip), %xmm0    # 0x78030
movlps %xmm0, 0x5a63db(%rip)   # 0x5faba0
movb $0x0, (%r15)
xorl %edi, %edi
callq 0x54ff3
movzwl (%r12), %r15d
decl %r15d
movw %r15w, (%r12)
movswq %r15w, %rax
leaq 0x382fd8(%rip), %rcx    # 0x3d77c0
movzwl (%rcx,%rax,2), %edx
movw %dx, (%rcx)
leaq 0x384fca(%rip), %rcx    # 0x3d97c0
movzwl (%rcx,%rax,2), %eax
movw %ax, (%rcx)
jmp 0x5480c
movsd %xmm0, 0x5a6399(%rip)   # 0x5faba0
movzwl (%r12), %r15d
testw %r15w, %r15w
jle 0x5495a
leaq 0x5a6393(%rip), %rbx    # 0x5fabb0
leaq 0x38afac(%rip), %r13    # 0x3df7d0
leal 0x3(%r15), %eax
movzwl %ax, %edx
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x62f0
movb $0x1, 0x5a6372(%rip)    # 0x5fabb0
movl $0x0, %r14d
cmpw $0x2, %r15w
jb 0x548ab
xorl %r14d, %r14d
movl $0x1, %r15d
movl %r15d, %edi
movl %r14d, %esi
callq 0x59829
testl %eax, %eax
js 0x54874
movb $0x1, (%r15,%rbx)
jne 0x54874
movslq %r14d, %rax
movb $0x1, (%rax,%rbx)
movl %r15d, %r14d
incq %r15
movswq (%r12), %rax
cmpq %rax, %r15
jl 0x54854
testw %ax, %ax
jg 0x548ab
jmp 0x548c0
movl %ebp, %edi
movl %r14d, %esi
callq 0x59829
testl %eax, %eax
js 0x548b5
movb $0x1, (%r15,%rbx)
jne 0x548b5
movslq %r14d, %rax
movb $0x1, (%rax,%rbx)
movl %ebp, %r14d
xorl %ebp, %ebp
jmp 0x548b5
movslq %ebp, %r15
cmpb $0x0, (%r15,%rbx)
je 0x54888
incl %ebp
movswl (%r12), %eax
cmpl %eax, %ebp
jl 0x548ab
movl %r14d, %edi
callq 0x54ff3
leaq 0x357c11(%rip), %rax    # 0x3ac4e0
cmpb $0x0, (%rax)
movslq %r14d, %rax
leaq 0x1e4174(%rip), %rdi    # 0x238a50
leaq 0x4febd(%rip), %r8      # 0xa47a0
leaq 0x3573f6(%rip), %r9     # 0x3abce0
je 0x54921
leaq 0x382ecd(%rip), %rcx    # 0x3d77c0
movzwl (%rcx,%rax,2), %ecx
testw %cx, %cx
js 0x54921
movzwl %cx, %ecx
addl %ecx, %ecx
movswq (%rdi,%rcx), %rdx
movl %edx, %esi
andl $0x7, %esi
movb (%r8,%rsi), %sil
sarl $0x3, %edx
movslq %edx, %rdx
orb %sil, (%r9,%rdx)
movzwl (%r13,%rcx), %ecx
jmp 0x548f7
movzwl (%r12), %r15d
decl %r15d
movw %r15w, (%r12)
movswq %r15w, %rcx
leaq 0x382e87(%rip), %rsi    # 0x3d77c0
movzwl (%rsi,%rcx,2), %edx
movw %dx, (%rsi,%rax,2)
leaq 0x384e78(%rip), %rdx    # 0x3d97c0
movzwl (%rdx,%rcx,2), %ecx
movw %cx, (%rdx,%rax,2)
testw %r15w, %r15w
jg 0x54824
cmpl $0x3, 0x5a5fef(%rip)    # 0x5fa950
jne 0x54986
leaq 0x5a5dd6(%rip), %rbx    # 0x5fa740
movl $0x203, %edi            # imm = 0x203
callq *0x98(%rbx)
movsd 0x25efb(%rip), %xmm1    # 0x7a878
xorps %xmm0, %xmm0
callq *0xa8(%rbx)
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq