#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 char u_int32_t;
typedef scalar_t__ cb;
typedef scalar_t__ ca;

/* Variables and functions */
__attribute__((__no__)) int buffer_eq_icase_ssn(const char *const a,
                                                const char *const b,
                                                const size_t len) {
  for (size_t i = 0; i < len; ++i) {
    unsigned int ca = ((unsigned char *)a)[i];
    unsigned int cb = ((unsigned char *)b)[i];
    if (ca != cb) {
      ca |= 0x20;
      cb |= 0x20;
      if (ca != cb)
        return 0;
      if (!((u_int32_t)(ca) - 'a' <= 'z' - 'a'))
        return 0;
      if (!((u_int32_t)(cb) - 'a' <= 'z' - 'a'))
        return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<buffer_eq_icase_ssn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    11d1 <buffer_eq_icase_ssn+0xd1>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
je     11bb <buffer_eq_icase_ssn+0xbb>
mov    -0x2c(%rbp),%eax
or     $0x20,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
or     $0x20,%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
je     117a <buffer_eq_icase_ssn+0x7a>
movl   $0x0,-0x4(%rbp)
jmp    11d8 <buffer_eq_icase_ssn+0xd8>
mov    -0x2c(%rbp),%eax
movsbl %al,%eax
sub    $0x61,%eax
cmp    $0x19,%eax
jle    1198 <buffer_eq_icase_ssn+0x98>
movl   $0x0,-0x4(%rbp)
jmp    11d8 <buffer_eq_icase_ssn+0xd8>
mov    -0x30(%rbp),%eax
movsbl %al,%eax
sub    $0x61,%eax
cmp    $0x19,%eax
jle    11b6 <buffer_eq_icase_ssn+0xb6>
movl   $0x0,-0x4(%rbp)
jmp    11d8 <buffer_eq_icase_ssn+0xd8>
jmp    11bb <buffer_eq_icase_ssn+0xbb>
jmp    11c0 <buffer_eq_icase_ssn+0xc0>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1118 <buffer_eq_icase_ssn+0x18>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<buffer_eq_icase_ssn>:
test   %rdx,%rdx
je     1160 <buffer_eq_icase_ssn+0x60>
mov    %rdx,%r8
neg    %r8
mov    $0x1,%r9b
mov    $0x1,%ecx
jmp    1139 <buffer_eq_icase_ssn+0x39>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %rdx,%rcx
setb   %r9b
lea    (%r8,%rcx,1),%rax
add    $0x1,%rax
add    $0x1,%rcx
cmp    $0x1,%rax
je     1163 <buffer_eq_icase_ssn+0x63>
movzbl -0x1(%rdi,%rcx,1),%r10d
movzbl -0x1(%rsi,%rcx,1),%eax
cmp    %al,%r10b
je     1120 <buffer_eq_icase_ssn+0x20>
or     $0x20,%al
cmp    $0x7a,%al
jg     1163 <buffer_eq_icase_ssn+0x63>
or     $0x20,%r10b
cmp    $0x7a,%r10b
jg     1163 <buffer_eq_icase_ssn+0x63>
cmp    %al,%r10b
je     1120 <buffer_eq_icase_ssn+0x20>
jmp    1163 <buffer_eq_icase_ssn+0x63>
xor    %r9d,%r9d
not    %r9b
movzbl %r9b,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @buffer_eq_icase_ssn(i8* %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i64 0, i64* %8
br label %11
11: ; preds = %54, %3
%12 = load i64, i64* %8
%13 = load i64, i64* %7
%14 = icmp ult i64 %12, %13
br i1 %14, label %15, label %57
15: ; preds = %11
%16 = load i8*, i8** %5
%17 = load i64, i64* %8
%18 = getelementptr inbounds i8, i8* %16, i64 %17
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
store i32 %20, i32* %9
%21 = load i8*, i8** %6
%22 = load i64, i64* %8
%23 = getelementptr inbounds i8, i8* %21, i64 %22
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
store i32 %25, i32* %10
%26 = load i32, i32* %9
%27 = load i32, i32* %10
%28 = icmp ne i32 %26, %27
br i1 %28, label %29, label %53
29: ; preds = %15
%30 = load i32, i32* %9
%31 = or i32 %30, 32
store i32 %31, i32* %9
%32 = load i32, i32* %10
%33 = or i32 %32, 32
store i32 %33, i32* %10
%34 = load i32, i32* %9
%35 = load i32, i32* %10
%36 = icmp ne i32 %34, %35
br i1 %36, label %37, label %38
37: ; preds = %29
store i32 0, i32* %4
br label %58
38: ; preds = %29
%39 = load i32, i32* %9
%40 = trunc i32 %39 to i8
%41 = sext i8 %40 to i32
%42 = sub nsw i32 %41, 97
%43 = icmp sle i32 %42, 25
br i1 %43, label %45, label %44
44: ; preds = %38
store i32 0, i32* %4
br label %58
45: ; preds = %38
%46 = load i32, i32* %10
%47 = trunc i32 %46 to i8
%48 = sext i8 %47 to i32
%49 = sub nsw i32 %48, 97
%50 = icmp sle i32 %49, 25
br i1 %50, label %52, label %51
51: ; preds = %45
store i32 0, i32* %4
br label %58
52: ; preds = %45
br label %53
53: ; preds = %52, %15
br label %54
54: ; preds = %53
%55 = load i64, i64* %8
%56 = add i64 %55, 1
store i64 %56, i64* %8
br label %11
57: ; preds = %11
store i32 1, i32* %4
br label %58
58: ; preds = %57, %51, %44, %37
%59 = load i32, i32* %4
ret i32 %59
}

LLVM IR (-O2):
define i32 @buffer_eq_icase_ssn(i8* nocapture %0, i8* nocapture %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %25, label %5
5: ; preds = %3, %21
%6 = phi i1 [ %23, %21 ], [ true, %3 ]
%7 = phi i64 [ %22, %21 ], [ 0, %3 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = getelementptr inbounds i8, i8* %1, i64 %7
%11 = load i8, i8* %10
%12 = icmp eq i8 %9, %11
br i1 %12, label %21, label %13
13: ; preds = %5
%14 = or i8 %9, 32
%15 = or i8 %11, 32
%16 = icmp eq i8 %14, %15
%17 = icmp slt i8 %14, 123
%18 = and i1 %17, %16
%19 = icmp slt i8 %15, 123
%20 = and i1 %19, %18
br i1 %20, label %21, label %25
21: ; preds = %5, %13
%22 = add nuw i64 %7, 1
%23 = icmp ult i64 %22, %2
%24 = icmp eq i64 %22, %2
br i1 %24, label %25, label %5
25: ; preds = %21, %13, %3
%26 = phi i1 [ false, %3 ], [ %6, %13 ], [ %23, %21 ]
%27 = xor i1 %26, true
%28 = zext i1 %27 to i32
ret i32 %28
}