#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 fmod(float, float);
float interpolatea(const float s1, const float s2, const float alpha) {
  if (s2 >= s1) {
    float d = fmod(
        (float)(s2 - s1),
        (float)(2 *
                3.141592653589793238462643383279502884197169399375105820974944592308));
    if (d >
        3.141592653589793238462643383279502884197169399375105820974944592308) {
      return s2 +
             (float)((2 * 3.141592653589793238462643383279502884197169399375105820974944592308 -
                      d) *
                     (1 - alpha));
    } else {
      return s1 + (float)(d * alpha);
    }
  } else {
    return interpolatea(s2, s1, 1 - alpha);
  }
}


x86 assembly (clang, -O0):
<interpolatea>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     11df <interpolatea+0xbf>
movss  -0xc(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movss  0xeac(%rip),%xmm1
call   1030 <fmod@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe95(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11be <interpolatea+0x9e>
movss  -0xc(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xe7d(%rip),%xmm1
subsd  %xmm2,%xmm1
movss  0xe61(%rip),%xmm2
subss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1200 <interpolatea+0xe0>
movss  -0x8(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1200 <interpolatea+0xe0>
movss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  0xe0f(%rip),%xmm2
subss  -0x10(%rbp),%xmm2
call   1040 <interpolatea@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<interpolatea>:
sub    $0x18,%rsp
ucomiss %xmm0,%xmm1
jae    114a <interpolatea+0x3a>
movss  0xedf(%rip),%xmm3
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movaps %xmm1,%xmm5
movaps %xmm3,%xmm4
subss  %xmm2,%xmm4
ucomiss %xmm1,%xmm0
movaps %xmm0,%xmm1
movaps %xmm4,%xmm2
movaps %xmm5,%xmm0
jb     1130 <interpolatea+0x20>
jmp    1150 <interpolatea+0x40>
movaps %xmm0,%xmm5
movaps %xmm2,%xmm4
movss  %xmm1,0x10(%rsp)
movss  %xmm4,0xc(%rsp)
movaps %xmm1,%xmm0
movss  %xmm5,0x14(%rsp)
subss  %xmm5,%xmm0
movss  0xe93(%rip),%xmm1
call   1030 <fmod@plt>
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
ucomisd 0xe83(%rip),%xmm1
jbe    11bc <interpolatea+0xac>
movsd  0xe81(%rip),%xmm0
subsd  %xmm1,%xmm0
movss  0xe65(%rip),%xmm1
subss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm0,%xmm1
cvtsd2ss %xmm1,%xmm1
movss  0x10(%rsp),%xmm0
addss  %xmm1,%xmm0
add    $0x18,%rsp
ret
mulss  0xc(%rsp),%xmm0
addss  0x14(%rsp),%xmm0
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define float @interpolatea(float %0, float %1, float %2) {
%4 = fcmp ult float %1, %0
br i1 %4, label %22, label %5
5: ; preds = %22, %3
%6 = phi float [ %0, %3 ], [ %24, %22 ]
%7 = phi float [ %1, %3 ], [ %25, %22 ]
%8 = phi float [ %2, %3 ], [ %26, %22 ]
%9 = fsub float %7, %6
%10 = tail call float @fmod(float %9, float 0x401921FB60000000)
%11 = fpext float %10 to double
%12 = fcmp ogt double %11, 0x400921FB54442D18
br i1 %12, label %13, label %20
13: ; preds = %5
%14 = fsub double 0x401921FB54442D18, %11
%15 = fsub float 1.000000e+00, %8
%16 = fpext float %15 to double
%17 = fmul double %14, %16
%18 = fptrunc double %17 to float
%19 = fadd float %7, %18
br label %28
20: ; preds = %5
%21 = tail call float @llvm.fmuladd.f32(float %10, float %8, float %6)
br label %28
22: ; preds = %3, %22
%23 = phi float [ %26, %22 ], [ %2, %3 ]
%24 = phi float [ %25, %22 ], [ %1, %3 ]
%25 = phi float [ %24, %22 ], [ %0, %3 ]
%26 = fsub float 1.000000e+00, %23
%27 = fcmp ult float %25, %24
br i1 %27, label %22, label %5
28: ; preds = %13, %20
%29 = phi float [ %19, %13 ], [ %21, %20 ]
ret float %29
}