#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 *, ...);
main() {
  int mat1[2][2] = {{1, 2}, {3, 4}};
  int mat2[2][2] = {{10, 20}, {30, 40}};
  int matsoma[2][2] = {0};
  int i, j;
  printf("Matriz 1\n\n");
  for (i = 0; i < 2; i++) {
    for (j = 0; j < 2; j++) {
      printf("%4d", mat1[i][j]);
    }
    printf("\n");
  }
  printf("\nMatriz 2\n\n");
  for (i = 0; i < 2; i++) {
    for (j = 0; j < 2; j++) {
      printf("%4d", mat2[i][j]);
    }
    printf("\n");
  }
  for (i = 0; i < 2; i++) {
    for (j = 0; j < 2; j++) {
      matsoma[i][j] = mat1[i][j] + mat2[i][j];
    }
  }
  printf("\nMatriz Soma\n\n");
  for (i = 0; i < 2; i++) {
    for (j = 0; j < 2; j++) {
      printf("%4d", matsoma[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0x2,-0x44(%rbp)
jge    11e9 <main+0xc9>
movl   $0x0,-0x48(%rbp)
cmpl   $0x2,-0x48(%rbp)
jge    11cd <main+0xad>
movslq -0x44(%rbp),%rcx
lea    -0x20(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1191 <main+0x71>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1180 <main+0x60>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0x2,-0x44(%rbp)
jge    1267 <main+0x147>
movl   $0x0,-0x48(%rbp)
cmpl   $0x2,-0x48(%rbp)
jge    124b <main+0x12b>
movslq -0x44(%rbp),%rcx
lea    -0x30(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    120f <main+0xef>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11fe <main+0xde>
movl   $0x0,-0x44(%rbp)
cmpl   $0x2,-0x44(%rbp)
jge    12ec <main+0x1cc>
movl   $0x0,-0x48(%rbp)
cmpl   $0x2,-0x48(%rbp)
jge    12d9 <main+0x1b9>
movslq -0x44(%rbp),%rcx
lea    -0x20(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
movslq -0x44(%rbp),%rcx
lea    -0x30(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x48(%rbp),%rcx
add    (%rax,%rcx,4),%edx
movslq -0x44(%rbp),%rcx
lea    -0x40(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x48(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    127f <main+0x15f>
jmp    12de <main+0x1be>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    126e <main+0x14e>
lea    0xd48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0x2,-0x44(%rbp)
jge    136a <main+0x24a>
movl   $0x0,-0x48(%rbp)
cmpl   $0x2,-0x48(%rbp)
jge    134e <main+0x22e>
movslq -0x44(%rbp),%rcx
lea    -0x40(%rbp),%rax
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xcf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1312 <main+0x1f2>
lea    0xcd4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1301 <main+0x1e1>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xecc(%rip),%rdi
call   1040 <puts@plt>
lea    0xebc(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe73(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x28,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe22(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x16,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x21,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x2c,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.mat1 = [2 x [2 x i32]] [[2 x i32] [i32 1, i32 2], [2 x i32] [i32 3, i32 4]]
@__const.main.mat2 = [2 x [2 x i32]] [[2 x i32] [i32 10, i32 20], [2 x i32] [i32 30, i32 40]]
@.str = [11 x i8] c"Matriz 1\0A\0A\00"
@.str.1 = [4 x i8] c"%4d\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [12 x i8] c"\0AMatriz 2\0A\0A\00"
@.str.4 = [15 x i8] c"\0AMatriz Soma\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x [2 x i32]]
%3 = alloca [2 x [2 x i32]]
%4 = alloca [2 x [2 x i32]]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [2 x [2 x i32]]* %2 to i8*
%8 = bitcast [2 x [2 x i32]]* %3 to i8*
%9 = bitcast [2 x [2 x i32]]* %4 to i8*
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %11
11: ; preds = %32, %0
%12 = load i32, i32* %5
%13 = icmp slt i32 %12, 2
br i1 %13, label %14, label %35
14: ; preds = %11
store i32 0, i32* %6
br label %15
15: ; preds = %27, %14
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 2
br i1 %17, label %18, label %30
18: ; preds = %15
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 %20
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [2 x i32], [2 x i32]* %21, i64 0, i64 %23
%25 = load i32, i32* %24
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %18
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %15
30: ; preds = %15
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %32
32: ; preds = %30
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %11
35: ; preds = %11
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %5
br label %37
37: ; preds = %58, %35
%38 = load i32, i32* %5
%39 = icmp slt i32 %38, 2
br i1 %39, label %40, label %61
40: ; preds = %37
store i32 0, i32* %6
br label %41
41: ; preds = %53, %40
%42 = load i32, i32* %6
%43 = icmp slt i32 %42, 2
br i1 %43, label %44, label %56
44: ; preds = %41
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 %46
%48 = load i32, i32* %6
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [2 x i32], [2 x i32]* %47, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %44
%54 = load i32, i32* %6
%55 = add nsw i32 %54, 1
store i32 %55, i32* %6
br label %41
56: ; preds = %41
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %58
58: ; preds = %56
%59 = load i32, i32* %5
%60 = add nsw i32 %59, 1
store i32 %60, i32* %5
br label %37
61: ; preds = %37
store i32 0, i32* %5
br label %62
62: ; preds = %95, %61
%63 = load i32, i32* %5
%64 = icmp slt i32 %63, 2
br i1 %64, label %65, label %98
65: ; preds = %62
store i32 0, i32* %6
br label %66
66: ; preds = %91, %65
%67 = load i32, i32* %6
%68 = icmp slt i32 %67, 2
br i1 %68, label %69, label %94
69: ; preds = %66
%70 = load i32, i32* %5
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 %71
%73 = load i32, i32* %6
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [2 x i32], [2 x i32]* %72, i64 0, i64 %74
%76 = load i32, i32* %75
%77 = load i32, i32* %5
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 %78
%80 = load i32, i32* %6
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [2 x i32], [2 x i32]* %79, i64 0, i64 %81
%83 = load i32, i32* %82
%84 = add nsw i32 %76, %83
%85 = load i32, i32* %5
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %4, i64 0, i64 %86
%88 = load i32, i32* %6
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [2 x i32], [2 x i32]* %87, i64 0, i64 %89
store i32 %84, i32* %90
br label %91
91: ; preds = %69
%92 = load i32, i32* %6
%93 = add nsw i32 %92, 1
store i32 %93, i32* %6
br label %66
94: ; preds = %66
br label %95
95: ; preds = %94
%96 = load i32, i32* %5
%97 = add nsw i32 %96, 1
store i32 %97, i32* %5
br label %62
98: ; preds = %62
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %5
br label %100
100: ; preds = %121, %98
%101 = load i32, i32* %5
%102 = icmp slt i32 %101, 2
br i1 %102, label %103, label %124
103: ; preds = %100
store i32 0, i32* %6
br label %104
104: ; preds = %116, %103
%105 = load i32, i32* %6
%106 = icmp slt i32 %105, 2
br i1 %106, label %107, label %119
107: ; preds = %104
%108 = load i32, i32* %5
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %4, i64 0, i64 %109
%111 = load i32, i32* %6
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [2 x i32], [2 x i32]* %110, i64 0, i64 %112
%114 = load i32, i32* %113
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %114)
br label %116
116: ; preds = %107
%117 = load i32, i32* %6
%118 = add nsw i32 %117, 1
store i32 %118, i32* %6
br label %104
119: ; preds = %104
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %121
121: ; preds = %119
%122 = load i32, i32* %5
%123 = add nsw i32 %122, 1
store i32 %123, i32* %5
br label %100
124: ; preds = %100
%125 = load i32, i32* %1
ret i32 %125
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%4d\00"
@str = [10 x i8] c"Matriz 1\0A\00"
@str.5 = [11 x i8] c"\0AMatriz 2\0A\00"
@str.6 = [14 x i8] c"\0AMatriz Soma\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 2)
%4 = tail call i32 @putchar(i32 10)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 4)
%7 = tail call i32 @putchar(i32 10)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.5, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 10)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 20)
%11 = tail call i32 @putchar(i32 10)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 30)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 40)
%14 = tail call i32 @putchar(i32 10)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.6, i64 0, i64 0))
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 11)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 22)
%18 = tail call i32 @putchar(i32 10)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 33)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 44)
%21 = tail call i32 @putchar(i32 10)
ret i32 0
}