// File: vsklad[P]cgen/./bal/cnf/processor/cnfoptimizer.cpp
// Function: bal::CnfOptimizer::base_execute(bool, bal::FormulaProcessingMode)
inline bool CnfOptimizer::base_execute(const bool b_reindex_variables, const FormulaProcessingMode mode) {
        _assert_level_0(mode == fpmAll || mode == fpmOriginal);
        
        clauses_.transaction_begin();
        __statistics_reset();
        
        TRACE_START;
        bool result = (evaluate_clauses() != erConflict);
        TRACE_FINISH;
        
        if (result) {
            
            __statistics_print();
            
            if (mode == fpmOriginal) {
                // "lazy" suboptimal approach until transitive reduction works efficiently
                // variables are reindexed at this stage
                // keep original clauses after updating variables;
                // except those satisfied while normalizing
                clauses_.transaction_rollback();
                // unit propagate or substitute variable values, rebuild indexes
                rebuild_clauses<CnfOptimizer, &CnfOptimizer::_normalize_clause>(this, false);
                // this may leave excluded clauses; second reinitialization addresses this
                CnfSubsumptionOptimizer::execute();
            } else if (mode == fpmAll) {
                clauses_.transaction_commit();
            };
            
            const variableid_t new_variables_size = update_variables(b_reindex_variables);
            rebuild_clauses<CnfOptimizer, &CnfOptimizer::_update_clause_variables>(this, mode == fpmAll);
            cnf_.named_variables_update(variables_);
            if (b_reindex_variables && new_variables_size != cnf_.variables_size()) {
                set_variables_size(new_variables_size);
            };

        } else {
            clauses_.transaction_rollback();
        };
        
        clauses_index_.reset(0, 0);
        processed_offset_ = 0; // to match state of the indexes
        
        return result;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
andb $0x1, %al
movb %al, -0x9(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movb $0x1, %al
cmpl $0x1, -0x10(%rbp)
movb %al, -0x1d(%rbp)
je 0x165d4
cmpl $0x2, -0x10(%rbp)
sete %al
movb %al, -0x1d(%rbp)
movb -0x1d(%rbp), %al
testb $0x1, %al
jne 0x165dd
jmp 0x165df
jmp 0x165fe
leaq 0x47d36(%rip), %rdi     # 0x5e31c
leaq 0x47927(%rip), %rsi     # 0x5df14
movl $0x4ed, %edx            # imm = 0x4ED
leaq 0x47d49(%rip), %rcx     # 0x5e342
callq 0xd1c0
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x16820
callq 0x12760
leaq 0x6cd79(%rip), %rdi     # 0x83390
callq 0x16210
cmpq $0x0, %rax
je 0x166de
leaq 0x6cd63(%rip), %rdi     # 0x83390
callq 0x178d0
movq %rax, %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
movq (%rdi), %rax
callq *0x10(%rax)
movl $0x0, -0x14(%rbp)
movq -0x28(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, -0x2c(%rbp)
movq 0xb8(%rax), %rdi
callq 0x102f0
movl %eax, %ecx
movl -0x2c(%rbp), %eax
cmpl %ecx, %eax
jae 0x166dc
movq -0x28(%rbp), %rax
movq 0xb8(%rax), %rdi
callq 0x10310
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
shll %ecx
orl $0x1, %ecx
cmpl %ecx, %eax
je 0x166cc
leaq 0x6ccfa(%rip), %rdi     # 0x83390
callq 0x178d0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, -0x38(%rbp)
movl -0x14(%rbp), %ecx
movl %ecx, -0x30(%rbp)
movq 0xb8(%rax), %rdi
callq 0x10310
movq -0x38(%rbp), %rdi
movl -0x30(%rbp), %esi
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq (%rdi), %rax
callq *0x30(%rax)
jmp 0x166ce
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1664a
jmp 0x166de
movq -0x28(%rbp), %rdi
callq 0x16890
cmpl $0x4, %eax
setne %al
andb $0x1, %al
movb %al, -0x15(%rbp)
leaq 0x6cc97(%rip), %rdi     # 0x83390
callq 0x16210
cmpq $0x0, %rax
je 0x16719
leaq 0x6cc85(%rip), %rdi     # 0x83390
callq 0x178d0
movq %rax, %rdi
movq (%rdi), %rax
callq *0x18(%rax)
testb $0x1, -0x15(%rbp)
je 0x167db
callq 0x127b0
cmpl $0x2, -0x10(%rbp)
jne 0x16754
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x16a20
movq -0x28(%rbp), %rsi
xorl %edx, %edx
movq %rsi, %rdi
callq 0x178f0
movq -0x28(%rbp), %rdi
callq 0x1f970
jmp 0x16769
cmpl $0x1, -0x10(%rbp)
jne 0x16767
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x17850
jmp 0x16769
movq -0x28(%rbp), %rdi
movb -0x9(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x16ae0
movq -0x28(%rbp), %rsi
movl %eax, -0x1c(%rbp)
cmpl $0x1, -0x10(%rbp)
sete %al
movzbl %al, %edx
andl $0x1, %edx
movq %rsi, %rdi
callq 0x16e20
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movq 0xb8(%rax), %rsi
callq 0x55280
testb $0x1, -0x9(%rbp)
je 0x167d9
movq -0x28(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, -0x3c(%rbp)
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x58(%rax)
movl %eax, %ecx
movl -0x3c(%rbp), %eax
cmpl %ecx, %eax
je 0x167d9
movq -0x28(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x16df0
jmp 0x167e8
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x16a20
movq -0x28(%rbp), %rdi
addq $0x30, %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x17d40
movq -0x28(%rbp), %rax
movl $0x0, 0xb0(%rax)
movb -0x15(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)