#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 */
char *Realtime_GetServerCookie();
int /*<<< orphan*/ address_append_current_location(char *);
char *roadmap_start_version();
int /*<<< orphan*/ sprintf(char *, char *, char const *, int, char *, char *);
int strlen(char *);
const char *address__prepare_query(const char *address) {
  static char s_current_location[1024];
  sprintf(s_current_location,
          "q=%s&mobile=true&max_results=%d&server_cookie=%s&version=%s",
          address, (13), Realtime_GetServerCookie(), roadmap_start_version());
  address_append_current_location(s_current_location +
                                  strlen(s_current_location));
  return s_current_location;
}


x86 assembly (clang, -O0):
<address__prepare_query>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1050 <Realtime_GetServerCookie@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <roadmap_start_version@plt>
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%r8
mov    %rax,%r9
lea    0x2ed8(%rip),%rdi
lea    0xe71(%rip),%rsi
mov    $0xd,%ecx
call   1070 <sprintf@plt>
lea    0x2ec0(%rip),%rdi
call   1040 <strlen@plt>
cltq
lea    0x2eb2(%rip),%rdi
add    %rax,%rdi
call   1060 <address_append_current_location@plt>
lea    0x2ea3(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<address__prepare_query>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %eax,%eax
call   1050 <Realtime_GetServerCookie@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1030 <roadmap_start_version@plt>
lea    0x2ef0(%rip),%rbx
lea    0xe89(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    $0xd,%ecx
mov    %r15,%r8
mov    %rax,%r9
call   1070 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
call   1060 <address_append_current_location@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@address__prepare_query.s_current_location = internal global [1024 x i8] zeroinitializer
@.str = [60 x i8] c"q=%s&mobile=true&max_results=%d&server_cookie=%s&version=%s\00"
define i8* @address__prepare_query(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* (...) @Realtime_GetServerCookie()
%5 = call i8* (...) @roadmap_start_version()
%6 = call i32 @sprintf(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @address__prepare_query.s_current_location, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* %3, i32 13, i8* %4, i8* %5)
%7 = call i32 @strlen(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @address__prepare_query.s_current_location, i64 0, i64 0))
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @address__prepare_query.s_current_location, i64 0, i64 0), i64 %8
%10 = call i32 @address_append_current_location(i8* %9)
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @address__prepare_query.s_current_location, i64 0, i64 0)
}

LLVM IR (-O2):
@address__prepare_query.s_current_location = internal global [1024 x i8] zeroinitializer
@.str = [60 x i8] c"q=%s&mobile=true&max_results=%d&server_cookie=%s&version=%s\00"
define i8* @address__prepare_query(i8* %0) {
%2 = tail call i8* (...) @Realtime_GetServerCookie()
%3 = tail call i8* (...) @roadmap_start_version()
%4 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([1024 x i8], [1024 x i8]* @address__prepare_query.s_current_location, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* %0, i32 13, i8* %2, i8* %3)
%5 = tail call i32 @strlen(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @address__prepare_query.s_current_location, i64 0, i64 0))
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* @address__prepare_query.s_current_location, i64 0, i64 %6
%8 = tail call i32 @address_append_current_location(i8* %7)
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @address__prepare_query.s_current_location, i64 0, i64 0)
}