// File: /workspace/github_c_makefile_star2_O1/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, %r14
movq %rdi, %r15
cmpl $0x4, %esi
je 0x2e0ac
cmpl $0x5, %esi
jne 0x2e14c
testq %r8, %r8
je 0x2e1a1
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r12
movaps %xmm0, (%r12)
movq $0x0, 0x10(%r12)
leaq 0x80750(%rip), %rsi     # 0xae792
xorl %ebx, %ebx
movq %r12, %rdi
movq %r14, %rdx
movq %r8, %rcx
xorl %eax, %eax
callq 0x8b533
movq 0x28(%r15), %r14
movq 0x28(%r14), %rax
movq 0x10(%r12), %rdx
movq %rax, 0x8(%rsp)
movl (%rax), %eax
testl %eax, %eax
je 0x2e464
movq %r14, 0x20(%rsp)
movq %rax, 0x18(%rsp)
leal -0x1(%rax), %esi
movb (%rdx), %cl
testb %cl, %cl
je 0x2e337
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 0x2e091
jmp 0x2e33d
testq %r12, %r12
je 0x2e474
movq %r8, 0x8(%rsp)
leaq 0x7ec96(%rip), %rdi     # 0xacd57
movq %r14, %rsi
callq 0x46e0
testl %eax, %eax
je 0x2e1ea
movslq 0x50(%r15), %rbp
testq %rbp, %rbp
jle 0x2e474
movq %r14, 0x10(%rsp)
movq 0x48(%r15), %rbx
xorl %r14d, %r14d
movq (%rbx,%r14,8), %r13
cmpl $0x4, (%r13)
jne 0x2e13f
movq 0x8(%r13), %rdi
movq %r12, %rsi
callq 0x46e0
testl %eax, %eax
jne 0x2e13f
movq %r13, %rdi
movq 0x10(%rsp), %rsi
callq 0x2c40b
testl %eax, %eax
js 0x2e12e
movq 0x28(%r13), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %rdi
movq 0x8(%rsp), %rsi
callq 0x46e0
testl %eax, %eax
je 0x2e132
movb $0x1, %al
jmp 0x2e137
xorl %eax, %eax
movq %r13, %r15
testb %al, %al
je 0x2e483
incq %r14
cmpq %r14, %rbp
jne 0x2e0ea
jmp 0x2e474
xorl %eax, %eax
cmpl $0x3, %esi
sete %al
movq 0x28(%r15,%rax,8), %rax
movq %rax, 0x10(%rsp)
movl (%rax), %eax
testl %eax, %eax
je 0x2e1e3
movl %esi, 0x20(%rsp)
movq %rax, 0x18(%rsp)
leal -0x1(%rax), %r12d
movb (%r8), %cl
testb %cl, %cl
je 0x2e274
leaq 0x1(%r8), %rax
movl $0x811c9dc5, %r13d      # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %r13d, %ecx
imull $0x1000193, %ecx, %r13d # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x2e186
jmp 0x2e27a
movslq 0x50(%r15), %rbx
testq %rbx, %rbx
jle 0x2e474
movq %r14, %r13
movq 0x48(%r15), %r14
xorl %r12d, %r12d
movq (%r14,%r12,8), %r15
cmpl $0x5, (%r15)
jne 0x2e1d6
movq 0x8(%r15), %rdi
movq %r13, %rsi
callq 0x46e0
testl %eax, %eax
je 0x2e483
incq %r12
cmpq %r12, %rbx
jne 0x2e1b8
jmp 0x2e474
xorl %ebx, %ebx
jmp 0x2e309
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r13
movaps %xmm0, (%r13)
movq $0x0, 0x10(%r13)
leaq 0x805ac(%rip), %rsi     # 0xae7b2
xorl %ebx, %ebx
movq %r13, %rdi
movq %r12, %rdx
movq %r14, %rcx
movq 0x8(%rsp), %r8
xorl %eax, %eax
callq 0x8b533
movq 0x28(%r15), %r14
movq 0x28(%r14), %rax
movq 0x10(%r13), %rdx
movq %rax, 0x8(%rsp)
movl (%rax), %eax
testl %eax, %eax
je 0x2e464
movq %r14, 0x20(%rsp)
movq %rax, 0x18(%rsp)
leal -0x1(%rax), %esi
movb (%rdx), %cl
testb %cl, %cl
je 0x2e3c7
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 0x2e259
jmp 0x2e3cd
movl $0x811c9dc5, %r13d      # imm = 0x811C9DC5
andl %r12d, %r13d
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rsi
movl $0x1, %ebp
movl %r13d, %ebx
movq %r8, 0x8(%rsp)
movq %rsi, 0x28(%rsp)
movl %ebx, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %r15d
leal (%rbx,%rbx), %r14d
andl $0x1e, %r14d
movl %r15d, %eax
movl %r14d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x2e2f3
testb $0x1, %al
jne 0x2e2de
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rdi
movq %r8, %rsi
callq 0x46e0
movq 0x28(%rsp), %rsi
movq 0x8(%rsp), %r8
testl %eax, %eax
je 0x2e2f3
addl %ebp, %ebx
andl %r12d, %ebx
incl %ebp
cmpl %r13d, %ebx
jne 0x2e298
movq 0x18(%rsp), %rax
movl %eax, %ebx
jmp 0x2e305
movl %r14d, %ecx
shrl %cl, %r15d
testb $0x3, %r15b
movq 0x18(%rsp), %rax
cmovnel %eax, %ebx
movl 0x20(%rsp), %esi
xorl %r15d, %r15d
cmpl %eax, %ebx
je 0x2e483
cmpl $0x3, %esi
movl %ebx, %eax
cmovnel %esi, %r15d
movslq %r15d, %rcx
imulq $0x38, %rax, %rax
movq 0x10(%rsp), %rdx
addq 0x20(%rdx), %rax
movq 0x18(%rax,%rcx,8), %r15
jmp 0x2e483
movl $0x811c9dc5, %r14d      # imm = 0x811C9DC5
andl %esi, %r14d
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rdi
movl $0x1, %r13d
movl %r14d, %r15d
movl %esi, 0x10(%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 0x2e3b9
testb $0x1, %al
jne 0x2e3a6
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 0x10(%rsp), %esi
movq %rbx, %rdx
testl %eax, %eax
je 0x2e3b9
addl %r13d, %r15d
andl %esi, %r15d
incl %r13d
cmpl %r14d, %r15d
jne 0x2e35b
jmp 0x2e444
movl %ebp, %ecx
shrl %cl, %r12d
testb $0x3, %r12b
jmp 0x2e454
movl $0x811c9dc5, %r14d      # imm = 0x811C9DC5
andl %esi, %r14d
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rdi
movl $0x1, %r12d
movl %r14d, %r15d
movl %esi, 0x10(%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 0x2e44b
testb $0x1, %al
jne 0x2e436
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 0x10(%rsp), %esi
movq %rbx, %rdx
testl %eax, %eax
je 0x2e44b
addl %r12d, %r15d
andl %esi, %r15d
incl %r12d
cmpl %r14d, %r15d
jne 0x2e3eb
movq 0x18(%rsp), %rax
jmp 0x2e45d
movl %ebp, %ecx
shrl %cl, %r13d
testb $0x3, %r13b
movq 0x18(%rsp), %rax
cmovel %r15d, %eax
movl %eax, %ebx
movq 0x20(%rsp), %r14
movq %rdx, %rdi
callq 0x45c0
movq 0x28(%r14), %rax
cmpl (%rax), %ebx
jne 0x2e479
xorl %r15d, %r15d
jmp 0x2e483
movq 0x20(%rax), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %r15
movq %r15, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq