#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 lin, col, tab;
  int mat[4][4];
  for (lin = 0; lin <= 3; lin++) {
    for (col = 0; col <= 3; col++) {
      printf("Digite ELEMENTO da linha %d, coluna %d damatriz: ", lin + 1,
             col + 1);
      scanf("%d", &mat[lin][col]);
    }
  }
  printf("\n\nResultado:\n\n");
  for (lin = 0; lin <= 3; lin++) {
    printf("%d\n", mat[lin][lin]);
    for (tab = 1; tab <= lin + 1; tab++) {
      printf(" ");
    }
  }
  printf("\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jg     11b2 <main+0x92>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jg     119f <main+0x7f>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0xc(%rbp),%edx
add    $0x1,%edx
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x8(%rbp),%rax
lea    -0x50(%rbp),%rsi
shl    $0x4,%rax
add    %rax,%rsi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xea6(%rip),%rdi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1147 <main+0x27>
jmp    11a4 <main+0x84>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jg     123c <main+0x11c>
movslq -0x8(%rbp),%rcx
lea    -0x50(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     1229 <main+0x109>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11fc <main+0xdc>
jmp    122e <main+0x10e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c7 <main+0xa7>
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
lea    0xeb2(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec9(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
mov    $0x4,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x24(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x28(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
mov    $0x4,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x2c(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x30(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x34(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x38(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x3c(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xccf(%rip),%rdi
call   1040 <puts@plt>
mov    (%rsp),%esi
lea    0xcbc(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x3c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    0xc2d(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [50 x i8] c"Digite ELEMENTO da linha %d, coluna %d damatriz: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@str = [14 x i8] c"\0A\0AResultado:\0A\00"
@str.6 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca [4 x [4 x i32]]
%2 = bitcast [4 x [4 x i32]]* %1 to i8*
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 1, i32 1)
%4 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 1, i32 2)
%7 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 0, i64 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 1, i32 3)
%10 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 0, i64 2
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 1, i32 4)
%13 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 0, i64 3
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 2, i32 1)
%16 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 1, i64 0
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 2, i32 2)
%19 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 1, i64 1
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %19)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 2, i32 3)
%22 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 1, i64 2
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 2, i32 4)
%25 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 1, i64 3
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %25)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 3, i32 1)
%28 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 2, i64 0
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %28)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 3, i32 2)
%31 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 2, i64 1
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %31)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 3, i32 3)
%34 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 2, i64 2
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %34)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 3, i32 4)
%37 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 2, i64 3
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %37)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 4, i32 1)
%40 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 3, i64 0
%41 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %40)
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 4, i32 2)
%43 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 3, i64 1
%44 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %43)
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 4, i32 3)
%46 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 3, i64 2
%47 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %46)
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 4, i32 4)
%49 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %1, i64 0, i64 3, i64 3
%50 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %49)
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%52 = load i32, i32* %4
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %52)
%54 = call i32 @putchar(i32 32)
%55 = load i32, i32* %19
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %55)
%57 = call i32 @putchar(i32 32)
%58 = call i32 @putchar(i32 32)
%59 = load i32, i32* %34
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %59)
%61 = call i32 @putchar(i32 32)
%62 = call i32 @putchar(i32 32)
%63 = call i32 @putchar(i32 32)
%64 = load i32, i32* %49
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %64)
%66 = call i32 @putchar(i32 32)
%67 = call i32 @putchar(i32 32)
%68 = call i32 @putchar(i32 32)
%69 = call i32 @putchar(i32 32)
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.6, i64 0, i64 0))
ret i32 0
}