// File: 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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x38(%rbp)
movq -0x18(%rbp), %rsi
callq 0x544e0
testb $0x1, %al
jne 0x4c06e
movb $0x0, -0x1(%rbp)
jmp 0x4c3e3
jmp 0x4c070
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rax
cmpl $0x0, 0x8(%rax)
jle 0x4c3df
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rdx
movl 0x8(%rdx), %ecx
addl $-0x1, %ecx
movl %ecx, 0x8(%rdx)
movl %ecx, -0x24(%rbp)
movq 0x48(%rax), %rcx
movq 0x10(%rcx), %rcx
imull $0x5, -0x24(%rbp), %edx
movslq %edx, %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0x28(%rbp)
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
imull $0x5, -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jne 0x4c0d4
movb $0x0, -0x1(%rbp)
jmp 0x4c3e3
movl $0x0, -0x30(%rbp)
movq -0x38(%rbp), %rcx
movl -0x30(%rbp), %eax
movq 0x28(%rcx), %rcx
movslq -0x28(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x4c11a
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x2c(%rbp), %eax
jne 0x4c10d
jmp 0x4c11a
jmp 0x4c10f
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x4c0db
movq -0x38(%rbp), %rcx
movq 0x48(%rcx), %rax
movq 0x10(%rax), %rax
imull $0x5, -0x24(%rbp), %edx
addl $0x2, %edx
movslq %edx, %rdx
movl (%rax,%rdx,4), %eax
movl %eax, -0x1c(%rbp)
movq 0x48(%rcx), %rax
movq 0x10(%rax), %rax
imull $0x5, -0x24(%rbp), %edx
addl $0x3, %edx
movslq %edx, %rdx
movl (%rax,%rdx,4), %eax
movl %eax, -0x20(%rbp)
movq 0x48(%rcx), %rax
movq 0x10(%rax), %rax
imull $0x5, -0x24(%rbp), %edx
addl $0x4, %edx
movslq %edx, %rdx
movl (%rax,%rdx,4), %eax
movl %eax, -0x24(%rbp)
movl -0x30(%rbp), %eax
movq 0x28(%rcx), %rcx
movslq -0x28(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x4c1ee
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %esi
movq 0x20(%rcx), %rax
movslq -0x28(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movslq -0x1c(%rbp), %rdx
movl %esi, (%rax,%rdx,4)
movl -0x28(%rbp), %esi
movq 0x20(%rcx), %rax
movslq -0x2c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movslq -0x20(%rbp), %rdx
movl %esi, (%rax,%rdx,4)
movl -0x20(%rbp), %esi
movq 0x20(%rcx), %rax
movslq -0x28(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x28(%rcx), %rdx
movslq -0x28(%rbp), %rdi
movl (%rdx,%rdi,4), %edx
addl -0x1c(%rbp), %edx
movslq %edx, %rdx
movl %esi, (%rax,%rdx,4)
movl -0x1c(%rbp), %edx
movq 0x20(%rcx), %rax
movslq -0x2c(%rbp), %rsi
movq (%rax,%rsi,8), %rax
movq 0x28(%rcx), %rcx
movslq -0x2c(%rbp), %rsi
movl (%rcx,%rsi,4), %ecx
addl -0x20(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x4c239
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x28(%rbp), %edx
movl -0x1c(%rbp), %ecx
xorl %r8d, %r8d
callq 0x54730
testb $0x1, %al
jne 0x4c211
movb $0x0, -0x1(%rbp)
jmp 0x4c3e3
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x2c(%rbp), %edx
movl -0x20(%rbp), %ecx
movl $0x1, %r8d
callq 0x54730
testb $0x1, %al
jne 0x4c237
movb $0x0, -0x1(%rbp)
jmp 0x4c3e3
jmp 0x4c239
movq -0x38(%rbp), %rax
movl 0x18(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x18(%rax)
movl 0x1c(%rax), %eax
cmpl -0x24(%rbp), %eax
jne 0x4c259
movq -0x38(%rbp), %rax
movl $0x0, 0x1c(%rax)
movq -0x38(%rbp), %rax
movl 0x18(%rax), %eax
cmpl -0x24(%rbp), %eax
je 0x4c3c3
movq -0x38(%rbp), %rcx
movl 0x1c(%rcx), %eax
cmpl 0x18(%rcx), %eax
jne 0x4c27f
movq -0x38(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, 0x1c(%rax)
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rcx
imull $0x3, 0x18(%rax), %edx
movslq %edx, %rdx
movsd (%rcx,%rdx,8), %xmm0
movq 0x30(%rax), %rcx
imull $0x3, -0x24(%rbp), %edx
movslq %edx, %rdx
movsd %xmm0, (%rcx,%rdx,8)
movq 0x30(%rax), %rcx
imull $0x3, 0x18(%rax), %edx
addl $0x1, %edx
movslq %edx, %rdx
movsd (%rcx,%rdx,8), %xmm0
movq 0x30(%rax), %rcx
imull $0x3, -0x24(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movsd %xmm0, (%rcx,%rdx,8)
movq 0x30(%rax), %rcx
imull $0x3, 0x18(%rax), %edx
addl $0x2, %edx
movslq %edx, %rdx
movsd (%rcx,%rdx,8), %xmm0
movq 0x30(%rax), %rax
imull $0x3, -0x24(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, -0x2c(%rbp)
movq -0x38(%rbp), %rdx
movl -0x2c(%rbp), %eax
movq 0x28(%rdx), %rcx
movslq 0x18(%rdx), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x4c35c
movq -0x38(%rbp), %rdi
movl -0x24(%rbp), %edx
movq 0x20(%rdi), %rax
movq 0x20(%rdi), %rcx
movslq 0x18(%rdi), %rsi
movq (%rcx,%rsi,8), %rcx
movslq -0x2c(%rbp), %rsi
movslq (%rcx,%rsi,4), %rcx
movq (%rax,%rcx,8), %rax
movq 0x20(%rdi), %rcx
movslq 0x18(%rdi), %rsi
movq (%rcx,%rsi,8), %rcx
movq 0x28(%rdi), %rsi
movslq 0x18(%rdi), %rdi
movl (%rsi,%rdi,4), %esi
addl -0x2c(%rbp), %esi
movslq %esi, %rsi
movslq (%rcx,%rsi,4), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x4c2f6
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rdi
movl -0x24(%rbp), %esi
movl 0x18(%rax), %edx
callq 0x4bfe0
movq -0x38(%rbp), %rcx
movq 0x20(%rcx), %rax
movslq 0x18(%rcx), %rdx
movq (%rax,%rdx,8), %rsi
movq 0x20(%rcx), %rax
movslq -0x24(%rbp), %rdx
movq %rsi, (%rax,%rdx,8)
movq 0x28(%rcx), %rax
movslq 0x18(%rcx), %rdx
movl (%rax,%rdx,4), %esi
movq 0x28(%rcx), %rax
movslq -0x24(%rbp), %rdx
movl %esi, (%rax,%rdx,4)
movl -0x24(%rbp), %edx
movq 0x20(%rcx), %rax
movslq -0x24(%rbp), %rsi
movq (%rax,%rsi,8), %rax
movq 0x28(%rcx), %rcx
movslq -0x24(%rbp), %rsi
movl (%rcx,%rsi,4), %ecx
shll %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x544e0
testb $0x1, %al
jne 0x4c3da
movb $0x0, -0x1(%rbp)
jmp 0x4c3e3
jmp 0x4c070
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nop