// File: /workspace/github_cpp_makefile_star2_O3/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, 0x8(%rsp)
movq %rdi, 0x18(%rsp)
testl %ecx, %ecx
js 0x8def
movl %r8d, %ebp
movl %ecx, %r15d
cmpl %r8d, %ecx
jg 0x8def
testl %ebp, %ebp
jle 0x8e0e
movq %r9, %rbx
movq 0x60(%rsp), %r14
testl %r15d, %r15d
je 0x8d21
movq %rdx, %r12
movl %r15d, %r14d
movq %rdx, %rax
subq 0x8(%rsp), %rax
sarq $0x3, %rax
cmpq %r14, %rax
jl 0x8de0
leal -0x1(%r15), %eax
movl %eax, 0x14(%rsp)
addq $-0x8, %r12
movq %r12, %r13
subq 0x8(%rsp), %r13
movq (%r12), %rsi
cmpl %ebp, %r15d
jne 0x8cd6
cmpl %r15d, 0x28(%rsi)
jne 0x8de0
movq %rbx, %rdi
callq 0xbf22
movq 0x60(%rsp), %rax
movq %rax, (%rsp)
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %r12, %rdx
movl 0x14(%rsp), %ecx
movl %ebp, %r8d
movq %rbx, %r9
callq 0x8c4c
addq $-0x8, 0x10(%rbx)
movq %r13, %rax
sarq $0x3, %rax
addq $-0x8, %r13
addq $-0x8, %r12
cmpq %r14, %rax
jge 0x8cc3
jmp 0x8de0
movl $0x40, %edi
callq 0x53c0
movq %rax, %r15
movq %rax, %rdi
movq 0x18(%rsp), %rsi
callq 0x630e
movq %r15, 0x20(%rsp)
leaq 0x8(%rbx), %rsi
movq %r15, %rdi
addq $0x8, %rdi
callq 0xc362
movq 0x28(%rbx), %rax
movq %rax, 0x28(%r15)
movl 0x30(%rbx), %eax
movl %eax, 0x30(%r15)
movq 0x8(%r14), %rsi
cmpq 0x10(%r14), %rsi
je 0x8d73
movq %r15, (%rsi)
addq $0x8, 0x8(%r14)
jmp 0x8d86
leaq 0x20(%rsp), %rbx
movq %r14, %rdi
movq %rbx, %rdx
callq 0xd208
movq (%rbx), %r15
movq 0x8(%r15), %rax
movq 0x10(%r15), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
movl $0x1, %ebx
testl %ecx, %ecx
jle 0x8dd4
xorl %r14d, %r14d
movq (%rax,%r14,8), %rdi
movq %r15, %rsi
callq 0xbef8
movq 0x20(%rsp), %r15
movq 0x8(%r15), %rax
movq 0x10(%r15), %rcx
movq (%rax,%r14,8), %rdx
imull 0x38(%rdx), %ebx
incq %r14
subq %rax, %rcx
shrq $0x3, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r14
jl 0x8da1
movq %r15, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x5ddc
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1d826(%rip), %rdi     # 0x2661c
leaq 0x1d840(%rip), %rsi     # 0x2663d
leaq 0x1d852(%rip), %rcx     # 0x26656
movl $0x22, %edx
callq 0x52c0
leaq 0x1d8c0(%rip), %rdi     # 0x266d5
leaq 0x1d821(%rip), %rsi     # 0x2663d
leaq 0x1d833(%rip), %rcx     # 0x26656
movl $0x23, %edx
callq 0x52c0
movq %rax, %rbx
movl $0x40, %esi
movq %r15, %rdi
callq 0x53e0
movq %rbx, %rdi
callq 0x56a0
nop