#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ mtf_is_ascii(char);
void mtf_fix_filepath(char *pathInOut) {
  assert(pathInOut != NULL);
  char *p = pathInOut;
  while (*p != '\0') {
    if (*p == '\\') {
      *p = '/';
    } else if (!mtf_is_ascii(*p)) {
      *p = '?';
    }
    ++p;
  }
}


x86 assembly (clang, -O0):
<mtf_fix_filepath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11a4 <mtf_fix_filepath+0x84>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    1172 <mtf_fix_filepath+0x52>
mov    -0x10(%rbp),%rax
movb   $0x2f,(%rax)
jmp    1193 <mtf_fix_filepath+0x73>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <mtf_is_ascii@plt>
cmp    $0x0,%eax
jne    118e <mtf_fix_filepath+0x6e>
mov    -0x10(%rbp),%rax
movb   $0x3f,(%rax)
jmp    1193 <mtf_fix_filepath+0x73>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1146 <mtf_fix_filepath+0x26>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mtf_fix_filepath>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
jmp    1146 <mtf_fix_filepath+0x26>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %cl,(%rbx)
add    $0x1,%rbx
movzbl (%rbx),%eax
mov    $0x2f,%cl
cmp    $0x5c,%al
je     1140 <mtf_fix_filepath+0x20>
test   %al,%al
je     1163 <mtf_fix_filepath+0x43>
movsbl %al,%edi
call   1030 <mtf_is_ascii@plt>
test   %eax,%eax
jne    1142 <mtf_fix_filepath+0x22>
mov    $0x3f,%cl
jmp    1140 <mtf_fix_filepath+0x20>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @mtf_fix_filepath(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
br label %5
5: ; preds = %13, %1
%6 = phi i8* [ %0, %1 ], [ %14, %13 ]
%7 = load i8, i8* %6
switch i8 %7, label %8 [
i8 0, label %15
i8 92, label %11
]
8: ; preds = %5
%9 = tail call i32 @mtf_is_ascii(i8 signext %7)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8, %5
%12 = phi i8 [ 47, %5 ], [ 63, %8 ]
store i8 %12, i8* %6
br label %13
13: ; preds = %11, %8
%14 = getelementptr inbounds i8, i8* %6, i64 1
br label %5
15: ; preds = %5
ret void
}