#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 StartsWithIgnoreCase(const char *s, const char *prefix) {
  while (*prefix) {
    if (tolower(*s++) != tolower(*prefix++)) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<StartsWithIgnoreCase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1180 <StartsWithIgnoreCase+0x70>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
je     117b <StartsWithIgnoreCase+0x6b>
movl   $0x0,-0x4(%rbp)
jmp    1187 <StartsWithIgnoreCase+0x77>
jmp    1120 <StartsWithIgnoreCase+0x10>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StartsWithIgnoreCase>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
xor    %ebx,%ebx
cmpb   $0x0,(%r15,%rbx,1)
je     114b <StartsWithIgnoreCase+0x3b>
movsbl (%r14,%rbx,1),%edi
call   1030 <tolower@plt>
mov    %rax,%r12
movsbl (%r15,%rbx,1),%edi
call   1030 <tolower@plt>
add    $0x1,%rbx
cmp    %rax,%r12
je     1120 <StartsWithIgnoreCase+0x10>
xor    %eax,%eax
jmp    1150 <StartsWithIgnoreCase+0x40>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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