#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 *mmp_str_pathUnixToSys(char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ xfree(char *);
int test_toSysPath(void) {
  char *w;
  if ((w = mmp_str_pathUnixToSys("pub/beer/more")) == NULL)
    return -1;
  if (strcmp(w, "pub/beer/more")) {
    xfree(w);
    return -1;
  }
  xfree(w);
  if ((w = mmp_str_pathUnixToSys("/home/twinky/stuff")) == NULL)
    return -1;
  if (strcmp(w, "/home/twinky/stuff")) {
    xfree(w);
    return -1;
  }
  xfree(w);
  return 0;
}


x86 assembly (clang, -O0):
<test_toSysPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1050 <mmp_str_pathUnixToSys@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    115e <test_toSysPath+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    11fb <test_toSysPath+0xcb>
mov    -0x10(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     118d <test_toSysPath+0x5d>
mov    -0x10(%rbp),%rdi
call   1030 <xfree@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11fb <test_toSysPath+0xcb>
mov    -0x10(%rbp),%rdi
call   1030 <xfree@plt>
lea    0xe71(%rip),%rdi
call   1050 <mmp_str_pathUnixToSys@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    11bc <test_toSysPath+0x8c>
movl   $0xffffffff,-0x4(%rbp)
jmp    11fb <test_toSysPath+0xcb>
mov    -0x10(%rbp),%rdi
lea    0xe47(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11eb <test_toSysPath+0xbb>
mov    -0x10(%rbp),%rdi
call   1030 <xfree@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11fb <test_toSysPath+0xcb>
mov    -0x10(%rbp),%rdi
call   1030 <xfree@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_toSysPath>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
call   1050 <mmp_str_pathUnixToSys@plt>
mov    $0xffffffff,%r15d
test   %rax,%rax
je     11a4 <test_toSysPath+0x74>
mov    %rax,%rbx
lea    0xea8(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcmp@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1030 <xfree@plt>
test   %rbp,%rbp
jne    11a4 <test_toSysPath+0x74>
lea    0xe97(%rip),%rdi
call   1050 <mmp_str_pathUnixToSys@plt>
test   %rax,%rax
je     11a4 <test_toSysPath+0x74>
mov    %rax,%r14
lea    0xe83(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcmp@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <xfree@plt>
neg    %rbx
sbb    %r15d,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"pub/beer/more\00"
@.str.1 = [19 x i8] c"/home/twinky/stuff\00"
define i32 @test_toSysPath() {
%1 = alloca i32
%2 = alloca i8*
%3 = call i8* @mmp_str_pathUnixToSys(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 -1, i32* %1
br label %29
6: ; preds = %0
%7 = load i8*, i8** %2
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i8*, i8** %2
%12 = call i32 @xfree(i8* %11)
store i32 -1, i32* %1
br label %29
13: ; preds = %6
%14 = load i8*, i8** %2
%15 = call i32 @xfree(i8* %14)
%16 = call i8* @mmp_str_pathUnixToSys(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
store i8* %16, i8** %2
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %19
18: ; preds = %13
store i32 -1, i32* %1
br label %29
19: ; preds = %13
%20 = load i8*, i8** %2
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i8*, i8** %2
%25 = call i32 @xfree(i8* %24)
store i32 -1, i32* %1
br label %29
26: ; preds = %19
%27 = load i8*, i8** %2
%28 = call i32 @xfree(i8* %27)
store i32 0, i32* %1
br label %29
29: ; preds = %26, %23, %18, %10, %5
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@.str = [14 x i8] c"pub/beer/more\00"
@.str.1 = [19 x i8] c"/home/twinky/stuff\00"
define i32 @test_toSysPath() {
%1 = tail call i8* @mmp_str_pathUnixToSys(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %15, label %3
3: ; preds = %0
%4 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
%6 = tail call i32 @xfree(i8* %1)
br i1 %5, label %7, label %15
7: ; preds = %3
%8 = tail call i8* @mmp_str_pathUnixToSys(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i8* %8, null
br i1 %9, label %15, label %10
10: ; preds = %7
%11 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp ne i64 %11, 0
%13 = tail call i32 @xfree(i8* %8)
%14 = sext i1 %12 to i32
br label %15
15: ; preds = %10, %3, %7, %0
%16 = phi i32 [ -1, %0 ], [ -1, %7 ], [ -1, %3 ], [ %14, %10 ]
ret i32 %16
}