#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 sin(double);
double lowpass(double n, double m, double wc) {
  double alpha = m / 2;
  double dist;
  dist = n - alpha;
  if (dist == 0)
    return wc / M_PI;
  return sin(wc * dist) / (M_PI * dist);
}


x86 assembly (clang, -O0):
<lowpass>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xecc(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    117e <lowpass+0x6e>
jp     117e <lowpass+0x6e>
movsd  -0x20(%rbp),%xmm0
mov    0x2e78(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11a6 <lowpass+0x96>
movsd  -0x20(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
call   1030 <sin@plt>
mov    0x2e54(%rip),%rax
movsd  (%rax),%xmm1
mulsd  -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lowpass>:
push   %rax
mulsd  0xee7(%rip),%xmm1
addsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1136 <lowpass+0x26>
jp     1136 <lowpass+0x26>
mov    0x2eb8(%rip),%rax
divsd  (%rax),%xmm2
jmp    1160 <lowpass+0x50>
mulsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
movsd  %xmm1,(%rsp)
call   1030 <sin@plt>
movapd %xmm0,%xmm2
mov    0x2e95(%rip),%rax
movsd  (%rsp),%xmm0
mulsd  (%rax),%xmm0
divsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @lowpass(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%10 = load double, double* %6
%11 = fdiv double %10, 2.000000e+00
store double %11, double* %8
%12 = load double, double* %5
%13 = load double, double* %8
%14 = fsub double %12, %13
store double %14, double* %9
%15 = load double, double* %9
%16 = fcmp oeq double %15, 0.000000e+00
br i1 %16, label %17, label %21
17: ; preds = %3
%18 = load double, double* %7
%19 = load double, double* @M_PI
%20 = fdiv double %18, %19
store double %20, double* %4
br label %30
21: ; preds = %3
%22 = load double, double* %7
%23 = load double, double* %9
%24 = fmul double %22, %23
%25 = call double @sin(double %24)
%26 = load double, double* @M_PI
%27 = load double, double* %9
%28 = fmul double %26, %27
%29 = fdiv double %25, %28
store double %29, double* %4
br label %30
30: ; preds = %21, %17
%31 = load double, double* %4
ret double %31
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @lowpass(double %0, double %1, double %2) {
%4 = fmul double %1, 5.000000e-01
%5 = fsub double %0, %4
%6 = fcmp oeq double %5, 0.000000e+00
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load double, double* @M_PI
%9 = fdiv double %2, %8
br label %16
10: ; preds = %3
%11 = fmul double %5, %2
%12 = tail call double @sin(double %11)
%13 = load double, double* @M_PI
%14 = fmul double %5, %13
%15 = fdiv double %12, %14
br label %16
16: ; preds = %10, %7
%17 = phi double [ %9, %7 ], [ %15, %10 ]
ret double %17
}