#include <stdio.h>
#include <iostream>
#include <fstream>
#include <cuda_runtime.h>
#include <cmath>
#include <string>
#include <cstdio>



using namespace std;


__global__ void p2_calc_gpu(float* d_x, float* d_y, float* d_z, float* d_ans, int* d_count, int* d_status, unsigned long long int numatm,float* d_xbox,float* d_ybox,float* d_zbox, int numfrm)
{
 int numcount;
 float r,cut,dx,dy,dz;
 float px,py,pz,nx,ny,nz,rp,rn,rpn,vcos,accu;
 cut=8.75;
 int conf,nat;
 unsigned long long int i = blockIdx.x * blockDim.x + threadIdx.x;
    
 if ( i < numatm*numfrm) {
    conf=int(i/numatm);
    nat=int(i%numatm);
    d_ans[i]=0;   
    d_count[i]=0;
    accu=0;
    numcount=0;
    if (d_status[nat]!=1){
        d_count[i]=d_count[i]+1;
        for (int j=0;j<numatm;j++){
             if (d_status[j]!=1){
             dx=d_x[i]-d_x[conf*numatm+j];
             dy=d_y[i]-d_y[conf*numatm+j];
             dz=d_z[i]-d_z[conf*numatm+j];

             dx=dx-d_xbox[conf]*(round(dx/d_xbox[conf]));
             dy=dy-d_ybox[conf]*(round(dy/d_ybox[conf]));
             dz=dz-d_zbox[conf]*(round(dz/d_zbox[conf]));

             r=sqrt(dx*dx+dy*dy+dz*dz);
             if (r<cut) {
                  
                   px=d_x[i+1]-d_x[i-1] ;     
                   py=d_y[i+1]-d_y[i-1] ;      
                   pz=d_z[i+1]-d_z[i-1] ;       
       
                   nx=d_x[conf*numatm+j+1]-d_x[conf*numatm+j-1] ;        
                   ny=d_y[conf*numatm+j+1]-d_y[conf*numatm+j-1] ;         
                   nz=d_z[conf*numatm+j+1]-d_z[conf*numatm+j-1] ;          
          
                   rp=sqrt(px*px+py*py+pz*pz);
                   rn=sqrt(nx*nx+ny*ny+nz*nz);
                   rpn= (nx*px+ny*py+nz*pz);
                   
                   vcos= rpn/(abs(rp)*abs(rn));
                   //cout<<i<<"\t"<<j<<"\t"<<vcos<<endl;
                   accu=accu+((3*vcos*vcos-1)/2.0);
                    numcount++;}
              } 
            }    
         if (numcount==0){
           d_ans[i]=0;
         }else{
         d_ans[i]=accu/numcount;    
         }
      }
    }
 }

int main()
{ 
 // int a,b,c;
  unsigned long long int numatm;
  int numfrm,countsum;
  int* h_count,*d_count;
  int* h_status,*d_status;
  float* h_xbox,*h_ybox,*h_zbox;
  float* d_xbox,*d_ybox,*d_zbox;
  float sum;  
  float* h_ans,*d_ans;
  float* h_x,*h_y,*h_z;
  float* d_x,*d_y,*d_z;
  char atmnm[2];
  string comment;
  unsigned long long int near2;
  int nthreads=128;
  int totalcount;
  float totalsum;
 
  
  ifstream infile,pbc,bond;
  ofstream outfile,p2;
  infile.open("XYZ.dat");
  bond.open("bond.dat");
  pbc.open("pbc.dat");
  p2.open("avrg.p2");
  outfile.open("local-order.dat");


bond>>numatm;
bond>>numfrm;
//numfrm=1;


//  cout<<numatm<<"\t"<<near2<<endl;
  unsigned int sizef= numfrm*numatm*sizeof(float);
  unsigned int sizef2= numfrm*sizeof(float);

  unsigned int sizei= numatm*sizeof(int);
  unsigned int sizei2= numfrm*numatm*sizeof(int);

  h_x= (float *) malloc(sizef);
  h_y= (float *) malloc(sizef);
  h_z= (float *) malloc(sizef);
  h_ans=  (float *) malloc(sizef);
  h_status= (int *) malloc(sizei);
  h_count= (int *) malloc(sizei2);
  h_xbox=  (float *) malloc(sizef2);
  h_ybox=  (float *) malloc(sizef2);
  h_zbox=  (float *) malloc(sizef2);

  cudaMalloc((void**)&d_x, sizef);
  cudaMalloc((void**)&d_y, sizef);
  cudaMalloc((void**)&d_z, sizef);
  cudaMalloc((void**)&d_ans, sizef);
  cudaMalloc((void**)&d_status, sizei);
  cudaMalloc((void**)&d_count, sizei2);
  cudaMalloc((void**)&d_xbox, sizef2);
  cudaMalloc((void**)&d_ybox, sizef2);
  cudaMalloc((void**)&d_zbox, sizef2);

//  bond>>h_status[0]>>a>>b;
  for (int i=0;i<numatm;i++) {
       bond>>h_status[i];
  }
/****copying status of carbon here as it need not to be copy again & again  ************/
  cudaMemcpy(d_status, h_status, sizei, cudaMemcpyHostToDevice);

/*****calculation over different frames **************************************/
  totalcount=0;
  totalsum=0;

  for (int k=0;k<numfrm;k++) {
    if(!(k%100)){
       cout<<"#"<<k<<endl;
    }
       pbc>>h_xbox[k]>>h_ybox[k]>>h_zbox[k];
      
      infile>>numatm;
      getline(infile,comment);
      getline(infile,comment);

      for (int i=0;i<numatm;i++) {
           infile>>atmnm>>h_x[k*numatm+i]>>h_y[k*numatm+i]>>h_z[k*numatm+i];
      }  
     }
  
      cudaMemcpy(d_x, h_x, sizef, cudaMemcpyHostToDevice);
      cudaMemcpy(d_y, h_y, sizef, cudaMemcpyHostToDevice);
      cudaMemcpy(d_z, h_z, sizef, cudaMemcpyHostToDevice);
      cudaMemcpy(d_xbox, h_xbox, sizef2, cudaMemcpyHostToDevice);
      cudaMemcpy(d_ybox, h_ybox, sizef2, cudaMemcpyHostToDevice);
      cudaMemcpy(d_zbox, h_zbox, sizef2, cudaMemcpyHostToDevice);

  
      near2=nthreads*(int(numatm*numfrm/nthreads)+1);
   
      p2_calc_gpu<<<near2/nthreads,nthreads >>>(d_x, d_y, d_z, d_ans, d_count, d_status, numatm,d_xbox,d_ybox,d_zbox, numfrm);
  
      cudaMemcpy(h_ans, d_ans, sizef, cudaMemcpyDeviceToHost);
      cudaMemcpy(h_count, d_count,sizei2,  cudaMemcpyDeviceToHost);
      cout<<h_ans[2]<<" "<<h_ans[10]<<"\n";
      for (int k=0;k<numfrm;k++) {
      sum=0;
      countsum=0;
      for (int i=0;i<numatm;i++){
        if (h_status[i]==1){
      outfile<<i<<"\t"<<9999<<" "<<endl;
      }
        if (h_status[i]!=1){
      outfile<<i<<"\t"<<h_ans[k*numfrm+i]<<endl;
      sum=sum+h_ans[k*numfrm+i];
      countsum=countsum+h_count[k*numfrm+i];
      }
      }
      outfile<<"#"<<sum/countsum<<endl;
      p2<<k<<" "<<sum/countsum<<endl;
      totalsum=totalsum+sum;
      totalcount=totalcount+countsum;
}     
      outfile<<"##final value is : "<<(totalsum/totalcount)<<endl;
      p2.close();
      outfile.close();

/**************************************************************************************/

        cudaFree(d_x);
        cudaFree(d_y);
        cudaFree(d_z);
        cudaFree(d_ans);
        cudaFree(d_status);
        cudaFree(d_count);
        cudaFree(d_xbox);
        cudaFree(d_ybox);
        cudaFree(d_zbox);

        free(h_x);
        free(h_y);
        free(h_z);
        free(h_ans);
        free(h_status);
        free(h_count);
        cudaFree(h_xbox);
        cudaFree(h_ybox);
        cudaFree(h_zbox);

  return 0;
}



	.file	"tmpxft_0028eafe_00000000-6_P2-gpu.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3770:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3770:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.type	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.isra.0, @function
_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.isra.0:
.LFB4508:
	.cfi_startproc
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	(%rdi), %rax
	movq	-24(%rax), %rax
	movq	240(%rdi,%rax), %rbx
	testq	%rbx, %rbx
	jne	.L3
	call	_ZSt16__throw_bad_castv@PLT
.L3:
	cmpb	$0, 56(%rbx)
	movq	%rdi, %rbp
	movq	%rsi, %r12
	je	.L4
	movb	67(%rbx), %al
	jmp	.L5
.L4:
	movq	%rbx, %rdi
	call	_ZNKSt5ctypeIcE13_M_widen_initEv@PLT
	movq	(%rbx), %rax
	movl	$10, %esi
	movq	%rbx, %rdi
	call	*48(%rax)
.L5:
	popq	%rbx
	.cfi_def_cfa_offset 24
	movq	%r12, %rsi
	movq	%rbp, %rdi
	movsbl	%al, %edx
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	jmp	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_@PLT
	.cfi_endproc
.LFE4508:
	.size	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.isra.0, .-_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.isra.0
	.align 2
	.type	_ZNSolsEPFRSoS_E.isra.0, @function
_ZNSolsEPFRSoS_E.isra.0:
.LFB4510:
	.cfi_startproc
	jmp	*%rsi
	.cfi_endproc
.LFE4510:
	.size	_ZNSolsEPFRSoS_E.isra.0, .-_ZNSolsEPFRSoS_E.isra.0
	.globl	_Z50__device_stub__Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_iPfS_S_S_PiS0_yS_S_S_i
	.type	_Z50__device_stub__Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_iPfS_S_S_PiS0_yS_S_S_i, @function
_Z50__device_stub__Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_iPfS_S_S_PiS0_yS_S_S_i:
.LFB3792:
	.cfi_startproc
	endbr64
	subq	$248, %rsp
	.cfi_def_cfa_offset 256
	movq	264(%rsp), %rax
	movq	%rdi, 72(%rsp)
	leaq	96(%rsp), %rdi
	movq	%rsi, 64(%rsp)
	leaq	108(%rsp), %rsi
	movq	%rax, 24(%rsp)
	movq	272(%rsp), %rax
	movq	%rdx, 56(%rsp)
	leaq	80(%rsp), %rdx
	movq	%rax, 16(%rsp)
	movq	280(%rsp), %rax
	movq	%rcx, 48(%rsp)
	leaq	88(%rsp), %rcx
	movq	%r8, 40(%rsp)
	movq	%r9, 32(%rsp)
	movq	%rax, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 232(%rsp)
	xorl	%eax, %eax
	leaq	72(%rsp), %rax
	movl	$1, 104(%rsp)
	movq	%rax, 144(%rsp)
	leaq	64(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	56(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 176(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 184(%rsp)
	leaq	256(%rsp), %rax
	movq	%rax, 192(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 200(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 208(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 216(%rsp)
	leaq	288(%rsp), %rax
	movq	%rax, 224(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 96(%rsp)
	movq	%rax, 108(%rsp)
	movl	$1, 116(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L9
	pushq	88(%rsp)
	.cfi_def_cfa_offset 264
	leaq	_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i(%rip), %rdi
	pushq	88(%rsp)
	.cfi_def_cfa_offset 272
	movq	124(%rsp), %rcx
	movl	132(%rsp), %r8d
	movq	112(%rsp), %rsi
	movl	120(%rsp), %edx
	leaq	160(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 264
	popq	%rdx
	.cfi_def_cfa_offset 256
.L9:
	movq	232(%rsp), %rax
	subq	%fs:40, %rax
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	addq	$248, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3792:
	.size	_Z50__device_stub__Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_iPfS_S_S_PiS0_yS_S_S_i, .-_Z50__device_stub__Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_iPfS_S_S_PiS0_yS_S_S_i
	.globl	_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i
	.type	_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i, @function
_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i:
.LFB3793:
	.cfi_startproc
	endbr64
	jmp	_Z50__device_stub__Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_iPfS_S_S_PiS0_yS_S_S_i
	.cfi_endproc
.LFE3793:
	.size	_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i, .-_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3795:
	.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	.LC0(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i(%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
.LFE3795:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata.str1.1
.LC2:
	.string	"XYZ.dat"
.LC3:
	.string	"bond.dat"
.LC4:
	.string	"pbc.dat"
.LC5:
	.string	"avrg.p2"
.LC6:
	.string	"local-order.dat"
.LC7:
	.string	"#"
.LC8:
	.string	" "
.LC9:
	.string	"\n"
.LC10:
	.string	"\t"
.LC11:
	.string	"##final value is : "
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3766:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3766
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	xorl	%esi, %esi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	leaq	-1624(%rbp), %r14
	pushq	%r13
	movq	%r14, %rdi
	pushq	%r12
	pushq	%rbx
	subq	$2856, %rsp
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	leaq	-2664(%rbp), %rax
	movq	%rsi, -2672(%rbp)
	movq	%rax, -2680(%rbp)
	movb	$0, -2664(%rbp)
.LEHB0:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE0:
	leaq	-1104(%rbp), %r13
	movq	%r13, %rdi
.LEHB1:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE1:
	leaq	-584(%rbp), %rbx
	movq	%rbx, %rdi
.LEHB2:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE2:
	leaq	-2648(%rbp), %rax
	movq	%rax, %rdi
	movq	%rax, %r15
.LEHB3:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE3:
	leaq	-2136(%rbp), %r12
	movq	%r12, %rdi
.LEHB4:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE4:
	movl	$8, %edx
	leaq	.LC2(%rip), %rsi
	movq	%r14, %rdi
.LEHB5:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	movl	$8, %edx
	leaq	.LC3(%rip), %rsi
	movq	%rbx, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	movl	$8, %edx
	leaq	.LC4(%rip), %rsi
	movq	%r13, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	movl	$16, %edx
	leaq	.LC5(%rip), %rsi
	movq	%r12, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	movl	$16, %edx
	leaq	.LC6(%rip), %rsi
	movq	%r15, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	leaq	-2784(%rbp), %rsi
	movq	%rbx, %rdi
	call	_ZNSi10_M_extractIyEERSiRT_@PLT
	leaq	-2788(%rbp), %rsi
	movq	%rbx, %rdi
	call	_ZNSirsERi@PLT
	movl	-2784(%rbp), %eax
	movl	-2788(%rbp), %r12d
	sall	$2, %eax
	movl	%eax, %r15d
	imull	%r12d, %eax
	movq	%rax, %rdi
	movq	%rax, -2808(%rbp)
	call	malloc@PLT
	movq	-2808(%rbp), %rdi
	movq	%rax, -2840(%rbp)
	call	malloc@PLT
	movq	-2808(%rbp), %rdi
	movq	%rax, -2848(%rbp)
	call	malloc@PLT
	movq	-2808(%rbp), %rdi
	movq	%rax, -2856(%rbp)
	call	malloc@PLT
	movq	%rax, %rbx
	movl	%r15d, %eax
	movq	%rax, %rdi
	movq	%rax, %r15
	call	malloc@PLT
	movq	-2808(%rbp), %rdi
	movq	%rax, -2832(%rbp)
	call	malloc@PLT
	movq	%rax, -2864(%rbp)
	leal	0(,%r12,4), %eax
	movq	%rax, %rdi
	movq	%rax, -2816(%rbp)
	call	malloc@PLT
	movq	-2816(%rbp), %rdi
	movq	%rax, -2872(%rbp)
	call	malloc@PLT
	movq	-2816(%rbp), %rdi
	movq	%rax, -2880(%rbp)
	call	malloc@PLT
	movq	-2808(%rbp), %rsi
	leaq	-2728(%rbp), %rdi
	movq	%rax, -2888(%rbp)
	call	cudaMalloc@PLT
	movq	-2808(%rbp), %rsi
	leaq	-2720(%rbp), %rdi
	call	cudaMalloc@PLT
	movq	-2808(%rbp), %rsi
	leaq	-2712(%rbp), %rdi
	call	cudaMalloc@PLT
	movq	-2808(%rbp), %rsi
	leaq	-2736(%rbp), %rdi
	call	cudaMalloc@PLT
	leaq	-2768(%rbp), %rdi
	movq	%r15, %rsi
	call	cudaMalloc@PLT
	movq	-2808(%rbp), %rsi
	leaq	-2776(%rbp), %rdi
	call	cudaMalloc@PLT
	movq	-2816(%rbp), %rsi
	leaq	-2760(%rbp), %rdi
	call	cudaMalloc@PLT
	movq	-2816(%rbp), %rsi
	leaq	-2752(%rbp), %rdi
	call	cudaMalloc@PLT
	movq	-2816(%rbp), %rsi
	leaq	-2744(%rbp), %rdi
	call	cudaMalloc@PLT
	xorl	%r12d, %r12d
	leaq	-584(%rbp), %r13
.L17:
	cmpq	-2784(%rbp), %r12
	jnb	.L59
	movq	-2832(%rbp), %rax
	movq	%r13, %rdi
	leaq	(%rax,%r12,4), %rsi
	call	_ZNSirsERi@PLT
	incq	%r12
	jmp	.L17
.L59:
	movq	-2832(%rbp), %rsi
	movq	-2768(%rbp), %rdi
	movl	$1, %ecx
	movq	%r15, %rdx
	call	cudaMemcpy@PLT
	xorl	%ecx, %ecx
	movq	%rcx, -2824(%rbp)
.L19:
	movl	-2824(%rbp), %r12d
	cmpl	%r12d, -2788(%rbp)
	jle	.L60
	movl	%r12d, %eax
	movl	$100, %ecx
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	.L20
	leaq	.LC7(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movl	%r12d, %esi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L20:
	movq	-2824(%rbp), %rax
	leaq	-1104(%rbp), %rdi
	leaq	0(,%rax,4), %r12
	movq	-2872(%rbp), %rax
	leaq	(%rax,%r12), %rsi
	call	_ZNSi10_M_extractIfEERSiRT_@PLT
	movq	%rax, %rdi
	movq	-2880(%rbp), %rax
	leaq	(%rax,%r12), %rsi
	call	_ZNSi10_M_extractIfEERSiRT_@PLT
	movq	%rax, %rdi
	movq	-2888(%rbp), %rax
	leaq	(%rax,%r12), %rsi
	call	_ZNSi10_M_extractIfEERSiRT_@PLT
	leaq	-1624(%rbp), %r12
	leaq	-2784(%rbp), %rsi
	movq	%r12, %rdi
	call	_ZNSi10_M_extractIyEERSiRT_@PLT
	leaq	-2680(%rbp), %r13
	movq	%r12, %rdi
	movq	%r13, %rsi
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.isra.0
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.isra.0
	xorl	%r12d, %r12d
	leaq	-58(%rbp), %r15
.L21:
	cmpq	-2784(%rbp), %r12
	jnb	.L61
	movq	-1624(%rbp), %rax
	leaq	-1624(%rbp), %r13
	movl	$2, %edx
	movq	%r15, %rsi
	movq	%r13, %rdi
	movq	-24(%rax), %rax
	movq	-1608(%rbp,%rax), %r14
	call	_ZSt17__istream_extractRSiPcl@PLT
	movq	-1624(%rbp), %rax
	addq	-24(%rax), %r13
	cmpl	$0, 32(%r13)
	jne	.L22
	decq	%r14
	cmpq	$1, %r14
	jbe	.L22
	movq	232(%r13), %rdi
	call	_ZNSt15basic_streambufIcSt11char_traitsIcEE5sgetcEv@PLT
	incl	%eax
	jne	.L22
	movq	-1624(%rbp), %rax
	movl	$2, %esi
	movq	-24(%rax), %rax
	leaq	-1624(%rbp,%rax), %rdi
	call	_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate@PLT
.L22:
	movq	-2824(%rbp), %rax
	imulq	-2784(%rbp), %rax
	leaq	-1624(%rbp), %rdi
	movq	-2840(%rbp), %rcx
	addq	%r12, %rax
	leaq	(%rcx,%rax,4), %rsi
	call	_ZNSi10_M_extractIfEERSiRT_@PLT
	movq	%rax, %rdi
	movq	-2824(%rbp), %rax
	imulq	-2784(%rbp), %rax
	movq	-2848(%rbp), %rcx
	addq	%r12, %rax
	leaq	(%rcx,%rax,4), %rsi
	call	_ZNSi10_M_extractIfEERSiRT_@PLT
	movq	%rax, %rdi
	movq	-2824(%rbp), %rax
	imulq	-2784(%rbp), %rax
	movq	-2856(%rbp), %rcx
	addq	%r12, %rax
	leaq	(%rcx,%rax,4), %rsi
	call	_ZNSi10_M_extractIfEERSiRT_@PLT
	incq	%r12
	jmp	.L21
.L61:
	incq	-2824(%rbp)
	jmp	.L19
.L60:
	movq	-2808(%rbp), %rdx
	movq	-2840(%rbp), %rsi
	movl	$1, %ecx
	movq	-2728(%rbp), %rdi
	call	cudaMemcpy@PLT
	movq	-2808(%rbp), %rdx
	movq	-2848(%rbp), %rsi
	movl	$1, %ecx
	movq	-2720(%rbp), %rdi
	call	cudaMemcpy@PLT
	movq	-2808(%rbp), %rdx
	movq	-2856(%rbp), %rsi
	movl	$1, %ecx
	movq	-2712(%rbp), %rdi
	call	cudaMemcpy@PLT
	movq	-2816(%rbp), %rdx
	movq	-2872(%rbp), %rsi
	movl	$1, %ecx
	movq	-2760(%rbp), %rdi
	call	cudaMemcpy@PLT
	movq	-2816(%rbp), %rdx
	movq	-2880(%rbp), %rsi
	movl	$1, %ecx
	movq	-2752(%rbp), %rdi
	call	cudaMemcpy@PLT
	movq	-2816(%rbp), %rdx
	movq	-2888(%rbp), %rsi
	movl	$1, %ecx
	movq	-2744(%rbp), %rdi
	call	cudaMemcpy@PLT
	movl	$33554433, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	movslq	-2788(%rbp), %rax
	imulq	-2784(%rbp), %rax
	salq	$7, %rdx
	shrq	$7, %rax
	incl	%eax
	sall	$7, %eax
	cltq
	shrq	$7, %rax
	movl	%eax, -2704(%rbp)
	movabsq	$4294967297, %rax
	movq	%rax, -2700(%rbp)
	movq	-2704(%rbp), %rdi
	movl	-2696(%rbp), %esi
	call	__cudaPushCallConfiguration@PLT
	movq	-2736(%rbp), %rcx
	testl	%eax, %eax
	jne	.L25
	pushq	%rdx
	movl	-2788(%rbp), %eax
	movq	-2768(%rbp), %r9
	movq	-2776(%rbp), %r8
	pushq	%rax
	pushq	-2744(%rbp)
	pushq	-2752(%rbp)
	pushq	-2760(%rbp)
	movq	-2712(%rbp), %rdx
	pushq	-2784(%rbp)
	movq	-2720(%rbp), %rsi
	movq	-2728(%rbp), %rdi
	.cfi_escape 0x2e,0x30
	call	_Z50__device_stub__Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_iPfS_S_S_PiS0_yS_S_S_i
	addq	$48, %rsp
.L25:
	movq	-2808(%rbp), %rdx
	movq	-2736(%rbp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdi
	.cfi_escape 0x2e,0
	call	cudaMemcpy@PLT
	movq	-2808(%rbp), %rdx
	movq	-2776(%rbp), %rsi
	movl	$2, %ecx
	movq	-2864(%rbp), %rdi
	call	cudaMemcpy@PLT
	leaq	_ZSt4cout(%rip), %rdi
	cvtss2sd	8(%rbx), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC8(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	cvtss2sd	40(%rbx), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC9(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	$0x00000000, -2824(%rbp)
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	movl	%eax, -2808(%rbp)
.L26:
	movl	-2808(%rbp), %eax
	cmpl	%eax, -2788(%rbp)
	jle	.L62
	movl	$0x00000000, -2816(%rbp)
	xorl	%r12d, %r12d
	xorl	%r13d, %r13d
.L32:
	cmpq	-2784(%rbp), %r12
	movl	%r12d, %r14d
	leaq	-2648(%rbp), %rdi
	jnb	.L63
	movq	-2832(%rbp), %rax
	cmpl	$1, (%rax,%r12,4)
	je	.L27
.L29:
	leaq	-2648(%rbp), %rdi
	movl	%r14d, %esi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC10(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	jmp	.L64
.L27:
	movl	%r14d, %esi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC10(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movl	$9999, %esi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC8(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	-2832(%rbp), %rax
	cmpl	$1, (%rax,%r12,4)
	je	.L30
	jmp	.L29
.L64:
	movl	-2808(%rbp), %edx
	imull	-2788(%rbp), %edx
	movq	%rax, %rdi
	addl	%r14d, %edx
	movslq	%edx, %rdx
	cvtss2sd	(%rbx,%rdx,4), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	-2808(%rbp), %eax
	imull	-2788(%rbp), %eax
	movss	-2816(%rbp), %xmm2
	movq	-2864(%rbp), %rcx
	addl	%r14d, %eax
	cltq
	addss	(%rbx,%rax,4), %xmm2
	addl	(%rcx,%rax,4), %r13d
	movss	%xmm2, -2816(%rbp)
.L30:
	incq	%r12
	jmp	.L32
.L63:
	leaq	.LC7(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cvtsi2ssl	%r13d, %xmm1
	movss	-2816(%rbp), %xmm0
	movq	%rax, %rdi
	divss	%xmm1, %xmm0
	cvtss2sd	%xmm0, %xmm4
	movaps	%xmm4, %xmm0
	movq	%xmm4, %r12
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	-2808(%rbp), %esi
	leaq	-2136(%rbp), %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC8(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	%r12, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movss	-2824(%rbp), %xmm3
	addss	-2816(%rbp), %xmm3
	addl	%r13d, %r15d
	incl	-2808(%rbp)
	movss	%xmm3, -2824(%rbp)
	jmp	.L26
.L62:
	leaq	-2648(%rbp), %rax
	leaq	.LC11(%rip), %rsi
	movq	%rax, %rdi
	movq	%rax, %r14
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cvtsi2ssl	%r15d, %xmm1
	movss	-2824(%rbp), %xmm0
	movq	%rax, %rdi
	divss	%xmm1, %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	-2136(%rbp), %r12
	movq	%r12, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
	movq	%r14, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
	movq	-2728(%rbp), %rdi
	call	cudaFree@PLT
	movq	-2720(%rbp), %rdi
	call	cudaFree@PLT
	movq	-2712(%rbp), %rdi
	call	cudaFree@PLT
	movq	-2736(%rbp), %rdi
	call	cudaFree@PLT
	movq	-2768(%rbp), %rdi
	call	cudaFree@PLT
	movq	-2776(%rbp), %rdi
	call	cudaFree@PLT
	movq	-2760(%rbp), %rdi
	call	cudaFree@PLT
	movq	-2752(%rbp), %rdi
	call	cudaFree@PLT
	movq	-2744(%rbp), %rdi
	call	cudaFree@PLT
	movq	-2840(%rbp), %rdi
	call	free@PLT
	movq	-2848(%rbp), %rdi
	call	free@PLT
	movq	-2856(%rbp), %rdi
	call	free@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movq	-2832(%rbp), %rdi
	call	free@PLT
	movq	-2864(%rbp), %rdi
	call	free@PLT
	movq	-2872(%rbp), %rdi
	call	cudaFree@PLT
	movq	-2880(%rbp), %rdi
	call	cudaFree@PLT
	movq	-2888(%rbp), %rdi
	call	cudaFree@PLT
.LEHE5:
	movq	%r12, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	%r14, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	leaq	-584(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	leaq	-1104(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	leaq	-1624(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	leaq	-2680(%rbp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	je	.L40
	jmp	.L57
.L51:
	endbr64
	movq	%rax, %rbx
.L33:
	leaq	-2136(%rbp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L34
.L50:
	endbr64
	movq	%rax, %rbx
.L34:
	leaq	-2648(%rbp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L35
.L49:
	endbr64
	movq	%rax, %rbx
.L35:
	leaq	-584(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L36
.L48:
	endbr64
	movq	%rax, %rbx
.L36:
	leaq	-1104(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L37
.L47:
	endbr64
	movq	%rax, %rbx
.L37:
	leaq	-1624(%rbp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L38
.L46:
	endbr64
	movq	%rax, %rbx
.L38:
	leaq	-2680(%rbp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L57
	movq	%rbx, %rdi
.LEHB6:
	call	_Unwind_Resume@PLT
.LEHE6:
.L57:
	call	__stack_chk_fail@PLT
.L40:
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3766:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3766:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3766-.LLSDACSB3766
.LLSDACSB3766:
	.uleb128 .LEHB0-.LFB3766
	.uleb128 .LEHE0-.LEHB0
	.uleb128 .L46-.LFB3766
	.uleb128 0
	.uleb128 .LEHB1-.LFB3766
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L47-.LFB3766
	.uleb128 0
	.uleb128 .LEHB2-.LFB3766
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L48-.LFB3766
	.uleb128 0
	.uleb128 .LEHB3-.LFB3766
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L49-.LFB3766
	.uleb128 0
	.uleb128 .LEHB4-.LFB3766
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L50-.LFB3766
	.uleb128 0
	.uleb128 .LEHB5-.LFB3766
	.uleb128 .LEHE5-.LEHB5
	.uleb128 .L51-.LFB3766
	.uleb128 0
	.uleb128 .LEHB6-.LFB3766
	.uleb128 .LEHE6-.LEHB6
	.uleb128 0
	.uleb128 0
.LLSDACSE3766:
	.section	.text.startup
	.size	main, .-main
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include <stdio.h>
#include <iostream>
#include <fstream>
#include <hip/hip_runtime.h>
#include <cmath>
#include <string>
#include <cstdio>



using namespace std;


__global__ void p2_calc_gpu(float* d_x, float* d_y, float* d_z, float* d_ans, int* d_count, int* d_status, unsigned long long int numatm,float* d_xbox,float* d_ybox,float* d_zbox, int numfrm)
{
 int numcount;
 float r,cut,dx,dy,dz;
 float px,py,pz,nx,ny,nz,rp,rn,rpn,vcos,accu;
 cut=8.75;
 int conf,nat;
 unsigned long long int i = blockIdx.x * blockDim.x + threadIdx.x;
    
 if ( i < numatm*numfrm) {
    conf=int(i/numatm);
    nat=int(i%numatm);
    d_ans[i]=0;   
    d_count[i]=0;
    accu=0;
    numcount=0;
    if (d_status[nat]!=1){
        d_count[i]=d_count[i]+1;
        for (int j=0;j<numatm;j++){
             if (d_status[j]!=1){
             dx=d_x[i]-d_x[conf*numatm+j];
             dy=d_y[i]-d_y[conf*numatm+j];
             dz=d_z[i]-d_z[conf*numatm+j];

             dx=dx-d_xbox[conf]*(round(dx/d_xbox[conf]));
             dy=dy-d_ybox[conf]*(round(dy/d_ybox[conf]));
             dz=dz-d_zbox[conf]*(round(dz/d_zbox[conf]));

             r=sqrt(dx*dx+dy*dy+dz*dz);
             if (r<cut) {
                  
                   px=d_x[i+1]-d_x[i-1] ;     
                   py=d_y[i+1]-d_y[i-1] ;      
                   pz=d_z[i+1]-d_z[i-1] ;       
       
                   nx=d_x[conf*numatm+j+1]-d_x[conf*numatm+j-1] ;        
                   ny=d_y[conf*numatm+j+1]-d_y[conf*numatm+j-1] ;         
                   nz=d_z[conf*numatm+j+1]-d_z[conf*numatm+j-1] ;          
          
                   rp=sqrt(px*px+py*py+pz*pz);
                   rn=sqrt(nx*nx+ny*ny+nz*nz);
                   rpn= (nx*px+ny*py+nz*pz);
                   
                   vcos= rpn/(abs(rp)*abs(rn));
                   //cout<<i<<"\t"<<j<<"\t"<<vcos<<endl;
                   accu=accu+((3*vcos*vcos-1)/2.0);
                    numcount++;}
              } 
            }    
         if (numcount==0){
           d_ans[i]=0;
         }else{
         d_ans[i]=accu/numcount;    
         }
      }
    }
 }

int main()
{ 
 // int a,b,c;
  unsigned long long int numatm;
  int numfrm,countsum;
  int* h_count,*d_count;
  int* h_status,*d_status;
  float* h_xbox,*h_ybox,*h_zbox;
  float* d_xbox,*d_ybox,*d_zbox;
  float sum;  
  float* h_ans,*d_ans;
  float* h_x,*h_y,*h_z;
  float* d_x,*d_y,*d_z;
  char atmnm[2];
  string comment;
  unsigned long long int near2;
  int nthreads=128;
  int totalcount;
  float totalsum;
 
  
  ifstream infile,pbc,bond;
  ofstream outfile,p2;
  infile.open("XYZ.dat");
  bond.open("bond.dat");
  pbc.open("pbc.dat");
  p2.open("avrg.p2");
  outfile.open("local-order.dat");


bond>>numatm;
bond>>numfrm;
//numfrm=1;


//  cout<<numatm<<"\t"<<near2<<endl;
  unsigned int sizef= numfrm*numatm*sizeof(float);
  unsigned int sizef2= numfrm*sizeof(float);

  unsigned int sizei= numatm*sizeof(int);
  unsigned int sizei2= numfrm*numatm*sizeof(int);

  h_x= (float *) malloc(sizef);
  h_y= (float *) malloc(sizef);
  h_z= (float *) malloc(sizef);
  h_ans=  (float *) malloc(sizef);
  h_status= (int *) malloc(sizei);
  h_count= (int *) malloc(sizei2);
  h_xbox=  (float *) malloc(sizef2);
  h_ybox=  (float *) malloc(sizef2);
  h_zbox=  (float *) malloc(sizef2);

  hipMalloc((void**)&d_x, sizef);
  hipMalloc((void**)&d_y, sizef);
  hipMalloc((void**)&d_z, sizef);
  hipMalloc((void**)&d_ans, sizef);
  hipMalloc((void**)&d_status, sizei);
  hipMalloc((void**)&d_count, sizei2);
  hipMalloc((void**)&d_xbox, sizef2);
  hipMalloc((void**)&d_ybox, sizef2);
  hipMalloc((void**)&d_zbox, sizef2);

//  bond>>h_status[0]>>a>>b;
  for (int i=0;i<numatm;i++) {
       bond>>h_status[i];
  }
/****copying status of carbon here as it need not to be copy again & again  ************/
  hipMemcpy(d_status, h_status, sizei, hipMemcpyHostToDevice);

/*****calculation over different frames **************************************/
  totalcount=0;
  totalsum=0;

  for (int k=0;k<numfrm;k++) {
    if(!(k%100)){
       cout<<"#"<<k<<endl;
    }
       pbc>>h_xbox[k]>>h_ybox[k]>>h_zbox[k];
      
      infile>>numatm;
      getline(infile,comment);
      getline(infile,comment);

      for (int i=0;i<numatm;i++) {
           infile>>atmnm>>h_x[k*numatm+i]>>h_y[k*numatm+i]>>h_z[k*numatm+i];
      }  
     }
  
      hipMemcpy(d_x, h_x, sizef, hipMemcpyHostToDevice);
      hipMemcpy(d_y, h_y, sizef, hipMemcpyHostToDevice);
      hipMemcpy(d_z, h_z, sizef, hipMemcpyHostToDevice);
      hipMemcpy(d_xbox, h_xbox, sizef2, hipMemcpyHostToDevice);
      hipMemcpy(d_ybox, h_ybox, sizef2, hipMemcpyHostToDevice);
      hipMemcpy(d_zbox, h_zbox, sizef2, hipMemcpyHostToDevice);

  
      near2=nthreads*(int(numatm*numfrm/nthreads)+1);
   
      p2_calc_gpu<<<near2/nthreads,nthreads >>>(d_x, d_y, d_z, d_ans, d_count, d_status, numatm,d_xbox,d_ybox,d_zbox, numfrm);
  
      hipMemcpy(h_ans, d_ans, sizef, hipMemcpyDeviceToHost);
      hipMemcpy(h_count, d_count,sizei2,  hipMemcpyDeviceToHost);
      cout<<h_ans[2]<<" "<<h_ans[10]<<"\n";
      for (int k=0;k<numfrm;k++) {
      sum=0;
      countsum=0;
      for (int i=0;i<numatm;i++){
        if (h_status[i]==1){
      outfile<<i<<"\t"<<9999<<" "<<endl;
      }
        if (h_status[i]!=1){
      outfile<<i<<"\t"<<h_ans[k*numfrm+i]<<endl;
      sum=sum+h_ans[k*numfrm+i];
      countsum=countsum+h_count[k*numfrm+i];
      }
      }
      outfile<<"#"<<sum/countsum<<endl;
      p2<<k<<" "<<sum/countsum<<endl;
      totalsum=totalsum+sum;
      totalcount=totalcount+countsum;
}     
      outfile<<"##final value is : "<<(totalsum/totalcount)<<endl;
      p2.close();
      outfile.close();

/**************************************************************************************/

        hipFree(d_x);
        hipFree(d_y);
        hipFree(d_z);
        hipFree(d_ans);
        hipFree(d_status);
        hipFree(d_count);
        hipFree(d_xbox);
        hipFree(d_ybox);
        hipFree(d_zbox);

        free(h_x);
        free(h_y);
        free(h_z);
        free(h_ans);
        free(h_status);
        free(h_count);
        hipFree(h_xbox);
        hipFree(h_ybox);
        hipFree(h_zbox);

  return 0;
}



	.text
	.file	"P2-gpu.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z26__device_stub__p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i # -- Begin function _Z26__device_stub__p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i
	.type	_Z26__device_stub__p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i,@function
_Z26__device_stub__p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i: # @_Z26__device_stub__p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$192, %rsp
	.cfi_def_cfa_offset 240
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	16(%rsp), %r8
	movq	%r9, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	240(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	248(%rsp), %rax
	movq	%rax, 56(%rbx)
	leaq	256(%rsp), %rax
	movq	%rax, 64(%rbx)
	leaq	264(%rsp), %rax
	movq	%rax, 72(%rbx)
	leaq	272(%rsp), %rax
	movq	%rax, 80(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%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	$_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$208, %rsp
	.cfi_adjust_cfa_offset -208
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z26__device_stub__p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i, .Lfunc_end0-_Z26__device_stub__p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$2824, %rsp                     # imm = 0xB08
	.cfi_def_cfa_offset 2880
	.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	224(%rsp), %rax
	movq	%rax, -16(%rax)
	movq	$0, -8(%rax)
	movb	$0, (%rax)
.Ltmp0:
	.cfi_escape 0x2e, 0x00
	leaq	240(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev
.Ltmp1:
# %bb.1:
.Ltmp3:
	.cfi_escape 0x2e, 0x00
	leaq	2304(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev
.Ltmp4:
# %bb.2:
.Ltmp6:
	.cfi_escape 0x2e, 0x00
	leaq	1784(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev
.Ltmp7:
# %bb.3:
.Ltmp9:
	.cfi_escape 0x2e, 0x00
	leaq	760(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev
.Ltmp10:
# %bb.4:
.Ltmp12:
	.cfi_escape 0x2e, 0x00
	leaq	1272(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev
.Ltmp13:
# %bb.5:
.Ltmp15:
	.cfi_escape 0x2e, 0x00
	leaq	240(%rsp), %rdi
	movl	$.L.str, %esi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp16:
# %bb.6:
.Ltmp17:
	.cfi_escape 0x2e, 0x00
	leaq	1784(%rsp), %rdi
	movl	$.L.str.1, %esi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp18:
# %bb.7:
.Ltmp19:
	.cfi_escape 0x2e, 0x00
	leaq	2304(%rsp), %rdi
	movl	$.L.str.2, %esi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp20:
# %bb.8:
.Ltmp21:
	.cfi_escape 0x2e, 0x00
	leaq	1272(%rsp), %rdi
	movl	$.L.str.3, %esi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp22:
# %bb.9:
.Ltmp23:
	.cfi_escape 0x2e, 0x00
	leaq	760(%rsp), %rdi
	movl	$.L.str.4, %esi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp24:
# %bb.10:
.Ltmp25:
	.cfi_escape 0x2e, 0x00
	leaq	1784(%rsp), %rdi
	leaq	24(%rsp), %rsi
	callq	_ZNSi10_M_extractIyEERSiRT_
.Ltmp26:
# %bb.11:                               # %_ZNSirsERy.exit
.Ltmp27:
	.cfi_escape 0x2e, 0x00
	leaq	1784(%rsp), %rdi
	leaq	12(%rsp), %rsi
	callq	_ZNSirsERi
.Ltmp28:
# %bb.12:
	movl	12(%rsp), %r14d
	movl	24(%rsp), %r15d
	shll	$2, %r14d
	movl	%r14d, %ebx
	imull	%r15d, %ebx
	shll	$2, %r15d
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, 72(%rsp)                  # 8-byte Spill
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, 64(%rsp)                  # 8-byte Spill
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, 56(%rsp)                  # 8-byte Spill
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, %r13
	.cfi_escape 0x2e, 0x00
	movq	%r15, %rdi
	callq	malloc
	movq	%rax, 48(%rsp)                  # 8-byte Spill
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, 104(%rsp)                 # 8-byte Spill
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 96(%rsp)                  # 8-byte Spill
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 88(%rsp)                  # 8-byte Spill
	.cfi_escape 0x2e, 0x00
	movq	%r14, 32(%rsp)                  # 8-byte Spill
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, 80(%rsp)                  # 8-byte Spill
.Ltmp30:
	.cfi_escape 0x2e, 0x00
	leaq	128(%rsp), %rdi
	movq	%rbx, 16(%rsp)                  # 8-byte Spill
	movq	%rbx, %rsi
	callq	hipMalloc
.Ltmp31:
# %bb.13:
.Ltmp32:
	.cfi_escape 0x2e, 0x00
	leaq	120(%rsp), %rdi
	movq	16(%rsp), %rsi                  # 8-byte Reload
	callq	hipMalloc
.Ltmp33:
# %bb.14:
.Ltmp34:
	.cfi_escape 0x2e, 0x00
	leaq	112(%rsp), %rdi
	movq	16(%rsp), %rsi                  # 8-byte Reload
	callq	hipMalloc
.Ltmp35:
# %bb.15:
.Ltmp36:
	.cfi_escape 0x2e, 0x00
	leaq	136(%rsp), %rdi
	movq	16(%rsp), %rsi                  # 8-byte Reload
	callq	hipMalloc
.Ltmp37:
# %bb.16:
.Ltmp38:
	.cfi_escape 0x2e, 0x00
	leaq	168(%rsp), %rdi
	movq	%r15, %rsi
	callq	hipMalloc
.Ltmp39:
# %bb.17:
.Ltmp40:
	.cfi_escape 0x2e, 0x00
	leaq	176(%rsp), %rdi
	movq	16(%rsp), %rsi                  # 8-byte Reload
	callq	hipMalloc
.Ltmp41:
# %bb.18:
.Ltmp42:
	.cfi_escape 0x2e, 0x00
	leaq	160(%rsp), %rdi
	movq	32(%rsp), %rsi                  # 8-byte Reload
	callq	hipMalloc
.Ltmp43:
# %bb.19:
.Ltmp44:
	.cfi_escape 0x2e, 0x00
	leaq	152(%rsp), %rdi
	movq	32(%rsp), %rsi                  # 8-byte Reload
	callq	hipMalloc
.Ltmp45:
# %bb.20:
.Ltmp46:
	.cfi_escape 0x2e, 0x00
	leaq	144(%rsp), %rdi
	movq	32(%rsp), %rsi                  # 8-byte Reload
	callq	hipMalloc
.Ltmp47:
# %bb.21:                               # %.preheader236
	cmpq	$0, 24(%rsp)
	je	.LBB1_25
# %bb.22:                               # %.lr.ph.preheader
	xorl	%ebx, %ebx
	leaq	1784(%rsp), %r14
	movq	48(%rsp), %r12                  # 8-byte Reload
.LBB1_23:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
.Ltmp48:
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_ZNSirsERi
.Ltmp49:
# %bb.24:                               #   in Loop: Header=BB1_23 Depth=1
	incq	%rbx
	addq	$4, %r12
	cmpq	%rbx, 24(%rsp)
	ja	.LBB1_23
.LBB1_25:                               # %._crit_edge
	movq	168(%rsp), %rdi
.Ltmp51:
	.cfi_escape 0x2e, 0x00
	movq	48(%rsp), %rsi                  # 8-byte Reload
	movq	%r15, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp52:
# %bb.26:                               # %.preheader235
	cmpl	$0, 12(%rsp)
	jle	.LBB1_56
# %bb.27:                               # %.lr.ph247
	xorl	%ebx, %ebx
	leaq	208(%rsp), %r15
	xorl	%r12d, %r12d
	movq	%r13, 192(%rsp)                 # 8-byte Spill
.LBB1_28:                               # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_44 Depth 2
	imull	$-1030792151, %r12d, %eax       # imm = 0xC28F5C29
	rorl	$2, %eax
	cmpl	$42949672, %eax                 # imm = 0x28F5C28
	ja	.LBB1_34
# %bb.29:                               #   in Loop: Header=BB1_28 Depth=1
.Ltmp53:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	$.L.str.5, %esi
	movl	$1, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp54:
# %bb.30:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
                                        #   in Loop: Header=BB1_28 Depth=1
.Ltmp55:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	%r12d, %esi
	callq	_ZNSolsEi
.Ltmp56:
# %bb.31:                               #   in Loop: Header=BB1_28 Depth=1
	movq	%rax, %r14
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
.Ltmp57:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp58:
# %bb.32:                               # %.noexc208
                                        #   in Loop: Header=BB1_28 Depth=1
.Ltmp59:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
.Ltmp60:
# %bb.33:                               # %.noexc209
                                        #   in Loop: Header=BB1_28 Depth=1
.Ltmp61:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp62:
.LBB1_34:                               # %_ZNSolsEPFRSoS_E.exit
                                        #   in Loop: Header=BB1_28 Depth=1
	movq	96(%rsp), %rax                  # 8-byte Reload
	leaq	(%rax,%r12,4), %rsi
.Ltmp63:
	.cfi_escape 0x2e, 0x00
	leaq	2304(%rsp), %rdi
	callq	_ZNSi10_M_extractIfEERSiRT_
.Ltmp64:
# %bb.35:                               # %_ZNSirsERf.exit
                                        #   in Loop: Header=BB1_28 Depth=1
	movq	88(%rsp), %rcx                  # 8-byte Reload
	leaq	(%rcx,%r12,4), %rsi
.Ltmp65:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSi10_M_extractIfEERSiRT_
.Ltmp66:
# %bb.36:                               # %_ZNSirsERf.exit150
                                        #   in Loop: Header=BB1_28 Depth=1
	movq	80(%rsp), %rcx                  # 8-byte Reload
	leaq	(%rcx,%r12,4), %rsi
.Ltmp67:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSi10_M_extractIfEERSiRT_
.Ltmp68:
# %bb.37:                               # %_ZNSirsERf.exit151
                                        #   in Loop: Header=BB1_28 Depth=1
.Ltmp69:
	.cfi_escape 0x2e, 0x00
	leaq	240(%rsp), %rdi
	leaq	24(%rsp), %rsi
	callq	_ZNSi10_M_extractIyEERSiRT_
.Ltmp70:
# %bb.38:                               # %_ZNSirsERy.exit152
                                        #   in Loop: Header=BB1_28 Depth=1
	movq	240(%rsp), %rax
	movq	-24(%rax), %rdi
	leaq	240(%rsp), %rax
	addq	%rax, %rdi
.Ltmp71:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp72:
# %bb.39:                               # %.noexc
                                        #   in Loop: Header=BB1_28 Depth=1
.Ltmp73:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %edx
	leaq	240(%rsp), %rdi
	movq	%r15, %rsi
	callq	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_
.Ltmp74:
# %bb.40:                               # %_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit
                                        #   in Loop: Header=BB1_28 Depth=1
	movq	240(%rsp), %rax
	movq	-24(%rax), %rdi
	leaq	240(%rsp), %rax
	addq	%rax, %rdi
.Ltmp75:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp76:
# %bb.41:                               # %.noexc154
                                        #   in Loop: Header=BB1_28 Depth=1
.Ltmp77:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %edx
	leaq	240(%rsp), %rdi
	movq	%r15, %rsi
	callq	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_
.Ltmp78:
# %bb.42:                               # %_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit156.preheader
                                        #   in Loop: Header=BB1_28 Depth=1
	movq	%r12, 40(%rsp)                  # 8-byte Spill
	cmpq	$0, 24(%rsp)
	je	.LBB1_55
# %bb.43:                               # %.lr.ph245.preheader
                                        #   in Loop: Header=BB1_28 Depth=1
	movq	72(%rsp), %r14                  # 8-byte Reload
	movq	64(%rsp), %r13                  # 8-byte Reload
	movq	56(%rsp), %r15                  # 8-byte Reload
	xorl	%r12d, %r12d
.LBB1_44:                               # %.lr.ph245
                                        #   Parent Loop BB1_28 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	240(%rsp), %rax
	movq	-24(%rax), %rax
	movq	256(%rsp,%rax), %rbp
.Ltmp80:
	.cfi_escape 0x2e, 0x00
	movl	$2, %edx
	leaq	240(%rsp), %rdi
	leaq	190(%rsp), %rsi
	callq	_ZSt17__istream_extractRSiPcl
.Ltmp81:
# %bb.45:                               # %.noexc158
                                        #   in Loop: Header=BB1_44 Depth=2
	movq	240(%rsp), %rax
	movq	-24(%rax), %rax
	cmpl	$0, 272(%rsp,%rax)
	jne	.LBB1_51
# %bb.46:                               # %.noexc158
                                        #   in Loop: Header=BB1_44 Depth=2
	addq	$-3, %rbp
	cmpq	$-3, %rbp
	ja	.LBB1_51
# %bb.47:                               #   in Loop: Header=BB1_44 Depth=2
	movq	472(%rsp,%rax), %rdi
	movq	16(%rdi), %rax
	cmpq	24(%rdi), %rax
	jae	.LBB1_48
.LBB1_51:                               # %_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_.exit
                                        #   in Loop: Header=BB1_44 Depth=2
	movq	24(%rsp), %rsi
	imulq	%rbx, %rsi
	addq	%r14, %rsi
.Ltmp86:
	.cfi_escape 0x2e, 0x00
	leaq	240(%rsp), %rdi
	callq	_ZNSi10_M_extractIfEERSiRT_
.Ltmp87:
# %bb.52:                               # %_ZNSirsERf.exit163
                                        #   in Loop: Header=BB1_44 Depth=2
	movq	24(%rsp), %rsi
	imulq	%rbx, %rsi
	addq	%r13, %rsi
.Ltmp88:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSi10_M_extractIfEERSiRT_
.Ltmp89:
# %bb.53:                               # %_ZNSirsERf.exit165
                                        #   in Loop: Header=BB1_44 Depth=2
	movq	24(%rsp), %rsi
	imulq	%rbx, %rsi
	addq	%r15, %rsi
.Ltmp90:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSi10_M_extractIfEERSiRT_
.Ltmp91:
# %bb.54:                               # %_ZNSirsERf.exit167
                                        #   in Loop: Header=BB1_44 Depth=2
	incq	%r12
	addq	$4, %r15
	addq	$4, %r13
	addq	$4, %r14
	cmpq	%r12, 24(%rsp)
	ja	.LBB1_44
	jmp	.LBB1_55
.LBB1_48:                               # %_ZNSt15basic_streambufIcSt11char_traitsIcEE5sgetcEv.exit.i
                                        #   in Loop: Header=BB1_44 Depth=2
	movq	(%rdi), %rax
.Ltmp82:
	.cfi_escape 0x2e, 0x00
	callq	*72(%rax)
.Ltmp83:
# %bb.49:                               # %.noexc159
                                        #   in Loop: Header=BB1_44 Depth=2
	cmpl	$-1, %eax
	jne	.LBB1_51
# %bb.50:                               #   in Loop: Header=BB1_44 Depth=2
	movq	240(%rsp), %rax
	movq	-24(%rax), %rax
	leaq	(%rsp,%rax), %rdi
	addq	$240, %rdi
	movl	32(%rdi), %esi
	orl	$2, %esi
.Ltmp84:
	.cfi_escape 0x2e, 0x00
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.Ltmp85:
	jmp	.LBB1_51
.LBB1_55:                               # %_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit156._crit_edge
                                        #   in Loop: Header=BB1_28 Depth=1
	movq	40(%rsp), %r12                  # 8-byte Reload
	incq	%r12
	movslq	12(%rsp), %rax
	addq	$4, %rbx
	cmpq	%rax, %r12
	movq	192(%rsp), %r13                 # 8-byte Reload
	leaq	208(%rsp), %r15
	jl	.LBB1_28
.LBB1_56:                               # %._crit_edge248
	movq	128(%rsp), %rdi
.Ltmp93:
	.cfi_escape 0x2e, 0x00
	movq	72(%rsp), %rsi                  # 8-byte Reload
	movq	16(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp94:
# %bb.57:
	movq	120(%rsp), %rdi
.Ltmp95:
	.cfi_escape 0x2e, 0x00
	movq	64(%rsp), %rsi                  # 8-byte Reload
	movq	16(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp96:
# %bb.58:
	movq	112(%rsp), %rdi
.Ltmp97:
	.cfi_escape 0x2e, 0x00
	movq	56(%rsp), %rsi                  # 8-byte Reload
	movq	16(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp98:
# %bb.59:
	movq	160(%rsp), %rdi
.Ltmp99:
	.cfi_escape 0x2e, 0x00
	movq	96(%rsp), %rsi                  # 8-byte Reload
	movq	32(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp100:
# %bb.60:
	movq	152(%rsp), %rdi
.Ltmp101:
	.cfi_escape 0x2e, 0x00
	movq	88(%rsp), %rsi                  # 8-byte Reload
	movq	32(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp102:
# %bb.61:
	movq	144(%rsp), %rdi
.Ltmp103:
	.cfi_escape 0x2e, 0x00
	movq	80(%rsp), %rsi                  # 8-byte Reload
	movq	32(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp104:
# %bb.62:
	movl	12(%rsp), %edi
	imull	24(%rsp), %edi
	subl	$-128, %edi
	sarl	$7, %edi
	btsq	$32, %rdi
.Ltmp105:
	.cfi_escape 0x2e, 0x00
	movabsq	$4294967424, %rdx               # imm = 0x100000080
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp106:
# %bb.63:
	testl	%eax, %eax
	jne	.LBB1_65
# %bb.64:
	movq	128(%rsp), %rdi
	movq	120(%rsp), %rsi
	movq	112(%rsp), %rdx
	movq	136(%rsp), %rcx
	movq	176(%rsp), %r8
	movq	168(%rsp), %r9
	movl	12(%rsp), %eax
.Ltmp107:
	.cfi_escape 0x2e, 0x30
	subq	$8, %rsp
	.cfi_adjust_cfa_offset 8
	pushq	%rax
	.cfi_adjust_cfa_offset 8
	pushq	160(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	176(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	192(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	64(%rsp)
	.cfi_adjust_cfa_offset 8
	callq	_Z26__device_stub__p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i
	addq	$48, %rsp
	.cfi_adjust_cfa_offset -48
.Ltmp108:
.LBB1_65:
	movq	136(%rsp), %rsi
.Ltmp109:
	.cfi_escape 0x2e, 0x00
	movq	%r13, %rdi
	movq	16(%rsp), %rdx                  # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp110:
# %bb.66:
	movq	176(%rsp), %rsi
.Ltmp111:
	.cfi_escape 0x2e, 0x00
	movq	104(%rsp), %rdi                 # 8-byte Reload
	movq	16(%rsp), %rdx                  # 8-byte Reload
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp112:
# %bb.67:
	cvtss2sd	8(%r13), %xmm0
.Ltmp113:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp114:
# %bb.68:                               # %_ZNSolsEf.exit
.Ltmp115:
	movq	%rax, %r14
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.6, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp116:
# %bb.69:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit170
	xorps	%xmm0, %xmm0
	cvtss2sd	40(%r13), %xmm0
.Ltmp117:
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp118:
# %bb.70:                               # %_ZNSolsEf.exit172
.Ltmp119:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.7, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp120:
# %bb.71:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit174.preheader
	cmpl	$0, 12(%rsp)
	jle	.LBB1_72
# %bb.81:                               # %.preheader.preheader
	xorps	%xmm0, %xmm0
	movss	%xmm0, 16(%rsp)                 # 4-byte Spill
	xorl	%ebp, %ebp
	leaq	760(%rsp), %r15
	xorl	%ebx, %ebx
.LBB1_82:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_84 Depth 2
	movl	%ebx, 32(%rsp)                  # 4-byte Spill
	cmpq	$0, 24(%rsp)
	xorps	%xmm0, %xmm0
	movss	%xmm0, 40(%rsp)                 # 4-byte Spill
	movl	$0, %ebx
	je	.LBB1_101
# %bb.83:                               # %.lr.ph252.preheader
                                        #   in Loop: Header=BB1_82 Depth=1
	movss	%xmm0, 40(%rsp)                 # 4-byte Spill
	xorl	%r12d, %r12d
	xorl	%ebx, %ebx
.LBB1_84:                               # %.lr.ph252
                                        #   Parent Loop BB1_82 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	48(%rsp), %rax                  # 8-byte Reload
	cmpl	$1, (%rax,%r12,4)
	jne	.LBB1_93
# %bb.85:                               #   in Loop: Header=BB1_84 Depth=2
.Ltmp121:
	.cfi_escape 0x2e, 0x00
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_ZNSolsEi
.Ltmp122:
# %bb.86:                               #   in Loop: Header=BB1_84 Depth=2
.Ltmp123:
	movq	%rax, %r14
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.8, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp124:
# %bb.87:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit180
                                        #   in Loop: Header=BB1_84 Depth=2
.Ltmp125:
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	movl	$9999, %esi                     # imm = 0x270F
	callq	_ZNSolsEi
.Ltmp126:
# %bb.88:                               #   in Loop: Header=BB1_84 Depth=2
.Ltmp127:
	movq	%rax, %r14
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.6, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp128:
# %bb.89:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit182
                                        #   in Loop: Header=BB1_84 Depth=2
	movq	(%r14), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
.Ltmp129:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp130:
# %bb.90:                               # %.noexc211
                                        #   in Loop: Header=BB1_84 Depth=2
.Ltmp131:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
.Ltmp132:
# %bb.91:                               # %.noexc212
                                        #   in Loop: Header=BB1_84 Depth=2
.Ltmp133:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp134:
# %bb.92:                               # %_ZNSolsEPFRSoS_E.exit184
                                        #   in Loop: Header=BB1_84 Depth=2
	movq	48(%rsp), %rax                  # 8-byte Reload
	cmpl	$1, (%rax,%r12,4)
	je	.LBB1_100
.LBB1_93:                               # %_ZNSolsEPFRSoS_E.exit184.thread
                                        #   in Loop: Header=BB1_84 Depth=2
.Ltmp135:
	.cfi_escape 0x2e, 0x00
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_ZNSolsEi
.Ltmp136:
# %bb.94:                               #   in Loop: Header=BB1_84 Depth=2
.Ltmp137:
	movq	%rax, %r14
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.8, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp138:
# %bb.95:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit186
                                        #   in Loop: Header=BB1_84 Depth=2
	movl	12(%rsp), %eax
	imull	%ebp, %eax
	addl	%r12d, %eax
	cltq
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r13,%rax,4), %xmm0
.Ltmp139:
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp140:
# %bb.96:                               # %_ZNSolsEf.exit188
                                        #   in Loop: Header=BB1_84 Depth=2
	movq	%rax, %r14
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
.Ltmp141:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp142:
# %bb.97:                               # %.noexc215
                                        #   in Loop: Header=BB1_84 Depth=2
.Ltmp143:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
.Ltmp144:
# %bb.98:                               # %.noexc216
                                        #   in Loop: Header=BB1_84 Depth=2
.Ltmp145:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp146:
# %bb.99:                               # %_ZNSolsEPFRSoS_E.exit190
                                        #   in Loop: Header=BB1_84 Depth=2
	movl	12(%rsp), %eax
	imull	%ebp, %eax
	addl	%r12d, %eax
	cltq
	movss	40(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	addss	(%r13,%rax,4), %xmm0
	movss	%xmm0, 40(%rsp)                 # 4-byte Spill
	movq	104(%rsp), %rcx                 # 8-byte Reload
	addl	(%rcx,%rax,4), %ebx
.LBB1_100:                              #   in Loop: Header=BB1_84 Depth=2
	incq	%r12
	cmpq	%r12, 24(%rsp)
	ja	.LBB1_84
.LBB1_101:                              # %._crit_edge253
                                        #   in Loop: Header=BB1_82 Depth=1
.Ltmp148:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.5, %esi
	movl	$1, %edx
	movq	%r15, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp149:
# %bb.102:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit178
                                        #   in Loop: Header=BB1_82 Depth=1
	xorps	%xmm0, %xmm0
	cvtsi2ss	%ebx, %xmm0
	movss	40(%rsp), %xmm1                 # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	divss	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	cvtss2sd	%xmm1, %xmm0
.Ltmp150:
	.cfi_escape 0x2e, 0x00
	movq	%r15, %rdi
	movsd	%xmm0, 200(%rsp)                # 8-byte Spill
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp151:
# %bb.103:                              # %_ZNSolsEf.exit192
                                        #   in Loop: Header=BB1_82 Depth=1
	movq	%rax, %r14
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
.Ltmp152:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp153:
# %bb.104:                              # %.noexc219
                                        #   in Loop: Header=BB1_82 Depth=1
.Ltmp154:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
.Ltmp155:
# %bb.105:                              # %.noexc220
                                        #   in Loop: Header=BB1_82 Depth=1
.Ltmp156:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp157:
# %bb.106:                              # %_ZNSolsEPFRSoS_E.exit194
                                        #   in Loop: Header=BB1_82 Depth=1
.Ltmp158:
	.cfi_escape 0x2e, 0x00
	leaq	1272(%rsp), %rdi
	movl	%ebp, %esi
	callq	_ZNSolsEi
.Ltmp159:
# %bb.107:                              #   in Loop: Header=BB1_82 Depth=1
.Ltmp160:
	movq	%rax, %r14
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.6, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp161:
# %bb.108:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit196
                                        #   in Loop: Header=BB1_82 Depth=1
.Ltmp162:
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	movsd	200(%rsp), %xmm0                # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp163:
# %bb.109:                              # %_ZNSolsEf.exit198
                                        #   in Loop: Header=BB1_82 Depth=1
	movq	%rax, %r14
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
.Ltmp164:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp165:
# %bb.110:                              # %.noexc223
                                        #   in Loop: Header=BB1_82 Depth=1
.Ltmp166:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
.Ltmp167:
# %bb.111:                              # %.noexc224
                                        #   in Loop: Header=BB1_82 Depth=1
.Ltmp168:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp169:
# %bb.112:                              # %_ZNSolsEPFRSoS_E.exit200
                                        #   in Loop: Header=BB1_82 Depth=1
	movss	16(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	addss	40(%rsp), %xmm0                 # 4-byte Folded Reload
	movss	%xmm0, 16(%rsp)                 # 4-byte Spill
	movl	32(%rsp), %eax                  # 4-byte Reload
	addl	%ebx, %eax
	movl	%eax, %ebx
	incl	%ebp
	cmpl	12(%rsp), %ebp
	jl	.LBB1_82
	jmp	.LBB1_113
.LBB1_72:
	xorl	%ebx, %ebx
	xorps	%xmm0, %xmm0
	movss	%xmm0, 16(%rsp)                 # 4-byte Spill
.LBB1_113:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit174._crit_edge
.Ltmp171:
	.cfi_escape 0x2e, 0x00
	leaq	760(%rsp), %rdi
	movl	$.L.str.9, %esi
	movl	$19, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp172:
# %bb.114:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit176
	xorps	%xmm0, %xmm0
	cvtsi2ss	%ebx, %xmm0
	movss	16(%rsp), %xmm1                 # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	divss	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	cvtss2sd	%xmm1, %xmm0
.Ltmp173:
	.cfi_escape 0x2e, 0x00
	leaq	760(%rsp), %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp174:
# %bb.115:                              # %_ZNSolsEf.exit202
	movq	%rax, %r14
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
.Ltmp175:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp176:
# %bb.116:                              # %.noexc227
.Ltmp177:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
.Ltmp178:
# %bb.117:                              # %.noexc228
.Ltmp179:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp180:
# %bb.118:                              # %_ZNSolsEPFRSoS_E.exit204
.Ltmp181:
	.cfi_escape 0x2e, 0x00
	leaq	1272(%rsp), %r12
	movq	%r12, %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp182:
# %bb.119:
.Ltmp183:
	.cfi_escape 0x2e, 0x00
	leaq	760(%rsp), %r15
	movq	%r15, %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp184:
# %bb.120:
	movq	128(%rsp), %rdi
.Ltmp185:
	.cfi_escape 0x2e, 0x00
	callq	hipFree
.Ltmp186:
# %bb.121:
	movq	120(%rsp), %rdi
.Ltmp187:
	.cfi_escape 0x2e, 0x00
	callq	hipFree
.Ltmp188:
# %bb.122:
	movq	112(%rsp), %rdi
.Ltmp189:
	.cfi_escape 0x2e, 0x00
	callq	hipFree
.Ltmp190:
# %bb.123:
	movq	136(%rsp), %rdi
.Ltmp191:
	.cfi_escape 0x2e, 0x00
	callq	hipFree
.Ltmp192:
# %bb.124:
	movq	168(%rsp), %rdi
.Ltmp193:
	.cfi_escape 0x2e, 0x00
	callq	hipFree
.Ltmp194:
# %bb.125:
	movq	176(%rsp), %rdi
.Ltmp195:
	.cfi_escape 0x2e, 0x00
	callq	hipFree
.Ltmp196:
# %bb.126:
	movq	160(%rsp), %rdi
.Ltmp197:
	.cfi_escape 0x2e, 0x00
	callq	hipFree
.Ltmp198:
# %bb.127:
	movq	152(%rsp), %rdi
.Ltmp199:
	.cfi_escape 0x2e, 0x00
	callq	hipFree
.Ltmp200:
# %bb.128:
	movq	144(%rsp), %rdi
.Ltmp201:
	.cfi_escape 0x2e, 0x00
	callq	hipFree
.Ltmp202:
# %bb.129:
	.cfi_escape 0x2e, 0x00
	movq	72(%rsp), %rdi                  # 8-byte Reload
	callq	free
	.cfi_escape 0x2e, 0x00
	movq	64(%rsp), %rdi                  # 8-byte Reload
	callq	free
	.cfi_escape 0x2e, 0x00
	movq	56(%rsp), %rdi                  # 8-byte Reload
	callq	free
	.cfi_escape 0x2e, 0x00
	movq	%r13, %rdi
	callq	free
	.cfi_escape 0x2e, 0x00
	movq	48(%rsp), %rdi                  # 8-byte Reload
	callq	free
	.cfi_escape 0x2e, 0x00
	movq	104(%rsp), %rdi                 # 8-byte Reload
	callq	free
.Ltmp203:
	.cfi_escape 0x2e, 0x00
	movq	96(%rsp), %rdi                  # 8-byte Reload
	callq	hipFree
.Ltmp204:
# %bb.130:
.Ltmp205:
	.cfi_escape 0x2e, 0x00
	movq	88(%rsp), %rdi                  # 8-byte Reload
	callq	hipFree
.Ltmp206:
# %bb.131:
.Ltmp207:
	.cfi_escape 0x2e, 0x00
	movq	80(%rsp), %rdi                  # 8-byte Reload
	callq	hipFree
.Ltmp208:
# %bb.132:
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rbx
	leaq	1280(%rsp), %rdi
	movq	%rbx, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %r14
	movq	-24(%rbx), %rax
	movq	%r14, 1272(%rsp,%rax)
	.cfi_escape 0x2e, 0x00
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	movl	$248, %r13d
	addq	%r13, %r12
	.cfi_escape 0x2e, 0x00
	movq	%r12, %rdi
	callq	_ZNSt8ios_baseD2Ev
	leaq	768(%rsp), %rdi
	movq	%rbx, -8(%rdi)
	movq	-24(%rbx), %rax
	movq	%r14, 760(%rsp,%rax)
	.cfi_escape 0x2e, 0x00
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	addq	%r13, %r15
	.cfi_escape 0x2e, 0x00
	movq	%r15, %rdi
	callq	_ZNSt8ios_baseD2Ev
	.cfi_escape 0x2e, 0x00
	leaq	1784(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	.cfi_escape 0x2e, 0x00
	leaq	2304(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	.cfi_escape 0x2e, 0x00
	leaq	240(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	208(%rsp), %rdi
	leaq	224(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB1_134
# %bb.133:                              # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	.cfi_escape 0x2e, 0x00
	callq	_ZdlPv
.LBB1_134:                              # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	xorl	%eax, %eax
	addq	$2824, %rsp                     # imm = 0xB08
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB1_77:
	.cfi_def_cfa_offset 2880
.Ltmp14:
	movq	%rax, %rbx
	jmp	.LBB1_137
.LBB1_76:
.Ltmp11:
	movq	%rax, %rbx
	jmp	.LBB1_138
.LBB1_75:
.Ltmp8:
	movq	%rax, %rbx
	jmp	.LBB1_139
.LBB1_74:
.Ltmp5:
	movq	%rax, %rbx
	jmp	.LBB1_140
.LBB1_73:
.Ltmp2:
	movq	%rax, %rbx
	jmp	.LBB1_141
.LBB1_135:
.Ltmp29:
	jmp	.LBB1_136
.LBB1_79:
.Ltmp50:
	jmp	.LBB1_136
.LBB1_78:
.Ltmp209:
	jmp	.LBB1_136
.LBB1_80:
.Ltmp79:
	jmp	.LBB1_136
.LBB1_146:
.Ltmp170:
	jmp	.LBB1_136
.LBB1_144:
.Ltmp92:
	jmp	.LBB1_136
.LBB1_145:
.Ltmp147:
.LBB1_136:
	movq	%rax, %rbx
	.cfi_escape 0x2e, 0x00
	leaq	1272(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
.LBB1_137:
	.cfi_escape 0x2e, 0x00
	leaq	760(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
.LBB1_138:
	.cfi_escape 0x2e, 0x00
	leaq	1784(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
.LBB1_139:
	.cfi_escape 0x2e, 0x00
	leaq	2304(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
.LBB1_140:
	.cfi_escape 0x2e, 0x00
	leaq	240(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
.LBB1_141:
	movq	208(%rsp), %rdi
	leaq	224(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB1_143
# %bb.142:                              # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i205
	.cfi_escape 0x2e, 0x00
	callq	_ZdlPv
.LBB1_143:                              # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit207
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end1:
	.size	main, .Lfunc_end1-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table1:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 1 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp2-.Lfunc_begin0           #     jumps to .Ltmp2
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp3-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp4-.Ltmp3                  #   Call between .Ltmp3 and .Ltmp4
	.uleb128 .Ltmp5-.Lfunc_begin0           #     jumps to .Ltmp5
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp6-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp7-.Ltmp6                  #   Call between .Ltmp6 and .Ltmp7
	.uleb128 .Ltmp8-.Lfunc_begin0           #     jumps to .Ltmp8
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp9-.Lfunc_begin0           # >> Call Site 4 <<
	.uleb128 .Ltmp10-.Ltmp9                 #   Call between .Ltmp9 and .Ltmp10
	.uleb128 .Ltmp11-.Lfunc_begin0          #     jumps to .Ltmp11
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp12-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp13-.Ltmp12                #   Call between .Ltmp12 and .Ltmp13
	.uleb128 .Ltmp14-.Lfunc_begin0          #     jumps to .Ltmp14
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp15-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp28-.Ltmp15                #   Call between .Ltmp15 and .Ltmp28
	.uleb128 .Ltmp29-.Lfunc_begin0          #     jumps to .Ltmp29
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp30-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp47-.Ltmp30                #   Call between .Ltmp30 and .Ltmp47
	.uleb128 .Ltmp209-.Lfunc_begin0         #     jumps to .Ltmp209
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp48-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp49-.Ltmp48                #   Call between .Ltmp48 and .Ltmp49
	.uleb128 .Ltmp50-.Lfunc_begin0          #     jumps to .Ltmp50
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp51-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Ltmp52-.Ltmp51                #   Call between .Ltmp51 and .Ltmp52
	.uleb128 .Ltmp209-.Lfunc_begin0         #     jumps to .Ltmp209
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp53-.Lfunc_begin0          # >> Call Site 10 <<
	.uleb128 .Ltmp78-.Ltmp53                #   Call between .Ltmp53 and .Ltmp78
	.uleb128 .Ltmp79-.Lfunc_begin0          #     jumps to .Ltmp79
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp80-.Lfunc_begin0          # >> Call Site 11 <<
	.uleb128 .Ltmp85-.Ltmp80                #   Call between .Ltmp80 and .Ltmp85
	.uleb128 .Ltmp92-.Lfunc_begin0          #     jumps to .Ltmp92
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp93-.Lfunc_begin0          # >> Call Site 12 <<
	.uleb128 .Ltmp120-.Ltmp93               #   Call between .Ltmp93 and .Ltmp120
	.uleb128 .Ltmp209-.Lfunc_begin0         #     jumps to .Ltmp209
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp121-.Lfunc_begin0         # >> Call Site 13 <<
	.uleb128 .Ltmp146-.Ltmp121              #   Call between .Ltmp121 and .Ltmp146
	.uleb128 .Ltmp147-.Lfunc_begin0         #     jumps to .Ltmp147
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp148-.Lfunc_begin0         # >> Call Site 14 <<
	.uleb128 .Ltmp169-.Ltmp148              #   Call between .Ltmp148 and .Ltmp169
	.uleb128 .Ltmp170-.Lfunc_begin0         #     jumps to .Ltmp170
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp171-.Lfunc_begin0         # >> Call Site 15 <<
	.uleb128 .Ltmp208-.Ltmp171              #   Call between .Ltmp171 and .Ltmp208
	.uleb128 .Ltmp209-.Lfunc_begin0         #     jumps to .Ltmp209
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp208-.Lfunc_begin0         # >> Call Site 16 <<
	.uleb128 .Lfunc_end1-.Ltmp208           #   Call between .Ltmp208 and .Lfunc_end1
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB2_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB2_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i, %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_end2:
	.size	__hip_module_ctor, .Lfunc_end2-__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	.LBB3_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
.LBB3_2:
	retq
.Lfunc_end3:
	.size	__hip_module_dtor, .Lfunc_end3-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i,@object # @_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i
	.section	.rodata,"a",@progbits
	.globl	_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i
	.p2align	3, 0x0
_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i:
	.quad	_Z26__device_stub__p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i
	.size	_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"XYZ.dat"
	.size	.L.str, 8

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"bond.dat"
	.size	.L.str.1, 9

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"pbc.dat"
	.size	.L.str.2, 8

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"avrg.p2"
	.size	.L.str.3, 8

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"local-order.dat"
	.size	.L.str.4, 16

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

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

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

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

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"##final value is : "
	.size	.L.str.9, 20

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i"
	.size	.L__unnamed_1, 37

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

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

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

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i ; -- Begin function _Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i
	.globl	_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i
	.p2align	8
	.type	_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i,@function
_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i:   ; @_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i
; %bb.0:
	s_clause 0x2
	s_load_b32 s2, s[0:1], 0x50
	s_load_b32 s3, s[0:1], 0x64
	s_load_b512 s[16:31], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_ashr_i32 s4, s2, 31
	s_and_b32 s3, s3, 0xffff
	s_mul_i32 s5, s2, s29
	v_mad_u64_u32 v[1:2], null, s15, s3, v[0:1]
	s_mul_hi_u32 s3, s2, s28
	v_mov_b32_e32 v2, 0
	s_add_i32 s3, s3, s5
	s_mul_i32 s4, s4, s28
	s_mul_i32 s2, s2, s28
	s_add_i32 s3, s3, s4
	s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1)
	v_cmp_gt_u64_e32 vcc_lo, s[2:3], v[1:2]
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB0_10
; %bb.1:
	v_cvt_f32_u32_e32 v0, s28
	v_cvt_f32_u32_e32 v3, s29
	s_sub_u32 s2, 0, s28
	s_subb_u32 s3, 0, s29
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v0, 0x4f800000, v3
	v_rcp_f32_e32 v0, v0
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v0, 0x5f7ffffc, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v3, 0x2f800000, v0
	v_trunc_f32_e32 v3, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fmamk_f32 v0, v3, 0xcf800000, v0
	v_cvt_u32_f32_e32 v3, v3
	v_cvt_u32_f32_e32 v0, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v4, s2, v3
	v_mul_hi_u32 v5, s2, v0
	v_mul_lo_u32 v6, s3, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v4, v5, v4
	v_mul_lo_u32 v5, s2, v0
	v_add_nc_u32_e32 v4, v4, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_hi_u32 v6, v0, v5
	v_mul_lo_u32 v7, v0, v4
	v_mul_hi_u32 v8, v0, v4
	v_mul_hi_u32 v9, v3, v5
	v_mul_lo_u32 v5, v3, v5
	v_mul_hi_u32 v10, v3, v4
	v_mul_lo_u32 v4, v3, v4
	v_add_co_u32 v6, vcc_lo, v6, v7
	v_add_co_ci_u32_e32 v7, vcc_lo, 0, v8, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v5, vcc_lo, v6, v5
	v_add_co_ci_u32_e32 v5, vcc_lo, v7, v9, vcc_lo
	v_add_co_ci_u32_e32 v6, vcc_lo, 0, v10, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v4, vcc_lo, v5, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, 0, v6, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, v0, v4
	v_add_co_ci_u32_e32 v3, vcc_lo, v3, v5, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_mul_hi_u32 v4, s2, v0
	v_mul_lo_u32 v6, s3, v0
	v_mul_lo_u32 v5, s2, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v4, v4, v5
	v_mul_lo_u32 v5, s2, v0
	v_add_nc_u32_e32 v4, v4, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_hi_u32 v6, v0, v5
	v_mul_lo_u32 v7, v0, v4
	v_mul_hi_u32 v8, v0, v4
	v_mul_hi_u32 v9, v3, v5
	v_mul_lo_u32 v5, v3, v5
	v_mul_hi_u32 v10, v3, v4
	v_mul_lo_u32 v4, v3, v4
	v_add_co_u32 v6, vcc_lo, v6, v7
	v_add_co_ci_u32_e32 v7, vcc_lo, 0, v8, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v5, vcc_lo, v6, v5
	v_add_co_ci_u32_e32 v5, vcc_lo, v7, v9, vcc_lo
	v_add_co_ci_u32_e32 v6, vcc_lo, 0, v10, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v4, vcc_lo, v5, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, 0, v6, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, v0, v4
	v_add_co_ci_u32_e32 v9, vcc_lo, v3, v5, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_mul_hi_u32 v10, v1, v0
	v_mad_u64_u32 v[5:6], null, 0, v0, 0
	v_mad_u64_u32 v[3:4], null, v1, v9, 0
	v_mad_u64_u32 v[7:8], null, 0, v9, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v0, vcc_lo, v10, v3
	v_add_co_ci_u32_e32 v3, vcc_lo, 0, v4, vcc_lo
	v_lshlrev_b64 v[10:11], 2, v[1:2]
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v0, vcc_lo, v0, v5
	v_add_co_ci_u32_e32 v0, vcc_lo, v3, v6, vcc_lo
	v_add_co_ci_u32_e32 v3, vcc_lo, 0, v8, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, v0, v7
	v_add_co_ci_u32_e32 v5, vcc_lo, 0, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_mul_lo_u32 v6, s29, v0
	v_mad_u64_u32 v[3:4], null, s28, v0, 0
	v_mul_lo_u32 v5, s28, v5
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_sub_co_u32 v3, vcc_lo, v1, v3
	v_add3_u32 v4, v4, v5, v6
	v_add_co_u32 v6, null, v0, 2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v5, 0, v4
	v_subrev_co_ci_u32_e64 v5, s2, s29, v5, vcc_lo
	v_sub_co_u32 v7, s2, v3, s28
	v_sub_co_ci_u32_e32 v4, vcc_lo, 0, v4, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_subrev_co_ci_u32_e64 v5, s2, 0, v5, s2
	v_cmp_le_u32_e32 vcc_lo, s28, v7
	s_mov_b64 s[2:3], 0
	v_cndmask_b32_e64 v7, 0, -1, vcc_lo
	s_delay_alu instid0(VALU_DEP_3)
	v_cmp_le_u32_e32 vcc_lo, s29, v5
	v_cndmask_b32_e64 v8, 0, -1, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s28, v3
	v_cndmask_b32_e64 v3, 0, -1, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s29, v4
	v_cndmask_b32_e64 v9, 0, -1, vcc_lo
	v_cmp_eq_u32_e32 vcc_lo, s29, v5
	v_cndmask_b32_e32 v5, v8, v7, vcc_lo
	v_cmp_eq_u32_e32 vcc_lo, s29, v4
	v_add_co_u32 v7, null, v0, 1
	v_cndmask_b32_e32 v3, v9, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cmp_ne_u32_e32 vcc_lo, 0, v5
	v_cndmask_b32_e32 v4, v7, v6, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_ne_u32_e32 vcc_lo, 0, v3
	v_cndmask_b32_e32 v8, v0, v4, vcc_lo
	v_add_co_u32 v16, vcc_lo, s24, v10
	v_add_co_ci_u32_e32 v17, vcc_lo, s25, v11, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v0, v8, s28
	global_store_b32 v[16:17], v2, off
	v_sub_nc_u32_e32 v3, v1, v0
	v_ashrrev_i32_e32 v4, 31, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[3:4]
	v_add_co_u32 v0, vcc_lo, s26, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s27, v1, vcc_lo
	global_load_b32 v3, v[0:1], off
	v_add_co_u32 v0, vcc_lo, s22, v10
	v_add_co_ci_u32_e32 v1, vcc_lo, s23, v11, vcc_lo
	global_store_b32 v[0:1], v2, off
	s_waitcnt vmcnt(0)
	v_cmp_ne_u32_e32 vcc_lo, 1, v3
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_10
; %bb.2:
	v_ashrrev_i32_e32 v9, 31, v8
	s_load_b128 s[4:7], s[0:1], 0x40
	v_mul_lo_u32 v6, v8, s29
	v_mad_u64_u32 v[2:3], null, v8, s28, 0
	s_delay_alu instid0(VALU_DEP_3)
	v_mul_lo_u32 v7, v9, s28
	v_add_co_u32 v4, vcc_lo, s16, v10
	v_add_co_ci_u32_e32 v5, vcc_lo, s17, v11, vcc_lo
	v_lshlrev_b64 v[14:15], 2, v[8:9]
	v_dual_mov_b32 v18, 1 :: v_dual_mov_b32 v23, 0
	v_add3_u32 v3, v3, v6, v7
	v_add_co_u32 v6, vcc_lo, s18, v10
	v_add_co_ci_u32_e32 v7, vcc_lo, s19, v11, vcc_lo
	v_add_co_u32 v8, vcc_lo, s20, v10
	v_add_co_ci_u32_e32 v9, vcc_lo, s21, v11, vcc_lo
	v_add_co_u32 v10, vcc_lo, s30, v14
	v_add_co_ci_u32_e32 v11, vcc_lo, s31, v15, vcc_lo
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v12, vcc_lo, s4, v14
	v_add_co_ci_u32_e32 v13, vcc_lo, s5, v15, vcc_lo
	v_add_co_u32 v14, vcc_lo, s6, v14
	v_add_co_ci_u32_e32 v15, vcc_lo, s7, v15, vcc_lo
	v_mov_b32_e32 v24, 0
	v_mov_b32_e32 v22, 0
	global_store_b32 v[16:17], v18, off
.LBB0_3:                                ; =>This Inner Loop Header: Depth=1
	global_load_b32 v16, v24, s[26:27]
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, 1, v16
	s_cbranch_vccnz .LBB0_7
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	v_add_co_u32 v16, vcc_lo, s2, v2
	v_add_co_ci_u32_e32 v17, vcc_lo, s3, v3, vcc_lo
	global_load_b32 v25, v[4:5], off
	s_mov_b32 s4, exec_lo
	v_lshlrev_b64 v[18:19], 2, v[16:17]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v16, vcc_lo, s16, v18
	v_add_co_ci_u32_e32 v17, vcc_lo, s17, v19, vcc_lo
	v_add_co_u32 v20, vcc_lo, s18, v18
	v_add_co_ci_u32_e32 v21, vcc_lo, s19, v19, vcc_lo
	global_load_b32 v26, v[16:17], off
	v_add_co_u32 v18, vcc_lo, s20, v18
	v_add_co_ci_u32_e32 v19, vcc_lo, s21, v19, vcc_lo
	s_clause 0x1
	global_load_b32 v27, v[6:7], off
	global_load_b32 v28, v[20:21], off
	global_load_b32 v29, v[8:9], off
	global_load_b32 v30, v[10:11], off
	global_load_b32 v31, v[18:19], off
	global_load_b32 v32, v[12:13], off
	global_load_b32 v33, v[14:15], off
	s_waitcnt vmcnt(5)
	v_dual_sub_f32 v25, v25, v26 :: v_dual_sub_f32 v26, v27, v28
	s_waitcnt vmcnt(2)
	v_sub_f32_e32 v28, v29, v31
	s_delay_alu instid0(VALU_DEP_2)
	v_div_scale_f32 v27, null, v30, v30, v25
	s_waitcnt vmcnt(1)
	v_div_scale_f32 v29, null, v32, v32, v26
	s_waitcnt vmcnt(0)
	v_div_scale_f32 v34, null, v33, v33, v28
	v_rcp_f32_e32 v31, v27
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_rcp_f32_e32 v35, v29
	v_div_scale_f32 v38, vcc_lo, v25, v30, v25
	v_rcp_f32_e32 v36, v34
	v_div_scale_f32 v40, s0, v26, v32, v26
	s_delay_alu instid0(TRANS32_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_3)
	v_fma_f32 v37, -v27, v31, 1.0
	s_waitcnt_depctr 0xfff
	v_fma_f32 v39, -v29, v35, 1.0
	v_fmac_f32_e32 v31, v37, v31
	v_fma_f32 v37, -v34, v36, 1.0
	v_fmac_f32_e32 v35, v39, v35
	v_div_scale_f32 v39, s1, v28, v33, v28
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_dual_mul_f32 v41, v38, v31 :: v_dual_fmac_f32 v36, v37, v36
	v_mul_f32_e32 v37, v40, v35
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_fma_f32 v42, -v27, v41, v38
	v_mul_f32_e32 v43, v39, v36
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_fma_f32 v44, -v29, v37, v40
	v_fmac_f32_e32 v41, v42, v31
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_fma_f32 v42, -v34, v43, v39
	v_fmac_f32_e32 v37, v44, v35
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v27, -v27, v41, v38
	v_fma_f32 v29, -v29, v37, v40
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_fmas_f32 v27, v27, v31, v41
	s_mov_b32 vcc_lo, s0
	v_div_fmas_f32 v29, v29, v35, v37
	s_mov_b32 vcc_lo, s1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_div_fixup_f32 v27, v27, v30, v25
	v_div_fixup_f32 v29, v29, v32, v26
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_trunc_f32_e32 v35, v27
	v_dual_fmac_f32 v43, v42, v36 :: v_dual_sub_f32 v38, v27, v35
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_fma_f32 v31, -v34, v43, v39
	v_trunc_f32_e32 v34, v29
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_div_fmas_f32 v31, v31, v36, v43
	v_sub_f32_e32 v36, v29, v34
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_div_fixup_f32 v31, v31, v33, v28
	v_cmp_ge_f32_e64 s0, |v36|, 0.5
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_trunc_f32_e32 v37, v31
	v_cndmask_b32_e64 v36, 0, 1.0, s0
	v_cmp_ge_f32_e64 s0, |v38|, 0.5
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_sub_f32_e32 v39, v31, v37
	v_bfi_b32 v29, 0x7fffffff, v36, v29
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v38, 0, 1.0, s0
	v_cmp_ge_f32_e64 s0, |v39|, 0.5
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f32_e32 v29, v34, v29
	v_bfi_b32 v27, 0x7fffffff, v38, v27
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v36, 0, 1.0, s0
	v_fma_f32 v26, -v32, v29, v26
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_f32_e32 v27, v35, v27
	v_bfi_b32 v31, 0x7fffffff, v36, v31
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mul_f32_e32 v26, v26, v26
	v_fma_f32 v25, -v30, v27, v25
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_f32_e32 v29, v37, v31
	v_fmac_f32_e32 v26, v25, v25
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v27, -v33, v29, v28
	v_fmac_f32_e32 v26, v27, v27
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mul_f32_e32 v25, 0x4f800000, v26
	v_cmp_gt_f32_e32 vcc_lo, 0xf800000, v26
	v_cndmask_b32_e32 v25, v26, v25, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	v_sqrt_f32_e32 v26, v25
	s_waitcnt_depctr 0xfff
	v_add_nc_u32_e32 v27, -1, v26
	v_add_nc_u32_e32 v28, 1, v26
	v_fma_f32 v29, -v27, v26, v25
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v30, -v28, v26, v25
	v_cmp_ge_f32_e64 s0, 0, v29
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v26, v26, v27, s0
	v_cmp_lt_f32_e64 s0, 0, v30
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v26, v26, v28, s0
	v_mul_f32_e32 v27, 0x37800000, v26
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v26, v26, v27, vcc_lo
	v_cmp_class_f32_e64 vcc_lo, v25, 0x260
	v_cndmask_b32_e32 v25, v26, v25, vcc_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_f32_e32 0x410c0000, v25
	s_cbranch_execz .LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	s_clause 0x3
	global_load_b32 v25, v[6:7], off offset:4
	global_load_b32 v26, v[6:7], off offset:-4
	global_load_b32 v27, v[20:21], off offset:4
	global_load_b32 v20, v[20:21], off offset:-4
	s_clause 0x3
	global_load_b32 v21, v[4:5], off offset:4
	global_load_b32 v28, v[4:5], off offset:-4
	global_load_b32 v29, v[16:17], off offset:4
	global_load_b32 v16, v[16:17], off offset:-4
	s_clause 0x3
	global_load_b32 v17, v[8:9], off offset:4
	global_load_b32 v30, v[8:9], off offset:-4
	global_load_b32 v31, v[18:19], off offset:4
	global_load_b32 v18, v[18:19], off offset:-4
	v_add_nc_u32_e32 v23, 1, v23
	s_waitcnt vmcnt(8)
	v_dual_sub_f32 v19, v25, v26 :: v_dual_sub_f32 v20, v27, v20
	s_waitcnt vmcnt(6)
	v_sub_f32_e32 v21, v21, v28
	s_waitcnt vmcnt(4)
	s_delay_alu instid0(VALU_DEP_2)
	v_dual_mul_f32 v25, v19, v19 :: v_dual_sub_f32 v16, v29, v16
	s_waitcnt vmcnt(2)
	v_dual_mul_f32 v26, v20, v20 :: v_dual_sub_f32 v17, v17, v30
	v_mul_f32_e32 v19, v19, v20
	s_waitcnt vmcnt(0)
	v_dual_sub_f32 v18, v31, v18 :: v_dual_fmac_f32 v25, v21, v21
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_fmac_f32_e32 v26, v16, v16
	v_fmac_f32_e32 v19, v21, v16
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_dual_fmac_f32 v25, v17, v17 :: v_dual_fmac_f32 v26, v18, v18
	v_fmac_f32_e32 v19, v17, v18
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_dual_mul_f32 v27, 0x4f800000, v25 :: v_dual_mul_f32 v28, 0x4f800000, v26
	v_cmp_gt_f32_e64 s0, 0xf800000, v26
	v_cmp_gt_f32_e32 vcc_lo, 0xf800000, v25
	v_cndmask_b32_e64 v26, v26, v28, s0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_sqrt_f32_e32 v28, v26
	s_waitcnt_depctr 0xfff
	v_dual_cndmask_b32 v25, v25, v27 :: v_dual_add_nc_u32 v30, -1, v28
	v_sqrt_f32_e32 v27, v25
	v_add_nc_u32_e32 v32, 1, v28
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v34, -v30, v28, v26
	v_fma_f32 v36, -v32, v28, v26
	s_waitcnt_depctr 0xfff
	v_add_nc_u32_e32 v29, -1, v27
	v_add_nc_u32_e32 v31, 1, v27
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v33, -v29, v27, v25
	v_fma_f32 v35, -v31, v27, v25
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_ge_f32_e64 s1, 0, v33
	v_cndmask_b32_e64 v27, v27, v29, s1
	v_cmp_ge_f32_e64 s1, 0, v34
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cndmask_b32_e64 v28, v28, v30, s1
	v_cmp_lt_f32_e64 s1, 0, v35
	v_cndmask_b32_e64 v27, v27, v31, s1
	v_cmp_lt_f32_e64 s1, 0, v36
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_f32_e32 v29, 0x37800000, v27
	v_cndmask_b32_e64 v28, v28, v32, s1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_dual_cndmask_b32 v27, v27, v29 :: v_dual_mul_f32 v30, 0x37800000, v28
	v_cmp_class_f32_e64 vcc_lo, v25, 0x260
	v_cndmask_b32_e64 v28, v28, v30, s0
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v20, v27, v25, vcc_lo
	v_cmp_class_f32_e64 vcc_lo, v26, 0x260
	v_cndmask_b32_e32 v25, v28, v26, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v16, v20, v25
	v_and_b32_e32 v17, 0x7fffffff, v16
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_scale_f32 v18, null, v17, v17, v19
	v_div_scale_f32 v17, vcc_lo, v19, v17, v19
	v_rcp_f32_e32 v20, v18
	s_waitcnt_depctr 0xfff
	v_fma_f32 v21, -v18, v20, 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v20, v21, v20
	v_mul_f32_e32 v21, v17, v20
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v25, -v18, v21, v17
	v_fmac_f32_e32 v21, v25, v20
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v17, -v18, v21, v17
	v_div_fmas_f32 v17, v17, v20, v21
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fixup_f32 v16, v17, |v16|, v19
	v_mul_f32_e32 v17, 0x40400000, v16
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fma_f32 v18, v16, v17, -1.0
	v_cvt_f64_f32_e32 v[16:17], v22
	v_cvt_f64_f32_e32 v[18:19], v18
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[16:17], v[18:19], 0.5, v[16:17]
	v_cvt_f32_f64_e32 v22, v[16:17]
.LBB0_6:                                ; %Flow189
                                        ;   in Loop: Header=BB0_3 Depth=1
	s_or_b32 exec_lo, exec_lo, s4
.LBB0_7:                                ;   in Loop: Header=BB0_3 Depth=1
	s_add_u32 s2, s2, 1
	s_addc_u32 s3, s3, 0
	s_add_u32 s26, s26, 4
	v_cmp_ge_u64_e64 s0, s[2:3], s[28:29]
	s_addc_u32 s27, s27, 0
	s_delay_alu instid0(VALU_DEP_1)
	s_and_b32 vcc_lo, exec_lo, s0
	s_cbranch_vccz .LBB0_3
; %bb.8:
	v_cmp_ne_u32_e32 vcc_lo, 0, v23
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_10
; %bb.9:
	v_cvt_f32_i32_e32 v2, v23
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_scale_f32 v3, null, v2, v2, v22
	v_rcp_f32_e32 v4, v3
	s_waitcnt_depctr 0xfff
	v_fma_f32 v5, -v3, v4, 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v4, v5, v4
	v_div_scale_f32 v5, vcc_lo, v22, v2, v22
	v_mul_f32_e32 v6, v5, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v7, -v3, v6, v5
	v_fmac_f32_e32 v6, v7, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v3, -v3, v6, v5
	v_div_fmas_f32 v3, v3, v4, v6
	s_delay_alu instid0(VALU_DEP_1)
	v_div_fixup_f32 v2, v3, v2, v22
	global_store_b32 v[0:1], v2, off
.LBB0_10:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 344
		.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 45
		.amdhsa_next_free_sgpr 32
		.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	_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i, .Lfunc_end0-_Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 2700
; NumSgprs: 34
; NumVgprs: 45
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 4
; VGPRBlocks: 5
; NumSGPRsForWavesPerEU: 34
; NumVGPRsForWavesPerEU: 45
; Occupancy: 16
; WaveLimiterHint : 1
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         40
        .size:           8
        .value_kind:     global_buffer
      - .offset:         48
        .size:           8
        .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
      - .offset:         80
        .size:           4
        .value_kind:     by_value
      - .offset:         88
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         92
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         96
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         100
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         102
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         104
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         106
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         108
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         110
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         128
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         136
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         144
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         152
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 344
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i
    .private_segment_fixed_size: 0
    .sgpr_count:     34
    .sgpr_spill_count: 0
    .symbol:         _Z11p2_calc_gpuPfS_S_S_PiS0_yS_S_S_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     45
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
