#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 */
typedef double f1;
typedef double f0;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, long, double, double, int);
void print_timings(double (*f0)(size_t), double (*f1)(size_t), size_t min_n,
                   size_t max_n) {
  size_t n;
  double f0_n, f1_n;
  for (n = min_n; n < max_n; n++) {
    f0_n = (f0)(n);
    f1_n = (f1)(n);
    printf("n=%2ld: %8.2f %8.2f (f%d)\n", (long)n, f0_n, f1_n,
           (f0_n <= f1_n) ? 1 : 0);
  }
}


x86 assembly (clang, -O0):
<print_timings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    119f <print_timings+0x8f>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rdi
call   *%rax
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rdi
call   *%rax
movsd  %xmm0,-0x38(%rbp)
mov    -0x28(%rbp),%rsi
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm2
xor    %edx,%edx
mov    $0x1,%eax
ucomisd %xmm3,%xmm2
cmovae %eax,%edx
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1130 <print_timings+0x20>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_timings>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
cmp    %rcx,%rdx
jae    1179 <print_timings+0x69>
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xecb(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   *%r12
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   *%r15
movapd %xmm0,%xmm1
xor    %edx,%edx
movsd  0x8(%rsp),%xmm0
ucomisd %xmm0,%xmm1
setae  %dl
mov    %r13,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1140 <print_timings+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [27 x i8] c"n=%2ld: %8.2f %8.2f (f%d)\0A\00"
define void @print_timings(double (i64)* %0, double (i64)* %1, i64 %2, i64 %3) {
%5 = alloca double (i64)*
%6 = alloca double (i64)*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca double
%11 = alloca double
store double (i64)* %0, double (i64)** %5
store double (i64)* %1, double (i64)** %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%12 = load i64, i64* %7
store i64 %12, i64* %9
br label %13
13: ; preds = %33, %4
%14 = load i64, i64* %9
%15 = load i64, i64* %8
%16 = icmp ult i64 %14, %15
br i1 %16, label %17, label %36
17: ; preds = %13
%18 = load double (i64)*, double (i64)** %5
%19 = load i64, i64* %9
%20 = call double %18(i64 %19)
store double %20, double* %10
%21 = load double (i64)*, double (i64)** %6
%22 = load i64, i64* %9
%23 = call double %21(i64 %22)
store double %23, double* %11
%24 = load i64, i64* %9
%25 = load double, double* %10
%26 = load double, double* %11
%27 = load double, double* %10
%28 = load double, double* %11
%29 = fcmp ole double %27, %28
%30 = zext i1 %29 to i64
%31 = select i1 %29, i32 1, i32 0
%32 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 %24, double %25, double %26, i32 %31)
br label %33
33: ; preds = %17
%34 = load i64, i64* %9
%35 = add i64 %34, 1
store i64 %35, i64* %9
br label %13
36: ; preds = %13
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"n=%2ld: %8.2f %8.2f (f%d)\0A\00"
define void @print_timings(double (i64)* nocapture %0, double (i64)* nocapture %1, i64 %2, i64 %3) {
%5 = icmp ult i64 %2, %3
br i1 %5, label %6, label %15
6: ; preds = %4, %6
%7 = phi i64 [ %13, %6 ], [ %2, %4 ]
%8 = tail call double %0(i64 %7)
%9 = tail call double %1(i64 %7)
%10 = fcmp ole double %8, %9
%11 = zext i1 %10 to i32
%12 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 %7, double %8, double %9, i32 %11)
%13 = add i64 %7, 1
%14 = icmp eq i64 %13, %3
br i1 %14, label %15, label %6
15: ; preds = %6, %4
ret void
}