// File: /workspace/github_cpp_makefile_star2_O2/WShabti-Team[P]WShabtiPict/wshabtilib/api/model.cpp
// Function: pictcore::Model::mapExclusionsToPseudoParameters()
bool Model::mapExclusionsToPseudoParameters()
{
    bool ret = false;

    // for each pseudoparameter
    for( size_t index = 0; index < GetParameters().size(); ++index )
    {
        Parameter* param = GetParameters()[ index ];
        ParamCollection* comps = param->GetComponents();
        
        if( comps )
        {
            // orepare a temporary collection for all exclusions being added
            ExclusionCollection newExcls;
        
            // this parameter is really a pseudoparameter
            for( ExclusionCollection::iterator iexcls = m_exclusions.begin(); iexcls != m_exclusions.end(); )
            {
                // partition exclusion terms into related, unrelated (to pseudoparam)
                Exclusion relatedTerms;
                Exclusion unrelatedTerms;
                for( Exclusion::iterator iexcl = iexcls->begin(); iexcl != iexcls->end(); ++iexcl )
                {
                    if( find( comps->begin(), comps->end(), iexcl->first ) == comps->end() )
                    {
                        unrelatedTerms.insert( *iexcl );
                    }
                    else
                    {
                        relatedTerms.insert( *iexcl );
                    }
                }

                // if any of exclusion's terms relate to underlying parameters
                if( !relatedTerms.empty() )
                {
                    // Get rid of the exclusion, since we'll replace it
                    m_exclusions.erase( iexcls++ );

                    // for each value of the pseudoparameter
                    for( int vidx = 0; vidx < param->GetValueCount(); ++vidx )
                    {
                        Exclusion::iterator irel;
                        for( irel = relatedTerms.begin(); irel != relatedTerms.end(); ++irel )
                        {
                            vector<Parameter*>::iterator ip = find( comps->begin(), comps->end(), irel->first );
                            if( comps->end() == ip )
                            {
                                break;
                            }
                            int nParam = static_cast<int>( distance( comps->begin(), ip ) );
                            size_t nRealVal = param->GetModel()->GetResults()[ vidx ][ nParam ];
                            if( nRealVal != irel->second )
                            {
                                break;
                            }
                        }

                        // if value is excluded in overlapping underlying params
                        if( relatedTerms.end() == irel )
                        {
                            // generate a new exclusion using unrelated + this pseudo/value
                            Exclusion newExclusion( unrelatedTerms );
                            newExclusion.insert( make_pair( param, vidx ) );
                            // Put it into a temporary collection so we don't hit it again on this iteration
                            newExcls.insert( newExclusion );
                            ret = true;
                        }
                    }
                }
                else
                {
                    // no new exclusion, just increment loop iterator
                    ++iexcls;
                }
            }

            // copy all new exclusions to the main collection
            __insert( m_exclusions, newExcls.begin(), newExcls.end() );
        }
    }

    return( ret );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
leaq 0x20(%rdi), %rax
movq %rax, 0x18(%rsp)
movq %rdi, 0x8(%rsp)
leaq 0x28(%rdi), %rax
movq %rax, 0x28(%rsp)
xorl %edx, %edx
movq $0x0, 0x20(%rsp)
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rax
movq 0x10(%rcx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %rdx
jae 0xbe7a
movq %rdx, 0x10(%rsp)
movq (%rax,%rdx,8), %r12
movq (%r12), %rax
movq %r12, %rdi
callq *0x18(%rax)
testq %rax, %rax
je 0xbe6d
movq %rax, %rbx
andl $0x0, 0x40(%rsp)
andq $0x0, 0x48(%rsp)
leaq 0x40(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %rax, 0x58(%rsp)
andq $0x0, 0x60(%rsp)
movq 0x8(%rsp), %rax
movq 0x38(%rax), %r13
cmpq 0x28(%rsp), %r13
je 0xbe4f
andl $0x0, 0x80(%rsp)
andq $0x0, 0x88(%rsp)
leaq 0x80(%rsp), %rax
movq %rax, 0x90(%rsp)
movq %rax, 0x98(%rsp)
xorl %ecx, %ecx
movb %cl, 0x40(%rax)
andl $0x0, 0xd0(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rax)
andq $0x0, 0xd8(%rsp)
movups %xmm0, 0x20(%rax)
leaq 0xd0(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq %rax, 0xe8(%rsp)
movb %cl, 0x40(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movq 0x38(%r13), %r15
leaq 0x28(%r13), %r14
cmpq %r14, %r15
je 0xbd26
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
leaq 0x20(%r15), %rbp
movq %rbp, %rdx
callq 0x707b
leaq 0xc8(%rsp), %rdi
cmpq 0x8(%rbx), %rax
je 0xbd11
leaq 0x78(%rsp), %rdi
movq %rbp, %rsi
callq 0x7fda
movq %r15, %rdi
callq 0x6500
movq %rax, %r15
jmp 0xbce6
movq 0xa0(%rsp), %r14
movq %r13, %rdi
callq 0x6500
movq %rax, 0x30(%rsp)
testq %r14, %r14
je 0xbe2e
movq 0x18(%rsp), %rdi
movq %r13, %rsi
callq 0x9506
xorl %r14d, %r14d
movslq 0x38(%r12), %rax
cmpq %rax, %r14
jge 0xbe2e
movq 0x90(%rsp), %rbp
leaq 0x80(%rsp), %rax
cmpq %rax, %rbp
je 0xbddb
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
leaq 0x20(%rbp), %rdx
callq 0x707b
movq %rax, %r15
cmpq %rax, 0x8(%rbx)
je 0xbdce
movq (%rbx), %r13
movq (%r12), %rax
movq %r12, %rdi
callq *0x10(%rax)
subq %r13, %r15
movq 0xd0(%rax), %rax
imulq $0x18, %r14, %rcx
movq (%rax,%rcx), %rax
shlq $0x1d, %r15
sarq $0x1d, %r15
movslq 0x28(%rbp), %rcx
cmpq %rcx, (%rax,%r15)
jne 0xbdce
movq %rbp, %rdi
callq 0x6500
movq %rax, %rbp
jmp 0xbd6a
leaq 0x80(%rsp), %rax
cmpq %rbp, %rax
jne 0xbe26
leaq 0x118(%rsp), %r15
movq %r15, %rdi
leaq 0xc8(%rsp), %rsi
callq 0x7f9c
movq %r12, 0x68(%rsp)
movl %r14d, 0x70(%rsp)
movq %r15, %rdi
leaq 0x68(%rsp), %rsi
callq 0x7fda
leaq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x8af8
movq %r15, %rdi
callq 0x7b50
movb $0x1, %al
movq %rax, 0x20(%rsp)
incq %r14
jmp 0xbd54
leaq 0xc8(%rsp), %rdi
callq 0x7b50
leaq 0x78(%rsp), %rdi
callq 0x7b50
movq 0x30(%rsp), %r13
jmp 0xbc66
movq 0x50(%rsp), %rsi
movq 0x18(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0xc631
leaq 0x38(%rsp), %rdi
callq 0xd1bc
movq 0x10(%rsp), %rdx
incq %rdx
jmp 0xbc01
movq 0x20(%rsp), %rax
andb $0x1, %al
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0xbed0
jmp 0xbeb6
jmp 0xbe9e
jmp 0xbeb6
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x7b50
jmp 0xbeb9
jmp 0xbeb6
jmp 0xbeb6
jmp 0xbeb6
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x7b50
leaq 0x78(%rsp), %rdi
callq 0x7b50
leaq 0x38(%rsp), %rdi
callq 0xd1bc
movq %rbx, %rdi
callq 0x66e0