#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 = 1000, y1 = 5, y2 = 0.2;
  double timetick, timeend;
  double resultado1, resultado2;
  long long int i;
  printf("Division...\n");
  timetick = dwalltime();
  for (i = 0; i < 1000000000; i++) {
    resultado1 = x / y1;
  }
  timeend = dwalltime();
  printf(" Tiempo total en segundos %.10lf \n", (timeend - timetick));
  printf(" Tiempo promedio en segundos %.10lf \n",
         (timeend - timetick) / 1000000000);
  printf("Producto...\n");
  timetick = dwalltime();
  for (i = 0; i < 1000000000; i++) {
    resultado2 = x * y2;
  }
  timeend = dwalltime();
  printf(" Tiempo total en segundos %.10lf \n", (timeend - timetick));
  printf(" Tiempo promedio en segundos %.10lf \n",
         (timeend - timetick) / 1000000000);
  if (resultado1 != resultado2) {
    printf("Error en resultado: %f <> %f \n", resultado1, resultado2);
  } else {
    printf("Resultado correcto\n");
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xed2(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xea8(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <dwalltime@plt>
movsd  %xmm0,-0x30(%rbp)
movq   $0x0,-0x50(%rbp)
cmpq   $0x3b9aca00,-0x50(%rbp)
3b
jge    11ad <main+0x8d>
movsd  -0x18(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    117f <main+0x5f>
mov    $0x0,%al
call   1040 <dwalltime@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
lea    0xe63(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x38(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  0xe35(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe62(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <dwalltime@plt>
movsd  %xmm0,-0x30(%rbp)
movq   $0x0,-0x50(%rbp)
cmpq   $0x3b9aca00,-0x50(%rbp)
3b
jge    1245 <main+0x125>
movsd  -0x18(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    1217 <main+0xf7>
mov    $0x0,%al
call   1040 <dwalltime@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
lea    0xdcb(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x38(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  0xd9d(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xdca(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x40(%rbp),%xmm0
ucomisd -0x48(%rbp),%xmm0
jne    12a8 <main+0x188>
jp     12a8 <main+0x188>
jmp    12c5 <main+0x1a5>
movsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
lea    0xdca(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    12d3 <main+0x1b3>
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%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    0xeca(%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>
lea    0xe8c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Division...\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 = [13 x i8] c"Producto...\0A\00"
@.str.4 = [31 x i8] c"Error en resultado: %f <> %f \0A\00"
@.str.5 = [20 x i8] c"Resultado correcto\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 double
%11 = alloca double
%12 = alloca double
%13 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 1.000000e+03, double* %6
store double 5.000000e+00, double* %7
store double 2.000000e-01, double* %8
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%15 = call double (...) @dwalltime()
store double %15, double* %9
store i64 0, i64* %13
br label %16
16: ; preds = %23, %2
%17 = load i64, i64* %13
%18 = icmp slt i64 %17, 1000000000
br i1 %18, label %19, label %26
19: ; preds = %16
%20 = load double, double* %6
%21 = load double, double* %7
%22 = fdiv double %20, %21
store double %22, double* %11
br label %23
23: ; preds = %19
%24 = load i64, i64* %13
%25 = add nsw i64 %24, 1
store i64 %25, i64* %13
br label %16
26: ; preds = %16
%27 = call double (...) @dwalltime()
store double %27, double* %10
%28 = load double, double* %10
%29 = load double, double* %9
%30 = fsub double %28, %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), double %30)
%32 = load double, double* %10
%33 = load double, double* %9
%34 = fsub double %32, %33
%35 = fdiv double %34, 1.000000e+09
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), double %35)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%38 = call double (...) @dwalltime()
store double %38, double* %9
store i64 0, i64* %13
br label %39
39: ; preds = %46, %26
%40 = load i64, i64* %13
%41 = icmp slt i64 %40, 1000000000
br i1 %41, label %42, label %49
42: ; preds = %39
%43 = load double, double* %6
%44 = load double, double* %8
%45 = fmul double %43, %44
store double %45, double* %12
br label %46
46: ; preds = %42
%47 = load i64, i64* %13
%48 = add nsw i64 %47, 1
store i64 %48, i64* %13
br label %39
49: ; preds = %39
%50 = call double (...) @dwalltime()
store double %50, double* %10
%51 = load double, double* %10
%52 = load double, double* %9
%53 = fsub double %51, %52
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), double %53)
%55 = load double, double* %10
%56 = load double, double* %9
%57 = fsub double %55, %56
%58 = fdiv double %57, 1.000000e+09
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), double %58)
%60 = load double, double* %11
%61 = load double, double* %12
%62 = fcmp une double %60, %61
br i1 %62, label %63, label %67
63: ; preds = %49
%64 = load double, double* %11
%65 = load double, double* %12
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), double %64, double %65)
br label %69
67: ; preds = %49
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %69
69: ; preds = %67, %63
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 = [12 x i8] c"Division...\00"
@str.6 = [12 x i8] c"Producto...\00"
@str.7 = [19 x i8] c"Resultado correcto\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 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+09
%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 ([12 x i8], [12 x i8]* @str.6, 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+09
%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)
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.7, i64 0, i64 0))
ret i32 0
}