// File: /workspace/github_c_makefile_star2_O1/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: dorotatesprite
static void dorotatesprite(int sx, int sy, int z, short a, short picnum, signed char dashade,
	unsigned char dapalnum, unsigned char dastat, int cx1, int cy1, int cx2, int cy2, int uniqid)
{
	int cosang, sinang, v, nextv, dax1, dax2, oy, bx, by;
	int x, y, x1, y1, x2, y2, gx1, gy1, iv;
	intptr_t i, p, bufplc, palookupoffs;
	int xsiz, ysiz, xoff, yoff, npoints, yplc, yinc, lx, rx;
	int xv, yv, xv2, yv2;

	//============================================================================= //POLYMOST BEGINS
#if USE_POLYMOST
	if (rendmode) { polymost_dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,cx1,cy1,cx2,cy2,uniqid); return; }
#else
	(void)uniqid;
#endif
	//============================================================================= //POLYMOST ENDS

	if (cx1 < 0) cx1 = 0;
	if (cy1 < 0) cy1 = 0;
	if (cx2 > xres-1) cx2 = xres-1;
	if (cy2 > yres-1) cy2 = yres-1;

	xsiz = tilesizx[picnum]; ysiz = tilesizy[picnum];
	if (dastat&16) { xoff = 0; yoff = 0; }
	else
	{
		xoff = (int)((signed char)((picanm[picnum]>>8)&255))+(xsiz>>1);
		yoff = (int)((signed char)((picanm[picnum]>>16)&255))+(ysiz>>1);
	}

	if (dastat&4) yoff = ysiz-yoff;

	cosang = sintable[(a+512)&2047]; sinang = sintable[a&2047];

	if ((dastat&2) != 0)  //Auto window size scaling
	{
		if ((dastat&8) == 0)
		{
			if (widescreen) {
				x = ydimenscale;   //= scale(xdimen,yxaspect,320);
				sx = ((cx1+cx2+2)<<15)+scale(sx-(320<<15),ydimen<<16,200*pixelaspect);
			} else {
				x = xdimenscale;   //= scale(xdimen,yxaspect,320);
				sx = ((cx1+cx2+2)<<15)+scale(sx-(320<<15),xdimen,320);
			}
			sy = ((cy1+cy2+2)<<15)+mulscale16(sy-(200<<15),x);
		}
		else
		{
			  //If not clipping to startmosts, & auto-scaling on, as a
			  //hard-coded bonus, scale to full screen instead
			if (widescreen) {
				x = scale(ydim<<16,yxaspect,200*pixelaspect);
				sx = (xdim<<15)+32768+scale(sx-(320<<15),ydim<<16,200*pixelaspect);
			} else {
				x = scale(xdim,yxaspect,320);
				sx = (xdim<<15)+32768+scale(sx-(320<<15),xdim,320);
			}
			sy = (ydim<<15)+32768+mulscale16(sy-(200<<15),x);
		}
		z = mulscale16(z,x);
	}

	xv = mulscale14(cosang,z);
	yv = mulscale14(sinang,z);
	if (((dastat&2) != 0) || ((dastat&8) == 0)) //Don't aspect unscaled perms
	{
		xv2 = mulscale16(xv,xyaspect);
		yv2 = mulscale16(yv,xyaspect);
	}
	else
	{
		xv2 = xv;
		yv2 = yv;
	}

	nry1[0] = sy - (yv*xoff + xv*yoff);
	nry1[1] = nry1[0] + yv*xsiz;
	nry1[3] = nry1[0] + xv*ysiz;
	nry1[2] = nry1[1]+nry1[3]-nry1[0];
	i = (cy1<<16); if ((nry1[0]<i) && (nry1[1]<i) && (nry1[2]<i) && (nry1[3]<i)) return;
	i = (cy2<<16); if ((nry1[0]>i) && (nry1[1]>i) && (nry1[2]>i) && (nry1[3]>i)) return;

	nrx1[0] = sx - (xv2*xoff - yv2*yoff);
	nrx1[1] = nrx1[0] + xv2*xsiz;
	nrx1[3] = nrx1[0] - yv2*ysiz;
	nrx1[2] = nrx1[1]+nrx1[3]-nrx1[0];
	i = (cx1<<16); if ((nrx1[0]<i) && (nrx1[1]<i) && (nrx1[2]<i) && (nrx1[3]<i)) return;
	i = (cx2<<16); if ((nrx1[0]>i) && (nrx1[1]>i) && (nrx1[2]>i) && (nrx1[3]>i)) return;

	gx1 = nrx1[0]; gy1 = nry1[0];   //back up these before clipping

	if ((npoints = clippoly4(cx1<<16,cy1<<16,(cx2+1)<<16,(cy2+1)<<16)) < 3) return;

	lx = nrx1[0]; rx = nrx1[0];

	nextv = 0;
	for(v=npoints-1;v>=0;v--)
	{
		x1 = nrx1[v]; x2 = nrx1[nextv];
		dax1 = (x1>>16); if (x1 < lx) lx = x1;
		dax2 = (x2>>16); if (x1 > rx) rx = x1;
		if (dax1 != dax2)
		{
			y1 = nry1[v]; y2 = nry1[nextv];
			yinc = divscale16(y2-y1,x2-x1);
			if (dax2 > dax1)
			{
				yplc = y1 + mulscale16((dax1<<16)+65535-x1,yinc);
				qinterpolatedown16short(&uplc[dax1],dax2-dax1,yplc,yinc);
			}
			else
			{
				yplc = y2 + mulscale16((dax2<<16)+65535-x2,yinc);
				qinterpolatedown16short(&dplc[dax2],dax1-dax2,yplc,yinc);
			}
		}
		nextv = v;
	}

	if (waloff[picnum] == 0) loadtile(picnum);
	setgotpic(picnum);
	bufplc = waloff[picnum];

	palookupoffs = (intptr_t)palookup[dapalnum] + (getpalookup(0L,(int)dashade)<<8);

	iv = divscale32(1L,z);
	xv = mulscale14(sinang,iv);
	yv = mulscale14(cosang,iv);
	if (((dastat&2) != 0) || ((dastat&8) == 0)) //Don't aspect unscaled perms
	{
		yv2 = mulscale16(-xv,yxaspect);
		xv2 = mulscale16(yv,yxaspect);
	}
	else
	{
		yv2 = -xv;
		xv2 = yv;
	}

	x1 = (lx>>16); x2 = (rx>>16);

	oy = 0;
	x = (x1<<16)-1-gx1; y = (oy<<16)+65535-gy1;
	bx = dmulscale16(x,xv2,y,xv);
	by = dmulscale16(x,yv2,y,yv);
	if (dastat&4) { yv = -yv; yv2 = -yv2; by = (ysiz<<16)-1-by; }

#ifndef USING_A_C
	int ny1, ny2, xx, xend, qlinemode=0, y1ve[4], y2ve[4], u4, d4;
	char bad;

	if ((dastat&1) == 0)
	{
		if (((a&1023) == 0) && (ysiz <= 256))  //vlineasm4 has 256 high limit!
		{
			if (dastat&64) setupvlineasm(24L); else setupmvlineasm(24L);
			by <<= 8; yv <<= 8; yv2 <<= 8;

			palookupoffse[0] = palookupoffse[1] = palookupoffse[2] = palookupoffse[3] = palookupoffs;
			vince[0] = vince[1] = vince[2] = vince[3] = yv;

			for(x=x1;x<x2;x+=4)
			{
				bad = 15; xend = min(x2-x,4);
				for(xx=0;xx<xend;xx++)
				{
					bx += xv2;

					y1 = uplc[x+xx]; y2 = dplc[x+xx];
					if ((dastat&8) == 0)
					{
						if (startumost[x+xx] > y1) y1 = startumost[x+xx];
						if (startdmost[x+xx] < y2) y2 = startdmost[x+xx];
					}
					if (y2 <= y1) continue;

					by += yv*(y1-oy); oy = y1;

					bufplce[xx] = (bx>>16)*ysiz+bufplc;
					vplce[xx] = by;
					y1ve[xx] = y1;
					y2ve[xx] = y2-1;
					bad &= ~pow2char[xx];
				}

				p = x+frameplace;

				u4 = max(max(y1ve[0],y1ve[1]),max(y1ve[2],y1ve[3]));
				d4 = min(min(y2ve[0],y2ve[1]),min(y2ve[2],y2ve[3]));

				if (dastat&64)
				{
					if ((bad != 0) || (u4 >= d4))
					{
						if (!(bad&1)) prevlineasm1(vince[0],(void *)palookupoffse[0],y2ve[0]-y1ve[0],vplce[0],(void *)bufplce[0],(void *)(ylookup[y1ve[0]]+p+0));
						if (!(bad&2)) prevlineasm1(vince[1],(void *)palookupoffse[1],y2ve[1]-y1ve[1],vplce[1],(void *)bufplce[1],(void *)(ylookup[y1ve[1]]+p+1));
						if (!(bad&4)) prevlineasm1(vince[2],(void *)palookupoffse[2],y2ve[2]-y1ve[2],vplce[2],(void *)bufplce[2],(void *)(ylookup[y1ve[2]]+p+2));
						if (!(bad&8)) prevlineasm1(vince[3],(void *)palookupoffse[3],y2ve[3]-y1ve[3],vplce[3],(void *)bufplce[3],(void *)(ylookup[y1ve[3]]+p+3));
						continue;
					}

					if (u4 > y1ve[0]) vplce[0] = prevlineasm1(vince[0],(void *)palookupoffse[0],u4-y1ve[0]-1,vplce[0],(void *)bufplce[0],(void *)(ylookup[y1ve[0]]+p+0));
					if (u4 > y1ve[1]) vplce[1] = prevlineasm1(vince[1],(void *)palookupoffse[1],u4-y1ve[1]-1,vplce[1],(void *)bufplce[1],(void *)(ylookup[y1ve[1]]+p+1));
					if (u4 > y1ve[2]) vplce[2] = prevlineasm1(vince[2],(void *)palookupoffse[2],u4-y1ve[2]-1,vplce[2],(void *)bufplce[2],(void *)(ylookup[y1ve[2]]+p+2));
					if (u4 > y1ve[3]) vplce[3] = prevlineasm1(vince[3],(void *)palookupoffse[3],u4-y1ve[3]-1,vplce[3],(void *)bufplce[3],(void *)(ylookup[y1ve[3]]+p+3));

					if (d4 >= u4) vlineasm4(d4-u4+1,(void *)(ylookup[u4]+p));

					i = p+ylookup[d4+1];
					if (y2ve[0] > d4) prevlineasm1(vince[0],(void *)palookupoffse[0],y2ve[0]-d4-1,vplce[0],(void *)bufplce[0],(void *)(i+0));
					if (y2ve[1] > d4) prevlineasm1(vince[1],(void *)palookupoffse[1],y2ve[1]-d4-1,vplce[1],(void *)bufplce[1],(void *)(i+1));
					if (y2ve[2] > d4) prevlineasm1(vince[2],(void *)palookupoffse[2],y2ve[2]-d4-1,vplce[2],(void *)bufplce[2],(void *)(i+2));
					if (y2ve[3] > d4) prevlineasm1(vince[3],(void *)palookupoffse[3],y2ve[3]-d4-1,vplce[3],(void *)bufplce[3],(void *)(i+3));
				}
				else
				{
					if ((bad != 0) || (u4 >= d4))
					{
						if (!(bad&1)) mvlineasm1(vince[0],(void *)palookupoffse[0],y2ve[0]-y1ve[0],vplce[0],(void *)bufplce[0],(void *)(ylookup[y1ve[0]]+p+0));
						if (!(bad&2)) mvlineasm1(vince[1],(void *)palookupoffse[1],y2ve[1]-y1ve[1],vplce[1],(void *)bufplce[1],(void *)(ylookup[y1ve[1]]+p+1));
						if (!(bad&4)) mvlineasm1(vince[2],(void *)palookupoffse[2],y2ve[2]-y1ve[2],vplce[2],(void *)bufplce[2],(void *)(ylookup[y1ve[2]]+p+2));
						if (!(bad&8)) mvlineasm1(vince[3],(void *)palookupoffse[3],y2ve[3]-y1ve[3],vplce[3],(void *)bufplce[3],(void *)(ylookup[y1ve[3]]+p+3));
						continue;
					}

					if (u4 > y1ve[0]) vplce[0] = mvlineasm1(vince[0],(void *)palookupoffse[0],u4-y1ve[0]-1,vplce[0],(void *)bufplce[0],(void *)(ylookup[y1ve[0]]+p+0));
					if (u4 > y1ve[1]) vplce[1] = mvlineasm1(vince[1],(void *)palookupoffse[1],u4-y1ve[1]-1,vplce[1],(void *)bufplce[1],(void *)(ylookup[y1ve[1]]+p+1));
					if (u4 > y1ve[2]) vplce[2] = mvlineasm1(vince[2],(void *)palookupoffse[2],u4-y1ve[2]-1,vplce[2],(void *)bufplce[2],(void *)(ylookup[y1ve[2]]+p+2));
					if (u4 > y1ve[3]) vplce[3] = mvlineasm1(vince[3],(void *)palookupoffse[3],u4-y1ve[3]-1,vplce[3],(void *)bufplce[3],(void *)(ylookup[y1ve[3]]+p+3));

					if (d4 >= u4) mvlineasm4(d4-u4+1,(void *)(ylookup[u4]+p));

					i = p+ylookup[d4+1];
					if (y2ve[0] > d4) mvlineasm1(vince[0],(void *)palookupoffse[0],y2ve[0]-d4-1,vplce[0],(void *)bufplce[0],(void *)(i+0));
					if (y2ve[1] > d4) mvlineasm1(vince[1],(void *)palookupoffse[1],y2ve[1]-d4-1,vplce[1],(void *)bufplce[1],(void *)(i+1));
					if (y2ve[2] > d4) mvlineasm1(vince[2],(void *)palookupoffse[2],y2ve[2]-d4-1,vplce[2],(void *)bufplce[2],(void *)(i+2));
					if (y2ve[3] > d4) mvlineasm1(vince[3],(void *)palookupoffse[3],y2ve[3]-d4-1,vplce[3],(void *)bufplce[3],(void *)(i+3));
				}

				faketimerhandler();
			}
		}
		else
		{
			if (dastat&64)
			{
				if ((xv2&0x0000ffff) == 0)
				{
					qlinemode = 1;
					setupqrhlineasm4(0L,yv2<<16,(xv2>>16)*ysiz+(yv2>>16),(void *)palookupoffs,0L,0L);
				}
				else
				{
					qlinemode = 0;
					setuprhlineasm4(xv2<<16,yv2<<16,(xv2>>16)*ysiz+(yv2>>16),(void *)palookupoffs,ysiz,0L);
				}
			}
			else
				setuprmhlineasm4(xv2<<16,yv2<<16,(xv2>>16)*ysiz+(yv2>>16),(void *)palookupoffs,ysiz,0L);

			y1 = uplc[x1];
			if (((dastat&8) == 0) && (startumost[x1] > y1)) y1 = startumost[x1];
			y2 = y1;
			for(x=x1;x<x2;x++)
			{
				ny1 = uplc[x]-1; ny2 = dplc[x];
				if ((dastat&8) == 0)
				{
					if (startumost[x]-1 > ny1) ny1 = startumost[x]-1;
					if (startdmost[x] < ny2) ny2 = startdmost[x];
				}

				if (ny1 < ny2-1)
				{
					if (ny1 >= y2)
					{
						while (y1 < y2-1)
						{
							y1++; if ((y1&31) == 0) faketimerhandler();

								//x,y1
							bx += xv*(y1-oy); by += yv*(y1-oy); oy = y1;
							if (dastat&64) {
								if (qlinemode) qrhlineasm4(x-lastx[y1],(void *)((bx>>16)*ysiz+(by>>16)+bufplc),0L,0L    ,by<<16,(void *)(ylookup[y1]+x+frameplace));
								else rhlineasm4(x-lastx[y1],(void *)((bx>>16)*ysiz+(by>>16)+bufplc),0L,bx<<16,by<<16,(void *)(ylookup[y1]+x+frameplace));
							} else rmhlineasm4(x-lastx[y1],(void *)((bx>>16)*ysiz+(by>>16)+bufplc),0L,bx<<16,by<<16,(void *)(ylookup[y1]+x+frameplace));
						}
						y1 = ny1;
					}
					else
					{
						while (y1 < ny1)
						{
							y1++; if ((y1&31) == 0) faketimerhandler();

								//x,y1
							bx += xv*(y1-oy); by += yv*(y1-oy); oy = y1;
							if (dastat&64) {
								if (qlinemode) qrhlineasm4(x-lastx[y1],(void *)((bx>>16)*ysiz+(by>>16)+bufplc),0L,0L    ,by<<16,(void *)(ylookup[y1]+x+frameplace));
								else rhlineasm4(x-lastx[y1],(void *)((bx>>16)*ysiz+(by>>16)+bufplc),0L,bx<<16,by<<16,(void *)(ylookup[y1]+x+frameplace));
							} else rmhlineasm4(x-lastx[y1],(void *)((bx>>16)*ysiz+(by>>16)+bufplc),0L,bx<<16,by<<16,(void *)(ylookup[y1]+x+frameplace));
						}
						while (y1 > ny1) lastx[y1--] = x;
					}
					while (y2 > ny2)
					{
						y2--; if ((y2&31) == 0) faketimerhandler();

							//x,y2
						bx += xv*(y2-oy); by += yv*(y2-oy); oy = y2;
						if (dastat&64) {
							if (qlinemode) qrhlineasm4(x-lastx[y2],(void *)((bx>>16)*ysiz+(by>>16)+bufplc),0L,0L    ,by<<16,(void *)(ylookup[y2]+x+frameplace));
							else rhlineasm4(x-lastx[y2],(void *)((bx>>16)*ysiz+(by>>16)+bufplc),0L,bx<<16,by<<16,(void *)(ylookup[y2]+x+frameplace));
						} else rmhlineasm4(x-lastx[y2],(void *)((bx>>16)*ysiz+(by>>16)+bufplc),0L,bx<<16,by<<16,(void *)(ylookup[y2]+x+frameplace));
					}
					while (y2 < ny2) lastx[y2++] = x;
				}
				else
				{
					while (y1 < y2-1)
					{
						y1++; if ((y1&31) == 0) faketimerhandler();

							//x,y1
						bx += xv*(y1-oy); by += yv*(y1-oy); oy = y1;
						if (dastat&64) {
							if (qlinemode) qrhlineasm4(x-lastx[y1],(void *)((bx>>16)*ysiz+(by>>16)+bufplc),0L,0L    ,by<<16,(void *)(ylookup[y1]+x+frameplace));
							else rhlineasm4(x-lastx[y1],(void *)((bx>>16)*ysiz+(by>>16)+bufplc),0L,bx<<16,by<<16,(void *)(ylookup[y1]+x+frameplace));
						} else rmhlineasm4(x-lastx[y1],(void *)((bx>>16)*ysiz+(by>>16)+bufplc),0L,bx<<16,by<<16,(void *)(ylookup[y1]+x+frameplace));
					}
					if (x == x2-1) { bx += xv2; by += yv2; break; }
					y1 = uplc[x+1];
					if (((dastat&8) == 0) && (startumost[x+1] > y1)) y1 = startumost[x+1];
					y2 = y1;
				}
				bx += xv2; by += yv2;
			}
			while (y1 < y2-1)
			{
				y1++; if ((y1&31) == 0) faketimerhandler();

					//x2,y1
				bx += xv*(y1-oy); by += yv*(y1-oy); oy = y1;
				if (dastat&64) {
					if (qlinemode) qrhlineasm4(x2-lastx[y1],(void *)((bx>>16)*ysiz+(by>>16)+bufplc),0L,0L,by<<16,(void *)(ylookup[y1]+x2+frameplace));
					else rhlineasm4(x2-lastx[y1],(void *)((bx>>16)*ysiz+(by>>16)+bufplc),0L,bx<<16,by<<16,(void *)(ylookup[y1]+x2+frameplace));
				} else rmhlineasm4(x2-lastx[y1],(void *)((bx>>16)*ysiz+(by>>16)+bufplc),0L,bx<<16,by<<16,(void *)(ylookup[y1]+x2+frameplace));
			}
		}
	}
	else
	{
		if ((dastat&1) == 0)
		{
			if (dastat&64)
				setupspritevline((void *)palookupoffs,(xv>>16)*ysiz,xv<<16,ysiz,yv,0L);
			else
				msetupspritevline((void *)palookupoffs,(xv>>16)*ysiz,xv<<16,ysiz,yv,0L);
		}
		else
		{
			tsetupspritevline((void *)palookupoffs,(xv>>16)*ysiz,xv<<16,ysiz,yv,0L);
			if (dastat&32) settransreverse(); else settransnormal();
		}
		for(x=x1;x<x2;x++)
		{
			bx += xv2; by += yv2;

			y1 = uplc[x]; y2 = dplc[x];
			if ((dastat&8) == 0)
			{
				if (startumost[x] > y1) y1 = startumost[x];
				if (startdmost[x] < y2) y2 = startdmost[x];
			}
			if (y2 <= y1) continue;

			switch(y1-oy)
			{
				case -1: bx -= xv; by -= yv; oy = y1; break;
				case 0: break;
				case 1: bx += xv; by += yv; oy = y1; break;
				default: bx += xv*(y1-oy); by += yv*(y1-oy); oy = y1; break;
			}

			p = ylookup[y1]+x+frameplace;

			if ((dastat&1) == 0)
			{
				if (dastat&64)
					spritevline(0L,by<<16,y2-y1+1,bx<<16,(void *)((bx>>16)*ysiz+(by>>16)+bufplc),(void *)p);
				else
					mspritevline(0L,by<<16,y2-y1+1,bx<<16,(void *)((bx>>16)*ysiz+(by>>16)+bufplc),(void *)p);
			}
			else
			{
				tspritevline(0L,by<<16,y2-y1+1,bx<<16,(void *)((bx>>16)*ysiz+(by>>16)+bufplc),(void *)p);
			}
			faketimerhandler();
		}
	}

#else	// USING_A_C

	if ((dastat&1) == 0)
	{
		if (dastat&64)
			setupspritevline((void *)palookupoffs,xv,yv,ysiz);
		else
			msetupspritevline((void *)palookupoffs,xv,yv,ysiz);
	}
	else
	{
		tsetupspritevline((void *)palookupoffs,xv,yv,ysiz);
		if (dastat&32) settransreverse(); else settransnormal();
	}
	for(x=x1;x<x2;x++)
	{
		bx += xv2; by += yv2;

		y1 = uplc[x]; y2 = dplc[x];
		if ((dastat&8) == 0)
		{
			if (startumost[x] > y1) y1 = startumost[x];
			if (startdmost[x] < y2) y2 = startdmost[x];
		}
		if (y2 <= y1) continue;

		switch(y1-oy)
		{
			case -1: bx -= xv; by -= yv; oy = y1; break;
			case 0: break;
			case 1: bx += xv; by += yv; oy = y1; break;
			default: bx += xv*(y1-oy); by += yv*(y1-oy); oy = y1; break;
		}

		p = ylookup[y1]+x+frameplace;

		if ((dastat&1) == 0)
		{
			if (dastat&64)
				spritevline(bx&65535,by&65535,y2-y1+1,(void *)((bx>>16)*ysiz+(by>>16)+bufplc),(void *)p);
			else
				mspritevline(bx&65535,by&65535,y2-y1+1,(void *)((bx>>16)*ysiz+(by>>16)+bufplc),(void *)p);
		}
		else
		{
			tspritevline(bx&65535,by&65535,y2-y1+1,(void *)((bx>>16)*ysiz+(by>>16)+bufplc),(void *)p);
			//transarea += (y2-y1);
		}
		faketimerhandler();
	}

#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %r10d
movl %esi, %r12d
leaq 0x5c5c1e(%rip), %rax    # 0x5f9950
cmpl $0x0, (%rax)
je 0x33d5b
movswl %cx, %ecx
movswl %r8w, %r8d
movsbl %r9b, %r9d
movl %r12d, %esi
movl %r10d, %edx
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x597e2
movl %r9d, 0x3c(%rsp)
movl 0xa8(%rsp), %eax
movl 0xa0(%rsp), %edx
movl 0x90(%rsp), %r11d
xorl %r15d, %r15d
testl %r11d, %r11d
cmovlel %r15d, %r11d
movl 0x98(%rsp), %r14d
testl %r14d, %r14d
cmovlel %r15d, %r14d
leaq 0x6f29a(%rip), %rsi     # 0xa3030
movl (%rsi), %esi
leal -0x1(%rsi), %ebp
cmpl %edx, %esi
cmovgl %edx, %ebp
leaq 0x6f28d(%rip), %rdx     # 0xa3034
movl (%rdx), %edx
leal -0x1(%rdx), %r9d
cmpl %eax, %edx
cmovgl %eax, %r9d
movb 0x88(%rsp), %bl
movl %r8d, 0x38(%rsp)
movswq %r8w, %rsi
leaq 0x3db256(%rip), %rax    # 0x40f020
movswl (%rax,%rsi,2), %r8d
leaq 0x3cca0a(%rip), %rax    # 0x4007e0
movswl (%rax,%rsi,2), %r13d
movl $0x0, %eax
testb $0x10, %bl
jne 0x33e0d
leaq 0x205c74(%rip), %rax    # 0x239a60
movl (%rax,%rsi,4), %eax
movl %eax, %edx
shrl $0x8, %edx
movsbl %dl, %edx
movl %r8d, %r15d
sarl %r15d
addl %edx, %r15d
shrl $0x10, %eax
movsbl %al, %edx
movl %r13d, %eax
sarl %eax
addl %edx, %eax
movq %rsi, 0x30(%rsp)
movb 0x80(%rsp), %dl
movb %dl, 0xf(%rsp)
movzbl %bl, %edx
movl %edx, 0x28(%rsp)
movl %r13d, %edx
subl %eax, %edx
testb $0x4, %bl
cmovel %eax, %edx
movl %edx, 0x20(%rsp)
movzwl %cx, %eax
leal 0x200(%rax), %ecx
movl $0x7ff, %edx            # imm = 0x7FF
andl %edx, %ecx
leaq 0x399f06(%rip), %rsi    # 0x3cdd50
movswq (%rsi,%rcx,2), %rcx
andl %edx, %eax
movswq (%rsi,%rax,2), %rax
testb $0x2, %bl
movb %bl, 0x7(%rsp)
movl %r13d, 0x8(%rsp)
movq %rcx, 0x10(%rsp)
movq %rax, 0x18(%rsp)
je 0x33fe7
movl 0x3e1df8(%rip), %eax    # 0x415c70
testb $0x8, %bl
jne 0x33ec2
leal (%r11,%rbp), %ecx
shll $0xf, %ecx
addl $0x10000, %ecx          # imm = 0x10000
addl $0xff600000, %edi       # imm = 0xFF600000
movslq %edi, %rdx
testl %eax, %eax
je 0x33f02
movl 0x246bf7(%rip), %eax    # 0x27aa94
shll $0x10, %eax
movslq 0x3e1dd1(%rip), %rsi    # 0x415c78
imulq $0xc8, %rsi, %rsi
cltq
imulq %rdx, %rax
cqto
idivq %rsi
leaq 0x4016e0(%rip), %rdx    # 0x4355a0
jmp 0x33f2f
testl %eax, %eax
je 0x33f50
movl 0x3d3120(%rip), %ecx    # 0x406ff0
shll $0x10, %ecx
movslq 0x3d310e(%rip), %rax    # 0x406fe8
movslq 0x3e1d97(%rip), %rdx    # 0x415c78
imulq $0xc8, %rdx, %rbx
movslq %ecx, %r13
imulq %r13, %rax
cqto
idivq %rbx
movq %rax, %rsi
movl 0x3d30ef(%rip), %ecx    # 0x406fec
jmp 0x33f87
movslq 0x6f927(%rip), %rax     # 0xa3830
imulq %rdx, %rax
movabsq $0x6666666666666667, %rdx # imm = 0x6666666666666667
imulq %rdx
movq %rdx, %rax
shrq $0x3f, %rdx
sarq $0x7, %rax
addq %rdx, %rax
leaq 0x246b69(%rip), %rdx    # 0x27aa98
addl %eax, %ecx
movslq (%rdx), %rsi
leal (%r9,%r14), %eax
shll $0xf, %eax
addl $0x10000, %eax          # imm = 0x10000
addl $0xff9c0000, %r12d      # imm = 0xFF9C0000
movslq %r12d, %r12
imulq %rsi, %r12
jmp 0x33fc6
movl 0x3d3096(%rip), %ecx    # 0x406fec
movslq 0x3d308b(%rip), %rax    # 0x406fe8
movslq %ecx, %r13
imulq %r13, %rax
movabsq $0x6666666666666667, %rdx # imm = 0x6666666666666667
imulq %rdx
movq %rdx, %rsi
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rsi
addq %rax, %rsi
movl $0x140, %ebx            # imm = 0x140
shll $0xf, %ecx
addl $0xff600000, %edi       # imm = 0xFF600000
movslq %edi, %rax
imulq %r13, %rax
cqto
idivq %rbx
movl $0x8000, %edx           # imm = 0x8000
addl %edx, %ecx
addl %eax, %ecx
movl 0x3d3045(%rip), %eax    # 0x406ff0
shll $0xf, %eax
addl %edx, %eax
addl $0xff9c0000, %r12d      # imm = 0xFF9C0000
movslq %r12d, %rdx
movslq %esi, %r12
imulq %rdx, %r12
movl 0x8(%rsp), %r13d
shrq $0x10, %r12
addl %eax, %r12d
movslq %r10d, %rax
movslq %esi, %r10
imulq %rax, %r10
shrq $0x10, %r10
movl %ecx, %edi
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rax
movslq %r10d, %rsi
movq %rsi, %rdx
imulq %rcx, %rdx
shrq $0xe, %rdx
movq %rsi, 0x40(%rsp)
imulq %rax, %rsi
shrq $0xe, %rsi
movl 0x28(%rsp), %r10d
andl $0xa, %r10d
movl %edx, %ecx
movl %esi, %eax
movl %r10d, 0x28(%rsp)
cmpl $0x8, %r10d
je 0x34037
movslq 0x328897(%rip), %r10    # 0x35c8b8
movslq %edx, %rcx
imulq %r10, %rcx
shrq $0x10, %rcx
movslq %esi, %rax
imulq %r10, %rax
shrq $0x10, %rax
movl %r15d, %r10d
imull %esi, %r10d
movl 0x20(%rsp), %ebx
imull %edx, %ebx
addl %r10d, %ebx
subl %ebx, %r12d
movl %r12d, 0x581aae(%rip)   # 0x5b5b00
imull %r8d, %esi
addl %r12d, %esi
movl %esi, 0x581aa5(%rip)    # 0x5b5b04
imull %r13d, %edx
leal (%r12,%rdx), %r10d
movl %r10d, 0x581a9e(%rip)   # 0x5b5b0c
addl %esi, %edx
movl %edx, 0x581a92(%rip)    # 0x5b5b08
shll $0x10, %r14d
cmpl %r14d, %r12d
jge 0x34092
cmpl %r14d, %esi
jge 0x34092
cmpl %r14d, %edx
jge 0x34092
cmpl %r14d, %r10d
jl 0x34719
shll $0x10, %r9d
cmpl %r9d, %r12d
jle 0x340ae
cmpl %r9d, %esi
jle 0x340ae
cmpl %r9d, %edx
jle 0x340ae
cmpl %r9d, %r10d
jg 0x34719
imull %ecx, %r15d
movl 0x20(%rsp), %esi
imull %eax, %esi
subl %r15d, %esi
addl %edi, %esi
movl %esi, 0x581a5c(%rip)    # 0x5b5b20
imull %ecx, %r8d
addl %esi, %r8d
movl %r8d, 0x581a52(%rip)    # 0x5b5b24
imull 0x8(%rsp), %eax
movl %esi, %ecx
subl %eax, %ecx
movl %ecx, 0x581a4b(%rip)    # 0x5b5b2c
movl %r8d, %edx
subl %eax, %edx
movl %edx, 0x581a3c(%rip)    # 0x5b5b28
shll $0x10, %r11d
movl %esi, 0x20(%rsp)
cmpl %r11d, %esi
jge 0x3410c
cmpl %r11d, %r8d
jge 0x3410c
cmpl %r11d, %edx
jge 0x3410c
cmpl %r11d, %ecx
jl 0x34719
shll $0x10, %ebp
cmpl %ebp, 0x20(%rsp)
jle 0x34126
cmpl %ebp, %r8d
jle 0x34126
cmpl %ebp, %edx
jle 0x34126
cmpl %ebp, %ecx
jg 0x34719
addl $0x10000, %ebp          # imm = 0x10000
xorl %r10d, %r10d
leaq 0x5819ea(%rip), %r8     # 0x5b5b20
leaq 0x581a23(%rip), %rsi    # 0x5b5b60
xorl %edi, %edi
movl %r10d, %r15d
movslq (%r8,%r15,4), %r13
cmpl %r11d, %r13d
jl 0x3416e
cmpl %ebp, %r13d
jg 0x3416e
movslq %edi, %rdi
leaq 0x5819e6(%rip), %rax    # 0x5b5b40
movl %r13d, (%rax,%rdi,4)
leaq 0x58199b(%rip), %rax    # 0x5b5b00
movl (%rax,%r15,4), %eax
movl %eax, (%rsi,%rdi,4)
incl %edi
incl %r10d
andl $0x3, %r10d
movslq (%r8,%r10,4), %rcx
subq %r13, %rcx
testl %ecx, %ecx
movl %r11d, %edx
cmovlel %ebp, %edx
movl %edx, %eax
subl %r13d, %eax
movl %eax, %ebx
subl %ecx, %ebx
xorl %eax, %ebx
jns 0x341c2
movslq %edi, %rdi
leaq 0x5819a5(%rip), %rbx    # 0x5b5b40
movl %edx, (%rbx,%rdi,4)
leaq 0x58195b(%rip), %rdx    # 0x5b5b00
movslq (%rdx,%r15,4), %rbx
movslq (%rdx,%r10,4), %rdx
subq %rbx, %rdx
cltq
imulq %rdx, %rax
cqto
idivq %rcx
addl %ebx, %eax
movl %eax, (%rsi,%rdi,4)
incl %edi
testl %ecx, %ecx
movl %ebp, %edx
cmovlel %r11d, %edx
movl %edx, %eax
subl %r13d, %eax
movl %eax, %ebx
subl %ecx, %ebx
xorl %eax, %ebx
jns 0x3420b
movslq %edi, %rdi
leaq 0x58195f(%rip), %rbx    # 0x5b5b40
movl %edx, (%rbx,%rdi,4)
leaq 0x581915(%rip), %rdx    # 0x5b5b00
movslq (%rdx,%r15,4), %rbx
movslq (%rdx,%r10,4), %rdx
subq %rbx, %rdx
cltq
imulq %rdx, %rax
movslq %ecx, %rcx
cqto
idivq %rcx
addl %ebx, %eax
movl %eax, (%rsi,%rdi,4)
incl %edi
testq %r10, %r10
jne 0x3413f
xorl %r10d, %r10d
cmpl $0x3, %edi
jl 0x34315
addl $0x10000, %r9d          # imm = 0x10000
xorl %ebp, %ebp
xorl %r10d, %r10d
movl %ebp, %eax
movslq %ebp, %r15
leal 0x1(%rax), %ebp
cmpl %edi, %ebp
movl $0x0, %eax
cmovel %eax, %ebp
movslq (%rsi,%r15,4), %r13
cmpl %r14d, %r13d
jl 0x3426c
cmpl %r9d, %r13d
jg 0x3426c
movslq %r10d, %r10
leaq 0x5818aa(%rip), %rax    # 0x5b5b00
movl %r13d, (%rax,%r10,4)
leaq 0x5818df(%rip), %rax    # 0x5b5b40
movl (%rax,%r15,4), %eax
movl %eax, (%r8,%r10,4)
incl %r10d
movslq %ebp, %r11
movslq (%rsi,%r11,4), %rcx
subq %r13, %rcx
testl %ecx, %ecx
movl %r14d, %edx
cmovlel %r9d, %edx
movl %edx, %eax
subl %r13d, %eax
movl %eax, %ebx
subl %ecx, %ebx
xorl %eax, %ebx
jns 0x342c0
movslq %r10d, %r10
leaq 0x58186a(%rip), %rbx    # 0x5b5b00
movl %edx, (%rbx,%r10,4)
leaq 0x58189f(%rip), %rdx    # 0x5b5b40
movslq (%rdx,%r15,4), %rbx
movslq (%rdx,%r11,4), %rdx
subq %rbx, %rdx
cltq
imulq %rdx, %rax
cqto
idivq %rcx
addl %ebx, %eax
movl %eax, (%r8,%r10,4)
incl %r10d
testl %ecx, %ecx
movl %r9d, %edx
cmovlel %r14d, %edx
movl %edx, %eax
subl %r13d, %eax
movl %eax, %ebx
subl %ecx, %ebx
xorl %eax, %ebx
jns 0x3430d
movslq %r10d, %r10
leaq 0x581820(%rip), %rbx    # 0x5b5b00
movl %edx, (%rbx,%r10,4)
leaq 0x581855(%rip), %rdx    # 0x5b5b40
movslq (%rdx,%r15,4), %rbx
movslq (%rdx,%r11,4), %rdx
subq %rbx, %rdx
cltq
imulq %rdx, %rax
movslq %ecx, %rcx
cqto
idivq %rcx
addl %ebx, %eax
movl %eax, (%r8,%r10,4)
incl %r10d
testl %ebp, %ebp
jne 0x3422c
cmpl $0x3, %r10d
jl 0x34719
movl 0x5817fa(%rip), %r13d   # 0x5b5b20
movl %r10d, %eax
decq %rax
xorl %r15d, %r15d
movl %r13d, %ebp
movl %r15d, %ecx
movq %rax, %r15
movl (%r8,%rax,4), %r10d
movl %r10d, %edi
sarl $0x10, %edi
cmpl %ebp, %r10d
cmovll %r10d, %ebp
movl (%r8,%rcx,4), %r14d
movl %r14d, %r11d
sarl $0x10, %r11d
cmpl %r13d, %r10d
cmovgl %r10d, %r13d
movl %edi, %esi
subl %r11d, %esi
je 0x343ee
movq %r8, %rbx
leaq 0x581790(%rip), %rax    # 0x5b5b00
movl (%rax,%r15,4), %r8d
movl (%rax,%rcx,4), %r9d
movl %r9d, %eax
subl %r8d, %eax
movl %r14d, %ecx
subl %r10d, %ecx
cltq
shlq $0x10, %rax
movslq %ecx, %rcx
cqto
idivq %rcx
movl %r11d, %edx
movslq %eax, %rcx
subl %edi, %edx
jle 0x343c3
notl %r10d
movzwl %r10w, %eax
imulq %rcx, %rax
shrq $0x10, %rax
addl %eax, %r8d
movslq %edi, %rax
leaq 0x41aab8(%rip), %rsi    # 0x44ee70
leaq (%rsi,%rax,2), %rdi
movl %edx, %esi
movl %r8d, %edx
jmp 0x343e6
notl %r14d
movzwl %r14w, %eax
imulq %rcx, %rax
shrq $0x10, %rax
addl %eax, %r9d
movslq %r11d, %rax
leaq 0x41c891(%rip), %rdx    # 0x450c70
leaq (%rdx,%rax,2), %rdi
movl %r9d, %edx
callq 0x4abaa
movq %rbx, %r8
leaq -0x1(%r15), %rax
leaq 0x1(%r15), %rcx
cmpq $0x1, %rcx
jg 0x34332
leaq 0x363ed9(%rip), %r10    # 0x3982e0
movq 0x30(%rsp), %rdx
cmpq $0x0, (%r10,%rdx,8)
movl 0x38(%rsp), %ebx
jne 0x3442a
movswl %bx, %edi
movq %r10, %r14
callq 0x2f106
movq %r14, %r10
movq 0x30(%rsp), %rdx
movswl %bx, %eax
leaq 0x3f930c(%rip), %rcx    # 0x42d740
cmpb $-0x39, (%rdx,%rcx)
ja 0x3443e
movb $-0x39, (%rdx,%rcx)
movl %eax, %ecx
andl $0x7, %ecx
leaq 0x6f356(%rip), %rdx     # 0xa37a0
movb (%rcx,%rdx), %cl
sarl $0x3, %eax
cltq
leaq 0x3f8e57(%rip), %rdx    # 0x42d2b0
orb %cl, (%rax,%rdx)
movzbl 0xf(%rsp), %ecx
movl 0x3c(%rsp), %esi
movzbl %sil, %eax
xorl %edx, %edx
testb %sil, %sil
cmovlel %edx, %eax
movzbl %al, %eax
movswl 0x3df3ad(%rip), %esi    # 0x413828
decl %esi
cmpl %esi, %eax
cmovll %eax, %esi
shll $0x8, %esi
movabsq $0x100000000, %rax      # imm = 0x100000000
xorl %edx, %edx
idivq 0x40(%rsp)
cltq
movq 0x18(%rsp), %rdx
imulq %rax, %rdx
shrq $0xe, %rdx
movq 0x10(%rsp), %r8
imulq %rax, %r8
shrq $0xe, %r8
cmpl $0x8, 0x28(%rsp)
movq %rdx, 0x18(%rsp)
jne 0x344ce
movl %edx, %r9d
negl %r9d
movl %r8d, %eax
movq %rax, 0x28(%rsp)
jmp 0x344f2
movslq 0x3d2b13(%rip), %rax    # 0x406fe8
negl %edx
movslq %edx, %r9
imulq %rax, %r9
shrq $0x10, %r9
movslq %r8d, %rdx
imulq %rax, %rdx
shrq $0x10, %rdx
movq %rdx, 0x28(%rsp)
leaq 0x3635e7(%rip), %rax    # 0x397ae0
movslq %esi, %rdi
movl %ebp, %edx
andl $0xffff0000, %edx       # imm = 0xFFFF0000
movl 0x20(%rsp), %esi
notl %esi
addl %edx, %esi
movl $0xffff, %edx           # imm = 0xFFFF
subl %r12d, %edx
movslq %esi, %r14
movslq %edx, %r15
movslq %r9d, %rdx
imulq %r14, %rdx
movslq %r8d, %rbx
imulq %r15, %rbx
addq %rdx, %rbx
shrq $0x10, %rbx
testb $0x4, 0x7(%rsp)
jne 0x3453d
movq %r8, 0x10(%rsp)
jmp 0x34553
negl %r8d
movq %r8, 0x10(%rsp)
negl %r9d
movl 0x8(%rsp), %edx
shll $0x10, %edx
notl %ebx
addl %edx, %ebx
movq 0x30(%rsp), %rdx
movq %r9, 0x20(%rsp)
addq (%rax,%rcx,8), %rdi
movq (%r10,%rdx,8), %rax
movq %rax, 0x30(%rsp)
sarl $0x10, %ebp
sarl $0x10, %r13d
movb 0x7(%rsp), %r12b
testb $0x1, %r12b
jne 0x34597
testb $0x40, %r12b
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rsi
jne 0x345b7
movl 0x8(%rsp), %ecx
callq 0x6e269
jmp 0x345c7
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdx
movl 0x8(%rsp), %ecx
callq 0x6e2f6
testb $0x20, %r12b
jne 0x345c2
callq 0x6dccb
jmp 0x345c7
movl 0x8(%rsp), %ecx
callq 0x6e1e3
jmp 0x345c7
callq 0x6dcd3
cmpl %r13d, %ebp
movq 0x20(%rsp), %rdi
jge 0x34719
movslq 0x28(%rsp), %rax
movslq 0x18(%rsp), %r12
imulq %r14, %rax
imulq %r15, %r12
addq %rax, %r12
shrq $0x10, %r12
movslq %ebp, %rbp
movslq %r13d, %r13
leaq (,%rbp,2), %r15
xorl %r14d, %r14d
leaq 0x41a86a(%rip), %rax    # 0x44ee70
movzwl (%r15,%rax), %ecx
leaq 0x41c65e(%rip), %rax    # 0x450c70
movzwl (%r15,%rax), %eax
testb $0x8, 0x7(%rsp)
jne 0x34646
leaq 0x39a94b(%rip), %rdx    # 0x3cef70
movzwl (%r15,%rdx), %edx
cmpw %cx, %dx
cmovlel %ecx, %edx
leaq 0x39c749(%rip), %rcx    # 0x3d0d80
movzwl (%r15,%rcx), %esi
cmpw %ax, %si
cmovgel %eax, %esi
movl %edx, %ecx
movl %esi, %eax
addl 0x28(%rsp), %r12d
addl %edi, %ebx
cmpw %ax, %cx
jge 0x34709
movswl %cx, %ecx
movl %ecx, %edx
subl %r14d, %edx
cmpl $0x1, %edx
je 0x34677
testl %edx, %edx
je 0x34696
cmpl $-0x1, %edx
jne 0x34682
subl 0x18(%rsp), %r12d
subl 0x10(%rsp), %ebx
jmp 0x34693
addl 0x18(%rsp), %r12d
addl 0x10(%rsp), %ebx
jmp 0x34693
movl %edx, %esi
imull 0x18(%rsp), %esi
addl %esi, %r12d
imull 0x10(%rsp), %edx
addl %edx, %ebx
movl %ecx, %r14d
movswl %ax, %edx
movslq %ecx, %rax
leaq 0x3e15fd(%rip), %rsi    # 0x415ca0
movslq (%rsi,%rax,4), %r8
leaq 0x148a02(%rip), %rax    # 0x17d0b0
addq (%rax), %r8
addq %rbp, %r8
movl %r12d, %edi
movl $0xffff, %eax           # imm = 0xFFFF
andl %eax, %edi
movl %ebx, %esi
andl %eax, %esi
subl %ecx, %edx
incl %edx
movl %r12d, %eax
sarl $0x10, %eax
imull 0x8(%rsp), %eax
movl %ebx, %ecx
sarl $0x10, %ecx
addl %eax, %ecx
movslq %ecx, %rcx
addq 0x30(%rsp), %rcx
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x346f3
testb $0x40, %al
jne 0x346fa
callq 0x6e283
jmp 0x346ff
callq 0x6e310
jmp 0x346ff
callq 0x6e1fd
callq 0xab51
movq 0x20(%rsp), %rdi
incq %rbp
addq $0x2, %r15
cmpq %rbp, %r13
jne 0x345ff
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq