#include <stdlib.h>
#include <stdio.h>

#define MY_CUDA_CHECK( call) {                                    \
    cudaError err = call;                                                    \
    if( cudaSuccess != err) {                                                \
        fprintf(stderr, "Cuda error in file '%s' in line %i : %s.\n",        \
                __FILE__, __LINE__, cudaGetErrorString( err) );              \
        exit(EXIT_FAILURE);                                                  \
    } }

#define MY_CHECK_ERROR(errorMessage) {                                    \
    cudaError_t err = cudaGetLastError();                                    \
    if( cudaSuccess != err) {                                                \
        fprintf(stderr, "Cuda error: %s in file '%s' in line %i : %s.\n",    \
                errorMessage, __FILE__, __LINE__, cudaGetErrorString( err) );\
        exit(EXIT_FAILURE);                                                  \
    }                                                                        \
    }

void writelog(int, int, const char *, ...);
#define MAKEMATR_RC 1
#if !defined(TRUE)
enum {FALSE, TRUE};
#endif
#if !defined(MAKEMATR_RC) 
#define MAKEMATR_RC 12
#endif

void **mmcuda(void ***rp, int r, int c, int s, int init) {
  int i;
  char **pc;
  short int **psi;
  int **pi;
  double **pd;
  char **d_pc;
  short int **d_psi;
  int **d_pi;
  double **d_pd;


  switch(s) {
  case sizeof(char):
    pc=(char **)malloc(r*sizeof(char *));
    if(!pc) writelog(TRUE, MAKEMATR_RC, "error in makematr 1\n");
    MY_CUDA_CHECK( cudaMalloc( (void **) &d_pc, r*sizeof(char*) ) );
    for(i=0; i<r; i++) {
      MY_CUDA_CHECK( cudaMalloc( (void **) &pc[i], c*sizeof(char) ) );
      if(init) {
            MY_CUDA_CHECK( cudaMemset( pc[i], 0, c*sizeof(char) ) );
      }
    }
    MY_CUDA_CHECK( cudaMemcpy( d_pc, pc, r*sizeof(char *), cudaMemcpyHostToDevice ) );
    rp[0]=(void **)d_pc;
    return (void **)pc;
  case sizeof(short int):
    psi=(short int **)malloc(r*sizeof(short int*));
    if(!psi) writelog(TRUE, MAKEMATR_RC, "error in makematr 2\n");
    MY_CUDA_CHECK( cudaMalloc( (void **) &d_psi, r*sizeof(short int*) ) );
    for(i=0; i<r; i++) {
      MY_CUDA_CHECK( cudaMalloc( (void **) &psi[i], c*sizeof(short int) ) );
      if(init) {
            MY_CUDA_CHECK( cudaMemset( psi[i], 0, c*sizeof(short int) ) );
      }
    }
    MY_CUDA_CHECK( cudaMemcpy( d_psi, psi, r*sizeof(short int*), cudaMemcpyHostToDevice ) );
    rp[0]=(void **)d_psi;
    return (void **)psi;
  case sizeof(int):
    pi=(int **)malloc(r*sizeof(int*));
    if(!pi) writelog(TRUE, MAKEMATR_RC, "error in makematr 3\n");
    MY_CUDA_CHECK( cudaMalloc( (void **) &d_pi, r*sizeof(int*) ) );
    for(i=0; i<r; i++) {
      MY_CUDA_CHECK( cudaMalloc( (void **) &pi[i], c*sizeof(int) ) );
      if(init) {
            MY_CUDA_CHECK( cudaMemset( pi[i], 0, c*sizeof(int) ) );
      }
    }
    MY_CUDA_CHECK( cudaMemcpy( d_pi, pi, r*sizeof(int *), cudaMemcpyHostToDevice ) );
    rp[0]=(void **)d_pi;
    return (void **)pi;
  case sizeof(double):
    pd=(double **)malloc(r*sizeof(double*));
    if(!pd) writelog(TRUE, MAKEMATR_RC, "error in makematr 4 for %d rows\n",r);
    MY_CUDA_CHECK( cudaMalloc( (void **) &d_pd, r*sizeof(double*) ) );
    for(i=0; i<r; i++) {
      MY_CUDA_CHECK( cudaMalloc( (void **) &pd[i], c*sizeof(double) ) );
      if(init) {
            MY_CUDA_CHECK( cudaMemset( pd[i], 0, c*sizeof(double) ) );
      }
    }
    MY_CUDA_CHECK( cudaMemcpy( d_pd, pd, r*sizeof(double *), cudaMemcpyHostToDevice ) );
    rp[0]=(void **)d_pd;
    return (void **)pd;
  default:
    writelog(TRUE,MAKEMATR_RC,"Unexpected size: %d\n",s);
    break;
  }
  return NULL;
}

	.file	"tmpxft_00336496_00000000-6_mmcuda.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2030:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2030:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"error in makematr 1\n"
.LC1:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/mbernaschi/StrongErgodicityBreaking/master/SBcode/GPU/mmcuda.cu"
.LC2:
	.string	"Cuda error in file '%s' in line %i : %s.\n"
.LC3:
	.string	"error in makematr 2\n"
.LC4:
	.string	"error in makematr 3\n"
.LC5:
	.string	"error in makematr 4 for %d rows\n"
.LC6:
	.string	"Unexpected size: %d\n"
	.text
	.globl	_Z6mmcudaPPPviiii
	.type	_Z6mmcudaPPPviiii, @function
_Z6mmcudaPPPviiii:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	%r8d, %r14d
	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
	movl	%esi, %r12d
	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
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	cmpl	$4, %ecx
	je	.L3
	jg	.L4
	cmpl	$1, %ecx
	je	.L5
	cmpl	$2, %ecx
	je	.L6
	jmp	.L7
.L4:
	cmpl	$8, %ecx
	je	.L8
	jmp	.L7
.L5:
	movslq	%esi, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	movq	%rax, (%rsp)
	call	malloc@PLT
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	.L9
	leaq	.LC0(%rip), %rdx
	movl	$1, %esi
	movl	$1, %edi
	xorl	%eax, %eax
	call	_Z8writelogiiPKcz@PLT
.L9:
	movq	(%rsp), %rsi
	leaq	16(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L10
	xorl	%eax, %eax
	movq	%rbx, %r15
	movl	%eax, 8(%rsp)
	jmp	.L11
.L10:
	call	cudaGetErrorString@PLT
	movl	$46, %r8d
	movq	%rax, %r9
	jmp	.L64
.L12:
	testl	%r14d, %r14d
	jne	.L66
.L13:
	incl	8(%rsp)
	addq	$8, %r15
.L11:
	cmpl	%r12d, 8(%rsp)
	jge	.L67
	movq	%r15, %rdi
	movq	%rbp, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L12
	call	cudaGetErrorString@PLT
	movl	$48, %r8d
	movq	%rax, %r9
.L64:
	movq	stderr(%rip), %rdi
	leaq	.LC1(%rip), %rcx
	leaq	.LC2(%rip), %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L66:
	movq	(%r15), %rdi
	movq	%rbp, %rdx
	xorl	%esi, %esi
	call	cudaMemset@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L13
	call	cudaGetErrorString@PLT
	movl	$50, %r8d
	movq	%rax, %r9
	jmp	.L64
.L67:
	movq	16(%rsp), %rdi
	movq	(%rsp), %rdx
	movl	$1, %ecx
	movq	%rbx, %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L37
	call	cudaGetErrorString@PLT
	movl	$53, %r8d
	movq	%rax, %r9
	jmp	.L64
.L6:
	movslq	%esi, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	movq	%rax, (%rsp)
	call	malloc@PLT
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	.L17
	leaq	.LC3(%rip), %rdx
	movl	$1, %esi
	movl	$1, %edi
	xorl	%eax, %eax
	call	_Z8writelogiiPKcz@PLT
.L17:
	movq	(%rsp), %rsi
	leaq	16(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L18
	leaq	0(%rbp,%rbp), %rax
	xorl	%r15d, %r15d
	movq	%rbx, %rbp
	movq	%rax, 8(%rsp)
	jmp	.L19
.L18:
	call	cudaGetErrorString@PLT
	movl	$59, %r8d
	movq	%rax, %r9
	jmp	.L64
.L20:
	testl	%r14d, %r14d
	jne	.L68
.L21:
	incl	%r15d
	addq	$8, %rbp
.L19:
	cmpl	%r12d, %r15d
	jge	.L69
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L20
	call	cudaGetErrorString@PLT
	movl	$61, %r8d
	movq	%rax, %r9
	jmp	.L64
.L68:
	movq	0(%rbp), %rdi
	movq	8(%rsp), %rdx
	xorl	%esi, %esi
	call	cudaMemset@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L21
	call	cudaGetErrorString@PLT
	movl	$63, %r8d
	movq	%rax, %r9
	jmp	.L64
.L69:
	movq	16(%rsp), %rdi
	movq	(%rsp), %rdx
	movl	$1, %ecx
	movq	%rbx, %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L37
	call	cudaGetErrorString@PLT
	movl	$66, %r8d
	movq	%rax, %r9
	jmp	.L64
.L3:
	movslq	%esi, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	movq	%rax, (%rsp)
	call	malloc@PLT
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	.L24
	leaq	.LC4(%rip), %rdx
	movl	$1, %esi
	movl	$1, %edi
	xorl	%eax, %eax
	call	_Z8writelogiiPKcz@PLT
.L24:
	movq	(%rsp), %rsi
	leaq	16(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L25
	leaq	0(,%rbp,4), %rax
	xorl	%r15d, %r15d
	movq	%rbx, %rbp
	movq	%rax, 8(%rsp)
	jmp	.L26
.L25:
	call	cudaGetErrorString@PLT
	movl	$72, %r8d
	movq	%rax, %r9
	jmp	.L64
.L27:
	testl	%r14d, %r14d
	jne	.L70
.L28:
	incl	%r15d
	addq	$8, %rbp
.L26:
	cmpl	%r12d, %r15d
	jge	.L71
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L27
	call	cudaGetErrorString@PLT
	movl	$74, %r8d
	movq	%rax, %r9
	jmp	.L64
.L70:
	movq	0(%rbp), %rdi
	movq	8(%rsp), %rdx
	xorl	%esi, %esi
	call	cudaMemset@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L28
	call	cudaGetErrorString@PLT
	movl	$76, %r8d
	movq	%rax, %r9
	jmp	.L64
.L71:
	movq	16(%rsp), %rdi
	movq	(%rsp), %rdx
	movl	$1, %ecx
	movq	%rbx, %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L37
	call	cudaGetErrorString@PLT
	movl	$79, %r8d
	movq	%rax, %r9
	jmp	.L64
.L8:
	movslq	%esi, %rax
	salq	$3, %rax
	movq	%rax, %rdi
	movq	%rax, (%rsp)
	call	malloc@PLT
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	.L31
	movl	%r12d, %ecx
	movl	$1, %esi
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	.LC5(%rip), %rdx
	call	_Z8writelogiiPKcz@PLT
.L31:
	movq	(%rsp), %rsi
	leaq	16(%rsp), %rdi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	jne	.L32
	leaq	0(,%rbp,8), %rax
	xorl	%r15d, %r15d
	movq	%rbx, %rbp
	movq	%rax, 8(%rsp)
	jmp	.L33
.L32:
	call	cudaGetErrorString@PLT
	movl	$85, %r8d
	movq	%rax, %r9
	jmp	.L64
.L34:
	testl	%r14d, %r14d
	jne	.L72
.L35:
	incl	%r15d
	addq	$8, %rbp
.L33:
	cmpl	%r12d, %r15d
	jge	.L73
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L34
	call	cudaGetErrorString@PLT
	movl	$87, %r8d
	movq	%rax, %r9
	jmp	.L64
.L72:
	movq	0(%rbp), %rdi
	movq	8(%rsp), %rdx
	xorl	%esi, %esi
	call	cudaMemset@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L35
	call	cudaGetErrorString@PLT
	movl	$89, %r8d
	movq	%rax, %r9
	jmp	.L64
.L73:
	movq	16(%rsp), %rdi
	movq	(%rsp), %rdx
	movl	$1, %ecx
	movq	%rbx, %rsi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L37
	call	cudaGetErrorString@PLT
	movl	$92, %r8d
	movq	%rax, %r9
	jmp	.L64
.L37:
	movq	16(%rsp), %rax
	movq	%rax, 0(%r13)
	jmp	.L2
.L7:
	leaq	.LC6(%rip), %rdx
	movl	$1, %esi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	movl	$1, %edi
	call	_Z8writelogiiPKcz@PLT
.L2:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L38
	call	__stack_chk_fail@PLT
.L38:
	addq	$40, %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
.LFE2027:
	.size	_Z6mmcudaPPPviiii, .-_Z6mmcudaPPPviiii
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2053:
	.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
.LFE2053:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.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 <stdlib.h>
#include <stdio.h>

#define MY_CUDA_CHECK( call) {                                    \
    hipError_t err = call;                                                    \
    if( hipSuccess != err) {                                                \
        fprintf(stderr, "Cuda error in file '%s' in line %i : %s.\n",        \
                __FILE__, __LINE__, hipGetErrorString( err) );              \
        exit(EXIT_FAILURE);                                                  \
    } }

#define MY_CHECK_ERROR(errorMessage) {                                    \
    hipError_t err = hipGetLastError();                                    \
    if( hipSuccess != err) {                                                \
        fprintf(stderr, "Cuda error: %s in file '%s' in line %i : %s.\n",    \
                errorMessage, __FILE__, __LINE__, hipGetErrorString( err) );\
        exit(EXIT_FAILURE);                                                  \
    }                                                                        \
    }

void writelog(int, int, const char *, ...);
#define MAKEMATR_RC 1
#if !defined(TRUE)
enum {FALSE, TRUE};
#endif
#if !defined(MAKEMATR_RC) 
#define MAKEMATR_RC 12
#endif

void **mmcuda(void ***rp, int r, int c, int s, int init) {
  int i;
  char **pc;
  short int **psi;
  int **pi;
  double **pd;
  char **d_pc;
  short int **d_psi;
  int **d_pi;
  double **d_pd;


  switch(s) {
  case sizeof(char):
    pc=(char **)malloc(r*sizeof(char *));
    if(!pc) writelog(TRUE, MAKEMATR_RC, "error in makematr 1\n");
    MY_CUDA_CHECK( hipMalloc( (void **) &d_pc, r*sizeof(char*) ) );
    for(i=0; i<r; i++) {
      MY_CUDA_CHECK( hipMalloc( (void **) &pc[i], c*sizeof(char) ) );
      if(init) {
            MY_CUDA_CHECK( hipMemset( pc[i], 0, c*sizeof(char) ) );
      }
    }
    MY_CUDA_CHECK( hipMemcpy( d_pc, pc, r*sizeof(char *), hipMemcpyHostToDevice ) );
    rp[0]=(void **)d_pc;
    return (void **)pc;
  case sizeof(short int):
    psi=(short int **)malloc(r*sizeof(short int*));
    if(!psi) writelog(TRUE, MAKEMATR_RC, "error in makematr 2\n");
    MY_CUDA_CHECK( hipMalloc( (void **) &d_psi, r*sizeof(short int*) ) );
    for(i=0; i<r; i++) {
      MY_CUDA_CHECK( hipMalloc( (void **) &psi[i], c*sizeof(short int) ) );
      if(init) {
            MY_CUDA_CHECK( hipMemset( psi[i], 0, c*sizeof(short int) ) );
      }
    }
    MY_CUDA_CHECK( hipMemcpy( d_psi, psi, r*sizeof(short int*), hipMemcpyHostToDevice ) );
    rp[0]=(void **)d_psi;
    return (void **)psi;
  case sizeof(int):
    pi=(int **)malloc(r*sizeof(int*));
    if(!pi) writelog(TRUE, MAKEMATR_RC, "error in makematr 3\n");
    MY_CUDA_CHECK( hipMalloc( (void **) &d_pi, r*sizeof(int*) ) );
    for(i=0; i<r; i++) {
      MY_CUDA_CHECK( hipMalloc( (void **) &pi[i], c*sizeof(int) ) );
      if(init) {
            MY_CUDA_CHECK( hipMemset( pi[i], 0, c*sizeof(int) ) );
      }
    }
    MY_CUDA_CHECK( hipMemcpy( d_pi, pi, r*sizeof(int *), hipMemcpyHostToDevice ) );
    rp[0]=(void **)d_pi;
    return (void **)pi;
  case sizeof(double):
    pd=(double **)malloc(r*sizeof(double*));
    if(!pd) writelog(TRUE, MAKEMATR_RC, "error in makematr 4 for %d rows\n",r);
    MY_CUDA_CHECK( hipMalloc( (void **) &d_pd, r*sizeof(double*) ) );
    for(i=0; i<r; i++) {
      MY_CUDA_CHECK( hipMalloc( (void **) &pd[i], c*sizeof(double) ) );
      if(init) {
            MY_CUDA_CHECK( hipMemset( pd[i], 0, c*sizeof(double) ) );
      }
    }
    MY_CUDA_CHECK( hipMemcpy( d_pd, pd, r*sizeof(double *), hipMemcpyHostToDevice ) );
    rp[0]=(void **)d_pd;
    return (void **)pd;
  default:
    writelog(TRUE,MAKEMATR_RC,"Unexpected size: %d\n",s);
    break;
  }
  return NULL;
}

	.text
	.file	"mmcuda.hip"
	.globl	_Z6mmcudaPPPviiii               # -- Begin function _Z6mmcudaPPPviiii
	.type	_Z6mmcudaPPPviiii,@function
_Z6mmcudaPPPviiii:                      # @_Z6mmcudaPPPviiii
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
                                        # kill: def $ecx killed $ecx def $rcx
	leal	-1(%rcx), %eax
	cmpl	$7, %eax
	ja	.LBB0_57
# %bb.1:
	movl	%r8d, %ebp
	movl	%edx, %r12d
	movl	%esi, %r15d
	jmpq	*.LJTI0_0(,%rax,8)
.LBB0_2:
	movq	%rdi, 16(%rsp)                  # 8-byte Spill
	movslq	%r15d, %r13
	shlq	$3, %r13
	movq	%r13, %rdi
	callq	malloc
	movq	%rax, %r14
	testq	%rax, %rax
	jne	.LBB0_4
# %bb.3:
	movl	$.L.str, %edx
	movl	$1, %edi
	movl	$1, %esi
	xorl	%eax, %eax
	callq	_Z8writelogiiPKcz
.LBB0_4:
	leaq	8(%rsp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB0_9
# %bb.5:                                # %.preheader
	testl	%r15d, %r15d
	jle	.LBB0_15
# %bb.6:                                # %.lr.ph165
	movslq	%r12d, %r12
	movl	%r15d, %ebx
	movq	%r14, %r15
.LBB0_7:                                # =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB0_8
# %bb.11:                               #   in Loop: Header=BB0_7 Depth=1
	testl	%ebp, %ebp
	je	.LBB0_14
# %bb.12:                               #   in Loop: Header=BB0_7 Depth=1
	movq	(%r15), %rdi
	xorl	%esi, %esi
	movq	%r12, %rdx
	callq	hipMemset
	testl	%eax, %eax
	jne	.LBB0_13
.LBB0_14:                               #   in Loop: Header=BB0_7 Depth=1
	addq	$8, %r15
	decq	%rbx
	jne	.LBB0_7
.LBB0_15:                               # %._crit_edge166
	movq	8(%rsp), %rdi
	movq	%r14, %rsi
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	je	.LBB0_56
# %bb.16:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movq	%rbx, %rdi
	movl	$55, %ecx
	jmp	.LBB0_10
.LBB0_30:
	movq	%rdi, 16(%rsp)                  # 8-byte Spill
	movslq	%r15d, %r13
	shlq	$3, %r13
	movq	%r13, %rdi
	callq	malloc
	movq	%rax, %r14
	testq	%rax, %rax
	jne	.LBB0_32
# %bb.31:
	movl	$.L.str.4, %edx
	movl	$1, %edi
	movl	$1, %esi
	xorl	%eax, %eax
	callq	_Z8writelogiiPKcz
.LBB0_32:
	leaq	8(%rsp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB0_60
# %bb.33:                               # %.preheader144
	testl	%r15d, %r15d
	jle	.LBB0_41
# %bb.34:                               # %.lr.ph159
	movslq	%r12d, %r12
	shlq	$2, %r12
	movl	%r15d, %ebx
	movq	%r14, %r15
.LBB0_35:                               # =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB0_36
# %bb.37:                               #   in Loop: Header=BB0_35 Depth=1
	testl	%ebp, %ebp
	je	.LBB0_40
# %bb.38:                               #   in Loop: Header=BB0_35 Depth=1
	movq	(%r15), %rdi
	xorl	%esi, %esi
	movq	%r12, %rdx
	callq	hipMemset
	testl	%eax, %eax
	jne	.LBB0_39
.LBB0_40:                               #   in Loop: Header=BB0_35 Depth=1
	addq	$8, %r15
	decq	%rbx
	jne	.LBB0_35
.LBB0_41:                               # %._crit_edge160
	movq	8(%rsp), %rdi
	movq	%r14, %rsi
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	je	.LBB0_56
# %bb.42:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movq	%rbx, %rdi
	movl	$81, %ecx
	jmp	.LBB0_10
.LBB0_17:
	movq	%rdi, 16(%rsp)                  # 8-byte Spill
	movslq	%r15d, %r13
	shlq	$3, %r13
	movq	%r13, %rdi
	callq	malloc
	movq	%rax, %r14
	testq	%rax, %rax
	jne	.LBB0_19
# %bb.18:
	movl	$.L.str.3, %edx
	movl	$1, %edi
	movl	$1, %esi
	xorl	%eax, %eax
	callq	_Z8writelogiiPKcz
.LBB0_19:
	leaq	8(%rsp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB0_59
# %bb.20:                               # %.preheader143
	testl	%r15d, %r15d
	jle	.LBB0_28
# %bb.21:                               # %.lr.ph162
	movslq	%r12d, %r12
	addq	%r12, %r12
	movl	%r15d, %ebx
	movq	%r14, %r15
.LBB0_22:                               # =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB0_23
# %bb.24:                               #   in Loop: Header=BB0_22 Depth=1
	testl	%ebp, %ebp
	je	.LBB0_27
# %bb.25:                               #   in Loop: Header=BB0_22 Depth=1
	movq	(%r15), %rdi
	xorl	%esi, %esi
	movq	%r12, %rdx
	callq	hipMemset
	testl	%eax, %eax
	jne	.LBB0_26
.LBB0_27:                               #   in Loop: Header=BB0_22 Depth=1
	addq	$8, %r15
	decq	%rbx
	jne	.LBB0_22
.LBB0_28:                               # %._crit_edge163
	movq	8(%rsp), %rdi
	movq	%r14, %rsi
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	je	.LBB0_56
# %bb.29:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movq	%rbx, %rdi
	movl	$68, %ecx
	jmp	.LBB0_10
.LBB0_43:
	movq	%rdi, 16(%rsp)                  # 8-byte Spill
	movslq	%r15d, %r13
	shlq	$3, %r13
	movq	%r13, %rdi
	callq	malloc
	movq	%rax, %r14
	testq	%rax, %rax
	jne	.LBB0_45
# %bb.44:
	movl	$.L.str.5, %edx
	movl	$1, %edi
	movl	$1, %esi
	movl	%r15d, %ecx
	xorl	%eax, %eax
	callq	_Z8writelogiiPKcz
.LBB0_45:
	leaq	8(%rsp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB0_61
# %bb.46:                               # %.preheader145
	testl	%r15d, %r15d
	jle	.LBB0_54
# %bb.47:                               # %.lr.ph
	movslq	%r12d, %r12
	shlq	$3, %r12
	movl	%r15d, %ebx
	movq	%r14, %r15
.LBB0_48:                               # =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB0_49
# %bb.50:                               #   in Loop: Header=BB0_48 Depth=1
	testl	%ebp, %ebp
	je	.LBB0_53
# %bb.51:                               #   in Loop: Header=BB0_48 Depth=1
	movq	(%r15), %rdi
	xorl	%esi, %esi
	movq	%r12, %rdx
	callq	hipMemset
	testl	%eax, %eax
	jne	.LBB0_52
.LBB0_53:                               #   in Loop: Header=BB0_48 Depth=1
	addq	$8, %r15
	decq	%rbx
	jne	.LBB0_48
.LBB0_54:                               # %._crit_edge
	movq	8(%rsp), %rdi
	movq	%r14, %rsi
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB0_55
.LBB0_56:
	movq	8(%rsp), %rax
	movq	16(%rsp), %rcx                  # 8-byte Reload
	movq	%rax, (%rcx)
	jmp	.LBB0_58
.LBB0_57:
	xorl	%r14d, %r14d
	movl	$.L.str.6, %edx
	movl	$1, %edi
	movl	$1, %esi
                                        # kill: def $ecx killed $ecx killed $rcx
	xorl	%eax, %eax
	callq	_Z8writelogiiPKcz
.LBB0_58:
	movq	%r14, %rax
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB0_36:
	.cfi_def_cfa_offset 80
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movq	%rbx, %rdi
	movl	$76, %ecx
	jmp	.LBB0_10
.LBB0_8:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movq	%rbx, %rdi
	movl	$50, %ecx
	jmp	.LBB0_10
.LBB0_23:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movq	%rbx, %rdi
	movl	$63, %ecx
	jmp	.LBB0_10
.LBB0_49:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movq	%rbx, %rdi
	movl	$89, %ecx
	jmp	.LBB0_10
.LBB0_39:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movq	%rbx, %rdi
	movl	$78, %ecx
	jmp	.LBB0_10
.LBB0_13:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movq	%rbx, %rdi
	movl	$52, %ecx
	jmp	.LBB0_10
.LBB0_26:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movq	%rbx, %rdi
	movl	$65, %ecx
	jmp	.LBB0_10
.LBB0_52:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movq	%rbx, %rdi
	movl	$91, %ecx
.LBB0_10:
	movq	%rax, %r8
	xorl	%eax, %eax
	callq	fprintf
	movl	$1, %edi
	callq	exit
.LBB0_60:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movq	%rbx, %rdi
	movl	$74, %ecx
	jmp	.LBB0_10
.LBB0_9:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movq	%rbx, %rdi
	movl	$48, %ecx
	jmp	.LBB0_10
.LBB0_59:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movq	%rbx, %rdi
	movl	$61, %ecx
	jmp	.LBB0_10
.LBB0_61:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movq	%rbx, %rdi
	movl	$87, %ecx
	jmp	.LBB0_10
.LBB0_55:
	movq	stderr(%rip), %rbx
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str.1, %esi
	movl	$.L.str.2, %edx
	movq	%rbx, %rdi
	movl	$94, %ecx
	jmp	.LBB0_10
.Lfunc_end0:
	.size	_Z6mmcudaPPPviiii, .Lfunc_end0-_Z6mmcudaPPPviiii
	.cfi_endproc
	.section	.rodata,"a",@progbits
	.p2align	3, 0x0
.LJTI0_0:
	.quad	.LBB0_2
	.quad	.LBB0_17
	.quad	.LBB0_57
	.quad	.LBB0_30
	.quad	.LBB0_57
	.quad	.LBB0_57
	.quad	.LBB0_57
	.quad	.LBB0_43
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"error in makematr 1\n"
	.size	.L.str, 21

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Cuda error in file '%s' in line %i : %s.\n"
	.size	.L.str.1, 42

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/mbernaschi/StrongErgodicityBreaking/master/SBcode/GPU/mmcuda.hip"
	.size	.L.str.2, 127

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"error in makematr 2\n"
	.size	.L.str.3, 21

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"error in makematr 3\n"
	.size	.L.str.4, 21

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"error in makematr 4 for %d rows\n"
	.size	.L.str.5, 33

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Unexpected size: %d\n"
	.size	.L.str.6, 21

	.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
