#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);
float filter_mitchell(float x) {
  static float a0 = (6.0 - 2.0 * (1.0 / 3.0)) / 6.0;
  static float a2 = (-18.0 + 12.0 * (1.0 / 3.0) + 6.0 * (1.0 / 3.0)) / 6.0;
  static float a3 = (12.0 - 9.0 * (1.0 / 3.0) - 6.0 * (1.0 / 3.0)) / 6.0;
  static float b0 = (8.0 * (1.0 / 3.0) + 24.0 * (1.0 / 3.0)) / 6.0;
  static float b1 = (-12.0 * (1.0 / 3.0) - 48.0 * (1.0 / 3.0)) / 6.0;
  static float b2 = (6.0 * (1.0 / 3.0) + 30.0 * (1.0 / 3.0)) / 6.0;
  static float b3 = (-(1.0 / 3.0) - 6.0 * (1.0 / 3.0)) / 6.0;
  x = fabsf(x);
  if (x < 1.0)
    return a0 + (x * x) * (a2 + x * a3);
  if (x < 2.0)
    return b0 + x * (b1 + x * (b2 + x * b3));
  return 0.0;
}


x86 assembly (clang, -O0):
<filter_mitchell>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movaps 0xefb(%rip),%xmm1
pand   %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xed1(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    117a <filter_mitchell+0x7a>
movss  0x2edf(%rip),%xmm1
movss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  0x2ed1(%rip),%xmm3
movss  -0x8(%rbp),%xmm2
movss  0x2ec8(%rip),%xmm4
mulss  %xmm4,%xmm2
addss  %xmm3,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ee <filter_mitchell+0xee>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe7d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11e6 <filter_mitchell+0xe6>
movss  0x2e8f(%rip),%xmm1
movss  -0x8(%rbp),%xmm0
movss  0x2e86(%rip),%xmm3
movss  -0x8(%rbp),%xmm2
movss  0x2e7d(%rip),%xmm5
movss  -0x8(%rbp),%xmm4
movss  0x2e74(%rip),%xmm6
mulss  %xmm6,%xmm4
addss  %xmm5,%xmm4
mulss  %xmm4,%xmm2
addss  %xmm3,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ee <filter_mitchell+0xee>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<filter_mitchell>:
movaps 0xef9(%rip),%xmm2
andps  %xmm0,%xmm2
movss  0xefe(%rip),%xmm1
ucomiss %xmm2,%xmm1
jbe    113f <filter_mitchell+0x3f>
movss  0xf05(%rip),%xmm1
mulss  %xmm2,%xmm1
addss  0xefd(%rip),%xmm1
mulss  %xmm0,%xmm0
mulss  %xmm0,%xmm1
addss  0xef1(%rip),%xmm1
movaps %xmm1,%xmm0
ret
movss  0xecd(%rip),%xmm0
ucomiss %xmm2,%xmm0
jbe    1179 <filter_mitchell+0x79>
movss  0xec4(%rip),%xmm0
mulss  %xmm2,%xmm0
addss  0xeb4(%rip),%xmm0
mulss  %xmm2,%xmm0
addss  0xeb0(%rip),%xmm0
mulss  %xmm2,%xmm0
addss  0xea8(%rip),%xmm0
ret
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
@filter_mitchell.a0 = internal global float 0x3FEC71C720000000
@filter_mitchell.a2 = internal global float -2.000000e+00
@filter_mitchell.a3 = internal global float 0x3FF2AAAAA0000000
@filter_mitchell.b0 = internal global float 0x3FFC71C720000000
@filter_mitchell.b1 = internal global float 0xC00AAAAAA0000000
@filter_mitchell.b2 = internal global float 2.000000e+00
@filter_mitchell.b3 = internal global float 0xBFD8E38E40000000
define float @filter_mitchell(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = call float @llvm.fabs.f32(float %4)
store float %5, float* %3
%6 = load float, float* %3
%7 = fpext float %6 to double
%8 = fcmp olt double %7, 1.000000e+00
br i1 %8, label %9, label %19
9: ; preds = %1
%10 = load float, float* @filter_mitchell.a0
%11 = load float, float* %3
%12 = load float, float* %3
%13 = fmul float %11, %12
%14 = load float, float* @filter_mitchell.a2
%15 = load float, float* %3
%16 = load float, float* @filter_mitchell.a3
%17 = call float @llvm.fmuladd.f32(float %15, float %16, float %14)
%18 = call float @llvm.fmuladd.f32(float %13, float %17, float %10)
store float %18, float* %2
br label %35
19: ; preds = %1
%20 = load float, float* %3
%21 = fpext float %20 to double
%22 = fcmp olt double %21, 2.000000e+00
br i1 %22, label %23, label %34
23: ; preds = %19
%24 = load float, float* @filter_mitchell.b0
%25 = load float, float* %3
%26 = load float, float* @filter_mitchell.b1
%27 = load float, float* %3
%28 = load float, float* @filter_mitchell.b2
%29 = load float, float* %3
%30 = load float, float* @filter_mitchell.b3
%31 = call float @llvm.fmuladd.f32(float %29, float %30, float %28)
%32 = call float @llvm.fmuladd.f32(float %27, float %31, float %26)
%33 = call float @llvm.fmuladd.f32(float %25, float %32, float %24)
store float %33, float* %2
br label %35
34: ; preds = %19
store float 0.000000e+00, float* %2
br label %35
35: ; preds = %34, %23, %9
%36 = load float, float* %2
ret float %36
}

LLVM IR (-O2):
define float @filter_mitchell(float %0) {
%2 = tail call float @llvm.fabs.f32(float %0)
%3 = fcmp olt float %2, 1.000000e+00
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = fmul float %0, %0
%6 = tail call float @llvm.fmuladd.f32(float %2, float 0x3FF2AAAAA0000000, float -2.000000e+00)
%7 = tail call float @llvm.fmuladd.f32(float %5, float %6, float 0x3FEC71C720000000)
br label %14
8: ; preds = %1
%9 = fcmp olt float %2, 2.000000e+00
br i1 %9, label %10, label %14
10: ; preds = %8
%11 = tail call float @llvm.fmuladd.f32(float %2, float 0xBFD8E38E40000000, float 2.000000e+00)
%12 = tail call float @llvm.fmuladd.f32(float %2, float %11, float 0xC00AAAAAA0000000)
%13 = tail call float @llvm.fmuladd.f32(float %2, float %12, float 0x3FFC71C720000000)
br label %14
14: ; preds = %8, %10, %4
%15 = phi float [ %7, %4 ], [ %13, %10 ], [ 0.000000e+00, %8 ]
ret float %15
}