// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/sam.c
// Function: bam_plp_push
int bam_plp_push(bam_plp_t iter, const bam1_t *b)
{
    if (iter->error) return -1;
    if (b) {
        if (b->core.tid < 0) { overlap_remove(iter, b); return 0; }
        // Skip only unmapped reads here, any additional filtering must be done in iter->func
        if (b->core.flag & BAM_FUNMAP) { overlap_remove(iter, b); return 0; }
        if (iter->tid == b->core.tid && iter->pos == b->core.pos && iter->mp->cnt > iter->maxcnt)
        {
            overlap_remove(iter, b);
            return 0;
        }
        if (bam_copy1(&iter->tail->b, b) == NULL)
            return -1;
        iter->tail->b.id = iter->id++;
        iter->tail->beg = b->core.pos;
        // Use raw rlen rather than bam_endpos() which adjusts rlen=0 to rlen=1
        iter->tail->end = b->core.pos + bam_cigar2rlen(b->core.n_cigar, bam_get_cigar(b));
        iter->tail->s = g_cstate_null; iter->tail->s.end = iter->tail->end - 1; // initialize cstate_t
        if (b->core.tid < iter->max_tid) {
            hts_log_error("The input is not sorted (chromosomes out of order)");
            iter->error = 1;
            return -1;
        }
        if ((b->core.tid == iter->max_tid) && (iter->tail->beg < iter->max_pos)) {
            hts_log_error("The input is not sorted (reads out of order)");
            iter->error = 1;
            return -1;
        }
        iter->max_tid = b->core.tid; iter->max_pos = iter->tail->beg;
        if (iter->tail->end > iter->pos || iter->tail->b.core.tid > iter->tid) {
            lbnode_t *next = mp_alloc(iter->mp);
            if (!next) {
                iter->error = 1;
                return -1;
            }
            if (iter->plp_construct) {
                if (iter->plp_construct(iter->data, &iter->tail->b,
                                        &iter->tail->cd) < 0) {
                    mp_free(iter->mp, next);
                    iter->error = 1;
                    return -1;
                }
            }
            if (overlap_push(iter, iter->tail) < 0) {
                mp_free(iter->mp, next);
                iter->error = 1;
                return -1;
            }
            iter->tail->next = next;
            iter->tail = iter->tail->next;
        }
    } else iter->is_eof = 1;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x38(%rax)
je 0x444c6
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x44829
cmpq $0x0, -0x18(%rbp)
je 0x44817
movq -0x18(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jge 0x444f4
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x43c20
movl $0x0, -0x4(%rbp)
jmp 0x44829
movq -0x18(%rbp), %rax
movzwl 0x10(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x4451d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x43c20
movl $0x0, -0x4(%rbp)
jmp 0x44829
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x44569
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x44569
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x3c(%rcx), %eax
jle 0x44569
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x43c20
movl $0x0, -0x4(%rbp)
jmp 0x44829
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x33080
cmpq $0x0, %rax
jne 0x4458c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x44829
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, 0x40(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x30(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x50(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movl 0x14(%rax), %edi
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rsi
movq -0x18(%rbp), %rax
movzwl 0x12(%rax), %eax
cltq
addq %rax, %rsi
callq 0x339b0
movq -0x28(%rbp), %rcx
addq %rax, %rcx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x58(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0xc9244(%rip), %rcx     # 0x10d850
movq %rcx, 0x60(%rax)
movq 0xc9241(%rip), %rcx     # 0x10d858
movq %rcx, 0x68(%rax)
movq 0xc923e(%rip), %rcx     # 0x10d860
movq %rcx, 0x70(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x58(%rax), %rcx
subq $0x1, %rcx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x70(%rax)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x1c(%rcx), %eax
jge 0x44683
movl $0x1, %edi
leaq 0xaddda(%rip), %rsi     # 0xf2438
leaq 0xadde0(%rip), %rdx     # 0xf2445
movb $0x0, %al
callq 0x1b030
movq -0x10(%rbp), %rax
movl $0x1, 0x38(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x44829
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x1c(%rcx), %eax
jne 0x446da
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x28(%rcx), %rax
jge 0x446da
movl $0x1, %edi
leaq 0xadd83(%rip), %rsi     # 0xf2438
leaq 0xaddbc(%rip), %rdx     # 0xf2478
movb $0x0, %al
callq 0x1b030
movq -0x10(%rbp), %rax
movl $0x1, 0x38(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x44829
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x50(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x58(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jg 0x4472a
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jle 0x44815
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x434d0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x44758
movq -0x10(%rbp), %rax
movl $0x1, 0x38(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x44829
movq -0x10(%rbp), %rax
cmpq $0x0, 0x70(%rax)
je 0x447b7
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x60(%rcx), %rdi
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rsi
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rdx
addq $0x80, %rdx
callq *%rax
cmpl $0x0, %eax
jge 0x447b5
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x436c0
movq -0x10(%rbp), %rax
movl $0x1, 0x38(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x44829
jmp 0x447b7
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x44840
cmpl $0x0, %eax
jge 0x447f1
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x436c0
movq -0x10(%rbp), %rax
movl $0x1, 0x38(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x44829
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x78(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x78(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x44822
movq -0x10(%rbp), %rax
movl $0x1, 0x30(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)