// File: /workspace/github_c_makefile_star2_O2/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 $0x78, %rsp
movq %rsi, %r15
movq %rdi, %r13
leaq 0x58(%rsp), %rax
movq %rdx, (%rax)
leaq 0x10(%rdi), %r14
movl 0x4c(%r13), %eax
leal -0x3(%rax), %ecx
cmpl $0xe, %ecx
ja 0x237ca
leaq 0x55e3f(%rip), %rdx     # 0x79258
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq 0x58(%rsp), %rbp
cmpq $0x0, (%r14)
je 0x234ff
movq %r14, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x21889
movl %eax, %ebx
andq $0x0, (%r14)
jmp 0x2349d
testq %r15, %r15
setne %bpl
movq 0x58(%rsp), %r12
movq 0x38(%r13), %rdi
movq %r12, %rsi
callq 0x1e543
movl %eax, %ebx
testl %eax, %eax
setns %al
andb %bpl, %al
cmpb $0x1, %al
jne 0x2349d
movl 0x8(%r12), %ecx
cmpl $-0x1, %ecx
jl 0x237ee
movl (%r15), %eax
cmpl %eax, %ecx
jge 0x237ee
movl 0x1c(%r12), %ecx
cmpl %eax, %ecx
jge 0x237ee
cmpl $-0x2, %ecx
jg 0x234d5
jmp 0x237ee
testl %ebx, %ebx
jns 0x234d5
jmp 0x23baf
movq 0x38(%r13), %rdi
leaq 0x58(%rsp), %rsi
callq 0x3340c
testl %eax, %eax
js 0x237d7
movl %eax, %ebx
movq 0x58(%rsp), %rdi
pushq $0x1
popq %rdx
movl %edx, %esi
callq 0x1e8b9
testl %eax, %eax
js 0x23bac
movq 0x80(%r13), %rdx
testq %rdx, %rdx
je 0x23baf
movq 0x58(%rsp), %rsi
movq %r15, %rdi
callq 0x1f61d
testl %eax, %eax
je 0x23402
jmp 0x23719
movq 0x40(%r13), %rbx
testq %rbx, %rbx
je 0x23553
cmpl $0x2, 0x54(%r13)
jne 0x235b6
movq 0x38(%r13), %rax
cmpq $0x0, 0x68(%rax)
je 0x235b6
movq %r13, %rdi
callq 0x1f383
testl %eax, %eax
js 0x23ba1
movq 0x38(%r13), %rdi
movq 0x68(%rdi), %rsi
xorl %edx, %edx
callq 0xc07b
testq %rax, %rax
js 0x23bac
movq 0x38(%r13), %rax
andq $0x0, 0x68(%rax)
movq %r13, %rdi
pushq $0x2
popq %rsi
movq %r14, %rdx
callq 0x12938
testl %eax, %eax
js 0x237b6
movq %r14, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x21889
movl %eax, %ebx
andq $0x0, (%r14)
testl %eax, %eax
jns 0x234d5
movq 0x8(%r13), %rcx
pushq $0x3
popq %rdi
leaq 0x570c1(%rip), %rsi     # 0x7a654
leaq 0x570c8(%rip), %rdx     # 0x7a662
xorl %eax, %eax
callq 0x110c6
testq %r15, %r15
je 0x23baf
cmpl $0x0, 0x4(%r15)
jne 0x23553
jmp 0x23baf
movq (%rbx), %rax
testq %rax, %rax
jne 0x23603
movq %r15, (%rbx)
incl 0x40(%r15)
cmpq $0x0, 0x38(%r15)
jne 0x235dc
movq %r15, %rdi
callq 0x6933d
testl %eax, %eax
js 0x23bac
leaq 0x48(%rbx), %rdi
xorl %esi, %esi
leaq 0x5e59(%rip), %rdx      # 0x29442
movq %r13, %rcx
callq 0x4920
testl %eax, %eax
jne 0x23bac
movl $0x1, 0x50(%rbx)
movq (%rbx), %rax
cmpq %r15, %rax
jne 0x2385d
movq 0x68(%rbx), %r12
testq %r12, %r12
jne 0x2369f
movq %rbx, 0x50(%rsp)
movl 0xd4(%rbx), %ebx
testl %ebx, %ebx
jne 0x23ba5
movq 0x50(%rsp), %rbx
leaq 0x78(%rbx), %r12
movq %r12, %rdi
callq 0x4750
movl 0xd0(%rbx), %ebx
movq %r12, %rdi
callq 0x4340
cmpl $0x3, %ebx
je 0x23bc0
movq 0x50(%rsp), %rax
movq 0x40(%rax), %rdi
callq 0x2bca5
testq %rax, %rax
je 0x23bac
movq %rax, %rbx
movq %r12, 0x68(%rsp)
movq %rax, %rdi
callq 0x2bfc2
movq %rax, %r12
movq 0x50(%rsp), %rax
movq %r12, 0x68(%rax)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2bfa2
testq %r12, %r12
movq 0x50(%rsp), %rbx
je 0x23bc4
movl 0x70(%rbx), %eax
movl 0x18(%r12), %ecx
cmpl %ecx, %eax
jge 0x236da
movslq %eax, %rcx
incl %eax
imulq $0x50, %rcx, %rsi
addq 0x10(%r12), %rsi
movl %eax, 0x70(%rbx)
movq %rbp, %rdi
callq 0x1dfcb
testq %rax, %rax
je 0x23bac
movq %rbx, %rbp
movl 0x70(%rbx), %eax
movl 0x18(%r12), %ecx
jmp 0x236dd
movq %rbx, %rbp
xorl %ebx, %ebx
cmpl %ecx, %eax
jne 0x234d5
leaq 0x18(%rbp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x4750
movq 0x60(%rbp), %rax
movq %rax, (%r12)
movq %r12, 0x60(%rbp)
movq 0x50(%rsp), %rdi
callq 0x4340
andq $0x0, 0x68(%rbp)
andl $0x0, 0x70(%rbp)
jmp 0x234d5
pushq $-0x2
popq %rax
cmovsl %eax, %ebx
jmp 0x23baf
movq 0x40(%r13), %r15
testq %r15, %r15
jne 0x23755
xorl %ecx, %ecx
cmpl $0x11, %eax
sete %cl
leal 0x3e(,%rcx,2), %edi
callq 0x233be
movq %rax, 0x40(%r13)
testq %rax, %rax
je 0x23bac
movq %rax, %r15
movl 0x4c(%r13), %eax
movq 0x58(%rsp), %r12
cmpl $0x10, %eax
jne 0x2379a
cmpq $0x0, 0x20(%r13)
je 0x2379a
cmpq $0x0, (%r14)
pushq $-0x1
popq %rbx
je 0x23baf
movq 0x10(%r15), %rdi
callq 0x45c0
movq 0x10(%r14), %rax
movq %rax, 0x10(%r15)
movups (%r14), %xmm0
movups %xmm0, (%r15)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
andq $0x0, 0x10(%r14)
jmp 0x23800
pushq $0x2
popq %rsi
movq %r13, %rdi
movq %r15, %rdx
callq 0x12938
pushq $-0x1
popq %rbx
cmpl $-0x1, %eax
je 0x23baf
jge 0x23800
movl %eax, %ebx
jmp 0x23baf
callq 0x4050
movl $0x20, (%rax)
jmp 0x237f9
callq 0x4050
movl $0x8, (%rax)
jmp 0x237f9
movq 0x38(%r13), %rdi
callq 0x451f0
cmpl $0x1, %eax
pushq $-0x1
popq %rbx
sbbl $0x0, %ebx
jmp 0x23baf
callq 0x4050
movl $0x22, (%rax)
pushq $-0x3
jmp 0x23bae
movq 0x10(%r15), %rbp
movb (%rbp), %al
cmpb 0x78(%r15), %al
jne 0x23bac
leaq 0x1(%rbp), %rax
movq %rax, 0x68(%rsp)
cmpl $0x0, 0x7c(%r15)
movq %r12, 0x60(%rsp)
je 0x23858
leaq 0x56ec0(%rip), %rsi     # 0x7a6ed
movq %rbp, %rdi
callq 0x48f0
testq %rax, %rax
je 0x23858
movq %rax, %r12
decq %r12
movq %rax, %rcx
movzbl (%rcx), %eax
cmpl $0x20, %eax
je 0x23850
cmpl $0x9, %eax
jne 0x2387a
incq %rcx
incq %r12
jmp 0x23843
xorl %r12d, %r12d
jmp 0x2388a
leaq 0x56df0(%rip), %rsi     # 0x7a654
leaq 0x56378(%rip), %rdx     # 0x79be3
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
jmp 0x23bac
movq %rcx, 0x68(%rsp)
movb $0x40, -0x1(%rcx)
movq 0x10(%r15), %rbp
subq %rbp, %r12
movq %r15, 0x50(%rsp)
movq (%r15), %rbx
cmpq %rbx, %r12
movq %rbx, %r15
cmovaq %r12, %r15
cmpq %rbx, %r12
jae 0x238c9
movsbl (%rbp,%r12), %edi
callq 0x28b20
testl %eax, %eax
jne 0x238b5
incq %r12
jmp 0x2389c
movb $0x0, (%rbp,%r12)
movq 0x50(%rsp), %rax
movq %r12, (%rax)
incq %r12
movq %r12, %r15
cmpq %rbx, %r15
movq %rbx, %r12
cmovaq %r15, %r12
cmpq %rbx, %r15
jae 0x238ef
movsbl (%rbp,%r15), %edi
callq 0x28b20
testl %eax, %eax
je 0x238ec
incq %r15
jmp 0x238d3
movq %r15, %r12
addq %r12, %rbp
movq 0x50(%rsp), %rax
movq %rbp, 0x28(%rax)
subq %r12, %rbx
movq %rbx, 0x18(%rax)
andq $0x0, 0x30(%rax)
leaq 0x30(%rax), %rbp
pushq $0x2
popq %r12
pushq $0x2b
popq %rbx
pushq $0x3e
popq %r15
movq %r13, %rdi
movl %r12d, %esi
movq %r14, %rdx
callq 0x12938
testl %eax, %eax
js 0x23954
movq 0x20(%r13), %rdi
movsbl (%rdi), %ecx
movl 0x4c(%r13), %eax
cmpl $0x11, %eax
movl %r15d, %edx
cmovel %ebx, %edx
cmpl %ecx, %edx
je 0x2396e
movq (%r14), %rsi
movq %rbp, %rdx
callq 0x21461
testl %eax, %eax
jns 0x23916
jmp 0x23bac
cmpl $-0x1, %eax
movq 0x50(%rsp), %r15
jne 0x23bac
cmpl $0x11, 0x4c(%r13)
jne 0x239d9
jmp 0x23bac
cmpl $0x11, %eax
movq 0x50(%rsp), %r15
jne 0x239d9
movq 0x30(%r15), %rbx
leaq 0x48(%r15), %rbp
andq $0x0, 0x48(%r15)
pushq $0x2
popq %r12
movq %r13, %rdi
movl %r12d, %esi
movq %r14, %rdx
callq 0x12938
testl %eax, %eax
js 0x23bac
movq (%r14), %rsi
cmpq %rbx, %rsi
ja 0x23bac
movq 0x20(%r13), %rdi
movq %rbp, %rdx
callq 0x21461
testl %eax, %eax
js 0x23bac
subq (%r14), %rbx
jne 0x23989
xorl %eax, %eax
cmpq (%rbp), %rax
jae 0x239d9
movq 0x58(%r15), %rcx
addb $-0x21, (%rcx,%rax)
incq %rax
jmp 0x239c6
movq (%r15), %r14
movq 0x10(%r15), %r15
movw $0x4, %bp
cmpq $0x3, %r14
jb 0x23a3b
cmpb $0x2f, -0x2(%r15,%r14)
jne 0x23a3b
movb -0x1(%r15,%r14), %bl
movsbl %bl, %edi
callq 0x291f8
testl %eax, %eax
pushq $-0x2
popq %r12
je 0x23a3f
xorl %eax, %eax
cmpb $0x32, %bl
setne %al
shll $0x6, %eax
orl $0x8d, %eax
cmpb $0x31, %bl
pushq $0x4d
popq %rbp
cmovnel %eax, %ebp
leaq -0x2(%r14), %rax
movq 0x50(%rsp), %rcx
movq %rax, (%rcx)
movb $0x0, -0x2(%r15,%r14)
movq (%rcx), %r14
movq 0x10(%rcx), %r15
jmp 0x23a3f
pushq $-0x2
popq %r12
addq %r15, %r14
movq 0x68(%rsp), %rdx
subq %rdx, %r14
movq 0x50(%rsp), %r15
movq 0x30(%r15), %rax
movq 0x40(%r15), %rcx
movq 0x58(%r15), %rsi
movq %rsi, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movq %rax, 0x30(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rsp)
andq $0x0, 0x48(%rsp)
andq $0x0, 0x28(%rsp)
orq $-0x1, 0x20(%rsp)
orl $-0x1, 0x18(%rsp)
andl $0x0, (%rsp)
movzwl %bp, %ecx
pushq $-0x1
popq %r8
pushq $-0x1
popq %r9
movq 0x60(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x1e077
movl %r12d, %ebx
testl %eax, %eax
js 0x23baf
movl %eax, %ebp
cmpl $0x0, 0x60(%r15)
je 0x23b72
cmpq $0x7, 0x18(%r15)
jb 0x23b72
movq 0x28(%r15), %rbx
movb 0x3(%rbx), %al
orb 0x1(%rbx), %al
cmpb $0x3a, %al
jne 0x23b72
movsbl (%rbx), %edi
callq 0x291f8
testl %eax, %eax
je 0x23b72
addq $0x4, %rbx
leaq 0x70(%rsp), %rsi
pushq $0xa
popq %rdx
movq %rbx, %rdi
callq 0x46d0
testq %rax, %rax
js 0x23b72
movq 0x70(%rsp), %rbx
movq 0x28(%r15), %r14
leaq 0x4(%r14), %rax
cmpq %rax, %rbx
je 0x23b72
cmpb $0x3a, (%rbx)
jne 0x23b72
movb (%r14), %al
xorl %ecx, %ecx
cmpb $0x32, %al
setne %cl
shll $0x6, %ecx
orl $0x89, %ecx
cmpb $0x31, %al
pushq $0x49
popq %rax
cmovnel %ecx, %eax
orw 0x10(%r13), %ax
movw %ax, 0x10(%r13)
cmpb $0x59, 0x2(%r14)
jne 0x23b53
orl $0x200, %eax            # imm = 0x200
movw %ax, 0x10(%r13)
movsbl 0x1(%rbx), %edi
callq 0x291f8
testl %eax, %eax
je 0x23bf7
xorl %edi, %edi
movq 0x50(%rsp), %r15
movq 0x60(%rsp), %r13
jmp 0x23b74
xorl %edi, %edi
cmpl $0x0, 0x64(%r15)
je 0x23b9d
movq 0x28(%r15), %rsi
movq 0x70(%r15), %r8
addq %rsi, %rdi
addq 0x18(%r15), %rsi
pushq $0x1
popq %rcx
movq %r13, %rdx
callq 0x22393
testl %eax, %eax
pushq $-0x2
popq %rax
cmovsl %eax, %ebp
movl %ebp, %ebx
jmp 0x23baf
movl %eax, %ebx
negl %ebx
callq 0x4050
movl %ebx, (%rax)
pushq $-0x2
popq %rbx
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $-0x1
jmp 0x23bae
movq 0x68(%rsp), %r14
movq %r14, %rdi
callq 0x4750
movl $0x3, 0xd0(%rbx)
movq %r14, %rdi
callq 0x4340
movq %rbx, %rax
xorl %ebx, %ebx
cmpl $0x0, 0xd4(%rax)
sete %bl
orl $-0x2, %ebx
jmp 0x23baf
incq %rbx
movq %rbx, %r12
subq %r14, %r12
movq 0x50(%rsp), %rax
movq 0x18(%rax), %r13
cmpq %r12, %r13
movq %r12, %r15
cmovaq %r13, %r15
cmpq %r13, %r12
jae 0x23c2e
movsbl (%r14,%r12), %edi
callq 0x28b20
testl %eax, %eax
jne 0x23c2b
incq %r12
jmp 0x23c13
movq %r12, %r15
movb $0x0, (%r14,%r15)
movq 0x50(%rsp), %rax
movq 0x28(%rax), %rax
subq %rbx, %rax
leaq (%r15,%rax), %r14
incq %r14
testl %r14d, %r14d
je 0x23b64
movq 0x50(%rsp), %r15
leaq 0x6c(%r15), %rsi
pushq $0x5a
popq %rdx
movq 0x60(%rsp), %r13
movq %r13, %rdi
movl %r14d, %ecx
movq %rbx, %r8
callq 0x25813
testl %eax, %eax
pushq $-0x2
popq %rax
cmovsl %eax, %ebp
movslq %r14d, %rdi
jmp 0x23b74