#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define PI 3.141592


#define CUDA_CHECK_RETURN(value) {											\
	cudaError_t _m_cudaStat = value;										\
	if (_m_cudaStat != cudaSuccess) {										\
		fprintf(stderr, "Error %s at line %d in file %s\n",					\
				cudaGetErrorString(_m_cudaStat), __LINE__, __FILE__);		\
		exit(1);															\
	} }



__global__ void anglesum(float *sino,
		float *image,
		int nangles,
		int nrays,
		int wdI,
		float delta,
		float ini)

{
  int i, j, T, k;
  float dt, th, dth, t, cost, sint, cumsum;
  float	x;
  float y;

  i = blockDim.x * blockIdx.x + threadIdx.x;
  j = blockDim.y * blockIdx.y + threadIdx.y;

  if ((i<wdI) && (j < wdI) ){

  x = ini + i * delta;
  y = ini + j * delta;



  cumsum = 0;

  dt  = 2.0/(nrays-1);
  dth = PI/(nangles);

  for(k=0; k < nangles; k++)
    {
      th = k*dth;

      cost  = cos(th);
      sint  = sin(th);

      t = x*cost + y*sint;

      T = (int) floor((t + 1)/dt);

      if(T > -1 && T < nrays-1)
	{
	  cumsum = cumsum + (sino[nangles*(T+1) + k]-sino[nangles*T + k])*(t-(-1.0 + T*dt))/dt + sino[nangles*T + k];
	}
    }
  image[j*wdI + i] = (cumsum*dth);
}
}


int main(int argc, char *argv[]) {
	int i, j;
	float delta, ini;

	int sizeImage = atoi(argv[2]);
	int nrays     = atoi(argv[3]);
	int nangles   = atoi(argv[4]);

	FILE *fp=fopen(argv[1], "r");


	cudaEvent_t start, stop;
	cudaEventCreate(&start);
	cudaEventCreate(&stop);
	float milliseconds = 0;

	float *dev_i = NULL;
	float *dev_s = NULL;
	float *image;
	float *sino;

	// GRID SIZE
	unsigned int gridp;
	gridp = (unsigned int) ceilf(((float)(sizeImage)/16));
	dim3 grid(gridp, gridp, 1);
	dim3 blocks(16, 16, 1);

	// MALLOC AND CUDA COPY
	image = (float *)malloc(sizeImage*sizeImage*sizeof(float));
	sino = (float *)malloc(nangles*nrays*sizeof(float));
	for (i = 0; i < nangles*nrays; i++)
		fscanf(fp, "%f", &sino[i]);


	cudaEventRecord(start);
	CUDA_CHECK_RETURN(cudaMalloc((void**) &dev_i, sizeof(float)*sizeImage*sizeImage));
	CUDA_CHECK_RETURN(cudaMalloc((void **)&dev_s , nangles*nrays*sizeof(float) ) );
	CUDA_CHECK_RETURN(cudaMemcpy (dev_s , sino , nrays*nangles*sizeof(float) , cudaMemcpyHostToDevice));
	//////////////////////

	// BACK PROJECTION
	ini = -sqrt(2)/2;

	delta = (double) sqrt(2)/(sizeImage-1);

	anglesum<<<grid, blocks>>>(dev_s, dev_i, nangles, nrays, sizeImage, delta, ini);
	// BACK PROJECTION FINISHED

	// COPY RESULTS
	CUDA_CHECK_RETURN(cudaGetLastError());

	CUDA_CHECK_RETURN(cudaMemcpy (image , dev_i , sizeImage*sizeImage*sizeof(float) , cudaMemcpyDeviceToHost) );

	cudaEventRecord(stop);
	cudaEventSynchronize(stop);
	cudaEventElapsedTime(&milliseconds, start, stop);

	fprintf(stderr, "%f ms\n", milliseconds);

	  for(i=0; i< sizeImage; i++)
	    {
	      for(j=0; j< sizeImage; j++)
		{
		  fprintf(stdout, "%f ", image[sizeImage*(sizeImage-1-i) + j]);
		}
	      fprintf(stdout, "\n");
	    }
	  //////////////

	  // FREE MEMORY
	free(sino);
	free(image);
	CUDA_CHECK_RETURN(cudaFree((void*) dev_s));
	CUDA_CHECK_RETURN(cudaFree((void*) dev_i));
	CUDA_CHECK_RETURN(cudaDeviceReset());

	return 0;
}

	.file	"tmpxft_0038f6eb_00000000-6_backproj.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	_Z34__device_stub__Z8anglesumPfS_iiiffPfS_iiiff
	.type	_Z34__device_stub__Z8anglesumPfS_iiiffPfS_iiiff, @function
