#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 M_PI;
float moduloTwoPI(float angle) {
  if (angle >= 0)
    while (angle > M_PI)
      angle -= 2.0 * M_PI;
  else
    while (angle <= -M_PI)
      angle += 2.0 * M_PI;
  return angle;
}


x86 assembly (clang, -O0):
<moduloTwoPI>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1167 <moduloTwoPI+0x67>
jmp    111f <moduloTwoPI+0x1f>
movss  -0x4(%rbp),%xmm0
mov    0x2ebd(%rip),%rax
ucomiss (%rax),%xmm0
jbe    1162 <moduloTwoPI+0x62>
mov    0x2ead(%rip),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    111f <moduloTwoPI+0x1f>
jmp    11c5 <moduloTwoPI+0xc5>
jmp    116c <moduloTwoPI+0x6c>
movss  -0x4(%rbp),%xmm1
mov    0x2e70(%rip),%rax
movss  (%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
ucomiss %xmm1,%xmm0
jb     11c0 <moduloTwoPI+0xc0>
mov    0x2e4f(%rip),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    116c <moduloTwoPI+0x6c>
jmp    11c5 <moduloTwoPI+0xc5>
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<moduloTwoPI>:
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
mov    0x2edb(%rip),%rax
movss  (%rax),%xmm1
jae    1143 <moduloTwoPI+0x43>
movaps 0xee6(%rip),%xmm2
xorps  %xmm1,%xmm2
ucomiss %xmm0,%xmm2
jb     1161 <moduloTwoPI+0x61>
cvtss2sd %xmm1,%xmm1
addsd  %xmm1,%xmm1
nopw   0x0(%rax,%rax,1)
cvtss2sd %xmm0,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
ucomiss %xmm0,%xmm2
jae    1130 <moduloTwoPI+0x30>
jmp    1161 <moduloTwoPI+0x61>
ucomiss %xmm1,%xmm0
jbe    1161 <moduloTwoPI+0x61>
cvtss2sd %xmm1,%xmm2
addsd  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm0
subsd  %xmm2,%xmm0
cvtsd2ss %xmm0,%xmm0
ucomiss %xmm1,%xmm0
ja     1150 <moduloTwoPI+0x50>
ret

LLVM IR (-O0):
@M_PI = global float 0.000000e+00
define float @moduloTwoPI(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp oge float %3, 0.000000e+00
br i1 %4, label %5, label %18
5: ; preds = %1
br label %6
6: ; preds = %10, %5
%7 = load float, float* %2
%8 = load float, float* @M_PI
%9 = fcmp ogt float %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load float, float* @M_PI
%12 = fpext float %11 to double
%13 = load float, float* %2
%14 = fpext float %13 to double
%15 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %12, double %14)
%16 = fptrunc double %15 to float
store float %16, float* %2
br label %6
17: ; preds = %6
br label %32
18: ; preds = %1
br label %19
19: ; preds = %24, %18
%20 = load float, float* %2
%21 = load float, float* @M_PI
%22 = fneg float %21
%23 = fcmp ole float %20, %22
br i1 %23, label %24, label %31
24: ; preds = %19
%25 = load float, float* @M_PI
%26 = fpext float %25 to double
%27 = load float, float* %2
%28 = fpext float %27 to double
%29 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %26, double %28)
%30 = fptrunc double %29 to float
store float %30, float* %2
br label %19
31: ; preds = %19
br label %32
32: ; preds = %31, %17
%33 = load float, float* %2
ret float %33
}

LLVM IR (-O2):
@M_PI = global float 0.000000e+00
define float @moduloTwoPI(float %0) {
%2 = fcmp ult float %0, 0.000000e+00
%3 = load float, float* @M_PI
br i1 %2, label %8, label %4
4: ; preds = %1
%5 = fcmp olt float %3, %0
br i1 %5, label %6, label %25
6: ; preds = %4
%7 = fpext float %3 to double
br label %13
8: ; preds = %1
%9 = fneg float %3
%10 = fcmp ult float %9, %0
br i1 %10, label %25, label %11
11: ; preds = %8
%12 = fpext float %3 to double
br label %19
13: ; preds = %6, %13
%14 = phi float [ %0, %6 ], [ %17, %13 ]
%15 = fpext float %14 to double
%16 = tail call double @llvm.fmuladd.f64(double %7, double -2.000000e+00, double %15)
%17 = fptrunc double %16 to float
%18 = fcmp olt float %3, %17
br i1 %18, label %13, label %25
19: ; preds = %11, %19
%20 = phi float [ %0, %11 ], [ %23, %19 ]
%21 = fpext float %20 to double
%22 = tail call double @llvm.fmuladd.f64(double %12, double 2.000000e+00, double %21)
%23 = fptrunc double %22 to float
%24 = fcmp ugt float %23, %9
br i1 %24, label %25, label %19
25: ; preds = %13, %19, %4, %8
%26 = phi float [ %0, %8 ], [ %0, %4 ], [ %23, %19 ], [ %17, %13 ]
ret float %26
}