// File: Luthaf[P]zeopp/networkstorage.cc
// Function: put_atoms_in_atom_network(ATOM_NETWORK*, std::vector<MOLECULE, std::allocator<MOLECULE>>*)
void put_atoms_in_atom_network(ATOM_NETWORK *cell, vector<MOLECULE> *assembled_molecules) {
  cell->numAtoms = 0;
  int num_assembled_molecules = assembled_molecules->size();
  for(int i=0; i<num_assembled_molecules; i++) {
    int num_at = assembled_molecules->at(i).atoms_xyz.size();
    for(int j=0; j<num_at; j++) {
      bool is_site = false, is_dummy_site = false;
      int num_sites = assembled_molecules->at(i).sites.size();
      int num_dummy_sites = assembled_molecules->at(i).dummy_sites.size();
      for(int k=0; k<num_sites && !is_site; k++) {
        is_site = (j == assembled_molecules->at(i).sites.at(k));
      }
      for(int k=0; k<num_dummy_sites && !is_dummy_site && !is_site; k++) {
        is_dummy_site = (j == assembled_molecules->at(i).dummy_sites.at(k));
      }
      if(!is_site && !is_dummy_site) { //don't save sites! they are dummy atoms and we don't need them in the ATOM_NETWORK (they will still be accessible in the vector<MOLECULE> assembled_molecules)
        XYZ xyz = assembled_molecules->at(i).atoms_xyz.at(j);
        XYZ abc = trans_to_origuc(cell->xyz_to_abc_returning_XYZ(xyz));
        string name = assembled_molecules->at(i).atoms_type.at(j);
        string label = assembled_molecules->at(i).atoms_label.at(j);
        ATOM a(xyz, name, label, lookupRadius(name, true));
        a.a_coord = abc.x;
        a.b_coord = abc.y;
        a.c_coord = abc.z;
        cell->atoms.push_back(a);
        cell->numAtoms++;
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl $0x0, 0x110(%rax)
movq -0x10(%rbp), %rdi
callq 0xaf3f0
movl %eax, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xa3fe8
movq -0x10(%rbp), %rdi
movslq -0x18(%rbp), %rsi
callq 0xaf120
movq %rax, %rdi
callq 0xae590
movl %eax, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xa3fd8
movb $0x0, -0x21(%rbp)
movb $0x0, -0x22(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x18(%rbp), %rsi
callq 0xaf120
movq %rax, %rdi
addq $0x48, %rdi
callq 0x10090
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x18(%rbp), %rsi
callq 0xaf120
movq %rax, %rdi
addq $0x60, %rdi
callq 0x10090
movl %eax, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %ecx
xorl %eax, %eax
cmpl -0x28(%rbp), %ecx
movb %al, -0x1e1(%rbp)
jge 0xa3c0d
movb -0x21(%rbp), %al
xorb $-0x1, %al
movb %al, -0x1e1(%rbp)
movb -0x1e1(%rbp), %al
testb $0x1, %al
jne 0xa3c19
jmp 0xa3c5d
movl -0x20(%rbp), %eax
movl %eax, -0x1e8(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x18(%rbp), %rsi
callq 0xaf120
movq %rax, %rdi
addq $0x48, %rdi
movslq -0x30(%rbp), %rsi
callq 0x101d0
movq %rax, %rcx
movl -0x1e8(%rbp), %eax
cmpl (%rcx), %eax
sete %al
andb $0x1, %al
movb %al, -0x21(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xa3bf2
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %ecx
xorl %eax, %eax
cmpl -0x2c(%rbp), %ecx
movb %al, -0x1e9(%rbp)
jge 0xa3c8d
xorl %eax, %eax
testb $0x1, -0x22(%rbp)
movb %al, -0x1e9(%rbp)
jne 0xa3c8d
movb -0x21(%rbp), %al
xorb $-0x1, %al
movb %al, -0x1e9(%rbp)
movb -0x1e9(%rbp), %al
testb $0x1, %al
jne 0xa3c99
jmp 0xa3cdd
movl -0x20(%rbp), %eax
movl %eax, -0x1f0(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x18(%rbp), %rsi
callq 0xaf120
movq %rax, %rdi
addq $0x60, %rdi
movslq -0x34(%rbp), %rsi
callq 0x101d0
movq %rax, %rcx
movl -0x1f0(%rbp), %eax
cmpl (%rcx), %eax
sete %al
andb $0x1, %al
movb %al, -0x22(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xa3c64
testb $0x1, -0x21(%rbp)
jne 0xa3fc8
testb $0x1, -0x22(%rbp)
jne 0xa3fc8
movq -0x10(%rbp), %rdi
movslq -0x18(%rbp), %rsi
callq 0xaf120
movq %rax, %rdi
movslq -0x20(%rbp), %rsi
callq 0xae5c0
movq 0x10(%rax), %rcx
movq %rcx, -0x40(%rbp)
movups (%rax), %xmm0
movaps %xmm0, -0x50(%rbp)
movq -0x8(%rbp), %rsi
leaq -0x80(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x95a40
movq -0x70(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x10(%rax)
movups -0x80(%rbp), %xmm0
movups %xmm0, (%rax)
leaq -0x68(%rbp), %rdi
callq 0xe9320
movq -0x10(%rbp), %rdi
movslq -0x18(%rbp), %rsi
callq 0xaf120
movq %rax, %rdi
addq $0x18, %rdi
movslq -0x20(%rbp), %rsi
callq 0xaf450
movq %rax, %rsi
leaq -0xa0(%rbp), %rdi
callq 0x5220
movq -0x10(%rbp), %rdi
movslq -0x18(%rbp), %rsi
callq 0xaf120
movq %rax, -0x1f8(%rbp)
jmp 0xa3d87
movq -0x1f8(%rbp), %rdi
addq $0x30, %rdi
movslq -0x20(%rbp), %rsi
callq 0xaf450
movq %rax, -0x200(%rbp)
jmp 0xa3da4
movq -0x200(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
callq 0x5220
jmp 0xa3db9
movq -0x40(%rbp), %rax
movq %rax, -0x170(%rbp)
movaps -0x50(%rbp), %xmm0
movaps %xmm0, -0x180(%rbp)
leaq -0x1a0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x5220
jmp 0xa3de4
leaq -0x1c0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x5220
jmp 0xa3df9
leaq -0x1e0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x5220
jmp 0xa3e0e
leaq -0x1e0(%rbp), %rdi
movl $0x1, %esi
callq 0x466e0
movsd %xmm0, -0x208(%rbp)
jmp 0xa3e29
movsd -0x208(%rbp), %xmm0
movq -0x170(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x10(%rax)
movaps -0x180(%rbp), %xmm1
movups %xmm1, (%rax)
leaq -0x168(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
leaq -0x1c0(%rbp), %rdx
callq 0x95640
jmp 0xa3e65
leaq -0x1e0(%rbp), %rdi
callq 0x5300
leaq -0x1c0(%rbp), %rdi
callq 0x5300
leaq -0x1a0(%rbp), %rdi
callq 0x5300
movsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x150(%rbp)
movsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x148(%rbp)
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x140(%rbp)
movq -0x8(%rbp), %rdi
addq $0x2f0, %rdi            # imm = 0x2F0
leaq -0x168(%rbp), %rsi
callq 0xf190
jmp 0xa3ec9
movq -0x8(%rbp), %rax
movl 0x110(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x110(%rax)
leaq -0x168(%rbp), %rdi
callq 0xf200
leaq -0xc0(%rbp), %rdi
callq 0x5300
leaq -0xa0(%rbp), %rdi
callq 0x5300
jmp 0xa3fc8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0xa3fba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0xa3fae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0xa3f82
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0xa3f76
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x5300
leaq -0x1c0(%rbp), %rdi
callq 0x5300
leaq -0x1a0(%rbp), %rdi
callq 0x5300
jmp 0xa3fae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0x168(%rbp), %rdi
callq 0xf200
leaq -0xc0(%rbp), %rdi
callq 0x5300
leaq -0xa0(%rbp), %rdi
callq 0x5300
jmp 0xa3ff1
jmp 0xa3fca
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xa3b9f
jmp 0xa3fda
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xa3b74
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
movq -0xc8(%rbp), %rdi
callq 0x58f0
nopl (%rax)