// File: /workspace/github_cpp_makefile_star2_O2/vsklad[P]cgen/./bal/anf/anf.cpp
// Function: bal::Anf::evaluate(bal::VariablesArray&) const
void Anf::evaluate(VariablesArray& variables) const {
        assert(variables_size() == variables.size());
        
        // pass 1 - gather values from unit clauses
        for (auto i = 0; i < equations_.size(); i++) {
            if (terms_size_(i) == 1 && symbols_size_(equations_[i]) == 1) {
                const literalid_t value = symbols_[terms_[equations_[i]]];
                _assert_level_1(literal_t__is_variable(value));
                variables.data()[literal_t__variable_id(value)] = literal_t__is_negation(value) ? 0b1 : 0b0;
            };
        };
        
        // pass 2 - try to evaluate all equations
        for (auto i = 0; i < equations_.size(); i++) {
            if (!(terms_size_(i) == 1 && symbols_size_(equations_[i]) == 1)) {
                const size_t terms_size = terms_size_(i);
                assert(terms_size >= 2);
                
                // assume the first term is the variable to assign
                // and the constant combined
                assert(symbols_size_(equations_[i]) == 1);
                assert(literal_t__is_variable(symbols_[terms_[equations_[i]]]));
                
                bool value = literal_t__is_negation(symbols_[terms_[equations_[i]]]);
                variableid_t variable_id = literal_t__variable_id(symbols_[terms_[equations_[i]]]);
                assert(variable_id < variables.size());
                
                // calculate variable value from the rest of equation
                for (auto j = equations_[i] + 1; j < equations_[i] + terms_size; j++) {
                    const size_t symbols_size = symbols_size_(j);
                    bool term_value = true;
                    for (auto k = terms_[j]; (k < terms_[j] + symbols_size) && term_value; k++) {
                        // require that all symbols are constants at this point
                        assert(literal_t__is_variable(symbols_[k]));
                        assert(!literal_t__is_negation(symbols_[k]));
                        assert(literal_t__variable_id(symbols_[k]) < variables.size());
                        const literalid_t symbol_value = variables.data()[literal_t__variable_id(symbols_[k])];
                        assert(literal_t__is_constant(symbol_value));
                        term_value &= literal_t__is_constant_1(symbol_value);
                    };
                    value ^= term_value;
                };
                
                variables.data()[variable_id] = literal_t__constant(value);
            };
        };
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rax
callq *0x58(%rax)
movq %rbx, -0x30(%rbp)
cmpl 0x8(%rbx), %eax
jne 0xd743
xorl %r15d, %r15d
movq 0xa8(%r14), %rax
movq 0xb0(%r14), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %r15, %rdx
jbe 0xd49a
movq %r14, %rdi
movq %r15, %rsi
callq 0xd994
cmpq $0x1, %rax
jne 0xd492
movq 0xa8(%r14), %rax
movl (%rax,%r15,4), %esi
movq %r14, %rdi
callq 0xda06
cmpq $0x1, %rax
jne 0xd492
movq 0xa8(%r14), %rax
movl (%rax,%r15,4), %eax
movq 0x78(%r14), %rcx
movq 0x90(%r14), %rdx
movl (%rdx,%rax,4), %eax
movl (%rcx,%rax,4), %eax
leal -0x2(%rax), %ecx
cmpl $-0x3, %ecx
jae 0xd724
movl %eax, %ecx
notl %ecx
andl $0x1, %ecx
movq -0x30(%rbp), %rdx
movq (%rdx), %rdx
shrl %eax
movl %ecx, -0x4(%rdx,%rax,4)
incq %r15
jmp 0xd40f
xorl %ebx, %ebx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rbx, %rcx
jbe 0xd61d
movq %r14, %rdi
movq %rbx, %rsi
callq 0xd994
cmpq $0x1, %rax
jne 0xd4e1
movq 0xa8(%r14), %rax
movl (%rax,%rbx,4), %esi
movq %r14, %rdi
callq 0xda06
cmpq $0x1, %rax
jne 0xd4e1
movq 0xa8(%r14), %rax
jmp 0xd60e
movq %r14, %rdi
movq %rbx, %rsi
callq 0xd994
cmpq $0x1, %rax
jbe 0xd6e6
movq %rax, %r12
movq 0xa8(%r14), %rax
movl (%rax,%rbx,4), %esi
movq %r14, %rdi
callq 0xda06
cmpq $0x1, %rax
jne 0xd705
movq 0xa8(%r14), %rax
movl (%rax,%rbx,4), %ecx
movq 0x78(%r14), %rdx
movq 0x90(%r14), %rsi
movl (%rsi,%rcx,4), %esi
movl (%rdx,%rsi,4), %r15d
leal 0x1(%r15), %edx
cmpl $0x2, %edx
jbe 0xd6a8
movl %r15d, %esi
shrl %esi
decl %esi
movq -0x30(%rbp), %rdx
movl %esi, -0x34(%rbp)
cmpl 0x8(%rdx), %esi
jae 0xd6c7
xorb $0x1, %r15b
movl %ecx, %r13d
incl %r13d
movl %ecx, %ecx
addq %r12, %rcx
cmpq %r13, %rcx
jbe 0xd5fa
movq %r14, %rdi
movq %r13, %rsi
callq 0xda06
movq 0x78(%r14), %rcx
movq 0x90(%r14), %rdx
movl (%rdx,%r13,4), %edx
addq %rdx, %rax
movq -0x30(%rbp), %rdi
movl 0x8(%rdi), %esi
movq (%rdi), %rdi
movb $0x1, %r8b
testb $0x1, %r8b
je 0xd5e8
movl %edx, %edx
cmpq %rdx, %rax
jbe 0xd5e8
movl (%rcx,%rdx,4), %r8d
leal 0x1(%r8), %r9d
cmpl $0x2, %r9d
jbe 0xd62c
testb $0x1, %r8b
je 0xd689
shrl %r8d
decl %r8d
cmpl %esi, %r8d
jae 0xd64b
movl %r8d, %r8d
movl (%rdi,%r8,4), %r8d
cmpl $0x2, %r8d
jae 0xd66a
cmpl $0x1, %r8d
sete %r8b
incl %edx
jmp 0xd597
xorb %r8b, %r15b
movq 0xa8(%r14), %rax
movl (%rax,%rbx,4), %ecx
jmp 0xd55c
movzbl %r15b, %ecx
andl $0x1, %ecx
movq -0x30(%rbp), %rdx
movq (%rdx), %rdx
movl -0x34(%rbp), %esi
movl %ecx, (%rdx,%rsi,4)
incq %rbx
movq 0xb0(%r14), %rcx
jmp 0xd49c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x23c22(%rip), %rdi     # 0x31255
leaq 0x239e5(%rip), %rsi     # 0x3101f
leaq 0x23cf5(%rip), %rcx     # 0x31336
movl $0x149, %edx            # imm = 0x149
callq 0xc180
leaq 0x23de5(%rip), %rdi     # 0x31437
leaq 0x239c6(%rip), %rsi     # 0x3101f
leaq 0x23cd6(%rip), %rcx     # 0x31336
movl $0x14b, %edx            # imm = 0x14B
callq 0xc180
leaq 0x23dfd(%rip), %rdi     # 0x3146e
leaq 0x239a7(%rip), %rsi     # 0x3101f
leaq 0x23cb7(%rip), %rcx     # 0x31336
movl $0x14d, %edx            # imm = 0x14D
callq 0xc180
leaq 0x23c3d(%rip), %rdi     # 0x312cd
leaq 0x23988(%rip), %rsi     # 0x3101f
leaq 0x23c98(%rip), %rcx     # 0x31336
movl $0x14a, %edx            # imm = 0x14A
callq 0xc180
leaq 0x23d31(%rip), %rdi     # 0x313e0
leaq 0x23969(%rip), %rsi     # 0x3101f
leaq 0x23c79(%rip), %rcx     # 0x31336
movl $0x13d, %edx            # imm = 0x13D
callq 0xc180
leaq 0x23d4a(%rip), %rdi     # 0x31418
leaq 0x2394a(%rip), %rsi     # 0x3101f
leaq 0x23c5a(%rip), %rcx     # 0x31336
movl $0x141, %edx            # imm = 0x141
callq 0xc180
leaq 0x23cc1(%rip), %rdi     # 0x313ae
leaq 0x2392b(%rip), %rsi     # 0x3101f
leaq 0x23c3b(%rip), %rcx     # 0x31336
movl $0x138, %edx            # imm = 0x138
callq 0xc180
leaq 0x23cb2(%rip), %rdi     # 0x313be
leaq 0x2390c(%rip), %rsi     # 0x3101f
leaq 0x23c1c(%rip), %rcx     # 0x31336
movl $0x13c, %edx            # imm = 0x13C
callq 0xc180
leaq 0x23c3b(%rip), %rdi     # 0x31366
leaq 0x238ed(%rip), %rsi     # 0x3101f
leaq 0x23bfd(%rip), %rcx     # 0x31336
movl $0x12f, %edx            # imm = 0x12F
callq 0xc180
leaq 0x2af85(%rip), %rdi     # 0x386cf
leaq 0x238ce(%rip), %rsi     # 0x3101f
leaq 0x23bde(%rip), %rcx     # 0x31336
movl $0x129, %edx            # imm = 0x129
callq 0xc180