// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/sam.c
// Function: sam_hdr_change_HD
int sam_hdr_change_HD(sam_hdr_t *h, const char *key, const char *val)
{
    if (!h || !key)
        return -1;

    if (!h->hrecs)
        return old_sam_hdr_change_HD(h, key, val);

    if (val) {
        if (sam_hdr_update_line(h, "HD", NULL, NULL, key, val, NULL) != 0)
            return -1;
    } else {
        if (sam_hdr_remove_tag_id(h, "HD", NULL, NULL, key) != 0)
            return -1;
    }
    return sam_hdr_rebuild(h);
}

// 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
jne 0x27fbf
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
cmpq $0x0, 0x38(%rdi)
je 0x27e02
testq %r15, %r15
je 0x27ecb
movq $0x0, (%rsp)
leaq 0x736ba(%rip), %rsi     # 0x9b4a3
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r14, %r8
movq %r15, %r9
xorl %eax, %eax
callq 0x8903d
jmp 0x27ee1
cmpq $0x4, 0x8(%rbx)
jb 0x27e29
movq 0x28(%rbx), %r12
leaq 0x7368e(%rip), %rsi     # 0x9b4a2
movl $0x3, %edx
movq %r12, %rdi
callq 0x4210
testl %eax, %eax
je 0x27f91
xorl %r13d, %r13d
xorl %r12d, %r12d
testq %r13, %r13
je 0x27f06
movq 0x28(%rbx), %rax
subq %rax, %r13
movq 0x8(%rbx), %rbp
movq %rax, 0x20(%rsp)
addq %rax, %rbp
subq %r12, %rbp
addq %r13, %rbp
testq %r15, %r15
je 0x27e78
movq %r15, %rdi
callq 0x41d0
movq $-0x6, %rcx
subq %rax, %rcx
cmpq %rcx, %rbp
ja 0x27fbf
addq %rax, %rbp
addq $0x4, %rbp
leaq 0x1(%rbp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x4680
movq %rax, %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rcx, %rcx
je 0x27fc4
testq %r15, %r15
je 0x27fd3
movq %r12, 0x8(%rsp)
movq %r15, (%rsp)
leaq 0x7361a(%rip), %rdx     # 0x9b4ca
movq %rcx, %r15
movq %rcx, %rdi
movq 0x18(%rsp), %rsi
movl %r13d, %ecx
movq 0x20(%rsp), %r8
movq %r14, %r9
jmp 0x27ff0
leaq 0x735d1(%rip), %rsi     # 0x9b4a3
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r14, %r8
callq 0x8b918
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x27fc4
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x87337
movq 0x8(%rbx), %r12
cmpq $-0xd, %r12
ja 0x27fbf
leaq 0xb(%r12), %rbp
testq %r15, %r15
je 0x27f41
movq %r15, %rdi
callq 0x41d0
movq $-0x6, %rcx
subq %rax, %rcx
cmpq %rcx, %rbp
ja 0x27fbf
leaq (%r12,%rax), %rbp
addq $0xf, %rbp
leaq 0x1(%rbp), %r12
movq %r12, %rdi
callq 0x4680
movq %rax, %rsi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rsi, %rsi
je 0x27fc4
movq 0x28(%rbx), %r8
testq %r15, %r15
je 0x28074
movq %r8, (%rsp)
leaq 0x73534(%rip), %rdx     # 0x9b4a6
leaq 0x73540(%rip), %rcx     # 0x9b4b9
movq %rsi, %rdi
movq %r12, %rsi
movq %r14, %r8
movq %r15, %r9
movq %rdi, %r15
xorl %eax, %eax
callq 0x4800
jmp 0x27ff7
movq %r12, %rdi
movl $0xa, %esi
callq 0x4190
testq %rax, %rax
je 0x27fbf
movq %rax, %r12
movb $0x0, (%rax)
movb $0x9, 0x13(%rsp)
movb (%r14), %al
movb %al, 0x14(%rsp)
testb %al, %al
je 0x2800c
movb 0x1(%r14), %al
jmp 0x2800e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x734fd(%rip), %rdx     # 0x9b4d7
movq %rcx, %r15
movq %rcx, %rdi
movq 0x18(%rsp), %rsi
movl %r13d, %ecx
movq 0x20(%rsp), %r8
movq %r12, %r9
xorl %eax, %eax
callq 0x4800
movq 0x28(%rbx), %rdi
callq 0x45c0
movq %r15, 0x28(%rbx)
movq %rbp, 0x8(%rbx)
xorl %eax, %eax
jmp 0x27fc4
xorl %eax, %eax
leaq 0x13(%rsp), %rsi
movb %al, 0x2(%rsi)
movw $0x3a, 0x3(%rsi)
movq 0x28(%rbx), %rdi
callq 0x40e0
movb $0xa, (%r12)
movb $0x1, %cl
testq %rax, %rax
je 0x2806f
movq %rax, %r13
leaq 0x4(%rax), %rdi
movq %rax, %r12
addq $0x3, %r12
movq $-0x1, %rbp
movb 0x1(%r12), %al
incq %r12
addb $-0x9, %al
incq %rbp
cmpb $0x1, %al
ja 0x28046
testq %r15, %r15
je 0x280a5
movq %r15, %rsi
movq %rbp, %rdx
callq 0x4210
testl %eax, %eax
je 0x28097
movb $0x1, %cl
jmp 0x280a5
movq %r12, %r13
jmp 0x280a5
leaq 0x73442(%rip), %rdx     # 0x9b4bd
leaq 0x73437(%rip), %rcx     # 0x9b4b9
movq %rsi, %r15
movq %rsi, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x4800
jmp 0x27ff7
movq %r15, %rdi
callq 0x41d0
cmpq %rbp, %rax
setne %cl
xorl %eax, %eax
testb %cl, %cl
jne 0x27e2f
jmp 0x27fc4