#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 M_PI;
int /*<<< orphan*/ norm_angle(float *);
float mix_angles(float first, float second, float interp) {
  float between = second - first;
  if (between > M_PI) {
    between = -(2 * M_PI - between);
  } else if (between < -M_PI) {
    between = 2 * M_PI + between;
  }
  between = first + between * (1 - interp);
  norm_angle(&between);
  return between;
}


x86 assembly (clang, -O0):
<mix_angles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
mov    0x2ea6(%rip),%rax
ucomiss (%rax),%xmm0
jbe    1187 <mix_angles+0x77>
mov    0x2e96(%rip),%rax
movss  (%rax),%xmm0
movss  -0x10(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11cf <mix_angles+0xbf>
movss  -0x10(%rbp),%xmm1
mov    0x2e55(%rip),%rax
movss  (%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
ucomiss %xmm1,%xmm0
jbe    11ca <mix_angles+0xba>
mov    0x2e34(%rip),%rax
movss  (%rax),%xmm0
movss  -0x10(%rbp),%xmm1
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11cf <mix_angles+0xbf>
movss  -0x4(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
movss  0xe1f(%rip),%xmm2
subss  -0xc(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <norm_angle@plt>
movss  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mix_angles>:
push   %rax
subss  %xmm0,%xmm1
mov    0x2ecc(%rip),%rax
movss  (%rax),%xmm3
ucomiss %xmm3,%xmm1
jbe    1139 <mix_angles+0x29>
addss  %xmm3,%xmm3
subss  %xmm1,%xmm3
xorps  0xecc(%rip),%xmm3
movaps %xmm3,%xmm1
jmp    1150 <mix_angles+0x40>
movaps 0xec0(%rip),%xmm4
xorps  %xmm3,%xmm4
ucomiss %xmm1,%xmm4
jbe    1150 <mix_angles+0x40>
addss  %xmm3,%xmm3
addss  %xmm3,%xmm1
movss  0xeb8(%rip),%xmm3
subss  %xmm2,%xmm3
mulss  %xmm1,%xmm3
addss  %xmm0,%xmm3
movss  %xmm3,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <norm_angle@plt>
movss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@M_PI = global float 0.000000e+00
define float @mix_angles(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
store float %10, float* %7
%11 = load float, float* %7
%12 = load float, float* @M_PI
%13 = fcmp ogt float %11, %12
br i1 %13, label %14, label %20
14: ; preds = %3
%15 = load float, float* @M_PI
%16 = load float, float* %7
%17 = fneg float %16
%18 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %15, float %17)
%19 = fneg float %18
store float %19, float* %7
br label %30
20: ; preds = %3
%21 = load float, float* %7
%22 = load float, float* @M_PI
%23 = fneg float %22
%24 = fcmp olt float %21, %23
br i1 %24, label %25, label %29
25: ; preds = %20
%26 = load float, float* @M_PI
%27 = load float, float* %7
%28 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %26, float %27)
store float %28, float* %7
br label %29
29: ; preds = %25, %20
br label %30
30: ; preds = %29, %14
%31 = load float, float* %4
%32 = load float, float* %7
%33 = load float, float* %6
%34 = fsub float 1.000000e+00, %33
%35 = call float @llvm.fmuladd.f32(float %32, float %34, float %31)
store float %35, float* %7
%36 = call i32 @norm_angle(float* %7)
%37 = load float, float* %7
ret float %37
}

LLVM IR (-O2):
@M_PI = global float 0.000000e+00
define float @mix_angles(float %0, float %1, float %2) {
%4 = alloca float
%5 = bitcast float* %4 to i8*
%6 = fsub float %1, %0
%7 = load float, float* @M_PI
%8 = fcmp ogt float %6, %7
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = fneg float %6
%11 = tail call float @llvm.fmuladd.f32(float %7, float 2.000000e+00, float %10)
%12 = fneg float %11
br label %18
13: ; preds = %3
%14 = fneg float %7
%15 = fcmp olt float %6, %14
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call float @llvm.fmuladd.f32(float %7, float 2.000000e+00, float %6)
br label %18
18: ; preds = %13, %16, %9
%19 = phi float [ %6, %13 ], [ %17, %16 ], [ %12, %9 ]
%20 = fsub float 1.000000e+00, %2
%21 = tail call float @llvm.fmuladd.f32(float %19, float %20, float %0)
store float %21, float* %4
%22 = call i32 @norm_angle(float* %4)
%23 = load float, float* %4
ret float %23
}