#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*/ strcpy(char *, int /*<<< orphan*/);
scalar_t__ wfile_absolute_path(char *);
int /*<<< orphan*/ wfile_fullname(char *, char *, char *);
int /*<<< orphan*/ wfile_get_wd();
int /*<<< orphan*/ wfile_noslash(char *, char *);
int /*<<< orphan*/ wfile_remove_dots(char *);
int /*<<< orphan*/ wfile_reslash(char *);
void wfile_make_absolute(char *path) {
  char newpath[512];
  wfile_reslash(path);
  wfile_remove_dots(path);
  if (wfile_absolute_path(path))
    return;
  strcpy(newpath, wfile_get_wd());
  wfile_fullname(newpath, newpath, path);
  wfile_remove_dots(newpath);
  wfile_noslash(path, newpath);
}


x86 assembly (clang, -O0):
<wfile_make_absolute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <wfile_reslash@plt>
mov    -0x8(%rbp),%rdi
call   1080 <wfile_remove_dots@plt>
mov    -0x8(%rbp),%rdi
call   1050 <wfile_absolute_path@plt>
cmp    $0x0,%rax
je     11a9 <wfile_make_absolute+0x39>
jmp    11ff <wfile_make_absolute+0x8f>
lea    -0x210(%rbp),%rax
mov    %rax,-0x218(%rbp)
mov    $0x0,%al
call   1060 <wfile_get_wd@plt>
mov    -0x218(%rbp),%rdi
mov    %eax,%esi
call   1040 <strcpy@plt>
lea    -0x210(%rbp),%rdi
lea    -0x210(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1070 <wfile_fullname@plt>
lea    -0x210(%rbp),%rdi
call   1080 <wfile_remove_dots@plt>
mov    -0x8(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1090 <wfile_noslash@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wfile_make_absolute>:
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %rdi,%rbx
call   1030 <wfile_reslash@plt>
mov    %rbx,%rdi
call   1080 <wfile_remove_dots@plt>
mov    %rbx,%rdi
call   1050 <wfile_absolute_path@plt>
test   %rax,%rax
jne    11cc <wfile_make_absolute+0x5c>
xor    %eax,%eax
call   1060 <wfile_get_wd@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <strcpy@plt>
mov    %r14,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1070 <wfile_fullname@plt>
mov    %r14,%rdi
call   1080 <wfile_remove_dots@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <wfile_noslash@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @wfile_make_absolute(i8* %0) {
%2 = alloca i8*
%3 = alloca [512 x i8]
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @wfile_reslash(i8* %4)
%6 = load i8*, i8** %2
%7 = call i32 @wfile_remove_dots(i8* %6)
%8 = load i8*, i8** %2
%9 = call i64 @wfile_absolute_path(i8* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
br label %25
12: ; preds = %1
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%14 = call i32 (...) @wfile_get_wd()
%15 = call i32 @strcpy(i8* %13, i32 %14)
%16 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%17 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%18 = load i8*, i8** %2
%19 = call i32 @wfile_fullname(i8* %16, i8* %17, i8* %18)
%20 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%21 = call i32 @wfile_remove_dots(i8* %20)
%22 = load i8*, i8** %2
%23 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%24 = call i32 @wfile_noslash(i8* %22, i8* %23)
br label %25
25: ; preds = %12, %11
ret void
}

LLVM IR (-O2):
define void @wfile_make_absolute(i8* %0) {
%2 = alloca [512 x i8]
%3 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @wfile_reslash(i8* %0)
%5 = tail call i32 @wfile_remove_dots(i8* %0)
%6 = tail call i64 @wfile_absolute_path(i8* %0)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = tail call i32 (...) @wfile_get_wd()
%10 = call i32 @strcpy(i8* %3, i32 %9)
%11 = call i32 @wfile_fullname(i8* %3, i8* %3, i8* %0)
%12 = call i32 @wfile_remove_dots(i8* %3)
%13 = call i32 @wfile_noslash(i8* %0, i8* %3)
br label %14
14: ; preds = %1, %8
ret void
}