#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 ldexp(double, double);
void waste_cpu_cycles(unsigned long long load_loops) {
  double param, result;
  double n;
  unsigned long long i;
  param = 0.95;
  n = 4;
  for (i = 0; i < load_loops; i++) {
    result = ldexp(param, (ldexp(param, ldexp(param, n))));
    result = ldexp(param, (ldexp(param, ldexp(param, n))));
    result = ldexp(param, (ldexp(param, ldexp(param, n))));
    result = ldexp(param, (ldexp(param, ldexp(param, n))));
  }
  return;
}


x86 assembly (clang, -O0):
<waste_cpu_cycles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
movsd  0xee4(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xecf(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1265 <waste_cpu_cycles+0x155>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
call   1030 <ldexp@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
call   1030 <ldexp@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
call   1030 <ldexp@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
call   1030 <ldexp@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    113e <waste_cpu_cycles+0x2e>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<waste_cpu_cycles>:
push   %rbx
test   %rdi,%rdi
je     11fe <waste_cpu_cycles+0xee>
mov    %rdi,%rbx
nopl   (%rax)
movsd  0xed8(%rip),%xmm0
movsd  0xed8(%rip),%xmm1
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  0xec0(%rip),%xmm0
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  0xeb0(%rip),%xmm0
call   1030 <ldexp@plt>
movsd  0xea3(%rip),%xmm0
movsd  0xea3(%rip),%xmm1
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  0xe8b(%rip),%xmm0
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  0xe7b(%rip),%xmm0
call   1030 <ldexp@plt>
movsd  0xe6e(%rip),%xmm0
movsd  0xe6e(%rip),%xmm1
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  0xe56(%rip),%xmm0
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  0xe46(%rip),%xmm0
call   1030 <ldexp@plt>
movsd  0xe39(%rip),%xmm0
movsd  0xe39(%rip),%xmm1
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  0xe21(%rip),%xmm0
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  0xe11(%rip),%xmm0
call   1030 <ldexp@plt>
add    $0xffffffffffffffff,%rbx
jne    1120 <waste_cpu_cycles+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @waste_cpu_cycles(i64 %0) {
%2 = alloca i64
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca i64
store i64 %0, i64* %2
store double 0x3FEE666666666666, double* %3
store double 4.000000e+00, double* %5
store i64 0, i64* %6
br label %7
7: ; preds = %40, %1
%8 = load i64, i64* %6
%9 = load i64, i64* %2
%10 = icmp ult i64 %8, %9
br i1 %10, label %11, label %43
11: ; preds = %7
%12 = load double, double* %3
%13 = load double, double* %3
%14 = load double, double* %3
%15 = load double, double* %5
%16 = call double @ldexp(double %14, double %15)
%17 = call double @ldexp(double %13, double %16)
%18 = call double @ldexp(double %12, double %17)
store double %18, double* %4
%19 = load double, double* %3
%20 = load double, double* %3
%21 = load double, double* %3
%22 = load double, double* %5
%23 = call double @ldexp(double %21, double %22)
%24 = call double @ldexp(double %20, double %23)
%25 = call double @ldexp(double %19, double %24)
store double %25, double* %4
%26 = load double, double* %3
%27 = load double, double* %3
%28 = load double, double* %3
%29 = load double, double* %5
%30 = call double @ldexp(double %28, double %29)
%31 = call double @ldexp(double %27, double %30)
%32 = call double @ldexp(double %26, double %31)
store double %32, double* %4
%33 = load double, double* %3
%34 = load double, double* %3
%35 = load double, double* %3
%36 = load double, double* %5
%37 = call double @ldexp(double %35, double %36)
%38 = call double @ldexp(double %34, double %37)
%39 = call double @ldexp(double %33, double %38)
store double %39, double* %4
br label %40
40: ; preds = %11
%41 = load i64, i64* %6
%42 = add i64 %41, 1
store i64 %42, i64* %6
br label %7
43: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @waste_cpu_cycles(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %19, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %17, %3 ], [ 0, %1 ]
%5 = tail call double @ldexp(double 0x3FEE666666666666, double 4.000000e+00)
%6 = tail call double @ldexp(double 0x3FEE666666666666, double %5)
%7 = tail call double @ldexp(double 0x3FEE666666666666, double %6)
%8 = tail call double @ldexp(double 0x3FEE666666666666, double 4.000000e+00)
%9 = tail call double @ldexp(double 0x3FEE666666666666, double %8)
%10 = tail call double @ldexp(double 0x3FEE666666666666, double %9)
%11 = tail call double @ldexp(double 0x3FEE666666666666, double 4.000000e+00)
%12 = tail call double @ldexp(double 0x3FEE666666666666, double %11)
%13 = tail call double @ldexp(double 0x3FEE666666666666, double %12)
%14 = tail call double @ldexp(double 0x3FEE666666666666, double 4.000000e+00)
%15 = tail call double @ldexp(double 0x3FEE666666666666, double %14)
%16 = tail call double @ldexp(double 0x3FEE666666666666, double %15)
%17 = add nuw i64 %4, 1
%18 = icmp eq i64 %17, %0
br i1 %18, label %19, label %3
19: ; preds = %3, %1
ret void
}