#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*/ MAXPATHLEN;
int /*<<< orphan*/ *realpath(char const *, char *);
scalar_t__ strncmp(char const *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ warn(char *, char const *);
int /*<<< orphan*/ warnx(char *, char const *);
void pathadj(const char *input, char *adjusted) {
  if (realpath(input, adjusted) == NULL)
    warn("Warning: realpath %s", input);
  if (strncmp(input, adjusted, MAXPATHLEN)) {
    warnx("\"%s\" is a non-resolved or relative path.", input);
    warnx("using \"%s\" instead.", adjusted);
  }
}


x86 assembly (clang, -O0):
<pathadj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <realpath@plt>
cmp    $0x0,%rax
jne    1177 <pathadj+0x37>
mov    -0x8(%rbp),%rsi
lea    0xe8e(%rip),%rdi
call   1040 <warn@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2e62(%rip),%rax
mov    (%rax),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     11b7 <pathadj+0x77>
mov    -0x8(%rbp),%rsi
lea    0xe73(%rip),%rdi
call   1050 <warnx@plt>
mov    -0x10(%rbp),%rsi
lea    0xe8c(%rip),%rdi
call   1050 <warnx@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pathadj>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1060 <realpath@plt>
test   %rax,%rax
jne    1163 <pathadj+0x23>
lea    0xea5(%rip),%rdi
mov    %rbx,%rsi
call   1040 <warn@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strncmp@plt>
test   %rax,%rax
je     11a1 <pathadj+0x61>
lea    0xe92(%rip),%rdi
mov    %rbx,%rsi
call   1050 <warnx@plt>
lea    0xeac(%rip),%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <warnx@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Warning: realpath %s\00"
@MAXPATHLEN = global i32 0
@.str.1 = [41 x i8] c"\22%s\22 is a non-resolved or relative path.\00"
@.str.2 = [20 x i8] c"using \22%s\22 instead.\00"
define void @pathadj(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32* @realpath(i8* %5, i8* %6)
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = call i32 @warn(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %9, %2
%13 = load i8*, i8** %3
%14 = load i8*, i8** %4
%15 = load i32, i32* @MAXPATHLEN
%16 = call i64 @strncmp(i8* %13, i8* %14, i32 %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %12
%19 = load i8*, i8** %3
%20 = call i32 @warnx(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = load i8*, i8** %4
%22 = call i32 @warnx(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %18, %12
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Warning: realpath %s\00"
@MAXPATHLEN = global i32 0
@.str.1 = [41 x i8] c"\22%s\22 is a non-resolved or relative path.\00"
@.str.2 = [20 x i8] c"using \22%s\22 instead.\00"
define void @pathadj(i8* %0, i8* %1) {
%3 = tail call i32* @realpath(i8* %0, i8* %1)
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @warn(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %5, %2
%8 = load i32, i32* @MAXPATHLEN
%9 = tail call i64 @strncmp(i8* %0, i8* %1, i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %7
%12 = tail call i32 @warnx(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%13 = tail call i32 @warnx(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %1)
br label %14
14: ; preds = %11, %7
ret void
}