// File: /workspace/github_cpp_makefile_star2_O3/zeeev[P]DASVC/bamtools/src/utils/bamtools_pileup_engine.cpp
// Function: BamTools::PileupEngine::PileupEnginePrivate::ClearOldData()
void PileupEngine::PileupEnginePrivate::ClearOldData(void) {
 
    // remove any alignments that end before our CurrentPosition
    // N.B. - BAM positions are 0-based, half-open. GetEndPosition() returns a 1-based position,
    //        while our CurrentPosition is 0-based. For example, an alignment with 'endPosition' of
    //        100 does not overlap a 'CurrentPosition' of 100, and should be discarded.

    size_t i = 0;
    size_t j = 0;
    const size_t numAlignments = CurrentAlignments.size();
    while ( i < numAlignments ) {

        // skip over alignment if its (1-based) endPosition is <= to (0-based) CurrentPosition
        // i.e. this entry will not be saved upon vector resize
        const int endPosition = CurrentAlignments[i].GetEndPosition();
        if ( endPosition <= CurrentPosition ) {
            ++i;
            continue;
        }

        // otherwise alignment ends after CurrentPosition
        // move it towards vector beginning, at index j
        if ( i != j )
            CurrentAlignments[j] = CurrentAlignments[i];

        // increment our indices
        ++i;
        ++j;
    }

    // 'squeeze' vector to size j, discarding all remaining alignments in the container
    CurrentAlignments.resize(j);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
leaq 0x8(%rdi), %rax
movq %rax, (%rsp)
movq 0x10(%rdi), %rax
subq 0x8(%rdi), %rax
je 0x64fad
movq %rdi, %rbx
sarq $0x3, %rax
movabsq $-0x7d05f417d05f417d, %r12 # imm = 0x82FA0BE82FA0BE83
imulq %rax, %r12
cmpq $0x1, %r12
adcq $0x0, %r12
xorl %r15d, %r15d
xorl %r14d, %r14d
xorl %r13d, %r13d
movq %rdi, 0x10(%rsp)
movq %r12, 0x8(%rsp)
movq 0x8(%rbx), %rdi
addq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x27520
cmpl 0x4(%rbx), %eax
jle 0x64f98
cmpq %r13, %r14
je 0x64f95
movq (%rsp), %rax
movq (%rax), %rbx
leaq (%rbx,%r15), %r12
imulq $0x158, %r13, %rbp      # imm = 0x158
movq %r13, 0x18(%rsp)
leaq (%rbx,%rbp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x27350
leaq (%rbx,%r15), %rsi
addq $0x28, %rsi
movl -0x8(%rsi), %eax
leaq (%rbx,%rbp), %rdi
addq $0x28, %rdi
movl %eax, -0x8(%rdi)
callq 0x27350
leaq (%rbx,%rbp), %rdi
addq $0x48, %rdi
leaq (%rbx,%r15), %rsi
addq $0x48, %rsi
callq 0x27350
addq %rbx, %rbp
addq $0x68, %rbp
addq %r15, %rbx
addq $0x68, %rbx
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x27350
movl $0x88, %eax
leaq (%rax,%r13), %rdi
leaq (%r12,%rax), %rsi
callq 0x27350
movups 0x40(%rbx), %xmm0
movups %xmm0, 0x40(%rbp)
movl $0xb8, %eax
leaq (%rax,%r13), %rdi
leaq (%r12,%rax), %rsi
callq 0x4f944
movq 0x68(%rbx), %rax
movq %rax, 0x68(%rbp)
movl 0x70(%rbx), %eax
movl %eax, 0x70(%rbp)
movl $0xe0, %eax
leaq (%rax,%r13), %rdi
leaq (%r12,%rax), %rsi
callq 0x27350
movl $0x100, %eax            # imm = 0x100
leaq (%rax,%r13), %rdi
leaq (%r12,%rax), %rsi
callq 0x27350
movb 0xc8(%rbx), %al
movb %al, 0xc8(%rbp)
movups 0xb8(%rbx), %xmm0
movq 0x10(%rsp), %rbx
movups %xmm0, 0xb8(%rbp)
movl $0x138, %eax            # imm = 0x138
addq %rax, %r13
addq %rax, %r12
movq %r13, %rdi
movq 0x18(%rsp), %r13
movq %r12, %rsi
movq 0x8(%rsp), %r12
callq 0x27350
incq %r13
incq %r14
addq $0x158, %r15            # imm = 0x158
cmpq %r14, %r12
jne 0x64e67
jmp 0x64fb0
xorl %r13d, %r13d
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x27220
movq (%rsp), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x653f6
leaq 0x20(%rsp), %rdi
callq 0x27920
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x27920
movq %rbx, %rdi
callq 0x27b10
movq %rax, %rdi
callq 0x2e1cd
nop