// Last update: 2018/12/01
#include <stdio.h>

#define CHECK(call)                                                            \
{                                                                               \
    const cudaError_t error = call;                                            \
    if (error != cudaSuccess)                                                  \
    {                                                                          \
        fprintf(stderr, "Error: %s:%d, ", __FILE__, __LINE__);                 \
        fprintf(stderr, "code: %d, reason: %s\n", error,                       \
                cudaGetErrorString(error));                                    \
        exit(1);                                                               \
    }                                                                          \
}

struct GpuTimer
{
    cudaEvent_t start;
    cudaEvent_t stop;

    GpuTimer()
    {
        cudaEventCreate(&start);
        cudaEventCreate(&stop);
    }

    ~GpuTimer()
    {
        cudaEventDestroy(start);
        cudaEventDestroy(stop);
    }

    void Start()
    {
        cudaEventRecord(start, 0);
    }

    void Stop()
    {
        cudaEventRecord(stop, 0);
    }

    float Elapsed()
    {
        float elapsed;
        cudaEventSynchronize(stop);
        cudaEventElapsedTime(&elapsed, start, stop);
        return elapsed;
    }
};

void scanByHost(int * in, int * out, int n)
{   
    GpuTimer timer; 
    timer.Start();

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

    timer.Stop();
    printf("Time of scanByHost: %.3f ms\n\n", timer.Elapsed());
}

/*
Scan within each block's data (work-inefficient), write results to "out", and 
write each block's sum to "blkSums" if "blkSums" is not NULL.
*/
__global__ void scanBlks1(int * in, int * out, int n, int * blkSums)
{   
    // TODO
    extern __shared__ int s_data[];
    int i = blockIdx.x * blockDim.x + threadIdx.x;
    if (i < n)
        s_data[threadIdx.x] = in[i];
    else
        s_data[threadIdx.x] = 0;
    __syncthreads();
    for (int stride = 1; stride < blockDim.x; stride *= 2)
    {
        if (threadIdx.x >= stride){
            int neededVal = s_data[threadIdx.x - stride];
            __syncthreads();
            s_data[threadIdx.x] += neededVal;
        }        
        __syncthreads();
    } 
    if (i < n)
        out[i] = s_data[threadIdx.x];
    if (blkSums != NULL)
        blkSums[blockIdx.x] = s_data[blockDim.x - 1];
}

/*
Scan within each block's data (work-efficient), write results to "out", and 
write each block's sum to "blkSums" if "blkSums" is not NULL.
*/
__global__ void scanBlks2(int * in, int * out, int n, int * blkSums)
{
    // TODO
	// 1. Each block loads data from GMEM to SMEM
    extern __shared__ int s_data[];
    int i1 = blockIdx.x * 2 * blockDim.x + threadIdx.x;
    int i2 = i1 + blockDim.x;
    if (i1 < n)
        s_data[threadIdx.x] = in[i1];
    if (i2 < n)
        s_data[threadIdx.x + blockDim.x] = in[i2];
    __syncthreads();

    // 2. Each block does scan with data on SMEM
    // 2.1. Reduction phase
    for (int stride = 1; stride < 2 * blockDim.x; stride *= 2)
    {
        int s_dataIdx = (threadIdx.x + 1) * 2 * stride - 1; // To avoid warp divergence
        if (s_dataIdx < 2 * blockDim.x)
            s_data[s_dataIdx] += s_data[s_dataIdx - stride];
        __syncthreads();
    }
    // 2.2. Post-reduction phase
    for (int stride = blockDim.x / 2; stride > 0; stride /= 2)
    {
        int s_dataIdx = (threadIdx.x + 1) * 2 * stride - 1 + stride; // Wow
        if (s_dataIdx < 2 * blockDim.x)
            s_data[s_dataIdx] += s_data[s_dataIdx - stride];
        __syncthreads();
    }

    // 3. Each block writes results from SMEM to GMEM
    if (i1 < n)
        out[i1] = s_data[threadIdx.x];
    if (i2 < n)
        out[i2] = s_data[threadIdx.x + blockDim.x];

    if (blkSums != NULL && threadIdx.x == 0)
        blkSums[blockIdx.x] = s_data[2 * blockDim.x - 1];
}

__global__ void addPrevSum(int * blkSumsScan, int * blkScans, int n)
{
	int i = blockIdx.x * blockDim.x + threadIdx.x + blockDim.x;
	if (i < n)
	{
		blkScans[i] += blkSumsScan[blockIdx.x];
	}
}

void scanByDevice(int * in, int * out, int n, int kernelType, int blkSize)
{
    GpuTimer timer; 
    timer.Start();

    // Allocate device memories
    int *d_in, *d_out;
    size_t bytes = n * sizeof(int);
    CHECK(cudaMalloc(&d_in, bytes));
    CHECK(cudaMalloc(&d_out, bytes));
    int blkDataSize;
    if (kernelType == 1)
        blkDataSize = blkSize;
    else
        blkDataSize = 2 * blkSize;
    int * d_blkSums;
    int numBlks = (n - 1) / blkDataSize + 1;
    CHECK(cudaMalloc(&d_blkSums, numBlks * sizeof(int)));
    
    // Copy data to device memories
    CHECK(cudaMemcpy(d_in, in, bytes, cudaMemcpyHostToDevice));

    // Call kernel to scan within each block's input data
    if (kernelType == 1)
        scanBlks1<<<numBlks, blkSize, blkDataSize * sizeof(int)>>>(d_in, d_out, n, d_blkSums);
    else // KernelType == 2
        scanBlks2<<<numBlks, blkSize, blkDataSize * sizeof(int)>>>(d_in, d_out, n, d_blkSums);
    cudaDeviceSynchronize();
    CHECK(cudaGetLastError());
    
    // Scan "d_blkSums" (by host)
    int * blkSums;
    blkSums = (int *)malloc(numBlks * sizeof(int));
    CHECK(cudaMemcpy(blkSums, d_blkSums, numBlks * sizeof(int), cudaMemcpyDeviceToHost));
    for (int i = 1; i < numBlks; i++)
        blkSums[i] += blkSums[i-1];
    CHECK(cudaMemcpy(d_blkSums, blkSums, numBlks * sizeof(int), cudaMemcpyHostToDevice));
    free(blkSums);
    
    // Call kernel to add block's previous sum to block's scan result
    addPrevSum<<<numBlks - 1, blkDataSize>>>(d_blkSums, d_out, n);
    cudaDeviceSynchronize();
    CHECK(cudaGetLastError());

    // Copy result from device memories
    CHECK(cudaMemcpy(out, d_out, bytes, cudaMemcpyDeviceToHost));
        
    // Free device memories
    CHECK(cudaFree(d_in));
    CHECK(cudaFree(d_out));
    CHECK(cudaFree(d_blkSums));

    timer.Stop();
    printf("Time of scanByDevice (kernelType=%d): %.3f ms\n\n", kernelType, timer.Elapsed());
}

void printDeviceInfo()
{
    cudaDeviceProp devProv;
    CHECK(cudaGetDeviceProperties(&devProv, 0));
    printf("**********GPU info**********\n");
    printf("Name: %s\n", devProv.name);
    printf("Compute capability: %d.%d\n", devProv.major, devProv.minor);
    printf("Num SMs: %d\n", devProv.multiProcessorCount);
    printf("Max num threads per SM: %d\n", devProv.maxThreadsPerMultiProcessor); 
    printf("Max num warps per SM: %d\n", devProv.maxThreadsPerMultiProcessor / devProv.warpSize);
    printf("GMEM: %zu byte\n", devProv.totalGlobalMem);
    printf("SMEM per SM: %zu byte\n", devProv.sharedMemPerMultiprocessor);
    printf("SMEM per block: %zu byte\n", devProv.sharedMemPerBlock);
    printf("****************************\n\n");
}

bool checkCorrectness(int * out, int * correctOut, int n)
{
    for (int i = 0; i < n; i++)
        if (out[i] != correctOut[i])
            return false;
    return true;
}

int main(int argc, char ** argv)
{
    // PRINT OUT DEVICE INFO
    printDeviceInfo();

    // SET UP INPUT SIZE
    int n = (1 << 24) + 1;
    printf("Input size: %d\n\n", n);

    // ALLOCATE MEMORIES
    size_t bytes = n * sizeof(int);
    int * in = (int *)malloc(bytes);
    int * out = (int *)malloc(bytes); // Device result
    int * correctOut = (int *)malloc(bytes); // Host result

    // SET UP INPUT DATA
    for (int i = 0; i < n; i++)
        in[i] = (int)(rand() & 0xFF) - 127; // random int in [-127, 128]

    // DETERMINE BLOCK SIZE
    int blockSize1 = 512; // Default for "scanBlks1"
    int blockSize2 = 512; // Default for "scanBlks2"
    if (argc == 2)
    {
        blockSize1 = blockSize2 = atoi(argv[1]);
    }
    else if (argc == 3)
    {
        blockSize1 = atoi(argv[1]);
        blockSize2 = atoi(argv[2]);
    }

    // SCAN BY HOST
    scanByHost(in, correctOut, n);
    
    // SCAN BY DEVICE, KERNEL 1
    int kernelType = 1;
    scanByDevice(in, out, n, kernelType, blockSize1);
    if (checkCorrectness(out, correctOut, n) == false)
        printf("scanByDevice (kernelType=%d) is INCORRECT!\n\n", kernelType);

    // SCAN BY DEVICE, KERNEL 2
    memset(out, 0, bytes); // Reset output
    kernelType = 2;
    scanByDevice(in, out, n, kernelType, blockSize2);
    if (checkCorrectness(out, correctOut, n) == false)
        printf("scanByDevice (kernelType=%d) is INCORRECT!\n\n", kernelType);

    // FREE MEMORIES
    free(in);
    free(out);
    free(correctOut);
    
    return EXIT_SUCCESS;
}
	.file	"tmpxft_00270714_00000000-6_bt5.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2043:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2043:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.text._ZN8GpuTimerD2Ev,"axG",@progbits,_ZN8GpuTimerD5Ev,comdat
	.align 2
	.weak	_ZN8GpuTimerD2Ev
	.type	_ZN8GpuTimerD2Ev, @function
_ZN8GpuTimerD2Ev:
.LFB2031:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA2031
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	movq	(%rdi), %rdi
	call	cudaEventDestroy@PLT
	movq	8(%rbx), %rdi
	call	cudaEventDestroy@PLT
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2031:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table._ZN8GpuTimerD2Ev,"aG",@progbits,_ZN8GpuTimerD5Ev,comdat
.LLSDA2031:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE2031-.LLSDACSB2031
.LLSDACSB2031:
.LLSDACSE2031:
	.section	.text._ZN8GpuTimerD2Ev,"axG",@progbits,_ZN8GpuTimerD5Ev,comdat
	.size	_ZN8GpuTimerD2Ev, .-_ZN8GpuTimerD2Ev
	.weak	_ZN8GpuTimerD1Ev
	.set	_ZN8GpuTimerD1Ev,_ZN8GpuTimerD2Ev
	.section	.text._ZN8GpuTimer7ElapsedEv,"axG",@progbits,_ZN8GpuTimer7ElapsedEv,comdat
	.align 2
	.weak	_ZN8GpuTimer7ElapsedEv
	.type	_ZN8GpuTimer7ElapsedEv, @function
_ZN8GpuTimer7ElapsedEv:
.LFB2035:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movq	8(%rdi), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	call	cudaEventSynchronize@PLT
	movq	8(%rbx), %rdx
	movq	(%rbx), %rsi
	leaq	4(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movss	4(%rsp), %xmm0
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	addq	$16, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2035:
	.size	_ZN8GpuTimer7ElapsedEv, .-_ZN8GpuTimer7ElapsedEv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Time of scanByHost: %.3f ms\n\n"
	.text
	.globl	_Z10scanByHostPiS_i
	.type	_Z10scanByHostPiS_i, @function
_Z10scanByHostPiS_i:
.LFB2036:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA2036
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	%edx, %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
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rsi, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rbp
	movq	%rbp, %rdi
.LEHB0:
	call	cudaEventCreate@PLT
	leaq	16(%rsp), %rdi
	call	cudaEventCreate@PLT
.LEHE0:
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
.LEHB1:
	call	cudaEventRecord@PLT
	movl	(%r12), %eax
	movl	%eax, (%rbx)
	xorl	%eax, %eax
.L9:
	incq	%rax
	cmpl	%eax, %r13d
	jle	.L17
	movl	(%r12,%rax,4), %edx
	addl	-4(%rbx,%rax,4), %edx
	movl	%edx, (%rbx,%rax,4)
	jmp	.L9
.L17:
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	%rbp, %rdi
	call	_ZN8GpuTimer7ElapsedEv
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
.LEHE1:
	movq	%rbp, %rdi
	call	_ZN8GpuTimerD1Ev
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L13
	jmp	.L15
.L14:
	endbr64
	movq	%rax, %rbx
.L11:
	movq	%rbp, %rdi
	call	_ZN8GpuTimerD1Ev
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	movq	%rbx, %rdi
.LEHB2:
	call	_Unwind_Resume@PLT
.LEHE2:
.L15:
	call	__stack_chk_fail@PLT
.L13:
	addq	$40, %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
.LFE2036:
	.section	.gcc_except_table,"a",@progbits
.LLSDA2036:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE2036-.LLSDACSB2036
.LLSDACSB2036:
	.uleb128 .LEHB0-.LFB2036
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB2036
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L14-.LFB2036
	.uleb128 0
	.uleb128 .LEHB2-.LFB2036
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE2036:
	.text
	.size	_Z10scanByHostPiS_i, .-_Z10scanByHostPiS_i
	.section	.rodata.str1.1
.LC1:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/hmhuan/PG_GPU/master/assignment/bt5.cu"
.LC2:
	.string	"Error: %s:%d, "
.LC3:
	.string	"code: %d, reason: %s\n"
.LC4:
	.string	"**********GPU info**********\n"
.LC5:
	.string	"Name: %s\n"
.LC6:
	.string	"Compute capability: %d.%d\n"
.LC7:
	.string	"Num SMs: %d\n"
.LC8:
	.string	"Max num threads per SM: %d\n"
.LC9:
	.string	"Max num warps per SM: %d\n"
.LC10:
	.string	"GMEM: %zu byte\n"
.LC11:
	.string	"SMEM per SM: %zu byte\n"
.LC12:
	.string	"SMEM per block: %zu byte\n"
.LC13:
	.string	"****************************\n\n"
	.text
	.globl	_Z15printDeviceInfov
	.type	_Z15printDeviceInfov, @function
_Z15printDeviceInfov:
.LFB2038:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	xorl	%esi, %esi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$1048, %rsp
	.cfi_def_cfa_offset 1072
	movq	%fs:40, %rax
	movq	%rax, 1032(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rdi
	call	cudaGetDeviceProperties_v2@PLT
	testl	%eax, %eax
	je	.L19
	movq	stderr(%rip), %rdi
	movl	%eax, %ebx
	xorl	%eax, %eax
	movl	$209, %r8d
	leaq	.LC1(%rip), %rcx
	leaq	.LC2(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	%ebx, %edi
	call	cudaGetErrorString@PLT
	movq	stderr(%rip), %rdi
	movl	%ebx, %ecx
	leaq	.LC3(%rip), %rdx
	movq	%rax, %r8
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L19:
	leaq	.LC4(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbp, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC5(%rip), %rsi
	call	__printf_chk@PLT
	movl	364(%rsp), %ecx
	movl	$2, %edi
	xorl	%eax, %eax
	movl	360(%rsp), %edx
	leaq	.LC6(%rip), %rsi
	call	__printf_chk@PLT
	movl	388(%rsp), %edx
	leaq	.LC7(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	624(%rsp), %edx
	leaq	.LC8(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	624(%rsp), %eax
	movl	$2, %edi
	leaq	.LC9(%rip), %rsi
	cltd
	idivl	308(%rsp)
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	288(%rsp), %rdx
	leaq	.LC10(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	640(%rsp), %rdx
	leaq	.LC11(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	296(%rsp), %rdx
	leaq	.LC12(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	xorl	%eax, %eax
	movl	$2, %edi
	leaq	.LC13(%rip), %rsi
	call	__printf_chk@PLT
	movq	1032(%rsp), %rax
	subq	%fs:40, %rax
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	addq	$1048, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2038:
	.size	_Z15printDeviceInfov, .-_Z15printDeviceInfov
	.globl	_Z16checkCorrectnessPiS_i
	.type	_Z16checkCorrectnessPiS_i, @function
_Z16checkCorrectnessPiS_i:
.LFB2039:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
.L23:
	cmpl	%eax, %edx
	jle	.L27
	movl	(%rdi,%rax,4), %ecx
	incq	%rax
	cmpl	-4(%rsi,%rax,4), %ecx
	je	.L23
	xorl	%eax, %eax
	ret
.L27:
	movb	$1, %al
	ret
	.cfi_endproc
.LFE2039:
	.size	_Z16checkCorrectnessPiS_i, .-_Z16checkCorrectnessPiS_i
	.globl	_Z33__device_stub__Z9scanBlks1PiS_iS_PiS_iS_
	.type	_Z33__device_stub__Z9scanBlks1PiS_iS_PiS_iS_, @function
_Z33__device_stub__Z9scanBlks1PiS_iS_PiS_iS_:
.LFB2065:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	40(%rsp), %rdx
	movq	%rcx, (%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L28
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z9scanBlks1PiS_iS_(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L28:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2065:
	.size	_Z33__device_stub__Z9scanBlks1PiS_iS_PiS_iS_, .-_Z33__device_stub__Z9scanBlks1PiS_iS_PiS_iS_
	.globl	_Z9scanBlks1PiS_iS_
	.type	_Z9scanBlks1PiS_iS_, @function
_Z9scanBlks1PiS_iS_:
.LFB2066:
	.cfi_startproc
	endbr64
	jmp	_Z33__device_stub__Z9scanBlks1PiS_iS_PiS_iS_
	.cfi_endproc
.LFE2066:
	.size	_Z9scanBlks1PiS_iS_, .-_Z9scanBlks1PiS_iS_
	.globl	_Z33__device_stub__Z9scanBlks2PiS_iS_PiS_iS_
	.type	_Z33__device_stub__Z9scanBlks2PiS_iS_PiS_iS_, @function
_Z33__device_stub__Z9scanBlks2PiS_iS_PiS_iS_:
.LFB2067:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	40(%rsp), %rdx
	movq	%rcx, (%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L33
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z9scanBlks2PiS_iS_(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L33:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L35
	call	__stack_chk_fail@PLT
.L35:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2067:
	.size	_Z33__device_stub__Z9scanBlks2PiS_iS_PiS_iS_, .-_Z33__device_stub__Z9scanBlks2PiS_iS_PiS_iS_
	.globl	_Z9scanBlks2PiS_iS_
	.type	_Z9scanBlks2PiS_iS_, @function
_Z9scanBlks2PiS_iS_:
.LFB2068:
	.cfi_startproc
	endbr64
	jmp	_Z33__device_stub__Z9scanBlks2PiS_iS_PiS_iS_
	.cfi_endproc
.LFE2068:
	.size	_Z9scanBlks2PiS_iS_, .-_Z9scanBlks2PiS_iS_
	.globl	_Z33__device_stub__Z10addPrevSumPiS_iPiS_i
	.type	_Z33__device_stub__Z10addPrevSumPiS_iPiS_i, @function
_Z33__device_stub__Z10addPrevSumPiS_iPiS_i:
.LFB2069:
	.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	.L38
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z10addPrevSumPiS_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
.L38:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L40
	call	__stack_chk_fail@PLT
.L40:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2069:
	.size	_Z33__device_stub__Z10addPrevSumPiS_iPiS_i, .-_Z33__device_stub__Z10addPrevSumPiS_iPiS_i
	.globl	_Z10addPrevSumPiS_i
	.type	_Z10addPrevSumPiS_i, @function
_Z10addPrevSumPiS_i:
.LFB2070:
	.cfi_startproc
	endbr64
	jmp	_Z33__device_stub__Z10addPrevSumPiS_iPiS_i
	.cfi_endproc
.LFE2070:
	.size	_Z10addPrevSumPiS_i, .-_Z10addPrevSumPiS_i
	.section	.rodata.str1.1
.LC14:
	.string	"Time of scanByDevice (kernelType=%d): %.3f ms\n\n"
	.text
	.globl	_Z12scanByDevicePiS_iii
	.type	_Z12scanByDevicePiS_iii, @function
_Z12scanByDevicePiS_iii:
.LFB2037:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA2037
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%edx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%r8d, %ebx
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movq	%rsi, 40(%rsp)
	movq	%rdi, 32(%rsp)
	movl	%ecx, 20(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	104(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 24(%rsp)
.LEHB3:
	call	cudaEventCreate@PLT
	leaq	112(%rsp), %rdi
	call	cudaEventCreate@PLT
.LEHE3:
	movq	104(%rsp), %rdi
	xorl	%esi, %esi
.LEHB4:
	call	cudaEventRecord@PLT
	movslq	%ebp, %rax
	leaq	56(%rsp), %rdi
	salq	$2, %rax
	movq	%rax, %rsi
	movq	%rax, 8(%rsp)
	call	cudaMalloc@PLT
	movl	%eax, %r12d
	testl	%eax, %eax
	je	.L44
	movl	$158, %r8d
.L102:
	movq	stderr(%rip), %rdi
	leaq	.LC1(%rip), %rcx
	leaq	.LC2(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	%r12d, %edi
	call	cudaGetErrorString@PLT
	movq	%rax, %r8
	movl	%r12d, %ecx
.L75:
	movq	stderr(%rip), %rdi
	leaq	.LC3(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L44:
	movq	8(%rsp), %rsi
	leaq	64(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	%eax, %r12d
	movl	$159, %r8d
	testl	%eax, %eax
	jne	.L102
	cmpl	$1, 20(%rsp)
	movl	%ebx, %r13d
	je	.L47
	leal	(%rbx,%rbx), %r13d
.L47:
	leal	-1(%rbp), %eax
	leaq	72(%rsp), %rdi
	cltd
	idivl	%r13d
	leal	1(%rax), %r14d
	movl	%eax, %r12d
	movslq	%r14d, %rax
	salq	$2, %rax
	movq	%rax, %rsi
	movq	%rax, (%rsp)
	call	cudaMalloc@PLT
	movl	%eax, %r15d
	movl	$167, %r8d
	testl	%eax, %eax
	jne	.L112
	movq	8(%rsp), %rdx
	movq	32(%rsp), %rsi
	movl	$1, %ecx
	movq	56(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %r15d
	testl	%eax, %eax
	je	.L49
	movl	$170, %r8d
.L112:
	movq	stderr(%rip), %rdi
	leaq	.LC1(%rip), %rcx
	leaq	.LC2(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	jmp	.L104
.L49:
	movslq	%r13d, %r8
	movl	%ebx, 92(%rsp)
	movabsq	$4294967297, %rax
	movl	$0, %r9d
	salq	$2, %r8
	cmpl	$1, 20(%rsp)
	movq	%rax, 96(%rsp)
	movl	100(%rsp), %ecx
	movq	92(%rsp), %rdx
	movq	%rax, 84(%rsp)
	movl	%r14d, 80(%rsp)
	movl	88(%rsp), %esi
	movq	80(%rsp), %rdi
	jne	.L50
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L52
	movq	72(%rsp), %rcx
	movq	64(%rsp), %rsi
	movl	%ebp, %edx
	movq	56(%rsp), %rdi
	call	_Z33__device_stub__Z9scanBlks1PiS_iS_PiS_iS_
	jmp	.L52
.L50:
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L52
	movq	72(%rsp), %rcx
	movq	64(%rsp), %rsi
	movl	%ebp, %edx
	movq	56(%rsp), %rdi
	call	_Z33__device_stub__Z9scanBlks2PiS_iS_PiS_iS_
.L52:
	call	cudaDeviceSynchronize@PLT
	call	cudaGetLastError@PLT
	movl	%eax, %ebx
	movl	$178, %r8d
	testl	%eax, %eax
	jne	.L107
	movq	(%rsp), %rdi
	call	malloc@PLT
	movq	(%rsp), %rdx
	movq	72(%rsp), %rsi
	movl	$2, %ecx
	movq	%rax, %rdi
	movq	%rax, %rbx
	call	cudaMemcpy@PLT
	movl	%eax, %r15d
	xorl	%eax, %eax
	testl	%r15d, %r15d
	je	.L55
	movq	stderr(%rip), %rdi
	movl	$183, %r8d
	leaq	.LC1(%rip), %rcx
	leaq	.LC2(%rip), %rdx
	movl	$2, %esi
.L104:
	call	__fprintf_chk@PLT
	movl	%r15d, %edi
	call	cudaGetErrorString@PLT
	movq	%rax, %r8
	movl	%r15d, %ecx
	jmp	.L75
.L55:
	incq	%rax
	cmpl	%eax, %r14d
	jle	.L113
	movl	-4(%rbx,%rax,4), %edx
	addl	%edx, (%rbx,%rax,4)
	jmp	.L55
.L113:
	movq	(%rsp), %rdx
	movq	72(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %r14d
	testl	%eax, %eax
	je	.L57
	movq	stderr(%rip), %rdi
	movl	$186, %r8d
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rcx
	leaq	.LC2(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	%r14d, %edi
	call	cudaGetErrorString@PLT
	movq	%rax, %r8
	movl	%r14d, %ecx
	jmp	.L75
.L57:
	movq	%rbx, %rdi
	call	free@PLT
	movl	%r13d, 92(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movabsq	$4294967297, %rax
	movl	%r12d, 80(%rsp)
	movq	%rax, 96(%rsp)
	movl	100(%rsp), %ecx
	movq	%rax, 84(%rsp)
	movq	92(%rsp), %rdx
	movq	80(%rsp), %rdi
	movl	88(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L58
	movq	64(%rsp), %rsi
	movq	72(%rsp), %rdi
	movl	%ebp, %edx
	call	_Z33__device_stub__Z10addPrevSumPiS_iPiS_i
.L58:
	call	cudaDeviceSynchronize@PLT
	call	cudaGetLastError@PLT
	movl	%eax, %ebx
	movl	$192, %r8d
	testl	%eax, %eax
	jne	.L107
	movq	8(%rsp), %rdx
	movq	64(%rsp), %rsi
	movl	$2, %ecx
	movq	40(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %ebx
	movl	$195, %r8d
	testl	%eax, %eax
	jne	.L107
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %ebx
	movl	$198, %r8d
	testl	%eax, %eax
	jne	.L107
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %ebx
	movl	$199, %r8d
	testl	%eax, %eax
	jne	.L107
	movq	72(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L63
	movl	$200, %r8d
.L107:
	movq	stderr(%rip), %rdi
	leaq	.LC1(%rip), %rcx
	leaq	.LC2(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	%ebx, %edi
	call	cudaGetErrorString@PLT
	movq	%rax, %r8
	movl	%ebx, %ecx
	jmp	.L75
.L63:
	movq	112(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	leaq	104(%rsp), %rbx
	movq	%rbx, %rdi
	call	_ZN8GpuTimer7ElapsedEv
	movl	20(%rsp), %edx
	leaq	.LC14(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	%xmm0, %xmm0
	call	__printf_chk@PLT
.LEHE4:
	movq	%rbx, %rdi
	call	_ZN8GpuTimerD1Ev
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L66
	jmp	.L72
.L69:
	endbr64
	movq	%rax, %rbx
.L64:
	movq	24(%rsp), %rdi
	call	_ZN8GpuTimerD1Ev
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L72
	movq	%rbx, %rdi
.LEHB5:
	call	_Unwind_Resume@PLT
.LEHE5:
.L72:
	call	__stack_chk_fail@PLT
.L66:
	addq	$136, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2037:
	.section	.gcc_except_table
.LLSDA2037:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE2037-.LLSDACSB2037
.LLSDACSB2037:
	.uleb128 .LEHB3-.LFB2037
	.uleb128 .LEHE3-.LEHB3
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB4-.LFB2037
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L69-.LFB2037
	.uleb128 0
	.uleb128 .LEHB5-.LFB2037
	.uleb128 .LEHE5-.LEHB5
	.uleb128 0
	.uleb128 0
.LLSDACSE2037:
	.text
	.size	_Z12scanByDevicePiS_iii, .-_Z12scanByDevicePiS_iii
	.section	.rodata.str1.1
.LC15:
	.string	"Input size: %d\n\n"
.LC16:
	.string	"scanByDevice (kernelType=%d) is INCORRECT!\n\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2040:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%r15d, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%edi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	pushq	%rcx
	.cfi_def_cfa_offset 64
	call	_Z15printDeviceInfov
	movl	$16777217, %edx
	leaq	.LC15(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	$67108868, %edi
	call	malloc@PLT
	movl	$67108868, %edi
	movq	%rax, %r12
	call	malloc@PLT
	movl	$67108868, %edi
	movq	%rax, %rbx
	call	malloc@PLT
	movq	%rax, %r13
.L115:
	call	rand@PLT
	movzbl	%al, %eax
	subl	$127, %eax
	movl	%eax, (%r12,%r15,4)
	incq	%r15
	cmpq	$16777217, %r15
	jne	.L115
	cmpl	$2, %ebp
	jne	.L116
	movq	8(%r14), %rdi
	call	atoi@PLT
	movl	%eax, %ebp
	movl	%eax, %r14d
	jmp	.L117
.L116:
	cmpl	$3, %ebp
	jne	.L120
	movq	8(%r14), %rdi
	call	atoi@PLT
	movq	16(%r14), %rdi
	movl	%eax, %ebp
	call	atoi@PLT
	movl	%eax, %r14d
	jmp	.L117
.L120:
	movl	$512, %r14d
	movl	$512, %ebp
.L117:
	movl	$16777217, %edx
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	_Z10scanByHostPiS_i
	movl	$16777217, %edx
	movq	%rbx, %rsi
	movq	%r12, %rdi
	movl	%ebp, %r8d
	movl	$1, %ecx
	call	_Z12scanByDevicePiS_iii
	movl	$16777217, %edx
	movq	%r13, %rsi
	movq	%rbx, %rdi
	call	_Z16checkCorrectnessPiS_i
	testb	%al, %al
	jne	.L118
	movl	$1, %edx
	leaq	.LC16(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
.L118:
	xorl	%eax, %eax
	movl	$16777217, %ecx
	movq	%rbx, %rdi
	movl	$16777217, %edx
	rep stosl
	movq	%rbx, %rsi
	movq	%r12, %rdi
	movl	%r14d, %r8d
	movl	$2, %ecx
	call	_Z12scanByDevicePiS_iii
	movl	$16777217, %edx
	movq	%r13, %rsi
	movq	%rbx, %rdi
	call	_Z16checkCorrectnessPiS_i
	testb	%al, %al
	jne	.L119
	movl	$2, %edx
	leaq	.LC16(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
.L119:
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movq	%r13, %rdi
	call	free@PLT
	popq	%rdx
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2040:
	.size	main, .-main
	.section	.rodata.str1.1
.LC17:
	.string	"_Z10addPrevSumPiS_i"
.LC18:
	.string	"_Z9scanBlks2PiS_iS_"
.LC19:
	.string	"_Z9scanBlks1PiS_iS_"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2072:
	.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	.LC17(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z10addPrevSumPiS_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	.LC18(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z9scanBlks2PiS_iS_(%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	.LC19(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z9scanBlks1PiS_iS_(%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
.LFE2072:
	.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
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.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:

// Last update: 2018/12/01

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

#define CHECK(call)                                                            \
{                                                                               \
    const hipError_t error = call;                                            \
    if (error != hipSuccess)                                                  \
    {                                                                          \
        fprintf(stderr, "Error: %s:%d, ", __FILE__, __LINE__);                 \
        fprintf(stderr, "code: %d, reason: %s\n", error,                       \
                hipGetErrorString(error));                                    \
        exit(1);                                                               \
    }                                                                          \
}

struct GpuTimer
{
    hipEvent_t start;
    hipEvent_t stop;

    GpuTimer()
    {
        hipEventCreate(&start);
        hipEventCreate(&stop);
    }

    ~GpuTimer()
    {
        hipEventDestroy(start);
        hipEventDestroy(stop);
    }

    void Start()
    {
        hipEventRecord(start, 0);
    }

    void Stop()
    {
        hipEventRecord(stop, 0);
    }

    float Elapsed()
    {
        float elapsed;
        hipEventSynchronize(stop);
        hipEventElapsedTime(&elapsed, start, stop);
        return elapsed;
    }
};

void scanByHost(int * in, int * out, int n)
{   
    GpuTimer timer; 
    timer.Start();

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

    timer.Stop();
    printf("Time of scanByHost: %.3f ms\n\n", timer.Elapsed());
}

/*
Scan within each block's data (work-inefficient), write results to "out", and 
write each block's sum to "blkSums" if "blkSums" is not NULL.
*/
__global__ void scanBlks1(int * in, int * out, int n, int * blkSums)
{   
    // TODO
    extern __shared__ int s_data[];
    int i = blockIdx.x * blockDim.x + threadIdx.x;
    if (i < n)
        s_data[threadIdx.x] = in[i];
    else
        s_data[threadIdx.x] = 0;
    __syncthreads();
    for (int stride = 1; stride < blockDim.x; stride *= 2)
    {
        if (threadIdx.x >= stride){
            int neededVal = s_data[threadIdx.x - stride];
            __syncthreads();
            s_data[threadIdx.x] += neededVal;
        }        
        __syncthreads();
    } 
    if (i < n)
        out[i] = s_data[threadIdx.x];
    if (blkSums != NULL)
        blkSums[blockIdx.x] = s_data[blockDim.x - 1];
}

/*
Scan within each block's data (work-efficient), write results to "out", and 
write each block's sum to "blkSums" if "blkSums" is not NULL.
*/
__global__ void scanBlks2(int * in, int * out, int n, int * blkSums)
{
    // TODO
	// 1. Each block loads data from GMEM to SMEM
    extern __shared__ int s_data[];
    int i1 = blockIdx.x * 2 * blockDim.x + threadIdx.x;
    int i2 = i1 + blockDim.x;
    if (i1 < n)
        s_data[threadIdx.x] = in[i1];
    if (i2 < n)
        s_data[threadIdx.x + blockDim.x] = in[i2];
    __syncthreads();

    // 2. Each block does scan with data on SMEM
    // 2.1. Reduction phase
    for (int stride = 1; stride < 2 * blockDim.x; stride *= 2)
    {
        int s_dataIdx = (threadIdx.x + 1) * 2 * stride - 1; // To avoid warp divergence
        if (s_dataIdx < 2 * blockDim.x)
            s_data[s_dataIdx] += s_data[s_dataIdx - stride];
        __syncthreads();
    }
    // 2.2. Post-reduction phase
    for (int stride = blockDim.x / 2; stride > 0; stride /= 2)
    {
        int s_dataIdx = (threadIdx.x + 1) * 2 * stride - 1 + stride; // Wow
        if (s_dataIdx < 2 * blockDim.x)
            s_data[s_dataIdx] += s_data[s_dataIdx - stride];
        __syncthreads();
    }

    // 3. Each block writes results from SMEM to GMEM
    if (i1 < n)
        out[i1] = s_data[threadIdx.x];
    if (i2 < n)
        out[i2] = s_data[threadIdx.x + blockDim.x];

    if (blkSums != NULL && threadIdx.x == 0)
        blkSums[blockIdx.x] = s_data[2 * blockDim.x - 1];
}

__global__ void addPrevSum(int * blkSumsScan, int * blkScans, int n)
{
	int i = blockIdx.x * blockDim.x + threadIdx.x + blockDim.x;
	if (i < n)
	{
		blkScans[i] += blkSumsScan[blockIdx.x];
	}
}

void scanByDevice(int * in, int * out, int n, int kernelType, int blkSize)
{
    GpuTimer timer; 
    timer.Start();

    // Allocate device memories
    int *d_in, *d_out;
    size_t bytes = n * sizeof(int);
    CHECK(hipMalloc(&d_in, bytes));
    CHECK(hipMalloc(&d_out, bytes));
    int blkDataSize;
    if (kernelType == 1)
        blkDataSize = blkSize;
    else
        blkDataSize = 2 * blkSize;
    int * d_blkSums;
    int numBlks = (n - 1) / blkDataSize + 1;
    CHECK(hipMalloc(&d_blkSums, numBlks * sizeof(int)));
    
    // Copy data to device memories
    CHECK(hipMemcpy(d_in, in, bytes, hipMemcpyHostToDevice));

    // Call kernel to scan within each block's input data
    if (kernelType == 1)
        scanBlks1<<<numBlks, blkSize, blkDataSize * sizeof(int)>>>(d_in, d_out, n, d_blkSums);
    else // KernelType == 2
        scanBlks2<<<numBlks, blkSize, blkDataSize * sizeof(int)>>>(d_in, d_out, n, d_blkSums);
    hipDeviceSynchronize();
    CHECK(hipGetLastError());
    
    // Scan "d_blkSums" (by host)
    int * blkSums;
    blkSums = (int *)malloc(numBlks * sizeof(int));
    CHECK(hipMemcpy(blkSums, d_blkSums, numBlks * sizeof(int), hipMemcpyDeviceToHost));
    for (int i = 1; i < numBlks; i++)
        blkSums[i] += blkSums[i-1];
    CHECK(hipMemcpy(d_blkSums, blkSums, numBlks * sizeof(int), hipMemcpyHostToDevice));
    free(blkSums);
    
    // Call kernel to add block's previous sum to block's scan result
    addPrevSum<<<numBlks - 1, blkDataSize>>>(d_blkSums, d_out, n);
    hipDeviceSynchronize();
    CHECK(hipGetLastError());

    // Copy result from device memories
    CHECK(hipMemcpy(out, d_out, bytes, hipMemcpyDeviceToHost));
        
    // Free device memories
    CHECK(hipFree(d_in));
    CHECK(hipFree(d_out));
    CHECK(hipFree(d_blkSums));

    timer.Stop();
    printf("Time of scanByDevice (kernelType=%d): %.3f ms\n\n", kernelType, timer.Elapsed());
}

void printDeviceInfo()
{
    hipDeviceProp_t devProv;
    CHECK(hipGetDeviceProperties(&devProv, 0));
    printf("**********GPU info**********\n");
    printf("Name: %s\n", devProv.name);
    printf("Compute capability: %d.%d\n", devProv.major, devProv.minor);
    printf("Num SMs: %d\n", devProv.multiProcessorCount);
    printf("Max num threads per SM: %d\n", devProv.maxThreadsPerMultiProcessor); 
    printf("Max num warps per SM: %d\n", devProv.maxThreadsPerMultiProcessor / devProv.warpSize);
    printf("GMEM: %zu byte\n", devProv.totalGlobalMem);
    printf("SMEM per SM: %zu byte\n", devProv.sharedMemPerMultiprocessor);
    printf("SMEM per block: %zu byte\n", devProv.sharedMemPerBlock);
    printf("****************************\n\n");
}

bool checkCorrectness(int * out, int * correctOut, int n)
{
    for (int i = 0; i < n; i++)
        if (out[i] != correctOut[i])
            return false;
    return true;
}

int main(int argc, char ** argv)
{
    // PRINT OUT DEVICE INFO
    printDeviceInfo();

    // SET UP INPUT SIZE
    int n = (1 << 24) + 1;
    printf("Input size: %d\n\n", n);

    // ALLOCATE MEMORIES
    size_t bytes = n * sizeof(int);
    int * in = (int *)malloc(bytes);
    int * out = (int *)malloc(bytes); // Device result
    int * correctOut = (int *)malloc(bytes); // Host result

    // SET UP INPUT DATA
    for (int i = 0; i < n; i++)
        in[i] = (int)(rand() & 0xFF) - 127; // random int in [-127, 128]

    // DETERMINE BLOCK SIZE
    int blockSize1 = 512; // Default for "scanBlks1"
    int blockSize2 = 512; // Default for "scanBlks2"
    if (argc == 2)
    {
        blockSize1 = blockSize2 = atoi(argv[1]);
    }
    else if (argc == 3)
    {
        blockSize1 = atoi(argv[1]);
        blockSize2 = atoi(argv[2]);
    }

    // SCAN BY HOST
    scanByHost(in, correctOut, n);
    
    // SCAN BY DEVICE, KERNEL 1
    int kernelType = 1;
    scanByDevice(in, out, n, kernelType, blockSize1);
    if (checkCorrectness(out, correctOut, n) == false)
        printf("scanByDevice (kernelType=%d) is INCORRECT!\n\n", kernelType);

    // SCAN BY DEVICE, KERNEL 2
    memset(out, 0, bytes); // Reset output
    kernelType = 2;
    scanByDevice(in, out, n, kernelType, blockSize2);
    if (checkCorrectness(out, correctOut, n) == false)
        printf("scanByDevice (kernelType=%d) is INCORRECT!\n\n", kernelType);

    // FREE MEMORIES
    free(in);
    free(out);
    free(correctOut);
    
    return EXIT_SUCCESS;
}
	.text
	.file	"bt5.hip"
	.globl	_Z10scanByHostPiS_i             # -- Begin function _Z10scanByHostPiS_i
	.type	_Z10scanByHostPiS_i,@function
_Z10scanByHostPiS_i:                    # @_Z10scanByHostPiS_i
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edx, %ebp
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	%rsp, %rdi
	callq	hipEventCreate
	leaq	8(%rsp), %r15
	movq	%r15, %rdi
	callq	hipEventCreate
	movq	-8(%r15), %rdi
.Ltmp0:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp1:
# %bb.1:                                # %_ZN8GpuTimer5StartEv.exit
	movl	(%r14), %eax
	movl	%eax, (%rbx)
	cmpl	$2, %ebp
	jl	.LBB0_4
# %bb.2:                                # %.lr.ph.preheader
	movl	%ebp, %eax
	movl	(%rbx), %ecx
	movl	$1, %edx
.LBB0_3:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	addl	(%r14,%rdx,4), %ecx
	movl	%ecx, (%rbx,%rdx,4)
	incq	%rdx
	cmpq	%rdx, %rax
	jne	.LBB0_3
.LBB0_4:                                # %._crit_edge
	movq	8(%rsp), %rdi
.Ltmp2:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp3:
# %bb.5:                                # %_ZN8GpuTimer4StopEv.exit
	movq	8(%rsp), %rdi
.Ltmp4:
	callq	hipEventSynchronize
.Ltmp5:
# %bb.6:                                # %.noexc
	movq	(%rsp), %rsi
	movq	8(%rsp), %rdx
.Ltmp6:
	leaq	20(%rsp), %rdi
	callq	hipEventElapsedTime
.Ltmp7:
# %bb.7:
	cvtss2sd	20(%rsp), %xmm0
	movl	$.L.str, %edi
	movb	$1, %al
	callq	printf
	movq	%rsp, %rdi
	callq	_ZN8GpuTimerD2Ev
	addq	$24, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB0_8:
	.cfi_def_cfa_offset 64
.Ltmp8:
	movq	%rax, %rbx
	movq	%rsp, %rdi
	callq	_ZN8GpuTimerD2Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end0:
	.size	_Z10scanByHostPiS_i, .Lfunc_end0-_Z10scanByHostPiS_i
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table0:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp7-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp7
	.uleb128 .Ltmp8-.Lfunc_begin0           #     jumps to .Ltmp8
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp7-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Lfunc_end0-.Ltmp7             #   Call between .Ltmp7 and .Lfunc_end0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZN8GpuTimerD2Ev,"axG",@progbits,_ZN8GpuTimerD2Ev,comdat
	.weak	_ZN8GpuTimerD2Ev                # -- Begin function _ZN8GpuTimerD2Ev
	.p2align	1, 0x90
	.type	_ZN8GpuTimerD2Ev,@function
_ZN8GpuTimerD2Ev:                       # @_ZN8GpuTimerD2Ev
.Lfunc_begin1:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception1
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	movq	(%rdi), %rdi
.Ltmp9:
	callq	hipEventDestroy
.Ltmp10:
# %bb.1:
	movq	8(%rbx), %rdi
.Ltmp11:
	callq	hipEventDestroy
.Ltmp12:
# %bb.2:
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.LBB1_3:
	.cfi_def_cfa_offset 16
.Ltmp13:
	movq	%rax, %rdi
	callq	__clang_call_terminate
.Lfunc_end1:
	.size	_ZN8GpuTimerD2Ev, .Lfunc_end1-_ZN8GpuTimerD2Ev
	.cfi_endproc
	.section	.gcc_except_table._ZN8GpuTimerD2Ev,"aG",@progbits,_ZN8GpuTimerD2Ev,comdat
	.p2align	2, 0x0
GCC_except_table1:
.Lexception1:
	.byte	255                             # @LPStart Encoding = omit
	.byte	3                               # @TType Encoding = udata4
	.uleb128 .Lttbase0-.Lttbaseref0
.Lttbaseref0:
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end1-.Lcst_begin1
.Lcst_begin1:
	.uleb128 .Ltmp9-.Lfunc_begin1           # >> Call Site 1 <<
	.uleb128 .Ltmp12-.Ltmp9                 #   Call between .Ltmp9 and .Ltmp12
	.uleb128 .Ltmp13-.Lfunc_begin1          #     jumps to .Ltmp13
	.byte	1                               #   On action: 1
.Lcst_end1:
	.byte	1                               # >> Action Record 1 <<
                                        #   Catch TypeInfo 1
	.byte	0                               #   No further actions
	.p2align	2, 0x0
                                        # >> Catch TypeInfos <<
	.long	0                               # TypeInfo 1
.Lttbase0:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	_Z24__device_stub__scanBlks1PiS_iS_ # -- Begin function _Z24__device_stub__scanBlks1PiS_iS_
	.type	_Z24__device_stub__scanBlks1PiS_iS_,@function
_Z24__device_stub__scanBlks1PiS_iS_:    # @_Z24__device_stub__scanBlks1PiS_iS_
	.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), %rdi
	movq	%rsi, (%rdi)
	leaq	4(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	24(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%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	$_Z9scanBlks1PiS_iS_, %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	_Z24__device_stub__scanBlks1PiS_iS_, .Lfunc_end2-_Z24__device_stub__scanBlks1PiS_iS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z24__device_stub__scanBlks2PiS_iS_ # -- Begin function _Z24__device_stub__scanBlks2PiS_iS_
	.type	_Z24__device_stub__scanBlks2PiS_iS_,@function
_Z24__device_stub__scanBlks2PiS_iS_:    # @_Z24__device_stub__scanBlks2PiS_iS_
	.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), %rdi
	movq	%rsi, (%rdi)
	leaq	4(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	24(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%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	$_Z9scanBlks2PiS_iS_, %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	_Z24__device_stub__scanBlks2PiS_iS_, .Lfunc_end3-_Z24__device_stub__scanBlks2PiS_iS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z25__device_stub__addPrevSumPiS_i # -- Begin function _Z25__device_stub__addPrevSumPiS_i
	.type	_Z25__device_stub__addPrevSumPiS_i,@function
_Z25__device_stub__addPrevSumPiS_i:     # @_Z25__device_stub__addPrevSumPiS_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	$_Z10addPrevSumPiS_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	_Z25__device_stub__addPrevSumPiS_i, .Lfunc_end4-_Z25__device_stub__addPrevSumPiS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z12scanByDevicePiS_iii         # -- Begin function _Z12scanByDevicePiS_iii
	.type	_Z12scanByDevicePiS_iii,@function
_Z12scanByDevicePiS_iii:                # @_Z12scanByDevicePiS_iii
.Lfunc_begin2:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception2
# %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	$88, %rsp
	.cfi_def_cfa_offset 144
	.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	%r8d, %r14d
	movl	%ecx, %r12d
	movl	%edx, %r13d
	movq	%rsi, 80(%rsp)                  # 8-byte Spill
	movq	%rdi, %rbx
	leaq	32(%rsp), %rdi
	callq	hipEventCreate
	leaq	40(%rsp), %r15
	movq	%r15, %rdi
	callq	hipEventCreate
	movq	-8(%r15), %rdi
.Ltmp14:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp15:
# %bb.1:                                # %_ZN8GpuTimer5StartEv.exit
	movslq	%r13d, %r15
	shlq	$2, %r15
.Ltmp17:
	leaq	24(%rsp), %rdi
	movq	%r15, %rsi
	callq	hipMalloc
.Ltmp18:
# %bb.2:                                # %_ZL9hipMallocIiE10hipError_tPPT_m.exit
	movl	%eax, %ebp
	testl	%eax, %eax
	jne	.LBB5_3
# %bb.8:
.Ltmp22:
	leaq	8(%rsp), %rdi
	movq	%r15, %rsi
	callq	hipMalloc
.Ltmp23:
# %bb.9:                                # %_ZL9hipMallocIiE10hipError_tPPT_m.exit125
	movl	%eax, %ebp
	testl	%eax, %eax
	jne	.LBB5_10
# %bb.12:
	movq	%r15, 72(%rsp)                  # 8-byte Spill
	movq	%r13, %rax
	leal	(%r14,%r14), %r13d
	movl	%r12d, 20(%rsp)                 # 4-byte Spill
	cmpl	$1, %r12d
	movl	%r13d, %ecx
	cmovel	%r14d, %ecx
	movq	%rax, 56(%rsp)                  # 8-byte Spill
	decl	%eax
	cltd
	movl	%ecx, 48(%rsp)                  # 4-byte Spill
	idivl	%ecx
                                        # kill: def $eax killed $eax def $rax
	movq	%rax, 64(%rsp)                  # 8-byte Spill
	leal	1(%rax), %r15d
	movslq	%r15d, %rbp
	shlq	$2, %rbp
.Ltmp27:
	movq	%rsp, %rdi
	movq	%rbp, %rsi
	callq	hipMalloc
.Ltmp28:
# %bb.13:                               # %_ZL9hipMallocIiE10hipError_tPPT_m.exit126
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	.LBB5_14
# %bb.16:
	movq	24(%rsp), %rdi
.Ltmp32:
	movq	%rbx, %rsi
	movq	72(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp33:
# %bb.17:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB5_18
# %bb.21:
	movl	%r15d, %r12d
	movq	%r12, %rdi
	btsq	$32, %rdi
	movl	%r14d, %edx
	btsq	$32, %rdx
	cmpl	$1, 20(%rsp)                    # 4-byte Folded Reload
	jne	.LBB5_26
# %bb.22:
	movslq	%r14d, %r8
	shlq	$2, %r8
.Ltmp41:
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp42:
	movq	56(%rsp), %r13                  # 8-byte Reload
# %bb.23:
	testl	%eax, %eax
	jne	.LBB5_29
# %bb.24:
	movq	24(%rsp), %rdi
	movq	8(%rsp), %rsi
	movq	(%rsp), %rcx
.Ltmp43:
	movl	%r13d, %edx
	callq	_Z24__device_stub__scanBlks1PiS_iS_
.Ltmp44:
	jmp	.LBB5_29
.LBB5_26:
	movslq	%r13d, %r8
	shlq	$2, %r8
.Ltmp37:
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp38:
	movq	56(%rsp), %r13                  # 8-byte Reload
# %bb.27:
	testl	%eax, %eax
	jne	.LBB5_29
# %bb.28:
	movq	24(%rsp), %rdi
	movq	8(%rsp), %rsi
	movq	(%rsp), %rcx
.Ltmp39:
	movl	%r13d, %edx
	callq	_Z24__device_stub__scanBlks2PiS_iS_
.Ltmp40:
.LBB5_29:
.Ltmp45:
	callq	hipDeviceSynchronize
.Ltmp46:
# %bb.30:
.Ltmp48:
	callq	hipGetLastError
.Ltmp49:
# %bb.31:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB5_32
# %bb.34:
	movq	%rbp, %rdi
	callq	malloc
	movq	%rax, %rbx
	movq	(%rsp), %rsi
.Ltmp53:
	movq	%rax, %rdi
	movq	%rbp, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp54:
# %bb.35:
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	.LBB5_42
# %bb.36:                               # %.preheader
	cmpl	$0, 64(%rsp)                    # 4-byte Folded Reload
	jle	.LBB5_39
# %bb.37:                               # %.lr.ph.preheader
	movl	(%rbx), %eax
	movl	$1, %ecx
.LBB5_38:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	addl	(%rbx,%rcx,4), %eax
	movl	%eax, (%rbx,%rcx,4)
	incq	%rcx
	cmpq	%rcx, %r12
	jne	.LBB5_38
.LBB5_39:                               # %._crit_edge
	movq	(%rsp), %rdi
.Ltmp58:
	movq	%rbx, %rsi
	movq	%rbp, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp59:
# %bb.40:
	movl	%eax, %ebp
	testl	%eax, %eax
	movl	20(%rsp), %r15d                 # 4-byte Reload
	jne	.LBB5_41
# %bb.46:
	movabsq	$4294967296, %r14               # imm = 0x100000000
	movq	%rbx, %rdi
	callq	free
	movl	64(%rsp), %edi                  # 4-byte Reload
	orq	%r14, %rdi
	movl	48(%rsp), %edx                  # 4-byte Reload
	orq	%r14, %rdx
.Ltmp63:
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp64:
# %bb.47:
	testl	%eax, %eax
	jne	.LBB5_49
# %bb.48:
	movq	(%rsp), %rdi
	movq	8(%rsp), %rsi
.Ltmp65:
	movl	%r13d, %edx
	callq	_Z25__device_stub__addPrevSumPiS_i
.Ltmp66:
.LBB5_49:
.Ltmp67:
	callq	hipDeviceSynchronize
.Ltmp68:
# %bb.50:
.Ltmp69:
	callq	hipGetLastError
.Ltmp70:
# %bb.51:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB5_52
# %bb.54:
	movq	8(%rsp), %rsi
.Ltmp74:
	movq	80(%rsp), %rdi                  # 8-byte Reload
	movq	72(%rsp), %rdx                  # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp75:
# %bb.55:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB5_56
# %bb.58:
	movq	24(%rsp), %rdi
.Ltmp79:
	callq	hipFree
.Ltmp80:
# %bb.59:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB5_60
# %bb.62:
	movq	8(%rsp), %rdi
.Ltmp84:
	callq	hipFree
.Ltmp85:
# %bb.63:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB5_64
# %bb.66:
	movq	(%rsp), %rdi
.Ltmp89:
	callq	hipFree
.Ltmp90:
# %bb.67:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB5_68
# %bb.70:
	movq	40(%rsp), %rdi
.Ltmp94:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp95:
# %bb.71:                               # %_ZN8GpuTimer4StopEv.exit
	movq	40(%rsp), %rdi
.Ltmp96:
	callq	hipEventSynchronize
.Ltmp97:
# %bb.72:                               # %.noexc
	movq	32(%rsp), %rsi
	movq	40(%rsp), %rdx
.Ltmp98:
	leaq	52(%rsp), %rdi
	callq	hipEventElapsedTime
.Ltmp99:
# %bb.73:
	cvtss2sd	52(%rsp), %xmm0
	movl	$.L.str.4, %edi
	movl	%r15d, %esi
	movb	$1, %al
	callq	printf
	leaq	32(%rsp), %rdi
	callq	_ZN8GpuTimerD2Ev
	addq	$88, %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
.LBB5_3:
	.cfi_def_cfa_offset 144
	movq	stderr(%rip), %rdi
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movl	$160, %ecx
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %rbx
.Ltmp19:
	movl	%ebp, %edi
	callq	hipGetErrorString
.Ltmp20:
	jmp	.LBB5_4
.LBB5_10:
	movq	stderr(%rip), %rdi
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movl	$161, %ecx
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %rbx
.Ltmp24:
	movl	%ebp, %edi
	callq	hipGetErrorString
.Ltmp25:
	jmp	.LBB5_4
.LBB5_14:
	movq	stderr(%rip), %rdi
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movl	$169, %ecx
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %rbx
.Ltmp29:
	movl	%r12d, %edi
	callq	hipGetErrorString
.Ltmp30:
# %bb.15:
	movl	$.L.str.3, %esi
	movq	%rbx, %rdi
	movl	%r12d, %edx
	jmp	.LBB5_5
.LBB5_18:
	movq	stderr(%rip), %rdi
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movl	$172, %ecx
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp34:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp35:
	jmp	.LBB5_19
.LBB5_32:
	movq	stderr(%rip), %rdi
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movl	$180, %ecx
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp50:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp51:
	jmp	.LBB5_19
.LBB5_42:
	movq	stderr(%rip), %rdi
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movl	$185, %ecx
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %rbx
.Ltmp55:
	movl	%r14d, %edi
	callq	hipGetErrorString
.Ltmp56:
# %bb.43:
	movl	$.L.str.3, %esi
	movq	%rbx, %rdi
	movl	%r14d, %edx
	jmp	.LBB5_5
.LBB5_41:
	movq	stderr(%rip), %rdi
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movl	$188, %ecx
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %rbx
.Ltmp60:
	movl	%ebp, %edi
	callq	hipGetErrorString
.Ltmp61:
.LBB5_4:
	movl	$.L.str.3, %esi
	movq	%rbx, %rdi
	movl	%ebp, %edx
	jmp	.LBB5_5
.LBB5_52:
	movq	stderr(%rip), %rdi
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movl	$194, %ecx
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp71:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp72:
	jmp	.LBB5_19
.LBB5_56:
	movq	stderr(%rip), %rdi
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movl	$197, %ecx
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp76:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp77:
	jmp	.LBB5_19
.LBB5_60:
	movq	stderr(%rip), %rdi
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movl	$200, %ecx
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp81:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp82:
	jmp	.LBB5_19
.LBB5_64:
	movq	stderr(%rip), %rdi
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movl	$201, %ecx
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp86:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp87:
	jmp	.LBB5_19
.LBB5_68:
	movq	stderr(%rip), %rdi
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movl	$202, %ecx
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
.Ltmp91:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp92:
.LBB5_19:
	movl	$.L.str.3, %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
.LBB5_5:
	movq	%rax, %rcx
	xorl	%eax, %eax
	callq	fprintf
	movl	$1, %edi
	callq	exit
.LBB5_6:
.Ltmp16:
	jmp	.LBB5_75
.LBB5_25:
.Ltmp47:
	jmp	.LBB5_75
.LBB5_76:
.Ltmp100:
	jmp	.LBB5_75
.LBB5_69:
.Ltmp93:
	jmp	.LBB5_75
.LBB5_65:
.Ltmp88:
	jmp	.LBB5_75
.LBB5_61:
.Ltmp83:
	jmp	.LBB5_75
.LBB5_57:
.Ltmp78:
	jmp	.LBB5_75
.LBB5_53:
.Ltmp73:
	jmp	.LBB5_75
.LBB5_45:
.Ltmp62:
	jmp	.LBB5_75
.LBB5_44:
.Ltmp57:
	jmp	.LBB5_75
.LBB5_33:
.Ltmp52:
	jmp	.LBB5_75
.LBB5_20:
.Ltmp36:
	jmp	.LBB5_75
.LBB5_74:
.Ltmp31:
	jmp	.LBB5_75
.LBB5_11:
.Ltmp26:
	jmp	.LBB5_75
.LBB5_7:
.Ltmp21:
.LBB5_75:
	movq	%rax, %rbx
	leaq	32(%rsp), %rdi
	callq	_ZN8GpuTimerD2Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end5:
	.size	_Z12scanByDevicePiS_iii, .Lfunc_end5-_Z12scanByDevicePiS_iii
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table5:
.Lexception2:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end2-.Lcst_begin2
.Lcst_begin2:
	.uleb128 .Lfunc_begin2-.Lfunc_begin2    # >> Call Site 1 <<
	.uleb128 .Ltmp14-.Lfunc_begin2          #   Call between .Lfunc_begin2 and .Ltmp14
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp14-.Lfunc_begin2          # >> Call Site 2 <<
	.uleb128 .Ltmp15-.Ltmp14                #   Call between .Ltmp14 and .Ltmp15
	.uleb128 .Ltmp16-.Lfunc_begin2          #     jumps to .Ltmp16
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp17-.Lfunc_begin2          # >> Call Site 3 <<
	.uleb128 .Ltmp18-.Ltmp17                #   Call between .Ltmp17 and .Ltmp18
	.uleb128 .Ltmp21-.Lfunc_begin2          #     jumps to .Ltmp21
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp22-.Lfunc_begin2          # >> Call Site 4 <<
	.uleb128 .Ltmp23-.Ltmp22                #   Call between .Ltmp22 and .Ltmp23
	.uleb128 .Ltmp26-.Lfunc_begin2          #     jumps to .Ltmp26
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp27-.Lfunc_begin2          # >> Call Site 5 <<
	.uleb128 .Ltmp28-.Ltmp27                #   Call between .Ltmp27 and .Ltmp28
	.uleb128 .Ltmp31-.Lfunc_begin2          #     jumps to .Ltmp31
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp32-.Lfunc_begin2          # >> Call Site 6 <<
	.uleb128 .Ltmp33-.Ltmp32                #   Call between .Ltmp32 and .Ltmp33
	.uleb128 .Ltmp36-.Lfunc_begin2          #     jumps to .Ltmp36
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp41-.Lfunc_begin2          # >> Call Site 7 <<
	.uleb128 .Ltmp46-.Ltmp41                #   Call between .Ltmp41 and .Ltmp46
	.uleb128 .Ltmp47-.Lfunc_begin2          #     jumps to .Ltmp47
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp48-.Lfunc_begin2          # >> Call Site 8 <<
	.uleb128 .Ltmp49-.Ltmp48                #   Call between .Ltmp48 and .Ltmp49
	.uleb128 .Ltmp52-.Lfunc_begin2          #     jumps to .Ltmp52
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp53-.Lfunc_begin2          # >> Call Site 9 <<
	.uleb128 .Ltmp54-.Ltmp53                #   Call between .Ltmp53 and .Ltmp54
	.uleb128 .Ltmp57-.Lfunc_begin2          #     jumps to .Ltmp57
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp58-.Lfunc_begin2          # >> Call Site 10 <<
	.uleb128 .Ltmp59-.Ltmp58                #   Call between .Ltmp58 and .Ltmp59
	.uleb128 .Ltmp62-.Lfunc_begin2          #     jumps to .Ltmp62
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp63-.Lfunc_begin2          # >> Call Site 11 <<
	.uleb128 .Ltmp68-.Ltmp63                #   Call between .Ltmp63 and .Ltmp68
	.uleb128 .Ltmp100-.Lfunc_begin2         #     jumps to .Ltmp100
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp69-.Lfunc_begin2          # >> Call Site 12 <<
	.uleb128 .Ltmp70-.Ltmp69                #   Call between .Ltmp69 and .Ltmp70
	.uleb128 .Ltmp73-.Lfunc_begin2          #     jumps to .Ltmp73
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp74-.Lfunc_begin2          # >> Call Site 13 <<
	.uleb128 .Ltmp75-.Ltmp74                #   Call between .Ltmp74 and .Ltmp75
	.uleb128 .Ltmp78-.Lfunc_begin2          #     jumps to .Ltmp78
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp79-.Lfunc_begin2          # >> Call Site 14 <<
	.uleb128 .Ltmp80-.Ltmp79                #   Call between .Ltmp79 and .Ltmp80
	.uleb128 .Ltmp83-.Lfunc_begin2          #     jumps to .Ltmp83
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp84-.Lfunc_begin2          # >> Call Site 15 <<
	.uleb128 .Ltmp85-.Ltmp84                #   Call between .Ltmp84 and .Ltmp85
	.uleb128 .Ltmp88-.Lfunc_begin2          #     jumps to .Ltmp88
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp89-.Lfunc_begin2          # >> Call Site 16 <<
	.uleb128 .Ltmp90-.Ltmp89                #   Call between .Ltmp89 and .Ltmp90
	.uleb128 .Ltmp93-.Lfunc_begin2          #     jumps to .Ltmp93
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp94-.Lfunc_begin2          # >> Call Site 17 <<
	.uleb128 .Ltmp99-.Ltmp94                #   Call between .Ltmp94 and .Ltmp99
	.uleb128 .Ltmp100-.Lfunc_begin2         #     jumps to .Ltmp100
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp19-.Lfunc_begin2          # >> Call Site 18 <<
	.uleb128 .Ltmp20-.Ltmp19                #   Call between .Ltmp19 and .Ltmp20
	.uleb128 .Ltmp21-.Lfunc_begin2          #     jumps to .Ltmp21
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp24-.Lfunc_begin2          # >> Call Site 19 <<
	.uleb128 .Ltmp25-.Ltmp24                #   Call between .Ltmp24 and .Ltmp25
	.uleb128 .Ltmp26-.Lfunc_begin2          #     jumps to .Ltmp26
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp29-.Lfunc_begin2          # >> Call Site 20 <<
	.uleb128 .Ltmp30-.Ltmp29                #   Call between .Ltmp29 and .Ltmp30
	.uleb128 .Ltmp31-.Lfunc_begin2          #     jumps to .Ltmp31
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp34-.Lfunc_begin2          # >> Call Site 21 <<
	.uleb128 .Ltmp35-.Ltmp34                #   Call between .Ltmp34 and .Ltmp35
	.uleb128 .Ltmp36-.Lfunc_begin2          #     jumps to .Ltmp36
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp50-.Lfunc_begin2          # >> Call Site 22 <<
	.uleb128 .Ltmp51-.Ltmp50                #   Call between .Ltmp50 and .Ltmp51
	.uleb128 .Ltmp52-.Lfunc_begin2          #     jumps to .Ltmp52
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp55-.Lfunc_begin2          # >> Call Site 23 <<
	.uleb128 .Ltmp56-.Ltmp55                #   Call between .Ltmp55 and .Ltmp56
	.uleb128 .Ltmp57-.Lfunc_begin2          #     jumps to .Ltmp57
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp60-.Lfunc_begin2          # >> Call Site 24 <<
	.uleb128 .Ltmp61-.Ltmp60                #   Call between .Ltmp60 and .Ltmp61
	.uleb128 .Ltmp62-.Lfunc_begin2          #     jumps to .Ltmp62
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp71-.Lfunc_begin2          # >> Call Site 25 <<
	.uleb128 .Ltmp72-.Ltmp71                #   Call between .Ltmp71 and .Ltmp72
	.uleb128 .Ltmp73-.Lfunc_begin2          #     jumps to .Ltmp73
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp76-.Lfunc_begin2          # >> Call Site 26 <<
	.uleb128 .Ltmp77-.Ltmp76                #   Call between .Ltmp76 and .Ltmp77
	.uleb128 .Ltmp78-.Lfunc_begin2          #     jumps to .Ltmp78
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp81-.Lfunc_begin2          # >> Call Site 27 <<
	.uleb128 .Ltmp82-.Ltmp81                #   Call between .Ltmp81 and .Ltmp82
	.uleb128 .Ltmp83-.Lfunc_begin2          #     jumps to .Ltmp83
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp86-.Lfunc_begin2          # >> Call Site 28 <<
	.uleb128 .Ltmp87-.Ltmp86                #   Call between .Ltmp86 and .Ltmp87
	.uleb128 .Ltmp88-.Lfunc_begin2          #     jumps to .Ltmp88
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp91-.Lfunc_begin2          # >> Call Site 29 <<
	.uleb128 .Ltmp92-.Ltmp91                #   Call between .Ltmp91 and .Ltmp92
	.uleb128 .Ltmp93-.Lfunc_begin2          #     jumps to .Ltmp93
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp92-.Lfunc_begin2          # >> Call Site 30 <<
	.uleb128 .Lfunc_end5-.Ltmp92            #   Call between .Ltmp92 and .Lfunc_end5
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end2:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	_Z15printDeviceInfov            # -- Begin function _Z15printDeviceInfov
	.type	_Z15printDeviceInfov,@function
_Z15printDeviceInfov:                   # @_Z15printDeviceInfov
	.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	8(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipGetDevicePropertiesR0600
	testl	%eax, %eax
	jne	.LBB6_2
# %bb.1:
	movl	$.Lstr, %edi
	callq	puts@PLT
	leaq	8(%rsp), %rbx
	movl	$.L.str.6, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	360(%rbx), %esi
	movl	364(%rbx), %edx
	movl	$.L.str.7, %edi
	xorl	%eax, %eax
	callq	printf
	movl	388(%rbx), %esi
	movl	$.L.str.8, %edi
	xorl	%eax, %eax
	callq	printf
	movl	624(%rbx), %esi
	movl	$.L.str.9, %edi
	xorl	%eax, %eax
	callq	printf
	movl	624(%rbx), %eax
	cltd
	idivl	308(%rbx)
	movl	$.L.str.10, %edi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	printf
	movq	288(%rbx), %rsi
	movl	$.L.str.11, %edi
	xorl	%eax, %eax
	callq	printf
	movq	640(%rbx), %rsi
	movl	$.L.str.12, %edi
	xorl	%eax, %eax
	callq	printf
	movq	296(%rbx), %rsi
	movl	$.L.str.13, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	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
.LBB6_2:
	.cfi_def_cfa_offset 1504
	movl	%eax, %ebx
	movq	stderr(%rip), %rdi
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movl	$211, %ecx
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %r14
	movl	%ebx, %edi
	callq	hipGetErrorString
	movl	$.L.str.3, %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
	movq	%rax, %rcx
	xorl	%eax, %eax
	callq	fprintf
	movl	$1, %edi
	callq	exit
.Lfunc_end6:
	.size	_Z15printDeviceInfov, .Lfunc_end6-_Z15printDeviceInfov
	.cfi_endproc
                                        # -- End function
	.globl	_Z16checkCorrectnessPiS_i       # -- Begin function _Z16checkCorrectnessPiS_i
	.type	_Z16checkCorrectnessPiS_i,@function
_Z16checkCorrectnessPiS_i:              # @_Z16checkCorrectnessPiS_i
	.cfi_startproc
# %bb.0:
	testl	%edx, %edx
	jle	.LBB7_6
# %bb.1:                                # %.lr.ph.preheader
	movl	(%rdi), %eax
	cmpl	(%rsi), %eax
	jne	.LBB7_8
# %bb.2:                                # %.lr.ph15.preheader
	movl	%edx, %eax
	movl	$1, %edx
.LBB7_3:                                # %.lr.ph15
                                        # =>This Inner Loop Header: Depth=1
	movq	%rdx, %rcx
	cmpq	%rdx, %rax
	je	.LBB7_5
# %bb.4:                                # %.lr.ph
                                        #   in Loop: Header=BB7_3 Depth=1
	movl	(%rdi,%rcx,4), %r8d
	leaq	1(%rcx), %rdx
	cmpl	(%rsi,%rcx,4), %r8d
	je	.LBB7_3
.LBB7_5:                                # %._crit_edge.loopexit
	cmpq	%rax, %rcx
	setae	%al
                                        # kill: def $al killed $al killed $eax
	retq
.LBB7_6:
	movb	$1, %al
                                        # kill: def $al killed $al killed $eax
	retq
.LBB7_8:
	xorl	%eax, %eax
                                        # kill: def $al killed $al killed $eax
	retq
.Lfunc_end7:
	.size	_Z16checkCorrectnessPiS_i, .Lfunc_end7-_Z16checkCorrectnessPiS_i
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	pushq	%rax
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %rbp
	movl	%edi, %r13d
	callq	_Z15printDeviceInfov
	xorl	%r12d, %r12d
	movl	$.L.str.15, %edi
	movl	$16777217, %esi                 # imm = 0x1000001
	xorl	%eax, %eax
	callq	printf
	movl	$67108868, %edi                 # imm = 0x4000004
	callq	malloc
	movq	%rax, %rbx
	movl	$67108868, %edi                 # imm = 0x4000004
	callq	malloc
	movq	%rax, %r14
	movl	$67108868, %edi                 # imm = 0x4000004
	callq	malloc
	movq	%rax, %r15
.LBB8_1:                                # =>This Inner Loop Header: Depth=1
	callq	rand
	movzbl	%al, %eax
	addl	$-127, %eax
	movl	%eax, (%rbx,%r12,4)
	incq	%r12
	cmpq	$16777217, %r12                 # imm = 0x1000001
	jne	.LBB8_1
# %bb.2:
	cmpl	$2, %r13d
	je	.LBB8_19
# %bb.3:
	movq	%rbp, %rax
	movl	$512, %ebp                      # imm = 0x200
	movl	$512, %r12d                     # imm = 0x200
	cmpl	$3, %r13d
	jne	.LBB8_6
# %bb.4:
	movq	%rax, %r12
	movq	8(%rax), %rdi
	callq	atoi
	movl	%eax, %ebp
	movq	16(%r12), %rdi
	callq	atoi
	jmp	.LBB8_5
.LBB8_19:
	movq	8(%rbp), %rdi
	callq	atoi
	movl	%eax, %ebp
.LBB8_5:
	movl	%eax, %r12d
.LBB8_6:
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movl	$16777217, %edx                 # imm = 0x1000001
	callq	_Z10scanByHostPiS_i
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$16777217, %edx                 # imm = 0x1000001
	movl	$1, %ecx
	movl	%ebp, %r8d
	callq	_Z12scanByDevicePiS_iii
	movl	(%r15), %ebp
	cmpl	%ebp, (%r14)
	jne	.LBB8_11
# %bb.7:                                # %.lr.ph.preheader
	movq	$-1, %rax
.LBB8_8:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	cmpq	$16777215, %rax                 # imm = 0xFFFFFF
	je	.LBB8_12
# %bb.9:                                # %.lr.ph.i
                                        #   in Loop: Header=BB8_8 Depth=1
	movl	8(%r14,%rax,4), %edx
	leaq	1(%rax), %rcx
	cmpl	8(%r15,%rax,4), %edx
	movq	%rcx, %rax
	je	.LBB8_8
# %bb.10:                               # %_Z16checkCorrectnessPiS_i.exit
	cmpq	$16777215, %rcx                 # imm = 0xFFFFFF
	ja	.LBB8_12
.LBB8_11:                               # %.critedge
	movl	$.L.str.16, %edi
	movl	$1, %esi
	xorl	%eax, %eax
	callq	printf
.LBB8_12:                               # %_Z16checkCorrectnessPiS_i.exit.thread
	movl	$67108868, %edx                 # imm = 0x4000004
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$16777217, %edx                 # imm = 0x1000001
	movl	$2, %ecx
	movl	%r12d, %r8d
	callq	_Z12scanByDevicePiS_iii
	cmpl	%ebp, (%r14)
	jne	.LBB8_17
# %bb.13:                               # %.lr.ph56.preheader
	movq	$-1, %rax
.LBB8_14:                               # %.lr.ph56
                                        # =>This Inner Loop Header: Depth=1
	cmpq	$16777215, %rax                 # imm = 0xFFFFFF
	je	.LBB8_18
# %bb.15:                               # %.lr.ph.i43
                                        #   in Loop: Header=BB8_14 Depth=1
	movl	8(%r14,%rax,4), %edx
	leaq	1(%rax), %rcx
	cmpl	8(%r15,%rax,4), %edx
	movq	%rcx, %rax
	je	.LBB8_14
# %bb.16:                               # %_Z16checkCorrectnessPiS_i.exit49
	cmpq	$16777215, %rcx                 # imm = 0xFFFFFF
	ja	.LBB8_18
.LBB8_17:                               # %.critedge59
	movl	$.L.str.16, %edi
	movl	$2, %esi
	xorl	%eax, %eax
	callq	printf
.LBB8_18:                               # %_Z16checkCorrectnessPiS_i.exit49.thread
	movq	%rbx, %rdi
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	%r15, %rdi
	callq	free
	xorl	%eax, %eax
	addq	$8, %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_end8:
	.size	main, .Lfunc_end8-main
	.cfi_endproc
                                        # -- End function
	.section	.text.__clang_call_terminate,"axG",@progbits,__clang_call_terminate,comdat
	.hidden	__clang_call_terminate          # -- Begin function __clang_call_terminate
	.weak	__clang_call_terminate
	.type	__clang_call_terminate,@function
__clang_call_terminate:                 # @__clang_call_terminate
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__cxa_begin_catch
	callq	_ZSt9terminatev
.Lfunc_end9:
	.size	__clang_call_terminate, .Lfunc_end9-__clang_call_terminate
	.cfi_endproc
                                        # -- End function
	.text
	.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	$_Z9scanBlks1PiS_iS_, %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	$_Z9scanBlks2PiS_iS_, %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	$_Z10addPrevSumPiS_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_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	"Time of scanByHost: %.3f ms\n\n"
	.size	.L.str, 30

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

	.type	_Z9scanBlks2PiS_iS_,@object     # @_Z9scanBlks2PiS_iS_
	.globl	_Z9scanBlks2PiS_iS_
	.p2align	3, 0x0
_Z9scanBlks2PiS_iS_:
	.quad	_Z24__device_stub__scanBlks2PiS_iS_
	.size	_Z9scanBlks2PiS_iS_, 8

	.type	_Z10addPrevSumPiS_i,@object     # @_Z10addPrevSumPiS_i
	.globl	_Z10addPrevSumPiS_i
	.p2align	3, 0x0
_Z10addPrevSumPiS_i:
	.quad	_Z25__device_stub__addPrevSumPiS_i
	.size	_Z10addPrevSumPiS_i, 8

	.type	.L.str.1,@object                # @.str.1
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.1:
	.asciz	"Error: %s:%d, "
	.size	.L.str.1, 15

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/hmhuan/PG_GPU/master/assignment/bt5.hip"
	.size	.L.str.2, 102

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"code: %d, reason: %s\n"
	.size	.L.str.3, 22

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Time of scanByDevice (kernelType=%d): %.3f ms\n\n"
	.size	.L.str.4, 48

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Name: %s\n"
	.size	.L.str.6, 10

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

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Num SMs: %d\n"
	.size	.L.str.8, 13

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"Max num threads per SM: %d\n"
	.size	.L.str.9, 28

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"Max num warps per SM: %d\n"
	.size	.L.str.10, 26

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"GMEM: %zu byte\n"
	.size	.L.str.11, 16

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"SMEM per SM: %zu byte\n"
	.size	.L.str.12, 23

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"SMEM per block: %zu byte\n"
	.size	.L.str.13, 26

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"Input size: %d\n\n"
	.size	.L.str.15, 17

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"scanByDevice (kernelType=%d) is INCORRECT!\n\n"
	.size	.L.str.16, 45

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z9scanBlks1PiS_iS_"
	.size	.L__unnamed_1, 20

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z9scanBlks2PiS_iS_"
	.size	.L__unnamed_2, 20

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z10addPrevSumPiS_i"
	.size	.L__unnamed_3, 20

	.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	"**********GPU info**********"
	.size	.Lstr, 29

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"****************************\n"
	.size	.Lstr.1, 30

	.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 __gxx_personality_v0
	.addrsig_sym _Z24__device_stub__scanBlks1PiS_iS_
	.addrsig_sym _Z24__device_stub__scanBlks2PiS_iS_
	.addrsig_sym _Z25__device_stub__addPrevSumPiS_i
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z9scanBlks1PiS_iS_
	.addrsig_sym _Z9scanBlks2PiS_iS_
	.addrsig_sym _Z10addPrevSumPiS_i
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z9scanBlks1PiS_iS_     ; -- Begin function _Z9scanBlks1PiS_iS_
	.globl	_Z9scanBlks1PiS_iS_
	.p2align	8
	.type	_Z9scanBlks1PiS_iS_,@function
_Z9scanBlks1PiS_iS_:                    ; @_Z9scanBlks1PiS_iS_
; %bb.0:
	s_clause 0x2
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b32 s9, s[0:1], 0x10
	s_load_b128 s[4:7], s[0:1], 0x0
	s_mov_b32 s8, s15
	v_mov_b32_e32 v4, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s3, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s8, s3, v[0:1]
	v_cmp_gt_i32_e32 vcc_lo, s9, v1
	v_ashrrev_i32_e32 v2, 31, v1
	s_and_saveexec_b32 s9, vcc_lo
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[3:4], 2, v[1:2]
	v_add_co_u32 v3, s2, s4, v3
	s_delay_alu instid0(VALU_DEP_1)
	v_add_co_ci_u32_e64 v4, s2, s5, v4, s2
	global_load_b32 v4, v[3:4], off
.LBB0_2:
	s_or_b32 exec_lo, exec_lo, s9
	v_lshl_add_u32 v3, v0, 2, 0
	s_cmp_lt_u32 s3, 2
	s_waitcnt vmcnt(0)
	ds_store_b32 v3, v4
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc1 .LBB0_7
; %bb.3:                                ; %.lr.ph.preheader
	s_mov_b32 s4, 1
.LBB0_4:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	s_mov_b32 s5, exec_lo
	v_cmpx_le_u32_e64 s4, v0
	s_cbranch_execz .LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	v_subrev_nc_u32_e32 v4, s4, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_lshl_add_u32 v4, v4, 2, 0
	ds_load_b32 v4, v4
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	ds_load_b32 v5, v3
	s_waitcnt lgkmcnt(0)
	v_add_nc_u32_e32 v4, v5, v4
	ds_store_b32 v3, v4
.LBB0_6:                                ;   in Loop: Header=BB0_4 Depth=1
	s_or_b32 exec_lo, exec_lo, s5
	s_lshl_b32 s4, s4, 1
	s_waitcnt lgkmcnt(0)
	s_cmp_ge_u32 s4, s3
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB0_4
.LBB0_7:                                ; %._crit_edge
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB0_9
; %bb.8:
	ds_load_b32 v3, v3
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo
	s_waitcnt lgkmcnt(0)
	global_store_b32 v[0:1], v3, off
.LBB0_9:
	s_or_b32 exec_lo, exec_lo, s2
	s_load_b64 s[0:1], s[0:1], 0x18
	s_waitcnt lgkmcnt(0)
	s_cmp_eq_u64 s[0:1], 0
	s_cbranch_scc1 .LBB0_11
; %bb.10:
	s_mov_b32 s9, 0
	v_mov_b32_e32 v1, 0
	s_lshl_b64 s[4:5], s[8:9], 2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	s_add_u32 s0, s0, s4
	s_addc_u32 s1, s1, s5
	s_lshl_b32 s2, s3, 2
	s_add_i32 s2, s2, 0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s2, s2, -4
	v_mov_b32_e32 v0, s2
	ds_load_b32 v0, v0
	s_waitcnt lgkmcnt(0)
	global_store_b32 v1, v0, s[0:1]
.LBB0_11:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9scanBlks1PiS_iS_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.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 6
		.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	_Z9scanBlks1PiS_iS_, .Lfunc_end0-_Z9scanBlks1PiS_iS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 432
; NumSgprs: 18
; NumVgprs: 6
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 6
; 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	_Z9scanBlks2PiS_iS_     ; -- Begin function _Z9scanBlks2PiS_iS_
	.globl	_Z9scanBlks2PiS_iS_
	.p2align	8
	.type	_Z9scanBlks2PiS_iS_,@function
_Z9scanBlks2PiS_iS_:                    ; @_Z9scanBlks2PiS_iS_
; %bb.0:
	s_clause 0x2
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b32 s3, s[0:1], 0x10
	s_load_b128 s[4:7], s[0:1], 0x0
	s_mov_b32 s8, s15
	s_waitcnt lgkmcnt(0)
	s_and_b32 s9, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_i32 s2, s15, s9
	v_lshl_add_u32 v3, s2, 1, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_gt_i32_e64 s2, s3, v3
	s_and_saveexec_b32 s10, s2
	s_cbranch_execz .LBB1_2
; %bb.1:
	v_ashrrev_i32_e32 v4, 31, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[1:2], 2, v[3:4]
	v_add_co_u32 v1, vcc_lo, s4, v1
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v2, vcc_lo, s5, v2, vcc_lo
	global_load_b32 v1, v[1:2], off
	v_lshl_add_u32 v2, v0, 2, 0
	s_waitcnt vmcnt(0)
	ds_store_b32 v2, v1
.LBB1_2:
	s_or_b32 exec_lo, exec_lo, s10
	v_add_nc_u32_e32 v1, s9, v3
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_gt_i32_e32 vcc_lo, s3, v1
	s_and_saveexec_b32 s10, vcc_lo
	s_cbranch_execz .LBB1_4
; %bb.3:
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[4:5], 2, v[1:2]
	v_add_co_u32 v4, s3, s4, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e64 v5, s3, s5, v5, s3
	global_load_b32 v2, v[4:5], off
	v_add_nc_u32_e32 v4, s9, v0
	v_lshl_add_u32 v4, v4, 2, 0
	s_waitcnt vmcnt(0)
	ds_store_b32 v4, v2
.LBB1_4:
	s_or_b32 exec_lo, exec_lo, s10
	v_lshl_add_u32 v2, v0, 1, 2
	s_lshl_b32 s4, s9, 1
	s_cmp_eq_u32 s9, 0
	s_mov_b32 s5, 1
	s_waitcnt lgkmcnt(0)
	s_barrier
.LBB1_5:                                ; =>This Inner Loop Header: Depth=1
	buffer_gl0_inv
	s_cbranch_scc1 .LBB1_9
; %bb.6:                                ;   in Loop: Header=BB1_5 Depth=1
	v_mad_u64_u32 v[4:5], null, s5, v2, -1
	s_mov_b32 s10, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_u32_e64 s4, v4
	s_cbranch_execz .LBB1_8
; %bb.7:                                ;   in Loop: Header=BB1_5 Depth=1
	v_subrev_nc_u32_e32 v5, s5, v4
	v_lshl_add_u32 v4, v4, 2, 0
	s_delay_alu instid0(VALU_DEP_2)
	v_lshl_add_u32 v5, v5, 2, 0
	ds_load_b32 v5, v5
	ds_load_b32 v6, v4
	s_waitcnt lgkmcnt(0)
	v_add_nc_u32_e32 v5, v6, v5
	ds_store_b32 v4, v5
.LBB1_8:                                ;   in Loop: Header=BB1_5 Depth=1
	s_or_b32 exec_lo, exec_lo, s10
	s_lshl_b32 s5, s5, 1
	s_waitcnt lgkmcnt(0)
	s_cmp_ge_u32 s5, s4
	s_barrier
	s_branch .LBB1_5
.LBB1_9:                                ; %.preheader
	s_cmp_lt_u32 s9, 2
	s_cbranch_scc1 .LBB1_14
; %bb.10:                               ; %.lr.ph48
	s_mov_b32 s5, s9
.LBB1_11:                               ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	s_lshr_b32 s10, s5, 1
	s_mov_b32 s11, exec_lo
	v_mad_u32_u24 v4, s10, v2, -1
	v_add_nc_u32_e32 v5, s10, v4
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_u32_e64 s4, v5
	s_cbranch_execz .LBB1_13
; %bb.12:                               ;   in Loop: Header=BB1_11 Depth=1
	v_lshl_add_u32 v4, v4, 2, 0
	v_lshl_add_u32 v5, v5, 2, 0
	ds_load_b32 v4, v4
	ds_load_b32 v6, v5
	s_waitcnt lgkmcnt(0)
	v_add_nc_u32_e32 v4, v6, v4
	ds_store_b32 v5, v4
.LBB1_13:                               ;   in Loop: Header=BB1_11 Depth=1
	s_or_b32 exec_lo, exec_lo, s11
	s_cmp_lt_u32 s5, 4
	s_mov_b32 s5, s10
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB1_11
.LBB1_14:                               ; %._crit_edge
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB1_16
; %bb.15:
	v_lshl_add_u32 v2, v0, 2, 0
	v_ashrrev_i32_e32 v4, 31, v3
	ds_load_b32 v5, v2
	v_lshlrev_b64 v[2:3], 2, v[3:4]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v2, s2, s6, v2
	v_add_co_ci_u32_e64 v3, s2, s7, v3, s2
	s_waitcnt lgkmcnt(0)
	global_store_b32 v[2:3], v5, off
.LBB1_16:
	s_or_b32 exec_lo, exec_lo, s3
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB1_18
; %bb.17:
	v_add_nc_u32_e32 v2, s9, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_lshl_add_u32 v2, v2, 2, 0
	ds_load_b32 v3, v2
	v_ashrrev_i32_e32 v2, 31, v1
	v_lshlrev_b64 v[1:2], 2, v[1:2]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v1, vcc_lo, s6, v1
	v_add_co_ci_u32_e32 v2, vcc_lo, s7, v2, vcc_lo
	s_waitcnt lgkmcnt(0)
	global_store_b32 v[1:2], v3, off
.LBB1_18:
	s_or_b32 exec_lo, exec_lo, s2
	s_load_b64 s[0:1], s[0:1], 0x18
	v_cmp_eq_u32_e32 vcc_lo, 0, v0
	s_mov_b32 s9, 0
	s_waitcnt lgkmcnt(0)
	s_cmp_lg_u64 s[0:1], 0
	s_cselect_b32 s2, -1, 0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, vcc_lo, s2
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB1_20
; %bb.19:
	s_lshl_b64 s[2:3], s[8:9], 2
	v_mov_b32_e32 v1, 0
	s_add_u32 s0, s0, s2
	s_addc_u32 s1, s1, s3
	s_lshl_b32 s2, s4, 2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s2, s2, 0
	s_add_i32 s2, s2, -4
	s_delay_alu instid0(SALU_CYCLE_1)
	v_mov_b32_e32 v0, s2
	ds_load_b32 v0, v0
	s_waitcnt lgkmcnt(0)
	global_store_b32 v1, v0, s[0:1]
.LBB1_20:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9scanBlks2PiS_iS_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 7
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z9scanBlks2PiS_iS_, .Lfunc_end1-_Z9scanBlks2PiS_iS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 780
; NumSgprs: 18
; NumVgprs: 7
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 7
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z10addPrevSumPiS_i     ; -- Begin function _Z10addPrevSumPiS_i
	.globl	_Z10addPrevSumPiS_i
	.p2align	8
	.type	_Z10addPrevSumPiS_i,@function
_Z10addPrevSumPiS_i:                    ; @_Z10addPrevSumPiS_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s3, s[0:1], 0x24
	s_load_b32 s4, s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s3, s3, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_i32 s5, s15, s3
	v_add3_u32 v0, s5, s3, v0
	s_mov_b32 s3, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s4, v0
	s_cbranch_execz .LBB2_2
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_ashrrev_i32_e32 v1, 31, v0
	s_mov_b32 s2, s15
	s_mov_b32 s3, 0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_lshl_b64 s[0:1], s[2:3], 2
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo
	s_add_u32 s0, s4, s0
	s_addc_u32 s1, s5, s1
	s_load_b32 s0, s[0:1], 0x0
	global_load_b32 v2, v[0:1], off
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_nc_u32_e32 v2, s0, v2
	global_store_b32 v[0:1], v2, off
.LBB2_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10addPrevSumPiS_i
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 3
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end2:
	.size	_Z10addPrevSumPiS_i, .Lfunc_end2-_Z10addPrevSumPiS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 176
; 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
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
      - .offset:         152
        .size:           4
        .value_kind:     hidden_dynamic_lds_size
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z9scanBlks1PiS_iS_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z9scanBlks1PiS_iS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     6
    .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
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
      - .offset:         152
        .size:           4
        .value_kind:     hidden_dynamic_lds_size
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z9scanBlks2PiS_iS_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z9scanBlks2PiS_iS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     7
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z10addPrevSumPiS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z10addPrevSumPiS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     3
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
