// File: /workspace/github_cpp_makefile_star2_O2/sunweilun[P]Delaunay/Mesh.cpp
// Function: Mesh::destroyGhostTriangle()
void Mesh::destroyGhostTriangle()
{
    std::vector<bool> ghostTriMap(triangles.size(), false);
    std::vector<bool> ghostEdgeMap(halfEdges.size(), false);
    for(unsigned i=0; i<triangles.size(); i++)
    {
        for(unsigned k=0; k<3; k++)
        {
            unsigned &eIndex = triangles[i].eIndices[k];
            HalfEdge &e = halfEdges[eIndex];
            if(e.vIndices[0] < 3 || e.vIndices[1] < 3)
            {
                ghostEdgeMap[eIndex] = true;
                ghostTriMap[i] = true;
            }
        }
    }
    std::vector<unsigned> indicesMap = lazyDeletion(halfEdges, ghostEdgeMap);
    lazyDeletion(triangles, ghostTriMap);
    for(unsigned i=0; i<triangles.size(); i++)
    {
        for(unsigned k=0; k<3; k++)
        {
            unsigned &eIndex = triangles[i].eIndices[k];
            eIndex = indicesMap[eIndex];
            HalfEdge &e = halfEdges[eIndex];
            e.vIndices[0] -= 3;
            e.vIndices[1] -= 3;
        }
    }

    for(unsigned i=3; i<vertices.size(); i++)
        vertices[i-3] = vertices[i];
    vertices.resize(vertices.size()-3);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rdi, %rbx
movq 0x30(%rdi), %rax
subq 0x28(%rdi), %rax
pushq $0x48
popq %rcx
cqto
idivq %rcx
xorl %r15d, %r15d
leaq 0x30(%rsp), %rdx
movb %r15b, (%rdx)
leaq 0x58(%rsp), %rdi
leaq 0x18(%rsp), %r14
movq %rax, %rsi
movq %r14, %rcx
callq 0x2b16
movq 0x48(%rbx), %rax
subq 0x40(%rbx), %rax
pushq $0x18
popq %rcx
cqto
idivq %rcx
movb %r15b, (%r14)
leaq 0x30(%rsp), %rdi
leaq 0x18(%rsp), %rdx
leaq 0xf(%rsp), %rcx
movq %rax, %rsi
callq 0x2b16
leaq 0x28(%rbx), %r14
leaq 0x40(%rbx), %r12
leaq 0x58(%rsp), %rbp
movq %rbx, 0x10(%rsp)
movl %r15d, %r15d
movq 0x30(%rbx), %rax
subq 0x28(%rbx), %rax
cqto
pushq $0x48
popq %rcx
idivq %rcx
cmpq %r15, %rax
jbe 0x1744
imulq $0x48, %r15, %rbx
xorl %r13d, %r13d
cmpq $0x3, %r13
je 0x173a
movq (%r14), %rax
addq %rbx, %rax
movl (%rax,%r13,4), %esi
movq (%r12), %rax
imulq $0x18, %rsi, %rcx
cmpl $0x3, (%rax,%rcx)
jb 0x171a
cmpl $0x2, 0x4(%rax,%rcx)
ja 0x1735
leaq 0x30(%rsp), %rdi
callq 0x2b7a
orq %rdx, (%rax)
movq %rbp, %rdi
movq %r15, %rsi
callq 0x2b7a
orq %rdx, (%rax)
incq %r13
jmp 0x16f5
incl %r15d
movq 0x10(%rsp), %rbx
jmp 0x16d6
leaq 0xa8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x2c50
leaq 0x18(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
movq %r12, %rsi
callq 0x2b97
leaq 0xa8(%rsp), %rdi
callq 0x2ccc
leaq 0x80(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x2c50
leaq 0xd0(%rsp), %rdi
leaq 0x80(%rsp), %rdx
movq %r14, %rsi
callq 0x2cdc
leaq 0xd0(%rsp), %rdi
callq 0x3e30
leaq 0x80(%rsp), %rdi
callq 0x2ccc
movq 0x28(%rbx), %rcx
movq 0x30(%rbx), %rax
subq %rcx, %rax
cqto
pushq $0x48
popq %rsi
idivq %rsi
movq 0x18(%rsp), %rdx
movq 0x40(%rbx), %rsi
xorl %edi, %edi
movdqa 0x484e(%rip), %xmm0     # 0x6030
movl %edi, %r8d
cmpq %r8, %rax
jbe 0x1823
imulq $0x48, %r8, %r8
addq %rcx, %r8
xorl %r9d, %r9d
cmpq $0x3, %r9
je 0x181f
movl (%r8,%r9,4), %r10d
movl (%rdx,%r10,4), %r10d
movl %r10d, (%r8,%r9,4)
imulq $0x18, %r10, %r10
movq (%rsi,%r10), %xmm1
paddd %xmm0, %xmm1
movq %xmm1, (%rsi,%r10)
incq %r9
jmp 0x17f4
incl %edi
jmp 0x17e2
leaq 0x10(%rbx), %rdi
xorl %eax, %eax
leal 0x3(%rax), %ecx
movq 0x10(%rbx), %rdx
movq 0x18(%rbx), %rsi
subq %rdx, %rsi
sarq $0x5, %rsi
cmpq %rcx, %rsi
jbe 0x186c
shlq $0x5, %rcx
movl %eax, %esi
shlq $0x5, %rsi
movl (%rdx,%rcx), %r8d
movl %r8d, (%rdx,%rsi)
movups 0x8(%rdx,%rcx), %xmm0
movups %xmm0, 0x8(%rdx,%rsi)
movq 0x18(%rdx,%rcx), %xmm0
movq %xmm0, 0x18(%rdx,%rsi)
incl %eax
jmp 0x1829
addq $-0x3, %rsi
callq 0x2d94
leaq 0x18(%rsp), %rdi
callq 0x3e30
leaq 0x30(%rsp), %rdi
callq 0x2ccc
leaq 0x58(%rsp), %rdi
callq 0x2ccc
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x2ccc
jmp 0x18d3
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x2ccc
jmp 0x18e4
jmp 0x18e1
movq %rax, %rbx
jmp 0x18ee
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x3e30
jmp 0x18e4
jmp 0x18e1
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x2ccc
leaq 0x58(%rsp), %rdi
callq 0x2ccc
movq %rbx, %rdi
callq 0x11a0