// File: /workspace/github_cpp_makefile_star2_O1/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, 0x10(%rsp)
movq %rdi, 0x20(%rsp)
testl %ecx, %ecx
js 0x8f06
movl %r8d, %ebp
movl %ecx, %r12d
cmpl %r8d, %ecx
jg 0x8f06
testl %ebp, %ebp
jle 0x8f25
movq %r9, %rbx
movq 0x60(%rsp), %r13
testl %r12d, %r12d
je 0x8e31
movq %rdx, %r15
movl %r12d, %r14d
movq %rdx, %rax
subq 0x10(%rsp), %rax
sarq $0x3, %rax
cmpq %r14, %rax
jl 0x8ef7
leal -0x1(%r12), %eax
movl %eax, 0x1c(%rsp)
addq $-0x8, %r15
movq %r15, %r13
subq 0x10(%rsp), %r13
movq (%r15), %rsi
cmpl %ebp, %r12d
jne 0x8de6
cmpl %r12d, 0x28(%rsi)
jne 0x8ef7
movq %rbx, %rdi
callq 0xc048
movq 0x60(%rsp), %rax
movq %rax, (%rsp)
movq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
movl 0x1c(%rsp), %ecx
movl %ebp, %r8d
movq %rbx, %r9
callq 0x8d5c
addq $-0x8, 0x10(%rbx)
movq %r13, %rax
sarq $0x3, %rax
addq $-0x8, %r13
addq $-0x8, %r15
cmpq %r14, %rax
jge 0x8dd4
jmp 0x8ef7
movl $0x40, %edi
callq 0x53c0
movq %rax, %r14
movq %rax, %rdi
movq 0x20(%rsp), %rsi
callq 0x62c8
movq %r14, 0x8(%rsp)
leaq 0x8(%rbx), %rsi
movq %r14, %rdi
addq $0x8, %rdi
callq 0xc47c
movl 0x28(%rbx), %eax
movl %eax, 0x28(%r14)
movl 0x2c(%rbx), %eax
movl %eax, 0x2c(%r14)
movl 0x30(%rbx), %eax
movl %eax, 0x30(%r14)
movq 0x8(%r13), %rsi
cmpq 0x10(%r13), %rsi
je 0x8e8e
movq 0x8(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%r13)
jmp 0x8e9b
leaq 0x8(%rsp), %rdx
movq %r13, %rdi
callq 0xd33a
movq 0x8(%rsp), %rsi
movq 0x8(%rsi), %rax
movq 0x10(%rsi), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
movl $0x1, %ebx
testl %ecx, %ecx
jle 0x8eeb
xorl %r14d, %r14d
movq (%rax,%r14,8), %rdi
callq 0xc01e
movq 0x8(%rsp), %rsi
movq 0x8(%rsi), %rax
movq 0x10(%rsi), %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 0x8ebb
movq %rsi, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x5dcc
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1d70f(%rip), %rdi     # 0x2661c
leaq 0x1d729(%rip), %rsi     # 0x2663d
leaq 0x1d73b(%rip), %rcx     # 0x26656
movl $0x22, %edx
callq 0x52c0
leaq 0x1d7a9(%rip), %rdi     # 0x266d5
leaq 0x1d70a(%rip), %rsi     # 0x2663d
leaq 0x1d71c(%rip), %rcx     # 0x26656
movl $0x23, %edx
callq 0x52c0
movq %rax, %rbx
movl $0x40, %esi
movq %r14, %rdi
callq 0x53e0
movq %rbx, %rdi
callq 0x56a0