#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 asprintf(char **, char *, char const *);
int /*<<< orphan*/ free(char *);
int system(char *);
int browser_Open(const char *psz_url) {
  char *psz_open_commandline;
  int i_ret;
  if (asprintf(&psz_open_commandline, "www-browser %s", psz_url) == -1)
    return -1;
  i_ret = system(psz_open_commandline);
  free(psz_open_commandline);
  if (i_ret == 0)
    return 0;
  if (asprintf(&psz_open_commandline, "mozilla %s", psz_url) == -1)
    return -1;
  i_ret = system(psz_open_commandline);
  free(psz_open_commandline);
  return i_ret;
}


x86 assembly (clang, -O0):
<browser_Open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1050 <asprintf@plt>
cmp    $0xffffffff,%eax
jne    1165 <browser_Open+0x35>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d4 <browser_Open+0xa4>
mov    -0x18(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x1c(%rbp)
jne    1190 <browser_Open+0x60>
movl   $0x0,-0x4(%rbp)
jmp    11d4 <browser_Open+0xa4>
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rdi
lea    0xe70(%rip),%rsi
call   1050 <asprintf@plt>
cmp    $0xffffffff,%eax
jne    11b9 <browser_Open+0x89>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d4 <browser_Open+0xa4>
mov    -0x18(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<browser_Open>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xebe(%rip),%rsi
lea    0x8(%rsp),%rdi
mov    %rbx,%rdx
call   1050 <asprintf@plt>
mov    $0xffffffff,%r14d
cmp    $0xffffffff,%eax
je     11a9 <browser_Open+0x79>
mov    0x8(%rsp),%rdi
call   1040 <system@plt>
mov    %eax,%ebp
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
test   %ebp,%ebp
je     11a6 <browser_Open+0x76>
lea    0xe94(%rip),%rsi
lea    0x8(%rsp),%rdi
mov    %rbx,%rdx
call   1050 <asprintf@plt>
cmp    $0xffffffff,%eax
je     11a9 <browser_Open+0x79>
mov    0x8(%rsp),%rdi
call   1040 <system@plt>
mov    %eax,%r14d
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
jmp    11a9 <browser_Open+0x79>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"www-browser %s\00"
@.str.1 = [11 x i8] c"mozilla %s\00"
define i32 @browser_Open(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @asprintf(i8** %4, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 -1, i32* %2
br label %29
10: ; preds = %1
%11 = load i8*, i8** %4
%12 = call i32 @system(i8* %11)
store i32 %12, i32* %5
%13 = load i8*, i8** %4
%14 = call i32 @free(i8* %13)
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %10
store i32 0, i32* %2
br label %29
18: ; preds = %10
%19 = load i8*, i8** %3
%20 = call i32 @asprintf(i8** %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 -1, i32* %2
br label %29
23: ; preds = %18
%24 = load i8*, i8** %4
%25 = call i32 @system(i8* %24)
store i32 %25, i32* %5
%26 = load i8*, i8** %4
%27 = call i32 @free(i8* %26)
%28 = load i32, i32* %5
store i32 %28, i32* %2
br label %29
29: ; preds = %23, %22, %17, %9
%30 = load i32, i32* %2
ret i32 %30
}

LLVM IR (-O2):
@.str = [15 x i8] c"www-browser %s\00"
@.str.1 = [11 x i8] c"mozilla %s\00"
define i32 @browser_Open(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call i32 @asprintf(i8** %2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = icmp eq i32 %4, -1
br i1 %5, label %20, label %6
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @system(i8* %7)
%9 = load i8*, i8** %2
%10 = call i32 @free(i8* %9)
%11 = icmp eq i32 %8, 0
br i1 %11, label %20, label %12
12: ; preds = %6
%13 = call i32 @asprintf(i8** %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%14 = icmp eq i32 %13, -1
br i1 %14, label %20, label %15
15: ; preds = %12
%16 = load i8*, i8** %2
%17 = call i32 @system(i8* %16)
%18 = load i8*, i8** %2
%19 = call i32 @free(i8* %18)
br label %20
20: ; preds = %12, %6, %1, %15
%21 = phi i32 [ %17, %15 ], [ -1, %1 ], [ 0, %6 ], [ -1, %12 ]
ret i32 %21
}