// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: sam_header2tbl
void *sam_header2tbl(const void *_dict, char type[2], char key_tag[2], char value_tag[2])
{
	const HeaderDict *dict = (const HeaderDict*)_dict;
    const list_t *l   = dict;
    khash_t(str) *tbl = kh_init(str);
    khiter_t k;
    int ret;

	if (_dict == 0) return tbl; // return an empty (not null) hash table
    while (l)
    {
        HeaderLine *hline = l->data;
        if ( hline->type[0]!=type[0] || hline->type[1]!=type[1] ) 
        {
            l = l->next;
            continue;
        }
        
        HeaderTag *key, *value;
        key   = header_line_has_tag(hline,key_tag);
        value = header_line_has_tag(hline,value_tag); 
        if ( !key || !value )
        {
            l = l->next;
            continue;
        }
        
        k = kh_get(str, tbl, key->value);
        if ( k != kh_end(tbl) )
            debug("[sam_header_lookup_table] They key %s not unique.\n", key->value);
        k = kh_put(str, tbl, key->value, &ret);
        kh_value(tbl, k) = value->value;

        l = l->next;
    }
    return tbl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rcx, -0xa8(%rbp)
movq %rdx, -0xa0(%rbp)
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x1
popq %rdi
pushq $0x28
popq %rsi
callq 0x31c0
testq %r14, %r14
je 0x89ca
movq %r14, %rdi
movq %rbx, %rsi
xorl %r13d, %r13d
pushq $0x2
popq %rbx
movq $0x0, -0x38(%rbp)
xorl %r14d, %r14d
xorl %r8d, %r8d
movq $0x0, -0x60(%rbp)
xorl %edx, %edx
movl $0x0, -0x68(%rbp)
movl $0x0, -0x48(%rbp)
movq %rsi, -0x78(%rbp)
movq %rax, -0x30(%rbp)
testq %rdi, %rdi
je 0x89ca
movq 0x10(%rdi), %r12
movb (%r12), %cl
cmpb (%rsi), %cl
jne 0x8647
movb 0x1(%r12), %cl
cmpb 0x1(%rsi), %cl
jne 0x8647
movl %r8d, -0x58(%rbp)
movl %edx, -0x40(%rbp)
movq %rdi, -0x80(%rbp)
movq %r12, %rdi
movq -0xa0(%rbp), %rsi
callq 0x89dc
movq %rax, %r15
movq %r12, %rdi
movq -0xa8(%rbp), %rsi
callq 0x89dc
testq %r15, %r15
sete %dl
testq %rax, %rax
sete %cl
orb %dl, %cl
jne 0x865c
movq %rax, -0x98(%rbp)
movq 0x8(%r15), %r12
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x8a01
cmpl -0x48(%rbp), %eax
je 0x8572
leaq 0x315d(%rip), %rdi      # 0xb6c1
movq %r12, %rsi
xorl %eax, %eax
callq 0x8ad8
movq 0x8(%r15), %r12
leaq 0x2b37(%rip), %rsi      # 0xb0b0
movl -0x40(%rbp), %edi
cmpl %edi, -0x68(%rbp)
movl -0x58(%rbp), %r8d
movq %r12, -0x88(%rbp)
jb 0x8676
movq -0x60(%rbp), %rax
addl %eax, %eax
movl -0x48(%rbp), %ecx
cmpl %ecx, %eax
movl $0x0, %eax
sbbl %eax, %eax
orl $0x1, %eax
addl %ecx, %eax
pushq $0x21
popq %rcx
leal -0x2(%rcx), %edx
decl %ecx
cmpl %eax, (%rsi,%rdx,4)
ja 0x85aa
movl %ecx, %eax
movl (%rsi,%rax,4), %r12d
cvtsi2sd %r12, %xmm0
mulsd 0x2a41(%rip), %xmm0     # 0xb008
addsd 0x2a41(%rip), %xmm0     # 0xb010
cvttsd2si %xmm0, %rax
cmpl %eax, -0x60(%rbp)
jae 0x8676
movq %rax, -0x70(%rbp)
movl %r12d, %eax
shrl $0x4, %eax
leaq 0x4(,%rax,4), %r15
movq %r15, %rdi
callq 0x3470
movq %rax, %r14
movq %rax, %rdi
movl $0xaa, %esi
movq %r15, %rdx
callq 0x3170
cmpl %r12d, -0x48(%rbp)
jae 0x8681
leaq (,%r12,8), %rsi
movq %rsi, -0x40(%rbp)
movq -0x38(%rbp), %rdi
callq 0x3590
movq -0x30(%rbp), %r15
movq %rax, -0x38(%rbp)
movq %rax, 0x18(%r15)
movq 0x20(%r15), %rdi
movq -0x40(%rbp), %rsi
callq 0x3590
movq %r15, %r8
movq %rax, 0x20(%r15)
jmp 0x8685
movl %r8d, %r12d
movl %edx, %r15d
movq 0x8(%rdi), %rdi
movl %r12d, %r8d
movl %r15d, %edx
jmp 0x84da
movl -0x58(%rbp), %eax
movl %eax, %r12d
movl -0x40(%rbp), %eax
movl %eax, %r15d
movq -0x78(%rbp), %rsi
movq -0x80(%rbp), %rdi
movq -0x30(%rbp), %rax
jmp 0x864d
movl %r8d, %r12d
movl %edi, %r15d
jmp 0x881f
movq -0x30(%rbp), %r8
leal -0x1(%r12), %eax
movl %eax, -0x4c(%rbp)
movl -0x48(%rbp), %edi
xorl %r9d, %r9d
movq %rdi, -0xb0(%rbp)
cmpq %rdi, %r9
je 0x87b5
movq 0x10(%r8), %r10
movl %r9d, %edx
shrl $0x4, %edx
movl (%r10,%rdx,4), %eax
leal (%r9,%r9), %ecx
andl $0x1e, %ecx
movl %eax, %esi
shrl %cl, %esi
testb $0x3, %sil
jne 0x87ad
movq %r10, -0x58(%rbp)
leaq (%r10,%rdx,4), %rdx
movq -0x38(%rbp), %rsi
movq (%rsi,%r9,8), %r15
movq 0x20(%r8), %rsi
movq %r9, -0x68(%rbp)
movq %rsi, -0x90(%rbp)
movq (%rsi,%r9,8), %rsi
movq %rsi, -0x40(%rbp)
btsl %ecx, %eax
movl %eax, (%rdx)
movq %r15, %rdi
callq 0x910c
movl %eax, %ecx
xorl %edx, %edx
divl %r12d
movl %edx, %esi
movl %ecx, %eax
xorl %edx, %edx
divl -0x4c(%rbp)
incl %edx
movl %esi, %edi
shrl $0x4, %edi
movl (%r14,%rdi,4), %eax
leal (%rsi,%rsi), %ecx
andl $0x1e, %ecx
movl %ebx, %r8d
shll %cl, %r8d
testl %eax, %r8d
jne 0x8736
addl %edx, %esi
cmpl %r12d, %esi
movl %r12d, %eax
cmovbl %r13d, %eax
subl %eax, %esi
jmp 0x870c
notl %r8d
andl %r8d, %eax
movl %eax, (%r14,%rdi,4)
movl %esi, %r8d
cmpl -0x48(%rbp), %esi
movq -0x58(%rbp), %rsi
jae 0x8787
movl (%rsi,%rdi,4), %eax
movl %eax, %edx
shrl %cl, %edx
testb $0x3, %dl
jne 0x8787
leaq (%rsi,%rdi,4), %rdx
movq -0x38(%rbp), %rdi
movq (%rdi,%r8,8), %rsi
movq %r15, (%rdi,%r8,8)
movq -0x90(%rbp), %r9
movq (%r9,%r8,8), %rdi
movq -0x40(%rbp), %r10
movq %r10, (%r9,%r8,8)
movq %rsi, %r15
movq %rdi, -0x40(%rbp)
jmp 0x86ed
movq -0x38(%rbp), %rax
movq %r15, (%rax,%r8,8)
movq -0x90(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, (%rax,%r8,8)
movq -0x30(%rbp), %r8
movq -0xb0(%rbp), %rdi
movq -0x68(%rbp), %r9
incq %r9
jmp 0x869a
cmpl %r12d, -0x48(%rbp)
jbe 0x87f6
leaq (,%r12,8), %r15
movq -0x38(%rbp), %rdi
movq %r15, %rsi
callq 0x3590
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, -0x38(%rbp)
movq %rcx, 0x18(%rax)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rdi
movq %r15, %rsi
callq 0x3590
movq -0x30(%rbp), %r8
movq %rax, 0x20(%r8)
movq 0x10(%r8), %rdi
movq %r8, %r15
callq 0x33d0
movq %r14, 0x10(%r15)
movl %r12d, (%r15)
movq -0x60(%rbp), %rax
movl %eax, 0x8(%r15)
movq -0x70(%rbp), %rcx
movl %ecx, 0xc(%r15)
movq %rcx, %r15
movl %eax, -0x68(%rbp)
movq -0x88(%rbp), %rdi
callq 0x910c
movl %eax, %esi
xorl %edx, %edx
divl %r12d
movl %edx, %edi
movl %edx, %eax
shrl $0x4, %eax
movl (%r14,%rax,4), %eax
leal (%rdi,%rdi), %ecx
shrl %cl, %eax
testb $0x2, %al
je 0x8852
movl %edi, %r8d
movq -0x30(%rbp), %rax
jmp 0x8925
movq %r15, -0x70(%rbp)
leal -0x1(%r12), %ecx
movl %esi, %eax
xorl %edx, %edx
divl %ecx
incl %edx
movl %edi, %esi
movl %r12d, %r8d
movq %rdi, -0x90(%rbp)
movl %edx, -0x4c(%rbp)
movl %esi, %eax
shrl $0x4, %eax
movl (%r14,%rax,4), %r9d
leal (%rsi,%rsi), %r15d
andl $0x1e, %r15d
movl %r9d, %eax
movl %r15d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x88fd
testb $0x1, %al
jne 0x88cf
movl %esi, %eax
movq -0x38(%rbp), %rcx
movq (%rcx,%rax,8), %rdi
movq %rsi, -0x48(%rbp)
movq -0x88(%rbp), %rsi
movq %r8, -0x40(%rbp)
movl %r9d, -0x58(%rbp)
callq 0x34a0
movl -0x58(%rbp), %r9d
movl -0x4c(%rbp), %edx
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %r8
movq -0x90(%rbp), %rdi
testl %eax, %eax
je 0x88fd
btl %r15d, %r9d
cmovbl %esi, %r8d
addl %edx, %esi
cmpl %r12d, %esi
movl %r12d, %eax
cmovbl %r13d, %eax
subl %eax, %esi
cmpl %edi, %esi
jne 0x8872
movb $0x1, %dl
movl %r12d, %ecx
cmpl %r12d, %r8d
movq -0x30(%rbp), %rax
movq -0x70(%rbp), %r15
je 0x8917
jmp 0x8925
movq -0x30(%rbp), %rax
movl %r15d, %ecx
shrl %cl, %r9d
testb $0x2, %r9b
sete %dl
movl %r8d, %ecx
movl %esi, %edi
movq -0x70(%rbp), %r15
cmpl %r12d, %ecx
cmovel %edi, %ecx
testb %dl, %dl
cmovnel %edi, %ecx
movl %ecx, %r8d
movl %r8d, %edx
shrl $0x4, %edx
movl (%r14,%rdx,4), %esi
leal (%r8,%r8), %ecx
andl $0x1e, %ecx
movl %esi, %edi
shrl %cl, %edi
movl %r8d, %r8d
testb $0x2, %dil
jne 0x8973
testb $0x1, %dil
je 0x89a6
pushq $0x3
popq %rdi
shll %cl, %edi
movq -0x38(%rbp), %rcx
movq -0x88(%rbp), %r9
movq %r9, (%rcx,%r8,8)
notl %edi
andl %edi, %esi
movl %esi, (%r14,%rdx,4)
movl 0x4(%rax), %edx
incl %edx
movq %rdx, -0x60(%rbp)
movl %edx, 0x4(%rax)
jmp 0x89a6
movq -0x38(%rbp), %rdi
movq -0x88(%rbp), %r9
movq %r9, (%rdi,%r8,8)
pushq $0x3
popq %rdi
shll %cl, %edi
notl %edi
andl %edi, %esi
movl %esi, (%r14,%rdx,4)
movl 0x4(%rax), %edx
movl 0x8(%rax), %esi
incl %edx
movq %rdx, -0x60(%rbp)
movl %edx, 0x4(%rax)
incl %esi
movl %esi, -0x68(%rbp)
movl %esi, 0x8(%rax)
movq -0x78(%rbp), %rsi
movq -0x80(%rbp), %rdi
movq -0x98(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq 0x20(%rax), %rdx
movq %rcx, (%rdx,%r8,8)
movl %r12d, -0x48(%rbp)
jmp 0x864d
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq