#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 */
double SFMSanitizeRadians(double);
double SFMDeltaRadians(double a1, double a2) {
  double theta = SFMSanitizeRadians(a2) - SFMSanitizeRadians(a1);
  if (theta < -3.14159265)
    return ((2 * 3.14159265) - a1 + a2);
  else if (theta > 3.14159265)
    return (-((2 * 3.14159265) - a2 + a1));
  else
    return (theta);
}


x86 assembly (clang, -O0):
<SFMDeltaRadians>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <SFMSanitizeRadians@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <SFMSanitizeRadians@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xeac(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    117b <SFMDeltaRadians+0x6b>
movsd  0xea9(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11cf <SFMDeltaRadians+0xbf>
movsd  -0x20(%rbp),%xmm0
movsd  0xe80(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11c5 <SFMDeltaRadians+0xb5>
movsd  0xe76(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11cf <SFMDeltaRadians+0xbf>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SFMDeltaRadians>:
sub    $0x28,%rsp
movsd  %xmm0,(%rsp)
movsd  %xmm1,0x8(%rsp)
movaps %xmm1,%xmm0
call   1030 <SFMSanitizeRadians@plt>
movaps %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1030 <SFMSanitizeRadians@plt>
movapd 0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0xeb8(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1166 <SFMDeltaRadians+0x56>
movsd  0xeba(%rip),%xmm0
subsd  (%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x28,%rsp
ret
movapd %xmm1,%xmm0
movsd  (%rsp),%xmm2
movsd  0x8(%rsp),%xmm1
ucomisd 0xe8b(%rip),%xmm0
jbe    1197 <SFMDeltaRadians+0x87>
movsd  0xe89(%rip),%xmm0
subsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
xorpd  0xe89(%rip),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @SFMDeltaRadians(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
%7 = load double, double* %5
%8 = call double @SFMSanitizeRadians(double %7)
%9 = load double, double* %4
%10 = call double @SFMSanitizeRadians(double %9)
%11 = fsub double %8, %10
store double %11, double* %6
%12 = load double, double* %6
%13 = fcmp olt double %12, 0xC00921FB53C8D4F1
br i1 %13, label %14, label %19
14: ; preds = %2
%15 = load double, double* %4
%16 = fsub double 0x401921FB53C8D4F1, %15
%17 = load double, double* %5
%18 = fadd double %16, %17
store double %18, double* %3
br label %30
19: ; preds = %2
%20 = load double, double* %6
%21 = fcmp ogt double %20, 0x400921FB53C8D4F1
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = load double, double* %5
%24 = fsub double 0x401921FB53C8D4F1, %23
%25 = load double, double* %4
%26 = fadd double %24, %25
%27 = fneg double %26
store double %27, double* %3
br label %30
28: ; preds = %19
%29 = load double, double* %6
store double %29, double* %3
br label %30
30: ; preds = %28, %22, %14
%31 = load double, double* %3
ret double %31
}

LLVM IR (-O2):
define double @SFMDeltaRadians(double %0, double %1) {
%3 = tail call double @SFMSanitizeRadians(double %1)
%4 = tail call double @SFMSanitizeRadians(double %0)
%5 = fsub double %3, %4
%6 = fcmp olt double %5, 0xC00921FB53C8D4F1
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = fsub double 0x401921FB53C8D4F1, %0
%9 = fadd double %8, %1
br label %16
10: ; preds = %2
%11 = fcmp ogt double %5, 0x400921FB53C8D4F1
br i1 %11, label %12, label %16
12: ; preds = %10
%13 = fsub double 0x401921FB53C8D4F1, %1
%14 = fadd double %13, %0
%15 = fneg double %14
br label %16
16: ; preds = %10, %12, %7
%17 = phi double [ %9, %7 ], [ %15, %12 ], [ %5, %10 ]
ret double %17
}