// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/htslib/sam.c
// Function: sam_read1
int sam_read1(htsFile *fp, bam_hdr_t *h, bam1_t *b)
{
    switch (fp->format.format) {
    case bam: {
        int r = bam_read1(fp->fp.bgzf, b);
        if (r >= 0) {
            if (b->core.tid  >= h->n_targets || b->core.tid  < -1 ||
                b->core.mtid >= h->n_targets || b->core.mtid < -1)
                return -3;
        }
        return r;
        }

    case cram: {
        int ret = cram_get_bam_seq(fp->fp.cram, &b);
        return ret >= 0
            ? ret
            : (cram_eof(fp->fp.cram) ? -1 : -2);
    }

    case sam: {
        int ret;
err_recover:
        if (fp->line.l == 0) {
            ret = hts_getline(fp, KS_SEP_LINE, &fp->line);
            if (ret < 0) return -1;
        }
        ret = sam_parse1(&fp->line, h, b);
        fp->line.l = 0;
        if (ret < 0) {
            if (hts_verbose >= 1)
                fprintf(stderr, "[W::%s] parse error at line %lld\n", __func__, (long long)fp->lineno);
            if (h->ignore_sam_err) goto err_recover;
        }
        return ret;
        }

    default:
        abort();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x44(%rax), %eax
movl %eax, -0x30(%rbp)
subl $0x3, %eax
je 0xa9da2
jmp 0xa9cd9
movl -0x30(%rbp), %eax
subl $0x4, %eax
je 0xa9cf0
jmp 0xa9ce3
movl -0x30(%rbp), %eax
subl $0x6, %eax
je 0xa9d53
jmp 0xa9e4f
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0xa6190
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jl 0xa9d48
movq -0x20(%rbp), %rax
movl (%rax), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xa9d3a
movq -0x20(%rbp), %rax
cmpl $-0x1, (%rax)
jl 0xa9d3a
movq -0x20(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xa9d3a
movq -0x20(%rbp), %rax
cmpl $-0x1, 0x14(%rax)
jge 0xa9d46
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0xa9e54
jmp 0xa9d48
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xa9e54
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0xb92e0
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jl 0xa9d75
movl -0x28(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0xa9d97
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x8af80
movl %eax, %edx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xa9e54
jmp 0xa9da4
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0xa9dd9
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x10, %rdx
movl $0x2, %esi
callq 0x728d0
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jge 0xa9dd7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa9e54
jmp 0xa9dd9
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xa8320
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
cmpl $0x0, -0x2c(%rbp)
jge 0xa9e47
leaq 0x5d1d6(%rip), %rax     # 0x106fe0
cmpl $0x1, (%rax)
jl 0xa9e36
movq 0x5b1ba(%rip), %rax     # 0x104fd0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
leaq 0x3a8ab(%rip), %rsi     # 0xe46d3
leaq 0x3a8c6(%rip), %rdx     # 0xe46f5
movb $0x0, %al
callq 0x6a80
movq -0x18(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0xa9e45
jmp 0xa9da4
jmp 0xa9e47
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xa9e54
callq 0x63b0
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)