// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/sam_header.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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r12
movl $0x1, %edi
movl $0x28, %esi
callq 0x32e0
movq %rax, 0x10(%rsp)
testq %r12, %r12
je 0x16d1d
movq %r12, %r9
movq %rbx, %r8
xorl %r10d, %r10d
movq $0x0, 0x8(%rsp)
xorl %r13d, %r13d
xorl %r12d, %r12d
movq $0x0, 0x40(%rsp)
xorl %ebp, %ebp
movl $0x0, 0x34(%rsp)
movq $0x0, 0x60(%rsp)
xorl %edi, %edi
movq %r14, 0x28(%rsp)
movq %r15, 0x70(%rsp)
movq %rbx, 0x48(%rsp)
movq 0x10(%r9), %rax
movb (%rax), %cl
cmpb (%r8), %cl
jne 0x16728
movb 0x1(%rax), %cl
cmpb 0x1(%r8), %cl
jne 0x16728
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x16728
movb (%r15), %cl
movq %rax, %rdx
movq 0x10(%rdx), %rbx
cmpb %cl, (%rbx)
jne 0x166fe
movb 0x1(%rbx), %sil
cmpb 0x1(%r15), %sil
je 0x16709
movq 0x8(%rdx), %rdx
testq %rdx, %rdx
jne 0x166ec
xorl %ebx, %ebx
movb (%r14), %cl
movq 0x10(%rax), %r11
cmpb %cl, (%r11)
jne 0x1671f
movb 0x1(%r11), %dl
cmpb 0x1(%r14), %dl
je 0x16740
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0x1670c
movl %r12d, %ebx
movl %ebp, %eax
movq 0x8(%r9), %r9
movl %ebx, %r12d
movl %eax, %ebp
testq %r9, %r9
jne 0x166c9
jmp 0x16d1d
testq %rbx, %rbx
je 0x16728
movq 0x8(%rbx), %rdx
testl %edi, %edi
movq %r9, 0x58(%rsp)
movq %r11, 0x50(%rsp)
movq %rdi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movl %ebp, 0x30(%rsp)
je 0x1678e
movsbl (%rdx), %ecx
testl %ecx, %ecx
je 0x16795
movb 0x1(%rdx), %al
testb %al, %al
je 0x16797
addq $0x2, %rdx
movl %ecx, %esi
shll $0x5, %esi
subl %ecx, %esi
movsbl %al, %ecx
addl %esi, %ecx
movb (%rdx), %al
incq %rdx
testb %al, %al
jne 0x16777
jmp 0x16797
xorl %ebp, %ebp
jmp 0x1685a
xorl %ecx, %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %edi
movl %edx, %r8d
leal -0x1(%rdi), %esi
movl %ecx, %eax
xorl %edx, %edx
divl %esi
incl %edx
movl %r8d, %ebp
movl %r8d, 0x38(%rsp)
movl %edx, 0x6c(%rsp)
movl %ebp, %eax
shrl $0x4, %eax
movq 0x60(%rsp), %rcx
movl (%rcx,%rax,4), %r15d
leal (,%rbp,2), %r14d
andl $0x1e, %r14d
movl %r15d, %eax
movl %r14d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x16839
testb $0x1, %al
jne 0x1680b
movl %ebp, %eax
movq 0x8(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
movq 0x18(%rsp), %rsi
callq 0x3300
movl 0x6c(%rsp), %edx
movl 0x38(%rsp), %r8d
movq 0x20(%rsp), %rdi
xorl %r10d, %r10d
testl %eax, %eax
je 0x16839
addl %edx, %ebp
cmpl %edi, %ebp
movl %edi, %eax
cmovbl %r10d, %eax
subl %eax, %ebp
cmpl %r8d, %ebp
jne 0x167b7
movq 0x28(%rsp), %r14
movq 0x48(%rsp), %r8
movq 0x58(%rsp), %r9
leaq 0x687e(%rip), %r15      # 0x1d0b0
movq 0x50(%rsp), %r11
jmp 0x16869
movl %r14d, %ecx
shrl %cl, %r15d
testb $0x3, %r15b
cmovnel %edi, %ebp
movq 0x28(%rsp), %r14
movq 0x48(%rsp), %r8
movq 0x58(%rsp), %r9
movq 0x50(%rsp), %r11
cmpl %edi, %ebp
leaq 0x684d(%rip), %r15      # 0x1d0b0
jne 0x16ce5
movl 0x30(%rsp), %esi
cmpl %esi, 0x34(%rsp)
jb 0x16935
movq 0x40(%rsp), %rax
addl %eax, %eax
cmpl %edi, %eax
movl $0x0, %eax
sbbl %eax, %eax
orl $0x1, %eax
addl %edi, %eax
movl $0x21, %ecx
leal -0x2(%rcx), %edx
decl %ecx
cmpl %eax, (%r15,%rdx,4)
ja 0x16891
movl %ecx, %eax
movl (%r15,%rax,4), %ebx
cvtsi2sd %rbx, %xmm0
mulsd 0x3991(%rip), %xmm0     # 0x1a240
addsd 0x3969(%rip), %xmm0     # 0x1a220
cvttsd2si %xmm0, %rax
cmpl %eax, 0x40(%rsp)
jae 0x16935
movq %rax, 0x38(%rsp)
movl %ebx, %eax
shrl $0x4, %eax
leaq 0x4(,%rax,4), %r14
movq %r14, %rdi
callq 0x33e0
movq %rax, %r13
movq %rax, %rdi
movl $0xaa, %esi
movq %r14, %rdx
callq 0x3260
movq 0x20(%rsp), %rdx
cmpl %ebx, %edx
jae 0x16944
leaq (,%rbx,8), %r14
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x3430
movq 0x10(%rsp), %r15
movq %rax, 0x8(%rsp)
movq %rax, 0x18(%r15)
movq 0x20(%r15), %rdi
movq %r14, %rsi
callq 0x3430
movq 0x20(%rsp), %rdx
movq %r15, %rcx
movq %rax, 0x20(%r15)
jmp 0x16949
movl %r12d, %ebx
movl %esi, %eax
movq %rax, 0x38(%rsp)
jmp 0x16b10
movq 0x10(%rsp), %rcx
testl %edx, %edx
movq 0x28(%rsp), %r14
je 0x16ad5
leal -0x1(%rbx), %edi
movq 0x10(%rcx), %r8
movl %edx, %r9d
xorl %r10d, %r10d
movl %r10d, %eax
shrl $0x4, %eax
movl (%r8,%rax,4), %edx
leal (%r10,%r10), %ecx
andl $0x1e, %ecx
movl %edx, %esi
shrl %cl, %esi
testb $0x3, %sil
jne 0x16a81
movq 0x8(%rsp), %rsi
movq (%rsi,%r10,8), %r14
movq 0x10(%rsp), %rsi
movq 0x20(%rsi), %r11
movq (%r11,%r10,8), %r15
btsl %ecx, %edx
movl %edx, (%r8,%rax,4)
movsbl (%r14), %ecx
testl %ecx, %ecx
je 0x169ca
movb 0x1(%r14), %al
testb %al, %al
je 0x169cc
leaq 0x2(%r14), %rdx
movl %ecx, %esi
shll $0x5, %esi
subl %ecx, %esi
movsbl %al, %ecx
addl %esi, %ecx
movb (%rdx), %al
incq %rdx
testb %al, %al
jne 0x169b3
jmp 0x169cc
xorl %ecx, %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %ebx
movl %edx, %esi
movl %ecx, %eax
xorl %edx, %edx
divl %edi
movl %esi, %eax
movl %esi, %ecx
addl %esi, %ecx
andl $0x1e, %ecx
movl $0x2, %r12d
shll %cl, %r12d
shrl $0x4, %eax
movl (%r13,%rax,4), %ebp
testl %ebp, %r12d
jne 0x16a25
incl %edx
addl %edx, %esi
xorl %eax, %eax
cmpl %ebx, %esi
jb 0x16a05
movl %ebx, %eax
subl %eax, %esi
movl %esi, %eax
shrl $0x4, %eax
movl (%r13,%rax,4), %ebp
leal (%rsi,%rsi), %ecx
andl $0x1e, %ecx
movl $0x2, %r12d
shll %cl, %r12d
testl %ebp, %r12d
je 0x169fb
notl %r12d
andl %ebp, %r12d
movl %r12d, (%r13,%rax,4)
movl %esi, %edx
cmpl 0x20(%rsp), %esi
jae 0x16a6f
movl (%r8,%rax,4), %esi
movl %esi, %ebp
shrl %cl, %ebp
testb $0x3, %bpl
jne 0x16a6f
movq 0x8(%rsp), %rbp
movq (%rbp,%rdx,8), %r12
movq %r14, (%rbp,%rdx,8)
movq (%r11,%rdx,8), %rbp
movq %r15, (%r11,%rdx,8)
btsl %ecx, %esi
movl %esi, (%r8,%rax,4)
movq %r12, %r14
movq %rbp, %r15
jmp 0x1699f
movq 0x8(%rsp), %rax
movq %r14, (%rax,%rdx,8)
movq %r15, (%r11,%rdx,8)
movq 0x28(%rsp), %r14
incq %r10
cmpq %r9, %r10
jne 0x16963
cmpl %ebx, 0x20(%rsp)
jbe 0x16ad0
leaq (,%rbx,8), %r14
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x3430
movq 0x10(%rsp), %r15
movq %rax, 0x8(%rsp)
movq %rax, 0x18(%r15)
movq 0x20(%r15), %rdi
movq %r14, %rsi
movq 0x28(%rsp), %r14
callq 0x3430
movq %r15, %rcx
movq %rax, 0x20(%r15)
jmp 0x16ad5
movq 0x10(%rsp), %rcx
movq 0x10(%rcx), %rdi
movq %rcx, %r15
callq 0x3060
movq %r13, 0x10(%r15)
movl %ebx, (%r15)
movq 0x40(%rsp), %rax
movl %eax, 0x8(%r15)
movq 0x38(%rsp), %rcx
movl %ecx, 0xc(%r15)
movl %eax, 0x34(%rsp)
movq 0x48(%rsp), %r8
movq 0x58(%rsp), %r9
xorl %r10d, %r10d
movq 0x50(%rsp), %r11
movq 0x18(%rsp), %rcx
movsbl (%rcx), %esi
testl %esi, %esi
je 0x16b3e
movb 0x1(%rcx), %al
testb %al, %al
je 0x16b40
addq $0x2, %rcx
movl %esi, %edx
shll $0x5, %edx
subl %esi, %edx
movsbl %al, %esi
addl %edx, %esi
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x16b27
jmp 0x16b40
xorl %esi, %esi
movl %esi, %eax
xorl %edx, %edx
divl %ebx
movl %edx, %edi
movl %edx, %eax
shrl $0x4, %eax
movl (%r13,%rax,4), %eax
leal (%rdi,%rdi), %ecx
shrl %cl, %eax
testb $0x2, %al
je 0x16b63
movl %edi, %r15d
jmp 0x16c24
leal -0x1(%rbx), %ecx
movl %esi, %eax
xorl %edx, %edx
divl %ecx
incl %edx
movl %edi, %r12d
movl %ebx, %r15d
movq %rdi, 0x20(%rsp)
movl %edx, 0x60(%rsp)
movl %r12d, %eax
shrl $0x4, %eax
movl (%r13,%rax,4), %ebp
leal (%r12,%r12), %r14d
andl $0x1e, %r14d
movl %ebp, %eax
movl %r14d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x16c00
testb $0x1, %al
jne 0x16bd4
movl %r12d, %eax
movq 0x8(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
movq 0x18(%rsp), %rsi
callq 0x3300
movl 0x60(%rsp), %edx
movq 0x20(%rsp), %rdi
movq 0x50(%rsp), %r11
xorl %r10d, %r10d
movq 0x58(%rsp), %r9
movq 0x48(%rsp), %r8
testl %eax, %eax
je 0x16c00
btl %r14d, %ebp
cmovbl %r12d, %r15d
addl %edx, %r12d
cmpl %ebx, %r12d
movl %ebx, %eax
cmovbl %r10d, %eax
subl %eax, %r12d
cmpl %edi, %r12d
jne 0x16b7d
movb $0x1, %al
movl %ebx, %ecx
cmpl %ebx, %r15d
movq 0x28(%rsp), %r14
je 0x16c17
jmp 0x16c24
movl %r14d, %ecx
shrl %cl, %ebp
testb $0x2, %bpl
sete %al
movl %r15d, %ecx
movl %r12d, %edi
movq 0x28(%rsp), %r14
cmpl %ebx, %ecx
cmovel %edi, %ecx
testb %al, %al
cmovnel %edi, %ecx
movl %ecx, %r15d
movl %r15d, %edx
shrl $0x4, %edx
movl (%r13,%rdx,4), %esi
leal (%r15,%r15), %ecx
andl $0x1e, %ecx
movl %esi, %edi
shrl %cl, %edi
movl %r15d, %eax
testb $0x2, %dil
jne 0x16c55
testb $0x1, %dil
movq 0x70(%rsp), %r15
jne 0x16c98
movq 0x10(%rsp), %rdx
jmp 0x16cc8
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %r15
movq %r15, (%rdi,%rax,8)
movl $0x3, %edi
shll %cl, %edi
notl %edi
andl %edi, %esi
movl %esi, (%r13,%rdx,4)
movq 0x10(%rsp), %rdx
movl 0x4(%rdx), %esi
movl 0x8(%rdx), %edi
incl %esi
movq %rsi, 0x40(%rsp)
movl %esi, 0x4(%rdx)
incl %edi
movl %edi, 0x34(%rsp)
movl %edi, 0x8(%rdx)
movq 0x70(%rsp), %r15
jmp 0x16cc8
movl $0x3, %edi
shll %cl, %edi
movq 0x8(%rsp), %rcx
movq 0x18(%rsp), %r12
movq %r12, (%rcx,%rax,8)
notl %edi
andl %edi, %esi
movl %esi, (%r13,%rdx,4)
movq 0x10(%rsp), %rdx
movl 0x4(%rdx), %esi
incl %esi
movq %rsi, 0x40(%rsp)
movl %esi, 0x4(%rdx)
movq 0x8(%r11), %rcx
movq 0x20(%rdx), %rdx
movq %rcx, (%rdx,%rax,8)
movq %r13, 0x60(%rsp)
movl %ebx, %edi
movq 0x38(%rsp), %rax
jmp 0x1672d
leaq 0x6208(%rip), %rdi      # 0x1cef4
movq 0x18(%rsp), %rsi
xorl %eax, %eax
callq 0x45d0
movq 0x20(%rsp), %rdi
movq 0x50(%rsp), %r11
xorl %r10d, %r10d
movq 0x58(%rsp), %r9
movq 0x48(%rsp), %r8
movq 0x8(%rbx), %rax
movq %rax, 0x18(%rsp)
jmp 0x16869
movq 0x10(%rsp), %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq