void test_different_subtree(void) {
  const char *buf;
  buf = make_rel_path("/home/user1///u1dir1", "/home/user2/././/u2dir1/.");
  do {
    seatest_assert_string_equal("../../user1/u1dir1", buf, __FUNCTION__, 77);
  } while (0);
  buf = make_rel_path("/home/file", "/tmp");
  do {
    seatest_assert_string_equal("../home/file", buf, __FUNCTION__, 80);
  } while (0);
}


x86 assembly (clang, -O0):
<test_different_subtree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    0xedf(%rip),%rsi
mov    $0x0,%al
call   1030 <make_rel_path@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xee1(%rip),%rdi
lea    0xeed(%rip),%rdx
mov    $0x4d,%ecx
mov    $0x0,%al
call   1040 <seatest_assert_string_equal@plt>
lea    0xef8(%rip),%rdi
lea    0xeea(%rip),%rsi
mov    $0x0,%al
call   1030 <make_rel_path@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed7(%rip),%rdi
lea    0xeb4(%rip),%rdx
mov    $0x50,%ecx
mov    $0x0,%al
call   1040 <seatest_assert_string_equal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_different_subtree>:
push   %rbx
lea    0xed8(%rip),%rdi
lea    0xee6(%rip),%rsi
xor    %eax,%eax
call   1030 <make_rel_path@plt>
movslq %eax,%rsi
lea    0xeef(%rip),%rdi
lea    0xefb(%rip),%rbx
mov    %rbx,%rdx
mov    $0x4d,%ecx
xor    %eax,%eax
call   1040 <seatest_assert_string_equal@plt>
lea    0xf03(%rip),%rdi
lea    0xef5(%rip),%rsi
xor    %eax,%eax
call   1030 <make_rel_path@plt>
movslq %eax,%rsi
lea    0xee9(%rip),%rdi
mov    %rbx,%rdx
mov    $0x50,%ecx
xor    %eax,%eax
pop    %rbx
jmp    1040 <seatest_assert_string_equal@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"/home/user1///u1dir1\00"
@.str.1 = [26 x i8] c"/home/user2/././/u2dir1/.\00"
@.str.2 = [19 x i8] c"../../user1/u1dir1\00"
@__FUNCTION__.test_different_subtree = [23 x i8] c"test_different_subtree\00"
@.str.3 = [11 x i8] c"/home/file\00"
@.str.4 = [5 x i8] c"/tmp\00"
@.str.5 = [13 x i8] c"../home/file\00"
define void @test_different_subtree() {
%1 = alloca i8*
%2 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @make_rel_path to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %1
br label %5
5: ; preds = %0
%6 = load i8*, i8** %1
%7 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @__FUNCTION__.test_different_subtree, i64 0, i64 0), i32 77)
br label %8
8: ; preds = %5
%9 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @make_rel_path to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %1
br label %12
12: ; preds = %8
%13 = load i8*, i8** %1
%14 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %13, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @__FUNCTION__.test_different_subtree, i64 0, i64 0), i32 80)
br label %15
15: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"/home/user1///u1dir1\00"
@.str.1 = [26 x i8] c"/home/user2/././/u2dir1/.\00"
@.str.2 = [19 x i8] c"../../user1/u1dir1\00"
@__FUNCTION__.test_different_subtree = [23 x i8] c"test_different_subtree\00"
@.str.3 = [11 x i8] c"/home/file\00"
@.str.4 = [5 x i8] c"/tmp\00"
@.str.5 = [13 x i8] c"../home/file\00"
define void @test_different_subtree() {
%1 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @make_rel_path to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%2 = sext i32 %1 to i64
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @__FUNCTION__.test_different_subtree, i64 0, i64 0), i32 77)
%5 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @make_rel_path to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
%8 = tail call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %7, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @__FUNCTION__.test_different_subtree, i64 0, i64 0), i32 80)
ret void
}