#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_bandpass(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(thf * x) - sin(tlf * x)) / x;
    n += 1.0;
  }
  if (n_taps & 1) {
    taps[(n_taps - 1) / 2] = thf - tlf;
  }
  window(taps, n_taps, win_type, alpha);
}


x86 assembly (clang, -O0):
<xfir_gen_bandpass>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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    1236 <xfir_gen_bandpass+0x116>
movsd  0xe4c(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
subsd  %xmm1,%xmm0
divsd  -0x48(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x40(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movsd  0xded(%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_bandpass+0x8e>
mov    -0x10(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     126b <xfir_gen_bandpass+0x14b>
movsd  -0x30(%rbp),%xmm0
subsd  -0x28(%rbp),%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    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xfir_gen_bandpass>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%r12
mov    %rsi,%r15
sub    $0x1,%r15
jb     1228 <xfir_gen_bandpass+0x108>
movss  %xmm2,0xc(%rsp)
cvtss2sd %xmm0,%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
cvtss2sd %xmm1,%xmm1
movq   %r15,%xmm0
punpckldq 0xe99(%rip),%xmm0
subpd  0xea1(%rip),%xmm0
movapd %xmm0,%xmm2
unpckhpd %xmm0,%xmm2
addsd  %xmm0,%xmm2
mulsd  0xe9d(%rip),%xmm2
addsd  %xmm1,%xmm1
xor    %ebp,%ebp
movsd  %xmm1,0x20(%rsp)
nop
movapd %xmm2,0x30(%rsp)
mulsd  0xe8a(%rip),%xmm2
movsd  %xmm2,0x18(%rsp)
movapd %xmm1,%xmm0
mulsd  %xmm2,%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0x18(%rsp),%xmm0
call   1030 <sin@plt>
movapd 0x30(%rsp),%xmm2
movsd  0x20(%rsp),%xmm1
movsd  0x28(%rsp),%xmm3
subsd  %xmm0,%xmm3
divsd  0x18(%rsp),%xmm3
xorps  %xmm0,%xmm0
cvtsd2ss %xmm3,%xmm0
movss  %xmm0,(%r12,%rbp,4)
addsd  0xe37(%rip),%xmm2
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1190 <xfir_gen_bandpass+0x70>
movsd  0x10(%rsp),%xmm0
test   $0x1,%bl
movss  0xc(%rsp),%xmm2
je     1228 <xfir_gen_bandpass+0x108>
subsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
and    $0xfffffffffffffffe,%r15
movss  %xmm0,(%r12,%r15,2)
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
movaps %xmm2,%xmm0
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <window@plt>

LLVM IR (-O0):
define void @xfir_gen_bandpass(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 = %52, %6
%29 = load i64, i64* %16
%30 = load i64, i64* %8
%31 = icmp ult i64 %29, %30
br i1 %31, label %32, label %55
32: ; preds = %28
%33 = load double, double* %15
%34 = fmul double 0x400921FB54442D18, %33
store double %34, double* %17
%35 = load double, double* %14
%36 = load double, double* %17
%37 = fmul double %35, %36
%38 = call double @sin(double %37)
%39 = load double, double* %13
%40 = load double, double* %17
%41 = fmul double %39, %40
%42 = call double @sin(double %41)
%43 = fsub double %38, %42
%44 = load double, double* %17
%45 = fdiv double %43, %44
%46 = fptrunc double %45 to float
%47 = load float*, float** %7
%48 = load i64, i64* %16
%49 = getelementptr inbounds float, float* %47, i64 %48
store float %46, float* %49
%50 = load double, double* %15
%51 = fadd double %50, 1.000000e+00
store double %51, double* %15
br label %52
52: ; preds = %32
%53 = load i64, i64* %16
%54 = add i64 %53, 1
store i64 %54, i64* %16
br label %28
55: ; preds = %28
%56 = load i64, i64* %8
%57 = and i64 %56, 1
%58 = icmp ne i64 %57, 0
br i1 %58, label %59, label %69
59: ; preds = %55
%60 = load double, double* %14
%61 = load double, double* %13
%62 = fsub double %60, %61
%63 = fptrunc double %62 to float
%64 = load float*, float** %7
%65 = load i64, i64* %8
%66 = sub i64 %65, 1
%67 = udiv i64 %66, 2
%68 = getelementptr inbounds float, float* %64, i64 %67
store float %63, float* %68
br label %69
69: ; preds = %59, %55
%70 = load float*, float** %7
%71 = load i64, i64* %8
%72 = load i32, i32* %11
%73 = load float, float* %12
%74 = call i32 @window(float* %70, i64 %71, i32 %72, float %73)
ret void
}

LLVM IR (-O2):
define void @xfir_gen_bandpass(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 %39, 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 [ %28, %16 ], [ %15, %13 ]
%18 = phi i64 [ %29, %16 ], [ 0, %13 ]
%19 = fmul double %17, 0x400921FB54442D18
%20 = fmul double %10, %19
%21 = tail call double @sin(double %20)
%22 = fmul double %8, %19
%23 = tail call double @sin(double %22)
%24 = fsub double %21, %23
%25 = fdiv double %24, %19
%26 = fptrunc double %25 to float
%27 = getelementptr inbounds float, float* %0, i64 %18
store float %26, float* %27
%28 = fadd double %17, 1.000000e+00
%29 = add nuw i64 %18, 1
%30 = icmp eq i64 %29, %1
br i1 %30, label %31, label %16
31: ; preds = %16
%32 = and i64 %1, 1
%33 = icmp eq i64 %32, 0
br i1 %33, label %39, label %34
34: ; preds = %31
%35 = fsub double %10, %8
%36 = fptrunc double %35 to float
%37 = lshr i64 %11, 1
%38 = getelementptr inbounds float, float* %0, i64 %37
store float %36, float* %38
br label %39
39: ; preds = %6, %34, %31
%40 = tail call i32 @window(float* %0, i64 %1, i32 %4, float %5)
ret void
}