#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*/ scanf(char *, int *);
int rec_matrix(int M1[10][10], int M, int N) {
  int valor;
  for (int i = 0; i < M; i++)
    for (int j = 0; j < N; j++) {
      printf("ingresar valor (%d,%d): ", i, j);
      scanf("%d", &valor);
      M1[i][j] = valor;
    }
  return 1;
}


x86 assembly (clang, -O0):
<rec_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b4 <rec_matrix+0x94>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11a1 <rec_matrix+0x81>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
lea    0xea8(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114c <rec_matrix+0x2c>
jmp    11a6 <rec_matrix+0x86>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1139 <rec_matrix+0x19>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rec_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,0x8(%rsp)
test   %esi,%esi
jle    119f <rec_matrix+0x7f>
mov    %rdi,%rbx
mov    %esi,%eax
mov    %rax,0x10(%rsp)
mov    0x8(%rsp),%r15d
xor    %ebp,%ebp
lea    0xeb2(%rip),%r12
jmp    115f <rec_matrix+0x3f>
add    $0x1,%rbp
add    $0x28,%rbx
cmp    0x10(%rsp),%rbp
je     119f <rec_matrix+0x7f>
cmpl   $0x0,0x8(%rsp)
lea    0xc(%rsp),%r13
jle    1150 <rec_matrix+0x30>
xor    %r14d,%r14d
xchg   %ax,%ax
mov    %r12,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,(%rbx,%r14,4)
add    $0x1,%r14
cmp    %r14,%r15
jne    1170 <rec_matrix+0x50>
jmp    1150 <rec_matrix+0x30>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"ingresar valor (%d,%d): \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @rec_matrix([10 x i32]* %0, i32 %1, i32 %2) {
%4 = alloca [10 x i32]*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store [10 x i32]* %0, [10 x i32]** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %8
br label %10
10: ; preds = %36, %3
%11 = load i32, i32* %8
%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* %9
br label %15
15: ; preds = %32, %14
%16 = load i32, i32* %9
%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* %8
%21 = load i32, i32* %9
%22 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %21)
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%24 = load i32, i32* %7
%25 = load [10 x i32]*, [10 x i32]** %4
%26 = load i32, i32* %8
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %25, i64 %27
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %28, i64 0, i64 %30
store i32 %24, i32* %31
br label %32
32: ; preds = %19
%33 = load i32, i32* %9
%34 = add nsw i32 %33, 1
store i32 %34, i32* %9
br label %15
35: ; preds = %15
br label %36
36: ; preds = %35
%37 = load i32, i32* %8
%38 = add nsw i32 %37, 1
store i32 %38, i32* %8
br label %10
39: ; preds = %10
ret i32 1
}

LLVM IR (-O2):
@.str = [25 x i8] c"ingresar valor (%d,%d): \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @rec_matrix([10 x i32]* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %15
7: ; preds = %3
%8 = icmp sgt i32 %2, 0
%9 = zext i32 %1 to i64
%10 = zext i32 %2 to i64
br label %11
11: ; preds = %7, %16
%12 = phi i64 [ 0, %7 ], [ %17, %16 ]
br i1 %8, label %13, label %16
13: ; preds = %11
%14 = trunc i64 %12 to i32
br label %19
15: ; preds = %16, %3
ret i32 1
16: ; preds = %19, %11
%17 = add nuw nsw i64 %12, 1
%18 = icmp eq i64 %17, %9
br i1 %18, label %15, label %11
19: ; preds = %13, %19
%20 = phi i64 [ 0, %13 ], [ %26, %19 ]
%21 = trunc i64 %20 to i32
%22 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %21)
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%24 = load i32, i32* %4
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %12, i64 %20
store i32 %24, i32* %25
%26 = add nuw nsw i64 %20, 1
%27 = icmp eq i64 %26, %10
br i1 %27, label %16, label %19
}