#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 *, ...);
void print_matrix(int m, int n, int **mat) {
  int i, j;
  printf("imprimindo vetores \n");
  for (i = 0; i < m; i++) {
    for (j = 0; j <= mat[i][0]; j++) {
      printf("%d\t", mat[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11ac <print_matrix+0x9c>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
cmp    (%rcx),%eax
jg     1190 <print_matrix+0x80>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114a <print_matrix+0x3a>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <print_matrix+0x27>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r12
mov    %edi,%ebp
lea    0xec0(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,%ebp
jle    11c0 <print_matrix+0x90>
mov    %ebp,%r15d
lea    0xea9(%rip),%r14
xor    %ebp,%ebp
jmp    1173 <print_matrix+0x43>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %r15,%rbp
je     11c0 <print_matrix+0x90>
mov    (%r12,%rbp,8),%rax
mov    (%rax),%esi
test   %esi,%esi
js     1160 <print_matrix+0x30>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r12,%rbp,8),%rax
cmpl   $0x0,(%rax)
jle    1160 <print_matrix+0x30>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x4(%rax,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r12,%rbp,8),%rax
movslq (%rax),%rcx
add    $0x1,%rbx
cmp    %rcx,%rbx
jl     11a0 <print_matrix+0x70>
jmp    1160 <print_matrix+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\09\00"
@str = [20 x i8] c"imprimindo vetores \00"
define void @print_matrix(i32 %0, i32 %1, i32** nocapture %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %34
6: ; preds = %3
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %30
%9 = phi i64 [ 0, %6 ], [ %32, %30 ]
%10 = getelementptr inbounds i32*, i32** %2, i64 %9
%11 = load i32*, i32** %10
%12 = load i32, i32* %11
%13 = icmp slt i32 %12, 0
br i1 %13, label %30, label %14
14: ; preds = %8
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%16 = load i32*, i32** %10
%17 = load i32, i32* %16
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %30
19: ; preds = %14, %19
%20 = phi i32* [ %26, %19 ], [ %16, %14 ]
%21 = phi i64 [ %25, %19 ], [ 1, %14 ]
%22 = getelementptr inbounds i32, i32* %20, i64 %21
%23 = load i32, i32* %22
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = add nuw nsw i64 %21, 1
%26 = load i32*, i32** %10
%27 = load i32, i32* %26
%28 = sext i32 %27 to i64
%29 = icmp slt i64 %21, %28
br i1 %29, label %19, label %30
30: ; preds = %19, %14, %8
%31 = tail call i32 @putchar(i32 10)
%32 = add nuw nsw i64 %9, 1
%33 = icmp eq i64 %32, %7
br i1 %33, label %34, label %8
34: ; preds = %30, %3
ret void
}