#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 log10(float);
int optfiltn(float delt1, float delt2, float df) {
  int n;
  float a, b, c, d;
  a = log10(delt1);
  b = log10(delt2);
  c = 11.012 + 0.51244 * (a - b);
  d = (0.005309 * a * a + 0.07114 * a - 0.4761) * b -
      (0.00266 * a * a + 0.5941 * a + 0.4278);
  n = ((int)(((d - c * df * df) / df) > 0.0 ? ((d - c * df * df) / df) + 0.5
                                            : ((d - c * df * df) / df) - 0.5)) +
      1;
  return n;
}


x86 assembly (clang, -O0):
<optfiltn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <log10@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <log10@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
subss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xed5(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xed1(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xea3(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm3
movsd  0xe7d(%rip),%xmm1
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe61(%rip),%xmm1
subsd  %xmm1,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm3
movsd  0xe3b(%rip),%xmm1
mulsd  %xmm3,%xmm1
movss  -0x14(%rbp),%xmm3
cvtss2sd %xmm3,%xmm4
movss  -0x14(%rbp),%xmm3
cvtss2sd %xmm3,%xmm5
movsd  0xe15(%rip),%xmm3
mulsd  %xmm5,%xmm3
mulsd  %xmm4,%xmm1
addsd  %xmm3,%xmm1
movsd  0xdf9(%rip),%xmm3
addsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
divss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    12ba <optfiltn+0x1aa>
movss  -0x20(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
divss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd94(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    12fd <optfiltn+0x1ed>
movss  -0x20(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
divss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd4c(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
cvttsd2si %xmm0,%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<optfiltn>:
sub    $0x18,%rsp
movss  %xmm2,0x14(%rsp)
movss  %xmm1,0x10(%rsp)
call   1030 <log10@plt>
movss  %xmm0,0xc(%rsp)
movss  0x10(%rsp),%xmm0
call   1030 <log10@plt>
movss  0xc(%rsp),%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
subss  %xmm0,%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  0xead(%rip),%xmm2
addsd  0xead(%rip),%xmm2
cvtsd2ss %xmm2,%xmm2
movsd  0xea9(%rip),%xmm3
mulsd  %xmm1,%xmm3
movsd  0xea5(%rip),%xmm4
mulsd  %xmm1,%xmm4
mulsd  %xmm1,%xmm3
addsd  %xmm4,%xmm3
addsd  0xe99(%rip),%xmm3
cvtss2sd %xmm0,%xmm0
mulsd  %xmm3,%xmm0
movsd  0xe91(%rip),%xmm3
mulsd  %xmm1,%xmm3
mulsd  %xmm1,%xmm3
mulsd  0xe89(%rip),%xmm1
addsd  %xmm3,%xmm1
addsd  0xe85(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  0x14(%rsp),%xmm1
mulss  %xmm1,%xmm2
mulss  %xmm1,%xmm2
subss  %xmm2,%xmm0
divss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
xor    %eax,%eax
ucomiss %xmm1,%xmm0
seta   %al
cvtss2sd %xmm0,%xmm0
lea    0xe59(%rip),%rcx
addsd  (%rcx,%rax,8),%xmm0
cvttsd2si %xmm0,%eax
add    $0x1,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @optfiltn(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%12 = load float, float* %4
%13 = call float @log10(float %12)
store float %13, float* %8
%14 = load float, float* %5
%15 = call float @log10(float %14)
store float %15, float* %9
%16 = load float, float* %8
%17 = load float, float* %9
%18 = fsub float %16, %17
%19 = fpext float %18 to double
%20 = call double @llvm.fmuladd.f64(double 5.124400e-01, double %19, double 1.101200e+01)
%21 = fptrunc double %20 to float
store float %21, float* %10
%22 = load float, float* %8
%23 = fpext float %22 to double
%24 = fmul double 5.309000e-03, %23
%25 = load float, float* %8
%26 = fpext float %25 to double
%27 = load float, float* %8
%28 = fpext float %27 to double
%29 = fmul double 0x3FB2363B256FFC11, %28
%30 = call double @llvm.fmuladd.f64(double %24, double %26, double %29)
%31 = fsub double %30, 4.761000e-01
%32 = load float, float* %9
%33 = fpext float %32 to double
%34 = load float, float* %8
%35 = fpext float %34 to double
%36 = fmul double 2.660000e-03, %35
%37 = load float, float* %8
%38 = fpext float %37 to double
%39 = load float, float* %8
%40 = fpext float %39 to double
%41 = fmul double 5.941000e-01, %40
%42 = call double @llvm.fmuladd.f64(double %36, double %38, double %41)
%43 = fadd double %42, 4.278000e-01
%44 = fneg double %43
%45 = call double @llvm.fmuladd.f64(double %31, double %33, double %44)
%46 = fptrunc double %45 to float
store float %46, float* %11
%47 = load float, float* %11
%48 = load float, float* %10
%49 = load float, float* %6
%50 = fmul float %48, %49
%51 = load float, float* %6
%52 = fneg float %50
%53 = call float @llvm.fmuladd.f32(float %52, float %51, float %47)
%54 = load float, float* %6
%55 = fdiv float %53, %54
%56 = fpext float %55 to double
%57 = fcmp ogt double %56, 0.000000e+00
br i1 %57, label %58, label %70
58: ; preds = %3
%59 = load float, float* %11
%60 = load float, float* %10
%61 = load float, float* %6
%62 = fmul float %60, %61
%63 = load float, float* %6
%64 = fneg float %62
%65 = call float @llvm.fmuladd.f32(float %64, float %63, float %59)
%66 = load float, float* %6
%67 = fdiv float %65, %66
%68 = fpext float %67 to double
%69 = fadd double %68, 5.000000e-01
br label %82
70: ; preds = %3
%71 = load float, float* %11
%72 = load float, float* %10
%73 = load float, float* %6
%74 = fmul float %72, %73
%75 = load float, float* %6
%76 = fneg float %74
%77 = call float @llvm.fmuladd.f32(float %76, float %75, float %71)
%78 = load float, float* %6
%79 = fdiv float %77, %78
%80 = fpext float %79 to double
%81 = fsub double %80, 5.000000e-01
br label %82
82: ; preds = %70, %58
%83 = phi double [ %69, %58 ], [ %81, %70 ]
%84 = fptosi double %83 to i32
%85 = add nsw i32 %84, 1
store i32 %85, i32* %7
%86 = load i32, i32* %7
ret i32 %86
}

LLVM IR (-O2):
define i32 @optfiltn(float %0, float %1, float %2) {
%4 = tail call float @log10(float %0)
%5 = tail call float @log10(float %1)
%6 = fsub float %4, %5
%7 = fpext float %6 to double
%8 = tail call double @llvm.fmuladd.f64(double %7, double 5.124400e-01, double 1.101200e+01)
%9 = fptrunc double %8 to float
%10 = fpext float %4 to double
%11 = fmul double %10, 5.309000e-03
%12 = fmul double %10, 0x3FB2363B256FFC11
%13 = tail call double @llvm.fmuladd.f64(double %11, double %10, double %12)
%14 = fadd double %13, -4.761000e-01
%15 = fpext float %5 to double
%16 = fmul double %10, 2.660000e-03
%17 = fmul double %10, 5.941000e-01
%18 = tail call double @llvm.fmuladd.f64(double %16, double %10, double %17)
%19 = fadd double %18, 4.278000e-01
%20 = fneg double %19
%21 = tail call double @llvm.fmuladd.f64(double %14, double %15, double %20)
%22 = fptrunc double %21 to float
%23 = fneg float %9
%24 = fmul float %23, %2
%25 = tail call float @llvm.fmuladd.f32(float %24, float %2, float %22)
%26 = fdiv float %25, %2
%27 = fpext float %26 to double
%28 = fcmp ogt float %26, 0.000000e+00
%29 = select i1 %28, double 5.000000e-01, double -5.000000e-01
%30 = fadd double %29, %27
%31 = fptosi double %30 to i32
%32 = add nsw i32 %31, 1
ret i32 %32
}