#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 /*<<< orphan*/ hash_table_add(void *, char *, char *);
void *hash_table_create(int /*<<< orphan*/);
int /*<<< orphan*/ hash_table_delete(void *, char *);
int /*<<< orphan*/ hash_table_destroy(void *);
char *hash_table_search(void *, char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int main(int argc, char **argv) {
  void *hash_table;
  hash_table = hash_table_create(0);
  hash_table_add(hash_table, "name", "nagp");
  printf("Look up key (%s), result: %s\n", "name",
         hash_table_search(hash_table, "name"));
  hash_table_delete(hash_table, "name");
  hash_table_destroy(hash_table);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1030 <hash_table_create@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe74(%rip),%rsi
lea    0xe72(%rip),%rdx
call   1080 <hash_table_add@plt>
mov    -0x18(%rbp),%rdi
lea    0xe5d(%rip),%rsi
call   1050 <hash_table_search@plt>
mov    %rax,%rdx
lea    0xe58(%rip),%rdi
lea    0xe47(%rip),%rsi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe37(%rip),%rsi
call   1060 <hash_table_delete@plt>
mov    -0x18(%rbp),%rdi
call   1070 <hash_table_destroy@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   1030 <hash_table_create@plt>
mov    %rax,%rbx
lea    0xe8b(%rip),%r14
lea    0xe89(%rip),%rdx
mov    %rax,%rdi
mov    %r14,%rsi
call   1080 <hash_table_add@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <hash_table_search@plt>
lea    0xe71(%rip),%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <hash_table_delete@plt>
mov    %rbx,%rdi
call   1070 <hash_table_destroy@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"name\00"
@.str.1 = [5 x i8] c"nagp\00"
@.str.2 = [30 x i8] c"Look up key (%s), result: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i8* @hash_table_create(i32 0)
store i8* %7, i8** %6
%8 = load i8*, i8** %6
%9 = call i32 @hash_table_add(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%10 = load i8*, i8** %6
%11 = call i8* @hash_table_search(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = load i8*, i8** %6
%14 = call i32 @hash_table_delete(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%15 = load i8*, i8** %6
%16 = call i32 @hash_table_destroy(i8* %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"name\00"
@.str.1 = [5 x i8] c"nagp\00"
@.str.2 = [30 x i8] c"Look up key (%s), result: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* @hash_table_create(i32 0)
%4 = tail call i32 @hash_table_add(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i8* @hash_table_search(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @hash_table_delete(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @hash_table_destroy(i8* %3)
ret i32 0
}