#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 */
scalar_t__ file_IsDirectorySeparator(char);
char file_NativeSlash();
unsigned int strlen(char *);
void file_MakeSlashesNative(char *path) {
  unsigned int i = 0;
  while (i < strlen(path)) {
    if (file_IsDirectorySeparator(path[i])) {
      path[i] = file_NativeSlash();
    }
    i++;
  }
}


x86 assembly (clang, -O0):
<file_MakeSlashesNative>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jae    119a <file_MakeSlashesNative+0x6a>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   1040 <file_IsDirectorySeparator@plt>
cmp    $0x0,%rax
je     118c <file_MakeSlashesNative+0x5c>
mov    $0x0,%al
call   1050 <file_NativeSlash@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <file_MakeSlashesNative+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_MakeSlashesNative>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
je     117f <file_MakeSlashesNative+0x4f>
xor    %ebx,%ebx
jmp    1163 <file_MakeSlashesNative+0x33>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%eax
cmp    %rax,%rbx
jae    117f <file_MakeSlashesNative+0x4f>
movsbl (%r14,%rbx,1),%edi
call   1040 <file_IsDirectorySeparator@plt>
test   %rax,%rax
je     1150 <file_MakeSlashesNative+0x20>
xor    %eax,%eax
call   1050 <file_NativeSlash@plt>
mov    %al,(%r14,%rbx,1)
jmp    1150 <file_MakeSlashesNative+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @file_MakeSlashesNative(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %23, %1
%5 = load i32, i32* %3
%6 = load i8*, i8** %2
%7 = call i32 @strlen(i8* %6)
%8 = icmp ult i32 %5, %7
br i1 %8, label %9, label %26
9: ; preds = %4
%10 = load i8*, i8** %2
%11 = load i32, i32* %3
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = load i8, i8* %13
%15 = call i64 @file_IsDirectorySeparator(i8 signext %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %9
%18 = call signext i8 (...) @file_NativeSlash()
%19 = load i8*, i8** %2
%20 = load i32, i32* %3
%21 = zext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
store i8 %18, i8* %22
br label %23
23: ; preds = %17, %9
%24 = load i32, i32* %3
%25 = add i32 %24, 1
store i32 %25, i32* %3
br label %4
26: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @file_MakeSlashesNative(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1, %12
%5 = phi i64 [ %13, %12 ], [ 0, %1 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = tail call i64 @file_IsDirectorySeparator(i8 signext %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %4
%11 = tail call signext i8 (...) @file_NativeSlash()
store i8 %11, i8* %6
br label %12
12: ; preds = %10, %4
%13 = add nuw nsw i64 %5, 1
%14 = tail call i32 @strlen(i8* %0)
%15 = zext i32 %14 to i64
%16 = icmp ult i64 %13, %15
br i1 %16, label %4, label %17
17: ; preds = %12, %1
ret void
}