#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void printConvertedPath(FILE *output, char *path) {
  char *workPath = path;
  while (*workPath != '\0') {
    switch (*workPath) {
    case '.':
    case '/':
    case '\\':
      fprintf(output, "_");
      break;
    default:
      fprintf(output, "%c", *workPath);
    }
    ++workPath;
  }
}


x86 assembly (clang, -O0):
<printConvertedPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11a5 <printConvertedPath+0x95>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x1c(%rbp)
add    $0xffffffd2,%eax
sub    $0x2,%eax
jb     1164 <printConvertedPath+0x54>
jmp    1153 <printConvertedPath+0x43>
mov    -0x1c(%rbp),%eax
sub    $0x5c,%eax
jne    117b <printConvertedPath+0x6b>
jmp    1164 <printConvertedPath+0x54>
mov    -0x8(%rbp),%rdi
lea    0xe91(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1194 <printConvertedPath+0x84>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movsbl (%rax),%edx
lea    0xe75(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <printConvertedPath+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printConvertedPath>:
push   %r15
push   %r14
push   %rbx
mov    (%rsi),%al
test   %al,%al
je     116d <printConvertedPath+0x5d>
mov    %rsi,%rbx
mov    %rdi,%r14
add    $0x1,%rbx
movabs $0x400000000003,%r15
jmp    1155 <printConvertedPath+0x45>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %eax,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     116d <printConvertedPath+0x5d>
movsbl %al,%eax
lea    -0x2e(%rax),%ecx
cmp    $0x2e,%ecx
ja     1140 <printConvertedPath+0x30>
mov    $0x5f,%edi
bt     %rcx,%r15
jb     1142 <printConvertedPath+0x32>
jmp    1140 <printConvertedPath+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"_\00"
@.str.1 = [3 x i8] c"%c\00"
define void @printConvertedPath(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
store i8* %6, i8** %5
br label %7
7: ; preds = %25, %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 %28
12: ; preds = %7
%13 = load i8*, i8** %5
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
switch i32 %15, label %19 [
i32 46, label %16
i32 47, label %16
i32 92, label %16
]
16: ; preds = %12, %12, %12
%17 = load i32*, i32** %3
%18 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %25
19: ; preds = %12
%20 = load i32*, i32** %3
%21 = load i8*, i8** %5
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %19, %16
%26 = load i8*, i8** %5
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %5
br label %7
28: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @printConvertedPath(i32* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %10
%6 = phi i8 [ %14, %10 ], [ %3, %2 ]
%7 = phi i8* [ %13, %10 ], [ %1, %2 ]
%8 = sext i8 %6 to i32
switch i32 %8, label %9 [
i32 46, label %10
i32 47, label %10
i32 92, label %10
]
9: ; preds = %5
br label %10
10: ; preds = %5, %5, %5, %9
%11 = phi i32 [ %8, %9 ], [ 95, %5 ], [ 95, %5 ], [ 95, %5 ]
%12 = tail call i32 @fputc(i32 %11, i32* %0)
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %10, %2
ret void
}