#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define GET_TIME(X, Y) (((Y).tv_sec - (X).tv_sec) + ((Y).tv_nsec - (X).tv_nsec) / 1000000000.0)
#define THREADS_PER_BLOCK 1024

  __constant__ __device__ int IE_d;
  __constant__ __device__ int JE_d;
  __constant__ __device__ float cb_d;
  __constant__ __device__ int is_d;
  __constant__ __device__ float pi_d;
  __constant__ __device__ float freq_d;
  __constant__ __device__ float dt_d;
  __constant__ __device__ float db_d;

  __global__ void ezCalc ( float *ez, float *hx, float *hy ) {
    int i, j = blockIdx.x;

    for (i = threadIdx.x; i < IE_d; i += blockDim.x) {

      if (i == 0 || i == IE_d - 1)
        ez[j * IE_d + i] = 0.0;

      if (j != 0 && !(i == 0 || i == IE_d - 1)) { // at x=0
        ez[j * IE_d + i] = ez[j * IE_d + i] + cb_d * (hy[j * IE_d + i] - hy[j * IE_d + (i - 1)] + hx[(j - 1 + JE_d) * IE_d + i] - hx[j * IE_d + i]);
      } else if (!(i == 0 || i == IE_d - 1))
        ez[j * IE_d + i] = ez[j * IE_d + i] + cb_d * (hy[j * IE_d + i] - hy[j * IE_d + (i - 1)] + hx[(j - 1) * IE_d + i] - hx[j * IE_d + i]);
      }
    }

  

  __global__ void ezCalc2 ( float *ez , int n ) {
    int j;

    for (j = threadIdx.x; j < JE_d; j += blockDim.x) {
      ez[j * IE_d + is_d] = cos(2 * pi_d * freq_d * n * dt_d);
    }

  }

  __global__ void hCalc ( float *ez, float *hx, float *hy ) {
    int i, j = blockIdx.x;

    for (i = threadIdx.x; i < IE_d; i += blockDim.x) {
      if (j + 1 == JE_d)
        hx[j * IE_d + i] = hx[j * IE_d + i] + db_d * (ez[j * IE_d + i] - ez[i]);
      else
        hx[j * IE_d + i] = hx[j * IE_d + i] + db_d * (ez[j * IE_d + i] - ez[(j + 1) * JE_d + i]);

      if (i == IE_d - 1)
        hy[j * JE_d + i] = hy[j * JE_d + i] + db_d * (0 - ez[j * JE_d + i]);
      else
        hy[j * JE_d + i] = hy[j * JE_d + i] + db_d * (ez[j * JE_d + (i + 1)] - ez[j * JE_d + i]);
    }


  }

  int main(int argc, char * argv[]) {

    int IE, JE, nsteps;
    int i, j, n, is;
    float pi = 3.141592653589793238462643;
    float * ez, * hx, * hy;
    float * ez_d, *hx_d, * hy_d;
    float dx, dt, epsz, mu, courant, cb, db, c, freq;
    int size;
    struct timespec Begin, Step0, Step1, Step2, Step3, End;
    FILE * fp;

    if (argc != 4) {
      printf("Invalid arguments... please type:\n");
      printf("   %s  IE JE steps\n", argv[0]);
      exit(0);
    }

    IE = atoi(argv[1]);
    JE = atoi(argv[2]);
    nsteps = atoi(argv[3]);

    printf("Running 2D FDTD algorithm with matrix of size %d x %d (%d steps)\n", IE, JE, nsteps);

    cudaMemcpyToSymbol(pi_d, &pi, sizeof(float), 0, cudaMemcpyHostToDevice);

    is = 10;
    cudaMemcpyToSymbol(is_d, &is, sizeof(int), 0, cudaMemcpyHostToDevice);

    epsz = 8.854e-12;
    mu = 4.0 * pi * 1.0e-7;
    c = 3.0e8;

    courant = 0.5;
    dx = 0.001;
    dt = (courant * dx) / (sqrt(2) * c);
    cudaMemcpyToSymbol(dt_d, &dt, sizeof(float), 0, cudaMemcpyHostToDevice);

    cb = dt / (epsz * dx);
    db = dt / (mu * dx);
    cudaMemcpyToSymbol(cb_d, &cb, sizeof(float), 0, cudaMemcpyHostToDevice);
    cudaMemcpyToSymbol(db_d, &db, sizeof(float), 0, cudaMemcpyHostToDevice);

    printf("Coefficients are: dt=%g cb=%g db=%g\n", dt, cb, db);

    size = IE * JE;

    ez = (float * ) calloc(size, sizeof(float));
    hx = (float * ) calloc(size, sizeof(float));
    hy = (float * ) calloc(size, sizeof(float));

    cudaMalloc( (void **) &ez_d, size * sizeof(float));
    cudaMalloc( (void **) &hx_d, size * sizeof(float));
    cudaMalloc( (void **) &hy_d, size * sizeof(float));

    freq = 50e9;
    cudaMemcpyToSymbol(freq_d, &freq, sizeof(float), 0, cudaMemcpyHostToDevice);

    cudaMemcpyToSymbol(JE_d, &JE, sizeof(float), 0, cudaMemcpyHostToDevice);
    cudaMemcpyToSymbol(IE_d, &IE, sizeof(float), 0, cudaMemcpyHostToDevice);

    if (clock_gettime(CLOCK_REALTIME, &Begin) == -1) {
      perror("Error in gettime");
      exit(1);
    }

    // Transfer initial matrices to gpu
    cudaMemcpy( ez_d, ez, size * sizeof(float), cudaMemcpyHostToDevice );
    cudaMemcpy( hx_d, hx, size * sizeof(float), cudaMemcpyHostToDevice );
    cudaMemcpy( hy_d, hy, size * sizeof(float), cudaMemcpyHostToDevice );

    for (n = 0; n < nsteps; n++) { // TIME
      if (clock_gettime(CLOCK_REALTIME, &Step0) == -1) {
        perror("Error in gettime");
        exit(1);
      }

      //Calculate the Ez field
      ezCalc<<<JE, THREADS_PER_BLOCK>>>( ez_d, hx_d, hy_d );

      clock_gettime(CLOCK_REALTIME, &Step1);

      //Ez field generator (line)
      ezCalc2<<<1, THREADS_PER_BLOCK>>>( ez_d , n );

      clock_gettime(CLOCK_REALTIME, &Step2);

      //Calculate the H field
      hCalc<<<JE, THREADS_PER_BLOCK>>>( ez_d, hx_d, hy_d );

      if (clock_gettime(CLOCK_REALTIME, &Step3) == -1) {
        perror("Error in gettime");
        exit(1);
      }

    }

    // Retrieve matrices from gpu
    cudaMemcpy( ez, ez_d, size * sizeof(float), cudaMemcpyDeviceToHost );
    cudaMemcpy( hx, hx_d, size * sizeof(float), cudaMemcpyDeviceToHost );
    cudaMemcpy( hy, hy_d, size * sizeof(float), cudaMemcpyDeviceToHost );

    if (clock_gettime(CLOCK_REALTIME, &End) == -1) {
      perror("Error in gettime");
      exit(1);
    }

    printf("\n\n====Total time: %f\n", GET_TIME(Begin, End));

    // write output to file
    fp = fopen("output_gpu_v4.txt", "w");
    fprintf(fp, "==================== Ez MATRIX ========================\n");
    for (i = 0, j = 0;
      (i < IE * JE) && (i < 1000); i++, j++) {
      if (j == 8) {
        fprintf(fp, "\n");
        j = 0;
      }
      fprintf(fp, "%8f  ", ez[i]);
    }
    fprintf(fp, "==================== Hx MATRIX ========================\n");
    for (i = 0, j = 0;
      (i < IE * JE) && (i < 1000); i++, j++) {
      if (j == 8) {
        fprintf(fp, "\n");
        j = 0;
      }
      fprintf(fp, "%8f  ", hx[i]);
    }
    fprintf(fp, "==================== Hy MATRIX ========================\n");
    for (i = 0, j = 0;
      (i < IE * JE) && (i < 1000); i++, j++) {
      if (j == 8) {
        fprintf(fp, "\n");
        j = 0;
      }
      fprintf(fp, "%8f  ", hy[i]);
    }

    free(ez);
    free(hy);
    free(hx);

    cudaFree( ez_d );
    cudaFree( hx_d );
    cudaFree( hy_d );

    return 0;

  }

	.file	"tmpxft_002ac149_00000000-6_gpu_v7.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2031:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2031:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z29__device_stub__Z6ezCalcPfS_S_PfS_S_
	.type	_Z29__device_stub__Z6ezCalcPfS_S_PfS_S_, @function
