#include <iostream>
#include <vector>
#include <chrono>
#include <cassert>



/***
   first argument is the approach
0: sequential, 1: reduce1, 2: reduce2, 3: reduce3, 4: reduce4, 5:reduce5 
   second argument is the number of elements
***/


__device__ void warpReduce(volatile unsigned int* sdata, const unsigned int tid, const unsigned int elements){
    if(elements > 32)    sdata[tid] += sdata[tid + 32];
    if(elements > 16)    sdata[tid] += sdata[tid + 16];
    if(elements > 8)     sdata[tid] += sdata[tid + 8];
    if(elements > 4)     sdata[tid] += sdata[tid + 4];
    if(elements > 2)     sdata[tid] += sdata[tid + 2];
    if(elements > 1)     sdata[tid] += sdata[tid + 1];
}


__global__ void kernel5(unsigned int* d_in, unsigned int* d_out, const unsigned int elements){
    extern __shared__ unsigned int sdata[];

    unsigned int tid = threadIdx.x;
    unsigned int i = threadIdx.x + blockIdx.x * (blockDim.x * 2);

    sdata[tid] = 0;

    if(i < elements){
	 if(gridDim.x > 1)    sdata[tid] = d_in[i] + d_in[i + blockDim.x];
         else    sdata[tid] = d_in[i];
    }
    __syncthreads();

    for(unsigned int s = blockDim.x / 2; s > 32; s >>= 1){
        if(tid < s)    sdata[tid] += sdata[tid + s];
	__syncthreads();
    }

    if(tid < 32)    warpReduce(sdata, tid, elements);

    if(tid == 0)    d_out[blockIdx.x] = sdata[0];
}


__global__ void kernel4(unsigned int* d_in, unsigned int* d_out, const unsigned int elements){
    extern __shared__ unsigned int sdata[];

    unsigned int tid = threadIdx.x;
    unsigned int i = threadIdx.x + blockIdx.x * (blockDim.x * 2);

    sdata[tid] = 0;
    if(i < elements){
        if(gridDim.x > 1)    sdata[tid] = d_in[i] + d_in[i + blockDim.x];
        else    sdata[tid] = d_in[i];
    }
    __syncthreads();


    for(unsigned int s = blockDim.x / 2; s > 0; s >>= 1){
        if(tid < s)    sdata[tid] += sdata[tid + s];
	__syncthreads();
    }

    if(tid == 0)    d_out[blockIdx.x] = sdata[0];
}



__global__ void kernel3(unsigned int* d_in, unsigned int* d_out, const unsigned int elements){
    extern __shared__ unsigned int sdata[];

    unsigned int tid = threadIdx.x;
    unsigned int i = threadIdx.x + blockIdx.x * blockDim.x;

    sdata[tid] = (i < elements) ? d_in[i] : 0;
    __syncthreads();

    for(unsigned int s = blockDim.x / 2; s > 0; s >>= 1){
        if(tid < s)    sdata[tid] += sdata[tid + s];
	__syncthreads();

    }
    if(tid == 0)    d_out[blockIdx.x] = sdata[0];
}



__global__ void kernel2(unsigned int* d_in, unsigned int* d_out, const unsigned int elements){
    extern __shared__ unsigned int sdata[];

    unsigned int tid = threadIdx.x;
    unsigned int i = threadIdx.x + blockIdx.x * blockDim.x;


    sdata[tid] = (i < elements) ? d_in[i] : 0;
    __syncthreads();

    for(unsigned int s = 1; s < blockDim.x; s*=2){
	unsigned int index = 2 * s * tid;
        if(index < blockDim.x)    sdata[index] += sdata[index + s];
	__syncthreads();
    }

    if(tid == 0)    d_out[blockIdx.x] = sdata[0];
}


__global__ void kernel1(unsigned int* d_in, unsigned int* d_out, const unsigned int elements){
    extern __shared__ unsigned int sdata[];

    unsigned int tid = threadIdx.x;
    unsigned int i = threadIdx.x + blockIdx.x * blockDim.x;
    
    sdata[tid] = (i < elements) ? d_in[i] : 0;
    __syncthreads();

    for(unsigned int s = 1; (s < blockDim.x) && (tid+s) < elements; s*=2){
        if(tid % (2*s) == 0)    sdata[tid] += sdata[tid + s];
	__syncthreads();

    }

    if(tid == 0)    d_out[blockIdx.x] = sdata[0];
}



void reduce_sum(const int approach, unsigned int& elements){
    unsigned int numBlocks = 0;
    int numThreads = 1024;

    unsigned int originalElements = elements;

    unsigned int size = elements * sizeof(unsigned int);
    
    std::vector<unsigned int> h_in;
    std::vector<unsigned int> h_out(elements, 0);

    for(unsigned int i = 0; i < elements; ++i)    h_in.push_back(i%2);
    unsigned int gold_sum = elements/2;

    unsigned int* d_in;
    unsigned int* d_out;

    cudaMalloc(&d_in, size);
    cudaMalloc(&d_out, size);

    cudaMemcpy(d_in, h_in.data(), size, cudaMemcpyHostToDevice);
    
    auto start = std::chrono::steady_clock::now();
    while(elements > 1){
	if(elements < numThreads){
            numBlocks = 1;
	    numThreads = elements;
	}
	else    numBlocks = (elements - 1) / numThreads + 1;


        if(approach == 1)    
	    kernel1<<<numBlocks, numThreads, numThreads * sizeof(unsigned int)>>>(d_in, d_out, elements);
        else if(approach == 2)    
	    kernel2<<<numBlocks, numThreads, numThreads * sizeof(unsigned int)>>>(d_in, d_out, elements);
        else if(approach == 3)
            kernel3<<<numBlocks, numThreads, numThreads * sizeof(unsigned int)>>>(d_in, d_out, elements);
        else if(approach == 4)
	    kernel4<<<numBlocks, numThreads, numThreads * sizeof(unsigned int)>>>(d_in, d_out, elements);
	else
	    kernel5<<<numBlocks, numThreads, numThreads * sizeof(unsigned int)>>>(d_in, d_out, elements);
	
        elements = numBlocks;

        if(approach >= 4)    elements = elements / 2;
	
	d_in = d_out;
    }	
    auto end = std::chrono::steady_clock::now();
    
    cudaMemcpy(h_out.data(), d_out, size, cudaMemcpyDeviceToHost);

    cudaFree(d_in);
    cudaFree(d_out);
    
    assert(h_out[0] == gold_sum);

    std::cout << "reduce " << approach << " took " << std::chrono::duration_cast<std::chrono::microseconds>(end-start).count();
    std::cout << " ms to sum " << originalElements << " elements\n"; 
}



void reduce_sum_sequential(const unsigned int elements){
    std::vector<unsigned int> h_in;
    
    unsigned int gold_sum, sequential_sum;

    for(unsigned int i = 0; i < elements; ++i)    h_in.push_back(i%2);
    gold_sum = elements / 2;
    
    auto start = std::chrono::steady_clock::now();
    for(auto i : h_in)    sequential_sum += i;
    auto end = std::chrono::steady_clock::now();
    
    assert(gold_sum == sequential_sum);

    std::cout << "sequential reduce took " << std::chrono::duration_cast<std::chrono::microseconds>(end-start).count();
    std::cout << " ms to sum " << elements << " elements\n"; 
}



int main(int argc, char* argv[]){ 
    int approach = std::stoi(argv[1]);
    unsigned int elements = std::stoi(argv[2]);
    
    if(approach == 0)    reduce_sum_sequential(elements);
    else    reduce_sum(approach, elements);



    return 0;
}


	.file	"tmpxft_0036b566_00000000-6_reduce_five_approaches.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4115:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4115:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z10warpReducePVjjj
	.type	_Z10warpReducePVjjj, @function
_Z10warpReducePVjjj:
.LFB4097:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE4097:
	.size	_Z10warpReducePVjjj, .-_Z10warpReducePVjjj
	.globl	_Z29__device_stub__Z7kernel5PjS_jPjS_j
	.type	_Z29__device_stub__Z7kernel5PjS_jPjS_j, @function
_Z29__device_stub__Z7kernel5PjS_jPjS_j:
.LFB4137:
	.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	.L4
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z7kernel5PjS_j(%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
.L4:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4137:
	.size	_Z29__device_stub__Z7kernel5PjS_jPjS_j, .-_Z29__device_stub__Z7kernel5PjS_jPjS_j
	.globl	_Z7kernel5PjS_j
	.type	_Z7kernel5PjS_j, @function
_Z7kernel5PjS_j:
.LFB4138:
	.cfi_startproc
	endbr64
	jmp	_Z29__device_stub__Z7kernel5PjS_jPjS_j
	.cfi_endproc
.LFE4138:
	.size	_Z7kernel5PjS_j, .-_Z7kernel5PjS_j
	.globl	_Z29__device_stub__Z7kernel4PjS_jPjS_j
	.type	_Z29__device_stub__Z7kernel4PjS_jPjS_j, @function
_Z29__device_stub__Z7kernel4PjS_jPjS_j:
.LFB4139:
	.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	.L10
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z7kernel4PjS_j(%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
.L10:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4139:
	.size	_Z29__device_stub__Z7kernel4PjS_jPjS_j, .-_Z29__device_stub__Z7kernel4PjS_jPjS_j
	.globl	_Z7kernel4PjS_j
	.type	_Z7kernel4PjS_j, @function
_Z7kernel4PjS_j:
.LFB4140:
	.cfi_startproc
	endbr64
	jmp	_Z29__device_stub__Z7kernel4PjS_jPjS_j
	.cfi_endproc
.LFE4140:
	.size	_Z7kernel4PjS_j, .-_Z7kernel4PjS_j
	.globl	_Z29__device_stub__Z7kernel3PjS_jPjS_j
	.type	_Z29__device_stub__Z7kernel3PjS_jPjS_j, @function
_Z29__device_stub__Z7kernel3PjS_jPjS_j:
.LFB4141:
	.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	.L15
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z7kernel3PjS_j(%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
.L15:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4141:
	.size	_Z29__device_stub__Z7kernel3PjS_jPjS_j, .-_Z29__device_stub__Z7kernel3PjS_jPjS_j
	.globl	_Z7kernel3PjS_j
	.type	_Z7kernel3PjS_j, @function
_Z7kernel3PjS_j:
.LFB4142:
	.cfi_startproc
	endbr64
	jmp	_Z29__device_stub__Z7kernel3PjS_jPjS_j
	.cfi_endproc
.LFE4142:
	.size	_Z7kernel3PjS_j, .-_Z7kernel3PjS_j
	.globl	_Z29__device_stub__Z7kernel2PjS_jPjS_j
	.type	_Z29__device_stub__Z7kernel2PjS_jPjS_j, @function
_Z29__device_stub__Z7kernel2PjS_jPjS_j:
.LFB4143:
	.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	.L20
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z7kernel2PjS_j(%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
.L20:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4143:
	.size	_Z29__device_stub__Z7kernel2PjS_jPjS_j, .-_Z29__device_stub__Z7kernel2PjS_jPjS_j
	.globl	_Z7kernel2PjS_j
	.type	_Z7kernel2PjS_j, @function
_Z7kernel2PjS_j:
.LFB4144:
	.cfi_startproc
	endbr64
	jmp	_Z29__device_stub__Z7kernel2PjS_jPjS_j
	.cfi_endproc
.LFE4144:
	.size	_Z7kernel2PjS_j, .-_Z7kernel2PjS_j
	.globl	_Z29__device_stub__Z7kernel1PjS_jPjS_j
	.type	_Z29__device_stub__Z7kernel1PjS_jPjS_j, @function
_Z29__device_stub__Z7kernel1PjS_jPjS_j:
.LFB4145:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L25
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z7kernel1PjS_j(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L25:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4145:
	.size	_Z29__device_stub__Z7kernel1PjS_jPjS_j, .-_Z29__device_stub__Z7kernel1PjS_jPjS_j
	.globl	_Z7kernel1PjS_j
	.type	_Z7kernel1PjS_j, @function
_Z7kernel1PjS_j:
.LFB4146:
	.cfi_startproc
	endbr64
	jmp	_Z29__device_stub__Z7kernel1PjS_jPjS_j
	.cfi_endproc
.LFE4146:
	.size	_Z7kernel1PjS_j, .-_Z7kernel1PjS_j
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z7kernel1PjS_j"
.LC1:
	.string	"_Z7kernel2PjS_j"
.LC2:
	.string	"_Z7kernel3PjS_j"
.LC3:
	.string	"_Z7kernel4PjS_j"
.LC4:
	.string	"_Z7kernel5PjS_j"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4148:
	.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	.LC0(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z7kernel1PjS_j(%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	.LC1(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z7kernel2PjS_j(%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	.LC2(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z7kernel3PjS_j(%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	.LC3(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z7kernel4PjS_j(%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	.LC4(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z7kernel5PjS_j(%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
.LFE4148:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev,"axG",@progbits,_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD5Ev,comdat
	.align 2
	.weak	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev
	.type	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev, @function
_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev:
.LFB4227:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	call	__errno_location@PLT
	cmpl	$0, (%rax)
	jne	.L32
	movl	(%rbx), %edx
	movl	%edx, (%rax)
.L32:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4227:
	.size	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev, .-_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev
	.weak	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	.set	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev,_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev
	.section	.text._ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_,"axG",@progbits,_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_,comdat
	.weak	_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_
	.type	_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_, @function
_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_:
.LFB4222:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4222
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rdi, %r15
	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
	movq	%rcx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdx, %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movl	%r8d, 12(%rsp)
	leaq	28(%rsp), %r13
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	call	__errno_location@PLT
	movl	12(%rsp), %edx
	leaq	32(%rsp), %rsi
	movq	%rbx, %rdi
	movq	%rax, %rbp
	movl	(%rax), %eax
	movl	%eax, 28(%rsp)
	xorl	%eax, %eax
	movl	%eax, 0(%rbp)
.LEHB0:
	call	*%r15
	movq	32(%rsp), %rdx
	cmpq	%rbx, %rdx
	jne	.L36
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L49
	movq	%r14, %rdi
	call	_ZSt24__throw_invalid_argumentPKc@PLT
.L36:
	cmpl	$34, 0(%rbp)
	je	.L38
	movl	$2147483648, %ecx
	movl	$4294967295, %esi
	addq	%rax, %rcx
	cmpq	%rcx, %rsi
	jnb	.L39
.L38:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L49
	movq	%r14, %rdi
	call	_ZSt20__throw_out_of_rangePKc@PLT
.LEHE0:
.L39:
	testq	%r12, %r12
	je	.L41
	subq	%rbx, %rdx
	movq	%rdx, (%r12)
.L41:
	movq	%r13, %rdi
	movl	%eax, 12(%rsp)
	call	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	movl	12(%rsp), %eax
	movq	40(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L44
	jmp	.L49
.L45:
	endbr64
	movq	%rax, %rbx
.L42:
	movq	%r13, %rdi
	call	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L49
	movq	%rbx, %rdi
.LEHB1:
	call	_Unwind_Resume@PLT
.LEHE1:
.L49:
	call	__stack_chk_fail@PLT
.L44:
	addq	$56, %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
.LFE4222:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table._ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_,"aG",@progbits,_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_,comdat
.LLSDA4222:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4222-.LLSDACSB4222
.LLSDACSB4222:
	.uleb128 .LEHB0-.LFB4222
	.uleb128 .LEHE0-.LEHB0
	.uleb128 .L45-.LFB4222
	.uleb128 0
	.uleb128 .LEHB1-.LFB4222
	.uleb128 .LEHE1-.LEHB1
	.uleb128 0
	.uleb128 0
.LLSDACSE4222:
	.section	.text._ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_,"axG",@progbits,_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_,comdat
	.size	_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_, .-_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_
	.section	.text._ZNSt6vectorIjSaIjEED2Ev,"axG",@progbits,_ZNSt6vectorIjSaIjEED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorIjSaIjEED2Ev
	.type	_ZNSt6vectorIjSaIjEED2Ev, @function
_ZNSt6vectorIjSaIjEED2Ev:
.LFB4486:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L52
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L52:
	ret
	.cfi_endproc
.LFE4486:
	.size	_ZNSt6vectorIjSaIjEED2Ev, .-_ZNSt6vectorIjSaIjEED2Ev
	.weak	_ZNSt6vectorIjSaIjEED1Ev
	.set	_ZNSt6vectorIjSaIjEED1Ev,_ZNSt6vectorIjSaIjEED2Ev
	.section	.rodata._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.str1.1,"aMS",@progbits,1
.LC5:
	.string	"basic_string: construction from null is not valid"
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC5IS3_EEPKcRKS3_,comdat
	.align 2
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, @function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_:
.LFB4510:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	16(%rdi), %rax
	movq	%rax, (%rdi)
	testq	%rsi, %rsi
	jne	.L55
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L60
	leaq	.LC5(%rip), %rdi
	call	_ZSt19__throw_logic_errorPKc@PLT
.L55:
	movq	%rdi, %rbx
	movq	%rsi, %rdi
	movq	%rsi, %rbp
	call	strlen@PLT
	movq	%rax, (%rsp)
	leaq	0(%rbp,%rax), %r12
	cmpq	$15, %rax
	jbe	.L57
	movq	%rsp, %rsi
	xorl	%edx, %edx
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm@PLT
	movq	%rax, (%rbx)
	movq	(%rsp), %rax
	movq	%rax, 16(%rbx)
.L57:
	movq	(%rbx), %rdi
	movq	%r12, %rdx
	movq	%rbp, %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13_S_copy_charsEPcPKcS7_@PLT
	movq	(%rsp), %rax
	movq	(%rbx), %rdx
	movq	%rax, 8(%rbx)
	movb	$0, (%rdx,%rax)
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L58
.L60:
	call	__stack_chk_fail@PLT
.L58:
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4510:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, .-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
	.set	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.section	.rodata._ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_.str1.1,"aMS",@progbits,1
.LC6:
	.string	"vector::_M_realloc_insert"
	.section	.text._ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_,"axG",@progbits,_ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_,comdat
	.align 2
	.weak	_ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_
	.type	_ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_, @function
_ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_:
.LFB4795:
	.cfi_startproc
	endbr64
	movabsq	$2305843009213693951, %rcx
	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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	8(%rdi), %rax
	movq	(%rdi), %r14
	movq	%rax, %rbx
	movq	%rax, (%rsp)
	subq	%r14, %rbx
	sarq	$2, %rbx
	cmpq	%rcx, %rbx
	jne	.L62
	leaq	.LC6(%rip), %rdi
	call	_ZSt20__throw_length_errorPKc@PLT
.L62:
	cmpq	%r14, (%rsp)
	movl	$1, %eax
	movq	%rsi, %r15
	movq	%rdi, %r13
	cmovne	%rbx, %rax
	movq	%rsi, %rbp
	addq	%rax, %rbx
	setc	%al
	subq	%r14, %r15
	movzbl	%al, %eax
	testq	%rax, %rax
	jne	.L72
	xorl	%r12d, %r12d
	testq	%rbx, %rbx
	je	.L67
	movabsq	$2305843009213693951, %rax
	cmpq	%rax, %rbx
	cmova	%rax, %rbx
	jmp	.L66
.L72:
	movq	%rcx, %rbx
.L66:
	leaq	0(,%rbx,4), %rdi
	movq	%rdx, 8(%rsp)
	call	_Znwm@PLT
	movq	8(%rsp), %rdx
	movq	%rax, %r12
.L67:
	movl	(%rdx), %eax
	movl	%eax, (%r12,%r15)
	testq	%r15, %r15
	jle	.L68
	movq	%r15, %rdx
	movq	%r14, %rsi
	movq	%r12, %rdi
	call	memmove@PLT
.L68:
	movq	(%rsp), %rax
	leaq	4(%r12,%r15), %rdx
	subq	%rbp, %rax
	testq	%rax, %rax
	jle	.L69
	movq	%rdx, %rdi
	movq	%rbp, %rsi
	movq	%rax, %rcx
	rep movsb
.L69:
	leaq	(%rdx,%rax), %rbp
	testq	%r14, %r14
	je	.L70
	movq	16(%r13), %rsi
	movq	%r14, %rdi
	subq	%r14, %rsi
	call	_ZdlPvm@PLT
.L70:
	leaq	(%r12,%rbx,4), %rax
	movq	%r12, 0(%r13)
	movq	%rbp, 8(%r13)
	movq	%rax, 16(%r13)
	addq	$24, %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
.LFE4795:
	.size	_ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_, .-_ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_
	.text
	.align 2
	.type	_ZNSt6vectorIjSaIjEE12emplace_backIJjEEERjDpOT_.isra.0, @function
_ZNSt6vectorIjSaIjEE12emplace_backIJjEEERjDpOT_.isra.0:
.LFB4945:
	.cfi_startproc
	movq	%rsi, %rdx
	movq	8(%rdi), %rsi
	cmpq	16(%rdi), %rsi
	je	.L80
	movl	(%rdx), %eax
	addq	$4, %rsi
	movl	%eax, -4(%rsi)
	movq	%rsi, 8(%rdi)
	ret
.L80:
	jmp	_ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_
	.cfi_endproc
.LFE4945:
	.size	_ZNSt6vectorIjSaIjEE12emplace_backIJjEEERjDpOT_.isra.0, .-_ZNSt6vectorIjSaIjEE12emplace_backIJjEEERjDpOT_.isra.0
	.section	.rodata.str1.1
.LC7:
	.string	"reduce "
.LC8:
	.string	" took "
.LC9:
	.string	" ms to sum "
.LC10:
	.string	" elements\n"
	.text
	.globl	_Z10reduce_sumiRj
	.type	_Z10reduce_sumiRj, @function
_Z10reduce_sumiRj:
.LFB4098:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4098
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%r8d, %r8d
	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
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movl	(%rsi), %r15d
	movl	%edi, 12(%rsp)
	xorl	%edi, %edi
	leaq	0(,%r15,4), %r12
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	movq	%rdi, 72(%rsp)
	movq	%rdi, 80(%rsp)
	movq	%rdi, 88(%rsp)
	movq	%r8, 96(%rsp)
	movq	%r8, 104(%rsp)
	movq	%r8, 112(%rsp)
	testq	%r15, %r15
	je	.L109
	movq	%r12, %rdi
.LEHB2:
	call	_Znwm@PLT
.LEHE2:
	movq	%rax, %r14
	jmp	.L84
.L109:
	xorl	%r14d, %r14d
.L84:
	leaq	(%r14,%r12), %rax
	movq	%r14, 96(%rsp)
	movq	%r14, %rdx
	movq	%rax, 112(%rsp)
	testq	%r15, %r15
	je	.L116
.L86:
	cmpq	%rdx, %rax
	je	.L85
	xorl	%ecx, %ecx
	addq	$4, %rdx
	movl	%ecx, -4(%rdx)
	jmp	.L86
.L116:
	movq	%r14, %rax
.L85:
	movq	%rax, 104(%rsp)
	xorl	%ebx, %ebx
	leaq	60(%rsp), %r13
.L88:
	cmpl	0(%rbp), %ebx
	jnb	.L117
	movl	%ebx, %eax
	leaq	72(%rsp), %rdi
	movq	%r13, %rsi
	andl	$1, %eax
	movl	%eax, 60(%rsp)
.LEHB3:
	call	_ZNSt6vectorIjSaIjEE12emplace_backIJjEEERjDpOT_.isra.0
	incl	%ebx
	jmp	.L88
.L117:
	movl	%r12d, %eax
	leaq	32(%rsp), %rdi
	movq	%rax, %rsi
	movq	%rax, 16(%rsp)
	call	cudaMalloc@PLT
	movq	16(%rsp), %rsi
	leaq	40(%rsp), %rdi
	call	cudaMalloc@PLT
	movq	16(%rsp), %rdx
	movq	72(%rsp), %rsi
	movl	$1, %ecx
	movq	32(%rsp), %rdi
	call	cudaMemcpy@PLT
	call	_ZNSt6chrono3_V212steady_clock3nowEv@PLT
	movl	$1024, %r12d
	movabsq	$4294967297, %r13
	movq	%rax, 24(%rsp)
.L90:
	movl	0(%rbp), %eax
	cmpl	$1, %eax
	jbe	.L118
	cmpl	%r12d, %eax
	jnb	.L91
	movl	%eax, %r12d
	movl	$1, %ebx
	jmp	.L92
.L91:
	decl	%eax
	xorl	%edx, %edx
	divl	%r12d
	leal	1(%rax), %ebx
.L92:
	movslq	%r12d, %r8
	salq	$2, %r8
	cmpl	$1, 12(%rsp)
	jne	.L93
	movq	%r13, 64(%rsp)
	movl	68(%rsp), %ecx
	xorl	%r9d, %r9d
	movq	%r13, 52(%rsp)
	movl	56(%rsp), %esi
	movl	%r12d, 60(%rsp)
	movq	60(%rsp), %rdx
	movl	%ebx, 48(%rsp)
	movq	48(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	movq	40(%rsp), %rsi
	testl	%eax, %eax
	jne	.L115
	movl	0(%rbp), %edx
	movq	32(%rsp), %rdi
	call	_Z29__device_stub__Z7kernel1PjS_jPjS_j
	jmp	.L115
.L93:
	cmpl	$2, 12(%rsp)
	jne	.L96
	movq	%r13, 64(%rsp)
	movl	68(%rsp), %ecx
	xorl	%r9d, %r9d
	movq	%r13, 52(%rsp)
	movl	56(%rsp), %esi
	movl	%r12d, 60(%rsp)
	movq	60(%rsp), %rdx
	movl	%ebx, 48(%rsp)
	movq	48(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	movq	40(%rsp), %rsi
	testl	%eax, %eax
	jne	.L115
	movl	0(%rbp), %edx
	movq	32(%rsp), %rdi
	call	_Z29__device_stub__Z7kernel2PjS_jPjS_j
	jmp	.L115
.L96:
	cmpl	$3, 12(%rsp)
	jne	.L98
	movq	%r13, 64(%rsp)
	movl	68(%rsp), %ecx
	xorl	%r9d, %r9d
	movq	%r13, 52(%rsp)
	movl	56(%rsp), %esi
	movl	%r12d, 60(%rsp)
	movq	60(%rsp), %rdx
	movl	%ebx, 48(%rsp)
	movq	48(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	movq	40(%rsp), %rsi
	testl	%eax, %eax
	jne	.L115
	movl	0(%rbp), %edx
	movq	32(%rsp), %rdi
	call	_Z29__device_stub__Z7kernel3PjS_jPjS_j
	jmp	.L115
.L98:
	cmpl	$4, 12(%rsp)
	movq	%r13, 64(%rsp)
	movl	$0, %r9d
	movq	%r13, 52(%rsp)
	movl	68(%rsp), %ecx
	movl	%r12d, 60(%rsp)
	movl	56(%rsp), %esi
	movl	%ebx, 48(%rsp)
	movq	60(%rsp), %rdx
	movq	48(%rsp), %rdi
	jne	.L100
	call	__cudaPushCallConfiguration@PLT
	movq	40(%rsp), %rsi
	testl	%eax, %eax
	jne	.L102
	movl	0(%rbp), %edx
	movq	32(%rsp), %rdi
	call	_Z29__device_stub__Z7kernel4PjS_jPjS_j
	jmp	.L102
.L100:
	call	__cudaPushCallConfiguration@PLT
	movq	40(%rsp), %rsi
	testl	%eax, %eax
	jne	.L103
	movl	0(%rbp), %edx
	movq	32(%rsp), %rdi
	call	_Z29__device_stub__Z7kernel5PjS_jPjS_j
.L103:
	cmpl	$3, 12(%rsp)
	movl	%ebx, 0(%rbp)
	jle	.L95
.L102:
	shrl	%ebx
.L115:
	movl	%ebx, 0(%rbp)
.L95:
	movq	40(%rsp), %rax
	movq	%rax, 32(%rsp)
	jmp	.L90
.L118:
	call	_ZNSt6chrono3_V212steady_clock3nowEv@PLT
	movq	16(%rsp), %rdx
	movq	40(%rsp), %rsi
	movq	%r14, %rdi
	movl	$2, %ecx
	movq	%rax, %rbx
	call	cudaMemcpy@PLT
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	leaq	_ZSt4cout(%rip), %rbp
	leaq	.LC7(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	12(%rsp), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC8(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	24(%rsp), %rdx
	movq	%rax, %rdi
	movq	%rbx, %rax
	movl	$1000, %ecx
	subq	%rdx, %rax
	cqto
	idivq	%rcx
	movq	%rax, %rsi
	call	_ZNSo9_M_insertIlEERSoT_@PLT
	leaq	.LC9(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	%r15, %rsi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC10(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.LEHE3:
	leaq	96(%rsp), %rdi
	call	_ZNSt6vectorIjSaIjEED1Ev
	leaq	72(%rsp), %rdi
	call	_ZNSt6vectorIjSaIjEED1Ev
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L108
	jmp	.L113
.L112:
	endbr64
	movq	%rax, %rbx
.L105:
	leaq	96(%rsp), %rdi
	call	_ZNSt6vectorIjSaIjEED1Ev
	jmp	.L106
.L111:
	endbr64
	movq	%rax, %rbx
.L106:
	leaq	72(%rsp), %rdi
	call	_ZNSt6vectorIjSaIjEED1Ev
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L113
	movq	%rbx, %rdi
.LEHB4:
	call	_Unwind_Resume@PLT
.LEHE4:
.L113:
	call	__stack_chk_fail@PLT
.L108:
	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
.LFE4098:
	.section	.gcc_except_table,"a",@progbits
.LLSDA4098:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4098-.LLSDACSB4098
.LLSDACSB4098:
	.uleb128 .LEHB2-.LFB4098
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L111-.LFB4098
	.uleb128 0
	.uleb128 .LEHB3-.LFB4098
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L112-.LFB4098
	.uleb128 0
	.uleb128 .LEHB4-.LFB4098
	.uleb128 .LEHE4-.LEHB4
	.uleb128 0
	.uleb128 0
.LLSDACSE4098:
	.text
	.size	_Z10reduce_sumiRj, .-_Z10reduce_sumiRj
	.section	.rodata.str1.1
.LC11:
	.string	"sequential reduce took "
	.text
	.globl	_Z21reduce_sum_sequentialj
	.type	_Z21reduce_sum_sequentialj, @function
_Z21reduce_sum_sequentialj:
.LFB4111:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4111
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movl	%edi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	xorl	%ebx, %ebx
	subq	$48, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	xorl	%eax, %eax
	leaq	16(%rsp), %r12
	movq	%rax, 16(%rsp)
	movq	%rax, 24(%rsp)
	movq	%rax, 32(%rsp)
.L120:
	cmpq	%rbp, %rbx
	je	.L128
	movl	%ebx, %eax
	leaq	12(%rsp), %rsi
	movq	%r12, %rdi
	andl	$1, %eax
	movl	%eax, 12(%rsp)
.LEHB5:
	call	_ZNSt6vectorIjSaIjEE12emplace_backIJjEEERjDpOT_.isra.0
	incq	%rbx
	jmp	.L120
.L128:
	call	_ZNSt6chrono3_V212steady_clock3nowEv@PLT
	leaq	_ZSt4cout(%rip), %r13
	movq	%rax, %r14
	call	_ZNSt6chrono3_V212steady_clock3nowEv@PLT
	leaq	.LC11(%rip), %rsi
	movq	%r13, %rdi
	movq	%rax, %rbx
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	%rbx, %rax
	movl	$1000, %ecx
	subq	%r14, %rax
	cqto
	idivq	%rcx
	movq	%rax, %rsi
	call	_ZNSo9_M_insertIlEERSoT_@PLT
	leaq	.LC9(%rip), %rsi
	movq	%r13, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	%rbp, %rsi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC10(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.LEHE5:
	movq	%r12, %rdi
	call	_ZNSt6vectorIjSaIjEED1Ev
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L124
	jmp	.L126
.L125:
	endbr64
	movq	%rax, %rbx
.L122:
	movq	%r12, %rdi
	call	_ZNSt6vectorIjSaIjEED1Ev
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L126
	movq	%rbx, %rdi
.LEHB6:
	call	_Unwind_Resume@PLT
.LEHE6:
.L126:
	call	__stack_chk_fail@PLT
.L124:
	addq	$48, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4111:
	.section	.gcc_except_table
.LLSDA4111:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4111-.LLSDACSB4111
.LLSDACSB4111:
	.uleb128 .LEHB5-.LFB4111
	.uleb128 .LEHE5-.LEHB5
	.uleb128 .L125-.LFB4111
	.uleb128 0
	.uleb128 .LEHB6-.LFB4111
	.uleb128 .LEHE6-.LEHB6
	.uleb128 0
	.uleb128 0
.LLSDACSE4111:
	.text
	.size	_Z21reduce_sum_sequentialj, .-_Z21reduce_sum_sequentialj
	.section	.rodata.str1.1
.LC12:
	.string	"stoi"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB4112:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4112
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC12(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$48, %rsp
	.cfi_def_cfa_offset 96
	movq	8(%rsi), %rsi
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %r13
	leaq	8(%rsp), %rbx
	movq	%r13, %rdx
	movq	%rbx, %rdi
.LEHB7:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE7:
	movq	8(%rsp), %rdx
	xorl	%ecx, %ecx
	movq	%r14, %rsi
	movq	__isoc23_strtol@GOTPCREL(%rip), %rdi
	movl	$10, %r8d
.LEHB8:
	call	_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_
.LEHE8:
	movq	%rbx, %rdi
	movl	%eax, %ebp
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	16(%r12), %rsi
	leaq	3(%rsp), %rdx
	movq	%rbx, %rdi
.LEHB9:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE9:
	movq	8(%rsp), %rdx
	xorl	%ecx, %ecx
	movq	%r14, %rsi
	movq	__isoc23_strtol@GOTPCREL(%rip), %rdi
	movl	$10, %r8d
.LEHB10:
	call	_ZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_
.LEHE10:
	movq	%rbx, %rdi
	movl	%eax, 4(%rsp)
	movl	%eax, %r12d
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	testl	%ebp, %ebp
	jne	.L130
	movl	%r12d, %edi
.LEHB11:
	call	_Z21reduce_sum_sequentialj
	jmp	.L131
.L130:
	movq	%r13, %rsi
	movl	%ebp, %edi
	call	_Z10reduce_sumiRj
.L131:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L136
	jmp	.L139
.L137:
	endbr64
	jmp	.L142
.L138:
	endbr64
.L142:
	movq	%rax, %rbp
.L134:
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L139
	movq	%rbp, %rdi
	call	_Unwind_Resume@PLT
.LEHE11:
.L139:
	call	__stack_chk_fail@PLT
.L136:
	addq	$48, %rsp
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4112:
	.section	.gcc_except_table
.LLSDA4112:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4112-.LLSDACSB4112
.LLSDACSB4112:
	.uleb128 .LEHB7-.LFB4112
	.uleb128 .LEHE7-.LEHB7
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB8-.LFB4112
	.uleb128 .LEHE8-.LEHB8
	.uleb128 .L137-.LFB4112
	.uleb128 0
	.uleb128 .LEHB9-.LFB4112
	.uleb128 .LEHE9-.LEHB9
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB10-.LFB4112
	.uleb128 .LEHE10-.LEHB10
	.uleb128 .L138-.LFB4112
	.uleb128 0
	.uleb128 .LEHB11-.LFB4112
	.uleb128 .LEHE11-.LEHB11
	.uleb128 0
	.uleb128 0
.LLSDACSE4112:
	.section	.text.startup
	.size	main, .-main
	.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:


#include <hip/hip_runtime.h>
#include <iostream>
#include <vector>
#include <chrono>
#include <cassert>



/***
   first argument is the approach
0: sequential, 1: reduce1, 2: reduce2, 3: reduce3, 4: reduce4, 5:reduce5 
   second argument is the number of elements
***/


__device__ void warpReduce(volatile unsigned int* sdata, const unsigned int tid, const unsigned int elements){
    if(elements > 32)    sdata[tid] += sdata[tid + 32];
    if(elements > 16)    sdata[tid] += sdata[tid + 16];
    if(elements > 8)     sdata[tid] += sdata[tid + 8];
    if(elements > 4)     sdata[tid] += sdata[tid + 4];
    if(elements > 2)     sdata[tid] += sdata[tid + 2];
    if(elements > 1)     sdata[tid] += sdata[tid + 1];
}


__global__ void kernel5(unsigned int* d_in, unsigned int* d_out, const unsigned int elements){
    extern __shared__ unsigned int sdata[];

    unsigned int tid = threadIdx.x;
    unsigned int i = threadIdx.x + blockIdx.x * (blockDim.x * 2);

    sdata[tid] = 0;

    if(i < elements){
	 if(gridDim.x > 1)    sdata[tid] = d_in[i] + d_in[i + blockDim.x];
         else    sdata[tid] = d_in[i];
    }
    __syncthreads();

    for(unsigned int s = blockDim.x / 2; s > 32; s >>= 1){
        if(tid < s)    sdata[tid] += sdata[tid + s];
	__syncthreads();
    }

    if(tid < 32)    warpReduce(sdata, tid, elements);

    if(tid == 0)    d_out[blockIdx.x] = sdata[0];
}


__global__ void kernel4(unsigned int* d_in, unsigned int* d_out, const unsigned int elements){
    extern __shared__ unsigned int sdata[];

    unsigned int tid = threadIdx.x;
    unsigned int i = threadIdx.x + blockIdx.x * (blockDim.x * 2);

    sdata[tid] = 0;
    if(i < elements){
        if(gridDim.x > 1)    sdata[tid] = d_in[i] + d_in[i + blockDim.x];
        else    sdata[tid] = d_in[i];
    }
    __syncthreads();


    for(unsigned int s = blockDim.x / 2; s > 0; s >>= 1){
        if(tid < s)    sdata[tid] += sdata[tid + s];
	__syncthreads();
    }

    if(tid == 0)    d_out[blockIdx.x] = sdata[0];
}



__global__ void kernel3(unsigned int* d_in, unsigned int* d_out, const unsigned int elements){
    extern __shared__ unsigned int sdata[];

    unsigned int tid = threadIdx.x;
    unsigned int i = threadIdx.x + blockIdx.x * blockDim.x;

    sdata[tid] = (i < elements) ? d_in[i] : 0;
    __syncthreads();

    for(unsigned int s = blockDim.x / 2; s > 0; s >>= 1){
        if(tid < s)    sdata[tid] += sdata[tid + s];
	__syncthreads();

    }
    if(tid == 0)    d_out[blockIdx.x] = sdata[0];
}



__global__ void kernel2(unsigned int* d_in, unsigned int* d_out, const unsigned int elements){
    extern __shared__ unsigned int sdata[];

    unsigned int tid = threadIdx.x;
    unsigned int i = threadIdx.x + blockIdx.x * blockDim.x;


    sdata[tid] = (i < elements) ? d_in[i] : 0;
    __syncthreads();

    for(unsigned int s = 1; s < blockDim.x; s*=2){
	unsigned int index = 2 * s * tid;
        if(index < blockDim.x)    sdata[index] += sdata[index + s];
	__syncthreads();
    }

    if(tid == 0)    d_out[blockIdx.x] = sdata[0];
}


__global__ void kernel1(unsigned int* d_in, unsigned int* d_out, const unsigned int elements){
    extern __shared__ unsigned int sdata[];

    unsigned int tid = threadIdx.x;
    unsigned int i = threadIdx.x + blockIdx.x * blockDim.x;
    
    sdata[tid] = (i < elements) ? d_in[i] : 0;
    __syncthreads();

    for(unsigned int s = 1; (s < blockDim.x) && (tid+s) < elements; s*=2){
        if(tid % (2*s) == 0)    sdata[tid] += sdata[tid + s];
	__syncthreads();

    }

    if(tid == 0)    d_out[blockIdx.x] = sdata[0];
}



void reduce_sum(const int approach, unsigned int& elements){
    unsigned int numBlocks = 0;
    int numThreads = 1024;

    unsigned int originalElements = elements;

    unsigned int size = elements * sizeof(unsigned int);
    
    std::vector<unsigned int> h_in;
    std::vector<unsigned int> h_out(elements, 0);

    for(unsigned int i = 0; i < elements; ++i)    h_in.push_back(i%2);
    unsigned int gold_sum = elements/2;

    unsigned int* d_in;
    unsigned int* d_out;

    hipMalloc(&d_in, size);
    hipMalloc(&d_out, size);

    hipMemcpy(d_in, h_in.data(), size, hipMemcpyHostToDevice);
    
    auto start = std::chrono::steady_clock::now();
    while(elements > 1){
	if(elements < numThreads){
            numBlocks = 1;
	    numThreads = elements;
	}
	else    numBlocks = (elements - 1) / numThreads + 1;


        if(approach == 1)    
	    kernel1<<<numBlocks, numThreads, numThreads * sizeof(unsigned int)>>>(d_in, d_out, elements);
        else if(approach == 2)    
	    kernel2<<<numBlocks, numThreads, numThreads * sizeof(unsigned int)>>>(d_in, d_out, elements);
        else if(approach == 3)
            kernel3<<<numBlocks, numThreads, numThreads * sizeof(unsigned int)>>>(d_in, d_out, elements);
        else if(approach == 4)
	    kernel4<<<numBlocks, numThreads, numThreads * sizeof(unsigned int)>>>(d_in, d_out, elements);
	else
	    kernel5<<<numBlocks, numThreads, numThreads * sizeof(unsigned int)>>>(d_in, d_out, elements);
	
        elements = numBlocks;

        if(approach >= 4)    elements = elements / 2;
	
	d_in = d_out;
    }	
    auto end = std::chrono::steady_clock::now();
    
    hipMemcpy(h_out.data(), d_out, size, hipMemcpyDeviceToHost);

    hipFree(d_in);
    hipFree(d_out);
    
    assert(h_out[0] == gold_sum);

    std::cout << "reduce " << approach << " took " << std::chrono::duration_cast<std::chrono::microseconds>(end-start).count();
    std::cout << " ms to sum " << originalElements << " elements\n"; 
}



void reduce_sum_sequential(const unsigned int elements){
    std::vector<unsigned int> h_in;
    
    unsigned int gold_sum, sequential_sum;

    for(unsigned int i = 0; i < elements; ++i)    h_in.push_back(i%2);
    gold_sum = elements / 2;
    
    auto start = std::chrono::steady_clock::now();
    for(auto i : h_in)    sequential_sum += i;
    auto end = std::chrono::steady_clock::now();
    
    assert(gold_sum == sequential_sum);

    std::cout << "sequential reduce took " << std::chrono::duration_cast<std::chrono::microseconds>(end-start).count();
    std::cout << " ms to sum " << elements << " elements\n"; 
}



int main(int argc, char* argv[]){ 
    int approach = std::stoi(argv[1]);
    unsigned int elements = std::stoi(argv[2]);
    
    if(approach == 0)    reduce_sum_sequential(elements);
    else    reduce_sum(approach, elements);



    return 0;
}


	.text
	.file	"reduce_five_approaches.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z22__device_stub__kernel5PjS_j # -- Begin function _Z22__device_stub__kernel5PjS_j
	.type	_Z22__device_stub__kernel5PjS_j,@function
_Z22__device_stub__kernel5PjS_j:        # @_Z22__device_stub__kernel5PjS_j
	.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	$_Z7kernel5PjS_j, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z22__device_stub__kernel5PjS_j, .Lfunc_end0-_Z22__device_stub__kernel5PjS_j
	.cfi_endproc
                                        # -- End function
	.globl	_Z22__device_stub__kernel4PjS_j # -- Begin function _Z22__device_stub__kernel4PjS_j
	.type	_Z22__device_stub__kernel4PjS_j,@function
_Z22__device_stub__kernel4PjS_j:        # @_Z22__device_stub__kernel4PjS_j
	.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	$_Z7kernel4PjS_j, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z22__device_stub__kernel4PjS_j, .Lfunc_end1-_Z22__device_stub__kernel4PjS_j
	.cfi_endproc
                                        # -- End function
	.globl	_Z22__device_stub__kernel3PjS_j # -- Begin function _Z22__device_stub__kernel3PjS_j
	.type	_Z22__device_stub__kernel3PjS_j,@function
_Z22__device_stub__kernel3PjS_j:        # @_Z22__device_stub__kernel3PjS_j
	.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	$_Z7kernel3PjS_j, %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	_Z22__device_stub__kernel3PjS_j, .Lfunc_end2-_Z22__device_stub__kernel3PjS_j
	.cfi_endproc
                                        # -- End function
	.globl	_Z22__device_stub__kernel2PjS_j # -- Begin function _Z22__device_stub__kernel2PjS_j
	.type	_Z22__device_stub__kernel2PjS_j,@function
_Z22__device_stub__kernel2PjS_j:        # @_Z22__device_stub__kernel2PjS_j
	.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	$_Z7kernel2PjS_j, %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	_Z22__device_stub__kernel2PjS_j, .Lfunc_end3-_Z22__device_stub__kernel2PjS_j
	.cfi_endproc
                                        # -- End function
	.globl	_Z22__device_stub__kernel1PjS_j # -- Begin function _Z22__device_stub__kernel1PjS_j
	.type	_Z22__device_stub__kernel1PjS_j,@function
_Z22__device_stub__kernel1PjS_j:        # @_Z22__device_stub__kernel1PjS_j
	.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	$_Z7kernel1PjS_j, %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	_Z22__device_stub__kernel1PjS_j, .Lfunc_end4-_Z22__device_stub__kernel1PjS_j
	.cfi_endproc
                                        # -- End function
	.globl	_Z10reduce_sumiRj               # -- Begin function _Z10reduce_sumiRj
	.type	_Z10reduce_sumiRj,@function
_Z10reduce_sumiRj:                      # @_Z10reduce_sumiRj
.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	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	.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, %r15
                                        # kill: def $edi killed $edi def $rdi
	movq	%rdi, 48(%rsp)                  # 8-byte Spill
	movl	(%rsi), %r14d
	xorps	%xmm0, %xmm0
	movaps	%xmm0, 16(%rsp)
	movq	$0, 32(%rsp)
	movq	%rsp, %rdx
	movl	$0, (%rdx)
.Ltmp0:
	leaq	80(%rsp), %rdi
	leaq	8(%rsp), %rcx
	movq	%r14, %rsi
	callq	_ZNSt6vectorIjSaIjEEC2EmRKjRKS0_
.Ltmp1:
# %bb.1:
	cmpl	$0, (%r15)
	je	.LBB5_7
# %bb.2:                                # %.lr.ph
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r12
	movq	%rsp, %r13
.LBB5_3:                                # =>This Inner Loop Header: Depth=1
	movl	%ebx, %eax
	andl	$1, %eax
	movl	%eax, (%rsp)
	movq	24(%rsp), %rsi
	cmpq	32(%rsp), %rsi
	je	.LBB5_5
# %bb.4:                                #   in Loop: Header=BB5_3 Depth=1
	movl	%eax, (%rsi)
	addq	$4, %rsi
	movq	%rsi, 24(%rsp)
	jmp	.LBB5_6
.LBB5_5:                                #   in Loop: Header=BB5_3 Depth=1
.Ltmp3:
	movq	%r12, %rdi
	movq	%r13, %rdx
	callq	_ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_
.Ltmp4:
.LBB5_6:                                # %_ZNSt6vectorIjSaIjEE9push_backEOj.exit
                                        #   in Loop: Header=BB5_3 Depth=1
	incl	%ebx
	cmpl	(%r15), %ebx
	jb	.LBB5_3
.LBB5_7:                                # %._crit_edge
	movq	%r14, 72(%rsp)                  # 8-byte Spill
	leal	(,%r14,4), %eax
	movl	%eax, %ebx
.Ltmp6:
	movq	%rsp, %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
.Ltmp7:
# %bb.8:                                # %_ZL9hipMallocIjE10hipError_tPPT_m.exit
.Ltmp8:
	leaq	8(%rsp), %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
.Ltmp9:
# %bb.9:                                # %_ZL9hipMallocIjE10hipError_tPPT_m.exit91
	movq	(%rsp), %rdi
	movq	16(%rsp), %rsi
.Ltmp10:
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp11:
# %bb.10:
	movq	%rbx, 64(%rsp)                  # 8-byte Spill
	callq	_ZNSt6chrono3_V212steady_clock3nowEv
	movq	%rax, 56(%rsp)                  # 8-byte Spill
	movl	(%r15), %ebp
	cmpl	$2, %ebp
	jb	.LBB5_35
# %bb.11:                               # %.lr.ph141
	movabsq	$4294967296, %r14               # imm = 0x100000000
	movq	48(%rsp), %rax                  # 8-byte Reload
	cmpl	$4, %eax
	setge	%r12b
	movl	$1024, %ebx                     # imm = 0x400
	leal	-1(%rax), %r13d
.LBB5_12:                               # =>This Inner Loop Header: Depth=1
	cmpl	%ebx, %ebp
	jae	.LBB5_15
# %bb.13:                               #   in Loop: Header=BB5_12 Depth=1
	movl	%ebp, %ebx
	movl	$1, %ebp
	jmp	.LBB5_16
.LBB5_15:                               #   in Loop: Header=BB5_12 Depth=1
	decl	%ebp
	movl	%ebp, %eax
	xorl	%edx, %edx
	divl	%ebx
	movl	%eax, %ebp
	incl	%ebp
.LBB5_16:                               #   in Loop: Header=BB5_12 Depth=1
	movl	%ebx, %edx
	leaq	(,%rdx,4), %r8
	movl	%ebp, %edi
	orq	%r14, %rdi
	orq	%r14, %rdx
	cmpl	$3, %r13d
	ja	.LBB5_31
# %bb.17:                               #   in Loop: Header=BB5_12 Depth=1
	jmpq	*.LJTI5_0(,%r13,8)
.LBB5_18:                               #   in Loop: Header=BB5_12 Depth=1
.Ltmp25:
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp26:
# %bb.19:                               #   in Loop: Header=BB5_12 Depth=1
	testl	%eax, %eax
	jne	.LBB5_34
# %bb.20:                               #   in Loop: Header=BB5_12 Depth=1
	movq	(%rsp), %rdi
	movq	8(%rsp), %rsi
	movl	(%r15), %edx
.Ltmp27:
	callq	_Z22__device_stub__kernel1PjS_j
.Ltmp28:
	jmp	.LBB5_34
.LBB5_25:                               #   in Loop: Header=BB5_12 Depth=1
.Ltmp17:
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp18:
# %bb.26:                               #   in Loop: Header=BB5_12 Depth=1
	testl	%eax, %eax
	jne	.LBB5_34
# %bb.27:                               #   in Loop: Header=BB5_12 Depth=1
	movq	(%rsp), %rdi
	movq	8(%rsp), %rsi
	movl	(%r15), %edx
.Ltmp19:
	callq	_Z22__device_stub__kernel3PjS_j
.Ltmp20:
	jmp	.LBB5_34
.LBB5_28:                               #   in Loop: Header=BB5_12 Depth=1
.Ltmp13:
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp14:
# %bb.29:                               #   in Loop: Header=BB5_12 Depth=1
	testl	%eax, %eax
	jne	.LBB5_34
# %bb.30:                               #   in Loop: Header=BB5_12 Depth=1
	movq	(%rsp), %rdi
	movq	8(%rsp), %rsi
	movl	(%r15), %edx
.Ltmp15:
	callq	_Z22__device_stub__kernel4PjS_j
.Ltmp16:
	jmp	.LBB5_34
.LBB5_22:                               #   in Loop: Header=BB5_12 Depth=1
.Ltmp21:
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp22:
# %bb.23:                               #   in Loop: Header=BB5_12 Depth=1
	testl	%eax, %eax
	jne	.LBB5_34
# %bb.24:                               #   in Loop: Header=BB5_12 Depth=1
	movq	(%rsp), %rdi
	movq	8(%rsp), %rsi
	movl	(%r15), %edx
.Ltmp23:
	callq	_Z22__device_stub__kernel2PjS_j
.Ltmp24:
	jmp	.LBB5_34
.LBB5_31:                               #   in Loop: Header=BB5_12 Depth=1
.Ltmp29:
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp30:
# %bb.32:                               #   in Loop: Header=BB5_12 Depth=1
	testl	%eax, %eax
	jne	.LBB5_34
# %bb.33:                               #   in Loop: Header=BB5_12 Depth=1
	movq	(%rsp), %rdi
	movq	8(%rsp), %rsi
	movl	(%r15), %edx
.Ltmp31:
	callq	_Z22__device_stub__kernel5PjS_j
.Ltmp32:
.LBB5_34:                               #   in Loop: Header=BB5_12 Depth=1
	movl	%r12d, %ecx
	shrl	%cl, %ebp
	movl	%ebp, (%r15)
	movq	8(%rsp), %rax
	movq	%rax, (%rsp)
	cmpl	$1, %ebp
	ja	.LBB5_12
.LBB5_35:                               # %._crit_edge142
	callq	_ZNSt6chrono3_V212steady_clock3nowEv
	movq	%rax, %r15
	movq	80(%rsp), %rdi
	movq	8(%rsp), %rsi
.Ltmp34:
	movq	64(%rsp), %rdx                  # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp35:
	movq	72(%rsp), %rbx                  # 8-byte Reload
# %bb.36:
	movq	(%rsp), %rdi
.Ltmp36:
	callq	hipFree
.Ltmp37:
# %bb.37:
	movq	8(%rsp), %rdi
.Ltmp38:
	callq	hipFree
.Ltmp39:
# %bb.38:
.Ltmp40:
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$7, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp41:
# %bb.39:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
.Ltmp42:
	movl	$_ZSt4cout, %edi
	movq	48(%rsp), %rsi                  # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	callq	_ZNSolsEi
.Ltmp43:
# %bb.40:
.Ltmp44:
	movq	%rax, %r14
	movl	$.L.str.1, %esi
	movl	$6, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp45:
# %bb.41:
	subq	56(%rsp), %r15                  # 8-byte Folded Reload
	movabsq	$2361183241434822607, %rcx      # imm = 0x20C49BA5E353F7CF
	movq	%r15, %rax
	imulq	%rcx
	movq	%rdx, %rsi
	shrq	$63, %rsi
	sarq	$7, %rdx
	addq	%rdx, %rsi
.Ltmp46:
	movq	%r14, %rdi
	callq	_ZNSo9_M_insertIlEERSoT_
.Ltmp47:
# %bb.42:                               # %_ZNSolsEl.exit
.Ltmp49:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$11, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp50:
# %bb.43:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit97
.Ltmp51:
	movl	$_ZSt4cout, %edi
	movq	%rbx, %rsi
	callq	_ZNSo9_M_insertImEERSoT_
.Ltmp52:
# %bb.44:                               # %_ZNSolsEj.exit
.Ltmp53:
	movl	$.L.str.3, %esi
	movl	$10, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp54:
# %bb.45:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit100
	movq	80(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB5_47
# %bb.46:
	callq	_ZdlPv
.LBB5_47:                               # %_ZNSt6vectorIjSaIjEED2Ev.exit
	movq	16(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB5_49
# %bb.48:
	callq	_ZdlPv
.LBB5_49:                               # %_ZNSt6vectorIjSaIjEED2Ev.exit102
	addq	$104, %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_51:
	.cfi_def_cfa_offset 160
.Ltmp48:
	jmp	.LBB5_52
.LBB5_57:
.Ltmp2:
	movq	%rax, %rbx
	jmp	.LBB5_54
.LBB5_14:
.Ltmp12:
	jmp	.LBB5_52
.LBB5_58:
.Ltmp5:
	jmp	.LBB5_52
.LBB5_50:
.Ltmp55:
	jmp	.LBB5_52
.LBB5_21:
.Ltmp33:
.LBB5_52:
	movq	%rax, %rbx
	movq	80(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB5_54
# %bb.53:
	callq	_ZdlPv
.LBB5_54:                               # %_ZNSt6vectorIjSaIjEED2Ev.exit104
	movq	16(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB5_56
# %bb.55:
	callq	_ZdlPv
.LBB5_56:                               # %_ZNSt6vectorIjSaIjEED2Ev.exit106
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end5:
	.size	_Z10reduce_sumiRj, .Lfunc_end5-_Z10reduce_sumiRj
	.cfi_endproc
	.section	.rodata,"a",@progbits
	.p2align	3, 0x0
.LJTI5_0:
	.quad	.LBB5_18
	.quad	.LBB5_22
	.quad	.LBB5_25
	.quad	.LBB5_28
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table5:
.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 .Ltmp0-.Lfunc_begin0           # >> Call Site 1 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp2-.Lfunc_begin0           #     jumps to .Ltmp2
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp3-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp4-.Ltmp3                  #   Call between .Ltmp3 and .Ltmp4
	.uleb128 .Ltmp5-.Lfunc_begin0           #     jumps to .Ltmp5
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp6-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp11-.Ltmp6                 #   Call between .Ltmp6 and .Ltmp11
	.uleb128 .Ltmp12-.Lfunc_begin0          #     jumps to .Ltmp12
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp25-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Ltmp32-.Ltmp25                #   Call between .Ltmp25 and .Ltmp32
	.uleb128 .Ltmp33-.Lfunc_begin0          #     jumps to .Ltmp33
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp34-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp45-.Ltmp34                #   Call between .Ltmp34 and .Ltmp45
	.uleb128 .Ltmp55-.Lfunc_begin0          #     jumps to .Ltmp55
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp46-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp47-.Ltmp46                #   Call between .Ltmp46 and .Ltmp47
	.uleb128 .Ltmp48-.Lfunc_begin0          #     jumps to .Ltmp48
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp49-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp54-.Ltmp49                #   Call between .Ltmp49 and .Ltmp54
	.uleb128 .Ltmp55-.Lfunc_begin0          #     jumps to .Ltmp55
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp54-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Lfunc_end5-.Ltmp54            #   Call between .Ltmp54 and .Lfunc_end5
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt6vectorIjSaIjEEC2EmRKjRKS0_,"axG",@progbits,_ZNSt6vectorIjSaIjEEC2EmRKjRKS0_,comdat
	.weak	_ZNSt6vectorIjSaIjEEC2EmRKjRKS0_ # -- Begin function _ZNSt6vectorIjSaIjEEC2EmRKjRKS0_
	.p2align	1, 0x90
	.type	_ZNSt6vectorIjSaIjEEC2EmRKjRKS0_,@function
_ZNSt6vectorIjSaIjEEC2EmRKjRKS0_:       # @_ZNSt6vectorIjSaIjEEC2EmRKjRKS0_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rsi, %rax
	shrq	$61, %rax
	jne	.LBB6_6
# %bb.1:                                # %_ZNSt6vectorIjSaIjEE17_S_check_init_lenEmRKS0_.exit
	movq	%rsi, %r14
	movq	%rdi, %rbx
	xorps	%xmm0, %xmm0
	movups	%xmm0, (%rdi)
	movq	$0, 16(%rdi)
	testq	%rsi, %rsi
	je	.LBB6_2
# %bb.3:
	movq	%rdx, %r15
	xorl	%r12d, %r12d
	movq	%rbx, %rdi
	movq	%r14, %rsi
	xorl	%edx, %edx
	callq	_ZNSt15__new_allocatorIjE8allocateEmPKv
	movq	%rax, (%rbx)
	leaq	(%rax,%r14,4), %rcx
	movq	%rcx, 16(%rbx)
	movl	(%r15), %edx
	shlq	$2, %r14
.LBB6_4:                                # %.lr.ph.i.i.i.i.i.i.i.i
                                        # =>This Inner Loop Header: Depth=1
	movl	%edx, (%rax,%r12)
	addq	$4, %r12
	cmpq	%r12, %r14
	jne	.LBB6_4
	jmp	.LBB6_5
.LBB6_2:                                # %_ZNSt12_Vector_baseIjSaIjEEC2EmRKS0_.exit.thread
	movups	%xmm0, (%rbx)
	movq	$0, 16(%rbx)
	xorl	%ecx, %ecx
.LBB6_5:                                # %.loopexit
	movq	%rcx, 8(%rbx)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.LBB6_6:
	.cfi_def_cfa_offset 48
	movl	$.L.str.6, %edi
	callq	_ZSt20__throw_length_errorPKc
.Lfunc_end6:
	.size	_ZNSt6vectorIjSaIjEEC2EmRKjRKS0_, .Lfunc_end6-_ZNSt6vectorIjSaIjEEC2EmRKjRKS0_
	.cfi_endproc
                                        # -- End function
	.text
	.globl	_Z21reduce_sum_sequentialj      # -- Begin function _Z21reduce_sum_sequentialj
	.type	_Z21reduce_sum_sequentialj,@function
_Z21reduce_sum_sequentialj:             # @_Z21reduce_sum_sequentialj
.Lfunc_begin1:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception1
# %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	$40, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edi, %ebx
	xorps	%xmm0, %xmm0
	movaps	%xmm0, 16(%rsp)
	movq	$0, 32(%rsp)
	testl	%edi, %edi
	je	.LBB7_6
# %bb.1:                                # %.lr.ph
	xorl	%ebp, %ebp
	leaq	16(%rsp), %r14
	leaq	12(%rsp), %r15
.LBB7_2:                                # =>This Inner Loop Header: Depth=1
	movl	%ebp, %eax
	andl	$1, %eax
	movl	%eax, 12(%rsp)
	movq	24(%rsp), %rsi
	cmpq	32(%rsp), %rsi
	je	.LBB7_4
# %bb.3:                                #   in Loop: Header=BB7_2 Depth=1
	movl	%eax, (%rsi)
	addq	$4, %rsi
	movq	%rsi, 24(%rsp)
	jmp	.LBB7_5
.LBB7_4:                                #   in Loop: Header=BB7_2 Depth=1
.Ltmp56:
	movq	%r14, %rdi
	movq	%r15, %rdx
	callq	_ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_
.Ltmp57:
.LBB7_5:                                # %_ZNSt6vectorIjSaIjEE9push_backEOj.exit
                                        #   in Loop: Header=BB7_2 Depth=1
	incl	%ebp
	cmpl	%ebp, %ebx
	jne	.LBB7_2
.LBB7_6:                                # %._crit_edge
	callq	_ZNSt6chrono3_V212steady_clock3nowEv
	movq	%rax, %r14
	callq	_ZNSt6chrono3_V212steady_clock3nowEv
	movq	%rax, %r15
.Ltmp59:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.4, %esi
	movl	$23, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp60:
# %bb.7:
	subq	%r14, %r15
	movabsq	$2361183241434822607, %rcx      # imm = 0x20C49BA5E353F7CF
	movq	%r15, %rax
	imulq	%rcx
	movq	%rdx, %rsi
	shrq	$63, %rsi
	sarq	$7, %rdx
	addq	%rdx, %rsi
.Ltmp61:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIlEERSoT_
.Ltmp62:
# %bb.8:                                # %_ZNSolsEl.exit
.Ltmp64:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$11, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp65:
# %bb.9:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit22
	movl	%ebx, %esi
.Ltmp66:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertImEERSoT_
.Ltmp67:
# %bb.10:                               # %_ZNSolsEj.exit
.Ltmp68:
	movl	$.L.str.3, %esi
	movl	$10, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp69:
# %bb.11:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit25
	movq	16(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB7_13
# %bb.12:
	callq	_ZdlPv
.LBB7_13:                               # %_ZNSt6vectorIjSaIjEED2Ev.exit
	addq	$40, %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
.LBB7_15:
	.cfi_def_cfa_offset 80
.Ltmp63:
	jmp	.LBB7_16
.LBB7_14:
.Ltmp70:
	jmp	.LBB7_16
.LBB7_19:
.Ltmp58:
.LBB7_16:
	movq	%rax, %rbx
	movq	16(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB7_18
# %bb.17:
	callq	_ZdlPv
.LBB7_18:                               # %_ZNSt6vectorIjSaIjEED2Ev.exit27
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end7:
	.size	_Z21reduce_sum_sequentialj, .Lfunc_end7-_Z21reduce_sum_sequentialj
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table7:
.Lexception1:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end1-.Lcst_begin1
.Lcst_begin1:
	.uleb128 .Ltmp56-.Lfunc_begin1          # >> Call Site 1 <<
	.uleb128 .Ltmp57-.Ltmp56                #   Call between .Ltmp56 and .Ltmp57
	.uleb128 .Ltmp58-.Lfunc_begin1          #     jumps to .Ltmp58
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp59-.Lfunc_begin1          # >> Call Site 2 <<
	.uleb128 .Ltmp60-.Ltmp59                #   Call between .Ltmp59 and .Ltmp60
	.uleb128 .Ltmp70-.Lfunc_begin1          #     jumps to .Ltmp70
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp61-.Lfunc_begin1          # >> Call Site 3 <<
	.uleb128 .Ltmp62-.Ltmp61                #   Call between .Ltmp61 and .Ltmp62
	.uleb128 .Ltmp63-.Lfunc_begin1          #     jumps to .Ltmp63
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp64-.Lfunc_begin1          # >> Call Site 4 <<
	.uleb128 .Ltmp69-.Ltmp64                #   Call between .Ltmp64 and .Ltmp69
	.uleb128 .Ltmp70-.Lfunc_begin1          #     jumps to .Ltmp70
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp69-.Lfunc_begin1          # >> Call Site 5 <<
	.uleb128 .Lfunc_end7-.Ltmp69            #   Call between .Ltmp69 and .Lfunc_end7
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end1:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
.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	$56, %rsp
	.cfi_def_cfa_offset 112
	.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, %r15
	movq	8(%rsi), %rsi
.Ltmp71:
	leaq	16(%rsp), %rdi
	leaq	12(%rsp), %rdx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
.Ltmp72:
# %bb.1:
	movq	16(%rsp), %r12
	callq	__errno_location
	movq	%rax, %rbx
	movl	(%rax), %ebp
	movl	$0, (%rax)
	leaq	48(%rsp), %r13
	movq	%r12, %rdi
	movq	%r13, %rsi
	movl	$10, %edx
	callq	__isoc23_strtol
	cmpq	%r12, (%r13)
	je	.LBB8_2
# %bb.8:
	movq	%rax, %r14
	movslq	%r14d, %rax
	cmpq	%r14, %rax
	jne	.LBB8_10
# %bb.9:
	movl	(%rbx), %eax
	cmpl	$34, %eax
	je	.LBB8_10
# %bb.12:
	testl	%eax, %eax
	jne	.LBB8_14
# %bb.13:
	movl	%ebp, (%rbx)
.LBB8_14:
	leaq	32(%rsp), %rbp
	movq	-16(%rbp), %rdi
	cmpq	%rbp, %rdi
	je	.LBB8_16
# %bb.15:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB8_16:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	movq	16(%r15), %rsi
.Ltmp74:
	leaq	16(%rsp), %rdi
	leaq	7(%rsp), %rdx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
.Ltmp75:
# %bb.17:
	movq	16(%rsp), %r12
	movl	(%rbx), %eax
	movl	%eax, 8(%rsp)                   # 4-byte Spill
	movl	$0, (%rbx)
	leaq	48(%rsp), %r13
	movq	%r12, %rdi
	movq	%r13, %rsi
	movl	$10, %edx
	callq	__isoc23_strtol
	cmpq	%r12, (%r13)
	je	.LBB8_18
# %bb.23:
	movq	%rax, %r15
	movabsq	$-4294967296, %rax              # imm = 0xFFFFFFFF00000000
	leaq	-2147483648(%r15), %rcx
	cmpq	%rax, %rcx
	jb	.LBB8_25
# %bb.24:
	movl	(%rbx), %eax
	cmpl	$34, %eax
	je	.LBB8_25
# %bb.27:
	testl	%eax, %eax
	jne	.LBB8_29
# %bb.28:
	movl	8(%rsp), %eax                   # 4-byte Reload
	movl	%eax, (%rbx)
.LBB8_29:
	movq	16(%rsp), %rdi
	cmpq	%rbp, %rdi
	je	.LBB8_31
# %bb.30:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i19
	callq	_ZdlPv
.LBB8_31:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit21
	movl	%r15d, 12(%rsp)
	testl	%r14d, %r14d
	je	.LBB8_32
# %bb.37:
	leaq	12(%rsp), %rsi
	movl	%r14d, %edi
	callq	_Z10reduce_sumiRj
	jmp	.LBB8_38
.LBB8_32:
	movl	%r15d, %edi
	callq	_Z21reduce_sum_sequentialj
.LBB8_38:
	xorl	%eax, %eax
	addq	$56, %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
.LBB8_2:
	.cfi_def_cfa_offset 112
.Ltmp84:
	movl	$.L.str.5, %edi
	callq	_ZSt24__throw_invalid_argumentPKc
.Ltmp85:
# %bb.3:
.LBB8_10:                               # %.critedge.i.i
.Ltmp82:
	movl	$.L.str.5, %edi
	callq	_ZSt20__throw_out_of_rangePKc
.Ltmp83:
# %bb.11:
.LBB8_18:
.Ltmp79:
	movl	$.L.str.5, %edi
	callq	_ZSt24__throw_invalid_argumentPKc
.Ltmp80:
# %bb.19:
.LBB8_25:                               # %.critedge.i.i14
.Ltmp77:
	movl	$.L.str.5, %edi
	callq	_ZSt20__throw_out_of_rangePKc
.Ltmp78:
# %bb.26:
.LBB8_36:
.Ltmp76:
	jmp	.LBB8_34
.LBB8_33:
.Ltmp73:
.LBB8_34:
	movq	%rax, %r14
	jmp	.LBB8_35
.LBB8_20:
.Ltmp81:
	movq	%rax, %r14
	cmpl	$0, (%rbx)
	jne	.LBB8_22
# %bb.21:
	movl	8(%rsp), %eax                   # 4-byte Reload
	movl	%eax, (%rbx)
.LBB8_22:                               # %_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev.exit.i.i15
	movq	16(%rsp), %rdi
	cmpq	%rbp, %rdi
	jne	.LBB8_7
	jmp	.LBB8_35
.LBB8_4:
.Ltmp86:
	movq	%rax, %r14
	cmpl	$0, (%rbx)
	jne	.LBB8_6
# %bb.5:
	movl	%ebp, (%rbx)
.LBB8_6:                                # %_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev.exit.i.i
	leaq	32(%rsp), %rax
	movq	-16(%rax), %rdi
	cmpq	%rax, %rdi
	je	.LBB8_35
.LBB8_7:                                # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i22
	callq	_ZdlPv
.LBB8_35:
	movq	%r14, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end8:
	.size	main, .Lfunc_end8-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table8:
.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 .Ltmp71-.Lfunc_begin2          # >> Call Site 1 <<
	.uleb128 .Ltmp72-.Ltmp71                #   Call between .Ltmp71 and .Ltmp72
	.uleb128 .Ltmp73-.Lfunc_begin2          #     jumps to .Ltmp73
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp74-.Lfunc_begin2          # >> Call Site 2 <<
	.uleb128 .Ltmp75-.Ltmp74                #   Call between .Ltmp74 and .Ltmp75
	.uleb128 .Ltmp76-.Lfunc_begin2          #     jumps to .Ltmp76
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp75-.Lfunc_begin2          # >> Call Site 3 <<
	.uleb128 .Ltmp84-.Ltmp75                #   Call between .Ltmp75 and .Ltmp84
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp84-.Lfunc_begin2          # >> Call Site 4 <<
	.uleb128 .Ltmp83-.Ltmp84                #   Call between .Ltmp84 and .Ltmp83
	.uleb128 .Ltmp86-.Lfunc_begin2          #     jumps to .Ltmp86
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp79-.Lfunc_begin2          # >> Call Site 5 <<
	.uleb128 .Ltmp78-.Ltmp79                #   Call between .Ltmp79 and .Ltmp78
	.uleb128 .Ltmp81-.Lfunc_begin2          #     jumps to .Ltmp81
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp78-.Lfunc_begin2          # >> Call Site 6 <<
	.uleb128 .Lfunc_end8-.Ltmp78            #   Call between .Ltmp78 and .Lfunc_end8
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end2:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_ # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	leaq	16(%rdi), %rax
	movq	%rax, (%rdi)
	testq	%rsi, %rsi
	je	.LBB9_1
# %bb.2:
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	%rsi, %rdi
	callq	strlen
	leaq	(%rax,%rbx), %rdx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # TAILCALL
.LBB9_1:
	.cfi_def_cfa_offset 32
	movl	$.L.str.8, %edi
	callq	_ZSt19__throw_logic_errorPKc
.Lfunc_end9:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, .Lfunc_end9-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt15__new_allocatorIjE8allocateEmPKv,"axG",@progbits,_ZNSt15__new_allocatorIjE8allocateEmPKv,comdat
	.weak	_ZNSt15__new_allocatorIjE8allocateEmPKv # -- Begin function _ZNSt15__new_allocatorIjE8allocateEmPKv
	.p2align	1, 0x90
	.type	_ZNSt15__new_allocatorIjE8allocateEmPKv,@function
_ZNSt15__new_allocatorIjE8allocateEmPKv: # @_ZNSt15__new_allocatorIjE8allocateEmPKv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rsi, %rax
	shrq	$61, %rax
	jne	.LBB10_1
# %bb.3:
	shlq	$2, %rsi
	movq	%rsi, %rdi
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	_Znwm                           # TAILCALL
.LBB10_1:
	.cfi_def_cfa_offset 16
	shrq	$62, %rsi
	je	.LBB10_2
# %bb.4:
	callq	_ZSt28__throw_bad_array_new_lengthv
.LBB10_2:
	callq	_ZSt17__throw_bad_allocv
.Lfunc_end10:
	.size	_ZNSt15__new_allocatorIjE8allocateEmPKv, .Lfunc_end10-_ZNSt15__new_allocatorIjE8allocateEmPKv
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_,"axG",@progbits,_ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_,comdat
	.weak	_ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_ # -- Begin function _ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_
	.p2align	1, 0x90
	.type	_ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_,@function
_ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_: # @_ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdx, (%rsp)                    # 8-byte Spill
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movl	$1, %esi
	movl	$.L.str.7, %edx
	callq	_ZNKSt6vectorIjSaIjEE12_M_check_lenEmPKc
	movq	(%rbx), %r13
	movq	8(%rbx), %r15
	movq	%r12, 8(%rsp)                   # 8-byte Spill
	subq	%r13, %r12
	movq	%r12, %r14
	sarq	$2, %r14
	testq	%rax, %rax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	je	.LBB11_1
# %bb.2:
	movq	%rbx, %rdi
	movq	%rax, %rsi
	xorl	%edx, %edx
	callq	_ZNSt15__new_allocatorIjE8allocateEmPKv
	movq	%rax, %rbp
	jmp	.LBB11_3
.LBB11_1:
	xorl	%ebp, %ebp
.LBB11_3:                               # %_ZNSt12_Vector_baseIjSaIjEE11_M_allocateEm.exit
	movq	(%rsp), %rax                    # 8-byte Reload
	movl	(%rax), %eax
	movl	%eax, (%rbp,%r14,4)
	testq	%r12, %r12
	jle	.LBB11_5
# %bb.4:
	movq	%rbp, %rdi
	movq	%r13, %rsi
	movq	%r12, %rdx
	callq	memmove@PLT
.LBB11_5:                               # %_ZNSt6vectorIjSaIjEE11_S_relocateEPjS2_S2_RS0_.exit
	addq	%rbp, %r12
	addq	$4, %r12
	movq	8(%rsp), %rsi                   # 8-byte Reload
	subq	%rsi, %r15
	testq	%r15, %r15
	jle	.LBB11_7
# %bb.6:
	movq	%r12, %rdi
	movq	%r15, %rdx
	callq	memmove@PLT
.LBB11_7:                               # %_ZNSt6vectorIjSaIjEE11_S_relocateEPjS2_S2_RS0_.exit16
	testq	%r13, %r13
	je	.LBB11_9
# %bb.8:
	movq	%r13, %rdi
	callq	_ZdlPv
.LBB11_9:                               # %_ZNSt12_Vector_baseIjSaIjEE13_M_deallocateEPjm.exit
	addq	%r15, %r12
	movq	%rbp, (%rbx)
	movq	%r12, 8(%rbx)
	movq	16(%rsp), %rax                  # 8-byte Reload
	leaq	(,%rax,4), %rax
	addq	%rbp, %rax
	movq	%rax, 16(%rbx)
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end11:
	.size	_ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_, .Lfunc_end11-_ZNSt6vectorIjSaIjEE17_M_realloc_insertIJjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNKSt6vectorIjSaIjEE12_M_check_lenEmPKc,"axG",@progbits,_ZNKSt6vectorIjSaIjEE12_M_check_lenEmPKc,comdat
	.weak	_ZNKSt6vectorIjSaIjEE12_M_check_lenEmPKc # -- Begin function _ZNKSt6vectorIjSaIjEE12_M_check_lenEmPKc
	.p2align	1, 0x90
	.type	_ZNKSt6vectorIjSaIjEE12_M_check_lenEmPKc,@function
_ZNKSt6vectorIjSaIjEE12_M_check_lenEmPKc: # @_ZNKSt6vectorIjSaIjEE12_M_check_lenEmPKc
	.cfi_startproc
# %bb.0:
	movabsq	$2305843009213693951, %rcx      # imm = 0x1FFFFFFFFFFFFFFF
	movq	8(%rdi), %r8
	subq	(%rdi), %r8
	sarq	$2, %r8
	movq	%rcx, %rax
	subq	%r8, %rax
	cmpq	%rsi, %rax
	jb	.LBB12_2
# %bb.1:
	cmpq	%rsi, %r8
	cmovaq	%r8, %rsi
	leaq	(%rsi,%r8), %rax
	cmpq	%rcx, %rax
	cmovaeq	%rcx, %rax
	addq	%r8, %rsi
	cmovbq	%rcx, %rax
	retq
.LBB12_2:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rdx, %rdi
	callq	_ZSt20__throw_length_errorPKc
.Lfunc_end12:
	.size	_ZNKSt6vectorIjSaIjEE12_M_check_lenEmPKc, .Lfunc_end12-_ZNKSt6vectorIjSaIjEE12_M_check_lenEmPKc
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	subq	%rsi, %r14
	movq	%r14, (%rsp)
	cmpq	$15, %r14
	jbe	.LBB13_1
# %bb.2:
	movq	%rsp, %r12
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm
	movq	%rax, (%rbx)
	movq	(%r12), %rcx
	movq	%rcx, 16(%rbx)
	jmp	.LBB13_3
.LBB13_1:                               # %._crit_edge
	movq	(%rbx), %rax
.LBB13_3:
	testq	%r14, %r14
	je	.LBB13_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB13_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB13_7
.LBB13_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB13_7:                               # %_ZZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tagEN6_GuardD2Ev.exit
	movq	(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	(%rbx), %rcx
	movb	$0, (%rcx,%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end13:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag, .Lfunc_end13-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.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	.LBB14_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB14_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z7kernel5PjS_j, %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	$_Z7kernel4PjS_j, %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	$_Z7kernel3PjS_j, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z7kernel2PjS_j, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z7kernel1PjS_j, %esi
	movl	$.L__unnamed_5, %edx
	movl	$.L__unnamed_5, %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_end14:
	.size	__hip_module_ctor, .Lfunc_end14-__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	.LBB15_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
.LBB15_2:
	retq
.Lfunc_end15:
	.size	__hip_module_dtor, .Lfunc_end15-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z7kernel5PjS_j,@object         # @_Z7kernel5PjS_j
	.section	.rodata,"a",@progbits
	.globl	_Z7kernel5PjS_j
	.p2align	3, 0x0
_Z7kernel5PjS_j:
	.quad	_Z22__device_stub__kernel5PjS_j
	.size	_Z7kernel5PjS_j, 8

	.type	_Z7kernel4PjS_j,@object         # @_Z7kernel4PjS_j
	.globl	_Z7kernel4PjS_j
	.p2align	3, 0x0
_Z7kernel4PjS_j:
	.quad	_Z22__device_stub__kernel4PjS_j
	.size	_Z7kernel4PjS_j, 8

	.type	_Z7kernel3PjS_j,@object         # @_Z7kernel3PjS_j
	.globl	_Z7kernel3PjS_j
	.p2align	3, 0x0
_Z7kernel3PjS_j:
	.quad	_Z22__device_stub__kernel3PjS_j
	.size	_Z7kernel3PjS_j, 8

	.type	_Z7kernel2PjS_j,@object         # @_Z7kernel2PjS_j
	.globl	_Z7kernel2PjS_j
	.p2align	3, 0x0
_Z7kernel2PjS_j:
	.quad	_Z22__device_stub__kernel2PjS_j
	.size	_Z7kernel2PjS_j, 8

	.type	_Z7kernel1PjS_j,@object         # @_Z7kernel1PjS_j
	.globl	_Z7kernel1PjS_j
	.p2align	3, 0x0
_Z7kernel1PjS_j:
	.quad	_Z22__device_stub__kernel1PjS_j
	.size	_Z7kernel1PjS_j, 8

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

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	" took "
	.size	.L.str.1, 7

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	" ms to sum "
	.size	.L.str.2, 12

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	" elements\n"
	.size	.L.str.3, 11

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"sequential reduce took "
	.size	.L.str.4, 24

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

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"cannot create std::vector larger than max_size()"
	.size	.L.str.6, 49

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"vector::_M_realloc_insert"
	.size	.L.str.7, 26

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"basic_string: construction from null is not valid"
	.size	.L.str.8, 50

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z7kernel5PjS_j"
	.size	.L__unnamed_1, 16

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z7kernel4PjS_j"
	.size	.L__unnamed_2, 16

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

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"_Z7kernel2PjS_j"
	.size	.L__unnamed_4, 16

	.type	.L__unnamed_5,@object           # @4
.L__unnamed_5:
	.asciz	"_Z7kernel1PjS_j"
	.size	.L__unnamed_5, 16

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

	.type	__hip_gpubin_handle,@object     # @__hip_gpubin_handle
	.local	__hip_gpubin_handle
	.comm	__hip_gpubin_handle,8,8
	.section	.init_array,"aw",@init_array
	.p2align	3, 0x0
	.quad	__hip_module_ctor
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.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 _Z22__device_stub__kernel5PjS_j
	.addrsig_sym _Z22__device_stub__kernel4PjS_j
	.addrsig_sym _Z22__device_stub__kernel3PjS_j
	.addrsig_sym _Z22__device_stub__kernel2PjS_j
	.addrsig_sym _Z22__device_stub__kernel1PjS_j
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z7kernel5PjS_j
	.addrsig_sym _Z7kernel4PjS_j
	.addrsig_sym _Z7kernel3PjS_j
	.addrsig_sym _Z7kernel2PjS_j
	.addrsig_sym _Z7kernel1PjS_j
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z7kernel5PjS_j         ; -- Begin function _Z7kernel5PjS_j
	.globl	_Z7kernel5PjS_j
	.p2align	8
	.type	_Z7kernel5PjS_j,@function
_Z7kernel5PjS_j:                        ; @_Z7kernel5PjS_j
; %bb.0:
	s_clause 0x2
	s_load_b32 s8, s[0:1], 0x24
	s_load_b32 s3, s[0:1], 0x10
	s_load_b128 s[4:7], s[0:1], 0x0
	s_add_u32 s0, s0, 24
	s_addc_u32 s1, s1, 0
	v_lshl_add_u32 v3, v0, 2, 0
	v_mov_b32_e32 v2, 0
	s_mov_b32 s2, s15
	ds_store_b32 v3, v2
	s_waitcnt lgkmcnt(0)
	s_and_b32 s8, s8, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_i32 s9, s15, s8
	v_lshl_add_u32 v1, s9, 1, v0
	s_mov_b32 s9, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_u32_e64 s3, v1
	s_cbranch_execz .LBB0_4
; %bb.1:
	v_lshlrev_b64 v[4:5], 2, v[1:2]
	s_load_b32 s0, s[0:1], 0x0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v4, vcc_lo, s4, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v5, vcc_lo
	global_load_b32 v2, v[4:5], off
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_u32 s0, 2
	s_cbranch_scc1 .LBB0_3
; %bb.2:
	v_dual_mov_b32 v5, 0 :: v_dual_add_nc_u32 v4, s8, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[4:5], 2, v[4:5]
	v_add_co_u32 v4, vcc_lo, s4, v4
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v5, vcc_lo
	global_load_b32 v1, v[4:5], off
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v2, v1, v2
.LBB0_3:                                ; %.sink.split
	s_waitcnt vmcnt(0)
	ds_store_b32 v3, v2
.LBB0_4:                                ; %Flow38
	s_or_b32 exec_lo, exec_lo, s9
	s_cmpk_lt_u32 s8, 0x42
	s_waitcnt lgkmcnt(0)
	s_barrier
.LBB0_5:                                ; %Flow38
                                        ; =>This Inner Loop Header: Depth=1
	buffer_gl0_inv
	s_cbranch_scc1 .LBB0_9
; %bb.6:                                ; %.lr.ph
                                        ;   in Loop: Header=BB0_5 Depth=1
	s_lshr_b32 s0, s8, 1
	s_mov_b32 s1, exec_lo
	v_cmpx_gt_u32_e64 s0, v0
	s_cbranch_execz .LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	v_lshl_add_u32 v1, s0, 2, v3
	ds_load_b32 v1, v1
	ds_load_b32 v2, v3
	s_waitcnt lgkmcnt(0)
	v_add_nc_u32_e32 v1, v2, v1
	ds_store_b32 v3, v1
.LBB0_8:                                ;   in Loop: Header=BB0_5 Depth=1
	s_or_b32 exec_lo, exec_lo, s1
	s_waitcnt lgkmcnt(0)
	s_barrier
	s_cmpk_lt_u32 s8, 0x84
	s_mov_b32 s8, s0
	s_branch .LBB0_5
.LBB0_9:                                ; %._crit_edge
	s_mov_b32 s1, exec_lo
	v_cmpx_gt_u32_e32 32, v0
	s_cbranch_execz .LBB0_22
; %bb.10:
	v_cmp_ne_u32_e32 vcc_lo, -1, v3
	s_cmp_lt_u32 s3, 33
	s_cbranch_scc1 .LBB0_12
; %bb.11:
	v_add_nc_u32_e32 v2, 0x80, v3
	s_mov_b64 s[4:5], src_shared_base
	v_cndmask_b32_e32 v1, 0, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_ne_u32_e64 s0, -1, v2
	v_cndmask_b32_e64 v4, 0, v2, s0
	v_cndmask_b32_e64 v5, 0, s5, s0
	v_cndmask_b32_e64 v2, 0, s5, vcc_lo
	flat_load_b32 v4, v[4:5] glc dlc
	s_waitcnt vmcnt(0)
	flat_load_b32 v5, v[1:2] glc dlc
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_nc_u32_e32 v4, v5, v4
	flat_store_b32 v[1:2], v4 dlc
	s_waitcnt_vscnt null, 0x0
.LBB0_12:
	s_cmp_lt_u32 s3, 17
	s_cbranch_scc1 .LBB0_14
; %bb.13:
	v_add_nc_u32_e32 v1, 64, v3
	v_cmp_ne_u32_e64 s0, -1, v3
	s_mov_b64 s[4:5], src_shared_base
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_ne_u32_e32 vcc_lo, -1, v1
	v_cndmask_b32_e64 v2, 0, s5, s0
	v_cndmask_b32_e32 v4, 0, v1, vcc_lo
	v_cndmask_b32_e64 v5, 0, s5, vcc_lo
	v_cndmask_b32_e64 v1, 0, v3, s0
	flat_load_b32 v4, v[4:5] glc dlc
	s_waitcnt vmcnt(0)
	flat_load_b32 v5, v[1:2] glc dlc
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_nc_u32_e32 v4, v5, v4
	flat_store_b32 v[1:2], v4 dlc
	s_waitcnt_vscnt null, 0x0
.LBB0_14:
	s_cmp_lt_u32 s3, 9
	s_cbranch_scc1 .LBB0_16
; %bb.15:
	v_add_nc_u32_e32 v1, 32, v3
	v_cmp_ne_u32_e64 s0, -1, v3
	s_mov_b64 s[4:5], src_shared_base
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_ne_u32_e32 vcc_lo, -1, v1
	v_cndmask_b32_e64 v2, 0, s5, s0
	v_cndmask_b32_e32 v4, 0, v1, vcc_lo
	v_cndmask_b32_e64 v5, 0, s5, vcc_lo
	v_cndmask_b32_e64 v1, 0, v3, s0
	flat_load_b32 v4, v[4:5] glc dlc
	s_waitcnt vmcnt(0)
	flat_load_b32 v5, v[1:2] glc dlc
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_nc_u32_e32 v4, v5, v4
	flat_store_b32 v[1:2], v4 dlc
	s_waitcnt_vscnt null, 0x0
.LBB0_16:
	s_cmp_lt_u32 s3, 5
	s_cbranch_scc1 .LBB0_18
; %bb.17:
	v_add_nc_u32_e32 v1, 16, v3
	v_cmp_ne_u32_e64 s0, -1, v3
	s_mov_b64 s[4:5], src_shared_base
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_ne_u32_e32 vcc_lo, -1, v1
	v_cndmask_b32_e64 v2, 0, s5, s0
	v_cndmask_b32_e32 v4, 0, v1, vcc_lo
	v_cndmask_b32_e64 v5, 0, s5, vcc_lo
	v_cndmask_b32_e64 v1, 0, v3, s0
	flat_load_b32 v4, v[4:5] glc dlc
	s_waitcnt vmcnt(0)
	flat_load_b32 v5, v[1:2] glc dlc
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_nc_u32_e32 v4, v5, v4
	flat_store_b32 v[1:2], v4 dlc
	s_waitcnt_vscnt null, 0x0
.LBB0_18:
	s_cmp_lt_u32 s3, 3
	s_cbranch_scc1 .LBB0_20
; %bb.19:
	v_add_nc_u32_e32 v1, 8, v3
	v_cmp_ne_u32_e64 s0, -1, v3
	s_mov_b64 s[4:5], src_shared_base
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_ne_u32_e32 vcc_lo, -1, v1
	v_cndmask_b32_e64 v2, 0, s5, s0
	v_cndmask_b32_e32 v4, 0, v1, vcc_lo
	v_cndmask_b32_e64 v5, 0, s5, vcc_lo
	v_cndmask_b32_e64 v1, 0, v3, s0
	flat_load_b32 v4, v[4:5] glc dlc
	s_waitcnt vmcnt(0)
	flat_load_b32 v5, v[1:2] glc dlc
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_nc_u32_e32 v4, v5, v4
	flat_store_b32 v[1:2], v4 dlc
	s_waitcnt_vscnt null, 0x0
.LBB0_20:
	s_cmp_lt_u32 s3, 2
	s_cbranch_scc1 .LBB0_22
; %bb.21:
	v_add_nc_u32_e32 v1, 4, v3
	v_cmp_ne_u32_e64 s0, -1, v3
	s_mov_b64 s[4:5], src_shared_base
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_ne_u32_e32 vcc_lo, -1, v1
	v_cndmask_b32_e64 v2, 0, s5, s0
	v_cndmask_b32_e32 v4, 0, v1, vcc_lo
	v_cndmask_b32_e64 v5, 0, s5, vcc_lo
	v_cndmask_b32_e64 v1, 0, v3, s0
	flat_load_b32 v3, v[4:5] glc dlc
	s_waitcnt vmcnt(0)
	flat_load_b32 v4, v[1:2] glc dlc
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_add_nc_u32_e32 v3, v4, v3
	flat_store_b32 v[1:2], v3 dlc
	s_waitcnt_vscnt null, 0x0
.LBB0_22:                               ; %Flow35
	s_or_b32 exec_lo, exec_lo, s1
	s_mov_b32 s3, 0
	s_mov_b32 s0, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB0_24
; %bb.23:
	v_mov_b32_e32 v0, 0
	s_lshl_b64 s[0:1], s[2:3], 2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_add_u32 s0, s6, s0
	s_addc_u32 s1, s7, s1
	ds_load_b32 v1, v0
	s_waitcnt lgkmcnt(0)
	global_store_b32 v0, v1, s[0:1]
.LBB0_24:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z7kernel5PjS_j
		.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 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	_Z7kernel5PjS_j, .Lfunc_end0-_Z7kernel5PjS_j
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1016
; 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 : 1
; 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	_Z7kernel4PjS_j         ; -- Begin function _Z7kernel4PjS_j
	.globl	_Z7kernel4PjS_j
	.p2align	8
	.type	_Z7kernel4PjS_j,@function
_Z7kernel4PjS_j:                        ; @_Z7kernel4PjS_j
; %bb.0:
	s_clause 0x2
	s_load_b32 s3, s[0:1], 0x24
	s_load_b32 s8, s[0:1], 0x10
	s_load_b128 s[4:7], s[0:1], 0x0
	s_add_u32 s0, s0, 24
	s_addc_u32 s1, s1, 0
	v_lshl_add_u32 v3, v0, 2, 0
	v_mov_b32_e32 v2, 0
	s_mov_b32 s2, s15
	ds_store_b32 v3, v2
	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 s9, s15, s3
	v_lshl_add_u32 v1, s9, 1, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_gt_u32_e32 vcc_lo, s8, v1
	s_and_saveexec_b32 s8, vcc_lo
	s_cbranch_execz .LBB1_4
; %bb.1:
	v_lshlrev_b64 v[4:5], 2, v[1:2]
	s_load_b32 s0, s[0:1], 0x0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v4, vcc_lo, s4, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v5, vcc_lo
	global_load_b32 v2, v[4:5], off
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_u32 s0, 2
	s_cbranch_scc1 .LBB1_3
; %bb.2:
	v_dual_mov_b32 v5, 0 :: v_dual_add_nc_u32 v4, s3, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[4:5], 2, v[4:5]
	v_add_co_u32 v4, vcc_lo, s4, v4
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v5, vcc_lo
	global_load_b32 v1, v[4:5], off
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v2, v1, v2
.LBB1_3:                                ; %.sink.split
	s_waitcnt vmcnt(0)
	ds_store_b32 v3, v2
.LBB1_4:                                ; %Flow34
	s_or_b32 exec_lo, exec_lo, s8
	s_cmp_lt_u32 s3, 2
	s_waitcnt lgkmcnt(0)
	s_barrier
.LBB1_5:                                ; %Flow34
                                        ; =>This Inner Loop Header: Depth=1
	buffer_gl0_inv
	s_cbranch_scc1 .LBB1_9
; %bb.6:                                ; %.lr.ph
                                        ;   in Loop: Header=BB1_5 Depth=1
	s_lshr_b32 s0, s3, 1
	s_mov_b32 s1, exec_lo
	v_cmpx_gt_u32_e64 s0, v0
	s_cbranch_execz .LBB1_8
; %bb.7:                                ;   in Loop: Header=BB1_5 Depth=1
	v_lshl_add_u32 v1, s0, 2, v3
	ds_load_b32 v1, v1
	ds_load_b32 v2, v3
	s_waitcnt lgkmcnt(0)
	v_add_nc_u32_e32 v1, v2, v1
	ds_store_b32 v3, v1
.LBB1_8:                                ;   in Loop: Header=BB1_5 Depth=1
	s_or_b32 exec_lo, exec_lo, s1
	s_waitcnt lgkmcnt(0)
	s_barrier
	s_cmp_lt_u32 s3, 4
	s_mov_b32 s3, s0
	s_branch .LBB1_5
.LBB1_9:                                ; %._crit_edge
	s_mov_b32 s3, 0
	s_mov_b32 s0, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB1_11
; %bb.10:
	v_mov_b32_e32 v0, 0
	s_lshl_b64 s[0:1], s[2:3], 2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_add_u32 s0, s6, s0
	s_addc_u32 s1, s7, s1
	ds_load_b32 v1, v0
	s_waitcnt lgkmcnt(0)
	global_store_b32 v0, v1, s[0:1]
.LBB1_11:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z7kernel4PjS_j
		.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 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_end1:
	.size	_Z7kernel4PjS_j, .Lfunc_end1-_Z7kernel4PjS_j
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 400
; 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	_Z7kernel3PjS_j         ; -- Begin function _Z7kernel3PjS_j
	.globl	_Z7kernel3PjS_j
	.p2align	8
	.type	_Z7kernel3PjS_j,@function
_Z7kernel3PjS_j:                        ; @_Z7kernel3PjS_j
; %bb.0:
	s_clause 0x2
	s_load_b32 s5, s[0:1], 0x24
	s_load_b32 s6, s[0:1], 0x10
	s_load_b128 s[0:3], s[0:1], 0x0
	s_mov_b32 s4, s15
	s_waitcnt lgkmcnt(0)
	s_and_b32 s5, s5, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[1:2], null, s4, s5, v[0:1]
	v_mov_b32_e32 v2, 0
	v_cmp_gt_u32_e32 vcc_lo, s6, v1
	s_and_saveexec_b32 s6, vcc_lo
	s_cbranch_execz .LBB2_2
; %bb.1:
	v_mov_b32_e32 v2, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[1:2], 2, v[1:2]
	v_add_co_u32 v1, vcc_lo, s0, v1
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v2, vcc_lo, s1, v2, vcc_lo
	global_load_b32 v2, v[1:2], off
.LBB2_2:
	s_or_b32 exec_lo, exec_lo, s6
	v_lshl_add_u32 v1, v0, 2, 0
	s_cmp_lt_u32 s5, 2
	s_waitcnt vmcnt(0)
	ds_store_b32 v1, v2
	s_waitcnt lgkmcnt(0)
	s_barrier
.LBB2_3:                                ; =>This Inner Loop Header: Depth=1
	buffer_gl0_inv
	s_cbranch_scc1 .LBB2_7
; %bb.4:                                ; %.lr.ph
                                        ;   in Loop: Header=BB2_3 Depth=1
	s_lshr_b32 s0, s5, 1
	s_mov_b32 s1, exec_lo
	v_cmpx_gt_u32_e64 s0, v0
	s_cbranch_execz .LBB2_6
; %bb.5:                                ;   in Loop: Header=BB2_3 Depth=1
	v_lshl_add_u32 v2, s0, 2, v1
	ds_load_b32 v2, v2
	ds_load_b32 v3, v1
	s_waitcnt lgkmcnt(0)
	v_add_nc_u32_e32 v2, v3, v2
	ds_store_b32 v1, v2
.LBB2_6:                                ;   in Loop: Header=BB2_3 Depth=1
	s_or_b32 exec_lo, exec_lo, s1
	s_waitcnt lgkmcnt(0)
	s_barrier
	s_cmp_lt_u32 s5, 4
	s_mov_b32 s5, s0
	s_branch .LBB2_3
.LBB2_7:                                ; %._crit_edge
	s_mov_b32 s0, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB2_9
; %bb.8:
	v_mov_b32_e32 v0, 0
	s_mov_b32 s5, 0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_lshl_b64 s[0:1], s[4:5], 2
	s_add_u32 s0, s2, s0
	ds_load_b32 v1, v0
	s_addc_u32 s1, s3, s1
	s_waitcnt lgkmcnt(0)
	global_store_b32 v0, v1, s[0:1]
.LBB2_9:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z7kernel3PjS_j
		.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 4
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end2:
	.size	_Z7kernel3PjS_j, .Lfunc_end2-_Z7kernel3PjS_j
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 312
; NumSgprs: 18
; NumVgprs: 4
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 4
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z7kernel2PjS_j         ; -- Begin function _Z7kernel2PjS_j
	.globl	_Z7kernel2PjS_j
	.p2align	8
	.type	_Z7kernel2PjS_j,@function
_Z7kernel2PjS_j:                        ; @_Z7kernel2PjS_j
; %bb.0:
	s_clause 0x2
	s_load_b32 s5, s[0:1], 0x24
	s_load_b32 s6, s[0:1], 0x10
	s_load_b128 s[0:3], s[0:1], 0x0
	s_mov_b32 s4, s15
	s_waitcnt lgkmcnt(0)
	s_and_b32 s5, s5, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[1:2], null, s4, s5, v[0:1]
	v_mov_b32_e32 v2, 0
	v_cmp_gt_u32_e32 vcc_lo, s6, v1
	s_and_saveexec_b32 s6, vcc_lo
	s_cbranch_execz .LBB3_2
; %bb.1:
	v_mov_b32_e32 v2, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[1:2], 2, v[1:2]
	v_add_co_u32 v1, vcc_lo, s0, v1
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v2, vcc_lo, s1, v2, vcc_lo
	global_load_b32 v2, v[1:2], off
.LBB3_2:
	s_or_b32 exec_lo, exec_lo, s6
	v_lshl_add_u32 v1, v0, 2, 0
	s_cmp_lt_u32 s5, 2
	s_waitcnt vmcnt(0)
	ds_store_b32 v1, v2
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc1 .LBB3_7
; %bb.3:                                ; %.lr.ph.preheader
	s_mov_b32 s1, 1
.LBB3_4:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	s_lshl_b32 s0, s1, 1
	s_mov_b32 s6, exec_lo
	v_mul_lo_u32 v1, s0, v0
	v_cmpx_gt_u32_e64 s5, v1
	s_cbranch_execz .LBB3_6
; %bb.5:                                ;   in Loop: Header=BB3_4 Depth=1
	v_lshl_add_u32 v1, v1, 2, 0
	s_delay_alu instid0(VALU_DEP_1)
	v_lshl_add_u32 v2, s1, 2, v1
	ds_load_b32 v2, v2
	ds_load_b32 v3, v1
	s_waitcnt lgkmcnt(0)
	v_add_nc_u32_e32 v2, v3, v2
	ds_store_b32 v1, v2
.LBB3_6:                                ;   in Loop: Header=BB3_4 Depth=1
	s_or_b32 exec_lo, exec_lo, s6
	s_cmp_ge_u32 s0, s5
	s_mov_b32 s1, s0
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB3_4
.LBB3_7:                                ; %._crit_edge
	s_mov_b32 s0, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB3_9
; %bb.8:
	v_mov_b32_e32 v0, 0
	s_mov_b32 s5, 0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_lshl_b64 s[0:1], s[4:5], 2
	s_add_u32 s0, s2, s0
	ds_load_b32 v1, v0
	s_addc_u32 s1, s3, s1
	s_waitcnt lgkmcnt(0)
	global_store_b32 v0, v1, s[0:1]
.LBB3_9:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z7kernel2PjS_j
		.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 4
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end3:
	.size	_Z7kernel2PjS_j, .Lfunc_end3-_Z7kernel2PjS_j
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 348
; NumSgprs: 18
; NumVgprs: 4
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 4
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z7kernel1PjS_j         ; -- Begin function _Z7kernel1PjS_j
	.globl	_Z7kernel1PjS_j
	.p2align	8
	.type	_Z7kernel1PjS_j,@function
_Z7kernel1PjS_j:                        ; @_Z7kernel1PjS_j
; %bb.0:
	s_clause 0x2
	s_load_b32 s6, s[0:1], 0x24
	s_load_b32 s5, s[0:1], 0x10
	s_load_b128 s[0:3], s[0:1], 0x0
	s_mov_b32 s4, s15
	s_mov_b32 s7, exec_lo
	s_waitcnt lgkmcnt(0)
	s_and_b32 s6, s6, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[1:2], null, s4, s6, v[0:1]
	v_mov_b32_e32 v2, 0
	v_cmpx_gt_u32_e64 s5, v1
	s_cbranch_execz .LBB4_2
; %bb.1:
	v_mov_b32_e32 v2, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[1:2], 2, v[1:2]
	v_add_co_u32 v1, vcc_lo, s0, v1
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v2, vcc_lo, s1, v2, vcc_lo
	global_load_b32 v2, v[1:2], off
.LBB4_2:
	s_or_b32 exec_lo, exec_lo, s7
	v_lshl_add_u32 v1, v0, 2, 0
	s_mov_b32 s0, 0
	s_cmp_lt_u32 s6, 2
	s_waitcnt vmcnt(0)
	ds_store_b32 v1, v2
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc1 .LBB4_10
; %bb.3:                                ; %.lr.ph.preheader
	s_mov_b32 s9, 1
                                        ; implicit-def: $sgpr1
.LBB4_4:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v2, s9, v0
	s_or_b32 s1, s1, exec_lo
	s_mov_b32 s8, exec_lo
                                        ; implicit-def: $sgpr7
	v_cmpx_gt_u32_e64 s5, v2
	s_cbranch_execz .LBB4_8
; %bb.5:                                ;   in Loop: Header=BB4_4 Depth=1
	s_lshl_b32 s7, s9, 1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s10, s7, -1
	v_and_b32_e32 v2, s10, v0
	s_mov_b32 s10, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_eq_u32_e32 0, v2
	s_cbranch_execz .LBB4_7
; %bb.6:                                ;   in Loop: Header=BB4_4 Depth=1
	v_lshl_add_u32 v2, s9, 2, v1
	ds_load_b32 v2, v2
	ds_load_b32 v3, v1
	s_waitcnt lgkmcnt(0)
	v_add_nc_u32_e32 v2, v3, v2
	ds_store_b32 v1, v2
.LBB4_7:                                ;   in Loop: Header=BB4_4 Depth=1
	s_or_b32 exec_lo, exec_lo, s10
	s_cmp_ge_u32 s7, s6
	s_waitcnt lgkmcnt(0)
	s_cselect_b32 s9, -1, 0
	s_and_not1_b32 s1, s1, exec_lo
	s_and_b32 s9, s9, exec_lo
	s_barrier
	s_or_b32 s1, s1, s9
	buffer_gl0_inv
.LBB4_8:                                ; %Flow
                                        ;   in Loop: Header=BB4_4 Depth=1
	s_or_b32 exec_lo, exec_lo, s8
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	s_and_b32 s8, exec_lo, s1
	s_mov_b32 s9, s7
	s_or_b32 s0, s8, s0
	s_and_not1_b32 exec_lo, exec_lo, s0
	s_cbranch_execnz .LBB4_4
; %bb.9:                                ; %Flow29
	s_or_b32 exec_lo, exec_lo, s0
.LBB4_10:                               ; %.critedge
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s0, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB4_12
; %bb.11:
	v_mov_b32_e32 v0, 0
	s_mov_b32 s5, 0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_lshl_b64 s[0:1], s[4:5], 2
	s_add_u32 s0, s2, s0
	ds_load_b32 v1, v0
	s_addc_u32 s1, s3, s1
	s_waitcnt lgkmcnt(0)
	global_store_b32 v0, v1, s[0:1]
.LBB4_12:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z7kernel1PjS_j
		.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 4
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end4:
	.size	_Z7kernel1PjS_j, .Lfunc_end4-_Z7kernel1PjS_j
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 416
; NumSgprs: 18
; NumVgprs: 4
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 4
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.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 sdata
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
      - .offset:         144
        .size:           4
        .value_kind:     hidden_dynamic_lds_size
    .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:           _Z7kernel5PjS_j
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z7kernel5PjS_j.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
      - .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
      - .offset:         144
        .size:           4
        .value_kind:     hidden_dynamic_lds_size
    .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:           _Z7kernel4PjS_j
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z7kernel4PjS_j.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
      - .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
      - .offset:         144
        .size:           4
        .value_kind:     hidden_dynamic_lds_size
    .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:           _Z7kernel3PjS_j
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z7kernel3PjS_j.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     4
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .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
      - .offset:         144
        .size:           4
        .value_kind:     hidden_dynamic_lds_size
    .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:           _Z7kernel2PjS_j
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z7kernel2PjS_j.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     4
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .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
      - .offset:         144
        .size:           4
        .value_kind:     hidden_dynamic_lds_size
    .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:           _Z7kernel1PjS_j
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z7kernel1PjS_j.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     4
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
