// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/sam.c
// Function: sam_read1
int sam_read1(htsFile *fp, sam_hdr_t *h, bam1_t *b)
{
    int ret, pass_filter;

    do {
        switch (fp->format.format) {
        case bam:
            ret = sam_read1_bam(fp, h, b);
            break;

        case cram:
            ret = sam_read1_cram(fp, h, &b);
            break;

        case sam:
            ret = sam_read1_sam(fp, h, b);
            break;

        case fasta_format:
        case fastq_format: {
            fastq_state *x = (fastq_state *)fp->state;
            if (!x) {
                if (!(fp->state = fastq_state_init(fp->format.format
                                                   == fastq_format ? '@' : '>')))
                    return -2;
            }

            return fastq_parse1(fp, b);
        }

        case empty_format:
            errno = EPIPE;
            return -3;

        default:
            errno = EFTYPE;
            return -3;
        }

        pass_filter = (ret >= 0 && fp->filter)
            ? sam_passes_filter(h, b, fp->filter)
            : 1;
    } while (pass_filter == 0);

    return pass_filter < 0 ? -2 : ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %r15
movq %rdi, %r12
leaq 0x68(%rsp), %rax
movq %rdx, (%rax)
leaq 0x10(%rdi), %r14
movq %rdi, 0x70(%rsp)
movq %r14, %rbx
movl 0x4c(%r12), %r14d
leal -0x3(%r14), %eax
cmpl $0xe, %eax
ja 0x29c19
leaq 0x6da75(%rip), %rcx     # 0x972a8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x68(%rsp), %r13
cmpq $0x0, (%rbx)
je 0x2993a
movq %rbx, %r14
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x275aa
movl %eax, %ebp
movq $0x0, (%rbx)
jmp 0x29902
testq %r15, %r15
setne %r14b
movq %r12, %rax
movq 0x68(%rsp), %r12
movq 0x38(%rax), %rdi
movq %r12, %rsi
callq 0x2315b
movl %eax, %ebp
testl %eax, %eax
setns %al
andb %r14b, %al
cmpb $0x1, %al
jne 0x298ff
movl 0x8(%r12), %ecx
cmpl $-0x1, %ecx
jl 0x29c40
movl (%r15), %eax
cmpl %eax, %ecx
jge 0x29c40
movl 0x1c(%r12), %ecx
cmpl %eax, %ecx
jge 0x29c40
movq %rbx, %r14
cmpl $-0x2, %ecx
jg 0x2990a
jmp 0x29c40
movq 0x38(%r12), %rdi
leaq 0x68(%rsp), %rsi
callq 0x3e19e
testl %eax, %eax
js 0x29c26
movl %eax, %ebp
movq 0x68(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0x235d8
testl %eax, %eax
movq %rbx, %r14
jns 0x2990a
jmp 0x2a1b6
movq %rbx, %r14
testl %ebp, %ebp
js 0x2a1bb
movq 0x70(%rsp), %r12
movq 0x80(%r12), %rdx
testq %rdx, %rdx
je 0x2a1bb
movq 0x68(%rsp), %rsi
movq %r15, %rdi
callq 0x24599
testl %eax, %eax
je 0x29817
jmp 0x29b52
movq 0x40(%r12), %r14
testq %r14, %r14
je 0x29996
cmpl $0x2, 0x54(%r12)
jne 0x29a08
movq 0x38(%r12), %rax
cmpq $0x0, 0x68(%rax)
je 0x29a08
movq %r12, %rdi
callq 0x24298
testl %eax, %eax
js 0x2a1ab
movq 0x38(%r12), %rdi
movq 0x68(%rdi), %rsi
xorl %edx, %edx
callq 0xd8df
testq %rax, %rax
js 0x2a1b6
movq 0x38(%r12), %rax
movq $0x0, 0x68(%rax)
movq %rbx, %r14
movq 0x70(%rsp), %rbx
movq %rbx, %rdi
movl $0x2, %esi
movq %r14, %rdx
callq 0x15732
testl %eax, %eax
js 0x29c05
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x275aa
movl %eax, %ebp
movq $0x0, (%r14)
testl %eax, %eax
jns 0x2990a
movq 0x8(%rbx), %rcx
movl $0x3, %edi
leaq 0x6ed14(%rip), %rsi     # 0x986f9
leaq 0x6ed1b(%rip), %rdx     # 0x98707
xorl %eax, %eax
callq 0x13de5
testq %r15, %r15
je 0x2a1bb
cmpl $0x0, 0x4(%r15)
jne 0x29999
jmp 0x2a1bb
movq (%r14), %rax
testq %rax, %rax
jne 0x29a56
movq %r15, (%r14)
incl 0x40(%r15)
cmpq $0x0, 0x38(%r15)
jne 0x29a2e
movq %r15, %rdi
callq 0x8413e
testl %eax, %eax
js 0x2a1b6
leaq 0x48(%r14), %rdi
xorl %esi, %esi
leaq 0x96b4(%rip), %rdx      # 0x330ef
movq %r12, %rcx
callq 0x4920
testl %eax, %eax
jne 0x2a1b6
movl $0x1, 0x50(%r14)
movq (%r14), %rax
cmpq %r15, %rax
jne 0x29cd1
movq 0x68(%r14), %r12
testq %r12, %r12
jne 0x29ad7
movl 0xd4(%r14), %ebp
testl %ebp, %ebp
jne 0x2a1af
leaq 0x78(%r14), %r12
movq %r12, %rdi
callq 0x4750
movl 0xd0(%r14), %ebp
movq %r12, %rdi
callq 0x4340
cmpl $0x3, %ebp
je 0x29cb4
movq 0x40(%r14), %rdi
callq 0x35e75
testq %rax, %rax
je 0x2a1b6
movq %rax, %rbp
movq %r12, 0x60(%rsp)
movq %rax, %rdi
callq 0x361a4
movq %rax, %r12
movq %rax, 0x68(%r14)
movq %rbp, %rdi
xorl %esi, %esi
callq 0x3617f
testq %r12, %r12
je 0x2a1cf
movl 0x70(%r14), %eax
movl 0x18(%r12), %ecx
cmpl %ecx, %eax
jge 0x29b14
movslq %eax, %rcx
incl %eax
leaq (%rcx,%rcx,4), %rsi
shlq $0x4, %rsi
addq 0x10(%r12), %rsi
movl %eax, 0x70(%r14)
movq %r13, %rdi
callq 0x22b64
testq %rax, %rax
je 0x2a1b6
movl 0x70(%r14), %eax
movl 0x18(%r12), %ecx
xorl %ebp, %ebp
cmpl %ecx, %eax
jne 0x29b4a
leaq 0x18(%r14), %r13
movq %r13, %rdi
callq 0x4750
movq 0x60(%r14), %rax
movq %rax, (%r12)
movq %r12, 0x60(%r14)
movq %r13, %rdi
callq 0x4340
movq $0x0, 0x68(%r14)
movl $0x0, 0x70(%r14)
movq %rbx, %r14
jmp 0x2990a
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmovsl %eax, %ebp
jmp 0x2a1bb
movq 0x40(%r12), %r13
testq %r13, %r13
jne 0x29ba4
movl $0x1, %edi
movl $0x80, %esi
callq 0x4300
testq %rax, %rax
je 0x29cbe
movq %rax, %r13
cmpl $0x11, %r14d
sete %al
movb $0x0, 0x6e(%r13)
movw $0x4342, 0x6c(%r13)     # imm = 0x4342
addb %al, %al
addb $0x3e, %al
movb %al, 0x78(%r13)
movq %r13, 0x40(%r12)
movq 0x68(%rsp), %r15
cmpl $0x10, %r14d
jne 0x29bea
cmpq $0x0, 0x20(%r12)
je 0x29bea
cmpq $0x0, (%rbx)
je 0x29cb4
movq 0x10(%r13), %rdi
callq 0x45c0
movq 0x10(%rbx), %rax
movq %rax, 0x10(%r13)
movups (%rbx), %xmm0
movups %xmm0, (%r13)
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
jmp 0x29c55
movq %r12, %rdi
movl $0x2, %esi
movq %r13, %rdx
callq 0x15732
cmpl $-0x1, %eax
je 0x29cb4
jge 0x29c55
movl %eax, %ebp
jmp 0x2a1bb
callq 0x4050
movl $0x20, (%rax)
jmp 0x29c4b
callq 0x4050
movl $0x8, (%rax)
jmp 0x29c4b
movq 0x38(%r12), %rdi
callq 0x53485
cmpl $0x1, %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
sbbl $0x0, %ebp
jmp 0x2a1bb
callq 0x4050
movl $0x22, (%rax)
movl $0xfffffffd, %ebp       # imm = 0xFFFFFFFD
jmp 0x2a1bb
movq 0x10(%r13), %r12
movb (%r12), %al
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
cmpb 0x78(%r13), %al
jne 0x2a1bb
leaq 0x1(%r12), %rax
movq %rax, 0x60(%rsp)
cmpl $0x0, 0x7c(%r13)
movq %r15, 0x58(%rsp)
je 0x29ccc
leaq 0x6eb09(%rip), %rsi     # 0x98792
movq %r12, %rdi
callq 0x48f0
testq %rax, %rax
je 0x29ccc
movq %rax, %r14
decq %r14
movq %rax, %rcx
movzbl (%rcx), %eax
cmpl $0x20, %eax
je 0x29cac
cmpl $0x9, %eax
jne 0x29cf0
incq %rcx
incq %r14
jmp 0x29c9f
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x2a1bb
movq $0x0, 0x40(%r12)
jmp 0x2a1b6
xorl %r14d, %r14d
jmp 0x29d00
leaq 0x6ea21(%rip), %rsi     # 0x986f9
leaq 0x6dfa9(%rip), %rdx     # 0x97c88
movl $0x1, %edi
xorl %eax, %eax
callq 0x13de5
jmp 0x2a1b6
movq %rcx, 0x60(%rsp)
movb $0x40, -0x1(%rcx)
movq 0x10(%r13), %r12
subq %r12, %r14
movq (%r13), %r15
cmpq %r15, %r14
jae 0x29d33
callq 0x4510
movq (%rax), %rax
movzbl (%r12,%r14), %ecx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x29d27
incq %r14
cmpq %r14, %r15
jne 0x29d11
jmp 0x29d54
movb $0x0, (%r12,%r14)
movq %r14, (%r13)
incq %r14
cmpq %r15, %r14
jae 0x29d57
callq 0x4510
movq (%rax), %rax
movzbl (%r12,%r14), %ecx
testb $0x20, 0x1(%rax,%rcx,2)
je 0x29d57
incq %r14
cmpq %r14, %r15
jne 0x29d40
movq %r15, %r14
addq %r14, %r12
movq %r12, 0x28(%r13)
subq %r14, %r15
movq %r15, 0x18(%r13)
movq $0x0, 0x30(%r13)
movl $0x2b, %r14d
movq 0x70(%rsp), %r12
movq %r12, %rdi
movl $0x2, %esi
movq %rbx, %rdx
callq 0x15732
testl %eax, %eax
js 0x29e51
movq 0x20(%r12), %r15
movsbl (%r15), %ecx
movl 0x4c(%r12), %eax
cmpl $0x11, %eax
movl $0x3e, %edx
cmovel %r14d, %edx
cmpl %ecx, %edx
je 0x29e6b
movq (%rbx), %r12
movq 0x30(%r13), %rdi
leaq (%r12,%rdi), %rax
addq $0x2, %rax
cmpq %rdi, %rax
jbe 0x2a19e
cmpq %rax, 0x38(%r13)
jae 0x29e1e
movq %r13, %r14
movq %rax, %r13
shrq %r13
movabsq $0x3fffffffffffffff, %rcx # imm = 0x3FFFFFFFFFFFFFFF
cmpq %rcx, %rax
movl $0x0, %ecx
cmovaq %rcx, %r13
addq %rax, %r13
movq 0x40(%r14), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x2a1bb
movq %rax, 0x40(%r14)
movq %r13, 0x38(%r14)
movq 0x30(%r14), %rdi
movq %r14, %r13
movl $0x2b, %r14d
jmp 0x29e22
movq 0x40(%r13), %rax
addq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x43c0
movq 0x30(%r13), %rax
addq %r12, %rax
movq %rax, 0x30(%r13)
movq 0x40(%r13), %rcx
movb $0x0, (%rcx,%rax)
testl %r12d, %r12d
jns 0x29d73
jmp 0x2a1bb
cmpl $-0x1, %eax
jne 0x2a1bb
cmpl $0x11, 0x4c(%r12)
jne 0x29f73
jmp 0x2a1bb
cmpl $0x11, %eax
jne 0x29f73
movq 0x30(%r13), %r14
movq $0x0, 0x48(%r13)
movq %rbx, %r15
movq %r12, %rdi
movl $0x2, %esi
movq %r15, %rdx
callq 0x15732
testl %eax, %eax
js 0x2a1bb
movq (%r15), %r12
cmpq %r14, %r12
ja 0x2a1bb
movq 0x48(%r13), %rdi
leaq (%r12,%rdi), %rax
addq $0x2, %rax
cmpq %rdi, %rax
jbe 0x2a19e
movq 0x70(%rsp), %rcx
movq 0x20(%rcx), %rsi
cmpq %rax, 0x50(%r13)
jae 0x29f1d
movq %rsi, 0x78(%rsp)
movq %r13, %r15
movq %rax, %r13
shrq %r13
movabsq $0x3fffffffffffffff, %rcx # imm = 0x3FFFFFFFFFFFFFFF
cmpq %rcx, %rax
movl $0x0, %ecx
cmovaq %rcx, %r13
addq %rax, %r13
movq 0x58(%r15), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x2a1bb
movq %rax, 0x58(%r15)
movq %r13, 0x50(%r15)
movq 0x48(%r15), %rdi
movq %r15, %r13
movq 0x78(%rsp), %rsi
jmp 0x29f21
movq 0x58(%r13), %rax
addq %rax, %rdi
movq %r12, %rdx
callq 0x43c0
movq 0x48(%r13), %rax
addq %r12, %rax
movq %rax, 0x48(%r13)
movq 0x58(%r13), %rcx
movb $0x0, (%rcx,%rax)
testl %r12d, %r12d
js 0x2a1bb
movq %rbx, %r15
subq (%rbx), %r14
movq 0x70(%rsp), %r12
jne 0x29e83
cmpq $0x0, 0x48(%r13)
je 0x29f73
xorl %eax, %eax
movq 0x58(%r13), %rcx
addb $-0x21, (%rcx,%rax)
incq %rax
cmpq 0x48(%r13), %rax
jb 0x29f62
movq (%r13), %rbx
movq 0x10(%r13), %r15
movw $0x4, %r14w
cmpq $0x3, %rbx
jb 0x29fd9
cmpb $0x2f, -0x2(%r15,%rbx)
jne 0x29fd9
movzbl -0x1(%r15,%rbx), %r12d
callq 0x4510
movq (%rax), %rax
testb $0x8, 0x1(%rax,%r12,2)
je 0x29fd9
xorl %eax, %eax
cmpb $0x32, %r12b
setne %al
shll $0x6, %eax
orl $0x8d, %eax
cmpb $0x31, %r12b
movl $0x4d, %r14d
cmovnel %eax, %r14d
leaq -0x2(%rbx), %rax
movq %rax, (%r13)
movb $0x0, -0x2(%r15,%rbx)
movq (%r13), %rbx
movq 0x10(%r13), %r15
movq 0x60(%rsp), %rdx
addq %r15, %rbx
subq %rdx, %rbx
movq 0x30(%r13), %rax
movq 0x40(%r13), %rcx
movq 0x58(%r13), %rdi
xorl %esi, %esi
movq %rsi, 0x48(%rsp)
movq %rdi, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movq %rax, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rsp)
movq $-0x1, 0x20(%rsp)
movl $0xffffffff, 0x18(%rsp) # imm = 0xFFFFFFFF
movl $0x0, (%rsp)
movzwl %r14w, %ecx
movq 0x58(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movq $-0x1, %r9
callq 0x22c19
testl %eax, %eax
js 0x2a1bb
movl %eax, %ebx
cmpl $0x0, 0x60(%r13)
je 0x2a202
cmpq $0x7, 0x18(%r13)
jb 0x2a202
movq 0x28(%r13), %r15
movb 0x3(%r15), %al
orb 0x1(%r15), %al
cmpb $0x3a, %al
jne 0x2a206
movzbl (%r15), %r12d
callq 0x4510
movq %rax, %r14
movq (%rax), %rax
testb $0x8, 0x1(%rax,%r12,2)
je 0x2a206
addq $0x4, %r15
leaq 0x80(%rsp), %rsi
movq %r15, %rdi
movl $0xa, %edx
callq 0x46d0
testq %rax, %rax
js 0x2a206
movq 0x80(%rsp), %r8
movq 0x28(%r13), %rax
leaq 0x4(%rax), %rcx
cmpq %rcx, %r8
je 0x2a206
cmpb $0x3a, (%r8)
jne 0x2a206
movb (%rax), %cl
xorl %edx, %edx
cmpb $0x32, %cl
setne %dl
shll $0x6, %edx
orl $0x89, %edx
cmpb $0x31, %cl
movl $0x49, %ecx
cmovnel %edx, %ecx
movq 0x58(%rsp), %rdx
orw 0x10(%rdx), %cx
movw %cx, 0x10(%rdx)
cmpb $0x59, 0x2(%rax)
jne 0x2a120
orl $0x200, %ecx            # imm = 0x200
movq 0x58(%rsp), %rdx
movw %cx, 0x10(%rdx)
movzbl 0x1(%r8), %ecx
movq (%r14), %rdx
testb $0x8, 0x1(%rdx,%rcx,2)
jne 0x2a206
incq %r8
movq %r8, %rcx
subq %rax, %rcx
movq 0x18(%r13), %rsi
cmpq %rsi, %rcx
jae 0x2a15b
movzbl (%rax,%rcx), %edi
testb $0x20, 0x1(%rdx,%rdi,2)
jne 0x2a15b
incq %rcx
cmpq %rsi, %rcx
jb 0x2a145
movq %rsi, %rcx
movb $0x0, (%rax,%rcx)
movq 0x28(%r13), %rax
subq %r8, %rax
leaq (%rcx,%rax), %r14
incq %r14
testl %r14d, %r14d
je 0x2a206
leaq 0x6c(%r13), %rsi
movq 0x58(%rsp), %r15
movq %r15, %rdi
movl $0x5a, %edx
movl %r14d, %ecx
callq 0x2de61
testl %eax, %eax
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmovsl %eax, %ebx
movslq %r14d, %rdi
jmp 0x2a20d
callq 0x4050
movl $0x4b, (%rax)
jmp 0x2a1bb
movl %eax, %ebp
negl %ebp
callq 0x4050
movl %ebp, (%rax)
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
movl %ebp, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0x4750
movl $0x3, 0xd0(%r14)
movq %rbx, %rdi
callq 0x4340
xorl %ebp, %ebp
cmpl $0x0, 0xd4(%r14)
sete %bpl
orl $-0x2, %ebp
jmp 0x2a1bb
xorl %edi, %edi
jmp 0x2a20d
xorl %edi, %edi
movq 0x58(%rsp), %r15
cmpl $0x0, 0x64(%r13)
je 0x2a23a
movq 0x28(%r13), %rsi
movq 0x70(%r13), %r8
addq %rsi, %rdi
addq 0x18(%r13), %rsi
movq %r15, %rdx
movl $0x1, %ecx
callq 0x2839b
testl %eax, %eax
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmovsl %eax, %ebx
movl %ebx, %ebp
jmp 0x2a1bb