#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__ strlen(char const *);
scalar_t__ tolower(char const);
int IsConsistentWith(const char *token, const char *expected) {
  int i, len;
  if (strlen(token) > strlen(expected))
    return 0;
  len = (int)strlen(token);
  for (i = 0; i < len; i++) {
    if (tolower(token[i]) != tolower(expected[i]))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<IsConsistentWith>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jle    1162 <IsConsistentWith+0x42>
movl   $0x0,-0x4(%rbp)
jmp    11dd <IsConsistentWith+0xbd>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    11d6 <IsConsistentWith+0xb6>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <tolower@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <tolower@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
je     11c3 <IsConsistentWith+0xa3>
movl   $0x0,-0x4(%rbp)
jmp    11dd <IsConsistentWith+0xbd>
jmp    11c8 <IsConsistentWith+0xa8>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1175 <IsConsistentWith+0x55>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsConsistentWith>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1030 <strlen@plt>
mov    %rax,%rbp
mov    %r14,%rdi
call   1030 <strlen@plt>
xor    %r15d,%r15d
cmp    %rax,%rbp
jg     118a <IsConsistentWith+0x6a>
mov    $0x1,%r15d
test   %ebp,%ebp
jle    118a <IsConsistentWith+0x6a>
mov    %ebp,%r13d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsbl (%r12,%rbx,1),%edi
call   1040 <tolower@plt>
mov    %rax,%rbp
movsbl (%r14,%rbx,1),%edi
call   1040 <tolower@plt>
cmp    %rax,%rbp
jne    1187 <IsConsistentWith+0x67>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1160 <IsConsistentWith+0x40>
jmp    118a <IsConsistentWith+0x6a>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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