//////////////////////////////////////////////////////////////////////////
////This is the code implementation for GPU Premier League Round 2: n-body simulation
//////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <fstream>
#include <vector>
#include <chrono>
#include <cuda_runtime.h>

using namespace std;

//////////////////////////////////////////////////////////////////////////
////TODO 0: Please replace the following strings with your team name and author names
////Note: Please do not use space in the string, use "_" instead
//////////////////////////////////////////////////////////////////////////

namespace name
{
	std::string team="Slim_Shaders";
	std::string author_1="TEST";
	std::string author_2="DO NOT SUBMIT";
	std::string author_3="Name_3";	////optional
};

//////////////////////////////////////////////////////////////////////////
////Here is a sample function implemented on CPU for n-body simulation.

__host__ void N_Body_Simulation_CPU_Poorman(double* pos_x,double* pos_y,double* pos_z,		////position array
											double* vel_x,double* vel_y,double* vel_z,		////velocity array
											double* acl_x,double* acl_y,double* acl_z,		////acceleration array
											const double* mass,								////mass array
											const int n,									////number of particles
											const double dt,								////timestep
											const double epsilon_squared)					////epsilon to avoid 0-denominator
{		
	////Step 1: set particle accelerations to be zero
	memset(acl_x,0x00,sizeof(double)*n);
	memset(acl_y,0x00,sizeof(double)*n);
	memset(acl_z,0x00,sizeof(double)*n);

	////Step 2: traverse all particle pairs and accumulate gravitational forces for each particle from pairwise interactions
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			////skip calculating force for itself
			if(i==j) continue;

			////r_ij=x_j-x_i
			double rx=pos_x[j]-pos_x[i];
			double ry=pos_y[j]-pos_y[i];
			double rz=pos_z[j]-pos_z[i];

			////a_ij=m_j*r_ij/(r+epsilon)^3, 
			////noticing that we ignore the gravitational coefficient (assuming G=1)
			double dis_squared=rx*rx+ry*ry+rz*rz;
			double one_over_dis_cube=1.0/pow(sqrt(dis_squared+epsilon_squared),3);
			double ax=mass[j]*rx*one_over_dis_cube;
			double ay=mass[j]*ry*one_over_dis_cube;
			double az=mass[j]*rz*one_over_dis_cube;

			////accumulate the force to the particle
			acl_x[i]+=ax;
			acl_y[i]+=ay;
			acl_z[i]+=az;
		}
	}

	////Step 3: explicit time integration to update the velocity and position of each particle
	for(int i=0;i<n;i++){
		////v_{t+1}=v_{t}+a_{t}*dt
		vel_x[i]+=acl_x[i]*dt;
		vel_y[i]+=acl_y[i]*dt;
		vel_z[i]+=acl_z[i]*dt;

		////x_{t+1}=x_{t}+v_{t}*dt
		pos_x[i]+=vel_x[i]*dt;
		pos_y[i]+=vel_y[i]*dt;
		pos_z[i]+=vel_z[i]*dt;
	}
}


//////////////////////////////////////////////////////////////////////////
////TODO 1: your GPU variables and functions start here


////Your implementations end here
//////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////
////Test function for n-body simulator
ofstream out;

//////////////////////////////////////////////////////////////////////////
////Please do not change the values below
const double dt=0.001;							////time step
const int time_step_num=10;						////number of time steps
const double epsilon=1e-2;						////epsilon added in the denominator to avoid 0-division when calculating the gravitational force
const double epsilon_squared=epsilon*epsilon;	////epsilon squared

////We use grid_size=4 to help you debug your code, change it to a bigger number (e.g., 16, 32, etc.) to test the performance of your GPU code
const unsigned int grid_size=32;					////assuming particles are initialized on a background grid
const unsigned int particle_n=pow(grid_size,3);	////assuming each grid cell has one particle at the beginning

__host__ void Test_N_Body_Simulation()
{
	////initialize position, velocity, acceleration, and mass
	
	double* pos_x=new double[particle_n];
	double* pos_y=new double[particle_n];
	double* pos_z=new double[particle_n];
	////initialize particle positions as the cell centers on a background grid
	double dx=1.0/(double)grid_size;
	for(unsigned int k=0;k<grid_size;k++){
		for(unsigned int j=0;j<grid_size;j++){
			for(unsigned int i=0;i<grid_size;i++){
                unsigned int index=k*grid_size*grid_size+j*grid_size+i;
				pos_x[index]=dx*(double)i;
				pos_y[index]=dx*(double)j;
				pos_z[index]=dx*(double)k;
			}
		}
	}

	double* vel_x=new double[particle_n];
	memset(vel_x,0x00,particle_n*sizeof(double));
	double* vel_y=new double[particle_n];
	memset(vel_y,0x00,particle_n*sizeof(double));
	double* vel_z=new double[particle_n];
	memset(vel_z,0x00,particle_n*sizeof(double));

	double* acl_x=new double[particle_n];
	memset(acl_x,0x00,particle_n*sizeof(double));
	double* acl_y=new double[particle_n];
	memset(acl_y,0x00,particle_n*sizeof(double));
	double* acl_z=new double[particle_n];
	memset(acl_z,0x00,particle_n*sizeof(double));

	double* mass=new double[particle_n];
	for(int i=0;i<particle_n;i++){
		mass[i]=100.0;
	}


	//////////////////////////////////////////////////////////////////////////
	////Default implementation: n-body simulation on CPU
	////Comment the CPU implementation out when you test large-scale examples
	auto cpu_start=chrono::system_clock::now();
	cout<<"Total number of particles: "<<particle_n<<endl;
	cout<<"Tracking the motion of particle "<<particle_n/2<<endl;
	for(int i=0;i<time_step_num;i++){
		N_Body_Simulation_CPU_Poorman(pos_x,pos_y,pos_z,vel_x,vel_y,vel_z,acl_x,acl_y,acl_z,mass,particle_n,dt,epsilon_squared);
		cout<<"pos on timestep "<<i<<": "<<pos_x[particle_n/2]<<", "<<pos_y[particle_n/2]<<", "<<pos_z[particle_n/2]<<endl;
	}
	auto cpu_end=chrono::system_clock::now();
	chrono::duration<double> cpu_time=cpu_end-cpu_start;
	cout<<"CPU runtime: "<<cpu_time.count()*1000.<<" ms."<<endl;

	//////////////////////////////////////////////////////////////////////////

	//////////////////////////////////////////////////////////////////////////
	////Your implementation: n-body simulator on GPU
	cudaEvent_t start,end;
	cudaEventCreate(&start);
	cudaEventCreate(&end);
	float gpu_time=0.0f;
	cudaDeviceSynchronize();
	cudaEventRecord(start);

	//////////////////////////////////////////////////////////////////////////
	////TODO 2: Your GPU functions are called here
	////Requirement: You need to copy data from the CPU arrays, conduct computations on the GPU, and copy the values back from GPU to CPU
	////The final positions should be stored in the same place as the CPU n-body function, i.e., pos_x, pos_y, pos_z
	////The correctness of your simulation will be evaluated by comparing the results (positions) with the results calculated by the default CPU implementations

	//////////////////////////////////////////////////////////////////////////

	cudaEventRecord(end);
	cudaEventSynchronize(end);
	cudaEventElapsedTime(&gpu_time,start,end);
	printf("\nGPU runtime: %.4f ms\n",gpu_time);
	cudaEventDestroy(start);
	cudaEventDestroy(end);
	//////////////////////////////////////////////////////////////////////////

	out<<"R0: "<<pos_x[particle_n/2]<<" " <<pos_y[particle_n/2]<<" " <<pos_z[particle_n/2]<<endl;
	out<<"T1: "<<gpu_time<<endl;
}

int main()
{
	if(name::team=="Team_X"){
		printf("\nPlease specify your team name and team member names in name::team and name::author to start.\n");
		return 0;
	}

	std::string file_name=name::team+"_competition_2_nbody.dat";
	out.open(file_name.c_str());
	
	if(out.fail()){
		printf("\ncannot open file %s to record results\n",file_name.c_str());
		return 0;
	}

	Test_N_Body_Simulation();

	return 0;
}

	.file	"tmpxft_0022a6e4_00000000-6_cpu_poorman.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4238:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4238:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"basic_string::append"
	.text
	.align 2
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm.isra.0, @function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm.isra.0:
.LFB5019:
	.cfi_startproc
	movabsq	$4611686018427387903, %rax
	subq	8(%rdi), %rax
	cmpq	%rdx, %rax
	jnb	.L3
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	.LC0(%rip), %rdi
	call	_ZSt20__throw_length_errorPKc@PLT
