#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*/ putchar(char);
int /*<<< orphan*/ puts(char *);
void imprime_matriz(int matriz[4][4]) {
  int i, j;
  puts("\n\t+----+----+----+----+----+");
  puts("\t|    |  1 |  2 |  3 |  4 | <-- Colunas");
  puts("\t+----+----+----+----+----+");
  for (i = 0; i < 4; i++) {
    printf("\t| %2d |", i + 1);
    for (j = 0; j < 4; j++) {
      if (!matriz[i][j])
        printf("  ");
      else
        printf("%3d", matriz[i][j]);
      printf(" |");
    }
    putchar('\n');
    puts("\t+----+----+----+----+----+");
  }
  puts("\t  |");
  puts("\t  +---- Linhas");
  putchar('\n');
}


x86 assembly (clang, -O0):
<imprime_matriz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
call   1040 <puts@plt>
lea    0xece(%rip),%rdi
call   1040 <puts@plt>
lea    0xea6(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    122a <imprime_matriz+0xfa>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    1206 <imprime_matriz+0xd6>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    11c6 <imprime_matriz+0x96>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11ea <imprime_matriz+0xba>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118c <imprime_matriz+0x5c>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdea(%rip),%rdi
call   1040 <puts@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1167 <imprime_matriz+0x37>
lea    0xe24(%rip),%rdi
call   1040 <puts@plt>
lea    0xe1d(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imprime_matriz>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xebb(%rip),%rdi
call   1040 <puts@plt>
lea    0xecc(%rip),%rdi
call   1040 <puts@plt>
lea    0xea4(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%ebp
lea    0xee0(%rip),%r12
lea    0xee2(%rip),%r13
lea    0xed5(%rip),%r14
xor    %r15d,%r15d
jmp    11cb <imprime_matriz+0x9b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe4c(%rip),%rdi
call   1040 <puts@plt>
add    $0x10,%r15
add    $0x1,%ebp
cmp    $0x40,%r15
je     1280 <imprime_matriz+0x150>
lea    0xe73(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rbx,%r15,1),%esi
test   %esi,%esi
je     11f0 <imprime_matriz+0xc0>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11fa <imprime_matriz+0xca>
nop
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rbx,%r15,1),%esi
test   %esi,%esi
je     1220 <imprime_matriz+0xf0>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    122a <imprime_matriz+0xfa>
nopl   0x0(%rax)
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rbx,%r15,1),%esi
test   %esi,%esi
je     1250 <imprime_matriz+0x120>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    125a <imprime_matriz+0x12a>
nopl   0x0(%rax)
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rbx,%r15,1),%esi
test   %esi,%esi
je     1190 <imprime_matriz+0x60>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    119a <imprime_matriz+0x6a>
lea    0xdce(%rip),%rdi
call   1040 <puts@plt>
lea    0xdc7(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"\0A\09+----+----+----+----+----+\00"
@.str.1 = [40 x i8] c"\09| | 1 | 2 | 3 | 4 | <-- Colunas\00"
@.str.2 = [28 x i8] c"\09+----+----+----+----+----+\00"
@.str.3 = [9 x i8] c"\09| %2d |\00"
@.str.4 = [3 x i8] c" \00"
@.str.5 = [4 x i8] c"%3d\00"
@.str.6 = [3 x i8] c" |\00"
@.str.7 = [5 x i8] c"\09 |\00"
@.str.8 = [16 x i8] c"\09 +---- Linhas\00"
define void @imprime_matriz([4 x i32]* %0) {
%2 = alloca [4 x i32]*
%3 = alloca i32
%4 = alloca i32
store [4 x i32]* %0, [4 x i32]** %2
%5 = call i32 @puts(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @puts(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %8
8: ; preds = %48, %1
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 4
br i1 %10, label %11, label %51
11: ; preds = %8
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %13)
store i32 0, i32* %4
br label %15
15: ; preds = %42, %11
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 4
br i1 %17, label %18, label %45
18: ; preds = %15
%19 = load [4 x i32]*, [4 x i32]** %2
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %19, i64 %21
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [4 x i32], [4 x i32]* %22, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = icmp ne i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %18
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %40
30: ; preds = %18
%31 = load [4 x i32]*, [4 x i32]** %2
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [4 x i32], [4 x i32]* %31, i64 %33
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [4 x i32], [4 x i32]* %34, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %38)
br label %40
40: ; preds = %30, %28
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %42
42: ; preds = %40
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %15
45: ; preds = %15
%46 = call i32 @putchar(i8 signext 10)
%47 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
br label %48
48: ; preds = %45
%49 = load i32, i32* %3
%50 = add nsw i32 %49, 1
store i32 %50, i32* %3
br label %8
51: ; preds = %8
%52 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%53 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%54 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"\0A\09+----+----+----+----+----+\00"
@.str.1 = [40 x i8] c"\09| | 1 | 2 | 3 | 4 | <-- Colunas\00"
@.str.2 = [28 x i8] c"\09+----+----+----+----+----+\00"
@.str.3 = [9 x i8] c"\09| %2d |\00"
@.str.4 = [3 x i8] c" \00"
@.str.5 = [4 x i8] c"%3d\00"
@.str.6 = [3 x i8] c" |\00"
@.str.7 = [5 x i8] c"\09 |\00"
@.str.8 = [16 x i8] c"\09 +---- Linhas\00"
define void @imprime_matriz([4 x i32]* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
br label %5
5: ; preds = %1, %44
%6 = phi i64 [ 0, %1 ], [ %7, %44 ]
%7 = add nuw nsw i64 %6, 1
%8 = trunc i64 %7 to i32
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %6, i64 0
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %5
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %17
15: ; preds = %5
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %11)
br label %17
17: ; preds = %15, %13
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %6, i64 1
%20 = load i32, i32* %19
%21 = icmp eq i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %17
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %20)
br label %26
24: ; preds = %17
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %26
26: ; preds = %24, %22
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%28 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %6, i64 2
%29 = load i32, i32* %28
%30 = icmp eq i32 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %26
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %29)
br label %35
33: ; preds = %26
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %35
35: ; preds = %33, %31
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%37 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %6, i64 3
%38 = load i32, i32* %37
%39 = icmp eq i32 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %35
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %38)
br label %44
42: ; preds = %35
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %44
44: ; preds = %42, %40
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%46 = tail call i32 @putchar(i8 signext 10)
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%48 = icmp eq i64 %7, 4
br i1 %48, label %49, label %5
49: ; preds = %44
%50 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%51 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%52 = tail call i32 @putchar(i8 signext 10)
ret void
}