#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char *getcwd(char *, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
char *strrchr(char *, char);
char *get_full_path(char *filename, char *full_path) {
  int path_up_count = 0;
  while (!strncmp(filename, "..", 2)) {
    if (filename[2] == '/')
      filename = filename + 3;
    else if (!strcmp("..", filename))
      strcpy(filename, "");
    else
      break;
    path_up_count++;
  }
  if (filename[0] == '/') {
    if (filename[strlen(filename) - 1] == '/')
      filename[strlen(filename) - 1] = '\0';
    return filename;
  } else if (!strcmp(filename, "."))
    strcpy(filename, "");
  else if (filename[0] == '.' && filename[1] == '/')
    filename = filename + 2;
  if (!(full_path = (char *)malloc((516 + strlen(filename)) * sizeof(char)))) {
    fprintf(stderr, "Can't allocate memory!\n");
    exit(1);
  }
  if (!(full_path = getcwd(full_path, 510 - strlen(filename)))) {
    fprintf(stderr, "Couldn't get current working directory...\n");
    exit(1);
  }
  if (path_up_count) {
    for (; path_up_count > 0; path_up_count--)
      full_path[strrchr(full_path, '/') - full_path] = '\0';
  }
  strcat(full_path, "/");
  strcat(full_path, filename);
  if (full_path[strlen(full_path) - 1] == '/')
    full_path[strlen(full_path) - 1] = '\0';
  return full_path;
}


x86 assembly (clang, -O0):
<get_full_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe3e(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11e1 <get_full_path+0x41>
jmp    1249 <get_full_path+0xa9>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x2f,%eax
jne    1203 <get_full_path+0x63>
mov    -0x10(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x10(%rbp)
jmp    123b <get_full_path+0x9b>
mov    -0x10(%rbp),%rsi
lea    0xdf2(%rip),%rdi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1231 <get_full_path+0x91>
mov    -0x10(%rbp),%rdi
lea    0xdf3(%rip),%rsi
call   1040 <strcpy@plt>
jmp    1236 <get_full_path+0x96>
jmp    1249 <get_full_path+0xa9>
jmp    123b <get_full_path+0x9b>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b7 <get_full_path+0x17>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    12b1 <get_full_path+0x111>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    12a4 <get_full_path+0x104>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1470 <get_full_path+0x2d0>
mov    -0x10(%rbp),%rdi
lea    0xd45(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    12df <get_full_path+0x13f>
mov    -0x10(%rbp),%rdi
lea    0xd45(%rip),%rsi
call   1040 <strcpy@plt>
jmp    1311 <get_full_path+0x171>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    130c <get_full_path+0x16c>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2f,%eax
jne    130c <get_full_path+0x16c>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
jmp    1311 <get_full_path+0x171>
jmp    1316 <get_full_path+0x176>
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x204,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    135e <get_full_path+0x1be>
mov    0x2c9a(%rip),%rax
mov    (%rax),%edi
lea    0xcb4(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    $0x1fe,%esi
sub    %eax,%esi
call   1070 <getcwd@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    13ac <get_full_path+0x20c>
mov    0x2c4c(%rip),%rax
mov    (%rax),%edi
lea    0xc7e(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
cmpl   $0x0,-0x1c(%rbp)
je     1400 <get_full_path+0x260>
jmp    13bb <get_full_path+0x21b>
cmpl   $0x0,-0x1c(%rbp)
jle    13fb <get_full_path+0x25b>
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x2f,%esi
call   1060 <strrchr@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
mov    -0x18(%rbp),%rdx
sub    %rdx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    13bb <get_full_path+0x21b>
jmp    1400 <get_full_path+0x260>
mov    -0x18(%rbp),%rdi
lea    0xc3b(%rip),%rsi
call   10b0 <strcat@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   10b0 <strcat@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    1468 <get_full_path+0x2c8>
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_full_path>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xe4f(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     11f6 <get_full_path+0x56>
mov    (%rbx),%r14b
cmp    $0x2f,%r14b
je     12e2 <get_full_path+0x142>
lea    0xe2c(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
je     124d <get_full_path+0xad>
cmp    $0x2e,%r14b
jne    125c <get_full_path+0xbc>
xor    %eax,%eax
cmpb   $0x2f,0x1(%rbx)
sete   %al
lea    (%rbx,%rax,2),%r14
jmp    125f <get_full_path+0xbf>
xor    %ebp,%ebp
lea    0xe01(%rip),%r14
lea    0xe14(%rip),%r15
jmp    122b <get_full_path+0x8b>
nopl   0x0(%rax,%rax,1)
add    $0x3,%rbx
add    $0x1,%ebp
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
jne    11c1 <get_full_path+0x21>
cmpb   $0x2f,0x2(%rbx)
je     1210 <get_full_path+0x70>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
jne    11c1 <get_full_path+0x21>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
jmp    1214 <get_full_path+0x74>
lea    0xdc6(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x204(%rax),%edi
call   10a0 <malloc@plt>
test   %rax,%rax
je     1310 <get_full_path+0x170>
mov    %rax,%rbx
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    $0x1fe,%esi
sub    %eax,%esi
mov    %rbx,%rdi
call   1070 <getcwd@plt>
test   %rax,%rax
je     1322 <get_full_path+0x182>
mov    %rax,%rbx
test   %ebp,%ebp
je     12c8 <get_full_path+0x128>
add    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1060 <strrchr@plt>
movb   $0x0,(%rax)
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
jg     12b0 <get_full_path+0x110>
lea    0xd77(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10b0 <strcat@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
cmpb   $0x2f,-0x1(%rax,%rbx,1)
jne    1302 <get_full_path+0x162>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cc9(%rip),%rax
mov    (%rax),%edi
lea    0xce3(%rip),%rsi
jmp    1332 <get_full_path+0x192>
mov    0x2cb7(%rip),%rax
mov    (%rax),%edi
lea    0xce9(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"..\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c".\00"
@stderr = global i32 0
@.str.3 = [24 x i8] c"Can't allocate memory!\0A\00"
@.str.4 = [43 x i8] c"Couldn't get current working directory...\0A\00"
@.str.5 = [2 x i8] c"/\00"
define i8* @get_full_path(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %6
br label %7
7: ; preds = %30, %2
%8 = load i8*, i8** %4
%9 = call i32 @strncmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
br i1 %11, label %12, label %33
12: ; preds = %7
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i64 2
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 47
br i1 %17, label %18, label %21
18: ; preds = %12
%19 = load i8*, i8** %4
%20 = getelementptr inbounds i8, i8* %19, i64 3
store i8* %20, i8** %4
br label %30
21: ; preds = %12
%22 = load i8*, i8** %4
%23 = call i32 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %21
%26 = load i8*, i8** %4
%27 = call i32 @strcpy(i8* %26, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %29
28: ; preds = %21
br label %33
29: ; preds = %25
br label %30
30: ; preds = %29, %18
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %7
33: ; preds = %28, %7
%34 = load i8*, i8** %4
%35 = getelementptr inbounds i8, i8* %34, i64 0
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 47
br i1 %38, label %39, label %58
39: ; preds = %33
%40 = load i8*, i8** %4
%41 = load i8*, i8** %4
%42 = call i32 @strlen(i8* %41)
%43 = sub nsw i32 %42, 1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %40, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 47
br i1 %48, label %49, label %56
49: ; preds = %39
%50 = load i8*, i8** %4
%51 = load i8*, i8** %4
%52 = call i32 @strlen(i8* %51)
%53 = sub nsw i32 %52, 1
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8, i8* %50, i64 %54
store i8 0, i8* %55
br label %56
56: ; preds = %49, %39
%57 = load i8*, i8** %4
store i8* %57, i8** %3
br label %151
58: ; preds = %33
%59 = load i8*, i8** %4
%60 = call i32 @strcmp(i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%61 = icmp ne i32 %60, 0
br i1 %61, label %65, label %62
62: ; preds = %58
%63 = load i8*, i8** %4
%64 = call i32 @strcpy(i8* %63, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %81
65: ; preds = %58
%66 = load i8*, i8** %4
%67 = getelementptr inbounds i8, i8* %66, i64 0
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = icmp eq i32 %69, 46
br i1 %70, label %71, label %80
71: ; preds = %65
%72 = load i8*, i8** %4
%73 = getelementptr inbounds i8, i8* %72, i64 1
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = icmp eq i32 %75, 47
br i1 %76, label %77, label %80
77: ; preds = %71
%78 = load i8*, i8** %4
%79 = getelementptr inbounds i8, i8* %78, i64 2
store i8* %79, i8** %4
br label %80
80: ; preds = %77, %71, %65
br label %81
81: ; preds = %80, %62
br label %82
82: ; preds = %81
%83 = load i8*, i8** %4
%84 = call i32 @strlen(i8* %83)
%85 = add nsw i32 516, %84
%86 = sext i32 %85 to i64
%87 = mul i64 %86, 1
%88 = trunc i64 %87 to i32
%89 = call i64 @malloc(i32 %88)
%90 = inttoptr i64 %89 to i8*
store i8* %90, i8** %5
%91 = icmp ne i8* %90, null
br i1 %91, label %96, label %92
92: ; preds = %82
%93 = load i32, i32* @stderr
%94 = call i32 @fprintf(i32 %93, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%95 = call i32 @exit(i32 1)
unreachable
96: ; preds = %82
%97 = load i8*, i8** %5
%98 = load i8*, i8** %4
%99 = call i32 @strlen(i8* %98)
%100 = sub nsw i32 510, %99
%101 = call i8* @getcwd(i8* %97, i32 %100)
store i8* %101, i8** %5
%102 = icmp ne i8* %101, null
br i1 %102, label %107, label %103
103: ; preds = %96
%104 = load i32, i32* @stderr
%105 = call i32 @fprintf(i32 %104, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
%106 = call i32 @exit(i32 1)
unreachable
107: ; preds = %96
%108 = load i32, i32* %6
%109 = icmp ne i32 %108, 0
br i1 %109, label %110, label %127
110: ; preds = %107
br label %111
111: ; preds = %123, %110
%112 = load i32, i32* %6
%113 = icmp sgt i32 %112, 0
br i1 %113, label %114, label %126
114: ; preds = %111
%115 = load i8*, i8** %5
%116 = load i8*, i8** %5
%117 = call i8* @strrchr(i8* %116, i8 signext 47)
%118 = load i8*, i8** %5
%119 = ptrtoint i8* %117 to i64
%120 = ptrtoint i8* %118 to i64
%121 = sub i64 %119, %120
%122 = getelementptr inbounds i8, i8* %115, i64 %121
store i8 0, i8* %122
br label %123
123: ; preds = %114
%124 = load i32, i32* %6
%125 = add nsw i32 %124, -1
store i32 %125, i32* %6
br label %111
126: ; preds = %111
br label %127
127: ; preds = %126, %107
%128 = load i8*, i8** %5
%129 = call i32 @strcat(i8* %128, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%130 = load i8*, i8** %5
%131 = load i8*, i8** %4
%132 = call i32 @strcat(i8* %130, i8* %131)
%133 = load i8*, i8** %5
%134 = load i8*, i8** %5
%135 = call i32 @strlen(i8* %134)
%136 = sub nsw i32 %135, 1
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds i8, i8* %133, i64 %137
%139 = load i8, i8* %138
%140 = sext i8 %139 to i32
%141 = icmp eq i32 %140, 47
br i1 %141, label %142, label %149
142: ; preds = %127
%143 = load i8*, i8** %5
%144 = load i8*, i8** %5
%145 = call i32 @strlen(i8* %144)
%146 = sub nsw i32 %145, 1
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds i8, i8* %143, i64 %147
store i8 0, i8* %148
br label %149
149: ; preds = %142, %127
%150 = load i8*, i8** %5
store i8* %150, i8** %3
br label %151
151: ; preds = %149, %56
%152 = load i8*, i8** %3
ret i8* %152
}

LLVM IR (-O2):
@.str = [3 x i8] c"..\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c".\00"
@stderr = global i32 0
@.str.3 = [24 x i8] c"Can't allocate memory!\0A\00"
@.str.4 = [43 x i8] c"Couldn't get current working directory...\0A\00"
@.str.5 = [2 x i8] c"/\00"
define i8* @get_full_path(i8* %0, i8* nocapture readnone %1) {
%3 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %23
5: ; preds = %2, %18
%6 = phi i32 [ %20, %18 ], [ 0, %2 ]
%7 = phi i8* [ %19, %18 ], [ %0, %2 ]
%8 = getelementptr inbounds i8, i8* %7, i64 2
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 47
br i1 %10, label %11, label %13
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %7, i64 3
br label %18
13: ; preds = %5
%14 = tail call i32 @strcmp(i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* dereferenceable(1) %7)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %23
16: ; preds = %13
%17 = tail call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %11
%19 = phi i8* [ %12, %11 ], [ %7, %16 ]
%20 = add nuw nsw i32 %6, 1
%21 = tail call i32 @strncmp(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%22 = icmp eq i32 %21, 0
br i1 %22, label %5, label %23
23: ; preds = %18, %13, %2
%24 = phi i8* [ %0, %2 ], [ %7, %13 ], [ %19, %18 ]
%25 = phi i32 [ 0, %2 ], [ %6, %13 ], [ %20, %18 ]
%26 = load i8, i8* %24
%27 = icmp eq i8 %26, 47
br i1 %27, label %28, label %35
28: ; preds = %23
%29 = tail call i32 @strlen(i8* %24)
%30 = add nsw i32 %29, -1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %24, i64 %31
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 47
br i1 %34, label %89, label %95
35: ; preds = %23
%36 = tail call i32 @strcmp(i8* %24, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = tail call i32 @strcpy(i8* %24, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %48
40: ; preds = %35
%41 = icmp eq i8 %26, 46
br i1 %41, label %42, label %48
42: ; preds = %40
%43 = getelementptr inbounds i8, i8* %24, i64 1
%44 = load i8, i8* %43
%45 = icmp eq i8 %44, 47
%46 = select i1 %45, i64 2, i64 0
%47 = getelementptr i8, i8* %24, i64 %46
br label %48
48: ; preds = %42, %38, %40
%49 = phi i8* [ %24, %40 ], [ %24, %38 ], [ %47, %42 ]
%50 = tail call i32 @strlen(i8* %49)
%51 = add nsw i32 %50, 516
%52 = tail call i64 @malloc(i32 %51)
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %58
54: ; preds = %48
%55 = load i32, i32* @stderr
%56 = tail call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%57 = tail call i32 @exit(i32 1)
unreachable
58: ; preds = %48
%59 = inttoptr i64 %52 to i8*
%60 = tail call i32 @strlen(i8* %49)
%61 = sub nsw i32 510, %60
%62 = tail call i8* @getcwd(i8* %59, i32 %61)
%63 = icmp eq i8* %62, null
br i1 %63, label %64, label %68
64: ; preds = %58
%65 = load i32, i32* @stderr
%66 = tail call i32 @fprintf(i32 %65, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
%67 = tail call i32 @exit(i32 1)
unreachable
68: ; preds = %58
%69 = icmp eq i32 %25, 0
br i1 %69, label %80, label %70
70: ; preds = %68
%71 = ptrtoint i8* %62 to i64
br label %72
72: ; preds = %70, %72
%73 = phi i32 [ %78, %72 ], [ %25, %70 ]
%74 = tail call i8* @strrchr(i8* %62, i8 signext 47)
%75 = ptrtoint i8* %74 to i64
%76 = sub i64 %75, %71
%77 = getelementptr inbounds i8, i8* %62, i64 %76
store i8 0, i8* %77
%78 = add nsw i32 %73, -1
%79 = icmp sgt i32 %73, 1
br i1 %79, label %72, label %80
80: ; preds = %72, %68
%81 = tail call i32 @strcat(i8* %62, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%82 = tail call i32 @strcat(i8* %62, i8* %49)
%83 = tail call i32 @strlen(i8* %62)
%84 = add nsw i32 %83, -1
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8, i8* %62, i64 %85
%87 = load i8, i8* %86
%88 = icmp eq i8 %87, 47
br i1 %88, label %89, label %95
89: ; preds = %80, %28
%90 = phi i8* [ %24, %28 ], [ %62, %80 ]
%91 = tail call i32 @strlen(i8* %90)
%92 = add nsw i32 %91, -1
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8, i8* %90, i64 %93
store i8 0, i8* %94
br label %95
95: ; preds = %89, %80, %28
%96 = phi i8* [ %24, %28 ], [ %62, %80 ], [ %90, %89 ]
ret i8* %96
}