#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 */
double Px(double **, double);
int /*<<< orphan*/ f1(double **);
int /*<<< orphan*/ f2(double **);
int /*<<< orphan*/ f3(double **);
int /*<<< orphan*/ iniMatriz(double **);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ verMatriz(double **);
int main() {
  double **matriz;
  double x = 5.3;
  double sol;
  int i;
  matriz = (double **)malloc(4 * sizeof(double *));
  for (i = 0; i < 5; i++)
    matriz[i] = (double *)malloc(5 * sizeof(double));
  iniMatriz(matriz);
  f1(matriz);
  f2(matriz);
  f3(matriz);
  printf("MATRIZ\n\n");
  verMatriz(matriz);
  sol = Px(matriz, x);
  printf("\nsol: %lf\n\n", sol);
  system("PAUSE");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xe59(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x20,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    11f2 <main+0x62>
mov    $0x28,%edi
call   10a0 <malloc@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11c1 <main+0x31>
mov    -0x10(%rbp),%rdi
call   1070 <iniMatriz@plt>
mov    -0x10(%rbp),%rdi
call   1090 <f1@plt>
mov    -0x10(%rbp),%rdi
call   1030 <f2@plt>
mov    -0x10(%rbp),%rdi
call   1080 <f3@plt>
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <verMatriz@plt>
mov    -0x10(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
call   1060 <Px@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xdc5(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xdc3(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x20,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbx
mov    $0x28,%edi
call   10b0 <malloc@plt>
mov    %rax,(%rbx)
mov    $0x28,%edi
call   10b0 <malloc@plt>
mov    %rax,0x8(%rbx)
mov    $0x28,%edi
call   10b0 <malloc@plt>
mov    %rax,0x10(%rbx)
mov    $0x28,%edi
call   10b0 <malloc@plt>
mov    %rax,0x18(%rbx)
mov    $0x28,%edi
call   10b0 <malloc@plt>
mov    %rax,0x20(%rbx)
mov    %rbx,%rdi
call   1080 <iniMatriz@plt>
mov    %rbx,%rdi
call   10a0 <f1@plt>
mov    %rbx,%rdi
call   1030 <f2@plt>
mov    %rbx,%rdi
call   1090 <f3@plt>
lea    0xe00(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   10c0 <verMatriz@plt>
movsd  0xdd1(%rip),%xmm0
mov    %rbx,%rdi
call   1070 <Px@plt>
lea    0xdca(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xdc8(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"MATRIZ\0A\0A\00"
@.str.1 = [12 x i8] c"\0Asol: %lf\0A\0A\00"
@.str.2 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double**
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store i32 0, i32* %1
store double 5.300000e+00, double* %3
%6 = call i64 @malloc(i32 32)
%7 = inttoptr i64 %6 to double**
store double** %7, double*** %2
store i32 0, i32* %5
br label %8
8: ; preds = %18, %0
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 5
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = call i64 @malloc(i32 40)
%13 = inttoptr i64 %12 to double*
%14 = load double**, double*** %2
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds double*, double** %14, i64 %16
store double* %13, double** %17
br label %18
18: ; preds = %11
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %8
21: ; preds = %8
%22 = load double**, double*** %2
%23 = call i32 @iniMatriz(double** %22)
%24 = load double**, double*** %2
%25 = call i32 @f1(double** %24)
%26 = load double**, double*** %2
%27 = call i32 @f2(double** %26)
%28 = load double**, double*** %2
%29 = call i32 @f3(double** %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%31 = load double**, double*** %2
%32 = call i32 @verMatriz(double** %31)
%33 = load double**, double*** %2
%34 = load double, double* %3
%35 = call double @Px(double** %33, double %34)
store double %35, double* %4
%36 = load double, double* %4
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %36)
%38 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"\0Asol: %lf\0A\0A\00"
@.str.2 = [6 x i8] c"PAUSE\00"
@str = [8 x i8] c"MATRIZ\0A\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 32)
%2 = inttoptr i64 %1 to double**
%3 = tail call i64 @malloc(i32 40)
%4 = inttoptr i64 %3 to double*
store double* %4, double** %2
%5 = tail call i64 @malloc(i32 40)
%6 = inttoptr i64 %5 to double*
%7 = getelementptr inbounds double*, double** %2, i64 1
store double* %6, double** %7
%8 = tail call i64 @malloc(i32 40)
%9 = inttoptr i64 %8 to double*
%10 = getelementptr inbounds double*, double** %2, i64 2
store double* %9, double** %10
%11 = tail call i64 @malloc(i32 40)
%12 = inttoptr i64 %11 to double*
%13 = getelementptr inbounds double*, double** %2, i64 3
store double* %12, double** %13
%14 = tail call i64 @malloc(i32 40)
%15 = inttoptr i64 %14 to double*
%16 = getelementptr inbounds double*, double** %2, i64 4
store double* %15, double** %16
%17 = tail call i32 @iniMatriz(double** %2)
%18 = tail call i32 @f1(double** %2)
%19 = tail call i32 @f2(double** %2)
%20 = tail call i32 @f3(double** %2)
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%22 = tail call i32 @verMatriz(double** %2)
%23 = tail call double @Px(double** %2, double 5.300000e+00)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %23)
%25 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}