/**********************************************************************/
// An unoptimized Naive N-Body solver for Gravity Simulations         //
// G is assumed to be 1.0                                             //
// Course Material for HPCSE-II, Spring 2019, ETH Zurich              //
// Authors: Sergio Martin                                             //
// License: Use if you like, but give us credit.                      //
/**********************************************************************/

#include <stdio.h>
#include <math.h>
#include <chrono>

int main(int argc, char* argv[])
{
 size_t N0 = 32;
 size_t N  = N0*N0*N0;

 // Initializing N-Body Problem

 double* xPos   = (double*) calloc (N, sizeof(double));
 double* yPos   = (double*) calloc (N, sizeof(double));
 double* zPos   = (double*) calloc (N, sizeof(double));
 double* xFor   = (double*) calloc (N, sizeof(double));
 double* yFor   = (double*) calloc (N, sizeof(double));
 double* zFor   = (double*) calloc (N, sizeof(double));
 double* mass   = (double*) calloc (N, sizeof(double));

 size_t current = 0;
 for (size_t i = 0; i < N0; i++)
 for (size_t j = 0; j < N0; j++)
 for (size_t k = 0; k < N0; k++)
 {
  xPos[current] = i;
  yPos[current] = j;
  zPos[current] = k;
  mass[current] = 1.0;
  xFor[current] = 0.0;
  yFor[current] = 0.0;
  zFor[current] = 0.0;
  current++;
 }

 // Running Force-calculation kernel
 auto startTime = std::chrono::system_clock::now();

 for (size_t i = 0; i < N; i++)
 for (size_t j = 0; j < N; j++) if (j != i)
 {
  double xDist = xPos[i] - xPos[j];
  double yDist = yPos[i] - yPos[j];
  double zDist = zPos[i] - zPos[j];
  double r     = sqrt(xDist*xDist + yDist*yDist + zDist*zDist);
  xFor[i] += xDist*mass[i]*mass[j] / (r*r*r);
  yFor[i] += yDist*mass[i]*mass[j] / (r*r*r);
  zFor[i] += zDist*mass[i]*mass[j] / (r*r*r);
 }

 auto endTime = std::chrono::system_clock::now();

 double forceChecksum = 0.0;
 for (size_t i = 0; i < N; i++) forceChecksum += xFor[i] + yFor[i] + zFor[i];
 if (fabs(forceChecksum) > 0.00001) { printf("Verification Failed: Forces are not conserved! Sum: %.10f\n", forceChecksum); exit(-1); }
 printf("Verification Passed! Time: %.8fs\n", std::chrono::duration<double>(endTime-startTime).count());
 return 0;
}

	.file	"tmpxft_00345a5e_00000000-6_nbody_gpu.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2132:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2132:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC4:
	.string	"Verification Failed: Forces are not conserved! Sum: %.10f\n"
.LC6:
	.string	"Verification Passed! Time: %.8fs\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2126:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$8, %esi
	movl	$32768, %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	$72, %rsp
	.cfi_def_cfa_offset 128
	call	calloc@PLT
	movl	$8, %esi
	movl	$32768, %edi
	movq	%rax, %r12
	call	calloc@PLT
	movl	$8, %esi
	movl	$32768, %edi
	movq	%rax, %r13
	call	calloc@PLT
	movl	$8, %esi
	movl	$32768, %edi
	movq	%rax, %r14
	call	calloc@PLT
	movl	$8, %esi
	movl	$32768, %edi
	movq	%rax, %rbp
	call	calloc@PLT
	movl	$8, %esi
	movl	$32768, %edi
	movq	%rax, %rbx
	call	calloc@PLT
	movl	$8, %esi
	movl	$32768, %edi
	movq	%rax, %r15
	call	calloc@PLT
	movsd	.LC1(%rip), %xmm0
	xorl	%esi, %esi
	movq	%rax, %rdx
	xorl	%eax, %eax
.L7:
	cvtsi2sdq	%rsi, %xmm1
	movq	%rsi, %r9
	xorl	%edi, %edi
	salq	$10, %r9
.L4:
	cvtsi2sdq	%rdi, %xmm3
	movq	%r9, %rcx
	xorl	%r8d, %r8d
.L3:
	cvtsi2sdq	%r8, %xmm2
	incq	%r8
	movsd	%xmm1, (%r12,%rcx,8)
	movsd	%xmm3, 0(%r13,%rcx,8)
	movsd	%xmm0, (%rdx,%rcx,8)
	movsd	%xmm2, (%r14,%rcx,8)
	incq	%rcx
	cmpq	$32, %r8
	jne	.L3
	incq	%rdi
	addq	$32, %r9
	cmpq	$32, %rdi
	jne	.L4
	movq	%rsi, %r8
	movl	$2048, %ecx
	incq	%rsi
	salq	$13, %r8
	leaq	(%r15,%r8), %r9
	movq	%r9, %rdi
	leaq	(%rbx,%r8), %r9
	addq	%rbp, %r8
	rep stosl
	movl	$2048, %ecx
	movq	%r9, %rdi
	rep stosl
	movl	$2048, %ecx
	movq	%r8, %rdi
	rep stosl
	cmpq	$32, %rsi
	jne	.L7
	movq	%rdx, 16(%rsp)
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	movq	16(%rsp), %rdx
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
.L8:
	xorl	%ecx, %ecx
.L10:
	cmpq	%rcx, %rax
	je	.L9
	movsd	(%r12,%rax,8), %xmm2
	subsd	(%r12,%rcx,8), %xmm2
	movq	%rdx, 56(%rsp)
	movsd	0(%r13,%rax,8), %xmm1
	movsd	(%r14,%rax,8), %xmm4
	movq	%rax, 48(%rsp)
	subsd	0(%r13,%rcx,8), %xmm1
	subsd	(%r14,%rcx,8), %xmm4
	movq	%rcx, 40(%rsp)
	movaps	%xmm2, %xmm0
	movsd	%xmm2, 32(%rsp)
	mulsd	%xmm2, %xmm0
	movaps	%xmm1, %xmm3
	movsd	%xmm1, 24(%rsp)
	mulsd	%xmm1, %xmm3
	movsd	%xmm4, 16(%rsp)
	addsd	%xmm3, %xmm0
	movaps	%xmm4, %xmm3
	mulsd	%xmm4, %xmm3
	addsd	%xmm3, %xmm0
	call	sqrt@PLT
	movq	48(%rsp), %rax
	movq	56(%rsp), %rdx
	movaps	%xmm0, %xmm6
	movsd	32(%rsp), %xmm2
	movq	40(%rsp), %rcx
	movsd	(%rdx,%rax,8), %xmm0
	movsd	24(%rsp), %xmm1
	movaps	%xmm6, %xmm3
	movsd	16(%rsp), %xmm4
	mulsd	%xmm6, %xmm3
	movsd	(%rdx,%rcx,8), %xmm5
	mulsd	%xmm0, %xmm2
	mulsd	%xmm0, %xmm1
	mulsd	%xmm4, %xmm0
	mulsd	%xmm6, %xmm3
	mulsd	%xmm5, %xmm2
	mulsd	%xmm5, %xmm1
	mulsd	%xmm5, %xmm0
	divsd	%xmm3, %xmm2
	divsd	%xmm3, %xmm1
	addsd	0(%rbp,%rax,8), %xmm2
	movsd	%xmm2, 0(%rbp,%rax,8)
	divsd	%xmm3, %xmm0
	addsd	(%rbx,%rax,8), %xmm1
	movsd	%xmm1, (%rbx,%rax,8)
	addsd	(%r15,%rax,8), %xmm0
	movsd	%xmm0, (%r15,%rax,8)
.L9:
	incq	%rcx
	cmpq	$32768, %rcx
	jne	.L10
	incq	%rax
	cmpq	$32768, %rax
	jne	.L8
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	xorl	%edx, %edx
	xorps	%xmm1, %xmm1
.L12:
	movsd	0(%rbp,%rdx,8), %xmm0
	addsd	(%rbx,%rdx,8), %xmm0
	addsd	(%r15,%rdx,8), %xmm0
	incq	%rdx
	addsd	%xmm0, %xmm1
	cmpq	$32768, %rdx
	jne	.L12
	movaps	%xmm1, %xmm0
	andps	.LC2(%rip), %xmm0
	comisd	.LC3(%rip), %xmm0
	jbe	.L23
	movl	$2, %edi
	movaps	%xmm1, %xmm0
	leaq	.LC4(%rip), %rsi
	movb	$1, %al
	call	__printf_chk@PLT
	orl	$-1, %edi
	call	exit@PLT
