// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/hashmap.c
// Function: gt_hashmap_test
static int
gt_hashmap_test(GtHashType hash_type)
{
  char *s1 = "foo", *s2 = "bar";
  GT_UNUSED GtUword ul1 = 1UL, ul2 = 2UL;
  GT_UNUSED GtUint64 ull1 = 3ULL, ull2 = 4ULL, *sptr = NULL,
                               *tptr = NULL;
  GtHashmap *hm;
  GtHashtable *ht;
  int had_err = 0;
  do {
    /* empty hash */
    hm = gt_hashmap_new(hash_type, NULL, NULL);
    gt_hashmap_delete(hm);

    /* empty hash with reset */
    hm = gt_hashmap_new(hash_type, NULL, NULL);
    gt_hashmap_reset(hm);
    gt_hashmap_delete(hm);

    /* hashes containing one element */
    hm = gt_hashmap_new(hash_type, NULL, NULL);
    gt_hashmap_add(hm, s1, s2);
    my_ensure(had_err, gt_hashmap_get(hm, s1) == s2);
    my_ensure(had_err, !gt_hashmap_get(hm, s2));
    gt_hashmap_delete(hm);

    /* hashes containing two elements */
    hm = gt_hashmap_new(hash_type, NULL, NULL);
    gt_hashmap_add(hm, s1, s2);
    gt_hashmap_add(hm, s2, s1);
    my_ensure(had_err, gt_hashmap_get(hm, s1) == s2);
    my_ensure(had_err, gt_hashmap_get(hm, s2) == s1);

    /* remove element A and ensure it's no longer present */
    gt_hashmap_remove(hm, s1);
    my_ensure(had_err, !gt_hashmap_get(hm, s1));
    my_ensure(had_err, gt_hashmap_get(hm, s2) == s1);
    gt_hashmap_delete(hm);

    /* hashes containing two elements (store key and value in
     * hashmap) where simple free is the correct way to get rid of them
     */
    if (hash_type == GT_HASH_STRING)
    {
      hm = gt_hashmap_new(hash_type, gt_free_func, gt_free_func);

      gt_hashmap_add(hm, gt_cstr_dup(s1), gt_cstr_dup(s2));
      gt_hashmap_add(hm, gt_cstr_dup(s2), gt_cstr_dup(s1));
      my_ensure(had_err, !strcmp(gt_hashmap_get(hm, s1), s2));
      my_ensure(had_err, !strcmp(gt_hashmap_get(hm, s2), s1));
      gt_hashmap_remove(hm, s1); /* remove first element */
      my_ensure(had_err, !gt_hashmap_get(hm, s1));
      my_ensure(had_err, !strcmp(gt_hashmap_get(hm, s2),  s1));
      gt_hashmap_delete(hm);
    }

    /* test direct modification of hash contents */
    ht = testul_testull_gt_hashmap_new();
    my_ensure(had_err, !sptr);
    sptr = testul_testull_gt_hashmap_add_and_return_storage(ht, ul1, ull1);
    my_ensure(had_err, *sptr == ull1);
    sptr = testul_testull_gt_hashmap_add_and_return_storage(ht, ul1, ull2);
    my_ensure(had_err, *sptr == ull2);
    (*sptr)++;
    tptr = testul_testull_gt_hashmap_get(ht, ul1);
    my_ensure(had_err, tptr == sptr);
    my_ensure(had_err, *tptr == ull2+1);
    gt_hashtable_delete(ht);

  } while (0);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edi, %ebp
xorl %esi, %esi
xorl %edx, %edx
callq 0x55da4
movq %rax, %rdi
callq 0x572a1
movl %ebp, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x55da4
movq %rax, %rbx
movq %rax, %rdi
callq 0x57019
movq %rbx, %rdi
callq 0x572a1
movl %ebp, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x55da4
movq %rax, %r14
leaq 0x84df3(%rip), %rbx     # 0xdaf01
leaq 0x84112(%rip), %r15     # 0xda227
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x55f31
movq %r14, %rdi
movq %rbx, %rsi
callq 0x55ef6
pushq $-0x1
popq %rbx
cmpq %r15, %rax
jne 0x561e8
leaq 0x840e6(%rip), %r15     # 0xda227
movq %r14, %rdi
movq %r15, %rsi
callq 0x55ef6
testq %rax, %rax
jne 0x561e8
movq %r14, %rdi
callq 0x572a1
movl %ebp, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x55da4
movq %rax, %r14
leaq 0x84d8f(%rip), %r12     # 0xdaf01
movq %rax, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x55f31
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x55f31
movq %r14, %rdi
movq %r12, %rsi
callq 0x55ef6
cmpq %r15, %rax
jne 0x561e8
leaq 0x84082(%rip), %rsi     # 0xda227
movq %r14, %rdi
callq 0x55ef6
cmpq %r12, %rax
jne 0x561e8
leaq 0x84d48(%rip), %r15     # 0xdaf01
movq %r14, %rdi
movq %r15, %rsi
callq 0x55f6f
movq %r14, %rdi
movq %r15, %rsi
callq 0x55ef6
testq %rax, %rax
jne 0x561e8
leaq 0x8404c(%rip), %rsi     # 0xda227
movq %r14, %rdi
callq 0x55ef6
cmpq %r15, %rax
je 0x561f9
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x572a1
cmpl $0x1, %ebp
jne 0x56307
leaq -0x48e82(%rip), %rdx    # 0xd38f
pushq $0x1
popq %rdi
movq %rdx, %rsi
callq 0x55da4
movq %rax, %r14
leaq 0x84cdb(%rip), %r15     # 0xdaf01
movq %r15, %rdi
callq 0x4f8ae
movq %rax, %r13
leaq 0x83fef(%rip), %r12     # 0xda227
movq %r12, %rdi
callq 0x4f8ae
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x55f31
movq %r12, %rdi
callq 0x4f8ae
movq %rax, %r13
movq %r15, %rdi
callq 0x4f8ae
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x55f31
movq %r14, %rdi
movq %r15, %rsi
callq 0x55ef6
movq %rax, %rdi
movq %r12, %rsi
callq 0xb880
testl %eax, %eax
jne 0x561e8
leaq 0x83f93(%rip), %rsi     # 0xda227
movq %r14, %rdi
callq 0x55ef6
leaq 0x84c5e(%rip), %rsi     # 0xdaf01
movq %rax, %rdi
callq 0xb880
testl %eax, %eax
jne 0x561e8
leaq 0x84c47(%rip), %r15     # 0xdaf01
movq %r14, %rdi
movq %r15, %rsi
callq 0x55f6f
movq %r14, %rdi
movq %r15, %rsi
callq 0x55ef6
testq %rax, %rax
jne 0x561e8
leaq 0x83f47(%rip), %rsi     # 0xda227
movq %r14, %rdi
callq 0x55ef6
leaq 0x84c12(%rip), %rsi     # 0xdaf01
movq %rax, %rdi
callq 0xb880
testl %eax, %eax
jne 0x561e8
movq %r14, %rdi
callq 0x572a1
movups 0xd842a(%rip), %xmm0    # 0x12e738
movups %xmm0, 0x20(%rsp)
movups 0xd840e(%rip), %xmm0    # 0x12e728
movups %xmm0, 0x10(%rsp)
movups 0xd83f2(%rip), %xmm0    # 0x12e718
movups %xmm0, (%rsp)
callq 0x5653b
movq %rax, %r14
pushq $0x3
popq %rsi
movq %rax, %rdi
callq 0x56421
cmpq $0x3, (%rax)
jne 0x561e8
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x56421
cmpq $0x4, (%rax)
jne 0x561e8
movq %rax, %r15
movq $0x5, (%rax)
leaq 0x30(%rsp), %rsi
movq $0x1, (%rsi)
movq %r14, %rdi
callq 0x565c1
leaq 0x8(%rax), %rcx
testq %rax, %rax
cmoveq %rax, %rcx
cmpq %r15, %rcx
jne 0x561e8
cmpq $0x5, (%rcx)
jne 0x561e8
movq %r14, %rdi
callq 0x572a1
xorl %ebx, %ebx
jmp 0x561e8