// File: /workspace/github_cpp_makefile_star2_O3/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
movsd %xmm3, 0x18(%rsp)
movsd %xmm2, 0x38(%rsp)
movsd %xmm1, 0x30(%rsp)
movsd %xmm0, 0x28(%rsp)
movl 0x1c(%rsi), %ecx
testl %ecx, %ecx
jle 0x833cc
movq %rdx, %rbx
movq %rsi, %r11
movq %rdi, %r15
movq 0x30(%rsi), %rax
xorl %r8d, %r8d
movsd 0xca190(%rip), %xmm3    # 0x14d058
movq %rdx, 0x40(%rsp)
cmpl $0x0, (%rax,%r8,4)
jle 0x833bd
movq %r8, %rcx
shlq $0x4, %rcx
movslq (%rbx,%rcx), %r12
movl 0x4(%rbx,%rcx), %r10d
movl 0x8(%rbx,%rcx), %r13d
movl 0xc(%rbx,%rcx), %esi
movq 0x60(%r15), %rcx
movq 0xc0(%r15), %rdx
movslq (%rdx,%r12,4), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0xc8(%r15), %rdx
movslq (%rdx,%r12,4), %rdx
shlq $0x5, %rdx
xorps %xmm0, %xmm0
cvtsi2sd %r10d, %xmm0
mulsd (%r15), %xmm0
addsd (%rcx,%rdx), %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r13d, %xmm1
movsd 0x8(%r15), %xmm2
mulsd %xmm1, %xmm2
movl %esi, 0x14(%rsp)
cvtsi2sd %esi, %xmm6
addsd %xmm0, %xmm2
movsd 0x18(%r15), %xmm7
mulsd %xmm6, %xmm7
addsd %xmm2, %xmm7
mulsd 0x10(%r15), %xmm1
addsd 0x8(%rcx,%rdx), %xmm1
movsd 0x20(%r15), %xmm8
mulsd %xmm6, %xmm8
mulsd 0x28(%r15), %xmm6
addsd %xmm1, %xmm8
addsd 0x10(%rcx,%rdx), %xmm6
movsd 0x28(%rsp), %xmm2
movapd %xmm2, %xmm9
subsd %xmm7, %xmm9
movsd 0x30(%rsp), %xmm1
movapd %xmm1, %xmm10
subsd %xmm8, %xmm10
movsd 0x38(%rsp), %xmm0
movapd %xmm0, %xmm11
subsd %xmm6, %xmm11
movapd %xmm7, %xmm12
subsd %xmm2, %xmm12
movapd %xmm8, %xmm13
subsd %xmm1, %xmm13
movapd %xmm6, %xmm14
subsd %xmm0, %xmm14
xorl %r14d, %r14d
movq %r8, 0x20(%rsp)
movl %r10d, 0x10(%rsp)
movl %r13d, 0xc(%rsp)
movsd %xmm6, 0x70(%rsp)
movsd %xmm7, 0x68(%rsp)
movsd %xmm8, 0x60(%rsp)
movapd %xmm9, 0xa0(%rsp)
movapd %xmm10, 0x90(%rsp)
movapd %xmm11, 0x80(%rsp)
movsd %xmm12, 0x58(%rsp)
movsd %xmm13, 0x50(%rsp)
movsd %xmm14, 0x48(%rsp)
movq 0x28(%r11), %rcx
movq (%rcx,%r8,8), %rcx
movslq (%rcx,%r14,4), %rcx
shlq $0x4, %rcx
movl (%rbx,%rcx), %ebp
movl 0x4(%rbx,%rcx), %edi
movl 0x8(%rbx,%rcx), %esi
movl 0xc(%rbx,%rcx), %edx
cmpl %r12d, %ebp
jne 0x83057
cmpl %r10d, %edi
jne 0x83057
cmpl %r13d, %esi
jne 0x83057
cmpl 0x14(%rsp), %edx
je 0x8332f
movslq %ebp, %r9
movl %edi, %ecx
subl %r10d, %ecx
movl %esi, %r8d
subl %r13d, %r8d
movl %edx, %r10d
subl 0x14(%rsp), %r10d
shll $0x10, %ecx
shll $0x8, %r8d
addl %ecx, %r8d
leal (%r10,%r8), %r13d
addl $0x7f7f7f, %r13d        # imm = 0x7F7F7F
movq 0xc0(%r15), %rcx
movslq (%rcx,%r9,4), %r8
movq 0x60(%r15), %r10
movq 0xa8(%r15), %rcx
movq (%r10,%r8,8), %r8
movq 0xc8(%r15), %r10
movslq (%r10,%r9,4), %r9
shlq $0x5, %r9
xorps %xmm0, %xmm0
cvtsi2sd %edi, %xmm0
mulsd (%r15), %xmm0
addsd (%r8,%r9), %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %esi, %xmm1
movsd 0x8(%r15), %xmm2
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
xorps %xmm15, %xmm15
cvtsi2sd %edx, %xmm15
movsd 0x18(%r15), %xmm4
mulsd %xmm15, %xmm4
addsd %xmm2, %xmm4
mulsd 0x10(%r15), %xmm1
addsd 0x8(%r8,%r9), %xmm1
movsd 0x20(%r15), %xmm5
mulsd %xmm15, %xmm5
mulsd 0x28(%r15), %xmm15
addsd 0x10(%r8,%r9), %xmm15
addsd %xmm1, %xmm5
subsd %xmm7, %xmm4
subsd %xmm8, %xmm5
subsd %xmm6, %xmm15
movapd %xmm10, %xmm0
unpcklpd %xmm5, %xmm0            # xmm0 = xmm0[0],xmm5[0]
movapd %xmm5, %xmm1
unpcklpd %xmm5, %xmm1            # xmm1 = xmm1[0],xmm5[0]
mulpd %xmm0, %xmm1
movapd %xmm9, %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 %xmm11, %xmm0
unpcklpd %xmm15, %xmm0           # xmm0 = xmm0[0],xmm15[0]
movapd %xmm15, %xmm1
unpcklpd %xmm15, %xmm1           # xmm1 = xmm1[0],xmm15[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
movapd %xmm5, %xmm1
movapd %xmm3, %xmm2
minsd %xmm0, %xmm2
mulsd %xmm2, %xmm4
addsd %xmm12, %xmm4
mulsd %xmm2, %xmm1
addsd %xmm13, %xmm1
mulsd %xmm2, %xmm15
addsd %xmm14, %xmm15
movslq (%rcx,%r12,4), %rdx
testq %rdx, %rdx
jle 0x831e4
movq 0x80(%r15), %rsi
movq 0x98(%r15), %rdi
movq (%rsi,%r12,8), %r9
movq %rdx, %r8
xorl %esi, %esi
cmpl %ebp, (%r9,%rsi)
jne 0x831db
movq (%rdi,%r12,8), %r10
cmpl %r13d, (%r10,%rsi)
je 0x83341
addq $0x4, %rsi
decq %r8
jne 0x831c7
movq 0xb8(%r15), %rsi
cmpl (%rsi,%r12,4), %edx
jne 0x832ac
movq %r15, %rdi
movl %r12d, %esi
movq %r11, %rbx
movapd %xmm15, 0xd0(%rsp)
movapd %xmm4, 0xc0(%rsp)
movapd %xmm1, 0xb0(%rsp)
movsd %xmm2, 0x78(%rsp)
callq 0x7fd54
movsd 0x78(%rsp), %xmm2
movapd 0xb0(%rsp), %xmm1
movapd 0xc0(%rsp), %xmm4
movapd 0xd0(%rsp), %xmm15
movsd 0x48(%rsp), %xmm14
movsd 0x50(%rsp), %xmm13
movsd 0x58(%rsp), %xmm12
movapd 0x80(%rsp), %xmm11
movapd 0x90(%rsp), %xmm10
movapd 0xa0(%rsp), %xmm9
movsd 0x60(%rsp), %xmm8
movsd 0x68(%rsp), %xmm7
movsd 0x70(%rsp), %xmm6
movsd 0xc9dc3(%rip), %xmm3    # 0x14d058
movq %rbx, %r11
movq 0x40(%rsp), %rbx
movq 0xa8(%r15), %rcx
movl (%rcx,%r12,4), %edx
movq 0x30(%r11), %rax
movq 0x80(%r15), %rsi
movq (%rsi,%r12,8), %rsi
movslq %edx, %rdx
movl %ebp, (%rsi,%rdx,4)
movq 0x90(%r15), %rdx
movq (%rdx,%r12,8), %rdx
movslq (%rcx,%r12,4), %rsi
movq %rsi, %rdi
shlq $0x4, %rdi
mulsd %xmm1, %xmm1
mulsd %xmm4, %xmm4
addsd %xmm1, %xmm4
mulsd %xmm15, %xmm15
addsd %xmm4, %xmm15
xorps %xmm0, %xmm0
sqrtsd %xmm15, %xmm0
subsd 0x18(%rsp), %xmm0
maxsd 0xce051(%rip), %xmm0    # 0x151350
movsd %xmm0, 0x8(%rdx,%rdi)
movsd %xmm2, (%rdx,%rdi)
movq 0x98(%r15), %rdx
movq (%rdx,%r12,8), %rdx
leal 0x1(%rsi), %edi
movl %edi, (%rcx,%r12,4)
movl %r13d, (%rdx,%rsi,4)
movq 0x20(%rsp), %r8
movl 0x10(%rsp), %r10d
movl 0xc(%rsp), %r13d
incq %r14
movslq (%rax,%r8,4), %rcx
cmpq %rcx, %r14
jl 0x8301f
jmp 0x833b9
testl %r8d, %r8d
je 0x831e4
movq 0x90(%r15), %rcx
movq (%rcx,%r12,8), %rcx
mulsd %xmm1, %xmm1
mulsd %xmm4, %xmm4
addsd %xmm1, %xmm4
mulsd %xmm15, %xmm15
addsd %xmm4, %xmm15
xorps %xmm0, %xmm0
sqrtsd %xmm15, %xmm0
subsd 0x18(%rsp), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
movq 0x20(%rsp), %r8
movl 0x10(%rsp), %r10d
jbe 0x83398
movq $0x0, 0x8(%rcx,%rsi,4)
jmp 0x8332a
movsd 0x8(%rcx,%rsi,4), %xmm1
ucomisd %xmm0, %xmm1
movl 0xc(%rsp), %r13d
jbe 0x8332f
movsd %xmm0, 0x8(%rcx,%rsi,4)
movsd %xmm2, (%rcx,%rsi,4)
jmp 0x8332f
movl 0x1c(%r11), %ecx
incq %r8
movslq %ecx, %rdx
cmpq %rdx, %r8
jl 0x82ecd
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq