// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/sam.c
// Function: bam_plp64_next
const bam_pileup1_t *bam_plp64_next(bam_plp_t iter, int *_tid, hts_pos_t *_pos, int *_n_plp)
{
    if (iter->error) { *_n_plp = -1; return NULL; }
    *_n_plp = 0;
    if (iter->is_eof && iter->head == iter->tail) return NULL;
    while (iter->is_eof || iter->max_tid > iter->tid || (iter->max_tid == iter->tid && iter->max_pos > iter->pos)) {
        int n_plp = 0;
        // write iter->plp at iter->pos
        lbnode_t **pptr = &iter->head;
        while (*pptr != iter->tail) {
            lbnode_t *p = *pptr;
            if (p->b.core.tid < iter->tid || (p->b.core.tid == iter->tid && p->end <= iter->pos)) { // then remove
                overlap_remove(iter, &p->b);
                if (iter->plp_destruct)
                    iter->plp_destruct(iter->data, &p->b, &p->cd);
                *pptr = p->next; mp_free(iter->mp, p);
            }
            else {
                if (p->b.core.tid == iter->tid && p->beg <= iter->pos) { // here: p->end > pos; then add to pileup
                    if (n_plp == iter->max_plp) { // then double the capacity
                        iter->max_plp = iter->max_plp? iter->max_plp<<1 : 256;
                        iter->plp = (bam_pileup1_t*)realloc(iter->plp, sizeof(bam_pileup1_t) * iter->max_plp);
                    }
                    iter->plp[n_plp].b = &p->b;
                    iter->plp[n_plp].cd = p->cd;
                    if (resolve_cigar2(iter->plp + n_plp, iter->pos, &p->s)) ++n_plp; // actually always true...
                }
                pptr = &(*pptr)->next;
            }
        }
        *_n_plp = n_plp; *_tid = iter->tid; *_pos = iter->pos;
        // update iter->tid and iter->pos
        if (iter->head != iter->tail) {
            if (iter->tid > iter->head->b.core.tid) {
                hts_log_error("Unsorted input. Pileup aborts");
                iter->error = 1;
                *_n_plp = -1;
                return NULL;
            }
        }
        if (iter->tid < iter->head->b.core.tid) { // come to a new reference sequence
            iter->tid = iter->head->b.core.tid; iter->pos = iter->head->beg; // jump to the next reference
        } else if (iter->pos < iter->head->beg) { // here: tid == head->b.core.tid
            iter->pos = iter->head->beg; // jump to the next position
        } else ++iter->pos; // scan contiguously
        // return
        if (n_plp) return iter->plp;
        if (iter->is_eof && iter->head == iter->tail) break;
    }
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %rbx
cmpl $0x0, 0x38(%rdi)
je 0x2fd54
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %r15
movl $0x0, (%rbx)
movl 0x30(%rdi), %eax
testl %eax, %eax
je 0x2fd6e
movq 0x8(%r15), %rcx
cmpq 0x10(%r15), %rcx
je 0x2fd43
leaq 0x8(%r15), %rcx
movq %rcx, 0x30(%rsp)
movl $0x100, %r14d           # imm = 0x100
movq %rbx, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
testl %eax, %eax
jne 0x2fda6
movl 0x18(%r15), %eax
cmpl %eax, 0x1c(%r15)
jg 0x2fda6
jne 0x2fd43
movq 0x28(%r15), %rax
cmpq 0x20(%r15), %rax
jle 0x2fd43
movq 0x8(%r15), %rbp
cmpq 0x10(%r15), %rbp
je 0x3030b
xorl %r12d, %r12d
movq 0x30(%rsp), %r13
movl 0x18(%r15), %eax
cmpl %eax, 0x8(%rbp)
jge 0x2fe33
movq 0x68(%r15), %rdi
movq %rbp, %rsi
callq 0x30406
movq 0x78(%r15), %rax
testq %rax, %rax
je 0x2fdea
movq 0x60(%r15), %rdi
leaq 0x80(%rbp), %rdx
movq %rbp, %rsi
callq *%rax
movq 0x78(%rbp), %rax
movq %rax, (%r13)
movq (%r15), %rbx
decl (%rbx)
movq $0x0, 0x78(%rbp)
movl 0x4(%rbx), %ecx
cmpl 0x8(%rbx), %ecx
jne 0x2ffac
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
cmovel %r14d, %eax
movl %eax, 0x8(%rbx)
movq 0x10(%rbx), %rdi
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x4840
movq %rax, 0x10(%rbx)
movl 0x4(%rbx), %ecx
jmp 0x2ffb0
jne 0x302b6
movq 0x20(%r15), %rax
cmpq %rax, 0x58(%rbp)
jle 0x2fdc5
cmpq %rax, 0x50(%rbp)
jg 0x302b6
movq 0x48(%r15), %rax
cmpl 0x34(%r15), %r12d
jne 0x2fe7d
leal (%r12,%r12), %ecx
testl %r12d, %r12d
cmovel %r14d, %ecx
movl %ecx, 0x34(%r15)
movslq %ecx, %rcx
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rsi
movq %rax, %rdi
callq 0x4840
movq %rax, 0x48(%r15)
movslq %r12d, %rcx
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rcx
movq %rbp, (%rax,%rcx)
movq 0x80(%rbp), %rdx
movq %rdx, 0x18(%rax,%rcx)
movq 0x20(%r15), %rdi
movq 0x48(%r15), %rdx
leaq (%rdx,%rcx), %rax
movq (%rdx,%rcx), %rdx
movq 0x38(%rdx), %rsi
movzwl 0x12(%rdx), %ecx
movq %rcx, (%rsp)
leaq (%rsi,%rcx), %r8
movslq 0x60(%rbp), %r9
cmpq $-0x1, %r9
movq %r12, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
je 0x2ffc2
movl (%r8,%r9,4), %ebx
movl %ebx, %r10d
shrl $0x4, %r10d
movq 0x68(%rbp), %r11
movq %rdi, %rcx
subq %r11, %rcx
cmpq %r10, %rcx
jl 0x300ab
movl 0x14(%rdx), %edi
cmpl %edi, %r9d
jae 0x303e7
movl 0x4(%r8,%r9,4), %r14d
movl %r14d, %ecx
andl $0xf, %ecx
andl $0xf, %ebx
cmpl $0x8, %ecx
je 0x3007c
movl %r14d, %ecx
andl $0xd, %ecx
je 0x3007c
andl $0xb, %r14d
cmpl $0x3, %r14d
je 0x3007c
cmpl $0x8, %ebx
ja 0x2ff3e
movl $0x181, %ecx            # imm = 0x181
btl %ebx, %ecx
jae 0x2ff3e
addl %r10d, 0x64(%rbp)
addq %r10, %r11
movq %r11, 0x68(%rbp)
incq %r9
cmpl %edi, %r9d
jae 0x30099
movq (%rsp), %rcx
leaq (%rcx,%r9,4), %r10
addq %rsi, %r10
movl (%r10), %r11d
movl %r11d, %ebx
andl $0xf, %ebx
cmpl $0x8, %ebx
je 0x30099
movl %r11d, %ecx
andl $0xd, %ecx
je 0x30099
movl %r11d, %ecx
andl $0xb, %ecx
cmpl $0x3, %ecx
je 0x30099
cmpl $0x4, %ebx
je 0x2ff93
cmpl $0x1, %ebx
jne 0x2ff9b
shrl $0x4, %r11d
addl %r11d, 0x64(%rbp)
incl %r9d
addq $0x4, %r10
cmpl %r9d, %edi
ja 0x2ff5c
jmp 0x303c5
movq 0x10(%rbx), %rax
leal 0x1(%rcx), %edx
movl %edx, 0x4(%rbx)
movslq %ecx, %rcx
movq %rbp, (%rax,%rcx,8)
jmp 0x302bd
movq %rdi, %r14
movl $0x0, 0x8(%rax)
movl 0x14(%rdx), %edi
cmpq $0x1, %rdi
jne 0x30012
movl (%r8), %edi
andl $0xf, %edi
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
cmpl $0x8, %edi
ja 0x30077
movl $0x181, %ecx            # imm = 0x181
btl %edi, %ecx
movq %r14, %rdi
jae 0x300ab
xorl %r9d, %r9d
movl %r9d, 0x60(%rbp)
movq (%rdx), %rcx
movq %rcx, 0x68(%rbp)
movl %r9d, 0x64(%rbp)
jmp 0x300ab
movq (%rdx), %rcx
movq %rcx, 0x68(%rbp)
movl $0x0, 0x64(%rbp)
testq %rdi, %rdi
je 0x303a6
xorl %r10d, %r10d
xorl %r9d, %r9d
movl (%r8,%r9,4), %r11d
movl %r11d, %ebx
andl $0xf, %ebx
cmpl $0x8, %ebx
je 0x30073
movl %r11d, %ecx
andl $0xd, %ecx
je 0x30073
movl %r11d, %ecx
andl $0xb, %ecx
cmpl $0x3, %ecx
je 0x30073
cmpl $0x4, %ebx
je 0x3005b
cmpl $0x1, %ebx
jne 0x30066
shrl $0x4, %r11d
addl %r11d, %r10d
movl %r10d, 0x64(%rbp)
incq %r9
cmpq %r9, %rdi
jne 0x3002f
jmp 0x303a6
movl %r9d, 0x60(%rbp)
movq %r14, %rdi
jmp 0x300ab
cmpl $0x8, %ebx
ja 0x3008f
movl $0x181, %ecx            # imm = 0x181
btl %ebx, %ecx
jae 0x3008f
addl %r10d, 0x64(%rbp)
addq %r10, %r11
movq %r11, 0x68(%rbp)
incl %r9d
movl %r9d, 0x60(%rbp)
cmpl %edi, %r9d
movq 0x8(%rsp), %rdi
jae 0x303c8
movslq %r9d, %rcx
movl (%r8,%rcx,4), %r11d
movl %r11d, %r10d
andl $0xf, %r10d
movl %r11d, %ecx
shrl $0x4, %ecx
movl 0x14(%rax), %r9d
movl $0x0, 0xc(%rax)
andl $-0xa, %r9d
movl %r9d, 0x14(%rax)
movq 0x68(%rbp), %r14
addq %r14, %rcx
decq %rcx
cmpq %rdi, %rcx
jne 0x30216
movslq 0x60(%rbp), %rbx
leal 0x1(%rbx), %ecx
movl 0x14(%rdx), %edi
cmpl %edi, %ecx
jae 0x30216
movl 0x4(%r8,%rbx,4), %r8d
movl %r8d, %r12d
andl $0xf, %r12d
shrl $0x4, %r8d
cmpl $0x2, %r10d
je 0x3015d
cmpl $0x2, %r12d
jne 0x3015d
negl %r8d
movl %r8d, 0xc(%rax)
addq $0x2, %rbx
cmpl %edi, %ebx
jae 0x30216
movq (%rsp), %rcx
leaq (%rcx,%rbx,4), %rcx
addq %rcx, %rsi
movl (%rsi), %r12d
movl %r12d, %ecx
andl $0xf, %ecx
cmpl $0x2, %ecx
jne 0x30216
shrl $0x4, %r12d
subl %r12d, %r8d
movl %r8d, 0xc(%rax)
incl %ebx
addq $0x4, %rsi
cmpl %ebx, %edi
ja 0x30131
jmp 0x30216
cmpl $0x6, %r12d
je 0x301b5
cmpl $0x1, %r12d
jne 0x30216
movl %r8d, 0xc(%rax)
addl $0x2, %ebx
cmpl %edi, %ebx
jae 0x30216
movslq %ebx, %rcx
movq (%rsp), %r12
leaq (%r12,%rcx,4), %rcx
addq %rcx, %rsi
movl (%rsi), %ecx
movl %ecx, %r12d
andl $0xf, %r12d
cmpl $0x6, %r12d
je 0x301a9
cmpl $0x1, %r12d
jne 0x30216
shrl $0x4, %ecx
addl %ecx, %r8d
movl %r8d, 0xc(%rax)
incl %ebx
addq $0x4, %rsi
cmpl %ebx, %edi
ja 0x3018a
jmp 0x30216
addq $0x2, %rbx
cmpl %edi, %ebx
jae 0x30216
movq (%rsp), %rcx
leaq (%rcx,%rbx,4), %rcx
addq %rcx, %rsi
xorl %ecx, %ecx
movl (%rsi), %r8d
movl %r8d, %r12d
andl $0xf, %r12d
cmpl $0x1, %r12d
jne 0x301e3
shrl $0x4, %r8d
addl %r8d, %ecx
jmp 0x30205
cmpl $0x8, %r12d
je 0x3020f
movl %ecx, %r12d
movl %r8d, %ecx
andl $0xd, %ecx
je 0x302cd
andl $0xb, %r8d
cmpl $0x3, %r8d
movl %r12d, %ecx
je 0x3020f
incl %ebx
addq $0x4, %rsi
cmpl %ebx, %edi
ja 0x301ca
testl %ecx, %ecx
jle 0x30216
movl %ecx, 0xc(%rax)
cmpl $0x7, %r10d
setne %cl
testb $0x7, %r11b
setne %sil
testb %cl, %sil
jne 0x30247
movq 0x8(%rsp), %rdi
movl %edi, %ecx
subl %r14d, %ecx
addl 0x64(%rbp), %ecx
movl %ecx, 0x8(%rax)
movl $0x100, %r14d           # imm = 0x100
movq 0x10(%rsp), %r12
jmp 0x30284
andl $0xe, %r11d
cmpl $0x2, %r11d
movl $0x100, %r14d           # imm = 0x100
movq 0x10(%rsp), %r12
movq 0x8(%rsp), %rdi
jne 0x30284
xorl %ecx, %ecx
cmpl $0x3, %r10d
sete %cl
movl %r9d, %esi
orl $0x1, %esi
movl %esi, 0x14(%rax)
movl 0x64(%rbp), %esi
movl %esi, 0x8(%rax)
leal (%r9,%rcx,8), %r9d
incl %r9d
movl %r9d, 0x14(%rax)
xorl %ecx, %ecx
cmpq %rdi, (%rdx)
sete %cl
andl $-0x3, %r9d
leal (%r9,%rcx,2), %ecx
movl %ecx, 0x14(%rax)
xorl %edx, %edx
cmpq %rdi, 0x70(%rbp)
sete %dl
andl $-0x5, %ecx
leal (%rcx,%rdx,4), %ecx
movl %ecx, 0x14(%rax)
movl 0x60(%rbp), %ecx
movl %ecx, 0x20(%rax)
incl %r12d
movq (%r13), %rbp
addq $0x78, %rbp
movq %rbp, %r13
movq (%r13), %rbp
cmpq 0x10(%r15), %rbp
jne 0x2fdbc
jmp 0x302d5
movl %r12d, %ecx
jmp 0x3020f
movq 0x8(%r15), %rcx
movq 0x28(%rsp), %rbx
movl %r12d, (%rbx)
movl 0x18(%r15), %r8d
movq 0x18(%rsp), %rsi
movl %r8d, (%rsi)
movq 0x20(%r15), %rax
movq 0x20(%rsp), %rdx
movq %rax, (%rdx)
cmpq %rbp, %rcx
je 0x30327
movl 0x8(%rcx), %edi
movb $0x1, %r9b
cmpl %edi, %r8d
jle 0x30330
jmp 0x30377
movl $0x0, (%rbx)
movl 0x18(%r15), %r8d
movl %r8d, (%rsi)
movq 0x20(%r15), %rax
movq %rax, (%rdx)
xorl %r12d, %r12d
movq %rbp, %rcx
jmp 0x3032a
movq %rcx, %rbp
movl 0x8(%rbp), %edi
xorl %r9d, %r9d
cmpl %edi, %r8d
jge 0x3033f
movl %edi, 0x18(%r15)
movq 0x50(%rcx), %rcx
jmp 0x3034e
movq 0x50(%rcx), %rdi
leaq 0x1(%rax), %rcx
cmpq %rdi, %rax
cmovlq %rdi, %rcx
movq %rcx, 0x20(%r15)
testl %r12d, %r12d
jne 0x3036e
movl 0x30(%r15), %eax
testl %eax, %eax
sete %cl
orb %cl, %r9b
jne 0x2fd8c
jmp 0x2fd43
movq 0x48(%r15), %rax
jmp 0x2fd45
leaq 0x67b62(%rip), %rsi     # 0x97ee0
leaq 0x67b6a(%rip), %rdx     # 0x97eef
movl $0x1, %edi
xorl %eax, %eax
callq 0x13de5
xorl %eax, %eax
movl $0x1, 0x38(%r15)
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
jmp 0x2fd45
leaq 0x6850c(%rip), %rdi     # 0x988b9
leaq 0x67972(%rip), %rsi     # 0x97d26
leaq 0x684c0(%rip), %rcx     # 0x9887b
movl $0x1588, %edx           # imm = 0x1588
callq 0x42f0
movl %edi, 0x60(%rbp)
leaq 0x684e7(%rip), %rdi     # 0x988b6
leaq 0x67950(%rip), %rsi     # 0x97d26
leaq 0x6849e(%rip), %rcx     # 0x9887b
movl $0x159e, %edx           # imm = 0x159E
callq 0x42f0
leaq 0x684c8(%rip), %rdi     # 0x988b6
leaq 0x67931(%rip), %rsi     # 0x97d26
leaq 0x6847f(%rip), %rcx     # 0x9887b
movl $0x158e, %edx           # imm = 0x158E
callq 0x42f0