// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
addq $0x40, %rdi
movl -0x14(%rbp), %eax
movl %eax, %esi
callq 0x4260
movq -0xb8(%rbp), %rdi
movq %rax, -0x20(%rbp)
addq $0x40, %rdi
movq -0x20(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, %esi
callq 0x4260
movq -0xb8(%rbp), %rdi
movq %rax, -0x28(%rbp)
movq %rdi, %rax
addq $0x40, %rax
movq %rax, -0xb0(%rbp)
addq $0x40, %rdi
movq -0x20(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, %esi
callq 0x4260
movq -0xb0(%rbp), %rdi
movl 0xc(%rax), %eax
movl %eax, %esi
callq 0x4260
movq %rax, -0x30(%rbp)
leaq -0x90(%rbp), %rax
movq %rax, %rcx
addq $0x60, %rcx
movq %rcx, -0xa8(%rbp)
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x43a0
movq -0xc0(%rbp), %rax
movq -0xa8(%rbp), %rcx
addq $0x18, %rax
cmpq %rcx, %rax
movq %rax, -0xa0(%rbp)
jne 0x2a64
movq -0xb8(%rbp), %rdi
addq $0x10, %rdi
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, %esi
callq 0x4240
movq %rax, %rsi
addq $0x8, %rsi
leaq -0x90(%rbp), %rdi
callq 0x4790
movq -0xb8(%rbp), %rdi
addq $0x10, %rdi
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, %esi
callq 0x4240
movq %rax, %rsi
addq $0x8, %rsi
leaq -0x90(%rbp), %rdi
addq $0x18, %rdi
callq 0x4790
movq -0xb8(%rbp), %rdi
addq $0x10, %rdi
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, %esi
callq 0x4240
movq %rax, %rsi
addq $0x8, %rsi
leaq -0x90(%rbp), %rdi
addq $0x30, %rdi
callq 0x4790
movq -0xb8(%rbp), %rdi
addq $0x10, %rdi
movq -0x30(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, %esi
callq 0x4240
movq %rax, %rsi
addq $0x8, %rsi
leaq -0x90(%rbp), %rdi
addq $0x48, %rdi
callq 0x4790
leaq -0x90(%rbp), %rdi
addq $0x18, %rdi
leaq -0x90(%rbp), %rsi
addq $0x30, %rsi
leaq -0x90(%rbp), %rdx
addq $0x48, %rdx
callq 0x52e0
movl %eax, -0x94(%rbp)
leaq -0x90(%rbp), %rdi
addq $0x30, %rdi
leaq -0x90(%rbp), %rsi
leaq -0x90(%rbp), %rdx
addq $0x48, %rdx
callq 0x52e0
movl %eax, -0x98(%rbp)
cmpl $0x0, -0x94(%rbp)
jle 0x2bb6
cmpl $0x0, -0x98(%rbp)
jg 0x2bbf
movb $0x1, -0x1(%rbp)
jmp 0x2cea
movsd -0x80(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2bfa
jp 0x2bfa
movsd -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2be1
jp 0x2be1
jmp 0x2bf1
movsd -0x38(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2bfa
jp 0x2bfa
movb $0x0, -0x1(%rbp)
jmp 0x2cea
movsd -0x68(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2c35
jp 0x2c35
movsd -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2c1c
jp 0x2c1c
jmp 0x2c2c
movsd -0x38(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2c35
jp 0x2c35
movb $0x0, -0x1(%rbp)
jmp 0x2cea
movsd -0x80(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2c59
jp 0x2c59
cmpl $0x0, -0x94(%rbp)
setle %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x2cea
movsd -0x68(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2c7a
jp 0x2c7a
cmpl $0x0, -0x98(%rbp)
setle %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x2cea
leaq -0x90(%rbp), %rdi
leaq -0x90(%rbp), %rsi
addq $0x18, %rsi
leaq -0x90(%rbp), %rdx
addq $0x30, %rdx
leaq -0x90(%rbp), %rcx
addq $0x48, %rcx
callq 0x5600
cmpl $0x0, %eax
jl 0x2cb2
movb $0x0, -0x1(%rbp)
jmp 0x2cea
leaq -0x90(%rbp), %rdi
leaq -0x90(%rbp), %rsi
addq $0x48, %rsi
leaq -0x90(%rbp), %rdx
addq $0x18, %rdx
leaq -0x90(%rbp), %rcx
addq $0x30, %rcx
callq 0x5600
cmpl $0x0, %eax
setl %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax,%rax)