#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 /*<<< orphan*/ gm_quadtree(int, int, int, char *);
int lat2tile(double, int);
int long2tile(double, int);
int /*<<< orphan*/ ms_quadtree(int, int, int, char *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int x, y, z = 14;
  double lat = 52.26483, lon = 9.99394;
  char ms_qkey[32];
  char gm_qkey[32];
  x = long2tile(lon, z);
  y = lat2tile(lat, z);
  ms_quadtree(x, y, z, ms_qkey);
  gm_quadtree(x, y, z, gm_qkey);
  printf("http://tile.openstreetmap.org/%d/%d/%d.png\n", z, x, y);
  printf("http://khm0.google.com/kh/v=45&x=%d&s=&y=%d&z=%d\n", x, y, z);
  printf("http://a0.ortho.tiles.virtualearth.net/tiles/a%s.jpeg?g=%d\n",
         ms_qkey, z + 32);
  printf("http://r0.ortho.tiles.virtualearth.net/tiles/r%s.png?g=%d\n", ms_qkey,
         z + 32);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xe,-0x10(%rbp)
movsd  0xe9a(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe85(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%edi
call   1070 <long2tile@plt>
mov    %eax,-0x8(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%edi
call   1060 <lat2tile@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    -0x40(%rbp),%rcx
call   1030 <ms_quadtree@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    -0x60(%rbp),%rcx
call   1040 <gm_quadtree@plt>
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rsi
mov    -0x10(%rbp),%edx
add    $0x20,%edx
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rsi
mov    -0x10(%rbp),%edx
add    $0x20,%edx
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
movsd  0xea0(%rip),%xmm0
mov    $0xe,%edi
call   1070 <long2tile@plt>
mov    %eax,%ebp
movsd  0xe94(%rip),%xmm0
mov    $0xe,%edi
call   1060 <lat2tile@plt>
mov    %eax,%ebx
lea    0x20(%rsp),%r14
mov    %ebp,%edi
mov    %eax,%esi
mov    $0xe,%edx
mov    %r14,%rcx
call   1030 <ms_quadtree@plt>
mov    %rsp,%rcx
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0xe,%edx
call   1040 <gm_quadtree@plt>
lea    0xe62(%rip),%rdi
mov    $0xe,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe77(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    $0xe,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe92(%rip),%rdi
mov    %r14,%rsi
mov    $0x2e,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb8(%rip),%rdi
mov    %r14,%rsi
mov    $0x2e,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [44 x i8] c"http://tile.openstreetmap.org/%d/%d/%d.png\0A\00"
@.str.1 = [50 x i8] c"http://khm0.google.com/kh/v=45&x=%d&s=&y=%d&z=%d\0A\00"
@.str.2 = [60 x i8] c"http://a0.ortho.tiles.virtualearth.net/tiles/a%s.jpeg?g=%d\0A\00"
@.str.3 = [59 x i8] c"http://r0.ortho.tiles.virtualearth.net/tiles/r%s.png?g=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca [32 x i8]
%8 = alloca [32 x i8]
store i32 0, i32* %1
store i32 14, i32* %4
store double 0x404A21E5F30E7FF6, double* %5
store double 9.993940e+00, double* %6
%9 = load double, double* %6
%10 = load i32, i32* %4
%11 = call i32 @long2tile(double %9, i32 %10)
store i32 %11, i32* %2
%12 = load double, double* %5
%13 = load i32, i32* %4
%14 = call i32 @lat2tile(double %12, i32 %13)
store i32 %14, i32* %3
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%19 = call i32 @ms_quadtree(i32 %15, i32 %16, i32 %17, i8* %18)
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%24 = call i32 @gm_quadtree(i32 %20, i32 %21, i32 %22, i8* %23)
%25 = load i32, i32* %4
%26 = load i32, i32* %2
%27 = load i32, i32* %3
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %25, i32 %26, i32 %27)
%29 = load i32, i32* %2
%30 = load i32, i32* %3
%31 = load i32, i32* %4
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i32 %29, i32 %30, i32 %31)
%33 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 32
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0), i8* %33, i32 %35)
%37 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 32
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), i8* %37, i32 %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [44 x i8] c"http://tile.openstreetmap.org/%d/%d/%d.png\0A\00"
@.str.1 = [50 x i8] c"http://khm0.google.com/kh/v=45&x=%d&s=&y=%d&z=%d\0A\00"
@.str.2 = [60 x i8] c"http://a0.ortho.tiles.virtualearth.net/tiles/a%s.jpeg?g=%d\0A\00"
@.str.3 = [59 x i8] c"http://r0.ortho.tiles.virtualearth.net/tiles/r%s.png?g=%d\0A\00"
define i32 @main() {
%1 = alloca [32 x i8]
%2 = alloca [32 x i8]
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @long2tile(double 9.993940e+00, i32 14)
%6 = tail call i32 @lat2tile(double 0x404A21E5F30E7FF6, i32 14)
%7 = call i32 @ms_quadtree(i32 %5, i32 %6, i32 14, i8* %3)
%8 = call i32 @gm_quadtree(i32 %5, i32 %6, i32 14, i8* %4)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 14, i32 %5, i32 %6)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 %6, i32 14)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0), i8* %3, i32 46)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), i8* %3, i32 46)
ret i32 0
}