#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 fmod(double const, double);
double GeogLatN(const double l) {
  double l1 = fmod(l, 2.0 * 3.141592653589793238462);
  l1 += (l1 < 0.0) ? 2.0 * 3.141592653589793238462 : 0.0;
  return (l1 > 1.5 * 3.141592653589793238462)
             ? l1 - 2.0 * 3.141592653589793238462
         : (l1 > 1.570796326794896619231) ? 3.141592653589793238462 - l1
                                          : l1;
}


x86 assembly (clang, -O0):
<GeogLatN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xede(%rip),%xmm1
call   1030 <fmod@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xec7(%rip),%xmm3
xorps  %xmm2,%xmm2
cmpltsd %xmm2,%xmm0
movaps %xmm0,%xmm1
andpd  %xmm3,%xmm1
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe91(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1194 <GeogLatN+0x84>
movsd  -0x10(%rbp),%xmm0
movsd  0xe82(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11d6 <GeogLatN+0xc6>
movsd  -0x10(%rbp),%xmm0
movsd  0xe6f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11c2 <GeogLatN+0xb2>
movsd  0xe65(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11cc <GeogLatN+0xbc>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GeogLatN>:
push   %rax
movsd  0xee7(%rip),%xmm1
call   1030 <fmod@plt>
xorpd  %xmm1,%xmm1
movapd %xmm0,%xmm2
cmpltsd %xmm1,%xmm2
movsd  0xecd(%rip),%xmm1
andpd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movsd  0xec5(%rip),%xmm1
addsd  %xmm2,%xmm1
movsd  0xec1(%rip),%xmm0
subsd  %xmm2,%xmm0
movsd  0xebd(%rip),%xmm3
cmpltsd %xmm2,%xmm3
andpd  %xmm3,%xmm0
andnpd %xmm2,%xmm3
orpd   %xmm0,%xmm3
movsd  0xeac(%rip),%xmm0
cmpltsd %xmm2,%xmm0
movapd %xmm0,%xmm2
andnpd %xmm3,%xmm2
andpd  %xmm1,%xmm0
orpd   %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @GeogLatN(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call double @fmod(double %4, double 0x401921FB54442D18)
store double %5, double* %3
%6 = load double, double* %3
%7 = fcmp olt double %6, 0.000000e+00
%8 = zext i1 %7 to i64
%9 = select i1 %7, double 0x401921FB54442D18, double 0.000000e+00
%10 = load double, double* %3
%11 = fadd double %10, %9
store double %11, double* %3
%12 = load double, double* %3
%13 = fcmp ogt double %12, 0x4012D97C7F3321D2
br i1 %13, label %14, label %17
14: ; preds = %1
%15 = load double, double* %3
%16 = fsub double %15, 0x401921FB54442D18
br label %27
17: ; preds = %1
%18 = load double, double* %3
%19 = fcmp ogt double %18, 0x3FF921FB54442D18
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load double, double* %3
%22 = fsub double 0x400921FB54442D18, %21
br label %25
23: ; preds = %17
%24 = load double, double* %3
br label %25
25: ; preds = %23, %20
%26 = phi double [ %22, %20 ], [ %24, %23 ]
br label %27
27: ; preds = %25, %14
%28 = phi double [ %16, %14 ], [ %26, %25 ]
ret double %28
}

LLVM IR (-O2):
define double @GeogLatN(double %0) {
%2 = tail call double @fmod(double %0, double 0x401921FB54442D18)
%3 = fcmp olt double %2, 0.000000e+00
%4 = select i1 %3, double 0x401921FB54442D18, double 0.000000e+00
%5 = fadd double %2, %4
%6 = fcmp ogt double %5, 0x4012D97C7F3321D2
%7 = fadd double %5, 0xC01921FB54442D18
%8 = fcmp ogt double %5, 0x3FF921FB54442D18
%9 = fsub double 0x400921FB54442D18, %5
%10 = select i1 %8, double %9, double %5
%11 = select i1 %6, double %7, double %10
ret double %11
}