#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 */
int toupper(char const);
int WpeStrccmp(const char *s1, const char *s2) {
  for (; (*s1) && (toupper(*s1) == toupper(*s2)); s1++, s2++)
    ;
  return (toupper(*s1) - toupper(*s2));
}


x86 assembly (clang, -O0):
<WpeStrccmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     115d <WpeStrccmp+0x4d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    116d <WpeStrccmp+0x5d>
jmp    118f <WpeStrccmp+0x7f>
jmp    1172 <WpeStrccmp+0x62>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <WpeStrccmp+0x10>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
sub    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WpeStrccmp>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    (%rdi),%al
test   %al,%al
je     1156 <WpeStrccmp+0x46>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %eax,%ebp
movsbl (%r14),%edi
call   1030 <toupper@plt>
cmp    %eax,%ebp
jne    115a <WpeStrccmp+0x4a>
add    $0x1,%r14
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <WpeStrccmp+0x20>
xor    %eax,%eax
jmp    115d <WpeStrccmp+0x4d>
mov    -0x1(%rbx),%al
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %eax,%ebx
movsbl (%r14),%edi
call   1030 <toupper@plt>
sub    %eax,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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