// File: FreeSlave[P]vhlt/hlrad/trace.cpp
// Function: TestLineOpaque_r(int, float const*, float const*)
int TestLineOpaque_r (int nodenum, const vec3_t start, const vec3_t stop)
{
	opaquenode_t *thisnode;
	vec_t front, back;
	if (nodenum < 0)
	{
		return 0;
	}
	thisnode = &opaquenodes[nodenum];
	switch (thisnode->type)
	{
	case plane_x:
		front = start[0] - thisnode->dist;
		back = stop[0] - thisnode->dist;
		break;
	case plane_y:
		front = start[1] - thisnode->dist;
		back = stop[1] - thisnode->dist;
		break;
	case plane_z:
		front = start[2] - thisnode->dist;
		back = stop[2] - thisnode->dist;
		break;
	default:
		front = DotProduct (start, thisnode->normal) - thisnode->dist;
		back = DotProduct (stop, thisnode->normal) - thisnode->dist;
	}
	if (front > ON_EPSILON / 2 && back > ON_EPSILON / 2)
	{
		return TestLineOpaque_r (thisnode->children[0], start, stop);
	}
	if (front < -ON_EPSILON / 2 && back < -ON_EPSILON / 2)
	{
		return TestLineOpaque_r (thisnode->children[1], start, stop);
	}
	if (fabs (front) <= ON_EPSILON && fabs (back) <= ON_EPSILON)
	{
		return TestLineOpaque_r (thisnode->children[0], start, stop)
			|| TestLineOpaque_r (thisnode->children[1], start, stop);
	}
	{
		int side;
		vec_t frac;
		vec3_t mid;
		int facenum;
		side = (front - back) < 0;
		frac = front / (front - back);
		if (frac < 0) frac = 0;
		if (frac > 1) frac = 1;
		mid[0] = start[0] + (stop[0] - start[0]) * frac;
		mid[1] = start[1] + (stop[1] - start[1]) * frac;
		mid[2] = start[2] + (stop[2] - start[2]) * frac;
		for (facenum = thisnode->firstface; facenum < thisnode->firstface + thisnode->numfaces; facenum++)
		{
			if (TestLineOpaque_face (facenum, mid))
			{
				return 1;
			}
		}
		return TestLineOpaque_r (thisnode->children[side], start, mid)
			|| TestLineOpaque_r (thisnode->children[!side], mid, stop);
	}
}

// Assembly:
subq $0x48, %rsp
movl %edi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
cmpl $0x0, 0x40(%rsp)
jge 0x648c6
movl $0x0, 0x44(%rsp)
jmp 0x64d54
movq 0x66cb233(%rip), %rax   # 0x672fb00
movslq 0x40(%rsp), %rcx
leaq (%rcx,%rcx,8), %rcx
leaq (%rax,%rcx,4), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x4(%rsp)
testl %eax, %eax
je 0x64909
jmp 0x648f0
movl 0x4(%rsp), %eax
subl $0x1, %eax
je 0x64940
jmp 0x648fb
movl 0x4(%rsp), %eax
subl $0x2, %eax
je 0x64979
jmp 0x649b2
movq 0x38(%rsp), %rax
movss (%rax), %xmm0
movq 0x28(%rsp), %rax
subss 0x10(%rax), %xmm0
movss %xmm0, 0x24(%rsp)
movq 0x30(%rsp), %rax
movss (%rax), %xmm0
movq 0x28(%rsp), %rax
subss 0x10(%rax), %xmm0
movss %xmm0, 0x20(%rsp)
jmp 0x64a68
movq 0x38(%rsp), %rax
movss 0x4(%rax), %xmm0
movq 0x28(%rsp), %rax
subss 0x10(%rax), %xmm0
movss %xmm0, 0x24(%rsp)
movq 0x30(%rsp), %rax
movss 0x4(%rax), %xmm0
movq 0x28(%rsp), %rax
subss 0x10(%rax), %xmm0
movss %xmm0, 0x20(%rsp)
jmp 0x64a68
movq 0x38(%rsp), %rax
movss 0x8(%rax), %xmm0
movq 0x28(%rsp), %rax
subss 0x10(%rax), %xmm0
movss %xmm0, 0x24(%rsp)
movq 0x30(%rsp), %rax
movss 0x8(%rax), %xmm0
movq 0x28(%rsp), %rax
subss 0x10(%rax), %xmm0
movss %xmm0, 0x20(%rsp)
jmp 0x64a68
movq 0x38(%rsp), %rax
movss (%rax), %xmm1
movq 0x28(%rsp), %rax
movss 0x4(%rax), %xmm2
movq 0x38(%rsp), %rax
movss 0x4(%rax), %xmm0
movq 0x28(%rsp), %rax
mulss 0x8(%rax), %xmm0
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
movq 0x38(%rsp), %rax
movss 0x8(%rax), %xmm0
movq 0x28(%rsp), %rax
movss 0xc(%rax), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movq 0x28(%rsp), %rax
subss 0x10(%rax), %xmm0
movss %xmm0, 0x24(%rsp)
movq 0x30(%rsp), %rax
movss (%rax), %xmm1
movq 0x28(%rsp), %rax
movss 0x4(%rax), %xmm2
movq 0x30(%rsp), %rax
movss 0x4(%rax), %xmm0
movq 0x28(%rsp), %rax
mulss 0x8(%rax), %xmm0
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
movq 0x30(%rsp), %rax
movss 0x8(%rax), %xmm0
movq 0x28(%rsp), %rax
movss 0xc(%rax), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movq 0x28(%rsp), %rax
subss 0x10(%rax), %xmm0
movss %xmm0, 0x20(%rsp)
movss 0x24(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x8dce(%rip), %xmm1     # 0x6d848
ucomisd %xmm1, %xmm0
jbe 0x64ab8
movss 0x20(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x8db6(%rip), %xmm1     # 0x6d848
ucomisd %xmm1, %xmm0
jbe 0x64ab8
movq 0x28(%rsp), %rax
movl 0x14(%rax), %edi
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq 0x648a0
movl %eax, 0x44(%rsp)
jmp 0x64d54
movss 0x24(%rsp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0xd146(%rip), %xmm0     # 0x71c10
ucomisd %xmm1, %xmm0
jbe 0x64b08
movss 0x20(%rsp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0xd12e(%rip), %xmm0     # 0x71c10
ucomisd %xmm1, %xmm0
jbe 0x64b08
movq 0x28(%rsp), %rax
movl 0x18(%rax), %edi
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq 0x648a0
movl %eax, 0x44(%rsp)
jmp 0x64d54
movss 0x24(%rsp), %xmm0
callq 0x11ce0
cvtss2sd %xmm0, %xmm1
movsd 0x8cc1(%rip), %xmm0     # 0x6d7e0
ucomisd %xmm1, %xmm0
jb 0x64b99
movss 0x20(%rsp), %xmm0
callq 0x11ce0
cvtss2sd %xmm0, %xmm1
movsd 0x8ca4(%rip), %xmm0     # 0x6d7e0
ucomisd %xmm1, %xmm0
jb 0x64b99
movq 0x28(%rsp), %rax
movl 0x14(%rax), %edi
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq 0x648a0
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, 0x3(%rsp)
jne 0x64b87
movq 0x28(%rsp), %rax
movl 0x18(%rax), %edi
movq 0x38(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq 0x648a0
cmpl $0x0, %eax
setne %al
movb %al, 0x3(%rsp)
movb 0x3(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x44(%rsp)
jmp 0x64d54
movss 0x24(%rsp), %xmm1
subss 0x20(%rsp), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm1, %xmm0
seta %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x1c(%rsp)
movss 0x24(%rsp), %xmm0
movss 0x24(%rsp), %xmm1
subss 0x20(%rsp), %xmm1
divss %xmm1, %xmm0
movss %xmm0, 0x18(%rsp)
xorps %xmm0, %xmm0
ucomiss 0x18(%rsp), %xmm0
jbe 0x64be6
xorps %xmm0, %xmm0
movss %xmm0, 0x18(%rsp)
movss 0x18(%rsp), %xmm0
movss 0x5458(%rip), %xmm1     # 0x6a04c
ucomiss %xmm1, %xmm0
jbe 0x64c07
movss 0x544b(%rip), %xmm0     # 0x6a04c
movss %xmm0, 0x18(%rsp)
movq 0x38(%rsp), %rax
movss (%rax), %xmm1
movq 0x30(%rsp), %rax
movss (%rax), %xmm0
movq 0x38(%rsp), %rax
subss (%rax), %xmm0
movss 0x18(%rsp), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0xc(%rsp)
movq 0x38(%rsp), %rax
movss 0x4(%rax), %xmm1
movq 0x30(%rsp), %rax
movss 0x4(%rax), %xmm0
movq 0x38(%rsp), %rax
subss 0x4(%rax), %xmm0
movss 0x18(%rsp), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x10(%rsp)
movq 0x38(%rsp), %rax
movss 0x8(%rax), %xmm1
movq 0x30(%rsp), %rax
movss 0x8(%rax), %xmm0
movq 0x38(%rsp), %rax
subss 0x8(%rax), %xmm0
movss 0x18(%rsp), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x14(%rsp)
movq 0x28(%rsp), %rax
movl 0x1c(%rax), %eax
movl %eax, 0x8(%rsp)
movl 0x8(%rsp), %eax
movq 0x28(%rsp), %rcx
movl 0x1c(%rcx), %ecx
movq 0x28(%rsp), %rdx
addl 0x20(%rdx), %ecx
cmpl %ecx, %eax
jge 0x64cea
movl 0x8(%rsp), %edi
leaq 0xc(%rsp), %rsi
callq 0x644a0
cmpl $0x0, %eax
je 0x64cdb
movl $0x1, 0x44(%rsp)
jmp 0x64d54
jmp 0x64cdd
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x64ca6
movq 0x28(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movl 0x14(%rax,%rcx,4), %edi
movq 0x38(%rsp), %rsi
leaq 0xc(%rsp), %rdx
callq 0x648a0
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, 0x2(%rsp)
jne 0x64d47
movq 0x28(%rsp), %rax
cmpl $0x0, 0x1c(%rsp)
setne %cl
xorb $-0x1, %cl
andb $0x1, %cl
movzbl %cl, %ecx
movl 0x14(%rax,%rcx,4), %edi
leaq 0xc(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq 0x648a0
cmpl $0x0, %eax
setne %al
movb %al, 0x2(%rsp)
movb 0x2(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopl (%rax)