/*
 * Title: prefixScan.cu
 * Author: 陈志韬
 * Student ID: SA12011089
 */
#include<stdio.h>
#include<stdlib.h>
#include<assert.h>
/*#include<c*/

#define NUM_BANKS 16
#define LOG_NUM_BANKS 4
#define CONFLICT_FREE_OFFSET(n) \
    ((n) >> NUM_BANKS + (n) >> (2 * LOG_NUM_BANKS)) 

#define DATA_SIZE 32
#define DEFAULT_BLOCK_SIZE 256
#define RAND_INT 50
//Only generate integers with value 0 or 1
#define MAX_INT_SIZE 2
typedef float calcType;

void randomInit(calcType *array, int m)
{
    /*srand(time(0));*/
    for(int i = 0;i < m; i++)
    {
        array[i] = ((calcType)random() / RAND_MAX) * RAND_INT;
    }
}

void randomInit(int *array, int m)
{
    /*srand(time(0));*/
    for(int i = 0;i < m; i++)
    {
        array[i] = random()%MAX_INT_SIZE;
    }
}

void printArray(calcType * array, int m)
{
    int i = 0;
    for(i = 0;i < m; i++)
    {
        printf("%f ", array[i]);
    }
    printf("\n");
}

//The size of out is larger than in by one, i.e the size of m is m+1
void cpuCalc(calcType *out, const calcType *in, int m)
{

    int j = 0;
    out[0] = 0;
    for(j = 1;j < m;j++)
    {
        out[j] = out[j - 1] + in[j - 1];
    }
}

__global__ void prescanEasy(calcType *g_odata, calcType *g_idata, int n)
{
    extern __shared__ calcType temp[];
    int thid = threadIdx.x;
    int pout = 0, pin = 1;

    //Make sure the data has been transfomed into the kernel thread
    /*g_odata[thid] = g_idata[thid];*/
    temp[pout*n + thid] = (thid > 0) ? g_idata[thid - 1] : 0;
    //下面一行GPU Gems 3没有，是我在进行错误的测试的时候认为是错误点添加上的
    //但是在修改73行代码之后的时候测试，不对结果产生影响。。
    //temp[pin*n + thid] = (thid > 0) ? g_idata[thid - 1] : 0;
    __syncthreads();
    /*for(int offset = 1; offset < n; offset *= 2)*/
    for(int offset = 1; offset < n; offset *= 2)
    {
        pout = 1 - pout; //交换双缓冲区的索引
        pin = 1 - pin;
        if( thid >= offset)
        {
            //GPU Gems 3 的样例程序的代码如下：
            //temp[pout*n+thid] += temp[pin*n+thid - offset];
            temp[pout*n + thid] = temp[pin*n + thid] + temp[pin*n + thid -offset];
        }
        else
            temp[pout*n + thid] = temp[pin*n + thid];
        __syncthreads();
        
    }
    g_odata[thid] = temp[pout*n + thid];

}
__global__ void prescanBank(calcType *g_odata, calcType *g_idata, int n)
{
    extern __shared__ calcType temp[];  // allocated on invocation
    int thid = threadIdx.x;
    int offset = 1;
    int d, ai, bi;
    calcType t;
    
    //Below is A
    temp[2*thid] = g_idata[2*thid]; // load input into shared memory
    temp[2*thid+1] = g_idata[2*thid+1];

    //A end
    for (d = n>>1; d > 0; d >>= 1)                    // build sum in place up the tree
    {
        __syncthreads();
        if (thid < d)
        {
            //Below is B
            ai = offset*(2*thid+1)-1;
            bi = offset*(2*thid+2)-1;
            //B end
            temp[bi] += temp[ai];
        }
        offset *= 2;
    }
    //Below is C
    if (thid == 0) { temp[n - 1] = 0; } // clear the last element
    //C end
    for (int d = 1; d < n; d *= 2) // traverse down tree & build scan
    {
        offset >>= 1;
        __syncthreads();
        if (thid < d)
        {
            //Below is D
            ai = offset*(2*thid+1)-1;
            bi = offset*(2*thid+2)-1;
            //D end
            t = temp[ai];
            temp[ai] = temp[bi];
            temp[bi] += t;
        }
    }
    __syncthreads();
    //Below is E
    g_odata[2*thid] = temp[2*thid]; // write results to device memory
    g_odata[2*thid+1] = temp[2*thid+1];
    //E end

}

__global__ void prescan(calcType *g_odata, calcType *g_idata, int n)
{
    extern __shared__ calcType temp[];  // allocated on invocation
    int thid = threadIdx.x;
    int offset = 1;
    //Below is A
    /*temp[2*thid] = g_idata[2*thid]; // load input into shared memory*/
    /*temp[2*thid+1] = g_idata[2*thid+1];*/
    int ai = thid;
    int bi = thid + (n/2);
    int bankOffsetA = CONFLICT_FREE_OFFSET(ai);
    int bankOffsetB = CONFLICT_FREE_OFFSET(bi);
    temp[ai + bankOffsetA] = g_idata[ai];
    temp[bi + bankOffsetB] = g_idata[bi];

    //A end
    for (int d = n>>1; d > 0; d >>= 1)                    // build sum in place up the tree
    {
        __syncthreads();
        if (thid < d)
        {
            //Below is B
            /*int ai = offset*(2*thid+1)-1;*/
            /*int bi = offset*(2*thid+2)-1;*/
            int ai = offset * (2*thid + 1) - 1;
            int bi = offset * (2*thid + 2) - 1;
            ai += CONFLICT_FREE_OFFSET(ai);
            bi += CONFLICT_FREE_OFFSET(bi);
            //B end
            temp[bi] += temp[ai];
        }
        offset *= 2;
    }
    //Below is C
    /*if (thid == 0) { temp[n - 1] = 0; } // clear the last element*/
    if(thid == 0) { temp[n - 1 + CONFLICT_FREE_OFFSET(n -1)] = 0;}
    //C end
    for (int d = 1; d < n; d *= 2) // traverse down tree & build scan
    {
        offset >>= 1;
        __syncthreads();
        if (thid < d)
        {
            //Below is D
            /*int ai = offset*(2*thid+1)-1;*/
            /*int bi = offset*(2*thid+2)-1;*/
            int ai = offset * (2*thid + 1) - 1;
            int bi = offset * (2*thid + 2) - 1;
            ai += CONFLICT_FREE_OFFSET(ai);
            bi += CONFLICT_FREE_OFFSET(bi);
            //D end
            calcType t = temp[ai];
            temp[ai] = temp[bi];
            temp[bi] += t;
        }
    }
    __syncthreads();
    //Below is E
    /*g_odata[2*thid] = temp[2*thid]; // write results to device memory*/
    /*g_odata[2*thid+1] = temp[2*thid+1];*/
    g_odata[ai] = temp[ai + bankOffsetA];
    g_odata[bi] = temp[bi + bankOffsetB];
    //E end
}

