#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*/ strcpy(char *, unsigned char *);
void phrase_path(unsigned char *path) {
  unsigned char *tmpp, *pst = path;
  while (*path == ' ')
    path++;
  while (*path != 0) {
    if ((*path == '.') && (*(path + 1) == '.')) {
      tmpp = path;
      tmpp -= 2;
      while ((tmpp >= pst) && (*tmpp != '\\'))
        tmpp--;
      tmpp++;
      strcpy((char *)(path + 3), tmpp);
    } else if (*path == '.') {
      strcpy((char *)(path + 2), path);
    }
    path++;
  }
}


x86 assembly (clang, -O0):
<phrase_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x20,%eax
jne    1145 <phrase_path+0x35>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1124 <phrase_path+0x14>
jmp    114a <phrase_path+0x3a>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
je     122c <phrase_path+0x11c>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x2e,%eax
jne    11f5 <phrase_path+0xe5>
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
cmp    $0x2e,%eax
jne    11f5 <phrase_path+0xe5>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0xfffffffffffffffe,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmp    -0x18(%rbp),%rcx
mov    %al,-0x19(%rbp)
jb     11b2 <phrase_path+0xa2>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x5c,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11c2 <phrase_path+0xb2>
jmp    11d3 <phrase_path+0xc3>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    118f <phrase_path+0x7f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x3,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    121b <phrase_path+0x10b>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x2e,%eax
jne    1216 <phrase_path+0x106>
mov    -0x8(%rbp),%rdi
add    $0x2,%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    121b <phrase_path+0x10b>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    114a <phrase_path+0x3a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phrase_path>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    -0x1(%rdi),%rbx
nopl   0x0(%rax,%rax,1)
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
cmp    $0x20,%al
je     1120 <phrase_path+0x10>
jmp    1148 <phrase_path+0x38>
xchg   %ax,%ax
add    $0x1,%rsi
mov    $0x3,%edi
add    %rbx,%rdi
call   1030 <strcpy@plt>
mov    0x1(%rbx),%al
add    $0x1,%rbx
cmp    $0x2e,%al
je     1160 <phrase_path+0x50>
test   %al,%al
jne    1141 <phrase_path+0x31>
jmp    1190 <phrase_path+0x80>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2,%edi
cmpb   $0x2e,0x1(%rbx)
mov    %rbx,%rsi
jne    1139 <phrase_path+0x29>
lea    -0x2(%rbx),%rsi
cmp    %r14,%rsi
jb     1130 <phrase_path+0x20>
nopw   0x0(%rax,%rax,1)
cmpb   $0x5c,(%rsi)
je     1130 <phrase_path+0x20>
add    $0xffffffffffffffff,%rsi
cmp    %r14,%rsi
jae    1180 <phrase_path+0x70>
jmp    1130 <phrase_path+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @phrase_path(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %4
br label %6
6: ; preds = %11, %1
%7 = load i8*, i8** %2
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = icmp eq i32 %9, 32
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %2
br label %6
14: ; preds = %6
br label %15
15: ; preds = %67, %14
%16 = load i8*, i8** %2
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %70
20: ; preds = %15
%21 = load i8*, i8** %2
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = icmp eq i32 %23, 46
br i1 %24, label %25, label %56
25: ; preds = %20
%26 = load i8*, i8** %2
%27 = getelementptr inbounds i8, i8* %26, i64 1
%28 = load i8, i8* %27
%29 = zext i8 %28 to i32
%30 = icmp eq i32 %29, 46
br i1 %30, label %31, label %56
31: ; preds = %25
%32 = load i8*, i8** %2
store i8* %32, i8** %3
%33 = load i8*, i8** %3
%34 = getelementptr inbounds i8, i8* %33, i64 -2
store i8* %34, i8** %3
br label %35
35: ; preds = %46, %31
%36 = load i8*, i8** %3
%37 = load i8*, i8** %4
%38 = icmp uge i8* %36, %37
br i1 %38, label %39, label %44
39: ; preds = %35
%40 = load i8*, i8** %3
%41 = load i8, i8* %40
%42 = zext i8 %41 to i32
%43 = icmp ne i32 %42, 92
br label %44
44: ; preds = %39, %35
%45 = phi i1 [ false, %35 ], [ %43, %39 ]
br i1 %45, label %46, label %49
46: ; preds = %44
%47 = load i8*, i8** %3
%48 = getelementptr inbounds i8, i8* %47, i32 -1
store i8* %48, i8** %3
br label %35
49: ; preds = %44
%50 = load i8*, i8** %3
%51 = getelementptr inbounds i8, i8* %50, i32 1
store i8* %51, i8** %3
%52 = load i8*, i8** %2
%53 = getelementptr inbounds i8, i8* %52, i64 3
%54 = load i8*, i8** %3
%55 = call i32 @strcpy(i8* %53, i8* %54)
br label %67
56: ; preds = %25, %20
%57 = load i8*, i8** %2
%58 = load i8, i8* %57
%59 = zext i8 %58 to i32
%60 = icmp eq i32 %59, 46
br i1 %60, label %61, label %66
61: ; preds = %56
%62 = load i8*, i8** %2
%63 = getelementptr inbounds i8, i8* %62, i64 2
%64 = load i8*, i8** %2
%65 = call i32 @strcpy(i8* %63, i8* %64)
br label %66
66: ; preds = %61, %56
br label %67
67: ; preds = %66, %49
%68 = load i8*, i8** %2
%69 = getelementptr inbounds i8, i8* %68, i32 1
store i8* %69, i8** %2
br label %15
70: ; preds = %15
ret void
}

LLVM IR (-O2):
define void @phrase_path(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 32
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %2, label %7
7: ; preds = %2, %32
%8 = phi i8 [ %34, %32 ], [ %4, %2 ]
%9 = phi i8* [ %33, %32 ], [ %3, %2 ]
switch i8 %8, label %32 [
i8 0, label %35
i8 46, label %10
]
10: ; preds = %7
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 46
br i1 %13, label %14, label %27
14: ; preds = %10
%15 = getelementptr inbounds i8, i8* %9, i64 -2
%16 = icmp ult i8* %15, %0
br i1 %16, label %24, label %17
17: ; preds = %14, %21
%18 = phi i8* [ %22, %21 ], [ %15, %14 ]
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 92
br i1 %20, label %24, label %21
21: ; preds = %17
%22 = getelementptr inbounds i8, i8* %18, i64 -1
%23 = icmp ult i8* %22, %0
br i1 %23, label %24, label %17
24: ; preds = %17, %21, %14
%25 = phi i8* [ %15, %14 ], [ %22, %21 ], [ %18, %17 ]
%26 = getelementptr inbounds i8, i8* %25, i64 1
br label %27
27: ; preds = %10, %24
%28 = phi i64 [ 3, %24 ], [ 2, %10 ]
%29 = phi i8* [ %26, %24 ], [ %9, %10 ]
%30 = getelementptr inbounds i8, i8* %9, i64 %28
%31 = tail call i32 @strcpy(i8* %30, i8* %29)
br label %32
32: ; preds = %27, %7
%33 = getelementptr inbounds i8, i8* %9, i64 1
%34 = load i8, i8* %33
br label %7
35: ; preds = %7
ret void
}