// File: /workspace/github_cpp_makefile_star2_O2/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 $0xb8, %rsp
movl %ecx, 0x24(%rsp)
movq %rdx, %rbx
movq %rdi, %r15
movq %rsi, 0x28(%rsp)
movq %rsi, %rdi
callq 0xa840
movq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
je 0x604b3
movq %rax, 0x8(%rbx)
movq %rbx, 0x38(%rsp)
xorl %ebx, %ebx
leaq 0x40(%rsp), %rbp
movslq 0xa0(%r15), %rax
cmpq %rax, %rbx
jge 0x605ec
movq 0x60(%r15), %rax
movq 0xc0(%r15), %rcx
movslq (%rcx,%rbx,4), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x8(%rsp)
movq 0xc8(%r15), %rax
movslq (%rax,%rbx,4), %r12
andq $0x0, 0x50(%rsp)
shlq $0x2, %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
xorl %r13d, %r13d
xorl %r14d, %r14d
movq 0xb0(%r15), %rax
movslq (%rax,%rbx,4), %rax
cmpq %rax, %r14
jge 0x60539
movq 0x88(%r15), %rax
movq (%rax,%rbx,8), %rsi
addq %r13, %rsi
movq %rbp, %rdi
callq 0x9434
incq %r14
addq $0x4, %r13
jmp 0x6050a
movq 0x8(%rsp), %rcx
movsd (%rcx,%r12,8), %xmm0
movsd %xmm0, 0x18(%rsp)
movl %r12d, %eax
orl $0x1, %eax
cltq
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, 0x10(%rsp)
movl %r12d, %eax
orl $0x2, %eax
cltq
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, 0x30(%rsp)
orl $0x3, %r12d
movslq %r12d, %rax
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
callq 0xa6ce
leaq 0x78(%rsp), %r12
movq %r12, %rdi
movsd 0x18(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x30(%rsp), %xmm2
movsd 0x8(%rsp), %xmm3
movq %r14, %rsi
callq 0x408c4
movq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x62c2c
leaq 0x98(%rsp), %rdi
callq 0xb290
movq %r14, %rdi
callq 0xb290
movq %rbp, %rdi
callq 0xb290
incq %rbx
jmp 0x604bf
xorl %r12d, %r12d
movl $0xff, %ebp
leaq 0x78(%rsp), %r13
cltq
cmpq %rax, %r12
jge 0x607cb
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
leaq (,%rcx,4), %rdx
shlq $0x5, %rcx
movsd (%rax,%rcx), %xmm0
movsd %xmm0, 0x8(%rsp)
leal 0x1(%rdx), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x18(%rsp)
orl $0x2, %edx
movslq %edx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x10(%rsp)
pushq $0x8
popq %r14
xorl %ebx, %ebx
movq 0xa8(%r15), %rax
movslq (%rax,%r12,4), %rax
cmpq %rax, %rbx
jge 0x607bc
movq 0x80(%r15), %rax
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 (%rax,%r12,8), %rax
movslq (%rax,%rbx,4), %rdx
cmpb $0x0, 0x24(%rsp)
je 0x606cf
cmpq %rdx, %r12
jle 0x606cf
testl %ecx, %ecx
jne 0x606cf
testl %r8d, %r8d
jne 0x606cf
testl %r9d, %r9d
je 0x607b0
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
cvtsi2sd %ecx, %xmm0
mulsd (%r15), %xmm0
addsd (%rax,%rdi), %xmm0
cvtsi2sd %r8d, %xmm3
movsd 0x8(%r15), %xmm4
mulsd %xmm3, %xmm4
addsd %xmm0, %xmm4
cvtsi2sd %r9d, %xmm1
movsd 0x18(%r15), %xmm2
mulsd %xmm1, %xmm2
addsd %xmm4, %xmm2
subsd 0x8(%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 0x18(%rsp), %xmm4
orl $0x2, %esi
movslq %esi, %rsi
mulsd 0x28(%r15), %xmm1
addsd (%rax,%rsi,8), %xmm1
subsd 0x10(%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 0x4087a
movq 0x38(%rsp), %rdi
movq %r13, %rsi
callq 0x4cc46
incq %rbx
addq $0x10, %r14
jmp 0x60661
incq %r12
movl 0xa0(%r15), %eax
jmp 0x605f9
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0xb290
jmp 0x607f2
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0xb290
jmp 0x60803
jmp 0x60800
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xb290
movq %rbx, %rdi
callq 0x4780
nop