// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %ecx, %ebp
movq %rdi, %rbx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
testq %rdx, %rdx
sete %dil
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
orb %cl, %dil
jne 0x8681a
movzwl (%rsi), %ecx
rolw $0x8, %cx
movzwl %cx, %edi
movq (%rbx), %r9
movl (%r9), %r8d
testl %r8d, %r8d
je 0x862d5
movl %ebp, (%rsp)
movq %rbx, 0x8(%rsp)
leal -0x1(%r8), %r11d
movl %r11d, %ebp
andl %edi, %ebp
movq 0x10(%r9), %r15
movl $0x1, %r12d
movl %ebp, %r10d
movl %r10d, %ecx
shrl $0x4, %ecx
movl (%r15,%rcx,4), %ebx
leal (%r10,%r10), %ecx
andl $0x1e, %ecx
movl %ebx, %r13d
shrl %cl, %r13d
testb $0x2, %r13b
jne 0x862c2
testb $0x1, %r13b
jne 0x862af
movq 0x18(%r9), %r13
movl %r10d, %r14d
cmpl %edi, (%r13,%r14,4)
je 0x862c2
addl %r12d, %r10d
andl %r11d, %r10d
incl %r12d
cmpl %ebp, %r10d
jne 0x8627e
jmp 0x8681a
shrl %cl, %ebx
testb $0x3, %bl
cmovnel %r8d, %r10d
movq 0x8(%rsp), %rbx
movl (%rsp), %ebp
jmp 0x862d8
xorl %r10d, %r10d
cmpl %r8d, %r10d
je 0x8681a
movq 0x10(%rdx), %rax
cmpq %rdx, 0x8(%rbx)
jne 0x862f8
xorl %ecx, %ecx
cmpq %rdx, %rax
cmovneq %rax, %rcx
movq %rcx, 0x8(%rbx)
movq 0x18(%rdx), %rcx
movq %rcx, 0x18(%rax)
movq %rax, 0x10(%rcx)
movq 0x8(%rdx), %rax
cmpq %rdx, %rax
movq %rdx, 0x28(%rsp)
je 0x86337
movq (%rdx), %rcx
cmpq %rdx, %rcx
je 0x86337
movq %rcx, (%rax)
movq (%rdx), %rcx
movq %rax, 0x8(%rcx)
movq 0x20(%r9), %rax
movl %r10d, %r8d
cmpq %rdx, (%rax,%r8,8)
jne 0x8636b
movq %rcx, (%rax,%r8,8)
jmp 0x8636b
movq 0x10(%r9), %rax
movl %r10d, %edx
shrl $0x4, %edx
movl (%rax,%rdx,4), %r11d
addl %r10d, %r10d
andl $0x1e, %r10d
movq %rbx, %r14
movl %r11d, %ebx
movl %r10d, %ecx
shrl %cl, %ebx
testb $0x3, %bl
movq %r14, %rbx
jne 0x8636b
btsl %r10d, %r11d
movl %r11d, (%rax,%rdx,4)
decl 0x4(%r9)
testl %ebp, %ebp
je 0x867f1
movzbl (%rsi), %eax
cmpl $0x52, %eax
je 0x8638f
cmpl $0x53, %eax
jne 0x867f1
cmpb $0x51, 0x1(%rsi)
je 0x86399
jmp 0x867f1
cmpb $0x47, 0x1(%rsi)
jne 0x867f1
cmpl $0x5247, %edi           # imm = 0x5247
je 0x86469
cmpl $0x5351, %edi           # imm = 0x5351
jne 0x867f1
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x867f1
xorl %esi, %esi
xorl %r14d, %r14d
movq 0x8(%rax), %rcx
movzbl (%rcx), %edx
cmpl $0x41, %edx
je 0x863f2
cmpl $0x53, %edx
jne 0x86409
cmpb $0x4e, 0x1(%rcx)
jne 0x86409
cmpl $0x2, 0x10(%rax)
jle 0x86829
addq $0x3, %rcx
movq %rcx, %r14
jmp 0x86409
cmpb $0x4e, 0x1(%rcx)
jne 0x86409
cmpl $0x2, 0x10(%rax)
jle 0x86848
addq $0x3, %rcx
movq %rcx, %rsi
movq (%rax), %rax
testq %rax, %rax
jne 0x863c8
movq %rsi, 0x10(%rsp)
testq %r14, %r14
je 0x867f1
movq 0x38(%rbx), %rax
movq %rax, (%rsp)
movl (%rax), %eax
testl %eax, %eax
je 0x864e5
leal -0x1(%rax), %edx
movb (%r14), %cl
testb %cl, %cl
movq %rax, 0x30(%rsp)
je 0x864ed
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 0x8644e
jmp 0x864f3
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rcx
testq %rcx, %rcx
je 0x867f1
movq 0x8(%rcx), %rax
cmpb $0x49, (%rax)
jne 0x8648a
cmpb $0x44, 0x1(%rax)
je 0x8648f
movq (%rcx), %rcx
jmp 0x86472
cmpl $0x2, 0x10(%rcx)
jle 0x86867
movq 0x50(%rbx), %r14
movl (%r14), %r8d
testl %r8d, %r8d
je 0x86684
leaq 0x3(%rax), %rcx
leal -0x1(%r8), %edx
movq %rcx, 0x20(%rsp)
movb (%rcx), %cl
testb %cl, %cl
je 0x8668c
addq $0x4, %rax
movl $0x811c9dc5, %r12d      # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %r12d, %ecx
imull $0x1000193, %ecx, %r12d # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x864ca
jmp 0x86692
xorl %r13d, %r13d
jmp 0x86582
movl $0x811c9dc5, %r15d      # imm = 0x811C9DC5
andl %edx, %r15d
movq (%rsp), %rax
movq 0x10(%rax), %rsi
movl $0x1, %r12d
movl %r15d, %r13d
movl %edx, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movl %r13d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %edi
leal (,%r13,2), %ebp
andl $0x1e, %ebp
movl %edi, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x86571
testb $0x1, %al
jne 0x8655e
movq (%rsp), %rax
movq 0x18(%rax), %rax
movl %r13d, %ecx
movl %edi, 0x8(%rsp)
movq (%rax,%rcx,8), %rdi
movq %r14, %rsi
callq 0x46c0
movl 0x8(%rsp), %edi
movq 0x18(%rsp), %rsi
movl 0x20(%rsp), %edx
testl %eax, %eax
je 0x86571
addl %r12d, %r13d
andl %edx, %r13d
incl %r12d
cmpl %r15d, %r13d
jne 0x86510
jmp 0x867f1
movl %ebp, %ecx
shrl %cl, %edi
testb $0x3, %dil
movq 0x30(%rsp), %rax
cmovnel %eax, %r13d
cmpl %eax, %r13d
je 0x867f1
movq (%rsp), %rax
movq 0x20(%rax), %rax
movl %r13d, %ecx
movl (%rax,%rcx,4), %ebp
movslq %ebp, %rax
leaq 0x1(%rax), %rdx
movl 0x28(%rbx), %ecx
cmpl %ecx, %edx
jge 0x865cf
movq 0x30(%rbx), %rsi
leaq (%rax,%rax,2), %rdi
leaq (%rsi,%rdi,8), %rdi
leaq (%rdx,%rdx,2), %rdx
leaq (%rsi,%rdx,8), %rsi
notl %eax
addl %eax, %ecx
movslq %ecx, %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rdx
callq 0x4830
movq 0x10(%rsp), %rdx
testq %rdx, %rdx
je 0x865e3
movq %rbx, %rdi
movl %ebp, %esi
callq 0x89e09
movq 0x38(%rbx), %rax
cmpl %r13d, (%rax)
je 0x86619
movq 0x10(%rax), %rdx
movl %r13d, %esi
shrl $0x4, %esi
movl (%rdx,%rsi,4), %edi
addl %r13d, %r13d
andl $0x1e, %r13d
movl %edi, %r8d
movl %r13d, %ecx
shrl %cl, %r8d
testb $0x3, %r8b
jne 0x86619
btsl %r13d, %edi
movl %edi, (%rdx,%rsi,4)
decl 0x4(%rax)
decl 0x28(%rbx)
movl 0x94(%rbx), %ecx
testl %ecx, %ecx
js 0x8662a
cmpl %ebp, %ecx
jle 0x86630
movl %ebp, 0x94(%rbx)
movl (%rax), %edx
testl %edx, %edx
je 0x867f1
movq 0x10(%rax), %rsi
xorl %edi, %edi
xorl %r8d, %r8d
movq %r8, %rcx
shrq $0x4, %rcx
movl (%rsi,%rcx,4), %r9d
movl %edi, %ecx
andb $0x1e, %cl
shrl %cl, %r9d
testb $0x3, %r9b
jne 0x86672
movq 0x20(%rax), %rcx
movl (%rcx,%r8,4), %r9d
cmpl %ebp, %r9d
jle 0x86672
decl %r9d
movl %r9d, (%rcx,%r8,4)
movl (%rax), %edx
incq %r8
movl %edx, %ecx
addl $0x2, %edi
cmpq %rcx, %r8
jb 0x86643
jmp 0x867f1
xorl %r15d, %r15d
jmp 0x8671a
movl $0x811c9dc5, %r12d      # imm = 0x811C9DC5
andl %edx, %r12d
movq 0x10(%r14), %rsi
movl $0x1, %r13d
movl %r12d, %r15d
movq %r8, (%rsp)
movl %edx, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movl %r15d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %edi
leal (%r15,%r15), %ebp
andl $0x1e, %ebp
movl %edi, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x8670e
testb $0x1, %al
jne 0x866fb
movq 0x18(%r14), %rax
movl %r15d, %ecx
movl %edi, 0x8(%rsp)
movq (%rax,%rcx,8), %rdi
movq 0x20(%rsp), %rsi
callq 0x46c0
movl 0x8(%rsp), %edi
movq 0x10(%rsp), %rsi
movl 0x18(%rsp), %edx
movq (%rsp), %r8
testl %eax, %eax
je 0x8670e
addl %r13d, %r15d
andl %edx, %r15d
incl %r13d
cmpl %r12d, %r15d
jne 0x866af
jmp 0x867f1
movl %ebp, %ecx
shrl %cl, %edi
testb $0x3, %dil
cmovnel %r8d, %r15d
cmpl %r8d, %r15d
je 0x867f1
movq 0x20(%r14), %rax
movl %r15d, %ecx
movslq (%rax,%rcx,4), %rbp
leaq 0x1(%rbp), %rcx
movl 0x40(%rbx), %eax
cmpl %eax, %ecx
jge 0x86770
movq 0x48(%rbx), %rdx
leaq (,%rbp,2), %rsi
addq %rbp, %rsi
leaq (%rdx,%rsi,8), %rdi
leaq (%rcx,%rcx,2), %rcx
leaq (%rdx,%rcx,8), %rsi
movl %ebp, %ecx
notl %ecx
addl %ecx, %eax
cltq
shlq $0x3, %rax
leaq (%rax,%rax,2), %rdx
callq 0x4830
movq 0x50(%rbx), %r14
movl (%r14), %r8d
cmpl %r15d, %r8d
jne 0x8677a
movl %r15d, %r8d
jmp 0x867a9
movq 0x10(%r14), %rax
movl %r15d, %edx
shrl $0x4, %edx
movl (%rax,%rdx,4), %esi
addl %r15d, %r15d
andl $0x1e, %r15d
movl %esi, %edi
movl %r15d, %ecx
shrl %cl, %edi
testb $0x3, %dil
jne 0x867a9
btsl %r15d, %esi
movl %esi, (%rax,%rdx,4)
decl 0x4(%r14)
movl (%r14), %r8d
decl 0x40(%rbx)
testl %r8d, %r8d
je 0x867f1
movq 0x10(%r14), %rax
xorl %edx, %edx
xorl %esi, %esi
movq %rsi, %rcx
shrq $0x4, %rcx
movl (%rax,%rcx,4), %edi
movl %edx, %ecx
andb $0x1e, %cl
shrl %cl, %edi
testb $0x3, %dil
jne 0x867e3
movq 0x20(%r14), %rcx
movl (%rcx,%rsi,4), %edi
cmpl %ebp, %edi
jle 0x867e3
decl %edi
movl %edi, (%rcx,%rsi,4)
movl (%r14), %r8d
incq %rsi
movl %r8d, %ecx
addl $0x2, %edx
cmpq %rcx, %rsi
jb 0x867b9
movq 0x28(%rsp), %r14
movq 0x20(%r14), %rsi
movq %rbx, %rdi
callq 0x8a8f0
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0x57e84
movl $0x1, 0x90(%rbx)
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1be45(%rip), %rdi     # 0xa2675
leaq 0x1b634(%rip), %rsi     # 0xa1e6b
leaq 0x1bc1b(%rip), %rcx     # 0xa2459
movl $0x1aa, %edx            # imm = 0x1AA
callq 0x42f0
leaq 0x1be26(%rip), %rdi     # 0xa2675
leaq 0x1b615(%rip), %rsi     # 0xa1e6b
leaq 0x1bbfc(%rip), %rcx     # 0xa2459
movl $0x1ad, %edx            # imm = 0x1AD
callq 0x42f0
leaq 0x1be07(%rip), %rdi     # 0xa2675
leaq 0x1b5f6(%rip), %rsi     # 0xa1e6b
leaq 0x1bbdd(%rip), %rcx     # 0xa2459
movl $0x1d0, %edx            # imm = 0x1D0
callq 0x42f0