// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/vcf.c
// Function: bcf_hdr_remove_from_hdict
static void bcf_hdr_remove_from_hdict(bcf_hdr_t *hdr, bcf_hrec_t *hrec)
{
    kstring_t str = KS_INITIALIZE;
    bcf_hdr_aux_t *aux = get_hdr_aux(hdr);
    khint_t k;
    int id;

    switch (hrec->type) {
    case BCF_HL_GEN:
        if (ksprintf(&str, "##%s=%s", hrec->key,hrec->value) < 0)
            str.l = 0;
        break;
    case BCF_HL_STR:
        id = bcf_hrec_find_key(hrec, "ID");
        if (id < 0)
            return;
        if (!hrec->vals[id] ||
            ksprintf(&str, "##%s=<ID=%s>", hrec->key, hrec->vals[id]) < 0)
            str.l = 0;
        break;
    default:
        return;
    }
    if (str.l) {
        k = kh_get(hdict, aux->gen, str.s);
    } else {
        // Couldn't get a string for some reason, so try the hard way...
        for (k = kh_begin(aux->gen); k < kh_end(aux->gen); k++) {
            if (kh_exist(aux->gen, k) && kh_val(aux->gen, k) == hrec)
                break;
        }
    }
    if (k != kh_end(aux->gen) && kh_val(aux->gen, k) == hrec) {
        kh_val(aux->gen, k) = NULL;
        free((char *) kh_key(aux->gen, k));
        kh_key(aux->gen, k) = NULL;
        kh_del(hdict, aux->gen, k);
    }
    free(str.s);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r15
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x28(%rdi), %r12
movl (%rsi), %eax
cmpl $0x4, %eax
je 0x2ecd3
cmpl $0x5, %eax
jne 0x2eee3
movq 0x8(%r15), %rdx
movq 0x10(%r15), %rcx
leaq 0x7fac1(%rip), %rsi     # 0xae792
jmp 0x2ed04
leaq 0x7e07d(%rip), %rsi     # 0xacd57
movq %r15, %rdi
callq 0x2c40b
testl %eax, %eax
js 0x2eee3
movq 0x28(%r15), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %rcx
testq %rcx, %rcx
je 0x2ed14
movq 0x8(%r15), %rdx
leaq 0x7faa1(%rip), %rsi     # 0xae7a5
leaq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0x8b533
testl %eax, %eax
jns 0x2ed1d
movq $0x0, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
movq 0x28(%r12), %r8
je 0x2ed75
movl (%r8), %eax
testl %eax, %eax
je 0x2edbd
movq %r15, 0x38(%rsp)
movq 0x20(%rsp), %r14
leal -0x1(%rax), %edx
movb (%r14), %cl
testb %cl, %cl
movq %r12, 0x40(%rsp)
movq %rax, 0x30(%rsp)
je 0x2edc5
leaq 0x1(%r14), %rax
movl $0x811c9dc5, %r15d      # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %r15d, %ecx
imull $0x1000193, %ecx, %r15d # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x2ed5d
jmp 0x2edcb
movl (%r8), %eax
testq %rax, %rax
je 0x2edbd
movq 0x10(%r8), %rdx
xorl %esi, %esi
xorl %r14d, %r14d
movl %r14d, %ecx
shrl $0x4, %ecx
movl (%rdx,%rcx,4), %edi
movl %esi, %ecx
andb $0x1e, %cl
shrl %cl, %edi
testb $0x3, %dil
jne 0x2edaa
movq 0x20(%r8), %rcx
cmpq %r15, (%rcx,%r14,8)
je 0x2ee65
incq %r14
addl $0x2, %esi
cmpq %r14, %rax
jne 0x2ed86
movl %eax, %r14d
jmp 0x2ee65
xorl %r14d, %r14d
jmp 0x2ee65
movl $0x811c9dc5, %r15d      # imm = 0x811C9DC5
andl %edx, %r15d
movq 0x10(%r8), %rsi
movl $0x1, %r12d
movl %r15d, %ebx
movq %r8, 0x50(%rsp)
movl %edx, 0xc(%rsp)
movq %rsi, 0x48(%rsp)
movl %ebx, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %r13d
leal (%rbx,%rbx), %ebp
andl $0x1e, %ebp
movl %r13d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x2ee49
testb $0x1, %al
jne 0x2ee2b
movq 0x18(%r8), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rdi
movq %r14, %rsi
callq 0x46e0
movq 0x48(%rsp), %rsi
movl 0xc(%rsp), %edx
movq 0x50(%rsp), %r8
testl %eax, %eax
je 0x2ee49
addl %r12d, %ebx
andl %edx, %ebx
incl %r12d
cmpl %r15d, %ebx
jne 0x2ede9
movq 0x40(%rsp), %r12
movq 0x38(%rsp), %r15
movq 0x30(%rsp), %r14
jmp 0x2ee65
movl %ebp, %ecx
shrl %cl, %r13d
testb $0x3, %r13b
movq 0x30(%rsp), %r14
cmovel %ebx, %r14d
movq 0x40(%rsp), %r12
movq 0x38(%rsp), %r15
movq 0x28(%r12), %rax
cmpl (%rax), %r14d
je 0x2eed9
movq 0x20(%rax), %rax
movl %r14d, %ebx
cmpq %r15, (%rax,%rbx,8)
jne 0x2eed9
xorl %r15d, %r15d
movq %r15, (%rax,%rbx,8)
movq 0x28(%r12), %rax
movq 0x18(%rax), %rax
movq (%rax,%rbx,8), %rdi
callq 0x45c0
movq 0x28(%r12), %rax
movq 0x18(%rax), %rax
movq %r15, (%rax,%rbx,8)
movq 0x28(%r12), %rax
cmpl %r14d, (%rax)
je 0x2eed9
movq 0x10(%rax), %rdx
movl %r14d, %esi
shrl $0x4, %esi
movl (%rdx,%rsi,4), %edi
addl %r14d, %r14d
andl $0x1e, %r14d
movl %edi, %r8d
movl %r14d, %ecx
shrl %cl, %r8d
testb $0x3, %r8b
jne 0x2eed9
btsl %r14d, %edi
movl %edi, (%rdx,%rsi,4)
decl 0x4(%rax)
movq 0x20(%rsp), %rdi
callq 0x45c0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq