// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/v_network.cc
// Function: void voronoi_network::add_edges_to_network<voro::voronoicell>(voro::voronoicell&, double, double, double, double, int*)
void voronoi_network::add_edges_to_network(v_cell &c,double x,double y,double z,double rad,int *cmap) {
	int i,j,ai,aj,ak,bi,bj,bk,k,l,q,*vmp;unsigned int cper;
	double vx,vy,vz,wx,wy,wz,dx,dy,dz,dis;double *pp;
	for(l=0;l<c.p;l++) {
		vmp=cmap+4*l;k=*(vmp++);ai=*(vmp++);aj=*(vmp++);ak=*vmp;
		pp=pts[reg[k]]+4*regp[k];
		vx=pp[0]+ai*bx+aj*bxy+ak*bxz;
		vy=pp[1]+aj*by+ak*byz;
		vz=pp[2]+ak*bz;
		for(q=0;q<c.nu[l];q++) {
			i=c.ed[l][q];
			vmp=cmap+4*i;
			j=*(vmp++);bi=*(vmp++);bj=*(vmp++);bk=*vmp;

			// Skip if this is a self-connecting edge
			if(j==k&&bi==ai&&bj==aj&&bk==ak) continue;
			cper=pack_periodicity(bi-ai,bj-aj,bk-ak);
			pp=pts[reg[j]]+(4*regp[j]);
			wx=pp[0]+bi*bx+bj*bxy+bk*bxz;
			wy=pp[1]+bj*by+bk*byz;
			wz=pp[2]+bk*bz;
			dx=wx-vx;dy=wy-vy;dz=wz-vz;
			dis=(x-vx)*dx+(y-vy)*dy+(z-vz)*dz;
			dis/=dx*dx+dy*dy+dz*dz;
			if(dis<0) dis=0;if(dis>1) dis=1;
			wx=vx-x+dis*dx;wy=vy-y+dis*dy;wz=vz-z+dis*dz;
			int nat=not_already_there(k,j,cper);
			if(nat==nu[k]) {
				if(nu[k]==numem[k]) add_particular_vertex_memory(k);
				ed[k][nu[k]]=j;
				raded[k][nu[k]].first(sqrt(wx*wx+wy*wy+wz*wz)-rad,dis);
				pered[k][nu[k]++]=cper;
			} else {
				raded[k][nat].add(sqrt(wx*wx+wy*wy+wz*wz)-rad,dis);
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rdx, %rbx
movsd %xmm3, 0x28(%rsp)
movsd %xmm2, 0x48(%rsp)
movsd %xmm1, 0x40(%rsp)
movsd %xmm0, 0x38(%rsp)
movq %rdi, %r15
xorl %edi, %edi
movq %rsi, 0x18(%rsp)
movslq 0x1c(%rsi), %rax
cmpq %rax, %rdi
jge 0x63246
movq %rdi, %rax
shlq $0x4, %rax
movslq (%rbx,%rax), %r12
movl 0x4(%rbx,%rax), %r8d
movl 0x8(%rbx,%rax), %r9d
movl 0xc(%rbx,%rax), %r10d
movq 0x60(%r15), %rax
movq 0xc0(%r15), %rcx
movslq (%rcx,%r12,4), %rcx
movq (%rax,%rcx,8), %rax
movq 0xc8(%r15), %rcx
movslq (%rcx,%r12,4), %rcx
shlq $0x5, %rcx
cvtsi2sd %r8d, %xmm0
mulsd (%r15), %xmm0
addsd (%rax,%rcx), %xmm0
cvtsi2sd %r9d, %xmm1
movsd 0x8(%r15), %xmm2
mulsd %xmm1, %xmm2
cvtsi2sd %r10d, %xmm3
addsd %xmm0, %xmm2
movsd 0x18(%r15), %xmm4
mulsd %xmm3, %xmm4
addsd %xmm2, %xmm4
mulsd 0x10(%r15), %xmm1
addsd 0x8(%rax,%rcx), %xmm1
movsd 0x20(%r15), %xmm5
mulsd %xmm3, %xmm5
mulsd 0x28(%r15), %xmm3
addsd %xmm1, %xmm5
addsd 0x10(%rax,%rcx), %xmm3
movsd 0x38(%rsp), %xmm2
movapd %xmm2, %xmm0
subsd %xmm4, %xmm0
movapd %xmm0, 0xd0(%rsp)
movsd 0x40(%rsp), %xmm1
movapd %xmm1, %xmm0
subsd %xmm5, %xmm0
movapd %xmm0, 0xc0(%rsp)
movsd 0x48(%rsp), %xmm0
movapd %xmm0, %xmm6
subsd %xmm3, %xmm6
movapd %xmm6, 0xb0(%rsp)
movsd %xmm4, 0x70(%rsp)
subsd %xmm2, %xmm4
movsd %xmm4, 0x60(%rsp)
movsd %xmm5, 0x68(%rsp)
subsd %xmm1, %xmm5
movsd %xmm5, 0x58(%rsp)
movsd %xmm3, 0x78(%rsp)
subsd %xmm0, %xmm3
movsd %xmm3, 0x50(%rsp)
xorl %r14d, %r14d
movq %rdi, 0x20(%rsp)
movl %r8d, 0x14(%rsp)
movl %r9d, 0x10(%rsp)
movl %r10d, 0xc(%rsp)
movq 0x30(%rsi), %rax
movslq (%rax,%rdi,4), %rax
cmpq %rax, %r14
jge 0x6323e
movq 0x28(%rsi), %rax
movq (%rax,%rdi,8), %rax
movslq (%rax,%r14,4), %rax
shlq $0x4, %rax
movl (%rbx,%rax), %ebp
movl 0x4(%rbx,%rax), %edx
movl 0x8(%rbx,%rax), %ecx
movl 0xc(%rbx,%rax), %eax
cmpl %r12d, %ebp
jne 0x62f54
cmpl %r8d, %edx
jne 0x62f54
cmpl %r9d, %ecx
jne 0x62f54
cmpl %r10d, %eax
je 0x63201
movslq %ebp, %rdi
movl %edx, %esi
subl %r8d, %esi
movl %ecx, %r8d
subl %r9d, %r8d
movl %eax, %r9d
subl %r10d, %r9d
shll $0x10, %esi
shll $0x8, %r8d
addl %esi, %r8d
leal (%r9,%r8), %r13d
addl $0x7f7f7f, %r13d        # imm = 0x7F7F7F
movq 0x60(%r15), %rsi
movq 0xc0(%r15), %r8
movslq (%r8,%rdi,4), %r8
movq (%rsi,%r8,8), %rsi
movq 0xc8(%r15), %r8
movslq (%r8,%rdi,4), %rdi
shlq $0x5, %rdi
cvtsi2sd %edx, %xmm0
mulsd (%r15), %xmm0
addsd (%rsi,%rdi), %xmm0
cvtsi2sd %ecx, %xmm1
movsd 0x8(%r15), %xmm2
mulsd %xmm1, %xmm2
cvtsi2sd %eax, %xmm3
addsd %xmm0, %xmm2
movsd 0x18(%r15), %xmm4
mulsd %xmm3, %xmm4
addsd %xmm2, %xmm4
mulsd 0x10(%r15), %xmm1
addsd 0x8(%rsi,%rdi), %xmm1
movsd 0x20(%r15), %xmm5
mulsd %xmm3, %xmm5
mulsd 0x28(%r15), %xmm3
addsd %xmm1, %xmm5
addsd 0x10(%rsi,%rdi), %xmm3
subsd 0x70(%rsp), %xmm4
subsd 0x68(%rsp), %xmm5
subsd 0x78(%rsp), %xmm3
movapd 0xc0(%rsp), %xmm0
unpcklpd %xmm5, %xmm0            # xmm0 = xmm0[0],xmm5[0]
movapd %xmm5, %xmm1
unpcklpd %xmm5, %xmm1            # xmm1 = xmm1[0],xmm5[0]
mulpd %xmm0, %xmm1
movapd 0xd0(%rsp), %xmm0
unpcklpd %xmm4, %xmm0            # xmm0 = xmm0[0],xmm4[0]
movapd %xmm4, %xmm2
unpcklpd %xmm4, %xmm2            # xmm2 = xmm2[0],xmm4[0]
mulpd %xmm0, %xmm2
addpd %xmm1, %xmm2
movapd 0xb0(%rsp), %xmm0
unpcklpd %xmm3, %xmm0            # xmm0 = xmm0[0],xmm3[0]
movapd %xmm3, %xmm1
unpcklpd %xmm3, %xmm1            # xmm1 = xmm1[0],xmm3[0]
mulpd %xmm0, %xmm1
addpd %xmm2, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
divsd %xmm0, %xmm1
xorpd %xmm0, %xmm0
maxsd %xmm1, %xmm0
movsd 0x98fe0(%rip), %xmm1    # 0xfc058
minsd %xmm0, %xmm1
mulsd %xmm1, %xmm4
addsd 0x60(%rsp), %xmm4
movapd %xmm4, 0x90(%rsp)
mulsd %xmm1, %xmm5
addsd 0x58(%rsp), %xmm5
movapd %xmm5, 0x80(%rsp)
movsd %xmm1, 0x30(%rsp)
mulsd %xmm1, %xmm3
addsd 0x50(%rsp), %xmm3
movapd %xmm3, 0xa0(%rsp)
movq %r15, %rdi
movl %r12d, %esi
movl %ebp, %edx
movl %r13d, %ecx
callq 0x60b58
movq 0xa8(%r15), %rcx
cmpl (%rcx,%r12,4), %eax
jne 0x6318f
movq 0xb8(%r15), %rdx
cmpl (%rdx,%r12,4), %eax
jne 0x630ff
movq %r15, %rdi
movl %r12d, %esi
callq 0x600cc
movq 0xa8(%r15), %rcx
movl (%rcx,%r12,4), %eax
movq 0x80(%r15), %rdx
movq (%rdx,%r12,8), %rdx
cltq
movl %ebp, (%rdx,%rax,4)
movq 0x90(%r15), %rax
movq (%rax,%r12,8), %rax
movslq (%rcx,%r12,4), %rdx
movq %rdx, %rsi
shlq $0x4, %rsi
movapd 0x80(%rsp), %xmm0
mulsd %xmm0, %xmm0
movapd 0x90(%rsp), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
movapd 0xa0(%rsp), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
subsd 0x28(%rsp), %xmm0
maxsd 0x9d17a(%rip), %xmm0    # 0x1002e0
movsd %xmm0, 0x8(%rax,%rsi)
movsd 0x30(%rsp), %xmm0
movsd %xmm0, (%rax,%rsi)
movq 0x98(%r15), %rax
movq (%rax,%r12,8), %rax
leal 0x1(%rdx), %esi
movl %esi, (%rcx,%r12,4)
movl %r13d, (%rax,%rdx,4)
jmp 0x631e8
movq 0x90(%r15), %rcx
cltq
shlq $0x4, %rax
movapd 0x80(%rsp), %xmm0
mulsd %xmm0, %xmm0
movapd 0x90(%rsp), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
movapd 0xa0(%rsp), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
subsd 0x28(%rsp), %xmm0
addq (%rcx,%r12,8), %rax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x63209
andq $0x0, 0x8(%rax)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdi
movl 0x14(%rsp), %r8d
movl 0x10(%rsp), %r9d
movl 0xc(%rsp), %r10d
incq %r14
jmp 0x62f0c
movsd 0x8(%rax), %xmm1
ucomisd %xmm0, %xmm1
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdi
movl 0x14(%rsp), %r8d
movl 0x10(%rsp), %r9d
movl 0xc(%rsp), %r10d
jbe 0x63201
movsd %xmm0, 0x8(%rax)
movsd 0x30(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0x63201
incq %rdi
jmp 0x62ddc
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq