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


void initData(void);
void initValues(void);
void initValuesLin(void);

void calculateMovingAverage(void);
void calculateMovingAverageCuda(void);
__global__ void kernelMovingAverage(double *MOV_LIN_D, double *DATA_LIN_D, int *ROWS);

void calculateColumnAverage(void);
void calculateColumnAverageCuda(void);
__global__ void kernelColumnAverage(double *AVG_D, double *DATA_LIN_D, int *COLUMNS, int *ELEMS_AVG);

void showData(void);
void showMov(void);
void showColAverage(void);
void showMovCuda(void);
void showColAverageCuda(void);

void checkResults(void);

void freeAll(void);

double **DATA;
double **MOV;

double *DATA_LIN;
double *DATA_TRANSPOSED_LIN;
double *MOV_LIN;

double *DATA_TRANSPOSED_LIN_D;
double *AVG_D;

double *AVG;
double *AVG_CUDA;

const int OK = 1;
const int KO = 0;

int COLUMNS;
int ROWS;
int ELEMS_AVG;
int TOTAL_CELLS;

void initData(void) {
	int i;

	AVG = (double *) malloc(COLUMNS * sizeof(double));
	AVG_CUDA = (double *) malloc(COLUMNS * sizeof(double));
	DATA = (double **) malloc(ROWS * sizeof(double *));
	MOV = (double **) malloc(ROWS * sizeof(double *));
	DATA_LIN  = (double *) malloc(TOTAL_CELLS * sizeof(double));
	DATA_TRANSPOSED_LIN = (double *) malloc(TOTAL_CELLS * sizeof(double));
	MOV_LIN = (double *) malloc(TOTAL_CELLS * sizeof(double));

	for (i = 0; i < ROWS; i++) {
		DATA[i] = (double *) malloc(COLUMNS * sizeof(double));
		MOV[i] = (double *) malloc(COLUMNS * sizeof(double *));
	}

	initValues();
}

void initValues(void) {
	int i, j;

	srand(time(NULL));

	for (i = 0; i < ROWS; i++) {
		for (j = 0; j < COLUMNS; j++) {
			DATA[i][j] = (100.0 * rand()) / ((double) RAND_MAX);
			MOV[i][j] = 0.0;
		}
	}

	for (i = 0; i < COLUMNS; i++) {
		AVG[i] = 0.0;
		AVG_CUDA[i] = 0.0;
	}

	initValuesLin();
}

void initValuesLin(void) {
	int i, j, k, l;

	srand(time(NULL));

	for (i = 0; i < ROWS; i++) {
		for (j = 0; j < COLUMNS; j++) {
			k = i * COLUMNS + j;
			l = j * ROWS + i;
			DATA_LIN[k] = DATA[i][j];
			MOV_LIN[k] = MOV[i][j];
			DATA_TRANSPOSED_LIN[l] = DATA[i][j];
		}
	}
}


int canShow() {
	if ((ROWS <= 15) && (COLUMNS <= 15)) {
		return 1;
	} else {
		return 0;
	}
}

void showData(void) {
	int x, y;

	if (!canShow()) return;

	for (y = 0; y < ROWS; y++) {
		for (x = 0; x < COLUMNS; x++) {
			printf("%07.4f ", DATA[y][x]);
		}
		printf("\n");
	}
	printf("\n");
}

void showMov(void) {
	int x, y;

	if (!canShow()) return;

	for (y = 0; y < ROWS; y++) {
		for (x = 0; x < COLUMNS; x++) {
			printf("%07.4f ", MOV[y][x]);
		}
		printf("\n");
	}
	printf("\n");
}

void showMovCuda(void)  {
	int x, y;

	if (!canShow()) return;

	for (y = 0; y < ROWS; y++) {
		for (x = 0; x < COLUMNS; x++) {
			printf("%07.4f ", MOV_LIN[y * COLUMNS + x]);
		}
		printf("\n");
	}
	printf("\n");

}

void showColAverage(void) {
	int x;

	if (!canShow()) return;

	for (x = 0; x < COLUMNS; x++) {
		printf("%07.4f ", AVG[x]);
	}
	printf("\n\n");
}

void showColAverageCuda(void) {
	int x;

	if (!canShow()) return;

	for (x = 0; x < COLUMNS; x++) {
		printf("%07.4f ", AVG_CUDA[x]);
	}
	printf("\n\n");
}

void calculateMovingAverage(void) {
    int x, y;
	int i;

	for (y = 0; y < ROWS; y++) {
		for (x = 0; x < COLUMNS; x++) {
	        MOV[y][x] = DATA[y][x];
	        for(i = 1; i <= 8; i++) {
	            if ((x - i) >= 0) {MOV[y][x] = MOV[y][x] + DATA[y][x - i];}
	        }
	        MOV[y][x] = MOV[y][x] / ELEMS_AVG;
		}
	}
}

void calculateColumnAverage(void) {
    int x, y;

	for (x = 0; x < COLUMNS; x++) {
		for (y = 0; y < ROWS; y++) {
			AVG[x] = AVG[x] + DATA[y][x];
		}
	    AVG[x] = AVG[x] / ROWS;
	}
}

__global__ void kernelMovingAverage(double *MOV_LIN_D, double *DATA_LIN_D, int *COLUMNS, int *ELEMS_AVG) {
	int i;
	int posIni;
	double cell;
        int columns;
        int elemsAvg;
        int row;
        int column;

        columns = *COLUMNS;
        elemsAvg = *ELEMS_AVG;
        row = blockIdx.x;
        column = threadIdx.x;

	cell = 0.0;

	posIni = row * columns + column;
	cell = DATA_LIN_D[posIni];

        for(i = 1; i <= 8; i++) {
            if ((column - i) >= 0) {
                cell = cell + DATA_LIN_D[posIni - i];
            }
        }
	
        cell = cell / elemsAvg;

	MOV_LIN_D[posIni] = cell;
}

void calculateMovingAverageCuda() {
        double *DATA_LIN_D;
        double *MOV_LIN_D;
	int *COLUMNS_D;
        int *ELEMS_AVG_D;

        cudaMalloc((void **) &DATA_LIN_D, TOTAL_CELLS * sizeof(double));
	cudaMalloc((void **) &MOV_LIN_D, TOTAL_CELLS * sizeof(double));
        cudaMalloc((void **) &COLUMNS_D, sizeof(int));
        cudaMalloc((void **) &ELEMS_AVG_D, sizeof(int));

	cudaMemcpy(DATA_LIN_D, DATA_LIN, TOTAL_CELLS * sizeof(double), cudaMemcpyHostToDevice );
        cudaMemcpy(MOV_LIN_D, MOV_LIN, TOTAL_CELLS * sizeof(double), cudaMemcpyHostToDevice );
        cudaMemcpy(COLUMNS_D, &COLUMNS, sizeof(int), cudaMemcpyHostToDevice);
        cudaMemcpy(ELEMS_AVG_D, &ELEMS_AVG, sizeof(int), cudaMemcpyHostToDevice);

        dim3 numColumns(COLUMNS, 1);
        dim3 numRows(ROWS, 1);
        kernelMovingAverage<<<numRows, numColumns>>>(MOV_LIN_D, DATA_LIN_D, COLUMNS_D, ELEMS_AVG_D);

	cudaMemcpy(MOV_LIN, MOV_LIN_D, TOTAL_CELLS * sizeof(double), cudaMemcpyDeviceToHost);

        cudaFree(COLUMNS_D);
        cudaFree(ELEMS_AVG_D);
	cudaFree(MOV_LIN_D);
	cudaFree(DATA_LIN_D);
}

__global__ void kernelColumnAverage(double *AVG_D, double *DATA_LIN_D, int *ROWS) {
	int i;
	int posIni;
	int posFin;
        int rows;
	double cell;

        rows = *ROWS;

	cell = 0.0;

	posIni = threadIdx.x * rows;
	posFin = posIni + rows;


	for (i = posIni; i < posFin; i++) {
		cell = cell + DATA_LIN_D[i];
	}

	cell = cell / rows;

	AVG_D[threadIdx.x] = cell;
}

void calculateColumnAverageCuda(void) {
        double *DATA_TRANSPOSED_LIN_D;
        double *AVG_D;
        int *ROWS_D;

	cudaMalloc((void **) &DATA_TRANSPOSED_LIN_D, TOTAL_CELLS * sizeof(double));
	cudaMalloc((void **) &AVG_D, COLUMNS * sizeof(double));
        cudaMalloc((void **) &ROWS_D, sizeof(int));

	cudaMemcpy(DATA_TRANSPOSED_LIN_D, DATA_TRANSPOSED_LIN, TOTAL_CELLS * sizeof(double), cudaMemcpyHostToDevice);
        cudaMemcpy(AVG_D, AVG, COLUMNS * sizeof(double), cudaMemcpyHostToDevice);
        cudaMemcpy(ROWS_D, &ROWS, sizeof(int), cudaMemcpyHostToDevice);

        dim3 numColumns(COLUMNS, 1);
        dim3 numRows(1, 1);
	kernelColumnAverage<<<numRows, numColumns>>>(AVG_D, DATA_TRANSPOSED_LIN_D, ROWS_D);

	cudaMemcpy(AVG_CUDA, AVG_D, COLUMNS * sizeof(double), cudaMemcpyDeviceToHost);

        cudaFree(ROWS_D);
	cudaFree(DATA_TRANSPOSED_LIN_D);
	cudaFree(AVG_D);
}

void  checkResults(void) {
	int y,x, k;
	double diff;
	double epsilon;
	int result;

	result= OK;
	epsilon = 0.0000001;

	for(y = 0; y < ROWS; y++) {
		for(x = 0; x < COLUMNS; x++) {
			k = y * COLUMNS + x;
			diff = abs(MOV[y][x] - MOV_LIN[k]);

			if (diff > epsilon) {
				result = KO;
				break;
			}
		}
	}

	printf("\nCheck result moving average : %d\n\n", result);

	result= OK;

	for(x = 0; x < COLUMNS; x++) {
	    diff = abs(AVG[x] - AVG_CUDA[x]);

	    if (diff > epsilon) {
		    result = KO;
			break;
		}
	}

	printf("Check result column average : %d\n\n", result);
}


void freeAll(void) {
	int y;

	free(AVG);
	for (y = 0; y < ROWS; y++) {
		free(DATA[y]);
		free(MOV[y]);
	}

	free(DATA);
	free(MOV);
}

int main(int argc, char**argv) {
	if (argc != 3) {
		printf("usage: exercici_cuda N M\n N : number of rows\n M number of columns\n\n");
	    ROWS = 5;
	    COLUMNS = 10;
	} else {
	    ROWS = atoi(argv[1]);
	    COLUMNS = atoi(argv[2]);
	}

	ELEMS_AVG = 9;
	TOTAL_CELLS = ROWS * COLUMNS;

	initData();

	showData();

	calculateMovingAverage();
	showMov();

	calculateColumnAverage();
	showColAverage();

	calculateMovingAverageCuda();
	showMovCuda();

	calculateColumnAverageCuda();
	showColAverageCuda();

	checkResults();

	freeAll();
}

	.file	"tmpxft_002dcc94_00000000-6_cuda.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2045:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2045:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z13initValuesLinv
	.type	_Z13initValuesLinv, @function
_Z13initValuesLinv:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%edi, %edi
	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
	pushq	%rdx
	.cfi_def_cfa_offset 64
	call	time@PLT
	movl	%eax, %edi
	call	srand@PLT
	movslq	ROWS(%rip), %r9
	xorl	%edi, %edi
	xorl	%esi, %esi
	movl	COLUMNS(%rip), %r10d
	movq	DATA(%rip), %rbp
	movq	DATA_LIN(%rip), %r12
	movq	MOV(%rip), %r13
	movq	%r9, %r11
	salq	$3, %r9
	movq	MOV_LIN(%rip), %r14
	movq	DATA_TRANSPOSED_LIN(%rip), %rbx
.L3:
	cmpl	%esi, %r11d
	jle	.L2
	movslq	%edi, %rax
	leaq	(%rbx,%rsi,8), %r8
	xorl	%edx, %edx
	salq	$3, %rax
.L6:
	cmpl	%edx, %r10d
	jle	.L9
	movq	0(%rbp,%rsi,8), %rcx
	movq	0(%r13,%rsi,8), %r15
	leaq	(%rcx,%rdx,8), %rcx
	movsd	(%rcx), %xmm0
	movsd	%xmm0, (%r12,%rax)
	movsd	(%r15,%rdx,8), %xmm0
	incq	%rdx
	movsd	%xmm0, (%r14,%rax)
	movsd	(%rcx), %xmm0
	addq	$8, %rax
	movsd	%xmm0, (%r8)
	addq	%r9, %r8
	jmp	.L6
.L9:
	incq	%rsi
	addl	%r10d, %edi
	jmp	.L3
.L2:
	popq	%rax
	.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
.LFE2029:
	.size	_Z13initValuesLinv, .-_Z13initValuesLinv
	.globl	_Z10initValuesv
	.type	_Z10initValuesv, @function
_Z10initValuesv:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorl	%edi, %edi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	call	time@PLT
	movl	%eax, %edi
	call	srand@PLT
.L11:
	cmpl	%ebp, ROWS(%rip)
	jle	.L13
	leaq	0(,%rbp,8), %r12
	xorl	%ebx, %ebx
.L14:
	cmpl	%ebx, COLUMNS(%rip)
	jle	.L18
	call	rand@PLT
	movl	%eax, %edx
	movq	DATA(%rip), %rax
	cvtsi2sdl	%edx, %xmm0
	mulsd	.LC0(%rip), %xmm0
	movq	(%rax,%r12), %rax
	divsd	.LC1(%rip), %xmm0
	movsd	%xmm0, (%rax,%rbx,8)
	movq	MOV(%rip), %rax
	movq	(%rax,%r12), %rax
	movq	$0x000000000, (%rax,%rbx,8)
	incq	%rbx
	jmp	.L14
.L18:
	incq	%rbp
	jmp	.L11
.L13:
	movl	COLUMNS(%rip), %edx
	movq	AVG(%rip), %rcx
	xorl	%eax, %eax
	movq	AVG_CUDA(%rip), %rsi
.L15:
	cmpl	%eax, %edx
	jle	.L19
	movq	$0x000000000, (%rcx,%rax,8)
	movq	$0x000000000, (%rsi,%rax,8)
	incq	%rax
	jmp	.L15
.L19:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	jmp	_Z13initValuesLinv
	.cfi_endproc
.LFE2028:
	.size	_Z10initValuesv, .-_Z10initValuesv
	.globl	_Z8initDatav
	.type	_Z8initDatav, @function
_Z8initDatav:
.LFB2027:
	.cfi_startproc
	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
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movslq	COLUMNS(%rip), %rbx
	salq	$3, %rbx
	movq	%rbx, %rdi
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, AVG(%rip)
	call	malloc@PLT
	movslq	ROWS(%rip), %rbp
	movq	%rax, AVG_CUDA(%rip)
	movq	%rbp, %r14
	salq	$3, %rbp
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, DATA(%rip)
	movq	%rax, %r12
	call	malloc@PLT
	movslq	TOTAL_CELLS(%rip), %rbp
	movq	%rax, MOV(%rip)
	movq	%rax, %r13
	salq	$3, %rbp
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, DATA_LIN(%rip)
	call	malloc@PLT
	movq	%rbp, %rdi
	xorl	%ebp, %ebp
	movq	%rax, DATA_TRANSPOSED_LIN(%rip)
	call	malloc@PLT
	movq	%rax, MOV_LIN(%rip)
.L21:
	cmpl	%ebp, %r14d
	jle	.L24
	movq	%rbx, %rdi
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, (%r12,%rbp,8)
	call	malloc@PLT
	movq	%rax, 0(%r13,%rbp,8)
	incq	%rbp
	jmp	.L21
.L24:
	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
	jmp	_Z10initValuesv
	.cfi_endproc
.LFE2027:
	.size	_Z8initDatav, .-_Z8initDatav
	.globl	_Z7canShowv
	.type	_Z7canShowv, @function
_Z7canShowv:
.LFB2030:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	cmpl	$15, ROWS(%rip)
	jg	.L25
	xorl	%eax, %eax
	cmpl	$15, COLUMNS(%rip)
	setle	%al
.L25:
	ret
	.cfi_endproc
.LFE2030:
	.size	_Z7canShowv, .-_Z7canShowv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC3:
	.string	"%07.4f "
.LC4:
	.string	"\n"
	.text
	.globl	_Z8showDatav
	.type	_Z8showDatav, @function
_Z8showDatav:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC3(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	pushq	%rcx
	.cfi_def_cfa_offset 48
	call	_Z7canShowv
	testl	%eax, %eax
	je	.L35
.L30:
	cmpl	%ebp, ROWS(%rip)
	jle	.L32
	leaq	0(,%rbp,8), %r12
	xorl	%ebx, %ebx
.L33:
	cmpl	%ebx, COLUMNS(%rip)
	jle	.L36
	movq	DATA(%rip), %rax
	movq	%r13, %rsi
	movl	$2, %edi
	movq	(%rax,%r12), %rax
	movsd	(%rax,%rbx,8), %xmm0
	movb	$1, %al
	incq	%rbx
	call	__printf_chk@PLT
	jmp	.L33
.L36:
	leaq	.LC4(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%rbp
	call	__printf_chk@PLT
	jmp	.L30
.L32:
	popq	%rdx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	leaq	.LC4(%rip), %rsi
	popq	%rbx
	.cfi_def_cfa_offset 32
	movl	$2, %edi
	popq	%rbp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
.L35:
	.cfi_restore_state
	popq	%rax
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2031:
	.size	_Z8showDatav, .-_Z8showDatav
	.globl	_Z7showMovv
	.type	_Z7showMovv, @function
_Z7showMovv:
.LFB2032:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC3(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	pushq	%rcx
	.cfi_def_cfa_offset 48
	call	_Z7canShowv
	testl	%eax, %eax
	je	.L44
.L39:
	cmpl	%ebp, ROWS(%rip)
	jle	.L41
	leaq	0(,%rbp,8), %r12
	xorl	%ebx, %ebx
.L42:
	cmpl	%ebx, COLUMNS(%rip)
	jle	.L45
	movq	MOV(%rip), %rax
	movq	%r13, %rsi
	movl	$2, %edi
	movq	(%rax,%r12), %rax
	movsd	(%rax,%rbx,8), %xmm0
	movb	$1, %al
	incq	%rbx
	call	__printf_chk@PLT
	jmp	.L42
.L45:
	leaq	.LC4(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%rbp
	call	__printf_chk@PLT
	jmp	.L39
.L41:
	popq	%rdx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	leaq	.LC4(%rip), %rsi
	popq	%rbx
	.cfi_def_cfa_offset 32
	movl	$2, %edi
	popq	%rbp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
.L44:
	.cfi_restore_state
	popq	%rax
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2032:
	.size	_Z7showMovv, .-_Z7showMovv
	.globl	_Z11showMovCudav
	.type	_Z11showMovCudav, @function
_Z11showMovCudav:
.LFB2033:
	.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
	leaq	.LC3(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
	call	_Z7canShowv
	testl	%eax, %eax
	je	.L53
.L48:
	cmpl	ROWS(%rip), %ebx
	jge	.L54
	xorl	%r12d, %r12d
.L50:
	movl	COLUMNS(%rip), %eax
	cmpl	%r12d, %eax
	jle	.L55
	imull	%ebx, %eax
	movq	MOV_LIN(%rip), %rdx
	movq	%rbp, %rsi
	movl	$2, %edi
	addl	%r12d, %eax
	incl	%r12d
	cltq
	movsd	(%rdx,%rax,8), %xmm0
	movb	$1, %al
	call	__printf_chk@PLT
	jmp	.L50
.L55:
	leaq	.LC4(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incl	%ebx
	call	__printf_chk@PLT
	jmp	.L48
.L54:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	leaq	.LC4(%rip), %rsi
	popq	%rbp
	.cfi_def_cfa_offset 16
	movl	$2, %edi
	xorl	%eax, %eax
	popq	%r12
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
.L53:
	.cfi_restore_state
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2033:
	.size	_Z11showMovCudav, .-_Z11showMovCudav
	.section	.rodata.str1.1
.LC5:
	.string	"\n\n"
	.text
	.globl	_Z14showColAveragev
	.type	_Z14showColAveragev, @function
_Z14showColAveragev:
.LFB2034:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC3(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	xorl	%ebx, %ebx
	pushq	%rcx
	.cfi_def_cfa_offset 32
	call	_Z7canShowv
	testl	%eax, %eax
	je	.L61
.L58:
	cmpl	%ebx, COLUMNS(%rip)
	jle	.L62
	movq	AVG(%rip), %rax
	movq	%rbp, %rsi
	movl	$2, %edi
	movsd	(%rax,%rbx,8), %xmm0
	movb	$1, %al
	incq	%rbx
	call	__printf_chk@PLT
	jmp	.L58
.L62:
	popq	%rdx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	leaq	.LC5(%rip), %rsi
	popq	%rbx
	.cfi_def_cfa_offset 16
	movl	$2, %edi
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
.L61:
	.cfi_restore_state
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2034:
	.size	_Z14showColAveragev, .-_Z14showColAveragev
	.globl	_Z18showColAverageCudav
	.type	_Z18showColAverageCudav, @function
_Z18showColAverageCudav:
.LFB2035:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC3(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	xorl	%ebx, %ebx
	pushq	%rcx
	.cfi_def_cfa_offset 32
	call	_Z7canShowv
	testl	%eax, %eax
	je	.L68
.L65:
	cmpl	%ebx, COLUMNS(%rip)
	jle	.L69
	movq	AVG_CUDA(%rip), %rax
	movq	%rbp, %rsi
	movl	$2, %edi
	movsd	(%rax,%rbx,8), %xmm0
	movb	$1, %al
	incq	%rbx
	call	__printf_chk@PLT
	jmp	.L65
.L69:
	popq	%rdx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	leaq	.LC5(%rip), %rsi
	popq	%rbx
	.cfi_def_cfa_offset 16
	movl	$2, %edi
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
.L68:
	.cfi_restore_state
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2035:
	.size	_Z18showColAverageCudav, .-_Z18showColAverageCudav
	.globl	_Z22calculateMovingAveragev
	.type	_Z22calculateMovingAveragev, @function
_Z22calculateMovingAveragev:
.LFB2036:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	ROWS(%rip), %r9d
	xorl	%edx, %edx
	movl	COLUMNS(%rip), %ebp
	movq	DATA(%rip), %r10
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	MOV(%rip), %r11
	movl	ELEMS_AVG(%rip), %ebx
.L71:
	cmpl	%edx, %r9d
	jle	.L79
	xorl	%edi, %edi
	xorl	%esi, %esi
.L75:
	cmpl	%esi, %ebp
	jle	.L80
	movq	(%r10,%rdx,8), %rax
	movq	(%r11,%rdx,8), %rcx
	movl	$1, %r8d
	addq	%rdi, %rax
	addq	%rdi, %rcx
	movsd	(%rax), %xmm0
	movsd	%xmm0, (%rcx)
.L73:
	cmpl	%r8d, %esi
	js	.L72
	movsd	(%rcx), %xmm0
	addsd	-8(%rax), %xmm0
	movsd	%xmm0, (%rcx)
.L72:
	incl	%r8d
	subq	$8, %rax
	cmpl	$9, %r8d
	jne	.L73
	cvtsi2sdl	%ebx, %xmm1
	movsd	(%rcx), %xmm0
	incl	%esi
	addq	$8, %rdi
	divsd	%xmm1, %xmm0
	movsd	%xmm0, (%rcx)
	jmp	.L75
.L80:
	incq	%rdx
	jmp	.L71
.L79:
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2036:
	.size	_Z22calculateMovingAveragev, .-_Z22calculateMovingAveragev
	.globl	_Z22calculateColumnAveragev
	.type	_Z22calculateColumnAveragev, @function
_Z22calculateColumnAveragev:
.LFB2037:
	.cfi_startproc
	endbr64
	movl	COLUMNS(%rip), %r9d
	movl	ROWS(%rip), %esi
	xorl	%eax, %eax
	movq	AVG(%rip), %rcx
	movq	DATA(%rip), %r8
.L82:
	cmpl	%eax, %r9d
	jle	.L81
	leaq	0(,%rax,8), %rdi
	xorl	%edx, %edx
.L85:
	movsd	(%rcx,%rax,8), %xmm0
	cmpl	%edx, %esi
	jle	.L86
	movq	(%r8,%rdx,8), %r10
	incq	%rdx
	addsd	(%r10,%rdi), %xmm0
	movsd	%xmm0, (%rcx,%rax,8)
	jmp	.L85
.L86:
	cvtsi2sdl	%esi, %xmm1
	divsd	%xmm1, %xmm0
	movsd	%xmm0, (%rcx,%rax,8)
	incq	%rax
	jmp	.L82
.L81:
	ret
	.cfi_endproc
.LFE2037:
	.size	_Z22calculateColumnAveragev, .-_Z22calculateColumnAveragev
	.section	.rodata.str1.1
.LC8:
	.string	"\nCheck result moving average : %d\n\n"
.LC9:
	.string	"Check result column average : %d\n\n"
	.text
	.globl	_Z12checkResultsv
	.type	_Z12checkResultsv, @function
_Z12checkResultsv:
.LFB2040:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	ROWS(%rip), %r11d
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	movl	COLUMNS(%rip), %edi
	movq	MOV(%rip), %r10
	movl	$1, %esi
	movq	MOV_LIN(%rip), %r9
	movq	.LC6(%rip), %xmm1
	movsd	.LC7(%rip), %xmm2
.L88:
	cmpl	%edx, %r11d
	jle	.L91
	movslq	%ecx, %rax
	leaq	(%r9,%rax,8), %r8
	xorl	%eax, %eax
.L92:
	cmpl	%eax, %edi
	jle	.L89
	movq	(%r10,%rdx,8), %rbx
	movsd	(%rbx,%rax,8), %xmm0
	subsd	(%r8,%rax,8), %xmm0
	incq	%rax
	andps	%xmm1, %xmm0
	comisd	%xmm2, %xmm0
	jbe	.L92
	xorl	%esi, %esi
.L89:
	incq	%rdx
	addl	%edi, %ecx
	jmp	.L88
.L91:
	movl	%esi, %edx
	movl	$2, %edi
	leaq	.LC8(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	COLUMNS(%rip), %edx
	xorl	%eax, %eax
	movq	AVG(%rip), %rcx
	movq	AVG_CUDA(%rip), %rsi
	movq	.LC6(%rip), %xmm1
	movsd	.LC7(%rip), %xmm2
.L93:
	cmpl	%eax, %edx
	jle	.L99
	movsd	(%rcx,%rax,8), %xmm0
	subsd	(%rsi,%rax,8), %xmm0
	incq	%rax
	andps	%xmm1, %xmm0
	comisd	%xmm2, %xmm0
	jbe	.L93
	xorl	%edx, %edx
	jmp	.L94
.L99:
	movl	$1, %edx
.L94:
	leaq	.LC9(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2040:
	.size	_Z12checkResultsv, .-_Z12checkResultsv
	.globl	_Z7freeAllv
	.type	_Z7freeAllv, @function
_Z7freeAllv:
.LFB2041:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	AVG(%rip), %rdi
	xorl	%ebx, %ebx
	call	free@PLT
.L101:
	cmpl	%ebx, ROWS(%rip)
	movq	DATA(%rip), %rdi
	jle	.L104
	movq	(%rdi,%rbx,8), %rdi
	call	free@PLT
	movq	MOV(%rip), %rax
	movq	(%rax,%rbx,8), %rdi
	incq	%rbx
	call	free@PLT
	jmp	.L101
.L104:
	call	free@PLT
	movq	MOV(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	free@PLT
	.cfi_endproc
.LFE2041:
	.size	_Z7freeAllv, .-_Z7freeAllv
	.globl	_Z46__device_stub__Z19kernelMovingAveragePdS_PiS0_PdS_PiS0_
	.type	_Z46__device_stub__Z19kernelMovingAveragePdS_PiS0_PdS_PiS0_, @function
_Z46__device_stub__Z19kernelMovingAveragePdS_PiS0_PdS_PiS0_:
.LFB2067:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%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	8(%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	.L105
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z19kernelMovingAveragePdS_PiS0_(%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
.L105:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L107
	call	__stack_chk_fail@PLT
.L107:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2067:
	.size	_Z46__device_stub__Z19kernelMovingAveragePdS_PiS0_PdS_PiS0_, .-_Z46__device_stub__Z19kernelMovingAveragePdS_PiS0_PdS_PiS0_
	.globl	_Z19kernelMovingAveragePdS_PiS0_
	.type	_Z19kernelMovingAveragePdS_PiS0_, @function
_Z19kernelMovingAveragePdS_PiS0_:
.LFB2068:
	.cfi_startproc
	endbr64
	jmp	_Z46__device_stub__Z19kernelMovingAveragePdS_PiS0_PdS_PiS0_
	.cfi_endproc
.LFE2068:
	.size	_Z19kernelMovingAveragePdS_PiS0_, .-_Z19kernelMovingAveragePdS_PiS0_
	.globl	_Z26calculateMovingAverageCudav
	.type	_Z26calculateMovingAverageCudav, @function
_Z26calculateMovingAverageCudav:
.LFB2038:
	.cfi_startproc
	endbr64
	subq	$72, %rsp
	.cfi_def_cfa_offset 80
	movslq	TOTAL_CELLS(%rip), %rsi
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rdi
	salq	$3, %rsi
	call	cudaMalloc@PLT
	movslq	TOTAL_CELLS(%rip), %rsi
	leaq	8(%rsp), %rdi
	salq	$3, %rsi
	call	cudaMalloc@PLT
	leaq	16(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	leaq	24(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movslq	TOTAL_CELLS(%rip), %rdx
	movq	(%rsp), %rdi
	movl	$1, %ecx
	movq	DATA_LIN(%rip), %rsi
	salq	$3, %rdx
	call	cudaMemcpy@PLT
	movq	8(%rsp), %rdi
	movl	$1, %ecx
	movslq	TOTAL_CELLS(%rip), %rdx
	movq	MOV_LIN(%rip), %rsi
	salq	$3, %rdx
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movl	$4, %edx
	leaq	COLUMNS(%rip), %rsi
	call	cudaMemcpy@PLT
	movq	24(%rsp), %rdi
	movl	$1, %ecx
	movl	$4, %edx
	leaq	ELEMS_AVG(%rip), %rsi
	call	cudaMemcpy@PLT
	movl	COLUMNS(%rip), %eax
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	ROWS(%rip), %edx
	movl	%eax, 32(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 36(%rsp)
	movl	40(%rsp), %ecx
	movl	%edx, 44(%rsp)
	movq	32(%rsp), %rdx
	movq	%rax, 48(%rsp)
	movq	44(%rsp), %rdi
	movl	52(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L111
	movq	24(%rsp), %rcx
	movq	16(%rsp), %rdx
	movq	(%rsp), %rsi
	movq	8(%rsp), %rdi
	call	_Z46__device_stub__Z19kernelMovingAveragePdS_PiS0_PdS_PiS0_
.L111:
	movslq	TOTAL_CELLS(%rip), %rdx
	movq	8(%rsp), %rsi
	movl	$2, %ecx
	movq	MOV_LIN(%rip), %rdi
	salq	$3, %rdx
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L112
	call	__stack_chk_fail@PLT
.L112:
	addq	$72, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2038:
	.size	_Z26calculateMovingAverageCudav, .-_Z26calculateMovingAverageCudav
	.globl	_Z43__device_stub__Z19kernelColumnAveragePdS_PiPdS_Pi
	.type	_Z43__device_stub__Z19kernelColumnAveragePdS_PiPdS_Pi, @function
_Z43__device_stub__Z19kernelColumnAveragePdS_PiPdS_Pi:
.LFB2069:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L114
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z19kernelColumnAveragePdS_Pi(%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
.L114:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L116
	call	__stack_chk_fail@PLT
.L116:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2069:
	.size	_Z43__device_stub__Z19kernelColumnAveragePdS_PiPdS_Pi, .-_Z43__device_stub__Z19kernelColumnAveragePdS_PiPdS_Pi
	.globl	_Z19kernelColumnAveragePdS_Pi
	.type	_Z19kernelColumnAveragePdS_Pi, @function
_Z19kernelColumnAveragePdS_Pi:
.LFB2070:
	.cfi_startproc
	endbr64
	jmp	_Z43__device_stub__Z19kernelColumnAveragePdS_PiPdS_Pi
	.cfi_endproc
.LFE2070:
	.size	_Z19kernelColumnAveragePdS_Pi, .-_Z19kernelColumnAveragePdS_Pi
	.globl	_Z26calculateColumnAverageCudav
	.type	_Z26calculateColumnAverageCudav, @function
_Z26calculateColumnAverageCudav:
.LFB2039:
	.cfi_startproc
	endbr64
	subq	$72, %rsp
	.cfi_def_cfa_offset 80
	movslq	TOTAL_CELLS(%rip), %rsi
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdi
	salq	$3, %rsi
	call	cudaMalloc@PLT
	movslq	COLUMNS(%rip), %rsi
	leaq	16(%rsp), %rdi
	salq	$3, %rsi
	call	cudaMalloc@PLT
	leaq	24(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movq	8(%rsp), %rdi
	movl	$1, %ecx
	movslq	TOTAL_CELLS(%rip), %rdx
	movq	DATA_TRANSPOSED_LIN(%rip), %rsi
	salq	$3, %rdx
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movslq	COLUMNS(%rip), %rdx
	movq	AVG(%rip), %rsi
	salq	$3, %rdx
	call	cudaMemcpy@PLT
	movq	24(%rsp), %rdi
	movl	$1, %ecx
	movl	$4, %edx
	leaq	ROWS(%rip), %rsi
	call	cudaMemcpy@PLT
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %esi
	movabsq	$4294967297, %rdi
	movl	COLUMNS(%rip), %eax
	movq	%rdi, 36(%rsp)
	movl	40(%rsp), %ecx
	movl	%eax, 32(%rsp)
	movq	32(%rsp), %rdx
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L120
	movq	24(%rsp), %rdx
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rdi
	call	_Z43__device_stub__Z19kernelColumnAveragePdS_PiPdS_Pi
.L120:
	movslq	COLUMNS(%rip), %rdx
	movq	16(%rsp), %rsi
	movl	$2, %ecx
	movq	AVG_CUDA(%rip), %rdi
	salq	$3, %rdx
	call	cudaMemcpy@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L121
	call	__stack_chk_fail@PLT
.L121:
	addq	$72, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2039:
	.size	_Z26calculateColumnAverageCudav, .-_Z26calculateColumnAverageCudav
	.section	.rodata.str1.1
.LC10:
	.string	"usage: exercici_cuda N M\n N : number of rows\n M number of columns\n\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2042:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	cmpl	$3, %edi
	je	.L124
	leaq	.LC10(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$10, %eax
	movl	$5, ROWS(%rip)
	jmp	.L125
.L124:
	movq	8(%rsi), %rdi
	movq	%rsi, %rbx
	call	atoi@PLT
	movq	16(%rbx), %rdi
	movl	%eax, ROWS(%rip)
	call	atoi@PLT
.L125:
	movl	%eax, COLUMNS(%rip)
	imull	ROWS(%rip), %eax
	movl	$9, ELEMS_AVG(%rip)
	movl	%eax, TOTAL_CELLS(%rip)
	call	_Z8initDatav
	call	_Z8showDatav
	call	_Z22calculateMovingAveragev
	call	_Z7showMovv
	call	_Z22calculateColumnAveragev
	call	_Z14showColAveragev
	call	_Z26calculateMovingAverageCudav
	call	_Z11showMovCudav
	call	_Z26calculateColumnAverageCudav
	call	_Z18showColAverageCudav
	call	_Z12checkResultsv
	call	_Z7freeAllv
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2042:
	.size	main, .-main
	.section	.rodata.str1.1
.LC11:
	.string	"_Z19kernelColumnAveragePdS_Pi"
.LC12:
	.string	"_Z19kernelMovingAveragePdS_PiS0_"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2072:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC11(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z19kernelColumnAveragePdS_Pi(%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	.LC12(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z19kernelMovingAveragePdS_PiS0_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2072:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.globl	TOTAL_CELLS
	.bss
	.align 4
	.type	TOTAL_CELLS, @object
	.size	TOTAL_CELLS, 4
TOTAL_CELLS:
	.zero	4
	.globl	ELEMS_AVG
	.align 4
	.type	ELEMS_AVG, @object
	.size	ELEMS_AVG, 4
ELEMS_AVG:
	.zero	4
	.globl	ROWS
	.align 4
	.type	ROWS, @object
	.size	ROWS, 4
ROWS:
	.zero	4
	.globl	COLUMNS
	.align 4
	.type	COLUMNS, @object
	.size	COLUMNS, 4
COLUMNS:
	.zero	4
	.globl	AVG_CUDA
	.align 8
	.type	AVG_CUDA, @object
	.size	AVG_CUDA, 8
AVG_CUDA:
	.zero	8
	.globl	AVG
	.align 8
	.type	AVG, @object
	.size	AVG, 8
AVG:
	.zero	8
	.globl	AVG_D
	.align 8
	.type	AVG_D, @object
	.size	AVG_D, 8
AVG_D:
	.zero	8
	.globl	DATA_TRANSPOSED_LIN_D
	.align 8
	.type	DATA_TRANSPOSED_LIN_D, @object
	.size	DATA_TRANSPOSED_LIN_D, 8
DATA_TRANSPOSED_LIN_D:
	.zero	8
	.globl	MOV_LIN
	.align 8
	.type	MOV_LIN, @object
	.size	MOV_LIN, 8
MOV_LIN:
	.zero	8
	.globl	DATA_TRANSPOSED_LIN
	.align 8
	.type	DATA_TRANSPOSED_LIN, @object
	.size	DATA_TRANSPOSED_LIN, 8
DATA_TRANSPOSED_LIN:
	.zero	8
	.globl	DATA_LIN
	.align 8
	.type	DATA_LIN, @object
	.size	DATA_LIN, 8
DATA_LIN:
	.zero	8
	.globl	MOV
	.align 8
	.type	MOV, @object
	.size	MOV, 8
MOV:
	.zero	8
	.globl	DATA
	.align 8
	.type	DATA, @object
	.size	DATA, 8
DATA:
	.zero	8
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	0
	.long	1079574528
	.align 8
.LC1:
	.long	-4194304
	.long	1105199103
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC6:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.section	.rodata.cst8
	.align 8
.LC7:
	.long	-1698910392
	.long	1048238066
	.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 <time.h>
#include <stdlib.h>
#include <string.h>


void initData(void);
void initValues(void);
void initValuesLin(void);

void calculateMovingAverage(void);
void calculateMovingAverageCuda(void);
__global__ void kernelMovingAverage(double *MOV_LIN_D, double *DATA_LIN_D, int *ROWS);

void calculateColumnAverage(void);
void calculateColumnAverageCuda(void);
__global__ void kernelColumnAverage(double *AVG_D, double *DATA_LIN_D, int *COLUMNS, int *ELEMS_AVG);

void showData(void);
void showMov(void);
void showColAverage(void);
void showMovCuda(void);
void showColAverageCuda(void);

void checkResults(void);

void freeAll(void);

double **DATA;
double **MOV;

double *DATA_LIN;
double *DATA_TRANSPOSED_LIN;
double *MOV_LIN;

double *DATA_TRANSPOSED_LIN_D;
double *AVG_D;

double *AVG;
double *AVG_CUDA;

const int OK = 1;
const int KO = 0;

int COLUMNS;
int ROWS;
int ELEMS_AVG;
int TOTAL_CELLS;

void initData(void) {
	int i;

	AVG = (double *) malloc(COLUMNS * sizeof(double));
	AVG_CUDA = (double *) malloc(COLUMNS * sizeof(double));
	DATA = (double **) malloc(ROWS * sizeof(double *));
	MOV = (double **) malloc(ROWS * sizeof(double *));
	DATA_LIN  = (double *) malloc(TOTAL_CELLS * sizeof(double));
	DATA_TRANSPOSED_LIN = (double *) malloc(TOTAL_CELLS * sizeof(double));
	MOV_LIN = (double *) malloc(TOTAL_CELLS * sizeof(double));

	for (i = 0; i < ROWS; i++) {
		DATA[i] = (double *) malloc(COLUMNS * sizeof(double));
		MOV[i] = (double *) malloc(COLUMNS * sizeof(double *));
	}

	initValues();
}

void initValues(void) {
	int i, j;

	srand(time(NULL));

	for (i = 0; i < ROWS; i++) {
		for (j = 0; j < COLUMNS; j++) {
			DATA[i][j] = (100.0 * rand()) / ((double) RAND_MAX);
			MOV[i][j] = 0.0;
		}
	}

	for (i = 0; i < COLUMNS; i++) {
		AVG[i] = 0.0;
		AVG_CUDA[i] = 0.0;
	}

	initValuesLin();
}

void initValuesLin(void) {
	int i, j, k, l;

	srand(time(NULL));

	for (i = 0; i < ROWS; i++) {
		for (j = 0; j < COLUMNS; j++) {
			k = i * COLUMNS + j;
			l = j * ROWS + i;
			DATA_LIN[k] = DATA[i][j];
			MOV_LIN[k] = MOV[i][j];
			DATA_TRANSPOSED_LIN[l] = DATA[i][j];
		}
	}
}


int canShow() {
	if ((ROWS <= 15) && (COLUMNS <= 15)) {
		return 1;
	} else {
		return 0;
	}
}

void showData(void) {
	int x, y;

	if (!canShow()) return;

	for (y = 0; y < ROWS; y++) {
		for (x = 0; x < COLUMNS; x++) {
			printf("%07.4f ", DATA[y][x]);
		}
		printf("\n");
	}
	printf("\n");
}

void showMov(void) {
	int x, y;

	if (!canShow()) return;

	for (y = 0; y < ROWS; y++) {
		for (x = 0; x < COLUMNS; x++) {
			printf("%07.4f ", MOV[y][x]);
		}
		printf("\n");
	}
	printf("\n");
}

void showMovCuda(void)  {
	int x, y;

	if (!canShow()) return;

	for (y = 0; y < ROWS; y++) {
		for (x = 0; x < COLUMNS; x++) {
			printf("%07.4f ", MOV_LIN[y * COLUMNS + x]);
		}
		printf("\n");
	}
	printf("\n");

}

void showColAverage(void) {
	int x;

	if (!canShow()) return;

	for (x = 0; x < COLUMNS; x++) {
		printf("%07.4f ", AVG[x]);
	}
	printf("\n\n");
}

void showColAverageCuda(void) {
	int x;

	if (!canShow()) return;

	for (x = 0; x < COLUMNS; x++) {
		printf("%07.4f ", AVG_CUDA[x]);
	}
	printf("\n\n");
}

void calculateMovingAverage(void) {
    int x, y;
	int i;

	for (y = 0; y < ROWS; y++) {
		for (x = 0; x < COLUMNS; x++) {
	        MOV[y][x] = DATA[y][x];
	        for(i = 1; i <= 8; i++) {
	            if ((x - i) >= 0) {MOV[y][x] = MOV[y][x] + DATA[y][x - i];}
	        }
	        MOV[y][x] = MOV[y][x] / ELEMS_AVG;
		}
	}
}

void calculateColumnAverage(void) {
    int x, y;

	for (x = 0; x < COLUMNS; x++) {
		for (y = 0; y < ROWS; y++) {
			AVG[x] = AVG[x] + DATA[y][x];
		}
	    AVG[x] = AVG[x] / ROWS;
	}
}

__global__ void kernelMovingAverage(double *MOV_LIN_D, double *DATA_LIN_D, int *COLUMNS, int *ELEMS_AVG) {
	int i;
	int posIni;
	double cell;
        int columns;
        int elemsAvg;
        int row;
        int column;

        columns = *COLUMNS;
        elemsAvg = *ELEMS_AVG;
        row = blockIdx.x;
        column = threadIdx.x;

	cell = 0.0;

	posIni = row * columns + column;
	cell = DATA_LIN_D[posIni];

        for(i = 1; i <= 8; i++) {
            if ((column - i) >= 0) {
                cell = cell + DATA_LIN_D[posIni - i];
            }
        }
	
        cell = cell / elemsAvg;

	MOV_LIN_D[posIni] = cell;
}

void calculateMovingAverageCuda() {
        double *DATA_LIN_D;
        double *MOV_LIN_D;
	int *COLUMNS_D;
        int *ELEMS_AVG_D;

        hipMalloc((void **) &DATA_LIN_D, TOTAL_CELLS * sizeof(double));
	hipMalloc((void **) &MOV_LIN_D, TOTAL_CELLS * sizeof(double));
        hipMalloc((void **) &COLUMNS_D, sizeof(int));
        hipMalloc((void **) &ELEMS_AVG_D, sizeof(int));

	hipMemcpy(DATA_LIN_D, DATA_LIN, TOTAL_CELLS * sizeof(double), hipMemcpyHostToDevice );
        hipMemcpy(MOV_LIN_D, MOV_LIN, TOTAL_CELLS * sizeof(double), hipMemcpyHostToDevice );
        hipMemcpy(COLUMNS_D, &COLUMNS, sizeof(int), hipMemcpyHostToDevice);
        hipMemcpy(ELEMS_AVG_D, &ELEMS_AVG, sizeof(int), hipMemcpyHostToDevice);

        dim3 numColumns(COLUMNS, 1);
        dim3 numRows(ROWS, 1);
        kernelMovingAverage<<<numRows, numColumns>>>(MOV_LIN_D, DATA_LIN_D, COLUMNS_D, ELEMS_AVG_D);

	hipMemcpy(MOV_LIN, MOV_LIN_D, TOTAL_CELLS * sizeof(double), hipMemcpyDeviceToHost);

        hipFree(COLUMNS_D);
        hipFree(ELEMS_AVG_D);
	hipFree(MOV_LIN_D);
	hipFree(DATA_LIN_D);
}

__global__ void kernelColumnAverage(double *AVG_D, double *DATA_LIN_D, int *ROWS) {
	int i;
	int posIni;
	int posFin;
        int rows;
	double cell;

        rows = *ROWS;

	cell = 0.0;

	posIni = threadIdx.x * rows;
	posFin = posIni + rows;


	for (i = posIni; i < posFin; i++) {
		cell = cell + DATA_LIN_D[i];
	}

	cell = cell / rows;

	AVG_D[threadIdx.x] = cell;
}

void calculateColumnAverageCuda(void) {
        double *DATA_TRANSPOSED_LIN_D;
        double *AVG_D;
        int *ROWS_D;

	hipMalloc((void **) &DATA_TRANSPOSED_LIN_D, TOTAL_CELLS * sizeof(double));
	hipMalloc((void **) &AVG_D, COLUMNS * sizeof(double));
        hipMalloc((void **) &ROWS_D, sizeof(int));

	hipMemcpy(DATA_TRANSPOSED_LIN_D, DATA_TRANSPOSED_LIN, TOTAL_CELLS * sizeof(double), hipMemcpyHostToDevice);
        hipMemcpy(AVG_D, AVG, COLUMNS * sizeof(double), hipMemcpyHostToDevice);
        hipMemcpy(ROWS_D, &ROWS, sizeof(int), hipMemcpyHostToDevice);

        dim3 numColumns(COLUMNS, 1);
        dim3 numRows(1, 1);
	kernelColumnAverage<<<numRows, numColumns>>>(AVG_D, DATA_TRANSPOSED_LIN_D, ROWS_D);

	hipMemcpy(AVG_CUDA, AVG_D, COLUMNS * sizeof(double), hipMemcpyDeviceToHost);

        hipFree(ROWS_D);
	hipFree(DATA_TRANSPOSED_LIN_D);
	hipFree(AVG_D);
}

void  checkResults(void) {
	int y,x, k;
	double diff;
	double epsilon;
	int result;

	result= OK;
	epsilon = 0.0000001;

	for(y = 0; y < ROWS; y++) {
		for(x = 0; x < COLUMNS; x++) {
			k = y * COLUMNS + x;
			diff = abs(MOV[y][x] - MOV_LIN[k]);

			if (diff > epsilon) {
				result = KO;
				break;
			}
		}
	}

	printf("\nCheck result moving average : %d\n\n", result);

	result= OK;

	for(x = 0; x < COLUMNS; x++) {
	    diff = abs(AVG[x] - AVG_CUDA[x]);

	    if (diff > epsilon) {
		    result = KO;
			break;
		}
	}

	printf("Check result column average : %d\n\n", result);
}


void freeAll(void) {
	int y;

	free(AVG);
	for (y = 0; y < ROWS; y++) {
		free(DATA[y]);
		free(MOV[y]);
	}

	free(DATA);
	free(MOV);
}

int main(int argc, char**argv) {
	if (argc != 3) {
		printf("usage: exercici_cuda N M\n N : number of rows\n M number of columns\n\n");
	    ROWS = 5;
	    COLUMNS = 10;
	} else {
	    ROWS = atoi(argv[1]);
	    COLUMNS = atoi(argv[2]);
	}

	ELEMS_AVG = 9;
	TOTAL_CELLS = ROWS * COLUMNS;

	initData();

	showData();

	calculateMovingAverage();
	showMov();

	calculateColumnAverage();
	showColAverage();

	calculateMovingAverageCuda();
	showMovCuda();

	calculateColumnAverageCuda();
	showColAverageCuda();

	checkResults();

	freeAll();
}

	.text
	.file	"cuda.hip"
	.globl	_Z8initDatav                    # -- Begin function _Z8initDatav
	.type	_Z8initDatav,@function
_Z8initDatav:                           # @_Z8initDatav
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movslq	COLUMNS(%rip), %rbx
	shlq	$3, %rbx
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, AVG(%rip)
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, AVG_CUDA(%rip)
	movslq	ROWS(%rip), %r15
	leaq	(,%r15,8), %r14
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, DATA(%rip)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, MOV(%rip)
	movslq	TOTAL_CELLS(%rip), %r14
	shlq	$3, %r14
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, DATA_LIN(%rip)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, DATA_TRANSPOSED_LIN(%rip)
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, MOV_LIN(%rip)
	testq	%r15, %r15
	jle	.LBB0_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%r15d, %r14d
	xorl	%r15d, %r15d
.LBB0_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	callq	malloc
	movq	DATA(%rip), %rcx
	movq	%rax, (%rcx,%r15,8)
	movq	%rbx, %rdi
	callq	malloc
	movq	MOV(%rip), %rcx
	movq	%rax, (%rcx,%r15,8)
	incq	%r15
	cmpq	%r15, %r14
	jne	.LBB0_2
.LBB0_3:                                # %._crit_edge
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	_Z10initValuesv                 # TAILCALL
.Lfunc_end0:
	.size	_Z8initDatav, .Lfunc_end0-_Z8initDatav
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z10initValuesv
.LCPI1_0:
	.quad	0x4059000000000000              # double 100
.LCPI1_1:
	.quad	0x41dfffffffc00000              # double 2147483647
	.text
	.globl	_Z10initValuesv
	.type	_Z10initValuesv,@function
_Z10initValuesv:                        # @_Z10initValuesv
	.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
	xorl	%edi, %edi
	callq	time
	movl	%eax, %edi
	callq	srand
	movl	ROWS(%rip), %ecx
	movl	COLUMNS(%rip), %eax
	testl	%ecx, %ecx
	jle	.LBB1_7
# %bb.1:                                # %.preheader13.preheader
	xorl	%ebx, %ebx
.LBB1_2:                                # %.preheader13
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_4 Depth 2
	testl	%eax, %eax
	jle	.LBB1_6
# %bb.3:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB1_2 Depth=1
	xorl	%r14d, %r14d
.LBB1_4:                                # %.lr.ph
                                        #   Parent Loop BB1_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	callq	rand
	movsd	.LCPI1_0(%rip), %xmm1           # xmm1 = mem[0],zero
	xorps	%xmm0, %xmm0
	cvtsi2sd	%eax, %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LCPI1_1(%rip), %xmm1           # xmm1 = mem[0],zero
	divsd	%xmm1, %xmm0
	movq	DATA(%rip), %rax
	movq	(%rax,%rbx,8), %rax
	movsd	%xmm0, (%rax,%r14,8)
	movq	MOV(%rip), %rax
	movq	(%rax,%rbx,8), %rax
	movq	$0, (%rax,%r14,8)
	incq	%r14
	movslq	COLUMNS(%rip), %rax
	cmpq	%rax, %r14
	jl	.LBB1_4
# %bb.5:                                # %._crit_edge.loopexit
                                        #   in Loop: Header=BB1_2 Depth=1
	movl	ROWS(%rip), %ecx
.LBB1_6:                                # %._crit_edge
                                        #   in Loop: Header=BB1_2 Depth=1
	incq	%rbx
	movslq	%ecx, %rdx
	cmpq	%rdx, %rbx
	jl	.LBB1_2
.LBB1_7:                                # %.preheader
	testl	%eax, %eax
	jle	.LBB1_10
# %bb.8:                                # %.lr.ph17
	movq	AVG(%rip), %rcx
	movq	AVG_CUDA(%rip), %rdx
	movl	%eax, %eax
	xorl	%esi, %esi
	xorl	%edi, %edi
.LBB1_9:                                # =>This Inner Loop Header: Depth=1
	movq	%rsi, (%rcx,%rdi,8)
	movq	%rsi, (%rdx,%rdi,8)
	incq	%rdi
	cmpq	%rdi, %rax
	jne	.LBB1_9
.LBB1_10:                               # %._crit_edge18
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_Z13initValuesLinv              # TAILCALL
.Lfunc_end1:
	.size	_Z10initValuesv, .Lfunc_end1-_Z10initValuesv
	.cfi_endproc
                                        # -- End function
	.globl	_Z13initValuesLinv              # -- Begin function _Z13initValuesLinv
	.type	_Z13initValuesLinv,@function
_Z13initValuesLinv:                     # @_Z13initValuesLinv
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	pushq	%rax
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	xorl	%ebx, %ebx
	xorl	%edi, %edi
	callq	time
	movl	%eax, %edi
	callq	srand
	movl	ROWS(%rip), %eax
	testl	%eax, %eax
	jle	.LBB2_6
# %bb.1:                                # %.preheader.lr.ph
	movl	COLUMNS(%rip), %ecx
	movq	DATA(%rip), %rdx
	movq	%rdx, (%rsp)                    # 8-byte Spill
	movq	DATA_LIN(%rip), %rsi
	movq	MOV(%rip), %rdi
	movq	MOV_LIN(%rip), %r8
	movq	DATA_TRANSPOSED_LIN(%rip), %r9
	leaq	(,%rax,8), %r10
	xorl	%r11d, %r11d
.LBB2_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_4 Depth 2
	testl	%ecx, %ecx
	jle	.LBB2_5
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB2_2 Depth=1
	movl	%ebx, %edx
	leaq	(%r8,%rdx,8), %r14
	leaq	(%rsi,%rdx,8), %r15
	movq	(%rsp), %rdx                    # 8-byte Reload
	movq	(%rdx,%r11,8), %r12
	movq	(%rdi,%r11,8), %r13
	movq	%r9, %rbp
	xorl	%edx, %edx
.LBB2_4:                                #   Parent Loop BB2_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	(%r12,%rdx,8), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, (%r15,%rdx,8)
	movsd	(%r13,%rdx,8), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, (%r14,%rdx,8)
	movsd	(%r12,%rdx,8), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, (%rbp)
	incq	%rdx
	addq	%r10, %rbp
	cmpq	%rdx, %rcx
	jne	.LBB2_4
.LBB2_5:                                # %._crit_edge
                                        #   in Loop: Header=BB2_2 Depth=1
	incq	%r11
	addq	$8, %r9
	addl	%ecx, %ebx
	cmpq	%rax, %r11
	jne	.LBB2_2
.LBB2_6:                                # %._crit_edge21
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z13initValuesLinv, .Lfunc_end2-_Z13initValuesLinv
	.cfi_endproc
                                        # -- End function
	.globl	_Z7canShowv                     # -- Begin function _Z7canShowv
	.type	_Z7canShowv,@function
_Z7canShowv:                            # @_Z7canShowv
	.cfi_startproc
# %bb.0:
	cmpl	$16, ROWS(%rip)
	setl	%al
	cmpl	$16, COLUMNS(%rip)
	setl	%cl
	andb	%al, %cl
	movzbl	%cl, %eax
	retq
.Lfunc_end3:
	.size	_Z7canShowv, .Lfunc_end3-_Z7canShowv
	.cfi_endproc
                                        # -- End function
	.globl	_Z8showDatav                    # -- Begin function _Z8showDatav
	.type	_Z8showDatav,@function
_Z8showDatav:                           # @_Z8showDatav
	.cfi_startproc
# %bb.0:
	movl	ROWS(%rip), %eax
	cmpl	$15, %eax
	jg	.LBB4_10
# %bb.1:
	cmpl	$15, COLUMNS(%rip)
	jg	.LBB4_10
# %bb.2:                                # %.preheader10
	testl	%eax, %eax
	jle	.LBB4_9
# %bb.3:                                # %.preheader.preheader
	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
	xorl	%ebx, %ebx
.LBB4_4:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_6 Depth 2
	cmpl	$0, COLUMNS(%rip)
	jle	.LBB4_7
# %bb.5:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB4_4 Depth=1
	xorl	%r14d, %r14d
.LBB4_6:                                # %.lr.ph
                                        #   Parent Loop BB4_4 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	DATA(%rip), %rax
	movq	(%rax,%rbx,8), %rax
	movsd	(%rax,%r14,8), %xmm0            # xmm0 = mem[0],zero
	movl	$.L.str, %edi
	movb	$1, %al
	callq	printf
	incq	%r14
	movslq	COLUMNS(%rip), %rax
	cmpq	%rax, %r14
	jl	.LBB4_6
.LBB4_7:                                # %._crit_edge
                                        #   in Loop: Header=BB4_4 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incq	%rbx
	movslq	ROWS(%rip), %rax
	cmpq	%rax, %rbx
	jl	.LBB4_4
# %bb.8:
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
.LBB4_9:                                # %._crit_edge13
	movl	$10, %edi
	jmp	putchar@PLT                     # TAILCALL
.LBB4_10:
	retq
.Lfunc_end4:
	.size	_Z8showDatav, .Lfunc_end4-_Z8showDatav
	.cfi_endproc
                                        # -- End function
	.globl	_Z7showMovv                     # -- Begin function _Z7showMovv
	.type	_Z7showMovv,@function
_Z7showMovv:                            # @_Z7showMovv
	.cfi_startproc
# %bb.0:
	movl	ROWS(%rip), %eax
	cmpl	$15, %eax
	jg	.LBB5_10
# %bb.1:
	cmpl	$15, COLUMNS(%rip)
	jg	.LBB5_10
# %bb.2:                                # %.preheader10
	testl	%eax, %eax
	jle	.LBB5_9
# %bb.3:                                # %.preheader.preheader
	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
	xorl	%ebx, %ebx
.LBB5_4:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_6 Depth 2
	cmpl	$0, COLUMNS(%rip)
	jle	.LBB5_7
# %bb.5:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB5_4 Depth=1
	xorl	%r14d, %r14d
.LBB5_6:                                # %.lr.ph
                                        #   Parent Loop BB5_4 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	MOV(%rip), %rax
	movq	(%rax,%rbx,8), %rax
	movsd	(%rax,%r14,8), %xmm0            # xmm0 = mem[0],zero
	movl	$.L.str, %edi
	movb	$1, %al
	callq	printf
	incq	%r14
	movslq	COLUMNS(%rip), %rax
	cmpq	%rax, %r14
	jl	.LBB5_6
.LBB5_7:                                # %._crit_edge
                                        #   in Loop: Header=BB5_4 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incq	%rbx
	movslq	ROWS(%rip), %rax
	cmpq	%rax, %rbx
	jl	.LBB5_4
# %bb.8:
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
.LBB5_9:                                # %._crit_edge13
	movl	$10, %edi
	jmp	putchar@PLT                     # TAILCALL
.LBB5_10:
	retq
.Lfunc_end5:
	.size	_Z7showMovv, .Lfunc_end5-_Z7showMovv
	.cfi_endproc
                                        # -- End function
	.globl	_Z11showMovCudav                # -- Begin function _Z11showMovCudav
	.type	_Z11showMovCudav,@function
_Z11showMovCudav:                       # @_Z11showMovCudav
	.cfi_startproc
# %bb.0:
	movl	ROWS(%rip), %eax
	cmpl	$15, %eax
	jg	.LBB6_10
# %bb.1:
	cmpl	$15, COLUMNS(%rip)
	jg	.LBB6_10
# %bb.2:                                # %.preheader11
	testl	%eax, %eax
	jle	.LBB6_9
# %bb.3:                                # %.preheader.preheader
	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
	xorl	%ebx, %ebx
.LBB6_4:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_6 Depth 2
	movl	COLUMNS(%rip), %eax
	testl	%eax, %eax
	jle	.LBB6_7
# %bb.5:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB6_4 Depth=1
	xorl	%r14d, %r14d
.LBB6_6:                                # %.lr.ph
                                        #   Parent Loop BB6_4 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	MOV_LIN(%rip), %rcx
	imull	%ebx, %eax
	cltq
	addq	%r14, %rax
	movsd	(%rcx,%rax,8), %xmm0            # xmm0 = mem[0],zero
	movl	$.L.str, %edi
	movb	$1, %al
	callq	printf
	movl	COLUMNS(%rip), %eax
	incq	%r14
	cmpl	%eax, %r14d
	jl	.LBB6_6
.LBB6_7:                                # %._crit_edge
                                        #   in Loop: Header=BB6_4 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incl	%ebx
	cmpl	ROWS(%rip), %ebx
	jl	.LBB6_4
# %bb.8:
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
.LBB6_9:                                # %._crit_edge14
	movl	$10, %edi
	jmp	putchar@PLT                     # TAILCALL
.LBB6_10:
	retq
.Lfunc_end6:
	.size	_Z11showMovCudav, .Lfunc_end6-_Z11showMovCudav
	.cfi_endproc
                                        # -- End function
	.globl	_Z14showColAveragev             # -- Begin function _Z14showColAveragev
	.type	_Z14showColAveragev,@function
_Z14showColAveragev:                    # @_Z14showColAveragev
	.cfi_startproc
# %bb.0:
	cmpl	$15, ROWS(%rip)
	jg	.LBB7_7
# %bb.1:
	movl	COLUMNS(%rip), %eax
	cmpl	$15, %eax
	jg	.LBB7_7
# %bb.2:                                # %.preheader
	testl	%eax, %eax
	jle	.LBB7_6
# %bb.3:                                # %.lr.ph.preheader
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	xorl	%ebx, %ebx
.LBB7_4:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	AVG(%rip), %rax
	movsd	(%rax,%rbx,8), %xmm0            # xmm0 = mem[0],zero
	movl	$.L.str, %edi
	movb	$1, %al
	callq	printf
	incq	%rbx
	movslq	COLUMNS(%rip), %rax
	cmpq	%rax, %rbx
	jl	.LBB7_4
# %bb.5:
	popq	%rbx
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
.LBB7_6:                                # %._crit_edge
	movl	$.Lstr.1, %edi
	jmp	puts@PLT                        # TAILCALL
.LBB7_7:
	retq
.Lfunc_end7:
	.size	_Z14showColAveragev, .Lfunc_end7-_Z14showColAveragev
	.cfi_endproc
                                        # -- End function
	.globl	_Z18showColAverageCudav         # -- Begin function _Z18showColAverageCudav
	.type	_Z18showColAverageCudav,@function
_Z18showColAverageCudav:                # @_Z18showColAverageCudav
	.cfi_startproc
# %bb.0:
	cmpl	$15, ROWS(%rip)
	jg	.LBB8_7
# %bb.1:
	movl	COLUMNS(%rip), %eax
	cmpl	$15, %eax
	jg	.LBB8_7
# %bb.2:                                # %.preheader
	testl	%eax, %eax
	jle	.LBB8_6
# %bb.3:                                # %.lr.ph.preheader
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	xorl	%ebx, %ebx
.LBB8_4:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	AVG_CUDA(%rip), %rax
	movsd	(%rax,%rbx,8), %xmm0            # xmm0 = mem[0],zero
	movl	$.L.str, %edi
	movb	$1, %al
	callq	printf
	incq	%rbx
	movslq	COLUMNS(%rip), %rax
	cmpq	%rax, %rbx
	jl	.LBB8_4
# %bb.5:
	popq	%rbx
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
.LBB8_6:                                # %._crit_edge
	movl	$.Lstr.1, %edi
	jmp	puts@PLT                        # TAILCALL
.LBB8_7:
	retq
.Lfunc_end8:
	.size	_Z18showColAverageCudav, .Lfunc_end8-_Z18showColAverageCudav
	.cfi_endproc
                                        # -- End function
	.globl	_Z22calculateMovingAveragev     # -- Begin function _Z22calculateMovingAveragev
	.type	_Z22calculateMovingAveragev,@function
_Z22calculateMovingAveragev:            # @_Z22calculateMovingAveragev
	.cfi_startproc
# %bb.0:
	movl	ROWS(%rip), %eax
	testl	%eax, %eax
	jle	.LBB9_11
# %bb.1:                                # %.preheader.lr.ph
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movl	COLUMNS(%rip), %ecx
	movq	DATA(%rip), %rdx
	movq	MOV(%rip), %rsi
	cvtsi2sdl	ELEMS_AVG(%rip), %xmm0
	xorl	%edi, %edi
.LBB9_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB9_4 Depth 2
                                        #       Child Loop BB9_5 Depth 3
	testl	%ecx, %ecx
	jle	.LBB9_9
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB9_2 Depth=1
	movq	(%rdx,%rdi,8), %r8
	movq	(%rsi,%rdi,8), %r9
	movq	%r8, %r10
	xorl	%r11d, %r11d
.LBB9_4:                                #   Parent Loop BB9_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB9_5 Depth 3
	movsd	(%r8,%r11,8), %xmm1             # xmm1 = mem[0],zero
	movsd	%xmm1, (%r9,%r11,8)
	movq	$-1, %rbx
.LBB9_5:                                #   Parent Loop BB9_2 Depth=1
                                        #     Parent Loop BB9_4 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movq	%r11, %r14
	addq	%rbx, %r14
	js	.LBB9_7
# %bb.6:                                #   in Loop: Header=BB9_5 Depth=3
	addsd	(%r10,%rbx,8), %xmm1
	movsd	%xmm1, (%r9,%r11,8)
.LBB9_7:                                #   in Loop: Header=BB9_5 Depth=3
	decq	%rbx
	cmpq	$-9, %rbx
	jne	.LBB9_5
# %bb.8:                                #   in Loop: Header=BB9_4 Depth=2
	divsd	%xmm0, %xmm1
	movsd	%xmm1, (%r9,%r11,8)
	incq	%r11
	addq	$8, %r10
	cmpq	%rcx, %r11
	jne	.LBB9_4
.LBB9_9:                                # %._crit_edge
                                        #   in Loop: Header=BB9_2 Depth=1
	incq	%rdi
	cmpq	%rax, %rdi
	jne	.LBB9_2
# %bb.10:
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r14
.LBB9_11:                               # %._crit_edge29
	retq
.Lfunc_end9:
	.size	_Z22calculateMovingAveragev, .Lfunc_end9-_Z22calculateMovingAveragev
	.cfi_endproc
                                        # -- End function
	.globl	_Z22calculateColumnAveragev     # -- Begin function _Z22calculateColumnAveragev
	.type	_Z22calculateColumnAveragev,@function
_Z22calculateColumnAveragev:            # @_Z22calculateColumnAveragev
	.cfi_startproc
# %bb.0:
	movl	COLUMNS(%rip), %eax
	testl	%eax, %eax
	jle	.LBB10_6
# %bb.1:                                # %.preheader.lr.ph
	movl	ROWS(%rip), %ecx
	movq	AVG(%rip), %rdx
	movq	DATA(%rip), %rsi
	cvtsi2sd	%ecx, %xmm0
	xorl	%edi, %edi
.LBB10_2:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB10_4 Depth 2
	movsd	(%rdx,%rdi,8), %xmm1            # xmm1 = mem[0],zero
	testl	%ecx, %ecx
	jle	.LBB10_5
# %bb.3:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB10_2 Depth=1
	xorl	%r8d, %r8d
.LBB10_4:                               # %.lr.ph
                                        #   Parent Loop BB10_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	(%rsi,%r8,8), %r9
	addsd	(%r9,%rdi,8), %xmm1
	movsd	%xmm1, (%rdx,%rdi,8)
	incq	%r8
	cmpq	%r8, %rcx
	jne	.LBB10_4
.LBB10_5:                               # %._crit_edge
                                        #   in Loop: Header=BB10_2 Depth=1
	divsd	%xmm0, %xmm1
	movsd	%xmm1, (%rdx,%rdi,8)
	incq	%rdi
	cmpq	%rax, %rdi
	jne	.LBB10_2
.LBB10_6:                               # %._crit_edge14
	retq
.Lfunc_end10:
	.size	_Z22calculateColumnAveragev, .Lfunc_end10-_Z22calculateColumnAveragev
	.cfi_endproc
                                        # -- End function
	.globl	_Z34__device_stub__kernelMovingAveragePdS_PiS0_ # -- Begin function _Z34__device_stub__kernelMovingAveragePdS_PiS0_
	.type	_Z34__device_stub__kernelMovingAveragePdS_PiS0_,@function
_Z34__device_stub__kernelMovingAveragePdS_PiS0_: # @_Z34__device_stub__kernelMovingAveragePdS_PiS0_
	.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	16(%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	8(%rsp), %r12
	movq	%rsp, %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z19kernelMovingAveragePdS_PiS0_, %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_end11:
	.size	_Z34__device_stub__kernelMovingAveragePdS_PiS0_, .Lfunc_end11-_Z34__device_stub__kernelMovingAveragePdS_PiS0_
	.cfi_endproc
                                        # -- End function
	.globl	_Z26calculateMovingAverageCudav # -- Begin function _Z26calculateMovingAverageCudav
	.type	_Z26calculateMovingAverageCudav,@function
_Z26calculateMovingAverageCudav:        # @_Z26calculateMovingAverageCudav
	.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
	subq	$40, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movslq	TOTAL_CELLS(%rip), %rsi
	shlq	$3, %rsi
	leaq	32(%rsp), %r12
	movq	%r12, %rdi
	callq	hipMalloc
	movslq	TOTAL_CELLS(%rip), %rsi
	shlq	$3, %rsi
	leaq	8(%rsp), %r15
	movq	%r15, %rdi
	callq	hipMalloc
	leaq	24(%rsp), %r14
	movl	$4, %esi
	movq	%r14, %rdi
	callq	hipMalloc
	leaq	16(%rsp), %rbx
	movl	$4, %esi
	movq	%rbx, %rdi
	callq	hipMalloc
	movq	(%r12), %rdi
	movq	DATA_LIN(%rip), %rsi
	movslq	TOTAL_CELLS(%rip), %rdx
	shlq	$3, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r15), %rdi
	movq	MOV_LIN(%rip), %rsi
	movslq	TOTAL_CELLS(%rip), %rdx
	shlq	$3, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r14), %rdi
	movl	$COLUMNS, %esi
	movl	$4, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%rbx), %rdi
	movl	$ELEMS_AVG, %esi
	movl	$4, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	COLUMNS(%rip), %edx
	btsq	$32, %rdx
	movl	ROWS(%rip), %edi
	btsq	$32, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB12_2
# %bb.1:
	movq	8(%rsp), %rdi
	movq	32(%rsp), %rsi
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rcx
	callq	_Z34__device_stub__kernelMovingAveragePdS_PiS0_
.LBB12_2:
	movq	MOV_LIN(%rip), %rdi
	movq	8(%rsp), %rsi
	movslq	TOTAL_CELLS(%rip), %rdx
	shlq	$3, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	32(%rsp), %rdi
	callq	hipFree
	addq	$40, %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_end12:
	.size	_Z26calculateMovingAverageCudav, .Lfunc_end12-_Z26calculateMovingAverageCudav
	.cfi_endproc
                                        # -- End function
	.globl	_Z34__device_stub__kernelColumnAveragePdS_Pi # -- Begin function _Z34__device_stub__kernelColumnAveragePdS_Pi
	.type	_Z34__device_stub__kernelColumnAveragePdS_Pi,@function
_Z34__device_stub__kernelColumnAveragePdS_Pi: # @_Z34__device_stub__kernelColumnAveragePdS_Pi
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z19kernelColumnAveragePdS_Pi, %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_end13:
	.size	_Z34__device_stub__kernelColumnAveragePdS_Pi, .Lfunc_end13-_Z34__device_stub__kernelColumnAveragePdS_Pi
	.cfi_endproc
                                        # -- End function
	.globl	_Z26calculateColumnAverageCudav # -- Begin function _Z26calculateColumnAverageCudav
	.type	_Z26calculateColumnAverageCudav,@function
_Z26calculateColumnAverageCudav:        # @_Z26calculateColumnAverageCudav
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movslq	TOTAL_CELLS(%rip), %rsi
	shlq	$3, %rsi
	leaq	24(%rsp), %r14
	movq	%r14, %rdi
	callq	hipMalloc
	movslq	COLUMNS(%rip), %rsi
	shlq	$3, %rsi
	leaq	8(%rsp), %r15
	movq	%r15, %rdi
	callq	hipMalloc
	leaq	16(%rsp), %rbx
	movl	$4, %esi
	movq	%rbx, %rdi
	callq	hipMalloc
	movq	(%r14), %rdi
	movq	DATA_TRANSPOSED_LIN(%rip), %rsi
	movslq	TOTAL_CELLS(%rip), %rdx
	shlq	$3, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r15), %rdi
	movq	AVG(%rip), %rsi
	movslq	COLUMNS(%rip), %rdx
	shlq	$3, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%rbx), %rdi
	movl	$ROWS, %esi
	movl	$4, %edx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	COLUMNS(%rip), %edx
	btsq	$32, %rdx
	movabsq	$4294967296, %rdi               # imm = 0x100000000
	orq	$1, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB14_2
# %bb.1:
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdx
	callq	_Z34__device_stub__kernelColumnAveragePdS_Pi
.LBB14_2:
	movq	AVG_CUDA(%rip), %rdi
	movq	8(%rsp), %rsi
	movslq	COLUMNS(%rip), %rdx
	shlq	$3, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	addq	$32, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end14:
	.size	_Z26calculateColumnAverageCudav, .Lfunc_end14-_Z26calculateColumnAverageCudav
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z12checkResultsv
.LCPI15_0:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI15_1:
	.quad	0x3e7ad7f29abcaf48              # double 9.9999999999999995E-8
	.text
	.globl	_Z12checkResultsv
	.type	_Z12checkResultsv,@function
_Z12checkResultsv:                      # @_Z12checkResultsv
	.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
	movl	ROWS(%rip), %eax
	movl	$1, %ebx
	movl	$1, %esi
	testl	%eax, %eax
	jle	.LBB15_8
# %bb.1:                                # %.preheader.lr.ph
	movl	COLUMNS(%rip), %ecx
	movq	MOV(%rip), %rdx
	movq	MOV_LIN(%rip), %rdi
	xorl	%r8d, %r8d
	movapd	.LCPI15_0(%rip), %xmm0          # xmm0 = [NaN,NaN]
	movsd	.LCPI15_1(%rip), %xmm1          # xmm1 = mem[0],zero
	xorl	%r9d, %r9d
.LBB15_2:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB15_5 Depth 2
	testl	%ecx, %ecx
	jle	.LBB15_7
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB15_2 Depth=1
	movl	%r8d, %r10d
	leaq	(%rdi,%r10,8), %r10
	movq	(%rdx,%r9,8), %r11
	xorl	%r14d, %r14d
.LBB15_5:                               #   Parent Loop BB15_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	(%r11,%r14,8), %xmm2            # xmm2 = mem[0],zero
	subsd	(%r10,%r14,8), %xmm2
	andpd	%xmm0, %xmm2
	ucomisd	%xmm1, %xmm2
	ja	.LBB15_6
# %bb.4:                                #   in Loop: Header=BB15_5 Depth=2
	incq	%r14
	cmpq	%r14, %rcx
	jne	.LBB15_5
	jmp	.LBB15_7
.LBB15_6:                               #   in Loop: Header=BB15_2 Depth=1
	xorl	%esi, %esi
.LBB15_7:                               # %._crit_edge
                                        #   in Loop: Header=BB15_2 Depth=1
	incq	%r9
	addl	%ecx, %r8d
	cmpq	%rax, %r9
	jne	.LBB15_2
.LBB15_8:                               # %._crit_edge27
	movl	$.L.str.3, %edi
	xorl	%eax, %eax
	callq	printf
	movl	COLUMNS(%rip), %eax
	testl	%eax, %eax
	jle	.LBB15_13
# %bb.9:                                # %.lr.ph30
	movq	AVG(%rip), %rcx
	movq	AVG_CUDA(%rip), %rdx
	xorl	%esi, %esi
	movapd	.LCPI15_0(%rip), %xmm0          # xmm0 = [NaN,NaN]
	movsd	.LCPI15_1(%rip), %xmm1          # xmm1 = mem[0],zero
.LBB15_11:                              # =>This Inner Loop Header: Depth=1
	movsd	(%rcx,%rsi,8), %xmm2            # xmm2 = mem[0],zero
	subsd	(%rdx,%rsi,8), %xmm2
	andpd	%xmm0, %xmm2
	ucomisd	%xmm1, %xmm2
	ja	.LBB15_12
# %bb.10:                               #   in Loop: Header=BB15_11 Depth=1
	incq	%rsi
	cmpq	%rsi, %rax
	jne	.LBB15_11
	jmp	.LBB15_13
.LBB15_12:
	xorl	%ebx, %ebx
.LBB15_13:                              # %._crit_edge31
	movl	$.L.str.4, %edi
	movl	%ebx, %esi
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	printf                          # TAILCALL
.Lfunc_end15:
	.size	_Z12checkResultsv, .Lfunc_end15-_Z12checkResultsv
	.cfi_endproc
                                        # -- End function
	.globl	_Z7freeAllv                     # -- Begin function _Z7freeAllv
	.type	_Z7freeAllv,@function
_Z7freeAllv:                            # @_Z7freeAllv
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	AVG(%rip), %rdi
	callq	free
	cmpl	$0, ROWS(%rip)
	jle	.LBB16_3
# %bb.1:                                # %.lr.ph.preheader
	xorl	%ebx, %ebx
.LBB16_2:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	DATA(%rip), %rax
	movq	(%rax,%rbx,8), %rdi
	callq	free
	movq	MOV(%rip), %rax
	movq	(%rax,%rbx,8), %rdi
	callq	free
	incq	%rbx
	movslq	ROWS(%rip), %rax
	cmpq	%rax, %rbx
	jl	.LBB16_2
.LBB16_3:                               # %._crit_edge
	movq	DATA(%rip), %rdi
	callq	free
	movq	MOV(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	free                            # TAILCALL
.Lfunc_end16:
	.size	_Z7freeAllv, .Lfunc_end16-_Z7freeAllv
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.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
	cmpl	$3, %edi
	jne	.LBB17_1
# %bb.2:
	movq	%rsi, %r14
	movq	8(%rsi), %rdi
	callq	atoi
	movl	%eax, %ebx
	movl	%eax, ROWS(%rip)
	movq	16(%r14), %rdi
	callq	atoi
	jmp	.LBB17_3
.LBB17_1:
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	movl	$5, ROWS(%rip)
	movl	$10, %eax
	movl	$5, %ebx
.LBB17_3:
	movl	%eax, COLUMNS(%rip)
	movl	$9, ELEMS_AVG(%rip)
	imull	%eax, %ebx
	movl	%ebx, TOTAL_CELLS(%rip)
	callq	_Z8initDatav
	callq	_Z8showDatav
	callq	_Z22calculateMovingAveragev
	callq	_Z7showMovv
	callq	_Z22calculateColumnAveragev
	callq	_Z14showColAveragev
	callq	_Z26calculateMovingAverageCudav
	callq	_Z11showMovCudav
	callq	_Z26calculateColumnAverageCudav
	callq	_Z18showColAverageCudav
	callq	_Z12checkResultsv
	callq	_Z7freeAllv
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end17:
	.size	main, .Lfunc_end17-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	.LBB18_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB18_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z19kernelMovingAveragePdS_PiS0_, %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	$_Z19kernelColumnAveragePdS_Pi, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %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_end18:
	.size	__hip_module_ctor, .Lfunc_end18-__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	.LBB19_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
.LBB19_2:
	retq
.Lfunc_end19:
	.size	__hip_module_dtor, .Lfunc_end19-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	DATA,@object                    # @DATA
	.bss
	.globl	DATA
	.p2align	3, 0x0
DATA:
	.quad	0
	.size	DATA, 8

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

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

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

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

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

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

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

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

	.type	COLUMNS,@object                 # @COLUMNS
	.globl	COLUMNS
	.p2align	2, 0x0
COLUMNS:
	.long	0                               # 0x0
	.size	COLUMNS, 4

	.type	ROWS,@object                    # @ROWS
	.globl	ROWS
	.p2align	2, 0x0
ROWS:
	.long	0                               # 0x0
	.size	ROWS, 4

	.type	ELEMS_AVG,@object               # @ELEMS_AVG
	.globl	ELEMS_AVG
	.p2align	2, 0x0
ELEMS_AVG:
	.long	0                               # 0x0
	.size	ELEMS_AVG, 4

	.type	TOTAL_CELLS,@object             # @TOTAL_CELLS
	.globl	TOTAL_CELLS
	.p2align	2, 0x0
TOTAL_CELLS:
	.long	0                               # 0x0
	.size	TOTAL_CELLS, 4

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

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

	.type	_Z19kernelColumnAveragePdS_Pi,@object # @_Z19kernelColumnAveragePdS_Pi
	.globl	_Z19kernelColumnAveragePdS_Pi
	.p2align	3, 0x0
_Z19kernelColumnAveragePdS_Pi:
	.quad	_Z34__device_stub__kernelColumnAveragePdS_Pi
	.size	_Z19kernelColumnAveragePdS_Pi, 8

	.type	.L.str.3,@object                # @.str.3
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.3:
	.asciz	"\nCheck result moving average : %d\n\n"
	.size	.L.str.3, 36

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Check result column average : %d\n\n"
	.size	.L.str.4, 35

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z19kernelMovingAveragePdS_PiS0_"
	.size	.L__unnamed_1, 33

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z19kernelColumnAveragePdS_Pi"
	.size	.L__unnamed_2, 30

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

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

	.type	.Lstr.1,@object                 # @str.1
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr.1:
	.asciz	"\n"
	.size	.Lstr.1, 2

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"usage: exercici_cuda N M\n N : number of rows\n M number of columns\n"
	.size	.Lstr.2, 67

	.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 _Z34__device_stub__kernelMovingAveragePdS_PiS0_
	.addrsig_sym _Z34__device_stub__kernelColumnAveragePdS_Pi
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym COLUMNS
	.addrsig_sym ROWS
	.addrsig_sym ELEMS_AVG
	.addrsig_sym _Z19kernelMovingAveragePdS_PiS0_
	.addrsig_sym _Z19kernelColumnAveragePdS_Pi
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z19kernelMovingAveragePdS_PiS0_ ; -- Begin function _Z19kernelMovingAveragePdS_PiS0_
	.globl	_Z19kernelMovingAveragePdS_PiS0_
	.p2align	8
	.type	_Z19kernelMovingAveragePdS_PiS0_,@function
_Z19kernelMovingAveragePdS_PiS0_:       ; @_Z19kernelMovingAveragePdS_PiS0_
; %bb.0:
	s_load_b256 s[0:7], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_load_b32 s4, s[4:5], 0x0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s4, s4, s15
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v1, s4, v0
	s_ashr_i32 s5, s4, 31
	v_add_co_u32 v5, s4, s4, v0
	v_add_co_ci_u32_e64 v6, null, s5, 0, s4
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v2, 31, v1
	s_load_b32 s4, s[6:7], 0x0
	v_lshlrev_b64 v[5:6], 3, v[5:6]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[1:2], 3, v[1:2]
	v_add_co_u32 v3, vcc_lo, s2, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_ci_u32_e32 v4, vcc_lo, s3, v2, vcc_lo
	v_add_co_u32 v5, vcc_lo, v5, s2
	v_add_co_ci_u32_e32 v6, vcc_lo, s3, v6, vcc_lo
	global_load_b64 v[3:4], v[3:4], off
	v_add_co_u32 v5, vcc_lo, v5, -8
	v_add_co_ci_u32_e32 v6, vcc_lo, -1, v6, vcc_lo
	s_mov_b32 s2, 1
.LBB0_1:                                ; =>This Inner Loop Header: Depth=1
	s_mov_b32 s3, exec_lo
	v_cmpx_le_u32_e64 s2, v0
	s_cbranch_execz .LBB0_3
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	global_load_b64 v[7:8], v[5:6], off
	s_waitcnt vmcnt(0)
	v_add_f64 v[3:4], v[3:4], v[7:8]
.LBB0_3:                                ;   in Loop: Header=BB0_1 Depth=1
	s_or_b32 exec_lo, exec_lo, s3
	v_add_co_u32 v5, vcc_lo, v5, -8
	v_add_co_ci_u32_e32 v6, vcc_lo, -1, v6, vcc_lo
	s_add_i32 s2, s2, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_lg_u32 s2, 9
	s_cbranch_scc1 .LBB0_1
; %bb.4:
	s_waitcnt lgkmcnt(0)
	v_cvt_f64_i32_e32 v[5:6], s4
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_scale_f64 v[7:8], null, v[5:6], v[5:6], v[3:4]
	v_rcp_f64_e32 v[9:10], v[7:8]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[11:12], -v[7:8], v[9:10], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[9:10], v[9:10], v[11:12], v[9:10]
	v_fma_f64 v[11:12], -v[7:8], v[9:10], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fma_f64 v[9:10], v[9:10], v[11:12], v[9:10]
	v_div_scale_f64 v[11:12], vcc_lo, v[3:4], v[5:6], v[3:4]
	v_mul_f64 v[13:14], v[11:12], v[9:10]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[7:8], -v[7:8], v[13:14], v[11:12]
	v_div_fmas_f64 v[7:8], v[7:8], v[9:10], v[13:14]
	v_add_co_u32 v0, vcc_lo, s0, v1
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v2, vcc_lo
	s_delay_alu instid0(VALU_DEP_3)
	v_div_fixup_f64 v[3:4], v[7:8], v[5:6], v[3:4]
	global_store_b64 v[0:1], v[3:4], off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z19kernelMovingAveragePdS_PiS0_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 32
		.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 15
		.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	_Z19kernelMovingAveragePdS_PiS0_, .Lfunc_end0-_Z19kernelMovingAveragePdS_PiS0_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 364
; NumSgprs: 18
; NumVgprs: 15
; ScratchSize: 0
; MemoryBound: 1
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 15
; 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	_Z19kernelColumnAveragePdS_Pi ; -- Begin function _Z19kernelColumnAveragePdS_Pi
	.globl	_Z19kernelColumnAveragePdS_Pi
	.p2align	8
	.type	_Z19kernelColumnAveragePdS_Pi,@function
_Z19kernelColumnAveragePdS_Pi:          ; @_Z19kernelColumnAveragePdS_Pi
; %bb.0:
	s_load_b64 s[2:3], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_load_b32 s2, s[2:3], 0x0
	s_load_b128 s[4:7], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s2, 1
	s_cbranch_scc1 .LBB1_4
; %bb.1:                                ; %.lr.ph.preheader
	v_mul_lo_u32 v3, s2, v0
	v_mov_b32_e32 v1, 0
	v_mov_b32_e32 v2, 0
	s_mov_b32 s1, 0
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v6, s2, v3
	v_ashrrev_i32_e32 v4, 31, v3
	v_lshlrev_b64 v[4:5], 3, v[3:4]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v4, vcc_lo, s6, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, s7, v5, vcc_lo
.LBB1_2:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	global_load_b64 v[7:8], v[4:5], off
	v_add_nc_u32_e32 v3, 1, v3
	v_add_co_u32 v4, s0, v4, 8
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e64 v5, s0, 0, v5, s0
	v_cmp_ge_i32_e32 vcc_lo, v3, v6
	s_or_b32 s1, vcc_lo, s1
	s_waitcnt vmcnt(0)
	v_add_f64 v[1:2], v[1:2], v[7:8]
	s_and_not1_b32 exec_lo, exec_lo, s1
	s_cbranch_execnz .LBB1_2
; %bb.3:                                ; %Flow
	s_or_b32 exec_lo, exec_lo, s1
	s_branch .LBB1_5
.LBB1_4:
	v_mov_b32_e32 v1, 0
	v_mov_b32_e32 v2, 0
.LBB1_5:                                ; %._crit_edge
	v_cvt_f64_i32_e32 v[3:4], s2
	v_lshlrev_b32_e32 v0, 3, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_scale_f64 v[5:6], null, v[3:4], v[3:4], v[1:2]
	v_rcp_f64_e32 v[7:8], v[5:6]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[9:10], -v[5:6], v[7:8], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[7:8], v[7:8], v[9:10], v[7:8]
	v_fma_f64 v[9:10], -v[5:6], v[7:8], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fma_f64 v[7:8], v[7:8], v[9:10], v[7:8]
	v_div_scale_f64 v[9:10], vcc_lo, v[1:2], v[3:4], v[1:2]
	v_mul_f64 v[11:12], v[9:10], v[7:8]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[5:6], -v[5:6], v[11:12], v[9:10]
	v_div_fmas_f64 v[5:6], v[5:6], v[7:8], v[11:12]
	s_delay_alu instid0(VALU_DEP_1)
	v_div_fixup_f64 v[1:2], v[5:6], v[3:4], v[1:2]
	global_store_b64 v0, v[1:2], s[4:5]
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z19kernelColumnAveragePdS_Pi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 24
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 13
		.amdhsa_next_free_sgpr 8
		.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	_Z19kernelColumnAveragePdS_Pi, .Lfunc_end1-_Z19kernelColumnAveragePdS_Pi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 308
; NumSgprs: 10
; NumVgprs: 13
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 1
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 10
; NumVGPRsForWavesPerEU: 13
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 32
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z19kernelMovingAveragePdS_PiS0_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z19kernelMovingAveragePdS_PiS0_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     15
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 24
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z19kernelColumnAveragePdS_Pi
    .private_segment_fixed_size: 0
    .sgpr_count:     10
    .sgpr_spill_count: 0
    .symbol:         _Z19kernelColumnAveragePdS_Pi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     13
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
