#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 fmod(double, int);
double DeltaRad(double ang1, double ang2) {
  double da = ang1 - ang2;
  if (-3.14159265358979323846 < da && da < 3.14159265358979323846)
    return da;
  else {
    da = fmod(da, 2 * 3.14159265358979323846);
    if (3.14159265358979323846 <= da)
      return da - 2 * 3.14159265358979323846;
    else if (da <= -3.14159265358979323846)
      return da + 2 * 3.14159265358979323846;
    else
      return da;
  }
  return da;
}


x86 assembly (clang, -O0):
<DeltaRad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xec2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    116a <DeltaRad+0x5a>
movsd  0xeb8(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    116a <DeltaRad+0x5a>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e4 <DeltaRad+0xd4>
movsd  -0x20(%rbp),%xmm0
mov    $0x6,%edi
call   1030 <fmod@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe7d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11b0 <DeltaRad+0xa0>
movsd  -0x20(%rbp),%xmm0
movsd  0xe6e(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e4 <DeltaRad+0xd4>
movsd  0xe48(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     11da <DeltaRad+0xca>
movsd  0xe45(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e4 <DeltaRad+0xd4>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DeltaRad>:
push   %rax
subsd  %xmm1,%xmm0
ucomisd 0xee3(%rip),%xmm0
jbe    112f <DeltaRad+0x1f>
movsd  0xee1(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    112f <DeltaRad+0x1f>
pop    %rax
ret
mov    $0x6,%edi
call   1030 <fmod@plt>
ucomisd 0xec7(%rip),%xmm0
jae    115b <DeltaRad+0x4b>
movsd  0xeb5(%rip),%xmm1
ucomisd %xmm0,%xmm1
jb     112d <DeltaRad+0x1d>
addsd  0xebf(%rip),%xmm0
pop    %rax
ret
addsd  0xead(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @DeltaRad(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* %4
%8 = load double, double* %5
%9 = fsub double %7, %8
store double %9, double* %6
%10 = load double, double* %6
%11 = fcmp olt double 0xC00921FB54442D18, %10
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load double, double* %6
%14 = fcmp olt double %13, 0x400921FB54442D18
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = load double, double* %6
store double %16, double* %3
br label %33
17: ; preds = %12, %2
%18 = load double, double* %6
%19 = call double @fmod(double %18, i32 6)
store double %19, double* %6
%20 = load double, double* %6
%21 = fcmp ole double 0x400921FB54442D18, %20
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = load double, double* %6
%24 = fsub double %23, 0x401921FB54442D18
store double %24, double* %3
br label %33
25: ; preds = %17
%26 = load double, double* %6
%27 = fcmp ole double %26, 0xC00921FB54442D18
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load double, double* %6
%30 = fadd double %29, 0x401921FB54442D18
store double %30, double* %3
br label %33
31: ; preds = %25
%32 = load double, double* %6
store double %32, double* %3
br label %33
33: ; preds = %31, %28, %22, %15
%34 = load double, double* %3
ret double %34
}

LLVM IR (-O2):
define double @DeltaRad(double %0, double %1) {
%3 = fsub double %0, %1
%4 = fcmp ogt double %3, 0xC00921FB54442D18
%5 = fcmp olt double %3, 0x400921FB54442D18
%6 = and i1 %4, %5
br i1 %6, label %16, label %7
7: ; preds = %2
%8 = tail call double @fmod(double %3, i32 6)
%9 = fcmp ult double %8, 0x400921FB54442D18
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = fadd double %8, 0xC01921FB54442D18
br label %16
12: ; preds = %7
%13 = fcmp ugt double %8, 0xC00921FB54442D18
br i1 %13, label %16, label %14
14: ; preds = %12
%15 = fadd double %8, 0x401921FB54442D18
br label %16
16: ; preds = %12, %2, %14, %10
%17 = phi double [ %11, %10 ], [ %15, %14 ], [ %3, %2 ], [ %8, %12 ]
ret double %17
}