#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__ toupper(char);
int wdc_UtilsStrCompare(char *pcSrc, char *pcDst) {
  while ((toupper(*pcSrc) == toupper(*pcDst)) && (*pcSrc != '\0')) {
    pcSrc++;
    pcDst++;
  }
  return *pcSrc - *pcDst;
}


x86 assembly (clang, -O0):
<wdc_UtilsStrCompare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    -0x20(%rbp),%rcx
mov    %rax,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
mov    %al,-0x11(%rbp)
jne    1161 <wdc_UtilsStrCompare+0x51>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1171 <wdc_UtilsStrCompare+0x61>
jmp    118e <wdc_UtilsStrCompare+0x7e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <wdc_UtilsStrCompare+0x10>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wdc_UtilsStrCompare>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <toupper@plt>
mov    %rax,%r15
movsbl (%r14),%edi
call   1030 <toupper@plt>
cmp    %rax,%r15
jne    116d <wdc_UtilsStrCompare+0x5d>
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,(%rbx)
je     116d <wdc_UtilsStrCompare+0x5d>
lea    0x1(%r14),%r12
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <toupper@plt>
mov    %rax,%r15
movsbl 0x1(%r14),%edi
call   1030 <toupper@plt>
mov    %r12,%r14
cmp    %rax,%r15
je     1140 <wdc_UtilsStrCompare+0x30>
jmp    1170 <wdc_UtilsStrCompare+0x60>
mov    %r14,%r12
movsbl (%rbx),%eax
movsbl (%r12),%ecx
sub    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @wdc_UtilsStrCompare(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = tail call i64 @toupper(i8 signext %3)
%5 = load i8, i8* %1
%6 = tail call i64 @toupper(i8 signext %5)
%7 = icmp eq i64 %4, %6
br i1 %7, label %8, label %21
8: ; preds = %2, %13
%9 = phi i8* [ %15, %13 ], [ %1, %2 ]
%10 = phi i8* [ %14, %13 ], [ %0, %2 ]
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %21, label %13
13: ; preds = %8
%14 = getelementptr inbounds i8, i8* %10, i64 1
%15 = getelementptr inbounds i8, i8* %9, i64 1
%16 = load i8, i8* %14
%17 = tail call i64 @toupper(i8 signext %16)
%18 = load i8, i8* %15
%19 = tail call i64 @toupper(i8 signext %18)
%20 = icmp eq i64 %17, %19
br i1 %20, label %8, label %21
21: ; preds = %8, %13, %2
%22 = phi i8* [ %0, %2 ], [ %14, %13 ], [ %10, %8 ]
%23 = phi i8* [ %1, %2 ], [ %15, %13 ], [ %9, %8 ]
%24 = load i8, i8* %22
%25 = sext i8 %24 to i32
%26 = load i8, i8* %23
%27 = sext i8 %26 to i32
%28 = sub nsw i32 %25, %27
ret i32 %28
}