// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/sphere_approx.cc
// Function: AtomCluster::replaceAtomByCluster(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, double)
void AtomCluster::replaceAtomByCluster(string cluster_type, double large_atom_radius){
	double shift = large_atom_radius - smallSphereRadius;

//Type: OCC: Octahedron + cube (15 spheres)
        if (cluster_type == "OCC"){
                for (int i = 0; i<15; i++){
                        atom_vector.push_back(center);
                }
                translate_cube(shift, 0);
                plusMinus_axes(shift, 8);
        }

//Type: FCC = 4 cubes (33 spheres) 
	if (cluster_type == "FCC" || cluster_type == "ACC"){

		//fills vector with spheres positioned at origin
		for (int i = 0; i<32; i++){
			atom_vector.push_back(center);
		}

		//Translate cube vertices for all 4 cubes
		translate_cube(shift, 0);
		rotate_xy_cube(shift, 8);
		rotate_xz_cube(shift, 16);
		rotate_yz_cube(shift, 24);

//Type: ACC = 4 cubes w/ axis spheres (39 spheres)
		if (cluster_type == "ACC"){
			vector <ATOM> axes;
			for (int i = 0; i<6; i++){
				atom_vector.push_back(center);
			}
			plusMinus_axes(shift, 32);
		}
		atom_vector.push_back(center);
	}

//Type: AQC = Axes, quadrants, cube (27 spheres)
//	Spheres along +- axes, 45 degrees from xy, xz, yz axes,
//	and cube with edges aligned to axes 
	else if (cluster_type == "AQC"){
		for (int i = 0; i<27; i++){
			atom_vector.push_back(center);
		}
		translate_axes(shift, 0);
		translate_cube(shift, 18);
	}

//Type: DDH = Dodecahedron (21 spheres); pentagonal faces
	else if (cluster_type == "DDH" || cluster_type == "TIH"){
		for (int i = 0; i<20; i++){
			atom_vector.push_back(center);
		}
		translate_dodecahedron(shift, 0);
//Type: TIH = Truncated icosahedron (33 spheres)
//	dodecahedron w/ center of faces filled w/ spheres
		if (cluster_type == "TIH"){
			vector <ATOM> ico;
			for (int i = 0; i<12; i++){
				atom_vector.push_back(center);
			}
			rotate_icosahedron(shift, 20);
		}
		atom_vector.push_back(center);
	}

//Type: ICH = Icosidodecahedron (31 spheres)
// Quasiregular polyhedron. pentagonal/triangular faces
	else if (cluster_type == "ICH" || cluster_type == "ICC"){
		for (int i = 0; i<30; i++){
			atom_vector.push_back(center);
		}
		translate_icosidodecahedron(shift, 0);
//Type: ICC = Icosidodecahedron w/ center face spheres (43 spheres)
		if (cluster_type == "ICC"){
	//		vector <ATOM> center_spheres;
		//	for (int i = 0; i<atom_vector.size(); i++){
		//		center_spheres.push_back(atom_vector.at(i));
		//	}
			calc_centerSpheres(shift, 0);
		}
		atom_vector.push_back(center);
	}

//Type: RIH = Rhombicosidodecahedron (61 spheres)
// Semiregular polyhedron. Square, pentagonal, triangular faces
	else if (cluster_type == "RIH"){
		for (int i = 0; i<61; i++){
			atom_vector.push_back(center);
		}

		translate_rhombi(shift, 0);
	}
//Type: S4 = 4 spheres in a spiral
        else if (cluster_type == "S4"){
                sphere_spiral(4, shift);
        }
//Type: S10 = 10 spheres in a spiral
        else if (cluster_type == "S10"){
                sphere_spiral(10, shift);
        }
//Type: S20 = 20 spheres in a spiral
        else if (cluster_type == "S20"){
                sphere_spiral(20, shift);
        }
//Type: S30 = 30 spheres in a spiral
        else if (cluster_type == "S30"){
                sphere_spiral(30, shift);
        }
//Type: S40 = 40 spheres in a spiral
        else if (cluster_type == "S40"){
                sphere_spiral(40, shift);
        }
//Type: S50 = 50 spheres in a spiral
        else if (cluster_type == "S50"){
                sphere_spiral(50, shift);
        }
//Type: S100 = 100 spheres in a spiral
        else if (cluster_type == "S100"){
                sphere_spiral(100, shift);
        }
//Type: S500 = 500 spheres in a spiral
        else if (cluster_type == "S500"){
                sphere_spiral(500, shift);
        }
//Type: S1000 = 1000 spheres in a spiral
        else if (cluster_type == "S1000"){
                sphere_spiral(1000, shift);
        }
//Type: S1000 = 1000 spheres in a spiral
        else if (cluster_type == "S10000"){
                sphere_spiral(10000, shift);
        }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
movq %rdi, %rbx
subsd (%rdi), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x99d43(%rip), %rsi     # 0x104c88
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6af95
leaq 0x138(%rbx), %r15
leaq 0xa0(%rbx), %r12
pushq $0xf
popq %rbp
subl $0x1, %ebp
jb 0x6af74
movq %r15, %rdi
movq %r12, %rsi
callq 0xa7d8
jmp 0x6af62
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
xorl %esi, %esi
callq 0x6b3f0
pushq $0x8
popq %rsi
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x6b406
leaq 0x99cf0(%rip), %rsi     # 0x104c8c
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
jne 0x6afbf
leaq 0x99ce1(%rip), %rsi     # 0x104c90
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6b090
leaq 0x138(%rbx), %r15
leaq 0xa0(%rbx), %r12
pushq $0x20
popq %rbp
subl $0x1, %ebp
jb 0x6afe2
movq %r15, %rdi
movq %r12, %rsi
callq 0xa7d8
jmp 0x6afd0
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
xorl %esi, %esi
callq 0x6b3f0
pushq $0x8
popq %rsi
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x6b858
pushq $0x10
popq %rsi
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x6b8ae
pushq $0x18
popq %rsi
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x6b904
leaq 0x99c64(%rip), %rsi     # 0x104c90
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6b078
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
pushq $0x6
popq %rbp
subl $0x1, %ebp
jb 0x6b05d
movq %r15, %rdi
movq %r12, %rsi
callq 0xa7d8
jmp 0x6b04b
pushq $0x20
popq %rsi
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x6b406
leaq 0x10(%rsp), %rdi
callq 0xb110
movq %r15, %rdi
movq %r12, %rsi
callq 0xa7d8
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x99bfd(%rip), %rsi     # 0x104c94
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6b0c6
leaq 0x138(%rbx), %r14
leaq 0xa0(%rbx), %r15
pushq $0x1b
popq %rbp
subl $0x1, %ebp
jb 0x6b113
movq %r14, %rdi
movq %r15, %rsi
callq 0xa7d8
jmp 0x6b0b4
leaq 0x99bcb(%rip), %rsi     # 0x104c98
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
jne 0x6b0f0
leaq 0x99bbc(%rip), %rsi     # 0x104c9c
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6b1a2
leaq 0x138(%rbx), %r15
leaq 0xa0(%rbx), %r12
pushq $0x14
popq %rbp
subl $0x1, %ebp
jb 0x6b140
movq %r15, %rdi
movq %r12, %rsi
callq 0xa7d8
jmp 0x6b101
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
xorl %esi, %esi
callq 0x6b956
pushq $0x12
popq %rsi
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x6b3f0
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
xorl %esi, %esi
callq 0x6b9b8
leaq 0x99b45(%rip), %rsi     # 0x104c9c
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6b078
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
pushq $0xc
popq %rbp
subl $0x1, %ebp
jb 0x6b18c
movq %r15, %rdi
movq %r12, %rsi
callq 0xa7d8
jmp 0x6b17a
pushq $0x14
popq %rsi
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x6ba4c
jmp 0x6b06e
leaq 0x99af7(%rip), %rsi     # 0x104ca0
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
jne 0x6b1c8
leaq 0x99ae8(%rip), %rsi     # 0x104ca4
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6b235
leaq 0x138(%rbx), %r15
leaq 0xa0(%rbx), %r12
pushq $0x1e
popq %rbp
subl $0x1, %ebp
jb 0x6b1eb
movq %r15, %rdi
movq %r12, %rsi
callq 0xa7d8
jmp 0x6b1d9
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
xorl %esi, %esi
callq 0x6bac0
leaq 0x99aa2(%rip), %rsi     # 0x104ca4
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6b21e
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
xorl %esi, %esi
callq 0x6bb7c
movq %r15, %rdi
movq %r12, %rsi
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xa7d8
leaq 0x99a6c(%rip), %rsi     # 0x104ca8
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6b26b
leaq 0x138(%rbx), %r14
leaq 0xa0(%rbx), %r15
pushq $0x3d
popq %rbp
subl $0x1, %ebp
jb 0x6b28b
movq %r14, %rdi
movq %r15, %rsi
callq 0xa7d8
jmp 0x6b259
leaq 0x99a3a(%rip), %rsi     # 0x104cac
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6b2a7
movsd 0x95322(%rip), %xmm0    # 0x1005a8
jmp 0x6b3ba
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
xorl %esi, %esi
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x6c342
leaq 0x99a01(%rip), %rsi     # 0x104caf
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6b2c7
movsd 0x95f2e(%rip), %xmm0    # 0x1011f0
jmp 0x6b3ba
leaq 0x999e5(%rip), %rsi     # 0x104cb3
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6b2e7
movsd 0x95f1e(%rip), %xmm0    # 0x101200
jmp 0x6b3ba
leaq 0x999c9(%rip), %rsi     # 0x104cb7
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6b307
movsd 0x99906(%rip), %xmm0    # 0x104c08
jmp 0x6b3ba
leaq 0x999ad(%rip), %rsi     # 0x104cbb
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6b327
movsd 0x998de(%rip), %xmm0    # 0x104c00
jmp 0x6b3ba
leaq 0x99991(%rip), %rsi     # 0x104cbf
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6b344
movsd 0x998b6(%rip), %xmm0    # 0x104bf8
jmp 0x6b3ba
leaq 0x99978(%rip), %rsi     # 0x104cc3
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6b361
movsd 0x90ce1(%rip), %xmm0    # 0xfc040
jmp 0x6b3ba
leaq 0x99960(%rip), %rsi     # 0x104cc8
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6b37e
movsd 0x98864(%rip), %xmm0    # 0x103be0
jmp 0x6b3ba
leaq 0x99948(%rip), %rsi     # 0x104ccd
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6b39b
movsd 0x96377(%rip), %xmm0    # 0x101710
jmp 0x6b3ba
leaq 0x99931(%rip), %rsi     # 0x104cd3
movq %r14, %rdi
callq 0x36bf4
testb %al, %al
je 0x6b083
movsd 0x951e6(%rip), %xmm0    # 0x1005a0
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm1
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x6c490
jmp 0x6b3da
jmp 0x6b3da
jmp 0x6b3da
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xb110
movq %rbx, %rdi
callq 0x4780
nop