// File: /workspace/github_cpp_makefile_star2_O3/sunweilun[P]Delaunay/Mesh.cpp
// Function: Mesh::isDelaunay(unsigned int) const
bool Mesh::isDelaunay(unsigned eIndex) const
{
    const HalfEdge &e = halfEdges[eIndex];
    const HalfEdge &next = halfEdges[e.nextIndex];
    const HalfEdge &neighbor_next = halfEdges[halfEdges[e.neighborIndex].nextIndex];
    vec3 v[4];
    v[0] = vertices[e.vIndices[0]].pos;
    v[1] = vertices[e.vIndices[1]].pos;
    v[2] = vertices[next.vIndices[1]].pos;
    v[3] = vertices[neighbor_next.vIndices[1]].pos;
    int ori123 = orient(v[1], v[2], v[3]);
    int ori203 = orient(v[2], v[0], v[3]);
    if(ori123<=0 || ori203<=0)
        return true;

    if(v[0].z == 0 && (v[2].z==0 || v[3].z == 0))
        return false;

    if(v[1].z == 0 && (v[2].z==0 || v[3].z == 0))
        return false;

    if(v[0].z == 0)
    {
        return ori123<=0;
    }
    if(v[1].z == 0)
    {
        return ori203<=0;
    }
    if(inCircle(v[0], v[1], v[2], v[3])>=0)
        return false;
    return inCircle(v[0], v[3], v[1], v[2])<0;
}

