// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
xorl %ebp, %ebp
testl %edi, %edi
js 0x337fe
movq %rdx, %rbx
movq %rsi, %r14
movq 0x66c654d(%rip), %rax   # 0x66f9ae0
movsd 0xb685(%rip), %xmm7     # 0x3ec20
movapd 0xb33c(%rip), %xmm8     # 0x3e8e0
movaps 0x6d94(%rip), %xmm9     # 0x3a340
movsd 0x7043(%rip), %xmm10    # 0x3a5f8
movl %edi, %ecx
leaq (%rcx,%rcx,8), %rcx
leaq (%rax,%rcx,4), %r12
movl (%r12), %ecx
cmpl $0x2, %ecx
je 0x335e9
cmpl $0x1, %ecx
je 0x335dc
testl %ecx, %ecx
jne 0x33607
movss (%r14), %xmm1
movss (%rbx), %xmm0
jmp 0x335f4
movss 0x4(%r14), %xmm1
movss 0x4(%rbx), %xmm0
jmp 0x335f4
movss 0x8(%r14), %xmm1
movss 0x8(%rbx), %xmm0
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movss 0x10(%r12), %xmm1
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
subps %xmm1, %xmm0
jmp 0x3366d
movss (%r14), %xmm0
movss 0x4(%r14), %xmm1
movss 0x8(%r14), %xmm2
movss (%rbx), %xmm3
unpcklps %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
movss 0x4(%rbx), %xmm4
unpcklps %xmm1, %xmm4            # xmm4 = xmm4[0],xmm1[0],xmm4[1],xmm1[1]
movss 0x8(%rbx), %xmm1
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movss 0x4(%r12), %xmm2
movss 0x8(%r12), %xmm5
movss 0xc(%r12), %xmm0
movss 0x10(%r12), %xmm6
shufps $0x0, %xmm5, %xmm5      # xmm5 = xmm5[0,0,0,0]
mulps %xmm4, %xmm5
shufps $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0]
mulps %xmm3, %xmm2
addps %xmm5, %xmm2
shufps $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
mulps %xmm1, %xmm0
addps %xmm2, %xmm0
shufps $0x0, %xmm6, %xmm6      # xmm6 = xmm6[0,0,0,0]
subps %xmm6, %xmm0
cvtps2pd %xmm0, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
ucomisd %xmm7, %xmm2
jbe 0x3368e
movl $0x14, %r15d
ucomisd %xmm7, %xmm1
ja 0x3370f
cmpltpd %xmm8, %xmm1
movmskpd %xmm1, %ecx
movl $0x18, %r15d
cmpl $0x3, %ecx
je 0x3370f
movaps %xmm0, %xmm1
shufps $0x55, %xmm0, %xmm1     # xmm1 = xmm1[1,1],xmm0[1,1]
movaps %xmm1, %xmm2
andps %xmm9, %xmm2
cvtss2sd %xmm2, %xmm2
ucomisd %xmm2, %xmm10
jb 0x33720
movaps %xmm0, %xmm2
andps %xmm9, %xmm2
cvtss2sd %xmm2, %xmm2
ucomisd %xmm2, %xmm10
jb 0x33720
movl 0x14(%r12), %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x33570
testl %eax, %eax
jne 0x337f9
movq 0x66c63f3(%rip), %rax   # 0x66f9ae0
movsd 0xb52b(%rip), %xmm7     # 0x3ec20
movapd 0xb1e2(%rip), %xmm8     # 0x3e8e0
movaps 0x6c3a(%rip), %xmm9     # 0x3a340
movsd 0x6ee9(%rip), %xmm10    # 0x3a5f8
movl (%r12,%r15), %edi
testl %edi, %edi
jns 0x335b5
jmp 0x337fe
movaps %xmm1, %xmm2
subss %xmm0, %xmm2
movss %xmm2, 0xc(%rsp)
divss %xmm2, %xmm1
xorps %xmm0, %xmm0
maxss %xmm1, %xmm0
movss 0x3964(%rip), %xmm1     # 0x370a4
minss %xmm0, %xmm1
movsd (%r14), %xmm0
movsd (%rbx), %xmm2
subps %xmm0, %xmm2
movaps %xmm1, %xmm3
unpcklps %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
mulps %xmm2, %xmm3
addps %xmm0, %xmm3
movlps %xmm3, 0x10(%rsp)
movss 0x8(%r14), %xmm0
movss 0x8(%rbx), %xmm2
subss %xmm0, %xmm2
mulss %xmm1, %xmm2
addss %xmm0, %xmm2
movss %xmm2, 0x18(%rsp)
cmpl $0x0, 0x20(%r12)
jle 0x337ae
movl 0x1c(%r12), %ebp
leaq 0x10(%rsp), %r15
movl %ebp, %edi
movq %r15, %rsi
callq 0x3333a
testl %eax, %eax
jne 0x337f9
incl %ebp
movl 0x20(%r12), %eax
addl 0x1c(%r12), %eax
cmpl %eax, %ebp
jl 0x33790
xorl %eax, %eax
xorps %xmm0, %xmm0
ucomiss 0xc(%rsp), %xmm0
seta %al
movl 0x14(%r12,%rax,4), %edi
leaq 0x10(%rsp), %rdx
movq %r14, %rsi
callq 0x33570
movl $0x1, %ebp
testl %eax, %eax
jne 0x337fe
xorps %xmm0, %xmm0
xorl %eax, %eax
ucomiss 0xc(%rsp), %xmm0
setbe %al
movl 0x14(%r12,%rax,4), %edi
leaq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0x33570
movl %eax, %ebp
jmp 0x337fe
movl $0x1, %ebp
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq