#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*/ chars_equals_ignore_case(char, char);
bool strings_bounded_equals_ignore_case(char *a, char *b, unsigned int size) {
  for (unsigned int k = 0; k < size; k++) {
    if (!chars_equals_ignore_case(a[k], b[k]))
      return false;
  }
  return true;
}


x86 assembly (clang, -O0):
<strings_bounded_equals_ignore_case>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    117b <strings_bounded_equals_ignore_case+0x6b>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    (%rax,%rcx,1),%dl
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
movsbl %dl,%edi
movsbl (%rax,%rcx,1),%esi
call   1030 <chars_equals_ignore_case@plt>
cmp    $0x0,%eax
jne    1168 <strings_bounded_equals_ignore_case+0x58>
movl   $0x0,-0x4(%rbp)
jmp    1182 <strings_bounded_equals_ignore_case+0x72>
jmp    116d <strings_bounded_equals_ignore_case+0x5d>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    112a <strings_bounded_equals_ignore_case+0x1a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strings_bounded_equals_ignore_case>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edx,%edx
je     1169 <strings_bounded_equals_ignore_case+0x59>
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%r15
movsbl (%rdi),%edi
movsbl (%rsi),%esi
call   1030 <chars_equals_ignore_case@plt>
test   %eax,%eax
je     1170 <strings_bounded_equals_ignore_case+0x60>
mov    %ebp,%ebp
mov    $0x1,%ecx
nopl   0x0(%rax)
mov    %rcx,%rbx
cmp    %rcx,%rbp
je     115f <strings_bounded_equals_ignore_case+0x4f>
movsbl (%r15,%rbx,1),%edi
movsbl (%r14,%rbx,1),%esi
call   1030 <chars_equals_ignore_case@plt>
lea    0x1(%rbx),%rcx
test   %eax,%eax
jne    1140 <strings_bounded_equals_ignore_case+0x30>
xor    %eax,%eax
cmp    %rbp,%rbx
setae  %al
jmp    1172 <strings_bounded_equals_ignore_case+0x62>
mov    $0x1,%eax
jmp    1172 <strings_bounded_equals_ignore_case+0x62>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @strings_bounded_equals_ignore_case(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %28, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %7
%12 = icmp ult i32 %10, %11
br i1 %12, label %13, label %31
13: ; preds = %9
%14 = load i8*, i8** %5
%15 = load i32, i32* %8
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = load i8*, i8** %6
%20 = load i32, i32* %8
%21 = zext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = call i32 @chars_equals_ignore_case(i8 signext %18, i8 signext %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %13
store i32 0, i32* %4
br label %32
27: ; preds = %13
br label %28
28: ; preds = %27
%29 = load i32, i32* %8
%30 = add i32 %29, 1
store i32 %30, i32* %8
br label %9
31: ; preds = %9
store i32 1, i32* %4
br label %32
32: ; preds = %31, %26
%33 = load i32, i32* %4
ret i32 %33
}

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