#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 gfarm_hash_key_equal_casefold(char const *, int, char const *, int);
int strlen(char const *);
scalar_t__ tolower(unsigned char);
int gfarm_hash_key_equal_casefold_strptr(const void *key1, int key1len,
                                         const void *key2, int key2len) {
  const char *const *strptr1 = key1, *const *strptr2 = key2;
  const char *str1 = *strptr1, *str2 = *strptr2;
  int len1, len2;
  if (tolower(*(unsigned char *)str1) != tolower(*(unsigned char *)str2))
    return (0);
  len1 = strlen(str1);
  len2 = strlen(str2);
  if (len1 != len2)
    return (0);
  return (gfarm_hash_key_equal_casefold(str1, len1, str2, len2));
}


x86 assembly (clang, -O0):
<gfarm_hash_key_equal_casefold_strptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rax
movzbl (%rax),%edi
call   1040 <tolower@plt>
mov    %rax,-0x58(%rbp)
mov    -0x48(%rbp),%rax
movzbl (%rax),%edi
call   1040 <tolower@plt>
mov    %rax,%rcx
mov    -0x58(%rbp),%rax
cmp    %rcx,%rax
je     11a4 <gfarm_hash_key_equal_casefold_strptr+0x74>
movl   $0x0,-0x4(%rbp)
jmp    11ea <gfarm_hash_key_equal_casefold_strptr+0xba>
mov    -0x40(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x50(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x50(%rbp),%eax
je     11d4 <gfarm_hash_key_equal_casefold_strptr+0xa4>
movl   $0x0,-0x4(%rbp)
jmp    11ea <gfarm_hash_key_equal_casefold_strptr+0xba>
mov    -0x40(%rbp),%rdi
mov    -0x4c(%rbp),%esi
mov    -0x48(%rbp),%rdx
mov    -0x50(%rbp),%ecx
call   1050 <gfarm_hash_key_equal_casefold@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gfarm_hash_key_equal_casefold_strptr>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%rbx
mov    (%rdx),%r14
movzbl (%rbx),%edi
call   1040 <tolower@plt>
mov    %rax,%rbp
movzbl (%r14),%edi
call   1040 <tolower@plt>
cmp    %rax,%rbp
jne    117c <gfarm_hash_key_equal_casefold_strptr+0x4c>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebp
jne    117c <gfarm_hash_key_equal_casefold_strptr+0x4c>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %ebp,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <gfarm_hash_key_equal_casefold@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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