.L3:
	.cfi_def_cfa_offset 8
	jmp	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_appendEPKcm@PLT
	.cfi_endproc
.LFE5019:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm.isra.0, .-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm.isra.0
	.align 2
	.type	_ZNSolsEPFRSoS_E.isra.0, @function
_ZNSolsEPFRSoS_E.isra.0:
.LFB5021:
	.cfi_startproc
	jmp	*%rsi
	.cfi_endproc
.LFE5021:
	.size	_ZNSolsEPFRSoS_E.isra.0, .-_ZNSolsEPFRSoS_E.isra.0
	.globl	_Z29N_Body_Simulation_CPU_PoormanPdS_S_S_S_S_S_S_S_PKdidd
	.type	_Z29N_Body_Simulation_CPU_PoormanPdS_S_S_S_S_S_S_S_PKdidd, @function
_Z29N_Body_Simulation_CPU_PoormanPdS_S_S_S_S_S_S_S_PKdidd:
.LFB4228:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	movaps	%xmm0, %xmm4
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r8, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rcx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movslq	176(%rsp), %r11
	movq	144(%rsp), %rdx
	movsd	%xmm1, 16(%rsp)
	movq	152(%rsp), %rsi
	movq	160(%rsp), %r10
	leaq	0(,%r11,8), %r15
	movq	%rdx, %rdi
	movq	%r15, %rcx
	rep stosb
	movq	%r15, %rcx
	movq	%rsi, %rdi
	rep stosb
	movq	%r15, %rcx
	movq	%r10, %rdi
	xorl	%r15d, %r15d
	rep stosb
.L10:
	movl	%r15d, 12(%rsp)
	cmpl	%r15d, 176(%rsp)
	jle	.L18
	xorl	%ecx, %ecx
.L12:
	cmpl	%ecx, 12(%rsp)
	je	.L11
	movsd	(%rbx,%rcx,8), %xmm3
	movsd	0(%rbp,%rcx,8), %xmm2
	movq	%r10, 160(%rsp)
	subsd	(%rbx,%r15,8), %xmm3
	subsd	0(%rbp,%r15,8), %xmm2
	movq	%rsi, 152(%rsp)
	movsd	(%r12,%rcx,8), %xmm5
	subsd	(%r12,%r15,8), %xmm5
	movq	%r9, 64(%rsp)
	movq	%rdx, 144(%rsp)
	movaps	%xmm3, %xmm0
	movaps	%xmm2, %xmm1
	movq	%r11, 56(%rsp)
	mulsd	%xmm2, %xmm1
	movq	%rcx, 48(%rsp)
	mulsd	%xmm3, %xmm0
	movsd	%xmm4, 72(%rsp)
	movsd	%xmm3, 40(%rsp)
	movsd	%xmm2, 32(%rsp)
	movsd	%xmm5, 24(%rsp)
	addsd	%xmm1, %xmm0
	movaps	%xmm5, %xmm1
	mulsd	%xmm5, %xmm1
	addsd	%xmm1, %xmm0
	addsd	16(%rsp), %xmm0
	call	sqrt@PLT
	movsd	.LC1(%rip), %xmm1
	call	pow@PLT
	movq	48(%rsp), %rcx
	movq	64(%rsp), %r9
	movsd	.LC2(%rip), %xmm1
	movq	168(%rsp), %rax
	movsd	40(%rsp), %xmm3
	movsd	32(%rsp), %xmm2
	divsd	%xmm0, %xmm1
	movsd	(%rax,%rcx,8), %xmm0
	movq	144(%rsp), %rdx
	movsd	24(%rsp), %xmm5
	movq	152(%rsp), %rsi
	mulsd	%xmm0, %xmm3
	movq	160(%rsp), %r10
	movq	56(%rsp), %r11
	mulsd	%xmm0, %xmm2
	movsd	72(%rsp), %xmm4
	mulsd	%xmm5, %xmm0
	mulsd	%xmm1, %xmm3
	addsd	(%rdx,%r15,8), %xmm3
	mulsd	%xmm1, %xmm2
	mulsd	%xmm1, %xmm0
	movsd	%xmm3, (%rdx,%r15,8)
	addsd	(%rsi,%r15,8), %xmm2
	movsd	%xmm2, (%rsi,%r15,8)
	addsd	(%r10,%r15,8), %xmm0
	movsd	%xmm0, (%r10,%r15,8)
.L11:
	incq	%rcx
	cmpq	%rcx, %r11
	jne	.L12
	incq	%r15
	jmp	.L10
.L18:
	xorl	%eax, %eax
.L13:
	cmpl	%eax, 176(%rsp)
	jle	.L19
	movsd	(%rdx,%rax,8), %xmm0
	mulsd	%xmm4, %xmm0
	addsd	0(%r13,%rax,8), %xmm0
	movsd	%xmm0, 0(%r13,%rax,8)
	movsd	(%rsi,%rax,8), %xmm0
	mulsd	%xmm4, %xmm0
	addsd	(%r14,%rax,8), %xmm0
	movsd	%xmm0, (%r14,%rax,8)
	movsd	(%r10,%rax,8), %xmm0
	mulsd	%xmm4, %xmm0
	addsd	(%r9,%rax,8), %xmm0
	movsd	%xmm0, (%r9,%rax,8)
	movsd	0(%r13,%rax,8), %xmm0
	mulsd	%xmm4, %xmm0
	addsd	(%rbx,%rax,8), %xmm0
	movsd	%xmm0, (%rbx,%rax,8)
	movsd	(%r14,%rax,8), %xmm0
	mulsd	%xmm4, %xmm0
	addsd	0(%rbp,%rax,8), %xmm0
	movsd	%xmm0, 0(%rbp,%rax,8)
	movsd	(%r9,%rax,8), %xmm0
	mulsd	%xmm4, %xmm0
	addsd	(%r12,%rax,8), %xmm0
	movsd	%xmm0, (%r12,%rax,8)
	incq	%rax
	jmp	.L13
.L19:
	addq	$88, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4228:
	.size	_Z29N_Body_Simulation_CPU_PoormanPdS_S_S_S_S_S_S_S_PKdidd, .-_Z29N_Body_Simulation_CPU_PoormanPdS_S_S_S_S_S_S_S_PKdidd
	.section	.rodata.str1.1
.LC5:
	.string	"Total number of particles: "
.LC6:
	.string	"Tracking the motion of particle "
.LC9:
	.string	"pos on timestep "
.LC10:
	.string	": "
.LC11:
	.string	", "
.LC13:
	.string	"CPU runtime: "
.LC15:
	.string	" ms."
.LC17:
	.string	"\nGPU runtime: %.4f ms\n"
.LC18:
	.string	"R0: "
.LC19:
	.string	" "
.LC20:
	.string	"T1: "
	.text
	.globl	_Z22Test_N_Body_Simulationv
	.type	_Z22Test_N_Body_Simulationv, @function
_Z22Test_N_Body_Simulationv:
.LFB4230:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$262144, %edi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	call	_Znam@PLT
	movl	$262144, %edi
	movq	%rax, %r12
	call	_Znam@PLT
	movl	$262144, %edi
	movq	%rax, %rbp
	call	_Znam@PLT
	movsd	.LC3(%rip), %xmm1
	xorl	%edx, %edx
	movq	%rax, %rbx
.L21:
	cvtsi2sdl	%edx, %xmm0
	movl	%edx, %edi
	xorl	%ecx, %ecx
	sall	$10, %edi
	mulsd	%xmm1, %xmm0
.L25:
	cvtsi2sdl	%ecx, %xmm2
	movl	%edi, %eax
	xorl	%esi, %esi
	salq	$3, %rax
	mulsd	%xmm1, %xmm2
