#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, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
void populaMatriz(int *matriz, int lin, int col) {
  int i, j;
  puts(" Entre com os valores da matriz\n");
  for (i = 0; i < lin; i++)
    for (j = 0; j < col; j++) {
      printf("Matriz[%d][%d]= ", i, j);
      scanf("%d", matriz + (i * col + j));
    }
}


x86 assembly (clang, -O0):
<populaMatriz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ca <populaMatriz+0x9a>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11b7 <populaMatriz+0x87>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%eax
imul   -0x10(%rbp),%eax
add    -0x18(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe8e(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1168 <populaMatriz+0x38>
jmp    11bc <populaMatriz+0x8c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1155 <populaMatriz+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<populaMatriz>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edx,0xc(%rsp)
mov    %esi,%ebx
mov    %rdi,0x10(%rsp)
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
test   %ebx,%ebx
jle    11e7 <populaMatriz+0xb7>
movslq 0xc(%rsp),%rax
mov    %ebx,%ecx
mov    %rcx,0x18(%rsp)
mov    %eax,%r15d
shl    $0x2,%rax
mov    %rax,0x20(%rsp)
xor    %ebp,%ebp
lea    0xea3(%rip),%r12
lea    0xead(%rip),%r13
jmp    11a5 <populaMatriz+0x75>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
mov    0x20(%rsp),%rax
add    %rax,0x10(%rsp)
cmp    0x18(%rsp),%rbp
je     11e7 <populaMatriz+0xb7>
cmpl   $0x0,0xc(%rsp)
jle    1190 <populaMatriz+0x60>
mov    0x10(%rsp),%rbx
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x1,%r14
add    $0x4,%rbx
cmp    %r14,%r15
jne    11c0 <populaMatriz+0x90>
jmp    1190 <populaMatriz+0x60>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c" Entre com os valores da matriz\0A\00"
@.str.1 = [17 x i8] c"Matriz[%d][%d]= \00"
@.str.2 = [3 x i8] c"%d\00"
define void @populaMatriz(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 @puts(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %10
10: ; preds = %36, %3
%11 = load i32, i32* %7
%12 = load i32, i32* %5
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %39
14: ; preds = %10
store i32 0, i32* %8
br label %15
15: ; preds = %32, %14
%16 = load i32, i32* %8
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %35
19: ; preds = %15
%20 = load i32, i32* %7
%21 = load i32, i32* %8
%22 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32 %21)
%23 = load i32*, i32** %4
%24 = load i32, i32* %7
%25 = load i32, i32* %6
%26 = mul nsw i32 %24, %25
%27 = load i32, i32* %8
%28 = add nsw i32 %26, %27
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %23, i64 %29
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %30)
br label %32
32: ; preds = %19
%33 = load i32, i32* %8
%34 = add nsw i32 %33, 1
store i32 %34, i32* %8
br label %15
35: ; preds = %15
br label %36
36: ; preds = %35
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %10
39: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c" Entre com os valores da matriz\0A\00"
@.str.1 = [17 x i8] c"Matriz[%d][%d]= \00"
@.str.2 = [3 x i8] c"%d\00"
define void @populaMatriz(i32* %0, i32 %1, i32 %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %28
6: ; preds = %3
%7 = icmp sgt i32 %2, 0
%8 = sext i32 %2 to i64
%9 = zext i32 %1 to i64
%10 = zext i32 %2 to i64
br label %11
11: ; preds = %6, %25
%12 = phi i64 [ 0, %6 ], [ %26, %25 ]
br i1 %7, label %13, label %25
13: ; preds = %11
%14 = mul nsw i64 %12, %8
%15 = trunc i64 %12 to i32
br label %16
16: ; preds = %13, %16
%17 = phi i64 [ 0, %13 ], [ %23, %16 ]
%18 = trunc i64 %17 to i32
%19 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %18)
%20 = add nsw i64 %17, %14
%21 = getelementptr inbounds i32, i32* %0, i64 %20
%22 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %21)
%23 = add nuw nsw i64 %17, 1
%24 = icmp eq i64 %23, %10
br i1 %24, label %25, label %16
25: ; preds = %16, %11
%26 = add nuw nsw i64 %12, 1
%27 = icmp eq i64 %26, %9
br i1 %27, label %28, label %11
28: ; preds = %25, %3
ret void
}