// File: /workspace/github_cpp_makefile_star2_O2/WShabti-Team[P]WShabtiPict/wshabtilib/api/model.cpp
// Function: pictcore::Model::fixRowSeeds()
void Model::fixRowSeeds()
{
    DOUT( L"Before row seeds initial clean up.  Row seeds number: " << static_cast<int>( m_rowSeeds.size() ) << L"\n" );
    for_each( m_rowSeeds.begin(), m_rowSeeds.end(), printRowSeed );

    // remove parameters that don't belong to this model
    for( RowSeedCollection::iterator i_seeds = m_rowSeeds.begin(); i_seeds != m_rowSeeds.end(); ++i_seeds )
    {
        RowSeed::iterator i_seed = i_seeds->begin();
        while( i_seed != i_seeds->end() )
        {
            // find the parameter in the collection, verify the value is within the range
            // if something is not right, remove the seed item
            vector<Parameter*>::iterator param = find( m_parameters.begin(), m_parameters.end(), i_seed->first );

            if( param != m_parameters.end()
            &&  i_seed->second >= 0
            &&  i_seed->second < ( *param )->GetValueCount() )
            {
                ++i_seed;
            }
            else
            {
                i_seed = __map_erase( *i_seeds, i_seed );
            }
        }
    }

    DOUT( L"Before contained row seeds removed. Row seeds number: " << static_cast<int>( m_rowSeeds.size() ) << L"\n" );
    for_each( m_rowSeeds.begin(), m_rowSeeds.end(), printRowSeed );

    // eliminate all seeds contained within other seeds
    RowSeedCollection::iterator first = m_rowSeeds.begin();
    while( first != m_rowSeeds.end() )
    {
        if( first->empty() )
        {
            first = m_rowSeeds.erase( first );
        }
        else
        {
            RowSeedCollection::iterator second = m_rowSeeds.begin();
            while( second != m_rowSeeds.end() )
            {
                if( first == second || !seedContained( *first, *second ) )
                    ++second;
                else
                    second = m_rowSeeds.erase( second );
            }
            ++first;
        }
    }

    DOUT( L"After contained row seeds removed.  Row seeds number: " << static_cast<int>( m_rowSeeds.size() ) << L"\n" );
    for_each( m_rowSeeds.begin(), m_rowSeeds.end(), printRowSeed );

    // check if any seed violates any exclusion
    for( ExclusionCollection::iterator ie = m_exclusions.begin(); ie != m_exclusions.end(); ++ie )
    {
        RowSeedCollection::iterator is = m_rowSeeds.begin();
        while( is != m_rowSeeds.end() )
        {
            if( seedViolatesExclusion( *is, const_cast<Exclusion&>( *ie ) ) )
            {
                is = m_rowSeeds.erase( is );
            }
            else
            {
                ++is;
            }
        }
    }

    DOUT( L"After excl violating seeds removed. Row seeds number: " << static_cast<int>( m_rowSeeds.size() ) << L"\n" );
    for_each( m_rowSeeds.begin(), m_rowSeeds.end(), printRowSeed );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x68(%rdi), %r14
movq %r14, %r13
movq (%r13), %r13
cmpq %r14, %r13
je 0xa825
leaq 0x10(%r13), %r15
movq 0x28(%r13), %r12
leaq 0x18(%r13), %rbp
cmpq %rbp, %r12
je 0xa7c5
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %rsi
leaq 0x20(%r12), %rdx
callq 0x707b
cmpq 0x10(%rbx), %rax
je 0xa815
movl 0x28(%r12), %ecx
testl %ecx, %ecx
js 0xa815
movq (%rax), %rax
cmpl 0x38(%rax), %ecx
jge 0xa815
movq %r12, %rdi
callq 0x6500
movq %rax, %r12
jmp 0xa7da
movq %r15, %rdi
movq %r12, %rsi
callq 0xc7a6
movq %rax, %r12
jmp 0xa7da
movq (%r14), %r15
cmpq %r14, %r15
je 0xa880
cmpq $0x0, 0x38(%r15)
je 0xa870
leaq 0x10(%r15), %r12
movq (%r14), %r13
cmpq %r14, %r13
je 0xa86b
cmpq %r13, %r15
je 0xa865
leaq 0x10(%r13), %rsi
movq %r12, %rdi
callq 0xc28a
testb %al, %al
je 0xa865
movq %r14, %rdi
movq %r13, %rsi
callq 0xc76e
movq %rax, %r13
jmp 0xa83b
movq (%r13), %r13
jmp 0xa83b
movq (%r15), %r15
jmp 0xa828
movq %r14, %rdi
movq %r15, %rsi
callq 0xc76e
movq %rax, %r15
jmp 0xa828
movq 0x38(%rbx), %r15
addq $0x28, %rbx
cmpq %rbx, %r15
je 0xa8cc
movq (%r14), %r13
leaq 0x20(%r15), %r12
cmpq %r14, %r13
je 0xa8bf
leaq 0x10(%r13), %rdi
movq %r12, %rsi
callq 0xc2d9
testb %al, %al
je 0xa8b9
movq %r14, %rdi
movq %r13, %rsi
callq 0xc76e
movq %rax, %r13
jmp 0xa894
movq (%r13), %r13
jmp 0xa894
movq %r15, %rdi
callq 0x6500
movq %rax, %r15
jmp 0xa888
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop