// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: clippoly
static int clippoly(int npoints, int clipstat)
{
	int z, zz, s1, s2, t, npoints2, start2, z1, z2, z3, z4, splitcnt;
	int cx1, cy1, cx2, cy2;

	cx1 = windowx1;
	cy1 = windowy1;
	cx2 = windowx2+1;
	cy2 = windowy2+1;
	cx1 <<= 12; cy1 <<= 12; cx2 <<= 12; cy2 <<= 12;

	if (clipstat&0xa)   //Need to clip top or left
	{
		npoints2 = 0; start2 = 0; z = 0; splitcnt = 0;
		do
		{
			s2 = cx1-rx1[z];
			do
			{
				zz = xb1[z]; xb1[z] = -1;
				s1 = s2; s2 = cx1-rx1[zz];
				if (s1 < 0)
				{
					rx2[npoints2] = rx1[z]; ry2[npoints2] = ry1[z];
					xb2[npoints2] = npoints2+1; npoints2++;
				}
				if ((s1^s2) < 0)
				{
					rx2[npoints2] = rx1[z]+scale(rx1[zz]-rx1[z],s1,s1-s2);
					ry2[npoints2] = ry1[z]+scale(ry1[zz]-ry1[z],s1,s1-s2);
					if (s1 < 0) p2[splitcnt++] = npoints2;
					xb2[npoints2] = npoints2+1;
					npoints2++;
				}
				z = zz;
			} while (xb1[z] >= 0);

			if (npoints2 >= start2+3)
				xb2[npoints2-1] = start2, start2 = npoints2;
			else
				npoints2 = start2;

			z = 1;
			while ((z < npoints) && (xb1[z] < 0)) z++;
		} while (z < npoints);
		if (npoints2 <= 2) return(0);

		for(z=1;z<splitcnt;z++)
			for(zz=0;zz<z;zz++)
			{
				z1 = p2[z]; z2 = xb2[z1]; z3 = p2[zz]; z4 = xb2[z3];
				s1  = klabs(rx2[z1]-rx2[z2])+klabs(ry2[z1]-ry2[z2]);
				s1 += klabs(rx2[z3]-rx2[z4])+klabs(ry2[z3]-ry2[z4]);
				s2  = klabs(rx2[z1]-rx2[z4])+klabs(ry2[z1]-ry2[z4]);
				s2 += klabs(rx2[z3]-rx2[z2])+klabs(ry2[z3]-ry2[z2]);
				if (s2 < s1)
					{ t = xb2[p2[z]]; xb2[p2[z]] = xb2[p2[zz]]; xb2[p2[zz]] = t; }
			}


		npoints = 0; start2 = 0; z = 0; splitcnt = 0;
		do
		{
			s2 = cy1-ry2[z];
			do
			{
				zz = xb2[z]; xb2[z] = -1;
				s1 = s2; s2 = cy1-ry2[zz];
				if (s1 < 0)
				{
					rx1[npoints] = rx2[z]; ry1[npoints] = ry2[z];
					xb1[npoints] = npoints+1; npoints++;
				}
				if ((s1^s2) < 0)
				{
					rx1[npoints] = rx2[z]+scale(rx2[zz]-rx2[z],s1,s1-s2);
					ry1[npoints] = ry2[z]+scale(ry2[zz]-ry2[z],s1,s1-s2);
					if (s1 < 0) p2[splitcnt++] = npoints;
					xb1[npoints] = npoints+1;
					npoints++;
				}
				z = zz;
			} while (xb2[z] >= 0);

			if (npoints >= start2+3)
				xb1[npoints-1] = start2, start2 = npoints;
			else
				npoints = start2;

			z = 1;
			while ((z < npoints2) && (xb2[z] < 0)) z++;
		} while (z < npoints2);
		if (npoints <= 2) return(0);

		for(z=1;z<splitcnt;z++)
			for(zz=0;zz<z;zz++)
			{
				z1 = p2[z]; z2 = xb1[z1]; z3 = p2[zz]; z4 = xb1[z3];
				s1  = klabs(rx1[z1]-rx1[z2])+klabs(ry1[z1]-ry1[z2]);
				s1 += klabs(rx1[z3]-rx1[z4])+klabs(ry1[z3]-ry1[z4]);
				s2  = klabs(rx1[z1]-rx1[z4])+klabs(ry1[z1]-ry1[z4]);
				s2 += klabs(rx1[z3]-rx1[z2])+klabs(ry1[z3]-ry1[z2]);
				if (s2 < s1)
					{ t = xb1[p2[z]]; xb1[p2[z]] = xb1[p2[zz]]; xb1[p2[zz]] = t; }
			}
	}
	if (clipstat&0x5)   //Need to clip bottom or right
	{
		npoints2 = 0; start2 = 0; z = 0; splitcnt = 0;
		do
		{
			s2 = rx1[z]-cx2;
			do
			{
				zz = xb1[z]; xb1[z] = -1;
				s1 = s2; s2 = rx1[zz]-cx2;
				if (s1 < 0)
				{
					rx2[npoints2] = rx1[z]; ry2[npoints2] = ry1[z];
					xb2[npoints2] = npoints2+1; npoints2++;
				}
				if ((s1^s2) < 0)
				{
					rx2[npoints2] = rx1[z]+scale(rx1[zz]-rx1[z],s1,s1-s2);
					ry2[npoints2] = ry1[z]+scale(ry1[zz]-ry1[z],s1,s1-s2);
					if (s1 < 0) p2[splitcnt++] = npoints2;
					xb2[npoints2] = npoints2+1;
					npoints2++;
				}
				z = zz;
			} while (xb1[z] >= 0);

			if (npoints2 >= start2+3)
				xb2[npoints2-1] = start2, start2 = npoints2;
			else
				npoints2 = start2;

			z = 1;
			while ((z < npoints) && (xb1[z] < 0)) z++;
		} while (z < npoints);
		if (npoints2 <= 2) return(0);

		for(z=1;z<splitcnt;z++)
			for(zz=0;zz<z;zz++)
			{
				z1 = p2[z]; z2 = xb2[z1]; z3 = p2[zz]; z4 = xb2[z3];
				s1  = klabs(rx2[z1]-rx2[z2])+klabs(ry2[z1]-ry2[z2]);
				s1 += klabs(rx2[z3]-rx2[z4])+klabs(ry2[z3]-ry2[z4]);
				s2  = klabs(rx2[z1]-rx2[z4])+klabs(ry2[z1]-ry2[z4]);
				s2 += klabs(rx2[z3]-rx2[z2])+klabs(ry2[z3]-ry2[z2]);
				if (s2 < s1)
					{ t = xb2[p2[z]]; xb2[p2[z]] = xb2[p2[zz]]; xb2[p2[zz]] = t; }
			}


		npoints = 0; start2 = 0; z = 0; splitcnt = 0;
		do
		{
			s2 = ry2[z]-cy2;
			do
			{
				zz = xb2[z]; xb2[z] = -1;
				s1 = s2; s2 = ry2[zz]-cy2;
				if (s1 < 0)
				{
					rx1[npoints] = rx2[z]; ry1[npoints] = ry2[z];
					xb1[npoints] = npoints+1; npoints++;
				}
				if ((s1^s2) < 0)
				{
					rx1[npoints] = rx2[z]+scale(rx2[zz]-rx2[z],s1,s1-s2);
					ry1[npoints] = ry2[z]+scale(ry2[zz]-ry2[z],s1,s1-s2);
					if (s1 < 0) p2[splitcnt++] = npoints;
					xb1[npoints] = npoints+1;
					npoints++;
				}
				z = zz;
			} while (xb2[z] >= 0);

			if (npoints >= start2+3)
				xb1[npoints-1] = start2, start2 = npoints;
			else
				npoints = start2;

			z = 1;
			while ((z < npoints2) && (xb2[z] < 0)) z++;
		} while (z < npoints2);
		if (npoints <= 2) return(0);

		for(z=1;z<splitcnt;z++)
			for(zz=0;zz<z;zz++)
			{
				z1 = p2[z]; z2 = xb1[z1]; z3 = p2[zz]; z4 = xb1[z3];
				s1  = klabs(rx1[z1]-rx1[z2])+klabs(ry1[z1]-ry1[z2]);
				s1 += klabs(rx1[z3]-rx1[z4])+klabs(ry1[z3]-ry1[z4]);
				s2  = klabs(rx1[z1]-rx1[z4])+klabs(ry1[z1]-ry1[z4]);
				s2 += klabs(rx1[z3]-rx1[z2])+klabs(ry1[z3]-ry1[z2]);
				if (s2 < s1)
					{ t = xb1[p2[z]]; xb1[p2[z]] = xb1[p2[zz]]; xb1[p2[zz]] = t; }
			}
	}
	return(npoints);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edi, %r10d
movl 0x3d8f9d(%rip), %r12d   # 0x407fe0
movl 0x3d8f9b(%rip), %eax    # 0x407fe4
movl %eax, -0x20(%rsp)
testb $0xa, %sil
je 0x2f669
movl %r12d, -0x40(%rsp)
movl %esi, -0x14(%rsp)
movl 0x3a2d0a(%rip), %edi    # 0x3d1d70
movl 0x3a4b14(%rip), %eax    # 0x3d3b80
shll $0xc, %edi
shll $0xc, %eax
movl %eax, -0x38(%rsp)
movq %r10, -0x60(%rsp)
movl %r10d, %eax
movq %rax, -0x68(%rsp)
xorl %r9d, %r9d
leaq 0x3d8f73(%rip), %rdx    # 0x408000
leaq 0x23c9dc(%rip), %r11    # 0x26ba70
leaq 0x2409e5(%rip), %r13    # 0x26fa80
xorl %ecx, %ecx
xorl %r12d, %r12d
movl %r9d, %eax
movl %edi, %r8d
subl (%rdx,%rax,4), %r8d
movslq %r9d, %rax
movl (%r11,%rax,4), %eax
movq %rcx, -0x10(%rsp)
movl %ecx, %ebp
movslq %r9d, %r10
movl %eax, %r9d
movl $0xffffffff, (%r11,%r10,4) # imm = 0xFFFFFFFF
testl %r8d, %r8d
jns 0x2f0f9
movl (%rdx,%r10,4), %eax
movslq %ebp, %rcx
leaq 0x46ce37(%rip), %rsi    # 0x49bf10
movl %eax, (%rsi,%rcx,4)
leaq 0x3dcf1d(%rip), %rax    # 0x40c000
movl (%rax,%r10,4), %eax
leaq 0x470e22(%rip), %rsi    # 0x49ff10
movl %eax, (%rsi,%rcx,4)
leal 0x1(%rcx), %ebp
movl %ebp, (%r13,%rcx,4)
movslq %r9d, %r14
movl (%rdx,%r14,4), %eax
movl %edi, %esi
subl %eax, %esi
movl %esi, %ecx
xorl %r8d, %ecx
jns 0x2f193
movl (%rdx,%r10,4), %r11d
subl %r11d, %eax
movl %r8d, %ecx
subl %esi, %ecx
cltq
movslq %r8d, %rbx
imulq %rbx, %rax
movslq %ecx, %r15
cqto
idivq %r15
movq %rax, %rcx
addl %r11d, %ecx
leaq 0x3dcec7(%rip), %rax    # 0x40c000
movslq (%rax,%r10,4), %r10
movslq (%rax,%r14,4), %rax
subq %r10, %rax
imulq %rbx, %rax
cqto
idivq %r15
addl %r10d, %eax
movslq %ebp, %rdx
leaq 0x46cdb6(%rip), %r10    # 0x49bf10
movl %ecx, (%r10,%rdx,4)
leaq 0x470dab(%rip), %rcx    # 0x49ff10
movl %eax, (%rcx,%rdx,4)
testl %r8d, %r8d
jns 0x2f17e
movslq %r12d, %rax
incl %r12d
leaq 0x3b0656(%rip), %rcx    # 0x3df7d0
movw %bp, (%rcx,%rax,2)
leaq 0x23c8eb(%rip), %r11    # 0x26ba70
incl %ebp
movl %ebp, (%r13,%rdx,4)
leaq 0x3d8e6d(%rip), %rdx    # 0x408000
movl (%r11,%r14,4), %eax
movl %esi, %r8d
testl %eax, %eax
jns 0x2f0b8
movq -0x10(%rsp), %rcx
leal 0x3(%rcx), %eax
cmpl %eax, %ebp
jl 0x2f1b8
leal -0x1(%rbp), %eax
movl %ecx, (%r13,%rax,4)
movl %ebp, %ecx
movq -0x68(%rsp), %rax
cmpl $0x2, -0x60(%rsp)
jl 0x2f1dd
movl $0x1, %r9d
cmpl $0x0, (%r11,%r9,4)
jns 0x2f0a0
incq %r9
cmpq %r9, %rax
jne 0x2f1ca
cmpl $0x3, %ecx
jl 0x2fae7
movq %rcx, -0x10(%rsp)
cmpl $0x2, %r12d
jl 0x2f357
movl %r12d, %eax
movq %rax, -0x8(%rsp)
movl $0x1, %ecx
movl $0x2, %eax
movq %rax, -0x50(%rsp)
leaq 0x3b05bd(%rip), %rax    # 0x3df7d0
movq %rcx, -0x60(%rsp)
movswq (%rax,%rcx,2), %rcx
leaq 0x46ccec(%rip), %rax    # 0x49bf10
movl (%rax,%rcx,4), %eax
movl %eax, -0x54(%rsp)
leaq 0x470cde(%rip), %rax    # 0x49ff10
movq %rcx, -0x48(%rsp)
movl (%rax,%rcx,4), %eax
movl %eax, -0x58(%rsp)
xorl %r9d, %r9d
movq -0x48(%rsp), %rax
movslq (%r13,%rax,4), %rdi
leaq 0x3b057e(%rip), %rax    # 0x3df7d0
movswq (%r9,%rax), %r10
movslq (%r13,%r10,4), %rax
leaq 0x46ccad(%rip), %rdx    # 0x49bf10
movl (%rdx,%rdi,4), %esi
movl %esi, -0x68(%rsp)
movl -0x54(%rsp), %ebp
movl %ebp, %ecx
subl %esi, %ecx
movl %ecx, %r12d
negl %r12d
cmovsl %ecx, %r12d
leaq 0x470c8d(%rip), %rsi    # 0x49ff10
movq %rdi, -0x28(%rsp)
movl (%rsi,%rdi,4), %r11d
movl -0x58(%rsp), %r14d
movl %r14d, %ecx
subl %r11d, %ecx
movl %ecx, %ebx
negl %ebx
cmovsl %ecx, %ebx
movl (%rdx,%r10,4), %ecx
movl (%rdx,%rax,4), %r13d
movl %ecx, %r15d
subl %r13d, %r15d
movl %r15d, %edx
negl %edx
cmovsl %r15d, %edx
movl (%rsi,%r10,4), %r8d
movq %rax, -0x30(%rsp)
movl (%rsi,%rax,4), %esi
movl %r8d, %edi
subl %esi, %edi
movl %edi, %r15d
negl %r15d
cmovsl %edi, %r15d
addl %r12d, %ebx
addl %edx, %ebx
addl %r15d, %ebx
subl %r13d, %ebp
leaq 0x24079e(%rip), %r13    # 0x26fa80
movl %ebp, %edi
negl %edi
cmovsl %ebp, %edi
subl %esi, %r14d
movl %r14d, %esi
negl %esi
cmovsl %r14d, %esi
subl -0x68(%rsp), %ecx
movl %ecx, %edx
negl %edx
cmovsl %ecx, %edx
subl %r11d, %r8d
movl %r8d, %ecx
negl %ecx
cmovsl %r8d, %ecx
addl %edx, %ecx
addl %edi, %ecx
addl %esi, %ecx
cmpl %ebx, %ecx
jae 0x2f32f
movq -0x48(%rsp), %rcx
movq -0x30(%rsp), %rdx
movl %edx, (%r13,%rcx,4)
movq -0x28(%rsp), %rcx
movl %ecx, (%r13,%r10,4)
addq $0x2, %r9
cmpq %r9, -0x50(%rsp)
jne 0x2f241
movq -0x60(%rsp), %rcx
incq %rcx
addq $0x2, -0x50(%rsp)
cmpq -0x8(%rsp), %rcx
jne 0x2f20c
movl -0x10(%rsp), %edi
xorl %r10d, %r10d
xorl %r8d, %r8d
movl $0x0, -0x68(%rsp)
movl -0x40(%rsp), %r12d
leaq 0x3d8c8b(%rip), %rbx    # 0x408000
leaq 0x470b94(%rip), %rdx    # 0x49ff10
movl %r8d, %eax
movl -0x38(%rsp), %ebp
subl (%rdx,%rax,4), %ebp
movslq %r8d, %rax
movl (%r13,%rax,4), %eax
movq %r10, -0x60(%rsp)
movl %r10d, %r9d
movslq %r8d, %r10
movl %eax, %r8d
movl $0xffffffff, (%r13,%r10,4) # imm = 0xFFFFFFFF
testl %ebp, %ebp
jns 0x2f3de
leaq 0x46cb60(%rip), %rax    # 0x49bf10
movl (%rax,%r10,4), %eax
movslq %r9d, %rcx
movl %eax, (%rbx,%rcx,4)
movl (%rdx,%r10,4), %eax
leaq 0x3dcc3b(%rip), %rdx    # 0x40c000
movl %eax, (%rdx,%rcx,4)
leaq 0x470b41(%rip), %rdx    # 0x49ff10
leal 0x1(%rcx), %r9d
leaq 0x23c696(%rip), %rax    # 0x26ba70
movl %r9d, (%rax,%rcx,4)
movslq %r8d, %r14
movl (%rdx,%r14,4), %r11d
movl -0x38(%rsp), %esi
subl %r11d, %esi
movl %esi, %eax
xorl %ebp, %eax
jns 0x2f48f
leaq 0x46cb13(%rip), %rax    # 0x49bf10
movslq (%rax,%r10,4), %rbx
movslq (%rax,%r14,4), %rax
subq %rbx, %rax
movl %ebp, %ecx
subl %esi, %ecx
movslq %ebp, %r15
imulq %r15, %rax
movslq %ecx, %r12
movq %rdx, %r13
cqto
idivq %r12
movq %rax, %rcx
addl %ebx, %ecx
movl (%r13,%r10,4), %r10d
subl %r10d, %r11d
movslq %r11d, %rax
imulq %r15, %rax
leaq 0x3d8bc7(%rip), %rbx    # 0x408000
cqto
idivq %r12
addl %r10d, %eax
movslq %r9d, %rdx
movl %ecx, (%rbx,%rdx,4)
leaq 0x3dcbb2(%rip), %rcx    # 0x40c000
movl %eax, (%rcx,%rdx,4)
testl %ebp, %ebp
jns 0x2f46e
movl -0x68(%rsp), %ecx
movslq %ecx, %rax
incl %ecx
movl %ecx, -0x68(%rsp)
leaq 0x3b0367(%rip), %rcx    # 0x3df7d0
movw %r9w, (%rcx,%rax,2)
movl -0x40(%rsp), %r12d
leaq 0x240606(%rip), %r13    # 0x26fa80
incl %r9d
leaq 0x23c5ec(%rip), %rax    # 0x26ba70
movl %r9d, (%rax,%rdx,4)
leaq 0x470a81(%rip), %rdx    # 0x49ff10
movl (%r13,%r14,4), %eax
movl %esi, %ebp
testl %eax, %eax
jns 0x2f396
movq -0x60(%rsp), %r10
leal 0x3(%r10), %eax
cmpl %eax, %r9d
jl 0x2f4be
leal -0x1(%r9), %eax
leaq 0x23c5b9(%rip), %rcx    # 0x26ba70
movl %r10d, (%rcx,%rax,4)
movl %r9d, %r10d
movl $0x1, %r8d
cmpl $0x0, (%r13,%r8,4)
jns 0x2f37c
incq %r8
cmpq %r8, %rdi
jne 0x2f4c4
cmpl $0x3, %r10d
jl 0x2fae7
movl -0x68(%rsp), %eax
cmpl $0x2, %eax
jl 0x2f665
movq %r10, -0x60(%rsp)
movl %eax, %eax
movq %rax, -0x8(%rsp)
movl $0x1, %ecx
movl $0x2, %eax
movq %rax, -0x50(%rsp)
leaq 0x3b02bf(%rip), %rax    # 0x3df7d0
movq %rcx, -0x38(%rsp)
movswq (%rax,%rcx,2), %rcx
movl (%rbx,%rcx,4), %eax
movl %eax, -0x54(%rsp)
leaq 0x3dcad7(%rip), %rax    # 0x40c000
movq %rcx, -0x48(%rsp)
movl (%rax,%rcx,4), %eax
movl %eax, -0x58(%rsp)
xorl %r9d, %r9d
leaq 0x23c531(%rip), %rax    # 0x26ba70
movq -0x48(%rsp), %rcx
movslq (%rax,%rcx,4), %rdi
leaq 0x3b0281(%rip), %rcx    # 0x3df7d0
movswq (%r9,%rcx), %r10
movslq (%rax,%r10,4), %r12
leaq 0x3d8aa1(%rip), %rcx    # 0x408000
movl (%rcx,%rdi,4), %eax
movl %eax, -0x68(%rsp)
movl -0x54(%rsp), %r15d
movl %r15d, %r11d
subl %eax, %r11d
movl %r11d, %eax
negl %eax
cmovsl %r11d, %eax
leaq 0x3dca7f(%rip), %rsi    # 0x40c000
movq %rdi, -0x28(%rsp)
movl (%rsi,%rdi,4), %r11d
movl -0x58(%rsp), %r14d
movl %r14d, %ebp
subl %r11d, %ebp
movl %ebp, %ebx
negl %ebx
cmovsl %ebp, %ebx
movl (%rcx,%r10,4), %ebp
movl (%rcx,%r12,4), %ecx
movl %ebp, %r13d
subl %ecx, %r13d
movl %r13d, %edx
negl %edx
cmovsl %r13d, %edx
movl (%rsi,%r10,4), %r8d
movq %r12, -0x30(%rsp)
movl (%rsi,%r12,4), %esi
movl %r8d, %edi
subl %esi, %edi
movl %edi, %r13d
negl %r13d
cmovsl %edi, %r13d
addl %eax, %ebx
addl %edx, %ebx
addl %r13d, %ebx
subl %ecx, %r15d
movl %r15d, %ecx
negl %ecx
cmovsl %r15d, %ecx
subl %esi, %r14d
movl %r14d, %edx
negl %edx
cmovsl %r14d, %edx
subl -0x68(%rsp), %ebp
movl %ebp, %eax
negl %eax
cmovsl %ebp, %eax
subl %r11d, %r8d
movl %r8d, %esi
negl %esi
cmovsl %r8d, %esi
addl %eax, %esi
addl %ecx, %esi
addl %edx, %esi
cmpl %ebx, %esi
leaq 0x23c45c(%rip), %rax    # 0x26ba70
jae 0x2f62c
movq -0x48(%rsp), %rcx
movq -0x30(%rsp), %rdx
movl %edx, (%rax,%rcx,4)
movq -0x28(%rsp), %rcx
movl %ecx, (%rax,%r10,4)
addq $0x2, %r9
cmpq %r9, -0x50(%rsp)
jne 0x2f53f
movq -0x38(%rsp), %rcx
incq %rcx
addq $0x2, -0x50(%rsp)
cmpq -0x8(%rsp), %rcx
leaq 0x3d89ab(%rip), %rbx    # 0x408000
jne 0x2f50a
movq -0x60(%rsp), %r10
movl -0x40(%rsp), %r12d
movl -0x14(%rsp), %esi
testb $0x5, %sil
je 0x2faea
shll $0xc, %r12d
movl $0x1000, %eax           # imm = 0x1000
addl %eax, %r12d
movl -0x20(%rsp), %ecx
shll $0xc, %ecx
addl %eax, %ecx
movl %ecx, -0x20(%rsp)
movq %r10, -0x60(%rsp)
movl %r10d, %edi
xorl %ebp, %ebp
leaq 0x3d8963(%rip), %rdx    # 0x408000
leaq 0x23c3cc(%rip), %r10    # 0x26ba70
leaq 0x2403d5(%rip), %r14    # 0x26fa80
xorl %ecx, %ecx
xorl %r15d, %r15d
movl %ebp, %eax
movl (%rdx,%rax,4), %r13d
subl %r12d, %r13d
movslq %ebp, %rax
movl (%r10,%rax,4), %eax
movq %rcx, -0x40(%rsp)
movl %ecx, %r9d
movslq %ebp, %rsi
movl %eax, %ebp
movl $0xffffffff, (%r10,%rsi,4) # imm = 0xFFFFFFFF
testl %r13d, %r13d
jns 0x2f708
movl (%rdx,%rsi,4), %eax
movslq %r9d, %rcx
leaq 0x46c829(%rip), %r8     # 0x49bf10
movl %eax, (%r8,%rcx,4)
leaq 0x3dc90e(%rip), %rax    # 0x40c000
movl (%rax,%rsi,4), %eax
leaq 0x470814(%rip), %r8     # 0x49ff10
movl %eax, (%r8,%rcx,4)
leal 0x1(%rcx), %r9d
movl %r9d, (%r14,%rcx,4)
movslq %ebp, %rbx
movl (%rdx,%rbx,4), %eax
movl %eax, %r8d
subl %r12d, %r8d
movl %r8d, %ecx
xorl %r13d, %ecx
jns 0x2f7ab
movl (%rdx,%rsi,4), %r10d
subl %r10d, %eax
movl %r13d, %ecx
subl %r8d, %ecx
cltq
movslq %r13d, %r11
imulq %r11, %rax
movslq %ecx, %r14
cqto
idivq %r14
movq %rax, %rcx
addl %r10d, %ecx
leaq 0x3dc8b5(%rip), %rax    # 0x40c000
movslq (%rax,%rsi,4), %rsi
movslq (%rax,%rbx,4), %rax
subq %rsi, %rax
imulq %r11, %rax
cqto
idivq %r14
addl %esi, %eax
movslq %r9d, %rdx
leaq 0x46c7a5(%rip), %rsi    # 0x49bf10
movl %ecx, (%rsi,%rdx,4)
leaq 0x47079b(%rip), %rcx    # 0x49ff10
movl %eax, (%rcx,%rdx,4)
testl %r13d, %r13d
jns 0x2f78f
movslq %r15d, %rax
incl %r15d
leaq 0x3b0046(%rip), %rcx    # 0x3df7d0
movw %r9w, (%rcx,%rax,2)
leaq 0x23c2da(%rip), %r10    # 0x26ba70
leaq 0x2402e3(%rip), %r14    # 0x26fa80
incl %r9d
movl %r9d, (%r14,%rdx,4)
leaq 0x3d8855(%rip), %rdx    # 0x408000
movl (%r10,%rbx,4), %eax
movl %r8d, %r13d
testl %eax, %eax
jns 0x2f6c8
movq -0x40(%rsp), %rcx
leal 0x3(%rcx), %eax
cmpl %eax, %r9d
jl 0x2f7d2
leal -0x1(%r9), %eax
movl %ecx, (%r14,%rax,4)
movl %r9d, %ecx
movq -0x60(%rsp), %rax
cmpl $0x2, %eax
jl 0x2f7f4
movl $0x1, %ebp
cmpl $0x0, (%r10,%rbp,4)
jns 0x2f6b0
incq %rbp
cmpq %rbp, %rdi
jne 0x2f7e1
cmpl $0x3, %ecx
jl 0x2fae7
movq %rcx, -0x40(%rsp)
cmpl $0x2, %r15d
jl 0x2f970
movl %r15d, %eax
movq %rax, -0x60(%rsp)
movl $0x1, %ecx
movl $0x2, %eax
movq %rax, -0x50(%rsp)
leaq 0x3affa6(%rip), %rax    # 0x3df7d0
movq %rcx, -0x38(%rsp)
movswq (%rax,%rcx,2), %rcx
leaq 0x46c6d5(%rip), %rax    # 0x49bf10
movl (%rax,%rcx,4), %eax
movl %eax, -0x54(%rsp)
leaq 0x4706c7(%rip), %rax    # 0x49ff10
movq %rcx, -0x48(%rsp)
movl (%rax,%rcx,4), %eax
movl %eax, -0x58(%rsp)
xorl %r13d, %r13d
movq -0x48(%rsp), %rax
movslq (%r14,%rax,4), %r8
leaq 0x3aff68(%rip), %rax    # 0x3df7d0
movswq (%r13,%rax), %rsi
movslq (%r14,%rsi,4), %rax
leaq 0x46c697(%rip), %rdx    # 0x49bf10
movl (%rdx,%r8,4), %edi
movl %edi, -0x68(%rsp)
movl -0x54(%rsp), %ebp
movl %ebp, %ecx
subl %edi, %ecx
movl %ecx, %r15d
negl %r15d
cmovsl %ecx, %r15d
leaq 0x470676(%rip), %rdi    # 0x49ff10
movq %r8, -0x28(%rsp)
movl (%rdi,%r8,4), %r10d
movl -0x58(%rsp), %ebx
movl %ebx, %ecx
subl %r10d, %ecx
movl %ecx, %r11d
negl %r11d
cmovsl %ecx, %r11d
movl (%rdx,%rsi,4), %ecx
movl (%rdx,%rax,4), %r12d
movl %ecx, %r14d
subl %r12d, %r14d
movl %r14d, %edx
negl %edx
cmovsl %r14d, %edx
movl (%rdi,%rsi,4), %r9d
movq %rax, -0x30(%rsp)
movl (%rdi,%rax,4), %edi
movl %r9d, %r8d
subl %edi, %r8d
movl %r8d, %r14d
negl %r14d
cmovsl %r8d, %r14d
addl %r15d, %r11d
addl %edx, %r11d
addl %r14d, %r11d
leaq 0x240188(%rip), %r14    # 0x26fa80
subl %r12d, %ebp
movl %ebp, %r8d
negl %r8d
cmovsl %ebp, %r8d
subl %edi, %ebx
movl %ebx, %edi
negl %edi
cmovsl %ebx, %edi
subl -0x68(%rsp), %ecx
movl %ecx, %edx
negl %edx
cmovsl %ecx, %edx
subl %r10d, %r9d
movl %r9d, %ecx
negl %ecx
cmovsl %r9d, %ecx
addl %edx, %ecx
addl %r8d, %ecx
addl %edi, %ecx
cmpl %r11d, %ecx
jae 0x2f948
movq -0x48(%rsp), %rcx
movq -0x30(%rsp), %rdx
movl %edx, (%r14,%rcx,4)
movq -0x28(%rsp), %rcx
movl %ecx, (%r14,%rsi,4)
addq $0x2, %r13
cmpq %r13, -0x50(%rsp)
jne 0x2f858
movq -0x38(%rsp), %rcx
incq %rcx
addq $0x2, -0x50(%rsp)
cmpq -0x60(%rsp), %rcx
jne 0x2f823
movl -0x40(%rsp), %r8d
xorl %r13d, %r13d
xorl %r9d, %r9d
movl $0x0, -0x68(%rsp)
leaq 0x3d8676(%rip), %r11    # 0x408000
leaq 0x47057f(%rip), %r15    # 0x49ff10
movl %r9d, %eax
movl (%r15,%rax,4), %ebp
subl -0x20(%rsp), %ebp
movslq %r9d, %rax
movl (%r14,%rax,4), %eax
movq %r13, -0x60(%rsp)
movslq %r9d, %rsi
movl %eax, %r9d
movl $0xffffffff, (%r14,%rsi,4) # imm = 0xFFFFFFFF
testl %ebp, %ebp
jns 0x2f9e8
leaq 0x46c54f(%rip), %rax    # 0x49bf10
movl (%rax,%rsi,4), %eax
movslq %r13d, %rcx
movl %eax, (%r11,%rcx,4)
movl (%r15,%rsi,4), %eax
leaq 0x3dc62a(%rip), %rdx    # 0x40c000
movl %eax, (%rdx,%rcx,4)
leal 0x1(%rcx), %r13d
leaq 0x23c08c(%rip), %rax    # 0x26ba70
movl %r13d, (%rax,%rcx,4)
movslq %r9d, %rbx
movl (%r15,%rbx,4), %r10d
movl %r10d, %edi
subl -0x20(%rsp), %edi
movl %edi, %eax
xorl %ebp, %eax
jns 0x2fa94
leaq 0x46c509(%rip), %rax    # 0x49bf10
movslq (%rax,%rsi,4), %r11
movslq (%rax,%rbx,4), %rax
subq %r11, %rax
movl %ebp, %ecx
subl %edi, %ecx
movslq %ebp, %r14
imulq %r14, %rax
movq %r15, %r12
movslq %ecx, %r15
cqto
idivq %r15
movq %rax, %rcx
addl %r11d, %ecx
movl (%r12,%rsi,4), %esi
subl %esi, %r10d
movslq %r10d, %rax
imulq %r14, %rax
leaq 0x3d85bd(%rip), %r11    # 0x408000
cqto
idivq %r15
addl %esi, %eax
movslq %r13d, %rdx
movl %ecx, (%r11,%rdx,4)
leaq 0x3dc5a8(%rip), %rcx    # 0x40c000
movl %eax, (%rcx,%rdx,4)
testl %ebp, %ebp
jns 0x2fa78
movl -0x68(%rsp), %ecx
movslq %ecx, %rax
incl %ecx
movl %ecx, -0x68(%rsp)
leaq 0x3afd5d(%rip), %rcx    # 0x3df7d0
movw %r13w, (%rcx,%rax,2)
leaq 0x240001(%rip), %r14    # 0x26fa80
incl %r13d
leaq 0x23bfe7(%rip), %rax    # 0x26ba70
movl %r13d, (%rax,%rdx,4)
leaq 0x47047c(%rip), %r15    # 0x49ff10
movl (%r14,%rbx,4), %eax
movl %edi, %ebp
testl %eax, %eax
jns 0x2f9a8
movq -0x60(%rsp), %r10
leal 0x3(%r10), %eax
cmpl %eax, %r13d
jl 0x2fac2
leal -0x1(%r13), %eax
leaq 0x23bfb5(%rip), %rcx    # 0x26ba70
movl %r10d, (%rcx,%rax,4)
movl %r13d, %r10d
movl $0x1, %r9d
cmpl $0x0, (%r14,%r9,4)
jns 0x2fad9
incq %r9
cmpq %r9, %r8
jne 0x2fac8
jmp 0x2fae1
movq %r10, %r13
jmp 0x2f991
cmpl $0x3, %r10d
jge 0x2faf8
xorl %r10d, %r10d
movl %r10d, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl -0x68(%rsp), %eax
cmpl $0x2, %eax
jl 0x2faea
movq %r10, -0x60(%rsp)
movl %eax, %eax
movq %rax, -0x20(%rsp)
movl $0x1, %ecx
movl $0x2, %eax
movq %rax, -0x50(%rsp)
leaq 0x3afcad(%rip), %rax    # 0x3df7d0
movq %rcx, -0x38(%rsp)
movswq (%rax,%rcx,2), %rcx
movl (%r11,%rcx,4), %eax
movl %eax, -0x54(%rsp)
leaq 0x3dc4c4(%rip), %rax    # 0x40c000
movq %rcx, -0x68(%rsp)
movl (%rax,%rcx,4), %eax
movl %eax, -0x58(%rsp)
xorl %r14d, %r14d
leaq 0x23bf1e(%rip), %rax    # 0x26ba70
movq -0x68(%rsp), %rcx
movslq (%rax,%rcx,4), %r8
leaq 0x3afc6e(%rip), %rcx    # 0x3df7d0
movswq (%r14,%rcx), %r9
movslq (%rax,%r9,4), %r12
leaq 0x3d848e(%rip), %rcx    # 0x408000
movl (%rcx,%r8,4), %esi
movl -0x54(%rsp), %r15d
movl %r15d, %r10d
subl %esi, %r10d
movl %r10d, %eax
negl %eax
cmovsl %r10d, %eax
leaq 0x3dc46f(%rip), %rdi    # 0x40c000
movq %r8, -0x48(%rsp)
movl (%rdi,%r8,4), %r10d
movl -0x58(%rsp), %ebx
movl %ebx, %ebp
subl %r10d, %ebp
movl %ebp, %r11d
negl %r11d
cmovsl %ebp, %r11d
movl (%rcx,%r9,4), %ebp
movl (%rcx,%r12,4), %ecx
movl %ebp, %r13d
subl %ecx, %r13d
movl %r13d, %edx
negl %edx
cmovsl %r13d, %edx
movq %r9, -0x30(%rsp)
movl (%rdi,%r9,4), %r9d
movq %r12, -0x28(%rsp)
movl (%rdi,%r12,4), %edi
movl %r9d, %r8d
subl %edi, %r8d
movl %r8d, %r13d
negl %r13d
cmovsl %r8d, %r13d
addl %eax, %r11d
addl %edx, %r11d
addl %r13d, %r11d
subl %ecx, %r15d
movl %r15d, %ecx
negl %ecx
cmovsl %r15d, %ecx
subl %edi, %ebx
movl %ebx, %edx
negl %edx
cmovsl %ebx, %edx
subl %esi, %ebp
movl %ebp, %eax
negl %eax
cmovsl %ebp, %eax
subl %r10d, %r9d
movl %r9d, %esi
negl %esi
cmovsl %r9d, %esi
addl %eax, %esi
addl %ecx, %esi
addl %edx, %esi
cmpl %r11d, %esi
leaq 0x23be47(%rip), %rax    # 0x26ba70
jae 0x2fc45
movq -0x68(%rsp), %rcx
movq -0x28(%rsp), %rdx
movl %edx, (%rax,%rcx,4)
movq -0x48(%rsp), %rcx
movq -0x30(%rsp), %rdx
movl %ecx, (%rax,%rdx,4)
addq $0x2, %r14
cmpq %r14, -0x50(%rsp)
jne 0x2fb52
movq -0x38(%rsp), %rcx
incq %rcx
addq $0x2, -0x50(%rsp)
cmpq -0x20(%rsp), %rcx
leaq 0x3d8392(%rip), %r11    # 0x408000
jne 0x2fb1c
movq -0x60(%rsp), %r10
jmp 0x2faea