#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 read_matrix(int m, int n, int a[][100]) {
  int i, j;
  printf("Informe os valores de A: \n");
  for (i = 0; i < m; i++) {
    for (j = 0; j < n; j++) {
      scanf("%d", &a[i][j]);
    }
  }
}


x86 assembly (clang, -O0):
<read_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11ae <read_matrix+0x8e>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    119b <read_matrix+0x7b>
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
imul   $0x190,%rax,%rax
add    %rax,%rsi
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe93(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1158 <read_matrix+0x38>
jmp    11a0 <read_matrix+0x80>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1145 <read_matrix+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r15
mov    %esi,0xc(%rsp)
mov    %edi,%ebx
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
test   %ebx,%ebx
jle    1197 <read_matrix+0x77>
mov    %ebx,%r12d
mov    0xc(%rsp),%eax
mov    %rax,0x10(%rsp)
xor    %r13d,%r13d
lea    0xea3(%rip),%rbp
jmp    1170 <read_matrix+0x50>
nop
add    $0x1,%r13
add    $0x190,%r15
cmp    %r12,%r13
je     1197 <read_matrix+0x77>
cmpl   $0x0,0xc(%rsp)
jle    1160 <read_matrix+0x40>
mov    0x10(%rsp),%r14
mov    %r15,%rbx
nop
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
add    $0x4,%rbx
add    $0xffffffffffffffff,%r14
jne    1180 <read_matrix+0x60>
jmp    1160 <read_matrix+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [26 x i8] c"Informe os valores de A: \00"
define void @read_matrix(i32 %0, i32 %1, [100 x i32]* %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %21
6: ; preds = %3
%7 = icmp sgt i32 %1, 0
%8 = zext i32 %0 to i64
%9 = zext i32 %1 to i64
br label %10
10: ; preds = %6, %18
%11 = phi i64 [ 0, %6 ], [ %19, %18 ]
br i1 %7, label %12, label %18
12: ; preds = %10, %12
%13 = phi i64 [ %16, %12 ], [ 0, %10 ]
%14 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 %11, i64 %13
%15 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = add nuw nsw i64 %13, 1
%17 = icmp eq i64 %16, %9
br i1 %17, label %18, label %12
18: ; preds = %12, %10
%19 = add nuw nsw i64 %11, 1
%20 = icmp eq i64 %19, %8
br i1 %20, label %21, label %10
21: ; preds = %18, %3
ret void
}