int main(int argc, char *argv[]) {
  struct hash *d;
  double t1, t2;
  int i;
  int nkeys;
  char *buffer;
  char *val;
  nkeys = (argc > 1) ? (int)atoi(argv[1]) : 100;
  printf("%15s: %d\n", "values", nkeys);
  buffer = (char *)malloc(9 * nkeys);
  d = hash_create(2097152);
  t1 = epoch_double();
  for (i = 0; i < nkeys; i++) {
    sprintf(buffer + i * 9, "%08x", i);
  }
  t2 = epoch_double();
  printf("%15s: %6.4f sec\n", "initialization", t2 - t1);
  t1 = epoch_double();
  for (i = 0; i < nkeys; i++) {
    hash_set(d, buffer + i * 9, buffer + i * 9);
  }
  t2 = epoch_double();
  printf("%15s: %6.4f sec\n", "adding", t2 - t1);
  t1 = epoch_double();
  for (i = 0; i < nkeys; i++) {
    val = (char *)hash_get(d, buffer + i * 9);
    if (0) {
      printf("hash_get: key=%p, val=%p\n", buffer + i * 9, val);
    }
  }
  t2 = epoch_double();
  printf("%15s: %6.4f sec\n", "lookup", t2 - t1);
  int cnt = hash_get_all_cnt(d);
  int num = 0;
  printf("cnt = %d\n", cnt);
  char **key = calloc(cnt, sizeof(char **));
  void **ptr = calloc(cnt, sizeof(void **));
  hash_dump_all(d, &num, key, ptr);
  if (num != cnt) {
    printf("hash cnt %d does not match expect %d\n", num, cnt);
  }
  for (i = 0; i < cnt; i++) {
    printf("dump key:val = %s:%p\n", key[i], ptr[i]);
  }
  free(key);
  free(ptr);
  t1 = epoch_double();
  for (i = 0; i < nkeys; i++) {
    hash_del(d, buffer + i * 9);
  }
  t2 = epoch_double();
  printf("%15s: %6.4f sec\n", "delete", t2 - t1);
  t1 = epoch_double();
  for (i = 0; i < nkeys; i++) {
    hash_set(d, buffer + i * 9, buffer + i * 9);
  }
  t2 = epoch_double();
  printf("%15s: %6.4f sec\n", "adding", t2 - t1);
  t1 = epoch_double();
  hash_destroy(d);
  t2 = epoch_double();
  printf("%15s: %6.4f sec\n", "free", t2 - t1);
  free(buffer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1217 <main+0x37>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x0,%al
call   10f0 <atoi@plt>
mov    %eax,-0x5c(%rbp)
jmp    1224 <main+0x44>
mov    $0x64,%eax
mov    %eax,-0x5c(%rbp)
jmp    1224 <main+0x44>
mov    -0x5c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%edx
lea    0xdcc(%rip),%rdi
lea    0xdcf(%rip),%rsi
mov    $0x0,%al
call   1060 <printf@plt>
imul   $0x9,-0x30(%rbp),%eax
movslq %eax,%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    $0x200000,%edi
mov    $0x0,%al
call   1050 <hash_create@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <epoch_double@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    12b3 <main+0xd3>
mov    -0x38(%rbp),%rdi
imul   $0x9,-0x2c(%rbp),%eax
cltq
add    %rax,%rdi
mov    -0x2c(%rbp),%edx
lea    0xd73(%rip),%rsi
mov    $0x0,%al
call   1100 <sprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    127b <main+0x9b>
mov    $0x0,%al
call   1040 <epoch_double@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
lea    0xd42(%rip),%rdi
lea    0xd4c(%rip),%rsi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1040 <epoch_double@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    1338 <main+0x158>
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rsi
imul   $0x9,-0x2c(%rbp),%eax
cltq
add    %rax,%rsi
mov    -0x38(%rbp),%rdx
imul   $0x9,-0x2c(%rbp),%eax
cltq
add    %rax,%rdx
mov    $0x0,%al
call   10a0 <hash_set@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12f9 <main+0x119>
mov    $0x0,%al
call   1040 <epoch_double@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
lea    0xcbd(%rip),%rdi
lea    0xcd6(%rip),%rsi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1040 <epoch_double@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    13b6 <main+0x1d6>
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rsi
imul   $0x9,-0x2c(%rbp),%eax
cltq
add    %rax,%rsi
mov    $0x0,%al
call   10d0 <hash_get@plt>
cltq
mov    %rax,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    137e <main+0x19e>
mov    $0x0,%al
call   1040 <epoch_double@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
lea    0xc3f(%rip),%rdi
lea    0xc5f(%rip),%rsi
mov    $0x1,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   10e0 <hash_get_all_cnt@plt>
mov    %eax,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x44(%rbp),%esi
lea    0xc40(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movslq -0x44(%rbp),%rdi
mov    $0x8,%esi
call   1090 <calloc@plt>
mov    %rax,-0x50(%rbp)
movslq -0x44(%rbp),%rdi
mov    $0x8,%esi
call   1090 <calloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x50(%rbp),%rdx
mov    -0x58(%rbp),%rcx
lea    -0x48(%rbp),%rsi
mov    $0x0,%al
call   1070 <hash_dump_all@plt>
mov    -0x48(%rbp),%eax
cmp    -0x44(%rbp),%eax
je     1466 <main+0x286>
mov    -0x48(%rbp),%esi
mov    -0x44(%rbp),%edx
lea    0xbef(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    14ad <main+0x2cd>
mov    -0x50(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x58(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xbdc(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    146d <main+0x28d>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1040 <epoch_double@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    1508 <main+0x328>
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rsi
imul   $0x9,-0x2c(%rbp),%eax
cltq
add    %rax,%rsi
mov    $0x0,%al
call   10c0 <hash_del@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    14d6 <main+0x2f6>
mov    $0x0,%al
call   1040 <epoch_double@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
lea    0xaed(%rip),%rdi
lea    0xb5a(%rip),%rsi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1040 <epoch_double@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    158d <main+0x3ad>
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rsi
imul   $0x9,-0x2c(%rbp),%eax
cltq
add    %rax,%rsi
mov    -0x38(%rbp),%rdx
imul   $0x9,-0x2c(%rbp),%eax
cltq
add    %rax,%rdx
mov    $0x0,%al
call   10a0 <hash_set@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    154e <main+0x36e>
mov    $0x0,%al
call   1040 <epoch_double@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
lea    0xa68(%rip),%rdi
lea    0xa81(%rip),%rsi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1040 <epoch_double@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1080 <hash_destroy@plt>
mov    $0x0,%al
call   1040 <epoch_double@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
lea    0xa1e(%rip),%rdi
lea    0xa92(%rip),%rsi
mov    $0x1,%al
call   1060 <printf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    $0x64,%ebx
cmp    $0x2,%edi
jl     1205 <main+0x25>
mov    0x8(%rsi),%rdi
xor    %eax,%eax
call   10f0 <atoi@plt>
mov    %eax,%ebx
lea    0xdf4(%rip),%rdi
lea    0xdf7(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    (%rbx,%rbx,8),%eax
movslq %eax,%rdi
call   10b0 <malloc@plt>
mov    %rax,%r15
mov    $0x200000,%edi
xor    %eax,%eax
call   1050 <hash_create@plt>
mov    %eax,%r12d
xor    %eax,%eax
call   1040 <epoch_double@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %ebx,%r14d
mov    %rbx,0x8(%rsp)
test   %ebx,%ebx
jle    128c <main+0xac>
lea    0xdb4(%rip),%r13
mov    %r15,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1100 <sprintf@plt>
add    $0x1,%rbp
add    $0x9,%rbx
cmp    %rbp,%r14
jne    1270 <main+0x90>
movslq %r12d,%r12
xor    %eax,%eax
call   1040 <epoch_double@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
subsd  0x10(%rsp),%xmm0
lea    0xd6c(%rip),%rdi
lea    0xd76(%rip),%rsi
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
call   1040 <epoch_double@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    0x8(%rsp),%r13
test   %r13d,%r13d
jle    12fa <main+0x11a>
mov    %r14,%rbp
mov    %r15,%rbx
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10a0 <hash_set@plt>
add    $0x9,%rbx
add    $0xffffffffffffffff,%rbp
jne    12e0 <main+0x100>
xor    %eax,%eax
call   1040 <epoch_double@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
subsd  0x10(%rsp),%xmm0
lea    0xd01(%rip),%rdi
lea    0xd1a(%rip),%rsi
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
call   1040 <epoch_double@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x20(%rsp)
test   %r13d,%r13d
jle    1367 <main+0x187>
mov    %r14,%rbp
mov    %r15,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10d0 <hash_get@plt>
add    $0x9,%rbx
add    $0xffffffffffffffff,%rbp
jne    1350 <main+0x170>
mov    %r15,0x10(%rsp)
xor    %eax,%eax
call   1040 <epoch_double@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
subsd  0x20(%rsp),%xmm0
lea    0xc8f(%rip),%rdi
lea    0xcaf(%rip),%rsi
mov    $0x1,%al
call   1060 <printf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   10e0 <hash_get_all_cnt@plt>
mov    %eax,%ebp
movl   $0x0,0x1c(%rsp)
lea    0xc94(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movslq %ebp,%rbx
mov    $0x8,%esi
mov    %rbx,%rdi
call   1090 <calloc@plt>
mov    %rax,%r13
mov    $0x8,%esi
mov    %rbx,%rdi
call   1090 <calloc@plt>
mov    %rax,%rbx
lea    0x1c(%rsp),%rsi
mov    %r12,%rdi
mov    %r13,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <hash_dump_all@plt>
mov    0x1c(%rsp),%esi
cmp    %ebp,%esi
je     1409 <main+0x229>
lea    0xc4e(%rip),%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1060 <printf@plt>
test   %ebp,%ebp
jle    1440 <main+0x260>
mov    %ebp,%r15d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%r13,%rbp,8),%rsi
mov    (%rbx,%rbp,8),%rdx
lea    0xc44(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1420 <main+0x240>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   1040 <epoch_double@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x20(%rsp)
mov    0x8(%rsp),%r13
test   %r13d,%r13d
mov    0x10(%rsp),%r15
jle    1497 <main+0x2b7>
mov    %r14,%rbp
mov    %r15,%rbx
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10c0 <hash_del@plt>
add    $0x9,%rbx
add    $0xffffffffffffffff,%rbp
jne    1480 <main+0x2a0>
xor    %eax,%eax
call   1040 <epoch_double@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
subsd  0x20(%rsp),%xmm0
lea    0xb64(%rip),%rdi
lea    0xbd1(%rip),%rsi
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
call   1040 <epoch_double@plt>
mov    %eax,%ebx
test   %r13d,%r13d
jle    14fa <main+0x31a>
mov    %r15,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   10a0 <hash_set@plt>
add    $0x9,%rbp
add    $0xffffffffffffffff,%r14
jne    14e0 <main+0x300>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1040 <epoch_double@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
subsd  0x8(%rsp),%xmm0
lea    0xaf4(%rip),%rbx
lea    0xb0d(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
call   1040 <epoch_double@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r12,%rdi
xor    %eax,%eax
call   1080 <hash_destroy@plt>
xor    %eax,%eax
call   1040 <epoch_double@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
subsd  0x8(%rsp),%xmm0
lea    0xb25(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.hash = type opaque
@.str = [10 x i8] c"%15s: %d\0A\00"
@.str.1 = [7 x i8] c"values\00"
@.str.2 = [5 x i8] c"%08x\00"
@.str.3 = [17 x i8] c"%15s: %6.4f sec\0A\00"
@.str.4 = [15 x i8] c"initialization\00"
@.str.5 = [7 x i8] c"adding\00"
@.str.6 = [7 x i8] c"lookup\00"
@.str.7 = [10 x i8] c"cnt = %d\0A\00"
@.str.8 = [38 x i8] c"hash cnt %d does not match expect %d\0A\00"
@.str.9 = [22 x i8] c"dump key:val = %s:%p\0A\00"
@.str.10 = [7 x i8] c"delete\00"
@.str.11 = [5 x i8] c"free\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.hash*
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8**
%16 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp sgt i32 %17, 1
br i1 %18, label %19, label %24
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %22)
br label %25
24: ; preds = %2
br label %25
25: ; preds = %24, %19
%26 = phi i32 [ %23, %19 ], [ 100, %24 ]
store i32 %26, i32* %10
%27 = load i32, i32* %10
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %10
%30 = mul nsw i32 9, %29
%31 = sext i32 %30 to i64
%32 = call i8* @malloc(i64 %31)
store i8* %32, i8** %11
%33 = call i32 (i32, ...) bitcast (i32 (...)* @hash_create to i32 (i32, ...)*)(i32 2097152)
%34 = sext i32 %33 to i64
%35 = inttoptr i64 %34 to %struct.hash*
store %struct.hash* %35, %struct.hash** %6
%36 = call i32 (...) @epoch_double()
%37 = sitofp i32 %36 to double
store double %37, double* %7
store i32 0, i32* %9
br label %38
38: ; preds = %50, %25
%39 = load i32, i32* %9
%40 = load i32, i32* %10
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %53
42: ; preds = %38
%43 = load i8*, i8** %11
%44 = load i32, i32* %9
%45 = mul nsw i32 %44, 9
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %43, i64 %46
%48 = load i32, i32* %9
%49 = call i32 (i8*, i8*, ...) @sprintf(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %48)
br label %50
50: ; preds = %42
%51 = load i32, i32* %9
%52 = add nsw i32 %51, 1
store i32 %52, i32* %9
br label %38
53: ; preds = %38
%54 = call i32 (...) @epoch_double()
%55 = sitofp i32 %54 to double
store double %55, double* %8
%56 = load double, double* %8
%57 = load double, double* %7
%58 = fsub double %56, %57
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), double %58)
%60 = call i32 (...) @epoch_double()
%61 = sitofp i32 %60 to double
store double %61, double* %7
store i32 0, i32* %9
br label %62
62: ; preds = %79, %53
%63 = load i32, i32* %9
%64 = load i32, i32* %10
%65 = icmp slt i32 %63, %64
br i1 %65, label %66, label %82
66: ; preds = %62
%67 = load %struct.hash*, %struct.hash** %6
%68 = load i8*, i8** %11
%69 = load i32, i32* %9
%70 = mul nsw i32 %69, 9
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8, i8* %68, i64 %71
%73 = load i8*, i8** %11
%74 = load i32, i32* %9
%75 = mul nsw i32 %74, 9
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i8, i8* %73, i64 %76
%78 = call i32 (%struct.hash*, i8*, i8*, ...) bitcast (i32 (...)* @hash_set to i32 (%struct.hash*, i8*, i8*, ...)*)(%struct.hash* %67, i8* %72, i8* %77)
br label %79
79: ; preds = %66
%80 = load i32, i32* %9
%81 = add nsw i32 %80, 1
store i32 %81, i32* %9
br label %62
82: ; preds = %62
%83 = call i32 (...) @epoch_double()
%84 = sitofp i32 %83 to double
store double %84, double* %8
%85 = load double, double* %8
%86 = load double, double* %7
%87 = fsub double %85, %86
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %87)
%89 = call i32 (...) @epoch_double()
%90 = sitofp i32 %89 to double
store double %90, double* %7
store i32 0, i32* %9
br label %91
91: ; preds = %105, %82
%92 = load i32, i32* %9
%93 = load i32, i32* %10
%94 = icmp slt i32 %92, %93
br i1 %94, label %95, label %108
95: ; preds = %91
%96 = load %struct.hash*, %struct.hash** %6
%97 = load i8*, i8** %11
%98 = load i32, i32* %9
%99 = mul nsw i32 %98, 9
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i8, i8* %97, i64 %100
%102 = call i32 (%struct.hash*, i8*, ...) bitcast (i32 (...)* @hash_get to i32 (%struct.hash*, i8*, ...)*)(%struct.hash* %96, i8* %101)
%103 = sext i32 %102 to i64
%104 = inttoptr i64 %103 to i8*
store i8* %104, i8** %12
br label %105
105: ; preds = %95
%106 = load i32, i32* %9
%107 = add nsw i32 %106, 1
store i32 %107, i32* %9
br label %91
108: ; preds = %91
%109 = call i32 (...) @epoch_double()
%110 = sitofp i32 %109 to double
store double %110, double* %8
%111 = load double, double* %8
%112 = load double, double* %7
%113 = fsub double %111, %112
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), double %113)
%115 = load %struct.hash*, %struct.hash** %6
%116 = call i32 (%struct.hash*, ...) bitcast (i32 (...)* @hash_get_all_cnt to i32 (%struct.hash*, ...)*)(%struct.hash* %115)
store i32 %116, i32* %13
store i32 0, i32* %14
%117 = load i32, i32* %13
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %117)
%119 = load i32, i32* %13
%120 = sext i32 %119 to i64
%121 = call i8* @calloc(i64 %120, i64 8)
%122 = bitcast i8* %121 to i8**
store i8** %122, i8*** %15
%123 = load i32, i32* %13
%124 = sext i32 %123 to i64
%125 = call i8* @calloc(i64 %124, i64 8)
%126 = bitcast i8* %125 to i8**
store i8** %126, i8*** %16
%127 = load %struct.hash*, %struct.hash** %6
%128 = load i8**, i8*** %15
%129 = load i8**, i8*** %16
%130 = call i32 (%struct.hash*, i32*, i8**, i8**, ...) bitcast (i32 (...)* @hash_dump_all to i32 (%struct.hash*, i32*, i8**, i8**, ...)*)(%struct.hash* %127, i32* %14, i8** %128, i8** %129)
%131 = load i32, i32* %14
%132 = load i32, i32* %13
%133 = icmp ne i32 %131, %132
br i1 %133, label %134, label %138
134: ; preds = %108
%135 = load i32, i32* %14
%136 = load i32, i32* %13
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i32 %135, i32 %136)
br label %138
138: ; preds = %134, %108
store i32 0, i32* %9
br label %139
139: ; preds = %155, %138
%140 = load i32, i32* %9
%141 = load i32, i32* %13
%142 = icmp slt i32 %140, %141
br i1 %142, label %143, label %158
143: ; preds = %139
%144 = load i8**, i8*** %15
%145 = load i32, i32* %9
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds i8*, i8** %144, i64 %146
%148 = load i8*, i8** %147
%149 = load i8**, i8*** %16
%150 = load i32, i32* %9
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds i8*, i8** %149, i64 %151
%153 = load i8*, i8** %152
%154 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i8* %148, i8* %153)
br label %155
155: ; preds = %143
%156 = load i32, i32* %9
%157 = add nsw i32 %156, 1
store i32 %157, i32* %9
br label %139
158: ; preds = %139
%159 = load i8**, i8*** %15
%160 = bitcast i8** %159 to i8*
%161 = load i8**, i8*** %16
%162 = bitcast i8** %161 to i8*
%163 = call i32 (...) @epoch_double()
%164 = sitofp i32 %163 to double
store double %164, double* %7
store i32 0, i32* %9
br label %165
165: ; preds = %177, %158
%166 = load i32, i32* %9
%167 = load i32, i32* %10
%168 = icmp slt i32 %166, %167
br i1 %168, label %169, label %180
169: ; preds = %165
%170 = load %struct.hash*, %struct.hash** %6
%171 = load i8*, i8** %11
%172 = load i32, i32* %9
%173 = mul nsw i32 %172, 9
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds i8, i8* %171, i64 %174
%176 = call i32 (%struct.hash*, i8*, ...) bitcast (i32 (...)* @hash_del to i32 (%struct.hash*, i8*, ...)*)(%struct.hash* %170, i8* %175)
br label %177
177: ; preds = %169
%178 = load i32, i32* %9
%179 = add nsw i32 %178, 1
store i32 %179, i32* %9
br label %165
180: ; preds = %165
%181 = call i32 (...) @epoch_double()
%182 = sitofp i32 %181 to double
store double %182, double* %8
%183 = load double, double* %8
%184 = load double, double* %7
%185 = fsub double %183, %184
%186 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), double %185)
%187 = call i32 (...) @epoch_double()
%188 = sitofp i32 %187 to double
store double %188, double* %7
store i32 0, i32* %9
br label %189
189: ; preds = %206, %180
%190 = load i32, i32* %9
%191 = load i32, i32* %10
%192 = icmp slt i32 %190, %191
br i1 %192, label %193, label %209
193: ; preds = %189
%194 = load %struct.hash*, %struct.hash** %6
%195 = load i8*, i8** %11
%196 = load i32, i32* %9
%197 = mul nsw i32 %196, 9
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds i8, i8* %195, i64 %198
%200 = load i8*, i8** %11
%201 = load i32, i32* %9
%202 = mul nsw i32 %201, 9
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds i8, i8* %200, i64 %203
%205 = call i32 (%struct.hash*, i8*, i8*, ...) bitcast (i32 (...)* @hash_set to i32 (%struct.hash*, i8*, i8*, ...)*)(%struct.hash* %194, i8* %199, i8* %204)
br label %206
206: ; preds = %193
%207 = load i32, i32* %9
%208 = add nsw i32 %207, 1
store i32 %208, i32* %9
br label %189
209: ; preds = %189
%210 = call i32 (...) @epoch_double()
%211 = sitofp i32 %210 to double
store double %211, double* %8
%212 = load double, double* %8
%213 = load double, double* %7
%214 = fsub double %212, %213
%215 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %214)
%216 = call i32 (...) @epoch_double()
%217 = sitofp i32 %216 to double
store double %217, double* %7
%218 = load %struct.hash*, %struct.hash** %6
%219 = call i32 (%struct.hash*, ...) bitcast (i32 (...)* @hash_destroy to i32 (%struct.hash*, ...)*)(%struct.hash* %218)
%220 = call i32 (...) @epoch_double()
%221 = sitofp i32 %220 to double
store double %221, double* %8
%222 = load double, double* %8
%223 = load double, double* %7
%224 = fsub double %222, %223
%225 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), double %224)
%226 = load i8*, i8** %11
ret i32 0
}

LLVM IR (-O2):
%struct.hash = type opaque
@.str = [10 x i8] c"%15s: %d\0A\00"
@.str.1 = [7 x i8] c"values\00"
@.str.2 = [5 x i8] c"%08x\00"
@.str.3 = [17 x i8] c"%15s: %6.4f sec\0A\00"
@.str.4 = [15 x i8] c"initialization\00"
@.str.5 = [7 x i8] c"adding\00"
@.str.6 = [7 x i8] c"lookup\00"
@.str.7 = [10 x i8] c"cnt = %d\0A\00"
@.str.8 = [38 x i8] c"hash cnt %d does not match expect %d\0A\00"
@.str.9 = [22 x i8] c"dump key:val = %s:%p\0A\00"
@.str.10 = [7 x i8] c"delete\00"
@.str.11 = [5 x i8] c"free\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %7)
br label %9
9: ; preds = %2, %5
%10 = phi i32 [ %8, %5 ], [ 100, %2 ]
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = mul nsw i32 %10, 9
%13 = sext i32 %12 to i64
%14 = tail call i8* @malloc(i64 %13)
%15 = tail call i32 (i32, ...) bitcast (i32 (...)* @hash_create to i32 (i32, ...)*)(i32 2097152)
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to %struct.hash*
%18 = tail call i32 (...) @epoch_double()
%19 = sitofp i32 %18 to double
%20 = icmp sgt i32 %10, 0
br i1 %20, label %21, label %31
21: ; preds = %9
%22 = zext i32 %10 to i64
br label %23
23: ; preds = %21, %23
%24 = phi i64 [ 0, %21 ], [ %29, %23 ]
%25 = mul nuw nsw i64 %24, 9
%26 = getelementptr inbounds i8, i8* %14, i64 %25
%27 = trunc i64 %24 to i32
%28 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %26, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %27)
%29 = add nuw nsw i64 %24, 1
%30 = icmp eq i64 %29, %22
br i1 %30, label %31, label %23
31: ; preds = %23, %9
%32 = tail call i32 (...) @epoch_double()
%33 = sitofp i32 %32 to double
%34 = fsub double %33, %19
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), double %34)
%36 = tail call i32 (...) @epoch_double()
%37 = sitofp i32 %36 to double
br i1 %20, label %38, label %47
38: ; preds = %31
%39 = zext i32 %10 to i64
br label %40
40: ; preds = %38, %40
%41 = phi i64 [ 0, %38 ], [ %45, %40 ]
%42 = mul nuw nsw i64 %41, 9
%43 = getelementptr inbounds i8, i8* %14, i64 %42
%44 = tail call i32 (%struct.hash*, i8*, i8*, ...) bitcast (i32 (...)* @hash_set to i32 (%struct.hash*, i8*, i8*, ...)*)(%struct.hash* %17, i8* %43, i8* %43)
%45 = add nuw nsw i64 %41, 1
%46 = icmp eq i64 %45, %39
br i1 %46, label %47, label %40
47: ; preds = %40, %31
%48 = tail call i32 (...) @epoch_double()
%49 = sitofp i32 %48 to double
%50 = fsub double %49, %37
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %50)
%52 = tail call i32 (...) @epoch_double()
%53 = sitofp i32 %52 to double
br i1 %20, label %54, label %63
54: ; preds = %47
%55 = zext i32 %10 to i64
br label %56
56: ; preds = %54, %56
%57 = phi i64 [ 0, %54 ], [ %61, %56 ]
%58 = mul nuw nsw i64 %57, 9
%59 = getelementptr inbounds i8, i8* %14, i64 %58
%60 = tail call i32 (%struct.hash*, i8*, ...) bitcast (i32 (...)* @hash_get to i32 (%struct.hash*, i8*, ...)*)(%struct.hash* %17, i8* %59)
%61 = add nuw nsw i64 %57, 1
%62 = icmp eq i64 %61, %55
br i1 %62, label %63, label %56
63: ; preds = %56, %47
%64 = tail call i32 (...) @epoch_double()
%65 = sitofp i32 %64 to double
%66 = fsub double %65, %53
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), double %66)
%68 = tail call i32 (%struct.hash*, ...) bitcast (i32 (...)* @hash_get_all_cnt to i32 (%struct.hash*, ...)*)(%struct.hash* %17)
%69 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %68)
%71 = sext i32 %68 to i64
%72 = tail call i8* @calloc(i64 %71, i64 8)
%73 = bitcast i8* %72 to i8**
%74 = tail call i8* @calloc(i64 %71, i64 8)
%75 = bitcast i8* %74 to i8**
%76 = call i32 (%struct.hash*, i32*, i8**, i8**, ...) bitcast (i32 (...)* @hash_dump_all to i32 (%struct.hash*, i32*, i8**, i8**, ...)*)(%struct.hash* %17, i32* %3, i8** %73, i8** %75)
%77 = load i32, i32* %3
%78 = icmp eq i32 %77, %68
br i1 %78, label %81, label %79
79: ; preds = %63
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i32 %77, i32 %68)
br label %81
81: ; preds = %79, %63
%82 = icmp sgt i32 %68, 0
br i1 %82, label %83, label %94
83: ; preds = %81
%84 = zext i32 %68 to i64
br label %85
85: ; preds = %83, %85
%86 = phi i64 [ 0, %83 ], [ %92, %85 ]
%87 = getelementptr inbounds i8*, i8** %73, i64 %86
%88 = load i8*, i8** %87
%89 = getelementptr inbounds i8*, i8** %75, i64 %86
%90 = load i8*, i8** %89
%91 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i8* %88, i8* %90)
%92 = add nuw nsw i64 %86, 1
%93 = icmp eq i64 %92, %84
br i1 %93, label %94, label %85
94: ; preds = %85, %81
%95 = call i32 (...) @epoch_double()
%96 = sitofp i32 %95 to double
br i1 %20, label %97, label %106
97: ; preds = %94
%98 = zext i32 %10 to i64
br label %99
99: ; preds = %97, %99
%100 = phi i64 [ 0, %97 ], [ %104, %99 ]
%101 = mul nuw nsw i64 %100, 9
%102 = getelementptr inbounds i8, i8* %14, i64 %101
%103 = call i32 (%struct.hash*, i8*, ...) bitcast (i32 (...)* @hash_del to i32 (%struct.hash*, i8*, ...)*)(%struct.hash* %17, i8* %102)
%104 = add nuw nsw i64 %100, 1
%105 = icmp eq i64 %104, %98
br i1 %105, label %106, label %99
106: ; preds = %99, %94
%107 = call i32 (...) @epoch_double()
%108 = sitofp i32 %107 to double
%109 = fsub double %108, %96
%110 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), double %109)
%111 = call i32 (...) @epoch_double()
br i1 %20, label %112, label %121
112: ; preds = %106
%113 = zext i32 %10 to i64
br label %114
114: ; preds = %112, %114
%115 = phi i64 [ 0, %112 ], [ %119, %114 ]
%116 = mul nuw nsw i64 %115, 9
%117 = getelementptr inbounds i8, i8* %14, i64 %116
%118 = call i32 (%struct.hash*, i8*, i8*, ...) bitcast (i32 (...)* @hash_set to i32 (%struct.hash*, i8*, i8*, ...)*)(%struct.hash* %17, i8* %117, i8* %117)
%119 = add nuw nsw i64 %115, 1
%120 = icmp eq i64 %119, %113
br i1 %120, label %121, label %114
121: ; preds = %114, %106
%122 = sitofp i32 %111 to double
%123 = call i32 (...) @epoch_double()
%124 = sitofp i32 %123 to double
%125 = fsub double %124, %122
%126 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %125)
%127 = call i32 (...) @epoch_double()
%128 = sitofp i32 %127 to double
%129 = call i32 (%struct.hash*, ...) bitcast (i32 (...)* @hash_destroy to i32 (%struct.hash*, ...)*)(%struct.hash* %17)
%130 = call i32 (...) @epoch_double()
%131 = sitofp i32 %130 to double
%132 = fsub double %131, %128
%133 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), double %132)
ret i32 0
}