// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/engine.c
// Function: rintersect
static int rintersect(int x1, int y1, int z1, int vx, int vy, int vz, int x3,
		  int y3, int x4, int y4, int *intx, int *inty, int *intz)
{     //p1 towards p2 is a ray
	int x34, y34, x31, y31, bot, topt, topu, t;

	x34 = x3-x4; y34 = y3-y4;
	bot = vx*y34 - vy*x34;
	if (bot >= 0)
	{
		if (bot == 0) return(0);
		x31 = x3-x1; y31 = y3-y1;
		topt = x31*y34 - y31*x34; if (topt < 0) return(0);
		topu = vx*y31 - vy*x31; if ((topu < 0) || (topu >= bot)) return(0);
	}
	else
	{
		x31 = x3-x1; y31 = y3-y1;
		topt = x31*y34 - y31*x34; if (topt > 0) return(0);
		topu = vx*y31 - vy*x31; if ((topu > 0) || (topu <= bot)) return(0);
	}
	t = divscale16(topt,bot);
	*intx = x1 + mulscale16(vx,t);
	*inty = y1 + mulscale16(vy,t);
	*intz = z1 + mulscale16(vz,t);
	return(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq 0x40(%rbp), %rax
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl %r8d, -0x18(%rbp)
movl %r9d, -0x1c(%rbp)
movl 0x10(%rbp), %eax
subl 0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl 0x18(%rbp), %eax
subl 0x28(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x14(%rbp), %eax
imull -0x24(%rbp), %eax
movl -0x18(%rbp), %ecx
imull -0x20(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jl 0x51c27
cmpl $0x0, -0x30(%rbp)
jne 0x51bc1
movl $0x0, -0x4(%rbp)
jmp 0x51cf3
movl 0x10(%rbp), %eax
subl -0x8(%rbp), %eax
movl %eax, -0x28(%rbp)
movl 0x18(%rbp), %eax
subl -0xc(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
imull -0x24(%rbp), %eax
movl -0x2c(%rbp), %ecx
imull -0x20(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jge 0x51bf8
movl $0x0, -0x4(%rbp)
jmp 0x51cf3
movl -0x14(%rbp), %eax
imull -0x2c(%rbp), %eax
movl -0x18(%rbp), %ecx
imull -0x28(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
jl 0x51c19
movl -0x38(%rbp), %eax
cmpl -0x30(%rbp), %eax
jl 0x51c25
movl $0x0, -0x4(%rbp)
jmp 0x51cf3
jmp 0x51c8a
movl 0x10(%rbp), %eax
subl -0x8(%rbp), %eax
movl %eax, -0x28(%rbp)
movl 0x18(%rbp), %eax
subl -0xc(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
imull -0x24(%rbp), %eax
movl -0x2c(%rbp), %ecx
imull -0x20(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jle 0x51c5e
movl $0x0, -0x4(%rbp)
jmp 0x51cf3
movl -0x14(%rbp), %eax
imull -0x2c(%rbp), %eax
movl -0x18(%rbp), %ecx
imull -0x28(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
jg 0x51c7f
movl -0x38(%rbp), %eax
cmpl -0x30(%rbp), %eax
jg 0x51c88
movl $0x0, -0x4(%rbp)
jmp 0x51cf3
jmp 0x51c8a
movl -0x34(%rbp), %edi
movl -0x30(%rbp), %esi
callq 0x4c7c0
movl %eax, -0x3c(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x14(%rbp), %edi
movl -0x3c(%rbp), %esi
callq 0x39010
movl -0x48(%rbp), %ecx
addl %eax, %ecx
movq 0x30(%rbp), %rax
movl %ecx, (%rax)
movl -0xc(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x18(%rbp), %edi
movl -0x3c(%rbp), %esi
callq 0x39010
movl -0x44(%rbp), %ecx
addl %eax, %ecx
movq 0x38(%rbp), %rax
movl %ecx, (%rax)
movl -0x10(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x1c(%rbp), %edi
movl -0x3c(%rbp), %esi
callq 0x39010
movl -0x40(%rbp), %ecx
addl %eax, %ecx
movq 0x40(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)