#include <iostream>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <math.h>
#include <vector>
#include <fstream>
#include "random"

#define space 15

#define dim1 100		//X 	 
#define dim2 100 	//Y
#define dim3 100 	//Z

#define N ( 100000 )
#define M ( 512 )

#define incr 1

#define rad_circles 1
#define num_circles 1000

#define FOR(i,n,inc) for( i = -n; i < n; i=i+inc)

//int idx_radius = 0;

using namespace std;

struct point3D{
	
	double x, y,z;
	point3D( double _x, double _y, double _z){
		x = _x;
		y = _y;
		z = _z;
	}
};

vector<point3D> v_point;	//vector of points
vector<point3D> v_circles;	//vector of circles' center
ofstream mb_file("data.obj");

//double thresh = 0.5;

__global__ void add( point3D* points, point3D* circles, point3D* intersection){
	
	int index = threadIdx.x + blockIdx.x*blockDim.x;

	//if( circles[index].x != -1 && circles[index].y != -1 && circles[index].z != -1 ){

	double sum = 0.0;//, sum2 = 0.0;

	double dif_x, dif_y, dif_z, value=0.0, thresh = 0.2;

	for( int i = 0 ; i < num_circles; i++){
			
		dif_x = (points[index].x - circles[i].x);
		dif_y = (points[index].y - circles[i].y);
		dif_z = (points[index].z - circles[i].z);

		//printf("%f %f %f %c", points[index].x, points[index].y, points[index].z, '\n');
		
		value = sqrt( dif_x*dif_x + dif_y*dif_y + dif_z*dif_z );

		//sum = value * value;
		//printf("%d\n", value);
		
		if( value <= rad_circles ){

			value = 1 - ( (value*value) / (rad_circles*rad_circles) );			

			sum = sum + (value * value);			

			if( sum > thresh ){
				intersection[index].x = points[index].x;
				intersection[index].y = points[index].y;
				intersection[index].z = points[index].z;
			}	
		}

		/*dif_x = intersection[index].x - circles[i].x;
		dif_y = intersection[index].y - circles[i].y;
		dif_z = intersection[index].z - circles[i].z;

		value = sqrt( dif_x*dif_x + dif_y*dif_y + dif_z*dif_z );

		if( value <= rad_circles ){

			value = 1 - ( (value * value) / (rad_circles * rad_circles) );			
			value = value * value;
			
			sum2 = sum2 + (value * value);			

			if( sum > thresh  ){				
			}
			else{
				intersection[index].x = intersection[index].y = intersection[index].z = -1;
			}
		}
*/

	}
/*
	sum = 0.0;

	for( int i = 1 ; i < num_circles; i++){
		dif_x = circles[i-1].x - circles[i].x;
		dif_y = circles[i-1].y - circles[i].y;
		dif_z = circles[i-1].z - circles[i].z;

		value = sqrt( dif_x*dif_x + dif_y*dif_y + dif_z*dif_z );

		if( value < rad_circles ){

			value = 1 - ( (value * value) / (rad_circles * rad_circles) );			
			value = value * value;
			
			sum = sum + (value * value);			

			if( sum < thresh - 0.48 ){
				intersection[index].x = points[index].x;
				intersection[index].y = points[index].y;
				intersection[index].z = points[index].z;
			}
		}
	}	
	*/
}

void init_ppoint3D( point3D*& points, int size ){
	for( int i = 0; i < size; i++){
		points[i] = point3D( -1, -1, -1);
	}
	cout << "vector initialized \n";
}

void print_flag( string message, int type){
	if( type == 1) cout << message << endl;
	else if( type == 2) cout << message << "\t";
}

int main(void){

	time_t timer = time(0);	

	point3D *points, *circles, *intersections;				// host copies of a,b,c
	point3D *d_points, *d_circles, *d_intersections;		// device copies of a,b,c


	//If index starts with negative number, first line
	//int size_matrix = ( 2 * dim1 ) * ( 2 * dim2 ) * ( 2 * dim3 ) * (
	//int size_matrix = ( dim1/incr ) * ( dim2/incr ) * ( dim3/incr ); // number of elements
	int size_matrix = 8 * ( dim1/incr ) * ( dim2/incr ) * ( dim3/incr );
	cout << "# elements: " << size_matrix << endl;
	
	int size = size_matrix * sizeof(point3D);
	cout << "size of matrix: " << size << endl;

	// Allocate space for device copies of a,b,c
	cudaMalloc( (void **)&d_points, size);
	cudaMalloc( (void **)&d_circles, size_matrix * sizeof(point3D) );
	cudaMalloc( (void **)&d_intersections, size);	

	// Alloc space for host copies of a,b,c and setup input
	points   	  = (point3D *)malloc(size);
	circles 	  = (point3D *)malloc(size_matrix * sizeof(point3D));
	intersections = (point3D *)malloc(size);	

	init_ppoint3D( intersections, size_matrix);

	/*    default_random_engine rng( random_device{}() ); 
    uniform_int_distribution<int> dist(-dim1, dim1); 
	*/

    init_ppoint3D( circles, size_matrix);

    //int position = dim1 / num_circles;
/*
    circles[0] = point3D( -4, -4, -4);
    circles[1] = point3D( -1.5, -3, -1.4);

    //circles[0] = point3D( -6, -6, -6);
	//circles[1] = point3D( -8, -8,  0);
    circles[2] = point3D( -6,  -6, -6);
    circles[3] = point3D( -8,  0,  0);
    
    circles[4] = point3D(  0, -8, -8);
    circles[5] = point3D(  0, -8,  0);
    circles[6] = point3D(  0,  0, -8);
    circles[7] = point3D(  0,  0,  0);
  */ 

	default_random_engine rng( random_device{}() ); 
    uniform_int_distribution<int> dist(-dim1, dim1); 
	
	for( int i = 0 ; i < num_circles; i++){
		int xr, yr, zr;
		xr = dist(rng);
		yr = dist(rng);
		zr = dist(rng);

    	circles[i] = point3D( xr, yr, zr);
	}

    /*for( int i = 0 ; i < num_circles ; i++){
		circles[i].x = i;
		circles[i].y = i;
		circles[i].z = i;
	}
	*/
    int index = 0;
    
    cout << "Filling vectors" << endl;


	
	for( double i = -dim1 ; i < dim1 ; i=i+incr){
		for( double j = -dim2 ; j < dim2 ; j=j+incr){
			for( double k = -dim3 ; k < dim3 ; k=k+incr){
				
			 	points[index].x = i ;
				points[index].y = j ;
				points[index].z = k ;

				//printf("%f %f %f %c", points[index].x, points[index].y, points[index].z, '\n');

				//mb_file << "v" << setw(space) << (double)a[index].x << setw(space) << (double)a[index].y << setw(space) << (double)a[index].z << endl;  				
				//mb_file << "v" << setw(space) << (double)b[index].x << setw(space) << (double)b[index].y << setw(space) << (double)b[index].z << endl;  				
				//cout << index <<"\n";
				index++;
			}		
		}
	}

	cout << index <<"\n";
	cout << "vectors ready" << endl;

	int cocient = 1000;
	int num_blocks = index / cocient;
	int num_threadsxblock = cocient; 

	// Copy inputs to device
	cudaMemcpy(d_points, points, size, cudaMemcpyHostToDevice);  // Args: Dir. destino, Dir. origen, tamano de dato, sentido del envio
	cudaMemcpy(d_circles, circles, size, cudaMemcpyHostToDevice);
	cudaMemcpy(d_intersections, intersections, size, cudaMemcpyHostToDevice);	

	// Launch add() kernel on GPU
	//for( int i = 0 ; i < num_circles; i++){
	add<<< num_blocks, num_threadsxblock>>> (d_points, d_circles, d_intersections);
	//}
	
	// Copy result back to host
	cudaMemcpy(intersections, d_intersections, size, cudaMemcpyDeviceToHost);
/*	
	for(int i=0; i < size_matrix; ++i){
		std::cout << setw(space) << a[i].x << setw(space) << a[i].y << setw(space) << a[i].z << endl ;
	}

	std::cout << std::endl;

	for(int i=0; i < size_matrix; ++i){
		std::cout << setw(space) << b[i].x << setw(space) << b[i].y << setw(space) << b[i].z << endl ;
	}

	std::cout << std::endl;

	for(int i=0; i < size_matrix; ++i){
		std::cout << setw(space) << c[i].x << setw(space) << c[i].y << setw(space) << c[i].z << endl ;
	}

	std::cout << std::endl;

	for(int i=0; i < size_matrix; ++i){
		std::cout << setw(space) << d[i].x << setw(space) << d[i].y << setw(space) << d[i].z << endl ;
	}

	std::cout << std::endl;
*/

	for(int i = 0; i < size_matrix; ++i){
		if( intersections[i].x != -1 && intersections[i].y != -1 && intersections[i].z != -1 ){
			mb_file << "v" << setw(space) << intersections[i].x << setw(space) << intersections[i].y << setw(space) << intersections[i].z << endl ;
		}
	}

	cout << std::endl;

	// Cleanup
	free(points);
	free(circles);
	free(intersections);
	cudaFree(d_points);
	cudaFree(d_circles);
	cudaFree(d_intersections);

	mb_file.close();

	time_t timer2 = time(0);
	cout <<"Tiempo total: " << difftime(timer2, timer) << endl;

	return 0;
}

	.file	"tmpxft_0020dc4a_00000000-6_metaballs.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB5107:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE5107:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE.isra.0, @function
_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE.isra.0:
.LFB5908:
	.cfi_startproc
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movslq	%esi, %rax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rax, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movslq	%edx, %rbp
	subq	%rax, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	cmpq	$2147483644, %rbp
	ja	.L3
	incq	%rbp
	movl	$2147483645, %eax
	xorl	%edx, %edx
	movl	$2147483647, %esi
	divq	%rbp
	movq	(%rdi), %rdx
	imulq	%rax, %rbp
	movq	%rax, %rcx
.L4:
	imulq	$16807, %rdx, %rax
	xorl	%edx, %edx
	divq	%rsi
	leaq	-1(%rdx), %rax
	cmpq	%rbp, %rax
	jnb	.L4
	movq	%rdx, 0(%r13)
	xorl	%edx, %edx
	divq	%rcx
	jmp	.L5
.L3:
	cmpq	$2147483645, %rbp
	je	.L6
	movl	$2147483646, %ecx
	movq	%rbp, %rax
	xorl	%edx, %edx
	movl	$2147483647, %ebx
	divq	%rcx
	movq	%rax, %r14
.L11:
	movl	%r14d, %edx
	xorl	%esi, %esi
	movq	%r13, %rdi
	call	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE.isra.0
	xorl	%edx, %edx
	movl	%eax, %ecx
	imulq	$16807, 0(%r13), %rax
	divq	%rbx
	movslq	%ecx, %rax
	imulq	$2147483646, %rax, %rax
	movq	%rdx, 0(%r13)
	decq	%rdx
	addq	%rdx, %rax
	setc	%dl
	movzbl	%dl, %edx
	cmpq	%rax, %rbp
	jb	.L11
	testq	%rdx, %rdx
	jne	.L11
	jmp	.L5
.L6:
	imulq	$16807, (%rdi), %rax
	movl	$2147483647, %ecx
	xorl	%edx, %edx
	divq	%rcx
	movq	%rdx, (%rdi)
	leaq	-1(%rdx), %rax
.L5:
	popq	%rbx
	.cfi_def_cfa_offset 40
	addl	%r12d, %eax
	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
.LFE5908:
	.size	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE.isra.0, .-_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE.isra.0
	.section	.text._ZNSt6vectorI7point3DSaIS0_EED2Ev,"axG",@progbits,_ZNSt6vectorI7point3DSaIS0_EED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorI7point3DSaIS0_EED2Ev
	.type	_ZNSt6vectorI7point3DSaIS0_EED2Ev, @function
_ZNSt6vectorI7point3DSaIS0_EED2Ev:
.LFB5891:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L14
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L14:
	ret
	.cfi_endproc
.LFE5891:
	.size	_ZNSt6vectorI7point3DSaIS0_EED2Ev, .-_ZNSt6vectorI7point3DSaIS0_EED2Ev
	.weak	_ZNSt6vectorI7point3DSaIS0_EED1Ev
	.set	_ZNSt6vectorI7point3DSaIS0_EED1Ev,_ZNSt6vectorI7point3DSaIS0_EED2Ev
	.text
	.align 2
	.type	_ZNSolsEPFRSoS_E.isra.0, @function
_ZNSolsEPFRSoS_E.isra.0:
.LFB5912:
	.cfi_startproc
	jmp	*%rsi
	.cfi_endproc
.LFE5912:
	.size	_ZNSolsEPFRSoS_E.isra.0, .-_ZNSolsEPFRSoS_E.isra.0
	.section	.rodata._ZNSt13random_deviceC2Ev.str1.1,"aMS",@progbits,1
.LC0:
	.string	"default"
	.section	.text._ZNSt13random_deviceC2Ev,"axG",@progbits,_ZNSt13random_deviceC5Ev,comdat
	.align 2
	.weak	_ZNSt13random_deviceC2Ev
	.type	_ZNSt13random_deviceC2Ev, @function
_ZNSt13random_deviceC2Ev:
.LFB4470:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4470
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	7+.LC0(%rip), %rdx
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	-7(%rdx), %rsi
	movq	%rdi, %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rdi
	leaq	8(%rsp), %rbp
	movq	%rdi, 8(%rsp)
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13_S_copy_charsEPcPKcS7_@PLT
	movq	8(%rsp), %rax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	movq	$7, 16(%rsp)
	movb	$0, 7(%rax)
.LEHB0:
	call	_ZNSt13random_device7_M_initERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE@PLT
.LEHE0:
	movq	%rbp, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L20
	jmp	.L22
.L21:
	endbr64
	movq	%rax, %rbx
.L18:
	movq	%rbp, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L22
	movq	%rbx, %rdi
.LEHB1:
	call	_Unwind_Resume@PLT
.LEHE1:
.L22:
	call	__stack_chk_fail@PLT
.L20:
	addq	$56, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4470:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table._ZNSt13random_deviceC2Ev,"aG",@progbits,_ZNSt13random_deviceC5Ev,comdat
.LLSDA4470:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4470-.LLSDACSB4470
.LLSDACSB4470:
	.uleb128 .LEHB0-.LFB4470
	.uleb128 .LEHE0-.LEHB0
	.uleb128 .L21-.LFB4470
	.uleb128 0
	.uleb128 .LEHB1-.LFB4470
	.uleb128 .LEHE1-.LEHB1
	.uleb128 0
	.uleb128 0
.LLSDACSE4470:
	.section	.text._ZNSt13random_deviceC2Ev,"axG",@progbits,_ZNSt13random_deviceC5Ev,comdat
	.size	_ZNSt13random_deviceC2Ev, .-_ZNSt13random_deviceC2Ev
	.weak	_ZNSt13random_deviceC1Ev
	.set	_ZNSt13random_deviceC1Ev,_ZNSt13random_deviceC2Ev
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"vector initialized \n"
	.text
	.globl	_Z13init_ppoint3DRP7point3Di
	.type	_Z13init_ppoint3DRP7point3Di, @function
_Z13init_ppoint3DRP7point3Di:
.LFB5102:
	.cfi_startproc
	endbr64
	movsd	.LC1(%rip), %xmm0
	xorl	%edx, %edx
.L25:
	cmpl	%edx, %esi
	jle	.L27
	imulq	$24, %rdx, %rax
	addq	(%rdi), %rax
	incq	%rdx
	movsd	%xmm0, (%rax)
	movsd	%xmm0, 8(%rax)
	movsd	%xmm0, 16(%rax)
	jmp	.L25
.L27:
	leaq	.LC2(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	jmp	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	.cfi_endproc
.LFE5102:
	.size	_Z13init_ppoint3DRP7point3Di, .-_Z13init_ppoint3DRP7point3Di
	.section	.rodata.str1.1
.LC3:
	.string	"\t"
	.text
	.globl	_Z10print_flagNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi
	.type	_Z10print_flagNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi, @function
_Z10print_flagNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi:
.LFB5103:
	.cfi_startproc
	endbr64
	pushq	%r8
	.cfi_def_cfa_offset 16
	cmpl	$1, %esi
	jne	.L29
	movq	%rdi, %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	popq	%rcx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	movq	%rax, %rdi
	jmp	_ZNSolsEPFRSoS_E.isra.0
.L29:
	.cfi_restore_state
	cmpl	$2, %esi
	jne	.L28
	movq	%rdi, %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	leaq	.LC3(%rip), %rsi
	popq	%rdx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	movq	%rax, %rdi
	jmp	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.L28:
	.cfi_restore_state
	popq	%rax
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE5103:
	.size	_Z10print_flagNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi, .-_Z10print_flagNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi
	.globl	_Z35__device_stub__Z3addP7point3DS0_S0_P7point3DS0_S0_
	.type	_Z35__device_stub__Z3addP7point3DS0_S0_P7point3DS0_S0_, @function
_Z35__device_stub__Z3addP7point3DS0_S0_P7point3DS0_S0_:
.LFB5129:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L32
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z3addP7point3DS0_S0_(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L32:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L34
	call	__stack_chk_fail@PLT
.L34:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE5129:
	.size	_Z35__device_stub__Z3addP7point3DS0_S0_P7point3DS0_S0_, .-_Z35__device_stub__Z3addP7point3DS0_S0_P7point3DS0_S0_
	.globl	_Z3addP7point3DS0_S0_
	.type	_Z3addP7point3DS0_S0_, @function
_Z3addP7point3DS0_S0_:
.LFB5130:
	.cfi_startproc
	endbr64
	jmp	_Z35__device_stub__Z3addP7point3DS0_S0_P7point3DS0_S0_
	.cfi_endproc
.LFE5130:
	.size	_Z3addP7point3DS0_S0_, .-_Z3addP7point3DS0_S0_
	.section	.rodata.str1.1
.LC5:
	.string	"# elements: "
.LC6:
	.string	"size of matrix: "
.LC7:
	.string	"Filling vectors"
.LC9:
	.string	"\n"
.LC10:
	.string	"vectors ready"
.LC11:
	.string	"v"
.LC12:
	.string	"Tiempo total: "
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB5104:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA5104
	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
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$1000, %rsp
	.cfi_def_cfa_offset 5152
	xorl	%edi, %edi
	movq	%fs:40, %rax
	movq	%rax, 5080(%rsp)
	xorl	%eax, %eax
	leaq	80(%rsp), %rbx
	call	time@PLT
	leaq	.LC5(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	movq	%rax, %r15
.LEHB2:
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	$8000000, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	.LC6(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	$192000000, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	24(%rsp), %rdi
	movl	$192000000, %esi
	call	cudaMalloc@PLT
	leaq	32(%rsp), %rdi
	movl	$192000000, %esi
	call	cudaMalloc@PLT
	movl	$192000000, %esi
	leaq	40(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	$192000000, %edi
	call	malloc@PLT
	movl	$192000000, %edi
	movq	%rax, %r14
	call	malloc@PLT
	movl	$192000000, %edi
	movq	%rax, 8(%rsp)
	movq	%rax, %r13
	call	malloc@PLT
	leaq	16(%rsp), %rdi
	movl	$8000000, %esi
	movq	%rax, 16(%rsp)
	movq	%rax, %rbp
	call	_Z13init_ppoint3DRP7point3Di
	leaq	8(%rsp), %rdi
	movl	$8000000, %esi
	call	_Z13init_ppoint3DRP7point3Di
	movq	%rbx, %rdi
	call	_ZNSt13random_deviceC1Ev
.LEHE2:
	movq	%rbx, %rdi
.LEHB3:
	call	_ZNSt13random_device9_M_getvalEv@PLT
.LEHE3:
	movl	$2147483647, %ecx
	xorl	%edx, %edx
	movl	%eax, %eax
	movq	%rbx, %rdi
	divq	%rcx
	movl	$1, %eax
	leaq	24000(%r13), %rbx
	testq	%rdx, %rdx
	cmove	%rax, %rdx
	movq	%rdx, 48(%rsp)
	call	_ZNSt13random_device7_M_finiEv@PLT
	movq	%r13, %r8
	leaq	48(%rsp), %r11
.L38:
	movl	$100, %edx
	movl	$-100, %esi
	movq	%r11, %rdi
	addq	$24, %r8
	call	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE.isra.0
	movl	$100, %edx
	movl	$-100, %esi
	movq	%r11, %rdi
	movl	%eax, %r10d
	call	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE.isra.0
	movl	$100, %edx
	movl	$-100, %esi
	movq	%r11, %rdi
	movl	%eax, %r9d
	call	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE.isra.0
	cvtsi2sdl	%r10d, %xmm0
	movsd	%xmm0, -24(%r8)
	cvtsi2sdl	%r9d, %xmm0
	movsd	%xmm0, -16(%r8)
	cvtsi2sdl	%eax, %xmm0
	movsd	%xmm0, -8(%r8)
	cmpq	%rbx, %r8
	jne	.L38
	leaq	.LC7(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
.LEHB4:
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movsd	.LC4(%rip), %xmm0
	movq	%r14, %rsi
	movsd	.LC8(%rip), %xmm2
	movl	$40000, %edi
	movaps	%xmm0, %xmm4
.L39:
	movsd	.LC4(%rip), %xmm1
	leal	-40000(%rdi), %eax
	movq	%rsi, %rcx
.L43:
	movl	%eax, %ebx
	movaps	%xmm4, %xmm3
	leal	200(%rax), %r8d
	movq	%rcx, %rdx
.L40:
	incl	%ebx
	movsd	%xmm3, 16(%rdx)
	addsd	%xmm2, %xmm3
	addq	$24, %rdx
	movsd	%xmm0, -24(%rdx)
	movsd	%xmm1, -16(%rdx)
	cmpl	%r8d, %ebx
	jne	.L40
	addsd	%xmm2, %xmm1
	addq	$4800, %rcx
	cmpl	%edi, %ebx
	je	.L41
	movl	%ebx, %eax
	jmp	.L43
.L41:
	addsd	%xmm2, %xmm0
	leal	40200(%rax), %edi
	addq	$960000, %rsi
	cmpl	$7999800, %eax
	jne	.L39
	movl	%ebx, %esi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC9(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC10(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	24(%rsp), %rdi
	movl	$1, %ecx
	movq	%r14, %rsi
	movl	$192000000, %edx
	call	cudaMemcpy@PLT
	movq	32(%rsp), %rdi
	movl	$1, %ecx
	movq	%r13, %rsi
	movl	$192000000, %edx
	call	cudaMemcpy@PLT
	movq	40(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbp, %rsi
	movl	$192000000, %edx
	call	cudaMemcpy@PLT
	movl	%ebx, %eax
	movl	$1000, %esi
	xorl	%r9d, %r9d
	cltd
	movl	$536871037, %ecx
	xorl	%r8d, %r8d
	movl	$1, 76(%rsp)
	idivl	%esi
	salq	$3, %rcx
	movq	%rcx, 68(%rsp)
	movq	%rcx, %rdx
	movl	$1, %ecx
	movl	%eax, 56(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 60(%rsp)
	movq	56(%rsp), %rdi
	movl	64(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L44
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	movq	24(%rsp), %rdi
	call	_Z35__device_stub__Z3addP7point3DS0_S0_P7point3DS0_S0_
.L44:
	movq	40(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbp, %rdi
	movq	%rbp, %r12
	movl	$192000000, %edx
	leaq	192000000(%rbp), %rbx
	call	cudaMemcpy@PLT
	movsd	.LC1(%rip), %xmm1
.L49:
	ucomisd	(%r12), %xmm1
	jp	.L54
	je	.L45
.L54:
	ucomisd	8(%r12), %xmm1
	jp	.L55
	je	.L45
.L55:
	ucomisd	16(%r12), %xmm1
	jp	.L56
	je	.L45
.L56:
	leaq	.LC11(%rip), %rsi
	leaq	mb_file(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	(%r12), %xmm0
	movq	%rax, %rdi
	movq	(%rax), %rax
	movq	-24(%rax), %rax
	movq	$15, 16(%rdi,%rax)
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movsd	8(%r12), %xmm0
	movq	%rax, %rdi
	movq	(%rax), %rax
	movq	-24(%rax), %rax
	movq	$15, 16(%rdi,%rax)
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movsd	16(%r12), %xmm0
	movq	%rax, %rdi
	movq	(%rax), %rax
	movq	-24(%rax), %rax
	movq	$15, 16(%rdi,%rax)
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movsd	.LC1(%rip), %xmm1
.L45:
	addq	$24, %r12
	cmpq	%r12, %rbx
	jne	.L49
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	%r14, %rdi
	call	free@PLT
	movq	%r13, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	leaq	mb_file(%rip), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
	xorl	%edi, %edi
	call	time@PLT
	leaq	.LC12(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	movq	%rax, %rbp
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r15, %rsi
	movq	%rbp, %rdi
	movq	%rax, %rbx
	call	difftime@PLT
	movq	%rbx, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.LEHE4:
	movq	5080(%rsp), %rax
	subq	%fs:40, %rax
	je	.L52
	jmp	.L60
.L53:
	endbr64
	movq	%rax, %rbp
.L50:
	movq	%rbx, %rdi
	call	_ZNSt13random_device7_M_finiEv@PLT
	movq	5080(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L60
	movq	%rbp, %rdi
.LEHB5:
	call	_Unwind_Resume@PLT
.LEHE5:
.L60:
	call	__stack_chk_fail@PLT
.L52:
	addq	$5096, %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
.LFE5104:
	.section	.gcc_except_table,"a",@progbits
.LLSDA5104:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE5104-.LLSDACSB5104
.LLSDACSB5104:
	.uleb128 .LEHB2-.LFB5104
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB3-.LFB5104
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L53-.LFB5104
	.uleb128 0
	.uleb128 .LEHB4-.LFB5104
	.uleb128 .LEHE4-.LEHB4
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB5-.LFB5104
	.uleb128 .LEHE5-.LEHB5
	.uleb128 0
	.uleb128 0
.LLSDACSE5104:
	.section	.text.startup
	.size	main, .-main
	.section	.rodata.str1.1
.LC13:
	.string	"_Z3addP7point3DS0_S0_"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB5132:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 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	.LC13(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z3addP7point3DS0_S0_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	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	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE5132:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata.str1.1
.LC14:
	.string	"data.obj"
	.section	.text.startup
	.type	_GLOBAL__sub_I_v_point, @function
_GLOBAL__sub_I_v_point:
.LFB5902:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	xorl	%edx, %edx
	leaq	_ZNSt6vectorI7point3DSaIS0_EED1Ev(%rip), %rbp
	leaq	v_point(%rip), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	__dso_handle(%rip), %rbx
	movq	%rbp, %rdi
	pushq	%rax
	.cfi_def_cfa_offset 32
	movq	%rdx, v_point(%rip)
	movq	%rdx, 8+v_point(%rip)
	movq	%rdx, 16+v_point(%rip)
	movq	%rbx, %rdx
	call	__cxa_atexit@PLT
	xorl	%ecx, %ecx
	movq	%rbx, %rdx
	movq	%rbp, %rdi
	leaq	v_circles(%rip), %rsi
	leaq	mb_file(%rip), %rbp
	movq	%rcx, v_circles(%rip)
	movq	%rcx, 8+v_circles(%rip)
	movq	%rcx, 16+v_circles(%rip)
	call	__cxa_atexit@PLT
	movq	%rbp, %rdi
	movl	$16, %edx
	leaq	.LC14(%rip), %rsi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
	movq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@GOTPCREL(%rip), %rdi
	movq	%rbx, %rdx
	popq	%r8
	.cfi_def_cfa_offset 24
	movq	%rbp, %rsi
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	__cxa_atexit@PLT
	.cfi_endproc
.LFE5902:
	.size	_GLOBAL__sub_I_v_point, .-_GLOBAL__sub_I_v_point
	.section	.init_array
	.align 8
	.quad	_GLOBAL__sub_I_v_point
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.globl	mb_file
	.bss
	.align 32
	.type	mb_file, @object
	.size	mb_file, 512
mb_file:
	.zero	512
	.globl	v_circles
	.align 16
	.type	v_circles, @object
	.size	v_circles, 24
v_circles:
	.zero	24
	.globl	v_point
	.align 16
	.type	v_point, @object
	.size	v_point, 24
v_point:
	.zero	24
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	-1074790400
	.align 8
.LC4:
	.long	0
	.long	-1067909120
	.align 8
.LC8:
	.long	0
	.long	1072693248
	.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
	.hidden	__dso_handle
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <iostream>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <math.h>
#include <vector>
#include <fstream>
#include "random"

#define space 15

#define dim1 100		//X 	 
#define dim2 100 	//Y
#define dim3 100 	//Z

#define N ( 100000 )
#define M ( 512 )

#define incr 1

#define rad_circles 1
#define num_circles 1000

#define FOR(i,n,inc) for( i = -n; i < n; i=i+inc)

//int idx_radius = 0;

using namespace std;

struct point3D{
	
	double x, y,z;
	point3D( double _x, double _y, double _z){
		x = _x;
		y = _y;
		z = _z;
	}
};

vector<point3D> v_point;	//vector of points
vector<point3D> v_circles;	//vector of circles' center
ofstream mb_file("data.obj");

//double thresh = 0.5;

__global__ void add( point3D* points, point3D* circles, point3D* intersection){
	
	int index = threadIdx.x + blockIdx.x*blockDim.x;

	//if( circles[index].x != -1 && circles[index].y != -1 && circles[index].z != -1 ){

	double sum = 0.0;//, sum2 = 0.0;

	double dif_x, dif_y, dif_z, value=0.0, thresh = 0.2;

	for( int i = 0 ; i < num_circles; i++){
			
		dif_x = (points[index].x - circles[i].x);
		dif_y = (points[index].y - circles[i].y);
		dif_z = (points[index].z - circles[i].z);

		//printf("%f %f %f %c", points[index].x, points[index].y, points[index].z, '\n');
		
		value = sqrt( dif_x*dif_x + dif_y*dif_y + dif_z*dif_z );

		//sum = value * value;
		//printf("%d\n", value);
		
		if( value <= rad_circles ){

			value = 1 - ( (value*value) / (rad_circles*rad_circles) );			

			sum = sum + (value * value);			

			if( sum > thresh ){
				intersection[index].x = points[index].x;
				intersection[index].y = points[index].y;
				intersection[index].z = points[index].z;
			}	
		}

		/*dif_x = intersection[index].x - circles[i].x;
		dif_y = intersection[index].y - circles[i].y;
		dif_z = intersection[index].z - circles[i].z;

		value = sqrt( dif_x*dif_x + dif_y*dif_y + dif_z*dif_z );

		if( value <= rad_circles ){

			value = 1 - ( (value * value) / (rad_circles * rad_circles) );			
			value = value * value;
			
			sum2 = sum2 + (value * value);			

			if( sum > thresh  ){				
			}
			else{
				intersection[index].x = intersection[index].y = intersection[index].z = -1;
			}
		}
*/

	}
/*
	sum = 0.0;

	for( int i = 1 ; i < num_circles; i++){
		dif_x = circles[i-1].x - circles[i].x;
		dif_y = circles[i-1].y - circles[i].y;
		dif_z = circles[i-1].z - circles[i].z;

		value = sqrt( dif_x*dif_x + dif_y*dif_y + dif_z*dif_z );

		if( value < rad_circles ){

			value = 1 - ( (value * value) / (rad_circles * rad_circles) );			
			value = value * value;
			
			sum = sum + (value * value);			

			if( sum < thresh - 0.48 ){
				intersection[index].x = points[index].x;
				intersection[index].y = points[index].y;
				intersection[index].z = points[index].z;
			}
		}
	}	
	*/
}

void init_ppoint3D( point3D*& points, int size ){
	for( int i = 0; i < size; i++){
		points[i] = point3D( -1, -1, -1);
	}
	cout << "vector initialized \n";
}

void print_flag( string message, int type){
	if( type == 1) cout << message << endl;
	else if( type == 2) cout << message << "\t";
}

int main(void){

	time_t timer = time(0);	

	point3D *points, *circles, *intersections;				// host copies of a,b,c
	point3D *d_points, *d_circles, *d_intersections;		// device copies of a,b,c


	//If index starts with negative number, first line
	//int size_matrix = ( 2 * dim1 ) * ( 2 * dim2 ) * ( 2 * dim3 ) * (
	//int size_matrix = ( dim1/incr ) * ( dim2/incr ) * ( dim3/incr ); // number of elements
	int size_matrix = 8 * ( dim1/incr ) * ( dim2/incr ) * ( dim3/incr );
	cout << "# elements: " << size_matrix << endl;
	
	int size = size_matrix * sizeof(point3D);
	cout << "size of matrix: " << size << endl;

	// Allocate space for device copies of a,b,c
	hipMalloc( (void **)&d_points, size);
	hipMalloc( (void **)&d_circles, size_matrix * sizeof(point3D) );
	hipMalloc( (void **)&d_intersections, size);	

	// Alloc space for host copies of a,b,c and setup input
	points   	  = (point3D *)malloc(size);
	circles 	  = (point3D *)malloc(size_matrix * sizeof(point3D));
	intersections = (point3D *)malloc(size);	

	init_ppoint3D( intersections, size_matrix);

	/*    default_random_engine rng( random_device{}() ); 
    uniform_int_distribution<int> dist(-dim1, dim1); 
	*/

    init_ppoint3D( circles, size_matrix);

    //int position = dim1 / num_circles;
/*
    circles[0] = point3D( -4, -4, -4);
    circles[1] = point3D( -1.5, -3, -1.4);

    //circles[0] = point3D( -6, -6, -6);
	//circles[1] = point3D( -8, -8,  0);
    circles[2] = point3D( -6,  -6, -6);
    circles[3] = point3D( -8,  0,  0);
    
    circles[4] = point3D(  0, -8, -8);
    circles[5] = point3D(  0, -8,  0);
    circles[6] = point3D(  0,  0, -8);
    circles[7] = point3D(  0,  0,  0);
  */ 

	default_random_engine rng( random_device{}() ); 
    uniform_int_distribution<int> dist(-dim1, dim1); 
	
	for( int i = 0 ; i < num_circles; i++){
		int xr, yr, zr;
		xr = dist(rng);
		yr = dist(rng);
		zr = dist(rng);

    	circles[i] = point3D( xr, yr, zr);
	}

    /*for( int i = 0 ; i < num_circles ; i++){
		circles[i].x = i;
		circles[i].y = i;
		circles[i].z = i;
	}
	*/
    int index = 0;
    
    cout << "Filling vectors" << endl;


	
	for( double i = -dim1 ; i < dim1 ; i=i+incr){
		for( double j = -dim2 ; j < dim2 ; j=j+incr){
			for( double k = -dim3 ; k < dim3 ; k=k+incr){
				
			 	points[index].x = i ;
				points[index].y = j ;
				points[index].z = k ;

				//printf("%f %f %f %c", points[index].x, points[index].y, points[index].z, '\n');

				//mb_file << "v" << setw(space) << (double)a[index].x << setw(space) << (double)a[index].y << setw(space) << (double)a[index].z << endl;  				
				//mb_file << "v" << setw(space) << (double)b[index].x << setw(space) << (double)b[index].y << setw(space) << (double)b[index].z << endl;  				
				//cout << index <<"\n";
				index++;
			}		
		}
	}

	cout << index <<"\n";
	cout << "vectors ready" << endl;

	int cocient = 1000;
	int num_blocks = index / cocient;
	int num_threadsxblock = cocient; 

	// Copy inputs to device
	hipMemcpy(d_points, points, size, hipMemcpyHostToDevice);  // Args: Dir. destino, Dir. origen, tamano de dato, sentido del envio
	hipMemcpy(d_circles, circles, size, hipMemcpyHostToDevice);
	hipMemcpy(d_intersections, intersections, size, hipMemcpyHostToDevice);	

	// Launch add() kernel on GPU
	//for( int i = 0 ; i < num_circles; i++){
	add<<< num_blocks, num_threadsxblock>>> (d_points, d_circles, d_intersections);
	//}
	
	// Copy result back to host
	hipMemcpy(intersections, d_intersections, size, hipMemcpyDeviceToHost);
/*	
	for(int i=0; i < size_matrix; ++i){
		std::cout << setw(space) << a[i].x << setw(space) << a[i].y << setw(space) << a[i].z << endl ;
	}

	std::cout << std::endl;

	for(int i=0; i < size_matrix; ++i){
		std::cout << setw(space) << b[i].x << setw(space) << b[i].y << setw(space) << b[i].z << endl ;
	}

	std::cout << std::endl;

	for(int i=0; i < size_matrix; ++i){
		std::cout << setw(space) << c[i].x << setw(space) << c[i].y << setw(space) << c[i].z << endl ;
	}

	std::cout << std::endl;

	for(int i=0; i < size_matrix; ++i){
		std::cout << setw(space) << d[i].x << setw(space) << d[i].y << setw(space) << d[i].z << endl ;
	}

	std::cout << std::endl;
*/

	for(int i = 0; i < size_matrix; ++i){
		if( intersections[i].x != -1 && intersections[i].y != -1 && intersections[i].z != -1 ){
			mb_file << "v" << setw(space) << intersections[i].x << setw(space) << intersections[i].y << setw(space) << intersections[i].z << endl ;
		}
	}

	cout << std::endl;

	// Cleanup
	free(points);
	free(circles);
	free(intersections);
	hipFree(d_points);
	hipFree(d_circles);
	hipFree(d_intersections);

	mb_file.close();

	time_t timer2 = time(0);
	cout <<"Tiempo total: " << difftime(timer2, timer) << endl;

	return 0;
}

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

                                        # End of file scope inline assembly
	.section	.text._ZNSt6vectorI7point3DSaIS0_EED2Ev,"axG",@progbits,_ZNSt6vectorI7point3DSaIS0_EED2Ev,comdat
	.weak	_ZNSt6vectorI7point3DSaIS0_EED2Ev # -- Begin function _ZNSt6vectorI7point3DSaIS0_EED2Ev
	.p2align	1, 0x90
	.type	_ZNSt6vectorI7point3DSaIS0_EED2Ev,@function
_ZNSt6vectorI7point3DSaIS0_EED2Ev:      # @_ZNSt6vectorI7point3DSaIS0_EED2Ev
	.cfi_startproc
# %bb.0:
	movq	(%rdi), %rdi
	testq	%rdi, %rdi
	jne	_ZdlPv                          # TAILCALL
# %bb.1:                                # %_ZNSt12_Vector_baseI7point3DSaIS0_EED2Ev.exit
	retq
.Lfunc_end0:
	.size	_ZNSt6vectorI7point3DSaIS0_EED2Ev, .Lfunc_end0-_ZNSt6vectorI7point3DSaIS0_EED2Ev
	.cfi_endproc
                                        # -- End function
	.text
	.globl	_Z18__device_stub__addP7point3DS0_S0_ # -- Begin function _Z18__device_stub__addP7point3DS0_S0_
	.type	_Z18__device_stub__addP7point3DS0_S0_,@function
_Z18__device_stub__addP7point3DS0_S0_:  # @_Z18__device_stub__addP7point3DS0_S0_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z3addP7point3DS0_S0_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z18__device_stub__addP7point3DS0_S0_, .Lfunc_end1-_Z18__device_stub__addP7point3DS0_S0_
	.cfi_endproc
                                        # -- End function
	.globl	_Z13init_ppoint3DRP7point3Di    # -- Begin function _Z13init_ppoint3DRP7point3Di
	.type	_Z13init_ppoint3DRP7point3Di,@function
_Z13init_ppoint3DRP7point3Di:           # @_Z13init_ppoint3DRP7point3Di
	.cfi_startproc
# %bb.0:
	testl	%esi, %esi
	jle	.LBB2_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%esi, %eax
	shlq	$3, %rax
	leaq	(%rax,%rax,2), %rax
	xorl	%ecx, %ecx
	movabsq	$-4616189618054758400, %rdx     # imm = 0xBFF0000000000000
.LBB2_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	(%rdi), %rsi
	movq	%rdx, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	movq	%rdx, 16(%rsi,%rcx)
	addq	$24, %rcx
	cmpq	%rcx, %rax
	jne	.LBB2_2
.LBB2_3:                                # %._crit_edge
	movl	$_ZSt4cout, %edi
	movl	$.L.str.3, %esi
	movl	$20, %edx
	jmp	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l # TAILCALL
.Lfunc_end2:
	.size	_Z13init_ppoint3DRP7point3Di, .Lfunc_end2-_Z13init_ppoint3DRP7point3Di
	.cfi_endproc
                                        # -- End function
	.globl	_Z10print_flagNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi # -- Begin function _Z10print_flagNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi
	.type	_Z10print_flagNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi,@function
_Z10print_flagNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi: # @_Z10print_flagNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	cmpl	$2, %esi
	je	.LBB3_3
# %bb.1:
	cmpl	$1, %esi
	jne	.LBB3_4
# %bb.2:
	movq	(%rdi), %rsi
	movq	8(%rdi), %rdx
	movl	$_ZSt4cout, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	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
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	_ZNSo5flushEv                   # TAILCALL
.LBB3_3:
	.cfi_def_cfa_offset 16
	movq	(%rdi), %rsi
	movq	8(%rdi), %rdx
	movl	$_ZSt4cout, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$.L.str.4, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l # TAILCALL
.LBB3_4:
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z10print_flagNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi, .Lfunc_end3-_Z10print_flagNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI4_0:
	.quad	0xc059000000000000              # double -100
.LCPI4_1:
	.quad	0x3ff0000000000000              # double 1
.LCPI4_2:
	.quad	0xbff0000000000000              # double -1
	.text
	.globl	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	$5064, %rsp                     # imm = 0x13C8
	.cfi_def_cfa_offset 5120
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	xorl	%edi, %edi
	callq	time
	movq	%rax, %r15
	movl	$_ZSt4cout, %edi
	movl	$.L.str.5, %esi
	movl	$12, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	$8000000, %esi                  # imm = 0x7A1200
	callq	_ZNSolsEi
	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
	movl	$16, %r14d
	movl	$_ZSt4cout, %edi
	movl	$.L.str.6, %esi
	movl	$16, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	$192000000, %esi                # imm = 0xB71B000
	callq	_ZNSolsEi
	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
	leaq	32(%rsp), %rdi
	movl	$192000000, %esi                # imm = 0xB71B000
	callq	hipMalloc
	leaq	24(%rsp), %rdi
	movl	$192000000, %esi                # imm = 0xB71B000
	callq	hipMalloc
	leaq	8(%rsp), %rdi
	movl	$192000000, %esi                # imm = 0xB71B000
	callq	hipMalloc
	movl	$192000000, %edi                # imm = 0xB71B000
	callq	malloc
	movq	%rax, %r13
	movq	%rax, %r12
	movl	$192000000, %edi                # imm = 0xB71B000
	callq	malloc
	movq	%rax, %rbp
	movl	$192000000, %edi                # imm = 0xB71B000
	callq	malloc
	movabsq	$-4616189618054758400, %rbx     # imm = 0xBFF0000000000000
.LBB4_1:                                # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	movq	%rbx, -16(%rax,%r14)
	movq	%rbx, -8(%rax,%r14)
	movq	%rbx, (%rax,%r14)
	addq	$24, %r14
	cmpq	$192000016, %r14                # imm = 0xB71B010
	jne	.LBB4_1
# %bb.2:                                # %_Z13init_ppoint3DRP7point3Di.exit
	movq	%rax, (%rsp)                    # 8-byte Spill
	movl	$_ZSt4cout, %edi
	movl	$.L.str.3, %esi
	movl	$20, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$16, %eax
.LBB4_3:                                # %.lr.ph.i68
                                        # =>This Inner Loop Header: Depth=1
	movq	%rbx, -16(%rbp,%rax)
	movq	%rbx, -8(%rbp,%rax)
	movq	%rbx, (%rbp,%rax)
	addq	$24, %rax
	cmpq	$192000016, %rax                # imm = 0xB71B010
	jne	.LBB4_3
# %bb.4:                                # %_Z13init_ppoint3DRP7point3Di.exit74
	movl	$_ZSt4cout, %edi
	movl	$.L.str.3, %esi
	movl	$20, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	leaq	64(%rsp), %rbx
	movq	%rbx, %rdi
	callq	_ZNSt13random_deviceC2Ev
.Ltmp0:
	movq	%rbx, %rdi
	callq	_ZNSt13random_device9_M_getvalEv
                                        # kill: def $eax killed $eax def $rax
.Ltmp1:
# %bb.5:
	movq	%rbp, 16(%rsp)                  # 8-byte Spill
	movq	%r12, 40(%rsp)                  # 8-byte Spill
	movq	%r15, 48(%rsp)                  # 8-byte Spill
	movl	%eax, %ecx
	leaq	(%rcx,%rcx,2), %rcx
	shrq	$32, %rcx
	movl	%eax, %edx
	subl	%ecx, %edx
	shrl	%edx
	addl	%ecx, %edx
	shrl	$30, %edx
	movl	%edx, %ecx
	shll	$31, %ecx
	orl	%edx, %ecx
	leal	(%rax,%rcx), %edx
	cmpl	$1, %edx
	adcl	%eax, %ecx
	movq	%rcx, 56(%rsp)
.Ltmp6:
	leaq	64(%rsp), %rdi
	callq	_ZNSt13random_device7_M_finiEv
.Ltmp7:
# %bb.6:                                # %_ZNSt13random_deviceD2Ev.exit
	movabsq	$433791696796, %rax             # imm = 0x64FFFFFF9C
	leaq	64(%rsp), %rcx
	movq	%rax, (%rcx)
	movl	$16, %r15d
.LBB4_7:                                # =>This Inner Loop Header: Depth=1
	leaq	64(%rsp), %rbx
	movq	%rbx, %rdi
	leaq	56(%rsp), %rbp
	movq	%rbp, %rsi
	movq	%rbx, %rdx
	callq	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE
	movl	%eax, %r14d
	movq	%rbx, %rdi
	movq	%rbp, %rsi
	movq	%rbx, %rdx
	callq	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE
	movl	%eax, %r12d
	movq	%rbx, %rdi
	movq	%rbp, %rsi
	movq	%rbx, %rdx
	callq	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE
	xorps	%xmm0, %xmm0
	cvtsi2sd	%r14d, %xmm0
	xorps	%xmm1, %xmm1
	cvtsi2sd	%r12d, %xmm1
	xorps	%xmm2, %xmm2
	cvtsi2sd	%eax, %xmm2
	movq	16(%rsp), %rax                  # 8-byte Reload
	movsd	%xmm0, -16(%rax,%r15)
	movsd	%xmm1, -8(%rax,%r15)
	movsd	%xmm2, (%rax,%r15)
	addq	$24, %r15
	cmpq	$24016, %r15                    # imm = 0x5DD0
	jne	.LBB4_7
# %bb.8:
	movl	$_ZSt4cout, %ebx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.7, %esi
	movl	$15, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	addq	$16, %r13
	movl	$-100, %eax
	movsd	.LCPI4_0(%rip), %xmm0           # xmm0 = mem[0],zero
	xorl	%ecx, %ecx
	movsd	.LCPI4_1(%rip), %xmm1           # xmm1 = mem[0],zero
	movapd	%xmm0, %xmm2
	movq	48(%rsp), %r15                  # 8-byte Reload
.LBB4_9:                                # %.preheader91
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_10 Depth 2
                                        #       Child Loop BB4_11 Depth 3
	movapd	%xmm0, %xmm3
	movl	$-100, %esi
.LBB4_10:                               # %.preheader
                                        #   Parent Loop BB4_9 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB4_11 Depth 3
	movq	%rcx, %rbp
	movslq	%ebp, %rcx
	leaq	(%rcx,%rcx,2), %rdx
	leaq	(,%rdx,8), %rdi
	addq	%r13, %rdi
	xorl	%edx, %edx
	movapd	%xmm0, %xmm4
.LBB4_11:                               #   Parent Loop BB4_9 Depth=1
                                        #     Parent Loop BB4_10 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movsd	%xmm2, -16(%rdi)
	movsd	%xmm3, -8(%rdi)
	movsd	%xmm4, (%rdi)
	incq	%rcx
	addsd	%xmm1, %xmm4
	addq	$24, %rdi
	decl	%edx
	cmpl	$-200, %edx
	jne	.LBB4_11
# %bb.12:                               #   in Loop: Header=BB4_10 Depth=2
	addsd	%xmm1, %xmm3
	incl	%esi
	cmpl	$100, %esi
	jne	.LBB4_10
# %bb.13:                               #   in Loop: Header=BB4_9 Depth=1
	addsd	%xmm1, %xmm2
	incl	%eax
	cmpl	$100, %eax
	jne	.LBB4_9
# %bb.14:
	subl	%edx, %ebp
	movl	$_ZSt4cout, %ebx
	movl	$_ZSt4cout, %edi
	movl	%ebp, %esi
	callq	_ZNSolsEi
	movl	$.L.str.8, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	$.L.str.9, %esi
	movl	$13, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movslq	%ebp, %rax
	imulq	$274877907, %rax, %r13          # imm = 0x10624DD3
	movq	%r13, %rax
	shrq	$63, %rax
	sarq	$38, %r13
	addl	%eax, %r13d
	movq	32(%rsp), %rdi
	movl	$192000000, %edx                # imm = 0xB71B000
	movq	40(%rsp), %rbp                  # 8-byte Reload
	movq	%rbp, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	24(%rsp), %rdi
	movl	$192000000, %edx                # imm = 0xB71B000
	movq	16(%rsp), %rsi                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	movq	8(%rsp), %rdi
	movl	$192000000, %edx                # imm = 0xB71B000
	movq	(%rsp), %rbx                    # 8-byte Reload
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	btsq	$32, %r13
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$1000, %rdx                     # imm = 0x3E8
	movq	%r13, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_16
# %bb.15:
	movq	32(%rsp), %rdi
	movq	24(%rsp), %rsi
	movq	8(%rsp), %rdx
	callq	_Z18__device_stub__addP7point3DS0_S0_
.LBB4_16:
	movq	8(%rsp), %rsi
	movl	$192000000, %edx                # imm = 0xB71B000
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	$16, %r14d
	movsd	.LCPI4_2(%rip), %xmm1           # xmm1 = mem[0],zero
	movl	$15, %r12d
.LBB4_17:                               # =>This Inner Loop Header: Depth=1
	movsd	-16(%rbx,%r14), %xmm0           # xmm0 = mem[0],zero
	ucomisd	%xmm1, %xmm0
	jne	.LBB4_18
	jnp	.LBB4_21
.LBB4_18:                               #   in Loop: Header=BB4_17 Depth=1
	movsd	-8(%rbx,%r14), %xmm0            # xmm0 = mem[0],zero
	ucomisd	%xmm1, %xmm0
	jne	.LBB4_19
	jnp	.LBB4_21
.LBB4_19:                               #   in Loop: Header=BB4_17 Depth=1
	movsd	(%rbx,%r14), %xmm0              # xmm0 = mem[0],zero
	ucomisd	%xmm1, %xmm0
	jne	.LBB4_20
	jnp	.LBB4_21
.LBB4_20:                               #   in Loop: Header=BB4_17 Depth=1
	movl	$mb_file, %edi
	movl	$.L.str.10, %esi
	movl	$1, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	mb_file(%rip), %rax
	movq	-24(%rax), %rax
	movq	%r12, mb_file+16(%rax)
	movq	(%rsp), %rax                    # 8-byte Reload
	movsd	-16(%rax,%r14), %xmm0           # xmm0 = mem[0],zero
	movl	$mb_file, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	movq	%r12, 16(%rax,%rcx)
	movq	(%rsp), %rcx                    # 8-byte Reload
	movsd	-8(%rcx,%r14), %xmm0            # xmm0 = mem[0],zero
	movq	%rax, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	movq	%r12, 16(%rax,%rcx)
	movq	(%rsp), %rcx                    # 8-byte Reload
	movsd	(%rcx,%r14), %xmm0              # xmm0 = mem[0],zero
	movq	%rax, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	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
	movsd	.LCPI4_2(%rip), %xmm1           # xmm1 = mem[0],zero
	movq	(%rsp), %rbx                    # 8-byte Reload
.LBB4_21:                               #   in Loop: Header=BB4_17 Depth=1
	addq	$24, %r14
	cmpq	$192000016, %r14                # imm = 0xB71B010
	jne	.LBB4_17
# %bb.22:
	movq	_ZSt4cout(%rip), %rax
	movl	$_ZSt4cout, %ecx
	movq	-24(%rax), %rdi
	addq	%rcx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%rbp, %rdi
	callq	free
	movq	16(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	%rbx, %rdi
	callq	free
	movq	32(%rsp), %rdi
	callq	hipFree
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movl	$mb_file, %edi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
	xorl	%edi, %edi
	callq	time
	movq	%rax, %rbx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.11, %esi
	movl	$14, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	difftime
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	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
	xorl	%eax, %eax
	addq	$5064, %rsp                     # imm = 0x13C8
	.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_23:
	.cfi_def_cfa_offset 5120
.Ltmp8:
	jmp	.LBB4_27
.LBB4_24:
.Ltmp2:
	movq	%rax, %rbx
.Ltmp3:
	leaq	64(%rsp), %rdi
	callq	_ZNSt13random_device7_M_finiEv
.Ltmp4:
# %bb.25:                               # %_ZNSt13random_deviceD2Ev.exit75
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.LBB4_26:
.Ltmp5:
.LBB4_27:
	movq	%rax, %rdi
	callq	__clang_call_terminate
.Lfunc_end4:
	.size	main, .Lfunc_end4-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table4:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	3                               # @TType Encoding = udata4
	.uleb128 .Lttbase0-.Lttbaseref0
.Lttbaseref0:
	.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 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp2-.Lfunc_begin0           #     jumps to .Ltmp2
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp6-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp7-.Ltmp6                  #   Call between .Ltmp6 and .Ltmp7
	.uleb128 .Ltmp8-.Lfunc_begin0           #     jumps to .Ltmp8
	.byte	1                               #   On action: 1
	.uleb128 .Ltmp7-.Lfunc_begin0           # >> Call Site 4 <<
	.uleb128 .Ltmp3-.Ltmp7                  #   Call between .Ltmp7 and .Ltmp3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp3-.Lfunc_begin0           # >> Call Site 5 <<
	.uleb128 .Ltmp4-.Ltmp3                  #   Call between .Ltmp3 and .Ltmp4
	.uleb128 .Ltmp5-.Lfunc_begin0           #     jumps to .Ltmp5
	.byte	1                               #   On action: 1
	.uleb128 .Ltmp4-.Lfunc_begin0           # >> Call Site 6 <<
	.uleb128 .Lfunc_end4-.Ltmp4             #   Call between .Ltmp4 and .Lfunc_end4
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.byte	1                               # >> Action Record 1 <<
                                        #   Catch TypeInfo 1
	.byte	0                               #   No further actions
	.p2align	2, 0x0
                                        # >> Catch TypeInfos <<
	.long	0                               # TypeInfo 1
.Lttbase0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt13random_deviceC2Ev,"axG",@progbits,_ZNSt13random_deviceC2Ev,comdat
	.weak	_ZNSt13random_deviceC2Ev        # -- Begin function _ZNSt13random_deviceC2Ev
	.p2align	1, 0x90
	.type	_ZNSt13random_deviceC2Ev,@function
_ZNSt13random_deviceC2Ev:               # @_ZNSt13random_deviceC2Ev
.Lfunc_begin1:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception1
# %bb.0:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.exit
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %rbx
	leaq	16(%rsp), %r15
	movq	%r15, -16(%r15)
	movq	%rsp, %r14
	movl	$.L.str.12, %esi
	movl	$.L.str.12+7, %edx
	movq	%r14, %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
.Ltmp9:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_ZNSt13random_device7_M_initERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
.Ltmp10:
# %bb.1:
	movq	(%rsp), %rdi
	cmpq	%r15, %rdi
	je	.LBB5_3
# %bb.2:                                # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB5_3:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	addq	$32, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.LBB5_4:
	.cfi_def_cfa_offset 64
.Ltmp11:
	movq	%rax, %rbx
	movq	(%rsp), %rdi
	cmpq	%r15, %rdi
	je	.LBB5_6
# %bb.5:                                # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i4
	callq	_ZdlPv
.LBB5_6:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit6
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end5:
	.size	_ZNSt13random_deviceC2Ev, .Lfunc_end5-_ZNSt13random_deviceC2Ev
	.cfi_endproc
	.section	.gcc_except_table._ZNSt13random_deviceC2Ev,"aG",@progbits,_ZNSt13random_deviceC2Ev,comdat
	.p2align	2, 0x0
GCC_except_table5:
.Lexception1:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end1-.Lcst_begin1
.Lcst_begin1:
	.uleb128 .Lfunc_begin1-.Lfunc_begin1    # >> Call Site 1 <<
	.uleb128 .Ltmp9-.Lfunc_begin1           #   Call between .Lfunc_begin1 and .Ltmp9
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp9-.Lfunc_begin1           # >> Call Site 2 <<
	.uleb128 .Ltmp10-.Ltmp9                 #   Call between .Ltmp9 and .Ltmp10
	.uleb128 .Ltmp11-.Lfunc_begin1          #     jumps to .Ltmp11
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp10-.Lfunc_begin1          # >> Call Site 3 <<
	.uleb128 .Lfunc_end5-.Ltmp10            #   Call between .Ltmp10 and .Lfunc_end5
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end1:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	subq	%rsi, %r14
	movq	%r14, (%rsp)
	cmpq	$15, %r14
	jbe	.LBB6_1
# %bb.2:
	movq	%rsp, %r12
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm
	movq	%rax, (%rbx)
	movq	(%r12), %rcx
	movq	%rcx, 16(%rbx)
	jmp	.LBB6_3
.LBB6_1:                                # %._crit_edge
	movq	(%rbx), %rax
.LBB6_3:
	testq	%r14, %r14
	je	.LBB6_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB6_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB6_7
.LBB6_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB6_7:                                # %_ZZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tagEN6_GuardD2Ev.exit
	movq	(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	(%rbx), %rcx
	movb	$0, (%rcx,%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag, .Lfunc_end6-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_endproc
                                        # -- End function
	.section	.text.__clang_call_terminate,"axG",@progbits,__clang_call_terminate,comdat
	.hidden	__clang_call_terminate          # -- Begin function __clang_call_terminate
	.weak	__clang_call_terminate
	.type	__clang_call_terminate,@function
__clang_call_terminate:                 # @__clang_call_terminate
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__cxa_begin_catch
	callq	_ZSt9terminatev
.Lfunc_end7:
	.size	__clang_call_terminate, .Lfunc_end7-__clang_call_terminate
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE,"axG",@progbits,_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE,comdat
	.weak	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE # -- Begin function _ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE
	.p2align	1, 0x90
	.type	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE,@function
_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE: # @_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movslq	4(%rdx), %rbp
	movslq	(%rdx), %rdi
	subq	%rdi, %rbp
	cmpq	$2147483644, %rbp               # imm = 0x7FFFFFFC
	ja	.LBB8_4
# %bb.1:
	incq	%rbp
	movl	$2147483645, %eax               # imm = 0x7FFFFFFD
	xorl	%edx, %edx
	divl	%ebp
	movl	%eax, %ecx
	imulq	%rcx, %rbp
	movq	(%rbx), %rdx
	movabsq	$8589934597, %r8                # imm = 0x200000005
.LBB8_2:                                # =>This Inner Loop Header: Depth=1
	imulq	$16807, %rdx, %rsi              # imm = 0x41A7
	movq	%rsi, %rax
	mulq	%r8
	movq	%rsi, %rax
	subq	%rdx, %rax
	shrq	%rax
	addq	%rdx, %rax
	shrq	$30, %rax
	movq	%rax, %rdx
	shlq	$31, %rdx
	subq	%rdx, %rax
	leaq	(%rsi,%rax), %rdx
	addq	%rsi, %rax
	decq	%rax
	cmpq	%rbp, %rax
	jae	.LBB8_2
# %bb.3:
	movq	%rdx, (%rbx)
	xorl	%edx, %edx
	divq	%rcx
	jmp	.LBB8_9
.LBB8_4:
	cmpq	$2147483645, %rbp               # imm = 0x7FFFFFFD
	jne	.LBB8_5
# %bb.10:
	imulq	$16807, (%rbx), %rcx            # imm = 0x41A7
	movabsq	$8589934597, %rdx               # imm = 0x200000005
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	shrq	%rax
	addq	%rdx, %rax
	shrq	$30, %rax
	movq	%rax, %rdx
	shlq	$31, %rdx
	subq	%rdx, %rax
	leaq	(%rcx,%rax), %rdx
	movq	%rdx, (%rbx)
	addq	%rcx, %rax
	decq	%rax
	jmp	.LBB8_9
.LBB8_5:                                # %.preheader
	movq	%rdx, 16(%rsp)                  # 8-byte Spill
	movq	%rbp, %rax
	shrq	%rax
	movabsq	$-9223372028264841207, %rcx     # imm = 0x8000000200000009
	mulq	%rcx
	movq	%rdx, %r12
	shrq	$29, %r12
	leaq	8(%rsp), %r13
	movabsq	$8589934597, %r14               # imm = 0x200000005
.LBB8_6:                                # =>This Inner Loop Header: Depth=1
	movl	$0, 8(%rsp)
	movl	%r12d, 12(%rsp)
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movq	%r13, %rdx
	callq	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE
	movslq	%eax, %rsi
	leaq	(%rsi,%rsi), %rax
	shlq	$31, %rsi
	subq	%rax, %rsi
	imulq	$16807, (%rbx), %rcx            # imm = 0x41A7
	movq	%rcx, %rax
	mulq	%r14
	movq	%rcx, %rax
	subq	%rdx, %rax
	shrq	%rax
	addq	%rdx, %rax
	shrq	$30, %rax
	movq	%rax, %rdx
	shlq	$31, %rdx
	subq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, (%rbx)
	addq	%rsi, %rax
	decq	%rax
	cmpq	%rbp, %rax
	ja	.LBB8_6
# %bb.7:                                #   in Loop: Header=BB8_6 Depth=1
	cmpq	%rsi, %rax
	jb	.LBB8_6
# %bb.8:                                # %.loopexit.loopexit
	movq	16(%rsp), %rcx                  # 8-byte Reload
	movl	(%rcx), %edi
.LBB8_9:                                # %.loopexit
	addl	%edi, %eax
                                        # kill: def $eax killed $eax killed $rax
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end8:
	.size	_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE, .Lfunc_end8-_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_RKNS0_10param_typeE
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _GLOBAL__sub_I_metaballs.hip
.LCPI9_0:
	.zero	16
	.section	.text.startup,"ax",@progbits
	.type	_GLOBAL__sub_I_metaballs.hip,@function
_GLOBAL__sub_I_metaballs.hip:           # @_GLOBAL__sub_I_metaballs.hip
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	xorps	%xmm0, %xmm0
	movups	%xmm0, v_point(%rip)
	xorl	%ebx, %ebx
	movq	%rbx, v_point+16(%rip)
	movl	$_ZNSt6vectorI7point3DSaIS0_EED2Ev, %edi
	movl	$v_point, %esi
	movl	$__dso_handle, %edx
	callq	__cxa_atexit
	xorps	%xmm0, %xmm0
	movups	%xmm0, v_circles(%rip)
	movq	%rbx, v_circles+16(%rip)
	movl	$_ZNSt6vectorI7point3DSaIS0_EED2Ev, %edi
	movl	$v_circles, %esi
	movl	$__dso_handle, %edx
	callq	__cxa_atexit
	movl	$mb_file, %edi
	movl	$.L.str, %esi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
	movl	$_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev, %edi
	movl	$mb_file, %esi
	movl	$__dso_handle, %edx
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	__cxa_atexit                    # TAILCALL
.Lfunc_end9:
	.size	_GLOBAL__sub_I_metaballs.hip, .Lfunc_end9-_GLOBAL__sub_I_metaballs.hip
	.cfi_endproc
                                        # -- End function
	.text
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB10_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB10_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z3addP7point3DS0_S0_, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end10:
	.size	__hip_module_ctor, .Lfunc_end10-__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	.LBB11_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
.LBB11_2:
	retq
.Lfunc_end11:
	.size	__hip_module_dtor, .Lfunc_end11-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	v_point,@object                 # @v_point
	.bss
	.globl	v_point
	.p2align	3, 0x0
v_point:
	.zero	24
	.size	v_point, 24

	.hidden	__dso_handle
	.type	v_circles,@object               # @v_circles
	.globl	v_circles
	.p2align	3, 0x0
v_circles:
	.zero	24
	.size	v_circles, 24

	.type	mb_file,@object                 # @mb_file
	.globl	mb_file
	.p2align	3, 0x0
mb_file:
	.zero	512
	.size	mb_file, 512

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"data.obj"
	.size	.L.str, 9

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

	.type	.L.str.3,@object                # @.str.3
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.3:
	.asciz	"vector initialized \n"
	.size	.L.str.3, 21

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

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

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"size of matrix: "
	.size	.L.str.6, 17

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Filling vectors"
	.size	.L.str.7, 16

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"\n"
	.size	.L.str.8, 2

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"vectors ready"
	.size	.L.str.9, 14

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"v"
	.size	.L.str.10, 2

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"Tiempo total: "
	.size	.L.str.11, 15

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

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z3addP7point3DS0_S0_"
	.size	.L__unnamed_1, 22

	.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	_GLOBAL__sub_I_metaballs.hip
	.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 _Z18__device_stub__addP7point3DS0_S0_
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym _GLOBAL__sub_I_metaballs.hip
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym v_point
	.addrsig_sym __dso_handle
	.addrsig_sym v_circles
	.addrsig_sym mb_file
	.addrsig_sym _Z3addP7point3DS0_S0_
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z3addP7point3DS0_S0_   ; -- Begin function _Z3addP7point3DS0_S0_
	.globl	_Z3addP7point3DS0_S0_
	.p2align	8
	.type	_Z3addP7point3DS0_S0_,@function
_Z3addP7point3DS0_S0_:                  ; @_Z3addP7point3DS0_S0_
; %bb.0:
	s_clause 0x2
	s_load_b32 s6, s[0:1], 0x24
	s_load_b64 s[4:5], s[0:1], 0x10
	s_load_b128 s[0:3], s[0:1], 0x0
	v_mov_b32_e32 v6, 0
	v_dual_mov_b32 v7, 0 :: v_dual_mov_b32 v16, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s6, s6, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s6, v[0:1]
	v_mad_i64_i32 v[4:5], null, v1, 24, s[4:5]
	v_mad_i64_i32 v[8:9], null, v1, 24, s[0:1]
	s_mov_b32 s4, 0x9999999a
	s_mov_b32 s5, 0x3fc99999
	s_mov_b64 s[0:1], 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v10, vcc_lo, v4, 16
	v_add_co_ci_u32_e32 v11, vcc_lo, 0, v5, vcc_lo
.LBB0_1:                                ; =>This Inner Loop Header: Depth=1
	s_add_u32 s6, s2, s0
	s_addc_u32 s7, s3, s1
	global_load_b128 v[0:3], v[8:9], off
	global_load_b128 v[17:20], v16, s[6:7]
	global_load_b64 v[12:13], v[8:9], off offset:16
	global_load_b64 v[14:15], v16, s[6:7] offset:16
	s_mov_b32 s6, exec_lo
	s_waitcnt vmcnt(2)
	v_add_f64 v[19:20], v[2:3], -v[19:20]
	v_add_f64 v[17:18], v[0:1], -v[17:18]
	s_waitcnt vmcnt(0)
	v_add_f64 v[14:15], v[12:13], -v[14:15]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[19:20], v[19:20], v[19:20]
	v_fma_f64 v[17:18], v[17:18], v[17:18], v[19:20]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[14:15], v[14:15], v[14:15], v[17:18]
	v_cmp_gt_f64_e32 vcc_lo, 0x10000000, v[14:15]
	v_cndmask_b32_e64 v17, 0, 1, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b32_e32 v17, 8, v17
	v_ldexp_f64 v[14:15], v[14:15], v17
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_rsq_f64_e32 v[17:18], v[14:15]
	s_waitcnt_depctr 0xfff
	v_mul_f64 v[19:20], v[14:15], v[17:18]
	v_mul_f64 v[17:18], v[17:18], 0.5
	v_fma_f64 v[21:22], -v[17:18], v[19:20], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fma_f64 v[19:20], v[19:20], v[21:22], v[19:20]
	v_fma_f64 v[17:18], v[17:18], v[21:22], v[17:18]
	v_fma_f64 v[21:22], -v[19:20], v[19:20], v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[19:20], v[21:22], v[17:18], v[19:20]
	v_fma_f64 v[21:22], -v[19:20], v[19:20], v[14:15]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_fma_f64 v[17:18], v[21:22], v[17:18], v[19:20]
	v_cndmask_b32_e64 v19, 0, 0xffffff80, vcc_lo
	v_cmp_class_f64_e64 vcc_lo, v[14:15], 0x260
	v_ldexp_f64 v[17:18], v[17:18], v19
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_cndmask_b32 v15, v18, v15 :: v_dual_cndmask_b32 v14, v17, v14
	v_cmpx_ge_f64_e32 1.0, v[14:15]
	s_cbranch_execz .LBB0_5
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	v_fma_f64 v[14:15], -v[14:15], v[14:15], 1.0
	s_mov_b32 s7, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[6:7], v[14:15], v[14:15], v[6:7]
	v_cmpx_lt_f64_e32 s[4:5], v[6:7]
; %bb.3:                                ;   in Loop: Header=BB0_1 Depth=1
	s_clause 0x1
	global_store_b128 v[4:5], v[0:3], off
	global_store_b64 v[10:11], v[12:13], off
; %bb.4:                                ; %Flow
                                        ;   in Loop: Header=BB0_1 Depth=1
	s_or_b32 exec_lo, exec_lo, s7
.LBB0_5:                                ;   in Loop: Header=BB0_1 Depth=1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s6
	s_add_u32 s0, s0, 24
	s_addc_u32 s1, s1, 0
	s_cmpk_eq_i32 s0, 0x5dc0
	s_cbranch_scc0 .LBB0_1
; %bb.6:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z3addP7point3DS0_S0_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 23
		.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	_Z3addP7point3DS0_S0_, .Lfunc_end0-_Z3addP7point3DS0_S0_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 492
; NumSgprs: 18
; NumVgprs: 23
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 23
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

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

	.end_amdgpu_metadata
