// File: 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
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
movsd 0x40(%rdi), %xmm0
movsd %xmm0, -0xf8(%rbp)
addq $0x138, %rdi            # imm = 0x138
movq %rdi, -0xf0(%rbp)
callq 0xf060
movsd -0xf8(%rbp), %xmm0
movq -0xf0(%rbp), %rdi
movq %rax, %rcx
movq -0xe8(%rbp), %rax
movq %rcx, %xmm1
movaps 0xfe596(%rip), %xmm2    # 0x1f6360
movaps %xmm2, -0xe0(%rbp)
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0xfe593(%rip), %xmm2    # 0x1f6370
movaps %xmm2, -0xd0(%rbp)
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd 0x90(%rax), %xmm0
movsd %xmm0, -0xb8(%rbp)
callq 0xf060
movaps -0xe0(%rbp), %xmm3
movaps -0xd0(%rbp), %xmm2
movsd -0xb8(%rbp), %xmm0
movq %rax, %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0xe8(%rbp), %rdi
movl -0x34(%rbp), %eax
movq %rax, -0x100(%rbp)
addq $0x138, %rdi            # imm = 0x138
callq 0xf060
movq %rax, %rcx
movq -0x100(%rbp), %rax
cmpq %rcx, %rax
jae 0xf827e
movq -0xe8(%rbp), %rdi
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x170(%rbp)
addq $0x138, %rdi            # imm = 0x138
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0xfcc0
movsd -0x170(%rbp), %xmm0
movq -0xe8(%rbp), %rdi
movsd %xmm0, 0x38(%rax)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x168(%rbp)
addq $0x138, %rdi            # imm = 0x138
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0xfcc0
movsd -0x168(%rbp), %xmm0
movq -0xe8(%rbp), %rdi
movsd %xmm0, 0x88(%rax)
movsd (%rdi), %xmm0
movsd %xmm0, -0x160(%rbp)
addq $0x138, %rdi            # imm = 0x138
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0xfcc0
movsd -0x160(%rbp), %xmm0
movq -0xe8(%rbp), %rdi
movsd %xmm0, 0x30(%rax)
movq %rdi, %rax
addq $0x8, %rax
addq $0x40, %rax
movq %rax, -0x158(%rbp)
addq $0x138, %rdi            # imm = 0x138
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0xfcc0
movq -0x158(%rbp), %rsi
movq %rax, %rdi
addq $0x40, %rdi
callq 0x5060
movq -0xe8(%rbp), %rdi
movl 0x88(%rdi), %eax
movl %eax, -0x14c(%rbp)
addq $0x138, %rdi            # imm = 0x138
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0xfcc0
movl -0x14c(%rbp), %ecx
movq -0xe8(%rbp), %rdi
movl %ecx, 0x80(%rax)
addq $0x138, %rdi            # imm = 0x138
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0xfcc0
movq -0xe8(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x148(%rbp)
addq $0x138, %rdi            # imm = 0x138
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0xfcc0
movq -0xe8(%rbp), %rdi
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x140(%rbp)
addq $0x138, %rdi            # imm = 0x138
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0xfcc0
movsd -0x148(%rbp), %xmm0
movsd -0x140(%rbp), %xmm1
movsd 0x10(%rax), %xmm2
leaq -0x50(%rbp), %rdi
callq 0xe9c70
movq -0x10(%rbp), %rsi
movq -0x50(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x68(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x97f20
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0xe9d70
movq -0xe8(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x138(%rbp)
addq $0x138, %rdi            # imm = 0x138
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0xfcc0
movsd -0x138(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq -0x50(%rbp), %rdi
movl $0x1, %esi
callq 0xe9d70
movq -0xe8(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x130(%rbp)
addq $0x138, %rdi            # imm = 0x138
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0xfcc0
movsd -0x130(%rbp), %xmm0
movsd %xmm0, 0x8(%rax)
leaq -0x50(%rbp), %rdi
movl $0x2, %esi
callq 0xe9d70
movq -0xe8(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x128(%rbp)
addq $0x138, %rdi            # imm = 0x138
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0xfcc0
movsd -0x128(%rbp), %xmm0
movsd %xmm0, 0x10(%rax)
movq -0x10(%rbp), %rsi
movq -0x50(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xb0(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x96150
movq -0x98(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0xe9d70
movq -0xe8(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x120(%rbp)
addq $0x138, %rdi            # imm = 0x138
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0xfcc0
movsd -0x120(%rbp), %xmm0
movsd %xmm0, 0x18(%rax)
leaq -0x50(%rbp), %rdi
movl $0x1, %esi
callq 0xe9d70
movq -0xe8(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x118(%rbp)
addq $0x138, %rdi            # imm = 0x138
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0xfcc0
movsd -0x118(%rbp), %xmm0
movsd %xmm0, 0x20(%rax)
leaq -0x50(%rbp), %rdi
movl $0x2, %esi
callq 0xe9d70
movq -0xe8(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x110(%rbp)
addq $0x138, %rdi            # imm = 0x138
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0xfcc0
movsd -0x110(%rbp), %xmm0
movq -0xe8(%rbp), %rdi
movsd %xmm0, 0x28(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x108(%rbp)
addq $0x138, %rdi            # imm = 0x138
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0xfcc0
movq -0x108(%rbp), %rdi
movq %rax, %rsi
callq 0xf190
movq -0x10(%rbp), %rdi
addq $0x308, %rdi            # imm = 0x308
leaq -0x14(%rbp), %rsi
callq 0xd1b0
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xf7e4f
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
nopw (%rax,%rax)