#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 DegToRad(double);
double RadToDeg(int /*<<< orphan*/);
int /*<<< orphan*/ atan(int /*<<< orphan*/);
double log(int /*<<< orphan*/);
int /*<<< orphan*/ sinh(double);
int /*<<< orphan*/ tan(double);
double MercatorLatitudeSimple(double lat) {
  if (lat > RadToDeg(atan(sinh(3.14159265358979323846264338327950288))))
    lat = RadToDeg(atan(sinh(3.14159265358979323846264338327950288)));
  if (lat < -RadToDeg(atan(sinh(3.14159265358979323846264338327950288))))
    lat = -RadToDeg(atan(sinh(3.14159265358979323846264338327950288)));
  double phi = DegToRad(lat);
  return log(tan((3.14159265358979323846264338327950288 / 4) + (phi / 2)));
}


x86 assembly (clang, -O0):
<MercatorLatitudeSimple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe81(%rip),%xmm0
call   1040 <sinh@plt>
mov    %eax,%edi
call   1060 <atan@plt>
mov    %eax,%edi
call   1030 <RadToDeg@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11c4 <MercatorLatitudeSimple+0x64>
movsd  0xe54(%rip),%xmm0
call   1040 <sinh@plt>
mov    %eax,%edi
call   1060 <atan@plt>
mov    %eax,%edi
call   1030 <RadToDeg@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe2a(%rip),%xmm0
call   1040 <sinh@plt>
mov    %eax,%edi
call   1060 <atan@plt>
mov    %eax,%edi
call   1030 <RadToDeg@plt>
movsd  -0x20(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
ucomisd %xmm1,%xmm0
jbe    1246 <MercatorLatitudeSimple+0xe6>
movsd  0xde9(%rip),%xmm0
call   1040 <sinh@plt>
mov    %eax,%edi
call   1060 <atan@plt>
mov    %eax,%edi
call   1030 <RadToDeg@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <DegToRad@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  0xdae(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xd9a(%rip),%xmm0
addsd  %xmm1,%xmm0
call   1070 <tan@plt>
mov    %eax,%edi
call   1080 <log@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MercatorLatitudeSimple>:
sub    $0x18,%rsp
movaps %xmm0,(%rsp)
movsd  0xe90(%rip),%xmm0
call   1040 <sinh@plt>
mov    %eax,%edi
call   1060 <atan@plt>
mov    %eax,%edi
call   1030 <RadToDeg@plt>
movapd (%rsp),%xmm1
ucomisd %xmm0,%xmm1
movapd %xmm1,%xmm0
jbe    11ad <MercatorLatitudeSimple+0x4d>
movsd  0xe66(%rip),%xmm0
call   1040 <sinh@plt>
mov    %eax,%edi
call   1060 <atan@plt>
mov    %eax,%edi
call   1030 <RadToDeg@plt>
movapd %xmm0,(%rsp)
movsd  0xe46(%rip),%xmm0
call   1040 <sinh@plt>
mov    %eax,%edi
call   1060 <atan@plt>
mov    %eax,%edi
call   1030 <RadToDeg@plt>
xorpd  0xe4b(%rip),%xmm0
ucomisd (%rsp),%xmm0
movapd (%rsp),%xmm0
jbe    1204 <MercatorLatitudeSimple+0xa4>
movsd  0xe17(%rip),%xmm0
call   1040 <sinh@plt>
mov    %eax,%edi
call   1060 <atan@plt>
mov    %eax,%edi
call   1030 <RadToDeg@plt>
xorpd  0xe1c(%rip),%xmm0
call   1050 <DegToRad@plt>
mulsd  0xdf7(%rip),%xmm0
addsd  0xdf7(%rip),%xmm0
call   1070 <tan@plt>
mov    %eax,%edi
add    $0x18,%rsp
jmp    1080 <log@plt>

LLVM IR (-O0):
define double @MercatorLatitudeSimple(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call i32 @sinh(double 0x400921FB54442D18)
%6 = call i32 @atan(i32 %5)
%7 = call double @RadToDeg(i32 %6)
%8 = fcmp ogt double %4, %7
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = call i32 @sinh(double 0x400921FB54442D18)
%11 = call i32 @atan(i32 %10)
%12 = call double @RadToDeg(i32 %11)
store double %12, double* %2
br label %13
13: ; preds = %9, %1
%14 = load double, double* %2
%15 = call i32 @sinh(double 0x400921FB54442D18)
%16 = call i32 @atan(i32 %15)
%17 = call double @RadToDeg(i32 %16)
%18 = fneg double %17
%19 = fcmp olt double %14, %18
br i1 %19, label %20, label %25
20: ; preds = %13
%21 = call i32 @sinh(double 0x400921FB54442D18)
%22 = call i32 @atan(i32 %21)
%23 = call double @RadToDeg(i32 %22)
%24 = fneg double %23
store double %24, double* %2
br label %25
25: ; preds = %20, %13
%26 = load double, double* %2
%27 = call double @DegToRad(double %26)
store double %27, double* %3
%28 = load double, double* %3
%29 = fdiv double %28, 2.000000e+00
%30 = fadd double 0x3FE921FB54442D18, %29
%31 = call i32 @tan(double %30)
%32 = call double @log(i32 %31)
ret double %32
}

LLVM IR (-O2):
define double @MercatorLatitudeSimple(double %0) {
%2 = tail call i32 @sinh(double 0x400921FB54442D18)
%3 = tail call i32 @atan(i32 %2)
%4 = tail call double @RadToDeg(i32 %3)
%5 = fcmp olt double %4, %0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = tail call i32 @sinh(double 0x400921FB54442D18)
%8 = tail call i32 @atan(i32 %7)
%9 = tail call double @RadToDeg(i32 %8)
br label %10
10: ; preds = %6, %1
%11 = phi double [ %9, %6 ], [ %0, %1 ]
%12 = tail call i32 @sinh(double 0x400921FB54442D18)
%13 = tail call i32 @atan(i32 %12)
%14 = tail call double @RadToDeg(i32 %13)
%15 = fneg double %14
%16 = fcmp olt double %11, %15
br i1 %16, label %17, label %22
17: ; preds = %10
%18 = tail call i32 @sinh(double 0x400921FB54442D18)
%19 = tail call i32 @atan(i32 %18)
%20 = tail call double @RadToDeg(i32 %19)
%21 = fneg double %20
br label %22
22: ; preds = %17, %10
%23 = phi double [ %21, %17 ], [ %11, %10 ]
%24 = tail call double @DegToRad(double %23)
%25 = fmul double %24, 5.000000e-01
%26 = fadd double %25, 0x3FE921FB54442D18
%27 = tail call i32 @tan(double %26)
%28 = tail call double @log(i32 %27)
ret double %28
}