// File: /workspace/github_cpp_makefile_star2_O1/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 $0x78, %rsp
movq %rcx, 0x58(%rsp)
movl %edx, 0x1c(%rsp)
movq 0x140(%rdi), %rcx
movq 0x138(%rdi), %rax
subq %rax, %rcx
je 0x8e726
movq %rsi, %r14
movq %rdi, %r15
sarq $0x3, %rcx
movabsq $-0x79435e50d79435e5, %rdx # imm = 0x86BCA1AF286BCA1B
imulq %rdx, %rcx
movq %rcx, %xmm0
punpckldq 0xc4db3(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xc4dbb(%rip), %xmm0    # 0x1532b0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x40(%rdi), %xmm0
movsd 0x90(%rdi), %xmm2
divsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
divsd %xmm1, %xmm2
movsd %xmm2, 0x48(%rsp)
leaq 0x48(%rdi), %rcx
movq %rcx, 0x40(%rsp)
leaq 0x308(%rsi), %rcx
movq %rcx, 0x38(%rsp)
movl $0x1, %ebx
xorl %ecx, %ecx
leaq 0x20(%rsp), %rbp
leaq 0x60(%rsp), %r13
imulq $0x98, %rcx, %r12
leaq (%rax,%r12), %rdi
addq $0x40, %rdi
movsd 0x50(%rsp), %xmm0
movsd %xmm0, -0x8(%rdi)
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x48(%rdi)
movsd (%r15), %xmm0
movsd %xmm0, -0x10(%rdi)
movq 0x40(%rsp), %rsi
callq 0x4240
movl 0x88(%r15), %eax
movq 0x138(%r15), %rcx
movl %eax, 0x80(%rcx,%r12)
movsd (%rcx,%r12), %xmm0
movsd 0x8(%rcx,%r12), %xmm1
movsd 0x10(%rcx,%r12), %xmm2
movq %rbp, %rdi
callq 0x85436
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x53e0c
movq %rbp, %rdi
xorl %esi, %esi
callq 0x85478
movsd (%rax), %xmm0
movq 0x138(%r15), %rax
movsd %xmm0, (%rax,%r12)
movq %rbp, %rdi
movl $0x1, %esi
callq 0x85478
movsd (%rax), %xmm0
movq 0x138(%r15), %rax
movsd %xmm0, 0x8(%rax,%r12)
movq %rbp, %rdi
movl $0x2, %esi
callq 0x85478
movsd (%rax), %xmm0
movq 0x138(%r15), %rax
movsd %xmm0, 0x10(%rax,%r12)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x52082
movq 0x70(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x60(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movq %rbp, %rdi
xorl %esi, %esi
callq 0x85478
movsd (%rax), %xmm0
movq 0x138(%r15), %rax
movsd %xmm0, 0x18(%rax,%r12)
movq %rbp, %rdi
movl $0x1, %esi
callq 0x85478
movsd (%rax), %xmm0
movq 0x138(%r15), %rax
movsd %xmm0, 0x20(%rax,%r12)
movq %rbp, %rdi
movl $0x2, %esi
callq 0x85478
movsd (%rax), %xmm0
movq 0x138(%r15), %rax
leaq (%rax,%r12), %rsi
movsd %xmm0, 0x28(%rax,%r12)
movq 0x58(%rsp), %rdi
callq 0xe936
movq 0x310(%r14), %rsi
cmpq 0x318(%r14), %rsi
je 0x8e6e7
movl 0x1c(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x310(%r14)
jmp 0x8e6f6
movq 0x38(%rsp), %rdi
leaq 0x1c(%rsp), %rdx
callq 0xf7b4
movl %ebx, %ecx
movq 0x138(%r15), %rax
movq 0x140(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x79435e50d79435e5, %rsi # imm = 0x86BCA1AF286BCA1B
imulq %rsi, %rdx
incl %ebx
cmpq %rcx, %rdx
ja 0x8e548
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop