// File: /workspace/github_c_makefile_star2_O3/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 $0x38, %rsp
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x27356
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
cmpq $0x0, 0x38(%rdi)
je 0x2729c
testq %r15, %r15
je 0x272f5
movq $0x0, (%rsp)
leaq 0x706eb(%rip), %rsi     # 0x97971
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r14, %r8
movq %r15, %r9
xorl %eax, %eax
callq 0x8696e
jmp 0x2730b
movq 0x8(%rbx), %r12
cmpq $0x4, %r12
jb 0x27332
movq 0x28(%rbx), %rdi
cmpb $0x40, (%rdi)
jne 0x2732c
cmpb $0x48, 0x1(%rdi)
jne 0x2732c
cmpb $0x44, 0x2(%rdi)
jne 0x2732c
movl $0xa, %esi
callq 0x4190
testq %rax, %rax
je 0x27356
movq %rax, %r12
movb $0x0, (%rax)
movb $0x9, 0x33(%rsp)
movb (%r14), %al
movb %al, 0x34(%rsp)
testb %al, %al
je 0x2741b
movb 0x1(%r14), %al
jmp 0x2741d
leaq 0x70675(%rip), %rsi     # 0x97971
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r14, %r8
callq 0x89007
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x2735b
movq %rbx, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x84d53
cmpq $-0xd, %r12
ja 0x27356
leaq 0xb(%r12), %r13
testq %r15, %r15
je 0x2736a
movq %r15, %rdi
callq 0x41d0
movq %rax, %rbp
movq $-0x6, %rax
subq %rbp, %rax
cmpq %rax, %r13
jbe 0x273ac
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rbp
addq $0xc, %r12
movq %r12, %rdi
callq 0x4680
movq %rax, %rsi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rsi, %rsi
je 0x2735b
movq 0x28(%rbx), %r8
leaq 0x71133(%rip), %rdx     # 0x984c4
leaq 0x71128(%rip), %rcx     # 0x984c0
movq %rsi, 0x18(%rsp)
movq %rsi, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x4800
jmp 0x273fe
leaq (%r12,%rbp), %r13
addq $0x10, %r13
movq %r13, %rdi
callq 0x4680
movq %rax, %rsi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rsi, %rsi
je 0x2735b
addq %r12, %rbp
addq $0xf, %rbp
movq 0x28(%rbx), %rax
movq %rax, (%rsp)
leaq 0x710ce(%rip), %rdx     # 0x984ad
leaq 0x710da(%rip), %rcx     # 0x984c0
movq %rsi, 0x18(%rsp)
movq %rsi, %rdi
movq %r13, %rsi
movq %r14, %r8
movq %r15, %r9
xorl %eax, %eax
callq 0x4800
movq 0x28(%rbx), %rdi
callq 0x45c0
movq 0x18(%rsp), %rax
movq %rax, 0x28(%rbx)
movq %rbp, 0x8(%rbx)
xorl %eax, %eax
jmp 0x2735b
xorl %eax, %eax
leaq 0x33(%rsp), %rsi
movb %al, 0x2(%rsi)
movw $0x3a, 0x3(%rsi)
movq 0x28(%rbx), %rdi
callq 0x40e0
movb $0xa, (%r12)
testq %rax, %rax
je 0x274ad
leaq 0x4(%rax), %rdi
leaq 0x3(%rax), %r12
movl $0x3, %ebp
movb 0x1(%r12), %cl
incq %r12
addb $-0x9, %cl
incq %rbp
cmpb $0x1, %cl
ja 0x2744b
testq %r15, %r15
je 0x27547
movq %rax, 0x20(%rsp)
leaq -0x4(%rbp), %rdx
movq %r15, %rsi
callq 0x4210
testl %eax, %eax
jne 0x27496
movq %r15, %rdi
callq 0x41d0
movq %rbp, %rcx
subq %rax, %rcx
xorl %eax, %eax
cmpq $0x4, %rcx
je 0x2735b
movq 0x8(%rbx), %r13
movq 0x28(%rbx), %rax
movq %rax, 0x28(%rsp)
subq %rax, 0x20(%rsp)
subq %rbp, %r13
jmp 0x274ce
movq 0x8(%rbx), %r13
movq 0x28(%rbx), %rcx
movq %r12, %rax
movq %rcx, 0x28(%rsp)
subq %rcx, %rax
movq %rax, 0x20(%rsp)
testq %r15, %r15
je 0x2755f
movq %r15, %rdi
callq 0x41d0
movq $-0x6, %rcx
subq %rax, %rcx
cmpq %rcx, %r13
ja 0x27356
movq %r13, %rbp
movq %rax, 0x18(%rsp)
addq %rax, %r13
addq $0x5, %r13
movq %r13, %rdi
callq 0x4680
movq %rax, %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rcx, %rcx
je 0x2735b
movq 0x18(%rsp), %rax
addq %rax, %rbp
addq $0x4, %rbp
movq %r12, 0x8(%rsp)
movq %r15, (%rsp)
leaq 0x70fa4(%rip), %rdx     # 0x984d1
movq %rcx, 0x18(%rsp)
movq %rcx, %rdi
movq %r13, %rsi
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %r8
movq %r14, %r9
jmp 0x2759e
movq 0x8(%rbx), %r13
movq 0x28(%rbx), %rcx
movq %rcx, 0x28(%rsp)
subq %rcx, %rax
movq %rax, 0x20(%rsp)
subq %rbp, %r13
movq %r13, %rbp
leaq 0x1(%r13), %r14
movq %r14, %rdi
callq 0x4680
movq %rax, %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rcx, %rcx
je 0x2735b
leaq 0x70f58(%rip), %rdx     # 0x984de
movq %rcx, 0x18(%rsp)
movq %rcx, %rdi
movq %r14, %rsi
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %r8
movq %r12, %r9
xorl %eax, %eax
callq 0x4800
jmp 0x273fe