#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 */
char *calloc(int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcat(char *, char *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
int /*<<< orphan*/ strncmp(char *, char *, int);
int strnlen(char *, int);
char *strrchr(char *, char);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("	Usage: %s directory\n", argv[0]);
    exit(-1);
  }
  char *old_path = calloc(4096, 1);
  if (!old_path)
    goto out1;
  char *new_path = calloc(4096, 1);
  if (!new_path)
    goto out2;
  strcpy(old_path, argv[1]);
  printf("   ___________ old_path : %s _________\n", old_path);
  char *slash = NULL, *tmp_slash = NULL, *dir_start = old_path + 1;
  while ((slash = strchr(dir_start, '/')) != NULL && *dir_start != '\0') {
    if (*(slash + 1) == '/') {
      printf(" directory formt error! \n");
      goto out3;
    }
    *slash = '\0';
    int mid_dir_len = strlen(dir_start);
    if (mid_dir_len == 1 && *dir_start == '.') {
      dir_start = slash + 1;
    } else if (mid_dir_len == 2 && !strncmp(dir_start, "..", 2)) {
      if (*new_path != '\0' && *(new_path + 1) != '\0') {
        tmp_slash = strrchr(new_path, '/');
        if (new_path != tmp_slash)
          *tmp_slash = '\0';
        else
          *(tmp_slash + 1) = '\0';
      }
      dir_start = slash + 1;
    } else {
      printf("mid dir :%s\n", dir_start);
      if (strnlen(new_path, 2) != 1)
        strncat(new_path, "/", 1);
      strcat(new_path, dir_start);
      dir_start = slash + 1;
    }
  }
  if (*dir_start != '\0' && *dir_start != '.' && !slash) {
    if (strnlen(new_path, 2) != 1)
      strncat(new_path, "/", 1);
    strcat(new_path, dir_start);
  }
  if (*new_path == '\0') {
    strncat(new_path, "/", 1);
  }
  printf("   ___________ new_path : %s _________\n", new_path);
out3:
  free(new_path);
out2:
  free(old_path);
out1:
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11ff <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    $0x1000,%edi
mov    $0x1,%esi
call   10c0 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1222 <main+0x62>
jmp    14cb <main+0x30b>
mov    $0x1000,%edi
mov    $0x1,%esi
call   10c0 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1245 <main+0x85>
jmp    14c2 <main+0x302>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1050 <strcpy@plt>
mov    -0x18(%rbp),%rsi
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    $0x2f,%esi
call   1070 <strchr@plt>
mov    %rax,%rcx
mov    %rcx,-0x28(%rbp)
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x3d(%rbp)
je     12b8 <main+0xf8>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x3d(%rbp)
mov    -0x3d(%rbp),%al
test   $0x1,%al
jne    12c8 <main+0x108>
jmp    141e <main+0x25e>
mov    -0x28(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2f,%eax
jne    12ec <main+0x12c>
lea    0xd5e(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    14b9 <main+0x2f9>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x38(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x1,-0x3c(%rbp)
jne    132a <main+0x16a>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    132a <main+0x16a>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1419 <main+0x259>
cmpl   $0x2,-0x3c(%rbp)
jne    13bd <main+0x1fd>
mov    -0x38(%rbp),%rdi
lea    0xd19(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    13bd <main+0x1fd>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     13ac <main+0x1ec>
mov    -0x20(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     13ac <main+0x1ec>
mov    -0x20(%rbp),%rdi
mov    $0x2f,%esi
call   1090 <strrchr@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x30(%rbp),%rax
je     139f <main+0x1df>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
jmp    13a7 <main+0x1e7>
mov    -0x30(%rbp),%rax
movb   $0x0,0x1(%rax)
jmp    13ac <main+0x1ec>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1414 <main+0x254>
mov    -0x38(%rbp),%rsi
lea    0xc93(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    $0x2,%esi
call   10a0 <strnlen@plt>
cmp    $0x1,%eax
je     13fb <main+0x23b>
mov    -0x20(%rbp),%rdi
lea    0xc77(%rip),%rsi
mov    $0x1,%edx
call   10b0 <strncat@plt>
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   10d0 <strcat@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1419 <main+0x259>
jmp    1284 <main+0xc4>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1482 <main+0x2c2>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
je     1482 <main+0x2c2>
cmpq   $0x0,-0x28(%rbp)
jne    1482 <main+0x2c2>
mov    -0x20(%rbp),%rdi
mov    $0x2,%esi
call   10a0 <strnlen@plt>
cmp    $0x1,%eax
je     1475 <main+0x2b5>
mov    -0x20(%rbp),%rdi
lea    0xbfd(%rip),%rsi
mov    $0x1,%edx
call   10b0 <strncat@plt>
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   10d0 <strcat@plt>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    14a7 <main+0x2e7>
mov    -0x20(%rbp),%rdi
lea    0xbcb(%rip),%rsi
mov    $0x1,%edx
call   10b0 <strncat@plt>
mov    -0x20(%rbp),%rsi
lea    0xbb8(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    13ef <main+0x21f>
mov    $0x1000,%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
test   %rax,%rax
je     13de <main+0x20e>
mov    %rax,%r12
mov    $0x1000,%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
test   %rax,%rax
je     13d6 <main+0x206>
mov    %rax,%r15
mov    0x8(%rbx),%rsi
mov    %r12,%rdi
call   1050 <strcpy@plt>
lea    0xde6(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %r12,%r14
add    $0x1,%r14
mov    %r14,%rdi
mov    $0x2f,%esi
call   1080 <strchr@plt>
test   %rax,%rax
je     1359 <main+0x189>
lea    0xde3(%rip),%r13
lea    0xde9(%rip),%rbp
jmp    1291 <main+0xc1>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
call   10e0 <strcat@plt>
mov    %r14,%rdi
mov    $0x2f,%esi
call   1080 <strchr@plt>
test   %rax,%rax
je     1359 <main+0x189>
cmpb   $0x0,(%r14)
je     1395 <main+0x1c5>
cmpb   $0x2f,0x1(%rax)
je     13c2 <main+0x1f2>
mov    %r14,%rbx
movb   $0x0,(%rax)
mov    %rax,%r14
add    $0x1,%r14
mov    %rbx,%rdi
call   1070 <strlen@plt>
cmp    $0x2,%eax
je     12d0 <main+0x100>
cmp    $0x1,%eax
jne    12e8 <main+0x118>
cmpb   $0x2e,(%rbx)
je     127b <main+0xab>
jmp    12e8 <main+0x118>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
lea    0xd64(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     1320 <main+0x150>
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %r15,%rdi
mov    $0x2,%esi
call   10b0 <strnlen@plt>
cmp    $0x1,%eax
je     1270 <main+0xa0>
mov    %r15,%rdi
mov    %rbp,%rsi
mov    $0x1,%edx
call   10c0 <strncat@plt>
jmp    1270 <main+0xa0>
cmpb   $0x0,(%r15)
je     127b <main+0xab>
cmpb   $0x0,0x1(%r15)
je     127b <main+0xab>
mov    %r15,%rdi
mov    $0x2f,%esi
call   10a0 <strrchr@plt>
cmp    %rax,%r15
je     134f <main+0x17f>
movb   $0x0,(%rax)
jmp    127b <main+0xab>
movb   $0x0,0x1(%r15)
jmp    127b <main+0xab>
mov    (%r14),%al
test   %al,%al
je     1395 <main+0x1c5>
cmp    $0x2e,%al
je     1395 <main+0x1c5>
mov    %r15,%rdi
mov    $0x2,%esi
call   10b0 <strnlen@plt>
cmp    $0x1,%eax
je     138a <main+0x1ba>
lea    0xcd1(%rip),%rsi
mov    %r15,%rdi
mov    $0x1,%edx
call   10c0 <strncat@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   10e0 <strcat@plt>
cmpb   $0x0,(%r15)
jne    13af <main+0x1df>
lea    0xcac(%rip),%rsi
mov    %r15,%rdi
mov    $0x1,%edx
call   10c0 <strncat@plt>
lea    0xc9a(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
jmp    13ce <main+0x1fe>
lea    0xcaf(%rip),%rdi
call   1060 <puts@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rbx),%rsi
lea    0xc07(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0xffffffff,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"\09Usage: %s directory\0A\00"
@.str.1 = [40 x i8] c" ___________ old_path : %s _________\0A\00"
@.str.2 = [26 x i8] c" directory formt error! \0A\00"
@.str.3 = [3 x i8] c"..\00"
@.str.4 = [13 x i8] c"mid dir :%s\0A\00"
@.str.5 = [2 x i8] c"/\00"
@.str.6 = [40 x i8] c" ___________ new_path : %s _________\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 2
br i1 %13, label %14, label %20
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = call i32 @exit(i32 -1)
unreachable
20: ; preds = %2
%21 = call i8* @calloc(i32 4096, i32 1)
store i8* %21, i8** %6
%22 = load i8*, i8** %6
%23 = icmp ne i8* %22, null
br i1 %23, label %25, label %24
24: ; preds = %20
br label %164
25: ; preds = %20
%26 = call i8* @calloc(i32 4096, i32 1)
store i8* %26, i8** %7
%27 = load i8*, i8** %7
%28 = icmp ne i8* %27, null
br i1 %28, label %30, label %29
29: ; preds = %25
br label %161
30: ; preds = %25
%31 = load i8*, i8** %6
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i32 @strcpy(i8* %31, i8* %34)
%36 = load i8*, i8** %6
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %36)
store i8* null, i8** %8
store i8* null, i8** %9
%38 = load i8*, i8** %6
%39 = getelementptr inbounds i8, i8* %38, i64 1
store i8* %39, i8** %10
br label %40
40: ; preds = %122, %30
%41 = load i8*, i8** %10
%42 = call i8* @strchr(i8* %41, i8 signext 47)
store i8* %42, i8** %8
%43 = icmp ne i8* %42, null
br i1 %43, label %44, label %49
44: ; preds = %40
%45 = load i8*, i8** %10
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp ne i32 %47, 0
br label %49
49: ; preds = %44, %40
%50 = phi i1 [ false, %40 ], [ %48, %44 ]
br i1 %50, label %51, label %123
51: ; preds = %49
%52 = load i8*, i8** %8
%53 = getelementptr inbounds i8, i8* %52, i64 1
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 47
br i1 %56, label %57, label %59
57: ; preds = %51
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %158
59: ; preds = %51
%60 = load i8*, i8** %8
store i8 0, i8* %60
%61 = load i8*, i8** %10
%62 = call i32 @strlen(i8* %61)
store i32 %62, i32* %11
%63 = load i32, i32* %11
%64 = icmp eq i32 %63, 1
br i1 %64, label %65, label %73
65: ; preds = %59
%66 = load i8*, i8** %10
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = icmp eq i32 %68, 46
br i1 %69, label %70, label %73
70: ; preds = %65
%71 = load i8*, i8** %8
%72 = getelementptr inbounds i8, i8* %71, i64 1
store i8* %72, i8** %10
br label %122
73: ; preds = %65, %59
%74 = load i32, i32* %11
%75 = icmp eq i32 %74, 2
br i1 %75, label %76, label %106
76: ; preds = %73
%77 = load i8*, i8** %10
%78 = call i32 @strncmp(i8* %77, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 2)
%79 = icmp ne i32 %78, 0
br i1 %79, label %106, label %80
80: ; preds = %76
%81 = load i8*, i8** %7
%82 = load i8, i8* %81
%83 = sext i8 %82 to i32
%84 = icmp ne i32 %83, 0
br i1 %84, label %85, label %103
85: ; preds = %80
%86 = load i8*, i8** %7
%87 = getelementptr inbounds i8, i8* %86, i64 1
%88 = load i8, i8* %87
%89 = sext i8 %88 to i32
%90 = icmp ne i32 %89, 0
br i1 %90, label %91, label %103
91: ; preds = %85
%92 = load i8*, i8** %7
%93 = call i8* @strrchr(i8* %92, i8 signext 47)
store i8* %93, i8** %9
%94 = load i8*, i8** %7
%95 = load i8*, i8** %9
%96 = icmp ne i8* %94, %95
br i1 %96, label %97, label %99
97: ; preds = %91
%98 = load i8*, i8** %9
store i8 0, i8* %98
br label %102
99: ; preds = %91
%100 = load i8*, i8** %9
%101 = getelementptr inbounds i8, i8* %100, i64 1
store i8 0, i8* %101
br label %102
102: ; preds = %99, %97
br label %103
103: ; preds = %102, %85, %80
%104 = load i8*, i8** %8
%105 = getelementptr inbounds i8, i8* %104, i64 1
store i8* %105, i8** %10
br label %121
106: ; preds = %76, %73
%107 = load i8*, i8** %10
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* %107)
%109 = load i8*, i8** %7
%110 = call i32 @strnlen(i8* %109, i32 2)
%111 = icmp ne i32 %110, 1
br i1 %111, label %112, label %115
112: ; preds = %106
%113 = load i8*, i8** %7
%114 = call i32 @strncat(i8* %113, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
br label %115
115: ; preds = %112, %106
%116 = load i8*, i8** %7
%117 = load i8*, i8** %10
%118 = call i32 @strcat(i8* %116, i8* %117)
%119 = load i8*, i8** %8
%120 = getelementptr inbounds i8, i8* %119, i64 1
store i8* %120, i8** %10
br label %121
121: ; preds = %115, %103
br label %122
122: ; preds = %121, %70
br label %40
123: ; preds = %49
%124 = load i8*, i8** %10
%125 = load i8, i8* %124
%126 = sext i8 %125 to i32
%127 = icmp ne i32 %126, 0
br i1 %127, label %128, label %147
128: ; preds = %123
%129 = load i8*, i8** %10
%130 = load i8, i8* %129
%131 = sext i8 %130 to i32
%132 = icmp ne i32 %131, 46
br i1 %132, label %133, label %147
133: ; preds = %128
%134 = load i8*, i8** %8
%135 = icmp ne i8* %134, null
br i1 %135, label %147, label %136
136: ; preds = %133
%137 = load i8*, i8** %7
%138 = call i32 @strnlen(i8* %137, i32 2)
%139 = icmp ne i32 %138, 1
br i1 %139, label %140, label %143
140: ; preds = %136
%141 = load i8*, i8** %7
%142 = call i32 @strncat(i8* %141, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
br label %143
143: ; preds = %140, %136
%144 = load i8*, i8** %7
%145 = load i8*, i8** %10
%146 = call i32 @strcat(i8* %144, i8* %145)
br label %147
147: ; preds = %143, %133, %128, %123
%148 = load i8*, i8** %7
%149 = load i8, i8* %148
%150 = sext i8 %149 to i32
%151 = icmp eq i32 %150, 0
br i1 %151, label %152, label %155
152: ; preds = %147
%153 = load i8*, i8** %7
%154 = call i32 @strncat(i8* %153, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
br label %155
155: ; preds = %152, %147
%156 = load i8*, i8** %7
%157 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i8* %156)
br label %158
158: ; preds = %155, %57
%159 = load i8*, i8** %7
%160 = call i32 @free(i8* %159)
br label %161
161: ; preds = %158, %29
%162 = load i8*, i8** %6
%163 = call i32 @free(i8* %162)
br label %164
164: ; preds = %161, %24
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"\09Usage: %s directory\0A\00"
@.str.1 = [40 x i8] c" ___________ old_path : %s _________\0A\00"
@.str.3 = [3 x i8] c"..\00"
@.str.4 = [13 x i8] c"mid dir :%s\0A\00"
@.str.5 = [2 x i8] c"/\00"
@.str.6 = [40 x i8] c" ___________ new_path : %s _________\0A\00"
@str = [25 x i8] c" directory formt error! \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %2
%9 = tail call dereferenceable_or_null(4096) i8* @calloc(i32 4096, i32 1)
%10 = icmp eq i8* %9, null
br i1 %10, label %86, label %11
11: ; preds = %8
%12 = tail call dereferenceable_or_null(4096) i8* @calloc(i32 4096, i32 1)
%13 = icmp eq i8* %12, null
br i1 %13, label %84, label %14
14: ; preds = %11
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call i32 @strcpy(i8* %9, i8* %16)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%19 = getelementptr inbounds i8, i8* %9, i64 1
%20 = tail call i8* @strchr(i8* dereferenceable(1) %19, i8 signext 47)
%21 = icmp eq i8* %20, null
br i1 %21, label %65, label %22
22: ; preds = %14
%23 = getelementptr inbounds i8, i8* %12, i64 1
br label %24
24: ; preds = %22, %62
%25 = phi i8* [ %20, %22 ], [ %63, %62 ]
%26 = phi i8* [ %19, %22 ], [ %30, %62 ]
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 0
br i1 %28, label %75, label %29
29: ; preds = %24
%30 = getelementptr inbounds i8, i8* %25, i64 1
%31 = load i8, i8* %30
%32 = icmp eq i8 %31, 47
br i1 %32, label %33, label %35
33: ; preds = %29
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %82
35: ; preds = %29
store i8 0, i8* %25
%36 = tail call i32 @strlen(i8* %26)
switch i32 %36, label %54 [
i32 1, label %37
i32 2, label %40
]
37: ; preds = %35
%38 = load i8, i8* %26
%39 = icmp eq i8 %38, 46
br i1 %39, label %62, label %54
40: ; preds = %35
%41 = tail call i32 @strncmp(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 2)
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %54
43: ; preds = %40
%44 = load i8, i8* %12
%45 = icmp eq i8 %44, 0
br i1 %45, label %62, label %46
46: ; preds = %43
%47 = load i8, i8* %23
%48 = icmp eq i8 %47, 0
br i1 %48, label %62, label %49
49: ; preds = %46
%50 = tail call i8* @strrchr(i8* %12, i8 signext 47)
%51 = icmp eq i8* %12, %50
br i1 %51, label %53, label %52
52: ; preds = %49
store i8 0, i8* %50
br label %62
53: ; preds = %49
store i8 0, i8* %23
br label %62
54: ; preds = %37, %35, %40
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* %26)
%56 = tail call i32 @strnlen(i8* %12, i32 2)
%57 = icmp eq i32 %56, 1
br i1 %57, label %60, label %58
58: ; preds = %54
%59 = tail call i32 @strncat(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
br label %60
60: ; preds = %58, %54
%61 = tail call i32 @strcat(i8* %12, i8* %26)
br label %62
62: ; preds = %43, %46, %53, %52, %37, %60
%63 = tail call i8* @strchr(i8* dereferenceable(1) %30, i8 signext 47)
%64 = icmp eq i8* %63, null
br i1 %64, label %65, label %24
65: ; preds = %62, %14
%66 = phi i8* [ %19, %14 ], [ %30, %62 ]
%67 = load i8, i8* %66
switch i8 %67, label %68 [
i8 0, label %75
i8 46, label %75
]
68: ; preds = %65
%69 = tail call i32 @strnlen(i8* %12, i32 2)
%70 = icmp eq i32 %69, 1
br i1 %70, label %73, label %71
71: ; preds = %68
%72 = tail call i32 @strncat(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
br label %73
73: ; preds = %71, %68
%74 = tail call i32 @strcat(i8* %12, i8* %66)
br label %75
75: ; preds = %24, %65, %65, %73
%76 = load i8, i8* %12
%77 = icmp eq i8 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %75
%79 = tail call i32 @strncat(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
br label %80
80: ; preds = %78, %75
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i8* %12)
br label %82
82: ; preds = %80, %33
%83 = tail call i32 @free(i8* %12)
br label %84
84: ; preds = %11, %82
%85 = tail call i32 @free(i8* %9)
br label %86
86: ; preds = %8, %84
ret i32 0
}