#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 */
int M_PI;
int atan(int /*<<< orphan*/);
int /*<<< orphan*/ exp(double);
int fabs(double);
double iter_pi(double, double, double);
double lat_from_isometric_lat(double L, double e) {
  double p0 = 2 * atan(exp(L)) - M_PI / 2;
  double pi = p0;
  double pj = iter_pi(pi, L, e);
  while (fabs(pj - pi) > 1e-11) {
    pi = pj;
    pj = iter_pi(pi, L, e);
  }
  return pj;
}


x86 assembly (clang, -O0):
<lat_from_isometric_lat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1060 <exp@plt>
mov    %eax,%edi
call   1050 <atan@plt>
shl    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    0x2e78(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
call   1030 <iter_pi@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
call   1040 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe38(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11fa <lat_from_isometric_lat+0xba>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
call   1030 <iter_pi@plt>
movsd  %xmm0,-0x28(%rbp)
jmp    11ad <lat_from_isometric_lat+0x6d>
movsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lat_from_isometric_lat>:
sub    $0x28,%rsp
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x18(%rsp)
call   1060 <exp@plt>
mov    %eax,%edi
call   1050 <atan@plt>
add    %eax,%eax
mov    0x2e83(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
add    %ecx,%edx
sar    %edx
sub    %edx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
call   1030 <iter_pi@plt>
movsd  %xmm0,0x8(%rsp)
subsd  0x10(%rsp),%xmm0
call   1040 <fabs@plt>
test   %eax,%eax
jle    11ef <lat_from_isometric_lat+0xaf>
movsd  0x8(%rsp),%xmm1
nopl   0x0(%rax,%rax,1)
movapd %xmm1,%xmm0
movsd  %xmm1,0x8(%rsp)
movsd  0x18(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
call   1030 <iter_pi@plt>
movsd  %xmm0,0x10(%rsp)
subsd  0x8(%rsp),%xmm0
call   1040 <fabs@plt>
movsd  0x10(%rsp),%xmm0
movapd %xmm0,%xmm1
test   %eax,%eax
jg     11b0 <lat_from_isometric_lat+0x70>
add    $0x28,%rsp
ret
movsd  0x8(%rsp),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@M_PI = global i32 0
define double @lat_from_isometric_lat(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %3
store double %1, double* %4
%8 = load double, double* %3
%9 = call i32 @exp(double %8)
%10 = call i32 @atan(i32 %9)
%11 = mul nsw i32 2, %10
%12 = load i32, i32* @M_PI
%13 = sdiv i32 %12, 2
%14 = sub nsw i32 %11, %13
%15 = sitofp i32 %14 to double
store double %15, double* %5
%16 = load double, double* %5
store double %16, double* %6
%17 = load double, double* %6
%18 = load double, double* %3
%19 = load double, double* %4
%20 = call double @iter_pi(double %17, double %18, double %19)
store double %20, double* %7
br label %21
21: ; preds = %28, %2
%22 = load double, double* %7
%23 = load double, double* %6
%24 = fsub double %22, %23
%25 = call i32 @fabs(double %24)
%26 = sitofp i32 %25 to double
%27 = fcmp ogt double %26, 0x3DA5FD7FE1796495
br i1 %27, label %28, label %34
28: ; preds = %21
%29 = load double, double* %7
store double %29, double* %6
%30 = load double, double* %6
%31 = load double, double* %3
%32 = load double, double* %4
%33 = call double @iter_pi(double %30, double %31, double %32)
store double %33, double* %7
br label %21
34: ; preds = %21
%35 = load double, double* %7
ret double %35
}

LLVM IR (-O2):
@M_PI = global i32 0
define double @lat_from_isometric_lat(double %0, double %1) {
%3 = tail call i32 @exp(double %0)
%4 = tail call i32 @atan(i32 %3)
%5 = shl nsw i32 %4, 1
%6 = load i32, i32* @M_PI
%7 = sdiv i32 %6, -2
%8 = add i32 %7, %5
%9 = sitofp i32 %8 to double
%10 = tail call double @iter_pi(double %9, double %0, double %1)
%11 = fsub double %10, %9
%12 = tail call i32 @fabs(double %11)
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %2, %14
%15 = phi double [ %16, %14 ], [ %10, %2 ]
%16 = tail call double @iter_pi(double %15, double %0, double %1)
%17 = fsub double %16, %15
%18 = tail call i32 @fabs(double %17)
%19 = icmp sgt i32 %18, 0
br i1 %19, label %14, label %20
20: ; preds = %14, %2
%21 = phi double [ %10, %2 ], [ %16, %14 ]
ret double %21
}