#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*/ uint8_t;

/* Variables and functions */
int toupper(int /*<<< orphan*/);
int wordeq(const uint8_t *a, const char *b, uint8_t l) {
  while (l--)
    if ((*a++ & 0x7F) != toupper(*b++))
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<wordeq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
je     1183 <wordeq+0x73>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%eax
and    $0x7f,%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
je     117e <wordeq+0x6e>
movl   $0x0,-0x4(%rbp)
jmp    118a <wordeq+0x7a>
jmp    1123 <wordeq+0x13>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wordeq>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%r12d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    %ebx,%r12d
je     1152 <wordeq+0x42>
mov    (%r15,%rbx,4),%ebp
and    $0x7f,%ebp
movsbl (%r14,%rbx,1),%edi
call   1030 <toupper@plt>
add    $0x1,%rbx
cmp    %eax,%ebp
je     1130 <wordeq+0x20>
xor    %eax,%eax
jmp    1157 <wordeq+0x47>
mov    $0x1,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @wordeq(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
br label %8
8: ; preds = %24, %3
%9 = load i32, i32* %7
%10 = add nsw i32 %9, -1
store i32 %10, i32* %7
%11 = icmp ne i32 %9, 0
br i1 %11, label %12, label %25
12: ; preds = %8
%13 = load i32*, i32** %5
%14 = getelementptr inbounds i32, i32* %13, i32 1
store i32* %14, i32** %5
%15 = load i32, i32* %13
%16 = and i32 %15, 127
%17 = load i8*, i8** %6
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %6
%19 = load i8, i8* %17
%20 = sext i8 %19 to i32
%21 = call i32 @toupper(i32 %20)
%22 = icmp ne i32 %16, %21
br i1 %22, label %23, label %24
23: ; preds = %12
store i32 0, i32* %4
br label %26
24: ; preds = %12
br label %8
25: ; preds = %8
store i32 1, i32* %4
br label %26
26: ; preds = %25, %23
%27 = load i32, i32* %4
ret i32 %27
}

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