.L23:
	movq	8(%rsp), %rbx
	leaq	.LC6(%rip), %rsi
	movl	$2, %edi
	subq	%rbx, %rax
	cvtsi2sdq	%rax, %xmm0
	movb	$1, %al
	divsd	.LC5(%rip), %xmm0
	call	__printf_chk@PLT
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	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
.LFE2126:
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2155:
	.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
.LFE2155:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.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
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1072693248
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.section	.rodata.cst8
	.align 8
.LC3:
	.long	-1998362383
	.long	1055193269
	.align 8
.LC5:
	.long	0
	.long	1104006501
	.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:

/**********************************************************************/
// An unoptimized Naive N-Body solver for Gravity Simulations         //
// G is assumed to be 1.0                                             //
// Course Material for HPCSE-II, Spring 2019, ETH Zurich              //
// Authors: Sergio Martin                                             //
// License: Use if you like, but give us credit.                      //
/**********************************************************************/


#include <hip/hip_runtime.h>
#include <stdio.h>
#include <math.h>
#include <chrono>

int main(int argc, char* argv[])
{
 size_t N0 = 32;
 size_t N  = N0*N0*N0;

 // Initializing N-Body Problem

 double* xPos   = (double*) calloc (N, sizeof(double));
 double* yPos   = (double*) calloc (N, sizeof(double));
 double* zPos   = (double*) calloc (N, sizeof(double));
 double* xFor   = (double*) calloc (N, sizeof(double));
 double* yFor   = (double*) calloc (N, sizeof(double));
 double* zFor   = (double*) calloc (N, sizeof(double));
 double* mass   = (double*) calloc (N, sizeof(double));

 size_t current = 0;
 for (size_t i = 0; i < N0; i++)
 for (size_t j = 0; j < N0; j++)
 for (size_t k = 0; k < N0; k++)
 {
  xPos[current] = i;
  yPos[current] = j;
  zPos[current] = k;
  mass[current] = 1.0;
  xFor[current] = 0.0;
  yFor[current] = 0.0;
  zFor[current] = 0.0;
  current++;
 }

 // Running Force-calculation kernel
 auto startTime = std::chrono::system_clock::now();

 for (size_t i = 0; i < N; i++)
 for (size_t j = 0; j < N; j++) if (j != i)
 {
  double xDist = xPos[i] - xPos[j];
  double yDist = yPos[i] - yPos[j];
  double zDist = zPos[i] - zPos[j];
  double r     = sqrt(xDist*xDist + yDist*yDist + zDist*zDist);
  xFor[i] += xDist*mass[i]*mass[j] / (r*r*r);
  yFor[i] += yDist*mass[i]*mass[j] / (r*r*r);
  zFor[i] += zDist*mass[i]*mass[j] / (r*r*r);
 }

 auto endTime = std::chrono::system_clock::now();

 double forceChecksum = 0.0;
 for (size_t i = 0; i < N; i++) forceChecksum += xFor[i] + yFor[i] + zFor[i];
 if (fabs(forceChecksum) > 0.00001) { printf("Verification Failed: Forces are not conserved! Sum: %.10f\n", forceChecksum); exit(-1); }
 printf("Verification Passed! Time: %.8fs\n", std::chrono::duration<double>(endTime-startTime).count());
 return 0;
}

	.text
	.file	"nbody_gpu.hip"
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function main
.LCPI0_0:
	.long	1127219200                      # 0x43300000
	.long	1160773632                      # 0x45300000
	.long	0                               # 0x0
	.long	0                               # 0x0
.LCPI0_1:
	.quad	0x4330000000000000              # double 4503599627370496
	.quad	0x4530000000000000              # double 1.9342813113834067E+25
.LCPI0_2:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI0_3:
	.quad	0x3ee4f8b588e368f1              # double 1.0000000000000001E-5
.LCPI0_4:
	.quad	0x41cdcd6500000000              # double 1.0E+9
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.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	$24, %rsp
	.cfi_def_cfa_offset 80
	.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	$32768, %edi                    # imm = 0x8000
	movl	$8, %esi
	callq	calloc
	movq	%rax, %r14
	movl	$32768, %edi                    # imm = 0x8000
	movl	$8, %esi
	callq	calloc
	movq	%rax, %r12
	movl	$32768, %edi                    # imm = 0x8000
	movl	$8, %esi
	callq	calloc
	movq	%rax, %rbp
	movl	$32768, %edi                    # imm = 0x8000
	movl	$8, %esi
	callq	calloc
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	movl	$32768, %edi                    # imm = 0x8000
	movl	$8, %esi
	callq	calloc
	movq	%rax, (%rsp)                    # 8-byte Spill
	movl	$32768, %edi                    # imm = 0x8000
	movl	$8, %esi
	callq	calloc
	movq	%rax, %r13
	movl	$32768, %edi                    # imm = 0x8000
	movl	$8, %esi
	callq	calloc
	movq	%rax, %rbx
	xorl	%edi, %edi
	movdqa	.LCPI0_0(%rip), %xmm0           # xmm0 = [1127219200,1160773632,0,0]
	movapd	.LCPI0_1(%rip), %xmm1           # xmm1 = [4.503599627370496E+15,1.9342813113834067E+25]
	movabsq	$4607182418800017408, %rax      # imm = 0x3FF0000000000000
	xorl	%ecx, %ecx
.LBB0_1:                                # %.preheader116
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_2 Depth 2
                                        #       Child Loop BB0_3 Depth 3
	movq	%rcx, %xmm3
	punpckldq	%xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
	subpd	%xmm1, %xmm3
	movapd	%xmm3, %xmm2
	unpckhpd	%xmm3, %xmm2                    # xmm2 = xmm2[1],xmm3[1]
	addsd	%xmm3, %xmm2
	xorl	%esi, %esi
.LBB0_2:                                # %.preheader115
                                        #   Parent Loop BB0_1 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB0_3 Depth 3
	movq	%rdi, %rdx
	movq	%rsi, %xmm4
	punpckldq	%xmm0, %xmm4            # xmm4 = xmm4[0],xmm0[0],xmm4[1],xmm0[1]
	subpd	%xmm1, %xmm4
	movapd	%xmm4, %xmm3
	unpckhpd	%xmm4, %xmm3                    # xmm3 = xmm3[1],xmm4[1]
	addsd	%xmm4, %xmm3
	leaq	(%r14,%rdi,8), %rdi
	leaq	(%r12,%rdx,8), %r9
	leaq	(,%rdx,8), %r10
	addq	%rbp, %r10
	leaq	(%rbx,%rdx,8), %r11
	xorl	%r8d, %r8d
.LBB0_3:                                #   Parent Loop BB0_1 Depth=1
                                        #     Parent Loop BB0_2 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movsd	%xmm2, (%rdi,%r8,8)
	movsd	%xmm3, (%r9,%r8,8)
	movq	%r8, %xmm4
	punpckldq	%xmm0, %xmm4            # xmm4 = xmm4[0],xmm0[0],xmm4[1],xmm0[1]
	subpd	%xmm1, %xmm4
	movapd	%xmm4, %xmm5
	unpckhpd	%xmm4, %xmm5                    # xmm5 = xmm5[1],xmm4[1]
	addsd	%xmm4, %xmm5
	movsd	%xmm5, (%r10,%r8,8)
	movq	%rax, (%r11,%r8,8)
	incq	%r8
	cmpq	$32, %r8
	jne	.LBB0_3
# %bb.4:                                #   in Loop: Header=BB0_2 Depth=2
	incq	%rsi
	leaq	(%rdx,%r8), %rdi
	cmpq	$32, %rsi
	jne	.LBB0_2
# %bb.5:                                #   in Loop: Header=BB0_1 Depth=1
	incq	%rcx
	addq	%r8, %rdx
	movq	%rdx, %rdi
	cmpq	$32, %rcx
	jne	.LBB0_1
# %bb.6:
	xorl	%r15d, %r15d
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movq	8(%rsp), %rcx                   # 8-byte Reload
	movq	(%rsp), %rdx                    # 8-byte Reload
