// File: FreeSlave[P]vhlt/hlrad/mathutil.cpp
// Function: point_in_winding(Winding const&, dplane_t const&, float const*, float)
bool            point_in_winding(const Winding& w, const dplane_t& plane, const vec_t* const point, vec_t epsilon/* = 0.0*/)
{
	int				numpoints;
	int				x;
	vec3_t			delta;
	vec3_t			normal;
	vec_t			dist;

	numpoints = w.m_NumPoints;

	for (x = 0; x < numpoints; x++)
	{
		VectorSubtract (w.m_Points[(x+ 1) % numpoints], w.m_Points[x], delta);
		CrossProduct (delta, plane.normal, normal);
		dist = DotProduct (point, normal) - DotProduct (w.m_Points[x], normal);

		if (dist < 0.0
			&& (epsilon == 0.0 || dist * dist > epsilon * epsilon * DotProduct (normal, normal)))
		{
			return false;
		}
	}

	return true;
}

// Assembly:
movq %rdi, -0x10(%rsp)
movq %rsi, -0x18(%rsp)
movq %rdx, -0x20(%rsp)
movss %xmm0, -0x24(%rsp)
movq -0x10(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x28(%rsp)
movl $0x0, -0x2c(%rsp)
movl -0x2c(%rsp), %eax
cmpl -0x28(%rsp), %eax
jge 0x4a16e
movq -0x10(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x60(%rsp)
movl -0x2c(%rsp), %eax
addl $0x1, %eax
cltd
idivl -0x28(%rsp)
movq -0x60(%rsp), %rax
movslq %edx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm0
movq -0x10(%rsp), %rax
movq 0x10(%rax), %rax
movslq -0x2c(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
subss (%rax), %xmm0
movss %xmm0, -0x38(%rsp)
movq -0x10(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x58(%rsp)
movl -0x2c(%rsp), %eax
addl $0x1, %eax
cltd
idivl -0x28(%rsp)
movq -0x58(%rsp), %rax
movslq %edx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x4(%rax), %xmm0
movq -0x10(%rsp), %rax
movq 0x10(%rax), %rax
movslq -0x2c(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
subss 0x4(%rax), %xmm0
movss %xmm0, -0x34(%rsp)
movq -0x10(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rsp)
movl -0x2c(%rsp), %eax
addl $0x1, %eax
cltd
idivl -0x28(%rsp)
movq -0x50(%rsp), %rax
movslq %edx, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x8(%rax), %xmm0
movq -0x10(%rsp), %rax
movq 0x10(%rax), %rax
movslq -0x2c(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
subss 0x8(%rax), %xmm0
movss %xmm0, -0x30(%rsp)
movss -0x34(%rsp), %xmm0
movq -0x18(%rsp), %rax
movss 0x8(%rax), %xmm2
movss -0x30(%rsp), %xmm1
movq -0x18(%rsp), %rax
mulss 0x4(%rax), %xmm1
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x44(%rsp)
movss -0x30(%rsp), %xmm0
movq -0x18(%rsp), %rax
movss (%rax), %xmm2
movss -0x38(%rsp), %xmm1
movq -0x18(%rsp), %rax
mulss 0x8(%rax), %xmm1
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x40(%rsp)
movss -0x38(%rsp), %xmm0
movq -0x18(%rsp), %rax
movss 0x4(%rax), %xmm2
movss -0x34(%rsp), %xmm1
movq -0x18(%rsp), %rax
mulss (%rax), %xmm1
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x3c(%rsp)
movq -0x20(%rsp), %rax
movss (%rax), %xmm1
movss -0x44(%rsp), %xmm2
movq -0x20(%rsp), %rax
movss 0x4(%rax), %xmm0
mulss -0x40(%rsp), %xmm0
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
movq -0x20(%rsp), %rax
movss 0x8(%rax), %xmm0
movss -0x3c(%rsp), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movq -0x10(%rsp), %rax
movq 0x10(%rax), %rax
movslq -0x2c(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss (%rax), %xmm2
movss -0x44(%rsp), %xmm3
movq -0x10(%rsp), %rax
movq 0x10(%rax), %rax
movslq -0x2c(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x4(%rax), %xmm1
mulss -0x40(%rsp), %xmm1
mulss %xmm3, %xmm2
addss %xmm1, %xmm2
movq -0x10(%rsp), %rax
movq 0x10(%rax), %rax
movslq -0x2c(%rsp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movss 0x8(%rax), %xmm1
movss -0x3c(%rsp), %xmm3
mulss %xmm3, %xmm1
addss %xmm2, %xmm1
subss %xmm1, %xmm0
movss %xmm0, -0x48(%rsp)
movss -0x48(%rsp), %xmm0
cvtss2sd %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x4a15c
movss -0x24(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x4a100
jp 0x4a100
jmp 0x4a155
movss -0x48(%rsp), %xmm0
mulss -0x48(%rsp), %xmm0
movss -0x24(%rsp), %xmm1
mulss -0x24(%rsp), %xmm1
movss -0x44(%rsp), %xmm3
movss -0x44(%rsp), %xmm4
movss -0x40(%rsp), %xmm2
mulss -0x40(%rsp), %xmm2
mulss %xmm4, %xmm3
addss %xmm2, %xmm3
movss -0x3c(%rsp), %xmm2
movss -0x3c(%rsp), %xmm4
mulss %xmm4, %xmm2
addss %xmm3, %xmm2
mulss %xmm2, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x4a15c
movb $0x0, -0x1(%rsp)
jmp 0x4a173
jmp 0x4a15e
movl -0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rsp)
jmp 0x49e79
movb $0x1, -0x1(%rsp)
movb -0x1(%rsp), %al
andb $0x1, %al
retq
nopw (%rax,%rax)