// File: 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
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movb %cl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf350
movq -0x18(%rbp), %rdi
callq 0xf370
movl $0x0, -0x30(%rbp)
movq -0x120(%rbp), %rcx
movl -0x30(%rbp), %eax
cmpl 0xa0(%rcx), %eax
jge 0xe3fb5
movq -0x120(%rbp), %rax
movq 0x60(%rax), %rcx
movq 0xc0(%rax), %rdx
movslq -0x30(%rbp), %rsi
movslq (%rdx,%rsi,4), %rdx
movq (%rcx,%rdx,8), %rcx
movq %rcx, -0x70(%rbp)
movq 0xc8(%rax), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %eax
shll $0x2, %eax
movl %eax, -0x2c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0xd0d0
movl $0x0, -0x34(%rbp)
movq -0x120(%rbp), %rcx
movl -0x34(%rbp), %eax
movq 0xb0(%rcx), %rcx
movslq -0x30(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xe3e8b
movq -0x120(%rbp), %rax
movq 0x88(%rax), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x34(%rbp), %rcx
leaq (%rax,%rcx,4), %rsi
leaq -0x88(%rbp), %rdi
callq 0xd1b0
jmp 0xe3e67
jmp 0xe3e69
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xe3e21
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xe3fa4
movq -0x10(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x70(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x140(%rbp)
movsd 0x8(%rax,%rcx,8), %xmm0
movsd %xmm0, -0x138(%rbp)
movsd 0x10(%rax,%rcx,8), %xmm0
movsd %xmm0, -0x130(%rbp)
movsd 0x18(%rax,%rcx,8), %xmm0
movsd %xmm0, -0x128(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0xeec0
jmp 0xe3eea
movsd -0x128(%rbp), %xmm3
movsd -0x130(%rbp), %xmm2
movsd -0x138(%rbp), %xmm1
movsd -0x140(%rbp), %xmm0
leaq -0xd8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x99b00
jmp 0xe3f1f
movq -0x148(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0xe5300
jmp 0xe3f34
leaq -0xd8(%rbp), %rdi
callq 0xf5c0
leaq -0xf0(%rbp), %rdi
callq 0xec80
leaq -0x88(%rbp), %rdi
callq 0xec80
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xe3dc2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xe3f98
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0xf5c0
leaq -0xf0(%rbp), %rdi
callq 0xec80
leaq -0x88(%rbp), %rdi
callq 0xec80
jmp 0xe4308
movl $0x0, -0x30(%rbp)
movq -0x120(%rbp), %rcx
movl -0x30(%rbp), %eax
cmpl 0xa0(%rcx), %eax
jge 0xe42ff
movq -0x120(%rbp), %rax
movq 0x60(%rax), %rcx
movq 0xc0(%rax), %rdx
movslq -0x30(%rbp), %rsi
movslq (%rdx,%rsi,4), %rdx
movq (%rcx,%rdx,8), %rcx
movq %rcx, -0x70(%rbp)
movq 0xc8(%rax), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %eax
shll $0x2, %eax
movl %eax, -0x2c(%rbp)
movq -0x70(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x40(%rbp)
movq -0x70(%rbp), %rax
movl -0x2c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x70(%rbp), %rax
movl -0x2c(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x50(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x120(%rbp), %rcx
movl -0x38(%rbp), %eax
movq 0xa8(%rcx), %rcx
movslq -0x30(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xe42ef
movq -0x120(%rbp), %rdi
movq 0x98(%rdi), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %esi
leaq -0x20(%rbp), %rdx
leaq -0x24(%rbp), %rcx
leaq -0x28(%rbp), %r8
callq 0xe52b0
testb $0x1, -0x19(%rbp)
je 0xe40dc
movq -0x120(%rbp), %rax
movq 0x80(%rax), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x30(%rbp), %eax
jge 0xe40da
cmpl $0x0, -0x20(%rbp)
jne 0xe40da
cmpl $0x0, -0x24(%rbp)
jne 0xe40da
cmpl $0x0, -0x28(%rbp)
jne 0xe40da
jmp 0xe42e1
jmp 0xe40dc
movq -0x120(%rbp), %rax
movq 0x60(%rax), %rcx
movq 0xc0(%rax), %rdx
movq 0x80(%rax), %rsi
movslq -0x30(%rbp), %rdi
movq (%rsi,%rdi,8), %rsi
movslq -0x38(%rbp), %rdi
movslq (%rsi,%rdi,4), %rsi
movslq (%rdx,%rsi,4), %rdx
movq (%rcx,%rdx,8), %rcx
movq %rcx, -0x70(%rbp)
movq 0xc8(%rax), %rcx
movq 0x80(%rax), %rdx
movslq -0x30(%rbp), %rsi
movq (%rdx,%rsi,8), %rdx
movslq -0x38(%rbp), %rsi
movslq (%rdx,%rsi,4), %rdx
movl (%rcx,%rdx,4), %ecx
shll $0x2, %ecx
movl %ecx, -0x2c(%rbp)
movq -0x70(%rbp), %rcx
movslq -0x2c(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm1
cvtsi2sdl -0x20(%rbp), %xmm0
movsd (%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsi2sdl -0x24(%rbp), %xmm1
movsd 0x8(%rax), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvtsi2sdl -0x28(%rbp), %xmm0
movsd 0x18(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
subsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x70(%rbp), %rcx
movl -0x2c(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movsd (%rcx,%rdx,8), %xmm0
cvtsi2sdl -0x24(%rbp), %xmm1
movsd 0x10(%rax), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvtsi2sdl -0x28(%rbp), %xmm0
movsd 0x20(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
subsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movq -0x70(%rbp), %rcx
movl -0x2c(%rbp), %edx
addl $0x2, %edx
movslq %edx, %rdx
movsd (%rcx,%rdx,8), %xmm1
cvtsi2sdl -0x28(%rbp), %xmm0
movsd 0x28(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
subsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0x18(%rbp), %rcx
movq %rcx, -0x150(%rbp)
movl -0x30(%rbp), %ecx
movl %ecx, -0x16c(%rbp)
movq 0x80(%rax), %rcx
movslq -0x30(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq -0x38(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0x168(%rbp)
movq 0x90(%rax), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x158(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x164(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x160(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x15c(%rbp)
movsd -0x58(%rbp), %xmm1
movsd -0x58(%rbp), %xmm2
movsd -0x60(%rbp), %xmm0
mulsd -0x60(%rbp), %xmm0
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x68(%rbp), %xmm0
movsd -0x68(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x53f0
movl -0x16c(%rbp), %esi
movl -0x168(%rbp), %edx
movl -0x164(%rbp), %ecx
movl -0x160(%rbp), %r8d
movl -0x15c(%rbp), %r9d
movaps %xmm0, %xmm1
movsd -0x158(%rbp), %xmm0
leaq -0x118(%rbp), %rdi
callq 0x99a30
movq -0x150(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0xaed60
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xe404f
jmp 0xe42f1
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xe3fbc
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
movq -0x90(%rbp), %rdi
callq 0x58f0
nopw %cs:(%rax,%rax)