// File: /workspace/github_cpp_makefile_star2_O1/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), %rax
cmpq %r14, %rax
je 0x9eb4
movq 0x28(%rax), %r12
movq %rax, (%rsp)
leaq 0x18(%rax), %rbp
cmpq %rbp, %r12
je 0x9ea8
movq (%rsp), %rax
leaq 0x10(%rax), %r15
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %rsi
leaq 0x20(%r12), %rdx
callq 0x6317
cmpq 0x10(%rbx), %rax
je 0x9e82
movl 0x28(%r12), %ecx
testl %ecx, %ecx
js 0x9e82
movq (%rax), %rax
cmpl 0x38(%rax), %ecx
jge 0x9e82
movq %r12, %rdi
callq 0x54b0
movq %rax, %r13
jmp 0x9ea0
movq %rbp, %r13
cmpq %r12, %rbp
je 0x9ea0
movq %r12, %rdi
callq 0x54b0
movq %rax, %r13
movq %r15, %rdi
movq %r12, %rsi
callq 0xee2a
movq %r13, %r12
cmpq %rbp, %r13
jne 0x9e4c
movq (%rsp), %rax
movq (%rax), %rax
jmp 0x9e2a
movq (%r14), %r15
cmpq %r14, %r15
je 0x9f1a
cmpq $0x0, 0x38(%r15)
je 0x9f07
movq (%r14), %r12
cmpq %r14, %r12
je 0x9f02
leaq 0x10(%r15), %r13
cmpq %r12, %r15
je 0x9ef9
leaq 0x10(%r12), %rsi
movq %r13, %rdi
callq 0xbe5c
testb %al, %al
je 0x9ef9
movq (%r12), %rbp
movq %r14, %rdi
movq %r12, %rsi
callq 0xd50a
movq %rbp, %r12
jmp 0x9efd
movq (%r12), %r12
cmpq %r14, %r12
jne 0x9ecf
movq (%r15), %r15
jmp 0x9eb7
movq (%r15), %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0xd50a
movq %r12, %r15
jmp 0x9eb7
movq 0x38(%rbx), %r15
addq $0x28, %rbx
cmpq %rbx, %r15
je 0x9f6a
movq (%r14), %r13
cmpq %r14, %r13
je 0x9f5a
leaq 0x20(%r15), %r12
leaq 0x10(%r13), %rdi
movq %r12, %rsi
callq 0xbeb8
movq (%r13), %rbp
testb %al, %al
je 0x9f52
movq %r14, %rdi
movq %r13, %rsi
callq 0xd50a
movq %rbp, %r13
cmpq %r14, %rbp
jne 0x9f33
movq %r15, %rdi
callq 0x54b0
movq %rax, %r15
cmpq %rbx, %rax
jne 0x9f27
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop