#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 dwalltime();
int /*<<< orphan*/ printf(char *, ...);
main(int argc, char *argv[]) {
  double x = 2;
  double timetick, timeend;
  double resultado;
  long long int i;
  printf("Funcion calculada...\n");
  timetick = dwalltime();
  double fx = 2 * (((x * x * x) + (3 * x * x) + (3 * x) + 2) / ((x * x) + 1));
  for (i = 0; i < 100000000; i++) {
    resultado += fx - i;
  }
  timeend = dwalltime();
  printf(" Tiempo total en segundos %.10lf \n", (timeend - timetick));
  printf(" Tiempo promedio en segundos %.10lf \n",
         (timeend - timetick) / 100000000);
  printf("Funcion calculada cada vez...\n");
  timetick = dwalltime();
  for (i = 0; i < 100000000; i++) {
    resultado +=
        2 * (((x * x * x) + (3 * x * x) + (3 * x) + 2) / ((x * x) + 1)) - i;
  }
  timeend = dwalltime();
  printf(" Tiempo total en segundos %.10lf \n", (timeend - timetick));
  printf(" Tiempo promedio en segundos %.10lf \n",
         (timeend - timetick) / 100000000);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xec2(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <dwalltime@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xe9c(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xe7d(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe5d(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
movsd  0xe4b(%rip),%xmm2
addsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
movsd  0xe33(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movq   $0x0,-0x38(%rbp)
cmpq   $0x5f5e100,-0x38(%rbp)
05
jge    1216 <main+0xf6>
movsd  -0x40(%rbp),%xmm0
cvtsi2sdq -0x38(%rbp),%xmm1
subsd  %xmm1,%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    11de <main+0xbe>
mov    $0x0,%al
call   1040 <dwalltime@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
lea    0xe03(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  0xdcc(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe02(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <dwalltime@plt>
movsd  %xmm0,-0x20(%rbp)
movq   $0x0,-0x38(%rbp)
cmpq   $0x5f5e100,-0x38(%rbp)
05
jge    1336 <main+0x216>
movsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  0xd6b(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  0xd4c(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd2c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xd1a(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdq -0x38(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1280 <main+0x160>
mov    $0x0,%al
call   1040 <dwalltime@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
lea    0xce3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  0xcac(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xce2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xf16(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <dwalltime@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1050 <dwalltime@plt>
subsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
lea    0xea4(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
divsd  0xe85(%rip),%xmm0
lea    0xea9(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <dwalltime@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1050 <dwalltime@plt>
subsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
divsd  0xe34(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Funcion calculada...\0A\00"
@.str.1 = [35 x i8] c" Tiempo total en segundos %.10lf \0A\00"
@.str.2 = [38 x i8] c" Tiempo promedio en segundos %.10lf \0A\00"
@.str.3 = [31 x i8] c"Funcion calculada cada vez...\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca i64
%11 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 2.000000e+00, double* %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%13 = call double (...) @dwalltime()
store double %13, double* %7
%14 = load double, double* %6
%15 = load double, double* %6
%16 = fmul double %14, %15
%17 = load double, double* %6
%18 = load double, double* %6
%19 = fmul double 3.000000e+00, %18
%20 = load double, double* %6
%21 = fmul double %19, %20
%22 = call double @llvm.fmuladd.f64(double %16, double %17, double %21)
%23 = load double, double* %6
%24 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %23, double %22)
%25 = fadd double %24, 2.000000e+00
%26 = load double, double* %6
%27 = load double, double* %6
%28 = call double @llvm.fmuladd.f64(double %26, double %27, double 1.000000e+00)
%29 = fdiv double %25, %28
%30 = fmul double 2.000000e+00, %29
store double %30, double* %11
store i64 0, i64* %10
br label %31
31: ; preds = %41, %2
%32 = load i64, i64* %10
%33 = icmp slt i64 %32, 100000000
br i1 %33, label %34, label %44
34: ; preds = %31
%35 = load double, double* %11
%36 = load i64, i64* %10
%37 = sitofp i64 %36 to double
%38 = fsub double %35, %37
%39 = load double, double* %9
%40 = fadd double %39, %38
store double %40, double* %9
br label %41
41: ; preds = %34
%42 = load i64, i64* %10
%43 = add nsw i64 %42, 1
store i64 %43, i64* %10
br label %31
44: ; preds = %31
%45 = call double (...) @dwalltime()
store double %45, double* %8
%46 = load double, double* %8
%47 = load double, double* %7
%48 = fsub double %46, %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), double %48)
%50 = load double, double* %8
%51 = load double, double* %7
%52 = fsub double %50, %51
%53 = fdiv double %52, 1.000000e+08
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), double %53)
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%56 = call double (...) @dwalltime()
store double %56, double* %7
store i64 0, i64* %10
br label %57
57: ; preds = %83, %44
%58 = load i64, i64* %10
%59 = icmp slt i64 %58, 100000000
br i1 %59, label %60, label %86
60: ; preds = %57
%61 = load double, double* %6
%62 = load double, double* %6
%63 = fmul double %61, %62
%64 = load double, double* %6
%65 = load double, double* %6
%66 = fmul double 3.000000e+00, %65
%67 = load double, double* %6
%68 = fmul double %66, %67
%69 = call double @llvm.fmuladd.f64(double %63, double %64, double %68)
%70 = load double, double* %6
%71 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %70, double %69)
%72 = fadd double %71, 2.000000e+00
%73 = load double, double* %6
%74 = load double, double* %6
%75 = call double @llvm.fmuladd.f64(double %73, double %74, double 1.000000e+00)
%76 = fdiv double %72, %75
%77 = load i64, i64* %10
%78 = sitofp i64 %77 to double
%79 = fneg double %78
%80 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %76, double %79)
%81 = load double, double* %9
%82 = fadd double %81, %80
store double %82, double* %9
br label %83
83: ; preds = %60
%84 = load i64, i64* %10
%85 = add nsw i64 %84, 1
store i64 %85, i64* %10
br label %57
86: ; preds = %57
%87 = call double (...) @dwalltime()
store double %87, double* %8
%88 = load double, double* %8
%89 = load double, double* %7
%90 = fsub double %88, %89
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), double %90)
%92 = load double, double* %8
%93 = load double, double* %7
%94 = fsub double %92, %93
%95 = fdiv double %94, 1.000000e+08
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), double %95)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [35 x i8] c" Tiempo total en segundos %.10lf \0A\00"
@.str.2 = [38 x i8] c" Tiempo promedio en segundos %.10lf \0A\00"
@str = [21 x i8] c"Funcion calculada...\00"
@str.4 = [30 x i8] c"Funcion calculada cada vez...\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%4 = tail call double (...) @dwalltime()
%5 = tail call double (...) @dwalltime()
%6 = fsub double %5, %4
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), double %6)
%8 = fdiv double %6, 1.000000e+08
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), double %8)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.4, i64 0, i64 0))
%11 = tail call double (...) @dwalltime()
%12 = tail call double (...) @dwalltime()
%13 = fsub double %12, %11
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), double %13)
%15 = fdiv double %13, 1.000000e+08
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), double %15)
ret i32 0
}