#include <stdio.h>
#include<stdlib.h>
#include<string.h>

#include "cuda_runtime.h"
#include "device_launch_parameters.h"


#define BLOCK_SIZE 1024
#define SECTION_SIZE 2*BLOCK_SIZE

__global__ void 
	listScanKernel(float * input, float * output, int len)
{
	__shared__ float list[SECTION_SIZE];
	unsigned int t = threadIdx.x;
	unsigned int start = blockIdx.x*blockDim.x;

	list[t] = ((t+start) < len ) ? input[t+start]:0.0f;
	list[t+blockDim.x] = ((start+t+blockDim.x) < len) ? input[start+t+blockDim.x]:0.0f;
 	
	for(unsigned int stride =1;stride<= BLOCK_SIZE; stride*=2)
	{
		int index = (t+1)*stride*2-1;
		if(index<SECTION_SIZE)
			list[index]+=list[index-stride];
		__syncthreads();
	}
	
	for(unsigned int stride = BLOCK_SIZE/2;stride>0;stride/=2)
	{
		__syncthreads();
		int index = (t+1)*stride*2-1;
		if(index+stride < SECTION_SIZE )
			list[index+stride]+=list[index];
	}
	
	__syncthreads();
	if(t+start < len)
		output[t+start] = list[t];
	
}
__global__ void
	loadSumArrayKernel(float *input, float *sumArray, int len)
{
	unsigned int t = threadIdx.x;
	unsigned int start = blockIdx.x*blockDim.x;
	unsigned int lastBlockId = (len-1)/BLOCK_SIZE;
	unsigned int lastThreadIdx = (len%BLOCK_SIZE-1);
	if(t+start<len)
	{
		if(blockIdx.x == lastBlockId)
			sumArray[blockIdx.x] = input[lastThreadIdx+start];
		else
		sumArray[blockIdx.x] = input[start+blockDim.x-1];
	}
}
__global__ void
	listScanSumKernel(float *input, float *output,int len)
{
	__shared__ float sumArray[SECTION_SIZE];
	unsigned int t = threadIdx.x;
	unsigned int start = blockIdx.x*blockDim.x;
	
	if(t+start<len && blockIdx.x>0)
	{
		
		output[t+start]+=input[blockIdx.x-1];
		__syncthreads();
	}
	
}

void totalCPU(float * input, float * output, int len)
{
	int i=0;
	output[0]=input[0];
	for(i=1;i<len;i++)
		output[i] = output[i-1]+input[i];

	printf("\n*****CPU calculation******\n");

}
void loadValue(char *FileInput,int len,float *a,float *b)
{
	FILE *file;
	int i=0;
	char buff[100];
	memset(b,0,len);

	file = fopen(FileInput,"r");
	if(!file)
	{
		printf("\nNo file found!");
		system("pause");
		exit(0);
	}

	while(fgets(buff,len,file))
	{
		a[i] = atof(buff);
		i++;
	}

	fclose(file);

}
void storeResult(char *fileOutput,float *arr,unsigned int len)
{
	FILE *file;
	int count=0;

	file = fopen(fileOutput,"w");
	if(!file)
	{
		printf("\nCannot create file!");
		system("pause");
		exit(0);
	}
	fprintf(file,"%d\n",len);
	for(count =0 ;count<len;count++)
	{
		fprintf(file,"%.0f\n",arr[count]);
	}
	fclose(file);
}
void dispRes(float *arr,int len)
{
	int i=0;
	printf("result = ");
	for(i=0;i<len;i++)
		printf("%4.0f ",arr[i]);	
	system("pause");
}
int main(int argc,char*argv[])
{
	float * hostInput; // The input 1D list
    float * hostOutput; // The output list
    float * deviceInput;
	float *deviceSumArray;
	float *deviceSumArrayOutput;
    float * deviceOutput;
    int numElements = (int) (atoi)(argv[3]); // number of elements in the input list

	hostInput = (float*)malloc(numElements*sizeof(float));
	hostOutput = (float*)malloc(numElements*sizeof(float));	

	//cuda memory allocation on the device
	cudaMalloc((void**)&deviceInput,numElements*sizeof(float));
	cudaMalloc((void**)&deviceOutput,numElements*sizeof(float));
	cudaMalloc((void**)&deviceSumArray,numElements*sizeof(float));
	cudaMalloc((void**)&deviceSumArrayOutput,numElements*sizeof(float));

	printf("Loading values to the array...\n");
	loadValue(argv[1],numElements,hostInput,hostOutput);

	//cuda memory copy from host to device
	cudaMemcpy(deviceInput,hostInput,numElements*sizeof(float),cudaMemcpyHostToDevice);

	//CPU equivalent
	totalCPU(hostInput,hostOutput,numElements);
	dispRes(hostOutput,numElements);

	printf("Calling CUDA kernel...\n");
	dim3 DimGrid((numElements-1)/BLOCK_SIZE+1,1,1);
	dim3 DimBlock(BLOCK_SIZE,1,1);	
	listScanKernel<<<DimGrid,DimBlock>>>(deviceInput,deviceOutput,numElements);
	loadSumArrayKernel<<<DimGrid,DimBlock>>>(deviceOutput,deviceSumArray,numElements);
	listScanKernel<<<DimGrid,DimBlock>>>(deviceSumArray,deviceSumArrayOutput,numElements);
	listScanSumKernel<<<DimGrid,DimBlock>>>(deviceSumArrayOutput,deviceOutput,numElements);

	//cuda memory copy from device to host
	cudaMemcpy(hostOutput,deviceOutput,numElements*sizeof(float),cudaMemcpyDeviceToHost);

	dispRes(hostOutput,numElements);

	storeResult(argv[2],hostOutput,numElements);

	free(hostInput);
	free(hostOutput);


	cudaFree(deviceInput);
	cudaFree(deviceOutput);
	return 0;

}

	.file	"tmpxft_0030bc17_00000000-6_kernel.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2034:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2034:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"\n*****CPU calculation******\n"
	.text
	.globl	_Z8totalCPUPfS_i
	.type	_Z8totalCPUPfS_i, @function
_Z8totalCPUPfS_i:
.LFB2027:
	.cfi_startproc
	endbr64
	movss	(%rdi), %xmm0
	xorl	%eax, %eax
	movss	%xmm0, (%rsi)
.L3:
	incq	%rax
	cmpl	%eax, %edx
	jle	.L6
	movss	-4(%rsi,%rax,4), %xmm0
	addss	(%rdi,%rax,4), %xmm0
	movss	%xmm0, (%rsi,%rax,4)
	jmp	.L3
.L6:
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2027:
	.size	_Z8totalCPUPfS_i, .-_Z8totalCPUPfS_i
	.section	.rodata.str1.1
.LC1:
	.string	"r"
.LC2:
	.string	"\nNo file found!"
.LC3:
	.string	"pause"
	.text
	.globl	_Z9loadValuePciPfS0_
	.type	_Z9loadValuePciPfS0_, @function
_Z9loadValuePciPfS0_:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rdi, %r8
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	%esi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdx, %rbx
	movq	%rcx, %rdx
	movslq	%esi, %rcx
	movq	%rdx, %rdi
	leaq	.LC1(%rip), %rsi
	subq	$120, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	rep stosb
	movq	%r8, %rdi
	call	fopen@PLT
	testq	%rax, %rax
	je	.L8
	movq	%rax, %rbp
	leaq	4(%rsp), %r13
	jmp	.L9
.L8:
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC3(%rip), %rdi
	call	system@PLT
	xorl	%edi, %edi
	call	exit@PLT
.L9:
	movq	%rbp, %rcx
	movl	%r12d, %edx
	movl	$100, %esi
	movq	%r13, %rdi
	call	__fgets_chk@PLT
	testq	%rax, %rax
	je	.L13
	movq	%r13, %rdi
	addq	$4, %rbx
	call	atof@PLT
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, -4(%rbx)
	jmp	.L9
.L13:
	movq	%rbp, %rdi
	call	fclose@PLT
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	addq	$120, %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
.LFE2028:
	.size	_Z9loadValuePciPfS0_, .-_Z9loadValuePciPfS0_
	.section	.rodata.str1.1
.LC4:
	.string	"w"
.LC5:
	.string	"\nCannot create file!"
.LC6:
	.string	"%d\n"
.LC7:
	.string	"%.0f\n"
	.text
	.globl	_Z11storeResultPcPfj
	.type	_Z11storeResultPcPfj, @function
_Z11storeResultPcPfj:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rsi, %r13
	leaq	.LC4(%rip), %rsi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movl	%edx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	call	fopen@PLT
	testq	%rax, %rax
	jne	.L15
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC3(%rip), %rdi
	call	system@PLT
	xorl	%edi, %edi
	call	exit@PLT
.L15:
	movq	%rax, %rdi
	movq	%rax, %rbx
	movl	%ebp, %ecx
	movl	$2, %esi
	leaq	.LC6(%rip), %rdx
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	call	__fprintf_chk@PLT
	leaq	.LC7(%rip), %r14
.L16:
	cmpq	%rbp, %r12
	je	.L19
	movq	%r14, %rdx
	movl	$2, %esi
	movq	%rbx, %rdi
	movb	$1, %al
	cvtss2sd	0(%r13,%r12,4), %xmm0
	call	__fprintf_chk@PLT
	incq	%r12
	jmp	.L16
.L19:
	movq	%rbx, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	fclose@PLT
	.cfi_endproc
.LFE2029:
	.size	_Z11storeResultPcPfj, .-_Z11storeResultPcPfj
	.section	.rodata.str1.1
.LC8:
	.string	"result = "
.LC9:
	.string	"%4.0f "
	.text
	.globl	_Z7dispResPfi
	.type	_Z7dispResPfi, @function
