#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 */
scalar_t__ binCoeff(int, int);
double f_fup(int, int);
double pow(int, int);
double f_d_fup(double x, int n) {
  int k;
  double y, z = 0.;
  for (k = 0; k < n + 2; k++) {
    z += (double)(binCoeff(k, n + 1) - binCoeff(k - 1, n + 1)) *
         f_fup(2. * x + (double)n / 2. + 1. - (double)k, n);
  }
  return pow(2., -n + 1) * z;
}


x86 assembly (clang, -O0):
<f_d_fup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
jge    11fe <f_d_fup+0xce>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
call   1030 <binCoeff@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%edi
sub    $0x1,%edi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
call   1030 <binCoeff@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
sub    %rcx,%rax
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xe5f(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe43(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
mov    -0xc(%rbp),%esi
call   1040 <f_fup@plt>
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114f <f_d_fup+0x1f>
xor    %esi,%esi
sub    -0xc(%rbp),%esi
add    $0x1,%esi
mov    $0x2,%edi
call   1050 <pow@plt>
mulsd  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_d_fup>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%r14d
xorpd  %xmm1,%xmm1
cmp    $0xffffffff,%edi
jl     11e4 <f_d_fup+0xb4>
lea    0x1(%r14),%r15d
xorps  %xmm1,%xmm1
cvtsi2sd %r14d,%xmm1
mulsd  0xea2(%rip),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
addsd  0xe9a(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %ebx,%ebx
xorpd  %xmm1,%xmm1
nopw   0x0(%rax,%rax,1)
movsd  %xmm1,(%rsp)
mov    %ebx,%edi
mov    %r15d,%esi
call   1030 <binCoeff@plt>
mov    %rax,%rbp
lea    -0x1(%rbx),%edi
mov    %r15d,%esi
call   1030 <binCoeff@plt>
sub    %rax,%rbp
xorps  %xmm0,%xmm0
cvtsi2sd %rbp,%xmm0
movsd  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
mov    %r14d,%esi
call   1040 <f_fup@plt>
movsd  (%rsp),%xmm1
mulsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm1
lea    0x1(%rbx),%eax
cmp    %r15d,%ebx
mov    %eax,%ebx
jne    1180 <f_d_fup+0x50>
movsd  %xmm1,(%rsp)
mov    $0x1,%esi
sub    %r14d,%esi
mov    $0x2,%edi
call   1050 <pow@plt>
mulsd  (%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @f_d_fup(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca double
store double %0, double* %3
store i32 %1, i32* %4
store double 0.000000e+00, double* %7
store i32 0, i32* %5
br label %8
8: ; preds = %39, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 2
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %42
13: ; preds = %8
%14 = load i32, i32* %5
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
%17 = call i64 @binCoeff(i32 %14, i32 %16)
%18 = load i32, i32* %5
%19 = sub nsw i32 %18, 1
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
%22 = call i64 @binCoeff(i32 %19, i32 %21)
%23 = sub nsw i64 %17, %22
%24 = sitofp i64 %23 to double
%25 = load double, double* %3
%26 = load i32, i32* %4
%27 = sitofp i32 %26 to double
%28 = fdiv double %27, 2.000000e+00
%29 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %25, double %28)
%30 = fadd double %29, 1.000000e+00
%31 = load i32, i32* %5
%32 = sitofp i32 %31 to double
%33 = fsub double %30, %32
%34 = fptosi double %33 to i32
%35 = load i32, i32* %4
%36 = call double @f_fup(i32 %34, i32 %35)
%37 = load double, double* %7
%38 = call double @llvm.fmuladd.f64(double %24, double %36, double %37)
store double %38, double* %7
br label %39
39: ; preds = %13
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
br label %8
42: ; preds = %8
%43 = load i32, i32* %4
%44 = sub nsw i32 0, %43
%45 = add nsw i32 %44, 1
%46 = call double @pow(i32 2, i32 %45)
%47 = load double, double* %7
%48 = fmul double %46, %47
ret double %48
}

LLVM IR (-O2):
define double @f_d_fup(double %0, i32 %1) {
%3 = icmp sgt i32 %1, -2
br i1 %3, label %4, label %26
4: ; preds = %2
%5 = add nsw i32 %1, 1
%6 = sitofp i32 %1 to double
%7 = fmul double %6, 5.000000e-01
%8 = tail call double @llvm.fmuladd.f64(double %0, double 2.000000e+00, double %7)
%9 = fadd double %8, 1.000000e+00
%10 = add i32 %1, 1
br label %11
11: ; preds = %4, %11
%12 = phi double [ 0.000000e+00, %4 ], [ %23, %11 ]
%13 = phi i32 [ 0, %4 ], [ %24, %11 ]
%14 = tail call i64 @binCoeff(i32 %13, i32 %5)
%15 = add nsw i32 %13, -1
%16 = tail call i64 @binCoeff(i32 %15, i32 %5)
%17 = sub nsw i64 %14, %16
%18 = sitofp i64 %17 to double
%19 = sitofp i32 %13 to double
%20 = fsub double %9, %19
%21 = fptosi double %20 to i32
%22 = tail call double @f_fup(i32 %21, i32 %1)
%23 = tail call double @llvm.fmuladd.f64(double %18, double %22, double %12)
%24 = add nuw i32 %13, 1
%25 = icmp eq i32 %13, %10
br i1 %25, label %26, label %11
26: ; preds = %11, %2
%27 = phi double [ 0.000000e+00, %2 ], [ %23, %11 ]
%28 = sub i32 1, %1
%29 = tail call double @pow(i32 2, i32 %28)
%30 = fmul double %27, %29
ret double %30
}