// File: vsklad[P]cgen/./bal/variables/variablesarray.hpp
// Function: bal::VariablesArray::assign_from_template(bal::VariablesArray const&, bal::VariablesArray const&, bal::VariablesArray::assign_from_template_mode_t)
inline void assign_from_template(const VariablesArray& values, const VariablesArray& template_,
                                         const assign_from_template_mode_t mode) {
            // resize to match
            resize(template_.size_);
            element_size_ = template_.element_size_;
            
            if (mode == aftmComplete) {
                values.assign_template_into(template_, *this);
            } else {
                for (auto i = 0; i < size_; i++) {
                    literalid_t value = LITERALID_UNASSIGNED;
                    if (literal_t__is_variable(template_.data_[i])) {
                        assert(literal_t__variable_id(template_.data_[i]) < values.size_);
                        value = literal_t__lookup(values.data_, template_.data_[i]);
                    } else {
                        value = template_.data_[i];
                    };
                    
                    if ((mode == aftmConstant && literal_t__is_constant(value)) ||
                        (mode == aftmDifference && value != template_.data_[i])) {
                        data_[i] = value;
                    } else {
                        data_[i] = LITERALID_UNASSIGNED;
                    };
                };
            };
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x30(%rbp)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x11390
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x1c(%rcx), %ecx
movl %ecx, 0x1c(%rax)
cmpl $0x0, -0x1c(%rbp)
jne 0x2e455
movq -0x30(%rbp), %rdx
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x10700
jmp 0x2e59b
movl $0x0, -0x20(%rbp)
movq -0x30(%rbp), %rcx
movl -0x20(%rbp), %eax
cmpl 0x8(%rcx), %eax
jae 0x2e599
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
movq -0x18(%rbp), %rax
movq (%rax), %rcx
movslq -0x20(%rbp), %rdx
xorl %eax, %eax
cmpl $0x1, (%rcx,%rdx,4)
movb %al, -0x31(%rbp)
jbe 0x2e49e
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
cmpl $-0x2, (%rax,%rcx,4)
setbe %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x2e4aa
jmp 0x2e52e
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
shrl %eax
subl $0x1, %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jae 0x2e4c8
jmp 0x2e4e7
leaq 0x34680(%rip), %rdi     # 0x62b4f
leaq 0x2d256(%rip), %rsi     # 0x5b72c
movl $0xe2, %edx
leaq 0x346a7(%rip), %rcx     # 0x62b89
callq 0xd1c0
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movslq -0x20(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
shrl %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movslq -0x20(%rbp), %rdx
movl (%rcx,%rdx,4), %esi
xorl $-0x1, %esi
andl $0x1, %esi
xorl %ecx, %ecx
movl $0x1, %edx
cmpl $0x0, %esi
cmovnel %edx, %ecx
xorl %ecx, %eax
movl %eax, -0x24(%rbp)
jmp 0x2e53f
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x24(%rbp)
cmpl $0x1, -0x1c(%rbp)
jne 0x2e54b
cmpl $0x1, -0x24(%rbp)
jbe 0x2e564
cmpl $0x2, -0x1c(%rbp)
jne 0x2e577
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movslq -0x20(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
je 0x2e577
movq -0x30(%rbp), %rax
movl -0x24(%rbp), %edx
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x2e589
movq -0x30(%rbp), %rax
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
jmp 0x2e58b
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2e45c
jmp 0x2e59b
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)