// File: /workspace/github_cpp_makefile_star2_O1/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, -0x50(%rbp)
cmpl 0x8(%r14), %eax
jne 0x21495
movq 0x18(%rbx), %r12
addq $0x8, %rbx
cmpq %rbx, %r12
je 0x21486
cmpl $0x2, 0x40(%r12)
jne 0x21472
movq 0x20(%r12), %rdx
leaq -0x48(%rbp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x202df
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 -0x50(%rbp), %rsi
movq %r14, %rdx
callq 0x2308e
movq 0x20(%r12), %rsi
movq 0x28(%r12), %rdx
movq 0x3dbb4(%rip), %rdi     # 0x5efa8
callq 0xc320
movq %rax, %r14
movl $0x3, %edx
movq %rax, %rdi
leaq 0x2098b(%rip), %rsi     # 0x41d96
callq 0xc320
movq %r14, %rdi
movq %r13, %rsi
callq 0x3f449
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0xc2a0
movsbl %al, %esi
movq %r13, %rdi
callq 0xc030
movq %rax, %rdi
callq 0xc1a0
movl $0x0, 0x40(%r12)
cmpl $0x0, -0x30(%rbp)
je 0x21472
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x2146a
callq 0xc350
movq $0x0, -0x48(%rbp)
xorl %eax, %eax
movl %eax, -0x40(%rbp)
movl %eax, -0x30(%rbp)
movq %r12, %rdi
callq 0xc1b0
movq %rax, %r12
cmpq %rbx, %rax
jne 0x2139b
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x272db(%rip), %rdi     # 0x48777
leaq 0x26ff2(%rip), %rsi     # 0x48495
leaq 0x273db(%rip), %rcx     # 0x48885
movl $0x192, %edx            # imm = 0x192
callq 0xc180
movq %rax, %rbx
cmpl $0x0, -0x30(%rbp)
je 0x214ca
leaq -0x30(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0xc6c1
movq %rbx, %rdi
callq 0xc4e0