#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 PATH_MAX;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, ...);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ *realpath(char const *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
char *strdup(char const *);
char *strerror(int /*<<< orphan*/);
int strlen(char *);
char *strrchr(char *, char);
char *fuse_mnt_resolve_path(const char *progname, const char *orig) {
  char buf[PATH_MAX];
  char *copy;
  char *dst;
  char *end;
  char *lastcomp;
  const char *toresolv;
  if (!orig[0]) {
    fprintf(stderr, "%s: invalid mountpoint '%s'\n", progname, orig);
    return NULL;
  }
  copy = strdup(orig);
  if (copy == NULL) {
    fprintf(stderr, "%s: failed to allocate memory\n", progname);
    return NULL;
  }
  toresolv = copy;
  lastcomp = NULL;
  for (end = copy + strlen(copy) - 1; end > copy && *end == '/'; end--)
    ;
  if (end[0] != '/') {
    char *tmp;
    end[1] = '\0';
    tmp = strrchr(copy, '/');
    if (tmp == NULL) {
      lastcomp = copy;
      toresolv = ".";
    } else {
      lastcomp = tmp + 1;
      if (tmp == copy)
        toresolv = "/";
    }
    if (strcmp(lastcomp, ".") == 0 || strcmp(lastcomp, "..") == 0) {
      lastcomp = NULL;
      toresolv = copy;
    } else if (tmp)
      tmp[0] = '\0';
  }
  if (realpath(toresolv, buf) == NULL) {
    fprintf(stderr, "%s: bad mount point %s: %s\n", progname, orig,
            strerror(errno));
    free(copy);
    return NULL;
  }
  if (lastcomp == NULL)
    dst = strdup(buf);
  else {
    dst = (char *)malloc(strlen(buf) + 1 + strlen(lastcomp) + 1);
    if (dst) {
      unsigned buflen = strlen(buf);
      if (buflen && buf[buflen - 1] == '/')
        sprintf(dst, "%s%s", buf, lastcomp);
      else
        sprintf(dst, "%s/%s", buf, lastcomp);
    }
  }
  free(copy);
  if (dst == NULL)
    fprintf(stderr, "%s: failed to allocate memory\n", progname);
  return dst;
}


