// File: 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
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x110(%rbp)
addq $0x68, %rdi
callq 0x1d590
movq -0x110(%rbp), %rdi
movq %rax, -0x10(%rbp)
addq $0x68, %rdi
callq 0x1d5f0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0x45a6(%rip), %rdx      # 0x1b4e0
callq 0x1d890
movq -0x110(%rbp), %rdi
addq $0x68, %rdi
callq 0x1d590
movq %rax, -0x20(%rbp)
movq -0x110(%rbp), %rdi
addq $0x68, %rdi
callq 0x1d5f0
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1d5c0
testb $0x1, %al
jne 0x16f7d
jmp 0x170d9
leaq -0x20(%rbp), %rdi
callq 0x1d620
movq %rax, %rdi
callq 0x1ba10
movq %rax, -0x30(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x1d620
movq %rax, %rdi
callq 0x1ba40
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x9130
testb $0x1, %al
jne 0x16fbd
jmp 0x170c9
movq -0x110(%rbp), %rdi
addq $0x8, %rdi
callq 0x8c90
movq -0x110(%rbp), %rdi
movq %rax, -0x48(%rbp)
addq $0x8, %rdi
callq 0x8cc0
movq %rax, -0x50(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x9160
movq %rax, %rdx
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x91c0
movq -0x110(%rbp), %rdi
movq %rax, -0x40(%rbp)
addq $0x8, %rdi
callq 0x8cc0
movq %rax, -0x58(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x8cf0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x111(%rbp)
jne 0x17034
jmp 0x17084
leaq -0x30(%rbp), %rdi
callq 0x9160
movq %rax, %rcx
xorl %eax, %eax
cmpl $0x0, 0x8(%rcx)
movb %al, -0x111(%rbp)
jl 0x17084
leaq -0x30(%rbp), %rdi
callq 0x9160
movl 0x8(%rax), %eax
movl %eax, -0x118(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x8d30
movq (%rax), %rdi
callq 0x8eb0
movl %eax, %ecx
movl -0x118(%rbp), %eax
cmpl %ecx, %eax
setl %al
movb %al, -0x111(%rbp)
movb -0x111(%rbp), %al
testb $0x1, %al
jne 0x17090
jmp 0x1709b
leaq -0x30(%rbp), %rdi
callq 0x9210
jmp 0x170c4
leaq -0x20(%rbp), %rdi
callq 0x1d970
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rsi
callq 0x1d8f0
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x16f92
jmp 0x170cb
leaq -0x20(%rbp), %rdi
callq 0x1d780
jmp 0x16f53
movq -0x110(%rbp), %rdi
addq $0x68, %rdi
callq 0x1d590
movq -0x110(%rbp), %rdi
movq %rax, -0x70(%rbp)
addq $0x68, %rdi
callq 0x1d5f0
movq %rax, -0x78(%rbp)
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rsi
leaq 0x43d0(%rip), %rdx      # 0x1b4e0
callq 0x1d890
movq -0x110(%rbp), %rdi
addq $0x68, %rdi
callq 0x1d590
movq %rax, -0x80(%rbp)
movq -0x110(%rbp), %rdi
addq $0x68, %rdi
callq 0x1d5f0
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x1d5c0
testb $0x1, %al
jne 0x17159
jmp 0x172b7
leaq -0x80(%rbp), %rdi
callq 0x1d620
movq %rax, %rdi
callq 0x1d690
testb $0x1, %al
jne 0x17170
jmp 0x171bc
movq -0x110(%rbp), %rax
addq $0x68, %rax
movq %rax, -0x120(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x1d730
movq -0x120(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x1d6b0
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x80(%rbp)
jmp 0x172b2
movq -0x110(%rbp), %rdi
addq $0x68, %rdi
callq 0x1d590
movq %rax, -0xa0(%rbp)
movq -0x110(%rbp), %rdi
addq $0x68, %rdi
callq 0x1d5f0
movq %rax, -0xa8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x1d5c0
testb $0x1, %al
jne 0x17206
jmp 0x172a9
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x1d990
testb $0x1, %al
jne 0x17249
leaq -0x80(%rbp), %rdi
callq 0x1d970
movq %rax, -0x128(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x1d970
movq -0x128(%rbp), %rdi
movq %rax, %rsi
callq 0x1b360
testb $0x1, %al
jne 0x17257
leaq -0xa0(%rbp), %rdi
callq 0x1d780
jmp 0x172a4
movq -0x110(%rbp), %rax
addq $0x68, %rax
movq %rax, -0x130(%rbp)
leaq -0xb8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x1d730
movq -0x130(%rbp), %rdi
movq -0xb8(%rbp), %rsi
callq 0x1d6b0
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0xa0(%rbp)
jmp 0x171d3
leaq -0x80(%rbp), %rdi
callq 0x1d780
jmp 0x17129
movq -0x110(%rbp), %rdi
addq $0x68, %rdi
callq 0x1d590
movq -0x110(%rbp), %rdi
movq %rax, -0xc0(%rbp)
addq $0x68, %rdi
callq 0x1d5f0
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
leaq 0x41e6(%rip), %rdx      # 0x1b4e0
callq 0x1d890
movq -0x110(%rbp), %rdi
addq $0x20, %rdi
callq 0xaf20
movq %rax, -0xd0(%rbp)
movq -0x110(%rbp), %rdi
addq $0x20, %rdi
callq 0xab70
movq %rax, -0xd8(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0xaf50
testb $0x1, %al
jne 0x17349
jmp 0x1743a
movq -0x110(%rbp), %rdi
addq $0x68, %rdi
callq 0x1d590
movq %rax, -0xe0(%rbp)
movq -0x110(%rbp), %rdi
addq $0x68, %rdi
callq 0x1d5f0
movq %rax, -0xe8(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x1d5c0
testb $0x1, %al
jne 0x17393
jmp 0x17427
leaq -0xe0(%rbp), %rdi
callq 0x1d970
movq %rax, -0x138(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0xafa0
movq -0x138(%rbp), %rdi
movq %rax, %rsi
callq 0x1b400
testb $0x1, %al
jne 0x173c7
jmp 0x17416
movq -0x110(%rbp), %rax
addq $0x68, %rax
movq %rax, -0x140(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x1d730
movq -0x140(%rbp), %rdi
movq -0xf8(%rbp), %rsi
callq 0x1d6b0
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rax
movq %rax, -0xe0(%rbp)
jmp 0x17422
leaq -0xe0(%rbp), %rdi
callq 0x1d780
jmp 0x17360
jmp 0x17429
leaq -0xd0(%rbp), %rdi
callq 0xb000
jmp 0x17316
movq -0x110(%rbp), %rdi
addq $0x68, %rdi
callq 0x1d590
movq -0x110(%rbp), %rdi
movq %rax, -0x100(%rbp)
addq $0x68, %rdi
callq 0x1d5f0
movq %rax, -0x108(%rbp)
movq -0x100(%rbp), %rdi
movq -0x108(%rbp), %rsi
leaq 0x4063(%rip), %rdx      # 0x1b4e0
callq 0x1d890
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopl (%rax,%rax)