#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*/ errAbort(char *, char *, char *);
char *pathRelativeToFile(char *, char *);
int /*<<< orphan*/ verbose(int, char *, char *, char *, char *);
char *mustPathRelativeToFile(char *baseFile, char *relPath) {
  char *path = pathRelativeToFile(baseFile, relPath);
  verbose(3, "baseFile=%s\nrelPath=%s\npath=%s\n", baseFile, relPath, path);
  if (!path)
    errAbort("Too many .. in symlink path %s to make relative to %s\n", relPath,
             baseFile);
  return path;
}


x86 assembly (clang, -O0):
<mustPathRelativeToFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <pathRelativeToFile@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    $0x3,%edi
lea    0xe97(%rip),%rsi
call   1050 <verbose@plt>
cmpq   $0x0,-0x18(%rbp)
jne    118d <mustPathRelativeToFile+0x5d>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xe98(%rip),%rdi
call   1030 <errAbort@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mustPathRelativeToFile>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1040 <pathRelativeToFile@plt>
mov    %rax,%rbx
lea    0xeb6(%rip),%rsi
mov    $0x3,%edi
mov    %r15,%rdx
mov    %r14,%rcx
mov    %rax,%r8
call   1050 <verbose@plt>
test   %rbx,%rbx
jne    1174 <mustPathRelativeToFile+0x44>
lea    0xeb7(%rip),%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <errAbort@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [32 x i8] c"baseFile=%s\0ArelPath=%s\0Apath=%s\0A\00"
@.str.1 = [55 x i8] c"Too many .. in symlink path %s to make relative to %s\0A\00"
define i8* @mustPathRelativeToFile(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i8* @pathRelativeToFile(i8* %6, i8* %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = load i8*, i8** %5
%12 = call i32 @verbose(i32 3, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10, i8* %11)
%13 = load i8*, i8** %5
%14 = icmp ne i8* %13, null
br i1 %14, label %19, label %15
15: ; preds = %2
%16 = load i8*, i8** %4
%17 = load i8*, i8** %3
%18 = call i32 @errAbort(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i8* %16, i8* %17)
br label %19
19: ; preds = %15, %2
%20 = load i8*, i8** %5
ret i8* %20
}

LLVM IR (-O2):
@.str = [32 x i8] c"baseFile=%s\0ArelPath=%s\0Apath=%s\0A\00"
@.str.1 = [55 x i8] c"Too many .. in symlink path %s to make relative to %s\0A\00"
define i8* @mustPathRelativeToFile(i8* %0, i8* %1) {
%3 = tail call i8* @pathRelativeToFile(i8* %0, i8* %1)
%4 = tail call i32 @verbose(i32 3, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i8* %3)
%5 = icmp eq i8* %3, null
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @errAbort(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %0)
br label %8
8: ; preds = %6, %2
ret i8* %3
}