#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 */
int M_PI;
double cos(double);
double fabs(double);
int /*<<< orphan*/ o_sinc(double);
double pow(int /*<<< orphan*/, double);
double f_Bspl(double x, double n) {
  if (fabs(x) > (n + 1.) / 2.)
    return 0.;
  double pik, y = 0.5, h = 2. * M_PI / (n + 1.);
  for (pik = h; pik <= h * 50; pik += h) {
    y += pow(o_sinc(pik / 2.), n + 1.) * cos(pik * x);
  }
  return y * 2. / (n + 1.);
}


x86 assembly (clang, -O0):
<f_Bspl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xed2(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xeae(%rip),%xmm1
addsd  -0x18(%rbp),%xmm1
movsd  0xe99(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    1182 <f_Bspl+0x52>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1271 <f_Bspl+0x141>
movsd  0xe86(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2e52(%rip),%rax
cvtsi2sdl (%rax),%xmm1
movsd  0xe5e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe5a(%rip),%xmm1
addsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  0xe45(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     124e <f_Bspl+0x11e>
movsd  -0x20(%rbp),%xmm0
movsd  0xe11(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <o_sinc@plt>
mov    %eax,%edi
movsd  0xe06(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
call   1040 <pow@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1030 <cos@plt>
movaps %xmm0,%xmm2
movsd  -0x38(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11c6 <f_Bspl+0x96>
movsd  0xdaa(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xda5(%rip),%xmm1
addsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_Bspl>:
sub    $0x48,%rsp
movapd 0xec4(%rip),%xmm3
andpd  %xmm0,%xmm3
addsd  0xec8(%rip),%xmm1
movsd  0xec8(%rip),%xmm2
mulsd  %xmm1,%xmm2
xorpd  %xmm4,%xmm4
ucomisd %xmm2,%xmm3
ja     1235 <f_Bspl+0x105>
mov    0x2e7f(%rip),%rax
xorps  %xmm2,%xmm2
cvtsi2sdl (%rax),%xmm2
addsd  %xmm2,%xmm2
divsd  %xmm1,%xmm2
movsd  0xea0(%rip),%xmm3
mulsd  %xmm2,%xmm3
movsd  %xmm2,0x8(%rsp)
ucomisd %xmm2,%xmm3
jae    119d <f_Bspl+0x6d>
movsd  0xe78(%rip),%xmm4
jmp    1231 <f_Bspl+0x101>
movsd  0xe73(%rip),%xmm4
movsd  0x8(%rsp),%xmm2
movsd  %xmm1,(%rsp)
movapd %xmm0,0x30(%rsp)
movsd  %xmm3,0x18(%rsp)
nopl   0x0(%rax)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm4,0x28(%rsp)
movapd %xmm2,%xmm0
mulsd  0xe40(%rip),%xmm0
call   1050 <o_sinc@plt>
mov    %eax,%edi
movsd  (%rsp),%xmm0
call   1040 <pow@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0x30(%rsp),%xmm0
call   1030 <cos@plt>
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
movsd  0x28(%rsp),%xmm4
mulsd  0x20(%rsp),%xmm0
addsd  %xmm0,%xmm4
addsd  0x8(%rsp),%xmm2
ucomisd %xmm2,%xmm3
jae    11c0 <f_Bspl+0x90>
addsd  %xmm4,%xmm4
movsd  (%rsp),%xmm1
divsd  %xmm1,%xmm4
movapd %xmm4,%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
@M_PI = global i32 0
define double @f_Bspl(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* %4
store double %1, double* %5
%9 = load double, double* %4
%10 = call double @llvm.fabs.f64(double %9)
%11 = load double, double* %5
%12 = fadd double %11, 1.000000e+00
%13 = fdiv double %12, 2.000000e+00
%14 = fcmp ogt double %10, %13
br i1 %14, label %15, label %16
15: ; preds = %2
store double 0.000000e+00, double* %3
br label %52
16: ; preds = %2
store double 5.000000e-01, double* %7
%17 = load i32, i32* @M_PI
%18 = sitofp i32 %17 to double
%19 = fmul double 2.000000e+00, %18
%20 = load double, double* %5
%21 = fadd double %20, 1.000000e+00
%22 = fdiv double %19, %21
store double %22, double* %8
%23 = load double, double* %8
store double %23, double* %6
br label %24
24: ; preds = %42, %16
%25 = load double, double* %6
%26 = load double, double* %8
%27 = fmul double %26, 5.000000e+01
%28 = fcmp ole double %25, %27
br i1 %28, label %29, label %46
29: ; preds = %24
%30 = load double, double* %6
%31 = fdiv double %30, 2.000000e+00
%32 = call i32 @o_sinc(double %31)
%33 = load double, double* %5
%34 = fadd double %33, 1.000000e+00
%35 = call double @pow(i32 %32, double %34)
%36 = load double, double* %6
%37 = load double, double* %4
%38 = fmul double %36, %37
%39 = call double @cos(double %38)
%40 = load double, double* %7
%41 = call double @llvm.fmuladd.f64(double %35, double %39, double %40)
store double %41, double* %7
br label %42
42: ; preds = %29
%43 = load double, double* %8
%44 = load double, double* %6
%45 = fadd double %44, %43
store double %45, double* %6
br label %24
46: ; preds = %24
%47 = load double, double* %7
%48 = fmul double %47, 2.000000e+00
%49 = load double, double* %5
%50 = fadd double %49, 1.000000e+00
%51 = fdiv double %48, %50
store double %51, double* %3
br label %52
52: ; preds = %46, %15
%53 = load double, double* %3
ret double %53
}

LLVM IR (-O2):
@M_PI = global i32 0
define double @f_Bspl(double %0, double %1) {
%3 = tail call double @llvm.fabs.f64(double %0)
%4 = fadd double %1, 1.000000e+00
%5 = fmul double %4, 5.000000e-01
%6 = fcmp ogt double %3, %5
br i1 %6, label %30, label %7
7: ; preds = %2
%8 = load i32, i32* @M_PI
%9 = sitofp i32 %8 to double
%10 = fmul double %9, 2.000000e+00
%11 = fdiv double %10, %4
%12 = fmul double %11, 5.000000e+01
%13 = fcmp ugt double %11, %12
br i1 %13, label %27, label %14
14: ; preds = %7, %14
%15 = phi double [ %22, %14 ], [ 5.000000e-01, %7 ]
%16 = phi double [ %23, %14 ], [ %11, %7 ]
%17 = fmul double %16, 5.000000e-01
%18 = tail call i32 @o_sinc(double %17)
%19 = tail call double @pow(i32 %18, double %4)
%20 = fmul double %16, %0
%21 = tail call double @cos(double %20)
%22 = tail call double @llvm.fmuladd.f64(double %19, double %21, double %15)
%23 = fadd double %11, %16
%24 = fcmp ugt double %23, %12
br i1 %24, label %25, label %14
25: ; preds = %14
%26 = fmul double %22, 2.000000e+00
br label %27
27: ; preds = %25, %7
%28 = phi double [ 1.000000e+00, %7 ], [ %26, %25 ]
%29 = fdiv double %28, %4
br label %30
30: ; preds = %2, %27
%31 = phi double [ %29, %27 ], [ 0.000000e+00, %2 ]
ret double %31
}