#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 M_PI;
double wrap(double pixel_value) {
  double wrapped_pixel_value;
  if (pixel_value > M_PI)
    wrapped_pixel_value = pixel_value - (2 * M_PI);
  else if (pixel_value < -M_PI)
    wrapped_pixel_value = pixel_value + (2 * M_PI);
  else
    wrapped_pixel_value = pixel_value;
  return wrapped_pixel_value;
}


x86 assembly (clang, -O0):
<wrap>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    0x2ed3(%rip),%rax
ucomisd (%rax),%xmm0
jbe    1141 <wrap+0x41>
movsd  -0x8(%rbp),%xmm0
mov    0x2ebd(%rip),%rax
movsd  (%rax),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11a3 <wrap+0xa3>
movsd  -0x8(%rbp),%xmm1
mov    0x2e9b(%rip),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
ucomisd %xmm1,%xmm0
jbe    1194 <wrap+0x94>
movsd  -0x8(%rbp),%xmm1
mov    0x2e6a(%rip),%rax
movsd  (%rax),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    119e <wrap+0x9e>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11a3 <wrap+0xa3>
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<wrap>:
mov    0x2ee1(%rip),%rax
movsd  (%rax),%xmm1
ucomisd %xmm1,%xmm0
jbe    111a <wrap+0x1a>
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
ret
movapd 0xede(%rip),%xmm2
xorpd  %xmm1,%xmm2
ucomisd %xmm0,%xmm2
jbe    1138 <wrap+0x38>
addsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

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

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @wrap(double %0) {
%2 = load double, double* @M_PI
%3 = fcmp olt double %2, %0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call double @llvm.fmuladd.f64(double %2, double -2.000000e+00, double %0)
br label %11
6: ; preds = %1
%7 = fneg double %2
%8 = fcmp ogt double %7, %0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call double @llvm.fmuladd.f64(double %2, double 2.000000e+00, double %0)
br label %11
11: ; preds = %6, %9, %4
%12 = phi double [ %5, %4 ], [ %10, %9 ], [ %0, %6 ]
ret double %12
}