// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/trace.cpp
// Function: TestLineOpaque(int, float const*, float const*, float const*)
int TestLineOpaque (int modelnum, const vec3_t modelorigin, const vec3_t start, const vec3_t stop)
{
	opaquemodel_t *thismodel = &opaquemodels[modelnum];
	vec_t front, back, frac;
	vec3_t p1, p2;
	VectorSubtract (start, modelorigin, p1);
	VectorSubtract (stop, modelorigin, p2);
	int axial;
	for (axial = 0; axial < 3; axial++)
	{
		front = p1[axial] - thismodel->maxs[axial];
		back = p2[axial] - thismodel->maxs[axial];
		if (front >= -ON_EPSILON && back >= -ON_EPSILON)
		{
			return 0;
		}
		if (front > ON_EPSILON || back > ON_EPSILON)
		{
			frac = front / (front - back);
			if (front > back)
			{
				p1[0] = p1[0] + (p2[0] - p1[0]) * frac;
				p1[1] = p1[1] + (p2[1] - p1[1]) * frac;
				p1[2] = p1[2] + (p2[2] - p1[2]) * frac;
			}
			else
			{
				p2[0] = p1[0] + (p2[0] - p1[0]) * frac;
				p2[1] = p1[1] + (p2[1] - p1[1]) * frac;
				p2[2] = p1[2] + (p2[2] - p1[2]) * frac;
			}
		}
		front = thismodel->mins[axial] - p1[axial];
		back = thismodel->mins[axial] - p2[axial];
		if (front >= -ON_EPSILON && back >= -ON_EPSILON)
		{
			return 0;
		}
		if (front > ON_EPSILON || back > ON_EPSILON)
		{
			frac = front / (front - back);
			if (front > back)
			{
				p1[0] = p1[0] + (p2[0] - p1[0]) * frac;
				p1[1] = p1[1] + (p2[1] - p1[1]) * frac;
				p1[2] = p1[2] + (p2[2] - p1[2]) * frac;
			}
			else
			{
				p2[0] = p1[0] + (p2[0] - p1[0]) * frac;
				p2[1] = p1[1] + (p2[1] - p1[1]) * frac;
				p2[2] = p1[2] + (p2[2] - p1[2]) * frac;
			}
		}
	}
	return TestLineOpaque_r (thismodel->headnode, p1, p2);
}

// Assembly:
subq $0x28, %rsp
movslq %edi, %rax
leaq (%rax,%rax,8), %rdi
leaq (%rdi,%rdi,2), %rdi
addq %rax, %rdi
addq 0x66c62c2(%rip), %rdi   # 0x66f9ae8
leaq 0x1c(%rsp), %r8
movss 0x8(%rdx), %xmm6
movss 0x8(%rsi), %xmm0
subss %xmm0, %xmm6
leaq 0x20(%rsp), %r9
movss %xmm6, (%r9)
movsd (%rdx), %xmm7
movsd (%rsi), %xmm1
subps %xmm1, %xmm7
movlps %xmm7, -0x8(%r9)
movsd (%rcx), %xmm2
subps %xmm1, %xmm2
leaq 0xc(%rsp), %rdx
movlps %xmm2, -0x4(%rdx)
movss 0x8(%rcx), %xmm3
subss %xmm0, %xmm3
leaq 0x10(%rsp), %rcx
movss %xmm3, (%rcx)
xorl %eax, %eax
movsd 0x6d71(%rip), %xmm0     # 0x3a5f0
movsd 0x6d71(%rip), %xmm1     # 0x3a5f8
xorl %esi, %esi
movss 0x18(%rsp,%rsi,4), %xmm8
movss 0xc(%rdi,%rsi,4), %xmm5
movaps %xmm8, %xmm10
subss %xmm5, %xmm10
movss 0x8(%rsp,%rsi,4), %xmm9
movaps %xmm9, %xmm4
subss %xmm5, %xmm4
xorps %xmm11, %xmm11
cvtss2sd %xmm10, %xmm11
ucomisd %xmm0, %xmm11
xorps %xmm5, %xmm5
cvtss2sd %xmm4, %xmm5
jb 0x338cf
ucomisd %xmm0, %xmm5
jae 0x33a1d
ucomisd %xmm1, %xmm11
ja 0x338e1
ucomisd %xmm1, %xmm5
ja 0x338e1
movaps %xmm6, %xmm5
jmp 0x33948
movaps %xmm10, %xmm5
ucomiss %xmm4, %xmm10
subss %xmm4, %xmm5
divss %xmm5, %xmm10
movaps %xmm2, %xmm5
subps %xmm7, %xmm5
movaps %xmm10, %xmm4
shufps $0x0, %xmm10, %xmm4     # xmm4 = xmm4[0,0],xmm10[0,0]
mulps %xmm5, %xmm4
addps %xmm7, %xmm4
movaps %xmm3, %xmm5
subss %xmm6, %xmm5
mulss %xmm10, %xmm5
addss %xmm6, %xmm5
jbe 0x3392d
movlps %xmm4, 0x18(%rsp)
movss %xmm5, 0x20(%rsp)
movss 0x18(%rsp,%rsi,4), %xmm8
jmp 0x3394b
movlps %xmm4, 0x8(%rsp)
movss %xmm5, 0x10(%rsp)
movss 0x8(%rsp,%rsi,4), %xmm9
movaps %xmm5, %xmm3
movaps %xmm6, %xmm5
movaps %xmm4, %xmm2
movaps %xmm7, %xmm4
movss (%rdi,%rsi,4), %xmm6
movaps %xmm6, %xmm10
subss %xmm8, %xmm10
subss %xmm9, %xmm6
xorps %xmm8, %xmm8
cvtss2sd %xmm10, %xmm8
ucomisd %xmm0, %xmm8
xorps %xmm7, %xmm7
cvtss2sd %xmm6, %xmm7
jb 0x3397f
ucomisd %xmm0, %xmm7
jae 0x33a1d
ucomisd %xmm1, %xmm8
ja 0x3398c
ucomisd %xmm1, %xmm7
jbe 0x339f8
movaps %xmm10, %xmm7
ucomiss %xmm6, %xmm10
subss %xmm6, %xmm7
divss %xmm7, %xmm10
movaps %xmm2, %xmm7
subps %xmm4, %xmm7
movaps %xmm10, %xmm6
shufps $0x0, %xmm10, %xmm6     # xmm6 = xmm6[0,0],xmm10[0,0]
mulps %xmm7, %xmm6
addps %xmm4, %xmm6
movaps %xmm3, %xmm7
subss %xmm5, %xmm7
mulss %xmm10, %xmm7
addss %xmm5, %xmm7
jbe 0x339d8
movss %xmm6, 0x18(%rsp)
movq %r8, %r10
movq %r9, %r11
movaps %xmm7, %xmm5
movaps %xmm6, %xmm4
jmp 0x339ea
movss %xmm6, 0x8(%rsp)
movq %rdx, %r10
movq %rcx, %r11
movaps %xmm7, %xmm3
movaps %xmm6, %xmm2
shufps $0x55, %xmm6, %xmm6     # xmm6 = xmm6[1,1,1,1]
movss %xmm6, (%r10)
movss %xmm7, (%r11)
incq %rsi
movaps %xmm5, %xmm6
movaps %xmm4, %xmm7
cmpq $0x3, %rsi
jne 0x33889
movl 0x18(%rdi), %edi
leaq 0x18(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x33570
addq $0x28, %rsp
retq