#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 _f(double);
double diff4(double x, double h) {
  double f1, f2, f3, f4;
  f1 = _f(x + h) - _f(x);
  f2 = _f(x + 2. * h) - _f(x);
  f3 = _f(x + 3. * h) - _f(x);
  f4 = _f(x + 4. * h) - _f(x);
  return (4. * f1 - 3. * f2 + 4. * f3 / 3. - 0.25 * f4) / h;
}


x86 assembly (clang, -O0):
<diff4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
call   1030 <_f@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <_f@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1030 <_f@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <_f@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  0xe6e(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <_f@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <_f@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  0xe37(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <_f@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <_f@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  0xdf5(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xdd9(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xdc9(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xdb4(%rip),%xmm2
divsd  %xmm2,%xmm0
addsd  %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  0xd97(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x10(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diff4>:
sub    $0x38,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
addsd  %xmm1,%xmm0
call   1030 <_f@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <_f@plt>
movsd  0x28(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x28(%rsp)
movsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm0
addsd  0x8(%rsp),%xmm0
call   1030 <_f@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <_f@plt>
movsd  0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xe72(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
call   1030 <_f@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <_f@plt>
movsd  0x18(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xe40(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
call   1030 <_f@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <_f@plt>
movsd  0x30(%rsp),%xmm3
subsd  %xmm0,%xmm3
movsd  0x20(%rsp),%xmm1
mulsd  0xe14(%rip),%xmm1
movsd  0x28(%rsp),%xmm0
movsd  0xdfe(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  %xmm2,%xmm1
divsd  0xddc(%rip),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm3,%xmm0
mulsd  0xde4(%rip),%xmm0
addsd  %xmm1,%xmm0
divsd  0x10(%rsp),%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @diff4(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %3
store double %1, double* %4
%9 = load double, double* %3
%10 = load double, double* %4
%11 = fadd double %9, %10
%12 = call double @_f(double %11)
%13 = load double, double* %3
%14 = call double @_f(double %13)
%15 = fsub double %12, %14
store double %15, double* %5
%16 = load double, double* %3
%17 = load double, double* %4
%18 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %17, double %16)
%19 = call double @_f(double %18)
%20 = load double, double* %3
%21 = call double @_f(double %20)
%22 = fsub double %19, %21
store double %22, double* %6
%23 = load double, double* %3
%24 = load double, double* %4
%25 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %24, double %23)
%26 = call double @_f(double %25)
%27 = load double, double* %3
%28 = call double @_f(double %27)
%29 = fsub double %26, %28
store double %29, double* %7
%30 = load double, double* %3
%31 = load double, double* %4
%32 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %31, double %30)
%33 = call double @_f(double %32)
%34 = load double, double* %3
%35 = call double @_f(double %34)
%36 = fsub double %33, %35
store double %36, double* %8
%37 = load double, double* %5
%38 = load double, double* %6
%39 = fmul double 3.000000e+00, %38
%40 = fneg double %39
%41 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %37, double %40)
%42 = load double, double* %7
%43 = fmul double 4.000000e+00, %42
%44 = fdiv double %43, 3.000000e+00
%45 = fadd double %41, %44
%46 = load double, double* %8
%47 = call double @llvm.fmuladd.f64(double -2.500000e-01, double %46, double %45)
%48 = load double, double* %4
%49 = fdiv double %47, %48
ret double %49
}

LLVM IR (-O2):
define double @diff4(double %0, double %1) {
%3 = fadd double %0, %1
%4 = tail call double @_f(double %3)
%5 = tail call double @_f(double %0)
%6 = fsub double %4, %5
%7 = tail call double @llvm.fmuladd.f64(double %1, double 2.000000e+00, double %0)
%8 = tail call double @_f(double %7)
%9 = tail call double @_f(double %0)
%10 = fsub double %8, %9
%11 = tail call double @llvm.fmuladd.f64(double %1, double 3.000000e+00, double %0)
%12 = tail call double @_f(double %11)
%13 = tail call double @_f(double %0)
%14 = fsub double %12, %13
%15 = tail call double @llvm.fmuladd.f64(double %1, double 4.000000e+00, double %0)
%16 = tail call double @_f(double %15)
%17 = tail call double @_f(double %0)
%18 = fsub double %16, %17
%19 = fmul double %10, -3.000000e+00
%20 = tail call double @llvm.fmuladd.f64(double %6, double 4.000000e+00, double %19)
%21 = fmul double %14, 4.000000e+00
%22 = fdiv double %21, 3.000000e+00
%23 = fadd double %20, %22
%24 = tail call double @llvm.fmuladd.f64(double %18, double -2.500000e-01, double %23)
%25 = fdiv double %24, %1
ret double %25
}