// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: drawmasks
void drawmasks(void)
{
	int i, j, k, l, gap, xs, ys, xp, yp, yoff, yspan;

	for(i=spritesortcnt-1;i>=0;i--) tspriteptr[i] = &tsprite[i];
	for(i=spritesortcnt-1;i>=0;i--)
	{
		xs = tspriteptr[i]->x-globalposx; ys = tspriteptr[i]->y-globalposy;
		yp = dmulscale6(xs,cosviewingrangeglobalang,ys,sinviewingrangeglobalang);
		if (yp > (4<<8))
		{
			xp = dmulscale6(ys,cosglobalang,-xs,singlobalang);
			if (mulscale24(abs(xp+yp),xdimen) >= yp) goto killsprite;
			spritesx[i] = scale(xp+yp,xdimen<<7,yp);
		}
		else if ((tspriteptr[i]->cstat&48) == 0)
		{
killsprite:
			spritesortcnt--;  //Delete face sprite if on wrong side!
			if (i != spritesortcnt)
			{
				tspriteptr[i] = tspriteptr[spritesortcnt];
				spritesx[i] = spritesx[spritesortcnt];
				spritesy[i] = spritesy[spritesortcnt];
			}
			continue;
		}
		spritesy[i] = yp;
	}

	gap = 1; while (gap < spritesortcnt) gap = (gap<<1)+1;
	for(gap>>=1;gap>0;gap>>=1)      //Sort sprite list
		for(i=0;i<spritesortcnt-gap;i++)
			for(l=i;l>=0;l-=gap)
			{
				if (spritesy[l] <= spritesy[l+gap]) break;
				swaplong(&tspriteptr[l],&tspriteptr[l+gap]);
				swaplong(&spritesx[l],&spritesx[l+gap]);
				swaplong(&spritesy[l],&spritesy[l+gap]);
			}

	if (spritesortcnt > 0)
		spritesy[spritesortcnt] = (spritesy[spritesortcnt-1]^1);

	ys = spritesy[0]; i = 0;
	for(j=1;j<=spritesortcnt;j++)
	{
		if (spritesy[j] == ys) continue;
		ys = spritesy[j];
		if (j > i+1)
		{
			for(k=i;k<j;k++)
			{
				spritesz[k] = tspriteptr[k]->z;
				if ((tspriteptr[k]->cstat&48) != 32)
				{
					yoff = (int)((signed char)((picanm[tspriteptr[k]->picnum]>>16)&255))+((int)tspriteptr[k]->yoffset);
					spritesz[k] -= ((yoff*tspriteptr[k]->yrepeat)<<2);
					yspan = (tilesizy[tspriteptr[k]->picnum]*tspriteptr[k]->yrepeat<<2);
					if (!(tspriteptr[k]->cstat&128)) spritesz[k] -= (yspan>>1);
					if (klabs(spritesz[k]-globalposz) < (yspan>>1)) spritesz[k] = globalposz;
				}
			}
			for(k=i+1;k<j;k++)
				for(l=i;l<k;l++)
					if (klabs(spritesz[k]-globalposz) < klabs(spritesz[l]-globalposz))
					{
						swaplong(&tspriteptr[k],&tspriteptr[l]);
						swaplong(&spritesx[k],&spritesx[l]);
						swaplong(&spritesy[k],&spritesy[l]);
						swaplong(&spritesz[k],&spritesz[l]);
					}
			for(k=i+1;k<j;k++)
				for(l=i;l<k;l++)
					if (tspriteptr[k]->statnum < tspriteptr[l]->statnum)
					{
						swaplong(&tspriteptr[k],&tspriteptr[l]);
						swaplong(&spritesx[k],&spritesx[l]);
						swaplong(&spritesy[k],&spritesy[l]);
					}
		}
		i = j;
	}

	/*for(i=spritesortcnt-1;i>=0;i--)
	{
		xs = tspriteptr[i].x-globalposx;
		ys = tspriteptr[i].y-globalposy;
		zs = tspriteptr[i].z-globalposz;

		xp = ys*cosglobalang-xs*singlobalang;
		yp = (zs<<1);
		zp = xs*cosglobalang+ys*singlobalang;

		xs = scale(xp,halfxdimen<<12,zp)+((halfxdimen+windowx1)<<12);
		ys = scale(yp,xdimenscale<<12,zp)+((globalhoriz+windowy1)<<12);

		drawline256(xs-65536,ys-65536,xs+65536,ys+65536,31);
		drawline256(xs+65536,ys-65536,xs-65536,ys+65536,31);
	}*/

#if USE_POLYMOST
		//Hack to make it draw all opaque quads first. This should reduce the chances of
		//bad sorting causing transparent quads knocking out opaque quads behind it.
		//
		//Need to store alpha flag with all textures before this works right!
	if (rendmode > 0)
	{
		for(i=spritesortcnt-1;i>=0;i--)
			if ((!(tspriteptr[i]->cstat&2))
#if USE_OPENGL
			    && (!polymost_texmayhavealpha(tspriteptr[i]->picnum,tspriteptr[i]->pal))
#endif
			   )
				{ drawsprite(i); tspriteptr[i] = 0; } //draw only if it is fully opaque
		for(i=j=0;i<spritesortcnt;i++)
		{
			if (!tspriteptr[i]) continue;
			tspriteptr[j] = tspriteptr[i];
			spritesx[j] = spritesx[i];
			spritesy[j] = spritesy[i]; j++;
		}
		spritesortcnt = j;


		for(i=maskwallcnt-1;i>=0;i--)
		{
			k = thewall[maskwall[i]];
			if ((!(wall[k].cstat&128))
#if USE_OPENGL
			    && (!polymost_texmayhavealpha(wall[k].overpicnum,wall[k].pal))
#endif
			   )
				{ drawmaskwall(i); maskwall[i] = -1; } //draw only if it is fully opaque
		}
		for(i=j=0;i<maskwallcnt;i++)
		{
			if (maskwall[i] < 0) continue;
			maskwall[j++] = maskwall[i];
		}
		maskwallcnt = j;
	}
#endif

	while ((spritesortcnt > 0) && (maskwallcnt > 0))  //While BOTH > 0
	{
		j = maskwall[maskwallcnt-1];
		if (spritewallfront(tspriteptr[spritesortcnt-1],(int)thewall[j]) == 0)
			drawsprite(--spritesortcnt);
		else
		{
				//Check to see if any sprites behind the masked wall...
			k = -1;
			gap = 0;
			for(i=spritesortcnt-2;i>=0;i--)
			{
#if USE_POLYMOST
				if (rendmode > 0)
					l = dxb1[j] <= (double)spritesx[i]/256.0 && (double)spritesx[i]/256.0 <= dxb2[j];
				else
#endif
					l = xb1[j] <= (spritesx[i]>>8) && (spritesx[i]>>8) <= xb2[j];
				if (l && spritewallfront(tspriteptr[i],(int)thewall[j]) == 0)
				{
					drawsprite(i);
					tspriteptr[i]->owner = -1;
					k = i;
					gap++;
				}
			}
			if (k >= 0)       //remove holes in sprite list
			{
				for(i=k;i<spritesortcnt;i++)
					if (tspriteptr[i]->owner >= 0)
					{
						if (i > k)
						{
							tspriteptr[k] = tspriteptr[i];
							spritesx[k] = spritesx[i];
							spritesy[k] = spritesy[i];
						}
						k++;
					}
				spritesortcnt -= gap;
			}

				//finally safe to draw the masked wall
			drawmaskwall(--maskwallcnt);
		}
	}
	while (spritesortcnt > 0) drawsprite(--spritesortcnt);
	while (maskwallcnt > 0) drawmaskwall(--maskwallcnt);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movslq 0x3adbb7(%rip), %r11    # 0x3d77a4
testq %r11, %r11
jle 0x2a220
leaq 0x1(%r11), %rcx
movl %ecx, %eax
andl $-0x2, %eax
leaq -0x1(%r11), %rdx
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
imulq $0x2c, %r11, %rdx
leaq 0x3b7bb8(%rip), %rsi    # 0x3e17d0
addq %rsi, %rdx
addq $-0x58, %rdx
leaq 0x3cdbaa(%rip), %r15    # 0x3f77d0
leaq (%r15,%r11,8), %rsi
addq $-0x8, %rsi
xorl %edi, %edi
movdqa 0x4a4a8(%rip), %xmm1    # 0x740e0
movdqa 0x4a4b0(%rip), %xmm2    # 0x740f0
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movq %rdi, %xmm4
pshufd $0x44, %xmm4, %xmm4     # xmm4 = xmm4[0,1,0,1]
por %xmm1, %xmm4
pxor %xmm2, %xmm4
movdqa %xmm4, %xmm5
pcmpgtd %xmm0, %xmm5
pcmpeqd %xmm0, %xmm4
pshufd $0xf5, %xmm4, %xmm6     # xmm6 = xmm4[1,1,3,3]
pand %xmm5, %xmm6
pshufd $0xf5, %xmm5, %xmm4     # xmm4 = xmm5[1,1,3,3]
por %xmm6, %xmm4
movd %xmm4, %r8d
notl %r8d
testb $0x1, %r8b
je 0x29c8d
leaq 0x2c(%rdx), %r8
movq %r8, (%rsi)
pxor %xmm3, %xmm4
pextrw $0x4, %xmm4, %r8d
testb $0x1, %r8b
je 0x29ca1
movq %rdx, -0x8(%rsi)
addq $0x2, %rdi
addq $-0x58, %rdx
addq $-0x10, %rsi
cmpq %rdi, %rax
jne 0x29c48
testl %r11d, %r11d
jle 0x2a220
movq %r11, 0x10(%rsp)
movslq 0x210d89(%rip), %rsi    # 0x23aa50
movslq 0x210d86(%rip), %rdi    # 0x23aa54
movslq 0x245da7(%rip), %r11    # 0x26fa7c
movslq 0x245d98(%rip), %r10    # 0x26fa74
movslq 0x245d8d(%rip), %rax    # 0x26fa70
movq %rax, 0x8(%rsp)
movslq 0x245d89(%rip), %rax    # 0x26fa78
movq %rax, (%rsp)
movslq 0x7ab36(%rip), %r13     # 0xa4830
movl %r13d, %eax
shll $0x7, %eax
cltq
movq %rax, 0x18(%rsp)
leaq 0x3d1ac2(%rip), %r12    # 0x3fb7d0
leaq 0x3d3abb(%rip), %r14    # 0x3fd7d0
leaq -0x1(%rcx), %rbp
movq -0x10(%r15,%rcx,8), %rbx
movslq (%rbx), %rdx
subq %rsi, %rdx
movslq 0x4(%rbx), %rax
subq %rdi, %rax
movq %r11, %r8
imulq %rdx, %r8
movq %r10, %r9
imulq %rax, %r9
addq %r8, %r9
shrq $0x6, %r9
cmpl $0x401, %r9d            # imm = 0x401
jl 0x29d96
negl %edx
imulq 0x8(%rsp), %rax
movslq %edx, %rdx
imulq (%rsp), %rdx
addq %rax, %rdx
shrq $0x6, %rdx
addl %r9d, %edx
movl %edx, %eax
negl %eax
cmovsl %edx, %eax
imulq %r13, %rax
shrq $0x18, %rax
cmpl %r9d, %eax
jge 0x29d9c
movslq %edx, %rax
imulq 0x18(%rsp), %rax
movl %r9d, %r8d
andl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
cqto
idivq %r8
movl %eax, -0x8(%r12,%rcx,4)
jmp 0x29dd6
testb $0x30, 0xc(%rbx)
jne 0x29dd6
movq 0x10(%rsp), %rdx
leal -0x1(%rdx), %eax
movl %eax, 0x3ad9fa(%rip)    # 0x3d77a4
movl %edx, %edx
cmpq %rdx, %rbp
jne 0x29db8
movq %rax, 0x10(%rsp)
jmp 0x29ddb
movslq %eax, %rdx
movq (%r15,%rdx,8), %r8
movq %r8, -0x10(%r15,%rcx,8)
movl (%r12,%rdx,4), %r8d
movl %r8d, -0x8(%r12,%rcx,4)
movl (%r14,%rdx,4), %r9d
movq %rax, 0x10(%rsp)
movl %r9d, -0x8(%r14,%rcx,4)
movq %rbp, %rcx
cmpq $0x1, %rbp
ja 0x29d15
movq 0x10(%rsp), %r11
cmpl $0x2, %r11d
jl 0x29e7b
movl $0x1, %ecx
movl %ecx, %eax
leal 0x1(,%rax,2), %ecx
cmpl %r11d, %ecx
jl 0x29dfc
addl %eax, %eax
sarl %eax
testl %eax, %eax
jle 0x29e7b
leaq 0x3cd9b7(%rip), %rcx    # 0x3f77d0
movl %r11d, %edx
subl %eax, %edx
jle 0x29e6b
xorl %esi, %esi
movl %esi, %edi
movl %edi, %r8d
movl (%r14,%r8,4), %r9d
addl %eax, %edi
movl (%r14,%rdi,4), %r10d
cmpl %r10d, %r9d
jle 0x29e65
movl (%rcx,%rdi,8), %r11d
movl (%rcx,%r8,8), %ebx
movl %ebx, (%rcx,%rdi,8)
movl %r11d, (%rcx,%r8,8)
movl (%r12,%rdi,4), %r11d
movl (%r12,%r8,4), %ebx
movl %ebx, (%r12,%rdi,4)
movl %r11d, (%r12,%r8,4)
movl %r9d, (%r14,%rdi,4)
movl %r10d, (%r14,%r8,4)
subl %eax, %r8d
movl %r8d, %edi
jns 0x29e24
incl %esi
cmpl %edx, %esi
jne 0x29e22
movl %eax, %edx
shrl %edx
cmpl $0x1, %eax
movl %edx, %eax
movq 0x10(%rsp), %r11
ja 0x29e19
testl %r11d, %r11d
jle 0x2a220
leal -0x1(%r11), %eax
movl (%r14,%rax,4), %eax
xorl $0x1, %eax
movl %r11d, %ecx
movq %rcx, 0x38(%rsp)
movl %eax, (%r14,%rcx,4)
movl 0x3d392f(%rip), %edx    # 0x3fd7d0
movl 0x241bb9(%rip), %eax    # 0x26ba60
movl %eax, (%rsp)
leal 0x1(%r11), %eax
xorl %ecx, %ecx
movl $0x1, %ebx
leaq 0x210ba4(%rip), %rbp    # 0x23aa60
movq %rax, 0x40(%rsp)
movl (%r14,%rbx,4), %esi
cmpl %edx, %esi
jne 0x29ed0
movl %edx, %esi
jmp 0x2a168
leal 0x1(%rcx), %edx
movslq %edx, %r8
cmpq %r8, %rbx
jle 0x2a166
movl %esi, 0x24(%rsp)
movslq %ecx, %r13
leaq (,%r13,8), %rcx
movq %rcx, 0x18(%rsp)
leaq (,%r13,4), %rcx
xorl %edi, %edi
movq %rbx, 0x30(%rsp)
leaq 0x3d78d7(%rip), %r14    # 0x4017e0
movq %r13, 0x28(%rsp)
movq 0x18(%rsp), %rdx
leaq (%rdx,%rdi,8), %rdx
movq (%r15,%rdx), %r11
movl 0x8(%r11), %r10d
leaq (%rcx,%rdi,4), %rdx
leaq 0x3d58b6(%rip), %rsi    # 0x3ff7e0
movl %r10d, (%rsi,%rdx)
movzwl 0xc(%r11), %edx
andl $0x30, %edx
cmpw $0x20, %dx
je 0x29fd5
leaq (,%rdi,4), %r9
movswq 0xe(%r11), %rdx
movsbl 0x2(%rbp,%rdx,4), %edx
movsbl 0x17(%r11), %ebx
addl %edx, %ebx
movzbl 0x15(%r11), %edx
imull %ebx, %edx
shll $0x2, %edx
subl %edx, %r10d
addq %rcx, %r9
leaq 0x3d586f(%rip), %rdx    # 0x3ff7e0
movl %r10d, (%rdx,%r9)
movswq 0xe(%r11), %rdx
movswl (%r14,%rdx,2), %ebx
movzbl 0x15(%r11), %edx
imull %ebx, %edx
movb 0xc(%r11), %bl
addl %edx, %edx
testb $-0x80, %bl
movl $0x0, %r11d
cmovel %edx, %r11d
subl %r11d, %r10d
movl %r10d, %r13d
subl (%rsp), %r13d
movl %r13d, %r11d
negl %r11d
cmovsl %r13d, %r11d
movq 0x28(%rsp), %r13
testb $-0x80, %bl
movq 0x30(%rsp), %rbx
je 0x29fc2
cmpl %edx, %r11d
jge 0x29fd5
cmpl %edx, %r11d
cmovll (%rsp), %r10d
leaq 0x3d580f(%rip), %rdx    # 0x3ff7e0
movl %r10d, (%rdx,%r9)
leaq (%rdi,%r13), %rdx
incq %rdx
incq %rdi
cmpq %rbx, %rdx
jl 0x29f0e
movq %r8, %rdi
subq %r13, %rdi
movq %rdi, 0x8(%rsp)
movq %r8, %r10
leaq 0x3d57e3(%rip), %rbp    # 0x3ff7e0
cmpq %r13, %r10
jle 0x2a0b6
movl (%rbp,%r10,4), %eax
xorl %r9d, %r9d
movl %eax, %r11d
movl (%rsp), %r13d
subl %r13d, %r11d
movl %r11d, %esi
negl %esi
cmovsl %r11d, %esi
leaq (%rcx,%r9,4), %rbx
movl (%rbp,%rbx), %r14d
movl %r14d, %edx
subl %r13d, %edx
movl %edx, %r11d
negl %r11d
cmovsl %edx, %r11d
cmpl %r11d, %esi
jae 0x2a0aa
leaq (,%r9,4), %rdx
movq 0x18(%rsp), %rsi
leaq (%rsi,%r9,8), %rsi
movl (%r15,%rsi), %r11d
movq %r12, %r13
movq %r15, %r12
movl (%r15,%r10,8), %r15d
movl %r15d, (%r12,%rsi)
movq %r12, %r15
movq %r13, %r12
movl %r11d, (%r15,%r10,8)
movl (%r13,%rbx), %esi
movl (%r13,%r10,4), %r11d
movl %r11d, (%r13,%rbx)
movl %esi, (%r13,%r10,4)
leaq 0x3d3749(%rip), %r13    # 0x3fd7d0
movl (%r13,%rbx), %esi
movl (%r13,%r10,4), %r11d
movl %r11d, (%r13,%rbx)
movl %esi, (%r13,%r10,4)
addq %rcx, %rdx
movl %eax, (%rbp,%rdx)
movl %r14d, (%rbp,%r10,4)
movl %r14d, %eax
incq %r9
cmpq %r9, %rdi
jne 0x2a00e
incq %r10
movl %r10d, %eax
incq %rdi
movq 0x30(%rsp), %rbx
cmpq %rbx, %rax
movq 0x28(%rsp), %r13
jne 0x29ffd
movq 0x10(%rsp), %r11
leaq 0x3d36f2(%rip), %r14    # 0x3fd7d0
leaq 0x21097b(%rip), %rbp    # 0x23aa60
movq 0x18(%rsp), %r10
cmpq %r13, %r8
jle 0x2a149
xorl %edi, %edi
movq (%r15,%r8,8), %rdx
movzwl 0x1a(%rdx), %eax
leaq (%r10,%rdi,8), %rsi
movq (%r15,%rsi), %r9
cmpw 0x1a(%r9), %ax
jge 0x2a13f
leaq (,%rdi,8), %rax
addq %r10, %rax
movl %edx, (%r15,%rax)
movl %r9d, (%r15,%r8,8)
leaq (%rcx,%rdi,4), %rax
movl (%r12,%rax), %edx
movl (%r12,%r8,4), %esi
movl %esi, (%r12,%rax)
movl %edx, (%r12,%r8,4)
movl (%r14,%rax), %edx
movl (%r14,%r8,4), %esi
movl %esi, (%r14,%rax)
movl %edx, (%r14,%r8,4)
incq %rdi
cmpq %rdi, 0x8(%rsp)
jne 0x2a0f1
incq %r8
movl %r8d, %eax
incq 0x8(%rsp)
cmpq %rbx, %rax
jne 0x2a0ea
movl %ebx, %ecx
movq 0x40(%rsp), %rax
movl 0x24(%rsp), %esi
jmp 0x2a168
movl %ebx, %ecx
incq %rbx
movl %esi, %edx
cmpq %rax, %rbx
jne 0x29ec1
leaq 0x5d07d3(%rip), %rax    # 0x5fa950
cmpl $0x0, (%rax)
jle 0x2a2dd
xorl %ebp, %ebp
testl %r11d, %r11d
jle 0x2a232
movq 0x38(%rsp), %rcx
movq -0x8(%r15,%rcx,8), %rax
testb $0x2, 0xc(%rax)
jne 0x2a1cc
movswl 0xe(%rax), %edi
movzbl 0x11(%rax), %esi
movq %rcx, %rbx
callq 0x4fdc0
movq %rbx, %rcx
testl %eax, %eax
jne 0x2a1cc
leal -0x1(%rcx), %edi
callq 0x2a603
movq %rbx, %rcx
movq $0x0, -0x8(%r15,%rbx,8)
decq %rcx
leaq 0x1(%rcx), %rax
cmpq $0x1, %rax
ja 0x2a196
movslq 0x3ad5c4(%rip), %rax    # 0x3d77a4
testq %rax, %rax
jle 0x2a232
shlq $0x2, %rax
xorl %ecx, %ecx
movq %r15, %rdx
xorl %ebp, %ebp
movq (%rdx), %rsi
testq %rsi, %rsi
je 0x2a211
movslq %ebp, %rbp
movq %rsi, (%r15,%rbp,8)
movl (%rcx,%r12), %esi
movl %esi, (%r12,%rbp,4)
movl (%rcx,%r14), %esi
movl %esi, (%r14,%rbp,4)
incl %ebp
addq $0x4, %rcx
addq $0x8, %rdx
cmpq %rcx, %rax
jne 0x2a1f0
jmp 0x2a232
leaq 0x5d0729(%rip), %rax    # 0x5fa950
xorl %ebp, %ebp
cmpl $0x0, (%rax)
jle 0x2a2dd
movl %ebp, 0x3ad56c(%rip)    # 0x3d77a4
movswq 0x3ad55e(%rip), %r14    # 0x3d779e
testq %r14, %r14
jle 0x2a2e6
incq %r14
leaq 0x3dbd8d(%rip), %rbx    # 0x405fe0
leaq 0x20e7f6(%rip), %r15    # 0x238a50
leaq 0x18e7ef(%rip), %r12    # 0x1b8a50
movswq -0x4(%rbx,%r14,2), %rax
movswq (%r15,%rax,2), %rax
shlq $0x5, %rax
testb $-0x80, 0xe(%rax,%r12)
jne 0x2a2a3
addq %r12, %rax
movswl 0x12(%rax), %edi
movzbl 0x15(%rax), %esi
callq 0x4fdc0
testl %eax, %eax
jne 0x2a2a3
leal 0xfffe(%r14), %eax
movswl %ax, %edi
callq 0x2d591
movw $0xffff, -0x4(%rbx,%r14,2) # imm = 0xFFFF
decq %r14
cmpq $0x1, %r14
ja 0x2a261
movswq 0x3ad4ea(%rip), %rcx    # 0x3d779e
xorl %eax, %eax
testq %rcx, %rcx
jle 0x2a2e8
addq %rcx, %rcx
xorl %edx, %edx
movzwl (%rdx,%rbx), %esi
testw %si, %si
js 0x2a2d2
movslq %eax, %rdi
incl %eax
movw %si, (%rbx,%rdi,2)
addq $0x2, %rdx
cmpq %rdx, %rcx
jne 0x2a2c0
jmp 0x2a2e8
movzwl 0x3ad4ba(%rip), %eax    # 0x3d779e
jmp 0x2a2f6
xorl %eax, %eax
movw %ax, 0x3ad4af(%rip)     # 0x3d779e
movl 0x3ad4ae(%rip), %r11d   # 0x3d77a4
testl %r11d, %r11d
jle 0x2a5b2
testw %ax, %ax
jle 0x2a5b2
leaq 0x3dbcd1(%rip), %rbx    # 0x405fe0
leaq 0x3cd4ba(%rip), %r12    # 0x3f77d0
leaq 0x20e733(%rip), %r13    # 0x238a50
movsd 0x4cdd3(%rip), %xmm2    # 0x770f8
movzwl %ax, %eax
decl %eax
movswq (%rbx,%rax,2), %rbp
leal -0x1(%r11), %edi
movq (%r12,%rdi,8), %rax
movswq (%r13,%rbp,2), %rcx
movslq (%rax), %rdx
movslq 0x4(%rax), %rax
shlq $0x5, %rcx
leaq 0x18e701(%rip), %r10    # 0x1b8a50
movslq (%rcx,%r10), %rsi
movslq 0x4(%rcx,%r10), %r8
movswq 0x8(%rcx,%r10), %rcx
shlq $0x5, %rcx
movslq (%rcx,%r10), %r9
subq %rsi, %r9
subq %r8, %rax
imulq %r9, %rax
subq %rdx, %rsi
movslq 0x4(%rcx,%r10), %rcx
subq %r8, %rcx
imulq %rsi, %rcx
addq %rax, %rcx
js 0x2a583
cmpl $0x2, %r11d
jb 0x2a569
addl $-0x2, %r11d
leaq 0x5d05b3(%rip), %rax    # 0x5fa950
movl (%rax), %ecx
leaq (,%r11,8), %r15
leaq (,%r11,4), %r10
xorl %r14d, %r14d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0x0, (%rsp)
leaq 0x3d140b(%rip), %rsi    # 0x3fb7d0
leaq 0x5d4814(%rip), %rdi    # 0x5febe0
movq %r10, 0x8(%rsp)
leaq (%r10,%r14), %rdx
movl (%rsi,%rdx), %edx
testl %ecx, %ecx
jle 0x2a409
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
mulsd %xmm2, %xmm0
ucomisd (%rdi,%rbp,8), %xmm0
jb 0x2a4d9
leaq 0x5dc7e7(%rip), %rdx    # 0x606be0
movsd (%rdx,%rbp,8), %xmm1
ucomisd %xmm0, %xmm1
jae 0x2a42e
jmp 0x2a4d9
sarl $0x8, %edx
leaq 0x24165d(%rip), %r8     # 0x26ba70
cmpl %edx, (%r8,%rbp,4)
jg 0x2a4d9
leaq 0x24565c(%rip), %r8     # 0x26fa80
cmpl (%r8,%rbp,4), %edx
jg 0x2a4d9
leaq (%r15,%r14,2), %rdx
movq (%r12,%rdx), %rdx
movswq (%r13,%rbp,2), %rsi
movslq (%rdx), %rdi
movslq 0x4(%rdx), %rdx
shlq $0x5, %rsi
leaq 0x18e602(%rip), %rbx    # 0x1b8a50
movslq (%rsi,%rbx), %r8
movslq 0x4(%rsi,%rbx), %r9
movswq 0x8(%rsi,%rbx), %rsi
shlq $0x5, %rsi
movslq (%rsi,%rbx), %r10
subq %r8, %r10
subq %r9, %rdx
imulq %r10, %rdx
subq %rdi, %r8
movslq 0x4(%rsi,%rbx), %rsi
subq %r9, %rsi
imulq %r8, %rsi
addq %rdx, %rsi
jns 0x2a4c6
leaq (%r14,%r14), %rbx
movl %r11d, %edi
movq %r12, %r13
movq %r11, %r12
callq 0x2a603
movsd 0x4cc5b(%rip), %xmm2    # 0x770f8
movq %r12, %r11
movq %r13, %r12
leaq 0x20e5a6(%rip), %r13    # 0x238a50
addq %r15, %rbx
movq (%r12,%rbx), %rax
movw $0xffff, 0x1e(%rax)     # imm = 0xFFFF
incl (%rsp)
leaq 0x5d048f(%rip), %rax    # 0x5fa950
movl (%rax), %ecx
movl %r11d, %eax
leaq 0x3d1303(%rip), %rsi    # 0x3fb7d0
leaq 0x5d470c(%rip), %rdi    # 0x5febe0
movq 0x8(%rsp), %r10
leaq -0x1(%r11), %rdx
addq $-0x4, %r14
testq %r11, %r11
movq %rdx, %r11
jg 0x2a3d1
testl %eax, %eax
leaq 0x3dbaea(%rip), %rbx    # 0x405fe0
leaq 0x3d32d3(%rip), %r15    # 0x3fd7d0
js 0x2a569
movl 0x3ad29f(%rip), %ecx    # 0x3d77a4
cmpl %ecx, %eax
jge 0x2a560
movl %eax, %edx
leaq (,%rdx,4), %rsi
shlq $0x3, %rdx
xorl %edi, %edi
movl %eax, %r8d
leaq (%rdx,%rdi,2), %r9
movq (%r12,%r9), %r9
cmpw $0x0, 0x1e(%r9)
js 0x2a556
cmpl %eax, %r8d
jge 0x2a553
movslq %r8d, %r10
movq %r9, (%r12,%r10,8)
leaq (%rsi,%rdi), %r9
leaq 0x3d128d(%rip), %r14    # 0x3fb7d0
movl (%r14,%r9), %r11d
movl %r11d, (%r14,%r10,4)
movl (%r15,%r9), %r9d
movl %r9d, (%r15,%r10,4)
incl %r8d
addq $0x4, %rdi
incl %eax
cmpl %eax, %ecx
jg 0x2a51c
subl (%rsp), %ecx
movl %ecx, 0x3ad23b(%rip)    # 0x3d77a4
movzwl 0x3ad22e(%rip), %eax    # 0x3d779e
decl %eax
movw %ax, 0x3ad225(%rip)     # 0x3d779e
movswl %ax, %edi
callq 0x2d591
jmp 0x2a58e
movl %edi, 0x3ad21b(%rip)    # 0x3d77a4
callq 0x2a603
movl 0x3ad20f(%rip), %r11d   # 0x3d77a4
movzwl 0x3ad202(%rip), %eax    # 0x3d779e
testl %r11d, %r11d
movsd 0x4cb51(%rip), %xmm2    # 0x770f8
jle 0x2a5b2
testw %ax, %ax
jg 0x2a325
testl %r11d, %r11d
jle 0x2a5ef
decl %r11d
movl %r11d, 0x3ad1e3(%rip)   # 0x3d77a4
movl %r11d, %edi
callq 0x2a603
movl 0x3ad1d4(%rip), %r11d   # 0x3d77a4
testl %r11d, %r11d
jg 0x2a5b7
jmp 0x2a5e8
decl %eax
movw %ax, 0x3ad1be(%rip)     # 0x3d779e
movswl %ax, %edi
callq 0x2d591
movzwl 0x3ad1af(%rip), %eax    # 0x3d779e
testw %ax, %ax
jg 0x2a5d7
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq