// File: vsklad[P]cgen/./bal/cnf/processor/cnfoptimizer.cpp
// Function: bal::CnfOptimizer::_update_clause_variables(unsigned int*) const
inline bool CnfOptimizer::_update_clause_variables(uint32_t* const p_clause) const {
        if (_clause_is_included(p_clause)) {
            const uint32_t clause_size = _clause_size(p_clause);
            const literalid_t* var_values = variables_.data();
            
            // assign reindexed variable numbers
            // sort order / normalization must be preserved because the only possible change is reindexing
            // all other changes must have been handled while evaluating
            for (auto i = 0; i < clause_size; i++) {
                const literalid_t old_literal = _clause_literal(p_clause, i);
                const literalid_t new_literal = literal_t__lookup(var_values, old_literal);
                if (old_literal != new_literal) {
                    // constants not possible as those clauses must have been eliminated
                    _assert_level_1(literal_t__is_variable(new_literal));
                    if (literal_t__is_negation(new_literal) && _clause_is_aggregated(p_clause)) {
                        // only unnegated mappings are possible for variables within an aggregated clause
                        _assert_level_3(literal_t__is_same_variable(old_literal, new_literal));
                        clause_flags_t flags = _clause_flags(p_clause);
                        ca_flags_negate(flags, i);
                        _clause_flags_set(p_clause, flags);
                    } else {
                        _clause_literal(p_clause, i) = new_literal;
                    };
                };
            };
            return true;
        } else {
            return false;
        };
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
jne 0x1f890
movq -0x40(%rbp), %rax
movq -0x18(%rbp), %rcx
movl (%rcx), %ecx
andl $0x7fff, %ecx           # imm = 0x7FFF
movl %ecx, -0x1c(%rbp)
movq 0xb8(%rax), %rdi
callq 0x10310
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jae 0x1f88a
movq -0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl 0x4(%rax,%rcx,4), %eax
movl %eax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movl -0x30(%rbp), %ecx
shrl %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movl -0x30(%rbp), %esi
xorl $-0x1, %esi
andl $0x1, %esi
xorl %ecx, %ecx
movl $0x1, %edx
cmpl $0x0, %esi
cmovnel %edx, %ecx
xorl %ecx, %eax
movl %eax, -0x34(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x34(%rbp), %eax
je 0x1f87a
xorl %eax, %eax
cmpl $0x1, -0x34(%rbp)
movb %al, -0x41(%rbp)
jbe 0x1f7be
cmpl $-0x2, -0x34(%rbp)
setbe %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x1f7c7
jmp 0x1f7c9
jmp 0x1f7e8
leaq 0x414a0(%rip), %rdi     # 0x60c70
leaq 0x3e73d(%rip), %rsi     # 0x5df14
movl $0x484, %edx            # imm = 0x484
leaq 0x414e1(%rip), %rcx     # 0x60cc4
callq 0xd1c0
movl -0x34(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x1f869
movq -0x18(%rbp), %rax
movl (%rax), %eax
andl $0x7fff, %eax           # imm = 0x7FFF
cmpl $0x4, %eax
ja 0x1f869
movl -0x30(%rbp), %eax
xorl -0x34(%rbp), %eax
shrl %eax
cmpl $0x0, %eax
jne 0x1f812
jmp 0x1f831
leaq 0x414f3(%rip), %rdi     # 0x60d0c
leaq 0x3e6f4(%rip), %rsi     # 0x5df14
movl $0x487, %edx            # imm = 0x487
leaq 0x41498(%rip), %rcx     # 0x60cc4
callq 0xd1c0
movq -0x18(%rbp), %rax
movl (%rax), %eax
shrl $0x10, %eax
movw %ax, -0x36(%rbp)
movl -0x2c(%rbp), %eax
leaq -0x36(%rbp), %rdi
movzwl %ax, %esi
callq 0x187e0
movzwl -0x36(%rbp), %ecx
shll $0x10, %ecx
movq -0x18(%rbp), %rax
movl (%rax), %eax
andl $0xffff, %eax           # imm = 0xFFFF
orl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1f878
movl -0x34(%rbp), %edx
movq -0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl %edx, 0x4(%rax,%rcx,4)
jmp 0x1f87a
jmp 0x1f87c
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1f756
movb $0x1, -0x1(%rbp)
jmp 0x1f894
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nop