#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 ceil(double);
int /*<<< orphan*/ printf(char *, double, double);
double stub1(double);
double stub2(double);
void tabulate(double (*f)(double), double first, double last,
              double increment) {
  double num_invervals = ceil((last - first) / increment);
  for (double i = 0; i <= num_invervals; i += 1) {
    double x = first + i * increment;
    printf("\t%0.5f\t%0.5f\n", x, (*f)(x));
  }
}


x86 assembly (clang, -O0):
<tabulate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
call   1030 <ceil@plt>
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     11cc <tabulate+0xac>
movsd  -0x10(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsd  -0x38(%rbp),%xmm0
call   *%rax
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
lea    0xe58(%rip),%rdi
call   1040 <printf@plt>
movsd  0xe43(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    115c <tabulate+0x3c>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tabulate>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
subsd  %xmm0,%xmm1
movsd  %xmm2,0x10(%rsp)
divsd  %xmm2,%xmm1
movapd %xmm1,%xmm0
call   1030 <ceil@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11a9 <tabulate+0x89>
lea    0xeb0(%rip),%r14
movsd  %xmm0,(%rsp)
nopl   (%rax)
movsd  %xmm1,0x20(%rsp)
movapd %xmm1,%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
call   *%rbx
movapd %xmm0,%xmm1
mov    %r14,%rdi
movsd  0x18(%rsp),%xmm0
call   1040 <printf@plt>
movsd  0x20(%rsp),%xmm1
movsd  (%rsp),%xmm0
addsd  0xe5d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jae    1160 <tabulate+0x40>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c"\09%0.5f\09%0.5f\0A\00"
define void @tabulate(double (double)* %0, double %1, double %2, double %3) {
%5 = alloca double (double)*
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store double (double)* %0, double (double)** %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%12 = load double, double* %7
%13 = load double, double* %6
%14 = fsub double %12, %13
%15 = load double, double* %8
%16 = fdiv double %14, %15
%17 = call double @llvm.ceil.f64(double %16)
store double %17, double* %9
store double 0.000000e+00, double* %10
br label %18
18: ; preds = %32, %4
%19 = load double, double* %10
%20 = load double, double* %9
%21 = fcmp ole double %19, %20
br i1 %21, label %22, label %35
22: ; preds = %18
%23 = load double, double* %6
%24 = load double, double* %10
%25 = load double, double* %8
%26 = call double @llvm.fmuladd.f64(double %24, double %25, double %23)
store double %26, double* %11
%27 = load double, double* %11
%28 = load double (double)*, double (double)** %5
%29 = load double, double* %11
%30 = call double %28(double %29)
%31 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %27, double %30)
br label %32
32: ; preds = %22
%33 = load double, double* %10
%34 = fadd double %33, 1.000000e+00
store double %34, double* %10
br label %18
35: ; preds = %18
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"\09%0.5f\09%0.5f\0A\00"
define void @tabulate(double (double)* nocapture %0, double %1, double %2, double %3) {
%5 = fsub double %2, %1
%6 = fdiv double %5, %3
%7 = tail call double @llvm.ceil.f64(double %6)
%8 = fcmp ult double %7, 0.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %10, %4
ret void
10: ; preds = %4, %10
%11 = phi double [ %15, %10 ], [ 0.000000e+00, %4 ]
%12 = tail call double @llvm.fmuladd.f64(double %11, double %3, double %1)
%13 = tail call double %0(double %12)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %12, double %13)
%15 = fadd double %11, 1.000000e+00
%16 = fcmp ugt double %15, %7
br i1 %16, label %9, label %10
}