.L22:
	cvtsi2sdl	%esi, %xmm3
	incl	%esi
	movsd	%xmm2, 0(%rbp,%rax)
	movsd	%xmm0, (%rbx,%rax)
	mulsd	%xmm1, %xmm3
	movsd	%xmm3, (%r12,%rax)
	addq	$8, %rax
	cmpl	$32, %esi
	jne	.L22
	incl	%ecx
	addl	$32, %edi
	cmpl	$32, %ecx
	jne	.L25
	incl	%edx
	cmpl	$32, %edx
	jne	.L21
	movl	$262144, %edi
	xorl	%r14d, %r14d
	call	_Znam@PLT
	movl	$65536, %ecx
	movq	%rax, 32(%rsp)
	movq	%rax, %rdi
	movl	%r14d, %eax
	rep stosl
	movl	$262144, %edi
	call	_Znam@PLT
	movl	$65536, %ecx
	movq	%rax, 40(%rsp)
	movq	%rax, %rdi
	movl	%r14d, %eax
	rep stosl
	movl	$262144, %edi
	call	_Znam@PLT
	movl	$65536, %ecx
	movq	%rax, 48(%rsp)
	movq	%rax, %rdi
	movl	%r14d, %eax
	rep stosl
	movl	$262144, %edi
	call	_Znam@PLT
	movl	$65536, %ecx
	movq	%rax, 56(%rsp)
	movq	%rax, %rdi
	movl	%r14d, %eax
	rep stosl
	movl	$262144, %edi
	call	_Znam@PLT
	movl	$65536, %ecx
	movq	%rax, 64(%rsp)
	movq	%rax, %rdi
	movl	%r14d, %eax
	rep stosl
	movl	$262144, %edi
	call	_Znam@PLT
	movl	$65536, %ecx
	movq	%rax, %rdi
	movq	%rax, %r13
	movl	%r14d, %eax
	rep stosl
	movl	$262144, %edi
	call	_Znam@PLT
	movsd	.LC4(%rip), %xmm0
	movq	%rax, %r15
	xorl	%eax, %eax
