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

/* Variables and functions */
int /*<<< orphan*/ hasht_free(struct hasht *);
int /*<<< orphan*/ running(char *);
char *strdup(char *);
int /*<<< orphan*/ test_hasht_delete(struct hasht *, char *, char *);
int /*<<< orphan*/ test_hasht_insert(struct hasht *, char *, char *);
int /*<<< orphan*/ test_hasht_insert_duplicate(struct hasht *, char *, char *);
struct hasht *test_hasht_new(size_t);
int /*<<< orphan*/ test_hasht_resize(struct hasht *, size_t);
int /*<<< orphan*/ test_hasht_search(struct hasht *, char *, char *);
int /*<<< orphan*/ test_hasht_used(struct hasht *, int);
int /*<<< orphan*/ testing(char *);
int main() {
  running("hash table");
  testing("new");
  size_t size = 4;
  struct hasht *t = test_hasht_new(size);
  char *k = strdup("foo");
  char *v = strdup("bar");
  testing("insert");
  test_hasht_insert(t, k, v);
  testing("search");
  test_hasht_search(t, k, v);
  testing("insert duplicate");
  test_hasht_insert_duplicate(t, k, v);
  testing("size");
  char *k2 = strdup("the answer?");
  char *v2 = strdup("42");
  test_hasht_insert(t, k2, v2);
  test_hasht_used(t, 2);
  testing("resize");
  test_hasht_resize(t, size);
  testing("remove");
  test_hasht_delete(t, k, v);
  hasht_free(t);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xe41(%rip),%rdi
call   10c0 <running@plt>
lea    0xe40(%rip),%rdi
call   1030 <testing@plt>
movq   $0x4,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <test_hasht_new@plt>
mov    %rax,-0x10(%rbp)
lea    0xe23(%rip),%rdi
call   10d0 <strdup@plt>
mov    %rax,-0x18(%rbp)
lea    0xe17(%rip),%rdi
call   10d0 <strdup@plt>
mov    %rax,-0x20(%rbp)
lea    0xe0b(%rip),%rdi
call   1030 <testing@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <test_hasht_insert@plt>
lea    0xdf5(%rip),%rdi
call   1030 <testing@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1060 <test_hasht_search@plt>
lea    0xddf(%rip),%rdi
call   1030 <testing@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1070 <test_hasht_insert_duplicate@plt>
lea    0xde4(%rip),%rdi
call   1030 <testing@plt>
lea    0xdc7(%rip),%rdi
call   10d0 <strdup@plt>
mov    %rax,-0x28(%rbp)
lea    0xdc3(%rip),%rdi
call   10d0 <strdup@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1050 <test_hasht_insert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1080 <test_hasht_used@plt>
lea    0xd97(%rip),%rdi
call   1030 <testing@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   10b0 <test_hasht_resize@plt>
lea    0xd85(%rip),%rdi
call   1030 <testing@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1090 <test_hasht_delete@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <hasht_free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xe41(%rip),%rdi
call   10c0 <running@plt>
lea    0xe40(%rip),%rdi
call   1030 <testing@plt>
mov    $0x4,%edi
call   1040 <test_hasht_new@plt>
mov    %rax,%rbx
lea    0xe2b(%rip),%rdi
call   10d0 <strdup@plt>
mov    %rax,%r14
lea    0xe20(%rip),%rdi
call   10d0 <strdup@plt>
mov    %rax,%r15
lea    0xe15(%rip),%rdi
call   1030 <testing@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <test_hasht_insert@plt>
lea    0xe02(%rip),%rdi
call   1030 <testing@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1060 <test_hasht_search@plt>
lea    0xdef(%rip),%rdi
call   1030 <testing@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1070 <test_hasht_insert_duplicate@plt>
lea    0xdf7(%rip),%rdi
call   1030 <testing@plt>
lea    0xdda(%rip),%rdi
call   10d0 <strdup@plt>
mov    %rax,%r12
lea    0xdd7(%rip),%rdi
call   10d0 <strdup@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %rax,%rdx
call   1050 <test_hasht_insert@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1080 <test_hasht_used@plt>
lea    0xdb3(%rip),%rdi
call   1030 <testing@plt>
mov    $0x4,%esi
mov    %rbx,%rdi
call   10b0 <test_hasht_resize@plt>
lea    0xda1(%rip),%rdi
call   1030 <testing@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1090 <test_hasht_delete@plt>
mov    %rbx,%rdi
call   10a0 <hasht_free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.hasht = type { i32 }
@.str = [11 x i8] c"hash table\00"
@.str.1 = [4 x i8] c"new\00"
@.str.2 = [4 x i8] c"foo\00"
@.str.3 = [4 x i8] c"bar\00"
@.str.4 = [7 x i8] c"insert\00"
@.str.5 = [7 x i8] c"search\00"
@.str.6 = [17 x i8] c"insert duplicate\00"
@.str.7 = [5 x i8] c"size\00"
@.str.8 = [12 x i8] c"the answer?\00"
@.str.9 = [3 x i8] c"42\00"
@.str.10 = [7 x i8] c"resize\00"
@.str.11 = [7 x i8] c"remove\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca %struct.hasht*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = call i32 @running(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @testing(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i64 4, i64* %1
%9 = load i64, i64* %1
%10 = call %struct.hasht* @test_hasht_new(i64 %9)
store %struct.hasht* %10, %struct.hasht** %2
%11 = call i8* @strdup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i8* %11, i8** %3
%12 = call i8* @strdup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
store i8* %12, i8** %4
%13 = call i32 @testing(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%14 = load %struct.hasht*, %struct.hasht** %2
%15 = load i8*, i8** %3
%16 = load i8*, i8** %4
%17 = call i32 @test_hasht_insert(%struct.hasht* %14, i8* %15, i8* %16)
%18 = call i32 @testing(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%19 = load %struct.hasht*, %struct.hasht** %2
%20 = load i8*, i8** %3
%21 = load i8*, i8** %4
%22 = call i32 @test_hasht_search(%struct.hasht* %19, i8* %20, i8* %21)
%23 = call i32 @testing(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%24 = load %struct.hasht*, %struct.hasht** %2
%25 = load i8*, i8** %3
%26 = load i8*, i8** %4
%27 = call i32 @test_hasht_insert_duplicate(%struct.hasht* %24, i8* %25, i8* %26)
%28 = call i32 @testing(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%29 = call i8* @strdup(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
store i8* %29, i8** %5
%30 = call i8* @strdup(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
store i8* %30, i8** %6
%31 = load %struct.hasht*, %struct.hasht** %2
%32 = load i8*, i8** %5
%33 = load i8*, i8** %6
%34 = call i32 @test_hasht_insert(%struct.hasht* %31, i8* %32, i8* %33)
%35 = load %struct.hasht*, %struct.hasht** %2
%36 = call i32 @test_hasht_used(%struct.hasht* %35, i32 2)
%37 = call i32 @testing(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%38 = load %struct.hasht*, %struct.hasht** %2
%39 = load i64, i64* %1
%40 = call i32 @test_hasht_resize(%struct.hasht* %38, i64 %39)
%41 = call i32 @testing(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
%42 = load %struct.hasht*, %struct.hasht** %2
%43 = load i8*, i8** %3
%44 = load i8*, i8** %4
%45 = call i32 @test_hasht_delete(%struct.hasht* %42, i8* %43, i8* %44)
%46 = load %struct.hasht*, %struct.hasht** %2
%47 = call i32 @hasht_free(%struct.hasht* %46)
ret i32 0
}

LLVM IR (-O2):
%struct.hasht = type { i32 }
@.str = [11 x i8] c"hash table\00"
@.str.1 = [4 x i8] c"new\00"
@.str.2 = [4 x i8] c"foo\00"
@.str.3 = [4 x i8] c"bar\00"
@.str.4 = [7 x i8] c"insert\00"
@.str.5 = [7 x i8] c"search\00"
@.str.6 = [17 x i8] c"insert duplicate\00"
@.str.7 = [5 x i8] c"size\00"
@.str.8 = [12 x i8] c"the answer?\00"
@.str.9 = [3 x i8] c"42\00"
@.str.10 = [7 x i8] c"resize\00"
@.str.11 = [7 x i8] c"remove\00"
define i32 @main() {
%1 = tail call i32 @running(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @testing(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call %struct.hasht* @test_hasht_new(i64 4)
%4 = tail call dereferenceable_or_null(4) i8* @strdup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call dereferenceable_or_null(4) i8* @strdup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @testing(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i32 @test_hasht_insert(%struct.hasht* %3, i8* %4, i8* %5)
%8 = tail call i32 @testing(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%9 = tail call i32 @test_hasht_search(%struct.hasht* %3, i8* %4, i8* %5)
%10 = tail call i32 @testing(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%11 = tail call i32 @test_hasht_insert_duplicate(%struct.hasht* %3, i8* %4, i8* %5)
%12 = tail call i32 @testing(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%13 = tail call dereferenceable_or_null(12) i8* @strdup(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%14 = tail call dereferenceable_or_null(3) i8* @strdup(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%15 = tail call i32 @test_hasht_insert(%struct.hasht* %3, i8* %13, i8* %14)
%16 = tail call i32 @test_hasht_used(%struct.hasht* %3, i32 2)
%17 = tail call i32 @testing(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%18 = tail call i32 @test_hasht_resize(%struct.hasht* %3, i64 4)
%19 = tail call i32 @testing(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
%20 = tail call i32 @test_hasht_delete(%struct.hasht* %3, i8* %4, i8* %5)
%21 = tail call i32 @hasht_free(%struct.hasht* %3)
ret i32 0
}