#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 *str_replace(char *, char *, char *);
char *formatPath(char *path) {
  char *newPath = str_replace(path, "/", "//");
  char *intermediate = str_replace(newPath, " ", "");
  char *finalPath = str_replace(intermediate, "\\", " ");
  return finalPath;
}


x86 assembly (clang, -O0):
<formatPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeda(%rip),%rsi
lea    0xed2(%rip),%rdx
call   1030 <str_replace@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec1(%rip),%rsi
lea    0xebb(%rip),%rdx
call   1030 <str_replace@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xea8(%rip),%rsi
lea    0xe9f(%rip),%rdx
call   1030 <str_replace@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<formatPath>:
push   %rbx
lea    0xee9(%rip),%rsi
lea    0xee1(%rip),%rdx
call   1030 <str_replace@plt>
lea    0xed8(%rip),%rbx
lea    0xed2(%rip),%rdx
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <str_replace@plt>
lea    0xec1(%rip),%rsi
mov    %rax,%rdi
mov    %rbx,%rdx
pop    %rbx
jmp    1030 <str_replace@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
@.str.1 = [3 x i8] c"//\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [2 x i8] c"\\\00"
define i8* @formatPath(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @str_replace(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = call i8* @str_replace(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = call i8* @str_replace(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i8* %11, i8** %5
%12 = load i8*, i8** %5
ret i8* %12
}

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
@.str.1 = [3 x i8] c"//\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [2 x i8] c"\\\00"
define i8* @formatPath(i8* %0) {
%2 = tail call i8* @str_replace(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i8* @str_replace(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%4 = tail call i8* @str_replace(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i8* %4
}