#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);
void alocaMatriz(int ***m, int linha, int coluna) {
  int i, **matriz;
  matriz = (int **)calloc(linha, sizeof(int *));
  for (i = 0; i < linha; i++) {
    matriz[i] = (int *)calloc(coluna, sizeof(int));
  }
  *m = matriz;
}


x86 assembly (clang, -O0):
<alocaMatriz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1170 <alocaMatriz+0x60>
mov    -0x10(%rbp),%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113a <alocaMatriz+0x2a>
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alocaMatriz>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r12d
mov    %esi,%r15d
mov    %rdi,%r14
mov    %esi,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,%r13
test   %r15d,%r15d
jle    115b <alocaMatriz+0x4b>
mov    %r15d,%ebp
xor    %ebx,%ebx
nopl   (%rax)
mov    %r12d,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,0x0(%r13,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1140 <alocaMatriz+0x30>
mov    %r13,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @alocaMatriz(i32*** %0, i32 %1, i32 %2) {
%4 = alloca i32***
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32**
store i32*** %0, i32**** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %5
%10 = call i64 @calloc(i32 %9, i32 8)
%11 = inttoptr i64 %10 to i32**
store i32** %11, i32*** %8
store i32 0, i32* %7
br label %12
12: ; preds = %24, %3
%13 = load i32, i32* %7
%14 = load i32, i32* %5
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %27
16: ; preds = %12
%17 = load i32, i32* %6
%18 = call i64 @calloc(i32 %17, i32 4)
%19 = inttoptr i64 %18 to i32*
%20 = load i32**, i32*** %8
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32*, i32** %20, i64 %22
store i32* %19, i32** %23
br label %24
24: ; preds = %16
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %12
27: ; preds = %12
%28 = load i32**, i32*** %8
%29 = load i32***, i32**** %4
store i32** %28, i32*** %29
ret void
}

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