// File: /workspace/github_cpp_makefile_star2_O1/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 $0x108, %rsp            # imm = 0x108
movapd %xmm0, 0x30(%rsp)
movq %rdi, %rbx
movl 0x8(%rdi), %esi
cmpl $0x2, %esi
ja 0xc0b4
leaq 0x1329e(%rip), %rdi     # 0x1f34b
xorl %eax, %eax
callq 0xa2a0
movq %rbx, %rdi
callq 0xbd40
movsd 0x13034(%rip), %xmm1    # 0x1f0f8
ucomisd %xmm0, %xmm1
jbe 0xc0d8
leaq 0x13295(%rip), %rdi     # 0x1f366
movb $0x1, %al
callq 0xa2a0
leaq 0xa0(%rsp), %rsi
leaq 0x68(%rsp), %rdx
movq %rbx, %rdi
callq 0xbbf0
cmpl $0x0, 0x8(%rbx)
je 0xc49c
movsd 0xa0(%rsp), %xmm0
movsd 0xa8(%rsp), %xmm1
movsd 0xb0(%rsp), %xmm2
movsd 0x68(%rsp), %xmm3
movsd %xmm3, 0x48(%rsp)
movapd 0x131da(%rip), %xmm3    # 0x1f300
movapd 0x30(%rsp), %xmm4
xorpd %xmm3, %xmm4
movapd %xmm4, 0xe0(%rsp)
movapd %xmm2, 0x70(%rsp)
xorpd %xmm3, %xmm2
movapd %xmm2, 0xd0(%rsp)
movapd %xmm0, 0x90(%rsp)
xorpd %xmm3, %xmm0
movapd %xmm0, 0xc0(%rsp)
movapd %xmm1, 0x80(%rsp)
xorpd %xmm1, %xmm3
movapd %xmm3, 0xf0(%rsp)
leaq 0x13200(%rip), %r14     # 0x1f37f
xorl %ecx, %ecx
xorl %r15d, %r15d
movq 0x10(%rbx), %r12
leaq (%r15,%r15,2), %rax
leaq (%r12,%rax,8), %r13
movq %rcx, 0x58(%rsp)
addq %rcx, %r12
xorl %ebp, %ebp
movsd (%r12,%rbp,8), %xmm0
movapd %xmm0, %xmm1
andpd 0x13164(%rip), %xmm1    # 0x1f310
ucomisd 0x130f4(%rip), %xmm1    # 0x1f2a8
jbe 0xc1c0
movq %r14, %rdi
movb $0x1, %al
callq 0xa2a0
incq %rbp
cmpq $0x3, %rbp
jne 0xc19a
movl 0x8(%rbx), %r12d
movsd 0x8(%r13), %xmm0
mulsd 0x80(%rsp), %xmm0
movsd (%r13), %xmm1
mulsd 0x90(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd 0x10(%r13), %xmm0
mulsd 0x70(%rsp), %xmm0
addsd %xmm1, %xmm0
subsd 0x48(%rsp), %xmm0
movapd 0xe0(%rsp), %xmm1
ucomisd %xmm0, %xmm1
ja 0xc21c
ucomisd 0x30(%rsp), %xmm0
jbe 0xc22a
leaq 0x1317d(%rip), %rdi     # 0x1f3a0
xorl %eax, %eax
callq 0xa2a0
leaq 0x1(%r15), %rcx
movl %ecx, %eax
movq %rcx, 0x50(%rsp)
cmpq %r12, %rcx
movq 0x10(%rbx), %rcx
movl $0x0, %edx
cmovneq %rax, %rdx
leaq (%rdx,%rdx,2), %rax
movsd (%rcx,%rax,8), %xmm2
subsd (%r13), %xmm2
movsd 0x8(%rcx,%rax,8), %xmm0
subsd 0x8(%r13), %xmm0
movsd 0x10(%rcx,%rax,8), %xmm3
subsd 0x10(%r13), %xmm3
movsd %xmm0, 0x10(%rsp)
mulsd %xmm0, %xmm0
movapd %xmm2, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd %xmm3, 0x20(%rsp)
movapd %xmm3, %xmm0
mulsd %xmm3, %xmm0
addsd %xmm1, %xmm0
ucomisd 0x13014(%rip), %xmm0    # 0x1f2b0
leaq 0x1313f(%rip), %rbp     # 0x1f3e2
movsd %xmm2, (%rsp)
jb 0xc2b0
sqrtsd %xmm0, %xmm0
jmp 0xc2ba
callq 0x4260
movsd (%rsp), %xmm2
movapd 0x30(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xc2d9
leaq 0x130f4(%rip), %rdi     # 0x1f3c1
xorl %eax, %eax
callq 0xa2a0
movsd (%rsp), %xmm2
movapd 0x90(%rsp), %xmm0
movsd 0x10(%rsp), %xmm3
mulsd %xmm3, %xmm0
mulsd 0xd0(%rsp), %xmm3
movapd 0x80(%rsp), %xmm6
movsd 0x20(%rsp), %xmm1
mulsd %xmm1, %xmm6
addsd %xmm3, %xmm6
mulsd 0xc0(%rsp), %xmm1
movapd 0x70(%rsp), %xmm7
mulsd %xmm2, %xmm7
addsd %xmm1, %xmm7
mulsd 0xf0(%rsp), %xmm2
addsd %xmm0, %xmm2
movapd %xmm7, %xmm0
mulsd %xmm7, %xmm0
movapd %xmm6, %xmm1
mulsd %xmm6, %xmm1
addsd %xmm0, %xmm1
movapd %xmm2, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
ucomisd 0x12f58(%rip), %xmm0    # 0x1f2b0
jb 0xc363
xorps %xmm3, %xmm3
sqrtsd %xmm0, %xmm3
jmp 0xc38e
movsd %xmm2, (%rsp)
movapd %xmm6, 0x20(%rsp)
movapd %xmm7, 0x10(%rsp)
callq 0x4260
movapd 0x10(%rsp), %xmm7
movapd 0x20(%rsp), %xmm6
movsd (%rsp), %xmm2
movapd %xmm0, %xmm3
movsd 0xfd7a(%rip), %xmm0     # 0x1c110
ucomisd %xmm3, %xmm0
xorpd %xmm4, %xmm4
xorpd %xmm5, %xmm5
ja 0xc3b4
divsd %xmm3, %xmm7
divsd %xmm3, %xmm2
movapd %xmm7, %xmm4
movapd %xmm2, %xmm5
cmpl $0x0, 0x8(%rbx)
je 0xc482
divsd %xmm3, %xmm6
cmpltsd 0xfd45(%rip), %xmm3     # 0x1c110
andnpd %xmm6, %xmm3
movsd 0x8(%r13), %xmm0
movapd %xmm3, %xmm1
mulsd (%r13), %xmm1
mulsd %xmm4, %xmm0
addsd %xmm0, %xmm1
movsd 0x10(%r13), %xmm2
mulsd %xmm5, %xmm2
addsd %xmm1, %xmm2
addsd 0x30(%rsp), %xmm2
movl $0x10, %r13d
xorl %r12d, %r12d
movapd %xmm3, (%rsp)
movsd %xmm4, 0x20(%rsp)
movsd %xmm5, 0x10(%rsp)
movsd %xmm2, 0x60(%rsp)
cmpq %r12, %r15
je 0xc473
movq 0x10(%rbx), %rax
movsd -0x8(%rax,%r13), %xmm0
mulsd %xmm4, %xmm0
movsd -0x10(%rax,%r13), %xmm1
mulsd %xmm3, %xmm1
addsd %xmm0, %xmm1
movsd (%rax,%r13), %xmm0
mulsd %xmm5, %xmm0
addsd %xmm1, %xmm0
ucomisd %xmm2, %xmm0
jbe 0xc473
movq %rbp, %rdi
xorl %eax, %eax
callq 0xa2a0
movsd 0x60(%rsp), %xmm2
movsd 0x10(%rsp), %xmm5
movsd 0x20(%rsp), %xmm4
movapd (%rsp), %xmm3
incq %r12
movl 0x8(%rbx), %eax
addq $0x18, %r13
cmpq %rax, %r12
jb 0xc41b
movl 0x8(%rbx), %eax
movq 0x58(%rsp), %rcx
addq $0x18, %rcx
movq 0x50(%rsp), %r15
cmpq %rax, %r15
jb 0xc184
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq