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


// Constant values.
int NUM_PARTICLES  = 10000;
int NUM_ITERATIONS = 1000;
int BLOCK_SIZE     = 32;


// Data of a single particule.
struct Particle {
    float3 position;
    float3 velocity;
};


// Generate a random number between in range [a, b].
#define RAND_FLOAT(a,b) (a + (float)rand() / RAND_MAX * (b-a))

// Check if the given command has returned an error.
#define CUDA_CHECK(cmd) if ((cmd) != cudaSuccess) { \
    printf("ERROR: cuda error at line %d\n", __LINE__); abort(); }


// Initialize the array of particules.
Particle *CreateParticuleArray()
{
    srand(42);

    Particle *array;
    CUDA_CHECK(cudaMallocManaged(&array, sizeof(Particle) * NUM_PARTICLES));

    for (int index = 0; index < NUM_PARTICLES; index++) {
        array[index].velocity.x = RAND_FLOAT(1, 10);
        array[index].velocity.y = RAND_FLOAT(1, 20);
        array[index].velocity.z = RAND_FLOAT(5, 30);

        array[index].position.x = RAND_FLOAT(-100, 100);
        array[index].position.y = RAND_FLOAT(-100, 100);
        array[index].position.z = RAND_FLOAT(-100, 100);
    }

    return array;
}


// Update a particule by one single step.
__device__ void UpdateParticule(Particle &particule, const float3 &dvel)
{
    particule.velocity.x += dvel.x;
    particule.velocity.y += dvel.y;
    particule.velocity.z += dvel.z;

    particule.position.x += particule.velocity.x;
    particule.position.y += particule.velocity.y;
    particule.position.z += particule.velocity.z;
}


// GPU kernel for updating a particule by one single step.
__global__ void GpuUpdate(Particle *particules, int NUM_PARTICLES, float3 dvel)
{
    auto index = blockDim.x * blockIdx.x + threadIdx.x;
    if (index < NUM_PARTICLES)
        UpdateParticule(particules[index], dvel);
}


// Make all iterations on GPU.
void GpuInterations(Particle *array, float3 dvel)
{
    int num_blocks = (NUM_PARTICLES + BLOCK_SIZE - 1) / BLOCK_SIZE;

    for (int i = 0; i < NUM_ITERATIONS; i++) {
        GpuUpdate<<<num_blocks, BLOCK_SIZE>>>(array, NUM_PARTICLES, dvel);
        cudaDeviceSynchronize();  // Make sure the particules were updated.
    }
}


// Entry point of this program.
int main(int argc, const char **argv)
{
    // When the program is ran with -h, show usage.
    if (argc == 2 && !strcmp(argv[1], "-h")) {
        printf("Usage: ./exercise_2a [num particules] [num iterations] [block size]\n");
        exit(0);
    }

    // Read number of particules, number of iterations and block size.
    if (argc >= 2) NUM_PARTICLES  = atoi(argv[1]);
    if (argc >= 3) NUM_ITERATIONS = atoi(argv[2]);
    if (argc >= 4) BLOCK_SIZE     = atoi(argv[3]);

    // Velocity increment on each step.
    float3 dvel = make_float3(-1.f, 3.45f, 7.3f);


    // Run iterations on GPU.
    Particle *array = CreateParticuleArray();

    printf("\nStarting GPU test ...\n");
    auto start = std::chrono::system_clock::now();

    GpuInterations(array, dvel);

    auto end = std::chrono::system_clock::now();
    int ms = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
    printf("GPU time: %d ms\n\n", ms);
}

	.file	"tmpxft_002de63e_00000000-6_exercise_2b.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2134:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2134:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"ERROR: cuda error at line %d\n"
	.text
	.globl	_Z20CreateParticuleArrayv
	.type	_Z20CreateParticuleArrayv, @function
_Z20CreateParticuleArrayv:
.LFB2126:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	$42, %edi
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	call	srand@PLT
	movslq	NUM_PARTICLES(%rip), %rsi
	movq	%rsp, %rdi
	movl	$1, %edx
	imulq	$24, %rsi, %rsi
	call	cudaMallocManaged@PLT
	testl	%eax, %eax
	je	.L3
	movl	$32, %edx
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	abort@PLT
.L3:
	cmpl	%ebp, NUM_PARTICLES(%rip)
	jle	.L11
	call	rand@PLT
	imulq	$24, %rbp, %rbx
	incq	%rbp
	cvtsi2ssl	%eax, %xmm0
	mulss	.LC1(%rip), %xmm0
	movq	(%rsp), %rax
	mulss	.LC2(%rip), %xmm0
	addss	.LC3(%rip), %xmm0
	movss	%xmm0, 12(%rax,%rbx)
	call	rand@PLT
	cvtsi2ssl	%eax, %xmm0
	mulss	.LC1(%rip), %xmm0
	movq	(%rsp), %rax
	mulss	.LC4(%rip), %xmm0
	addss	.LC3(%rip), %xmm0
	movss	%xmm0, 16(%rax,%rbx)
	call	rand@PLT
	cvtsi2ssl	%eax, %xmm0
	mulss	.LC1(%rip), %xmm0
	movq	(%rsp), %rax
	mulss	.LC5(%rip), %xmm0
	addss	.LC6(%rip), %xmm0
	movss	%xmm0, 20(%rax,%rbx)
	call	rand@PLT
	cvtsi2ssl	%eax, %xmm0
	mulss	.LC1(%rip), %xmm0
	movq	(%rsp), %rax
	mulss	.LC7(%rip), %xmm0
	subss	.LC8(%rip), %xmm0
	movss	%xmm0, (%rax,%rbx)
	call	rand@PLT
	cvtsi2ssl	%eax, %xmm0
	mulss	.LC1(%rip), %xmm0
	movq	(%rsp), %rax
	mulss	.LC7(%rip), %xmm0
	subss	.LC8(%rip), %xmm0
	movss	%xmm0, 4(%rax,%rbx)
	call	rand@PLT
	cvtsi2ssl	%eax, %xmm0
	mulss	.LC1(%rip), %xmm0
	movq	(%rsp), %rax
	mulss	.LC7(%rip), %xmm0
	subss	.LC8(%rip), %xmm0
	movss	%xmm0, 8(%rax,%rbx)
	jmp	.L3
.L11:
	movq	(%rsp), %rax
	movq	8(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2126:
	.size	_Z20CreateParticuleArrayv, .-_Z20CreateParticuleArrayv
	.globl	_Z15UpdateParticuleR8ParticleRK6float3
	.type	_Z15UpdateParticuleR8ParticleRK6float3, @function
_Z15UpdateParticuleR8ParticleRK6float3:
.LFB2127:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE2127:
	.size	_Z15UpdateParticuleR8ParticleRK6float3, .-_Z15UpdateParticuleR8ParticleRK6float3
	.globl	_Z44__device_stub__Z9GpuUpdateP8Particlei6float3P8ParticleiR6float3
	.type	_Z44__device_stub__Z9GpuUpdateP8Particlei6float3P8ParticleiR6float3, @function
_Z44__device_stub__Z9GpuUpdateP8Particlei6float3P8ParticleiR6float3:
.LFB2156:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	24(%rsp), %rcx
	leaq	32(%rsp), %rdi
	movl	%esi, 4(%rsp)
	leaq	44(%rsp), %rsi
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movq	%rdx, 96(%rsp)
	leaq	16(%rsp), %rdx
	movq	%rax, 80(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 88(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 32(%rsp)
	movl	$1, 40(%rsp)
	movq	%rax, 44(%rsp)
	movl	$1, 52(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L14
	pushq	24(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z9GpuUpdateP8Particlei6float3(%rip), %rdi
	pushq	24(%rsp)
	.cfi_def_cfa_offset 144
	movq	60(%rsp), %rcx
	movl	68(%rsp), %r8d
	movq	48(%rsp), %rsi
	movl	56(%rsp), %edx
	leaq	96(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L14:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2156:
	.size	_Z44__device_stub__Z9GpuUpdateP8Particlei6float3P8ParticleiR6float3, .-_Z44__device_stub__Z9GpuUpdateP8Particlei6float3P8ParticleiR6float3
	.globl	_Z9GpuUpdateP8Particlei6float3
	.type	_Z9GpuUpdateP8Particlei6float3, @function
_Z9GpuUpdateP8Particlei6float3:
.LFB2157:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movq	%rsp, %rdx
	movq	%xmm0, (%rsp)
	movss	%xmm1, 8(%rsp)
	call	_Z44__device_stub__Z9GpuUpdateP8Particlei6float3P8ParticleiR6float3
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2157:
	.size	_Z9GpuUpdateP8Particlei6float3, .-_Z9GpuUpdateP8Particlei6float3
	.globl	_Z14GpuInterationsP8Particle6float3
	.type	_Z14GpuInterationsP8Particle6float3, @function
_Z14GpuInterationsP8Particle6float3:
.LFB2128:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movabsq	$4294967297, %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$72, %rsp
	.cfi_def_cfa_offset 112
	movl	BLOCK_SIZE(%rip), %ecx
	movq	%xmm0, (%rsp)
	movss	%xmm1, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	movl	NUM_PARTICLES(%rip), %eax
	addl	%ecx, %eax
	decl	%eax
	cltd
	idivl	%ecx
	movl	%eax, %ebx
.L21:
	cmpl	%ebp, NUM_ITERATIONS(%rip)
	jle	.L26
	movl	BLOCK_SIZE(%rip), %eax
	movl	%ebx, 20(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r13, 36(%rsp)
	movl	40(%rsp), %ecx
	movq	%r13, 24(%rsp)
	movq	20(%rsp), %rdi
	movl	%eax, 32(%rsp)
	movl	28(%rsp), %esi
	movq	32(%rsp), %rdx
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L22
	movq	(%rsp), %rax
	movl	NUM_PARTICLES(%rip), %esi
	leaq	44(%rsp), %rdx
	movq	%r12, %rdi
	movq	%rax, 44(%rsp)
	movl	8(%rsp), %eax
	movl	%eax, 52(%rsp)
	call	_Z44__device_stub__Z9GpuUpdateP8Particlei6float3P8ParticleiR6float3
.L22:
	call	cudaDeviceSynchronize@PLT
	incl	%ebp
	jmp	.L21
.L26:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	addq	$72, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2128:
	.size	_Z14GpuInterationsP8Particle6float3, .-_Z14GpuInterationsP8Particle6float3
	.section	.rodata.str1.1
.LC9:
	.string	"-h"
.LC10:
	.string	"Usage: ./exercise_2a [num particules] [num iterations] [block size]\n"
.LC12:
	.string	"\nStarting GPU test ...\n"
.LC13:
	.string	"GPU time: %d ms\n\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2129:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%edi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rsi, %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	cmpl	$2, %edi
	jne	.L28
	movq	8(%rsi), %rdi
	leaq	.LC9(%rip), %rsi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L29
	movl	$2, %edi
	leaq	.LC10(%rip), %rsi
	call	__printf_chk@PLT
	xorl	%edi, %edi
	call	exit@PLT
.L28:
	cmpl	$1, %edi
	jle	.L30
.L29:
	movq	8(%rbx), %rdi
	call	atoi@PLT
	movl	%eax, NUM_PARTICLES(%rip)
	cmpl	$2, %ebp
	je	.L30
	movq	16(%rbx), %rdi
	call	atoi@PLT
	movl	%eax, NUM_ITERATIONS(%rip)
	cmpl	$3, %ebp
	je	.L30
	movq	24(%rbx), %rdi
	call	atoi@PLT
	movl	%eax, BLOCK_SIZE(%rip)
.L30:
	movabsq	$4637806900337967104, %rax
	movl	$0x40e9999a, 12(%rsp)
	movq	%rax, 4(%rsp)
	call	_Z20CreateParticuleArrayv
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	movq	%rax, %rbp
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	movq	4(%rsp), %xmm0
	movss	12(%rsp), %xmm1
	movq	%rbp, %rdi
	movq	%rax, %rbx
	call	_Z14GpuInterationsP8Particle6float3
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	movl	$1000000, %ecx
	movl	$2, %edi
	leaq	.LC13(%rip), %rsi
	subq	%rbx, %rax
	cqto
	idivq	%rcx
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2129:
	.size	main, .-main
	.section	.rodata.str1.1
.LC14:
	.string	"_Z9GpuUpdateP8Particlei6float3"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2159:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC14(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z9GpuUpdateP8Particlei6float3(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2159:
	.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
	.globl	BLOCK_SIZE
	.data
	.align 4
	.type	BLOCK_SIZE, @object
	.size	BLOCK_SIZE, 4
BLOCK_SIZE:
	.long	32
	.globl	NUM_ITERATIONS
	.align 4
	.type	NUM_ITERATIONS, @object
	.size	NUM_ITERATIONS, 4
NUM_ITERATIONS:
	.long	1000
	.globl	NUM_PARTICLES
	.align 4
	.type	NUM_PARTICLES, @object
	.size	NUM_PARTICLES, 4
NUM_PARTICLES:
	.long	10000
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC1:
	.long	805306368
	.align 4
.LC2:
	.long	1091567616
	.align 4
.LC3:
	.long	1065353216
	.align 4
.LC4:
	.long	1100480512
	.align 4
.LC5:
	.long	1103626240
	.align 4
.LC6:
	.long	1084227584
	.align 4
.LC7:
	.long	1128792064
	.align 4
.LC8:
	.long	1120403456
	.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:


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


// Constant values.
int NUM_PARTICLES  = 10000;
int NUM_ITERATIONS = 1000;
int BLOCK_SIZE     = 32;


// Data of a single particule.
struct Particle {
    float3 position;
    float3 velocity;
};


// Generate a random number between in range [a, b].
#define RAND_FLOAT(a,b) (a + (float)rand() / RAND_MAX * (b-a))

// Check if the given command has returned an error.
#define CUDA_CHECK(cmd) if ((cmd) != hipSuccess) { \
    printf("ERROR: cuda error at line %d\n", __LINE__); abort(); }


// Initialize the array of particules.
Particle *CreateParticuleArray()
{
    srand(42);

    Particle *array;
    CUDA_CHECK(hipMallocManaged(&array, sizeof(Particle) * NUM_PARTICLES));

    for (int index = 0; index < NUM_PARTICLES; index++) {
        array[index].velocity.x = RAND_FLOAT(1, 10);
        array[index].velocity.y = RAND_FLOAT(1, 20);
        array[index].velocity.z = RAND_FLOAT(5, 30);

        array[index].position.x = RAND_FLOAT(-100, 100);
        array[index].position.y = RAND_FLOAT(-100, 100);
        array[index].position.z = RAND_FLOAT(-100, 100);
    }

    return array;
}


// Update a particule by one single step.
__device__ void UpdateParticule(Particle &particule, const float3 &dvel)
{
    particule.velocity.x += dvel.x;
    particule.velocity.y += dvel.y;
    particule.velocity.z += dvel.z;

    particule.position.x += particule.velocity.x;
    particule.position.y += particule.velocity.y;
    particule.position.z += particule.velocity.z;
}


// GPU kernel for updating a particule by one single step.
__global__ void GpuUpdate(Particle *particules, int NUM_PARTICLES, float3 dvel)
{
    auto index = blockDim.x * blockIdx.x + threadIdx.x;
    if (index < NUM_PARTICLES)
        UpdateParticule(particules[index], dvel);
}


// Make all iterations on GPU.
void GpuInterations(Particle *array, float3 dvel)
{
    int num_blocks = (NUM_PARTICLES + BLOCK_SIZE - 1) / BLOCK_SIZE;

    for (int i = 0; i < NUM_ITERATIONS; i++) {
        GpuUpdate<<<num_blocks, BLOCK_SIZE>>>(array, NUM_PARTICLES, dvel);
        hipDeviceSynchronize();  // Make sure the particules were updated.
    }
}


// Entry point of this program.
int main(int argc, const char **argv)
{
    // When the program is ran with -h, show usage.
    if (argc == 2 && !strcmp(argv[1], "-h")) {
        printf("Usage: ./exercise_2a [num particules] [num iterations] [block size]\n");
        exit(0);
    }

    // Read number of particules, number of iterations and block size.
    if (argc >= 2) NUM_PARTICLES  = atoi(argv[1]);
    if (argc >= 3) NUM_ITERATIONS = atoi(argv[2]);
    if (argc >= 4) BLOCK_SIZE     = atoi(argv[3]);

    // Velocity increment on each step.
    float3 dvel = make_float3(-1.f, 3.45f, 7.3f);


    // Run iterations on GPU.
    Particle *array = CreateParticuleArray();

    printf("\nStarting GPU test ...\n");
    auto start = std::chrono::system_clock::now();

    GpuInterations(array, dvel);

    auto end = std::chrono::system_clock::now();
    int ms = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
    printf("GPU time: %d ms\n\n", ms);
}

	.text
	.file	"exercise_2b.hip"
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z20CreateParticuleArrayv
.LCPI0_0:
	.long	0x30000000                      # float 4.65661287E-10
.LCPI0_1:
	.long	0x41100000                      # float 9
.LCPI0_2:
	.long	0x3f800000                      # float 1
.LCPI0_3:
	.long	0x41980000                      # float 19
.LCPI0_4:
	.long	0x41c80000                      # float 25
.LCPI0_5:
	.long	0x40a00000                      # float 5
.LCPI0_6:
	.long	0x43480000                      # float 200
.LCPI0_7:
	.long	0xc2c80000                      # float -100
	.text
	.globl	_Z20CreateParticuleArrayv
	.type	_Z20CreateParticuleArrayv,@function
_Z20CreateParticuleArrayv:              # @_Z20CreateParticuleArrayv
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movl	$42, %edi
	callq	srand
	movslq	NUM_PARTICLES(%rip), %rax
	shlq	$3, %rax
	leaq	(%rax,%rax,2), %rsi
	movq	%rsp, %rdi
	movl	$1, %edx
	callq	hipMallocManaged
	testl	%eax, %eax
	jne	.LBB0_5
# %bb.1:                                # %.preheader
	cmpl	$0, NUM_PARTICLES(%rip)
	jle	.LBB0_4
# %bb.2:                                # %.lr.ph.preheader
	xorl	%ebx, %ebx
	xorl	%r14d, %r14d
.LBB0_3:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	.LCPI0_0(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	mulss	%xmm1, %xmm0
	mulss	.LCPI0_1(%rip), %xmm0
	movss	.LCPI0_2(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	addss	%xmm1, %xmm0
	movq	(%rsp), %rax
	movss	%xmm0, 12(%rax,%rbx)
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	mulss	.LCPI0_0(%rip), %xmm0
	mulss	.LCPI0_3(%rip), %xmm0
	addss	.LCPI0_2(%rip), %xmm0
	movq	(%rsp), %rax
	movss	%xmm0, 16(%rax,%rbx)
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	mulss	.LCPI0_0(%rip), %xmm0
	mulss	.LCPI0_4(%rip), %xmm0
	addss	.LCPI0_5(%rip), %xmm0
	movq	(%rsp), %rax
	movss	%xmm0, 20(%rax,%rbx)
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	mulss	.LCPI0_0(%rip), %xmm0
	movss	.LCPI0_6(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	mulss	%xmm1, %xmm0
	movss	.LCPI0_7(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	addss	%xmm1, %xmm0
	movq	(%rsp), %rax
	movss	%xmm0, (%rax,%rbx)
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	mulss	.LCPI0_0(%rip), %xmm0
	mulss	.LCPI0_6(%rip), %xmm0
	addss	.LCPI0_7(%rip), %xmm0
	movq	(%rsp), %rax
	movss	%xmm0, 4(%rax,%rbx)
	callq	rand
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	mulss	.LCPI0_0(%rip), %xmm0
	mulss	.LCPI0_6(%rip), %xmm0
	addss	.LCPI0_7(%rip), %xmm0
	movq	(%rsp), %rax
	movss	%xmm0, 8(%rax,%rbx)
	incq	%r14
	movslq	NUM_PARTICLES(%rip), %rax
	addq	$24, %rbx
	cmpq	%rax, %r14
	jl	.LBB0_3
.LBB0_4:                                # %._crit_edge
	movq	(%rsp), %rax
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.LBB0_5:
	.cfi_def_cfa_offset 32
	movl	$.L.str, %edi
	movl	$34, %esi
	xorl	%eax, %eax
	callq	printf
	callq	abort
.Lfunc_end0:
	.size	_Z20CreateParticuleArrayv, .Lfunc_end0-_Z20CreateParticuleArrayv
	.cfi_endproc
                                        # -- End function
	.globl	_Z24__device_stub__GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE # -- Begin function _Z24__device_stub__GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE
	.type	_Z24__device_stub__GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE,@function
_Z24__device_stub__GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE: # @_Z24__device_stub__GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	64(%rsp), %rax
	movlps	%xmm0, (%rax)
	movss	%xmm1, 8(%rax)
	leaq	24(%rsp), %rcx
	movq	%rdi, (%rcx)
	leaq	4(%rsp), %rdx
	movl	%esi, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rcx, (%rbx)
	movq	%rdx, 8(%rbx)
	movq	%rax, 16(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.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
	retq
.Lfunc_end1:
	.size	_Z24__device_stub__GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE, .Lfunc_end1-_Z24__device_stub__GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE
	.cfi_endproc
                                        # -- End function
	.globl	_Z14GpuInterationsP8Particle15HIP_vector_typeIfLj3EE # -- Begin function _Z14GpuInterationsP8Particle15HIP_vector_typeIfLj3EE
	.type	_Z14GpuInterationsP8Particle15HIP_vector_typeIfLj3EE,@function
_Z14GpuInterationsP8Particle15HIP_vector_typeIfLj3EE: # @_Z14GpuInterationsP8Particle15HIP_vector_typeIfLj3EE
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	subq	$40, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movss	%xmm1, 12(%rsp)                 # 4-byte Spill
	movaps	%xmm0, 16(%rsp)                 # 16-byte Spill
	cmpl	$0, NUM_ITERATIONS(%rip)
	jle	.LBB2_5
# %bb.1:                                # %.lr.ph
	movq	%rdi, %rbx
	movabsq	$4294967296, %r15               # imm = 0x100000000
	movl	NUM_PARTICLES(%rip), %eax
	movl	BLOCK_SIZE(%rip), %ecx
	addl	%ecx, %eax
	decl	%eax
	cltd
	idivl	%ecx
	movl	%eax, %r14d
	btsq	$32, %r14
	xorl	%r12d, %r12d
.LBB2_2:                                # =>This Inner Loop Header: Depth=1
	movl	BLOCK_SIZE(%rip), %edx
	orq	%r15, %rdx
	movq	%r14, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_4
# %bb.3:                                #   in Loop: Header=BB2_2 Depth=1
	movl	NUM_PARTICLES(%rip), %esi
	movq	%rbx, %rdi
	movaps	16(%rsp), %xmm0                 # 16-byte Reload
	movss	12(%rsp), %xmm1                 # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	callq	_Z24__device_stub__GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE
.LBB2_4:                                #   in Loop: Header=BB2_2 Depth=1
	callq	hipDeviceSynchronize
	incl	%r12d
	cmpl	NUM_ITERATIONS(%rip), %r12d
	jl	.LBB2_2
.LBB2_5:                                # %._crit_edge
	addq	$40, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z14GpuInterationsP8Particle15HIP_vector_typeIfLj3EE, .Lfunc_end2-_Z14GpuInterationsP8Particle15HIP_vector_typeIfLj3EE
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function main
.LCPI3_0:
	.long	0xbf800000                      # float -1
	.long	0x405ccccd                      # float 3.45000005
	.zero	4
	.zero	4
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0
.LCPI3_1:
	.long	0x40e9999a                      # float 7.30000019
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %rbx
	cmpl	$2, %edi
	jne	.LBB3_3
# %bb.1:
	movq	8(%rbx), %rbx
	movl	$.L.str.1, %esi
	movq	%rbx, %rdi
	callq	strcmp
	movl	$NUM_PARTICLES, %r14d
	testl	%eax, %eax
	jne	.LBB3_6
# %bb.2:
	movl	$.Lstr, %edi
	callq	puts@PLT
	xorl	%edi, %edi
	callq	exit
.LBB3_3:
	jl	.LBB3_7
# %bb.4:
	movl	%edi, %ebp
	movq	8(%rbx), %rdi
	callq	atoi
	movl	%eax, NUM_PARTICLES(%rip)
	movq	16(%rbx), %rdi
	callq	atoi
	movl	%eax, NUM_ITERATIONS(%rip)
	cmpl	$3, %ebp
	je	.LBB3_7
# %bb.5:
	movq	24(%rbx), %rbx
	movl	$BLOCK_SIZE, %r14d
.LBB3_6:                                # %.thread20.sink.split
	movq	%rbx, %rdi
	callq	atoi
	movl	%eax, (%r14)
.LBB3_7:                                # %.thread20
	callq	_Z20CreateParticuleArrayv
	movq	%rax, %rbx
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	movq	%rax, %r14
	movaps	.LCPI3_0(%rip), %xmm0           # xmm0 = <-1.0E+0,3.45000005E+0,u,u>
	movss	.LCPI3_1(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	movq	%rbx, %rdi
	callq	_Z14GpuInterationsP8Particle15HIP_vector_typeIfLj3EE
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	subq	%r14, %rax
	movabsq	$4835703278458516699, %rcx      # imm = 0x431BDE82D7B634DB
	imulq	%rcx
	movq	%rdx, %rsi
	shrq	$63, %rsi
	shrq	$18, %rdx
	addl	%edx, %esi
	movl	$.L.str.4, %edi
                                        # kill: def $esi killed $esi killed $rsi
	xorl	%eax, %eax
	callq	printf
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	main, .Lfunc_end3-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB4_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB4_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end4:
	.size	__hip_module_ctor, .Lfunc_end4-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB5_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB5_2:
	retq
.Lfunc_end5:
	.size	__hip_module_dtor, .Lfunc_end5-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	NUM_PARTICLES,@object           # @NUM_PARTICLES
	.data
	.globl	NUM_PARTICLES
	.p2align	2, 0x0
NUM_PARTICLES:
	.long	10000                           # 0x2710
	.size	NUM_PARTICLES, 4

	.type	NUM_ITERATIONS,@object          # @NUM_ITERATIONS
	.globl	NUM_ITERATIONS
	.p2align	2, 0x0
NUM_ITERATIONS:
	.long	1000                            # 0x3e8
	.size	NUM_ITERATIONS, 4

	.type	BLOCK_SIZE,@object              # @BLOCK_SIZE
	.globl	BLOCK_SIZE
	.p2align	2, 0x0
BLOCK_SIZE:
	.long	32                              # 0x20
	.size	BLOCK_SIZE, 4

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"ERROR: cuda error at line %d\n"
	.size	.L.str, 30

	.type	_Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE,@object # @_Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE
	.section	.rodata,"a",@progbits
	.globl	_Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE
	.p2align	3, 0x0
_Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE:
	.quad	_Z24__device_stub__GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE
	.size	_Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE, 8

	.type	.L.str.1,@object                # @.str.1
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.1:
	.asciz	"-h"
	.size	.L.str.1, 3

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"GPU time: %d ms\n\n"
	.size	.L.str.4, 18

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE"
	.size	.L__unnamed_1, 48

	.type	__hip_fatbin_wrapper,@object    # @__hip_fatbin_wrapper
	.section	.hipFatBinSegment,"a",@progbits
	.p2align	3, 0x0
__hip_fatbin_wrapper:
	.long	1212764230                      # 0x48495046
	.long	1                               # 0x1
	.quad	__hip_fatbin
	.quad	0
	.size	__hip_fatbin_wrapper, 24

	.type	__hip_gpubin_handle,@object     # @__hip_gpubin_handle
	.local	__hip_gpubin_handle
	.comm	__hip_gpubin_handle,8,8
	.section	.init_array,"aw",@init_array
	.p2align	3, 0x0
	.quad	__hip_module_ctor
	.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	"Usage: ./exercise_2a [num particules] [num iterations] [block size]"
	.size	.Lstr, 68

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"\nStarting GPU test ..."
	.size	.Lstr.1, 23

	.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 _Z24__device_stub__GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE ; -- Begin function _Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE
	.globl	_Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE
	.p2align	8
	.type	_Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE,@function
_Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE: ; @_Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b32 s3, s[0:1], 0x8
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_u32_e64 s3, v1
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_clause 0x1
	s_load_b64 s[4:5], s[0:1], 0x0
	s_load_b128 s[0:3], s[0:1], 0xc
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[4:5], null, v1, 24, s[4:5]
	s_clause 0x1
	global_load_b128 v[0:3], v[4:5], off
	global_load_b64 v[6:7], v[4:5], off offset:16
	s_waitcnt vmcnt(0)
	v_dual_add_f32 v3, s0, v3 :: v_dual_add_f32 v6, s1, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_add_f32 v7, s2, v7 :: v_dual_add_f32 v0, v3, v0
	v_dual_add_f32 v1, v6, v1 :: v_dual_add_f32 v2, v7, v2
	s_clause 0x1
	global_store_b64 v[4:5], v[6:7], off offset:16
	global_store_b128 v[4:5], v[0:3], off
.LBB0_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 8
		.amdhsa_next_free_sgpr 16
		.amdhsa_reserve_vcc 0
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE, .Lfunc_end0-_Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 176
; NumSgprs: 16
; NumVgprs: 8
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 1
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 16
; NumVGPRsForWavesPerEU: 8
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.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_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           12
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE
    .private_segment_fixed_size: 0
    .sgpr_count:     16
    .sgpr_spill_count: 0
    .symbol:         _Z9GpuUpdateP8Particlei15HIP_vector_typeIfLj3EE.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     8
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
