#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 */
int /*<<< orphan*/ matriz_ponteiro(int **);
int main() {
  int mtr[3][4];
  for (int lin = 0, cont = 0; lin < 3; lin++)
    for (int col = 0; col < 4; col++)
      mtr[lin][col] = cont++;
  matriz_ponteiro(mtr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
cmpl   $0x3,-0x44(%rbp)
jge    118a <main+0x7a>
movl   $0x0,-0x4c(%rbp)
cmpl   $0x4,-0x4c(%rbp)
jge    1177 <main+0x67>
mov    -0x48(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
movslq -0x44(%rbp),%rcx
lea    -0x40(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x4c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    113e <main+0x2e>
jmp    117c <main+0x6c>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    112d <main+0x1d>
lea    -0x40(%rbp),%rdi
call   1030 <matriz_ponteiro@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xeea(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeee(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    %rsp,%rdi
call   1030 <matriz_ponteiro@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [3 x [4 x i32]]
%2 = bitcast [3 x [4 x i32]]* %1 to i8*
%3 = bitcast [3 x [4 x i32]]* %1 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %3
%4 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 1, i64 0
%5 = bitcast i32* %4 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %5
%6 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i64 0, i64 2, i64 0
%7 = bitcast i32* %6 to <4 x i32>*
store <4 x i32> <i32 8, i32 9, i32 10, i32 11>, <4 x i32>* %7
%8 = bitcast [3 x [4 x i32]]* %1 to i32**
%9 = call i32 @matriz_ponteiro(i32** %8)
ret i32 0
}