// File: vsklad[P]cgen/commands.cpp
// Function: bool process_impl<bal::Anf, true>(bal::Anf&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, CGenVariableInfo, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, CGenVariableInfo>>>&, bool, bal::FormulaProcessingMode)
bool process_impl(FORMULA& formula, CGenVariablesMap& variables_map,
                  const bool b_reindex_variables, const bal::FormulaProcessingMode mode) {
    static_assert(std::is_base_of<bal::Formula, FORMULA>::value, "FORMULA must be a descendant of bal::Formula");
    
    // all variable values will be mapped to a single array
    // conflicts of the constant values if any will be found on the way
    bal::VariablesArray variables(formula.variables_size(), 1);
    
    // a flag to determine the need for the compute route
    if (variables_require_computing(variables_map)) {
        std::cout << "Computing variables" << std::endl;
        variables.assign_sequence();
        variables_merge(variables, formula, variables_map, false, true);
        if (!evaluate(formula, variables)) {
            throw std::invalid_argument(ERROR_COMPUTE_INVALID_ENCODING);
        };
        variables_store_computed(formula, variables, variables_map);
    };
    
    // rebuild the variables with computed values if exist
    // all random values generated and all except options applied
    variables.assign_sequence();
    const bal::variables_size_t changes_count = variables_merge(variables, formula, variables_map,
                                                                true, mode != bal::fpmUnoptimized);
    if (!ONLY_IF_CHANGED || changes_count > 0) {
        if (changes_count > 0) {
            std::cout << "Assigning " << std::dec << changes_count << " variable(s) in the formula" << std::endl;
        };
        return process(formula, variables, b_reindex_variables, mode);
    } else {
        return true;
    };
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movl %ecx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
callq *0x58(%rax)
movl %eax, %esi
leaq -0x40(%rbp), %rdi
movl $0x1, %edx
callq 0x10330
movq -0x18(%rbp), %rdi
callq 0x2bea0
testb $0x1, %al
jne 0x41cb9
jmp 0x41dab
movq 0x412e0(%rip), %rdi     # 0x82fa0
leaq 0x24391(%rip), %rsi     # 0x66058
callq 0xd320
movq %rax, -0x60(%rbp)
jmp 0x41cd2
movq -0x60(%rbp), %rdi
movq 0x412a3(%rip), %rsi     # 0x82f80
callq 0xd360
jmp 0x41ce4
leaq -0x40(%rbp), %rdi
movq %rdi, -0x70(%rbp)
xorl %esi, %esi
movl %esi, -0x64(%rbp)
callq 0x103a0
movq -0x70(%rbp), %rdi
movl -0x64(%rbp), %ecx
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl $0x1, %r8d
callq 0x2bf10
jmp 0x41d12
movq -0x10(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x468d0
movb %al, -0x71(%rbp)
jmp 0x41d24
movb -0x71(%rbp), %al
testb $0x1, %al
jne 0x41d96
jmp 0x41d2d
movl $0x10, %edi
callq 0xd150
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x80(%rbp)
leaq 0x24324(%rip), %rsi     # 0x6606c
callq 0xd5f0
jmp 0x41d4f
movq -0x80(%rbp), %rdi
movq 0x4127e(%rip), %rsi     # 0x82fd8
movq 0x4125f(%rip), %rdx     # 0x82fc0
callq 0xd570
jmp 0x41ef1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x41edf
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
callq 0xd210
jmp 0x41edf
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq -0x40(%rbp), %rsi
callq 0x2c280
jmp 0x41da9
jmp 0x41dab
leaq -0x40(%rbp), %rdi
movq %rdi, -0x90(%rbp)
xorl %esi, %esi
callq 0x103a0
movq -0x90(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x20(%rbp), %eax
testl %eax, %eax
setne %al
movzbl %al, %r8d
movl $0x1, %ecx
callq 0x2bf10
movl %eax, -0x84(%rbp)
jmp 0x41dea
movl -0x84(%rbp), %eax
movl %eax, -0x50(%rbp)
cmpl $0x0, -0x50(%rbp)
jbe 0x41ebd
cmpl $0x0, -0x50(%rbp)
jbe 0x41e8a
movq 0x41192(%rip), %rdi     # 0x82fa0
leaq 0x24279(%rip), %rsi     # 0x6608e
callq 0xd320
movq %rax, -0x98(%rbp)
jmp 0x41e23
movq -0x98(%rbp), %rdi
leaq -0x31b71(%rip), %rsi    # 0x102c0
callq 0xd0f0
movq %rax, -0xa0(%rbp)
jmp 0x41e3f
movq -0xa0(%rbp), %rdi
movl -0x50(%rbp), %esi
callq 0xd420
movq %rax, -0xa8(%rbp)
jmp 0x41e57
movq -0xa8(%rbp), %rdi
leaq 0x24234(%rip), %rsi     # 0x66099
callq 0xd320
movq %rax, -0xb0(%rbp)
jmp 0x41e73
movq -0xb0(%rbp), %rdi
movq 0x410ff(%rip), %rsi     # 0x82f80
callq 0xd360
jmp 0x41e88
jmp 0x41e8a
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %ecx
movzbl -0x19(%rbp), %edx
andl $0x1, %edx
leaq -0x40(%rbp), %rsi
callq 0x46900
movb %al, -0xb1(%rbp)
jmp 0x41ea9
movb -0xb1(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movl $0x1, -0x54(%rbp)
jmp 0x41ec8
movb $0x1, -0x1(%rbp)
movl $0x1, -0x54(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x10850
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xc0, %rsp
popq %rbp
retq
leaq -0x40(%rbp), %rdi
callq 0x10850
movq -0x48(%rbp), %rdi
callq 0xd5a0
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)