// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movl %esi, 0xc(%rsp)
movl %edx, %eax
imulq $0x48, %rax, %rcx
addq 0x28(%rdi), %rcx
movq 0x40(%rdi), %rax
pushq $-0x1
popq %rbp
xorl %edx, %edx
cmpq $0x3, %rdx
je 0x2143
movl (%rcx,%rdx,4), %edi
imulq $0x18, %rdi, %r8
cmpl %esi, (%rax,%r8)
cmovel %edi, %ebp
incq %rdx
jmp 0x212a
leaq 0x40(%rsp), %rcx
movq %rcx, -0x30(%rcx)
movq $0x1, -0x28(%rcx)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rcx)
movl $0x3f800000, -0x10(%rcx) # imm = 0x3F800000
movups %xmm0, -0x8(%rcx)
leaq 0x10(%rsp), %r14
movl %ebp, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %r15
movl 0x8(%rax,%r15), %eax
movq 0x28(%rbx), %r12
imulq $0x48, %rax, %r13
movq 0x20(%r12,%r13), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x4c00
leaq (%r12,%r13), %rdi
addq $0x10, %rdi
callq 0x3034
movq 0x40(%rbx), %rax
movl 0x14(%rax,%r15), %ecx
imulq $0x18, %rcx, %rcx
movl 0xc(%rax,%rcx), %ecx
cmpl %ebp, %ecx
jne 0x216d
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x4ee6
movq 0x20(%rsp), %r12
testq %r12, %r12
je 0x2249
leaq 0x8(%r12), %r14
movq 0x40(%rbx), %rax
movl %ebp, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %r13
movl 0x8(%rax,%r13), %r15d
movl (%r14), %eax
movq 0x10(%rbx), %rcx
shlq $0x5, %rax
leaq (%rcx,%rax), %rdx
addq $0x8, %rdx
movq %rbx, %rdi
movl %r15d, %esi
callq 0x1900
testb %al, %al
jne 0x2219
movq 0x40(%rbx), %rax
movl 0x14(%rax,%r13), %ecx
imulq $0x18, %rcx, %rcx
movl 0xc(%rax,%rcx), %ecx
cmpl %ebp, %ecx
jne 0x21d5
jmp 0x2240
movl (%r14), %eax
movq 0x10(%rbx), %rcx
shlq $0x5, %rax
movl %r15d, (%rcx,%rax)
movq 0x28(%rbx), %rax
imulq $0x48, %r15, %rcx
leaq (%rax,%rcx), %rdi
addq $0x10, %rdi
movq %r14, %rsi
callq 0x4fe8
movq (%r12), %r12
jmp 0x21c5
leaq 0x10(%rsp), %rdi
callq 0x3018
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2268
jmp 0x2268
jmp 0x2268
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3018
movq %rbx, %rdi
callq 0x11a0
nop