// File: /workspace/github_cpp_makefile_star2_O2/vsklad[P]cgen/./bal/variables/variablesarray.hpp
// Function: bal::VariablesArray::assign_template_from(bal::VariablesArray const&, bal::VariablesArray const&)
inline variables_size_t assign_template_from(const VariablesArray& template_, const VariablesArray& value) {
            _assert_level_1(template_.size_ == value.size_);
            variables_size_t changes_count = 0;
            for (container_size_t i = 0; i < template_.size_; i++) {
                literalid_t lhs_literal = template_.data_[i];
                literalid_t rhs_literal = value.data_[i];
                
                // an unassigned literal means there is nothing to assign or to assign to
                // equalence means there is nothing to assign as well
                while (!literal_t__is_unassigned(rhs_literal) &&
                       !literal_t__is_unassigned(lhs_literal) && lhs_literal != rhs_literal) {
                    
                    if (literal_t__is_variable(lhs_literal)) {
                        rhs_literal = literal_t__substitute_literal(lhs_literal, rhs_literal);
                        literal_t__unnegate(lhs_literal);
                        
                        const variableid_t variableid = literal_t__variable_id(lhs_literal);
                        _assert_level_1(variableid < size_);

                        // the value must not be set OR it cannot be set to two different values OR
                        // for variables, higher variable id gets assigned with the lower one
                        // i.e. swap variables if necessary
                        if (data_[variableid] != rhs_literal) {
                            if (literal_t__is_variable(rhs_literal) && rhs_literal > lhs_literal) {
                                std::swap(rhs_literal, lhs_literal);
                                continue;
                            } else if (data_[variableid] == lhs_literal || literal_t__is_unassigned(data_[variableid])) {
                                data_[variableid] = rhs_literal;
                                changes_count++;
                            } else if (literal_t__is_negation_of(data_[variableid], lhs_literal)) {
                                data_[variableid] = literal_t__negated(rhs_literal);
                                changes_count++;
                            } else if (literal_t__is_constant(data_[variableid]) || literal_t__is_variable(data_[variableid])) {
                                lhs_literal = data_[variableid];
                                continue;
                            } else {
                                return VARIABLEID_ERROR;
                            };
                        };
                    } else if (literal_t__is_constant(lhs_literal) && literal_t__is_variable(rhs_literal)) {
                        // { const = var } => { var = const }
                        std::swap(rhs_literal, lhs_literal);
                        continue;
                    } else if (lhs_literal != rhs_literal) {
                        // any remaining literals must match whatever they are
                        return VARIABLEID_ERROR;
                    };
                    break;
                };
            };
            return changes_count;
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl 0x8(%rsi), %ecx
cmpl 0x8(%rdx), %ecx
jne 0xdd83
movq (%rsi), %rax
movq %rax, -0x40(%rbp)
movq (%rdx), %rax
movq %rax, -0x38(%rbp)
xorl %r8d, %r8d
movl $0x0, -0x2c(%rbp)
movl %ecx, %ecx
cmpq %rcx, %r8
jae 0xdd5f
movq -0x40(%rbp), %rax
movl (%rax,%r8,4), %r13d
movq -0x38(%rbp), %rax
movl (%rax,%r8,4), %r14d
movl 0x8(%rdi), %r10d
movq (%rdi), %r9
cmpl $-0x1, %r14d
je 0xdd40
movl %r13d, %r11d
cmpl $-0x1, %r13d
je 0xdd40
cmpl %r14d, %r11d
je 0xdd40
cmpl $0x2, %r11d
jb 0xdd24
movl %r11d, %ecx
shrl %ecx
decl %ecx
cmpl %r10d, %ecx
jae 0xdd64
movl %r11d, %ebx
andl $0x1, %ebx
xorl %r14d, %ebx
movl %ebx, %r12d
xorl $0x1, %r12d
movl %ecx, %r15d
movl (%r9,%r15,4), %ecx
cmpl %r12d, %ecx
je 0xdd40
orl $0x1, %r11d
leal -0x2(%r12), %r14d
cmpl $-0x3, %r14d
setb %al
cmpl %r11d, %r12d
seta %dl
movl %r12d, %r13d
movl %r11d, %r14d
testb %al, %dl
jne 0xdc93
cmpl %r11d, %ecx
je 0xdd36
cmpl $-0x1, %ecx
je 0xdd36
xorl %ecx, %r11d
movl %ecx, %r13d
movl %r12d, %r14d
cmpl $0x1, %r11d
jne 0xdc93
jmp 0xdd39
movl %r14d, %r13d
cmpl $0x1, %r14d
movl %r11d, %r14d
ja 0xdc93
jmp 0xdd4b
movl %r12d, %ebx
movl %ebx, (%r9,%r15,4)
incl -0x2c(%rbp)
incq %r8
movl 0x8(%rsi), %ecx
jmp 0xdc71
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl -0x2c(%rbp), %eax
jmp 0xdd50
leaq 0x23b55(%rip), %rdi     # 0x318c0
leaq 0x239ba(%rip), %rsi     # 0x3172c
leaq 0x23adc(%rip), %rcx     # 0x31855
movl $0x9d, %edx
callq 0xc180
leaq 0x23aac(%rip), %rdi     # 0x31836
leaq 0x2399b(%rip), %rsi     # 0x3172c
leaq 0x23abd(%rip), %rcx     # 0x31855
movl $0x8d, %edx
callq 0xc180