// File: /workspace/github_cpp_makefile_star2_O2/biotomas[P]ipasir/sat/minisat220/minisat-220/minisat/core/Solver.cc
// Function: Minisat::Solver::simplify()
bool Solver::simplify()
{
    assert(decisionLevel() == 0);

    if (!ok || propagate() != CRef_Undef)
        return ok = false;

    if (nAssigns() == simpDB_assigns || (simpDB_props > 0))
        return true;

    // Remove satisfied clauses:
    removeSatisfied(learnts);
    if (remove_satisfied){       // Can be turned off.
        removeSatisfied(clauses);

        // TODO: what todo in if 'remove_satisfied' is false?

        // Remove all released variables from the trail:
        for (int i = 0; i < released_vars.size(); i++){
            assert(seen[released_vars[i]] == 0);
            seen[released_vars[i]] = 1;
        }

        int i, j;
        for (i = j = 0; i < trail.size(); i++)
            if (seen[var(trail[i])] == 0)
                trail[j++] = trail[i];
        trail.shrink(i - j);
        //printf("trail.size()= %d, qhead = %d\n", trail.size(), qhead);
        qhead = trail.size();

        for (int i = 0; i < released_vars.size(); i++)
            seen[released_vars[i]] = 0;

        // Released variables are now ready to be reused:
        append(released_vars, free_vars);
        released_vars.clear();
    }
    checkGarbage();
    rebuildOrderHeap();

    simpDB_assigns = nAssigns();
    simpDB_props   = clauses_literals + learnts_literals;   // (shouldn't depend on stats really, but it will do for now)

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x1, 0x2a0(%rdi)
jne 0x510a
movq %rbx, %rdi
callq 0x408c
cmpl $-0x1, %eax
je 0x5120
movb $0x0, 0x2a0(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl 0x170(%rbx), %eax
movb $0x1, %bpl
cmpl 0x2bc(%rbx), %eax
je 0x5113
cmpq $0x0, 0x2c0(%rbx)
jg 0x5113
leaq 0x158(%rbx), %rsi
movq %rbx, %rdi
callq 0x4f32
cmpb $0x1, 0x2d0(%rbx)
jne 0x5264
leaq 0x148(%rbx), %rsi
movq %rbx, %rdi
callq 0x4f32
xorl %eax, %eax
movslq 0x300(%rbx), %rcx
cmpq %rcx, %rax
jge 0x518f
movq 0x2f8(%rbx), %rcx
movq 0x318(%rbx), %rdx
movslq (%rcx,%rax,4), %rcx
movb $0x1, (%rdx,%rcx)
incq %rax
jmp 0x5168
leaq 0x168(%rbx), %rdi
movq 0x168(%rbx), %rax
movq 0x318(%rbx), %rcx
xorl %esi, %esi
xorl %edx, %edx
movslq 0x170(%rbx), %r8
cmpq %r8, %rsi
jge 0x51d6
movl (%rax,%rsi,4), %r8d
movl %r8d, %r9d
sarl %r9d
movslq %r9d, %r9
cmpb $0x0, (%rcx,%r9)
jne 0x51d1
movslq %edx, %r9
incl %edx
movl %r8d, (%rax,%r9,4)
incq %rsi
jmp 0x51a8
subl %edx, %esi
callq 0x6694
movl 0x170(%rbx), %eax
movl %eax, 0x2b8(%rbx)
xorl %ecx, %ecx
movslq 0x300(%rbx), %rax
cmpq %rax, %rcx
jge 0x5212
movq 0x2f8(%rbx), %rax
movq 0x318(%rbx), %rdx
movslq (%rax,%rcx,4), %rax
movb $0x0, (%rdx,%rax)
incq %rcx
jmp 0x51eb
leaq 0x308(%rbx), %r14
xorl %r15d, %r15d
cltq
cmpq %rax, %r15
jge 0x5253
movq %r14, %rdi
callq 0x8078
movq 0x2f8(%rbx), %rax
movq 0x308(%rbx), %rcx
movslq 0x310(%rbx), %rdx
movl (%rax,%r15,4), %eax
movl %eax, -0x4(%rcx,%rdx,4)
incq %r15
movl 0x300(%rbx), %eax
jmp 0x521c
cmpq $0x0, 0x2f8(%rbx)
je 0x5264
andl $0x0, 0x300(%rbx)
movq %rbx, %rdi
callq 0x6ad2
movq %rbx, %rdi
callq 0x5034
movl 0x170(%rbx), %eax
movl %eax, 0x2bc(%rbx)
movq 0x130(%rbx), %rax
addq 0x128(%rbx), %rax
movq %rax, 0x2c0(%rbx)
jmp 0x5113