.L26:
	movsd	%xmm0, (%r15,%rax,8)
	incq	%rax
	cmpq	$32768, %rax
	jne	.L26
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	leaq	_ZSt4cout(%rip), %r14
	leaq	.LC5(%rip), %rsi
	movq	%r14, %rdi
	movq	%rax, 72(%rsp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	$32768, %esi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	%r14, %rdi
	leaq	.LC6(%rip), %rsi
	xorl	%r14d, %r14d
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	$16384, %esi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L27:
	pushq	%rax
	.cfi_def_cfa_offset 184
	movsd	.LC7(%rip), %xmm1
	movq	%rbx, %rdx
	movq	%rbp, %rsi
	pushq	$32768
	.cfi_def_cfa_offset 192
	movsd	.LC8(%rip), %xmm0
	movq	%r12, %rdi
	pushq	%r15
	.cfi_def_cfa_offset 200
	pushq	%r13
	.cfi_def_cfa_offset 208
	pushq	96(%rsp)
	.cfi_def_cfa_offset 216
	pushq	96(%rsp)
	.cfi_def_cfa_offset 224
	movq	96(%rsp), %r9
	movq	88(%rsp), %r8
	movq	80(%rsp), %rcx
	call	_Z29N_Body_Simulation_CPU_PoormanPdS_S_S_S_S_S_S_S_PKdidd
	addq	$48, %rsp
	.cfi_def_cfa_offset 176
	leaq	.LC9(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r14d, %esi
	incl	%r14d
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC10(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	131072(%r12), %xmm4
	movq	%rax, %rdi
	movaps	%xmm4, %xmm0
	movsd	%xmm4, 8(%rsp)
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	leaq	.LC11(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	131072(%rbp), %xmm5
	movq	%rax, %rdi
	movaps	%xmm5, %xmm0
	movsd	%xmm5, 16(%rsp)
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	leaq	.LC11(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	131072(%rbx), %xmm6
	movq	%rax, %rdi
	movaps	%xmm6, %xmm0
	movsd	%xmm6, 24(%rsp)
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	cmpl	$10, %r14d
	jne	.L27
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	movq	72(%rsp), %rdx
	leaq	.LC13(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	leaq	out(%rip), %rbx
	leaq	.LC19(%rip), %rbp
	subq	%rdx, %rax
	cvtsi2sdq	%rax, %xmm0
	divsd	.LC12(%rip), %xmm0
	movsd	%xmm0, 32(%rsp)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	32(%rsp), %xmm0
	mulsd	.LC14(%rip), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	leaq	.LC15(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	88(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	96(%rsp), %rdi
	call	cudaEventCreate@PLT
	movl	$0x00000000, 84(%rsp)
	call	cudaDeviceSynchronize@PLT
	movq	88(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	96(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	96(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	96(%rsp), %rdx
	movq	88(%rsp), %rsi
	leaq	84(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC17(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	84(%rsp), %xmm0
	call	__printf_chk@PLT
	movq	88(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	96(%rsp), %rdi
	call	cudaEventDestroy@PLT
	leaq	.LC18(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	8(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rbp, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	16(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rbp, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	24(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	.LC20(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cvtss2sd	84(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	addq	$120, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4230:
	.size	_Z22Test_N_Body_Simulationv, .-_Z22Test_N_Body_Simulationv
	.section	.rodata.str1.1
.LC21:
	.string	"Team_X"
.LC22:
	.string	"\nPlease specify your team name and team member names in name::team and name::author to start.\n"
.LC23:
	.string	"_competition_2_nbody.dat"
.LC24:
	.string	"\ncannot open file %s to record results\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB4235:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4235
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movq	8+_ZN4name4teamB5cxx11E(%rip), %rbp
	movq	_ZN4name4teamB5cxx11E(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	cmpq	$6, %rbp
	jne	.L34
	movl	$6, %edx
	leaq	.LC21(%rip), %rsi
	movq	%r12, %rdi
	call	memcmp@PLT
	testl	%eax, %eax
	je	.L35
.L34:
	leaq	24(%rsp), %rax
	leaq	8(%rsp), %rbx
	movb	$0, 24(%rsp)
	movq	%rax, 8(%rsp)
	leaq	24(%rbp), %rsi
	xorl	%eax, %eax
	movq	%rbx, %rdi
	movq	%rax, 16(%rsp)
.LEHB0:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEm@PLT
.LEHE0:
	jmp	.L54
.L35:
	leaq	.LC22(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
.LEHB1:
	call	__printf_chk@PLT
.LEHE1:
	jmp	.L37
.L54:
	movq	%rbp, %rdx
	movq	%r12, %rsi
	movq	%rbx, %rdi
.LEHB2:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm.isra.0
	movl	$24, %edx
	leaq	.LC23(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm.isra.0
.LEHE2:
	jmp	.L55
.L47:
	endbr64
	jmp	.L53
.L55:
	movq	8(%rsp), %rsi
	movl	$16, %edx
	leaq	out(%rip), %rdi
.LEHB3:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	testb	$5, 280+out(%rip)
	je	.L41
	movq	8(%rsp), %rdx
	leaq	.LC24(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L42
.L41:
	call	_Z22Test_N_Body_Simulationv
.LEHE3:
.L42:
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
.L37:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L45
	jmp	.L50
.L46:
	endbr64
.L53:
	movq	%rax, %rbp
.L43:
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L50
	movq	%rbp, %rdi
.LEHB4:
	call	_Unwind_Resume@PLT
.LEHE4:
.L50:
	call	__stack_chk_fail@PLT
.L45:
	addq	$48, %rsp
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4235:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4235:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4235-.LLSDACSB4235
.LLSDACSB4235:
	.uleb128 .LEHB0-.LFB4235
	.uleb128 .LEHE0-.LEHB0
	.uleb128 .L47-.LFB4235
	.uleb128 0
	.uleb128 .LEHB1-.LFB4235
	.uleb128 .LEHE1-.LEHB1
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB2-.LFB4235
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L47-.LFB4235
	.uleb128 0
	.uleb128 .LEHB3-.LFB4235
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L46-.LFB4235
	.uleb128 0
	.uleb128 .LEHB4-.LFB4235
	.uleb128 .LEHE4-.LEHB4
	.uleb128 0
	.uleb128 0
.LLSDACSE4235:
	.section	.text.startup
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4261:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4261:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.str1.1,"aMS",@progbits,1
.LC25:
	.string	"basic_string: construction from null is not valid"
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC5IS3_EEPKcRKS3_,comdat
	.align 2
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, @function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_:
.LFB4605:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	16(%rdi), %rax
	movq	%rax, (%rdi)
	testq	%rsi, %rsi
	jne	.L59
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L64
	leaq	.LC25(%rip), %rdi
	call	_ZSt19__throw_logic_errorPKc@PLT
.L59:
	movq	%rdi, %rbx
	movq	%rsi, %rdi
	movq	%rsi, %rbp
	call	strlen@PLT
	movq	%rax, (%rsp)
	leaq	0(%rbp,%rax), %r12
	cmpq	$15, %rax
	jbe	.L61
	movq	%rsp, %rsi
	xorl	%edx, %edx
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm@PLT
	movq	%rax, (%rbx)
	movq	(%rsp), %rax
	movq	%rax, 16(%rbx)
.L61:
	movq	(%rbx), %rdi
	movq	%r12, %rdx
	movq	%rbp, %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13_S_copy_charsEPcPKcS7_@PLT
	movq	(%rsp), %rax
	movq	(%rbx), %rdx
	movq	%rax, 8(%rbx)
	movb	$0, (%rdx,%rax)
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L62
.L64:
	call	__stack_chk_fail@PLT
.L62:
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4605:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, .-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
	.set	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.section	.rodata.str1.1
.LC26:
	.string	"Slim_Shaders"
.LC27:
	.string	"TEST"
.LC28:
	.string	"DO NOT SUBMIT"
.LC29:
	.string	"Name_3"
	.section	.text.startup
	.type	_GLOBAL__sub_I__ZN4name4teamB5cxx11E, @function
_GLOBAL__sub_I__ZN4name4teamB5cxx11E:
.LFB5014:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	_ZN4name4teamB5cxx11E(%rip), %r12
	leaq	.LC26(%rip), %rsi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	__dso_handle(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	7(%rsp), %rbp
	movq	%rbp, %rdx
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
	movq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev@GOTPCREL(%rip), %rdi
	movq	%r12, %rsi
	movq	%rbx, %rdx
	leaq	_ZN4name8author_1B5cxx11E(%rip), %r12
	call	__cxa_atexit@PLT
	movq	%rbp, %rdx
	movq	%r12, %rdi
	leaq	.LC27(%rip), %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
	movq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev@GOTPCREL(%rip), %rdi
	movq	%r12, %rsi
	movq	%rbx, %rdx
	leaq	_ZN4name8author_2B5cxx11E(%rip), %r12
	call	__cxa_atexit@PLT
	movq	%rbp, %rdx
	leaq	.LC28(%rip), %rsi
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
	movq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev@GOTPCREL(%rip), %rdi
	movq	%rbx, %rdx
	movq	%r12, %rsi
	call	__cxa_atexit@PLT
	movq	%rbp, %rdx
	leaq	_ZN4name8author_3B5cxx11E(%rip), %rbp
	leaq	.LC29(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
	movq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev@GOTPCREL(%rip), %rdi
	movq	%rbp, %rsi
	movq	%rbx, %rdx
	leaq	out(%rip), %rbp
	call	__cxa_atexit@PLT
	movq	%rbp, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L66
	call	__stack_chk_fail@PLT
.L66:
	movq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@GOTPCREL(%rip), %rdi
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	movq	%rbx, %rdx
	movq	%rbp, %rsi
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	jmp	__cxa_atexit@PLT
	.cfi_endproc
.LFE5014:
	.size	_GLOBAL__sub_I__ZN4name4teamB5cxx11E, .-_GLOBAL__sub_I__ZN4name4teamB5cxx11E
	.section	.init_array
	.align 8
	.quad	_GLOBAL__sub_I__ZN4name4teamB5cxx11E
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.globl	out
	.bss
	.align 32
	.type	out, @object
	.size	out, 512
out:
	.zero	512
	.globl	_ZN4name8author_3B5cxx11E
	.align 32
	.type	_ZN4name8author_3B5cxx11E, @object
	.size	_ZN4name8author_3B5cxx11E, 32
_ZN4name8author_3B5cxx11E:
	.zero	32
	.globl	_ZN4name8author_2B5cxx11E
	.align 32
	.type	_ZN4name8author_2B5cxx11E, @object
	.size	_ZN4name8author_2B5cxx11E, 32
_ZN4name8author_2B5cxx11E:
	.zero	32
	.globl	_ZN4name8author_1B5cxx11E
	.align 32
	.type	_ZN4name8author_1B5cxx11E, @object
	.size	_ZN4name8author_1B5cxx11E, 32
_ZN4name8author_1B5cxx11E:
	.zero	32
	.globl	_ZN4name4teamB5cxx11E
	.align 32
	.type	_ZN4name4teamB5cxx11E, @object
	.size	_ZN4name4teamB5cxx11E, 32
_ZN4name4teamB5cxx11E:
	.zero	32
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1074266112
	.align 8
.LC2:
	.long	0
	.long	1072693248
	.align 8
.LC3:
	.long	0
	.long	1067450368
	.align 8
.LC4:
	.long	0
	.long	1079574528
	.align 8
.LC7:
	.long	-350469331
	.long	1058682594
	.align 8
.LC8:
	.long	-755914244
	.long	1062232653
	.align 8
.LC12:
	.long	0
	.long	1104006501
	.align 8
.LC14:
	.long	0
	.long	1083129856
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.hidden	__dso_handle
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

//////////////////////////////////////////////////////////////////////////
////This is the code implementation for GPU Premier League Round 2: n-body simulation
//////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <fstream>
#include <vector>
#include <chrono>
#include <hip/hip_runtime.h>

using namespace std;

//////////////////////////////////////////////////////////////////////////
////TODO 0: Please replace the following strings with your team name and author names
////Note: Please do not use space in the string, use "_" instead
//////////////////////////////////////////////////////////////////////////

namespace name
{
	std::string team="Slim_Shaders";
	std::string author_1="TEST";
	std::string author_2="DO NOT SUBMIT";
	std::string author_3="Name_3";	////optional
};

//////////////////////////////////////////////////////////////////////////
////Here is a sample function implemented on CPU for n-body simulation.

__host__ void N_Body_Simulation_CPU_Poorman(double* pos_x,double* pos_y,double* pos_z,		////position array
											double* vel_x,double* vel_y,double* vel_z,		////velocity array
											double* acl_x,double* acl_y,double* acl_z,		////acceleration array
											const double* mass,								////mass array
											const int n,									////number of particles
											const double dt,								////timestep
											const double epsilon_squared)					////epsilon to avoid 0-denominator
{		
	////Step 1: set particle accelerations to be zero
	memset(acl_x,0x00,sizeof(double)*n);
	memset(acl_y,0x00,sizeof(double)*n);
	memset(acl_z,0x00,sizeof(double)*n);

	////Step 2: traverse all particle pairs and accumulate gravitational forces for each particle from pairwise interactions
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			////skip calculating force for itself
			if(i==j) continue;

			////r_ij=x_j-x_i
			double rx=pos_x[j]-pos_x[i];
			double ry=pos_y[j]-pos_y[i];
			double rz=pos_z[j]-pos_z[i];

			////a_ij=m_j*r_ij/(r+epsilon)^3, 
			////noticing that we ignore the gravitational coefficient (assuming G=1)
			double dis_squared=rx*rx+ry*ry+rz*rz;
			double one_over_dis_cube=1.0/pow(sqrt(dis_squared+epsilon_squared),3);
			double ax=mass[j]*rx*one_over_dis_cube;
			double ay=mass[j]*ry*one_over_dis_cube;
			double az=mass[j]*rz*one_over_dis_cube;

			////accumulate the force to the particle
			acl_x[i]+=ax;
			acl_y[i]+=ay;
			acl_z[i]+=az;
		}
	}

	////Step 3: explicit time integration to update the velocity and position of each particle
	for(int i=0;i<n;i++){
		////v_{t+1}=v_{t}+a_{t}*dt
		vel_x[i]+=acl_x[i]*dt;
		vel_y[i]+=acl_y[i]*dt;
		vel_z[i]+=acl_z[i]*dt;

		////x_{t+1}=x_{t}+v_{t}*dt
		pos_x[i]+=vel_x[i]*dt;
		pos_y[i]+=vel_y[i]*dt;
		pos_z[i]+=vel_z[i]*dt;
	}
}


//////////////////////////////////////////////////////////////////////////
////TODO 1: your GPU variables and functions start here


////Your implementations end here
//////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////
////Test function for n-body simulator
ofstream out;

//////////////////////////////////////////////////////////////////////////
////Please do not change the values below
const double dt=0.001;							////time step
const int time_step_num=10;						////number of time steps
const double epsilon=1e-2;						////epsilon added in the denominator to avoid 0-division when calculating the gravitational force
const double epsilon_squared=epsilon*epsilon;	////epsilon squared

////We use grid_size=4 to help you debug your code, change it to a bigger number (e.g., 16, 32, etc.) to test the performance of your GPU code
const unsigned int grid_size=32;					////assuming particles are initialized on a background grid
const unsigned int particle_n=pow(grid_size,3);	////assuming each grid cell has one particle at the beginning

__host__ void Test_N_Body_Simulation()
{
	////initialize position, velocity, acceleration, and mass
	
	double* pos_x=new double[particle_n];
	double* pos_y=new double[particle_n];
	double* pos_z=new double[particle_n];
	////initialize particle positions as the cell centers on a background grid
	double dx=1.0/(double)grid_size;
	for(unsigned int k=0;k<grid_size;k++){
		for(unsigned int j=0;j<grid_size;j++){
			for(unsigned int i=0;i<grid_size;i++){
                unsigned int index=k*grid_size*grid_size+j*grid_size+i;
				pos_x[index]=dx*(double)i;
				pos_y[index]=dx*(double)j;
				pos_z[index]=dx*(double)k;
			}
		}
	}

	double* vel_x=new double[particle_n];
	memset(vel_x,0x00,particle_n*sizeof(double));
	double* vel_y=new double[particle_n];
	memset(vel_y,0x00,particle_n*sizeof(double));
	double* vel_z=new double[particle_n];
	memset(vel_z,0x00,particle_n*sizeof(double));

	double* acl_x=new double[particle_n];
	memset(acl_x,0x00,particle_n*sizeof(double));
	double* acl_y=new double[particle_n];
	memset(acl_y,0x00,particle_n*sizeof(double));
	double* acl_z=new double[particle_n];
	memset(acl_z,0x00,particle_n*sizeof(double));

	double* mass=new double[particle_n];
	for(int i=0;i<particle_n;i++){
		mass[i]=100.0;
	}


	//////////////////////////////////////////////////////////////////////////
	////Default implementation: n-body simulation on CPU
	////Comment the CPU implementation out when you test large-scale examples
	auto cpu_start=chrono::system_clock::now();
	cout<<"Total number of particles: "<<particle_n<<endl;
	cout<<"Tracking the motion of particle "<<particle_n/2<<endl;
	for(int i=0;i<time_step_num;i++){
		N_Body_Simulation_CPU_Poorman(pos_x,pos_y,pos_z,vel_x,vel_y,vel_z,acl_x,acl_y,acl_z,mass,particle_n,dt,epsilon_squared);
		cout<<"pos on timestep "<<i<<": "<<pos_x[particle_n/2]<<", "<<pos_y[particle_n/2]<<", "<<pos_z[particle_n/2]<<endl;
	}
	auto cpu_end=chrono::system_clock::now();
	chrono::duration<double> cpu_time=cpu_end-cpu_start;
	cout<<"CPU runtime: "<<cpu_time.count()*1000.<<" ms."<<endl;

	//////////////////////////////////////////////////////////////////////////

	//////////////////////////////////////////////////////////////////////////
	////Your implementation: n-body simulator on GPU
	hipEvent_t start,end;
	hipEventCreate(&start);
	hipEventCreate(&end);
	float gpu_time=0.0f;
	hipDeviceSynchronize();
	hipEventRecord(start);

	//////////////////////////////////////////////////////////////////////////
	////TODO 2: Your GPU functions are called here
	////Requirement: You need to copy data from the CPU arrays, conduct computations on the GPU, and copy the values back from GPU to CPU
	////The final positions should be stored in the same place as the CPU n-body function, i.e., pos_x, pos_y, pos_z
	////The correctness of your simulation will be evaluated by comparing the results (positions) with the results calculated by the default CPU implementations

	//////////////////////////////////////////////////////////////////////////

	hipEventRecord(end);
	hipEventSynchronize(end);
	hipEventElapsedTime(&gpu_time,start,end);
	printf("\nGPU runtime: %.4f ms\n",gpu_time);
	hipEventDestroy(start);
	hipEventDestroy(end);
	//////////////////////////////////////////////////////////////////////////

	out<<"R0: "<<pos_x[particle_n/2]<<" " <<pos_y[particle_n/2]<<" " <<pos_z[particle_n/2]<<endl;
	out<<"T1: "<<gpu_time<<endl;
}

int main()
{
	if(name::team=="Team_X"){
		printf("\nPlease specify your team name and team member names in name::team and name::author to start.\n");
		return 0;
	}

	std::string file_name=name::team+"_competition_2_nbody.dat";
	out.open(file_name.c_str());
	
	if(out.fail()){
		printf("\ncannot open file %s to record results\n",file_name.c_str());
		return 0;
	}

	Test_N_Body_Simulation();

	return 0;
}

	.text
	.file	"cpu_poorman.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z29N_Body_Simulation_CPU_PoormanPdS_S_S_S_S_S_S_S_PKdidd
.LCPI0_0:
	.quad	0x4008000000000000              # double 3
.LCPI0_1:
	.quad	0x3ff0000000000000              # double 1
.LCPI0_2:
	.quad	0x0000000000000000              # double 0
	.text
	.globl	_Z29N_Body_Simulation_CPU_PoormanPdS_S_S_S_S_S_S_S_PKdidd
	.type	_Z29N_Body_Simulation_CPU_PoormanPdS_S_S_S_S_S_S_S_PKdidd,@function
_Z29N_Body_Simulation_CPU_PoormanPdS_S_S_S_S_S_S_S_PKdidd: # @_Z29N_Body_Simulation_CPU_PoormanPdS_S_S_S_S_S_S_S_PKdidd
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movsd	%xmm1, 56(%rsp)                 # 8-byte Spill
	movsd	%xmm0, (%rsp)                   # 8-byte Spill
	movq	%r9, 32(%rsp)                   # 8-byte Spill
	movq	%r8, 24(%rsp)                   # 8-byte Spill
	movq	%rcx, 16(%rsp)                  # 8-byte Spill
	movq	%rdx, %r12
	movq	%rsi, %r13
	movq	%rdi, %rbp
	movslq	176(%rsp), %rbx
	movq	152(%rsp), %r15
	movq	144(%rsp), %rdi
	leaq	(,%rbx,8), %r14
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	memset@PLT
	movq	%r15, %rdi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	memset@PLT
	movq	160(%rsp), %rdi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	memset@PLT
	movq	%rbx, %rax
	movq	144(%rsp), %r10
	movq	160(%rsp), %rbx
	movsd	(%rsp), %xmm1                   # 8-byte Reload
                                        # xmm1 = mem[0],zero
	testq	%rax, %rax
	jle	.LBB0_9
# %bb.1:                                # %.preheader90.lr.ph
	movq	%r15, %r9
	movq	%r12, %r8
	movq	%rax, %rcx
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	movl	%eax, %edi
	xorl	%r14d, %r14d
	movq	%rbp, 48(%rsp)                  # 8-byte Spill
	movq	%rdi, 40(%rsp)                  # 8-byte Spill
.LBB0_2:                                # %.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_3 Depth 2
	xorl	%r15d, %r15d
.LBB0_3:                                #   Parent Loop BB0_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpq	%r15, %r14
	je	.LBB0_12
# %bb.4:                                #   in Loop: Header=BB0_3 Depth=2
	movq	%r10, %r12
	movq	%r9, %rbx
	movsd	(%rbp,%r15,8), %xmm0            # xmm0 = mem[0],zero
	subsd	(%rbp,%r14,8), %xmm0
	movsd	(%r13,%r15,8), %xmm1            # xmm1 = mem[0],zero
	movq	%r13, %rbp
	subsd	(%r13,%r14,8), %xmm1
	movsd	(%r8,%r15,8), %xmm2             # xmm2 = mem[0],zero
	movq	%r8, %r13
	subsd	(%r8,%r14,8), %xmm2
	movsd	%xmm0, 80(%rsp)                 # 8-byte Spill
	mulsd	%xmm0, %xmm0
	movsd	%xmm1, 72(%rsp)                 # 8-byte Spill
	mulsd	%xmm1, %xmm1
	addsd	%xmm0, %xmm1
	movsd	%xmm2, 64(%rsp)                 # 8-byte Spill
	movapd	%xmm2, %xmm0
	mulsd	%xmm2, %xmm0
	addsd	%xmm1, %xmm0
	addsd	56(%rsp), %xmm0                 # 8-byte Folded Reload
	ucomisd	.LCPI0_2(%rip), %xmm0
	jb	.LBB0_10
# %bb.5:                                #   in Loop: Header=BB0_3 Depth=2
	sqrtsd	%xmm0, %xmm0
	jmp	.LBB0_11
.LBB0_10:                               # %call.sqrt
                                        #   in Loop: Header=BB0_3 Depth=2
	callq	sqrt
.LBB0_11:                               # %.split
                                        #   in Loop: Header=BB0_3 Depth=2
	movsd	.LCPI0_0(%rip), %xmm1           # xmm1 = mem[0],zero
	callq	pow
	movsd	.LCPI0_1(%rip), %xmm1           # xmm1 = mem[0],zero
	divsd	%xmm0, %xmm1
	movq	168(%rsp), %rax
	movsd	(%rax,%r15,8), %xmm0            # xmm0 = mem[0],zero
	movsd	80(%rsp), %xmm2                 # 8-byte Reload
                                        # xmm2 = mem[0],zero
	mulsd	%xmm0, %xmm2
	mulsd	%xmm1, %xmm2
	movsd	72(%rsp), %xmm3                 # 8-byte Reload
                                        # xmm3 = mem[0],zero
	mulsd	%xmm0, %xmm3
	mulsd	%xmm1, %xmm3
	movsd	64(%rsp), %xmm4                 # 8-byte Reload
                                        # xmm4 = mem[0],zero
	mulsd	%xmm0, %xmm4
	movq	%r12, %r10
	addsd	(%r12,%r14,8), %xmm2
	mulsd	%xmm1, %xmm4
	movsd	%xmm2, (%r12,%r14,8)
	movq	%rbx, %r9
	addsd	(%rbx,%r14,8), %xmm3
	movsd	%xmm3, (%rbx,%r14,8)
	movq	160(%rsp), %rbx
	addsd	(%rbx,%r14,8), %xmm4
	movsd	%xmm4, (%rbx,%r14,8)
	movsd	(%rsp), %xmm1                   # 8-byte Reload
                                        # xmm1 = mem[0],zero
	movq	%r13, %r8
	movq	%rbp, %r13
	movq	48(%rsp), %rbp                  # 8-byte Reload
	movq	40(%rsp), %rdi                  # 8-byte Reload
.LBB0_12:                               #   in Loop: Header=BB0_3 Depth=2
	incq	%r15
	cmpq	%r15, %rdi
	jne	.LBB0_3
# %bb.13:                               # %._crit_edge
                                        #   in Loop: Header=BB0_2 Depth=1
	incq	%r14
	cmpq	%rdi, %r14
	jne	.LBB0_2
# %bb.6:                                # %.preheader
	cmpl	$0, 8(%rsp)                     # 4-byte Folded Reload
	movq	32(%rsp), %rcx                  # 8-byte Reload
	movq	24(%rsp), %rdx                  # 8-byte Reload
	movq	16(%rsp), %rsi                  # 8-byte Reload
	jle	.LBB0_9
# %bb.7:                                # %.lr.ph94.preheader
	xorl	%eax, %eax
.LBB0_8:                                # %.lr.ph94
                                        # =>This Inner Loop Header: Depth=1
	movsd	(%r10,%rax,8), %xmm0            # xmm0 = mem[0],zero
	mulsd	%xmm1, %xmm0
	addsd	(%rsi,%rax,8), %xmm0
	movsd	%xmm0, (%rsi,%rax,8)
	movsd	(%r9,%rax,8), %xmm0             # xmm0 = mem[0],zero
	mulsd	%xmm1, %xmm0
	addsd	(%rdx,%rax,8), %xmm0
	movsd	%xmm0, (%rdx,%rax,8)
	movsd	(%rbx,%rax,8), %xmm0            # xmm0 = mem[0],zero
	mulsd	%xmm1, %xmm0
	addsd	(%rcx,%rax,8), %xmm0
	movsd	%xmm0, (%rcx,%rax,8)
	movsd	(%rsi,%rax,8), %xmm0            # xmm0 = mem[0],zero
	mulsd	%xmm1, %xmm0
	addsd	(%rbp,%rax,8), %xmm0
	movsd	%xmm0, (%rbp,%rax,8)
	movsd	(%rdx,%rax,8), %xmm0            # xmm0 = mem[0],zero
	mulsd	%xmm1, %xmm0
	addsd	(%r13,%rax,8), %xmm0
	movsd	%xmm0, (%r13,%rax,8)
	movsd	(%rcx,%rax,8), %xmm0            # xmm0 = mem[0],zero
	mulsd	%xmm1, %xmm0
	addsd	(%r8,%rax,8), %xmm0
	movsd	%xmm0, (%r8,%rax,8)
	incq	%rax
	cmpq	%rax, %rdi
	jne	.LBB0_8
.LBB0_9:                                # %._crit_edge95
	addq	$88, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z29N_Body_Simulation_CPU_PoormanPdS_S_S_S_S_S_S_S_PKdidd, .Lfunc_end0-_Z29N_Body_Simulation_CPU_PoormanPdS_S_S_S_S_S_S_S_PKdidd
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z22Test_N_Body_Simulationv
.LCPI1_0:
	.quad	0x3fa0000000000000              # double 0.03125
.LCPI1_1:
	.quad	0x3f50624dd2f1a9fc              # double 0.001
.LCPI1_2:
	.quad	0x3f1a36e2eb1c432d              # double 1.0E-4
.LCPI1_3:
	.quad	0x41cdcd6500000000              # double 1.0E+9
.LCPI1_4:
	.quad	0x408f400000000000              # double 1000
	.text
	.globl	_Z22Test_N_Body_Simulationv
	.type	_Z22Test_N_Body_Simulationv,@function
_Z22Test_N_Body_Simulationv:            # @_Z22Test_N_Body_Simulationv
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	_ZL10particle_n(%rip), %r13d
	leaq	(,%r13,8), %r14
	movq	%r14, %rdi
	callq	_Znam
	movq	%rax, %r12
	movq	%r14, %rdi
	callq	_Znam
	movq	%rax, %rbx
	movq	%r14, %rdi
	callq	_Znam
	movq	%rax, %rsi
	xorl	%eax, %eax
	movsd	.LCPI1_0(%rip), %xmm0           # xmm0 = mem[0],zero
	movl	$256, %ecx                      # imm = 0x100
	movl	$8192, %edx                     # imm = 0x2000
	movq	%rsi, 16(%rsp)                  # 8-byte Spill
	movq	%rbx, 24(%rsp)                  # 8-byte Spill
	movq	%rbx, %rdi
	movq	%r12, 48(%rsp)                  # 8-byte Spill
	movq	%r12, %r8
.LBB1_1:                                # %.preheader56
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_2 Depth 2
                                        #       Child Loop BB1_3 Depth 3
	movl	%eax, %r9d
	xorps	%xmm1, %xmm1
	cvtsi2sd	%r9, %xmm1
	mulsd	%xmm0, %xmm1
	movq	%rsi, %r9
	movq	%rdi, %r10
	movq	%r8, %r11
	xorl	%ebx, %ebx
.LBB1_2:                                # %.preheader
                                        #   Parent Loop BB1_1 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB1_3 Depth 3
	movl	%ebx, %r12d
	xorps	%xmm2, %xmm2
	cvtsi2sd	%r12, %xmm2
	mulsd	%xmm0, %xmm2
	xorl	%r12d, %r12d
.LBB1_3:                                #   Parent Loop BB1_1 Depth=1
                                        #     Parent Loop BB1_2 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movl	%r12d, %ebp
	xorps	%xmm3, %xmm3
	cvtsi2sd	%rbp, %xmm3
	mulsd	%xmm0, %xmm3
	movsd	%xmm3, (%r11,%r12,8)
	movsd	%xmm2, (%r10,%r12,8)
	movsd	%xmm1, (%r9,%r12,8)
	incq	%r12
	cmpq	$32, %r12
	jne	.LBB1_3
# %bb.4:                                #   in Loop: Header=BB1_2 Depth=2
	incq	%rbx
	addq	%rcx, %r11
	addq	%rcx, %r10
	addq	%rcx, %r9
	cmpq	$32, %rbx
	jne	.LBB1_2
# %bb.5:                                #   in Loop: Header=BB1_1 Depth=1
	incq	%rax
	addq	%rdx, %r8
	addq	%rdx, %rdi
	addq	%rdx, %rsi
	cmpq	$32, %rax
	jne	.LBB1_1
# %bb.6:
	movq	%r14, %rdi
	callq	_Znam
	xorl	%ebp, %ebp
	movq	%rax, 40(%rsp)                  # 8-byte Spill
	movq	%rax, %rdi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	memset@PLT
	movq	%r14, %rdi
	callq	_Znam
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	movq	%rax, %rdi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	memset@PLT
	movq	%r14, %rdi
	callq	_Znam
	movq	%rax, 88(%rsp)                  # 8-byte Spill
	movq	%rax, %rdi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	memset@PLT
	movq	%r14, %rdi
	callq	_Znam
	movq	%rax, 80(%rsp)                  # 8-byte Spill
	movq	%rax, %rdi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	memset@PLT
	movq	%r14, %rdi
	callq	_Znam
	movq	%rax, %r12
	movq	%rax, %rdi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	memset@PLT
	movq	%r14, %rdi
	callq	_Znam
	movq	%rax, %r15
	movq	%rax, %rdi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	memset@PLT
	movq	%r14, %rdi
	callq	_Znam
	testq	%r13, %r13
	je	.LBB1_9
# %bb.7:                                # %.lr.ph.preheader
	xorl	%edx, %edx
	movabsq	$4636737291354636288, %rcx      # imm = 0x4059000000000000
.LBB1_8:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	%rcx, (%rax,%rdx,8)
	incq	%rdx
	cmpq	%rdx, %r13
	jne	.LBB1_8
.LBB1_9:                                # %._crit_edge
	movq	%rax, 72(%rsp)                  # 8-byte Spill
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	movl	$_ZSt4cout, %edi
	movl	$.L.str.9, %esi
	movl	$27, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	_ZL10particle_n(%rip), %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$_ZSt4cout, %edi
	movl	$.L.str.10, %esi
	movl	$32, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	_ZL10particle_n(%rip), %esi
	shrl	%esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	48(%rsp), %rbx                  # 8-byte Reload
	movq	40(%rsp), %r14                  # 8-byte Reload
	movq	%r12, 56(%rsp)                  # 8-byte Spill
	movq	%r15, 64(%rsp)                  # 8-byte Spill
	movq	24(%rsp), %r15                  # 8-byte Reload
	movq	16(%rsp), %r12                  # 8-byte Reload
.LBB1_10:                               # =>This Inner Loop Header: Depth=1
	movl	_ZL10particle_n(%rip), %eax
	subq	$8, %rsp
	.cfi_adjust_cfa_offset 8
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r14, %rcx
	movq	16(%rsp), %r8                   # 8-byte Reload
	movq	96(%rsp), %r9                   # 8-byte Reload
	movsd	.LCPI1_1(%rip), %xmm0           # xmm0 = mem[0],zero
	movsd	.LCPI1_2(%rip), %xmm1           # xmm1 = mem[0],zero
	pushq	%rax
	.cfi_adjust_cfa_offset 8
	pushq	88(%rsp)                        # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	88(%rsp)                        # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	88(%rsp)                        # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	pushq	120(%rsp)                       # 8-byte Folded Reload
	.cfi_adjust_cfa_offset 8
	callq	_Z29N_Body_Simulation_CPU_PoormanPdS_S_S_S_S_S_S_S_PKdidd
	addq	$48, %rsp
	.cfi_adjust_cfa_offset -48
	movl	$_ZSt4cout, %edi
	movl	$.L.str.11, %esi
	movl	$16, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	%ebp, %esi
	callq	_ZNSolsEi
	movq	%rax, %r13
	movl	$.L.str.12, %esi
	movl	$2, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	_ZL10particle_n(%rip), %eax
	shrl	%eax
	movsd	(%rbx,%rax,8), %xmm0            # xmm0 = mem[0],zero
	movq	%r13, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r13
	movl	$.L.str.13, %esi
	movl	$2, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	_ZL10particle_n(%rip), %eax
	shrl	%eax
	movsd	(%r15,%rax,8), %xmm0            # xmm0 = mem[0],zero
	movq	%r13, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r13
	movl	$.L.str.13, %esi
	movl	$2, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	_ZL10particle_n(%rip), %eax
	shrl	%eax
	movsd	(%r12,%rax,8), %xmm0            # xmm0 = mem[0],zero
	movq	%r13, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r13
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r13, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r13, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	incl	%ebp
	cmpl	$10, %ebp
	jne	.LBB1_10
# %bb.11:
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	subq	32(%rsp), %rax                  # 8-byte Folded Reload
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI1_3(%rip), %xmm0
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movl	$_ZSt4cout, %edi
	movl	$.L.str.14, %esi
	movl	$13, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	mulsd	.LCPI1_4(%rip), %xmm0
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r14
	movl	$.L.str.15, %esi
	movl	$4, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%r14), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	leaq	112(%rsp), %r14
	movq	%r14, %rdi
	callq	hipEventCreate
	leaq	104(%rsp), %r13
	movq	%r13, %rdi
	callq	hipEventCreate
	leaq	100(%rsp), %rbp
	movl	$0, (%rbp)
	callq	hipDeviceSynchronize
	movq	(%r14), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%r13), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%r13), %rdi
	callq	hipEventSynchronize
	movq	(%r14), %rsi
	movq	(%r13), %rdx
	movq	%rbp, %rdi
	callq	hipEventElapsedTime
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbp), %xmm0
	movl	$.L.str.16, %edi
	movb	$1, %al
	callq	printf
	movq	(%r14), %rdi
	callq	hipEventDestroy
	movq	(%r13), %rdi
	callq	hipEventDestroy
	movl	$out, %edi
	movl	$.L.str.17, %esi
	movl	$4, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	_ZL10particle_n(%rip), %eax
	shrl	%eax
	movsd	(%rbx,%rax,8), %xmm0            # xmm0 = mem[0],zero
	movl	$out, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r14
	movl	$.L.str.18, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	_ZL10particle_n(%rip), %eax
	shrl	%eax
	movq	24(%rsp), %rcx                  # 8-byte Reload
	movsd	(%rcx,%rax,8), %xmm0            # xmm0 = mem[0],zero
	movq	%r14, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r14
	movl	$.L.str.18, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	_ZL10particle_n(%rip), %eax
	shrl	%eax
	movq	16(%rsp), %rcx                  # 8-byte Reload
	movsd	(%rcx,%rax,8), %xmm0            # xmm0 = mem[0],zero
	movq	%r14, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r14
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$out, %edi
	movl	$.L.str.19, %esi
	movl	$4, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbp), %xmm0
	movl	$out, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	addq	$120, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z22Test_N_Body_Simulationv, .Lfunc_end1-_Z22Test_N_Body_Simulationv
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	_ZN4name4teamB5cxx11E+8(%rip), %rbx
	movq	_ZN4name4teamB5cxx11E(%rip), %r14
	cmpq	$6, %rbx
	jne	.LBB2_3
# %bb.1:                                # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit
	movl	$1835099476, %eax               # imm = 0x6D616554
	xorl	(%r14), %eax
	movzwl	4(%r14), %ecx
	xorl	$22623, %ecx                    # imm = 0x585F
	orl	%eax, %ecx
	je	.LBB2_2
.LBB2_3:                                # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit.thread5
	leaq	16(%rsp), %r15
	movq	%r15, -16(%r15)
	movq	$0, -8(%r15)
	movb	$0, (%r15)
	leaq	24(%rbx), %rsi
.Ltmp0:
	movq	%rsp, %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEm
.Ltmp1:
# %bb.4:
.Ltmp2:
	movq	%rsp, %rdi
	movq	%r14, %rsi
	movq	%rbx, %rdx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm
.Ltmp3:
# %bb.5:
.Ltmp4:
	movq	%rsp, %rdi
	movl	$.L.str.22, %esi
	movl	$24, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm
.Ltmp5:
# %bb.6:                                # %_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_.exit
	movq	(%rsp), %rsi
.Ltmp7:
	movl	$out, %edi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp8:
# %bb.7:
	movq	out(%rip), %rax
	movq	-24(%rax), %rax
	testb	$5, out+32(%rax)
	je	.LBB2_14
# %bb.8:
	movq	(%rsp), %rsi
	movl	$.L.str.23, %edi
	xorl	%eax, %eax
	callq	printf
	jmp	.LBB2_15
.LBB2_14:
.Ltmp9:
	callq	_Z22Test_N_Body_Simulationv
.Ltmp10:
.LBB2_15:
	movq	(%rsp), %rdi
	cmpq	%r15, %rdi
	je	.LBB2_17
# %bb.16:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i2
	callq	_ZdlPv
	jmp	.LBB2_17
.LBB2_2:                                # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit.thread
	movl	$.Lstr, %edi
	callq	puts@PLT
.LBB2_17:
	xorl	%eax, %eax
	addq	$32, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.LBB2_13:
	.cfi_def_cfa_offset 64
.Ltmp11:
	jmp	.LBB2_10
.LBB2_9:
.Ltmp6:
.LBB2_10:
	movq	%rax, %rbx
	movq	(%rsp), %rdi
	cmpq	%r15, %rdi
	je	.LBB2_12
# %bb.11:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i.i.i
	callq	_ZdlPv
.LBB2_12:                               # %common.resume
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end2:
	.size	main, .Lfunc_end2-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table2:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 1 <<
	.uleb128 .Ltmp5-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp5
	.uleb128 .Ltmp6-.Lfunc_begin0           #     jumps to .Ltmp6
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp7-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp10-.Ltmp7                 #   Call between .Ltmp7 and .Ltmp10
	.uleb128 .Ltmp11-.Lfunc_begin0          #     jumps to .Ltmp11
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp10-.Lfunc_begin0          # >> Call Site 3 <<
	.uleb128 .Lfunc_end2-.Ltmp10            #   Call between .Ltmp10 and .Lfunc_end2
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text.startup,"ax",@progbits
	.type	_GLOBAL__sub_I_cpu_poorman.hip,@function # -- Begin function _GLOBAL__sub_I_cpu_poorman.hip
_GLOBAL__sub_I_cpu_poorman.hip:         # @_GLOBAL__sub_I_cpu_poorman.hip
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	$_ZN4name4teamB5cxx11E+16, _ZN4name4teamB5cxx11E(%rip)
	movabsq	$7018951688579542099, %rax      # imm = 0x6168535F6D696C53
	movq	%rax, _ZN4name4teamB5cxx11E+16(%rip)
	movl	$1936876900, _ZN4name4teamB5cxx11E+24(%rip) # imm = 0x73726564
	movq	$12, _ZN4name4teamB5cxx11E+8(%rip)
	xorl	%ebx, %ebx
	movb	%bl, _ZN4name4teamB5cxx11E+28(%rip)
	movl	$_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev, %edi
	movl	$_ZN4name4teamB5cxx11E, %esi
	movl	$__dso_handle, %edx
	callq	__cxa_atexit
	movq	$_ZN4name8author_1B5cxx11E+16, _ZN4name8author_1B5cxx11E(%rip)
	movl	$1414743380, _ZN4name8author_1B5cxx11E+16(%rip) # imm = 0x54534554
	movq	$4, _ZN4name8author_1B5cxx11E+8(%rip)
	movb	%bl, _ZN4name8author_1B5cxx11E+20(%rip)
	movl	$_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev, %edi
	movl	$_ZN4name8author_1B5cxx11E, %esi
	movl	$__dso_handle, %edx
	callq	__cxa_atexit
	movq	$_ZN4name8author_2B5cxx11E+16, _ZN4name8author_2B5cxx11E(%rip)
	movabsq	$5989880203992649540, %rax      # imm = 0x5320544F4E204F44
	movq	%rax, _ZN4name8author_2B5cxx11E+16(%rip)
	movabsq	$6073470519780515924, %rax      # imm = 0x54494D4255532054
	movq	%rax, _ZN4name8author_2B5cxx11E+21(%rip)
	movq	$13, _ZN4name8author_2B5cxx11E+8(%rip)
	movb	%bl, _ZN4name8author_2B5cxx11E+29(%rip)
	movl	$_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev, %edi
	movl	$_ZN4name8author_2B5cxx11E, %esi
	movl	$__dso_handle, %edx
	callq	__cxa_atexit
	movq	$_ZN4name8author_3B5cxx11E+16, _ZN4name8author_3B5cxx11E(%rip)
	movl	$1701667150, _ZN4name8author_3B5cxx11E+16(%rip) # imm = 0x656D614E
	movw	$13151, _ZN4name8author_3B5cxx11E+20(%rip) # imm = 0x335F
	movq	$6, _ZN4name8author_3B5cxx11E+8(%rip)
	movb	%bl, _ZN4name8author_3B5cxx11E+22(%rip)
	movl	$_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev, %edi
	movl	$_ZN4name8author_3B5cxx11E, %esi
	movl	$__dso_handle, %edx
	callq	__cxa_atexit
	movl	$out, %edi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev
	movl	$_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev, %edi
	movl	$out, %esi
	movl	$__dso_handle, %edx
	callq	__cxa_atexit
	movl	$32768, _ZL10particle_n(%rip)   # imm = 0x8000
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_GLOBAL__sub_I_cpu_poorman.hip, .Lfunc_end3-_GLOBAL__sub_I_cpu_poorman.hip
	.cfi_endproc
                                        # -- End function
	.type	_ZN4name4teamB5cxx11E,@object   # @_ZN4name4teamB5cxx11E
	.bss
	.globl	_ZN4name4teamB5cxx11E
	.p2align	3, 0x0
_ZN4name4teamB5cxx11E:
	.zero	32
	.size	_ZN4name4teamB5cxx11E, 32

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Slim_Shaders"
	.size	.L.str, 13

	.hidden	__dso_handle
	.type	_ZN4name8author_1B5cxx11E,@object # @_ZN4name8author_1B5cxx11E
	.bss
	.globl	_ZN4name8author_1B5cxx11E
	.p2align	3, 0x0
_ZN4name8author_1B5cxx11E:
	.zero	32
	.size	_ZN4name8author_1B5cxx11E, 32

	.type	_ZN4name8author_2B5cxx11E,@object # @_ZN4name8author_2B5cxx11E
	.globl	_ZN4name8author_2B5cxx11E
	.p2align	3, 0x0
_ZN4name8author_2B5cxx11E:
	.zero	32
	.size	_ZN4name8author_2B5cxx11E, 32

	.type	.L.str.4,@object                # @.str.4
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.4:
	.asciz	"DO NOT SUBMIT"
	.size	.L.str.4, 14

	.type	_ZN4name8author_3B5cxx11E,@object # @_ZN4name8author_3B5cxx11E
	.bss
	.globl	_ZN4name8author_3B5cxx11E
	.p2align	3, 0x0
_ZN4name8author_3B5cxx11E:
	.zero	32
	.size	_ZN4name8author_3B5cxx11E, 32

	.type	.L.str.6,@object                # @.str.6
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.6:
	.asciz	"Name_3"
	.size	.L.str.6, 7

	.type	out,@object                     # @out
	.bss
	.globl	out
	.p2align	3, 0x0
out:
	.zero	512
	.size	out, 512

	.type	_ZL10particle_n,@object         # @_ZL10particle_n
	.local	_ZL10particle_n
	.comm	_ZL10particle_n,4,4
	.type	.L.str.9,@object                # @.str.9
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.9:
	.asciz	"Total number of particles: "
	.size	.L.str.9, 28

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"Tracking the motion of particle "
	.size	.L.str.10, 33

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"pos on timestep "
	.size	.L.str.11, 17

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	": "
	.size	.L.str.12, 3

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	", "
	.size	.L.str.13, 3

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"CPU runtime: "
	.size	.L.str.14, 14

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	" ms."
	.size	.L.str.15, 5

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"\nGPU runtime: %.4f ms\n"
	.size	.L.str.16, 23

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"R0: "
	.size	.L.str.17, 5

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	" "
	.size	.L.str.18, 2

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"T1: "
	.size	.L.str.19, 5

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	"Team_X"
	.size	.L.str.20, 7

	.type	.L.str.22,@object               # @.str.22
.L.str.22:
	.asciz	"_competition_2_nbody.dat"
	.size	.L.str.22, 25

	.type	.L.str.23,@object               # @.str.23
.L.str.23:
	.asciz	"\ncannot open file %s to record results\n"
	.size	.L.str.23, 40

	.section	.init_array,"aw",@init_array
	.p2align	3, 0x0
	.quad	_GLOBAL__sub_I_cpu_poorman.hip
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"\nPlease specify your team name and team member names in name::team and name::author to start."
	.size	.Lstr, 94

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym _GLOBAL__sub_I_cpu_poorman.hip
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _ZN4name4teamB5cxx11E
	.addrsig_sym __dso_handle
	.addrsig_sym _ZN4name8author_1B5cxx11E
	.addrsig_sym _ZN4name8author_2B5cxx11E
	.addrsig_sym _ZN4name8author_3B5cxx11E
	.addrsig_sym out
	.addrsig_sym _ZL10particle_n
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_cuid_

	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
