// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/common/winding.cpp
// Function: Winding::Check(double) const
vec_t epsilon
#endif
							   ) const
{
    unsigned int    i, j;
    vec_t*          p1;
    vec_t*          p2;
    vec_t           d, edgedist;
    vec3_t          dir, edgenormal, facenormal;
    vec_t           area;
    vec_t           facedist;

    if (m_NumPoints < 3)
    {
        Error("Winding::Check : %i points", m_NumPoints);
    }

    area = getArea();
    if (area < 1)
    {
        Error("Winding::Check : %f area", area);
    }

    getPlane(facenormal, facedist);

    for (i = 0; i < m_NumPoints; i++)
    {
        p1 = m_Points[i];

        for (j = 0; j < 3; j++)
        {
            if (p1[j] > BOGUS_RANGE || p1[j] < -BOGUS_RANGE)
            {
                Error("Winding::Check : BOGUS_RANGE: %f", p1[j]);
            }
        }

        j = i + 1 == m_NumPoints ? 0 : i + 1;

        // check the point is on the face plane
        d = DotProduct(p1, facenormal) - facedist;
        if (d < -ON_EPSILON || d > ON_EPSILON)
        {
            Error("Winding::Check : point off plane");
        }

        // check the edge isn't degenerate
        p2 = m_Points[j];
        VectorSubtract(p2, p1, dir);

        if (VectorLength(dir) < ON_EPSILON)
        {
            Error("Winding::Check : degenerate edge");
        }

        CrossProduct(facenormal, dir, edgenormal);
        VectorNormalize(edgenormal);
        edgedist = DotProduct(p1, edgenormal);
        edgedist += ON_EPSILON;

        // all other points must be on front side
        for (j = 0; j < m_NumPoints; j++)
        {
            if (j == i)
            {
                continue;
            }
            d = DotProduct(m_Points[j], edgenormal);
            if (d > edgedist)
            {
                Error("Winding::Check : non-convex");
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movapd %xmm0, 0x10(%rsp)
movq %rdi, %rbx
movl 0x8(%rdi), %esi
cmpl $0x2, %esi
ja 0xbeee
leaq 0x13444(%rip), %rdi     # 0x1f32b
xorl %eax, %eax
callq 0xa164
movq %rbx, %rdi
callq 0xbba2
movsd 0x131ea(%rip), %xmm1    # 0x1f0e8
ucomisd %xmm0, %xmm1
jbe 0xbf12
leaq 0x1343b(%rip), %rdi     # 0x1f346
movb $0x1, %al
callq 0xa164
leaq 0x90(%rsp), %rsi
leaq 0x58(%rsp), %rdx
movq %rbx, %rdi
callq 0xba7e
cmpl $0x0, 0x8(%rbx)
je 0xc2a1
movsd 0x90(%rsp), %xmm0
movsd 0x98(%rsp), %xmm1
movsd 0xa0(%rsp), %xmm2
movsd 0x58(%rsp), %xmm3
movsd %xmm3, 0x48(%rsp)
movapd 0x13380(%rip), %xmm3    # 0x1f2e0
movapd 0x10(%rsp), %xmm4
xorpd %xmm3, %xmm4
movapd %xmm4, 0xd0(%rsp)
movapd %xmm2, 0x60(%rsp)
xorpd %xmm3, %xmm2
movapd %xmm2, 0xc0(%rsp)
movapd %xmm0, 0x80(%rsp)
xorpd %xmm3, %xmm0
movapd %xmm0, 0xb0(%rsp)
movapd %xmm1, 0x70(%rsp)
xorpd %xmm1, %xmm3
movapd %xmm3, 0xe0(%rsp)
leaq 0x133a9(%rip), %r14     # 0x1f35f
movq $0x0, 0x8(%rsp)
xorl %r12d, %r12d
movq %r12, %r15
movq 0x10(%rbx), %r12
leaq (%r15,%r15,2), %rax
leaq (%r12,%rax,8), %r13
addq 0x8(%rsp), %r12
xorl %ebp, %ebp
movsd (%r12,%rbp,8), %xmm0
movapd %xmm0, %xmm1
andpd 0x13306(%rip), %xmm1    # 0x1f2f0
ucomisd 0x132a6(%rip), %xmm1    # 0x1f298
jbe 0xbffe
movq %r14, %rdi
movb $0x1, %al
callq 0xa164
incq %rbp
cmpq $0x3, %rbp
jne 0xbfd8
movl 0x8(%rbx), %ebp
movsd (%r13), %xmm0
movsd 0x8(%r13), %xmm1
movapd %xmm1, %xmm2
mulsd 0x70(%rsp), %xmm2
movapd %xmm0, %xmm3
mulsd 0x80(%rsp), %xmm3
addsd %xmm2, %xmm3
movsd 0x10(%r13), %xmm6
movapd %xmm6, %xmm2
mulsd 0x60(%rsp), %xmm2
addsd %xmm3, %xmm2
subsd 0x48(%rsp), %xmm2
movapd 0xd0(%rsp), %xmm3
ucomisd %xmm2, %xmm3
ja 0xc062
ucomisd 0x10(%rsp), %xmm2
jbe 0xc082
leaq 0x13317(%rip), %rdi     # 0x1f380
xorl %eax, %eax
callq 0xa164
movsd (%r13), %xmm0
movsd 0x8(%r13), %xmm1
movsd 0x10(%r13), %xmm6
leaq 0x1(%r15), %r12
movl %r12d, %eax
cmpq %rbp, %r12
movq 0x10(%rbx), %rcx
movl $0x0, %edx
cmovneq %rax, %rdx
leaq (%rdx,%rdx,2), %rax
movsd (%rcx,%rax,8), %xmm7
movsd 0x8(%rcx,%rax,8), %xmm8
subsd %xmm0, %xmm7
subsd %xmm1, %xmm8
movsd 0x10(%rcx,%rax,8), %xmm5
subsd %xmm6, %xmm5
movapd %xmm8, %xmm2
mulsd %xmm8, %xmm2
movapd %xmm7, %xmm3
mulsd %xmm7, %xmm3
addsd %xmm2, %xmm3
movapd %xmm5, %xmm2
mulsd %xmm5, %xmm2
addsd %xmm3, %xmm2
sqrtsd %xmm2, %xmm2
movapd 0x10(%rsp), %xmm3
ucomisd %xmm2, %xmm3
jbe 0xc132
leaq 0x132ac(%rip), %rdi     # 0x1f3a1
xorl %eax, %eax
movapd %xmm7, 0x30(%rsp)
movsd %xmm5, 0x20(%rsp)
movsd %xmm8, (%rsp)
callq 0xa164
movsd (%rsp), %xmm8
movsd 0x20(%rsp), %xmm5
movapd 0x30(%rsp), %xmm7
movsd (%r13), %xmm0
movsd 0x8(%r13), %xmm1
movsd 0x10(%r13), %xmm6
movapd 0x80(%rsp), %xmm4
mulsd %xmm8, %xmm4
mulsd 0xc0(%rsp), %xmm8
movapd 0x70(%rsp), %xmm2
mulsd %xmm5, %xmm2
addsd %xmm8, %xmm2
mulsd 0xb0(%rsp), %xmm5
movapd 0x60(%rsp), %xmm3
mulsd %xmm7, %xmm3
addsd %xmm5, %xmm3
mulsd 0xe0(%rsp), %xmm7
addsd %xmm4, %xmm7
movapd %xmm3, %xmm4
mulsd %xmm3, %xmm4
movapd %xmm2, %xmm5
mulsd %xmm2, %xmm5
addsd %xmm4, %xmm5
movapd %xmm7, %xmm4
mulsd %xmm7, %xmm4
addsd %xmm5, %xmm4
xorps %xmm5, %xmm5
sqrtsd %xmm4, %xmm5
movsd 0xff6c(%rip), %xmm4     # 0x1c118
ucomisd %xmm5, %xmm4
xorpd %xmm4, %xmm4
xorpd %xmm8, %xmm8
ja 0xc1cc
divsd %xmm5, %xmm2
divsd %xmm5, %xmm3
movapd %xmm3, %xmm4
movapd %xmm2, %xmm8
movl 0x8(%rbx), %eax
testl %eax, %eax
je 0xc2a1
divsd %xmm5, %xmm7
cmpltsd 0xff34(%rip), %xmm5     # 0x1c118
andnpd %xmm7, %xmm5
mulsd %xmm4, %xmm1
mulsd %xmm8, %xmm0
addsd %xmm1, %xmm0
mulsd %xmm5, %xmm6
addsd %xmm0, %xmm6
addsd 0x10(%rsp), %xmm6
movl $0x10, %r13d
xorl %ebp, %ebp
movsd %xmm6, 0x30(%rsp)
movapd %xmm5, 0x20(%rsp)
movsd %xmm4, (%rsp)
movsd %xmm8, 0x50(%rsp)
cmpq %rbp, %r15
je 0xc284
movq 0x10(%rbx), %rcx
movsd -0x8(%rcx,%r13), %xmm0
mulsd %xmm4, %xmm0
movsd -0x10(%rcx,%r13), %xmm1
mulsd %xmm8, %xmm1
addsd %xmm0, %xmm1
movsd (%rcx,%r13), %xmm0
mulsd %xmm5, %xmm0
addsd %xmm1, %xmm0
ucomisd %xmm6, %xmm0
jbe 0xc284
leaq 0x13160(%rip), %rdi     # 0x1f3c2
xorl %eax, %eax
callq 0xa164
movsd 0x50(%rsp), %xmm8
movsd (%rsp), %xmm4
movapd 0x20(%rsp), %xmm5
movsd 0x30(%rsp), %xmm6
movl 0x8(%rbx), %eax
incq %rbp
movl %eax, %ecx
addq $0x18, %r13
cmpq %rcx, %rbp
jb 0xc223
addq $0x18, 0x8(%rsp)
cmpq %rcx, %r12
jb 0xbfc2
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop