// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/vcf.c
// Function: bcf_hdr_get_hrec
bcf_hrec_t *bcf_hdr_get_hrec(const bcf_hdr_t *hdr, int type, const char *key, const char *value, const char *str_class)
{
    int i;
    if ( type==BCF_HL_GEN )
    {
        // e.g. ##fileformat=VCFv4.2
        //      ##source=GenomicsDBImport
        //      ##bcftools_viewVersion=1.16-80-gdfdb0923+htslib-1.16-34-g215d364
        if ( value )
        {
            kstring_t str = {0,0,0};
            ksprintf(&str, "##%s=%s", key,value);
            bcf_hdr_aux_t *aux = get_hdr_aux(hdr);
            khint_t k = kh_get(hdict, aux->gen, str.s);
            free(str.s);
            if ( k == kh_end(aux->gen) ) return NULL;
            return kh_val(aux->gen, k);
        }
        for (i=0; i<hdr->nhrec; i++)
        {
            if ( hdr->hrec[i]->type!=type ) continue;
            if ( strcmp(hdr->hrec[i]->key,key) ) continue;
            return hdr->hrec[i];
        }
        return NULL;
    }
    else if ( type==BCF_HL_STR )
    {
        // e.g. ##GATKCommandLine=<ID=GenomicsDBImport,CommandLine="GenomicsDBImport....">
        //      ##ALT=<ID=NON_REF,Description="Represents any possible alternative allele not already represented at this location by REF and ALT">
        if (!str_class) return NULL;
        if ( !strcmp("ID",key) )
        {
            kstring_t str = {0,0,0};
            ksprintf(&str, "##%s=<%s=%s>",str_class,key,value);
            bcf_hdr_aux_t *aux = get_hdr_aux(hdr);
            khint_t k = kh_get(hdict, aux->gen, str.s);
            free(str.s);
            if ( k == kh_end(aux->gen) ) return NULL;
            return kh_val(aux->gen, k);
        }
        for (i=0; i<hdr->nhrec; i++)
        {
            if ( hdr->hrec[i]->type!=type ) continue;
            if ( strcmp(hdr->hrec[i]->key,str_class) ) continue;
            int j = bcf_hrec_find_key(hdr->hrec[i],key);
            if ( j>=0 && !strcmp(hdr->hrec[i]->vals[j],value) ) return hdr->hrec[i];
        }
        return NULL;
    }
    vdict_t *d = type==BCF_HL_CTG ? (vdict_t*)hdr->dict[BCF_DT_CTG] : (vdict_t*)hdr->dict[BCF_DT_ID];
    khint_t k = kh_get(vdict, d, value);
    if ( k == kh_end(d) ) return NULL;
    return kh_val(d, k).hrec[type==BCF_HL_CTG?0:type];
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %r12
movq %rcx, %r8
movq %rdx, %r15
movq %rdi, %r14
cmpl $0x4, %esi
je 0x2cf0d
cmpl $0x5, %esi
jne 0x2cfa3
testq %r8, %r8
je 0x2cff9
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r12
movaps %xmm0, (%r12)
movq $0x0, 0x10(%r12)
leaq 0x7e89f(%rip), %rsi     # 0xab742
xorl %ebx, %ebx
movq %r12, %rdi
movq %r15, %rdx
movq %r8, %rcx
xorl %eax, %eax
callq 0x89557
movq 0x28(%r14), %r14
movq 0x28(%r14), %rax
movq 0x10(%r12), %rdx
movq %rax, 0x8(%rsp)
movl (%rax), %eax
testl %eax, %eax
je 0x2d2b8
movq %r14, 0x18(%rsp)
movq %rax, 0x10(%rsp)
leal -0x1(%rax), %esi
movb (%rdx), %cl
testb %cl, %cl
je 0x2d18b
leaq 0x1(%rdx), %rax
movl $0x811c9dc5, %r14d      # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %r14d, %ecx
imull $0x1000193, %ecx, %r14d # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x2cef2
jmp 0x2d191
testq %r12, %r12
je 0x2d2c8
movzbl (%r15), %eax
subl $0x49, %eax
jne 0x2cf2e
movzbl 0x1(%r15), %eax
subl $0x44, %eax
jne 0x2cf2e
movzbl 0x2(%r15), %eax
negl %eax
testl %eax, %eax
je 0x2d040
movslq 0x50(%r14), %rbx
testq %rbx, %rbx
jle 0x2d2c8
movq %r8, 0x20(%rsp)
movq 0x48(%r14), %r13
xorl %ebp, %ebp
movq (%r13,%rbp,8), %r14
cmpl $0x4, (%r14)
jne 0x2cf96
movq 0x8(%r14), %rdi
movq %r12, %rsi
callq 0x46e0
testl %eax, %eax
jne 0x2cf96
movq %r14, %rdi
movq %r15, %rsi
callq 0x2b32b
testl %eax, %eax
js 0x2cf96
movq 0x28(%r14), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %rdi
movq 0x20(%rsp), %rsi
callq 0x46e0
testl %eax, %eax
je 0x2d2d7
incq %rbp
cmpq %rbp, %rbx
jne 0x2cf50
jmp 0x2d2c8
xorl %eax, %eax
cmpl $0x3, %esi
sete %al
movq 0x28(%r14,%rax,8), %rax
movq %rax, 0x8(%rsp)
movl (%rax), %eax
testl %eax, %eax
je 0x2d038
movl %esi, 0x18(%rsp)
movq %rax, 0x10(%rsp)
leal -0x1(%rax), %edx
movb (%r8), %cl
testb %cl, %cl
movq %r8, 0x20(%rsp)
je 0x2d0c5
leaq 0x1(%r8), %rax
movl $0x811c9dc5, %ebx       # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %ebx, %ecx
imull $0x1000193, %ecx, %ebx  # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x2cfe0
jmp 0x2d0ca
movslq 0x50(%r14), %rbx
testq %rbx, %rbx
jle 0x2d2c8
movq 0x48(%r14), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %r14
cmpl $0x5, (%r14)
jne 0x2d02b
movq 0x8(%r14), %rdi
movq %r15, %rsi
callq 0x46e0
testl %eax, %eax
je 0x2d2d7
incq %r13
cmpq %r13, %rbx
jne 0x2d00d
jmp 0x2d2c8
xorl %r12d, %r12d
jmp 0x2d15b
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r13
movaps %xmm0, (%r13)
movq $0x0, 0x10(%r13)
leaq 0x7e706(%rip), %rsi     # 0xab762
xorl %ebx, %ebx
movq %r13, %rdi
movq %r12, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x89557
movq 0x28(%r14), %r14
movq 0x28(%r14), %rax
movq 0x10(%r13), %rdx
movq %rax, 0x8(%rsp)
movl (%rax), %eax
testl %eax, %eax
je 0x2d2b8
movq %r14, 0x18(%rsp)
movq %rax, 0x10(%rsp)
leal -0x1(%rax), %esi
movb (%rdx), %cl
testb %cl, %cl
je 0x2d21b
leaq 0x1(%rdx), %rax
movl $0x811c9dc5, %r14d      # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %r14d, %ecx
imull $0x1000193, %ecx, %r14d # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x2d0aa
jmp 0x2d221
movl $0x811c9dc5, %ebx       # imm = 0x811C9DC5
andl %edx, %ebx
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rsi
movl $0x1, %r13d
xorl %r14d, %r14d
movl %ebx, %r12d
movq %rsi, 0x28(%rsp)
movl %r12d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %ebp
leal (%r12,%r12), %r15d
andl $0x1e, %r15d
movl %ebp, %eax
movl %r15d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x2d145
testb $0x1, %al
jne 0x2d132
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movl %r12d, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x20(%rsp), %rsi
movl %edx, %r14d
callq 0x46e0
movq 0x28(%rsp), %rsi
movl %r14d, %edx
xorl %r14d, %r14d
testl %eax, %eax
je 0x2d145
addl %r13d, %r12d
andl %edx, %r12d
incl %r13d
cmpl %ebx, %r12d
jne 0x2d0e6
jmp 0x2d2d7
movl %r15d, %ecx
shrl %cl, %ebp
testb $0x3, %bpl
movq 0x10(%rsp), %rax
cmovnel %eax, %r12d
movl 0x18(%rsp), %esi
xorl %r14d, %r14d
cmpl %eax, %r12d
je 0x2d2d7
cmpl $0x3, %esi
movl %r12d, %eax
cmovnel %esi, %r14d
movslq %r14d, %rcx
imulq $0x38, %rax, %rax
movq 0x8(%rsp), %rdx
addq 0x20(%rdx), %rax
movq 0x18(%rax,%rcx,8), %r14
jmp 0x2d2d7
movl $0x811c9dc5, %r14d      # imm = 0x811C9DC5
andl %esi, %r14d
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rdi
movl $0x1, %r13d
movl %r14d, %r15d
movl %esi, 0x20(%rsp)
movq %rdi, 0x28(%rsp)
movl %r15d, %eax
shrl $0x4, %eax
movl (%rdi,%rax,4), %r12d
leal (%r15,%r15), %ebp
andl $0x1e, %ebp
movl %r12d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x2d20d
testb $0x1, %al
jne 0x2d1fa
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rdi
movq %rdx, %rbx
movq %rdx, %rsi
callq 0x46e0
movq 0x28(%rsp), %rdi
movl 0x20(%rsp), %esi
movq %rbx, %rdx
testl %eax, %eax
je 0x2d20d
addl %r13d, %r15d
andl %esi, %r15d
incl %r13d
cmpl %r14d, %r15d
jne 0x2d1af
jmp 0x2d298
movl %ebp, %ecx
shrl %cl, %r12d
testb $0x3, %r12b
jmp 0x2d2a8
movl $0x811c9dc5, %r14d      # imm = 0x811C9DC5
andl %esi, %r14d
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rdi
movl $0x1, %r12d
movl %r14d, %r15d
movl %esi, 0x20(%rsp)
movq %rdi, 0x28(%rsp)
movl %r15d, %eax
shrl $0x4, %eax
movl (%rdi,%rax,4), %r13d
leal (%r15,%r15), %ebp
andl $0x1e, %ebp
movl %r13d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x2d29f
testb $0x1, %al
jne 0x2d28a
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rdi
movq %rdx, %rbx
movq %rdx, %rsi
callq 0x46e0
movq 0x28(%rsp), %rdi
movl 0x20(%rsp), %esi
movq %rbx, %rdx
testl %eax, %eax
je 0x2d29f
addl %r12d, %r15d
andl %esi, %r15d
incl %r12d
cmpl %r14d, %r15d
jne 0x2d23f
movq 0x10(%rsp), %rax
jmp 0x2d2b1
movl %ebp, %ecx
shrl %cl, %r13d
testb $0x3, %r13b
movq 0x10(%rsp), %rax
cmovel %r15d, %eax
movl %eax, %ebx
movq 0x18(%rsp), %r14
movq %rdx, %rdi
callq 0x45c0
movq 0x28(%r14), %rax
cmpl (%rax), %ebx
jne 0x2d2cd
xorl %r14d, %r14d
jmp 0x2d2d7
movq 0x20(%rax), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %r14
movq %r14, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq