// File: /workspace/github_cpp_makefile_star2_O1/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 $0x58, %rsp
movq %rdi, %rbx
movl %esi, 0x14(%rsp)
movl %edx, %eax
leaq (%rax,%rax,8), %rax
shlq $0x3, %rax
addq 0x28(%rdi), %rax
movq 0x40(%rdi), %rcx
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
xorl %edx, %edx
movl (%rax,%rdx,4), %edi
leaq (%rdi,%rdi,2), %r8
cmpl %esi, (%rcx,%r8,8)
cmovel %edi, %r13d
incq %rdx
cmpq $0x3, %rdx
jne 0x2a0f
leaq 0x50(%rsp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
leaq 0x20(%rsp), %r14
leaq 0x8(%rsp), %r15
movl %r13d, %r12d
movl %r12d, %eax
movq 0x28(%rbx), %rdx
movq 0x40(%rbx), %rcx
leaq (%rax,%rax,2), %rax
movq %rax, (%rsp)
movl 0x8(%rcx,%rax,8), %eax
leaq (%rax,%rax,8), %r12
movq %rdx, 0x18(%rsp)
movq 0x20(%rdx,%r12,8), %rbp
movq %r14, 0x8(%rsp)
testq %rbp, %rbp
je 0x2a9b
leaq 0x8(%rbp), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x5296
movq (%rbp), %rbp
jmp 0x2a81
movq 0x18(%rsp), %rax
leaq (%rax,%r12,8), %rdi
addq $0x10, %rdi
callq 0x39e4
movq 0x40(%rbx), %rax
movq (%rsp), %rcx
movl 0x14(%rax,%rcx,8), %ecx
leaq (%rcx,%rcx,2), %rcx
movl 0xc(%rax,%rcx,8), %r12d
cmpl %r13d, %r12d
jne 0x2a57
leaq 0x20(%rsp), %rdi
leaq 0x14(%rsp), %rsi
callq 0x5556
movq 0x30(%rsp), %rax
testq %rax, %rax
je 0x2b87
movq %rax, (%rsp)
leaq 0x8(%rax), %r15
movl %r12d, %eax
movq 0x10(%rbx), %rcx
movq 0x40(%rbx), %rdx
leaq (%rax,%rax,2), %r14
movl 0x8(%rdx,%r14,8), %r12d
movl (%r15), %eax
shlq $0x5, %rax
leaq (%rcx,%rax), %rdx
addq $0x8, %rdx
movq %rbx, %rdi
movl %r12d, %esi
callq 0x1cb2
movl %eax, %ebp
testb %al, %al
je 0x2b56
movl (%r15), %eax
movq 0x10(%rbx), %rcx
shlq $0x5, %rax
movl %r12d, (%rcx,%rax)
movq 0x28(%rbx), %rax
leaq (%r12,%r12,8), %rcx
leaq (%rax,%rcx,8), %rdi
addq $0x10, %rdi
movq %rdi, 0x8(%rsp)
movq %r15, %rsi
leaq 0x8(%rsp), %rdx
callq 0x5296
movl %r13d, %r12d
jmp 0x2b68
movq 0x40(%rbx), %rax
movl 0x14(%rax,%r14,8), %ecx
leaq (%rcx,%rcx,2), %rcx
movl 0xc(%rax,%rcx,8), %r12d
cmpl %r13d, %r12d
sete %al
orb %al, %bpl
cmpb $0x1, %bpl
jne 0x2aec
movq (%rsp), %rax
movq (%rax), %rax
jmp 0x2adb
leaq 0x20(%rsp), %rdi
callq 0x39be
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2ba4
jmp 0x2ba4
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x39be
movq %rbx, %rdi
callq 0x11b0
nop