#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, int);
float AngleSubtract(float a1, float a2) {
  float a;
  a = a1 - a2;
  a = fmod(a, 360);
  while (a > 180) {
    a -= 360;
  }
  while (a < -180) {
    a += 360;
  }
  return a;
}


x86 assembly (clang, -O0):
<AngleSubtract>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
mov    $0x168,%edi
call   1030 <fmod@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xeae(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1176 <AngleSubtract+0x66>
movss  -0xc(%rbp),%xmm0
movss  0xea0(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1145 <AngleSubtract+0x35>
jmp    117b <AngleSubtract+0x6b>
movss  0xe81(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    11a4 <AngleSubtract+0x94>
movss  0xe73(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    117b <AngleSubtract+0x6b>
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AngleSubtract>:
push   %rax
subss  %xmm1,%xmm0
mov    $0x168,%edi
call   1030 <fmod@plt>
ucomiss 0xeda(%rip),%xmm0
jbe    1149 <AngleSubtract+0x39>
movss  0xed4(%rip),%xmm1
movss  0xec8(%rip),%xmm2
nopl   0x0(%rax,%rax,1)
addss  %xmm1,%xmm0
ucomiss %xmm2,%xmm0
ja     1140 <AngleSubtract+0x30>
movss  0xeb7(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1169 <AngleSubtract+0x59>
movss  0xeae(%rip),%xmm2
xchg   %ax,%ax
addss  %xmm2,%xmm0
ucomiss %xmm0,%xmm1
ja     1160 <AngleSubtract+0x50>
pop    %rax
ret

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

LLVM IR (-O2):
define float @AngleSubtract(float %0, float %1) {
%3 = fsub float %0, %1
%4 = tail call float @fmod(float %3, i32 360)
%5 = fcmp ogt float %4, 1.800000e+02
br i1 %5, label %9, label %6
6: ; preds = %9, %2
%7 = phi float [ %4, %2 ], [ %11, %9 ]
%8 = fcmp olt float %7, -1.800000e+02
br i1 %8, label %13, label %17
9: ; preds = %2, %9
%10 = phi float [ %11, %9 ], [ %4, %2 ]
%11 = fadd float %10, -3.600000e+02
%12 = fcmp ogt float %11, 1.800000e+02
br i1 %12, label %9, label %6
13: ; preds = %6, %13
%14 = phi float [ %15, %13 ], [ %7, %6 ]
%15 = fadd float %14, 3.600000e+02
%16 = fcmp olt float %15, -1.800000e+02
br i1 %16, label %13, label %17
17: ; preds = %13, %6
%18 = phi float [ %7, %6 ], [ %15, %13 ]
ret float %18
}