#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 quartIn(int, float, float, float);
float quartOut(int, float, float, float);
float quartInOut(float fraction, float start, float delta, float slope) {
  if (fraction < 0.5)
    return quartIn(2 * fraction, start, delta / 2, slope);
  return quartOut(2 * fraction - 1, start + delta / 2, delta / 2, slope);
}


x86 assembly (clang, -O0):
<quartInOut>:
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
cvtss2sd %xmm0,%xmm1
movsd  0xeb3(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1192 <quartInOut+0x72>
movss  0xea9(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
cvttss2si %xmm0,%edi
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  0xe8e(%rip),%xmm2
divss  %xmm2,%xmm1
movss  -0x14(%rbp),%xmm2
call   1030 <quartIn@plt>
movss  %xmm0,-0x4(%rbp)
jmp    11e5 <quartInOut+0xc5>
movss  -0x8(%rbp),%xmm0
addss  %xmm0,%xmm0
movss  0xe69(%rip),%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  0xe4b(%rip),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
movss  0xe36(%rip),%xmm2
divss  %xmm2,%xmm1
movss  -0x14(%rbp),%xmm2
call   1040 <quartOut@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quartInOut>:
movss  0xed8(%rip),%xmm4
ucomiss %xmm0,%xmm4
jbe    114b <quartInOut+0x2b>
addss  %xmm0,%xmm0
cvttss2si %xmm0,%edi
mulss  0xec3(%rip),%xmm2
movaps %xmm1,%xmm0
movaps %xmm2,%xmm1
movaps %xmm3,%xmm2
jmp    1030 <quartIn@plt>
addss  %xmm0,%xmm0
addss  0xead(%rip),%xmm0
cvttss2si %xmm0,%edi
mulss  0xe9d(%rip),%xmm2
addss  %xmm2,%xmm1
movaps %xmm1,%xmm0
movaps %xmm2,%xmm1
movaps %xmm3,%xmm2
jmp    1040 <quartOut@plt>

LLVM IR (-O0):
define float @quartInOut(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 = fpext float %10 to double
%12 = fcmp olt double %11, 5.000000e-01
br i1 %12, label %13, label %22
13: ; preds = %4
%14 = load float, float* %6
%15 = fmul float 2.000000e+00, %14
%16 = fptosi float %15 to i32
%17 = load float, float* %7
%18 = load float, float* %8
%19 = fdiv float %18, 2.000000e+00
%20 = load float, float* %9
%21 = call float @quartIn(i32 %16, float %17, float %19, float %20)
store float %21, float* %5
br label %34
22: ; preds = %4
%23 = load float, float* %6
%24 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %23, float -1.000000e+00)
%25 = fptosi float %24 to i32
%26 = load float, float* %7
%27 = load float, float* %8
%28 = fdiv float %27, 2.000000e+00
%29 = fadd float %26, %28
%30 = load float, float* %8
%31 = fdiv float %30, 2.000000e+00
%32 = load float, float* %9
%33 = call float @quartOut(i32 %25, float %29, float %31, float %32)
store float %33, float* %5
br label %34
34: ; preds = %22, %13
%35 = load float, float* %5
ret float %35
}

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