_Z34__device_stub__Z8anglesumPfS_iiiffPfS_iiiff:
.LFB2053:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	76(%rsp), %rsi
	movl	%edx, 28(%rsp)
	leaq	48(%rsp), %rdx
	movl	%ecx, 24(%rsp)
	leaq	56(%rsp), %rcx
	movl	%r8d, 20(%rsp)
	movss	%xmm0, 16(%rsp)
	movss	%xmm1, 12(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	28(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L2
	pushq	56(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z8anglesumPfS_iiiff(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 208
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L2:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2053:
	.size	_Z34__device_stub__Z8anglesumPfS_iiiffPfS_iiiff, .-_Z34__device_stub__Z8anglesumPfS_iiiffPfS_iiiff
	.globl	_Z8anglesumPfS_iiiff
	.type	_Z8anglesumPfS_iiiff, @function
_Z8anglesumPfS_iiiff:
.LFB2054:
	.cfi_startproc
	endbr64
	jmp	_Z34__device_stub__Z8anglesumPfS_iiiffPfS_iiiff
	.cfi_endproc
.LFE2054:
	.size	_Z8anglesumPfS_iiiff, .-_Z8anglesumPfS_iiiff
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"r"
.LC3:
	.string	"%f"
.LC4:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/cerqueirajc/cu-ra-bp/master/src/tomo-cuda/backprojection/backproj.cu"
.LC5:
	.string	"Error %s at line %d in file %s\n"
.LC8:
	.string	"%f ms\n"
.LC9:
	.string	"%f "
.LC10:
	.string	"\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
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movq	16(%rsi), %rdi
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	call	atoi@PLT
	movq	24(%r12), %rdi
	movl	%eax, %ebx
	call	atoi@PLT
	movq	32(%r12), %rdi
	movl	%eax, %r14d
	call	atoi@PLT
	movq	8(%r12), %rdi
	movl	%r14d, %r12d
	leaq	.LC0(%rip), %rsi
	movl	%eax, %ebp
	call	fopen@PLT
	imull	%ebp, %r12d
	leaq	64(%rsp), %rdi
	movq	%rax, 40(%rsp)
	call	cudaEventCreate@PLT
	leaq	72(%rsp), %rdi
	call	cudaEventCreate@PLT
	cvtsi2ssl	%ebx, %xmm0
	xorl	%eax, %eax
	movl	$0x00000000, 60(%rsp)
	mulss	.LC2(%rip), %xmm0
	movq	%rax, 80(%rsp)
	movq	%rax, 88(%rsp)
	call	ceilf@PLT
	movl	$1, 104(%rsp)
	cvttss2siq	%xmm0, %rax
	movl	$1, 116(%rsp)
	movl	%eax, 96(%rsp)
	movl	%eax, 100(%rsp)
	movabsq	$68719476752, %rax
	movq	%rax, 108(%rsp)
	movl	%ebx, %eax
	imull	%ebx, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	movq	%rax, 32(%rsp)
	call	malloc@PLT
	movq	%rax, 16(%rsp)
	movslq	%r12d, %rax
	salq	$2, %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	malloc@PLT
	movq	%rax, 24(%rsp)
	movq	%rax, %r15
.L9:
	cmpl	%r13d, %r12d
	jle	.L27
	movq	40(%rsp), %rdi
	movq	%r15, %rdx
	xorl	%eax, %eax
	incl	%r13d
	leaq	.LC3(%rip), %rsi
	addq	$4, %r15
	call	__isoc23_fscanf@PLT
	jmp	.L9
.L27:
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	movslq	%ebx, %r12
	call	cudaEventRecord@PLT
	movq	%r12, %rsi
	leaq	80(%rsp), %rdi
	imulq	%r12, %rsi
	salq	$2, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L11
	call	cudaGetErrorString@PLT
	leaq	.LC4(%rip), %r9
	movl	$102, %r8d
	movq	%rax, %rcx
	jmp	.L26
.L11:
	movq	8(%rsp), %rsi
	leaq	88(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L12
	call	cudaGetErrorString@PLT
	leaq	.LC4(%rip), %r9
	movl	$103, %r8d
	movq	%rax, %rcx
.L26:
	movq	stderr(%rip), %rdi
	leaq	.LC5(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L12:
	movq	88(%rsp), %rdi
	movq	8(%rsp), %rdx
	movl	$1, %ecx
	movq	24(%rsp), %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L13
	call	cudaGetErrorString@PLT
	leaq	.LC4(%rip), %r9
	movl	$104, %r8d
	movq	%rax, %rcx
	jmp	.L26
.L13:
	movl	116(%rsp), %ecx
	movq	108(%rsp), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	96(%rsp), %rdi
	movl	104(%rsp), %esi
	leal	-1(%rbx), %r13d
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L14
	cvtsi2sdl	%r13d, %xmm1
	movq	80(%rsp), %rsi
	movl	%ebx, %r8d
	movl	%r14d, %ecx
	movsd	.LC6(%rip), %xmm0
	movq	88(%rsp), %rdi
	movl	%ebp, %edx
	divsd	%xmm1, %xmm0
	movss	.LC7(%rip), %xmm1
	cvtsd2ss	%xmm0, %xmm0
	call	_Z34__device_stub__Z8anglesumPfS_iiiffPfS_iiiff
.L14:
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L15
	call	cudaGetErrorString@PLT
	leaq	.LC4(%rip), %r9
	movl	$116, %r8d
	movq	%rax, %rcx
	jmp	.L26
.L15:
	movq	16(%rsp), %rdi
	movq	32(%rsp), %rdx
	movl	$2, %ecx
	movq	80(%rsp), %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L16
	call	cudaGetErrorString@PLT
	leaq	.LC4(%rip), %r9
	movl	$118, %r8d
	movq	%rax, %rcx
	jmp	.L26
.L16:
	movq	72(%rsp), %rdi
	xorl	%esi, %esi
	movl	%ebx, %ebp
	salq	$2, %r12
	negl	%ebp
	imull	%ebx, %r13d
	xorl	%r14d, %r14d
	call	cudaEventRecord@PLT
	movq	72(%rsp), %rdi
	movslq	%ebp, %rbp
	call	cudaEventSynchronize@PLT
	movq	72(%rsp), %rdx
	movq	64(%rsp), %rsi
	movslq	%r13d, %r13
	leaq	60(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	stderr(%rip), %rdi
	leaq	.LC8(%rip), %rdx
	movb	$1, %al
	movl	$2, %esi
	cvtss2sd	60(%rsp), %xmm0
	call	__fprintf_chk@PLT
	leaq	0(,%rbp,4), %rax
	movq	%rax, 8(%rsp)
	movq	16(%rsp), %rax
	leaq	(%rax,%r13,4), %r13
.L17:
	cmpl	%ebx, %r14d
	jge	.L28
	leaq	0(%r13,%r12), %r15
	movq	%r13, %rbp
.L18:
	cvtss2sd	0(%rbp), %xmm0
	movl	$2, %esi
	movq	stdout(%rip), %rdi
	movb	$1, %al
	leaq	.LC9(%rip), %rdx
	addq	$4, %rbp
	call	__fprintf_chk@PLT
	cmpq	%r15, %rbp
	jne	.L18
	movq	stdout(%rip), %rdi
	leaq	.LC10(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	incl	%r14d
	call	__fprintf_chk@PLT
	movq	8(%rsp), %rax
	addq	%rax, %r13
	jmp	.L17
.L28:
	movq	24(%rsp), %rdi
	call	free@PLT
	movq	16(%rsp), %rdi
	call	free@PLT
	movq	88(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L20
	call	cudaGetErrorString@PLT
	leaq	.LC4(%rip), %r9
	movl	$139, %r8d
	movq	%rax, %rcx
	jmp	.L26
.L20:
	movq	80(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L21
	call	cudaGetErrorString@PLT
	leaq	.LC4(%rip), %r9
	movl	$140, %r8d
	movq	%rax, %rcx
	jmp	.L26
.L21:
	call	cudaDeviceReset@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L22
	call	cudaGetErrorString@PLT
	leaq	.LC4(%rip), %r9
	movl	$141, %r8d
	movq	%rax, %rcx
	jmp	.L26
.L22:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	addq	$136, %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
.LC11:
	.string	"_Z8anglesumPfS_iiiff"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2056:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC11(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z8anglesumPfS_iiiff(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2056:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC2:
	.long	1031798784
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC6:
	.long	1719614413
	.long	1073127582
	.section	.rodata.cst4
	.align 4
.LC7:
	.long	-1087044365
	.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 <math.h>
#define PI 3.141592


#define CUDA_CHECK_RETURN(value) {											\
	hipError_t _m_cudaStat = value;										\
	if (_m_cudaStat != hipSuccess) {										\
		fprintf(stderr, "Error %s at line %d in file %s\n",					\
				hipGetErrorString(_m_cudaStat), __LINE__, __FILE__);		\
		exit(1);															\
	} }



__global__ void anglesum(float *sino,
		float *image,
		int nangles,
		int nrays,
		int wdI,
		float delta,
		float ini)

{
  int i, j, T, k;
  float dt, th, dth, t, cost, sint, cumsum;
  float	x;
  float y;

  i = blockDim.x * blockIdx.x + threadIdx.x;
  j = blockDim.y * blockIdx.y + threadIdx.y;

  if ((i<wdI) && (j < wdI) ){

  x = ini + i * delta;
  y = ini + j * delta;



  cumsum = 0;

  dt  = 2.0/(nrays-1);
  dth = PI/(nangles);

  for(k=0; k < nangles; k++)
    {
      th = k*dth;

      cost  = cos(th);
      sint  = sin(th);

      t = x*cost + y*sint;

      T = (int) floor((t + 1)/dt);

      if(T > -1 && T < nrays-1)
	{
	  cumsum = cumsum + (sino[nangles*(T+1) + k]-sino[nangles*T + k])*(t-(-1.0 + T*dt))/dt + sino[nangles*T + k];
	}
    }
  image[j*wdI + i] = (cumsum*dth);
}
}


int main(int argc, char *argv[]) {
	int i, j;
	float delta, ini;

	int sizeImage = atoi(argv[2]);
	int nrays     = atoi(argv[3]);
	int nangles   = atoi(argv[4]);

	FILE *fp=fopen(argv[1], "r");


	hipEvent_t start, stop;
	hipEventCreate(&start);
	hipEventCreate(&stop);
	float milliseconds = 0;

	float *dev_i = NULL;
	float *dev_s = NULL;
	float *image;
	float *sino;

	// GRID SIZE
	unsigned int gridp;
	gridp = (unsigned int) ceilf(((float)(sizeImage)/16));
	dim3 grid(gridp, gridp, 1);
	dim3 blocks(16, 16, 1);

	// MALLOC AND CUDA COPY
	image = (float *)malloc(sizeImage*sizeImage*sizeof(float));
	sino = (float *)malloc(nangles*nrays*sizeof(float));
	for (i = 0; i < nangles*nrays; i++)
		fscanf(fp, "%f", &sino[i]);


	hipEventRecord(start);
	CUDA_CHECK_RETURN(hipMalloc((void**) &dev_i, sizeof(float)*sizeImage*sizeImage));
	CUDA_CHECK_RETURN(hipMalloc((void **)&dev_s , nangles*nrays*sizeof(float) ) );
	CUDA_CHECK_RETURN(hipMemcpy (dev_s , sino , nrays*nangles*sizeof(float) , hipMemcpyHostToDevice));
	//////////////////////

	// BACK PROJECTION
	ini = -sqrt(2)/2;

	delta = (double) sqrt(2)/(sizeImage-1);

	anglesum<<<grid, blocks>>>(dev_s, dev_i, nangles, nrays, sizeImage, delta, ini);
	// BACK PROJECTION FINISHED

	// COPY RESULTS
	CUDA_CHECK_RETURN(hipGetLastError());

	CUDA_CHECK_RETURN(hipMemcpy (image , dev_i , sizeImage*sizeImage*sizeof(float) , hipMemcpyDeviceToHost) );

	hipEventRecord(stop);
	hipEventSynchronize(stop);
	hipEventElapsedTime(&milliseconds, start, stop);

	fprintf(stderr, "%f ms\n", milliseconds);

	  for(i=0; i< sizeImage; i++)
	    {
	      for(j=0; j< sizeImage; j++)
		{
		  fprintf(stdout, "%f ", image[sizeImage*(sizeImage-1-i) + j]);
		}
	      fprintf(stdout, "\n");
	    }
	  //////////////

	  // FREE MEMORY
	free(sino);
	free(image);
	CUDA_CHECK_RETURN(hipFree((void*) dev_s));
	CUDA_CHECK_RETURN(hipFree((void*) dev_i));
	CUDA_CHECK_RETURN(hipDeviceReset());

	return 0;
}

	.text
	.file	"backproj.hip"
	.globl	_Z23__device_stub__anglesumPfS_iiiff # -- Begin function _Z23__device_stub__anglesumPfS_iiiff
	.type	_Z23__device_stub__anglesumPfS_iiiff,@function
_Z23__device_stub__anglesumPfS_iiiff:   # @_Z23__device_stub__anglesumPfS_iiiff
	.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	$160, %rsp
	.cfi_def_cfa_offset 208
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	28(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	24(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	20(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	16(%rsp), %r8
	movss	%xmm0, (%r8)
	leaq	12(%rsp), %r9
	movss	%xmm1, (%r9)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	movq	%r9, 48(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	40(%rsp), %r12
	leaq	32(%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	$_Z8anglesumPfS_iiiff, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$176, %rsp
	.cfi_adjust_cfa_offset -176
	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	_Z23__device_stub__anglesumPfS_iiiff, .Lfunc_end0-_Z23__device_stub__anglesumPfS_iiiff
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI1_0:
	.long	0x3d800000                      # float 0.0625
.LCPI1_2:
	.long	0xbf3504f3                      # float -0.707106769
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI1_1:
	.quad	0x3ff6a09e667f3bcd              # double 1.4142135623730951
	.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	$72, %rsp
	.cfi_def_cfa_offset 128
	.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
	movq	16(%rsi), %rdi
	callq	atoi
	movl	%eax, %r14d
	movq	24(%rbx), %rdi
	callq	atoi
	movl	%eax, %ebp
	movq	32(%rbx), %rdi
	callq	atoi
	movl	%eax, %r15d
	movq	8(%rbx), %rdi
	movl	$.L.str, %esi
	callq	fopen
	movq	%rax, %r12
	leaq	64(%rsp), %rdi
	callq	hipEventCreate
	leaq	40(%rsp), %rdi
	callq	hipEventCreate
	movl	$0, 60(%rsp)
	xorl	%eax, %eax
	cvtsi2ss	%r14d, %xmm0
	movq	%rax, 16(%rsp)
	movq	%rax, 8(%rsp)
	mulss	.LCPI1_0(%rip), %xmm0
	callq	ceilf@PLT
	movss	%xmm0, 56(%rsp)                 # 4-byte Spill
	movl	%r14d, %r13d
	imull	%r13d, %r13d
	shlq	$2, %r13
	movq	%r13, %rdi
	callq	malloc
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	movl	%r15d, 48(%rsp)                 # 4-byte Spill
	movl	%r15d, %ebx
	movl	%ebp, 52(%rsp)                  # 4-byte Spill
	imull	%ebp, %ebx
	movslq	%ebx, %r15
	leaq	(,%r15,4), %rbp
	movq	%rbp, %rdi
	callq	malloc
	movq	%rax, 24(%rsp)                  # 8-byte Spill
	testl	%r15d, %r15d
	jle	.LBB1_3
# %bb.1:                                # %.lr.ph.preheader
	movl	%ebx, %ebx
	movq	24(%rsp), %r15                  # 8-byte Reload
.LBB1_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	$.L.str.1, %esi
	movq	%r12, %rdi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	addq	$4, %r15
	decq	%rbx
	jne	.LBB1_2
.LBB1_3:                                # %._crit_edge
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movslq	%r14d, %r12
	movq	%r12, %rsi
	imulq	%r12, %rsi
	shlq	$2, %rsi
	leaq	16(%rsp), %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB1_4
# %bb.6:
	leaq	8(%rsp), %rdi
	movq	%rbp, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB1_7
# %bb.8:
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi                  # 8-byte Reload
	movq	%rbp, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB1_9
# %bb.10:
	cvttss2si	56(%rsp), %rdi          # 4-byte Folded Reload
	movl	%edi, %eax
	shlq	$32, %rdi
	orq	%rax, %rdi
	leal	-1(%r14), %ebp
	movabsq	$68719476752, %rdx              # imm = 0x1000000010
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB1_12
# %bb.11:
	xorps	%xmm0, %xmm0
	cvtsi2sd	%ebp, %xmm0
	movsd	.LCPI1_1(%rip), %xmm1           # xmm1 = mem[0],zero
	divsd	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	cvtsd2ss	%xmm1, %xmm0
	movq	8(%rsp), %rdi
	movq	16(%rsp), %rsi
	movss	.LCPI1_2(%rip), %xmm1           # xmm1 = mem[0],zero,zero,zero
	movl	48(%rsp), %edx                  # 4-byte Reload
	movl	52(%rsp), %ecx                  # 4-byte Reload
	movl	%r14d, %r8d
	callq	_Z23__device_stub__anglesumPfS_iiiff
.LBB1_12:
	callq	hipGetLastError
	testl	%eax, %eax
	jne	.LBB1_13
# %bb.14:
	movq	16(%rsp), %rsi
	movq	32(%rsp), %rdi                  # 8-byte Reload
	movq	%r13, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB1_15
# %bb.16:
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	40(%rsp), %rdi
	callq	hipEventSynchronize
	movq	64(%rsp), %rsi
	movq	40(%rsp), %rdx
	leaq	60(%rsp), %r15
	movq	%r15, %rdi
	callq	hipEventElapsedTime
	movq	stderr(%rip), %rdi
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r15), %xmm0
	movl	$.L.str.4, %esi
	movb	$1, %al
	callq	fprintf
	testl	%r14d, %r14d
	jle	.LBB1_21
# %bb.17:                               # %.preheader.lr.ph
	movl	%ebp, %eax
	movl	%r14d, %r14d
	imulq	%r12, %rax
	movq	32(%rsp), %rcx                  # 8-byte Reload
	leaq	(%rcx,%rax,4), %r15
	shlq	$2, %r12
	negq	%r12
	xorl	%r13d, %r13d
.LBB1_18:                               # %.lr.ph90
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_19 Depth 2
	xorl	%ebx, %ebx
.LBB1_19:                               #   Parent Loop BB1_18 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	stdout(%rip), %rdi
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r15,%rbx,4), %xmm0
	movl	$.L.str.5, %esi
	movb	$1, %al
	callq	fprintf
	incq	%rbx
	cmpq	%rbx, %r14
	jne	.LBB1_19
# %bb.20:                               # %._crit_edge91
                                        #   in Loop: Header=BB1_18 Depth=1
	movq	stdout(%rip), %rsi
	movl	$10, %edi
	callq	fputc@PLT
	incq	%r13
	addq	%r12, %r15
	cmpq	%r14, %r13
	jne	.LBB1_18
.LBB1_21:                               # %._crit_edge93
	movq	24(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	32(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	8(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB1_22
# %bb.23:
	movq	16(%rsp), %rdi
	callq	hipFree
	testl	%eax, %eax
	jne	.LBB1_24
# %bb.25:
	callq	hipDeviceReset
	testl	%eax, %eax
	jne	.LBB1_26
# %bb.27:
	xorl	%eax, %eax
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB1_4:
	.cfi_def_cfa_offset 128
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.2, %esi
	movl	$.L.str.3, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$104, %ecx
	jmp	.LBB1_5
.LBB1_7:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.2, %esi
	movl	$.L.str.3, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$105, %ecx
	jmp	.LBB1_5
.LBB1_9:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.2, %esi
	movl	$.L.str.3, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$106, %ecx
	jmp	.LBB1_5
.LBB1_13:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.2, %esi
	movl	$.L.str.3, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$118, %ecx
	jmp	.LBB1_5
.LBB1_15:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.2, %esi
	movl	$.L.str.3, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$120, %ecx
.LBB1_5:
	xorl	%eax, %eax
	callq	fprintf
	movl	$1, %edi
	callq	exit
.LBB1_22:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.2, %esi
	movl	$.L.str.3, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$141, %ecx
	jmp	.LBB1_5
.LBB1_24:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.2, %esi
	movl	$.L.str.3, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$142, %ecx
	jmp	.LBB1_5
.LBB1_26:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.2, %esi
	movl	$.L.str.3, %r8d
	movq	%rbx, %rdi
	movq	%rax, %rdx
	movl	$143, %ecx
	jmp	.LBB1_5
.Lfunc_end1:
	.size	main, .Lfunc_end1-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:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB2_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB2_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z8anglesumPfS_iiiff, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end2:
	.size	__hip_module_ctor, .Lfunc_end2-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB3_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB3_2:
	retq
.Lfunc_end3:
	.size	__hip_module_dtor, .Lfunc_end3-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z8anglesumPfS_iiiff,@object    # @_Z8anglesumPfS_iiiff
	.section	.rodata,"a",@progbits
	.globl	_Z8anglesumPfS_iiiff
	.p2align	3, 0x0
_Z8anglesumPfS_iiiff:
	.quad	_Z23__device_stub__anglesumPfS_iiiff
	.size	_Z8anglesumPfS_iiiff, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"r"
	.size	.L.str, 2

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"%f"
	.size	.L.str.1, 3

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Error %s at line %d in file %s\n"
	.size	.L.str.2, 32

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/cerqueirajc/cu-ra-bp/master/src/tomo-cuda/backprojection/backproj.hip"
	.size	.L.str.3, 132

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"%f ms\n"
	.size	.L.str.4, 7

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"%f "
	.size	.L.str.5, 4

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z8anglesumPfS_iiiff"
	.size	.L__unnamed_1, 21

	.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 _Z23__device_stub__anglesumPfS_iiiff
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z8anglesumPfS_iiiff
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z8anglesumPfS_iiiff    ; -- Begin function _Z8anglesumPfS_iiiff
	.globl	_Z8anglesumPfS_iiiff
	.p2align	8
	.type	_Z8anglesumPfS_iiiff,@function
_Z8anglesumPfS_iiiff:                   ; @_Z8anglesumPfS_iiiff
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x34
	s_load_b128 s[4:7], s[0:1], 0x10
	v_and_b32_e32 v2, 0x3ff, v0
	v_bfe_u32 v3, 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) | instid1(SALU_CYCLE_1)
	v_mad_u64_u32 v[0:1], null, s14, s2, v[2:3]
	v_mad_u64_u32 v[1:2], null, s15, s3, v[3:4]
	s_mov_b32 s2, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_max_i32_e32 v2, v0, v1
	v_cmpx_gt_i32_e64 s6, v2
	s_cbranch_execz .LBB0_17
; %bb.1:
	v_cvt_f64_i32_e32 v[2:3], s4
	s_mov_b32 s2, 0xfc8b007a
	s_mov_b32 s3, 0x400921fa
	s_cmp_lt_i32 s4, 1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_scale_f64 v[4:5], null, v[2:3], v[2:3], s[2:3]
	v_rcp_f64_e32 v[6:7], v[4:5]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]
	v_fma_f64 v[8:9], -v[4:5], v[6:7], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fma_f64 v[6:7], v[6:7], v[8:9], v[6:7]
	v_div_scale_f64 v[8:9], vcc_lo, s[2:3], v[2:3], s[2:3]
	v_mul_f64 v[10:11], v[8:9], v[6:7]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[4:5], -v[4:5], v[10:11], v[8:9]
	v_div_fmas_f64 v[4:5], v[4:5], v[6:7], v[10:11]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_div_fixup_f64 v[2:3], v[4:5], v[2:3], s[2:3]
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x20
	s_load_b128 s[8:11], s[0:1], 0x0
	v_cvt_f32_f64_e32 v4, v[2:3]
	s_cbranch_scc1 .LBB0_15
; %bb.2:                                ; %.lr.ph
	s_add_i32 s1, s5, -1
	s_mov_b32 s3, 0xb94c1982
	v_cvt_f64_i32_e32 v[2:3], s1
	s_mov_b32 s5, 0x37d75334
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_scale_f64 v[5:6], null, v[2:3], v[2:3], 2.0
	v_rcp_f64_e32 v[7:8], v[5:6]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[9:10], -v[5:6], v[7:8], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[7:8], v[7:8], v[9:10], v[7:8]
	v_fma_f64 v[9:10], -v[5:6], v[7:8], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_fma_f64 v[7:8], v[7:8], v[9:10], v[7:8]
	v_div_scale_f64 v[9:10], vcc_lo, 2.0, v[2:3], 2.0
	v_mul_f64 v[11:12], v[9:10], v[7:8]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[5:6], -v[5:6], v[11:12], v[9:10]
	v_div_fmas_f64 v[5:6], v[5:6], v[7:8], v[11:12]
	v_cvt_f32_i32_e32 v8, v1
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_fma_f32 v8, v8, s7, s2
	v_div_fixup_f64 v[2:3], v[5:6], v[2:3], 2.0
	v_cvt_f32_i32_e32 v5, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_4)
	v_fma_f32 v7, v5, s7, s2
	v_mov_b32_e32 v5, 0
	s_mov_b32 s2, 0
	v_cvt_f32_f64_e32 v6, v[2:3]
	s_delay_alu instid0(VALU_DEP_1)
	v_cvt_f64_f32_e32 v[2:3], v6
.LBB0_3:                                ; =>This Inner Loop Header: Depth=1
	v_cvt_f32_i32_e32 v9, s2
	s_mov_b32 s13, -1
                                        ; implicit-def: $sgpr12
                                        ; implicit-def: $vgpr10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f32_e32 v9, v4, v9
	v_readfirstlane_b32 s0, v9
	v_cmp_ngt_f32_e64 s7, 0x48000000, |v9|
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_bitset0_b32 s0, 31
	s_and_b32 vcc_lo, exec_lo, s7
	s_cbranch_vccz .LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	s_and_b32 s12, s0, 0x7fffff
	s_lshr_b32 s13, s0, 23
	s_bitset1_b32 s12, 23
	s_addk_i32 s13, 0xff88
	s_mul_hi_u32 s14, s12, 0xfe5163ab
	s_mul_i32 s15, s12, 0x3c439041
	s_mul_hi_u32 s16, s12, 0x3c439041
	s_add_u32 s14, s14, s15
	s_addc_u32 s15, 0, s16
	s_mul_i32 s16, s12, 0xdb629599
	s_mul_hi_u32 s17, s12, 0xdb629599
	s_add_u32 s15, s15, s16
	s_addc_u32 s16, 0, s17
	s_mul_i32 s17, s12, 0xf534ddc0
	s_mul_hi_u32 s18, s12, 0xf534ddc0
	s_add_u32 s16, s16, s17
	s_addc_u32 s17, 0, s18
	s_mul_i32 s18, s12, 0xfc2757d1
	s_mul_hi_u32 s19, s12, 0xfc2757d1
	s_add_u32 s17, s17, s18
	s_addc_u32 s18, 0, s19
	s_mul_i32 s19, s12, 0x4e441529
	s_mul_hi_u32 s20, s12, 0x4e441529
	s_add_u32 s18, s18, s19
	s_addc_u32 s19, 0, s20
	s_cmp_gt_u32 s13, 63
	s_mul_i32 s20, s12, 0xfe5163ab
	s_mul_hi_u32 s21, s12, 0xa2f9836e
	s_mul_i32 s12, s12, 0xa2f9836e
	s_cselect_b32 s22, s15, s17
	s_cselect_b32 s14, s14, s16
	s_cselect_b32 s15, s20, s15
	s_add_u32 s12, s19, s12
	s_addc_u32 s19, 0, s21
	s_cmp_gt_u32 s13, 63
	s_cselect_b32 s20, 0xffffffc0, 0
	s_cselect_b32 s16, s16, s18
	s_cselect_b32 s12, s17, s12
	s_cselect_b32 s17, s18, s19
	s_add_i32 s20, s20, s13
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_gt_u32 s20, 31
	s_cselect_b32 s13, 0xffffffe0, 0
	s_cselect_b32 s18, s16, s12
	s_cselect_b32 s12, s12, s17
	s_cselect_b32 s16, s22, s16
	s_cselect_b32 s17, s14, s22
	s_cselect_b32 s14, s15, s14
	s_add_i32 s13, s13, s20
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_gt_u32 s13, 31
	s_cselect_b32 s15, 0xffffffe0, 0
	s_cselect_b32 s12, s18, s12
	s_cselect_b32 s18, s16, s18
	s_cselect_b32 s16, s17, s16
	s_cselect_b32 s14, s14, s17
	s_add_i32 s15, s15, s13
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	s_sub_i32 s13, 32, s15
	s_cmp_eq_u32 s15, 0
	v_mov_b32_e32 v10, s13
	s_cselect_b32 s15, -1, 0
	v_alignbit_b32 v11, s12, s18, v10
	v_alignbit_b32 v12, s18, s16, v10
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_readfirstlane_b32 s13, v11
	v_cndmask_b32_e64 v11, v12, s18, s15
	s_delay_alu instid0(VALU_DEP_2)
	s_cselect_b32 s12, s12, s13
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_alignbit_b32 v12, s12, v11, 30
	s_bfe_u32 s13, s12, 0x1001d
	s_delay_alu instid0(SALU_CYCLE_1)
	s_sub_i32 s17, 0, s13
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_xor_b32_e32 v12, s17, v12
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_clz_i32_u32_e32 v13, v12
	v_min_u32_e32 v13, 32, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_lshlrev_b32_e32 v15, 23, v13
	v_alignbit_b32 v10, s16, s14, v10
	v_sub_nc_u32_e32 v14, 31, v13
	v_cndmask_b32_e64 v10, v10, s16, s15
	s_delay_alu instid0(VALU_DEP_1)
	v_alignbit_b32 v11, v11, v10, 30
	v_alignbit_b32 v10, v10, s14, 30
	s_lshr_b32 s14, s12, 29
	s_lshr_b32 s12, s12, 30
	s_lshl_b32 s14, s14, 31
	v_xor_b32_e32 v11, s17, v11
	v_xor_b32_e32 v10, s17, v10
	s_or_b32 s15, s14, 0.5
	s_add_i32 s12, s13, s12
	v_sub_nc_u32_e32 v15, s15, v15
	v_alignbit_b32 v12, v12, v11, v14
	v_alignbit_b32 v10, v11, v10, v14
	s_mov_b32 s13, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_alignbit_b32 v11, v12, v10, 9
	v_lshrrev_b32_e32 v12, 9, v12
	v_clz_i32_u32_e32 v14, v11
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_min_u32_e32 v14, 32, v14
	v_sub_nc_u32_e32 v16, 31, v14
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_alignbit_b32 v10, v11, v10, v16
	v_or_b32_e32 v11, v12, v15
	v_add_nc_u32_e32 v13, v14, v13
	v_lshrrev_b32_e32 v10, 9, v10
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_mul_f32 v13, 0x3fc90fda, v11 :: v_dual_lshlrev_b32 v12, 23, v13
	v_sub_nc_u32_e32 v10, v10, v12
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v12, 0x3fc90fda, v11, -v13
	v_add_nc_u32_e32 v10, 0x33000000, v10
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fmac_f32_e32 v12, 0x33a22168, v11
	v_or_b32_e32 v10, s14, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v12, 0x3fc90fda, v10
	v_add_f32_e32 v10, v13, v12
.LBB0_5:                                ; %Flow94
                                        ;   in Loop: Header=BB0_3 Depth=1
	v_mov_b32_e32 v11, s12
	v_mul_f32_e64 v12, 0x3f22f983, |v9|
	s_and_not1_b32 vcc_lo, exec_lo, s13
	s_cbranch_vccnz .LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_rndne_f32_e32 v11, v12
	v_fma_f32 v10, 0xbfc90fda, v11, |v9|
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v10, 0xb3a22168, v11
	v_fmac_f32_e32 v10, 0xa7c234c4, v11
	v_cvt_i32_f32_e32 v11, v11
.LBB0_7:                                ; %_ZL3cosf.exit
                                        ;   in Loop: Header=BB0_3 Depth=1
	s_and_b32 vcc_lo, exec_lo, s7
	s_cbranch_vccz .LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_3 Depth=1
	s_and_b32 s7, s0, 0x7fffff
	s_lshr_b32 s12, s0, 23
	s_bitset1_b32 s7, 23
	s_addk_i32 s12, 0xff88
	s_mul_hi_u32 s13, s7, 0xfe5163ab
	s_mul_i32 s14, s7, 0x3c439041
	s_mul_hi_u32 s15, s7, 0x3c439041
	s_add_u32 s13, s13, s14
	s_addc_u32 s14, 0, s15
	s_mul_i32 s15, s7, 0xdb629599
	s_mul_hi_u32 s16, s7, 0xdb629599
	s_add_u32 s14, s14, s15
	s_addc_u32 s15, 0, s16
	s_mul_i32 s16, s7, 0xf534ddc0
	s_mul_hi_u32 s17, s7, 0xf534ddc0
	s_add_u32 s15, s15, s16
	s_addc_u32 s16, 0, s17
	s_mul_i32 s17, s7, 0xfc2757d1
	s_mul_hi_u32 s18, s7, 0xfc2757d1
	s_add_u32 s16, s16, s17
	s_addc_u32 s17, 0, s18
	s_mul_i32 s18, s7, 0x4e441529
	s_mul_hi_u32 s19, s7, 0x4e441529
	s_add_u32 s17, s17, s18
	s_addc_u32 s18, 0, s19
	s_cmp_gt_u32 s12, 63
	s_mul_i32 s19, s7, 0xfe5163ab
	s_mul_hi_u32 s20, s7, 0xa2f9836e
	s_mul_i32 s7, s7, 0xa2f9836e
	s_cselect_b32 s21, s14, s16
	s_cselect_b32 s13, s13, s15
	s_cselect_b32 s14, s19, s14
	s_add_u32 s7, s18, s7
	s_addc_u32 s18, 0, s20
	s_cmp_gt_u32 s12, 63
	s_cselect_b32 s19, 0xffffffc0, 0
	s_cselect_b32 s15, s15, s17
	s_cselect_b32 s7, s16, s7
	s_cselect_b32 s16, s17, s18
	s_add_i32 s19, s19, s12
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_gt_u32 s19, 31
	s_cselect_b32 s12, 0xffffffe0, 0
	s_cselect_b32 s17, s15, s7
	s_cselect_b32 s7, s7, s16
	s_cselect_b32 s15, s21, s15
	s_cselect_b32 s16, s13, s21
	s_cselect_b32 s13, s14, s13
	s_add_i32 s12, s12, s19
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_gt_u32 s12, 31
	s_cselect_b32 s14, 0xffffffe0, 0
	s_cselect_b32 s7, s17, s7
	s_cselect_b32 s17, s15, s17
	s_cselect_b32 s15, s16, s15
	s_cselect_b32 s13, s13, s16
	s_add_i32 s14, s14, s12
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	s_sub_i32 s12, 32, s14
	s_cmp_eq_u32 s14, 0
	v_mov_b32_e32 v13, s12
	s_cselect_b32 s14, -1, 0
	v_alignbit_b32 v14, s7, s17, v13
	v_alignbit_b32 v15, s17, s15, v13
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_readfirstlane_b32 s12, v14
	v_cndmask_b32_e64 v14, v15, s17, s14
	s_delay_alu instid0(VALU_DEP_2)
	s_cselect_b32 s7, s7, s12
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_alignbit_b32 v15, s7, v14, 30
	s_bfe_u32 s12, s7, 0x1001d
	s_delay_alu instid0(SALU_CYCLE_1)
	s_sub_i32 s16, 0, s12
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_xor_b32_e32 v15, s16, v15
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_clz_i32_u32_e32 v16, v15
	v_min_u32_e32 v16, 32, v16
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_lshlrev_b32_e32 v18, 23, v16
	v_alignbit_b32 v13, s15, s13, v13
	v_sub_nc_u32_e32 v17, 31, v16
	v_cndmask_b32_e64 v13, v13, s15, s14
	s_delay_alu instid0(VALU_DEP_1)
	v_alignbit_b32 v14, v14, v13, 30
	v_alignbit_b32 v13, v13, s13, 30
	s_lshr_b32 s13, s7, 29
	s_lshr_b32 s7, s7, 30
	s_lshl_b32 s13, s13, 31
	v_xor_b32_e32 v14, s16, v14
	v_xor_b32_e32 v13, s16, v13
	s_or_b32 s14, s13, 0.5
	s_add_i32 s12, s12, s7
	v_sub_nc_u32_e32 v18, s14, v18
	v_alignbit_b32 v15, v15, v14, v17
	v_alignbit_b32 v13, v14, v13, v17
	s_mov_b32 s7, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_alignbit_b32 v14, v15, v13, 9
	v_lshrrev_b32_e32 v15, 9, v15
	v_clz_i32_u32_e32 v17, v14
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_min_u32_e32 v17, 32, v17
	v_sub_nc_u32_e32 v19, 31, v17
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_alignbit_b32 v13, v14, v13, v19
	v_or_b32_e32 v14, v15, v18
	v_add_nc_u32_e32 v16, v17, v16
	v_lshrrev_b32_e32 v13, 9, v13
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_mul_f32 v16, 0x3fc90fda, v14 :: v_dual_lshlrev_b32 v15, 23, v16
	v_sub_nc_u32_e32 v13, v13, v15
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v15, 0x3fc90fda, v14, -v16
	v_add_nc_u32_e32 v13, 0x33000000, v13
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fmac_f32_e32 v15, 0x33a22168, v14
	v_or_b32_e32 v13, s13, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v15, 0x3fc90fda, v13
	v_add_f32_e32 v13, v16, v15
	s_branch .LBB0_10
.LBB0_9:                                ;   in Loop: Header=BB0_3 Depth=1
	s_mov_b32 s7, -1
                                        ; implicit-def: $sgpr12
                                        ; implicit-def: $vgpr13
.LBB0_10:                               ; %Flow
                                        ;   in Loop: Header=BB0_3 Depth=1
	v_mov_b32_e32 v14, s12
	s_and_not1_b32 vcc_lo, exec_lo, s7
	s_cbranch_vccnz .LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_3 Depth=1
	v_rndne_f32_e32 v12, v12
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_fma_f32 v13, 0xbfc90fda, v12, |v9|
	v_cvt_i32_f32_e32 v14, v12
	v_fmac_f32_e32 v13, 0xb3a22168, v12
	s_delay_alu instid0(VALU_DEP_1)
	v_fmac_f32_e32 v13, 0xa7c234c4, v12
.LBB0_12:                               ; %_ZL3sinf.exit
                                        ;   in Loop: Header=BB0_3 Depth=1
	v_dual_mul_f32 v12, v10, v10 :: v_dual_and_b32 v15, 1, v11
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_dual_mul_f32 v16, v13, v13 :: v_dual_lshlrev_b32 v11, 30, v11
	v_xor_b32_e32 v22, s0, v9
	v_fmaak_f32 v17, s3, v12, 0x3c0881c4
	v_dual_fmaak_f32 v18, s5, v12, 0xbab64f3b :: v_dual_and_b32 v19, 1, v14
	v_lshlrev_b32_e32 v14, 30, v14
	v_cmp_eq_u32_e32 vcc_lo, 0, v15
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_fmaak_f32 v17, v12, v17, 0xbe2aaa9d
	v_fmaak_f32 v20, s3, v16, 0x3c0881c4
	v_and_b32_e32 v11, 0x80000000, v11
	v_mul_f32_e32 v17, v12, v17
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fmaak_f32 v20, v16, v20, 0xbe2aaa9d
	v_dual_fmaak_f32 v21, s5, v16, 0xbab64f3b :: v_dual_fmac_f32 v10, v10, v17
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_mul_f32_e32 v20, v16, v20
	v_fmaak_f32 v18, v12, v18, 0x3d2aabf7
	v_fmaak_f32 v21, v16, v21, 0x3d2aabf7
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_dual_fmac_f32 v13, v13, v20 :: v_dual_fmaak_f32 v18, v12, v18, 0xbf000004
	v_fmaak_f32 v21, v16, v21, 0xbf000004
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v12, v12, v18, 1.0
	v_fma_f32 v16, v16, v21, 1.0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v10, -v10, v12, vcc_lo
	v_cmp_eq_u32_e32 vcc_lo, 0, v19
	v_and_b32_e32 v14, 0x80000000, v14
	v_xor_b32_e32 v10, v11, v10
	v_cndmask_b32_e32 v13, v16, v13, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_xor_b32_e32 v12, v22, v14
	v_cmp_class_f32_e64 vcc_lo, v9, 0x1f8
	v_xor_b32_e32 v11, v12, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v9, 0x7fc00000, v11, vcc_lo
	v_dual_cndmask_b32 v10, 0x7fc00000, v10 :: v_dual_mul_f32 v9, v8, v9
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v9, v7, v10
	v_add_f32_e32 v10, 1.0, v9
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_scale_f32 v11, null, v6, v6, v10
	v_div_scale_f32 v14, vcc_lo, v10, v6, v10
	v_rcp_f32_e32 v12, v11
	s_waitcnt_depctr 0xfff
	v_fma_f32 v13, -v11, v12, 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v12, v13, v12
	v_mul_f32_e32 v13, v14, v12
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v15, -v11, v13, v14
	v_fmac_f32_e32 v13, v15, v12
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v11, -v11, v13, v14
	v_div_fmas_f32 v11, v11, v12, v13
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fixup_f32 v10, v11, v6, v10
	v_floor_f32_e32 v10, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_i32_f32_e32 v10, v10
	v_cmp_lt_i32_e32 vcc_lo, -1, v10
	v_cmp_gt_i32_e64 s0, s1, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s7, vcc_lo, s0
	s_and_saveexec_b32 s0, s7
	s_cbranch_execz .LBB0_14
; %bb.13:                               ;   in Loop: Header=BB0_3 Depth=1
	v_mul_lo_u32 v12, v10, s4
	v_cvt_f32_i32_e32 v10, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_mul_f32_e32 v10, v6, v10
	v_add3_u32 v11, s2, s4, v12
	v_add_nc_u32_e32 v13, s2, v12
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v12, 31, v11
	v_ashrrev_i32_e32 v14, 31, v13
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[11:12], 2, v[11:12]
	v_lshlrev_b64 v[13:14], 2, v[13:14]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v11, vcc_lo, s8, v11
	v_add_co_ci_u32_e32 v12, vcc_lo, s9, v12, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v13, vcc_lo, s8, v13
	v_add_co_ci_u32_e32 v14, vcc_lo, s9, v14, vcc_lo
	s_clause 0x1
	global_load_b32 v15, v[11:12], off
	global_load_b32 v19, v[13:14], off
	v_cvt_f64_f32_e32 v[10:11], v10
	v_cvt_f64_f32_e32 v[12:13], v9
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[9:10], v[10:11], -1.0
	v_add_f64 v[9:10], v[12:13], -v[9:10]
	s_waitcnt vmcnt(0)
	v_sub_f32_e32 v11, v15, v19
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_f64_f32_e32 v[11:12], v11
	v_mul_f64 v[9:10], v[9:10], v[11:12]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_scale_f64 v[11:12], null, v[2:3], v[2:3], v[9:10]
	v_div_scale_f64 v[17:18], vcc_lo, v[9:10], v[2:3], v[9:10]
	v_rcp_f64_e32 v[13:14], v[11:12]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[15:16], -v[11:12], v[13:14], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[13:14], v[13:14], v[15:16], v[13:14]
	v_fma_f64 v[15:16], -v[11:12], v[13:14], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[13:14], v[13:14], v[15:16], v[13:14]
	v_mul_f64 v[15:16], v[17:18], v[13:14]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[11:12], -v[11:12], v[15:16], v[17:18]
	v_div_fmas_f64 v[11:12], v[11:12], v[13:14], v[15:16]
	v_cvt_f64_f32_e32 v[13:14], v5
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_fixup_f64 v[9:10], v[11:12], v[2:3], v[9:10]
	v_cvt_f64_f32_e32 v[11:12], v19
	v_add_f64 v[9:10], v[9:10], v[13:14]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f64 v[9:10], v[9:10], v[11:12]
	v_cvt_f32_f64_e32 v5, v[9:10]
.LBB0_14:                               ;   in Loop: Header=BB0_3 Depth=1
	s_or_b32 exec_lo, exec_lo, s0
	s_add_i32 s2, s2, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_lg_u32 s4, s2
	s_cbranch_scc1 .LBB0_3
	s_branch .LBB0_16
.LBB0_15:
	v_mov_b32_e32 v5, 0
.LBB0_16:                               ; %._crit_edge
	v_mad_u64_u32 v[2:3], null, v1, s6, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[0:1], 2, v[2:3]
	s_delay_alu instid0(VALU_DEP_4) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mul_f32_e32 v2, v5, v4
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s10, v0
	s_delay_alu instid0(VALU_DEP_3)
	v_add_co_ci_u32_e32 v1, vcc_lo, s11, v1, vcc_lo
	global_store_b32 v[0:1], v2, off
.LBB0_17:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z8anglesumPfS_iiiff
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.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 23
		.amdhsa_next_free_sgpr 23
		.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	_Z8anglesumPfS_iiiff, .Lfunc_end0-_Z8anglesumPfS_iiiff
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 2720
; NumSgprs: 25
; NumVgprs: 23
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 3
; VGPRBlocks: 2
; NumSGPRsForWavesPerEU: 25
; NumVGPRsForWavesPerEU: 23
; 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:     by_value
      - .offset:         20
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z8anglesumPfS_iiiff
    .private_segment_fixed_size: 0
    .sgpr_count:     25
    .sgpr_spill_count: 0
    .symbol:         _Z8anglesumPfS_iiiff.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     23
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
