#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;
float exp(double);
float calc_lop_alpha(float rate, float freq) {
  float fr = freq / rate;
  if (fr < 0.0002)
    fr = 0.0002;
  if (fr > 0.4998)
    fr = 0.4998;
  return 1.0 - exp(-2.0 * M_PI * fr);
}


x86 assembly (clang, -O0):
<calc_lop_alpha>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
divss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xebe(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1159 <calc_lop_alpha+0x49>
movss  0xecc(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe9e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1181 <calc_lop_alpha+0x71>
movss  0xea8(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movsd  0xe8f(%rip),%xmm0
mov    0x2e58(%rip),%rax
mulsd  (%rax),%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
cvtss2sd %xmm0,%xmm1
movsd  0xe5e(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_lop_alpha>:
push   %rax
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movaps %xmm0,%xmm1
cmpltsd 0xed8(%rip),%xmm1
movsd  0xed8(%rip),%xmm2
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
mov    0x2ea9(%rip),%rax
movsd  (%rax),%xmm3
mulsd  0xec5(%rip),%xmm3
orpd   %xmm1,%xmm2
movsd  0xec1(%rip),%xmm1
cmpltsd %xmm2,%xmm1
movsd  0xebc(%rip),%xmm0
andpd  %xmm1,%xmm0
andnpd %xmm2,%xmm1
orpd   %xmm1,%xmm0
mulsd  %xmm3,%xmm0
call   1030 <exp@plt>
movss  0xea7(%rip),%xmm1
subss  %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define float @calc_lop_alpha(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %4
%7 = load float, float* %3
%8 = fdiv float %6, %7
store float %8, float* %5
%9 = load float, float* %5
%10 = fpext float %9 to double
%11 = fcmp olt double %10, 2.000000e-04
br i1 %11, label %12, label %13
12: ; preds = %2
store float 0x3F2A36E2E0000000, float* %5
br label %13
13: ; preds = %12, %2
%14 = load float, float* %5
%15 = fpext float %14 to double
%16 = fcmp ogt double %15, 4.998000e-01
br i1 %16, label %17, label %18
17: ; preds = %13
store float 0x3FDFFCB920000000, float* %5
br label %18
18: ; preds = %17, %13
%19 = load double, double* @M_PI
%20 = fmul double -2.000000e+00, %19
%21 = load float, float* %5
%22 = fpext float %21 to double
%23 = fmul double %20, %22
%24 = call float @exp(double %23)
%25 = fpext float %24 to double
%26 = fsub double 1.000000e+00, %25
%27 = fptrunc double %26 to float
ret float %27
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define float @calc_lop_alpha(float %0, float %1) {
%3 = fdiv float %1, %0
%4 = fpext float %3 to double
%5 = fcmp olt double %4, 2.000000e-04
%6 = fpext float %3 to double
%7 = select i1 %5, double 0x3F2A36E2E0000000, double %6
%8 = fcmp ogt double %7, 4.998000e-01
%9 = load double, double* @M_PI
%10 = fmul double %9, -2.000000e+00
%11 = select i1 %8, double 0x3FDFFCB920000000, double %7
%12 = fmul double %11, %10
%13 = tail call float @exp(double %12)
%14 = fsub float 1.000000e+00, %13
ret float %14
}