// File: /workspace/github_c_makefile_star2_O1/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, %rbx
leaq 0x60(%rsp), %rax
movq %rdx, (%rax)
leaq 0x10(%rdi), %r14
movl 0x4c(%rbx), %r12d
leal -0x3(%r12), %eax
cmpl $0xe, %eax
ja 0x2a86f
leaq 0x6fda7(%rip), %rcx     # 0x9a1dc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x60(%rsp), %r12
cmpq $0x0, (%r14)
je 0x2a50f
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x280b4
movl %eax, %ebp
movq $0x0, (%r14)
jmp 0x2a58c
testq %r15, %r15
setne %r13b
movq 0x60(%rsp), %r12
movq 0x38(%rbx), %rdi
movq %r12, %rsi
callq 0x23b61
movl %eax, %ebp
testl %eax, %eax
setns %al
andb %r13b, %al
cmpb $0x1, %al
jne 0x2a58c
movl 0x8(%r12), %ecx
movl (%r15), %eax
cmpl %eax, %ecx
setge %dl
cmpl $-0x1, %ecx
setl %cl
orb %dl, %cl
jne 0x2a4c2
movl 0x1c(%r12), %ecx
cmpl %eax, %ecx
setl %al
cmpl $-0x1, %ecx
setge %cl
testb %cl, %al
jne 0x2a58c
callq 0x4050
movl $0x22, (%rax)
movl $0xfffffffd, %ebp       # imm = 0xFFFFFFFD
jmp 0x2a58c
movq 0x38(%rbx), %rdi
leaq 0x60(%rsp), %rsi
callq 0x40244
testl %eax, %eax
js 0x2a578
movl %eax, %ebp
movq 0x60(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0x23fae
testl %eax, %eax
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmovsl %eax, %ebp
jmp 0x2a58c
movq 0x40(%rbx), %r13
testq %r13, %r13
je 0x2a6fa
cmpl $0x2, 0x54(%rbx)
jne 0x2a5bb
movq 0x38(%rbx), %rax
cmpq $0x0, 0x68(%rax)
je 0x2a5bb
movq %rbx, %rdi
callq 0x24c5b
testl %eax, %eax
js 0x2a6c7
movq 0x38(%rbx), %rdi
movq 0x68(%rdi), %rsi
xorl %edx, %edx
callq 0xd9a9
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
testq %rax, %rax
js 0x2a6e8
movq 0x38(%rbx), %rax
movq $0x0, 0x68(%rax)
movl $0x2, %ecx
jmp 0x2a6ed
movq 0x38(%rbx), %rdi
callq 0x55e07
cmpl $0x1, %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
sbbl $0x0, %ebp
movl $0x1, %eax
testl %ebp, %ebp
js 0x2a5ae
movq 0x80(%rbx), %rdx
testq %rdx, %rdx
je 0x2a5ae
movq 0x60(%rsp), %rsi
movq %r15, %rdi
callq 0x24f73
testl %eax, %eax
je 0x2a41c
jmp 0x2ae6c
cmpq $0x0, (%r13)
je 0x2a5f1
cmpq %r15, (%r13)
je 0x2a637
movl $0x1, %edi
leaq 0x7111e(%rip), %rsi     # 0x9b6f2
leaq 0x7069a(%rip), %rdx     # 0x9ac75
xorl %eax, %eax
callq 0x14378
movl $0x1, %ecx
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
jmp 0x2a6ed
movq %r15, (%r13)
incl 0x40(%r15)
cmpq $0x0, 0x38(%r15)
jne 0x2a610
movq %r15, %rdi
callq 0x866a8
testl %eax, %eax
js 0x2a6e3
leaq 0x48(%r13), %rdi
xorl %esi, %esi
leaq 0x9d27(%rip), %rdx      # 0x34344
movq %rbx, %rcx
callq 0x4920
testl %eax, %eax
jne 0x2a6e3
movl $0x1, 0x50(%r13)
jmp 0x2a5c2
movq 0x68(%r13), %rdx
testq %rdx, %rdx
je 0x2a6cd
testq %rdx, %rdx
je 0x2a76e
movslq 0x70(%r13), %rax
cmpl 0x18(%rdx), %eax
movq %rdx, 0x58(%rsp)
jge 0x2a680
leal 0x1(%rax), %ecx
leaq (%rax,%rax,4), %rsi
shlq $0x4, %rsi
addq 0x10(%rdx), %rsi
movl %ecx, 0x70(%r13)
movq %r12, %rdi
callq 0x2357d
movq 0x58(%rsp), %rdx
testq %rax, %rax
je 0x2a6e3
movl 0x70(%r13), %eax
xorl %ecx, %ecx
cmpl 0x18(%rdx), %eax
jne 0x2a6ed
leaq 0x18(%r13), %rdi
movq %rdi, 0x50(%rsp)
callq 0x4750
movq 0x60(%r13), %rax
movq 0x58(%rsp), %rcx
movq %rax, (%rcx)
movq %rcx, 0x60(%r13)
movq 0x50(%rsp), %rdi
callq 0x4340
xorl %ecx, %ecx
movq $0x0, 0x68(%r13)
movl $0x0, 0x70(%r13)
jmp 0x2a6ed
movl %eax, %ebp
negl %ebp
jmp 0x2a6dc
movl 0xd4(%r13), %ebp
testl %ebp, %ebp
je 0x2a7a3
callq 0x4050
movl %ebp, (%rax)
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
movl $0x1, %ecx
testl %ecx, %ecx
je 0x2a760
cmpl $0x2, %ecx
jne 0x2a58c
movq %rbx, %rdi
movl $0x2, %esi
movq %r14, %rdx
callq 0x15cc5
testl %eax, %eax
js 0x2a767
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x280b4
movl %eax, %ebp
movq $0x0, (%r14)
testl %eax, %eax
jns 0x2a58c
movq 0x8(%rbx), %rcx
movl $0x3, %edi
leaq 0x70fb5(%rip), %rsi     # 0x9b6f2
leaq 0x70fbc(%rip), %rdx     # 0x9b700
xorl %eax, %eax
callq 0x14378
testq %r15, %r15
je 0x2a58c
cmpl $0x0, 0x4(%r15)
jne 0x2a6fa
jmp 0x2a58c
xorl %ebp, %ebp
jmp 0x2a58c
movl %eax, %ebp
jmp 0x2a58c
leaq 0x78(%r13), %rbp
movq %rbp, %rdi
callq 0x4750
movl $0x3, 0xd0(%r13)
movq %rbp, %rdi
callq 0x4340
xorl %ebp, %ebp
cmpl $0x0, 0xd4(%r13)
sete %bpl
orl $-0x2, %ebp
jmp 0x2a6e8
leaq 0x78(%r13), %rbp
movq %rbp, %rdi
callq 0x4750
movl 0xd0(%r13), %eax
movl %eax, 0x58(%rsp)
movq %rbp, %rdi
callq 0x4340
cmpl $0x3, 0x58(%rsp)
jne 0x2a7d4
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %edx, %edx
xorl %esi, %esi
jmp 0x2a819
movq 0x40(%r13), %rdi
callq 0x37249
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
testq %rax, %rax
setne %sil
je 0x2a817
movq %rax, %rdi
movq %rax, 0x50(%rsp)
callq 0x37576
movq %rax, 0x58(%rsp)
movq %rax, 0x68(%r13)
movq 0x50(%rsp), %rdi
xorl %esi, %esi
callq 0x37551
movq 0x58(%rsp), %rdx
movb $0x1, %sil
jmp 0x2a819
xorl %edx, %edx
movl $0x1, %ecx
testb %sil, %sil
jne 0x2a644
jmp 0x2a6ed
cmpq $0x0, 0x40(%rbx)
jne 0x2a893
movl $0x1, %edi
movl $0x80, %esi
callq 0x4300
testq %rax, %rax
je 0x2a884
cmpl $0x11, %r12d
sete %cl
movb $0x0, 0x6e(%rax)
movw $0x4342, 0x6c(%rax)     # imm = 0x4342
addb %cl, %cl
addb $0x3e, %cl
movb %cl, 0x78(%rax)
jmp 0x2a886
callq 0x4050
movl $0x20, (%rax)
jmp 0x2a87a
callq 0x4050
movl $0x8, (%rax)
movl $0xfffffffd, %ebp       # imm = 0xFFFFFFFD
jmp 0x2ae74
xorl %eax, %eax
movq %rax, 0x40(%rbx)
testq %rax, %rax
je 0x2a959
movq 0x60(%rsp), %r15
movq 0x40(%rbx), %r13
cmpl $0x10, %r12d
jne 0x2a8de
cmpq $0x0, 0x20(%rbx)
je 0x2a8de
cmpq $0x0, (%r14)
je 0x2a94f
movq 0x10(%r13), %rdi
callq 0x45c0
movq 0x10(%r14), %rax
movq %rax, 0x10(%r13)
movups (%r14), %xmm0
movups %xmm0, (%r13)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq $0x0, 0x10(%r14)
jmp 0x2a8fb
movq %rbx, %rdi
movl $0x2, %esi
movq %r13, %rdx
callq 0x15cc5
cmpl $-0x1, %eax
je 0x2a94f
movl %eax, %ebp
jl 0x2ae74
movq 0x10(%r13), %rdi
movb (%rdi), %al
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
cmpb 0x78(%r13), %al
jne 0x2ae74
leaq 0x1(%rdi), %r12
cmpl $0x0, 0x7c(%r13)
movq %r15, 0x78(%rsp)
je 0x2a963
leaq 0x70e64(%rip), %rsi     # 0x9b78b
callq 0x48f0
testq %rax, %rax
je 0x2a963
movq %rax, %r15
decq %r15
movq %rax, %rcx
movzbl (%rcx), %eax
cmpl $0x20, %eax
je 0x2a947
cmpl $0x9, %eax
jne 0x2a96d
incq %rcx
incq %r15
jmp 0x2a93a
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x2ae74
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
jmp 0x2ae74
movq %r12, 0x68(%rsp)
xorl %r15d, %r15d
jmp 0x2a97a
movq %rcx, 0x68(%rsp)
movb $0x40, -0x1(%rcx)
subq 0x10(%r13), %r15
movq (%r13), %r12
movq %r13, 0x50(%rsp)
movq 0x10(%r13), %r13
cmpq %r12, %r15
jae 0x2a9bf
callq 0x4510
movq (%rax), %rax
movzbl (%r13,%r15), %ecx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x2a9ae
incq %r15
cmpq %r15, %r12
jne 0x2a994
movq %r12, %r15
jmp 0x2a9bf
movb $0x0, (%r13,%r15)
movq 0x50(%rsp), %rax
movq %r15, (%rax)
incq %r15
cmpq %r12, %r15
jae 0x2a9e4
callq 0x4510
movq (%rax), %rax
movzbl (%r13,%r15), %ecx
testb $0x20, 0x1(%rax,%rcx,2)
je 0x2a9e4
incq %r15
cmpq %r15, %r12
jne 0x2a9cc
movq %r12, %r15
addq %r15, %r13
movq 0x50(%rsp), %rax
movq %r13, 0x28(%rax)
movq %rax, %r13
subq %r15, %r12
movq %r12, 0x18(%rax)
movq $0x0, 0x30(%rax)
movl $0x2b, %r12d
movq %rbx, %rdi
movl $0x2, %esi
movq %r14, %rdx
callq 0x15cc5
testl %eax, %eax
jns 0x2aa2f
cmpl $-0x1, %eax
jne 0x2ae74
cmpl $0x11, 0x4c(%rbx)
je 0x2ae74
cmpl $-0x1, %eax
je 0x2aaf8
movq 0x20(%rbx), %rsi
movsbl (%rsi), %eax
cmpl $0x11, 0x4c(%rbx)
movl $0x3e, %ecx
cmovel %r12d, %ecx
cmpl %eax, %ecx
je 0x2aaf8
movq (%r14), %r15
movq 0x30(%r13), %rcx
leaq (%r15,%rcx), %rax
addq $0x2, %rax
cmpq %rcx, %rax
jbe 0x2adf7
cmpq %rax, 0x38(%r13)
jae 0x2aac7
movq %rsi, 0x58(%rsp)
movq %r13, %r12
movq %rax, %r13
shrq %r13
movabsq $0x3fffffffffffffff, %rcx # imm = 0x3FFFFFFFFFFFFFFF
cmpq %rcx, %rax
movl $0x0, %ecx
cmovaq %rcx, %r13
addq %rax, %r13
movq 0x40(%r12), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x2ae74
movq %rax, 0x40(%r12)
movq %r13, 0x38(%r12)
movq %r12, %r13
movl $0x2b, %r12d
movq 0x58(%rsp), %rsi
movq 0x40(%r13), %rdi
addq 0x30(%r13), %rdi
movq %r15, %rdx
callq 0x43c0
movq 0x30(%r13), %rax
addq %r15, %rax
movq %rax, 0x30(%r13)
movq 0x40(%r13), %rcx
movb $0x0, (%rcx,%rax)
testl %r15d, %r15d
jns 0x2aa08
jmp 0x2ae74
cmpl $0x11, 0x4c(%rbx)
jne 0x2abf9
movq 0x30(%r13), %r12
movq $0x0, 0x48(%r13)
movq %rbx, %rdi
movl $0x2, %esi
movq %r14, %rdx
callq 0x15cc5
testl %eax, %eax
js 0x2ae74
movq (%r14), %r15
cmpq %r12, %r15
ja 0x2ae74
movq 0x48(%r13), %rcx
leaq (%r15,%rcx), %rax
addq $0x2, %rax
cmpq %rcx, %rax
jbe 0x2adf7
movq 0x20(%rbx), %rsi
cmpq %rax, 0x50(%r13)
jae 0x2abaa
movq %rsi, 0x70(%rsp)
movq %r12, 0x58(%rsp)
movq %r13, %r12
movq %rax, %r13
shrq %r13
movabsq $0x3fffffffffffffff, %rcx # imm = 0x3FFFFFFFFFFFFFFF
cmpq %rcx, %rax
movl $0x0, %ecx
cmovaq %rcx, %r13
addq %rax, %r13
movq 0x58(%r12), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x2ae74
movq %rax, 0x58(%r12)
movq %r13, 0x50(%r12)
movq %r12, %r13
movq 0x58(%rsp), %r12
movq 0x70(%rsp), %rsi
movq 0x58(%r13), %rdi
addq 0x48(%r13), %rdi
movq %r15, %rdx
callq 0x43c0
movq 0x48(%r13), %rax
addq %r15, %rax
movq %rax, 0x48(%r13)
movq 0x58(%r13), %rcx
movb $0x0, (%rcx,%rax)
testl %r15d, %r15d
js 0x2ae74
subq (%r14), %r12
jne 0x2ab0e
cmpq $0x0, 0x48(%r13)
je 0x2abf9
xorl %eax, %eax
movq 0x58(%r13), %rcx
addb $-0x21, (%rcx,%rax)
incq %rax
cmpq 0x48(%r13), %rax
jb 0x2abe8
movq (%r13), %r14
movw $0x4, %bx
cmpq $0x3, %r14
jb 0x2ac54
movq 0x10(%r13), %r15
cmpb $0x2f, -0x2(%r15,%r14)
jne 0x2ac54
movzbl -0x1(%r15,%r14), %r12d
callq 0x4510
movq (%rax), %rax
testb $0x8, 0x1(%rax,%r12,2)
je 0x2ac54
xorl %eax, %eax
cmpb $0x32, %r12b
setne %al
shll $0x6, %eax
orl $0x8d, %eax
cmpb $0x31, %r12b
movl $0x4d, %ebx
cmovnel %eax, %ebx
leaq -0x2(%r14), %rax
movq %rax, (%r13)
movb $0x0, -0x2(%r15,%r14)
movq 0x10(%r13), %rsi
addq (%r13), %rsi
movq 0x30(%r13), %rax
movq 0x68(%rsp), %rdx
subq %rdx, %rsi
movq 0x40(%r13), %rcx
movq 0x58(%r13), %rdi
xorl %r14d, %r14d
movq %r14, 0x48(%rsp)
movq %rdi, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movq %rax, 0x30(%rsp)
movq %r14, 0x28(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rsp)
movq $-0x1, 0x20(%rsp)
movl $0xffffffff, 0x18(%rsp) # imm = 0xFFFFFFFF
movl $0x0, (%rsp)
movzwl %bx, %ecx
movq 0x78(%rsp), %r15
movq %r15, %rdi
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movq $-0x1, %r9
callq 0x2362f
testl %eax, %eax
js 0x2ae74
movl %eax, %ebx
cmpl $0x0, 0x60(%r13)
je 0x2ae04
cmpq $0x7, 0x18(%r13)
jb 0x2ae09
movq %r13, %rax
movq %r15, %r13
movq 0x28(%rax), %r15
movb 0x3(%r15), %al
orb 0x1(%r15), %al
cmpb $0x3a, %al
jne 0x2ae11
movzbl (%r15), %r12d
callq 0x4510
movq %rax, %r14
movq (%rax), %rax
testb $0x8, 0x1(%rax,%r12,2)
je 0x2ae11
addq $0x4, %r15
leaq 0x80(%rsp), %rsi
movq %r15, %rdi
movl $0xa, %edx
callq 0x46d0
testq %rax, %rax
js 0x2ae11
movq 0x80(%rsp), %r8
movq 0x50(%rsp), %rax
movq 0x28(%rax), %rax
leaq 0x4(%rax), %rcx
cmpq %rcx, %r8
movq %r13, %r15
je 0x2ae88
cmpb $0x3a, (%r8)
jne 0x2ae88
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
orw %cx, 0x10(%r15)
cmpb $0x59, 0x2(%rax)
jne 0x2ad99
orb $0x2, 0x11(%r15)
movzbl 0x1(%r8), %ecx
movq (%r14), %rdx
testb $0x8, 0x1(%rdx,%rcx,2)
jne 0x2ae88
incq %r8
movq %r8, %rcx
subq %rax, %rcx
movq 0x50(%rsp), %rsi
movq 0x18(%rsi), %rsi
cmpq %rsi, %rcx
jae 0x2add9
movzbl (%rax,%rcx), %edi
testb $0x20, 0x1(%rdx,%rdi,2)
jne 0x2add9
incq %rcx
cmpq %rsi, %rcx
jb 0x2adc3
movq %rsi, %rcx
movb $0x0, (%rax,%rcx)
movq 0x50(%rsp), %rdx
movl 0x28(%rdx), %eax
subl %r8d, %ecx
leal (%rcx,%rax), %r14d
incl %r14d
movq %r13, %r15
movq %rdx, %r13
jmp 0x2ae1f
callq 0x4050
movl $0x4b, (%rax)
jmp 0x2ae74
xorl %r8d, %r8d
jmp 0x2ae1f
xorl %r8d, %r8d
xorl %r14d, %r14d
jmp 0x2ae1f
xorl %r8d, %r8d
xorl %r14d, %r14d
movq %r13, %r15
movq 0x50(%rsp), %r13
testl %r14d, %r14d
je 0x2ae42
leaq 0x6c(%r13), %rsi
movq %r15, %rdi
movl $0x5a, %edx
movl %r14d, %ecx
callq 0x2ea98
testl %eax, %eax
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmovsl %eax, %ebx
movl %ebx, %ebp
cmpl $0x0, 0x64(%r13)
je 0x2ae74
movslq %r14d, %rdi
movq 0x28(%r13), %rsi
movq 0x70(%r13), %r8
addq %rsi, %rdi
addq 0x18(%r13), %rsi
movq %r15, %rdx
movl $0x1, %ecx
callq 0x28ed8
testl %eax, %eax
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmovsl %eax, %ebp
movl %ebp, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r8d, %r8d
xorl %r14d, %r14d
jmp 0x2ae1a