// File: /workspace/github_cpp_makefile_star2_O1/vsklad[P]cgen/./bal/cnf/processor/cnfoptimizer.cpp
// Function: bal::CnfOptimizer::update_variables(bool)
inline variableid_t CnfOptimizer::update_variables(const bool b_reindex_variables) {
        literalid_t* var_values = variables_.data();
        variableid_t next_variable_id = VARIABLEID_MIN;
        
        // go through the variables sequentially
        for (variables_size_t i = 0; i < variables_.size(); i++) {
            if (literal_t__is_variable(var_values[i])) {
                variableid_t variable_id = literal_t__variable_id(var_values[i]);
                if (variable_id != i) {
                    // assume referencing of variables with lower ids only
                    // and therefore the reference is updated by now
                    assert(i > variable_id);
                    // all clauses with the variable must have been excluded
                    assert(!is_variable_used(i));
                    // UNASSIGNED may not be referenced
                    assert(!literal_t__is_unassigned(var_values[variable_id]));
                    // take the reference of the reference instead of making a new variable
                    var_values[i] = literal_t__substitute_literal(var_values[i], var_values[variable_id]);
                } else if (is_variable_used(variable_id) || cnf_.is_variable_named(variable_id)) {
                    if (b_reindex_variables) {
                        // generate new variable id
                        if (next_variable_id != variable_id) {
                            // only update after next_variable_id falls behind
                            var_values[i] = literal_t__substitute_variable(var_values[i], next_variable_id);
                        };
                        next_variable_id++;
                    };
                } else {
                    var_values[i] = LITERALID_UNASSIGNED;
                };
            } else {
                // unassigned cannot be created earlier than this stage
                assert(literal_t__is_constant(var_values[i]));
            };
        };
#ifdef CNF_TRACE
        if (p_tracer_ != nullptr) p_tracer_->update_variables(variables_);
#endif
        // validate the new variables size
        _assert_level_1(cnf_.variables_size() <= variables_.size());
        _assert_level_1(next_variable_id <= variables_.size());
        return next_variable_id;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, -0x2c(%rbp)
movq %rdi, %rbx
movq 0xb8(%rdi), %rsi
cmpl $0x0, 0x8(%rsi)
je 0x1341a
movq (%rsi), %r13
xorl %r15d, %r15d
xorl %r14d, %r14d
movl (%r13,%r15,4), %eax
leal 0x1(%rax), %ecx
cmpl $0x3, %ecx
jae 0x13317
cmpl $0x2, %eax
jae 0x13485
incq %r15
movq 0xb8(%rbx), %rsi
movl 0x8(%rsi), %eax
cmpq %rax, %r15
jb 0x132ea
jmp 0x1341d
movl %eax, %r12d
shrl %r12d
decl %r12d
cmpq %r12, %r15
jne 0x133a0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %r12d, 0x68(%rbx)
jbe 0x1333a
movq 0x60(%rbx), %rax
movl %r12d, %ecx
movl (%rax,%rcx,4), %eax
cmpl $-0x1, %eax
je 0x1335f
movq 0x18(%rbx), %rdx
movq 0x38(%rbx), %rcx
movq (%rdx), %rdx
movl %eax, %eax
movl 0x4(%rcx,%rax,8), %esi
testb $-0x80, 0xd(%rdx,%rsi,4)
je 0x13373
movl (%rcx,%rax,8), %eax
cmpl $-0x1, %eax
jne 0x1334a
movq 0x8(%rbx), %rdi
movl %r12d, %esi
callq 0x3d22a
testb %al, %al
je 0x1340c
cmpb $0x0, -0x2c(%rbp)
je 0x13300
cmpl %r12d, %r14d
je 0x13398
leal 0x3(,%r14,2), %eax
movl (%r13,%r15,4), %ecx
andl $0x1, %ecx
andl $-0x2, %eax
orl %ecx, %eax
movl %eax, (%r13,%r15,4)
incl %r14d
jmp 0x13300
movl %r12d, %ecx
cmpq %rcx, %r15
jbe 0x134c3
movl 0x68(%rbx), %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpq %rsi, %r15
jae 0x133c1
movq 0x60(%rbx), %rdx
movl (%rdx,%r15,4), %edx
cmpl $-0x1, %edx
je 0x133ec
movq 0x18(%rbx), %rdi
movq 0x38(%rbx), %rsi
movq (%rdi), %rdi
movl %edx, %edx
movl 0x4(%rsi,%rdx,8), %r8d
testb $-0x80, 0xd(%rdi,%r8,4)
je 0x13466
movl (%rsi,%rdx,8), %edx
cmpl $-0x1, %edx
jne 0x133d1
movl (%r13,%rcx,4), %ecx
cmpl $-0x1, %ecx
je 0x134a4
andl $0x1, %eax
xorl %ecx, %eax
xorl $0x1, %eax
movl %eax, (%r13,%r15,4)
jmp 0x13300
movl $0xffffffff, (%r13,%r15,4) # imm = 0xFFFFFFFF
jmp 0x13300
xorl %r14d, %r14d
movq 0x4beec(%rip), %rdi     # 0x5f310
testq %rdi, %rdi
je 0x1342f
movq (%rdi), %rax
callq *0x38(%rax)
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
callq *0x58(%rax)
movq 0xb8(%rbx), %rcx
movl 0x8(%rcx), %ecx
cmpl %ecx, %eax
ja 0x134e2
cmpl %ecx, %r14d
ja 0x13501
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x331cb(%rip), %rdi     # 0x46638
leaq 0x30984(%rip), %rsi     # 0x43df8
leaq 0x33180(%rip), %rcx     # 0x465fb
movl $0x4a5, %edx            # imm = 0x4A5
callq 0xc180
leaq 0x331f4(%rip), %rdi     # 0x46680
leaq 0x30965(%rip), %rsi     # 0x43df8
leaq 0x33161(%rip), %rcx     # 0x465fb
movl $0x4b8, %edx            # imm = 0x4B8
callq 0xc180
leaq 0x331a2(%rip), %rdi     # 0x4664d
leaq 0x30946(%rip), %rsi     # 0x43df8
leaq 0x33142(%rip), %rcx     # 0x465fb
movl $0x4a7, %edx            # imm = 0x4A7
callq 0xc180
leaq 0x33121(%rip), %rdi     # 0x465eb
leaq 0x30927(%rip), %rsi     # 0x43df8
leaq 0x33123(%rip), %rcx     # 0x465fb
movl $0x4a3, %edx            # imm = 0x4A3
callq 0xc180
leaq 0x331bd(%rip), %rdi     # 0x466a6
leaq 0x30908(%rip), %rsi     # 0x43df8
leaq 0x33104(%rip), %rcx     # 0x465fb
movl $0x4bf, %edx            # imm = 0x4BF
callq 0xc180
leaq 0x331c9(%rip), %rdi     # 0x466d1
leaq 0x308e9(%rip), %rsi     # 0x43df8
leaq 0x330e5(%rip), %rcx     # 0x465fb
movl $0x4c0, %edx            # imm = 0x4C0
callq 0xc180