.LBB0_7:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_8 Depth 2
	xorl	%eax, %eax
.LBB0_8:                                #   Parent Loop BB0_7 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpq	%rax, %r15
	je	.LBB0_10
# %bb.9:                                #   in Loop: Header=BB0_8 Depth=2
	movsd	(%r14,%r15,8), %xmm1            # xmm1 = mem[0],zero
	subsd	(%r14,%rax,8), %xmm1
	movsd	(%r12,%r15,8), %xmm2            # xmm2 = mem[0],zero
	subsd	(%r12,%rax,8), %xmm2
	movsd	(%rbp,%r15,8), %xmm0            # xmm0 = mem[0],zero
	subsd	(%rbp,%rax,8), %xmm0
	movapd	%xmm1, %xmm3
	mulsd	%xmm1, %xmm3
	movapd	%xmm2, %xmm4
	mulsd	%xmm2, %xmm4
	addsd	%xmm3, %xmm4
	movapd	%xmm0, %xmm3
	mulsd	%xmm0, %xmm3
	addsd	%xmm4, %xmm3
	sqrtsd	%xmm3, %xmm3
	movsd	(%rbx,%r15,8), %xmm4            # xmm4 = mem[0],zero
	mulsd	%xmm4, %xmm1
	movsd	(%rbx,%rax,8), %xmm5            # xmm5 = mem[0],zero
	mulsd	%xmm5, %xmm1
	movapd	%xmm3, %xmm6
	mulsd	%xmm3, %xmm6
	mulsd	%xmm3, %xmm6
	divsd	%xmm6, %xmm1
	addsd	(%rcx,%r15,8), %xmm1
	mulsd	%xmm4, %xmm2
	mulsd	%xmm5, %xmm2
	divsd	%xmm6, %xmm2
	addsd	(%rdx,%r15,8), %xmm2
	movsd	%xmm1, (%rcx,%r15,8)
	movsd	%xmm2, (%rdx,%r15,8)
	mulsd	%xmm4, %xmm0
	mulsd	%xmm5, %xmm0
	divsd	%xmm6, %xmm0
	addsd	(%r13,%r15,8), %xmm0
	movsd	%xmm0, (%r13,%r15,8)
.LBB0_10:                               #   in Loop: Header=BB0_8 Depth=2
	incq	%rax
	cmpq	$32768, %rax                    # imm = 0x8000
	jne	.LBB0_8
# %bb.11:                               #   in Loop: Header=BB0_7 Depth=1
	incq	%r15
	cmpq	$32768, %r15                    # imm = 0x8000
	jne	.LBB0_7
# %bb.12:
	xorl	%ebx, %ebx
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	pxor	%xmm0, %xmm0
	movq	(%rsp), %rdx                    # 8-byte Reload
	movq	8(%rsp), %rcx                   # 8-byte Reload
.LBB0_13:                               # =>This Inner Loop Header: Depth=1
	movsd	(%rcx,%rbx,8), %xmm1            # xmm1 = mem[0],zero
	addsd	(%rdx,%rbx,8), %xmm1
	addsd	(%r13,%rbx,8), %xmm1
	addsd	%xmm1, %xmm0
	incq	%rbx
	cmpq	$32768, %rbx                    # imm = 0x8000
	jne	.LBB0_13
# %bb.14:
	movapd	.LCPI0_2(%rip), %xmm1           # xmm1 = [NaN,NaN]
	andpd	%xmm0, %xmm1
	ucomisd	.LCPI0_3(%rip), %xmm1
	ja	.LBB0_16
# %bb.15:
	subq	16(%rsp), %rax                  # 8-byte Folded Reload
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rax, %xmm0
	divsd	.LCPI0_4(%rip), %xmm0
	movl	$.L.str.1, %edi
	movb	$1, %al
	callq	printf
	xorl	%eax, %eax
	addq	$24, %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
.LBB0_16:
	.cfi_def_cfa_offset 80
	movl	$.L.str, %edi
	movb	$1, %al
	callq	printf
	movl	$-1, %edi
	callq	exit
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Verification Failed: Forces are not conserved! Sum: %.10f\n"
	.size	.L.str, 59

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Verification Passed! Time: %.8fs\n"
	.size	.L.str.1, 34

	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.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_

	.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
