#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;
double atan(int /*<<< orphan*/);
int /*<<< orphan*/ sinh(int);
void tile2latlon(unsigned int x, unsigned int y, int zoom, double *lat,
                 double *lon) {
  unsigned long long n = 1LL << zoom;
  *lon = 360.0 * x / n - 180.0;
  double lat_rad = atan(sinh(M_PI * (1 - 2.0 * y / n)));
  *lat = lat_rad * 180 / M_PI;
}


x86 assembly (clang, -O0):
<tile2latlon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0xc(%rbp),%cl
mov    $0x1,%eax
shl    %cl,%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  0xeb8(%rip),%xmm1
mulsd  %xmm1,%xmm0
movq   -0x28(%rbp),%xmm1
movaps 0xeb8(%rip),%xmm4
punpckldq %xmm4,%xmm1
movapd 0xebc(%rip),%xmm3
subpd  %xmm3,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  0xe89(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    0x2e46(%rip),%rax
cvtsi2sdl (%rax),%xmm0
mov    -0x8(%rbp),%eax
cvtsi2sd %rax,%xmm2
addsd  %xmm2,%xmm2
movq   -0x28(%rbp),%xmm1
punpckldq %xmm4,%xmm1
subpd  %xmm3,%xmm1
movaps %xmm1,%xmm3
unpckhpd %xmm1,%xmm1
addsd  %xmm3,%xmm1
divsd  %xmm1,%xmm2
movsd  0xe32(%rip),%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sinh@plt>
mov    %eax,%edi
call   1040 <atan@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  0xe05(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
mov    0x2de1(%rip),%rax
cvtsi2sdl (%rax),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tile2latlon>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%rax
mov    %edi,%ecx
cvtsi2sd %rcx,%xmm0
mulsd  0xec0(%rip),%xmm0
movq   %rax,%xmm1
punpckldq 0xed3(%rip),%xmm1
subpd  0xedb(%rip),%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
addsd  0xe9b(%rip),%xmm0
movsd  %xmm0,(%r8)
mov    0x2e6f(%rip),%rbx
xorps  %xmm0,%xmm0
cvtsi2sdl (%rbx),%xmm0
mov    %esi,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
addsd  %xmm1,%xmm1
divsd  %xmm2,%xmm1
movsd  0xe76(%rip),%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm2
cvttsd2si %xmm2,%edi
call   1030 <sinh@plt>
mov    %eax,%edi
call   1040 <atan@plt>
mulsd  0xe5e(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl (%rbx),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@M_PI = global i32 0
define void @tile2latlon(i32 %0, i32 %1, i32 %2, double* %3, double* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
%11 = alloca i64
%12 = alloca double
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store double* %3, double** %9
store double* %4, double** %10
%13 = load i32, i32* %8
%14 = zext i32 %13 to i64
%15 = shl i64 1, %14
store i64 %15, i64* %11
%16 = load i32, i32* %6
%17 = uitofp i32 %16 to double
%18 = fmul double 3.600000e+02, %17
%19 = load i64, i64* %11
%20 = uitofp i64 %19 to double
%21 = fdiv double %18, %20
%22 = fsub double %21, 1.800000e+02
%23 = load double*, double** %10
store double %22, double* %23
%24 = load i32, i32* @M_PI
%25 = sitofp i32 %24 to double
%26 = load i32, i32* %7
%27 = uitofp i32 %26 to double
%28 = fmul double 2.000000e+00, %27
%29 = load i64, i64* %11
%30 = uitofp i64 %29 to double
%31 = fdiv double %28, %30
%32 = fsub double 1.000000e+00, %31
%33 = fmul double %25, %32
%34 = fptosi double %33 to i32
%35 = call i32 @sinh(i32 %34)
%36 = call double @atan(i32 %35)
store double %36, double* %12
%37 = load double, double* %12
%38 = fmul double %37, 1.800000e+02
%39 = load i32, i32* @M_PI
%40 = sitofp i32 %39 to double
%41 = fdiv double %38, %40
%42 = load double*, double** %9
store double %41, double* %42
ret void
}

LLVM IR (-O2):
@M_PI = global i32 0
define void @tile2latlon(i32 %0, i32 %1, i32 %2, double* nocapture writeonly %3, double* nocapture writeonly %4) {
%6 = zext i32 %2 to i64
%7 = shl nuw i64 1, %6
%8 = uitofp i32 %0 to double
%9 = fmul double %8, 3.600000e+02
%10 = uitofp i64 %7 to double
%11 = fdiv double %9, %10
%12 = fadd double %11, -1.800000e+02
store double %12, double* %4
%13 = load i32, i32* @M_PI
%14 = sitofp i32 %13 to double
%15 = uitofp i32 %1 to double
%16 = fmul double %15, 2.000000e+00
%17 = fdiv double %16, %10
%18 = fsub double 1.000000e+00, %17
%19 = fmul double %18, %14
%20 = fptosi double %19 to i32
%21 = tail call i32 @sinh(i32 %20)
%22 = tail call double @atan(i32 %21)
%23 = fmul double %22, 1.800000e+02
%24 = load i32, i32* @M_PI
%25 = sitofp i32 %24 to double
%26 = fdiv double %23, %25
store double %26, double* %3
ret void
}