// File: /workspace/github_cpp_makefile_star2_O3/icemiliang[P]vot/src/vot/cell.cc
// Function: bool voro::voronoicell_base::collapse_order2<voro::voronoicell>(voro::voronoicell&)
inline bool voronoicell_base::collapse_order2(vc_class &vc) {
    if(!collapse_order1(vc)) return false;
    int a,b,i,j,k,l;
    while(mec[2]>0) {

        // Pick a order 2 vertex and read in its edges
        i=--mec[2];
        j=mep[2][5*i];k=mep[2][5*i+1];
        if(j==k) {
#if VOROPP_VERBOSE >=1
            fputs("Order two vertex joins itself",stderr);
#endif
            return false;
        }

        // Scan the edges of j to see if joins k
        for(l=0;l<nu[j];l++) {
            if(ed[j][l]==k) break;
        }

        // If j doesn't already join k, join them together.
        // Otherwise delete the connection to the current
        // vertex from j and k.
        a=mep[2][5*i+2];b=mep[2][5*i+3];i=mep[2][5*i+4];
        if(l==nu[j]) {
            ed[j][a]=k;
            ed[k][b]=j;
            ed[j][nu[j]+a]=b;
            ed[k][nu[k]+b]=a;
        } else {
            if(!delete_connection(vc,j,a,false)) return false;
            if(!delete_connection(vc,k,b,true)) return false;
        }

        // Compact the memory
        --p;
        if(up==i) up=0;
        if(p!=i) {
            if(up==p) up=i;
            pts[3*i]=pts[3*p];
            pts[3*i+1]=pts[3*p+1];
            pts[3*i+2]=pts[3*p+2];
            for(k=0;k<nu[p];k++) ed[ed[p][k]][ed[p][nu[p]+k]]=i;
            vc.n_copy_pointer(i,p);
            ed[i]=ed[p];
            nu[i]=nu[p];
            ed[i][nu[i]<<1]=i;
        }

        // Collapse any order 1 vertices if they were created
        if(!collapse_order1(vc)) return false;
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x26dc6
testb %al, %al
je 0x22669
movq 0x40(%r14), %rcx
movl 0x8(%rcx), %eax
testl %eax, %eax
setle %bpl
jle 0x2267c
decl %eax
movl %eax, 0x8(%rcx)
movq 0x48(%r14), %rcx
movq 0x10(%rcx), %rdi
leal (%rax,%rax,4), %r8d
movl (%rdi,%r8,4), %edx
movl 0x4(%rdi,%r8,4), %r15d
xorl %r9d, %r9d
cmpl %r15d, %edx
je 0x22669
movslq %edx, %rsi
movq 0x28(%r14), %rax
movslq (%rax,%rsi,4), %r10
testq %r10, %r10
jle 0x22511
movq 0x20(%r14), %rcx
movq (%rcx,%rsi,8), %rcx
xorl %r9d, %r9d
cmpl %r15d, (%rcx,%r9,4)
je 0x22511
incq %r9
cmpq %r9, %r10
jne 0x224f2
movl 0x8(%rdi,%r8,4), %ecx
movl 0xc(%rdi,%r8,4), %r12d
movl 0x10(%rdi,%r8,4), %r13d
jmp 0x22525
movl 0x8(%rdi,%r8,4), %ecx
movl 0xc(%rdi,%r8,4), %r12d
movl 0x10(%rdi,%r8,4), %r13d
cmpl %r10d, %r9d
jne 0x2255a
movslq %r15d, %rdi
movq 0x20(%r14), %r8
movq (%r8,%rsi,8), %r9
movslq %ecx, %rcx
movl %r15d, (%r9,%rcx,4)
movq (%r8,%rdi,8), %r8
movslq %r12d, %r10
movl %edx, (%r8,%r10,4)
movslq (%rax,%rsi,4), %rdx
addq %rcx, %rdx
movl %r10d, (%r9,%rdx,4)
movslq (%rax,%rdi,4), %rax
addq %r10, %rax
movl %ecx, (%r8,%rax,4)
jmp 0x2258f
movq %r14, %rdi
movq %rbx, %rsi
xorl %r8d, %r8d
callq 0x26f12
testb %al, %al
je 0x2266b
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %edx
movl %r12d, %ecx
movl $0x1, %r8d
callq 0x26f12
testb %al, %al
je 0x2266b
movslq 0x18(%r14), %rcx
decq %rcx
movl %ecx, 0x18(%r14)
movl 0x1c(%r14), %eax
cmpl %r13d, %eax
jne 0x225ad
movl $0x0, 0x1c(%r14)
xorl %eax, %eax
cmpl %r13d, %ecx
je 0x22654
cmpl %ecx, %eax
jne 0x225be
movl %r13d, 0x1c(%r14)
movq 0x30(%r14), %rax
leaq (%rcx,%rcx,2), %rdx
movsd (%rax,%rdx,8), %xmm0
leal (%r13,%r13,2), %esi
movslq %esi, %rsi
movsd %xmm0, (%rax,%rsi,8)
movsd 0x8(%rax,%rdx,8), %xmm0
movsd %xmm0, 0x8(%rax,%rsi,8)
movsd 0x10(%rax,%rdx,8), %xmm0
movsd %xmm0, 0x10(%rax,%rsi,8)
movq 0x20(%r14), %rax
movq 0x28(%r14), %rdx
movslq %ecx, %rcx
movl (%rdx,%rcx,4), %edi
testl %edi, %edi
jle 0x2262e
xorl %esi, %esi
movq (%rax,%rcx,8), %rcx
movslq (%rcx,%rsi,4), %r8
movq (%rax,%r8,8), %r8
movslq %edi, %rdi
addq %rsi, %rdi
movslq (%rcx,%rdi,4), %rcx
movl %r13d, (%r8,%rcx,4)
incq %rsi
movslq 0x18(%r14), %rcx
movslq (%rdx,%rcx,4), %rdi
cmpq %rdi, %rsi
jl 0x22604
movq (%rax,%rcx,8), %rdx
movslq %r13d, %rsi
movq %rdx, (%rax,%rsi,8)
movq 0x28(%r14), %rax
movl (%rax,%rcx,4), %ecx
movl %ecx, (%rax,%rsi,4)
movq 0x20(%r14), %rax
movq (%rax,%rsi,8), %rax
addl %ecx, %ecx
movslq %ecx, %rcx
movl %r13d, (%rax,%rcx,4)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x26dc6
testb %al, %al
jne 0x2249e
jmp 0x2266b
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %bpl
jmp 0x2266b
nop