// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/header.c
// Function: sam_hdr_line_index
int sam_hdr_line_index(sam_hdr_t *bh,
                       const char *type,
                       const char *key) {
    sam_hrecs_t *hrecs;
    if (!bh || !type || !key)
        return -2;

    if (!(hrecs = bh->hrecs)) {
        if (sam_hdr_fill_hrecs(bh) != 0)
            return -2;
        hrecs = bh->hrecs;
    }

    khint_t k;
    int idx = -1;
    switch (type[0]) {
    case 'S':
        if (type[1] == 'Q') {
            k = kh_get(m_s2i, hrecs->ref_hash, key);
            if (k != kh_end(hrecs->ref_hash))
                idx = kh_val(hrecs->ref_hash, k);
        } else {
            hts_log_warning("Type '%s' not supported. Only @SQ, @RG and @PG lines are indexed", type);
        }
        break;
    case 'R':
        if (type[1] == 'G') {
            k = kh_get(m_s2i, hrecs->rg_hash, key);
            if (k != kh_end(hrecs->rg_hash))
                idx = kh_val(hrecs->rg_hash, k);
        } else {
            hts_log_warning("Type '%s' not supported. Only @SQ, @RG and @PG lines are indexed", type);
        }
        break;
    case 'P':
        if (type[1] == 'G') {
            k = kh_get(m_s2i, hrecs->pg_hash, key);
            if (k != kh_end(hrecs->pg_hash))
                idx = kh_val(hrecs->pg_hash, k);
        } else {
            hts_log_warning("Type '%s' not supported. Only @SQ, @RG and @PG lines are indexed", type);
        }
        break;
    default:
        hts_log_warning("Type '%s' not supported. Only @SQ, @RG and @PG lines are indexed", type);
    }

    return idx;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
movq %rdx, 0x10(%rsp)
testq %rdx, %rdx
sete %al
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
orb %cl, %al
jne 0x88b2b
movq %rsi, %r14
movq %rdi, %r15
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0x88a3c
movzbl (%r14), %ecx
cmpl $0x50, %ecx
je 0x88ab3
cmpl $0x52, %ecx
je 0x88a55
cmpl $0x53, %ecx
jne 0x88b09
cmpb $0x51, 0x1(%r14)
jne 0x88b09
movq 0x38(%rax), %rax
movq %rax, 0x8(%rsp)
movl (%rax), %eax
testl %eax, %eax
je 0x88b3c
movq %rax, 0x18(%rsp)
leal -0x1(%rax), %ebx
movq 0x10(%rsp), %rax
movb (%rax), %cl
testb %cl, %cl
je 0x88c48
movq 0x10(%rsp), %rax
incq %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 0x88a21
jmp 0x88c4e
movq %r15, %rdi
callq 0x8413e
testl %eax, %eax
jne 0x88b2b
movq 0x38(%r15), %rax
jmp 0x889bf
cmpb $0x47, 0x1(%r14)
jne 0x88b09
movq 0x50(%rax), %rax
movq %rax, 0x8(%rsp)
movl (%rax), %eax
testl %eax, %eax
je 0x88b3c
movq %rax, 0x18(%rsp)
leal -0x1(%rax), %ebx
movq 0x10(%rsp), %rax
movb (%rax), %cl
testb %cl, %cl
je 0x88b44
movq 0x10(%rsp), %rax
incq %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 0x88a98
jmp 0x88b4a
cmpb $0x47, 0x1(%r14)
jne 0x88b09
movq 0x70(%rax), %rax
movq %rax, 0x8(%rsp)
movl (%rax), %eax
testl %eax, %eax
je 0x88b3c
movq %rax, 0x18(%rsp)
leal -0x1(%rax), %esi
movq 0x10(%rsp), %rax
movb (%rax), %cl
testb %cl, %cl
je 0x88bc7
movq 0x10(%rsp), %rax
incq %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 0x88aee
jmp 0x88bcd
leaq 0x1946f(%rip), %rsi     # 0xa1f7f
leaq 0x1947b(%rip), %rdx     # 0xa1f92
movl $0x3, %edi
movq %r14, %rcx
xorl %eax, %eax
callq 0x13de5
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
jmp 0x88cd5
movl $0x811c9dc5, %r13d      # imm = 0x811C9DC5
andl %ebx, %r13d
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rsi
movl $0x1, %r12d
movl %r13d, %r15d
movq %rsi, 0x20(%rsp)
movl %r15d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %r14d
leal (%r15,%r15), %ebp
andl $0x1e, %ebp
movl %r14d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x88cc3
testb $0x1, %al
jne 0x88baf
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x10(%rsp), %rsi
callq 0x46c0
movq 0x20(%rsp), %rsi
testl %eax, %eax
je 0x88cc3
addl %r12d, %r15d
andl %ebx, %r15d
incl %r12d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl %r13d, %r15d
jne 0x88b64
jmp 0x88b2b
movl $0x811c9dc5, %r13d      # imm = 0x811C9DC5
andl %esi, %r13d
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rbx
movl $0x1, %r12d
movl %r13d, %r15d
movl %esi, 0x20(%rsp)
movl %r15d, %eax
shrl $0x4, %eax
movl (%rbx,%rax,4), %r14d
leal (%r15,%r15), %ebp
andl $0x1e, %ebp
movl %r14d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x88cc3
testb $0x1, %al
jne 0x88c30
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x10(%rsp), %rsi
callq 0x46c0
movl 0x20(%rsp), %esi
testl %eax, %eax
je 0x88cc3
addl %r12d, %r15d
andl %esi, %r15d
incl %r12d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl %r13d, %r15d
jne 0x88be6
jmp 0x88b2b
movl $0x811c9dc5, %r13d      # imm = 0x811C9DC5
andl %ebx, %r13d
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rsi
movl $0x1, %r12d
movl %r13d, %r15d
movq %rsi, 0x20(%rsp)
movl %r15d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %r14d
leal (%r15,%r15), %ebp
andl $0x1e, %ebp
movl %r14d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x88cc3
testb $0x1, %al
jne 0x88cab
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x10(%rsp), %rsi
callq 0x46c0
movq 0x20(%rsp), %rsi
testl %eax, %eax
je 0x88cc3
addl %r12d, %r15d
andl %ebx, %r15d
incl %r12d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl %r13d, %r15d
jne 0x88c68
jmp 0x88b2b
movl %ebp, %ecx
shrl %cl, %r14d
testb $0x3, %r14b
movq 0x18(%rsp), %rax
cmovnel %eax, %r15d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl %eax, %r15d
je 0x88b2b
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rax
movl %r15d, %ecx
movl (%rax,%rcx,4), %ebp
jmp 0x88b2b