#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*/ getcwd(char *, int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void mpeg3io_complete_path(char *complete_path, char *path) {
  if (path[0] != '/') {
    char current_dir[1024];
    getcwd(current_dir, 1024);
    sprintf(complete_path, "%s/%s", current_dir, path);
  } else
    strcpy(complete_path, path);
}


x86 assembly (clang, -O0):
<mpeg3io_complete_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     1184 <mpeg3io_complete_path+0x54>
lea    -0x410(%rbp),%rdi
mov    $0x400,%esi
call   1040 <getcwd@plt>
mov    -0x8(%rbp),%rdi
lea    -0x410(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe86(%rip),%rsi
call   1050 <sprintf@plt>
jmp    1191 <mpeg3io_complete_path+0x61>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpeg3io_complete_path>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
cmpb   $0x2f,(%rsi)
jne    115e <mpeg3io_complete_path+0x2e>
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <strcpy@plt>
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x400,%esi
call   1040 <getcwd@plt>
lea    0xe8b(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
mov    %rbx,%rcx
call   1050 <sprintf@plt>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s/%s\00"
define void @mpeg3io_complete_path(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [1024 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 47
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%13 = call i32 @getcwd(i8* %12, i32 1024)
%14 = load i8*, i8** %3
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%16 = load i8*, i8** %4
%17 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %16)
br label %22
18: ; preds = %2
%19 = load i8*, i8** %3
%20 = load i8*, i8** %4
%21 = call i32 @strcpy(i8* %19, i8* %20)
br label %22
22: ; preds = %18, %11
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s/%s\00"
define void @mpeg3io_complete_path(i8* %0, i8* %1) {
%3 = alloca [1024 x i8]
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 47
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = call i32 @getcwd(i8* %7, i32 1024)
%9 = call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %1)
br label %12
10: ; preds = %2
%11 = tail call i32 @strcpy(i8* %0, i8* %1)
br label %12
12: ; preds = %10, %6
ret void
}