// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: grouscan
static void grouscan(int dax1, int dax2, int sectnum, unsigned char dastat)
{
	int i, j, l, x, y, dx, dy, wx, wy, y1, y2, daz;
	int daslope, dasqr;
	int shoffs, shinc, m1, m2;
	intptr_t *mptr1, *mptr2, *nptr1, *nptr2;
	walltype *wal;
	sectortype *sec;

	sec = &sector[sectnum];

	if (dastat == 0)
	{
		if (globalposz <= getceilzofslope(sectnum,globalposx,globalposy))
			return;  //Back-face culling
		globalorientation = sec->ceilingstat;
		globalpicnum = sec->ceilingpicnum;
		globalshade = sec->ceilingshade;
		globalpal = sec->ceilingpal;
		daslope = sec->ceilingheinum;
		daz = sec->ceilingz;
	}
	else
	{
		if (globalposz >= getflorzofslope(sectnum,globalposx,globalposy))
			return;  //Back-face culling
		globalorientation = sec->floorstat;
		globalpicnum = sec->floorpicnum;
		globalshade = sec->floorshade;
		globalpal = sec->floorpal;
		daslope = sec->floorheinum;
		daz = sec->floorz;
	}

	if (palookup[globalpal] == 0) globalpal = 0;
	if ((picanm[globalpicnum]&192) != 0) globalpicnum += animateoffs(globalpicnum,sectnum);
	setgotpic(globalpicnum);
	if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) return;
	if (waloff[globalpicnum] == 0) loadtile(globalpicnum);

	wal = &wall[sec->wallptr];
	wx = wall[wal->point2].x - wal->x;
	wy = wall[wal->point2].y - wal->y;
	dasqr = krecipasm(nsqrtasm(wx*wx+wy*wy));
	i = mulscale21(daslope,dasqr);
	wx *= i; wy *= i;

	globalx = -mulscale19(singlobalang,xdimenrecip);
	globaly = mulscale19(cosglobalang,xdimenrecip);
	globalx1 = (globalposx<<8);
	globaly1 = -(globalposy<<8);
	i = (dax1-halfxdimen)*xdimenrecip;
	globalx2 = mulscale16(cosglobalang<<4,viewingrangerecip) - mulscale27(singlobalang,i);
	globaly2 = mulscale16(singlobalang<<4,viewingrangerecip) + mulscale27(cosglobalang,i);
	globalzd = (xdimscale<<9);
	globalzx = -dmulscale17(wx,globaly2,-wy,globalx2) + mulscale10(1-globalhoriz,globalzd);
	globalz = -dmulscale25(wx,globaly,-wy,globalx);

	if (globalorientation&64)  //Relative alignment
	{
		dx = mulscale14(wall[wal->point2].x-wal->x,dasqr);
		dy = mulscale14(wall[wal->point2].y-wal->y,dasqr);

		i = nsqrtasm(daslope*daslope+16777216);

		x = globalx; y = globaly;
		globalx = dmulscale16(x,dx,y,dy);
		globaly = mulscale12(dmulscale16(-y,dx,x,dy),i);

		x = ((wal->x-globalposx)<<8); y = ((wal->y-globalposy)<<8);
		globalx1 = dmulscale16(-x,dx,-y,dy);
		globaly1 = mulscale12(dmulscale16(-y,dx,x,dy),i);

		x = globalx2; y = globaly2;
		globalx2 = dmulscale16(x,dx,y,dy);
		globaly2 = mulscale12(dmulscale16(-y,dx,x,dy),i);
	}
	if (globalorientation&0x4)
	{
		i = globalx; globalx = -globaly; globaly = -i;
		i = globalx1; globalx1 = globaly1; globaly1 = i;
		i = globalx2; globalx2 = -globaly2; globaly2 = -i;
	}
	if (globalorientation&0x10) { globalx1 = -globalx1, globalx2 = -globalx2, globalx = -globalx; }
	if (globalorientation&0x20) { globaly1 = -globaly1, globaly2 = -globaly2, globaly = -globaly; }

	daz = dmulscale9(wx,globalposy-wal->y,-wy,globalposx-wal->x) + ((daz-globalposz)<<8);
	globalx2 = mulscale20(globalx2,daz); globalx = mulscale28(globalx,daz);
	globaly2 = mulscale20(globaly2,-daz); globaly = mulscale28(globaly,-daz);

	i = 8-(picsiz[globalpicnum]&15); j = 8-(picsiz[globalpicnum]>>4);
	if (globalorientation&8) { i++; j++; }
	globalx1 <<= (i+12); globalx2 <<= i; globalx <<= i;
	globaly1 <<= (j+12); globaly2 <<= j; globaly <<= j;

	if (dastat == 0)
	{
		globalx1 += (((int)sec->ceilingxpanning)<<24);
		globaly1 += (((int)sec->ceilingypanning)<<24);
	}
	else
	{
		globalx1 += (((int)sec->floorxpanning)<<24);
		globaly1 += (((int)sec->floorypanning)<<24);
	}

	asm1 = -(globalzd>>(16-BITSOFPRECISION));

	globvis = globalvisibility;
	if (sec->visibility != 0) globvis = mulscale4(globvis,(int)((unsigned char)(sec->visibility+16)));
	globvis = mulscale13(globvis,daz);
	globvis = mulscale16(globvis,xdimscale);

	setupslopevlin(((int)(picsiz[globalpicnum]&15))+(((int)(picsiz[globalpicnum]>>4))<<8),(void *)waloff[globalpicnum],-ylookup[1]);

	l = (globalzd>>16);

	assert(SLOPALOOKUPSIZ - 4 - ydimen > 0);

	shinc = mulscale16(globalz,xdimenscale);
	if (shinc > 0) shoffs = (4<<15); else shoffs = ((SLOPALOOKUPSIZ-4-ydimen)<<15);
	if (dastat == 0) y1 = umost[dax1]; else y1 = max(umost[dax1],dplc[dax1]);
	m1 = mulscale16(y1,globalzd) + (globalzx>>6);
		//Avoid visibility overflow by crossing horizon
	if (globalzd > 0) m1 += (globalzd>>16); else m1 -= (globalzd>>16);
	m2 = m1+l;
	mptr1 = &slopalookup[y1+(shoffs>>15)]; mptr2 = mptr1+1;

	assert(y1+(shoffs>>15) >= 0);
	assert(y1+(shoffs>>15) <= SLOPALOOKUPSIZ-2);

	for(x=dax1;x<=dax2;x++)
	{
		if (dastat == 0) { y1 = umost[x]; y2 = min(dmost[x],uplc[x])-1; }
		else { y1 = max(umost[x],dplc[x]); y2 = dmost[x]-1; }
		if (y1 <= y2)
		{
			assert(y1+(shoffs>>15) >= 0);
			assert(y1+(shoffs>>15) <= SLOPALOOKUPSIZ-1);
			assert(y2+(shoffs>>15) >= 0);
			assert(y2+(shoffs>>15) <= SLOPALOOKUPSIZ-1);

			nptr1 = &slopalookup[y1+(shoffs>>15)];
			nptr2 = &slopalookup[y2+(shoffs>>15)];
			while (nptr1 <= mptr1)
			{
				*mptr1-- = (intptr_t)palookup[globalpal] + (getpalookup((int)mulscale24(krecipasm(m1),globvis),globalshade)<<8);
				m1 -= l;
			}
			while (nptr2 >= mptr2)
			{
				*mptr2++ = (intptr_t)palookup[globalpal] + (getpalookup((int)mulscale24(krecipasm(m2),globvis),globalshade)<<8);
				m2 += l;
			}

			globalx3 = (globalx2>>10);
			globaly3 = (globaly2>>10);
			asm3 = mulscale16(y2,globalzd) + (globalzx>>6);
			slopevlin((void *)(ylookup[y2]+x+frameoffset),krecipasm((int)asm3>>3),nptr2,y2-y1+1,globalx1,globaly1);

			if ((x&15) == 0) faketimerhandler();
		}
		globalx2 += globalx;
		globaly2 += globaly;
		globalzx += globalz;
		shoffs += shinc;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %edx, %r13d
movl %esi, 0x10(%rsp)
movl %edi, %ebp
movl 0x22deea(%rip), %ebx    # 0x26ba60
movl 0x1fced4(%rip), %esi    # 0x23aa50
movl 0x1fced2(%rip), %edx    # 0x23aa54
movl %ecx, 0x14(%rsp)
testl %ecx, %ecx
movl %edx, 0x8(%rsp)
movswl %r13w, %edi
movl %esi, %r12d
je 0x3dbc3
callq 0x3aaf4
cmpl %eax, %ebx
jge 0x3e61b
movl $0x8, %ecx
movl $0x1a, %edx
movl $0x1d, %esi
movl $0x1c, %edi
movl $0x18, %eax
movl $0xe, %r8d
jmp 0x3dbef
callq 0x3abce
cmpl %eax, %ebx
jle 0x3e61b
movl $0x4, %ecx
movl $0x12, %edx
movl $0x15, %esi
movl $0x14, %edi
movl $0x10, %eax
movl $0xc, %r8d
movslq %r13d, %r9
leaq (%r9,%r9,4), %r9
leaq 0x205e63(%rip), %r10    # 0x243a60
leaq (%r10,%r9,8), %rbx
movswl (%rbx,%r8), %r8d
movl %r8d, 0x3d23f3(%rip)    # 0x410000
movzwl (%rbx,%rax), %r14d
movswq %r14w, %rax
movw %ax, 0x3d23f3(%rip)     # 0x410010
movsbl (%rbx,%rdi), %edi
movl %edi, 0x3d6c05(%rip)    # 0x41482c
movzbl (%rbx,%rsi), %esi
movl %esi, 0x3d23d3(%rip)    # 0x410004
leaq 0x35aea8(%rip), %rdi    # 0x398ae0
cmpq $0x0, (%rdi,%rsi,8)
jne 0x3dc49
movl $0x0, 0x3d23bb(%rip)    # 0x410004
movswl (%rbx,%rdx), %r15d
movl (%rbx,%rcx), %r13d
leaq 0x1fce07(%rip), %rcx    # 0x23aa60
testb $-0x40, (%rcx,%rax,4)
je 0x3dc79
movswl %r14w, %edi
xorl %esi, %esi
callq 0x242cd
addl %eax, %r14d
movw %r14w, 0x3d239b(%rip)   # 0x410010
movswq %r14w, %rax
movswl %r14w, %edi
leaq 0x3f0abc(%rip), %rcx    # 0x42e740
cmpb $-0x39, (%rax,%rcx)
ja 0x3dc8e
movb $-0x39, (%rax,%rcx)
movl %edi, %ecx
andl $0x7, %ecx
leaq 0x66b06(%rip), %rdx     # 0xa47a0
movb (%rcx,%rdx), %cl
movl %edi, %edx
sarl $0x3, %edx
movslq %edx, %rdx
leaq 0x3f0604(%rip), %rsi    # 0x42e2b0
orb %cl, (%rdx,%rsi)
leaq 0x3d236a(%rip), %rcx    # 0x410020
cmpw $0x0, (%rcx,%rax,2)
jle 0x3e61b
leaq 0x3c3b18(%rip), %rcx    # 0x4017e0
cmpw $0x0, (%rcx,%rax,2)
jle 0x3e61b
movl %r13d, 0x44(%rsp)
leaq 0x35b601(%rip), %rcx    # 0x3992e0
cmpq $0x0, (%rcx,%rax,8)
jne 0x3dcfc
callq 0x2fc7e
movl 0x1fcd5e(%rip), %r12d   # 0x23aa50
movl 0x1fcd5c(%rip), %eax    # 0x23aa54
movl %eax, 0x8(%rsp)
movl %r12d, 0x20(%rsp)
movswq (%rbx), %rax
shlq $0x5, %rax
leaq 0x17ad40(%rip), %rdx    # 0x1b8a50
movswq 0x8(%rax,%rdx), %rsi
shlq $0x5, %rsi
movslq (%rsi,%rdx), %r13
movslq (%rax,%rdx), %rcx
movq %rcx, 0x18(%rsp)
subq %rcx, %r13
movq %rsi, 0x58(%rsp)
movl 0x4(%rsi,%rdx), %edi
movslq 0x4(%rax,%rdx), %rax
movq %rax, 0x30(%rsp)
subl %eax, %edi
movl %r13d, %ecx
imull %r13d, %ecx
movl %edi, %eax
imull %eax, %eax
addl %ecx, %eax
movl %eax, %ecx
shrl $0x18, %ecx
orl $0x1000, %ecx           # imm = 0x1000
movl %eax, %edx
shrl $0xc, %edx
cmpl $0x1000000, %eax        # imm = 0x1000000
cmovael %ecx, %edx
leaq 0x418194(%rip), %rcx    # 0x455f00
movzwl (%rcx,%rdx,2), %ecx
shrl %cl, %eax
leaq 0x41a387(%rip), %rdx    # 0x458100
movzwl (%rdx,%rax,2), %eax
shrl $0x8, %ecx
shrl %cl, %eax
cvtsi2ss %eax, %xmm0
movslq 0x231ceb(%rip), %rcx    # 0x26fa78
movslq 0x3f8808(%rip), %r14    # 0x43659c
movslq 0x231cd5(%rip), %rdx    # 0x26fa70
movslq 0x3db0c2(%rip), %rax    # 0x418e64
movl %ebp, 0x3c(%rsp)
movslq %ebp, %r11
movq %r11, 0x28(%rsp)
subq %rax, %r11
imulq %r14, %r11
movl %edx, %eax
shll $0x4, %eax
movslq 0x390f77(%rip), %rsi    # 0x3ced38
cltq
imulq %rsi, %rax
shrq $0x10, %rax
movq %rcx, %r8
imulq %r11, %r8
shrq $0x1b, %r8
subl %r8d, %eax
imulq %rdx, %r11
imulq %r14, %rdx
imulq %rcx, %r14
shll $0x4, %ecx
movslq %ecx, %r8
imulq %rsi, %r8
movd %xmm0, %ecx
shrq $0x10, %r8
shrq $0x1b, %r11
addl %r8d, %r11d
movl %ecx, %esi
shrl $0xa, %esi
andl $0x1ffc, %esi           # imm = 0x1FFC
leaq 0x40e050(%rip), %r8     # 0x44be60
movl (%rsi,%r8), %esi
addl $0x800000, %ecx         # imm = 0x800000
shrl $0x17, %ecx
sarl %cl, %esi
movslq %esi, %rsi
movslq %r15d, %rcx
imulq %rsi, %rcx
shrq $0x15, %rcx
movl %r13d, %r8d
imull %ecx, %r8d
imull %ecx, %edi
negl %edi
movslq %r8d, %r10
movslq %r11d, %rcx
movq %rcx, 0x48(%rsp)
imulq %r10, %rcx
movslq %edi, %rdi
movslq %eax, %r8
movq %r8, 0x50(%rsp)
imulq %rdi, %r8
addq %rcx, %r8
movslq 0x23dc3b(%rip), %rcx    # 0x27ba9c
movl $0x1, %r9d
subq %rcx, %r9
movslq 0x390ec3(%rip), %rcx    # 0x3ced34
movq %rcx, 0x70(%rsp)
movl %ecx, %r12d
shll $0x9, %r12d
movslq %r12d, %rcx
imulq %r9, %rcx
shrq $0x11, %r8
shrq $0xa, %rcx
subl %r8d, %ecx
movl %ecx, 0x415c67(%rip)    # 0x453afc
shrq $0x13, %r14
negl %r14d
shrq $0x13, %rdx
movslq %edx, %rbp
movq %rbp, %rcx
movq %r10, 0x68(%rsp)
imulq %r10, %rcx
movslq %r14d, %r9
movq %rdi, %r8
imulq %r9, %r8
addq %rcx, %r8
shrq $0x19, %r8
negl %r8d
movl %r8d, 0x415c3e(%rip)    # 0x453b08
movl %r12d, 0x40(%rsp)
movl %r12d, 0x415c16(%rip)   # 0x453aec
movl 0x3d2124(%rip), %ecx    # 0x410000
movl %ecx, 0x4(%rsp)
testb $0x40, %cl
jne 0x3df01
movl 0x20(%rsp), %r12d
movl %r12d, %r13d
shll $0x8, %r13d
movl 0x8(%rsp), %ecx
movl %ecx, %esi
shll $0x8, %esi
negl %esi
jmp 0x3e038
imull %r15d, %r15d
addl $0x1000000, %r15d       # imm = 0x1000000
movl %r15d, %eax
shrl $0x17, %eax
andl $-0x2, %eax
leaq 0x417fe4(%rip), %rcx    # 0x455f00
movzwl 0x2000(%rcx,%rax), %ecx
shrl %cl, %r15d
leaq 0x17ab22(%rip), %rax    # 0x1b8a50
movq 0x58(%rsp), %r8
movslq 0x4(%r8,%rax), %rax
movq 0x30(%rsp), %r10
subq %r10, %rax
leaq 0x41a1b9(%rip), %r8     # 0x458100
movzwl (%r8,%r15,2), %r15d
imulq %rsi, %r13
shrq $0xe, %r13
movslq %r13d, %r11
imulq %rsi, %rax
negl %edx
movslq %edx, %rdx
imulq %r11, %rdx
movq 0x18(%rsp), %rsi
movl %esi, %r8d
movl 0x20(%rsp), %r12d
subl %r12d, %r8d
shll $0x8, %r8d
movslq %r8d, %rsi
negl %r8d
movslq %r8d, %r8
imulq %r11, %r8
movq %r11, %r13
imulq %r9, %r13
shrq $0xe, %rax
movslq %eax, %r14
imulq %r14, %rbp
addq %r13, %rbp
imulq %r14, %r9
addq %rdx, %r9
movl 0x8(%rsp), %eax
subl %r10d, %eax
shll $0x8, %eax
cltq
movq %r14, %r13
imulq %rax, %r13
addq %r8, %r13
imulq %r11, %rax
imulq %r14, %rsi
addq %rax, %rsi
movq %r14, %rax
movq 0x48(%rsp), %rdx
imulq %rdx, %rax
negl %edx
movslq %edx, %rdx
imulq %r11, %rdx
movq 0x50(%rsp), %r8
imulq %r8, %r11
addq %r11, %rax
shrl $0x8, %ecx
shrl %cl, %r15d
imulq %r8, %r14
addq %rdx, %r14
shrq $0x10, %r9
movslq %r9d, %rdx
imulq %r15, %rdx
shrq $0x10, %rsi
movslq %esi, %rsi
imulq %r15, %rsi
shrq $0x10, %r14
movslq %r14d, %r11
imulq %r15, %r11
shrq $0x10, %rbp
movl %ebp, 0x415ae5(%rip)    # 0x453b00
shrq $0xc, %rdx
movl %edx, 0x415adf(%rip)    # 0x453b04
shrq $0x10, %r13
shrq $0xc, %rsi
shrq $0x10, %rax
shrq $0xc, %r11
movl %ebp, %r14d
testb $0x4, 0x4(%rsp)
jne 0x3e04c
movq 0x18(%rsp), %r10
movl %esi, %r8d
movl %r13d, %esi
jmp 0x3e076
movq 0x18(%rsp), %r10
movl %edx, %ecx
negl %ecx
negl %r14d
movl %r13d, 0x3d67dd(%rip)   # 0x41483c
movl %r11d, %r9d
negl %r9d
negl %eax
movl %r14d, %edx
movl %eax, %r11d
movl %r13d, %r8d
movl %ecx, %r14d
movl %r9d, %eax
testb $0x10, 0x4(%rsp)
movl 0x44(%rsp), %r12d
movq 0x30(%rsp), %r13
movq %rbx, 0x60(%rsp)
je 0x3e099
negl %esi
movl %esi, 0x3d67a4(%rip)    # 0x414838
negl %eax
negl %r14d
xorl %r15d, %r15d
cmpb $0x0, 0x14(%rsp)
setne %r15b
movl %r8d, %r9d
negl %r9d
movl %r11d, %ebp
negl %ebp
movl %edx, %ecx
negl %ecx
movl 0x4(%rsp), %ebx
testb $0x20, %bl
cmovel %r8d, %r9d
cmovel %edx, %ecx
cmovel %r11d, %ebp
movl 0x8(%rsp), %edx
subl %r13d, %edx
movl 0x20(%rsp), %r8d
subl %r10d, %r8d
movslq %edx, %rdx
movq 0x68(%rsp), %r10
imulq %rdx, %r10
movslq %r8d, %rdx
imulq %rdx, %rdi
addq %r10, %rdi
shrq $0x9, %rdi
subl 0x22d96a(%rip), %r12d   # 0x26ba60
shll $0x8, %r12d
addl %edi, %r12d
movslq %eax, %r13
movslq %r12d, %r11
imulq %r11, %r13
shrq $0x14, %r13
movslq %r14d, %r8
imulq %r11, %r8
shrq $0x1c, %r8
movl %r11d, %eax
negl %eax
movslq %ebp, %r12
cltq
imulq %rax, %r12
shrq $0x14, %r12
movslq %ecx, %r14
imulq %rax, %r14
shrq $0x1c, %r14
movswq 0x3d1ed5(%rip), %rdx    # 0x410010
leaq 0x3d670e(%rip), %rax    # 0x414850
movq %rdx, 0x8(%rsp)
movzbl (%rdx,%rax), %ebp
movl %ebp, %r10d
andl $0xf, %r10d
movl %ebp, %edi
shrl $0x4, %edi
andl $0x8, %ebx
cmpl $0x1, %ebx
movl $0x9, %eax
sbbl $0x0, %eax
movl %eax, %edx
subl %r10d, %edx
leal 0xc(%rdx), %ecx
shll %cl, %esi
movl %edx, %ecx
shll %cl, %r13d
shll %cl, %r8d
subl %edi, %eax
movl %r13d, 0x3d66c0(%rip)   # 0x414840
movl %r8d, 0x415979(%rip)    # 0x453b00
leal 0xc(%rax), %ecx
shll %cl, %r9d
movl %eax, %ecx
shll %cl, %r12d
shll %cl, %r14d
movl %r12d, 0x3d66a8(%rip)   # 0x414844
movl %r14d, 0x415961(%rip)   # 0x453b04
movq 0x60(%rsp), %rcx
movzbl 0x16(%rcx,%r15,8), %eax
shll $0x18, %eax
addl %esi, %eax
movl %eax, 0x3d667f(%rip)    # 0x414838
movzbl 0x17(%rcx,%r15,8), %eax
shll $0x18, %eax
addl %r9d, %eax
movl %eax, 0x3d6671(%rip)    # 0x41483c
movl 0x40(%rsp), %eax
sarl $0xd, %eax
negl %eax
movl %eax, 0x3d8a7a(%rip)    # 0x416c54
movb 0x20(%rcx), %cl
movl 0x390b5d(%rip), %eax    # 0x3ced40
testb %cl, %cl
je 0x3e1f8
movslq %eax, %rdx
addb $0x10, %cl
movzbl %cl, %eax
imulq %rdx, %rax
shrq $0x4, %rax
movq 0x28(%rsp), %r15
cltq
imulq %rax, %r11
shrq $0xd, %r11
movslq %r11d, %rax
imulq 0x70(%rsp), %rax
shrq $0x10, %rax
movl %eax, 0x3d6616(%rip)    # 0x414830
shll $0x4, %ebp
andl $0xf00, %ebp            # imm = 0xF00
orl %r10d, %ebp
leaq 0x35b0b3(%rip), %rax    # 0x3992e0
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
xorl %edx, %edx
subl 0x3d8a66(%rip), %edx    # 0x416ca4
movl %ebp, %edi
callq 0x6fb35
movl 0x23d849(%rip), %eax    # 0x27ba94
cmpl $0x1dfc, %eax           # imm = 0x1DFC
jge 0x3e687
movslq 0x4158ab(%rip), %rcx    # 0x453b08
movslq 0x23d834(%rip), %r8     # 0x27ba98
imulq %rcx, %r8
shrq $0x10, %r8
shll $0xf, %eax
movl $0xefe0000, %ecx        # imm = 0xEFE0000
subl %eax, %ecx
testl %r8d, %r8d
movl $0x20000, %r9d          # imm = 0x20000
cmovlel %ecx, %r9d
leaq 0x395906(%rip), %r10    # 0x3d3b90
movzwl (%r10,%r15,2), %eax
cmpb $0x0, 0x14(%rsp)
movl 0x3c(%rsp), %esi
je 0x3e2ac
leaq 0x4139cf(%rip), %rcx    # 0x451c70
movzwl (%rcx,%r15,2), %ecx
cmpw %cx, %ax
cmovlel %ecx, %eax
movswl %ax, %edx
movl %r9d, %ecx
sarl $0xf, %ecx
addl %edx, %ecx
js 0x3e6a6
cmpl $0x1dfe, %ecx           # imm = 0x1DFE
ja 0x3e6c5
cmpl 0x10(%rsp), %esi
jg 0x3e61b
movslq 0x415812(%rip), %rdx    # 0x453aec
movl %edx, %r12d
sarl $0x10, %r12d
movl %ecx, %ecx
leaq 0x3feb76(%rip), %rsi    # 0x43ce60
leaq (%rsi,%rcx,8), %rbx
leaq (%rsi,%rcx,8), %r13
addq $0x8, %r13
movl %edx, %ecx
shrl $0x10, %ecx
movl %r12d, %edi
negl %edi
testl %edx, %edx
cmovgl %ecx, %edi
movswq %ax, %rax
imulq %rdx, %rax
shrq $0x10, %rax
movl 0x4157e5(%rip), %esi    # 0x453afc
movl %esi, %ebp
sarl $0x6, %ebp
addl %edi, %ebp
addl %eax, %ebp
leal (%r12,%rbp), %r14d
incl 0x10(%rsp)
leaq 0x397661(%rip), %rdi    # 0x3d5990
movq %r8, 0x18(%rsp)
movzwl (%r10,%r15,2), %eax
cmpb $0x0, 0x14(%rsp)
je 0x3e359
leaq 0x413929(%rip), %rcx    # 0x451c70
movzwl (%rcx,%r15,2), %ecx
cmpw %cx, %ax
cmovlel %ecx, %eax
movzwl (%rdi,%r15,2), %ecx
jmp 0x3e370
movzwl (%rdi,%r15,2), %edx
leaq 0x411b0b(%rip), %rcx    # 0x44fe70
movzwl (%rcx,%r15,2), %ecx
cmpw %cx, %dx
cmovll %edx, %ecx
cmpw %ax, %cx
jle 0x3e5e0
cwtl
movl %r9d, %edx
sarl $0xf, %edx
movl %edx, %edi
addl %eax, %edi
js 0x3e649
cmpl $0x1e00, %edi           # imm = 0x1E00
jae 0x3e668
movswl %cx, %ecx
leal -0x1(%rcx), %r10d
addl %r10d, %edx
cmpl $0x1e00, %edx           # imm = 0x1E00
jae 0x3e62a
movl %r10d, 0x30(%rsp)
movq %rcx, 0x20(%rsp)
movl %eax, 0x4(%rsp)
movl %r9d, 0x8(%rsp)
movq %r15, 0x28(%rsp)
movl %edi, %ecx
leaq 0x3fea93(%rip), %rax    # 0x43ce60
leaq (%rax,%rcx,8), %r9
cmpq %rbx, %r9
ja 0x3e468
movslq 0x3d1c23(%rip), %r10    # 0x410004
movslq 0x3d6448(%rip), %r11    # 0x414830
movl 0x3d643d(%rip), %r8d    # 0x41482c
movswl 0x3d6432(%rip), %edi    # 0x414828
decl %edi
xorps %xmm0, %xmm0
cvtsi2ss %ebp, %xmm0
movd %xmm0, %eax
movl %eax, %ecx
shrl $0xa, %ecx
andl $0x1ffc, %ecx           # imm = 0x1FFC
leaq 0x40da4b(%rip), %r15    # 0x44be60
movl (%rcx,%r15), %r15d
leal 0x800000(%rax), %ecx
shrl $0x17, %ecx
sarl %cl, %r15d
sarl $0x1f, %eax
xorl %r15d, %eax
movslq %eax, %rcx
imulq %r11, %rcx
shrq $0x18, %rcx
sarl $0x8, %ecx
addl %r8d, %ecx
testl %ecx, %ecx
jg 0x3e442
xorl %ecx, %ecx
cmpl %edi, %ecx
jl 0x3e448
movl %edi, %ecx
shll $0x8, %ecx
movslq %ecx, %rax
leaq 0x35a68b(%rip), %rcx    # 0x398ae0
addq (%rcx,%r10,8), %rax
movq %rax, (%rbx)
addq $-0x8, %rbx
subl %r12d, %ebp
cmpq %rbx, %r9
jbe 0x3e3f8
movl %edx, %ecx
leaq 0x3fe9ef(%rip), %rax    # 0x43ce60
leaq (%rax,%rcx,8), %rdx
cmpq %r13, %rdx
jae 0x3e484
movq 0x28(%rsp), %r15
jmp 0x3e519
movslq 0x3d1b79(%rip), %r9     # 0x410004
movslq 0x3d639e(%rip), %r10    # 0x414830
movl 0x3d6393(%rip), %r8d    # 0x41482c
movswl 0x3d6388(%rip), %edi    # 0x414828
decl %edi
movq 0x28(%rsp), %r15
xorps %xmm0, %xmm0
cvtsi2ss %r14d, %xmm0
movd %xmm0, %eax
movl %eax, %ecx
shrl $0xa, %ecx
andl $0x1ffc, %ecx           # imm = 0x1FFC
leaq 0x40d99b(%rip), %r11    # 0x44be60
movl (%rcx,%r11), %r11d
leal 0x800000(%rax), %ecx
shrl $0x17, %ecx
sarl %cl, %r11d
sarl $0x1f, %eax
xorl %r11d, %eax
movslq %eax, %rcx
imulq %r10, %rcx
shrq $0x18, %rcx
sarl $0x8, %ecx
addl %r8d, %ecx
testl %ecx, %ecx
jg 0x3e4f2
xorl %ecx, %ecx
cmpl %edi, %ecx
jl 0x3e4f8
movl %edi, %ecx
shll $0x8, %ecx
movslq %ecx, %rax
leaq 0x35a5db(%rip), %rcx    # 0x398ae0
addq (%rcx,%r9,8), %rax
movq %rax, (%r13)
addq $0x8, %r13
addl %r12d, %r14d
cmpq %r13, %rdx
jae 0x3e4a7
movl 0x3d6321(%rip), %eax    # 0x414840
sarl $0xa, %eax
movl %eax, 0x4155cc(%rip)    # 0x453af4
movl 0x3d6316(%rip), %eax    # 0x414844
sarl $0xa, %eax
movl %eax, 0x4155c1(%rip)    # 0x453af8
movslq 0x4155ae(%rip), %rax    # 0x453aec
movslq 0x30(%rsp), %rcx
imulq %rcx, %rax
shrq $0x10, %rax
sarl $0x6, %esi
addl %eax, %esi
movslq %esi, %rax
movq %rax, 0x3d8706(%rip)    # 0x416c60
leaq 0x3d873f(%rip), %rsi    # 0x416ca0
movslq (%rsi,%rcx,4), %rdi
addq %r15, %rdi
addq 0x399221(%rip), %rdi    # 0x3d7790
sarl $0x3, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movd %xmm0, %esi
movl %esi, %eax
shrl $0xa, %eax
andl $0x1ffc, %eax           # imm = 0x1FFC
leaq 0x40d8d2(%rip), %rcx    # 0x44be60
movl (%rax,%rcx), %eax
leal 0x800000(%rsi), %ecx
shrl $0x17, %ecx
sarl %cl, %eax
sarl $0x1f, %esi
xorl %eax, %esi
movq 0x20(%rsp), %rcx
subl 0x4(%rsp), %ecx
movl 0x3d6287(%rip), %r8d    # 0x414838
movl 0x3d6284(%rip), %r9d    # 0x41483c
callq 0x6fb56
testb $0xf, %r15b
jne 0x3e5c8
callq 0xacd7
movq 0x18(%rsp), %r8
movl 0x8(%rsp), %r9d
leaq 0x3955b7(%rip), %r10    # 0x3d3b90
leaq 0x3973b0(%rip), %rdi    # 0x3d5990
movl 0x41551a(%rip), %eax    # 0x453b00
addl %eax, 0x3d6254(%rip)    # 0x414840
movl 0x415512(%rip), %eax    # 0x453b04
addl %eax, 0x3d624c(%rip)    # 0x414844
movl 0x4154fe(%rip), %esi    # 0x453afc
addl 0x415504(%rip), %esi    # 0x453b08
movl %esi, 0x4154f2(%rip)    # 0x453afc
addl %r8d, %r9d
incq %r15
cmpl %r15d, 0x10(%rsp)
jne 0x3e334
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x39103(%rip), %rdi     # 0x77734
leaq 0x38bd6(%rip), %rsi     # 0x7720e
leaq 0x3906c(%rip), %rcx     # 0x776ab
movl $0x8a5, %edx            # imm = 0x8A5
callq 0x61b0
leaq 0x39087(%rip), %rdi     # 0x776d7
leaq 0x38bb7(%rip), %rsi     # 0x7720e
leaq 0x3904d(%rip), %rcx     # 0x776ab
movl $0x8a2, %edx            # imm = 0x8A2
callq 0x61b0
leaq 0x390a1(%rip), %rdi     # 0x77710
leaq 0x38b98(%rip), %rsi     # 0x7720e
leaq 0x3902e(%rip), %rcx     # 0x776ab
movl $0x8a3, %edx            # imm = 0x8A3
callq 0x61b0
leaq 0x38ffd(%rip), %rdi     # 0x7768b
leaq 0x38b79(%rip), %rsi     # 0x7720e
leaq 0x3900f(%rip), %rcx     # 0x776ab
movl $0x88e, %edx            # imm = 0x88E
callq 0x61b0
leaq 0x3902a(%rip), %rdi     # 0x776d7
leaq 0x38b5a(%rip), %rsi     # 0x7720e
leaq 0x38ff0(%rip), %rcx     # 0x776ab
movl $0x899, %edx            # imm = 0x899
callq 0x61b0
leaq 0x39020(%rip), %rdi     # 0x776ec
leaq 0x38b3b(%rip), %rsi     # 0x7720e
leaq 0x38fd1(%rip), %rcx     # 0x776ab
movl $0x89a, %edx            # imm = 0x89A
callq 0x61b0