#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 /*<<< orphan*/ memcmp(unsigned char const *, unsigned char const *, size_t);
int /*<<< orphan*/ skip_prefix(unsigned char const **, size_t *,
                               unsigned char const *, size_t, unsigned int);
int equal_case(const unsigned char *pattern, size_t pattern_len,
               const unsigned char *subject, size_t subject_len,
               unsigned int flags) {
  skip_prefix(&pattern, &pattern_len, subject, subject_len, flags);
  if (pattern_len != subject_len)
    return 0;
  return !memcmp(pattern, subject, pattern_len);
}


x86 assembly (clang, -O0):
<equal_case>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x2c(%rbp),%r8d
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <skip_prefix@plt>
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
je     116f <equal_case+0x4f>
movl   $0x0,-0x4(%rbp)
jmp    1190 <equal_case+0x70>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<equal_case>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rdi,0x10(%rsp)
mov    %rsi,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <skip_prefix@plt>
xor    %eax,%eax
cmp    %rbx,0x8(%rsp)
jne    1168 <equal_case+0x48>
mov    0x10(%rsp),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <bcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @equal_case(i8* %0, i64 %1, i8* %2, i64 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32
store i8* %0, i8** %7
store i64 %1, i64* %8
store i8* %2, i8** %9
store i64 %3, i64* %10
store i32 %4, i32* %11
%12 = load i8*, i8** %9
%13 = load i64, i64* %10
%14 = load i32, i32* %11
%15 = call i32 @skip_prefix(i8** %7, i64* %8, i8* %12, i64 %13, i32 %14)
%16 = load i64, i64* %8
%17 = load i64, i64* %10
%18 = icmp ne i64 %16, %17
br i1 %18, label %19, label %20
19: ; preds = %5
store i32 0, i32* %6
br label %28
20: ; preds = %5
%21 = load i8*, i8** %7
%22 = load i8*, i8** %9
%23 = load i64, i64* %8
%24 = call i32 @memcmp(i8* %21, i8* %22, i64 %23)
%25 = icmp ne i32 %24, 0
%26 = xor i1 %25, true
%27 = zext i1 %26 to i32
store i32 %27, i32* %6
br label %28
28: ; preds = %20, %19
%29 = load i32, i32* %6
ret i32 %29
}

LLVM IR (-O2):
define i32 @equal_case(i8* %0, i64 %1, i8* %2, i64 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i64
store i8* %0, i8** %6
store i64 %1, i64* %7
%8 = call i32 @skip_prefix(i8** %6, i64* %7, i8* %2, i64 %3, i32 %4)
%9 = load i64, i64* %7
%10 = icmp eq i64 %9, %3
br i1 %10, label %11, label %16
11: ; preds = %5
%12 = load i8*, i8** %6
%13 = call i32 @bcmp(i8* %12, i8* %2, i64 %3)
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %5, %11
%17 = phi i32 [ %15, %11 ], [ 0, %5 ]
ret i32 %17
}