#include <iostream>
#include <random>
#include <fstream>
#include <string>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>

#define nr 512 
#define nc 512 
#define Blk_H 8 
#define Blk_W 8 
#define stclX 1
#define stclY 1
using namespace std;

// cuda code
#define cudaCheckErrors(msg) \
    do { \
        cudaError_t __err = cudaGetLastError(); \
        if (__err != cudaSuccess) { \
            fprintf(stderr, "Fatal error: %s (%s at %s:%d)\n", \
                msg, cudaGetErrorString(__err), \
                __FILE__, __LINE__); \
            fprintf(stderr, "*** FAILED - ABORTING\n"); \
            exit(1); \
        } \
    } while (0)

typedef double num_col[nc];

// function declartions
void write_ouput(num_col *phi,int nx,int ny,int step,double dx,double dy);

__global__ void lap_per(num_col * mat_in, num_col * mat_out);

__global__ void calc_df(num_col * mat_in, num_col * mat_out);

__global__ void update_phi(num_col * mat_in, num_col * mat_out);

int main(){
    // declare simulation variables
    int step;
    int steps    = 10000;
    int skip     = 1000;
    int ny       = nr;
    int nx       = nc;
    double dx    = 1.0;
    double dy    = 1.0;
    double phi0  = 0.0;
    num_col * phi;
    num_col * df;
    num_col * d_phi;
    num_col * d_df;

    int size = nx*ny*sizeof(double);

    // allocate resources for phi and df on cpu
    phi = (num_col*) malloc(size);
    df  = (num_col*) malloc(size);

    // allocate memory on gpu
    cudaMalloc((void**) &d_phi,size);
    cudaCheckErrors("cudaMalloc fail");
    cudaMalloc((void**) &d_df,size);
    cudaCheckErrors("cudaMalloc fail");

    // clean up output files from previous runs
//    system("rm fluid*");

    // random number stuff
    default_random_engine generator;
    uniform_real_distribution<double> ran(-1.0,1.0);
    
    // initialize system
    for (int i=0; i<nx;i++){
        for (int j=0; j<ny;j++){
            phi[i][j] = phi0 + 0.1*ran(generator);
        }
    }

    // write initial condition output file
    write_ouput(phi,nx,ny,1,dx,dy);

    // evolve the system using finite difference to
    // solve the CH equation

    // copy data to the gpu
    cudaMemcpy(d_phi,phi,size,cudaMemcpyHostToDevice);
    cudaCheckErrors("cudaMemcpy H2D fail");
    cudaMemcpy(d_df,df,size,cudaMemcpyHostToDevice);
    cudaCheckErrors("cudaMemcpy H2D fail");

    // get grid and block size
    dim3 threadsPerBlock(Blk_H,Blk_W);
    dim3 numBlocks( (nr + Blk_H - 1)/threadsPerBlock.x, (nc + Blk_W - 1)/threadsPerBlock.x );

    for (step = 1; step <= steps; step++){

        // pass the number crunching off to the gpu

        // calculate the laplacian of phi and store in df
        lap_per<<<numBlocks,threadsPerBlock>>>(d_phi,d_df);
        cudaDeviceSynchronize();
        cudaCheckErrors("cuda kernel fail");

        // caclulate df and store in df
        calc_df<<<numBlocks,threadsPerBlock>>>(d_phi,d_df);
        cudaDeviceSynchronize();
        cudaCheckErrors("cuda kernel fail");
        
        // calculate the laplacian of df and update phi
        update_phi<<<numBlocks,threadsPerBlock>>>(d_df,d_phi);
        cudaDeviceSynchronize();
        cudaCheckErrors("cuda kernel fail");
        
        // write output
        if (step%skip == 0){
            // get phi from gpu
            cudaMemcpyAsync(phi,d_phi,size,cudaMemcpyDeviceToHost);
            cudaCheckErrors("cudaMemcpy D2H fail");
            write_ouput(phi,nx,ny,step,dx,dy);
        }
    }

    // clean up on device
    cudaFree(d_phi);
    cudaFree(d_df);
    return 0;
}

// function definitions

__global__ void lap_per(num_col * mat_in, num_col * mat_out){
    int i = blockIdx.x * blockDim.x + threadIdx.x;
    int j = blockIdx.y * blockDim.y + threadIdx.y;
    int is,in,je,jw;
    int ii,jj,iis,iin,jje,jjw;

    __shared__ double d2x,d2y;

    if (i < nc && j < nr ){

        // get neighbors for stencil for the bulk case
        is = i - 1;
        in = i + 1;
        je = j + 1;
        jw = j - 1;

        // apply periodic boundary conditions
        // south boundary
        if (i == 0) is = nr - 1;
        // north boundary
        if (i == (nr-1)) in = 0;
        // west boundary
        if (j == 0) jw = nc - 1;
        // east boundary
        if (j == (nc-1)) je = 0;

        // shared memory neighbor indices
        ii = threadIdx.x + stclX;
        jj = threadIdx.y + stclY;
        iin = ii + 1;
        iis = ii - 1;
        jje = jj + 1;
        jjw = jj - 1;

        // sync all the threads in the block up to this point
        __syncthreads();

        // memory optimization using shared memory
        __shared__ double smem[(Blk_H + 2*stclX)][(Blk_W + 2*stclY)];
        smem[ii][jj] = mat_in[i][j];
        // load north side of stencil
        if (threadIdx.x > (Blk_H - 2*stclX)){
            smem[ii + stclX][jj] =  mat_in[in][j];
        }
        // load south side of stencil
        if (threadIdx.x == 0){
            smem[ii - stclX][jj] =  mat_in[is][j];
        }
        // load east side of stencil
        if (threadIdx.y > (Blk_W - 2*stclY)){
            smem[ii][jj + stclY] =  mat_in[i][je];
        }
        // load west side of stencil
        if (threadIdx.y == 0){
            smem[ii][jj - stclY] =  mat_in[i][jw];
        }

        // sync threads to ensure all data is loaded into shared memory
        __syncthreads();

        // calculate 2D laplacian approximation (assume dx and dy = 1.0)
        d2y = smem[iis][jj] + smem[iin][jj] - 2.0*smem[ii][jj];
        d2x = smem[ii][jjw] + smem[ii][jje] - 2.0*smem[ii][jj];
        mat_out[i][j] = d2x + d2y;
    }
}

__global__ void calc_df(num_col * mat_in, num_col * mat_out){
    int i = blockIdx.x * blockDim.x + threadIdx.x;
    int j = blockIdx.y * blockDim.y + threadIdx.y;
    int ii = threadIdx.x;
    int jj = threadIdx.y;
    if (i < nc && j < nr ){

        // memory optimization using shared memory
        __shared__ double smem[(Blk_H)][(Blk_W)];
        smem[ii][jj] = mat_in[i][j];

        // calulate df[i][j] noting that it currently stores the laplacian of phi
        // also assume kappa=1.0
        mat_out[i][j] = -1.0*mat_out[i][j] + smem[ii][jj]*smem[ii][jj]*smem[ii][jj] - smem[ii][jj];
    }
}

__global__ void update_phi(num_col * mat_in, num_col * mat_out){
    int i = blockIdx.x * blockDim.x + threadIdx.x;
    int j = blockIdx.y * blockDim.y + threadIdx.y;
    int is,in,je,jw;
    int ii,jj,iis,iin,jje,jjw;
    __shared__ double d2x,d2y,dt;
    dt = 0.01;
    if (i < nc && j < nr ){
        // get neighbors for stencil for the bulk case
        is = i - 1;
        in = i + 1;
        je = j + 1;
        jw = j - 1;

        // apply periodic boundary conditions
        // left boundary
        if (i == 0) is = nr - 1;
        // right boundary
        if (i == (nr-1)) in = 0;
        // bottom boundary
        if (j == 0) jw = nc - 1;
        // top boundary
        if (j == (nc-1)) je = 0;

        // shared memory neighbor indices
        ii = threadIdx.x + stclX;
        jj = threadIdx.y + stclY;
        iin = ii + 1;
        iis = ii - 1;
        jje = jj + 1;
        jjw = jj - 1;

        // sync all the threads in the block up to this point
        __syncthreads();

        // memory optimization using shared memory
        __shared__ double smem[(Blk_H + 2*stclX)][(Blk_W + 2*stclY)];
        smem[ii][jj] = mat_in[i][j];
        // load north side of stencil
        if (threadIdx.x > (Blk_H - 2*stclX)){
            smem[ii + stclX][jj] =  mat_in[in][j];
        }
        // load south side of stencil
        if (threadIdx.x == 0){
            smem[ii - stclX][jj] =  mat_in[is][j];
        }
        // load east side of stencil
        if (threadIdx.y > (Blk_W - 2*stclY)){
            smem[ii][jj + stclY] =  mat_in[i][je];
        }
        // load west side of stencil
        if (threadIdx.y == 0){
            smem[ii][jj - stclY] =  mat_in[i][jw];
        }

        // sync threads to ensure all data is loaded into shared memory
        __syncthreads();

        // calculate 2D laplacian approximation (assume dx and dy = 1.0)
        d2y = smem[iis][jj] + smem[iin][jj] - 2.0*smem[ii][jj];
        d2x = smem[ii][jjw] + smem[ii][jje] - 2.0*smem[ii][jj];
        mat_out[i][j] = mat_out[i][j] + dt*(d2x + d2y);
    }
}

void write_ouput(num_col *phi,int nx,int ny,int step,double dx,double dy)
{
    string filename = to_string(step);
    filename = "fluid_" + filename + ".vtk";
    string d = "     ";

    ofstream outf(filename);
 
    // If we couldn't open the output file stream for writing
    if (!outf)
    {
        // Print an error and exit
        cerr << "could not open output file for reading!" << endl;
        exit(1);
    }

    // write file header
    outf << "# vtk DataFile Version 3.1" << endl;
    outf << "VTK file containing grid data" << endl;
    outf << "ASCII" << endl;
    outf << endl;
    outf << "DATASET STRUCTURED_POINTS" << endl;
    outf << "DIMENSIONS" << d<< nx << d << ny << "     1" << endl;
    outf << "ORIGIN 1 1 1" << endl;
    outf << "SPACING     1.0     1.0     1.0" << endl;
    outf << endl;
    outf << "POINT_DATA     " <<  nx*ny << endl;
    outf << "SCALARS Phi float" << endl;
    outf << "LOOKUP_TABLE default" << endl;

    // write out the values of phi
    for (int i=0; i<nx;i++){
        for (int j=0; j<ny;j++){
            outf << setw(16) << phi[i][j] << endl;
        }
    }
    
}

	.file	"tmpxft_0029fccd_00000000-6_fdExample.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB5096:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE5096:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZNSolsEPFRSoS_E.isra.0, @function
_ZNSolsEPFRSoS_E.isra.0:
.LFB5907:
	.cfi_startproc
	jmp	*%rsi
	.cfi_endproc
.LFE5907:
	.size	_ZNSolsEPFRSoS_E.isra.0, .-_ZNSolsEPFRSoS_E.isra.0
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"basic_string::append"
	.text
	.align 2
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm.isra.0, @function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm.isra.0:
.LFB5908:
	.cfi_startproc
	movabsq	$4611686018427387903, %rax
	subq	8(%rdi), %rax
	cmpq	%rdx, %rax
	jnb	.L4
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	.LC0(%rip), %rdi
	call	_ZSt20__throw_length_errorPKc@PLT
.L4:
	.cfi_def_cfa_offset 8
	jmp	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_appendEPKcm@PLT
	.cfi_endproc
.LFE5908:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm.isra.0, .-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm.isra.0
	.globl	_Z34__device_stub__Z7lap_perPA512_dS0_PA512_dS0_
	.type	_Z34__device_stub__Z7lap_perPA512_dS0_PA512_dS0_, @function
_Z34__device_stub__Z7lap_perPA512_dS0_PA512_dS0_:
.LFB5118:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	32(%rsp), %rcx
	leaq	24(%rsp), %rdx
	movq	%rsi, (%rsp)
	leaq	40(%rsp), %rdi
	leaq	52(%rsp), %rsi
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 48(%rsp)
	movq	%rax, 88(%rsp)
	movq	%rsp, %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 40(%rsp)
	movq	%rax, 52(%rsp)
	movl	$1, 60(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L9
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z7lap_perPA512_dS0_(%rip), %rdi
	pushq	32(%rsp)
	.cfi_def_cfa_offset 144
	movq	68(%rsp), %rcx
	movl	76(%rsp), %r8d
	movq	56(%rsp), %rsi
	movl	64(%rsp), %edx
	leaq	104(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L9:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE5118:
	.size	_Z34__device_stub__Z7lap_perPA512_dS0_PA512_dS0_, .-_Z34__device_stub__Z7lap_perPA512_dS0_PA512_dS0_
	.globl	_Z7lap_perPA512_dS0_
	.type	_Z7lap_perPA512_dS0_, @function
_Z7lap_perPA512_dS0_:
.LFB5119:
	.cfi_startproc
	endbr64
	jmp	_Z34__device_stub__Z7lap_perPA512_dS0_PA512_dS0_
	.cfi_endproc
.LFE5119:
	.size	_Z7lap_perPA512_dS0_, .-_Z7lap_perPA512_dS0_
	.globl	_Z34__device_stub__Z7calc_dfPA512_dS0_PA512_dS0_
	.type	_Z34__device_stub__Z7calc_dfPA512_dS0_PA512_dS0_, @function
_Z34__device_stub__Z7calc_dfPA512_dS0_PA512_dS0_:
.LFB5120:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	32(%rsp), %rcx
	leaq	24(%rsp), %rdx
	movq	%rsi, (%rsp)
	leaq	40(%rsp), %rdi
	leaq	52(%rsp), %rsi
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 48(%rsp)
	movq	%rax, 88(%rsp)
	movq	%rsp, %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 40(%rsp)
	movq	%rax, 52(%rsp)
	movl	$1, 60(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L14
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z7calc_dfPA512_dS0_(%rip), %rdi
	pushq	32(%rsp)
	.cfi_def_cfa_offset 144
	movq	68(%rsp), %rcx
	movl	76(%rsp), %r8d
	movq	56(%rsp), %rsi
	movl	64(%rsp), %edx
	leaq	104(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L14:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE5120:
	.size	_Z34__device_stub__Z7calc_dfPA512_dS0_PA512_dS0_, .-_Z34__device_stub__Z7calc_dfPA512_dS0_PA512_dS0_
	.globl	_Z7calc_dfPA512_dS0_
	.type	_Z7calc_dfPA512_dS0_, @function
_Z7calc_dfPA512_dS0_:
.LFB5121:
	.cfi_startproc
	endbr64
	jmp	_Z34__device_stub__Z7calc_dfPA512_dS0_PA512_dS0_
	.cfi_endproc
.LFE5121:
	.size	_Z7calc_dfPA512_dS0_, .-_Z7calc_dfPA512_dS0_
	.globl	_Z38__device_stub__Z10update_phiPA512_dS0_PA512_dS0_
	.type	_Z38__device_stub__Z10update_phiPA512_dS0_PA512_dS0_, @function
_Z38__device_stub__Z10update_phiPA512_dS0_PA512_dS0_:
.LFB5122:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	32(%rsp), %rcx
	leaq	24(%rsp), %rdx
	movq	%rsi, (%rsp)
	leaq	40(%rsp), %rdi
	leaq	52(%rsp), %rsi
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 48(%rsp)
	movq	%rax, 88(%rsp)
	movq	%rsp, %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 40(%rsp)
	movq	%rax, 52(%rsp)
	movl	$1, 60(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L19
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z10update_phiPA512_dS0_(%rip), %rdi
	pushq	32(%rsp)
	.cfi_def_cfa_offset 144
	movq	68(%rsp), %rcx
	movl	76(%rsp), %r8d
	movq	56(%rsp), %rsi
	movl	64(%rsp), %edx
	leaq	104(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L19:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE5122:
	.size	_Z38__device_stub__Z10update_phiPA512_dS0_PA512_dS0_, .-_Z38__device_stub__Z10update_phiPA512_dS0_PA512_dS0_
	.globl	_Z10update_phiPA512_dS0_
	.type	_Z10update_phiPA512_dS0_, @function
_Z10update_phiPA512_dS0_:
.LFB5123:
	.cfi_startproc
	endbr64
	jmp	_Z38__device_stub__Z10update_phiPA512_dS0_PA512_dS0_
	.cfi_endproc
.LFE5123:
	.size	_Z10update_phiPA512_dS0_, .-_Z10update_phiPA512_dS0_
	.section	.rodata.str1.1
.LC1:
	.string	"_Z10update_phiPA512_dS0_"
.LC2:
	.string	"_Z7calc_dfPA512_dS0_"
.LC3:
	.string	"_Z7lap_perPA512_dS0_"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB5125:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC1(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z10update_phiPA512_dS0_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC2(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z7calc_dfPA512_dS0_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC3(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z7lap_perPA512_dS0_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE5125:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata.str1.1
.LC5:
	.string	"fluid_"
.LC6:
	.string	".vtk"
.LC7:
	.string	"     "
.LC8:
	.string	"could not open output file for reading!"
.LC9:
	.string	"# vtk DataFile Version 3.1"
.LC10:
	.string	"VTK file containing grid data"
.LC11:
	.string	"ASCII"
.LC12:
	.string	"DATASET STRUCTURED_POINTS"
.LC13:
	.string	"DIMENSIONS"
.LC14:
	.string	"     1"
.LC15:
	.string	"ORIGIN 1 1 1"
.LC16:
	.string	"SPACING     1.0     1.0     1.0"
.LC17:
	.string	"POINT_DATA     "
.LC18:
	.string	"SCALARS Phi float"
.LC19:
	.string	"LOOKUP_TABLE default"
.LC4:
	.string	"00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899"
	.text
	.globl	_Z11write_ouputPA512_diiidd
	.type	_Z11write_ouputPA512_diiidd, @function
_Z11write_ouputPA512_diiidd:
.LFB5090:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA5090
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%ecx, %r8d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	shrl	$31, %r8d
	movl	$1, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%ecx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	subq	$840, %rsp
	.cfi_def_cfa_offset 896
	movq	%fs:40, %rax
	movq	%rax, 824(%rsp)
	xorl	%eax, %eax
	negl	%r13d
	cmovs	%ecx, %r13d
	movl	$10000, %ecx
	movl	%r13d, %eax
.L32:
	cmpl	$9, %eax
	jbe	.L28
	cmpl	$99, %eax
	ja	.L29
	incl	%r14d
	jmp	.L28
.L29:
	cmpl	$999, %eax
	ja	.L30
	addl	$2, %r14d
	jmp	.L28
.L30:
	cmpl	$9999, %eax
	ja	.L31
	addl	$3, %r14d
	jmp	.L28
.L31:
	movl	%eax, %eax
	xorl	%edx, %edx
	addl	$4, %r14d
	divq	%rcx
	jmp	.L32
.L28:
	leaq	40(%rsp), %rax
	leal	(%r8,%r14), %esi
	movl	$45, %edx
	decl	%r14d
	movq	%rax, 24(%rsp)
	movq	24(%rsp), %rdi
	leaq	56(%rsp), %rax
	movl	%r8d, 8(%rsp)
	movq	%rax, 40(%rsp)
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructEmc@PLT
	movl	8(%rsp), %r8d
	movl	$201, %ecx
	leaq	623(%rsp), %rdi
	leaq	.LC4(%rip), %rsi
	rep movsb
	movzbl	%r8b, %r8d
	movl	$100, %ecx
	addq	40(%rsp), %r8
.L33:
	cmpl	$99, %r13d
	jbe	.L67
	movl	%r13d, %eax
	xorl	%edx, %edx
	movl	%r14d, %esi
	divl	%ecx
	addl	%edx, %edx
	movl	%eax, %r13d
	leal	1(%rdx), %eax
	movb	623(%rsp,%rdx), %dl
	movb	623(%rsp,%rax), %al
	movb	%al, (%r8,%rsi)
	leal	-1(%r14), %eax
	subl	$2, %r14d
	movb	%dl, (%r8,%rax)
	jmp	.L33
.L67:
	leal	48(%r13), %eax
	cmpl	$9, %r13d
	jbe	.L36
	addl	%r13d, %r13d
	leal	1(%r13), %eax
	movb	623(%rsp,%rax), %al
	movb	%al, 1(%r8)
	movb	623(%rsp,%r13), %al
.L36:
	movb	%al, (%r8)
	movq	40(%rsp), %rax
	leaq	88(%rsp), %r13
	xorl	%edx, %edx
	movq	48(%rsp), %r14
	movq	%r13, 72(%rsp)
	movq	%rax, 8(%rsp)
	leaq	72(%rsp), %rax
	leaq	6(%r14), %rsi
	movq	%rax, %rdi
	movq	%rax, 16(%rsp)
	movq	%rdx, 80(%rsp)
	movb	$0, 88(%rsp)
.LEHB0:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEm@PLT
	movq	16(%rsp), %rdi
	movl	$6, %edx
	leaq	.LC5(%rip), %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm.isra.0
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rdi
	movq	%r14, %rdx
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm.isra.0
.LEHE0:
	jmp	.L68
.L59:
	endbr64
	jmp	.L66
.L68:
	movq	16(%rsp), %rdi
	leaq	.LC6(%rip), %rsi
.LEHB1:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKc@PLT
.LEHE1:
	movq	%rax, %rsi
	leaq	104(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1EOS4_@PLT
	movq	8(%rsp), %rdi
	call	_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv@PLT
	movq	112(%rsp), %r14
	testb	%al, %al
	je	.L40
	testq	%r14, %r14
	je	.L41
	movq	104(%rsp), %rsi
	movq	40(%rsp), %rdi
	movq	%r14, %rdx
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7_S_copyEPcPKcm@PLT
.L41:
	movq	112(%rsp), %rax
	movq	40(%rsp), %rdx
	movq	%rax, 48(%rsp)
	movb	$0, (%rdx,%rax)
	jmp	.L42
.L40:
	movq	24(%rsp), %rdi
	call	_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv@PLT
	movl	%eax, %edx
	xorl	%eax, %eax
	testb	%dl, %dl
	jne	.L43
	movq	40(%rsp), %rax
	movq	56(%rsp), %r15
.L43:
	movq	104(%rsp), %rdx
	movq	%r14, 48(%rsp)
	movq	%rdx, 40(%rsp)
	movq	120(%rsp), %rdx
	movq	%rdx, 56(%rsp)
	testq	%rax, %rax
	je	.L44
	movq	%rax, 104(%rsp)
	movq	%r15, 120(%rsp)
	jmp	.L42
.L44:
	leaq	120(%rsp), %rax
	movq	%rax, 104(%rsp)
.L42:
	xorl	%eax, %eax
	movq	8(%rsp), %rdi
	movq	%rax, 112(%rsp)
	movq	104(%rsp), %rax
	movb	$0, (%rax)
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	16(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	leaq	5+.LC7(%rip), %rdx
	movq	%r13, %rdi
	movq	%r13, 72(%rsp)
	leaq	-5(%rdx), %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13_S_copy_charsEPcPKcS7_@PLT
	movq	72(%rsp), %rax
	movq	24(%rsp), %rsi
	movq	$5, 80(%rsp)
	movq	8(%rsp), %rdi
	movl	$16, %edx
	movb	$0, 5(%rax)
.LEHB2:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1ERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode@PLT
.LEHE2:
	movl	384(%rsp), %r13d
	andl	$5, %r13d
	je	.L45
	leaq	.LC8(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
.LEHB3:
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	$1, %edi
	call	exit@PLT
.L45:
	movq	8(%rsp), %rdi
	leaq	.LC9(%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	8(%rsp), %rdi
	leaq	.LC10(%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	8(%rsp), %rdi
	leaq	.LC11(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	8(%rsp), %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	8(%rsp), %rdi
	leaq	.LC12(%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	8(%rsp), %rdi
	leaq	.LC13(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	16(%rsp), %rsi
	movq	%rax, %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	%rax, %rdi
	movl	%ebp, %esi
	call	_ZNSolsEi@PLT
	movq	16(%rsp), %rsi
	movq	%rax, %rdi
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	%rax, %rdi
	movl	%r12d, %esi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC14(%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	8(%rsp), %rdi
	leaq	.LC15(%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	8(%rsp), %rdi
	leaq	.LC16(%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	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	8(%rsp), %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	8(%rsp), %rdi
	leaq	.LC17(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebp, %esi
	movq	%rax, %rdi
	imull	%r12d, %esi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	8(%rsp), %rdi
	leaq	.LC18(%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	8(%rsp), %rdi
	leaq	.LC19(%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
	leaq	104(%rsp), %r15
.L46:
	cmpl	%ebp, %r13d
	jge	.L48
	xorl	%r14d, %r14d
.L49:
	cmpl	%r14d, %r12d
	jle	.L69
	movq	104(%rsp), %rax
	movsd	(%rbx,%r14,8), %xmm0
	movq	%r15, %rdi
	movq	-24(%rax), %rax
	movq	$16, 120(%rsp,%rax)
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.LEHE3:
	incq	%r14
	jmp	.L49
.L69:
	incl	%r13d
	addq	$4096, %rbx
	jmp	.L46
.L48:
	leaq	104(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	leaq	72(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	leaq	40(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	824(%rsp), %rax
	subq	%fs:40, %rax
	je	.L54
	jmp	.L64
.L56:
	endbr64
	jmp	.L66
.L58:
	endbr64
	movq	%rax, %rbx
.L51:
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L52
.L57:
	endbr64
.L66:
	movq	%rax, %rbx
.L52:
	movq	16(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	24(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	824(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L64
	movq	%rbx, %rdi
.LEHB4:
	call	_Unwind_Resume@PLT
.LEHE4:
.L64:
	call	__stack_chk_fail@PLT
.L54:
	addq	$840, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE5090:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA5090:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE5090-.LLSDACSB5090
.LLSDACSB5090:
	.uleb128 .LEHB0-.LFB5090
	.uleb128 .LEHE0-.LEHB0
	.uleb128 .L59-.LFB5090
	.uleb128 0
	.uleb128 .LEHB1-.LFB5090
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L56-.LFB5090
	.uleb128 0
	.uleb128 .LEHB2-.LFB5090
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L57-.LFB5090
	.uleb128 0
	.uleb128 .LEHB3-.LFB5090
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L58-.LFB5090
	.uleb128 0
	.uleb128 .LEHB4-.LFB5090
	.uleb128 .LEHE4-.LEHB4
	.uleb128 0
	.uleb128 0
.LLSDACSE5090:
	.text
	.size	_Z11write_ouputPA512_diiidd, .-_Z11write_ouputPA512_diiidd
	.section	.rodata.str1.1
.LC21:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/paulmillett/cueso/develop/src/fdExample.cu"
.LC22:
	.string	"cudaMalloc fail"
.LC23:
	.string	"Fatal error: %s (%s at %s:%d)\n"
.LC24:
	.string	"*** FAILED - ABORTING\n"
.LC30:
	.string	"cudaMemcpy H2D fail"
.LC31:
	.string	"cuda kernel fail"
.LC32:
	.string	"cudaMemcpy D2H fail"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB5089:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	$2097152, %edi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	call	malloc@PLT
	movl	$2097152, %edi
	movq	%rax, %rbx
	call	malloc@PLT
	movq	%rsp, %rdi
	movl	$2097152, %esi
	movq	%rax, %rbp
	call	cudaMalloc@PLT
	call	cudaGetLastError@PLT
	testl	%eax, %eax
	je	.L71
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	pushq	%rbp
	.cfi_remember_state
	.cfi_def_cfa_offset 88
	movq	%rax, %r8
	pushq	$64
	.cfi_def_cfa_offset 96
	jmp	.L97
.L71:
	.cfi_restore_state
	leaq	8(%rsp), %rdi
	movl	$2097152, %esi
	call	cudaMalloc@PLT
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L72
	call	cudaGetErrorString@PLT
	pushq	%rbx
	.cfi_def_cfa_offset 88
	pushq	$66
	.cfi_def_cfa_offset 96
	movq	%rax, %r8
.L97:
	leaq	.LC21(%rip), %r9
	leaq	.LC22(%rip), %rcx
.L98:
	movq	stderr(%rip), %rdi
	leaq	.LC23(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movq	stderr(%rip), %rdi
	popq	%r10
	.cfi_def_cfa_offset 88
	xorl	%eax, %eax
	popq	%r11
	.cfi_def_cfa_offset 80
	leaq	.LC24(%rip), %rdx
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L72:
	movsd	.LC26(%rip), %xmm3
	movq	%rbx, %rsi
	leaq	2097152(%rbx), %r8
	xorps	%xmm2, %xmm2
	movsd	.LC27(%rip), %xmm4
	movl	$1, %edx
	movl	$2147483647, %edi
	movsd	.LC29(%rip), %xmm5
.L73:
	xorl	%ecx, %ecx
.L79:
	imulq	$16807, %rdx, %rax
	xorl	%edx, %edx
	divq	%rdi
	movq	%rdx, %rax
	decq	%rax
	js	.L74
	cvtsi2sdq	%rax, %xmm0
	jmp	.L75
.L74:
	movq	%rax, %r9
	andl	$1, %eax
	shrq	%r9
	orq	%rax, %r9
	cvtsi2sdq	%r9, %xmm0
	addsd	%xmm0, %xmm0
.L75:
	imulq	$16807, %rdx, %rax
	xorl	%edx, %edx
	addsd	%xmm2, %xmm0
	divq	%rdi
	movq	%rdx, %rax
	decq	%rax
	js	.L76
	cvtsi2sdq	%rax, %xmm1
	jmp	.L77
.L76:
	movq	%rax, %r9
	andl	$1, %eax
	shrq	%r9
	orq	%rax, %r9
	cvtsi2sdq	%r9, %xmm1
	addsd	%xmm1, %xmm1
.L77:
	mulsd	%xmm3, %xmm1
	addsd	%xmm1, %xmm0
	divsd	%xmm4, %xmm0
	comisd	.LC28(%rip), %xmm0
	jb	.L78
	movsd	.LC20(%rip), %xmm0
.L78:
	addsd	%xmm0, %xmm0
	subsd	.LC28(%rip), %xmm0
	mulsd	%xmm5, %xmm0
	addsd	%xmm2, %xmm0
	movsd	%xmm0, (%rsi,%rcx,8)
	incq	%rcx
	cmpq	$512, %rcx
	jne	.L79
	addq	$4096, %rsi
	cmpq	%rsi, %r8
	jne	.L73
	movsd	.LC28(%rip), %xmm1
	movl	$1, %ecx
	movl	$512, %edx
	movq	%rbx, %rdi
	movl	$512, %esi
	movaps	%xmm1, %xmm0
	call	_Z11write_ouputPA512_diiidd
	movq	(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movl	$2097152, %edx
	call	cudaMemcpy@PLT
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L81
	call	cudaGetErrorString@PLT
	movq	%rax, %r8
	pushq	%r9
	.cfi_remember_state
	.cfi_def_cfa_offset 88
	pushq	$90
	.cfi_def_cfa_offset 96
	jmp	.L99
.L81:
	.cfi_restore_state
	movq	8(%rsp), %rdi
	movl	$1, %ecx
	movl	$2097152, %edx
	movq	%rbp, %rsi
	call	cudaMemcpy@PLT
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L82
	call	cudaGetErrorString@PLT
	pushq	%rdi
	.cfi_def_cfa_offset 88
	movq	%rax, %r8
	pushq	$92
	.cfi_def_cfa_offset 96
.L99:
	leaq	.LC21(%rip), %r9
	leaq	.LC30(%rip), %rcx
	jmp	.L98
.L82:
	.cfi_def_cfa_offset 80
	movl	$536870913, %eax
	movl	$1, 36(%rsp)
	movl	$1, %ebp
	movl	$1000, %r12d
	salq	$3, %rax
	movq	%rax, 20(%rsp)
	movabsq	$274877907008, %rax
	movq	%rax, 28(%rsp)
.L91:
	movl	24(%rsp), %ecx
	movq	28(%rsp), %rdi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$8, 16(%rsp)
	movl	36(%rsp), %esi
	movq	16(%rsp), %rdx
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L83
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	call	_Z34__device_stub__Z7lap_perPA512_dS0_PA512_dS0_
.L83:
	call	cudaDeviceSynchronize@PLT
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L84
	call	cudaGetErrorString@PLT
	movq	%rax, %r8
	pushq	%rsi
	.cfi_remember_state
	.cfi_def_cfa_offset 88
	pushq	$105
	.cfi_def_cfa_offset 96
	jmp	.L100
.L84:
	.cfi_restore_state
	movl	24(%rsp), %ecx
	movq	16(%rsp), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	28(%rsp), %rdi
	movl	36(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L85
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	call	_Z34__device_stub__Z7calc_dfPA512_dS0_PA512_dS0_
.L85:
	call	cudaDeviceSynchronize@PLT
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L86
	call	cudaGetErrorString@PLT
	movq	%rax, %r8
	pushq	%rcx
	.cfi_remember_state
	.cfi_def_cfa_offset 88
	pushq	$110
	.cfi_def_cfa_offset 96
	jmp	.L100
.L86:
	.cfi_restore_state
	movl	24(%rsp), %ecx
	movq	16(%rsp), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	28(%rsp), %rdi
	movl	36(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L87
	movq	(%rsp), %rsi
	movq	8(%rsp), %rdi
	call	_Z38__device_stub__Z10update_phiPA512_dS0_PA512_dS0_
.L87:
	call	cudaDeviceSynchronize@PLT
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L88
	call	cudaGetErrorString@PLT
	pushq	%rdx
	.cfi_def_cfa_offset 88
	movq	%rax, %r8
	pushq	$115
	.cfi_def_cfa_offset 96
.L100:
	leaq	.LC21(%rip), %r9
	leaq	.LC31(%rip), %rcx
	jmp	.L98
.L88:
	.cfi_def_cfa_offset 80
	movl	%ebp, %eax
	cltd
	idivl	%r12d
	testl	%edx, %edx
	jne	.L89
	movq	(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movl	$2, %ecx
	movl	$2097152, %edx
	call	cudaMemcpyAsync@PLT
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L90
	call	cudaGetErrorString@PLT
	leaq	.LC21(%rip), %r9
	leaq	.LC32(%rip), %rcx
	movq	%rax, %r8
	pushq	%rax
	.cfi_remember_state
	.cfi_def_cfa_offset 88
	pushq	$121
	.cfi_def_cfa_offset 96
	jmp	.L98
.L90:
	.cfi_restore_state
	movl	%ebp, %ecx
	movl	$512, %edx
	movl	$512, %esi
	movq	%rbx, %rdi
	movsd	.LC28(%rip), %xmm1
	movaps	%xmm1, %xmm0
	call	_Z11write_ouputPA512_diiidd
.L89:
	incl	%ebp
	cmpl	$10001, %ebp
	jne	.L91
	movq	(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L92
	call	__stack_chk_fail@PLT
.L92:
	addq	$48, %rsp
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE5089:
	.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
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC20:
	.long	-1
	.long	1072693247
	.align 8
.LC26:
	.long	-8388608
	.long	1105199103
	.align 8
.LC27:
	.long	-16777216
	.long	1137704959
	.align 8
.LC28:
	.long	0
	.long	1072693248
	.align 8
.LC29:
	.long	-1717986918
	.long	1069128089
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <iostream>
#include <random>
#include <fstream>
#include <string>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>

#define nr 512 
#define nc 512 
#define Blk_H 8 
#define Blk_W 8 
#define stclX 1
#define stclY 1
using namespace std;

// cuda code
#define cudaCheckErrors(msg) \
    do { \
        hipError_t __err = hipGetLastError(); \
        if (__err != hipSuccess) { \
            fprintf(stderr, "Fatal error: %s (%s at %s:%d)\n", \
                msg, hipGetErrorString(__err), \
                __FILE__, __LINE__); \
            fprintf(stderr, "*** FAILED - ABORTING\n"); \
            exit(1); \
        } \
    } while (0)

typedef double num_col[nc];

// function declartions
void write_ouput(num_col *phi,int nx,int ny,int step,double dx,double dy);

__global__ void lap_per(num_col * mat_in, num_col * mat_out);

__global__ void calc_df(num_col * mat_in, num_col * mat_out);

__global__ void update_phi(num_col * mat_in, num_col * mat_out);

int main(){
    // declare simulation variables
    int step;
    int steps    = 10000;
    int skip     = 1000;
    int ny       = nr;
    int nx       = nc;
    double dx    = 1.0;
    double dy    = 1.0;
    double phi0  = 0.0;
    num_col * phi;
    num_col * df;
    num_col * d_phi;
    num_col * d_df;

    int size = nx*ny*sizeof(double);

    // allocate resources for phi and df on cpu
    phi = (num_col*) malloc(size);
    df  = (num_col*) malloc(size);

    // allocate memory on gpu
    hipMalloc((void**) &d_phi,size);
    cudaCheckErrors("hipMalloc fail");
    hipMalloc((void**) &d_df,size);
    cudaCheckErrors("hipMalloc fail");

    // clean up output files from previous runs
//    system("rm fluid*");

    // random number stuff
    default_random_engine generator;
    uniform_real_distribution<double> ran(-1.0,1.0);
    
    // initialize system
    for (int i=0; i<nx;i++){
        for (int j=0; j<ny;j++){
            phi[i][j] = phi0 + 0.1*ran(generator);
        }
    }

    // write initial condition output file
    write_ouput(phi,nx,ny,1,dx,dy);

    // evolve the system using finite difference to
    // solve the CH equation

    // copy data to the gpu
    hipMemcpy(d_phi,phi,size,hipMemcpyHostToDevice);
    cudaCheckErrors("hipMemcpy H2D fail");
    hipMemcpy(d_df,df,size,hipMemcpyHostToDevice);
    cudaCheckErrors("hipMemcpy H2D fail");

    // get grid and block size
    dim3 threadsPerBlock(Blk_H,Blk_W);
    dim3 numBlocks( (nr + Blk_H - 1)/threadsPerBlock.x, (nc + Blk_W - 1)/threadsPerBlock.x );

    for (step = 1; step <= steps; step++){

        // pass the number crunching off to the gpu

        // calculate the laplacian of phi and store in df
        lap_per<<<numBlocks,threadsPerBlock>>>(d_phi,d_df);
        hipDeviceSynchronize();
        cudaCheckErrors("cuda kernel fail");

        // caclulate df and store in df
        calc_df<<<numBlocks,threadsPerBlock>>>(d_phi,d_df);
        hipDeviceSynchronize();
        cudaCheckErrors("cuda kernel fail");
        
        // calculate the laplacian of df and update phi
        update_phi<<<numBlocks,threadsPerBlock>>>(d_df,d_phi);
        hipDeviceSynchronize();
        cudaCheckErrors("cuda kernel fail");
        
        // write output
        if (step%skip == 0){
            // get phi from gpu
            hipMemcpyAsync(phi,d_phi,size,hipMemcpyDeviceToHost);
            cudaCheckErrors("hipMemcpy D2H fail");
            write_ouput(phi,nx,ny,step,dx,dy);
        }
    }

    // clean up on device
    hipFree(d_phi);
    hipFree(d_df);
    return 0;
}

// function definitions

__global__ void lap_per(num_col * mat_in, num_col * mat_out){
    int i = blockIdx.x * blockDim.x + threadIdx.x;
    int j = blockIdx.y * blockDim.y + threadIdx.y;
    int is,in,je,jw;
    int ii,jj,iis,iin,jje,jjw;

    __shared__ double d2x,d2y;

    if (i < nc && j < nr ){

        // get neighbors for stencil for the bulk case
        is = i - 1;
        in = i + 1;
        je = j + 1;
        jw = j - 1;

        // apply periodic boundary conditions
        // south boundary
        if (i == 0) is = nr - 1;
        // north boundary
        if (i == (nr-1)) in = 0;
        // west boundary
        if (j == 0) jw = nc - 1;
        // east boundary
        if (j == (nc-1)) je = 0;

        // shared memory neighbor indices
        ii = threadIdx.x + stclX;
        jj = threadIdx.y + stclY;
        iin = ii + 1;
        iis = ii - 1;
        jje = jj + 1;
        jjw = jj - 1;

        // sync all the threads in the block up to this point
        __syncthreads();

        // memory optimization using shared memory
        __shared__ double smem[(Blk_H + 2*stclX)][(Blk_W + 2*stclY)];
        smem[ii][jj] = mat_in[i][j];
        // load north side of stencil
        if (threadIdx.x > (Blk_H - 2*stclX)){
            smem[ii + stclX][jj] =  mat_in[in][j];
        }
        // load south side of stencil
        if (threadIdx.x == 0){
            smem[ii - stclX][jj] =  mat_in[is][j];
        }
        // load east side of stencil
        if (threadIdx.y > (Blk_W - 2*stclY)){
            smem[ii][jj + stclY] =  mat_in[i][je];
        }
        // load west side of stencil
        if (threadIdx.y == 0){
            smem[ii][jj - stclY] =  mat_in[i][jw];
        }

        // sync threads to ensure all data is loaded into shared memory
        __syncthreads();

        // calculate 2D laplacian approximation (assume dx and dy = 1.0)
        d2y = smem[iis][jj] + smem[iin][jj] - 2.0*smem[ii][jj];
        d2x = smem[ii][jjw] + smem[ii][jje] - 2.0*smem[ii][jj];
        mat_out[i][j] = d2x + d2y;
    }
}

__global__ void calc_df(num_col * mat_in, num_col * mat_out){
    int i = blockIdx.x * blockDim.x + threadIdx.x;
    int j = blockIdx.y * blockDim.y + threadIdx.y;
    int ii = threadIdx.x;
    int jj = threadIdx.y;
    if (i < nc && j < nr ){

        // memory optimization using shared memory
        __shared__ double smem[(Blk_H)][(Blk_W)];
        smem[ii][jj] = mat_in[i][j];

        // calulate df[i][j] noting that it currently stores the laplacian of phi
        // also assume kappa=1.0
        mat_out[i][j] = -1.0*mat_out[i][j] + smem[ii][jj]*smem[ii][jj]*smem[ii][jj] - smem[ii][jj];
    }
}

__global__ void update_phi(num_col * mat_in, num_col * mat_out){
    int i = blockIdx.x * blockDim.x + threadIdx.x;
    int j = blockIdx.y * blockDim.y + threadIdx.y;
    int is,in,je,jw;
    int ii,jj,iis,iin,jje,jjw;
    __shared__ double d2x,d2y,dt;
    dt = 0.01;
    if (i < nc && j < nr ){
        // get neighbors for stencil for the bulk case
        is = i - 1;
        in = i + 1;
        je = j + 1;
        jw = j - 1;

        // apply periodic boundary conditions
        // left boundary
        if (i == 0) is = nr - 1;
        // right boundary
        if (i == (nr-1)) in = 0;
        // bottom boundary
        if (j == 0) jw = nc - 1;
        // top boundary
        if (j == (nc-1)) je = 0;

        // shared memory neighbor indices
        ii = threadIdx.x + stclX;
        jj = threadIdx.y + stclY;
        iin = ii + 1;
        iis = ii - 1;
        jje = jj + 1;
        jjw = jj - 1;

        // sync all the threads in the block up to this point
        __syncthreads();

        // memory optimization using shared memory
        __shared__ double smem[(Blk_H + 2*stclX)][(Blk_W + 2*stclY)];
        smem[ii][jj] = mat_in[i][j];
        // load north side of stencil
        if (threadIdx.x > (Blk_H - 2*stclX)){
            smem[ii + stclX][jj] =  mat_in[in][j];
        }
        // load south side of stencil
        if (threadIdx.x == 0){
            smem[ii - stclX][jj] =  mat_in[is][j];
        }
        // load east side of stencil
        if (threadIdx.y > (Blk_W - 2*stclY)){
            smem[ii][jj + stclY] =  mat_in[i][je];
        }
        // load west side of stencil
        if (threadIdx.y == 0){
            smem[ii][jj - stclY] =  mat_in[i][jw];
        }

        // sync threads to ensure all data is loaded into shared memory
        __syncthreads();

        // calculate 2D laplacian approximation (assume dx and dy = 1.0)
        d2y = smem[iis][jj] + smem[iin][jj] - 2.0*smem[ii][jj];
        d2x = smem[ii][jjw] + smem[ii][jje] - 2.0*smem[ii][jj];
        mat_out[i][j] = mat_out[i][j] + dt*(d2x + d2y);
    }
}

void write_ouput(num_col *phi,int nx,int ny,int step,double dx,double dy)
{
    string filename = to_string(step);
    filename = "fluid_" + filename + ".vtk";
    string d = "     ";

    ofstream outf(filename);
 
    // If we couldn't open the output file stream for writing
    if (!outf)
    {
        // Print an error and exit
        cerr << "could not open output file for reading!" << endl;
        exit(1);
    }

    // write file header
    outf << "# vtk DataFile Version 3.1" << endl;
    outf << "VTK file containing grid data" << endl;
    outf << "ASCII" << endl;
    outf << endl;
    outf << "DATASET STRUCTURED_POINTS" << endl;
    outf << "DIMENSIONS" << d<< nx << d << ny << "     1" << endl;
    outf << "ORIGIN 1 1 1" << endl;
    outf << "SPACING     1.0     1.0     1.0" << endl;
    outf << endl;
    outf << "POINT_DATA     " <<  nx*ny << endl;
    outf << "SCALARS Phi float" << endl;
    outf << "LOOKUP_TABLE default" << endl;

    // write out the values of phi
    for (int i=0; i<nx;i++){
        for (int j=0; j<ny;j++){
            outf << setw(16) << phi[i][j] << endl;
        }
    }
    
}

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

                                        # End of file scope inline assembly
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI0_0:
	.quad	0xbff0000000000000              # double -1
.LCPI0_1:
	.quad	0x3fb999999999999a              # double 0.10000000000000001
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	$2097152, %edi                  # imm = 0x200000
	callq	malloc
	movq	%rax, %rbx
	movl	$2097152, %edi                  # imm = 0x200000
	callq	malloc
	movq	%rax, %r14
	movq	%rsp, %rdi
	movl	$2097152, %esi                  # imm = 0x200000
	callq	hipMalloc
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB0_1
# %bb.3:
	leaq	8(%rsp), %rdi
	movl	$2097152, %esi                  # imm = 0x200000
	callq	hipMalloc
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB0_4
# %bb.5:
	leaq	16(%rsp), %r15
	movq	$1, (%r15)
	xorl	%r12d, %r12d
	movq	%rbx, %r13
.LBB0_6:                                # %.preheader107
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_7 Depth 2
	xorl	%ebp, %ebp
.LBB0_7:                                #   Parent Loop BB0_6 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	%r15, %rdi
	callq	_ZSt18generate_canonicalIdLm53ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_
	movsd	.LCPI0_0(%rip), %xmm1           # xmm1 = mem[0],zero
	addsd	%xmm0, %xmm0
	addsd	%xmm1, %xmm0
	movsd	.LCPI0_1(%rip), %xmm1           # xmm1 = mem[0],zero
	mulsd	%xmm1, %xmm0
	xorpd	%xmm1, %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, (%r13,%rbp,8)
	incq	%rbp
	cmpq	$512, %rbp                      # imm = 0x200
	jne	.LBB0_7
# %bb.8:                                #   in Loop: Header=BB0_6 Depth=1
	incq	%r12
	addq	$4096, %r13                     # imm = 0x1000
	cmpq	$512, %r12                      # imm = 0x200
	jne	.LBB0_6
# %bb.9:
	movq	%rbx, %rdi
	movl	$512, %esi                      # imm = 0x200
	movl	$512, %edx                      # imm = 0x200
	movl	$1, %ecx
	callq	_Z11write_ouputPA512_diiidd
	movq	(%rsp), %rdi
	movl	$2097152, %edx                  # imm = 0x200000
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB0_10
# %bb.11:
	movq	8(%rsp), %rdi
	movl	$1, %ebp
	movl	$2097152, %edx                  # imm = 0x200000
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB0_31
# %bb.12:                               # %.preheader.preheader
	movabsq	$274877907008, %r14             # imm = 0x4000000040
	movabsq	$34359738376, %r15              # imm = 0x800000008
	movl	$65535, %r12d                   # imm = 0xFFFF
.LBB0_13:                               # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB0_15
# %bb.14:                               #   in Loop: Header=BB0_13 Depth=1
	movq	(%rsp), %rdi
	movq	8(%rsp), %rsi
	callq	_Z22__device_stub__lap_perPA512_dS0_
.LBB0_15:                               #   in Loop: Header=BB0_13 Depth=1
	callq	hipDeviceSynchronize
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB0_16
# %bb.17:                               #   in Loop: Header=BB0_13 Depth=1
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB0_19
# %bb.18:                               #   in Loop: Header=BB0_13 Depth=1
	movq	(%rsp), %rdi
	movq	8(%rsp), %rsi
	callq	_Z22__device_stub__calc_dfPA512_dS0_
.LBB0_19:                               #   in Loop: Header=BB0_13 Depth=1
	callq	hipDeviceSynchronize
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB0_20
# %bb.21:                               #   in Loop: Header=BB0_13 Depth=1
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB0_23
# %bb.22:                               #   in Loop: Header=BB0_13 Depth=1
	movq	8(%rsp), %rdi
	movq	(%rsp), %rsi
	callq	_Z25__device_stub__update_phiPA512_dS0_
.LBB0_23:                               #   in Loop: Header=BB0_13 Depth=1
	callq	hipDeviceSynchronize
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB0_24
# %bb.25:                               #   in Loop: Header=BB0_13 Depth=1
	movl	%ebp, %eax
	andl	%r12d, %eax
	shrl	$3, %eax
	imull	$8389, %eax, %eax               # imm = 0x20C5
	shrl	$20, %eax
	imull	$-1000, %eax, %eax              # imm = 0xFC18
	andl	%r12d, %eax
	addw	%bp, %ax
	jne	.LBB0_29
# %bb.26:                               #   in Loop: Header=BB0_13 Depth=1
	movq	(%rsp), %rsi
	movl	$2097152, %edx                  # imm = 0x200000
	movq	%rbx, %rdi
	movl	$2, %ecx
	xorl	%r8d, %r8d
	callq	hipMemcpyAsync
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB0_27
# %bb.28:                               #   in Loop: Header=BB0_13 Depth=1
	movq	%rbx, %rdi
	movl	$512, %esi                      # imm = 0x200
	movl	$512, %edx                      # imm = 0x200
	movl	%ebp, %ecx
	callq	_Z11write_ouputPA512_diiidd
.LBB0_29:                               #   in Loop: Header=BB0_13 Depth=1
	incl	%ebp
	cmpl	$10001, %ebp                    # imm = 0x2711
	jne	.LBB0_13
# %bb.30:
	movq	(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB0_24:
	.cfi_def_cfa_offset 80
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %esi
	movl	$.L.str.5, %edx
	movl	$.L.str.2, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rcx
	movl	$117, %r9d
	jmp	.LBB0_2
.LBB0_20:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %esi
	movl	$.L.str.5, %edx
	movl	$.L.str.2, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rcx
	movl	$112, %r9d
	jmp	.LBB0_2
.LBB0_16:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %esi
	movl	$.L.str.5, %edx
	movl	$.L.str.2, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rcx
	movl	$107, %r9d
	jmp	.LBB0_2
.LBB0_27:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %esi
	movl	$.L.str.6, %edx
	movl	$.L.str.2, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rcx
	movl	$123, %r9d
.LBB0_2:
	xorl	%eax, %eax
	callq	fprintf
	movq	stderr(%rip), %rcx
	movl	$.L.str.3, %edi
	movl	$22, %esi
	movl	$1, %edx
	callq	fwrite@PLT
	movl	$1, %edi
	callq	exit
.LBB0_1:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %esi
	movl	$.L.str.1, %edx
	movl	$.L.str.2, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rcx
	movl	$66, %r9d
	jmp	.LBB0_2
.LBB0_4:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %esi
	movl	$.L.str.1, %edx
	movl	$.L.str.2, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rcx
	movl	$68, %r9d
	jmp	.LBB0_2
.LBB0_10:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %esi
	movl	$.L.str.4, %edx
	movl	$.L.str.2, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rcx
	movl	$92, %r9d
	jmp	.LBB0_2
.LBB0_31:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %esi
	movl	$.L.str.4, %edx
	movl	$.L.str.2, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rcx
	movl	$94, %r9d
	jmp	.LBB0_2
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
                                        # -- End function
	.globl	_Z11write_ouputPA512_diiidd     # -- Begin function _Z11write_ouputPA512_diiidd
	.type	_Z11write_ouputPA512_diiidd,@function
_Z11write_ouputPA512_diiidd:            # @_Z11write_ouputPA512_diiidd
.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	$600, %rsp                      # imm = 0x258
	.cfi_def_cfa_offset 656
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%ecx, %r12d
	movl	%edx, 12(%rsp)                  # 4-byte Spill
	movl	%esi, %ebx
	movq	%rdi, %r14
	movl	%ecx, %r15d
	negl	%r15d
	cmovsl	%ecx, %r15d
	movl	$1, %r13d
	cmpl	$10, %r15d
	jb	.LBB1_9
# %bb.1:                                # %.lr.ph.i.i.preheader
	movl	$4, %r13d
	movl	$3518437209, %eax               # imm = 0xD1B71759
	movl	%r15d, %ecx
.LBB1_2:                                # %.lr.ph.i.i
                                        # =>This Inner Loop Header: Depth=1
	cmpl	$99, %ecx
	jbe	.LBB1_3
# %bb.4:                                #   in Loop: Header=BB1_2 Depth=1
	cmpl	$999, %ecx                      # imm = 0x3E7
	jbe	.LBB1_5
# %bb.6:                                #   in Loop: Header=BB1_2 Depth=1
	cmpl	$10000, %ecx                    # imm = 0x2710
	jb	.LBB1_9
# %bb.7:                                #   in Loop: Header=BB1_2 Depth=1
	movl	%ecx, %edx
	imulq	%rax, %rdx
	shrq	$45, %rdx
	addl	$4, %r13d
	cmpl	$99999, %ecx                    # imm = 0x1869F
	movl	%edx, %ecx
	ja	.LBB1_2
# %bb.8:                                # %_ZNSt8__detail14__to_chars_lenIjEEjT_i.exit.i.loopexit
	addl	$-3, %r13d
	jmp	.LBB1_9
.LBB1_3:
	addl	$-2, %r13d
	jmp	.LBB1_9
.LBB1_5:
	decl	%r13d
.LBB1_9:                                # %_ZNSt8__detail14__to_chars_lenIjEEjT_i.exit.i
	shrl	$31, %r12d
	leal	(%r12,%r13), %esi
	leaq	72(%rsp), %rax
	movq	%rax, -16(%rax)
.Ltmp0:
	leaq	56(%rsp), %rdi
	movl	$45, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructEmc
.Ltmp1:
# %bb.10:                               # %_ZNSt7__cxx119to_stringEi.exit
	movl	%r12d, %edi
	addq	56(%rsp), %rdi
	movl	%r13d, %esi
	movl	%r15d, %edx
	callq	_ZNSt8__detail18__to_chars_10_implIjEEvPcjT_
	movq	56(%rsp), %r15
	movq	64(%rsp), %r12
	leaq	32(%rsp), %r13
	movq	%r13, -16(%r13)
	movq	$0, -8(%r13)
	movb	$0, (%r13)
	leaq	6(%r12), %rsi
.Ltmp3:
	leaq	16(%rsp), %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEm
.Ltmp4:
# %bb.11:
.Ltmp5:
	leaq	16(%rsp), %rdi
	movl	$.L.str.7, %esi
	movl	$6, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm
.Ltmp6:
# %bb.12:
.Ltmp7:
	leaq	16(%rsp), %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm
.Ltmp8:
# %bb.13:                               # %_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_RKS8_.exit
.Ltmp10:
	leaq	16(%rsp), %rdi
	movl	$.L.str.8, %esi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKc
.Ltmp11:
# %bb.14:                               # %.noexc
	movq	%rax, %r12
	movl	%ebx, 48(%rsp)                  # 4-byte Spill
	leaq	104(%rsp), %r15
	movq	%r15, -16(%r15)
	movq	(%rax), %rsi
	movq	%rax, %rbx
	addq	$16, %rbx
	cmpq	%rbx, %rsi
	je	.LBB1_15
# %bb.17:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	movq	%rsi, 88(%rsp)
	movq	16(%r12), %rax
	movq	%rax, 104(%rsp)
	movq	8(%r12), %rbp
	jmp	.LBB1_18
.LBB1_15:
	movq	8(%r12), %rbp
	leaq	1(%rbp), %rdx
	movq	%r15, %rdi
	callq	memcpy@PLT
.LBB1_18:
	leaq	88(%rsp), %r13
	movq	%rbp, 8(%r13)
	movq	%rbx, (%r12)
	movq	$0, 8(%r12)
	movb	$0, 16(%r12)
	leaq	56(%rsp), %rdi
	movq	%r13, %rsi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_
	movq	(%r13), %rdi
	cmpq	%r15, %rdi
	je	.LBB1_20
# %bb.19:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i28
	callq	_ZdlPv
.LBB1_20:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	movq	16(%rsp), %rdi
	leaq	32(%rsp), %r15
	cmpq	%r15, %rdi
	movl	48(%rsp), %ebx                  # 4-byte Reload
	je	.LBB1_22
# %bb.21:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i29
	callq	_ZdlPv
.LBB1_22:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit31
	leaq	16(%rsp), %rdi
	movq	%r15, (%rdi)
.Ltmp13:
	movl	$.L.str.9, %esi
	movl	$.L.str.9+5, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
.Ltmp14:
# %bb.23:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.exit
.Ltmp16:
	leaq	88(%rsp), %rdi
	leaq	56(%rsp), %rsi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1ERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode
.Ltmp17:
# %bb.24:
	movq	88(%rsp), %rax
	movq	-24(%rax), %rax
	testb	$5, 120(%rsp,%rax)
	jne	.LBB1_25
# %bb.33:
.Ltmp23:
	leaq	88(%rsp), %r15
	movl	$.L.str.11, %esi
	movl	$26, %edx
	movq	%r15, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp24:
# %bb.34:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit39
	movq	88(%rsp), %rax
	addq	-24(%rax), %r15
.Ltmp25:
	movq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp26:
# %bb.35:                               # %.noexc102
.Ltmp27:
	movsbl	%al, %esi
	leaq	88(%rsp), %rdi
	callq	_ZNSo3putEc
.Ltmp28:
# %bb.36:                               # %.noexc103
.Ltmp29:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp30:
# %bb.37:                               # %_ZNSolsEPFRSoS_E.exit41
.Ltmp31:
	leaq	88(%rsp), %r15
	movl	$.L.str.12, %esi
	movl	$29, %edx
	movq	%r15, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp32:
# %bb.38:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit43
	movq	88(%rsp), %rax
	addq	-24(%rax), %r15
.Ltmp33:
	movq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp34:
# %bb.39:                               # %.noexc105
.Ltmp35:
	movsbl	%al, %esi
	leaq	88(%rsp), %rdi
	callq	_ZNSo3putEc
.Ltmp36:
# %bb.40:                               # %.noexc106
.Ltmp37:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp38:
# %bb.41:                               # %_ZNSolsEPFRSoS_E.exit45
.Ltmp39:
	leaq	88(%rsp), %r15
	movl	$.L.str.13, %esi
	movl	$5, %edx
	movq	%r15, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp40:
# %bb.42:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit47
	movq	88(%rsp), %rax
	addq	-24(%rax), %r15
.Ltmp41:
	movq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp42:
# %bb.43:                               # %.noexc109
.Ltmp43:
	movsbl	%al, %esi
	leaq	88(%rsp), %r15
	movq	%r15, %rdi
	callq	_ZNSo3putEc
.Ltmp44:
# %bb.44:                               # %.noexc110
.Ltmp45:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp46:
# %bb.45:                               # %_ZNSolsEPFRSoS_E.exit49
	movq	88(%rsp), %rax
	addq	-24(%rax), %r15
.Ltmp47:
	movq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp48:
# %bb.46:                               # %.noexc113
.Ltmp49:
	movsbl	%al, %esi
	leaq	88(%rsp), %rdi
	callq	_ZNSo3putEc
.Ltmp50:
# %bb.47:                               # %.noexc114
.Ltmp51:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp52:
# %bb.48:                               # %_ZNSolsEPFRSoS_E.exit51
.Ltmp53:
	leaq	88(%rsp), %r15
	movl	$.L.str.14, %esi
	movl	$25, %edx
	movq	%r15, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp54:
# %bb.49:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit53
	movq	88(%rsp), %rax
	addq	-24(%rax), %r15
.Ltmp55:
	movq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp56:
# %bb.50:                               # %.noexc117
.Ltmp57:
	movsbl	%al, %esi
	leaq	88(%rsp), %rdi
	callq	_ZNSo3putEc
.Ltmp58:
# %bb.51:                               # %.noexc118
.Ltmp59:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp60:
# %bb.52:                               # %_ZNSolsEPFRSoS_E.exit55
.Ltmp61:
	leaq	88(%rsp), %rdi
	movl	$.L.str.15, %esi
	movl	$10, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp62:
# %bb.53:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit57
	movq	16(%rsp), %rsi
	movq	24(%rsp), %rdx
.Ltmp63:
	leaq	88(%rsp), %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp64:
# %bb.54:                               # %_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit
.Ltmp65:
	movq	%rax, %rdi
	movl	%ebx, %esi
	callq	_ZNSolsEi
.Ltmp66:
# %bb.55:
	movq	16(%rsp), %rsi
	movq	24(%rsp), %rdx
.Ltmp67:
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp68:
# %bb.56:                               # %_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit60
.Ltmp69:
	movq	%rax, %rdi
	movl	12(%rsp), %esi                  # 4-byte Reload
	callq	_ZNSolsEi
.Ltmp70:
# %bb.57:
.Ltmp71:
	movq	%rax, %r15
	movl	$.L.str.16, %esi
	movl	$6, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp72:
# %bb.58:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit62
	movq	(%r15), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
.Ltmp73:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp74:
# %bb.59:                               # %.noexc121
.Ltmp75:
	movsbl	%al, %esi
	movq	%r15, %rdi
	callq	_ZNSo3putEc
.Ltmp76:
# %bb.60:                               # %.noexc122
.Ltmp77:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp78:
# %bb.61:                               # %_ZNSolsEPFRSoS_E.exit64
.Ltmp79:
	leaq	88(%rsp), %r15
	movl	$.L.str.17, %esi
	movl	$12, %edx
	movq	%r15, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp80:
# %bb.62:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit66
	movq	88(%rsp), %rax
	addq	-24(%rax), %r15
.Ltmp81:
	movq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp82:
# %bb.63:                               # %.noexc125
.Ltmp83:
	movsbl	%al, %esi
	leaq	88(%rsp), %rdi
	callq	_ZNSo3putEc
.Ltmp84:
# %bb.64:                               # %.noexc126
.Ltmp85:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp86:
# %bb.65:                               # %_ZNSolsEPFRSoS_E.exit68
.Ltmp87:
	leaq	88(%rsp), %r15
	movl	$.L.str.18, %esi
	movl	$31, %edx
	movq	%r15, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp88:
# %bb.66:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit70
	movq	88(%rsp), %rax
	addq	-24(%rax), %r15
.Ltmp89:
	movq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp90:
# %bb.67:                               # %.noexc129
.Ltmp91:
	movsbl	%al, %esi
	leaq	88(%rsp), %r15
	movq	%r15, %rdi
	callq	_ZNSo3putEc
.Ltmp92:
# %bb.68:                               # %.noexc130
.Ltmp93:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp94:
# %bb.69:                               # %_ZNSolsEPFRSoS_E.exit72
	movq	88(%rsp), %rax
	addq	-24(%rax), %r15
.Ltmp95:
	movq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp96:
# %bb.70:                               # %.noexc133
.Ltmp97:
	movsbl	%al, %esi
	leaq	88(%rsp), %rdi
	callq	_ZNSo3putEc
.Ltmp98:
# %bb.71:                               # %.noexc134
.Ltmp99:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp100:
# %bb.72:                               # %_ZNSolsEPFRSoS_E.exit74
.Ltmp101:
	leaq	88(%rsp), %rdi
	movl	$.L.str.19, %esi
	movl	$15, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp102:
# %bb.73:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit76
	movl	12(%rsp), %esi                  # 4-byte Reload
	imull	%ebx, %esi
.Ltmp103:
	leaq	88(%rsp), %rdi
	callq	_ZNSolsEi
.Ltmp104:
# %bb.74:
	movq	%rax, %r15
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
.Ltmp105:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp106:
# %bb.75:                               # %.noexc137
.Ltmp107:
	movsbl	%al, %esi
	movq	%r15, %rdi
	callq	_ZNSo3putEc
.Ltmp108:
# %bb.76:                               # %.noexc138
.Ltmp109:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp110:
# %bb.77:                               # %_ZNSolsEPFRSoS_E.exit78
.Ltmp111:
	leaq	88(%rsp), %r15
	movl	$.L.str.20, %esi
	movl	$17, %edx
	movq	%r15, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp112:
# %bb.78:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit80
	movq	88(%rsp), %rax
	addq	-24(%rax), %r15
.Ltmp113:
	movq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp114:
# %bb.79:                               # %.noexc141
.Ltmp115:
	movsbl	%al, %esi
	leaq	88(%rsp), %rdi
	callq	_ZNSo3putEc
.Ltmp116:
# %bb.80:                               # %.noexc142
.Ltmp117:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp118:
# %bb.81:                               # %_ZNSolsEPFRSoS_E.exit82
.Ltmp119:
	leaq	88(%rsp), %r15
	movl	$.L.str.21, %esi
	movl	$20, %edx
	movq	%r15, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp120:
# %bb.82:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit84
	movq	88(%rsp), %rax
	addq	-24(%rax), %r15
.Ltmp121:
	movq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp122:
# %bb.83:                               # %.noexc145
.Ltmp123:
	movsbl	%al, %esi
	leaq	88(%rsp), %rdi
	callq	_ZNSo3putEc
.Ltmp124:
# %bb.84:                               # %.noexc146
.Ltmp125:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp126:
# %bb.85:                               # %_ZNSolsEPFRSoS_E.exit86.preheader
	testl	%ebx, %ebx
	jle	.LBB1_95
# %bb.86:                               # %.preheader.lr.ph
	movl	%ebx, %eax
	movq	%rax, 48(%rsp)                  # 8-byte Spill
	movl	12(%rsp), %ebp                  # 4-byte Reload
	xorl	%ebx, %ebx
	leaq	88(%rsp), %r15
.LBB1_87:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_89 Depth 2
	cmpl	$0, 12(%rsp)                    # 4-byte Folded Reload
	jle	.LBB1_94
# %bb.88:                               # %.lr.ph.preheader
                                        #   in Loop: Header=BB1_87 Depth=1
	xorl	%r13d, %r13d
.LBB1_89:                               # %.lr.ph
                                        #   Parent Loop BB1_87 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	88(%rsp), %rax
	movq	-24(%rax), %rax
	movq	$16, 104(%rsp,%rax)
	movsd	(%r14,%r13,8), %xmm0            # xmm0 = mem[0],zero
.Ltmp128:
	movq	%r15, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp129:
# %bb.90:                               # %_ZNSolsEd.exit
                                        #   in Loop: Header=BB1_89 Depth=2
	movq	%rax, %r12
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r12, %rdi
.Ltmp130:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp131:
# %bb.91:                               # %.noexc149
                                        #   in Loop: Header=BB1_89 Depth=2
.Ltmp132:
	movsbl	%al, %esi
	movq	%r12, %rdi
	callq	_ZNSo3putEc
.Ltmp133:
# %bb.92:                               # %.noexc150
                                        #   in Loop: Header=BB1_89 Depth=2
.Ltmp134:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp135:
# %bb.93:                               # %_ZNSolsEPFRSoS_E.exit95
                                        #   in Loop: Header=BB1_89 Depth=2
	incq	%r13
	cmpq	%r13, %rbp
	jne	.LBB1_89
.LBB1_94:                               # %_ZNSolsEPFRSoS_E.exit86
                                        #   in Loop: Header=BB1_87 Depth=1
	incq	%rbx
	addq	$4096, %r14                     # imm = 0x1000
	cmpq	48(%rsp), %rbx                  # 8-byte Folded Reload
	jne	.LBB1_87
.LBB1_95:                               # %_ZNSolsEPFRSoS_E.exit86._crit_edge
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	96(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 88(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	336(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	movq	16(%rsp), %rdi
	leaq	32(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB1_97
# %bb.96:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i87
	callq	_ZdlPv
.LBB1_97:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit89
	movq	56(%rsp), %rdi
	leaq	72(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB1_99
# %bb.98:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i90
	callq	_ZdlPv
.LBB1_99:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit92
	addq	$600, %rsp                      # imm = 0x258
	.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_25:
	.cfi_def_cfa_offset 656
.Ltmp19:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.10, %esi
	movl	$39, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp20:
# %bb.26:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
.Ltmp21:
	movl	$_ZSt4cerr, %edi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp22:
# %bb.27:                               # %_ZNSolsEPFRSoS_E.exit
	movl	$1, %edi
	callq	exit
.LBB1_31:
.Ltmp18:
	movq	%rax, %rbx
	jmp	.LBB1_102
.LBB1_30:
.Ltmp15:
	movq	%rax, %rbx
	jmp	.LBB1_104
.LBB1_28:
.Ltmp12:
	jmp	.LBB1_29
.LBB1_107:
.Ltmp2:
	movq	%rax, %rdi
	callq	__clang_call_terminate
.LBB1_16:
.Ltmp9:
.LBB1_29:
	movq	%rax, %rbx
	movq	16(%rsp), %rdi
	cmpq	%r13, %rdi
	jne	.LBB1_103
	jmp	.LBB1_104
.LBB1_32:
.Ltmp127:
	jmp	.LBB1_101
.LBB1_100:
.Ltmp136:
.LBB1_101:
	movq	%rax, %rbx
	leaq	88(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
	leaq	32(%rsp), %r15
.LBB1_102:
	movq	16(%rsp), %rdi
	cmpq	%r15, %rdi
	je	.LBB1_104
.LBB1_103:                              # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i96
	callq	_ZdlPv
.LBB1_104:                              # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit98
	leaq	72(%rsp), %rax
	movq	56(%rsp), %rdi
	cmpq	%rax, %rdi
	je	.LBB1_106
# %bb.105:                              # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i99
	callq	_ZdlPv
.LBB1_106:                              # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit101
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end1:
	.size	_Z11write_ouputPA512_diiidd, .Lfunc_end1-_Z11write_ouputPA512_diiidd
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table1:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	3                               # @TType Encoding = udata4
	.uleb128 .Lttbase0-.Lttbaseref0
.Lttbaseref0:
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 1 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp2-.Lfunc_begin0           #     jumps to .Ltmp2
	.byte	1                               #   On action: 1
	.uleb128 .Ltmp3-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp8-.Ltmp3                  #   Call between .Ltmp3 and .Ltmp8
	.uleb128 .Ltmp9-.Lfunc_begin0           #     jumps to .Ltmp9
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp10-.Lfunc_begin0          # >> Call Site 3 <<
	.uleb128 .Ltmp11-.Ltmp10                #   Call between .Ltmp10 and .Ltmp11
	.uleb128 .Ltmp12-.Lfunc_begin0          #     jumps to .Ltmp12
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp11-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Ltmp13-.Ltmp11                #   Call between .Ltmp11 and .Ltmp13
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp13-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp14-.Ltmp13                #   Call between .Ltmp13 and .Ltmp14
	.uleb128 .Ltmp15-.Lfunc_begin0          #     jumps to .Ltmp15
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp16-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp17-.Ltmp16                #   Call between .Ltmp16 and .Ltmp17
	.uleb128 .Ltmp18-.Lfunc_begin0          #     jumps to .Ltmp18
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp23-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp126-.Ltmp23               #   Call between .Ltmp23 and .Ltmp126
	.uleb128 .Ltmp127-.Lfunc_begin0         #     jumps to .Ltmp127
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp128-.Lfunc_begin0         # >> Call Site 8 <<
	.uleb128 .Ltmp135-.Ltmp128              #   Call between .Ltmp128 and .Ltmp135
	.uleb128 .Ltmp136-.Lfunc_begin0         #     jumps to .Ltmp136
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp19-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Ltmp22-.Ltmp19                #   Call between .Ltmp19 and .Ltmp22
	.uleb128 .Ltmp127-.Lfunc_begin0         #     jumps to .Ltmp127
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp22-.Lfunc_begin0          # >> Call Site 10 <<
	.uleb128 .Lfunc_end1-.Ltmp22            #   Call between .Ltmp22 and .Lfunc_end1
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.byte	1                               # >> Action Record 1 <<
                                        #   Catch TypeInfo 1
	.byte	0                               #   No further actions
	.p2align	2, 0x0
                                        # >> Catch TypeInfos <<
	.long	0                               # TypeInfo 1
.Lttbase0:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	_Z22__device_stub__lap_perPA512_dS0_ # -- Begin function _Z22__device_stub__lap_perPA512_dS0_
	.type	_Z22__device_stub__lap_perPA512_dS0_,@function
_Z22__device_stub__lap_perPA512_dS0_:   # @_Z22__device_stub__lap_perPA512_dS0_
	.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	$80, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	16(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%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	$_Z7lap_perPA512_dS0_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$96, %rsp
	.cfi_adjust_cfa_offset -96
	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_end2:
	.size	_Z22__device_stub__lap_perPA512_dS0_, .Lfunc_end2-_Z22__device_stub__lap_perPA512_dS0_
	.cfi_endproc
                                        # -- End function
	.globl	_Z22__device_stub__calc_dfPA512_dS0_ # -- Begin function _Z22__device_stub__calc_dfPA512_dS0_
	.type	_Z22__device_stub__calc_dfPA512_dS0_,@function
_Z22__device_stub__calc_dfPA512_dS0_:   # @_Z22__device_stub__calc_dfPA512_dS0_
	.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	$80, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	16(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%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	$_Z7calc_dfPA512_dS0_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$96, %rsp
	.cfi_adjust_cfa_offset -96
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z22__device_stub__calc_dfPA512_dS0_, .Lfunc_end3-_Z22__device_stub__calc_dfPA512_dS0_
	.cfi_endproc
                                        # -- End function
	.globl	_Z25__device_stub__update_phiPA512_dS0_ # -- Begin function _Z25__device_stub__update_phiPA512_dS0_
	.type	_Z25__device_stub__update_phiPA512_dS0_,@function
_Z25__device_stub__update_phiPA512_dS0_: # @_Z25__device_stub__update_phiPA512_dS0_
	.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	$80, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	16(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%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	$_Z10update_phiPA512_dS0_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$96, %rsp
	.cfi_adjust_cfa_offset -96
	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_end4:
	.size	_Z25__device_stub__update_phiPA512_dS0_, .Lfunc_end4-_Z25__device_stub__update_phiPA512_dS0_
	.cfi_endproc
                                        # -- End function
	.section	.text.__clang_call_terminate,"axG",@progbits,__clang_call_terminate,comdat
	.hidden	__clang_call_terminate          # -- Begin function __clang_call_terminate
	.weak	__clang_call_terminate
	.type	__clang_call_terminate,@function
__clang_call_terminate:                 # @__clang_call_terminate
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__cxa_begin_catch
	callq	_ZSt9terminatev
.Lfunc_end5:
	.size	__clang_call_terminate, .Lfunc_end5-__clang_call_terminate
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt8__detail18__to_chars_10_implIjEEvPcjT_,"axG",@progbits,_ZNSt8__detail18__to_chars_10_implIjEEvPcjT_,comdat
	.weak	_ZNSt8__detail18__to_chars_10_implIjEEvPcjT_ # -- Begin function _ZNSt8__detail18__to_chars_10_implIjEEvPcjT_
	.type	_ZNSt8__detail18__to_chars_10_implIjEEvPcjT_,@function
_ZNSt8__detail18__to_chars_10_implIjEEvPcjT_: # @_ZNSt8__detail18__to_chars_10_implIjEEvPcjT_
	.cfi_startproc
# %bb.0:
                                        # kill: def $esi killed $esi def $rsi
	cmpl	$100, %edx
	jb	.LBB6_1
# %bb.2:                                # %.lr.ph.preheader
	decl	%esi
.LBB6_3:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	%edx, %eax
	imulq	$1374389535, %rax, %rax         # imm = 0x51EB851F
	shrq	$37, %rax
	imull	$100, %eax, %ecx
	movl	%edx, %r8d
	subl	%ecx, %r8d
	movb	.L__const._ZNSt8__detail18__to_chars_10_implIjEEvPcjT_.__digits+1(%r8,%r8), %cl
	movl	%esi, %r9d
	movb	%cl, (%rdi,%r9)
	movb	.L__const._ZNSt8__detail18__to_chars_10_implIjEEvPcjT_.__digits(%r8,%r8), %cl
	leal	-1(%rsi), %r8d
	movb	%cl, (%rdi,%r8)
	addl	$-2, %esi
	cmpl	$9999, %edx                     # imm = 0x270F
	movl	%eax, %edx
	ja	.LBB6_3
	jmp	.LBB6_4
.LBB6_1:
	movl	%edx, %eax
.LBB6_4:                                # %._crit_edge
	cmpl	$10, %eax
	jb	.LBB6_6
# %bb.5:
	movl	%eax, %eax
	leaq	(%rax,%rax), %rcx
	movl	%ecx, %ecx
	movb	.L__const._ZNSt8__detail18__to_chars_10_implIjEEvPcjT_.__digits+1(%rcx), %cl
	movb	%cl, 1(%rdi)
	movb	.L__const._ZNSt8__detail18__to_chars_10_implIjEEvPcjT_.__digits(%rax,%rax), %al
	jmp	.LBB6_7
.LBB6_6:
	orb	$48, %al
.LBB6_7:
	movb	%al, (%rdi)
	retq
.Lfunc_end6:
	.size	_ZNSt8__detail18__to_chars_10_implIjEEvPcjT_, .Lfunc_end6-_ZNSt8__detail18__to_chars_10_implIjEEvPcjT_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	subq	%rsi, %r14
	movq	%r14, (%rsp)
	cmpq	$15, %r14
	jbe	.LBB7_1
# %bb.2:
	movq	%rsp, %r12
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm
	movq	%rax, (%rbx)
	movq	(%r12), %rcx
	movq	%rcx, 16(%rbx)
	jmp	.LBB7_3
.LBB7_1:                                # %._crit_edge
	movq	(%rbx), %rax
.LBB7_3:
	testq	%r14, %r14
	je	.LBB7_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB7_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB7_7
.LBB7_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB7_7:                                # %_ZZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tagEN6_GuardD2Ev.exit
	movq	(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	(%rbx), %rcx
	movb	$0, (%rcx,%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end7:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag, .Lfunc_end7-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _ZSt18generate_canonicalIdLm53ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_
.LCPI8_0:
	.quad	0x41dfffffff800000              # double 2147483646
.LCPI8_3:
	.quad	0x3ff0000000000000              # double 1
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0
.LCPI8_1:
	.long	0x40000000                      # float 2
.LCPI8_2:
	.long	0x5f000000                      # float 9.22337203E+18
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0
.LCPI8_4:
	.long	1127219200                      # 0x43300000
	.long	1160773632                      # 0x45300000
	.long	0                               # 0x0
	.long	0                               # 0x0
.LCPI8_5:
	.quad	0x4330000000000000              # double 4503599627370496
	.quad	0x4530000000000000              # double 1.9342813113834067E+25
	.section	.text._ZSt18generate_canonicalIdLm53ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_,"axG",@progbits,_ZSt18generate_canonicalIdLm53ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_,comdat
	.weak	_ZSt18generate_canonicalIdLm53ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_
	.type	_ZSt18generate_canonicalIdLm53ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_,@function
_ZSt18generate_canonicalIdLm53ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_: # @_ZSt18generate_canonicalIdLm53ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$64, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	fldl	.LCPI8_0(%rip)
	fstpt	(%rsp)
	callq	logl
	fstpt	52(%rsp)                        # 10-byte Folded Spill
	flds	.LCPI8_1(%rip)
	fstpt	(%rsp)
	callq	logl
	fldt	52(%rsp)                        # 10-byte Folded Reload
	fdivp	%st, %st(1)
	flds	.LCPI8_2(%rip)
	xorl	%ecx, %ecx
	fxch	%st(1)
	fucomi	%st(1), %st
	fldz
	fcmovnb	%st(2), %st
	fstp	%st(2)
	fsubp	%st, %st(1)
	setae	%cl
	fnstcw	20(%rsp)
	movzwl	20(%rsp), %eax
	orl	$3072, %eax                     # imm = 0xC00
	movw	%ax, 22(%rsp)
	fldcw	22(%rsp)
	fistpll	40(%rsp)
	fldcw	20(%rsp)
	shlq	$63, %rcx
	xorq	40(%rsp), %rcx
	leaq	52(%rcx), %rax
	xorl	%edx, %edx
	divq	%rcx
	movq	%rax, %rcx
	cmpq	$1, %rax
	adcq	$0, %rcx
	movq	(%rbx), %rax
	xorpd	%xmm0, %xmm0
	movsd	.LCPI8_3(%rip), %xmm1           # xmm1 = mem[0],zero
	movabsq	$8589934597, %rdi               # imm = 0x200000005
	movdqa	.LCPI8_4(%rip), %xmm2           # xmm2 = [1127219200,1160773632,0,0]
	movapd	.LCPI8_5(%rip), %xmm3           # xmm3 = [4.503599627370496E+15,1.9342813113834067E+25]
.LBB8_1:                                # %select.unfold
                                        # =>This Inner Loop Header: Depth=1
	imulq	$16807, %rax, %rsi              # imm = 0x41A7
	movq	%rsi, %rax
	mulq	%rdi
	movq	%rsi, %r8
	subq	%rdx, %r8
	shrq	%r8
	addq	%rdx, %r8
	shrq	$30, %r8
	movq	%r8, %rax
	shlq	$31, %rax
	subq	%rax, %r8
	leaq	(%rsi,%r8), %rax
	leaq	(%rsi,%r8), %rdx
	decq	%rdx
	movq	%rdx, %xmm4
	punpckldq	%xmm2, %xmm4            # xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1]
	subpd	%xmm3, %xmm4
	movapd	%xmm4, %xmm5
	unpckhpd	%xmm4, %xmm5                    # xmm5 = xmm5[1],xmm4[1]
	addsd	%xmm4, %xmm5
	mulsd	%xmm1, %xmm5
	movsd	%xmm1, 32(%rsp)
	fldl	32(%rsp)
	fmull	.LCPI8_0(%rip)
	addsd	%xmm5, %xmm0
	fstpl	24(%rsp)
	movsd	24(%rsp), %xmm1                 # xmm1 = mem[0],zero
	decq	%rcx
	jne	.LBB8_1
# %bb.2:
	movq	%rax, (%rbx)
	divsd	%xmm1, %xmm0
	ucomisd	.LCPI8_3(%rip), %xmm0
	jae	.LBB8_4
# %bb.3:
	addq	$64, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.LBB8_4:
	.cfi_def_cfa_offset 80
	movsd	.LCPI8_3(%rip), %xmm0           # xmm0 = mem[0],zero
	xorpd	%xmm1, %xmm1
	addq	$64, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	nextafter                       # TAILCALL
.Lfunc_end8:
	.size	_ZSt18generate_canonicalIdLm53ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_, .Lfunc_end8-_ZSt18generate_canonicalIdLm53ESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEET_RT1_
	.cfi_endproc
                                        # -- End function
	.text
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB9_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB9_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z7lap_perPA512_dS0_, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z7calc_dfPA512_dS0_, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z10update_phiPA512_dS0_, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end9:
	.size	__hip_module_ctor, .Lfunc_end9-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB10_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB10_2:
	retq
.Lfunc_end10:
	.size	__hip_module_dtor, .Lfunc_end10-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Fatal error: %s (%s at %s:%d)\n"
	.size	.L.str, 31

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"hipMalloc fail"
	.size	.L.str.1, 15

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/paulmillett/cueso/develop/src/fdExample.hip"
	.size	.L.str.2, 106

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"*** FAILED - ABORTING\n"
	.size	.L.str.3, 23

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"hipMemcpy H2D fail"
	.size	.L.str.4, 19

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

	.type	.L.str.5,@object                # @.str.5
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.5:
	.asciz	"cuda kernel fail"
	.size	.L.str.5, 17

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

	.type	_Z10update_phiPA512_dS0_,@object # @_Z10update_phiPA512_dS0_
	.globl	_Z10update_phiPA512_dS0_
	.p2align	3, 0x0
_Z10update_phiPA512_dS0_:
	.quad	_Z25__device_stub__update_phiPA512_dS0_
	.size	_Z10update_phiPA512_dS0_, 8

	.type	.L.str.6,@object                # @.str.6
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.6:
	.asciz	"hipMemcpy D2H fail"
	.size	.L.str.6, 19

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

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

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

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"could not open output file for reading!"
	.size	.L.str.10, 40

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"# vtk DataFile Version 3.1"
	.size	.L.str.11, 27

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"VTK file containing grid data"
	.size	.L.str.12, 30

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

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"DATASET STRUCTURED_POINTS"
	.size	.L.str.14, 26

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

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

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"ORIGIN 1 1 1"
	.size	.L.str.17, 13

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"SPACING     1.0     1.0     1.0"
	.size	.L.str.18, 32

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"POINT_DATA     "
	.size	.L.str.19, 16

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	"SCALARS Phi float"
	.size	.L.str.20, 18

	.type	.L.str.21,@object               # @.str.21
.L.str.21:
	.asciz	"LOOKUP_TABLE default"
	.size	.L.str.21, 21

	.type	.L__const._ZNSt8__detail18__to_chars_10_implIjEEvPcjT_.__digits,@object # @__const._ZNSt8__detail18__to_chars_10_implIjEEvPcjT_.__digits
	.section	.rodata.str1.16,"aMS",@progbits,1
	.p2align	4, 0x0
.L__const._ZNSt8__detail18__to_chars_10_implIjEEvPcjT_.__digits:
	.asciz	"00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899"
	.size	.L__const._ZNSt8__detail18__to_chars_10_implIjEEvPcjT_.__digits, 201

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

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z7calc_dfPA512_dS0_"
	.size	.L__unnamed_2, 21

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z10update_phiPA512_dS0_"
	.size	.L__unnamed_3, 25

	.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 _Z22__device_stub__lap_perPA512_dS0_
	.addrsig_sym _Z22__device_stub__calc_dfPA512_dS0_
	.addrsig_sym _Z25__device_stub__update_phiPA512_dS0_
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z7lap_perPA512_dS0_
	.addrsig_sym _Z7calc_dfPA512_dS0_
	.addrsig_sym _Z10update_phiPA512_dS0_
	.addrsig_sym _ZSt4cerr
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z7lap_perPA512_dS0_    ; -- Begin function _Z7lap_perPA512_dS0_
	.globl	_Z7lap_perPA512_dS0_
	.p2align	8
	.type	_Z7lap_perPA512_dS0_,@function
_Z7lap_perPA512_dS0_:                   ; @_Z7lap_perPA512_dS0_
; %bb.0:
	s_load_b32 s2, s[0:1], 0x1c
	v_and_b32_e32 v1, 0x3ff, v0
	v_bfe_u32 v0, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s3, s2, 16
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[6:7], null, s15, s3, v[0:1]
	v_mad_u64_u32 v[8:9], null, s14, s2, v[1:2]
	s_mov_b32 s2, exec_lo
	v_max_i32_e32 v2, v8, v6
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e32 0x200, v2
	s_cbranch_execz .LBB0_10
; %bb.1:
	s_load_b128 s[0:3], s[0:1], 0x0
	v_ashrrev_i32_e32 v9, 31, v8
	v_ashrrev_i32_e32 v7, 31, v6
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	v_lshlrev_b64 v[2:3], 12, v[8:9]
	v_lshlrev_b64 v[4:5], 3, v[6:7]
	s_mov_b32 s4, exec_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v7, vcc_lo, s0, v2
	v_add_co_ci_u32_e32 v10, vcc_lo, s1, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v9, vcc_lo, v7, v4
	v_add_co_ci_u32_e32 v10, vcc_lo, v10, v5, vcc_lo
	global_load_b64 v[10:11], v[9:10], off
	v_lshlrev_b32_e32 v9, 3, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_mad_u32_u24 v7, 0x50, v1, v9
	s_waitcnt vmcnt(0)
	ds_store_b64 v7, v[10:11] offset:88
	v_cmpx_lt_u32_e32 6, v1
	s_cbranch_execz .LBB0_3
; %bb.2:
	v_add_nc_u32_e32 v10, 1, v8
	v_cmp_ne_u32_e32 vcc_lo, 0x1ff, v8
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v10, 0, v10, vcc_lo
	v_ashrrev_i32_e32 v11, 31, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[10:11], 12, v[10:11]
	v_add_co_u32 v10, vcc_lo, s0, v10
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_ci_u32_e32 v11, vcc_lo, s1, v11, vcc_lo
	v_add_co_u32 v10, vcc_lo, v10, v4
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v11, vcc_lo, v11, v5, vcc_lo
	global_load_b64 v[10:11], v[10:11], off
	s_waitcnt vmcnt(0)
	ds_store_b64 v7, v[10:11] offset:168
.LBB0_3:
	s_or_b32 exec_lo, exec_lo, s4
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s4, exec_lo
	v_cmpx_eq_u32_e32 0, v1
	s_cbranch_execz .LBB0_5
; %bb.4:
	v_add_nc_u32_e32 v10, -1, v8
	v_cmp_ne_u32_e32 vcc_lo, 0, v8
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v10, 0x1ff, v10, vcc_lo
	v_ashrrev_i32_e32 v11, 31, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[10:11], 12, v[10:11]
	v_add_co_u32 v8, vcc_lo, s0, v10
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_ci_u32_e32 v11, vcc_lo, s1, v11, vcc_lo
	v_add_co_u32 v10, vcc_lo, v8, v4
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v11, vcc_lo, v11, v5, vcc_lo
	global_load_b64 v[10:11], v[10:11], off
	s_waitcnt vmcnt(0)
	ds_store_b64 v9, v[10:11] offset:8
.LBB0_5:
	s_or_b32 exec_lo, exec_lo, s4
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s4, exec_lo
	v_cmpx_lt_u32_e32 6, v0
	s_cbranch_execz .LBB0_7
; %bb.6:
	v_add_nc_u32_e32 v8, 1, v6
	v_cmp_ne_u32_e32 vcc_lo, 0x1ff, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v8, 0, v8, vcc_lo
	v_add_co_u32 v10, vcc_lo, s0, v2
	v_add_co_ci_u32_e32 v11, vcc_lo, s1, v3, vcc_lo
	v_ashrrev_i32_e32 v9, 31, v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[8:9], 3, v[8:9]
	v_add_co_u32 v8, vcc_lo, v10, v8
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v9, vcc_lo, v11, v9, vcc_lo
	global_load_b64 v[8:9], v[8:9], off
	s_waitcnt vmcnt(0)
	ds_store_b64 v7, v[8:9] offset:96
.LBB0_7:
	s_or_b32 exec_lo, exec_lo, s4
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s4, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB0_9
; %bb.8:
	v_add_nc_u32_e32 v0, -1, v6
	v_cmp_ne_u32_e32 vcc_lo, 0, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v8, 0x1ff, v0, vcc_lo
	v_add_co_u32 v0, vcc_lo, s0, v2
	v_add_co_ci_u32_e32 v6, vcc_lo, s1, v3, vcc_lo
	v_ashrrev_i32_e32 v9, 31, v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[8:9], 3, v[8:9]
	v_add_co_u32 v8, vcc_lo, v0, v8
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v9, vcc_lo, v6, v9, vcc_lo
	v_mul_u32_u24_e32 v0, 0x50, v1
	global_load_b64 v[8:9], v[8:9], off
	s_waitcnt vmcnt(0)
	ds_store_b64 v0, v[8:9] offset:80
.LBB0_9:
	s_or_b32 exec_lo, exec_lo, s4
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	ds_load_2addr_b64 v[8:11], v7 offset0:1 offset1:12
	ds_load_b64 v[0:1], v7 offset:168
	ds_load_2addr_b64 v[12:15], v7 offset0:10 offset1:11
	v_add_co_u32 v2, vcc_lo, s2, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s3, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, v2, v4
	v_add_co_ci_u32_e32 v3, vcc_lo, v3, v5, vcc_lo
	s_waitcnt lgkmcnt(1)
	v_add_f64 v[0:1], v[8:9], v[0:1]
	s_waitcnt lgkmcnt(0)
	v_add_f64 v[6:7], v[12:13], v[10:11]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[0:1], v[14:15], -2.0, v[0:1]
	v_fma_f64 v[6:7], v[14:15], -2.0, v[6:7]
	s_delay_alu instid0(VALU_DEP_1)
	v_add_f64 v[0:1], v[0:1], v[6:7]
	global_store_b64 v[2:3], v[0:1], off
.LBB0_10:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z7lap_perPA512_dS0_
		.amdhsa_group_segment_fixed_size 800
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 272
		.amdhsa_user_sgpr_count 14
		.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 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 16
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z7lap_perPA512_dS0_, .Lfunc_end0-_Z7lap_perPA512_dS0_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 776
; NumSgprs: 18
; NumVgprs: 16
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 800 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 16
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z7calc_dfPA512_dS0_    ; -- Begin function _Z7calc_dfPA512_dS0_
	.globl	_Z7calc_dfPA512_dS0_
	.p2align	8
	.type	_Z7calc_dfPA512_dS0_,@function
_Z7calc_dfPA512_dS0_:                   ; @_Z7calc_dfPA512_dS0_
; %bb.0:
	s_load_b32 s2, s[0:1], 0x1c
	v_and_b32_e32 v1, 0x3ff, v0
	v_bfe_u32 v4, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s3, s2, 16
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[2:3], null, s14, s2, v[1:2]
	v_mad_u64_u32 v[0:1], null, s15, s3, v[4:5]
	s_mov_b32 s2, exec_lo
	v_max_i32_e32 v1, v2, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e32 0x200, v1
	s_cbranch_execz .LBB1_2
; %bb.1:
	s_load_b128 s[0:3], s[0:1], 0x0
	v_ashrrev_i32_e32 v3, 31, v2
	v_ashrrev_i32_e32 v1, 31, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[2:3], 12, v[2:3]
	v_lshlrev_b64 v[0:1], 3, v[0:1]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v4, vcc_lo, s0, v2
	v_add_co_ci_u32_e32 v5, vcc_lo, s1, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v4, vcc_lo, v4, v0
	v_add_co_ci_u32_e32 v5, vcc_lo, v5, v1, vcc_lo
	v_add_co_u32 v2, vcc_lo, s2, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s3, v3, vcc_lo
	global_load_b64 v[4:5], v[4:5], off
	v_add_co_u32 v0, vcc_lo, v2, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, v3, v1, vcc_lo
	global_load_b64 v[2:3], v[0:1], off
	s_waitcnt vmcnt(1)
	v_mul_f64 v[6:7], v[4:5], v[4:5]
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[2:3], v[4:5], v[6:7], -v[2:3]
	v_add_f64 v[2:3], v[2:3], -v[4:5]
	global_store_b64 v[0:1], v[2:3], off
.LBB1_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z7calc_dfPA512_dS0_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 272
		.amdhsa_user_sgpr_count 14
		.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 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 8
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z7calc_dfPA512_dS0_, .Lfunc_end1-_Z7calc_dfPA512_dS0_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 252
; NumSgprs: 18
; NumVgprs: 8
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 8
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z10update_phiPA512_dS0_ ; -- Begin function _Z10update_phiPA512_dS0_
	.globl	_Z10update_phiPA512_dS0_
	.p2align	8
	.type	_Z10update_phiPA512_dS0_,@function
_Z10update_phiPA512_dS0_:               ; @_Z10update_phiPA512_dS0_
; %bb.0:
	s_load_b32 s2, s[0:1], 0x1c
	v_and_b32_e32 v1, 0x3ff, v0
	v_bfe_u32 v0, v0, 10, 10
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s3, s2, 16
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[6:7], null, s15, s3, v[0:1]
	v_mad_u64_u32 v[8:9], null, s14, s2, v[1:2]
	s_mov_b32 s2, exec_lo
	v_max_i32_e32 v2, v8, v6
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e32 0x200, v2
	s_cbranch_execz .LBB2_10
; %bb.1:
	s_load_b128 s[0:3], s[0:1], 0x0
	v_ashrrev_i32_e32 v9, 31, v8
	v_ashrrev_i32_e32 v7, 31, v6
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	v_lshlrev_b64 v[2:3], 12, v[8:9]
	v_lshlrev_b64 v[4:5], 3, v[6:7]
	s_mov_b32 s4, exec_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v7, vcc_lo, s0, v2
	v_add_co_ci_u32_e32 v10, vcc_lo, s1, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v9, vcc_lo, v7, v4
	v_add_co_ci_u32_e32 v10, vcc_lo, v10, v5, vcc_lo
	global_load_b64 v[10:11], v[9:10], off
	v_lshlrev_b32_e32 v9, 3, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_mad_u32_u24 v7, 0x50, v1, v9
	s_waitcnt vmcnt(0)
	ds_store_b64 v7, v[10:11] offset:88
	v_cmpx_lt_u32_e32 6, v1
	s_cbranch_execz .LBB2_3
; %bb.2:
	v_add_nc_u32_e32 v10, 1, v8
	v_cmp_ne_u32_e32 vcc_lo, 0x1ff, v8
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v10, 0, v10, vcc_lo
	v_ashrrev_i32_e32 v11, 31, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[10:11], 12, v[10:11]
	v_add_co_u32 v10, vcc_lo, s0, v10
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_ci_u32_e32 v11, vcc_lo, s1, v11, vcc_lo
	v_add_co_u32 v10, vcc_lo, v10, v4
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v11, vcc_lo, v11, v5, vcc_lo
	global_load_b64 v[10:11], v[10:11], off
	s_waitcnt vmcnt(0)
	ds_store_b64 v7, v[10:11] offset:168
.LBB2_3:
	s_or_b32 exec_lo, exec_lo, s4
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s4, exec_lo
	v_cmpx_eq_u32_e32 0, v1
	s_cbranch_execz .LBB2_5
; %bb.4:
	v_add_nc_u32_e32 v10, -1, v8
	v_cmp_ne_u32_e32 vcc_lo, 0, v8
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v10, 0x1ff, v10, vcc_lo
	v_ashrrev_i32_e32 v11, 31, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[10:11], 12, v[10:11]
	v_add_co_u32 v8, vcc_lo, s0, v10
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_ci_u32_e32 v11, vcc_lo, s1, v11, vcc_lo
	v_add_co_u32 v10, vcc_lo, v8, v4
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v11, vcc_lo, v11, v5, vcc_lo
	global_load_b64 v[10:11], v[10:11], off
	s_waitcnt vmcnt(0)
	ds_store_b64 v9, v[10:11] offset:8
.LBB2_5:
	s_or_b32 exec_lo, exec_lo, s4
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s4, exec_lo
	v_cmpx_lt_u32_e32 6, v0
	s_cbranch_execz .LBB2_7
; %bb.6:
	v_add_nc_u32_e32 v8, 1, v6
	v_cmp_ne_u32_e32 vcc_lo, 0x1ff, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v8, 0, v8, vcc_lo
	v_add_co_u32 v10, vcc_lo, s0, v2
	v_add_co_ci_u32_e32 v11, vcc_lo, s1, v3, vcc_lo
	v_ashrrev_i32_e32 v9, 31, v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[8:9], 3, v[8:9]
	v_add_co_u32 v8, vcc_lo, v10, v8
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v9, vcc_lo, v11, v9, vcc_lo
	global_load_b64 v[8:9], v[8:9], off
	s_waitcnt vmcnt(0)
	ds_store_b64 v7, v[8:9] offset:96
.LBB2_7:
	s_or_b32 exec_lo, exec_lo, s4
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mov_b32 s4, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB2_9
; %bb.8:
	v_add_nc_u32_e32 v0, -1, v6
	v_cmp_ne_u32_e32 vcc_lo, 0, v6
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v8, 0x1ff, v0, vcc_lo
	v_add_co_u32 v0, vcc_lo, s0, v2
	v_add_co_ci_u32_e32 v6, vcc_lo, s1, v3, vcc_lo
	v_ashrrev_i32_e32 v9, 31, v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[8:9], 3, v[8:9]
	v_add_co_u32 v8, vcc_lo, v0, v8
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v9, vcc_lo, v6, v9, vcc_lo
	v_mul_u32_u24_e32 v0, 0x50, v1
	global_load_b64 v[8:9], v[8:9], off
	s_waitcnt vmcnt(0)
	ds_store_b64 v0, v[8:9] offset:80
.LBB2_9:
	s_or_b32 exec_lo, exec_lo, s4
	v_add_co_u32 v0, vcc_lo, s2, v2
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v3, vcc_lo
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v8, vcc_lo, v0, v4
	v_add_co_ci_u32_e32 v9, vcc_lo, v1, v5, vcc_lo
	s_barrier
	buffer_gl0_inv
	s_mov_b32 s0, 0x47ae147b
	global_load_b64 v[10:11], v[8:9], off
	ds_load_2addr_b64 v[0:3], v7 offset0:1 offset1:12
	ds_load_b64 v[12:13], v7 offset:168
	ds_load_2addr_b64 v[4:7], v7 offset0:10 offset1:11
	s_mov_b32 s1, 0x3f847ae1
	s_waitcnt lgkmcnt(1)
	v_add_f64 v[0:1], v[0:1], v[12:13]
	s_waitcnt lgkmcnt(0)
	v_add_f64 v[2:3], v[4:5], v[2:3]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f64 v[0:1], v[6:7], -2.0, v[0:1]
	v_fma_f64 v[2:3], v[6:7], -2.0, v[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f64 v[0:1], v[0:1], v[2:3]
	s_waitcnt vmcnt(0)
	v_fma_f64 v[0:1], v[0:1], s[0:1], v[10:11]
	global_store_b64 v[8:9], v[0:1], off
.LBB2_10:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10update_phiPA512_dS0_
		.amdhsa_group_segment_fixed_size 800
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 272
		.amdhsa_user_sgpr_count 14
		.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 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 14
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end2:
	.size	_Z10update_phiPA512_dS0_, .Lfunc_end2-_Z10update_phiPA512_dS0_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 812
; NumSgprs: 18
; NumVgprs: 14
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 800 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 14
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.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
      - .offset:         16
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         20
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         28
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         30
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         32
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         34
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         36
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         38
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         56
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         80
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 800
    .kernarg_segment_align: 8
    .kernarg_segment_size: 272
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z7lap_perPA512_dS0_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z7lap_perPA512_dS0_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     16
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         20
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         28
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         30
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         32
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         34
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         36
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         38
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         56
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         80
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 272
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z7calc_dfPA512_dS0_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z7calc_dfPA512_dS0_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     8
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         20
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         28
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         30
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         32
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         34
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         36
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         38
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         56
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         80
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 800
    .kernarg_segment_align: 8
    .kernarg_segment_size: 272
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z10update_phiPA512_dS0_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z10update_phiPA512_dS0_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     14
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
