// File: /workspace/github_cpp_makefile_star2_O3/Luthaf[P]zeopp/voro++/src/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[i<<2]=pts[p<<2];
			pts[(i<<2)+1]=pts[(p<<2)+1];
			pts[(i<<2)+2]=pts[(p<<2)+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, %r14
movq %rdi, %r15
callq 0x12af0
testb %al, %al
je 0xe622
movq 0x68(%r15), %rcx
movl 0x8(%rcx), %eax
testl %eax, %eax
setle %bl
jle 0xe619
decl %eax
movl %eax, 0x8(%rcx)
movq 0x70(%r15), %rcx
movq 0x10(%rcx), %rdi
leal (%rax,%rax,4), %r8d
movl (%rdi,%r8,4), %edx
movl 0x4(%rdi,%r8,4), %ebp
cmpl %ebp, %edx
je 0xe61d
movslq %edx, %rsi
movq 0x30(%r15), %rax
movslq (%rax,%rsi,4), %r9
testq %r9, %r9
jle 0xe492
movq 0x28(%r15), %rcx
movq (%rcx,%rsi,8), %rcx
xorl %r10d, %r10d
cmpl %ebp, (%rcx,%r10,4)
je 0xe495
incq %r10
cmpq %r10, %r9
jne 0xe473
movl 0x8(%rdi,%r8,4), %ecx
movl 0xc(%rdi,%r8,4), %r12d
movl 0x10(%rdi,%r8,4), %r13d
jmp 0xe4a9
xorl %r10d, %r10d
movl 0x8(%rdi,%r8,4), %ecx
movl 0xc(%rdi,%r8,4), %r12d
movl 0x10(%rdi,%r8,4), %r13d
cmpl %r9d, %r10d
jne 0xe4de
movslq %ebp, %rdi
movq 0x28(%r15), %r8
movq (%r8,%rsi,8), %r9
movslq %ecx, %rcx
movl %ebp, (%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 0xe512
movq %r15, %rdi
movq %r14, %rsi
xorl %r8d, %r8d
callq 0x12c8a
testb %al, %al
je 0xe624
movq %r15, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %r12d, %ecx
movl $0x1, %r8d
callq 0x12c8a
testb %al, %al
je 0xe624
movslq 0x1c(%r15), %rcx
leaq -0x1(%rcx), %rax
movl %eax, 0x1c(%r15)
movl 0x20(%r15), %edx
cmpl %r13d, %edx
jne 0xe531
movl $0x0, 0x20(%r15)
xorl %edx, %edx
cmpl %r13d, %eax
je 0xe604
cmpl %eax, %edx
jne 0xe542
movl %r13d, 0x20(%r15)
movq 0x40(%r15), %rdx
leal (,%rax,4), %esi
movslq %esi, %rsi
movsd (%rdx,%rsi,8), %xmm0
leal (,%r13,4), %esi
movslq %esi, %rsi
movsd %xmm0, (%rdx,%rsi,8)
leal 0x1(,%rax,4), %esi
movslq %esi, %rsi
movsd (%rdx,%rsi,8), %xmm0
leal 0x1(,%r13,4), %esi
movslq %esi, %rsi
movsd %xmm0, (%rdx,%rsi,8)
leal 0x2(,%rax,4), %esi
movslq %esi, %rsi
movsd (%rdx,%rsi,8), %xmm0
leal 0x2(,%r13,4), %esi
movslq %esi, %rsi
movsd %xmm0, (%rdx,%rsi,8)
movq 0x28(%r15), %rdx
movq 0x30(%r15), %rsi
movl -0x4(%rsi,%rcx,4), %edi
testl %edi, %edi
jle 0xe5df
xorl %ecx, %ecx
movq (%rdx,%rax,8), %rax
movslq (%rax,%rcx,4), %r8
movq (%rdx,%r8,8), %r8
movslq %edi, %rdi
addq %rcx, %rdi
movslq (%rax,%rdi,4), %rax
movl %r13d, (%r8,%rax,4)
incq %rcx
movslq 0x1c(%r15), %rax
movslq (%rsi,%rax,4), %rdi
cmpq %rdi, %rcx
jl 0xe5b5
movq (%rdx,%rax,8), %rcx
movslq %r13d, %rsi
movq %rcx, (%rdx,%rsi,8)
movq 0x30(%r15), %rcx
movl (%rcx,%rax,4), %eax
movl %eax, (%rcx,%rsi,4)
movq 0x28(%r15), %rcx
movq (%rcx,%rsi,8), %rcx
addl %eax, %eax
cltq
movl %r13d, (%rcx,%rax,4)
movq %r15, %rdi
movq %r14, %rsi
callq 0x12af0
testb %al, %al
jne 0xe424
jmp 0xe624
movb $0x1, %bl
jmp 0xe624
callq 0x2595
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop