#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 atan(double);
double exp(double);
double pow(double, int);
double tile2lat(int y, int z) {
  double n = M_PI - 2.0 * M_PI * y / pow(2.0, z);
  return 180.0 / M_PI * atan(0.5 * (exp(n) - exp(-n)));
}


x86 assembly (clang, -O0):
<tile2lat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ea3(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xeba(%rip),%xmm0
mov    0x2e8b(%rip),%rax
mulsd  (%rax),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%edi
movsd  0xe96(%rip),%xmm0
call   1050 <pow@plt>
movsd  -0x30(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe67(%rip),%xmm0
mov    0x2e40(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1040 <exp@plt>
movsd  -0x20(%rbp),%xmm1
subsd  %xmm0,%xmm1
movsd  0xe0e(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <atan@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tile2lat>:
push   %rbx
sub    $0x30,%rsp
mov    0x2eac(%rip),%rbx
movsd  (%rbx),%xmm0
movapd %xmm0,0x10(%rsp)
addsd  %xmm0,%xmm0
cvtsi2sd %edi,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xea0(%rip),%xmm0
mov    %esi,%edi
call   1050 <pow@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd 0x10(%rsp),%xmm0
subsd  %xmm1,%xmm0
movapd %xmm0,0x10(%rsp)
movsd  0xe7f(%rip),%xmm1
divsd  (%rbx),%xmm1
movsd  %xmm1,0x8(%rsp)
call   1040 <exp@plt>
movsd  %xmm0,0x28(%rsp)
movapd 0x10(%rsp),%xmm0
xorpd  0xe74(%rip),%xmm0
call   1040 <exp@plt>
movsd  0x28(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xe4d(%rip),%xmm1
movapd %xmm1,%xmm0
call   1030 <atan@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @tile2lat(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load double, double* @M_PI
%7 = load double, double* @M_PI
%8 = fmul double 2.000000e+00, %7
%9 = load i32, i32* %3
%10 = sitofp i32 %9 to double
%11 = fmul double %8, %10
%12 = load i32, i32* %4
%13 = call double @pow(double 2.000000e+00, i32 %12)
%14 = fdiv double %11, %13
%15 = fsub double %6, %14
store double %15, double* %5
%16 = load double, double* @M_PI
%17 = fdiv double 1.800000e+02, %16
%18 = load double, double* %5
%19 = call double @exp(double %18)
%20 = load double, double* %5
%21 = fneg double %20
%22 = call double @exp(double %21)
%23 = fsub double %19, %22
%24 = fmul double 5.000000e-01, %23
%25 = call double @atan(double %24)
%26 = fmul double %17, %25
ret double %26
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @tile2lat(i32 %0, i32 %1) {
%3 = load double, double* @M_PI
%4 = fmul double %3, 2.000000e+00
%5 = sitofp i32 %0 to double
%6 = fmul double %4, %5
%7 = tail call double @pow(double 2.000000e+00, i32 %1)
%8 = fdiv double %6, %7
%9 = fsub double %3, %8
%10 = load double, double* @M_PI
%11 = fdiv double 1.800000e+02, %10
%12 = tail call double @exp(double %9)
%13 = fneg double %9
%14 = tail call double @exp(double %13)
%15 = fsub double %12, %14
%16 = fmul double %15, 5.000000e-01
%17 = tail call double @atan(double %16)
%18 = fmul double %11, %17
ret double %18
}