#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 elasticIn(int, float, float, float, int, float);
float elasticOut(int, float, float, float, int, float);
float elasticInOut(float fraction, float start, float delta, float amplitude,
                   int bounces, float damping) {
  if (fraction < 0.5)
    return elasticIn(2 * fraction, start, delta / 2, amplitude, bounces,
                     damping);
  return elasticOut(2 * fraction - 1, start + delta / 2, delta / 2, amplitude,
                    bounces, damping);
}


x86 assembly (clang, -O0):
<elasticInOut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  %xmm3,-0x14(%rbp)
mov    %edi,-0x18(%rbp)
movss  %xmm4,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeab(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11a2 <elasticInOut+0x82>
movss  0xea1(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
cvttss2si %xmm0,%edi
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  0xe86(%rip),%xmm2
divss  %xmm2,%xmm1
movss  -0x14(%rbp),%xmm2
mov    -0x18(%rbp),%esi
movss  -0x1c(%rbp),%xmm3
call   1040 <elasticIn@plt>
movss  %xmm0,-0x4(%rbp)
jmp    11fd <elasticInOut+0xdd>
movss  -0x8(%rbp),%xmm0
addss  %xmm0,%xmm0
movss  0xe59(%rip),%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  0xe3b(%rip),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
movss  0xe26(%rip),%xmm2
divss  %xmm2,%xmm1
movss  -0x14(%rbp),%xmm2
mov    -0x18(%rbp),%esi
movss  -0x1c(%rbp),%xmm3
call   1030 <elasticOut@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<elasticInOut>:
mov    %edi,%esi
movss  0xed6(%rip),%xmm5
ucomiss %xmm0,%xmm5
jbe    1150 <elasticInOut+0x30>
addss  %xmm0,%xmm0
cvttss2si %xmm0,%edi
mulss  0xec1(%rip),%xmm2
movaps %xmm1,%xmm0
movaps %xmm2,%xmm1
movaps %xmm3,%xmm2
movaps %xmm4,%xmm3
jmp    1040 <elasticIn@plt>
addss  %xmm0,%xmm0
addss  0xea8(%rip),%xmm0
cvttss2si %xmm0,%edi
mulss  0xe98(%rip),%xmm2
addss  %xmm2,%xmm1
movaps %xmm1,%xmm0
movaps %xmm2,%xmm1
movaps %xmm3,%xmm2
movaps %xmm4,%xmm3
jmp    1030 <elasticOut@plt>

LLVM IR (-O0):
define float @elasticInOut(float %0, float %1, float %2, float %3, i32 %4, float %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca i32
%13 = alloca float
store float %0, float* %8
store float %1, float* %9
store float %2, float* %10
store float %3, float* %11
store i32 %4, i32* %12
store float %5, float* %13
%14 = load float, float* %8
%15 = fpext float %14 to double
%16 = fcmp olt double %15, 5.000000e-01
br i1 %16, label %17, label %28
17: ; preds = %6
%18 = load float, float* %8
%19 = fmul float 2.000000e+00, %18
%20 = fptosi float %19 to i32
%21 = load float, float* %9
%22 = load float, float* %10
%23 = fdiv float %22, 2.000000e+00
%24 = load float, float* %11
%25 = load i32, i32* %12
%26 = load float, float* %13
%27 = call float @elasticIn(i32 %20, float %21, float %23, float %24, i32 %25, float %26)
store float %27, float* %7
br label %42
28: ; preds = %6
%29 = load float, float* %8
%30 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %29, float -1.000000e+00)
%31 = fptosi float %30 to i32
%32 = load float, float* %9
%33 = load float, float* %10
%34 = fdiv float %33, 2.000000e+00
%35 = fadd float %32, %34
%36 = load float, float* %10
%37 = fdiv float %36, 2.000000e+00
%38 = load float, float* %11
%39 = load i32, i32* %12
%40 = load float, float* %13
%41 = call float @elasticOut(i32 %31, float %35, float %37, float %38, i32 %39, float %40)
store float %41, float* %7
br label %42
42: ; preds = %28, %17
%43 = load float, float* %7
ret float %43
}

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