#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 cl_rhash_table {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ cl_rhash_table_cost_slot(struct cl_rhash_table *,
                                            int /*<<< orphan*/,
                                            int /*<<< orphan*/);
int /*<<< orphan*/ cl_rhash_table_hash(struct cl_rhash_table *, void **);
void **cl_rhash_table_ptr(struct cl_rhash_table *, int /*<<< orphan*/);
int /*<<< orphan*/ cl_rhash_table_slot(struct cl_rhash_table *,
                                       int /*<<< orphan*/, int /*<<< orphan*/);
uint32_t cl_rhash_table_cost(struct cl_rhash_table *tbl, uint32_t slot) {
  void **ent = cl_rhash_table_ptr(tbl, slot);
  uint32_t hcode = cl_rhash_table_hash(tbl, ent);
  uint32_t o_slot = cl_rhash_table_slot(tbl, hcode, 0);
  return cl_rhash_table_cost_slot(tbl, slot, o_slot);
}


x86 assembly (clang, -O0):
<cl_rhash_table_cost>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <cl_rhash_table_ptr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <cl_rhash_table_hash@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
xor    %edx,%edx
call   1060 <cl_rhash_table_slot@plt>
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1040 <cl_rhash_table_cost_slot@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cl_rhash_table_cost>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1050 <cl_rhash_table_ptr@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <cl_rhash_table_hash@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
call   1060 <cl_rhash_table_slot@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <cl_rhash_table_cost_slot@plt>

LLVM IR (-O0):
%struct.cl_rhash_table = type { i32 }
define i32 @cl_rhash_table_cost(%struct.cl_rhash_table* %0, i32 %1) {
%3 = alloca %struct.cl_rhash_table*
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store %struct.cl_rhash_table* %0, %struct.cl_rhash_table** %3
store i32 %1, i32* %4
%8 = load %struct.cl_rhash_table*, %struct.cl_rhash_table** %3
%9 = load i32, i32* %4
%10 = call i8** @cl_rhash_table_ptr(%struct.cl_rhash_table* %8, i32 %9)
store i8** %10, i8*** %5
%11 = load %struct.cl_rhash_table*, %struct.cl_rhash_table** %3
%12 = load i8**, i8*** %5
%13 = call i32 @cl_rhash_table_hash(%struct.cl_rhash_table* %11, i8** %12)
store i32 %13, i32* %6
%14 = load %struct.cl_rhash_table*, %struct.cl_rhash_table** %3
%15 = load i32, i32* %6
%16 = call i32 @cl_rhash_table_slot(%struct.cl_rhash_table* %14, i32 %15, i32 0)
store i32 %16, i32* %7
%17 = load %struct.cl_rhash_table*, %struct.cl_rhash_table** %3
%18 = load i32, i32* %4
%19 = load i32, i32* %7
%20 = call i32 @cl_rhash_table_cost_slot(%struct.cl_rhash_table* %17, i32 %18, i32 %19)
ret i32 %20
}

LLVM IR (-O2):
%struct.cl_rhash_table = type { i32 }
define i32 @cl_rhash_table_cost(%struct.cl_rhash_table* %0, i32 %1) {
%3 = tail call i8** @cl_rhash_table_ptr(%struct.cl_rhash_table* %0, i32 %1)
%4 = tail call i32 @cl_rhash_table_hash(%struct.cl_rhash_table* %0, i8** %3)
%5 = tail call i32 @cl_rhash_table_slot(%struct.cl_rhash_table* %0, i32 %4, i32 0)
%6 = tail call i32 @cl_rhash_table_cost_slot(%struct.cl_rhash_table* %0, i32 %1, i32 %5)
ret i32 %6
}