// File: /workspace/github_c_makefile_star2_O1/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 $0x48, %rsp
movq %rcx, %r13
cmpl $0x0, 0x38(%rdi)
je 0x30ab3
movl $0xffffffff, (%r13)     # imm = 0xFFFFFFFF
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %r15
movq %rsi, %rbp
movq %rdi, %r12
movl $0x0, (%r13)
cmpl $0x0, 0x30(%rdi)
je 0x30ad6
movq 0x8(%r12), %rax
cmpq 0x10(%r12), %rax
je 0x30aa2
leaq 0x8(%r12), %rax
movq %rax, 0x30(%rsp)
movq %r13, 0x20(%rsp)
movq %r15, 0x40(%rsp)
movq %rbp, 0x38(%rsp)
cmpl $0x0, 0x30(%r12)
jne 0x30b11
movl 0x18(%r12), %eax
cmpl %eax, 0x1c(%r12)
jg 0x30b11
jne 0x30aa2
movq 0x28(%r12), %rax
cmpq 0x20(%r12), %rax
jle 0x30aa2
movq 0x8(%r12), %rbp
movq 0x10(%r12), %rax
xorl %r14d, %r14d
cmpq %rax, %rbp
je 0x3109a
movq 0x30(%rsp), %r15
movl 0x8(%rbp), %eax
movl 0x18(%r12), %ecx
cmpl %ecx, %eax
jge 0x30bb6
movq %r12, %rdi
movq %rbp, %rsi
callq 0x311dc
movq 0x78(%r12), %rax
testq %rax, %rax
je 0x30b5e
movq 0x60(%r12), %rdi
leaq 0x80(%rbp), %rdx
movq %rbp, %rsi
callq *%rax
movq 0x78(%rbp), %rax
movq %rax, (%r15)
movq (%r12), %rbx
decl (%rbx)
movq $0x0, 0x78(%rbp)
movl 0x8(%rbx), %eax
cmpl %eax, 0x4(%rbx)
jne 0x30b9f
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x100, %eax            # imm = 0x100
cmovel %eax, %ecx
movl %ecx, 0x8(%rbx)
movq 0x10(%rbx), %rdi
movslq %ecx, %rsi
shlq $0x3, %rsi
callq 0x4840
movq %rax, 0x10(%rbx)
movq 0x10(%rbx), %rax
movslq 0x4(%rbx), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%rbx)
movq %rbp, (%rax,%rcx,8)
jmp 0x31089
jne 0x31082
movq 0x58(%rbp), %rdx
cmpq 0x20(%r12), %rdx
jle 0x30b38
cmpl %ecx, %eax
jne 0x31082
movq 0x50(%rbp), %rax
cmpq 0x20(%r12), %rax
jg 0x31082
movl 0x34(%r12), %eax
cmpl %eax, %r14d
jne 0x30c18
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x100, %eax            # imm = 0x100
cmovel %eax, %ecx
movl %ecx, 0x34(%r12)
movq 0x48(%r12), %rdi
movslq %ecx, %rax
shlq $0x3, %rax
leaq (%rax,%rax,4), %rsi
callq 0x4840
movq %rax, 0x48(%r12)
movq 0x48(%r12), %rax
movslq %r14d, %rcx
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rcx
movq %rbp, (%rax,%rcx)
movq 0x80(%rbp), %rdx
movq %rdx, 0x18(%rax,%rcx)
movq 0x20(%r12), %r13
movq 0x48(%r12), %rdx
leaq (%rdx,%rcx), %rax
movq (%rdx,%rcx), %rdx
movq 0x38(%rdx), %rsi
movzwl 0x12(%rdx), %ecx
movq %rcx, 0x8(%rsp)
leaq (%rsi,%rcx), %r8
movslq 0x60(%rbp), %rdi
cmpq $-0x1, %rdi
movq %r13, 0x18(%rsp)
je 0x30d68
movl (%r8,%rdi,4), %ebx
movl %ebx, %r10d
shrl $0x4, %r10d
movq 0x68(%rbp), %r11
movq %r13, %rcx
subq %r11, %rcx
cmpq %r10, %rcx
jl 0x30e8c
movl %r14d, 0x14(%rsp)
movq %rdx, %rcx
movl 0x14(%rdx), %r9d
cmpl %r9d, %edi
jae 0x3119e
movq %r13, %rdx
movq %rcx, %r14
movl 0x4(%r8,%rdi,4), %ecx
movl %ecx, %r13d
andl $0xf, %r13d
andl $0xf, %ebx
cmpl $0x8, %r13d
je 0x30e59
movl %ecx, %r13d
andl $0xd, %r13d
je 0x30e59
andl $0xb, %ecx
cmpl $0x3, %ecx
je 0x30e59
cmpl $0x8, %ebx
ja 0x30cec
movl $0x181, %ecx            # imm = 0x181
btl %ebx, %ecx
jae 0x30cec
addl %r10d, 0x64(%rbp)
addq %r10, %r11
movq %r11, 0x68(%rbp)
incq %rdi
cmpl %r9d, %edi
movq %rdx, %r13
jae 0x30e78
movq 0x8(%rsp), %rcx
leaq (%rcx,%rdi,4), %r10
addq %rsi, %r10
movq %r14, %rdx
movl 0x14(%rsp), %r14d
movl (%r10), %r11d
movl %r11d, %ebx
andl $0xf, %ebx
cmpl $0x8, %ebx
je 0x30e80
movl %r11d, %ecx
andl $0xd, %ecx
je 0x30e80
movl %r11d, %ecx
andl $0xb, %ecx
cmpl $0x3, %ecx
je 0x30e80
cmpl $0x4, %ebx
je 0x30d4d
cmpl $0x1, %ebx
jne 0x30d55
shrl $0x4, %r11d
addl %r11d, 0x64(%rbp)
incl %edi
addq $0x4, %r10
cmpl %edi, %r9d
ja 0x30d16
movl %r9d, %edi
jmp 0x30e80
movl $0x0, 0x8(%rax)
movl 0x14(%rdx), %edi
cmpq $0x1, %rdi
jne 0x30da9
movl (%r8), %ecx
andl $0xf, %ecx
cmpl $0x8, %ecx
ja 0x30e8c
movl $0x181, %edi            # imm = 0x181
btl %ecx, %edi
jae 0x30e8c
xorl %edi, %edi
movl %edi, 0x60(%rbp)
movq (%rdx), %rcx
movq %rcx, 0x68(%rbp)
movl %edi, 0x64(%rbp)
jmp 0x30e8c
movq (%rdx), %rcx
movq %rcx, 0x68(%rbp)
movl $0x0, 0x64(%rbp)
testq %rdi, %rdi
je 0x3117f
movl (%r8), %r10d
movl %r10d, %r11d
andl $0xf, %r11d
xorl %r9d, %r9d
movb $0x1, %bl
cmpl $0x8, %r11d
je 0x30e46
movl %r10d, %ecx
andl $0xd, %ecx
je 0x30e46
movl %r10d, %ecx
andl $0xb, %ecx
cmpl $0x3, %ecx
je 0x30e46
movq 0x8(%rsp), %rcx
leaq (%rsi,%rcx), %rbx
addq $0x4, %rbx
leaq -0x1(%rdi), %r13
xorl %r9d, %r9d
cmpl $0x4, %r11d
je 0x30e08
cmpl $0x1, %r11d
jne 0x30e10
shrl $0x4, %r10d
addl %r10d, 0x64(%rbp)
cmpq %r9, %r13
je 0x3117f
movl (%rbx,%r9,4), %r10d
movl %r10d, %r11d
andl $0xf, %r11d
incq %r9
cmpl $0x8, %r11d
je 0x30e40
movl %r10d, %ecx
andl $0xd, %ecx
je 0x30e40
movl %r10d, %ecx
andl $0xb, %ecx
cmpl $0x3, %ecx
jne 0x30dfc
cmpq %rdi, %r9
setb %bl
testb %bl, %bl
je 0x3117f
movl %r9d, 0x60(%rbp)
movq 0x18(%rsp), %r13
jmp 0x30e8c
cmpl $0x8, %ebx
ja 0x30e6c
movl $0x181, %ecx            # imm = 0x181
btl %ebx, %ecx
jae 0x30e6c
addl %r10d, 0x64(%rbp)
addq %r10, %r11
movq %r11, 0x68(%rbp)
incl %edi
movq %rdx, %r13
movq %r14, %rdx
movl 0x14(%rsp), %r14d
movl %edi, 0x60(%rbp)
cmpl %r9d, %edi
jae 0x311bd
movslq 0x60(%rbp), %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), %rbx
addq %rbx, %rcx
decq %rcx
cmpq %r13, %rcx
jne 0x30ff6
movslq 0x60(%rbp), %rdi
leal 0x1(%rdi), %ecx
movl 0x14(%rdx), %r13d
cmpl %r13d, %ecx
jae 0x30ff6
movl 0x4(%r8,%rdi,4), %ecx
movl %ecx, %r8d
andl $0xf, %r8d
shrl $0x4, %ecx
cmpl $0x2, %r10d
je 0x30f3d
cmpl $0x2, %r8d
jne 0x30f3d
negl %ecx
movl %ecx, 0xc(%rax)
addq $0x2, %rdi
cmpl %r13d, %edi
jae 0x30ff6
movq 0x8(%rsp), %rcx
leaq (%rcx,%rdi,4), %rcx
addq %rcx, %rsi
movl (%rsi), %ecx
movl %ecx, %r8d
andl $0xf, %r8d
cmpl $0x2, %r8d
jne 0x30ff6
shrl $0x4, %ecx
subl %ecx, 0xc(%rax)
incl %edi
addq $0x4, %rsi
cmpl %edi, %r13d
ja 0x30f14
jmp 0x30ff6
cmpl $0x6, %r8d
je 0x30f93
cmpl $0x1, %r8d
jne 0x30ff6
movl %ecx, 0xc(%rax)
addl $0x2, %edi
cmpl %r13d, %edi
jae 0x30ff6
movslq %edi, %rcx
movq 0x8(%rsp), %r8
leaq (%r8,%rcx,4), %rcx
addq %rcx, %rsi
movl (%rsi), %ecx
movl %ecx, %r8d
andl $0xf, %r8d
cmpl $0x6, %r8d
je 0x30f86
cmpl $0x1, %r8d
jne 0x30ff6
shrl $0x4, %ecx
addl %ecx, 0xc(%rax)
incl %edi
addq $0x4, %rsi
cmpl %edi, %r13d
ja 0x30f6b
jmp 0x30ff6
addq $0x2, %rdi
cmpl %r13d, %edi
jae 0x30ff6
movq 0x8(%rsp), %rcx
leaq (%rcx,%rdi,4), %rcx
addq %rcx, %rsi
movl $0x0, 0x8(%rsp)
movl (%rsi), %r8d
movl %r8d, %ecx
andl $0xf, %ecx
cmpl $0x1, %ecx
jne 0x30fc9
shrl $0x4, %r8d
addl %r8d, 0x8(%rsp)
jmp 0x30fe0
cmpl $0x8, %ecx
je 0x30feb
movl %r8d, %ecx
andl $0xd, %ecx
je 0x30feb
andl $0xb, %r8d
cmpl $0x3, %r8d
je 0x30feb
incl %edi
addq $0x4, %rsi
cmpl %edi, %r13d
ja 0x30fb0
movl 0x8(%rsp), %ecx
testl %ecx, %ecx
jle 0x30ff6
movl %ecx, 0xc(%rax)
cmpl $0x7, %r10d
setne %cl
testb $0x7, %r11b
setne %sil
testb %cl, %sil
jne 0x3101e
movq 0x18(%rsp), %rcx
subl %ebx, %ecx
addl 0x64(%rbp), %ecx
movl %ecx, 0x8(%rax)
movq 0x20(%rsp), %r13
jmp 0x3104e
andl $0xe, %r11d
cmpl $0x2, %r11d
movq 0x20(%rsp), %r13
jne 0x3104e
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), %ecx
incl %ecx
movl %ecx, 0x14(%rax)
xorl %ecx, %ecx
movq 0x18(%rsp), %rsi
cmpq %rsi, (%rdx)
sete %cl
movl 0x14(%rax), %edx
andl $-0x3, %edx
leal (%rdx,%rcx,2), %ecx
movl %ecx, 0x14(%rax)
xorl %edx, %edx
cmpq %rsi, 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 %r14d
movq (%r15), %r15
addq $0x78, %r15
movq (%r15), %rbp
movq 0x10(%r12), %rax
cmpq %rax, %rbp
jne 0x30b2c
movl %r14d, (%r13)
movl 0x18(%r12), %ecx
movq 0x38(%rsp), %rbp
movl %ecx, (%rbp)
movq 0x20(%r12), %rcx
movq 0x40(%rsp), %r15
movq %rcx, (%r15)
movq 0x8(%r12), %rcx
cmpq %rax, %rcx
je 0x31107
movl 0x18(%r12), %edx
cmpl 0x8(%rcx), %edx
jle 0x31107
movl $0x1, %ebx
movl $0x1, %edi
leaq 0x69df0(%rip), %rsi     # 0x9aecd
leaq 0x69df8(%rip), %rdx     # 0x9aedc
xorl %eax, %eax
callq 0x14378
movl $0x1, 0x38(%r12)
movl $0xffffffff, (%r13)     # imm = 0xFFFFFFFF
movq $0x0, 0x28(%rsp)
jmp 0x31164
movl 0x8(%rcx), %edx
cmpl %edx, 0x18(%r12)
jge 0x3111c
movl %edx, 0x18(%r12)
movq 0x50(%rcx), %rdx
jmp 0x31130
movq 0x20(%r12), %rsi
movq 0x50(%rcx), %rdi
leaq 0x1(%rsi), %rdx
cmpq %rdi, %rsi
cmovlq %rdi, %rdx
movq %rdx, 0x20(%r12)
testl %r14d, %r14d
je 0x3114b
movq 0x48(%r12), %rax
movq %rax, 0x28(%rsp)
movl $0x1, %ebx
jmp 0x31164
xorl %edx, %edx
cmpl $0x0, 0x30(%r12)
setne %dl
cmpq %rax, %rcx
leal (%rdx,%rdx,2), %ebx
movl $0x0, %eax
cmovnel %eax, %ebx
testl %ebx, %ebx
je 0x30aef
cmpl $0x3, %ebx
je 0x30aa2
movq 0x28(%rsp), %rax
jmp 0x30aa4
leaq 0x6a72c(%rip), %rdi     # 0x9b8b2
leaq 0x69b86(%rip), %rsi     # 0x9ad13
leaq 0x6a6e0(%rip), %rcx     # 0x9b874
movl $0x1588, %edx           # imm = 0x1588
callq 0x42f0
leaq 0x6a70a(%rip), %rdi     # 0x9b8af
leaq 0x69b67(%rip), %rsi     # 0x9ad13
leaq 0x6a6c1(%rip), %rcx     # 0x9b874
movl $0x158e, %edx           # imm = 0x158E
callq 0x42f0
leaq 0x6a6eb(%rip), %rdi     # 0x9b8af
leaq 0x69b48(%rip), %rsi     # 0x9ad13
leaq 0x6a6a2(%rip), %rcx     # 0x9b874
movl $0x159e, %edx           # imm = 0x159E
callq 0x42f0