void test_real_path() {
  const char *p2, *p1;
  p1 = real_path("../test/Makefile");
  assert(p1);
  printf("%s\n", p1);
  p1 = real_path("t_path.c");
  assert(p1);
  p1 = strdup(p1);
  p2 = real_path("./t_path.c");
  __assert_str(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/pnx/archived/refs/heads/next/test/t_path.c",
      148, __FUNCTION__, p1, p2);
  free(p1);
}


x86 assembly (clang, -O0):
<test_real_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1040 <real_path@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1060 <assert@plt>
mov    -0x10(%rbp),%rsi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1040 <real_path@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1060 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1080 <strdup@plt>
mov    %rax,-0x10(%rbp)
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <real_path@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%r8
lea    0xe38(%rip),%rdi
mov    $0x94,%esi
lea    0xeb1(%rip),%rdx
mov    $0x0,%al
call   1070 <__assert_str@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_real_path>:
push   %rbx
lea    0xe98(%rip),%rdi
xor    %eax,%eax
call   1040 <real_path@plt>
movslq %eax,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <assert@plt>
mov    %rbx,%rdi
call   1050 <puts@plt>
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1040 <real_path@plt>
movslq %eax,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <assert@plt>
mov    %rbx,%rdi
call   1080 <strdup@plt>
mov    %rax,%rbx
lea    0xe60(%rip),%rdi
xor    %eax,%eax
call   1040 <real_path@plt>
movslq %eax,%r8
lea    0xe5a(%rip),%rdi
lea    0xed8(%rip),%rdx
mov    $0x94,%esi
mov    %rbx,%rcx
xor    %eax,%eax
call   1070 <__assert_str@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"../test/Makefile\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [9 x i8] c"t_path.c\00"
@.str.3 = [11 x i8] c"./t_path.c\00"
@.str.4 = [133 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pnx/archived/refs/heads/next/test/t_path.c\00"
@__FUNCTION__.test_real_path = [15 x i8] c"test_real_path\00"
define void @test_real_path() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @real_path to i32 (i8*, ...)*)(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @assert to i32 (i8*, ...)*)(i8* %6)
%8 = load i8*, i8** %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @real_path to i32 (i8*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %2
%13 = load i8*, i8** %2
%14 = call i32 (i8*, ...) bitcast (i32 (...)* @assert to i32 (i8*, ...)*)(i8* %13)
%15 = load i8*, i8** %2
%16 = call i8* @strdup(i8* %15)
store i8* %16, i8** %2
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @real_path to i32 (i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i8*
store i8* %19, i8** %1
%20 = load i8*, i8** %2
%21 = load i8*, i8** %1
%22 = call i32 (i8*, i32, i8*, i8*, i8*, ...) bitcast (i32 (...)* @__assert_str to i32 (i8*, i32, i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.4, i64 0, i64 0), i32 148, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__.test_real_path, i64 0, i64 0), i8* %20, i8* %21)
%23 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"../test/Makefile\00"
@.str.2 = [9 x i8] c"t_path.c\00"
@.str.3 = [11 x i8] c"./t_path.c\00"
@.str.4 = [133 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pnx/archived/refs/heads/next/test/t_path.c\00"
@__FUNCTION__.test_real_path = [15 x i8] c"test_real_path\00"
define void @test_real_path() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @real_path to i32 (i8*, ...)*)(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = sext i32 %1 to i64
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @assert to i32 (i8*, ...)*)(i8* %3)
%5 = tail call i32 @puts(i8* dereferenceable(1) %3)
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @real_path to i32 (i8*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
%9 = tail call i32 (i8*, ...) bitcast (i32 (...)* @assert to i32 (i8*, ...)*)(i8* %8)
%10 = tail call i8* @strdup(i8* %8)
%11 = tail call i32 (i8*, ...) bitcast (i32 (...)* @real_path to i32 (i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i8*
%14 = tail call i32 (i8*, i32, i8*, i8*, i8*, ...) bitcast (i32 (...)* @__assert_str to i32 (i8*, i32, i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.4, i64 0, i64 0), i32 148, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__.test_real_path, i64 0, i64 0), i8* %10, i8* %13)
tail call void @free(i8* %10)
ret void
}