#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 */
float fabsf(float);
scalar_t__ ltr_int_is_finite(float);
float ltr_int_nonlinfilt(float x, float y_minus_1, float filterfactor) {
  float y;
  if (!ltr_int_is_finite(x)) {
    return y_minus_1;
  }
  float delta = x - y_minus_1;
  y = y_minus_1 + delta * (fabsf(delta) / (fabsf(delta) + filterfactor));
  if (!ltr_int_is_finite(y)) {
    if (ltr_int_is_finite(y_minus_1)) {
      return y_minus_1;
    } else {
      return 0.0f;
    }
  }
  return y;
}


x86 assembly (clang, -O0):
<ltr_int_nonlinfilt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <ltr_int_is_finite@plt>
cmp    $0x0,%rax
jne    114a <ltr_int_nonlinfilt+0x3a>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11e7 <ltr_int_nonlinfilt+0xd7>
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm1
movss  -0x18(%rbp),%xmm0
movss  -0x18(%rbp),%xmm2
movaps 0xe91(%rip),%xmm3
pand   %xmm3,%xmm2
movss  -0x18(%rbp),%xmm3
movaps 0xe81(%rip),%xmm4
pand   %xmm4,%xmm3
addss  -0x10(%rbp),%xmm3
divss  %xmm3,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <ltr_int_is_finite@plt>
cmp    $0x0,%rax
jne    11dd <ltr_int_nonlinfilt+0xcd>
movss  -0xc(%rbp),%xmm0
call   1030 <ltr_int_is_finite@plt>
cmp    $0x0,%rax
je     11d0 <ltr_int_nonlinfilt+0xc0>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11e7 <ltr_int_nonlinfilt+0xd7>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11e7 <ltr_int_nonlinfilt+0xd7>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltr_int_nonlinfilt>:
sub    $0x28,%rsp
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x8(%rsp)
movaps %xmm0,0x10(%rsp)
call   1030 <ltr_int_is_finite@plt>
test   %rax,%rax
je     118a <ltr_int_nonlinfilt+0x7a>
movss  0x8(%rsp),%xmm3
movaps 0x10(%rsp),%xmm1
subss  %xmm3,%xmm1
movaps 0xebb(%rip),%xmm0
andps  %xmm1,%xmm0
movss  0xc(%rsp),%xmm2
addss  %xmm0,%xmm2
divss  %xmm2,%xmm0
mulss  %xmm1,%xmm0
addss  %xmm3,%xmm0
movaps %xmm0,0x10(%rsp)
call   1030 <ltr_int_is_finite@plt>
movaps 0x10(%rsp),%xmm0
test   %rax,%rax
je     1177 <ltr_int_nonlinfilt+0x67>
add    $0x28,%rsp
ret
movss  0x8(%rsp),%xmm0
call   1030 <ltr_int_is_finite@plt>
xorps  %xmm0,%xmm0
test   %rax,%rax
je     1172 <ltr_int_nonlinfilt+0x62>
movss  0x8(%rsp),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @ltr_int_nonlinfilt(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
%10 = load float, float* %5
%11 = call i64 @ltr_int_is_finite(float %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %3
%14 = load float, float* %6
store float %14, float* %4
br label %41
15: ; preds = %3
%16 = load float, float* %5
%17 = load float, float* %6
%18 = fsub float %16, %17
store float %18, float* %9
%19 = load float, float* %6
%20 = load float, float* %9
%21 = load float, float* %9
%22 = call float @llvm.fabs.f32(float %21)
%23 = load float, float* %9
%24 = call float @llvm.fabs.f32(float %23)
%25 = load float, float* %7
%26 = fadd float %24, %25
%27 = fdiv float %22, %26
%28 = call float @llvm.fmuladd.f32(float %20, float %27, float %19)
store float %28, float* %8
%29 = load float, float* %8
%30 = call i64 @ltr_int_is_finite(float %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %39, label %32
32: ; preds = %15
%33 = load float, float* %6
%34 = call i64 @ltr_int_is_finite(float %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = load float, float* %6
store float %37, float* %4
br label %41
38: ; preds = %32
store float 0.000000e+00, float* %4
br label %41
39: ; preds = %15
%40 = load float, float* %8
store float %40, float* %4
br label %41
41: ; preds = %39, %38, %36, %13
%42 = load float, float* %4
ret float %42
}

LLVM IR (-O2):
define float @ltr_int_nonlinfilt(float %0, float %1, float %2) {
%4 = tail call i64 @ltr_int_is_finite(float %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %18, label %6
6: ; preds = %3
%7 = fsub float %0, %1
%8 = tail call float @llvm.fabs.f32(float %7)
%9 = fadd float %8, %2
%10 = fdiv float %8, %9
%11 = tail call float @llvm.fmuladd.f32(float %7, float %10, float %1)
%12 = tail call i64 @ltr_int_is_finite(float %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %6
%15 = tail call i64 @ltr_int_is_finite(float %1)
%16 = icmp eq i64 %15, 0
%17 = select i1 %16, float 0.000000e+00, float %1
br label %18
18: ; preds = %14, %6, %3
%19 = phi float [ %1, %3 ], [ %17, %14 ], [ %11, %6 ]
ret float %19
}