#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ errhandler(int, char *, char *);
scalar_t__ malloc(unsigned int);
double ***matrix2(int nrl, int nrh, int ncl, int nch, int nll, int nlh) {
  double ***pArray;
  int i, j;
  pArray = (double ***)malloc((unsigned)(nrh - nrl + 1) * sizeof(double **));
  if (pArray == 0)
    errhandler(451,
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/EvaBr/CFD-Lab/refs/heads/"
               "master/Backup/FinalProjectPresentation/helper.c",
               "Storage cannot be allocated");
  pArray -= nrl;
  for (i = nrl; i <= nrh; i++) {
    pArray[i] = (double **)malloc((unsigned)(nch - ncl + 1) * sizeof(double *));
    if (pArray[i] == 0)
      errhandler(456,
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/EvaBr/CFD-Lab/refs/heads/"
                 "master/Backup/FinalProjectPresentation/helper.c",
                 "Storage cannot be allocated");
    pArray[i] -= ncl;
    for (j = ncl; j <= nch; j++) {
      pArray[i][j] =
          (double *)malloc((unsigned)(nlh - nll + 1) * sizeof(double));
      if (pArray[i][j] == 0)
        errhandler(460,
                   "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/EvaBr/CFD-Lab/refs/heads/"
                   "master/Backup/FinalProjectPresentation/helper.c",
                   "Storage cannot be allocated");
      pArray[i][j] -= nll;
    }
  }
  return pArray;
}


x86 assembly (clang, -O0):
<matrix2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,%eax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1179 <matrix2+0x59>
mov    $0x1c3,%edi
lea    0xe93(%rip),%rsi
lea    0xf2f(%rip),%rdx
call   1030 <errhandler@plt>
mov    -0x4(%rbp),%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     12d4 <matrix2+0x1b4>
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,%eax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    11f5 <matrix2+0xd5>
mov    $0x1c8,%edi
lea    0xe17(%rip),%rsi
lea    0xeb3(%rip),%rdx
call   1030 <errhandler@plt>
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
movslq %esi,%rdi
xor    %esi,%esi
sub    %rdi,%rsi
shl    $0x3,%rsi
add    %rsi,%rdx
mov    %rdx,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     12c1 <matrix2+0x1a1>
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,%eax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    1289 <matrix2+0x169>
mov    $0x1cc,%edi
lea    0xd83(%rip),%rsi
lea    0xe1f(%rip),%rdx
call   1030 <errhandler@plt>
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
movslq %esi,%rdi
xor    %esi,%esi
sub    %rdi,%rsi
shl    $0x3,%rsi
add    %rsi,%rdx
mov    %rdx,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    121d <matrix2+0xfd>
jmp    12c6 <matrix2+0x1a6>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1199 <matrix2+0x79>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrix2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9d,%r15d
mov    %r8d,%r14d
mov    %ecx,0x8(%rsp)
mov    %edx,0x4(%rsp)
mov    %esi,%r13d
mov    %edi,%ebx
mov    %esi,%eax
sub    %edi,%eax
lea    0x8(,%rax,8),%edi
call   1040 <malloc@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1171 <matrix2+0x51>
lea    0xea0(%rip),%rsi
lea    0xf3c(%rip),%rdx
mov    $0x1c3,%edi
call   1030 <errhandler@plt>
movslq %ebx,%r12
lea    0x0(,%r12,8),%rax
sub    %rax,%rbp
mov    %r13d,(%rsp)
cmp    %ebx,%r13d
jge    119a <matrix2+0x7a>
mov    %rbp,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rsp),%eax
mov    %eax,%ecx
mov    0x4(%rsp),%eax
sub    %eax,%ecx
lea    0x8(,%rcx,8),%edx
mov    %edx,0xc(%rsp)
cltq
mov    %rax,0x10(%rsp)
neg    %rax
mov    %rax,0x20(%rsp)
sub    %r14d,%r15d
lea    0x8(,%r15,8),%ebx
movslq %r14d,%r13
neg    %r13
addl   $0x1,(%rsp)
add    $0x1,%ecx
mov    %rcx,0x18(%rsp)
jmp    11ea <matrix2+0xca>
nop
add    $0x1,%r12
cmp    %r12d,(%rsp)
je     1188 <matrix2+0x68>
mov    0xc(%rsp),%edi
call   1040 <malloc@plt>
mov    %rax,0x0(%rbp,%r12,8)
test   %rax,%rax
jne    121a <matrix2+0xfa>
mov    $0x1c8,%edi
lea    0xdf7(%rip),%rsi
lea    0xe93(%rip),%rdx
call   1030 <errhandler@plt>
mov    0x0(%rbp,%r12,8),%rax
mov    0x20(%rsp),%rcx
lea    (%rax,%rcx,8),%rax
mov    %rax,0x0(%rbp,%r12,8)
mov    0x4(%rsp),%eax
cmp    %eax,0x8(%rsp)
jl     11e0 <matrix2+0xc0>
mov    0x18(%rsp),%rax
mov    %eax,%r14d
mov    0x10(%rsp),%r15
jmp    1266 <matrix2+0x146>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    (%rcx,%r13,8),%rcx
mov    %rcx,(%rax,%r15,8)
add    $0x1,%r15
add    $0xffffffff,%r14d
je     11e0 <matrix2+0xc0>
mov    %ebx,%edi
call   1040 <malloc@plt>
mov    0x0(%rbp,%r12,8),%rcx
mov    %rax,(%rcx,%r15,8)
mov    0x0(%rbp,%r12,8),%rax
mov    (%rax,%r15,8),%rcx
test   %rcx,%rcx
jne    1250 <matrix2+0x130>
mov    $0x1cc,%edi
lea    0xd70(%rip),%rsi
lea    0xe0c(%rip),%rdx
call   1030 <errhandler@plt>
mov    0x0(%rbp,%r12,8),%rax
mov    (%rax,%r15,8),%rcx
jmp    1250 <matrix2+0x130>

LLVM IR (-O0):
@.str = [163 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/EvaBr/CFD-Lab/refs/heads/master/Backup/FinalProjectPresentation/helper.c\00"
@.str.1 = [28 x i8] c"Storage cannot be allocated\00"
define double*** @matrix2(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double***
%14 = alloca i32
%15 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%16 = load i32, i32* %8
%17 = load i32, i32* %7
%18 = sub nsw i32 %16, %17
%19 = add nsw i32 %18, 1
%20 = zext i32 %19 to i64
%21 = mul i64 %20, 8
%22 = trunc i64 %21 to i32
%23 = call i64 @malloc(i32 %22)
%24 = inttoptr i64 %23 to double***
store double*** %24, double**** %13
%25 = load double***, double**** %13
%26 = icmp eq double*** %25, null
br i1 %26, label %27, label %29
27: ; preds = %6
%28 = call i32 @errhandler(i32 451, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %27, %6
%30 = load i32, i32* %7
%31 = load double***, double**** %13
%32 = sext i32 %30 to i64
%33 = sub i64 0, %32
%34 = getelementptr inbounds double**, double*** %31, i64 %33
store double*** %34, double**** %13
%35 = load i32, i32* %7
store i32 %35, i32* %14
br label %36
36: ; preds = %125, %29
%37 = load i32, i32* %14
%38 = load i32, i32* %8
%39 = icmp sle i32 %37, %38
br i1 %39, label %40, label %128
40: ; preds = %36
%41 = load i32, i32* %10
%42 = load i32, i32* %9
%43 = sub nsw i32 %41, %42
%44 = add nsw i32 %43, 1
%45 = zext i32 %44 to i64
%46 = mul i64 %45, 8
%47 = trunc i64 %46 to i32
%48 = call i64 @malloc(i32 %47)
%49 = inttoptr i64 %48 to double**
%50 = load double***, double**** %13
%51 = load i32, i32* %14
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double**, double*** %50, i64 %52
store double** %49, double*** %53
%54 = load double***, double**** %13
%55 = load i32, i32* %14
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds double**, double*** %54, i64 %56
%58 = load double**, double*** %57
%59 = icmp eq double** %58, null
br i1 %59, label %60, label %62
60: ; preds = %40
%61 = call i32 @errhandler(i32 456, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %62
62: ; preds = %60, %40
%63 = load i32, i32* %9
%64 = load double***, double**** %13
%65 = load i32, i32* %14
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double**, double*** %64, i64 %66
%68 = load double**, double*** %67
%69 = sext i32 %63 to i64
%70 = sub i64 0, %69
%71 = getelementptr inbounds double*, double** %68, i64 %70
store double** %71, double*** %67
%72 = load i32, i32* %9
store i32 %72, i32* %15
br label %73
73: ; preds = %121, %62
%74 = load i32, i32* %15
%75 = load i32, i32* %10
%76 = icmp sle i32 %74, %75
br i1 %76, label %77, label %124
77: ; preds = %73
%78 = load i32, i32* %12
%79 = load i32, i32* %11
%80 = sub nsw i32 %78, %79
%81 = add nsw i32 %80, 1
%82 = zext i32 %81 to i64
%83 = mul i64 %82, 8
%84 = trunc i64 %83 to i32
%85 = call i64 @malloc(i32 %84)
%86 = inttoptr i64 %85 to double*
%87 = load double***, double**** %13
%88 = load i32, i32* %14
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds double**, double*** %87, i64 %89
%91 = load double**, double*** %90
%92 = load i32, i32* %15
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds double*, double** %91, i64 %93
store double* %86, double** %94
%95 = load double***, double**** %13
%96 = load i32, i32* %14
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds double**, double*** %95, i64 %97
%99 = load double**, double*** %98
%100 = load i32, i32* %15
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds double*, double** %99, i64 %101
%103 = load double*, double** %102
%104 = icmp eq double* %103, null
br i1 %104, label %105, label %107
105: ; preds = %77
%106 = call i32 @errhandler(i32 460, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %107
107: ; preds = %105, %77
%108 = load i32, i32* %11
%109 = load double***, double**** %13
%110 = load i32, i32* %14
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds double**, double*** %109, i64 %111
%113 = load double**, double*** %112
%114 = load i32, i32* %15
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds double*, double** %113, i64 %115
%117 = load double*, double** %116
%118 = sext i32 %108 to i64
%119 = sub i64 0, %118
%120 = getelementptr inbounds double, double* %117, i64 %119
store double* %120, double** %116
br label %121
121: ; preds = %107
%122 = load i32, i32* %15
%123 = add nsw i32 %122, 1
store i32 %123, i32* %15
br label %73
124: ; preds = %73
br label %125
125: ; preds = %124
%126 = load i32, i32* %14
%127 = add nsw i32 %126, 1
store i32 %127, i32* %14
br label %36
128: ; preds = %36
%129 = load double***, double**** %13
ret double*** %129
}

LLVM IR (-O2):
@.str = [163 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/EvaBr/CFD-Lab/refs/heads/master/Backup/FinalProjectPresentation/helper.c\00"
@.str.1 = [28 x i8] c"Storage cannot be allocated\00"
define double*** @matrix2(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = sub nsw i32 %1, %0
%8 = shl i32 %7, 3
%9 = add i32 %8, 8
%10 = tail call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to double***
%12 = icmp eq i64 %10, 0
br i1 %12, label %13, label %15
13: ; preds = %6
%14 = tail call i32 @errhandler(i32 451, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %6
%16 = sext i32 %0 to i64
%17 = sub nsw i64 0, %16
%18 = getelementptr inbounds double**, double*** %11, i64 %17
%19 = icmp slt i32 %1, %0
br i1 %19, label %73, label %20
20: ; preds = %15
%21 = sub nsw i32 %3, %2
%22 = shl i32 %21, 3
%23 = add i32 %22, 8
%24 = sext i32 %2 to i64
%25 = sub nsw i64 0, %24
%26 = icmp slt i32 %3, %2
%27 = sub nsw i32 %5, %4
%28 = shl i32 %27, 3
%29 = add i32 %28, 8
%30 = sext i32 %4 to i64
%31 = sub nsw i64 0, %30
%32 = add i32 %3, 1
%33 = add i32 %1, 1
br label %34
34: ; preds = %20, %69
%35 = phi i64 [ %16, %20 ], [ %70, %69 ]
%36 = tail call i64 @malloc(i32 %23)
%37 = inttoptr i64 %36 to double**
%38 = getelementptr inbounds double**, double*** %18, i64 %35
store double** %37, double*** %38
%39 = icmp eq i64 %36, 0
br i1 %39, label %40, label %43
40: ; preds = %34
%41 = tail call i32 @errhandler(i32 456, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%42 = load double**, double*** %38
br label %43
43: ; preds = %40, %34
%44 = phi double** [ %42, %40 ], [ %37, %34 ]
%45 = getelementptr inbounds double*, double** %44, i64 %25
store double** %45, double*** %38
br i1 %26, label %69, label %46
46: ; preds = %43, %61
%47 = phi i64 [ %66, %61 ], [ %24, %43 ]
%48 = tail call i64 @malloc(i32 %29)
%49 = inttoptr i64 %48 to double*
%50 = load double**, double*** %38
%51 = getelementptr inbounds double*, double** %50, i64 %47
store double* %49, double** %51
%52 = load double**, double*** %38
%53 = getelementptr inbounds double*, double** %52, i64 %47
%54 = load double*, double** %53
%55 = icmp eq double* %54, null
br i1 %55, label %56, label %61
56: ; preds = %46
%57 = tail call i32 @errhandler(i32 460, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%58 = load double**, double*** %38
%59 = getelementptr inbounds double*, double** %58, i64 %47
%60 = load double*, double** %59
br label %61
61: ; preds = %56, %46
%62 = phi double* [ %60, %56 ], [ %54, %46 ]
%63 = phi double** [ %58, %56 ], [ %52, %46 ]
%64 = getelementptr inbounds double*, double** %63, i64 %47
%65 = getelementptr inbounds double, double* %62, i64 %31
store double* %65, double** %64
%66 = add nsw i64 %47, 1
%67 = trunc i64 %66 to i32
%68 = icmp eq i32 %32, %67
br i1 %68, label %69, label %46
69: ; preds = %61, %43
%70 = add nsw i64 %35, 1
%71 = trunc i64 %70 to i32
%72 = icmp eq i32 %33, %71
br i1 %72, label %73, label %34
73: ; preds = %69, %15
ret double*** %18
}