#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 *);
void matriz(int M[][100], int ordem) {
  int l, c;
  for (c = 0; c < ordem; ++c) {
    for (l = 0; l < ordem; ++l) {
      printf("Valor[%d][%d]: ", c, l);
      scanf("%d", &M[c][l]);
    }
  }
  for (c = 0; c < ordem; c++) {
    for (l = 0; l < ordem; l++) {
      printf("%d ", M[c][l]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<matriz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b3 <matriz+0x93>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a0 <matriz+0x80>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
movslq -0x14(%rbp),%rax
imul   $0x190,%rax,%rax
add    %rax,%rsi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe83(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1149 <matriz+0x29>
jmp    11a5 <matriz+0x85>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1136 <matriz+0x16>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    122a <matriz+0x10a>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    120e <matriz+0xee>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11cd <matriz+0xad>
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ba <matriz+0x9a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matriz>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %esi,%esi
jle    1220 <matriz+0xf0>
mov    %esi,0x4(%rsp)
mov    %esi,%r15d
mov    %rdi,%rbx
lea    0xea9(%rip),%r12
lea    0xeb2(%rip),%r13
mov    %rdi,0x8(%rsp)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,0x10(%rsp)
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x1,%r14
add    $0x4,%rbx
cmp    %r14,%r15
jne    1180 <matriz+0x50>
add    $0x1,%rbp
mov    0x10(%rsp),%rbx
add    $0x190,%rbx
cmp    %r15,%rbp
jne    1170 <matriz+0x40>
cmpl   $0x0,0x4(%rsp)
mov    0x8(%rsp),%rbx
jle    1220 <matriz+0xf0>
lea    0xe44(%rip),%r12
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rbx,%rbp,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    11f0 <matriz+0xc0>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
add    $0x190,%rbx
cmp    %r15,%r14
jne    11e0 <matriz+0xb0>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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