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

bool verify(int data[], int length)
{
	for (int i = 1 ; i < length; ++i)
	{
		if (data[i] - data [i - 1] != i )
		{ printf("error %d\n", i); return false; }
	}
	return true;
}

#define DUMP(x) printf("%s %d\n", #x, props.x)

void dumpCUDAProps(cudaDeviceProp & props)
{
	DUMP(canMapHostMemory);
	DUMP(clockRate);
	DUMP(computeMode);
	DUMP(deviceOverlap);
	DUMP(integrated);
	DUMP(kernelExecTimeoutEnabled);
	DUMP(major);
	DUMP(maxGridSize[0]);
	DUMP(maxGridSize[1]);
	DUMP(maxGridSize[2]);
	DUMP(maxThreadsDim[0]);
	DUMP(maxThreadsDim[1]);
	DUMP(maxThreadsDim[2]);
	DUMP(maxThreadsPerBlock);
	DUMP(memPitch);
	DUMP(minor);
	DUMP(multiProcessorCount);
	printf("name %s\n", props.name);
	DUMP(regsPerBlock);
	DUMP(sharedMemPerBlock);
	DUMP(textureAlignment);
	DUMP(totalConstMem);
	DUMP(totalGlobalMem);
	DUMP(warpSize);

}

#define BLOCK_SIZE 64 

__global__ void prefixsumblock(int *in, int *out, int length)
{
	int x = threadIdx.x + blockIdx.x * BLOCK_SIZE;

	if (x < length)
		out[x] = in[x];

	__syncthreads();

	for ( int i = 1; i < BLOCK_SIZE; i <<= 1)
	{
		if (threadIdx.x + i < BLOCK_SIZE && x + i < length) 
		{
			out[x + i] = in[x] + in[x + i];
		}
		__syncthreads();

		if (x < length)
			in[x] = out[x];

		__syncthreads();
	}
}

__global__ void correctsumends(int *ends, int *in, int *out)
{
	int x = threadIdx.x + blockIdx.x * BLOCK_SIZE;
	int end = ends[blockIdx.x];
	out[x] = in[x] + end;
}


__global__ void gathersumends(int *in, int *out)
{
	int x = threadIdx.x + blockIdx.x * BLOCK_SIZE;
	if (x > 0)
		out[x] = in[x * BLOCK_SIZE - 1];
	else 
		out[x] = 0;
}

__global__ void zarro(int *data, int length)
{
	int x = threadIdx.x + blockIdx.x * BLOCK_SIZE;

	if (x < length)
		data[x] = 0;
}


void prefixsum(int* in, int *out, int length)
{
	int blocks = (length + BLOCK_SIZE - 1) / BLOCK_SIZE;


	dim3 dimGrid(blocks, 1, 1);
	dim3 dimBlock(BLOCK_SIZE, 1, 1);

	zarro<<<dimGrid, dimBlock>>>(out, length);
	prefixsumblock<<<dimGrid, dimBlock>>>(in, out, length);

	if (blocks > 1) {
		int *devEnds;
		int *devTmpEnds;

		cudaMalloc((void**) &devEnds, blocks * sizeof(int));
		cudaMalloc((void**) &devTmpEnds, blocks * sizeof(int));

		int subblocks = (blocks + BLOCK_SIZE - 1) / BLOCK_SIZE;

		dim3 subgrid(subblocks, 1, 1);
		dim3 subblock(BLOCK_SIZE, 1, 1);
		gathersumends<<<subgrid, subblock>>>(out, devEnds);
		prefixsum(devEnds, devTmpEnds, blocks);

		cudaFree(devEnds);

		correctsumends<<<dimGrid, dimBlock>>>(devTmpEnds, in, out);

		cudaFree(devTmpEnds);
	}
}


void cudasummer(int data[], int length)
{

	int *devIn, *devOut;
	cudaEvent_t start, stop;
	cudaEventCreate(&start);
	cudaEventCreate(&stop);
	cudaEventRecord(start, 0);
	cudaMalloc((void**) &devIn, length * sizeof(int));
	cudaMalloc((void**) &devOut, length * sizeof(int));
	cudaMemcpy(devIn, data, length * sizeof(int), cudaMemcpyHostToDevice);

	prefixsum(devIn, devOut, length);

	cudaMemcpy(data, devOut, length * sizeof(int), cudaMemcpyDeviceToHost);

	cudaFree(devIn);
	cudaFree(devOut);

	cudaEventRecord(stop, 0);
	cudaEventSynchronize(stop);

	float t;

	cudaEventElapsedTime(&t, start, stop);

	printf("Elapsed time %3fms\n", t);
	cudaEventDestroy(start);
	cudaEventDestroy(stop);

}

void devicesDump()
{

	int deviceCount;
	cudaGetDeviceCount(&deviceCount);
	int device;
	for (device = 0; device < deviceCount; ++device) {
		cudaDeviceProp deviceProp;
		cudaGetDeviceProperties(&deviceProp, device);
		dumpCUDAProps(deviceProp);
	}
}


int main(int argc, char *argv[]) 
{

	int length;
	if (argc < 2) {
		length = 500;
	}	
	else length = atoi(argv[1]);

	int *data = (int*) malloc(length * sizeof(int));
	for (int i = 0; i < length; ++i) {
		data[i] = i; //rand();
	}

	devicesDump();

	cudasummer(data, length);





	if (length < 1000) 
		for (int i = 0 ; i < length; ++i)
		{
			printf("%d\n", data[i]);
		}
	verify(data, length);
}


	.file	"tmpxft_00211c3d_00000000-6_prefixOrig.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2035:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2035:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"error %d\n"
	.text
	.globl	_Z6verifyPii
	.type	_Z6verifyPii, @function
_Z6verifyPii:
.LFB2027:
	.cfi_startproc
	endbr64
	movl	$1, %eax
.L3:
	movl	%eax, %ecx
	cmpl	%eax, %esi
	jle	.L12
	movl	(%rdi,%rax,4), %edx
	subl	-4(%rdi,%rax,4), %edx
	cmpl	%eax, %edx
	je	.L4
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	%ecx, %edx
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
.L4:
	incq	%rax
	jmp	.L3
.L12:
	movb	$1, %al
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z6verifyPii, .-_Z6verifyPii
	.section	.rodata.str1.1
.LC1:
	.string	"canMapHostMemory"
.LC2:
	.string	"%s %d\n"
.LC3:
	.string	"clockRate"
.LC4:
	.string	"computeMode"
.LC5:
	.string	"deviceOverlap"
.LC6:
	.string	"integrated"
.LC7:
	.string	"kernelExecTimeoutEnabled"
.LC8:
	.string	"major"
.LC9:
	.string	"maxGridSize[0]"
.LC10:
	.string	"maxGridSize[1]"
.LC11:
	.string	"maxGridSize[2]"
.LC12:
	.string	"maxThreadsDim[0]"
.LC13:
	.string	"maxThreadsDim[1]"
.LC14:
	.string	"maxThreadsDim[2]"
.LC15:
	.string	"maxThreadsPerBlock"
.LC16:
	.string	"memPitch"
.LC17:
	.string	"minor"
.LC18:
	.string	"multiProcessorCount"
.LC19:
	.string	"name %s\n"
.LC20:
	.string	"regsPerBlock"
.LC21:
	.string	"sharedMemPerBlock"
.LC22:
	.string	"textureAlignment"
.LC23:
	.string	"totalConstMem"
.LC24:
	.string	"totalGlobalMem"
.LC25:
	.string	"warpSize"
	.text
	.globl	_Z13dumpCUDAPropsR14cudaDeviceProp
	.type	_Z13dumpCUDAPropsR14cudaDeviceProp, @function
_Z13dumpCUDAPropsR14cudaDeviceProp:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC2(%rip), %rbp
	leaq	.LC1(%rip), %rdx
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rbp, %rsi
	movq	%rdi, %rbx
	pushq	%rax
	.cfi_def_cfa_offset 32
	movl	400(%rdi), %ecx
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	348(%rbx), %ecx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rdx
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	404(%rbx), %ecx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC4(%rip), %rdx
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	384(%rbx), %ecx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC5(%rip), %rdx
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	396(%rbx), %ecx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC6(%rip), %rdx
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	392(%rbx), %ecx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC7(%rip), %rdx
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	360(%rbx), %ecx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC8(%rip), %rdx
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	336(%rbx), %ecx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC9(%rip), %rdx
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	340(%rbx), %ecx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC10(%rip), %rdx
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	344(%rbx), %ecx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC11(%rip), %rdx
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	324(%rbx), %ecx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC12(%rip), %rdx
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	328(%rbx), %ecx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC13(%rip), %rdx
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	332(%rbx), %ecx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC14(%rip), %rdx
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	320(%rbx), %ecx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC15(%rip), %rdx
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	%rbp, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	movq	312(%rbx), %rcx
	leaq	.LC16(%rip), %rdx
	call	__printf_chk@PLT
	movl	364(%rbx), %ecx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC17(%rip), %rdx
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	388(%rbx), %ecx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	leaq	.LC18(%rip), %rdx
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	%rbx, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC19(%rip), %rsi
	call	__printf_chk@PLT
	movl	304(%rbx), %ecx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC20(%rip), %rdx
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	%rbp, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	movq	296(%rbx), %rcx
	leaq	.LC21(%rip), %rdx
	call	__printf_chk@PLT
	movq	%rbp, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	movq	368(%rbx), %rcx
	leaq	.LC22(%rip), %rdx
	call	__printf_chk@PLT
	movq	%rbp, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	movq	352(%rbx), %rcx
	leaq	.LC23(%rip), %rdx
	call	__printf_chk@PLT
	movq	%rbp, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	movq	288(%rbx), %rcx
	leaq	.LC24(%rip), %rdx
	call	__printf_chk@PLT
	movl	308(%rbx), %ecx
	movq	%rbp, %rsi
	popq	%r8
	.cfi_def_cfa_offset 24
	leaq	.LC25(%rip), %rdx
	popq	%rbx
	.cfi_def_cfa_offset 16
	movl	$2, %edi
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2028:
	.size	_Z13dumpCUDAPropsR14cudaDeviceProp, .-_Z13dumpCUDAPropsR14cudaDeviceProp
	.globl	_Z11devicesDumpv
	.type	_Z11devicesDumpv, @function
