#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 Izero(double);
double sin(double);
double sqrt(double);
void lrsLpFilter(double c[], int N, double frq, double Beta, int Num) {
  double IBeta, temp, temp1, inm1;
  int i;
  c[0] = 2.0 * frq;
  for (i = 1; i < N; i++) {
    temp = (3.14159265358979232846) * (double)i / (double)Num;
    c[i] = sin(2.0 * temp * frq) / temp;
  }
  IBeta = 1.0 / Izero(Beta);
  inm1 = 1.0 / ((double)(N - 1));
  for (i = 1; i < N; i++) {
    temp = (double)i * inm1;
    temp1 = 1.0 - temp * temp;
    temp1 = (temp1 < 0 ? 0 : temp1);
    c[i] *= Izero(Beta * sqrt(temp1)) * IBeta;
  }
}


x86 assembly (clang, -O0):
<lrsLpFilter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %edx,-0x24(%rbp)
movsd  0xeac(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ca <lrsLpFilter+0x9a>
cvtsi2sdl -0x4c(%rbp),%xmm1
movsd  0xe8f(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe65(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
divsd  -0x38(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1168 <lrsLpFilter+0x38>
movsd  -0x20(%rbp),%xmm0
call   1030 <Izero@plt>
movaps %xmm0,%xmm1
movsd  0xe29(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe0e(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x1,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12d4 <lrsLpFilter+0x1a4>
cvtsi2sdl -0x4c(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xdb6(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    1276 <lrsLpFilter+0x146>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    1280 <lrsLpFilter+0x150>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <Izero@plt>
mulsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    120a <lrsLpFilter+0xda>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lrsLpFilter>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
movsd  %xmm1,0x18(%rsp)
movapd %xmm0,%xmm1
mov    %esi,%r14d
mov    %rdi,%rbx
addsd  %xmm0,%xmm0
movsd  %xmm0,(%rdi)
mov    %esi,%r15d
cmp    $0x2,%esi
jl     11c2 <lrsLpFilter+0x92>
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
movsd  %xmm0,0x20(%rsp)
mov    $0x1,%ebp
movsd  %xmm1,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mulsd  0xe71(%rip),%xmm0
divsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
addsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm0
call   1040 <sin@plt>
movsd  0x8(%rsp),%xmm1
divsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%rbx,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1180 <lrsLpFilter+0x50>
movsd  0x18(%rsp),%xmm0
call   1030 <Izero@plt>
cmp    $0x2,%r14d
jl     126e <lrsLpFilter+0x13e>
add    $0xffffffff,%r14d
movsd  0xe25(%rip),%xmm2
movapd %xmm2,%xmm3
xorps  %xmm1,%xmm1
cvtsi2sd %r14d,%xmm1
divsd  %xmm0,%xmm3
movsd  %xmm3,0x10(%rsp)
divsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
mov    $0x1,%ebp
jmp    1239 <lrsLpFilter+0x109>
nopw   0x0(%rax,%rax,1)
call   1050 <sqrt@plt>
mulsd  0x18(%rsp),%xmm0
call   1030 <Izero@plt>
mulsd  0x10(%rsp),%xmm0
mulsd  (%rbx,%rbp,8),%xmm0
movsd  %xmm0,(%rbx,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%r15
je     126e <lrsLpFilter+0x13e>
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mulsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm0
movsd  0xdb6(%rip),%xmm1
subsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
maxsd  %xmm1,%xmm0
ucomisd 0xdaa(%rip),%xmm0
jb     1210 <lrsLpFilter+0xe0>
sqrtsd %xmm0,%xmm0
jmp    1215 <lrsLpFilter+0xe5>
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @lrsLpFilter(double* %0, i32 %1, double %2, double %3, i32 %4) {
%6 = alloca double*
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca i32
store double* %0, double** %6
store i32 %1, i32* %7
store double %2, double* %8
store double %3, double* %9
store i32 %4, i32* %10
%16 = load double, double* %8
%17 = fmul double 2.000000e+00, %16
%18 = load double*, double** %6
%19 = getelementptr inbounds double, double* %18, i64 0
store double %17, double* %19
store i32 1, i32* %15
br label %20
20: ; preds = %42, %5
%21 = load i32, i32* %15
%22 = load i32, i32* %7
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %45
24: ; preds = %20
%25 = load i32, i32* %15
%26 = sitofp i32 %25 to double
%27 = fmul double 0x400921FB54442D16, %26
%28 = load i32, i32* %10
%29 = sitofp i32 %28 to double
%30 = fdiv double %27, %29
store double %30, double* %12
%31 = load double, double* %12
%32 = fmul double 2.000000e+00, %31
%33 = load double, double* %8
%34 = fmul double %32, %33
%35 = call double @sin(double %34)
%36 = load double, double* %12
%37 = fdiv double %35, %36
%38 = load double*, double** %6
%39 = load i32, i32* %15
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
store double %37, double* %41
br label %42
42: ; preds = %24
%43 = load i32, i32* %15
%44 = add nsw i32 %43, 1
store i32 %44, i32* %15
br label %20
45: ; preds = %20
%46 = load double, double* %9
%47 = call double @Izero(double %46)
%48 = fdiv double 1.000000e+00, %47
store double %48, double* %11
%49 = load i32, i32* %7
%50 = sub nsw i32 %49, 1
%51 = sitofp i32 %50 to double
%52 = fdiv double 1.000000e+00, %51
store double %52, double* %14
store i32 1, i32* %15
br label %53
53: ; preds = %86, %45
%54 = load i32, i32* %15
%55 = load i32, i32* %7
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %89
57: ; preds = %53
%58 = load i32, i32* %15
%59 = sitofp i32 %58 to double
%60 = load double, double* %14
%61 = fmul double %59, %60
store double %61, double* %12
%62 = load double, double* %12
%63 = load double, double* %12
%64 = fneg double %62
%65 = call double @llvm.fmuladd.f64(double %64, double %63, double 1.000000e+00)
store double %65, double* %13
%66 = load double, double* %13
%67 = fcmp olt double %66, 0.000000e+00
br i1 %67, label %68, label %69
68: ; preds = %57
br label %71
69: ; preds = %57
%70 = load double, double* %13
br label %71
71: ; preds = %69, %68
%72 = phi double [ 0.000000e+00, %68 ], [ %70, %69 ]
store double %72, double* %13
%73 = load double, double* %9
%74 = load double, double* %13
%75 = call double @sqrt(double %74)
%76 = fmul double %73, %75
%77 = call double @Izero(double %76)
%78 = load double, double* %11
%79 = fmul double %77, %78
%80 = load double*, double** %6
%81 = load i32, i32* %15
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds double, double* %80, i64 %82
%84 = load double, double* %83
%85 = fmul double %84, %79
store double %85, double* %83
br label %86
86: ; preds = %71
%87 = load i32, i32* %15
%88 = add nsw i32 %87, 1
store i32 %88, i32* %15
br label %53
89: ; preds = %53
ret void
}

LLVM IR (-O2):
define void @lrsLpFilter(double* nocapture %0, i32 %1, double %2, double %3, i32 %4) {
%6 = fmul double %2, 2.000000e+00
store double %6, double* %0
%7 = icmp sgt i32 %1, 1
br i1 %7, label %8, label %24
8: ; preds = %5
%9 = sitofp i32 %4 to double
%10 = zext i32 %1 to i64
br label %11
11: ; preds = %8, %11
%12 = phi i64 [ 1, %8 ], [ %22, %11 ]
%13 = trunc i64 %12 to i32
%14 = sitofp i32 %13 to double
%15 = fmul double %14, 0x400921FB54442D16
%16 = fdiv double %15, %9
%17 = fmul double %16, 2.000000e+00
%18 = fmul double %17, %2
%19 = tail call double @sin(double %18)
%20 = fdiv double %19, %16
%21 = getelementptr inbounds double, double* %0, i64 %12
store double %20, double* %21
%22 = add nuw nsw i64 %12, 1
%23 = icmp eq i64 %22, %10
br i1 %23, label %24, label %11
24: ; preds = %11, %5
%25 = tail call double @Izero(double %3)
%26 = fdiv double 1.000000e+00, %25
%27 = add nsw i32 %1, -1
%28 = sitofp i32 %27 to double
%29 = fdiv double 1.000000e+00, %28
br i1 %7, label %30, label %50
30: ; preds = %24
%31 = zext i32 %1 to i64
br label %32
32: ; preds = %30, %32
%33 = phi i64 [ 1, %30 ], [ %48, %32 ]
%34 = trunc i64 %33 to i32
%35 = sitofp i32 %34 to double
%36 = fmul double %29, %35
%37 = fneg double %36
%38 = tail call double @llvm.fmuladd.f64(double %37, double %36, double 1.000000e+00)
%39 = fcmp olt double %38, 0.000000e+00
%40 = select i1 %39, double 0.000000e+00, double %38
%41 = tail call double @sqrt(double %40)
%42 = fmul double %41, %3
%43 = tail call double @Izero(double %42)
%44 = fmul double %26, %43
%45 = getelementptr inbounds double, double* %0, i64 %33
%46 = load double, double* %45
%47 = fmul double %46, %44
store double %47, double* %45
%48 = add nuw nsw i64 %33, 1
%49 = icmp eq i64 %48, %31
br i1 %49, label %50, label %32
50: ; preds = %32, %24
ret void
}