#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 hashmap_iterator {
  int dummy;
};
struct hashmap {
  int dummy;
};

/* Variables and functions */
int EXIT_SUCCESS;
scalar_t__ hashmap_create(int);
int /*<<< orphan*/ hashmap_dump(struct hashmap *);
int /*<<< orphan*/ *hashmap_get(struct hashmap *, char *);
struct hashmap_iterator *hashmap_get_iterator(struct hashmap *);
scalar_t__ hashmap_get_next(struct hashmap_iterator *);
scalar_t__ hashmap_has_next(struct hashmap_iterator *);
int /*<<< orphan*/ hashmap_put(struct hashmap *, char *, void *);
scalar_t__ hashmap_remove(struct hashmap *, char *);
int hashmap_size(struct hashmap *);
int /*<<< orphan*/ my_assert(int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  struct hashmap *map;
  map = (struct hashmap *)hashmap_create(16);
  hashmap_put(map, "one", (void *)1);
  hashmap_put(map, "two", (void *)2);
  hashmap_put(map, "three", (void *)3);
  hashmap_put(map, "four", (void *)4);
  hashmap_put(map, "five", (void *)5);
  hashmap_put(map, "six", (void *)6);
  hashmap_put(map, "seven", (void *)7);
  hashmap_put(map, "eight", (void *)8);
  hashmap_put(map, "nine", (void *)9);
  hashmap_put(map, "ten", (void *)10);
  my_assert(4 == (long)hashmap_get(map, "four"));
  my_assert(4 == (long)hashmap_remove(map, "four"));
  my_assert(NULL == hashmap_get(map, "four"));
  my_assert(9 == hashmap_size(map));
  struct hashmap_iterator *iterator = hashmap_get_iterator(map);
  my_assert(NULL != iterator);
  hashmap_dump(map);
  while (hashmap_has_next(iterator)) {
    printf("%d\n", (long)hashmap_get_next(iterator));
  }
  printf("Tests passed!\n");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x10,%edi
call   1050 <hashmap_create@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe28(%rip),%rsi
mov    $0x1,%edx
call   1060 <hashmap_put@plt>
mov    -0x10(%rbp),%rdi
lea    0xe17(%rip),%rsi
mov    $0x2,%edx
call   1060 <hashmap_put@plt>
mov    -0x10(%rbp),%rdi
lea    0xe06(%rip),%rsi
mov    $0x3,%edx
call   1060 <hashmap_put@plt>
mov    -0x10(%rbp),%rdi
lea    0xdf7(%rip),%rsi
mov    $0x4,%edx
call   1060 <hashmap_put@plt>
mov    -0x10(%rbp),%rdi
lea    0xde7(%rip),%rsi
mov    $0x5,%edx
call   1060 <hashmap_put@plt>
mov    -0x10(%rbp),%rdi
lea    0xdd7(%rip),%rsi
mov    $0x6,%edx
call   1060 <hashmap_put@plt>
mov    -0x10(%rbp),%rdi
lea    0xdc6(%rip),%rsi
mov    $0x7,%edx
call   1060 <hashmap_put@plt>
mov    -0x10(%rbp),%rdi
lea    0xdb7(%rip),%rsi
mov    $0x8,%edx
call   1060 <hashmap_put@plt>
mov    -0x10(%rbp),%rdi
lea    0xda8(%rip),%rsi
mov    $0x9,%edx
call   1060 <hashmap_put@plt>
mov    -0x10(%rbp),%rdi
lea    0xd98(%rip),%rsi
mov    $0xa,%edx
call   1060 <hashmap_put@plt>
mov    -0x10(%rbp),%rdi
lea    0xd64(%rip),%rsi
call   1070 <hashmap_get@plt>
mov    %rax,%rcx
mov    $0x4,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <my_assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xd3c(%rip),%rsi
call   10a0 <hashmap_remove@plt>
mov    %rax,%rcx
mov    $0x4,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <my_assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xd14(%rip),%rsi
call   1070 <hashmap_get@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <my_assert@plt>
mov    -0x10(%rbp),%rdi
call   1040 <hashmap_size@plt>
mov    %eax,%ecx
mov    $0x9,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <my_assert@plt>
mov    -0x10(%rbp),%rdi
call   10d0 <hashmap_get_iterator@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <my_assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <hashmap_dump@plt>
mov    -0x18(%rbp),%rdi
call   10c0 <hashmap_has_next@plt>
cmp    $0x0,%rax
je     138e <main+0x1de>
mov    -0x18(%rbp),%rdi
call   1080 <hashmap_get_next@plt>
mov    %rax,%rsi
lea    0xcaf(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    135c <main+0x1ac>
lea    0xca0(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x2c3d(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x10,%edi
call   1060 <hashmap_create@plt>
mov    %rax,%r15
lea    0xe27(%rip),%rsi
mov    $0x1,%edx
mov    %rax,%rdi
call   1070 <hashmap_put@plt>
lea    0xe17(%rip),%rsi
mov    $0x2,%edx
mov    %r15,%rdi
call   1070 <hashmap_put@plt>
lea    0xe07(%rip),%rsi
mov    $0x3,%edx
mov    %r15,%rdi
call   1070 <hashmap_put@plt>
lea    0xdf9(%rip),%r14
mov    $0x4,%edx
mov    %r15,%rdi
mov    %r14,%rsi
call   1070 <hashmap_put@plt>
lea    0xde7(%rip),%rsi
mov    $0x5,%edx
mov    %r15,%rdi
call   1070 <hashmap_put@plt>
lea    0xdd8(%rip),%rsi
mov    $0x6,%edx
mov    %r15,%rdi
call   1070 <hashmap_put@plt>
lea    0xdc8(%rip),%rsi
mov    $0x7,%edx
mov    %r15,%rdi
call   1070 <hashmap_put@plt>
lea    0xdba(%rip),%rsi
mov    $0x8,%edx
mov    %r15,%rdi
call   1070 <hashmap_put@plt>
lea    0xdac(%rip),%rsi
mov    $0x9,%edx
mov    %r15,%rdi
call   1070 <hashmap_put@plt>
lea    0xd9d(%rip),%rsi
mov    $0xa,%edx
mov    %r15,%rdi
call   1070 <hashmap_put@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <hashmap_get@plt>
xor    %edi,%edi
cmp    $0x4,%rax
sete   %dil
call   10c0 <my_assert@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   10b0 <hashmap_remove@plt>
xor    %edi,%edi
cmp    $0x4,%rax
sete   %dil
call   10c0 <my_assert@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <hashmap_get@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   10c0 <my_assert@plt>
mov    %r15,%rdi
call   1040 <hashmap_size@plt>
xor    %edi,%edi
cmp    $0x9,%eax
sete   %dil
call   10c0 <my_assert@plt>
mov    %r15,%rdi
call   10e0 <hashmap_get_iterator@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   10c0 <my_assert@plt>
mov    %r15,%rdi
call   1030 <hashmap_dump@plt>
mov    %rbx,%rdi
call   10d0 <hashmap_has_next@plt>
test   %rax,%rax
je     1362 <main+0x1a2>
lea    0xcfc(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1090 <hashmap_get_next@plt>
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %rbx,%rdi
call   10d0 <hashmap_has_next@plt>
test   %rax,%rax
jne    1340 <main+0x180>
lea    0xccc(%rip),%rdi
call   1050 <puts@plt>
mov    0x2c6b(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.hashmap = type { i32 }
%struct.hashmap_iterator = type { i32 }
@.str = [4 x i8] c"one\00"
@.str.1 = [4 x i8] c"two\00"
@.str.2 = [6 x i8] c"three\00"
@.str.3 = [5 x i8] c"four\00"
@.str.4 = [5 x i8] c"five\00"
@.str.5 = [4 x i8] c"six\00"
@.str.6 = [6 x i8] c"seven\00"
@.str.7 = [6 x i8] c"eight\00"
@.str.8 = [5 x i8] c"nine\00"
@.str.9 = [4 x i8] c"ten\00"
@.str.10 = [4 x i8] c"%d\0A\00"
@.str.11 = [15 x i8] c"Tests passed!\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.hashmap*
%3 = alloca %struct.hashmap_iterator*
store i32 0, i32* %1
%4 = call i64 @hashmap_create(i32 16)
%5 = inttoptr i64 %4 to %struct.hashmap*
store %struct.hashmap* %5, %struct.hashmap** %2
%6 = load %struct.hashmap*, %struct.hashmap** %2
%7 = call i32 @hashmap_put(%struct.hashmap* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* inttoptr (i64 1 to i8*))
%8 = load %struct.hashmap*, %struct.hashmap** %2
%9 = call i32 @hashmap_put(%struct.hashmap* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* inttoptr (i64 2 to i8*))
%10 = load %struct.hashmap*, %struct.hashmap** %2
%11 = call i32 @hashmap_put(%struct.hashmap* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* inttoptr (i64 3 to i8*))
%12 = load %struct.hashmap*, %struct.hashmap** %2
%13 = call i32 @hashmap_put(%struct.hashmap* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* inttoptr (i64 4 to i8*))
%14 = load %struct.hashmap*, %struct.hashmap** %2
%15 = call i32 @hashmap_put(%struct.hashmap* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* inttoptr (i64 5 to i8*))
%16 = load %struct.hashmap*, %struct.hashmap** %2
%17 = call i32 @hashmap_put(%struct.hashmap* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* inttoptr (i64 6 to i8*))
%18 = load %struct.hashmap*, %struct.hashmap** %2
%19 = call i32 @hashmap_put(%struct.hashmap* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* inttoptr (i64 7 to i8*))
%20 = load %struct.hashmap*, %struct.hashmap** %2
%21 = call i32 @hashmap_put(%struct.hashmap* %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* inttoptr (i64 8 to i8*))
%22 = load %struct.hashmap*, %struct.hashmap** %2
%23 = call i32 @hashmap_put(%struct.hashmap* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* inttoptr (i64 9 to i8*))
%24 = load %struct.hashmap*, %struct.hashmap** %2
%25 = call i32 @hashmap_put(%struct.hashmap* %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* inttoptr (i64 10 to i8*))
%26 = load %struct.hashmap*, %struct.hashmap** %2
%27 = call i32* @hashmap_get(%struct.hashmap* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%28 = ptrtoint i32* %27 to i64
%29 = icmp eq i64 4, %28
%30 = zext i1 %29 to i32
%31 = call i32 @my_assert(i32 %30)
%32 = load %struct.hashmap*, %struct.hashmap** %2
%33 = call i64 @hashmap_remove(%struct.hashmap* %32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%34 = icmp eq i64 4, %33
%35 = zext i1 %34 to i32
%36 = call i32 @my_assert(i32 %35)
%37 = load %struct.hashmap*, %struct.hashmap** %2
%38 = call i32* @hashmap_get(%struct.hashmap* %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp eq i32* null, %38
%40 = zext i1 %39 to i32
%41 = call i32 @my_assert(i32 %40)
%42 = load %struct.hashmap*, %struct.hashmap** %2
%43 = call i32 @hashmap_size(%struct.hashmap* %42)
%44 = icmp eq i32 9, %43
%45 = zext i1 %44 to i32
%46 = call i32 @my_assert(i32 %45)
%47 = load %struct.hashmap*, %struct.hashmap** %2
%48 = call %struct.hashmap_iterator* @hashmap_get_iterator(%struct.hashmap* %47)
store %struct.hashmap_iterator* %48, %struct.hashmap_iterator** %3
%49 = load %struct.hashmap_iterator*, %struct.hashmap_iterator** %3
%50 = icmp ne %struct.hashmap_iterator* null, %49
%51 = zext i1 %50 to i32
%52 = call i32 @my_assert(i32 %51)
%53 = load %struct.hashmap*, %struct.hashmap** %2
%54 = call i32 @hashmap_dump(%struct.hashmap* %53)
br label %55
55: ; preds = %59, %0
%56 = load %struct.hashmap_iterator*, %struct.hashmap_iterator** %3
%57 = call i64 @hashmap_has_next(%struct.hashmap_iterator* %56)
%58 = icmp ne i64 %57, 0
br i1 %58, label %59, label %63
59: ; preds = %55
%60 = load %struct.hashmap_iterator*, %struct.hashmap_iterator** %3
%61 = call i64 @hashmap_get_next(%struct.hashmap_iterator* %60)
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i64 %61)
br label %55
63: ; preds = %55
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0))
%65 = load i32, i32* @EXIT_SUCCESS
ret i32 %65
}

LLVM IR (-O2):
%struct.hashmap = type { i32 }
%struct.hashmap_iterator = type { i32 }
@.str = [4 x i8] c"one\00"
@.str.1 = [4 x i8] c"two\00"
@.str.2 = [6 x i8] c"three\00"
@.str.3 = [5 x i8] c"four\00"
@.str.4 = [5 x i8] c"five\00"
@.str.5 = [4 x i8] c"six\00"
@.str.6 = [6 x i8] c"seven\00"
@.str.7 = [6 x i8] c"eight\00"
@.str.8 = [5 x i8] c"nine\00"
@.str.9 = [4 x i8] c"ten\00"
@.str.10 = [4 x i8] c"%d\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [14 x i8] c"Tests passed!\00"
define i32 @main() {
%1 = tail call i64 @hashmap_create(i32 16)
%2 = inttoptr i64 %1 to %struct.hashmap*
%3 = tail call i32 @hashmap_put(%struct.hashmap* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* inttoptr (i64 1 to i8*))
%4 = tail call i32 @hashmap_put(%struct.hashmap* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* inttoptr (i64 2 to i8*))
%5 = tail call i32 @hashmap_put(%struct.hashmap* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* inttoptr (i64 3 to i8*))
%6 = tail call i32 @hashmap_put(%struct.hashmap* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* inttoptr (i64 4 to i8*))
%7 = tail call i32 @hashmap_put(%struct.hashmap* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* inttoptr (i64 5 to i8*))
%8 = tail call i32 @hashmap_put(%struct.hashmap* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* inttoptr (i64 6 to i8*))
%9 = tail call i32 @hashmap_put(%struct.hashmap* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* inttoptr (i64 7 to i8*))
%10 = tail call i32 @hashmap_put(%struct.hashmap* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* inttoptr (i64 8 to i8*))
%11 = tail call i32 @hashmap_put(%struct.hashmap* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* inttoptr (i64 9 to i8*))
%12 = tail call i32 @hashmap_put(%struct.hashmap* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* inttoptr (i64 10 to i8*))
%13 = tail call i32* @hashmap_get(%struct.hashmap* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i32* %13, inttoptr (i64 4 to i32*)
%15 = zext i1 %14 to i32
%16 = tail call i32 @my_assert(i32 %15)
%17 = tail call i64 @hashmap_remove(%struct.hashmap* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i64 %17, 4
%19 = zext i1 %18 to i32
%20 = tail call i32 @my_assert(i32 %19)
%21 = tail call i32* @hashmap_get(%struct.hashmap* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i32* %21, null
%23 = zext i1 %22 to i32
%24 = tail call i32 @my_assert(i32 %23)
%25 = tail call i32 @hashmap_size(%struct.hashmap* %2)
%26 = icmp eq i32 %25, 9
%27 = zext i1 %26 to i32
%28 = tail call i32 @my_assert(i32 %27)
%29 = tail call %struct.hashmap_iterator* @hashmap_get_iterator(%struct.hashmap* %2)
%30 = icmp ne %struct.hashmap_iterator* %29, null
%31 = zext i1 %30 to i32
%32 = tail call i32 @my_assert(i32 %31)
%33 = tail call i32 @hashmap_dump(%struct.hashmap* %2)
%34 = tail call i64 @hashmap_has_next(%struct.hashmap_iterator* %29)
%35 = icmp eq i64 %34, 0
br i1 %35, label %41, label %36
36: ; preds = %0, %36
%37 = tail call i64 @hashmap_get_next(%struct.hashmap_iterator* %29)
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i64 %37)
%39 = tail call i64 @hashmap_has_next(%struct.hashmap_iterator* %29)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %36
41: ; preds = %36, %0
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%43 = load i32, i32* @EXIT_SUCCESS
ret i32 %43
}