#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*/ printf(char *, char *);
struct ZHashTable *zcreate_hash_table();
int /*<<< orphan*/ zfree_hash_table(struct ZHashTable *);
scalar_t__ zhash_exists(struct ZHashTable *, char *);
scalar_t__ zhash_get(struct ZHashTable *, char *);
int /*<<< orphan*/ zhash_set(struct ZHashTable *, char *, void *);
int main() {
  struct ZHashTable *hash_table;
  hash_table = zcreate_hash_table();
  zhash_set(hash_table, "hello", (void *)"world");
  if (zhash_exists(hash_table, "hello")) {
    printf("hello %s\n", (char *)zhash_get(hash_table, "hello"));
  }
  if (zhash_exists(hash_table, "goodbye")) {
    printf("goodbye %s\n", (char *)zhash_get(hash_table, "goodbye"));
  }
  zfree_hash_table(hash_table);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <zcreate_hash_table@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe7b(%rip),%rsi
lea    0xe7a(%rip),%rdx
call   1070 <zhash_set@plt>
mov    -0x10(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1040 <zhash_exists@plt>
cmp    $0x0,%rax
je     11ca <main+0x6a>
mov    -0x10(%rbp),%rdi
lea    0xe4a(%rip),%rsi
call   1050 <zhash_get@plt>
mov    %rax,%rsi
lea    0xe47(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe41(%rip),%rsi
call   1040 <zhash_exists@plt>
cmp    $0x0,%rax
je     1203 <main+0xa3>
mov    -0x10(%rbp),%rdi
lea    0xe27(%rip),%rsi
call   1050 <zhash_get@plt>
mov    %rax,%rsi
lea    0xe20(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <zfree_hash_table@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1080 <zcreate_hash_table@plt>
mov    %rax,%rbx
lea    0xe8b(%rip),%r14
lea    0xe8a(%rip),%rdx
mov    %rax,%rdi
mov    %r14,%rsi
call   1070 <zhash_set@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <zhash_exists@plt>
test   %rax,%rax
je     11b5 <main+0x55>
lea    0xe62(%rip),%rsi
mov    %rbx,%rdi
call   1050 <zhash_get@plt>
lea    0xe5f(%rip),%rdi
mov    %rax,%rsi
call   1060 <printf@plt>
lea    0xe5a(%rip),%rsi
mov    %rbx,%rdi
call   1040 <zhash_exists@plt>
test   %rax,%rax
je     11e7 <main+0x87>
lea    0xe46(%rip),%rsi
mov    %rbx,%rdi
call   1050 <zhash_get@plt>
lea    0xe3f(%rip),%rdi
mov    %rax,%rsi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1030 <zfree_hash_table@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.ZHashTable = type { i32 }
@.str = [6 x i8] c"hello\00"
@.str.1 = [6 x i8] c"world\00"
@.str.2 = [10 x i8] c"hello %s\0A\00"
@.str.3 = [8 x i8] c"goodbye\00"
@.str.4 = [12 x i8] c"goodbye %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.ZHashTable*
store i32 0, i32* %1
%3 = call %struct.ZHashTable* (...) @zcreate_hash_table()
store %struct.ZHashTable* %3, %struct.ZHashTable** %2
%4 = load %struct.ZHashTable*, %struct.ZHashTable** %2
%5 = call i32 @zhash_set(%struct.ZHashTable* %4, 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))
%6 = load %struct.ZHashTable*, %struct.ZHashTable** %2
%7 = call i64 @zhash_exists(%struct.ZHashTable* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = load %struct.ZHashTable*, %struct.ZHashTable** %2
%11 = call i64 @zhash_get(%struct.ZHashTable* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%12 = inttoptr i64 %11 to i8*
%13 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %9, %0
%15 = load %struct.ZHashTable*, %struct.ZHashTable** %2
%16 = call i64 @zhash_exists(%struct.ZHashTable* %15, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %14
%19 = load %struct.ZHashTable*, %struct.ZHashTable** %2
%20 = call i64 @zhash_get(%struct.ZHashTable* %19, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%21 = inttoptr i64 %20 to i8*
%22 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %18, %14
%24 = load %struct.ZHashTable*, %struct.ZHashTable** %2
%25 = call i32 @zfree_hash_table(%struct.ZHashTable* %24)
ret i32 0
}

LLVM IR (-O2):
%struct.ZHashTable = type { i32 }
@.str = [6 x i8] c"hello\00"
@.str.1 = [6 x i8] c"world\00"
@.str.2 = [10 x i8] c"hello %s\0A\00"
@.str.3 = [8 x i8] c"goodbye\00"
@.str.4 = [12 x i8] c"goodbye %s\0A\00"
define i32 @main() {
%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 i64 @zhash_exists(%struct.ZHashTable* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %0
%6 = tail call i64 @zhash_get(%struct.ZHashTable* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = inttoptr i64 %6 to i8*
%8 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %7)
br label %9
9: ; preds = %5, %0
%10 = tail call i64 @zhash_exists(%struct.ZHashTable* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %9
%13 = tail call i64 @zhash_get(%struct.ZHashTable* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%14 = inttoptr i64 %13 to i8*
%15 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %12, %9
%17 = tail call i32 @zfree_hash_table(%struct.ZHashTable* %1)
ret i32 0
}