_Z7dispResPfi:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	xorl	%eax, %eax
	leaq	.LC9(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdi, %r12
	movl	$2, %edi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	%esi, %ebp
	leaq	.LC8(%rip), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	xorl	%ebx, %ebx
	pushq	%rdx
	.cfi_def_cfa_offset 48
	call	__printf_chk@PLT
.L21:
	cmpl	%ebx, %ebp
	jle	.L24
	movq	%r13, %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	(%r12,%rbx,4), %xmm0
	call	__printf_chk@PLT
	incq	%rbx
	jmp	.L21
.L24:
	popq	%rax
	.cfi_def_cfa_offset 40
	leaq	.LC3(%rip), %rdi
	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
	jmp	system@PLT
	.cfi_endproc
.LFE2030:
	.size	_Z7dispResPfi, .-_Z7dispResPfi
	.globl	_Z37__device_stub__Z14listScanKernelPfS_iPfS_i
	.type	_Z37__device_stub__Z14listScanKernelPfS_iPfS_i, @function
_Z37__device_stub__Z14listScanKernelPfS_iPfS_i:
.LFB2056:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L25
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z14listScanKernelPfS_i(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L25:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2056:
	.size	_Z37__device_stub__Z14listScanKernelPfS_iPfS_i, .-_Z37__device_stub__Z14listScanKernelPfS_iPfS_i
	.globl	_Z14listScanKernelPfS_i
	.type	_Z14listScanKernelPfS_i, @function
_Z14listScanKernelPfS_i:
.LFB2057:
	.cfi_startproc
	endbr64
	jmp	_Z37__device_stub__Z14listScanKernelPfS_iPfS_i
	.cfi_endproc
.LFE2057:
	.size	_Z14listScanKernelPfS_i, .-_Z14listScanKernelPfS_i
	.globl	_Z41__device_stub__Z18loadSumArrayKernelPfS_iPfS_i
	.type	_Z41__device_stub__Z18loadSumArrayKernelPfS_iPfS_i, @function
_Z41__device_stub__Z18loadSumArrayKernelPfS_iPfS_i:
.LFB2058:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L30
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z18loadSumArrayKernelPfS_i(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L30:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2058:
	.size	_Z41__device_stub__Z18loadSumArrayKernelPfS_iPfS_i, .-_Z41__device_stub__Z18loadSumArrayKernelPfS_iPfS_i
	.globl	_Z18loadSumArrayKernelPfS_i
	.type	_Z18loadSumArrayKernelPfS_i, @function
_Z18loadSumArrayKernelPfS_i:
.LFB2059:
	.cfi_startproc
	endbr64
	jmp	_Z41__device_stub__Z18loadSumArrayKernelPfS_iPfS_i
	.cfi_endproc
.LFE2059:
	.size	_Z18loadSumArrayKernelPfS_i, .-_Z18loadSumArrayKernelPfS_i
	.globl	_Z40__device_stub__Z17listScanSumKernelPfS_iPfS_i
	.type	_Z40__device_stub__Z17listScanSumKernelPfS_iPfS_i, @function
_Z40__device_stub__Z17listScanSumKernelPfS_iPfS_i:
.LFB2060:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L35
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z17listScanSumKernelPfS_i(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L35:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L37
	call	__stack_chk_fail@PLT
.L37:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2060:
	.size	_Z40__device_stub__Z17listScanSumKernelPfS_iPfS_i, .-_Z40__device_stub__Z17listScanSumKernelPfS_iPfS_i
	.globl	_Z17listScanSumKernelPfS_i
	.type	_Z17listScanSumKernelPfS_i, @function
_Z17listScanSumKernelPfS_i:
.LFB2061:
	.cfi_startproc
	endbr64
	jmp	_Z40__device_stub__Z17listScanSumKernelPfS_iPfS_i
	.cfi_endproc
.LFE2061:
	.size	_Z17listScanSumKernelPfS_i, .-_Z17listScanSumKernelPfS_i
	.section	.rodata.str1.1
.LC10:
	.string	"Loading values to the array...\n"
.LC11:
	.string	"Calling CUDA kernel...\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$64, %rsp
	.cfi_def_cfa_offset 112
	movq	24(%rsi), %rdi
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	call	atoi@PLT
	movslq	%eax, %rbp
	movq	%rbp, %rbx
	salq	$2, %rbp
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, %r13
	call	malloc@PLT
	movq	%rsp, %rdi
	movq	%rbp, %rsi
	movq	%rax, %r12
	call	cudaMalloc@PLT
	leaq	24(%rsp), %rdi
	movq	%rbp, %rsi
	call	cudaMalloc@PLT
	leaq	8(%rsp), %rdi
	movq	%rbp, %rsi
	call	cudaMalloc@PLT
	leaq	16(%rsp), %rdi
	movq	%rbp, %rsi
	call	cudaMalloc@PLT
	leaq	.LC10(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	8(%r14), %rdi
	movq	%r12, %rcx
	movq	%r13, %rdx
	movl	%ebx, %esi
	call	_Z9loadValuePciPfS0_
	movq	(%rsp), %rdi
	movq	%rbp, %rdx
	movq	%r13, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	%ebx, %edx
	movq	%r12, %rsi
	movq	%r13, %rdi
	call	_Z8totalCPUPfS_i
	movl	%ebx, %esi
	movq	%r12, %rdi
	call	_Z7dispResPfi
	leaq	.LC11(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leal	-1(%rbx), %eax
	movl	$1024, %ecx
	xorl	%r9d, %r9d
	cltd
	xorl	%r8d, %r8d
	movl	$1, 52(%rsp)
	idivl	%ecx
	movl	$4194305, %edx
	movl	$1, %ecx
	salq	$10, %rdx
	movq	%rdx, 44(%rsp)
	incl	%eax
	movl	%eax, 32(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 36(%rsp)
	movq	32(%rsp), %rdi
	movl	40(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L41
	movq	24(%rsp), %rsi
	movq	(%rsp), %rdi
	movl	%ebx, %edx
	call	_Z37__device_stub__Z14listScanKernelPfS_iPfS_i
.L41:
	movl	52(%rsp), %ecx
	movq	44(%rsp), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	32(%rsp), %rdi
	movl	40(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L42
	movq	8(%rsp), %rsi
	movq	24(%rsp), %rdi
	movl	%ebx, %edx
	call	_Z41__device_stub__Z18loadSumArrayKernelPfS_iPfS_i
.L42:
	movl	52(%rsp), %ecx
	movq	44(%rsp), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	32(%rsp), %rdi
	movl	40(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L43
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdi
	movl	%ebx, %edx
	call	_Z37__device_stub__Z14listScanKernelPfS_iPfS_i
.L43:
	movl	52(%rsp), %ecx
	movq	44(%rsp), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	32(%rsp), %rdi
	movl	40(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L44
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdi
	movl	%ebx, %edx
	call	_Z40__device_stub__Z17listScanSumKernelPfS_iPfS_i
.L44:
	movq	24(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbp, %rdx
	movq	%r12, %rdi
	call	cudaMemcpy@PLT
	movl	%ebx, %esi
	movq	%r12, %rdi
	call	_Z7dispResPfi
	movq	16(%r14), %rdi
	movl	%ebx, %edx
	movq	%r12, %rsi
	call	_Z11storeResultPcPfj
	movq	%r13, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	(%rsp), %rdi
	call	cudaFree@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L45
	call	__stack_chk_fail@PLT
.L45:
	addq	$64, %rsp
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2031:
	.size	main, .-main
	.section	.rodata.str1.1
.LC12:
	.string	"_Z17listScanSumKernelPfS_i"
.LC13:
	.string	"_Z18loadSumArrayKernelPfS_i"
.LC14:
	.string	"_Z14listScanKernelPfS_i"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2063:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -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	.LC12(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z17listScanSumKernelPfS_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC13(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z18loadSumArrayKernelPfS_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC14(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z14listScanKernelPfS_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	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	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2063:
	.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
	.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 <stdio.h>
#include<stdlib.h>
#include<string.h>

#include "hip/hip_runtime.h"



#define BLOCK_SIZE 1024
#define SECTION_SIZE 2*BLOCK_SIZE

__global__ void 
	listScanKernel(float * input, float * output, int len)
{
	__shared__ float list[SECTION_SIZE];
	unsigned int t = threadIdx.x;
	unsigned int start = blockIdx.x*blockDim.x;

	list[t] = ((t+start) < len ) ? input[t+start]:0.0f;
	list[t+blockDim.x] = ((start+t+blockDim.x) < len) ? input[start+t+blockDim.x]:0.0f;
 	
	for(unsigned int stride =1;stride<= BLOCK_SIZE; stride*=2)
	{
		int index = (t+1)*stride*2-1;
		if(index<SECTION_SIZE)
			list[index]+=list[index-stride];
		__syncthreads();
	}
	
	for(unsigned int stride = BLOCK_SIZE/2;stride>0;stride/=2)
	{
		__syncthreads();
		int index = (t+1)*stride*2-1;
		if(index+stride < SECTION_SIZE )
			list[index+stride]+=list[index];
	}
	
	__syncthreads();
	if(t+start < len)
		output[t+start] = list[t];
	
}
__global__ void
	loadSumArrayKernel(float *input, float *sumArray, int len)
{
	unsigned int t = threadIdx.x;
	unsigned int start = blockIdx.x*blockDim.x;
	unsigned int lastBlockId = (len-1)/BLOCK_SIZE;
	unsigned int lastThreadIdx = (len%BLOCK_SIZE-1);
	if(t+start<len)
	{
		if(blockIdx.x == lastBlockId)
			sumArray[blockIdx.x] = input[lastThreadIdx+start];
		else
		sumArray[blockIdx.x] = input[start+blockDim.x-1];
	}
}
__global__ void
	listScanSumKernel(float *input, float *output,int len)
{
	__shared__ float sumArray[SECTION_SIZE];
	unsigned int t = threadIdx.x;
	unsigned int start = blockIdx.x*blockDim.x;
	
	if(t+start<len && blockIdx.x>0)
	{
		
		output[t+start]+=input[blockIdx.x-1];
		__syncthreads();
	}
	
}

void totalCPU(float * input, float * output, int len)
{
	int i=0;
	output[0]=input[0];
	for(i=1;i<len;i++)
		output[i] = output[i-1]+input[i];

	printf("\n*****CPU calculation******\n");

}
void loadValue(char *FileInput,int len,float *a,float *b)
{
	FILE *file;
	int i=0;
	char buff[100];
	memset(b,0,len);

	file = fopen(FileInput,"r");
	if(!file)
	{
		printf("\nNo file found!");
		system("pause");
		exit(0);
	}

	while(fgets(buff,len,file))
	{
		a[i] = atof(buff);
		i++;
	}

	fclose(file);

}
void storeResult(char *fileOutput,float *arr,unsigned int len)
{
	FILE *file;
	int count=0;

	file = fopen(fileOutput,"w");
	if(!file)
	{
		printf("\nCannot create file!");
		system("pause");
		exit(0);
	}
	fprintf(file,"%d\n",len);
	for(count =0 ;count<len;count++)
	{
		fprintf(file,"%.0f\n",arr[count]);
	}
	fclose(file);
}
void dispRes(float *arr,int len)
{
	int i=0;
	printf("result = ");
	for(i=0;i<len;i++)
		printf("%4.0f ",arr[i]);	
	system("pause");
}
int main(int argc,char*argv[])
{
	float * hostInput; // The input 1D list
    float * hostOutput; // The output list
    float * deviceInput;
	float *deviceSumArray;
	float *deviceSumArrayOutput;
    float * deviceOutput;
    int numElements = (int) (atoi)(argv[3]); // number of elements in the input list

	hostInput = (float*)malloc(numElements*sizeof(float));
	hostOutput = (float*)malloc(numElements*sizeof(float));	

	//cuda memory allocation on the device
	hipMalloc((void**)&deviceInput,numElements*sizeof(float));
	hipMalloc((void**)&deviceOutput,numElements*sizeof(float));
	hipMalloc((void**)&deviceSumArray,numElements*sizeof(float));
	hipMalloc((void**)&deviceSumArrayOutput,numElements*sizeof(float));

	printf("Loading values to the array...\n");
	loadValue(argv[1],numElements,hostInput,hostOutput);

	//cuda memory copy from host to device
	hipMemcpy(deviceInput,hostInput,numElements*sizeof(float),hipMemcpyHostToDevice);

	//CPU equivalent
	totalCPU(hostInput,hostOutput,numElements);
	dispRes(hostOutput,numElements);

	printf("Calling CUDA kernel...\n");
	dim3 DimGrid((numElements-1)/BLOCK_SIZE+1,1,1);
	dim3 DimBlock(BLOCK_SIZE,1,1);	
	listScanKernel<<<DimGrid,DimBlock>>>(deviceInput,deviceOutput,numElements);
	loadSumArrayKernel<<<DimGrid,DimBlock>>>(deviceOutput,deviceSumArray,numElements);
	listScanKernel<<<DimGrid,DimBlock>>>(deviceSumArray,deviceSumArrayOutput,numElements);
	listScanSumKernel<<<DimGrid,DimBlock>>>(deviceSumArrayOutput,deviceOutput,numElements);

	//cuda memory copy from device to host
	hipMemcpy(hostOutput,deviceOutput,numElements*sizeof(float),hipMemcpyDeviceToHost);

	dispRes(hostOutput,numElements);

	storeResult(argv[2],hostOutput,numElements);

	free(hostInput);
	free(hostOutput);


	hipFree(deviceInput);
	hipFree(deviceOutput);
	return 0;

}

	.text
	.file	"kernel.hip"
	.globl	_Z29__device_stub__listScanKernelPfS_i # -- Begin function _Z29__device_stub__listScanKernelPfS_i
	.type	_Z29__device_stub__listScanKernelPfS_i,@function
_Z29__device_stub__listScanKernelPfS_i: # @_Z29__device_stub__listScanKernelPfS_i
	.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	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%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	$_Z14listScanKernelPfS_i, %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_end0:
	.size	_Z29__device_stub__listScanKernelPfS_i, .Lfunc_end0-_Z29__device_stub__listScanKernelPfS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z33__device_stub__loadSumArrayKernelPfS_i # -- Begin function _Z33__device_stub__loadSumArrayKernelPfS_i
	.type	_Z33__device_stub__loadSumArrayKernelPfS_i,@function
_Z33__device_stub__loadSumArrayKernelPfS_i: # @_Z33__device_stub__loadSumArrayKernelPfS_i
	.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	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%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	$_Z18loadSumArrayKernelPfS_i, %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	_Z33__device_stub__loadSumArrayKernelPfS_i, .Lfunc_end1-_Z33__device_stub__loadSumArrayKernelPfS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z32__device_stub__listScanSumKernelPfS_i # -- Begin function _Z32__device_stub__listScanSumKernelPfS_i
	.type	_Z32__device_stub__listScanSumKernelPfS_i,@function
_Z32__device_stub__listScanSumKernelPfS_i: # @_Z32__device_stub__listScanSumKernelPfS_i
	.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	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%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	$_Z17listScanSumKernelPfS_i, %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_end2:
	.size	_Z32__device_stub__listScanSumKernelPfS_i, .Lfunc_end2-_Z32__device_stub__listScanSumKernelPfS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z8totalCPUPfS_i                # -- Begin function _Z8totalCPUPfS_i
	.type	_Z8totalCPUPfS_i,@function
_Z8totalCPUPfS_i:                       # @_Z8totalCPUPfS_i
	.cfi_startproc
# %bb.0:
	movss	(%rdi), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%rsi)
	cmpl	$2, %edx
	jl	.LBB3_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%edx, %eax
	movss	(%rsi), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	movl	$1, %ecx
.LBB3_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	addss	(%rdi,%rcx,4), %xmm0
	movss	%xmm0, (%rsi,%rcx,4)
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB3_2
.LBB3_3:                                # %._crit_edge
	movl	$.Lstr, %edi
	jmp	puts@PLT                        # TAILCALL
.Lfunc_end3:
	.size	_Z8totalCPUPfS_i, .Lfunc_end3-_Z8totalCPUPfS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z9loadValuePciPfS0_            # -- Begin function _Z9loadValuePciPfS0_
	.type	_Z9loadValuePciPfS0_,@function
_Z9loadValuePciPfS0_:                   # @_Z9loadValuePciPfS0_
	.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	%rbx
	.cfi_def_cfa_offset 40
	subq	$104, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdx, %rbx
	movl	%esi, %ebp
	movq	%rdi, %r14
	movslq	%esi, %rdx
	movq	%rcx, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	movl	$.L.str.1, %esi
	movq	%r14, %rdi
	callq	fopen
	testq	%rax, %rax
	je	.LBB4_5
# %bb.1:                                # %.preheader
	movq	%rax, %r14
	movq	%rsp, %rdi
	movl	%ebp, %esi
	movq	%rax, %rdx
	callq	fgets
	testq	%rax, %rax
	je	.LBB4_4
# %bb.2:
	movq	%rsp, %r15
.LBB4_3:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	callq	atof
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, (%rbx)
	movq	%r15, %rdi
	movl	%ebp, %esi
	movq	%r14, %rdx
	callq	fgets
	addq	$4, %rbx
	testq	%rax, %rax
	jne	.LBB4_3
.LBB4_4:                                # %._crit_edge
	movq	%r14, %rdi
	callq	fclose
	addq	$104, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.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
.LBB4_5:
	.cfi_def_cfa_offset 144
	movl	$.L.str.2, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.3, %edi
	callq	system
	xorl	%edi, %edi
	callq	exit
.Lfunc_end4:
	.size	_Z9loadValuePciPfS0_, .Lfunc_end4-_Z9loadValuePciPfS0_
	.cfi_endproc
                                        # -- End function
	.globl	_Z11storeResultPcPfj            # -- Begin function _Z11storeResultPcPfj
	.type	_Z11storeResultPcPfj,@function
_Z11storeResultPcPfj:                   # @_Z11storeResultPcPfj
	.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	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edx, %ebp
	movq	%rsi, %rbx
	movl	$.L.str.4, %esi
	callq	fopen
	testq	%rax, %rax
	je	.LBB5_5
# %bb.1:
	movq	%rax, %r14
	movl	$.L.str.6, %esi
	movq	%rax, %rdi
	movl	%ebp, %edx
	xorl	%eax, %eax
	callq	fprintf
	testl	%ebp, %ebp
	je	.LBB5_4
# %bb.2:                                # %.lr.ph.preheader
	movl	%ebp, %r15d
	xorl	%r12d, %r12d
.LBB5_3:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx,%r12,4), %xmm0
	movl	$.L.str.7, %esi
	movq	%r14, %rdi
	movb	$1, %al
	callq	fprintf
	incq	%r12
	cmpq	%r12, %r15
	jne	.LBB5_3
.LBB5_4:                                # %._crit_edge
	movq	%r14, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.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
	jmp	fclose                          # TAILCALL
.LBB5_5:
	.cfi_def_cfa_offset 48
	movl	$.L.str.5, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.3, %edi
	callq	system
	xorl	%edi, %edi
	callq	exit
.Lfunc_end5:
	.size	_Z11storeResultPcPfj, .Lfunc_end5-_Z11storeResultPcPfj
	.cfi_endproc
                                        # -- End function
	.globl	_Z7dispResPfi                   # -- Begin function _Z7dispResPfi
	.type	_Z7dispResPfi,@function
_Z7dispResPfi:                          # @_Z7dispResPfi
	.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	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%esi, %ebp
	movq	%rdi, %rbx
	movl	$.L.str.8, %edi
	xorl	%eax, %eax
	callq	printf
	testl	%ebp, %ebp
	jle	.LBB6_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%ebp, %r14d
	xorl	%r15d, %r15d
.LBB6_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx,%r15,4), %xmm0
	movl	$.L.str.9, %edi
	movb	$1, %al
	callq	printf
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB6_2
.LBB6_3:                                # %._crit_edge
	movl	$.L.str.3, %edi
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.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
	jmp	system                          # TAILCALL
.Lfunc_end6:
	.size	_Z7dispResPfi, .Lfunc_end6-_Z7dispResPfi
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function 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	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %rbp
	movq	24(%rsi), %rdi
	callq	atoi
	movl	%eax, %r14d
	movslq	%eax, %rbx
	leaq	(,%rbx,4), %r13
	movq	%r13, %rdi
	callq	malloc
	movq	%rax, %r15
	movq	%r13, %rdi
	callq	malloc
	movq	%rax, %r12
	leaq	8(%rsp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	movq	%rsp, %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	leaq	24(%rsp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	leaq	16(%rsp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	movq	%rbp, 32(%rsp)                  # 8-byte Spill
	movq	8(%rbp), %rdi
	movl	%ebx, %esi
	movq	%r15, %rdx
	movq	%r12, %rcx
	callq	_Z9loadValuePciPfS0_
	leaq	8(%rsp), %rax
	movq	(%rax), %rdi
	movq	%r15, %rsi
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movss	(%r15), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%r12)
	cmpl	$2, %ebx
	jl	.LBB7_3
# %bb.1:                                # %.lr.ph.preheader.i
	movl	%r14d, %eax
	movss	(%r12), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	movl	$1, %ecx
.LBB7_2:                                # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	addss	(%r15,%rcx,4), %xmm0
	movss	%xmm0, (%r12,%rcx,4)
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB7_2
.LBB7_3:                                # %_Z8totalCPUPfS_i.exit
	movabsq	$4294968320, %rbp               # imm = 0x100000400
	movl	$.Lstr, %edi
	callq	puts@PLT
	movq	%r12, %rdi
	movl	%r14d, %esi
	callq	_Z7dispResPfi
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	leal	-1(%r14), %eax
	movl	%r14d, %ecx
	addl	$1022, %ecx                     # imm = 0x3FE
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$10, %ecx
	incl	%ecx
	leaq	(%rcx,%rbp), %rbx
	addq	$-1024, %rbx                    # imm = 0xFC00
	movq	%rbx, %rdi
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB7_5
# %bb.4:
	movq	8(%rsp), %rdi
	movq	(%rsp), %rsi
	movl	%r14d, %edx
	callq	_Z29__device_stub__listScanKernelPfS_i
.LBB7_5:
	movq	%rbx, %rdi
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB7_7
# %bb.6:
	movq	(%rsp), %rdi
	movq	24(%rsp), %rsi
	movl	%r14d, %edx
	callq	_Z33__device_stub__loadSumArrayKernelPfS_i
.LBB7_7:
	movq	%rbx, %rdi
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB7_9
# %bb.8:
	movq	24(%rsp), %rdi
	movq	16(%rsp), %rsi
	movl	%r14d, %edx
	callq	_Z29__device_stub__listScanKernelPfS_i
.LBB7_9:
	movq	%rbx, %rdi
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB7_11
# %bb.10:
	movq	16(%rsp), %rdi
	movq	(%rsp), %rsi
	movl	%r14d, %edx
	callq	_Z32__device_stub__listScanSumKernelPfS_i
.LBB7_11:
	movq	(%rsp), %rsi
	movq	%r12, %rdi
	movq	%r13, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	%r12, %rdi
	movl	%r14d, %esi
	callq	_Z7dispResPfi
	movq	32(%rsp), %rax                  # 8-byte Reload
	movq	16(%rax), %rdi
	movq	%r12, %rsi
	movl	%r14d, %edx
	callq	_Z11storeResultPcPfj
	movq	%r15, %rdi
	callq	free
	movq	%r12, %rdi
	callq	free
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	(%rsp), %rdi
	callq	hipFree
	xorl	%eax, %eax
	addq	$40, %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_end7:
	.size	main, .Lfunc_end7-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:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB8_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB8_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z14listScanKernelPfS_i, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z18loadSumArrayKernelPfS_i, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z17listScanSumKernelPfS_i, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end8:
	.size	__hip_module_ctor, .Lfunc_end8-__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	.LBB9_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
.LBB9_2:
	retq
.Lfunc_end9:
	.size	__hip_module_dtor, .Lfunc_end9-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z14listScanKernelPfS_i,@object # @_Z14listScanKernelPfS_i
	.section	.rodata,"a",@progbits
	.globl	_Z14listScanKernelPfS_i
	.p2align	3, 0x0
_Z14listScanKernelPfS_i:
	.quad	_Z29__device_stub__listScanKernelPfS_i
	.size	_Z14listScanKernelPfS_i, 8

	.type	_Z18loadSumArrayKernelPfS_i,@object # @_Z18loadSumArrayKernelPfS_i
	.globl	_Z18loadSumArrayKernelPfS_i
	.p2align	3, 0x0
_Z18loadSumArrayKernelPfS_i:
	.quad	_Z33__device_stub__loadSumArrayKernelPfS_i
	.size	_Z18loadSumArrayKernelPfS_i, 8

	.type	_Z17listScanSumKernelPfS_i,@object # @_Z17listScanSumKernelPfS_i
	.globl	_Z17listScanSumKernelPfS_i
	.p2align	3, 0x0
_Z17listScanSumKernelPfS_i:
	.quad	_Z32__device_stub__listScanSumKernelPfS_i
	.size	_Z17listScanSumKernelPfS_i, 8

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

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"\nNo file found!"
	.size	.L.str.2, 16

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

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

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"\nCannot create file!"
	.size	.L.str.5, 21

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"%d\n"
	.size	.L.str.6, 4

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"%.0f\n"
	.size	.L.str.7, 6

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"result = "
	.size	.L.str.8, 10

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"%4.0f "
	.size	.L.str.9, 7

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z14listScanKernelPfS_i"
	.size	.L__unnamed_1, 24

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z18loadSumArrayKernelPfS_i"
	.size	.L__unnamed_2, 28

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z17listScanSumKernelPfS_i"
	.size	.L__unnamed_3, 27

	.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	"\n*****CPU calculation******"
	.size	.Lstr, 28

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"Loading values to the array..."
	.size	.Lstr.1, 31

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"Calling CUDA kernel..."
	.size	.Lstr.2, 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 _Z29__device_stub__listScanKernelPfS_i
	.addrsig_sym _Z33__device_stub__loadSumArrayKernelPfS_i
	.addrsig_sym _Z32__device_stub__listScanSumKernelPfS_i
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z14listScanKernelPfS_i
	.addrsig_sym _Z18loadSumArrayKernelPfS_i
	.addrsig_sym _Z17listScanSumKernelPfS_i
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z14listScanKernelPfS_i ; -- Begin function _Z14listScanKernelPfS_i
	.globl	_Z14listScanKernelPfS_i
	.p2align	8
	.type	_Z14listScanKernelPfS_i,@function
_Z14listScanKernelPfS_i:                ; @_Z14listScanKernelPfS_i
; %bb.0:
	s_clause 0x2
	s_load_b32 s3, s[0:1], 0x24
	s_load_b32 s2, s[0:1], 0x10
	s_load_b128 s[4:7], s[0:1], 0x0
	v_mov_b32_e32 v3, 0
	v_mov_b32_e32 v5, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s1, s3, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s1, v[0:1]
	v_cmp_gt_u32_e32 vcc_lo, s2, v1
	s_and_saveexec_b32 s3, vcc_lo
	s_cbranch_execz .LBB0_2
; %bb.1:
	v_mov_b32_e32 v2, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[4:5], 2, v[1:2]
	v_add_co_u32 v4, s0, s4, v4
	s_delay_alu instid0(VALU_DEP_1)
	v_add_co_ci_u32_e64 v5, s0, s5, v5, s0
	global_load_b32 v5, v[4:5], off
.LBB0_2:
	s_or_b32 exec_lo, exec_lo, s3
	v_add_nc_u32_e32 v2, s1, v1
	v_lshlrev_b32_e32 v4, 2, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_cmp_gt_u32_e64 s0, s2, v2
	s_waitcnt vmcnt(0)
	ds_store_b32 v4, v5
	s_and_saveexec_b32 s2, s0
	s_cbranch_execz .LBB0_4
; %bb.3:
	v_mov_b32_e32 v3, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	v_add_co_u32 v2, s0, s4, v2
	s_delay_alu instid0(VALU_DEP_1)
	v_add_co_ci_u32_e64 v3, s0, s5, v3, s0
	global_load_b32 v3, v[2:3], off
.LBB0_4:
	s_or_b32 exec_lo, exec_lo, s2
	v_lshl_add_u32 v5, s1, 2, v4
	v_add_nc_u32_e32 v2, 1, v0
	s_mov_b32 s1, 1
	s_waitcnt vmcnt(0)
	ds_store_b32 v5, v3
.LBB0_5:                                ; =>This Inner Loop Header: Depth=1
	v_mul_lo_u32 v3, s1, v2
	s_mov_b32 s2, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_u32_e32 0x401, v3
	s_cbranch_execz .LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	v_lshl_add_u32 v3, v3, 1, -1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_subrev_nc_u32_e32 v5, s1, v3
	v_lshlrev_b32_e32 v3, 2, v3
	v_lshlrev_b32_e32 v5, 2, v5
	ds_load_b32 v5, v5
	ds_load_b32 v6, v3
	s_waitcnt lgkmcnt(0)
	v_add_f32_e32 v5, v5, v6
	ds_store_b32 v3, v5
.LBB0_7:                                ;   in Loop: Header=BB0_5 Depth=1
	s_or_b32 exec_lo, exec_lo, s2
	s_lshl_b32 s0, s1, 1
	s_cmpk_gt_u32 s1, 0x200
	s_mov_b32 s1, s0
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB0_5
; %bb.8:                                ; %.preheader
	v_lshl_add_u32 v0, v0, 1, 2
	s_movk_i32 s1, 0x200
.LBB0_9:                                ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_mad_u32_u24 v2, v0, s1, -1
	s_mov_b32 s2, exec_lo
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	v_add_nc_u32_e32 v3, s1, v2
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_u32_e32 0x800, v3
	s_cbranch_execz .LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	v_lshlrev_b32_e32 v2, 2, v2
	v_lshlrev_b32_e32 v3, 2, v3
	ds_load_b32 v2, v2
	ds_load_b32 v5, v3
	s_waitcnt lgkmcnt(0)
	v_add_f32_e32 v2, v2, v5
	ds_store_b32 v3, v2
.LBB0_11:                               ;   in Loop: Header=BB0_9 Depth=1
	s_or_b32 exec_lo, exec_lo, s2
	s_lshr_b32 s0, s1, 1
	s_cmp_lt_u32 s1, 2
	s_mov_b32 s1, s0
	s_cbranch_scc0 .LBB0_9
; %bb.12:
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_and_saveexec_b32 s0, vcc_lo
	s_cbranch_execz .LBB0_14
; %bb.13:
	ds_load_b32 v3, v4
	v_mov_b32_e32 v2, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	v_add_co_u32 v0, vcc_lo, s6, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo
	s_waitcnt lgkmcnt(0)
	global_store_b32 v[0:1], v3, off
.LBB0_14:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z14listScanKernelPfS_i
		.amdhsa_group_segment_fixed_size 8192
		.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 7
		.amdhsa_next_free_sgpr 16
		.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	_Z14listScanKernelPfS_i, .Lfunc_end0-_Z14listScanKernelPfS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 568
; NumSgprs: 18
; NumVgprs: 7
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 8192 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 7
; 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
	.protected	_Z18loadSumArrayKernelPfS_i ; -- Begin function _Z18loadSumArrayKernelPfS_i
	.globl	_Z18loadSumArrayKernelPfS_i
	.p2align	8
	.type	_Z18loadSumArrayKernelPfS_i,@function
_Z18loadSumArrayKernelPfS_i:            ; @_Z18loadSumArrayKernelPfS_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x24
	s_load_b32 s3, s[0:1], 0x10
	s_mov_b32 s6, exec_lo
	s_waitcnt lgkmcnt(0)
	s_and_b32 s5, s4, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_i32 s4, s15, s5
	v_add_nc_u32_e32 v0, s4, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_u32_e64 s3, v0
	s_cbranch_execz .LBB1_2
; %bb.1:                                ; %.sink.split
	s_load_b128 s[8:11], s[0:1], 0x0
	s_add_i32 s0, s3, -1
	s_ashr_i32 s1, s3, 31
	s_ashr_i32 s6, s0, 31
	s_lshr_b32 s1, s1, 22
	s_lshr_b32 s6, s6, 22
	s_add_i32 s1, s3, s1
	s_add_i32 s0, s0, s6
	s_and_b32 s1, s1, 0xfffffc00
	s_ashr_i32 s0, s0, 10
	s_sub_i32 s1, s3, s1
	s_cmp_eq_u32 s15, s0
	s_mov_b32 s2, s15
	s_mov_b32 s3, 0
	s_cselect_b32 s5, s1, s5
	s_lshl_b64 s[0:1], s[2:3], 2
	s_add_i32 s2, s4, s5
	s_waitcnt lgkmcnt(0)
	s_add_u32 s0, s10, s0
	s_addc_u32 s1, s11, s1
	s_add_i32 s2, s2, -1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_lshl_b64 s[2:3], s[2:3], 2
	s_add_u32 s2, s8, s2
	s_addc_u32 s3, s9, s3
	s_load_b32 s2, s[2:3], 0x0
	s_waitcnt lgkmcnt(0)
	v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
	global_store_b32 v0, v1, s[0:1]
.LBB1_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z18loadSumArrayKernelPfS_i
		.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 2
		.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_end1:
	.size	_Z18loadSumArrayKernelPfS_i, .Lfunc_end1-_Z18loadSumArrayKernelPfS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 212
; NumSgprs: 16
; NumVgprs: 2
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 1
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 16
; NumVGPRsForWavesPerEU: 2
; 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
	.protected	_Z17listScanSumKernelPfS_i ; -- Begin function _Z17listScanSumKernelPfS_i
	.globl	_Z17listScanSumKernelPfS_i
	.p2align	8
	.type	_Z17listScanSumKernelPfS_i,@function
_Z17listScanSumKernelPfS_i:             ; @_Z17listScanSumKernelPfS_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b32 s3, s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_cmp_lg_u32 s15, 0
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_cselect_b32 s2, -1, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_cmp_gt_u32_e32 vcc_lo, s3, v1
	s_mov_b32 s3, 0
	s_and_b32 s2, s2, vcc_lo
	s_and_saveexec_b32 s4, s2
	s_cbranch_execz .LBB2_2
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_mov_b32_e32 v2, 0
	s_add_i32 s2, s15, -1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_lshl_b64 s[0:1], s[2:3], 2
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo
	s_add_u32 s0, s4, s0
	s_addc_u32 s1, s5, s1
	s_load_b32 s0, s[0:1], 0x0
	global_load_b32 v2, v[0:1], off
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_f32_e32 v2, s0, v2
	global_store_b32 v[0:1], v2, off
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
.LBB2_2:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z17listScanSumKernelPfS_i
		.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 3
		.amdhsa_next_free_sgpr 16
		.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_end2:
	.size	_Z17listScanSumKernelPfS_i, .Lfunc_end2-_Z17listScanSumKernelPfS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 184
; NumSgprs: 18
; NumVgprs: 3
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 3
; 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
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .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: 8192
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z14listScanKernelPfS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z14listScanKernelPfS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     7
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .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:           _Z18loadSumArrayKernelPfS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     16
    .sgpr_spill_count: 0
    .symbol:         _Z18loadSumArrayKernelPfS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     2
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .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:           _Z17listScanSumKernelPfS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z17listScanSumKernelPfS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     3
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
