// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/sam.c
// Function: sam_hdr_read
sam_hdr_t *sam_hdr_read(htsFile *fp)
{
    if (!fp) {
        errno = EINVAL;
        return NULL;
    }

    switch (fp->format.format) {
    case bam:
        return sam_hdr_sanitise(bam_hdr_read(fp->fp.bgzf));

    case cram:
        return sam_hdr_sanitise(sam_hdr_dup(fp->fp.cram->header));

    case sam:
        return sam_hdr_create(fp);

    case fastq_format:
    case fasta_format:
        return sam_hdr_init();

    case empty_format:
        errno = EPIPE;
        return NULL;

    default:
        errno = EFTYPE;
        return NULL;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
testq %rdi, %rdi
je 0x2069c
movq %rdi, %r12
movl 0x4c(%rdi), %eax
addl $-0x3, %eax
cmpl $0xe, %eax
ja 0x20b28
leaq 0x58b47(%rip), %rcx     # 0x791c4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1d600
callq 0x4050
movl $0x16, (%rax)
xorl %eax, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%r12), %rax
movq 0x18(%rax), %rdi
callq 0x1d74a
jmp 0x20b0f
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
andq $0x0, 0x70(%rsp)
callq 0x1d600
movq %rax, %r15
callq 0xef80
movq %rax, %r14
testq %r15, %r15
setne %al
testq %r14, %r14
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x20b48
movq %r15, 0x8(%rsp)
leaq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
pushq $0x40
popq %rax
leaq 0x60(%rsp), %r15
xorl %r13d, %r13d
movq $0x0, (%rsp)
cmpl $0x40, %eax
jne 0x20b7a
movq %r12, %rdi
pushq $0x2
popq %rsi
movq 0x10(%rsp), %rdx
callq 0x12938
movl %eax, %ebx
testl %eax, %eax
js 0x20b83
movq %r15, %rbp
movq 0x20(%r12), %r15
cmpb $0x40, (%r15)
jne 0x20c10
movq 0x10(%rsp), %rax
cmpq $0x4, (%rax)
setae %cl
movb 0x1(%r15), %al
cmpb $0x53, %al
sete %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x208ce
cmpb $0x51, 0x2(%r15)
jne 0x20906
addq $0x4, %r15
pushq $-0x1
popq %rcx
xorl %r13d, %r13d
movq %r15, 0x20(%rsp)
movzbl (%r15), %eax
cmpl $0x4c, %eax
je 0x207ee
cmpl $0x53, %eax
jne 0x208ad
cmpb $0x4e, 0x1(%r15)
jne 0x208ad
cmpb $0x3a, 0x2(%r15)
jne 0x208ad
movq %rcx, 0x18(%rsp)
movq %r13, %rcx
addq $0x3, %r15
movq %r15, %rsi
movq %r15, 0x20(%rsp)
movq %r15, %r13
movzbl (%r15), %eax
cmpl $0xa, %eax
ja 0x207e6
movl $0x601, %edx            # imm = 0x601
btl %eax, %edx
jb 0x2083d
incq %r15
incq %r13
jmp 0x207d3
cmpb $0x4e, 0x1(%r15)
jne 0x208ad
cmpb $0x3a, 0x2(%r15)
jne 0x208ad
addq $0x3, %r15
movq %r15, %rdi
leaq 0x20(%rsp), %rsi
pushq $0xa
popq %rdx
movq %rcx, %r15
callq 0x40b0
cmpq $-0x1, %r15
sete %cl
cmpq %rax, %r15
sete %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0x20fc5
movq 0x20(%rsp), %r15
movq %rax, %rcx
jmp 0x208ad
testq %rcx, %rcx
je 0x2086e
movq %rcx, 0x30(%rsp)
pushq $0x3
popq %rdi
leaq 0x598d7(%rip), %rsi     # 0x7a128
leaq 0x598df(%rip), %rdx     # 0x7a137
xorl %eax, %eax
callq 0x110c6
movq 0x30(%rsp), %rdi
callq 0x45c0
movq 0x20(%rsp), %rsi
movq %rsi, 0x30(%rsp)
subq %rsi, %r13
leaq 0x1(%r13), %rdi
pushq $0x1
popq %rsi
callq 0x4300
testq %rax, %rax
je 0x20b8c
movq %rax, %rdi
movq 0x30(%rsp), %rsi
movq %r13, %rdx
movq %rax, %r13
callq 0x4250
movq %r15, 0x20(%rsp)
movq 0x18(%rsp), %rcx
jmp 0x208ad
incq %r15
movzbl (%r15), %eax
testl %eax, %eax
je 0x20912
cmpl $0x9, %eax
je 0x208c1
cmpl $0xa, %eax
jne 0x208aa
jmp 0x20912
movq %r15, 0x20(%rsp)
incq %r15
jmp 0x2078f
movzbl %al, %eax
cmpl $0x43, %eax
je 0x20a5b
cmpl $0x53, %eax
je 0x20906
cmpl $0x50, %eax
je 0x209cc
cmpl $0x52, %eax
je 0x209cc
cmpl $0x48, %eax
jne 0x20b53
movb $0x9, %al
cmpb $0x44, 0x2(%r15)
jmp 0x209d3
movb $0x9, %al
cmpb $0x51, 0x2(%r15)
jmp 0x209d3
movq %r15, 0x20(%rsp)
testq %r13, %r13
je 0x20a65
testq %rcx, %rcx
movq %rbp, %r15
js 0x20a90
movq %rcx, 0x18(%rsp)
movq %r14, %rdi
movq %r13, %rsi
leaq 0x40(%rsp), %rdx
callq 0xf354
cmpl $0x0, 0x40(%rsp)
js 0x20fbf
je 0x20ab7
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
decq %rcx
movl %eax, %r15d
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jbe 0x20ae1
movq (%rsp), %r13
testq %r13, %r13
jne 0x20985
callq 0xef80
movq %rax, %r13
testq %rax, %rax
je 0x20fe3
movq 0x18(%r14), %rax
movq (%rax,%r15,8), %rsi
movq %r13, %rdi
leaq 0x40(%rsp), %rdx
callq 0xf354
cmpl $0x0, 0x40(%rsp)
js 0x20fde
movq %r13, (%rsp)
movq 0x20(%r13), %rcx
cltq
movq 0x18(%rsp), %rdx
movq %rdx, (%rcx,%rax,8)
movl 0x4(%r14), %eax
decl %eax
shlq $0x20, %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
jmp 0x20aee
movb $0x9, %al
cmpb $0x47, 0x2(%r15)
pushq $0x3
popq %rcx
jne 0x20b53
cmpb %al, (%r15,%rcx)
jne 0x20b53
movq %rbp, %r15
movq 0x10(%r12), %rsi
movq 0x20(%r12), %rdi
movq %r15, %rdx
callq 0x21461
testl %eax, %eax
js 0x20b8c
pushq $0xa
popq %rdi
movq %r15, %rsi
callq 0x21551
testl %eax, %eax
js 0x20b8c
testb $0x10, (%r12)
jne 0x20a43
movq 0x38(%r12), %rdi
leaq 0x40(%rsp), %rsi
pushq $0x1
popq %rdx
callq 0xd4e0
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
addl %eax, %ecx
testq %rax, %rax
movzbl 0x40(%rsp), %eax
cmovlel %ecx, %eax
jmp 0x20a4d
movq 0x38(%r12), %rdi
callq 0xacbb
cmpl $-0x1, %eax
jge 0x20725
jmp 0x20b8c
movb $0x4f, %al
pushq $0x2
popq %rcx
jmp 0x209dc
pushq $0x3
popq %rdi
leaq 0x596b9(%rip), %rsi     # 0x7a128
leaq 0x59785(%rip), %rdx     # 0x7a1fb
xorl %eax, %eax
callq 0x110c6
movq 0x20(%r12), %rdi
callq 0x288b5
pushq $0x1
popq %r13
jmp 0x209e6
pushq $0x3
popq %rdi
leaq 0x5968e(%rip), %rsi     # 0x7a128
leaq 0x59730(%rip), %rdx     # 0x7a1d1
movq %r13, %rcx
xorl %eax, %eax
callq 0x110c6
movq 0x20(%r12), %rdi
callq 0x288b5
jmp 0x20ad7
movq 0x28(%r12), %r8
pushq $0x3
popq %rdi
leaq 0x59662(%rip), %rsi     # 0x7a128
leaq 0x596de(%rip), %rdx     # 0x7a1ab
movq %r13, %rcx
xorl %eax, %eax
callq 0x110c6
movq %r13, %rdi
callq 0x45c0
jmp 0x20afc
movq %rax, %rcx
movl 0x4(%r14), %eax
decl %eax
shlq $0x20, %rax
orq %rcx, %rax
movq 0x20(%r14), %rcx
movq %rax, (%rcx,%r15,8)
movq %rbp, %r15
pushq $0x1
popq %r13
jmp 0x209e9
movq 0x38(%r12), %rdi
callq 0x1d8f2
movq %rax, %rdi
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2100d
callq 0x4050
movl $0x8, (%rax)
jmp 0x206a7
callq 0x4050
movl $0x20, (%rax)
jmp 0x206a7
xorl %r13d, %r13d
xorl %r12d, %r12d
jmp 0x20be1
leaq 0x595ce(%rip), %rsi     # 0x7a128
leaq 0x596c0(%rip), %rdx     # 0x7a221
xorl %r13d, %r13d
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
movq 0x20(%r12), %rdi
callq 0x288b5
jmp 0x20b8f
movq 0x10(%rsp), %rax
andq $0x0, (%rax)
cmpl $-0x1, %ebx
jge 0x20c10
xorl %r13d, %r13d
movq 0x8(%rsp), %r15
movq (%rsp), %r12
cmpq $0x0, 0x20(%r15)
je 0x20ba6
cmpq $0x0, 0x10(%r15)
jne 0x20be1
xorl %ebx, %ebx
xorl %ebp, %ebp
cmpl (%r14), %ebp
je 0x20bdc
movq 0x10(%r14), %rax
movl %ebp, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %ebx, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0x20bd5
movq 0x18(%r14), %rax
movl %ebp, %ecx
movq (%rax,%rcx,8), %rdi
callq 0x45c0
incl %ebp
addl $0x2, %ebx
jmp 0x20baa
movq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x1d61e
leaq 0x60(%rsp), %rdi
callq 0x22fef
movq %r14, %rdi
callq 0xef8b
movq %r12, %rdi
callq 0xef8b
movq %r13, %rdi
callq 0x45c0
jmp 0x206a7
testl %r13d, %r13d
je 0x20cbf
xorl %r13d, %r13d
movq 0x8(%rsp), %r15
movslq 0x4(%r14), %rbx
movl %ebx, (%r15)
leaq (,%rbx,8), %rdi
callq 0x4680
movq %rax, 0x20(%r15)
testq %rax, %rax
je 0x20cb6
shlq $0x2, %rbx
movq %rbx, %rdi
callq 0x4680
movq %rax, 0x10(%r15)
testq %rax, %rax
je 0x20cb6
xorl %eax, %eax
xorl %edx, %edx
cmpl (%r14), %edx
je 0x20f66
movq 0x10(%r14), %rcx
movl %edx, %esi
shrl $0x4, %esi
movl (%rcx,%rsi,4), %esi
movl %eax, %ecx
andb $0x1e, %cl
shrl %cl, %esi
testb $0x3, %sil
jne 0x20caf
movl %edx, %ecx
movq 0x18(%r14), %rsi
movq 0x20(%r14), %rdi
movq (%rsi,%rcx,8), %rsi
movq 0x20(%r15), %r8
movslq 0x4(%rdi,%rcx,8), %rdi
movq %rsi, (%r8,%rdi,8)
movq 0x20(%r14), %rsi
movq (%rsi,%rcx,8), %rdi
movq 0x10(%r15), %r8
movq %rdi, %r9
sarq $0x20, %r9
movl %edi, (%r8,%r9,4)
movq %r9, (%rsi,%rcx,8)
incl %edx
addl $0x2, %eax
jmp 0x20c57
andl $0x0, (%r15)
jmp 0x20b94
movq 0x30(%r12), %rbx
testq %rbx, %rbx
movq 0x8(%rsp), %r15
je 0x20f66
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%rsp)
leaq 0x571f0(%rip), %rsi     # 0x77ed1
movq %rbx, %rdi
callq 0x40e0
leaq 0x7(%rax), %r13
testq %rax, %rax
cmoveq %rbx, %r13
leaq 0x5982b(%rip), %rsi     # 0x7a526
movq %r13, %rdi
xorl %eax, %eax
callq 0xe19b
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x20f46
movq %r13, 0x18(%rsp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
decq %rax
movq %rax, 0x80(%rsp)
movl $0x0, 0x2c(%rsp)
movq 0x10(%rsp), %r15
andq $0x0, 0x40(%rsp)
leaq 0x40(%rsp), %rdi
leaq -0x138a7(%rip), %rsi    # 0xd4a0
movq %r15, %rdx
callq 0x8fc3
movl %eax, %ebp
testl %eax, %eax
js 0x20f0b
movq 0x50(%rsp), %r13
movq %r13, %rdi
pushq $0x9
popq %rsi
callq 0x4190
testq %rax, %rax
je 0x20d35
movq %rax, %rbx
movq %rax, %r15
subq %r13, %r15
leaq 0x1(%r15), %rdi
pushq $0x1
popq %rsi
callq 0x4300
testq %rax, %rax
je 0x20f03
movq %rax, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rax, %r13
callq 0x43c0
movq %r14, %rdi
movq %r13, %r15
movq %r13, %rsi
leaq 0x3c(%rsp), %rdx
callq 0xf354
cmpl $0x0, 0x3c(%rsp)
js 0x20ff3
movl %eax, %r13d
movq %rbx, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x40b0
cmpl $0x0, 0x3c(%rsp)
movq %rax, 0x30(%rsp)
je 0x20e51
movq %rax, %rdx
movl %r13d, %r15d
cmpq 0x80(%rsp), %rax
jle 0x20e7b
orl $-0x1, 0x38(%rsp)
movq (%rsp), %r13
testq %r13, %r13
jne 0x20e0a
callq 0xef80
movq %rax, %r13
testq %rax, %rax
je 0x21000
movq 0x18(%r14), %rax
movq (%rax,%r15,8), %rsi
movq %r13, %rdi
leaq 0x38(%rsp), %rdx
callq 0xf354
cmpl $0x0, 0x38(%rsp)
movq %r13, (%rsp)
js 0x20f03
movq 0x20(%r13), %rcx
movl %eax, %eax
movq 0x30(%rsp), %rdx
movq %rdx, (%rcx,%rax,8)
movl 0x4(%r14), %eax
decl %eax
shlq $0x20, %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
orq %rcx, %rax
jmp 0x20e88
pushq $0x3
popq %rdi
leaq 0x592cd(%rip), %rsi     # 0x7a128
leaq 0x593f8(%rip), %rdx     # 0x7a25a
movq %r15, %rcx
movq 0x18(%rsp), %r8
xorl %eax, %eax
callq 0x110c6
movq %r15, %rdi
callq 0x45c0
jmp 0x20e97
movl 0x4(%r14), %eax
decl %eax
shlq $0x20, %rax
orq %rdx, %rax
movq 0x20(%r14), %rcx
movq %rax, (%rcx,%r15,8)
pushq $0x1
popq %rax
movl %eax, 0x2c(%rsp)
leaq 0x58a1b(%rip), %rdi     # 0x798b9
leaq 0x60(%rsp), %r15
movq %r15, %rsi
callq 0x214c5
movl %eax, 0x5c(%rsp)
movq 0x50(%rsp), %rdi
subq %rdi, %rbx
movq %rbx, %rsi
movq %r15, %rdx
callq 0x21461
movl %eax, %ebx
leaq 0x589f6(%rip), %rdi     # 0x798c1
movq %r15, %rsi
callq 0x214c5
movl %eax, %r13d
orl 0x5c(%rsp), %r13d
orl %ebx, %r13d
movq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x28928
movl %eax, %ebx
orl %r13d, %ebx
pushq $0xa
popq %rdi
movq %r15, %rsi
callq 0x21551
orl %ebx, %eax
jns 0x20d30
xorl %r13d, %r13d
jmp 0x20ff6
xorl %r13d, %r13d
leaq 0x40(%rsp), %rdi
callq 0x22fef
movq %r15, %rdi
callq 0xd8ee
testl %eax, %eax
je 0x20f4e
leaq 0x591fd(%rip), %rsi     # 0x7a128
leaq 0x59352(%rip), %rdx     # 0x7a284
pushq $0x1
popq %rdi
movq 0x18(%rsp), %rcx
xorl %eax, %eax
callq 0x110c6
jmp 0x20b8f
xorl %r13d, %r13d
jmp 0x20b94
testl %ebp, %ebp
jns 0x20b8f
cmpl $0x0, 0x2c(%rsp)
movq 0x8(%rsp), %r15
jne 0x20c21
movq (%rsp), %rax
movq %rax, 0x30(%r15)
movq %r14, %rdi
callq 0xef8b
movq 0x60(%rsp), %rax
testq %rax, %rax
jne 0x20f99
leaq 0x56dcf(%rip), %rdi     # 0x77d56
leaq 0x60(%rsp), %rbx
xorl %esi, %esi
movq %rbx, %rdx
callq 0x21461
movq (%rbx), %rax
movq %rax, 0x8(%r15)
movq 0x70(%rsp), %rax
movq %rax, 0x28(%r15)
movq %r15, %rdi
callq 0x2100d
movq %rax, 0x78(%r12)
movl $0x1, 0x40(%rax)
jmp 0x206a9
movq (%rsp), %r12
jmp 0x20fe9
leaq 0x5915c(%rip), %rsi     # 0x7a128
leaq 0x5918d(%rip), %rdx     # 0x7a160
pushq $0x1
popq %rdi
movq %r13, %rcx
jmp 0x20f3a
movq %r13, %r12
jmp 0x20fe6
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x8(%rsp), %r15
jmp 0x20b98
movq %r15, %r13
movq 0x10(%rsp), %r15
jmp 0x20f0e
movq $0x0, (%rsp)
jmp 0x20f03