// File: /workspace/github_c_makefile_star2_O3/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 %rdi, %r15
movabsq $0x7fffffff7fffffff, %r12 # imm = 0x7FFFFFFF7FFFFFFF
cmpl $0x0, (%rdi)
jle 0x3197d
movq %rcx, %r14
movq %rsi, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movq %r8, 0x18(%rsp)
movq 0x18(%r15), %rax
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
xorl %ebp, %ebp
xorl %ebx, %ebx
movq (%rax,%rbp,2), %rcx
cmpq 0x10(%r15), %rcx
jne 0x318ae
movq 0x8(%r15), %rcx
movl (%rcx,%rbp), %ecx
cmpl 0x4(%r15), %ecx
jne 0x318ae
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 0x31419
movq 0x30(%r15), %rcx
movq %rax, (%rcx,%rbp,2)
movq 0x20(%r15), %rax
movq (%rax,%rbp,2), %rax
cmpl $0x0, 0x38(%rax)
jne 0x3198d
movq 0x30(%r15), %rax
cmpq $0x0, (%rax,%rbp,2)
je 0x31899
movl 0x4(%rsp), %eax
movq 0x8(%r15), %rcx
movl %eax, (%rcx,%rbp)
movq 0x20(%rsp), %rcx
jmp 0x318a6
movq 0x8(%r15), %rax
movl $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 0x318db
movq 0x8(%r15), %rcx
movl (%rcx,%rbp), %ecx
cmpl %r13d, %ecx
jae 0x318ce
movq (%rax,%rbp,2), %r12
movl %ecx, %r13d
jmp 0x318db
jne 0x318db
movq (%rax,%rbp,2), %rcx
cmpq %r12, %rcx
cmovlq %rcx, %r12
incq %rbx
movslq (%r15), %rcx
addq $0x4, %rbp
cmpq %rcx, %rbx
jl 0x3182d
movq %r12, 0x10(%r15)
movl %r13d, 0x4(%r15)
xorl %eax, %eax
movabsq $0x7fffffff7fffffff, %rcx # imm = 0x7FFFFFFF7FFFFFFF
cmpq %rcx, %r12
je 0x31992
movq 0x8(%rsp), %rcx
movl %r13d, (%rcx)
movq 0x10(%rsp), %rcx
movq %r12, (%rcx)
cmpl $0x0, (%r15)
movq 0x18(%rsp), %rdi
jle 0x31992
movq 0x10(%r15), %rcx
xorl %edx, %edx
xorl %eax, %eax
movq 0x18(%r15), %rsi
cmpq %rcx, (%rsi,%rdx,8)
jne 0x31960
movq 0x8(%r15), %rsi
movl (%rsi,%rdx,4), %esi
cmpl 0x4(%r15), %esi
jne 0x31960
movq 0x28(%r15), %rsi
movl (%rsi,%rdx,4), %esi
movl %esi, (%r14,%rdx,4)
movq 0x30(%r15), %rsi
movq (%rsi,%rdx,8), %rsi
movq %rsi, (%rdi,%rdx,8)
incl %eax
jmp 0x31970
movl $0x0, (%r14,%rdx,4)
movq $0x0, (%rdi,%rdx,8)
incq %rdx
movslq (%r15), %rsi
cmpq %rsi, %rdx
jl 0x3192e
jmp 0x31992
movq %r12, 0x10(%r15)
movl $0xffffffff, 0x4(%r15)  # imm = 0xFFFFFFFF
xorl %eax, %eax
jmp 0x31992
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq