// File: /workspace/github_cpp_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movsd 0xa61d(%rip), %xmm7     # 0x39820
pushq $0x14
popq %r15
movapd 0xa950(%rip), %xmm8     # 0x39b60
pushq $0x18
popq %r12
movaps 0x6084(%rip), %xmm9     # 0x352a0
movsd 0x6383(%rip), %xmm10    # 0x355a8
pushq $0x1
popq %rbp
testl %edi, %edi
js 0x2f382
movq 0x66c78b9(%rip), %rax   # 0x66f6af0
movl %edi, %ecx
imulq $0x24, %rcx, %rcx
leaq (%rax,%rcx), %r13
movl (%rax,%rcx), %eax
cmpl $0x2, %eax
je 0x2f26a
cmpl $0x1, %eax
je 0x2f25d
testl %eax, %eax
jne 0x2f287
movss (%r14), %xmm1
movss (%rbx), %xmm0
jmp 0x2f275
movss 0x4(%r14), %xmm1
movss 0x4(%rbx), %xmm0
jmp 0x2f275
movss 0x8(%r14), %xmm1
movss 0x8(%rbx), %xmm0
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movss 0x10(%r13), %xmm1
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
subps %xmm1, %xmm0
jmp 0x2f2e9
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(%r13), %xmm2
movss 0x8(%r13), %xmm5
movss 0xc(%r13), %xmm0
movss 0x10(%r13), %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 0x2f303
ucomisd %xmm7, %xmm1
movq %r15, %rcx
ja 0x2f378
cmpltpd %xmm8, %xmm1
movmskpd %xmm1, %eax
movq %r12, %rcx
cmpl $0x3, %eax
je 0x2f378
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 0x2f395
movaps %xmm0, %xmm2
andps %xmm9, %xmm2
cvtss2sd %xmm2, %xmm2
ucomisd %xmm2, %xmm10
jb 0x2f395
movl 0x14(%r13), %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2f1e7
movsd 0x6250(%rip), %xmm10    # 0x355a8
movaps 0x5f40(%rip), %xmm9     # 0x352a0
movapd 0xa7f7(%rip), %xmm8     # 0x39b60
movsd 0xa4af(%rip), %xmm7     # 0x39820
movq %r12, %rcx
testl %eax, %eax
jne 0x2f384
movl (%r13,%rcx), %edi
jmp 0x2f228
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movaps %xmm1, %xmm4
subss %xmm0, %xmm4
divss %xmm4, %xmm1
xorps %xmm0, %xmm0
maxss %xmm1, %xmm0
movss 0x2cb5(%rip), %xmm1     # 0x32064
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
leaq 0x8(%rsp), %r15
movlps %xmm3, (%r15)
movss 0x8(%r14), %xmm0
movss 0x8(%rbx), %xmm2
subss %xmm0, %xmm2
mulss %xmm1, %xmm2
addss %xmm0, %xmm2
movss %xmm2, 0x8(%r15)
movl 0x1c(%r13), %r12d
pushq $0x1
popq %rbp
movss %xmm4, 0x4(%rsp)
movl 0x20(%r13), %eax
addl 0x1c(%r13), %eax
cmpl %eax, %r12d
jge 0x2f428
movl %r12d, %edi
movq %r15, %rsi
callq 0x2efca
movss 0x4(%rsp), %xmm4
incl %r12d
testl %eax, %eax
je 0x2f3fe
jmp 0x2f384
xorps %xmm0, %xmm0
xorl %eax, %eax
ucomiss %xmm4, %xmm0
seta %al
movl 0x14(%r13,%rax,4), %edi
leaq 0x8(%rsp), %rdx
movq %r14, %rsi
callq 0x2f1e7
testl %eax, %eax
jne 0x2f384
xorl %eax, %eax
xorps %xmm0, %xmm0
ucomiss 0x4(%rsp), %xmm0
setbe %al
movl 0x14(%r13,%rax,4), %edi
leaq 0x8(%rsp), %rsi
movq %rbx, %rdx
callq 0x2f1e7
movl %eax, %ebp
jmp 0x2f384