// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: owallmost
static int owallmost(short *mostbuf, int w, int z)
{
	int bad, inty, xcross, y, yinc;
	int s1, s2, s3, s4, ix1, ix2, iy1, iy2, t;
	int i;

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

	ix1 = xb1[w]; iy1 = yb1[w];
	ix2 = xb2[w]; iy2 = yb2[w];

	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)
	{
		t = divscale30(z-s1,s2-s1);
		inty = yb1[w] + mulscale30(yb2[w]-yb1[w],t);
		xcross = xb1[w] + scale(mulscale30(yb2[w],t),xb2[w]-xb1[w],inty);

		if ((bad&3) == 2)
		{
			if (xb1[w] <= xcross) { 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]) { 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)
	{
		t = divscale30(z-s3,s4-s3);
		inty = yb1[w] + mulscale30(yb2[w]-yb1[w],t);
		xcross = xb1[w] + scale(mulscale30(yb2[w],t),xb2[w]-xb1[w],inty);

		if ((bad&12) == 8)
		{
			if (xb1[w] <= xcross) { 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]) { 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(z,xdimenscale,iy1)<<4);
	yinc = ((scale(z,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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl -0x18(%rbp), %eax
shll $0x7, %eax
movl %eax, -0x18(%rbp)
movl 0x27963f(%rip), %edi    # 0x2b05e0
movslq -0x14(%rbp), %rcx
leaq 0x279644(%rip), %rax    # 0x2b05f0
movl (%rax,%rcx,4), %esi
callq 0x376c0
movl %eax, -0x30(%rbp)
movl 0x279623(%rip), %edi    # 0x2b05e0
movslq -0x14(%rbp), %rcx
leaq 0x27d628(%rip), %rax    # 0x2b45f0
movl (%rax,%rcx,4), %esi
callq 0x376c0
movl %eax, -0x34(%rbp)
movl 0x281617(%rip), %edi    # 0x2b85f0
movslq -0x14(%rbp), %rcx
leaq 0x27960c(%rip), %rax    # 0x2b05f0
movl (%rax,%rcx,4), %esi
callq 0x376c0
movl %eax, -0x38(%rbp)
movl 0x2815fb(%rip), %edi    # 0x2b85f0
movslq -0x14(%rbp), %rcx
leaq 0x27d5f0(%rip), %rax    # 0x2b45f0
movl (%rax,%rcx,4), %esi
callq 0x376c0
movl %eax, -0x3c(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x30(%rbp), %eax
setl %al
andb $0x1, %al
movzbl %al, %eax
movl -0x18(%rbp), %ecx
cmpl -0x34(%rbp), %ecx
setl %cl
andb $0x1, %cl
movzbl %cl, %ecx
shll %ecx
addl %ecx, %eax
movl -0x18(%rbp), %ecx
cmpl -0x38(%rbp), %ecx
setg %cl
andb $0x1, %cl
movzbl %cl, %ecx
shll $0x2, %ecx
addl %ecx, %eax
movl -0x18(%rbp), %ecx
cmpl -0x3c(%rbp), %ecx
setg %cl
andb $0x1, %cl
movzbl %cl, %ecx
shll $0x3, %ecx
addl %ecx, %eax
movl %eax, -0x1c(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x27156e(%rip), %rax    # 0x2a85d0
movl (%rax,%rcx,4), %eax
movl %eax, -0x40(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x27957d(%rip), %rax    # 0x2b05f0
movl (%rax,%rcx,4), %eax
movl %eax, -0x48(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x27555c(%rip), %rax    # 0x2ac5e0
movl (%rax,%rcx,4), %eax
movl %eax, -0x44(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x27d55b(%rip), %rax    # 0x2b45f0
movl (%rax,%rcx,4), %eax
movl %eax, -0x4c(%rbp)
movl -0x1c(%rbp), %eax
andl $0x3, %eax
cmpl $0x3, %eax
jne 0x370d8
movl -0x40(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x44(%rbp), %eax
jg 0x370cd
movq -0x10(%rbp), %rax
movslq -0x54(%rbp), %rcx
movw $0x0, (%rax,%rcx,2)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x370ac
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x37508
movl -0x1c(%rbp), %eax
andl $0xc, %eax
cmpl $0xc, %eax
jne 0x3711c
movl -0x40(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x44(%rbp), %eax
jg 0x37111
movl 0x2814fd(%rip), %eax    # 0x2b85f4
movw %ax, %dx
movq -0x10(%rbp), %rax
movslq -0x54(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x370e9
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x37508
movl -0x1c(%rbp), %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x3728b
movl -0x18(%rbp), %edi
subl -0x30(%rbp), %edi
movl -0x34(%rbp), %esi
subl -0x30(%rbp), %esi
callq 0x376e0
movl %eax, -0x50(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x2794a6(%rip), %rax    # 0x2b05f0
movl (%rax,%rcx,4), %eax
movl %eax, -0x5c(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x27d495(%rip), %rax    # 0x2b45f0
movl (%rax,%rcx,4), %edi
movslq -0x14(%rbp), %rcx
leaq 0x279487(%rip), %rax    # 0x2b05f0
subl (%rax,%rcx,4), %edi
movl -0x50(%rbp), %esi
callq 0x37700
movl %eax, %ecx
movl -0x5c(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x20(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x271447(%rip), %rax    # 0x2a85d0
movl (%rax,%rcx,4), %eax
movl %eax, -0x58(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x27d456(%rip), %rax    # 0x2b45f0
movl (%rax,%rcx,4), %edi
movl -0x50(%rbp), %esi
callq 0x37700
movl %eax, %edi
movslq -0x14(%rbp), %rcx
leaq 0x27542e(%rip), %rax    # 0x2ac5e0
movl (%rax,%rcx,4), %esi
movslq -0x14(%rbp), %rcx
leaq 0x271410(%rip), %rax    # 0x2a85d0
subl (%rax,%rcx,4), %esi
movl -0x20(%rbp), %edx
callq 0x37720
movl %eax, %ecx
movl -0x58(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
andl $0x3, %eax
cmpl $0x2, %eax
jne 0x37236
movslq -0x14(%rbp), %rcx
leaq 0x2713e5(%rip), %rax    # 0x2a85d0
movl (%rax,%rcx,4), %eax
cmpl -0x24(%rbp), %eax
jg 0x371ff
movl -0x20(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movslq -0x14(%rbp), %rdx
leaq 0x2753ca(%rip), %rcx    # 0x2ac5e0
cmpl (%rcx,%rdx,4), %eax
jg 0x37234
movq -0x10(%rbp), %rax
movslq -0x54(%rbp), %rcx
movw $0x0, (%rax,%rcx,2)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x37208
jmp 0x37289
movl -0x24(%rbp), %eax
movslq -0x14(%rbp), %rdx
leaq 0x27539c(%rip), %rcx    # 0x2ac5e0
cmpl (%rcx,%rdx,4), %eax
jg 0x37255
movl -0x20(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x40(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x271370(%rip), %rax    # 0x2a85d0
movl (%rax,%rcx,4), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0x37287
movq -0x10(%rbp), %rax
movslq -0x54(%rbp), %rcx
movw $0x0, (%rax,%rcx,2)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x37266
jmp 0x37289
jmp 0x3728b
movl -0x1c(%rbp), %eax
andl $0xc, %eax
cmpl $0x0, %eax
je 0x37408
movl -0x18(%rbp), %edi
subl -0x38(%rbp), %edi
movl -0x3c(%rbp), %esi
subl -0x38(%rbp), %esi
callq 0x376e0
movl %eax, -0x50(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x279337(%rip), %rax    # 0x2b05f0
movl (%rax,%rcx,4), %eax
movl %eax, -0x64(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x27d326(%rip), %rax    # 0x2b45f0
movl (%rax,%rcx,4), %edi
movslq -0x14(%rbp), %rcx
leaq 0x279318(%rip), %rax    # 0x2b05f0
subl (%rax,%rcx,4), %edi
movl -0x50(%rbp), %esi
callq 0x37700
movl %eax, %ecx
movl -0x64(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x20(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x2712d8(%rip), %rax    # 0x2a85d0
movl (%rax,%rcx,4), %eax
movl %eax, -0x60(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x27d2e7(%rip), %rax    # 0x2b45f0
movl (%rax,%rcx,4), %edi
movl -0x50(%rbp), %esi
callq 0x37700
movl %eax, %edi
movslq -0x14(%rbp), %rcx
leaq 0x2752bf(%rip), %rax    # 0x2ac5e0
movl (%rax,%rcx,4), %esi
movslq -0x14(%rbp), %rcx
leaq 0x2712a1(%rip), %rax    # 0x2a85d0
subl (%rax,%rcx,4), %esi
movl -0x20(%rbp), %edx
callq 0x37720
movl %eax, %ecx
movl -0x60(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
andl $0xc, %eax
cmpl $0x8, %eax
jne 0x373ac
movslq -0x14(%rbp), %rcx
leaq 0x271276(%rip), %rax    # 0x2a85d0
movl (%rax,%rcx,4), %eax
cmpl -0x24(%rbp), %eax
jg 0x3736e
movl -0x20(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movslq -0x14(%rbp), %rdx
leaq 0x27525b(%rip), %rcx    # 0x2ac5e0
cmpl (%rcx,%rdx,4), %eax
jg 0x373aa
movl 0x281264(%rip), %eax    # 0x2b85f4
movw %ax, %dx
movq -0x10(%rbp), %rax
movslq -0x54(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x37377
jmp 0x37406
movl -0x24(%rbp), %eax
movslq -0x14(%rbp), %rdx
leaq 0x275226(%rip), %rcx    # 0x2ac5e0
cmpl (%rcx,%rdx,4), %eax
jg 0x373cb
movl -0x20(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x40(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x2711fa(%rip), %rax    # 0x2a85d0
movl (%rax,%rcx,4), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0x37404
movl 0x28120a(%rip), %eax    # 0x2b85f4
movw %ax, %dx
movq -0x10(%rbp), %rax
movslq -0x54(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x373dc
jmp 0x37406
jmp 0x37408
movl -0x18(%rbp), %edi
movl 0x2811e7(%rip), %esi    # 0x2b85f8
movl -0x48(%rbp), %edx
callq 0x37720
shll $0x4, %eax
movl %eax, -0x28(%rbp)
movl -0x18(%rbp), %edi
movl 0x2811d0(%rip), %esi    # 0x2b85f8
movl -0x4c(%rbp), %edx
callq 0x37720
shll $0x4, %eax
subl -0x28(%rbp), %eax
movl -0x44(%rbp), %ecx
subl -0x40(%rbp), %ecx
addl $0x1, %ecx
cltd
idivl %ecx
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x40(%rbp), %rax
shlq %rax
addq %rax, %rdi
movl -0x44(%rbp), %esi
subl -0x40(%rbp), %esi
addl $0x1, %esi
movl -0x28(%rbp), %edx
movl 0x281197(%rip), %eax    # 0x2b85fc
shll $0x10, %eax
addl %eax, %edx
movl -0x2c(%rbp), %ecx
callq 0x6ecf0
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movswl (%rax,%rcx,2), %eax
cmpl $0x0, %eax
jge 0x37491
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movw $0x0, (%rax,%rcx,2)
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movswl (%rax,%rcx,2), %eax
cmpl 0x281151(%rip), %eax    # 0x2b85f4
jle 0x374ba
movl 0x281149(%rip), %eax    # 0x2b85f4
movw %ax, %dx
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movswl (%rax,%rcx,2), %eax
cmpl $0x0, %eax
jge 0x374d9
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movw $0x0, (%rax,%rcx,2)
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movswl (%rax,%rcx,2), %eax
cmpl 0x281109(%rip), %eax    # 0x2b85f4
jle 0x37502
movl 0x281101(%rip), %eax    # 0x2b85f4
movw %ax, %dx
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)