#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 */
char tolower(unsigned char);
int CompareStart(const char *a, const char *b) {
  while (*a && *b) {
    char c, d;
    c = tolower((unsigned char)*a++);
    d = tolower((unsigned char)*b++);
    if (c != d) {
      return 0;
    }
  }
  return (*b == 0);
}


x86 assembly (clang, -O0):
<CompareStart>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1b(%rbp)
je     1145 <CompareStart+0x35>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1b(%rbp)
mov    -0x1b(%rbp),%al
test   $0x1,%al
jne    1155 <CompareStart+0x45>
jmp    11aa <CompareStart+0x9a>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%edi
call   1030 <tolower@plt>
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movzbl (%rax),%edi
call   1030 <tolower@plt>
mov    %al,-0x1a(%rbp)
movsbl -0x19(%rbp),%eax
movsbl -0x1a(%rbp),%ecx
cmp    %ecx,%eax
je     11a5 <CompareStart+0x95>
movl   $0x0,-0x4(%rbp)
jmp    11bf <CompareStart+0xaf>
jmp    1120 <CompareStart+0x10>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CompareStart>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
xor    %ebx,%ebx
nop
movzbl (%r14,%rbx,1),%eax
movzbl (%r15,%rbx,1),%ecx
test   %al,%al
je     1153 <CompareStart+0x43>
test   %cl,%cl
je     115c <CompareStart+0x4c>
movzbl %al,%edi
call   1030 <tolower@plt>
mov    %eax,%ebp
movzbl (%r15,%rbx,1),%edi
call   1030 <tolower@plt>
add    $0x1,%rbx
cmp    %al,%bpl
je     1120 <CompareStart+0x10>
xor    %eax,%eax
jmp    1161 <CompareStart+0x51>
xor    %eax,%eax
test   %cl,%cl
sete   %al
jmp    1161 <CompareStart+0x51>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @CompareStart(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
br label %8
8: ; preds = %35, %2
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %8
%14 = load i8*, i8** %5
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br label %18
18: ; preds = %13, %8
%19 = phi i1 [ false, %8 ], [ %17, %13 ]
br i1 %19, label %20, label %36
20: ; preds = %18
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %4
%23 = load i8, i8* %21
%24 = call signext i8 @tolower(i8 zeroext %23)
store i8 %24, i8* %6
%25 = load i8*, i8** %5
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %5
%27 = load i8, i8* %25
%28 = call signext i8 @tolower(i8 zeroext %27)
store i8 %28, i8* %7
%29 = load i8, i8* %6
%30 = sext i8 %29 to i32
%31 = load i8, i8* %7
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %30, %32
br i1 %33, label %34, label %35
34: ; preds = %20
store i32 0, i32* %3
br label %42
35: ; preds = %20
br label %8
36: ; preds = %18
%37 = load i8*, i8** %5
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 0
%41 = zext i1 %40 to i32
store i32 %41, i32* %3
br label %42
42: ; preds = %36, %34
%43 = load i32, i32* %3
ret i32 %43
}

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