_Z29__device_stub__Z6ezCalcPfS_S_PfS_S_:
.LFB2053:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L2
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z6ezCalcPfS_S_(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L2:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2053:
	.size	_Z29__device_stub__Z6ezCalcPfS_S_PfS_S_, .-_Z29__device_stub__Z6ezCalcPfS_S_PfS_S_
	.globl	_Z6ezCalcPfS_S_
	.type	_Z6ezCalcPfS_S_, @function
_Z6ezCalcPfS_S_:
.LFB2054:
	.cfi_startproc
	endbr64
	jmp	_Z29__device_stub__Z6ezCalcPfS_S_PfS_S_
	.cfi_endproc
.LFE2054:
	.size	_Z6ezCalcPfS_S_, .-_Z6ezCalcPfS_S_
	.globl	_Z27__device_stub__Z7ezCalc2PfiPfi
	.type	_Z27__device_stub__Z7ezCalc2PfiPfi, @function
_Z27__device_stub__Z7ezCalc2PfiPfi:
.LFB2055:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	32(%rsp), %rcx
	leaq	24(%rsp), %rdx
	movl	%esi, 4(%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)
	leaq	4(%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	.L8
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z7ezCalc2Pfi(%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
.L8:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2055:
	.size	_Z27__device_stub__Z7ezCalc2PfiPfi, .-_Z27__device_stub__Z7ezCalc2PfiPfi
	.globl	_Z7ezCalc2Pfi
	.type	_Z7ezCalc2Pfi, @function
_Z7ezCalc2Pfi:
.LFB2056:
	.cfi_startproc
	endbr64
	jmp	_Z27__device_stub__Z7ezCalc2PfiPfi
	.cfi_endproc
.LFE2056:
	.size	_Z7ezCalc2Pfi, .-_Z7ezCalc2Pfi
	.globl	_Z28__device_stub__Z5hCalcPfS_S_PfS_S_
	.type	_Z28__device_stub__Z5hCalcPfS_S_PfS_S_, @function
_Z28__device_stub__Z5hCalcPfS_S_PfS_S_:
.LFB2057:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L13
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z5hCalcPfS_S_(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L13:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2057:
	.size	_Z28__device_stub__Z5hCalcPfS_S_PfS_S_, .-_Z28__device_stub__Z5hCalcPfS_S_PfS_S_
	.globl	_Z5hCalcPfS_S_
	.type	_Z5hCalcPfS_S_, @function
_Z5hCalcPfS_S_:
.LFB2058:
	.cfi_startproc
	endbr64
	jmp	_Z28__device_stub__Z5hCalcPfS_S_PfS_S_
	.cfi_endproc
.LFE2058:
	.size	_Z5hCalcPfS_S_, .-_Z5hCalcPfS_S_
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"Invalid arguments... please type:\n"
.LC2:
	.string	"   %s  IE JE steps\n"
.LC3:
	.string	"Running 2D FDTD algorithm with matrix of size %d x %d (%d steps)\n"
.LC9:
	.string	"Coefficients are: dt=%g cb=%g db=%g\n"
.LC11:
	.string	"Error in gettime"
.LC13:
	.string	"\n\n====Total time: %f\n"
.LC14:
	.string	"w"
.LC15:
	.string	"output_gpu_v4.txt"
.LC16:
	.string	"==================== Ez MATRIX ========================\n"
.LC17:
	.string	"\n"
.LC18:
	.string	"%8f  "
.LC19:
	.string	"==================== Hx MATRIX ========================\n"
.LC20:
	.string	"==================== Hy MATRIX ========================\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$200, %rsp
	.cfi_def_cfa_offset 256
	movq	%fs:40, %rax
	movq	%rax, 184(%rsp)
	xorl	%eax, %eax
	movl	$0x40490fdb, 28(%rsp)
	cmpl	$4, %edi
	je	.L19
	leaq	.LC1(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	(%rbx), %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	xorl	%edi, %edi
	jmp	.L62
.L19:
	movq	8(%rsi), %rdi
	call	atoi@PLT
	movq	16(%rbx), %rdi
	movl	%eax, %ebp
	movl	%eax, 16(%rsp)
	call	atoi@PLT
	movq	24(%rbx), %rdi
	movl	%eax, %r12d
	movl	%eax, 20(%rsp)
	call	atoi@PLT
	movl	%r12d, %ecx
	movl	%ebp, %edx
	movl	$2, %edi
	movl	%eax, %r8d
	leaq	.LC3(%rip), %rsi
	movl	%eax, %r14d
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%ecx, %ecx
	leaq	28(%rsp), %rsi
	movl	$1, %r8d
	movl	$4, %edx
	leaq	_ZL4pi_d(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	xorl	%ecx, %ecx
	leaq	24(%rsp), %rsi
	movl	$1, %r8d
	movl	$4, %edx
	leaq	_ZL4is_d(%rip), %rdi
	movl	$10, 24(%rsp)
	call	cudaMemcpyToSymbol@PLT
	cvtss2sd	28(%rsp), %xmm0
	xorl	%ecx, %ecx
	leaq	32(%rsp), %rsi
	mulsd	.LC4(%rip), %xmm0
	movl	$1, %r8d
	movl	$4, %edx
	movl	$0x2ba5dc59, 32(%rsp)
	mulsd	.LC5(%rip), %xmm0
	leaq	_ZL4dt_d(%rip), %rdi
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, 8(%rsp)
	call	cudaMemcpyToSymbol@PLT
	movss	8(%rsp), %xmm0
	movss	32(%rsp), %xmm1
	xorl	%ecx, %ecx
	leaq	36(%rsp), %rsi
	movl	$1, %r8d
	movl	$4, %edx
	mulss	.LC8(%rip), %xmm0
	movaps	%xmm1, %xmm2
	leaq	_ZL4cb_d(%rip), %rdi
	divss	.LC7(%rip), %xmm2
	movss	%xmm2, 36(%rsp)
	divss	%xmm0, %xmm1
	movss	%xmm1, 40(%rsp)
	call	cudaMemcpyToSymbol@PLT
	xorl	%ecx, %ecx
	movl	$1, %r8d
	movl	$4, %edx
	leaq	40(%rsp), %rsi
	leaq	_ZL4db_d(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	leaq	.LC9(%rip), %rsi
	movl	$2, %edi
	movb	$3, %al
	cvtss2sd	32(%rsp), %xmm0
	cvtss2sd	40(%rsp), %xmm2
	cvtss2sd	36(%rsp), %xmm1
	call	__printf_chk@PLT
	movl	16(%rsp), %r13d
	imull	20(%rsp), %r13d
	movl	$4, %esi
	movslq	%r13d, %r13
	movq	%r13, %rdi
	call	calloc@PLT
	movl	$4, %esi
	movq	%r13, %rdi
	movq	%rax, %r12
	call	calloc@PLT
	movl	$4, %esi
	movq	%r13, %rdi
	movq	%rax, %rbx
	call	calloc@PLT
	leaq	48(%rsp), %rdi
	movq	%rax, %rbp
	leaq	0(,%r13,4), %rax
	movq	%rax, %rsi
	movq	%rax, 8(%rsp)
	call	cudaMalloc@PLT
	movq	8(%rsp), %rsi
	leaq	56(%rsp), %rdi
	call	cudaMalloc@PLT
	movq	8(%rsp), %rsi
	leaq	64(%rsp), %rdi
	call	cudaMalloc@PLT
	xorl	%ecx, %ecx
	leaq	44(%rsp), %rsi
	movl	$1, %r8d
	movl	$4, %edx
	leaq	_ZL6freq_d(%rip), %rdi
	movl	$0x513a43b7, 44(%rsp)
	call	cudaMemcpyToSymbol@PLT
	xorl	%ecx, %ecx
	leaq	20(%rsp), %rsi
	movl	$1, %r8d
	movl	$4, %edx
	leaq	_ZL4JE_d(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	xorl	%ecx, %ecx
	leaq	16(%rsp), %rsi
	movl	$1, %r8d
	movl	$4, %edx
	leaq	_ZL4IE_d(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	xorl	%edi, %edi
	leaq	88(%rsp), %rsi
	call	clock_gettime@PLT
	incl	%eax
	jne	.L20
.L22:
	leaq	.LC11(%rip), %rdi
	call	perror@PLT
	movl	$1, %edi
.L62:
	call	exit@PLT
.L20:
	movq	8(%rsp), %rdx
	movq	48(%rsp), %rdi
	movq	%r12, %rsi
	xorl	%r15d, %r15d
	movabsq	$4294968320, %r13
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	8(%rsp), %rdx
	movq	56(%rsp), %rdi
	movq	%rbx, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	8(%rsp), %rdx
	movq	64(%rsp), %rdi
	movq	%rbp, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
.L21:
	cmpl	%r14d, %r15d
	jge	.L63
	xorl	%edi, %edi
	leaq	104(%rsp), %rsi
	call	clock_gettime@PLT
	incl	%eax
	je	.L22
	movl	20(%rsp), %eax
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r13, %rdx
	movl	$1, %ecx
	movq	%r13, 168(%rsp)
	movl	%eax, 76(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 80(%rsp)
	movq	76(%rsp), %rdi
	movl	$1, 176(%rsp)
	movl	84(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L23
	movq	64(%rsp), %rdx
	movq	56(%rsp), %rsi
	movq	48(%rsp), %rdi
	call	_Z29__device_stub__Z6ezCalcPfS_S_PfS_S_
.L23:
	xorl	%edi, %edi
	leaq	120(%rsp), %rsi
	call	clock_gettime@PLT
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r13, %rdx
	movabsq	$4294967297, %rdi
	movl	$1, %ecx
	movl	$1, %esi
	movq	%r13, 168(%rsp)
	movl	$1, 176(%rsp)
	movq	%rdi, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L24
	movq	48(%rsp), %rdi
	movl	%r15d, %esi
	call	_Z27__device_stub__Z7ezCalc2PfiPfi
.L24:
	xorl	%edi, %edi
	leaq	136(%rsp), %rsi
	call	clock_gettime@PLT
	movl	20(%rsp), %eax
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r13, %rdx
	movl	$1, %ecx
	movq	%r13, 168(%rsp)
	movl	%eax, 76(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 80(%rsp)
	movq	76(%rsp), %rdi
	movl	$1, 176(%rsp)
	movl	84(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L25
	movq	64(%rsp), %rdx
	movq	56(%rsp), %rsi
	movq	48(%rsp), %rdi
	call	_Z28__device_stub__Z5hCalcPfS_S_PfS_S_
.L25:
	xorl	%edi, %edi
	leaq	152(%rsp), %rsi
	call	clock_gettime@PLT
	incl	%eax
	je	.L22
	incl	%r15d
	jmp	.L21
.L63:
	movq	8(%rsp), %rdx
	movq	48(%rsp), %rsi
	movl	$2, %ecx
	movq	%r12, %rdi
	call	cudaMemcpy@PLT
	movq	8(%rsp), %rdx
	movq	56(%rsp), %rsi
	movq	%rbx, %rdi
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movq	8(%rsp), %rdx
	movq	64(%rsp), %rsi
	movq	%rbp, %rdi
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	xorl	%edi, %edi
	leaq	168(%rsp), %rsi
	call	clock_gettime@PLT
	incl	%eax
	je	.L22
	movq	176(%rsp), %rax
	subq	96(%rsp), %rax
	movl	$2, %edi
	xorl	%r14d, %r14d
	cvtsi2sdq	%rax, %xmm0
	movq	168(%rsp), %rax
	subq	88(%rsp), %rax
	xorl	%r13d, %r13d
	cvtsi2sdq	%rax, %xmm1
	leaq	.LC13(%rip), %rsi
	movb	$1, %al
	divsd	.LC12(%rip), %xmm0
	leaq	.LC17(%rip), %r15
	addsd	%xmm1, %xmm0
	call	__printf_chk@PLT
	leaq	.LC14(%rip), %rsi
	leaq	.LC15(%rip), %rdi
	call	fopen@PLT
	leaq	.LC16(%rip), %rdx
	movl	$2, %esi
	movq	%rax, 8(%rsp)
	movq	%rax, %rdi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L27:
	movl	16(%rsp), %eax
	imull	20(%rsp), %eax
	cmpl	%r14d, %eax
	jle	.L40
	cmpl	$1000, %r14d
	je	.L40
	cmpl	$8, %r13d
	jne	.L28
	movq	8(%rsp), %rdi
	movq	%r15, %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	call	__fprintf_chk@PLT
.L28:
	movq	8(%rsp), %rdi
	movl	$2, %esi
	movb	$1, %al
	incl	%r13d
	leaq	.LC18(%rip), %rdx
	cvtss2sd	(%r12,%r14,4), %xmm0
	incq	%r14
	call	__fprintf_chk@PLT
	jmp	.L27
.L40:
	movq	8(%rsp), %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	xorl	%r14d, %r14d
	leaq	.LC19(%rip), %rdx
	xorl	%r13d, %r13d
	leaq	.LC17(%rip), %r15
	call	__fprintf_chk@PLT
.L31:
	movl	16(%rsp), %eax
	imull	20(%rsp), %eax
	cmpl	%r14d, %eax
	jle	.L41
	cmpl	$1000, %r14d
	je	.L41
	cmpl	$8, %r13d
	jne	.L32
	movq	8(%rsp), %rdi
	movq	%r15, %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	call	__fprintf_chk@PLT
.L32:
	movq	8(%rsp), %rdi
	movl	$2, %esi
	movb	$1, %al
	incl	%r13d
	leaq	.LC18(%rip), %rdx
	cvtss2sd	(%rbx,%r14,4), %xmm0
	incq	%r14
	call	__fprintf_chk@PLT
	jmp	.L31
.L41:
	movq	8(%rsp), %rdi
	movl	$2, %esi
	xorl	%eax, %eax
	xorl	%r14d, %r14d
	leaq	.LC20(%rip), %rdx
	xorl	%r13d, %r13d
	leaq	.LC17(%rip), %r15
	call	__fprintf_chk@PLT
.L35:
	movl	16(%rsp), %eax
	imull	20(%rsp), %eax
	cmpl	%r14d, %eax
	jle	.L42
	cmpl	$1000, %r14d
	je	.L42
	cmpl	$8, %r13d
	jne	.L36
	movq	8(%rsp), %rdi
	movq	%r15, %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	call	__fprintf_chk@PLT
.L36:
	movq	8(%rsp), %rdi
	movl	$2, %esi
	movb	$1, %al
	incl	%r13d
	leaq	.LC18(%rip), %rdx
	cvtss2sd	0(%rbp,%r14,4), %xmm0
	incq	%r14
	call	__fprintf_chk@PLT
	jmp	.L35
.L42:
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movq	48(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	je	.L39
	call	__stack_chk_fail@PLT
.L39:
	addq	$200, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	main, .-main
	.section	.rodata.str1.1
.LC21:
	.string	"_Z5hCalcPfS_S_"
.LC22:
	.string	"_Z7ezCalc2Pfi"
.LC23:
	.string	"_Z6ezCalcPfS_S_"
.LC24:
	.string	"IE_d"
.LC25:
	.string	"JE_d"
.LC26:
	.string	"cb_d"
.LC27:
	.string	"is_d"
.LC28:
	.string	"pi_d"
.LC29:
	.string	"freq_d"
.LC30:
	.string	"dt_d"
.LC31:
	.string	"db_d"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2060:
	.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	.LC21(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z5hCalcPfS_S_(%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	.LC22(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z7ezCalc2Pfi(%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	.LC23(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z6ezCalcPfS_S_(%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	%r8d, %r8d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC24(%rip), %rdx
	movl	$4, %r9d
	leaq	_ZL4IE_d(%rip), %rsi
	pushq	$1
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	call	__cudaRegisterVar@PLT
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rdx
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC25(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL4JE_d(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rcx
	.cfi_def_cfa_offset 24
	popq	%rsi
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC26(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL4cb_d(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rdi
	.cfi_def_cfa_offset 24
	popq	%r8
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC27(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL4is_d(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%r9
	.cfi_def_cfa_offset 24
	popq	%r10
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC28(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL4pi_d(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%r11
	.cfi_def_cfa_offset 24
	popq	%rax
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC29(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL6freq_d(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rdx
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC30(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL4dt_d(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rcx
	.cfi_def_cfa_offset 24
	popq	%rsi
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC31(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movl	$4, %r9d
	movq	%rdx, %rcx
	leaq	_ZL4db_d(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rdi
	.cfi_def_cfa_offset 24
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	popq	%r8
	.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
.LFE2060:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.local	_ZL4db_d
	.comm	_ZL4db_d,4,4
	.local	_ZL4dt_d
	.comm	_ZL4dt_d,4,4
	.local	_ZL6freq_d
	.comm	_ZL6freq_d,4,4
	.local	_ZL4pi_d
	.comm	_ZL4pi_d,4,4
	.local	_ZL4is_d
	.comm	_ZL4is_d,4,4
	.local	_ZL4cb_d
	.comm	_ZL4cb_d,4,4
	.local	_ZL4JE_d
	.comm	_ZL4JE_d,4,4
	.local	_ZL4IE_d
	.comm	_ZL4IE_d,4,4
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC4:
	.long	0
	.long	1074790400
	.align 8
.LC5:
	.long	-1698910392
	.long	1048238066
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC7:
	.long	673152991
	.align 4
.LC8:
	.long	981668463
	.section	.rodata.cst8
	.align 8
.LC12:
	.long	0
	.long	1104006501
	.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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define GET_TIME(X, Y) (((Y).tv_sec - (X).tv_sec) + ((Y).tv_nsec - (X).tv_nsec) / 1000000000.0)
#define THREADS_PER_BLOCK 1024

  __constant__ __device__ int IE_d;
  __constant__ __device__ int JE_d;
  __constant__ __device__ float cb_d;
  __constant__ __device__ int is_d;
  __constant__ __device__ float pi_d;
  __constant__ __device__ float freq_d;
  __constant__ __device__ float dt_d;
  __constant__ __device__ float db_d;

  __global__ void ezCalc ( float *ez, float *hx, float *hy ) {
    int i, j = blockIdx.x;

    for (i = threadIdx.x; i < IE_d; i += blockDim.x) {

      if (i == 0 || i == IE_d - 1)
        ez[j * IE_d + i] = 0.0;

      if (j != 0 && !(i == 0 || i == IE_d - 1)) { // at x=0
        ez[j * IE_d + i] = ez[j * IE_d + i] + cb_d * (hy[j * IE_d + i] - hy[j * IE_d + (i - 1)] + hx[(j - 1 + JE_d) * IE_d + i] - hx[j * IE_d + i]);
      } else if (!(i == 0 || i == IE_d - 1))
        ez[j * IE_d + i] = ez[j * IE_d + i] + cb_d * (hy[j * IE_d + i] - hy[j * IE_d + (i - 1)] + hx[(j - 1) * IE_d + i] - hx[j * IE_d + i]);
      }
    }

  

  __global__ void ezCalc2 ( float *ez , int n ) {
    int j;

    for (j = threadIdx.x; j < JE_d; j += blockDim.x) {
      ez[j * IE_d + is_d] = cos(2 * pi_d * freq_d * n * dt_d);
    }

  }

  __global__ void hCalc ( float *ez, float *hx, float *hy ) {
    int i, j = blockIdx.x;

    for (i = threadIdx.x; i < IE_d; i += blockDim.x) {
      if (j + 1 == JE_d)
        hx[j * IE_d + i] = hx[j * IE_d + i] + db_d * (ez[j * IE_d + i] - ez[i]);
      else
        hx[j * IE_d + i] = hx[j * IE_d + i] + db_d * (ez[j * IE_d + i] - ez[(j + 1) * JE_d + i]);

      if (i == IE_d - 1)
        hy[j * JE_d + i] = hy[j * JE_d + i] + db_d * (0 - ez[j * JE_d + i]);
      else
        hy[j * JE_d + i] = hy[j * JE_d + i] + db_d * (ez[j * JE_d + (i + 1)] - ez[j * JE_d + i]);
    }


  }

  int main(int argc, char * argv[]) {

    int IE, JE, nsteps;
    int i, j, n, is;
    float pi = 3.141592653589793238462643;
    float * ez, * hx, * hy;
    float * ez_d, *hx_d, * hy_d;
    float dx, dt, epsz, mu, courant, cb, db, c, freq;
    int size;
    struct timespec Begin, Step0, Step1, Step2, Step3, End;
    FILE * fp;

    if (argc != 4) {
      printf("Invalid arguments... please type:\n");
      printf("   %s  IE JE steps\n", argv[0]);
      exit(0);
    }

    IE = atoi(argv[1]);
    JE = atoi(argv[2]);
    nsteps = atoi(argv[3]);

    printf("Running 2D FDTD algorithm with matrix of size %d x %d (%d steps)\n", IE, JE, nsteps);

    hipMemcpyToSymbol(HIP_SYMBOL(pi_d), &pi, sizeof(float), 0, hipMemcpyHostToDevice);

    is = 10;
    hipMemcpyToSymbol(HIP_SYMBOL(is_d), &is, sizeof(int), 0, hipMemcpyHostToDevice);

    epsz = 8.854e-12;
    mu = 4.0 * pi * 1.0e-7;
    c = 3.0e8;

    courant = 0.5;
    dx = 0.001;
    dt = (courant * dx) / (sqrt(2) * c);
    hipMemcpyToSymbol(HIP_SYMBOL(dt_d), &dt, sizeof(float), 0, hipMemcpyHostToDevice);

    cb = dt / (epsz * dx);
    db = dt / (mu * dx);
    hipMemcpyToSymbol(HIP_SYMBOL(cb_d), &cb, sizeof(float), 0, hipMemcpyHostToDevice);
    hipMemcpyToSymbol(HIP_SYMBOL(db_d), &db, sizeof(float), 0, hipMemcpyHostToDevice);

    printf("Coefficients are: dt=%g cb=%g db=%g\n", dt, cb, db);

    size = IE * JE;

    ez = (float * ) calloc(size, sizeof(float));
    hx = (float * ) calloc(size, sizeof(float));
    hy = (float * ) calloc(size, sizeof(float));

    hipMalloc( (void **) &ez_d, size * sizeof(float));
    hipMalloc( (void **) &hx_d, size * sizeof(float));
    hipMalloc( (void **) &hy_d, size * sizeof(float));

    freq = 50e9;
    hipMemcpyToSymbol(HIP_SYMBOL(freq_d), &freq, sizeof(float), 0, hipMemcpyHostToDevice);

    hipMemcpyToSymbol(HIP_SYMBOL(JE_d), &JE, sizeof(float), 0, hipMemcpyHostToDevice);
    hipMemcpyToSymbol(HIP_SYMBOL(IE_d), &IE, sizeof(float), 0, hipMemcpyHostToDevice);

    if (clock_gettime(CLOCK_REALTIME, &Begin) == -1) {
      perror("Error in gettime");
      exit(1);
    }

    // Transfer initial matrices to gpu
    hipMemcpy( ez_d, ez, size * sizeof(float), hipMemcpyHostToDevice );
    hipMemcpy( hx_d, hx, size * sizeof(float), hipMemcpyHostToDevice );
    hipMemcpy( hy_d, hy, size * sizeof(float), hipMemcpyHostToDevice );

    for (n = 0; n < nsteps; n++) { // TIME
      if (clock_gettime(CLOCK_REALTIME, &Step0) == -1) {
        perror("Error in gettime");
        exit(1);
      }

      //Calculate the Ez field
      ezCalc<<<JE, THREADS_PER_BLOCK>>>( ez_d, hx_d, hy_d );

      clock_gettime(CLOCK_REALTIME, &Step1);

      //Ez field generator (line)
      ezCalc2<<<1, THREADS_PER_BLOCK>>>( ez_d , n );

      clock_gettime(CLOCK_REALTIME, &Step2);

      //Calculate the H field
      hCalc<<<JE, THREADS_PER_BLOCK>>>( ez_d, hx_d, hy_d );

      if (clock_gettime(CLOCK_REALTIME, &Step3) == -1) {
        perror("Error in gettime");
        exit(1);
      }

    }

    // Retrieve matrices from gpu
    hipMemcpy( ez, ez_d, size * sizeof(float), hipMemcpyDeviceToHost );
    hipMemcpy( hx, hx_d, size * sizeof(float), hipMemcpyDeviceToHost );
    hipMemcpy( hy, hy_d, size * sizeof(float), hipMemcpyDeviceToHost );

    if (clock_gettime(CLOCK_REALTIME, &End) == -1) {
      perror("Error in gettime");
      exit(1);
    }

    printf("\n\n====Total time: %f\n", GET_TIME(Begin, End));

    // write output to file
    fp = fopen("output_gpu_v4.txt", "w");
    fprintf(fp, "==================== Ez MATRIX ========================\n");
    for (i = 0, j = 0;
      (i < IE * JE) && (i < 1000); i++, j++) {
      if (j == 8) {
        fprintf(fp, "\n");
        j = 0;
      }
      fprintf(fp, "%8f  ", ez[i]);
    }
    fprintf(fp, "==================== Hx MATRIX ========================\n");
    for (i = 0, j = 0;
      (i < IE * JE) && (i < 1000); i++, j++) {
      if (j == 8) {
        fprintf(fp, "\n");
        j = 0;
      }
      fprintf(fp, "%8f  ", hx[i]);
    }
    fprintf(fp, "==================== Hy MATRIX ========================\n");
    for (i = 0, j = 0;
      (i < IE * JE) && (i < 1000); i++, j++) {
      if (j == 8) {
        fprintf(fp, "\n");
        j = 0;
      }
      fprintf(fp, "%8f  ", hy[i]);
    }

    free(ez);
    free(hy);
    free(hx);

    hipFree( ez_d );
    hipFree( hx_d );
    hipFree( hy_d );

    return 0;

  }

	.text
	.file	"gpu_v7.hip"
	.globl	_Z21__device_stub__ezCalcPfS_S_ # -- Begin function _Z21__device_stub__ezCalcPfS_S_
	.type	_Z21__device_stub__ezCalcPfS_S_,@function
_Z21__device_stub__ezCalcPfS_S_:        # @_Z21__device_stub__ezCalcPfS_S_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z6ezCalcPfS_S_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z21__device_stub__ezCalcPfS_S_, .Lfunc_end0-_Z21__device_stub__ezCalcPfS_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z22__device_stub__ezCalc2Pfi   # -- Begin function _Z22__device_stub__ezCalc2Pfi
	.type	_Z22__device_stub__ezCalc2Pfi,@function
_Z22__device_stub__ezCalc2Pfi:          # @_Z22__device_stub__ezCalc2Pfi
	.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	4(%rsp), %rcx
	movl	%esi, (%rcx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z7ezCalc2Pfi, %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_end1:
	.size	_Z22__device_stub__ezCalc2Pfi, .Lfunc_end1-_Z22__device_stub__ezCalc2Pfi
	.cfi_endproc
                                        # -- End function
	.globl	_Z20__device_stub__hCalcPfS_S_  # -- Begin function _Z20__device_stub__hCalcPfS_S_
	.type	_Z20__device_stub__hCalcPfS_S_,@function
_Z20__device_stub__hCalcPfS_S_:         # @_Z20__device_stub__hCalcPfS_S_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z5hCalcPfS_S_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z20__device_stub__hCalcPfS_S_, .Lfunc_end2-_Z20__device_stub__hCalcPfS_S_
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI3_0:
	.quad	0x4010000000000000              # double 4
.LCPI3_1:
	.quad	0x3e7ad7f29abcaf48              # double 9.9999999999999995E-8
.LCPI3_4:
	.quad	0x41cdcd6500000000              # double 1.0E+9
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0
.LCPI3_2:
	.long	0x281f7fdf                      # float 8.85400067E-15
.LCPI3_3:
	.long	0x3a83126f                      # float 0.00100000005
	.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	$200, %rsp
	.cfi_def_cfa_offset 256
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %rbx
	movl	$1078530011, 52(%rsp)           # imm = 0x40490FDB
	cmpl	$4, %edi
	jne	.LBB3_34
# %bb.1:
	movq	8(%rbx), %rdi
	callq	atoi
	movl	%eax, %ebp
	leaq	12(%rsp), %rax
	movl	%ebp, (%rax)
	movq	16(%rbx), %rdi
	callq	atoi
	movl	%eax, %r14d
	leaq	8(%rsp), %r13
	movl	%eax, (%r13)
	movq	24(%rbx), %rdi
	callq	atoi
	movl	%eax, %r12d
	movl	$.L.str.2, %edi
	movl	%ebp, %esi
	movl	%r14d, %edx
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	printf
	leaq	52(%rsp), %rbx
	movl	$pi_d, %edi
	movl	$4, %edx
	movq	%rbx, %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	leaq	100(%rsp), %rsi
	movl	$10, (%rsi)
	movl	$is_d, %edi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	cvtss2sd	(%rbx), %xmm0
	mulsd	.LCPI3_0(%rip), %xmm0
	mulsd	.LCPI3_1(%rip), %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, 40(%rsp)                 # 4-byte Spill
	leaq	96(%rsp), %rbx
	movl	$732290137, (%rbx)              # imm = 0x2BA5DC59
	movl	$dt_d, %edi
	movl	$4, %edx
	movq	%rbx, %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	movss	(%rbx), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	movaps	%xmm0, %xmm1
	divss	.LCPI3_2(%rip), %xmm1
	leaq	92(%rsp), %r14
	movss	40(%rsp), %xmm2                 # 4-byte Reload
                                        # xmm2 = mem[0],zero,zero,zero
	mulss	.LCPI3_3(%rip), %xmm2
	movss	%xmm1, (%r14)
	divss	%xmm2, %xmm0
	leaq	88(%rsp), %r15
	movss	%xmm0, (%r15)
	movl	$cb_d, %edi
	movl	$4, %edx
	movq	%r14, %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	movl	$db_d, %edi
	movl	$4, %edx
	movq	%r15, %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbx), %xmm0
	xorps	%xmm1, %xmm1
	cvtss2sd	(%r14), %xmm1
	xorps	%xmm2, %xmm2
	cvtss2sd	(%r15), %xmm2
	movl	$.L.str.3, %edi
	movb	$3, %al
	callq	printf
	leaq	12(%rsp), %rax
	movslq	(%rax), %rax
	movslq	(%r13), %rbp
	imulq	%rax, %rbp
	movl	$4, %esi
	movq	%rbp, %rdi
	callq	calloc
	movq	%rax, %r14
	movl	$4, %esi
	movq	%rbp, %rdi
	callq	calloc
	movq	%rax, %rbx
	movl	$4, %esi
	movq	%rbp, %rdi
	callq	calloc
	movq	%rax, %r15
	shlq	$2, %rbp
	leaq	16(%rsp), %rdi
	movq	%rbp, %rsi
	callq	hipMalloc
	leaq	32(%rsp), %rdi
	movq	%rbp, %rsi
	callq	hipMalloc
	leaq	24(%rsp), %rdi
	movq	%rbp, %rsi
	callq	hipMalloc
	leaq	84(%rsp), %rsi
	movl	$1362772919, (%rsi)             # imm = 0x513A43B7
	movl	$freq_d, %edi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	movl	$JE_d, %edi
	movl	$4, %edx
	movq	%r13, %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	movl	$IE_d, %edi
	movl	$4, %edx
	leaq	12(%rsp), %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	leaq	120(%rsp), %rsi
	xorl	%edi, %edi
	callq	clock_gettime
	cmpl	$-1, %eax
	je	.LBB3_13
# %bb.2:
	movq	16(%rsp), %rdi
	movq	%r14, 72(%rsp)                  # 8-byte Spill
	movq	%r14, %rsi
	movq	%rbp, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	32(%rsp), %rdi
	movq	%rbx, 40(%rsp)                  # 8-byte Spill
	movq	%rbx, %rsi
	movq	%rbp, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	24(%rsp), %rdi
	movq	%r15, 64(%rsp)                  # 8-byte Spill
	movq	%r15, %rsi
	movq	%rbp, 56(%rsp)                  # 8-byte Spill
	movq	%rbp, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%r12d, %r12d
	jle	.LBB3_14
# %bb.3:                                # %.lr.ph.preheader
	movl	%r12d, %r15d
	xorl	%r13d, %r13d
	movabsq	$4294968320, %rbx               # imm = 0x100000400
	leaq	-1023(%rbx), %r12
	leaq	152(%rsp), %rbp
	leaq	136(%rsp), %r14
.LBB3_5:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	xorl	%edi, %edi
	leaq	184(%rsp), %rsi
	callq	clock_gettime
	cmpl	$-1, %eax
	je	.LBB3_13
# %bb.6:                                #   in Loop: Header=BB3_5 Depth=1
	movl	8(%rsp), %eax
	leaq	(%rbx,%rax), %rdi
	addq	$-1024, %rdi                    # imm = 0xFC00
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB3_8
# %bb.7:                                #   in Loop: Header=BB3_5 Depth=1
	movq	16(%rsp), %rdi
	movq	32(%rsp), %rsi
	movq	24(%rsp), %rdx
	callq	_Z21__device_stub__ezCalcPfS_S_
.LBB3_8:                                #   in Loop: Header=BB3_5 Depth=1
	xorl	%edi, %edi
	leaq	168(%rsp), %rsi
	callq	clock_gettime
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB3_10
# %bb.9:                                #   in Loop: Header=BB3_5 Depth=1
	movq	16(%rsp), %rdi
	movl	%r13d, %esi
	callq	_Z22__device_stub__ezCalc2Pfi
.LBB3_10:                               #   in Loop: Header=BB3_5 Depth=1
	xorl	%edi, %edi
	movq	%rbp, %rsi
	callq	clock_gettime
	movl	8(%rsp), %eax
	leaq	(%rbx,%rax), %rdi
	addq	$-1024, %rdi                    # imm = 0xFC00
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB3_12
# %bb.11:                               #   in Loop: Header=BB3_5 Depth=1
	movq	16(%rsp), %rdi
	movq	32(%rsp), %rsi
	movq	24(%rsp), %rdx
	callq	_Z20__device_stub__hCalcPfS_S_
.LBB3_12:                               #   in Loop: Header=BB3_5 Depth=1
	xorl	%edi, %edi
	movq	%r14, %rsi
	callq	clock_gettime
	cmpl	$-1, %eax
	je	.LBB3_13
# %bb.4:                                #   in Loop: Header=BB3_5 Depth=1
	incl	%r13d
	cmpl	%r13d, %r15d
	jne	.LBB3_5
.LBB3_14:                               # %._crit_edge
	movq	16(%rsp), %rsi
	movq	72(%rsp), %r15                  # 8-byte Reload
	movq	%r15, %rdi
	movq	56(%rsp), %rbx                  # 8-byte Reload
	movq	%rbx, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	32(%rsp), %rsi
	movq	40(%rsp), %r14                  # 8-byte Reload
	movq	%r14, %rdi
	movq	%rbx, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	24(%rsp), %rsi
	movq	64(%rsp), %r13                  # 8-byte Reload
	movq	%r13, %rdi
	movq	%rbx, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	leaq	104(%rsp), %rsi
	xorl	%edi, %edi
	callq	clock_gettime
	cmpl	$-1, %eax
	je	.LBB3_13
# %bb.15:
	movq	104(%rsp), %rax
	movq	112(%rsp), %rcx
	subq	120(%rsp), %rax
	cvtsi2sd	%rax, %xmm1
	subq	128(%rsp), %rcx
	cvtsi2sd	%rcx, %xmm0
	divsd	.LCPI3_4(%rip), %xmm0
	addsd	%xmm1, %xmm0
	movl	$.L.str.5, %edi
	movb	$1, %al
	callq	printf
	movl	$.L.str.6, %edi
	movl	$.L.str.7, %esi
	callq	fopen
	movq	%rax, %r12
	movl	$.L.str.8, %edi
	movl	$56, %esi
	movl	$1, %edx
	movq	%rax, %rcx
	callq	fwrite@PLT
	movl	8(%rsp), %eax
	imull	12(%rsp), %eax
	testl	%eax, %eax
	jle	.LBB3_21
# %bb.16:                               # %.lr.ph105.preheader
	xorl	%ebx, %ebx
	xorl	%ebp, %ebp
.LBB3_17:                               # %.lr.ph105
                                        # =>This Inner Loop Header: Depth=1
	cmpl	$8, %ebp
	jne	.LBB3_19
# %bb.18:                               #   in Loop: Header=BB3_17 Depth=1
	movl	$10, %edi
	movq	%r12, %rsi
	callq	fputc@PLT
	xorl	%ebp, %ebp
.LBB3_19:                               #   in Loop: Header=BB3_17 Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r15,%rbx,4), %xmm0
	movl	$.L.str.10, %esi
	movq	%r12, %rdi
	movb	$1, %al
	callq	fprintf
	cmpq	$998, %rbx                      # imm = 0x3E6
	ja	.LBB3_21
# %bb.20:                               #   in Loop: Header=BB3_17 Depth=1
	incq	%rbx
	incl	%ebp
	movslq	12(%rsp), %rax
	movslq	8(%rsp), %rcx
	imulq	%rax, %rcx
	cmpq	%rcx, %rbx
	jl	.LBB3_17
.LBB3_21:                               # %._crit_edge106
	movl	$.L.str.11, %edi
	movl	$56, %esi
	movl	$1, %edx
	movq	%r12, %rcx
	callq	fwrite@PLT
	movl	8(%rsp), %eax
	imull	12(%rsp), %eax
	testl	%eax, %eax
	jle	.LBB3_27
# %bb.22:                               # %.lr.ph110.preheader
	xorl	%ebx, %ebx
	xorl	%ebp, %ebp
.LBB3_23:                               # %.lr.ph110
                                        # =>This Inner Loop Header: Depth=1
	cmpl	$8, %ebp
	jne	.LBB3_25
# %bb.24:                               #   in Loop: Header=BB3_23 Depth=1
	movl	$10, %edi
	movq	%r12, %rsi
	callq	fputc@PLT
	xorl	%ebp, %ebp
.LBB3_25:                               #   in Loop: Header=BB3_23 Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r14,%rbx,4), %xmm0
	movl	$.L.str.10, %esi
	movq	%r12, %rdi
	movb	$1, %al
	callq	fprintf
	cmpq	$998, %rbx                      # imm = 0x3E6
	ja	.LBB3_27
# %bb.26:                               #   in Loop: Header=BB3_23 Depth=1
	incq	%rbx
	incl	%ebp
	movslq	12(%rsp), %rax
	movslq	8(%rsp), %rcx
	imulq	%rax, %rcx
	cmpq	%rcx, %rbx
	jl	.LBB3_23
.LBB3_27:                               # %._crit_edge111
	movl	$.L.str.12, %edi
	movl	$56, %esi
	movl	$1, %edx
	movq	%r12, %rcx
	callq	fwrite@PLT
	movl	8(%rsp), %eax
	imull	12(%rsp), %eax
	testl	%eax, %eax
	jle	.LBB3_33
# %bb.28:                               # %.lr.ph115.preheader
	xorl	%ebx, %ebx
	xorl	%ebp, %ebp
.LBB3_29:                               # %.lr.ph115
                                        # =>This Inner Loop Header: Depth=1
	cmpl	$8, %ebp
	jne	.LBB3_31
# %bb.30:                               #   in Loop: Header=BB3_29 Depth=1
	movl	$10, %edi
	movq	%r12, %rsi
	callq	fputc@PLT
	xorl	%ebp, %ebp
.LBB3_31:                               #   in Loop: Header=BB3_29 Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r13,%rbx,4), %xmm0
	movl	$.L.str.10, %esi
	movq	%r12, %rdi
	movb	$1, %al
	callq	fprintf
	cmpq	$998, %rbx                      # imm = 0x3E6
	ja	.LBB3_33
# %bb.32:                               #   in Loop: Header=BB3_29 Depth=1
	incq	%rbx
	incl	%ebp
	movslq	12(%rsp), %rax
	movslq	8(%rsp), %rcx
	imulq	%rax, %rcx
	cmpq	%rcx, %rbx
	jl	.LBB3_29
.LBB3_33:                               # %._crit_edge116
	movq	%r15, %rdi
	callq	free
	movq	%r13, %rdi
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	32(%rsp), %rdi
	callq	hipFree
	movq	24(%rsp), %rdi
	callq	hipFree
	xorl	%eax, %eax
	addq	$200, %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
.LBB3_13:
	.cfi_def_cfa_offset 256
	movl	$.L.str.4, %edi
	callq	perror
	movl	$1, %edi
	callq	exit
.LBB3_34:
	movl	$.Lstr, %edi
	callq	puts@PLT
	movq	(%rbx), %rsi
	movl	$.L.str.1, %edi
	xorl	%eax, %eax
	callq	printf
	xorl	%edi, %edi
	callq	exit
.Lfunc_end3:
	.size	main, .Lfunc_end3-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB4_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB4_2:
	subq	$32, %rsp
	.cfi_adjust_cfa_offset 32
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z6ezCalcPfS_S_, %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	$_Z7ezCalc2Pfi, %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	$_Z5hCalcPfS_S_, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	addq	$32, %rsp
	.cfi_adjust_cfa_offset -32
	movl	$IE_d, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$JE_d, %esi
	movl	$.L__unnamed_5, %edx
	movl	$.L__unnamed_5, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$cb_d, %esi
	movl	$.L__unnamed_6, %edx
	movl	$.L__unnamed_6, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$is_d, %esi
	movl	$.L__unnamed_7, %edx
	movl	$.L__unnamed_7, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$pi_d, %esi
	movl	$.L__unnamed_8, %edx
	movl	$.L__unnamed_8, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$freq_d, %esi
	movl	$.L__unnamed_9, %edx
	movl	$.L__unnamed_9, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$dt_d, %esi
	movl	$.L__unnamed_10, %edx
	movl	$.L__unnamed_10, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$db_d, %esi
	movl	$.L__unnamed_11, %edx
	movl	$.L__unnamed_11, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$__hip_module_dtor, %edi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end4:
	.size	__hip_module_ctor, .Lfunc_end4-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB5_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB5_2:
	retq
.Lfunc_end5:
	.size	__hip_module_dtor, .Lfunc_end5-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	IE_d,@object                    # @IE_d
	.local	IE_d
	.comm	IE_d,4,4
	.type	JE_d,@object                    # @JE_d
	.local	JE_d
	.comm	JE_d,4,4
	.type	cb_d,@object                    # @cb_d
	.local	cb_d
	.comm	cb_d,4,4
	.type	is_d,@object                    # @is_d
	.local	is_d
	.comm	is_d,4,4
	.type	pi_d,@object                    # @pi_d
	.local	pi_d
	.comm	pi_d,4,4
	.type	freq_d,@object                  # @freq_d
	.local	freq_d
	.comm	freq_d,4,4
	.type	dt_d,@object                    # @dt_d
	.local	dt_d
	.comm	dt_d,4,4
	.type	db_d,@object                    # @db_d
	.local	db_d
	.comm	db_d,4,4
	.type	_Z6ezCalcPfS_S_,@object         # @_Z6ezCalcPfS_S_
	.section	.rodata,"a",@progbits
	.globl	_Z6ezCalcPfS_S_
	.p2align	3, 0x0
_Z6ezCalcPfS_S_:
	.quad	_Z21__device_stub__ezCalcPfS_S_
	.size	_Z6ezCalcPfS_S_, 8

	.type	_Z7ezCalc2Pfi,@object           # @_Z7ezCalc2Pfi
	.globl	_Z7ezCalc2Pfi
	.p2align	3, 0x0
_Z7ezCalc2Pfi:
	.quad	_Z22__device_stub__ezCalc2Pfi
	.size	_Z7ezCalc2Pfi, 8

	.type	_Z5hCalcPfS_S_,@object          # @_Z5hCalcPfS_S_
	.globl	_Z5hCalcPfS_S_
	.p2align	3, 0x0
_Z5hCalcPfS_S_:
	.quad	_Z20__device_stub__hCalcPfS_S_
	.size	_Z5hCalcPfS_S_, 8

	.type	.L.str.1,@object                # @.str.1
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.1:
	.asciz	"   %s  IE JE steps\n"
	.size	.L.str.1, 20

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Running 2D FDTD algorithm with matrix of size %d x %d (%d steps)\n"
	.size	.L.str.2, 66

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Coefficients are: dt=%g cb=%g db=%g\n"
	.size	.L.str.3, 37

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Error in gettime"
	.size	.L.str.4, 17

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"\n\n====Total time: %f\n"
	.size	.L.str.5, 22

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"output_gpu_v4.txt"
	.size	.L.str.6, 18

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

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"==================== Ez MATRIX ========================\n"
	.size	.L.str.8, 57

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"%8f  "
	.size	.L.str.10, 6

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"==================== Hx MATRIX ========================\n"
	.size	.L.str.11, 57

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"==================== Hy MATRIX ========================\n"
	.size	.L.str.12, 57

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z6ezCalcPfS_S_"
	.size	.L__unnamed_1, 16

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z7ezCalc2Pfi"
	.size	.L__unnamed_2, 14

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z5hCalcPfS_S_"
	.size	.L__unnamed_3, 15

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"IE_d"
	.size	.L__unnamed_4, 5

	.type	.L__unnamed_5,@object           # @4
.L__unnamed_5:
	.asciz	"JE_d"
	.size	.L__unnamed_5, 5

	.type	.L__unnamed_6,@object           # @5
.L__unnamed_6:
	.asciz	"cb_d"
	.size	.L__unnamed_6, 5

	.type	.L__unnamed_7,@object           # @6
.L__unnamed_7:
	.asciz	"is_d"
	.size	.L__unnamed_7, 5

	.type	.L__unnamed_8,@object           # @7
.L__unnamed_8:
	.asciz	"pi_d"
	.size	.L__unnamed_8, 5

	.type	.L__unnamed_9,@object           # @8
.L__unnamed_9:
	.asciz	"freq_d"
	.size	.L__unnamed_9, 7

	.type	.L__unnamed_10,@object          # @9
.L__unnamed_10:
	.asciz	"dt_d"
	.size	.L__unnamed_10, 5

	.type	.L__unnamed_11,@object          # @10
.L__unnamed_11:
	.asciz	"db_d"
	.size	.L__unnamed_11, 5

	.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

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"Invalid arguments... please type:"
	.size	.Lstr, 34

	.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 _Z21__device_stub__ezCalcPfS_S_
	.addrsig_sym _Z22__device_stub__ezCalc2Pfi
	.addrsig_sym _Z20__device_stub__hCalcPfS_S_
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym IE_d
	.addrsig_sym JE_d
	.addrsig_sym cb_d
	.addrsig_sym is_d
	.addrsig_sym pi_d
	.addrsig_sym freq_d
	.addrsig_sym dt_d
	.addrsig_sym db_d
	.addrsig_sym _Z6ezCalcPfS_S_
	.addrsig_sym _Z7ezCalc2Pfi
	.addrsig_sym _Z5hCalcPfS_S_
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z6ezCalcPfS_S_         ; -- Begin function _Z6ezCalcPfS_S_
	.globl	_Z6ezCalcPfS_S_
	.p2align	8
	.type	_Z6ezCalcPfS_S_,@function
_Z6ezCalcPfS_S_:                        ; @_Z6ezCalcPfS_S_
; %bb.0:
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, IE_d@rel32@lo+4
	s_addc_u32 s3, s3, IE_d@rel32@hi+12
	s_load_b32 s8, s[2:3], 0x0
	s_mov_b32 s2, exec_lo
	s_waitcnt lgkmcnt(0)
	v_cmpx_gt_i32_e64 s8, v0
	s_cbranch_execz .LBB0_7
; %bb.1:                                ; %.lr.ph
	s_add_i32 s9, s8, -1
	s_cmp_eq_u32 s15, 0
	v_mov_b32_e32 v3, 0
	s_cselect_b32 s10, -1, 0
	s_getpc_b64 s[12:13]
	s_add_u32 s12, s12, cb_d@rel32@lo+4
	s_addc_u32 s13, s13, cb_d@rel32@hi+12
	s_getpc_b64 s[16:17]
	s_add_u32 s16, s16, JE_d@rel32@lo+4
	s_addc_u32 s17, s17, JE_d@rel32@hi+12
	s_clause 0x2
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[2:3], s[0:1], 0x10
	s_load_b32 s0, s[0:1], 0x24
	s_load_b32 s11, s[12:13], 0x0
	s_load_b32 s12, s[16:17], 0x0
	s_mul_i32 s13, s8, s15
	s_mov_b32 s14, 0
	s_add_i32 s15, s15, -1
	s_waitcnt lgkmcnt(0)
	s_and_b32 s16, s0, 0xffff
.LBB0_2:                                ; =>This Inner Loop Header: Depth=1
	v_add_nc_u32_e32 v1, s13, v0
	v_cmp_eq_u32_e32 vcc_lo, 0, v0
	v_cmp_eq_u32_e64 s0, s9, v0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v2, 31, v1
	s_or_b32 s17, vcc_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s18, s17
	s_cbranch_execz .LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[4:5], 2, v[1:2]
	v_add_co_u32 v4, s1, s4, v4
	s_delay_alu instid0(VALU_DEP_1)
	v_add_co_ci_u32_e64 v5, s1, s5, v5, s1
	global_store_b32 v[4:5], v3, off
.LBB0_4:                                ;   in Loop: Header=BB0_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s18
	s_or_b32 s1, s10, vcc_lo
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_or_b32 s1, s1, s0
	s_and_b32 s0, s1, s17
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_xor_b32 s17, s0, -1
	s_and_saveexec_b32 s0, s17
	s_cbranch_execz .LBB0_6
; %bb.5:                                ; %.sink.split
                                        ;   in Loop: Header=BB0_2 Depth=1
	v_cndmask_b32_e64 v4, s12, 0, s1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v6, s15, v4
	v_mad_u64_u32 v[4:5], null, v6, s8, v[0:1]
	v_lshlrev_b64 v[1:2], 2, v[1:2]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v6, vcc_lo, s2, v1
	v_ashrrev_i32_e32 v5, 31, v4
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_ci_u32_e32 v7, vcc_lo, s3, v2, vcc_lo
	v_lshlrev_b64 v[4:5], 2, v[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v4, vcc_lo, s6, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, s7, v5, vcc_lo
	global_load_b64 v[6:7], v[6:7], off offset:-4
	global_load_b32 v8, v[4:5], off
	v_add_co_u32 v4, vcc_lo, s6, v1
	v_add_co_ci_u32_e32 v5, vcc_lo, s7, v2, vcc_lo
	v_add_co_u32 v1, vcc_lo, s4, v1
	v_add_co_ci_u32_e32 v2, vcc_lo, s5, v2, vcc_lo
	global_load_b32 v4, v[4:5], off
	global_load_b32 v5, v[1:2], off
	s_waitcnt vmcnt(3)
	v_sub_f32_e32 v6, v7, v6
	s_waitcnt vmcnt(2)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_f32_e32 v6, v6, v8
	s_waitcnt vmcnt(1)
	v_sub_f32_e32 v4, v6, v4
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_fmac_f32_e32 v5, s11, v4
	global_store_b32 v[1:2], v5, off
.LBB0_6:                                ;   in Loop: Header=BB0_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s0
	v_add_nc_u32_e32 v0, s16, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_cmp_le_i32_e32 vcc_lo, s8, v0
	s_or_b32 s14, vcc_lo, s14
	s_and_not1_b32 exec_lo, exec_lo, s14
	s_cbranch_execnz .LBB0_2
.LBB0_7:                                ; %._crit_edge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z6ezCalcPfS_S_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 9
		.amdhsa_next_free_sgpr 19
		.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	_Z6ezCalcPfS_S_, .Lfunc_end0-_Z6ezCalcPfS_S_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 512
; NumSgprs: 21
; NumVgprs: 9
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 21
; NumVGPRsForWavesPerEU: 9
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z7ezCalc2Pfi           ; -- Begin function _Z7ezCalc2Pfi
	.globl	_Z7ezCalc2Pfi
	.p2align	8
	.type	_Z7ezCalc2Pfi,@function
_Z7ezCalc2Pfi:                          ; @_Z7ezCalc2Pfi
; %bb.0:
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, JE_d@rel32@lo+4
	s_addc_u32 s3, s3, JE_d@rel32@hi+12
	s_load_b32 s4, s[2:3], 0x0
	s_mov_b32 s2, exec_lo
	s_waitcnt lgkmcnt(0)
	v_cmpx_gt_i32_e64 s4, v0
	s_cbranch_execz .LBB1_3
; %bb.1:                                ; %.lr.ph
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, pi_d@rel32@lo+4
	s_addc_u32 s3, s3, pi_d@rel32@hi+12
	s_getpc_b64 s[6:7]
	s_add_u32 s6, s6, freq_d@rel32@lo+4
	s_addc_u32 s7, s7, freq_d@rel32@hi+12
	s_load_b32 s5, s[2:3], 0x0
	s_load_b32 s8, s[0:1], 0x8
	s_load_b32 s6, s[6:7], 0x0
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, dt_d@rel32@lo+4
	s_addc_u32 s3, s3, dt_d@rel32@hi+12
	s_load_b32 s2, s[2:3], 0x0
	s_waitcnt lgkmcnt(0)
	v_add_f32_e64 v1, s5, s5
	v_cvt_f32_i32_e32 v2, s8
	s_load_b32 s5, s[0:1], 0x1c
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v1, s6, v1
	v_mul_f32_e32 v1, v1, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v3, s2, v1
	v_readfirstlane_b32 s2, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_bitset0_b32 s2, 31
	s_and_b32 s3, s2, 0x7fffff
	s_lshr_b32 s2, s2, 23
	s_bitset1_b32 s3, 23
	s_addk_i32 s2, 0xff88
	s_mul_hi_u32 s6, s3, 0xfe5163ab
	s_mul_i32 s8, s3, 0x3c439041
	s_mul_hi_u32 s7, s3, 0x3c439041
	s_add_u32 s6, s6, s8
	s_mul_i32 s10, s3, 0xdb629599
	s_addc_u32 s7, 0, s7
	s_mul_hi_u32 s9, s3, 0xdb629599
	s_add_u32 s7, s7, s10
	s_mul_i32 s12, s3, 0xf534ddc0
	s_addc_u32 s9, 0, s9
	s_mul_hi_u32 s11, s3, 0xf534ddc0
	s_add_u32 s9, s9, s12
	s_mul_i32 s14, s3, 0xfc2757d1
	s_addc_u32 s11, 0, s11
	s_mul_hi_u32 s13, s3, 0xfc2757d1
	s_add_u32 s11, s11, s14
	s_mul_i32 s10, s3, 0x4e441529
	s_addc_u32 s13, 0, s13
	s_mul_hi_u32 s8, s3, 0x4e441529
	s_add_u32 s10, s13, s10
	s_addc_u32 s8, 0, s8
	s_mul_i32 s12, s3, 0xfe5163ab
	s_mul_hi_u32 s14, s3, 0xa2f9836e
	s_cmp_gt_u32 s2, 63
	s_mul_i32 s3, s3, 0xa2f9836e
	s_cselect_b32 s13, s7, s11
	s_cselect_b32 s6, s6, s9
	s_cselect_b32 s7, s12, s7
	s_add_u32 s3, s8, s3
	s_addc_u32 s8, 0, s14
	s_cmp_gt_u32 s2, 63
	s_cselect_b32 s12, 0xffffffc0, 0
	s_cselect_b32 s9, s9, s10
	s_cselect_b32 s3, s11, s3
	s_cselect_b32 s8, s10, s8
	s_add_i32 s12, s12, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_gt_u32 s12, 31
	s_cselect_b32 s2, 0xffffffe0, 0
	s_cselect_b32 s10, s9, s3
	s_cselect_b32 s3, s3, s8
	s_cselect_b32 s8, s13, s9
	s_cselect_b32 s9, s6, s13
	s_cselect_b32 s6, s7, s6
	s_add_i32 s2, s2, s12
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_gt_u32 s2, 31
	s_cselect_b32 s7, 0xffffffe0, 0
	s_cselect_b32 s3, s10, s3
	s_cselect_b32 s10, s8, s10
	s_cselect_b32 s8, s9, s8
	s_cselect_b32 s6, s6, s9
	s_add_i32 s7, s7, s2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	s_sub_i32 s2, 32, s7
	s_cmp_eq_u32 s7, 0
	v_mov_b32_e32 v1, s2
	s_cselect_b32 s7, -1, 0
	v_alignbit_b32 v2, s3, s10, v1
	v_alignbit_b32 v4, s10, s8, v1
	v_alignbit_b32 v1, s8, s6, v1
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_readfirstlane_b32 s2, v2
	v_cndmask_b32_e64 v2, v4, s10, s7
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v1, v1, s8, s7
	s_mov_b32 s7, 0x37d75334
	s_cselect_b32 s9, s3, s2
	s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1)
	v_alignbit_b32 v4, s9, v2, 30
	s_bfe_u32 s10, s9, 0x1001d
	v_alignbit_b32 v2, v2, v1, 30
	s_sub_i32 s2, 0, s10
	v_alignbit_b32 v1, v1, s6, 30
	v_xor_b32_e32 v4, s2, v4
	s_mov_b32 s6, 0xb94c1982
	v_xor_b32_e32 v2, s2, v2
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_xor_b32_e32 v1, s2, v1
	v_clz_i32_u32_e32 v5, v4
	s_lshr_b32 s2, s9, 29
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_lshl_b32 s2, s2, 31
	v_min_u32_e32 v5, 32, v5
	s_or_b32 s3, s2, 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v6, 31, v5
	v_lshlrev_b32_e32 v7, 23, v5
	v_alignbit_b32 v4, v4, v2, v6
	v_alignbit_b32 v1, v2, v1, v6
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v7, s3, v7
	v_alignbit_b32 v2, v4, v1, 9
	v_lshrrev_b32_e32 v4, 9, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_clz_i32_u32_e32 v6, v2
	v_min_u32_e32 v6, 32, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v8, 31, v6
	v_add_nc_u32_e32 v5, v6, v5
	v_alignbit_b32 v1, v2, v1, v8
	v_or_b32_e32 v2, v4, v7
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_lshlrev_b32_e32 v4, 23, v5
	v_mul_f32_e64 v5, 0x3f22f983, |v3|
	v_lshrrev_b32_e32 v1, 9, v1
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_f32_e32 v6, 0x3fc90fda, v2
	v_sub_nc_u32_e32 v1, v1, v4
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_rndne_f32_e32 v4, v5
	v_fma_f32 v5, 0x3fc90fda, v2, -v6
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v1, 0x33000000, v1
	v_fmamk_f32 v2, v2, 0x33a22168, v5
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_fma_f32 v7, 0xbfc90fda, v4, |v3|
	v_cmp_gt_f32_e64 vcc_lo, 0x48000000, |v3|
	v_or_b32_e32 v1, s2, v1
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, IE_d@rel32@lo+4
	s_addc_u32 s3, s3, IE_d@rel32@hi+12
	s_lshr_b32 s8, s9, 30
	v_fmamk_f32 v5, v4, 0xb3a22168, v7
	v_fmac_f32_e32 v2, 0x3fc90fda, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_fmamk_f32 v1, v4, 0xa7c234c4, v5
	v_cvt_i32_f32_e32 v4, v4
	v_add_f32_e32 v2, v6, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v1, v2, v1, vcc_lo
	v_mul_f32_e32 v2, v1, v1
	s_delay_alu instid0(VALU_DEP_1)
	v_fmaak_f32 v5, s6, v2, 0x3c0881c4
	v_fmaak_f32 v6, s7, v2, 0xbab64f3b
	s_getpc_b64 s[6:7]
	s_add_u32 s6, s6, is_d@rel32@lo+4
	s_addc_u32 s7, s7, is_d@rel32@hi+12
	s_add_i32 s10, s10, s8
	s_load_b32 s8, s[2:3], 0x0
	s_load_b32 s6, s[6:7], 0x0
	v_fmaak_f32 v5, v2, v5, 0xbe2aaa9d
	v_cndmask_b32_e32 v4, s10, v4, vcc_lo
	s_load_b64 s[2:3], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s1, s5, 0xffff
	s_mov_b32 s5, 0
	v_mul_f32_e32 v5, v2, v5
	v_dual_fmaak_f32 v6, v2, v6, 0x3d2aabf7 :: v_dual_and_b32 v7, 1, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_dual_fmac_f32 v1, v1, v5 :: v_dual_lshlrev_b32 v4, 30, v4
	v_fmaak_f32 v6, v2, v6, 0xbf000004
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cmp_eq_u32_e32 vcc_lo, 0, v7
	v_fma_f32 v2, v2, v6, 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_cndmask_b32_e64 v1, -v1, v2, vcc_lo
	v_and_b32_e32 v2, 0x80000000, v4
	v_cmp_class_f32_e64 vcc_lo, v3, 0x1f8
	v_xor_b32_e32 v4, v2, v1
	v_mad_u64_u32 v[1:2], null, v0, s8, s[6:7]
	s_mul_i32 s6, s8, s1
	s_delay_alu instid0(VALU_DEP_2)
	v_cndmask_b32_e32 v3, 0x7fc00000, v4, vcc_lo
.LBB1_2:                                ; %_ZL3cosf.exit
                                        ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v2, 31, v1
	v_add_nc_u32_e32 v0, s1, v0
	v_lshlrev_b64 v[4:5], 2, v[1:2]
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_cmp_le_i32_e32 vcc_lo, s4, v0
	v_add_nc_u32_e32 v1, s6, v1
	s_or_b32 s5, vcc_lo, s5
	v_add_co_u32 v4, s0, s2, v4
	s_delay_alu instid0(VALU_DEP_1)
	v_add_co_ci_u32_e64 v5, s0, s3, v5, s0
	global_store_b32 v[4:5], v3, off
	s_and_not1_b32 exec_lo, exec_lo, s5
	s_cbranch_execnz .LBB1_2
.LBB1_3:                                ; %._crit_edge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z7ezCalc2Pfi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 272
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 9
		.amdhsa_next_free_sgpr 15
		.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	_Z7ezCalc2Pfi, .Lfunc_end1-_Z7ezCalc2Pfi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1228
; NumSgprs: 17
; NumVgprs: 9
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 17
; NumVGPRsForWavesPerEU: 9
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z5hCalcPfS_S_          ; -- Begin function _Z5hCalcPfS_S_
	.globl	_Z5hCalcPfS_S_
	.p2align	8
	.type	_Z5hCalcPfS_S_,@function
_Z5hCalcPfS_S_:                         ; @_Z5hCalcPfS_S_
; %bb.0:
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, IE_d@rel32@lo+4
	s_addc_u32 s3, s3, IE_d@rel32@hi+12
	s_load_b32 s2, s[2:3], 0x0
	s_mov_b32 s3, exec_lo
	s_waitcnt lgkmcnt(0)
	v_cmpx_gt_i32_e64 s2, v0
	s_cbranch_execz .LBB2_5
; %bb.1:                                ; %.lr.ph
	s_getpc_b64 s[4:5]
	s_add_u32 s4, s4, JE_d@rel32@lo+4
	s_addc_u32 s5, s5, JE_d@rel32@hi+12
	s_getpc_b64 s[8:9]
	s_add_u32 s8, s8, db_d@rel32@lo+4
	s_addc_u32 s9, s9, db_d@rel32@hi+12
	s_load_b32 s11, s[0:1], 0x24
	s_load_b32 s12, s[4:5], 0x0
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
	s_load_b32 s3, s[8:9], 0x0
	s_add_i32 s13, s15, 1
	s_add_i32 s9, s2, -1
	s_mul_i32 s8, s2, s15
	s_mov_b32 s10, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s11, s11, 0xffff
	s_mul_i32 s14, s12, s13
	s_cmp_lg_u32 s13, s12
	s_mul_i32 s12, s12, s15
	s_cselect_b32 s13, s14, 0
	s_ashr_i32 s14, s12, 31
	s_add_u32 s15, s4, 4
	s_addc_u32 s16, s5, 0
.LBB2_2:                                ; =>This Inner Loop Header: Depth=1
	v_add_nc_u32_e32 v1, s8, v0
	v_add_nc_u32_e32 v3, s13, v0
	s_mov_b32 s17, exec_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v2, 31, v1
	v_ashrrev_i32_e32 v4, 31, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[1:2], 2, v[1:2]
	v_lshlrev_b64 v[3:4], 2, v[3:4]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v5, vcc_lo, s4, v1
	v_add_co_ci_u32_e32 v6, vcc_lo, s5, v2, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v3, vcc_lo, s4, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s5, v4, vcc_lo
	v_add_co_u32 v7, vcc_lo, s6, v1
	v_add_co_ci_u32_e32 v8, vcc_lo, s7, v2, vcc_lo
	s_clause 0x1
	global_load_b32 v1, v[5:6], off
	global_load_b32 v2, v[3:4], off
	global_load_b32 v3, v[7:8], off
	s_waitcnt vmcnt(1)
	v_dual_sub_f32 v1, v1, v2 :: v_dual_mov_b32 v2, s9
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_fmac_f32_e32 v3, s3, v1
	v_mov_b32_e32 v1, 0
	global_store_b32 v[7:8], v3, off
	v_cmpx_ne_u32_e64 s9, v0
	s_cbranch_execz .LBB2_4
; %bb.3:                                ;   in Loop: Header=BB2_2 Depth=1
	v_ashrrev_i32_e32 v2, 31, v0
	v_add_co_u32 v1, vcc_lo, v0, s12
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e32 v2, vcc_lo, s14, v2, vcc_lo
	v_lshlrev_b64 v[1:2], 2, v[1:2]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v1, vcc_lo, s15, v1
	v_add_co_ci_u32_e32 v2, vcc_lo, s16, v2, vcc_lo
	global_load_b32 v1, v[1:2], off
	v_mov_b32_e32 v2, v0
.LBB2_4:                                ;   in Loop: Header=BB2_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s17
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v2, s12, v2
	v_ashrrev_i32_e32 v3, 31, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	v_add_co_u32 v4, vcc_lo, s4, v2
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v3, vcc_lo
	v_add_co_u32 v2, vcc_lo, s0, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s1, v3, vcc_lo
	global_load_b32 v4, v[4:5], off
	global_load_b32 v5, v[2:3], off
	s_waitcnt vmcnt(1)
	v_sub_f32_e32 v1, v1, v4
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_fmac_f32 v5, s3, v1 :: v_dual_add_nc_u32 v0, s11, v0
	v_cmp_le_i32_e32 vcc_lo, s2, v0
	global_store_b32 v[2:3], v5, off
	s_or_b32 s10, vcc_lo, s10
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s10
	s_cbranch_execnz .LBB2_2
.LBB2_5:                                ; %._crit_edge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z5hCalcPfS_S_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 9
		.amdhsa_next_free_sgpr 18
		.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	_Z5hCalcPfS_S_, .Lfunc_end2-_Z5hCalcPfS_S_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 544
; NumSgprs: 20
; NumVgprs: 9
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 20
; NumVGPRsForWavesPerEU: 9
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.protected	IE_d                    ; @IE_d
	.type	IE_d,@object
	.section	.bss,"aw",@nobits
	.globl	IE_d
	.p2align	2, 0x0
IE_d:
	.long	0                               ; 0x0
	.size	IE_d, 4

	.protected	JE_d                    ; @JE_d
	.type	JE_d,@object
	.globl	JE_d
	.p2align	2, 0x0
JE_d:
	.long	0                               ; 0x0
	.size	JE_d, 4

	.protected	cb_d                    ; @cb_d
	.type	cb_d,@object
	.globl	cb_d
	.p2align	2, 0x0
cb_d:
	.long	0x00000000                      ; float 0
	.size	cb_d, 4

	.protected	is_d                    ; @is_d
	.type	is_d,@object
	.globl	is_d
	.p2align	2, 0x0
is_d:
	.long	0                               ; 0x0
	.size	is_d, 4

	.protected	pi_d                    ; @pi_d
	.type	pi_d,@object
	.globl	pi_d
	.p2align	2, 0x0
pi_d:
	.long	0x00000000                      ; float 0
	.size	pi_d, 4

	.protected	freq_d                  ; @freq_d
	.type	freq_d,@object
	.globl	freq_d
	.p2align	2, 0x0
freq_d:
	.long	0x00000000                      ; float 0
	.size	freq_d, 4

	.protected	dt_d                    ; @dt_d
	.type	dt_d,@object
	.globl	dt_d
	.p2align	2, 0x0
dt_d:
	.long	0x00000000                      ; float 0
	.size	dt_d, 4

	.protected	db_d                    ; @db_d
	.type	db_d,@object
	.globl	db_d
	.p2align	2, 0x0
db_d:
	.long	0x00000000                      ; float 0
	.size	db_d, 4

	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.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 IE_d
	.addrsig_sym JE_d
	.addrsig_sym cb_d
	.addrsig_sym is_d
	.addrsig_sym pi_d
	.addrsig_sym freq_d
	.addrsig_sym dt_d
	.addrsig_sym db_d
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z6ezCalcPfS_S_
    .private_segment_fixed_size: 0
    .sgpr_count:     21
    .sgpr_spill_count: 0
    .symbol:         _Z6ezCalcPfS_S_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     9
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         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:           _Z7ezCalc2Pfi
    .private_segment_fixed_size: 0
    .sgpr_count:     17
    .sgpr_spill_count: 0
    .symbol:         _Z7ezCalc2Pfi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     9
    .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
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z5hCalcPfS_S_
    .private_segment_fixed_size: 0
    .sgpr_count:     20
    .sgpr_spill_count: 0
    .symbol:         _Z5hCalcPfS_S_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     9
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
