// File: /workspace/github_c_makefile_star2_O2/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 0x5a9ace(%rip), %eax    # 0x5f3950
testl %eax, %eax
je 0x4acdf
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
leaq 0x12d20e(%rip), %rcx    # 0x1770b0
leaq 0x382cd7(%rip), %r12    # 0x3ccb80
movslq (%r12), %rdx
leaq 0x12d3d0(%rip), %rsi    # 0x177284
movslq (%rsi), %rsi
imulq %rdx, %rsi
addq (%rcx), %rsi
leaq 0x380eab(%rip), %r13    # 0x3cad70
movslq (%r13), %rcx
addq %rsi, %rcx
leaq 0x3868bd(%rip), %rdx    # 0x3d0790
movq %rcx, (%rdx)
cmpl $0x3, %eax
jne 0x4a045
callq 0x46fc8
leaq 0x5a9855(%rip), %rbx    # 0x5f3740
movl $0xb71, %edi            # imm = 0xB71
callq *0x40(%rbx)
movl $0x207, %edi            # imm = 0x207
callq *0x98(%rbx)
movsd 0x2567a(%rip), %xmm0    # 0x6f580
movsd 0x20bf2(%rip), %xmm1    # 0x6ab00
callq *0xa8(%rbx)
cmpl $0x0, 0x5a9a65(%rip)    # 0x5f3980
je 0x4a045
movl 0x5adc89(%rip), %ecx    # 0x5f7bb0
incl %ecx
movl %ecx, 0x5adc81(%rip)    # 0x5f7bb0
movl 0x5a9b17(%rip), %eax    # 0x5f3a4c
leaq 0x3d1f44(%rip), %rdx    # 0x41be80
cmpl (%rdx), %eax
jge 0x49f62
incl %eax
movl %eax, 0x5a9b04(%rip)    # 0x5f3a4c
pushq $0x1
popq %rcx
movl %ecx, %edi
movl %ecx, %esi
movl %ecx, %edx
callq *0x10(%rbx)
movl $0x4000, %edi           # imm = 0x4000
callq *0x8(%rbx)
movl 0x5adc4e(%rip), %ecx    # 0x5f7bb0
movq 0x80(%rbx), %rax
movl (%r13), %edi
leaq 0x530c0(%rip), %rdx     # 0x9d034
testb $0x1, %cl
jne 0x49fd4
leaq 0x3b7064(%rip), %rcx    # 0x400fe4
movl (%rcx), %ecx
movl %ecx, %esi
notl %esi
addl (%rdx), %esi
leaq 0x3b7051(%rip), %rdx    # 0x400fe0
movl (%rdx), %edx
subl %edi, %edx
addl $0x11, %edx
subl (%r12), %ecx
incl %ecx
callq *%rax
pushq $0x1
popq %rcx
xorl %edi, %edi
movl %ecx, %esi
movl %ecx, %edx
callq *0x10(%rbx)
leaq 0x21eac7(%rip), %rax    # 0x268a78
movl (%rax), %eax
movl $0xfffffc00, %ecx       # imm = 0xFFFFFC00
cltd
idivl %ecx
leaq 0x1e9a8e(%rip), %rcx    # 0x233a50
addl %eax, (%rcx)
leaq 0x21eaa5(%rip), %rax    # 0x268a70
movl (%rax), %eax
movl $0x400, %ecx            # imm = 0x400
jmp 0x4a030
leaq 0x3b7009(%rip), %rcx    # 0x400fe4
movl (%rcx), %ecx
movl %ecx, %esi
notl %esi
addl (%rdx), %esi
leaq 0x3b6ff6(%rip), %rdx    # 0x400fe0
movl (%rdx), %edx
subl %edi, %edx
addl $-0x10, %edi
addl $0x11, %edx
subl (%r12), %ecx
incl %ecx
callq *%rax
pushq $0x1
popq %rcx
movl %ecx, %edi
xorl %esi, %esi
xorl %edx, %edx
callq *0x10(%rbx)
leaq 0x21ea69(%rip), %rax    # 0x268a78
movl (%rax), %eax
movl $0x400, %ecx            # imm = 0x400
cltd
idivl %ecx
leaq 0x1e9a30(%rip), %rcx    # 0x233a50
addl %eax, (%rcx)
leaq 0x21ea47(%rip), %rax    # 0x268a70
movl (%rax), %eax
movl $0xfffffc00, %ecx       # imm = 0xFFFFFC00
cltd
idivl %ecx
leaq 0x1e9a1a(%rip), %rcx    # 0x233a54
addl (%rcx), %eax
leaq 0x1e9a11(%rip), %rcx    # 0x233a54
movl %eax, (%rcx)
leaq 0x22aa4c(%rip), %rax    # 0x274a98
cvtsi2sdl (%rax), %xmm2
mulsd 0x25530(%rip), %xmm2    # 0x6f588
leaq 0x30c859(%rip), %rax    # 0x3568b8
cvtsi2sdl (%rax), %xmm0
leaq 0x37ece6(%rip), %rax    # 0x3c8d50
cvtsi2sdl (%rax), %xmm1
mulsd %xmm1, %xmm0
mulsd 0x25516(%rip), %xmm0    # 0x6f590
movsd %xmm2, 0x5adb36(%rip)   # 0x5f7bb8
leaq 0x537a7(%rip), %rax     # 0x9d830
cvtsi2sdl (%rax), %xmm2
movsd %xmm0, 0x5adb2b(%rip)   # 0x5f7bc0
mulsd %xmm1, %xmm2
mulsd 0x254f7(%rip), %xmm2    # 0x6f598
movsd %xmm2, 0x5adb1f(%rip)   # 0x5f7bc8
leaq 0x21e9c0(%rip), %rbx    # 0x268a70
cvtsi2sdl (%rbx), %xmm2
movsd 0x254e4(%rip), %xmm3    # 0x6f5a0
mulsd %xmm3, %xmm2
movsd %xmm2, 0x5a98e8(%rip)   # 0x5f39b0
leaq 0x21e9a9(%rip), %r14    # 0x268a78
cvtsi2sdl (%r14), %xmm4
mulsd %xmm3, %xmm4
movsd %xmm4, 0x5a98e0(%rip)   # 0x5f39c0
mulsd %xmm1, %xmm2
movsd 0x1fed4(%rip), %xmm3    # 0x69fc0
mulsd %xmm3, %xmm2
movsd %xmm2, 0x5a98b0(%rip)   # 0x5f39a8
mulsd %xmm1, %xmm4
mulsd %xmm3, %xmm4
movsd %xmm4, 0x5a98b0(%rip)   # 0x5f39b8
leaq 0x3c7d55(%rip), %rax    # 0x411e64
cvtsi2sdl (%rax), %xmm1
movsd %xmm1, 0x5a9a15(%rip)   # 0x5f3b30
movsd 0x21e65(%rip), %xmm2    # 0x6bf88
mulsd %xmm1, %xmm2
movsd 0x209d1(%rip), %xmm4    # 0x6ab00
movapd %xmm4, %xmm3
divsd %xmm2, %xmm3
movsd %xmm3, 0x5a9a69(%rip)   # 0x5f3ba8
leaq 0x22a956(%rip), %rax    # 0x274a9c
cvtsi2sdl (%rax), %xmm2
leaq 0x37dbef(%rip), %rax    # 0x3c7d40
cvtsi2ssl (%rax), %xmm3
cvtss2sd %xmm3, %xmm3
mulsd %xmm0, %xmm3
mulsd 0x25443(%rip), %xmm3    # 0x6f5a8
movsd %xmm3, 0x5ada63(%rip)   # 0x5f7bd0
leaq 0x22a920(%rip), %r15    # 0x274a94
movl (%r15), %eax
sarl %eax
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, 0x5a999f(%rip)   # 0x5f3b40
mulsd %xmm3, %xmm3
movapd %xmm4, %xmm0
subsd %xmm3, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x4a1bd
sqrtsd %xmm0, %xmm0
jmp 0x4a1c2
callq 0x64c0
movl (%r15), %eax
sarl %eax
cvtsi2sd %eax, %xmm1
movsd %xmm0, 0x5a994d(%rip)   # 0x5f3b20
movsd %xmm1, 0x5a995d(%rip)   # 0x5f3b38
cvtss2sd 0x5a9775(%rip), %xmm0   # 0x5f3958
callq 0x6a10
movsd %xmm0, 0x5a9938(%rip)   # 0x5f3b28
cvtss2sd 0x5a9760(%rip), %xmm0   # 0x5f3958
callq 0x6390
movaps %xmm0, %xmm1
andps 0x251d9(%rip), %xmm1    # 0x6f3e0
movsd %xmm0, 0x5a9939(%rip)   # 0x5f3b48
movsd 0x25399(%rip), %xmm2    # 0x6f5b0
ucomisd %xmm1, %xmm2
jbe 0x4a24d
andq $0x0, 0x5a9923(%rip)    # 0x5f3b48
movsd 0x5a98fb(%rip), %xmm1   # 0x5f3b28
xorps %xmm0, %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x251b0(%rip), %rcx     # 0x6f3f0
movsd (%rcx,%rax,8), %xmm1
movsd %xmm1, 0x5a98db(%rip)   # 0x5f3b28
leaq 0x1677ea(%rip), %r15    # 0x1b1a3e
cmpb $0x0, (%r15)
movsd 0x2089f(%rip), %xmm12   # 0x6ab00
je 0x4a271
xorps 0x22b36(%rip), %xmm0    # 0x6cda0
movlps %xmm0, 0x5a98d7(%rip)   # 0x5f3b48
leaq 0x3b6d68(%rip), %rax    # 0x400fe0
movl (%rax), %eax
subl (%r13), %eax
movabsq $-0x4010000000000000, %rcx # imm = 0xBFF0000000000000
movq %rcx, 0x98(%rsp)
addl $0x3, %eax
cvtsi2sd %eax, %xmm1
movq %rcx, 0x80(%rsp)
movsd %xmm1, 0x90(%rsp)
movsd %xmm1, 0x88(%rsp)
movaps 0x25148(%rip), %xmm1    # 0x6f400
leaq 0x3b6d25(%rip), %rax    # 0x400fe4
movl (%rax), %eax
subl (%r12), %eax
movaps %xmm1, 0xb0(%rsp)
addl $0x3, %eax
cvtsi2sd %eax, %xmm1
movsd %xmm1, 0xc8(%rsp)
movsd %xmm1, 0xc0(%rsp)
movsd 0x5a9842(%rip), %xmm7   # 0x5f3b30
movsd 0x5a9842(%rip), %xmm6   # 0x5f3b38
movsd 0x5a982a(%rip), %xmm5   # 0x5f3b28
movsd 0x5a981a(%rip), %xmm3   # 0x5f3b20
movsd 0x5a9832(%rip), %xmm4   # 0x5f3b40
movapd %xmm7, %xmm2
mulsd %xmm4, %xmm2
xorl %eax, %eax
movapd %xmm7, %xmm1
mulsd %xmm3, %xmm1
cmpq $0x4, %rax
je 0x4a3b4
movsd 0x80(%rsp,%rax,8), %xmm8
subsd %xmm7, %xmm8
movsd 0xb0(%rsp,%rax,8), %xmm9
subsd %xmm6, %xmm9
movapd %xmm9, %xmm10
mulsd %xmm0, %xmm10
movapd %xmm0, %xmm11
mulsd %xmm8, %xmm11
mulsd %xmm5, %xmm8
addsd %xmm10, %xmm8
mulsd %xmm5, %xmm9
subsd %xmm11, %xmm9
movsd %xmm8, 0x80(%rsp,%rax,8)
movapd %xmm4, %xmm8
mulsd %xmm9, %xmm8
mulsd %xmm3, %xmm9
addsd %xmm2, %xmm9
movsd %xmm9, 0xb0(%rsp,%rax,8)
movapd %xmm1, %xmm9
subsd %xmm8, %xmm9
movsd %xmm9, 0x170(%rsp,%rax,8)
incq %rax
jmp 0x4a320
xorl %edx, %edx
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
xorl %eax, %eax
cmpq $0x4, %rdx
je 0x4a4c4
movsd 0x170(%rsp,%rdx,8), %xmm8
ucomisd %xmm12, %xmm8
jb 0x4a413
movsd 0x80(%rsp,%rdx,8), %xmm9
cltq
movsd %xmm9, 0x140(%rsp,%rax,8)
movsd 0xb0(%rsp,%rdx,8), %xmm9
movsd %xmm9, 0x110(%rsp,%rax,8)
movsd %xmm8, 0xe0(%rsp,%rax,8)
incl %eax
leaq 0x1(%rdx), %rsi
ucomisd %xmm12, %xmm8
setae %r8b
cmpq $0x3, %rdx
movl $0x0, %edi
cmovneq %rsi, %rdi
movsd 0x170(%rsp,%rdi,8), %xmm9
ucomisd %xmm12, %xmm9
sbbb $0x0, %r8b
jne 0x4a4bc
movapd %xmm12, %xmm10
subsd %xmm8, %xmm10
subsd %xmm8, %xmm9
divsd %xmm9, %xmm10
movsd 0x80(%rsp,%rdi,8), %xmm8
movsd 0x80(%rsp,%rdx,8), %xmm9
subsd %xmm9, %xmm8
mulsd %xmm10, %xmm8
addsd %xmm9, %xmm8
cltq
movsd %xmm8, 0x140(%rsp,%rax,8)
movsd 0xb0(%rsp,%rdi,8), %xmm8
movsd 0xb0(%rsp,%rdx,8), %xmm9
subsd %xmm9, %xmm8
mulsd %xmm10, %xmm8
addsd %xmm9, %xmm8
movsd %xmm8, 0x110(%rsp,%rax,8)
movq %rcx, 0xe0(%rsp,%rax,8)
incl %eax
movq %rsi, %rdx
jmp 0x4a3c2
cmpl $0x3, %eax
jl 0x4acce
movl %eax, %ecx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x4a51b
movapd %xmm7, %xmm8
divsd 0xe0(%rsp,%rdx,8), %xmm8
movsd 0x140(%rsp,%rdx,8), %xmm9
mulsd %xmm8, %xmm9
addsd %xmm7, %xmm9
mulsd 0x110(%rsp,%rdx,8), %xmm8
movsd %xmm9, 0x50(%rsp,%rdx,8)
addsd %xmm6, %xmm8
movsd %xmm8, 0x20(%rsp,%rdx,8)
incq %rdx
jmp 0x4a4d1
movsd 0x50(%rsp), %xmm8
xorl %ecx, %ecx
ucomisd 0x58(%rsp), %xmm8
seta %cl
leal -0x1(%rax), %esi
movq %rsi, %rdx
movl %ecx, %edi
cmpl $0x2, %edx
jl 0x4a556
movsd 0x50(%rsp,%rdi,8), %xmm8
ucomisd 0x50(%rsp,%rdx,8), %xmm8
movl %edx, %edi
ja 0x4a54f
movl %ecx, %edi
decq %rdx
movl %edi, %ecx
jmp 0x4a534
cvtsd2ss 0x50(%rsp,%rdi,8), %xmm8
movss %xmm8, 0x5bd6a2(%rip)   # 0x607c08
cvtsd2ss 0x20(%rsp,%rdi,8), %xmm8
movss %xmm8, 0x5bd69e(%rip)   # 0x607c14
movss %xmm8, 0x5bd68d(%rip)   # 0x607c0c
leal 0x1(%rcx), %edi
xorl %r8d, %r8d
cmpl %eax, %edi
cmovgel %r8d, %edi
leal -0x1(%rcx), %r9d
testl %ecx, %ecx
cmovlel %esi, %r9d
pushq $0x2
popq %rdx
leaq 0x5bd641(%rip), %rcx    # 0x607be0
movl %edi, %r11d
movsd 0x50(%rsp,%r11,8), %xmm9
movl %r9d, %r10d
movsd 0x50(%rsp,%r10,8), %xmm8
ucomisd %xmm9, %xmm8
jbe 0x4a653
cmpl $0x2, %edx
jl 0x4a5dc
leal -0x1(%rdx), %r12d
imulq $0x28, %r12, %r13
cvtss2sd (%r13,%rcx), %xmm10
ucomisd %xmm9, %xmm10
jb 0x4a5dc
movl %r12d, %edx
movslq %edx, %rdx
imulq $0x28, %rdx, %r12
movapd %xmm9, %xmm10
movhpd 0x20(%rsp,%r11,8), %xmm10 # xmm10 = xmm10[0],mem[0]
cvtpd2ps %xmm10, %xmm10
movlpd %xmm10, (%r12,%rcx)
leal 0x1(%r9), %r11d
cmpl %eax, %r11d
cmovgel %r8d, %r11d
movsd 0x50(%rsp,%r11,8), %xmm10
subsd %xmm10, %xmm9
movsd 0x20(%rsp,%r10,8), %xmm11
movsd 0x20(%rsp,%r11,8), %xmm12
subsd %xmm12, %xmm11
mulsd %xmm9, %xmm11
subsd %xmm10, %xmm8
divsd %xmm8, %xmm11
addsd %xmm12, %xmm11
cvtsd2ss %xmm11, %xmm8
movss %xmm8, 0xc(%r12,%rcx)
incl %edx
incl %edi
cmpl %eax, %edi
cmovgel %r8d, %edi
jmp 0x4a746
ucomisd %xmm8, %xmm9
jbe 0x4a6e7
cmpl $0x2, %edx
jl 0x4a67c
leal -0x1(%rdx), %r12d
imulq $0x28, %r12, %r13
cvtss2sd (%r13,%rcx), %xmm10
ucomisd %xmm8, %xmm10
jb 0x4a67c
movl %r12d, %edx
movslq %edx, %rdx
imulq $0x28, %rdx, %r12
cvtsd2ss 0x20(%rsp,%r10,8), %xmm10
leal -0x1(%rdi), %r10d
testl %edi, %edi
cmovlel %esi, %r10d
movsd 0x50(%rsp,%r10,8), %xmm11
movapd %xmm8, %xmm12
subsd %xmm11, %xmm12
movsd 0x20(%rsp,%r11,8), %xmm13
movsd 0x20(%rsp,%r10,8), %xmm14
subsd %xmm14, %xmm13
mulsd %xmm12, %xmm13
subsd %xmm11, %xmm9
divsd %xmm9, %xmm13
addsd %xmm14, %xmm13
unpcklpd %xmm13, %xmm8           # xmm8 = xmm8[0],xmm13[0]
cvtpd2ps %xmm8, %xmm8
movss %xmm10, 0xc(%r12,%rcx)
movlpd %xmm8, (%r12,%rcx)
incl %edx
jmp 0x4a73b
cmpl $0x2, %edx
jl 0x4a705
leal -0x1(%rdx), %r12d
imulq $0x28, %r12, %r13
cvtss2sd (%r13,%rcx), %xmm10
ucomisd %xmm9, %xmm10
jb 0x4a705
movl %r12d, %edx
movslq %edx, %rdx
movhpd 0x20(%rsp,%r11,8), %xmm9 # xmm9 = xmm9[0],mem[0]
cvtpd2ps %xmm9, %xmm9
imulq $0x28, %rdx, %r11
cvtsd2ss 0x20(%rsp,%r10,8), %xmm10
movlpd %xmm9, (%r11,%rcx)
movss %xmm10, 0xc(%r11,%rcx)
incl %edx
incl %edi
cmpl %eax, %edi
cmovgel %r8d, %edi
cmpl %r9d, %edi
je 0x4a759
testl %r9d, %r9d
leal -0x1(%r9), %r9d
cmovlel %esi, %r9d
cmpl %r9d, %edi
jne 0x4a59f
movl %edi, %r10d
movsd 0x50(%rsp,%r10,8), %xmm8
leal -0x1(%rdx), %eax
cltq
imulq $0x28, %rax, %rax
cvtss2sd (%rax,%rcx), %xmm9
ucomisd %xmm9, %xmm8
jbe 0x4a798
cvtsd2ss %xmm8, %xmm8
movslq %edx, %rax
imulq $0x28, %rax, %rax
cvtsd2ss 0x20(%rsp,%r10,8), %xmm9
movss %xmm8, (%rax,%rcx)
movss %xmm9, 0xc(%rax,%rcx)
movss %xmm9, 0x4(%rax,%rcx)
incl %edx
xorl %esi, %esi
testl %edx, %edx
movl $0x0, %eax
cmovgl %edx, %eax
leaq 0x5bd469(%rip), %rdi    # 0x607c14
cmpq %rsi, %rax
je 0x4a7e3
leaq 0x1(%rsi), %r8
movss -0x8(%rdi), %xmm8
movss (%rdi), %xmm9
movss %xmm8, -0x2c(%rdi)
movl %esi, -0x14(%rdi)
movss %xmm9, -0x24(%rdi)
movl %esi, -0x10(%rdi)
movl %r8d, -0x20(%rdi)
decl %esi
movl %esi, -0x1c(%rdi)
addq $0x28, %rdi
movq %r8, %rsi
jmp 0x4a7ab
leal -0x1(%rdx), %eax
movslq %eax, %rsi
imulq $0x28, %rsi, %rdi
andl $0x0, 0x14(%rdi,%rcx)
movl %esi, 0x5bd400(%rip)    # 0x607bf8
movl %edx, 0x5e53e2(%rip)    # 0x62fbe0
movslq %edx, %rdi
imulq $0x28, %rdi, %rsi
leaq (%rsi,%rcx), %r8
addq $0x18, %r8
cmpq $0xfff, %rdi            # imm = 0xFFF
jg 0x4a82c
incq %rdi
leal 0x2(%rax), %r9d
movl %r9d, -0x4(%r8)
movl %eax, (%r8)
incl %eax
addq $0x28, %r8
jmp 0x4a80d
movl %edx, 0x5e539a(%rip)    # 0x62fbcc
movl $0xfff, 0x18(%rsi,%rcx) # imm = 0xFFF
leaq 0x34728f(%rip), %r12    # 0x391ad0
cmpw $0x2, (%r12)
jne 0x4aa8d
leaq 0x533ec(%rip), %rax     # 0x9dc40
cvtsi2sdl (%rax), %xmm8
subsd %xmm7, %xmm8
leaq 0x3c7603(%rip), %rax    # 0x411e68
cvtsi2sdl (%rax), %xmm7
subsd %xmm6, %xmm7
movapd %xmm7, %xmm6
mulsd %xmm0, %xmm6
mulsd %xmm8, %xmm0
mulsd %xmm5, %xmm8
addsd %xmm6, %xmm8
mulsd %xmm5, %xmm7
subsd %xmm0, %xmm7
mulsd %xmm7, %xmm4
subsd %xmm4, %xmm1
mulsd %xmm3, %xmm7
cvtsi2ssl (%rbx), %xmm0
cvtss2sd %xmm0, %xmm0
cvtsi2ssl (%r14), %xmm3
cvtss2sd %xmm3, %xmm3
movapd %xmm8, %xmm4
mulsd %xmm3, %xmm4
movapd %xmm1, %xmm5
mulsd %xmm0, %xmm5
subsd %xmm4, %xmm5
cvttsd2si %xmm5, %r8d
addsd %xmm2, %xmm7
mulsd %xmm0, %xmm8
mulsd %xmm3, %xmm1
addsd %xmm8, %xmm1
cvttsd2si %xmm1, %r9d
mulsd 0x21686(%rip), %xmm7    # 0x6bf68
cvttsd2si %xmm7, %eax
leaq 0x16714b(%rip), %rbx    # 0x1b1a38
movl $0x1, (%rbx)
leaq 0x1e9156(%rip), %rcx    # 0x233a50
movl (%rcx), %edi
leaq 0x1e9151(%rip), %rcx    # 0x233a54
movl (%rcx), %esi
leaq 0x21a154(%rip), %rcx    # 0x264a60
movl (%rcx), %edx
leaq 0x37d437(%rip), %rcx    # 0x3c7d4c
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 0x33ac6
addq $0x40, %rsp
andl $0x0, (%rbx)
movzwl (%r15), %ecx
leaq 0x404587(%rip), %rax    # 0x44eef0
movw %cx, (%rax)
movswq (%r14), %rax
testq %rax, %rax
js 0x4aa00
leaq 0x404572(%rip), %r13    # 0x44eef2
movw %ax, (%r13)
leaq 0x347146(%rip), %rbp    # 0x391ad2
andw $0x0, (%rbp)
shlq $0x5, %rax
leaq 0x1670b4(%rip), %r14    # 0x1b1a50
cmpw $0x0, 0xa(%r14,%rax)
leaq 0x167094(%rip), %r15    # 0x1b1a3e
js 0x4aa87
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 0x2373c
movl 0xc(%rsp), %eax
cmpl (%rbx), %eax
jle 0x4aa22
movswq 0x4(%rsp), %rax
shlq $0x5, %rax
testb $0x2, 0xe(%r14,%rax)
je 0x4aa87
addq %rax, %r14
movzwl 0xa(%r14), %eax
movw %ax, (%r13)
jmp 0x4aa87
movzwl 0x6(%rsp), %eax
testw %ax, %ax
js 0x4aa42
leaq 0x4044e1(%rip), %rcx    # 0x44eef2
movw %ax, (%rcx)
leaq 0x3470b7(%rip), %rax    # 0x391ad2
movw $0x3, (%rax)
jmp 0x4aa80
cmpl 0x8(%rsp), %eax
jle 0x4aa87
movswq 0x4(%rsp), %rax
shlq $0x5, %rax
testb $0x30, 0xe(%r14,%rax)
je 0x4aa87
movw $0x4, (%rbp)
jmp 0x4aa87
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 0x2373c
movl 0xc(%rsp), %eax
addl %eax, %eax
movl (%r14), %ecx
addl (%rbx), %ecx
xorl %edx, %edx
cmpl %ecx, %eax
setge %dl
incl %edx
leaq 0x347055(%rip), %rax    # 0x391ad2
movw %dx, (%rax)
leaq 0x166fb7(%rip), %r15    # 0x1b1a3e
andw $0x0, (%r12)
leaq 0x385d08(%rip), %r14    # 0x3d079c
andw $0x0, (%r14)
leaq 0x385cfa(%rip), %rax    # 0x3d079a
andw $0x0, (%rax)
leaq 0x37d2a1(%rip), %rbx    # 0x3c7d4c
movzwl (%rbx), %ebp
cmpw $0x1000, %bp            # imm = 0x1000
jl 0x4aabd
addl $0xfffff000, %ebp       # imm = 0xFFFFF000
jmp 0x4aadf
leaq 0x1e8f8c(%rip), %rax    # 0x233a50
movl (%rax), %edi
leaq 0x1e8f87(%rip), %rax    # 0x233a54
movl (%rax), %esi
movq %rbx, %rdx
callq 0x23663
movzwl (%rbx), %eax
testw %ax, %ax
jns 0x4aae4
movw %bp, (%rbx)
movl %ebp, %eax
movswl %ax, %edi
callq 0x4ace0
cmpb $0x0, (%r15)
movsd 0x5a90b0(%rip), %xmm0   # 0x5f3ba8
je 0x4ab40
xorps 0x2229f(%rip), %xmm0    # 0x6cda0
movlps %xmm0, 0x5a9098(%rip)   # 0x5f3ba0
movb $0x0, (%r15)
xorl %edi, %edi
callq 0x4b308
movzwl (%r14), %r15d
decl %r15d
movw %r15w, (%r14)
movswq %r15w, %rax
leaq 0x385c97(%rip), %rcx    # 0x3d07c0
movzwl (%rcx,%rax,2), %edx
movw %dx, (%rcx)
leaq 0x387c89(%rip), %rcx    # 0x3d27c0
movzwl (%rcx,%rax,2), %eax
movw %ax, (%rcx)
jmp 0x4ab4c
movsd %xmm0, 0x5a9058(%rip)   # 0x5f3ba0
movzwl (%r14), %r15d
leaq 0x5a905d(%rip), %rbx    # 0x5f3bb0
testw %r15w, %r15w
jle 0x4aca2
leal 0x3(%r15), %eax
movzwl %ax, %edx
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x62f0
movb $0x1, 0x5a9039(%rip)    # 0x5f3bb0
pushq $0x1
popq %r14
leaq 0x385c1a(%rip), %r12    # 0x3d079c
movswq %r15w, %rax
cmpq %rax, %r14
jge 0x4abb4
movl %r14d, %edi
movl %ebp, %esi
callq 0x4f846
testl %eax, %eax
js 0x4abaa
movb $0x1, (%r14,%rbx)
jne 0x4abaa
movslq %ebp, %rax
movb $0x1, (%rax,%rbx)
movl %r14d, %ebp
incq %r14
movzwl (%r12), %r15d
jmp 0x4ab82
xorl %r14d, %r14d
movswl %r15w, %eax
movslq %ebp, %r13
cmpl %eax, %r14d
jge 0x4ac00
movslq %r14d, %r12
cmpb $0x0, (%r12,%rbx)
je 0x4abd2
incl %r14d
jmp 0x4abb7
movl %r14d, %edi
movl %ebp, %esi
callq 0x4f846
leaq 0x385bb9(%rip), %rcx    # 0x3d079c
movzwl (%rcx), %r15d
testl %eax, %eax
js 0x4abcd
movb $0x1, (%r12,%rbx)
jne 0x4abcd
movb $0x1, (%r13,%rbx)
movl %r14d, %ebp
xorl %r14d, %r14d
jmp 0x4abcd
movl %ebp, %edi
callq 0x4b308
leaq 0x35a8d2(%rip), %rax    # 0x3a54e0
cmpb $0x0, (%rax)
leaq 0x1e6e38(%rip), %rsi    # 0x231a50
leaq 0x52b81(%rip), %rdi     # 0x9d7a0
leaq 0x35a0ba(%rip), %r8     # 0x3a4ce0
leaq 0x38dba3(%rip), %r9     # 0x3d87d0
je 0x4ac67
leaq (,%r13,2), %rax
addq 0x4136a(%rip), %rax     # 0x8bfa8
movswq (%rax), %rcx
testq %rcx, %rcx
js 0x4ac67
leaq (%rcx,%rcx), %rax
addq %r9, %rax
movswq (%rsi,%rcx,2), %rcx
movl %ecx, %edx
andl $0x7, %edx
movb (%rdi,%rdx), %dl
sarl $0x3, %ecx
movslq %ecx, %rcx
orb %dl, (%r8,%rcx)
jmp 0x4ac3e
leaq 0x385b2e(%rip), %rax    # 0x3d079c
movzwl (%rax), %r15d
decl %r15d
movw %r15w, (%rax)
movswq %r15w, %rax
leaq 0x385b3c(%rip), %rdx    # 0x3d07c0
movzwl (%rdx,%rax,2), %ecx
movw %cx, (%rdx,%r13,2)
leaq 0x387b2c(%rip), %rcx    # 0x3d27c0
movzwl (%rcx,%rax,2), %eax
movw %ax, (%rcx,%r13,2)
jmp 0x4ab53
cmpl $0x3, 0x5a8ca7(%rip)    # 0x5f3950
jne 0x4acce
leaq 0x5a8a8e(%rip), %rbx    # 0x5f3740
movl $0x203, %edi            # imm = 0x203
callq *0x98(%rbx)
movsd 0x248f3(%rip), %xmm1    # 0x6f5b8
xorps %xmm0, %xmm0
callq *0xa8(%rbx)
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq