// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/sphere_approx.cc
// Function: AtomCluster::copyReplacementAtoms(ATOM_NETWORK*, int, std::vector<ATOM, std::allocator<ATOM>>*)
void AtomCluster::copyReplacementAtoms(ATOM_NETWORK *atmnet, int atomID, std::vector <ATOM> *newatoms){

 double newMass = orgAtom.mass/((double) atom_vector.size());
 double newCharge = orgAtom.charge/((double) atom_vector.size());

 for(unsigned int i = 0; i < atom_vector.size(); i++)
    {
    atom_vector[i].mass = newMass;
    atom_vector[i].charge = newCharge;
    atom_vector[i].radius = smallSphereRadius;
    atom_vector[i].type = orgAtom.type;
    atom_vector[i].specialID = orgAtom.specialID;

    Point pt(atom_vector[i].x, atom_vector[i].y, atom_vector[i].z);

    atmnet->shiftXYZInUC(pt);
    atom_vector[i].x = pt[0];
    atom_vector[i].y = pt[1];
    atom_vector[i].z = pt[2];

    pt = atmnet->xyz_to_abc(pt);
    atom_vector[i].a_coord = pt[0];
    atom_vector[i].b_coord = pt[1];
    atom_vector[i].c_coord = pt[2];

    newatoms->push_back(atom_vector[i]);
    atmnet->IDmapping.push_back(atomID);
    };


}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rcx, 0x68(%rsp)
movq %rdi, %r15
leaq 0x1c(%rsp), %rax
movl %edx, (%rax)
movq 0x140(%rdi), %rcx
movq 0x138(%rdi), %r8
movq %rcx, %rax
subq %r8, %rax
movl $0x98, %edi
cqto
idivq %rdi
movq %rax, %xmm0
punpckldq 0x98879(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x98881(%rip), %xmm0    # 0x103580
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x40(%r15), %xmm0
movsd 0x90(%r15), %xmm2
divsd %xmm1, %xmm0
movsd %xmm0, 0x60(%rsp)
divsd %xmm1, %xmm2
movsd %xmm2, 0x58(%rsp)
leaq 0x48(%r15), %rax
movq %rax, 0x50(%rsp)
movq %rsi, 0x40(%rsp)
leaq 0x308(%rsi), %rax
movq %rax, 0x48(%rsp)
xorl %eax, %eax
movq 0x40(%rsp), %r12
pushq $0x2
popq %rbp
movl %eax, %ebx
subq %r8, %rcx
movq %rcx, %rax
cqto
movl $0x98, %ecx
idivq %rcx
cmpq %rbx, %rax
jbe 0x6af10
imulq $0x98, %rbx, %r13
leaq (%r8,%r13), %rdi
addq $0x40, %rdi
movsd 0x60(%rsp), %xmm0
movsd %xmm0, -0x8(%rdi)
movsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x48(%rdi)
movsd (%r15), %xmm0
movsd %xmm0, -0x10(%rdi)
movq 0x50(%rsp), %rsi
callq 0x4270
movl 0x88(%r15), %eax
movq 0x138(%r15), %rcx
movl %eax, 0x80(%rcx,%r13)
movsd (%rcx,%r13), %xmm0
movsd 0x8(%rcx,%r13), %xmm1
movsd 0x10(%rcx,%r13), %xmm2
leaq 0x20(%rsp), %rdi
movq %rdi, %r14
callq 0x63c46
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x70(%rsp), %rdi
movq %r12, %rsi
callq 0x3f9c2
movq %r14, %rdi
xorl %esi, %esi
callq 0x63c78
movsd (%rax), %xmm0
movq 0x138(%r15), %rax
movsd %xmm0, (%rax,%r13)
movq %r14, %rdi
pushq $0x1
popq %rsi
callq 0x63c78
movsd (%rax), %xmm0
movq 0x138(%r15), %rax
movsd %xmm0, 0x8(%rax,%r13)
movq %r14, %rdi
movl %ebp, %esi
callq 0x63c78
movsd (%rax), %xmm0
movq 0x138(%r15), %rax
movsd %xmm0, 0x10(%rax,%r13)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x70(%rsp), %rdi
movq %r12, %rsi
callq 0x3e4c8
movq 0x80(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x70(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x63c78
movsd (%rax), %xmm0
movq 0x138(%r15), %rax
movsd %xmm0, 0x18(%rax,%r13)
movq %r14, %rdi
pushq $0x1
popq %rsi
callq 0x63c78
movsd (%rax), %xmm0
movq 0x138(%r15), %rax
movsd %xmm0, 0x20(%rax,%r13)
movq %r14, %rdi
movl %ebp, %esi
callq 0x63c78
movsd (%rax), %xmm0
movq 0x138(%r15), %rax
leaq (%rax,%r13), %rsi
movsd %xmm0, 0x28(%rax,%r13)
movq 0x68(%rsp), %rdi
callq 0xa7d8
movq 0x48(%rsp), %rdi
leaq 0x1c(%rsp), %rsi
callq 0x9434
leal 0x1(%rbx), %eax
movq 0x138(%r15), %r8
movq 0x140(%r15), %rcx
jmp 0x6ad52
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq