#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 *, double *);
void lee_matriz(double **m, int filas, int columnas) {
  int i, j;
  double dato;
  for (i = 0; i < filas; i++) {
    for (j = 0; j < columnas; j++) {
      printf("Dar el elemento [%d][%d]", i + 1, j + 1);
      scanf("%lf", &dato);
      m[i][j] = dato;
    }
  }
}


x86 assembly (clang, -O0):
<lee_matriz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11bb <lee_matriz+0x9b>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11a8 <lee_matriz+0x88>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x18(%rbp),%edx
add    $0x1,%edx
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
lea    0xea2(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114c <lee_matriz+0x2c>
jmp    11ad <lee_matriz+0x8d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <lee_matriz+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lee_matriz>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edx,0xc(%rsp)
test   %esi,%esi
jle    11c2 <lee_matriz+0xa2>
mov    %rdi,%r15
mov    %esi,%eax
mov    %rax,0x10(%rsp)
mov    0xc(%rsp),%eax
xor    %ebp,%ebp
lea    0xeaf(%rip),%rbx
mov    %rax,0x18(%rsp)
jmp    116a <lee_matriz+0x4a>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rbp
cmp    0x10(%rsp),%r12
je     11c2 <lee_matriz+0xa2>
lea    0x1(%rbp),%r12
cmpl   $0x0,0xc(%rsp)
jle    1160 <lee_matriz+0x40>
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
lea    0x1(%r14),%r13
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r13d,%edx
call   1030 <printf@plt>
lea    0xe80(%rip),%rdi
lea    0x20(%rsp),%rsi
call   1040 <scanf@plt>
movsd  0x20(%rsp),%xmm0
mov    (%r15,%rbp,8),%rax
movsd  %xmm0,(%rax,%r14,8)
mov    0x18(%rsp),%rax
mov    %r13,%r14
cmp    %r13,%rax
jne    1180 <lee_matriz+0x60>
jmp    1160 <lee_matriz+0x40>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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