#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 localize_path(char *path) {
  int i;
  if (path == NULL)
    return 0;
  for (i = 0; path[i] != 0; i++) {
    if (path[i] == '\\')
      path[i] = '/';
  }
  return 1;
}


x86 assembly (clang, -O0):
<localize_path>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    111f <localize_path+0x1f>
movl   $0x0,-0x4(%rbp)
jmp    1176 <localize_path+0x76>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     116f <localize_path+0x6f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5c,%eax
jne    115c <localize_path+0x5c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x2f,(%rax,%rcx,1)
jmp    1161 <localize_path+0x61>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <localize_path+0x26>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<localize_path>:
test   %rdi,%rdi
jne    1117 <localize_path+0x17>
xor    %eax,%eax
ret
nopl   0x0(%rax,%rax,1)
movb   $0x2f,(%rdi)
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x5c,%al
je     1110 <localize_path+0x10>
test   %al,%al
jne    1113 <localize_path+0x13>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @localize_path(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1, %8
%4 = phi i64 [ %9, %8 ], [ 0, %1 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
switch i8 %6, label %8 [
i8 0, label %10
i8 92, label %7
]
7: ; preds = %3
store i8 47, i8* %5
br label %8
8: ; preds = %3, %7
%9 = add nuw i64 %4, 1
br label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ 1, %3 ]
ret i32 %11
}