// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/header.c
// Function: sam_hrecs_remove_key
int sam_hrecs_remove_key(sam_hrecs_t *hrecs,
                         sam_hrec_type_t *type,
                         const char *key) {
    sam_hrec_tag_t *tag, *prev;
    if (!hrecs)
        return -1;
    tag = sam_hrecs_find_key(type, key, &prev);
    if (!tag)
        return 0; // Not there anyway

    if (type->type == TYPEKEY("SQ") && tag->str[0] == 'A' && tag->str[1] == 'N') {
        assert(tag->len >= 3);
        sam_hrec_tag_t *sn_tag = sam_hrecs_find_key(type, "SN", NULL);
        if (sn_tag) {
            assert(sn_tag->len >= 3);
            khint_t k = kh_get(m_s2i, hrecs->ref_hash, sn_tag->str + 3);
            if (k != kh_end(hrecs->ref_hash))
                sam_hrecs_remove_ref_altnames(hrecs, kh_val(hrecs->ref_hash, k), tag->str + 3);
        }
    }

    if (!prev) { //first tag
        type->tag = tag->next;
    } else {
        prev->next = tag->next;
    }
    pool_free(hrecs->tag_pool, tag);
    hrecs->dirty = 1; //mark text as dirty and force a rebuild

    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xdd6f7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xdd882
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0xdaf50
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xdd71f
movl $0x0, -0x4(%rbp)
jmp 0xdd882
movq -0x18(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, -0x40(%rbp)
leaq 0x14fbc(%rip), %rdi     # 0xf26ec
callq 0xdabd0
movl %eax, %ecx
movl -0x40(%rbp), %eax
cmpl %ecx, %eax
jne 0xdd836
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x41, %eax
jne 0xdd836
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x4e, %eax
jne 0xdd836
movq -0x28(%rbp), %rax
cmpl $0x3, 0x10(%rax)
jl 0xdd777
jmp 0xdd796
leaq 0x1b1d3(%rip), %rdi     # 0xf8951
leaq 0x1a9c2(%rip), %rsi     # 0xf8147
movl $0xa78, %edx            # imm = 0xA78
leaq 0x1ac12(%rip), %rcx     # 0xf83a3
callq 0x42e0
movq -0x18(%rbp), %rdi
leaq 0x161bc(%rip), %rsi     # 0xf395d
xorl %eax, %eax
movl %eax, %edx
callq 0xdaf50
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0xdd834
movq -0x38(%rbp), %rax
cmpl $0x3, 0x10(%rax)
jl 0xdd7c1
jmp 0xdd7e0
leaq 0x1ac24(%rip), %rdi     # 0xf83ec
leaq 0x1a978(%rip), %rsi     # 0xf8147
movl $0xa7b, %edx            # imm = 0xA7B
leaq 0x1abc8(%rip), %rcx     # 0xf83a3
callq 0x42e0
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x3, %rsi
callq 0xdae00
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x38(%rcx), %rcx
cmpl (%rcx), %eax
je 0xdd832
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x20(%rax), %rax
movl -0x3c(%rbp), %ecx
movl (%rax,%rcx,4), %esi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdx
addq $0x3, %rdx
callq 0xde660
jmp 0xdd834
jmp 0xdd836
cmpq $0x0, -0x30(%rbp)
jne 0xdd84e
movq -0x28(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0xdd85c
movq -0x28(%rbp), %rax
movq (%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x822f0
movq -0x10(%rbp), %rax
movl $0x1, 0x90(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)