#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 get_seconds();
int /*<<< orphan*/ printf(char *, double);
double run_float_bench() {
  double secs;
  double begin = get_seconds();
  int i;
  double nb = 0;
  for (i = 0; i < 300000; i++) {
    nb *= i;
    int n = i >> 10;
    nb /= n;
  }
  double end = get_seconds();
  secs = end - begin;
  printf("Time to run float bench: %.2f[secs]\n", secs);
  return secs;
}


x86 assembly (clang, -O0):
<run_float_bench>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x0,%al
call   1030 <get_seconds@plt>
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x493e0,-0x14(%rbp)
jge    1189 <run_float_bench+0x69>
cvtsi2sdl -0x14(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
sar    $0xa,%eax
mov    %eax,-0x24(%rbp)
cvtsi2sdl -0x24(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1143 <run_float_bench+0x23>
mov    $0x0,%al
call   1030 <get_seconds@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xe50(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_float_bench>:
push   %rax
xor    %eax,%eax
call   1030 <get_seconds@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <get_seconds@plt>
subsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Time to run float bench: %.2f[secs]\0A\00"
define double @run_float_bench() {
%1 = alloca double
%2 = alloca double
%3 = alloca i32
%4 = alloca double
%5 = alloca i32
%6 = alloca double
%7 = call double (...) @get_seconds()
store double %7, double* %2
store double 0.000000e+00, double* %4
store i32 0, i32* %3
br label %8
8: ; preds = %22, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 300000
br i1 %10, label %11, label %25
11: ; preds = %8
%12 = load i32, i32* %3
%13 = sitofp i32 %12 to double
%14 = load double, double* %4
%15 = fmul double %14, %13
store double %15, double* %4
%16 = load i32, i32* %3
%17 = ashr i32 %16, 10
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = sitofp i32 %18 to double
%20 = load double, double* %4
%21 = fdiv double %20, %19
store double %21, double* %4
br label %22
22: ; preds = %11
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %8
25: ; preds = %8
%26 = call double (...) @get_seconds()
store double %26, double* %6
%27 = load double, double* %6
%28 = load double, double* %2
%29 = fsub double %27, %28
store double %29, double* %1
%30 = load double, double* %1
%31 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), double %30)
%32 = load double, double* %1
ret double %32
}

LLVM IR (-O2):
@.str = [37 x i8] c"Time to run float bench: %.2f[secs]\0A\00"
define double @run_float_bench() {
%1 = tail call double (...) @get_seconds()
%2 = tail call double (...) @get_seconds()
%3 = fsub double %2, %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), double %3)
ret double %3
}