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


x86 assembly (clang, -O0):
<sineInOut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeb8(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1188 <sineInOut+0x68>
movss  0xeae(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
cvttss2si %xmm0,%edi
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  0xe93(%rip),%xmm2
divss  %xmm2,%xmm1
call   1040 <sineIn@plt>
movss  %xmm0,-0x4(%rbp)
jmp    11d6 <sineInOut+0xb6>
movss  -0x8(%rbp),%xmm0
addss  %xmm0,%xmm0
movss  0xe73(%rip),%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  0xe55(%rip),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
movss  0xe40(%rip),%xmm2
divss  %xmm2,%xmm1
call   1030 <sineOut@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sineInOut>:
movss  0xed8(%rip),%xmm3
ucomiss %xmm0,%xmm3
jbe    1148 <sineInOut+0x28>
addss  %xmm0,%xmm0
cvttss2si %xmm0,%edi
mulss  0xec3(%rip),%xmm2
movaps %xmm1,%xmm0
movaps %xmm2,%xmm1
jmp    1040 <sineIn@plt>
addss  %xmm0,%xmm0
addss  0xeb0(%rip),%xmm0
cvttss2si %xmm0,%edi
mulss  0xea0(%rip),%xmm2
addss  %xmm2,%xmm1
movaps %xmm1,%xmm0
movaps %xmm2,%xmm1
jmp    1030 <sineOut@plt>

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

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