// File: 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
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x168(%rbp)
addq $0x28, %rdi
callq 0x4a40
movq %rax, -0x160(%rbp)
movb $0x0, -0x31(%rbp)
leaq -0x32(%rbp), %rdi
movq %rdi, -0x158(%rbp)
callq 0x4a70
movq -0x160(%rbp), %rsi
movq -0x158(%rbp), %rcx
leaq -0x30(%rbp), %rdi
leaq -0x31(%rbp), %rdx
callq 0x4a90
jmp 0x1c1b
leaq -0x32(%rbp), %rdi
callq 0x4b10
movq -0x168(%rbp), %rdi
addq $0x40, %rdi
callq 0x4b30
movq %rax, -0x178(%rbp)
movb $0x0, -0x71(%rbp)
leaq -0x72(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0x4a70
movq -0x178(%rbp), %rsi
movq -0x170(%rbp), %rcx
leaq -0x70(%rbp), %rdi
leaq -0x71(%rbp), %rdx
callq 0x4a90
jmp 0x1c6c
leaq -0x72(%rbp), %rdi
callq 0x4b10
movl $0x0, -0x78(%rbp)
movq -0x168(%rbp), %rdi
movl -0x78(%rbp), %eax
movq %rax, -0x180(%rbp)
addq $0x28, %rdi
callq 0x4a40
movq %rax, %rcx
movq -0x180(%rbp), %rax
cmpq %rcx, %rax
jae 0x1e22
movl $0x0, -0x7c(%rbp)
cmpl $0x3, -0x7c(%rbp)
jae 0x1e12
movq -0x168(%rbp), %rdi
addq $0x28, %rdi
movl -0x78(%rbp), %eax
movl %eax, %esi
callq 0x4b60
movq -0x168(%rbp), %rdi
movl -0x7c(%rbp), %ecx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x88(%rbp)
addq $0x40, %rdi
movq -0x88(%rbp), %rax
movl (%rax), %eax
movl %eax, %esi
callq 0x4990
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
cmpl $0x3, (%rax)
jb 0x1d1f
movq -0x90(%rbp), %rax
cmpl $0x3, 0x4(%rax)
jae 0x1e02
movq -0x88(%rbp), %rax
movl (%rax), %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
callq 0x4b80
movq %rdx, -0x190(%rbp)
movq %rax, -0x188(%rbp)
jmp 0x1d43
movq -0x190(%rbp), %rax
movq -0x188(%rbp), %rcx
movq %rcx, -0xa0(%rbp)
movq %rax, -0x98(%rbp)
leaq -0xa0(%rbp), %rdi
movl $0x1, %esi
callq 0x4be0
movl -0x78(%rbp), %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0x4b80
movq %rdx, -0x1a0(%rbp)
movq %rax, -0x198(%rbp)
jmp 0x1d8e
movq -0x1a0(%rbp), %rax
movq -0x198(%rbp), %rcx
movq %rcx, -0xb0(%rbp)
movq %rax, -0xa8(%rbp)
leaq -0xb0(%rbp), %rdi
movl $0x1, %esi
callq 0x4be0
jmp 0x1e02
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x32(%rbp), %rdi
callq 0x4b10
jmp 0x2125
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x72(%rbp), %rdi
callq 0x4b10
jmp 0x211c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x2113
jmp 0x1e04
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x1cb0
jmp 0x1e14
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x1c7c
movq -0x168(%rbp), %rax
addq $0x40, %rax
movq %rax, -0x1a8(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x4de0
jmp 0x1e46
movq -0x1a8(%rbp), %rsi
leaq -0xc8(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
callq 0x4c30
jmp 0x1e62
leaq -0xf0(%rbp), %rdi
callq 0x4f60
movq -0x168(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x1b0(%rbp)
leaq -0x130(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x4de0
jmp 0x1e92
movq -0x1b0(%rbp), %rsi
leaq -0x108(%rbp), %rdi
leaq -0x130(%rbp), %rdx
callq 0x4f80
jmp 0x1eae
leaq -0x108(%rbp), %rdi
callq 0x5130
leaq -0x130(%rbp), %rdi
callq 0x4f60
movl $0x0, -0x134(%rbp)
movq -0x168(%rbp), %rdi
movl -0x134(%rbp), %eax
movq %rax, -0x1b8(%rbp)
addq $0x28, %rdi
callq 0x4a40
movq %rax, %rcx
movq -0x1b8(%rbp), %rax
cmpq %rcx, %rax
jae 0x201a
movl $0x0, -0x138(%rbp)
cmpl $0x3, -0x138(%rbp)
jae 0x2004
movq -0x168(%rbp), %rdi
addq $0x28, %rdi
movl -0x134(%rbp), %eax
movl %eax, %esi
callq 0x4b60
movl -0x138(%rbp), %ecx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rax
movl (%rax), %eax
movl %eax, %esi
leaq -0xc8(%rbp), %rdi
callq 0x5190
movq -0x168(%rbp), %rdi
movl (%rax), %ecx
movq -0x140(%rbp), %rax
movl %ecx, (%rax)
addq $0x40, %rdi
movq -0x140(%rbp), %rax
movl (%rax), %eax
movl %eax, %esi
callq 0x4990
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rax
movl (%rax), %ecx
subl $0x3, %ecx
movl %ecx, (%rax)
movq -0x148(%rbp), %rax
movl 0x4(%rax), %ecx
subl $0x3, %ecx
movl %ecx, 0x4(%rax)
movl -0x138(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x138(%rbp)
jmp 0x1f0a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x4f60
jmp 0x2113
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x2107
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x4f60
jmp 0x2107
jmp 0x2006
movl -0x134(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x134(%rbp)
jmp 0x1ed0
movl $0x3, -0x14c(%rbp)
movq -0x168(%rbp), %rdi
movl -0x14c(%rbp), %eax
movq %rax, -0x1c0(%rbp)
addq $0x10, %rdi
callq 0x51b0
movq %rax, %rcx
movq -0x1c0(%rbp), %rax
cmpq %rcx, %rax
jae 0x20b4
movq -0x168(%rbp), %rdi
addq $0x10, %rdi
movq %rdi, -0x1d0(%rbp)
movl -0x14c(%rbp), %eax
movl %eax, %esi
callq 0x51d0
movq -0x1d0(%rbp), %rdi
movq %rax, -0x1c8(%rbp)
movl -0x14c(%rbp), %eax
addl $-0x3, %eax
movl %eax, %esi
callq 0x51d0
movq -0x1c8(%rbp), %rsi
movq %rax, %rdi
callq 0x51f0
jmp 0x209e
jmp 0x20a0
movl -0x14c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14c(%rbp)
jmp 0x2024
movq -0x168(%rbp), %rdi
addq $0x10, %rdi
movq %rdi, -0x1d8(%rbp)
callq 0x51b0
movq -0x1d8(%rbp), %rdi
movq %rax, %rsi
addq $-0x3, %rsi
callq 0x5230
jmp 0x20e0
leaq -0xc8(%rbp), %rdi
callq 0x5130
leaq -0x70(%rbp), %rdi
callq 0x4f60
leaq -0x30(%rbp), %rdi
callq 0x4f60
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
leaq -0xc8(%rbp), %rdi
callq 0x5130
leaq -0x70(%rbp), %rdi
callq 0x4f60
leaq -0x30(%rbp), %rdi
callq 0x4f60
movq -0x40(%rbp), %rdi
callq 0x11c0
nop