#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, const char *argv[]) {
  int matriz[2][2];
  int i, j;
  printf("\nDigite valor para os elementos da matriz\n\n");
  for (i = 0; i < 2; i++)
    for (j = 0; j < 2; j++) {
      scanf("%d", &matriz[i][j]);
    }
  for (i = 0; i < 2; i++)
    for (j = 0; j < 2; j++) {
      printf("\nM[%d][%d] = %d\n", i, j, matriz[i][j]);
    }
  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    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jge    11ad <main+0x8d>
movl   $0x0,-0x28(%rbp)
cmpl   $0x2,-0x28(%rbp)
jge    119a <main+0x7a>
movslq -0x24(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x3,%rax
add    %rax,%rsi
movslq -0x28(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xea5(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    115c <main+0x3c>
jmp    119f <main+0x7f>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114b <main+0x2b>
movl   $0x0,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jge    121a <main+0xfa>
movl   $0x0,-0x28(%rbp)
cmpl   $0x2,-0x28(%rbp)
jge    1207 <main+0xe7>
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
movslq -0x24(%rbp),%rcx
lea    -0x20(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11c5 <main+0xa5>
jmp    120c <main+0xec>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11b4 <main+0x94>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    (%rsp),%ecx
lea    0xe7f(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%ecx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [17 x i8] c"\0AM[%d][%d] = %d\0A\00"
@str = [43 x i8] c"\0ADigite valor para os elementos da matriz\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [2 x [2 x i32]]
%4 = bitcast [2 x [2 x i32]]* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%6 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 0, i64 1
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 1, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 1, i64 1
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = load i32, i32* %6
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 0, i32 %14)
%16 = load i32, i32* %8
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 1, i32 %16)
%18 = load i32, i32* %10
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 0, i32 %18)
%20 = load i32, i32* %12
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 1, i32 %20)
ret i32 0
}