#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 */
struct iw_rr_ctx {
  int dummy;
};

/* Variables and functions */
double exp(double);
double iw_filter_gaussian(struct iw_rr_ctx *rrctx, double x) {
  double value;
  if (x >= 2.0)
    return 0.0;
  value = exp(-2.0 * x * x) * 0.79788456080286535587989;
  if (x <= 1.999)
    return value;
  return 1000.0 * (2.0 - x) * value;
}


x86 assembly (clang, -O0):
<iw_filter_gaussian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xed2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1145 <iw_filter_gaussian+0x35>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11b2 <iw_filter_gaussian+0xa2>
movsd  0xecb(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1030 <exp@plt>
movsd  0xeac(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe93(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     118f <iw_filter_gaussian+0x7f>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11b2 <iw_filter_gaussian+0xa2>
movsd  0xe69(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
movsd  0xe7c(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iw_filter_gaussian>:
push   %rax
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd 0xedf(%rip),%xmm1
jae    1170 <iw_filter_gaussian+0x60>
movsd  0xedd(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm1,(%rsp)
call   1030 <exp@plt>
movsd  (%rsp),%xmm2
mulsd  0xec6(%rip),%xmm0
movsd  0xec6(%rip),%xmm1
ucomisd %xmm2,%xmm1
jae    1170 <iw_filter_gaussian+0x60>
movsd  0xea0(%rip),%xmm1
subsd  %xmm2,%xmm1
mulsd  0xeb4(%rip),%xmm1
mulsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
%struct.iw_rr_ctx = type { i32 }
define double @iw_filter_gaussian(%struct.iw_rr_ctx* %0, double %1) {
%3 = alloca double
%4 = alloca %struct.iw_rr_ctx*
%5 = alloca double
%6 = alloca double
store %struct.iw_rr_ctx* %0, %struct.iw_rr_ctx** %4
store double %1, double* %5
%7 = load double, double* %5
%8 = fcmp oge double %7, 2.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %2
store double 0.000000e+00, double* %3
br label %27
10: ; preds = %2
%11 = load double, double* %5
%12 = fmul double -2.000000e+00, %11
%13 = load double, double* %5
%14 = fmul double %12, %13
%15 = call double @exp(double %14)
%16 = fmul double %15, 0x3FE9884533D43651
store double %16, double* %6
%17 = load double, double* %5
%18 = fcmp ole double %17, 1.999000e+00
br i1 %18, label %19, label %21
19: ; preds = %10
%20 = load double, double* %6
store double %20, double* %3
br label %27
21: ; preds = %10
%22 = load double, double* %5
%23 = fsub double 2.000000e+00, %22
%24 = fmul double 1.000000e+03, %23
%25 = load double, double* %6
%26 = fmul double %24, %25
store double %26, double* %3
br label %27
27: ; preds = %21, %19, %9
%28 = load double, double* %3
ret double %28
}

LLVM IR (-O2):
%struct.iw_rr_ctx = type { i32 }
define double @iw_filter_gaussian(%struct.iw_rr_ctx* nocapture readnone %0, double %1) {
%3 = fcmp ult double %1, 2.000000e+00
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = fmul double %1, -2.000000e+00
%6 = fmul double %5, %1
%7 = tail call double @exp(double %6)
%8 = fmul double %7, 0x3FE9884533D43651
%9 = fcmp ugt double %1, 1.999000e+00
br i1 %9, label %10, label %14
10: ; preds = %4
%11 = fsub double 2.000000e+00, %1
%12 = fmul double %11, 1.000000e+03
%13 = fmul double %12, %8
br label %14
14: ; preds = %4, %2, %10
%15 = phi double [ %13, %10 ], [ 0.000000e+00, %2 ], [ %8, %4 ]
ret double %15
}