#include <iostream>
#include <cuda.h>
#include <math.h>
#include <stdio.h>

typedef unsigned int uint;

// O kernel a seguir obtém o índice da thread operante e verifica se ela está apta para manipular o array.
// Assim, por meio dele, executamos em paralelo (CUDA Cores * SMs) operações em paralelo, dado o particionamento em blocos.
__global__ void sieve(uint* d_array, uint i, uint k, uint n) {
	int idx = threadIdx.x + (32 * blockIdx.x);
	if ((idx >= k) && (idx <= n)) {
		if ( (d_array[idx] % i) == 0) { 
			d_array[idx] = 0;
		}
	}
	__syncthreads();
}

// Função que obtém o valor de entrada presente no arquivo.
uint get_n(char* filename) {
     FILE* infile;
     infile = fopen(filename,"r");
     if (infile != NULL) {
          uint n;
          fscanf(infile,"%i", &n);
          fclose(infile);
          return n;
     } else {
          return 0;
     }
}

void onDevice(uint* h_array, uint n) {
	uint* d_array;

	// Allocando memória na GPU.
	cudaMalloc((void**)&d_array, (n + 1) * sizeof(uint));

	// Copiando conteudo para a GPU.
    cudaMemcpy(d_array, h_array, (n + 1) * sizeof(uint), cudaMemcpyHostToDevice);

    dim3 threadsPorBloco(32, 1, 1);
    dim3 blocosPorGrid(ceil( (double)n/32), 1, 1);

    // Executando o sieve
    for (uint i = 2; i <= ceil(sqrt(n)); ++i) {
    	if (h_array[i] != 0) {
            uint k = i*i;
            if (k <= n) {
				// Invoka o kernel para operações de mod
				sieve<<<blocosPorGrid, threadsPorBloco>>>(d_array, i, k, n);
				// Detecção de erro caso o kernel apresente algum...
				cudaError_t err = cudaGetLastError();
				if (err != cudaSuccess) 
					printf("Error: %s\n", cudaGetErrorString(err));
				// Atualiza o array presente na CPU depois do resultado.
				cudaMemcpy(h_array, d_array, (n + 1) * sizeof(uint), cudaMemcpyDeviceToHost);
            }
       }
	}

    // Desaloca os espaços alocados.
    cudaFree(d_array);
}

void onHost(int argc, char* argv[]) {

	if (argc == 2) {
		uint n = get_n(argv[1]);
		if (n == 0) {
			std::cout << "Input error.\n";
		}
		// Open the output file
		FILE* outfile;
		outfile = fopen("problem_output.txt","w");
		if (outfile == NULL) {
			std::cout << "Problem opening output file.\n";
		}
		// Initialize array
		uint* h_array = new uint[n+1];
		for (uint i = 2; i <= n; ++i) {
			h_array[i] = i;
		}

		// Invoca o device (GPU) para processamento do array
		onDevice(h_array, n);

		// Exibe a saída no arquivo
		for (uint i = 2; i <= n; ++i)
			if (h_array[i] != 0)
				fprintf(outfile,"%u ", i);
		
		fclose(outfile);
		delete[] h_array;
	} else {
		std::cout << "Usage: ./sieve problem_input" << std::endl;
	}
}

int main(int argc, char* argv[]){
	onHost(argc, argv);
	return 0;
}
	.file	"tmpxft_00322295_00000000-6_sieve_cuda.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3641:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3641:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"r"
.LC1:
	.string	"%i"
	.text
	.globl	_Z5get_nPc
	.type	_Z5get_nPc, @function
_Z5get_nPc:
.LFB3635:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	.LC0(%rip), %rsi
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	call	fopen@PLT
	movq	%rax, %rbx
	xorl	%eax, %eax
	testq	%rbx, %rbx
	je	.L2
	leaq	4(%rsp), %rdx
	leaq	.LC1(%rip), %rsi
	movq	%rbx, %rdi
	call	__isoc23_fscanf@PLT
	movq	%rbx, %rdi
	call	fclose@PLT
	movl	4(%rsp), %eax
.L2:
	movq	8(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$16, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3635:
	.size	_Z5get_nPc, .-_Z5get_nPc
	.globl	_Z27__device_stub__Z5sievePjjjjPjjjj
	.type	_Z27__device_stub__Z5sievePjjjjPjjjj, @function
_Z27__device_stub__Z5sievePjjjjPjjjj:
.LFB3663:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 16(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 12(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L8
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z5sievePjjjj(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L8:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3663:
	.size	_Z27__device_stub__Z5sievePjjjjPjjjj, .-_Z27__device_stub__Z5sievePjjjjPjjjj
	.globl	_Z5sievePjjjj
	.type	_Z5sievePjjjj, @function
_Z5sievePjjjj:
.LFB3664:
	.cfi_startproc
	endbr64
	jmp	_Z27__device_stub__Z5sievePjjjjPjjjj
	.cfi_endproc
.LFE3664:
	.size	_Z5sievePjjjj, .-_Z5sievePjjjj
	.section	.rodata.str1.1
.LC3:
	.string	"Error: %s\n"
	.text
	.globl	_Z8onDevicePjj
	.type	_Z8onDevicePjj, @function
_Z8onDevicePjj:
.LFB3636:
	.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
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leal	1(%rsi), %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	salq	$2, %r12
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%r12, %rsi
	movl	$2, %ebx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdi
	call	cudaMalloc@PLT
	movq	8(%rsp), %rdi
	movq	%r12, %rdx
	movq	%r13, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	$134217729, %eax
	movsd	.LC2(%rip), %xmm0
	movl	$1, 24(%rsp)
	salq	$5, %rax
	movq	%rax, 16(%rsp)
	movl	%ebp, %eax
	cvtsi2sdq	%rax, %xmm2
	mulsd	%xmm2, %xmm0
	movq	%xmm2, %r15
	call	ceil@PLT
	cvttsd2siq	%xmm0, %rax
	movl	%eax, 28(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 32(%rsp)
.L16:
	movq	%r15, %xmm0
	call	sqrt@PLT
	call	ceil@PLT
	movl	%ebx, %eax
	movaps	%xmm0, %xmm1
	cvtsi2sdq	%rax, %xmm0
	comisd	%xmm0, %xmm1
	jb	.L28
	cmpl	$0, 0(%r13,%rax,4)
	je	.L17
	movl	%ebx, %r14d
	imull	%ebx, %r14d
	cmpl	%r14d, %ebp
	jb	.L17
	movl	24(%rsp), %ecx
	movq	16(%rsp), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	28(%rsp), %rdi
	movl	36(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L18
	movq	8(%rsp), %rdi
	movl	%ebp, %ecx
	movl	%r14d, %edx
	movl	%ebx, %esi
	call	_Z27__device_stub__Z5sievePjjjjPjjjj
.L18:
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L19
	call	cudaGetErrorString@PLT
	leaq	.LC3(%rip), %rsi
	movl	$2, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L19:
	movq	8(%rsp), %rsi
	movl	$2, %ecx
	movq	%r12, %rdx
	movq	%r13, %rdi
	call	cudaMemcpy@PLT
.L17:
	incl	%ebx
	jmp	.L16
.L28:
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3636:
	.size	_Z8onDevicePjj, .-_Z8onDevicePjj
	.section	.rodata.str1.1
.LC4:
	.string	"Input error.\n"
.LC5:
	.string	"w"
.LC6:
	.string	"problem_output.txt"
.LC7:
	.string	"Problem opening output file.\n"
.LC8:
	.string	"%u "
.LC9:
	.string	"Usage: ./sieve problem_input"
	.text
	.globl	_Z6onHostiPPc
	.type	_Z6onHostiPPc, @function
_Z6onHostiPPc:
.LFB3637:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	pushq	%rcx
	.cfi_def_cfa_offset 64
	cmpl	$2, %edi
	jne	.L30
	movq	8(%rsi), %rdi
	call	_Z5get_nPc
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.L31
	leaq	.LC4(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.L31:
	leaq	.LC5(%rip), %rsi
	leaq	.LC6(%rip), %rdi
	call	fopen@PLT
	movq	%rax, %r12
	testq	%rax, %rax
	jne	.L32
	leaq	.LC7(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.L32:
	leal	1(%rbx), %edi
	salq	$2, %rdi
	call	_Znam@PLT
	movq	%rax, %rbp
	movl	$2, %eax
.L33:
	cmpl	%eax, %ebx
	jb	.L39
	movl	%eax, %edx
	movl	%eax, 0(%rbp,%rdx,4)
	incl	%eax
	jmp	.L33
.L39:
	movl	%ebx, %esi
	movq	%rbp, %rdi
	leaq	8(%rbp), %r14
	movl	$2, %r13d
	call	_Z8onDevicePjj
	leaq	.LC8(%rip), %r15
.L35:
	cmpl	%r13d, %ebx
	jb	.L40
	cmpl	$0, (%r14)
	je	.L36
	movl	%r13d, %ecx
	movq	%r15, %rdx
	movl	$2, %esi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L36:
	incl	%r13d
	addq	$4, %r14
	jmp	.L35
.L40:
	movq	%r12, %rdi
	call	fclose@PLT
	popq	%rdx
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movq	%rbp, %rdi
	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
	jmp	_ZdaPv@PLT
.L30:
	.cfi_restore_state
	leaq	_ZSt4cout(%rip), %rdi
	leaq	.LC9(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	popq	%rax
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	.cfi_endproc
.LFE3637:
	.size	_Z6onHostiPPc, .-_Z6onHostiPPc
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3638:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	call	_Z6onHostiPPc
	xorl	%eax, %eax
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3638:
	.size	main, .-main
	.section	.rodata.str1.1
.LC10:
	.string	"_Z5sievePjjjj"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3666:
	.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	.LC10(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z5sievePjjjj(%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
.LFE3666:
	.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
.LC2:
	.long	0
	.long	1067450368
	.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 <iostream>
#include <hip/hip_runtime.h>
#include <math.h>
#include <stdio.h>

typedef unsigned int uint;

// O kernel a seguir obtém o índice da thread operante e verifica se ela está apta para manipular o array.
// Assim, por meio dele, executamos em paralelo (CUDA Cores * SMs) operações em paralelo, dado o particionamento em blocos.
__global__ void sieve(uint* d_array, uint i, uint k, uint n) {
	int idx = threadIdx.x + (32 * blockIdx.x);
	if ((idx >= k) && (idx <= n)) {
		if ( (d_array[idx] % i) == 0) { 
			d_array[idx] = 0;
		}
	}
	__syncthreads();
}

// Função que obtém o valor de entrada presente no arquivo.
uint get_n(char* filename) {
     FILE* infile;
     infile = fopen(filename,"r");
     if (infile != NULL) {
          uint n;
          fscanf(infile,"%i", &n);
          fclose(infile);
          return n;
     } else {
          return 0;
     }
}

void onDevice(uint* h_array, uint n) {
	uint* d_array;

	// Allocando memória na GPU.
	hipMalloc((void**)&d_array, (n + 1) * sizeof(uint));

	// Copiando conteudo para a GPU.
    hipMemcpy(d_array, h_array, (n + 1) * sizeof(uint), hipMemcpyHostToDevice);

    dim3 threadsPorBloco(32, 1, 1);
    dim3 blocosPorGrid(ceil( (double)n/32), 1, 1);

    // Executando o sieve
    for (uint i = 2; i <= ceil(sqrt(n)); ++i) {
    	if (h_array[i] != 0) {
            uint k = i*i;
            if (k <= n) {
				// Invoka o kernel para operações de mod
				sieve<<<blocosPorGrid, threadsPorBloco>>>(d_array, i, k, n);
				// Detecção de erro caso o kernel apresente algum...
				hipError_t err = hipGetLastError();
				if (err != hipSuccess) 
					printf("Error: %s\n", hipGetErrorString(err));
				// Atualiza o array presente na CPU depois do resultado.
				hipMemcpy(h_array, d_array, (n + 1) * sizeof(uint), hipMemcpyDeviceToHost);
            }
       }
	}

    // Desaloca os espaços alocados.
    hipFree(d_array);
}

void onHost(int argc, char* argv[]) {

	if (argc == 2) {
		uint n = get_n(argv[1]);
		if (n == 0) {
			std::cout << "Input error.\n";
		}
		// Open the output file
		FILE* outfile;
		outfile = fopen("problem_output.txt","w");
		if (outfile == NULL) {
			std::cout << "Problem opening output file.\n";
		}
		// Initialize array
		uint* h_array = new uint[n+1];
		for (uint i = 2; i <= n; ++i) {
			h_array[i] = i;
		}

		// Invoca o device (GPU) para processamento do array
		onDevice(h_array, n);

		// Exibe a saída no arquivo
		for (uint i = 2; i <= n; ++i)
			if (h_array[i] != 0)
				fprintf(outfile,"%u ", i);
		
		fclose(outfile);
		delete[] h_array;
	} else {
		std::cout << "Usage: ./sieve problem_input" << std::endl;
	}
}

int main(int argc, char* argv[]){
	onHost(argc, argv);
	return 0;
}
	.text
	.file	"sieve_cuda.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z20__device_stub__sievePjjjj   # -- Begin function _Z20__device_stub__sievePjjjj
	.type	_Z20__device_stub__sievePjjjj,@function
_Z20__device_stub__sievePjjjj:          # @_Z20__device_stub__sievePjjjj
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	20(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	16(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	12(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%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	$_Z5sievePjjjj, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z20__device_stub__sievePjjjj, .Lfunc_end0-_Z20__device_stub__sievePjjjj
	.cfi_endproc
                                        # -- End function
	.globl	_Z5get_nPc                      # -- Begin function _Z5get_nPc
	.type	_Z5get_nPc,@function
_Z5get_nPc:                             # @_Z5get_nPc
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movl	$.L.str, %esi
	callq	fopen
	testq	%rax, %rax
	je	.LBB1_1
# %bb.2:
	movq	%rax, %rbx
	leaq	4(%rsp), %r14
	movl	$.L.str.1, %esi
	movq	%rax, %rdi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	movq	%rbx, %rdi
	callq	fclose
	movl	(%r14), %eax
	jmp	.LBB1_3
.LBB1_1:
	xorl	%eax, %eax
.LBB1_3:
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z5get_nPc, .Lfunc_end1-_Z5get_nPc
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z8onDevicePjj
.LCPI2_0:
	.quad	0x3fa0000000000000              # double 0.03125
.LCPI2_1:
	.quad	0x4000000000000000              # double 2
	.text
	.globl	_Z8onDevicePjj
	.type	_Z8onDevicePjj,@function
_Z8onDevicePjj:                         # @_Z8onDevicePjj
	.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	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%esi, %ebx
	movq	%rdi, %r14
	leal	1(%rbx), %r15d
	shlq	$2, %r15
	leaq	24(%rsp), %r12
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	hipMalloc
	movq	(%r12), %rdi
	movq	%r14, %rsi
	movq	%r15, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%ebx, %eax
	cvtsi2sd	%rax, %xmm1
	movsd	%xmm1, 16(%rsp)                 # 8-byte Spill
	movsd	.LCPI2_0(%rip), %xmm0           # xmm0 = mem[0],zero
	mulsd	%xmm1, %xmm0
	callq	ceil@PLT
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	xorps	%xmm0, %xmm0
	sqrtsd	16(%rsp), %xmm0                 # 8-byte Folded Reload
	callq	ceil@PLT
	ucomisd	.LCPI2_1(%rip), %xmm0
	jb	.LBB2_10
# %bb.1:                                # %.lr.ph.preheader
	movabsq	$4294967296, %rcx               # imm = 0x100000000
	cvttsd2si	8(%rsp), %rax           # 8-byte Folded Reload
	movl	%eax, %eax
	btsq	$32, %rax
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	movl	$3, %r13d
	addq	$32, %rcx
	movq	%rcx, 8(%rsp)                   # 8-byte Spill
	movsd	%xmm0, 16(%rsp)                 # 8-byte Spill
.LBB2_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	leal	-1(%r13), %ebp
	cmpl	$0, (%r14,%rbp,4)
	je	.LBB2_9
# %bb.3:                                #   in Loop: Header=BB2_2 Depth=1
	movl	%ebp, %r12d
	imull	%ebp, %r12d
	cmpl	%ebx, %r12d
	ja	.LBB2_9
# %bb.4:                                #   in Loop: Header=BB2_2 Depth=1
	movq	32(%rsp), %rdi                  # 8-byte Reload
	movl	$1, %esi
	movq	8(%rsp), %rdx                   # 8-byte Reload
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_6
# %bb.5:                                #   in Loop: Header=BB2_2 Depth=1
	movq	24(%rsp), %rdi
	movl	%ebp, %esi
	movl	%r12d, %edx
	movl	%ebx, %ecx
	callq	_Z20__device_stub__sievePjjjj
.LBB2_6:                                #   in Loop: Header=BB2_2 Depth=1
	callq	hipGetLastError
	testl	%eax, %eax
	je	.LBB2_8
# %bb.7:                                #   in Loop: Header=BB2_2 Depth=1
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.2, %edi
	movq	%rax, %rsi
	xorl	%eax, %eax
	callq	printf
.LBB2_8:                                #   in Loop: Header=BB2_2 Depth=1
	movq	24(%rsp), %rsi
	movq	%r14, %rdi
	movq	%r15, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
.LBB2_9:                                #   in Loop: Header=BB2_2 Depth=1
	movl	%r13d, %eax
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rax, %xmm1
	incl	%r13d
	ucomisd	%xmm1, %xmm0
	jae	.LBB2_2
.LBB2_10:                               # %._crit_edge
	movq	24(%rsp), %rdi
	callq	hipFree
	addq	$40, %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
.Lfunc_end2:
	.size	_Z8onDevicePjj, .Lfunc_end2-_Z8onDevicePjj
	.cfi_endproc
                                        # -- End function
	.globl	_Z6onHostiPPc                   # -- Begin function _Z6onHostiPPc
	.type	_Z6onHostiPPc,@function
_Z6onHostiPPc:                          # @_Z6onHostiPPc
	.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	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	cmpl	$2, %edi
	jne	.LBB3_15
# %bb.1:
	movq	8(%rsi), %rdi
	callq	_Z5get_nPc
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB3_3
# %bb.2:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.3, %esi
	movl	$13, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.LBB3_3:
	movl	$.L.str.4, %edi
	movl	$.L.str.5, %esi
	callq	fopen
	movq	%rax, %r14
	testq	%rax, %rax
	jne	.LBB3_5
# %bb.4:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.6, %esi
	movl	$29, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.LBB3_5:
	leal	1(%rbx), %r12d
	leaq	(,%r12,4), %rdi
	callq	_Znam
	movq	%rax, %r15
	cmpl	$1, %ebx
	ja	.LBB3_13
# %bb.6:                                # %._crit_edge.thread
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_Z8onDevicePjj
	jmp	.LBB3_12
.LBB3_15:
	movl	$_ZSt4cout, %ebx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.8, %esi
	movl	$28, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.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
	jmp	_ZNSo5flushEv                   # TAILCALL
.LBB3_13:                               # %.lr.ph.preheader
	.cfi_def_cfa_offset 48
	cmpl	$4, %r12d
	movl	$3, %eax
	cmovael	%r12d, %eax
	movl	$2, %ecx
.LBB3_14:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	%ecx, (%r15,%rcx,4)
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB3_14
# %bb.7:                                # %._crit_edge
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_Z8onDevicePjj
	cmpl	$2, %ebx
	jb	.LBB3_12
# %bb.8:                                # %.lr.ph30.preheader
	movl	$2, %ebp
.LBB3_9:                                # %.lr.ph30
                                        # =>This Inner Loop Header: Depth=1
	movl	%ebp, %eax
	cmpl	$0, (%r15,%rax,4)
	je	.LBB3_11
# %bb.10:                               #   in Loop: Header=BB3_9 Depth=1
	movl	$.L.str.7, %esi
	movq	%r14, %rdi
	movl	%ebp, %edx
	xorl	%eax, %eax
	callq	fprintf
.LBB3_11:                               #   in Loop: Header=BB3_9 Depth=1
	incl	%ebp
	cmpl	%ebx, %ebp
	jbe	.LBB3_9
.LBB3_12:                               # %._crit_edge31
	movq	%r14, %rdi
	callq	fclose
	movq	%r15, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.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
	jmp	_ZdaPv                          # TAILCALL
.Lfunc_end3:
	.size	_Z6onHostiPPc, .Lfunc_end3-_Z6onHostiPPc
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	_Z6onHostiPPc
	xorl	%eax, %eax
	popq	%rcx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	main, .Lfunc_end4-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	.LBB5_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB5_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z5sievePjjjj, %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_end5:
	.size	__hip_module_ctor, .Lfunc_end5-__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	.LBB6_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
.LBB6_2:
	retq
.Lfunc_end6:
	.size	__hip_module_dtor, .Lfunc_end6-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z5sievePjjjj,@object           # @_Z5sievePjjjj
	.section	.rodata,"a",@progbits
	.globl	_Z5sievePjjjj
	.p2align	3, 0x0
_Z5sievePjjjj:
	.quad	_Z20__device_stub__sievePjjjj
	.size	_Z5sievePjjjj, 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	"%i"
	.size	.L.str.1, 3

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Error: %s\n"
	.size	.L.str.2, 11

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Input error.\n"
	.size	.L.str.3, 14

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"problem_output.txt"
	.size	.L.str.4, 19

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

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Problem opening output file.\n"
	.size	.L.str.6, 30

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"%u "
	.size	.L.str.7, 4

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Usage: ./sieve problem_input"
	.size	.L.str.8, 29

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z5sievePjjjj"
	.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

	.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 _Z20__device_stub__sievePjjjj
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z5sievePjjjj
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z5sievePjjjj           ; -- Begin function _Z5sievePjjjj
	.globl	_Z5sievePjjjj
	.p2align	8
	.type	_Z5sievePjjjj,@function
_Z5sievePjjjj:                          ; @_Z5sievePjjjj
; %bb.0:
	s_load_b128 s[4:7], s[0:1], 0x8
	v_lshl_add_u32 v0, s15, 5, v0
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cmp_le_u32_e32 vcc_lo, s5, v0
	v_cmp_ge_u32_e64 s2, s6, v0
	s_and_b32 s3, vcc_lo, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s2, s3
	s_cbranch_execz .LBB0_3
; %bb.1:
	s_load_b64 s[0:1], s[0:1], 0x0
	v_ashrrev_i32_e32 v1, 31, v0
	v_cvt_f32_u32_e32 v3, s4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	v_rcp_iflag_f32_e32 v3, v3
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v3, 0x4f7ffffe, v3
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_cvt_u32_f32_e32 v3, v3
	s_sub_i32 s0, 0, s4
	global_load_b32 v2, v[0:1], off
	v_mul_lo_u32 v4, s0, v3
	v_mul_hi_u32 v4, v3, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v3, v3, v4
	s_waitcnt vmcnt(0)
	v_mul_hi_u32 v3, v2, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v3, v3, s4
	v_sub_nc_u32_e32 v2, v2, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_subrev_nc_u32_e32 v3, s4, v2
	v_cmp_le_u32_e32 vcc_lo, s4, v2
	v_cndmask_b32_e32 v2, v2, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_subrev_nc_u32_e32 v3, s4, v2
	v_cmp_le_u32_e32 vcc_lo, s4, v2
	v_cndmask_b32_e32 v2, v2, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_eq_u32_e32 vcc_lo, 0, v2
	s_and_b32 exec_lo, exec_lo, vcc_lo
	s_cbranch_execz .LBB0_3
; %bb.2:
	v_mov_b32_e32 v2, 0
	global_store_b32 v[0:1], v2, off
.LBB0_3:
	s_or_b32 exec_lo, exec_lo, s2
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z5sievePjjjj
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 20
		.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 5
		.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	_Z5sievePjjjj, .Lfunc_end0-_Z5sievePjjjj
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 268
; NumSgprs: 18
; NumVgprs: 5
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 5
; 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:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 20
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z5sievePjjjj
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z5sievePjjjj.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     5
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
