// File: /workspace/github_cpp_makefile_star2_O1/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
movq %rdx, %rbx
movq %rsi, %r14
movsd 0xb6d0(%rip), %xmm7     # 0x3fca0
movapd 0xb387(%rip), %xmm8     # 0x3f960
movaps 0x6d5f(%rip), %xmm9     # 0x3b340
movsd 0x705e(%rip), %xmm10    # 0x3b648
testl %edi, %edi
js 0x34738
movq 0x66c64e7(%rip), %rax   # 0x66faae0
movl %edi, %ecx
leaq (%rcx,%rcx,8), %rcx
leaq (%rax,%rcx,4), %r12
movl (%r12), %eax
cmpl $0x2, %eax
je 0x3462d
cmpl $0x1, %eax
je 0x34620
testl %eax, %eax
jne 0x3464b
movss (%r14), %xmm1
movss (%rbx), %xmm0
jmp 0x34638
movss 0x4(%r14), %xmm1
movss 0x4(%rbx), %xmm0
jmp 0x34638
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 0x346b1
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 0x346d2
ucomisd %xmm7, %xmm1
jbe 0x346d2
movl 0x14(%r12), %edi
jmp 0x345ea
cmpltpd %xmm8, %xmm1
movmskpd %xmm1, %eax
cmpl $0x3, %eax
jne 0x346eb
movl 0x18(%r12), %edi
jmp 0x345ea
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 0x3473f
movaps %xmm0, %xmm2
andps %xmm9, %xmm2
cvtss2sd %xmm2, %xmm2
ucomisd %xmm2, %xmm10
jb 0x3473f
movl 0x14(%r12), %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x345b6
testl %eax, %eax
jne 0x34818
movl 0x18(%r12), %edi
jmp 0x345c8
xorl %eax, %eax
jmp 0x3481d
movaps %xmm1, %xmm2
subss %xmm0, %xmm2
movss %xmm2, 0xc(%rsp)
divss %xmm2, %xmm1
xorps %xmm0, %xmm0
maxss %xmm1, %xmm0
movss 0x39d9(%rip), %xmm1     # 0x38138
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 0x347cd
movl 0x1c(%r12), %ebp
leaq 0x10(%rsp), %r15
movl %ebp, %edi
movq %r15, %rsi
callq 0x34380
testl %eax, %eax
jne 0x34818
incl %ebp
movl 0x20(%r12), %eax
addl 0x1c(%r12), %eax
cmpl %eax, %ebp
jl 0x347af
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 0x345b6
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0x3481d
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 0x345b6
jmp 0x3481d
movl $0x1, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq