#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__ malloc(int);
void aloc2Dmatrix(double ***m, int l, int c) {
  *m = (double **)malloc(l * sizeof(double *));
  for (int i = 0; i < l; i++) {
    (*m)[i] = (double *)malloc(c * sizeof(double));
    for (int j = 0; j < c; j++) {
      (*m)[i][j] = 0;
    }
  }
}


x86 assembly (clang, -O0):
<aloc2Dmatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11be <aloc2Dmatrix+0xae>
movslq -0x10(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11ab <aloc2Dmatrix+0x9b>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1176 <aloc2Dmatrix+0x66>
jmp    11b0 <aloc2Dmatrix+0xa0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1142 <aloc2Dmatrix+0x32>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aloc2Dmatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r12d
mov    %rdi,%rbx
lea    0x0(,%r12,8),%edi
call   1040 <malloc@plt>
mov    %rax,(%rbx)
test   %r12d,%r12d
jle    1190 <aloc2Dmatrix+0x70>
lea    0x0(,%r14,8),%r13d
mov    %r14d,%r15d
shl    $0x3,%r15
mov    %r12d,%r12d
xor    %ebp,%ebp
jmp    1169 <aloc2Dmatrix+0x49>
nop
add    $0x1,%rbp
cmp    %rbp,%r12
je     1190 <aloc2Dmatrix+0x70>
mov    %r13d,%edi
call   1040 <malloc@plt>
mov    (%rbx),%rcx
mov    %rax,(%rcx,%rbp,8)
test   %r14d,%r14d
jle    1160 <aloc2Dmatrix+0x40>
mov    (%rbx),%rax
mov    (%rax,%rbp,8),%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   1030 <memset@plt>
jmp    1160 <aloc2Dmatrix+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @aloc2Dmatrix(double*** %0, i32 %1, i32 %2) {
%4 = alloca double***
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store double*** %0, double**** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = mul i64 %10, 8
%12 = trunc i64 %11 to i32
%13 = call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to double**
%15 = load double***, double**** %4
store double** %14, double*** %15
store i32 0, i32* %7
br label %16
16: ; preds = %50, %3
%17 = load i32, i32* %7
%18 = load i32, i32* %5
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %53
20: ; preds = %16
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = mul i64 %22, 8
%24 = trunc i64 %23 to i32
%25 = call i64 @malloc(i32 %24)
%26 = inttoptr i64 %25 to double*
%27 = load double***, double**** %4
%28 = load double**, double*** %27
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double*, double** %28, i64 %30
store double* %26, double** %31
store i32 0, i32* %8
br label %32
32: ; preds = %46, %20
%33 = load i32, i32* %8
%34 = load i32, i32* %6
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %49
36: ; preds = %32
%37 = load double***, double**** %4
%38 = load double**, double*** %37
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double*, double** %38, i64 %40
%42 = load double*, double** %41
%43 = load i32, i32* %8
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %42, i64 %44
store double 0.000000e+00, double* %45
br label %46
46: ; preds = %36
%47 = load i32, i32* %8
%48 = add nsw i32 %47, 1
store i32 %48, i32* %8
br label %32
49: ; preds = %32
br label %50
50: ; preds = %49
%51 = load i32, i32* %7
%52 = add nsw i32 %51, 1
store i32 %52, i32* %7
br label %16
53: ; preds = %16
ret void
}

LLVM IR (-O2):
define void @aloc2Dmatrix(double*** nocapture %0, i32 %1, i32 %2) {
%4 = shl i32 %1, 3
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to double**
store double** %6, double*** %0
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %14
8: ; preds = %3
%9 = shl i32 %2, 3
%10 = icmp sgt i32 %2, 0
%11 = zext i32 %2 to i64
%12 = shl nuw nsw i64 %11, 3
%13 = zext i32 %1 to i64
br label %15
14: ; preds = %26, %3
ret void
15: ; preds = %8, %26
%16 = phi i64 [ 0, %8 ], [ %27, %26 ]
%17 = tail call i64 @malloc(i32 %9)
%18 = inttoptr i64 %17 to double*
%19 = load double**, double*** %0
%20 = getelementptr inbounds double*, double** %19, i64 %16
store double* %18, double** %20
br i1 %10, label %21, label %26
21: ; preds = %15
%22 = load double**, double*** %0
%23 = getelementptr inbounds double*, double** %22, i64 %16
%24 = bitcast double** %23 to i8**
%25 = load i8*, i8** %24
br label %26
26: ; preds = %21, %15
%27 = add nuw nsw i64 %16, 1
%28 = icmp eq i64 %27, %13
br i1 %28, label %14, label %15
}