x86 assembly (clang, -O0):
<fuse_mnt_resolve_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2e36(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x70(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
jne    121f <fuse_mnt_resolve_path+0x7f>
mov    0x2de5(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xdfc(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movq   $0x0,-0x8(%rbp)
movl   $0x1,-0x54(%rbp)
jmp    154f <fuse_mnt_resolve_path+0x3af>
mov    -0x18(%rbp),%rdi
call   10b0 <strdup@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1266 <fuse_mnt_resolve_path+0xc6>
mov    0x2d9a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xdd2(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movq   $0x0,-0x8(%rbp)
movl   $0x1,-0x54(%rbp)
jmp    154f <fuse_mnt_resolve_path+0x3af>
mov    -0x30(%rbp),%rax
mov    %rax,-0x50(%rbp)
movq   $0x0,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x78(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rcx
xor    %eax,%eax
cmp    -0x30(%rbp),%rcx
mov    %al,-0x79(%rbp)
jbe    12be <fuse_mnt_resolve_path+0x11e>
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
sete   %al
mov    %al,-0x79(%rbp)
mov    -0x79(%rbp),%al
test   $0x1,%al
jne    12ce <fuse_mnt_resolve_path+0x12e>
jmp    12e4 <fuse_mnt_resolve_path+0x144>
jmp    12d3 <fuse_mnt_resolve_path+0x133>
mov    -0x40(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x40(%rbp)
jmp    129b <fuse_mnt_resolve_path+0xfb>
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     13c0 <fuse_mnt_resolve_path+0x220>
mov    -0x40(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x30(%rbp),%rdi
mov    $0x2f,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    1331 <fuse_mnt_resolve_path+0x191>
mov    -0x30(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    0xd17(%rip),%rax
mov    %rax,-0x50(%rbp)
jmp    135b <fuse_mnt_resolve_path+0x1bb>
mov    -0x60(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
mov    -0x60(%rbp),%rax
cmp    -0x30(%rbp),%rax
jne    1356 <fuse_mnt_resolve_path+0x1b6>
lea    0xcea(%rip),%rax
mov    %rax,-0x50(%rbp)
jmp    135b <fuse_mnt_resolve_path+0x1bb>
mov    -0x48(%rbp),%rdi
lea    0xcd9(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     138f <fuse_mnt_resolve_path+0x1ef>
mov    -0x48(%rbp),%rdi
lea    0xcbe(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    13a4 <fuse_mnt_resolve_path+0x204>
movq   $0x0,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x50(%rbp)
jmp    13bb <fuse_mnt_resolve_path+0x21b>
cmpq   $0x0,-0x60(%rbp)
je     13b6 <fuse_mnt_resolve_path+0x216>
mov    -0x60(%rbp),%rax
movb   $0x0,(%rax)
jmp    13bb <fuse_mnt_resolve_path+0x21b>
jmp    13c0 <fuse_mnt_resolve_path+0x220>
mov    -0x70(%rbp),%rsi
mov    -0x50(%rbp),%rdi
call   1080 <realpath@plt>
cmp    $0x0,%rax
jne    144c <fuse_mnt_resolve_path+0x2ac>
mov    0x2bfa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x94(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    0x2bcd(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x94(%rbp),%edi
mov    -0x90(%rbp),%rdx
mov    -0x88(%rbp),%rcx
mov    %rax,%r8
lea    0xc19(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
movl   $0x1,-0x54(%rbp)
jmp    154f <fuse_mnt_resolve_path+0x3af>
cmpq   $0x0,-0x48(%rbp)
jne    1469 <fuse_mnt_resolve_path+0x2c9>
mov    -0x70(%rbp),%rdi
call   10b0 <strdup@plt>
mov    %rax,-0x38(%rbp)
jmp    1511 <fuse_mnt_resolve_path+0x371>
mov    -0x70(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
mov    -0x48(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x98(%rbp),%edi
add    %eax,%edi
add    $0x1,%edi
call   1090 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     150c <fuse_mnt_resolve_path+0x36c>
mov    -0x70(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0x0,-0x64(%rbp)
je     14ef <fuse_mnt_resolve_path+0x34f>
mov    -0x70(%rbp),%rax
mov    -0x64(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    14ef <fuse_mnt_resolve_path+0x34f>
mov    -0x70(%rbp),%rdx
mov    -0x38(%rbp),%rdi
mov    -0x48(%rbp),%rcx
lea    0xb78(%rip),%rsi
call   10a0 <sprintf@plt>
jmp    1507 <fuse_mnt_resolve_path+0x367>
mov    -0x70(%rbp),%rdx
mov    -0x38(%rbp),%rdi
mov    -0x48(%rbp),%rcx
lea    0xb60(%rip),%rsi
call   10a0 <sprintf@plt>
jmp    150c <fuse_mnt_resolve_path+0x36c>
jmp    1511 <fuse_mnt_resolve_path+0x371>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x38(%rbp)
jne    1540 <fuse_mnt_resolve_path+0x3a0>
mov    0x2aac(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xae4(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x54(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x8(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fuse_mnt_resolve_path>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%r12
mov    0x2e32(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r15
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
cmpb   $0x0,(%rsi)
je     1216 <fuse_mnt_resolve_path+0x76>
mov    %r14,%rdi
call   10b0 <strdup@plt>
test   %rax,%rax
je     13c7 <fuse_mnt_resolve_path+0x227>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <strlen@plt>
cltq
lea    (%rax,%rbx,1),%rcx
add    $0xffffffffffffffff,%rcx
mov    %r14,-0x50(%rbp)
mov    %rcx,%rax
movzbl (%rcx),%edx
cmp    %rbx,%rcx
jbe    123b <fuse_mnt_resolve_path+0x9b>
lea    -0x1(%rax),%rcx
cmp    $0x2f,%dl
je     1200 <fuse_mnt_resolve_path+0x60>
jmp    124e <fuse_mnt_resolve_path+0xae>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
lea    0xdda(%rip),%rsi
xor    %r13d,%r13d
mov    %r12,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    13e4 <fuse_mnt_resolve_path+0x244>
cmp    $0x2f,%dl
jne    124e <fuse_mnt_resolve_path+0xae>
xor    %eax,%eax
mov    %rax,-0x30(%rbp)
mov    %rbx,%r13
jmp    12e6 <fuse_mnt_resolve_path+0x146>
mov    %r12,-0x38(%rbp)
movb   $0x0,0x1(%rax)
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1050 <strrchr@plt>
mov    %rax,%r14
cmp    %rbx,%rax
lea    0xdcc(%rip),%rax
cmovne %rbx,%rax
mov    %rax,-0x48(%rbp)
lea    0x1(%r14),%r12
test   %r14,%r14
mov    %r12,-0x40(%rbp)
cmove  %rbx,%r12
lea    0xdb1(%rip),%r13
mov    %r12,%rdi
mov    %r13,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12d9 <fuse_mnt_resolve_path+0x139>
lea    0xd99(%rip),%rsi
mov    %r12,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
cmovne %rbx,%rax
mov    %rax,-0x30(%rbp)
cmove  %rbx,%r13
je     12e2 <fuse_mnt_resolve_path+0x142>
test   %r14,%r14
mov    -0x38(%rbp),%r12
je     12e6 <fuse_mnt_resolve_path+0x146>
movb   $0x0,(%r14)
mov    -0x40(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x48(%rbp),%r13
jmp    12e6 <fuse_mnt_resolve_path+0x146>
xor    %eax,%eax
mov    %rax,-0x30(%rbp)
mov    %rbx,%r13
mov    -0x38(%rbp),%r12
mov    %r13,%rdi
mov    %r15,%rsi
call   1080 <realpath@plt>
test   %rax,%rax
je     134d <fuse_mnt_resolve_path+0x1ad>
mov    -0x30(%rbp),%r13
test   %r13,%r13
je     138d <fuse_mnt_resolve_path+0x1ed>
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %eax,%r14d
mov    %r13,%rdi
call   1040 <strlen@plt>
lea    (%r14,%rax,1),%edi
add    $0x2,%edi
call   1090 <malloc@plt>
test   %rax,%rax
je     13bf <fuse_mnt_resolve_path+0x21f>
mov    %rax,%r13
mov    %r15,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
je     139a <fuse_mnt_resolve_path+0x1fa>
add    $0xffffffff,%eax
cmpb   $0x2f,(%r15,%rax,1)
jne    139a <fuse_mnt_resolve_path+0x1fa>
lea    0xd12(%rip),%rsi
jmp    13a1 <fuse_mnt_resolve_path+0x201>
mov    0x2c84(%rip),%rax
mov    (%rax),%r14d
mov    0x2c72(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xcd5(%rip),%rsi
xor    %r13d,%r13d
mov    %r14d,%edi
mov    %r12,%rdx
mov    -0x50(%rbp),%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    13e4 <fuse_mnt_resolve_path+0x244>
mov    %r15,%rdi
call   10b0 <strdup@plt>
mov    %rax,%r13
jmp    13b0 <fuse_mnt_resolve_path+0x210>
lea    0xcc1(%rip),%rsi
mov    %r13,%rdi
mov    %r15,%rdx
mov    -0x30(%rbp),%rcx
call   10a0 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
test   %r13,%r13
jne    13e4 <fuse_mnt_resolve_path+0x244>
jmp    13c7 <fuse_mnt_resolve_path+0x227>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x2c0a(%rip),%rax
mov    (%rax),%edi
lea    0xc46(%rip),%rsi
xor    %r13d,%r13d
mov    %r12,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r13,%rax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@PATH_MAX = global i32 0
@stderr = global i32 0
@.str = [29 x i8] c"%s: invalid mountpoint '%s'\0A\00"
@.str.1 = [31 x i8] c"%s: failed to allocate memory\0A\00"
@.str.2 = [2 x i8] c".\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [3 x i8] c"..\00"
@.str.5 = [28 x i8] c"%s: bad mount point %s: %s\0A\00"
@errno = global i32 0
@.str.6 = [5 x i8] c"%s%s\00"
@.str.7 = [6 x i8] c"%s/%s\00"
define i8* @fuse_mnt_resolve_path(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%16 = load i32, i32* @PATH_MAX
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %6
%19 = alloca i8, i64 %17
store i64 %17, i64* %7
%20 = load i8*, i8** %5
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = icmp ne i8 %22, 0
br i1 %23, label %29, label %24
24: ; preds = %2
%25 = load i32, i32* @stderr
%26 = load i8*, i8** %4
%27 = load i8*, i8** %5
%28 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %26, i8* %27)
store i8* null, i8** %3
store i32 1, i32* %13
br label %164
29: ; preds = %2
%30 = load i8*, i8** %5
%31 = call i8* @strdup(i8* %30)
store i8* %31, i8** %8
%32 = load i8*, i8** %8
%33 = icmp eq i8* %32, null
br i1 %33, label %34, label %38
34: ; preds = %29
%35 = load i32, i32* @stderr
%36 = load i8*, i8** %4
%37 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %36)
store i8* null, i8** %3
store i32 1, i32* %13
br label %164
38: ; preds = %29
%39 = load i8*, i8** %8
store i8* %39, i8** %12
store i8* null, i8** %11
%40 = load i8*, i8** %8
%41 = load i8*, i8** %8
%42 = call i32 @strlen(i8* %41)
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %40, i64 %43
%45 = getelementptr inbounds i8, i8* %44, i64 -1
store i8* %45, i8** %10
br label %46
46: ; preds = %58, %38
%47 = load i8*, i8** %10
%48 = load i8*, i8** %8
%49 = icmp ugt i8* %47, %48
br i1 %49, label %50, label %55
50: ; preds = %46
%51 = load i8*, i8** %10
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = icmp eq i32 %53, 47
br label %55
55: ; preds = %50, %46
%56 = phi i1 [ false, %46 ], [ %54, %50 ]
br i1 %56, label %57, label %61
57: ; preds = %55
br label %58
58: ; preds = %57
%59 = load i8*, i8** %10
%60 = getelementptr inbounds i8, i8* %59, i32 -1
store i8* %60, i8** %10
br label %46
61: ; preds = %55
%62 = load i8*, i8** %10
%63 = getelementptr inbounds i8, i8* %62, i64 0
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp ne i32 %65, 47
br i1 %66, label %67, label %102
67: ; preds = %61
%68 = load i8*, i8** %10
%69 = getelementptr inbounds i8, i8* %68, i64 1
store i8 0, i8* %69
%70 = load i8*, i8** %8
%71 = call i8* @strrchr(i8* %70, i8 signext 47)
store i8* %71, i8** %14
%72 = load i8*, i8** %14
%73 = icmp eq i8* %72, null
br i1 %73, label %74, label %76
74: ; preds = %67
%75 = load i8*, i8** %8
store i8* %75, i8** %11
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %12
br label %84
76: ; preds = %67
%77 = load i8*, i8** %14
%78 = getelementptr inbounds i8, i8* %77, i64 1
store i8* %78, i8** %11
%79 = load i8*, i8** %14
%80 = load i8*, i8** %8
%81 = icmp eq i8* %79, %80
br i1 %81, label %82, label %83
82: ; preds = %76
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8** %12
br label %83
83: ; preds = %82, %76
br label %84
84: ; preds = %83, %74
%85 = load i8*, i8** %11
%86 = call i64 @strcmp(i8* %85, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%87 = icmp eq i64 %86, 0
br i1 %87, label %92, label %88
88: ; preds = %84
%89 = load i8*, i8** %11
%90 = call i64 @strcmp(i8* %89, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%91 = icmp eq i64 %90, 0
br i1 %91, label %92, label %94
92: ; preds = %88, %84
store i8* null, i8** %11
%93 = load i8*, i8** %8
store i8* %93, i8** %12
br label %101
94: ; preds = %88
%95 = load i8*, i8** %14
%96 = icmp ne i8* %95, null
br i1 %96, label %97, label %100
97: ; preds = %94
%98 = load i8*, i8** %14
%99 = getelementptr inbounds i8, i8* %98, i64 0
store i8 0, i8* %99
br label %100
100: ; preds = %97, %94
br label %101
101: ; preds = %100, %92
br label %102
102: ; preds = %101, %61
%103 = load i8*, i8** %12
%104 = call i32* @realpath(i8* %103, i8* %19)
%105 = icmp eq i32* %104, null
br i1 %105, label %106, label %115
106: ; preds = %102
%107 = load i32, i32* @stderr
%108 = load i8*, i8** %4
%109 = load i8*, i8** %5
%110 = load i32, i32* @errno
%111 = call i8* @strerror(i32 %110)
%112 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* %108, i8* %109, i8* %111)
%113 = load i8*, i8** %8
%114 = call i32 @free(i8* %113)
store i8* null, i8** %3
store i32 1, i32* %13
br label %164
115: ; preds = %102
%116 = load i8*, i8** %11
%117 = icmp eq i8* %116, null
br i1 %117, label %118, label %120
118: ; preds = %115
%119 = call i8* @strdup(i8* %19)
store i8* %119, i8** %9
br label %153
120: ; preds = %115
%121 = call i32 @strlen(i8* %19)
%122 = add nsw i32 %121, 1
%123 = load i8*, i8** %11
%124 = call i32 @strlen(i8* %123)
%125 = add nsw i32 %122, %124
%126 = add nsw i32 %125, 1
%127 = call i64 @malloc(i32 %126)
%128 = inttoptr i64 %127 to i8*
store i8* %128, i8** %9
%129 = load i8*, i8** %9
%130 = icmp ne i8* %129, null
br i1 %130, label %131, label %152
131: ; preds = %120
%132 = call i32 @strlen(i8* %19)
store i32 %132, i32* %15
%133 = load i32, i32* %15
%134 = icmp ne i32 %133, 0
br i1 %134, label %135, label %147
135: ; preds = %131
%136 = load i32, i32* %15
%137 = sub i32 %136, 1
%138 = zext i32 %137 to i64
%139 = getelementptr inbounds i8, i8* %19, i64 %138
%140 = load i8, i8* %139
%141 = sext i8 %140 to i32
%142 = icmp eq i32 %141, 47
br i1 %142, label %143, label %147
143: ; preds = %135
%144 = load i8*, i8** %9
%145 = load i8*, i8** %11
%146 = call i32 @sprintf(i8* %144, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %19, i8* %145)
br label %151
147: ; preds = %135, %131
%148 = load i8*, i8** %9
%149 = load i8*, i8** %11
%150 = call i32 @sprintf(i8* %148, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %19, i8* %149)
br label %151
151: ; preds = %147, %143
br label %152
152: ; preds = %151, %120
br label %153
153: ; preds = %152, %118
%154 = load i8*, i8** %8
%155 = call i32 @free(i8* %154)
%156 = load i8*, i8** %9
%157 = icmp eq i8* %156, null
br i1 %157, label %158, label %162
158: ; preds = %153
%159 = load i32, i32* @stderr
%160 = load i8*, i8** %4
%161 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %159, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %160)
br label %162
162: ; preds = %158, %153
%163 = load i8*, i8** %9
store i8* %163, i8** %3
store i32 1, i32* %13
br label %164
164: ; preds = %162, %106, %34, %24
%165 = load i8*, i8** %6
%166 = load i8*, i8** %3
ret i8* %166
}

LLVM IR (-O2):
@PATH_MAX = global i32 0
@stderr = global i32 0
@.str = [29 x i8] c"%s: invalid mountpoint '%s'\0A\00"
@.str.1 = [31 x i8] c"%s: failed to allocate memory\0A\00"
@.str.2 = [2 x i8] c".\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [3 x i8] c"..\00"
@.str.5 = [28 x i8] c"%s: bad mount point %s: %s\0A\00"
@errno = global i32 0
@.str.6 = [5 x i8] c"%s%s\00"
@.str.7 = [6 x i8] c"%s/%s\00"
define i8* @fuse_mnt_resolve_path(i8* %0, i8* %1) {
%3 = load i32, i32* @PATH_MAX
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = load i8, i8* %1
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
br label %90
11: ; preds = %2
%12 = tail call i8* @strdup(i8* %1)
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i32, i32* @stderr
%16 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %90
17: ; preds = %11
%18 = tail call i32 @strlen(i8* %12)
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %12, i64 %19
br label %21
21: ; preds = %27, %17
%22 = phi i8* [ %20, %17 ], [ %23, %27 ]
%23 = getelementptr inbounds i8, i8* %22, i64 -1
%24 = icmp ugt i8* %23, %12
%25 = load i8, i8* %23
%26 = icmp eq i8 %25, 47
br i1 %24, label %27, label %28
27: ; preds = %21
br i1 %26, label %21, label %29
28: ; preds = %21
br i1 %26, label %45, label %29
29: ; preds = %27, %28
store i8 0, i8* %22
%30 = tail call i8* @strrchr(i8* %12, i8 signext 47)
%31 = icmp eq i8* %30, null
%32 = getelementptr inbounds i8, i8* %30, i64 1
%33 = icmp eq i8* %30, %12
%34 = select i1 %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* %12
%35 = select i1 %31, i8* %12, i8* %32
%36 = tail call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %45, label %38
38: ; preds = %29
%39 = tail call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
%41 = select i1 %40, i1 true, i1 %31
%42 = select i1 %40, i8* null, i8* %12
%43 = select i1 %40, i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
br i1 %41, label %45, label %44
44: ; preds = %38
store i8 0, i8* %30
br label %45
45: ; preds = %38, %44, %29, %28
%46 = phi i8* [ null, %28 ], [ %32, %44 ], [ %42, %38 ], [ null, %29 ]
%47 = phi i8* [ %12, %28 ], [ %34, %44 ], [ %43, %38 ], [ %12, %29 ]
%48 = call i32* @realpath(i8* %47, i8* %5)
%49 = icmp eq i32* %48, null
br i1 %49, label %50, label %56
50: ; preds = %45
%51 = load i32, i32* @stderr
%52 = load i32, i32* @errno
%53 = call i8* @strerror(i32 %52)
%54 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* %0, i8* %1, i8* %53)
%55 = call i32 @free(i8* %12)
br label %90
56: ; preds = %45
%57 = icmp eq i8* %46, null
br i1 %57, label %58, label %60
58: ; preds = %56
%59 = call i8* @strdup(i8* %5)
br label %83
60: ; preds = %56
%61 = call i32 @strlen(i8* %5)
%62 = call i32 @strlen(i8* %46)
%63 = add i32 %61, 2
%64 = add i32 %63, %62
%65 = call i64 @malloc(i32 %64)
%66 = inttoptr i64 %65 to i8*
%67 = icmp eq i64 %65, 0
br i1 %67, label %68, label %70
68: ; preds = %60
%69 = call i32 @free(i8* %12)
br label %87
70: ; preds = %60
%71 = call i32 @strlen(i8* %5)
%72 = icmp eq i32 %71, 0
br i1 %72, label %81, label %73
73: ; preds = %70
%74 = add i32 %71, -1
%75 = zext i32 %74 to i64
%76 = getelementptr inbounds i8, i8* %5, i64 %75
%77 = load i8, i8* %76
%78 = icmp eq i8 %77, 47
br i1 %78, label %79, label %81
79: ; preds = %73
%80 = call i32 @sprintf(i8* %66, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %5, i8* %46)
br label %83
81: ; preds = %73, %70
%82 = call i32 @sprintf(i8* %66, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %5, i8* %46)
br label %83
83: ; preds = %79, %81, %58
%84 = phi i8* [ %59, %58 ], [ %66, %81 ], [ %66, %79 ]
%85 = call i32 @free(i8* %12)
%86 = icmp eq i8* %84, null
br i1 %86, label %87, label %90
87: ; preds = %68, %83
%88 = load i32, i32* @stderr
%89 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %90
90: ; preds = %83, %87, %50, %14, %8
%91 = phi i8* [ null, %14 ], [ null, %50 ], [ null, %8 ], [ null, %87 ], [ %84, %83 ]
ret i8* %91
}