// File: sunweilun[P]Delaunay/Mesh.cpp
// Function: Mesh::updateConfGraph(unsigned int, unsigned int)
void Mesh::updateConfGraph(unsigned vIndex, unsigned tIndex)
{
    unsigned startEdgeIndex = MAX_UINT;
    for(unsigned i=0; i<3; i++)
    {
        unsigned ei = triangles[tIndex].eIndices[i];
        if(halfEdges[ei].vIndices[0] == vIndex)
            startEdgeIndex = ei;
    }

    unsigned eIndex = startEdgeIndex;

    std::unordered_set<unsigned> confVertIndices;
    do
    {
        Triangle &t = triangles[halfEdges[eIndex].tIndex];
        confVertIndices.insert(t.confVertIndices.begin(), t.confVertIndices.end());

        t.confVertIndices.clear();
        unsigned &neighborIndex = halfEdges[eIndex].neighborIndex;
        eIndex = halfEdges[neighborIndex].nextIndex;
    }
    while(eIndex != startEdgeIndex);

    confVertIndices.erase(vIndex);

    for(auto it = confVertIndices.begin(); it != confVertIndices.end(); it++)
    {
        do
        {
            unsigned triIndex = halfEdges[eIndex].tIndex;
            if(inTriangle(triIndex, vertices[*it].pos))
            {
                vertices[*it].confTriIndex = triIndex;
                triangles[triIndex].confVertIndices.insert(*it);
                eIndex = startEdgeIndex;
                break;
            }
            unsigned &neighborIndex = halfEdges[eIndex].neighborIndex;
            eIndex = halfEdges[neighborIndex].nextIndex;
        }
        while(eIndex != startEdgeIndex);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x18(%rbp)
cmpl $0x3, -0x18(%rbp)
jae 0x3161
movq -0xc8(%rbp), %rdi
addq $0x28, %rdi
movl -0x10(%rbp), %eax
movl %eax, %esi
callq 0x4b60
movq -0xc8(%rbp), %rdi
movl -0x18(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x1c(%rbp)
addq $0x40, %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x4990
movl (%rax), %eax
cmpl -0xc(%rbp), %eax
jne 0x3154
movl -0x1c(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x3156
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x310e
movl -0x14(%rbp), %eax
movl %eax, -0x20(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x5b20
movq -0xc8(%rbp), %rdi
movq %rdi, %rax
addq $0x28, %rax
movq %rax, -0xd0(%rbp)
addq $0x40, %rdi
movl -0x20(%rbp), %eax
movl %eax, %esi
callq 0x4990
movq -0xd0(%rbp), %rdi
movl 0x8(%rax), %eax
movl %eax, %esi
callq 0x4b60
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
addq $0x10, %rdi
callq 0x5b80
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
addq $0x10, %rdi
callq 0x5bb0
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rsi
movq -0x70(%rbp), %rdx
leaq -0x58(%rbp), %rdi
callq 0x5b40
jmp 0x31dd
movq -0x60(%rbp), %rdi
addq $0x10, %rdi
callq 0x5be0
movq -0xc8(%rbp), %rdi
addq $0x40, %rdi
movl -0x20(%rbp), %eax
movl %eax, %esi
callq 0x4990
movq -0xc8(%rbp), %rdi
addq $0x14, %rax
movq %rax, -0x88(%rbp)
addq $0x40, %rdi
movq -0x88(%rbp), %rax
movl (%rax), %eax
movl %eax, %esi
callq 0x4990
movl 0xc(%rax), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x3170
leaq -0x58(%rbp), %rdi
leaq -0xc(%rbp), %rsi
callq 0x5c00
jmp 0x3246
leaq -0x58(%rbp), %rdi
callq 0x5b80
movq %rax, -0x90(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x5bb0
movq %rax, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x5c30
testb $0x1, %al
jne 0x3282
jmp 0x3447
jmp 0x3284
movq -0xc8(%rbp), %rdi
addq $0x40, %rdi
movl -0x20(%rbp), %eax
movl %eax, %esi
callq 0x4990
movq %rax, %rcx
movq -0xc8(%rbp), %rax
movl 0x8(%rcx), %ecx
movl %ecx, -0x9c(%rbp)
movl -0x9c(%rbp), %ecx
movl %ecx, -0xd8(%rbp)
addq $0x10, %rax
movq %rax, -0xe0(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x5c60
movq -0xe0(%rbp), %rdi
movl (%rax), %eax
movl %eax, %esi
callq 0x51d0
movq -0xc8(%rbp), %rdi
movl -0xd8(%rbp), %esi
movq %rax, %rdx
addq $0x8, %rdx
callq 0x2130
movb %al, -0xd1(%rbp)
jmp 0x3300
movb -0xd1(%rbp), %al
testb $0x1, %al
jne 0x330f
jmp 0x33de
movq -0xc8(%rbp), %rax
movl -0x9c(%rbp), %ecx
movl %ecx, -0x104(%rbp)
addq $0x10, %rax
movq %rax, -0x110(%rbp)
leaq -0x90(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x5c60
movq -0x110(%rbp), %rdi
movl (%rax), %eax
movl %eax, %esi
callq 0x51d0
movl -0x104(%rbp), %ecx
movq -0xc8(%rbp), %rdi
movl %ecx, (%rax)
addq $0x28, %rdi
movl -0x9c(%rbp), %eax
movl %eax, %esi
callq 0x4b60
movq -0x100(%rbp), %rdi
addq $0x10, %rax
movq %rax, -0xf8(%rbp)
callq 0x5c60
movq -0xf8(%rbp), %rdi
movq %rax, %rsi
callq 0x5c90
movb %dl, -0xe9(%rbp)
movq %rax, -0xe8(%rbp)
jmp 0x33a5
movb -0xe9(%rbp), %al
movq -0xe8(%rbp), %rcx
movq %rcx, -0xb0(%rbp)
movb %al, -0xa8(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x20(%rbp)
jmp 0x342b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x5d00
jmp 0x3459
movq -0xc8(%rbp), %rdi
addq $0x40, %rdi
movl -0x20(%rbp), %eax
movl %eax, %esi
callq 0x4990
movq -0xc8(%rbp), %rdi
addq $0x14, %rax
movq %rax, -0xb8(%rbp)
addq $0x40, %rdi
movq -0xb8(%rbp), %rax
movl (%rax), %eax
movl %eax, %esi
callq 0x4990
movl 0xc(%rax), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x3284
jmp 0x342d
leaq -0x90(%rbp), %rdi
xorl %esi, %esi
callq 0x5cd0
movq %rax, -0xc0(%rbp)
jmp 0x3256
leaq -0x58(%rbp), %rdi
callq 0x5d00
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x11c0
nopw %cs:(%rax,%rax)