#include "utilities.cuh"


cudaError_t arrayMalloc(void*** array, int length, size_t* size)
{
	cudaError_t cudaStatus;

	for (int i = 0; i < length; i++)
	{
		cudaStatus = cudaMalloc(array[i], size[i]);
		if (cudaStatus != cudaSuccess)
		{
			fprintf(stderr, "cudaMalloc failed!\n");
			goto Error;
		}
	}
Error:
	for (size_t i = 0; i < length; i++)
	{
		cudaFree(array[i]);
	}

	return cudaStatus;
}

cudaError_t arraycpyHtoD(void*** array_d, void*** array_h, int length, size_t* size)
{
	cudaError_t cudaStatus;

	for (int i = 0; i < length; i++)
	{
		cudaStatus = cudaMemcpy(*array_d[i], *array_h[i], size[i], cudaMemcpyHostToDevice);
		if (cudaStatus != cudaSuccess)
		{
			fprintf(stderr, "cudaMemcpy HostToDevice of array %d failed!\n", i);
			fprintf(stderr, "Reasons for failure : %s\n", cudaGetErrorString(cudaStatus));
			goto Error;
		}
	}
Error:
	for (size_t i = 0; i < length; i++)
	{
		cudaFree(array_d[i]);
	}

	return cudaStatus;
}

cudaError_t arraycpyHtoD_v2(void*** array_d, void** array_h, int length, size_t* size)
{
	cudaError_t cudaStatus;

	for (int i = 0; i < length; i++)
	{
		cudaStatus = cudaMemcpy(*array_d[i], array_h[i], size[i], cudaMemcpyHostToDevice);
		if (cudaStatus != cudaSuccess)
		{
			fprintf(stderr, "cudaMemcpy HostToDevice of array %d failed!\n", i);
			fprintf(stderr, "Reasons for failure : %s\n", cudaGetErrorString(cudaStatus));
			goto Error;
		}
	}
Error:
	for (size_t i = 0; i < length; i++)
	{
		cudaFree(array_d[i]);
	}

	return cudaStatus;
}

cudaError_t arraycpyDtoH(void*** array_h, void*** array_d, int length, size_t* size)
{
	cudaError_t cudaStatus;

	for (int i = 0; i < length; i++)
	{
		cudaStatus = cudaMemcpy(*array_h[i], *array_d[i], size[i], cudaMemcpyDeviceToHost);
		if (cudaStatus != cudaSuccess)
		{
			fprintf(stderr, "cudaMemcpy DeviceToHost of array %d failed!\n", i);
			goto Error;
		}
	}
Error:
	for (size_t i = 0; i < length; i++)
	{
		cudaFree(array_d[i]);
	}

	return cudaStatus;
}

cudaError_t arraycpyDtoH_v2(void** array_h, void*** array_d, int length, size_t* size)
{
	cudaError_t cudaStatus;

	for (int i = 0; i < length; i++)
	{
		cudaStatus = cudaMemcpy(array_h[i], *array_d[i], size[i], cudaMemcpyDeviceToHost);
		if (cudaStatus != cudaSuccess)
		{
			fprintf(stderr, "cudaMemcpy DeviceToHost of array %d failed!\n", i);
			goto Error;
		}
	}
Error:
	for (size_t i = 0; i < length; i++)
	{
		cudaFree(array_d[i]);
	}

	return cudaStatus;
}

cudaError_t oneMalloc(void** a_d, size_t size)
{
	cudaError_t cudaStatus;
	cudaStatus = cudaMalloc((void**)&a_d, size );
	if (cudaStatus != cudaSuccess) {
		fprintf(stderr, "cudaMalloc failed!\n");
	}
	return cudaStatus;
}

cudaError_t onecpyHtoD(void* dev_a, void* a, size_t size)
{
	cudaError_t cudaStatus;
	cudaStatus = cudaMemcpy(dev_a, a, size, cudaMemcpyHostToDevice);
	if (cudaStatus != cudaSuccess) {
		fprintf(stderr, "cudaMemcpy failed!\n");
	}
	return cudaStatus;
}

cudaError_t onecpyDtoH(void* a, void* dev_a, size_t size)
{
	cudaError_t cudaStatus;
	cudaStatus = cudaMemcpy(a, dev_a, size, cudaMemcpyDeviceToHost);
	if (cudaStatus != cudaSuccess) {
		fprintf(stderr, "one cudaMemcpy DtoH failed!\n");
	}
	return cudaStatus;
}

cudaError_t oneSetdevice()
{
	cudaError_t cudaStatus;
	cudaStatus = cudaSetDevice(0);
	if (cudaStatus != cudaSuccess) {
		fprintf(stderr, "cudaSetDevice failed!  Do you have a CUDA-capable GPU installed?\n");
	}
	return cudaStatus;
}

cudaError_t oneLastError()
{
	cudaError_t cudaStatus;
	cudaStatus = cudaGetLastError();
	if (cudaStatus != cudaSuccess) {
		fprintf(stderr, "addKernel launch failed: %s\n", cudaGetErrorString(cudaStatus));
	}
	return cudaStatus;
}

// cudaDeviceSynchronize waits for the kernel to finish, and returns
// any errors encountered during the launch.

cudaError_t oneCudaDeviceSync()
{
	cudaError_t cudaStatus;
	cudaStatus = cudaDeviceSynchronize();
	if (cudaStatus != cudaSuccess) {
		fprintf(stderr, "cudaDeviceSynchronize returned error code %d after launching addKernel!\n", cudaStatus);
	}
	return cudaStatus;
}

using namespace std;

void write_array_to_file(double* A, string filename, int M, int N)
{
	fstream file;
	file.open(filename, ios::out);

	for (int i = 0; i < M; i++)
	{
		if(i != M-1)
			for (int j = 0; j < N; j++)
			{
				if (j != N - 1)
					file << A[i * N + j] << ' ';
				else
					file << A[i * N + j] << '\n';
			}
		else
			for (int j = 0; j < N; j++)
			{
				if (j != N - 1)
					file << A[i * N + j] << ' ';
				else
					file << A[i * N + j];
			}
	}
}
void write_array_to_file_simple(double* A, string filename, int size)
{
	fstream file;
	file.open(filename, ios::out);


		for (int i = 0; i < size; i++)
		{
			try {
				file << A[i] << ' ';
			}
			catch (...)
			{
			 cout << filename << " writing error at element " << i << '/' << size << endl;
			}
		}
}

void write_array_to_file_simple_v(vector<double>& A, string filename, int size)
{
	fstream file;
	file.open(filename, ios::out);


	for (int i = 0; i < size; i++)
	{
		try {
			file << A[i] << ' ';
		}
		catch (...)
		{
			cout << filename << " writing error at element " << i << '/' << size << endl;
		}
	}
}
	.file	"tmpxft_0021afe4_00000000-6_utilities.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4145:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4145:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZNSt13basic_fstreamIcSt11char_traitsIcEE4openERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode.isra.0, @function
_ZNSt13basic_fstreamIcSt11char_traitsIcEE4openERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode.isra.0:
.LFB4865:
	.cfi_startproc
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	addq	$24, %rdi
	call	_ZNSt13basic_filebufIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	testq	%rax, %rax
	movq	(%rbx), %rax
	jne	.L3
	addq	-24(%rax), %rbx
	movl	$4, %esi
	movq	%rbx, %rdi
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	jmp	_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate@PLT
.L3:
	.cfi_restore_state
	addq	-24(%rax), %rbx
	xorl	%esi, %esi
	movq	%rbx, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate@PLT
	.cfi_endproc
.LFE4865:
	.size	_ZNSt13basic_fstreamIcSt11char_traitsIcEE4openERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode.isra.0, .-_ZNSt13basic_fstreamIcSt11char_traitsIcEE4openERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode.isra.0
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"cudaMalloc failed!\n"
	.text
	.globl	_Z11arrayMallocPPPviPm
	.type	_Z11arrayMallocPPPviPm, @function
_Z11arrayMallocPPPviPm:
.LFB4129:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%rdx, %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movslq	%esi, %rbx
.L7:
	cmpl	%ebp, %ebx
	jle	.L15
	movq	(%r14,%rbp,8), %rsi
	movq	0(%r13,%rbp,8), %rdi
	incq	%rbp
	call	cudaMalloc@PLT
	movl	%eax, %r12d
	testl	%eax, %eax
	je	.L7
	movq	stderr(%rip), %rdi
	leaq	.LC0(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	jmp	.L8
.L15:
	xorl	%r12d, %r12d
.L8:
	xorl	%ebp, %ebp
.L10:
	cmpq	%rbx, %rbp
	jnb	.L16
	movq	0(%r13,%rbp,8), %rdi
	incq	%rbp
	call	cudaFree@PLT
	jmp	.L10
.L16:
	popq	%rbx
	.cfi_def_cfa_offset 40
	movl	%r12d, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4129:
	.size	_Z11arrayMallocPPPviPm, .-_Z11arrayMallocPPPviPm
	.section	.rodata.str1.1
.LC1:
	.string	"cudaMemcpy HostToDevice of array %d failed!\n"
.LC2:
	.string	"Reasons for failure : %s\n"
	.text
	.globl	_Z12arraycpyHtoDPPPvS1_iPm
	.type	_Z12arraycpyHtoDPPPvS1_iPm, @function
_Z12arraycpyHtoDPPPvS1_iPm:
.LFB4130:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rcx, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movslq	%edx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	pushq	%r8
	.cfi_def_cfa_offset 64
.L18:
	cmpl	%ebx, %r12d
	jle	.L25
	movq	(%r14,%rbx,8), %rsi
	movq	0(%r13,%rbx,8), %rax
	movl	$1, %ecx
	movq	(%r15,%rbx,8), %rdx
	movq	(%rsi), %rsi
	movq	(%rax), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %ebp
	leaq	1(%rbx), %rax
	testl	%ebp, %ebp
	je	.L23
	movq	stderr(%rip), %rdi
	movl	%ebx, %ecx
	movl	$2, %esi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdx
	call	__fprintf_chk@PLT
	movl	%ebp, %edi
	call	cudaGetErrorString@PLT
	movq	stderr(%rip), %rdi
	movl	$2, %esi
	leaq	.LC2(%rip), %rdx
	movq	%rax, %rcx
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	jmp	.L19
.L23:
	movq	%rax, %rbx
	jmp	.L18
.L25:
	xorl	%ebp, %ebp
.L19:
	xorl	%ebx, %ebx
.L21:
	cmpq	%r12, %rbx
	jnb	.L26
	movq	0(%r13,%rbx,8), %rdi
	incq	%rbx
	call	cudaFree@PLT
	jmp	.L21
.L26:
	popq	%rdx
	.cfi_def_cfa_offset 56
	movl	%ebp, %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
.LFE4130:
	.size	_Z12arraycpyHtoDPPPvS1_iPm, .-_Z12arraycpyHtoDPPPvS1_iPm
	.globl	_Z15arraycpyHtoD_v2PPPvS0_iPm
	.type	_Z15arraycpyHtoD_v2PPPvS0_iPm, @function
_Z15arraycpyHtoD_v2PPPvS0_iPm:
.LFB4131:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rcx, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movslq	%edx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	pushq	%r8
	.cfi_def_cfa_offset 64
.L28:
	cmpl	%ebx, %r12d
	jle	.L35
	movq	0(%r13,%rbx,8), %rax
	movq	(%r15,%rbx,8), %rdx
	movl	$1, %ecx
	movq	(%r14,%rbx,8), %rsi
	movq	(%rax), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %ebp
	leaq	1(%rbx), %rax
	testl	%ebp, %ebp
	je	.L33
	movq	stderr(%rip), %rdi
	movl	%ebx, %ecx
	movl	$2, %esi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdx
	call	__fprintf_chk@PLT
	movl	%ebp, %edi
	call	cudaGetErrorString@PLT
	movq	stderr(%rip), %rdi
	movl	$2, %esi
	leaq	.LC2(%rip), %rdx
	movq	%rax, %rcx
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	jmp	.L29
.L33:
	movq	%rax, %rbx
	jmp	.L28
.L35:
	xorl	%ebp, %ebp
.L29:
	xorl	%ebx, %ebx
.L31:
	cmpq	%r12, %rbx
	jnb	.L36
	movq	0(%r13,%rbx,8), %rdi
	incq	%rbx
	call	cudaFree@PLT
	jmp	.L31
.L36:
	popq	%rdx
	.cfi_def_cfa_offset 56
	movl	%ebp, %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
.LFE4131:
	.size	_Z15arraycpyHtoD_v2PPPvS0_iPm, .-_Z15arraycpyHtoD_v2PPPvS0_iPm
	.section	.rodata.str1.1
.LC3:
	.string	"cudaMemcpy DeviceToHost of array %d failed!\n"
	.text
	.globl	_Z12arraycpyDtoHPPPvS1_iPm
	.type	_Z12arraycpyDtoHPPPvS1_iPm, @function
_Z12arraycpyDtoHPPPvS1_iPm:
.LFB4132:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rcx, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rsi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movslq	%edx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	pushq	%r8
	.cfi_def_cfa_offset 64
.L38:
	cmpl	%ebx, %ebp
	jle	.L45
	movq	0(%r13,%rbx,8), %rsi
	movq	(%r14,%rbx,8), %rax
	movl	$2, %ecx
	movq	(%r15,%rbx,8), %rdx
	movq	(%rsi), %rsi
	movq	(%rax), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %r12d
	leaq	1(%rbx), %rax
	testl	%r12d, %r12d
	je	.L43
	movq	stderr(%rip), %rdi
	movl	%ebx, %ecx
	movl	$2, %esi
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rdx
	call	__fprintf_chk@PLT
	jmp	.L39
.L43:
	movq	%rax, %rbx
	jmp	.L38
.L45:
	xorl	%r12d, %r12d
.L39:
	xorl	%ebx, %ebx
.L41:
	cmpq	%rbp, %rbx
	jnb	.L46
	movq	0(%r13,%rbx,8), %rdi
	incq	%rbx
	call	cudaFree@PLT
	jmp	.L41
.L46:
	popq	%rdx
	.cfi_def_cfa_offset 56
	movl	%r12d, %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
.LFE4132:
	.size	_Z12arraycpyDtoHPPPvS1_iPm, .-_Z12arraycpyDtoHPPPvS1_iPm
	.globl	_Z15arraycpyDtoH_v2PPvPS0_iPm
	.type	_Z15arraycpyDtoH_v2PPvPS0_iPm, @function
_Z15arraycpyDtoH_v2PPvPS0_iPm:
.LFB4133:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rcx, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rsi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movslq	%edx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	pushq	%r8
	.cfi_def_cfa_offset 64
.L48:
	cmpl	%ebx, %ebp
	jle	.L55
	movq	0(%r13,%rbx,8), %rax
	movq	(%r15,%rbx,8), %rdx
	movl	$2, %ecx
	movq	(%r14,%rbx,8), %rdi
	movq	(%rax), %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %r12d
	leaq	1(%rbx), %rax
	testl	%r12d, %r12d
	je	.L53
	movq	stderr(%rip), %rdi
	movl	%ebx, %ecx
	movl	$2, %esi
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rdx
	call	__fprintf_chk@PLT
	jmp	.L49
.L53:
	movq	%rax, %rbx
	jmp	.L48
.L55:
	xorl	%r12d, %r12d
.L49:
	xorl	%ebx, %ebx
.L51:
	cmpq	%rbp, %rbx
	jnb	.L56
	movq	0(%r13,%rbx,8), %rdi
	incq	%rbx
	call	cudaFree@PLT
	jmp	.L51
.L56:
	popq	%rdx
	.cfi_def_cfa_offset 56
	movl	%r12d, %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
.LFE4133:
	.size	_Z15arraycpyDtoH_v2PPvPS0_iPm, .-_Z15arraycpyDtoH_v2PPvPS0_iPm
	.globl	_Z9oneMallocPPvm
	.type	_Z9oneMallocPPvm, @function
_Z9oneMallocPPvm:
.LFB4134:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movq	%rdi, 8(%rsp)
	leaq	8(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L57
	movq	stderr(%rip), %rdi
	leaq	.LC0(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L57:
	addq	$16, %rsp
	.cfi_def_cfa_offset 16
	movl	%ebx, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4134:
	.size	_Z9oneMallocPPvm, .-_Z9oneMallocPPvm
	.section	.rodata.str1.1
.LC4:
	.string	"cudaMemcpy failed!\n"
	.text
	.globl	_Z10onecpyHtoDPvS_m
	.type	_Z10onecpyHtoDPvS_m, @function
_Z10onecpyHtoDPvS_m:
.LFB4135:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L63
	movq	stderr(%rip), %rdi
	leaq	.LC4(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L63:
	movl	%ebx, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4135:
	.size	_Z10onecpyHtoDPvS_m, .-_Z10onecpyHtoDPvS_m
	.section	.rodata.str1.1
.LC5:
	.string	"one cudaMemcpy DtoH failed!\n"
	.text
	.globl	_Z10onecpyDtoHPvS_m
	.type	_Z10onecpyDtoHPvS_m, @function
_Z10onecpyDtoHPvS_m:
.LFB4136:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	$2, %ecx
	call	cudaMemcpy@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L69
	movq	stderr(%rip), %rdi
	leaq	.LC5(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L69:
	movl	%ebx, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4136:
	.size	_Z10onecpyDtoHPvS_m, .-_Z10onecpyDtoHPvS_m
	.section	.rodata.str1.1
.LC6:
	.string	"cudaSetDevice failed!  Do you have a CUDA-capable GPU installed?\n"
	.text
	.globl	_Z12oneSetdevicev
	.type	_Z12oneSetdevicev, @function
_Z12oneSetdevicev:
.LFB4137:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	xorl	%edi, %edi
	call	cudaSetDevice@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L75
	movq	stderr(%rip), %rdi
	leaq	.LC6(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L75:
	movl	%ebx, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4137:
	.size	_Z12oneSetdevicev, .-_Z12oneSetdevicev
	.section	.rodata.str1.1
.LC7:
	.string	"addKernel launch failed: %s\n"
	.text
	.globl	_Z12oneLastErrorv
	.type	_Z12oneLastErrorv, @function
_Z12oneLastErrorv:
.LFB4138:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	call	cudaGetLastError@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L81
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movq	stderr(%rip), %rdi
	movl	$2, %esi
	leaq	.LC7(%rip), %rdx
	movq	%rax, %rcx
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
.L81:
	movl	%ebx, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4138:
	.size	_Z12oneLastErrorv, .-_Z12oneLastErrorv
	.section	.rodata.str1.1
.LC8:
	.string	"cudaDeviceSynchronize returned error code %d after launching addKernel!\n"
	.text
	.globl	_Z17oneCudaDeviceSyncv
	.type	_Z17oneCudaDeviceSyncv, @function
_Z17oneCudaDeviceSyncv:
.LFB4139:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	call	cudaDeviceSynchronize@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L87
	movq	stderr(%rip), %rdi
	movl	%eax, %ecx
	movl	$2, %esi
	xorl	%eax, %eax
	leaq	.LC8(%rip), %rdx
	call	__fprintf_chk@PLT
.L87:
	movl	%ebx, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4139:
	.size	_Z17oneCudaDeviceSyncv, .-_Z17oneCudaDeviceSyncv
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4168:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4168:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.text
	.globl	_Z19write_array_to_filePdNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEii
	.type	_Z19write_array_to_filePdNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEii, @function
_Z19write_array_to_filePdNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEii:
.LFB4140:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4140
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%ecx, %ebx
	subq	$584, %rsp
	.cfi_def_cfa_offset 640
	movq	%fs:40, %rax
	movq	%rax, 568(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
.LEHB0:
	call	_ZNSt13basic_fstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE0:
	movq	0(%rbp), %rsi
	movq	8(%rsp), %rdi
	movl	$16, %edx
.LEHB1:
	call	_ZNSt13basic_fstreamIcSt11char_traitsIcEE4openERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode.isra.0
	leal	-1(%r12), %eax
	xorl	%r15d, %r15d
	xorl	%r13d, %r13d
	movl	%eax, 28(%rsp)
.L96:
	cmpl	%r12d, %r13d
	jge	.L116
	movslq	%r15d, %rax
	cmpl	%r13d, 28(%rsp)
	movl	$0, %ebp
	leaq	(%r14,%rax,8), %rax
	movq	%rax, 16(%rsp)
	leal	-1(%rbx), %eax
	movl	%eax, 24(%rsp)
	je	.L98
.L99:
	cmpl	%ebx, %ebp
	jge	.L106
	movq	16(%rsp), %rax
	cmpl	%ebp, 24(%rsp)
	leaq	56(%rsp), %rdi
	movsd	(%rax,%rbp,8), %xmm0
	je	.L100
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	movl	$32, %esi
	jmp	.L115
.L100:
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	movl	$10, %esi
.L115:
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
	incq	%rbp
	jmp	.L99
.L105:
	movq	16(%rsp), %rax
	cmpl	%ebp, 24(%rsp)
	leaq	56(%rsp), %rdi
	movsd	(%rax,%rbp,8), %xmm0
	je	.L103
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	movl	$32, %esi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
.L104:
	incq	%rbp
.L98:
	cmpl	%ebx, %ebp
	jl	.L105
.L106:
	incl	%r13d
	addl	%ebx, %r15d
	jmp	.L96
.L103:
	call	_ZNSo9_M_insertIdEERSoT_@PLT
.LEHE1:
	jmp	.L104
.L116:
	movq	8(%rsp), %rdi
	call	_ZNSt13basic_fstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	568(%rsp), %rax
	subq	%fs:40, %rax
	je	.L110
	jmp	.L112
.L111:
	endbr64
	movq	%rax, %rbx
.L108:
	movq	8(%rsp), %rdi
	call	_ZNSt13basic_fstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	568(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L112
	movq	%rbx, %rdi
.LEHB2:
	call	_Unwind_Resume@PLT
.LEHE2:
.L112:
	call	__stack_chk_fail@PLT
.L110:
	addq	$584, %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
.LFE4140:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4140:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4140-.LLSDACSB4140
.LLSDACSB4140:
	.uleb128 .LEHB0-.LFB4140
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB4140
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L111-.LFB4140
	.uleb128 0
	.uleb128 .LEHB2-.LFB4140
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE4140:
	.text
	.size	_Z19write_array_to_filePdNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEii, .-_Z19write_array_to_filePdNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEii
	.section	.rodata.str1.1
.LC9:
	.string	" writing error at element "
	.text
	.globl	_Z26write_array_to_file_simplePdNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi
	.type	_Z26write_array_to_file_simplePdNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi, @function
_Z26write_array_to_file_simplePdNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi:
.LFB4141:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4141
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%edx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$552, %rsp
	.cfi_def_cfa_offset 608
	movq	%fs:40, %rax
	movq	%rax, 536(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rbp
	movq	%rbp, %rdi
.LEHB3:
	call	_ZNSt13basic_fstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE3:
	movq	(%r12), %rsi
	movl	$16, %edx
	movq	%rbp, %rdi
.LEHB4:
	call	_ZNSt13basic_fstreamIcSt11char_traitsIcEE4openERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode.isra.0
.LEHE4:
	xorl	%ebx, %ebx
	leaq	24(%rsp), %r15
.L118:
	cmpl	%ebx, %r13d
	jle	.L133
	movsd	(%r14,%rbx,8), %xmm0
	movq	%r15, %rdi
.LEHB5:
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	movl	$32, %esi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
.LEHE5:
.L121:
	incq	%rbx
	jmp	.L118
.L133:
	movq	%rbp, %rdi
	call	_ZNSt13basic_fstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	je	.L125
	jmp	.L131
.L128:
	endbr64
	movq	%rax, %rdi
.L120:
	call	__cxa_begin_catch@PLT
	movq	%r12, %rsi
	leaq	_ZSt4cout(%rip), %rdi
.LEHB6:
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	%rax, %rdi
	leaq	.LC9(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movl	%ebx, %esi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	movl	$47, %esi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
	movq	%rax, %rdi
	movl	%r13d, %esi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
.LEHE6:
.LEHB7:
	call	__cxa_end_catch@PLT
.LEHE7:
	jmp	.L121
.L129:
	endbr64
	movq	%rax, %rbx
.L122:
	call	__cxa_end_catch@PLT
	jmp	.L123
.L127:
	endbr64
	movq	%rax, %rbx
.L123:
	movq	%rbp, %rdi
	call	_ZNSt13basic_fstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L131
	movq	%rbx, %rdi
.LEHB8:
	call	_Unwind_Resume@PLT
.LEHE8:
.L131:
	call	__stack_chk_fail@PLT
.L125:
	addq	$552, %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
.LFE4141:
	.section	.gcc_except_table
	.align 4
.LLSDA4141:
	.byte	0xff
	.byte	0x9b
	.uleb128 .LLSDATT4141-.LLSDATTD4141
.LLSDATTD4141:
	.byte	0x1
	.uleb128 .LLSDACSE4141-.LLSDACSB4141
.LLSDACSB4141:
	.uleb128 .LEHB3-.LFB4141
	.uleb128 .LEHE3-.LEHB3
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB4-.LFB4141
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L127-.LFB4141
	.uleb128 0
	.uleb128 .LEHB5-.LFB4141
	.uleb128 .LEHE5-.LEHB5
	.uleb128 .L128-.LFB4141
	.uleb128 0x1
	.uleb128 .LEHB6-.LFB4141
	.uleb128 .LEHE6-.LEHB6
	.uleb128 .L129-.LFB4141
	.uleb128 0
	.uleb128 .LEHB7-.LFB4141
	.uleb128 .LEHE7-.LEHB7
	.uleb128 .L127-.LFB4141
	.uleb128 0
	.uleb128 .LEHB8-.LFB4141
	.uleb128 .LEHE8-.LEHB8
	.uleb128 0
	.uleb128 0
.LLSDACSE4141:
	.byte	0x1
	.byte	0
	.align 4
	.long	0

.LLSDATT4141:
	.text
	.size	_Z26write_array_to_file_simplePdNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi, .-_Z26write_array_to_file_simplePdNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi
	.globl	_Z28write_array_to_file_simple_vRSt6vectorIdSaIdEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi
	.type	_Z28write_array_to_file_simple_vRSt6vectorIdSaIdEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi, @function
_Z28write_array_to_file_simple_vRSt6vectorIdSaIdEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi:
.LFB4142:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4142
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%edx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$552, %rsp
	.cfi_def_cfa_offset 608
	movq	%fs:40, %rax
	movq	%rax, 536(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rbp
	movq	%rbp, %rdi
.LEHB9:
	call	_ZNSt13basic_fstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE9:
	movq	(%r12), %rsi
	movl	$16, %edx
	movq	%rbp, %rdi
.LEHB10:
	call	_ZNSt13basic_fstreamIcSt11char_traitsIcEE4openERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode.isra.0
.LEHE10:
	xorl	%ebx, %ebx
	leaq	24(%rsp), %r15
.L135:
	cmpl	%ebx, %r13d
	jle	.L150
	movq	(%r14), %rax
	movq	%r15, %rdi
	movsd	(%rax,%rbx,8), %xmm0
.LEHB11:
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	movl	$32, %esi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
.LEHE11:
.L138:
	incq	%rbx
	jmp	.L135
.L150:
	movq	%rbp, %rdi
	call	_ZNSt13basic_fstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	je	.L142
	jmp	.L148
.L145:
	endbr64
	movq	%rax, %rdi
.L137:
	call	__cxa_begin_catch@PLT
	movq	%r12, %rsi
	leaq	_ZSt4cout(%rip), %rdi
.LEHB12:
	call	_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	%rax, %rdi
	leaq	.LC9(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movl	%ebx, %esi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	movl	$47, %esi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
	movq	%rax, %rdi
	movl	%r13d, %esi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
.LEHE12:
.LEHB13:
	call	__cxa_end_catch@PLT
.LEHE13:
	jmp	.L138
.L146:
	endbr64
	movq	%rax, %rbx
.L139:
	call	__cxa_end_catch@PLT
	jmp	.L140
.L144:
	endbr64
	movq	%rax, %rbx
.L140:
	movq	%rbp, %rdi
	call	_ZNSt13basic_fstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L148
	movq	%rbx, %rdi
.LEHB14:
	call	_Unwind_Resume@PLT
.LEHE14:
.L148:
	call	__stack_chk_fail@PLT
.L142:
	addq	$552, %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
.LFE4142:
	.section	.gcc_except_table
	.align 4
.LLSDA4142:
	.byte	0xff
	.byte	0x9b
	.uleb128 .LLSDATT4142-.LLSDATTD4142
.LLSDATTD4142:
	.byte	0x1
	.uleb128 .LLSDACSE4142-.LLSDACSB4142
.LLSDACSB4142:
	.uleb128 .LEHB9-.LFB4142
	.uleb128 .LEHE9-.LEHB9
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB10-.LFB4142
	.uleb128 .LEHE10-.LEHB10
	.uleb128 .L144-.LFB4142
	.uleb128 0
	.uleb128 .LEHB11-.LFB4142
	.uleb128 .LEHE11-.LEHB11
	.uleb128 .L145-.LFB4142
	.uleb128 0x1
	.uleb128 .LEHB12-.LFB4142
	.uleb128 .LEHE12-.LEHB12
	.uleb128 .L146-.LFB4142
	.uleb128 0
	.uleb128 .LEHB13-.LFB4142
	.uleb128 .LEHE13-.LEHB13
	.uleb128 .L144-.LFB4142
	.uleb128 0
	.uleb128 .LEHB14-.LFB4142
	.uleb128 .LEHE14-.LEHB14
	.uleb128 0
	.uleb128 0
.LLSDACSE4142:
	.byte	0x1
	.byte	0
	.align 4
	.long	0

.LLSDATT4142:
	.text
	.size	_Z28write_array_to_file_simple_vRSt6vectorIdSaIdEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi, .-_Z28write_array_to_file_simple_vRSt6vectorIdSaIdEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi
	.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 <stdio.h>
#include <string>
#include <fstream>
#include <iostream>
#include <vector>
#include "math.h"

hipError_t arrayMalloc(void*** array, int length, size_t* size);
hipError_t arraycpyHtoD(void*** array_d, void*** array_h, int length, size_t* size);
hipError_t arraycpyHtoD_v2(void*** array_d, void** array_h, int length, size_t* size);
hipError_t arraycpyDtoH(void*** array_h, void*** array_d, int length, size_t* size);
hipError_t arraycpyDtoH_v2(void** array_h, void*** array_d, int length, size_t* size);
hipError_t oneMalloc(void** a_d, size_t size);
hipError_t onecpyHtoD(void* dev_a, void* a, size_t size);
hipError_t onecpyDtoH(void* a, void* dev_a, size_t size);
hipError_t oneSetdevice();
hipError_t oneLastError();
hipError_t oneCudaDeviceSync();
void write_array_to_file(double* A, std::string filename, int M, int N);
void write_array_to_file_simple(double* A, std::string filename, int size);
void write_array_to_file_simple_v(std::vector<double>& A, std::string filename, int size);


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

                                        # End of file scope inline assembly
	.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 __hip_cuid_

	.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_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
