// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: wallmost
int wallmost(short *mostbuf, int w, int sectnum, unsigned char dastat)
{
	int bad, i, j, t, y, z, inty, intz, xcross, yinc, fw;
	int x1, y1, z1, x2, y2, z2, xv, yv, dx, dy, dasqr, oz1, oz2;
	int s1, s2, s3, s4, ix1, ix2, iy1, iy2;

	if (dastat == 0)
	{
		z = sector[sectnum].ceilingz-globalposz;
		if ((sector[sectnum].ceilingstat&2) == 0) return(owallmost(mostbuf,w,z));
	}
	else
	{
		z = sector[sectnum].floorz-globalposz;
		if ((sector[sectnum].floorstat&2) == 0) return(owallmost(mostbuf,w,z));
	}

	i = thewall[w];
	if (i == sector[sectnum].wallptr) return(owallmost(mostbuf,w,z));

	x1 = wall[i].x; x2 = wall[wall[i].point2].x-x1;
	y1 = wall[i].y; y2 = wall[wall[i].point2].y-y1;

	fw = sector[sectnum].wallptr; i = wall[fw].point2;
	dx = wall[i].x-wall[fw].x; dy = wall[i].y-wall[fw].y;
	dasqr = krecipasm(nsqrtasm(dx*dx+dy*dy));

	if (xb1[w] == 0)
		{ xv = cosglobalang+sinviewingrangeglobalang; yv = singlobalang-cosviewingrangeglobalang; }
	else
		{ xv = x1-globalposx; yv = y1-globalposy; }
	i = xv*(y1-globalposy)-yv*(x1-globalposx); j = yv*x2-xv*y2;
	if (klabs(j) > klabs(i>>3)) i = divscale28(i,j);
	if (dastat == 0)
	{
		t = mulscale15(sector[sectnum].ceilingheinum,dasqr);
		z1 = sector[sectnum].ceilingz;
	}
	else
	{
		t = mulscale15(sector[sectnum].floorheinum,dasqr);
		z1 = sector[sectnum].floorz;
	}
	z1 = dmulscale24(dx*t,mulscale20(y2,i)+((y1-wall[fw].y)<<8),
						 -dy*t,mulscale20(x2,i)+((x1-wall[fw].x)<<8))+((z1-globalposz)<<7);


	if (xb2[w] == xdimen-1)
		{ xv = cosglobalang-sinviewingrangeglobalang; yv = singlobalang+cosviewingrangeglobalang; }
	else
		{ xv = (x2+x1)-globalposx; yv = (y2+y1)-globalposy; }
	i = xv*(y1-globalposy)-yv*(x1-globalposx); j = yv*x2-xv*y2;
	if (klabs(j) > klabs(i>>3)) i = divscale28(i,j);
	if (dastat == 0)
	{
		t = mulscale15(sector[sectnum].ceilingheinum,dasqr);
		z2 = sector[sectnum].ceilingz;
	}
	else
	{
		t = mulscale15(sector[sectnum].floorheinum,dasqr);
		z2 = sector[sectnum].floorz;
	}
	z2 = dmulscale24(dx*t,mulscale20(y2,i)+((y1-wall[fw].y)<<8),
						 -dy*t,mulscale20(x2,i)+((x1-wall[fw].x)<<8))+((z2-globalposz)<<7);


	s1 = mulscale20(globaluclip,yb1[w]); s2 = mulscale20(globaluclip,yb2[w]);
	s3 = mulscale20(globaldclip,yb1[w]); s4 = mulscale20(globaldclip,yb2[w]);
	bad = (z1<s1)+((z2<s2)<<1)+((z1>s3)<<2)+((z2>s4)<<3);

	ix1 = xb1[w]; ix2 = xb2[w];
	iy1 = yb1[w]; iy2 = yb2[w];
	oz1 = z1; oz2 = z2;

	if ((bad&3) == 3)
	{
		//clearbufbyte(&mostbuf[ix1],(ix2-ix1+1)*sizeof(mostbuf[0]),0L);
		for (i=ix1; i<=ix2; i++) mostbuf[i] = 0;
		return(bad);
	}

	if ((bad&12) == 12)
	{
		//clearbufbyte(&mostbuf[ix1],(ix2-ix1+1)*sizeof(mostbuf[0]),ydimen+(ydimen<<16));
		for (i=ix1; i<=ix2; i++) mostbuf[i] = ydimen;
		return(bad);
	}

	if (bad&3)
	{
			//inty = intz / (globaluclip>>16)
		t = divscale30(oz1-s1,s2-s1+oz1-oz2);
		inty = yb1[w] + mulscale30(yb2[w]-yb1[w],t);
		intz = oz1 + mulscale30(oz2-oz1,t);
		xcross = xb1[w] + scale(mulscale30(yb2[w],t),xb2[w]-xb1[w],inty);

		//t = divscale30((x1<<4)-xcross*yb1[w],xcross*(yb2[w]-yb1[w])-((x2-x1)<<4));
		//inty = yb1[w] + mulscale30(yb2[w]-yb1[w],t);
		//intz = z1 + mulscale30(z2-z1,t);

		if ((bad&3) == 2)
		{
			if (xb1[w] <= xcross) { z2 = intz; iy2 = inty; ix2 = xcross; }
			//clearbufbyte(&mostbuf[xcross+1],(xb2[w]-xcross)*sizeof(mostbuf[0]),0L);
			for (i=xcross+1; i<=xb2[w]; i++) mostbuf[i] = 0;
		}
		else
		{
			if (xcross <= xb2[w]) { z1 = intz; iy1 = inty; ix1 = xcross; }
			//clearbufbyte(&mostbuf[xb1[w]],(xcross-xb1[w]+1)*sizeof(mostbuf[0]),0L);
			for (i=xb1[w]; i<=xcross; i++) mostbuf[i] = 0;
		}
	}

	if (bad&12)
	{
			//inty = intz / (globaldclip>>16)
		t = divscale30(oz1-s3,s4-s3+oz1-oz2);
		inty = yb1[w] + mulscale30(yb2[w]-yb1[w],t);
		intz = oz1 + mulscale30(oz2-oz1,t);
		xcross = xb1[w] + scale(mulscale30(yb2[w],t),xb2[w]-xb1[w],inty);

		//t = divscale30((x1<<4)-xcross*yb1[w],xcross*(yb2[w]-yb1[w])-((x2-x1)<<4));
		//inty = yb1[w] + mulscale30(yb2[w]-yb1[w],t);
		//intz = z1 + mulscale30(z2-z1,t);

		if ((bad&12) == 8)
		{
			if (xb1[w] <= xcross) { z2 = intz; iy2 = inty; ix2 = xcross; }
			//clearbufbyte(&mostbuf[xcross+1],(xb2[w]-xcross)*sizeof(mostbuf[0]),ydimen+(ydimen<<16));
			for (i=xcross+1; i<=xb2[w]; i++) mostbuf[i] = ydimen;
		}
		else
		{
			if (xcross <= xb2[w]) { z1 = intz; iy1 = inty; ix1 = xcross; }
			//clearbufbyte(&mostbuf[xb1[w]],(xcross-xb1[w]+1)*sizeof(mostbuf[0]),ydimen+(ydimen<<16));
			for (i=xb1[w]; i<=xcross; i++) mostbuf[i] = ydimen;
		}
	}

	y = (scale(z1,xdimenscale,iy1)<<4);
	yinc = ((scale(z2,xdimenscale,iy2)<<4)-y) / (ix2-ix1+1);
	qinterpolatedown16short(&mostbuf[ix1],ix2-ix1+1,y+(globalhoriz<<16),yinc);

	if (mostbuf[ix1] < 0) mostbuf[ix1] = 0;
	if (mostbuf[ix1] > ydimen) mostbuf[ix1] = ydimen;
	if (mostbuf[ix2] < 0) mostbuf[ix2] = 0;
	if (mostbuf[ix2] > ydimen) mostbuf[ix2] = ydimen;

	return(bad);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movslq %edx, %rax
leaq (%rax,%rax,4), %rax
leaq 0x21f715(%rip), %r11    # 0x243a60
leaq (%r11,%rax,8), %r9
movl 0x24770a(%rip), %r8d    # 0x26ba60
testl %ecx, %ecx
je 0x2436a
movl 0x8(%r9), %edx
subl %r8d, %edx
testb $0x2, 0xe(%r9)
jne 0x24378
jmp 0x24392
movl 0x4(%r9), %edx
subl %r8d, %edx
testb $0x2, 0xc(%r9)
je 0x24392
movslq %esi, %r12
leaq 0x2146ce(%rip), %r10    # 0x238a50
movswq (%r10,%r12,2), %r10
movswq (%r11,%rax,8), %rax
cmpw %ax, %r10w
jne 0x243a5
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x24b5f
movl %ecx, 0x48(%rsp)
movq %rdi, 0x40(%rsp)
shlq $0x5, %r10
leaq 0x194697(%rip), %rcx    # 0x1b8a50
movl (%r10,%rcx), %esi
movl 0x4(%r10,%rcx), %ebp
movswq 0x8(%r10,%rcx), %rdx
shlq $0x5, %rdx
movl (%rdx,%rcx), %r14d
movl 0x4(%rdx,%rcx), %edi
movl %r14d, 0x4(%rsp)
subl %esi, %r14d
movl %edi, %r15d
subl %ebp, %r15d
shlq $0x5, %rax
movswq 0x8(%rax,%rcx), %rdx
shlq $0x5, %rdx
movl (%rax,%rcx), %r10d
movl 0x4(%rax,%rcx), %ebx
movl (%rdx,%rcx), %eax
movl 0x4(%rdx,%rcx), %r11d
movl %r10d, 0xc(%rsp)
subl %r10d, %eax
movl %ebx, 0x8(%rsp)
subl %ebx, %r11d
movl %eax, 0x24(%rsp)
movl %eax, %ecx
imull %eax, %ecx
movl %r11d, %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 0x431ac1(%rip), %rcx    # 0x455f00
movzwl (%rcx,%rdx,2), %ecx
shrl %cl, %eax
leaq 0x433cb4(%rip), %rdx    # 0x458100
movzwl (%rdx,%rax,2), %eax
shrl $0x8, %ecx
shrl %cl, %eax
cvtsi2ss %eax, %xmm0
movd %xmm0, %ecx
movl %ecx, %eax
shrl $0xa, %eax
andl $0x1ffc, %eax           # imm = 0x1FFC
leaq 0x4279f2(%rip), %rdx    # 0x44be60
movl (%rax,%rdx), %ebx
addl $0x800000, %ecx         # imm = 0x800000
shrl $0x17, %ecx
sarl %cl, %ebx
leaq 0x2475ed(%rip), %rax    # 0x26ba70
movq %r12, 0x50(%rsp)
movslq (%rax,%r12,4), %rax
movq %rax, 0x18(%rsp)
testq %rax, %rax
movl %edi, (%rsp)
je 0x244ba
movl 0x2165b1(%rip), %eax    # 0x23aa50
movl %esi, %r13d
subl %eax, %r13d
movl 0x2165a9(%rip), %ecx    # 0x23aa54
movl %ebp, %r12d
movl %ecx, 0x38(%rsp)
subl %ecx, %r12d
movl %r12d, %edx
jmp 0x244ea
movl 0x24b5b3(%rip), %r13d   # 0x26fa74
addl 0x24b5a8(%rip), %r13d   # 0x26fa70
movl 0x24b5aa(%rip), %edx    # 0x26fa78
subl 0x24b5a8(%rip), %edx    # 0x26fa7c
movl 0x21657a(%rip), %ecx    # 0x23aa54
movl 0x216570(%rip), %eax    # 0x23aa50
movl %ebp, %r12d
movl %ecx, 0x38(%rsp)
subl %ecx, %r12d
movl %r12d, %r10d
imull %r13d, %r10d
movl %eax, 0x28(%rsp)
movl %eax, %ecx
subl %esi, %ecx
movl %ecx, %eax
imull %edx, %eax
addl %r10d, %eax
imull %r14d, %edx
imull %r15d, %r13d
subl %r13d, %edx
movl %edx, %r10d
negl %r10d
cmovsl %edx, %r10d
movl %eax, %edi
sarl $0x3, %edi
movl %edi, %r13d
negl %r13d
cmovsl %edi, %r13d
cmpl %r13d, %r10d
movl %r8d, 0x10(%rsp)
jbe 0x2453d
cltq
shlq $0x1c, %rax
movslq %edx, %rdi
cqto
idivq %rdi
xorl %edi, %edi
cmpb $0x0, 0x48(%rsp)
setne %dil
movslq %ebx, %r8
movswq 0x12(%r9,%rdi,8), %rdx
movq %r8, 0x30(%rsp)
imulq %r8, %rdx
shrq $0xf, %rdx
movl 0x4(%r9,%rdi,4), %r8d
movl 0x24(%rsp), %r13d
imull %edx, %r13d
subl 0x8(%rsp), %ebp
movslq %r15d, %rbx
cltq
subl 0xc(%rsp), %esi
movq %rax, %rdi
imulq %rbx, %rdi
shrq $0x14, %rdi
shll $0x8, %ebp
addl %ebp, %edi
negl %r11d
imull %r11d, %edx
movslq %r13d, %r10
movslq %edi, %rdi
imulq %r10, %rdi
movslq %r14d, %r13
imulq %r13, %rax
shrq $0x14, %rax
shll $0x8, %esi
addl %esi, %eax
movslq %edx, %rdx
cltq
imulq %rdx, %rax
addq %rdi, %rax
shrq $0x18, %rax
subl 0x10(%rsp), %r8d
shll $0x7, %r8d
movl %r8d, 0xc(%rsp)
leaq 0x24b4b1(%rip), %rdx    # 0x26fa80
movq 0x50(%rsp), %rdi
movl (%rdx,%rdi,4), %r10d
movl 0x80252(%rip), %edx     # 0xa4830
decl %edx
cmpl %edx, %r10d
jne 0x245ff
movl 0x24b485(%rip), %edx    # 0x26fa70
subl 0x24b483(%rip), %edx    # 0x26fa74
movl 0x24b485(%rip), %edi    # 0x26fa7c
addl 0x24b47b(%rip), %edi    # 0x26fa78
jmp 0x2460e
movl 0x4(%rsp), %edx
subl 0x28(%rsp), %edx
movl (%rsp), %edi
subl 0x38(%rsp), %edi
addl %eax, 0xc(%rsp)
imull %edx, %r12d
imull %edi, %ecx
addl %r12d, %ecx
imull %edi, %r14d
imull %edx, %r15d
subl %r15d, %r14d
movl %r14d, %eax
negl %eax
cmovsl %r14d, %eax
movl %ecx, %edx
sarl $0x3, %edx
movl %edx, %edi
negl %edi
cmovsl %edx, %edi
cmpl %edi, %eax
movl 0x10(%rsp), %edi
jbe 0x24656
movslq %ecx, %rax
shlq $0x1c, %rax
movslq %r14d, %rcx
cqto
idivq %rcx
movq %rax, %rcx
movq 0x40(%rsp), %r12
xorl %eax, %eax
cmpb $0x0, 0x48(%rsp)
setne %al
movswq 0x12(%r9,%rax,8), %rdx
imulq 0x30(%rsp), %rdx
shrq $0xf, %rdx
movl 0x4(%r9,%rax,4), %r14d
movl 0x24(%rsp), %r8d
imull %edx, %r8d
movslq %ecx, %rax
imulq %rax, %rbx
shrq $0x14, %rbx
addl %ebx, %ebp
imull %edx, %r11d
imulq %rax, %r13
shrq $0x14, %r13
addl %r13d, %esi
movslq %r8d, %rax
movslq %ebp, %rcx
imulq %rax, %rcx
movslq %r11d, %rax
movslq %esi, %rdx
imulq %rax, %rdx
addq %rcx, %rdx
shrq $0x18, %rdx
subl %edi, %r14d
shll $0x7, %r14d
addl %edx, %r14d
movslq 0x24f3b5(%rip), %rdx    # 0x273a80
leaq 0x24f3be(%rip), %rax    # 0x273a90
movq 0x50(%rsp), %rsi
movslq (%rax,%rsi,4), %rdi
movq %rdi, %rax
imulq %rdx, %rax
shrq $0x14, %rax
leaq 0x2533a3(%rip), %rcx    # 0x277a90
movl (%rcx,%rsi,4), %ecx
movslq %ecx, %rbp
imulq %rbp, %rdx
shrq $0x14, %rdx
movslq 0x25738e(%rip), %r13    # 0x27ba90
movq %r13, %r15
movq %rdi, 0x10(%rsp)
imulq %rdi, %r15
shrq $0x14, %r15
imulq %rbp, %r13
shrq $0x14, %r13
xorl %esi, %esi
movl 0xc(%rsp), %r11d
movl %r11d, %edi
subl %eax, %edi
setl %sil
xorl %r8d, %r8d
cmpl %edx, %r14d
setl %r8b
leal (%rsi,%r8,2), %esi
xorl %r8d, %r8d
movl %r11d, %ebx
subl %r15d, %ebx
setg %r8b
xorl %r9d, %r9d
cmpl %r13d, %r14d
setg %r9b
shll $0x3, %r9d
leal (%r9,%r8,4), %r9d
leal (%r9,%rsi), %r8d
cmpl $0x3, %esi
jne 0x2478c
movq 0x18(%rsp), %rax
subl %eax, %r10d
jl 0x24b4d
leaq (%r12,%rax,2), %rdi
leaq 0x2(,%r10,2), %rdx
xorl %esi, %esi
movl %r8d, %ebx
callq 0x62f0
movl %ebx, %r8d
jmp 0x24b4d
movq %r9, 0x48(%rsp)
cmpl $0xc, %r9d
movq 0x18(%rsp), %r9
jne 0x247c6
subl %r9d, %r10d
jl 0x24b4d
leaq (%r12,%r9,2), %rax
incl %r10d
xorl %ecx, %ecx
movzwl 0x2572df(%rip), %edx    # 0x27ba94
movw %dx, (%rax,%rcx,2)
incq %rcx
cmpl %ecx, %r10d
jne 0x247ae
jmp 0x24b4d
testl %esi, %esi
movl %r8d, 0x24(%rsp)
je 0x248a4
addl %r11d, %edx
addl %r14d, %eax
subl %eax, %edx
movslq %edi, %rax
shlq $0x1e, %rax
movslq %edx, %rdi
cqto
idivq %rdi
movl %ebp, %edx
movq 0x10(%rsp), %r12
subl %r12d, %edx
movslq %edx, %rdi
cltq
imulq %rax, %rdi
shrq $0x1e, %rdi
addl %r12d, %edi
movl %r14d, %edx
subl %r11d, %edx
movq %r9, %r12
movslq %edx, %r9
imulq %rax, %r9
shrq $0x1e, %r9
addl %r11d, %r9d
movl %r10d, %edx
subl %r12d, %edx
imulq %rbp, %rax
shrq $0x1e, %rax
movslq %eax, %r12
movslq %edx, %rax
imulq %r12, %rax
movslq %edi, %r12
cqto
idivq %r12
movq 0x18(%rsp), %r12
leal (%r12,%rax), %edx
cmpl $0x2, %esi
jne 0x248c5
testl %eax, %eax
cmovsl %r14d, %r9d
movl %edx, %esi
cmovsl %r10d, %esi
movl %esi, 0x8(%rsp)
cmovsl %ecx, %edi
cmpl %r10d, %edx
movq 0x40(%rsp), %r12
jge 0x24939
movq %rdi, 0x28(%rsp)
movslq %edx, %rcx
leaq (%r12,%rcx,2), %rdi
addq $0x2, %rdi
movq 0x18(%rsp), %rcx
movl %ecx, %edx
notl %edx
movq %r10, 0x38(%rsp)
addl %r10d, %edx
subl %eax, %edx
movl %r9d, 0x4(%rsp)
movl %r11d, %eax
movq %rax, 0x30(%rsp)
movq 0x10(%rsp), %rax
movl %eax, (%rsp)
jmp 0x24917
movl %r14d, 0x4(%rsp)
movl %r11d, %eax
movq %rax, 0x30(%rsp)
movl %r10d, 0x8(%rsp)
movq 0x10(%rsp), %rsi
movl %esi, (%rsp)
movl %ecx, %edi
jmp 0x2496b
cmpl %r10d, %edx
cmovgl %r11d, %r9d
movq %r9, 0x30(%rsp)
movl %edx, %esi
cmovgl %r12d, %esi
cmovgl 0x10(%rsp), %edi
testl %eax, %eax
movq %r12, %rax
movq 0x40(%rsp), %r12
js 0x24950
movq %rdi, %r8
leaq (%r12,%rax,2), %rdi
cmpl %edx, %eax
cmovgl %eax, %edx
subl %eax, %edx
movl %r14d, 0x4(%rsp)
movl %esi, %eax
movq %rax, 0x18(%rsp)
movq %r10, 0x38(%rsp)
movl %r10d, 0x8(%rsp)
movl %r8d, (%rsp)
movl %ecx, %eax
movq %rax, 0x28(%rsp)
movl %edx, %eax
leaq 0x2(,%rax,2), %rdx
xorl %esi, %esi
callq 0x62f0
movq 0x38(%rsp), %r10
movl 0xc(%rsp), %r11d
movq 0x28(%rsp), %rdi
jmp 0x24966
movl %r9d, 0x4(%rsp)
movl %r11d, %eax
movq %rax, 0x30(%rsp)
movq 0x10(%rsp), %rsi
movl %esi, (%rsp)
jmp 0x2496b
movl %r14d, 0x4(%rsp)
movl %esi, %eax
movq %rax, 0x18(%rsp)
movl %r10d, 0x8(%rsp)
movl %edi, (%rsp)
movl %ecx, %edi
movq 0x10(%rsp), %rsi
movq 0x48(%rsp), %r9
testl %r9d, %r9d
je 0x24a38
movq %rdi, 0x28(%rsp)
addl %r11d, %r13d
addl %r14d, %r15d
subl %r15d, %r13d
movslq %ebx, %rax
shlq $0x1e, %rax
movslq %r13d, %rcx
cqto
idivq %rcx
movl %ebp, %ecx
subl %esi, %ecx
movslq %ecx, %rcx
cltq
imulq %rax, %rcx
shrq $0x1e, %rcx
addl %esi, %ecx
subl %r11d, %r14d
movslq %r14d, %rdi
imulq %rax, %rdi
shrq $0x1e, %rdi
addl %r11d, %edi
movq 0x50(%rsp), %rdx
leaq 0x2470aa(%rip), %rsi    # 0x26ba70
movslq (%rsi,%rdx,4), %rsi
movl %r10d, %edx
subl %esi, %edx
imulq %rax, %rbp
shrq $0x1e, %rbp
movslq %ebp, %r8
movslq %edx, %rax
imulq %r8, %rax
movslq %ecx, %r8
cqto
idivq %r8
leal (%rsi,%rax), %edx
cmpl $0x8, %r9d
jne 0x24a51
testl %eax, %eax
movl 0x4(%rsp), %r11d
cmovnsl %edi, %r11d
movl 0x8(%rsp), %ebx
cmovnsl %edx, %ebx
movq 0x28(%rsp), %rdi
cmovnsl %ecx, %edi
cmpl %r10d, %edx
movq 0x30(%rsp), %r8
movq 0x18(%rsp), %r9
jge 0x24a4b
movslq %r10d, %rax
movslq %edx, %rcx
movzwl 0x25706c(%rip), %edx    # 0x27ba94
movw %dx, 0x2(%r12,%rcx,2)
incq %rcx
cmpq %rax, %rcx
jl 0x24a21
jmp 0x24a4b
movl 0x8(%rsp), %ebx
movq 0x30(%rsp), %r8
movq 0x18(%rsp), %r9
movl 0x4(%rsp), %r11d
movl (%rsp), %r10d
jmp 0x24aa8
cmpl %r10d, %edx
movq 0x30(%rsp), %r8
cmovlel %edi, %r8d
movq 0x18(%rsp), %r9
cmovlel %edx, %r9d
movl (%rsp), %r10d
cmovlel %ecx, %r10d
testl %eax, %eax
movl 0x8(%rsp), %ebx
movl 0x4(%rsp), %r11d
js 0x24aa3
cmpl %edx, %esi
cmovgl %esi, %edx
leaq (%r12,%rsi,2), %rax
subl %esi, %edx
incl %edx
xorl %ecx, %ecx
movq 0x28(%rsp), %rdi
movzwl 0x256ffe(%rip), %esi    # 0x27ba94
movw %si, (%rax,%rcx,2)
incq %rcx
cmpl %ecx, %edx
jne 0x24a8f
jmp 0x24aa8
movq 0x28(%rsp), %rdi
movslq 0x256fe9(%rip), %rsi    # 0x27ba98
movslq %r8d, %rax
imulq %rsi, %rax
movslq %r10d, %rcx
cqto
idivq %rcx
movq %rax, %rcx
movslq %r11d, %rax
imulq %rsi, %rax
movslq %edi, %rsi
cqto
idivq %rsi
subl %ecx, %eax
shll $0x4, %ecx
shll $0x4, %eax
movl %ebx, %esi
subl %r9d, %esi
incl %esi
cltd
idivl %esi
movslq %r9d, %rdx
leaq (%r12,%rdx,2), %r14
movl 0x256fad(%rip), %edx    # 0x27ba9c
shll $0x10, %edx
addl %ecx, %edx
movq %r14, %rdi
movl %eax, %ecx
callq 0x4d1a2
movzwl (%r14), %eax
testw %ax, %ax
jns 0x24b0f
movw $0x0, (%r14)
xorl %eax, %eax
movzwl %ax, %ecx
movl 0x256f7c(%rip), %eax    # 0x27ba94
cmpl %ecx, %eax
movl 0x24(%rsp), %r8d
jge 0x24b25
movw %ax, (%r14)
movslq %ebx, %rax
movzwl (%r12,%rax,2), %ecx
testw %cx, %cx
jns 0x24b3b
movw $0x0, (%r12,%rax,2)
xorl %ecx, %ecx
movzwl %cx, %edx
movl 0x256f50(%rip), %ecx    # 0x27ba94
cmpl %edx, %ecx
jge 0x24b4d
movw %cx, (%r12,%rax,2)
movl %r8d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq