#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);
double **makeBuff(int rows, int columns) {
  int i;
  double **ret;
  ret = (double **)calloc(rows, sizeof(double *));
  if (ret == NULL) {
    return NULL;
  } else {
    for (i = 0; i < rows; i++) {
      ret[i] = (double *)calloc(columns, sizeof(double));
      if (ret[i] == NULL) {
        return NULL;
      }
    }
  }
  return ret;
}


x86 assembly (clang, -O0):
<makeBuff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1147 <makeBuff+0x37>
movq   $0x0,-0x8(%rbp)
jmp    11b6 <makeBuff+0xa6>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a9 <makeBuff+0x99>
mov    -0x10(%rbp),%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    1196 <makeBuff+0x86>
movq   $0x0,-0x8(%rbp)
jmp    11b6 <makeBuff+0xa6>
jmp    119b <makeBuff+0x8b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114e <makeBuff+0x3e>
jmp    11ae <makeBuff+0x9e>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeBuff>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %edi,%r14d
mov    $0x8,%esi
call   1030 <calloc@plt>
test   %rax,%rax
je     1161 <makeBuff+0x51>
mov    %rax,%rbx
test   %r14d,%r14d
jle    1163 <makeBuff+0x53>
mov    %r14d,%r14d
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %r15d,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,(%rbx,%rbp,8)
test   %rax,%rax
je     1161 <makeBuff+0x51>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1140 <makeBuff+0x30>
jmp    1163 <makeBuff+0x53>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double** @makeBuff(i32 %0, i32 %1) {
%3 = alloca double**
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double**
store i32 %0, i32* %4
store i32 %1, i32* %5
%8 = load i32, i32* %4
%9 = call i64 @calloc(i32 %8, i32 8)
%10 = inttoptr i64 %9 to double**
store double** %10, double*** %7
%11 = load double**, double*** %7
%12 = icmp eq double** %11, null
br i1 %12, label %13, label %14
13: ; preds = %2
store double** null, double*** %3
br label %41
14: ; preds = %2
store i32 0, i32* %6
br label %15
15: ; preds = %35, %14
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %38
19: ; preds = %15
%20 = load i32, i32* %5
%21 = call i64 @calloc(i32 %20, i32 8)
%22 = inttoptr i64 %21 to double*
%23 = load double**, double*** %7
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double*, double** %23, i64 %25
store double* %22, double** %26
%27 = load double**, double*** %7
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double*, double** %27, i64 %29
%31 = load double*, double** %30
%32 = icmp eq double* %31, null
br i1 %32, label %33, label %34
33: ; preds = %19
store double** null, double*** %3
br label %41
34: ; preds = %19
br label %35
35: ; preds = %34
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %15
38: ; preds = %15
br label %39
39: ; preds = %38
%40 = load double**, double*** %7
store double** %40, double*** %3
br label %41
41: ; preds = %39, %33, %13
%42 = load double**, double*** %3
ret double** %42
}

LLVM IR (-O2):
define double** @makeBuff(i32 %0, i32 %1) {
%3 = tail call i64 @calloc(i32 %0, i32 8)
%4 = inttoptr i64 %3 to double**
%5 = icmp eq i64 %3, 0
br i1 %5, label %19, label %6
6: ; preds = %2
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %19
8: ; preds = %6
%9 = zext i32 %0 to i64
br label %12
10: ; preds = %12
%11 = icmp eq i64 %18, %9
br i1 %11, label %19, label %12
12: ; preds = %8, %10
%13 = phi i64 [ 0, %8 ], [ %18, %10 ]
%14 = tail call i64 @calloc(i32 %1, i32 8)
%15 = inttoptr i64 %14 to double*
%16 = getelementptr inbounds double*, double** %4, i64 %13
store double* %15, double** %16
%17 = icmp eq i64 %14, 0
%18 = add nuw nsw i64 %13, 1
br i1 %17, label %19, label %10
19: ; preds = %12, %10, %6, %2
%20 = phi double** [ null, %2 ], [ %4, %6 ], [ null, %12 ], [ %4, %10 ]
ret double** %20
}