// File: /workspace/github_cpp_makefile_star2_O3/Luthaf[P]zeopp/v_network.cc
// Function: voronoi_network::store_network(std::vector<VOR_NODE, std::allocator<VOR_NODE>>&, std::vector<VOR_EDGE, std::allocator<VOR_EDGE>>&, bool)
void voronoi_network::store_network(vector<VOR_NODE> &nodes, vector <VOR_EDGE> &edges, bool reverse_remove) {
  int ai,aj,ak,j,l,ll,q;
  double x,y,z,x2,y2,z2,*ptsp;
  
  nodes.clear(); edges.clear();

  // Print the vertex table
  for(l=0;l<edc;l++) {
    ptsp=pts[reg[l]];j=4*regp[l];

    vector<int> atomIDs;
    for(ll=0;ll<nec[l];ll++) atomIDs.push_back(ne[l][ll]);

    nodes.push_back(VOR_NODE(ptsp[j], ptsp[j+1], ptsp[j+2], ptsp[j+3], atomIDs));
  }
  
  // Print out the edge table, loop over vertices
  for(l=0;l<edc;l++) {
    
    // Store the position of this vertex
    ptsp=pts[reg[l]];j=4*regp[l];
    x=ptsp[j];y=ptsp[j+1];z=ptsp[j+2];

    // Loop over edges of this vertex
    for(q=0;q<nu[l];q++) {
      
      unpack_periodicity(pered[l][q],ai,aj,ak);
      
      // If this option is enabled, then the code will not
      // print edges from i to j for j<i.
      if(reverse_remove) if(ed[l][q]<l&&ai==0&&aj==0&&ak==0) continue;
      
      // Compute and print the length of the edge 
      ptsp=pts[reg[ed[l][q]]];j=4*regp[ed[l][q]];
      x2=ptsp[j]+ai*bx+aj*bxy+ak*bxz-x;
      y2=ptsp[j+1]+aj*by+ak*byz-y;
      z2=ptsp[j+2]+ak*bz-z;
      edges.push_back(VOR_EDGE(l, ed[l][q], raded[l][q].e, ai, aj, ak, sqrt(x2*x2+y2*y2+z2*z2)));
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %ecx, 0x1c(%rsp)
movq %rdx, %rbx
movq %rsi, %rax
movq %rdi, %r15
movq (%rsi), %rsi
movq %rax, 0x38(%rsp)
movq %rax, %rdi
callq 0x133a8
movq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
je 0x80195
movq %rax, 0x8(%rbx)
movq %rbx, 0x48(%rsp)
cmpl $0x0, 0xa0(%r15)
jle 0x8051a
xorl %ebp, %ebp
movq 0x60(%r15), %rax
movq 0xc0(%r15), %rcx
movslq (%rcx,%rbp,4), %rcx
movq (%rax,%rcx,8), %rbx
movq 0xc8(%r15), %rax
movslq (%rax,%rbp,4), %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq 0xb0(%r15), %rax
cmpl $0x0, (%rax,%rbp,4)
jle 0x80236
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x88(%r15), %rcx
movq (%rcx,%rbp,8), %rdx
addq %r12, %rdx
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x80215
movl (%rdx), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x80226
leaq 0x20(%rsp), %rdi
callq 0xf864
movq 0xb0(%r15), %rax
incq %r13
movslq (%rax,%rbp,4), %rcx
addq $0x4, %r12
cmpq %rcx, %r13
jl 0x801ec
shlq $0x2, %r14
movsd (%rbx,%r14,8), %xmm0
movsd %xmm0, 0x10(%rsp)
movl %r14d, %eax
orl $0x1, %eax
cltq
movsd (%rbx,%rax,8), %xmm0
movsd %xmm0, 0x8(%rsp)
movl %r14d, %eax
orl $0x2, %eax
cltq
movsd (%rbx,%rax,8), %xmm0
movsd %xmm0, (%rsp)
orl $0x3, %r14d
movslq %r14d, %rax
movsd (%rbx,%rax,8), %xmm0
movsd %xmm0, 0x40(%rsp)
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0xe8f8
leaq 0x68(%rsp), %r14
movq %r14, %rdi
movsd 0x10(%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movsd (%rsp), %xmm2
movsd 0x40(%rsp), %xmm3
movq %rbx, %rsi
callq 0x5522c
movq 0x38(%rsp), %rdi
movq %r14, %rsi
callq 0x82ca4
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x802e0
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x802f7
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x8030e
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
incq %rbp
movslq 0xa0(%r15), %rcx
cmpq %rcx, %rbp
jl 0x801aa
testl %ecx, %ecx
jle 0x8051a
movq 0xa8(%r15), %rax
xorl %r12d, %r12d
movl $0xff, %ebp
leaq 0x68(%rsp), %r13
cmpl $0x0, (%rax,%r12,4)
jle 0x8050b
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
leaq (,%rdx,4), %rsi
shlq $0x5, %rdx
movsd (%rcx,%rdx), %xmm0
movsd %xmm0, 0x10(%rsp)
leal 0x1(%rsi), %edx
movslq %edx, %rdx
movsd (%rcx,%rdx,8), %xmm0
movsd %xmm0, 0x8(%rsp)
orl $0x2, %esi
movslq %esi, %rdx
movsd (%rcx,%rdx,8), %xmm0
movsd %xmm0, (%rsp)
movl $0x8, %r14d
xorl %ebx, %ebx
movq 0x80(%r15), %rdx
movq 0x98(%r15), %rcx
movq (%rcx,%r12,8), %rcx
movl (%rcx,%rbx,4), %r9d
movl %r9d, %ecx
shrl $0x10, %ecx
addl $-0x7f, %ecx
movl %r9d, %r8d
shrl $0x8, %r8d
andl %ebp, %r8d
addl $-0x7f, %r8d
andl %ebp, %r9d
addl $-0x7f, %r9d
movq (%rdx,%r12,8), %rdx
movslq (%rdx,%rbx,4), %rdx
cmpb $0x0, 0x1c(%rsp)
je 0x80400
cmpq %rdx, %r12
jle 0x80400
testl %ecx, %ecx
jne 0x80400
testl %r8d, %r8d
jne 0x80400
testl %r9d, %r9d
je 0x804f0
movq 0x60(%r15), %rax
movq 0xc0(%r15), %rsi
movslq (%rsi,%rdx,4), %rsi
movq (%rax,%rsi,8), %rax
movq 0xc8(%r15), %rsi
movslq (%rsi,%rdx,4), %rdi
leaq (,%rdi,4), %rsi
shlq $0x5, %rdi
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
mulsd (%r15), %xmm0
addsd (%rax,%rdi), %xmm0
xorps %xmm3, %xmm3
cvtsi2sd %r8d, %xmm3
movsd 0x8(%r15), %xmm4
mulsd %xmm3, %xmm4
addsd %xmm0, %xmm4
xorps %xmm1, %xmm1
cvtsi2sd %r9d, %xmm1
movsd 0x18(%r15), %xmm2
mulsd %xmm1, %xmm2
addsd %xmm4, %xmm2
subsd 0x10(%rsp), %xmm2
leal 0x1(%rsi), %edi
movslq %edi, %rdi
mulsd 0x10(%r15), %xmm3
addsd (%rax,%rdi,8), %xmm3
movsd 0x20(%r15), %xmm4
mulsd %xmm1, %xmm4
addsd %xmm3, %xmm4
subsd 0x8(%rsp), %xmm4
orl $0x2, %esi
movslq %esi, %rsi
mulsd 0x28(%r15), %xmm1
addsd (%rax,%rsi,8), %xmm1
subsd (%rsp), %xmm1
movq 0x90(%r15), %rax
movq (%rax,%r12,8), %rax
movsd (%rax,%r14), %xmm0
mulsd %xmm4, %xmm4
mulsd %xmm2, %xmm2
addsd %xmm4, %xmm2
mulsd %xmm1, %xmm1
addsd %xmm2, %xmm1
sqrtsd %xmm1, %xmm1
movq %r13, %rdi
movl %r12d, %esi
callq 0x551e0
movq 0x48(%rsp), %rdi
movq %r13, %rsi
callq 0x687be
movq 0xa8(%r15), %rax
incq %rbx
movslq (%rax,%r12,4), %rcx
addq $0x10, %r14
cmpq %rcx, %rbx
jl 0x803a6
movl 0xa0(%r15), %ecx
incq %r12
movslq %ecx, %rdx
cmpq %rdx, %r12
jl 0x8033d
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8056c
movq %rax, %rbx
jmp 0x80553
movq %rax, %rbx
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x80553
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x8056f
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
jmp 0x8056f
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x80586
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780