#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 */
typedef int /*<<< orphan*/ s;

/* Variables and functions */
scalar_t__ fabs(float);
float stbir__filter_catmullrom(float x, float s) {
  (void)sizeof(s);
  x = (float)fabs(x);
  if (x < 1.0f)
    return 1 - x * x * (2.5f - 1.5f * x);
  else if (x < 2.0f)
    return 2 - x * (4 + x * (0.5f * x - 2.5f));
  return (0.0f);
}


x86 assembly (clang, -O0):
<stbir__filter_catmullrom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xec2(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1196 <stbir__filter_catmullrom+0x86>
movss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  0xeb5(%rip),%xmm2
mulss  %xmm2,%xmm1
movss  0xead(%rip),%xmm2
addss  %xmm2,%xmm1
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm1,%xmm0
movss  0xe78(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1213 <stbir__filter_catmullrom+0x103>
movss  0xe66(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1206 <stbir__filter_catmullrom+0xf6>
movss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0x8(%rbp),%xmm2
movss  0xe4d(%rip),%xmm3
mulss  %xmm3,%xmm2
movss  0xe45(%rip),%xmm3
addss  %xmm3,%xmm2
mulss  %xmm2,%xmm1
movss  0xe2d(%rip),%xmm2
addss  %xmm2,%xmm1
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm1,%xmm0
movss  0xe0c(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1213 <stbir__filter_catmullrom+0x103>
jmp    120b <stbir__filter_catmullrom+0xfb>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stbir__filter_catmullrom>:
push   %rax
call   1030 <fabs@plt>
cvtsi2ss %rax,%xmm1
test   %rax,%rax
jle    1158 <stbir__filter_catmullrom+0x48>
cmp    $0x1,%rax
jne    1182 <stbir__filter_catmullrom+0x72>
movss  0xed2(%rip),%xmm2
mulss  %xmm1,%xmm2
addss  0xeca(%rip),%xmm2
mulss  %xmm1,%xmm2
addss  0xec2(%rip),%xmm2
mulss  %xmm1,%xmm2
movss  0xeba(%rip),%xmm0
subss  %xmm2,%xmm0
pop    %rax
ret
movss  0xeb0(%rip),%xmm0
mulss  %xmm1,%xmm0
addss  0xea8(%rip),%xmm0
mulss  %xmm1,%xmm1
mulss  %xmm0,%xmm1
movss  0xe9c(%rip),%xmm0
subss  %xmm1,%xmm0
pop    %rax
ret
xorps  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @stbir__filter_catmullrom(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %4
store float %1, float* %5
%6 = load float, float* %4
%7 = call i64 @fabs(float %6)
%8 = sitofp i64 %7 to float
store float %8, float* %4
%9 = load float, float* %4
%10 = fcmp olt float %9, 1.000000e+00
br i1 %10, label %11, label %19
11: ; preds = %2
%12 = load float, float* %4
%13 = load float, float* %4
%14 = fmul float %12, %13
%15 = load float, float* %4
%16 = call float @llvm.fmuladd.f32(float -1.500000e+00, float %15, float 2.500000e+00)
%17 = fneg float %14
%18 = call float @llvm.fmuladd.f32(float %17, float %16, float 1.000000e+00)
store float %18, float* %3
br label %32
19: ; preds = %2
%20 = load float, float* %4
%21 = fcmp olt float %20, 2.000000e+00
br i1 %21, label %22, label %30
22: ; preds = %19
%23 = load float, float* %4
%24 = load float, float* %4
%25 = load float, float* %4
%26 = call float @llvm.fmuladd.f32(float 5.000000e-01, float %25, float -2.500000e+00)
%27 = call float @llvm.fmuladd.f32(float %24, float %26, float 4.000000e+00)
%28 = fneg float %23
%29 = call float @llvm.fmuladd.f32(float %28, float %27, float 2.000000e+00)
store float %29, float* %3
br label %32
30: ; preds = %19
br label %31
31: ; preds = %30
store float 0.000000e+00, float* %3
br label %32
32: ; preds = %31, %22, %11
%33 = load float, float* %3
ret float %33
}

LLVM IR (-O2):
define float @stbir__filter_catmullrom(float %0, float %1) {
%3 = tail call i64 @fabs(float %0)
%4 = sitofp i64 %3 to float
%5 = icmp slt i64 %3, 1
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = tail call float @llvm.fmuladd.f32(float %4, float -1.500000e+00, float 2.500000e+00)
%8 = fneg float %4
%9 = fmul float %8, %4
%10 = tail call float @llvm.fmuladd.f32(float %9, float %7, float 1.000000e+00)
br label %18
11: ; preds = %2
%12 = icmp eq i64 %3, 1
br i1 %12, label %13, label %18
13: ; preds = %11
%14 = tail call float @llvm.fmuladd.f32(float %4, float 5.000000e-01, float -2.500000e+00)
%15 = tail call float @llvm.fmuladd.f32(float %4, float %14, float 4.000000e+00)
%16 = fneg float %4
%17 = tail call float @llvm.fmuladd.f32(float %16, float %15, float 2.000000e+00)
br label %18
18: ; preds = %11, %13, %6
%19 = phi float [ %10, %6 ], [ %17, %13 ], [ 0.000000e+00, %11 ]
ret float %19
}