// File: /workspace/github_c_makefile_star2_O1/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: getzrange
void getzrange(int x, int y, int z, short sectnum,
		 int *ceilz, int *ceilhit, int *florz, int *florhit,
		 int walldist, unsigned int cliptype)
{
	sectortype *sec;
	walltype *wal, *wal2;
	spritetype *spr;
	int clipsectcnt, startwall, endwall, tilenum, xoff, yoff, dax, day;
	int xmin, ymin, xmax, ymax, i, j, k, l, daz, daz2, dx, dy;
	int x1, y1, x2, y2, x3, y3, x4, y4, ang, cosang, sinang;
	int xspan, yspan, xrepeat, yrepeat, dasprclipmask, dawalclipmask;
	short cstat;
	unsigned char clipyou;

	if (sectnum < 0)
	{
		*ceilz = 0x80000000; *ceilhit = -1;
		*florz = 0x7fffffff; *florhit = -1;
		return;
	}

		//Extra walldist for sprites on sector lines
	i = walldist+MAXCLIPDIST+1;
	xmin = x-i; ymin = y-i;
	xmax = x+i; ymax = y+i;

	getzsofslope(sectnum,x,y,ceilz,florz);
	*ceilhit = sectnum+16384; *florhit = sectnum+16384;

	dawalclipmask = (cliptype&65535);
	dasprclipmask = (cliptype>>16);

	clipsectorlist[0] = sectnum;
	clipsectcnt = 0; clipsectnum = 1;

	do  //Collect sectors inside your square first
	{
		sec = &sector[clipsectorlist[clipsectcnt]];
		startwall = sec->wallptr; endwall = startwall + sec->wallnum;
		for(j=startwall,wal=&wall[startwall];j<endwall;j++,wal++)
		{
			k = wal->nextsector;
			if (k >= 0)
			{
				wal2 = &wall[wal->point2];
				x1 = wal->x; x2 = wal2->x;
				if ((x1 < xmin) && (x2 < xmin)) continue;
				if ((x1 > xmax) && (x2 > xmax)) continue;
				y1 = wal->y; y2 = wal2->y;
				if ((y1 < ymin) && (y2 < ymin)) continue;
				if ((y1 > ymax) && (y2 > ymax)) continue;

				dx = x2-x1; dy = y2-y1;
				if (dx*(y-y1) < (x-x1)*dy) continue; //back
				if (dx > 0) dax = dx*(ymin-y1); else dax = dx*(ymax-y1);
				if (dy > 0) day = dy*(xmax-x1); else day = dy*(xmin-x1);
				if (dax >= day) continue;

				if (wal->cstat&dawalclipmask) continue;
				sec = &sector[k];
				if (editstatus == 0)
				{
					if (((sec->ceilingstat&1) == 0) && (z <= sec->ceilingz+(3<<8))) continue;
					if (((sec->floorstat&1) == 0) && (z >= sec->floorz-(3<<8))) continue;
				}

				for(i=clipsectnum-1;i>=0;i--) if (clipsectorlist[i] == k) break;
				if (i < 0) clipsectorlist[clipsectnum++] = k;

				if ((x1 < xmin+MAXCLIPDIST) && (x2 < xmin+MAXCLIPDIST)) continue;
				if ((x1 > xmax-MAXCLIPDIST) && (x2 > xmax-MAXCLIPDIST)) continue;
				if ((y1 < ymin+MAXCLIPDIST) && (y2 < ymin+MAXCLIPDIST)) continue;
				if ((y1 > ymax-MAXCLIPDIST) && (y2 > ymax-MAXCLIPDIST)) continue;
				if (dx > 0) dax += dx*MAXCLIPDIST; else dax -= dx*MAXCLIPDIST;
				if (dy > 0) day -= dy*MAXCLIPDIST; else day += dy*MAXCLIPDIST;
				if (dax >= day) continue;

					//It actually got here, through all the continue's!!!
				getzsofslope((short)k,x,y,&daz,&daz2);
				if (daz > *ceilz) { *ceilz = daz; *ceilhit = k+16384; }
				if (daz2 < *florz) { *florz = daz2; *florhit = k+16384; }
			}
		}
		clipsectcnt++;
	} while (clipsectcnt < clipsectnum);

	for(i=0;i<clipsectnum;i++)
	{
		for(j=headspritesect[clipsectorlist[i]];j>=0;j=nextspritesect[j])
		{
			spr = &sprite[j];
			cstat = spr->cstat;
			if (cstat&dasprclipmask)
			{
				x1 = spr->x; y1 = spr->y;

				clipyou = 0;
				switch(cstat&48)
				{
					case 0:
						k = walldist+(spr->clipdist<<2)+1;
						if ((klabs(x1-x) <= k) && (klabs(y1-y) <= k))
						{
							daz = spr->z;
							k = ((tilesizy[spr->picnum]*spr->yrepeat)<<1);
							if (cstat&128) daz += k;
							if (picanm[spr->picnum]&0x00ff0000) daz -= ((int)((signed char)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
							daz2 = daz - (k<<1);
							clipyou = 1;
						}
						break;
					case 16:
						tilenum = spr->picnum;
						xoff = (int)((signed char)((picanm[tilenum]>>8)&255))+((int)spr->xoffset);
						if ((cstat&4) > 0) xoff = -xoff;
						k = spr->ang; l = spr->xrepeat;
						dax = sintable[k&2047]*l; day = sintable[(k+1536)&2047]*l;
						l = tilesizx[tilenum]; k = (l>>1)+xoff;
						x1 -= mulscale16(dax,k); x2 = x1+mulscale16(dax,l);
						y1 -= mulscale16(day,k); y2 = y1+mulscale16(day,l);
						if (clipinsideboxline(x,y,x1,y1,x2,y2,walldist+1) != 0)
						{
							daz = spr->z; k = ((tilesizy[spr->picnum]*spr->yrepeat)<<1);
							if (cstat&128) daz += k;
							if (picanm[spr->picnum]&0x00ff0000) daz -= ((int)((signed char)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
							daz2 = daz-(k<<1);
							clipyou = 1;
						}
						break;
					case 32:
						daz = spr->z; daz2 = daz;

						if ((cstat&64) != 0)
							if ((z > daz) == ((cstat&8)==0)) continue;

						tilenum = spr->picnum;
						xoff = (int)((signed char)((picanm[tilenum]>>8)&255))+((int)spr->xoffset);
						yoff = (int)((signed char)((picanm[tilenum]>>16)&255))+((int)spr->yoffset);
						if ((cstat&4) > 0) xoff = -xoff;
						if ((cstat&8) > 0) yoff = -yoff;

						ang = spr->ang;
						cosang = sintable[(ang+512)&2047]; sinang = sintable[ang];
						xspan = tilesizx[tilenum]; xrepeat = spr->xrepeat;
						yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat;

						dax = ((xspan>>1)+xoff)*xrepeat; day = ((yspan>>1)+yoff)*yrepeat;
						x1 += dmulscale16(sinang,dax,cosang,day)-x;
						y1 += dmulscale16(sinang,day,-cosang,dax)-y;
						l = xspan*xrepeat;
						x2 = x1 - mulscale16(sinang,l);
						y2 = y1 + mulscale16(cosang,l);
						l = yspan*yrepeat;
						k = -mulscale16(cosang,l); x3 = x2+k; x4 = x1+k;
						k = -mulscale16(sinang,l); y3 = y2+k; y4 = y1+k;

						dax = mulscale14(sintable[(spr->ang-256+512)&2047],walldist+4);
						day = mulscale14(sintable[(spr->ang-256)&2047],walldist+4);
						x1 += dax; x2 -= day; x3 -= dax; x4 += day;
						y1 += day; y2 += dax; y3 -= day; y4 -= dax;

						if ((y1^y2) < 0)
						{
							if ((x1^x2) < 0) clipyou ^= (x1*y2<x2*y1)^(y1<y2);
							else if (x1 >= 0) clipyou ^= 1;
						}
						if ((y2^y3) < 0)
						{
							if ((x2^x3) < 0) clipyou ^= (x2*y3<x3*y2)^(y2<y3);
							else if (x2 >= 0) clipyou ^= 1;
						}
						if ((y3^y4) < 0)
						{
							if ((x3^x4) < 0) clipyou ^= (x3*y4<x4*y3)^(y3<y4);
							else if (x3 >= 0) clipyou ^= 1;
						}
						if ((y4^y1) < 0)
						{
							if ((x4^x1) < 0) clipyou ^= (x4*y1<x1*y4)^(y4<y1);
							else if (x4 >= 0) clipyou ^= 1;
						}
						break;
				}

				if (clipyou != 0)
				{
					if ((z > daz) && (daz > *ceilz)) { *ceilz = daz; *ceilhit = j+49152; }
					if ((z < daz2) && (daz2 < *florz)) { *florz = daz2; *florhit = j+49152; }
				}
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r9, %r15
movl %ecx, %ebx
movl %edx, 0x14(%rsp)
movq 0xd8(%rsp), %rcx
movq 0xd0(%rsp), %r9
testw %bx, %bx
js 0x3a826
movl %esi, %edx
movl %edi, %esi
movl 0xe0(%rsp), %edi
leal 0x401(%rdi), %eax
movq %r8, %rcx
movl %esi, %r14d
subl %eax, %r14d
movl %edx, %ebp
subl %eax, %ebp
leal (%rdi,%rsi), %r12d
addl $0x401, %r12d           # imm = 0x401
leal 0x401(%rdi,%rdx), %r13d
movswl %bx, %edi
movq %rdx, 0x50(%rsp)
movq %r8, 0x68(%rsp)
movq %r9, %r8
movq %rsi, 0x58(%rsp)
callq 0x2600d
movq %r13, %r8
movl %ebp, %r10d
leal 0x4000(%rbx), %eax
movzwl %ax, %eax
movq %r15, 0x88(%rsp)
movl %eax, (%r15)
movq 0xd8(%rsp), %rcx
movl %eax, (%rcx)
movw %bx, 0x3f6661(%rip)     # 0x430540
movzwl 0x17db56(%rip), %eax    # 0x1b7a3c
movw %ax, 0x36(%rsp)
movl $0x400, %edi            # imm = 0x400
leal (%r14,%rdi), %eax
movl %eax, 0x64(%rsp)
movl $0xfffffc00, %eax       # imm = 0xFFFFFC00
leal (%r12,%rax), %r9d
addl %ebp, %edi
addl %r13d, %eax
movl %eax, 0x80(%rsp)
movw $0x1, %ax
movl %eax, 0x20(%rsp)
xorl %ecx, %ecx
leaq 0x208b42(%rip), %rsi    # 0x242a60
movl %ebp, 0x38(%rsp)
movq %r13, 0x8(%rsp)
movq %rdi, 0x90(%rsp)
movl %r9d, 0x84(%rsp)
leaq 0x3f6602(%rip), %rax    # 0x430540
movq %rcx, 0x18(%rsp)
movswq (%rax,%rcx,2), %rax
leaq (%rax,%rax,4), %rax
movswl 0x2(%rsi,%rax,8), %r15d
testl %r15d, %r15d
jle 0x3a26b
movswl (%rsi,%rax,8), %ebp
addl %ebp, %r15d
movslq %ebp, %rbx
shlq $0x5, %rbx
leaq 0x17dae0(%rip), %rdx    # 0x1b7a50
addq %rdx, %rbx
movl 0x20(%rsp), %eax
movq %rax, 0x48(%rsp)
movswl 0xc(%rbx), %r13d
testl %r13d, %r13d
js 0x3a054
movswq 0x8(%rbx), %rax
shlq $0x5, %rax
movl (%rbx), %esi
movl (%rax,%rdx), %ecx
cmpl %r14d, %esi
jge 0x39fa6
cmpl %r14d, %ecx
jl 0x3a054
cmpl %r12d, %esi
jle 0x39fb4
cmpl %r12d, %ecx
jg 0x3a054
addq %rdx, %rax
movl 0x4(%rbx), %r9d
movl 0x4(%rax), %edi
cmpl %r10d, %r9d
jge 0x39fcc
cmpl %r10d, %edi
jl 0x3a054
cmpl %r8d, %r9d
jle 0x39fd6
cmpl %r8d, %edi
jg 0x3a054
movl %ecx, %edx
subl %esi, %edx
movl %edi, %eax
subl %r9d, %eax
movq 0x50(%rsp), %r8
subl %r9d, %r8d
imull %edx, %r8d
movq 0x58(%rsp), %r10
subl %esi, %r10d
imull %eax, %r10d
cmpl %r10d, %r8d
jge 0x3a003
movl 0x38(%rsp), %r10d
jmp 0x3a048
testl %edx, %edx
movq 0x8(%rsp), %r8
movl 0x38(%rsp), %r10d
cmovgl %r10d, %r8d
subl %r9d, %r8d
movl %r8d, 0x78(%rsp)
imull %edx, %r8d
testl %eax, %eax
movl %r14d, %r11d
cmovgl %r12d, %r11d
subl %esi, %r11d
movl %r11d, 0x70(%rsp)
imull %eax, %r11d
cmpl %r11d, %r8d
jge 0x3a048
movzwl 0xe(%rbx), %r8d
testl %r8d, 0xe8(%rsp)
je 0x3a068
movq 0x8(%rsp), %r8
leaq 0x17d9fc(%rip), %rdx    # 0x1b7a50
incl %ebp
addq $0x20, %rbx
cmpl %r15d, %ebp
jl 0x39f7c
jmp 0x3a26b
cmpw $0x0, 0x36(%rsp)
je 0x3a208
movswl 0x48(%rsp), %r11d
movl %r11d, %r8d
sarl $0x1f, %r8d
andl %r11d, %r8d
movl %r8d, 0x40(%rsp)
leaq 0x3f64b0(%rip), %r8     # 0x430540
leaq (%r8,%r11,2), %r8
addq $-0x2, %r8
testl %r11d, %r11d
jle 0x3a0b5
decl %r11d
leaq -0x2(%r8), %r10
cmpw %r13w, (%r8)
movq %r10, %r8
jne 0x3a098
incl %r11d
movl %r11d, %r8d
jmp 0x3a0ba
movl 0x40(%rsp), %r8d
testl %r8d, %r8d
movq 0x8(%rsp), %r8
movl 0x64(%rsp), %r10d
jg 0x3a0f6
movq 0x48(%rsp), %r8
leal 0x1(%r8), %r11d
movswq %r8w, %r8
leaq 0x3f6463(%rip), %r10    # 0x430540
movw %r13w, (%r10,%r8,2)
movl 0x64(%rsp), %r10d
movq 0x8(%rsp), %r8
movl %r11d, 0x20(%rsp)
movq %r11, 0x48(%rsp)
cmpl %r10d, %esi
movl %r10d, %r11d
movl 0x38(%rsp), %r10d
jge 0x3a10c
cmpl %r11d, %ecx
jl 0x3a04d
movl 0x84(%rsp), %r11d
cmpl %r11d, %esi
jle 0x3a122
cmpl %r11d, %ecx
jg 0x3a04d
movq 0x90(%rsp), %rcx
cmpl %ecx, %r9d
jge 0x3a137
cmpl %ecx, %edi
jl 0x3a04d
movl 0x80(%rsp), %ecx
cmpl %ecx, %r9d
jle 0x3a14b
cmpl %ecx, %edi
jg 0x3a04d
xorl %ecx, %ecx
testl %eax, %eax
setle %cl
xorl %esi, %esi
testl %edx, %edx
setg %sil
shll $0xb, %esi
movl $0xfffffc00, %edi       # imm = 0xFFFFFC00
movl 0x78(%rsp), %r9d
addl %edi, %r9d
addl %esi, %r9d
imull %edx, %r9d
shll $0xb, %ecx
movl 0x70(%rsp), %edx
addl %edi, %edx
addl %ecx, %edx
imull %eax, %edx
cmpl %edx, %r9d
jge 0x3a04d
movswl %r13w, %edi
movq 0x58(%rsp), %rsi
movq 0x50(%rsp), %rdx
leaq 0x30(%rsp), %rcx
leaq 0x2c(%rsp), %r8
callq 0x2600d
movl 0x30(%rsp), %eax
movq 0x68(%rsp), %rcx
cmpl (%rcx), %eax
jle 0x3a1ca
movq 0x68(%rsp), %rcx
movl %eax, (%rcx)
leal 0x4000(%r13), %eax
movq 0x88(%rsp), %rcx
movl %eax, (%rcx)
movl 0x2c(%rsp), %eax
movq 0xd0(%rsp), %rcx
cmpl (%rcx), %eax
movl 0x38(%rsp), %r10d
movq 0x8(%rsp), %r8
leaq 0x17d867(%rip), %rdx    # 0x1b7a50
jge 0x3a054
movl %eax, (%rcx)
addl $0x4000, %r13d          # imm = 0x4000
movq 0xd8(%rsp), %rax
movl %r13d, (%rax)
jmp 0x3a054
movl %r13d, %r8d
leaq (%r8,%r8,4), %r8
leaq 0x20884a(%rip), %r11    # 0x242a60
leaq (%r11,%r8,8), %r8
testb $0x1, 0xc(%r8)
jne 0x3a243
movl 0x4(%r8), %r11d
movq %r8, 0x40(%rsp)
movl $0x300, %r8d            # imm = 0x300
addl %r8d, %r11d
movq 0x40(%rsp), %r8
cmpl 0x14(%rsp), %r11d
jge 0x3a048
testb $0x1, 0xe(%r8)
jne 0x3a074
movl 0x8(%r8), %r8d
movl $0xfffffd00, %r11d      # imm = 0xFFFFFD00
addl %r11d, %r8d
cmpl 0x14(%rsp), %r8d
jle 0x3a048
jmp 0x3a074
movq 0x18(%rsp), %rcx
incq %rcx
movswq 0x20(%rsp), %rdx
cmpq %rdx, %rcx
leaq 0x2087dd(%rip), %rsi    # 0x242a60
jl 0x39f37
movl 0x30(%rsp), %r15d
movl 0x2c(%rsp), %eax
movl %eax, 0x18(%rsp)
cmpw $0x0, 0x20(%rsp)
jle 0x3a817
movl 0xe8(%rsp), %edi
shrl $0x10, %edi
movl 0xe0(%rsp), %eax
movq %rax, %rcx
addl $0x4, %eax
cltq
movq %rax, 0x78(%rsp)
incl %ecx
movq %rcx, 0x20(%rsp)
xorl %ecx, %ecx
leaq 0x2419e0(%rip), %r8     # 0x27bcb0
leaq 0x37b249(%rip), %r9     # 0x3b5520
leaq 0x3bb82(%rip), %r10     # 0x75e60
movl %edi, 0x8(%rsp)
movq %rdx, 0x40(%rsp)
leaq 0x3f6252(%rip), %rax    # 0x430540
movq %rcx, 0x70(%rsp)
movswq (%rax,%rcx,2), %rax
leaq 0x371211(%rip), %rcx    # 0x3ab510
movzwl (%rcx,%rax,2), %eax
testw %ax, %ax
js 0x3a801
movzwl %ax, %r14d
imulq $0x2c, %r14, %rbp
movzwl 0xc(%rbp,%r8), %r13d
testl %r13d, %edi
je 0x3a7f7
addq %r8, %rbp
movl (%rbp), %edx
movl 0x4(%rbp), %ecx
movl %r13d, %eax
shrl $0x4, %eax
andl $0x3, %eax
movslq (%r10,%rax,4), %rax
addq %r10, %rax
jmpq *%rax
movzbl 0x12(%rbp), %eax
movq 0x20(%rsp), %rsi
leal (%rsi,%rax,4), %eax
subl 0x58(%rsp), %edx
movl %edx, %esi
negl %esi
cmovsl %edx, %esi
cmpl %eax, %esi
jg 0x3a7f7
subl 0x50(%rsp), %ecx
movl %ecx, %edx
negl %edx
cmovsl %ecx, %edx
cmpl %eax, %edx
jg 0x3a7f7
movswq 0xe(%rbp), %rdx
leaq 0x3c6464(%rip), %rax    # 0x4007e0
movswl (%rax,%rdx,2), %eax
movzbl 0x15(%rbp), %ecx
imull %ecx, %eax
movsbl %r13b, %esi
sarl $0x7, %esi
leal (%rax,%rax), %r15d
andl %esi, %r15d
addl 0x8(%rbp), %r15d
leaq 0x1ff6c0(%rip), %rsi    # 0x239a60
movl (%rsi,%rdx,4), %edx
testl $0xff0000, %edx         # imm = 0xFF0000
je 0x3a4dd
shrl $0x10, %edx
movsbl %dl, %edx
imull %edx, %ecx
shll $0x2, %ecx
subl %ecx, %r15d
jmp 0x3a4dd
movswq 0xe(%rbp), %rbx
leaq 0x1ff691(%rip), %rax    # 0x239a60
movl (%rax,%rbx,4), %r12d
movl %r12d, %eax
shrl $0x8, %eax
movsbl %al, %eax
movsbl 0x16(%rbp), %esi
addl %eax, %esi
movl %esi, %eax
negl %eax
testb $0x4, %r13b
cmovel %esi, %eax
movzwl 0x1c(%rbp), %esi
movzbl 0x14(%rbp), %edi
movl %esi, %r8d
movl $0x7ff, %r9d            # imm = 0x7FF
andl %r9d, %r8d
leaq 0x393948(%rip), %r10    # 0x3cdd50
movswq (%r10,%r8,2), %r8
imulq %rdi, %r8
addl $0x600, %esi            # imm = 0x600
andl %r9d, %esi
movswq (%r10,%rsi,2), %r9
imulq %rdi, %r9
leaq 0x3d4bf6(%rip), %rsi    # 0x40f020
movswq (%rsi,%rbx,2), %rsi
movl %esi, %edi
sarl %edi
addl %eax, %edi
movslq %edi, %rax
movq %rax, %rdi
imulq %r8, %rdi
shrq $0x10, %rdi
subl %edi, %edx
imulq %rsi, %r8
shrq $0x10, %r8
addl %edx, %r8d
imulq %r9, %rax
shrq $0x10, %rax
subl %eax, %ecx
imulq %rsi, %r9
shrq $0x10, %r9
addl %ecx, %r9d
movq 0x20(%rsp), %rax
movl %eax, (%rsp)
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x354ce
leaq 0x3b9dd(%rip), %r10     # 0x75e60
leaq 0x37b096(%rip), %r9     # 0x3b5520
leaq 0x24181f(%rip), %r8     # 0x27bcb0
movl 0x8(%rsp), %edi
testl %eax, %eax
je 0x3a7f7
leaq 0x3c633c(%rip), %rax    # 0x4007e0
movswl (%rax,%rbx,2), %eax
movzbl 0x15(%rbp), %ecx
imull %ecx, %eax
movsbl %r13b, %edx
sarl $0x7, %edx
leal (%rax,%rax), %r15d
andl %edx, %r15d
addl 0x8(%rbp), %r15d
testl $0xff0000, %r12d        # imm = 0xFF0000
je 0x3a4dd
shll $0x8, %r12d
sarl $0x16, %r12d
andl $-0x4, %r12d
imull %ecx, %r12d
subl %r12d, %r15d
shll $0x2, %eax
movl %r15d, %ecx
subl %eax, %ecx
movl %ecx, 0x18(%rsp)
jmp 0x3a7a3
movl 0x8(%rbp), %r15d
testb $0x40, %r13b
movl %r15d, 0x18(%rsp)
je 0x3a516
cmpl 0x14(%rsp), %r15d
setl %al
testb $0x8, %r13b
sete %sil
cmpb %al, %sil
je 0x3a7f7
movswq 0xe(%rbp), %rax
leaq 0x1ff53e(%rip), %rsi    # 0x239a60
movl (%rsi,%rax,4), %esi
movl %esi, %edi
shrl $0x8, %edi
movsbl %dil, %edi
movsbl 0x16(%rbp), %r8d
addl %edi, %r8d
shrl $0x10, %esi
movsbl %sil, %esi
movsbl 0x17(%rbp), %edi
addl %esi, %edi
movl %r8d, %r12d
negl %r12d
testb $0x4, %r13b
cmovel %r8d, %r12d
movl %edi, %esi
negl %esi
testb $0x8, %r13b
cmovel %edi, %esi
movswq 0x1c(%rbp), %r10
leal 0x200(%r10), %edi
movl $0x7ff, %r8d            # imm = 0x7FF
andl %r8d, %edi
leaq 0x3937d8(%rip), %r9     # 0x3cdd50
movswq (%r9,%rdi,2), %r8
movswq (%r9,%r10,2), %r11
leaq 0x3d4a97(%rip), %rdi    # 0x40f020
movswq (%rdi,%rax,2), %rbx
movzbl 0x14(%rbp), %edi
leaq 0x3c6247(%rip), %r9     # 0x4007e0
movswq (%r9,%rax,2), %r15
movzbl 0x15(%rbp), %r9d
movl %ebx, %eax
sarl %eax
addl %r12d, %eax
movslq %eax, %r12
imulq %rdi, %r12
movq %r15, 0x38(%rsp)
movl %r15d, %eax
sarl %eax
addl %esi, %eax
cltq
imulq %r9, %rax
movq %r12, %r13
imulq %r11, %r13
movq %rax, %rsi
imulq %r8, %rsi
addq %r13, %rsi
shrq $0x10, %rsi
subl 0x58(%rsp), %esi
addl %edx, %esi
imulq %r11, %rax
imulq %r8, %r12
subq %r12, %rax
shrq $0x10, %rax
subl 0x50(%rsp), %eax
addl %ecx, %eax
imulq %rbx, %rdi
movq %rdi, %rdx
imulq %r11, %rdx
shrq $0x10, %rdx
movl %esi, %r15d
subl %edx, %r15d
imulq %r8, %rdi
shrq $0x10, %rdi
addl %eax, %edi
leal 0x100(%r10), %edx
movl $0x7ff, %ebx            # imm = 0x7FF
andl %ebx, %edx
leaq 0x393729(%rip), %r12    # 0x3cdd50
movswq (%r12,%rdx,2), %r13
movq 0x78(%rsp), %rcx
imulq %rcx, %r13
shrq $0xe, %r13
leal 0x700(%r10), %edx
andl %ebx, %edx
movswq (%r12,%rdx,2), %r12
imulq %rcx, %r12
shrq $0xe, %r12
movl %r15d, %ecx
subl %r12d, %ecx
leal (%rax,%r12), %edx
leal (%rdi,%r13), %r10d
movl %r10d, %ebp
xorl %edx, %ebp
leal (%rsi,%r13), %ebx
movl %ebx, 0x48(%rsp)
js 0x3a670
xorl %ebp, %ebp
jmp 0x3a698
movl %ecx, %ebp
xorl %ebx, %ebp
js 0x3a67e
testl %ebx, %ebx
setns %bpl
jmp 0x3a698
movl %r10d, %ebp
imull %ebx, %ebp
movl %ecx, %ebx
imull %edx, %ebx
cmpl %ebx, %ebp
setl %bl
cmpl %r10d, %edx
setl %bpl
xorb %bl, %bpl
imulq 0x38(%rsp), %r9
imulq %r9, %r8
shrq $0x10, %r8
imulq %r11, %r9
shrq $0x10, %r9
subl %r8d, %r15d
subl %r13d, %r15d
subl %r9d, %edi
subl %r12d, %edi
movl %r10d, %r11d
xorl %edi, %r11d
movl 0x18(%rsp), %ebx
jns 0x3a6fa
movl %ecx, %r11d
xorl %r15d, %r11d
js 0x3a6da
testl %ecx, %ecx
setns %cl
xorb %bpl, %cl
movl %ecx, %ebp
jmp 0x3a6fa
imull %edi, %ecx
movl %r15d, %r11d
imull %r10d, %r11d
cmpl %r11d, %ecx
setl %cl
cmpl %edi, %r10d
setl %r10b
xorb %bpl, %r10b
xorb %cl, %r10b
movl %r10d, %ebp
subl %r8d, %esi
addl %r12d, %esi
addl %r13d, %r9d
subl %r9d, %eax
movl %edi, %ecx
xorl %eax, %ecx
leaq 0x3b74f(%rip), %r10     # 0x75e60
js 0x3a723
leaq 0x241596(%rip), %r8     # 0x27bcb0
leaq 0x37adff(%rip), %r9     # 0x3b5520
jmp 0x3a762
movl %r15d, %ecx
xorl %esi, %ecx
leaq 0x241581(%rip), %r8     # 0x27bcb0
leaq 0x37adea(%rip), %r9     # 0x3b5520
js 0x3a745
testl %r15d, %r15d
setns %cl
xorb %bpl, %cl
movl %ecx, %ebp
jmp 0x3a762
imull %eax, %r15d
movl %esi, %ecx
imull %edi, %ecx
cmpl %ecx, %r15d
setl %cl
cmpl %eax, %edi
setl %dil
xorb %bpl, %dil
xorb %cl, %dil
movl %edi, %ebp
movl %eax, %ecx
xorl %edx, %ecx
movl 0x8(%rsp), %edi
jns 0x3a79b
movl %esi, %ecx
movl 0x48(%rsp), %r11d
xorl %r11d, %ecx
js 0x3a782
testl %esi, %esi
setns %al
xorb %bpl, %al
jmp 0x3a799
imull %edx, %esi
imull %eax, %r11d
cmpl %r11d, %esi
setl %cl
cmpl %edx, %eax
setl %al
xorb %bpl, %al
xorb %cl, %al
movl %eax, %ebp
movl %ebx, %r15d
testb %bpl, %bpl
je 0x3a7f7
cmpl 0x14(%rsp), %r15d
jge 0x3a7cd
movq 0x68(%rsp), %rax
cmpl (%rax), %r15d
jle 0x3a7cd
movq 0x68(%rsp), %rax
movl %r15d, (%rax)
leal 0xc000(%r14), %eax
movq 0x88(%rsp), %rcx
movl %eax, (%rcx)
movl 0x18(%rsp), %ecx
cmpl 0x14(%rsp), %ecx
jle 0x3a7f7
movq 0xd0(%rsp), %rax
cmpl (%rax), %ecx
jge 0x3a7f7
movl %ecx, (%rax)
movl %r14d, %eax
addl $0xc000, %eax           # imm = 0xC000
movq 0xd8(%rsp), %rcx
movl %eax, (%rcx)
movzwl (%r9,%r14,2), %eax
jmp 0x3a303
movq 0x70(%rsp), %rcx
incq %rcx
movq 0x40(%rsp), %rdx
cmpq %rdx, %rcx
jne 0x3a2e7
movl %r15d, 0x30(%rsp)
movl 0x18(%rsp), %eax
movl %eax, 0x2c(%rsp)
jmp 0x3a83e
movl $0x80000000, (%r8)      # imm = 0x80000000
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, (%r15)
movl $0x7fffffff, (%r9)      # imm = 0x7FFFFFFF
movl %eax, (%rcx)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq