// File: /workspace/github_cpp_makefile_star2_O1/sunweilun[P]Delaunay/Mesh.cpp
// Function: Mesh::inTriangle(unsigned int, glm::detail::tvec3<double, (glm::precision)0> const&) const
bool Mesh::inTriangle(unsigned triIndex, const vec3& pos) const
{
    bool projCond = false;
    for(int i=0; i<3; i++)
    {
        vec3 v[2];
        const HalfEdge& e = halfEdges[triangles[triIndex].eIndices[i]];
        v[0] = vertices[e.vIndices[0]].pos;
        v[1] = vertices[e.vIndices[1]].pos;
        if(orient(v[0], v[1], pos)<0)
            return false;
        real projDist = glm::dot(pos-v[0], glm::normalize(v[1]-v[0]));
        if(projDist >= 0 && projDist < glm::length(v[1] - v[0]))
            projCond = true;
    }
    return projCond;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %rbx
movq %rdi, %r14
movl %esi, %eax
shlq $0x3, %rax
leaq (%rax,%rax,8), %r12
xorl %r13d, %r13d
xorpd %xmm3, %xmm3
xorl %r15d, %r15d
xorl %ebp, %ebp
movq 0x28(%r14), %rax
addq %r12, %rax
movl (%rax,%r13,4), %ecx
movq 0x10(%r14), %rax
movq 0x40(%r14), %rdx
leaq (%rcx,%rcx,2), %rsi
movl (%rdx,%rsi,8), %ecx
movl 0x4(%rdx,%rsi,8), %edx
shlq $0x5, %rcx
movsd 0x8(%rax,%rcx), %xmm10
movsd 0x10(%rax,%rcx), %xmm8
shlq $0x5, %rdx
movsd 0x8(%rax,%rdx), %xmm6
movsd 0x10(%rax,%rdx), %xmm5
movsd (%rbx), %xmm9
movsd 0x8(%rbx), %xmm7
movapd %xmm10, %xmm0
subsd %xmm9, %xmm0
movapd %xmm8, %xmm1
subsd %xmm7, %xmm1
movapd %xmm6, %xmm2
subsd %xmm9, %xmm2
mulsd %xmm1, %xmm2
movapd %xmm5, %xmm4
subsd %xmm7, %xmm4
mulsd %xmm0, %xmm4
subsd %xmm2, %xmm4
ucomisd %xmm3, %xmm4
jb 0x1ee0
addq %rax, %rcx
addq $0x8, %rcx
leaq 0x8(%rax,%rdx), %rax
movsd 0x10(%rax), %xmm2
movsd 0x10(%rcx), %xmm13
movsd 0x10(%rbx), %xmm11
subsd %xmm10, %xmm6
subsd %xmm8, %xmm5
subsd %xmm13, %xmm2
movapd %xmm5, %xmm0
mulsd %xmm5, %xmm0
movapd %xmm6, %xmm1
mulsd %xmm6, %xmm1
addsd %xmm0, %xmm1
movapd %xmm2, %xmm12
mulsd %xmm2, %xmm12
addsd %xmm1, %xmm12
ucomisd %xmm3, %xmm12
jb 0x1dc3
xorps %xmm0, %xmm0
sqrtsd %xmm12, %xmm0
jmp 0x1e5f
movapd %xmm12, %xmm0
movsd %xmm4, 0x8(%rsp)
movsd %xmm5, 0x50(%rsp)
movsd %xmm2, (%rsp)
movsd %xmm6, 0x48(%rsp)
movsd %xmm7, 0x40(%rsp)
movsd %xmm8, 0x38(%rsp)
movsd %xmm9, 0x30(%rsp)
movsd %xmm10, 0x28(%rsp)
movsd %xmm11, 0x20(%rsp)
movsd %xmm12, 0x18(%rsp)
movsd %xmm13, 0x10(%rsp)
callq 0x10c0
movsd 0x10(%rsp), %xmm13
movsd 0x18(%rsp), %xmm12
movsd 0x20(%rsp), %xmm11
movsd 0x28(%rsp), %xmm10
movsd 0x30(%rsp), %xmm9
movsd 0x38(%rsp), %xmm8
movsd 0x40(%rsp), %xmm7
movsd 0x48(%rsp), %xmm6
movsd (%rsp), %xmm2
movsd 0x50(%rsp), %xmm5
movsd 0x8(%rsp), %xmm4
xorpd %xmm3, %xmm3
movsd 0x41d1(%rip), %xmm1     # 0x6038
divsd %xmm0, %xmm1
subsd %xmm10, %xmm9
subsd %xmm8, %xmm7
subsd %xmm13, %xmm11
mulsd %xmm1, %xmm6
mulsd %xmm9, %xmm6
mulsd %xmm1, %xmm5
mulsd %xmm7, %xmm5
addsd %xmm6, %xmm5
mulsd %xmm1, %xmm2
mulsd %xmm11, %xmm2
addsd %xmm5, %xmm2
ucomisd %xmm3, %xmm2
jb 0x1ee0
ucomisd %xmm3, %xmm12
jb 0x1eb3
xorps %xmm0, %xmm0
sqrtsd %xmm12, %xmm0
jmp 0x1ed7
movapd %xmm12, %xmm0
movsd %xmm4, 0x8(%rsp)
movsd %xmm2, (%rsp)
callq 0x10c0
movsd (%rsp), %xmm2
movsd 0x8(%rsp), %xmm4
xorpd %xmm3, %xmm3
ucomisd %xmm2, %xmm0
jbe 0x1ee0
movb $0x1, %bpl
ucomisd %xmm3, %xmm4
jb 0x1eff
cmpq $0x2, %r13
leaq 0x1(%r13), %rax
setae %r15b
movq %rax, %r13
cmpq $0x3, %rax
jne 0x1cdc
andb %bpl, %r15b
andb $0x1, %r15b
movl %r15d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq