#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);
int /*<<< orphan*/ matriz(int **, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, const char *argv[]) {
  int **a, i, j, M, N;
  printf("Quatidade de linha\n");
  scanf("%d", &M);
  printf("Quantidade de Coluna\n");
  scanf("%d", &N);
  a = (int **)malloc(M * sizeof(int **));
  for (i = 0; i < M; i++) {
    a[i] = (int *)malloc(N * sizeof(int *));
    for (j = 0; j < N; j++) {
      printf("Informe a[%d][%d]: ", i, j);
      scanf("%d", &a[i][j]);
    }
  }
  matriz(a, M, N);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea9(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8b(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1060 <scanf@plt>
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1241 <main+0x101>
movslq -0x28(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    122e <main+0xee>
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
movslq -0x20(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xdf9(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11dd <main+0x9d>
jmp    1233 <main+0xf3>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ac <main+0x6c>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1040 <matriz@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
lea    0xe92(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
mov    0x4(%rsp),%edi
shl    $0x3,%edi
call   1060 <malloc@plt>
mov    %rax,%r12
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
test   %esi,%esi
jle    1221 <main+0xd1>
lea    0xe50(%rip),%r14
lea    0xe46(%rip),%r15
xor    %r13d,%r13d
jmp    11ce <main+0x7e>
nop
add    $0x1,%r13
movslq 0x4(%rsp),%rsi
cmp    %rsi,%r13
jge    1221 <main+0xd1>
shl    $0x3,%edx
mov    %edx,%edi
call   1060 <malloc@plt>
mov    %rax,(%r12,%r13,8)
mov    (%rsp),%edx
test   %edx,%edx
jle    11c0 <main+0x70>
xor    %ebp,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r13d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r12,%r13,8),%rsi
add    %rbp,%rsi
mov    %r15,%rdi
call   1070 <scanf@plt>
add    $0x1,%rbx
movslq (%rsp),%rdx
add    $0x4,%rbp
cmp    %rdx,%rbx
jl     11f0 <main+0xa0>
jmp    11c0 <main+0x70>
mov    %r12,%rdi
call   1050 <matriz@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Quatidade de linha\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"Quantidade de Coluna\0A\00"
@.str.3 = [20 x i8] c"Informe a[%d][%d]: \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32**
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%15 = load i32, i32* %9
%16 = sext i32 %15 to i64
%17 = mul i64 %16, 8
%18 = trunc i64 %17 to i32
%19 = call i64 @malloc(i32 %18)
%20 = inttoptr i64 %19 to i32**
store i32** %20, i32*** %6
store i32 0, i32* %7
br label %21
21: ; preds = %57, %2
%22 = load i32, i32* %7
%23 = load i32, i32* %9
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %60
25: ; preds = %21
%26 = load i32, i32* %10
%27 = sext i32 %26 to i64
%28 = mul i64 %27, 8
%29 = trunc i64 %28 to i32
%30 = call i64 @malloc(i32 %29)
%31 = inttoptr i64 %30 to i32*
%32 = load i32**, i32*** %6
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32*, i32** %32, i64 %34
store i32* %31, i32** %35
store i32 0, i32* %8
br label %36
36: ; preds = %53, %25
%37 = load i32, i32* %8
%38 = load i32, i32* %10
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %56
40: ; preds = %36
%41 = load i32, i32* %7
%42 = load i32, i32* %8
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %41, i32 %42)
%44 = load i32**, i32*** %6
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i32*, i32** %44, i64 %46
%48 = load i32*, i32** %47
%49 = load i32, i32* %8
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i32, i32* %48, i64 %50
%52 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %51)
br label %53
53: ; preds = %40
%54 = load i32, i32* %8
%55 = add nsw i32 %54, 1
store i32 %55, i32* %8
br label %36
56: ; preds = %36
br label %57
57: ; preds = %56
%58 = load i32, i32* %7
%59 = add nsw i32 %58, 1
store i32 %59, i32* %7
br label %21
60: ; preds = %21
%61 = load i32**, i32*** %6
%62 = load i32, i32* %9
%63 = load i32, i32* %10
%64 = call i32 @matriz(i32** %61, i32 %62, i32 %63)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [20 x i8] c"Informe a[%d][%d]: \00"
@str = [19 x i8] c"Quatidade de linha\00"
@str.4 = [21 x i8] c"Quantidade de Coluna\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.4, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%11 = load i32, i32* %3
%12 = shl i32 %11, 3
%13 = call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i32**
%15 = load i32, i32* %3
%16 = icmp sgt i32 %15, 0
%17 = load i32, i32* %4
br i1 %16, label %18, label %46
18: ; preds = %2, %40
%19 = phi i32 [ %41, %40 ], [ %17, %2 ]
%20 = phi i64 [ %42, %40 ], [ 0, %2 ]
%21 = shl i32 %19, 3
%22 = call i64 @malloc(i32 %21)
%23 = inttoptr i64 %22 to i32*
%24 = getelementptr inbounds i32*, i32** %14, i64 %20
store i32* %23, i32** %24
%25 = load i32, i32* %4
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %40
27: ; preds = %18
%28 = trunc i64 %20 to i32
br label %29
29: ; preds = %27, %29
%30 = phi i64 [ 0, %27 ], [ %36, %29 ]
%31 = trunc i64 %30 to i32
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %28, i32 %31)
%33 = load i32*, i32** %24
%34 = getelementptr inbounds i32, i32* %33, i64 %30
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %34)
%36 = add nuw nsw i64 %30, 1
%37 = load i32, i32* %4
%38 = sext i32 %37 to i64
%39 = icmp slt i64 %36, %38
br i1 %39, label %29, label %40
40: ; preds = %29, %18
%41 = phi i32 [ %25, %18 ], [ %37, %29 ]
%42 = add nuw nsw i64 %20, 1
%43 = load i32, i32* %3
%44 = sext i32 %43 to i64
%45 = icmp slt i64 %42, %44
br i1 %45, label %18, label %46
46: ; preds = %40, %2
%47 = phi i32 [ %17, %2 ], [ %41, %40 ]
%48 = phi i32 [ %15, %2 ], [ %43, %40 ]
%49 = call i32 @matriz(i32** %14, i32 %48, i32 %47)
ret i32 0
}