#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 M_PI;
double cos(double);
double pow(double, int);
double sin(double);
double sf_bwlp(int n, double fcf) {
  int m, k;
  double omega;
  double fomega;
  double parg0;
  double sf;
  omega = M_PI * fcf;
  fomega = sin(omega);
  parg0 = M_PI / (double)(2 * n);
  m = n / 2;
  sf = 1.0;
  for (k = 0; k < n / 2; ++k)
    sf *= 1.0 + fomega * sin((double)(2 * k + 1) * parg0);
  fomega = sin(omega / 2.0);
  if (n % 2)
    sf *= fomega + cos(omega / 2.0);
  sf = pow(fomega, n) / sf;
  return (sf);
}


x86 assembly (clang, -O0):
<sf_bwlp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    0x2ea1(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x28(%rbp)
mov    0x2e7d(%rip),%rax
movsd  (%rax),%xmm0
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
movsd  0xe68(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
cmp    %ecx,%eax
jge    1213 <sf_bwlp+0xe3>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x30(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe09(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a4 <sf_bwlp+0x74>
movsd  -0x20(%rbp),%xmm0
movsd  0xde8(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1278 <sf_bwlp+0x148>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xdaf(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x4(%rbp),%edi
call   1050 <pow@plt>
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sf_bwlp>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %edi,%r14d
mov    0x2ea4(%rip),%rbx
mulsd  (%rbx),%xmm0
movsd  %xmm0,0x18(%rsp)
call   1030 <sin@plt>
cmp    $0x2,%r14d
jl     119b <sf_bwlp+0x6b>
movsd  %xmm0,0x10(%rsp)
movsd  (%rbx),%xmm2
lea    (%r14,%r14,1),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  %xmm0,%xmm2
mov    %r14d,%r15d
shr    $0x1f,%r15d
add    %r14d,%r15d
sar    %r15d
mov    %r14d,%eax
and    $0xfffffffe,%eax
cmp    $0x2,%eax
jne    11a8 <sf_bwlp+0x78>
movsd  0xe6e(%rip),%xmm0
movapd %xmm0,%xmm1
jmp    1249 <sf_bwlp+0x119>
movsd  0xe5d(%rip),%xmm0
jmp    127e <sf_bwlp+0x14e>
mov    %r15d,%ebp
and    $0xfffffffe,%ebp
movsd  0xe4a(%rip),%xmm0
mov    $0x3,%ebx
movsd  %xmm2,0x20(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
lea    -0x2(%rbx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  %xmm2,%xmm0
call   1030 <sin@plt>
movapd %xmm0,%xmm1
mulsd  0x10(%rsp),%xmm1
movsd  0xe05(%rip),%xmm0
addsd  %xmm0,%xmm1
mulsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  0x20(%rsp),%xmm0
call   1030 <sin@plt>
movsd  0x20(%rsp),%xmm2
mulsd  0x10(%rsp),%xmm0
addsd  0xdcf(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
add    $0x4,%ebx
add    $0xfffffffe,%ebp
jne    11d0 <sf_bwlp+0xa0>
add    $0xfffffffe,%ebx
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
movsd  %xmm0,0x8(%rsp)
test   $0x1,%r15b
je     1284 <sf_bwlp+0x154>
mulsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
call   1030 <sin@plt>
movsd  0x10(%rsp),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xd8c(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
mulsd  0xd76(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
call   1030 <sin@plt>
movapd %xmm0,%xmm2
test   $0x1,%r14b
je     12d6 <sf_bwlp+0x1a6>
movsd  0x18(%rsp),%xmm0
movsd  %xmm2,0x10(%rsp)
call   1040 <cos@plt>
movsd  0x10(%rsp),%xmm2
movapd %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movapd %xmm2,%xmm0
mov    %r14d,%edi
call   1050 <pow@plt>
divsd  0x8(%rsp),%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @sf_bwlp(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
%11 = load double, double* @M_PI
%12 = load double, double* %4
%13 = fmul double %11, %12
store double %13, double* %7
%14 = load double, double* %7
%15 = call double @sin(double %14)
store double %15, double* %8
%16 = load double, double* @M_PI
%17 = load i32, i32* %3
%18 = mul nsw i32 2, %17
%19 = sitofp i32 %18 to double
%20 = fdiv double %16, %19
store double %20, double* %9
%21 = load i32, i32* %3
%22 = sdiv i32 %21, 2
store i32 %22, i32* %5
store double 1.000000e+00, double* %10
store i32 0, i32* %6
br label %23
23: ; preds = %40, %2
%24 = load i32, i32* %6
%25 = load i32, i32* %3
%26 = sdiv i32 %25, 2
%27 = icmp slt i32 %24, %26
br i1 %27, label %28, label %43
28: ; preds = %23
%29 = load double, double* %8
%30 = load i32, i32* %6
%31 = mul nsw i32 2, %30
%32 = add nsw i32 %31, 1
%33 = sitofp i32 %32 to double
%34 = load double, double* %9
%35 = fmul double %33, %34
%36 = call double @sin(double %35)
%37 = call double @llvm.fmuladd.f64(double %29, double %36, double 1.000000e+00)
%38 = load double, double* %10
%39 = fmul double %38, %37
store double %39, double* %10
br label %40
40: ; preds = %28
%41 = load i32, i32* %6
%42 = add nsw i32 %41, 1
store i32 %42, i32* %6
br label %23
43: ; preds = %23
%44 = load double, double* %7
%45 = fdiv double %44, 2.000000e+00
%46 = call double @sin(double %45)
store double %46, double* %8
%47 = load i32, i32* %3
%48 = srem i32 %47, 2
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %58
50: ; preds = %43
%51 = load double, double* %8
%52 = load double, double* %7
%53 = fdiv double %52, 2.000000e+00
%54 = call double @cos(double %53)
%55 = fadd double %51, %54
%56 = load double, double* %10
%57 = fmul double %56, %55
store double %57, double* %10
br label %58
58: ; preds = %50, %43
%59 = load double, double* %8
%60 = load i32, i32* %3
%61 = call double @pow(double %59, i32 %60)
%62 = load double, double* %10
%63 = fdiv double %61, %62
store double %63, double* %10
%64 = load double, double* %10
ret double %64
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @sf_bwlp(i32 %0, double %1) {
%3 = load double, double* @M_PI
%4 = fmul double %3, %1
%5 = tail call double @sin(double %4)
%6 = load double, double* @M_PI
%7 = shl nsw i32 %0, 1
%8 = sitofp i32 %7 to double
%9 = fdiv double %6, %8
%10 = sdiv i32 %0, 2
%11 = icmp sgt i32 %0, 1
br i1 %11, label %12, label %53
12: ; preds = %2
%13 = and i32 %10, 1
%14 = and i32 %0, -2
%15 = icmp eq i32 %14, 2
br i1 %15, label %43, label %16
16: ; preds = %12
%17 = and i32 %10, -2
br label %18
18: ; preds = %18, %16
%19 = phi double [ 1.000000e+00, %16 ], [ %35, %18 ]
%20 = phi i32 [ 0, %16 ], [ %36, %18 ]
%21 = phi i32 [ 0, %16 ], [ %37, %18 ]
%22 = shl nuw nsw i32 %20, 1
%23 = or i32 %22, 1
%24 = sitofp i32 %23 to double
%25 = fmul double %9, %24
%26 = tail call double @sin(double %25)
%27 = tail call double @llvm.fmuladd.f64(double %5, double %26, double 1.000000e+00)
%28 = fmul double %19, %27
%29 = shl nuw i32 %20, 1
%30 = or i32 %29, 3
%31 = sitofp i32 %30 to double
%32 = fmul double %9, %31
%33 = tail call double @sin(double %32)
%34 = tail call double @llvm.fmuladd.f64(double %5, double %33, double 1.000000e+00)
%35 = fmul double %28, %34
%36 = add nuw nsw i32 %20, 2
%37 = add i32 %21, 2
%38 = icmp eq i32 %37, %17
br i1 %38, label %39, label %18
39: ; preds = %18
%40 = shl nuw i32 %36, 1
%41 = or i32 %40, 1
%42 = sitofp i32 %41 to double
br label %43
43: ; preds = %39, %12
%44 = phi double [ undef, %12 ], [ %35, %39 ]
%45 = phi double [ 1.000000e+00, %12 ], [ %35, %39 ]
%46 = phi double [ 1.000000e+00, %12 ], [ %42, %39 ]
%47 = icmp eq i32 %13, 0
br i1 %47, label %53, label %48
48: ; preds = %43
%49 = fmul double %9, %46
%50 = tail call double @sin(double %49)
%51 = tail call double @llvm.fmuladd.f64(double %5, double %50, double 1.000000e+00)
%52 = fmul double %45, %51
br label %53
53: ; preds = %48, %43, %2
%54 = phi double [ 1.000000e+00, %2 ], [ %44, %43 ], [ %52, %48 ]
%55 = fmul double %4, 5.000000e-01
%56 = tail call double @sin(double %55)
%57 = and i32 %0, 1
%58 = icmp eq i32 %57, 0
br i1 %58, label %63, label %59
59: ; preds = %53
%60 = tail call double @cos(double %55)
%61 = fadd double %56, %60
%62 = fmul double %54, %61
br label %63
63: ; preds = %59, %53
%64 = phi double [ %62, %59 ], [ %54, %53 ]
%65 = tail call double @pow(double %56, i32 %0)
%66 = fdiv double %65, %64
ret double %66
}