#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 floor(double);
double limitAngle180between(double L) {
  double F;
  L /= 360.0;
  F = (L - floor(L)) * 360.0;
  if (F < -180)
    F += 360;
  else if (F > 180)
    F -= 360;
  return F;
}


x86 assembly (clang, -O0):
<limitAngle180between>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xede(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  0xead(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe94(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    118e <limitAngle180between+0x7e>
movsd  0xe89(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11c0 <limitAngle180between+0xb0>
movsd  -0x10(%rbp),%xmm0
movsd  0xe75(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11bb <limitAngle180between+0xab>
movsd  -0x10(%rbp),%xmm0
movsd  0xe56(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11c0 <limitAngle180between+0xb0>
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<limitAngle180between>:
push   %rax
divsd  0xee7(%rip),%xmm0
movsd  %xmm0,(%rsp)
call   1030 <floor@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xecc(%rip),%xmm1
movsd  0xecc(%rip),%xmm0
ucomisd %xmm1,%xmm0
movapd %xmm1,%xmm0
jbe    1150 <limitAngle180between+0x40>
addsd  0xeb2(%rip),%xmm0
pop    %rax
ret
ucomisd 0xeb8(%rip),%xmm0
jbe    1162 <limitAngle180between+0x52>
addsd  0xeb6(%rip),%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
define double @limitAngle180between(double %0) {
%2 = fdiv double %0, 3.600000e+02
%3 = tail call double @llvm.floor.f64(double %2)
%4 = fsub double %2, %3
%5 = fmul double %4, 3.600000e+02
%6 = fcmp olt double %5, -1.800000e+02
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = fadd double %5, 3.600000e+02
br label %13
9: ; preds = %1
%10 = fcmp ogt double %5, 1.800000e+02
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = fadd double %5, -3.600000e+02
br label %13
13: ; preds = %9, %11, %7
%14 = phi double [ %8, %7 ], [ %12, %11 ], [ %5, %9 ]
ret double %14
}