#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__ tolower(int /*<<< orphan*/);
int WXHash_StrCaseEqualsFn(void *keya, void *keyb) {
  char *ptra = (char *)keya, *ptrb = (char *)keyb;
  while (*ptra != '\0') {
    if (tolower(*(ptra++)) != tolower(*(ptrb++)))
      return 0;
  }
  if (*ptrb != '\0')
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<WXHash_StrCaseEqualsFn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1193 <WXHash_StrCaseEqualsFn+0x83>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
je     118e <WXHash_StrCaseEqualsFn+0x7e>
movl   $0x0,-0x4(%rbp)
jmp    11b6 <WXHash_StrCaseEqualsFn+0xa6>
jmp    1130 <WXHash_StrCaseEqualsFn+0x20>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11af <WXHash_StrCaseEqualsFn+0x9f>
movl   $0x0,-0x4(%rbp)
jmp    11b6 <WXHash_StrCaseEqualsFn+0xa6>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WXHash_StrCaseEqualsFn>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
movsbl (%r15,%rbx,1),%edi
test   %edi,%edi
je     1148 <WXHash_StrCaseEqualsFn+0x38>
call   1030 <tolower@plt>
mov    %rax,%r12
movsbl (%r14,%rbx,1),%edi
call   1030 <tolower@plt>
add    $0x1,%rbx
cmp    %rax,%r12
je     1120 <WXHash_StrCaseEqualsFn+0x10>
xor    %eax,%eax
jmp    1152 <WXHash_StrCaseEqualsFn+0x42>
xor    %eax,%eax
cmpb   $0x0,(%r14,%rbx,1)
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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