#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;
scalar_t__ calloc(int, int);
double cos(double);
double *ccof_bwbs(int n, double f1f, double f2f) {
  double alpha;
  double *ccof;
  int i, j;
  alpha = -2.0 * cos(M_PI * (f2f + f1f) / 2.0) / cos(M_PI * (f2f - f1f) / 2.0);
  ccof = (double *)calloc(2 * n + 1, sizeof(double));
  ccof[0] = 1.0;
  ccof[2] = 1.0;
  ccof[1] = alpha;
  for (i = 1; i < n; ++i) {
    ccof[2 * i + 2] += ccof[2 * i];
    for (j = 2 * i; j > 1; --j)
      ccof[j + 1] += alpha * ccof[j] + ccof[j - 1];
    ccof[2] += alpha * ccof[1] + 1.0;
    ccof[1] += alpha;
  }
  return (ccof);
}


x86 assembly (clang, -O0):
<ccof_bwbs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    0x2eac(%rip),%rax
movsd  (%rax),%xmm0
movsd  -0x18(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeb2(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xea6(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    0x2e6e(%rip),%rax
movsd  (%rax),%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe74(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x4(%rbp),%edi
shl    $0x1,%edi
add    $0x1,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsd  0xe2f(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  0xe1f(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    12e4 <ccof_bwbs+0x1c4>
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x1,-0x30(%rbp)
jle    1297 <ccof_bwbs+0x177>
movsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
jmp    123c <ccof_bwbs+0x11c>
movsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd4f(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
addsd  0x10(%rax),%xmm0
movsd  %xmm0,0x10(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rax
addsd  0x8(%rax),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11fb <ccof_bwbs+0xdb>
mov    -0x28(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ccof_bwbs>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x20(%rsp)
mov    %edi,%ebx
mov    0x2eac(%rip),%r14
addsd  %xmm1,%xmm0
mulsd  (%r14),%xmm0
mulsd  0xeb3(%rip),%xmm0
call   1040 <cos@plt>
mulsd  0xeae(%rip),%xmm0
movapd %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
mulsd  (%r14),%xmm0
mulsd  0xe88(%rip),%xmm0
call   1040 <cos@plt>
movapd (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
lea    (%rbx,%rbx,1),%edi
add    $0x1,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
movapd (%rsp),%xmm4
movabs $0x3ff0000000000000,%rcx
mov    %rcx,(%rax)
mov    %rcx,0x10(%rax)
movsd  %xmm4,0x8(%rax)
cmp    $0x2,%ebx
jl     12c3 <ccof_bwbs+0x1a3>
mov    %ebx,%r8d
mov    $0x2,%edx
mov    $0x1,%esi
mov    $0xffffffffffffffff,%r9
xor    %ebx,%ebx
movsd  0xe33(%rip),%xmm0
jmp    121b <ccof_bwbs+0xfb>
nop
movupd 0x8(%rax),%xmm1
movapd %xmm4,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movapd %xmm4,%xmm3
unpcklpd %xmm2,%xmm3
addpd  %xmm1,%xmm3
movupd %xmm3,0x8(%rax)
add    $0x1,%rsi
add    $0x2,%rdx
add    $0x1,%rbx
add    $0x2,%r9
cmp    %r8,%rsi
je     12c3 <ccof_bwbs+0x1a3>
mov    %rsi,%rdi
shl    $0x4,%rdi
movsd  (%rax,%rdi,1),%xmm1
addsd  0x10(%rax,%rdi,1),%xmm1
movsd  %xmm1,0x10(%rax,%rdi,1)
lea    0x0(,%rdx,8),%rdi
lea    -0x1(%rdx),%ecx
movsd  (%rax,%rdx,8),%xmm1
mulsd  %xmm4,%xmm1
addsd  (%rax,%rcx,8),%xmm1
or     $0x8,%rdi
addsd  (%rax,%rdi,1),%xmm1
movsd  %xmm1,(%rax,%rdi,1)
test   %rbx,%rbx
je     11e0 <ccof_bwbs+0xc0>
mov    %r9,%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0x10(%rax,%rdi,8),%xmm1
lea    0x1(%rdi),%ecx
movapd %xmm4,%xmm2
mulsd  %xmm1,%xmm2
addsd  (%rax,%rcx,8),%xmm2
addsd  0x18(%rax,%rdi,8),%xmm2
movsd  %xmm2,0x18(%rax,%rdi,8)
mov    %edi,%ecx
movsd  0x8(%rax,%rdi,8),%xmm2
mulsd  %xmm4,%xmm2
addsd  (%rax,%rcx,8),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x10(%rax,%rdi,8)
lea    -0x2(%rdi),%rcx
add    $0x2,%rdi
cmp    $0x3,%rdi
mov    %rcx,%rdi
jg     1270 <ccof_bwbs+0x150>
jmp    11e0 <ccof_bwbs+0xc0>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double* @ccof_bwbs(i32 %0, double %1, double %2) {
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %4
store double %1, double* %5
store double %2, double* %6
%11 = load double, double* @M_PI
%12 = load double, double* %6
%13 = load double, double* %5
%14 = fadd double %12, %13
%15 = fmul double %11, %14
%16 = fdiv double %15, 2.000000e+00
%17 = call double @cos(double %16)
%18 = fmul double -2.000000e+00, %17
%19 = load double, double* @M_PI
%20 = load double, double* %6
%21 = load double, double* %5
%22 = fsub double %20, %21
%23 = fmul double %19, %22
%24 = fdiv double %23, 2.000000e+00
%25 = call double @cos(double %24)
%26 = fdiv double %18, %25
store double %26, double* %7
%27 = load i32, i32* %4
%28 = mul nsw i32 2, %27
%29 = add nsw i32 %28, 1
%30 = call i64 @calloc(i32 %29, i32 8)
%31 = inttoptr i64 %30 to double*
store double* %31, double** %8
%32 = load double*, double** %8
%33 = getelementptr inbounds double, double* %32, i64 0
store double 1.000000e+00, double* %33
%34 = load double*, double** %8
%35 = getelementptr inbounds double, double* %34, i64 2
store double 1.000000e+00, double* %35
%36 = load double, double* %7
%37 = load double*, double** %8
%38 = getelementptr inbounds double, double* %37, i64 1
store double %36, double* %38
store i32 1, i32* %9
br label %39
39: ; preds = %102, %3
%40 = load i32, i32* %9
%41 = load i32, i32* %4
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %105
43: ; preds = %39
%44 = load double*, double** %8
%45 = load i32, i32* %9
%46 = mul nsw i32 2, %45
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double, double* %44, i64 %47
%49 = load double, double* %48
%50 = load double*, double** %8
%51 = load i32, i32* %9
%52 = mul nsw i32 2, %51
%53 = add nsw i32 %52, 2
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %50, i64 %54
%56 = load double, double* %55
%57 = fadd double %56, %49
store double %57, double* %55
%58 = load i32, i32* %9
%59 = mul nsw i32 2, %58
store i32 %59, i32* %10
br label %60
60: ; preds = %84, %43
%61 = load i32, i32* %10
%62 = icmp sgt i32 %61, 1
br i1 %62, label %63, label %87
63: ; preds = %60
%64 = load double, double* %7
%65 = load double*, double** %8
%66 = load i32, i32* %10
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds double, double* %65, i64 %67
%69 = load double, double* %68
%70 = load double*, double** %8
%71 = load i32, i32* %10
%72 = sub nsw i32 %71, 1
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %70, i64 %73
%75 = load double, double* %74
%76 = call double @llvm.fmuladd.f64(double %64, double %69, double %75)
%77 = load double*, double** %8
%78 = load i32, i32* %10
%79 = add nsw i32 %78, 1
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds double, double* %77, i64 %80
%82 = load double, double* %81
%83 = fadd double %82, %76
store double %83, double* %81
br label %84
84: ; preds = %63
%85 = load i32, i32* %10
%86 = add nsw i32 %85, -1
store i32 %86, i32* %10
br label %60
87: ; preds = %60
%88 = load double, double* %7
%89 = load double*, double** %8
%90 = getelementptr inbounds double, double* %89, i64 1
%91 = load double, double* %90
%92 = call double @llvm.fmuladd.f64(double %88, double %91, double 1.000000e+00)
%93 = load double*, double** %8
%94 = getelementptr inbounds double, double* %93, i64 2
%95 = load double, double* %94
%96 = fadd double %95, %92
store double %96, double* %94
%97 = load double, double* %7
%98 = load double*, double** %8
%99 = getelementptr inbounds double, double* %98, i64 1
%100 = load double, double* %99
%101 = fadd double %100, %97
store double %101, double* %99
br label %102
102: ; preds = %87
%103 = load i32, i32* %9
%104 = add nsw i32 %103, 1
store i32 %104, i32* %9
br label %39
105: ; preds = %39
%106 = load double*, double** %8
ret double* %106
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double* @ccof_bwbs(i32 %0, double %1, double %2) {
%4 = load double, double* @M_PI
%5 = fadd double %1, %2
%6 = fmul double %5, %4
%7 = fmul double %6, 5.000000e-01
%8 = tail call double @cos(double %7)
%9 = fmul double %8, -2.000000e+00
%10 = load double, double* @M_PI
%11 = fsub double %2, %1
%12 = fmul double %11, %10
%13 = fmul double %12, 5.000000e-01
%14 = tail call double @cos(double %13)
%15 = fdiv double %9, %14
%16 = shl nsw i32 %0, 1
%17 = or i32 %16, 1
%18 = tail call i64 @calloc(i32 %17, i32 8)
%19 = inttoptr i64 %18 to double*
store double 1.000000e+00, double* %19
%20 = getelementptr inbounds double, double* %19, i64 2
store double 1.000000e+00, double* %20
%21 = getelementptr inbounds double, double* %19, i64 1
store double %15, double* %21
%22 = icmp sgt i32 %0, 1
br i1 %22, label %23, label %85
23: ; preds = %3
%24 = zext i32 %0 to i64
%25 = insertelement <2 x double> poison, double %15, i64 0
%26 = bitcast double* %21 to <2 x double>*
%27 = bitcast double* %21 to <2 x double>*
br label %28
28: ; preds = %75, %23
%29 = phi i64 [ %84, %75 ], [ 0, %23 ]
%30 = phi i64 [ %81, %75 ], [ 1, %23 ]
%31 = phi i64 [ %82, %75 ], [ 2, %23 ]
%32 = shl nuw nsw i64 %30, 1
%33 = getelementptr inbounds double, double* %19, i64 %32
%34 = load double, double* %33
%35 = add nuw nsw i64 %32, 2
%36 = getelementptr inbounds double, double* %19, i64 %35
%37 = load double, double* %36
%38 = fadd double %34, %37
store double %38, double* %36
%39 = getelementptr inbounds double, double* %19, i64 %31
%40 = load double, double* %39
%41 = add nsw i64 %31, -1
%42 = and i64 %41, 4294967295
%43 = getelementptr inbounds double, double* %19, i64 %42
%44 = load double, double* %43
%45 = tail call double @llvm.fmuladd.f64(double %15, double %40, double %44)
%46 = or i64 %31, 1
%47 = getelementptr inbounds double, double* %19, i64 %46
%48 = load double, double* %47
%49 = fadd double %48, %45
store double %49, double* %47
%50 = icmp eq i64 %29, 0
br i1 %50, label %75, label %51
51: ; preds = %28, %51
%52 = phi i64 [ %66, %51 ], [ %41, %28 ]
%53 = getelementptr inbounds double, double* %19, i64 %52
%54 = load double, double* %53
%55 = add nsw i64 %52, -1
%56 = and i64 %55, 4294967295
%57 = getelementptr inbounds double, double* %19, i64 %56
%58 = load double, double* %57
%59 = tail call double @llvm.fmuladd.f64(double %15, double %54, double %58)
%60 = add nuw nsw i64 %52, 1
%61 = getelementptr inbounds double, double* %19, i64 %60
%62 = load double, double* %61
%63 = fadd double %62, %59
store double %63, double* %61
%64 = getelementptr inbounds double, double* %19, i64 %55
%65 = load double, double* %64
%66 = add nsw i64 %52, -2
%67 = and i64 %66, 4294967295
%68 = getelementptr inbounds double, double* %19, i64 %67
%69 = load double, double* %68
%70 = tail call double @llvm.fmuladd.f64(double %15, double %65, double %69)
%71 = getelementptr inbounds double, double* %19, i64 %52
%72 = load double, double* %71
%73 = fadd double %72, %70
store double %73, double* %71
%74 = icmp sgt i64 %52, 3
br i1 %74, label %51, label %75
75: ; preds = %51, %28
%76 = load <2 x double>, <2 x double>* %26
%77 = extractelement <2 x double> %76, i64 0
%78 = tail call double @llvm.fmuladd.f64(double %15, double %77, double 1.000000e+00)
%79 = insertelement <2 x double> %25, double %78, i64 1
%80 = fadd <2 x double> %79, %76
store <2 x double> %80, <2 x double>* %27
%81 = add nuw nsw i64 %30, 1
%82 = add nuw nsw i64 %31, 2
%83 = icmp eq i64 %81, %24
%84 = add i64 %29, 1
br i1 %83, label %85, label %28
85: ; preds = %75, %3
ret double* %19
}