// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/header.c
// Function: sam_hrecs_remove_line
static int sam_hrecs_remove_line(sam_hrecs_t *hrecs, const char *type_name, sam_hrec_type_t *type_found, int remove_hash) {
    if (!hrecs || !type_name || !type_found)
        return -1;

    khint32_t itype = TYPEKEY(type_name);
    khint_t k = kh_get(sam_hrecs_t, hrecs->h, itype);
    if (k == kh_end(hrecs->h))
        return -1;

    // Remove from global list (remembering it could be the only line)
    if (hrecs->first_line == type_found) {
        hrecs->first_line = (type_found->global_next != type_found
                             ? type_found->global_next : NULL);
    }
    type_found->global_next->global_prev = type_found->global_prev;
    type_found->global_prev->global_next = type_found->global_next;

    /* single element in the list */
    if (type_found->prev == type_found || type_found->next == type_found) {
        kh_del(sam_hrecs_t, hrecs->h, k);
    } else {
        type_found->prev->next = type_found->next;
        type_found->next->prev = type_found->prev;
        if (kh_val(hrecs->h, k) == type_found) { //first element
            kh_val(hrecs->h, k) = type_found->next;
        }
    }

    if (remove_hash && (!strncmp(type_name, "SQ", 2) || !strncmp(type_name, "RG", 2)))
        sam_hrecs_remove_hash_entry(hrecs, itype, type_found);

    sam_hrecs_free_tags(hrecs, type_found->tag);
    pool_free(hrecs->type_pool, type_found);

    hrecs->dirty = 1;

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xda1ec
cmpq $0x0, -0x18(%rbp)
je 0xda1ec
cmpq $0x0, -0x20(%rbp)
jne 0xda1f8
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xda39b
movq -0x18(%rbp), %rdi
callq 0xdabd0
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl -0x28(%rbp), %esi
callq 0xdc6d0
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
cmpl (%rcx), %eax
jne 0xda230
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xda39b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x20(%rbp), %rax
jne 0xda26e
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x20(%rbp), %rax
je 0xda25a
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0xda262
xorl %eax, %eax
movq %rax, -0x38(%rbp)
jmp 0xda262
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x20(%rbp), %rax
je 0xda2b1
movq -0x20(%rbp), %rax
movq (%rax), %rax
cmpq -0x20(%rbp), %rax
jne 0xda2c2
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl -0x2c(%rbp), %esi
callq 0xdf6b0
jmp 0xda31a
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
movl -0x2c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
cmpq -0x20(%rbp), %rax
jne 0xda318
movq -0x20(%rbp), %rax
movq (%rax), %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
movl -0x2c(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
jmp 0xda31a
cmpl $0x0, -0x24(%rbp)
je 0xda364
movq -0x18(%rbp), %rdi
leaq 0x183c1(%rip), %rsi     # 0xf26ec
movl $0x2, %edx
callq 0x4200
cmpl $0x0, %eax
je 0xda354
movq -0x18(%rbp), %rdi
leaq 0x182d1(%rip), %rsi     # 0xf2616
movl $0x2, %edx
callq 0x4200
cmpl $0x0, %eax
jne 0xda364
movq -0x10(%rbp), %rdi
movl -0x28(%rbp), %esi
movq -0x20(%rbp), %rdx
callq 0xdf730
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0xdfbd0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x822f0
movq -0x10(%rbp), %rax
movl $0x1, 0x90(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)