#include <stdio.h>
#include <sys/time.h>
#include <iostream>
#include <fstream>
#include <cstdint>
using namespace std;

/**
 * O argumento deve ser double
 */
#define GET_TIME(now) { \
	struct timespec time; \
	clock_gettime(CLOCK_MONOTONIC_RAW, &time); \
	now = time.tv_sec + time.tv_nsec/1000000000.0; \
}

/**
 * Para checar erros em chamadas Cuda
 */
#define CUDA_SAFE_CALL(call) { \
	cudaError_t err = call;     \
	if(err != cudaSuccess) {    \
		fprintf(stderr,"Erro no arquivo '%s', linha %i: %s.\n",__FILE__, __LINE__,cudaGetErrorString(err)); \
		exit(EXIT_FAILURE); } \
}

/**
 * Kernel para execucao paralela em CUDA
 */
__global__ void applyMask(uint8_t *image, uint8_t *ret, int width, int heigth, int colors) {
	int i = blockDim.x * blockIdx.x + threadIdx.x +1;
	int j = blockDim.y * blockIdx.y + threadIdx.y +1;
	int c = threadIdx.z;
	if (i<heigth && j<width){
		int gx = image[c+colors*((i-1)*width + j-1)] + 2*image[c+colors*((i-1)*width+j)] + image[c+colors*((i-1)*width+j+1)] - image[c+colors*((i+1)*width+j-1)] - 2*image[c+colors*((i+1)*width+j)] - image[c+colors*((i+1)*width+j+1)];
		int gy = image[c+colors*((i-1)*width+j-1)] + 2*image[c+colors*(i*width+j-1)] + image[c+colors*((i+1)*width+j-1)] - image[c+colors*((i-1)*width+j+1)] - 2*image[c+colors*(i*width+j+1)] - image[c+colors*((i+1)*width+j+1)];
		double g = sqrtf(gx*gx + gy*gy)/4;
		ret[c+colors*(i*width+j)] = (uint8_t) g;
	}
}

__global__ void applyMaskWithSharedMemory(uint8_t *image, uint8_t *ret, int width, int heigth, int colors) {
	extern __shared__ uint8_t subimagememory[];
	uint8_t *subimage = subimagememory;
	int i = (blockDim.x - 2) * blockIdx.x + threadIdx.x,
		j = (blockDim.y - 2) * blockIdx.y + threadIdx.y,
		c = threadIdx.z,
		x = threadIdx.x,
		y = threadIdx.y;
	if (i<heigth && j<width){
		subimage[c+colors*(x*blockDim.x + y)] = image[c+colors*((i)*width+j)];
		__syncthreads();
		if (x && x!=blockDim.x-1 && y && y!=blockDim.y-1){
			int gx = subimage[c+colors*((x-1)*blockDim.x + y-1)] + 2*subimage[c+colors*((x-1)*blockDim.x + y)] + subimage[c+colors*((x-1)*blockDim.x + y+1)]
					 - subimage[c+colors*((x+1)*blockDim.x + y-1)] - 2*subimage[c+colors*((x+1)*blockDim.x + y)] - subimage[c+colors*((x+1)*blockDim.x + y+1)];
			int gy = subimage[c+colors*((x-1)*blockDim.x + y-1)] + 2*subimage[c+colors*(x*blockDim.x + y-1)] + subimage[c+colors*((x+1)*blockDim.x + y-1)] 
				     - subimage[c+colors*((x-1)*blockDim.x + y+1)] - 2*subimage[c+colors*(x*blockDim.x + y+1)] - subimage[c+colors*((x+1)*blockDim.x + y+1)];
			double g = sqrtf(gx*gx + gy*gy)/4;
			ret[c+colors*(i*width+j)] = (uint8_t) g;
		} else {
			__syncthreads();
		}
	} else {
		__syncthreads();
	}
}

/**
 * Imprime os resultados do programa sequencial
 */
void printResultsSeq(unsigned int width, unsigned int heigth, unsigned int colors, double tempoSeq, bool csv = true){
	if (csv) {
		cout << width << ";" << heigth << ";" << colors << ";" << tempoSeq<< endl;
	} else {
		cout << "Dimensões da imagem = " << width << " x " << heigth << " (x"<<colors<<")" << endl
			 << "Tempo sequencial = "<< tempoSeq << " seg" << endl;
	}
}

/**
 * Imprime os resultados do programa paralelo
 */
void printResultsPar(unsigned int width, unsigned int heigth, unsigned int colors, unsigned int blockDim, float delta_eventos, double initialParTime, double finalParTime, bool csv = true){
	if (csv) {
		cout << width << ";" << heigth << ";" << colors << ";" << blockDim << ";" << delta_eventos/1000 << ";" << initialParTime << ";" << finalParTime << endl;
	} else {
		cout << "Dimensões da imagem = " << width << " x " << heigth << " (x"<<colors<<")" << endl
			 << "Dimensões dos blocos = " << blockDim << " x " << blockDim << endl
			 << "Tempo paralelo kernel = "<< delta_eventos/1000 << " seg" << endl
			 << "Tempo paralelo begin = "<< initialParTime <<" seg" << endl
			 << "Tempo paralelo end    = "<< finalParTime <<" seg" << endl
			 << "Tempo paralelo total  = "<< initialParTime+(delta_eventos/1000)+finalParTime <<" seg" << endl;
	}
}

void applyMaskPar(uint8_t **imagePointer, unsigned int width, unsigned int heigth, unsigned int colors, unsigned int blockDim, bool shared){
		long int imageBytes = width*heigth*colors*sizeof(uint8_t);
		double begin, end;
		uint8_t *image = imagePointer[0];
		double initialParTime, finalParTime;
		float delta_eventos = 0;
		cudaEvent_t start, stop;
		uint8_t *original, *result; //matrizes device
		// ALLOCATE SPACE AND COPY IMAGE TO DEVICE (CPU → GPU)
			GET_TIME(begin);
			// Aloca espaço para as matrizes na GPU
			CUDA_SAFE_CALL(cudaMalloc((void**) &original, imageBytes));
			CUDA_SAFE_CALL(cudaMalloc((void**) &result, imageBytes));
			
			// Copia as matrizes de entrada da CPU para a GPU (host para device)
			CUDA_SAFE_CALL(cudaMemcpy(original, image, imageBytes, cudaMemcpyHostToDevice));

			// Invoca o kernel com blocos de tamanhos fixos
			GET_TIME(end);
			initialParTime = end-begin; // Calcula o tempo das inicializações paralelo em segundos

		// KERNEL RUN
			CUDA_SAFE_CALL(cudaEventCreate(&start));
			CUDA_SAFE_CALL(cudaEventCreate(&stop));
			CUDA_SAFE_CALL(cudaEventRecord(start));
			if (shared){
				if (blockDim < 3){
					cerr << "Para executar com memória compartilhada é necessário ter pelo menos um bloco de 3x3" << endl;
					exit(EXIT_FAILURE);
				}
				dim3 threadsBlock = {blockDim, blockDim, colors};
				dim3 blocksGrid = {(heigth + threadsBlock.x - 1)/(blockDim-2), (width + threadsBlock.y - 1)/(blockDim-2), 1};
				int tamMemCompartilhada = threadsBlock.x*threadsBlock.y*colors*sizeof(uint8_t);
				applyMaskWithSharedMemory<<<blocksGrid, threadsBlock, tamMemCompartilhada>>>(original, result, width, heigth, colors);
			} else {
				dim3 threadsBlock = {blockDim, blockDim, colors};
				dim3 blocksGrid = {(heigth + threadsBlock.x - 3)/threadsBlock.x, (width + threadsBlock.y - 3)/threadsBlock.y, 1};
				applyMask<<<blocksGrid, threadsBlock>>>(original, result, width, heigth, colors);
			}
			CUDA_SAFE_CALL(cudaGetLastError());
			CUDA_SAFE_CALL(cudaEventRecord(stop));
			CUDA_SAFE_CALL(cudaEventSynchronize(stop));
			CUDA_SAFE_CALL(cudaEventElapsedTime(&delta_eventos, start, stop));

		// GET RESULT FROM DEVICE (GPU → CPU)
			GET_TIME(begin);
			CUDA_SAFE_CALL(cudaMemcpy(image, result, imageBytes, cudaMemcpyDeviceToHost))
			GET_TIME(end);
			finalParTime = end-begin; // calcula o tempo das finalizacoes paralelo em segundos

		// FREE MEMORY
			CUDA_SAFE_CALL(cudaFree(original));
			CUDA_SAFE_CALL(cudaFree(result));

			printResultsPar(width, heigth, colors, blockDim, delta_eventos, initialParTime, finalParTime);
}

void applyMaskSeq(uint8_t **imagePointer, unsigned int width, unsigned int heigth, unsigned int colors){
	double begin, end;
	uint8_t *image = imagePointer[0], *ret;
	long int imageBytes = width*heigth*colors*sizeof(uint8_t);
	ret = (uint8_t *) malloc(imageBytes);
	if ( ret == NULL   ) {
		cerr << "Memoria  insuficiente" << endl;
		exit(EXIT_FAILURE);
	}
	double tempoSeq;
	GET_TIME(begin);
	for (int i = 1; i < heigth -1; ++i) {
		for (int j = 1; j < width -1; ++j) {
			for (int c = 0; c < colors; ++c) {
				int gx = image[c+colors*((i-1)*width + j-1)] + 2*image[c+colors*((i-1)*width+j)] + image[c+colors*((i-1)*width+j+1)] - image[c+colors*((i+1)*width+j-1)] - 2*image[c+colors*((i+1)*width+j)] - image[c+colors*((i+1)*width+j+1)];
				int gy = image[c+colors*((i-1)*width+j-1)] + 2*image[c+colors*(i*width+j-1)] + image[c+colors*((i+1)*width+j-1)] - image[c+colors*((i-1)*width+j+1)] - 2*image[c+colors*(i*width+j+1)] - image[c+colors*((i+1)*width+j+1)];
				double g = sqrt(gx*gx + gy*gy)/4;
				ret[c+colors*(i*width+j)] = (uint8_t) g;
			}
		}
	}
	GET_TIME(end);
	tempoSeq = end-begin;
	printResultsSeq(width, heigth, colors, tempoSeq);
	imagePointer[0] = ret;
	free(image);
}

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

	// INPUT
		unsigned int width, heigth, colors, blockDim;
		long int imageBytes; //qtde bytes por matriz
		uint8_t *image; //matrizes host
		char *inputFileName, *outputFileName;

	// GET INPUT
		if(argc < 6) {
			cerr << "Digite: "<< argv[0] <<" <largura da imagem> <altura da imagem> <cores na imagem (1 para escala de cinza ou 3 para rgb)> <arquivo de entrada> <arquivo de saída> [nº de linhas e colunas dos blocos]" << endl;
			exit(EXIT_FAILURE);
		}
		//dimensao das matrizes e tamanho dos blocos
		width = atol(argv[1]);
		heigth = atol(argv[2]);
		colors = atol(argv[3]);
		inputFileName = argv[4];
		outputFileName = argv[5];

	// LOAD IMAGE
		imageBytes = width*heigth*colors*sizeof(uint8_t);
		image = (uint8_t *) malloc(imageBytes);
		if ( image == NULL   ) {
			cerr << "Memoria  insuficiente" << endl;
			exit(EXIT_FAILURE);
		}
		ifstream infile (inputFileName, ios::binary);
		infile.read(reinterpret_cast<char *>(image), imageBytes);
		infile.close();

	if (argc > 6){
		blockDim = atol(argv[6]);
		applyMaskPar(&image, width, heigth, colors, blockDim, argc>7);
	} else {
		applyMaskSeq(&image, width, heigth, colors);
	}
	// SAVE RESULT IN FILE
		ofstream outfile (outputFileName, ios::binary);
		outfile.write(reinterpret_cast<char *>(image), imageBytes);
		outfile.close();

	free(image);

	return 0;
}

	.file	"tmpxft_002cb04f_00000000-6_sobel.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3773:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3773:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	";"
.LC1:
	.string	"Dimens\303\265es da imagem = "
.LC2:
	.string	" x "
.LC3:
	.string	" (x"
.LC4:
	.string	")"
.LC5:
	.string	"Tempo sequencial = "