_Z11devicesDumpv:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	xorl	%ebx, %ebx
	subq	$1064, %rsp
	.cfi_def_cfa_offset 1088
	movq	%fs:40, %rax
	movq	%rax, 1048(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdi
	leaq	16(%rsp), %rbp
	call	cudaGetDeviceCount@PLT
.L16:
	cmpl	%ebx, 12(%rsp)
	jle	.L20
	movl	%ebx, %esi
	movq	%rbp, %rdi
	incl	%ebx
	call	cudaGetDeviceProperties_v2@PLT
	movq	%rbp, %rdi
	call	_Z13dumpCUDAPropsR14cudaDeviceProp
	jmp	.L16
.L20:
	movq	1048(%rsp), %rax
	subq	%fs:40, %rax
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	addq	$1064, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2031:
	.size	_Z11devicesDumpv, .-_Z11devicesDumpv
	.globl	_Z37__device_stub__Z14prefixsumblockPiS_iPiS_i
	.type	_Z37__device_stub__Z14prefixsumblockPiS_iPiS_i, @function
_Z37__device_stub__Z14prefixsumblockPiS_iPiS_i:
.LFB2057:
	.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	.L21
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z14prefixsumblockPiS_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
.L21:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2057:
	.size	_Z37__device_stub__Z14prefixsumblockPiS_iPiS_i, .-_Z37__device_stub__Z14prefixsumblockPiS_iPiS_i
	.globl	_Z14prefixsumblockPiS_i
	.type	_Z14prefixsumblockPiS_i, @function
_Z14prefixsumblockPiS_i:
.LFB2058:
	.cfi_startproc
	endbr64
	jmp	_Z37__device_stub__Z14prefixsumblockPiS_iPiS_i
	.cfi_endproc
.LFE2058:
	.size	_Z14prefixsumblockPiS_i, .-_Z14prefixsumblockPiS_i
	.globl	_Z38__device_stub__Z14correctsumendsPiS_S_PiS_S_
	.type	_Z38__device_stub__Z14correctsumendsPiS_S_PiS_S_, @function
_Z38__device_stub__Z14correctsumendsPiS_S_PiS_S_:
.LFB2059:
	.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
	movq	%rdx, 8(%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	8(%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	.L26
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z14correctsumendsPiS_S_(%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
.L26:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2059:
	.size	_Z38__device_stub__Z14correctsumendsPiS_S_PiS_S_, .-_Z38__device_stub__Z14correctsumendsPiS_S_PiS_S_
	.globl	_Z14correctsumendsPiS_S_
	.type	_Z14correctsumendsPiS_S_, @function
_Z14correctsumendsPiS_S_:
.LFB2060:
	.cfi_startproc
	endbr64
	jmp	_Z38__device_stub__Z14correctsumendsPiS_S_PiS_S_
	.cfi_endproc
.LFE2060:
	.size	_Z14correctsumendsPiS_S_, .-_Z14correctsumendsPiS_S_
	.globl	_Z35__device_stub__Z13gathersumendsPiS_PiS_
	.type	_Z35__device_stub__Z13gathersumendsPiS_PiS_, @function
_Z35__device_stub__Z13gathersumendsPiS_PiS_:
.LFB2061:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	32(%rsp), %rcx
	leaq	24(%rsp), %rdx
	movq	%rsi, (%rsp)
	leaq	40(%rsp), %rdi
	leaq	52(%rsp), %rsi
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 48(%rsp)
	movq	%rax, 88(%rsp)
	movq	%rsp, %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 40(%rsp)
	movq	%rax, 52(%rsp)
	movl	$1, 60(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L31
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z13gathersumendsPiS_(%rip), %rdi
	pushq	32(%rsp)
	.cfi_def_cfa_offset 144
	movq	68(%rsp), %rcx
	movl	76(%rsp), %r8d
	movq	56(%rsp), %rsi
	movl	64(%rsp), %edx
	leaq	104(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L31:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L33
	call	__stack_chk_fail@PLT
.L33:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2061:
	.size	_Z35__device_stub__Z13gathersumendsPiS_PiS_, .-_Z35__device_stub__Z13gathersumendsPiS_PiS_
	.globl	_Z13gathersumendsPiS_
	.type	_Z13gathersumendsPiS_, @function
_Z13gathersumendsPiS_:
.LFB2062:
	.cfi_startproc
	endbr64
	jmp	_Z35__device_stub__Z13gathersumendsPiS_PiS_
	.cfi_endproc
.LFE2062:
	.size	_Z13gathersumendsPiS_, .-_Z13gathersumendsPiS_
	.globl	_Z25__device_stub__Z5zarroPiiPii
	.type	_Z25__device_stub__Z5zarroPiiPii, @function
_Z25__device_stub__Z5zarroPiiPii:
.LFB2063:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	32(%rsp), %rcx
	leaq	24(%rsp), %rdx
	movl	%esi, 4(%rsp)
	leaq	40(%rsp), %rdi
	leaq	52(%rsp), %rsi
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 48(%rsp)
	movq	%rax, 88(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 40(%rsp)
	movq	%rax, 52(%rsp)
	movl	$1, 60(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L36
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z5zarroPii(%rip), %rdi
	pushq	32(%rsp)
	.cfi_def_cfa_offset 144
	movq	68(%rsp), %rcx
	movl	76(%rsp), %r8d
	movq	56(%rsp), %rsi
	movl	64(%rsp), %edx
	leaq	104(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L36:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L38
	call	__stack_chk_fail@PLT
.L38:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2063:
	.size	_Z25__device_stub__Z5zarroPiiPii, .-_Z25__device_stub__Z5zarroPiiPii
	.globl	_Z5zarroPii
	.type	_Z5zarroPii, @function
_Z5zarroPii:
.LFB2064:
	.cfi_startproc
	endbr64
	jmp	_Z25__device_stub__Z5zarroPiiPii
	.cfi_endproc
.LFE2064:
	.size	_Z5zarroPii, .-_Z5zarroPii
	.globl	_Z9prefixsumPiS_i
	.type	_Z9prefixsumPiS_i, @function
_Z9prefixsumPiS_i:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$64, %ecx
	movq	%rdi, %r13
	xorl	%r9d, %r9d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	%edx, %r12d
	xorl	%r8d, %r8d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$88, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leal	63(%rdx), %eax
	movl	$1, 44(%rsp)
	cltd
	idivl	%ecx
	movl	$67108865, %edx
	movl	$1, %ecx
	salq	$6, %rdx
	movq	%rdx, 36(%rsp)
	movl	%eax, 24(%rsp)
	movl	%eax, %ebx
	movabsq	$4294967297, %rax
	movq	%rax, 28(%rsp)
	movq	24(%rsp), %rdi
	movl	32(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L42
	movl	%r12d, %esi
	movq	%rbp, %rdi
	call	_Z25__device_stub__Z5zarroPiiPii
.L42:
	movl	44(%rsp), %ecx
	movq	36(%rsp), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	24(%rsp), %rdi
	movl	32(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L43
	movl	%r12d, %edx
	movq	%rbp, %rsi
	movq	%r13, %rdi
	call	_Z37__device_stub__Z14prefixsumblockPiS_iPiS_i
.L43:
	cmpl	$64, %r12d
	jle	.L41
	movslq	%ebx, %r12
	leaq	8(%rsp), %rdi
	salq	$2, %r12
	movq	%r12, %rsi
	call	cudaMalloc@PLT
	leaq	16(%rsp), %rdi
	movq	%r12, %rsi
	call	cudaMalloc@PLT
	leal	63(%rbx), %eax
	movl	$67108865, %edx
	xorl	%r9d, %r9d
	sarl	$6, %eax
	xorl	%r8d, %r8d
	salq	$6, %rdx
	movl	$1, %ecx
	movl	%eax, 48(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 52(%rsp)
	movq	48(%rsp), %rdi
	movl	56(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L45
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	call	_Z35__device_stub__Z13gathersumendsPiS_PiS_
.L45:
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdi
	movl	%ebx, %edx
	call	_Z9prefixsumPiS_i
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movl	44(%rsp), %ecx
	movl	32(%rsp), %esi
	xorl	%r9d, %r9d
	movq	36(%rsp), %rdx
	movq	24(%rsp), %rdi
	xorl	%r8d, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L46
	movq	16(%rsp), %rdi
	movq	%rbp, %rdx
	movq	%r13, %rsi
	call	_Z38__device_stub__Z14correctsumendsPiS_S_PiS_S_
.L46:
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
.L41:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L47
	call	__stack_chk_fail@PLT
.L47:
	addq	$88, %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
.LFE2029:
	.size	_Z9prefixsumPiS_i, .-_Z9prefixsumPiS_i
	.section	.rodata.str1.1
.LC26:
	.string	"Elapsed time %3fms\n"
	.text
	.globl	_Z10cudasummerPii
	.type	_Z10cudasummerPii, @function
_Z10cudasummerPii:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movslq	%esi, %rbx
	movq	%rbx, %r12
	salq	$2, %rbx
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	32(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	leaq	8(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	leaq	16(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	movq	8(%rsp), %rdi
	movq	%rbx, %rdx
	movq	%rbp, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdi
	movl	%r12d, %edx
	call	_Z9prefixsumPiS_i
	movq	16(%rsp), %rsi
	movq	%rbx, %rdx
	movq	%rbp, %rdi
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	32(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	32(%rsp), %rdx
	movq	24(%rsp), %rsi
	leaq	4(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC26(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	4(%rsp), %xmm0
	call	__printf_chk@PLT
	movq	24(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	32(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L50
	call	__stack_chk_fail@PLT
.L50:
	addq	$48, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2030:
	.size	_Z10cudasummerPii, .-_Z10cudasummerPii
	.section	.rodata.str1.1
.LC27:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2032:
	.cfi_startproc
	endbr64
	decl	%edi
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movl	$500, %ebx
	pushq	%rcx
	.cfi_def_cfa_offset 48
	jle	.L53
	movq	8(%rsi), %rdi
	call	atoi@PLT
	movl	%eax, %ebx
.L53:
	movslq	%ebx, %rdi
	salq	$2, %rdi
	call	malloc@PLT
	movq	%rax, %rbp
	xorl	%eax, %eax
.L54:
	cmpl	%eax, %ebx
	jle	.L64
	movl	%eax, 0(%rbp,%rax,4)
	incq	%rax
	jmp	.L54
.L64:
	call	_Z11devicesDumpv
	movl	%ebx, %esi
	movq	%rbp, %rdi
	call	_Z10cudasummerPii
	cmpl	$999, %ebx
	jg	.L58
	xorl	%r12d, %r12d
	leaq	.LC27(%rip), %r13
.L56:
	cmpl	%r12d, %ebx
	jle	.L58
	movl	0(%rbp,%r12,4), %edx
	movq	%r13, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%r12
	call	__printf_chk@PLT
	jmp	.L56
.L58:
	movl	%ebx, %esi
	movq	%rbp, %rdi
	call	_Z6verifyPii
	popq	%rdx
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
.LFE2032:
	.size	main, .-main
	.section	.rodata.str1.1
.LC28:
	.string	"_Z5zarroPii"
.LC29:
	.string	"_Z13gathersumendsPiS_"
.LC30:
	.string	"_Z14correctsumendsPiS_S_"
.LC31:
	.string	"_Z14prefixsumblockPiS_i"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2066:
	.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	.LC28(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z5zarroPii(%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	.LC29(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z13gathersumendsPiS_(%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	.LC30(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z14correctsumendsPiS_S_(%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	.LC31(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z14prefixsumblockPiS_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
.LFE2066:
	.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 <hip/hip_runtime.h>
#include <stdio.h>
#include <stdlib.h>

bool verify(int data[], int length)
{
	for (int i = 1 ; i < length; ++i)
	{
		if (data[i] - data [i - 1] != i )
		{ printf("error %d\n", i); return false; }
	}
	return true;
}

#define DUMP(x) printf("%s %d\n", #x, props.x)

void dumpCUDAProps(hipDeviceProp_t & props)
{
	DUMP(canMapHostMemory);
	DUMP(clockRate);
	DUMP(computeMode);
	DUMP(deviceOverlap);
	DUMP(integrated);
	DUMP(kernelExecTimeoutEnabled);
	DUMP(major);
	DUMP(maxGridSize[0]);
	DUMP(maxGridSize[1]);
	DUMP(maxGridSize[2]);
	DUMP(maxThreadsDim[0]);
	DUMP(maxThreadsDim[1]);
	DUMP(maxThreadsDim[2]);
	DUMP(maxThreadsPerBlock);
	DUMP(memPitch);
	DUMP(minor);
	DUMP(multiProcessorCount);
	printf("name %s\n", props.name);
	DUMP(regsPerBlock);
	DUMP(sharedMemPerBlock);
	DUMP(textureAlignment);
	DUMP(totalConstMem);
	DUMP(totalGlobalMem);
	DUMP(warpSize);

}

#define BLOCK_SIZE 64 

__global__ void prefixsumblock(int *in, int *out, int length)
{
	int x = threadIdx.x + blockIdx.x * BLOCK_SIZE;

	if (x < length)
		out[x] = in[x];

	__syncthreads();

	for ( int i = 1; i < BLOCK_SIZE; i <<= 1)
	{
		if (threadIdx.x + i < BLOCK_SIZE && x + i < length) 
		{
			out[x + i] = in[x] + in[x + i];
		}
		__syncthreads();

		if (x < length)
			in[x] = out[x];

		__syncthreads();
	}
}

__global__ void correctsumends(int *ends, int *in, int *out)
{
	int x = threadIdx.x + blockIdx.x * BLOCK_SIZE;
	int end = ends[blockIdx.x];
	out[x] = in[x] + end;
}


__global__ void gathersumends(int *in, int *out)
{
	int x = threadIdx.x + blockIdx.x * BLOCK_SIZE;
	if (x > 0)
		out[x] = in[x * BLOCK_SIZE - 1];
	else 
		out[x] = 0;
}

__global__ void zarro(int *data, int length)
{
	int x = threadIdx.x + blockIdx.x * BLOCK_SIZE;

	if (x < length)
		data[x] = 0;
}


void prefixsum(int* in, int *out, int length)
{
	int blocks = (length + BLOCK_SIZE - 1) / BLOCK_SIZE;


	dim3 dimGrid(blocks, 1, 1);
	dim3 dimBlock(BLOCK_SIZE, 1, 1);

	zarro<<<dimGrid, dimBlock>>>(out, length);
	prefixsumblock<<<dimGrid, dimBlock>>>(in, out, length);

	if (blocks > 1) {
		int *devEnds;
		int *devTmpEnds;

		hipMalloc((void**) &devEnds, blocks * sizeof(int));
		hipMalloc((void**) &devTmpEnds, blocks * sizeof(int));

		int subblocks = (blocks + BLOCK_SIZE - 1) / BLOCK_SIZE;

		dim3 subgrid(subblocks, 1, 1);
		dim3 subblock(BLOCK_SIZE, 1, 1);
		gathersumends<<<subgrid, subblock>>>(out, devEnds);
		prefixsum(devEnds, devTmpEnds, blocks);

		hipFree(devEnds);

		correctsumends<<<dimGrid, dimBlock>>>(devTmpEnds, in, out);

		hipFree(devTmpEnds);
	}
}


void cudasummer(int data[], int length)
{

	int *devIn, *devOut;
	hipEvent_t start, stop;
	hipEventCreate(&start);
	hipEventCreate(&stop);
	hipEventRecord(start, 0);
	hipMalloc((void**) &devIn, length * sizeof(int));
	hipMalloc((void**) &devOut, length * sizeof(int));
	hipMemcpy(devIn, data, length * sizeof(int), hipMemcpyHostToDevice);

	prefixsum(devIn, devOut, length);

	hipMemcpy(data, devOut, length * sizeof(int), hipMemcpyDeviceToHost);

	hipFree(devIn);
	hipFree(devOut);

	hipEventRecord(stop, 0);
	hipEventSynchronize(stop);

	float t;

	hipEventElapsedTime(&t, start, stop);

	printf("Elapsed time %3fms\n", t);
	hipEventDestroy(start);
	hipEventDestroy(stop);

}

void devicesDump()
{

	int deviceCount;
	hipGetDeviceCount(&deviceCount);
	int device;
	for (device = 0; device < deviceCount; ++device) {
		hipDeviceProp_t deviceProp;
		hipGetDeviceProperties(&deviceProp, device);
		dumpCUDAProps(deviceProp);
	}
}


int main(int argc, char *argv[]) 
{

	int length;
	if (argc < 2) {
		length = 500;
	}	
	else length = atoi(argv[1]);

	int *data = (int*) malloc(length * sizeof(int));
	for (int i = 0; i < length; ++i) {
		data[i] = i; //rand();
	}

	devicesDump();

	cudasummer(data, length);





	if (length < 1000) 
		for (int i = 0 ; i < length; ++i)
		{
			printf("%d\n", data[i]);
		}
	verify(data, length);
}


	.text
	.file	"prefixOrig.hip"
	.globl	_Z6verifyPii                    # -- Begin function _Z6verifyPii
	.type	_Z6verifyPii,@function
_Z6verifyPii:                           # @_Z6verifyPii
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movb	$1, %bl
	cmpl	$2, %esi
	jl	.LBB0_9
# %bb.1:                                # %.lr.ph.preheader
	movl	4(%rdi), %eax
	subl	(%rdi), %eax
	cmpl	$1, %eax
	jne	.LBB0_2
# %bb.6:                                # %.lr.ph26.preheader
	movl	%esi, %eax
	movl	$2, %ecx
	subq	%rax, %rcx
	movl	$1, %edx
.LBB0_7:                                # %.lr.ph26
                                        # =>This Inner Loop Header: Depth=1
	leaq	(%rcx,%rdx), %rsi
	cmpq	$1, %rsi
	je	.LBB0_8
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB0_7 Depth=1
	leaq	1(%rdx), %rsi
	movl	4(%rdi,%rdx,4), %r8d
	subl	(%rdi,%rdx,4), %r8d
	movq	%rsi, %rdx
	cmpq	%r8, %rsi
	je	.LBB0_7
# %bb.4:                                # %.lr.ph._crit_edge
	cmpq	%rax, %rsi
	setae	%bl
	jmp	.LBB0_5
.LBB0_2:
	movl	$1, %esi
	xorl	%ebx, %ebx
.LBB0_5:
	movl	$.L.str, %edi
                                        # kill: def $esi killed $esi killed $rsi
	xorl	%eax, %eax
	callq	printf
	jmp	.LBB0_9
.LBB0_8:                                # %.loopexit.loopexit
	incq	%rdx
	cmpq	%rax, %rdx
	setae	%bl
.LBB0_9:                                # %.loopexit
	movl	%ebx, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z6verifyPii, .Lfunc_end0-_Z6verifyPii
	.cfi_endproc
                                        # -- End function
	.globl	_Z13dumpCUDAPropsR20hipDeviceProp_tR0600 # -- Begin function _Z13dumpCUDAPropsR20hipDeviceProp_tR0600
	.type	_Z13dumpCUDAPropsR20hipDeviceProp_tR0600,@function
_Z13dumpCUDAPropsR20hipDeviceProp_tR0600: # @_Z13dumpCUDAPropsR20hipDeviceProp_tR0600
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	movl	400(%rdi), %edx
	movl	$.L.str.1, %edi
	movl	$.L.str.2, %esi
	xorl	%eax, %eax
	callq	printf
	movl	348(%rbx), %edx
	movl	$.L.str.1, %edi
	movl	$.L.str.3, %esi
	xorl	%eax, %eax
	callq	printf
	movl	404(%rbx), %edx
	movl	$.L.str.1, %edi
	movl	$.L.str.4, %esi
	xorl	%eax, %eax
	callq	printf
	movl	384(%rbx), %edx
	movl	$.L.str.1, %edi
	movl	$.L.str.5, %esi
	xorl	%eax, %eax
	callq	printf
	movl	396(%rbx), %edx
	movl	$.L.str.1, %edi
	movl	$.L.str.6, %esi
	xorl	%eax, %eax
	callq	printf
	movl	392(%rbx), %edx
	movl	$.L.str.1, %edi
	movl	$.L.str.7, %esi
	xorl	%eax, %eax
	callq	printf
	movl	360(%rbx), %edx
	movl	$.L.str.1, %edi
	movl	$.L.str.8, %esi
	xorl	%eax, %eax
	callq	printf
	movl	336(%rbx), %edx
	movl	$.L.str.1, %edi
	movl	$.L.str.9, %esi
	xorl	%eax, %eax
	callq	printf
	movl	340(%rbx), %edx
	movl	$.L.str.1, %edi
	movl	$.L.str.10, %esi
	xorl	%eax, %eax
	callq	printf
	movl	344(%rbx), %edx
	movl	$.L.str.1, %edi
	movl	$.L.str.11, %esi
	xorl	%eax, %eax
	callq	printf
	movl	324(%rbx), %edx
	movl	$.L.str.1, %edi
	movl	$.L.str.12, %esi
	xorl	%eax, %eax
	callq	printf
	movl	328(%rbx), %edx
	movl	$.L.str.1, %edi
	movl	$.L.str.13, %esi
	xorl	%eax, %eax
	callq	printf
	movl	332(%rbx), %edx
	movl	$.L.str.1, %edi
	movl	$.L.str.14, %esi
	xorl	%eax, %eax
	callq	printf
	movl	320(%rbx), %edx
	movl	$.L.str.1, %edi
	movl	$.L.str.15, %esi
	xorl	%eax, %eax
	callq	printf
	movq	312(%rbx), %rdx
	movl	$.L.str.1, %edi
	movl	$.L.str.16, %esi
	xorl	%eax, %eax
	callq	printf
	movl	364(%rbx), %edx
	movl	$.L.str.1, %edi
	movl	$.L.str.17, %esi
	xorl	%eax, %eax
	callq	printf
	movl	388(%rbx), %edx
	movl	$.L.str.1, %edi
	movl	$.L.str.18, %esi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.19, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	304(%rbx), %edx
	movl	$.L.str.1, %edi
	movl	$.L.str.20, %esi
	xorl	%eax, %eax
	callq	printf
	movq	296(%rbx), %rdx
	movl	$.L.str.1, %edi
	movl	$.L.str.21, %esi
	xorl	%eax, %eax
	callq	printf
	movq	368(%rbx), %rdx
	movl	$.L.str.1, %edi
	movl	$.L.str.22, %esi
	xorl	%eax, %eax
	callq	printf
	movq	352(%rbx), %rdx
	movl	$.L.str.1, %edi
	movl	$.L.str.23, %esi
	xorl	%eax, %eax
	callq	printf
	movq	288(%rbx), %rdx
	movl	$.L.str.1, %edi
	movl	$.L.str.24, %esi
	xorl	%eax, %eax
	callq	printf
	movl	308(%rbx), %edx
	movl	$.L.str.1, %edi
	movl	$.L.str.25, %esi
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	printf                          # TAILCALL
.Lfunc_end1:
	.size	_Z13dumpCUDAPropsR20hipDeviceProp_tR0600, .Lfunc_end1-_Z13dumpCUDAPropsR20hipDeviceProp_tR0600
	.cfi_endproc
                                        # -- End function
	.globl	_Z29__device_stub__prefixsumblockPiS_i # -- Begin function _Z29__device_stub__prefixsumblockPiS_i
	.type	_Z29__device_stub__prefixsumblockPiS_i,@function
_Z29__device_stub__prefixsumblockPiS_i: # @_Z29__device_stub__prefixsumblockPiS_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	$_Z14prefixsumblockPiS_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	_Z29__device_stub__prefixsumblockPiS_i, .Lfunc_end2-_Z29__device_stub__prefixsumblockPiS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z29__device_stub__correctsumendsPiS_S_ # -- Begin function _Z29__device_stub__correctsumendsPiS_S_
	.type	_Z29__device_stub__correctsumendsPiS_S_,@function
_Z29__device_stub__correctsumendsPiS_S_: # @_Z29__device_stub__correctsumendsPiS_S_
	.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	24(%rsp), %rsi
	movq	%rdx, (%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	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	$_Z14correctsumendsPiS_S_, %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_end3:
	.size	_Z29__device_stub__correctsumendsPiS_S_, .Lfunc_end3-_Z29__device_stub__correctsumendsPiS_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z28__device_stub__gathersumendsPiS_ # -- Begin function _Z28__device_stub__gathersumendsPiS_
	.type	_Z28__device_stub__gathersumendsPiS_,@function
_Z28__device_stub__gathersumendsPiS_:   # @_Z28__device_stub__gathersumendsPiS_
	.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	$80, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	16(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%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	$_Z13gathersumendsPiS_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$96, %rsp
	.cfi_adjust_cfa_offset -96
	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_end4:
	.size	_Z28__device_stub__gathersumendsPiS_, .Lfunc_end4-_Z28__device_stub__gathersumendsPiS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z20__device_stub__zarroPii     # -- Begin function _Z20__device_stub__zarroPii
	.type	_Z20__device_stub__zarroPii,@function
_Z20__device_stub__zarroPii:            # @_Z20__device_stub__zarroPii
	.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	$80, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	4(%rsp), %rcx
	movl	%esi, (%rcx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%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	$_Z5zarroPii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$96, %rsp
	.cfi_adjust_cfa_offset -96
	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_end5:
	.size	_Z20__device_stub__zarroPii, .Lfunc_end5-_Z20__device_stub__zarroPii
	.cfi_endproc
                                        # -- End function
	.globl	_Z9prefixsumPiS_i               # -- Begin function _Z9prefixsumPiS_i
	.type	_Z9prefixsumPiS_i,@function
_Z9prefixsumPiS_i:                      # @_Z9prefixsumPiS_i
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edx, %ebp
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movabsq	$4294967360, %r15               # imm = 0x100000040
	leal	63(%rbp), %eax
	leal	126(%rbp), %r13d
	testl	%eax, %eax
	cmovnsl	%eax, %r13d
	sarl	$6, %r13d
	leaq	(%r15,%r13), %r12
	addq	$-64, %r12
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_2
# %bb.1:
	movq	%rbx, %rdi
	movl	%ebp, %esi
	callq	_Z20__device_stub__zarroPii
.LBB6_2:
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_4
# %bb.3:
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movl	%ebp, %edx
	callq	_Z29__device_stub__prefixsumblockPiS_i
.LBB6_4:
	cmpl	$65, %ebp
	jl	.LBB6_10
# %bb.5:
	leal	(,%r13,4), %ebp
	leaq	16(%rsp), %rdi
	movq	%rbp, %rsi
	callq	hipMalloc
	leaq	8(%rsp), %rdi
	movq	%rbp, %rsi
	callq	hipMalloc
	leal	63(%r13), %eax
	shrl	$6, %eax
	leaq	(%r15,%rax), %rdi
	addq	$-64, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_7
# %bb.6:
	movq	16(%rsp), %rsi
	movq	%rbx, %rdi
	callq	_Z28__device_stub__gathersumendsPiS_
.LBB6_7:
	movq	16(%rsp), %rdi
	movq	8(%rsp), %rsi
	movl	%r13d, %edx
	callq	_Z9prefixsumPiS_i
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_9
# %bb.8:
	movq	8(%rsp), %rdi
	movq	%r14, %rsi
	movq	%rbx, %rdx
	callq	_Z29__device_stub__correctsumendsPiS_S_
.LBB6_9:
	movq	8(%rsp), %rdi
	callq	hipFree
.LBB6_10:
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	_Z9prefixsumPiS_i, .Lfunc_end6-_Z9prefixsumPiS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z10cudasummerPii               # -- Begin function _Z10cudasummerPii
	.type	_Z10cudasummerPii,@function
_Z10cudasummerPii:                      # @_Z10cudasummerPii
	.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
	movl	%esi, %ebp
	movq	%rdi, %r15
	movq	%rsp, %rbx
	movq	%rbx, %rdi
	callq	hipEventCreate
	leaq	16(%rsp), %r14
	movq	%r14, %rdi
	callq	hipEventCreate
	movq	(%rbx), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movslq	%ebp, %rbx
	leaq	(,%rbx,4), %rbp
	leaq	32(%rsp), %r12
	movq	%r12, %rdi
	movq	%rbp, %rsi
	callq	hipMalloc
	leaq	24(%rsp), %r13
	movq	%r13, %rdi
	movq	%rbp, %rsi
	callq	hipMalloc
	movq	(%r12), %rdi
	movq	%r15, %rsi
	movq	%rbp, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r12), %rdi
	movq	(%r13), %rsi
	movl	%ebx, %edx
	callq	_Z9prefixsumPiS_i
	movq	(%r13), %rsi
	movq	%r15, %rdi
	movq	%rbp, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	(%r12), %rdi
	callq	hipFree
	movq	(%r13), %rdi
	callq	hipFree
	movq	(%r14), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%r14), %rdi
	callq	hipEventSynchronize
	movq	%rsp, %r15
	movq	(%r15), %rsi
	movq	(%r14), %rdx
	leaq	12(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	cvtss2sd	(%rbx), %xmm0
	movl	$.L.str.26, %edi
	movb	$1, %al
	callq	printf
	movq	(%r15), %rdi
	callq	hipEventDestroy
	movq	(%r14), %rdi
	callq	hipEventDestroy
	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	_Z10cudasummerPii, .Lfunc_end7-_Z10cudasummerPii
	.cfi_endproc
                                        # -- End function
	.globl	_Z11devicesDumpv                # -- Begin function _Z11devicesDumpv
	.type	_Z11devicesDumpv,@function
_Z11devicesDumpv:                       # @_Z11devicesDumpv
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	subq	$1480, %rsp                     # imm = 0x5C8
	.cfi_def_cfa_offset 1504
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	leaq	4(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipGetDeviceCount
	cmpl	$0, (%rbx)
	jle	.LBB8_3
# %bb.1:                                # %.lr.ph.preheader
	xorl	%ebx, %ebx
	leaq	8(%rsp), %r14
.LBB8_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	hipGetDevicePropertiesR0600
	movq	%r14, %rdi
	callq	_Z13dumpCUDAPropsR20hipDeviceProp_tR0600
	incl	%ebx
	cmpl	4(%rsp), %ebx
	jl	.LBB8_2
.LBB8_3:                                # %._crit_edge
	addq	$1480, %rsp                     # imm = 0x5C8
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end8:
	.size	_Z11devicesDumpv, .Lfunc_end8-_Z11devicesDumpv
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.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
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	$500, %ebx                      # imm = 0x1F4
	cmpl	$2, %edi
	jl	.LBB9_2
# %bb.1:
	movq	8(%rsi), %rdi
	callq	atoi
	movl	%eax, %ebx
.LBB9_2:
	movslq	%ebx, %r12
	leaq	(,%r12,4), %rdi
	callq	malloc
	movq	%rax, %r14
	movl	%ebx, %r15d
	testl	%r12d, %r12d
	jle	.LBB9_5
# %bb.3:                                # %.lr.ph.preheader
	xorl	%eax, %eax
.LBB9_4:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	%eax, (%r14,%rax,4)
	incq	%rax
	cmpq	%rax, %r15
	jne	.LBB9_4
.LBB9_5:                                # %._crit_edge
	callq	_Z11devicesDumpv
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_Z10cudasummerPii
	leal	-1(%rbx), %eax
	cmpl	$998, %eax                      # imm = 0x3E6
	ja	.LBB9_8
# %bb.6:                                # %.lr.ph23.preheader
	xorl	%r12d, %r12d
.LBB9_7:                                # %.lr.ph23
                                        # =>This Inner Loop Header: Depth=1
	movl	(%r14,%r12,4), %esi
	movl	$.L.str.27, %edi
	xorl	%eax, %eax
	callq	printf
	incq	%r12
	cmpq	%r12, %r15
	jne	.LBB9_7
.LBB9_8:                                # %.loopexit
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_Z6verifyPii
	xorl	%eax, %eax
	addq	$8, %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_end9:
	.size	main, .Lfunc_end9-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	.LBB10_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB10_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z14prefixsumblockPiS_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	$_Z14correctsumendsPiS_S_, %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	$_Z13gathersumendsPiS_, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z5zarroPii, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %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_end10:
	.size	__hip_module_ctor, .Lfunc_end10-__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	.LBB11_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
.LBB11_2:
	retq
.Lfunc_end11:
	.size	__hip_module_dtor, .Lfunc_end11-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"error %d\n"
	.size	.L.str, 10

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"%s %d\n"
	.size	.L.str.1, 7

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

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

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

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"deviceOverlap"
	.size	.L.str.5, 14

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"integrated"
	.size	.L.str.6, 11

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"kernelExecTimeoutEnabled"
	.size	.L.str.7, 25

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"major"
	.size	.L.str.8, 6

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"maxGridSize[0]"
	.size	.L.str.9, 15

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"maxGridSize[1]"
	.size	.L.str.10, 15

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"maxGridSize[2]"
	.size	.L.str.11, 15

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"maxThreadsDim[0]"
	.size	.L.str.12, 17

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"maxThreadsDim[1]"
	.size	.L.str.13, 17

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"maxThreadsDim[2]"
	.size	.L.str.14, 17

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"maxThreadsPerBlock"
	.size	.L.str.15, 19

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"memPitch"
	.size	.L.str.16, 9

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"minor"
	.size	.L.str.17, 6

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

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"name %s\n"
	.size	.L.str.19, 9

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

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

	.type	.L.str.22,@object               # @.str.22
.L.str.22:
	.asciz	"textureAlignment"
	.size	.L.str.22, 17

	.type	.L.str.23,@object               # @.str.23
.L.str.23:
	.asciz	"totalConstMem"
	.size	.L.str.23, 14

	.type	.L.str.24,@object               # @.str.24
.L.str.24:
	.asciz	"totalGlobalMem"
	.size	.L.str.24, 15

	.type	.L.str.25,@object               # @.str.25
.L.str.25:
	.asciz	"warpSize"
	.size	.L.str.25, 9

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

	.type	_Z14correctsumendsPiS_S_,@object # @_Z14correctsumendsPiS_S_
	.globl	_Z14correctsumendsPiS_S_
	.p2align	3, 0x0
_Z14correctsumendsPiS_S_:
	.quad	_Z29__device_stub__correctsumendsPiS_S_
	.size	_Z14correctsumendsPiS_S_, 8

	.type	_Z13gathersumendsPiS_,@object   # @_Z13gathersumendsPiS_
	.globl	_Z13gathersumendsPiS_
	.p2align	3, 0x0
_Z13gathersumendsPiS_:
	.quad	_Z28__device_stub__gathersumendsPiS_
	.size	_Z13gathersumendsPiS_, 8

	.type	_Z5zarroPii,@object             # @_Z5zarroPii
	.globl	_Z5zarroPii
	.p2align	3, 0x0
_Z5zarroPii:
	.quad	_Z20__device_stub__zarroPii
	.size	_Z5zarroPii, 8

	.type	.L.str.26,@object               # @.str.26
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.26:
	.asciz	"Elapsed time %3fms\n"
	.size	.L.str.26, 20

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

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

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z14correctsumendsPiS_S_"
	.size	.L__unnamed_2, 25

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z13gathersumendsPiS_"
	.size	.L__unnamed_3, 22

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"_Z5zarroPii"
	.size	.L__unnamed_4, 12

	.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

	.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__prefixsumblockPiS_i
	.addrsig_sym _Z29__device_stub__correctsumendsPiS_S_
	.addrsig_sym _Z28__device_stub__gathersumendsPiS_
	.addrsig_sym _Z20__device_stub__zarroPii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z14prefixsumblockPiS_i
	.addrsig_sym _Z14correctsumendsPiS_S_
	.addrsig_sym _Z13gathersumendsPiS_
	.addrsig_sym _Z5zarroPii
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z14prefixsumblockPiS_i ; -- Begin function _Z14prefixsumblockPiS_i
	.globl	_Z14prefixsumblockPiS_i
	.p2align	8
	.type	_Z14prefixsumblockPiS_i,@function
_Z14prefixsumblockPiS_i:                ; @_Z14prefixsumblockPiS_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s8, s[0:1], 0x10
	s_load_b128 s[4:7], s[0:1], 0x0
	v_lshl_add_u32 v1, s15, 6, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v2, 31, v1
	v_lshlrev_b64 v[4:5], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_cmp_gt_i32_e32 vcc_lo, s8, v1
	s_and_saveexec_b32 s1, vcc_lo
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v2, s0, s4, v4
	v_add_co_ci_u32_e64 v3, s0, s5, v5, s0
	global_load_b32 v6, v[2:3], off
	v_add_co_u32 v2, s0, s6, v4
	s_delay_alu instid0(VALU_DEP_1)
	v_add_co_ci_u32_e64 v3, s0, s7, v5, s0
	s_waitcnt vmcnt(0)
	global_store_b32 v[2:3], v6, off
.LBB0_2:                                ; %._crit_edge
	s_or_b32 exec_lo, exec_lo, s1
	v_add_co_u32 v2, s0, s4, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e64 v3, s0, s5, v5, s0
	v_add_co_u32 v4, s0, s6, v4
	v_add_co_ci_u32_e64 v5, s0, s7, v5, s0
	s_mov_b32 s2, 1
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
.LBB0_3:                                ; =>This Inner Loop Header: Depth=1
	v_add_nc_u32_e32 v6, s2, v0
	v_add_nc_u32_e32 v7, s2, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_gt_u32_e64 s0, 64, v6
	v_cmp_gt_i32_e64 s1, s8, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s0, s0, s1
	s_and_saveexec_b32 s1, s0
	s_cbranch_execz .LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	s_ashr_i32 s3, s2, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_lshl_b64 s[4:5], s[2:3], 2
	v_add_co_u32 v6, s0, v2, s4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e64 v7, s0, s5, v3, s0
	s_clause 0x1
	global_load_b32 v8, v[2:3], off
	global_load_b32 v9, v[6:7], off
	v_add_co_u32 v6, s0, v4, s4
	v_add_co_ci_u32_e64 v7, s0, s5, v5, s0
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v8, v9, v8
	global_store_b32 v[6:7], v8, off
.LBB0_5:                                ;   in Loop: Header=BB0_3 Depth=1
	s_or_b32 exec_lo, exec_lo, s1
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_and_saveexec_b32 s0, vcc_lo
	s_cbranch_execz .LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	global_load_b32 v6, v[4:5], off
	s_waitcnt vmcnt(0)
	global_store_b32 v[2:3], v6, off
.LBB0_7:                                ;   in Loop: Header=BB0_3 Depth=1
	s_or_b32 exec_lo, exec_lo, s0
	s_lshl_b32 s2, s2, 1
	s_waitcnt_vscnt null, 0x0
	s_cmp_gt_i32 s2, 63
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB0_3
; %bb.8:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z14prefixsumblockPiS_i
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 20
		.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 10
		.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	_Z14prefixsumblockPiS_i, .Lfunc_end0-_Z14prefixsumblockPiS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 392
; NumSgprs: 18
; NumVgprs: 10
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 10
; 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	_Z14correctsumendsPiS_S_ ; -- Begin function _Z14correctsumendsPiS_S_
	.globl	_Z14correctsumendsPiS_S_
	.p2align	8
	.type	_Z14correctsumendsPiS_S_,@function
_Z14correctsumendsPiS_S_:               ; @_Z14correctsumendsPiS_S_
; %bb.0:
	s_load_b128 s[4:7], s[0:1], 0x0
	s_mov_b32 s2, s15
	s_mov_b32 s3, 0
	v_lshl_add_u32 v0, s2, 6, v0
	s_lshl_b64 s[2:3], s[2:3], 2
	s_load_b64 s[0:1], s[0:1], 0x10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v1, 31, v0
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v3, vcc_lo, s7, v1, vcc_lo
	s_add_u32 s2, s4, s2
	s_addc_u32 s3, s5, s3
	v_add_co_u32 v0, vcc_lo, s0, v0
	global_load_b32 v2, v[2:3], off
	s_load_b32 s2, s[2:3], 0x0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_nc_u32_e32 v2, s2, v2
	global_store_b32 v[0:1], v2, off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z14correctsumendsPiS_S_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 24
		.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 4
		.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_end1:
	.size	_Z14correctsumendsPiS_S_, .Lfunc_end1-_Z14correctsumendsPiS_S_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 136
; NumSgprs: 18
; NumVgprs: 4
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 4
; 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	_Z13gathersumendsPiS_   ; -- Begin function _Z13gathersumendsPiS_
	.globl	_Z13gathersumendsPiS_
	.p2align	8
	.type	_Z13gathersumendsPiS_,@function
_Z13gathersumendsPiS_:                  ; @_Z13gathersumendsPiS_
; %bb.0:
	v_lshl_add_u32 v0, s15, 6, v0
	s_mov_b32 s2, exec_lo
                                        ; implicit-def: $sgpr5
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e32 1, v0
	s_xor_b32 s2, exec_lo, s2
; %bb.1:
	v_ashrrev_i32_e32 v1, 31, v0
	s_mov_b32 s5, 0
; %bb.2:                                ; %Flow
	s_or_saveexec_b32 s4, s2
	s_load_b128 s[0:3], s[0:1], 0x0
	v_mov_b32_e32 v2, s5
	s_xor_b32 exec_lo, exec_lo, s4
	s_cbranch_execz .LBB2_4
; %bb.3:
	v_dual_mov_b32 v3, 0 :: v_dual_lshlrev_b32 v2, 6, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[1:2], 2, v[2:3]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v1, vcc_lo, s0, v1
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v2, vcc_lo, s1, v2, vcc_lo
	global_load_b32 v2, v[1:2], off offset:-4
	v_mov_b32_e32 v1, v3
.LBB2_4:
	s_or_b32 exec_lo, exec_lo, s4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s2, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	s_waitcnt vmcnt(0)
	global_store_b32 v[0:1], v2, off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13gathersumendsPiS_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 16
		.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 4
		.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	_Z13gathersumendsPiS_, .Lfunc_end2-_Z13gathersumendsPiS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 168
; NumSgprs: 18
; NumVgprs: 4
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 4
; 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	_Z5zarroPii             ; -- Begin function _Z5zarroPii
	.globl	_Z5zarroPii
	.p2align	8
	.type	_Z5zarroPii,@function
_Z5zarroPii:                            ; @_Z5zarroPii
; %bb.0:
	s_load_b32 s2, s[0:1], 0x8
	v_lshl_add_u32 v0, s15, 6, v0
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_gt_i32_e32 vcc_lo, s2, v0
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB3_2
; %bb.1:
	s_load_b64 s[0:1], s[0:1], 0x0
	v_ashrrev_i32_e32 v1, 31, v0
	v_mov_b32_e32 v2, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_store_b32 v[0:1], v2, off
.LBB3_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z5zarroPii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 12
		.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_end3:
	.size	_Z5zarroPii, .Lfunc_end3-_Z5zarroPii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 104
; 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
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 20
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z14prefixsumblockPiS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z14prefixsumblockPiS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     10
    .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
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 24
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z14correctsumendsPiS_S_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z14correctsumendsPiS_S_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     4
    .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
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 16
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z13gathersumendsPiS_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z13gathersumendsPiS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     4
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 12
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z5zarroPii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z5zarroPii.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
