#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 toupper(char);
void normalize_filename(char *name) {
  int i = 0;
  char c;
  while ((c = name[i]) != '\0') {
    if (c == '\\') {
      name[i] = '/';
    } else {
      name[i] = toupper(c);
    }
    i++;
  }
}


x86 assembly (clang, -O0):
<normalize_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0xd(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     117f <normalize_filename+0x6f>
movsbl -0xd(%rbp),%eax
cmp    $0x5c,%eax
jne    115b <normalize_filename+0x4b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x2f,(%rax,%rcx,1)
jmp    1171 <normalize_filename+0x61>
movsbl -0xd(%rbp),%edi
call   1030 <toupper@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <normalize_filename+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normalize_filename>:
push   %rbx
mov    %rdi,%rbx
jmp    1126 <normalize_filename+0x16>
cs nopw 0x0(%rax,%rax,1)
mov    %al,(%rbx)
add    $0x1,%rbx
movzbl (%rbx),%ecx
mov    $0x2f,%al
cmp    $0x5c,%cl
je     1120 <normalize_filename+0x10>
test   %cl,%cl
je     113e <normalize_filename+0x2e>
movsbl %cl,%edi
call   1030 <toupper@plt>
jmp    1120 <normalize_filename+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @normalize_filename(i8* nocapture %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i64 [ %10, %8 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
switch i8 %5, label %6 [
i8 0, label %11
i8 92, label %8
]
6: ; preds = %2
%7 = tail call signext i8 @toupper(i8 signext %5)
br label %8
8: ; preds = %2, %6
%9 = phi i8 [ %7, %6 ], [ 47, %2 ]
store i8 %9, i8* %4
%10 = add nuw i64 %3, 1
br label %2
11: ; preds = %2
ret void
}