#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 */
int /*<<< orphan*/ ffabs(double *);
int gaussian(double);
double sq(int);
double short_gaussian_window(double x, double range, double w) {
  x /= range;
  ffabs(&x);
  if (x >= 1.)
    return 0.;
  w *= 0.7071067811865475244;
  if (w < 1e-4)
    return sq(1. - sq(x));
  return sq(gaussian(x * w) - gaussian(w)) / sq(1. - gaussian(w));
}


x86 assembly (clang, -O0):
<short_gaussian_window>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <ffabs@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xe90(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1187 <short_gaussian_window+0x57>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1237 <short_gaussian_window+0x107>
movsd  0xe81(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe67(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11d8 <short_gaussian_window+0xa8>
cvttsd2si -0x10(%rbp),%edi
call   1050 <sq@plt>
movaps %xmm0,%xmm1
movsd  0xe3f(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <sq@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1237 <short_gaussian_window+0x107>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1040 <gaussian@plt>
mov    %eax,-0x2c(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <gaussian@plt>
mov    -0x2c(%rbp),%edi
sub    %eax,%edi
call   1050 <sq@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <gaussian@plt>
cvtsi2sd %eax,%xmm1
movsd  0xde7(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <sq@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<short_gaussian_window>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm2,0x8(%rsp)
divsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rdi
call   1030 <ffabs@plt>
movsd  0x10(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd 0xe9f(%rip),%xmm0
jae    11f3 <short_gaussian_window+0xc3>
movsd  0x8(%rsp),%xmm2
mulsd  0xe93(%rip),%xmm2
movsd  0xe93(%rip),%xmm1
ucomisd %xmm2,%xmm1
jbe    11a7 <short_gaussian_window+0x77>
cvttsd2si %xmm0,%edi
call   1050 <sq@plt>
movsd  0xe6c(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1050 <sq@plt>
movapd %xmm0,%xmm1
jmp    11f3 <short_gaussian_window+0xc3>
mulsd  %xmm2,%xmm0
movsd  %xmm2,0x8(%rsp)
call   1040 <gaussian@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1040 <gaussian@plt>
sub    %eax,%ebx
mov    %ebx,%edi
call   1050 <sq@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <gaussian@plt>
mov    $0x1,%edi
sub    %eax,%edi
call   1050 <sq@plt>
movsd  0x18(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @short_gaussian_window(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%8 = load double, double* %6
%9 = load double, double* %5
%10 = fdiv double %9, %8
store double %10, double* %5
%11 = call i32 @ffabs(double* %5)
%12 = load double, double* %5
%13 = fcmp oge double %12, 1.000000e+00
br i1 %13, label %14, label %15
14: ; preds = %3
store double 0.000000e+00, double* %4
br label %43
15: ; preds = %3
%16 = load double, double* %7
%17 = fmul double %16, 0x3FE6A09E667F3BCD
store double %17, double* %7
%18 = load double, double* %7
%19 = fcmp olt double %18, 1.000000e-04
br i1 %19, label %20, label %27
20: ; preds = %15
%21 = load double, double* %5
%22 = fptosi double %21 to i32
%23 = call double @sq(i32 %22)
%24 = fsub double 1.000000e+00, %23
%25 = fptosi double %24 to i32
%26 = call double @sq(i32 %25)
store double %26, double* %4
br label %43
27: ; preds = %15
%28 = load double, double* %5
%29 = load double, double* %7
%30 = fmul double %28, %29
%31 = call i32 @gaussian(double %30)
%32 = load double, double* %7
%33 = call i32 @gaussian(double %32)
%34 = sub nsw i32 %31, %33
%35 = call double @sq(i32 %34)
%36 = load double, double* %7
%37 = call i32 @gaussian(double %36)
%38 = sitofp i32 %37 to double
%39 = fsub double 1.000000e+00, %38
%40 = fptosi double %39 to i32
%41 = call double @sq(i32 %40)
%42 = fdiv double %35, %41
store double %42, double* %4
br label %43
43: ; preds = %27, %20, %14
%44 = load double, double* %4
ret double %44
}

LLVM IR (-O2):
define double @short_gaussian_window(double %0, double %1, double %2) {
%4 = alloca double
%5 = fdiv double %0, %1
store double %5, double* %4
%6 = call i32 @ffabs(double* %4)
%7 = load double, double* %4
%8 = fcmp ult double %7, 1.000000e+00
br i1 %8, label %9, label %28
9: ; preds = %3
%10 = fmul double %2, 0x3FE6A09E667F3BCD
%11 = fcmp olt double %10, 1.000000e-04
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = fptosi double %7 to i32
%14 = call double @sq(i32 %13)
%15 = fsub double 1.000000e+00, %14
%16 = fptosi double %15 to i32
%17 = call double @sq(i32 %16)
br label %28
18: ; preds = %9
%19 = fmul double %10, %7
%20 = call i32 @gaussian(double %19)
%21 = call i32 @gaussian(double %10)
%22 = sub nsw i32 %20, %21
%23 = call double @sq(i32 %22)
%24 = call i32 @gaussian(double %10)
%25 = sub i32 1, %24
%26 = call double @sq(i32 %25)
%27 = fdiv double %23, %26
br label %28
28: ; preds = %3, %18, %12
%29 = phi double [ %17, %12 ], [ %27, %18 ], [ 0.000000e+00, %3 ]
ret double %29
}