// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/test_khash.c
// Function: benchmark
static int benchmark(const char *keys_file) {
    const size_t kl = 16;
    size_t max = 50000000;
    size_t i;
    char *keys = NULL;
    char **key_locations = NULL;
    khash_t(str2int) *h;
    long long start, end;

    if (keys_file) {
        max = read_keys(keys_file, &keys, &key_locations);
    } else {
        keys = make_keys(max, kl);
    }

    if (!keys) return -1;

    h = kh_init(str2int);
    if (!h) goto fail;

    if ((start = get_time()) < 0)
        goto fail;

    if (keys_file) {
        for (i = 0; i < max; i++) {
            int ret;
            khint_t k = kh_put(str2int, h, key_locations[i], &ret);
            if (ret < 0) {
                fprintf(stderr, "Unexpected return from kh_put(%s) : %d\n",
                        key_locations[i], ret);
                goto fail;
            }
            kh_val(h, k) = i;
        }
    } else {
        for (i = 0; i < max; i++) {
            int ret;
            khint_t k = kh_put(str2int, h, keys + i * kl, &ret);
            if (ret <= 0) {
                fprintf(stderr, "Unexpected return from kh_put(%s) : %d\n",
                        keys + i * kl, ret);
                goto fail;
            }
            kh_val(h, k) = i;
        }
    }

    if ((end = get_time()) < 0)
        goto fail;

    printf("Insert %zu %s\n", max, fmt_time(end - start));

    if ((start = get_time()) < 0)
        goto fail;

    if (keys_file) {
        for (i = 0; i < max; i++) {
            khint_t k = kh_get(str2int, h, key_locations[i]);
            if (k >= kh_end(h)) {
                fprintf(stderr, "Couldn't find %s in hash table\n",
                        key_locations[i]);
                goto fail;
            }
        }
    } else {
        for (i = 0; i < max; i++) {
            khint_t k = kh_get(str2int, h, keys + i * kl);
            if (k >= kh_end(h)) {
                fprintf(stderr, "Couldn't find %s in hash table\n",
                        keys + i * kl);
                goto fail;
            }
        }
    }

    if ((end = get_time()) < 0)
        goto fail;

    printf("Lookup %zu %s\n", max, fmt_time(end - start));

    write_stats_str2int(h);

    kh_destroy(str2int, h);
    free(keys);
    free(key_locations);

    return 0;
 fail:
    kh_destroy(str2int, h);
    free(keys);
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq $0x10, -0x18(%rbp)
movq $0x2faf080, -0x20(%rbp) # imm = 0x2FAF080
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x1afd
movq -0x10(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x2e50
movq %rax, -0x20(%rbp)
jmp 0x1b0f
movq -0x20(%rbp), %rdi
movl $0x10, %esi
callq 0x1280
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x1b22
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1e24
callq 0x1e30
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x1b37
jmp 0x1e0b
callq 0x3170
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
jge 0x1b4b
jmp 0x1e0b
cmpq $0x0, -0x10(%rbp)
je 0x1bdd
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x1bd8
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x54(%rbp), %rdx
callq 0x21c0
movl %eax, -0x58(%rbp)
cmpl $0x0, -0x54(%rbp)
jge 0x1bb6
movq 0x444f(%rip), %rax      # 0x5fe0
movq (%rax), %rdi
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movl -0x54(%rbp), %ecx
leaq 0x26b7(%rip), %rsi      # 0x4261
movb $0x0, %al
callq 0x1110
jmp 0x1e0b
movq -0x28(%rbp), %rax
movl %eax, %edx
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x58(%rbp), %ecx
movl %edx, (%rax,%rcx,4)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x1b5e
jmp 0x1c67
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x1c65
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
leaq -0x5c(%rbp), %rdx
callq 0x21c0
movl %eax, -0x60(%rbp)
cmpl $0x0, -0x5c(%rbp)
jg 0x1c43
movq 0x43c5(%rip), %rax      # 0x5fe0
movq (%rax), %rdi
movq -0x30(%rbp), %rdx
movq -0x28(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdx
movl -0x5c(%rbp), %ecx
leaq 0x262a(%rip), %rsi      # 0x4261
movb $0x0, %al
callq 0x1110
jmp 0x1e0b
movq -0x28(%rbp), %rax
movl %eax, %edx
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x60(%rbp), %ecx
movl %edx, (%rax,%rcx,4)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x1be5
jmp 0x1c67
callq 0x3170
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
jge 0x1c7b
jmp 0x1e0b
movq -0x20(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x50(%rbp), %rdi
subq -0x48(%rbp), %rdi
callq 0x31c0
movq -0x70(%rbp), %rsi
movq %rax, %rdx
leaq 0x26fb(%rip), %rdi      # 0x4399
movb $0x0, %al
callq 0x1030
callq 0x3170
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
jge 0x1cb9
jmp 0x1e0b
cmpq $0x0, -0x10(%rbp)
je 0x1d30
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x1d2e
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x2a70
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl (%rcx), %eax
jb 0x1d1e
movq 0x42e4(%rip), %rax      # 0x5fe0
movq (%rax), %rdi
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x259d(%rip), %rsi      # 0x42af
movb $0x0, %al
callq 0x1110
jmp 0x1e0b
jmp 0x1d20
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x1cc8
jmp 0x1da3
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x1da1
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x2a70
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl (%rcx), %eax
jb 0x1d91
movq 0x4271(%rip), %rax      # 0x5fe0
movq (%rax), %rdi
movq -0x30(%rbp), %rdx
movq -0x28(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdx
leaq 0x2527(%rip), %rsi      # 0x42af
movb $0x0, %al
callq 0x1110
jmp 0x1e0b
jmp 0x1d93
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x1d38
jmp 0x1da3
callq 0x3170
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
jge 0x1db4
jmp 0x1e0b
movq -0x20(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x50(%rbp), %rdi
subq -0x48(%rbp), %rdi
callq 0x31c0
movq -0x78(%rbp), %rsi
movq %rax, %rdx
leaq 0x25d1(%rip), %rdi      # 0x43a8
movb $0x0, %al
callq 0x1030
movq -0x40(%rbp), %rdi
callq 0x2030
movq -0x40(%rbp), %rdi
callq 0x2170
movq -0x30(%rbp), %rdi
callq 0x10e0
movq -0x38(%rbp), %rdi
callq 0x10e0
movl $0x0, -0x4(%rbp)
jmp 0x1e24
movq -0x40(%rbp), %rdi
callq 0x2170
movq -0x30(%rbp), %rdi
callq 0x10e0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq