#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 */
size_t pos(int, int, int);
int /*<<< orphan*/ printf(char *, ...);
void imprimeMatriz(int *matriz, int m, int n) {
  printf("\u250c ");
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 3; ++j) {
      printf(" ");
    }
    printf("\t");
  }
  printf(" \u2510\n");
  for (int y = 0; y < m; ++y) {
    printf("\u2502 ");
    for (int x = 0; x < n; ++x) {
      printf("%-3d\t", matriz[pos(x, y, n)]);
    }
    printf(" \u2502\n");
  }
  printf("\u2514 ");
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 3; ++j) {
      printf(" ");
    }
    printf("\t");
  }
  printf(" \u2518\n");
}


x86 assembly (clang, -O0):
<imprimeMatriz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    119c <imprimeMatriz+0x7c>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    1180 <imprimeMatriz+0x60>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115a <imprimeMatriz+0x3a>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <imprimeMatriz+0x27>
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1236 <imprimeMatriz+0x116>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    121a <imprimeMatriz+0xfa>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <pos@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
mov    (%rax,%rcx,4),%esi
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11d2 <imprimeMatriz+0xb2>
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b1 <imprimeMatriz+0x91>
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    12a0 <imprimeMatriz+0x180>
movl   $0x0,-0x28(%rbp)
cmpl   $0x3,-0x28(%rbp)
jge    1284 <imprimeMatriz+0x164>
lea    0xd9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    125e <imprimeMatriz+0x13e>
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    124b <imprimeMatriz+0x12b>
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imprimeMatriz>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%rbp
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %ebx,%ebx
jle    119e <imprimeMatriz+0x5e>
mov    %ebx,%r15d
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x9,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%r15d
jne    1170 <imprimeMatriz+0x30>
lea    0xe70(%rip),%rdi
call   1040 <puts@plt>
test   %r14d,%r14d
jle    1216 <imprimeMatriz+0xd6>
lea    0xe54(%rip),%r12
xor    %r15d,%r15d
jmp    11d5 <imprimeMatriz+0x95>
nopl   0x0(%rax,%rax,1)
lea    0xe58(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r15d
cmp    %r14d,%r15d
je     1216 <imprimeMatriz+0xd6>
lea    0xe29(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %ebx,%ebx
jle    11c0 <imprimeMatriz+0x80>
xor    %r13d,%r13d
nopw   0x0(%rax,%rax,1)
mov    %r13d,%edi
mov    %r15d,%esi
mov    %ebx,%edx
call   1060 <pos@plt>
mov    0x0(%rbp,%rax,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r13d
cmp    %r13d,%ebx
jne    11f0 <imprimeMatriz+0xb0>
jmp    11c0 <imprimeMatriz+0x80>
lea    0xdf3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %ebx,%ebx
jle    125d <imprimeMatriz+0x11d>
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x9,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1230 <imprimeMatriz+0xf0>
lea    0xdb6(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"\E2\94\8C \00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [2 x i8] c"\09\00"
@.str.3 = [6 x i8] c" \E2\94\90\0A\00"
@.str.4 = [5 x i8] c"\E2\94\82 \00"
@.str.5 = [6 x i8] c"%-3d\09\00"
@.str.6 = [6 x i8] c" \E2\94\82\0A\00"
@.str.7 = [5 x i8] c"\E2\94\94 \00"
@.str.8 = [6 x i8] c" \E2\94\98\0A\00"
define void @imprimeMatriz(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %14
14: ; preds = %29, %3
%15 = load i32, i32* %7
%16 = load i32, i32* %6
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %32
18: ; preds = %14
store i32 0, i32* %8
br label %19
19: ; preds = %24, %18
%20 = load i32, i32* %8
%21 = icmp slt i32 %20, 3
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %22
%25 = load i32, i32* %8
%26 = add nsw i32 %25, 1
store i32 %26, i32* %8
br label %19
27: ; preds = %19
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %27
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
store i32 %31, i32* %7
br label %14
32: ; preds = %14
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %9
br label %34
34: ; preds = %58, %32
%35 = load i32, i32* %9
%36 = load i32, i32* %5
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %61
38: ; preds = %34
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %10
br label %40
40: ; preds = %53, %38
%41 = load i32, i32* %10
%42 = load i32, i32* %6
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %56
44: ; preds = %40
%45 = load i32*, i32** %4
%46 = load i32, i32* %10
%47 = load i32, i32* %9
%48 = load i32, i32* %6
%49 = call i64 @pos(i32 %46, i32 %47, i32 %48)
%50 = getelementptr inbounds i32, i32* %45, i64 %49
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %44
%54 = load i32, i32* %10
%55 = add nsw i32 %54, 1
store i32 %55, i32* %10
br label %40
56: ; preds = %40
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %58
58: ; preds = %56
%59 = load i32, i32* %9
%60 = add nsw i32 %59, 1
store i32 %60, i32* %9
br label %34
61: ; preds = %34
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %11
br label %63
63: ; preds = %78, %61
%64 = load i32, i32* %11
%65 = load i32, i32* %6
%66 = icmp slt i32 %64, %65
br i1 %66, label %67, label %81
67: ; preds = %63
store i32 0, i32* %12
br label %68
68: ; preds = %73, %67
%69 = load i32, i32* %12
%70 = icmp slt i32 %69, 3
br i1 %70, label %71, label %76
71: ; preds = %68
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %73
73: ; preds = %71
%74 = load i32, i32* %12
%75 = add nsw i32 %74, 1
store i32 %75, i32* %12
br label %68
76: ; preds = %68
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %78
78: ; preds = %76
%79 = load i32, i32* %11
%80 = add nsw i32 %79, 1
store i32 %80, i32* %11
br label %63
81: ; preds = %63
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\E2\94\8C \00"
@.str.4 = [5 x i8] c"\E2\94\82 \00"
@.str.5 = [6 x i8] c"%-3d\09\00"
@.str.7 = [5 x i8] c"\E2\94\94 \00"
@str = [5 x i8] c" \E2\94\90\00"
@str.9 = [5 x i8] c" \E2\94\98\00"
@str.10 = [5 x i8] c" \E2\94\82\00"
define void @imprimeMatriz(i32* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %14
6: ; preds = %3, %6
%7 = phi i32 [ %12, %6 ], [ 0, %3 ]
%8 = tail call i32 @putchar(i32 32)
%9 = tail call i32 @putchar(i32 32)
%10 = tail call i32 @putchar(i32 32)
%11 = tail call i32 @putchar(i32 9)
%12 = add nuw nsw i32 %7, 1
%13 = icmp eq i32 %12, %2
br i1 %13, label %14, label %6
14: ; preds = %6, %3
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%16 = icmp sgt i32 %1, 0
br i1 %16, label %19, label %17
17: ; preds = %22, %14
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br i1 %5, label %34, label %42
19: ; preds = %14, %22
%20 = phi i32 [ %24, %22 ], [ 0, %14 ]
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br i1 %5, label %26, label %22
22: ; preds = %26, %19
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.10, i64 0, i64 0))
%24 = add nuw nsw i32 %20, 1
%25 = icmp eq i32 %24, %1
br i1 %25, label %17, label %19
26: ; preds = %19, %26
%27 = phi i32 [ %32, %26 ], [ 0, %19 ]
%28 = tail call i64 @pos(i32 %27, i32 %20, i32 %2)
%29 = getelementptr inbounds i32, i32* %0, i64 %28
%30 = load i32, i32* %29
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %30)
%32 = add nuw nsw i32 %27, 1
%33 = icmp eq i32 %32, %2
br i1 %33, label %22, label %26
34: ; preds = %17, %34
%35 = phi i32 [ %40, %34 ], [ 0, %17 ]
%36 = tail call i32 @putchar(i32 32)
%37 = tail call i32 @putchar(i32 32)
%38 = tail call i32 @putchar(i32 32)
%39 = tail call i32 @putchar(i32 9)
%40 = add nuw nsw i32 %35, 1
%41 = icmp eq i32 %40, %2
br i1 %41, label %42, label %34
42: ; preds = %34, %17
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.9, i64 0, i64 0))
ret void
}