#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 /*<<< orphan*/ arguments;

/* Variables and functions */
char *roadmap_gps_source();
int /*<<< orphan*/ roadmap_spawn(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
void roadmap_start_console(void) {
  const char *url = roadmap_gps_source();
  if (url == NULL) {
    roadmap_spawn("roadgps", "");
  } else {
    char arguments[1024];
    snprintf(arguments, sizeof(arguments), "--gps=%s", url);
    roadmap_spawn("roadgps", arguments);
  }
}


x86 assembly (clang, -O0):
<roadmap_start_console>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    $0x0,%al
call   1050 <roadmap_gps_source@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1169 <roadmap_start_console+0x39>
lea    0xea8(%rip),%rdi
lea    0xeb1(%rip),%rsi
call   1040 <roadmap_spawn@plt>
jmp    1198 <roadmap_start_console+0x68>
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x400,%esi
lea    0xe88(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x410(%rbp),%rsi
lea    0xe6d(%rip),%rdi
call   1040 <roadmap_spawn@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roadmap_start_console>:
push   %rbx
sub    $0x400,%rsp
xor    %eax,%eax
call   1050 <roadmap_gps_source@plt>
test   %rax,%rax
je     1176 <roadmap_start_console+0x46>
lea    0xebd(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %rax,%rcx
call   1030 <snprintf@plt>
lea    0xe9b(%rip),%rdi
mov    %rbx,%rsi
call   1040 <roadmap_spawn@plt>
add    $0x400,%rsp
pop    %rbx
ret
lea    0xe83(%rip),%rdi
lea    0xe8c(%rip),%rsi
add    $0x400,%rsp
pop    %rbx
jmp    1040 <roadmap_spawn@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"roadgps\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [9 x i8] c"--gps=%s\00"
define void @roadmap_start_console() {
%1 = alloca i8*
%2 = alloca [1024 x i8]
%3 = call i8* (...) @roadmap_gps_source()
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @roadmap_spawn(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %14
8: ; preds = %0
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%10 = load i8*, i8** %1
%11 = call i32 @snprintf(i8* %9, i32 1024, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%13 = call i32 @roadmap_spawn(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %8, %6
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"roadgps\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [9 x i8] c"--gps=%s\00"
define void @roadmap_start_console() {
%1 = alloca [1024 x i8]
%2 = tail call i8* (...) @roadmap_gps_source()
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 @roadmap_spawn(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %10
6: ; preds = %0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%8 = call i32 @snprintf(i8* %7, i32 1024, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%9 = call i32 @roadmap_spawn(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %10
10: ; preds = %6, %4
ret void
}