#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 limitAngle180(double L) {
  double F;
  L /= 180.0;
  F = L - floor(L);
  if (F > 0)
    return 180 * F;
  else if (F < 0)
    return 180 - 180 * F;
  else
    return L;
}


x86 assembly (clang, -O0):
<limitAngle180>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1181 <limitAngle180+0x71>
movsd  0xe8e(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11c0 <limitAngle180+0xb0>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11b6 <limitAngle180+0xa6>
movsd  -0x18(%rbp),%xmm0
movsd  0xe6c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe58(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11c0 <limitAngle180+0xb0>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<limitAngle180>:
push   %rax
divsd  0xee7(%rip),%xmm0
movsd  %xmm0,(%rsp)
call   1030 <floor@plt>
movsd  (%rsp),%xmm2
movapd %xmm0,%xmm1
movapd %xmm2,%xmm0
subsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    114c <limitAngle180+0x3c>
mulsd  0xeba(%rip),%xmm0
movapd %xmm0,%xmm2
jmp    1164 <limitAngle180+0x54>
ucomisd %xmm0,%xmm1
jbe    1164 <limitAngle180+0x54>
mulsd  0xeae(%rip),%xmm0
addsd  0xe9e(%rip),%xmm0
pop    %rax
ret
movapd %xmm2,%xmm0
pop    %rax
ret

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

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