#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__ isupper(char);
int /*<<< orphan*/ tolower(char);
void remapFileName(const char *name, char *mapName) {
  char c;
  while ((c = *name++) != '\0') {
    if (c == '\\')
      *mapName++ = '/';
    else if (isupper(c))
      *mapName++ = tolower(c);
    else
      *mapName++ = c;
  }
  *mapName = '\0';
}


x86 assembly (clang, -O0):
<remapFileName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     11c6 <remapFileName+0xa6>
movsbl -0x11(%rbp),%eax
cmp    $0x5c,%eax
jne    1174 <remapFileName+0x54>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x2f,(%rax)
jmp    11c1 <remapFileName+0xa1>
movsbl -0x11(%rbp),%edi
call   1040 <isupper@plt>
cmp    $0x0,%rax
je     11a8 <remapFileName+0x88>
movsbl -0x11(%rbp),%edi
call   1030 <tolower@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    11bc <remapFileName+0x9c>
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    11c1 <remapFileName+0xa1>
jmp    1130 <remapFileName+0x10>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remapFileName>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebp,%ebp
jmp    1148 <remapFileName+0x28>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %al,(%r14,%rbp,1)
add    $0x1,%rbp
movzbl (%r15,%rbp,1),%ebx
mov    $0x2f,%al
cmp    $0x5c,%bl
je     1140 <remapFileName+0x20>
test   %bl,%bl
je     1178 <remapFileName+0x58>
movsbl %bl,%r12d
mov    %r12d,%edi
call   1040 <isupper@plt>
mov    %rax,%rcx
mov    %ebx,%eax
test   %rcx,%rcx
je     1140 <remapFileName+0x20>
mov    %r12d,%edi
call   1030 <tolower@plt>
jmp    1140 <remapFileName+0x20>
movb   $0x0,(%r14,%rbp,1)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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