#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*/ abs2rel_file_ok(char *, char *, char *, char *);
int /*<<< orphan*/ abs2rel_ok(char *, char *, char *, char *);
void test_004(void) {
  abs2rel_ok("/usr/local/share/dict", "/usr/local/share", "dict", "no up");
  abs2rel_ok("/usr/local/share/dict", "/usr/local/share/doc", "../dict",
             "up, down");
  abs2rel_ok("/usr/local/share/dict/foo", "/usr/local/share/doc/bar",
             "../../dict/foo", "up, up, down, down (abs)");
  abs2rel_ok("dict/foo", "doc/bar", "../../dict/foo",
             "up, up, down, down (rel)");
  abs2rel_ok("/private/tmp", "/", "private/tmp", "close to root");
  abs2rel_file_ok("/private/tmp", "/tmp", "private/tmp", "close to root");
  abs2rel_file_ok("/usr/local/bin/perl", "/usr/bin/perl", "../local/bin/perl",
                  "from file 1");
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xee4(%rip),%rsi
lea    0xf0c(%rip),%rdx
lea    0xee7(%rip),%rcx
call   1040 <abs2rel_ok@plt>
lea    0xeb4(%rip),%rdi
lea    0xeda(%rip),%rsi
lea    0xee8(%rip),%rdx
lea    0xee9(%rip),%rcx
call   1040 <abs2rel_ok@plt>
lea    0xee6(%rip),%rdi
lea    0xef9(%rip),%rsi
lea    0xf0b(%rip),%rdx
lea    0xf13(%rip),%rcx
call   1040 <abs2rel_ok@plt>
lea    0xefe(%rip),%rdi
lea    0xee9(%rip),%rsi
lea    0xeea(%rip),%rdx
lea    0xf0b(%rip),%rcx
call   1040 <abs2rel_ok@plt>
lea    0xf18(%rip),%rdi
lea    0xf1e(%rip),%rsi
lea    0xf0b(%rip),%rdx
lea    0xf12(%rip),%rcx
call   1040 <abs2rel_ok@plt>
lea    0xef7(%rip),%rdi
lea    0xef8(%rip),%rsi
lea    0xeea(%rip),%rdx
lea    0xef1(%rip),%rcx
call   1030 <abs2rel_file_ok@plt>
lea    0xef3(%rip),%rdi
lea    0xf00(%rip),%rsi
lea    0xf07(%rip),%rdx
lea    0xf12(%rip),%rcx
call   1030 <abs2rel_file_ok@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %r15
push   %r14
push   %rbx
lea    0xed4(%rip),%rbx
lea    0xee3(%rip),%rsi
lea    0xf0b(%rip),%rdx
lea    0xee6(%rip),%rcx
mov    %rbx,%rdi
call   1040 <abs2rel_ok@plt>
lea    0xedd(%rip),%rsi
lea    0xeeb(%rip),%rdx
lea    0xeec(%rip),%rcx
mov    %rbx,%rdi
call   1040 <abs2rel_ok@plt>
lea    0xee6(%rip),%rdi
lea    0xef9(%rip),%rsi
lea    0xf0b(%rip),%rbx
lea    0xf13(%rip),%rcx
mov    %rbx,%rdx
call   1040 <abs2rel_ok@plt>
lea    0xefb(%rip),%rdi
lea    0xee6(%rip),%rsi
lea    0xf0f(%rip),%rcx
mov    %rbx,%rdx
call   1040 <abs2rel_ok@plt>
lea    0xf19(%rip),%rbx
lea    0xf1f(%rip),%rsi
lea    0xf0c(%rip),%r14
lea    0xf13(%rip),%r15
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r15,%rcx
call   1040 <abs2rel_ok@plt>
lea    0xef7(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r15,%rcx
call   1030 <abs2rel_file_ok@plt>
lea    0xef7(%rip),%rdi
lea    0xf04(%rip),%rsi
lea    0xf0b(%rip),%rdx
lea    0xf16(%rip),%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <abs2rel_file_ok@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"/usr/local/share/dict\00"
@.str.1 = [17 x i8] c"/usr/local/share\00"
@.str.2 = [5 x i8] c"dict\00"
@.str.3 = [6 x i8] c"no up\00"
@.str.4 = [21 x i8] c"/usr/local/share/doc\00"
@.str.5 = [8 x i8] c"../dict\00"
@.str.6 = [9 x i8] c"up, down\00"
@.str.7 = [26 x i8] c"/usr/local/share/dict/foo\00"
@.str.8 = [25 x i8] c"/usr/local/share/doc/bar\00"
@.str.9 = [15 x i8] c"../../dict/foo\00"
@.str.10 = [25 x i8] c"up, up, down, down (abs)\00"
@.str.11 = [9 x i8] c"dict/foo\00"
@.str.12 = [8 x i8] c"doc/bar\00"
@.str.13 = [25 x i8] c"up, up, down, down (rel)\00"
@.str.14 = [13 x i8] c"/private/tmp\00"
@.str.15 = [2 x i8] c"/\00"
@.str.16 = [12 x i8] c"private/tmp\00"
@.str.17 = [14 x i8] c"close to root\00"
@.str.18 = [5 x i8] c"/tmp\00"
@.str.19 = [20 x i8] c"/usr/local/bin/perl\00"
@.str.20 = [14 x i8] c"/usr/bin/perl\00"
@.str.21 = [18 x i8] c"../local/bin/perl\00"
@.str.22 = [12 x i8] c"from file 1\00"
define void @test_004() {
%1 = call i32 @abs2rel_ok(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%2 = call i32 @abs2rel_ok(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%3 = call i32 @abs2rel_ok(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
%4 = call i32 @abs2rel_ok(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.13, i64 0, i64 0))
%5 = call i32 @abs2rel_ok(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0))
%6 = call i32 @abs2rel_file_ok(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0))
%7 = call i32 @abs2rel_file_ok(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.20, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.22, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"/usr/local/share/dict\00"
@.str.1 = [17 x i8] c"/usr/local/share\00"
@.str.2 = [5 x i8] c"dict\00"
@.str.3 = [6 x i8] c"no up\00"
@.str.4 = [21 x i8] c"/usr/local/share/doc\00"
@.str.5 = [8 x i8] c"../dict\00"
@.str.6 = [9 x i8] c"up, down\00"
@.str.7 = [26 x i8] c"/usr/local/share/dict/foo\00"
@.str.8 = [25 x i8] c"/usr/local/share/doc/bar\00"
@.str.9 = [15 x i8] c"../../dict/foo\00"
@.str.10 = [25 x i8] c"up, up, down, down (abs)\00"
@.str.11 = [9 x i8] c"dict/foo\00"
@.str.12 = [8 x i8] c"doc/bar\00"
@.str.13 = [25 x i8] c"up, up, down, down (rel)\00"
@.str.14 = [13 x i8] c"/private/tmp\00"
@.str.15 = [2 x i8] c"/\00"
@.str.16 = [12 x i8] c"private/tmp\00"
@.str.17 = [14 x i8] c"close to root\00"
@.str.18 = [5 x i8] c"/tmp\00"
@.str.19 = [20 x i8] c"/usr/local/bin/perl\00"
@.str.20 = [14 x i8] c"/usr/bin/perl\00"
@.str.21 = [18 x i8] c"../local/bin/perl\00"
@.str.22 = [12 x i8] c"from file 1\00"
define void @test_004() {
%1 = tail call i32 @abs2rel_ok(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%2 = tail call i32 @abs2rel_ok(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%3 = tail call i32 @abs2rel_ok(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
%4 = tail call i32 @abs2rel_ok(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.13, i64 0, i64 0))
%5 = tail call i32 @abs2rel_ok(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0))
%6 = tail call i32 @abs2rel_file_ok(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0))
%7 = tail call i32 @abs2rel_file_ok(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.20, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.22, i64 0, i64 0))
ret void
}