#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 *, ...);
printMatrix(int **mat, int matrix_size, char *matrix_name) {
  int i, j;
  printf("A matriz %s %d X %d é:\n", matrix_name, matrix_size, matrix_size);
  for (i = 0; i < matrix_size; i++) {
    for (j = 0; j < matrix_size; j++)
      printf("%d ", mat[i][j]);
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11ac <printMatrix+0x9c>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1190 <printMatrix+0x80>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1155 <printMatrix+0x45>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1142 <printMatrix+0x32>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r15
lea    0xecc(%rip),%rdi
mov    %rdx,%rsi
mov    %ebp,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
jle    119d <printMatrix+0x7d>
mov    %ebp,%r12d
lea    0xec9(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r15,%rbx,8),%rax
mov    (%rax,%rbp,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1170 <printMatrix+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %r12,%rbx
jne    1160 <printMatrix+0x40>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"A matriz %s %d X %d \C3\A9:\0A\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @printMatrix(i32** %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i32** %0, i32*** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
%10 = load i8*, i8** %7
%11 = load i32, i32* %6
%12 = load i32, i32* %6
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %11, i32 %12)
store i32 0, i32* %8
br label %14
14: ; preds = %39, %3
%15 = load i32, i32* %8
%16 = load i32, i32* %6
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %42
18: ; preds = %14
store i32 0, i32* %9
br label %19
19: ; preds = %34, %18
%20 = load i32, i32* %9
%21 = load i32, i32* %6
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %37
23: ; preds = %19
%24 = load i32**, i32*** %5
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32*, i32** %24, i64 %26
%28 = load i32*, i32** %27
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %23
%35 = load i32, i32* %9
%36 = add nsw i32 %35, 1
store i32 %36, i32* %9
br label %19
37: ; preds = %19
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %39
39: ; preds = %37
%40 = load i32, i32* %8
%41 = add nsw i32 %40, 1
store i32 %41, i32* %8
br label %14
42: ; preds = %14
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%44 = load i32, i32* %4
ret i32 %44
}

LLVM IR (-O2):
@.str = [25 x i8] c"A matriz %s %d X %d \C3\A9:\0A\00"
@.str.1 = [4 x i8] c"%d \00"
define i32 @printMatrix(i32** nocapture %0, i32 %1, i8* %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %1, i32 %1)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %23
6: ; preds = %3
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %19, %6
%9 = phi i64 [ 0, %6 ], [ %21, %19 ]
%10 = getelementptr inbounds i32*, i32** %0, i64 %9
br label %11
11: ; preds = %8, %11
%12 = phi i64 [ 0, %8 ], [ %17, %11 ]
%13 = load i32*, i32** %10
%14 = getelementptr inbounds i32, i32* %13, i64 %12
%15 = load i32, i32* %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = add nuw nsw i64 %12, 1
%18 = icmp eq i64 %17, %7
br i1 %18, label %19, label %11
19: ; preds = %11
%20 = tail call i32 @putchar(i32 10)
%21 = add nuw nsw i64 %9, 1
%22 = icmp eq i64 %21, %7
br i1 %22, label %23, label %8
23: ; preds = %19, %3
%24 = tail call i32 @putchar(i32 10)
ret i32 undef
}