#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 */
typedef int /*<<< orphan*/ S2;
typedef int /*<<< orphan*/ S1;

/* Variables and functions */
int strcasecmp(char *, char *);
char *strchr(char *, char);
int /*<<< orphan*/ strncpy(char *, char *, int);
int stricomp(char *Str1, char *Str2) {
  char S1[512], S2[512];
  char *chptr;
  strncpy(S1, Str1, sizeof(S1));
  strncpy(S2, Str2, sizeof(S2));
  while ((chptr = strchr(S1, '\\')) != NULL) {
    *chptr = '_';
  }
  while ((chptr = strchr(S2, '\\')) != NULL) {
    *chptr = '_';
  }
  while ((chptr = strchr(S1, '/')) != NULL) {
    *chptr = '_';
  }
  while ((chptr = strchr(S2, '/')) != NULL) {
    *chptr = '_';
  }
  return strcasecmp(S1, S2);
}


x86 assembly (clang, -O0):
<stricomp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x200,%edx
call   1040 <strncpy@plt>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x200,%edx
call   1040 <strncpy@plt>
lea    -0x210(%rbp),%rdi
mov    $0x5c,%esi
call   1050 <strchr@plt>
mov    %rax,-0x418(%rbp)
cmp    $0x0,%rax
je     119e <stricomp+0x6e>
mov    -0x418(%rbp),%rax
movb   $0x5f,(%rax)
jmp    116d <stricomp+0x3d>
jmp    11a3 <stricomp+0x73>
lea    -0x410(%rbp),%rdi
mov    $0x5c,%esi
call   1050 <strchr@plt>
mov    %rax,-0x418(%rbp)
cmp    $0x0,%rax
je     11d4 <stricomp+0xa4>
mov    -0x418(%rbp),%rax
movb   $0x5f,(%rax)
jmp    11a3 <stricomp+0x73>
jmp    11d9 <stricomp+0xa9>
lea    -0x210(%rbp),%rdi
mov    $0x2f,%esi
call   1050 <strchr@plt>
mov    %rax,-0x418(%rbp)
cmp    $0x0,%rax
je     120a <stricomp+0xda>
mov    -0x418(%rbp),%rax
movb   $0x5f,(%rax)
jmp    11d9 <stricomp+0xa9>
jmp    120f <stricomp+0xdf>
lea    -0x410(%rbp),%rdi
mov    $0x2f,%esi
call   1050 <strchr@plt>
mov    %rax,-0x418(%rbp)
cmp    $0x0,%rax
je     1240 <stricomp+0x110>
mov    -0x418(%rbp),%rax
movb   $0x5f,(%rax)
jmp    120f <stricomp+0xdf>
lea    -0x210(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1030 <strcasecmp@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stricomp>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0x200(%rsp),%r14
mov    %r14,%rdi
mov    $0x200,%edx
call   1040 <strncpy@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
mov    $0x200,%edx
call   1040 <strncpy@plt>
mov    %r14,%rdi
mov    $0x5c,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     1195 <stricomp+0x65>
lea    0x200(%rsp),%rbx
nop
movb   $0x5f,(%rax)
mov    %rbx,%rdi
mov    $0x5c,%esi
call   1050 <strchr@plt>
test   %rax,%rax
jne    1180 <stricomp+0x50>
mov    %rsp,%rdi
mov    $0x5c,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     11c5 <stricomp+0x95>
mov    %rsp,%rbx
nopw   0x0(%rax,%rax,1)
movb   $0x5f,(%rax)
mov    %rbx,%rdi
mov    $0x5c,%esi
call   1050 <strchr@plt>
test   %rax,%rax
jne    11b0 <stricomp+0x80>
lea    0x200(%rsp),%rdi
mov    $0x2f,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     1205 <stricomp+0xd5>
lea    0x200(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movb   $0x5f,(%rax)
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1050 <strchr@plt>
test   %rax,%rax
jne    11f0 <stricomp+0xc0>
mov    %rsp,%rdi
mov    $0x2f,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     1235 <stricomp+0x105>
mov    %rsp,%rbx
nopw   0x0(%rax,%rax,1)
movb   $0x5f,(%rax)
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1050 <strchr@plt>
test   %rax,%rax
jne    1220 <stricomp+0xf0>
lea    0x200(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <strcasecmp@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @stricomp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [512 x i8]
%6 = alloca [512 x i8]
%7 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%9 = load i8*, i8** %3
%10 = call i32 @strncpy(i8* %8, i8* %9, i32 512)
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%12 = load i8*, i8** %4
%13 = call i32 @strncpy(i8* %11, i8* %12, i32 512)
br label %14
14: ; preds = %18, %2
%15 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%16 = call i8* @strchr(i8* %15, i8 signext 92)
store i8* %16, i8** %7
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = load i8*, i8** %7
store i8 95, i8* %19
br label %14
20: ; preds = %14
br label %21
21: ; preds = %25, %20
%22 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%23 = call i8* @strchr(i8* %22, i8 signext 92)
store i8* %23, i8** %7
%24 = icmp ne i8* %23, null
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = load i8*, i8** %7
store i8 95, i8* %26
br label %21
27: ; preds = %21
br label %28
28: ; preds = %32, %27
%29 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%30 = call i8* @strchr(i8* %29, i8 signext 47)
store i8* %30, i8** %7
%31 = icmp ne i8* %30, null
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = load i8*, i8** %7
store i8 95, i8* %33
br label %28
34: ; preds = %28
br label %35
35: ; preds = %39, %34
%36 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%37 = call i8* @strchr(i8* %36, i8 signext 47)
store i8* %37, i8** %7
%38 = icmp ne i8* %37, null
br i1 %38, label %39, label %41
39: ; preds = %35
%40 = load i8*, i8** %7
store i8 95, i8* %40
br label %35
41: ; preds = %35
%42 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%43 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%44 = call i32 @strcasecmp(i8* %42, i8* %43)
ret i32 %44
}

LLVM IR (-O2):
define i32 @stricomp(i8* %0, i8* %1) {
%3 = alloca [512 x i8]
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%7 = call i32 @strncpy(i8* %5, i8* %0, i32 512)
%8 = call i32 @strncpy(i8* %6, i8* %1, i32 512)
%9 = call i8* @strchr(i8* %5, i8 signext 92)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %14, %2
%12 = call i8* @strchr(i8* %6, i8 signext 92)
%13 = icmp eq i8* %12, null
br i1 %13, label %18, label %21
14: ; preds = %2, %14
%15 = phi i8* [ %16, %14 ], [ %9, %2 ]
store i8 95, i8* %15
%16 = call i8* @strchr(i8* %5, i8 signext 92)
%17 = icmp eq i8* %16, null
br i1 %17, label %11, label %14
18: ; preds = %21, %11
%19 = call i8* @strchr(i8* %5, i8 signext 47)
%20 = icmp eq i8* %19, null
br i1 %20, label %25, label %28
21: ; preds = %11, %21
%22 = phi i8* [ %23, %21 ], [ %12, %11 ]
store i8 95, i8* %22
%23 = call i8* @strchr(i8* %6, i8 signext 92)
%24 = icmp eq i8* %23, null
br i1 %24, label %18, label %21
25: ; preds = %28, %18
%26 = call i8* @strchr(i8* %6, i8 signext 47)
%27 = icmp eq i8* %26, null
br i1 %27, label %36, label %32
28: ; preds = %18, %28
%29 = phi i8* [ %30, %28 ], [ %19, %18 ]
store i8 95, i8* %29
%30 = call i8* @strchr(i8* %5, i8 signext 47)
%31 = icmp eq i8* %30, null
br i1 %31, label %25, label %28
32: ; preds = %25, %32
%33 = phi i8* [ %34, %32 ], [ %26, %25 ]
store i8 95, i8* %33
%34 = call i8* @strchr(i8* %6, i8 signext 47)
%35 = icmp eq i8* %34, null
br i1 %35, label %36, label %32
36: ; preds = %32, %25
%37 = call i32 @strcasecmp(i8* %5, i8* %6)
ret i32 %37
}