#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__ IRCUppercase(char const);
int IRCStrcmp(const char *str1, const char *str2) {
  unsigned char c1, c2;
  for (; IRCUppercase(*str1) == IRCUppercase(*str2); str1++, str2++) {
    if (*str1 == '\0')
      return 0;
  }
  c1 = (unsigned char)IRCUppercase(*str1);
  c2 = (unsigned char)IRCUppercase(*str2);
  return c1 < c2 ? -1 : 1;
}


x86 assembly (clang, -O0):
<IRCStrcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <IRCUppercase@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <IRCUppercase@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jne    118a <IRCStrcmp+0x7a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1168 <IRCStrcmp+0x58>
movl   $0x0,-0x4(%rbp)
jmp    11c2 <IRCStrcmp+0xb2>
jmp    116d <IRCStrcmp+0x5d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1120 <IRCStrcmp+0x10>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <IRCUppercase@plt>
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <IRCUppercase@plt>
mov    %al,-0x1a(%rbp)
movzbl -0x19(%rbp),%edx
movzbl -0x1a(%rbp),%esi
mov    $0x1,%eax
mov    $0xffffffff,%ecx
cmp    %esi,%edx
cmovl  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IRCStrcmp>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <IRCUppercase@plt>
mov    %rax,%r15
movsbl (%r14),%edi
call   1030 <IRCUppercase@plt>
cmp    %rax,%r15
jne    116d <IRCStrcmp+0x5d>
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,(%rbx)
je     119a <IRCStrcmp+0x8a>
lea    0x1(%r14),%r12
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <IRCUppercase@plt>
mov    %rax,%r15
movsbl 0x1(%r14),%edi
call   1030 <IRCUppercase@plt>
mov    %r12,%r14
cmp    %rax,%r15
je     1140 <IRCStrcmp+0x30>
jmp    1170 <IRCStrcmp+0x60>
mov    %r14,%r12
movsbl (%rbx),%edi
call   1030 <IRCUppercase@plt>
mov    %rax,%rbx
movsbl (%r12),%edi
call   1030 <IRCUppercase@plt>
movzbl %bl,%ecx
movzbl %al,%eax
xor    %edx,%edx
cmp    %eax,%ecx
setae  %dl
lea    (%rdx,%rdx,1),%eax
add    $0xffffffff,%eax
jmp    119c <IRCStrcmp+0x8c>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @IRCStrcmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
br label %8
8: ; preds = %23, %2
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = call i64 @IRCUppercase(i8 signext %10)
%12 = load i8*, i8** %5
%13 = load i8, i8* %12
%14 = call i64 @IRCUppercase(i8 signext %13)
%15 = icmp eq i64 %11, %14
br i1 %15, label %16, label %28
16: ; preds = %8
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %16
store i32 0, i32* %3
br label %44
22: ; preds = %16
br label %23
23: ; preds = %22
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %4
%26 = load i8*, i8** %5
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %5
br label %8
28: ; preds = %8
%29 = load i8*, i8** %4
%30 = load i8, i8* %29
%31 = call i64 @IRCUppercase(i8 signext %30)
%32 = trunc i64 %31 to i8
store i8 %32, i8* %6
%33 = load i8*, i8** %5
%34 = load i8, i8* %33
%35 = call i64 @IRCUppercase(i8 signext %34)
%36 = trunc i64 %35 to i8
store i8 %36, i8* %7
%37 = load i8, i8* %6
%38 = zext i8 %37 to i32
%39 = load i8, i8* %7
%40 = zext i8 %39 to i32
%41 = icmp slt i32 %38, %40
%42 = zext i1 %41 to i64
%43 = select i1 %41, i32 -1, i32 1
store i32 %43, i32* %3
br label %44
44: ; preds = %28, %21
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
define i32 @IRCStrcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = tail call i64 @IRCUppercase(i8 signext %3)
%5 = load i8, i8* %1
%6 = tail call i64 @IRCUppercase(i8 signext %5)
%7 = icmp eq i64 %4, %6
br i1 %7, label %8, label %21
8: ; preds = %2, %13
%9 = phi i8* [ %14, %13 ], [ %0, %2 ]
%10 = phi i8* [ %15, %13 ], [ %1, %2 ]
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %34, label %13
13: ; preds = %8
%14 = getelementptr inbounds i8, i8* %9, i64 1
%15 = getelementptr inbounds i8, i8* %10, i64 1
%16 = load i8, i8* %14
%17 = tail call i64 @IRCUppercase(i8 signext %16)
%18 = load i8, i8* %15
%19 = tail call i64 @IRCUppercase(i8 signext %18)
%20 = icmp eq i64 %17, %19
br i1 %20, label %8, label %21
21: ; preds = %13, %2
%22 = phi i8* [ %1, %2 ], [ %15, %13 ]
%23 = phi i8* [ %0, %2 ], [ %14, %13 ]
%24 = load i8, i8* %23
%25 = tail call i64 @IRCUppercase(i8 signext %24)
%26 = trunc i64 %25 to i32
%27 = load i8, i8* %22
%28 = tail call i64 @IRCUppercase(i8 signext %27)
%29 = trunc i64 %28 to i32
%30 = and i32 %26, 255
%31 = and i32 %29, 255
%32 = icmp ult i32 %30, %31
%33 = select i1 %32, i32 -1, i32 1
br label %34
34: ; preds = %8, %21
%35 = phi i32 [ %33, %21 ], [ 0, %8 ]
ret i32 %35
}