// File: /workspace/github_cpp_makefile_star2_O1/FreeSlave[P]vhlt/hlrad/trace.cpp
// Function: TestLineOpaque_face(int, float const*)
int TestLineOpaque_face (int facenum, const vec3_t hit)
{
	opaqueface_t *thisface = &opaquefaces[facenum];
	int x;
	if (thisface->numedges == 0)
	{
		Developer (DEVELOPER_LEVEL_WARNING, "Warning: TestLineOpaque: Empty face.\n");
		return 0;
	}
	for (x = 0; x < thisface->numedges; x++)
	{
		if (DotProduct (hit, thisface->edges[x].normal) - thisface->edges[x].dist > ON_EPSILON)
		{
			return 0;
		}
	}
#ifdef HLRAD_OPAQUE_ALPHATEST
	if (thisface->tex_alphatest)
	{
		double x, y;
		x = DotProduct (hit, thisface->tex_vecs[0]) + thisface->tex_vecs[0][3];
		y = DotProduct (hit, thisface->tex_vecs[1]) + thisface->tex_vecs[1][3];
		x = floor (x - thisface->tex_width * floor (x / thisface->tex_width));
		y = floor (y - thisface->tex_height * floor (y / thisface->tex_height));
		x = x > thisface->tex_width - 1? thisface->tex_width - 1: x < 0? 0: x;
		y = y > thisface->tex_height - 1? thisface->tex_height - 1: y < 0? 0: y;
		if (thisface->tex_canvas[(int)y * thisface->tex_width + (int)x] == 0xFF)
		{
			return 0;
		}
	}
#endif
	return 1;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x58, %rsp
movq 0x66c674a(%rip), %r14   # 0x66faad8
movslq %edi, %rax
leaq (%rax,%rax,2), %rax
shlq $0x5, %rax
movl 0x1c(%r14,%rax), %ecx
testq %rcx, %rcx
je 0x34593
addq %rax, %r14
testl %ecx, %ecx
jle 0x34416
movss (%rsi), %xmm0
movss 0x4(%rsi), %xmm1
movq 0x20(%r14), %rax
movss 0x8(%rsi), %xmm2
shlq $0x2, %rcx
leaq (%rcx,%rcx,4), %rcx
xorl %ebx, %ebx
movsd 0x7276(%rip), %xmm3     # 0x3b648
xorl %edx, %edx
movss 0x4(%rax,%rdx), %xmm4
mulss %xmm1, %xmm4
movss (%rax,%rdx), %xmm5
mulss %xmm0, %xmm5
addss %xmm4, %xmm5
movss 0x8(%rax,%rdx), %xmm4
mulss %xmm2, %xmm4
addss %xmm5, %xmm4
subss 0xc(%rax,%rdx), %xmm4
cvtss2sd %xmm4, %xmm4
ucomisd %xmm3, %xmm4
ja 0x345a8
addq $0x14, %rdx
cmpq %rdx, %rcx
jne 0x343d4
cmpb $0x1, 0x2c(%r14)
jne 0x3458c
movss (%rsi), %xmm0
movss 0x4(%rsi), %xmm1
movss 0x8(%rsi), %xmm2
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
movss 0x44(%r14), %xmm3
movss 0x30(%r14), %xmm4
movss 0x34(%r14), %xmm5
unpcklps %xmm3, %xmm5            # xmm5 = xmm5[0],xmm3[0],xmm5[1],xmm3[1]
mulps %xmm1, %xmm5
movss 0x38(%r14), %xmm1
movss 0x3c(%r14), %xmm3
shufps $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movss 0x40(%r14), %xmm6
unpcklps %xmm6, %xmm4            # xmm4 = xmm4[0],xmm6[0],xmm4[1],xmm6[1]
mulps %xmm0, %xmm4
addps %xmm5, %xmm4
shufps $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0]
movss 0x48(%r14), %xmm0
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
mulps %xmm2, %xmm1
addps %xmm4, %xmm1
movss 0x4c(%r14), %xmm0
unpcklps %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
addps %xmm1, %xmm3
cvtps2pd %xmm3, %xmm1
movapd %xmm1, 0x10(%rsp)
movq 0x50(%r14), %rbx
movq %rbx, %xmm0
movdqa %xmm0, 0x40(%rsp)
cvtdq2pd %xmm0, %xmm0
movapd %xmm0, (%rsp)
divpd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
movapd %xmm1, %xmm0
callq 0x4580
movapd %xmm0, 0x30(%rsp)
movapd 0x20(%rsp), %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
callq 0x4580
movapd 0x30(%rsp), %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
mulpd (%rsp), %xmm1
movapd 0x10(%rsp), %xmm0
subpd %xmm1, %xmm0
movapd %xmm0, 0x10(%rsp)
callq 0x4580
movapd %xmm0, (%rsp)
movapd 0x10(%rsp), %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
callq 0x4580
movapd (%rsp), %xmm5
unpcklpd %xmm0, %xmm5            # xmm5 = xmm5[0],xmm0[0]
xorpd %xmm1, %xmm1
movapd %xmm5, %xmm2
cmpltpd %xmm1, %xmm2
movmskpd %xmm2, %eax
xorpd %xmm1, %xmm1
xorps %xmm4, %xmm4
testb $0x1, %al
jne 0x34533
movapd %xmm5, %xmm4
pcmpeqd %xmm2, %xmm2
movdqa 0x40(%rsp), %xmm3
paddd %xmm2, %xmm3
cvtdq2pd %xmm3, %xmm3
movapd %xmm3, %xmm2
cmpltpd %xmm5, %xmm2
movmskpd %xmm2, %ecx
movapd %xmm3, %xmm2
testb $0x1, %cl
jne 0x3455e
movaps %xmm4, %xmm2
testb $0x2, %al
jne 0x34566
movapd %xmm0, %xmm1
testb $0x2, %cl
je 0x34573
unpckhpd %xmm3, %xmm3            # xmm3 = xmm3[1,1]
movapd %xmm3, %xmm1
cvttsd2si %xmm1, %eax
movq 0x58(%r14), %rcx
imull %eax, %ebx
cvttsd2si %xmm2, %eax
addl %ebx, %eax
cltq
cmpb $-0x1, (%rcx,%rax)
je 0x345b2
movl $0x1, %ebx
jmp 0x345a8
leaq 0xb777(%rip), %rsi      # 0x3fd11
xorl %ebx, %ebx
movl $0x2, %edi
xorl %eax, %eax
callq 0xa52e
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r14
retq
xorl %ebx, %ebx
jmp 0x345a8