#include <stdio.h>
#include <stdlib.h>
#define TPB 512

__global__ void oddPopulate(int *A, int *O, int n, int *numOdds){
    __shared__ int odds;

    if(threadIdx.x){
        odds = 0;
    }

    __syncthreads();

    int index = blockIdx.x * blockDim.x + threadIdx.x;
    if(index < n){
       if(A[index] % 2 == 0){
           O[index] = 0;
       }
       else{
           O[index] = 1;
           atomicAdd(&odds, 1);
       }
    }

    if(threadIdx.x == 0){
        atomicAdd(numOdds, odds);
    }
}

__global__ void upwardSweep(int *temp, int *c, int d, int n){

    int index = threadIdx.x + blockIdx.x * blockDim.x;
    if(index < n){
        if(index >= d){
            temp[index] = c[index-d];
        }
        else{
            temp[index] = 0;
        }

    }
    
}  

__global__ void downwardSweep(int *temp, int *c, int n){
    int index = threadIdx.x + blockIdx.x * blockDim.x;
    if(index < n){
        c[index] = c[index] + temp[index];
    }
}

__global__ void fillOddArray(int *D, int *sums, int *A, int n){
    int index = blockIdx.x * blockDim.x + threadIdx.x;
    if(index < n){
        if(A[index]%2 == 1){
            D[sums[index] - 1] = A[index];
        }
    }
}

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

    FILE *fp;
    char word[255];
    int N = 0;

    fp = fopen("inp.txt", "r");

    if (fp == NULL){
        return -1;
    }


    while (fscanf(fp, "%*s ", word) != EOF) {     //this one works      
        N++;
    }

    if(N == 0){
        return -1;
    } 

    fclose(fp);

    fp = fopen("inp.txt", "r");

    if (fp == NULL){
        return -1;
    }

    int A[N];

    fscanf(fp, "%d", &A[0]);

    int idx = 1;
    while(idx < N){
        fscanf(fp, ", %d", &A[idx]);

        idx++;
    }

    int odds[1];

    int O[N];

    int *d_A;
    int *d_O;
    int *d_numOdds;

    int A_size = sizeof(int)*N;
    int O_size = sizeof(int)*N;
    int odds_size = sizeof(int)*1;

    cudaMalloc((void **) &d_A, A_size);
    cudaMalloc((void **) &d_O, O_size);
    cudaMalloc((void **) &d_numOdds, odds_size);

    cudaMemcpy(d_A, A, A_size, cudaMemcpyHostToDevice);
    cudaMemcpy(d_numOdds, odds, odds_size, cudaMemcpyHostToDevice);

    oddPopulate<<<(N + TPB - 1)/TPB, TPB>>>(d_A, d_O, N, d_numOdds);

    cudaMemcpy(O, d_O, O_size, cudaMemcpyDeviceToHost);
    cudaMemcpy(odds, d_numOdds, odds_size, cudaMemcpyDeviceToHost);

    cudaFree(d_A);
    cudaFree(d_O);
    cudaFree(d_numOdds);

    int *d_OSum;
    int *d_temp;
    int temp_size = N*sizeof(int);

    cudaMalloc((void **) &d_OSum, temp_size);
    cudaMalloc((void **) &d_temp, temp_size);

    cudaMemcpy(d_OSum, O, temp_size, cudaMemcpyHostToDevice);

    int x = 1;
    
    while(x < N) {

        upwardSweep<<<(N + TPB - 1)/TPB, TPB>>>(d_temp, d_OSum, x, N);
    
        downwardSweep<<<(N + TPB - 1)/TPB, TPB>>>(d_temp, d_OSum, N);
        
        x *= 2;

    }

    cudaFree(d_temp);

    int D[odds[0]];

    int *d_D;
    int *d_Nums;

    cudaMalloc((void **) &d_D, odds[0]*sizeof(int));
    cudaMalloc((void **) &d_Nums, N*sizeof(int));

    cudaMemcpy(d_Nums, A, N*sizeof(int), cudaMemcpyHostToDevice);

    fillOddArray<<<(N + TPB - 1)/TPB, TPB>>>(d_D, d_OSum, d_Nums, N);

    cudaMemcpy(D, d_D, odds[0]*sizeof(int), cudaMemcpyDeviceToHost);
    
    cudaFree(d_Nums);
    cudaFree(d_D);
    cudaFree(d_OSum);

    fp = fopen("q3.txt","w+");
    fputs("[",fp);
    for(int i = 0; i < odds[0]; i++){
        snprintf(word, sizeof(word), "%d", D[i]);
        fputs(word,fp);

        if(i != odds[0] - 1)
            fputs(", ",fp);
    }
    fputs("]",fp);
    fclose(fp);

    return 0;
}

    
	.file	"tmpxft_00276595_00000000-6_q3.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2030:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2030:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z36__device_stub__Z11oddPopulatePiS_iS_PiS_iS_
	.type	_Z36__device_stub__Z11oddPopulatePiS_iS_PiS_iS_, @function
_Z36__device_stub__Z11oddPopulatePiS_iS_PiS_iS_:
.LFB2052:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	40(%rsp), %rdx
	movq	%rcx, (%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L2
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z11oddPopulatePiS_iS_(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L2:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2052:
	.size	_Z36__device_stub__Z11oddPopulatePiS_iS_PiS_iS_, .-_Z36__device_stub__Z11oddPopulatePiS_iS_PiS_iS_
	.globl	_Z11oddPopulatePiS_iS_
	.type	_Z11oddPopulatePiS_iS_, @function
_Z11oddPopulatePiS_iS_:
.LFB2053:
	.cfi_startproc
	endbr64
	jmp	_Z36__device_stub__Z11oddPopulatePiS_iS_PiS_iS_
	.cfi_endproc
.LFE2053:
	.size	_Z11oddPopulatePiS_iS_, .-_Z11oddPopulatePiS_iS_
	.globl	_Z35__device_stub__Z11upwardSweepPiS_iiPiS_ii
	.type	_Z35__device_stub__Z11upwardSweepPiS_iiPiS_ii, @function
_Z35__device_stub__Z11upwardSweepPiS_iiPiS_ii:
.LFB2054:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 8(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L8
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z11upwardSweepPiS_ii(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L8:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2054:
	.size	_Z35__device_stub__Z11upwardSweepPiS_iiPiS_ii, .-_Z35__device_stub__Z11upwardSweepPiS_iiPiS_ii
	.globl	_Z11upwardSweepPiS_ii
	.type	_Z11upwardSweepPiS_ii, @function
_Z11upwardSweepPiS_ii:
.LFB2055:
	.cfi_startproc
	endbr64
	jmp	_Z35__device_stub__Z11upwardSweepPiS_iiPiS_ii
	.cfi_endproc
.LFE2055:
	.size	_Z11upwardSweepPiS_ii, .-_Z11upwardSweepPiS_ii
	.globl	_Z36__device_stub__Z13downwardSweepPiS_iPiS_i
	.type	_Z36__device_stub__Z13downwardSweepPiS_iPiS_i, @function
_Z36__device_stub__Z13downwardSweepPiS_iPiS_i:
.LFB2056:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L13
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z13downwardSweepPiS_i(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L13:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2056:
	.size	_Z36__device_stub__Z13downwardSweepPiS_iPiS_i, .-_Z36__device_stub__Z13downwardSweepPiS_iPiS_i
	.globl	_Z13downwardSweepPiS_i
	.type	_Z13downwardSweepPiS_i, @function
_Z13downwardSweepPiS_i:
.LFB2057:
	.cfi_startproc
	endbr64
	jmp	_Z36__device_stub__Z13downwardSweepPiS_iPiS_i
	.cfi_endproc
.LFE2057:
	.size	_Z13downwardSweepPiS_i, .-_Z13downwardSweepPiS_i
	.globl	_Z37__device_stub__Z12fillOddArrayPiS_S_iPiS_S_i
	.type	_Z37__device_stub__Z12fillOddArrayPiS_S_iPiS_S_i, @function
_Z37__device_stub__Z12fillOddArrayPiS_S_iPiS_S_i:
.LFB2058:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L18
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z12fillOddArrayPiS_S_i(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L18:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2058:
	.size	_Z37__device_stub__Z12fillOddArrayPiS_S_iPiS_S_i, .-_Z37__device_stub__Z12fillOddArrayPiS_S_iPiS_S_i
	.globl	_Z12fillOddArrayPiS_S_i
	.type	_Z12fillOddArrayPiS_S_i, @function
_Z12fillOddArrayPiS_S_i:
.LFB2059:
	.cfi_startproc
	endbr64
	jmp	_Z37__device_stub__Z12fillOddArrayPiS_S_iPiS_S_i
	.cfi_endproc
.LFE2059:
	.size	_Z12fillOddArrayPiS_S_i, .-_Z12fillOddArrayPiS_S_i
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"r"
.LC1:
	.string	"inp.txt"
.LC2:
	.string	"%*s "
.LC3:
	.string	"%d"
.LC4:
	.string	", %d"
.LC5:
	.string	"w+"
.LC6:
	.string	"q3.txt"
.LC7:
	.string	", "
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_offset 12, -48
	leaq	.LC1(%rip), %r12
	movq	%r13, %rsi
	pushq	%rbx
	movq	%r12, %rdi
	subq	$392, %rsp
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	fopen@PLT
	testq	%rax, %rax
	jne	.L66
.L27:
	orl	$-1, %eax
	jmp	.L23
.L66:
	movq	%rax, %r15
	xorl	%ebx, %ebx
	leaq	.LC2(%rip), %r14
.L24:
	leaq	-311(%rbp), %rax
	movq	%r14, %rsi
	movq	%r15, %rdi
	movq	%rax, -416(%rbp)
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__isoc23_fscanf@PLT
	incl	%eax
	je	.L68
	incl	%ebx
	jmp	.L24
.L68:
	testl	%ebx, %ebx
	je	.L27
	movq	%r15, %rdi
	call	fclose@PLT
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	fopen@PLT
	movq	%rax, %r14
	testq	%rax, %rax
	je	.L27
	movslq	%ebx, %r13
	movq	%rsp, %rdx
	salq	$2, %r13
	leaq	15(%r13), %r12
	movq	%r12, %rcx
	movq	%r12, %rax
	andq	$-4096, %rcx
	andq	$-16, %rax
	subq	%rcx, %rdx
.L28:
	cmpq	%rdx, %rsp
	je	.L29
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L28
.L29:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L30
	orq	$0, -8(%rsp,%rax)
.L30:
	movq	%rsp, %rdx
	leaq	.LC3(%rip), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	movq	%rsp, -408(%rbp)
	call	__isoc23_fscanf@PLT
	movq	-408(%rbp), %rdx
	leaq	(%rdx,%r13), %r15
.L31:
	addq	$4, %rdx
	cmpq	%r15, %rdx
	je	.L69
	leaq	.LC4(%rip), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	movq	%rdx, -424(%rbp)
	call	__isoc23_fscanf@PLT
	movq	-424(%rbp), %rdx
	jmp	.L31
.L69:
	movq	%r12, %rax
	movq	%rsp, %rdx
	andq	$-4096, %r12
	andq	$-16, %rax
	subq	%r12, %rdx
.L33:
	cmpq	%rdx, %rsp
	je	.L34
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L33
.L34:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L35
	orq	$0, -8(%rsp,%rax)
.L35:
	leal	0(,%rbx,4), %eax
	leaq	-400(%rbp), %rdi
	movq	%rsp, -424(%rbp)
	movslq	%eax, %r15
	leaq	-316(%rbp), %r14
	leal	511(%rbx), %r12d
	movq	%r15, %rsi
	sarl	$9, %r12d
	call	cudaMalloc@PLT
	leaq	-392(%rbp), %rdi
	movq	%r15, %rsi
	call	cudaMalloc@PLT
	leaq	-384(%rbp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movq	-408(%rbp), %rsi
	movl	$1, %ecx
	movq	%r15, %rdx
	movq	-400(%rbp), %rdi
	call	cudaMemcpy@PLT
	movq	-384(%rbp), %rdi
	movl	$1, %ecx
	movq	%r14, %rsi
	movl	$4, %edx
	call	cudaMemcpy@PLT
	movl	$8388609, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	%r12d, -340(%rbp)
	salq	$9, %rdx
	movl	$1, %ecx
	movabsq	$4294967297, %rax
	movq	%rax, -336(%rbp)
	movl	-332(%rbp), %esi
	movq	-340(%rbp), %rdi
	movq	%rdx, -328(%rbp)
	movl	$1, -320(%rbp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L36
	movq	-384(%rbp), %rcx
	movq	-392(%rbp), %rsi
	movl	%ebx, %edx
	movq	-400(%rbp), %rdi
	call	_Z36__device_stub__Z11oddPopulatePiS_iS_PiS_iS_
.L36:
	movq	-392(%rbp), %rsi
	movq	-424(%rbp), %rdi
	movq	%r15, %rdx
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movq	-384(%rbp), %rsi
	movl	$2, %ecx
	movq	%r14, %rdi
	movl	$4, %edx
	movl	$1, %r14d
	call	cudaMemcpy@PLT
	movq	-400(%rbp), %rdi
	call	cudaFree@PLT
	movq	-392(%rbp), %rdi
	call	cudaFree@PLT
	movq	-384(%rbp), %rdi
	call	cudaFree@PLT
	movq	%r15, %rsi
	leaq	-376(%rbp), %rdi
	call	cudaMalloc@PLT
	movq	%r15, %rsi
	leaq	-368(%rbp), %rdi
	call	cudaMalloc@PLT
	movq	-424(%rbp), %rsi
	movq	%r15, %rdx
	movq	-376(%rbp), %rdi
	movabsq	$4294967808, %r15
	movl	$1, %ecx
	call	cudaMemcpy@PLT
.L37:
	cmpl	%r14d, %ebx
	jle	.L70
	movl	%r12d, -340(%rbp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r15, %rdx
	movabsq	$4294967297, %rax
	movl	$1, %ecx
	movq	%r15, -328(%rbp)
	movq	%rax, -336(%rbp)
	movl	-332(%rbp), %esi
	movq	-340(%rbp), %rdi
	movl	$1, -320(%rbp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L38
	movq	-376(%rbp), %rsi
	movq	-368(%rbp), %rdi
	movl	%ebx, %ecx
	movl	%r14d, %edx
	call	_Z35__device_stub__Z11upwardSweepPiS_iiPiS_ii
.L38:
	movl	%r12d, -340(%rbp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r15, %rdx
	movabsq	$4294967297, %rax
	movl	$1, %ecx
	movq	%r15, -328(%rbp)
	movq	%rax, -336(%rbp)
	movl	-332(%rbp), %esi
	movq	-340(%rbp), %rdi
	movl	$1, -320(%rbp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L39
	movq	-376(%rbp), %rsi
	movq	-368(%rbp), %rdi
	movl	%ebx, %edx
	call	_Z36__device_stub__Z13downwardSweepPiS_iPiS_i
.L39:
	addl	%r14d, %r14d
	jmp	.L37
.L70:
	movq	-368(%rbp), %rdi
	call	cudaFree@PLT
	movslq	-316(%rbp), %rsi
	movq	%rsp, %rcx
	salq	$2, %rsi
	leaq	15(%rsi), %rdx
	movq	%rdx, %rax
	andq	$-4096, %rdx
	andq	$-16, %rax
	subq	%rdx, %rcx
.L41:
	cmpq	%rcx, %rsp
	je	.L42
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L41
.L42:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L43
	orq	$0, -8(%rsp,%rax)
.L43:
	leaq	-360(%rbp), %rdi
	movq	%rsp, %r14
	call	cudaMalloc@PLT
	leaq	-352(%rbp), %rdi
	movq	%r13, %rsi
	call	cudaMalloc@PLT
	movq	-408(%rbp), %rsi
	movl	$1, %ecx
	movq	%r13, %rdx
	movq	-352(%rbp), %rdi
	call	cudaMemcpy@PLT
	movl	$8388609, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	%r12d, -340(%rbp)
	salq	$9, %rdx
	movl	$1, %ecx
	movabsq	$4294967297, %rax
	movq	%rax, -336(%rbp)
	movl	-332(%rbp), %esi
	movq	-340(%rbp), %rdi
	movq	%rdx, -328(%rbp)
	movl	$1, -320(%rbp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L44
	movq	-352(%rbp), %rdx
	movq	-376(%rbp), %rsi
	movl	%ebx, %ecx
	movq	-360(%rbp), %rdi
	call	_Z37__device_stub__Z12fillOddArrayPiS_S_iPiS_S_i
.L44:
	movslq	-316(%rbp), %rdx
	movq	-360(%rbp), %rsi
	movq	%r14, %rdi
	xorl	%r12d, %r12d
	movl	$2, %ecx
	leaq	.LC7(%rip), %r13
	salq	$2, %rdx
	call	cudaMemcpy@PLT
	movq	-352(%rbp), %rdi
	call	cudaFree@PLT
	movq	-360(%rbp), %rdi
	call	cudaFree@PLT
	movq	-376(%rbp), %rdi
	call	cudaFree@PLT
	leaq	.LC5(%rip), %rsi
	leaq	.LC6(%rip), %rdi
	call	fopen@PLT
	movl	$91, %edi
	movq	%rax, %rsi
	movq	%rax, %rbx
	call	fputc@PLT
.L45:
	cmpl	%r12d, -316(%rbp)
	jle	.L71
	movl	(%r14,%r12,4), %r9d
	movl	$255, %ecx
	movl	$2, %edx
	xorl	%eax, %eax
	movq	-416(%rbp), %rdi
	leaq	.LC3(%rip), %r8
	movl	$255, %esi
	call	__snprintf_chk@PLT
	movq	-416(%rbp), %rdi
	movq	%rbx, %rsi
	call	fputs@PLT
	movl	-316(%rbp), %eax
	decl	%eax
	cmpl	%r12d, %eax
	je	.L46
	movq	%rbx, %rsi
	movq	%r13, %rdi
	call	fputs@PLT
.L46:
	incq	%r12
	jmp	.L45
.L71:
	movq	%rbx, %rsi
	movl	$93, %edi
	call	fputc@PLT
	movq	%rbx, %rdi
	call	fclose@PLT
	xorl	%eax, %eax
.L23:
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L48
	call	__stack_chk_fail@PLT
.L48:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2027:
	.size	main, .-main
	.section	.rodata.str1.1
.LC8:
	.string	"_Z12fillOddArrayPiS_S_i"
.LC9:
	.string	"_Z13downwardSweepPiS_i"
.LC10:
	.string	"_Z11upwardSweepPiS_ii"
.LC11:
	.string	"_Z11oddPopulatePiS_iS_"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2061:
	.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	.LC8(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z12fillOddArrayPiS_S_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC9(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z13downwardSweepPiS_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC10(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z11upwardSweepPiS_ii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC11(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z11oddPopulatePiS_iS_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2061:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <stdio.h>
#include <stdlib.h>
#define TPB 512

__global__ void oddPopulate(int *A, int *O, int n, int *numOdds){
    __shared__ int odds;

    if(threadIdx.x){
        odds = 0;
    }

    __syncthreads();

    int index = blockIdx.x * blockDim.x + threadIdx.x;
    if(index < n){
       if(A[index] % 2 == 0){
           O[index] = 0;
       }
       else{
           O[index] = 1;
           atomicAdd(&odds, 1);
       }
    }

    if(threadIdx.x == 0){
        atomicAdd(numOdds, odds);
    }
}

__global__ void upwardSweep(int *temp, int *c, int d, int n){

    int index = threadIdx.x + blockIdx.x * blockDim.x;
    if(index < n){
        if(index >= d){
            temp[index] = c[index-d];
        }
        else{
            temp[index] = 0;
        }

    }
    
}  

__global__ void downwardSweep(int *temp, int *c, int n){
    int index = threadIdx.x + blockIdx.x * blockDim.x;
    if(index < n){
        c[index] = c[index] + temp[index];
    }
}

__global__ void fillOddArray(int *D, int *sums, int *A, int n){
    int index = blockIdx.x * blockDim.x + threadIdx.x;
    if(index < n){
        if(A[index]%2 == 1){
            D[sums[index] - 1] = A[index];
        }
    }
}

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

    FILE *fp;
    char word[255];
    int N = 0;

    fp = fopen("inp.txt", "r");

    if (fp == NULL){
        return -1;
    }


    while (fscanf(fp, "%*s ", word) != EOF) {     //this one works      
        N++;
    }

    if(N == 0){
        return -1;
    } 

    fclose(fp);

    fp = fopen("inp.txt", "r");

    if (fp == NULL){
        return -1;
    }

    int A[N];

    fscanf(fp, "%d", &A[0]);

    int idx = 1;
    while(idx < N){
        fscanf(fp, ", %d", &A[idx]);

        idx++;
    }

    int odds[1];

    int O[N];

    int *d_A;
    int *d_O;
    int *d_numOdds;

    int A_size = sizeof(int)*N;
    int O_size = sizeof(int)*N;
    int odds_size = sizeof(int)*1;

    hipMalloc((void **) &d_A, A_size);
    hipMalloc((void **) &d_O, O_size);
    hipMalloc((void **) &d_numOdds, odds_size);

    hipMemcpy(d_A, A, A_size, hipMemcpyHostToDevice);
    hipMemcpy(d_numOdds, odds, odds_size, hipMemcpyHostToDevice);

    oddPopulate<<<(N + TPB - 1)/TPB, TPB>>>(d_A, d_O, N, d_numOdds);

    hipMemcpy(O, d_O, O_size, hipMemcpyDeviceToHost);
    hipMemcpy(odds, d_numOdds, odds_size, hipMemcpyDeviceToHost);

    hipFree(d_A);
    hipFree(d_O);
    hipFree(d_numOdds);

    int *d_OSum;
    int *d_temp;
    int temp_size = N*sizeof(int);

    hipMalloc((void **) &d_OSum, temp_size);
    hipMalloc((void **) &d_temp, temp_size);

    hipMemcpy(d_OSum, O, temp_size, hipMemcpyHostToDevice);

    int x = 1;
    
    while(x < N) {

        upwardSweep<<<(N + TPB - 1)/TPB, TPB>>>(d_temp, d_OSum, x, N);
    
        downwardSweep<<<(N + TPB - 1)/TPB, TPB>>>(d_temp, d_OSum, N);
        
        x *= 2;

    }

    hipFree(d_temp);

    int D[odds[0]];

    int *d_D;
    int *d_Nums;

    hipMalloc((void **) &d_D, odds[0]*sizeof(int));
    hipMalloc((void **) &d_Nums, N*sizeof(int));

    hipMemcpy(d_Nums, A, N*sizeof(int), hipMemcpyHostToDevice);

    fillOddArray<<<(N + TPB - 1)/TPB, TPB>>>(d_D, d_OSum, d_Nums, N);

    hipMemcpy(D, d_D, odds[0]*sizeof(int), hipMemcpyDeviceToHost);
    
    hipFree(d_Nums);
    hipFree(d_D);
    hipFree(d_OSum);

    fp = fopen("q3.txt","w+");
    fputs("[",fp);
    for(int i = 0; i < odds[0]; i++){
        snprintf(word, sizeof(word), "%d", D[i]);
        fputs(word,fp);

        if(i != odds[0] - 1)
            fputs(", ",fp);
    }
    fputs("]",fp);
    fclose(fp);

    return 0;
}

    
	.text
	.file	"q3.hip"
	.globl	_Z26__device_stub__oddPopulatePiS_iS_ # -- Begin function _Z26__device_stub__oddPopulatePiS_iS_
	.type	_Z26__device_stub__oddPopulatePiS_iS_,@function
_Z26__device_stub__oddPopulatePiS_iS_:  # @_Z26__device_stub__oddPopulatePiS_iS_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	4(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	24(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z11oddPopulatePiS_iS_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z26__device_stub__oddPopulatePiS_iS_, .Lfunc_end0-_Z26__device_stub__oddPopulatePiS_iS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z26__device_stub__upwardSweepPiS_ii # -- Begin function _Z26__device_stub__upwardSweepPiS_ii
	.type	_Z26__device_stub__upwardSweepPiS_ii,@function
_Z26__device_stub__upwardSweepPiS_ii:   # @_Z26__device_stub__upwardSweepPiS_ii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	8(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	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	$_Z11upwardSweepPiS_ii, %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	_Z26__device_stub__upwardSweepPiS_ii, .Lfunc_end1-_Z26__device_stub__upwardSweepPiS_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z28__device_stub__downwardSweepPiS_i # -- Begin function _Z28__device_stub__downwardSweepPiS_i
	.type	_Z28__device_stub__downwardSweepPiS_i,@function
_Z28__device_stub__downwardSweepPiS_i:  # @_Z28__device_stub__downwardSweepPiS_i
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z13downwardSweepPiS_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z28__device_stub__downwardSweepPiS_i, .Lfunc_end2-_Z28__device_stub__downwardSweepPiS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z27__device_stub__fillOddArrayPiS_S_i # -- Begin function _Z27__device_stub__fillOddArrayPiS_S_i
	.type	_Z27__device_stub__fillOddArrayPiS_S_i,@function
_Z27__device_stub__fillOddArrayPiS_S_i: # @_Z27__device_stub__fillOddArrayPiS_S_i
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z12fillOddArrayPiS_S_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z27__device_stub__fillOddArrayPiS_S_i, .Lfunc_end3-_Z27__device_stub__fillOddArrayPiS_S_i
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$360, %rsp                      # imm = 0x168
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	$.L.str, %edi
	movl	$.L.str.1, %esi
	callq	fopen
	movq	%rax, %r14
	movl	$-1, %eax
	testq	%r14, %r14
	je	.LBB4_25
# %bb.1:                                # %.preheader.preheader
	movq	$-2, %r15
	movq	$-4, %rbx
	movabsq	$-17179869184, %r13             # imm = 0xFFFFFFFC00000000
	movabsq	$17179869184, %r12              # imm = 0x400000000
.LBB4_2:                                # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	addq	%r12, %r13
	movl	$.L.str.2, %esi
	movq	%r14, %rdi
	leaq	-400(%rbp), %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	incq	%r15
	addq	$4, %rbx
	cmpl	$-1, %eax
	jne	.LBB4_2
# %bb.3:
	cmpl	$-1, %r15d
	je	.LBB4_4
# %bb.5:
	movq	%r14, %rdi
	callq	fclose
	movl	$.L.str, %edi
	movl	$.L.str.1, %esi
	callq	fopen
	movq	%rax, %rcx
	testq	%rax, %rax
	movl	$-1, %eax
	je	.LBB4_25
# %bb.6:
	movq	%rsp, -136(%rbp)                # 8-byte Spill
	leaq	1(%r15), %rax
	movq	%rax, -72(%rbp)                 # 8-byte Spill
	movq	%rsp, %rdx
	leaq	19(,%r15,4), %rax
	andq	$-16, %rax
	subq	%rax, %rdx
	movq	%rdx, %rsp
	movl	$.L.str.3, %esi
	movq	%rcx, -56(%rbp)                 # 8-byte Spill
	movq	%rcx, %rdi
	movq	%rdx, -80(%rbp)                 # 8-byte Spill
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	testl	%r15d, %r15d
	je	.LBB4_9
# %bb.7:                                # %.lr.ph.preheader
	movq	-80(%rbp), %rax                 # 8-byte Reload
	leaq	4(%rax), %r12
	movq	%r15, %r14
.LBB4_8:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	$.L.str.4, %esi
	movq	-56(%rbp), %rdi                 # 8-byte Reload
	movq	%r12, %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	addq	$4, %r12
	decq	%r14
	jne	.LBB4_8
.LBB4_9:                                # %._crit_edge
	movq	%rsp, %rcx
	movq	-72(%rbp), %rax                 # 8-byte Reload
	leaq	15(,%rax,4), %rax
	andq	$-16, %rax
	subq	%rax, %rcx
	movq	%rcx, -56(%rbp)                 # 8-byte Spill
	movq	%rcx, %rsp
	sarq	$32, %r13
	leaq	-128(%rbp), %r14
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	leaq	-112(%rbp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	leaq	-104(%rbp), %r12
	movl	$4, %esi
	movq	%r12, %rdi
	callq	hipMalloc
	movq	(%r14), %rdi
	movq	-80(%rbp), %rsi                 # 8-byte Reload
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r12), %rdi
	leaq	-44(%rbp), %rsi
	movl	$4, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%r15d, %eax
	addl	$512, %eax                      # imm = 0x200
	shrl	$9, %eax
	movabsq	$4294967808, %rdx               # imm = 0x100000200
	leaq	(%rax,%rdx), %r14
	addq	$-512, %r14                     # imm = 0xFE00
	movq	%r14, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_11
# %bb.10:
	movq	-128(%rbp), %rdi
	movq	-112(%rbp), %rsi
	movq	-104(%rbp), %rcx
	movq	-72(%rbp), %rdx                 # 8-byte Reload
                                        # kill: def $edx killed $edx killed $rdx
	callq	_Z26__device_stub__oddPopulatePiS_iS_
.LBB4_11:
	movq	-112(%rbp), %rsi
	movq	-56(%rbp), %rdi                 # 8-byte Reload
	movq	%r13, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	-104(%rbp), %rsi
	leaq	-44(%rbp), %rdi
	movl	$4, %edx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	-128(%rbp), %rdi
	callq	hipFree
	movq	-112(%rbp), %rdi
	callq	hipFree
	movq	-104(%rbp), %rdi
	callq	hipFree
	leaq	-64(%rbp), %r12
	movq	%r12, %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	leaq	-96(%rbp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	movq	(%r12), %rdi
	movl	$1, %r12d
	movq	-56(%rbp), %rsi                 # 8-byte Reload
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%r15d, %r15d
	movq	-72(%rbp), %r15                 # 8-byte Reload
	movabsq	$4294967808, %r13               # imm = 0x100000200
	je	.LBB4_17
.LBB4_12:                               # %.lr.ph99
                                        # =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%r13, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_14
# %bb.13:                               #   in Loop: Header=BB4_12 Depth=1
	movq	-96(%rbp), %rdi
	movq	-64(%rbp), %rsi
	movl	%r12d, %edx
	movl	%r15d, %ecx
	callq	_Z26__device_stub__upwardSweepPiS_ii
.LBB4_14:                               #   in Loop: Header=BB4_12 Depth=1
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%r13, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_16
# %bb.15:                               #   in Loop: Header=BB4_12 Depth=1
	movq	-96(%rbp), %rdi
	movq	-64(%rbp), %rsi
	movl	%r15d, %edx
	callq	_Z28__device_stub__downwardSweepPiS_i
.LBB4_16:                               #   in Loop: Header=BB4_12 Depth=1
	addl	%r12d, %r12d
	cmpl	%r15d, %r12d
	jb	.LBB4_12
.LBB4_17:                               # %._crit_edge100
	movq	-96(%rbp), %rdi
	callq	hipFree
	movslq	-44(%rbp), %rsi
	movl	%esi, %eax
	movq	%rsp, %r13
	leaq	15(,%rax,4), %rax
	andq	$-16, %rax
	subq	%rax, %r13
	movq	%r13, %rsp
	shlq	$2, %rsi
	leaq	-88(%rbp), %rdi
	callq	hipMalloc
	leaq	-120(%rbp), %r12
	movq	%r12, %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	movq	(%r12), %rdi
	movq	-80(%rbp), %rsi                 # 8-byte Reload
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	%r14, %rdi
	movl	$1, %esi
	movabsq	$4294967808, %rdx               # imm = 0x100000200
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_19
# %bb.18:
	movq	-88(%rbp), %rdi
	movq	-64(%rbp), %rsi
	movq	-120(%rbp), %rdx
	movl	%r15d, %ecx
	callq	_Z27__device_stub__fillOddArrayPiS_S_i
.LBB4_19:
	movq	-88(%rbp), %rsi
	movslq	-44(%rbp), %rdx
	shlq	$2, %rdx
	movq	%r13, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	-120(%rbp), %rdi
	callq	hipFree
	movq	-88(%rbp), %rdi
	callq	hipFree
	movq	-64(%rbp), %rdi
	callq	hipFree
	movl	$.L.str.5, %edi
	movl	$.L.str.6, %esi
	callq	fopen
	movq	%rax, %rbx
	movl	$.L.str.7, %edi
	movq	%rax, %rsi
	callq	fputs
	cmpl	$0, -44(%rbp)
	jle	.LBB4_24
# %bb.20:                               # %.lr.ph103.preheader
	leaq	-400(%rbp), %r14
	xorl	%r15d, %r15d
.LBB4_21:                               # %.lr.ph103
                                        # =>This Inner Loop Header: Depth=1
	movl	(%r13,%r15,4), %ecx
	movl	$255, %esi
	movl	$.L.str.3, %edx
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	snprintf
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	fputs
	movl	-44(%rbp), %eax
	leal	-1(%rax), %ecx
	cmpq	%rcx, %r15
	je	.LBB4_23
# %bb.22:                               #   in Loop: Header=BB4_21 Depth=1
	movl	$.L.str.8, %edi
	movq	%rbx, %rsi
	callq	fputs
	movl	-44(%rbp), %eax
.LBB4_23:                               #   in Loop: Header=BB4_21 Depth=1
	incq	%r15
	cltq
	cmpq	%rax, %r15
	jl	.LBB4_21
.LBB4_24:                               # %._crit_edge104
	movl	$.L.str.9, %edi
	movq	%rbx, %rsi
	callq	fputs
	movq	%rbx, %rdi
	callq	fclose
	xorl	%eax, %eax
	movq	-136(%rbp), %rsp                # 8-byte Reload
	jmp	.LBB4_25
.LBB4_4:
	movl	$-1, %eax
.LBB4_25:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa %rsp, 8
	retq
.Lfunc_end4:
	.size	main, .Lfunc_end4-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB5_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB5_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z11oddPopulatePiS_iS_, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z11upwardSweepPiS_ii, %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	$_Z13downwardSweepPiS_i, %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	$_Z12fillOddArrayPiS_S_i, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end5:
	.size	__hip_module_ctor, .Lfunc_end5-__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	.LBB6_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
.LBB6_2:
	retq
.Lfunc_end6:
	.size	__hip_module_dtor, .Lfunc_end6-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z11oddPopulatePiS_iS_,@object  # @_Z11oddPopulatePiS_iS_
	.section	.rodata,"a",@progbits
	.globl	_Z11oddPopulatePiS_iS_
	.p2align	3, 0x0
_Z11oddPopulatePiS_iS_:
	.quad	_Z26__device_stub__oddPopulatePiS_iS_
	.size	_Z11oddPopulatePiS_iS_, 8

	.type	_Z11upwardSweepPiS_ii,@object   # @_Z11upwardSweepPiS_ii
	.globl	_Z11upwardSweepPiS_ii
	.p2align	3, 0x0
_Z11upwardSweepPiS_ii:
	.quad	_Z26__device_stub__upwardSweepPiS_ii
	.size	_Z11upwardSweepPiS_ii, 8

	.type	_Z13downwardSweepPiS_i,@object  # @_Z13downwardSweepPiS_i
	.globl	_Z13downwardSweepPiS_i
	.p2align	3, 0x0
_Z13downwardSweepPiS_i:
	.quad	_Z28__device_stub__downwardSweepPiS_i
	.size	_Z13downwardSweepPiS_i, 8

	.type	_Z12fillOddArrayPiS_S_i,@object # @_Z12fillOddArrayPiS_S_i
	.globl	_Z12fillOddArrayPiS_S_i
	.p2align	3, 0x0
_Z12fillOddArrayPiS_S_i:
	.quad	_Z27__device_stub__fillOddArrayPiS_S_i
	.size	_Z12fillOddArrayPiS_S_i, 8

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

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"r"
	.size	.L.str.1, 2

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"%*s "
	.size	.L.str.2, 5

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"%d"
	.size	.L.str.3, 3

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	", %d"
	.size	.L.str.4, 5

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"q3.txt"
	.size	.L.str.5, 7

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

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"["
	.size	.L.str.7, 2

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

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"]"
	.size	.L.str.9, 2

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z11oddPopulatePiS_iS_"
	.size	.L__unnamed_1, 23

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z11upwardSweepPiS_ii"
	.size	.L__unnamed_2, 22

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z13downwardSweepPiS_i"
	.size	.L__unnamed_3, 23

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"_Z12fillOddArrayPiS_S_i"
	.size	.L__unnamed_4, 24

	.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 _Z26__device_stub__oddPopulatePiS_iS_
	.addrsig_sym _Z26__device_stub__upwardSweepPiS_ii
	.addrsig_sym _Z28__device_stub__downwardSweepPiS_i
	.addrsig_sym _Z27__device_stub__fillOddArrayPiS_S_i
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z11oddPopulatePiS_iS_
	.addrsig_sym _Z11upwardSweepPiS_ii
	.addrsig_sym _Z13downwardSweepPiS_i
	.addrsig_sym _Z12fillOddArrayPiS_S_i
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z11oddPopulatePiS_iS_  ; -- Begin function _Z11oddPopulatePiS_iS_
	.globl	_Z11oddPopulatePiS_iS_
	.p2align	8
	.type	_Z11oddPopulatePiS_iS_,@function
_Z11oddPopulatePiS_iS_:                 ; @_Z11oddPopulatePiS_iS_
; %bb.0:
	v_cmp_eq_u32_e32 vcc_lo, 0, v0
	s_mov_b32 s3, exec_lo
	v_cmpx_ne_u32_e32 0, v0
	s_cbranch_execz .LBB0_2
; %bb.1:
	v_mov_b32_e32 v1, 0
	ds_store_b32 v1, v1
.LBB0_2:
	s_or_b32 exec_lo, exec_lo, s3
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b32 s3, s[0:1], 0x10
	s_mov_b32 s4, exec_lo
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB0_9
; %bb.3:
	s_load_b128 s[8:11], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v2, s2, s8, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e64 v3, s2, s9, v1, s2
	v_add_co_u32 v0, s3, s10, v0
	v_add_co_ci_u32_e64 v1, s3, s11, v1, s3
	global_load_b32 v2, v[2:3], off
	s_mov_b32 s3, exec_lo
	s_waitcnt vmcnt(0)
	v_and_b32_e32 v2, 1, v2
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_eq_u32_e32 1, v2
	s_xor_b32 s3, exec_lo, s3
	s_cbranch_execz .LBB0_7
; %bb.4:
	s_mov_b32 s5, exec_lo
	v_mov_b32_e32 v3, 1
	v_mbcnt_lo_u32_b32 v2, s5, 0
	s_mov_b32 s6, exec_lo
	global_store_b32 v[0:1], v3, off
	v_cmpx_eq_u32_e32 0, v2
	s_cbranch_execz .LBB0_6
; %bb.5:
	s_bcnt1_i32_b32 s2, s5
	s_delay_alu instid0(SALU_CYCLE_1)
	v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
	ds_add_u32 v0, v1
.LBB0_6:                                ; %Flow20
	s_or_b32 exec_lo, exec_lo, s6
                                        ; implicit-def: $vgpr0_vgpr1
.LBB0_7:                                ; %Flow21
	s_and_not1_saveexec_b32 s2, s3
	s_cbranch_execz .LBB0_9
; %bb.8:
	v_mov_b32_e32 v2, 0
	global_store_b32 v[0:1], v2, off
.LBB0_9:
	s_or_b32 exec_lo, exec_lo, s4
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB0_12
; %bb.10:
	s_mov_b32 s2, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mbcnt_lo_u32_b32 v0, s2, 0
	v_cmp_eq_u32_e32 vcc_lo, 0, v0
	s_and_b32 s3, exec_lo, vcc_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 exec_lo, s3
	s_cbranch_execz .LBB0_12
; %bb.11:
	v_mov_b32_e32 v0, 0
	s_load_b64 s[0:1], s[0:1], 0x18
	s_bcnt1_i32_b32 s2, s2
	ds_load_b32 v1, v0
	s_waitcnt lgkmcnt(0)
	v_mul_lo_u32 v1, v1, s2
	global_atomic_add_u32 v0, v1, s[0:1]
.LBB0_12:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z11oddPopulatePiS_iS_
		.amdhsa_group_segment_fixed_size 4
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 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_end0:
	.size	_Z11oddPopulatePiS_iS_, .Lfunc_end0-_Z11oddPopulatePiS_iS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 396
; NumSgprs: 18
; NumVgprs: 4
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 4 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	_Z11upwardSweepPiS_ii   ; -- Begin function _Z11upwardSweepPiS_ii
	.globl	_Z11upwardSweepPiS_ii
	.p2align	8
	.type	_Z11upwardSweepPiS_ii,@function
_Z11upwardSweepPiS_ii:                  ; @_Z11upwardSweepPiS_ii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b64 s[4:5], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s5, v1
	s_cbranch_execz .LBB1_4
; %bb.1:
	s_load_b128 s[0:3], s[0:1], 0x0
	v_mov_b32_e32 v0, 0
	s_mov_b32 s5, exec_lo
	v_cmpx_le_i32_e64 s4, v1
	s_cbranch_execz .LBB1_3
; %bb.2:
	v_subrev_nc_u32_e32 v2, s4, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, s2, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s3, v3, vcc_lo
	global_load_b32 v0, v[2:3], off
.LBB1_3:                                ; %.sink.split
	s_or_b32 exec_lo, exec_lo, s5
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[1:2], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v1, vcc_lo, s0, v1
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v2, vcc_lo, s1, v2, vcc_lo
	s_waitcnt vmcnt(0)
	global_store_b32 v[1:2], v0, off
.LBB1_4:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z11upwardSweepPiS_ii
		.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_end1:
	.size	_Z11upwardSweepPiS_ii, .Lfunc_end1-_Z11upwardSweepPiS_ii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 200
; 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	_Z13downwardSweepPiS_i  ; -- Begin function _Z13downwardSweepPiS_i
	.globl	_Z13downwardSweepPiS_i
	.p2align	8
	.type	_Z13downwardSweepPiS_i,@function
_Z13downwardSweepPiS_i:                 ; @_Z13downwardSweepPiS_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x24
	s_load_b32 s3, s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB2_2
; %bb.1:
	s_load_b128 s[0:3], s[0:1], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v2, vcc_lo, s2, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s3, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_load_b32 v4, v[2:3], off
	global_load_b32 v0, v[0:1], off
	s_waitcnt vmcnt(0)
	v_add_nc_u32_e32 v0, v0, v4
	global_store_b32 v[2:3], v0, off
.LBB2_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13downwardSweepPiS_i
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 5
		.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	_Z13downwardSweepPiS_i, .Lfunc_end2-_Z13downwardSweepPiS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 160
; NumSgprs: 18
; NumVgprs: 5
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 5
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z12fillOddArrayPiS_S_i ; -- Begin function _Z12fillOddArrayPiS_S_i
	.globl	_Z12fillOddArrayPiS_S_i
	.p2align	8
	.type	_Z12fillOddArrayPiS_S_i,@function
_Z12fillOddArrayPiS_S_i:                ; @_Z12fillOddArrayPiS_S_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b32 s3, s[0:1], 0x18
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB3_3
; %bb.1:
	s_load_b64 s[2:3], s[0:1], 0x10
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v2, vcc_lo, s2, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v3, vcc_lo, s3, v1, vcc_lo
	global_load_b32 v2, v[2:3], off
	s_waitcnt vmcnt(0)
	v_and_b32_e32 v3, 0x80000001, v2
	v_cmp_eq_u32_e32 vcc_lo, 1, v3
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB3_3
; %bb.2:
	s_load_b128 s[0:3], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s2, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	global_load_b32 v0, v[0:1], off
	s_waitcnt vmcnt(0)
	v_ashrrev_i32_e32 v1, 31, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	v_add_co_u32 v0, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_store_b32 v[0:1], v2, off offset:-4
.LBB3_3:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z12fillOddArrayPiS_S_i
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 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	_Z12fillOddArrayPiS_S_i, .Lfunc_end3-_Z12fillOddArrayPiS_S_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 224
; 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 : 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
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 4
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z11oddPopulatePiS_iS_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z11oddPopulatePiS_iS_.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:         20
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z11upwardSweepPiS_ii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z11upwardSweepPiS_ii.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
    .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:           _Z13downwardSweepPiS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z13downwardSweepPiS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     5
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z12fillOddArrayPiS_S_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z12fillOddArrayPiS_S_i.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
