#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*/ PHYSFS_exists(char const *);
int /*<<< orphan*/ PHYSFS_getRealDir(char const *);
char *__PHYSFS_platformCvtToDependent(int /*<<< orphan*/, char const *,
                                      char const *);
int /*<<< orphan*/ __PHYSFS_setError(char *);
char *PHYSFS_getDependentPath(const char *fname) {
  char *retval = NULL;
  if (fname == NULL) {
    __PHYSFS_setError("Invalid argument");
    return 0;
  };
  if (!PHYSFS_exists(fname))
    return NULL;
  if (fname[0] == '/')
    retval =
        __PHYSFS_platformCvtToDependent(PHYSFS_getRealDir(fname), fname, "");
  else
    retval =
        __PHYSFS_platformCvtToDependent(PHYSFS_getRealDir(fname), "/", fname);
  return (retval);
}


x86 assembly (clang, -O0):
<PHYSFS_getDependentPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1178 <PHYSFS_getDependentPath+0x38>
lea    0xe9a(%rip),%rdi
call   1050 <__PHYSFS_setError@plt>
movq   $0x0,-0x8(%rbp)
jmp    11f2 <PHYSFS_getDependentPath+0xb2>
mov    -0x10(%rbp),%rdi
call   1030 <PHYSFS_exists@plt>
cmp    $0x0,%eax
jne    1197 <PHYSFS_getDependentPath+0x57>
movq   $0x0,-0x8(%rbp)
jmp    11f2 <PHYSFS_getDependentPath+0xb2>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    11cb <PHYSFS_getDependentPath+0x8b>
mov    -0x10(%rbp),%rdi
call   1040 <PHYSFS_getRealDir@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
lea    0xe55(%rip),%rdx
call   1060 <__PHYSFS_platformCvtToDependent@plt>
mov    %rax,-0x18(%rbp)
jmp    11ea <PHYSFS_getDependentPath+0xaa>
mov    -0x10(%rbp),%rdi
call   1040 <PHYSFS_getRealDir@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rdx
lea    0xe30(%rip),%rsi
call   1060 <__PHYSFS_platformCvtToDependent@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PHYSFS_getDependentPath>:
push   %rbp
push   %rbx
push   %rax
test   %rdi,%rdi
je     1173 <PHYSFS_getDependentPath+0x33>
mov    %rdi,%rbx
call   1030 <PHYSFS_exists@plt>
test   %eax,%eax
je     117f <PHYSFS_getDependentPath+0x3f>
mov    (%rbx),%bpl
mov    %rbx,%rdi
call   1040 <PHYSFS_getRealDir@plt>
cmp    $0x2f,%bpl
jne    1188 <PHYSFS_getDependentPath+0x48>
lea    0xea6(%rip),%rdx
mov    %eax,%edi
mov    %rbx,%rsi
jmp    1194 <PHYSFS_getDependentPath+0x54>
lea    0xe86(%rip),%rdi
call   1050 <__PHYSFS_setError@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe82(%rip),%rsi
mov    %eax,%edi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <__PHYSFS_platformCvtToDependent@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"Invalid argument\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c"/\00"
define i8* @PHYSFS_getDependentPath(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* null, i8** %4
%5 = load i8*, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @__PHYSFS_setError(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i8* null, i8** %2
br label %32
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i32 @PHYSFS_exists(i8* %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %9
store i8* null, i8** %2
br label %32
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 47
br i1 %19, label %20, label %25
20: ; preds = %14
%21 = load i8*, i8** %3
%22 = call i32 @PHYSFS_getRealDir(i8* %21)
%23 = load i8*, i8** %3
%24 = call i8* @__PHYSFS_platformCvtToDependent(i32 %22, i8* %23, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
store i8* %24, i8** %4
br label %30
25: ; preds = %14
%26 = load i8*, i8** %3
%27 = call i32 @PHYSFS_getRealDir(i8* %26)
%28 = load i8*, i8** %3
%29 = call i8* @__PHYSFS_platformCvtToDependent(i32 %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* %28)
store i8* %29, i8** %4
br label %30
30: ; preds = %25, %20
%31 = load i8*, i8** %4
store i8* %31, i8** %2
br label %32
32: ; preds = %30, %13, %7
%33 = load i8*, i8** %2
ret i8* %33
}

LLVM IR (-O2):
@.str = [17 x i8] c"Invalid argument\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c"/\00"
define i8* @PHYSFS_getDependentPath(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @__PHYSFS_setError(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %16
5: ; preds = %1
%6 = tail call i32 @PHYSFS_exists(i8* %0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %16, label %8
8: ; preds = %5
%9 = load i8, i8* %0
%10 = icmp eq i8 %9, 47
%11 = tail call i32 @PHYSFS_getRealDir(i8* %0)
br i1 %10, label %12, label %14
12: ; preds = %8
%13 = tail call i8* @__PHYSFS_platformCvtToDependent(i32 %11, i8* %0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %16
14: ; preds = %8
%15 = tail call i8* @__PHYSFS_platformCvtToDependent(i32 %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %16
16: ; preds = %12, %14, %5, %3
%17 = phi i8* [ null, %3 ], [ null, %5 ], [ %13, %12 ], [ %15, %14 ]
ret i8* %17
}