#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 */
struct ZHashTable {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
struct ZHashTable *zcreate_hash_table();
int /*<<< orphan*/ zfree_hash_table(struct ZHashTable *);
int zhash_exists(struct ZHashTable *, char *);
int /*<<< orphan*/ *zhash_get(struct ZHashTable *, char *);
int /*<<< orphan*/ zhash_set(struct ZHashTable *, char *, void *);
void zhash_exists_test() {
  struct ZHashTable *hash_table;
  hash_table = zcreate_hash_table();
  zhash_set(hash_table, "hello", (void *)"world");
  zhash_set(hash_table, "nothing", NULL);
  assert(zhash_exists(hash_table, "hello") == true);
  assert(zhash_exists(hash_table, "nothing") == true);
  assert(zhash_get(hash_table, "nothing") == NULL);
  assert(zhash_exists(hash_table, "nope") == false);
  zfree_hash_table(hash_table);
}


x86 assembly (clang, -O0):
<zhash_exists_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1080 <zcreate_hash_table@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe82(%rip),%rsi
lea    0xe81(%rip),%rdx
call   1060 <zhash_set@plt>
mov    -0x8(%rbp),%rdi
lea    0xe77(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1060 <zhash_set@plt>
mov    -0x8(%rbp),%rdi
lea    0xe57(%rip),%rsi
call   1040 <zhash_exists@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    0xe43(%rip),%rsi
call   1040 <zhash_exists@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    0xe23(%rip),%rsi
call   1050 <zhash_get@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    0xe0a(%rip),%rsi
call   1040 <zhash_exists@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1030 <zfree_hash_table@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zhash_exists_test>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1080 <zcreate_hash_table@plt>
mov    %rax,%rbx
lea    0xe8a(%rip),%r15
lea    0xe89(%rip),%rdx
mov    %rax,%rdi
mov    %r15,%rsi
call   1060 <zhash_set@plt>
lea    0xe7d(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1060 <zhash_set@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <zhash_exists@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <zhash_exists@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <zhash_get@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
lea    0xe26(%rip),%rsi
mov    %rbx,%rdi
call   1040 <zhash_exists@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <zfree_hash_table@plt>

LLVM IR (-O0):
%struct.ZHashTable = type { i32 }
@.str = [6 x i8] c"hello\00"
@.str.1 = [6 x i8] c"world\00"
@.str.2 = [8 x i8] c"nothing\00"
@.str.3 = [5 x i8] c"nope\00"
define void @zhash_exists_test() {
%1 = alloca %struct.ZHashTable*
%2 = call %struct.ZHashTable* (...) @zcreate_hash_table()
store %struct.ZHashTable* %2, %struct.ZHashTable** %1
%3 = load %struct.ZHashTable*, %struct.ZHashTable** %1
%4 = call i32 @zhash_set(%struct.ZHashTable* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%5 = load %struct.ZHashTable*, %struct.ZHashTable** %1
%6 = call i32 @zhash_set(%struct.ZHashTable* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* null)
%7 = load %struct.ZHashTable*, %struct.ZHashTable** %1
%8 = call i32 @zhash_exists(%struct.ZHashTable* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32 %8, 1
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load %struct.ZHashTable*, %struct.ZHashTable** %1
%13 = call i32 @zhash_exists(%struct.ZHashTable* %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i32 %13, 1
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load %struct.ZHashTable*, %struct.ZHashTable** %1
%18 = call i32* @zhash_get(%struct.ZHashTable* %17, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i32* %18, null
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load %struct.ZHashTable*, %struct.ZHashTable** %1
%23 = call i32 @zhash_exists(%struct.ZHashTable* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i32 %23, 0
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = load %struct.ZHashTable*, %struct.ZHashTable** %1
%28 = call i32 @zfree_hash_table(%struct.ZHashTable* %27)
ret void
}

LLVM IR (-O2):
%struct.ZHashTable = type { i32 }
@.str = [6 x i8] c"hello\00"
@.str.1 = [6 x i8] c"world\00"
@.str.2 = [8 x i8] c"nothing\00"
@.str.3 = [5 x i8] c"nope\00"
define void @zhash_exists_test() {
%1 = tail call %struct.ZHashTable* (...) @zcreate_hash_table()
%2 = tail call i32 @zhash_set(%struct.ZHashTable* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @zhash_set(%struct.ZHashTable* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* null)
%4 = tail call i32 @zhash_exists(%struct.ZHashTable* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 1
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = tail call i32 @zhash_exists(%struct.ZHashTable* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i32 %8, 1
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
%12 = tail call i32* @zhash_get(%struct.ZHashTable* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i32* %12, null
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = tail call i32 @zhash_exists(%struct.ZHashTable* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
%18 = zext i1 %17 to i32
%19 = tail call i32 @assert(i32 %18)
%20 = tail call i32 @zfree_hash_table(%struct.ZHashTable* %1)
ret void
}