#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
double **make_dm(int rows, int cols) {
  double **temp;
  int i;
  if (rows == 0)
    rows = 1;
  if (cols == 0)
    cols = 1;
  temp = (double **)calloc(rows, sizeof(double *));
  if (!temp) {
    fprintf(stderr, "Run-time error in make_dm");
    exit(1);
  }
  temp--;
  for (i = 1; i <= rows; i++) {
    temp[i] = (double *)calloc(cols, sizeof(double));
    if (!temp[i]) {
      fprintf(stderr, "Run-time error in make_dm");
      exit(1);
    }
    temp[i]--;
  }
  return temp;
}


x86 assembly (clang, -O0):
<make_dm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    114f <make_dm+0x1f>
movl   $0x1,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1160 <make_dm+0x30>
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    119b <make_dm+0x6b>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
lea    0xe74(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     122a <make_dm+0xfa>
mov    -0x8(%rbp),%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    1208 <make_dm+0xd8>
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
lea    0xe07(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
add    $0xfffffffffffffff8,%rdx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ae <make_dm+0x7e>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_dm>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%r14d
test   %edi,%edi
mov    $0x1,%eax
cmove  %eax,%r14d
mov    %esi,%r15d
test   %esi,%esi
cmove  %eax,%r15d
mov    %r14d,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
test   %rax,%rax
je     11a9 <make_dm+0x79>
mov    %rax,%rbx
test   %r14d,%r14d
jle    1197 <make_dm+0x67>
mov    %r14d,%r14d
xor    %ebp,%ebp
nopl   (%rax)
mov    %r15d,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,(%rbx,%rbp,8)
test   %rax,%rax
je     11a9 <make_dm+0x79>
add    $0xfffffffffffffff8,%rax
mov    %rax,(%rbx,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1170 <make_dm+0x40>
add    $0xfffffffffffffff8,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
lea    0xe47(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"Run-time error in make_dm\00"
define double** @make_dm(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca double**
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 1, i32* %3
br label %10
10: ; preds = %9, %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 1, i32* %4
br label %14
14: ; preds = %13, %10
%15 = load i32, i32* %3
%16 = call i64 @calloc(i32 %15, i32 8)
%17 = inttoptr i64 %16 to double**
store double** %17, double*** %5
%18 = load double**, double*** %5
%19 = icmp ne double** %18, null
br i1 %19, label %24, label %20
20: ; preds = %14
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %14
%25 = load double**, double*** %5
%26 = getelementptr inbounds double*, double** %25, i32 -1
store double** %26, double*** %5
store i32 1, i32* %6
br label %27
27: ; preds = %56, %24
%28 = load i32, i32* %6
%29 = load i32, i32* %3
%30 = icmp sle i32 %28, %29
br i1 %30, label %31, label %59
31: ; preds = %27
%32 = load i32, i32* %4
%33 = call i64 @calloc(i32 %32, i32 8)
%34 = inttoptr i64 %33 to double*
%35 = load double**, double*** %5
%36 = load i32, i32* %6
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double*, double** %35, i64 %37
store double* %34, double** %38
%39 = load double**, double*** %5
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double*, double** %39, i64 %41
%43 = load double*, double** %42
%44 = icmp ne double* %43, null
br i1 %44, label %49, label %45
45: ; preds = %31
%46 = load i32, i32* @stderr
%47 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %31
%50 = load double**, double*** %5
%51 = load i32, i32* %6
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double*, double** %50, i64 %52
%54 = load double*, double** %53
%55 = getelementptr inbounds double, double* %54, i32 -1
store double* %55, double** %53
br label %56
56: ; preds = %49
%57 = load i32, i32* %6
%58 = add nsw i32 %57, 1
store i32 %58, i32* %6
br label %27
59: ; preds = %27
%60 = load double**, double*** %5
ret double** %60
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"Run-time error in make_dm\00"
define double** @make_dm(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = select i1 %3, i32 1, i32 %0
%5 = icmp eq i32 %1, 0
%6 = select i1 %5, i32 1, i32 %1
%7 = tail call i64 @calloc(i32 %4, i32 8)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = inttoptr i64 %7 to double**
%15 = getelementptr inbounds double*, double** %14, i64 -1
%16 = icmp slt i32 %4, 1
br i1 %16, label %34, label %17
17: ; preds = %13
%18 = add nuw i32 %4, 1
%19 = zext i32 %18 to i64
br label %20
20: ; preds = %17, %30
%21 = phi i64 [ 1, %17 ], [ %32, %30 ]
%22 = tail call i64 @calloc(i32 %6, i32 8)
%23 = inttoptr i64 %22 to double*
%24 = getelementptr inbounds double*, double** %15, i64 %21
store double* %23, double** %24
%25 = icmp eq i64 %22, 0
br i1 %25, label %26, label %30
26: ; preds = %20
%27 = load i32, i32* @stderr
%28 = tail call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%29 = tail call i32 @exit(i32 1)
unreachable
30: ; preds = %20
%31 = getelementptr inbounds double, double* %23, i64 -1
store double* %31, double** %24
%32 = add nuw nsw i64 %21, 1
%33 = icmp eq i64 %32, %19
br i1 %33, label %34, label %20
34: ; preds = %30, %13
ret double** %15
}