.LC6:
	.string	" seg"
	.text
	.globl	_Z15printResultsSeqjjjdb
	.type	_Z15printResultsSeqjjjdb, @function
_Z15printResultsSeqjjjdb:
.LFB3766:
	.cfi_startproc
	endbr64
	testb	%cl, %cl
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%xmm0, %r14
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	%edi, %r12d
	leaq	_ZSt4cout(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movl	%edx, %ebx
	pushq	%r8
	.cfi_def_cfa_offset 48
	je	.L3
	movq	%r12, %rsi
	leaq	.LC0(%rip), %r12
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	%r12, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbp, %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	%r12, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	%r12, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r14, %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	jmp	.L5
.L3:
	leaq	.LC1(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r12, %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbp, %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	leaq	.LC3(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	leaq	.LC4(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC5(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r14, %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	leaq	.LC6(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.L5:
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	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	%r14
	.cfi_def_cfa_offset 8
	jmp	_ZNSolsEPFRSoS_E@PLT
	.cfi_endproc
.LFE3766:
	.size	_Z15printResultsSeqjjjdb, .-_Z15printResultsSeqjjjdb
	.section	.rodata.str1.1
.LC8:
	.string	"Dimens\303\265es dos blocos = "
.LC9:
	.string	"Tempo paralelo kernel = "
.LC10:
	.string	"Tempo paralelo begin = "
.LC11:
	.string	"Tempo paralelo end    = "
.LC12:
	.string	"Tempo paralelo total  = "
	.text
	.globl	_Z15printResultsParjjjjfddb
	.type	_Z15printResultsParjjjjfddb, @function
_Z15printResultsParjjjjfddb:
.LFB3767:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movd	%xmm0, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movl	%esi, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movl	%ecx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movl	%edi, %ebx
	leaq	_ZSt4cout(%rip), %rdi
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	testb	%r8b, %r8b
	movsd	%xmm1, 8(%rsp)
	movsd	%xmm2, 16(%rsp)
	je	.L8
	movq	%rbx, %rsi
	leaq	.LC0(%rip), %rbx
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r13, %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r12, %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbp, %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movd	%r14d, %xmm0
	divss	.LC7(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	8(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	16(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	jmp	.L10
.L8:
	leaq	.LC1(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbx, %rsi
	leaq	.LC2(%rip), %rbx
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r13, %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	leaq	.LC3(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r12, %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	leaq	.LC4(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC8(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbp, %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	%rbx, %rsi
	leaq	.LC6(%rip), %rbx
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbp, %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC9(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movd	%r14d, %xmm0
	divss	.LC7(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm3
	movq	%rax, %rdi
	movaps	%xmm3, %xmm0
	movsd	%xmm3, 24(%rsp)
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC10(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	8(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC11(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	16(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	leaq	.LC12(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	8(%rsp), %xmm0
	addsd	24(%rsp), %xmm0
	addsd	16(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.L10:
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	addq	$32, %rsp
	.cfi_def_cfa_offset 48
	movq	%rax, %rdi
	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	_ZNSolsEPFRSoS_E@PLT
	.cfi_endproc
.LFE3767:
	.size	_Z15printResultsParjjjjfddb, .-_Z15printResultsParjjjjfddb
	.section	.rodata.str1.1
.LC13:
	.string	"Memoria  insuficiente"
	.text
	.globl	_Z12applyMaskSeqPPhjjj
	.type	_Z12applyMaskSeqPPhjjj, @function
_Z12applyMaskSeqPPhjjj:
.LFB3769:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%esi, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%ecx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$168, %rsp
	.cfi_def_cfa_offset 224
	movq	(%rdi), %r14
	movq	%rdi, 24(%rsp)
	movl	%edx, %edi
	imull	%ecx, %edi
	movl	%edx, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	imull	%esi, %edi
	call	malloc@PLT
	movq	%rax, (%rsp)
	testq	%rax, %rax
	jne	.L12
	leaq	.LC13(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movl	$1, %edi
	call	exit@PLT
.L12:
	leaq	136(%rsp), %rsi
	movl	$4, %edi
	xorl	%r15d, %r15d
	call	clock_gettime@PLT
	movl	%r13d, %esi
	leal	1(%r13,%r13), %eax
	leal	(%rbp,%rbp), %ecx
	imull	%ebp, %eax
	movl	%ecx, %edx
	movl	$1, 12(%rsp)
	cvtsi2sdq	136(%rsp), %xmm1
	imull	%ebp, %esi
	movl	%eax, 104(%rsp)
	imull	%r13d, %edx
	cvtsi2sdq	144(%rsp), %xmm0
	divsd	.LC14(%rip), %xmm0
	leal	(%rcx,%rsi), %eax
	addsd	%xmm1, %xmm0
	movl	%eax, 108(%rsp)
	subl	%ebp, %eax
	movl	%eax, 112(%rsp)
	movsd	%xmm0, 80(%rsp)
.L13:
	movl	8(%rsp), %eax
	decl	%eax
	cmpl	%eax, 12(%rsp)
	jnb	.L17
	leal	(%rcx,%r15), %eax
	movl	$1, 16(%rsp)
	xorl	%r12d, %r12d
	movl	%eax, 20(%rsp)
	movl	104(%rsp), %eax
	addl	%r15d, %eax
	movl	%eax, 88(%rsp)
	leal	(%rcx,%rdx), %eax
	movl	%eax, 92(%rsp)
	leal	(%r15,%rsi), %eax
	movl	%eax, 32(%rsp)
	movl	108(%rsp), %eax
	addl	%r15d, %eax
	movl	%eax, 96(%rsp)
	movl	112(%rsp), %eax
	addl	%r15d, %eax
	movl	%eax, 100(%rsp)
.L18:
	leal	-1(%r13), %eax
	cmpl	%eax, 16(%rsp)
	jnb	.L15
	leal	(%r12,%r15), %eax
	xorl	%ebx, %ebx
	movl	%eax, 36(%rsp)
	movl	20(%rsp), %eax
	subl	%ebp, %eax
	addl	%r12d, %eax
	movl	%eax, 40(%rsp)
	movl	20(%rsp), %eax
	addl	%r12d, %eax
	movl	%eax, 44(%rsp)
	leal	(%r12,%rdx), %eax
	movl	%eax, 56(%rsp)
	movl	88(%rsp), %eax
	addl	%r12d, %eax
	movl	%eax, 60(%rsp)
	movl	92(%rsp), %eax
	addl	%r12d, %eax
	movl	%eax, 64(%rsp)
	movl	32(%rsp), %eax
	addl	%r12d, %eax
	movl	%eax, 68(%rsp)
	movl	96(%rsp), %eax
	addl	%r12d, %eax
	movl	%eax, 72(%rsp)
	movl	100(%rsp), %eax
	addl	%r12d, %eax
	movl	%eax, 76(%rsp)
	movl	%ebp, %eax
	movq	%rax, 48(%rsp)
.L16:
	movq	48(%rsp), %rax
	cmpq	%rax, %rbx
	je	.L22
	movl	36(%rsp), %eax
	movl	%ecx, 116(%rsp)
	movl	60(%rsp), %ecx
	movl	%edx, 124(%rsp)
	addl	%ebx, %eax
	movl	68(%rsp), %edx
	movl	%esi, 120(%rsp)
	movl	%eax, %eax
	leal	(%rcx,%rbx), %r11d
	movl	72(%rsp), %ecx
	movzbl	(%r14,%rax), %r10d
	movl	44(%rsp), %eax
	movzbl	(%r14,%r11), %r11d
	addl	%ebx, %eax
	movl	%eax, %eax
	addl	%r11d, %r11d
	movzbl	(%r14,%rax), %r8d
	movl	56(%rsp), %eax
	addl	%ebx, %eax
	movl	%eax, %eax
	movzbl	(%r14,%rax), %r9d
	movl	64(%rsp), %eax
	addl	%ebx, %eax
	movl	%eax, %eax
	movzbl	(%r14,%rax), %edi
	movl	40(%rsp), %eax
	addl	%ebx, %eax
	movl	%eax, %eax
	movzbl	(%r14,%rax), %eax
	leal	(%r10,%rax,2), %eax
	addl	%r8d, %eax
	subl	%r9d, %eax
	subl	%r11d, %eax
	leal	(%rdx,%rbx), %r11d
	movzbl	(%r14,%r11), %r11d
	subl	%edi, %eax
	imull	%eax, %eax
	leal	(%r10,%r11,2), %r10d
	addl	%r9d, %r10d
	subl	%r8d, %r10d
	leal	(%rcx,%rbx), %r8d
	movzbl	(%r14,%r8), %r8d
	addl	%r8d, %r8d
	subl	%r8d, %r10d
	subl	%edi, %r10d
	imull	%r10d, %r10d
	addl	%r10d, %eax
	cvtsi2sdl	%eax, %xmm0
	call	sqrt@PLT
	movl	76(%rsp), %eax
	movq	(%rsp), %rdx
	mulsd	.LC15(%rip), %xmm0
	movl	120(%rsp), %esi
	addl	%ebx, %eax
	movl	116(%rsp), %ecx
	incq	%rbx
	movl	%eax, %eax
	cvttsd2sil	%xmm0, %edi
	movb	%dil, (%rdx,%rax)
	movl	124(%rsp), %edx
	jmp	.L16
.L22:
	incl	16(%rsp)
	addl	%ebp, %r12d
	jmp	.L18
.L15:
	incl	12(%rsp)
	movl	32(%rsp), %r15d
	addl	%esi, %edx
	jmp	.L13
.L17:
	leaq	136(%rsp), %rsi
	movl	$4, %edi
	call	clock_gettime@PLT
	movl	8(%rsp), %esi
	movl	$1, %ecx
	movl	%ebp, %edx
	cvtsi2sdq	136(%rsp), %xmm1
	movl	%r13d, %edi
	cvtsi2sdq	144(%rsp), %xmm0
	divsd	.LC14(%rip), %xmm0
	addsd	%xmm1, %xmm0
	subsd	80(%rsp), %xmm0
	call	_Z15printResultsSeqjjjdb
	movq	24(%rsp), %rax
	movq	(%rsp), %rcx
	movq	%rcx, (%rax)
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	addq	$168, %rsp
	.cfi_def_cfa_offset 56
	movq	%r14, %rdi
	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
	jmp	free@PLT
	.cfi_endproc
.LFE3769:
	.size	_Z12applyMaskSeqPPhjjj, .-_Z12applyMaskSeqPPhjjj
	.globl	_Z33__device_stub__Z9applyMaskPhS_iiiPhS_iii
	.type	_Z33__device_stub__Z9applyMaskPhS_iiiPhS_iii, @function
_Z33__device_stub__Z9applyMaskPhS_iiiPhS_iii:
.LFB3795:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 8(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, 4(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L23
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z9applyMaskPhS_iii(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	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 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L23:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3795:
	.size	_Z33__device_stub__Z9applyMaskPhS_iiiPhS_iii, .-_Z33__device_stub__Z9applyMaskPhS_iiiPhS_iii
	.globl	_Z9applyMaskPhS_iii
	.type	_Z9applyMaskPhS_iii, @function
_Z9applyMaskPhS_iii:
.LFB3796:
	.cfi_startproc
	endbr64
	jmp	_Z33__device_stub__Z9applyMaskPhS_iiiPhS_iii
	.cfi_endproc
.LFE3796:
	.size	_Z9applyMaskPhS_iii, .-_Z9applyMaskPhS_iii
	.globl	_Z50__device_stub__Z25applyMaskWithSharedMemoryPhS_iiiPhS_iii
	.type	_Z50__device_stub__Z25applyMaskWithSharedMemoryPhS_iiiPhS_iii, @function
_Z50__device_stub__Z25applyMaskWithSharedMemoryPhS_iiiPhS_iii:
.LFB3797:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 8(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, 4(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L28
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z25applyMaskWithSharedMemoryPhS_iii(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	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 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L28:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3797:
	.size	_Z50__device_stub__Z25applyMaskWithSharedMemoryPhS_iiiPhS_iii, .-_Z50__device_stub__Z25applyMaskWithSharedMemoryPhS_iiiPhS_iii
	.globl	_Z25applyMaskWithSharedMemoryPhS_iii
	.type	_Z25applyMaskWithSharedMemoryPhS_iii, @function
_Z25applyMaskWithSharedMemoryPhS_iii:
.LFB3798:
	.cfi_startproc
	endbr64
	jmp	_Z50__device_stub__Z25applyMaskWithSharedMemoryPhS_iiiPhS_iii
	.cfi_endproc
.LFE3798:
	.size	_Z25applyMaskWithSharedMemoryPhS_iii, .-_Z25applyMaskWithSharedMemoryPhS_iii
	.section	.rodata.str1.1
.LC17:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/jfportalb/GPU/master/sobel.cu"
.LC18:
	.string	"Erro no arquivo '%s', linha %i: %s.\n"
.LC19:
	.string	"Para executar com mem\303\263ria compartilhada \303\251 necess\303\241rio ter pelo menos um bloco de 3x3"
	.text
	.globl	_Z12applyMaskParPPhjjjjb
	.type	_Z12applyMaskParPPhjjjjb, @function
_Z12applyMaskParPPhjjjjb:
.LFB3768:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%r9d, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	%edx, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	imull	%ecx, %r14d
	movl	%edx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%esi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%ecx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	imull	%esi, %r14d
	movl	%r8d, %ebx
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	movq	(%rdi), %rax
	movl	$4, %edi
	movl	$0x00000000, 36(%rsp)
	movq	%rax, 8(%rsp)
	leaq	88(%rsp), %rax
	movq	%rax, %rsi
	movq	%rax, (%rsp)
	call	clock_gettime@PLT
	cvtsi2sdq	88(%rsp), %xmm1
	leaq	56(%rsp), %rdi
	movq	%r14, %rsi
	cvtsi2sdq	96(%rsp), %xmm0
	divsd	.LC14(%rip), %xmm0
	addsd	%xmm1, %xmm0
	movsd	%xmm0, 16(%rsp)
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L34
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$107, %r8d
	movq	%rax, %r9
	jmp	.L54
.L34:
	leaq	64(%rsp), %rdi
	movq	%r14, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L35
	call	cudaGetErrorString@PLT
	movl	$108, %r8d
	movq	%rax, %r9
.L54:
	movq	stderr(%rip), %rdi
	leaq	.LC17(%rip), %rcx
	leaq	.LC18(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
.L55:
	movl	$1, %edi
	call	exit@PLT
.L35:
	movq	56(%rsp), %rdi
	movq	8(%rsp), %rsi
	movl	$1, %ecx
	movq	%r14, %rdx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L36
	call	cudaGetErrorString@PLT
	movl	$111, %r8d
	movq	%rax, %r9
	jmp	.L54
.L36:
	movq	(%rsp), %rsi
	movl	$4, %edi
	call	clock_gettime@PLT
	cvtsi2sdq	88(%rsp), %xmm1
	leaq	40(%rsp), %rdi
	cvtsi2sdq	96(%rsp), %xmm0
	divsd	.LC14(%rip), %xmm0
	addsd	%xmm1, %xmm0
	subsd	16(%rsp), %xmm0
	movsd	%xmm0, 16(%rsp)
	call	cudaEventCreate@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L37
	call	cudaGetErrorString@PLT
	movl	$118, %r8d
	movq	%rax, %r9
	jmp	.L54
.L37:
	leaq	48(%rsp), %rdi
	call	cudaEventCreate@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L38
	call	cudaGetErrorString@PLT
	movl	$119, %r8d
	movq	%rax, %r9
	jmp	.L54
.L38:
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L39
	call	cudaGetErrorString@PLT
	movl	$120, %r8d
	movq	%rax, %r9
	jmp	.L54
.L39:
	testb	%r15b, %r15b
	je	.L40
	cmpl	$2, %ebx
	ja	.L41
	leaq	.LC19(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	jmp	.L55
.L41:
	leal	-1(%rbx), %ecx
	leal	-2(%rbx), %esi
	xorl	%edx, %edx
	movl	%ebx, %r8d
	imull	%ebx, %r8d
	leal	0(%r13,%rcx), %eax
	movl	%ebx, 76(%rsp)
	xorl	%r9d, %r9d
	divl	%esi
	movl	%ebx, 80(%rsp)
	movl	%ebp, 84(%rsp)
	movl	$1, 96(%rsp)
	xorl	%edx, %edx
	imull	%ebp, %r8d
	movslq	%r8d, %r8
	movl	%eax, 88(%rsp)
	leal	(%r12,%rcx), %eax
	movl	%ebp, %ecx
	divl	%esi
	movq	76(%rsp), %rdx
	movl	$1, %esi
	movl	%eax, 92(%rsp)
	movq	88(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L43
	movq	64(%rsp), %rsi
	movq	56(%rsp), %rdi
	movl	%ebp, %r8d
	movl	%r13d, %ecx
	movl	%r12d, %edx
	call	_Z50__device_stub__Z25applyMaskWithSharedMemoryPhS_iiiPhS_iii
	jmp	.L43
.L40:
	leal	-3(%rbx), %ecx
	xorl	%edx, %edx
	movl	%ebx, 76(%rsp)
	xorl	%r9d, %r9d
	leal	0(%r13,%rcx), %eax
	movl	%ebx, 80(%rsp)
	xorl	%r8d, %r8d
	movl	$1, %esi
	divl	%ebx
	movl	%ebp, 84(%rsp)
	movl	$1, 96(%rsp)
	xorl	%edx, %edx
	movl	%eax, 88(%rsp)
	leal	(%r12,%rcx), %eax
	movl	%ebp, %ecx
	divl	%ebx
	movq	76(%rsp), %rdx
	movl	%eax, 92(%rsp)
	movq	88(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L43
	movq	64(%rsp), %rsi
	movq	56(%rsp), %rdi
	movl	%ebp, %r8d
	movl	%r13d, %ecx
	movl	%r12d, %edx
	call	_Z33__device_stub__Z9applyMaskPhS_iiiPhS_iii
.L43:
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L45
	call	cudaGetErrorString@PLT
	movl	$135, %r8d
	movq	%rax, %r9
	jmp	.L54
.L45:
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L46
	call	cudaGetErrorString@PLT
	movl	$136, %r8d
	movq	%rax, %r9
	jmp	.L54
.L46:
	movq	48(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L47
	call	cudaGetErrorString@PLT
	movl	$137, %r8d
	movq	%rax, %r9
	jmp	.L54
.L47:
	movq	48(%rsp), %rdx
	movq	40(%rsp), %rsi
	leaq	36(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L48
	call	cudaGetErrorString@PLT
	movl	$138, %r8d
	movq	%rax, %r9
	jmp	.L54
.L48:
	movq	(%rsp), %rsi
	movl	$4, %edi
	call	clock_gettime@PLT
	cvtsi2sdq	88(%rsp), %xmm1
	movq	8(%rsp), %rdi
	movq	%r14, %rdx
	cvtsi2sdq	96(%rsp), %xmm0
	movq	64(%rsp), %rsi
	movl	$2, %ecx
	divsd	.LC14(%rip), %xmm0
	addsd	%xmm1, %xmm0
	movsd	%xmm0, 24(%rsp)
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L49
	call	cudaGetErrorString@PLT
	movl	$142, %r8d
	movq	%rax, %r9
	jmp	.L54
.L49:
	movq	(%rsp), %rsi
	movl	$4, %edi
	call	clock_gettime@PLT
	cvtsi2sdq	88(%rsp), %xmm0
	movq	56(%rsp), %rdi
	cvtsi2sdq	96(%rsp), %xmm2
	divsd	.LC14(%rip), %xmm2
	addsd	%xmm0, %xmm2
	subsd	24(%rsp), %xmm2
	movsd	%xmm2, (%rsp)
	call	cudaFree@PLT
	movsd	(%rsp), %xmm2
	testl	%eax, %eax
	movl	%eax, %edi
	je	.L50
	call	cudaGetErrorString@PLT
	movl	$147, %r8d
	movq	%rax, %r9
	jmp	.L54
.L50:
	movq	64(%rsp), %rdi
	movsd	%xmm2, (%rsp)
	call	cudaFree@PLT
	movsd	(%rsp), %xmm2
	testl	%eax, %eax
	movl	%eax, %edi
	je	.L51
	call	cudaGetErrorString@PLT
	movl	$148, %r8d
	movq	%rax, %r9
	jmp	.L54
.L51:
	movsd	16(%rsp), %xmm1
	movss	36(%rsp), %xmm0
	movl	%ebx, %ecx
	movl	%ebp, %edx
	movl	$1, %r8d
	movl	%r13d, %esi
	movl	%r12d, %edi
	call	_Z15printResultsParjjjjfddb
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L52
	call	__stack_chk_fail@PLT
.L52:
	addq	$120, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3768:
	.size	_Z12applyMaskParPPhjjjjb, .-_Z12applyMaskParPPhjjjjb
	.section	.rodata.str1.1
.LC20:
	.string	"_Z25applyMaskWithSharedMemoryPhS_iii"
.LC21:
	.string	"_Z9applyMaskPhS_iii"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3800:
	.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	.LC20(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z25applyMaskWithSharedMemoryPhS_iii(%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	.LC21(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z9applyMaskPhS_iii(%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
.LFE3800:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata.str1.1
.LC22:
	.string	"Digite: "
.LC23:
	.string	" <largura da imagem> <altura da imagem> <cores na imagem (1 para escala de cinza ou 3 para rgb)> <arquivo de entrada> <arquivo de sa\303\255da> [n\302\272 de linhas e colunas dos blocos]"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3770:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3770
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$1096, %rsp
	.cfi_def_cfa_offset 1152
	movq	%fs:40, %rax
	movq	%rax, 1080(%rsp)
	xorl	%eax, %eax
	cmpl	$5, %edi
	jg	.L59
	leaq	.LC22(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
.LEHB0:
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	(%rbx), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC23(%rip), %rsi
	movq	%rax, %rdi
	jmp	.L73
.L59:
	movl	%edi, %ebp
	movq	8(%rsi), %rdi
	call	atol@PLT
	movq	16(%rbx), %rdi
	movq	%rax, %r12
	movl	%eax, %r13d
	call	atol@PLT
	movq	24(%rbx), %rdi
	movq	%rax, 8(%rsp)
	movl	%eax, %r14d
	call	atol@PLT
	movq	8(%rsp), %rdx
	movq	40(%rbx), %rcx
	movq	32(%rbx), %rsi
	movl	%eax, %r15d
	imull	%r12d, %edx
	movq	%rcx, 16(%rsp)
	movq	%rsi, (%rsp)
	movl	%edx, %ecx
	imull	%eax, %ecx
	movq	%rcx, %rdi
	movq	%rcx, 8(%rsp)
	call	malloc@PLT
	movq	(%rsp), %rsi
	testq	%rax, %rax
	movq	%rax, 40(%rsp)
	jne	.L60
	leaq	.LC13(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
.L73:
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movl	$1, %edi
	call	exit@PLT
.L60:
	movq	%rax, 24(%rsp)
	leaq	560(%rsp), %rax
	movl	$4, %edx
	movq	%rax, %rdi
	movq	%rax, (%rsp)
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
.LEHE0:
	movq	8(%rsp), %rdx
	movq	24(%rsp), %rsi
	movq	(%rsp), %rdi
.LEHB1:
	call	_ZNSi4readEPcl@PLT
	movq	(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv@PLT
	cmpl	$6, %ebp
	leaq	40(%rsp), %r12
	je	.L61
	movq	48(%rbx), %rdi
	call	atol@PLT
	xorl	%r9d, %r9d
	cmpl	$7, %ebp
	movl	%r15d, %ecx
	setg	%r9b
	movl	%eax, %r8d
	movl	%r14d, %edx
	movl	%r13d, %esi
	movq	%r12, %rdi
	call	_Z12applyMaskParPPhjjjjb
.L63:
	leaq	48(%rsp), %rbp
	movq	16(%rsp), %rsi
	movl	$4, %edx
	movq	%rbp, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
	jmp	.L74
.L61:
	movl	%r15d, %ecx
	movl	%r14d, %edx
	movl	%r13d, %esi
	movq	%r12, %rdi
	call	_Z12applyMaskSeqPPhjjj
.LEHE1:
	jmp	.L63
.L74:
	movq	40(%rsp), %rbx
	movq	8(%rsp), %rdx
	movq	%rbp, %rdi
	movq	%rbx, %rsi
.LEHB2:
	call	_ZNSo5writeEPKcl@PLT
	movq	%rbp, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
.LEHE2:
	movq	%rbx, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	1080(%rsp), %rax
	subq	%fs:40, %rax
	je	.L67
	jmp	.L71
.L69:
	endbr64
	movq	%rax, %rbx
.L64:
	movq	%rbp, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L65
.L68:
	endbr64
	movq	%rax, %rbx
.L65:
	movq	(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	1080(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L71
	movq	%rbx, %rdi
.LEHB3:
	call	_Unwind_Resume@PLT
.LEHE3:
.L71:
	call	__stack_chk_fail@PLT
.L67:
	addq	$1096, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3770:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3770:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3770-.LLSDACSB3770
.LLSDACSB3770:
	.uleb128 .LEHB0-.LFB3770
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB3770
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L68-.LFB3770
	.uleb128 0
	.uleb128 .LEHB2-.LFB3770
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L69-.LFB3770
	.uleb128 0
	.uleb128 .LEHB3-.LFB3770
	.uleb128 .LEHE3-.LEHB3
	.uleb128 0
	.uleb128 0
.LLSDACSE3770:
	.section	.text.startup
	.size	main, .-main
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC7:
	.long	1148846080
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC14:
	.long	0
	.long	1104006501
	.align 8
.LC15:
	.long	0
	.long	1070596096
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <stdio.h>
#include <sys/time.h>
#include <iostream>
#include <fstream>
#include <cstdint>
using namespace std;

/**
 * O argumento deve ser double
 */
#define GET_TIME(now) { \
	struct timespec time; \
	clock_gettime(CLOCK_MONOTONIC_RAW, &time); \
	now = time.tv_sec + time.tv_nsec/1000000000.0; \
}

/**
 * Para checar erros em chamadas Cuda
 */
#define CUDA_SAFE_CALL(call) { \
	hipError_t err = call;     \
	if(err != hipSuccess) {    \
		fprintf(stderr,"Erro no arquivo '%s', linha %i: %s.\n",__FILE__, __LINE__,hipGetErrorString(err)); \
		exit(EXIT_FAILURE); } \
}

/**
 * Kernel para execucao paralela em CUDA
 */
__global__ void applyMask(uint8_t *image, uint8_t *ret, int width, int heigth, int colors) {
	int i = blockDim.x * blockIdx.x + threadIdx.x +1;
	int j = blockDim.y * blockIdx.y + threadIdx.y +1;
	int c = threadIdx.z;
	if (i<heigth && j<width){
		int gx = image[c+colors*((i-1)*width + j-1)] + 2*image[c+colors*((i-1)*width+j)] + image[c+colors*((i-1)*width+j+1)] - image[c+colors*((i+1)*width+j-1)] - 2*image[c+colors*((i+1)*width+j)] - image[c+colors*((i+1)*width+j+1)];
		int gy = image[c+colors*((i-1)*width+j-1)] + 2*image[c+colors*(i*width+j-1)] + image[c+colors*((i+1)*width+j-1)] - image[c+colors*((i-1)*width+j+1)] - 2*image[c+colors*(i*width+j+1)] - image[c+colors*((i+1)*width+j+1)];
		double g = sqrtf(gx*gx + gy*gy)/4;
		ret[c+colors*(i*width+j)] = (uint8_t) g;
	}
}

__global__ void applyMaskWithSharedMemory(uint8_t *image, uint8_t *ret, int width, int heigth, int colors) {
	extern __shared__ uint8_t subimagememory[];
	uint8_t *subimage = subimagememory;
	int i = (blockDim.x - 2) * blockIdx.x + threadIdx.x,
		j = (blockDim.y - 2) * blockIdx.y + threadIdx.y,
		c = threadIdx.z,
		x = threadIdx.x,
		y = threadIdx.y;
	if (i<heigth && j<width){
		subimage[c+colors*(x*blockDim.x + y)] = image[c+colors*((i)*width+j)];
		__syncthreads();
		if (x && x!=blockDim.x-1 && y && y!=blockDim.y-1){
			int gx = subimage[c+colors*((x-1)*blockDim.x + y-1)] + 2*subimage[c+colors*((x-1)*blockDim.x + y)] + subimage[c+colors*((x-1)*blockDim.x + y+1)]
					 - subimage[c+colors*((x+1)*blockDim.x + y-1)] - 2*subimage[c+colors*((x+1)*blockDim.x + y)] - subimage[c+colors*((x+1)*blockDim.x + y+1)];
			int gy = subimage[c+colors*((x-1)*blockDim.x + y-1)] + 2*subimage[c+colors*(x*blockDim.x + y-1)] + subimage[c+colors*((x+1)*blockDim.x + y-1)] 
				     - subimage[c+colors*((x-1)*blockDim.x + y+1)] - 2*subimage[c+colors*(x*blockDim.x + y+1)] - subimage[c+colors*((x+1)*blockDim.x + y+1)];
			double g = sqrtf(gx*gx + gy*gy)/4;
			ret[c+colors*(i*width+j)] = (uint8_t) g;
		} else {
			__syncthreads();
		}
	} else {
		__syncthreads();
	}
}

/**
 * Imprime os resultados do programa sequencial
 */
void printResultsSeq(unsigned int width, unsigned int heigth, unsigned int colors, double tempoSeq, bool csv = true){
	if (csv) {
		cout << width << ";" << heigth << ";" << colors << ";" << tempoSeq<< endl;
	} else {
		cout << "Dimensões da imagem = " << width << " x " << heigth << " (x"<<colors<<")" << endl
			 << "Tempo sequencial = "<< tempoSeq << " seg" << endl;
	}
}

/**
 * Imprime os resultados do programa paralelo
 */
void printResultsPar(unsigned int width, unsigned int heigth, unsigned int colors, unsigned int blockDim, float delta_eventos, double initialParTime, double finalParTime, bool csv = true){
	if (csv) {
		cout << width << ";" << heigth << ";" << colors << ";" << blockDim << ";" << delta_eventos/1000 << ";" << initialParTime << ";" << finalParTime << endl;
	} else {
		cout << "Dimensões da imagem = " << width << " x " << heigth << " (x"<<colors<<")" << endl
			 << "Dimensões dos blocos = " << blockDim << " x " << blockDim << endl
			 << "Tempo paralelo kernel = "<< delta_eventos/1000 << " seg" << endl
			 << "Tempo paralelo begin = "<< initialParTime <<" seg" << endl
			 << "Tempo paralelo end    = "<< finalParTime <<" seg" << endl
			 << "Tempo paralelo total  = "<< initialParTime+(delta_eventos/1000)+finalParTime <<" seg" << endl;
	}
}

void applyMaskPar(uint8_t **imagePointer, unsigned int width, unsigned int heigth, unsigned int colors, unsigned int blockDim, bool shared){
		long int imageBytes = width*heigth*colors*sizeof(uint8_t);
		double begin, end;
		uint8_t *image = imagePointer[0];
		double initialParTime, finalParTime;
		float delta_eventos = 0;
		hipEvent_t start, stop;
		uint8_t *original, *result; //matrizes device
		// ALLOCATE SPACE AND COPY IMAGE TO DEVICE (CPU → GPU)
			GET_TIME(begin);
			// Aloca espaço para as matrizes na GPU
			CUDA_SAFE_CALL(hipMalloc((void**) &original, imageBytes));
			CUDA_SAFE_CALL(hipMalloc((void**) &result, imageBytes));
			
			// Copia as matrizes de entrada da CPU para a GPU (host para device)
			CUDA_SAFE_CALL(hipMemcpy(original, image, imageBytes, hipMemcpyHostToDevice));

			// Invoca o kernel com blocos de tamanhos fixos
			GET_TIME(end);
			initialParTime = end-begin; // Calcula o tempo das inicializações paralelo em segundos

		// KERNEL RUN
			CUDA_SAFE_CALL(hipEventCreate(&start));
			CUDA_SAFE_CALL(hipEventCreate(&stop));
			CUDA_SAFE_CALL(hipEventRecord(start));
			if (shared){
				if (blockDim < 3){
					cerr << "Para executar com memória compartilhada é necessário ter pelo menos um bloco de 3x3" << endl;
					exit(EXIT_FAILURE);
				}
				dim3 threadsBlock = {blockDim, blockDim, colors};
				dim3 blocksGrid = {(heigth + threadsBlock.x - 1)/(blockDim-2), (width + threadsBlock.y - 1)/(blockDim-2), 1};
				int tamMemCompartilhada = threadsBlock.x*threadsBlock.y*colors*sizeof(uint8_t);
				applyMaskWithSharedMemory<<<blocksGrid, threadsBlock, tamMemCompartilhada>>>(original, result, width, heigth, colors);
			} else {
				dim3 threadsBlock = {blockDim, blockDim, colors};
				dim3 blocksGrid = {(heigth + threadsBlock.x - 3)/threadsBlock.x, (width + threadsBlock.y - 3)/threadsBlock.y, 1};
				applyMask<<<blocksGrid, threadsBlock>>>(original, result, width, heigth, colors);
			}
			CUDA_SAFE_CALL(hipGetLastError());
			CUDA_SAFE_CALL(hipEventRecord(stop));
			CUDA_SAFE_CALL(hipEventSynchronize(stop));
			CUDA_SAFE_CALL(hipEventElapsedTime(&delta_eventos, start, stop));

		// GET RESULT FROM DEVICE (GPU → CPU)
			GET_TIME(begin);
			CUDA_SAFE_CALL(hipMemcpy(image, result, imageBytes, hipMemcpyDeviceToHost))
			GET_TIME(end);
			finalParTime = end-begin; // calcula o tempo das finalizacoes paralelo em segundos

		// FREE MEMORY
			CUDA_SAFE_CALL(hipFree(original));
			CUDA_SAFE_CALL(hipFree(result));

			printResultsPar(width, heigth, colors, blockDim, delta_eventos, initialParTime, finalParTime);
}

void applyMaskSeq(uint8_t **imagePointer, unsigned int width, unsigned int heigth, unsigned int colors){
	double begin, end;
	uint8_t *image = imagePointer[0], *ret;
	long int imageBytes = width*heigth*colors*sizeof(uint8_t);
	ret = (uint8_t *) malloc(imageBytes);
	if ( ret == NULL   ) {
		cerr << "Memoria  insuficiente" << endl;
		exit(EXIT_FAILURE);
	}
	double tempoSeq;
	GET_TIME(begin);
	for (int i = 1; i < heigth -1; ++i) {
		for (int j = 1; j < width -1; ++j) {
			for (int c = 0; c < colors; ++c) {
				int gx = image[c+colors*((i-1)*width + j-1)] + 2*image[c+colors*((i-1)*width+j)] + image[c+colors*((i-1)*width+j+1)] - image[c+colors*((i+1)*width+j-1)] - 2*image[c+colors*((i+1)*width+j)] - image[c+colors*((i+1)*width+j+1)];
				int gy = image[c+colors*((i-1)*width+j-1)] + 2*image[c+colors*(i*width+j-1)] + image[c+colors*((i+1)*width+j-1)] - image[c+colors*((i-1)*width+j+1)] - 2*image[c+colors*(i*width+j+1)] - image[c+colors*((i+1)*width+j+1)];
				double g = sqrt(gx*gx + gy*gy)/4;
				ret[c+colors*(i*width+j)] = (uint8_t) g;
			}
		}
	}
	GET_TIME(end);
	tempoSeq = end-begin;
	printResultsSeq(width, heigth, colors, tempoSeq);
	imagePointer[0] = ret;
	free(image);
}

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

	// INPUT
		unsigned int width, heigth, colors, blockDim;
		long int imageBytes; //qtde bytes por matriz
		uint8_t *image; //matrizes host
		char *inputFileName, *outputFileName;

	// GET INPUT
		if(argc < 6) {
			cerr << "Digite: "<< argv[0] <<" <largura da imagem> <altura da imagem> <cores na imagem (1 para escala de cinza ou 3 para rgb)> <arquivo de entrada> <arquivo de saída> [nº de linhas e colunas dos blocos]" << endl;
			exit(EXIT_FAILURE);
		}
		//dimensao das matrizes e tamanho dos blocos
		width = atol(argv[1]);
		heigth = atol(argv[2]);
		colors = atol(argv[3]);
		inputFileName = argv[4];
		outputFileName = argv[5];

	// LOAD IMAGE
		imageBytes = width*heigth*colors*sizeof(uint8_t);
		image = (uint8_t *) malloc(imageBytes);
		if ( image == NULL   ) {
			cerr << "Memoria  insuficiente" << endl;
			exit(EXIT_FAILURE);
		}
		ifstream infile (inputFileName, ios::binary);
		infile.read(reinterpret_cast<char *>(image), imageBytes);
		infile.close();

	if (argc > 6){
		blockDim = atol(argv[6]);
		applyMaskPar(&image, width, heigth, colors, blockDim, argc>7);
	} else {
		applyMaskSeq(&image, width, heigth, colors);
	}
	// SAVE RESULT IN FILE
		ofstream outfile (outputFileName, ios::binary);
		outfile.write(reinterpret_cast<char *>(image), imageBytes);
		outfile.close();

	free(image);

	return 0;
}

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

                                        # End of file scope inline assembly
	.globl	_Z24__device_stub__applyMaskPhS_iii # -- Begin function _Z24__device_stub__applyMaskPhS_iii
	.type	_Z24__device_stub__applyMaskPhS_iii,@function
_Z24__device_stub__applyMaskPhS_iii:    # @_Z24__device_stub__applyMaskPhS_iii
	.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	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	8(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	4(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z9applyMaskPhS_iii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z24__device_stub__applyMaskPhS_iii, .Lfunc_end0-_Z24__device_stub__applyMaskPhS_iii
	.cfi_endproc
                                        # -- End function
	.globl	_Z40__device_stub__applyMaskWithSharedMemoryPhS_iii # -- Begin function _Z40__device_stub__applyMaskWithSharedMemoryPhS_iii
	.type	_Z40__device_stub__applyMaskWithSharedMemoryPhS_iii,@function
_Z40__device_stub__applyMaskWithSharedMemoryPhS_iii: # @_Z40__device_stub__applyMaskWithSharedMemoryPhS_iii
	.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	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	8(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	4(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z25applyMaskWithSharedMemoryPhS_iii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z40__device_stub__applyMaskWithSharedMemoryPhS_iii, .Lfunc_end1-_Z40__device_stub__applyMaskWithSharedMemoryPhS_iii
	.cfi_endproc
                                        # -- End function
	.globl	_Z15printResultsSeqjjjdb        # -- Begin function _Z15printResultsSeqjjjdb
	.type	_Z15printResultsSeqjjjdb,@function
_Z15printResultsSeqjjjdb:               # @_Z15printResultsSeqjjjdb
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %rbp, -16
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movl	%edx, %ebx
	movl	%esi, %ebp
	movl	%edi, %r14d
	testl	%ecx, %ecx
	je	.LBB2_2
# %bb.1:
	movl	%r14d, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %r14
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebp, %esi
	movq	%r14, %rdi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %r14
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebx, %esi
	movq	%r14, %rdi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %rbx
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	jmp	.LBB2_3
.LBB2_2:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$23, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%r14d, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %r14
	movl	$.L.str.2, %esi
	movl	$3, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebp, %esi
	movq	%r14, %rdi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %r14
	movl	$.L.str.3, %esi
	movl	$3, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebx, %esi
	movq	%r14, %rdi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %rbx
	movl	$.L.str.4, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%rbx), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%rax, %rbx
	movl	$.L.str.5, %esi
	movl	$19, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movl	$.L.str.6, %esi
	movl	$4, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.LBB2_3:
	movq	(%rbx), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	_ZNSo5flushEv                   # TAILCALL
.Lfunc_end2:
	.size	_Z15printResultsSeqjjjdb, .Lfunc_end2-_Z15printResultsSeqjjjdb
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z15printResultsParjjjjfddb
.LCPI3_0:
	.long	0x447a0000                      # float 1000
	.text
	.globl	_Z15printResultsParjjjjfddb
	.type	_Z15printResultsParjjjjfddb,@function
_Z15printResultsParjjjjfddb:            # @_Z15printResultsParjjjjfddb
	.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	%rbx
	.cfi_def_cfa_offset 40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movsd	%xmm2, 16(%rsp)                 # 8-byte Spill
	movsd	%xmm1, 8(%rsp)                  # 8-byte Spill
	movss	%xmm0, (%rsp)                   # 4-byte Spill
	movl	%ecx, %ebx
	movl	%edx, %ebp
	movl	%esi, %r14d
	movl	%edi, %r15d
	testl	%r8d, %r8d
	je	.LBB3_2
# %bb.1:
	movl	%r15d, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %r15
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%r14d, %esi
	movq	%r15, %rdi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %r14
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebp, %esi
	movq	%r14, %rdi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %r14
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebx, %esi
	movq	%r14, %rdi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %rbx
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movss	(%rsp), %xmm0                   # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	divss	.LCPI3_0(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movq	%rbx, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	jmp	.LBB3_3
.LBB3_2:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$23, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%r15d, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %r15
	movl	$.L.str.2, %esi
	movl	$3, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%r14d, %esi
	movq	%r15, %rdi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %r14
	movl	$.L.str.3, %esi
	movl	$3, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebp, %esi
	movq	%r14, %rdi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %r14
	movl	$.L.str.4, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%r14), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%rax, %r14
	movl	$.L.str.7, %esi
	movl	$24, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebx, %ebx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %r14
	movl	$.L.str.2, %esi
	movl	$3, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_ZNSo9_M_insertImEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%rax, %rbx
	movl	$.L.str.8, %esi
	movl	$24, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movss	(%rsp), %xmm0                   # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	divss	.LCPI3_0(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movsd	%xmm0, (%rsp)                   # 8-byte Spill
	movq	%rbx, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movl	$.L.str.6, %esi
	movl	$4, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%rbx), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%rax, %rbx
	movl	$.L.str.9, %esi
	movl	$23, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movl	$.L.str.6, %esi
	movl	$4, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%rbx), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%rax, %rbx
	movl	$.L.str.10, %esi
	movl	$24, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movl	$.L.str.6, %esi
	movl	$4, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%rbx), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%rax, %rbx
	movl	$.L.str.11, %esi
	movl	$24, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movsd	(%rsp), %xmm0                   # 8-byte Reload
                                        # xmm0 = mem[0],zero
	addsd	8(%rsp), %xmm0                  # 8-byte Folded Reload
	addsd	16(%rsp), %xmm0                 # 8-byte Folded Reload
	movq	%rbx, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movl	$.L.str.6, %esi
	movl	$4, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.LBB3_3:
	movq	(%rbx), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	addq	$24, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	_ZNSo5flushEv                   # TAILCALL
.Lfunc_end3:
	.size	_Z15printResultsParjjjjfddb, .Lfunc_end3-_Z15printResultsParjjjjfddb
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z12applyMaskParPPhjjjjb
.LCPI4_0:
	.quad	0x41cdcd6500000000              # double 1.0E+9
	.text
	.globl	_Z12applyMaskParPPhjjjjb
	.type	_Z12applyMaskParPPhjjjjb,@function
_Z12applyMaskParPPhjjjjb:               # @_Z12applyMaskParPPhjjjjb
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%r9d, %r13d
	movl	%r8d, %ebx
	movl	%ecx, %ebp
	movl	%edx, %r15d
                                        # kill: def $esi killed $esi def $rsi
	movl	%edx, %r12d
	movq	%rsi, 8(%rsp)                   # 8-byte Spill
	imull	%esi, %r12d
	imull	%ecx, %r12d
	movq	(%rdi), %rax
	movq	%rax, 56(%rsp)                  # 8-byte Spill
	movl	$0, 20(%rsp)
	leaq	104(%rsp), %r14
	movl	$4, %edi
	movq	%r14, %rsi
	callq	clock_gettime
	movq	(%r14), %rax
	movq	%rax, 96(%rsp)                  # 8-byte Spill
	movq	8(%r14), %r14
	leaq	32(%rsp), %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB4_20
# %bb.1:
	leaq	24(%rsp), %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB4_21
# %bb.2:
	movq	%r14, 88(%rsp)                  # 8-byte Spill
	movq	32(%rsp), %rdi
	movq	56(%rsp), %rsi                  # 8-byte Reload
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB4_22
# %bb.3:
	leaq	104(%rsp), %r14
	movl	$4, %edi
	movq	%r14, %rsi
	callq	clock_gettime
	movq	(%r14), %rax
	movq	%rax, 80(%rsp)                  # 8-byte Spill
	movq	8(%r14), %r14
	leaq	64(%rsp), %rdi
	callq	hipEventCreate
	testl	%eax, %eax
	jne	.LBB4_23
# %bb.4:
	leaq	40(%rsp), %rdi
	callq	hipEventCreate
	testl	%eax, %eax
	jne	.LBB4_24
# %bb.5:
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	testl	%eax, %eax
	jne	.LBB4_25
# %bb.6:
	testb	%r13b, %r13b
	je	.LBB4_10
# %bb.7:
	cmpl	$2, %ebx
	jbe	.LBB4_35
# %bb.8:
	movl	%ebx, %eax
	movq	%rax, %rcx
	shlq	$32, %rcx
	orq	%rax, %rcx
	leal	(%rbx,%r15), %eax
	decl	%eax
	leal	-2(%rbx), %esi
	xorl	%edx, %edx
	divl	%esi
	movl	%eax, %edi
	movq	8(%rsp), %rax                   # 8-byte Reload
	addl	%ebx, %eax
	decl	%eax
	xorl	%edx, %edx
	divl	%esi
                                        # kill: def $eax killed $eax def $rax
	shlq	$32, %rax
	orq	%rax, %rdi
	movl	%ebx, %eax
	imull	%ebp, %eax
	imull	%ebx, %eax
	movslq	%eax, %r8
	movl	$1, %esi
	movq	%rcx, %rdx
	movl	%ebp, %ecx
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_12
# %bb.9:
	movq	32(%rsp), %rdi
	movq	24(%rsp), %rsi
	movq	8(%rsp), %rdx                   # 8-byte Reload
                                        # kill: def $edx killed $edx killed $rdx
	movl	%r15d, %ecx
	movl	%ebp, %r8d
	callq	_Z40__device_stub__applyMaskWithSharedMemoryPhS_iii
	jmp	.LBB4_12
.LBB4_10:
	movl	%ebx, %eax
	movq	%rax, %rcx
	shlq	$32, %rcx
	orq	%rax, %rcx
	leal	(%rbx,%r15), %eax
	addl	$-3, %eax
	xorl	%edx, %edx
	divl	%ebx
	movl	%eax, %edi
	movq	8(%rsp), %rax                   # 8-byte Reload
	addl	%ebx, %eax
	addl	$-3, %eax
	xorl	%edx, %edx
	divl	%ebx
                                        # kill: def $eax killed $eax def $rax
	shlq	$32, %rax
	orq	%rax, %rdi
	movl	$1, %esi
	movq	%rcx, %rdx
	movl	%ebp, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_12
# %bb.11:
	movq	32(%rsp), %rdi
	movq	24(%rsp), %rsi
	movq	8(%rsp), %rdx                   # 8-byte Reload
                                        # kill: def $edx killed $edx killed $rdx
	movl	%r15d, %ecx
	movl	%ebp, %r8d
	callq	_Z24__device_stub__applyMaskPhS_iii
.LBB4_12:
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB4_26
# %bb.13:
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	testl	%eax, %eax
	jne	.LBB4_27
# %bb.14:
	movl	%ebp, 52(%rsp)                  # 4-byte Spill
	movq	40(%rsp), %rdi
	callq	hipEventSynchronize
	testl	%eax, %eax
	jne	.LBB4_28
# %bb.15:
	movq	%r14, %rbp
	movq	%r15, 72(%rsp)                  # 8-byte Spill
	movq	64(%rsp), %rsi
	movq	40(%rsp), %rdx
	leaq	20(%rsp), %rdi
	callq	hipEventElapsedTime
	testl	%eax, %eax
	jne	.LBB4_29
# %bb.16:
	leaq	104(%rsp), %r14
	movl	$4, %edi
	movq	%r14, %rsi
	callq	clock_gettime
	movq	(%r14), %r13
	movq	8(%r14), %r15
	movq	24(%rsp), %rsi
	movq	56(%rsp), %rdi                  # 8-byte Reload
	movq	%r12, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB4_30
# %bb.17:
	leaq	104(%rsp), %r14
	movl	$4, %edi
	movq	%r14, %rsi
	callq	clock_gettime
	movq	(%r14), %r12
	movq	8(%r14), %r14
	movq	32(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB4_31
# %bb.18:
	movq	24(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB4_32
# %bb.19:
	cvtsi2sd	%r14, %xmm0
	movsd	.LCPI4_0(%rip), %xmm3           # xmm3 = mem[0],zero
	divsd	%xmm3, %xmm0
	cvtsi2sd	%r12, %xmm2
	cvtsi2sd	%r15, %xmm1
	addsd	%xmm0, %xmm2
	divsd	%xmm3, %xmm1
	xorps	%xmm0, %xmm0
	cvtsi2sd	%r13, %xmm0
	addsd	%xmm1, %xmm0
	subsd	%xmm0, %xmm2
	xorps	%xmm0, %xmm0
	cvtsi2sd	%rbp, %xmm0
	divsd	%xmm3, %xmm0
	xorps	%xmm1, %xmm1
	cvtsi2sdq	80(%rsp), %xmm1         # 8-byte Folded Reload
	addsd	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	cvtsi2sdq	88(%rsp), %xmm0         # 8-byte Folded Reload
	cvtsi2sdq	96(%rsp), %xmm4         # 8-byte Folded Reload
	divsd	%xmm3, %xmm0
	addsd	%xmm0, %xmm4
	subsd	%xmm4, %xmm1
	movss	20(%rsp), %xmm0                 # xmm0 = mem[0],zero,zero,zero
	movq	8(%rsp), %rdi                   # 8-byte Reload
                                        # kill: def $edi killed $edi killed $rdi
	movq	72(%rsp), %rsi                  # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	movl	52(%rsp), %edx                  # 4-byte Reload
	movl	%ebx, %ecx
	movl	$1, %r8d
	callq	_Z15printResultsParjjjjfddb
	addq	$120, %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
.LBB4_20:
	.cfi_def_cfa_offset 176
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.12, %esi
	movl	$.L.str.13, %edx
	movq	%rbx, %rdi
	movl	$109, %ecx
	jmp	.LBB4_33
.LBB4_21:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.12, %esi
	movl	$.L.str.13, %edx
	movq	%rbx, %rdi
	movl	$110, %ecx
	jmp	.LBB4_33
.LBB4_22:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.12, %esi
	movl	$.L.str.13, %edx
	movq	%rbx, %rdi
	movl	$113, %ecx
	jmp	.LBB4_33
.LBB4_23:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.12, %esi
	movl	$.L.str.13, %edx
	movq	%rbx, %rdi
	movl	$120, %ecx
	jmp	.LBB4_33
.LBB4_24:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.12, %esi
	movl	$.L.str.13, %edx
	movq	%rbx, %rdi
	movl	$121, %ecx
	jmp	.LBB4_33
.LBB4_25:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.12, %esi
	movl	$.L.str.13, %edx
	movq	%rbx, %rdi
	movl	$122, %ecx
	jmp	.LBB4_33
.LBB4_26:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.12, %esi
	movl	$.L.str.13, %edx
	movq	%rbx, %rdi
	movl	$137, %ecx
	jmp	.LBB4_33
.LBB4_27:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.12, %esi
	movl	$.L.str.13, %edx
	movq	%rbx, %rdi
	movl	$138, %ecx
	jmp	.LBB4_33
.LBB4_28:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.12, %esi
	movl	$.L.str.13, %edx
	movq	%rbx, %rdi
	movl	$139, %ecx
	jmp	.LBB4_33
.LBB4_29:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.12, %esi
	movl	$.L.str.13, %edx
	movq	%rbx, %rdi
	movl	$140, %ecx
	jmp	.LBB4_33
.LBB4_30:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.12, %esi
	movl	$.L.str.13, %edx
	movq	%rbx, %rdi
	movl	$144, %ecx
	jmp	.LBB4_33
.LBB4_31:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.12, %esi
	movl	$.L.str.13, %edx
	movq	%rbx, %rdi
	movl	$149, %ecx
	jmp	.LBB4_33
.LBB4_32:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.12, %esi
	movl	$.L.str.13, %edx
	movq	%rbx, %rdi
	movl	$150, %ecx
.LBB4_33:
	movq	%rax, %r8
	xorl	%eax, %eax
	callq	fprintf
.LBB4_34:
	movl	$1, %edi
	callq	exit
.LBB4_35:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.14, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	jmp	.LBB4_34
.Lfunc_end4:
	.size	_Z12applyMaskParPPhjjjjb, .Lfunc_end4-_Z12applyMaskParPPhjjjjb
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z12applyMaskSeqPPhjjj
.LCPI5_0:
	.quad	0x3fd0000000000000              # double 0.25
.LCPI5_1:
	.quad	0x41cdcd6500000000              # double 1.0E+9
	.text
	.globl	_Z12applyMaskSeqPPhjjj
	.type	_Z12applyMaskSeqPPhjjj,@function
_Z12applyMaskSeqPPhjjj:                 # @_Z12applyMaskSeqPPhjjj
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edx, %r15d
                                        # kill: def $esi killed $esi def $rsi
	movq	%rdi, 88(%rsp)                  # 8-byte Spill
	movq	(%rdi), %rbx
	movl	%edx, %edi
	movq	%rsi, 16(%rsp)                  # 8-byte Spill
	imull	%esi, %edi
	movl	%ecx, (%rsp)                    # 4-byte Spill
	imull	%ecx, %edi
	callq	malloc
	movq	%rax, 40(%rsp)                  # 8-byte Spill
	testq	%rax, %rax
	je	.LBB5_16
# %bb.1:
	leaq	120(%rsp), %r14
	movl	$4, %edi
	movq	%r14, %rsi
	callq	clock_gettime
	movq	(%r14), %rax
	movq	%rax, 80(%rsp)                  # 8-byte Spill
	movq	8(%r14), %rax
	movq	%rax, 72(%rsp)                  # 8-byte Spill
	leal	-1(%r15), %edx
	cmpl	$2, %edx
	jb	.LBB5_6
# %bb.2:                                # %.preheader121.lr.ph
	movq	16(%rsp), %rcx                  # 8-byte Reload
	leal	-1(%rcx), %eax
	movl	%eax, 4(%rsp)                   # 4-byte Spill
	movl	(%rsp), %eax                    # 4-byte Reload
	movl	%eax, %r10d
	imull	%ecx, %eax
	movl	%eax, 24(%rsp)                  # 4-byte Spill
	movl	$1, %r11d
	xorpd	%xmm1, %xmm1
	movsd	.LCPI5_0(%rip), %xmm2           # xmm2 = mem[0],zero
	movq	%r15, 96(%rsp)                  # 8-byte Spill
	movl	%edx, 28(%rsp)                  # 4-byte Spill
	movq	%rbx, 104(%rsp)                 # 8-byte Spill
.LBB5_3:                                # %.preheader121
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_8 Depth 2
                                        #       Child Loop BB5_10 Depth 3
	cmpl	$1, 4(%rsp)                     # 4-byte Folded Reload
	jbe	.LBB5_4
# %bb.7:                                # %.preheader.lr.ph
                                        #   in Loop: Header=BB5_3 Depth=1
	leal	-1(%r11), %r14d
	movl	%r14d, %r15d
	movq	16(%rsp), %rax                  # 8-byte Reload
	imull	%eax, %r15d
	leal	1(%r11), %edx
	movl	%edx, %r13d
	imull	%eax, %r13d
	movl	24(%rsp), %ecx                  # 4-byte Reload
	movl	%ecx, %ebp
	imull	%r11d, %ebp
	imull	%eax, %r11d
	leal	1(%r11), %esi
	movl	(%rsp), %eax                    # 4-byte Reload
	imull	%eax, %esi
	movq	%rsi, 8(%rsp)                   # 8-byte Spill
	addl	$2, %r11d
	imull	%eax, %r11d
	leal	2(%r13), %esi
	imull	%eax, %esi
	movq	%rsi, 64(%rsp)                  # 8-byte Spill
	incl	%r13d
	imull	%eax, %r13d
	movl	%ecx, %esi
	movl	%edx, 32(%rsp)                  # 4-byte Spill
	imull	%edx, %esi
	movq	%rsi, 56(%rsp)                  # 8-byte Spill
	leal	2(%r15), %edx
	imull	%eax, %edx
	movq	%rdx, 48(%rsp)                  # 8-byte Spill
	incl	%r15d
	imull	%eax, %r15d
	imull	%ecx, %r14d
	movl	$1, %eax
.LBB5_8:                                # %.preheader
                                        #   Parent Loop BB5_3 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB5_10 Depth 3
	movl	%eax, 36(%rsp)                  # 4-byte Spill
	cmpl	$0, (%rsp)                      # 4-byte Folded Reload
	je	.LBB5_12
# %bb.9:                                # %.lr.ph
                                        #   in Loop: Header=BB5_8 Depth=2
	xorl	%r12d, %r12d
	movq	%rbp, 112(%rsp)                 # 8-byte Spill
.LBB5_10:                               #   Parent Loop BB5_3 Depth=1
                                        #     Parent Loop BB5_8 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	leal	(%r14,%r12), %eax
	movzbl	(%rbx,%rax), %eax
	leal	(%r15,%r12), %ecx
	movzbl	(%rbx,%rcx), %esi
	movq	48(%rsp), %rcx                  # 8-byte Reload
	addl	%r12d, %ecx
	movzbl	(%rbx,%rcx), %ecx
	movq	56(%rsp), %rdx                  # 8-byte Reload
	addl	%r12d, %edx
	movzbl	(%rbx,%rdx), %edx
	leal	(%r12,%r13), %edi
	movzbl	(%rbx,%rdi), %edi
	subl	%edi, %esi
	movq	64(%rsp), %rdi                  # 8-byte Reload
	addl	%r12d, %edi
	movzbl	(%rbx,%rdi), %edi
	leal	(%rcx,%rax), %r8d
	subl	%edx, %r8d
	subl	%edi, %r8d
	leal	(%r8,%rsi,2), %esi
	leal	(%r12,%rbp), %r8d
	movzbl	(%rbx,%r8), %r8d
	leal	(%r11,%r12), %r9d
	movzbl	(%rbx,%r9), %r9d
	subl	%r9d, %r8d
	addl	%edx, %eax
	addl	%edi, %ecx
	subl	%ecx, %eax
	leal	(%rax,%r8,2), %eax
	imull	%esi, %esi
	imull	%eax, %eax
	addl	%esi, %eax
	xorps	%xmm0, %xmm0
	cvtsi2sd	%eax, %xmm0
	ucomisd	%xmm1, %xmm0
	jb	.LBB5_14
# %bb.11:                               #   in Loop: Header=BB5_10 Depth=3
	sqrtsd	%xmm0, %xmm0
	jmp	.LBB5_15
.LBB5_14:                               # %call.sqrt
                                        #   in Loop: Header=BB5_10 Depth=3
	movq	%r14, %rbp
	movq	%r10, %r14
	movq	%r13, %rbx
	movq	%r15, %r13
	movq	%r11, %r15
	callq	sqrt
	movq	%r15, %r11
	movq	%r13, %r15
	movq	%rbx, %r13
	movq	104(%rsp), %rbx                 # 8-byte Reload
	movsd	.LCPI5_0(%rip), %xmm2           # xmm2 = mem[0],zero
	xorpd	%xmm1, %xmm1
	movq	%r14, %r10
	movq	%rbp, %r14
	movq	112(%rsp), %rbp                 # 8-byte Reload
.LBB5_15:                               # %.split
                                        #   in Loop: Header=BB5_10 Depth=3
	mulsd	%xmm2, %xmm0
	cvttsd2si	%xmm0, %eax
	movq	8(%rsp), %rcx                   # 8-byte Reload
	addl	%r12d, %ecx
	movq	40(%rsp), %rdx                  # 8-byte Reload
	movb	%al, (%rdx,%rcx)
	incq	%r12
	cmpq	%r12, %r10
	jne	.LBB5_10
.LBB5_12:                               # %._crit_edge
                                        #   in Loop: Header=BB5_8 Depth=2
	movl	36(%rsp), %eax                  # 4-byte Reload
	incl	%eax
	addq	%r10, 8(%rsp)                   # 8-byte Folded Spill
	addq	%r10, %r11
	addq	%r10, %rbp
	addq	%r10, 64(%rsp)                  # 8-byte Folded Spill
	addq	%r10, %r13
	addq	%r10, 56(%rsp)                  # 8-byte Folded Spill
	addq	%r10, 48(%rsp)                  # 8-byte Folded Spill
	addq	%r10, %r15
	addq	%r10, %r14
	cmpl	4(%rsp), %eax                   # 4-byte Folded Reload
	jne	.LBB5_8
# %bb.13:                               #   in Loop: Header=BB5_3 Depth=1
	movq	96(%rsp), %r15                  # 8-byte Reload
	movl	28(%rsp), %edx                  # 4-byte Reload
	movl	32(%rsp), %eax                  # 4-byte Reload
	jmp	.LBB5_5
.LBB5_4:                                # %.preheader121.._crit_edge124_crit_edge
                                        #   in Loop: Header=BB5_3 Depth=1
	incl	%r11d
	movl	%r11d, %eax
.LBB5_5:                                # %._crit_edge124
                                        #   in Loop: Header=BB5_3 Depth=1
	movl	%eax, %r11d
	cmpl	%edx, %eax
	jne	.LBB5_3
.LBB5_6:                                # %._crit_edge126
	xorps	%xmm0, %xmm0
	cvtsi2sdq	80(%rsp), %xmm0         # 8-byte Folded Reload
	xorps	%xmm1, %xmm1
	cvtsi2sdq	72(%rsp), %xmm1         # 8-byte Folded Reload
	divsd	.LCPI5_1(%rip), %xmm1
	addsd	%xmm0, %xmm1
	movsd	%xmm1, 8(%rsp)                  # 8-byte Spill
	leaq	120(%rsp), %r14
	movl	$4, %edi
	movq	%r14, %rsi
	callq	clock_gettime
	xorps	%xmm1, %xmm1
	cvtsi2sdq	(%r14), %xmm1
	xorps	%xmm0, %xmm0
	cvtsi2sdq	8(%r14), %xmm0
	divsd	.LCPI5_1(%rip), %xmm0
	addsd	%xmm1, %xmm0
	subsd	8(%rsp), %xmm0                  # 8-byte Folded Reload
	movq	16(%rsp), %rdi                  # 8-byte Reload
                                        # kill: def $edi killed $edi killed $rdi
	movl	%r15d, %esi
	movl	(%rsp), %edx                    # 4-byte Reload
	movl	$1, %ecx
	callq	_Z15printResultsSeqjjjdb
	movq	88(%rsp), %rax                  # 8-byte Reload
	movq	40(%rsp), %rcx                  # 8-byte Reload
	movq	%rcx, (%rax)
	movq	%rbx, %rdi
	callq	free
	addq	$136, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB5_16:
	.cfi_def_cfa_offset 192
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.15, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$1, %edi
	callq	exit
.Lfunc_end5:
	.size	_Z12applyMaskSeqPPhjjj, .Lfunc_end5-_Z12applyMaskSeqPPhjjj
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$1080, %rsp                     # imm = 0x438
	.cfi_def_cfa_offset 1136
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %r12
	cmpl	$5, %edi
	jle	.LBB6_11
# %bb.1:
	movl	%edi, %ebp
	movq	8(%r12), %rdi
	callq	atol
	movq	%rax, %r14
	movq	16(%r12), %rdi
	callq	atol
	movq	%rax, %rbx
	movq	24(%r12), %rdi
	callq	atol
	movq	%rax, %rcx
	movq	32(%r12), %r15
	movq	40(%r12), %rax
	movq	%rax, 40(%rsp)                  # 8-byte Spill
	movq	%rbx, 24(%rsp)                  # 8-byte Spill
                                        # kill: def $ebx killed $ebx killed $rbx def $rbx
	movq	%r14, 32(%rsp)                  # 8-byte Spill
	imull	%r14d, %ebx
	movq	%rcx, 16(%rsp)                  # 8-byte Spill
	imull	%ecx, %ebx
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, 8(%rsp)
	testq	%rax, %rax
	je	.LBB6_12
# %bb.2:
	movq	%rax, %r13
	leaq	560(%rsp), %r14
	movq	%r14, %rdi
	movq	%r15, %rsi
	movl	$4, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
.Ltmp0:
	movq	%r14, %rdi
	movq	%r13, %rsi
	movq	%rbx, %rdx
	callq	_ZNSi4readEPcl
.Ltmp1:
# %bb.3:
.Ltmp2:
	leaq	560(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv
.Ltmp3:
# %bb.4:
	cmpl	$6, %ebp
	jne	.LBB6_6
# %bb.5:
.Ltmp6:
	leaq	8(%rsp), %rdi
	movq	32(%rsp), %rsi                  # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	movq	24(%rsp), %rdx                  # 8-byte Reload
                                        # kill: def $edx killed $edx killed $rdx
	movq	16(%rsp), %rcx                  # 8-byte Reload
                                        # kill: def $ecx killed $ecx killed $rcx
	callq	_Z12applyMaskSeqPPhjjj
.Ltmp7:
	jmp	.LBB6_7
.LBB6_6:
	movq	48(%r12), %rdi
	callq	atol
	xorl	%r9d, %r9d
	cmpl	$8, %ebp
	setae	%r9b
.Ltmp4:
	leaq	8(%rsp), %rdi
	movq	32(%rsp), %rsi                  # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	movq	24(%rsp), %rdx                  # 8-byte Reload
                                        # kill: def $edx killed $edx killed $rdx
	movq	16(%rsp), %rcx                  # 8-byte Reload
                                        # kill: def $ecx killed $ecx killed $rcx
	movl	%eax, %r8d
	callq	_Z12applyMaskParPPhjjjjb
.Ltmp5:
.LBB6_7:
.Ltmp9:
	leaq	48(%rsp), %rdi
	movq	40(%rsp), %rsi                  # 8-byte Reload
	movl	$4, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
.Ltmp10:
# %bb.8:
	movq	8(%rsp), %r14
.Ltmp12:
	leaq	48(%rsp), %rdi
	movq	%r14, %rsi
	movq	%rbx, %rdx
	callq	_ZNSo5writeEPKcl
.Ltmp13:
# %bb.9:
.Ltmp14:
	leaq	48(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp15:
# %bb.10:
	movq	%r14, %rdi
	callq	free
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	56(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 48(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	296(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	leaq	560(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	xorl	%eax, %eax
	addq	$1080, %rsp                     # imm = 0x438
	.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
.LBB6_11:
	.cfi_def_cfa_offset 1136
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.16, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	(%r12), %rsi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.17, %esi
	movq	%rax, %rdi
	jmp	.LBB6_13
.LBB6_12:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.15, %esi
.LBB6_13:
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$1, %edi
	callq	exit
.LBB6_14:
.Ltmp11:
	jmp	.LBB6_17
.LBB6_15:
.Ltmp16:
	movq	%rax, %rbx
	leaq	48(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
	jmp	.LBB6_18
.LBB6_16:
.Ltmp8:
.LBB6_17:
	movq	%rax, %rbx
.LBB6_18:
	leaq	560(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end6:
	.size	main, .Lfunc_end6-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table6:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp5-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp5
	.uleb128 .Ltmp8-.Lfunc_begin0           #     jumps to .Ltmp8
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp9-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp10-.Ltmp9                 #   Call between .Ltmp9 and .Ltmp10
	.uleb128 .Ltmp11-.Lfunc_begin0          #     jumps to .Ltmp11
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp12-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Ltmp15-.Ltmp12                #   Call between .Ltmp12 and .Ltmp15
	.uleb128 .Ltmp16-.Lfunc_begin0          #     jumps to .Ltmp16
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp15-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Lfunc_end6-.Ltmp15            #   Call between .Ltmp15 and .Lfunc_end6
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB7_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB7_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z9applyMaskPhS_iii, %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	$_Z25applyMaskWithSharedMemoryPhS_iii, %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_end7:
	.size	__hip_module_ctor, .Lfunc_end7-__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	.LBB8_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
.LBB8_2:
	retq
.Lfunc_end8:
	.size	__hip_module_dtor, .Lfunc_end8-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z9applyMaskPhS_iii,@object     # @_Z9applyMaskPhS_iii
	.section	.rodata,"a",@progbits
	.globl	_Z9applyMaskPhS_iii
	.p2align	3, 0x0
_Z9applyMaskPhS_iii:
	.quad	_Z24__device_stub__applyMaskPhS_iii
	.size	_Z9applyMaskPhS_iii, 8

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

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

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Dimens\303\265es da imagem = "
	.size	.L.str.1, 24

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	" x "
	.size	.L.str.2, 4

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	" (x"
	.size	.L.str.3, 4

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	")"
	.size	.L.str.4, 2

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Tempo sequencial = "
	.size	.L.str.5, 20

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

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Dimens\303\265es dos blocos = "
	.size	.L.str.7, 25

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Tempo paralelo kernel = "
	.size	.L.str.8, 25

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"Tempo paralelo begin = "
	.size	.L.str.9, 24

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"Tempo paralelo end    = "
	.size	.L.str.10, 25

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"Tempo paralelo total  = "
	.size	.L.str.11, 25

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"Erro no arquivo '%s', linha %i: %s.\n"
	.size	.L.str.12, 37

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/jfportalb/GPU/master/sobel.hip"
	.size	.L.str.13, 93

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"Para executar com mem\303\263ria compartilhada \303\251 necess\303\241rio ter pelo menos um bloco de 3x3"
	.size	.L.str.14, 87

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"Memoria  insuficiente"
	.size	.L.str.15, 22

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"Digite: "
	.size	.L.str.16, 9

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	" <largura da imagem> <altura da imagem> <cores na imagem (1 para escala de cinza ou 3 para rgb)> <arquivo de entrada> <arquivo de sa\303\255da> [n\302\272 de linhas e colunas dos blocos]"
	.size	.L.str.17, 175

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

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z25applyMaskWithSharedMemoryPhS_iii"
	.size	.L__unnamed_2, 37

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

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

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z24__device_stub__applyMaskPhS_iii
	.addrsig_sym _Z40__device_stub__applyMaskWithSharedMemoryPhS_iii
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z9applyMaskPhS_iii
	.addrsig_sym _Z25applyMaskWithSharedMemoryPhS_iii
	.addrsig_sym _ZSt4cout
	.addrsig_sym _ZSt4cerr
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z9applyMaskPhS_iii     ; -- Begin function _Z9applyMaskPhS_iii
	.globl	_Z9applyMaskPhS_iii
	.p2align	8
	.type	_Z9applyMaskPhS_iii,@function
_Z9applyMaskPhS_iii:                    ; @_Z9applyMaskPhS_iii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b128 s[4:7], s[0:1], 0x10
	v_and_b32_e32 v1, 0x3ff, v0
	v_bfe_u32 v5, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s3, s2, 16
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[3:4], null, s14, s2, v[1:2]
	v_mad_u64_u32 v[1:2], null, s15, s3, v[5:6]
	v_add_nc_u32_e32 v4, 1, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v2, 1, v1
	v_cmp_gt_i32_e32 vcc_lo, s5, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_gt_i32_e64 s2, s4, v2
	s_and_b32 s2, vcc_lo, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB0_2
; %bb.1:
	v_mul_lo_u32 v3, v3, s4
	s_load_b128 s[0:3], s[0:1], 0x0
	v_bfe_u32 v0, v0, 20, 10
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_add_nc_u32_e32 v5, v3, v1
	v_add_nc_u32_e32 v6, v2, v3
	v_lshl_add_u32 v11, s4, 1, v3
	v_mad_u64_u32 v[3:4], null, v5, s6, v[0:1]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mad_u64_u32 v[4:5], null, v6, s6, v[0:1]
	v_add_nc_u32_e32 v7, v11, v1
	v_add_nc_u32_e32 v8, v11, v2
	v_subrev_nc_u32_e32 v15, s4, v11
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mad_u64_u32 v[5:6], null, v7, s6, v[0:1]
	v_mad_u64_u32 v[6:7], null, v8, s6, v[0:1]
	v_ashrrev_i32_e32 v8, 31, v3
	v_add_nc_u32_e32 v10, s6, v4
	v_ashrrev_i32_e32 v9, 31, v4
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v7, vcc_lo, s0, v3
	v_add_co_ci_u32_e32 v8, vcc_lo, s1, v8, vcc_lo
	v_ashrrev_i32_e32 v12, 31, v10
	v_add_co_u32 v3, vcc_lo, s0, v4
	v_add_co_ci_u32_e32 v4, vcc_lo, s1, v9, vcc_lo
	v_add_co_u32 v9, vcc_lo, s0, v10
	s_delay_alu instid0(VALU_DEP_4)
	v_add_co_ci_u32_e32 v10, vcc_lo, s1, v12, vcc_lo
	v_ashrrev_i32_e32 v12, 31, v5
	v_add_co_u32 v11, vcc_lo, s0, v5
	v_ashrrev_i32_e32 v13, 31, v6
	v_add_nc_u32_e32 v16, s6, v6
	v_add_nc_u32_e32 v2, v15, v2
	v_add_co_ci_u32_e32 v12, vcc_lo, s1, v12, vcc_lo
	v_add_co_u32 v5, vcc_lo, s0, v6
	v_add_co_ci_u32_e32 v6, vcc_lo, s1, v13, vcc_lo
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[13:14], null, v2, s6, v[0:1]
	v_add_nc_u32_e32 v18, v15, v1
	v_add_co_u32 v1, vcc_lo, s0, v16
	v_ashrrev_i32_e32 v17, 31, v16
	v_mad_u64_u32 v[14:15], null, v18, s6, v[0:1]
	v_add_nc_u32_e32 v15, s6, v13
	s_delay_alu instid0(VALU_DEP_3)
	v_add_co_ci_u32_e32 v2, vcc_lo, s1, v17, vcc_lo
	s_clause 0x5
	global_load_u8 v7, v[7:8], off
	global_load_u8 v4, v[3:4], off
	global_load_u8 v8, v[9:10], off
	global_load_u8 v9, v[11:12], off
	global_load_u8 v5, v[5:6], off
	global_load_u8 v6, v[1:2], off
	v_ashrrev_i32_e32 v3, 31, v15
	v_ashrrev_i32_e32 v1, 31, v14
	v_add_co_u32 v0, vcc_lo, s0, v14
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	v_add_co_u32 v2, vcc_lo, s0, v15
	v_add_co_ci_u32_e32 v3, vcc_lo, s1, v3, vcc_lo
	s_clause 0x1
	global_load_u8 v0, v[0:1], off
	global_load_u8 v1, v[2:3], off
	s_waitcnt vmcnt(5)
	v_add_nc_u32_e32 v2, v8, v7
	s_waitcnt vmcnt(3)
	v_sub_nc_u32_e32 v4, v4, v5
	s_waitcnt vmcnt(2)
	v_add_nc_u32_e32 v3, v9, v6
	v_add_nc_u32_e32 v5, v7, v9
	v_add_nc_u32_e32 v6, v8, v6
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v2, v2, v3
	v_lshl_add_u32 v2, v4, 1, v2
	s_waitcnt vmcnt(0)
	v_sub_nc_u32_e32 v0, v0, v1
	v_sub_nc_u32_e32 v1, v5, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshl_add_u32 v0, v0, 1, v1
	v_mul_i32_i24_e32 v1, v2, v2
	v_mad_i32_i24 v0, v0, v0, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_f32_i32_e32 v0, v0
	v_mul_f32_e32 v1, 0x4f800000, v0
	v_cmp_gt_f32_e32 vcc_lo, 0xf800000, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v0, v0, v1, vcc_lo
	v_sqrt_f32_e32 v1, v0
	s_waitcnt_depctr 0xfff
	v_add_nc_u32_e32 v2, -1, v1
	v_add_nc_u32_e32 v3, 1, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v4, -v2, v1, v0
	v_fma_f32 v5, -v3, v1, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_ge_f32_e64 s0, 0, v4
	v_cndmask_b32_e64 v1, v1, v2, s0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_lt_f32_e64 s0, 0, v5
	v_cndmask_b32_e64 v1, v1, v3, s0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v2, 0x37800000, v1
	v_cndmask_b32_e32 v1, v1, v2, vcc_lo
	v_cmp_class_f32_e64 vcc_lo, v0, 0x260
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v0, v1, v0, vcc_lo
	v_ashrrev_i32_e32 v1, 31, v13
	v_mul_f32_e32 v0, 0x3e800000, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_cvt_i32_f32_e32 v2, v0
	v_add_co_u32 v0, vcc_lo, s2, v13
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	global_store_b8 v[0:1], v2, off
.LBB0_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9applyMaskPhS_iii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 14
		.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 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 2
		.amdhsa_next_free_vgpr 19
		.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	_Z9applyMaskPhS_iii, .Lfunc_end0-_Z9applyMaskPhS_iii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 748
; NumSgprs: 18
; NumVgprs: 19
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 19
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 2
	.text
	.protected	_Z25applyMaskWithSharedMemoryPhS_iii ; -- Begin function _Z25applyMaskWithSharedMemoryPhS_iii
	.globl	_Z25applyMaskWithSharedMemoryPhS_iii
	.p2align	8
	.type	_Z25applyMaskWithSharedMemoryPhS_iii,@function
_Z25applyMaskWithSharedMemoryPhS_iii:   ; @_Z25applyMaskWithSharedMemoryPhS_iii
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b128 s[4:7], s[0:1], 0x10
	v_and_b32_e32 v2, 0x3ff, v0
	v_bfe_u32 v3, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s7, s2, 0xffff
	s_lshr_b32 s8, s2, 16
	s_add_i32 s2, s7, -2
	s_add_i32 s3, s8, -2
	v_mad_u64_u32 v[4:5], null, s2, s14, v[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[6:7], null, s3, s15, v[3:4]
	v_cmp_le_i32_e32 vcc_lo, s5, v4
	v_cmp_le_i32_e64 s2, s4, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s2, vcc_lo, s2
	s_and_saveexec_b32 s3, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_xor_b32 s2, exec_lo, s3
	s_cbranch_execz .LBB1_2
; %bb.1:
	s_barrier
	buffer_gl0_inv
                                        ; implicit-def: $vgpr6_vgpr7
                                        ; implicit-def: $vgpr4_vgpr5
                                        ; implicit-def: $vgpr0
                                        ; implicit-def: $vgpr2
                                        ; implicit-def: $vgpr3
.LBB1_2:                                ; %Flow171
	s_and_not1_saveexec_b32 s2, s2
	s_cbranch_execz .LBB1_9
; %bb.3:
	s_load_b128 s[0:3], s[0:1], 0x0
	v_mad_u64_u32 v[7:8], null, v4, s4, v[6:7]
	v_bfe_u32 v6, v0, 20, 10
	v_mad_u32_u24 v5, v2, s7, v3
	v_cmp_eq_u32_e64 s4, 0, v2
	s_mov_b32 s5, exec_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[0:1], null, v7, s6, v[6:7]
	v_add_nc_u32_e32 v1, 0, v6
	v_ashrrev_i32_e32 v4, 31, v0
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v7, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v8, vcc_lo, s1, v4, vcc_lo
	global_load_u8 v8, v[7:8], off
	v_mad_u64_u32 v[6:7], null, v5, s6, v[1:2]
	s_waitcnt vmcnt(0)
	ds_store_b8 v6, v8
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	v_cmpx_ne_u32_e32 0, v2
	s_cbranch_execz .LBB1_7
; %bb.4:
	s_add_i32 s0, s7, -1
	v_cmp_ne_u32_e32 vcc_lo, 0, v3
	v_cmp_ne_u32_e64 s0, s0, v2
	s_add_i32 s8, s8, -1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_ne_u32_e64 s1, s8, v3
	s_and_b32 s8, vcc_lo, s0
	s_mov_b32 s0, -1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s8, s8, s1
	s_and_saveexec_b32 s1, s8
	s_cbranch_execz .LBB1_6
; %bb.5:
	v_mul_u32_u24_e32 v2, s7, v2
	v_add_nc_u32_e32 v5, -1, v5
	s_lshl_b32 s0, s6, 1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_subrev_nc_u32_e32 v2, s7, v2
	v_add_nc_u32_e32 v2, v2, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_lshl_add_u32 v3, s7, 1, v2
	v_add_nc_u32_e32 v6, -1, v2
	v_mul_lo_u32 v7, v2, s6
	v_add_nc_u32_e32 v8, -1, v3
	v_mul_lo_u32 v9, v3, s6
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[2:3], null, v6, s6, v[1:2]
	v_mul_lo_u32 v3, v5, s6
	v_mad_u64_u32 v[5:6], null, v8, s6, v[1:2]
	v_add_nc_u32_e32 v6, v1, v7
	v_add3_u32 v7, v7, s6, v1
	v_add_nc_u32_e32 v8, v1, v9
	v_add3_u32 v9, v9, s6, v1
	ds_load_u8 v2, v2
	ds_load_u8 v6, v6
	ds_load_u8 v7, v7
	ds_load_u8 v5, v5
	ds_load_u8 v8, v8
	ds_load_u8 v9, v9
	v_add_nc_u32_e32 v10, v1, v3
	v_add3_u32 v1, v3, s0, v1
	ds_load_u8 v3, v10
	ds_load_u8 v1, v1
	s_waitcnt lgkmcnt(5)
	v_add_nc_u32_e32 v10, v7, v2
	s_waitcnt lgkmcnt(4)
	v_add_nc_u32_e32 v2, v2, v5
	s_waitcnt lgkmcnt(3)
	v_sub_nc_u32_e32 v6, v6, v8
	s_waitcnt lgkmcnt(2)
	v_add_nc_u32_e32 v11, v5, v9
	v_add_nc_u32_e32 v5, v7, v9
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_sub_nc_u32_e32 v7, v10, v11
	s_waitcnt lgkmcnt(0)
	v_sub_nc_u32_e32 v1, v3, v1
	v_sub_nc_u32_e32 v2, v2, v5
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshl_add_u32 v3, v6, 1, v7
	v_lshl_add_u32 v1, v1, 1, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_i32_i24_e32 v2, v3, v3
	v_mad_i32_i24 v1, v1, v1, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_f32_i32_e32 v1, v1
	v_mul_f32_e32 v2, 0x4f800000, v1
	v_cmp_gt_f32_e32 vcc_lo, 0xf800000, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v1, v1, v2, vcc_lo
	v_sqrt_f32_e32 v2, v1
	s_waitcnt_depctr 0xfff
	v_add_nc_u32_e32 v3, -1, v2
	v_add_nc_u32_e32 v5, 1, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v6, -v3, v2, v1
	v_fma_f32 v7, -v5, v2, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_ge_f32_e64 s0, 0, v6
	v_cndmask_b32_e64 v2, v2, v3, s0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_lt_f32_e64 s0, 0, v7
	v_cndmask_b32_e64 v2, v2, v5, s0
	s_xor_b32 s0, exec_lo, -1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v3, 0x37800000, v2
	v_cndmask_b32_e32 v2, v2, v3, vcc_lo
	v_cmp_class_f32_e64 vcc_lo, v1, 0x260
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v1, v2, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s2, v0
	v_mul_f32_e32 v1, 0x3e800000, v1
	s_delay_alu instid0(VALU_DEP_1)
	v_cvt_i32_f32_e32 v2, v1
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v4, vcc_lo
	global_store_b8 v[0:1], v2, off
.LBB1_6:                                ; %Flow169
	s_or_b32 exec_lo, exec_lo, s1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	s_and_not1_b32 s1, s4, exec_lo
	s_and_b32 s0, s0, exec_lo
	s_or_b32 s4, s1, s0
.LBB1_7:                                ; %Flow
	s_or_b32 exec_lo, exec_lo, s5
	s_and_saveexec_b32 s0, s4
	s_cbranch_execz .LBB1_9
; %bb.8:
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
.LBB1_9:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z25applyMaskWithSharedMemoryPhS_iii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 14
		.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 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 2
		.amdhsa_next_free_vgpr 12
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z25applyMaskWithSharedMemoryPhS_iii, .Lfunc_end1-_Z25applyMaskWithSharedMemoryPhS_iii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 852
; NumSgprs: 18
; NumVgprs: 12
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 12
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 2
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         20
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z9applyMaskPhS_iii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z9applyMaskPhS_iii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     19
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         20
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
      - .offset:         152
        .size:           4
        .value_kind:     hidden_dynamic_lds_size
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z25applyMaskWithSharedMemoryPhS_iii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z25applyMaskWithSharedMemoryPhS_iii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     12
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
