#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;
void norm_angle(float *angle) {
  while (*angle > M_PI) {
    *angle -= M_PI * 2;
  }
  while (*angle < -M_PI) {
    *angle += M_PI * 2;
  }
}


x86 assembly (clang, -O0):
<norm_angle>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    0x2ed1(%rip),%rax
ucomiss (%rax),%xmm0
jbe    1152 <norm_angle+0x52>
mov    0x2ec1(%rip),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
movd   %xmm0,%ecx
xor    $0x80000000,%ecx
movd   %ecx,%xmm0
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,(%rax)
jmp    1108 <norm_angle+0x8>
jmp    1157 <norm_angle+0x57>
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    0x2e82(%rip),%rax
movss  (%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
ucomiss %xmm1,%xmm0
jbe    11a4 <norm_angle+0xa4>
mov    0x2e61(%rip),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,(%rax)
jmp    1157 <norm_angle+0x57>
pop    %rbp
ret

x86 assembly (clang, -O2):
<norm_angle>:
movss  (%rdi),%xmm0
mov    0x2edd(%rip),%rax
nopl   0x0(%rax,%rax,1)
movss  (%rax),%xmm1
ucomiss %xmm1,%xmm0
jbe    1127 <norm_angle+0x27>
addss  %xmm1,%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,(%rdi)
jmp    1110 <norm_angle+0x10>
movaps 0xed2(%rip),%xmm2
xorps  %xmm1,%xmm2
ucomiss %xmm0,%xmm2
jbe    115b <norm_angle+0x5b>
movaps 0xec3(%rip),%xmm2
nopl   (%rax)
addss  %xmm1,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,(%rdi)
movss  (%rax),%xmm1
movaps %xmm1,%xmm3
xorps  %xmm2,%xmm3
ucomiss %xmm0,%xmm3
ja     1140 <norm_angle+0x40>
ret

LLVM IR (-O0):
@M_PI = global float 0.000000e+00
define void @norm_angle(float* %0) {
%2 = alloca float*
store float* %0, float** %2
br label %3
3: ; preds = %8, %1
%4 = load float*, float** %2
%5 = load float, float* %4
%6 = load float, float* @M_PI
%7 = fcmp ogt float %5, %6
br i1 %7, label %8, label %14
8: ; preds = %3
%9 = load float, float* @M_PI
%10 = load float*, float** %2
%11 = load float, float* %10
%12 = fneg float %9
%13 = call float @llvm.fmuladd.f32(float %12, float 2.000000e+00, float %11)
store float %13, float* %10
br label %3
14: ; preds = %3
br label %15
15: ; preds = %21, %14
%16 = load float*, float** %2
%17 = load float, float* %16
%18 = load float, float* @M_PI
%19 = fneg float %18
%20 = fcmp olt float %17, %19
br i1 %20, label %21, label %26
21: ; preds = %15
%22 = load float, float* @M_PI
%23 = load float*, float** %2
%24 = load float, float* %23
%25 = call float @llvm.fmuladd.f32(float %22, float 2.000000e+00, float %24)
store float %25, float* %23
br label %15
26: ; preds = %15
ret void
}

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