#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 pow(float, int);
float inOutQuad(float t, float b, float c, float d) {
  t = t / d * 2;
  if (t < 1)
    return c / 2 * pow(t, 2) + b;
  return -c / 2 * ((t - 1) * (t - 3) - 1) + b;
}


x86 assembly (clang, -O0):
<inOutQuad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  %xmm3,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
divss  -0x14(%rbp),%xmm0
movss  0xec6(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xeb1(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    119d <inOutQuad+0x8d>
movss  -0x10(%rbp),%xmm0
movss  0xe9e(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm2
movss  -0x18(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ff <inOutQuad+0xef>
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xe4d(%rip),%xmm1
divss  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm2
movss  0xe38(%rip),%xmm1
subss  %xmm1,%xmm2
movss  -0x8(%rbp),%xmm1
movss  0xe33(%rip),%xmm3
subss  %xmm3,%xmm1
mulss  %xmm1,%xmm2
movss  0xe1f(%rip),%xmm1
addss  %xmm1,%xmm2
movss  -0xc(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inOutQuad>:
push   %rax
divss  %xmm3,%xmm0
addss  %xmm0,%xmm0
movss  0xedf(%rip),%xmm3
ucomiss %xmm0,%xmm3
jbe    1150 <inOutQuad+0x40>
mulss  0xee2(%rip),%xmm2
movss  %xmm2,(%rsp)
mov    $0x2,%edi
movss  %xmm1,0x4(%rsp)
call   1030 <pow@plt>
mulss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
pop    %rax
ret
mulss  0xeac(%rip),%xmm2
movss  0xea8(%rip),%xmm3
movaps %xmm0,%xmm4
addss  %xmm3,%xmm4
addss  0xe9d(%rip),%xmm0
mulss  %xmm4,%xmm0
addss  %xmm3,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @inOutQuad(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
%10 = load float, float* %6
%11 = load float, float* %9
%12 = fdiv float %10, %11
%13 = fmul float %12, 2.000000e+00
store float %13, float* %6
%14 = load float, float* %6
%15 = fcmp olt float %14, 1.000000e+00
br i1 %15, label %16, label %23
16: ; preds = %4
%17 = load float, float* %8
%18 = fdiv float %17, 2.000000e+00
%19 = load float, float* %6
%20 = call float @pow(float %19, i32 2)
%21 = load float, float* %7
%22 = call float @llvm.fmuladd.f32(float %18, float %20, float %21)
store float %22, float* %5
br label %34
23: ; preds = %4
%24 = load float, float* %8
%25 = fneg float %24
%26 = fdiv float %25, 2.000000e+00
%27 = load float, float* %6
%28 = fsub float %27, 1.000000e+00
%29 = load float, float* %6
%30 = fsub float %29, 3.000000e+00
%31 = call float @llvm.fmuladd.f32(float %28, float %30, float -1.000000e+00)
%32 = load float, float* %7
%33 = call float @llvm.fmuladd.f32(float %26, float %31, float %32)
store float %33, float* %5
br label %34
34: ; preds = %23, %16
%35 = load float, float* %5
ret float %35
}

LLVM IR (-O2):
define float @inOutQuad(float %0, float %1, float %2, float %3) {
%5 = fdiv float %0, %3
%6 = fmul float %5, 2.000000e+00
%7 = fcmp olt float %6, 1.000000e+00
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = fmul float %2, 5.000000e-01
%10 = tail call float @pow(float %6, i32 2)
%11 = tail call float @llvm.fmuladd.f32(float %9, float %10, float %1)
br label %18
12: ; preds = %4
%13 = fmul float %2, -5.000000e-01
%14 = fadd float %6, -1.000000e+00
%15 = fadd float %6, -3.000000e+00
%16 = tail call float @llvm.fmuladd.f32(float %14, float %15, float -1.000000e+00)
%17 = tail call float @llvm.fmuladd.f32(float %13, float %16, float %1)
br label %18
18: ; preds = %12, %8
%19 = phi float [ %11, %8 ], [ %17, %12 ]
ret float %19
}