#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*/ memmove(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
void Parse_ConvertPath(char *path) {
  char *ptr;
  for (ptr = path; *ptr;) {
    if ((*ptr == '\\' || *ptr == '/') &&
        (*(ptr + 1) == '\\' || *(ptr + 1) == '/')) {
      memmove(ptr, ptr + 1, strlen(ptr));
    } else {
      ptr++;
    }
  }
  for (ptr = path; *ptr;) {
    if (*ptr == '/' || *ptr == '\\')
      *ptr = '/';
    ptr++;
  }
}


x86 assembly (clang, -O0):
<Parse_ConvertPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11c5 <Parse_ConvertPath+0xa5>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
je     1161 <Parse_ConvertPath+0x41>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    11b4 <Parse_ConvertPath+0x94>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x5c,%eax
je     1183 <Parse_ConvertPath+0x63>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2f,%eax
jne    11b4 <Parse_ConvertPath+0x94>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1040 <memmove@plt>
jmp    11c0 <Parse_ConvertPath+0xa0>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1134 <Parse_ConvertPath+0x14>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1212 <Parse_ConvertPath+0xf2>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     11fa <Parse_ConvertPath+0xda>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    1201 <Parse_ConvertPath+0xe1>
mov    -0x10(%rbp),%rax
movb   $0x2f,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11cd <Parse_ConvertPath+0xad>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Parse_ConvertPath>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    %rdi,%r14
lea    0x1(%r14),%r15
jmp    1155 <Parse_ConvertPath+0x35>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1040 <memmove@plt>
movzbl (%r14),%eax
cmp    $0x2f,%al
je     1161 <Parse_ConvertPath+0x41>
cmp    $0x5c,%al
jne    1170 <Parse_ConvertPath+0x50>
movzbl (%r15),%eax
cmp    $0x5c,%al
je     1140 <Parse_ConvertPath+0x20>
cmp    $0x2f,%al
je     1140 <Parse_ConvertPath+0x20>
jmp    1174 <Parse_ConvertPath+0x54>
nop
test   %al,%al
je     1187 <Parse_ConvertPath+0x67>
mov    %r15,%r14
jmp    112b <Parse_ConvertPath+0xb>
nopl   0x0(%rax)
movb   $0x2f,(%rbx)
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x2f,%al
je     1180 <Parse_ConvertPath+0x60>
cmp    $0x5c,%al
je     1180 <Parse_ConvertPath+0x60>
test   %al,%al
jne    1183 <Parse_ConvertPath+0x63>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @Parse_ConvertPath(i8* %0) {
br label %2
2: ; preds = %12, %1
%3 = phi i8* [ %13, %12 ], [ %0, %1 ]
%4 = getelementptr inbounds i8, i8* %3, i64 1
br label %5
5: ; preds = %2, %9
%6 = load i8, i8* %3
switch i8 %6, label %12 [
i8 0, label %14
i8 92, label %7
i8 47, label %7
]
7: ; preds = %5, %5
%8 = load i8, i8* %4
switch i8 %8, label %12 [
i8 92, label %9
i8 47, label %9
]
9: ; preds = %7, %7
%10 = tail call i32 @strlen(i8* %3)
%11 = tail call i32 @memmove(i8* %3, i8* %4, i32 %10)
br label %5
12: ; preds = %7, %5
%13 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
14: ; preds = %5, %18
%15 = phi i8* [ %19, %18 ], [ %0, %5 ]
%16 = load i8, i8* %15
switch i8 %16, label %18 [
i8 0, label %20
i8 47, label %17
i8 92, label %17
]
17: ; preds = %14, %14
store i8 47, i8* %15
br label %18
18: ; preds = %14, %17
%19 = getelementptr inbounds i8, i8* %15, i64 1
br label %14
20: ; preds = %14
ret void
}