#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 const sin(double const);
int /*<<< orphan*/ window(float *, size_t, int, float);
void xfir_gen_bandstop(float taps[], size_t n_taps, float low_freq,
                       float high_freq, int win_type, float alpha) {
  const double tlf = 2.0 * low_freq;
  const double thf = 2.0 * high_freq;
  double n = -0.5 * (n_taps - 1);
  size_t i;
  for (i = 0; i < n_taps; i++) {
    const double x = (3.14159265358979323846) * n;
    taps[i] = (sin(x) - (sin(thf * x) - sin(tlf * x))) / x;
    n += 1.0;
  }
  if (n_taps & 1) {
    taps[(n_taps - 1) / 2] = 1.0 - (2.0 * (high_freq - low_freq));
  }
  window(taps, n_taps, win_type, alpha);
}


x86 assembly (clang, -O0):
<xfir_gen_bandstop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  %xmm1,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movss  %xmm2,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
movq   %rax,%xmm1
movaps 0xea6(%rip),%xmm0
punpckldq %xmm0,%xmm1
movapd 0xeaa(%rip),%xmm0
subpd  %xmm0,%xmm1
movaps %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe63(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    124e <xfir_gen_bandstop+0x12e>
movsd  0xe4c(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x58(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
subsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
divsd  -0x48(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x40(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movsd  0xdd5(%rip),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    11ae <xfir_gen_bandstop+0x8e>
mov    -0x10(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     1297 <xfir_gen_bandstop+0x177>
movss  -0x18(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
addsd  %xmm1,%xmm1
movsd  0xd8e(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
shr    $0x1,%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
movss  -0x20(%rbp),%xmm0
call   1040 <window@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xfir_gen_bandstop>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x50,%rsp
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%r12
mov    %rsi,%r15
sub    $0x1,%r15
jb     1266 <xfir_gen_bandstop+0x146>
movss  %xmm2,0x1c(%rsp)
movss  %xmm0,0x14(%rsp)
cvtss2sd %xmm0,%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
movss  %xmm1,0x18(%rsp)
cvtss2sd %xmm1,%xmm1
movq   %r15,%xmm0
punpckldq 0xe8d(%rip),%xmm0
subpd  0xe95(%rip),%xmm0
movapd %xmm0,%xmm2
unpckhpd %xmm0,%xmm2
addsd  %xmm0,%xmm2
mulsd  0xe91(%rip),%xmm2
addsd  %xmm1,%xmm1
movsd  %xmm1,0x20(%rsp)
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movapd %xmm2,0x40(%rsp)
movapd %xmm2,%xmm0
mulsd  0xe76(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1030 <sin@plt>
movsd  %xmm0,0x38(%rsp)
movsd  0x20(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x28(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movapd 0x40(%rsp),%xmm2
movsd  0xe37(%rip),%xmm3
movsd  0x30(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x38(%rsp),%xmm0
subsd  %xmm1,%xmm0
divsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%r12,%rbp,4)
addsd  %xmm3,%xmm2
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11a0 <xfir_gen_bandstop+0x80>
test   $0x1,%bl
movss  0x1c(%rsp),%xmm2
movss  0x18(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
je     1266 <xfir_gen_bandstop+0x146>
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
addsd  %xmm0,%xmm0
subsd  %xmm0,%xmm3
xorps  %xmm0,%xmm0
cvtsd2ss %xmm3,%xmm0
and    $0xfffffffffffffffe,%r15
movss  %xmm0,(%r12,%r15,2)
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
movaps %xmm2,%xmm0
add    $0x50,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <window@plt>

LLVM IR (-O0):
define void @xfir_gen_bandstop(float* %0, i64 %1, float %2, float %3, i32 %4, float %5) {
%7 = alloca float*
%8 = alloca i64
%9 = alloca float
%10 = alloca float
%11 = alloca i32
%12 = alloca float
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca i64
%17 = alloca double
store float* %0, float** %7
store i64 %1, i64* %8
store float %2, float* %9
store float %3, float* %10
store i32 %4, i32* %11
store float %5, float* %12
%18 = load float, float* %9
%19 = fpext float %18 to double
%20 = fmul double 2.000000e+00, %19
store double %20, double* %13
%21 = load float, float* %10
%22 = fpext float %21 to double
%23 = fmul double 2.000000e+00, %22
store double %23, double* %14
%24 = load i64, i64* %8
%25 = sub i64 %24, 1
%26 = uitofp i64 %25 to double
%27 = fmul double -5.000000e-01, %26
store double %27, double* %15
store i64 0, i64* %16
br label %28
28: ; preds = %55, %6
%29 = load i64, i64* %16
%30 = load i64, i64* %8
%31 = icmp ult i64 %29, %30
br i1 %31, label %32, label %58
32: ; preds = %28
%33 = load double, double* %15
%34 = fmul double 0x400921FB54442D18, %33
store double %34, double* %17
%35 = load double, double* %17
%36 = call double @sin(double %35)
%37 = load double, double* %14
%38 = load double, double* %17
%39 = fmul double %37, %38
%40 = call double @sin(double %39)
%41 = load double, double* %13
%42 = load double, double* %17
%43 = fmul double %41, %42
%44 = call double @sin(double %43)
%45 = fsub double %40, %44
%46 = fsub double %36, %45
%47 = load double, double* %17
%48 = fdiv double %46, %47
%49 = fptrunc double %48 to float
%50 = load float*, float** %7
%51 = load i64, i64* %16
%52 = getelementptr inbounds float, float* %50, i64 %51
store float %49, float* %52
%53 = load double, double* %15
%54 = fadd double %53, 1.000000e+00
store double %54, double* %15
br label %55
55: ; preds = %32
%56 = load i64, i64* %16
%57 = add i64 %56, 1
store i64 %57, i64* %16
br label %28
58: ; preds = %28
%59 = load i64, i64* %8
%60 = and i64 %59, 1
%61 = icmp ne i64 %60, 0
br i1 %61, label %62, label %74
62: ; preds = %58
%63 = load float, float* %10
%64 = load float, float* %9
%65 = fsub float %63, %64
%66 = fpext float %65 to double
%67 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %66, double 1.000000e+00)
%68 = fptrunc double %67 to float
%69 = load float*, float** %7
%70 = load i64, i64* %8
%71 = sub i64 %70, 1
%72 = udiv i64 %71, 2
%73 = getelementptr inbounds float, float* %69, i64 %72
store float %68, float* %73
br label %74
74: ; preds = %62, %58
%75 = load float*, float** %7
%76 = load i64, i64* %8
%77 = load i32, i32* %11
%78 = load float, float* %12
%79 = call i32 @window(float* %75, i64 %76, i32 %77, float %78)
ret void
}

LLVM IR (-O2):
define void @xfir_gen_bandstop(float* %0, i64 %1, float %2, float %3, i32 %4, float %5) {
%7 = fpext float %2 to double
%8 = fmul double %7, 2.000000e+00
%9 = fpext float %3 to double
%10 = fmul double %9, 2.000000e+00
%11 = add i64 %1, -1
%12 = icmp eq i64 %1, 0
br i1 %12, label %43, label %13
13: ; preds = %6
%14 = uitofp i64 %11 to double
%15 = fmul double %14, -5.000000e-01
br label %16
16: ; preds = %13, %16
%17 = phi double [ %30, %16 ], [ %15, %13 ]
%18 = phi i64 [ %31, %16 ], [ 0, %13 ]
%19 = fmul double %17, 0x400921FB54442D18
%20 = tail call double @sin(double %19)
%21 = fmul double %10, %19
%22 = tail call double @sin(double %21)
%23 = fmul double %8, %19
%24 = tail call double @sin(double %23)
%25 = fsub double %22, %24
%26 = fsub double %20, %25
%27 = fdiv double %26, %19
%28 = fptrunc double %27 to float
%29 = getelementptr inbounds float, float* %0, i64 %18
store float %28, float* %29
%30 = fadd double %17, 1.000000e+00
%31 = add nuw i64 %18, 1
%32 = icmp eq i64 %31, %1
br i1 %32, label %33, label %16
33: ; preds = %16
%34 = and i64 %1, 1
%35 = icmp eq i64 %34, 0
br i1 %35, label %43, label %36
36: ; preds = %33
%37 = fsub float %3, %2
%38 = fpext float %37 to double
%39 = tail call double @llvm.fmuladd.f64(double %38, double -2.000000e+00, double 1.000000e+00)
%40 = fptrunc double %39 to float
%41 = lshr i64 %11, 1
%42 = getelementptr inbounds float, float* %0, i64 %41
store float %40, float* %42
br label %43
43: ; preds = %6, %36, %33
%44 = tail call i32 @window(float* %0, i64 %1, i32 %4, float %5)
ret void
}