// File: /workspace/github_cpp_makefile_star2_O2/WShabti-Team[P]WShabtiPict/wshabtilib/api/model.cpp
// Function: pictcore::Model::choose(__gnu_cxx::__normal_iterator<pictcore::Parameter**, std::vector<pictcore::Parameter*, std::allocator<pictcore::Parameter*>>>, __gnu_cxx::__normal_iterator<pictcore::Parameter**, std::vector<pictcore::Parameter*, std::allocator<pictcore::Parameter*>>>, int, int, pictcore::Combination&, std::vector<pictcore::Combination*, std::allocator<pictcore::Combination*>>&)
void Model::choose( ParamCollection::iterator first,     // the iterators apply to current stage of recursion
                    ParamCollection::iterator last,
                    int                       order,     // number of items to choose in the range from first to last
                    int                       realOrder, // real order of this combination
                    Combination&              baseCombo,
                    ComboCollection&          vecCombo ) // where to put result vector
{
    assert( order >= 0 && order <= realOrder );
    assert( realOrder > 0 );

    if( 0 == order )
    {
        // add the current combination to the result vector
        Combination *combo = new Combination( this );
        combo->Assign( baseCombo );
        vecCombo.push_back( combo );

        // add the combination to all the parameters
        // set up its bit vector
        // initialize the zero count
        // add to the global zero count Combination::GlobalZero
        int size = 1;
        for( int n = 0; n < combo->GetParameterCount(); ++n )
        {
            // link all parameters in the combination to this combination
            ( *combo )[ n ].LinkCombination( combo );
            // determine size of bit vector
            size *= ( *combo )[ n ].GetValueCount();
        }

        // set size of combination's bit vector
        combo->SetMapSize( size );
        return;
    }

    // iterate over the possible first element in the combination
    // the three parts of the loop conditional are all necessary!
    // first part makes sure we have enough elements for the current combination
    // second part decrements the loop variable, then ensures that we don't emit
    //   subsets of higher-order combinations
    while( distance( first, last ) >= order && ( ( *( --last ) )->GetOrder() == order || order != realOrder ) )
    {
        // add the parameter to the combination
        baseCombo.PushParameter( *last );

        // recurse over remaining elements
        choose( first, last, order - 1, realOrder, baseCombo, vecCombo );
        baseCombo.PopParameter();
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, 0x18(%rsp)
movq %rdi, 0x10(%rsp)
testl %ecx, %ecx
js 0x9c93
movl %r8d, %ebp
movl %ecx, %r12d
cmpl %r8d, %ecx
jg 0x9c93
testl %ebp, %ebp
jle 0x9cac
movq %r9, %rbx
testl %r12d, %r12d
je 0x9c01
movq %rdx, %r13
movl %r12d, %r15d
leal -0x1(%r12), %eax
movl %eax, 0xc(%rsp)
leaq -0x8(%rdx), %r14
subq 0x18(%rsp), %r13
movq %r13, %rax
sarq $0x3, %rax
cmpq %r15, %rax
jl 0x9c84
movq (%r14), %rsi
cmpl %ebp, %r12d
jne 0x9bc5
cmpl %r12d, 0x28(%rsi)
jne 0x9c84
movq %rbx, %rdi
callq 0xc436
movq 0x60(%rsp), %rax
movq %rax, (%rsp)
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %r14, %rdx
movl 0xc(%rsp), %ecx
movl %ebp, %r8d
movq %rbx, %r9
callq 0x9b4c
addq $-0x8, 0x10(%rbx)
addq $-0x8, %r14
addq $-0x8, %r13
jmp 0x9ba3
pushq $0x40
popq %rdi
callq 0x6440
movq %rax, %r14
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x6fa6
leaq 0x20(%rsp), %r15
movq %r14, (%r15)
movq %r14, %rdi
movq %rbx, %rsi
callq 0xc3d4
movq 0x60(%rsp), %rdi
movq %r15, %rsi
callq 0xc402
movq (%r15), %rsi
movq 0x8(%rsi), %rax
pushq $0x1
popq %rbx
xorl %r14d, %r14d
movq 0x10(%rsi), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r14
jge 0x9c78
movq (%rax,%r14,8), %rdi
callq 0xc420
movq 0x20(%rsp), %rsi
movq 0x8(%rsi), %rax
movq (%rax,%r14,8), %rcx
imull 0x38(%rcx), %ebx
incq %r14
jmp 0x9c46
movq %rsi, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x6adc
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1897a(%rip), %rdi     # 0x22614
leaq 0x18994(%rip), %rsi     # 0x22635
leaq 0x189a6(%rip), %rcx     # 0x2264e
pushq $0x22
jmp 0x9cc3
leaq 0x18a1a(%rip), %rdi     # 0x226cd
leaq 0x1897b(%rip), %rsi     # 0x22635
leaq 0x1898d(%rip), %rcx     # 0x2264e
pushq $0x23
popq %rdx
callq 0x6310
movq %rax, %rbx
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x6460
movq %rbx, %rdi
callq 0x66e0
nop