#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*/ is_relpath(char *);
char *scwd();
int /*<<< orphan*/ slcpy(char *, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *);
void make_path_absolute(char *path) {
  static char buf[256];
  if (!is_relpath(path)) {
    return;
  }
  slcpy(buf, path, 256);
  snprintf(path, 256, "%s/%s", scwd(), buf);
}


x86 assembly (clang, -O0):
<make_path_absolute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <is_relpath@plt>
cmp    $0x0,%eax
jne    1163 <make_path_absolute+0x23>
jmp    11a6 <make_path_absolute+0x66>
mov    -0x8(%rbp),%rsi
lea    0x2ee2(%rip),%rdi
mov    $0x100,%edx
call   1040 <slcpy@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <scwd@plt>
mov    -0x10(%rbp),%rdi
mov    %rax,%rcx
mov    $0x100,%esi
lea    0xe66(%rip),%rdx
lea    0x2eaf(%rip),%r8
call   1050 <snprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_path_absolute>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1060 <is_relpath@plt>
test   %eax,%eax
je     118f <make_path_absolute+0x4f>
lea    0x2ef9(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x100,%edx
call   1040 <slcpy@plt>
xor    %eax,%eax
call   1030 <scwd@plt>
lea    0xe8b(%rip),%rdx
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %rax,%rcx
mov    %r14,%r8
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <snprintf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@make_path_absolute.buf = internal global [256 x i8] zeroinitializer
@.str = [6 x i8] c"%s/%s\00"
define void @make_path_absolute(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @is_relpath(i8* %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %1
br label %13
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i32 @slcpy(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @make_path_absolute.buf, i64 0, i64 0), i8* %8, i32 256)
%10 = load i8*, i8** %2
%11 = call i8* (...) @scwd()
%12 = call i32 @snprintf(i8* %10, i32 256, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %11, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @make_path_absolute.buf, i64 0, i64 0))
br label %13
13: ; preds = %7, %6
ret void
}

LLVM IR (-O2):
@make_path_absolute.buf = internal global [256 x i8] zeroinitializer
@.str = [6 x i8] c"%s/%s\00"
define void @make_path_absolute(i8* %0) {
%2 = tail call i32 @is_relpath(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @slcpy(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @make_path_absolute.buf, i64 0, i64 0), i8* %0, i32 256)
%6 = tail call i8* (...) @scwd()
%7 = tail call i32 @snprintf(i8* %0, i32 256, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @make_path_absolute.buf, i64 0, i64 0))
br label %8
8: ; preds = %1, %4
ret void
}