// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: cansee
int cansee(int x1, int y1, int z1, short sect1, int x2, int y2, int z2, short sect2)
{
	sectortype *sec;
	walltype *wal, *wal2;
	int i, cnt, nexts, x, y, z, cz, fz, dasectnum, dacnt, danum;
	int x21, y21, z21, x31, y31, x34, y34, bot, t;

	if ((x1 == x2) && (y1 == y2)) return(sect1 == sect2);

	x21 = x2-x1; y21 = y2-y1; z21 = z2-z1;

	clipsectorlist[0] = sect1; danum = 1;
	for(dacnt=0;dacnt<danum;dacnt++)
	{
		dasectnum = clipsectorlist[dacnt]; sec = &sector[dasectnum];
		for(cnt=sec->wallnum,wal=&wall[sec->wallptr];cnt>0;cnt--,wal++)
		{
			wal2 = &wall[wal->point2];
			x31 = wal->x-x1; x34 = wal->x-wal2->x;
			y31 = wal->y-y1; y34 = wal->y-wal2->y;

			bot = y21*x34-x21*y34; if (bot <= 0) continue;
			t = y21*x31-x21*y31; if ((unsigned)t >= (unsigned)bot) continue;
			t = y31*x34-x31*y34; if ((unsigned)t >= (unsigned)bot) continue;

			nexts = wal->nextsector;
			if ((nexts < 0) || (wal->cstat&32)) return(0);

			t = divscale24(t,bot);
			x = x1 + mulscale24(x21,t);
			y = y1 + mulscale24(y21,t);
			z = z1 + mulscale24(z21,t);

			getzsofslope((short)dasectnum,x,y,&cz,&fz);
			if ((z <= cz) || (z >= fz)) return(0);
			getzsofslope((short)nexts,x,y,&cz,&fz);
			if ((z <= cz) || (z >= fz)) return(0);

			for(i=danum-1;i>=0;i--) if (clipsectorlist[i] == nexts) break;
			if (i < 0) clipsectorlist[danum++] = nexts;
		}
	}
	for(i=danum-1;i>=0;i--) if (clipsectorlist[i] == sect2) return(1);
	return(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movw %cx, %ax
movw 0x18(%rbp), %cx
movl 0x10(%rbp), %ecx
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movw %ax, -0x12(%rbp)
movl %r8d, -0x18(%rbp)
movl %r9d, -0x1c(%rbp)
movl -0x8(%rbp), %eax
cmpl -0x18(%rbp), %eax
jne 0x4fe14
movl -0xc(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jne 0x4fe14
movswl -0x12(%rbp), %eax
movswl 0x18(%rbp), %ecx
cmpl %ecx, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
jmp 0x50155
movl -0x18(%rbp), %eax
subl -0x8(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x1c(%rbp), %eax
subl -0xc(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl 0x10(%rbp), %eax
subl -0x10(%rbp), %eax
movl %eax, -0x70(%rbp)
movw -0x12(%rbp), %ax
movw %ax, 0x41bf46(%rip)     # 0x46bd80
movl $0x1, -0x64(%rbp)
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x64(%rbp), %eax
jge 0x50112
movslq -0x60(%rbp), %rcx
leaq 0x41bf21(%rip), %rax    # 0x46bd80
movswl (%rax,%rcx,2), %eax
movl %eax, -0x5c(%rbp)
movslq -0x5c(%rbp), %rcx
leaq 0x23074f(%rip), %rax    # 0x2805c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movswl 0x2(%rax), %eax
movl %eax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movswq (%rax), %rcx
leaq 0x1a571a(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
cmpl $0x0, -0x40(%rbp)
jle 0x50102
movq -0x30(%rbp), %rax
movswq 0x8(%rax), %rcx
leaq 0x1a56f5(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %eax
subl -0x8(%rbp), %eax
movl %eax, -0x74(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %eax
movq -0x38(%rbp), %rcx
subl (%rcx), %eax
movl %eax, -0x7c(%rbp)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %eax
subl -0xc(%rbp), %eax
movl %eax, -0x78(%rbp)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x38(%rbp), %rcx
subl 0x4(%rcx), %eax
movl %eax, -0x80(%rbp)
movl -0x6c(%rbp), %eax
imull -0x7c(%rbp), %eax
movl -0x68(%rbp), %ecx
imull -0x80(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x84(%rbp)
cmpl $0x0, -0x84(%rbp)
jg 0x4ff23
jmp 0x500e8
movl -0x6c(%rbp), %eax
imull -0x74(%rbp), %eax
movl -0x68(%rbp), %ecx
imull -0x78(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x88(%rbp)
movl -0x88(%rbp), %eax
cmpl -0x84(%rbp), %eax
jb 0x4ff4c
jmp 0x500e8
movl -0x78(%rbp), %eax
imull -0x7c(%rbp), %eax
movl -0x74(%rbp), %ecx
imull -0x80(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x88(%rbp)
movl -0x88(%rbp), %eax
cmpl -0x84(%rbp), %eax
jb 0x4ff75
jmp 0x500e8
movq -0x30(%rbp), %rax
movswl 0xc(%rax), %eax
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jl 0x4ff96
movq -0x30(%rbp), %rax
movswl 0xe(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x4ffa2
movl $0x0, -0x4(%rbp)
jmp 0x50155
movl -0x88(%rbp), %edi
movl -0x84(%rbp), %esi
callq 0x50170
movl %eax, -0x88(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x94(%rbp)
movl -0x68(%rbp), %edi
movl -0x88(%rbp), %esi
callq 0x3c8b0
movl %eax, %ecx
movl -0x94(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x48(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x90(%rbp)
movl -0x6c(%rbp), %edi
movl -0x88(%rbp), %esi
callq 0x3c8b0
movl %eax, %ecx
movl -0x90(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x4c(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x70(%rbp), %edi
movl -0x88(%rbp), %esi
callq 0x3c8b0
movl %eax, %ecx
movl -0x8c(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x50(%rbp)
movl -0x5c(%rbp), %eax
movl -0x48(%rbp), %esi
movl -0x4c(%rbp), %edx
leaq -0x54(%rbp), %rcx
leaq -0x58(%rbp), %r8
movswl %ax, %edi
callq 0x393f0
movl -0x50(%rbp), %eax
cmpl -0x54(%rbp), %eax
jle 0x5004e
movl -0x50(%rbp), %eax
cmpl -0x58(%rbp), %eax
jl 0x5005a
movl $0x0, -0x4(%rbp)
jmp 0x50155
movl -0x44(%rbp), %eax
movl -0x48(%rbp), %esi
movl -0x4c(%rbp), %edx
leaq -0x54(%rbp), %rcx
leaq -0x58(%rbp), %r8
movswl %ax, %edi
callq 0x393f0
movl -0x50(%rbp), %eax
cmpl -0x54(%rbp), %eax
jle 0x50083
movl -0x50(%rbp), %eax
cmpl -0x58(%rbp), %eax
jl 0x5008f
movl $0x0, -0x4(%rbp)
jmp 0x50155
movl -0x64(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jl 0x500c1
movslq -0x3c(%rbp), %rcx
leaq 0x41bcd7(%rip), %rax    # 0x46bd80
movswl (%rax,%rcx,2), %eax
cmpl -0x44(%rbp), %eax
jne 0x500b4
jmp 0x500c1
jmp 0x500b6
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x50098
cmpl $0x0, -0x3c(%rbp)
jge 0x500e6
movl -0x44(%rbp), %eax
movw %ax, %dx
movl -0x64(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x64(%rbp)
movslq %eax, %rcx
leaq 0x41bc9e(%rip), %rax    # 0x46bd80
movw %dx, (%rax,%rcx,2)
jmp 0x500e8
movl -0x40(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x40(%rbp)
movq -0x30(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x30(%rbp)
jmp 0x4fea1
jmp 0x50104
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x4fe48
movl -0x64(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jl 0x5014e
movslq -0x3c(%rbp), %rcx
leaq 0x41bc54(%rip), %rax    # 0x46bd80
movswl (%rax,%rcx,2), %eax
movswl 0x18(%rbp), %ecx
cmpl %ecx, %eax
jne 0x50141
movl $0x1, -0x4(%rbp)
jmp 0x50155
jmp 0x50143
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x5011b
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)