// File: WShabti-Team[P]WShabtiPict/wshabtilib/api/combination.cpp
// Function: pictcore::Combination::Feasible()
int Combination::Feasible()
{
    int* workbuf = m_model->GetTask()->GetWorkbuf();

    int nWorkVals = 1;
    workbuf[ 0 ] = 0;
    for( Parameter* param : m_params )
    {
        for( int i = 0; i < nWorkVals; i++ )
        {
            workbuf[ i ] *= param->GetValueCount();
        }
        int nCurrentVal = (int) param->GetLast();
        if( param->GetBoundCount() )
        {
            for( int i = 0; i < nWorkVals; ++i )
            {
                workbuf[ i ] += nCurrentVal;
            }
        }
        else
        {
            for( int i = 0; i < nWorkVals; ++i )
            {
                for( int addend = 1; addend < param->GetValueCount(); ++addend )
                {
                    workbuf[ i + nWorkVals*addend ] = workbuf[ i ] + addend;
                }
            }
            nWorkVals *= param->GetValueCount();
        }
    }

    // Now count the zeros corresponding to the open combinations
    int zeros = 0;
    for( int i = 0; i < nWorkVals; ++i )
    {
        if( Open == m_bitvec[ workbuf[ i ] ] )
        {
            ++zeros;
        }
    }

    return zeros;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq 0x38(%rax), %rdi
callq 0x8f00
movq %rax, %rdi
callq 0x8f20
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, -0x10(%rbp)
movl $0x1, -0x14(%rbp)
movq -0x10(%rbp), %rcx
movl $0x0, (%rcx)
addq $0x8, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x8c90
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x8cc0
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x8cf0
testb $0x1, %al
jne 0x81a9
jmp 0x82bf
leaq -0x28(%rbp), %rdi
callq 0x8d30
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x81ed
movq -0x38(%rbp), %rdi
callq 0x8eb0
movl %eax, %edx
movq -0x10(%rbp), %rax
movslq -0x3c(%rbp), %rcx
imull (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x81c0
movq -0x38(%rbp), %rdi
callq 0x8f40
movl %eax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
callq 0x8e90
testb $0x1, %al
jne 0x8208
jmp 0x8235
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x8233
movl -0x40(%rbp), %edx
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
addl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x820f
jmp 0x82af
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x829f
movl $0x1, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x38(%rbp), %rdi
callq 0x8eb0
movl %eax, %ecx
movl -0x64(%rbp), %eax
cmpl %ecx, %eax
jge 0x8292
movq -0x10(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl -0x4c(%rbp), %edx
movq -0x10(%rbp), %rax
movl -0x48(%rbp), %ecx
movl -0x14(%rbp), %esi
imull -0x4c(%rbp), %esi
addl %esi, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x824b
jmp 0x8294
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x823c
movq -0x38(%rbp), %rdi
callq 0x8eb0
imull -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x82b1
leaq -0x28(%rbp), %rdi
callq 0x8d70
jmp 0x8193
movl $0x0, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x8309
movq -0x60(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
movslq -0x54(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movzbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x82fc
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x82fe
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x82cd
movl -0x50(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)