#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 LerpAngle(float from, float to, float frac) {
  float a;
  if (to - from > 180) {
    to -= 360;
  }
  if (to - from < -180) {
    to += 360;
  }
  a = from + frac * (to - from);
  return a;
}


x86 assembly (clang, -O0):
<LerpAngle>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  0xedb(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1144 <LerpAngle+0x44>
movss  -0x8(%rbp),%xmm0
movss  0xec9(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm1
subss  -0x4(%rbp),%xmm1
movss  0xeb2(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    1171 <LerpAngle+0x71>
movss  0xe9d(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
subss  -0x4(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<LerpAngle>:
movaps %xmm1,%xmm3
subss  %xmm0,%xmm3
movss  0xef1(%rip),%xmm4
addss  %xmm1,%xmm4
movss  0xee9(%rip),%xmm5
cmpltss %xmm3,%xmm5
andps  %xmm5,%xmm4
andnps %xmm1,%xmm5
orps   %xmm4,%xmm5
movaps %xmm5,%xmm1
subss  %xmm0,%xmm1
movaps %xmm5,%xmm3
addss  0xecd(%rip),%xmm3
cmpltss 0xec8(%rip),%xmm1
andps  %xmm1,%xmm3
andnps %xmm5,%xmm1
orps   %xmm3,%xmm1
subss  %xmm0,%xmm1
mulss  %xmm2,%xmm1
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @LerpAngle(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%8 = load float, float* %5
%9 = load float, float* %4
%10 = fsub float %8, %9
%11 = fcmp ogt float %10, 1.800000e+02
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load float, float* %5
%14 = fsub float %13, 3.600000e+02
store float %14, float* %5
br label %15
15: ; preds = %12, %3
%16 = load float, float* %5
%17 = load float, float* %4
%18 = fsub float %16, %17
%19 = fcmp olt float %18, -1.800000e+02
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = load float, float* %5
%22 = fadd float %21, 3.600000e+02
store float %22, float* %5
br label %23
23: ; preds = %20, %15
%24 = load float, float* %4
%25 = load float, float* %6
%26 = load float, float* %5
%27 = load float, float* %4
%28 = fsub float %26, %27
%29 = call float @llvm.fmuladd.f32(float %25, float %28, float %24)
store float %29, float* %7
%30 = load float, float* %7
ret float %30
}

LLVM IR (-O2):
define float @LerpAngle(float %0, float %1, float %2) {
%4 = fsub float %1, %0
%5 = fcmp ogt float %4, 1.800000e+02
%6 = fadd float %1, -3.600000e+02
%7 = select i1 %5, float %6, float %1
%8 = fsub float %7, %0
%9 = fcmp olt float %8, -1.800000e+02
%10 = fadd float %7, 3.600000e+02
%11 = select i1 %9, float %10, float %7
%12 = fsub float %11, %0
%13 = tail call float @llvm.fmuladd.f32(float %2, float %12, float %0)
ret float %13
}