#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 */
typedef int uint8_t;

/* Variables and functions */
int atan(float);
float exp(float);
float fabs(float);
float pow(int, float);
float sin(float);
float inverse_isometric_latitude(float lat, float e, float epsilon) {
  float exp_l = exp(lat);
  float phi0 = 2 * atan(exp_l) - (3.14159265358979323846 / 2);
  float phi_;
  uint8_t bound = 3;
  do {
    phi_ = phi0;
    float sin_phi = e * sin(phi_);
    phi0 = 2 * atan(pow((1 + sin_phi) / (1. - sin_phi), e / 2.) * exp_l) -
           (3.14159265358979323846 / 2);
    bound--;
  } while (bound && fabs(phi_ - phi0) > epsilon);
  return phi0;
}


x86 assembly (clang, -O0):
<inverse_isometric_latitude>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
call   1060 <exp@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
call   1050 <atan@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe71(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x3,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  0xe3e(%rip),%xmm0
addss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xe1c(%rip),%xmm1
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdf7(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1070 <pow@plt>
mulss  -0x10(%rbp),%xmm0
call   1050 <atan@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  0xdc9(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x1c(%rbp)
mov    %al,-0x25(%rbp)
je     1275 <inverse_isometric_latitude+0x125>
movss  -0x18(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
call   1030 <fabs@plt>
ucomiss -0xc(%rbp),%xmm0
seta   %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    11a3 <inverse_isometric_latitude+0x53>
movss  -0x14(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inverse_isometric_latitude>:
sub    $0x38,%rsp
movss  %xmm2,0xc(%rsp)
movss  %xmm1,(%rsp)
call   1050 <exp@plt>
movss  %xmm0,0x8(%rsp)
call   1040 <atan@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xe90(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movss  0xe8f(%rip),%xmm1
mulss  (%rsp),%xmm1
movss  %xmm1,0x4(%rsp)
call   1030 <sin@plt>
mulss  (%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
addss  0xe6f(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe57(%rip),%xmm2
subsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
cvttsd2si %xmm0,%edi
movss  0x4(%rsp),%xmm0
call   1060 <pow@plt>
mulss  0x8(%rsp),%xmm0
call   1040 <atan@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xe1c(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movaps 0x20(%rsp),%xmm1
subss  %xmm0,%xmm1
andps  0xe28(%rip),%xmm1
ucomiss 0xc(%rsp),%xmm1
jbe    12d7 <inverse_isometric_latitude+0x197>
movaps %xmm0,0x10(%rsp)
call   1030 <sin@plt>
mulss  (%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
addss  0xdf3(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xddb(%rip),%xmm2
subsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
cvttsd2si %xmm0,%edi
movss  0x4(%rsp),%xmm0
call   1060 <pow@plt>
mulss  0x8(%rsp),%xmm0
call   1040 <atan@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xda0(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movaps 0x10(%rsp),%xmm1
subss  %xmm0,%xmm1
andps  0xdac(%rip),%xmm1
ucomiss 0xc(%rsp),%xmm1
jbe    12d7 <inverse_isometric_latitude+0x197>
call   1030 <sin@plt>
mulss  (%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
addss  0xd80(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd68(%rip),%xmm2
subsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
cvttsd2si %xmm0,%edi
movss  0x4(%rsp),%xmm0
call   1060 <pow@plt>
mulss  0x8(%rsp),%xmm0
call   1040 <atan@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xd2d(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define float @inverse_isometric_latitude(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%12 = load float, float* %4
%13 = call float @exp(float %12)
store float %13, float* %7
%14 = load float, float* %7
%15 = call i32 @atan(float %14)
%16 = mul nsw i32 2, %15
%17 = sitofp i32 %16 to double
%18 = fsub double %17, 0x3FF921FB54442D18
%19 = fptrunc double %18 to float
store float %19, float* %8
store i32 3, i32* %10
br label %20
20: ; preds = %58, %3
%21 = load float, float* %8
store float %21, float* %9
%22 = load float, float* %5
%23 = load float, float* %9
%24 = call float @sin(float %23)
%25 = fmul float %22, %24
store float %25, float* %11
%26 = load float, float* %11
%27 = fadd float 1.000000e+00, %26
%28 = fpext float %27 to double
%29 = load float, float* %11
%30 = fpext float %29 to double
%31 = fsub double 1.000000e+00, %30
%32 = fdiv double %28, %31
%33 = fptosi double %32 to i32
%34 = load float, float* %5
%35 = fpext float %34 to double
%36 = fdiv double %35, 2.000000e+00
%37 = fptrunc double %36 to float
%38 = call float @pow(i32 %33, float %37)
%39 = load float, float* %7
%40 = fmul float %38, %39
%41 = call i32 @atan(float %40)
%42 = mul nsw i32 2, %41
%43 = sitofp i32 %42 to double
%44 = fsub double %43, 0x3FF921FB54442D18
%45 = fptrunc double %44 to float
store float %45, float* %8
%46 = load i32, i32* %10
%47 = add nsw i32 %46, -1
store i32 %47, i32* %10
br label %48
48: ; preds = %20
%49 = load i32, i32* %10
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %58
51: ; preds = %48
%52 = load float, float* %9
%53 = load float, float* %8
%54 = fsub float %52, %53
%55 = call float @fabs(float %54)
%56 = load float, float* %6
%57 = fcmp ogt float %55, %56
br label %58
58: ; preds = %51, %48
%59 = phi i1 [ false, %48 ], [ %57, %51 ]
br i1 %59, label %20, label %60
60: ; preds = %58
%61 = load float, float* %8
ret float %61
}

LLVM IR (-O2):
define float @inverse_isometric_latitude(float %0, float %1, float %2) {
%4 = tail call float @exp(float %0)
%5 = tail call i32 @atan(float %4)
%6 = shl nsw i32 %5, 1
%7 = sitofp i32 %6 to double
%8 = fadd double %7, 0xBFF921FB54442D18
%9 = fptrunc double %8 to float
%10 = fmul float %1, 5.000000e-01
%11 = tail call float @sin(float %9)
%12 = fmul float %11, %1
%13 = fadd float %12, 1.000000e+00
%14 = fpext float %13 to double
%15 = fpext float %12 to double
%16 = fsub double 1.000000e+00, %15
%17 = fdiv double %14, %16
%18 = fptosi double %17 to i32
%19 = tail call float @pow(i32 %18, float %10)
%20 = fmul float %4, %19
%21 = tail call i32 @atan(float %20)
%22 = shl nsw i32 %21, 1
%23 = sitofp i32 %22 to double
%24 = fadd double %23, 0xBFF921FB54442D18
%25 = fptrunc double %24 to float
%26 = fsub float %9, %25
%27 = tail call float @llvm.fabs.f32(float %26)
%28 = fcmp ogt float %27, %2
br i1 %28, label %29, label %64
29: ; preds = %3
%30 = tail call float @sin(float %25)
%31 = fmul float %30, %1
%32 = fadd float %31, 1.000000e+00
%33 = fpext float %32 to double
%34 = fpext float %31 to double
%35 = fsub double 1.000000e+00, %34
%36 = fdiv double %33, %35
%37 = fptosi double %36 to i32
%38 = tail call float @pow(i32 %37, float %10)
%39 = fmul float %4, %38
%40 = tail call i32 @atan(float %39)
%41 = shl nsw i32 %40, 1
%42 = sitofp i32 %41 to double
%43 = fadd double %42, 0xBFF921FB54442D18
%44 = fptrunc double %43 to float
%45 = fsub float %25, %44
%46 = tail call float @llvm.fabs.f32(float %45)
%47 = fcmp ogt float %46, %2
br i1 %47, label %48, label %64
48: ; preds = %29
%49 = tail call float @sin(float %44)
%50 = fmul float %49, %1
%51 = fadd float %50, 1.000000e+00
%52 = fpext float %51 to double
%53 = fpext float %50 to double
%54 = fsub double 1.000000e+00, %53
%55 = fdiv double %52, %54
%56 = fptosi double %55 to i32
%57 = tail call float @pow(i32 %56, float %10)
%58 = fmul float %4, %57
%59 = tail call i32 @atan(float %58)
%60 = shl nsw i32 %59, 1
%61 = sitofp i32 %60 to double
%62 = fadd double %61, 0xBFF921FB54442D18
%63 = fptrunc double %62 to float
br label %64
64: ; preds = %48, %29, %3
%65 = phi float [ %25, %3 ], [ %44, %29 ], [ %63, %48 ]
ret float %65
}