// File: /workspace/github_cpp_makefile_star2_O3/vsklad[P]cgen/commands.cpp
// Function: variables_store_computed(bal::Formula const&, bal::VariablesArray const&, 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>>>&)
void variables_store_computed(const bal::Formula& formula,
                              const bal::VariablesArray& variables,
                              CGenVariablesMap& variables_map) {
    assert(formula.variables_size() == variables.size());
    for (auto it = variables_map.begin(); it != variables_map.end(); it++ ) {
        if (it->second.mode == vmCompute) {
            const bal::VariablesArray template_ = variable_get_template(formula, it->first.c_str());
            it->second.data.assign_from_template(variables, template_,
                                                 it->second.compute_mode == vcmComplete ? bal::VariablesArray::aftmComplete :
                                                 it->second.compute_mode == vcmConstant ? bal::VariablesArray::aftmConstant :
                                                 bal::VariablesArray::aftmDifference);
            
            std::cout << it->first << " = " << it->second.data << std::endl;
            it->second.mode = vmValue; // the value has now been computed
        };
    };
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%rdi), %rax
callq *0x58(%rax)
movq %r14, -0x30(%rbp)
cmpl 0x8(%r14), %eax
jne 0x1fd8e
movq 0x18(%rbx), %r12
addq $0x8, %rbx
cmpq %rbx, %r12
je 0x1fd7f
cmpl $0x2, 0x40(%r12)
jne 0x1fd6b
movq 0x20(%r12), %rdx
leaq -0x50(%rbp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x1eaef
leaq 0x58(%r12), %r13
movl 0x44(%r12), %eax
xorl %ecx, %ecx
cmpl $0x2, %eax
setne %cl
incl %ecx
testl %eax, %eax
cmovel %eax, %ecx
movq %r13, %rdi
movq -0x30(%rbp), %rsi
movq %r14, %rdx
callq 0x21a0a
movq 0x20(%r12), %rsi
movq 0x28(%r12), %rdx
movq 0x3c2b3(%rip), %rdi     # 0x5bfb0
callq 0xb320
movq %rax, %r14
movl $0x3, %edx
movq %rax, %rdi
leaq 0x2006e(%rip), %rsi     # 0x3fd82
callq 0xb320
movq %r14, %rdi
movq %r13, %rsi
callq 0x3d449
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0xb2a0
movsbl %al, %esi
movq %r13, %rdi
callq 0xb030
movq %rax, %rdi
callq 0xb1a0
movl $0x0, 0x40(%r12)
cmpl $0x0, -0x38(%rbp)
je 0x1fd6b
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x1fd6b
callq 0xb350
movq %r12, %rdi
callq 0xb1b0
movq %rax, %r12
cmpq %rbx, %rax
jne 0x1fca4
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x269f2(%rip), %rdi     # 0x46787
leaq 0x26709(%rip), %rsi     # 0x464a5
leaq 0x26af2(%rip), %rcx     # 0x46895
movl $0x192, %edx            # imm = 0x192
callq 0xb180
movq %rax, %rbx
cmpl $0x0, -0x38(%rbp)
je 0x1fdc4
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x1fdc4
callq 0xb350
movq %rbx, %rdi
callq 0xb4e0