// File: FreeSlave[P]vhlt/hlrad/trace.cpp
// Function: TestPointOpaque_r(int, bool, float const*)
int TestPointOpaque_r (int nodenum, bool solid, const vec3_t point)
{
	opaquenode_t *thisnode;
	vec_t dist;
	while (1)
	{
		if (nodenum < 0)
		{
			if (solid && g_dleafs[-nodenum-1].contents == CONTENTS_SOLID)
				return 1;
			else
				return 0;
		}
		thisnode = &opaquenodes[nodenum];
		switch (thisnode->type)
		{
		case plane_x:
			dist = point[0] - thisnode->dist;
			break;
		case plane_y:
			dist = point[1] - thisnode->dist;
			break;
		case plane_z:
			dist = point[2] - thisnode->dist;
			break;
		default:
			dist = DotProduct (point, thisnode->normal) - thisnode->dist;
		}
		if (dist > HUNT_WALL_EPSILON)
		{
			nodenum = thisnode->children[0];
		}
		else if (dist < -HUNT_WALL_EPSILON)
		{
			nodenum = thisnode->children[1];
		}
		else
		{
			break;
		}
	}
	{
		int facenum;
		for (facenum = thisnode->firstface; facenum < thisnode->firstface + thisnode->numfaces; facenum++)
		{
			if (TestLineOpaque_face (facenum, point))
			{
				return 1;
			}
		}
	}
	return TestPointOpaque_r (thisnode->children[0], solid, point)
		|| TestPointOpaque_r (thisnode->children[1], solid, point);
}

// Assembly:
subq $0x38, %rsp
movb %sil, %al
movl %edi, 0x30(%rsp)
andb $0x1, %al
movb %al, 0x2f(%rsp)
movq %rdx, 0x20(%rsp)
cmpl $0x0, 0x30(%rsp)
jge 0x6531d
testb $0x1, 0x2f(%rsp)
je 0x65310
xorl %eax, %eax
subl 0x30(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0xa211d9(%rip), %rax    # 0xa864d0
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x2, (%rax)
jne 0x65310
movl $0x1, 0x34(%rsp)
jmp 0x6550d
movl $0x0, 0x34(%rsp)
jmp 0x6550d
movq 0x66ca7dc(%rip), %rax   # 0x672fb00
movslq 0x30(%rsp), %rcx
leaq (%rcx,%rcx,8), %rcx
leaq (%rax,%rcx,4), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movl (%rax), %eax
movl %eax, 0xc(%rsp)
testl %eax, %eax
je 0x6535d
jmp 0x65347
movl 0xc(%rsp), %eax
subl $0x1, %eax
je 0x6537b
jmp 0x65352
movl 0xc(%rsp), %eax
subl $0x2, %eax
je 0x65397
jmp 0x653b3
movq 0x20(%rsp), %rax
movss (%rax), %xmm0
movq 0x18(%rsp), %rax
subss 0x10(%rax), %xmm0
movss %xmm0, 0x14(%rsp)
jmp 0x6540e
movq 0x20(%rsp), %rax
movss 0x4(%rax), %xmm0
movq 0x18(%rsp), %rax
subss 0x10(%rax), %xmm0
movss %xmm0, 0x14(%rsp)
jmp 0x6540e
movq 0x20(%rsp), %rax
movss 0x8(%rax), %xmm0
movq 0x18(%rsp), %rax
subss 0x10(%rax), %xmm0
movss %xmm0, 0x14(%rsp)
jmp 0x6540e
movq 0x20(%rsp), %rax
movss (%rax), %xmm1
movq 0x18(%rsp), %rax
movss 0x4(%rax), %xmm2
movq 0x20(%rsp), %rax
movss 0x4(%rax), %xmm0
movq 0x18(%rsp), %rax
mulss 0x8(%rax), %xmm0
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
movq 0x20(%rsp), %rax
movss 0x8(%rax), %xmm0
movq 0x18(%rsp), %rax
movss 0xc(%rax), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movq 0x18(%rsp), %rax
subss 0x10(%rax), %xmm0
movss %xmm0, 0x14(%rsp)
movss 0x14(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0xc460(%rip), %xmm1     # 0x71880
ucomisd %xmm1, %xmm0
jbe 0x65434
movq 0x18(%rsp), %rax
movl 0x14(%rax), %eax
movl %eax, 0x30(%rsp)
jmp 0x6545e
movss 0x14(%rsp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0xc442(%rip), %xmm0     # 0x71888
ucomisd %xmm1, %xmm0
jbe 0x6545a
movq 0x18(%rsp), %rax
movl 0x18(%rax), %eax
movl %eax, 0x30(%rsp)
jmp 0x6545c
jmp 0x65463
jmp 0x6545e
jmp 0x652d6
movq 0x18(%rsp), %rax
movl 0x1c(%rax), %eax
movl %eax, 0x10(%rsp)
movl 0x10(%rsp), %eax
movq 0x18(%rsp), %rcx
movl 0x1c(%rcx), %ecx
movq 0x18(%rsp), %rdx
addl 0x20(%rdx), %ecx
cmpl %ecx, %eax
jge 0x654b3
movl 0x10(%rsp), %edi
movq 0x20(%rsp), %rsi
callq 0x644a0
cmpl $0x0, %eax
je 0x654a4
movl $0x1, 0x34(%rsp)
jmp 0x6550d
jmp 0x654a6
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x6546f
movq 0x18(%rsp), %rax
movl 0x14(%rax), %edi
movb 0x2f(%rsp), %al
movq 0x20(%rsp), %rdx
andb $0x1, %al
movzbl %al, %esi
callq 0x652c0
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, 0xb(%rsp)
jne 0x65500
movq 0x18(%rsp), %rax
movl 0x18(%rax), %edi
movb 0x2f(%rsp), %al
movq 0x20(%rsp), %rdx
andb $0x1, %al
movzbl %al, %esi
callq 0x652c0
cmpl $0x0, %eax
setne %al
movb %al, 0xb(%rsp)
movb 0xb(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)