#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 tolower(int);
int _ht_lower_strcmp(const char *node_key, const char *look_key) {
  int cn;
  int cl;
  do {
    cn = *node_key++;
    cl = *look_key++;
  } while (cn && cn == tolower(cl));
  return cn - tolower(cl);
}


x86 assembly (clang, -O0):
<_ht_lower_strcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x19(%rbp)
je     1174 <_ht_lower_strcmp+0x64>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <tolower@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1120 <_ht_lower_strcmp+0x10>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <tolower@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ht_lower_strcmp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r12
xor    %r14d,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsbl (%r12,%rbx,1),%ebp
movsbl (%r15,%rbx,1),%r13d
test   %ebp,%ebp
je     1151 <_ht_lower_strcmp+0x41>
mov    %r13d,%edi
call   1030 <tolower@plt>
add    $0x1,%rbx
cmp    %ebp,%eax
je     1130 <_ht_lower_strcmp+0x20>
mov    %ebp,%r14d
mov    %r13d,%edi
call   1030 <tolower@plt>
sub    %eax,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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