#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 path_getseparator(char const *);
void path_translateInPlace(char *buffer, const char *type) {
  char *ptr;
  for (ptr = buffer; *ptr != '\0'; ++ptr) {
    if (*ptr == '\\' || *ptr == '/')
      *ptr = path_getseparator(type);
  }
}


x86 assembly (clang, -O0):
<path_translateInPlace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     117f <path_translateInPlace+0x6f>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
je     1158 <path_translateInPlace+0x48>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1169 <path_translateInPlace+0x59>
mov    -0x10(%rbp),%rdi
call   1030 <path_getseparator@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
jmp    116e <path_translateInPlace+0x5e>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <path_translateInPlace+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<path_translateInPlace>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
jmp    112e <path_translateInPlace+0x1e>
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <path_getseparator@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x2f,%al
je     1120 <path_translateInPlace+0x10>
cmp    $0x5c,%al
je     1120 <path_translateInPlace+0x10>
test   %al,%al
jne    112a <path_translateInPlace+0x1a>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @path_translateInPlace(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
br label %7
7: ; preds = %27, %2
%8 = load i8*, i8** %5
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %30
12: ; preds = %7
%13 = load i8*, i8** %5
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 92
br i1 %16, label %22, label %17
17: ; preds = %12
%18 = load i8*, i8** %5
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 47
br i1 %21, label %22, label %26
22: ; preds = %17, %12
%23 = load i8*, i8** %4
%24 = call signext i8 @path_getseparator(i8* %23)
%25 = load i8*, i8** %5
store i8 %24, i8* %25
br label %26
26: ; preds = %22, %17
br label %27
27: ; preds = %26
%28 = load i8*, i8** %5
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %5
br label %7
30: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @path_translateInPlace(i8* nocapture %0, i8* %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i8* [ %0, %2 ], [ %9, %8 ]
%5 = load i8, i8* %4
switch i8 %5, label %8 [
i8 0, label %10
i8 92, label %6
i8 47, label %6
]
6: ; preds = %3, %3
%7 = tail call signext i8 @path_getseparator(i8* %1)
store i8 %7, i8* %4
br label %8
8: ; preds = %3, %6
%9 = getelementptr inbounds i8, i8* %4, i64 1
br label %3
10: ; preds = %3
ret void
}