// File: /workspace/github_c_makefile_star2_O1/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
cmpl $0x0, (%rdi)
jle 0x32a9c
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %ebp, %ebp
xorl %r12d, %r12d
movq 0x18(%r15), %rax
movq (%rax,%rbp,2), %rax
cmpq 0x10(%r15), %rax
jne 0x32a52
movq 0x8(%r15), %rax
movl (%rax,%rbp), %eax
cmpl 0x4(%r15), %eax
jne 0x32a52
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 0x325c6
movq 0x30(%r15), %rcx
movq %rax, (%rcx,%rbp,2)
movq 0x20(%r15), %rax
movq (%rax,%rbp,2), %rax
cmpl $0x0, 0x38(%rax)
jne 0x32b2b
movq 0x30(%r15), %rax
cmpq $0x0, (%rax,%rbp,2)
je 0x32a3d
movl 0x4(%rsp), %eax
movq 0x8(%r15), %rcx
movl %eax, (%rcx,%rbp)
movq 0x20(%rsp), %rax
jmp 0x32a4a
movq 0x8(%r15), %rax
movl $0x0, (%rax,%rbp)
xorl %eax, %eax
movq 0x18(%r15), %rcx
movq %rax, (%rcx,%rbp,2)
movq 0x30(%r15), %rax
cmpq $0x0, (%rax,%rbp,2)
je 0x32a83
movq 0x8(%r15), %rax
movl (%rax,%rbp), %ecx
cmpl %ebx, %ecx
jae 0x32a72
movq 0x18(%r15), %rax
movq (%rax,%rbp,2), %r13
jmp 0x32a85
jne 0x32a83
movq 0x18(%r15), %rax
movq (%rax,%rbp,2), %rax
cmpq %r13, %rax
cmovlq %rax, %r13
movl %ebx, %ecx
incq %r12
movslq (%r15), %rax
addq $0x4, %rbp
movl %ecx, %ebx
cmpq %rax, %r12
jl 0x329cd
jmp 0x32aa1
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %r13, 0x10(%r15)
movl %ecx, 0x4(%r15)
xorl %eax, %eax
movabsq $0x7fffffff7fffffff, %rdx # imm = 0x7FFFFFFF7FFFFFFF
cmpq %rdx, %r13
je 0x32b30
movq 0x8(%rsp), %rdx
movl %ecx, (%rdx)
movq 0x10(%rsp), %rcx
movq %r13, (%rcx)
cmpl $0x0, (%r15)
movq 0x18(%rsp), %rdi
jle 0x32b30
movq 0x10(%r15), %rcx
xorl %edx, %edx
xorl %eax, %eax
movq 0x18(%r15), %rsi
cmpq %rcx, (%rsi,%rdx,8)
jne 0x32b0e
movq 0x8(%r15), %rsi
movl (%rsi,%rdx,4), %esi
cmpl 0x4(%r15), %esi
jne 0x32b0e
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 0x32b1e
movl $0x0, (%r14,%rdx,4)
movq $0x0, (%rdi,%rdx,8)
incq %rdx
movslq (%r15), %rsi
cmpq %rsi, %rdx
jl 0x32adc
jmp 0x32b30
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq