#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*/ die_errno(char *);
char *path_absolute(char const *);
scalar_t__ strncmp(char const *, char *, int);
char *xstrdup(char const *);
char *file_url_absolute(const char *str) {
  char *absolute;
  if (strncmp(str, "http://", 7) == 0)
    return xstrdup(str);
  absolute = path_absolute(str);
  if (absolute == NULL)
    die_errno("get_current_dir_name");
  return absolute;
}


x86 assembly (clang, -O0):
<file_url_absolute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea9(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    117d <file_url_absolute+0x3d>
mov    -0x10(%rbp),%rdi
call   1050 <xstrdup@plt>
mov    %rax,-0x8(%rbp)
jmp    11a9 <file_url_absolute+0x69>
mov    -0x10(%rbp),%rdi
call   1040 <path_absolute@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11a1 <file_url_absolute+0x61>
lea    0xe6c(%rip),%rdi
call   1060 <die_errno@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_url_absolute>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
mov    %rbx,%rdi
test   %rax,%rax
je     1169 <file_url_absolute+0x29>
call   1040 <path_absolute@plt>
test   %rax,%rax
je     116f <file_url_absolute+0x2f>
pop    %rbx
ret
pop    %rbx
jmp    1050 <xstrdup@plt>
lea    0xe92(%rip),%rdi
call   1060 <die_errno@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"http://\00"
@.str.1 = [21 x i8] c"get_current_dir_name\00"
define i8* @file_url_absolute(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @strncmp(i8* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i8* @xstrdup(i8* %9)
store i8* %10, i8** %2
br label %20
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = call i8* @path_absolute(i8* %12)
store i8* %13, i8** %4
%14 = load i8*, i8** %4
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 @die_errno(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %11
%19 = load i8*, i8** %4
store i8* %19, i8** %2
br label %20
20: ; preds = %18, %8
%21 = load i8*, i8** %2
ret i8* %21
}

LLVM IR (-O2):
@.str = [8 x i8] c"http://\00"
@.str.1 = [21 x i8] c"get_current_dir_name\00"
define i8* @file_url_absolute(i8* %0) {
%2 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i8* @xstrdup(i8* %0)
br label %11
6: ; preds = %1
%7 = tail call i8* @path_absolute(i8* %0)
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @die_errno(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %6, %9, %4
%12 = phi i8* [ %5, %4 ], [ null, %9 ], [ %7, %6 ]
ret i8* %12
}