// File: /workspace/github_c_makefile_star2_O1/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 0x8b548
movq %rsi, %r14
movq %rdi, %r15
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0x8b2af
movzbl (%r14), %ecx
cmpl $0x50, %ecx
je 0x8b326
cmpl $0x52, %ecx
je 0x8b2c8
cmpl $0x53, %ecx
jne 0x8b37c
cmpb $0x51, 0x1(%r14)
jne 0x8b37c
movq 0x38(%rax), %rax
movq %rax, 0x8(%rsp)
movl (%rax), %eax
testl %eax, %eax
je 0x8b3a3
movq %rax, 0x18(%rsp)
leal -0x1(%rax), %ebx
movq 0x10(%rsp), %rax
movb (%rax), %cl
testb %cl, %cl
je 0x8b4a2
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 0x8b294
jmp 0x8b4a8
movq %r15, %rdi
callq 0x866a8
testl %eax, %eax
jne 0x8b548
movq 0x38(%r15), %rax
jmp 0x8b232
cmpb $0x47, 0x1(%r14)
jne 0x8b37c
movq 0x50(%rax), %rax
movq %rax, 0x8(%rsp)
movl (%rax), %eax
testl %eax, %eax
je 0x8b3a3
movq %rax, 0x18(%rsp)
leal -0x1(%rax), %ebx
movq 0x10(%rsp), %rax
movb (%rax), %cl
testb %cl, %cl
je 0x8b3ab
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 0x8b30b
jmp 0x8b3b1
cmpb $0x47, 0x1(%r14)
jne 0x8b37c
movq 0x70(%rax), %rax
movq %rax, 0x8(%rsp)
movl (%rax), %eax
testl %eax, %eax
je 0x8b3a3
movq %rax, 0x18(%rsp)
leal -0x1(%rax), %esi
movq 0x10(%rsp), %rax
movb (%rax), %cl
testb %cl, %cl
je 0x8b429
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 0x8b361
jmp 0x8b42f
leaq 0x1947d(%rip), %rsi     # 0xa4800
leaq 0x19489(%rip), %rdx     # 0xa4813
movl $0x3, %edi
movq %r14, %rcx
xorl %eax, %eax
callq 0x14378
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x8b548
xorl %r15d, %r15d
jmp 0x8b52f
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 0x8b51d
testb $0x1, %al
jne 0x8b416
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 0x8b51d
addl %r12d, %r15d
andl %ebx, %r15d
incl %r12d
cmpl %r13d, %r15d
jne 0x8b3cb
jmp 0x8b513
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 0x8b51d
testb $0x1, %al
jne 0x8b492
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 0x8b51d
addl %r12d, %r15d
andl %esi, %r15d
incl %r12d
cmpl %r13d, %r15d
jne 0x8b448
jmp 0x8b513
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 0x8b51d
testb $0x1, %al
jne 0x8b505
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 0x8b51d
addl %r12d, %r15d
andl %ebx, %r15d
incl %r12d
cmpl %r13d, %r15d
jne 0x8b4c2
movq 0x18(%rsp), %rax
movl %eax, %r15d
jmp 0x8b52f
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 0x8b548
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rax
movl %r15d, %ecx
movl (%rax,%rcx,4), %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq