/**
 * Copyright 1993-2012 NVIDIA Corporation.  All rights reserved.
 *
 * Please refer to the NVIDIA end user license agreement (EULA) associated
 * with this source code for terms and conditions that govern your use of
 * this software. Any use, reproduction, disclosure, or distribution of
 * this software and related documentation outside the terms of the EULA
 * is strictly prohibited.
 */

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

/**
 * This macro checks return value of the CUDA runtime call and exits
 * the application if the call failed.
 */
#define CUDA_CHECK_RETURN(value) {											\
	cudaError_t _m_cudaStat = value;										\
	if (_m_cudaStat != cudaSuccess) {										\
		fprintf(stderr, "Error %s at line %d in file %s\n",					\
				cudaGetErrorString(_m_cudaStat), __LINE__, __FILE__);		\
		exit(1);															\
	} }

void alloc_on_device(float *, float*, void **, void **, int);
void free_on_device(void *, void*);
void copy_from_device(void *, float*, int);
void fprint_mat(FILE *, float *, int);
void a_x_mais_y_host(int, float *, float*, int);
float* init(int);

__global__ void a_x_mais_y_device(int, float* , float*, int);
__global__ void a_x_mais_y_device_coalesce(int, float*, float*, int);

const int SEQUENTIAL = 1;
const int CUDA = 2;
const int CUDA_COALESCE = 4;

/**
 * Host function that prepares data array and passes it to the CUDA kernel.
 */
int main(int argc, char ** argv) {

	if(argc < 4) {
		printf("Uso: %s <algoritmo> <tamanho_vetor> <tamanho_bloco> <a opcional> <debug opcional>\n\
algoritmo:\n\ts (Sequencial)\n\tc (Cuda nao coalescente)\n\tcc (Cuda coalescente)\n", argv[0]);
		return -1;
	}

	const char * mode = (argc > 1 ? argv[1] : "");
	const int vector_size = (argc > 2 ? atoi(argv[2]) : 0);
	const int block_size = (argc > 3 ? atoi(argv[3]) : 0);
	const int debug = argc > 4 ? strcmp(argv[4], "debug") == 0 : 0;

	srand(time(NULL));

	int state = -1;
	float *x = init(vector_size);
	float *y = init(vector_size);
	float *x_device, *y_device;
	int n_blocks = (vector_size + (block_size - 1)) / block_size;
	int shared_memory = block_size * 2 * sizeof(float);
	float a = 0.0f;

	FILE *f_a;
	FILE *f_x;
	FILE *f_y;
	FILE *f_axy;

	if(argc > 4) {
		a = atof(argv[4]);
	} else {
		a = (float) (rand() % vector_size);
	}

	if(strncmp(mode, "s", 1) == 0) {
		state = SEQUENTIAL;
		if(debug) {
			f_a = fopen("y_s.txt", "w");
			f_x = fopen("x_s.txt", "w");
			f_y = fopen("y_s.txt", "w");
			f_axy = fopen("axy_s.txt", "w");
		}
	} else if(strlen(mode) == 1 && strncmp(mode, "c", 1) == 0) {
		state = CUDA;
		if(debug) {
			f_a = fopen("y_c.txt", "w");
			f_x = fopen("x_c.txt", "w");
			f_y = fopen("y_c.txt", "w");
			f_axy = fopen("axy_c.txt", "w");
		}
	} else if(strncmp(mode, "cc", 2) == 0) {
		state = CUDA_COALESCE;
		if(debug) {
			f_a = fopen("y_c.txt", "w");
			f_x = fopen("x_cc.txt", "w");
			f_y = fopen("y_cc.txt", "w");
			f_axy = fopen("axy_cc.txt", "w");
		}
	}

	if(debug) {
		fprintf(f_a, "%f", a);
		fprint_mat(f_x, x, vector_size);
		fprint_mat(f_y, y, vector_size);
	}

	if(state == SEQUENTIAL) {
		a_x_mais_y_host(a, x, y, vector_size);
	} else {
		alloc_on_device(x, y, (void**)&x_device, (void**) &y_device, vector_size);

		if(state == CUDA) {
			a_x_mais_y_device<<<n_blocks, block_size>>>(a, x_device, y_device, vector_size);
		} else if(state == CUDA_COALESCE) {
			a_x_mais_y_device_coalesce<<<n_blocks, block_size, shared_memory>>>(a, x_device, y_device, vector_size);
		}

		copy_from_device(y_device, y, vector_size);
	}

	if(debug) {
		fprint_mat(f_axy, y, vector_size);
		fclose(f_x);
		fclose(f_y);
		fclose(f_axy);
		fclose(f_a);
	}

	free(x);
	free(y);

	return 0;
}

void fprint_mat(FILE *f, float *v, int n) {
	for(int i = 0; i < n-1; i++) {
		fprintf(f, "%f ", v[i]);
	}

	fprintf(f, "%f", v[n-1]);
}

void alloc_on_device(float *x, float *y, void **x_ptr, void **y_ptr, int n) {
	size_t size = sizeof(float) * n;
	CUDA_CHECK_RETURN(cudaMalloc(x_ptr, size));
	CUDA_CHECK_RETURN(cudaMalloc(y_ptr, size));
	CUDA_CHECK_RETURN(cudaMemcpy(*x_ptr, x, size, cudaMemcpyHostToDevice));
	CUDA_CHECK_RETURN(cudaMemcpy(*y_ptr, y, size, cudaMemcpyHostToDevice));
}

void copy_from_device(void *v_ptr, float *v, int n) {
	cudaMemcpy(v, v_ptr, sizeof(float) * n, cudaMemcpyDeviceToHost);
}

void free_on_device(void *x_ptr, void *y_ptr) {
	cudaFree(x_ptr);
	cudaFree(y_ptr);
}

void a_x_mais_y_host(int a, float *x, float* y, int n) {
	for(int i = 0; i < n; ++i) {
		y[i] = (a * x[i]) + y[i];
	}
}

float* init(int n) {
	float *v = (float*) malloc(sizeof(float) * n);

	for(int i = 0; i < n; ++i) {
		v[i] = (float) i;
	}

	return v;
}

////////////////////////////////////////////////////////////////////////////////

__global__ void a_x_mais_y_device(int a, float* x, float* y, int n) {
	int i = blockDim.x * blockIdx.x + threadIdx.x;

	if(i < n) {
		y[i] = a * x[i] + y[i];
	}
}

__global__ void a_x_mais_y_device_coalesce(int a, float* x, float* y, int n) {
	int i = blockDim.x * blockIdx.x + threadIdx.x;
	int ti = threadIdx.x;

	extern __shared__ float sharedX[];
	float *sharedY = &sharedX[0] + blockDim.x;

	if(i < n) {
		sharedX[ti] = x[i];
		sharedY[ti] = y[i];

		y[i] = a * sharedX[ti] + sharedY[ti];
	}
}

	.file	"tmpxft_0036a98f_00000000-6_AXMaisY.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2036:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2036:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%f "
.LC1:
	.string	"%f"
	.text
	.globl	_Z10fprint_matP8_IO_FILEPfi
	.type	_Z10fprint_matP8_IO_FILEPfi, @function
_Z10fprint_matP8_IO_FILEPfi:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rsi, %r12
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movslq	%edx, %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
.L3:
	leal	-1(%rbx), %eax
	cmpl	%r13d, %eax
	jle	.L7
	movq	%r14, %rdx
	movl	$2, %esi
	movb	$1, %al
	movq	%rdi, 8(%rsp)
	cvtss2sd	(%r12,%r13,4), %xmm0
	call	__fprintf_chk@PLT
	incq	%r13
	movq	8(%rsp), %rdi
	jmp	.L3
.L7:
	cvtss2sd	-4(%r12,%rbx,4), %xmm0
	addq	$24, %rsp
	.cfi_def_cfa_offset 40
	leaq	.LC1(%rip), %rdx
	movl	$2, %esi
	popq	%rbx
	.cfi_def_cfa_offset 32
	movb	$1, %al
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	__fprintf_chk@PLT
	.cfi_endproc
.LFE2028:
	.size	_Z10fprint_matP8_IO_FILEPfi, .-_Z10fprint_matP8_IO_FILEPfi
	.section	.rodata.str1.1
.LC2:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/wakim/prog-gpu-cuda/master/AXMaisY/src/AXMaisY.cu"
.LC3:
	.string	"Error %s at line %d in file %s\n"
	.text
	.globl	_Z15alloc_on_devicePfS_PPvS1_i
	.type	_Z15alloc_on_devicePfS_PPvS1_i, @function
_Z15alloc_on_devicePfS_PPvS1_i:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%rdi, %r14
	movq	%rdx, %rdi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rsi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rdx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%rcx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movslq	%r8d, %rbx
	salq	$2, %rbx
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L9
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	leaq	.LC2(%rip), %r9
	movl	$149, %r8d
	movq	%rax, %rcx
	jmp	.L14
.L9:
	movq	%rbp, %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L10
	call	cudaGetErrorString@PLT
	leaq	.LC2(%rip), %r9
	movl	$150, %r8d
	movq	%rax, %rcx
.L14:
	movq	stderr(%rip), %rdi
	leaq	.LC3(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L10:
	movq	(%r12), %rdi
	movl	$1, %ecx
	movq	%rbx, %rdx
	movq	%r14, %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L11
	call	cudaGetErrorString@PLT
	leaq	.LC2(%rip), %r9
	movl	$151, %r8d
	movq	%rax, %rcx
	jmp	.L14
.L11:
	movq	0(%rbp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rdx
	movq	%r13, %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L8
	call	cudaGetErrorString@PLT
	leaq	.LC2(%rip), %r9
	movl	$152, %r8d
	movq	%rax, %rcx
	jmp	.L14
.L8:
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2029:
	.size	_Z15alloc_on_devicePfS_PPvS1_i, .-_Z15alloc_on_devicePfS_PPvS1_i
	.globl	_Z16copy_from_devicePvPfi
	.type	_Z16copy_from_devicePvPfi, @function
_Z16copy_from_devicePvPfi:
.LFB2030:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movslq	%edx, %rdx
	movq	%rsi, %rdi
	movl	$2, %ecx
	salq	$2, %rdx
	movq	%rax, %rsi
	jmp	cudaMemcpy@PLT
	.cfi_endproc
.LFE2030:
	.size	_Z16copy_from_devicePvPfi, .-_Z16copy_from_devicePvPfi
	.globl	_Z14free_on_devicePvS_
	.type	_Z14free_on_devicePvS_, @function
_Z14free_on_devicePvS_:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rsi, %rbx
	call	cudaFree@PLT
	movq	%rbx, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	cudaFree@PLT
	.cfi_endproc
.LFE2031:
	.size	_Z14free_on_devicePvS_, .-_Z14free_on_devicePvS_
	.globl	_Z15a_x_mais_y_hostiPfS_i
	.type	_Z15a_x_mais_y_hostiPfS_i, @function
_Z15a_x_mais_y_hostiPfS_i:
.LFB2032:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
.L19:
	cmpl	%eax, %ecx
	jle	.L21
	cvtsi2ssl	%edi, %xmm0
	mulss	(%rsi,%rax,4), %xmm0
	addss	(%rdx,%rax,4), %xmm0
	movss	%xmm0, (%rdx,%rax,4)
	incq	%rax
	jmp	.L19
.L21:
	ret
	.cfi_endproc
.LFE2032:
	.size	_Z15a_x_mais_y_hostiPfS_i, .-_Z15a_x_mais_y_hostiPfS_i
	.globl	_Z4initi
	.type	_Z4initi, @function
_Z4initi:
.LFB2033:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movslq	%edi, %rdi
	movq	%rdi, %rbx
	salq	$2, %rdi
	call	malloc@PLT
	xorl	%edx, %edx
.L23:
	cmpl	%edx, %ebx
	jle	.L26
	cvtsi2ssl	%edx, %xmm0
	movss	%xmm0, (%rax,%rdx,4)
	incq	%rdx
	jmp	.L23
.L26:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2033:
	.size	_Z4initi, .-_Z4initi
	.globl	_Z41__device_stub__Z17a_x_mais_y_deviceiPfS_iiPfS_i
	.type	_Z41__device_stub__Z17a_x_mais_y_deviceiPfS_iiPfS_i, @function
_Z41__device_stub__Z17a_x_mais_y_deviceiPfS_iiPfS_i:
.LFB2058:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movl	%edi, 28(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 24(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L27
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z17a_x_mais_y_deviceiPfS_i(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L27:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L29
	call	__stack_chk_fail@PLT
.L29:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2058:
	.size	_Z41__device_stub__Z17a_x_mais_y_deviceiPfS_iiPfS_i, .-_Z41__device_stub__Z17a_x_mais_y_deviceiPfS_iiPfS_i
	.globl	_Z17a_x_mais_y_deviceiPfS_i
	.type	_Z17a_x_mais_y_deviceiPfS_i, @function
_Z17a_x_mais_y_deviceiPfS_i:
.LFB2059:
	.cfi_startproc
	endbr64
	jmp	_Z41__device_stub__Z17a_x_mais_y_deviceiPfS_iiPfS_i
	.cfi_endproc
.LFE2059:
	.size	_Z17a_x_mais_y_deviceiPfS_i, .-_Z17a_x_mais_y_deviceiPfS_i
	.globl	_Z50__device_stub__Z26a_x_mais_y_device_coalesceiPfS_iiPfS_i
	.type	_Z50__device_stub__Z26a_x_mais_y_device_coalesceiPfS_iiPfS_i, @function
_Z50__device_stub__Z26a_x_mais_y_device_coalesceiPfS_iiPfS_i:
.LFB2060:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movl	%edi, 28(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 24(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L32
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z26a_x_mais_y_device_coalesceiPfS_i(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L32:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L34
	call	__stack_chk_fail@PLT
.L34:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2060:
	.size	_Z50__device_stub__Z26a_x_mais_y_device_coalesceiPfS_iiPfS_i, .-_Z50__device_stub__Z26a_x_mais_y_device_coalesceiPfS_iiPfS_i
	.globl	_Z26a_x_mais_y_device_coalesceiPfS_i
	.type	_Z26a_x_mais_y_device_coalesceiPfS_i, @function
_Z26a_x_mais_y_device_coalesceiPfS_i:
.LFB2061:
	.cfi_startproc
	endbr64
	jmp	_Z50__device_stub__Z26a_x_mais_y_device_coalesceiPfS_iiPfS_i
	.cfi_endproc
.LFE2061:
	.size	_Z26a_x_mais_y_device_coalesceiPfS_i, .-_Z26a_x_mais_y_device_coalesceiPfS_i
	.section	.rodata.str1.1
.LC4:
	.string	"Uso: %s <algoritmo> <tamanho_vetor> <tamanho_bloco> <a opcional> <debug opcional>\nalgoritmo:\n\ts (Sequencial)\n\tc (Cuda nao coalescente)\n\tcc (Cuda coalescente)\n"
.LC5:
	.string	"debug"
.LC6:
	.string	"w"
.LC7:
	.string	"y_s.txt"
.LC8:
	.string	"x_s.txt"
.LC9:
	.string	"axy_s.txt"
.LC10:
	.string	"y_c.txt"
.LC11:
	.string	"x_c.txt"
.LC12:
	.string	"axy_c.txt"
.LC13:
	.string	"cc"
.LC14:
	.string	"x_cc.txt"
.LC15:
	.string	"y_cc.txt"
.LC16:
	.string	"axy_cc.txt"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rsi, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	cmpl	$3, %edi
	jg	.L38
	movq	(%rsi), %rdx
	movl	$2, %edi
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
	orl	$-1, %eax
	jmp	.L37
.L38:
	movq	8(%rsi), %rax
	movl	%edi, %r14d
	movq	16(%rsi), %rdi
	xorl	%r13d, %r13d
	movq	%rax, 40(%rsp)
	call	atoi@PLT
	movq	24(%r15), %rdi
	movl	%eax, 8(%rsp)
	call	atoi@PLT
	movl	%eax, %ebx
	cmpl	$4, %r14d
	je	.L40
	movq	32(%r15), %rdi
	leaq	.LC5(%rip), %rsi
	xorl	%r13d, %r13d
	call	strcmp@PLT
	testl	%eax, %eax
	sete	%r13b
.L40:
	xorl	%edi, %edi
	call	time@PLT
	movl	%eax, %edi
	call	srand@PLT
	movl	8(%rsp), %edi
	call	_Z4initi
	movl	8(%rsp), %edi
	movq	%rax, 16(%rsp)
	call	_Z4initi
	movq	%rax, (%rsp)
	cmpl	$4, %r14d
	je	.L41
	movq	32(%r15), %rdi
	call	atof@PLT
	cvtsd2ss	%xmm0, %xmm1
	movss	%xmm1, 12(%rsp)
	jmp	.L42
.L41:
	call	rand@PLT
	cltd
	idivl	8(%rsp)
	cvtsi2ssl	%edx, %xmm2
	movss	%xmm2, 12(%rsp)
.L42:
	movq	40(%rsp), %rax
	movb	(%rax), %r14b
	cmpb	$115, %r14b
	jne	.L43
	testl	%r13d, %r13d
	je	.L44
	leaq	.LC6(%rip), %r12
	leaq	.LC7(%rip), %rbp
	movl	%r13d, %r14d
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	fopen@PLT
	movq	%r12, %rsi
	leaq	.LC8(%rip), %rdi
	movq	%rax, 24(%rsp)
	call	fopen@PLT
	movq	%r12, %rsi
	movq	%rbp, %rdi
	movq	%rax, 32(%rsp)
	call	fopen@PLT
	movq	%r12, %rsi
	leaq	.LC9(%rip), %rdi
	movq	%rax, %rbp
	call	fopen@PLT
	movq	%rax, %r12
	jmp	.L56
.L43:
	movq	40(%rsp), %rdi
	call	strlen@PLT
	cmpb	$99, %r14b
	jne	.L46
	decq	%rax
	jne	.L46
	movl	$2, %r14d
	testl	%r13d, %r13d
	je	.L49
	leaq	.LC6(%rip), %r12
	leaq	.LC10(%rip), %rbp
	movq	%rbp, %rdi
	movq	%r12, %rsi
	call	fopen@PLT
	movq	%r12, %rsi
	leaq	.LC11(%rip), %rdi
	movq	%rax, 24(%rsp)
	call	fopen@PLT
	movq	%rbp, %rdi
	movq	%r12, %rsi
	movq	%rax, 32(%rsp)
	call	fopen@PLT
	movq	%r12, %rsi
	leaq	.LC12(%rip), %rdi
	movq	%rax, %rbp
	jmp	.L77
.L46:
	movq	40(%rsp), %rdi
	movl	$2, %edx
	leaq	.LC13(%rip), %rsi
	call	strncmp@PLT
	testl	%eax, %eax
	jne	.L48
	movl	$4, %r14d
	testl	%r13d, %r13d
	je	.L49
	leaq	.LC6(%rip), %r12
	leaq	.LC10(%rip), %rdi
	movq	%r12, %rsi
	call	fopen@PLT
	movq	%r12, %rsi
	leaq	.LC14(%rip), %rdi
	movq	%rax, 24(%rsp)
	call	fopen@PLT
	movq	%r12, %rsi
	leaq	.LC15(%rip), %rdi
	movq	%rax, 32(%rsp)
	call	fopen@PLT
	movq	%r12, %rsi
	leaq	.LC16(%rip), %rdi
	movq	%rax, %rbp
.L77:
	call	fopen@PLT
	movq	%rax, %r12
.L56:
	movq	24(%rsp), %rdi
	leaq	.LC1(%rip), %rdx
	movl	$2, %esi
	movb	$1, %al
	cvtss2sd	12(%rsp), %xmm0
	call	__fprintf_chk@PLT
	movl	8(%rsp), %edx
	movq	16(%rsp), %rsi
	movq	32(%rsp), %rdi
	call	_Z10fprint_matP8_IO_FILEPfi
	movl	8(%rsp), %edx
	movq	(%rsp), %rsi
	movq	%rbp, %rdi
	call	_Z10fprint_matP8_IO_FILEPfi
	cmpl	$1, %r14d
	jne	.L49
.L44:
	cvttss2sil	12(%rsp), %edi
	movl	8(%rsp), %ecx
	movq	(%rsp), %rdx
	movq	16(%rsp), %rsi
	call	_Z15a_x_mais_y_hostiPfS_i
	jmp	.L50
.L48:
	orl	$-1, %r14d
	testl	%r13d, %r13d
	jne	.L56
.L49:
	movl	8(%rsp), %eax
	movl	8(%rsp), %r8d
	leaq	56(%rsp), %rcx
	movq	(%rsp), %rsi
	movq	16(%rsp), %rdi
	leal	-1(%rax,%rbx), %eax
	cltd
	idivl	%ebx
	leaq	48(%rsp), %rdx
	movl	%eax, %r15d
	call	_Z15alloc_on_devicePfS_PPvS1_i
	cmpl	$2, %r14d
	jne	.L51
	movabsq	$4294967297, %rax
	movl	%ebx, 76(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%rax, 80(%rsp)
	movl	84(%rsp), %ecx
	movq	%rax, 68(%rsp)
	movq	76(%rsp), %rdx
	movl	%r15d, 64(%rsp)
	movl	72(%rsp), %esi
	movq	64(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L53
	cvttss2sil	12(%rsp), %edi
	movl	8(%rsp), %ecx
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rsi
	call	_Z41__device_stub__Z17a_x_mais_y_deviceiPfS_iiPfS_i
	jmp	.L53
.L51:
	cmpl	$4, %r14d
	jne	.L53
	movl	%ebx, 76(%rsp)
	leal	0(,%rbx,8), %r8d
	xorl	%r9d, %r9d
	movabsq	$4294967297, %rax
	movq	%rax, 80(%rsp)
	movl	84(%rsp), %ecx
	movslq	%r8d, %r8
	movq	%rax, 68(%rsp)
	movq	76(%rsp), %rdx
	movl	%r15d, 64(%rsp)
	movl	72(%rsp), %esi
	movq	64(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L53
	cvttss2sil	12(%rsp), %edi
	movl	8(%rsp), %ecx
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rsi
	call	_Z50__device_stub__Z26a_x_mais_y_device_coalesceiPfS_iiPfS_i
.L53:
	movl	8(%rsp), %edx
	movq	(%rsp), %rsi
	movq	56(%rsp), %rdi
	call	_Z16copy_from_devicePvPfi
.L50:
	testl	%r13d, %r13d
	je	.L55
	movl	8(%rsp), %edx
	movq	(%rsp), %rsi
	movq	%r12, %rdi
	call	_Z10fprint_matP8_IO_FILEPfi
	movq	32(%rsp), %rdi
	call	fclose@PLT
	movq	%rbp, %rdi
	call	fclose@PLT
	movq	%r12, %rdi
	call	fclose@PLT
	movq	24(%rsp), %rdi
	call	fclose@PLT
.L55:
	movq	16(%rsp), %rdi
	call	free@PLT
	movq	(%rsp), %rdi
	call	free@PLT
	xorl	%eax, %eax
.L37:
	movq	88(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L57
	call	__stack_chk_fail@PLT
.L57:
	addq	$104, %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
.LFE2027:
	.size	main, .-main
	.section	.rodata.str1.1
.LC17:
	.string	"_Z26a_x_mais_y_device_coalesceiPfS_i"
.LC18:
	.string	"_Z17a_x_mais_y_deviceiPfS_i"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2063:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC17(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z26a_x_mais_y_device_coalesceiPfS_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC18(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z17a_x_mais_y_deviceiPfS_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	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
.LFE2063:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

/**
 * Copyright 1993-2012 NVIDIA Corporation.  All rights reserved.
 *
 * Please refer to the NVIDIA end user license agreement (EULA) associated
 * with this source code for terms and conditions that govern your use of
 * this software. Any use, reproduction, disclosure, or distribution of
 * this software and related documentation outside the terms of the EULA
 * is strictly prohibited.
 */


#include <hip/hip_runtime.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

/**
 * This macro checks return value of the CUDA runtime call and exits
 * the application if the call failed.
 */
#define CUDA_CHECK_RETURN(value) {											\
	hipError_t _m_cudaStat = value;										\
	if (_m_cudaStat != hipSuccess) {										\
		fprintf(stderr, "Error %s at line %d in file %s\n",					\
				hipGetErrorString(_m_cudaStat), __LINE__, __FILE__);		\
		exit(1);															\
	} }

void alloc_on_device(float *, float*, void **, void **, int);
void free_on_device(void *, void*);
void copy_from_device(void *, float*, int);
void fprint_mat(FILE *, float *, int);
void a_x_mais_y_host(int, float *, float*, int);
float* init(int);

__global__ void a_x_mais_y_device(int, float* , float*, int);
__global__ void a_x_mais_y_device_coalesce(int, float*, float*, int);

const int SEQUENTIAL = 1;
const int CUDA = 2;
const int CUDA_COALESCE = 4;

/**
 * Host function that prepares data array and passes it to the CUDA kernel.
 */
int main(int argc, char ** argv) {

	if(argc < 4) {
		printf("Uso: %s <algoritmo> <tamanho_vetor> <tamanho_bloco> <a opcional> <debug opcional>\n\
algoritmo:\n\ts (Sequencial)\n\tc (Cuda nao coalescente)\n\tcc (Cuda coalescente)\n", argv[0]);
		return -1;
	}

	const char * mode = (argc > 1 ? argv[1] : "");
	const int vector_size = (argc > 2 ? atoi(argv[2]) : 0);
	const int block_size = (argc > 3 ? atoi(argv[3]) : 0);
	const int debug = argc > 4 ? strcmp(argv[4], "debug") == 0 : 0;

	srand(time(NULL));

	int state = -1;
	float *x = init(vector_size);
	float *y = init(vector_size);
	float *x_device, *y_device;
	int n_blocks = (vector_size + (block_size - 1)) / block_size;
	int shared_memory = block_size * 2 * sizeof(float);
	float a = 0.0f;

	FILE *f_a;
	FILE *f_x;
	FILE *f_y;
	FILE *f_axy;

	if(argc > 4) {
		a = atof(argv[4]);
	} else {
		a = (float) (rand() % vector_size);
	}

	if(strncmp(mode, "s", 1) == 0) {
		state = SEQUENTIAL;
		if(debug) {
			f_a = fopen("y_s.txt", "w");
			f_x = fopen("x_s.txt", "w");
			f_y = fopen("y_s.txt", "w");
			f_axy = fopen("axy_s.txt", "w");
		}
	} else if(strlen(mode) == 1 && strncmp(mode, "c", 1) == 0) {
		state = CUDA;
		if(debug) {
			f_a = fopen("y_c.txt", "w");
			f_x = fopen("x_c.txt", "w");
			f_y = fopen("y_c.txt", "w");
			f_axy = fopen("axy_c.txt", "w");
		}
	} else if(strncmp(mode, "cc", 2) == 0) {
		state = CUDA_COALESCE;
		if(debug) {
			f_a = fopen("y_c.txt", "w");
			f_x = fopen("x_cc.txt", "w");
			f_y = fopen("y_cc.txt", "w");
			f_axy = fopen("axy_cc.txt", "w");
		}
	}

	if(debug) {
		fprintf(f_a, "%f", a);
		fprint_mat(f_x, x, vector_size);
		fprint_mat(f_y, y, vector_size);
	}

	if(state == SEQUENTIAL) {
		a_x_mais_y_host(a, x, y, vector_size);
	} else {
		alloc_on_device(x, y, (void**)&x_device, (void**) &y_device, vector_size);

		if(state == CUDA) {
			a_x_mais_y_device<<<n_blocks, block_size>>>(a, x_device, y_device, vector_size);
		} else if(state == CUDA_COALESCE) {
			a_x_mais_y_device_coalesce<<<n_blocks, block_size, shared_memory>>>(a, x_device, y_device, vector_size);
		}

		copy_from_device(y_device, y, vector_size);
	}

	if(debug) {
		fprint_mat(f_axy, y, vector_size);
		fclose(f_x);
		fclose(f_y);
		fclose(f_axy);
		fclose(f_a);
	}

	free(x);
	free(y);

	return 0;
}

void fprint_mat(FILE *f, float *v, int n) {
	for(int i = 0; i < n-1; i++) {
		fprintf(f, "%f ", v[i]);
	}

	fprintf(f, "%f", v[n-1]);
}

void alloc_on_device(float *x, float *y, void **x_ptr, void **y_ptr, int n) {
	size_t size = sizeof(float) * n;
	CUDA_CHECK_RETURN(hipMalloc(x_ptr, size));
	CUDA_CHECK_RETURN(hipMalloc(y_ptr, size));
	CUDA_CHECK_RETURN(hipMemcpy(*x_ptr, x, size, hipMemcpyHostToDevice));
	CUDA_CHECK_RETURN(hipMemcpy(*y_ptr, y, size, hipMemcpyHostToDevice));
}

void copy_from_device(void *v_ptr, float *v, int n) {
	hipMemcpy(v, v_ptr, sizeof(float) * n, hipMemcpyDeviceToHost);
}

void free_on_device(void *x_ptr, void *y_ptr) {
	hipFree(x_ptr);
	hipFree(y_ptr);
}

void a_x_mais_y_host(int a, float *x, float* y, int n) {
	for(int i = 0; i < n; ++i) {
		y[i] = (a * x[i]) + y[i];
	}
}

float* init(int n) {
	float *v = (float*) malloc(sizeof(float) * n);

	for(int i = 0; i < n; ++i) {
		v[i] = (float) i;
	}

	return v;
}

////////////////////////////////////////////////////////////////////////////////

__global__ void a_x_mais_y_device(int a, float* x, float* y, int n) {
	int i = blockDim.x * blockIdx.x + threadIdx.x;

	if(i < n) {
		y[i] = a * x[i] + y[i];
	}
}

__global__ void a_x_mais_y_device_coalesce(int a, float* x, float* y, int n) {
	int i = blockDim.x * blockIdx.x + threadIdx.x;
	int ti = threadIdx.x;

	extern __shared__ float sharedX[];
	float *sharedY = &sharedX[0] + blockDim.x;

	if(i < n) {
		sharedX[ti] = x[i];
		sharedY[ti] = y[i];

		y[i] = a * sharedX[ti] + sharedY[ti];
	}
}

	.text
	.file	"AXMaisY.hip"
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %r13
	cmpl	$3, %edi
	jg	.LBB0_2
# %bb.1:
	movq	(%r13), %rsi
	movl	$.L.str, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$-1, %eax
	jmp	.LBB0_48
.LBB0_2:
	movl	%edi, %r12d
	movq	8(%r13), %rax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movq	16(%r13), %rdi
	callq	atoi
	movl	%eax, %ebx
	movq	24(%r13), %rdi
	callq	atoi
                                        # kill: def $eax killed $eax def $rax
	movq	%rax, 56(%rsp)                  # 8-byte Spill
	movb	$1, 6(%rsp)                     # 1-byte Folded Spill
	cmpl	$4, %r12d
	je	.LBB0_4
# %bb.3:
	movq	32(%r13), %rdi
	movl	$.L.str.2, %esi
	callq	strcmp
	testl	%eax, %eax
	setne	6(%rsp)                         # 1-byte Folded Spill
.LBB0_4:
	xorl	%edi, %edi
	callq	time
	movl	%eax, %edi
	callq	srand
	movslq	%ebx, %r15
	shlq	$2, %r15
	movq	%r15, %rdi
	callq	malloc
	movq	%rax, %r14
	testl	%ebx, %ebx
	movq	%r15, 96(%rsp)                  # 8-byte Spill
	jle	.LBB0_5
# %bb.6:                                # %.lr.ph.preheader.i
	movq	%rbx, %rbp
	movl	%ebx, %ebx
	xorl	%eax, %eax
.LBB0_7:                                # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	%xmm0, (%r14,%rax,4)
	incq	%rax
	cmpq	%rax, %rbx
	jne	.LBB0_7
# %bb.8:                                # %_Z4initi.exit
	movq	%r15, %rdi
	callq	malloc
	movq	%rax, %r15
	xorl	%eax, %eax
.LBB0_9:                                # %.lr.ph.i88
                                        # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	%xmm0, (%r15,%rax,4)
	incq	%rax
	cmpq	%rax, %rbx
	jne	.LBB0_9
# %bb.10:
	movq	%rbp, %rbx
	jmp	.LBB0_11
.LBB0_5:                                # %_Z4initi.exit.thread
	movq	%r15, %rdi
	callq	malloc
	movq	%rax, %r15
.LBB0_11:                               # %_Z4initi.exit92
	movq	56(%rsp), %rcx                  # 8-byte Reload
	leal	(%rbx,%rcx), %eax
	decl	%eax
	cltd
	idivl	%ecx
	movl	%eax, 52(%rsp)                  # 4-byte Spill
	cmpl	$4, %r12d
	jne	.LBB0_12
# %bb.13:
	callq	rand
	cltd
	idivl	%ebx
	xorps	%xmm0, %xmm0
	cvtsi2ss	%edx, %xmm0
	jmp	.LBB0_14
.LBB0_12:
	movq	32(%r13), %rdi
	callq	atof
	cvtsd2ss	%xmm0, %xmm0
.LBB0_14:
	movaps	%xmm0, 64(%rsp)                 # 16-byte Spill
	movb	6(%rsp), %bpl                   # 1-byte Reload
	movq	16(%rsp), %r13                  # 8-byte Reload
	movb	(%r13), %r12b
	cmpb	$115, %r12b
	jne	.LBB0_23
# %bb.15:
                                        # implicit-def: $rax
                                        # kill: killed $rax
                                        # implicit-def: $rax
                                        # kill: killed $rax
                                        # implicit-def: $r13
                                        # implicit-def: $rax
                                        # kill: killed $rax
	testb	%bpl, %bpl
	jne	.LBB0_21
# %bb.16:
	movb	%r12b, 7(%rsp)                  # 1-byte Spill
	movl	$.L.str.7, %eax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movl	$.L.str.6, %r12d
	movl	$.L.str.4, %edi
	movl	$0, 8(%rsp)                     # 4-byte Folded Spill
	movl	$.L.str.4, %eax
	movq	%rax, 32(%rsp)                  # 8-byte Spill
.LBB0_17:                               # %.thread.sink.split
	movl	$0, 12(%rsp)                    # 4-byte Folded Spill
	jmp	.LBB0_18
.LBB0_23:
	movq	%r13, %rdi
	callq	strlen
	cmpb	$99, %r12b
	jne	.LBB0_28
# %bb.24:
	cmpq	$1, %rax
	jne	.LBB0_28
# %bb.25:
	testb	%bpl, %bpl
	je	.LBB0_26
# %bb.27:                               # %.thread.thread.thread
	leaq	40(%rsp), %rdx
	leaq	24(%rsp), %rcx
	movq	%r14, %rdi
	movq	%r15, %rsi
	movl	%ebx, %r8d
	callq	_Z15alloc_on_devicePfS_PPvS1_i
                                        # implicit-def: $rax
                                        # kill: killed $rax
                                        # implicit-def: $r12
                                        # implicit-def: $rax
                                        # kill: killed $rax
                                        # implicit-def: $rax
                                        # kill: killed $rax
	jmp	.LBB0_39
.LBB0_28:
	movl	$.L.str.12, %esi
	movl	$2, %edx
	movq	%r13, %rdi
	callq	strncmp
	testl	%eax, %eax
	je	.LBB0_29
# %bb.31:
	testb	%bpl, %bpl
	je	.LBB0_32
# %bb.33:                               # %.thread154
	leaq	40(%rsp), %rdx
	leaq	24(%rsp), %rcx
	movq	%r14, %rdi
	movq	%r15, %rsi
	movl	%ebx, %r8d
	callq	_Z15alloc_on_devicePfS_PPvS1_i
                                        # implicit-def: $rax
                                        # kill: killed $rax
                                        # implicit-def: $r12
                                        # implicit-def: $rax
                                        # kill: killed $rax
                                        # implicit-def: $rax
                                        # kill: killed $rax
	jmp	.LBB0_44
.LBB0_26:
	movb	%r12b, 7(%rsp)                  # 1-byte Spill
	movb	$1, %al
	movl	%eax, 12(%rsp)                  # 4-byte Spill
	movl	$.L.str.11, %eax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movl	$.L.str.10, %r12d
	movl	$.L.str.9, %edi
	movl	$0, 8(%rsp)                     # 4-byte Folded Spill
	movl	$.L.str.9, %eax
	movq	%rax, 32(%rsp)                  # 8-byte Spill
.LBB0_18:                               # %.thread.sink.split
	movl	$.L.str.5, %esi
	callq	fopen
	movq	%rax, %r13
	movl	$.L.str.5, %esi
	movq	%r12, %rdi
	callq	fopen
	movq	%rax, %rbp
	movl	$.L.str.5, %esi
	movq	32(%rsp), %rdi                  # 8-byte Reload
	callq	fopen
	movq	%rax, %r12
	movl	$.L.str.5, %esi
	movq	16(%rsp), %rdi                  # 8-byte Reload
	callq	fopen
	movq	%r13, %rdi
	movq	%rax, 88(%rsp)                  # 8-byte Spill
.LBB0_19:                               # %.thread
	xorps	%xmm0, %xmm0
	cvtss2sd	64(%rsp), %xmm0                 # 16-byte Folded Reload
	movl	$.L.str.16, %esi
	movq	%rdi, 16(%rsp)                  # 8-byte Spill
	movb	$1, %al
	callq	fprintf
	movq	%rbp, %r13
	movq	%rbp, %rdi
	movq	%r14, %rsi
	movl	%ebx, %edx
	callq	_Z10fprint_matP8_IO_FILEPfi
	movq	%r12, %rdi
	movq	%r15, %rsi
	movl	%ebx, %edx
	callq	_Z10fprint_matP8_IO_FILEPfi
	cmpb	$115, 7(%rsp)                   # 1-byte Folded Reload
	movq	%r12, 32(%rsp)                  # 8-byte Spill
	jne	.LBB0_37
# %bb.20:
	movb	6(%rsp), %bpl                   # 1-byte Reload
.LBB0_21:                               # %.thread.thread164
	testl	%ebx, %ebx
	jle	.LBB0_22
# %bb.35:                               # %.lr.ph.i93
	cvttps2dq	64(%rsp), %xmm0         # 16-byte Folded Reload
	cvtdq2ps	%xmm0, %xmm0
	movl	%ebx, %eax
	xorl	%ecx, %ecx
	movq	%r13, %r12
.LBB0_36:                               # =>This Inner Loop Header: Depth=1
	movss	(%r14,%rcx,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	mulss	%xmm0, %xmm1
	addss	(%r15,%rcx,4), %xmm1
	movss	%xmm1, (%r15,%rcx,4)
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB0_36
	jmp	.LBB0_45
.LBB0_37:
	leaq	40(%rsp), %rdx
	leaq	24(%rsp), %rcx
	movq	%r14, %rdi
	movq	%r15, %rsi
	movl	%ebx, %r8d
	callq	_Z15alloc_on_devicePfS_PPvS1_i
	cmpb	$0, 12(%rsp)                    # 1-byte Folded Reload
	je	.LBB0_41
# %bb.38:
	movq	%r13, %r12
	movb	6(%rsp), %bpl                   # 1-byte Reload
.LBB0_39:
	movl	52(%rsp), %edi                  # 4-byte Reload
	btsq	$32, %rdi
	movl	56(%rsp), %edx                  # 4-byte Reload
	btsq	$32, %rdx
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB0_44
# %bb.40:
	cvttss2si	64(%rsp), %edi          # 16-byte Folded Reload
	movq	40(%rsp), %rsi
	movq	24(%rsp), %rdx
	movl	%ebx, %ecx
	callq	_Z32__device_stub__a_x_mais_y_deviceiPfS_i
	jmp	.LBB0_44
.LBB0_22:
	movq	%r13, %r12
	jmp	.LBB0_45
.LBB0_41:
	cmpb	$0, 8(%rsp)                     # 1-byte Folded Reload
	movq	%r13, %r12
	movb	6(%rsp), %bpl                   # 1-byte Reload
	jne	.LBB0_42
	jmp	.LBB0_44
.LBB0_29:
	testb	%bpl, %bpl
	je	.LBB0_30
# %bb.34:                               # %.thread179
	leaq	40(%rsp), %rdx
	leaq	24(%rsp), %rcx
	movq	%r14, %rdi
	movq	%r15, %rsi
	movl	%ebx, %r8d
	callq	_Z15alloc_on_devicePfS_PPvS1_i
                                        # implicit-def: $rax
                                        # kill: killed $rax
                                        # implicit-def: $rax
                                        # kill: killed $rax
                                        # implicit-def: $r12
                                        # implicit-def: $rax
                                        # kill: killed $rax
.LBB0_42:
	movq	56(%rsp), %rcx                  # 8-byte Reload
	leal	(,%rcx,8), %eax
	movslq	%eax, %r8
	movl	52(%rsp), %edi                  # 4-byte Reload
	btsq	$32, %rdi
	movl	%ecx, %edx
	btsq	$32, %rdx
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB0_44
# %bb.43:
	cvttss2si	64(%rsp), %edi          # 16-byte Folded Reload
	movq	40(%rsp), %rsi
	movq	24(%rsp), %rdx
	movl	%ebx, %ecx
	callq	_Z41__device_stub__a_x_mais_y_device_coalesceiPfS_i
.LBB0_44:
	movq	24(%rsp), %rsi
	movq	%r15, %rdi
	movq	96(%rsp), %rdx                  # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
.LBB0_45:                               # %_Z15a_x_mais_y_hostiPfS_i.exit
	testb	%bpl, %bpl
	jne	.LBB0_47
# %bb.46:
	movq	88(%rsp), %r13                  # 8-byte Reload
	movq	%r13, %rdi
	movq	%r15, %rsi
	movl	%ebx, %edx
	callq	_Z10fprint_matP8_IO_FILEPfi
	movq	%r12, %rdi
	callq	fclose
	movq	32(%rsp), %rdi                  # 8-byte Reload
	callq	fclose
	movq	%r13, %rdi
	callq	fclose
	movq	16(%rsp), %rdi                  # 8-byte Reload
	callq	fclose
.LBB0_47:
	movq	%r14, %rdi
	callq	free
	movq	%r15, %rdi
	callq	free
	xorl	%eax, %eax
.LBB0_48:
	addq	$104, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB0_32:
	.cfi_def_cfa_offset 160
	movb	%r12b, 7(%rsp)                  # 1-byte Spill
	movb	%bpl, 6(%rsp)                   # 1-byte Spill
	movl	$0, 8(%rsp)                     # 4-byte Folded Spill
	movl	$0, 12(%rsp)                    # 4-byte Folded Spill
                                        # implicit-def: $rdi
                                        # implicit-def: $rbp
                                        # implicit-def: $r12
                                        # implicit-def: $rax
                                        # kill: killed $rax
	jmp	.LBB0_19
.LBB0_30:
	movb	%r12b, 7(%rsp)                  # 1-byte Spill
	movb	$1, %al
	movl	%eax, 8(%rsp)                   # 4-byte Spill
	movl	$.L.str.15, %eax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	movl	$.L.str.14, %eax
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	movl	$.L.str.13, %r12d
	movl	$.L.str.9, %edi
	jmp	.LBB0_17
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
                                        # -- End function
	.globl	_Z4initi                        # -- Begin function _Z4initi
	.type	_Z4initi,@function
_Z4initi:                               # @_Z4initi
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movl	%edi, %ebx
	movslq	%edi, %r14
	leaq	(,%r14,4), %rdi
	callq	malloc
	testl	%r14d, %r14d
	jle	.LBB1_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%ebx, %ecx
	xorl	%edx, %edx
.LBB1_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtsi2ss	%edx, %xmm0
	movss	%xmm0, (%rax,%rdx,4)
	incq	%rdx
	cmpq	%rdx, %rcx
	jne	.LBB1_2
.LBB1_3:                                # %._crit_edge
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z4initi, .Lfunc_end1-_Z4initi
	.cfi_endproc
                                        # -- End function
	.globl	_Z10fprint_matP8_IO_FILEPfi     # -- Begin function _Z10fprint_matP8_IO_FILEPfi
	.type	_Z10fprint_matP8_IO_FILEPfi,@function
_Z10fprint_matP8_IO_FILEPfi:            # @_Z10fprint_matP8_IO_FILEPfi
	.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	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
                                        # kill: def $edx killed $edx def $rdx
	movq	%rsi, %r14
	movq	%rdi, %rbx
	leal	-1(%rdx), %ebp
	cmpl	$2, %edx
	jl	.LBB2_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%ebp, %r15d
	xorl	%r12d, %r12d
.LBB2_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r14,%r12,4), %xmm0
	movl	$.L.str.17, %esi
	movq	%rbx, %rdi
	movb	$1, %al
	callq	fprintf
	incq	%r12
	cmpq	%r12, %r15
	jne	.LBB2_2
.LBB2_3:                                # %._crit_edge
	movslq	%ebp, %rax
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r14,%rax,4), %xmm0
	movl	$.L.str.16, %esi
	movq	%rbx, %rdi
	movb	$1, %al
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.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	fprintf                         # TAILCALL
.Lfunc_end2:
	.size	_Z10fprint_matP8_IO_FILEPfi, .Lfunc_end2-_Z10fprint_matP8_IO_FILEPfi
	.cfi_endproc
                                        # -- End function
	.globl	_Z15a_x_mais_y_hostiPfS_i       # -- Begin function _Z15a_x_mais_y_hostiPfS_i
	.type	_Z15a_x_mais_y_hostiPfS_i,@function
_Z15a_x_mais_y_hostiPfS_i:              # @_Z15a_x_mais_y_hostiPfS_i
	.cfi_startproc
# %bb.0:
	testl	%ecx, %ecx
	jle	.LBB3_3
# %bb.1:                                # %.lr.ph
	cvtsi2ss	%edi, %xmm0
	movl	%ecx, %eax
	xorl	%ecx, %ecx
.LBB3_2:                                # =>This Inner Loop Header: Depth=1
	movss	(%rsi,%rcx,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	mulss	%xmm0, %xmm1
	addss	(%rdx,%rcx,4), %xmm1
	movss	%xmm1, (%rdx,%rcx,4)
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB3_2
.LBB3_3:                                # %._crit_edge
	retq
.Lfunc_end3:
	.size	_Z15a_x_mais_y_hostiPfS_i, .Lfunc_end3-_Z15a_x_mais_y_hostiPfS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z15alloc_on_devicePfS_PPvS1_i  # -- Begin function _Z15alloc_on_devicePfS_PPvS1_i
	.type	_Z15alloc_on_devicePfS_PPvS1_i,@function
_Z15alloc_on_devicePfS_PPvS1_i:         # @_Z15alloc_on_devicePfS_PPvS1_i
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rcx, %r15
	movq	%rdx, %r13
	movq	%rsi, %rbx
	movq	%rdi, %r12
	movslq	%r8d, %r14
	shlq	$2, %r14
	movq	%rdx, %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB4_1
# %bb.3:
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB4_4
# %bb.5:
	movq	(%r13), %rdi
	movq	%r12, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB4_6
# %bb.7:
	movq	(%r15), %rdi
	movq	%rbx, %rsi
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB4_8
# %bb.9:
	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
.LBB4_1:
	.cfi_def_cfa_offset 48
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.18, %esi
	movl	$.L.str.19, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$151, %ecx
	jmp	.LBB4_2
.LBB4_4:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.18, %esi
	movl	$.L.str.19, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$152, %ecx
	jmp	.LBB4_2
.LBB4_6:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.18, %esi
	movl	$.L.str.19, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$153, %ecx
	jmp	.LBB4_2
.LBB4_8:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.18, %esi
	movl	$.L.str.19, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$154, %ecx
.LBB4_2:
	xorl	%eax, %eax
	callq	fprintf
	movl	$1, %edi
	callq	exit
.Lfunc_end4:
	.size	_Z15alloc_on_devicePfS_PPvS1_i, .Lfunc_end4-_Z15alloc_on_devicePfS_PPvS1_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z32__device_stub__a_x_mais_y_deviceiPfS_i # -- Begin function _Z32__device_stub__a_x_mais_y_deviceiPfS_i
	.type	_Z32__device_stub__a_x_mais_y_deviceiPfS_i,@function
_Z32__device_stub__a_x_mais_y_deviceiPfS_i: # @_Z32__device_stub__a_x_mais_y_deviceiPfS_i
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	12(%rsp), %rax
	movl	%edi, (%rax)
	leaq	40(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	32(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	8(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z17a_x_mais_y_deviceiPfS_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_Z32__device_stub__a_x_mais_y_deviceiPfS_i, .Lfunc_end5-_Z32__device_stub__a_x_mais_y_deviceiPfS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z41__device_stub__a_x_mais_y_device_coalesceiPfS_i # -- Begin function _Z41__device_stub__a_x_mais_y_device_coalesceiPfS_i
	.type	_Z41__device_stub__a_x_mais_y_device_coalesceiPfS_i,@function
_Z41__device_stub__a_x_mais_y_device_coalesceiPfS_i: # @_Z41__device_stub__a_x_mais_y_device_coalesceiPfS_i
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	12(%rsp), %rax
	movl	%edi, (%rax)
	leaq	40(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	32(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	8(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z26a_x_mais_y_device_coalesceiPfS_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	_Z41__device_stub__a_x_mais_y_device_coalesceiPfS_i, .Lfunc_end6-_Z41__device_stub__a_x_mais_y_device_coalesceiPfS_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z16copy_from_devicePvPfi       # -- Begin function _Z16copy_from_devicePvPfi
	.type	_Z16copy_from_devicePvPfi,@function
_Z16copy_from_devicePvPfi:              # @_Z16copy_from_devicePvPfi
	.cfi_startproc
# %bb.0:
	movq	%rdi, %rax
	movslq	%edx, %rdx
	shlq	$2, %rdx
	movq	%rsi, %rdi
	movq	%rax, %rsi
	movl	$2, %ecx
	jmp	hipMemcpy                       # TAILCALL
.Lfunc_end7:
	.size	_Z16copy_from_devicePvPfi, .Lfunc_end7-_Z16copy_from_devicePvPfi
	.cfi_endproc
                                        # -- End function
	.globl	_Z14free_on_devicePvS_          # -- Begin function _Z14free_on_devicePvS_
	.type	_Z14free_on_devicePvS_,@function
_Z14free_on_devicePvS_:                 # @_Z14free_on_devicePvS_
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rsi, %rbx
	callq	hipFree
	movq	%rbx, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	hipFree                         # TAILCALL
.Lfunc_end8:
	.size	_Z14free_on_devicePvS_, .Lfunc_end8-_Z14free_on_devicePvS_
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB9_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB9_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z17a_x_mais_y_deviceiPfS_i, %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	$_Z26a_x_mais_y_device_coalesceiPfS_i, %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_end9:
	.size	__hip_module_ctor, .Lfunc_end9-__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	.LBB10_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
.LBB10_2:
	retq
.Lfunc_end10:
	.size	__hip_module_dtor, .Lfunc_end10-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Uso: %s <algoritmo> <tamanho_vetor> <tamanho_bloco> <a opcional> <debug opcional>\nalgoritmo:\n\ts (Sequencial)\n\tc (Cuda nao coalescente)\n\tcc (Cuda coalescente)\n"
	.size	.L.str, 159

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"debug"
	.size	.L.str.2, 6

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"y_s.txt"
	.size	.L.str.4, 8

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

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"x_s.txt"
	.size	.L.str.6, 8

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"axy_s.txt"
	.size	.L.str.7, 10

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"y_c.txt"
	.size	.L.str.9, 8

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"x_c.txt"
	.size	.L.str.10, 8

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"axy_c.txt"
	.size	.L.str.11, 10

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

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"x_cc.txt"
	.size	.L.str.13, 9

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"y_cc.txt"
	.size	.L.str.14, 9

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"axy_cc.txt"
	.size	.L.str.15, 11

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

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

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

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

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"Error %s at line %d in file %s\n"
	.size	.L.str.18, 32

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/wakim/prog-gpu-cuda/master/AXMaisY/src/AXMaisY.hip"
	.size	.L.str.19, 113

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z17a_x_mais_y_deviceiPfS_i"
	.size	.L__unnamed_1, 28

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z26a_x_mais_y_device_coalesceiPfS_i"
	.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 _Z32__device_stub__a_x_mais_y_deviceiPfS_i
	.addrsig_sym _Z41__device_stub__a_x_mais_y_device_coalesceiPfS_i
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z17a_x_mais_y_deviceiPfS_i
	.addrsig_sym _Z26a_x_mais_y_device_coalesceiPfS_i
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z17a_x_mais_y_deviceiPfS_i ; -- Begin function _Z17a_x_mais_y_deviceiPfS_i
	.globl	_Z17a_x_mais_y_deviceiPfS_i
	.p2align	8
	.type	_Z17a_x_mais_y_deviceiPfS_i,@function
_Z17a_x_mais_y_deviceiPfS_i:            ; @_Z17a_x_mais_y_deviceiPfS_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b32 s3, s[0:1], 0x18
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x8
	v_ashrrev_i32_e32 v2, 31, v1
	s_load_b32 s0, s[0:1], 0x0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v2, vcc_lo, s4, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s7, v1, vcc_lo
	v_cvt_f32_i32_e32 v4, s0
	global_load_b32 v2, v[2:3], off
	global_load_b32 v3, v[0:1], off
	s_waitcnt vmcnt(0)
	v_fmac_f32_e32 v3, v2, v4
	global_store_b32 v[0:1], v3, off
.LBB0_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z17a_x_mais_y_deviceiPfS_i
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 5
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z17a_x_mais_y_deviceiPfS_i, .Lfunc_end0-_Z17a_x_mais_y_deviceiPfS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 172
; NumSgprs: 18
; NumVgprs: 5
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 5
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z26a_x_mais_y_device_coalesceiPfS_i ; -- Begin function _Z26a_x_mais_y_device_coalesceiPfS_i
	.globl	_Z26a_x_mais_y_device_coalesceiPfS_i
	.p2align	8
	.type	_Z26a_x_mais_y_device_coalesceiPfS_i,@function
_Z26a_x_mais_y_device_coalesceiPfS_i:   ; @_Z26a_x_mais_y_device_coalesceiPfS_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b32 s3, s[0:1], 0x18
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	v_cmp_gt_i32_e32 vcc_lo, s3, v1
	s_and_saveexec_b32 s3, vcc_lo
	s_cbranch_execz .LBB1_2
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x8
	v_ashrrev_i32_e32 v2, 31, v1
	v_lshlrev_b32_e32 v0, 2, v0
	s_lshl_b32 s2, s2, 2
	s_load_b32 s0, s[0:1], 0x0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[1:2], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v3, vcc_lo, s4, v1
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v4, vcc_lo, s5, v2, vcc_lo
	v_add_co_u32 v1, vcc_lo, s6, v1
	v_add_co_ci_u32_e32 v2, vcc_lo, s7, v2, vcc_lo
	global_load_b32 v3, v[3:4], off
	global_load_b32 v4, v[1:2], off
	v_add_nc_u32_e32 v5, 0, v0
	v_add3_u32 v0, 0, s2, v0
	s_waitcnt vmcnt(1)
	ds_store_b32 v5, v3
	s_waitcnt vmcnt(0)
	ds_store_b32 v0, v4
	ds_load_b32 v0, v5
	v_cvt_f32_i32_e32 v3, s0
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_fmac_f32_e32 v4, v0, v3
	global_store_b32 v[1:2], v4, off
.LBB1_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z26a_x_mais_y_device_coalesceiPfS_i
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 6
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z26a_x_mais_y_device_coalesceiPfS_i, .Lfunc_end1-_Z26a_x_mais_y_device_coalesceiPfS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 224
; NumSgprs: 18
; NumVgprs: 6
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 6
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.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:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z17a_x_mais_y_deviceiPfS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z17a_x_mais_y_deviceiPfS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     5
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
      - .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:           _Z26a_x_mais_y_device_coalesceiPfS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z26a_x_mais_y_device_coalesceiPfS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     6
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
