#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 */
double *newDoubleArea(int, int *);
double **newPDoubleDArea(int, int *);
int /*<<< orphan*/ printf(char *, int, ...);
double **new2DimDoubleArea(int size, int dmi, int *ret) {
  double **pTmp = newPDoubleDArea(size, ret);
  int index = 0;
  if ((ret != NULL) && (pTmp != NULL)) {
    for (index = 0; index < size; index++) {
      pTmp[index] = newDoubleArea(dmi, ret);
    }
  } else if ((pTmp == NULL) && (size != 0)) {
    *ret = 0;
  } else if (ret != NULL) {
    *ret = 0;
    printf("Error Cannot allocate space (size:%d), ln:%d, file:%s \n", size,
           356,
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/Chalearm/MachineLearning-/refs/heads/"
           "master/mProject/library_jui/dataStruct/src/basicVarArea.c");
  } else {
    printf("Error ret is null, ln:%d, file:%s \n", 360,
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/Chalearm/MachineLearning-/refs/heads/"
           "master/mProject/library_jui/dataStruct/src/basicVarArea.c");
  }
  return (double **)pTmp;
}


x86 assembly (clang, -O0):
<new2DimDoubleArea>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <newPDoubleDArea@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11b0 <new2DimDoubleArea+0x80>
cmpq   $0x0,-0x18(%rbp)
je     11b0 <new2DimDoubleArea+0x80>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11ab <new2DimDoubleArea+0x7b>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <newDoubleArea@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1176 <new2DimDoubleArea+0x46>
jmp    122f <new2DimDoubleArea+0xff>
cmpq   $0x0,-0x18(%rbp)
jne    11d4 <new2DimDoubleArea+0xa4>
cmpl   $0x0,-0x4(%rbp)
je     11d4 <new2DimDoubleArea+0xa4>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
jmp    122a <new2DimDoubleArea+0xfa>
cmpq   $0x0,-0x10(%rbp)
je     120b <new2DimDoubleArea+0xdb>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x4(%rbp),%esi
lea    0xe0d(%rip),%rdi
mov    $0x164,%edx
lea    0xe39(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1225 <new2DimDoubleArea+0xf5>
lea    0xedf(%rip),%rdi
mov    $0x168,%esi
lea    0xe1a(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122a <new2DimDoubleArea+0xfa>
jmp    122f <new2DimDoubleArea+0xff>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<new2DimDoubleArea>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r13
mov    %esi,%r12d
mov    %edi,%r15d
mov    %rdx,%rsi
call   1050 <newPDoubleDArea@plt>
mov    %rax,%r14
test   %r13,%r13
je     118a <new2DimDoubleArea+0x5a>
test   %r14,%r14
je     118a <new2DimDoubleArea+0x5a>
test   %r15d,%r15d
jle    11e4 <new2DimDoubleArea+0xb4>
mov    %r15d,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r12d,%edi
mov    %r13,%rsi
call   1040 <newDoubleArea@plt>
mov    %rax,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <new2DimDoubleArea+0x40>
jmp    11e4 <new2DimDoubleArea+0xb4>
test   %r15d,%r15d
je     119e <new2DimDoubleArea+0x6e>
test   %r14,%r14
jne    119e <new2DimDoubleArea+0x6e>
movl   $0x0,0x0(%r13)
jmp    11e4 <new2DimDoubleArea+0xb4>
test   %r13,%r13
je     11ca <new2DimDoubleArea+0x9a>
movl   $0x0,0x0(%r13)
lea    0xe4e(%rip),%rdi
lea    0xe7f(%rip),%rcx
mov    %r15d,%esi
mov    $0x164,%edx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11e4 <new2DimDoubleArea+0xb4>
lea    0xf20(%rip),%rdi
lea    0xe60(%rip),%rdx
mov    $0x168,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [56 x i8] c"Error Cannot allocate space (size:%d), ln:%d, file:%s \0A\00"
@.str.1 = [185 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Chalearm/MachineLearning-/refs/heads/master/mProject/library_jui/dataStruct/src/basicVarArea.c\00"
@.str.2 = [36 x i8] c"Error ret is null, ln:%d, file:%s \0A\00"
define double** @new2DimDoubleArea(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca double**
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%9 = load i32, i32* %4
%10 = load i32*, i32** %6
%11 = call double** @newPDoubleDArea(i32 %9, i32* %10)
store double** %11, double*** %7
store i32 0, i32* %8
%12 = load i32*, i32** %6
%13 = icmp ne i32* %12, null
br i1 %13, label %14, label %34
14: ; preds = %3
%15 = load double**, double*** %7
%16 = icmp ne double** %15, null
br i1 %16, label %17, label %34
17: ; preds = %14
store i32 0, i32* %8
br label %18
18: ; preds = %30, %17
%19 = load i32, i32* %8
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %33
22: ; preds = %18
%23 = load i32, i32* %5
%24 = load i32*, i32** %6
%25 = call double* @newDoubleArea(i32 %23, i32* %24)
%26 = load double**, double*** %7
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double*, double** %26, i64 %28
store double* %25, double** %29
br label %30
30: ; preds = %22
%31 = load i32, i32* %8
%32 = add nsw i32 %31, 1
store i32 %32, i32* %8
br label %18
33: ; preds = %18
br label %53
34: ; preds = %14, %3
%35 = load double**, double*** %7
%36 = icmp eq double** %35, null
br i1 %36, label %37, label %42
37: ; preds = %34
%38 = load i32, i32* %4
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = load i32*, i32** %6
store i32 0, i32* %41
br label %52
42: ; preds = %37, %34
%43 = load i32*, i32** %6
%44 = icmp ne i32* %43, null
br i1 %44, label %45, label %49
45: ; preds = %42
%46 = load i32*, i32** %6
store i32 0, i32* %46
%47 = load i32, i32* %4
%48 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %47, i32 356, i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0))
br label %51
49: ; preds = %42
%50 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 360, i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0))
br label %51
51: ; preds = %49, %45
br label %52
52: ; preds = %51, %40
br label %53
53: ; preds = %52, %33
%54 = load double**, double*** %7
ret double** %54
}

LLVM IR (-O2):
@.str = [56 x i8] c"Error Cannot allocate space (size:%d), ln:%d, file:%s \0A\00"
@.str.1 = [185 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Chalearm/MachineLearning-/refs/heads/master/mProject/library_jui/dataStruct/src/basicVarArea.c\00"
@.str.2 = [36 x i8] c"Error ret is null, ln:%d, file:%s \0A\00"
define double** @new2DimDoubleArea(i32 %0, i32 %1, i32* %2) {
%4 = tail call double** @newPDoubleDArea(i32 %0, i32* %2)
%5 = icmp ne i32* %2, null
%6 = icmp ne double** %4, null
%7 = select i1 %5, i1 %6, i1 false
br i1 %7, label %8, label %18
8: ; preds = %3
%9 = icmp sgt i32 %0, 0
br i1 %9, label %10, label %28
10: ; preds = %8
%11 = zext i32 %0 to i64
br label %12
12: ; preds = %10, %12
%13 = phi i64 [ 0, %10 ], [ %16, %12 ]
%14 = tail call double* @newDoubleArea(i32 %1, i32* %2)
%15 = getelementptr inbounds double*, double** %4, i64 %13
store double* %14, double** %15
%16 = add nuw nsw i64 %13, 1
%17 = icmp eq i64 %16, %11
br i1 %17, label %28, label %12
18: ; preds = %3
%19 = icmp eq double** %4, null
%20 = icmp ne i32 %0, 0
%21 = and i1 %20, %19
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 0, i32* %2
br label %28
23: ; preds = %18
br i1 %5, label %24, label %26
24: ; preds = %23
store i32 0, i32* %2
%25 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %0, i32 356, i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0))
br label %28
26: ; preds = %23
%27 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 360, i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str.1, i64 0, i64 0))
br label %28
28: ; preds = %12, %8, %22, %26, %24
ret double** %4
}