#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 */
typedef int /*<<< orphan*/ uint32_t;
struct cuckoo_hash_item {
  int dummy;
};
struct cuckoo_hash {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ compute_hash(void const *, size_t, int /*<<< orphan*/ *,
                                int /*<<< orphan*/ *);
struct cuckoo_hash_item *lookup(struct cuckoo_hash const *, void const *,
                                size_t, int /*<<< orphan*/, int /*<<< orphan*/);
struct cuckoo_hash_item *cuckoo_hash_lookup(const struct cuckoo_hash *hash,
                                            const void *key, size_t key_len) {
  uint32_t h1, h2;
  compute_hash(key, key_len, &h1, &h2);
  return lookup(hash, key, key_len, h1, h2);
}


x86 assembly (clang, -O0):
<cuckoo_hash_lookup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1040 <compute_hash@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <lookup@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cuckoo_hash_lookup>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rsi,%rdi
mov    %r14,%rsi
call   1040 <compute_hash@plt>
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <lookup@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.cuckoo_hash_item = type { i32 }
%struct.cuckoo_hash = type { i32 }
define %struct.cuckoo_hash_item* @cuckoo_hash_lookup(%struct.cuckoo_hash* %0, i8* %1, i64 %2) {
%4 = alloca %struct.cuckoo_hash*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
store %struct.cuckoo_hash* %0, %struct.cuckoo_hash** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = call i32 @compute_hash(i8* %9, i64 %10, i32* %7, i32* %8)
%12 = load %struct.cuckoo_hash*, %struct.cuckoo_hash** %4
%13 = load i8*, i8** %5
%14 = load i64, i64* %6
%15 = load i32, i32* %7
%16 = load i32, i32* %8
%17 = call %struct.cuckoo_hash_item* @lookup(%struct.cuckoo_hash* %12, i8* %13, i64 %14, i32 %15, i32 %16)
ret %struct.cuckoo_hash_item* %17
}

LLVM IR (-O2):
%struct.cuckoo_hash_item = type { i32 }
%struct.cuckoo_hash = type { i32 }
define %struct.cuckoo_hash_item* @cuckoo_hash_lookup(%struct.cuckoo_hash* %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %4 to i8*
%7 = bitcast i32* %5 to i8*
%8 = call i32 @compute_hash(i8* %1, i64 %2, i32* %4, i32* %5)
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = call %struct.cuckoo_hash_item* @lookup(%struct.cuckoo_hash* %0, i8* %1, i64 %2, i32 %9, i32 %10)
ret %struct.cuckoo_hash_item* %11
}