#include "global_defines.cuh"
#include <numeric>




void LBM::relaxation(){





	/*One-step density relaxation process

				c.......density relaxation: a single time relaxation with relaxation
				c       parameter omega is applied here. This step is only "local",
				c       nothing is propagated through the lattice.
				c*/

	if(data_location==GPU)
		copy_data_from_device_to_host();

	int  x,y,z;
	FLOATING  u_x=0.0, u_y=0.0, u_z=0.0, u_squ=0.0, rho=0.0, reciprocal_rho=0.0;




	FLOATING u_n[19];
	//	FLOATING n_equ[19];
	FLOATING buff[19];

	//	FLOATING u_n_squared[19];
	//FLOATING two_x_c_squ_sqared;
	const FLOATING omega_x_t_0=omega*t_0, omega_x_t_1=omega*t_1, omega_x_t_2=omega*t_2;
	FLOATING omega_x_rho_x_t_0, omega_x_rho_x_t_1, omega_x_rho_x_t_2;
	FLOATING temp_factor;
	FLOATING u_n__over__c_squ[19];
	FLOATING u_n__over__c_squ__squared_and_halved[19];

	//....square speed of sound
	/*      compute the out let velocity with a convevtive boundary condition
					c.....loop over all nodes
					c.....attention: actual densities are stored after the propagation
					c                step in the help-array n_hlp !*/


#pragma unroll
	for (z = 0 ; z< lz ; ++z){
#pragma unroll
		for (y = 0 ; y< ly ; ++y){
#pragma unroll
			for (x = 0 ; x< lx; ++x){

				/*c.........only free nodes are considered here
					!if (.not. obstacles[z][y][x]) then
					c...........integral local density
					c...........initialize variable ro*/
				//memory optimised implementation
				buff[0]=D3_hlp.Q0[index(z,y,x)];
				buff[1]=D3_hlp.Q1[index(z,y,x)];
				buff[2]=D3_hlp.Q2[index(z,y,x)];
				buff[3]=D3_hlp.Q3[index(z,y,x)];
				buff[4]=D3_hlp.Q4[index(z,y,x)];
				buff[5]=D3_hlp.Q5[index(z,y,x)];
				buff[6]=D3_hlp.Q6[index(z,y,x)];
				buff[7]=D3_hlp.Q7[index(z,y,x)];
				buff[8]=D3_hlp.Q8[index(z,y,x)];
				buff[9]=D3_hlp.Q9[index(z,y,x)];
				buff[10]=D3_hlp.Q10[index(z,y,x)];
				buff[11]=D3_hlp.Q11[index(z,y,x)];
				buff[12]=D3_hlp.Q12[index(z,y,x)];
				buff[13]=D3_hlp.Q13[index(z,y,x)];
				buff[14]=D3_hlp.Q14[index(z,y,x)];
				buff[15]=D3_hlp.Q15[index(z,y,x)];
				buff[16]=D3_hlp.Q16[index(z,y,x)];
				buff[17]=D3_hlp.Q17[index(z,y,x)];
				buff[18]=D3_hlp.Q18[index(z,y,x)];

				rho=accumulate(buff, buff+DENSITIES, 0.0);

				reciprocal_rho=1.0/rho;




				switch(obstacles[index(z,y,x)]){
				case 1:
					u_x = 0.0;
					u_y = 0.0;
					u_z = 0.0;
					break;
				default:
					u_x = 0.0;
					u_x =  reciprocal_rho*(buff[1] + buff[7] + buff[10] +buff[11] + buff[14]-
							(buff[3] + buff[8] + buff[9] +buff[12] + buff[13]));

					u_y = 0.0;
					u_y =  reciprocal_rho*(buff[2]+buff[8]+buff[7]+buff[16] + buff[15] -
							(buff[4] + buff[9] + buff[10] +buff[17] + buff[18]));

					u_z = 0.0;
					u_z =  reciprocal_rho*(buff[5]+buff[13]+buff[14]+buff[15]+buff[18]-
							(buff[6]+buff[12]+buff[11]+buff[16]+buff[17]));
					break;
				}//switch(obstacles[index(z,y,x)])

				//original implementation
				//				rho=0.0;
				//				rho+=D3_hlp.Q0[index(z,y,x)]+D3_hlp.Q1[index(z,y,x)]+D3_hlp.Q2[index(z,y,x)]+D3_hlp.Q3[index(z,y,x)];
				//				rho+=D3_hlp.Q4[index(z,y,x)]+D3_hlp.Q5[index(z,y,x)]+D3_hlp.Q6[index(z,y,x)]+D3_hlp.Q7[index(z,y,x)];
				//				rho+=D3_hlp.Q8[index(z,y,x)]+D3_hlp.Q9[index(z,y,x)]+D3_hlp.Q10[index(z,y,x)]+D3_hlp.Q11[index(z,y,x)];
				//				rho+=D3_hlp.Q12[index(z,y,x)]+D3_hlp.Q13[index(z,y,x)]+D3_hlp.Q14[index(z,y,x)]+D3_hlp.Q15[index(z,y,x)];
				//				rho+=D3_hlp.Q16[index(z,y,x)]+D3_hlp.Q17[index(z,y,x)]+D3_hlp.Q18[index(z,y,x)];
				//				reciprocal_rho=1.0/rho;

				//...........x-, and y- velocity components

				//				switch(obstacles[index(z,y,x)]){
				//				case 1:
				//					u_x = 0.0;
				//					u_y = 0.0;
				//					u_z = 0.0;
				//					break;
				//				default:
				//					u_x = (FLOATING) reciprocal_rho*(D3_hlp.Q1[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
				//							D3_hlp.Q11[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] -
				//							(D3_hlp.Q3[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] +
				//									D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)]));
				//
				//					u_y = (FLOATING) reciprocal_rho*(D3_hlp.Q2[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] +
				//							D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q15[index(z,y,x)] -
				//							(D3_hlp.Q4[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
				//									D3_hlp.Q17[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)]));
				//
				//					u_z = (FLOATING) reciprocal_rho*(D3_hlp.Q5[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] +
				//							D3_hlp.Q15[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)] -
				//							(D3_hlp.Q6[index(z,y,x)] + D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q11[index(z,y,x)] +
				//									D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q17[index(z,y,x)]));
				//					break;
				//				}//switch(obstacles[index(z,y,x)])




				u_squ = (FLOATING)  u_x*u_x + u_y*u_y + u_z*u_z;
				temp_factor= 0.5*(2.0* c_squ - u_squ)/c_squ;
				//u_squ = (FLOATING)  pow(u_x,2) + pow(u_y,2) + pow(u_z,2);


				/*...........n- velocity compnents (n = lattice node connection vectors)
					c...........this is only necessary for clearence, and only 3 speeds would
					c...........be necessary*/


				//WARNING!!!! o pinakas autos exei tropopoihmena indices!!!!
				u_n[0]= 0.0; //SHOULD NEVER USED!
				u_n[1] =   u_x;
				u_n[2] =         u_y;
				u_n[3] = - u_x;
				u_n[4] =       - u_y;
				u_n[5] =   u_z;
				u_n[6] =       - u_z;
				u_n[7] =   u_x + u_y;
				u_n[8] = - u_x + u_y;
				u_n[9] = - u_x - u_y;
				u_n[10] =   u_x - u_y;
				u_n[11] =   u_x - u_z;
				u_n[12] = - u_x - u_z;
				u_n[13] = - u_x + u_z;
				u_n[14] =   u_x + u_z;
				u_n[15] =   u_z + u_y;
				u_n[16] = - u_z + u_y;
				u_n[17] = - u_z - u_y;
				u_n[18] =   u_z - u_y;

#pragma unroll
				for(int i=0; i<DENSITIES; ++i){
					u_n__over__c_squ[i]=reciprocal_c_squ*u_n[i];
					u_n__over__c_squ__squared_and_halved[i]=0.5*u_n__over__c_squ[i]*u_n__over__c_squ[i];
				}

				/*c...........equilibrium densities
					c...........this can be rewritten to improve computational performance
					c...........considerabely !
					c
					c...........zero velocity density
					c*/
				//memory optimised implementation! WARNING!!! different from the original case!

				//two_x_c_squ_sqared=2.0*c_squ*c_squ;
				omega_x_rho_x_t_0=omega_x_t_0*rho;
				omega_x_rho_x_t_1=omega_x_t_1*rho;
				omega_x_rho_x_t_2=omega_x_t_2*rho;


				//				//...........relaxation step


				//omega_x_rho_x_t_0*(1.0 - 0.5*u_squ/c_squ);
				D3.Q0[index(z,y,x)]=buff[0]*one_minus_omega+omega_x_rho_x_t_0*(u_n__over__c_squ__squared_and_halved[0]+u_n__over__c_squ[0]+temp_factor);




				D3.Q1[index(z,y,x)]=buff[1]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[1]+u_n__over__c_squ[1]+temp_factor);
				D3.Q2[index(z,y,x)]=buff[2]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[2]+u_n__over__c_squ[2]+temp_factor);
				D3.Q3[index(z,y,x)]=buff[3]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[3]+u_n__over__c_squ[3]+temp_factor);
				D3.Q4[index(z,y,x)]=buff[4]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[4]+u_n__over__c_squ[4]+temp_factor);
				D3.Q5[index(z,y,x)]=buff[5]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[5]+u_n__over__c_squ[5]+temp_factor);
				D3.Q6[index(z,y,x)]=buff[6]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[6]+u_n__over__c_squ[6]+temp_factor);



				D3.Q7[index(z,y,x)]= buff[ 7]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 7]+u_n__over__c_squ[ 7]+temp_factor);
				D3.Q8[index(z,y,x)]= buff[ 8]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 8]+u_n__over__c_squ[ 8]+temp_factor);
				D3.Q9[index(z,y,x)]= buff[ 9]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 9]+u_n__over__c_squ[ 9]+temp_factor);
				D3.Q10[index(z,y,x)]=buff[10]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[10]+u_n__over__c_squ[10]+temp_factor);
				D3.Q11[index(z,y,x)]=buff[11]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[11]+u_n__over__c_squ[11]+temp_factor);
				D3.Q12[index(z,y,x)]=buff[12]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[12]+u_n__over__c_squ[12]+temp_factor);
				D3.Q13[index(z,y,x)]=buff[13]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[13]+u_n__over__c_squ[13]+temp_factor);
				D3.Q14[index(z,y,x)]=buff[14]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[14]+u_n__over__c_squ[14]+temp_factor);
				D3.Q15[index(z,y,x)]=buff[15]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[15]+u_n__over__c_squ[15]+temp_factor);
				D3.Q16[index(z,y,x)]=buff[16]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[16]+u_n__over__c_squ[16]+temp_factor);
				D3.Q17[index(z,y,x)]=buff[17]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[17]+u_n__over__c_squ[17]+temp_factor);
				D3.Q18[index(z,y,x)]=buff[18]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[18]+u_n__over__c_squ[18]+temp_factor);

				//original implementation
				//				n_equ[0] = t_0  * rho*(1.0 - u_squ / (2.0 * c_squ));
				//
				//								//...........axis speeds (factor: t_1)
				//				#pragma unroll
				//								for (int i = 1 ; i< 7; ++i){
				//									n_equ[i] = t_1 * rho*(1.0 + u_n[i] / c_squ
				//											+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
				//											- u_squ / (2.0  * c_squ));
				//								}
				//
				//								//...........diagonal speeds (factor: t_2)
				//				#pragma unroll
				//								for (int i = 7 ; i< 19; ++i){
				//									n_equ[i] = t_2  * rho*(1.0 + u_n[i] / c_squ
				//											+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
				//											- u_squ / (2.0  * c_squ));
				//								}

				//				D3.Q0[index(z,y,x)]=D3_hlp.Q0[index(z,y,x)]+omega*(n_equ[0] - D3_hlp.Q0[index(z,y,x)]);
				//								D3.Q1[index(z,y,x)]=D3_hlp.Q1[index(z,y,x)]+omega*(n_equ[1] - D3_hlp.Q1[index(z,y,x)]);
				//								D3.Q2[index(z,y,x)]=D3_hlp.Q2[index(z,y,x)]+omega*(n_equ[2] - D3_hlp.Q2[index(z,y,x)]);
				//								D3.Q3[index(z,y,x)]=D3_hlp.Q3[index(z,y,x)]+omega*(n_equ[3] - D3_hlp.Q3[index(z,y,x)]);
				//								D3.Q4[index(z,y,x)]=D3_hlp.Q4[index(z,y,x)]+omega*(n_equ[4] - D3_hlp.Q4[index(z,y,x)]);
				//								D3.Q5[index(z,y,x)]=D3_hlp.Q5[index(z,y,x)]+omega*(n_equ[5] - D3_hlp.Q5[index(z,y,x)]);
				//								D3.Q6[index(z,y,x)]=D3_hlp.Q6[index(z,y,x)]+omega*(n_equ[6] - D3_hlp.Q6[index(z,y,x)]);
				//								D3.Q7[index(z,y,x)]=D3_hlp.Q7[index(z,y,x)]+omega*(n_equ[7] - D3_hlp.Q7[index(z,y,x)]);
				//								D3.Q8[index(z,y,x)]=D3_hlp.Q8[index(z,y,x)]+omega*(n_equ[8] - D3_hlp.Q8[index(z,y,x)]);
				//								D3.Q9[index(z,y,x)]=D3_hlp.Q9[index(z,y,x)]+omega*(n_equ[9] - D3_hlp.Q9[index(z,y,x)]);
				//								D3.Q10[index(z,y,x)]=D3_hlp.Q10[index(z,y,x)]+omega*(n_equ[10] - D3_hlp.Q10[index(z,y,x)]);
				//								D3.Q11[index(z,y,x)]=D3_hlp.Q11[index(z,y,x)]+omega*(n_equ[11] - D3_hlp.Q11[index(z,y,x)]);
				//								D3.Q12[index(z,y,x)]=D3_hlp.Q12[index(z,y,x)]+omega*(n_equ[12] - D3_hlp.Q12[index(z,y,x)]);
				//								D3.Q13[index(z,y,x)]=D3_hlp.Q13[index(z,y,x)]+omega*(n_equ[13] - D3_hlp.Q13[index(z,y,x)]);
				//								D3.Q14[index(z,y,x)]=D3_hlp.Q14[index(z,y,x)]+omega*(n_equ[14] - D3_hlp.Q14[index(z,y,x)]);
				//								D3.Q15[index(z,y,x)]=D3_hlp.Q15[index(z,y,x)]+omega*(n_equ[15] - D3_hlp.Q15[index(z,y,x)]);
				//								D3.Q16[index(z,y,x)]=D3_hlp.Q16[index(z,y,x)]+omega*(n_equ[16] - D3_hlp.Q16[index(z,y,x)]);
				//								D3.Q17[index(z,y,x)]=D3_hlp.Q17[index(z,y,x)]+omega*(n_equ[17] - D3_hlp.Q17[index(z,y,x)]);
				//								D3.Q18[index(z,y,x)]=D3_hlp.Q18[index(z,y,x)]+omega*(n_equ[18] - D3_hlp.Q18[index(z,y,x)]);

				if (x == lx-2) {
					u_previous_spatial_boundary[index2D(z,y)] = u_x;
					v_previous_spatial_boundary[index2D(z,y)] = u_y;
					w_previous_spatial_boundary[index2D(z,y)] = u_z;

					u_current[index2D(z,y)] = u_x;
					v_current[index2D(z,y)] = u_y;
					w_current[index2D(z,y)] = u_z;

				}//if (x == lx-2)
			}//for (x = 0 ; x< lx; ++x)
		}//for (y = 0 ; y< ly ; ++y)
	}//for (z = 0 ; z< lz ; ++z)
#ifdef DEBUG
	cout << " #LBM relaxation OK!" << endl;
#endif
}

void LBM::initial_relaxation(){





	/*One-step density relaxation process

				c.......density relaxation: a single time relaxation with relaxation
				c       parameter omega is applied here. This step is only "local",
				c       nothing is propagated through the lattice.
				c*/

	int  x,y,z;
	FLOATING  u_x=0.0, u_y=0.0, u_z=0.0, u_squ=0.0, rho=0.0;
	const FLOATING  tau=3.0*nu + 0.5, omega = 1.0 /tau; //	omega=1.0/(3.0*nu+0.5);



	FLOATING u_n[19], n_equ[19];

	//....square speed of sound
	/*      compute the out let velocity with a convevtive boundary condition
					c.....loop over all nodes
					c.....attention: actual densities are stored after the propagation
					c                step in the help-array n_hlp !*/



	for (z = 0 ; z< lz ; ++z){
		for (y = 0 ; y< ly ; ++y){
			for (x = 0 ; x< lx; ++x){

				/*c.........only free nodes are considered here
					!if (.not. obstacles[z][y][x]) then
					c...........integral local density
					c...........initialize variable ro*/


				rho=0.0;
				rho+=D3_hlp.Q0[index(z,y,x)]+D3_hlp.Q1[index(z,y,x)]+D3_hlp.Q2[index(z,y,x)]+D3_hlp.Q3[index(z,y,x)];
				rho+=D3_hlp.Q4[index(z,y,x)]+D3_hlp.Q5[index(z,y,x)]+D3_hlp.Q6[index(z,y,x)]+D3_hlp.Q7[index(z,y,x)];
				rho+=D3_hlp.Q8[index(z,y,x)]+D3_hlp.Q9[index(z,y,x)]+D3_hlp.Q10[index(z,y,x)]+D3_hlp.Q11[index(z,y,x)];
				rho+=D3_hlp.Q12[index(z,y,x)]+D3_hlp.Q13[index(z,y,x)]+D3_hlp.Q14[index(z,y,x)]+D3_hlp.Q15[index(z,y,x)];
				rho+=D3_hlp.Q16[index(z,y,x)]+D3_hlp.Q17[index(z,y,x)]+D3_hlp.Q18[index(z,y,x)];


				//...........x-, and y- velocity components


				if ( obstacles[index(z,y,x)]==1 ) {
					u_x = 0.0;
					u_y = 0.0;
					u_z = 0.0;
				}else{





					u_x = (FLOATING) (D3_hlp.Q1[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
							D3_hlp.Q11[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] -
							(D3_hlp.Q3[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] +
									D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)])) / rho;

					u_y = (FLOATING) (D3_hlp.Q2[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] +
							D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q15[index(z,y,x)] -
							(D3_hlp.Q4[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
									D3_hlp.Q17[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)])) / rho;

					u_z = (FLOATING) (D3_hlp.Q5[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] +
							D3_hlp.Q15[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)] -
							(D3_hlp.Q6[index(z,y,x)] + D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q11[index(z,y,x)] +
									D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q17[index(z,y,x)])) / rho;

				}

				u_squ = (FLOATING)  u_x*u_x + u_y*u_y + u_z*u_z;
				//u_squ = (FLOATING)  pow(u_x,2) + pow(u_y,2) + pow(u_z,2);


				/*...........n- velocity compnents (n = lattice node connection vectors)
					c...........this is only necessary for clearence, and only 3 speeds would
					c...........be necessary*/

				//WARNING!!!! o pinakas autos exei tropopoihmena indices!!!!
				u_n[0]= 0.0; //SHOULD NEVER USED!
				u_n[1] =   u_x;
				u_n[2] =         u_y;
				u_n[3] = - u_x;
				u_n[4] =       - u_y;
				u_n[5] =   u_z;
				u_n[6] =       - u_z;
				u_n[7] =   u_x + u_y;
				u_n[8] = - u_x + u_y;
				u_n[9] = - u_x - u_y;
				u_n[10] =   u_x - u_y;
				u_n[11] =   u_x - u_z;
				u_n[12] = - u_x - u_z;
				u_n[13] = - u_x + u_z;
				u_n[14] =   u_x + u_z;
				u_n[15] =   u_z + u_y;
				u_n[16] = - u_z + u_y;
				u_n[17] = - u_z - u_y;
				u_n[18] =   u_z - u_y;

				/*c...........equilibrium densities
					c...........this can be rewritten to improve computational performance
					c...........considerabely !
					c
					c...........zero velocity density
					c*/
				n_equ[0] = t_0  * rho*(1.0 - u_squ / (2.0 * c_squ));

				//...........axis speeds (factor: t_1)
				for (int i = 1 ; i< 7; ++i){
					n_equ[i] = t_1 * rho*(1.0 + u_n[i] / c_squ
							+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
							- u_squ / (2.0  * c_squ));
				}

				//...........diagonal speeds (factor: t_2)
				for (int i = 7 ; i< 19; ++i){
					n_equ[i] = t_2  * rho*(1.0 + u_n[i] / c_squ
							+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
							- u_squ / (2.0  * c_squ));
				}


				//...........relaxation step




				D3.Q0[index(z,y,x)]=D3_hlp.Q0[index(z,y,x)]+omega*(n_equ[0] - D3_hlp.Q0[index(z,y,x)]);
				D3.Q1[index(z,y,x)]=D3_hlp.Q1[index(z,y,x)]+omega*(n_equ[1] - D3_hlp.Q1[index(z,y,x)]);
				D3.Q2[index(z,y,x)]=D3_hlp.Q2[index(z,y,x)]+omega*(n_equ[2] - D3_hlp.Q2[index(z,y,x)]);
				D3.Q3[index(z,y,x)]=D3_hlp.Q3[index(z,y,x)]+omega*(n_equ[3] - D3_hlp.Q3[index(z,y,x)]);
				D3.Q4[index(z,y,x)]=D3_hlp.Q4[index(z,y,x)]+omega*(n_equ[4] - D3_hlp.Q4[index(z,y,x)]);
				D3.Q5[index(z,y,x)]=D3_hlp.Q5[index(z,y,x)]+omega*(n_equ[5] - D3_hlp.Q5[index(z,y,x)]);
				D3.Q6[index(z,y,x)]=D3_hlp.Q6[index(z,y,x)]+omega*(n_equ[6] - D3_hlp.Q6[index(z,y,x)]);
				D3.Q7[index(z,y,x)]=D3_hlp.Q7[index(z,y,x)]+omega*(n_equ[7] - D3_hlp.Q7[index(z,y,x)]);
				D3.Q8[index(z,y,x)]=D3_hlp.Q8[index(z,y,x)]+omega*(n_equ[8] - D3_hlp.Q8[index(z,y,x)]);
				D3.Q9[index(z,y,x)]=D3_hlp.Q9[index(z,y,x)]+omega*(n_equ[9] - D3_hlp.Q9[index(z,y,x)]);
				D3.Q10[index(z,y,x)]=D3_hlp.Q10[index(z,y,x)]+omega*(n_equ[10] - D3_hlp.Q10[index(z,y,x)]);
				D3.Q11[index(z,y,x)]=D3_hlp.Q11[index(z,y,x)]+omega*(n_equ[11] - D3_hlp.Q11[index(z,y,x)]);
				D3.Q12[index(z,y,x)]=D3_hlp.Q12[index(z,y,x)]+omega*(n_equ[12] - D3_hlp.Q12[index(z,y,x)]);
				D3.Q13[index(z,y,x)]=D3_hlp.Q13[index(z,y,x)]+omega*(n_equ[13] - D3_hlp.Q13[index(z,y,x)]);
				D3.Q14[index(z,y,x)]=D3_hlp.Q14[index(z,y,x)]+omega*(n_equ[14] - D3_hlp.Q14[index(z,y,x)]);
				D3.Q15[index(z,y,x)]=D3_hlp.Q15[index(z,y,x)]+omega*(n_equ[15] - D3_hlp.Q15[index(z,y,x)]);
				D3.Q16[index(z,y,x)]=D3_hlp.Q16[index(z,y,x)]+omega*(n_equ[16] - D3_hlp.Q16[index(z,y,x)]);
				D3.Q17[index(z,y,x)]=D3_hlp.Q17[index(z,y,x)]+omega*(n_equ[17] - D3_hlp.Q17[index(z,y,x)]);
				D3.Q18[index(z,y,x)]=D3_hlp.Q18[index(z,y,x)]+omega*(n_equ[18] - D3_hlp.Q18[index(z,y,x)]);

				//at the penultimat slice, save previous and current slices
				if (x == lx-2) {
					u_previous_spatial_boundary[index2D(z,y)] = u_x;
					v_previous_spatial_boundary[index2D(z,y)] = u_y;
					w_previous_spatial_boundary[index2D(z,y)] = u_z;

					u_current[index2D(z,y)] = u_x;
					v_current[index2D(z,y)] = u_y;
					w_current[index2D(z,y)] = u_z;

					//the following 3 lines correspond to time_unit==0!!!
					u_previous_temporal_boundary[index2D(z,y)] = u_current[index2D(z,y)];
					v_previous_temporal_boundary[index2D(z,y)] = v_current[index2D(z,y)];
					w_previous_temporal_boundary[index2D(z,y)] = w_current[index2D(z,y)];

				}//if (x == lx-2)
			}//for (x = 0 ; x< lx; ++x)
		}//for (y = 0 ; y< ly ; ++y)
	}//for (z = 0 ; z< lz ; ++z)
#ifdef DEBUG
	cout << " #LBM relaxation OK!" << endl;
#endif
}

//__global__
//void relaxation_kernel(int lx, int ly, int lz, FLOATING reynolds, FLOATING nu, FLOATING r_small,
//		FLOATING t_0, FLOATING t_1, FLOATING t_2, FLOATING c_squ, FLOATING omega, FLOATING one_minus_omega,
//		FLOATING reciprocal_c_squ,lattice D3, lattice D3_hlp, int *obstacles_d,
//		FLOATING *u_previous_spatial_boundary, FLOATING *v_previous_spatial_boundary, FLOATING *w_previous_spatial_boundary,
//		FLOATING *u_current, FLOATING *v_current, FLOATING *w_current){
//
//
//
//
//
//	/*One-step density relaxation process
//
//				c.......density relaxation: a single time relaxation with relaxation
//				c       parameter omega is applied here. This step is only "local",
//				c       nothing is propagated through the lattice.
//				c*/
//
//	int  x,y,z;
//	FLOATING  u_x=0.0, u_y=0.0, u_z=0.0, u_squ=0.0, rho=0.0, reciprocal_rho=0.0;
//
//
//
//
//	FLOATING u_n[19];
//	//	FLOATING n_equ[19];
//	FLOATING buff[19];
//
//	//	FLOATING u_n_squared[19];
//	//FLOATING two_x_c_squ_sqared;
//	const FLOATING omega_x_t_0=omega*t_0, omega_x_t_1=omega*t_1, omega_x_t_2=omega*t_2;
//	FLOATING omega_x_rho_x_t_0, omega_x_rho_x_t_1, omega_x_rho_x_t_2;
//	FLOATING temp_factor;
//	FLOATING u_n__over__c_squ[19];
//	FLOATING u_n__over__c_squ__squared_and_halved[19];
//
//	//....square speed of sound
//	/*      compute the out let velocity with a convevtive boundary condition
//					c.....loop over all nodes
//					c.....attention: actual densities are stored after the propagation
//					c                step in the help-array n_hlp !*/
//
//
//#pragma unroll
//	for (z = 0 ; z< lz ; ++z){
//#pragma unroll
//		for (y = 0 ; y< ly ; ++y){
//#pragma unroll
//			for (x = 0 ; x< lx; ++x){
//
//				/*c.........only free nodes are considered here
//					!if (.not. obstacles[z][y][x]) then
//					c...........integral local density
//					c...........initialize variable ro*/
//				//memory optimised implementation
//				buff[0]=D3_hlp.Q0[index(z,y,x)];
//				buff[1]=D3_hlp.Q1[index(z,y,x)];
//				buff[2]=D3_hlp.Q2[index(z,y,x)];
//				buff[3]=D3_hlp.Q3[index(z,y,x)];
//				buff[4]=D3_hlp.Q4[index(z,y,x)];
//				buff[5]=D3_hlp.Q5[index(z,y,x)];
//				buff[6]=D3_hlp.Q6[index(z,y,x)];
//				buff[7]=D3_hlp.Q7[index(z,y,x)];
//				buff[8]=D3_hlp.Q8[index(z,y,x)];
//				buff[9]=D3_hlp.Q9[index(z,y,x)];
//				buff[10]=D3_hlp.Q10[index(z,y,x)];
//				buff[11]=D3_hlp.Q11[index(z,y,x)];
//				buff[12]=D3_hlp.Q12[index(z,y,x)];
//				buff[13]=D3_hlp.Q13[index(z,y,x)];
//				buff[14]=D3_hlp.Q14[index(z,y,x)];
//				buff[15]=D3_hlp.Q15[index(z,y,x)];
//				buff[16]=D3_hlp.Q16[index(z,y,x)];
//				buff[17]=D3_hlp.Q17[index(z,y,x)];
//				buff[18]=D3_hlp.Q18[index(z,y,x)];
//
//				rho=0.0;
//				for(int k=0; k<DENSITIES; ++k)
//					rho+=buff[k];
//
//				//	rho=accumulate(buff, buff+DENSITIES, 0.0);
//
//				reciprocal_rho=1.0/rho;
//
//
//
//
//				switch(obstacles_d[index(z,y,x)]){
//				case 1:
//					u_x = 0.0;
//					u_y = 0.0;
//					u_z = 0.0;
//					break;
//				default:
//					u_x = 0.0;
//					u_x =  reciprocal_rho*(buff[1] + buff[7] + buff[10] +buff[11] + buff[14]-
//							(buff[3] + buff[8] + buff[9] +buff[12] + buff[13]));
//
//					u_y = 0.0;
//					u_y =  reciprocal_rho*(buff[2]+buff[8]+buff[7]+buff[16] + buff[15] -
//							(buff[4] + buff[9] + buff[10] +buff[17] + buff[18]));
//
//					u_z = 0.0;
//					u_z =  reciprocal_rho*(buff[5]+buff[13]+buff[14]+buff[15]+buff[18]-
//							(buff[6]+buff[12]+buff[11]+buff[16]+buff[17]));
//					break;
//				}//switch(obstacles[index(z,y,x)])
//
//				//original implementation
//				//				rho=0.0;
//				//				rho+=D3_hlp.Q0[index(z,y,x)]+D3_hlp.Q1[index(z,y,x)]+D3_hlp.Q2[index(z,y,x)]+D3_hlp.Q3[index(z,y,x)];
//				//				rho+=D3_hlp.Q4[index(z,y,x)]+D3_hlp.Q5[index(z,y,x)]+D3_hlp.Q6[index(z,y,x)]+D3_hlp.Q7[index(z,y,x)];
//				//				rho+=D3_hlp.Q8[index(z,y,x)]+D3_hlp.Q9[index(z,y,x)]+D3_hlp.Q10[index(z,y,x)]+D3_hlp.Q11[index(z,y,x)];
//				//				rho+=D3_hlp.Q12[index(z,y,x)]+D3_hlp.Q13[index(z,y,x)]+D3_hlp.Q14[index(z,y,x)]+D3_hlp.Q15[index(z,y,x)];
//				//				rho+=D3_hlp.Q16[index(z,y,x)]+D3_hlp.Q17[index(z,y,x)]+D3_hlp.Q18[index(z,y,x)];
//				//				reciprocal_rho=1.0/rho;
//
//				//...........x-, and y- velocity components
//
//				//				switch(obstacles[index(z,y,x)]){
//				//				case 1:
//				//					u_x = 0.0;
//				//					u_y = 0.0;
//				//					u_z = 0.0;
//				//					break;
//				//				default:
//				//					u_x = (FLOATING) reciprocal_rho*(D3_hlp.Q1[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
//				//							D3_hlp.Q11[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] -
//				//							(D3_hlp.Q3[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] +
//				//									D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)]));
//				//
//				//					u_y = (FLOATING) reciprocal_rho*(D3_hlp.Q2[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] +
//				//							D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q15[index(z,y,x)] -
//				//							(D3_hlp.Q4[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
//				//									D3_hlp.Q17[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)]));
//				//
//				//					u_z = (FLOATING) reciprocal_rho*(D3_hlp.Q5[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] +
//				//							D3_hlp.Q15[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)] -
//				//							(D3_hlp.Q6[index(z,y,x)] + D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q11[index(z,y,x)] +
//				//									D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q17[index(z,y,x)]));
//				//					break;
//				//				}//switch(obstacles[index(z,y,x)])
//
//
//
//
//				u_squ = (FLOATING)  u_x*u_x + u_y*u_y + u_z*u_z;
//				temp_factor= 0.5*(2.0* c_squ - u_squ)/c_squ;
//				//u_squ = (FLOATING)  pow(u_x,2) + pow(u_y,2) + pow(u_z,2);
//
//
//				/*...........n- velocity compnents (n = lattice node connection vectors)
//					c...........this is only necessary for clearence, and only 3 speeds would
//					c...........be necessary*/
//
//
//				//WARNING!!!! o pinakas autos exei tropopoihmena indices!!!!
//				u_n[0]= 0.0; //SHOULD NEVER USED!
//				u_n[1] =   u_x;
//				u_n[2] =         u_y;
//				u_n[3] = - u_x;
//				u_n[4] =       - u_y;
//				u_n[5] =   u_z;
//				u_n[6] =       - u_z;
//				u_n[7] =   u_x + u_y;
//				u_n[8] = - u_x + u_y;
//				u_n[9] = - u_x - u_y;
//				u_n[10] =   u_x - u_y;
//				u_n[11] =   u_x - u_z;
//				u_n[12] = - u_x - u_z;
//				u_n[13] = - u_x + u_z;
//				u_n[14] =   u_x + u_z;
//				u_n[15] =   u_z + u_y;
//				u_n[16] = - u_z + u_y;
//				u_n[17] = - u_z - u_y;
//				u_n[18] =   u_z - u_y;
//
//#pragma unroll
//				for(int i=0; i<DENSITIES; ++i){
//					u_n__over__c_squ[i]=reciprocal_c_squ*u_n[i];
//					u_n__over__c_squ__squared_and_halved[i]=0.5*u_n__over__c_squ[i]*u_n__over__c_squ[i];
//				}
//
//				/*c...........equilibrium densities
//					c...........this can be rewritten to improve computational performance
//					c...........considerabely !
//					c
//					c...........zero velocity density
//					c*/
//				//memory optimised implementation! WARNING!!! different from the original case!
//
//				//two_x_c_squ_sqared=2.0*c_squ*c_squ;
//				omega_x_rho_x_t_0=omega_x_t_0*rho;
//				omega_x_rho_x_t_1=omega_x_t_1*rho;
//				omega_x_rho_x_t_2=omega_x_t_2*rho;
//
//
//				//				//...........relaxation step
//
//
//				//omega_x_rho_x_t_0*(1.0 - 0.5*u_squ/c_squ);
//				D3.Q0[index(z,y,x)]=buff[0]*one_minus_omega+omega_x_rho_x_t_0*(u_n__over__c_squ__squared_and_halved[0]+u_n__over__c_squ[0]+temp_factor);
//
//
//
//
//				D3.Q1[index(z,y,x)]=buff[1]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[1]+u_n__over__c_squ[1]+temp_factor);
//				D3.Q2[index(z,y,x)]=buff[2]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[2]+u_n__over__c_squ[2]+temp_factor);
//				D3.Q3[index(z,y,x)]=buff[3]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[3]+u_n__over__c_squ[3]+temp_factor);
//				D3.Q4[index(z,y,x)]=buff[4]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[4]+u_n__over__c_squ[4]+temp_factor);
//				D3.Q5[index(z,y,x)]=buff[5]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[5]+u_n__over__c_squ[5]+temp_factor);
//				D3.Q6[index(z,y,x)]=buff[6]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[6]+u_n__over__c_squ[6]+temp_factor);
//
//
//
//				D3.Q7[index(z,y,x)]= buff[ 7]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 7]+u_n__over__c_squ[ 7]+temp_factor);
//				D3.Q8[index(z,y,x)]= buff[ 8]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 8]+u_n__over__c_squ[ 8]+temp_factor);
//				D3.Q9[index(z,y,x)]= buff[ 9]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 9]+u_n__over__c_squ[ 9]+temp_factor);
//				D3.Q10[index(z,y,x)]=buff[10]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[10]+u_n__over__c_squ[10]+temp_factor);
//				D3.Q11[index(z,y,x)]=buff[11]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[11]+u_n__over__c_squ[11]+temp_factor);
//				D3.Q12[index(z,y,x)]=buff[12]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[12]+u_n__over__c_squ[12]+temp_factor);
//				D3.Q13[index(z,y,x)]=buff[13]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[13]+u_n__over__c_squ[13]+temp_factor);
//				D3.Q14[index(z,y,x)]=buff[14]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[14]+u_n__over__c_squ[14]+temp_factor);
//				D3.Q15[index(z,y,x)]=buff[15]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[15]+u_n__over__c_squ[15]+temp_factor);
//				D3.Q16[index(z,y,x)]=buff[16]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[16]+u_n__over__c_squ[16]+temp_factor);
//				D3.Q17[index(z,y,x)]=buff[17]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[17]+u_n__over__c_squ[17]+temp_factor);
//				D3.Q18[index(z,y,x)]=buff[18]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[18]+u_n__over__c_squ[18]+temp_factor);
//
//				//original implementation
//				//				n_equ[0] = t_0  * rho*(1.0 - u_squ / (2.0 * c_squ));
//				//
//				//								//...........axis speeds (factor: t_1)
//				//				#pragma unroll
//				//								for (int i = 1 ; i< 7; ++i){
//				//									n_equ[i] = t_1 * rho*(1.0 + u_n[i] / c_squ
//				//											+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
//				//											- u_squ / (2.0  * c_squ));
//				//								}
//				//
//				//								//...........diagonal speeds (factor: t_2)
//				//				#pragma unroll
//				//								for (int i = 7 ; i< 19; ++i){
//				//									n_equ[i] = t_2  * rho*(1.0 + u_n[i] / c_squ
//				//											+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
//				//											- u_squ / (2.0  * c_squ));
//				//								}
//
//				//				D3.Q0[index(z,y,x)]=D3_hlp.Q0[index(z,y,x)]+omega*(n_equ[0] - D3_hlp.Q0[index(z,y,x)]);
//				//								D3.Q1[index(z,y,x)]=D3_hlp.Q1[index(z,y,x)]+omega*(n_equ[1] - D3_hlp.Q1[index(z,y,x)]);
//				//								D3.Q2[index(z,y,x)]=D3_hlp.Q2[index(z,y,x)]+omega*(n_equ[2] - D3_hlp.Q2[index(z,y,x)]);
//				//								D3.Q3[index(z,y,x)]=D3_hlp.Q3[index(z,y,x)]+omega*(n_equ[3] - D3_hlp.Q3[index(z,y,x)]);
//				//								D3.Q4[index(z,y,x)]=D3_hlp.Q4[index(z,y,x)]+omega*(n_equ[4] - D3_hlp.Q4[index(z,y,x)]);
//				//								D3.Q5[index(z,y,x)]=D3_hlp.Q5[index(z,y,x)]+omega*(n_equ[5] - D3_hlp.Q5[index(z,y,x)]);
//				//								D3.Q6[index(z,y,x)]=D3_hlp.Q6[index(z,y,x)]+omega*(n_equ[6] - D3_hlp.Q6[index(z,y,x)]);
//				//								D3.Q7[index(z,y,x)]=D3_hlp.Q7[index(z,y,x)]+omega*(n_equ[7] - D3_hlp.Q7[index(z,y,x)]);
//				//								D3.Q8[index(z,y,x)]=D3_hlp.Q8[index(z,y,x)]+omega*(n_equ[8] - D3_hlp.Q8[index(z,y,x)]);
//				//								D3.Q9[index(z,y,x)]=D3_hlp.Q9[index(z,y,x)]+omega*(n_equ[9] - D3_hlp.Q9[index(z,y,x)]);
//				//								D3.Q10[index(z,y,x)]=D3_hlp.Q10[index(z,y,x)]+omega*(n_equ[10] - D3_hlp.Q10[index(z,y,x)]);
//				//								D3.Q11[index(z,y,x)]=D3_hlp.Q11[index(z,y,x)]+omega*(n_equ[11] - D3_hlp.Q11[index(z,y,x)]);
//				//								D3.Q12[index(z,y,x)]=D3_hlp.Q12[index(z,y,x)]+omega*(n_equ[12] - D3_hlp.Q12[index(z,y,x)]);
//				//								D3.Q13[index(z,y,x)]=D3_hlp.Q13[index(z,y,x)]+omega*(n_equ[13] - D3_hlp.Q13[index(z,y,x)]);
//				//								D3.Q14[index(z,y,x)]=D3_hlp.Q14[index(z,y,x)]+omega*(n_equ[14] - D3_hlp.Q14[index(z,y,x)]);
//				//								D3.Q15[index(z,y,x)]=D3_hlp.Q15[index(z,y,x)]+omega*(n_equ[15] - D3_hlp.Q15[index(z,y,x)]);
//				//								D3.Q16[index(z,y,x)]=D3_hlp.Q16[index(z,y,x)]+omega*(n_equ[16] - D3_hlp.Q16[index(z,y,x)]);
//				//								D3.Q17[index(z,y,x)]=D3_hlp.Q17[index(z,y,x)]+omega*(n_equ[17] - D3_hlp.Q17[index(z,y,x)]);
//				//								D3.Q18[index(z,y,x)]=D3_hlp.Q18[index(z,y,x)]+omega*(n_equ[18] - D3_hlp.Q18[index(z,y,x)]);
//
//				if (x == lx-2) {
//					u_previous_spatial_boundary[index2D(z,y)] = u_x;
//					v_previous_spatial_boundary[index2D(z,y)] = u_y;
//					w_previous_spatial_boundary[index2D(z,y)] = u_z;
//
//					u_current[index2D(z,y)] = u_x;
//					v_current[index2D(z,y)] = u_y;
//					w_current[index2D(z,y)] = u_z;
//
//				}//if (x == lx-2)
//			}//for (x = 0 ; x< lx; ++x)
//		}//for (y = 0 ; y< ly ; ++y)
//	}//for (z = 0 ; z< lz ; ++z)
//#ifdef DEBUG
//	cout << " #LBM relaxation OK!" << endl;
//#endif
//}
//
//__global__
//void relaxation_kernel_v2(int lx, int ly, int lz, FLOATING reynolds, FLOATING nu, FLOATING r_small,
//		FLOATING t_0, FLOATING t_1, FLOATING t_2, FLOATING c_squ, FLOATING omega, FLOATING one_minus_omega,
//		FLOATING reciprocal_c_squ,
//		FLOATING *hlp_Q0, FLOATING *hlp_Q1, FLOATING *hlp_Q2, FLOATING *hlp_Q3,
//		FLOATING *hlp_Q4, FLOATING *hlp_Q5, FLOATING *hlp_Q6, FLOATING *hlp_Q7,
//		FLOATING *hlp_Q8, FLOATING *hlp_Q9, FLOATING *hlp_Q10, FLOATING *hlp_Q11,
//		FLOATING *hlp_Q12, FLOATING *hlp_Q13, FLOATING *hlp_Q14, FLOATING *hlp_Q15,
//		FLOATING *hlp_Q16, FLOATING *hlp_Q17, FLOATING *hlp_Q18,
//		FLOATING *Q0, FLOATING *Q1, FLOATING *Q2, FLOATING *Q3,
//		FLOATING *Q4, FLOATING *Q5, FLOATING *Q6, FLOATING *Q7,
//		FLOATING *Q8, FLOATING *Q9, FLOATING *Q10, FLOATING *Q11,
//		FLOATING *Q12, FLOATING *Q13, FLOATING *Q14, FLOATING *Q15,
//		FLOATING *Q16, FLOATING *Q17, FLOATING *Q18,
//		int *obstacles_d,
//		FLOATING *u_previous_spatial_boundary, FLOATING *v_previous_spatial_boundary, FLOATING *w_previous_spatial_boundary,
//		FLOATING *u_current, FLOATING *v_current, FLOATING *w_current){
//
//
//
//
//
//	/*One-step density relaxation process
//
//				c.......density relaxation: a single time relaxation with relaxation
//				c       parameter omega is applied here. This step is only "local",
//				c       nothing is propagated through the lattice.
//				c*/
//
//	int  x,y,z;
//	FLOATING  u_x=0.0, u_y=0.0, u_z=0.0, u_squ=0.0, rho=0.0, reciprocal_rho=0.0;
//
//
//
//
//	FLOATING u_n[19];
//	//	FLOATING n_equ[19];
//	FLOATING buff[19];
//
//	//	FLOATING u_n_squared[19];
//	//FLOATING two_x_c_squ_sqared;
//	const FLOATING omega_x_t_0=omega*t_0, omega_x_t_1=omega*t_1, omega_x_t_2=omega*t_2;
//	FLOATING omega_x_rho_x_t_0, omega_x_rho_x_t_1, omega_x_rho_x_t_2;
//	FLOATING temp_factor;
//	FLOATING u_n__over__c_squ[19];
//	FLOATING u_n__over__c_squ__squared_and_halved[19];
//
//	//....square speed of sound
//	/*      compute the out let velocity with a convevtive boundary condition
//					c.....loop over all nodes
//					c.....attention: actual densities are stored after the propagation
//					c                step in the help-array n_hlp !*/
//
//	//
//	//#pragma unroll
//	//	for (z = 0 ; z< lz ; ++z){
//	//#pragma unroll
//	//		for (y = 0 ; y< ly ; ++y){
//	//#pragma unroll
//	//			for (x = 0 ; x< lx; ++x){
//
//	const int tid=blockIdx.x*blockDim.x+threadIdx.x;
//	int rest;
//	int end_of_memory=lz*ly*(lx);
//
//	z=(int) (tid/(ly*lx));
//	rest=tid-z;
//	y=(int)(rest/lx);
//	x=rest-y;
//
//	if (tid<end_of_memory){
//		/*c.........only free nodes are considered here
//					!if (.not. obstacles[z][y][x]) then
//					c...........integral local density
//					c...........initialize variable ro*/
//		//memory optimised implementation
//		buff[0]=hlp_Q0[index(z,y,x)];
//		buff[1]=hlp_Q1[index(z,y,x)];
//		buff[2]=hlp_Q2[index(z,y,x)];
//		buff[3]=hlp_Q3[index(z,y,x)];
//		buff[4]=hlp_Q4[index(z,y,x)];
//		buff[5]=hlp_Q5[index(z,y,x)];
//		buff[6]=hlp_Q6[index(z,y,x)];
//		buff[7]=hlp_Q7[index(z,y,x)];
//		buff[8]=hlp_Q8[index(z,y,x)];
//		buff[9]=hlp_Q9[index(z,y,x)];
//		buff[10]=hlp_Q10[index(z,y,x)];
//		buff[11]=hlp_Q11[index(z,y,x)];
//		buff[12]=hlp_Q12[index(z,y,x)];
//		buff[13]=hlp_Q13[index(z,y,x)];
//		buff[14]=hlp_Q14[index(z,y,x)];
//		buff[15]=hlp_Q15[index(z,y,x)];
//		buff[16]=hlp_Q16[index(z,y,x)];
//		buff[17]=hlp_Q17[index(z,y,x)];
//		buff[18]=hlp_Q18[index(z,y,x)];
//
//		rho=0.0;
//		for(int k=0; k<DENSITIES; ++k)
//			rho+=buff[k];
//
//		//	rho=accumulate(buff, buff+DENSITIES, 0.0);
//
//		reciprocal_rho=1.0/rho;
//
//
//
//
//		switch(obstacles_d[index(z,y,x)]){
//		case 1:
//			u_x = 0.0;
//			u_y = 0.0;
//			u_z = 0.0;
//			break;
//		default:
//			u_x = 0.0;
//			u_x =  reciprocal_rho*(buff[1] + buff[7] + buff[10] +buff[11] + buff[14]-
//					(buff[3] + buff[8] + buff[9] +buff[12] + buff[13]));
//
//			u_y = 0.0;
//			u_y =  reciprocal_rho*(buff[2]+buff[8]+buff[7]+buff[16] + buff[15] -
//					(buff[4] + buff[9] + buff[10] +buff[17] + buff[18]));
//
//			u_z = 0.0;
//			u_z =  reciprocal_rho*(buff[5]+buff[13]+buff[14]+buff[15]+buff[18]-
//					(buff[6]+buff[12]+buff[11]+buff[16]+buff[17]));
//			break;
//		}//switch(obstacles[index(z,y,x)])
//
//		//original implementation
//		//				rho=0.0;
//		//				rho+=D3_hlp.Q0[index(z,y,x)]+D3_hlp.Q1[index(z,y,x)]+D3_hlp.Q2[index(z,y,x)]+D3_hlp.Q3[index(z,y,x)];
//		//				rho+=D3_hlp.Q4[index(z,y,x)]+D3_hlp.Q5[index(z,y,x)]+D3_hlp.Q6[index(z,y,x)]+D3_hlp.Q7[index(z,y,x)];
//		//				rho+=D3_hlp.Q8[index(z,y,x)]+D3_hlp.Q9[index(z,y,x)]+D3_hlp.Q10[index(z,y,x)]+D3_hlp.Q11[index(z,y,x)];
//		//				rho+=D3_hlp.Q12[index(z,y,x)]+D3_hlp.Q13[index(z,y,x)]+D3_hlp.Q14[index(z,y,x)]+D3_hlp.Q15[index(z,y,x)];
//		//				rho+=D3_hlp.Q16[index(z,y,x)]+D3_hlp.Q17[index(z,y,x)]+D3_hlp.Q18[index(z,y,x)];
//		//				reciprocal_rho=1.0/rho;
//
//		//...........x-, and y- velocity components
//
//		//				switch(obstacles[index(z,y,x)]){
//		//				case 1:
//		//					u_x = 0.0;
//		//					u_y = 0.0;
//		//					u_z = 0.0;
//		//					break;
//		//				default:
//		//					u_x = (FLOATING) reciprocal_rho*(D3_hlp.Q1[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
//		//							D3_hlp.Q11[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] -
//		//							(D3_hlp.Q3[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] +
//		//									D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)]));
//		//
//		//					u_y = (FLOATING) reciprocal_rho*(D3_hlp.Q2[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] +
//		//							D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q15[index(z,y,x)] -
//		//							(D3_hlp.Q4[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
//		//									D3_hlp.Q17[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)]));
//		//
//		//					u_z = (FLOATING) reciprocal_rho*(D3_hlp.Q5[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] +
//		//							D3_hlp.Q15[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)] -
//		//							(D3_hlp.Q6[index(z,y,x)] + D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q11[index(z,y,x)] +
//		//									D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q17[index(z,y,x)]));
//		//					break;
//		//				}//switch(obstacles[index(z,y,x)])
//
//
//
//
//		u_squ = (FLOATING)  u_x*u_x + u_y*u_y + u_z*u_z;
//		temp_factor= 0.5*(2.0* c_squ - u_squ)/c_squ;
//		//u_squ = (FLOATING)  pow(u_x,2) + pow(u_y,2) + pow(u_z,2);
//
//
//		/*...........n- velocity compnents (n = lattice node connection vectors)
//					c...........this is only necessary for clearence, and only 3 speeds would
//					c...........be necessary*/
//
//
//		//WARNING!!!! o pinakas autos exei tropopoihmena indices!!!!
//		u_n[0]= 0.0; //SHOULD NEVER USED!
//		u_n[1] =   u_x;
//		u_n[2] =         u_y;
//		u_n[3] = - u_x;
//		u_n[4] =       - u_y;
//		u_n[5] =   u_z;
//		u_n[6] =       - u_z;
//		u_n[7] =   u_x + u_y;
//		u_n[8] = - u_x + u_y;
//		u_n[9] = - u_x - u_y;
//		u_n[10] =   u_x - u_y;
//		u_n[11] =   u_x - u_z;
//		u_n[12] = - u_x - u_z;
//		u_n[13] = - u_x + u_z;
//		u_n[14] =   u_x + u_z;
//		u_n[15] =   u_z + u_y;
//		u_n[16] = - u_z + u_y;
//		u_n[17] = - u_z - u_y;
//		u_n[18] =   u_z - u_y;
//
//#pragma unroll
//		for(int i=0; i<DENSITIES; ++i){
//			u_n__over__c_squ[i]=reciprocal_c_squ*u_n[i];
//			u_n__over__c_squ__squared_and_halved[i]=0.5*u_n__over__c_squ[i]*u_n__over__c_squ[i];
//		}
//
//		/*c...........equilibrium densities
//					c...........this can be rewritten to improve computational performance
//					c...........considerabely !
//					c
//					c...........zero velocity density
//					c*/
//		//memory optimised implementation! WARNING!!! different from the original case!
//
//		//two_x_c_squ_sqared=2.0*c_squ*c_squ;
//		omega_x_rho_x_t_0=omega_x_t_0*rho;
//		omega_x_rho_x_t_1=omega_x_t_1*rho;
//		omega_x_rho_x_t_2=omega_x_t_2*rho;
//
//
//		//				//...........relaxation step
//
//
//		//omega_x_rho_x_t_0*(1.0 - 0.5*u_squ/c_squ);
//		Q0[index(z,y,x)]=buff[0]*one_minus_omega+omega_x_rho_x_t_0*(u_n__over__c_squ__squared_and_halved[0]+u_n__over__c_squ[0]+temp_factor);
//
//
//
//
//		Q1[index(z,y,x)]=buff[1]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[1]+u_n__over__c_squ[1]+temp_factor);
//		Q2[index(z,y,x)]=buff[2]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[2]+u_n__over__c_squ[2]+temp_factor);
//		Q3[index(z,y,x)]=buff[3]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[3]+u_n__over__c_squ[3]+temp_factor);
//		Q4[index(z,y,x)]=buff[4]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[4]+u_n__over__c_squ[4]+temp_factor);
//		Q5[index(z,y,x)]=buff[5]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[5]+u_n__over__c_squ[5]+temp_factor);
//		Q6[index(z,y,x)]=buff[6]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[6]+u_n__over__c_squ[6]+temp_factor);
//
//
//
//		Q7[index(z,y,x)]= buff[ 7]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 7]+u_n__over__c_squ[ 7]+temp_factor);
//		Q8[index(z,y,x)]= buff[ 8]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 8]+u_n__over__c_squ[ 8]+temp_factor);
//		Q9[index(z,y,x)]= buff[ 9]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 9]+u_n__over__c_squ[ 9]+temp_factor);
//		Q10[index(z,y,x)]=buff[10]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[10]+u_n__over__c_squ[10]+temp_factor);
//		Q11[index(z,y,x)]=buff[11]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[11]+u_n__over__c_squ[11]+temp_factor);
//		Q12[index(z,y,x)]=buff[12]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[12]+u_n__over__c_squ[12]+temp_factor);
//		Q13[index(z,y,x)]=buff[13]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[13]+u_n__over__c_squ[13]+temp_factor);
//		Q14[index(z,y,x)]=buff[14]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[14]+u_n__over__c_squ[14]+temp_factor);
//		Q15[index(z,y,x)]=buff[15]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[15]+u_n__over__c_squ[15]+temp_factor);
//		Q16[index(z,y,x)]=buff[16]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[16]+u_n__over__c_squ[16]+temp_factor);
//		Q17[index(z,y,x)]=buff[17]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[17]+u_n__over__c_squ[17]+temp_factor);
//		Q18[index(z,y,x)]=buff[18]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[18]+u_n__over__c_squ[18]+temp_factor);
//
//		//original implementation
//		//				n_equ[0] = t_0  * rho*(1.0 - u_squ / (2.0 * c_squ));
//		//
//		//								//...........axis speeds (factor: t_1)
//		//				#pragma unroll
//		//								for (int i = 1 ; i< 7; ++i){
//		//									n_equ[i] = t_1 * rho*(1.0 + u_n[i] / c_squ
//		//											+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
//		//											- u_squ / (2.0  * c_squ));
//		//								}
//		//
//		//								//...........diagonal speeds (factor: t_2)
//		//				#pragma unroll
//		//								for (int i = 7 ; i< 19; ++i){
//		//									n_equ[i] = t_2  * rho*(1.0 + u_n[i] / c_squ
//		//											+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
//		//											- u_squ / (2.0  * c_squ));
//		//								}
//
//		//				D3.Q0[index(z,y,x)]=D3_hlp.Q0[index(z,y,x)]+omega*(n_equ[0] - D3_hlp.Q0[index(z,y,x)]);
//		//								D3.Q1[index(z,y,x)]=D3_hlp.Q1[index(z,y,x)]+omega*(n_equ[1] - D3_hlp.Q1[index(z,y,x)]);
//		//								D3.Q2[index(z,y,x)]=D3_hlp.Q2[index(z,y,x)]+omega*(n_equ[2] - D3_hlp.Q2[index(z,y,x)]);
//		//								D3.Q3[index(z,y,x)]=D3_hlp.Q3[index(z,y,x)]+omega*(n_equ[3] - D3_hlp.Q3[index(z,y,x)]);
//		//								D3.Q4[index(z,y,x)]=D3_hlp.Q4[index(z,y,x)]+omega*(n_equ[4] - D3_hlp.Q4[index(z,y,x)]);
//		//								D3.Q5[index(z,y,x)]=D3_hlp.Q5[index(z,y,x)]+omega*(n_equ[5] - D3_hlp.Q5[index(z,y,x)]);
//		//								D3.Q6[index(z,y,x)]=D3_hlp.Q6[index(z,y,x)]+omega*(n_equ[6] - D3_hlp.Q6[index(z,y,x)]);
//		//								D3.Q7[index(z,y,x)]=D3_hlp.Q7[index(z,y,x)]+omega*(n_equ[7] - D3_hlp.Q7[index(z,y,x)]);
//		//								D3.Q8[index(z,y,x)]=D3_hlp.Q8[index(z,y,x)]+omega*(n_equ[8] - D3_hlp.Q8[index(z,y,x)]);
//		//								D3.Q9[index(z,y,x)]=D3_hlp.Q9[index(z,y,x)]+omega*(n_equ[9] - D3_hlp.Q9[index(z,y,x)]);
//		//								D3.Q10[index(z,y,x)]=D3_hlp.Q10[index(z,y,x)]+omega*(n_equ[10] - D3_hlp.Q10[index(z,y,x)]);
//		//								D3.Q11[index(z,y,x)]=D3_hlp.Q11[index(z,y,x)]+omega*(n_equ[11] - D3_hlp.Q11[index(z,y,x)]);
//		//								D3.Q12[index(z,y,x)]=D3_hlp.Q12[index(z,y,x)]+omega*(n_equ[12] - D3_hlp.Q12[index(z,y,x)]);
//		//								D3.Q13[index(z,y,x)]=D3_hlp.Q13[index(z,y,x)]+omega*(n_equ[13] - D3_hlp.Q13[index(z,y,x)]);
//		//								D3.Q14[index(z,y,x)]=D3_hlp.Q14[index(z,y,x)]+omega*(n_equ[14] - D3_hlp.Q14[index(z,y,x)]);
//		//								D3.Q15[index(z,y,x)]=D3_hlp.Q15[index(z,y,x)]+omega*(n_equ[15] - D3_hlp.Q15[index(z,y,x)]);
//		//								D3.Q16[index(z,y,x)]=D3_hlp.Q16[index(z,y,x)]+omega*(n_equ[16] - D3_hlp.Q16[index(z,y,x)]);
//		//								D3.Q17[index(z,y,x)]=D3_hlp.Q17[index(z,y,x)]+omega*(n_equ[17] - D3_hlp.Q17[index(z,y,x)]);
//		//								D3.Q18[index(z,y,x)]=D3_hlp.Q18[index(z,y,x)]+omega*(n_equ[18] - D3_hlp.Q18[index(z,y,x)]);
//
//		if (x == lx-2) {
//			u_previous_spatial_boundary[index2D(z,y)] = u_x;
//			v_previous_spatial_boundary[index2D(z,y)] = u_y;
//			w_previous_spatial_boundary[index2D(z,y)] = u_z;
//
//			u_current[index2D(z,y)] = u_x;
//			v_current[index2D(z,y)] = u_y;
//			w_current[index2D(z,y)] = u_z;
//
//		}//if (x == lx-2)
//	}//if memory!
//	//			}//for (x = 0 ; x< lx; ++x)
//	//		}//for (y = 0 ; y< ly ; ++y)
//	//	}//for (z = 0 ; z< lz ; ++z)
//
//}
//
//__global__
//void relaxation_kernel_v3(int lx, int ly, int lz, FLOATING reynolds, FLOATING nu, FLOATING r_small,
//		FLOATING t_0, FLOATING t_1, FLOATING t_2, FLOATING c_squ, FLOATING omega, FLOATING one_minus_omega,
//		FLOATING reciprocal_c_squ,
//		FLOATING *hlp_Q0, FLOATING *hlp_Q1, FLOATING *hlp_Q2, FLOATING *hlp_Q3,
//		FLOATING *hlp_Q4, FLOATING *hlp_Q5, FLOATING *hlp_Q6, FLOATING *hlp_Q7,
//		FLOATING *hlp_Q8, FLOATING *hlp_Q9, FLOATING *hlp_Q10, FLOATING *hlp_Q11,
//		FLOATING *hlp_Q12, FLOATING *hlp_Q13, FLOATING *hlp_Q14, FLOATING *hlp_Q15,
//		FLOATING *hlp_Q16, FLOATING *hlp_Q17, FLOATING *hlp_Q18,
//		FLOATING *Q0, FLOATING *Q1, FLOATING *Q2, FLOATING *Q3,
//		FLOATING *Q4, FLOATING *Q5, FLOATING *Q6, FLOATING *Q7,
//		FLOATING *Q8, FLOATING *Q9, FLOATING *Q10, FLOATING *Q11,
//		FLOATING *Q12, FLOATING *Q13, FLOATING *Q14, FLOATING *Q15,
//		FLOATING *Q16, FLOATING *Q17, FLOATING *Q18,
//		int *obstacles,
//		FLOATING *u_previous_spatial_boundary, FLOATING *v_previous_spatial_boundary, FLOATING *w_previous_spatial_boundary,
//		FLOATING *u_current, FLOATING *v_current, FLOATING *w_current){
//
//
//
//
//
//	/*One-step density relaxation process
//
//				c.......density relaxation: a single time relaxation with relaxation
//				c       parameter omega is applied here. This step is only "local",
//				c       nothing is propagated through the lattice.
//				c*/
//
//	int  x,y,z;
//	FLOATING  u_x=0.0, u_y=0.0, u_z=0.0, u_squ=0.0, rho=0.0, reciprocal_rho=0.0;
//
//
//
//
//	FLOATING u_n[19];
//	//	FLOATING n_equ[19];
//	FLOATING buff[19];
//
//	//	FLOATING u_n_squared[19];
//	//FLOATING two_x_c_squ_sqared;
//	const FLOATING omega_x_t_0=omega*t_0, omega_x_t_1=omega*t_1, omega_x_t_2=omega*t_2;
//	FLOATING omega_x_rho_x_t_0, omega_x_rho_x_t_1, omega_x_rho_x_t_2;
//	FLOATING temp_factor;
//	FLOATING u_n__over__c_squ[19];
//	FLOATING u_n__over__c_squ__squared_and_halved[19];
//
//	//....square speed of sound
//	/*      compute the out let velocity with a convevtive boundary condition
//					c.....loop over all nodes
//					c.....attention: actual densities are stored after the propagation
//					c                step in the help-array n_hlp !*/
//
//	//
//	//#pragma unroll
//	//	for (z = 0 ; z< lz ; ++z){
//	//#pragma unroll
//	//		for (y = 0 ; y< ly ; ++y){
//	//#pragma unroll
//	//			for (x = 0 ; x< lx; ++x){
//
//	const int tid=blockIdx.x*blockDim.x+threadIdx.x;
//	int rest;
//	int end_of_memory=lz*ly*(lx);
//
//	z=(int) (tid/(ly*lx));
//	rest=tid-z;
//	y=(int)(rest/lx);
//	x=rest-y;
//
//	if (tid<end_of_memory){
//		/*c.........only free nodes are considered here
//					!if (.not. obstacles[z][y][x]) then
//					c...........integral local density
//					c...........initialize variable ro*/
//		//memory optimised implementation
//		buff[0]=hlp_Q0[tid];
//		buff[1]=hlp_Q1[tid];
//		buff[2]=hlp_Q2[tid];
//		buff[3]=hlp_Q3[tid];
//		buff[4]=hlp_Q4[tid];
//		buff[5]=hlp_Q5[tid];
//		buff[6]=hlp_Q6[tid];
//		buff[7]=hlp_Q7[tid];
//		buff[8]=hlp_Q8[tid];
//		buff[9]=hlp_Q9[tid];
//		buff[10]=hlp_Q10[tid];
//		buff[11]=hlp_Q11[tid];
//		buff[12]=hlp_Q12[tid];
//		buff[13]=hlp_Q13[tid];
//		buff[14]=hlp_Q14[tid];
//		buff[15]=hlp_Q15[tid];
//		buff[16]=hlp_Q16[tid];
//		buff[17]=hlp_Q17[tid];
//		buff[18]=hlp_Q18[tid];
//
//		rho=0.0;
//		for(int k=0; k<DENSITIES; ++k)
//			rho+=buff[k];
//
//		//	rho=accumulate(buff, buff+DENSITIES, 0.0);
//
//		reciprocal_rho=1.0/rho;
//
//
//
//
//		switch(obstacles[tid]){
//		case 1:
//			u_x = 0.0;
//			u_y = 0.0;
//			u_z = 0.0;
//			break;
//		default:
//			u_x = 0.0;
//			u_x =  reciprocal_rho*(buff[1] + buff[7] + buff[10] +buff[11] + buff[14]-
//					(buff[3] + buff[8] + buff[9] +buff[12] + buff[13]));
//
//			u_y = 0.0;
//			u_y =  reciprocal_rho*(buff[2]+buff[8]+buff[7]+buff[16] + buff[15] -
//					(buff[4] + buff[9] + buff[10] +buff[17] + buff[18]));
//
//			u_z = 0.0;
//			u_z =  reciprocal_rho*(buff[5]+buff[13]+buff[14]+buff[15]+buff[18]-
//					(buff[6]+buff[12]+buff[11]+buff[16]+buff[17]));
//			break;
//		}//switch(obstacles[index(z,y,x)])
//
//		//original implementation
//		//				rho=0.0;
//		//				rho+=D3_hlp.Q0[index(z,y,x)]+D3_hlp.Q1[index(z,y,x)]+D3_hlp.Q2[index(z,y,x)]+D3_hlp.Q3[index(z,y,x)];
//		//				rho+=D3_hlp.Q4[index(z,y,x)]+D3_hlp.Q5[index(z,y,x)]+D3_hlp.Q6[index(z,y,x)]+D3_hlp.Q7[index(z,y,x)];
//		//				rho+=D3_hlp.Q8[index(z,y,x)]+D3_hlp.Q9[index(z,y,x)]+D3_hlp.Q10[index(z,y,x)]+D3_hlp.Q11[index(z,y,x)];
//		//				rho+=D3_hlp.Q12[index(z,y,x)]+D3_hlp.Q13[index(z,y,x)]+D3_hlp.Q14[index(z,y,x)]+D3_hlp.Q15[index(z,y,x)];
//		//				rho+=D3_hlp.Q16[index(z,y,x)]+D3_hlp.Q17[index(z,y,x)]+D3_hlp.Q18[index(z,y,x)];
//		//				reciprocal_rho=1.0/rho;
//
//		//...........x-, and y- velocity components
//
//		//				switch(obstacles[index(z,y,x)]){
//		//				case 1:
//		//					u_x = 0.0;
//		//					u_y = 0.0;
//		//					u_z = 0.0;
//		//					break;
//		//				default:
//		//					u_x = (FLOATING) reciprocal_rho*(D3_hlp.Q1[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
//		//							D3_hlp.Q11[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] -
//		//							(D3_hlp.Q3[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] +
//		//									D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)]));
//		//
//		//					u_y = (FLOATING) reciprocal_rho*(D3_hlp.Q2[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] +
//		//							D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q15[index(z,y,x)] -
//		//							(D3_hlp.Q4[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
//		//									D3_hlp.Q17[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)]));
//		//
//		//					u_z = (FLOATING) reciprocal_rho*(D3_hlp.Q5[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] +
//		//							D3_hlp.Q15[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)] -
//		//							(D3_hlp.Q6[index(z,y,x)] + D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q11[index(z,y,x)] +
//		//									D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q17[index(z,y,x)]));
//		//					break;
//		//				}//switch(obstacles[index(z,y,x)])
//
//
//
//
//		u_squ = (FLOATING)  u_x*u_x + u_y*u_y + u_z*u_z;
//		temp_factor= 0.5*(2.0* c_squ - u_squ)/c_squ;
//		//u_squ = (FLOATING)  pow(u_x,2) + pow(u_y,2) + pow(u_z,2);
//
//
//		/*...........n- velocity compnents (n = lattice node connection vectors)
//					c...........this is only necessary for clearence, and only 3 speeds would
//					c...........be necessary*/
//
//
//		//WARNING!!!! o pinakas autos exei tropopoihmena indices!!!!
//		u_n[0]= 0.0; //SHOULD NEVER USED!
//		u_n[1] =   u_x;
//		u_n[2] =         u_y;
//		u_n[3] = - u_x;
//		u_n[4] =       - u_y;
//		u_n[5] =   u_z;
//		u_n[6] =       - u_z;
//		u_n[7] =   u_x + u_y;
//		u_n[8] = - u_x + u_y;
//		u_n[9] = - u_x - u_y;
//		u_n[10] =   u_x - u_y;
//		u_n[11] =   u_x - u_z;
//		u_n[12] = - u_x - u_z;
//		u_n[13] = - u_x + u_z;
//		u_n[14] =   u_x + u_z;
//		u_n[15] =   u_z + u_y;
//		u_n[16] = - u_z + u_y;
//		u_n[17] = - u_z - u_y;
//		u_n[18] =   u_z - u_y;
//
//#pragma unroll
//		for(int i=0; i<DENSITIES; ++i){
//			u_n__over__c_squ[i]=reciprocal_c_squ*u_n[i];
//			u_n__over__c_squ__squared_and_halved[i]=0.5*u_n__over__c_squ[i]*u_n__over__c_squ[i];
//		}
//
//		/*c...........equilibrium densities
//					c...........this can be rewritten to improve computational performance
//					c...........considerabely !
//					c
//					c...........zero velocity density
//					c*/
//		//memory optimised implementation! WARNING!!! different from the original case!
//
//		//two_x_c_squ_sqared=2.0*c_squ*c_squ;
//		omega_x_rho_x_t_0=omega_x_t_0*rho;
//		omega_x_rho_x_t_1=omega_x_t_1*rho;
//		omega_x_rho_x_t_2=omega_x_t_2*rho;
//
//
//		//				//...........relaxation step
//
//
//		//omega_x_rho_x_t_0*(1.0 - 0.5*u_squ/c_squ);
//		Q0[tid]=buff[0]*one_minus_omega+omega_x_rho_x_t_0*(u_n__over__c_squ__squared_and_halved[0]+u_n__over__c_squ[0]+temp_factor);
//
//
//
//
//		Q1[tid]=buff[1]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[1]+u_n__over__c_squ[1]+temp_factor);
//		Q2[tid]=buff[2]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[2]+u_n__over__c_squ[2]+temp_factor);
//		Q3[tid]=buff[3]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[3]+u_n__over__c_squ[3]+temp_factor);
//		Q4[tid]=buff[4]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[4]+u_n__over__c_squ[4]+temp_factor);
//		Q5[tid]=buff[5]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[5]+u_n__over__c_squ[5]+temp_factor);
//		Q6[tid]=buff[6]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[6]+u_n__over__c_squ[6]+temp_factor);
//
//
//
//		Q7[tid]= buff[ 7]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 7]+u_n__over__c_squ[ 7]+temp_factor);
//		Q8[tid]= buff[ 8]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 8]+u_n__over__c_squ[ 8]+temp_factor);
//		Q9[tid]= buff[ 9]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 9]+u_n__over__c_squ[ 9]+temp_factor);
//		Q10[tid]=buff[10]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[10]+u_n__over__c_squ[10]+temp_factor);
//		Q11[tid]=buff[11]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[11]+u_n__over__c_squ[11]+temp_factor);
//		Q12[tid]=buff[12]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[12]+u_n__over__c_squ[12]+temp_factor);
//		Q13[tid]=buff[13]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[13]+u_n__over__c_squ[13]+temp_factor);
//		Q14[tid]=buff[14]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[14]+u_n__over__c_squ[14]+temp_factor);
//		Q15[tid]=buff[15]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[15]+u_n__over__c_squ[15]+temp_factor);
//		Q16[tid]=buff[16]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[16]+u_n__over__c_squ[16]+temp_factor);
//		Q17[tid]=buff[17]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[17]+u_n__over__c_squ[17]+temp_factor);
//		Q18[tid]=buff[18]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[18]+u_n__over__c_squ[18]+temp_factor);
//
//		//original implementation
//		//				n_equ[0] = t_0  * rho*(1.0 - u_squ / (2.0 * c_squ));
//		//
//		//								//...........axis speeds (factor: t_1)
//		//				#pragma unroll
//		//								for (int i = 1 ; i< 7; ++i){
//		//									n_equ[i] = t_1 * rho*(1.0 + u_n[i] / c_squ
//		//											+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
//		//											- u_squ / (2.0  * c_squ));
//		//								}
//		//
//		//								//...........diagonal speeds (factor: t_2)
//		//				#pragma unroll
//		//								for (int i = 7 ; i< 19; ++i){
//		//									n_equ[i] = t_2  * rho*(1.0 + u_n[i] / c_squ
//		//											+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
//		//											- u_squ / (2.0  * c_squ));
//		//								}
//
//		//				D3.Q0[index(z,y,x)]=D3_hlp.Q0[index(z,y,x)]+omega*(n_equ[0] - D3_hlp.Q0[index(z,y,x)]);
//		//								D3.Q1[index(z,y,x)]=D3_hlp.Q1[index(z,y,x)]+omega*(n_equ[1] - D3_hlp.Q1[index(z,y,x)]);
//		//								D3.Q2[index(z,y,x)]=D3_hlp.Q2[index(z,y,x)]+omega*(n_equ[2] - D3_hlp.Q2[index(z,y,x)]);
//		//								D3.Q3[index(z,y,x)]=D3_hlp.Q3[index(z,y,x)]+omega*(n_equ[3] - D3_hlp.Q3[index(z,y,x)]);
//		//								D3.Q4[index(z,y,x)]=D3_hlp.Q4[index(z,y,x)]+omega*(n_equ[4] - D3_hlp.Q4[index(z,y,x)]);
//		//								D3.Q5[index(z,y,x)]=D3_hlp.Q5[index(z,y,x)]+omega*(n_equ[5] - D3_hlp.Q5[index(z,y,x)]);
//		//								D3.Q6[index(z,y,x)]=D3_hlp.Q6[index(z,y,x)]+omega*(n_equ[6] - D3_hlp.Q6[index(z,y,x)]);
//		//								D3.Q7[index(z,y,x)]=D3_hlp.Q7[index(z,y,x)]+omega*(n_equ[7] - D3_hlp.Q7[index(z,y,x)]);
//		//								D3.Q8[index(z,y,x)]=D3_hlp.Q8[index(z,y,x)]+omega*(n_equ[8] - D3_hlp.Q8[index(z,y,x)]);
//		//								D3.Q9[index(z,y,x)]=D3_hlp.Q9[index(z,y,x)]+omega*(n_equ[9] - D3_hlp.Q9[index(z,y,x)]);
//		//								D3.Q10[index(z,y,x)]=D3_hlp.Q10[index(z,y,x)]+omega*(n_equ[10] - D3_hlp.Q10[index(z,y,x)]);
//		//								D3.Q11[index(z,y,x)]=D3_hlp.Q11[index(z,y,x)]+omega*(n_equ[11] - D3_hlp.Q11[index(z,y,x)]);
//		//								D3.Q12[index(z,y,x)]=D3_hlp.Q12[index(z,y,x)]+omega*(n_equ[12] - D3_hlp.Q12[index(z,y,x)]);
//		//								D3.Q13[index(z,y,x)]=D3_hlp.Q13[index(z,y,x)]+omega*(n_equ[13] - D3_hlp.Q13[index(z,y,x)]);
//		//								D3.Q14[index(z,y,x)]=D3_hlp.Q14[index(z,y,x)]+omega*(n_equ[14] - D3_hlp.Q14[index(z,y,x)]);
//		//								D3.Q15[index(z,y,x)]=D3_hlp.Q15[index(z,y,x)]+omega*(n_equ[15] - D3_hlp.Q15[index(z,y,x)]);
//		//								D3.Q16[index(z,y,x)]=D3_hlp.Q16[index(z,y,x)]+omega*(n_equ[16] - D3_hlp.Q16[index(z,y,x)]);
//		//								D3.Q17[index(z,y,x)]=D3_hlp.Q17[index(z,y,x)]+omega*(n_equ[17] - D3_hlp.Q17[index(z,y,x)]);
//		//								D3.Q18[index(z,y,x)]=D3_hlp.Q18[index(z,y,x)]+omega*(n_equ[18] - D3_hlp.Q18[index(z,y,x)]);
//
//		if (x == lx-2) {
//			u_previous_spatial_boundary[index2D(z,y)] = u_x;
//			v_previous_spatial_boundary[index2D(z,y)] = u_y;
//			w_previous_spatial_boundary[index2D(z,y)] = u_z;
//
//			u_current[index2D(z,y)] = u_x;
//			v_current[index2D(z,y)] = u_y;
//			w_current[index2D(z,y)] = u_z;
//
//		}//if (x == lx-2)
//	}//if memory!
//	//			}//for (x = 0 ; x< lx; ++x)
//	//		}//for (y = 0 ; y< ly ; ++y)
//	//	}//for (z = 0 ; z< lz ; ++z)
//
//}

__global__
void relaxation_kernel_v4(const int lx, const int ly, const int lz, const FLOATING reynolds, FLOATING nu, FLOATING r_small,
		FLOATING t_0, FLOATING t_1, FLOATING t_2, FLOATING c_squ, FLOATING omega, FLOATING one_minus_omega,
		FLOATING reciprocal_c_squ,
		const FLOATING *hlp_Q0, const FLOATING *hlp_Q1, const FLOATING *hlp_Q2, const FLOATING *hlp_Q3,
		const FLOATING *hlp_Q4, const FLOATING *hlp_Q5, const FLOATING *hlp_Q6, const FLOATING *hlp_Q7,
		const FLOATING *hlp_Q8, const FLOATING *hlp_Q9, const FLOATING *hlp_Q10, const FLOATING *hlp_Q11,
		const FLOATING *hlp_Q12, const FLOATING *hlp_Q13, const FLOATING *hlp_Q14, const FLOATING *hlp_Q15,
		const FLOATING *hlp_Q16, const FLOATING *hlp_Q17, const FLOATING *hlp_Q18,
		FLOATING *Q0, FLOATING *Q1, FLOATING *Q2, FLOATING *Q3,
		FLOATING *Q4, FLOATING *Q5, FLOATING *Q6, FLOATING *Q7,
		FLOATING *Q8, FLOATING *Q9, FLOATING *Q10, FLOATING *Q11,
		FLOATING *Q12, FLOATING *Q13, FLOATING *Q14, FLOATING *Q15,
		FLOATING *Q16, FLOATING *Q17, FLOATING *Q18,
		const int *obstacles,
		FLOATING *u_previous_spatial_boundary, FLOATING *v_previous_spatial_boundary, FLOATING *w_previous_spatial_boundary,
		FLOATING *u_current, FLOATING *v_current, FLOATING *w_current, FLOATING *u_current_temp){





	/*One-step density relaxation process

				c.......density relaxation: a single time relaxation with relaxation
				c       parameter omega is applied here. This step is only "local",
				c       nothing is propagated through the lattice.
				c*/

	int  x,y,z;
	FLOATING  u_x=0.0, u_y=0.0, u_z=0.0, u_squ=0.0, rho=0.0, reciprocal_rho=0.0;




	__shared__ FLOATING u_n[19];

	__shared__ FLOATING buff[19];

	//	extern __shared__ FLOATING shared_buffer[];

	const FLOATING omega_x_t_0=omega*t_0, omega_x_t_1=omega*t_1, omega_x_t_2=omega*t_2;
	FLOATING omega_x_rho_x_t_0, omega_x_rho_x_t_1, omega_x_rho_x_t_2;
	FLOATING temp_factor;
	FLOATING u_n__over__c_squ[19];
	FLOATING u_n__over__c_squ__squared_and_halved[19];

	//....square speed of sound
	/*      compute the out let velocity with a convevtive boundary condition
					c.....loop over all nodes
					c.....attention: actual densities are stored after the propagation
					c                step in the help-array n_hlp !*/



	const int tid=blockIdx.x*blockDim.x+threadIdx.x;
	int rest;
	int end_of_memory=lz*ly*(lx);

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

	if (tid<end_of_memory){
		/*c.........only free nodes are considered here
					!if (.not. obstacles[z][y][x]) then
					c...........integral local density
					c...........initialize variable ro*/
		//memory optimised implementation
		buff[0]=hlp_Q0[tid];
		buff[1]=hlp_Q1[tid];
		buff[2]=hlp_Q2[tid];
		buff[3]=hlp_Q3[tid];
		buff[4]=hlp_Q4[tid];
		buff[5]=hlp_Q5[tid];
		buff[6]=hlp_Q6[tid];
		buff[7]=hlp_Q7[tid];
		buff[8]=hlp_Q8[tid];
		buff[9]=hlp_Q9[tid];
		buff[10]=hlp_Q10[tid];
		buff[11]=hlp_Q11[tid];
		buff[12]=hlp_Q12[tid];
		buff[13]=hlp_Q13[tid];
		buff[14]=hlp_Q14[tid];
		buff[15]=hlp_Q15[tid];
		buff[16]=hlp_Q16[tid];
		buff[17]=hlp_Q17[tid];
		buff[18]=hlp_Q18[tid];

		rho=0.0;
#pragma unroll
		for(int k=0; k<DENSITIES; ++k)
			rho+=buff[k];



		reciprocal_rho=1.0/rho;




		u_x =  (1-obstacles[tid])*reciprocal_rho*(buff[1] + buff[7] + buff[10] +buff[11] + buff[14]-
				(buff[3] + buff[8] + buff[9] +buff[12] + buff[13]));


		u_y =   (1-obstacles[tid])*reciprocal_rho*(buff[2]+buff[8]+buff[7]+buff[16] + buff[15] -
				(buff[4] + buff[9] + buff[10] +buff[17] + buff[18]));


		u_z =   (1-obstacles[tid])*reciprocal_rho*(buff[5]+buff[13]+buff[14]+buff[15]+buff[18]-
				(buff[6]+buff[12]+buff[11]+buff[16]+buff[17]));






		u_squ = (FLOATING)  u_x*u_x + u_y*u_y + u_z*u_z;
		temp_factor= 0.5*(2.0* c_squ - u_squ)/c_squ;
		//u_squ = (FLOATING)  pow(u_x,2) + pow(u_y,2) + pow(u_z,2);


		/*...........n- velocity compnents (n = lattice node connection vectors)
					c...........this is only necessary for clearence, and only 3 speeds would
					c...........be necessary*/


		//WARNING!!!! o pinakas autos exei tropopoihmena indices!!!!
		u_n[0]= 0.0; //SHOULD NEVER USED!
		u_n[1] =   u_x;
		u_n[2] =         u_y;
		u_n[3] = - u_x;
		u_n[4] =       - u_y;
		u_n[5] =   u_z;
		u_n[6] =       - u_z;
		u_n[7] =   u_x + u_y;
		u_n[8] = - u_x + u_y;
		u_n[9] = - u_x - u_y;
		u_n[10] =   u_x - u_y;
		u_n[11] =   u_x - u_z;
		u_n[12] = - u_x - u_z;
		u_n[13] = - u_x + u_z;
		u_n[14] =   u_x + u_z;
		u_n[15] =   u_z + u_y;
		u_n[16] = - u_z + u_y;
		u_n[17] = - u_z - u_y;
		u_n[18] =   u_z - u_y;

#pragma unroll
		for(int i=0; i<DENSITIES; ++i){
			u_n__over__c_squ[i]=reciprocal_c_squ*u_n[i];
			u_n__over__c_squ__squared_and_halved[i]=0.5*u_n__over__c_squ[i]*u_n__over__c_squ[i];
		}

		/*c...........equilibrium densities
					c...........this can be rewritten to improve computational performance
					c...........considerabely !
					c
					c...........zero velocity density
					c*/
		//memory optimised implementation! WARNING!!! different from the original case!

		//two_x_c_squ_sqared=2.0*c_squ*c_squ;
		omega_x_rho_x_t_0=omega_x_t_0*rho;
		omega_x_rho_x_t_1=omega_x_t_1*rho;
		omega_x_rho_x_t_2=omega_x_t_2*rho;


		//				//...........relaxation step


		//omega_x_rho_x_t_0*(1.0 - 0.5*u_squ/c_squ);
		Q0[tid]=buff[0]*one_minus_omega+omega_x_rho_x_t_0*(u_n__over__c_squ__squared_and_halved[0]+u_n__over__c_squ[0]+temp_factor);




		Q1[tid]=buff[1]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[1]+u_n__over__c_squ[1]+temp_factor);
		Q2[tid]=buff[2]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[2]+u_n__over__c_squ[2]+temp_factor);
		Q3[tid]=buff[3]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[3]+u_n__over__c_squ[3]+temp_factor);
		Q4[tid]=buff[4]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[4]+u_n__over__c_squ[4]+temp_factor);
		Q5[tid]=buff[5]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[5]+u_n__over__c_squ[5]+temp_factor);
		Q6[tid]=buff[6]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[6]+u_n__over__c_squ[6]+temp_factor);



		Q7[tid]= buff[ 7]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 7]+u_n__over__c_squ[ 7]+temp_factor);
		Q8[tid]= buff[ 8]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 8]+u_n__over__c_squ[ 8]+temp_factor);
		Q9[tid]= buff[ 9]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 9]+u_n__over__c_squ[ 9]+temp_factor);
		Q10[tid]=buff[10]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[10]+u_n__over__c_squ[10]+temp_factor);
		Q11[tid]=buff[11]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[11]+u_n__over__c_squ[11]+temp_factor);
		Q12[tid]=buff[12]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[12]+u_n__over__c_squ[12]+temp_factor);
		Q13[tid]=buff[13]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[13]+u_n__over__c_squ[13]+temp_factor);
		Q14[tid]=buff[14]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[14]+u_n__over__c_squ[14]+temp_factor);
		Q15[tid]=buff[15]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[15]+u_n__over__c_squ[15]+temp_factor);
		Q16[tid]=buff[16]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[16]+u_n__over__c_squ[16]+temp_factor);
		Q17[tid]=buff[17]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[17]+u_n__over__c_squ[17]+temp_factor);
		Q18[tid]=buff[18]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[18]+u_n__over__c_squ[18]+temp_factor);


		//todo : improve the following if by having a kernel to collect all the necessary data
		if (x == lx-2 and obstacles[index(z,y,(lx-1))]==0) {
			u_previous_spatial_boundary[index2D(z,y)] = u_x;
			v_previous_spatial_boundary[index2D(z,y)] = u_y;
			w_previous_spatial_boundary[index2D(z,y)] = u_z;

			u_current[index2D(z,y)] = u_x;
			v_current[index2D(z,y)] = u_y;
			w_current[index2D(z,y)] = u_z;

			u_current_temp[index2D(z,y)] = u_x;


		}//if (x == lx-2)
	}//if memory!


}


void LBM::cuda_relaxation(){

	if(data_location==CPU)
		copy_data_from_host_to_device();

	dim3 threads_type2(threads_for_streaming_collision_and_relaxation,1,1);
	dim3 grid_type2(blocks_for_streaming_collision_and_relaxation,1,1);

	relaxation_kernel_v4<<<grid_type2, threads_type2>>>( lx,  ly,  lz,  reynolds,  nu,  r_small,
			t_0,  t_1,  t_2,  c_squ,  omega,  one_minus_omega,
			reciprocal_c_squ,
			D3_hlp_d.Q0, D3_hlp_d.Q1, D3_hlp_d.Q2, D3_hlp_d.Q3,
			D3_hlp_d.Q4, D3_hlp_d.Q5, D3_hlp_d.Q6, D3_hlp_d.Q7,
			D3_hlp_d.Q8, D3_hlp_d.Q9, D3_hlp_d.Q10, D3_hlp_d.Q11,
			D3_hlp_d.Q12, D3_hlp_d.Q13, D3_hlp_d.Q14, D3_hlp_d.Q15,
			D3_hlp_d.Q16, D3_hlp_d.Q17, D3_hlp_d.Q18,
			D3_d.Q0, D3_d.Q1, D3_d.Q2, D3_d.Q3,
			D3_d.Q4, D3_d.Q5, D3_d.Q6, D3_d.Q7,
			D3_d.Q8, D3_d.Q9, D3_d.Q10, D3_d.Q11,
			D3_d.Q12, D3_d.Q13, D3_d.Q14, D3_d.Q15,
			D3_d.Q16, D3_d.Q17, D3_d.Q18,
			obstacles_d,
			u_previous_spatial_boundary_d, v_previous_spatial_boundary_d, w_previous_spatial_boundary_d,
			u_current_d, v_current_d, w_current_d, u_current_temp_d);




	cudaDeviceSynchronize();
}

	.file	"tmpxft_00270a65_00000000-6_relaxation.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4604:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4604:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.globl	_ZN3LBM10relaxationEv
	.type	_ZN3LBM10relaxationEv, @function
_ZN3LBM10relaxationEv:
.LFB4599:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rdi, %rbx
	subq	$384, %rsp
	.cfi_def_cfa_offset 432
	movq	%fs:40, %rax
	movq	%rax, 376(%rsp)
	xorl	%eax, %eax
	cmpl	$1, 784(%rdi)
	jne	.L3
	call	_ZN3LBM29copy_data_from_device_to_hostEv@PLT
.L3:
	movss	172(%rbx), %xmm0
	movss	84(%rbx), %xmm3
	xorl	%edi, %edi
	movss	88(%rbx), %xmm2
	movl	36(%rbx), %r12d
	mulss	%xmm0, %xmm3
	mulss	%xmm0, %xmm2
	mulss	92(%rbx), %xmm0
	movss	%xmm3, 52(%rsp)
	movss	%xmm2, 56(%rsp)
	movss	%xmm0, 60(%rsp)
.L4:
	cmpl	%edi, %r12d
	jle	.L2
	movl	32(%rbx), %r11d
	xorl	%esi, %esi
	leaq	224(%rsp), %r10
	movl	%r11d, %ebp
	imull	%edi, %ebp
.L13:
	cmpl	%esi, %r11d
	jle	.L10
	movl	28(%rbx), %r9d
	leal	(%rsi,%rbp), %eax
	xorl	%r8d, %r8d
	leaq	72(%rsp), %r13
	movslq	%eax, %rdx
	imull	%r9d, %eax
	leal	-2(%r9), %r14d
	salq	$2, %rdx
	cltq
	salq	$2, %rax
.L11:
	cmpl	%r8d, %r9d
	jle	.L20
	movq	384(%rbx), %rcx
	xorps	%xmm4, %xmm4
	movss	(%rcx,%rax), %xmm14
	movq	392(%rbx), %rcx
	movss	%xmm14, 148(%rsp)
	movss	(%rcx,%rax), %xmm12
	movq	400(%rbx), %rcx
	movss	%xmm12, 152(%rsp)
	movss	(%rcx,%rax), %xmm11
	movq	408(%rbx), %rcx
	movss	%xmm11, 156(%rsp)
	movss	(%rcx,%rax), %xmm10
	movq	416(%rbx), %rcx
	movss	%xmm10, 160(%rsp)
	movss	(%rcx,%rax), %xmm9
	movq	424(%rbx), %rcx
	movss	%xmm9, 164(%rsp)
	movss	(%rcx,%rax), %xmm8
	movq	432(%rbx), %rcx
	movss	%xmm8, 168(%rsp)
	movss	(%rcx,%rax), %xmm1
	movq	440(%rbx), %rcx
	movss	(%rcx,%rax), %xmm6
	movq	448(%rbx), %rcx
	movss	%xmm1, 48(%rsp)
	movss	%xmm1, 172(%rsp)
	movss	%xmm6, 176(%rsp)
	movss	(%rcx,%rax), %xmm1
	movq	456(%rbx), %rcx
	movss	(%rcx,%rax), %xmm3
	movss	%xmm1, 8(%rsp)
	movss	%xmm1, 180(%rsp)
	movss	%xmm3, 12(%rsp)
	movss	%xmm3, 184(%rsp)
	movq	464(%rbx), %rcx
	movss	(%rcx,%rax), %xmm2
	movq	472(%rbx), %rcx
	movss	(%rcx,%rax), %xmm1
	movq	480(%rbx), %rcx
	movss	%xmm2, 16(%rsp)
	movss	%xmm2, 188(%rsp)
	movss	(%rcx,%rax), %xmm3
	movq	488(%rbx), %rcx
	movss	%xmm1, 20(%rsp)
	movss	%xmm1, 192(%rsp)
	movss	(%rcx,%rax), %xmm2
	movq	496(%rbx), %rcx
	movss	%xmm3, 24(%rsp)
	movss	%xmm3, 196(%rsp)
	movss	(%rcx,%rax), %xmm1
	movq	504(%rbx), %rcx
	movss	%xmm2, 28(%rsp)
	movss	%xmm2, 200(%rsp)
	movss	(%rcx,%rax), %xmm3
	movq	512(%rbx), %rcx
	movss	%xmm1, 32(%rsp)
	movss	%xmm1, 204(%rsp)
	movss	(%rcx,%rax), %xmm2
	movq	520(%rbx), %rcx
	movss	%xmm3, 36(%rsp)
	movss	%xmm3, 208(%rsp)
	movss	(%rcx,%rax), %xmm3
	movss	%xmm2, 40(%rsp)
	movss	%xmm2, 212(%rsp)
	movss	%xmm3, 44(%rsp)
	movss	%xmm3, 216(%rsp)
	movq	528(%rbx), %rcx
	movss	(%rcx,%rax), %xmm15
	leaq	148(%rsp), %rcx
	movss	%xmm15, 220(%rsp)
.L5:
	cvtss2sd	(%rcx), %xmm0
	addq	$4, %rcx
	addsd	%xmm0, %xmm4
	cmpq	%r10, %rcx
	jne	.L5
	movq	536(%rbx), %rcx
	cvtsd2ss	%xmm4, %xmm4
	cmpl	$1, (%rcx,%rax)
	je	.L15
	movss	8(%rsp), %xmm0
	movaps	%xmm12, %xmm3
	movss	.LC2(%rip), %xmm5
	addss	%xmm6, %xmm3
	addss	16(%rsp), %xmm3
	movss	8(%rsp), %xmm1
	divss	%xmm4, %xmm5
	addss	20(%rsp), %xmm3
	addss	%xmm10, %xmm0
	movss	28(%rsp), %xmm2
	addss	32(%rsp), %xmm3
	addss	12(%rsp), %xmm0
	addss	24(%rsp), %xmm0
	addss	28(%rsp), %xmm0
	addss	%xmm11, %xmm1
	addss	%xmm8, %xmm2
	addss	32(%rsp), %xmm2
	addss	36(%rsp), %xmm2
	subss	%xmm0, %xmm3
	movss	12(%rsp), %xmm0
	addss	%xmm6, %xmm1
	addss	40(%rsp), %xmm1
	addss	%xmm9, %xmm0
	addss	16(%rsp), %xmm0
	addss	44(%rsp), %xmm0
	addss	36(%rsp), %xmm1
	addss	%xmm15, %xmm2
	addss	%xmm15, %xmm0
	subss	%xmm0, %xmm1
	movss	48(%rsp), %xmm0
	addss	24(%rsp), %xmm0
	addss	20(%rsp), %xmm0
	addss	40(%rsp), %xmm0
	addss	44(%rsp), %xmm0
	mulss	%xmm5, %xmm3
	subss	%xmm0, %xmm2
	mulss	%xmm5, %xmm1
	mulss	%xmm5, %xmm2
	jmp	.L6
.L15:
	xorps	%xmm2, %xmm2
	movaps	%xmm2, %xmm1
	movaps	%xmm2, %xmm3
.L6:
	movaps	%xmm1, %xmm13
	movaps	%xmm3, %xmm5
	xorl	%ecx, %ecx
	cvtss2sd	96(%rbx), %xmm7
	mulss	%xmm1, %xmm13
	movaps	%xmm7, %xmm0
	movl	$0x00000000, 72(%rsp)
	mulss	%xmm3, %xmm5
	addsd	%xmm7, %xmm0
	movss	%xmm3, 76(%rsp)
	movss	%xmm1, 80(%rsp)
	movss	%xmm2, 92(%rsp)
	addss	%xmm13, %xmm5
	movaps	%xmm2, %xmm13
	mulss	%xmm2, %xmm13
	addss	%xmm13, %xmm5
	movaps	%xmm3, %xmm13
	addss	%xmm1, %xmm13
	cvtss2sd	%xmm5, %xmm5
	subsd	%xmm5, %xmm0
	mulsd	.LC3(%rip), %xmm0
	movaps	%xmm3, %xmm5
	movss	%xmm13, 100(%rsp)
	movaps	%xmm1, %xmm13
	xorps	.LC4(%rip), %xmm5
	subss	%xmm3, %xmm13
	movss	%xmm5, 84(%rsp)
	divsd	%xmm7, %xmm0
	movss	%xmm13, 104(%rsp)
	movaps	%xmm5, %xmm13
	subss	%xmm2, %xmm5
	subss	%xmm1, %xmm13
	movaps	%xmm1, %xmm7
	xorps	.LC4(%rip), %xmm7
	movss	%xmm5, 120(%rsp)
	movaps	%xmm2, %xmm5
	subss	%xmm3, %xmm5
	movss	%xmm13, 108(%rsp)
	movaps	%xmm3, %xmm13
	subss	%xmm1, %xmm13
	movss	%xmm7, 88(%rsp)
	movaps	%xmm2, %xmm7
	xorps	.LC4(%rip), %xmm7
	movss	%xmm5, 124(%rsp)
	movaps	%xmm3, %xmm5
	addss	%xmm2, %xmm5
	movss	%xmm13, 112(%rsp)
	movaps	%xmm3, %xmm13
	subss	%xmm2, %xmm13
	movss	%xmm7, 96(%rsp)
	subss	%xmm1, %xmm7
	movss	%xmm5, 128(%rsp)
	movaps	%xmm1, %xmm5
	addss	%xmm2, %xmm5
	movss	%xmm13, 116(%rsp)
	movss	100(%rbx), %xmm13
	movss	%xmm7, 140(%rsp)
	movss	%xmm5, 132(%rsp)
	movaps	%xmm1, %xmm5
	subss	%xmm2, %xmm5
	movss	%xmm5, 136(%rsp)
	movaps	%xmm2, %xmm5
	subss	%xmm1, %xmm5
	movss	%xmm5, 144(%rsp)
	cvtsd2ss	%xmm0, %xmm0
.L7:
	movss	(%rcx,%r13), %xmm7
	movsd	.LC3(%rip), %xmm5
	mulss	%xmm13, %xmm7
	movss	%xmm7, (%rcx,%r10)
	cvtss2sd	%xmm7, %xmm7
	mulsd	%xmm7, %xmm5
	mulsd	%xmm7, %xmm5
	cvtsd2ss	%xmm5, %xmm5
	movss	%xmm5, 300(%rsp,%rcx)
	addq	$4, %rcx
	cmpq	$76, %rcx
	jne	.L7
	movss	56(%rsp), %xmm7
	movss	60(%rsp), %xmm5
	mulss	176(%rbx), %xmm14
	movq	216(%rbx), %rcx
	movss	300(%rsp), %xmm13
	mulss	%xmm4, %xmm5
	addss	224(%rsp), %xmm13
	mulss	%xmm4, %xmm7
	mulss	52(%rsp), %xmm4
	addss	%xmm0, %xmm13
	mulss	%xmm13, %xmm4
	addss	%xmm14, %xmm4
	movss	%xmm4, (%rcx,%rax)
	movq	224(%rbx), %rcx
	movss	304(%rsp), %xmm4
	addss	228(%rsp), %xmm4
	mulss	176(%rbx), %xmm12
	addss	%xmm0, %xmm4
	mulss	%xmm7, %xmm4
	addss	%xmm12, %xmm4
	movss	%xmm4, (%rcx,%rax)
	movq	232(%rbx), %rcx
	movss	308(%rsp), %xmm4
	addss	232(%rsp), %xmm4
	mulss	176(%rbx), %xmm11
	addss	%xmm0, %xmm4
	mulss	%xmm7, %xmm4
	addss	%xmm11, %xmm4
	movss	%xmm4, (%rcx,%rax)
	movq	240(%rbx), %rcx
	movss	312(%rsp), %xmm4
	addss	236(%rsp), %xmm4
	mulss	176(%rbx), %xmm10
	addss	%xmm0, %xmm4
	mulss	%xmm7, %xmm4
	addss	%xmm10, %xmm4
	movss	%xmm4, (%rcx,%rax)
	movq	248(%rbx), %rcx
	movss	316(%rsp), %xmm4
	addss	240(%rsp), %xmm4
	mulss	176(%rbx), %xmm9
	addss	%xmm0, %xmm4
	mulss	%xmm7, %xmm4
	addss	%xmm9, %xmm4
	movss	%xmm4, (%rcx,%rax)
	movq	256(%rbx), %rcx
	movss	320(%rsp), %xmm4
	addss	244(%rsp), %xmm4
	mulss	176(%rbx), %xmm8
	addss	%xmm0, %xmm4
	mulss	%xmm7, %xmm4
	addss	%xmm8, %xmm4
	movss	%xmm4, (%rcx,%rax)
	movq	264(%rbx), %rcx
	movss	324(%rsp), %xmm4
	addss	248(%rsp), %xmm4
	addss	%xmm0, %xmm4
	mulss	%xmm7, %xmm4
	movss	48(%rsp), %xmm7
	mulss	176(%rbx), %xmm7
	addss	%xmm7, %xmm4
	movss	%xmm4, (%rcx,%rax)
	mulss	176(%rbx), %xmm6
	movss	328(%rsp), %xmm4
	addss	252(%rsp), %xmm4
	movq	272(%rbx), %rcx
	addss	%xmm0, %xmm4
	mulss	%xmm5, %xmm4
	addss	%xmm6, %xmm4
	movss	8(%rsp), %xmm6
	movss	%xmm4, (%rcx,%rax)
	mulss	176(%rbx), %xmm6
	movss	332(%rsp), %xmm4
	addss	256(%rsp), %xmm4
	movq	280(%rbx), %rcx
	addss	%xmm0, %xmm4
	mulss	%xmm5, %xmm4
	addss	%xmm6, %xmm4
	movss	12(%rsp), %xmm6
	movss	%xmm4, (%rcx,%rax)
	mulss	176(%rbx), %xmm6
	movss	336(%rsp), %xmm4
	addss	260(%rsp), %xmm4
	movq	288(%rbx), %rcx
	addss	%xmm0, %xmm4
	mulss	%xmm5, %xmm4
	addss	%xmm6, %xmm4
	movss	16(%rsp), %xmm6
	movss	%xmm4, (%rcx,%rax)
	mulss	176(%rbx), %xmm6
	movss	340(%rsp), %xmm4
	addss	264(%rsp), %xmm4
	movq	296(%rbx), %rcx
	addss	%xmm0, %xmm4
	mulss	%xmm5, %xmm4
	addss	%xmm6, %xmm4
	movss	%xmm4, (%rcx,%rax)
	movq	304(%rbx), %rcx
	movss	344(%rsp), %xmm4
	addss	268(%rsp), %xmm4
	movss	20(%rsp), %xmm6
	mulss	176(%rbx), %xmm6
	addss	%xmm0, %xmm4
	mulss	%xmm5, %xmm4
	addss	%xmm6, %xmm4
	movss	24(%rsp), %xmm6
	movss	%xmm4, (%rcx,%rax)
	mulss	176(%rbx), %xmm6
	movss	348(%rsp), %xmm4
	addss	272(%rsp), %xmm4
	movq	312(%rbx), %rcx
	addss	%xmm0, %xmm4
	mulss	%xmm5, %xmm4
	addss	%xmm6, %xmm4
	movss	28(%rsp), %xmm6
	movss	%xmm4, (%rcx,%rax)
	mulss	176(%rbx), %xmm6
	movss	352(%rsp), %xmm4
	addss	276(%rsp), %xmm4
	movq	320(%rbx), %rcx
	addss	%xmm0, %xmm4
	mulss	%xmm5, %xmm4
	addss	%xmm6, %xmm4
	movss	32(%rsp), %xmm6
	movss	%xmm4, (%rcx,%rax)
	mulss	176(%rbx), %xmm6
	movss	356(%rsp), %xmm4
	addss	280(%rsp), %xmm4
	movq	328(%rbx), %rcx
	addss	%xmm0, %xmm4
	mulss	%xmm5, %xmm4
	addss	%xmm6, %xmm4
	movss	36(%rsp), %xmm6
	movss	%xmm4, (%rcx,%rax)
	mulss	176(%rbx), %xmm6
	movss	360(%rsp), %xmm4
	addss	284(%rsp), %xmm4
	movq	336(%rbx), %rcx
	addss	%xmm0, %xmm4
	mulss	%xmm5, %xmm4
	addss	%xmm6, %xmm4
	movss	40(%rsp), %xmm6
	movss	%xmm4, (%rcx,%rax)
	mulss	176(%rbx), %xmm6
	movss	364(%rsp), %xmm4
	addss	288(%rsp), %xmm4
	movq	344(%rbx), %rcx
	addss	%xmm0, %xmm4
	mulss	%xmm5, %xmm4
	addss	%xmm6, %xmm4
	movss	%xmm4, (%rcx,%rax)
	movss	44(%rsp), %xmm6
	movss	368(%rsp), %xmm4
	addss	292(%rsp), %xmm4
	mulss	176(%rbx), %xmm6
	movq	352(%rbx), %rcx
	addss	%xmm0, %xmm4
	mulss	%xmm5, %xmm4
	addss	%xmm6, %xmm4
	movss	%xmm4, (%rcx,%rax)
	movq	360(%rbx), %rcx
	movss	372(%rsp), %xmm4
	addss	296(%rsp), %xmm4
	addss	%xmm4, %xmm0
	movss	176(%rbx), %xmm4
	mulss	%xmm15, %xmm4
	mulss	%xmm5, %xmm0
	addss	%xmm4, %xmm0
	movss	%xmm0, (%rcx,%rax)
	cmpl	%r8d, %r14d
	jne	.L8
	movq	568(%rbx), %rcx
	movss	%xmm3, (%rcx,%rdx)
	movq	576(%rbx), %rcx
	movss	%xmm1, (%rcx,%rdx)
	movq	584(%rbx), %rcx
	movss	%xmm2, (%rcx,%rdx)
	movq	544(%rbx), %rcx
	movss	%xmm3, (%rcx,%rdx)
	movq	552(%rbx), %rcx
	movss	%xmm1, (%rcx,%rdx)
	movq	560(%rbx), %rcx
	movss	%xmm2, (%rcx,%rdx)
.L8:
	incl	%r8d
	addq	$4, %rax
	jmp	.L11
.L20:
	incl	%esi
	jmp	.L13
.L10:
	incl	%edi
	jmp	.L4
.L2:
	movq	376(%rsp), %rax
	subq	%fs:40, %rax
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	addq	$384, %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
.LFE4599:
	.size	_ZN3LBM10relaxationEv, .-_ZN3LBM10relaxationEv
	.align 2
	.globl	_ZN3LBM18initial_relaxationEv
	.type	_ZN3LBM18initial_relaxationEv, @function
_ZN3LBM18initial_relaxationEv:
.LFB4600:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rdi, %rax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$296, %rsp
	.cfi_def_cfa_offset 352
	cvtss2sd	64(%rdi), %xmm0
	movl	36(%rdi), %esi
	xorl	%edi, %edi
	mulsd	.LC5(%rip), %xmm0
	movss	.LC2(%rip), %xmm1
	movq	%fs:40, %rdx
	movq	%rdx, 280(%rsp)
	xorl	%edx, %edx
	addsd	.LC3(%rip), %xmm0
	movl	%esi, 120(%rsp)
	cvtsd2ss	%xmm0, %xmm0
	divss	%xmm0, %xmm1
.L22:
	cmpl	%edi, 120(%rsp)
	jle	.L21
	movl	32(%rax), %esi
	movl	%esi, 112(%rsp)
	imull	%edi, %esi
	movl	%esi, 124(%rsp)
	xorl	%esi, %esi
.L31:
	cmpl	%esi, 112(%rsp)
	jle	.L28
	movl	28(%rax), %r9d
	movl	124(%rsp), %ecx
	xorl	%r8d, %r8d
	leal	(%rsi,%rcx), %edx
	leal	-2(%r9), %ecx
	movl	%ecx, 116(%rsp)
	movslq	%edx, %rcx
	imull	%r9d, %edx
	salq	$2, %rcx
	movslq	%edx, %rdx
	salq	$2, %rdx
.L29:
	cmpl	%r8d, %r9d
	jle	.L37
	movq	384(%rax), %r10
	movq	392(%rax), %r13
	xorps	%xmm7, %xmm7
	movq	400(%rax), %r12
	movq	408(%rax), %rbp
	movss	(%r10,%rdx), %xmm3
	addq	%rdx, %r13
	movq	416(%rax), %rbx
	addq	%rdx, %r12
	movss	0(%r13), %xmm0
	addq	%rdx, %rbp
	movq	424(%rax), %r14
	movss	%xmm3, (%rsp)
	movss	(%r12), %xmm3
	movss	(%rsp), %xmm2
	addq	%rdx, %rbx
	addq	%rdx, %r14
	movq	432(%rax), %r11
	movq	448(%rax), %r15
	movss	%xmm3, 8(%rsp)
	addss	%xmm0, %xmm2
	addss	8(%rsp), %xmm2
	movss	0(%rbp), %xmm3
	addq	%rdx, %r11
	addq	%rdx, %r15
	movq	%r11, 16(%rsp)
	movss	(%r15), %xmm15
	addss	%xmm3, %xmm2
	movq	%r15, 40(%rsp)
	addss	%xmm7, %xmm2
	movss	(%rbx), %xmm7
	movss	%xmm7, 12(%rsp)
	movss	(%r14), %xmm7
	movss	12(%rsp), %xmm4
	movss	%xmm7, 24(%rsp)
	addss	24(%rsp), %xmm4
	movss	(%r11), %xmm7
	movq	440(%rax), %r11
	movss	%xmm7, 28(%rsp)
	addq	%rdx, %r11
	addss	%xmm7, %xmm4
	movss	(%r11), %xmm14
	movq	%r11, 32(%rsp)
	movq	456(%rax), %r11
	addss	%xmm14, %xmm4
	addq	%rdx, %r11
	movq	%r11, 48(%rsp)
	movss	(%r11), %xmm13
	movq	464(%rax), %r15
	addss	%xmm2, %xmm4
	movaps	%xmm15, %xmm2
	movq	472(%rax), %r11
	addss	%xmm13, %xmm2
	movq	488(%rax), %r10
	addq	%rdx, %r15
	addq	%rdx, %r11
	movss	(%r15), %xmm12
	movss	(%r11), %xmm7
	movq	%r11, 64(%rsp)
	addq	%rdx, %r10
	movq	480(%rax), %r11
	movss	(%r10), %xmm11
	movq	%r15, 56(%rsp)
	addss	%xmm12, %xmm2
	movq	496(%rax), %r15
	movss	%xmm7, 4(%rsp)
	addq	%rdx, %r11
	addq	%rdx, %r15
	addss	%xmm7, %xmm2
	movss	(%r11), %xmm7
	movss	(%r15), %xmm10
	movq	%r15, 72(%rsp)
	movq	504(%rax), %r15
	addss	%xmm4, %xmm2
	movaps	%xmm7, %xmm4
	addq	%rdx, %r15
	addss	%xmm11, %xmm4
	movss	(%r15), %xmm9
	movq	%r15, 80(%rsp)
	movq	512(%rax), %r15
	addss	%xmm10, %xmm4
	addq	%rdx, %r15
	movss	(%r15), %xmm6
	movq	%r15, 88(%rsp)
	movq	520(%rax), %r15
	addss	%xmm9, %xmm4
	addq	%rdx, %r15
	movss	(%r15), %xmm5
	movq	%r15, 96(%rsp)
	movq	528(%rax), %r15
	addss	%xmm2, %xmm4
	movaps	%xmm6, %xmm2
	addss	%xmm5, %xmm2
	addq	%rdx, %r15
	movss	(%r15), %xmm8
	movq	%r15, 104(%rsp)
	movq	536(%rax), %r15
	addss	%xmm8, %xmm2
	cmpl	$1, (%r15,%rdx)
	addss	%xmm4, %xmm2
	je	.L33
	addss	%xmm15, %xmm3
	addss	%xmm14, %xmm0
	movss	12(%rsp), %xmm4
	addss	%xmm13, %xmm4
	addss	%xmm13, %xmm3
	addss	%xmm12, %xmm0
	addss	4(%rsp), %xmm0
	addss	%xmm12, %xmm4
	addss	%xmm7, %xmm3
	addss	28(%rsp), %xmm7
	addss	%xmm10, %xmm0
	addss	4(%rsp), %xmm7
	addss	%xmm5, %xmm4
	addss	%xmm11, %xmm3
	addss	%xmm8, %xmm4
	subss	%xmm3, %xmm0
	movss	8(%rsp), %xmm3
	addss	%xmm15, %xmm3
	divss	%xmm2, %xmm0
	addss	%xmm14, %xmm3
	addss	%xmm6, %xmm3
	addss	%xmm7, %xmm6
	addss	%xmm9, %xmm3
	addss	%xmm6, %xmm5
	subss	%xmm4, %xmm3
	movss	24(%rsp), %xmm4
	addss	%xmm11, %xmm4
	divss	%xmm2, %xmm3
	addss	%xmm10, %xmm4
	addss	%xmm9, %xmm4
	addss	%xmm8, %xmm4
	subss	%xmm5, %xmm4
	divss	%xmm2, %xmm4
	jmp	.L23
.L33:
	xorps	%xmm4, %xmm4
	movaps	%xmm4, %xmm3
	movaps	%xmm4, %xmm0
.L23:
	movaps	%xmm0, %xmm7
	movaps	%xmm0, %xmm5
	movaps	%xmm3, %xmm6
	movss	96(%rax), %xmm9
	addss	%xmm3, %xmm7
	xorps	.LC4(%rip), %xmm5
	xorps	.LC4(%rip), %xmm6
	movss	%xmm0, 132(%rsp)
	cvtss2sd	%xmm9, %xmm8
	movl	$4, %r15d
	movsd	.LC6(%rip), %xmm10
	movss	%xmm3, 136(%rsp)
	movss	%xmm5, 140(%rsp)
	movss	%xmm7, 156(%rsp)
	movaps	%xmm3, %xmm7
	movss	%xmm6, 144(%rsp)
	subss	%xmm0, %xmm7
	movaps	%xmm4, %xmm6
	xorps	.LC4(%rip), %xmm6
	movss	%xmm4, 148(%rsp)
	movss	%xmm6, 152(%rsp)
	subss	%xmm3, %xmm6
	movss	%xmm7, 160(%rsp)
	movaps	%xmm5, %xmm7
	subss	%xmm4, %xmm5
	subss	%xmm3, %xmm7
	movss	%xmm6, 196(%rsp)
	movaps	%xmm8, %xmm6
	movss	%xmm5, 176(%rsp)
	movaps	%xmm4, %xmm5
	addsd	%xmm8, %xmm6
	movss	%xmm7, 164(%rsp)
	subss	%xmm0, %xmm5
	movaps	%xmm0, %xmm7
	subss	%xmm3, %xmm7
	mulsd	%xmm6, %xmm8
	movss	%xmm5, 180(%rsp)
	movaps	%xmm0, %xmm5
	movss	%xmm7, 168(%rsp)
	addss	%xmm4, %xmm5
	movaps	%xmm0, %xmm7
	subss	%xmm4, %xmm7
	movss	%xmm5, 184(%rsp)
	movaps	%xmm3, %xmm5
	movss	%xmm7, 172(%rsp)
	addss	%xmm4, %xmm5
	movaps	%xmm0, %xmm7
	mulss	%xmm0, %xmm7
	movss	%xmm5, 188(%rsp)
	movaps	%xmm3, %xmm5
	subss	%xmm4, %xmm5
	movss	%xmm5, 192(%rsp)
	movaps	%xmm4, %xmm5
	subss	%xmm3, %xmm5
	movss	%xmm5, 200(%rsp)
	movaps	%xmm3, %xmm5
	mulss	%xmm3, %xmm5
	addss	%xmm5, %xmm7
	movaps	%xmm4, %xmm5
	mulss	%xmm4, %xmm5
	addss	%xmm5, %xmm7
	movss	84(%rax), %xmm5
	mulss	%xmm2, %xmm5
	cvtss2sd	%xmm7, %xmm7
	divsd	%xmm6, %xmm7
	cvtss2sd	%xmm5, %xmm5
	subsd	%xmm7, %xmm10
	mulsd	%xmm10, %xmm5
	movss	88(%rax), %xmm10
	mulss	%xmm2, %xmm10
	cvtsd2ss	%xmm5, %xmm5
	cvtss2sd	%xmm10, %xmm10
.L24:
	movss	128(%rsp,%r15), %xmm11
	movaps	%xmm11, %xmm6
	mulss	%xmm11, %xmm11
	divss	%xmm9, %xmm6
	cvtss2sd	%xmm11, %xmm11
	divsd	%xmm8, %xmm11
	cvtss2sd	%xmm6, %xmm6
	addsd	.LC6(%rip), %xmm6
	addsd	%xmm11, %xmm6
	subsd	%xmm7, %xmm6
	mulsd	%xmm10, %xmm6
	cvtsd2ss	%xmm6, %xmm6
	movss	%xmm6, 204(%rsp,%r15)
	addq	$4, %r15
	cmpq	$28, %r15
	jne	.L24
	mulss	92(%rax), %xmm2
	cvtss2sd	%xmm2, %xmm2
.L25:
	movss	128(%rsp,%r15), %xmm10
	movaps	%xmm10, %xmm6
	mulss	%xmm10, %xmm10
	divss	%xmm9, %xmm6
	cvtss2sd	%xmm10, %xmm10
	divsd	%xmm8, %xmm10
	cvtss2sd	%xmm6, %xmm6
	addsd	.LC6(%rip), %xmm6
	addsd	%xmm10, %xmm6
	subsd	%xmm7, %xmm6
	mulsd	%xmm2, %xmm6
	cvtsd2ss	%xmm6, %xmm6
	movss	%xmm6, 204(%rsp,%r15)
	addq	$4, %r15
	cmpq	$76, %r15
	jne	.L25
	subss	(%rsp), %xmm5
	movq	216(%rax), %r15
	movss	208(%rsp), %xmm2
	mulss	%xmm1, %xmm5
	addss	(%rsp), %xmm5
	movss	%xmm5, (%r15,%rdx)
	movss	0(%r13), %xmm5
	movq	224(%rax), %r13
	subss	%xmm5, %xmm2
	mulss	%xmm1, %xmm2
	addss	%xmm5, %xmm2
	movss	%xmm2, 0(%r13,%rdx)
	movss	(%r12), %xmm5
	movss	212(%rsp), %xmm2
	movq	232(%rax), %r12
	subss	%xmm5, %xmm2
	mulss	%xmm1, %xmm2
	addss	%xmm5, %xmm2
	movss	%xmm2, (%r12,%rdx)
	movss	0(%rbp), %xmm5
	movss	216(%rsp), %xmm2
	movq	240(%rax), %rbp
	subss	%xmm5, %xmm2
	mulss	%xmm1, %xmm2
	addss	%xmm5, %xmm2
	movss	%xmm2, 0(%rbp,%rdx)
	movss	(%rbx), %xmm5
	movss	220(%rsp), %xmm2
	movq	248(%rax), %rbx
	subss	%xmm5, %xmm2
	mulss	%xmm1, %xmm2
	addss	%xmm5, %xmm2
	movss	%xmm2, (%rbx,%rdx)
	movss	(%r14), %xmm5
	movss	224(%rsp), %xmm2
	movq	256(%rax), %rbx
	subss	%xmm5, %xmm2
	mulss	%xmm1, %xmm2
	addss	%xmm5, %xmm2
	movss	%xmm2, (%rbx,%rdx)
	movq	16(%rsp), %rbx
	movss	228(%rsp), %xmm2
	movss	(%rbx), %xmm5
	movq	264(%rax), %rbx
	subss	%xmm5, %xmm2
	mulss	%xmm1, %xmm2
	addss	%xmm5, %xmm2
	movss	%xmm2, (%rbx,%rdx)
	movq	32(%rsp), %rbx
	movss	(%rbx), %xmm5
	movq	272(%rax), %rbx
	movss	232(%rsp), %xmm2
	subss	%xmm5, %xmm2
	mulss	%xmm1, %xmm2
	addss	%xmm5, %xmm2
	movss	%xmm2, (%rbx,%rdx)
	movq	40(%rsp), %rbx
	movss	236(%rsp), %xmm2
	movss	(%rbx), %xmm5
	movq	280(%rax), %rbx
	subss	%xmm5, %xmm2
	mulss	%xmm1, %xmm2
	addss	%xmm5, %xmm2
	movss	%xmm2, (%rbx,%rdx)
	movq	48(%rsp), %rbx
	movss	240(%rsp), %xmm2
	movss	(%rbx), %xmm5
	movq	288(%rax), %rbx
	subss	%xmm5, %xmm2
	mulss	%xmm1, %xmm2
	addss	%xmm5, %xmm2
	movss	%xmm2, (%rbx,%rdx)
	movq	56(%rsp), %rbx
	movss	244(%rsp), %xmm2
	movss	(%rbx), %xmm5
	movq	296(%rax), %rbx
	subss	%xmm5, %xmm2
	mulss	%xmm1, %xmm2
	addss	%xmm5, %xmm2
	movss	%xmm2, (%rbx,%rdx)
	movq	64(%rsp), %rbx
	movss	248(%rsp), %xmm2
	movss	(%rbx), %xmm5
	movq	304(%rax), %rbx
	subss	%xmm5, %xmm2
	mulss	%xmm1, %xmm2
	addss	%xmm5, %xmm2
	movss	%xmm2, (%rbx,%rdx)
	movss	(%r11), %xmm5
	movq	72(%rsp), %rbx
	movss	252(%rsp), %xmm2
	movq	312(%rax), %r11
	subss	%xmm5, %xmm2
	mulss	%xmm1, %xmm2
	addss	%xmm5, %xmm2
	movss	%xmm2, (%r11,%rdx)
	movss	(%r10), %xmm5
	movss	256(%rsp), %xmm2
	movq	320(%rax), %r10
	subss	%xmm5, %xmm2
	mulss	%xmm1, %xmm2
	addss	%xmm5, %xmm2
	movss	%xmm2, (%r10,%rdx)
	movss	(%rbx), %xmm5
	movq	328(%rax), %r10
	movss	260(%rsp), %xmm2
	movq	80(%rsp), %rbx
	subss	%xmm5, %xmm2
	mulss	%xmm1, %xmm2
	addss	%xmm5, %xmm2
	movss	%xmm2, (%r10,%rdx)
	movss	(%rbx), %xmm5
	movss	264(%rsp), %xmm2
	movq	336(%rax), %r10
	movq	88(%rsp), %rbx
	subss	%xmm5, %xmm2
	mulss	%xmm1, %xmm2
	addss	%xmm5, %xmm2
	movss	%xmm2, (%r10,%rdx)
	movss	(%rbx), %xmm5
	movss	268(%rsp), %xmm2
	movq	344(%rax), %r10
	movq	96(%rsp), %rbx
	subss	%xmm5, %xmm2
	mulss	%xmm1, %xmm2
	addss	%xmm5, %xmm2
	movss	%xmm2, (%r10,%rdx)
	movss	(%rbx), %xmm5
	movss	272(%rsp), %xmm2
	movq	352(%rax), %r10
	movq	104(%rsp), %rbx
	subss	%xmm5, %xmm2
	mulss	%xmm1, %xmm2
	addss	%xmm5, %xmm2
	movss	%xmm2, (%r10,%rdx)
	movss	(%rbx), %xmm5
	movss	276(%rsp), %xmm2
	movq	360(%rax), %r10
	subss	%xmm5, %xmm2
	mulss	%xmm1, %xmm2
	addss	%xmm5, %xmm2
	movss	%xmm2, (%r10,%rdx)
	cmpl	%r8d, 116(%rsp)
	jne	.L26
	movq	568(%rax), %r10
	movq	544(%rax), %rbx
	movq	552(%rax), %r11
	movss	%xmm0, (%r10,%rcx)
	movq	576(%rax), %r10
	addq	%rcx, %rbx
	addq	%rcx, %r11
	movss	%xmm3, (%r10,%rcx)
	movq	584(%rax), %r10
	movss	%xmm4, (%r10,%rcx)
	movq	560(%rax), %r10
	movss	%xmm0, (%rbx)
	addq	%rcx, %r10
	movss	%xmm3, (%r11)
	movss	%xmm4, (%r10)
	movss	(%rbx), %xmm0
	movq	592(%rax), %rbx
	movss	%xmm0, (%rbx,%rcx)
	movss	(%r11), %xmm0
	movq	600(%rax), %r11
	movss	%xmm0, (%r11,%rcx)
	movss	(%r10), %xmm0
	movq	608(%rax), %r10
	movss	%xmm0, (%r10,%rcx)
.L26:
	incl	%r8d
	addq	$4, %rdx
	jmp	.L29
.L37:
	incl	%esi
	jmp	.L31
.L28:
	incl	%edi
	jmp	.L22
.L21:
	movq	280(%rsp), %rax
	subq	%fs:40, %rax
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	addq	$296, %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
.LFE4600:
	.size	_ZN3LBM18initial_relaxationEv, .-_ZN3LBM18initial_relaxationEv
	.globl	_Z188__device_stub__Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
	.type	_Z188__device_stub__Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_, @function
_Z188__device_stub__Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_:
.LFB4626:
	.cfi_startproc
	endbr64
	subq	$968, %rsp
	.cfi_def_cfa_offset 976
	movq	992(%rsp), %rax
	movl	%edi, 412(%rsp)
	leaq	432(%rsp), %rdi
	movl	%esi, 408(%rsp)
	leaq	444(%rsp), %rsi
	movq	%rax, 336(%rsp)
	movq	1000(%rsp), %rax
	movl	%edx, 404(%rsp)
	leaq	416(%rsp), %rdx
	movq	%rax, 328(%rsp)
	movq	1008(%rsp), %rax
	movq	%rcx, 360(%rsp)
	leaq	424(%rsp), %rcx
	movq	%rax, 320(%rsp)
	movq	1016(%rsp), %rax
	movq	%r8, 352(%rsp)
	movq	%rax, 312(%rsp)
	movq	1024(%rsp), %rax
	movq	%r9, 344(%rsp)
	movq	%rax, 304(%rsp)
	movq	1032(%rsp), %rax
	movss	%xmm0, 400(%rsp)
	movq	%rax, 296(%rsp)
	movq	1040(%rsp), %rax
	movss	%xmm1, 396(%rsp)
	movq	%rax, 288(%rsp)
	movq	1048(%rsp), %rax
	movss	%xmm2, 392(%rsp)
	movq	%rax, 280(%rsp)
	movss	%xmm3, 388(%rsp)
	movss	%xmm4, 384(%rsp)
	movss	%xmm5, 380(%rsp)
	movss	%xmm6, 376(%rsp)
	movss	%xmm7, 372(%rsp)
	movq	1056(%rsp), %rax
	movq	%rax, 272(%rsp)
	movq	1064(%rsp), %rax
	movq	%rax, 264(%rsp)
	movq	1072(%rsp), %rax
	movq	%rax, 256(%rsp)
	movq	1080(%rsp), %rax
	movq	%rax, 248(%rsp)
	movq	1088(%rsp), %rax
	movq	%rax, 240(%rsp)
	movq	1096(%rsp), %rax
	movq	%rax, 232(%rsp)
	movq	1104(%rsp), %rax
	movq	%rax, 224(%rsp)
	movq	1112(%rsp), %rax
	movq	%rax, 216(%rsp)
	movq	1120(%rsp), %rax
	movq	%rax, 208(%rsp)
	movq	1128(%rsp), %rax
	movq	%rax, 200(%rsp)
	movq	1136(%rsp), %rax
	movq	%rax, 192(%rsp)
	movq	1144(%rsp), %rax
	movq	%rax, 184(%rsp)
	movq	1152(%rsp), %rax
	movq	%rax, 176(%rsp)
	movq	1160(%rsp), %rax
	movq	%rax, 168(%rsp)
	movq	1168(%rsp), %rax
	movq	%rax, 160(%rsp)
	movq	1176(%rsp), %rax
	movq	%rax, 152(%rsp)
	movq	1184(%rsp), %rax
	movq	%rax, 144(%rsp)
	movq	1192(%rsp), %rax
	movq	%rax, 136(%rsp)
	movq	1200(%rsp), %rax
	movq	%rax, 128(%rsp)
	movq	1208(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	1216(%rsp), %rax
	movq	%rax, 112(%rsp)
	movq	1224(%rsp), %rax
	movq	%rax, 104(%rsp)
	movq	1232(%rsp), %rax
	movq	%rax, 96(%rsp)
	movq	1240(%rsp), %rax
	movq	%rax, 88(%rsp)
	movq	1248(%rsp), %rax
	movq	%rax, 80(%rsp)
	movq	1256(%rsp), %rax
	movq	%rax, 72(%rsp)
	movq	1264(%rsp), %rax
	movq	%rax, 64(%rsp)
	movq	1272(%rsp), %rax
	movq	%rax, 56(%rsp)
	movq	1280(%rsp), %rax
	movq	%rax, 48(%rsp)
	movq	1288(%rsp), %rax
	movq	%rax, 40(%rsp)
	movq	1296(%rsp), %rax
	movq	%rax, 32(%rsp)
	movq	1304(%rsp), %rax
	movq	%rax, 24(%rsp)
	movq	1312(%rsp), %rax
	movq	%rax, 16(%rsp)
	movq	1320(%rsp), %rax
	movq	%rax, 8(%rsp)
	movq	1328(%rsp), %rax
	movq	%rax, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 952(%rsp)
	xorl	%eax, %eax
	leaq	412(%rsp), %rax
	movq	%rax, 480(%rsp)
	leaq	408(%rsp), %rax
	movq	%rax, 488(%rsp)
	leaq	404(%rsp), %rax
	movq	%rax, 496(%rsp)
	leaq	400(%rsp), %rax
	movq	%rax, 504(%rsp)
	leaq	396(%rsp), %rax
	movq	%rax, 512(%rsp)
	leaq	392(%rsp), %rax
	movq	%rax, 520(%rsp)
	leaq	388(%rsp), %rax
	movq	%rax, 528(%rsp)
	leaq	384(%rsp), %rax
	movq	%rax, 536(%rsp)
	leaq	380(%rsp), %rax
	movq	%rax, 544(%rsp)
	leaq	376(%rsp), %rax
	movq	%rax, 552(%rsp)
	leaq	372(%rsp), %rax
	movq	%rax, 560(%rsp)
	leaq	976(%rsp), %rax
	movq	%rax, 568(%rsp)
	leaq	984(%rsp), %rax
	movq	%rax, 576(%rsp)
	leaq	360(%rsp), %rax
	movq	%rax, 584(%rsp)
	leaq	352(%rsp), %rax
	movq	%rax, 592(%rsp)
	leaq	344(%rsp), %rax
	movq	%rax, 600(%rsp)
	leaq	336(%rsp), %rax
	movq	%rax, 608(%rsp)
	leaq	328(%rsp), %rax
	movq	%rax, 616(%rsp)
	leaq	320(%rsp), %rax
	movq	%rax, 624(%rsp)
	leaq	312(%rsp), %rax
	movq	%rax, 632(%rsp)
	leaq	304(%rsp), %rax
	movq	%rax, 640(%rsp)
	leaq	296(%rsp), %rax
	movq	%rax, 648(%rsp)
	leaq	288(%rsp), %rax
	movq	%rax, 656(%rsp)
	leaq	280(%rsp), %rax
	movq	%rax, 664(%rsp)
	leaq	272(%rsp), %rax
	movq	%rax, 672(%rsp)
	leaq	264(%rsp), %rax
	movq	%rax, 680(%rsp)
	leaq	256(%rsp), %rax
	movq	%rax, 688(%rsp)
	leaq	248(%rsp), %rax
	movq	%rax, 696(%rsp)
	leaq	240(%rsp), %rax
	movq	%rax, 704(%rsp)
	leaq	232(%rsp), %rax
	movq	%rax, 712(%rsp)
	leaq	224(%rsp), %rax
	movq	%rax, 720(%rsp)
	leaq	216(%rsp), %rax
	movq	%rax, 728(%rsp)
	leaq	208(%rsp), %rax
	movq	%rax, 736(%rsp)
	leaq	200(%rsp), %rax
	movq	%rax, 744(%rsp)
	leaq	192(%rsp), %rax
	movq	%rax, 752(%rsp)
	leaq	184(%rsp), %rax
	movq	%rax, 760(%rsp)
	leaq	176(%rsp), %rax
	movq	%rax, 768(%rsp)
	leaq	168(%rsp), %rax
	movq	%rax, 776(%rsp)
	leaq	160(%rsp), %rax
	movq	%rax, 784(%rsp)
	leaq	152(%rsp), %rax
	movq	%rax, 792(%rsp)
	leaq	144(%rsp), %rax
	movq	%rax, 800(%rsp)
	leaq	136(%rsp), %rax
	movq	%rax, 808(%rsp)
	leaq	128(%rsp), %rax
	movq	%rax, 816(%rsp)
	leaq	120(%rsp), %rax
	movq	%rax, 824(%rsp)
	leaq	112(%rsp), %rax
	movq	%rax, 832(%rsp)
	leaq	104(%rsp), %rax
	movq	%rax, 840(%rsp)
	leaq	96(%rsp), %rax
	movq	%rax, 848(%rsp)
	leaq	88(%rsp), %rax
	movq	%rax, 856(%rsp)
	leaq	80(%rsp), %rax
	movq	%rax, 864(%rsp)
	leaq	72(%rsp), %rax
	movq	%rax, 872(%rsp)
	leaq	64(%rsp), %rax
	movq	%rax, 880(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, 888(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 896(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 904(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 912(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 920(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 928(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 936(%rsp)
	movq	%rsp, %rax
	movq	%rax, 944(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 432(%rsp)
	movl	$1, 440(%rsp)
	movq	%rax, 444(%rsp)
	movl	$1, 452(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L38
	pushq	424(%rsp)
	.cfi_def_cfa_offset 984
	leaq	_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_(%rip), %rdi
	pushq	424(%rsp)
	.cfi_def_cfa_offset 992
	movq	460(%rsp), %rcx
	movl	468(%rsp), %r8d
	movq	448(%rsp), %rsi
	movl	456(%rsp), %edx
	leaq	496(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 984
	popq	%rdx
	.cfi_def_cfa_offset 976
.L38:
	movq	952(%rsp), %rax
	subq	%fs:40, %rax
	je	.L40
	call	__stack_chk_fail@PLT
.L40:
	addq	$968, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4626:
	.size	_Z188__device_stub__Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_, .-_Z188__device_stub__Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
	.globl	_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
	.type	_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_, @function
_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_:
.LFB4627:
	.cfi_startproc
	endbr64
	jmp	_Z188__device_stub__Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
	.cfi_endproc
.LFE4627:
	.size	_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_, .-_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
	.align 2
	.globl	_ZN3LBM15cuda_relaxationEv
	.type	_ZN3LBM15cuda_relaxationEv, @function
_ZN3LBM15cuda_relaxationEv:
.LFB4601:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	cmpl	$0, 784(%rdi)
	jne	.L44
	call	_ZN3LBM29copy_data_from_host_to_deviceEv@PLT
.L44:
	movl	48(%rbx), %eax
	movl	52(%rbx), %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	%eax, 8(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 12(%rsp)
	movl	16(%rsp), %ecx
	movl	%edx, 20(%rsp)
	movq	8(%rsp), %rdx
	movq	%rax, 24(%rsp)
	movq	20(%rsp), %rdi
	movl	28(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L45
	movq	992(%rbx), %rcx
	movss	72(%rbx), %xmm0
	movl	36(%rbx), %edx
	movl	32(%rbx), %esi
	movl	28(%rbx), %edi
	pushq	%rax
	.cfi_def_cfa_offset 56
	pushq	624(%rbx)
	.cfi_def_cfa_offset 64
	pushq	640(%rbx)
	.cfi_def_cfa_offset 72
	pushq	632(%rbx)
	.cfi_def_cfa_offset 80
	pushq	616(%rbx)
	.cfi_def_cfa_offset 88
	pushq	664(%rbx)
	.cfi_def_cfa_offset 96
	pushq	656(%rbx)
	.cfi_def_cfa_offset 104
	pushq	648(%rbx)
	.cfi_def_cfa_offset 112
	pushq	800(%rbx)
	.cfi_def_cfa_offset 120
	pushq	968(%rbx)
	.cfi_def_cfa_offset 128
	pushq	960(%rbx)
	.cfi_def_cfa_offset 136
	pushq	952(%rbx)
	.cfi_def_cfa_offset 144
	pushq	944(%rbx)
	.cfi_def_cfa_offset 152
	pushq	936(%rbx)
	.cfi_def_cfa_offset 160
	pushq	928(%rbx)
	.cfi_def_cfa_offset 168
	pushq	920(%rbx)
	.cfi_def_cfa_offset 176
	pushq	912(%rbx)
	.cfi_def_cfa_offset 184
	pushq	904(%rbx)
	.cfi_def_cfa_offset 192
	pushq	896(%rbx)
	.cfi_def_cfa_offset 200
	pushq	888(%rbx)
	.cfi_def_cfa_offset 208
	pushq	880(%rbx)
	.cfi_def_cfa_offset 216
	pushq	872(%rbx)
	.cfi_def_cfa_offset 224
	pushq	864(%rbx)
	.cfi_def_cfa_offset 232
	pushq	856(%rbx)
	.cfi_def_cfa_offset 240
	pushq	848(%rbx)
	.cfi_def_cfa_offset 248
	pushq	840(%rbx)
	.cfi_def_cfa_offset 256
	pushq	832(%rbx)
	.cfi_def_cfa_offset 264
	pushq	824(%rbx)
	.cfi_def_cfa_offset 272
	pushq	1136(%rbx)
	.cfi_def_cfa_offset 280
	pushq	1128(%rbx)
	.cfi_def_cfa_offset 288
	pushq	1120(%rbx)
	.cfi_def_cfa_offset 296
	pushq	1112(%rbx)
	.cfi_def_cfa_offset 304
	pushq	1104(%rbx)
	.cfi_def_cfa_offset 312
	pushq	1096(%rbx)
	.cfi_def_cfa_offset 320
	pushq	1088(%rbx)
	.cfi_def_cfa_offset 328
	pushq	1080(%rbx)
	.cfi_def_cfa_offset 336
	pushq	1072(%rbx)
	.cfi_def_cfa_offset 344
	pushq	1064(%rbx)
	.cfi_def_cfa_offset 352
	pushq	1056(%rbx)
	.cfi_def_cfa_offset 360
	pushq	1048(%rbx)
	.cfi_def_cfa_offset 368
	pushq	1040(%rbx)
	.cfi_def_cfa_offset 376
	pushq	1032(%rbx)
	.cfi_def_cfa_offset 384
	pushq	1024(%rbx)
	.cfi_def_cfa_offset 392
	pushq	1016(%rbx)
	.cfi_def_cfa_offset 400
	movss	100(%rbx), %xmm1
	pushq	%r8
	.cfi_def_cfa_offset 408
	pushq	%r8
	.cfi_def_cfa_offset 416
	movss	%xmm1, 8(%rsp)
	movss	176(%rbx), %xmm1
	movss	%xmm1, (%rsp)
	movss	96(%rbx), %xmm6
	movss	92(%rbx), %xmm5
	movq	1008(%rbx), %r9
	movq	1000(%rbx), %r8
	movss	172(%rbx), %xmm7
	movss	88(%rbx), %xmm4
	movss	84(%rbx), %xmm3
	movss	68(%rbx), %xmm2
	movss	64(%rbx), %xmm1
	call	_Z188__device_stub__Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
	addq	$368, %rsp
	.cfi_def_cfa_offset 48
.L45:
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	cudaDeviceSynchronize@PLT
	.cfi_endproc
.LFE4601:
	.size	_ZN3LBM15cuda_relaxationEv, .-_ZN3LBM15cuda_relaxationEv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC7:
	.string	"_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4629:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC7(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4629:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC2:
	.long	1065353216
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC3:
	.long	0
	.long	1071644672
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC4:
	.long	-2147483648
	.long	0
	.long	0
	.long	0
	.section	.rodata.cst8
	.align 8
.LC5:
	.long	0
	.long	1074266112
	.align 8
.LC6:
	.long	0
	.long	1072693248
	.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 <numeric>




void LBM::relaxation(){





	/*One-step density relaxation process

				c.......density relaxation: a single time relaxation with relaxation
				c       parameter omega is applied here. This step is only "local",
				c       nothing is propagated through the lattice.
				c*/

	if(data_location==GPU)
		copy_data_from_device_to_host();

	int  x,y,z;
	FLOATING  u_x=0.0, u_y=0.0, u_z=0.0, u_squ=0.0, rho=0.0, reciprocal_rho=0.0;




	FLOATING u_n[19];
	//	FLOATING n_equ[19];
	FLOATING buff[19];

	//	FLOATING u_n_squared[19];
	//FLOATING two_x_c_squ_sqared;
	const FLOATING omega_x_t_0=omega*t_0, omega_x_t_1=omega*t_1, omega_x_t_2=omega*t_2;
	FLOATING omega_x_rho_x_t_0, omega_x_rho_x_t_1, omega_x_rho_x_t_2;
	FLOATING temp_factor;
	FLOATING u_n__over__c_squ[19];
	FLOATING u_n__over__c_squ__squared_and_halved[19];

	//....square speed of sound
	/*      compute the out let velocity with a convevtive boundary condition
					c.....loop over all nodes
					c.....attention: actual densities are stored after the propagation
					c                step in the help-array n_hlp !*/


#pragma unroll
	for (z = 0 ; z< lz ; ++z){
#pragma unroll
		for (y = 0 ; y< ly ; ++y){
#pragma unroll
			for (x = 0 ; x< lx; ++x){

				/*c.........only free nodes are considered here
					!if (.not. obstacles[z][y][x]) then
					c...........integral local density
					c...........initialize variable ro*/
				//memory optimised implementation
				buff[0]=D3_hlp.Q0[index(z,y,x)];
				buff[1]=D3_hlp.Q1[index(z,y,x)];
				buff[2]=D3_hlp.Q2[index(z,y,x)];
				buff[3]=D3_hlp.Q3[index(z,y,x)];
				buff[4]=D3_hlp.Q4[index(z,y,x)];
				buff[5]=D3_hlp.Q5[index(z,y,x)];
				buff[6]=D3_hlp.Q6[index(z,y,x)];
				buff[7]=D3_hlp.Q7[index(z,y,x)];
				buff[8]=D3_hlp.Q8[index(z,y,x)];
				buff[9]=D3_hlp.Q9[index(z,y,x)];
				buff[10]=D3_hlp.Q10[index(z,y,x)];
				buff[11]=D3_hlp.Q11[index(z,y,x)];
				buff[12]=D3_hlp.Q12[index(z,y,x)];
				buff[13]=D3_hlp.Q13[index(z,y,x)];
				buff[14]=D3_hlp.Q14[index(z,y,x)];
				buff[15]=D3_hlp.Q15[index(z,y,x)];
				buff[16]=D3_hlp.Q16[index(z,y,x)];
				buff[17]=D3_hlp.Q17[index(z,y,x)];
				buff[18]=D3_hlp.Q18[index(z,y,x)];

				rho=accumulate(buff, buff+DENSITIES, 0.0);

				reciprocal_rho=1.0/rho;




				switch(obstacles[index(z,y,x)]){
				case 1:
					u_x = 0.0;
					u_y = 0.0;
					u_z = 0.0;
					break;
				default:
					u_x = 0.0;
					u_x =  reciprocal_rho*(buff[1] + buff[7] + buff[10] +buff[11] + buff[14]-
							(buff[3] + buff[8] + buff[9] +buff[12] + buff[13]));

					u_y = 0.0;
					u_y =  reciprocal_rho*(buff[2]+buff[8]+buff[7]+buff[16] + buff[15] -
							(buff[4] + buff[9] + buff[10] +buff[17] + buff[18]));

					u_z = 0.0;
					u_z =  reciprocal_rho*(buff[5]+buff[13]+buff[14]+buff[15]+buff[18]-
							(buff[6]+buff[12]+buff[11]+buff[16]+buff[17]));
					break;
				}//switch(obstacles[index(z,y,x)])

				//original implementation
				//				rho=0.0;
				//				rho+=D3_hlp.Q0[index(z,y,x)]+D3_hlp.Q1[index(z,y,x)]+D3_hlp.Q2[index(z,y,x)]+D3_hlp.Q3[index(z,y,x)];
				//				rho+=D3_hlp.Q4[index(z,y,x)]+D3_hlp.Q5[index(z,y,x)]+D3_hlp.Q6[index(z,y,x)]+D3_hlp.Q7[index(z,y,x)];
				//				rho+=D3_hlp.Q8[index(z,y,x)]+D3_hlp.Q9[index(z,y,x)]+D3_hlp.Q10[index(z,y,x)]+D3_hlp.Q11[index(z,y,x)];
				//				rho+=D3_hlp.Q12[index(z,y,x)]+D3_hlp.Q13[index(z,y,x)]+D3_hlp.Q14[index(z,y,x)]+D3_hlp.Q15[index(z,y,x)];
				//				rho+=D3_hlp.Q16[index(z,y,x)]+D3_hlp.Q17[index(z,y,x)]+D3_hlp.Q18[index(z,y,x)];
				//				reciprocal_rho=1.0/rho;

				//...........x-, and y- velocity components

				//				switch(obstacles[index(z,y,x)]){
				//				case 1:
				//					u_x = 0.0;
				//					u_y = 0.0;
				//					u_z = 0.0;
				//					break;
				//				default:
				//					u_x = (FLOATING) reciprocal_rho*(D3_hlp.Q1[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
				//							D3_hlp.Q11[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] -
				//							(D3_hlp.Q3[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] +
				//									D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)]));
				//
				//					u_y = (FLOATING) reciprocal_rho*(D3_hlp.Q2[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] +
				//							D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q15[index(z,y,x)] -
				//							(D3_hlp.Q4[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
				//									D3_hlp.Q17[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)]));
				//
				//					u_z = (FLOATING) reciprocal_rho*(D3_hlp.Q5[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] +
				//							D3_hlp.Q15[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)] -
				//							(D3_hlp.Q6[index(z,y,x)] + D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q11[index(z,y,x)] +
				//									D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q17[index(z,y,x)]));
				//					break;
				//				}//switch(obstacles[index(z,y,x)])




				u_squ = (FLOATING)  u_x*u_x + u_y*u_y + u_z*u_z;
				temp_factor= 0.5*(2.0* c_squ - u_squ)/c_squ;
				//u_squ = (FLOATING)  pow(u_x,2) + pow(u_y,2) + pow(u_z,2);


				/*...........n- velocity compnents (n = lattice node connection vectors)
					c...........this is only necessary for clearence, and only 3 speeds would
					c...........be necessary*/


				//WARNING!!!! o pinakas autos exei tropopoihmena indices!!!!
				u_n[0]= 0.0; //SHOULD NEVER USED!
				u_n[1] =   u_x;
				u_n[2] =         u_y;
				u_n[3] = - u_x;
				u_n[4] =       - u_y;
				u_n[5] =   u_z;
				u_n[6] =       - u_z;
				u_n[7] =   u_x + u_y;
				u_n[8] = - u_x + u_y;
				u_n[9] = - u_x - u_y;
				u_n[10] =   u_x - u_y;
				u_n[11] =   u_x - u_z;
				u_n[12] = - u_x - u_z;
				u_n[13] = - u_x + u_z;
				u_n[14] =   u_x + u_z;
				u_n[15] =   u_z + u_y;
				u_n[16] = - u_z + u_y;
				u_n[17] = - u_z - u_y;
				u_n[18] =   u_z - u_y;

#pragma unroll
				for(int i=0; i<DENSITIES; ++i){
					u_n__over__c_squ[i]=reciprocal_c_squ*u_n[i];
					u_n__over__c_squ__squared_and_halved[i]=0.5*u_n__over__c_squ[i]*u_n__over__c_squ[i];
				}

				/*c...........equilibrium densities
					c...........this can be rewritten to improve computational performance
					c...........considerabely !
					c
					c...........zero velocity density
					c*/
				//memory optimised implementation! WARNING!!! different from the original case!

				//two_x_c_squ_sqared=2.0*c_squ*c_squ;
				omega_x_rho_x_t_0=omega_x_t_0*rho;
				omega_x_rho_x_t_1=omega_x_t_1*rho;
				omega_x_rho_x_t_2=omega_x_t_2*rho;


				//				//...........relaxation step


				//omega_x_rho_x_t_0*(1.0 - 0.5*u_squ/c_squ);
				D3.Q0[index(z,y,x)]=buff[0]*one_minus_omega+omega_x_rho_x_t_0*(u_n__over__c_squ__squared_and_halved[0]+u_n__over__c_squ[0]+temp_factor);




				D3.Q1[index(z,y,x)]=buff[1]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[1]+u_n__over__c_squ[1]+temp_factor);
				D3.Q2[index(z,y,x)]=buff[2]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[2]+u_n__over__c_squ[2]+temp_factor);
				D3.Q3[index(z,y,x)]=buff[3]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[3]+u_n__over__c_squ[3]+temp_factor);
				D3.Q4[index(z,y,x)]=buff[4]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[4]+u_n__over__c_squ[4]+temp_factor);
				D3.Q5[index(z,y,x)]=buff[5]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[5]+u_n__over__c_squ[5]+temp_factor);
				D3.Q6[index(z,y,x)]=buff[6]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[6]+u_n__over__c_squ[6]+temp_factor);



				D3.Q7[index(z,y,x)]= buff[ 7]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 7]+u_n__over__c_squ[ 7]+temp_factor);
				D3.Q8[index(z,y,x)]= buff[ 8]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 8]+u_n__over__c_squ[ 8]+temp_factor);
				D3.Q9[index(z,y,x)]= buff[ 9]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 9]+u_n__over__c_squ[ 9]+temp_factor);
				D3.Q10[index(z,y,x)]=buff[10]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[10]+u_n__over__c_squ[10]+temp_factor);
				D3.Q11[index(z,y,x)]=buff[11]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[11]+u_n__over__c_squ[11]+temp_factor);
				D3.Q12[index(z,y,x)]=buff[12]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[12]+u_n__over__c_squ[12]+temp_factor);
				D3.Q13[index(z,y,x)]=buff[13]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[13]+u_n__over__c_squ[13]+temp_factor);
				D3.Q14[index(z,y,x)]=buff[14]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[14]+u_n__over__c_squ[14]+temp_factor);
				D3.Q15[index(z,y,x)]=buff[15]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[15]+u_n__over__c_squ[15]+temp_factor);
				D3.Q16[index(z,y,x)]=buff[16]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[16]+u_n__over__c_squ[16]+temp_factor);
				D3.Q17[index(z,y,x)]=buff[17]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[17]+u_n__over__c_squ[17]+temp_factor);
				D3.Q18[index(z,y,x)]=buff[18]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[18]+u_n__over__c_squ[18]+temp_factor);

				//original implementation
				//				n_equ[0] = t_0  * rho*(1.0 - u_squ / (2.0 * c_squ));
				//
				//								//...........axis speeds (factor: t_1)
				//				#pragma unroll
				//								for (int i = 1 ; i< 7; ++i){
				//									n_equ[i] = t_1 * rho*(1.0 + u_n[i] / c_squ
				//											+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
				//											- u_squ / (2.0  * c_squ));
				//								}
				//
				//								//...........diagonal speeds (factor: t_2)
				//				#pragma unroll
				//								for (int i = 7 ; i< 19; ++i){
				//									n_equ[i] = t_2  * rho*(1.0 + u_n[i] / c_squ
				//											+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
				//											- u_squ / (2.0  * c_squ));
				//								}

				//				D3.Q0[index(z,y,x)]=D3_hlp.Q0[index(z,y,x)]+omega*(n_equ[0] - D3_hlp.Q0[index(z,y,x)]);
				//								D3.Q1[index(z,y,x)]=D3_hlp.Q1[index(z,y,x)]+omega*(n_equ[1] - D3_hlp.Q1[index(z,y,x)]);
				//								D3.Q2[index(z,y,x)]=D3_hlp.Q2[index(z,y,x)]+omega*(n_equ[2] - D3_hlp.Q2[index(z,y,x)]);
				//								D3.Q3[index(z,y,x)]=D3_hlp.Q3[index(z,y,x)]+omega*(n_equ[3] - D3_hlp.Q3[index(z,y,x)]);
				//								D3.Q4[index(z,y,x)]=D3_hlp.Q4[index(z,y,x)]+omega*(n_equ[4] - D3_hlp.Q4[index(z,y,x)]);
				//								D3.Q5[index(z,y,x)]=D3_hlp.Q5[index(z,y,x)]+omega*(n_equ[5] - D3_hlp.Q5[index(z,y,x)]);
				//								D3.Q6[index(z,y,x)]=D3_hlp.Q6[index(z,y,x)]+omega*(n_equ[6] - D3_hlp.Q6[index(z,y,x)]);
				//								D3.Q7[index(z,y,x)]=D3_hlp.Q7[index(z,y,x)]+omega*(n_equ[7] - D3_hlp.Q7[index(z,y,x)]);
				//								D3.Q8[index(z,y,x)]=D3_hlp.Q8[index(z,y,x)]+omega*(n_equ[8] - D3_hlp.Q8[index(z,y,x)]);
				//								D3.Q9[index(z,y,x)]=D3_hlp.Q9[index(z,y,x)]+omega*(n_equ[9] - D3_hlp.Q9[index(z,y,x)]);
				//								D3.Q10[index(z,y,x)]=D3_hlp.Q10[index(z,y,x)]+omega*(n_equ[10] - D3_hlp.Q10[index(z,y,x)]);
				//								D3.Q11[index(z,y,x)]=D3_hlp.Q11[index(z,y,x)]+omega*(n_equ[11] - D3_hlp.Q11[index(z,y,x)]);
				//								D3.Q12[index(z,y,x)]=D3_hlp.Q12[index(z,y,x)]+omega*(n_equ[12] - D3_hlp.Q12[index(z,y,x)]);
				//								D3.Q13[index(z,y,x)]=D3_hlp.Q13[index(z,y,x)]+omega*(n_equ[13] - D3_hlp.Q13[index(z,y,x)]);
				//								D3.Q14[index(z,y,x)]=D3_hlp.Q14[index(z,y,x)]+omega*(n_equ[14] - D3_hlp.Q14[index(z,y,x)]);
				//								D3.Q15[index(z,y,x)]=D3_hlp.Q15[index(z,y,x)]+omega*(n_equ[15] - D3_hlp.Q15[index(z,y,x)]);
				//								D3.Q16[index(z,y,x)]=D3_hlp.Q16[index(z,y,x)]+omega*(n_equ[16] - D3_hlp.Q16[index(z,y,x)]);
				//								D3.Q17[index(z,y,x)]=D3_hlp.Q17[index(z,y,x)]+omega*(n_equ[17] - D3_hlp.Q17[index(z,y,x)]);
				//								D3.Q18[index(z,y,x)]=D3_hlp.Q18[index(z,y,x)]+omega*(n_equ[18] - D3_hlp.Q18[index(z,y,x)]);

				if (x == lx-2) {
					u_previous_spatial_boundary[index2D(z,y)] = u_x;
					v_previous_spatial_boundary[index2D(z,y)] = u_y;
					w_previous_spatial_boundary[index2D(z,y)] = u_z;

					u_current[index2D(z,y)] = u_x;
					v_current[index2D(z,y)] = u_y;
					w_current[index2D(z,y)] = u_z;

				}//if (x == lx-2)
			}//for (x = 0 ; x< lx; ++x)
		}//for (y = 0 ; y< ly ; ++y)
	}//for (z = 0 ; z< lz ; ++z)
#ifdef DEBUG
	cout << " #LBM relaxation OK!" << endl;
#endif
}

void LBM::initial_relaxation(){





	/*One-step density relaxation process

				c.......density relaxation: a single time relaxation with relaxation
				c       parameter omega is applied here. This step is only "local",
				c       nothing is propagated through the lattice.
				c*/

	int  x,y,z;
	FLOATING  u_x=0.0, u_y=0.0, u_z=0.0, u_squ=0.0, rho=0.0;
	const FLOATING  tau=3.0*nu + 0.5, omega = 1.0 /tau; //	omega=1.0/(3.0*nu+0.5);



	FLOATING u_n[19], n_equ[19];

	//....square speed of sound
	/*      compute the out let velocity with a convevtive boundary condition
					c.....loop over all nodes
					c.....attention: actual densities are stored after the propagation
					c                step in the help-array n_hlp !*/



	for (z = 0 ; z< lz ; ++z){
		for (y = 0 ; y< ly ; ++y){
			for (x = 0 ; x< lx; ++x){

				/*c.........only free nodes are considered here
					!if (.not. obstacles[z][y][x]) then
					c...........integral local density
					c...........initialize variable ro*/


				rho=0.0;
				rho+=D3_hlp.Q0[index(z,y,x)]+D3_hlp.Q1[index(z,y,x)]+D3_hlp.Q2[index(z,y,x)]+D3_hlp.Q3[index(z,y,x)];
				rho+=D3_hlp.Q4[index(z,y,x)]+D3_hlp.Q5[index(z,y,x)]+D3_hlp.Q6[index(z,y,x)]+D3_hlp.Q7[index(z,y,x)];
				rho+=D3_hlp.Q8[index(z,y,x)]+D3_hlp.Q9[index(z,y,x)]+D3_hlp.Q10[index(z,y,x)]+D3_hlp.Q11[index(z,y,x)];
				rho+=D3_hlp.Q12[index(z,y,x)]+D3_hlp.Q13[index(z,y,x)]+D3_hlp.Q14[index(z,y,x)]+D3_hlp.Q15[index(z,y,x)];
				rho+=D3_hlp.Q16[index(z,y,x)]+D3_hlp.Q17[index(z,y,x)]+D3_hlp.Q18[index(z,y,x)];


				//...........x-, and y- velocity components


				if ( obstacles[index(z,y,x)]==1 ) {
					u_x = 0.0;
					u_y = 0.0;
					u_z = 0.0;
				}else{





					u_x = (FLOATING) (D3_hlp.Q1[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
							D3_hlp.Q11[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] -
							(D3_hlp.Q3[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] +
									D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)])) / rho;

					u_y = (FLOATING) (D3_hlp.Q2[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] +
							D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q15[index(z,y,x)] -
							(D3_hlp.Q4[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
									D3_hlp.Q17[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)])) / rho;

					u_z = (FLOATING) (D3_hlp.Q5[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] +
							D3_hlp.Q15[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)] -
							(D3_hlp.Q6[index(z,y,x)] + D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q11[index(z,y,x)] +
									D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q17[index(z,y,x)])) / rho;

				}

				u_squ = (FLOATING)  u_x*u_x + u_y*u_y + u_z*u_z;
				//u_squ = (FLOATING)  pow(u_x,2) + pow(u_y,2) + pow(u_z,2);


				/*...........n- velocity compnents (n = lattice node connection vectors)
					c...........this is only necessary for clearence, and only 3 speeds would
					c...........be necessary*/

				//WARNING!!!! o pinakas autos exei tropopoihmena indices!!!!
				u_n[0]= 0.0; //SHOULD NEVER USED!
				u_n[1] =   u_x;
				u_n[2] =         u_y;
				u_n[3] = - u_x;
				u_n[4] =       - u_y;
				u_n[5] =   u_z;
				u_n[6] =       - u_z;
				u_n[7] =   u_x + u_y;
				u_n[8] = - u_x + u_y;
				u_n[9] = - u_x - u_y;
				u_n[10] =   u_x - u_y;
				u_n[11] =   u_x - u_z;
				u_n[12] = - u_x - u_z;
				u_n[13] = - u_x + u_z;
				u_n[14] =   u_x + u_z;
				u_n[15] =   u_z + u_y;
				u_n[16] = - u_z + u_y;
				u_n[17] = - u_z - u_y;
				u_n[18] =   u_z - u_y;

				/*c...........equilibrium densities
					c...........this can be rewritten to improve computational performance
					c...........considerabely !
					c
					c...........zero velocity density
					c*/
				n_equ[0] = t_0  * rho*(1.0 - u_squ / (2.0 * c_squ));

				//...........axis speeds (factor: t_1)
				for (int i = 1 ; i< 7; ++i){
					n_equ[i] = t_1 * rho*(1.0 + u_n[i] / c_squ
							+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
							- u_squ / (2.0  * c_squ));
				}

				//...........diagonal speeds (factor: t_2)
				for (int i = 7 ; i< 19; ++i){
					n_equ[i] = t_2  * rho*(1.0 + u_n[i] / c_squ
							+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
							- u_squ / (2.0  * c_squ));
				}


				//...........relaxation step




				D3.Q0[index(z,y,x)]=D3_hlp.Q0[index(z,y,x)]+omega*(n_equ[0] - D3_hlp.Q0[index(z,y,x)]);
				D3.Q1[index(z,y,x)]=D3_hlp.Q1[index(z,y,x)]+omega*(n_equ[1] - D3_hlp.Q1[index(z,y,x)]);
				D3.Q2[index(z,y,x)]=D3_hlp.Q2[index(z,y,x)]+omega*(n_equ[2] - D3_hlp.Q2[index(z,y,x)]);
				D3.Q3[index(z,y,x)]=D3_hlp.Q3[index(z,y,x)]+omega*(n_equ[3] - D3_hlp.Q3[index(z,y,x)]);
				D3.Q4[index(z,y,x)]=D3_hlp.Q4[index(z,y,x)]+omega*(n_equ[4] - D3_hlp.Q4[index(z,y,x)]);
				D3.Q5[index(z,y,x)]=D3_hlp.Q5[index(z,y,x)]+omega*(n_equ[5] - D3_hlp.Q5[index(z,y,x)]);
				D3.Q6[index(z,y,x)]=D3_hlp.Q6[index(z,y,x)]+omega*(n_equ[6] - D3_hlp.Q6[index(z,y,x)]);
				D3.Q7[index(z,y,x)]=D3_hlp.Q7[index(z,y,x)]+omega*(n_equ[7] - D3_hlp.Q7[index(z,y,x)]);
				D3.Q8[index(z,y,x)]=D3_hlp.Q8[index(z,y,x)]+omega*(n_equ[8] - D3_hlp.Q8[index(z,y,x)]);
				D3.Q9[index(z,y,x)]=D3_hlp.Q9[index(z,y,x)]+omega*(n_equ[9] - D3_hlp.Q9[index(z,y,x)]);
				D3.Q10[index(z,y,x)]=D3_hlp.Q10[index(z,y,x)]+omega*(n_equ[10] - D3_hlp.Q10[index(z,y,x)]);
				D3.Q11[index(z,y,x)]=D3_hlp.Q11[index(z,y,x)]+omega*(n_equ[11] - D3_hlp.Q11[index(z,y,x)]);
				D3.Q12[index(z,y,x)]=D3_hlp.Q12[index(z,y,x)]+omega*(n_equ[12] - D3_hlp.Q12[index(z,y,x)]);
				D3.Q13[index(z,y,x)]=D3_hlp.Q13[index(z,y,x)]+omega*(n_equ[13] - D3_hlp.Q13[index(z,y,x)]);
				D3.Q14[index(z,y,x)]=D3_hlp.Q14[index(z,y,x)]+omega*(n_equ[14] - D3_hlp.Q14[index(z,y,x)]);
				D3.Q15[index(z,y,x)]=D3_hlp.Q15[index(z,y,x)]+omega*(n_equ[15] - D3_hlp.Q15[index(z,y,x)]);
				D3.Q16[index(z,y,x)]=D3_hlp.Q16[index(z,y,x)]+omega*(n_equ[16] - D3_hlp.Q16[index(z,y,x)]);
				D3.Q17[index(z,y,x)]=D3_hlp.Q17[index(z,y,x)]+omega*(n_equ[17] - D3_hlp.Q17[index(z,y,x)]);
				D3.Q18[index(z,y,x)]=D3_hlp.Q18[index(z,y,x)]+omega*(n_equ[18] - D3_hlp.Q18[index(z,y,x)]);

				//at the penultimat slice, save previous and current slices
				if (x == lx-2) {
					u_previous_spatial_boundary[index2D(z,y)] = u_x;
					v_previous_spatial_boundary[index2D(z,y)] = u_y;
					w_previous_spatial_boundary[index2D(z,y)] = u_z;

					u_current[index2D(z,y)] = u_x;
					v_current[index2D(z,y)] = u_y;
					w_current[index2D(z,y)] = u_z;

					//the following 3 lines correspond to time_unit==0!!!
					u_previous_temporal_boundary[index2D(z,y)] = u_current[index2D(z,y)];
					v_previous_temporal_boundary[index2D(z,y)] = v_current[index2D(z,y)];
					w_previous_temporal_boundary[index2D(z,y)] = w_current[index2D(z,y)];

				}//if (x == lx-2)
			}//for (x = 0 ; x< lx; ++x)
		}//for (y = 0 ; y< ly ; ++y)
	}//for (z = 0 ; z< lz ; ++z)
#ifdef DEBUG
	cout << " #LBM relaxation OK!" << endl;
#endif
}

//__global__
//void relaxation_kernel(int lx, int ly, int lz, FLOATING reynolds, FLOATING nu, FLOATING r_small,
//		FLOATING t_0, FLOATING t_1, FLOATING t_2, FLOATING c_squ, FLOATING omega, FLOATING one_minus_omega,
//		FLOATING reciprocal_c_squ,lattice D3, lattice D3_hlp, int *obstacles_d,
//		FLOATING *u_previous_spatial_boundary, FLOATING *v_previous_spatial_boundary, FLOATING *w_previous_spatial_boundary,
//		FLOATING *u_current, FLOATING *v_current, FLOATING *w_current){
//
//
//
//
//
//	/*One-step density relaxation process
//
//				c.......density relaxation: a single time relaxation with relaxation
//				c       parameter omega is applied here. This step is only "local",
//				c       nothing is propagated through the lattice.
//				c*/
//
//	int  x,y,z;
//	FLOATING  u_x=0.0, u_y=0.0, u_z=0.0, u_squ=0.0, rho=0.0, reciprocal_rho=0.0;
//
//
//
//
//	FLOATING u_n[19];
//	//	FLOATING n_equ[19];
//	FLOATING buff[19];
//
//	//	FLOATING u_n_squared[19];
//	//FLOATING two_x_c_squ_sqared;
//	const FLOATING omega_x_t_0=omega*t_0, omega_x_t_1=omega*t_1, omega_x_t_2=omega*t_2;
//	FLOATING omega_x_rho_x_t_0, omega_x_rho_x_t_1, omega_x_rho_x_t_2;
//	FLOATING temp_factor;
//	FLOATING u_n__over__c_squ[19];
//	FLOATING u_n__over__c_squ__squared_and_halved[19];
//
//	//....square speed of sound
//	/*      compute the out let velocity with a convevtive boundary condition
//					c.....loop over all nodes
//					c.....attention: actual densities are stored after the propagation
//					c                step in the help-array n_hlp !*/
//
//
//#pragma unroll
//	for (z = 0 ; z< lz ; ++z){
//#pragma unroll
//		for (y = 0 ; y< ly ; ++y){
//#pragma unroll
//			for (x = 0 ; x< lx; ++x){
//
//				/*c.........only free nodes are considered here
//					!if (.not. obstacles[z][y][x]) then
//					c...........integral local density
//					c...........initialize variable ro*/
//				//memory optimised implementation
//				buff[0]=D3_hlp.Q0[index(z,y,x)];
//				buff[1]=D3_hlp.Q1[index(z,y,x)];
//				buff[2]=D3_hlp.Q2[index(z,y,x)];
//				buff[3]=D3_hlp.Q3[index(z,y,x)];
//				buff[4]=D3_hlp.Q4[index(z,y,x)];
//				buff[5]=D3_hlp.Q5[index(z,y,x)];
//				buff[6]=D3_hlp.Q6[index(z,y,x)];
//				buff[7]=D3_hlp.Q7[index(z,y,x)];
//				buff[8]=D3_hlp.Q8[index(z,y,x)];
//				buff[9]=D3_hlp.Q9[index(z,y,x)];
//				buff[10]=D3_hlp.Q10[index(z,y,x)];
//				buff[11]=D3_hlp.Q11[index(z,y,x)];
//				buff[12]=D3_hlp.Q12[index(z,y,x)];
//				buff[13]=D3_hlp.Q13[index(z,y,x)];
//				buff[14]=D3_hlp.Q14[index(z,y,x)];
//				buff[15]=D3_hlp.Q15[index(z,y,x)];
//				buff[16]=D3_hlp.Q16[index(z,y,x)];
//				buff[17]=D3_hlp.Q17[index(z,y,x)];
//				buff[18]=D3_hlp.Q18[index(z,y,x)];
//
//				rho=0.0;
//				for(int k=0; k<DENSITIES; ++k)
//					rho+=buff[k];
//
//				//	rho=accumulate(buff, buff+DENSITIES, 0.0);
//
//				reciprocal_rho=1.0/rho;
//
//
//
//
//				switch(obstacles_d[index(z,y,x)]){
//				case 1:
//					u_x = 0.0;
//					u_y = 0.0;
//					u_z = 0.0;
//					break;
//				default:
//					u_x = 0.0;
//					u_x =  reciprocal_rho*(buff[1] + buff[7] + buff[10] +buff[11] + buff[14]-
//							(buff[3] + buff[8] + buff[9] +buff[12] + buff[13]));
//
//					u_y = 0.0;
//					u_y =  reciprocal_rho*(buff[2]+buff[8]+buff[7]+buff[16] + buff[15] -
//							(buff[4] + buff[9] + buff[10] +buff[17] + buff[18]));
//
//					u_z = 0.0;
//					u_z =  reciprocal_rho*(buff[5]+buff[13]+buff[14]+buff[15]+buff[18]-
//							(buff[6]+buff[12]+buff[11]+buff[16]+buff[17]));
//					break;
//				}//switch(obstacles[index(z,y,x)])
//
//				//original implementation
//				//				rho=0.0;
//				//				rho+=D3_hlp.Q0[index(z,y,x)]+D3_hlp.Q1[index(z,y,x)]+D3_hlp.Q2[index(z,y,x)]+D3_hlp.Q3[index(z,y,x)];
//				//				rho+=D3_hlp.Q4[index(z,y,x)]+D3_hlp.Q5[index(z,y,x)]+D3_hlp.Q6[index(z,y,x)]+D3_hlp.Q7[index(z,y,x)];
//				//				rho+=D3_hlp.Q8[index(z,y,x)]+D3_hlp.Q9[index(z,y,x)]+D3_hlp.Q10[index(z,y,x)]+D3_hlp.Q11[index(z,y,x)];
//				//				rho+=D3_hlp.Q12[index(z,y,x)]+D3_hlp.Q13[index(z,y,x)]+D3_hlp.Q14[index(z,y,x)]+D3_hlp.Q15[index(z,y,x)];
//				//				rho+=D3_hlp.Q16[index(z,y,x)]+D3_hlp.Q17[index(z,y,x)]+D3_hlp.Q18[index(z,y,x)];
//				//				reciprocal_rho=1.0/rho;
//
//				//...........x-, and y- velocity components
//
//				//				switch(obstacles[index(z,y,x)]){
//				//				case 1:
//				//					u_x = 0.0;
//				//					u_y = 0.0;
//				//					u_z = 0.0;
//				//					break;
//				//				default:
//				//					u_x = (FLOATING) reciprocal_rho*(D3_hlp.Q1[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
//				//							D3_hlp.Q11[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] -
//				//							(D3_hlp.Q3[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] +
//				//									D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)]));
//				//
//				//					u_y = (FLOATING) reciprocal_rho*(D3_hlp.Q2[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] +
//				//							D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q15[index(z,y,x)] -
//				//							(D3_hlp.Q4[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
//				//									D3_hlp.Q17[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)]));
//				//
//				//					u_z = (FLOATING) reciprocal_rho*(D3_hlp.Q5[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] +
//				//							D3_hlp.Q15[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)] -
//				//							(D3_hlp.Q6[index(z,y,x)] + D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q11[index(z,y,x)] +
//				//									D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q17[index(z,y,x)]));
//				//					break;
//				//				}//switch(obstacles[index(z,y,x)])
//
//
//
//
//				u_squ = (FLOATING)  u_x*u_x + u_y*u_y + u_z*u_z;
//				temp_factor= 0.5*(2.0* c_squ - u_squ)/c_squ;
//				//u_squ = (FLOATING)  pow(u_x,2) + pow(u_y,2) + pow(u_z,2);
//
//
//				/*...........n- velocity compnents (n = lattice node connection vectors)
//					c...........this is only necessary for clearence, and only 3 speeds would
//					c...........be necessary*/
//
//
//				//WARNING!!!! o pinakas autos exei tropopoihmena indices!!!!
//				u_n[0]= 0.0; //SHOULD NEVER USED!
//				u_n[1] =   u_x;
//				u_n[2] =         u_y;
//				u_n[3] = - u_x;
//				u_n[4] =       - u_y;
//				u_n[5] =   u_z;
//				u_n[6] =       - u_z;
//				u_n[7] =   u_x + u_y;
//				u_n[8] = - u_x + u_y;
//				u_n[9] = - u_x - u_y;
//				u_n[10] =   u_x - u_y;
//				u_n[11] =   u_x - u_z;
//				u_n[12] = - u_x - u_z;
//				u_n[13] = - u_x + u_z;
//				u_n[14] =   u_x + u_z;
//				u_n[15] =   u_z + u_y;
//				u_n[16] = - u_z + u_y;
//				u_n[17] = - u_z - u_y;
//				u_n[18] =   u_z - u_y;
//
//#pragma unroll
//				for(int i=0; i<DENSITIES; ++i){
//					u_n__over__c_squ[i]=reciprocal_c_squ*u_n[i];
//					u_n__over__c_squ__squared_and_halved[i]=0.5*u_n__over__c_squ[i]*u_n__over__c_squ[i];
//				}
//
//				/*c...........equilibrium densities
//					c...........this can be rewritten to improve computational performance
//					c...........considerabely !
//					c
//					c...........zero velocity density
//					c*/
//				//memory optimised implementation! WARNING!!! different from the original case!
//
//				//two_x_c_squ_sqared=2.0*c_squ*c_squ;
//				omega_x_rho_x_t_0=omega_x_t_0*rho;
//				omega_x_rho_x_t_1=omega_x_t_1*rho;
//				omega_x_rho_x_t_2=omega_x_t_2*rho;
//
//
//				//				//...........relaxation step
//
//
//				//omega_x_rho_x_t_0*(1.0 - 0.5*u_squ/c_squ);
//				D3.Q0[index(z,y,x)]=buff[0]*one_minus_omega+omega_x_rho_x_t_0*(u_n__over__c_squ__squared_and_halved[0]+u_n__over__c_squ[0]+temp_factor);
//
//
//
//
//				D3.Q1[index(z,y,x)]=buff[1]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[1]+u_n__over__c_squ[1]+temp_factor);
//				D3.Q2[index(z,y,x)]=buff[2]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[2]+u_n__over__c_squ[2]+temp_factor);
//				D3.Q3[index(z,y,x)]=buff[3]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[3]+u_n__over__c_squ[3]+temp_factor);
//				D3.Q4[index(z,y,x)]=buff[4]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[4]+u_n__over__c_squ[4]+temp_factor);
//				D3.Q5[index(z,y,x)]=buff[5]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[5]+u_n__over__c_squ[5]+temp_factor);
//				D3.Q6[index(z,y,x)]=buff[6]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[6]+u_n__over__c_squ[6]+temp_factor);
//
//
//
//				D3.Q7[index(z,y,x)]= buff[ 7]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 7]+u_n__over__c_squ[ 7]+temp_factor);
//				D3.Q8[index(z,y,x)]= buff[ 8]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 8]+u_n__over__c_squ[ 8]+temp_factor);
//				D3.Q9[index(z,y,x)]= buff[ 9]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 9]+u_n__over__c_squ[ 9]+temp_factor);
//				D3.Q10[index(z,y,x)]=buff[10]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[10]+u_n__over__c_squ[10]+temp_factor);
//				D3.Q11[index(z,y,x)]=buff[11]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[11]+u_n__over__c_squ[11]+temp_factor);
//				D3.Q12[index(z,y,x)]=buff[12]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[12]+u_n__over__c_squ[12]+temp_factor);
//				D3.Q13[index(z,y,x)]=buff[13]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[13]+u_n__over__c_squ[13]+temp_factor);
//				D3.Q14[index(z,y,x)]=buff[14]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[14]+u_n__over__c_squ[14]+temp_factor);
//				D3.Q15[index(z,y,x)]=buff[15]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[15]+u_n__over__c_squ[15]+temp_factor);
//				D3.Q16[index(z,y,x)]=buff[16]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[16]+u_n__over__c_squ[16]+temp_factor);
//				D3.Q17[index(z,y,x)]=buff[17]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[17]+u_n__over__c_squ[17]+temp_factor);
//				D3.Q18[index(z,y,x)]=buff[18]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[18]+u_n__over__c_squ[18]+temp_factor);
//
//				//original implementation
//				//				n_equ[0] = t_0  * rho*(1.0 - u_squ / (2.0 * c_squ));
//				//
//				//								//...........axis speeds (factor: t_1)
//				//				#pragma unroll
//				//								for (int i = 1 ; i< 7; ++i){
//				//									n_equ[i] = t_1 * rho*(1.0 + u_n[i] / c_squ
//				//											+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
//				//											- u_squ / (2.0  * c_squ));
//				//								}
//				//
//				//								//...........diagonal speeds (factor: t_2)
//				//				#pragma unroll
//				//								for (int i = 7 ; i< 19; ++i){
//				//									n_equ[i] = t_2  * rho*(1.0 + u_n[i] / c_squ
//				//											+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
//				//											- u_squ / (2.0  * c_squ));
//				//								}
//
//				//				D3.Q0[index(z,y,x)]=D3_hlp.Q0[index(z,y,x)]+omega*(n_equ[0] - D3_hlp.Q0[index(z,y,x)]);
//				//								D3.Q1[index(z,y,x)]=D3_hlp.Q1[index(z,y,x)]+omega*(n_equ[1] - D3_hlp.Q1[index(z,y,x)]);
//				//								D3.Q2[index(z,y,x)]=D3_hlp.Q2[index(z,y,x)]+omega*(n_equ[2] - D3_hlp.Q2[index(z,y,x)]);
//				//								D3.Q3[index(z,y,x)]=D3_hlp.Q3[index(z,y,x)]+omega*(n_equ[3] - D3_hlp.Q3[index(z,y,x)]);
//				//								D3.Q4[index(z,y,x)]=D3_hlp.Q4[index(z,y,x)]+omega*(n_equ[4] - D3_hlp.Q4[index(z,y,x)]);
//				//								D3.Q5[index(z,y,x)]=D3_hlp.Q5[index(z,y,x)]+omega*(n_equ[5] - D3_hlp.Q5[index(z,y,x)]);
//				//								D3.Q6[index(z,y,x)]=D3_hlp.Q6[index(z,y,x)]+omega*(n_equ[6] - D3_hlp.Q6[index(z,y,x)]);
//				//								D3.Q7[index(z,y,x)]=D3_hlp.Q7[index(z,y,x)]+omega*(n_equ[7] - D3_hlp.Q7[index(z,y,x)]);
//				//								D3.Q8[index(z,y,x)]=D3_hlp.Q8[index(z,y,x)]+omega*(n_equ[8] - D3_hlp.Q8[index(z,y,x)]);
//				//								D3.Q9[index(z,y,x)]=D3_hlp.Q9[index(z,y,x)]+omega*(n_equ[9] - D3_hlp.Q9[index(z,y,x)]);
//				//								D3.Q10[index(z,y,x)]=D3_hlp.Q10[index(z,y,x)]+omega*(n_equ[10] - D3_hlp.Q10[index(z,y,x)]);
//				//								D3.Q11[index(z,y,x)]=D3_hlp.Q11[index(z,y,x)]+omega*(n_equ[11] - D3_hlp.Q11[index(z,y,x)]);
//				//								D3.Q12[index(z,y,x)]=D3_hlp.Q12[index(z,y,x)]+omega*(n_equ[12] - D3_hlp.Q12[index(z,y,x)]);
//				//								D3.Q13[index(z,y,x)]=D3_hlp.Q13[index(z,y,x)]+omega*(n_equ[13] - D3_hlp.Q13[index(z,y,x)]);
//				//								D3.Q14[index(z,y,x)]=D3_hlp.Q14[index(z,y,x)]+omega*(n_equ[14] - D3_hlp.Q14[index(z,y,x)]);
//				//								D3.Q15[index(z,y,x)]=D3_hlp.Q15[index(z,y,x)]+omega*(n_equ[15] - D3_hlp.Q15[index(z,y,x)]);
//				//								D3.Q16[index(z,y,x)]=D3_hlp.Q16[index(z,y,x)]+omega*(n_equ[16] - D3_hlp.Q16[index(z,y,x)]);
//				//								D3.Q17[index(z,y,x)]=D3_hlp.Q17[index(z,y,x)]+omega*(n_equ[17] - D3_hlp.Q17[index(z,y,x)]);
//				//								D3.Q18[index(z,y,x)]=D3_hlp.Q18[index(z,y,x)]+omega*(n_equ[18] - D3_hlp.Q18[index(z,y,x)]);
//
//				if (x == lx-2) {
//					u_previous_spatial_boundary[index2D(z,y)] = u_x;
//					v_previous_spatial_boundary[index2D(z,y)] = u_y;
//					w_previous_spatial_boundary[index2D(z,y)] = u_z;
//
//					u_current[index2D(z,y)] = u_x;
//					v_current[index2D(z,y)] = u_y;
//					w_current[index2D(z,y)] = u_z;
//
//				}//if (x == lx-2)
//			}//for (x = 0 ; x< lx; ++x)
//		}//for (y = 0 ; y< ly ; ++y)
//	}//for (z = 0 ; z< lz ; ++z)
//#ifdef DEBUG
//	cout << " #LBM relaxation OK!" << endl;
//#endif
//}
//
//__global__
//void relaxation_kernel_v2(int lx, int ly, int lz, FLOATING reynolds, FLOATING nu, FLOATING r_small,
//		FLOATING t_0, FLOATING t_1, FLOATING t_2, FLOATING c_squ, FLOATING omega, FLOATING one_minus_omega,
//		FLOATING reciprocal_c_squ,
//		FLOATING *hlp_Q0, FLOATING *hlp_Q1, FLOATING *hlp_Q2, FLOATING *hlp_Q3,
//		FLOATING *hlp_Q4, FLOATING *hlp_Q5, FLOATING *hlp_Q6, FLOATING *hlp_Q7,
//		FLOATING *hlp_Q8, FLOATING *hlp_Q9, FLOATING *hlp_Q10, FLOATING *hlp_Q11,
//		FLOATING *hlp_Q12, FLOATING *hlp_Q13, FLOATING *hlp_Q14, FLOATING *hlp_Q15,
//		FLOATING *hlp_Q16, FLOATING *hlp_Q17, FLOATING *hlp_Q18,
//		FLOATING *Q0, FLOATING *Q1, FLOATING *Q2, FLOATING *Q3,
//		FLOATING *Q4, FLOATING *Q5, FLOATING *Q6, FLOATING *Q7,
//		FLOATING *Q8, FLOATING *Q9, FLOATING *Q10, FLOATING *Q11,
//		FLOATING *Q12, FLOATING *Q13, FLOATING *Q14, FLOATING *Q15,
//		FLOATING *Q16, FLOATING *Q17, FLOATING *Q18,
//		int *obstacles_d,
//		FLOATING *u_previous_spatial_boundary, FLOATING *v_previous_spatial_boundary, FLOATING *w_previous_spatial_boundary,
//		FLOATING *u_current, FLOATING *v_current, FLOATING *w_current){
//
//
//
//
//
//	/*One-step density relaxation process
//
//				c.......density relaxation: a single time relaxation with relaxation
//				c       parameter omega is applied here. This step is only "local",
//				c       nothing is propagated through the lattice.
//				c*/
//
//	int  x,y,z;
//	FLOATING  u_x=0.0, u_y=0.0, u_z=0.0, u_squ=0.0, rho=0.0, reciprocal_rho=0.0;
//
//
//
//
//	FLOATING u_n[19];
//	//	FLOATING n_equ[19];
//	FLOATING buff[19];
//
//	//	FLOATING u_n_squared[19];
//	//FLOATING two_x_c_squ_sqared;
//	const FLOATING omega_x_t_0=omega*t_0, omega_x_t_1=omega*t_1, omega_x_t_2=omega*t_2;
//	FLOATING omega_x_rho_x_t_0, omega_x_rho_x_t_1, omega_x_rho_x_t_2;
//	FLOATING temp_factor;
//	FLOATING u_n__over__c_squ[19];
//	FLOATING u_n__over__c_squ__squared_and_halved[19];
//
//	//....square speed of sound
//	/*      compute the out let velocity with a convevtive boundary condition
//					c.....loop over all nodes
//					c.....attention: actual densities are stored after the propagation
//					c                step in the help-array n_hlp !*/
//
//	//
//	//#pragma unroll
//	//	for (z = 0 ; z< lz ; ++z){
//	//#pragma unroll
//	//		for (y = 0 ; y< ly ; ++y){
//	//#pragma unroll
//	//			for (x = 0 ; x< lx; ++x){
//
//	const int tid=blockIdx.x*blockDim.x+threadIdx.x;
//	int rest;
//	int end_of_memory=lz*ly*(lx);
//
//	z=(int) (tid/(ly*lx));
//	rest=tid-z;
//	y=(int)(rest/lx);
//	x=rest-y;
//
//	if (tid<end_of_memory){
//		/*c.........only free nodes are considered here
//					!if (.not. obstacles[z][y][x]) then
//					c...........integral local density
//					c...........initialize variable ro*/
//		//memory optimised implementation
//		buff[0]=hlp_Q0[index(z,y,x)];
//		buff[1]=hlp_Q1[index(z,y,x)];
//		buff[2]=hlp_Q2[index(z,y,x)];
//		buff[3]=hlp_Q3[index(z,y,x)];
//		buff[4]=hlp_Q4[index(z,y,x)];
//		buff[5]=hlp_Q5[index(z,y,x)];
//		buff[6]=hlp_Q6[index(z,y,x)];
//		buff[7]=hlp_Q7[index(z,y,x)];
//		buff[8]=hlp_Q8[index(z,y,x)];
//		buff[9]=hlp_Q9[index(z,y,x)];
//		buff[10]=hlp_Q10[index(z,y,x)];
//		buff[11]=hlp_Q11[index(z,y,x)];
//		buff[12]=hlp_Q12[index(z,y,x)];
//		buff[13]=hlp_Q13[index(z,y,x)];
//		buff[14]=hlp_Q14[index(z,y,x)];
//		buff[15]=hlp_Q15[index(z,y,x)];
//		buff[16]=hlp_Q16[index(z,y,x)];
//		buff[17]=hlp_Q17[index(z,y,x)];
//		buff[18]=hlp_Q18[index(z,y,x)];
//
//		rho=0.0;
//		for(int k=0; k<DENSITIES; ++k)
//			rho+=buff[k];
//
//		//	rho=accumulate(buff, buff+DENSITIES, 0.0);
//
//		reciprocal_rho=1.0/rho;
//
//
//
//
//		switch(obstacles_d[index(z,y,x)]){
//		case 1:
//			u_x = 0.0;
//			u_y = 0.0;
//			u_z = 0.0;
//			break;
//		default:
//			u_x = 0.0;
//			u_x =  reciprocal_rho*(buff[1] + buff[7] + buff[10] +buff[11] + buff[14]-
//					(buff[3] + buff[8] + buff[9] +buff[12] + buff[13]));
//
//			u_y = 0.0;
//			u_y =  reciprocal_rho*(buff[2]+buff[8]+buff[7]+buff[16] + buff[15] -
//					(buff[4] + buff[9] + buff[10] +buff[17] + buff[18]));
//
//			u_z = 0.0;
//			u_z =  reciprocal_rho*(buff[5]+buff[13]+buff[14]+buff[15]+buff[18]-
//					(buff[6]+buff[12]+buff[11]+buff[16]+buff[17]));
//			break;
//		}//switch(obstacles[index(z,y,x)])
//
//		//original implementation
//		//				rho=0.0;
//		//				rho+=D3_hlp.Q0[index(z,y,x)]+D3_hlp.Q1[index(z,y,x)]+D3_hlp.Q2[index(z,y,x)]+D3_hlp.Q3[index(z,y,x)];
//		//				rho+=D3_hlp.Q4[index(z,y,x)]+D3_hlp.Q5[index(z,y,x)]+D3_hlp.Q6[index(z,y,x)]+D3_hlp.Q7[index(z,y,x)];
//		//				rho+=D3_hlp.Q8[index(z,y,x)]+D3_hlp.Q9[index(z,y,x)]+D3_hlp.Q10[index(z,y,x)]+D3_hlp.Q11[index(z,y,x)];
//		//				rho+=D3_hlp.Q12[index(z,y,x)]+D3_hlp.Q13[index(z,y,x)]+D3_hlp.Q14[index(z,y,x)]+D3_hlp.Q15[index(z,y,x)];
//		//				rho+=D3_hlp.Q16[index(z,y,x)]+D3_hlp.Q17[index(z,y,x)]+D3_hlp.Q18[index(z,y,x)];
//		//				reciprocal_rho=1.0/rho;
//
//		//...........x-, and y- velocity components
//
//		//				switch(obstacles[index(z,y,x)]){
//		//				case 1:
//		//					u_x = 0.0;
//		//					u_y = 0.0;
//		//					u_z = 0.0;
//		//					break;
//		//				default:
//		//					u_x = (FLOATING) reciprocal_rho*(D3_hlp.Q1[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
//		//							D3_hlp.Q11[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] -
//		//							(D3_hlp.Q3[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] +
//		//									D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)]));
//		//
//		//					u_y = (FLOATING) reciprocal_rho*(D3_hlp.Q2[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] +
//		//							D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q15[index(z,y,x)] -
//		//							(D3_hlp.Q4[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
//		//									D3_hlp.Q17[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)]));
//		//
//		//					u_z = (FLOATING) reciprocal_rho*(D3_hlp.Q5[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] +
//		//							D3_hlp.Q15[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)] -
//		//							(D3_hlp.Q6[index(z,y,x)] + D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q11[index(z,y,x)] +
//		//									D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q17[index(z,y,x)]));
//		//					break;
//		//				}//switch(obstacles[index(z,y,x)])
//
//
//
//
//		u_squ = (FLOATING)  u_x*u_x + u_y*u_y + u_z*u_z;
//		temp_factor= 0.5*(2.0* c_squ - u_squ)/c_squ;
//		//u_squ = (FLOATING)  pow(u_x,2) + pow(u_y,2) + pow(u_z,2);
//
//
//		/*...........n- velocity compnents (n = lattice node connection vectors)
//					c...........this is only necessary for clearence, and only 3 speeds would
//					c...........be necessary*/
//
//
//		//WARNING!!!! o pinakas autos exei tropopoihmena indices!!!!
//		u_n[0]= 0.0; //SHOULD NEVER USED!
//		u_n[1] =   u_x;
//		u_n[2] =         u_y;
//		u_n[3] = - u_x;
//		u_n[4] =       - u_y;
//		u_n[5] =   u_z;
//		u_n[6] =       - u_z;
//		u_n[7] =   u_x + u_y;
//		u_n[8] = - u_x + u_y;
//		u_n[9] = - u_x - u_y;
//		u_n[10] =   u_x - u_y;
//		u_n[11] =   u_x - u_z;
//		u_n[12] = - u_x - u_z;
//		u_n[13] = - u_x + u_z;
//		u_n[14] =   u_x + u_z;
//		u_n[15] =   u_z + u_y;
//		u_n[16] = - u_z + u_y;
//		u_n[17] = - u_z - u_y;
//		u_n[18] =   u_z - u_y;
//
//#pragma unroll
//		for(int i=0; i<DENSITIES; ++i){
//			u_n__over__c_squ[i]=reciprocal_c_squ*u_n[i];
//			u_n__over__c_squ__squared_and_halved[i]=0.5*u_n__over__c_squ[i]*u_n__over__c_squ[i];
//		}
//
//		/*c...........equilibrium densities
//					c...........this can be rewritten to improve computational performance
//					c...........considerabely !
//					c
//					c...........zero velocity density
//					c*/
//		//memory optimised implementation! WARNING!!! different from the original case!
//
//		//two_x_c_squ_sqared=2.0*c_squ*c_squ;
//		omega_x_rho_x_t_0=omega_x_t_0*rho;
//		omega_x_rho_x_t_1=omega_x_t_1*rho;
//		omega_x_rho_x_t_2=omega_x_t_2*rho;
//
//
//		//				//...........relaxation step
//
//
//		//omega_x_rho_x_t_0*(1.0 - 0.5*u_squ/c_squ);
//		Q0[index(z,y,x)]=buff[0]*one_minus_omega+omega_x_rho_x_t_0*(u_n__over__c_squ__squared_and_halved[0]+u_n__over__c_squ[0]+temp_factor);
//
//
//
//
//		Q1[index(z,y,x)]=buff[1]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[1]+u_n__over__c_squ[1]+temp_factor);
//		Q2[index(z,y,x)]=buff[2]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[2]+u_n__over__c_squ[2]+temp_factor);
//		Q3[index(z,y,x)]=buff[3]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[3]+u_n__over__c_squ[3]+temp_factor);
//		Q4[index(z,y,x)]=buff[4]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[4]+u_n__over__c_squ[4]+temp_factor);
//		Q5[index(z,y,x)]=buff[5]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[5]+u_n__over__c_squ[5]+temp_factor);
//		Q6[index(z,y,x)]=buff[6]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[6]+u_n__over__c_squ[6]+temp_factor);
//
//
//
//		Q7[index(z,y,x)]= buff[ 7]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 7]+u_n__over__c_squ[ 7]+temp_factor);
//		Q8[index(z,y,x)]= buff[ 8]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 8]+u_n__over__c_squ[ 8]+temp_factor);
//		Q9[index(z,y,x)]= buff[ 9]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 9]+u_n__over__c_squ[ 9]+temp_factor);
//		Q10[index(z,y,x)]=buff[10]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[10]+u_n__over__c_squ[10]+temp_factor);
//		Q11[index(z,y,x)]=buff[11]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[11]+u_n__over__c_squ[11]+temp_factor);
//		Q12[index(z,y,x)]=buff[12]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[12]+u_n__over__c_squ[12]+temp_factor);
//		Q13[index(z,y,x)]=buff[13]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[13]+u_n__over__c_squ[13]+temp_factor);
//		Q14[index(z,y,x)]=buff[14]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[14]+u_n__over__c_squ[14]+temp_factor);
//		Q15[index(z,y,x)]=buff[15]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[15]+u_n__over__c_squ[15]+temp_factor);
//		Q16[index(z,y,x)]=buff[16]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[16]+u_n__over__c_squ[16]+temp_factor);
//		Q17[index(z,y,x)]=buff[17]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[17]+u_n__over__c_squ[17]+temp_factor);
//		Q18[index(z,y,x)]=buff[18]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[18]+u_n__over__c_squ[18]+temp_factor);
//
//		//original implementation
//		//				n_equ[0] = t_0  * rho*(1.0 - u_squ / (2.0 * c_squ));
//		//
//		//								//...........axis speeds (factor: t_1)
//		//				#pragma unroll
//		//								for (int i = 1 ; i< 7; ++i){
//		//									n_equ[i] = t_1 * rho*(1.0 + u_n[i] / c_squ
//		//											+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
//		//											- u_squ / (2.0  * c_squ));
//		//								}
//		//
//		//								//...........diagonal speeds (factor: t_2)
//		//				#pragma unroll
//		//								for (int i = 7 ; i< 19; ++i){
//		//									n_equ[i] = t_2  * rho*(1.0 + u_n[i] / c_squ
//		//											+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
//		//											- u_squ / (2.0  * c_squ));
//		//								}
//
//		//				D3.Q0[index(z,y,x)]=D3_hlp.Q0[index(z,y,x)]+omega*(n_equ[0] - D3_hlp.Q0[index(z,y,x)]);
//		//								D3.Q1[index(z,y,x)]=D3_hlp.Q1[index(z,y,x)]+omega*(n_equ[1] - D3_hlp.Q1[index(z,y,x)]);
//		//								D3.Q2[index(z,y,x)]=D3_hlp.Q2[index(z,y,x)]+omega*(n_equ[2] - D3_hlp.Q2[index(z,y,x)]);
//		//								D3.Q3[index(z,y,x)]=D3_hlp.Q3[index(z,y,x)]+omega*(n_equ[3] - D3_hlp.Q3[index(z,y,x)]);
//		//								D3.Q4[index(z,y,x)]=D3_hlp.Q4[index(z,y,x)]+omega*(n_equ[4] - D3_hlp.Q4[index(z,y,x)]);
//		//								D3.Q5[index(z,y,x)]=D3_hlp.Q5[index(z,y,x)]+omega*(n_equ[5] - D3_hlp.Q5[index(z,y,x)]);
//		//								D3.Q6[index(z,y,x)]=D3_hlp.Q6[index(z,y,x)]+omega*(n_equ[6] - D3_hlp.Q6[index(z,y,x)]);
//		//								D3.Q7[index(z,y,x)]=D3_hlp.Q7[index(z,y,x)]+omega*(n_equ[7] - D3_hlp.Q7[index(z,y,x)]);
//		//								D3.Q8[index(z,y,x)]=D3_hlp.Q8[index(z,y,x)]+omega*(n_equ[8] - D3_hlp.Q8[index(z,y,x)]);
//		//								D3.Q9[index(z,y,x)]=D3_hlp.Q9[index(z,y,x)]+omega*(n_equ[9] - D3_hlp.Q9[index(z,y,x)]);
//		//								D3.Q10[index(z,y,x)]=D3_hlp.Q10[index(z,y,x)]+omega*(n_equ[10] - D3_hlp.Q10[index(z,y,x)]);
//		//								D3.Q11[index(z,y,x)]=D3_hlp.Q11[index(z,y,x)]+omega*(n_equ[11] - D3_hlp.Q11[index(z,y,x)]);
//		//								D3.Q12[index(z,y,x)]=D3_hlp.Q12[index(z,y,x)]+omega*(n_equ[12] - D3_hlp.Q12[index(z,y,x)]);
//		//								D3.Q13[index(z,y,x)]=D3_hlp.Q13[index(z,y,x)]+omega*(n_equ[13] - D3_hlp.Q13[index(z,y,x)]);
//		//								D3.Q14[index(z,y,x)]=D3_hlp.Q14[index(z,y,x)]+omega*(n_equ[14] - D3_hlp.Q14[index(z,y,x)]);
//		//								D3.Q15[index(z,y,x)]=D3_hlp.Q15[index(z,y,x)]+omega*(n_equ[15] - D3_hlp.Q15[index(z,y,x)]);
//		//								D3.Q16[index(z,y,x)]=D3_hlp.Q16[index(z,y,x)]+omega*(n_equ[16] - D3_hlp.Q16[index(z,y,x)]);
//		//								D3.Q17[index(z,y,x)]=D3_hlp.Q17[index(z,y,x)]+omega*(n_equ[17] - D3_hlp.Q17[index(z,y,x)]);
//		//								D3.Q18[index(z,y,x)]=D3_hlp.Q18[index(z,y,x)]+omega*(n_equ[18] - D3_hlp.Q18[index(z,y,x)]);
//
//		if (x == lx-2) {
//			u_previous_spatial_boundary[index2D(z,y)] = u_x;
//			v_previous_spatial_boundary[index2D(z,y)] = u_y;
//			w_previous_spatial_boundary[index2D(z,y)] = u_z;
//
//			u_current[index2D(z,y)] = u_x;
//			v_current[index2D(z,y)] = u_y;
//			w_current[index2D(z,y)] = u_z;
//
//		}//if (x == lx-2)
//	}//if memory!
//	//			}//for (x = 0 ; x< lx; ++x)
//	//		}//for (y = 0 ; y< ly ; ++y)
//	//	}//for (z = 0 ; z< lz ; ++z)
//
//}
//
//__global__
//void relaxation_kernel_v3(int lx, int ly, int lz, FLOATING reynolds, FLOATING nu, FLOATING r_small,
//		FLOATING t_0, FLOATING t_1, FLOATING t_2, FLOATING c_squ, FLOATING omega, FLOATING one_minus_omega,
//		FLOATING reciprocal_c_squ,
//		FLOATING *hlp_Q0, FLOATING *hlp_Q1, FLOATING *hlp_Q2, FLOATING *hlp_Q3,
//		FLOATING *hlp_Q4, FLOATING *hlp_Q5, FLOATING *hlp_Q6, FLOATING *hlp_Q7,
//		FLOATING *hlp_Q8, FLOATING *hlp_Q9, FLOATING *hlp_Q10, FLOATING *hlp_Q11,
//		FLOATING *hlp_Q12, FLOATING *hlp_Q13, FLOATING *hlp_Q14, FLOATING *hlp_Q15,
//		FLOATING *hlp_Q16, FLOATING *hlp_Q17, FLOATING *hlp_Q18,
//		FLOATING *Q0, FLOATING *Q1, FLOATING *Q2, FLOATING *Q3,
//		FLOATING *Q4, FLOATING *Q5, FLOATING *Q6, FLOATING *Q7,
//		FLOATING *Q8, FLOATING *Q9, FLOATING *Q10, FLOATING *Q11,
//		FLOATING *Q12, FLOATING *Q13, FLOATING *Q14, FLOATING *Q15,
//		FLOATING *Q16, FLOATING *Q17, FLOATING *Q18,
//		int *obstacles,
//		FLOATING *u_previous_spatial_boundary, FLOATING *v_previous_spatial_boundary, FLOATING *w_previous_spatial_boundary,
//		FLOATING *u_current, FLOATING *v_current, FLOATING *w_current){
//
//
//
//
//
//	/*One-step density relaxation process
//
//				c.......density relaxation: a single time relaxation with relaxation
//				c       parameter omega is applied here. This step is only "local",
//				c       nothing is propagated through the lattice.
//				c*/
//
//	int  x,y,z;
//	FLOATING  u_x=0.0, u_y=0.0, u_z=0.0, u_squ=0.0, rho=0.0, reciprocal_rho=0.0;
//
//
//
//
//	FLOATING u_n[19];
//	//	FLOATING n_equ[19];
//	FLOATING buff[19];
//
//	//	FLOATING u_n_squared[19];
//	//FLOATING two_x_c_squ_sqared;
//	const FLOATING omega_x_t_0=omega*t_0, omega_x_t_1=omega*t_1, omega_x_t_2=omega*t_2;
//	FLOATING omega_x_rho_x_t_0, omega_x_rho_x_t_1, omega_x_rho_x_t_2;
//	FLOATING temp_factor;
//	FLOATING u_n__over__c_squ[19];
//	FLOATING u_n__over__c_squ__squared_and_halved[19];
//
//	//....square speed of sound
//	/*      compute the out let velocity with a convevtive boundary condition
//					c.....loop over all nodes
//					c.....attention: actual densities are stored after the propagation
//					c                step in the help-array n_hlp !*/
//
//	//
//	//#pragma unroll
//	//	for (z = 0 ; z< lz ; ++z){
//	//#pragma unroll
//	//		for (y = 0 ; y< ly ; ++y){
//	//#pragma unroll
//	//			for (x = 0 ; x< lx; ++x){
//
//	const int tid=blockIdx.x*blockDim.x+threadIdx.x;
//	int rest;
//	int end_of_memory=lz*ly*(lx);
//
//	z=(int) (tid/(ly*lx));
//	rest=tid-z;
//	y=(int)(rest/lx);
//	x=rest-y;
//
//	if (tid<end_of_memory){
//		/*c.........only free nodes are considered here
//					!if (.not. obstacles[z][y][x]) then
//					c...........integral local density
//					c...........initialize variable ro*/
//		//memory optimised implementation
//		buff[0]=hlp_Q0[tid];
//		buff[1]=hlp_Q1[tid];
//		buff[2]=hlp_Q2[tid];
//		buff[3]=hlp_Q3[tid];
//		buff[4]=hlp_Q4[tid];
//		buff[5]=hlp_Q5[tid];
//		buff[6]=hlp_Q6[tid];
//		buff[7]=hlp_Q7[tid];
//		buff[8]=hlp_Q8[tid];
//		buff[9]=hlp_Q9[tid];
//		buff[10]=hlp_Q10[tid];
//		buff[11]=hlp_Q11[tid];
//		buff[12]=hlp_Q12[tid];
//		buff[13]=hlp_Q13[tid];
//		buff[14]=hlp_Q14[tid];
//		buff[15]=hlp_Q15[tid];
//		buff[16]=hlp_Q16[tid];
//		buff[17]=hlp_Q17[tid];
//		buff[18]=hlp_Q18[tid];
//
//		rho=0.0;
//		for(int k=0; k<DENSITIES; ++k)
//			rho+=buff[k];
//
//		//	rho=accumulate(buff, buff+DENSITIES, 0.0);
//
//		reciprocal_rho=1.0/rho;
//
//
//
//
//		switch(obstacles[tid]){
//		case 1:
//			u_x = 0.0;
//			u_y = 0.0;
//			u_z = 0.0;
//			break;
//		default:
//			u_x = 0.0;
//			u_x =  reciprocal_rho*(buff[1] + buff[7] + buff[10] +buff[11] + buff[14]-
//					(buff[3] + buff[8] + buff[9] +buff[12] + buff[13]));
//
//			u_y = 0.0;
//			u_y =  reciprocal_rho*(buff[2]+buff[8]+buff[7]+buff[16] + buff[15] -
//					(buff[4] + buff[9] + buff[10] +buff[17] + buff[18]));
//
//			u_z = 0.0;
//			u_z =  reciprocal_rho*(buff[5]+buff[13]+buff[14]+buff[15]+buff[18]-
//					(buff[6]+buff[12]+buff[11]+buff[16]+buff[17]));
//			break;
//		}//switch(obstacles[index(z,y,x)])
//
//		//original implementation
//		//				rho=0.0;
//		//				rho+=D3_hlp.Q0[index(z,y,x)]+D3_hlp.Q1[index(z,y,x)]+D3_hlp.Q2[index(z,y,x)]+D3_hlp.Q3[index(z,y,x)];
//		//				rho+=D3_hlp.Q4[index(z,y,x)]+D3_hlp.Q5[index(z,y,x)]+D3_hlp.Q6[index(z,y,x)]+D3_hlp.Q7[index(z,y,x)];
//		//				rho+=D3_hlp.Q8[index(z,y,x)]+D3_hlp.Q9[index(z,y,x)]+D3_hlp.Q10[index(z,y,x)]+D3_hlp.Q11[index(z,y,x)];
//		//				rho+=D3_hlp.Q12[index(z,y,x)]+D3_hlp.Q13[index(z,y,x)]+D3_hlp.Q14[index(z,y,x)]+D3_hlp.Q15[index(z,y,x)];
//		//				rho+=D3_hlp.Q16[index(z,y,x)]+D3_hlp.Q17[index(z,y,x)]+D3_hlp.Q18[index(z,y,x)];
//		//				reciprocal_rho=1.0/rho;
//
//		//...........x-, and y- velocity components
//
//		//				switch(obstacles[index(z,y,x)]){
//		//				case 1:
//		//					u_x = 0.0;
//		//					u_y = 0.0;
//		//					u_z = 0.0;
//		//					break;
//		//				default:
//		//					u_x = (FLOATING) reciprocal_rho*(D3_hlp.Q1[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
//		//							D3_hlp.Q11[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] -
//		//							(D3_hlp.Q3[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] +
//		//									D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)]));
//		//
//		//					u_y = (FLOATING) reciprocal_rho*(D3_hlp.Q2[index(z,y,x)] + D3_hlp.Q8[index(z,y,x)] + D3_hlp.Q7[index(z,y,x)] +
//		//							D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q15[index(z,y,x)] -
//		//							(D3_hlp.Q4[index(z,y,x)] + D3_hlp.Q9[index(z,y,x)] + D3_hlp.Q10[index(z,y,x)] +
//		//									D3_hlp.Q17[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)]));
//		//
//		//					u_z = (FLOATING) reciprocal_rho*(D3_hlp.Q5[index(z,y,x)] + D3_hlp.Q13[index(z,y,x)] + D3_hlp.Q14[index(z,y,x)] +
//		//							D3_hlp.Q15[index(z,y,x)] + D3_hlp.Q18[index(z,y,x)] -
//		//							(D3_hlp.Q6[index(z,y,x)] + D3_hlp.Q12[index(z,y,x)] + D3_hlp.Q11[index(z,y,x)] +
//		//									D3_hlp.Q16[index(z,y,x)] + D3_hlp.Q17[index(z,y,x)]));
//		//					break;
//		//				}//switch(obstacles[index(z,y,x)])
//
//
//
//
//		u_squ = (FLOATING)  u_x*u_x + u_y*u_y + u_z*u_z;
//		temp_factor= 0.5*(2.0* c_squ - u_squ)/c_squ;
//		//u_squ = (FLOATING)  pow(u_x,2) + pow(u_y,2) + pow(u_z,2);
//
//
//		/*...........n- velocity compnents (n = lattice node connection vectors)
//					c...........this is only necessary for clearence, and only 3 speeds would
//					c...........be necessary*/
//
//
//		//WARNING!!!! o pinakas autos exei tropopoihmena indices!!!!
//		u_n[0]= 0.0; //SHOULD NEVER USED!
//		u_n[1] =   u_x;
//		u_n[2] =         u_y;
//		u_n[3] = - u_x;
//		u_n[4] =       - u_y;
//		u_n[5] =   u_z;
//		u_n[6] =       - u_z;
//		u_n[7] =   u_x + u_y;
//		u_n[8] = - u_x + u_y;
//		u_n[9] = - u_x - u_y;
//		u_n[10] =   u_x - u_y;
//		u_n[11] =   u_x - u_z;
//		u_n[12] = - u_x - u_z;
//		u_n[13] = - u_x + u_z;
//		u_n[14] =   u_x + u_z;
//		u_n[15] =   u_z + u_y;
//		u_n[16] = - u_z + u_y;
//		u_n[17] = - u_z - u_y;
//		u_n[18] =   u_z - u_y;
//
//#pragma unroll
//		for(int i=0; i<DENSITIES; ++i){
//			u_n__over__c_squ[i]=reciprocal_c_squ*u_n[i];
//			u_n__over__c_squ__squared_and_halved[i]=0.5*u_n__over__c_squ[i]*u_n__over__c_squ[i];
//		}
//
//		/*c...........equilibrium densities
//					c...........this can be rewritten to improve computational performance
//					c...........considerabely !
//					c
//					c...........zero velocity density
//					c*/
//		//memory optimised implementation! WARNING!!! different from the original case!
//
//		//two_x_c_squ_sqared=2.0*c_squ*c_squ;
//		omega_x_rho_x_t_0=omega_x_t_0*rho;
//		omega_x_rho_x_t_1=omega_x_t_1*rho;
//		omega_x_rho_x_t_2=omega_x_t_2*rho;
//
//
//		//				//...........relaxation step
//
//
//		//omega_x_rho_x_t_0*(1.0 - 0.5*u_squ/c_squ);
//		Q0[tid]=buff[0]*one_minus_omega+omega_x_rho_x_t_0*(u_n__over__c_squ__squared_and_halved[0]+u_n__over__c_squ[0]+temp_factor);
//
//
//
//
//		Q1[tid]=buff[1]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[1]+u_n__over__c_squ[1]+temp_factor);
//		Q2[tid]=buff[2]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[2]+u_n__over__c_squ[2]+temp_factor);
//		Q3[tid]=buff[3]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[3]+u_n__over__c_squ[3]+temp_factor);
//		Q4[tid]=buff[4]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[4]+u_n__over__c_squ[4]+temp_factor);
//		Q5[tid]=buff[5]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[5]+u_n__over__c_squ[5]+temp_factor);
//		Q6[tid]=buff[6]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[6]+u_n__over__c_squ[6]+temp_factor);
//
//
//
//		Q7[tid]= buff[ 7]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 7]+u_n__over__c_squ[ 7]+temp_factor);
//		Q8[tid]= buff[ 8]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 8]+u_n__over__c_squ[ 8]+temp_factor);
//		Q9[tid]= buff[ 9]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 9]+u_n__over__c_squ[ 9]+temp_factor);
//		Q10[tid]=buff[10]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[10]+u_n__over__c_squ[10]+temp_factor);
//		Q11[tid]=buff[11]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[11]+u_n__over__c_squ[11]+temp_factor);
//		Q12[tid]=buff[12]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[12]+u_n__over__c_squ[12]+temp_factor);
//		Q13[tid]=buff[13]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[13]+u_n__over__c_squ[13]+temp_factor);
//		Q14[tid]=buff[14]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[14]+u_n__over__c_squ[14]+temp_factor);
//		Q15[tid]=buff[15]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[15]+u_n__over__c_squ[15]+temp_factor);
//		Q16[tid]=buff[16]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[16]+u_n__over__c_squ[16]+temp_factor);
//		Q17[tid]=buff[17]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[17]+u_n__over__c_squ[17]+temp_factor);
//		Q18[tid]=buff[18]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[18]+u_n__over__c_squ[18]+temp_factor);
//
//		//original implementation
//		//				n_equ[0] = t_0  * rho*(1.0 - u_squ / (2.0 * c_squ));
//		//
//		//								//...........axis speeds (factor: t_1)
//		//				#pragma unroll
//		//								for (int i = 1 ; i< 7; ++i){
//		//									n_equ[i] = t_1 * rho*(1.0 + u_n[i] / c_squ
//		//											+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
//		//											- u_squ / (2.0  * c_squ));
//		//								}
//		//
//		//								//...........diagonal speeds (factor: t_2)
//		//				#pragma unroll
//		//								for (int i = 7 ; i< 19; ++i){
//		//									n_equ[i] = t_2  * rho*(1.0 + u_n[i] / c_squ
//		//											+ (u_n[i]*u_n[i]) / (2.0 * c_squ *c_squ)
//		//											- u_squ / (2.0  * c_squ));
//		//								}
//
//		//				D3.Q0[index(z,y,x)]=D3_hlp.Q0[index(z,y,x)]+omega*(n_equ[0] - D3_hlp.Q0[index(z,y,x)]);
//		//								D3.Q1[index(z,y,x)]=D3_hlp.Q1[index(z,y,x)]+omega*(n_equ[1] - D3_hlp.Q1[index(z,y,x)]);
//		//								D3.Q2[index(z,y,x)]=D3_hlp.Q2[index(z,y,x)]+omega*(n_equ[2] - D3_hlp.Q2[index(z,y,x)]);
//		//								D3.Q3[index(z,y,x)]=D3_hlp.Q3[index(z,y,x)]+omega*(n_equ[3] - D3_hlp.Q3[index(z,y,x)]);
//		//								D3.Q4[index(z,y,x)]=D3_hlp.Q4[index(z,y,x)]+omega*(n_equ[4] - D3_hlp.Q4[index(z,y,x)]);
//		//								D3.Q5[index(z,y,x)]=D3_hlp.Q5[index(z,y,x)]+omega*(n_equ[5] - D3_hlp.Q5[index(z,y,x)]);
//		//								D3.Q6[index(z,y,x)]=D3_hlp.Q6[index(z,y,x)]+omega*(n_equ[6] - D3_hlp.Q6[index(z,y,x)]);
//		//								D3.Q7[index(z,y,x)]=D3_hlp.Q7[index(z,y,x)]+omega*(n_equ[7] - D3_hlp.Q7[index(z,y,x)]);
//		//								D3.Q8[index(z,y,x)]=D3_hlp.Q8[index(z,y,x)]+omega*(n_equ[8] - D3_hlp.Q8[index(z,y,x)]);
//		//								D3.Q9[index(z,y,x)]=D3_hlp.Q9[index(z,y,x)]+omega*(n_equ[9] - D3_hlp.Q9[index(z,y,x)]);
//		//								D3.Q10[index(z,y,x)]=D3_hlp.Q10[index(z,y,x)]+omega*(n_equ[10] - D3_hlp.Q10[index(z,y,x)]);
//		//								D3.Q11[index(z,y,x)]=D3_hlp.Q11[index(z,y,x)]+omega*(n_equ[11] - D3_hlp.Q11[index(z,y,x)]);
//		//								D3.Q12[index(z,y,x)]=D3_hlp.Q12[index(z,y,x)]+omega*(n_equ[12] - D3_hlp.Q12[index(z,y,x)]);
//		//								D3.Q13[index(z,y,x)]=D3_hlp.Q13[index(z,y,x)]+omega*(n_equ[13] - D3_hlp.Q13[index(z,y,x)]);
//		//								D3.Q14[index(z,y,x)]=D3_hlp.Q14[index(z,y,x)]+omega*(n_equ[14] - D3_hlp.Q14[index(z,y,x)]);
//		//								D3.Q15[index(z,y,x)]=D3_hlp.Q15[index(z,y,x)]+omega*(n_equ[15] - D3_hlp.Q15[index(z,y,x)]);
//		//								D3.Q16[index(z,y,x)]=D3_hlp.Q16[index(z,y,x)]+omega*(n_equ[16] - D3_hlp.Q16[index(z,y,x)]);
//		//								D3.Q17[index(z,y,x)]=D3_hlp.Q17[index(z,y,x)]+omega*(n_equ[17] - D3_hlp.Q17[index(z,y,x)]);
//		//								D3.Q18[index(z,y,x)]=D3_hlp.Q18[index(z,y,x)]+omega*(n_equ[18] - D3_hlp.Q18[index(z,y,x)]);
//
//		if (x == lx-2) {
//			u_previous_spatial_boundary[index2D(z,y)] = u_x;
//			v_previous_spatial_boundary[index2D(z,y)] = u_y;
//			w_previous_spatial_boundary[index2D(z,y)] = u_z;
//
//			u_current[index2D(z,y)] = u_x;
//			v_current[index2D(z,y)] = u_y;
//			w_current[index2D(z,y)] = u_z;
//
//		}//if (x == lx-2)
//	}//if memory!
//	//			}//for (x = 0 ; x< lx; ++x)
//	//		}//for (y = 0 ; y< ly ; ++y)
//	//	}//for (z = 0 ; z< lz ; ++z)
//
//}

__global__
void relaxation_kernel_v4(const int lx, const int ly, const int lz, const FLOATING reynolds, FLOATING nu, FLOATING r_small,
		FLOATING t_0, FLOATING t_1, FLOATING t_2, FLOATING c_squ, FLOATING omega, FLOATING one_minus_omega,
		FLOATING reciprocal_c_squ,
		const FLOATING *hlp_Q0, const FLOATING *hlp_Q1, const FLOATING *hlp_Q2, const FLOATING *hlp_Q3,
		const FLOATING *hlp_Q4, const FLOATING *hlp_Q5, const FLOATING *hlp_Q6, const FLOATING *hlp_Q7,
		const FLOATING *hlp_Q8, const FLOATING *hlp_Q9, const FLOATING *hlp_Q10, const FLOATING *hlp_Q11,
		const FLOATING *hlp_Q12, const FLOATING *hlp_Q13, const FLOATING *hlp_Q14, const FLOATING *hlp_Q15,
		const FLOATING *hlp_Q16, const FLOATING *hlp_Q17, const FLOATING *hlp_Q18,
		FLOATING *Q0, FLOATING *Q1, FLOATING *Q2, FLOATING *Q3,
		FLOATING *Q4, FLOATING *Q5, FLOATING *Q6, FLOATING *Q7,
		FLOATING *Q8, FLOATING *Q9, FLOATING *Q10, FLOATING *Q11,
		FLOATING *Q12, FLOATING *Q13, FLOATING *Q14, FLOATING *Q15,
		FLOATING *Q16, FLOATING *Q17, FLOATING *Q18,
		const int *obstacles,
		FLOATING *u_previous_spatial_boundary, FLOATING *v_previous_spatial_boundary, FLOATING *w_previous_spatial_boundary,
		FLOATING *u_current, FLOATING *v_current, FLOATING *w_current, FLOATING *u_current_temp){





	/*One-step density relaxation process

				c.......density relaxation: a single time relaxation with relaxation
				c       parameter omega is applied here. This step is only "local",
				c       nothing is propagated through the lattice.
				c*/

	int  x,y,z;
	FLOATING  u_x=0.0, u_y=0.0, u_z=0.0, u_squ=0.0, rho=0.0, reciprocal_rho=0.0;




	__shared__ FLOATING u_n[19];

	__shared__ FLOATING buff[19];

	//	extern __shared__ FLOATING shared_buffer[];

	const FLOATING omega_x_t_0=omega*t_0, omega_x_t_1=omega*t_1, omega_x_t_2=omega*t_2;
	FLOATING omega_x_rho_x_t_0, omega_x_rho_x_t_1, omega_x_rho_x_t_2;
	FLOATING temp_factor;
	FLOATING u_n__over__c_squ[19];
	FLOATING u_n__over__c_squ__squared_and_halved[19];

	//....square speed of sound
	/*      compute the out let velocity with a convevtive boundary condition
					c.....loop over all nodes
					c.....attention: actual densities are stored after the propagation
					c                step in the help-array n_hlp !*/



	const int tid=blockIdx.x*blockDim.x+threadIdx.x;
	int rest;
	int end_of_memory=lz*ly*(lx);

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

	if (tid<end_of_memory){
		/*c.........only free nodes are considered here
					!if (.not. obstacles[z][y][x]) then
					c...........integral local density
					c...........initialize variable ro*/
		//memory optimised implementation
		buff[0]=hlp_Q0[tid];
		buff[1]=hlp_Q1[tid];
		buff[2]=hlp_Q2[tid];
		buff[3]=hlp_Q3[tid];
		buff[4]=hlp_Q4[tid];
		buff[5]=hlp_Q5[tid];
		buff[6]=hlp_Q6[tid];
		buff[7]=hlp_Q7[tid];
		buff[8]=hlp_Q8[tid];
		buff[9]=hlp_Q9[tid];
		buff[10]=hlp_Q10[tid];
		buff[11]=hlp_Q11[tid];
		buff[12]=hlp_Q12[tid];
		buff[13]=hlp_Q13[tid];
		buff[14]=hlp_Q14[tid];
		buff[15]=hlp_Q15[tid];
		buff[16]=hlp_Q16[tid];
		buff[17]=hlp_Q17[tid];
		buff[18]=hlp_Q18[tid];

		rho=0.0;
#pragma unroll
		for(int k=0; k<DENSITIES; ++k)
			rho+=buff[k];



		reciprocal_rho=1.0/rho;




		u_x =  (1-obstacles[tid])*reciprocal_rho*(buff[1] + buff[7] + buff[10] +buff[11] + buff[14]-
				(buff[3] + buff[8] + buff[9] +buff[12] + buff[13]));


		u_y =   (1-obstacles[tid])*reciprocal_rho*(buff[2]+buff[8]+buff[7]+buff[16] + buff[15] -
				(buff[4] + buff[9] + buff[10] +buff[17] + buff[18]));


		u_z =   (1-obstacles[tid])*reciprocal_rho*(buff[5]+buff[13]+buff[14]+buff[15]+buff[18]-
				(buff[6]+buff[12]+buff[11]+buff[16]+buff[17]));






		u_squ = (FLOATING)  u_x*u_x + u_y*u_y + u_z*u_z;
		temp_factor= 0.5*(2.0* c_squ - u_squ)/c_squ;
		//u_squ = (FLOATING)  pow(u_x,2) + pow(u_y,2) + pow(u_z,2);


		/*...........n- velocity compnents (n = lattice node connection vectors)
					c...........this is only necessary for clearence, and only 3 speeds would
					c...........be necessary*/


		//WARNING!!!! o pinakas autos exei tropopoihmena indices!!!!
		u_n[0]= 0.0; //SHOULD NEVER USED!
		u_n[1] =   u_x;
		u_n[2] =         u_y;
		u_n[3] = - u_x;
		u_n[4] =       - u_y;
		u_n[5] =   u_z;
		u_n[6] =       - u_z;
		u_n[7] =   u_x + u_y;
		u_n[8] = - u_x + u_y;
		u_n[9] = - u_x - u_y;
		u_n[10] =   u_x - u_y;
		u_n[11] =   u_x - u_z;
		u_n[12] = - u_x - u_z;
		u_n[13] = - u_x + u_z;
		u_n[14] =   u_x + u_z;
		u_n[15] =   u_z + u_y;
		u_n[16] = - u_z + u_y;
		u_n[17] = - u_z - u_y;
		u_n[18] =   u_z - u_y;

#pragma unroll
		for(int i=0; i<DENSITIES; ++i){
			u_n__over__c_squ[i]=reciprocal_c_squ*u_n[i];
			u_n__over__c_squ__squared_and_halved[i]=0.5*u_n__over__c_squ[i]*u_n__over__c_squ[i];
		}

		/*c...........equilibrium densities
					c...........this can be rewritten to improve computational performance
					c...........considerabely !
					c
					c...........zero velocity density
					c*/
		//memory optimised implementation! WARNING!!! different from the original case!

		//two_x_c_squ_sqared=2.0*c_squ*c_squ;
		omega_x_rho_x_t_0=omega_x_t_0*rho;
		omega_x_rho_x_t_1=omega_x_t_1*rho;
		omega_x_rho_x_t_2=omega_x_t_2*rho;


		//				//...........relaxation step


		//omega_x_rho_x_t_0*(1.0 - 0.5*u_squ/c_squ);
		Q0[tid]=buff[0]*one_minus_omega+omega_x_rho_x_t_0*(u_n__over__c_squ__squared_and_halved[0]+u_n__over__c_squ[0]+temp_factor);




		Q1[tid]=buff[1]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[1]+u_n__over__c_squ[1]+temp_factor);
		Q2[tid]=buff[2]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[2]+u_n__over__c_squ[2]+temp_factor);
		Q3[tid]=buff[3]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[3]+u_n__over__c_squ[3]+temp_factor);
		Q4[tid]=buff[4]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[4]+u_n__over__c_squ[4]+temp_factor);
		Q5[tid]=buff[5]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[5]+u_n__over__c_squ[5]+temp_factor);
		Q6[tid]=buff[6]*one_minus_omega+omega_x_rho_x_t_1*(u_n__over__c_squ__squared_and_halved[6]+u_n__over__c_squ[6]+temp_factor);



		Q7[tid]= buff[ 7]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 7]+u_n__over__c_squ[ 7]+temp_factor);
		Q8[tid]= buff[ 8]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 8]+u_n__over__c_squ[ 8]+temp_factor);
		Q9[tid]= buff[ 9]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[ 9]+u_n__over__c_squ[ 9]+temp_factor);
		Q10[tid]=buff[10]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[10]+u_n__over__c_squ[10]+temp_factor);
		Q11[tid]=buff[11]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[11]+u_n__over__c_squ[11]+temp_factor);
		Q12[tid]=buff[12]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[12]+u_n__over__c_squ[12]+temp_factor);
		Q13[tid]=buff[13]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[13]+u_n__over__c_squ[13]+temp_factor);
		Q14[tid]=buff[14]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[14]+u_n__over__c_squ[14]+temp_factor);
		Q15[tid]=buff[15]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[15]+u_n__over__c_squ[15]+temp_factor);
		Q16[tid]=buff[16]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[16]+u_n__over__c_squ[16]+temp_factor);
		Q17[tid]=buff[17]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[17]+u_n__over__c_squ[17]+temp_factor);
		Q18[tid]=buff[18]*one_minus_omega+omega_x_rho_x_t_2*(u_n__over__c_squ__squared_and_halved[18]+u_n__over__c_squ[18]+temp_factor);


		//todo : improve the following if by having a kernel to collect all the necessary data
		if (x == lx-2 and obstacles[index(z,y,(lx-1))]==0) {
			u_previous_spatial_boundary[index2D(z,y)] = u_x;
			v_previous_spatial_boundary[index2D(z,y)] = u_y;
			w_previous_spatial_boundary[index2D(z,y)] = u_z;

			u_current[index2D(z,y)] = u_x;
			v_current[index2D(z,y)] = u_y;
			w_current[index2D(z,y)] = u_z;

			u_current_temp[index2D(z,y)] = u_x;


		}//if (x == lx-2)
	}//if memory!


}


void LBM::cuda_relaxation(){

	if(data_location==CPU)
		copy_data_from_host_to_device();

	dim3 threads_type2(threads_for_streaming_collision_and_relaxation,1,1);
	dim3 grid_type2(blocks_for_streaming_collision_and_relaxation,1,1);

	relaxation_kernel_v4<<<grid_type2, threads_type2>>>( lx,  ly,  lz,  reynolds,  nu,  r_small,
			t_0,  t_1,  t_2,  c_squ,  omega,  one_minus_omega,
			reciprocal_c_squ,
			D3_hlp_d.Q0, D3_hlp_d.Q1, D3_hlp_d.Q2, D3_hlp_d.Q3,
			D3_hlp_d.Q4, D3_hlp_d.Q5, D3_hlp_d.Q6, D3_hlp_d.Q7,
			D3_hlp_d.Q8, D3_hlp_d.Q9, D3_hlp_d.Q10, D3_hlp_d.Q11,
			D3_hlp_d.Q12, D3_hlp_d.Q13, D3_hlp_d.Q14, D3_hlp_d.Q15,
			D3_hlp_d.Q16, D3_hlp_d.Q17, D3_hlp_d.Q18,
			D3_d.Q0, D3_d.Q1, D3_d.Q2, D3_d.Q3,
			D3_d.Q4, D3_d.Q5, D3_d.Q6, D3_d.Q7,
			D3_d.Q8, D3_d.Q9, D3_d.Q10, D3_d.Q11,
			D3_d.Q12, D3_d.Q13, D3_d.Q14, D3_d.Q15,
			D3_d.Q16, D3_d.Q17, D3_d.Q18,
			obstacles_d,
			u_previous_spatial_boundary_d, v_previous_spatial_boundary_d, w_previous_spatial_boundary_d,
			u_current_d, v_current_d, w_current_d, u_current_temp_d);




	hipDeviceSynchronize();
}

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

                                        # End of file scope inline assembly
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _ZN3LBM10relaxationEv
.LCPI0_0:
	.long	0x3f800000                      # float 1
.LCPI0_3:
	.long	0x00000000                      # float 0
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI0_1:
	.quad	0x3fe0000000000000              # double 0.5
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0
.LCPI0_2:
	.long	0x80000000                      # float -0
	.long	0x80000000                      # float -0
	.long	0x80000000                      # float -0
	.long	0x80000000                      # float -0
	.text
	.globl	_ZN3LBM10relaxationEv
	.p2align	1, 0x90
	.type	_ZN3LBM10relaxationEv,@function
_ZN3LBM10relaxationEv:                  # @_ZN3LBM10relaxationEv
	.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	$808, %rsp                      # imm = 0x328
	.cfi_def_cfa_offset 864
	.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	%rdi, %rbx
	cmpl	$1, 784(%rdi)
	jne	.LBB0_2
# %bb.1:
	movq	%rbx, %rdi
	callq	_ZN3LBM29copy_data_from_device_to_hostEv
.LBB0_2:
	movl	36(%rbx), %eax
	movq	%rax, 224(%rsp)                 # 8-byte Spill
	testl	%eax, %eax
	jle	.LBB0_17
# %bb.3:                                # %.preheader241.lr.ph
	movss	172(%rbx), %xmm0                # xmm0 = mem[0],zero,zero,zero
	movss	84(%rbx), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	mulss	%xmm0, %xmm1
	movss	%xmm1, 104(%rsp)                # 4-byte Spill
	movss	88(%rbx), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	mulss	%xmm0, %xmm1
	movss	%xmm1, 100(%rsp)                # 4-byte Spill
	mulss	92(%rbx), %xmm0
	movss	%xmm0, 108(%rsp)                # 4-byte Spill
	movl	28(%rbx), %ecx
	movl	32(%rbx), %eax
	movq	%rax, 80(%rsp)                  # 8-byte Spill
	leal	-2(%rcx), %eax
	movq	%rax, 248(%rsp)                 # 8-byte Spill
	xorl	%eax, %eax
	movq	%rax, 72(%rsp)                  # 8-byte Spill
.LBB0_4:                                # %.preheader241
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_6 Depth 2
                                        #       Child Loop BB0_8 Depth 3
                                        #         Child Loop BB0_9 Depth 4
	cmpl	$0, 80(%rsp)                    # 4-byte Folded Reload
	jle	.LBB0_16
# %bb.5:                                # %.preheader.lr.ph
                                        #   in Loop: Header=BB0_4 Depth=1
	movq	384(%rbx), %rax
	movq	%rax, 416(%rsp)                 # 8-byte Spill
	movq	392(%rbx), %rax
	movq	%rax, 408(%rsp)                 # 8-byte Spill
	movq	400(%rbx), %rax
	movq	%rax, 400(%rsp)                 # 8-byte Spill
	movq	408(%rbx), %rax
	movq	%rax, 392(%rsp)                 # 8-byte Spill
	movq	416(%rbx), %rax
	movq	%rax, 384(%rsp)                 # 8-byte Spill
	movq	424(%rbx), %rax
	movq	%rax, 376(%rsp)                 # 8-byte Spill
	movq	432(%rbx), %rax
	movq	%rax, 368(%rsp)                 # 8-byte Spill
	movq	440(%rbx), %rax
	movq	%rax, 360(%rsp)                 # 8-byte Spill
	movq	448(%rbx), %rax
	movq	%rax, 352(%rsp)                 # 8-byte Spill
	movq	456(%rbx), %rax
	movq	%rax, 344(%rsp)                 # 8-byte Spill
	movq	464(%rbx), %rax
	movq	%rax, 336(%rsp)                 # 8-byte Spill
	movq	472(%rbx), %rax
	movq	%rax, 328(%rsp)                 # 8-byte Spill
	movq	80(%rsp), %rax                  # 8-byte Reload
	movl	%eax, %edx
	movq	72(%rsp), %rax                  # 8-byte Reload
	imull	%eax, %edx
	movq	%rdx, 240(%rsp)                 # 8-byte Spill
	movl	32(%rbx), %edx
	imull	%eax, %edx
	movq	%rdx, 232(%rsp)                 # 8-byte Spill
	movq	216(%rbx), %rax
	movq	%rax, 320(%rsp)                 # 8-byte Spill
	movq	224(%rbx), %rax
	movq	%rax, 312(%rsp)                 # 8-byte Spill
	movq	232(%rbx), %rax
	movq	%rax, 304(%rsp)                 # 8-byte Spill
	movq	240(%rbx), %rax
	movq	%rax, 296(%rsp)                 # 8-byte Spill
	movq	248(%rbx), %rax
	movq	%rax, 288(%rsp)                 # 8-byte Spill
	movq	256(%rbx), %rax
	movq	%rax, 280(%rsp)                 # 8-byte Spill
	movq	264(%rbx), %rax
	movq	%rax, 272(%rsp)                 # 8-byte Spill
	movq	272(%rbx), %rax
	movq	%rax, 264(%rsp)                 # 8-byte Spill
	movq	280(%rbx), %rax
	movq	%rax, 256(%rsp)                 # 8-byte Spill
	movq	288(%rbx), %rbp
	movq	480(%rbx), %rax
	movq	488(%rbx), %rdi
	movq	496(%rbx), %rdx
	movq	504(%rbx), %rsi
	movq	512(%rbx), %r8
	movq	520(%rbx), %r9
	xorl	%r10d, %r10d
	movq	%r10, 88(%rsp)                  # 8-byte Spill
.LBB0_6:                                # %.preheader
                                        #   Parent Loop BB0_4 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB0_8 Depth 3
                                        #         Child Loop BB0_9 Depth 4
	testl	%ecx, %ecx
	jle	.LBB0_15
# %bb.7:                                # %.lr.ph
                                        #   in Loop: Header=BB0_6 Depth=2
	movq	240(%rsp), %r10                 # 8-byte Reload
	movq	88(%rsp), %r14                  # 8-byte Reload
	leal	(%r10,%r14), %r11d
	imull	%ecx, %r11d
	movq	232(%rsp), %r10                 # 8-byte Reload
	addl	%r10d, %r14d
	movslq	%r14d, %r10
	imull	%ecx, %r14d
	movslq	%r11d, %r11
	movslq	%r14d, %r14
	xorl	%r15d, %r15d
.LBB0_8:                                #   Parent Loop BB0_4 Depth=1
                                        #     Parent Loop BB0_6 Depth=2
                                        # =>    This Loop Header: Depth=3
                                        #         Child Loop BB0_9 Depth 4
	leaq	(%r15,%r11), %r12
	movq	416(%rsp), %r13                 # 8-byte Reload
	movss	(%r13,%r12,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 132(%rsp)                # 4-byte Spill
	movss	%xmm0, 144(%rsp)
	movq	408(%rsp), %r13                 # 8-byte Reload
	movss	(%r13,%r12,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 40(%rsp)                 # 4-byte Spill
	movss	%xmm0, 148(%rsp)
	movq	400(%rsp), %r13                 # 8-byte Reload
	movss	(%r13,%r12,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 44(%rsp)                 # 4-byte Spill
	movss	%xmm0, 152(%rsp)
	movq	392(%rsp), %r13                 # 8-byte Reload
	movss	(%r13,%r12,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 48(%rsp)                 # 4-byte Spill
	movss	%xmm0, 156(%rsp)
	movq	384(%rsp), %r13                 # 8-byte Reload
	movss	(%r13,%r12,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 52(%rsp)                 # 4-byte Spill
	movss	%xmm0, 160(%rsp)
	movq	376(%rsp), %r13                 # 8-byte Reload
	movss	(%r13,%r12,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 56(%rsp)                 # 4-byte Spill
	movss	%xmm0, 164(%rsp)
	movq	368(%rsp), %r13                 # 8-byte Reload
	movss	(%r13,%r12,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 60(%rsp)                 # 4-byte Spill
	movss	%xmm0, 168(%rsp)
	movq	360(%rsp), %r13                 # 8-byte Reload
	movss	(%r13,%r12,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 64(%rsp)                 # 4-byte Spill
	movss	%xmm0, 172(%rsp)
	movq	352(%rsp), %r13                 # 8-byte Reload
	movss	(%r13,%r12,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 68(%rsp)                 # 4-byte Spill
	movss	%xmm0, 176(%rsp)
	movq	344(%rsp), %r13                 # 8-byte Reload
	movss	(%r13,%r12,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 36(%rsp)                 # 4-byte Spill
	movss	%xmm0, 180(%rsp)
	movq	336(%rsp), %r13                 # 8-byte Reload
	movss	(%r13,%r12,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 32(%rsp)                 # 4-byte Spill
	movss	%xmm0, 184(%rsp)
	movq	328(%rsp), %r13                 # 8-byte Reload
	movss	(%r13,%r12,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 20(%rsp)                 # 4-byte Spill
	movss	%xmm0, 188(%rsp)
	movss	(%rax,%r12,4), %xmm12           # xmm12 = mem[0],zero,zero,zero
	movss	%xmm12, 192(%rsp)
	movss	(%rdi,%r12,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 16(%rsp)                 # 4-byte Spill
	movss	%xmm0, 196(%rsp)
	movss	(%rdx,%r12,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 12(%rsp)                 # 4-byte Spill
	movss	%xmm0, 200(%rsp)
	movss	(%rsi,%r12,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 28(%rsp)                 # 4-byte Spill
	movss	%xmm0, 204(%rsp)
	leaq	(%r15,%r14), %r12
	movss	(%r8,%r12,4), %xmm4             # xmm4 = mem[0],zero,zero,zero
	movss	%xmm4, 208(%rsp)
	movss	(%r9,%r12,4), %xmm3             # xmm3 = mem[0],zero,zero,zero
	movss	%xmm3, 212(%rsp)
	movq	528(%rbx), %r13
	movss	(%r13,%r12,4), %xmm2            # xmm2 = mem[0],zero,zero,zero
	movss	%xmm2, 216(%rsp)
	xorl	%r13d, %r13d
	xorpd	%xmm0, %xmm0
.LBB0_9:                                # %.lr.ph.i
                                        #   Parent Loop BB0_4 Depth=1
                                        #     Parent Loop BB0_6 Depth=2
                                        #       Parent Loop BB0_8 Depth=3
                                        # =>      This Inner Loop Header: Depth=4
	xorps	%xmm1, %xmm1
	cvtss2sd	144(%rsp,%r13), %xmm1
	addsd	%xmm1, %xmm0
	addq	$4, %r13
	cmpq	$76, %r13
	jne	.LBB0_9
# %bb.10:                               # %_ZSt10accumulateIPfdET0_T_S2_S1_.exit
                                        #   in Loop: Header=BB0_8 Depth=3
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, 24(%rsp)                 # 4-byte Spill
	movq	536(%rbx), %r13
	xorps	%xmm6, %xmm6
	cmpl	$1, (%r13,%r12,4)
	xorps	%xmm11, %xmm11
	xorps	%xmm5, %xmm5
	je	.LBB0_12
# %bb.11:                               #   in Loop: Header=BB0_8 Depth=3
	movss	40(%rsp), %xmm5                 # 4-byte Reload
                                        # xmm5 = mem[0],zero,zero,zero
	movss	64(%rsp), %xmm15                # 4-byte Reload
                                        # xmm15 = mem[0],zero,zero,zero
	addss	%xmm15, %xmm5
	movss	32(%rsp), %xmm13                # 4-byte Reload
                                        # xmm13 = mem[0],zero,zero,zero
	addss	%xmm13, %xmm5
	movss	20(%rsp), %xmm10                # 4-byte Reload
                                        # xmm10 = mem[0],zero,zero,zero
	addss	%xmm10, %xmm5
	movss	12(%rsp), %xmm7                 # 4-byte Reload
                                        # xmm7 = mem[0],zero,zero,zero
	addss	%xmm7, %xmm5
	movss	48(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	movss	68(%rsp), %xmm1                 # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	addss	%xmm1, %xmm0
	movss	36(%rsp), %xmm14                # 4-byte Reload
                                        # xmm14 = mem[0],zero,zero,zero
	addss	%xmm14, %xmm0
	addss	%xmm12, %xmm0
	movss	16(%rsp), %xmm8                 # 4-byte Reload
                                        # xmm8 = mem[0],zero,zero,zero
	addss	%xmm8, %xmm0
	subss	%xmm0, %xmm5
	movss	44(%rsp), %xmm11                # 4-byte Reload
                                        # xmm11 = mem[0],zero,zero,zero
	addss	%xmm1, %xmm11
	addss	%xmm15, %xmm11
	addss	%xmm4, %xmm11
	movss	28(%rsp), %xmm1                 # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	addss	%xmm1, %xmm11
	movss	52(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	addss	%xmm14, %xmm0
	addss	%xmm13, %xmm0
	addss	%xmm3, %xmm0
	addss	%xmm2, %xmm0
	subss	%xmm0, %xmm11
	movss	56(%rsp), %xmm6                 # 4-byte Reload
                                        # xmm6 = mem[0],zero,zero,zero
	addss	%xmm8, %xmm6
	addss	%xmm7, %xmm6
	addss	%xmm1, %xmm6
	addss	%xmm2, %xmm6
	movss	60(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	addss	%xmm12, %xmm0
	addss	%xmm10, %xmm0
	addss	%xmm4, %xmm0
	addss	%xmm3, %xmm0
	subss	%xmm0, %xmm6
	movss	.LCPI0_0(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
	divss	24(%rsp), %xmm0                 # 4-byte Folded Reload
	mulss	%xmm0, %xmm5
	mulss	%xmm0, %xmm11
	mulss	%xmm0, %xmm6
.LBB0_12:                               #   in Loop: Header=BB0_8 Depth=3
	movaps	%xmm5, %xmm0
	mulss	%xmm5, %xmm0
	movaps	%xmm11, %xmm1
	mulss	%xmm11, %xmm1
	addss	%xmm0, %xmm1
	movss	%xmm2, 140(%rsp)                # 4-byte Spill
	movaps	%xmm6, %xmm2
	mulss	%xmm6, %xmm2
	addss	%xmm1, %xmm2
	xorps	%xmm1, %xmm1
	cvtss2sd	96(%rbx), %xmm1
	movaps	%xmm1, %xmm9
	addsd	%xmm1, %xmm9
	cvtss2sd	%xmm2, %xmm2
	subsd	%xmm2, %xmm9
	movss	%xmm3, 136(%rsp)                # 4-byte Spill
	movsd	.LCPI0_1(%rip), %xmm3           # xmm3 = mem[0],zero
	mulsd	%xmm3, %xmm9
	divsd	%xmm1, %xmm9
	movss	100(%rbx), %xmm1                # xmm1 = mem[0],zero,zero,zero
	movaps	%xmm1, %xmm2
	mulss	.LCPI0_3(%rip), %xmm2
	movss	%xmm2, 112(%rsp)                # 4-byte Spill
	cvtss2sd	%xmm2, %xmm2
	movaps	%xmm2, %xmm0
	mulsd	%xmm3, %xmm0
	mulsd	%xmm2, %xmm0
	movsd	%xmm0, 448(%rsp)                # 8-byte Spill
	movaps	%xmm1, %xmm2
	mulss	%xmm5, %xmm2
	movss	%xmm2, 116(%rsp)                # 4-byte Spill
	cvtss2sd	%xmm2, %xmm2
	movaps	%xmm2, %xmm7
	mulsd	%xmm3, %xmm7
	mulsd	%xmm2, %xmm7
	movsd	%xmm7, 472(%rsp)                # 8-byte Spill
	movaps	%xmm1, %xmm2
	mulss	%xmm11, %xmm2
	movss	%xmm2, 120(%rsp)                # 4-byte Spill
	cvtss2sd	%xmm2, %xmm2
	movaps	%xmm2, %xmm7
	mulsd	%xmm3, %xmm7
	mulsd	%xmm2, %xmm7
	movsd	%xmm7, 488(%rsp)                # 8-byte Spill
	movss	%xmm12, 124(%rsp)               # 4-byte Spill
	movaps	%xmm5, %xmm0
	movaps	.LCPI0_2(%rip), %xmm2           # xmm2 = [-0.0E+0,-0.0E+0,-0.0E+0,-0.0E+0]
	movss	%xmm4, 128(%rsp)                # 4-byte Spill
	movaps	%xmm2, %xmm4
	xorps	%xmm2, %xmm0
	movaps	%xmm0, %xmm13
	movaps	%xmm0, %xmm14
	mulss	%xmm1, %xmm0
	movaps	%xmm0, 736(%rsp)                # 16-byte Spill
	xorps	%xmm2, %xmm2
	cvtss2sd	%xmm0, %xmm2
	movaps	%xmm2, %xmm7
	mulsd	%xmm3, %xmm7
	mulsd	%xmm2, %xmm7
	movsd	%xmm7, 480(%rsp)                # 8-byte Spill
	movaps	%xmm11, %xmm2
	xorps	%xmm4, %xmm2
	mulss	%xmm1, %xmm2
	movaps	%xmm2, 768(%rsp)                # 16-byte Spill
	cvtss2sd	%xmm2, %xmm2
	movaps	%xmm2, %xmm7
	mulsd	%xmm3, %xmm7
	mulsd	%xmm2, %xmm7
	movsd	%xmm7, 504(%rsp)                # 8-byte Spill
	movaps	%xmm6, %xmm7
	xorps	%xmm4, %xmm7
	movaps	%xmm7, %xmm2
	mulss	%xmm1, %xmm7
	movaps	%xmm7, 640(%rsp)                # 16-byte Spill
	movaps	%xmm11, %xmm8
	addss	%xmm5, %xmm8
	mulss	%xmm1, %xmm8
	movaps	%xmm8, 656(%rsp)                # 16-byte Spill
	movaps	%xmm11, %xmm0
	subss	%xmm5, %xmm0
	mulss	%xmm1, %xmm0
	movaps	%xmm0, 672(%rsp)                # 16-byte Spill
	subss	%xmm11, %xmm13
	mulss	%xmm1, %xmm13
	movaps	%xmm13, %xmm15
	movaps	%xmm13, 688(%rsp)               # 16-byte Spill
	movaps	%xmm5, %xmm4
	subss	%xmm11, %xmm4
	mulss	%xmm1, %xmm4
	movaps	%xmm4, 512(%rsp)                # 16-byte Spill
	movaps	%xmm5, %xmm4
	subss	%xmm6, %xmm4
	mulss	%xmm1, %xmm4
	movaps	%xmm4, 528(%rsp)                # 16-byte Spill
	subss	%xmm6, %xmm14
	mulss	%xmm1, %xmm14
	movaps	%xmm14, 544(%rsp)               # 16-byte Spill
	movaps	%xmm6, %xmm4
	subss	%xmm5, %xmm4
	mulss	%xmm1, %xmm4
	movaps	%xmm4, 560(%rsp)                # 16-byte Spill
	movaps	%xmm6, %xmm4
	movaps	%xmm5, 624(%rsp)                # 16-byte Spill
	addss	%xmm5, %xmm4
	mulss	%xmm1, %xmm4
	movaps	%xmm4, 576(%rsp)                # 16-byte Spill
	movaps	%xmm6, %xmm12
	addss	%xmm11, %xmm12
	mulss	%xmm1, %xmm12
	movaps	%xmm12, 704(%rsp)               # 16-byte Spill
	movaps	%xmm11, %xmm10
	subss	%xmm6, %xmm10
	mulss	%xmm1, %xmm10
	movaps	%xmm10, 720(%rsp)               # 16-byte Spill
	subss	%xmm11, %xmm2
	mulss	%xmm1, %xmm2
	movaps	%xmm11, %xmm4
	movaps	%xmm2, %xmm11
	movaps	%xmm2, 752(%rsp)                # 16-byte Spill
	movaps	%xmm6, %xmm2
	movaps	%xmm4, 592(%rsp)                # 16-byte Spill
	subss	%xmm4, %xmm2
	mulss	%xmm1, %xmm2
	movaps	%xmm6, %xmm4
	movaps	%xmm2, %xmm6
	movaps	%xmm2, 784(%rsp)                # 16-byte Spill
	movaps	%xmm4, 608(%rsp)                # 16-byte Spill
	mulss	%xmm4, %xmm1
	xorps	%xmm2, %xmm2
	cvtss2sd	%xmm1, %xmm2
	movaps	%xmm2, %xmm5
	mulsd	%xmm3, %xmm5
	mulsd	%xmm2, %xmm5
	xorps	%xmm2, %xmm2
	cvtss2sd	%xmm7, %xmm2
	movaps	%xmm2, %xmm7
	mulsd	%xmm3, %xmm7
	mulsd	%xmm2, %xmm7
	xorps	%xmm2, %xmm2
	cvtss2sd	%xmm8, %xmm2
	movaps	%xmm2, %xmm8
	mulsd	%xmm3, %xmm8
	mulsd	%xmm2, %xmm8
	xorps	%xmm2, %xmm2
	cvtss2sd	%xmm0, %xmm2
	movaps	%xmm2, %xmm13
	mulsd	%xmm3, %xmm13
	mulsd	%xmm2, %xmm13
	xorps	%xmm2, %xmm2
	cvtss2sd	%xmm15, %xmm2
	movaps	%xmm2, %xmm14
	mulsd	%xmm3, %xmm14
	mulsd	%xmm2, %xmm14
	xorps	%xmm2, %xmm2
	cvtss2sd	512(%rsp), %xmm2                # 16-byte Folded Reload
	movaps	%xmm2, %xmm15
	mulsd	%xmm3, %xmm15
	mulsd	%xmm2, %xmm15
	xorps	%xmm2, %xmm2
	cvtss2sd	528(%rsp), %xmm2                # 16-byte Folded Reload
	movaps	%xmm2, %xmm0
	mulsd	%xmm3, %xmm0
	mulsd	%xmm2, %xmm0
	movsd	%xmm0, 424(%rsp)                # 8-byte Spill
	xorps	%xmm4, %xmm4
	cvtss2sd	544(%rsp), %xmm4                # 16-byte Folded Reload
	movaps	%xmm4, %xmm2
	mulsd	%xmm3, %xmm2
	mulsd	%xmm4, %xmm2
	xorps	%xmm4, %xmm4
	cvtss2sd	560(%rsp), %xmm4                # 16-byte Folded Reload
	movaps	%xmm4, %xmm0
	mulsd	%xmm3, %xmm0
	mulsd	%xmm4, %xmm0
	movsd	%xmm0, 432(%rsp)                # 8-byte Spill
	xorps	%xmm4, %xmm4
	cvtss2sd	576(%rsp), %xmm4                # 16-byte Folded Reload
	movaps	%xmm4, %xmm0
	mulsd	%xmm3, %xmm0
	mulsd	%xmm4, %xmm0
	movsd	%xmm0, 440(%rsp)                # 8-byte Spill
	xorps	%xmm0, %xmm0
	cvtss2sd	%xmm12, %xmm0
	movaps	%xmm0, %xmm12
	mulsd	%xmm3, %xmm12
	mulsd	%xmm0, %xmm12
	xorps	%xmm0, %xmm0
	cvtss2sd	%xmm10, %xmm0
	movaps	%xmm0, %xmm4
	mulsd	%xmm3, %xmm4
	mulsd	%xmm0, %xmm4
	movsd	%xmm4, 456(%rsp)                # 8-byte Spill
	xorps	%xmm4, %xmm4
	cvtss2sd	%xmm11, %xmm4
	movaps	%xmm4, %xmm11
	mulsd	%xmm3, %xmm11
	mulsd	%xmm4, %xmm11
	movsd	%xmm11, 464(%rsp)               # 8-byte Spill
	xorps	%xmm4, %xmm4
	cvtss2sd	%xmm6, %xmm4
	movaps	%xmm4, %xmm6
	mulsd	%xmm3, %xmm6
	mulsd	%xmm4, %xmm6
	movsd	%xmm6, 496(%rsp)                # 8-byte Spill
	xorps	%xmm4, %xmm4
	cvtsd2ss	448(%rsp), %xmm4                # 8-byte Folded Reload
	xorps	%xmm0, %xmm0
	cvtsd2ss	%xmm9, %xmm0
	addss	112(%rsp), %xmm4                # 4-byte Folded Reload
	movss	104(%rsp), %xmm3                # 4-byte Reload
                                        # xmm3 = mem[0],zero,zero,zero
	movss	24(%rsp), %xmm11                # 4-byte Reload
                                        # xmm11 = mem[0],zero,zero,zero
	mulss	%xmm11, %xmm3
	addss	%xmm0, %xmm4
	mulss	%xmm3, %xmm4
	movss	132(%rsp), %xmm3                # 4-byte Reload
                                        # xmm3 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm3
	addss	%xmm3, %xmm4
	movq	320(%rsp), %r13                 # 8-byte Reload
	movss	%xmm4, (%r13,%r12,4)
	xorps	%xmm3, %xmm3
	cvtsd2ss	472(%rsp), %xmm3                # 8-byte Folded Reload
	addss	116(%rsp), %xmm3                # 4-byte Folded Reload
	movss	100(%rsp), %xmm4                # 4-byte Reload
                                        # xmm4 = mem[0],zero,zero,zero
	mulss	%xmm11, %xmm4
	movss	40(%rsp), %xmm6                 # 4-byte Reload
                                        # xmm6 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm6
	addss	%xmm0, %xmm3
	mulss	%xmm4, %xmm3
	addss	%xmm6, %xmm3
	movq	312(%rsp), %r13                 # 8-byte Reload
	movss	%xmm3, (%r13,%r12,4)
	xorps	%xmm3, %xmm3
	cvtsd2ss	488(%rsp), %xmm3                # 8-byte Folded Reload
	movaps	%xmm11, %xmm6
	movss	44(%rsp), %xmm11                # 4-byte Reload
                                        # xmm11 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm11
	addss	120(%rsp), %xmm3                # 4-byte Folded Reload
	addss	%xmm0, %xmm3
	mulss	%xmm4, %xmm3
	addss	%xmm11, %xmm3
	movq	304(%rsp), %r13                 # 8-byte Reload
	movss	%xmm3, (%r13,%r12,4)
	xorps	%xmm3, %xmm3
	cvtsd2ss	480(%rsp), %xmm3                # 8-byte Folded Reload
	addss	736(%rsp), %xmm3                # 16-byte Folded Reload
	movss	48(%rsp), %xmm9                 # 4-byte Reload
                                        # xmm9 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm9
	addss	%xmm0, %xmm3
	mulss	%xmm4, %xmm3
	addss	%xmm9, %xmm3
	movq	296(%rsp), %r13                 # 8-byte Reload
	movss	%xmm3, (%r13,%r12,4)
	xorps	%xmm3, %xmm3
	cvtsd2ss	504(%rsp), %xmm3                # 8-byte Folded Reload
	addss	768(%rsp), %xmm3                # 16-byte Folded Reload
	movss	52(%rsp), %xmm9                 # 4-byte Reload
                                        # xmm9 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm9
	addss	%xmm0, %xmm3
	mulss	%xmm4, %xmm3
	addss	%xmm9, %xmm3
	cvtsd2ss	%xmm5, %xmm5
	movq	288(%rsp), %r13                 # 8-byte Reload
	movss	%xmm3, (%r13,%r12,4)
	addss	%xmm1, %xmm5
	movss	56(%rsp), %xmm1                 # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm1
	addss	%xmm0, %xmm5
	mulss	%xmm4, %xmm5
	addss	%xmm1, %xmm5
	movq	280(%rsp), %r13                 # 8-byte Reload
	movss	%xmm5, (%r13,%r12,4)
	xorps	%xmm1, %xmm1
	cvtsd2ss	%xmm7, %xmm1
	addss	640(%rsp), %xmm1                # 16-byte Folded Reload
	addss	%xmm0, %xmm1
	mulss	%xmm4, %xmm1
	movss	60(%rsp), %xmm3                 # 4-byte Reload
                                        # xmm3 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm3
	addss	%xmm3, %xmm1
	movq	272(%rsp), %r13                 # 8-byte Reload
	movss	%xmm1, (%r13,%r12,4)
	xorps	%xmm1, %xmm1
	cvtsd2ss	%xmm8, %xmm1
	addss	656(%rsp), %xmm1                # 16-byte Folded Reload
	mulss	108(%rsp), %xmm6                # 4-byte Folded Reload
	movss	64(%rsp), %xmm3                 # 4-byte Reload
                                        # xmm3 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm3
	addss	%xmm0, %xmm1
	mulss	%xmm6, %xmm1
	addss	%xmm3, %xmm1
	xorps	%xmm3, %xmm3
	cvtsd2ss	%xmm13, %xmm3
	movq	264(%rsp), %r13                 # 8-byte Reload
	movss	%xmm1, (%r13,%r12,4)
	addss	672(%rsp), %xmm3                # 16-byte Folded Reload
	movss	68(%rsp), %xmm1                 # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm1
	addss	%xmm0, %xmm3
	mulss	%xmm6, %xmm3
	addss	%xmm1, %xmm3
	movq	256(%rsp), %r13                 # 8-byte Reload
	movss	%xmm3, (%r13,%r12,4)
	xorps	%xmm1, %xmm1
	cvtsd2ss	%xmm14, %xmm1
	movss	36(%rsp), %xmm3                 # 4-byte Reload
                                        # xmm3 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm3
	addss	688(%rsp), %xmm1                # 16-byte Folded Reload
	addss	%xmm0, %xmm1
	mulss	%xmm6, %xmm1
	addss	%xmm3, %xmm1
	movss	%xmm1, (%rbp,%r12,4)
	xorps	%xmm1, %xmm1
	cvtsd2ss	%xmm15, %xmm1
	addss	512(%rsp), %xmm1                # 16-byte Folded Reload
	movss	32(%rsp), %xmm3                 # 4-byte Reload
                                        # xmm3 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm3
	addss	%xmm0, %xmm1
	mulss	%xmm6, %xmm1
	addss	%xmm3, %xmm1
	xorps	%xmm3, %xmm3
	cvtsd2ss	424(%rsp), %xmm3                # 8-byte Folded Reload
	movq	296(%rbx), %r13
	movss	%xmm1, (%r13,%r12,4)
	addss	528(%rsp), %xmm3                # 16-byte Folded Reload
	movss	20(%rsp), %xmm1                 # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm1
	addss	%xmm0, %xmm3
	mulss	%xmm6, %xmm3
	addss	%xmm1, %xmm3
	movq	304(%rbx), %r13
	movss	%xmm3, (%r13,%r12,4)
	xorps	%xmm1, %xmm1
	cvtsd2ss	%xmm2, %xmm1
	addss	544(%rsp), %xmm1                # 16-byte Folded Reload
	movss	124(%rsp), %xmm2                # 4-byte Reload
                                        # xmm2 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm2
	addss	%xmm0, %xmm1
	mulss	%xmm6, %xmm1
	addss	%xmm2, %xmm1
	xorps	%xmm2, %xmm2
	cvtsd2ss	432(%rsp), %xmm2                # 8-byte Folded Reload
	movq	312(%rbx), %r13
	movss	%xmm1, (%r13,%r12,4)
	addss	560(%rsp), %xmm2                # 16-byte Folded Reload
	movss	16(%rsp), %xmm1                 # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm1
	addss	%xmm0, %xmm2
	mulss	%xmm6, %xmm2
	addss	%xmm1, %xmm2
	movq	320(%rbx), %r13
	movss	%xmm2, (%r13,%r12,4)
	xorps	%xmm1, %xmm1
	cvtsd2ss	440(%rsp), %xmm1                # 8-byte Folded Reload
	addss	576(%rsp), %xmm1                # 16-byte Folded Reload
	movss	12(%rsp), %xmm2                 # 4-byte Reload
                                        # xmm2 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm2
	addss	%xmm0, %xmm1
	mulss	%xmm6, %xmm1
	addss	%xmm2, %xmm1
	xorps	%xmm2, %xmm2
	cvtsd2ss	%xmm12, %xmm2
	movq	328(%rbx), %r13
	movss	%xmm1, (%r13,%r12,4)
	addss	704(%rsp), %xmm2                # 16-byte Folded Reload
	movss	28(%rsp), %xmm1                 # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm1
	addss	%xmm0, %xmm2
	mulss	%xmm6, %xmm2
	addss	%xmm1, %xmm2
	movq	336(%rbx), %r13
	movss	%xmm2, (%r13,%r12,4)
	xorps	%xmm1, %xmm1
	cvtsd2ss	456(%rsp), %xmm1                # 8-byte Folded Reload
	addss	720(%rsp), %xmm1                # 16-byte Folded Reload
	movss	128(%rsp), %xmm2                # 4-byte Reload
                                        # xmm2 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm2
	addss	%xmm0, %xmm1
	mulss	%xmm6, %xmm1
	addss	%xmm2, %xmm1
	xorps	%xmm2, %xmm2
	cvtsd2ss	464(%rsp), %xmm2                # 8-byte Folded Reload
	movq	344(%rbx), %r13
	movss	%xmm1, (%r13,%r12,4)
	addss	752(%rsp), %xmm2                # 16-byte Folded Reload
	movss	136(%rsp), %xmm1                # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm1
	addss	%xmm0, %xmm2
	mulss	%xmm6, %xmm2
	addss	%xmm1, %xmm2
	movq	352(%rbx), %r13
	movss	%xmm2, (%r13,%r12,4)
	xorps	%xmm1, %xmm1
	cvtsd2ss	496(%rsp), %xmm1                # 8-byte Folded Reload
	addss	784(%rsp), %xmm1                # 16-byte Folded Reload
	addss	%xmm0, %xmm1
	mulss	%xmm6, %xmm1
	movss	140(%rsp), %xmm0                # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	mulss	176(%rbx), %xmm0
	addss	%xmm0, %xmm1
	movq	360(%rbx), %r13
	movss	%xmm1, (%r13,%r12,4)
	cmpq	248(%rsp), %r15                 # 8-byte Folded Reload
	jne	.LBB0_14
# %bb.13:                               #   in Loop: Header=BB0_8 Depth=3
	movq	568(%rbx), %r12
	movaps	624(%rsp), %xmm0                # 16-byte Reload
	movss	%xmm0, (%r12,%r10,4)
	movq	576(%rbx), %r12
	movaps	592(%rsp), %xmm2                # 16-byte Reload
	movss	%xmm2, (%r12,%r10,4)
	movq	584(%rbx), %r12
	movaps	608(%rsp), %xmm1                # 16-byte Reload
	movss	%xmm1, (%r12,%r10,4)
	movq	544(%rbx), %r12
	movss	%xmm0, (%r12,%r10,4)
	movq	552(%rbx), %r12
	movss	%xmm2, (%r12,%r10,4)
	movq	560(%rbx), %r12
	movss	%xmm1, (%r12,%r10,4)
.LBB0_14:                               #   in Loop: Header=BB0_8 Depth=3
	incq	%r15
	cmpq	%rcx, %r15
	jne	.LBB0_8
.LBB0_15:                               # %._crit_edge
                                        #   in Loop: Header=BB0_6 Depth=2
	movq	88(%rsp), %r11                  # 8-byte Reload
	incq	%r11
	movq	%r11, %r10
	movq	%r11, 88(%rsp)                  # 8-byte Spill
	cmpq	80(%rsp), %r11                  # 8-byte Folded Reload
	jne	.LBB0_6
.LBB0_16:                               # %._crit_edge245
                                        #   in Loop: Header=BB0_4 Depth=1
	movq	72(%rsp), %rdx                  # 8-byte Reload
	incq	%rdx
	movq	%rdx, %rax
	movq	%rdx, 72(%rsp)                  # 8-byte Spill
	cmpq	224(%rsp), %rdx                 # 8-byte Folded Reload
	jne	.LBB0_4
.LBB0_17:                               # %._crit_edge247
	addq	$808, %rsp                      # imm = 0x328
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_ZN3LBM10relaxationEv, .Lfunc_end0-_ZN3LBM10relaxationEv
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _ZN3LBM18initial_relaxationEv
.LCPI1_0:
	.quad	0x4008000000000000              # double 3
.LCPI1_1:
	.quad	0x3fe0000000000000              # double 0.5
.LCPI1_4:
	.quad	0x3ff0000000000000              # double 1
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0
.LCPI1_2:
	.long	0x3f800000                      # float 1
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0
.LCPI1_3:
	.long	0x80000000                      # float -0
	.long	0x80000000                      # float -0
	.long	0x80000000                      # float -0
	.long	0x80000000                      # float -0
	.text
	.globl	_ZN3LBM18initial_relaxationEv
	.p2align	1, 0x90
	.type	_ZN3LBM18initial_relaxationEv,@function
_ZN3LBM18initial_relaxationEv:          # @_ZN3LBM18initial_relaxationEv
	.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	$456, %rsp                      # imm = 0x1C8
	.cfi_def_cfa_offset 512
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	36(%rdi), %eax
	movq	%rax, 184(%rsp)                 # 8-byte Spill
	testl	%eax, %eax
	jle	.LBB1_17
# %bb.1:                                # %.preheader449.lr.ph
	cvtss2sd	64(%rdi), %xmm0
	mulsd	.LCPI1_0(%rip), %xmm0
	addsd	.LCPI1_1(%rip), %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	.LCPI1_2(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	divss	%xmm0, %xmm1
	movss	%xmm1, -76(%rsp)                # 4-byte Spill
	movl	28(%rdi), %eax
	movl	32(%rdi), %ecx
	movq	%rcx, -104(%rsp)                # 8-byte Spill
	movq	%rax, -88(%rsp)                 # 8-byte Spill
	addl	$-2, %eax
	movq	%rax, 272(%rsp)                 # 8-byte Spill
	xorl	%eax, %eax
	movq	%rax, -112(%rsp)                # 8-byte Spill
	movsd	.LCPI1_4(%rip), %xmm2           # xmm2 = mem[0],zero
	movq	%rdi, -128(%rsp)                # 8-byte Spill
.LBB1_2:                                # %.preheader449
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_4 Depth 2
                                        #       Child Loop BB1_6 Depth 3
                                        #         Child Loop BB1_9 Depth 4
                                        #         Child Loop BB1_11 Depth 4
	cmpl	$0, -104(%rsp)                  # 4-byte Folded Reload
	jle	.LBB1_16
# %bb.3:                                # %.preheader448.lr.ph
                                        #   in Loop: Header=BB1_2 Depth=1
	movq	384(%rdi), %rax
	movq	%rax, 440(%rsp)                 # 8-byte Spill
	movq	392(%rdi), %rax
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	movq	400(%rdi), %rax
	movq	%rax, (%rsp)                    # 8-byte Spill
	movq	408(%rdi), %rax
	movq	%rax, -8(%rsp)                  # 8-byte Spill
	movq	416(%rdi), %rax
	movq	%rax, -16(%rsp)                 # 8-byte Spill
	movq	424(%rdi), %rax
	movq	%rax, -24(%rsp)                 # 8-byte Spill
	movq	432(%rdi), %rax
	movq	%rax, -32(%rsp)                 # 8-byte Spill
	movq	440(%rdi), %rax
	movq	%rax, -40(%rsp)                 # 8-byte Spill
	movq	448(%rdi), %rax
	movq	%rax, -48(%rsp)                 # 8-byte Spill
	movq	456(%rdi), %rax
	movq	464(%rdi), %r8
	movq	472(%rdi), %rdx
	movq	480(%rdi), %rsi
	movq	488(%rdi), %r9
	movq	-104(%rsp), %rcx                # 8-byte Reload
                                        # kill: def $ecx killed $ecx killed $rcx def $rcx
	imull	-112(%rsp), %ecx                # 4-byte Folded Reload
	movq	%rcx, 192(%rsp)                 # 8-byte Spill
	movq	496(%rdi), %rcx
	movq	504(%rdi), %r10
	movq	512(%rdi), %r11
	movq	520(%rdi), %rbx
	movq	528(%rdi), %r14
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	536(%rdi), %r15
	movq	%r15, 432(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	216(%rdi), %r15
	movq	%r15, 424(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	224(%rdi), %r15
	movq	%r15, 416(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	232(%rdi), %r15
	movq	%r15, 408(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	240(%rdi), %r15
	movq	%r15, 400(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	248(%rdi), %r15
	movq	%r15, 392(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	256(%rdi), %r15
	movq	%r15, 384(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	264(%rdi), %r15
	movq	%r15, 376(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	272(%rdi), %r15
	movq	%r15, 368(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	280(%rdi), %r15
	movq	%r15, 360(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	288(%rdi), %r15
	movq	%r15, 352(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	296(%rdi), %r15
	movq	%r15, 344(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	304(%rdi), %r15
	movq	%r15, 336(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	312(%rdi), %r15
	movq	%r15, 328(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	320(%rdi), %r15
	movq	%r15, 320(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	328(%rdi), %r15
	movq	%r15, 312(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	336(%rdi), %r15
	movq	%r15, 304(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	344(%rdi), %r15
	movq	%r15, 296(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	352(%rdi), %r15
	movq	%r15, 288(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	360(%rdi), %r15
	movq	%r15, 280(%rsp)                 # 8-byte Spill
	xorl	%r15d, %r15d
	movq	%r15, -96(%rsp)                 # 8-byte Spill
.LBB1_4:                                # %.preheader448
                                        #   Parent Loop BB1_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB1_6 Depth 3
                                        #         Child Loop BB1_9 Depth 4
                                        #         Child Loop BB1_11 Depth 4
	cmpl	$0, -88(%rsp)                   # 4-byte Folded Reload
	jle	.LBB1_15
# %bb.5:                                # %.lr.ph
                                        #   in Loop: Header=BB1_4 Depth=2
	movq	192(%rsp), %r15                 # 8-byte Reload
	movq	-96(%rsp), %r12                 # 8-byte Reload
	leal	(%r15,%r12), %ebp
	movq	-88(%rsp), %r15                 # 8-byte Reload
	movl	%r15d, %r12d
	imull	%ebp, %r12d
	movq	-128(%rsp), %rdi                # 8-byte Reload
	movq	568(%rdi), %r15
	movq	%r15, 264(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %r15                # 8-byte Reload
	movslq	%ebp, %rdi
	movq	576(%r15), %r13
	movq	%r13, 256(%rsp)                 # 8-byte Spill
	movq	584(%r15), %r13
	movq	%r13, 248(%rsp)                 # 8-byte Spill
	movq	544(%r15), %r13
	movq	%r13, 240(%rsp)                 # 8-byte Spill
	movq	552(%r15), %r13
	movq	%r13, 232(%rsp)                 # 8-byte Spill
	movq	560(%r15), %r13
	movq	%r13, 224(%rsp)                 # 8-byte Spill
	movq	592(%r15), %r13
	movq	%r13, 216(%rsp)                 # 8-byte Spill
	movq	600(%r15), %r13
	movq	%r13, 208(%rsp)                 # 8-byte Spill
	movq	608(%r15), %r13
	movq	%r13, 200(%rsp)                 # 8-byte Spill
	movslq	%r12d, %r12
	movq	%r12, 448(%rsp)                 # 8-byte Spill
	xorl	%r12d, %r12d
.LBB1_6:                                #   Parent Loop BB1_2 Depth=1
                                        #     Parent Loop BB1_4 Depth=2
                                        # =>    This Loop Header: Depth=3
                                        #         Child Loop BB1_9 Depth 4
                                        #         Child Loop BB1_11 Depth 4
	movq	448(%rsp), %r13                 # 8-byte Reload
	addq	%r12, %r13
	movq	440(%rsp), %rbp                 # 8-byte Reload
	movss	(%rbp,%r13,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	movq	8(%rsp), %rbp                   # 8-byte Reload
	movss	(%rbp,%r13,4), %xmm8            # xmm8 = mem[0],zero,zero,zero
	movss	%xmm1, -52(%rsp)                # 4-byte Spill
	addss	%xmm8, %xmm1
	movq	(%rsp), %rbp                    # 8-byte Reload
	movss	(%rbp,%r13,4), %xmm9            # xmm9 = mem[0],zero,zero,zero
	addss	%xmm9, %xmm1
	movq	-8(%rsp), %rbp                  # 8-byte Reload
	movss	(%rbp,%r13,4), %xmm15           # xmm15 = mem[0],zero,zero,zero
	addss	%xmm15, %xmm1
	xorps	%xmm14, %xmm14
	addss	%xmm14, %xmm1
	movq	-16(%rsp), %rbp                 # 8-byte Reload
	movss	(%rbp,%r13,4), %xmm12           # xmm12 = mem[0],zero,zero,zero
	movq	-24(%rsp), %rbp                 # 8-byte Reload
	movss	(%rbp,%r13,4), %xmm10           # xmm10 = mem[0],zero,zero,zero
	movaps	%xmm12, %xmm4
	addss	%xmm10, %xmm4
	movq	-32(%rsp), %rbp                 # 8-byte Reload
	movss	(%rbp,%r13,4), %xmm11           # xmm11 = mem[0],zero,zero,zero
	addss	%xmm11, %xmm4
	movq	-40(%rsp), %rbp                 # 8-byte Reload
	movss	(%rbp,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, -72(%rsp)                # 4-byte Spill
	addss	%xmm0, %xmm4
	addss	%xmm1, %xmm4
	movq	-48(%rsp), %rbp                 # 8-byte Reload
	movss	(%rbp,%r13,4), %xmm13           # xmm13 = mem[0],zero,zero,zero
	movss	(%rax,%r13,4), %xmm3            # xmm3 = mem[0],zero,zero,zero
	movaps	%xmm13, %xmm5
	addss	%xmm3, %xmm5
	movss	(%r8,%r13,4), %xmm6             # xmm6 = mem[0],zero,zero,zero
	addss	%xmm6, %xmm5
	movss	(%rdx,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, -116(%rsp)               # 4-byte Spill
	addss	%xmm0, %xmm5
	addss	%xmm4, %xmm5
	movss	(%rsi,%r13,4), %xmm4            # xmm4 = mem[0],zero,zero,zero
	movss	(%r9,%r13,4), %xmm0             # xmm0 = mem[0],zero,zero,zero
	movss	%xmm4, -56(%rsp)                # 4-byte Spill
	movss	%xmm0, -68(%rsp)                # 4-byte Spill
	addss	%xmm0, %xmm4
	movss	(%rcx,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, -120(%rsp)               # 4-byte Spill
	addss	%xmm0, %xmm4
	movss	(%r10,%r13,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	addss	%xmm1, %xmm4
	addss	%xmm5, %xmm4
	movss	(%r11,%r13,4), %xmm7            # xmm7 = mem[0],zero,zero,zero
	movss	(%rbx,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm7, -64(%rsp)                # 4-byte Spill
	movss	%xmm0, -60(%rsp)                # 4-byte Spill
	addss	%xmm0, %xmm7
	movss	(%r14,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	addss	%xmm0, %xmm7
	addss	%xmm4, %xmm7
	movq	432(%rsp), %rbp                 # 8-byte Reload
	cmpl	$1, (%rbp,%r13,4)
	xorps	%xmm4, %xmm4
	xorps	%xmm5, %xmm5
	je	.LBB1_8
# %bb.7:                                #   in Loop: Header=BB1_6 Depth=3
	movss	-72(%rsp), %xmm4                # 4-byte Reload
                                        # xmm4 = mem[0],zero,zero,zero
	addss	%xmm4, %xmm8
	addss	%xmm6, %xmm8
	addss	-116(%rsp), %xmm8               # 4-byte Folded Reload
	addss	-120(%rsp), %xmm8               # 4-byte Folded Reload
	addss	%xmm13, %xmm15
	addss	%xmm3, %xmm15
	movss	-56(%rsp), %xmm5                # 4-byte Reload
                                        # xmm5 = mem[0],zero,zero,zero
	addss	%xmm5, %xmm15
	movss	-68(%rsp), %xmm14               # 4-byte Reload
                                        # xmm14 = mem[0],zero,zero,zero
	addss	%xmm14, %xmm15
	subss	%xmm15, %xmm8
	addss	%xmm13, %xmm9
	addss	%xmm4, %xmm9
	addss	%xmm3, %xmm12
	addss	%xmm6, %xmm12
	movss	-64(%rsp), %xmm6                # 4-byte Reload
                                        # xmm6 = mem[0],zero,zero,zero
	addss	%xmm6, %xmm9
	addss	%xmm1, %xmm9
	movss	-60(%rsp), %xmm3                # 4-byte Reload
                                        # xmm3 = mem[0],zero,zero,zero
	addss	%xmm3, %xmm12
	addss	%xmm0, %xmm12
	subss	%xmm12, %xmm9
	addss	%xmm14, %xmm10
	addss	-120(%rsp), %xmm10              # 4-byte Folded Reload
	addss	%xmm1, %xmm10
	addss	%xmm0, %xmm10
	addss	%xmm5, %xmm11
	addss	-116(%rsp), %xmm11              # 4-byte Folded Reload
	addss	%xmm6, %xmm11
	addss	%xmm3, %xmm11
	subss	%xmm11, %xmm10
	divss	%xmm7, %xmm8
	divss	%xmm7, %xmm9
	divss	%xmm7, %xmm10
	movaps	%xmm8, %xmm14
	movaps	%xmm9, %xmm4
	movaps	%xmm10, %xmm5
.LBB1_8:                                #   in Loop: Header=BB1_6 Depth=3
	movaps	%xmm14, %xmm0
	mulss	%xmm14, %xmm0
	movaps	%xmm4, %xmm1
	mulss	%xmm4, %xmm1
	addss	%xmm0, %xmm1
	movaps	%xmm5, %xmm0
	mulss	%xmm5, %xmm0
	addss	%xmm1, %xmm0
	movss	%xmm14, 100(%rsp)
	movss	%xmm4, 104(%rsp)
	movaps	%xmm14, %xmm3
	movaps	.LCPI1_3(%rip), %xmm6           # xmm6 = [-0.0E+0,-0.0E+0,-0.0E+0,-0.0E+0]
	xorps	%xmm6, %xmm3
	movss	%xmm3, 108(%rsp)
	movaps	%xmm4, %xmm1
	xorps	%xmm6, %xmm1
	movss	%xmm1, 112(%rsp)
	movss	%xmm5, 116(%rsp)
	movaps	%xmm5, %xmm1
	xorps	%xmm6, %xmm1
	movss	%xmm1, 120(%rsp)
	movaps	%xmm14, %xmm6
	addss	%xmm4, %xmm6
	movss	%xmm6, 124(%rsp)
	movaps	%xmm4, %xmm6
	subss	%xmm14, %xmm6
	movss	%xmm6, 128(%rsp)
	movaps	%xmm3, %xmm6
	subss	%xmm4, %xmm6
	movss	%xmm6, 132(%rsp)
	movaps	%xmm14, %xmm6
	subss	%xmm4, %xmm6
	movss	%xmm6, 136(%rsp)
	movaps	%xmm14, %xmm6
	subss	%xmm5, %xmm6
	movss	%xmm6, 140(%rsp)
	subss	%xmm5, %xmm3
	movss	%xmm3, 144(%rsp)
	movaps	%xmm5, %xmm3
	subss	%xmm14, %xmm3
	movss	%xmm3, 148(%rsp)
	movaps	%xmm14, %xmm3
	addss	%xmm5, %xmm3
	movss	%xmm3, 152(%rsp)
	movaps	%xmm4, %xmm3
	addss	%xmm5, %xmm3
	movss	%xmm3, 156(%rsp)
	movaps	%xmm4, %xmm3
	subss	%xmm5, %xmm3
	movss	%xmm3, 160(%rsp)
	subss	%xmm4, %xmm1
	movss	%xmm1, 164(%rsp)
	movaps	%xmm5, %xmm1
	subss	%xmm4, %xmm1
	movss	%xmm1, 168(%rsp)
	movss	84(%r15), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	mulss	%xmm7, %xmm1
	cvtss2sd	%xmm1, %xmm1
	cvtss2sd	%xmm0, %xmm8
	movss	96(%r15), %xmm9                 # xmm9 = mem[0],zero,zero,zero
	xorps	%xmm3, %xmm3
	cvtss2sd	%xmm9, %xmm3
	movaps	%xmm3, %xmm10
	addsd	%xmm3, %xmm10
	divsd	%xmm10, %xmm8
	movapd	%xmm2, %xmm11
	subsd	%xmm8, %xmm11
	mulsd	%xmm1, %xmm11
	movss	88(%r15), %xmm0                 # xmm0 = mem[0],zero,zero,zero
	mulss	%xmm7, %xmm0
	cvtss2sd	%xmm0, %xmm0
	mulsd	%xmm3, %xmm10
	movl	$1, %ebp
.LBB1_9:                                #   Parent Loop BB1_2 Depth=1
                                        #     Parent Loop BB1_4 Depth=2
                                        #       Parent Loop BB1_6 Depth=3
                                        # =>      This Inner Loop Header: Depth=4
	movss	96(%rsp,%rbp,4), %xmm1          # xmm1 = mem[0],zero,zero,zero
	movaps	%xmm1, %xmm3
	divss	%xmm9, %xmm3
	cvtss2sd	%xmm3, %xmm3
	addsd	%xmm2, %xmm3
	mulss	%xmm1, %xmm1
	cvtss2sd	%xmm1, %xmm1
	divsd	%xmm10, %xmm1
	addsd	%xmm3, %xmm1
	subsd	%xmm8, %xmm1
	mulsd	%xmm0, %xmm1
	cvtsd2ss	%xmm1, %xmm1
	movss	%xmm1, 16(%rsp,%rbp,4)
	incq	%rbp
	cmpq	$7, %rbp
	jne	.LBB1_9
# %bb.10:                               # %.preheader
                                        #   in Loop: Header=BB1_6 Depth=3
	mulss	92(%r15), %xmm7
	xorps	%xmm0, %xmm0
	cvtss2sd	%xmm7, %xmm0
	xorl	%ebp, %ebp
.LBB1_11:                               #   Parent Loop BB1_2 Depth=1
                                        #     Parent Loop BB1_4 Depth=2
                                        #       Parent Loop BB1_6 Depth=3
                                        # =>      This Inner Loop Header: Depth=4
	movss	124(%rsp,%rbp,4), %xmm1         # xmm1 = mem[0],zero,zero,zero
	movaps	%xmm1, %xmm3
	divss	%xmm9, %xmm3
	cvtss2sd	%xmm3, %xmm3
	addsd	%xmm2, %xmm3
	mulss	%xmm1, %xmm1
	cvtss2sd	%xmm1, %xmm1
	divsd	%xmm10, %xmm1
	addsd	%xmm3, %xmm1
	subsd	%xmm8, %xmm1
	mulsd	%xmm0, %xmm1
	cvtsd2ss	%xmm1, %xmm1
	movss	%xmm1, 44(%rsp,%rbp,4)
	incq	%rbp
	cmpq	$12, %rbp
	jne	.LBB1_11
# %bb.12:                               #   in Loop: Header=BB1_6 Depth=3
	xorps	%xmm0, %xmm0
	cvtsd2ss	%xmm11, %xmm0
	movss	-52(%rsp), %xmm1                # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	subss	%xmm1, %xmm0
	movss	-76(%rsp), %xmm3                # 4-byte Reload
                                        # xmm3 = mem[0],zero,zero,zero
	mulss	%xmm3, %xmm0
	addss	%xmm1, %xmm0
	movq	424(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm0, (%rbp,%r13,4)
	movq	8(%rsp), %rbp                   # 8-byte Reload
	movss	(%rbp,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	20(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	%xmm3, %xmm1
	addss	%xmm0, %xmm1
	movq	416(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm1, (%rbp,%r13,4)
	movq	(%rsp), %rbp                    # 8-byte Reload
	movss	(%rbp,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	24(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	%xmm3, %xmm1
	addss	%xmm0, %xmm1
	movq	408(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm1, (%rbp,%r13,4)
	movq	-8(%rsp), %rbp                  # 8-byte Reload
	movss	(%rbp,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	28(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	%xmm3, %xmm1
	addss	%xmm0, %xmm1
	movq	400(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm1, (%rbp,%r13,4)
	movq	-16(%rsp), %rbp                 # 8-byte Reload
	movss	(%rbp,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	32(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	%xmm3, %xmm1
	addss	%xmm0, %xmm1
	movq	392(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm1, (%rbp,%r13,4)
	movq	-24(%rsp), %rbp                 # 8-byte Reload
	movss	(%rbp,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	36(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	%xmm3, %xmm1
	addss	%xmm0, %xmm1
	movq	384(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm1, (%rbp,%r13,4)
	movq	-32(%rsp), %rbp                 # 8-byte Reload
	movss	(%rbp,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	40(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	%xmm3, %xmm1
	addss	%xmm0, %xmm1
	movq	376(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm1, (%rbp,%r13,4)
	movq	-40(%rsp), %rbp                 # 8-byte Reload
	movss	(%rbp,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	44(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	%xmm3, %xmm1
	addss	%xmm0, %xmm1
	movq	368(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm1, (%rbp,%r13,4)
	movq	-48(%rsp), %rbp                 # 8-byte Reload
	movss	(%rbp,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	48(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	%xmm3, %xmm1
	addss	%xmm0, %xmm1
	movq	360(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm1, (%rbp,%r13,4)
	movss	(%rax,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	52(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	%xmm3, %xmm1
	addss	%xmm0, %xmm1
	movq	352(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm1, (%rbp,%r13,4)
	movss	(%r8,%r13,4), %xmm0             # xmm0 = mem[0],zero,zero,zero
	movss	56(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	%xmm3, %xmm1
	addss	%xmm0, %xmm1
	movq	344(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm1, (%rbp,%r13,4)
	movss	(%rdx,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	60(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	%xmm3, %xmm1
	addss	%xmm0, %xmm1
	movq	336(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm1, (%rbp,%r13,4)
	movss	(%rsi,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	64(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	%xmm3, %xmm1
	addss	%xmm0, %xmm1
	movq	328(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm1, (%rbp,%r13,4)
	movss	(%r9,%r13,4), %xmm0             # xmm0 = mem[0],zero,zero,zero
	movss	68(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	%xmm3, %xmm1
	addss	%xmm0, %xmm1
	movq	320(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm1, (%rbp,%r13,4)
	movss	(%rcx,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	72(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	%xmm3, %xmm1
	addss	%xmm0, %xmm1
	movq	312(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm1, (%rbp,%r13,4)
	movss	(%r10,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	76(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	%xmm3, %xmm1
	addss	%xmm0, %xmm1
	movq	304(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm1, (%rbp,%r13,4)
	movss	(%r11,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	80(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	%xmm3, %xmm1
	addss	%xmm0, %xmm1
	movq	296(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm1, (%rbp,%r13,4)
	movss	(%rbx,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	84(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	%xmm3, %xmm1
	addss	%xmm0, %xmm1
	movq	288(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm1, (%rbp,%r13,4)
	movss	(%r14,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	88(%rsp), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	subss	%xmm0, %xmm1
	mulss	%xmm3, %xmm1
	addss	%xmm0, %xmm1
	movq	280(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm1, (%rbp,%r13,4)
	cmpq	272(%rsp), %r12                 # 8-byte Folded Reload
	jne	.LBB1_14
# %bb.13:                               #   in Loop: Header=BB1_6 Depth=3
	movq	264(%rsp), %r13                 # 8-byte Reload
	movss	%xmm14, (%r13,%rdi,4)
	movq	256(%rsp), %r13                 # 8-byte Reload
	movss	%xmm4, (%r13,%rdi,4)
	movq	248(%rsp), %r13                 # 8-byte Reload
	movss	%xmm5, (%r13,%rdi,4)
	movq	240(%rsp), %r13                 # 8-byte Reload
	movss	%xmm14, (%r13,%rdi,4)
	movq	232(%rsp), %rbp                 # 8-byte Reload
	movss	%xmm4, (%rbp,%rdi,4)
	movq	%r14, %r15
	movq	%rbx, %r14
	movq	%r11, %rbx
	movq	%r10, %r11
	movq	%rcx, %r10
	movq	%r9, %rcx
	movq	%rsi, %r9
	movq	%rdx, %rsi
	movq	%r8, %rdx
	movq	%rax, %r8
	movq	224(%rsp), %rax                 # 8-byte Reload
	movss	%xmm5, (%rax,%rdi,4)
	movss	(%r13,%rdi,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movq	216(%rsp), %r13                 # 8-byte Reload
	movss	%xmm0, (%r13,%rdi,4)
	movss	(%rbp,%rdi,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movq	208(%rsp), %r13                 # 8-byte Reload
	movss	%xmm0, (%r13,%rdi,4)
	movss	(%rax,%rdi,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movq	%r8, %rax
	movq	%rdx, %r8
	movq	%rsi, %rdx
	movq	%r9, %rsi
	movq	%rcx, %r9
	movq	%r10, %rcx
	movq	%r11, %r10
	movq	%rbx, %r11
	movq	%r14, %rbx
	movq	%r15, %r14
	movq	-128(%rsp), %r15                # 8-byte Reload
	movq	200(%rsp), %r13                 # 8-byte Reload
	movss	%xmm0, (%r13,%rdi,4)
.LBB1_14:                               #   in Loop: Header=BB1_6 Depth=3
	incq	%r12
	cmpq	-88(%rsp), %r12                 # 8-byte Folded Reload
	jne	.LBB1_6
.LBB1_15:                               # %._crit_edge
                                        #   in Loop: Header=BB1_4 Depth=2
	movq	-96(%rsp), %r12                 # 8-byte Reload
	incq	%r12
	movq	%r12, %r15
	movq	%r12, -96(%rsp)                 # 8-byte Spill
	movq	-128(%rsp), %rdi                # 8-byte Reload
	cmpq	-104(%rsp), %r12                # 8-byte Folded Reload
	jne	.LBB1_4
.LBB1_16:                               # %._crit_edge462
                                        #   in Loop: Header=BB1_2 Depth=1
	movq	-112(%rsp), %rcx                # 8-byte Reload
	incq	%rcx
	movq	%rcx, %rax
	movq	%rcx, -112(%rsp)                # 8-byte Spill
	cmpq	184(%rsp), %rcx                 # 8-byte Folded Reload
	jne	.LBB1_2
.LBB1_17:                               # %._crit_edge472
	addq	$456, %rsp                      # imm = 0x1C8
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_ZN3LBM18initial_relaxationEv, .Lfunc_end1-_ZN3LBM18initial_relaxationEv
	.cfi_endproc
                                        # -- End function
	.globl	_Z35__device_stub__relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_ # -- Begin function _Z35__device_stub__relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
	.type	_Z35__device_stub__relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_,@function
_Z35__device_stub__relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_: # @_Z35__device_stub__relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
	.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	$600, %rsp                      # imm = 0x258
	.cfi_def_cfa_offset 656
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	leaq	12(%rsp), %rax
	movl	%edi, (%rax)
	leaq	52(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	48(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	44(%rsp), %rdx
	movss	%xmm0, (%rdx)
	leaq	40(%rsp), %r10
	movss	%xmm1, (%r10)
	leaq	36(%rsp), %r11
	movss	%xmm2, (%r11)
	leaq	32(%rsp), %r14
	movss	%xmm3, (%r14)
	leaq	28(%rsp), %r15
	movss	%xmm4, (%r15)
	leaq	24(%rsp), %r12
	movss	%xmm5, (%r12)
	leaq	20(%rsp), %r13
	movss	%xmm6, (%r13)
	leaq	16(%rsp), %rbp
	movss	%xmm7, (%rbp)
	leaq	88(%rsp), %rax
	movq	%rcx, (%rax)
	leaq	80(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	72(%rsp), %r8
	movq	%r9, (%r8)
	leaq	128(%rsp), %rbx
	leaq	12(%rsp), %r9
	movq	%r9, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%r10, 32(%rbx)
	movq	%r11, 40(%rbx)
	movq	%r14, 48(%rbx)
	movq	%r15, 56(%rbx)
	movq	%r12, 64(%rbx)
	movq	%r13, 72(%rbx)
	movq	%rbp, 80(%rbx)
	leaq	656(%rsp), %rdx
	movq	%rdx, 88(%rbx)
	leaq	664(%rsp), %rdx
	movq	%rdx, 96(%rbx)
	movq	%rax, 104(%rbx)
	movq	%rcx, 112(%rbx)
	movq	%r8, 120(%rbx)
	leaq	672(%rsp), %rax
	movq	%rax, 128(%rbx)
	leaq	680(%rsp), %rax
	movq	%rax, 136(%rbx)
	leaq	688(%rsp), %rax
	movq	%rax, 144(%rbx)
	leaq	696(%rsp), %rax
	movq	%rax, 152(%rbx)
	leaq	704(%rsp), %rax
	movq	%rax, 160(%rbx)
	leaq	712(%rsp), %rax
	movq	%rax, 168(%rbx)
	leaq	720(%rsp), %rax
	movq	%rax, 176(%rbx)
	leaq	728(%rsp), %rax
	movq	%rax, 184(%rbx)
	leaq	736(%rsp), %rax
	movq	%rax, 192(%rbx)
	leaq	744(%rsp), %rax
	movq	%rax, 200(%rbx)
	leaq	752(%rsp), %rax
	movq	%rax, 208(%rbx)
	leaq	760(%rsp), %rax
	movq	%rax, 216(%rbx)
	leaq	768(%rsp), %rax
	movq	%rax, 224(%rbx)
	leaq	776(%rsp), %rax
	movq	%rax, 232(%rbx)
	leaq	784(%rsp), %rax
	movq	%rax, 240(%rbx)
	leaq	792(%rsp), %rax
	movq	%rax, 248(%rbx)
	leaq	800(%rsp), %rax
	movq	%rax, 256(%rbx)
	leaq	808(%rsp), %rax
	movq	%rax, 264(%rbx)
	leaq	816(%rsp), %rax
	movq	%rax, 272(%rbx)
	leaq	824(%rsp), %rax
	movq	%rax, 280(%rbx)
	leaq	832(%rsp), %rax
	movq	%rax, 288(%rbx)
	leaq	840(%rsp), %rax
	movq	%rax, 296(%rbx)
	leaq	848(%rsp), %rax
	movq	%rax, 304(%rbx)
	leaq	856(%rsp), %rax
	movq	%rax, 312(%rbx)
	leaq	864(%rsp), %rax
	movq	%rax, 320(%rbx)
	leaq	872(%rsp), %rax
	movq	%rax, 328(%rbx)
	leaq	880(%rsp), %rax
	movq	%rax, 336(%rbx)
	leaq	888(%rsp), %rax
	movq	%rax, 344(%rbx)
	leaq	896(%rsp), %rax
	movq	%rax, 352(%rbx)
	leaq	904(%rsp), %rax
	movq	%rax, 360(%rbx)
	leaq	912(%rsp), %rax
	movq	%rax, 368(%rbx)
	leaq	920(%rsp), %rax
	movq	%rax, 376(%rbx)
	leaq	928(%rsp), %rax
	movq	%rax, 384(%rbx)
	leaq	936(%rsp), %rax
	movq	%rax, 392(%rbx)
	leaq	944(%rsp), %rax
	movq	%rax, 400(%rbx)
	leaq	952(%rsp), %rax
	movq	%rax, 408(%rbx)
	leaq	960(%rsp), %rax
	movq	%rax, 416(%rbx)
	leaq	968(%rsp), %rax
	movq	%rax, 424(%rbx)
	leaq	976(%rsp), %rax
	movq	%rax, 432(%rbx)
	leaq	984(%rsp), %rax
	movq	%rax, 440(%rbx)
	leaq	992(%rsp), %rax
	movq	%rax, 448(%rbx)
	leaq	1000(%rsp), %rax
	movq	%rax, 456(%rbx)
	leaq	1008(%rsp), %rax
	movq	%rax, 464(%rbx)
	leaq	112(%rsp), %r14
	leaq	96(%rsp), %r15
	leaq	64(%rsp), %r12
	leaq	56(%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	$_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$616, %rsp                      # imm = 0x268
	.cfi_adjust_cfa_offset -616
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z35__device_stub__relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_, .Lfunc_end2-_Z35__device_stub__relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
	.cfi_endproc
                                        # -- End function
	.globl	_ZN3LBM15cuda_relaxationEv      # -- Begin function _ZN3LBM15cuda_relaxationEv
	.p2align	1, 0x90
	.type	_ZN3LBM15cuda_relaxationEv,@function
_ZN3LBM15cuda_relaxationEv:             # @_ZN3LBM15cuda_relaxationEv
	.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	$440, %rsp                      # imm = 0x1B8
	.cfi_def_cfa_offset 496
	.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	%rdi, %rbx
	cmpl	$0, 784(%rdi)
	jne	.LBB3_2
# %bb.1:
	movq	%rbx, %rdi
	callq	_ZN3LBM29copy_data_from_host_to_deviceEv
.LBB3_2:
	movl	48(%rbx), %edx
	movl	52(%rbx), %edi
	btsq	$32, %rdx
	btsq	$32, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB3_4
# %bb.3:
	movl	28(%rbx), %edi
	movl	32(%rbx), %esi
	movl	36(%rbx), %edx
	movss	72(%rbx), %xmm0                 # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 404(%rsp)                # 4-byte Spill
	movss	64(%rbx), %xmm0                 # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 400(%rsp)                # 4-byte Spill
	movss	68(%rbx), %xmm0                 # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 396(%rsp)                # 4-byte Spill
	movss	84(%rbx), %xmm0                 # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 392(%rsp)                # 4-byte Spill
	movss	88(%rbx), %xmm0                 # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 388(%rsp)                # 4-byte Spill
	movss	92(%rbx), %xmm0                 # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 384(%rsp)                # 4-byte Spill
	movss	96(%rbx), %xmm0                 # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 380(%rsp)                # 4-byte Spill
	movss	172(%rbx), %xmm0                # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 376(%rsp)                # 4-byte Spill
	movss	176(%rbx), %xmm0                # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 372(%rsp)                # 4-byte Spill
	movss	100(%rbx), %xmm0                # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 368(%rsp)                # 4-byte Spill
	movq	992(%rbx), %rax
	movq	%rax, 408(%rsp)                 # 8-byte Spill
	movq	1000(%rbx), %r8
	movq	1008(%rbx), %r9
	movups	1016(%rbx), %xmm0
	movaps	%xmm0, 416(%rsp)                # 16-byte Spill
	movups	1032(%rbx), %xmm11
	movups	1048(%rbx), %xmm12
	movups	1064(%rbx), %xmm13
	movups	1080(%rbx), %xmm14
	movups	1096(%rbx), %xmm15
	movq	968(%rbx), %rcx
	movq	800(%rbx), %r10
	movq	648(%rbx), %r11
	movq	656(%rbx), %r14
	movq	664(%rbx), %r15
	movq	616(%rbx), %r12
	movq	632(%rbx), %r13
	movq	640(%rbx), %rbp
	movq	624(%rbx), %rax
	movups	1112(%rbx), %xmm10
	movups	1128(%rbx), %xmm9
	movups	824(%rbx), %xmm8
	movups	840(%rbx), %xmm7
	movups	856(%rbx), %xmm6
	movups	872(%rbx), %xmm5
	movups	888(%rbx), %xmm4
	movups	904(%rbx), %xmm3
	movups	920(%rbx), %xmm2
	movups	936(%rbx), %xmm1
	movups	952(%rbx), %xmm0
	movq	%rax, 352(%rsp)
	movq	%rbp, 344(%rsp)
	movq	%r13, 336(%rsp)
	movq	%r12, 328(%rsp)
	movq	%r15, 320(%rsp)
	movq	%r14, 312(%rsp)
	movq	%r11, 304(%rsp)
	movq	%r10, 296(%rsp)
	movq	%rcx, 288(%rsp)
	movups	%xmm0, 272(%rsp)
	movups	%xmm1, 256(%rsp)
	movups	%xmm2, 240(%rsp)
	movups	%xmm3, 224(%rsp)
	movups	%xmm4, 208(%rsp)
	movups	%xmm5, 192(%rsp)
	movups	%xmm6, 176(%rsp)
	movups	%xmm7, 160(%rsp)
	movups	%xmm8, 144(%rsp)
	movups	%xmm9, 128(%rsp)
	movups	%xmm10, 112(%rsp)
	movups	%xmm15, 96(%rsp)
	movups	%xmm14, 80(%rsp)
	movups	%xmm13, 64(%rsp)
	movups	%xmm12, 48(%rsp)
	movups	%xmm11, 32(%rsp)
	movaps	416(%rsp), %xmm0                # 16-byte Reload
	movups	%xmm0, 16(%rsp)
	movss	368(%rsp), %xmm0                # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 8(%rsp)
	movss	372(%rsp), %xmm0                # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%rsp)
	movss	404(%rsp), %xmm0                # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	movss	400(%rsp), %xmm1                # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	movss	396(%rsp), %xmm2                # 4-byte Reload
                                        # xmm2 = mem[0],zero,zero,zero
	movss	392(%rsp), %xmm3                # 4-byte Reload
                                        # xmm3 = mem[0],zero,zero,zero
	movss	388(%rsp), %xmm4                # 4-byte Reload
                                        # xmm4 = mem[0],zero,zero,zero
	movss	384(%rsp), %xmm5                # 4-byte Reload
                                        # xmm5 = mem[0],zero,zero,zero
	movss	380(%rsp), %xmm6                # 4-byte Reload
                                        # xmm6 = mem[0],zero,zero,zero
	movss	376(%rsp), %xmm7                # 4-byte Reload
                                        # xmm7 = mem[0],zero,zero,zero
	movq	408(%rsp), %rcx                 # 8-byte Reload
	callq	_Z35__device_stub__relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
.LBB3_4:
	addq	$440, %rsp                      # imm = 0x1B8
	.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
	jmp	hipDeviceSynchronize            # TAILCALL
.Lfunc_end3:
	.size	_ZN3LBM15cuda_relaxationEv, .Lfunc_end3-_ZN3LBM15cuda_relaxationEv
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB4_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB4_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end4:
	.size	__hip_module_ctor, .Lfunc_end4-__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	.LBB5_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
.LBB5_2:
	retq
.Lfunc_end5:
	.size	__hip_module_dtor, .Lfunc_end5-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_,@object # @_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
	.section	.rodata,"a",@progbits
	.globl	_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
	.p2align	3, 0x0
_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_:
	.quad	_Z35__device_stub__relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
	.size	_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_, 8

	.type	.L__unnamed_1,@object           # @0
	.section	.rodata.str1.1,"aMS",@progbits,1
.L__unnamed_1:
	.asciz	"_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_"
	.size	.L__unnamed_1, 175

	.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__relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_ ; -- Begin function _Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
	.globl	_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
	.p2align	8
	.type	_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_,@function
_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_: ; @_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x1b4
	s_load_b128 s[28:31], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mul_i32 s2, s29, s28
	s_mul_i32 s3, s2, s30
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_cmp_gt_i32_e32 vcc_lo, s3, v1
	s_and_saveexec_b32 s3, vcc_lo
	s_cbranch_execz .LBB0_4
; %bb.1:
	s_ashr_i32 s3, s2, 31
	v_ashrrev_i32_e32 v2, 31, v1
	s_add_i32 s2, s2, s3
	s_clause 0x5
	s_load_b256 s[20:27], s[0:1], 0x18
	s_load_b512 s[84:99], s[0:1], 0x38
	s_load_b512 s[68:83], s[0:1], 0x78
	s_load_b512 s[52:67], s[0:1], 0xb8
	s_load_b512 s[36:51], s[0:1], 0xf8
	s_load_b512 s[4:19], s[0:1], 0x138
	s_xor_b32 s2, s2, s3
	v_xor_b32_e32 v0, s3, v2
	v_cvt_f32_u32_e32 v4, s2
	s_sub_i32 s3, 0, s2
	s_delay_alu instid0(VALU_DEP_1)
	v_rcp_iflag_f32_e32 v4, v4
	v_add_nc_u32_e32 v3, v1, v2
	s_waitcnt lgkmcnt(0)
	v_mul_f32_e64 v28, s20, s24
	v_mul_f32_e64 v26, s22, s24
	v_mul_f32_e64 v27, s21, s24
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v4, 0x4f7ffffe, v4
	v_xor_b32_e32 v3, v3, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_u32_f32_e32 v4, v4
	v_mul_lo_u32 v5, s3, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v5, v4, v5
	v_add_nc_u32_e32 v4, v4, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v4, v3, v4
	v_mul_lo_u32 v5, v4, s2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v3, v3, v5
	v_add_nc_u32_e32 v5, 1, v4
	v_cmp_le_u32_e32 vcc_lo, s2, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v4, v4, v5, vcc_lo
	v_subrev_nc_u32_e32 v5, s2, v3
	v_cndmask_b32_e32 v3, v3, v5, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_cmp_le_u32_e32 vcc_lo, s2, v3
	v_add_nc_u32_e32 v3, 1, v4
	s_ashr_i32 s2, s28, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_add_i32 s3, s28, s2
	v_cndmask_b32_e32 v3, v4, v3, vcc_lo
	s_xor_b32 s3, s3, s2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_sub_i32 s27, 0, s3
	v_xor_b32_e32 v3, v3, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v3, v3, v0
	v_sub_nc_u32_e32 v4, v1, v3
	v_lshlrev_b64 v[1:2], 2, v[1:2]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v0, 31, v4
	v_add_nc_u32_e32 v6, v4, v0
	v_xor_b32_e32 v5, s2, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_xor_b32_e32 v0, v6, v0
	v_cvt_f32_u32_e32 v6, s3
	v_rcp_iflag_f32_e32 v6, v6
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v6, 0x4f7ffffe, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_u32_f32_e32 v6, v6
	v_mul_lo_u32 v7, s27, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v7, v6, v7
	v_add_nc_u32_e32 v6, v6, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v6, v0, v6
	v_mul_lo_u32 v7, v6, s3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v0, v0, v7
	v_add_nc_u32_e32 v7, 1, v6
	v_cmp_le_u32_e32 vcc_lo, s3, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v6, v6, v7, vcc_lo
	v_subrev_nc_u32_e32 v7, s3, v0
	v_cndmask_b32_e32 v0, v0, v7, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_cmp_le_u32_e32 vcc_lo, s3, v0
	v_add_nc_u32_e32 v0, 1, v6
	s_add_i32 s3, s28, -2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v0, v6, v0, vcc_lo
	v_xor_b32_e32 v0, v0, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_sub_nc_u32_e32 v0, v0, v5
	v_add_co_u32 v5, vcc_lo, s84, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s85, v2, vcc_lo
	v_sub_nc_u32_e32 v4, v4, v0
	global_load_b32 v32, v[5:6], off
	v_add_co_u32 v5, vcc_lo, s86, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s87, v2, vcc_lo
	global_load_b32 v25, v[5:6], off
	v_add_co_u32 v5, vcc_lo, s88, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s89, v2, vcc_lo
	global_load_b32 v24, v[5:6], off
	v_add_co_u32 v5, vcc_lo, s90, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s91, v2, vcc_lo
	global_load_b32 v23, v[5:6], off
	v_add_co_u32 v5, vcc_lo, s92, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s93, v2, vcc_lo
	global_load_b32 v22, v[5:6], off
	v_add_co_u32 v5, vcc_lo, s94, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s95, v2, vcc_lo
	global_load_b32 v21, v[5:6], off
	v_add_co_u32 v5, vcc_lo, s96, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s97, v2, vcc_lo
	global_load_b32 v20, v[5:6], off
	v_add_co_u32 v5, vcc_lo, s98, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s99, v2, vcc_lo
	global_load_b32 v19, v[5:6], off
	v_add_co_u32 v5, vcc_lo, s68, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s69, v2, vcc_lo
	global_load_b32 v18, v[5:6], off
	v_add_co_u32 v5, vcc_lo, s70, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s71, v2, vcc_lo
	global_load_b32 v17, v[5:6], off
	v_add_co_u32 v5, vcc_lo, s72, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s73, v2, vcc_lo
	global_load_b32 v16, v[5:6], off
	v_add_co_u32 v5, vcc_lo, s74, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s75, v2, vcc_lo
	global_load_b32 v15, v[5:6], off
	v_add_co_u32 v5, vcc_lo, s76, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s77, v2, vcc_lo
	global_load_b32 v14, v[5:6], off
	v_add_co_u32 v5, vcc_lo, s78, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s79, v2, vcc_lo
	global_load_b32 v13, v[5:6], off
	v_add_co_u32 v5, vcc_lo, s80, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s81, v2, vcc_lo
	global_load_b32 v12, v[5:6], off
	v_add_co_u32 v5, vcc_lo, s82, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s83, v2, vcc_lo
	global_load_b32 v11, v[5:6], off
	v_add_co_u32 v5, vcc_lo, s52, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s53, v2, vcc_lo
	global_load_b32 v10, v[5:6], off
	v_add_co_u32 v5, vcc_lo, s54, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s55, v2, vcc_lo
	global_load_b32 v9, v[5:6], off
	v_add_co_u32 v5, vcc_lo, s56, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s57, v2, vcc_lo
	global_load_b32 v8, v[5:6], off
	s_waitcnt vmcnt(18)
	v_add_f32_e32 v5, 0, v32
	s_waitcnt vmcnt(17)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f32_e32 v5, v5, v25
	s_waitcnt vmcnt(16)
	v_add_f32_e32 v5, v5, v24
	s_waitcnt vmcnt(15)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f32_e32 v5, v5, v23
	s_waitcnt vmcnt(14)
	v_add_f32_e32 v5, v5, v22
	s_waitcnt vmcnt(13)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f32_e32 v5, v5, v21
	s_waitcnt vmcnt(12)
	v_add_f32_e32 v5, v5, v20
	s_waitcnt vmcnt(11)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f32_e32 v5, v5, v19
	s_waitcnt vmcnt(10)
	v_add_f32_e32 v5, v5, v18
	s_waitcnt vmcnt(9)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f32_e32 v5, v5, v17
	s_waitcnt vmcnt(8)
	v_add_f32_e32 v5, v5, v16
	s_waitcnt vmcnt(7)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f32_e32 v5, v5, v15
	s_waitcnt vmcnt(6)
	v_add_f32_e32 v5, v5, v14
	s_waitcnt vmcnt(5)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f32_e32 v5, v5, v13
	s_waitcnt vmcnt(4)
	v_add_f32_e32 v5, v5, v12
	s_waitcnt vmcnt(3)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f32_e32 v5, v5, v11
	s_waitcnt vmcnt(2)
	v_add_f32_e32 v5, v5, v10
	s_waitcnt vmcnt(1)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f32_e32 v5, v5, v9
	s_waitcnt vmcnt(0)
	v_add_f32_e32 v45, v5, v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_scale_f32 v5, null, v45, v45, 1.0
	v_mul_f32_e32 v28, v28, v45
	v_rcp_f32_e32 v6, v5
	s_waitcnt_depctr 0xfff
	v_fma_f32 v7, -v5, v6, 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v6, v7, v6
	v_div_scale_f32 v7, vcc_lo, 1.0, v45, 1.0
	v_mul_f32_e32 v29, v7, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v30, -v5, v29, v7
	v_fmac_f32_e32 v29, v30, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v5, -v5, v29, v7
	v_div_fmas_f32 v5, v5, v6, v29
	v_add_f32_e32 v29, v20, v14
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_4)
	v_div_fixup_f32 v7, v5, v45, 1.0
	v_add_co_u32 v5, vcc_lo, s16, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s17, v2, vcc_lo
	v_add_f32_e32 v29, v15, v29
	global_load_b32 v5, v[5:6], off
	v_add_f32_e32 v6, v23, v18
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_add_f32 v29, v29, v10 :: v_dual_add_f32 v6, v6, v17
	v_dual_add_f32 v29, v29, v9 :: v_dual_add_f32 v6, v6, v14
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_add_f32_e32 v6, v6, v13
	s_waitcnt vmcnt(0)
	v_sub_nc_u32_e32 v5, 1, v5
	v_cvt_f32_i32_e32 v5, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_mul_f32_e32 v43, v7, v5
	v_add_f32_e32 v5, v25, v19
	v_add_f32_e32 v7, v22, v17
	v_add_f32_e32 v5, v5, v16
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f32_e32 v7, v7, v16
	v_add_f32_e32 v5, v5, v15
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f32_e32 v7, v7, v9
	v_add_f32_e32 v5, v5, v12
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f32_e32 v7, v7, v8
	v_sub_f32_e32 v31, v5, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_add_f32 v6, v24, v18 :: v_dual_mul_f32 v5, v31, v43
	v_add_f32_e32 v6, v19, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v6, v6, v10
	v_add_f32_e32 v6, v11, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_sub_f32 v44, v6, v7 :: v_dual_add_f32 v7, v21, v13
	v_mul_f32_e32 v6, v44, v43
	v_fma_f32 v47, v44, v43, v5
	v_fma_f32 v48, v44, v43, -v5
	v_fma_f32 v49, -v44, v43, -v5
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_fma_f32 v50, v31, v43, -v6
	v_add_f32_e32 v7, v7, v12
	v_mul_f32_e32 v33, v6, v6
	v_add_f32_e32 v7, v7, v11
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fmac_f32_e32 v33, v5, v5
	v_add_f32_e32 v7, v7, v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_sub_f32_e32 v46, v7, v29
	v_cvt_f64_f32_e32 v[29:30], s23
	v_mul_f32_e32 v7, v46, v43
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fmac_f32_e32 v33, v7, v7
	v_fma_f32 v31, v44, v43, -v7
	v_cvt_f64_f32_e32 v[33:34], v33
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[33:34], v[29:30], 2.0, -v[33:34]
	v_mul_f64 v[33:34], v[33:34], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_scale_f64 v[35:36], null, v[29:30], v[29:30], v[33:34]
	v_rcp_f64_e32 v[37:38], v[35:36]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[39:40], -v[35:36], v[37:38], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[37:38], v[37:38], v[39:40], v[37:38]
	v_fma_f64 v[39:40], -v[35:36], v[37:38], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fma_f64 v[37:38], v[37:38], v[39:40], v[37:38]
	v_div_scale_f64 v[39:40], vcc_lo, v[33:34], v[29:30], v[33:34]
	v_mul_f64 v[41:42], v[39:40], v[37:38]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fma_f64 v[35:36], -v[35:36], v[41:42], v[39:40]
	v_fma_f32 v39, -v46, v43, v5
	v_div_fmas_f64 v[35:36], v[35:36], v[37:38], v[41:42]
	v_mul_f32_e64 v37, s26, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cvt_f64_f32_e32 v[37:38], v37
	v_div_fixup_f64 v[41:42], v[35:36], v[29:30], v[33:34]
	v_fma_f32 v36, -v46, v43, -v5
	v_fma_f32 v35, v46, v43, -v5
	v_fma_f32 v34, v46, v43, v5
	v_fma_f32 v33, v46, v43, v6
	v_fma_f32 v30, -v44, v43, -v7
	v_fma_f32 v29, v46, v43, -v6
	v_mul_f64 v[43:44], v[37:38], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	v_cvt_f32_f64_e32 v46, v[37:38]
	v_mul_f32_e32 v37, s26, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cvt_f64_f32_e32 v[37:38], v37
	v_fmac_f32_e64 v46, s26, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[43:44], v[37:38], 0.5
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cvt_f32_f64_e32 v51, v[37:38]
	v_mul_f32_e32 v37, s26, v6
	v_cvt_f64_f32_e32 v[37:38], v37
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fmac_f32_e32 v51, s26, v5
	v_mul_f64 v[43:44], v[37:38], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	v_cvt_f32_f64_e32 v52, v[37:38]
	v_mul_f32_e64 v37, -v5, s26
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cvt_f64_f32_e32 v[37:38], v37
	v_fmac_f32_e32 v52, s26, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[43:44], v[37:38], 0.5
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cvt_f32_f64_e32 v53, v[37:38]
	v_mul_f32_e64 v37, -v6, s26
	v_cvt_f64_f32_e32 v[37:38], v37
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[43:44], v[37:38], 0.5
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cvt_f32_f64_e32 v54, v[37:38]
	v_mul_f32_e32 v37, s26, v7
	v_cvt_f64_f32_e32 v[37:38], v37
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[43:44], v[37:38], 0.5
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cvt_f32_f64_e32 v55, v[37:38]
	v_mul_f32_e64 v37, -v7, s26
	v_cvt_f64_f32_e32 v[37:38], v37
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fmac_f32_e32 v55, s26, v7
	v_mul_f64 v[43:44], v[37:38], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	v_cvt_f32_f64_e32 v56, v[37:38]
	v_mul_f32_e32 v37, s26, v47
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_f64_f32_e32 v[37:38], v37
	v_mul_f64 v[43:44], v[37:38], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	v_cvt_f32_f64_e32 v57, v[37:38]
	v_mul_f32_e32 v37, s26, v48
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cvt_f64_f32_e32 v[37:38], v37
	v_fmac_f32_e32 v57, s26, v47
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[43:44], v[37:38], 0.5
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cvt_f32_f64_e32 v58, v[37:38]
	v_mul_f32_e32 v37, s26, v49
	v_cvt_f64_f32_e32 v[37:38], v37
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fmac_f32_e32 v58, s26, v48
	v_mul_f64 v[43:44], v[37:38], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	v_cvt_f32_f64_e32 v59, v[37:38]
	v_mul_f32_e32 v37, s26, v50
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cvt_f64_f32_e32 v[37:38], v37
	v_fmac_f32_e32 v59, s26, v49
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[43:44], v[37:38], 0.5
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cvt_f32_f64_e32 v60, v[37:38]
	v_mul_f32_e32 v37, s26, v39
	v_cvt_f64_f32_e32 v[37:38], v37
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fmac_f32_e32 v60, s26, v50
	v_mul_f64 v[43:44], v[37:38], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	v_cvt_f32_f64_e32 v61, v[37:38]
	v_mul_f32_e32 v37, s26, v36
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cvt_f64_f32_e32 v[37:38], v37
	v_fmac_f32_e32 v61, s26, v39
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[43:44], v[37:38], 0.5
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cvt_f32_f64_e32 v62, v[37:38]
	v_mul_f32_e32 v37, s26, v35
	v_cvt_f64_f32_e32 v[37:38], v37
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fmac_f32_e32 v62, s26, v36
	v_mul_f64 v[43:44], v[37:38], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	v_cvt_f32_f64_e32 v63, v[37:38]
	v_mul_f32_e32 v37, s26, v34
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cvt_f64_f32_e32 v[37:38], v37
	v_fmac_f32_e32 v63, s26, v35
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[43:44], v[37:38], 0.5
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cvt_f32_f64_e32 v64, v[37:38]
	v_mul_f32_e32 v37, s26, v33
	v_cvt_f64_f32_e32 v[37:38], v37
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fmac_f32_e32 v64, s26, v34
	v_mul_f64 v[43:44], v[37:38], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	v_cvt_f32_f64_e32 v65, v[37:38]
	v_mul_f32_e32 v37, s26, v31
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cvt_f64_f32_e32 v[37:38], v37
	v_fmac_f32_e32 v65, s26, v33
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[43:44], v[37:38], 0.5
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cvt_f32_f64_e32 v66, v[37:38]
	v_mul_f32_e32 v37, s26, v30
	v_cvt_f64_f32_e32 v[37:38], v37
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fmac_f32_e32 v66, s26, v31
	v_mul_f64 v[43:44], v[37:38], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	v_cvt_f32_f64_e32 v40, v[37:38]
	v_mul_f32_e32 v37, s26, v29
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cvt_f64_f32_e32 v[37:38], v37
	v_fmac_f32_e32 v40, s26, v30
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[43:44], v[37:38], 0.5
	v_mul_f64 v[37:38], v[43:44], v[37:38]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_cvt_f32_f64_e32 v37, v[37:38]
	v_cvt_f32_f64_e32 v38, v[41:42]
	v_mul_f32_e32 v41, v27, v45
	v_fmac_f32_e32 v37, s26, v29
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v27, v46, v38
	v_mul_f32_e32 v42, v28, v27
	v_add_co_u32 v27, vcc_lo, s58, v1
	v_add_co_ci_u32_e32 v28, vcc_lo, s59, v2, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v42, s25, v32
	global_store_b32 v[27:28], v42, off
	v_add_f32_e32 v27, v51, v38
	v_mul_f32_e32 v32, v41, v27
	v_add_co_u32 v27, vcc_lo, s60, v1
	v_add_co_ci_u32_e32 v28, vcc_lo, s61, v2, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_dual_fmac_f32 v32, s25, v25 :: v_dual_add_f32 v25, v52, v38
	v_mul_f32_e32 v26, v26, v45
	global_store_b32 v[27:28], v32, off
	v_mul_f32_e32 v27, v41, v25
	v_fmac_f32_e32 v27, s25, v24
	v_add_co_u32 v24, vcc_lo, s62, v1
	v_add_co_ci_u32_e32 v25, vcc_lo, s63, v2, vcc_lo
	global_store_b32 v[24:25], v27, off
	v_fma_f32 v24, -v5, s26, v53
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v24, v24, v38
	v_mul_f32_e32 v25, v41, v24
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v25, s25, v23
	v_add_co_u32 v23, vcc_lo, s64, v1
	v_add_co_ci_u32_e32 v24, vcc_lo, s65, v2, vcc_lo
	global_store_b32 v[23:24], v25, off
	v_fma_f32 v23, -v6, s26, v54
	v_add_f32_e32 v23, v23, v38
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v24, v41, v23
	v_fmac_f32_e32 v24, s25, v22
	v_add_co_u32 v22, vcc_lo, s66, v1
	v_add_co_ci_u32_e32 v23, vcc_lo, s67, v2, vcc_lo
	global_store_b32 v[22:23], v24, off
	v_add_f32_e32 v22, v55, v38
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v23, v41, v22
	v_fmac_f32_e32 v23, s25, v21
	v_add_co_u32 v21, vcc_lo, s36, v1
	v_add_co_ci_u32_e32 v22, vcc_lo, s37, v2, vcc_lo
	global_store_b32 v[21:22], v23, off
	v_fma_f32 v21, -v7, s26, v56
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v21, v21, v38
	v_mul_f32_e32 v22, v41, v21
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v22, s25, v20
	v_add_co_u32 v20, vcc_lo, s38, v1
	v_add_co_ci_u32_e32 v21, vcc_lo, s39, v2, vcc_lo
	global_store_b32 v[20:21], v22, off
	v_add_f32_e32 v20, v57, v38
	v_mul_f32_e32 v21, v26, v20
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v21, s25, v19
	v_add_co_u32 v19, vcc_lo, s40, v1
	v_add_co_ci_u32_e32 v20, vcc_lo, s41, v2, vcc_lo
	global_store_b32 v[19:20], v21, off
	v_add_f32_e32 v19, v58, v38
	v_mul_f32_e32 v20, v26, v19
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v20, s25, v18
	v_add_co_u32 v18, vcc_lo, s42, v1
	v_add_co_ci_u32_e32 v19, vcc_lo, s43, v2, vcc_lo
	global_store_b32 v[18:19], v20, off
	v_add_f32_e32 v18, v59, v38
	v_mul_f32_e32 v19, v26, v18
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v19, s25, v17
	v_add_co_u32 v17, vcc_lo, s44, v1
	v_add_co_ci_u32_e32 v18, vcc_lo, s45, v2, vcc_lo
	global_store_b32 v[17:18], v19, off
	v_add_f32_e32 v17, v60, v38
	v_mul_f32_e32 v18, v26, v17
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v18, s25, v16
	v_add_co_u32 v16, vcc_lo, s46, v1
	v_add_co_ci_u32_e32 v17, vcc_lo, s47, v2, vcc_lo
	global_store_b32 v[16:17], v18, off
	v_add_f32_e32 v16, v61, v38
	v_mul_f32_e32 v17, v26, v16
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v17, s25, v15
	v_add_co_u32 v15, vcc_lo, s48, v1
	v_add_co_ci_u32_e32 v16, vcc_lo, s49, v2, vcc_lo
	global_store_b32 v[15:16], v17, off
	v_add_f32_e32 v15, v62, v38
	v_mul_f32_e32 v16, v26, v15
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v16, s25, v14
	v_add_co_u32 v14, vcc_lo, s50, v1
	v_add_co_ci_u32_e32 v15, vcc_lo, s51, v2, vcc_lo
	global_store_b32 v[14:15], v16, off
	v_add_f32_e32 v14, v63, v38
	v_mul_f32_e32 v15, v26, v14
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v15, s25, v13
	v_add_co_u32 v13, vcc_lo, s4, v1
	v_add_co_ci_u32_e32 v14, vcc_lo, s5, v2, vcc_lo
	global_store_b32 v[13:14], v15, off
	v_add_f32_e32 v13, v64, v38
	v_mul_f32_e32 v14, v26, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v14, s25, v12
	v_add_co_u32 v12, vcc_lo, s6, v1
	v_add_co_ci_u32_e32 v13, vcc_lo, s7, v2, vcc_lo
	global_store_b32 v[12:13], v14, off
	v_add_f32_e32 v12, v65, v38
	v_mul_f32_e32 v13, v26, v12
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v13, s25, v11
	v_add_co_u32 v11, vcc_lo, s8, v1
	v_add_co_ci_u32_e32 v12, vcc_lo, s9, v2, vcc_lo
	global_store_b32 v[11:12], v13, off
	v_add_f32_e32 v11, v66, v38
	v_mul_f32_e32 v12, v26, v11
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v12, s25, v10
	v_add_co_u32 v10, vcc_lo, s10, v1
	v_add_co_ci_u32_e32 v11, vcc_lo, s11, v2, vcc_lo
	global_store_b32 v[10:11], v12, off
	v_add_f32_e32 v10, v40, v38
	v_mul_f32_e32 v11, v26, v10
	s_delay_alu instid0(VALU_DEP_1)
	v_fmac_f32_e32 v11, s25, v9
	v_add_co_u32 v9, vcc_lo, s12, v1
	v_add_co_ci_u32_e32 v10, vcc_lo, s13, v2, vcc_lo
	v_add_co_u32 v1, vcc_lo, s14, v1
	v_add_co_ci_u32_e32 v2, vcc_lo, s15, v2, vcc_lo
	global_store_b32 v[9:10], v11, off
	v_add_f32_e32 v9, v37, v38
	v_cmp_eq_u32_e32 vcc_lo, s3, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v9, v26, v9
	v_fmac_f32_e32 v9, s25, v8
	global_store_b32 v[1:2], v9, off
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_4
; %bb.2:
	v_mad_u64_u32 v[1:2], null, v3, s29, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v0, v1, s28
	v_ashrrev_i32_e32 v3, 31, v0
	v_add_co_u32 v2, vcc_lo, s28, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v3, vcc_lo, s2, v3, vcc_lo
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, s16, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s17, v3, vcc_lo
	global_load_b32 v0, v[2:3], off offset:-4
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, 0, v0
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_4
; %bb.3:
	s_load_b256 s[4:11], s[0:1], 0x178
	v_ashrrev_i32_e32 v2, 31, v1
	s_load_b128 s[0:3], s[0:1], 0x198
	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 v2, vcc_lo, s18, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s19, v1, vcc_lo
	global_store_b32 v[2:3], v5, off
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v2, vcc_lo, s4, v0
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo
	v_add_co_u32 v8, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v9, vcc_lo, s7, v1, vcc_lo
	v_add_co_u32 v10, vcc_lo, s8, v0
	v_add_co_ci_u32_e32 v11, vcc_lo, s9, v1, vcc_lo
	v_add_co_u32 v12, vcc_lo, s10, v0
	v_add_co_ci_u32_e32 v13, vcc_lo, s11, v1, vcc_lo
	global_store_b32 v[2:3], v6, off
	v_add_co_u32 v2, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v3, vcc_lo, s1, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s2, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	global_store_b32 v[8:9], v7, off
	global_store_b32 v[10:11], v5, off
	global_store_b32 v[12:13], v6, off
	global_store_b32 v[2:3], v7, off
	global_store_b32 v[0:1], v5, off
.LBB0_4:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 680
		.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 67
		.amdhsa_next_free_sgpr 100
		.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	_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_, .Lfunc_end0-_Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 3456
; NumSgprs: 102
; NumVgprs: 67
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 12
; VGPRBlocks: 8
; NumSGPRsForWavesPerEU: 102
; NumVGPRsForWavesPerEU: 67
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .offset:         4
        .size:           4
        .value_kind:     by_value
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         20
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         36
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     by_value
      - .offset:         44
        .size:           4
        .value_kind:     by_value
      - .offset:         48
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         56
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         64
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         72
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         80
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         88
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         96
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         104
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         112
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         120
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         128
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         136
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         144
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         152
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         160
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         168
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         176
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         184
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         192
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         200
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         208
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         216
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         224
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         232
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         240
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         248
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         256
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         264
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         272
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         280
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         288
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         296
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         304
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         312
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         320
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         328
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         336
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         344
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         352
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         360
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         368
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         376
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         384
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         392
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         400
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         408
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         416
        .size:           8
        .value_kind:     global_buffer
      - .offset:         424
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         428
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         432
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         436
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         438
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         440
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         442
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         444
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         446
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         464
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         472
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         480
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         488
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 680
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_
    .private_segment_fixed_size: 0
    .sgpr_count:     102
    .sgpr_spill_count: 0
    .symbol:         _Z20relaxation_kernel_v4iiiffffffffffPKfS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_PfS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_PKiS1_S1_S1_S1_S1_S1_S1_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     67
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
