#include <stdio.h>
#include <cuda.h>
#include <string>
#include <iostream>
#include <fstream>
#include "f_eval.cuh"

using namespace std;

__inline__ __host__ __device__ double f_eval(double* p_x, int m);
double* readFile(string input, int *m, int *n);
void writeFile(string output, double* A, int m, int n);

__global__ void jacobian(double *dA, double *dB, int m, int step, int n, double eps)
{
	extern __shared__ double p[];
	double *f = (double*)&p[step];
	// Local line index
	int lli = threadIdx.x*m;
	// Global line index
	int gli = blockIdx.x*step + lli;
	
	if(gli < n*m){
	// Load a block into shared memory
	for(int i = 0; i < m; i++){
		p[lli + i] = dA[gli + i];
	}
	__threadfence();
	
	// Every thread computes partial derivatives at a single point
	for(int i = 0; i < m; i++){
		p[lli + i] += eps;
		__threadfence();
		// f(x1,x2,...,xi+eps,...,xm)
		f[lli + i] = f_eval(p+lli, m);
		
		p[lli + i] -= 2*eps;
		__threadfence();
		// f(x1,x2,...,xi-eps,...,xm)
		f[lli + i] -= f_eval(p+lli, m);
		
		p[lli + i] += eps;
		__threadfence();
		// df/dxi = (f(x1,x2,...,xi+eps,...,xm) - f(x1,x2,...,xi-eps,...,xm))/2/eps
		dB[gli+i] = f[lli + i]/eps/2;
	}
	}
}

int main(int argc, char* argv[])
{
	if(argc != 4){
		printf("USAGE: %s <inputArray.inp> <outfile> <epsilon>\n", argv[0]);
		return 1;
	}

	string inputFN = argv[1];
	string outputFN = argv[2];
	double epsilon = atof(argv[3]);
	int m, n;
	
	cudaEvent_t start_in, stop_in, start_ex, stop_ex;
	cudaEventCreate(&start_in);
	cudaEventCreate(&stop_in);
	cudaEventCreate(&start_ex);
	cudaEventCreate(&stop_ex);
	
	// Read file
	double* A = readFile(inputFN, &m, &n);
	size_t size = sizeof(double)*m*n;
	
	// Allocate memory on the device
	double *dA, *dB;
	cudaMalloc(&dA, size);
	cudaMalloc(&dB, size);
	
	int N_blocks, N_threads;
	// Shared memory is the limiting factor
	// Calculate how many points would fit
	// Division by 2 is because function values are also stored in shared memory
	int a = 48*1024/8/m/2;
	if(a >= n){
		N_threads = n;
		N_blocks = 1;
	} else {
		N_threads = a;
		N_blocks = n/N_threads+1;
	}
	
	//Start inclusive timer
	cudaEventRecord(start_in, 0);
	cudaMemcpy(dA, A, size, cudaMemcpyHostToDevice);
	
	//Start exclusive timer
	cudaEventRecord(start_ex, 0);
	
	jacobian<<<N_blocks, N_threads, sizeof(double)*2*m*N_threads>>>(dA, dB, m, N_threads*m, n, epsilon);
	cudaDeviceSynchronize();
	
	//Stop exclusive timer
	cudaEventRecord(stop_ex, 0);
	cudaEventSynchronize(stop_ex);
	
	cudaMemcpy(A, dB, size, cudaMemcpyDeviceToHost);
	
	//Stop inclusive timer
	cudaEventRecord(stop_in, 0);
	cudaEventSynchronize(stop_in);
	
	float time_in, time_ex;
	cudaEventElapsedTime(&time_in, start_in, stop_in);
	cudaEventElapsedTime(&time_ex, start_ex, stop_ex);
	
	writeFile(outputFN, A, m, n);
	cout << n << "," << m << "," << time_ex << "," << time_in << endl;

	cudaFree(A);
	cudaFree(dA);
	cudaFree(dB);
	A = NULL;
	dA = NULL;
	dB = NULL;
	cudaEventDestroy(start_in);
	cudaEventDestroy(stop_in);
	cudaEventDestroy(start_ex);
	cudaEventDestroy(stop_ex);
}

double* readFile(string input, int *m, int *n){
	string line;
	ifstream in (input);
	if (in.is_open())
	{
		//read n
		getline(in,line);
		*n = atoi(line.c_str());
		
		//read m
		getline(in,line);
		*m = atoi(line.c_str());
		
		// Allocate pinned memory
		double *A;
		cudaMallocHost(&A, sizeof(double)*(*m)*(*n));
		
		for(int i = 0; i < *n; i++){
			for(int j = 0; j < *m-1; j++){
				getline(in,line,',');
				A[i*(*m)+j] = atof(line.c_str());
			}
			getline(in,line);
			A[(i+1)*(*m)-1] = atof(line.c_str());
		}
		
		in.close();
		
		return A;
	}
	else{
		*m = -1;
		*n = -1;
		cout << "Unable to open input file!"; 
		return NULL;
	}
}

void writeFile(string output, double* A, int m, int n){
	ofstream out (output);
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m-1; j++){
			out << A[i*m+j] << ",";
		}
		out << A[(i+1)*m-1] << endl;
	}
	
	out.close();
}
	.file	"tmpxft_002122e4_00000000-6_jacobian-old.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3773:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3773:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.type	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.isra.0, @function
_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.isra.0:
.LFB4517:
	.cfi_startproc
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	(%rdi), %rax
	movq	-24(%rax), %rax
	movq	240(%rdi,%rax), %rbx
	testq	%rbx, %rbx
	jne	.L3
	call	_ZSt16__throw_bad_castv@PLT
.L3:
	cmpb	$0, 56(%rbx)
	movq	%rdi, %rbp
	movq	%rsi, %r12
	je	.L4
	movb	67(%rbx), %al
	jmp	.L5
.L4:
	movq	%rbx, %rdi
	call	_ZNKSt5ctypeIcE13_M_widen_initEv@PLT
	movq	(%rbx), %rax
	movl	$10, %esi
	movq	%rbx, %rdi
	call	*48(%rax)
.L5:
	popq	%rbx
	.cfi_def_cfa_offset 24
	movq	%r12, %rsi
	movq	%rbp, %rdi
	movsbl	%al, %edx
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	jmp	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_@PLT
	.cfi_endproc
.LFE4517:
	.size	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.isra.0, .-_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.isra.0
	.globl	_Z33__device_stub__Z8jacobianPdS_iiidPdS_iiid
	.type	_Z33__device_stub__Z8jacobianPdS_iiidPdS_iiid, @function
_Z33__device_stub__Z8jacobianPdS_iiidPdS_iiid:
.LFB3795:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	%rdi, 40(%rsp)
	leaq	72(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	84(%rsp), %rsi
	movl	%edx, 28(%rsp)
	leaq	56(%rsp), %rdx
	movl	%ecx, 24(%rsp)
	leaq	64(%rsp), %rcx
	movl	%r8d, 20(%rsp)
	movsd	%xmm0, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 80(%rsp)
	movq	%rax, 120(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	28(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 72(%rsp)
	movq	%rax, 84(%rsp)
	movl	$1, 92(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L8
	pushq	64(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z8jacobianPdS_iiid(%rip), %rdi
	pushq	64(%rsp)
	.cfi_def_cfa_offset 208
	movq	100(%rsp), %rcx
	movl	108(%rsp), %r8d
	movq	88(%rsp), %rsi
	movl	96(%rsp), %edx
	leaq	136(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L8:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3795:
	.size	_Z33__device_stub__Z8jacobianPdS_iiidPdS_iiid, .-_Z33__device_stub__Z8jacobianPdS_iiidPdS_iiid
	.globl	_Z8jacobianPdS_iiid
	.type	_Z8jacobianPdS_iiid, @function
_Z8jacobianPdS_iiid:
.LFB3796:
	.cfi_startproc
	endbr64
	jmp	_Z33__device_stub__Z8jacobianPdS_iiidPdS_iiid
	.cfi_endproc
.LFE3796:
	.size	_Z8jacobianPdS_iiid, .-_Z8jacobianPdS_iiid
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z8jacobianPdS_iiid"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3798:
	.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	.LC0(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z8jacobianPdS_iiid(%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
.LFE3798:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.str1.1,"aMS",@progbits,1
.LC1:
	.string	"basic_string: construction from null is not valid"
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC5IS3_EEPKcRKS3_,comdat
	.align 2
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, @function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_:
.LFB4115:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	16(%rdi), %rax
	movq	%rax, (%rdi)
	testq	%rsi, %rsi
	jne	.L16
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	leaq	.LC1(%rip), %rdi
	call	_ZSt19__throw_logic_errorPKc@PLT
.L16:
	movq	%rdi, %rbx
	movq	%rsi, %rdi
	movq	%rsi, %rbp
	call	strlen@PLT
	movq	%rax, (%rsp)
	leaq	0(%rbp,%rax), %r12
	cmpq	$15, %rax
	jbe	.L18
	movq	%rsp, %rsi
	xorl	%edx, %edx
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm@PLT
	movq	%rax, (%rbx)
	movq	(%rsp), %rax
	movq	%rax, 16(%rbx)
.L18:
	movq	(%rbx), %rdi
	movq	%r12, %rdx
	movq	%rbp, %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13_S_copy_charsEPcPKcS7_@PLT
	movq	(%rsp), %rax
	movq	(%rbx), %rdx
	movq	%rax, 8(%rbx)
	movb	$0, (%rdx,%rax)
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L19
.L21:
	call	__stack_chk_fail@PLT
.L19:
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4115:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, .-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
	.set	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.section	.rodata.str1.1
.LC2:
	.string	"Unable to open input file!"
	.text
	.globl	_Z8readFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_
	.type	_Z8readFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_, @function
_Z8readFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_:
.LFB3768:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3768
	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	%rdx, %r13
	movl	$8, %edx
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	movq	%rdi, %rsi
	subq	$600, %rsp
	.cfi_def_cfa_offset 656
	movq	%fs:40, %rax
	movq	%rax, 584(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rax
	movb	$0, 48(%rsp)
	leaq	32(%rsp), %r12
	movq	%rax, 32(%rsp)
	xorl	%eax, %eax
	movq	%rax, 40(%rsp)
	leaq	64(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
.LEHB0:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1ERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode@PLT
.LEHE0:
	leaq	184(%rsp), %rdi
	call	_ZNKSt12__basic_fileIcE7is_openEv@PLT
	testb	%al, %al
	je	.L23
	movq	8(%rsp), %rdi
	movq	%r12, %rsi
.LEHB1:
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.isra.0
	movq	32(%rsp), %rdi
	call	atoi@PLT
	movq	8(%rsp), %rdi
	movq	%r12, %rsi
	movl	%eax, 0(%r13)
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.isra.0
	movq	32(%rsp), %rdi
	call	atoi@PLT
	leaq	24(%rsp), %rdi
	xorl	%edx, %edx
	movl	%eax, (%rbx)
	movslq	0(%r13), %rsi
	cltq
	imulq	%rax, %rsi
	salq	$3, %rsi
	call	cudaHostAlloc@PLT
	xorl	%r14d, %r14d
.L24:
	cmpl	%r14d, 0(%r13)
	jle	.L39
	xorl	%r15d, %r15d
.L26:
	movl	(%rbx), %eax
	decl	%eax
	cmpl	%r15d, %eax
	jle	.L40
	movq	8(%rsp), %rdi
	movl	$44, %edx
	movq	%r12, %rsi
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_@PLT
	movl	(%rbx), %eax
	movq	24(%rsp), %rdx
	movq	32(%rsp), %rdi
	imull	%r14d, %eax
	addl	%r15d, %eax
	incl	%r15d
	cltq
	leaq	(%rdx,%rax,8), %rbp
	call	atof@PLT
	movsd	%xmm0, 0(%rbp)
	jmp	.L26
.L40:
	movq	8(%rsp), %rdi
	movq	%r12, %rsi
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.isra.0
	movl	(%rbx), %eax
	incl	%r14d
	movq	24(%rsp), %rdx
	movq	32(%rsp), %rdi
	imull	%r14d, %eax
	cltq
	leaq	-8(%rdx,%rax,8), %r15
	call	atof@PLT
	movsd	%xmm0, (%r15)
	jmp	.L24
.L39:
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv@PLT
	movq	24(%rsp), %rbx
	jmp	.L27
.L23:
	movl	$-1, (%rbx)
	leaq	.LC2(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	movl	$-1, 0(%r13)
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.LEHE1:
	xorl	%ebx, %ebx
.L27:
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	584(%rsp), %rax
	subq	%fs:40, %rax
	je	.L31
	jmp	.L37
.L35:
	endbr64
	movq	%rax, %rbx
.L28:
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L29
.L34:
	endbr64
	movq	%rax, %rbx
.L29:
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	584(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L37
	movq	%rbx, %rdi
.LEHB2:
	call	_Unwind_Resume@PLT
.LEHE2:
.L37:
	call	__stack_chk_fail@PLT
.L31:
	addq	$600, %rsp
	.cfi_def_cfa_offset 56
	movq	%rbx, %rax
	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
.LFE3768:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3768:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3768-.LLSDACSB3768
.LLSDACSB3768:
	.uleb128 .LEHB0-.LFB3768
	.uleb128 .LEHE0-.LEHB0
	.uleb128 .L34-.LFB3768
	.uleb128 0
	.uleb128 .LEHB1-.LFB3768
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L35-.LFB3768
	.uleb128 0
	.uleb128 .LEHB2-.LFB3768
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE3768:
	.text
	.size	_Z8readFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_, .-_Z8readFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_
	.section	.rodata.str1.1
.LC3:
	.string	","
	.text
	.globl	_Z9writeFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii
	.type	_Z9writeFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii, @function
_Z9writeFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii:
.LFB3770:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3770
	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
	movslq	%edx, %r13
	movl	$16, %edx
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rsi, %r12
	movq	%rdi, %rsi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%r13, %rbx
	salq	$3, %r13
	leaq	(%r12,%r13), %r14
	subq	$568, %rsp
	.cfi_def_cfa_offset 624
	movl	%ecx, 28(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 552(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
.LEHB3:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1ERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode@PLT
.LEHE3:
	xorl	%eax, %eax
	movl	%eax, 24(%rsp)
	movl	%eax, 20(%rsp)
.L42:
	movl	28(%rsp), %ecx
	cmpl	%ecx, 20(%rsp)
	jge	.L44
	movslq	24(%rsp), %rax
	xorl	%ebp, %ebp
	leaq	(%r12,%rax,8), %r15
.L45:
	leal	-1(%rbx), %eax
	cmpl	%ebp, %eax
	jle	.L52
	movsd	(%r15,%rbp,8), %xmm0
	movq	8(%rsp), %rdi
.LEHB4:
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC3(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	incq	%rbp
	jmp	.L45
.L52:
	movsd	-8(%r14), %xmm0
	movq	8(%rsp), %rdi
	incl	20(%rsp)
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	addl	%ebx, 24(%rsp)
	addq	%r13, %r14
	jmp	.L42
.L44:
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
.LEHE4:
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	552(%rsp), %rax
	subq	%fs:40, %rax
	je	.L48
	jmp	.L50
.L49:
	endbr64
	movq	%rax, %rbx
.L46:
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	552(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L50
	movq	%rbx, %rdi
.LEHB5:
	call	_Unwind_Resume@PLT
.LEHE5:
.L50:
	call	__stack_chk_fail@PLT
.L48:
	addq	$568, %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
.LFE3770:
	.section	.gcc_except_table
.LLSDA3770:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3770-.LLSDACSB3770
.LLSDACSB3770:
	.uleb128 .LEHB3-.LFB3770
	.uleb128 .LEHE3-.LEHB3
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB4-.LFB3770
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L49-.LFB3770
	.uleb128 0
	.uleb128 .LEHB5-.LFB3770
	.uleb128 .LEHE5-.LEHB5
	.uleb128 0
	.uleb128 0
.LLSDACSE3770:
	.text
	.size	_Z9writeFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii, .-_Z9writeFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii
	.section	.rodata.str1.1
.LC4:
	.string	"USAGE: %s <inputArray.inp> <outfile> <epsilon>\n"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3767:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3767
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$248, %rsp
	.cfi_def_cfa_offset 304
	movq	%fs:40, %rax
	movq	%rax, 232(%rsp)
	xorl	%eax, %eax
	cmpl	$4, %edi
	je	.L54
	movq	(%rsi), %rdx
	movl	$2, %edi
	leaq	.LC4(%rip), %rsi
.LEHB6:
	call	__printf_chk@PLT
	movl	$1, %eax
	jmp	.L53
.L54:
	leaq	136(%rsp), %rax
	movq	8(%rsi), %rsi
	leaq	124(%rsp), %r14
	movq	%rax, %rdi
	movq	%r14, %rdx
	movq	%rax, 24(%rsp)
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE6:
	leaq	168(%rsp), %rax
	movq	16(%rbx), %rsi
	movq	%r14, %rdx
	movq	%rax, %rdi
	movq	%rax, 32(%rsp)
.LEHB7:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE7:
	movq	24(%rbx), %rdi
	call	atof@PLT
	leaq	64(%rsp), %rdi
	movsd	%xmm0, 40(%rsp)
.LEHB8:
	call	cudaEventCreate@PLT
	leaq	72(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	80(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	88(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	200(%rsp), %rbp
	movq	24(%rsp), %rsi
	movq	%rbp, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1ERKS4_@PLT
.LEHE8:
	leaq	60(%rsp), %rdx
	leaq	56(%rsp), %rsi
	movq	%rbp, %rdi
.LEHB9:
	call	_Z8readFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_
.LEHE9:
	movq	%rbp, %rdi
	movq	%rax, 8(%rsp)
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movslq	56(%rsp), %r15
	movslq	60(%rsp), %rax
	leaq	96(%rsp), %rdi
	movq	%rax, %rbp
	imulq	%r15, %rax
	movq	%r15, %r12
	salq	$3, %rax
	movq	%rax, %rsi
	movq	%rax, 16(%rsp)
.LEHB10:
	call	cudaMalloc@PLT
	movq	16(%rsp), %rsi
	leaq	104(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	$6144, %eax
	movl	$2, %ecx
	cltd
	idivl	%r15d
	cltd
	idivl	%ecx
	movl	%eax, %ebx
	cmpl	%eax, %ebp
	jle	.L66
	movl	%ebp, %eax
	cltd
	idivl	%ebx
	leal	1(%rax), %r13d
	jmp	.L56
.L66:
	movl	%ebp, %ebx
	movl	$1, %r13d
.L56:
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	16(%rsp), %rdx
	movq	8(%rsp), %rsi
	movl	$1, %ecx
	movq	96(%rsp), %rdi
	call	cudaMemcpy@PLT
	movq	80(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movslq	%ebx, %r8
	movl	%ebx, 124(%rsp)
	xorl	%r9d, %r9d
	movabsq	$4294967297, %rax
	imulq	%r15, %r8
	movq	%rax, 128(%rsp)
	movq	124(%rsp), %rdx
	movq	%rax, 116(%rsp)
	movl	132(%rsp), %ecx
	movl	%r13d, 112(%rsp)
	movl	120(%rsp), %esi
	movq	112(%rsp), %rdi
	salq	$4, %r8
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	je	.L57
.L59:
	call	cudaDeviceSynchronize@PLT
	jmp	.L75
.L57:
	movl	%ebx, %ecx
	movsd	40(%rsp), %xmm0
	movq	104(%rsp), %rsi
	movl	%ebp, %r8d
	imull	%r12d, %ecx
	movq	96(%rsp), %rdi
	movl	%r12d, %edx
	call	_Z33__device_stub__Z8jacobianPdS_iiidPdS_iiid
	jmp	.L59
.L75:
	movq	88(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	88(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	16(%rsp), %rdx
	movq	104(%rsp), %rsi
	movl	$2, %ecx
	movq	8(%rsp), %rdi
	call	cudaMemcpy@PLT
	movq	72(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	72(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	72(%rsp), %rdx
	movq	64(%rsp), %rsi
	leaq	112(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	88(%rsp), %rdx
	movq	80(%rsp), %rsi
	movq	%r14, %rdi
	call	cudaEventElapsedTime@PLT
	leaq	200(%rsp), %r13
	movq	32(%rsp), %rsi
	movq	%r13, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1ERKS4_@PLT
.LEHE10:
	movq	8(%rsp), %rsi
	movl	%ebp, %ecx
	movl	%r12d, %edx
	movq	%r13, %rdi
.LEHB11:
	call	_Z9writeFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii
.LEHE11:
	movq	%r13, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movl	%ebp, %esi
	leaq	_ZSt4cout(%rip), %rdi
.LEHB12:
	call	_ZNSolsEi@PLT
	leaq	.LC3(%rip), %rbx
	movq	%rax, %rdi
	movq	%rbx, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movl	%r12d, %esi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	movq	%rbx, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	cvtss2sd	124(%rsp), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	movq	%rbx, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	cvtss2sd	112(%rsp), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	96(%rsp), %rdi
	call	cudaFree@PLT
	movq	104(%rsp), %rdi
	call	cudaFree@PLT
	movq	64(%rsp), %rdi
	xorl	%eax, %eax
	movq	%rax, 96(%rsp)
	movq	%rax, 104(%rsp)
	call	cudaEventDestroy@PLT
	movq	72(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	80(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	88(%rsp), %rdi
	call	cudaEventDestroy@PLT
.LEHE12:
	leaq	168(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	leaq	136(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	xorl	%eax, %eax
	jmp	.L53
.L69:
	endbr64
	movq	%rax, %rbx
.L60:
	movq	%rbp, %rdi
	jmp	.L73
.L70:
	endbr64
	movq	%rax, %rbx
.L62:
	movq	%r13, %rdi
.L73:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	jmp	.L61
.L68:
	endbr64
	movq	%rax, %rbx
.L61:
	movq	32(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	jmp	.L63
.L67:
	endbr64
	movq	%rax, %rbx
.L63:
	movq	24(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	232(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L74
	movq	%rbx, %rdi
.LEHB13:
	call	_Unwind_Resume@PLT
.LEHE13:
.L53:
	movq	232(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L65
.L74:
	call	__stack_chk_fail@PLT
.L65:
	addq	$248, %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
.LFE3767:
	.section	.gcc_except_table
.LLSDA3767:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3767-.LLSDACSB3767
.LLSDACSB3767:
	.uleb128 .LEHB6-.LFB3767
	.uleb128 .LEHE6-.LEHB6
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB7-.LFB3767
	.uleb128 .LEHE7-.LEHB7
	.uleb128 .L67-.LFB3767
	.uleb128 0
	.uleb128 .LEHB8-.LFB3767
	.uleb128 .LEHE8-.LEHB8
	.uleb128 .L68-.LFB3767
	.uleb128 0
	.uleb128 .LEHB9-.LFB3767
	.uleb128 .LEHE9-.LEHB9
	.uleb128 .L69-.LFB3767
	.uleb128 0
	.uleb128 .LEHB10-.LFB3767
	.uleb128 .LEHE10-.LEHB10
	.uleb128 .L68-.LFB3767
	.uleb128 0
	.uleb128 .LEHB11-.LFB3767
	.uleb128 .LEHE11-.LEHB11
	.uleb128 .L70-.LFB3767
	.uleb128 0
	.uleb128 .LEHB12-.LFB3767
	.uleb128 .LEHE12-.LEHB12
	.uleb128 .L68-.LFB3767
	.uleb128 0
	.uleb128 .LEHB13-.LFB3767
	.uleb128 .LEHE13-.LEHB13
	.uleb128 0
	.uleb128 0
.LLSDACSE3767:
	.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 <stdio.h>
#include <hip/hip_runtime.h>
#include <string>
#include <iostream>
#include <fstream>
#include "f_eval.cuh"

using namespace std;

__inline__ __host__ __device__ double f_eval(double* p_x, int m);
double* readFile(string input, int *m, int *n);
void writeFile(string output, double* A, int m, int n);

__global__ void jacobian(double *dA, double *dB, int m, int step, int n, double eps)
{
	extern __shared__ double p[];
	double *f = (double*)&p[step];
	// Local line index
	int lli = threadIdx.x*m;
	// Global line index
	int gli = blockIdx.x*step + lli;
	
	if(gli < n*m){
	// Load a block into shared memory
	for(int i = 0; i < m; i++){
		p[lli + i] = dA[gli + i];
	}
	__threadfence();
	
	// Every thread computes partial derivatives at a single point
	for(int i = 0; i < m; i++){
		p[lli + i] += eps;
		__threadfence();
		// f(x1,x2,...,xi+eps,...,xm)
		f[lli + i] = f_eval(p+lli, m);
		
		p[lli + i] -= 2*eps;
		__threadfence();
		// f(x1,x2,...,xi-eps,...,xm)
		f[lli + i] -= f_eval(p+lli, m);
		
		p[lli + i] += eps;
		__threadfence();
		// df/dxi = (f(x1,x2,...,xi+eps,...,xm) - f(x1,x2,...,xi-eps,...,xm))/2/eps
		dB[gli+i] = f[lli + i]/eps/2;
	}
	}
}

int main(int argc, char* argv[])
{
	if(argc != 4){
		printf("USAGE: %s <inputArray.inp> <outfile> <epsilon>\n", argv[0]);
		return 1;
	}

	string inputFN = argv[1];
	string outputFN = argv[2];
	double epsilon = atof(argv[3]);
	int m, n;
	
	hipEvent_t start_in, stop_in, start_ex, stop_ex;
	hipEventCreate(&start_in);
	hipEventCreate(&stop_in);
	hipEventCreate(&start_ex);
	hipEventCreate(&stop_ex);
	
	// Read file
	double* A = readFile(inputFN, &m, &n);
	size_t size = sizeof(double)*m*n;
	
	// Allocate memory on the device
	double *dA, *dB;
	hipMalloc(&dA, size);
	hipMalloc(&dB, size);
	
	int N_blocks, N_threads;
	// Shared memory is the limiting factor
	// Calculate how many points would fit
	// Division by 2 is because function values are also stored in shared memory
	int a = 48*1024/8/m/2;
	if(a >= n){
		N_threads = n;
		N_blocks = 1;
	} else {
		N_threads = a;
		N_blocks = n/N_threads+1;
	}
	
	//Start inclusive timer
	hipEventRecord(start_in, 0);
	hipMemcpy(dA, A, size, hipMemcpyHostToDevice);
	
	//Start exclusive timer
	hipEventRecord(start_ex, 0);
	
	jacobian<<<N_blocks, N_threads, sizeof(double)*2*m*N_threads>>>(dA, dB, m, N_threads*m, n, epsilon);
	hipDeviceSynchronize();
	
	//Stop exclusive timer
	hipEventRecord(stop_ex, 0);
	hipEventSynchronize(stop_ex);
	
	hipMemcpy(A, dB, size, hipMemcpyDeviceToHost);
	
	//Stop inclusive timer
	hipEventRecord(stop_in, 0);
	hipEventSynchronize(stop_in);
	
	float time_in, time_ex;
	hipEventElapsedTime(&time_in, start_in, stop_in);
	hipEventElapsedTime(&time_ex, start_ex, stop_ex);
	
	writeFile(outputFN, A, m, n);
	cout << n << "," << m << "," << time_ex << "," << time_in << endl;

	hipFree(A);
	hipFree(dA);
	hipFree(dB);
	A = NULL;
	dA = NULL;
	dB = NULL;
	hipEventDestroy(start_in);
	hipEventDestroy(stop_in);
	hipEventDestroy(start_ex);
	hipEventDestroy(stop_ex);
}

double* readFile(string input, int *m, int *n){
	string line;
	ifstream in (input);
	if (in.is_open())
	{
		//read n
		getline(in,line);
		*n = atoi(line.c_str());
		
		//read m
		getline(in,line);
		*m = atoi(line.c_str());
		
		// Allocate pinned memory
		double *A;
		hipHostMalloc(&A, sizeof(double)*(*m)*(*n), hipHostMallocDefault);
		
		for(int i = 0; i < *n; i++){
			for(int j = 0; j < *m-1; j++){
				getline(in,line,',');
				A[i*(*m)+j] = atof(line.c_str());
			}
			getline(in,line);
			A[(i+1)*(*m)-1] = atof(line.c_str());
		}
		
		in.close();
		
		return A;
	}
	else{
		*m = -1;
		*n = -1;
		cout << "Unable to open input file!"; 
		return NULL;
	}
}

void writeFile(string output, double* A, int m, int n){
	ofstream out (output);
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m-1; j++){
			out << A[i*m+j] << ",";
		}
		out << A[(i+1)*m-1] << endl;
	}
	
	out.close();
}
	.text
	.file	"jacobian-old.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z23__device_stub__jacobianPdS_iiid # -- Begin function _Z23__device_stub__jacobianPdS_iiid
	.type	_Z23__device_stub__jacobianPdS_iiid,@function
_Z23__device_stub__jacobianPdS_iiid:    # @_Z23__device_stub__jacobianPdS_iiid
	.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	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	20(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	16(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	12(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	40(%rsp), %r8
	movsd	%xmm0, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%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	$_Z8jacobianPdS_iiid, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z23__device_stub__jacobianPdS_iiid, .Lfunc_end0-_Z23__device_stub__jacobianPdS_iiid
	.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	$200, %rsp
	.cfi_def_cfa_offset 256
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %rbx
	cmpl	$4, %edi
	jne	.LBB1_54
# %bb.1:
	movq	8(%rbx), %rsi
	leaq	168(%rsp), %rdi
	leaq	72(%rsp), %rdx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	movq	16(%rbx), %rsi
.Ltmp0:
	leaq	72(%rsp), %rdi
	leaq	32(%rsp), %rdx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
.Ltmp1:
# %bb.2:
	movq	24(%rbx), %rdi
	callq	atof
	movsd	%xmm0, 64(%rsp)                 # 8-byte Spill
.Ltmp3:
	leaq	32(%rsp), %rdi
	callq	hipEventCreate
.Ltmp4:
# %bb.3:
.Ltmp5:
	leaq	24(%rsp), %rdi
	callq	hipEventCreate
.Ltmp6:
# %bb.4:
.Ltmp7:
	leaq	40(%rsp), %rdi
	callq	hipEventCreate
.Ltmp8:
# %bb.5:
.Ltmp9:
	leaq	16(%rsp), %rdi
	callq	hipEventCreate
.Ltmp10:
# %bb.6:
	leaq	152(%rsp), %r14
	movq	%r14, -16(%r14)
	movq	168(%rsp), %rsi
	movq	176(%rsp), %rdx
	addq	%rsi, %rdx
.Ltmp12:
	leaq	136(%rsp), %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
.Ltmp13:
# %bb.7:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_.exit
.Ltmp15:
	leaq	136(%rsp), %rdi
	leaq	60(%rsp), %rsi
	leaq	56(%rsp), %rdx
	callq	_Z8readFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_
.Ltmp16:
# %bb.8:
	movq	%rax, %rbx
	movq	136(%rsp), %rdi
	cmpq	%r14, %rdi
	je	.LBB1_10
# %bb.9:                                # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB1_10:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	movslq	60(%rsp), %r14
	movslq	56(%rsp), %r15
	movq	%r14, %r12
	imulq	%r15, %r12
	shlq	$3, %r12
.Ltmp18:
	leaq	8(%rsp), %rdi
	movq	%r12, %rsi
	callq	hipMalloc
.Ltmp19:
# %bb.11:                               # %_ZL9hipMallocIdE10hipError_tPPT_m.exit
.Ltmp20:
	movq	%rsp, %rdi
	movq	%r12, %rsi
	callq	hipMalloc
.Ltmp21:
# %bb.12:                               # %_ZL9hipMallocIdE10hipError_tPPT_m.exit47
	movl	$6144, %eax                     # imm = 0x1800
	xorl	%edx, %edx
	idivl	%r14d
	movzwl	%ax, %ecx
	shrl	$15, %ecx
	addl	%eax, %ecx
	movswl	%cx, %ecx
	sarl	%ecx
	movl	$1, %r13d
	movl	%r15d, %ebp
	cmpl	%ecx, %r15d
	jle	.LBB1_14
# %bb.13:
	movl	%r15d, %eax
	cltd
	idivl	%ecx
	movl	%eax, %r13d
	incl	%r13d
	movl	%ecx, %ebp
.LBB1_14:
	movq	32(%rsp), %rdi
.Ltmp23:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp24:
# %bb.15:
	movq	8(%rsp), %rdi
.Ltmp25:
	movq	%rbx, %rsi
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp26:
# %bb.16:
	movq	40(%rsp), %rdi
.Ltmp27:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp28:
# %bb.17:
	movslq	%ebp, %rax
	movq	%r14, %r8
	imulq	%rax, %r8
	shlq	$4, %r8
	movl	%r13d, %edi
	btsq	$32, %rdi
	movl	%eax, %edx
	btsq	$32, %rdx
.Ltmp29:
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp30:
# %bb.18:
	testl	%eax, %eax
	jne	.LBB1_20
# %bb.19:
	movq	8(%rsp), %rdi
	movq	(%rsp), %rsi
	imull	%r14d, %ebp
.Ltmp31:
	movl	%r14d, %edx
	movl	%ebp, %ecx
	movl	%r15d, %r8d
	movsd	64(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_Z23__device_stub__jacobianPdS_iiid
.Ltmp32:
.LBB1_20:
.Ltmp33:
	callq	hipDeviceSynchronize
.Ltmp34:
# %bb.21:
	movq	16(%rsp), %rdi
.Ltmp35:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp36:
# %bb.22:
	movq	16(%rsp), %rdi
.Ltmp37:
	callq	hipEventSynchronize
.Ltmp38:
# %bb.23:
	movq	(%rsp), %rsi
.Ltmp39:
	movq	%rbx, %rdi
	movq	%r12, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp40:
# %bb.24:
	movq	24(%rsp), %rdi
.Ltmp41:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp42:
# %bb.25:
	movq	24(%rsp), %rdi
.Ltmp43:
	callq	hipEventSynchronize
.Ltmp44:
# %bb.26:
	movq	32(%rsp), %rsi
	movq	24(%rsp), %rdx
.Ltmp46:
	leaq	52(%rsp), %rdi
	callq	hipEventElapsedTime
.Ltmp47:
# %bb.27:
	movq	40(%rsp), %rsi
	movq	16(%rsp), %rdx
.Ltmp48:
	leaq	48(%rsp), %rdi
	callq	hipEventElapsedTime
.Ltmp49:
# %bb.28:
	leaq	120(%rsp), %r12
	movq	%r12, -16(%r12)
	movq	72(%rsp), %rsi
	movq	80(%rsp), %rdx
	addq	%rsi, %rdx
.Ltmp50:
	leaq	104(%rsp), %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
.Ltmp51:
# %bb.29:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_.exit51
.Ltmp52:
	leaq	104(%rsp), %rdi
	movq	%rbx, %rsi
	movl	%r14d, %edx
	movl	%r15d, %ecx
	callq	_Z9writeFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii
.Ltmp53:
# %bb.30:
	movq	104(%rsp), %rdi
	cmpq	%r12, %rdi
	je	.LBB1_32
# %bb.31:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i52
	callq	_ZdlPv
.LBB1_32:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit54
.Ltmp55:
	movl	$_ZSt4cout, %edi
	movl	%r15d, %esi
	callq	_ZNSolsEi
.Ltmp56:
# %bb.33:
.Ltmp57:
	movq	%rax, %r15
	movl	$.L.str.1, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp58:
# %bb.34:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
.Ltmp59:
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_ZNSolsEi
.Ltmp60:
# %bb.35:
.Ltmp61:
	movq	%rax, %r14
	movl	$.L.str.1, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp62:
# %bb.36:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit55
	cvtss2sd	48(%rsp), %xmm0
.Ltmp63:
	movq	%r14, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp64:
# %bb.37:                               # %_ZNSolsEf.exit
.Ltmp65:
	movq	%rax, %r14
	movl	$.L.str.1, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp66:
# %bb.38:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit56
	xorps	%xmm0, %xmm0
	cvtss2sd	52(%rsp), %xmm0
.Ltmp67:
	movq	%r14, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp68:
# %bb.39:                               # %_ZNSolsEf.exit57
	movq	%rax, %r14
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
.Ltmp69:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp70:
# %bb.40:                               # %.noexc
.Ltmp71:
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
.Ltmp72:
# %bb.41:                               # %.noexc73
.Ltmp73:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp74:
# %bb.42:                               # %_ZNSolsEPFRSoS_E.exit
.Ltmp75:
	movq	%rbx, %rdi
	callq	hipFree
.Ltmp76:
# %bb.43:
	movq	8(%rsp), %rdi
.Ltmp77:
	callq	hipFree
.Ltmp78:
# %bb.44:
	movq	(%rsp), %rdi
.Ltmp79:
	callq	hipFree
.Ltmp80:
# %bb.45:
	xorl	%eax, %eax
	movq	%rax, 8(%rsp)
	movq	%rax, (%rsp)
	movq	32(%rsp), %rdi
.Ltmp81:
	callq	hipEventDestroy
.Ltmp82:
# %bb.46:
	movq	24(%rsp), %rdi
.Ltmp83:
	callq	hipEventDestroy
.Ltmp84:
# %bb.47:
	movq	40(%rsp), %rdi
.Ltmp85:
	callq	hipEventDestroy
.Ltmp86:
# %bb.48:
	movq	16(%rsp), %rdi
.Ltmp87:
	callq	hipEventDestroy
.Ltmp88:
# %bb.49:
	leaq	88(%rsp), %rax
	movq	-16(%rax), %rdi
	cmpq	%rax, %rdi
	je	.LBB1_51
# %bb.50:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i58
	callq	_ZdlPv
.LBB1_51:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit60
	leaq	184(%rsp), %rax
	movq	-16(%rax), %rdi
	cmpq	%rax, %rdi
	je	.LBB1_53
# %bb.52:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i61
	callq	_ZdlPv
.LBB1_53:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit63
	xorl	%eax, %eax
	jmp	.LBB1_55
.LBB1_54:
	movq	(%rbx), %rsi
	movl	$.L.str, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$1, %eax
.LBB1_55:
	addq	$200, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB1_56:
	.cfi_def_cfa_offset 256
.Ltmp54:
	movq	%rax, %rbx
	movq	104(%rsp), %rdi
	cmpq	%r12, %rdi
	jne	.LBB1_58
	jmp	.LBB1_66
.LBB1_57:
.Ltmp17:
	movq	%rax, %rbx
	movq	136(%rsp), %rdi
	cmpq	%r14, %rdi
	je	.LBB1_66
.LBB1_58:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i64
	callq	_ZdlPv
	jmp	.LBB1_66
.LBB1_59:
.Ltmp14:
	jmp	.LBB1_65
.LBB1_60:
.Ltmp2:
	movq	%rax, %rbx
	jmp	.LBB1_68
.LBB1_61:
.Ltmp22:
	jmp	.LBB1_65
.LBB1_62:
.Ltmp11:
	jmp	.LBB1_65
.LBB1_63:
.Ltmp45:
	jmp	.LBB1_65
.LBB1_64:
.Ltmp89:
.LBB1_65:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit50
	movq	%rax, %rbx
.LBB1_66:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit50
	leaq	88(%rsp), %rax
	movq	-16(%rax), %rdi
	cmpq	%rax, %rdi
	je	.LBB1_68
# %bb.67:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i67
	callq	_ZdlPv
.LBB1_68:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit69
	leaq	184(%rsp), %rax
	movq	-16(%rax), %rdi
	cmpq	%rax, %rdi
	je	.LBB1_70
# %bb.69:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i70
	callq	_ZdlPv
.LBB1_70:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit72
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end1:
	.size	main, .Lfunc_end1-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table1:
.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 .Ltmp10-.Ltmp3                 #   Call between .Ltmp3 and .Ltmp10
	.uleb128 .Ltmp11-.Lfunc_begin0          #     jumps to .Ltmp11
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp12-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Ltmp13-.Ltmp12                #   Call between .Ltmp12 and .Ltmp13
	.uleb128 .Ltmp14-.Lfunc_begin0          #     jumps to .Ltmp14
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp15-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp16-.Ltmp15                #   Call between .Ltmp15 and .Ltmp16
	.uleb128 .Ltmp17-.Lfunc_begin0          #     jumps to .Ltmp17
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp18-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp21-.Ltmp18                #   Call between .Ltmp18 and .Ltmp21
	.uleb128 .Ltmp22-.Lfunc_begin0          #     jumps to .Ltmp22
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp23-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp44-.Ltmp23                #   Call between .Ltmp23 and .Ltmp44
	.uleb128 .Ltmp45-.Lfunc_begin0          #     jumps to .Ltmp45
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp46-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp51-.Ltmp46                #   Call between .Ltmp46 and .Ltmp51
	.uleb128 .Ltmp89-.Lfunc_begin0          #     jumps to .Ltmp89
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp52-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Ltmp53-.Ltmp52                #   Call between .Ltmp52 and .Ltmp53
	.uleb128 .Ltmp54-.Lfunc_begin0          #     jumps to .Ltmp54
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp55-.Lfunc_begin0          # >> Call Site 10 <<
	.uleb128 .Ltmp88-.Ltmp55                #   Call between .Ltmp55 and .Ltmp88
	.uleb128 .Ltmp89-.Lfunc_begin0          #     jumps to .Ltmp89
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp88-.Lfunc_begin0          # >> Call Site 11 <<
	.uleb128 .Lfunc_end1-.Ltmp88            #   Call between .Ltmp88 and .Lfunc_end1
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_ # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.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
	leaq	16(%rdi), %rax
	movq	%rax, (%rdi)
	testq	%rsi, %rsi
	je	.LBB2_1
# %bb.2:
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	%rsi, %rdi
	callq	strlen
	leaq	(%rax,%rbx), %rdx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # TAILCALL
.LBB2_1:
	.cfi_def_cfa_offset 32
	movl	$.L.str.3, %edi
	callq	_ZSt19__throw_logic_errorPKc
.Lfunc_end2:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, .Lfunc_end2-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.cfi_endproc
                                        # -- End function
	.text
	.globl	_Z8readFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_ # -- Begin function _Z8readFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_
	.type	_Z8readFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_,@function
_Z8readFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_: # @_Z8readFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_
.Lfunc_begin1:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception1
# %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	$568, %rsp                      # imm = 0x238
	.cfi_def_cfa_offset 624
	.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, %rbx
	movq	%rsi, %r14
	movq	%rdi, %rsi
	leaq	32(%rsp), %rax
	movq	%rax, -16(%rax)
	movq	$0, -8(%rax)
	movb	$0, (%rax)
.Ltmp90:
	leaq	48(%rsp), %r15
	movq	%r15, %rdi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1ERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode
.Ltmp91:
# %bb.1:
	leaq	168(%rsp), %rdi
	callq	_ZNKSt12__basic_fileIcE7is_openEv
	testb	%al, %al
	je	.LBB3_20
# %bb.2:
	movq	48(%rsp), %rax
	addq	-24(%rax), %r15
.Ltmp95:
	movq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp96:
# %bb.3:                                # %.noexc
.Ltmp97:
	movsbl	%al, %edx
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %rsi
	movq	%r15, %rdi
	callq	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_
.Ltmp98:
# %bb.4:                                # %_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit
	movq	16(%rsp), %rdi
	callq	atoi
	movl	%eax, (%rbx)
	movq	48(%rsp), %rax
	addq	-24(%rax), %r15
.Ltmp99:
	movq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp100:
# %bb.5:                                # %.noexc31
.Ltmp101:
	movsbl	%al, %edx
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %rsi
	movq	%r15, %rdi
	callq	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_
.Ltmp102:
# %bb.6:                                # %_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit33
	movq	16(%rsp), %rdi
	callq	atoi
	movl	%eax, (%r14)
	cltq
	movslq	(%rbx), %rsi
	imulq	%rax, %rsi
	shlq	$3, %rsi
.Ltmp104:
	leaq	8(%rsp), %rdi
	xorl	%edx, %edx
	callq	hipHostMalloc
.Ltmp105:
# %bb.7:                                # %_ZL13hipHostMallocIdE10hipError_tPPT_mj.exit.preheader
	cmpl	$0, (%rbx)
	jle	.LBB3_16
# %bb.8:                                # %.preheader.preheader
	movl	(%r14), %eax
	xorl	%ebp, %ebp
	leaq	16(%rsp), %r12
.LBB3_9:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_11 Depth 2
	cmpl	$2, %eax
	jl	.LBB3_13
# %bb.10:                               # %.lr.ph.preheader
                                        #   in Loop: Header=BB3_9 Depth=1
	xorl	%r13d, %r13d
.LBB3_11:                               # %.lr.ph
                                        #   Parent Loop BB3_9 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
.Ltmp106:
	movq	%r15, %rdi
	movq	%r12, %rsi
	movl	$44, %edx
	callq	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_
.Ltmp107:
# %bb.12:                               #   in Loop: Header=BB3_11 Depth=2
	movq	16(%rsp), %rdi
	callq	atof
	movq	8(%rsp), %rax
	movl	(%r14), %ecx
	movl	%ebp, %edx
	imull	%ecx, %edx
	movslq	%edx, %rdx
	addq	%r13, %rdx
	movsd	%xmm0, (%rax,%rdx,8)
	decl	%ecx
	incq	%r13
	cmpl	%ecx, %r13d
	jl	.LBB3_11
.LBB3_13:                               # %._crit_edge
                                        #   in Loop: Header=BB3_9 Depth=1
	movq	48(%rsp), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
.Ltmp109:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp110:
# %bb.14:                               # %.noexc35
                                        #   in Loop: Header=BB3_9 Depth=1
.Ltmp111:
	movsbl	%al, %edx
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_
.Ltmp112:
# %bb.15:                               # %_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit37
                                        #   in Loop: Header=BB3_9 Depth=1
	movq	16(%rsp), %rdi
	callq	atof
	movq	8(%rsp), %rcx
	incl	%ebp
	movl	(%r14), %eax
	movl	%eax, %edx
	imull	%ebp, %edx
	movslq	%edx, %rdx
	movsd	%xmm0, -8(%rcx,%rdx,8)
	cmpl	(%rbx), %ebp
	jl	.LBB3_9
.LBB3_16:                               # %_ZL13hipHostMallocIdE10hipError_tPPT_mj.exit._crit_edge
.Ltmp114:
	leaq	48(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv
.Ltmp115:
# %bb.17:
	movq	8(%rsp), %rbx
	jmp	.LBB3_22
.LBB3_20:
	movl	$-1, %eax
	movl	%eax, (%r14)
	movl	%eax, (%rbx)
.Ltmp93:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$26, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp94:
# %bb.21:
	xorl	%ebx, %ebx
.LBB3_22:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	leaq	48(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	16(%rsp), %rdi
	leaq	32(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB3_24
# %bb.23:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB3_24:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	movq	%rbx, %rax
	addq	$568, %rsp                      # imm = 0x238
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB3_19:
	.cfi_def_cfa_offset 624
.Ltmp116:
	jmp	.LBB3_26
.LBB3_18:
.Ltmp92:
	movq	%rax, %rbx
	jmp	.LBB3_27
.LBB3_25:
.Ltmp103:
	jmp	.LBB3_26
.LBB3_31:
.Ltmp113:
	jmp	.LBB3_26
.LBB3_30:
.Ltmp108:
.LBB3_26:
	movq	%rax, %rbx
	leaq	48(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
.LBB3_27:
	movq	16(%rsp), %rdi
	leaq	32(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB3_29
# %bb.28:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i39
	callq	_ZdlPv
.LBB3_29:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit41
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end3:
	.size	_Z8readFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_, .Lfunc_end3-_Z8readFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table3:
.Lexception1:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end1-.Lcst_begin1
.Lcst_begin1:
	.uleb128 .Ltmp90-.Lfunc_begin1          # >> Call Site 1 <<
	.uleb128 .Ltmp91-.Ltmp90                #   Call between .Ltmp90 and .Ltmp91
	.uleb128 .Ltmp92-.Lfunc_begin1          #     jumps to .Ltmp92
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp95-.Lfunc_begin1          # >> Call Site 2 <<
	.uleb128 .Ltmp102-.Ltmp95               #   Call between .Ltmp95 and .Ltmp102
	.uleb128 .Ltmp103-.Lfunc_begin1         #     jumps to .Ltmp103
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp104-.Lfunc_begin1         # >> Call Site 3 <<
	.uleb128 .Ltmp105-.Ltmp104              #   Call between .Ltmp104 and .Ltmp105
	.uleb128 .Ltmp116-.Lfunc_begin1         #     jumps to .Ltmp116
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp106-.Lfunc_begin1         # >> Call Site 4 <<
	.uleb128 .Ltmp107-.Ltmp106              #   Call between .Ltmp106 and .Ltmp107
	.uleb128 .Ltmp108-.Lfunc_begin1         #     jumps to .Ltmp108
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp109-.Lfunc_begin1         # >> Call Site 5 <<
	.uleb128 .Ltmp112-.Ltmp109              #   Call between .Ltmp109 and .Ltmp112
	.uleb128 .Ltmp113-.Lfunc_begin1         #     jumps to .Ltmp113
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp114-.Lfunc_begin1         # >> Call Site 6 <<
	.uleb128 .Ltmp115-.Ltmp114              #   Call between .Ltmp114 and .Ltmp115
	.uleb128 .Ltmp116-.Lfunc_begin1         #     jumps to .Ltmp116
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp93-.Lfunc_begin1          # >> Call Site 7 <<
	.uleb128 .Ltmp94-.Ltmp93                #   Call between .Ltmp93 and .Ltmp94
	.uleb128 .Ltmp103-.Lfunc_begin1         #     jumps to .Ltmp103
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp94-.Lfunc_begin1          # >> Call Site 8 <<
	.uleb128 .Lfunc_end3-.Ltmp94            #   Call between .Ltmp94 and .Lfunc_end3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end1:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	_Z9writeFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii # -- Begin function _Z9writeFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii
	.type	_Z9writeFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii,@function
_Z9writeFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii: # @_Z9writeFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii
.Lfunc_begin2:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception2
# %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	$552, %rsp                      # imm = 0x228
	.cfi_def_cfa_offset 608
	.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	%ecx, %r14d
	movl	%edx, %ebx
	movq	%rsi, 8(%rsp)                   # 8-byte Spill
	movq	%rdi, %rsi
	leaq	40(%rsp), %r12
	movq	%r12, %rdi
	movl	$16, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1ERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode
	leal	-1(%rbx), %ebp
	movq	%rbx, 16(%rsp)                  # 8-byte Spill
	movslq	%ebx, %rax
	movq	%rax, 24(%rsp)                  # 8-byte Spill
	xorl	%ebx, %ebx
	testl	%r14d, %r14d
	cmovlel	%ebx, %r14d
	movq	%r14, 32(%rsp)                  # 8-byte Spill
	xorl	%r15d, %r15d
.LBB4_1:                                # %_ZNSolsEPFRSoS_E.exit
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_4 Depth 2
	cmpq	32(%rsp), %r15                  # 8-byte Folded Reload
	je	.LBB4_12
# %bb.2:                                # %.preheader
                                        #   in Loop: Header=BB4_1 Depth=1
	cmpl	$2, 16(%rsp)                    # 4-byte Folded Reload
	jl	.LBB4_7
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB4_1 Depth=1
	movl	%ebx, %eax
	movq	8(%rsp), %rcx                   # 8-byte Reload
	leaq	(%rcx,%rax,8), %r13
	xorl	%r14d, %r14d
.LBB4_4:                                #   Parent Loop BB4_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	(%r13,%r14,8), %xmm0            # xmm0 = mem[0],zero
.Ltmp117:
	movq	%r12, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp118:
# %bb.5:                                # %_ZNSolsEd.exit20
                                        #   in Loop: Header=BB4_4 Depth=2
.Ltmp119:
	movl	$.L.str.1, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp120:
# %bb.6:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
                                        #   in Loop: Header=BB4_4 Depth=2
	incq	%r14
	cmpq	%r14, %rbp
	jne	.LBB4_4
.LBB4_7:                                # %._crit_edge
                                        #   in Loop: Header=BB4_1 Depth=1
	incq	%r15
	movq	%r15, %rax
	imulq	24(%rsp), %rax                  # 8-byte Folded Reload
	movq	8(%rsp), %rcx                   # 8-byte Reload
	movsd	-8(%rcx,%rax,8), %xmm0          # xmm0 = mem[0],zero
.Ltmp122:
	movq	%r12, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp123:
# %bb.8:                                # %_ZNSolsEd.exit
                                        #   in Loop: Header=BB4_1 Depth=1
	movq	%rax, %r13
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r13, %rdi
.Ltmp124:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp125:
# %bb.9:                                # %.noexc
                                        #   in Loop: Header=BB4_1 Depth=1
.Ltmp126:
	movsbl	%al, %esi
	movq	%r13, %rdi
	callq	_ZNSo3putEc
.Ltmp127:
# %bb.10:                               # %.noexc21
                                        #   in Loop: Header=BB4_1 Depth=1
	addl	16(%rsp), %ebx                  # 4-byte Folded Reload
.Ltmp128:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp129:
	jmp	.LBB4_1
.LBB4_12:
.Ltmp131:
	leaq	40(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp132:
# %bb.13:
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	48(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 40(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	288(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	addq	$552, %rsp                      # imm = 0x228
	.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
.LBB4_14:
	.cfi_def_cfa_offset 608
.Ltmp133:
	jmp	.LBB4_15
.LBB4_11:
.Ltmp130:
	jmp	.LBB4_15
.LBB4_16:
.Ltmp121:
.LBB4_15:
	movq	%rax, %rbx
	leaq	40(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end4:
	.size	_Z9writeFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii, .Lfunc_end4-_Z9writeFileNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table4:
.Lexception2:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end2-.Lcst_begin2
.Lcst_begin2:
	.uleb128 .Lfunc_begin2-.Lfunc_begin2    # >> Call Site 1 <<
	.uleb128 .Ltmp117-.Lfunc_begin2         #   Call between .Lfunc_begin2 and .Ltmp117
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp117-.Lfunc_begin2         # >> Call Site 2 <<
	.uleb128 .Ltmp120-.Ltmp117              #   Call between .Ltmp117 and .Ltmp120
	.uleb128 .Ltmp121-.Lfunc_begin2         #     jumps to .Ltmp121
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp122-.Lfunc_begin2         # >> Call Site 3 <<
	.uleb128 .Ltmp129-.Ltmp122              #   Call between .Ltmp122 and .Ltmp129
	.uleb128 .Ltmp130-.Lfunc_begin2         #     jumps to .Ltmp130
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp131-.Lfunc_begin2         # >> Call Site 4 <<
	.uleb128 .Ltmp132-.Ltmp131              #   Call between .Ltmp131 and .Ltmp132
	.uleb128 .Ltmp133-.Lfunc_begin2         #     jumps to .Ltmp133
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp132-.Lfunc_begin2         # >> Call Site 5 <<
	.uleb128 .Lfunc_end4-.Ltmp132           #   Call between .Ltmp132 and .Lfunc_end4
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end2:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	subq	%rsi, %r14
	movq	%r14, (%rsp)
	cmpq	$15, %r14
	jbe	.LBB5_1
# %bb.2:
	movq	%rsp, %r12
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm
	movq	%rax, (%rbx)
	movq	(%r12), %rcx
	movq	%rcx, 16(%rbx)
	jmp	.LBB5_3
.LBB5_1:                                # %._crit_edge
	movq	(%rbx), %rax
.LBB5_3:
	testq	%r14, %r14
	je	.LBB5_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB5_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB5_7
.LBB5_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB5_7:                                # %_ZZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tagEN6_GuardD2Ev.exit
	movq	(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	(%rbx), %rcx
	movb	$0, (%rcx,%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag, .Lfunc_end5-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	subq	%rsi, %r14
	movq	%r14, (%rsp)
	cmpq	$15, %r14
	jbe	.LBB6_1
# %bb.2:
	movq	%rsp, %r12
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm
	movq	%rax, (%rbx)
	movq	(%r12), %rcx
	movq	%rcx, 16(%rbx)
	jmp	.LBB6_3
.LBB6_1:                                # %._crit_edge
	movq	(%rbx), %rax
.LBB6_3:
	testq	%r14, %r14
	je	.LBB6_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB6_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB6_7
.LBB6_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB6_7:                                # %_ZZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tagEN6_GuardD2Ev.exit
	movq	(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	(%rbx), %rcx
	movb	$0, (%rcx,%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag, .Lfunc_end6-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
	.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:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB7_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB7_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z8jacobianPdS_iiid, %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_end7:
	.size	__hip_module_ctor, .Lfunc_end7-__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	.LBB8_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
.LBB8_2:
	retq
.Lfunc_end8:
	.size	__hip_module_dtor, .Lfunc_end8-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z8jacobianPdS_iiid,@object     # @_Z8jacobianPdS_iiid
	.section	.rodata,"a",@progbits
	.globl	_Z8jacobianPdS_iiid
	.p2align	3, 0x0
_Z8jacobianPdS_iiid:
	.quad	_Z23__device_stub__jacobianPdS_iiid
	.size	_Z8jacobianPdS_iiid, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"USAGE: %s <inputArray.inp> <outfile> <epsilon>\n"
	.size	.L.str, 48

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

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Unable to open input file!"
	.size	.L.str.2, 27

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"basic_string: construction from null is not valid"
	.size	.L.str.3, 50

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z8jacobianPdS_iiid"
	.size	.L__unnamed_1, 20

	.type	__hip_fatbin_wrapper,@object    # @__hip_fatbin_wrapper
	.section	.hipFatBinSegment,"a",@progbits
	.p2align	3, 0x0
__hip_fatbin_wrapper:
	.long	1212764230                      # 0x48495046
	.long	1                               # 0x1
	.quad	__hip_fatbin
	.quad	0
	.size	__hip_fatbin_wrapper, 24

	.type	__hip_gpubin_handle,@object     # @__hip_gpubin_handle
	.local	__hip_gpubin_handle
	.comm	__hip_gpubin_handle,8,8
	.section	.init_array,"aw",@init_array
	.p2align	3, 0x0
	.quad	__hip_module_ctor
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

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

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z8jacobianPdS_iiid     ; -- Begin function _Z8jacobianPdS_iiid
	.globl	_Z8jacobianPdS_iiid
	.p2align	8
	.type	_Z8jacobianPdS_iiid,@function
_Z8jacobianPdS_iiid:                    ; @_Z8jacobianPdS_iiid
; %bb.0:
	s_load_b128 s[4:7], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	v_mul_lo_u32 v0, v0, s4
	s_mul_i32 s2, s6, s4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s5, v[0:1]
	v_cmp_gt_i32_e32 vcc_lo, s2, v1
	s_and_saveexec_b32 s2, vcc_lo
	s_cbranch_execz .LBB0_12
; %bb.1:                                ; %.preheader
	s_cmp_lt_i32 s4, 1
	s_mov_b32 s2, -1
	s_cbranch_scc0 .LBB0_3
; %bb.2:                                ; %.loopexit.critedge
	s_mov_b32 s2, 0
	buffer_gl1_inv
	buffer_gl0_inv
.LBB0_3:                                ; %Flow90
	s_and_not1_b32 vcc_lo, exec_lo, s2
	s_cbranch_vccnz .LBB0_12
; %bb.4:                                ; %.lr.ph.preheader
	s_load_b128 s[8:11], s[0:1], 0x0
	v_lshl_add_u32 v2, v0, 3, 0
	s_mov_b32 s2, 0
.LBB0_5:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_add_nc_u32_e32 v3, s2, v1
	s_add_i32 s2, s2, 1
	s_cmp_eq_u32 s4, s2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v4, 31, v3
	v_lshlrev_b64 v[3:4], 3, v[3:4]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v3, vcc_lo, s8, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s9, v4, vcc_lo
	global_load_b64 v[3:4], v[3:4], off
	s_waitcnt vmcnt(0)
	ds_store_b64 v2, v[3:4]
	v_add_nc_u32_e32 v2, 8, v2
	s_cbranch_scc0 .LBB0_5
; %bb.6:                                ; %._crit_edge
	s_load_b64 s[0:1], s[0:1], 0x20
	v_lshl_add_u32 v6, v0, 3, 0
	s_lshl_b32 s3, s5, 3
	s_mov_b32 s2, 0
	s_add_i32 s3, s3, 0
	s_waitcnt lgkmcnt(0)
	buffer_gl1_inv
	buffer_gl0_inv
	v_add_f64 v[2:3], s[0:1], s[0:1]
.LBB0_7:                                ; %.lr.ph.i.preheader
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_8 Depth 2
                                        ;     Child Loop BB0_10 Depth 2
	v_lshl_add_u32 v7, s2, 3, v6
	s_mov_b32 s5, s4
	v_mov_b32_e32 v8, v6
	ds_load_b64 v[4:5], v7
	s_waitcnt lgkmcnt(0)
	v_add_f64 v[9:10], v[4:5], s[0:1]
	v_mov_b32_e32 v4, 0
	v_mov_b32_e32 v5, 0x3ff00000
	ds_store_b64 v7, v[9:10]
	s_waitcnt lgkmcnt(0)
	buffer_gl1_inv
	buffer_gl0_inv
.LBB0_8:                                ; %.lr.ph.i
                                        ;   Parent Loop BB0_7 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ds_load_b64 v[9:10], v8
	v_add_nc_u32_e32 v8, 8, v8
	s_add_i32 s5, s5, -1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_lg_u32 s5, 0
	s_waitcnt lgkmcnt(0)
	v_mul_f64 v[4:5], v[4:5], v[9:10]
	s_cbranch_scc1 .LBB0_8
; %bb.9:                                ; %_Z6f_evalPdi.exit
                                        ;   in Loop: Header=BB0_7 Depth=1
	v_add_nc_u32_e32 v8, s2, v0
	s_mov_b32 s5, s4
	v_mov_b32_e32 v9, v6
	s_delay_alu instid0(VALU_DEP_2)
	v_lshl_add_u32 v8, v8, 3, s3
	ds_store_b64 v8, v[4:5]
	ds_load_b64 v[4:5], v7
	s_waitcnt lgkmcnt(0)
	v_add_f64 v[10:11], v[4:5], -v[2:3]
	v_mov_b32_e32 v4, 0
	v_mov_b32_e32 v5, 0x3ff00000
	ds_store_b64 v7, v[10:11]
	s_waitcnt lgkmcnt(0)
	buffer_gl1_inv
	buffer_gl0_inv
.LBB0_10:                               ; %.lr.ph.i49
                                        ;   Parent Loop BB0_7 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ds_load_b64 v[10:11], v9
	v_add_nc_u32_e32 v9, 8, v9
	s_add_i32 s5, s5, -1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_lg_u32 s5, 0
	s_waitcnt lgkmcnt(0)
	v_mul_f64 v[4:5], v[4:5], v[10:11]
	s_cbranch_scc1 .LBB0_10
; %bb.11:                               ; %_Z6f_evalPdi.exit53
                                        ;   in Loop: Header=BB0_7 Depth=1
	ds_load_b64 v[9:10], v8
	s_waitcnt lgkmcnt(0)
	v_add_f64 v[4:5], v[9:10], -v[4:5]
	ds_store_b64 v8, v[4:5]
	ds_load_b64 v[4:5], v7
	s_waitcnt lgkmcnt(0)
	v_add_f64 v[4:5], v[4:5], s[0:1]
	ds_store_b64 v7, v[4:5]
	s_waitcnt lgkmcnt(0)
	buffer_gl1_inv
	buffer_gl0_inv
	ds_load_b64 v[4:5], v8
	s_waitcnt lgkmcnt(0)
	v_div_scale_f64 v[7:8], null, s[0:1], s[0:1], v[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f64_e32 v[9:10], v[7:8]
	s_waitcnt_depctr 0xfff
	v_fma_f64 v[11:12], -v[7:8], v[9:10], 1.0
	v_fma_f64 v[9:10], v[9:10], v[11:12], v[9:10]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[11:12], -v[7:8], v[9:10], 1.0
	v_fma_f64 v[9:10], v[9:10], v[11:12], v[9:10]
	v_div_scale_f64 v[11:12], vcc_lo, v[4:5], s[0:1], v[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_f64 v[13:14], v[11:12], v[9:10]
	v_fma_f64 v[7:8], -v[7:8], v[13:14], v[11:12]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_div_fmas_f64 v[7:8], v[7:8], v[9:10], v[13:14]
	v_div_fixup_f64 v[4:5], v[7:8], s[0:1], v[4:5]
	v_add_nc_u32_e32 v7, s2, v1
	s_add_i32 s2, s2, 1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_cmp_eq_u32 s2, s4
	v_ashrrev_i32_e32 v8, 31, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[7:8], 3, v[7:8]
	v_add_co_u32 v7, vcc_lo, s10, v7
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v8, vcc_lo, s11, v8, vcc_lo
	v_mul_f64 v[4:5], v[4:5], 0.5
	global_store_b64 v[7:8], v[4:5], off
	s_cbranch_scc0 .LBB0_7
.LBB0_12:                               ; %.loopexit
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z8jacobianPdS_iiid
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 40
		.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 15
		.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	_Z8jacobianPdS_iiid, .Lfunc_end0-_Z8jacobianPdS_iiid
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 764
; NumSgprs: 18
; NumVgprs: 15
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 15
; 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:     by_value
      - .offset:         20
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           8
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 40
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z8jacobianPdS_iiid
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z8jacobianPdS_iiid.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     15
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
