/*
	Cource - "Разработка приложений на CUDA "
  	Task 1:
  		Выделить на GPU массив arr из 10^9 элементов типа 
  		float и инициализировать его с помощью ядра следующим образом: 
  		arr[i] = sin((i%360)*Pi/180). Скопировать массив в память центрального 
  		процессора и посчитать ошибку err = sum_i(abs(sin((i%360)*Pi/180) 
  		- arr[i]))/10^9. Провести исследование зависимости результата от использования 
  		функций: sin, sinf, __sin. Объяснить результат. Проверить результат 
  		при использовании массива типа double.
  	Written by Pavel Santaev
*/

#include <stdio.h>
#include <unistd.h> 
#include <math.h>

typedef double arrType;

__global__ void calcSin(arrType * a, size_t len){
	unsigned int index = blockIdx.x * blockDim.x + threadIdx.x;
	unsigned int i = index;
	size_t threadsCount = blockDim.x * gridDim.x;
	while (i < len){
		double value = ((arrType)(i % 360)) * M_PI / 180;
		a[i] = __sinf(value);
		i = i + threadsCount;
	}
}

double calcErr(arrType * arr, size_t len){
	double sum = 0;
	for (int i = 0; i < len; i++){
		sum += abs(sin((i % 360) * M_PI / 180) - arr[i]);
	}
	return sum / len;
}

int main(){
	size_t N = 1000 * 1000 * 100;
	size_t size = sizeof(arrType) * N;
	arrType * ptr;
	cudaError_t error;

	int deviceCount = 0;
	error = cudaGetDeviceCount(&deviceCount);
	if (cudaSuccess != error){
    	printf("Error in cudaGetDeviceCount: %s\n", cudaGetErrorString(error));
    	return 0;
    }
	printf("cudaGetDeviceCount = %x\n", deviceCount);

	int deviceID = 1;
	cudaDeviceProp devProp;
    error = cudaGetDeviceProperties(&devProp, deviceID);
    if (cudaSuccess != error){
    	printf("Error in cudaGetDeviceProperties: %d\n", cudaGetErrorString(error));
    	return 0;
    }
    printf ( "Device %d\n", 0 );
    printf ( "Compute capability     : %d.%d\n", devProp.major, devProp.minor );
    printf ( "Name                   : %s\n", devProp.name );
    printf ( "Total Global Memory    : %d\n", devProp.totalGlobalMem );
    printf ( "Shared memory per block: %d\n", devProp.sharedMemPerBlock );
    printf ( "Registers per block    : %d\n", devProp.regsPerBlock );
    printf ( "Warp size              : %d\n", devProp.warpSize );
    printf ( "Max threads per block  : %d\n", devProp.maxThreadsPerBlock );
    printf ( "Total constant memory  : %d\n", devProp.totalConstMem );
    printf ( "Max Grid Size  : %d %d %d\n", devProp.maxGridSize[0], devProp.maxGridSize[1], devProp.maxGridSize[2]);
    printf ( "Max Threads Dim  : %d %d %d\n", devProp.maxThreadsDim[0], devProp.maxThreadsDim[1], devProp.maxThreadsDim[2]);

	cudaSetDevice(deviceID);

	

	printf("sizeof size_t %d \n", sizeof(size_t));
	printf("sizeof type %d \n", sizeof(arrType));
	printf("allocating %u memory\n", size);
	cudaMalloc(&ptr, size);
	dim3 threads = dim3(devProp.maxThreadsPerBlock, 1);
    dim3 blocks  = dim3(128, 1);
	calcSin<<<blocks, threads>>>(ptr, N);

	int i = 0;
	arrType * hostPtr;
	hostPtr = (arrType *)malloc(size);

	cudaMemcpy(hostPtr, ptr, size, cudaMemcpyDeviceToHost);

	for (i = 0; i < 10; i++){
		printf("%f ", hostPtr[i]);
	}

	printf("\nerror = %0.10f ", calcErr(hostPtr, N));

	cudaFree(ptr);
	free(hostPtr);
	printf("\nfinished\n");
}


	.file	"tmpxft_002870a7_00000000-6_main.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2044:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2044:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z7calcErrPdm
	.type	_Z7calcErrPdm, @function
_Z7calcErrPdm:
.LFB2040:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	xorps	%xmm1, %xmm1
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	$360, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	xorl	%ebx, %ebx
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
.L3:
	movl	%ebx, %eax
	cmpq	%r12, %rbx
	je	.L7
	cltd
	movsd	%xmm1, 8(%rsp)
	idivl	%ebp
	cvtsi2sdl	%edx, %xmm0
	mulsd	.LC1(%rip), %xmm0
	divsd	.LC2(%rip), %xmm0
	call	sin@PLT
	movsd	8(%rsp), %xmm1
	subsd	0(%r13,%rbx,8), %xmm0
	andps	.LC3(%rip), %xmm0
	incq	%rbx
	addsd	%xmm0, %xmm1
	jmp	.L3
.L7:
	cvtsi2sdq	%rbx, %xmm0
	addq	$24, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	divsd	%xmm0, %xmm1
	movaps	%xmm1, %xmm0
	ret
	.cfi_endproc
.LFE2040:
	.size	_Z7calcErrPdm, .-_Z7calcErrPdm
	.globl	_Z27__device_stub__Z7calcSinPdmPdm
	.type	_Z27__device_stub__Z7calcSinPdmPdm, @function
_Z27__device_stub__Z7calcSinPdmPdm:
.LFB2066:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	32(%rsp), %rcx
	leaq	24(%rsp), %rdx
	movq	%rsi, (%rsp)
	leaq	40(%rsp), %rdi
	leaq	52(%rsp), %rsi
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 48(%rsp)
	movq	%rax, 88(%rsp)
	movq	%rsp, %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 40(%rsp)
	movq	%rax, 52(%rsp)
	movl	$1, 60(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L8
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z7calcSinPdm(%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
.LFE2066:
	.size	_Z27__device_stub__Z7calcSinPdmPdm, .-_Z27__device_stub__Z7calcSinPdmPdm
	.globl	_Z7calcSinPdm
	.type	_Z7calcSinPdm, @function
_Z7calcSinPdm:
.LFB2067:
	.cfi_startproc
	endbr64
	jmp	_Z27__device_stub__Z7calcSinPdmPdm
	.cfi_endproc
.LFE2067:
	.size	_Z7calcSinPdm, .-_Z7calcSinPdm
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC4:
	.string	"Error in cudaGetDeviceCount: %s\n"
.LC5:
	.string	"cudaGetDeviceCount = %x\n"
.LC6:
	.string	"Error in cudaGetDeviceProperties: %d\n"
.LC7:
	.string	"Device %d\n"
.LC8:
	.string	"Compute capability     : %d.%d\n"
.LC9:
	.string	"Name                   : %s\n"
.LC10:
	.string	"Total Global Memory    : %d\n"
.LC11:
	.string	"Shared memory per block: %d\n"
.LC12:
	.string	"Registers per block    : %d\n"
.LC13:
	.string	"Warp size              : %d\n"
.LC14:
	.string	"Max threads per block  : %d\n"
.LC15:
	.string	"Total constant memory  : %d\n"
.LC16:
	.string	"Max Grid Size  : %d %d %d\n"
.LC17:
	.string	"Max Threads Dim  : %d %d %d\n"
.LC18:
	.string	"sizeof size_t %d \n"
.LC19:
	.string	"sizeof type %d \n"
.LC20:
	.string	"allocating %u memory\n"
.LC21:
	.string	"%f "
.LC22:
	.string	"\nerror = %0.10f "
.LC23:
	.string	"\nfinished\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2041:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$1088, %rsp
	.cfi_def_cfa_offset 1120
	movq	%fs:40, %rax
	movq	%rax, 1080(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdi
	xorl	%eax, %eax
	movl	%eax, 12(%rsp)
	call	cudaGetDeviceCount@PLT
	testl	%eax, %eax
	je	.L14
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	leaq	.LC4(%rip), %rsi
	movq	%rax, %rdx
	jmp	.L22
.L14:
	movl	12(%rsp), %edx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	48(%rsp), %rbx
	leaq	.LC5(%rip), %rsi
	call	__printf_chk@PLT
	movq	%rbx, %rdi
	movl	$1, %esi
	call	cudaGetDeviceProperties_v2@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L16
	call	cudaGetErrorString@PLT
	leaq	.LC6(%rip), %rsi
	movq	%rax, %rdx
.L22:
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L15
.L16:
	xorl	%edx, %edx
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	412(%rsp), %ecx
	movl	$2, %edi
	xorl	%eax, %eax
	movl	408(%rsp), %edx
	leaq	.LC8(%rip), %rsi
	call	__printf_chk@PLT
	movq	%rbx, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC9(%rip), %rsi
	call	__printf_chk@PLT
	movq	336(%rsp), %rdx
	leaq	.LC10(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	344(%rsp), %rdx
	leaq	.LC11(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	352(%rsp), %edx
	leaq	.LC12(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	356(%rsp), %edx
	leaq	.LC13(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	368(%rsp), %edx
	leaq	.LC14(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	400(%rsp), %rdx
	leaq	.LC15(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	392(%rsp), %r8d
	xorl	%eax, %eax
	movl	388(%rsp), %ecx
	movl	384(%rsp), %edx
	leaq	.LC16(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	380(%rsp), %r8d
	xorl	%eax, %eax
	movl	376(%rsp), %ecx
	movl	372(%rsp), %edx
	leaq	.LC17(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	$1, %edi
	call	cudaSetDevice@PLT
	movl	$8, %edx
	leaq	.LC18(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	$8, %edx
	leaq	.LC19(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	$800000000, %edx
	leaq	.LC20(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	16(%rsp), %rdi
	movl	$800000000, %esi
	call	cudaMalloc@PLT
	movl	368(%rsp), %eax
	movl	$33554433, %edi
	xorl	%r9d, %r9d
	movl	$1, %esi
	xorl	%r8d, %r8d
	salq	$7, %rdi
	movl	%eax, 24(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 28(%rsp)
	movl	32(%rsp), %ecx
	movq	24(%rsp), %rdx
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L17
	movq	16(%rsp), %rdi
	movl	$100000000, %esi
	call	_Z27__device_stub__Z7calcSinPdmPdm
.L17:
	movl	$800000000, %edi
	xorl	%ebp, %ebp
	leaq	.LC21(%rip), %r12
	call	malloc@PLT
	movq	16(%rsp), %rsi
	movl	$2, %ecx
	movl	$800000000, %edx
	movq	%rax, %rdi
	movq	%rax, %rbx
	call	cudaMemcpy@PLT
.L18:
	movsd	(%rbx,%rbp,8), %xmm0
	movq	%r12, %rsi
	movl	$2, %edi
	movb	$1, %al
	incq	%rbp
	call	__printf_chk@PLT
	cmpq	$10, %rbp
	jne	.L18
	movl	$100000000, %esi
	movq	%rbx, %rdi
	call	_Z7calcErrPdm
	leaq	.LC22(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	call	__printf_chk@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	%rbx, %rdi
	call	free@PLT
	leaq	.LC23(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L15:
	movq	1080(%rsp), %rax
	subq	%fs:40, %rax
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	addq	$1088, %rsp
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2041:
	.size	main, .-main
	.section	.rodata.str1.1
.LC24:
	.string	"_Z7calcSinPdm"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2069:
	.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	.LC24(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z7calcSinPdm(%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
.LFE2069:
	.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.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	1413754136
	.long	1074340347
	.align 8
.LC2:
	.long	0
	.long	1080459264
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC3:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.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:

/*
	Cource - "Разработка приложений на CUDA "
  	Task 1:
  		Выделить на GPU массив arr из 10^9 элементов типа 
  		float и инициализировать его с помощью ядра следующим образом: 
  		arr[i] = sin((i%360)*Pi/180). Скопировать массив в память центрального 
  		процессора и посчитать ошибку err = sum_i(abs(sin((i%360)*Pi/180) 
  		- arr[i]))/10^9. Провести исследование зависимости результата от использования 
  		функций: sin, sinf, __sin. Объяснить результат. Проверить результат 
  		при использовании массива типа double.
  	Written by Pavel Santaev
*/


#include <hip/hip_runtime.h>
#include <stdio.h>
#include <unistd.h> 
#include <math.h>

typedef double arrType;

__global__ void calcSin(arrType * a, size_t len){
	unsigned int index = blockIdx.x * blockDim.x + threadIdx.x;
	unsigned int i = index;
	size_t threadsCount = blockDim.x * gridDim.x;
	while (i < len){
		double value = ((arrType)(i % 360)) * M_PI / 180;
		a[i] = __sinf(value);
		i = i + threadsCount;
	}
}

double calcErr(arrType * arr, size_t len){
	double sum = 0;
	for (int i = 0; i < len; i++){
		sum += abs(sin((i % 360) * M_PI / 180) - arr[i]);
	}
	return sum / len;
}

int main(){
	size_t N = 1000 * 1000 * 100;
	size_t size = sizeof(arrType) * N;
	arrType * ptr;
	hipError_t error;

	int deviceCount = 0;
	error = hipGetDeviceCount(&deviceCount);
	if (hipSuccess != error){
    	printf("Error in cudaGetDeviceCount: %s\n", hipGetErrorString(error));
    	return 0;
    }
	printf("hipGetDeviceCount = %x\n", deviceCount);

	int deviceID = 1;
	hipDeviceProp_t devProp;
    error = hipGetDeviceProperties(&devProp, deviceID);
    if (hipSuccess != error){
    	printf("Error in cudaGetDeviceProperties: %d\n", hipGetErrorString(error));
    	return 0;
    }
    printf ( "Device %d\n", 0 );
    printf ( "Compute capability     : %d.%d\n", devProp.major, devProp.minor );
    printf ( "Name                   : %s\n", devProp.name );
    printf ( "Total Global Memory    : %d\n", devProp.totalGlobalMem );
    printf ( "Shared memory per block: %d\n", devProp.sharedMemPerBlock );
    printf ( "Registers per block    : %d\n", devProp.regsPerBlock );
    printf ( "Warp size              : %d\n", devProp.warpSize );
    printf ( "Max threads per block  : %d\n", devProp.maxThreadsPerBlock );
    printf ( "Total constant memory  : %d\n", devProp.totalConstMem );
    printf ( "Max Grid Size  : %d %d %d\n", devProp.maxGridSize[0], devProp.maxGridSize[1], devProp.maxGridSize[2]);
    printf ( "Max Threads Dim  : %d %d %d\n", devProp.maxThreadsDim[0], devProp.maxThreadsDim[1], devProp.maxThreadsDim[2]);

	hipSetDevice(deviceID);

	

	printf("sizeof size_t %d \n", sizeof(size_t));
	printf("sizeof type %d \n", sizeof(arrType));
	printf("allocating %u memory\n", size);
	hipMalloc(&ptr, size);
	dim3 threads = dim3(devProp.maxThreadsPerBlock, 1);
    dim3 blocks  = dim3(128, 1);
	calcSin<<<blocks, threads>>>(ptr, N);

	int i = 0;
	arrType * hostPtr;
	hostPtr = (arrType *)malloc(size);

	hipMemcpy(hostPtr, ptr, size, hipMemcpyDeviceToHost);

	for (i = 0; i < 10; i++){
		printf("%f ", hostPtr[i]);
	}

	printf("\nerror = %0.10f ", calcErr(hostPtr, N));

	hipFree(ptr);
	free(hostPtr);
	printf("\nfinished\n");
}


	.text
	.file	"main.hip"
	.globl	_Z22__device_stub__calcSinPdm   # -- Begin function _Z22__device_stub__calcSinPdm
	.type	_Z22__device_stub__calcSinPdm,@function
_Z22__device_stub__calcSinPdm:          # @_Z22__device_stub__calcSinPdm
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$80, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	16(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%rsp, %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z7calcSinPdm, %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_end0:
	.size	_Z22__device_stub__calcSinPdm, .Lfunc_end0-_Z22__device_stub__calcSinPdm
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z7calcErrPdm
.LCPI1_0:
	.quad	0x400921fb54442d18              # double 3.1415926535897931
.LCPI1_1:
	.quad	0x4066800000000000              # double 180
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0
.LCPI1_2:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
.LCPI1_3:
	.long	1127219200                      # 0x43300000
	.long	1160773632                      # 0x45300000
	.long	0                               # 0x0
	.long	0                               # 0x0
.LCPI1_4:
	.quad	0x4330000000000000              # double 4503599627370496
	.quad	0x4530000000000000              # double 1.9342813113834067E+25
	.text
	.globl	_Z7calcErrPdm
	.type	_Z7calcErrPdm,@function
_Z7calcErrPdm:                          # @_Z7calcErrPdm
	.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	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %rbx
	testq	%rsi, %rsi
	je	.LBB1_1
# %bb.3:                                # %.lr.ph.preheader
	movq	%rdi, %r14
	xorpd	%xmm2, %xmm2
	xorl	%ebp, %ebp
	movq	%rbx, %r15
.LBB1_4:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movsd	%xmm2, (%rsp)                   # 8-byte Spill
	movl	%ebp, %eax
	shrl	$3, %eax
	imulq	$381774871, %rax, %rax          # imm = 0x16C16C17
	shrq	$34, %rax
	imull	$360, %eax, %eax                # imm = 0x168
	movl	%ebp, %ecx
	subl	%eax, %ecx
	xorps	%xmm0, %xmm0
	cvtsi2sd	%ecx, %xmm0
	mulsd	.LCPI1_0(%rip), %xmm0
	divsd	.LCPI1_1(%rip), %xmm0
	callq	sin
	movsd	(%rsp), %xmm2                   # 8-byte Reload
                                        # xmm2 = mem[0],zero
	subsd	(%r14), %xmm0
	andpd	.LCPI1_2(%rip), %xmm0
	addsd	%xmm0, %xmm2
	addq	$8, %r14
	incl	%ebp
	decq	%r15
	jne	.LBB1_4
	jmp	.LBB1_2
.LBB1_1:
	xorpd	%xmm2, %xmm2
.LBB1_2:                                # %._crit_edge
	movq	%rbx, %xmm0
	punpckldq	.LCPI1_3(%rip), %xmm0   # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
	subpd	.LCPI1_4(%rip), %xmm0
	movapd	%xmm0, %xmm1
	unpckhpd	%xmm0, %xmm1                    # xmm1 = xmm1[1],xmm0[1]
	addsd	%xmm0, %xmm1
	divsd	%xmm1, %xmm2
	movapd	%xmm2, %xmm0
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z7calcErrPdm, .Lfunc_end1-_Z7calcErrPdm
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI2_0:
	.quad	0x400921fb54442d18              # double 3.1415926535897931
.LCPI2_1:
	.quad	0x4066800000000000              # double 180
.LCPI2_3:
	.quad	0x4197d78400000000              # double 1.0E+8
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0
.LCPI2_2:
	.quad	0x7fffffffffffffff              # double NaN
	.quad	0x7fffffffffffffff              # double NaN
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$1504, %rsp                     # imm = 0x5E0
	.cfi_def_cfa_offset 1536
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	28(%rsp), %rdi
	movl	$0, (%rdi)
	callq	hipGetDeviceCount
	testl	%eax, %eax
	je	.LBB2_3
# %bb.1:
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	jmp	.LBB2_2
.LBB2_3:
	movl	28(%rsp), %esi
	movl	$.L.str.1, %edi
	xorl	%eax, %eax
	callq	printf
	leaq	32(%rsp), %rdi
	movl	$1, %esi
	callq	hipGetDevicePropertiesR0600
	testl	%eax, %eax
	je	.LBB2_5
# %bb.4:
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.2, %edi
.LBB2_2:
	movq	%rax, %rsi
	xorl	%eax, %eax
	callq	printf
.LBB2_12:
	xorl	%eax, %eax
	addq	$1504, %rsp                     # imm = 0x5E0
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.LBB2_5:
	.cfi_def_cfa_offset 1536
	movl	$.L.str.3, %edi
	xorl	%esi, %esi
	xorl	%eax, %eax
	callq	printf
	leaq	32(%rsp), %rbx
	movl	360(%rbx), %esi
	movl	364(%rbx), %edx
	movl	$.L.str.4, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.5, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	printf
	movq	288(%rbx), %rsi
	movl	$.L.str.6, %edi
	xorl	%eax, %eax
	callq	printf
	movq	296(%rbx), %rsi
	movl	$.L.str.7, %edi
	xorl	%eax, %eax
	callq	printf
	movl	304(%rbx), %esi
	movl	$.L.str.8, %edi
	xorl	%eax, %eax
	callq	printf
	movl	308(%rbx), %esi
	movl	$.L.str.9, %edi
	xorl	%eax, %eax
	callq	printf
	movl	320(%rbx), %esi
	movl	$.L.str.10, %edi
	xorl	%eax, %eax
	callq	printf
	movq	352(%rbx), %rsi
	movl	$.L.str.11, %edi
	xorl	%eax, %eax
	callq	printf
	movl	336(%rbx), %esi
	movl	340(%rbx), %edx
	movl	344(%rbx), %ecx
	movl	$.L.str.12, %edi
	xorl	%eax, %eax
	callq	printf
	movl	324(%rbx), %esi
	movl	328(%rbx), %edx
	movl	332(%rbx), %ecx
	movl	$.L.str.13, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$1, %edi
	callq	hipSetDevice
	movl	$.L.str.14, %edi
	movl	$8, %esi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.15, %edi
	movl	$8, %esi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.16, %edi
	movl	$800000000, %esi                # imm = 0x2FAF0800
	xorl	%eax, %eax
	callq	printf
	leaq	16(%rsp), %rdi
	movl	$800000000, %esi                # imm = 0x2FAF0800
	callq	hipMalloc
	movl	320(%rbx), %edx
	btsq	$32, %rdx
	movabsq	$4294967296, %rdi               # imm = 0x100000000
	orq	$128, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_7
# %bb.6:
	movq	16(%rsp), %rdi
	movl	$100000000, %esi                # imm = 0x5F5E100
	callq	_Z22__device_stub__calcSinPdm
.LBB2_7:
	movl	$800000000, %edi                # imm = 0x2FAF0800
	callq	malloc
	movq	%rax, %rbx
	movq	16(%rsp), %rsi
	movl	$800000000, %edx                # imm = 0x2FAF0800
	movq	%rax, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	xorl	%r14d, %r14d
.LBB2_8:                                # =>This Inner Loop Header: Depth=1
	movsd	(%rbx,%r14,8), %xmm0            # xmm0 = mem[0],zero
	movl	$.L.str.17, %edi
	movb	$1, %al
	callq	printf
	incq	%r14
	cmpq	$10, %r14
	jne	.LBB2_8
# %bb.9:                                # %.lr.ph.i.preheader
	xorpd	%xmm0, %xmm0
	xorl	%r14d, %r14d
	xorl	%r15d, %r15d
.LBB2_10:                               # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movl	%r14d, %eax
	shrl	$3, %eax
	imulq	$381774871, %rax, %rax          # imm = 0x16C16C17
	shrq	$34, %rax
	imull	$360, %eax, %eax                # imm = 0x168
	movl	%r14d, %ecx
	subl	%eax, %ecx
	xorps	%xmm0, %xmm0
	cvtsi2sd	%ecx, %xmm0
	mulsd	.LCPI2_0(%rip), %xmm0
	divsd	.LCPI2_1(%rip), %xmm0
	callq	sin
	subsd	(%rbx,%r15), %xmm0
	andpd	.LCPI2_2(%rip), %xmm0
	movsd	8(%rsp), %xmm1                  # 8-byte Reload
                                        # xmm1 = mem[0],zero
	addsd	%xmm0, %xmm1
	movsd	%xmm1, 8(%rsp)                  # 8-byte Spill
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	addq	$8, %r15
	incl	%r14d
	cmpq	$800000000, %r15                # imm = 0x2FAF0800
	jne	.LBB2_10
# %bb.11:                               # %_Z7calcErrPdm.exit
	divsd	.LCPI2_3(%rip), %xmm0
	movl	$.L.str.18, %edi
	movb	$1, %al
	callq	printf
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	%rbx, %rdi
	callq	free
	movl	$.Lstr, %edi
	callq	puts@PLT
	jmp	.LBB2_12
.Lfunc_end2:
	.size	main, .Lfunc_end2-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	.LBB3_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB3_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z7calcSinPdm, %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_end3:
	.size	__hip_module_ctor, .Lfunc_end3-__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	.LBB4_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
.LBB4_2:
	retq
.Lfunc_end4:
	.size	__hip_module_dtor, .Lfunc_end4-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z7calcSinPdm,@object           # @_Z7calcSinPdm
	.section	.rodata,"a",@progbits
	.globl	_Z7calcSinPdm
	.p2align	3, 0x0
_Z7calcSinPdm:
	.quad	_Z22__device_stub__calcSinPdm
	.size	_Z7calcSinPdm, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Error in cudaGetDeviceCount: %s\n"
	.size	.L.str, 33

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"hipGetDeviceCount = %x\n"
	.size	.L.str.1, 24

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Error in cudaGetDeviceProperties: %d\n"
	.size	.L.str.2, 38

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Device %d\n"
	.size	.L.str.3, 11

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Compute capability     : %d.%d\n"
	.size	.L.str.4, 32

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Name                   : %s\n"
	.size	.L.str.5, 29

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Total Global Memory    : %d\n"
	.size	.L.str.6, 29

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Shared memory per block: %d\n"
	.size	.L.str.7, 29

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Registers per block    : %d\n"
	.size	.L.str.8, 29

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"Warp size              : %d\n"
	.size	.L.str.9, 29

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"Max threads per block  : %d\n"
	.size	.L.str.10, 29

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"Total constant memory  : %d\n"
	.size	.L.str.11, 29

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"Max Grid Size  : %d %d %d\n"
	.size	.L.str.12, 27

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"Max Threads Dim  : %d %d %d\n"
	.size	.L.str.13, 29

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"sizeof size_t %d \n"
	.size	.L.str.14, 19

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"sizeof type %d \n"
	.size	.L.str.15, 17

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"allocating %u memory\n"
	.size	.L.str.16, 22

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

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"\nerror = %0.10f "
	.size	.L.str.18, 17

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z7calcSinPdm"
	.size	.L__unnamed_1, 14

	.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	"\nfinished"
	.size	.Lstr, 10

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

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z7calcSinPdm           ; -- Begin function _Z7calcSinPdm
	.globl	_Z7calcSinPdm
	.p2align	8
	.type	_Z7calcSinPdm,@function
_Z7calcSinPdm:                          ; @_Z7calcSinPdm
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x1c
	s_load_b128 s[4:7], s[0:1], 0x0
	s_add_u32 s0, s0, 16
	s_addc_u32 s1, s1, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s8, s2, 0xffff
	s_mov_b32 s2, exec_lo
	v_mad_u64_u32 v[1:2], null, s15, s8, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_dual_mov_b32 v3, 0 :: v_dual_mov_b32 v2, v1
	v_cmpx_gt_u64_e64 s[6:7], v[2:3]
	s_cbranch_execz .LBB0_3
; %bb.1:                                ; %.lr.ph.preheader
	s_load_b32 s1, s[0:1], 0x0
	v_dual_mov_b32 v5, v3 :: v_dual_mov_b32 v4, v2
	s_mov_b32 s2, 0x54442d18
	s_mov_b32 s3, 0x400921fb
	s_waitcnt lgkmcnt(0)
	s_add_i32 s15, s15, s1
	s_mul_i32 s1, s1, s8
	v_mad_u64_u32 v[6:7], null, s15, s8, v[0:1]
	s_mov_b32 s8, 0
	s_delay_alu instid0(VALU_DEP_1)
	v_mov_b32_e32 v2, v6
.LBB0_2:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	v_lshrrev_b32_e32 v0, 3, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v0, 0x16c16c17, v0
	v_lshrrev_b32_e32 v0, 2, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_u32_u24_e32 v0, 0x168, v0
	v_sub_nc_u32_e32 v0, v1, v0
	v_add_nc_u32_e32 v1, s1, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_f64_u32_e32 v[6:7], v0
	v_mul_f64 v[6:7], v[6:7], s[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_scale_f64 v[8:9], null, 0x40668000, 0x40668000, v[6:7]
	v_div_scale_f64 v[14:15], vcc_lo, v[6:7], 0x40668000, v[6:7]
	v_rcp_f64_e32 v[10:11], v[8:9]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[12:13], -v[8:9], v[10:11], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[10:11], v[10:11], v[12:13], v[10:11]
	v_fma_f64 v[12:13], -v[8:9], v[10:11], 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[10:11], v[10:11], v[12:13], v[10:11]
	v_mul_f64 v[12:13], v[14:15], v[10:11]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[8:9], -v[8:9], v[12:13], v[14:15]
	v_div_fmas_f64 v[8:9], v[8:9], v[10:11], v[12:13]
	v_cmp_le_u64_e32 vcc_lo, s[6:7], v[2:3]
	s_or_b32 s8, vcc_lo, s8
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_3)
	v_div_fixup_f64 v[6:7], v[8:9], 0x40668000, v[6:7]
	v_lshlrev_b64 v[8:9], 3, v[4:5]
	v_dual_mov_b32 v5, v3 :: v_dual_mov_b32 v4, v2
	v_add_nc_u32_e32 v2, s1, v2
	v_add_co_u32 v8, s0, s4, v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e64 v9, s0, s5, v9, s0
	v_cvt_f32_f64_e32 v0, v[6:7]
	v_mul_f32_e32 v0, 0.15915494, v0
	s_delay_alu instid0(VALU_DEP_1)
	v_sin_f32_e32 v0, v0
	s_waitcnt_depctr 0xfff
	v_cvt_f64_f32_e32 v[6:7], v0
	global_store_b64 v[8:9], v[6:7], off
	s_and_not1_b32 exec_lo, exec_lo, s8
	s_cbranch_execnz .LBB0_2
.LBB0_3:                                ; %._crit_edge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z7calcSinPdm
		.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 16
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z7calcSinPdm, .Lfunc_end0-_Z7calcSinPdm
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 420
; NumSgprs: 18
; NumVgprs: 16
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 16
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .offset:         8
        .size:           8
        .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:           _Z7calcSinPdm
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z7calcSinPdm.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     16
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
