#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*/ Q_getwd(char *);
int /*<<< orphan*/ strcat(char *, char const *);
int /*<<< orphan*/ strcpy(char *, char const *);
char *ExpandArg(const char *path) {
  static char full[1024];
  if (path[0] != '/' && path[0] != '\\' && path[1] != ':') {
    Q_getwd(full);
    strcat(full, path);
  } else
    strcpy(full, path);
  return full;
}


x86 assembly (clang, -O0):
<ExpandArg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     118e <ExpandArg+0x5e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
je     118e <ExpandArg+0x5e>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x3a,%eax
je     118e <ExpandArg+0x5e>
lea    0x2edc(%rip),%rdi
call   1050 <Q_getwd@plt>
mov    -0x8(%rbp),%rsi
lea    0x2ecc(%rip),%rdi
call   1040 <strcat@plt>
jmp    119e <ExpandArg+0x6e>
mov    -0x8(%rbp),%rsi
lea    0x2eb7(%rip),%rdi
call   1030 <strcpy@plt>
lea    0x2eab(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ExpandArg>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%al
cmp    $0x2f,%al
je     1147 <ExpandArg+0x17>
cmp    $0x5c,%al
je     1147 <ExpandArg+0x17>
cmpb   $0x3a,0x1(%rbx)
jne    1165 <ExpandArg+0x35>
lea    0x2f02(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0x2ef3(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0x2ee4(%rip),%r14
mov    %r14,%rdi
call   1050 <Q_getwd@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcat@plt>
jmp    1156 <ExpandArg+0x26>

LLVM IR (-O0):
@ExpandArg.full = internal global [1024 x i8] zeroinitializer
define i8* @ExpandArg(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 47
br i1 %7, label %8, label %24
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 92
br i1 %13, label %14, label %24
14: ; preds = %8
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 58
br i1 %19, label %20, label %24
20: ; preds = %14
%21 = call i32 @Q_getwd(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @ExpandArg.full, i64 0, i64 0))
%22 = load i8*, i8** %2
%23 = call i32 @strcat(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @ExpandArg.full, i64 0, i64 0), i8* %22)
br label %27
24: ; preds = %14, %8, %1
%25 = load i8*, i8** %2
%26 = call i32 @strcpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @ExpandArg.full, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %24, %20
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @ExpandArg.full, i64 0, i64 0)
}

LLVM IR (-O2):
@ExpandArg.full = internal global [1024 x i8] zeroinitializer
define i8* @ExpandArg(i8* %0) {
%2 = load i8, i8* %0
switch i8 %2, label %3 [
i8 47, label %10
i8 92, label %10
]
3: ; preds = %1
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 58
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = tail call i32 @Q_getwd(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @ExpandArg.full, i64 0, i64 0))
%9 = tail call i32 @strcat(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @ExpandArg.full, i64 0, i64 0), i8* %0)
br label %12
10: ; preds = %1, %1, %3
%11 = tail call i32 @strcpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @ExpandArg.full, i64 0, i64 0), i8* %0)
br label %12
12: ; preds = %10, %7
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @ExpandArg.full, i64 0, i64 0)
}