// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/sam.c
// Function: bam_mplp64_auto
int bam_mplp64_auto(bam_mplp_t iter, int *_tid, hts_pos_t *_pos, int *n_plp, const bam_pileup1_t **plp)
{
    int i, ret = 0;
    hts_pos_t new_min_pos = HTS_POS_MAX;
    uint32_t new_min_tid = (uint32_t)-1;
    for (i = 0; i < iter->n; ++i) {
        if (iter->pos[i] == iter->min_pos && iter->tid[i] == iter->min_tid) {
            int tid;
            hts_pos_t pos;
            iter->plp[i] = bam_plp64_auto(iter->iter[i], &tid, &pos, &iter->n_plp[i]);
            if ( iter->iter[i]->error ) return -1;
            if (iter->plp[i]) {
                iter->tid[i] = tid;
                iter->pos[i] = pos;
            } else {
                iter->tid[i] = 0;
                iter->pos[i] = 0;
            }
        }
        if (iter->plp[i]) {
            if (iter->tid[i] < new_min_tid) {
                new_min_tid = iter->tid[i];
                new_min_pos = iter->pos[i];
            } else if (iter->tid[i] == new_min_tid && iter->pos[i] < new_min_pos) {
                new_min_pos = iter->pos[i];
            }
        }
    }
    iter->min_pos = new_min_pos;
    iter->min_tid = new_min_tid;
    if (new_min_pos == HTS_POS_MAX) return 0;
    *_tid = new_min_tid; *_pos = new_min_pos;
    for (i = 0; i < iter->n; ++i) {
        if (iter->pos[i] == iter->min_pos && iter->tid[i] == iter->min_tid) {
            n_plp[i] = iter->n_plp[i], plp[i] = iter->plp[i];
            ++ret;
        } else n_plp[i] = 0, plp[i] = 0;
    }
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, 0x18(%rsp)
movq %rcx, %r14
movq %rdx, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, %r15
movabsq $0x7fffffff7fffffff, %r13 # imm = 0x7FFFFFFF7FFFFFFF
pushq $-0x1
popq %rbx
xorl %ebp, %ebp
xorl %r12d, %r12d
movslq (%r15), %rax
cmpq %rax, %r12
jge 0x2873d
movq 0x18(%r15), %rax
movq (%rax,%rbp,2), %rcx
cmpq 0x10(%r15), %rcx
jne 0x28704
movq 0x8(%r15), %rcx
movl (%rcx,%rbp), %ecx
cmpl 0x4(%r15), %ecx
jne 0x28704
movq 0x20(%r15), %rax
movq (%rax,%rbp,2), %rdi
movq 0x28(%r15), %rcx
addq %rbp, %rcx
leaq 0x4(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x28333
movq 0x30(%r15), %rcx
movq %rax, (%rcx,%rbp,2)
movq 0x20(%r15), %rax
movq (%rax,%rbp,2), %rax
cmpl $0x0, 0x38(%rax)
jne 0x287bb
movq 0x30(%r15), %rax
cmpq $0x0, (%rax,%rbp,2)
je 0x286f2
movl 0x4(%rsp), %eax
movq 0x8(%r15), %rcx
movl %eax, (%rcx,%rbp)
movq 0x20(%rsp), %rcx
jmp 0x286fc
movq 0x8(%r15), %rax
andl $0x0, (%rax,%rbp)
xorl %ecx, %ecx
movq 0x18(%r15), %rax
movq %rcx, (%rax,%rbp,2)
movq 0x30(%r15), %rcx
cmpq $0x0, (%rcx,%rbp,2)
je 0x2872d
movq 0x8(%r15), %rcx
movl (%rcx,%rbp), %ecx
cmpl %ebx, %ecx
jae 0x28720
movq (%rax,%rbp,2), %r13
jmp 0x2872f
jne 0x2872d
movq (%rax,%rbp,2), %rax
cmpq %r13, %rax
cmovlq %rax, %r13
movl %ebx, %ecx
incq %r12
addq $0x4, %rbp
movl %ecx, %ebx
jmp 0x28676
movq %r13, 0x10(%r15)
movl %ebx, 0x4(%r15)
xorl %eax, %eax
movabsq $0x7fffffff7fffffff, %rcx # imm = 0x7FFFFFFF7FFFFFFF
cmpq %rcx, %r13
je 0x287be
movq 0x8(%rsp), %rax
movl %ebx, (%rax)
movq 0x10(%rsp), %rax
movq %r13, (%rax)
xorl %ecx, %ecx
xorl %eax, %eax
movq 0x18(%rsp), %rsi
movslq (%r15), %rdx
cmpq %rdx, %rcx
jge 0x287be
movq 0x18(%r15), %rdx
movq (%rdx,%rcx,8), %rdx
cmpq 0x10(%r15), %rdx
jne 0x287ac
movq 0x8(%r15), %rdx
movl (%rdx,%rcx,4), %edx
cmpl 0x4(%r15), %edx
jne 0x287ac
movq 0x28(%r15), %rdx
movl (%rdx,%rcx,4), %edx
movl %edx, (%r14,%rcx,4)
movq 0x30(%r15), %rdx
movq (%rdx,%rcx,8), %rdx
movq %rdx, (%rsi,%rcx,8)
incl %eax
jmp 0x287b6
andl $0x0, (%r14,%rcx,4)
andq $0x0, (%rsi,%rcx,8)
incq %rcx
jmp 0x2876e
pushq $-0x1
popq %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq