// File: /workspace/github_cpp_makefile_star2_O3/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 0x68(%rdi), %r15
cmpq %r14, %r15
je 0x9dcd
movq 0x28(%r15), %r13
leaq 0x18(%r15), %r12
cmpq %r12, %r13
je 0x9d64
leaq 0x10(%r15), %rax
movq %rax, (%rsp)
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %rsi
leaq 0x20(%r13), %rdx
callq 0x635d
cmpq 0x10(%rbx), %rax
je 0x9d40
movl 0x28(%r13), %ecx
testl %ecx, %ecx
js 0x9d40
movq (%rax), %rax
cmpl 0x38(%rax), %ecx
jge 0x9d40
movq %r13, %rdi
callq 0x54b0
movq %rax, %r13
jmp 0x9d5f
cmpq %r13, %r12
je 0x9d64
movq %r13, %rdi
callq 0x54b0
movq %rax, %rbp
movq (%rsp), %rdi
movq %r13, %rsi
callq 0xec62
movq %rbp, %r13
cmpq %r12, %r13
jne 0x9d0c
movq (%r15), %r15
cmpq %r14, %r15
jne 0x9cf7
movq (%r14), %r15
jmp 0x9dcd
cmpq $0x0, 0x38(%r15)
je 0x9dbc
movq (%r14), %r12
cmpq %r14, %r12
je 0x9db7
leaq 0x10(%r15), %r13
cmpq %r12, %r15
je 0x9dae
leaq 0x10(%r12), %rsi
movq %r13, %rdi
callq 0xbd59
testb %al, %al
je 0x9dae
movq (%r12), %rbp
movq %r14, %rdi
movq %r12, %rsi
callq 0xd3e0
movq %rbp, %r12
jmp 0x9db2
movq (%r12), %r12
cmpq %r14, %r12
jne 0x9d84
movq (%r15), %r15
jmp 0x9dcd
movq (%r15), %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0xd3e0
movq %r12, %r15
cmpq %r14, %r15
jne 0x9d71
movq 0x38(%rbx), %r15
addq $0x28, %rbx
cmpq %rbx, %r15
je 0x9e22
movq (%r14), %r13
cmpq %r14, %r13
je 0x9e12
leaq 0x20(%r15), %r12
leaq 0x10(%r13), %rdi
movq %r12, %rsi
callq 0xbdad
movq (%r13), %rbp
testb %al, %al
je 0x9e0a
movq %r14, %rdi
movq %r13, %rsi
callq 0xd3e0
movq %rbp, %r13
cmpq %r14, %rbp
jne 0x9deb
movq %r15, %rdi
callq 0x54b0
movq %rax, %r15
cmpq %rbx, %rax
jne 0x9ddf
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop