#include "global_defines.cuh"
#include "kernels3.cuh"

FLOATING LBM::sum_microscopic_densities_for_a_single_node(const int x, const int y, const int z){
	FLOATING sum = 0.0;
	sum = sum + D3.Q0[index(z,y,x)];

	sum+=D3.Q1[index(z,y,x)];
	sum+=D3.Q2[index(z,y,x)];
	sum+=D3.Q3[index(z,y,x)];
	sum+=D3.Q4[index(z,y,x)];
	sum+=D3.Q5[index(z,y,x)];
	sum+=D3.Q6[index(z,y,x)];

	sum+=D3.Q7[index(z,y,x)];
	sum+=D3.Q8[index(z,y,x)];
	sum+=D3.Q9[index(z,y,x)];
	sum+=D3.Q10[index(z,y,x)];
	sum+=D3.Q11[index(z,y,x)];
	sum+=D3.Q12[index(z,y,x)];
	sum+=D3.Q13[index(z,y,x)];
	sum+=D3.Q14[index(z,y,x)];
	sum+=D3.Q15[index(z,y,x)];
	sum+=D3.Q16[index(z,y,x)];
	sum+=D3.Q17[index(z,y,x)];
	sum+=D3.Q18[index(z,y,x)];

	return sum;
}




int LBM::calculate_macroscopic_density_in_the_host(FLOATING &density){
	/*compute integral density*/

	if(data_location==GPU)
		copy_data_from_device_to_host();
	//.....local variables
	int  x,y,z;
	FLOATING n_sum=0.0;

	//.....loop over computational domain
	//...........loop over all densities

	//loop only for the last quarter of the domain
#pragma unroll
	for ( z =0 ; z < lz ; ++z){
#pragma unroll
		for (y = 0; y < ly ; ++y){
#pragma unroll
			for ( x = (lx*3/4)-1 ; x< lx ; ++x){

				n_sum+=sum_microscopic_densities_for_a_single_node(x,y,z);

			}
		}
	}





	cout.setf(ios::fixed,ios::floatfield);
	cout.precision(10);
	cout << "density check: Integral density=" << n_sum << " " << n_sum/(lz*ly*(lx/4))  << endl;
	//check for nan

	if( isnan(n_sum/(lx*lz*ly))==0 ){
		//it is NOT nan, it is a good number!
		density=n_sum/(lz*ly*(lx/4));
		return 1;
	}else{
		//NAN WAS FOUND:the rest of this branch is for debugging purposes (print the nan on an external file)
		cout << " nsum:" << n_sum << endl;
#pragma unroll
		for ( z =0 ; z < lz ; ++z){
#pragma unroll
			for (y = 0; y < ly ; ++y){
#pragma unroll
				for ( x = (lx*3/4)-1 ; x< lx ; ++x){
					n_sum+=sum_microscopic_densities_for_a_single_node(x,y,z);

					if(isnan(n_sum)==0)
						cout << " x,y,z: " << x << " " << y << " " << z << endl;
				}
			}
		}

		return 0;

	}

}


FLOATING sum_one_density(int big_array_length, int numThreads, int numBlocks, int whichKernel, FLOATING *D3_Q,FLOATING* h_odata, FLOATING* d_odata){
	FLOATING partial_sum=0.0;

	reduce<FLOATING>(big_array_length, numThreads, numBlocks, whichKernel, D3_Q, d_odata);
	cudaDeviceSynchronize();
	cudaMemcpy( h_odata, d_odata, numBlocks*sizeof(FLOATING), cudaMemcpyDeviceToHost);
	for(int i=0; i<numBlocks; i++)
		partial_sum+= h_odata[i];

	return partial_sum;
}


__global__
void simple_check_density(const FLOATING *input_array, const int lx, const int ly, const int lz, FLOATING *output_array){
	int tid=blockIdx.x*blockDim.x+threadIdx.x;

	int z=(int) (tid/(ly*lx));
	int	y=(int) (tid-z*(ly*lx))/lx;
	int	x=(int) tid-z*(ly*lx)-y*lx;

	if( (3/4*lx-1)<=x and x< lx)
		output_array[tid]=input_array[tid];
}

FLOATING LBM::calulate_partial_sum(const FLOATING *input_array_d){
	FLOATING partial_sum=0.0;
	//calculate cuda threads and blocks
	//	simple_check_density<<< 1,1 >>> (input_array_d, 680, 73, 73, temp_check_density_d_full);
	partial_sum=reduce_sum(temp_check_density_d_full, 680*73*73);
	return partial_sum;
}


__global__
void collect_data_convergence_interest(const CUDA_FLOATING *input_array, const int lx, const int ly, const int lz,
		FLOATING *output_array){

	//collects a range of elements from input_array and inserts them into the output
	//then the reduce will be applied upon these data
	int tid=blockIdx.x*blockDim.x+threadIdx.x;

	int z_short= (int)(4*tid)/(lx*ly);
	int y_short=(int) (4*tid-z_short*lx*ly) / lx ;
	int x_short=((4*tid+3)%lx);

	extern __shared__ FLOATING shared_buffer[];

	shared_buffer[threadIdx.x]=input_array[index(z_short,y_short,x_short)];
	__syncthreads();

	output_array[tid]=shared_buffer[threadIdx.x];

	//	output_array[tid]=input_array[index(z_short,y_short,x_short)];



	__syncthreads();

}

FLOATING LBM::reduce_a_fraction_of_the_domain(const CUDA_FLOATING *domain_of_interest_d){

	int lattice_nodes=lz*ly*lx/4;
	int n_of_threads=threads_per_kernel;
	int n_of_blocks= (lattice_nodes)/n_of_threads;

	if( (lattice_nodes%n_of_threads)!=0)
		++n_of_blocks;

	const int size_of_allocated_shared_memory=(n_of_threads)*sizeof(CUDA_FLOATING);

	dim3 threads_type2(n_of_threads,1,1);
	dim3 grid_type2(n_of_blocks,1,1);

	collect_data_convergence_interest<<<grid_type2, threads_type2,size_of_allocated_shared_memory>>>(domain_of_interest_d,
			lx, ly,  lz, temp_check_density_d);

	FLOATING partial_sum=reduce_sum(temp_check_density_d, lz*ly*lx/4);
	return partial_sum;


}

void LBM::cuda_check_density(const int iteration){

//	int const array_length=(lx*ly*lz);
//	int const FLOATING_array_size=array_length*sizeof(FLOATING);



	FLOATING n_sum=0.0;


	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q0);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q1);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q2);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q3);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q4);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q5);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q6);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q7);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q8);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q9);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q10);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q11);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q12);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q13);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q14);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q15);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q16);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q17);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q18);
	//	n_sum=1.1;

	FLOATING temp_cpu_density=0.0;
	//CPU WORKING
//	if(data_location==GPU)
//		copy_data_from_device_to_host();
//	if( check_density(temp_cpu_density)==0)
//		exit(10);

	//save results in file - start
	const int quarter_length=lx*ly*lz/4;

	char buffer1[256];
	snprintf(buffer1, sizeof(buffer1), "LBM2_%s_convergence.log", case_name.c_str());

#ifdef PRODUCE_OUTPUT_FILES
	ofstream convergence_file;
	convergence_file.open( buffer1);
	//convergence_file.open( buffer1 , ofstream::app);
	convergence_file.precision(10);
#endif //PRODUCE_OUTPUT_FILES

	if (n_sum!=0){
		cout <<" cuda Integral density:" << n_sum/quarter_length << endl;
#ifdef PRODUCE_OUTPUT_FILES
		convergence_file<< iteration << "\t" << n_sum/quarter_length << "\t" << temp_cpu_density << endl;
#endif //PRODUCE_OUTPUT_FILES
	}else{
		cout <<" n_sum=0! potentially wrong! check code!" << endl;
#ifdef PRODUCE_OUTPUT_FILES
		convergence_file<< iteration << "\t" << n_sum/quarter_length << " WARNING! "<< endl;
#endif //PRODUCE_OUTPUT_FILES
	}
#ifdef PRODUCE_OUTPUT_FILES
	convergence_file.close();
#endif //PRODUCE_OUTPUT_FILES
	//save results in file - end

}

	.file	"tmpxft_00215ea0_00000000-6_check_density.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4568:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4568:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZNSolsEPFRSoS_E.isra.0, @function
_ZNSolsEPFRSoS_E.isra.0:
.LFB5276:
	.cfi_startproc
	jmp	*%rsi
	.cfi_endproc
.LFE5276:
	.size	_ZNSolsEPFRSoS_E.isra.0, .-_ZNSolsEPFRSoS_E.isra.0
	.align 2
	.globl	_ZN3LBM43sum_microscopic_densities_for_a_single_nodeEiii
	.type	_ZN3LBM43sum_microscopic_densities_for_a_single_nodeEiii, @function
_ZN3LBM43sum_microscopic_densities_for_a_single_nodeEiii:
.LFB4560:
	.cfi_startproc
	endbr64
	imull	32(%rdi), %ecx
	xorps	%xmm0, %xmm0
	addl	%ecx, %edx
	imull	28(%rdi), %edx
	movq	216(%rdi), %rcx
	addl	%esi, %edx
	movslq	%edx, %rdx
	addss	(%rcx,%rdx,4), %xmm0
	movq	224(%rdi), %rcx
	addss	(%rcx,%rdx,4), %xmm0
	movq	232(%rdi), %rcx
	addss	(%rcx,%rdx,4), %xmm0
	movq	240(%rdi), %rcx
	addss	(%rcx,%rdx,4), %xmm0
	movq	248(%rdi), %rcx
	addss	(%rcx,%rdx,4), %xmm0
	movq	256(%rdi), %rcx
	addss	(%rcx,%rdx,4), %xmm0
	movq	264(%rdi), %rcx
	addss	(%rcx,%rdx,4), %xmm0
	movq	272(%rdi), %rcx
	addss	(%rcx,%rdx,4), %xmm0
	movq	280(%rdi), %rcx
	addss	(%rcx,%rdx,4), %xmm0
	movq	288(%rdi), %rcx
	addss	(%rcx,%rdx,4), %xmm0
	movq	296(%rdi), %rcx
	addss	(%rcx,%rdx,4), %xmm0
	movq	304(%rdi), %rcx
	addss	(%rcx,%rdx,4), %xmm0
	movq	312(%rdi), %rcx
	addss	(%rcx,%rdx,4), %xmm0
	movq	320(%rdi), %rcx
	addss	(%rcx,%rdx,4), %xmm0
	movq	328(%rdi), %rcx
	addss	(%rcx,%rdx,4), %xmm0
	movq	336(%rdi), %rcx
	movq	360(%rdi), %rax
	addss	(%rcx,%rdx,4), %xmm0
	movq	344(%rdi), %rcx
	addss	(%rcx,%rdx,4), %xmm0
	movq	352(%rdi), %rcx
	addss	(%rcx,%rdx,4), %xmm0
	addss	(%rax,%rdx,4), %xmm0
	ret
	.cfi_endproc
.LFE4560:
	.size	_ZN3LBM43sum_microscopic_densities_for_a_single_nodeEiii, .-_ZN3LBM43sum_microscopic_densities_for_a_single_nodeEiii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"density check: Integral density="
.LC2:
	.string	" "
.LC3:
	.string	" nsum:"
.LC4:
	.string	" x,y,z: "
	.text
	.align 2
	.globl	_ZN3LBM41calculate_macroscopic_density_in_the_hostERf
	.type	_ZN3LBM41calculate_macroscopic_density_in_the_hostERf, @function
_ZN3LBM41calculate_macroscopic_density_in_the_hostERf:
.LFB4561:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	cmpl	$1, 784(%rdi)
	jne	.L5
	call	_ZN3LBM29copy_data_from_device_to_hostEv@PLT
.L5:
	movl	$0x00000000, 12(%rsp)
	movl	36(%r14), %r12d
	xorl	%r13d, %r13d
	movl	$4, %r10d
.L6:
	cmpl	%r13d, %r12d
	jle	.L10
	movl	32(%r14), %ebp
	xorl	%r9d, %r9d
.L11:
	cmpl	%r9d, %ebp
	jle	.L23
	movl	28(%r14), %r11d
	leal	(%r11,%r11,2), %eax
	cltd
	idivl	%r10d
	leal	-1(%rax), %esi
.L7:
	cmpl	%esi, %r11d
	jle	.L24
	movl	%r13d, %ecx
	movl	%r9d, %edx
	movq	%r14, %rdi
	call	_ZN3LBM43sum_microscopic_densities_for_a_single_nodeEiii
	addss	12(%rsp), %xmm0
	incl	%esi
	movss	%xmm0, 12(%rsp)
	jmp	.L7
.L24:
	incl	%r9d
	jmp	.L11
.L23:
	incl	%r13d
	jmp	.L6
.L10:
	movl	32+_ZSt4cout(%rip), %eax
	leaq	_ZSt4cout(%rip), %r13
	leaq	.LC1(%rip), %rsi
	movq	$10, 16+_ZSt4cout(%rip)
	movq	%r13, %rdi
	movl	$4, %r12d
	andl	$-261, %eax
	orl	$4, %eax
	movl	%eax, 32+_ZSt4cout(%rip)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cvtss2sd	12(%rsp), %xmm3
	movaps	%xmm3, %xmm0
	movq	%xmm3, %rbp
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	36(%r14), %ecx
	imull	32(%r14), %ecx
	movq	%rax, %rdi
	movl	28(%r14), %eax
	movss	12(%rsp), %xmm0
	cltd
	idivl	%r12d
	imull	%eax, %ecx
	cvtsi2ssl	%ecx, %xmm1
	divss	%xmm1, %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	28(%r14), %eax
	movl	36(%r14), %edx
	movl	32(%r14), %esi
	movss	12(%rsp), %xmm0
	movl	%eax, %ecx
	imull	%edx, %ecx
	imull	%esi, %ecx
	cvtsi2ssl	%ecx, %xmm1
	divss	%xmm1, %xmm0
	ucomiss	%xmm0, %xmm0
	jp	.L12
	imull	%esi, %edx
	movss	12(%rsp), %xmm0
	movl	%edx, %ecx
	cltd
	idivl	%r12d
	movl	%ecx, %edx
	imull	%eax, %edx
	movl	$1, %eax
	cvtsi2ssl	%edx, %xmm1
	divss	%xmm1, %xmm0
	movss	%xmm0, (%rbx)
	jmp	.L4
.L12:
	leaq	.LC3(%rip), %rsi
	movq	%r13, %rdi
	leaq	.LC4(%rip), %r15
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbp, %xmm0
	xorl	%ebp, %ebp
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L14:
	cmpl	%ebp, 36(%r14)
	jle	.L25
	xorl	%r12d, %r12d
.L19:
	cmpl	%r12d, 32(%r14)
	jle	.L26
	imull	$3, 28(%r14), %eax
	movl	$4, %ecx
	cltd
	idivl	%ecx
	leal	-1(%rax), %ebx
.L15:
	cmpl	%ebx, 28(%r14)
	jle	.L27
	movl	%ebp, %ecx
	movl	%r12d, %edx
	movl	%ebx, %esi
	movq	%r14, %rdi
	call	_ZN3LBM43sum_microscopic_densities_for_a_single_nodeEiii
	addss	12(%rsp), %xmm0
	ucomiss	%xmm0, %xmm0
	movss	%xmm0, 12(%rsp)
	jp	.L16
	movq	%r15, %rsi
	movq	%r13, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebx, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r12d, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	leaq	.LC2(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebp, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L16:
	incl	%ebx
	jmp	.L15
.L27:
	incl	%r12d
	jmp	.L19
.L26:
	incl	%ebp
	jmp	.L14
.L25:
	xorl	%eax, %eax
.L4:
	addq	$24, %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
.LFE4561:
	.size	_ZN3LBM41calculate_macroscopic_density_in_the_hostERf, .-_ZN3LBM41calculate_macroscopic_density_in_the_hostERf
	.globl	_Z15sum_one_densityiiiiPfS_S_
	.type	_Z15sum_one_densityiiiiPfS_S_, @function
_Z15sum_one_densityiiiiPfS_S_:
.LFB4562:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%r9, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movl	%edx, %ebx
	pushq	%r10
	.cfi_def_cfa_offset 32
	movq	32(%rsp), %r9
	call	_Z6reduceIfEviiiiPT_S1_@PLT
	call	cudaDeviceSynchronize@PLT
	movq	32(%rsp), %rsi
	movslq	%ebx, %rdx
	movq	%rbp, %rdi
	salq	$2, %rdx
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	xorl	%eax, %eax
	xorps	%xmm0, %xmm0
.L29:
	cmpl	%eax, %ebx
	jle	.L32
	addss	0(%rbp,%rax,4), %xmm0
	incq	%rax
	jmp	.L29
.L32:
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4562:
	.size	_Z15sum_one_densityiiiiPfS_S_, .-_Z15sum_one_densityiiiiPfS_S_
	.align 2
	.globl	_ZN3LBM20calulate_partial_sumEPKf
	.type	_ZN3LBM20calulate_partial_sumEPKf, @function
_ZN3LBM20calulate_partial_sumEPKf:
.LFB4563:
	.cfi_startproc
	endbr64
	movq	776(%rdi), %rdi
	movl	$3623720, %esi
	jmp	_Z10reduce_sumPfi@PLT
	.cfi_endproc
.LFE4563:
	.size	_ZN3LBM20calulate_partial_sumEPKf, .-_ZN3LBM20calulate_partial_sumEPKf
	.globl	_Z46__device_stub__Z20simple_check_densityPKfiiiPfPKfiiiPf
	.type	_Z46__device_stub__Z20simple_check_densityPKfiiiPfPKfiiiPf, @function
_Z46__device_stub__Z20simple_check_densityPKfiiiPfPKfiiiPf:
.LFB4590:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 16(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 12(%rsp)
	leaq	40(%rsp), %rcx
	movq	%r8, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L34
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z20simple_check_densityPKfiiiPf(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L34:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L36
	call	__stack_chk_fail@PLT
.L36:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4590:
	.size	_Z46__device_stub__Z20simple_check_densityPKfiiiPfPKfiiiPf, .-_Z46__device_stub__Z20simple_check_densityPKfiiiPfPKfiiiPf
	.globl	_Z20simple_check_densityPKfiiiPf
	.type	_Z20simple_check_densityPKfiiiPf, @function
_Z20simple_check_densityPKfiiiPf:
.LFB4591:
	.cfi_startproc
	endbr64
	jmp	_Z46__device_stub__Z20simple_check_densityPKfiiiPfPKfiiiPf
	.cfi_endproc
.LFE4591:
	.size	_Z20simple_check_densityPKfiiiPf, .-_Z20simple_check_densityPKfiiiPf
	.globl	_Z59__device_stub__Z33collect_data_convergence_interestPKfiiiPfPKfiiiPf
	.type	_Z59__device_stub__Z33collect_data_convergence_interestPKfiiiPfPKfiiiPf, @function
_Z59__device_stub__Z33collect_data_convergence_interestPKfiiiPfPKfiiiPf:
.LFB4592:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 16(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 12(%rsp)
	leaq	40(%rsp), %rcx
	movq	%r8, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L39
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z33collect_data_convergence_interestPKfiiiPf(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L39:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L41
	call	__stack_chk_fail@PLT
.L41:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4592:
	.size	_Z59__device_stub__Z33collect_data_convergence_interestPKfiiiPfPKfiiiPf, .-_Z59__device_stub__Z33collect_data_convergence_interestPKfiiiPfPKfiiiPf
	.globl	_Z33collect_data_convergence_interestPKfiiiPf
	.type	_Z33collect_data_convergence_interestPKfiiiPf, @function
_Z33collect_data_convergence_interestPKfiiiPf:
.LFB4593:
	.cfi_startproc
	endbr64
	jmp	_Z59__device_stub__Z33collect_data_convergence_interestPKfiiiPfPKfiiiPf
	.cfi_endproc
.LFE4593:
	.size	_Z33collect_data_convergence_interestPKfiiiPf, .-_Z33collect_data_convergence_interestPKfiiiPf
	.align 2
	.globl	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	.type	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf, @function
_ZN3LBM31reduce_a_fraction_of_the_domainEPKf:
.LFB4564:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	$4, %ecx
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 64
	movl	36(%rdi), %eax
	imull	32(%rdi), %eax
	imull	28(%rdi), %eax
	movl	108(%rdi), %r8d
	movl	%r8d, 8(%rsp)
	cltd
	idivl	%ecx
	cltd
	idivl	%r8d
	cmpl	$1, %edx
	movabsq	$4294967297, %rdx
	sbbl	$-1, %eax
	movq	%rdx, 24(%rsp)
	sall	$2, %r8d
	movl	28(%rsp), %esi
	movq	%rdx, 12(%rsp)
	movl	16(%rsp), %ecx
	xorl	%r9d, %r9d
	movslq	%r8d, %r8
	movl	%eax, 20(%rsp)
	movq	8(%rsp), %rdx
	movq	20(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L46
	movl	36(%rbx), %ecx
	movl	32(%rbx), %edx
	movq	%rbp, %rdi
	movl	28(%rbx), %esi
	movq	768(%rbx), %r8
	call	_Z59__device_stub__Z33collect_data_convergence_interestPKfiiiPfPKfiiiPf
.L46:
	movl	36(%rbx), %eax
	imull	32(%rbx), %eax
	movl	$4, %ecx
	imull	28(%rbx), %eax
	movq	768(%rbx), %rdi
	addq	$40, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	cltd
	idivl	%ecx
	movl	%eax, %esi
	jmp	_Z10reduce_sumPfi@PLT
	.cfi_endproc
.LFE4564:
	.size	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf, .-_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	.section	.rodata.str1.1
.LC5:
	.string	"_Z33collect_data_convergence_interestPKfiiiPf"
.LC6:
	.string	"_Z20simple_check_densityPKfiiiPf"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4595:
	.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	.LC5(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z33collect_data_convergence_interestPKfiiiPf(%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	.LC6(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z20simple_check_densityPKfiiiPf(%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
.LFE4595:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata.str1.1
.LC7:
	.string	"LBM2_%s_convergence.log"
.LC8:
	.string	" cuda Integral density:"
.LC9:
	.string	"\t"
.LC11:
	.string	" n_sum=0! potentially wrong! check code!"
.LC12:
	.string	" WARNING! "
	.text
	.align 2
	.globl	_ZN3LBM18cuda_check_densityEi
	.type	_ZN3LBM18cuda_check_densityEi, @function
_ZN3LBM18cuda_check_densityEi:
.LFB4565:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4565
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movl	%esi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rdi, %rbx
	subq	$800, %rsp
	.cfi_def_cfa_offset 848
	movq	824(%rdi), %rsi
	movq	%fs:40, %rax
	movq	%rax, 792(%rsp)
	xorl	%eax, %eax
	leaq	536(%rsp), %r13
.LEHB0:
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movq	832(%rbx), %rsi
	movq	%rbx, %rdi
	movaps	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	addss	%xmm0, %xmm1
	movss	%xmm1, 12(%rsp)
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	addss	12(%rsp), %xmm0
	movq	840(%rbx), %rsi
	movq	%rbx, %rdi
	movss	%xmm0, 12(%rsp)
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	addss	12(%rsp), %xmm0
	movq	848(%rbx), %rsi
	movq	%rbx, %rdi
	movss	%xmm0, 12(%rsp)
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	addss	12(%rsp), %xmm0
	movq	856(%rbx), %rsi
	movq	%rbx, %rdi
	movss	%xmm0, 12(%rsp)
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	addss	12(%rsp), %xmm0
	movq	864(%rbx), %rsi
	movq	%rbx, %rdi
	movss	%xmm0, 12(%rsp)
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	addss	12(%rsp), %xmm0
	movq	872(%rbx), %rsi
	movq	%rbx, %rdi
	movss	%xmm0, 12(%rsp)
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	addss	12(%rsp), %xmm0
	movq	880(%rbx), %rsi
	movq	%rbx, %rdi
	movss	%xmm0, 12(%rsp)
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	addss	12(%rsp), %xmm0
	movq	888(%rbx), %rsi
	movq	%rbx, %rdi
	movss	%xmm0, 12(%rsp)
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	addss	12(%rsp), %xmm0
	movq	896(%rbx), %rsi
	movq	%rbx, %rdi
	movss	%xmm0, 12(%rsp)
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	addss	12(%rsp), %xmm0
	movq	904(%rbx), %rsi
	movq	%rbx, %rdi
	movss	%xmm0, 12(%rsp)
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	addss	12(%rsp), %xmm0
	movq	912(%rbx), %rsi
	movq	%rbx, %rdi
	movss	%xmm0, 12(%rsp)
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	addss	12(%rsp), %xmm0
	movq	920(%rbx), %rsi
	movq	%rbx, %rdi
	movss	%xmm0, 12(%rsp)
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	addss	12(%rsp), %xmm0
	movq	928(%rbx), %rsi
	movq	%rbx, %rdi
	movss	%xmm0, 12(%rsp)
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	addss	12(%rsp), %xmm0
	movq	936(%rbx), %rsi
	movq	%rbx, %rdi
	movss	%xmm0, 12(%rsp)
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	addss	12(%rsp), %xmm0
	movq	944(%rbx), %rsi
	movq	%rbx, %rdi
	movss	%xmm0, 12(%rsp)
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	addss	12(%rsp), %xmm0
	movq	952(%rbx), %rsi
	movq	%rbx, %rdi
	movss	%xmm0, 12(%rsp)
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	addss	12(%rsp), %xmm0
	movq	960(%rbx), %rsi
	movq	%rbx, %rdi
	movss	%xmm0, 12(%rsp)
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	addss	12(%rsp), %xmm0
	movq	968(%rbx), %rsi
	movq	%rbx, %rdi
	movss	%xmm0, 12(%rsp)
	call	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movl	28(%rbx), %eax
	imull	32(%rbx), %eax
	movq	%r13, %rdi
	imull	36(%rbx), %eax
	movl	$4, %ecx
	addss	12(%rsp), %xmm0
	movl	$256, %esi
	movq	136(%rbx), %r9
	leaq	.LC7(%rip), %r8
	leaq	24(%rsp), %rbx
	cltd
	movd	%xmm0, %r14d
	idivl	%ecx
	movl	$2, %edx
	movl	$256, %ecx
	movl	%eax, %ebp
	xorl	%eax, %eax
	call	__snprintf_chk@PLT
	movq	%rbx, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE0:
	movl	$16, %edx
	movq	%r13, %rsi
	movq	%rbx, %rdi
.LEHB1:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	xorps	%xmm0, %xmm0
	movd	%r14d, %xmm2
	movq	$10, 280(%rsp)
	leaq	_ZSt4cout(%rip), %rdi
	ucomiss	%xmm0, %xmm2
	leaq	.LC9(%rip), %r13
	jp	.L61
	je	.L53
.L61:
	leaq	.LC8(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cvtsi2ssl	%ebp, %xmm1
	movd	%r14d, %xmm0
	movq	%rax, %rdi
	divss	%xmm1, %xmm0
	cvtss2sd	%xmm0, %xmm3
	movaps	%xmm3, %xmm0
	movq	%xmm3, %rbp
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	%r12d, %esi
	movq	%rbx, %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	movq	%r13, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	%rbp, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	movq	%r13, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	xorps	%xmm0, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
.L66:
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	%rbx, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
	jmp	.L67
.L53:
	leaq	.LC11(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	%r12d, %esi
	movq	%rbx, %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	movq	%r13, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cvtsi2ssl	%ebp, %xmm1
	movd	%r14d, %xmm0
	movq	%rax, %rdi
	divss	%xmm1, %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC12(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.LEHE1:
	jmp	.L66
.L67:
	movq	%rbx, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	792(%rsp), %rax
	subq	%fs:40, %rax
	je	.L59
	jmp	.L63
.L60:
	endbr64
	movq	%rax, %rbp
.L57:
	movq	%rbx, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	792(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L63
	movq	%rbp, %rdi
.LEHB2:
	call	_Unwind_Resume@PLT
.LEHE2:
.L63:
	call	__stack_chk_fail@PLT
.L59:
	addq	$800, %rsp
	.cfi_def_cfa_offset 48
	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
.LFE4565:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4565:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4565-.LLSDACSB4565
.LLSDACSB4565:
	.uleb128 .LEHB0-.LFB4565
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB4565
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L60-.LFB4565
	.uleb128 0
	.uleb128 .LEHB2-.LFB4565
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE4565:
	.text
	.size	_ZN3LBM18cuda_check_densityEi, .-_ZN3LBM18cuda_check_densityEi
	.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
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include "global_defines.cuh"
#include "kernels3.cuh"

FLOATING LBM::sum_microscopic_densities_for_a_single_node(const int x, const int y, const int z){
	FLOATING sum = 0.0;
	sum = sum + D3.Q0[index(z,y,x)];

	sum+=D3.Q1[index(z,y,x)];
	sum+=D3.Q2[index(z,y,x)];
	sum+=D3.Q3[index(z,y,x)];
	sum+=D3.Q4[index(z,y,x)];
	sum+=D3.Q5[index(z,y,x)];
	sum+=D3.Q6[index(z,y,x)];

	sum+=D3.Q7[index(z,y,x)];
	sum+=D3.Q8[index(z,y,x)];
	sum+=D3.Q9[index(z,y,x)];
	sum+=D3.Q10[index(z,y,x)];
	sum+=D3.Q11[index(z,y,x)];
	sum+=D3.Q12[index(z,y,x)];
	sum+=D3.Q13[index(z,y,x)];
	sum+=D3.Q14[index(z,y,x)];
	sum+=D3.Q15[index(z,y,x)];
	sum+=D3.Q16[index(z,y,x)];
	sum+=D3.Q17[index(z,y,x)];
	sum+=D3.Q18[index(z,y,x)];

	return sum;
}




int LBM::calculate_macroscopic_density_in_the_host(FLOATING &density){
	/*compute integral density*/

	if(data_location==GPU)
		copy_data_from_device_to_host();
	//.....local variables
	int  x,y,z;
	FLOATING n_sum=0.0;

	//.....loop over computational domain
	//...........loop over all densities

	//loop only for the last quarter of the domain
#pragma unroll
	for ( z =0 ; z < lz ; ++z){
#pragma unroll
		for (y = 0; y < ly ; ++y){
#pragma unroll
			for ( x = (lx*3/4)-1 ; x< lx ; ++x){

				n_sum+=sum_microscopic_densities_for_a_single_node(x,y,z);

			}
		}
	}





	cout.setf(ios::fixed,ios::floatfield);
	cout.precision(10);
	cout << "density check: Integral density=" << n_sum << " " << n_sum/(lz*ly*(lx/4))  << endl;
	//check for nan

	if( isnan(n_sum/(lx*lz*ly))==0 ){
		//it is NOT nan, it is a good number!
		density=n_sum/(lz*ly*(lx/4));
		return 1;
	}else{
		//NAN WAS FOUND:the rest of this branch is for debugging purposes (print the nan on an external file)
		cout << " nsum:" << n_sum << endl;
#pragma unroll
		for ( z =0 ; z < lz ; ++z){
#pragma unroll
			for (y = 0; y < ly ; ++y){
#pragma unroll
				for ( x = (lx*3/4)-1 ; x< lx ; ++x){
					n_sum+=sum_microscopic_densities_for_a_single_node(x,y,z);

					if(isnan(n_sum)==0)
						cout << " x,y,z: " << x << " " << y << " " << z << endl;
				}
			}
		}

		return 0;

	}

}


FLOATING sum_one_density(int big_array_length, int numThreads, int numBlocks, int whichKernel, FLOATING *D3_Q,FLOATING* h_odata, FLOATING* d_odata){
	FLOATING partial_sum=0.0;

	reduce<FLOATING>(big_array_length, numThreads, numBlocks, whichKernel, D3_Q, d_odata);
	hipDeviceSynchronize();
	hipMemcpy( h_odata, d_odata, numBlocks*sizeof(FLOATING), hipMemcpyDeviceToHost);
	for(int i=0; i<numBlocks; i++)
		partial_sum+= h_odata[i];

	return partial_sum;
}


__global__
void simple_check_density(const FLOATING *input_array, const int lx, const int ly, const int lz, FLOATING *output_array){
	int tid=blockIdx.x*blockDim.x+threadIdx.x;

	int z=(int) (tid/(ly*lx));
	int	y=(int) (tid-z*(ly*lx))/lx;
	int	x=(int) tid-z*(ly*lx)-y*lx;

	if( (3/4*lx-1)<=x and x< lx)
		output_array[tid]=input_array[tid];
}

FLOATING LBM::calulate_partial_sum(const FLOATING *input_array_d){
	FLOATING partial_sum=0.0;
	//calculate cuda threads and blocks
	//	simple_check_density<<< 1,1 >>> (input_array_d, 680, 73, 73, temp_check_density_d_full);
	partial_sum=reduce_sum(temp_check_density_d_full, 680*73*73);
	return partial_sum;
}


__global__
void collect_data_convergence_interest(const CUDA_FLOATING *input_array, const int lx, const int ly, const int lz,
		FLOATING *output_array){

	//collects a range of elements from input_array and inserts them into the output
	//then the reduce will be applied upon these data
	int tid=blockIdx.x*blockDim.x+threadIdx.x;

	int z_short= (int)(4*tid)/(lx*ly);
	int y_short=(int) (4*tid-z_short*lx*ly) / lx ;
	int x_short=((4*tid+3)%lx);

	extern __shared__ FLOATING shared_buffer[];

	shared_buffer[threadIdx.x]=input_array[index(z_short,y_short,x_short)];
	__syncthreads();

	output_array[tid]=shared_buffer[threadIdx.x];

	//	output_array[tid]=input_array[index(z_short,y_short,x_short)];



	__syncthreads();

}

FLOATING LBM::reduce_a_fraction_of_the_domain(const CUDA_FLOATING *domain_of_interest_d){

	int lattice_nodes=lz*ly*lx/4;
	int n_of_threads=threads_per_kernel;
	int n_of_blocks= (lattice_nodes)/n_of_threads;

	if( (lattice_nodes%n_of_threads)!=0)
		++n_of_blocks;

	const int size_of_allocated_shared_memory=(n_of_threads)*sizeof(CUDA_FLOATING);

	dim3 threads_type2(n_of_threads,1,1);
	dim3 grid_type2(n_of_blocks,1,1);

	collect_data_convergence_interest<<<grid_type2, threads_type2,size_of_allocated_shared_memory>>>(domain_of_interest_d,
			lx, ly,  lz, temp_check_density_d);

	FLOATING partial_sum=reduce_sum(temp_check_density_d, lz*ly*lx/4);
	return partial_sum;


}

void LBM::cuda_check_density(const int iteration){

//	int const array_length=(lx*ly*lz);
//	int const FLOATING_array_size=array_length*sizeof(FLOATING);



	FLOATING n_sum=0.0;


	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q0);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q1);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q2);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q3);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q4);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q5);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q6);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q7);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q8);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q9);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q10);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q11);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q12);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q13);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q14);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q15);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q16);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q17);
	n_sum+=reduce_a_fraction_of_the_domain(D3_d.Q18);
	//	n_sum=1.1;

	FLOATING temp_cpu_density=0.0;
	//CPU WORKING
//	if(data_location==GPU)
//		copy_data_from_device_to_host();
//	if( check_density(temp_cpu_density)==0)
//		exit(10);

	//save results in file - start
	const int quarter_length=lx*ly*lz/4;

	char buffer1[256];
	snprintf(buffer1, sizeof(buffer1), "LBM2_%s_convergence.log", case_name.c_str());

#ifdef PRODUCE_OUTPUT_FILES
	ofstream convergence_file;
	convergence_file.open( buffer1);
	//convergence_file.open( buffer1 , ofstream::app);
	convergence_file.precision(10);
#endif //PRODUCE_OUTPUT_FILES

	if (n_sum!=0){
		cout <<" cuda Integral density:" << n_sum/quarter_length << endl;
#ifdef PRODUCE_OUTPUT_FILES
		convergence_file<< iteration << "\t" << n_sum/quarter_length << "\t" << temp_cpu_density << endl;
#endif //PRODUCE_OUTPUT_FILES
	}else{
		cout <<" n_sum=0! potentially wrong! check code!" << endl;
#ifdef PRODUCE_OUTPUT_FILES
		convergence_file<< iteration << "\t" << n_sum/quarter_length << " WARNING! "<< endl;
#endif //PRODUCE_OUTPUT_FILES
	}
#ifdef PRODUCE_OUTPUT_FILES
	convergence_file.close();
#endif //PRODUCE_OUTPUT_FILES
	//save results in file - end

}

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

                                        # End of file scope inline assembly
	.globl	_ZN3LBM43sum_microscopic_densities_for_a_single_nodeEiii # -- Begin function _ZN3LBM43sum_microscopic_densities_for_a_single_nodeEiii
	.p2align	1, 0x90
	.type	_ZN3LBM43sum_microscopic_densities_for_a_single_nodeEiii,@function
_ZN3LBM43sum_microscopic_densities_for_a_single_nodeEiii: # @_ZN3LBM43sum_microscopic_densities_for_a_single_nodeEiii
	.cfi_startproc
# %bb.0:
	imull	32(%rdi), %ecx
	addl	%edx, %ecx
	imull	28(%rdi), %ecx
	addl	%esi, %ecx
	movslq	%ecx, %rax
	movq	216(%rdi), %rcx
	movq	224(%rdi), %rdx
	xorps	%xmm0, %xmm0
	addss	(%rcx,%rax,4), %xmm0
	addss	(%rdx,%rax,4), %xmm0
	movq	232(%rdi), %rcx
	addss	(%rcx,%rax,4), %xmm0
	movq	240(%rdi), %rcx
	addss	(%rcx,%rax,4), %xmm0
	movq	248(%rdi), %rcx
	addss	(%rcx,%rax,4), %xmm0
	movq	256(%rdi), %rcx
	addss	(%rcx,%rax,4), %xmm0
	movq	264(%rdi), %rcx
	addss	(%rcx,%rax,4), %xmm0
	movq	272(%rdi), %rcx
	addss	(%rcx,%rax,4), %xmm0
	movq	280(%rdi), %rcx
	addss	(%rcx,%rax,4), %xmm0
	movq	288(%rdi), %rcx
	addss	(%rcx,%rax,4), %xmm0
	movq	296(%rdi), %rcx
	addss	(%rcx,%rax,4), %xmm0
	movq	304(%rdi), %rcx
	addss	(%rcx,%rax,4), %xmm0
	movq	312(%rdi), %rcx
	addss	(%rcx,%rax,4), %xmm0
	movq	320(%rdi), %rcx
	addss	(%rcx,%rax,4), %xmm0
	movq	328(%rdi), %rcx
	addss	(%rcx,%rax,4), %xmm0
	movq	336(%rdi), %rcx
	addss	(%rcx,%rax,4), %xmm0
	movq	344(%rdi), %rcx
	addss	(%rcx,%rax,4), %xmm0
	movq	352(%rdi), %rcx
	addss	(%rcx,%rax,4), %xmm0
	movq	360(%rdi), %rcx
	addss	(%rcx,%rax,4), %xmm0
	retq
.Lfunc_end0:
	.size	_ZN3LBM43sum_microscopic_densities_for_a_single_nodeEiii, .Lfunc_end0-_ZN3LBM43sum_microscopic_densities_for_a_single_nodeEiii
	.cfi_endproc
                                        # -- End function
	.globl	_ZN3LBM41calculate_macroscopic_density_in_the_hostERf # -- Begin function _ZN3LBM41calculate_macroscopic_density_in_the_hostERf
	.p2align	1, 0x90
	.type	_ZN3LBM41calculate_macroscopic_density_in_the_hostERf,@function
_ZN3LBM41calculate_macroscopic_density_in_the_hostERf: # @_ZN3LBM41calculate_macroscopic_density_in_the_hostERf
	.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	$40, %rsp
	.cfi_def_cfa_offset 96
	.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, %r14
	movq	%rdi, %rbx
	cmpl	$1, 784(%rdi)
	jne	.LBB1_2
# %bb.1:
	movq	%rbx, %rdi
	callq	_ZN3LBM29copy_data_from_device_to_hostEv
.LBB1_2:
	movl	36(%rbx), %eax
	movl	%eax, 24(%rsp)                  # 4-byte Spill
	testl	%eax, %eax
	movq	%r14, 32(%rsp)                  # 8-byte Spill
	jle	.LBB1_3
# %bb.4:                                # %.preheader38.lr.ph
	movl	28(%rbx), %r14d
	movl	32(%rbx), %eax
	movl	%eax, 16(%rsp)                  # 4-byte Spill
	leal	(%r14,%r14,2), %eax
	leal	(%r14,%r14,2), %ecx
	addl	$3, %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$2, %ecx
	movq	%rcx, %r13
	leal	-1(%rcx), %eax
	movl	%eax, 28(%rsp)                  # 4-byte Spill
	xorl	%ebp, %ebp
	xorps	%xmm0, %xmm0
	movss	%xmm0, 12(%rsp)                 # 4-byte Spill
.LBB1_5:                                # %.preheader38
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_7 Depth 2
                                        #       Child Loop BB1_10 Depth 3
	cmpl	$0, 16(%rsp)                    # 4-byte Folded Reload
	jle	.LBB1_12
# %bb.6:                                # %.lr.ph43.preheader
                                        #   in Loop: Header=BB1_5 Depth=1
	xorl	%r15d, %r15d
.LBB1_7:                                # %.lr.ph43
                                        #   Parent Loop BB1_5 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB1_10 Depth 3
	cmpl	%r14d, %r13d
	jle	.LBB1_9
# %bb.8:                                #   in Loop: Header=BB1_7 Depth=2
	movss	12(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	jmp	.LBB1_11
.LBB1_9:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB1_7 Depth=2
	movl	28(%rsp), %r12d                 # 4-byte Reload
	movss	12(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
.LBB1_10:                               # %.lr.ph
                                        #   Parent Loop BB1_5 Depth=1
                                        #     Parent Loop BB1_7 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movss	%xmm0, 12(%rsp)                 # 4-byte Spill
	movq	%rbx, %rdi
	movl	%r12d, %esi
	movl	%r15d, %edx
	movl	%ebp, %ecx
	callq	_ZN3LBM43sum_microscopic_densities_for_a_single_nodeEiii
	movss	12(%rsp), %xmm1                 # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	addss	%xmm0, %xmm1
	movss	%xmm1, 12(%rsp)                 # 4-byte Spill
	movss	12(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	incl	%r12d
	cmpl	%r12d, %r14d
	jne	.LBB1_10
.LBB1_11:                               # %._crit_edge
                                        #   in Loop: Header=BB1_7 Depth=2
	movss	%xmm0, 12(%rsp)                 # 4-byte Spill
	incl	%r15d
	cmpl	16(%rsp), %r15d                 # 4-byte Folded Reload
	jne	.LBB1_7
.LBB1_12:                               # %._crit_edge44
                                        #   in Loop: Header=BB1_5 Depth=1
	incl	%ebp
	cmpl	24(%rsp), %ebp                  # 4-byte Folded Reload
	jne	.LBB1_5
	jmp	.LBB1_13
.LBB1_3:
	xorps	%xmm0, %xmm0
	movss	%xmm0, 12(%rsp)                 # 4-byte Spill
.LBB1_13:                               # %._crit_edge48
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rcx
	movl	$-261, %edx                     # imm = 0xFEFB
	andl	_ZSt4cout+24(%rcx), %edx
	orl	$4, %edx
	movl	%edx, _ZSt4cout+24(%rcx)
	movq	-24(%rax), %rax
	movq	$10, _ZSt4cout+8(%rax)
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$32, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	xorps	%xmm0, %xmm0
	cvtss2sd	12(%rsp), %xmm0                 # 4-byte Folded Reload
	movl	$_ZSt4cout, %edi
	movsd	%xmm0, 16(%rsp)                 # 8-byte Spill
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r15
	movl	$.L.str.1, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	28(%rbx), %eax
	movl	32(%rbx), %ecx
	imull	36(%rbx), %ecx
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovnsl	%eax, %edx
	sarl	$2, %edx
	imull	%ecx, %edx
	xorps	%xmm0, %xmm0
	cvtsi2ss	%edx, %xmm0
	movss	12(%rsp), %xmm1                 # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	divss	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	cvtss2sd	%xmm1, %xmm0
	movq	%r15, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r15
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r15, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movss	12(%rsp), %xmm2                 # 4-byte Reload
                                        # xmm2 = mem[0],zero,zero,zero
	movl	28(%rbx), %ecx
	movl	36(%rbx), %eax
	imull	32(%rbx), %eax
	movl	%eax, %edx
	imull	%ecx, %edx
	xorps	%xmm0, %xmm0
	cvtsi2ss	%edx, %xmm0
	movaps	%xmm2, %xmm1
	divss	%xmm0, %xmm1
	ucomiss	%xmm1, %xmm1
	jp	.LBB1_15
# %bb.14:
	leal	3(%rcx), %edx
	testl	%ecx, %ecx
	cmovnsl	%ecx, %edx
	sarl	$2, %edx
	imull	%eax, %edx
	xorps	%xmm0, %xmm0
	cvtsi2ss	%edx, %xmm0
	divss	%xmm0, %xmm2
	movq	32(%rsp), %rax                  # 8-byte Reload
	movss	%xmm2, (%rax)
	movl	$1, %eax
.LBB1_29:                               # %.loopexit
	addq	$40, %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
.LBB1_15:
	.cfi_def_cfa_offset 96
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$6, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r14
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	36(%rbx), %edx
	testl	%edx, %edx
	jle	.LBB1_16
# %bb.17:                               # %.preheader.preheader
	movl	32(%rbx), %ecx
	xorl	%ebp, %ebp
.LBB1_18:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_20 Depth 2
                                        #       Child Loop BB1_22 Depth 3
	testl	%ecx, %ecx
	jle	.LBB1_28
# %bb.19:                               # %.lr.ph58.preheader
                                        #   in Loop: Header=BB1_18 Depth=1
	movl	28(%rbx), %r12d
	xorl	%r14d, %r14d
	movss	12(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
.LBB1_20:                               # %.lr.ph58
                                        #   Parent Loop BB1_18 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB1_22 Depth 3
	leal	(%r12,%r12,2), %eax
	leal	(%r12,%r12,2), %r15d
	addl	$3, %r15d
	testl	%eax, %eax
	cmovnsl	%eax, %r15d
	sarl	$2, %r15d
	cmpl	%r12d, %r15d
	jg	.LBB1_26
# %bb.21:                               # %.lr.ph53.preheader
                                        #   in Loop: Header=BB1_20 Depth=2
	decl	%r15d
.LBB1_22:                               # %.lr.ph53
                                        #   Parent Loop BB1_18 Depth=1
                                        #     Parent Loop BB1_20 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movss	%xmm0, 12(%rsp)                 # 4-byte Spill
	movq	%rbx, %rdi
	movl	%r15d, %esi
	movl	%r14d, %edx
	movl	%ebp, %ecx
	callq	_ZN3LBM43sum_microscopic_densities_for_a_single_nodeEiii
	addss	12(%rsp), %xmm0                 # 4-byte Folded Reload
	movss	%xmm0, 12(%rsp)                 # 4-byte Spill
	ucomiss	%xmm0, %xmm0
	jp	.LBB1_24
# %bb.23:                               #   in Loop: Header=BB1_22 Depth=3
	movl	$_ZSt4cout, %edi
	movl	$.L.str.3, %esi
	movl	$8, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	%r15d, %esi
	callq	_ZNSolsEi
	movq	%rax, %r12
	movl	$.L.str.1, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%r12, %rdi
	movl	%r14d, %esi
	callq	_ZNSolsEi
	movq	%rax, %r12
	movl	$.L.str.1, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%r12, %rdi
	movl	%ebp, %esi
	callq	_ZNSolsEi
	movq	%rax, %r12
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r12, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r12, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	28(%rbx), %r12d
.LBB1_24:                               #   in Loop: Header=BB1_22 Depth=3
	incl	%r15d
	cmpl	%r12d, %r15d
	movss	12(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	jl	.LBB1_22
# %bb.25:                               # %._crit_edge54.loopexit
                                        #   in Loop: Header=BB1_20 Depth=2
	movl	32(%rbx), %ecx
.LBB1_26:                               # %._crit_edge54
                                        #   in Loop: Header=BB1_20 Depth=2
	incl	%r14d
	cmpl	%ecx, %r14d
	jl	.LBB1_20
# %bb.27:                               # %._crit_edge59.loopexit
                                        #   in Loop: Header=BB1_18 Depth=1
	movss	%xmm0, 12(%rsp)                 # 4-byte Spill
	movl	36(%rbx), %edx
.LBB1_28:                               # %._crit_edge59
                                        #   in Loop: Header=BB1_18 Depth=1
	incl	%ebp
	xorl	%eax, %eax
	cmpl	%edx, %ebp
	jl	.LBB1_18
	jmp	.LBB1_29
.LBB1_16:
	xorl	%eax, %eax
	jmp	.LBB1_29
.Lfunc_end1:
	.size	_ZN3LBM41calculate_macroscopic_density_in_the_hostERf, .Lfunc_end1-_ZN3LBM41calculate_macroscopic_density_in_the_hostERf
	.cfi_endproc
                                        # -- End function
	.globl	_Z15sum_one_densityiiiiPfS_S_   # -- Begin function _Z15sum_one_densityiiiiPfS_S_
	.type	_Z15sum_one_densityiiiiPfS_S_,@function
_Z15sum_one_densityiiiiPfS_S_:          # @_Z15sum_one_densityiiiiPfS_S_
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%r9, %rbx
	movl	%edx, %ebp
	movq	48(%rsp), %r14
	movq	%r14, %r9
	callq	_Z6reduceIfEviiiiPT_S1_
	callq	hipDeviceSynchronize
	movslq	%ebp, %r15
	leaq	(,%r15,4), %rdx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%r15d, %r15d
	jle	.LBB2_1
# %bb.3:                                # %.lr.ph.preheader
	movl	%ebp, %eax
	xorps	%xmm0, %xmm0
	xorl	%ecx, %ecx
.LBB2_4:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	addss	(%rbx,%rcx,4), %xmm0
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB2_4
	jmp	.LBB2_2
.LBB2_1:
	xorps	%xmm0, %xmm0
.LBB2_2:                                # %._crit_edge
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z15sum_one_densityiiiiPfS_S_, .Lfunc_end2-_Z15sum_one_densityiiiiPfS_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z35__device_stub__simple_check_densityPKfiiiPf # -- Begin function _Z35__device_stub__simple_check_densityPKfiiiPf
	.type	_Z35__device_stub__simple_check_densityPKfiiiPf,@function
_Z35__device_stub__simple_check_densityPKfiiiPf: # @_Z35__device_stub__simple_check_densityPKfiiiPf
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	12(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	8(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	32(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z20simple_check_densityPKfiiiPf, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z35__device_stub__simple_check_densityPKfiiiPf, .Lfunc_end3-_Z35__device_stub__simple_check_densityPKfiiiPf
	.cfi_endproc
                                        # -- End function
	.globl	_ZN3LBM20calulate_partial_sumEPKf # -- Begin function _ZN3LBM20calulate_partial_sumEPKf
	.p2align	1, 0x90
	.type	_ZN3LBM20calulate_partial_sumEPKf,@function
_ZN3LBM20calulate_partial_sumEPKf:      # @_ZN3LBM20calulate_partial_sumEPKf
	.cfi_startproc
# %bb.0:
	movq	776(%rdi), %rdi
	movl	$3623720, %esi                  # imm = 0x374B28
	jmp	_Z10reduce_sumPfi               # TAILCALL
.Lfunc_end4:
	.size	_ZN3LBM20calulate_partial_sumEPKf, .Lfunc_end4-_ZN3LBM20calulate_partial_sumEPKf
	.cfi_endproc
                                        # -- End function
	.globl	_Z48__device_stub__collect_data_convergence_interestPKfiiiPf # -- Begin function _Z48__device_stub__collect_data_convergence_interestPKfiiiPf
	.type	_Z48__device_stub__collect_data_convergence_interestPKfiiiPf,@function
_Z48__device_stub__collect_data_convergence_interestPKfiiiPf: # @_Z48__device_stub__collect_data_convergence_interestPKfiiiPf
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	12(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	8(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	32(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z33collect_data_convergence_interestPKfiiiPf, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_Z48__device_stub__collect_data_convergence_interestPKfiiiPf, .Lfunc_end5-_Z48__device_stub__collect_data_convergence_interestPKfiiiPf
	.cfi_endproc
                                        # -- End function
	.globl	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf # -- Begin function _ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	.p2align	1, 0x90
	.type	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf,@function
_ZN3LBM31reduce_a_fraction_of_the_domainEPKf: # @_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	.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
	movq	%rsi, %r14
	movq	%rdi, %rbx
	movl	32(%rdi), %edx
	imull	36(%rdi), %edx
	movl	108(%rdi), %ecx
	imull	28(%rdi), %edx
	leal	3(%rdx), %eax
	testl	%edx, %edx
	cmovnsl	%edx, %eax
	sarl	$2, %eax
	cltd
	idivl	%ecx
                                        # kill: def $eax killed $eax def $rax
	cmpl	$1, %edx
	sbbl	$-1, %eax
	leal	(,%rcx,4), %edx
	btsq	$32, %rcx
	btsq	$32, %rax
	movslq	%edx, %r8
	movq	%rax, %rdi
	movl	$1, %esi
	movq	%rcx, %rdx
	movl	$1, %ecx
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_2
# %bb.1:
	movl	28(%rbx), %esi
	movl	32(%rbx), %edx
	movl	36(%rbx), %ecx
	movq	768(%rbx), %r8
	movq	%r14, %rdi
	callq	_Z48__device_stub__collect_data_convergence_interestPKfiiiPf
.LBB6_2:
	movl	32(%rbx), %eax
	imull	36(%rbx), %eax
	imull	28(%rbx), %eax
	leal	3(%rax), %esi
	testl	%eax, %eax
	cmovnsl	%eax, %esi
	movq	768(%rbx), %rdi
	sarl	$2, %esi
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_Z10reduce_sumPfi               # TAILCALL
.Lfunc_end6:
	.size	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf, .Lfunc_end6-_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	.cfi_endproc
                                        # -- End function
	.globl	_ZN3LBM18cuda_check_densityEi   # -- Begin function _ZN3LBM18cuda_check_densityEi
	.p2align	1, 0x90
	.type	_ZN3LBM18cuda_check_densityEi,@function
_ZN3LBM18cuda_check_densityEi:          # @_ZN3LBM18cuda_check_densityEi
.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	%rbx
	.cfi_def_cfa_offset 40
	subq	$856, %rsp                      # imm = 0x358
	.cfi_def_cfa_offset 896
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%esi, %ebx
	movq	%rdi, %r14
	movq	824(%rdi), %rsi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movss	%xmm0, (%rsp)                   # 4-byte Spill
	movq	832(%r14), %rsi
	movq	%r14, %rdi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movss	%xmm0, 76(%rsp)                 # 4-byte Spill
	movq	840(%r14), %rsi
	movq	%r14, %rdi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movss	%xmm0, 72(%rsp)                 # 4-byte Spill
	movq	848(%r14), %rsi
	movq	%r14, %rdi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movss	%xmm0, 68(%rsp)                 # 4-byte Spill
	movq	856(%r14), %rsi
	movq	%r14, %rdi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movss	%xmm0, 64(%rsp)                 # 4-byte Spill
	movq	864(%r14), %rsi
	movq	%r14, %rdi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movss	%xmm0, 60(%rsp)                 # 4-byte Spill
	movq	872(%r14), %rsi
	movq	%r14, %rdi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movss	%xmm0, 56(%rsp)                 # 4-byte Spill
	movq	880(%r14), %rsi
	movq	%r14, %rdi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movss	%xmm0, 52(%rsp)                 # 4-byte Spill
	movq	888(%r14), %rsi
	movq	%r14, %rdi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movss	%xmm0, 48(%rsp)                 # 4-byte Spill
	movq	896(%r14), %rsi
	movq	%r14, %rdi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movss	%xmm0, 44(%rsp)                 # 4-byte Spill
	movq	904(%r14), %rsi
	movq	%r14, %rdi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movss	%xmm0, 40(%rsp)                 # 4-byte Spill
	movq	912(%r14), %rsi
	movq	%r14, %rdi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movss	%xmm0, 36(%rsp)                 # 4-byte Spill
	movq	920(%r14), %rsi
	movq	%r14, %rdi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movss	%xmm0, 32(%rsp)                 # 4-byte Spill
	movq	928(%r14), %rsi
	movq	%r14, %rdi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movss	%xmm0, 28(%rsp)                 # 4-byte Spill
	movq	936(%r14), %rsi
	movq	%r14, %rdi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movss	%xmm0, 24(%rsp)                 # 4-byte Spill
	movq	944(%r14), %rsi
	movq	%r14, %rdi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movss	%xmm0, 20(%rsp)                 # 4-byte Spill
	movq	952(%r14), %rsi
	movq	%r14, %rdi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movss	%xmm0, 16(%rsp)                 # 4-byte Spill
	movq	960(%r14), %rsi
	movq	%r14, %rdi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movss	%xmm0, 12(%rsp)                 # 4-byte Spill
	movq	968(%r14), %rsi
	movq	%r14, %rdi
	callq	_ZN3LBM31reduce_a_fraction_of_the_domainEPKf
	movl	32(%r14), %eax
	imull	28(%r14), %eax
	movss	%xmm0, 8(%rsp)                  # 4-byte Spill
	imull	36(%r14), %eax
	leal	3(%rax), %ebp
	testl	%eax, %eax
	cmovnsl	%eax, %ebp
	movq	136(%r14), %rcx
	leaq	592(%rsp), %r14
	movl	$256, %esi                      # imm = 0x100
	movl	$.L.str.4, %edx
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	snprintf
	leaq	80(%rsp), %r15
	movq	%r15, %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev
.Ltmp0:
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp1:
# %bb.1:
	xorps	%xmm0, %xmm0
	movss	(%rsp), %xmm1                   # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	addss	%xmm0, %xmm1
	addss	76(%rsp), %xmm1                 # 4-byte Folded Reload
	addss	72(%rsp), %xmm1                 # 4-byte Folded Reload
	addss	68(%rsp), %xmm1                 # 4-byte Folded Reload
	addss	64(%rsp), %xmm1                 # 4-byte Folded Reload
	addss	60(%rsp), %xmm1                 # 4-byte Folded Reload
	addss	56(%rsp), %xmm1                 # 4-byte Folded Reload
	addss	52(%rsp), %xmm1                 # 4-byte Folded Reload
	addss	48(%rsp), %xmm1                 # 4-byte Folded Reload
	addss	44(%rsp), %xmm1                 # 4-byte Folded Reload
	addss	40(%rsp), %xmm1                 # 4-byte Folded Reload
	addss	36(%rsp), %xmm1                 # 4-byte Folded Reload
	addss	32(%rsp), %xmm1                 # 4-byte Folded Reload
	addss	28(%rsp), %xmm1                 # 4-byte Folded Reload
	addss	24(%rsp), %xmm1                 # 4-byte Folded Reload
	addss	20(%rsp), %xmm1                 # 4-byte Folded Reload
	addss	16(%rsp), %xmm1                 # 4-byte Folded Reload
	addss	12(%rsp), %xmm1                 # 4-byte Folded Reload
	addss	8(%rsp), %xmm1                  # 4-byte Folded Reload
	sarl	$2, %ebp
	movss	%xmm1, (%rsp)                   # 4-byte Spill
	ucomiss	%xmm0, %xmm1
	movq	80(%rsp), %rax
	movq	-24(%rax), %rax
	movq	$10, 88(%rsp,%rax)
	jne	.LBB7_2
	jnp	.LBB7_14
.LBB7_2:
.Ltmp20:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.5, %esi
	movl	$23, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp21:
# %bb.3:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	xorps	%xmm0, %xmm0
	cvtsi2ss	%ebp, %xmm0
	movss	(%rsp), %xmm1                   # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	divss	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	cvtss2sd	%xmm1, %xmm0
.Ltmp22:
	movl	$_ZSt4cout, %edi
	movsd	%xmm0, (%rsp)                   # 8-byte Spill
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp23:
# %bb.4:                                # %_ZNSolsEf.exit
	movq	%rax, %r14
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
.Ltmp24:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp25:
# %bb.5:                                # %.noexc
.Ltmp26:
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
.Ltmp27:
# %bb.6:                                # %.noexc42
.Ltmp28:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp29:
# %bb.7:                                # %_ZNSolsEPFRSoS_E.exit
.Ltmp30:
	leaq	80(%rsp), %rdi
	movl	%ebx, %esi
	callq	_ZNSolsEi
.Ltmp31:
# %bb.8:
.Ltmp32:
	movq	%rax, %rbx
	movl	$.L.str.6, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp33:
# %bb.9:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit31
.Ltmp34:
	movq	%rbx, %rdi
	movsd	(%rsp), %xmm0                   # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp35:
# %bb.10:                               # %_ZNSolsEf.exit32
.Ltmp36:
	movq	%rax, %rbx
	movl	$.L.str.6, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp37:
# %bb.11:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit33
.Ltmp38:
	xorps	%xmm0, %xmm0
	movq	%rbx, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp39:
# %bb.12:                               # %_ZNSolsEf.exit34
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
.Ltmp40:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp41:
	jmp	.LBB7_23
.LBB7_14:
.Ltmp2:
	movl	$_ZSt4cout, %r14d
	movl	$_ZSt4cout, %edi
	movl	$.L.str.7, %esi
	movl	$40, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp3:
# %bb.15:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit36
	movq	_ZSt4cout(%rip), %rax
	addq	-24(%rax), %r14
.Ltmp4:
	movq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp5:
# %bb.16:                               # %.noexc48
.Ltmp6:
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
.Ltmp7:
# %bb.17:                               # %.noexc49
.Ltmp8:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp9:
# %bb.18:                               # %_ZNSolsEPFRSoS_E.exit37
.Ltmp10:
	leaq	80(%rsp), %rdi
	movl	%ebx, %esi
	callq	_ZNSolsEi
.Ltmp11:
# %bb.19:
.Ltmp12:
	movq	%rax, %rbx
	movl	$.L.str.6, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp13:
# %bb.20:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit38
	cvtsi2ss	%ebp, %xmm0
	movss	(%rsp), %xmm1                   # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	divss	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	cvtss2sd	%xmm1, %xmm0
.Ltmp14:
	movq	%rbx, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp15:
# %bb.21:                               # %_ZNSolsEf.exit39
.Ltmp16:
	movq	%rax, %rbx
	movl	$.L.str.8, %esi
	movl	$10, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp17:
# %bb.22:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit40
	movq	(%rbx), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
.Ltmp18:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp19:
.LBB7_23:                               # %.noexc52.invoke
.Ltmp42:
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
.Ltmp43:
# %bb.24:                               # %.noexc53.invoke
.Ltmp44:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp45:
# %bb.25:                               # %_ZNSolsEPFRSoS_E.exit35
.Ltmp46:
	leaq	80(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp47:
# %bb.26:
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	88(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 80(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	328(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	addq	$856, %rsp                      # imm = 0x358
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB7_13:
	.cfi_def_cfa_offset 896
.Ltmp48:
	movq	%rax, %rbx
	leaq	80(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end7:
	.size	_ZN3LBM18cuda_check_densityEi, .Lfunc_end7-_ZN3LBM18cuda_check_densityEi
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table7:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp47-.Ltmp0                 #   Call between .Ltmp0 and .Ltmp47
	.uleb128 .Ltmp48-.Lfunc_begin0          #     jumps to .Ltmp48
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp47-.Lfunc_begin0          # >> Call Site 3 <<
	.uleb128 .Lfunc_end7-.Ltmp47            #   Call between .Ltmp47 and .Lfunc_end7
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB8_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB8_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z20simple_check_densityPKfiiiPf, %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	$_Z33collect_data_convergence_interestPKfiiiPf, %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_end8:
	.size	__hip_module_ctor, .Lfunc_end8-__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	.LBB9_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
.LBB9_2:
	retq
.Lfunc_end9:
	.size	__hip_module_dtor, .Lfunc_end9-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"density check: Integral density="
	.size	.L.str, 33

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

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

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	" x,y,z: "
	.size	.L.str.3, 9

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

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

	.type	.L.str.4,@object                # @.str.4
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.4:
	.asciz	"LBM2_%s_convergence.log"
	.size	.L.str.4, 24

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	" cuda Integral density:"
	.size	.L.str.5, 24

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

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	" n_sum=0! potentially wrong! check code!"
	.size	.L.str.7, 41

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	" WARNING! "
	.size	.L.str.8, 11

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

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z33collect_data_convergence_interestPKfiiiPf"
	.size	.L__unnamed_2, 46

	.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 _Z35__device_stub__simple_check_densityPKfiiiPf
	.addrsig_sym _Z48__device_stub__collect_data_convergence_interestPKfiiiPf
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _ZSt4cout
	.addrsig_sym _Z20simple_check_densityPKfiiiPf
	.addrsig_sym _Z33collect_data_convergence_interestPKfiiiPf
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z20simple_check_densityPKfiiiPf ; -- Begin function _Z20simple_check_densityPKfiiiPf
	.globl	_Z20simple_check_densityPKfiiiPf
	.p2align	8
	.type	_Z20simple_check_densityPKfiiiPf,@function
_Z20simple_check_densityPKfiiiPf:       ; @_Z20simple_check_densityPKfiiiPf
; %bb.0:
	s_clause 0x1
	s_load_b64 s[2:3], s[0:1], 0x8
	s_load_b32 s4, s[0:1], 0x2c
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s3, s3, s2
	s_and_b32 s4, s4, 0xffff
	s_ashr_i32 s5, s3, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s3, s3, s5
	s_xor_b32 s3, s3, s5
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_f32_u32_e32 v1, s3
	v_rcp_iflag_f32_e32 v1, v1
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v1, 0x4f7ffffe, v1
	s_delay_alu instid0(VALU_DEP_1)
	v_cvt_u32_f32_e32 v3, v1
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	s_sub_i32 s4, 0, s3
	s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1)
	v_mul_lo_u32 v0, s4, v3
	s_ashr_i32 s4, s2, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	s_add_i32 s5, s2, s4
	v_ashrrev_i32_e32 v2, 31, v1
	s_xor_b32 s4, s5, s4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v0, v3, v0
	v_add_nc_u32_e32 v0, v3, v0
	v_cvt_f32_u32_e32 v3, s4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_iflag_f32_e32 v3, v3
	s_waitcnt_depctr 0xfff
	v_dual_mul_f32 v3, 0x4f7ffffe, v3 :: v_dual_add_nc_u32 v4, v1, v2
	v_xor_b32_e32 v4, v4, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cvt_u32_f32_e32 v3, v3
	v_mul_hi_u32 v0, v4, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v0, v0, s3
	v_sub_nc_u32_e32 v0, v4, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_subrev_nc_u32_e32 v4, s3, v0
	v_cmp_le_u32_e32 vcc_lo, s3, v0
	v_cndmask_b32_e32 v0, v0, v4, vcc_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_subrev_nc_u32_e32 v4, s3, v0
	v_cmp_le_u32_e32 vcc_lo, s3, v0
	s_sub_i32 s3, 0, s4
	s_cmp_gt_i32 s2, -1
	s_cselect_b32 s2, -1, 0
	v_cndmask_b32_e32 v0, v0, v4, vcc_lo
	v_mul_lo_u32 v4, s3, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_xor_b32_e32 v0, v0, v2
	v_mul_hi_u32 v4, v3, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v0, v0, v2
	v_ashrrev_i32_e32 v5, 31, v0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v3, v3, v4
	v_add_nc_u32_e32 v0, v0, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_xor_b32_e32 v0, v0, v5
	v_mul_hi_u32 v3, v0, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v3, v3, s4
	v_sub_nc_u32_e32 v0, v0, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_subrev_nc_u32_e32 v3, s4, v0
	v_cmp_le_u32_e32 vcc_lo, s4, v0
	v_cndmask_b32_e32 v0, v0, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_subrev_nc_u32_e32 v3, s4, v0
	v_cmp_le_u32_e32 vcc_lo, s4, v0
	v_cndmask_b32_e32 v0, v0, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_xor_b32_e32 v0, v0, v5
	v_sub_nc_u32_e32 v0, v0, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_lt_i32_e32 vcc_lo, -2, v0
	s_and_b32 s2, s2, vcc_lo
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_load_b64 s[2:3], s[0:1], 0x0
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_load_b64 s[0:1], s[0:1], 0x18
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, s2, v0
	v_add_co_ci_u32_e32 v3, vcc_lo, s3, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_load_b32 v2, v[2:3], off
	s_waitcnt vmcnt(0)
	global_store_b32 v[0:1], v2, off
.LBB0_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z20simple_check_densityPKfiiiPf
		.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_end0:
	.size	_Z20simple_check_densityPKfiiiPf, .Lfunc_end0-_Z20simple_check_densityPKfiiiPf
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 484
; 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
	.protected	_Z33collect_data_convergence_interestPKfiiiPf ; -- Begin function _Z33collect_data_convergence_interestPKfiiiPf
	.globl	_Z33collect_data_convergence_interestPKfiiiPf
	.p2align	8
	.type	_Z33collect_data_convergence_interestPKfiiiPf,@function
_Z33collect_data_convergence_interestPKfiiiPf: ; @_Z33collect_data_convergence_interestPKfiiiPf
; %bb.0:
	s_clause 0x2
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[2:3], s[0:1], 0x18
	s_load_b32 s0, s[0:1], 0x2c
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s7, s7, s6
	s_and_b32 s0, s0, 0xffff
	s_ashr_i32 s8, s7, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s7, s7, s8
	s_xor_b32 s7, s7, s8
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_f32_u32_e32 v1, s7
	v_rcp_iflag_f32_e32 v1, v1
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v1, 0x4f7ffffe, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_3)
	v_cvt_u32_f32_e32 v3, v1
	v_mad_u64_u32 v[1:2], null, s15, s0, v[0:1]
	s_sub_i32 s0, 0, s7
	v_lshl_add_u32 v0, v0, 2, 0
	v_mul_lo_u32 v2, s0, v3
	s_ashr_i32 s0, s6, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	s_add_i32 s1, s6, s0
	v_bfe_i32 v5, v1, 29, 1
	s_xor_b32 s0, s1, s0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	s_sub_i32 s1, 0, s0
	v_mul_hi_u32 v2, v3, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v2, v3, v2
	v_cvt_f32_u32_e32 v3, s0
	v_rcp_iflag_f32_e32 v3, v3
	s_waitcnt_depctr 0xfff
	v_dual_mul_f32 v3, 0x4f7ffffe, v3 :: v_dual_lshlrev_b32 v4, 2, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v6, v4, v5
	v_cvt_u32_f32_e32 v3, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_xor_b32_e32 v7, v6, v5
	v_add_nc_u32_e32 v6, 3, v6
	v_mul_hi_u32 v2, v7, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_xor_b32_e32 v6, v6, v5
	v_mul_lo_u32 v2, v2, s7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v2, v7, v2
	v_subrev_nc_u32_e32 v7, s7, v2
	v_cmp_le_u32_e32 vcc_lo, s7, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v2, v2, v7, vcc_lo
	v_subrev_nc_u32_e32 v7, s7, v2
	v_cmp_le_u32_e32 vcc_lo, s7, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v2, v2, v7, vcc_lo
	v_mul_lo_u32 v7, s1, v3
	v_xor_b32_e32 v2, v2, v5
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_hi_u32 v7, v3, v7
	v_sub_nc_u32_e32 v2, v2, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_ashrrev_i32_e32 v8, 31, v2
	v_add_nc_u32_e32 v3, v3, v7
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v2, v2, v8
	v_mul_hi_u32 v7, v6, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_xor_b32_e32 v2, v2, v8
	v_mul_hi_u32 v3, v2, v3
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v7, v7, s0
	v_mul_lo_u32 v3, v3, s0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v6, v6, v7
	v_cmp_le_u32_e32 vcc_lo, s0, v6
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v2, v2, v3
	v_subrev_nc_u32_e32 v3, s0, v6
	v_subrev_nc_u32_e32 v7, s0, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v3, v6, v3, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s0, v2
	v_subrev_nc_u32_e32 v6, s0, v3
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v2, v2, v7, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s0, v3
	v_subrev_nc_u32_e32 v7, s0, v2
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v3, v3, v6, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s0, v2
	v_xor_b32_e32 v3, v3, v5
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v2, v2, v7, vcc_lo
	v_sub_nc_u32_e32 v3, v3, v5
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_xor_b32_e32 v2, v2, v8
	v_sub_nc_u32_e32 v2, v8, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add3_u32 v2, v3, v2, v4
	v_ashrrev_i32_e32 v3, 31, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	v_add_co_u32 v2, vcc_lo, s4, v2
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v3, vcc_lo
	global_load_b32 v2, v[2:3], off
	s_waitcnt vmcnt(0)
	ds_store_b32 v0, v2
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	ds_load_b32 v3, v0
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	v_add_co_u32 v0, vcc_lo, s2, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	s_waitcnt lgkmcnt(0)
	global_store_b32 v[0:1], v3, off
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z33collect_data_convergence_interestPKfiiiPf
		.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 9
		.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	_Z33collect_data_convergence_interestPKfiiiPf, .Lfunc_end1-_Z33collect_data_convergence_interestPKfiiiPf
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 624
; NumSgprs: 18
; NumVgprs: 9
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 9
; 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
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z20simple_check_densityPKfiiiPf
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z20simple_check_densityPKfiiiPf.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     6
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
      - .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:           _Z33collect_data_convergence_interestPKfiiiPf
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z33collect_data_convergence_interestPKfiiiPf.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     9
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
