#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*/ F_OK;
int PATH_MAX;
scalar_t__ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
int /*<<< orphan*/ memmove(char *, char *, size_t);
char *realpath(char const *, char *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
size_t strlen(char const *);
scalar_t__ strncmp(char *, char *, int);
char *strstr(char *, char *);
char *canonpath(const char *path, char *resolved_path) {
  char canon[PATH_MAX], *p, *dst;
  size_t len = strlen(path);
  if (len >= PATH_MAX)
    goto fallback;
  memcpy(canon, path, len + 1);
  while ((p = strstr(canon, "//")) != NULL)
    memmove(p, p + 1, strlen(p + 1) + 1);
  while ((p = strstr(canon, "/./")) != NULL)
    memmove(p, p + 2, strlen(p + 2) + 1);
  if (strncmp(canon, "/dev/mapper/", 12) == 0 &&
      strchr(canon + 12, '/') == NULL && access(canon, F_OK) == 0) {
    strcpy(resolved_path, canon);
    return resolved_path;
  }
  if (strncmp(canon, "/dev/", 5) == 0 && (p = strchr(canon + 5, '/')) != NULL &&
      strchr(p + 1, '/') == NULL) {
    strcpy(resolved_path, "/dev/mapper/");
    dst = strchr(resolved_path, 0);
    for (p = canon + 5; *p; ++p) {
      if (dst - resolved_path >= PATH_MAX - 2)
        goto fallback;
      switch (*p) {
      case '/':
        *dst = '-';
        break;
      case '-':
        *dst++ = '-';
      default:
        *dst = *p;
      }
      ++dst;
    }
    *dst = 0;
    if (access(resolved_path, F_OK) == 0)
      return resolved_path;
  }
fallback:
  return realpath(path, resolved_path);
}


x86 assembly (clang, -O0):
<canonpath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2e46(%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,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    0x2e09(%rip),%rcx
movslq (%rcx),%rcx
cmp    %rcx,%rax
jb     11f8 <canonpath+0x68>
jmp    14a9 <canonpath+0x319>
mov    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x40(%rbp),%rdx
add    $0x1,%rdx
call   1080 <memcpy@plt>
mov    -0x50(%rbp),%rdi
lea    0xde8(%rip),%rsi
call   10b0 <strstr@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     1265 <canonpath+0xd5>
mov    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
mov    -0x30(%rbp),%rdi
add    $0x1,%rdi
call   1050 <strlen@plt>
mov    -0x60(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1090 <memmove@plt>
jmp    120d <canonpath+0x7d>
jmp    126a <canonpath+0xda>
mov    -0x50(%rbp),%rdi
lea    0xd8e(%rip),%rsi
call   10b0 <strstr@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     12c2 <canonpath+0x132>
mov    -0x30(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x30(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x68(%rbp)
mov    -0x30(%rbp),%rdi
add    $0x2,%rdi
call   1050 <strlen@plt>
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1090 <memmove@plt>
jmp    126a <canonpath+0xda>
mov    -0x50(%rbp),%rdi
lea    0xd3a(%rip),%rsi
mov    $0xc,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    133a <canonpath+0x1aa>
mov    -0x50(%rbp),%rdi
add    $0xc,%rdi
mov    $0x2f,%esi
call   1060 <strchr@plt>
cmp    $0x0,%rax
jne    133a <canonpath+0x1aa>
mov    -0x50(%rbp),%rdi
mov    0x2cc8(%rip),%rax
mov    (%rax),%esi
call   10a0 <access@plt>
cmp    $0x0,%rax
jne    133a <canonpath+0x1aa>
mov    -0x50(%rbp),%rsi
mov    -0x18(%rbp),%rdi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x44(%rbp)
jmp    14c1 <canonpath+0x331>
mov    -0x50(%rbp),%rdi
lea    0xccf(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    14a4 <canonpath+0x314>
mov    -0x50(%rbp),%rdi
add    $0x5,%rdi
mov    $0x2f,%esi
call   1060 <strchr@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     14a4 <canonpath+0x314>
mov    -0x30(%rbp),%rdi
add    $0x1,%rdi
mov    $0x2f,%esi
call   1060 <strchr@plt>
cmp    $0x0,%rax
jne    14a4 <canonpath+0x314>
mov    -0x18(%rbp),%rdi
lea    0xc67(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1060 <strchr@plt>
mov    %rax,%rcx
mov    -0x50(%rbp),%rax
mov    %rcx,-0x38(%rbp)
add    $0x5,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmpb   $0x0,(%rax)
je     1468 <canonpath+0x2d8>
mov    -0x38(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    0x2c0e(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
jl     13f8 <canonpath+0x268>
jmp    14a9 <canonpath+0x319>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x74(%rbp)
sub    $0x2d,%eax
je     142d <canonpath+0x29d>
jmp    1410 <canonpath+0x280>
mov    -0x74(%rbp),%eax
sub    $0x2f,%eax
jne    143f <canonpath+0x2af>
jmp    1421 <canonpath+0x291>
mov    -0x38(%rbp),%rax
movb   $0x2d,(%rax)
jmp    144b <canonpath+0x2bb>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
movb   $0x2d,(%rax)
mov    -0x30(%rbp),%rax
mov    (%rax),%cl
mov    -0x38(%rbp),%rax
mov    %cl,(%rax)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    13c3 <canonpath+0x233>
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rdi
mov    0x2b56(%rip),%rax
mov    (%rax),%esi
call   10a0 <access@plt>
cmp    $0x0,%rax
jne    149f <canonpath+0x30f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x44(%rbp)
jmp    14c1 <canonpath+0x331>
jmp    14a4 <canonpath+0x314>
jmp    14a9 <canonpath+0x319>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <realpath@plt>
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x44(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x8(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<canonpath>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    0x2e45(%rip),%rax
movslq (%rax),%rbx
mov    %ebx,%eax
mov    %rsp,%r13
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
call   1050 <strlen@plt>
cmp    %rbx,%rax
jae    12f1 <canonpath+0x161>
add    $0x1,%rax
mov    %r13,%rdi
mov    %r14,-0x30(%rbp)
mov    %r14,%rsi
mov    %rax,%rdx
call   1080 <memcpy@plt>
lea    0xe14(%rip),%rsi
mov    %r13,%rdi
call   10b0 <strstr@plt>
test   %rax,%rax
je     123e <canonpath+0xae>
mov    %rax,%rbx
lea    0xdfd(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%rbx),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <memmove@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   10b0 <strstr@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1210 <canonpath+0x80>
lea    0xdbe(%rip),%rsi
mov    %r13,%rdi
call   10b0 <strstr@plt>
test   %rax,%rax
je     128e <canonpath+0xfe>
mov    %rax,%rbx
lea    0xda7(%rip),%r12
nopl   0x0(%rax)
lea    0x2(%rbx),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <memmove@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   10b0 <strstr@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1260 <canonpath+0xd0>
lea    0xd72(%rip),%rsi
mov    %r13,%rdi
mov    $0xc,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    12d4 <canonpath+0x144>
lea    0xc(%r13),%rdi
mov    $0x2f,%esi
call   1060 <strchr@plt>
test   %rax,%rax
jne    12d4 <canonpath+0x144>
mov    0x2d0f(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
call   10a0 <access@plt>
test   %rax,%rax
je     13b3 <canonpath+0x223>
lea    0xd39(%rip),%rsi
mov    %r13,%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
mov    -0x30(%rbp),%r14
je     1311 <canonpath+0x181>
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <realpath@plt>
mov    %rax,%r15
mov    %r15,%rax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x5(%r13),%r12
mov    %r12,%rdi
mov    $0x2f,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     12f1 <canonpath+0x161>
add    $0x1,%rax
mov    %rax,%rdi
mov    $0x2f,%esi
call   1060 <strchr@plt>
test   %rax,%rax
jne    12f1 <canonpath+0x161>
lea    0xcc3(%rip),%rsi
mov    %r15,%rdi
call   1040 <strcpy@plt>
mov    %r15,%rdi
call   1050 <strlen@plt>
add    %r15,%rax
mov    (%r12),%cl
test   %cl,%cl
je     13c3 <canonpath+0x233>
add    $0x6,%r13
jmp    1384 <canonpath+0x1f4>
movb   $0x2d,(%rax)
add    $0x1,%rax
movzbl -0x1(%r13),%ecx
mov    %cl,(%rax)
add    $0x1,%rax
movzbl 0x0(%r13),%ecx
add    $0x1,%r13
test   %cl,%cl
je     13c3 <canonpath+0x233>
mov    %rax,%rdx
sub    %r15,%rdx
mov    0x2c5f(%rip),%rsi
movslq (%rsi),%rsi
add    $0xfffffffffffffffe,%rsi
cmp    %rsi,%rdx
jge    12f1 <canonpath+0x161>
movsbl %cl,%edx
cmp    $0x2d,%edx
je     1365 <canonpath+0x1d5>
cmp    $0x2f,%edx
jne    1371 <canonpath+0x1e1>
movb   $0x2d,(%rax)
jmp    1373 <canonpath+0x1e3>
mov    %r15,%rdi
mov    %r13,%rsi
call   1040 <strcpy@plt>
jmp    12ff <canonpath+0x16f>
movb   $0x0,(%rax)
mov    0x2c03(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
call   10a0 <access@plt>
test   %rax,%rax
jne    12f1 <canonpath+0x161>
jmp    12ff <canonpath+0x16f>

LLVM IR (-O0):
@PATH_MAX = global i32 0
@.str = [3 x i8] c"//\00"
@.str.1 = [4 x i8] c"/./\00"
@.str.2 = [13 x i8] c"/dev/mapper/\00"
@F_OK = global i32 0
@.str.3 = [6 x i8] c"/dev/\00"
define i8* @canonpath(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 i64
%11 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%12 = load i32, i32* @PATH_MAX
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %6
%15 = alloca i8, i64 %13
store i64 %13, i64* %7
%16 = load i8*, i8** %4
%17 = call i64 @strlen(i8* %16)
store i64 %17, i64* %10
%18 = load i64, i64* %10
%19 = load i32, i32* @PATH_MAX
%20 = sext i32 %19 to i64
%21 = icmp uge i64 %18, %20
br i1 %21, label %22, label %23
22: ; preds = %2
br label %130
23: ; preds = %2
%24 = load i8*, i8** %4
%25 = load i64, i64* %10
%26 = add i64 %25, 1
%27 = call i32 @memcpy(i8* %15, i8* %24, i64 %26)
br label %28
28: ; preds = %31, %23
%29 = call i8* @strstr(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %29, i8** %8
%30 = icmp ne i8* %29, null
br i1 %30, label %31, label %40
31: ; preds = %28
%32 = load i8*, i8** %8
%33 = load i8*, i8** %8
%34 = getelementptr inbounds i8, i8* %33, i64 1
%35 = load i8*, i8** %8
%36 = getelementptr inbounds i8, i8* %35, i64 1
%37 = call i64 @strlen(i8* %36)
%38 = add i64 %37, 1
%39 = call i32 @memmove(i8* %32, i8* %34, i64 %38)
br label %28
40: ; preds = %28
br label %41
41: ; preds = %44, %40
%42 = call i8* @strstr(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i8* %42, i8** %8
%43 = icmp ne i8* %42, null
br i1 %43, label %44, label %53
44: ; preds = %41
%45 = load i8*, i8** %8
%46 = load i8*, i8** %8
%47 = getelementptr inbounds i8, i8* %46, i64 2
%48 = load i8*, i8** %8
%49 = getelementptr inbounds i8, i8* %48, i64 2
%50 = call i64 @strlen(i8* %49)
%51 = add i64 %50, 1
%52 = call i32 @memmove(i8* %45, i8* %47, i64 %51)
br label %41
53: ; preds = %41
%54 = call i64 @strncmp(i8* %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 12)
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %68
56: ; preds = %53
%57 = getelementptr inbounds i8, i8* %15, i64 12
%58 = call i8* @strchr(i8* %57, i8 signext 47)
%59 = icmp eq i8* %58, null
br i1 %59, label %60, label %68
60: ; preds = %56
%61 = load i32, i32* @F_OK
%62 = call i64 @access(i8* %15, i32 %61)
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %68
64: ; preds = %60
%65 = load i8*, i8** %5
%66 = call i32 @strcpy(i8* %65, i8* %15)
%67 = load i8*, i8** %5
store i8* %67, i8** %3
store i32 1, i32* %11
br label %134
68: ; preds = %60, %56, %53
%69 = call i64 @strncmp(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 5)
%70 = icmp eq i64 %69, 0
br i1 %70, label %71, label %129
71: ; preds = %68
%72 = getelementptr inbounds i8, i8* %15, i64 5
%73 = call i8* @strchr(i8* %72, i8 signext 47)
store i8* %73, i8** %8
%74 = icmp ne i8* %73, null
br i1 %74, label %75, label %129
75: ; preds = %71
%76 = load i8*, i8** %8
%77 = getelementptr inbounds i8, i8* %76, i64 1
%78 = call i8* @strchr(i8* %77, i8 signext 47)
%79 = icmp eq i8* %78, null
br i1 %79, label %80, label %129
80: ; preds = %75
%81 = load i8*, i8** %5
%82 = call i32 @strcpy(i8* %81, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%83 = load i8*, i8** %5
%84 = call i8* @strchr(i8* %83, i8 signext 0)
store i8* %84, i8** %9
%85 = getelementptr inbounds i8, i8* %15, i64 5
store i8* %85, i8** %8
br label %86
86: ; preds = %117, %80
%87 = load i8*, i8** %8
%88 = load i8, i8* %87
%89 = icmp ne i8 %88, 0
br i1 %89, label %90, label %120
90: ; preds = %86
%91 = load i8*, i8** %9
%92 = load i8*, i8** %5
%93 = ptrtoint i8* %91 to i64
%94 = ptrtoint i8* %92 to i64
%95 = sub i64 %93, %94
%96 = load i32, i32* @PATH_MAX
%97 = sub nsw i32 %96, 2
%98 = sext i32 %97 to i64
%99 = icmp sge i64 %95, %98
br i1 %99, label %100, label %101
100: ; preds = %90
br label %130
101: ; preds = %90
%102 = load i8*, i8** %8
%103 = load i8, i8* %102
%104 = sext i8 %103 to i32
switch i32 %104, label %110 [
i32 47, label %105
i32 45, label %107
]
105: ; preds = %101
%106 = load i8*, i8** %9
store i8 45, i8* %106
br label %114
107: ; preds = %101
%108 = load i8*, i8** %9
%109 = getelementptr inbounds i8, i8* %108, i32 1
store i8* %109, i8** %9
store i8 45, i8* %108
br label %110
110: ; preds = %101, %107
%111 = load i8*, i8** %8
%112 = load i8, i8* %111
%113 = load i8*, i8** %9
store i8 %112, i8* %113
br label %114
114: ; preds = %110, %105
%115 = load i8*, i8** %9
%116 = getelementptr inbounds i8, i8* %115, i32 1
store i8* %116, i8** %9
br label %117
117: ; preds = %114
%118 = load i8*, i8** %8
%119 = getelementptr inbounds i8, i8* %118, i32 1
store i8* %119, i8** %8
br label %86
120: ; preds = %86
%121 = load i8*, i8** %9
store i8 0, i8* %121
%122 = load i8*, i8** %5
%123 = load i32, i32* @F_OK
%124 = call i64 @access(i8* %122, i32 %123)
%125 = icmp eq i64 %124, 0
br i1 %125, label %126, label %128
126: ; preds = %120
%127 = load i8*, i8** %5
store i8* %127, i8** %3
store i32 1, i32* %11
br label %134
128: ; preds = %120
br label %129
129: ; preds = %128, %75, %71, %68
br label %130
130: ; preds = %129, %100, %22
%131 = load i8*, i8** %4
%132 = load i8*, i8** %5
%133 = call i8* @realpath(i8* %131, i8* %132)
store i8* %133, i8** %3
store i32 1, i32* %11
br label %134
134: ; preds = %130, %126, %64
%135 = load i8*, i8** %6
%136 = load i8*, i8** %3
ret i8* %136
}

LLVM IR (-O2):
@PATH_MAX = global i32 0
@.str = [3 x i8] c"//\00"
@.str.1 = [4 x i8] c"/./\00"
@.str.2 = [13 x i8] c"/dev/mapper/\00"
@F_OK = global i32 0
@.str.3 = [6 x i8] c"/dev/\00"
define i8* @canonpath(i8* %0, i8* %1) {
%3 = load i32, i32* @PATH_MAX
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%7 = sext i32 %3 to i64
%8 = icmp ult i64 %6, %7
br i1 %8, label %9, label %95
9: ; preds = %2
%10 = add nuw i64 %6, 1
%11 = call i32 @memcpy(i8* %5, i8* %0, i64 %10)
%12 = call i8* @strstr(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %17
14: ; preds = %17, %9
%15 = call i8* @strstr(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i8* %15, null
br i1 %16, label %33, label %25
17: ; preds = %9, %17
%18 = phi i8* [ %23, %17 ], [ %12, %9 ]
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = call i64 @strlen(i8* %19)
%21 = add i64 %20, 1
%22 = call i32 @memmove(i8* %18, i8* %19, i64 %21)
%23 = call i8* @strstr(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%24 = icmp eq i8* %23, null
br i1 %24, label %14, label %17
25: ; preds = %14, %25
%26 = phi i8* [ %31, %25 ], [ %15, %14 ]
%27 = getelementptr inbounds i8, i8* %26, i64 2
%28 = call i64 @strlen(i8* %27)
%29 = add i64 %28, 1
%30 = call i32 @memmove(i8* %26, i8* %27, i64 %29)
%31 = call i8* @strstr(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%32 = icmp eq i8* %31, null
br i1 %32, label %33, label %25
33: ; preds = %25, %14
%34 = call i64 @strncmp(i8* %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 12)
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %46
36: ; preds = %33
%37 = getelementptr inbounds i8, i8* %5, i64 12
%38 = call i8* @strchr(i8* %37, i8 signext 47)
%39 = icmp eq i8* %38, null
br i1 %39, label %40, label %46
40: ; preds = %36
%41 = load i32, i32* @F_OK
%42 = call i64 @access(i8* %5, i32 %41)
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %40
%45 = call i32 @strcpy(i8* %1, i8* %5)
br label %97
46: ; preds = %40, %36, %33
%47 = call i64 @strncmp(i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 5)
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %95
49: ; preds = %46
%50 = getelementptr inbounds i8, i8* %5, i64 5
%51 = call i8* @strchr(i8* %50, i8 signext 47)
%52 = icmp eq i8* %51, null
br i1 %52, label %95, label %53
53: ; preds = %49
%54 = getelementptr inbounds i8, i8* %51, i64 1
%55 = call i8* @strchr(i8* %54, i8 signext 47)
%56 = icmp eq i8* %55, null
br i1 %56, label %57, label %95
57: ; preds = %53
%58 = call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%59 = call i64 @strlen(i8* dereferenceable(1) %1)
%60 = getelementptr i8, i8* %1, i64 %59
%61 = load i8, i8* %50
%62 = icmp eq i8 %61, 0
br i1 %62, label %90, label %63
63: ; preds = %57
%64 = ptrtoint i8* %1 to i64
br label %65
65: ; preds = %63, %84
%66 = phi i8 [ %61, %63 ], [ %88, %84 ]
%67 = phi i8* [ %60, %63 ], [ %86, %84 ]
%68 = phi i8* [ %50, %63 ], [ %87, %84 ]
%69 = ptrtoint i8* %67 to i64
%70 = sub i64 %69, %64
%71 = load i32, i32* @PATH_MAX
%72 = add nsw i32 %71, -2
%73 = sext i32 %72 to i64
%74 = icmp slt i64 %70, %73
br i1 %74, label %75, label %95
75: ; preds = %65
%76 = sext i8 %66 to i32
switch i32 %76, label %81 [
i32 47, label %77
i32 45, label %78
]
77: ; preds = %75
store i8 45, i8* %67
br label %84
78: ; preds = %75
%79 = getelementptr inbounds i8, i8* %67, i64 1
store i8 45, i8* %67
%80 = load i8, i8* %68
br label %81
81: ; preds = %75, %78
%82 = phi i8 [ %66, %75 ], [ %80, %78 ]
%83 = phi i8* [ %67, %75 ], [ %79, %78 ]
store i8 %82, i8* %83
br label %84
84: ; preds = %81, %77
%85 = phi i8* [ %83, %81 ], [ %67, %77 ]
%86 = getelementptr inbounds i8, i8* %85, i64 1
%87 = getelementptr inbounds i8, i8* %68, i64 1
%88 = load i8, i8* %87
%89 = icmp eq i8 %88, 0
br i1 %89, label %90, label %65
90: ; preds = %84, %57
%91 = phi i8* [ %60, %57 ], [ %86, %84 ]
store i8 0, i8* %91
%92 = load i32, i32* @F_OK
%93 = call i64 @access(i8* %1, i32 %92)
%94 = icmp eq i64 %93, 0
br i1 %94, label %97, label %95
95: ; preds = %65, %46, %49, %53, %90, %2
%96 = call i8* @realpath(i8* %0, i8* %1)
br label %97
97: ; preds = %90, %95, %44
%98 = phi i8* [ %96, %95 ], [ %1, %44 ], [ %1, %90 ]
ret i8* %98
}