int main(int argc, char *argv[])
{
    int data_bytes = DATA_SIZE * sizeof(calcType);
    
    calcType *h_out = 0, *d_out = 0;
    calcType *h_in  = 0, *d_in = 0;
    calcType *cpu = 0;
    h_out = (calcType*)malloc(data_bytes);
    h_in = (calcType*)malloc(data_bytes);
    cpu = (calcType*)malloc(data_bytes);
    cudaMalloc( (void**)&d_out, data_bytes);
    cudaMalloc( (void**)&d_in, data_bytes);
    if(0 == h_out || 0 == h_in || 0 == d_out || 0 == d_in)
    {
        printf("Couldn't allocate memory\n");
        return 1;
    }
    randomInit(h_in, DATA_SIZE);
    printArray(h_in, DATA_SIZE);
    cudaMemcpy(d_in, h_in, data_bytes, cudaMemcpyHostToDevice);
    cudaMemset(d_out, 0, data_bytes);

    //Cpu Calc
    cpuCalc(cpu, h_in, DATA_SIZE);
    printArray(cpu, DATA_SIZE);

    //开始进入GPU执行
    dim3 grid, block;
    float time; 
    block.x = DATA_SIZE;
    /*grid.x = (DATA_SIZE + block.x - 1)/block.x;*/
    grid.x = 1;
    cudaEvent_t start, stop;
    cudaEventCreate(&start),
    cudaEventCreate(&stop);

    cudaEventRecord(start, 0);
    prescanEasy<<<grid, block, data_bytes * 2>>>(d_out, d_in, DATA_SIZE);
    /*prescanBank<<<grid, block, data_bytes * 2>>>(d_out, d_in, DATA_SIZE);*/
    /*prescan<<<grid, block, data_bytes * 2>>>(d_out, d_in, DATA_SIZE);*/
    cudaEventRecord(stop, 0);
    cudaEventSynchronize(stop);
    cudaEventElapsedTime(&time, start, stop);

    printf("PrescanEasy Time elapsed: %fms\n", time);

    cudaEventRecord(start, 0);
    /*prescanEasy<<<grid, block, data_bytes * 2>>>(d_out, d_in, DATA_SIZE);*/
    prescanBank<<<grid, block, data_bytes * 2>>>(d_out, d_in, DATA_SIZE);
    /*prescan<<<grid, block, data_bytes * 2>>>(d_out, d_in, DATA_SIZE);*/
    cudaEventRecord(stop, 0);
    cudaEventSynchronize(stop);
    cudaEventElapsedTime(&time, start, stop);

    printf("PrescanBank Time elapsed: %fms\n", time);

    cudaEventRecord(start, 0);
    /*prescanEasy<<<grid, block, data_bytes * 2>>>(d_out, d_in, DATA_SIZE);*/
    /*prescanBank<<<grid, block, data_bytes * 2>>>(d_out, d_in, DATA_SIZE);*/
    prescan<<<grid, block, data_bytes * 2>>>(d_out, d_in, DATA_SIZE);
    cudaEventRecord(stop, 0);
    cudaEventSynchronize(stop);
    cudaEventElapsedTime(&time, start, stop);
    
    printf("Prescan Time elapsed: %fms\n", time);

    cudaEventDestroy(start);
    cudaEventDestroy(stop);

    cudaMemcpy( h_out, d_out, data_bytes, cudaMemcpyDeviceToHost );
    printArray(h_out, DATA_SIZE);
    free(h_in);
    free(h_out);
    free(cpu);
    cudaFree(d_in);
    cudaFree(d_out);

    return 0;
}

	.file	"tmpxft_0020ec0a_00000000-6_prefixSum.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
	.globl	_Z10randomInitPfi
	.type	_Z10randomInitPfi, @function
_Z10randomInitPfi:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
.L3:
	cmpl	%ebx, %ebp
	jle	.L7
	call	random@PLT
	cvtsi2ssq	%rax, %xmm0
	mulss	.LC0(%rip), %xmm0
	mulss	.LC1(%rip), %xmm0
	movss	%xmm0, (%r12,%rbx,4)
	incq	%rbx
	jmp	.L3
.L7:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z10randomInitPfi, .-_Z10randomInitPfi
	.globl	_Z10randomInitPii
	.type	_Z10randomInitPii, @function
_Z10randomInitPii:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$2, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	xorl	%ebx, %ebx
	pushq	%rdx
	.cfi_def_cfa_offset 48
.L9:
	cmpl	%ebx, %ebp
	jle	.L12
	call	random@PLT
	cqto
	idivq	%r13
	movl	%edx, (%r12,%rbx,4)
	incq	%rbx
	jmp	.L9
.L12:
	popq	%rax
	.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	_Z10randomInitPii, .-_Z10randomInitPii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%f "
.LC3:
	.string	"\n"
	.text
	.globl	_Z10printArrayPfi
	.type	_Z10printArrayPfi, @function
_Z10printArrayPfi:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC2(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	xorl	%ebx, %ebx
	pushq	%rcx
	.cfi_def_cfa_offset 48
.L14:
	cmpl	%ebx, %ebp
	jle	.L17
	movq	%r13, %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	(%r12,%rbx,4), %xmm0
	call	__printf_chk@PLT
	incq	%rbx
	jmp	.L14
.L17:
	popq	%rdx
	.cfi_def_cfa_offset 40
	leaq	.LC3(%rip), %rsi
	popq	%rbx
	.cfi_def_cfa_offset 32
	movl	$2, %edi
	popq	%rbp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2029:
	.size	_Z10printArrayPfi, .-_Z10printArrayPfi
	.globl	_Z7cpuCalcPfPKfi
	.type	_Z7cpuCalcPfPKfi, @function
_Z7cpuCalcPfPKfi:
.LFB2030:
	.cfi_startproc
	endbr64
	movl	$0x00000000, (%rdi)
	xorl	%eax, %eax
.L19:
	incq	%rax
	cmpl	%eax, %edx
	jle	.L21
	movss	-4(%rdi,%rax,4), %xmm0
	addss	-4(%rsi,%rax,4), %xmm0
	movss	%xmm0, (%rdi,%rax,4)
	jmp	.L19
.L21:
	ret
	.cfi_endproc
.LFE2030:
	.size	_Z7cpuCalcPfPKfi, .-_Z7cpuCalcPfPKfi
	.globl	_Z34__device_stub__Z11prescanEasyPfS_iPfS_i
	.type	_Z34__device_stub__Z11prescanEasyPfS_iPfS_i, @function
_Z34__device_stub__Z11prescanEasyPfS_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	.L22
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z11prescanEasyPfS_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
.L22:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2056:
	.size	_Z34__device_stub__Z11prescanEasyPfS_iPfS_i, .-_Z34__device_stub__Z11prescanEasyPfS_iPfS_i
	.globl	_Z11prescanEasyPfS_i
	.type	_Z11prescanEasyPfS_i, @function
_Z11prescanEasyPfS_i:
.LFB2057:
	.cfi_startproc
	endbr64
	jmp	_Z34__device_stub__Z11prescanEasyPfS_iPfS_i
	.cfi_endproc
.LFE2057:
	.size	_Z11prescanEasyPfS_i, .-_Z11prescanEasyPfS_i
	.globl	_Z34__device_stub__Z11prescanBankPfS_iPfS_i
	.type	_Z34__device_stub__Z11prescanBankPfS_iPfS_i, @function
_Z34__device_stub__Z11prescanBankPfS_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	.L27
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z11prescanBankPfS_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
.L27:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L29
	call	__stack_chk_fail@PLT
.L29:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2058:
	.size	_Z34__device_stub__Z11prescanBankPfS_iPfS_i, .-_Z34__device_stub__Z11prescanBankPfS_iPfS_i
	.globl	_Z11prescanBankPfS_i
	.type	_Z11prescanBankPfS_i, @function
_Z11prescanBankPfS_i:
.LFB2059:
	.cfi_startproc
	endbr64
	jmp	_Z34__device_stub__Z11prescanBankPfS_iPfS_i
	.cfi_endproc
.LFE2059:
	.size	_Z11prescanBankPfS_i, .-_Z11prescanBankPfS_i
	.globl	_Z29__device_stub__Z7prescanPfS_iPfS_i
	.type	_Z29__device_stub__Z7prescanPfS_iPfS_i, @function
_Z29__device_stub__Z7prescanPfS_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	.L32
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z7prescanPfS_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
.L32:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L34
	call	__stack_chk_fail@PLT
.L34:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2060:
	.size	_Z29__device_stub__Z7prescanPfS_iPfS_i, .-_Z29__device_stub__Z7prescanPfS_iPfS_i
	.globl	_Z7prescanPfS_i
	.type	_Z7prescanPfS_i, @function
_Z7prescanPfS_i:
.LFB2061:
	.cfi_startproc
	endbr64
	jmp	_Z29__device_stub__Z7prescanPfS_iPfS_i
	.cfi_endproc
.LFE2061:
	.size	_Z7prescanPfS_i, .-_Z7prescanPfS_i
	.section	.rodata.str1.1
.LC5:
	.string	"Couldn't allocate memory\n"
.LC6:
	.string	"PrescanEasy Time elapsed: %fms\n"
.LC7:
	.string	"PrescanBank Time elapsed: %fms\n"
.LC8:
	.string	"Prescan Time elapsed: %fms\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$128, %edi
	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
	subq	$88, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	xorl	%eax, %eax
	movq	%rax, 16(%rsp)
	movq	%rax, 24(%rsp)
	call	malloc@PLT
	movl	$128, %edi
	movq	%rax, %rbp
	call	malloc@PLT
	movl	$128, %edi
	movq	%rax, %rbx
	call	malloc@PLT
	leaq	16(%rsp), %rdi
	movl	$128, %esi
	movq	%rax, %r12
	call	cudaMalloc@PLT
	leaq	24(%rsp), %rdi
	movl	$128, %esi
	call	cudaMalloc@PLT
	testq	%rbp, %rbp
	je	.L38
	testq	%rbx, %rbx
	je	.L38
	cmpq	$0, 16(%rsp)
	je	.L38
	cmpq	$0, 24(%rsp)
	jne	.L39
.L38:
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %eax
	jmp	.L37
.L39:
	movl	$32, %esi
	movq	%rbx, %rdi
	call	_Z10randomInitPfi
	movl	$32, %esi
	movq	%rbx, %rdi
	call	_Z10printArrayPfi
	movq	24(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movl	$128, %edx
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	movl	$128, %edx
	call	cudaMemset@PLT
	movl	$32, %edx
	movq	%r12, %rdi
	movq	%rbx, %rsi
	call	_Z7cpuCalcPfPKfi
	movl	$32, %esi
	call	_Z10printArrayPfi
	leaq	32(%rsp), %rdi
	movabsq	$4294967297, %rax
	movl	$1, 56(%rsp)
	movq	%rax, 48(%rsp)
	addq	$31, %rax
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	cudaEventCreate@PLT
	leaq	40(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	68(%rsp), %ecx
	movl	56(%rsp), %esi
	xorl	%r9d, %r9d
	movq	60(%rsp), %rdx
	movq	48(%rsp), %rdi
	movl	$256, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L41
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdi
	movl	$32, %edx
	call	_Z34__device_stub__Z11prescanEasyPfS_iPfS_i
.L41:
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	leaq	12(%rsp), %r13
	call	cudaEventRecord@PLT
	movq	40(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	movq	%r13, %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC6(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	12(%rsp), %xmm0
	call	__printf_chk@PLT
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	68(%rsp), %ecx
	movl	56(%rsp), %esi
	xorl	%r9d, %r9d
	movq	60(%rsp), %rdx
	movq	48(%rsp), %rdi
	movl	$256, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L42
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdi
	movl	$32, %edx
	call	_Z34__device_stub__Z11prescanBankPfS_iPfS_i
.L42:
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	40(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	movq	%r13, %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	12(%rsp), %xmm0
	call	__printf_chk@PLT
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	68(%rsp), %ecx
	movl	56(%rsp), %esi
	xorl	%r9d, %r9d
	movq	60(%rsp), %rdx
	movq	48(%rsp), %rdi
	movl	$256, %r8d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L43
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdi
	movl	$32, %edx
	call	_Z29__device_stub__Z7prescanPfS_iPfS_i
.L43:
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	40(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	movq	%r13, %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC8(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	12(%rsp), %xmm0
	call	__printf_chk@PLT
	movq	32(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	40(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	16(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbp, %rdi
	movl	$128, %edx
	call	cudaMemcpy@PLT
	movl	$32, %esi
	movq	%rbp, %rdi
	call	_Z10printArrayPfi
	movq	%rbx, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	xorl	%eax, %eax
.L37:
	movq	72(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L44
	call	__stack_chk_fail@PLT
.L44:
	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
.LFE2031:
	.size	main, .-main
	.section	.rodata.str1.1
.LC9:
	.string	"_Z7prescanPfS_i"
.LC10:
	.string	"_Z11prescanBankPfS_i"
.LC11:
	.string	"_Z11prescanEasyPfS_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	.LC9(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z7prescanPfS_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	.LC10(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z11prescanBankPfS_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	.LC11(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z11prescanEasyPfS_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
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC0:
	.long	805306368
	.align 4
.LC1:
	.long	1112014848
	.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:

/*
 * Title: prefixScan.cu
 * Author: 陈志韬
 * Student ID: SA12011089
 */

#include <hip/hip_runtime.h>
#include<stdio.h>
#include<stdlib.h>
#include<assert.h>
/*#include<c*/

#define NUM_BANKS 16
#define LOG_NUM_BANKS 4
#define CONFLICT_FREE_OFFSET(n) \
    ((n) >> NUM_BANKS + (n) >> (2 * LOG_NUM_BANKS)) 

#define DATA_SIZE 32
#define DEFAULT_BLOCK_SIZE 256
#define RAND_INT 50
//Only generate integers with value 0 or 1
#define MAX_INT_SIZE 2
typedef float calcType;

void randomInit(calcType *array, int m)
{
    /*srand(time(0));*/
    for(int i = 0;i < m; i++)
    {
        array[i] = ((calcType)random() / RAND_MAX) * RAND_INT;
    }
}

void randomInit(int *array, int m)
{
    /*srand(time(0));*/
    for(int i = 0;i < m; i++)
    {
        array[i] = random()%MAX_INT_SIZE;
    }
}

void printArray(calcType * array, int m)
{
    int i = 0;
    for(i = 0;i < m; i++)
    {
        printf("%f ", array[i]);
    }
    printf("\n");
}

//The size of out is larger than in by one, i.e the size of m is m+1
void cpuCalc(calcType *out, const calcType *in, int m)
{

    int j = 0;
    out[0] = 0;
    for(j = 1;j < m;j++)
    {
        out[j] = out[j - 1] + in[j - 1];
    }
}

__global__ void prescanEasy(calcType *g_odata, calcType *g_idata, int n)
{
    extern __shared__ calcType temp[];
    int thid = threadIdx.x;
    int pout = 0, pin = 1;

    //Make sure the data has been transfomed into the kernel thread
    /*g_odata[thid] = g_idata[thid];*/
    temp[pout*n + thid] = (thid > 0) ? g_idata[thid - 1] : 0;
    //下面一行GPU Gems 3没有，是我在进行错误的测试的时候认为是错误点添加上的
    //但是在修改73行代码之后的时候测试，不对结果产生影响。。
    //temp[pin*n + thid] = (thid > 0) ? g_idata[thid - 1] : 0;
    __syncthreads();
    /*for(int offset = 1; offset < n; offset *= 2)*/
    for(int offset = 1; offset < n; offset *= 2)
    {
        pout = 1 - pout; //交换双缓冲区的索引
        pin = 1 - pin;
        if( thid >= offset)
        {
            //GPU Gems 3 的样例程序的代码如下：
            //temp[pout*n+thid] += temp[pin*n+thid - offset];
            temp[pout*n + thid] = temp[pin*n + thid] + temp[pin*n + thid -offset];
        }
        else
            temp[pout*n + thid] = temp[pin*n + thid];
        __syncthreads();
        
    }
    g_odata[thid] = temp[pout*n + thid];

}
__global__ void prescanBank(calcType *g_odata, calcType *g_idata, int n)
{
    extern __shared__ calcType temp[];  // allocated on invocation
    int thid = threadIdx.x;
    int offset = 1;
    int d, ai, bi;
    calcType t;
    
    //Below is A
    temp[2*thid] = g_idata[2*thid]; // load input into shared memory
    temp[2*thid+1] = g_idata[2*thid+1];

    //A end
    for (d = n>>1; d > 0; d >>= 1)                    // build sum in place up the tree
    {
        __syncthreads();
        if (thid < d)
        {
            //Below is B
            ai = offset*(2*thid+1)-1;
            bi = offset*(2*thid+2)-1;
            //B end
            temp[bi] += temp[ai];
        }
        offset *= 2;
    }
    //Below is C
    if (thid == 0) { temp[n - 1] = 0; } // clear the last element
    //C end
    for (int d = 1; d < n; d *= 2) // traverse down tree & build scan
    {
        offset >>= 1;
        __syncthreads();
        if (thid < d)
        {
            //Below is D
            ai = offset*(2*thid+1)-1;
            bi = offset*(2*thid+2)-1;
            //D end
            t = temp[ai];
            temp[ai] = temp[bi];
            temp[bi] += t;
        }
    }
    __syncthreads();
    //Below is E
    g_odata[2*thid] = temp[2*thid]; // write results to device memory
    g_odata[2*thid+1] = temp[2*thid+1];
    //E end

}

__global__ void prescan(calcType *g_odata, calcType *g_idata, int n)
{
    extern __shared__ calcType temp[];  // allocated on invocation
    int thid = threadIdx.x;
    int offset = 1;
    //Below is A
    /*temp[2*thid] = g_idata[2*thid]; // load input into shared memory*/
    /*temp[2*thid+1] = g_idata[2*thid+1];*/
    int ai = thid;
    int bi = thid + (n/2);
    int bankOffsetA = CONFLICT_FREE_OFFSET(ai);
    int bankOffsetB = CONFLICT_FREE_OFFSET(bi);
    temp[ai + bankOffsetA] = g_idata[ai];
    temp[bi + bankOffsetB] = g_idata[bi];

    //A end
    for (int d = n>>1; d > 0; d >>= 1)                    // build sum in place up the tree
    {
        __syncthreads();
        if (thid < d)
        {
            //Below is B
            /*int ai = offset*(2*thid+1)-1;*/
            /*int bi = offset*(2*thid+2)-1;*/
            int ai = offset * (2*thid + 1) - 1;
            int bi = offset * (2*thid + 2) - 1;
            ai += CONFLICT_FREE_OFFSET(ai);
            bi += CONFLICT_FREE_OFFSET(bi);
            //B end
            temp[bi] += temp[ai];
        }
        offset *= 2;
    }
    //Below is C
    /*if (thid == 0) { temp[n - 1] = 0; } // clear the last element*/
    if(thid == 0) { temp[n - 1 + CONFLICT_FREE_OFFSET(n -1)] = 0;}
    //C end
    for (int d = 1; d < n; d *= 2) // traverse down tree & build scan
    {
        offset >>= 1;
        __syncthreads();
        if (thid < d)
        {
            //Below is D
            /*int ai = offset*(2*thid+1)-1;*/
            /*int bi = offset*(2*thid+2)-1;*/
            int ai = offset * (2*thid + 1) - 1;
            int bi = offset * (2*thid + 2) - 1;
            ai += CONFLICT_FREE_OFFSET(ai);
            bi += CONFLICT_FREE_OFFSET(bi);
            //D end
            calcType t = temp[ai];
            temp[ai] = temp[bi];
            temp[bi] += t;
        }
    }
    __syncthreads();
    //Below is E
    /*g_odata[2*thid] = temp[2*thid]; // write results to device memory*/
    /*g_odata[2*thid+1] = temp[2*thid+1];*/
    g_odata[ai] = temp[ai + bankOffsetA];
    g_odata[bi] = temp[bi + bankOffsetB];
    //E end
}

int main(int argc, char *argv[])
{
    int data_bytes = DATA_SIZE * sizeof(calcType);
    
    calcType *h_out = 0, *d_out = 0;
    calcType *h_in  = 0, *d_in = 0;
    calcType *cpu = 0;
    h_out = (calcType*)malloc(data_bytes);
    h_in = (calcType*)malloc(data_bytes);
    cpu = (calcType*)malloc(data_bytes);
    hipMalloc( (void**)&d_out, data_bytes);
    hipMalloc( (void**)&d_in, data_bytes);
    if(0 == h_out || 0 == h_in || 0 == d_out || 0 == d_in)
    {
        printf("Couldn't allocate memory\n");
        return 1;
    }
    randomInit(h_in, DATA_SIZE);
    printArray(h_in, DATA_SIZE);
    hipMemcpy(d_in, h_in, data_bytes, hipMemcpyHostToDevice);
    hipMemset(d_out, 0, data_bytes);

    //Cpu Calc
    cpuCalc(cpu, h_in, DATA_SIZE);
    printArray(cpu, DATA_SIZE);

    //开始进入GPU执行
    dim3 grid, block;
    float time; 
    block.x = DATA_SIZE;
    /*grid.x = (DATA_SIZE + block.x - 1)/block.x;*/
    grid.x = 1;
    hipEvent_t start, stop;
    hipEventCreate(&start),
    hipEventCreate(&stop);

    hipEventRecord(start, 0);
    prescanEasy<<<grid, block, data_bytes * 2>>>(d_out, d_in, DATA_SIZE);
    /*prescanBank<<<grid, block, data_bytes * 2>>>(d_out, d_in, DATA_SIZE);*/
    /*prescan<<<grid, block, data_bytes * 2>>>(d_out, d_in, DATA_SIZE);*/
    hipEventRecord(stop, 0);
    hipEventSynchronize(stop);
    hipEventElapsedTime(&time, start, stop);

    printf("PrescanEasy Time elapsed: %fms\n", time);

    hipEventRecord(start, 0);
    /*prescanEasy<<<grid, block, data_bytes * 2>>>(d_out, d_in, DATA_SIZE);*/
    prescanBank<<<grid, block, data_bytes * 2>>>(d_out, d_in, DATA_SIZE);
    /*prescan<<<grid, block, data_bytes * 2>>>(d_out, d_in, DATA_SIZE);*/
    hipEventRecord(stop, 0);
    hipEventSynchronize(stop);
    hipEventElapsedTime(&time, start, stop);

    printf("PrescanBank Time elapsed: %fms\n", time);

    hipEventRecord(start, 0);
    /*prescanEasy<<<grid, block, data_bytes * 2>>>(d_out, d_in, DATA_SIZE);*/
    /*prescanBank<<<grid, block, data_bytes * 2>>>(d_out, d_in, DATA_SIZE);*/
    prescan<<<grid, block, data_bytes * 2>>>(d_out, d_in, DATA_SIZE);
    hipEventRecord(stop, 0);
    hipEventSynchronize(stop);
    hipEventElapsedTime(&time, start, stop);
    
    printf("Prescan Time elapsed: %fms\n", time);

    hipEventDestroy(start);
    hipEventDestroy(stop);

    hipMemcpy( h_out, d_out, data_bytes, hipMemcpyDeviceToHost );
    printArray(h_out, DATA_SIZE);
    free(h_in);
    free(h_out);
    free(cpu);
    hipFree(d_in);
    hipFree(d_out);

    return 0;
}

	.text
	.file	"prefixSum.hip"
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z10randomInitPfi
.LCPI0_0:
	.long	0x30000000                      # float 4.65661287E-10
.LCPI0_1:
	.long	0x42480000                      # float 50
	.text
	.globl	_Z10randomInitPfi
	.type	_Z10randomInitPfi,@function
_Z10randomInitPfi:                      # @_Z10randomInitPfi
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB0_4
# %bb.1:                                # %.lr.ph.preheader
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %rbx
	movl	%esi, %r14d
	xorl	%r15d, %r15d
.LBB0_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	callq	random
	xorps	%xmm0, %xmm0
	cvtsi2ss	%rax, %xmm0
	mulss	.LCPI0_0(%rip), %xmm0
	mulss	.LCPI0_1(%rip), %xmm0
	movss	%xmm0, (%rbx,%r15,4)
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB0_2
# %bb.3:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %r15
.LBB0_4:                                # %._crit_edge
	retq
.Lfunc_end0:
	.size	_Z10randomInitPfi, .Lfunc_end0-_Z10randomInitPfi
	.cfi_endproc
                                        # -- End function
	.globl	_Z10randomInitPii               # -- Begin function _Z10randomInitPii
	.type	_Z10randomInitPii,@function
_Z10randomInitPii:                      # @_Z10randomInitPii
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB1_4
# %bb.1:                                # %.lr.ph.preheader
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %rbx
	movl	%esi, %r14d
	xorl	%r15d, %r15d
.LBB1_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	callq	random
	movq	%rax, %rcx
	shrq	$63, %rcx
	addl	%eax, %ecx
	andl	$-2, %ecx
	subl	%ecx, %eax
	movl	%eax, (%rbx,%r15,4)
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB1_2
# %bb.3:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %r15
.LBB1_4:                                # %._crit_edge
	retq
.Lfunc_end1:
	.size	_Z10randomInitPii, .Lfunc_end1-_Z10randomInitPii
	.cfi_endproc
                                        # -- End function
	.globl	_Z10printArrayPfi               # -- Begin function _Z10printArrayPfi
	.type	_Z10printArrayPfi,@function
_Z10printArrayPfi:                      # @_Z10printArrayPfi
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB2_4
# %bb.1:                                # %.lr.ph.preheader
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %rbx
	movl	%esi, %r14d
	xorl	%r15d, %r15d
.LBB2_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx,%r15,4), %xmm0
	movl	$.L.str, %edi
	movb	$1, %al
	callq	printf
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB2_2
# %bb.3:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %r15
.LBB2_4:                                # %._crit_edge
	movl	$10, %edi
	jmp	putchar@PLT                     # TAILCALL
.Lfunc_end2:
	.size	_Z10printArrayPfi, .Lfunc_end2-_Z10printArrayPfi
	.cfi_endproc
                                        # -- End function
	.globl	_Z7cpuCalcPfPKfi                # -- Begin function _Z7cpuCalcPfPKfi
	.type	_Z7cpuCalcPfPKfi,@function
_Z7cpuCalcPfPKfi:                       # @_Z7cpuCalcPfPKfi
	.cfi_startproc
# %bb.0:
	movl	$0, (%rdi)
	cmpl	$2, %edx
	jl	.LBB3_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%edx, %eax
	decq	%rax
	xorps	%xmm0, %xmm0
	xorl	%ecx, %ecx
.LBB3_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	addss	(%rsi,%rcx,4), %xmm0
	movss	%xmm0, 4(%rdi,%rcx,4)
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB3_2
.LBB3_3:                                # %._crit_edge
	retq
.Lfunc_end3:
	.size	_Z7cpuCalcPfPKfi, .Lfunc_end3-_Z7cpuCalcPfPKfi
	.cfi_endproc
                                        # -- End function
	.globl	_Z26__device_stub__prescanEasyPfS_i # -- Begin function _Z26__device_stub__prescanEasyPfS_i
	.type	_Z26__device_stub__prescanEasyPfS_i,@function
_Z26__device_stub__prescanEasyPfS_i:    # @_Z26__device_stub__prescanEasyPfS_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	$_Z11prescanEasyPfS_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_end4:
	.size	_Z26__device_stub__prescanEasyPfS_i, .Lfunc_end4-_Z26__device_stub__prescanEasyPfS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z26__device_stub__prescanBankPfS_i # -- Begin function _Z26__device_stub__prescanBankPfS_i
	.type	_Z26__device_stub__prescanBankPfS_i,@function
_Z26__device_stub__prescanBankPfS_i:    # @_Z26__device_stub__prescanBankPfS_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	$_Z11prescanBankPfS_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_end5:
	.size	_Z26__device_stub__prescanBankPfS_i, .Lfunc_end5-_Z26__device_stub__prescanBankPfS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z22__device_stub__prescanPfS_i # -- Begin function _Z22__device_stub__prescanPfS_i
	.type	_Z22__device_stub__prescanPfS_i,@function
_Z22__device_stub__prescanPfS_i:        # @_Z22__device_stub__prescanPfS_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	$_Z7prescanPfS_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_end6:
	.size	_Z22__device_stub__prescanPfS_i, .Lfunc_end6-_Z22__device_stub__prescanPfS_i
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI7_0:
	.long	0x30000000                      # float 4.65661287E-10
.LCPI7_1:
	.long	0x42480000                      # float 50
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$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
	xorl	%eax, %eax
	leaq	8(%rsp), %r12
	movq	%rax, (%r12)
	leaq	24(%rsp), %r13
	movq	%rax, (%r13)
	movl	$128, %edi
	callq	malloc
	movq	%rax, %rbx
	movl	$128, %edi
	callq	malloc
	movq	%rax, %r15
	movl	$128, %edi
	callq	malloc
	movq	%rax, %r14
	movl	$128, %esi
	movq	%r12, %rdi
	callq	hipMalloc
	movl	$128, %esi
	movq	%r13, %rdi
	callq	hipMalloc
	testq	%rbx, %rbx
	je	.LBB7_16
# %bb.1:
	testq	%r15, %r15
	je	.LBB7_16
# %bb.2:
	cmpq	$0, 8(%rsp)
	je	.LBB7_16
# %bb.3:
	cmpq	$0, 24(%rsp)
	je	.LBB7_16
# %bb.4:                                # %.lr.ph.i.preheader
	xorl	%r12d, %r12d
.LBB7_5:                                # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	callq	random
	xorps	%xmm0, %xmm0
	cvtsi2ss	%rax, %xmm0
	mulss	.LCPI7_0(%rip), %xmm0
	mulss	.LCPI7_1(%rip), %xmm0
	movss	%xmm0, (%r15,%r12,4)
	incq	%r12
	cmpq	$32, %r12
	jne	.LBB7_5
# %bb.6:                                # %_Z10randomInitPfi.exit
	movq	%r15, %rdi
	movl	$32, %esi
	callq	_Z10printArrayPfi
	movq	24(%rsp), %rdi
	movl	$128, %edx
	movq	%r15, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	8(%rsp), %rdi
	movl	$128, %edx
	xorl	%esi, %esi
	callq	hipMemset
	movl	$0, (%r14)
	movl	$1, %eax
	xorps	%xmm0, %xmm0
.LBB7_7:                                # %.lr.ph.i55
                                        # =>This Inner Loop Header: Depth=1
	addss	-4(%r15,%rax,4), %xmm0
	movss	%xmm0, (%r14,%rax,4)
	incq	%rax
	cmpq	$32, %rax
	jne	.LBB7_7
# %bb.8:                                # %_Z7cpuCalcPfPKfi.exit
	movabsq	$4294967297, %r12               # imm = 0x100000001
	movq	%r14, %rdi
	movl	$32, %esi
	callq	_Z10printArrayPfi
	leaq	16(%rsp), %r13
	movq	%r13, %rdi
	callq	hipEventCreate
	movq	%rsp, %rdi
	callq	hipEventCreate
	movq	(%r13), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	leaq	31(%r12), %rbp
	movl	$256, %r8d                      # imm = 0x100
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB7_10
# %bb.9:
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi
	movl	$32, %edx
	callq	_Z26__device_stub__prescanEasyPfS_i
.LBB7_10:
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	movq	16(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	36(%rsp), %r13
	movq	%r13, %rdi
	callq	hipEventElapsedTime
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r13), %xmm0
	movl	$.L.str.3, %edi
	movb	$1, %al
	callq	printf
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movl	$256, %r8d                      # imm = 0x100
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB7_12
# %bb.11:
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi
	movl	$32, %edx
	callq	_Z26__device_stub__prescanBankPfS_i
.LBB7_12:
	movq	(%rsp), %rdi
	xorl	%r13d, %r13d
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	movq	16(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	36(%rsp), %r12
	movq	%r12, %rdi
	callq	hipEventElapsedTime
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r12), %xmm0
	movl	$.L.str.4, %edi
	movb	$1, %al
	callq	printf
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movl	$256, %r8d                      # imm = 0x100
	movabsq	$4294967297, %rdi               # imm = 0x100000001
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB7_14
# %bb.13:
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi
	movl	$32, %edx
	callq	_Z22__device_stub__prescanPfS_i
.LBB7_14:
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	movq	16(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	36(%rsp), %r12
	movq	%r12, %rdi
	callq	hipEventElapsedTime
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r12), %xmm0
	movl	$.L.str.5, %edi
	movb	$1, %al
	callq	printf
	movq	16(%rsp), %rdi
	callq	hipEventDestroy
	movq	(%rsp), %rdi
	callq	hipEventDestroy
	movq	8(%rsp), %rsi
	movl	$128, %edx
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	%rbx, %rdi
	movl	$32, %esi
	callq	_Z10printArrayPfi
	movq	%r15, %rdi
	callq	free
	movq	%rbx, %rdi
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	jmp	.LBB7_15
.LBB7_16:
	movl	$.Lstr, %edi
	callq	puts@PLT
	movl	$1, %r13d
.LBB7_15:
	movl	%r13d, %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	$_Z11prescanEasyPfS_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	$_Z11prescanBankPfS_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	$_Z7prescanPfS_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	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"%f "
	.size	.L.str, 4

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

	.type	_Z11prescanBankPfS_i,@object    # @_Z11prescanBankPfS_i
	.globl	_Z11prescanBankPfS_i
	.p2align	3, 0x0
_Z11prescanBankPfS_i:
	.quad	_Z26__device_stub__prescanBankPfS_i
	.size	_Z11prescanBankPfS_i, 8

	.type	_Z7prescanPfS_i,@object         # @_Z7prescanPfS_i
	.globl	_Z7prescanPfS_i
	.p2align	3, 0x0
_Z7prescanPfS_i:
	.quad	_Z22__device_stub__prescanPfS_i
	.size	_Z7prescanPfS_i, 8

	.type	.L.str.3,@object                # @.str.3
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.3:
	.asciz	"PrescanEasy Time elapsed: %fms\n"
	.size	.L.str.3, 32

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"PrescanBank Time elapsed: %fms\n"
	.size	.L.str.4, 32

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Prescan Time elapsed: %fms\n"
	.size	.L.str.5, 28

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z11prescanEasyPfS_i"
	.size	.L__unnamed_1, 21

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z11prescanBankPfS_i"
	.size	.L__unnamed_2, 21

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z7prescanPfS_i"
	.size	.L__unnamed_3, 16

	.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	"Couldn't allocate memory"
	.size	.Lstr, 25

	.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 _Z26__device_stub__prescanEasyPfS_i
	.addrsig_sym _Z26__device_stub__prescanBankPfS_i
	.addrsig_sym _Z22__device_stub__prescanPfS_i
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z11prescanEasyPfS_i
	.addrsig_sym _Z11prescanBankPfS_i
	.addrsig_sym _Z7prescanPfS_i
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z11prescanEasyPfS_i    ; -- Begin function _Z11prescanEasyPfS_i
	.globl	_Z11prescanEasyPfS_i
	.p2align	8
	.type	_Z11prescanEasyPfS_i,@function
_Z11prescanEasyPfS_i:                   ; @_Z11prescanEasyPfS_i
; %bb.0:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_mov_b32_e32 v3, 0
	v_lshlrev_b32_e32 v1, 2, v0
	s_mov_b32 s2, 0
	s_mov_b32 s3, exec_lo
	v_cmpx_ne_u32_e32 0, v0
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_waitcnt lgkmcnt(0)
	global_load_b32 v3, v1, s[6:7] offset:-4
.LBB0_2:
	s_or_b32 exec_lo, exec_lo, s3
	s_load_b32 s0, s[0:1], 0x10
	v_lshl_add_u32 v2, v0, 2, 0
	s_waitcnt vmcnt(0)
	ds_store_b32 v2, v3
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cmp_lt_i32 s0, 2
	s_cbranch_scc1 .LBB0_7
; %bb.3:                                ; %.lr.ph.preheader
	s_mov_b32 s1, 1
	s_mov_b32 s3, 1
.LBB0_4:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	s_sub_i32 s3, 1, s3
	s_mov_b32 s6, exec_lo
	s_mul_i32 s7, s3, s0
	v_lshl_add_u32 v3, s7, 2, v2
	ds_load_b32 v3, v3
	v_cmpx_le_u32_e64 s1, v0
	s_cbranch_execz .LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	v_add_nc_u32_e32 v4, s7, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_subrev_nc_u32_e32 v4, s1, v4
	v_lshl_add_u32 v4, v4, 2, 0
	ds_load_b32 v4, v4
	s_waitcnt lgkmcnt(0)
	v_add_f32_e32 v3, v3, v4
.LBB0_6:                                ;   in Loop: Header=BB0_4 Depth=1
	s_or_b32 exec_lo, exec_lo, s6
	s_sub_i32 s2, 1, s2
	s_lshl_b32 s1, s1, 1
	s_mul_i32 s6, s2, s0
	s_cmp_ge_i32 s1, s0
	v_lshl_add_u32 v4, s6, 2, v2
	s_waitcnt lgkmcnt(0)
	ds_store_b32 v4, v3
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB0_4
.LBB0_7:                                ; %Flow54
	s_mul_i32 s0, s2, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	v_lshl_add_u32 v0, s0, 2, v2
	ds_load_b32 v0, v0
	s_waitcnt lgkmcnt(0)
	global_store_b32 v1, v0, s[4:5]
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z11prescanEasyPfS_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 5
		.amdhsa_next_free_sgpr 8
		.amdhsa_reserve_vcc 0
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z11prescanEasyPfS_i, .Lfunc_end0-_Z11prescanEasyPfS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 296
; NumSgprs: 8
; NumVgprs: 5
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 8
; NumVGPRsForWavesPerEU: 5
; 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	_Z11prescanBankPfS_i    ; -- Begin function _Z11prescanBankPfS_i
	.globl	_Z11prescanBankPfS_i
	.p2align	8
	.type	_Z11prescanBankPfS_i,@function
_Z11prescanBankPfS_i:                   ; @_Z11prescanBankPfS_i
; %bb.0:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_lshlrev_b32_e32 v2, 3, v0
	s_load_b32 s0, s[0:1], 0x10
	v_lshlrev_b32_e32 v1, 1, v0
	s_mov_b32 s1, 1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(SALU_CYCLE_1)
	v_or_b32_e32 v3, 1, v1
	s_waitcnt lgkmcnt(0)
	global_load_b64 v[4:5], v2, s[6:7]
	v_add_nc_u32_e32 v2, 0, v2
	s_ashr_i32 s2, s0, 1
	s_cmp_lt_i32 s2, 1
	s_waitcnt vmcnt(0)
	ds_store_2addr_b32 v2, v4, v5 offset1:1
	s_cbranch_scc1 .LBB1_5
.LBB1_1:                                ; =>This Inner Loop Header: Depth=1
	s_mov_b32 s3, exec_lo
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	v_cmpx_gt_i32_e64 s2, v0
	s_cbranch_execz .LBB1_3
; %bb.2:                                ;   in Loop: Header=BB1_1 Depth=1
	v_mul_lo_u32 v4, s1, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b32_e32 v4, 2, v4
	v_add3_u32 v4, v4, 0, -4
	s_delay_alu instid0(VALU_DEP_1)
	v_lshl_add_u32 v5, s1, 2, v4
	ds_load_b32 v4, v4
	ds_load_b32 v6, v5
	s_waitcnt lgkmcnt(0)
	v_add_f32_e32 v4, v4, v6
	ds_store_b32 v5, v4
.LBB1_3:                                ;   in Loop: Header=BB1_1 Depth=1
	s_or_b32 exec_lo, exec_lo, s3
	s_lshl_b32 s1, s1, 1
	s_lshr_b32 s3, s2, 1
	s_cmp_gt_u32 s2, 1
	s_cbranch_scc0 .LBB1_5
; %bb.4:                                ;   in Loop: Header=BB1_1 Depth=1
	s_mov_b32 s2, s3
	s_branch .LBB1_1
.LBB1_5:                                ; %._crit_edge
	s_mov_b32 s2, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB1_7
; %bb.6:
	s_lshl_b32 s3, s0, 2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s3, s3, 0
	s_add_i32 s3, s3, -4
	s_delay_alu instid0(SALU_CYCLE_1)
	v_dual_mov_b32 v4, 0 :: v_dual_mov_b32 v5, s3
	ds_store_b32 v5, v4
.LBB1_7:
	s_or_b32 exec_lo, exec_lo, s2
	s_cmp_lt_i32 s0, 2
	s_cbranch_scc1 .LBB1_12
; %bb.8:                                ; %.lr.ph49
	s_mov_b32 s2, 1
.LBB1_9:                                ; =>This Inner Loop Header: Depth=1
	s_lshr_b32 s1, s1, 1
	s_mov_b32 s3, exec_lo
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	v_cmpx_gt_u32_e64 s2, v0
	s_cbranch_execz .LBB1_11
; %bb.10:                               ;   in Loop: Header=BB1_9 Depth=1
	v_mul_lo_u32 v4, s1, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b32_e32 v4, 2, v4
	v_add3_u32 v4, v4, 0, -4
	s_delay_alu instid0(VALU_DEP_1)
	v_lshl_add_u32 v5, s1, 2, v4
	ds_load_b32 v6, v4
	ds_load_b32 v7, v5
	s_waitcnt lgkmcnt(0)
	v_add_f32_e32 v6, v6, v7
	ds_store_b32 v4, v7
	ds_store_b32 v5, v6
.LBB1_11:                               ;   in Loop: Header=BB1_9 Depth=1
	s_or_b32 exec_lo, exec_lo, s3
	s_lshl_b32 s2, s2, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_ge_i32 s2, s0
	s_cbranch_scc0 .LBB1_9
.LBB1_12:                               ; %._crit_edge50
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	ds_load_2addr_b32 v[2:3], v2 offset1:1
	v_lshlrev_b32_e32 v0, 2, v1
	s_waitcnt lgkmcnt(0)
	global_store_b64 v0, v[2:3], s[4:5]
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z11prescanBankPfS_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 8
		.amdhsa_next_free_sgpr 8
		.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	_Z11prescanBankPfS_i, .Lfunc_end1-_Z11prescanBankPfS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 452
; NumSgprs: 8
; NumVgprs: 8
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 8
; NumVGPRsForWavesPerEU: 8
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z7prescanPfS_i         ; -- Begin function _Z7prescanPfS_i
	.globl	_Z7prescanPfS_i
	.p2align	8
	.type	_Z7prescanPfS_i,@function
_Z7prescanPfS_i:                        ; @_Z7prescanPfS_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s6, s[0:1], 0x10
	s_load_b128 s[0:3], s[0:1], 0x0
	v_lshlrev_b32_e32 v1, 2, v0
	v_lshl_or_b32 v4, v0, 1, 1
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s4, s6, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s4, s6, s4
	s_ashr_i32 s8, s4, 1
	v_add_co_u32 v2, s4, s2, v1
	s_ashr_i32 s9, s8, 31
	v_add_co_ci_u32_e64 v3, null, s3, 0, s4
	s_lshl_b64 s[4:5], s[8:9], 2
	s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1)
	v_add_co_u32 v2, vcc_lo, v2, s4
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v3, vcc_lo
	s_clause 0x1
	global_load_b32 v5, v1, s[2:3]
	global_load_b32 v6, v[2:3], off
	v_add_nc_u32_e32 v2, s8, v0
	s_ashr_i32 s3, s6, 1
	s_mov_b32 s2, 1
	s_cmp_lt_i32 s3, 1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v3, 16, v2
	v_ashrrev_i32_e32 v3, v3, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 8, v3
	v_add_nc_u32_e32 v2, v3, v2
	v_add_nc_u32_e32 v3, 0, v1
	s_delay_alu instid0(VALU_DEP_2)
	v_lshl_add_u32 v2, v2, 2, 0
	s_waitcnt vmcnt(1)
	ds_store_b32 v3, v5
	s_waitcnt vmcnt(0)
	ds_store_b32 v2, v6
	s_cbranch_scc1 .LBB2_5
.LBB2_1:                                ; =>This Inner Loop Header: Depth=1
	s_mov_b32 s7, exec_lo
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	v_cmpx_gt_i32_e64 s3, v0
	s_cbranch_execz .LBB2_3
; %bb.2:                                ;   in Loop: Header=BB2_1 Depth=1
	v_mul_lo_u32 v5, s2, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_add_nc_u32_e32 v6, s2, v5
	v_add_nc_u32_e32 v7, -1, v5
	v_add_nc_u32_e32 v5, 15, v5
	v_add_nc_u32_e32 v8, -1, v6
	v_add_nc_u32_e32 v6, 15, v6
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v5, v5, v7
	v_ashrrev_i32_e32 v6, v6, v8
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v5, 8, v5
	v_ashrrev_i32_e32 v6, 8, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v5, v5, v7
	v_add_nc_u32_e32 v6, v6, v8
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshl_add_u32 v5, v5, 2, 0
	v_lshl_add_u32 v6, v6, 2, 0
	ds_load_b32 v5, v5
	ds_load_b32 v7, v6
	s_waitcnt lgkmcnt(0)
	v_add_f32_e32 v5, v5, v7
	ds_store_b32 v6, v5
.LBB2_3:                                ;   in Loop: Header=BB2_1 Depth=1
	s_or_b32 exec_lo, exec_lo, s7
	s_lshl_b32 s2, s2, 1
	s_lshr_b32 s7, s3, 1
	s_cmp_lt_u32 s3, 2
	s_cbranch_scc1 .LBB2_5
; %bb.4:                                ;   in Loop: Header=BB2_1 Depth=1
	s_mov_b32 s3, s7
	s_branch .LBB2_1
.LBB2_5:                                ; %Flow87
	s_mov_b32 s3, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB2_7
; %bb.6:
	s_add_i32 s7, s6, -1
	s_add_i32 s8, s6, 15
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_ashr_i32 s8, s7, s8
	s_ashr_i32 s8, s8, 8
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s8, s8, s7
	s_lshl_b32 s7, s8, 2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s7, s7, 0
	v_dual_mov_b32 v5, 0 :: v_dual_mov_b32 v6, s7
	ds_store_b32 v6, v5
.LBB2_7:
	s_or_b32 exec_lo, exec_lo, s3
	s_cmp_lt_i32 s6, 2
	s_cbranch_scc1 .LBB2_12
; %bb.8:                                ; %.lr.ph76
	s_mov_b32 s3, 1
.LBB2_9:                                ; =>This Inner Loop Header: Depth=1
	s_lshr_b32 s2, s2, 1
	s_mov_b32 s7, exec_lo
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	v_cmpx_gt_u32_e64 s3, v0
	s_cbranch_execz .LBB2_11
; %bb.10:                               ;   in Loop: Header=BB2_9 Depth=1
	v_mul_lo_u32 v5, s2, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_add_nc_u32_e32 v6, s2, v5
	v_add_nc_u32_e32 v7, -1, v5
	v_add_nc_u32_e32 v5, 15, v5
	v_add_nc_u32_e32 v8, -1, v6
	v_add_nc_u32_e32 v6, 15, v6
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v5, v5, v7
	v_ashrrev_i32_e32 v6, v6, v8
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v5, 8, v5
	v_ashrrev_i32_e32 v6, 8, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v5, v5, v7
	v_add_nc_u32_e32 v6, v6, v8
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshl_add_u32 v5, v5, 2, 0
	v_lshl_add_u32 v6, v6, 2, 0
	ds_load_b32 v7, v5
	ds_load_b32 v8, v6
	s_waitcnt lgkmcnt(0)
	v_add_f32_e32 v7, v7, v8
	ds_store_b32 v5, v8
	ds_store_b32 v6, v7
.LBB2_11:                               ;   in Loop: Header=BB2_9 Depth=1
	s_or_b32 exec_lo, exec_lo, s7
	s_lshl_b32 s3, s3, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_ge_i32 s3, s6
	s_cbranch_scc0 .LBB2_9
.LBB2_12:                               ; %._crit_edge77
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	ds_load_b32 v0, v3
	ds_load_b32 v4, v2
	v_add_co_u32 v2, s2, s0, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_ci_u32_e64 v3, null, s1, 0, s2
	v_add_co_u32 v2, vcc_lo, v2, s4
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v3, vcc_lo
	s_waitcnt lgkmcnt(1)
	global_store_b32 v1, v0, s[0:1]
	s_waitcnt lgkmcnt(0)
	global_store_b32 v[2:3], v4, off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z7prescanPfS_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 9
		.amdhsa_next_free_sgpr 10
		.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	_Z7prescanPfS_i, .Lfunc_end2-_Z7prescanPfS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 752
; NumSgprs: 12
; NumVgprs: 9
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 1
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 12
; NumVGPRsForWavesPerEU: 9
; 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:           _Z11prescanEasyPfS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     8
    .sgpr_spill_count: 0
    .symbol:         _Z11prescanEasyPfS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     5
    .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
    .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:           _Z11prescanBankPfS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     8
    .sgpr_spill_count: 0
    .symbol:         _Z11prescanBankPfS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     8
    .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
    .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:           _Z7prescanPfS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     12
    .sgpr_spill_count: 0
    .symbol:         _Z7prescanPfS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     9
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
