#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include <vector>
#include <sstream>

#define N (2048*2048)
#define THREADS_PER_BLOCK 51

using namespace std;

__global__ void lastDigit(int *a, int *b) {
        int index = threadIdx.x + blockIdx.x * blockDim.x;
        b[index] = a[index]%10;
}

__global__ void find_maximum_kernel(int *array, int *min, int *mutex, unsigned int n)
{
	unsigned int index = threadIdx.x + blockIdx.x*blockDim.x;
	unsigned int stride = gridDim.x*blockDim.x;
	unsigned int offset = 0;

	__shared__ float cache[256];


	float temp = -1.0;
	while(index + offset < n){
	temp = fminf(temp, array[index + offset]);

	offset += stride;
	}

	cache[threadIdx.x] = temp;

	__syncthreads();


	// reduction
	unsigned int i = blockDim.x/2;
	while(i != 0){
		if(threadIdx.x < i){
			cache[threadIdx.x] = fminf(cache[threadIdx.x], cache[threadIdx.x + i]);
		}

	__syncthreads();
	i /= 2;
	}

	if(threadIdx.x == 0){
		while(atomicCAS(mutex,0,1) != 0);  //lock
			*min = fminf(*min, cache[0]);
	atomicExch(mutex, 0);  //unlock
	}
}



int main()
{
        std::ifstream ifs;
        ifs.open("inp.txt", std::ifstream::in);
        std::string temp;
        std::getline(ifs, temp);


        vector<int> vect;

        std::stringstream ss(temp);

        int i;

        while (ss >> i)
        {
                vect.push_back(i);

                if (ss.peek() == ',' || ss.peek() == ' ' )
                        ss.ignore();
        }

        ifs.close();
        int *h_array;
	int *d_array;
	int *h_min;
	int *d_min;
	int *d_mutex;
	
	h_array = (int*)malloc(N*sizeof(int));
	h_min = (int*)malloc(sizeof(int));
	cudaMalloc((void**)&d_array, N*sizeof(int));
	cudaMalloc((void**)&d_min, sizeof(int));
	cudaMalloc((void**)&d_mutex, sizeof(int));
	cudaMemset(d_min, 0, sizeof(int));
	cudaMemset(d_mutex, 0, sizeof(int));
	//populate array
	for(i = 0; i < vect.size(); i++){
               h_array[i] = vect[i]; 
        }

        int size = vect.size() * sizeof(int);
        

	cudaMemcpy(d_array, h_array, N*sizeof(int), cudaMemcpyHostToDevice);
	dim3 gridSize = 256;
	dim3 blockSize = 256;
	find_maximum_kernel<<< gridSize, blockSize >>>(d_array, d_min, d_mutex, N);
	
	cudaMemcpy(h_min, d_min, sizeof(float), cudaMemcpyDeviceToHost);

	ofstream q1a;
	q1a.open ("q1a.txt");
	q1a << *h_min;
	q1a.close();
	






	//part b
	int *d_b_array;
	int *h_array_b_solution;
	int *d_array_b_solution;
	
        //b = (int *)malloc(size);
	
	h_array_b_solution = (int*)malloc(N*sizeof(int));
        cudaMalloc((void **)&d_array_b_solution, size);
        cudaMalloc((void **)&d_b_array, size);
	
	cudaMemcpy(d_b_array, h_array, size, cudaMemcpyHostToDevice);
        lastDigit<<<N/THREADS_PER_BLOCK,THREADS_PER_BLOCK>>>(d_b_array, d_array_b_solution);

        cudaMemcpy(h_array_b_solution, d_array_b_solution, size, cudaMemcpyDeviceToHost);
        
	ofstream q1b;
	q1b.open ("q1b.txt");
	
	for(i = 0; i < vect.size(); i++){
                printf("%d, ", h_array_b_solution[i]);
        	q1b << h_array_b_solution[i] << ",";
	}
	q1b.close();

	free(h_array);
	free(h_min);
	free(h_array_b_solution);
	cudaFree(d_array);
	cudaFree(d_min);
	cudaFree(d_mutex);
	cudaFree(d_b_array);
	cudaFree(d_array_b_solution);
        return 0;
}

	.file	"tmpxft_00239db5_00000000-6_q1.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4200:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4200:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z30__device_stub__Z9lastDigitPiS_PiS_
	.type	_Z30__device_stub__Z9lastDigitPiS_PiS_, @function
_Z30__device_stub__Z9lastDigitPiS_PiS_:
.LFB4222:
	.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	.L2
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z9lastDigitPiS_(%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
.L2:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4222:
	.size	_Z30__device_stub__Z9lastDigitPiS_PiS_, .-_Z30__device_stub__Z9lastDigitPiS_PiS_
	.globl	_Z9lastDigitPiS_
	.type	_Z9lastDigitPiS_, @function
_Z9lastDigitPiS_:
.LFB4223:
	.cfi_startproc
	endbr64
	jmp	_Z30__device_stub__Z9lastDigitPiS_PiS_
	.cfi_endproc
.LFE4223:
	.size	_Z9lastDigitPiS_, .-_Z9lastDigitPiS_
	.globl	_Z44__device_stub__Z19find_maximum_kernelPiS_S_jPiS_S_j
	.type	_Z44__device_stub__Z19find_maximum_kernelPiS_S_jPiS_S_j, @function
_Z44__device_stub__Z19find_maximum_kernelPiS_S_jPiS_S_j:
.LFB4224:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 4(%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	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%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	_Z19find_maximum_kernelPiS_S_j(%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
.LFE4224:
	.size	_Z44__device_stub__Z19find_maximum_kernelPiS_S_jPiS_S_j, .-_Z44__device_stub__Z19find_maximum_kernelPiS_S_jPiS_S_j
	.globl	_Z19find_maximum_kernelPiS_S_j
	.type	_Z19find_maximum_kernelPiS_S_j, @function
_Z19find_maximum_kernelPiS_S_j:
.LFB4225:
	.cfi_startproc
	endbr64
	jmp	_Z44__device_stub__Z19find_maximum_kernelPiS_S_jPiS_S_j
	.cfi_endproc
.LFE4225:
	.size	_Z19find_maximum_kernelPiS_S_j, .-_Z19find_maximum_kernelPiS_S_j
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z19find_maximum_kernelPiS_S_j"
.LC1:
	.string	"_Z9lastDigitPiS_"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4227:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z19find_maximum_kernelPiS_S_j(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC1(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z9lastDigitPiS_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4227:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZNSt6vectorIiSaIiEED2Ev,"axG",@progbits,_ZNSt6vectorIiSaIiEED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorIiSaIiEED2Ev
	.type	_ZNSt6vectorIiSaIiEED2Ev, @function
_ZNSt6vectorIiSaIiEED2Ev:
.LFB4565:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L15
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L15:
	ret
	.cfi_endproc
.LFE4565:
	.size	_ZNSt6vectorIiSaIiEED2Ev, .-_ZNSt6vectorIiSaIiEED2Ev
	.weak	_ZNSt6vectorIiSaIiEED1Ev
	.set	_ZNSt6vectorIiSaIiEED1Ev,_ZNSt6vectorIiSaIiEED2Ev
	.section	.rodata._ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_.str1.1,"aMS",@progbits,1
.LC2:
	.string	"vector::_M_realloc_insert"
	.section	.text._ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_,"axG",@progbits,_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_,comdat
	.align 2
	.weak	_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_
	.type	_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_, @function
_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_:
.LFB4785:
	.cfi_startproc
	endbr64
	movabsq	$2305843009213693951, %rcx
	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
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	8(%rdi), %rax
	movq	(%rdi), %r14
	movq	%rax, %rbx
	movq	%rax, (%rsp)
	subq	%r14, %rbx
	sarq	$2, %rbx
	cmpq	%rcx, %rbx
	jne	.L18
	leaq	.LC2(%rip), %rdi
	call	_ZSt20__throw_length_errorPKc@PLT
.L18:
	cmpq	%r14, (%rsp)
	movl	$1, %eax
	movq	%rsi, %r15
	movq	%rdi, %r13
	cmovne	%rbx, %rax
	movq	%rsi, %rbp
	addq	%rax, %rbx
	setc	%al
	subq	%r14, %r15
	movzbl	%al, %eax
	testq	%rax, %rax
	jne	.L28
	xorl	%r12d, %r12d
	testq	%rbx, %rbx
	je	.L23
	movabsq	$2305843009213693951, %rax
	cmpq	%rax, %rbx
	cmova	%rax, %rbx
	jmp	.L22
.L28:
	movq	%rcx, %rbx
.L22:
	leaq	0(,%rbx,4), %rdi
	movq	%rdx, 8(%rsp)
	call	_Znwm@PLT
	movq	8(%rsp), %rdx
	movq	%rax, %r12
.L23:
	movl	(%rdx), %eax
	movl	%eax, (%r12,%r15)
	testq	%r15, %r15
	jle	.L24
	movq	%r15, %rdx
	movq	%r14, %rsi
	movq	%r12, %rdi
	call	memmove@PLT
.L24:
	movq	(%rsp), %rax
	leaq	4(%r12,%r15), %rdx
	subq	%rbp, %rax
	testq	%rax, %rax
	jle	.L25
	movq	%rdx, %rdi
	movq	%rbp, %rsi
	movq	%rax, %rcx
	rep movsb
.L25:
	leaq	(%rdx,%rax), %rbp
	testq	%r14, %r14
	je	.L26
	movq	16(%r13), %rsi
	movq	%r14, %rdi
	subq	%r14, %rsi
	call	_ZdlPvm@PLT
.L26:
	leaq	(%r12,%rbx,4), %rax
	movq	%r12, 0(%r13)
	movq	%rbp, 8(%r13)
	movq	%rax, 16(%r13)
	addq	$24, %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
.LFE4785:
	.size	_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_, .-_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_
	.section	.rodata.str1.1
.LC3:
	.string	"inp.txt"
.LC4:
	.string	"q1a.txt"
.LC5:
	.string	"q1b.txt"
.LC6:
	.string	"%d, "
.LC7:
	.string	","
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB4186:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4186
	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
	subq	$2136, %rsp
	.cfi_def_cfa_offset 2192
	movq	%fs:40, %rax
	movq	%rax, 2120(%rsp)
	xorl	%eax, %eax
	leaq	1600(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 16(%rsp)
.LEHB0:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE0:
	movq	16(%rsp), %rdi
	movl	$8, %edx
	leaq	.LC3(%rip), %rsi
.LEHB1:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
.LEHE1:
	leaq	168(%rsp), %rax
	xorl	%ecx, %ecx
	movb	$0, 168(%rsp)
	movq	%rax, 152(%rsp)
	movq	1600(%rsp), %rax
	movq	%rcx, 160(%rsp)
	movq	-24(%rax), %rax
	movq	1840(%rsp,%rax), %rbx
	leaq	152(%rsp), %rax
	movq	%rax, 24(%rsp)
	testq	%rbx, %rbx
	jne	.L36
	movq	2120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L72
.LEHB2:
	call	_ZSt16__throw_bad_castv@PLT
.L36:
	cmpb	$0, 56(%rbx)
	je	.L38
	movb	67(%rbx), %al
	jmp	.L39
.L38:
	movq	%rbx, %rdi
	call	_ZNKSt5ctypeIcE13_M_widen_initEv@PLT
	movq	(%rbx), %rax
	movl	$10, %esi
	movq	%rbx, %rdi
	call	*48(%rax)
.L39:
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdi
	movsbl	%al, %edx
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_@PLT
.LEHE2:
	xorl	%edx, %edx
	leaq	184(%rsp), %rax
	movq	24(%rsp), %rsi
	movq	%rdx, 128(%rsp)
	movq	%rax, %rdi
	movq	%rdx, 136(%rsp)
	movq	%rdx, 144(%rsp)
	movl	$24, %edx
	movq	%rax, (%rsp)
.LEHB3:
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1ERKNS_12basic_stringIcS2_S3_EESt13_Ios_Openmode@PLT
.LEHE3:
	leaq	36(%rsp), %rbx
.L40:
	movq	(%rsp), %rdi
	movq	%rbx, %rsi
.LEHB4:
	call	_ZNSirsERi@PLT
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	jne	.L75
	movq	136(%rsp), %rsi
	cmpq	144(%rsp), %rsi
	je	.L41
	movl	36(%rsp), %eax
	addq	$4, %rsi
	movl	%eax, -4(%rsi)
	movq	%rsi, 136(%rsp)
	jmp	.L42
.L41:
	leaq	128(%rsp), %rdi
	movq	%rbx, %rdx
	call	_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_
.L42:
	movq	(%rsp), %rdi
	call	_ZNSi4peekEv@PLT
	cmpl	$44, %eax
	jne	.L43
.L45:
	movq	(%rsp), %rdi
	call	_ZNSi6ignoreEv@PLT
	jmp	.L40
.L43:
	movq	(%rsp), %rdi
	call	_ZNSi4peekEv@PLT
	cmpl	$32, %eax
	jne	.L40
	jmp	.L45
.L75:
	movq	16(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv@PLT
	movl	$16777216, %edi
	call	malloc@PLT
	movl	$4, %edi
	movq	%rax, %r12
	call	malloc@PLT
	leaq	40(%rsp), %rdi
	movl	$16777216, %esi
	movq	%rax, %r13
	call	cudaMalloc@PLT
	leaq	48(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	leaq	56(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movq	48(%rsp), %rdi
	movl	$4, %edx
	xorl	%esi, %esi
	call	cudaMemset@PLT
	movq	56(%rsp), %rdi
	movl	$4, %edx
	xorl	%esi, %esi
	call	cudaMemset@PLT
	movq	128(%rsp), %rcx
	movq	136(%rsp), %rbx
	xorl	%eax, %eax
	movl	%eax, 36(%rsp)
	subq	%rcx, %rbx
	movq	%rbx, %r14
	sarq	$2, %r14
.L47:
	movslq	36(%rsp), %rdx
	movq	%rdx, %rax
	cmpq	%r14, %rdx
	jnb	.L76
	movl	(%rcx,%rdx,4), %esi
	incl	%eax
	movl	%eax, 36(%rsp)
	movl	%esi, (%r12,%rdx,4)
	jmp	.L47
.L76:
	movq	40(%rsp), %rdi
	movl	$1, %ecx
	movl	$16777216, %edx
	movq	%r12, %rsi
	call	cudaMemcpy@PLT
	movl	$16777217, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	salq	$8, %rdi
	movl	$1, %esi
	movq	%rdi, %rdx
	call	__cudaPushCallConfiguration@PLT
	movq	48(%rsp), %rsi
	testl	%eax, %eax
	jne	.L49
	movq	56(%rsp), %rdx
	movq	40(%rsp), %rdi
	movl	$4194304, %ecx
	call	_Z44__device_stub__Z19find_maximum_kernelPiS_S_jPiS_S_j
.L49:
	movq	48(%rsp), %rsi
	movl	$2, %ecx
	movl	$4, %edx
	movq	%r13, %rdi
	call	cudaMemcpy@PLT
	leaq	576(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE4:
	movq	8(%rsp), %rdi
	movl	$16, %edx
	leaq	.LC4(%rip), %rsi
.LEHB5:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	movl	0(%r13), %esi
	movq	8(%rsp), %rdi
	call	_ZNSolsEi@PLT
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
	movl	$16777216, %edi
	movslq	%ebx, %rbx
	call	malloc@PLT
	leaq	72(%rsp), %rdi
	movq	%rbx, %rsi
	movq	%rax, %rbp
	call	cudaMalloc@PLT
	leaq	64(%rsp), %rdi
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	movq	64(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rdx
	movq	%r12, %rsi
	call	cudaMemcpy@PLT
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	movl	$1, %esi
	movabsq	$4294967347, %rdx
	movabsq	$4295049537, %rdi
	call	__cudaPushCallConfiguration@PLT
	movq	72(%rsp), %rsi
	testl	%eax, %eax
	jne	.L50
	movq	64(%rsp), %rdi
	call	_Z30__device_stub__Z9lastDigitPiS_PiS_
.L50:
	movq	72(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdx
	movq	%rbp, %rdi
	call	cudaMemcpy@PLT
	leaq	1088(%rsp), %rbx
	movq	%rbx, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE5:
	movl	$16, %edx
	leaq	.LC5(%rip), %rsi
	movq	%rbx, %rdi
.LEHB6:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	xorl	%eax, %eax
	leaq	.LC6(%rip), %r15
.L51:
	movl	%eax, 36(%rsp)
	cltq
	cmpq	%r14, %rax
	jnb	.L77
	movl	0(%rbp,%rax,4), %edx
	movq	%r15, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movslq	36(%rsp), %rax
	movq	%rbx, %rdi
	movl	0(%rbp,%rax,4), %esi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	movl	$1, %edx
	leaq	.LC7(%rip), %rsi
	call	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT
	movl	36(%rsp), %eax
	incl	%eax
	jmp	.L51
.L77:
	movq	%rbx, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%r13, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movq	48(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
	movq	72(%rsp), %rdi
	call	cudaFree@PLT
.LEHE6:
	movq	%rbx, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	leaq	184(%rsp), %rdi
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev@PLT
	leaq	128(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	leaq	152(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	leaq	1600(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	2120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L60
	jmp	.L72
.L67:
	endbr64
	movq	%rax, %rbp
.L53:
	movq	%rbx, %rdi
	movq	%rbp, %rbx
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L54
.L66:
	endbr64
	movq	%rax, %rbx
.L54:
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L55
.L65:
	endbr64
	movq	%rax, %rbx
.L55:
	movq	(%rsp), %rdi
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev@PLT
	jmp	.L56
.L64:
	endbr64
	movq	%rax, %rbx
.L56:
	leaq	128(%rsp), %rdi
	call	_ZNSt6vectorIiSaIiEED1Ev
	jmp	.L57
.L63:
	endbr64
	movq	%rax, %rbx
.L57:
	movq	24(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	jmp	.L58
.L62:
	endbr64
	movq	%rax, %rbx
.L58:
	movq	16(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	2120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L72
	movq	%rbx, %rdi
.LEHB7:
	call	_Unwind_Resume@PLT
.LEHE7:
.L72:
	call	__stack_chk_fail@PLT
.L60:
	addq	$2136, %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
.LFE4186:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4186:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4186-.LLSDACSB4186
.LLSDACSB4186:
	.uleb128 .LEHB0-.LFB4186
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB4186
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L62-.LFB4186
	.uleb128 0
	.uleb128 .LEHB2-.LFB4186
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L63-.LFB4186
	.uleb128 0
	.uleb128 .LEHB3-.LFB4186
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L64-.LFB4186
	.uleb128 0
	.uleb128 .LEHB4-.LFB4186
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L65-.LFB4186
	.uleb128 0
	.uleb128 .LEHB5-.LFB4186
	.uleb128 .LEHE5-.LEHB5
	.uleb128 .L66-.LFB4186
	.uleb128 0
	.uleb128 .LEHB6-.LFB4186
	.uleb128 .LEHE6-.LEHB6
	.uleb128 .L67-.LFB4186
	.uleb128 0
	.uleb128 .LEHB7-.LFB4186
	.uleb128 .LEHE7-.LEHB7
	.uleb128 0
	.uleb128 0
.LLSDACSE4186:
	.section	.text.startup
	.size	main, .-main
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include <vector>
#include <sstream>

#define N (2048*2048)
#define THREADS_PER_BLOCK 51

using namespace std;

__global__ void lastDigit(int *a, int *b) {
        int index = threadIdx.x + blockIdx.x * blockDim.x;
        b[index] = a[index]%10;
}

__global__ void find_maximum_kernel(int *array, int *min, int *mutex, unsigned int n)
{
	unsigned int index = threadIdx.x + blockIdx.x*blockDim.x;
	unsigned int stride = gridDim.x*blockDim.x;
	unsigned int offset = 0;

	__shared__ float cache[256];


	float temp = -1.0;
	while(index + offset < n){
	temp = fminf(temp, array[index + offset]);

	offset += stride;
	}

	cache[threadIdx.x] = temp;

	__syncthreads();


	// reduction
	unsigned int i = blockDim.x/2;
	while(i != 0){
		if(threadIdx.x < i){
			cache[threadIdx.x] = fminf(cache[threadIdx.x], cache[threadIdx.x + i]);
		}

	__syncthreads();
	i /= 2;
	}

	if(threadIdx.x == 0){
		while(atomicCAS(mutex,0,1) != 0);  //lock
			*min = fminf(*min, cache[0]);
	atomicExch(mutex, 0);  //unlock
	}
}



int main()
{
        std::ifstream ifs;
        ifs.open("inp.txt", std::ifstream::in);
        std::string temp;
        std::getline(ifs, temp);


        vector<int> vect;

        std::stringstream ss(temp);

        int i;

        while (ss >> i)
        {
                vect.push_back(i);

                if (ss.peek() == ',' || ss.peek() == ' ' )
                        ss.ignore();
        }

        ifs.close();
        int *h_array;
	int *d_array;
	int *h_min;
	int *d_min;
	int *d_mutex;
	
	h_array = (int*)malloc(N*sizeof(int));
	h_min = (int*)malloc(sizeof(int));
	hipMalloc((void**)&d_array, N*sizeof(int));
	hipMalloc((void**)&d_min, sizeof(int));
	hipMalloc((void**)&d_mutex, sizeof(int));
	hipMemset(d_min, 0, sizeof(int));
	hipMemset(d_mutex, 0, sizeof(int));
	//populate array
	for(i = 0; i < vect.size(); i++){
               h_array[i] = vect[i]; 
        }

        int size = vect.size() * sizeof(int);
        

	hipMemcpy(d_array, h_array, N*sizeof(int), hipMemcpyHostToDevice);
	dim3 gridSize = 256;
	dim3 blockSize = 256;
	find_maximum_kernel<<< gridSize, blockSize >>>(d_array, d_min, d_mutex, N);
	
	hipMemcpy(h_min, d_min, sizeof(float), hipMemcpyDeviceToHost);

	ofstream q1a;
	q1a.open ("q1a.txt");
	q1a << *h_min;
	q1a.close();
	






	//part b
	int *d_b_array;
	int *h_array_b_solution;
	int *d_array_b_solution;
	
        //b = (int *)malloc(size);
	
	h_array_b_solution = (int*)malloc(N*sizeof(int));
        hipMalloc((void **)&d_array_b_solution, size);
        hipMalloc((void **)&d_b_array, size);
	
	hipMemcpy(d_b_array, h_array, size, hipMemcpyHostToDevice);
        lastDigit<<<N/THREADS_PER_BLOCK,THREADS_PER_BLOCK>>>(d_b_array, d_array_b_solution);

        hipMemcpy(h_array_b_solution, d_array_b_solution, size, hipMemcpyDeviceToHost);
        
	ofstream q1b;
	q1b.open ("q1b.txt");
	
	for(i = 0; i < vect.size(); i++){
                printf("%d, ", h_array_b_solution[i]);
        	q1b << h_array_b_solution[i] << ",";
	}
	q1b.close();

	free(h_array);
	free(h_min);
	free(h_array_b_solution);
	hipFree(d_array);
	hipFree(d_min);
	hipFree(d_mutex);
	hipFree(d_b_array);
	hipFree(d_array_b_solution);
        return 0;
}

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

                                        # End of file scope inline assembly
	.globl	_Z24__device_stub__lastDigitPiS_ # -- Begin function _Z24__device_stub__lastDigitPiS_
	.type	_Z24__device_stub__lastDigitPiS_,@function
_Z24__device_stub__lastDigitPiS_:       # @_Z24__device_stub__lastDigitPiS_
	.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	$_Z9lastDigitPiS_, %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	_Z24__device_stub__lastDigitPiS_, .Lfunc_end0-_Z24__device_stub__lastDigitPiS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z34__device_stub__find_maximum_kernelPiS_S_j # -- Begin function _Z34__device_stub__find_maximum_kernelPiS_S_j
	.type	_Z34__device_stub__find_maximum_kernelPiS_S_j,@function
_Z34__device_stub__find_maximum_kernelPiS_S_j: # @_Z34__device_stub__find_maximum_kernelPiS_S_j
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%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	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z19find_maximum_kernelPiS_S_j, %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_end1:
	.size	_Z34__device_stub__find_maximum_kernelPiS_S_j, .Lfunc_end1-_Z34__device_stub__find_maximum_kernelPiS_S_j
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$2040, %rsp                     # imm = 0x7F8
	.cfi_def_cfa_offset 2096
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	leaq	1520(%rsp), %rbx
	movq	%rbx, %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1Ev
.Ltmp0:
	movl	$.L.str, %esi
	movq	%rbx, %rdi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp1:
# %bb.1:
	leaq	88(%rsp), %rbp
	movq	%rbp, -16(%rbp)
	movq	$0, -8(%rbp)
	movb	$0, (%rbp)
	movq	1520(%rsp), %rax
	addq	-24(%rax), %rbx
.Ltmp3:
	movq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp4:
# %bb.2:                                # %.noexc
.Ltmp5:
	movsbl	%al, %edx
	leaq	1520(%rsp), %rdi
	leaq	72(%rsp), %rsi
	callq	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_
.Ltmp6:
# %bb.3:                                # %_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit
	xorps	%xmm0, %xmm0
	movaps	%xmm0, 16(%rsp)
	movq	$0, 32(%rsp)
.Ltmp8:
	leaq	104(%rsp), %rdi
	leaq	72(%rsp), %rsi
	movl	$24, %edx
	callq	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1ERKNS_12basic_stringIcS2_S3_EESt13_Ios_Openmode
.Ltmp9:
# %bb.4:
	leaq	104(%rsp), %rbx
	leaq	4(%rsp), %r14
	leaq	16(%rsp), %r15
.LBB2_5:                                # =>This Inner Loop Header: Depth=1
.Ltmp11:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_ZNSirsERi
.Ltmp12:
# %bb.6:                                #   in Loop: Header=BB2_5 Depth=1
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB2_15
# %bb.7:                                #   in Loop: Header=BB2_5 Depth=1
	movq	24(%rsp), %rsi
	cmpq	32(%rsp), %rsi
	je	.LBB2_9
# %bb.8:                                #   in Loop: Header=BB2_5 Depth=1
	movl	4(%rsp), %eax
	movl	%eax, (%rsi)
	addq	$4, %rsi
	movq	%rsi, 24(%rsp)
	jmp	.LBB2_10
.LBB2_9:                                #   in Loop: Header=BB2_5 Depth=1
.Ltmp83:
	movq	%r15, %rdi
	movq	%r14, %rdx
	callq	_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_
.Ltmp84:
.LBB2_10:                               # %_ZNSt6vectorIiSaIiEE9push_backERKi.exit
                                        #   in Loop: Header=BB2_5 Depth=1
.Ltmp85:
	movq	%rbx, %rdi
	callq	_ZNSi4peekEv
.Ltmp86:
# %bb.11:                               #   in Loop: Header=BB2_5 Depth=1
	cmpl	$44, %eax
	je	.LBB2_14
# %bb.12:                               #   in Loop: Header=BB2_5 Depth=1
.Ltmp87:
	movq	%rbx, %rdi
	callq	_ZNSi4peekEv
.Ltmp88:
# %bb.13:                               #   in Loop: Header=BB2_5 Depth=1
	cmpl	$32, %eax
	jne	.LBB2_5
.LBB2_14:                               #   in Loop: Header=BB2_5 Depth=1
.Ltmp89:
	movq	%rbx, %rdi
	callq	_ZNSi6ignoreEv
.Ltmp90:
	jmp	.LBB2_5
.LBB2_15:
.Ltmp13:
	leaq	1520(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv
.Ltmp14:
# %bb.16:
	movl	$16777216, %edi                 # imm = 0x1000000
	callq	malloc
	movq	%rax, %rbx
	movl	$4, %edi
	callq	malloc
	movq	%rax, %r14
.Ltmp16:
	leaq	64(%rsp), %rdi
	movl	$16777216, %esi                 # imm = 0x1000000
	callq	hipMalloc
.Ltmp17:
# %bb.17:
.Ltmp18:
	leaq	8(%rsp), %rdi
	movl	$4, %esi
	callq	hipMalloc
.Ltmp19:
# %bb.18:
.Ltmp20:
	leaq	56(%rsp), %rdi
	movl	$4, %esi
	callq	hipMalloc
.Ltmp21:
# %bb.19:
	movq	8(%rsp), %rdi
.Ltmp22:
	movl	$4, %edx
	xorl	%esi, %esi
	callq	hipMemset
.Ltmp23:
# %bb.20:
	movq	56(%rsp), %rdi
.Ltmp24:
	movl	$4, %edx
	xorl	%esi, %esi
	callq	hipMemset
.Ltmp25:
# %bb.21:                               # %.preheader67
	movq	16(%rsp), %rax
	movq	24(%rsp), %rcx
	movq	%rcx, %r13
	subq	%rax, %r13
	sarq	$2, %r13
	movl	$0, 4(%rsp)
	cmpq	%rax, %rcx
	je	.LBB2_24
# %bb.22:                               # %.lr.ph.preheader
	cmpq	$1, %r13
	movq	%r13, %rcx
	adcq	$0, %rcx
	xorl	%edx, %edx
.LBB2_23:                               # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	(%rax,%rdx,4), %esi
	movl	%esi, (%rbx,%rdx,4)
	incq	%rdx
	movl	%edx, 4(%rsp)
	cmpq	%rdx, %rcx
	jne	.LBB2_23
.LBB2_24:                               # %._crit_edge
	movq	64(%rsp), %rdi
.Ltmp27:
	movl	$16777216, %edx                 # imm = 0x1000000
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp28:
# %bb.25:
.Ltmp30:
	movabsq	$4294967552, %rdi               # imm = 0x100000100
	movl	$1, %esi
	movq	%rdi, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp31:
# %bb.26:
	testl	%eax, %eax
	jne	.LBB2_28
# %bb.27:
	movq	64(%rsp), %rdi
	movq	8(%rsp), %rsi
	movq	56(%rsp), %rdx
.Ltmp32:
	movl	$4194304, %ecx                  # imm = 0x400000
	callq	_Z34__device_stub__find_maximum_kernelPiS_S_j
.Ltmp33:
.LBB2_28:
	movq	8(%rsp), %rsi
.Ltmp34:
	movl	$4, %edx
	movq	%r14, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp35:
# %bb.29:
.Ltmp37:
	leaq	1008(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev
.Ltmp38:
# %bb.30:
.Ltmp40:
	leaq	1008(%rsp), %rdi
	movl	$.L.str.1, %esi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp41:
# %bb.31:
	movl	(%r14), %esi
.Ltmp42:
	leaq	1008(%rsp), %rdi
	callq	_ZNSolsEi
.Ltmp43:
# %bb.32:
.Ltmp44:
	leaq	1008(%rsp), %r15
	movq	%r15, %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp45:
# %bb.33:
	shll	$2, %r13d
	movl	$16777216, %edi                 # imm = 0x1000000
	callq	malloc
	movq	%rax, %r12
	movslq	%r13d, %r13
.Ltmp47:
	leaq	40(%rsp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
.Ltmp48:
# %bb.34:
.Ltmp49:
	leaq	48(%rsp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
.Ltmp50:
# %bb.35:
	movq	48(%rsp), %rdi
.Ltmp51:
	movq	%rbx, %rsi
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp52:
# %bb.36:
.Ltmp53:
	movabsq	$4295049537, %rdi               # imm = 0x100014141
	movabsq	$4294967347, %rdx               # imm = 0x100000033
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp54:
# %bb.37:
	testl	%eax, %eax
	jne	.LBB2_39
# %bb.38:
	movq	48(%rsp), %rdi
	movq	40(%rsp), %rsi
.Ltmp55:
	callq	_Z24__device_stub__lastDigitPiS_
.Ltmp56:
.LBB2_39:
	movq	40(%rsp), %rsi
.Ltmp57:
	movq	%r12, %rdi
	movq	%r13, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp58:
# %bb.40:
.Ltmp60:
	leaq	496(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev
.Ltmp61:
# %bb.41:
.Ltmp63:
	leaq	496(%rsp), %rdi
	movl	$.L.str.2, %esi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp64:
# %bb.42:                               # %.preheader
	movl	$0, 4(%rsp)
	movq	24(%rsp), %rax
	cmpq	16(%rsp), %rax
	je	.LBB2_47
# %bb.43:                               # %.lr.ph75.preheader
	leaq	496(%rsp), %r13
	xorl	%eax, %eax
.LBB2_44:                               # %.lr.ph75
                                        # =>This Inner Loop Header: Depth=1
	movl	(%r12,%rax,4), %esi
	movl	$.L.str.3, %edi
	xorl	%eax, %eax
	callq	printf
	movslq	4(%rsp), %rax
	movl	(%r12,%rax,4), %esi
.Ltmp65:
	movq	%r13, %rdi
	callq	_ZNSolsEi
.Ltmp66:
# %bb.45:                               #   in Loop: Header=BB2_44 Depth=1
.Ltmp67:
	movl	$.L.str.4, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp68:
# %bb.46:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
                                        #   in Loop: Header=BB2_44 Depth=1
	movslq	4(%rsp), %rax
	incq	%rax
	movl	%eax, 4(%rsp)
	movq	24(%rsp), %rcx
	subq	16(%rsp), %rcx
	sarq	$2, %rcx
	cmpq	%rax, %rcx
	ja	.LBB2_44
.LBB2_47:                               # %._crit_edge76
.Ltmp70:
	leaq	496(%rsp), %r13
	movq	%r13, %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp71:
# %bb.48:
	movq	%rbx, %rdi
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	%r12, %rdi
	callq	free
	movq	64(%rsp), %rdi
.Ltmp72:
	callq	hipFree
.Ltmp73:
# %bb.49:
	movq	8(%rsp), %rdi
.Ltmp74:
	callq	hipFree
.Ltmp75:
# %bb.50:
	movq	56(%rsp), %rdi
.Ltmp76:
	callq	hipFree
.Ltmp77:
# %bb.51:
	movq	48(%rsp), %rdi
.Ltmp78:
	callq	hipFree
.Ltmp79:
# %bb.52:
	movq	40(%rsp), %rdi
.Ltmp80:
	callq	hipFree
.Ltmp81:
# %bb.53:
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rbx
	leaq	504(%rsp), %rdi
	movq	%rbx, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %r14
	movq	-24(%rbx), %rax
	movq	%r14, 496(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	movl	$248, %r12d
	addq	%r12, %r13
	movq	%r13, %rdi
	callq	_ZNSt8ios_baseD2Ev
	leaq	1016(%rsp), %rdi
	movq	%rbx, -8(%rdi)
	movq	-24(%rbx), %rax
	movq	%r14, 1008(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	addq	%r12, %r15
	movq	%r15, %rdi
	callq	_ZNSt8ios_baseD2Ev
	leaq	104(%rsp), %rdi
	movl	$_ZTTNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE, %esi
	callq	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED2Ev
	leaq	232(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	movq	16(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB2_55
# %bb.54:
	callq	_ZdlPv
.LBB2_55:                               # %_ZNSt6vectorIiSaIiEED2Ev.exit
	movq	72(%rsp), %rdi
	cmpq	%rbp, %rdi
	je	.LBB2_57
# %bb.56:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB2_57:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	leaq	1520(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	xorl	%eax, %eax
	addq	$2040, %rsp                     # imm = 0x7F8
	.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
.LBB2_58:
	.cfi_def_cfa_offset 2096
.Ltmp62:
	jmp	.LBB2_69
.LBB2_59:
.Ltmp39:
	jmp	.LBB2_75
.LBB2_60:
.Ltmp29:
	jmp	.LBB2_75
.LBB2_61:                               # %.loopexit.split-lp69
.Ltmp15:
	jmp	.LBB2_75
.LBB2_62:
.Ltmp10:
	movq	%rax, %rbx
	jmp	.LBB2_77
.LBB2_63:
.Ltmp2:
	movq	%rax, %rbx
	jmp	.LBB2_81
.LBB2_64:
.Ltmp7:
	movq	%rax, %rbx
	jmp	.LBB2_79
.LBB2_65:
.Ltmp36:
	jmp	.LBB2_75
.LBB2_66:
.Ltmp46:
	jmp	.LBB2_69
.LBB2_67:
.Ltmp26:
	jmp	.LBB2_75
.LBB2_68:
.Ltmp59:
.LBB2_69:
	movq	%rax, %rbx
	jmp	.LBB2_73
.LBB2_70:                               # %.loopexit.split-lp
.Ltmp82:
	jmp	.LBB2_72
.LBB2_71:                               # %.loopexit
.Ltmp69:
.LBB2_72:
	movq	%rax, %rbx
	leaq	496(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
.LBB2_73:
	leaq	1008(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
	jmp	.LBB2_76
.LBB2_74:                               # %.loopexit68
.Ltmp91:
.LBB2_75:
	movq	%rax, %rbx
.LBB2_76:
	leaq	104(%rsp), %rdi
	movl	$_ZTTNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE, %esi
	callq	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED2Ev
	leaq	232(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
.LBB2_77:
	movq	16(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB2_79
# %bb.78:
	callq	_ZdlPv
.LBB2_79:
	movq	72(%rsp), %rdi
	cmpq	%rbp, %rdi
	je	.LBB2_81
# %bb.80:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i58
	callq	_ZdlPv
.LBB2_81:
	leaq	1520(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end2:
	.size	main, .Lfunc_end2-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table2:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp2-.Lfunc_begin0           #     jumps to .Ltmp2
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp3-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp6-.Ltmp3                  #   Call between .Ltmp3 and .Ltmp6
	.uleb128 .Ltmp7-.Lfunc_begin0           #     jumps to .Ltmp7
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp8-.Lfunc_begin0           # >> Call Site 4 <<
	.uleb128 .Ltmp9-.Ltmp8                  #   Call between .Ltmp8 and .Ltmp9
	.uleb128 .Ltmp10-.Lfunc_begin0          #     jumps to .Ltmp10
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp11-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp90-.Ltmp11                #   Call between .Ltmp11 and .Ltmp90
	.uleb128 .Ltmp91-.Lfunc_begin0          #     jumps to .Ltmp91
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp13-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp14-.Ltmp13                #   Call between .Ltmp13 and .Ltmp14
	.uleb128 .Ltmp15-.Lfunc_begin0          #     jumps to .Ltmp15
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp16-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp25-.Ltmp16                #   Call between .Ltmp16 and .Ltmp25
	.uleb128 .Ltmp26-.Lfunc_begin0          #     jumps to .Ltmp26
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp27-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp28-.Ltmp27                #   Call between .Ltmp27 and .Ltmp28
	.uleb128 .Ltmp29-.Lfunc_begin0          #     jumps to .Ltmp29
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp30-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Ltmp35-.Ltmp30                #   Call between .Ltmp30 and .Ltmp35
	.uleb128 .Ltmp36-.Lfunc_begin0          #     jumps to .Ltmp36
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp37-.Lfunc_begin0          # >> Call Site 10 <<
	.uleb128 .Ltmp38-.Ltmp37                #   Call between .Ltmp37 and .Ltmp38
	.uleb128 .Ltmp39-.Lfunc_begin0          #     jumps to .Ltmp39
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp40-.Lfunc_begin0          # >> Call Site 11 <<
	.uleb128 .Ltmp45-.Ltmp40                #   Call between .Ltmp40 and .Ltmp45
	.uleb128 .Ltmp46-.Lfunc_begin0          #     jumps to .Ltmp46
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp47-.Lfunc_begin0          # >> Call Site 12 <<
	.uleb128 .Ltmp58-.Ltmp47                #   Call between .Ltmp47 and .Ltmp58
	.uleb128 .Ltmp59-.Lfunc_begin0          #     jumps to .Ltmp59
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp60-.Lfunc_begin0          # >> Call Site 13 <<
	.uleb128 .Ltmp61-.Ltmp60                #   Call between .Ltmp60 and .Ltmp61
	.uleb128 .Ltmp62-.Lfunc_begin0          #     jumps to .Ltmp62
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp63-.Lfunc_begin0          # >> Call Site 14 <<
	.uleb128 .Ltmp64-.Ltmp63                #   Call between .Ltmp63 and .Ltmp64
	.uleb128 .Ltmp82-.Lfunc_begin0          #     jumps to .Ltmp82
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp65-.Lfunc_begin0          # >> Call Site 15 <<
	.uleb128 .Ltmp68-.Ltmp65                #   Call between .Ltmp65 and .Ltmp68
	.uleb128 .Ltmp69-.Lfunc_begin0          #     jumps to .Ltmp69
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp70-.Lfunc_begin0          # >> Call Site 16 <<
	.uleb128 .Ltmp81-.Ltmp70                #   Call between .Ltmp70 and .Ltmp81
	.uleb128 .Ltmp82-.Lfunc_begin0          #     jumps to .Ltmp82
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp81-.Lfunc_begin0          # >> Call Site 17 <<
	.uleb128 .Lfunc_end2-.Ltmp81            #   Call between .Ltmp81 and .Lfunc_end2
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_,"axG",@progbits,_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_,comdat
	.weak	_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_ # -- Begin function _ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_
	.p2align	1, 0x90
	.type	_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_,@function
_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_: # @_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rdx, (%rsp)                    # 8-byte Spill
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movl	$1, %esi
	movl	$.L.str.6, %edx
	callq	_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc
	movq	(%rbx), %r13
	movq	8(%rbx), %r15
	movq	%r12, 8(%rsp)                   # 8-byte Spill
	subq	%r13, %r12
	movq	%r12, %r14
	sarq	$2, %r14
	testq	%rax, %rax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	je	.LBB3_1
# %bb.2:
	movq	%rbx, %rdi
	movq	%rax, %rsi
	xorl	%edx, %edx
	callq	_ZNSt15__new_allocatorIiE8allocateEmPKv
	movq	%rax, %rbp
	jmp	.LBB3_3
.LBB3_1:
	xorl	%ebp, %ebp
.LBB3_3:                                # %_ZNSt12_Vector_baseIiSaIiEE11_M_allocateEm.exit
	movq	(%rsp), %rax                    # 8-byte Reload
	movl	(%rax), %eax
	movl	%eax, (%rbp,%r14,4)
	testq	%r12, %r12
	jle	.LBB3_5
# %bb.4:
	movq	%rbp, %rdi
	movq	%r13, %rsi
	movq	%r12, %rdx
	callq	memmove@PLT
.LBB3_5:                                # %_ZNSt6vectorIiSaIiEE11_S_relocateEPiS2_S2_RS0_.exit
	addq	%rbp, %r12
	addq	$4, %r12
	movq	8(%rsp), %rsi                   # 8-byte Reload
	subq	%rsi, %r15
	testq	%r15, %r15
	jle	.LBB3_7
# %bb.6:
	movq	%r12, %rdi
	movq	%r15, %rdx
	callq	memmove@PLT
.LBB3_7:                                # %_ZNSt6vectorIiSaIiEE11_S_relocateEPiS2_S2_RS0_.exit16
	testq	%r13, %r13
	je	.LBB3_9
# %bb.8:
	movq	%r13, %rdi
	callq	_ZdlPv
.LBB3_9:                                # %_ZNSt12_Vector_baseIiSaIiEE13_M_deallocateEPim.exit
	addq	%r15, %r12
	movq	%rbp, (%rbx)
	movq	%r12, 8(%rbx)
	movq	16(%rsp), %rax                  # 8-byte Reload
	leaq	(,%rax,4), %rax
	addq	%rbp, %rax
	movq	%rax, 16(%rbx)
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_, .Lfunc_end3-_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc,"axG",@progbits,_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc,comdat
	.weak	_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc # -- Begin function _ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc
	.p2align	1, 0x90
	.type	_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc,@function
_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc: # @_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc
	.cfi_startproc
# %bb.0:
	movabsq	$2305843009213693951, %rcx      # imm = 0x1FFFFFFFFFFFFFFF
	movq	8(%rdi), %r8
	subq	(%rdi), %r8
	sarq	$2, %r8
	movq	%rcx, %rax
	subq	%r8, %rax
	cmpq	%rsi, %rax
	jb	.LBB4_2
# %bb.1:
	cmpq	%rsi, %r8
	cmovaq	%r8, %rsi
	leaq	(%rsi,%r8), %rax
	cmpq	%rcx, %rax
	cmovaeq	%rcx, %rax
	addq	%r8, %rsi
	cmovbq	%rcx, %rax
	retq
.LBB4_2:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rdx, %rdi
	callq	_ZSt20__throw_length_errorPKc
.Lfunc_end4:
	.size	_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc, .Lfunc_end4-_ZNKSt6vectorIiSaIiEE12_M_check_lenEmPKc
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt15__new_allocatorIiE8allocateEmPKv,"axG",@progbits,_ZNSt15__new_allocatorIiE8allocateEmPKv,comdat
	.weak	_ZNSt15__new_allocatorIiE8allocateEmPKv # -- Begin function _ZNSt15__new_allocatorIiE8allocateEmPKv
	.p2align	1, 0x90
	.type	_ZNSt15__new_allocatorIiE8allocateEmPKv,@function
_ZNSt15__new_allocatorIiE8allocateEmPKv: # @_ZNSt15__new_allocatorIiE8allocateEmPKv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rsi, %rax
	shrq	$61, %rax
	jne	.LBB5_1
# %bb.3:
	shlq	$2, %rsi
	movq	%rsi, %rdi
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	_Znwm                           # TAILCALL
.LBB5_1:
	.cfi_def_cfa_offset 16
	shrq	$62, %rsi
	je	.LBB5_2
# %bb.4:
	callq	_ZSt28__throw_bad_array_new_lengthv
.LBB5_2:
	callq	_ZSt17__throw_bad_allocv
.Lfunc_end5:
	.size	_ZNSt15__new_allocatorIiE8allocateEmPKv, .Lfunc_end5-_ZNSt15__new_allocatorIiE8allocateEmPKv
	.cfi_endproc
                                        # -- End function
	.text
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB6_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB6_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z9lastDigitPiS_, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z19find_maximum_kernelPiS_S_j, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end6:
	.size	__hip_module_ctor, .Lfunc_end6-__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	.LBB7_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
.LBB7_2:
	retq
.Lfunc_end7:
	.size	__hip_module_dtor, .Lfunc_end7-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z9lastDigitPiS_,@object        # @_Z9lastDigitPiS_
	.section	.rodata,"a",@progbits
	.globl	_Z9lastDigitPiS_
	.p2align	3, 0x0
_Z9lastDigitPiS_:
	.quad	_Z24__device_stub__lastDigitPiS_
	.size	_Z9lastDigitPiS_, 8

	.type	_Z19find_maximum_kernelPiS_S_j,@object # @_Z19find_maximum_kernelPiS_S_j
	.globl	_Z19find_maximum_kernelPiS_S_j
	.p2align	3, 0x0
_Z19find_maximum_kernelPiS_S_j:
	.quad	_Z34__device_stub__find_maximum_kernelPiS_S_j
	.size	_Z19find_maximum_kernelPiS_S_j, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"inp.txt"
	.size	.L.str, 8

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"q1a.txt"
	.size	.L.str.1, 8

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"q1b.txt"
	.size	.L.str.2, 8

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"%d, "
	.size	.L.str.3, 5

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

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"vector::_M_realloc_insert"
	.size	.L.str.6, 26

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z9lastDigitPiS_"
	.size	.L__unnamed_1, 17

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z19find_maximum_kernelPiS_S_j"
	.size	.L__unnamed_2, 31

	.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 _Z24__device_stub__lastDigitPiS_
	.addrsig_sym _Z34__device_stub__find_maximum_kernelPiS_S_j
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z9lastDigitPiS_
	.addrsig_sym _Z19find_maximum_kernelPiS_S_j
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z9lastDigitPiS_        ; -- Begin function _Z9lastDigitPiS_
	.globl	_Z9lastDigitPiS_
	.p2align	8
	.type	_Z9lastDigitPiS_,@function
_Z9lastDigitPiS_:                       ; @_Z9lastDigitPiS_
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x1c
	s_load_b128 s[0:3], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	v_add_co_u32 v2, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s1, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s2, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	global_load_b32 v2, v[2:3], off
	s_waitcnt vmcnt(0)
	v_mul_hi_i32 v3, 0x66666667, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshrrev_b32_e32 v4, 31, v3
	v_ashrrev_i32_e32 v3, 2, v3
	v_add_nc_u32_e32 v3, v3, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v3, v3, 10
	v_sub_nc_u32_e32 v2, v2, v3
	global_store_b32 v[0:1], v2, off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z9lastDigitPiS_
		.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 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	_Z9lastDigitPiS_, .Lfunc_end0-_Z9lastDigitPiS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 164
; 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
	.protected	_Z19find_maximum_kernelPiS_S_j ; -- Begin function _Z19find_maximum_kernelPiS_S_j
	.globl	_Z19find_maximum_kernelPiS_S_j
	.p2align	8
	.type	_Z19find_maximum_kernelPiS_S_j,@function
_Z19find_maximum_kernelPiS_S_j:         ; @_Z19find_maximum_kernelPiS_S_j
; %bb.0:
	s_clause 0x3
	s_load_b32 s8, s[0:1], 0x2c
	s_load_b32 s9, s[0:1], 0x18
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[2:3], s[0:1], 0x10
	s_add_u32 s0, s0, 32
	s_addc_u32 s1, s1, 0
	v_mov_b32_e32 v3, -1.0
	s_mov_b32 s10, exec_lo
	s_waitcnt lgkmcnt(0)
	s_and_b32 s8, s8, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s8, v[0:1]
	v_cmpx_gt_u32_e64 s9, v1
	s_cbranch_execz .LBB1_4
; %bb.1:                                ; %.lr.ph.preheader
	s_load_b32 s1, s[0:1], 0x0
	v_dual_mov_b32 v3, -1.0 :: v_dual_mov_b32 v2, 0
	s_mov_b32 s0, 0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s1, s1, s8
.LBB1_2:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
	v_lshlrev_b64 v[4:5], 2, v[1:2]
	v_add_nc_u32_e32 v1, s1, v1
	v_max_f32_e32 v3, v3, v3
	v_add_co_u32 v4, vcc_lo, s4, v4
	s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_ci_u32_e32 v5, vcc_lo, s5, v5, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s9, v1
	global_load_b32 v4, v[4:5], off
	s_or_b32 s0, vcc_lo, s0
	s_waitcnt vmcnt(0)
	v_cvt_f32_i32_e32 v4, v4
	s_delay_alu instid0(VALU_DEP_1)
	v_min_f32_e32 v3, v3, v4
	s_and_not1_b32 exec_lo, exec_lo, s0
	s_cbranch_execnz .LBB1_2
; %bb.3:                                ; %Flow44
	s_or_b32 exec_lo, exec_lo, s0
.LBB1_4:                                ; %Flow45
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 exec_lo, exec_lo, s10
	v_lshlrev_b32_e32 v1, 2, v0
	s_cmp_lt_u32 s8, 2
	ds_store_b32 v1, v3
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc1 .LBB1_8
.LBB1_5:                                ; %.lr.ph30
                                        ; =>This Inner Loop Header: Depth=1
	s_lshr_b32 s0, s8, 1
	s_mov_b32 s1, exec_lo
	v_cmpx_gt_u32_e64 s0, v0
	s_cbranch_execz .LBB1_7
; %bb.6:                                ;   in Loop: Header=BB1_5 Depth=1
	v_lshl_add_u32 v2, s0, 2, v1
	ds_load_b32 v2, v2
	ds_load_b32 v3, v1
	s_waitcnt lgkmcnt(0)
	v_dual_max_f32 v2, v2, v2 :: v_dual_max_f32 v3, v3, v3
	s_delay_alu instid0(VALU_DEP_1)
	v_min_f32_e32 v2, v3, v2
	ds_store_b32 v1, v2
.LBB1_7:                                ;   in Loop: Header=BB1_5 Depth=1
	s_or_b32 exec_lo, exec_lo, s1
	s_cmp_gt_u32 s8, 3
	s_mov_b32 s8, s0
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc1 .LBB1_5
.LBB1_8:                                ; %._crit_edge31
	s_mov_b32 s0, 0
	s_mov_b32 s1, exec_lo
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB1_12
; %bb.9:                                ; %.preheader.preheader
	v_dual_mov_b32 v0, 1 :: v_dual_mov_b32 v1, 0
.LBB1_10:                               ; %.preheader
                                        ; =>This Inner Loop Header: Depth=1
	global_atomic_cmpswap_b32 v2, v1, v[0:1], s[2:3] glc
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, 0, v2
	s_or_b32 s0, vcc_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s0
	s_cbranch_execnz .LBB1_10
; %bb.11:
	s_or_b32 exec_lo, exec_lo, s0
	v_mov_b32_e32 v0, 0
	global_load_b32 v1, v0, s[6:7]
	ds_load_b32 v2, v0
	s_waitcnt lgkmcnt(0)
	v_max_f32_e32 v2, v2, v2
	s_waitcnt vmcnt(0)
	v_cvt_f32_i32_e32 v1, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_min_f32_e32 v1, v1, v2
	v_cvt_i32_f32_e32 v1, v1
	global_store_b32 v0, v1, s[6:7]
	global_atomic_swap_b32 v0, v0, s[2:3]
.LBB1_12:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z19find_maximum_kernelPiS_S_j
		.amdhsa_group_segment_fixed_size 1024
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.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 6
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z19find_maximum_kernelPiS_S_j, .Lfunc_end1-_Z19find_maximum_kernelPiS_S_j
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 480
; NumSgprs: 18
; NumVgprs: 6
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 1024 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 6
; 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
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         20
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         28
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         30
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         32
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         34
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         36
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         38
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         56
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         80
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 272
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z9lastDigitPiS_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z9lastDigitPiS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     5
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 1024
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z19find_maximum_kernelPiS_S_j
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z19find_maximum_kernelPiS_S_j.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     6
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