// Assembly:
movl %esi, %eax
movq 0x10(%rdi), %rcx
movq 0x40(%rdi), %rsi
leaq (%rax,%rax,2), %rdx
movl 0xc(%rsi,%rdx,8), %r8d
movl 0x14(%rsi,%rdx,8), %eax
leaq (%rax,%rax,2), %rax
movl 0xc(%rsi,%rax,8), %r9d
movl (%rsi,%rdx,8), %eax
movl 0x4(%rsi,%rdx,8), %edi
shlq $0x5, %rax
movsd 0x8(%rcx,%rax), %xmm4
movsd 0x10(%rcx,%rax), %xmm13
shlq $0x5, %rdi
movsd 0x8(%rcx,%rdi), %xmm6
movsd 0x10(%rcx,%rdi), %xmm5
leaq (%r8,%r8,2), %rdx
movl 0x4(%rsi,%rdx,8), %edx
shlq $0x5, %rdx
leaq (%r9,%r9,2), %r8
movl 0x4(%rsi,%r8,8), %esi
shlq $0x5, %rsi
movupd 0x8(%rcx,%rdx), %xmm10
movupd 0x8(%rcx,%rsi), %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
movapd %xmm5, %xmm12
subsd %xmm1, %xmm12
movapd %xmm10, %xmm11
subpd %xmm0, %xmm11
movapd %xmm4, %xmm15
subsd %xmm0, %xmm15
movapd %xmm6, %xmm14
unpcklpd %xmm13, %xmm14          # xmm14 = xmm14[0],xmm13[0]
subpd %xmm0, %xmm14
movapd %xmm14, %xmm7
shufpd $0x1, %xmm14, %xmm7     # xmm7 = xmm7[1],xmm14[0]
movapd %xmm15, %xmm8
unpcklpd %xmm11, %xmm8           # xmm8 = xmm8[0],xmm11[0]
movapd %xmm11, %xmm9
shufpd $0x1, %xmm12, %xmm9     # xmm9 = xmm9[1],xmm12[0]
mulpd %xmm8, %xmm9
mulpd %xmm11, %xmm7
subpd %xmm9, %xmm7
xorpd %xmm8, %xmm8
cmpnltpd %xmm7, %xmm8
movmskpd %xmm8, %r8d
testl %r8d, %r8d
je 0x21bc
movb $0x1, %al
retq
addq %rcx, %rax
addq $0x8, %rax
movsd 0x10(%rax), %xmm8
xorl %eax, %eax
xorpd %xmm7, %xmm7
ucomisd %xmm7, %xmm8
jne 0x21d8
jnp 0x21bb
addq %rcx, %rdi
addq $0x8, %rdi
movsd 0x10(%rdi), %xmm8
ucomisd %xmm7, %xmm8
jne 0x21ee
jnp 0x21bb
movapd %xmm4, %xmm2
subsd %xmm10, %xmm2
movsd %xmm4, -0x50(%rsp)
movapd %xmm10, %xmm3
unpckhpd %xmm10, %xmm3           # xmm3 = xmm3[1],xmm10[1]
movapd %xmm13, %xmm4
subsd %xmm3, %xmm4
movapd %xmm6, %xmm8
subsd %xmm10, %xmm8
movapd %xmm5, %xmm9
subsd %xmm3, %xmm5
movapd %xmm4, %xmm7
movapd %xmm8, -0x18(%rsp)
mulsd %xmm8, %xmm7
movsd %xmm2, -0x58(%rsp)
mulsd %xmm5, %xmm2
subsd %xmm7, %xmm2
xorpd %xmm7, %xmm7
ucomisd %xmm7, %xmm2
jne 0x2251
jnp 0x239b
movsd %xmm9, -0x60(%rsp)
movapd %xmm3, -0x38(%rsp)
movapd %xmm4, -0x28(%rsp)
movsd %xmm5, -0x68(%rsp)
movsd 0x18(%rcx,%rdx), %xmm9
movsd 0x18(%rcx,%rsi), %xmm8
ucomisd %xmm7, %xmm8
jne 0x2285
jnp 0x235d
movapd %xmm14, %xmm3
unpckhpd %xmm14, %xmm3           # xmm3 = xmm3[1],xmm14[1]
movapd %xmm3, -0x48(%rsp)
movapd %xmm14, %xmm7
mulpd %xmm14, %xmm7
unpckhpd %xmm7, %xmm7            # xmm7 = xmm7[1,1]
movapd %xmm15, %xmm3
mulsd %xmm15, %xmm3
addsd %xmm7, %xmm3
movapd %xmm12, %xmm7
mulsd %xmm12, %xmm7
movsd %xmm8, -0x70(%rsp)
movapd %xmm14, %xmm8
mulsd %xmm14, %xmm8
addsd %xmm7, %xmm8
movapd %xmm11, %xmm7
unpckhpd %xmm11, %xmm7           # xmm7 = xmm7[1],xmm11[1]
movapd %xmm7, %xmm5
mulsd %xmm7, %xmm5
movapd %xmm9, %xmm4
movapd %xmm11, %xmm9
mulsd %xmm11, %xmm9
addsd %xmm5, %xmm9
movapd %xmm7, %xmm2
mulsd %xmm8, %xmm2
movapd %xmm12, %xmm5
mulsd %xmm9, %xmm5
subsd %xmm2, %xmm5
mulsd %xmm11, %xmm8
mulsd %xmm14, %xmm9
subsd %xmm8, %xmm9
mulsd -0x48(%rsp), %xmm9
mulsd %xmm15, %xmm5
subsd %xmm9, %xmm5
movapd %xmm4, %xmm9
mulsd %xmm12, %xmm11
mulsd %xmm14, %xmm7
subsd %xmm11, %xmm7
mulsd %xmm3, %xmm7
addsd %xmm5, %xmm7
xorpd %xmm8, %xmm8
ucomisd %xmm8, %xmm7
movsd -0x70(%rsp), %xmm8
jae 0x239b
movsd -0x50(%rsp), %xmm3
subsd %xmm6, %xmm3
movsd -0x60(%rsp), %xmm2
subsd %xmm2, %xmm13
movapd %xmm0, %xmm7
subsd %xmm6, %xmm7
mulsd %xmm13, %xmm7
movapd %xmm1, %xmm4
subsd %xmm2, %xmm4
mulsd %xmm3, %xmm4
subsd %xmm7, %xmm4
xorpd %xmm5, %xmm5
ucomisd %xmm5, %xmm4
jne 0x239e
jp 0x239e
xorl %eax, %eax
retq
ucomisd %xmm5, %xmm9
jne 0x23ab
jnp 0x21b9
xorpd %xmm12, %xmm12
ucomisd %xmm12, %xmm8
movb $0x1, %al
jne 0x23bf
jnp 0x21bb
subsd %xmm10, %xmm0
subsd -0x38(%rsp), %xmm1
movapd -0x28(%rsp), %xmm11
movapd %xmm11, %xmm4
mulsd %xmm11, %xmm4
movsd -0x58(%rsp), %xmm3
movapd %xmm3, %xmm2
mulsd %xmm3, %xmm2
addsd %xmm4, %xmm2
movapd %xmm1, %xmm4
mulsd %xmm1, %xmm4
movapd %xmm0, %xmm5
mulsd %xmm0, %xmm5
addsd %xmm4, %xmm5
movsd -0x68(%rsp), %xmm8
movapd %xmm8, %xmm4
mulsd %xmm8, %xmm4
movapd -0x18(%rsp), %xmm10
movapd %xmm10, %xmm6
mulsd %xmm10, %xmm6
addsd %xmm4, %xmm6
movapd %xmm8, %xmm4
mulsd %xmm5, %xmm4
movapd %xmm1, %xmm7
mulsd %xmm6, %xmm7
subsd %xmm4, %xmm7
mulsd %xmm10, %xmm5
mulsd %xmm0, %xmm6
subsd %xmm5, %xmm6
mulsd %xmm11, %xmm6
mulsd %xmm3, %xmm7
subsd %xmm6, %xmm7
mulsd %xmm10, %xmm1
mulsd %xmm8, %xmm0
subsd %xmm1, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm7, %xmm0
ucomisd %xmm12, %xmm0
setb %al
retq
nop