// File: Myyura[P]MyyuraSat/./source/./solver_basic.cpp
// Function: MyyuraSat::Solver::reloc_all(MyyuraSat::ClauseAllocator&)
void Solver::reloc_all(ClauseAllocator& to) {
    // Watchers:
    _watches.clean_all();
    for (int v = 0; v < n_variables(); v++) {
        for (int s = 0; s < 2; s++) {
            Literal p(v, s);
            Vector<_Watcher>& ws = _watches[p];
            for (int j = 0; j < ws.size(); j++) {
                _ca.reloc(ws[j].cref, to);
            }
        }
    }

    // Occlits
    _occur_lit.clean_all();
    for (int v = 0; v < n_variables(); v++) {
        for (int s = 0; s < 2; s++) {
            Literal p(v, s);
            Vector<CRARef>& cs = _occur_lit[p];
            for (int j = 0; j < cs.size(); j++) {
                _ca.reloc(cs[j], to);
            }
        }
    }

    // Reasons:
    for (int i = 0; i < _trail.size(); i++) {
        Variable v = _trail[i].variable();

        /**
         * Note: it is not safe to call 'locked()' on a relocated clause. This 
         * is why we keep 'dangling' reasons here. It is safe and does not hurt.
         */
        if (reason(v) != CRAREF_UNDEF && 
            (_ca[reason(v)].reloced() || is_locked(_ca[reason(v)]))) {
            if (is_removed(reason(v))) {
                throw std::logic_error("Solver::reloc_all : reason is already removed!");
            }

            _ca.reloc(_variable_info[v].reason, to);
        }
    }

    int i, j;
    // Learnts:
    for (i = j = 0; i < _learnts.size(); i++) {
        if (!is_removed(_learnts[i])) {
            _ca.reloc(_learnts[i], to);
            _learnts[j++] = _learnts[i];
        }
    }
    _learnts.shrink(i - j);


    // Original:
    for (i = j = 0; i < _clauses.size(); i++) {
        if (!is_removed(_clauses[i])) {
            _ca.reloc(_clauses[i], to);
            _clauses[j++] = _clauses[i];
        }
    }
    _clauses.shrink(i - j);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x70(%rbp)
addq $0x88, %rdi
callq 0x7af0
movl $0x0, -0x14(%rbp)
movq -0x70(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, -0x74(%rbp)
callq 0x7530
movl %eax, %ecx
movl -0x74(%rbp), %eax
cmpl %ecx, %eax
jge 0x3be0
movl $0x0, -0x18(%rbp)
cmpl $0x2, -0x18(%rbp)
jge 0x3bd0
movl -0x14(%rbp), %esi
cmpl $0x0, -0x18(%rbp)
setne %al
movzbl %al, %edx
andl $0x1, %edx
leaq -0x1c(%rbp), %rdi
callq 0x7430
movq -0x70(%rbp), %rdi
addq $0x88, %rdi
leaq -0x1c(%rbp), %rsi
callq 0x7ba0
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x78(%rbp)
movq -0x28(%rbp), %rdi
callq 0x7bd0
movl %eax, %ecx
movl -0x78(%rbp), %eax
cmpl %ecx, %eax
jge 0x3bc0
movq -0x70(%rbp), %rax
addq $0xf8, %rax
movq %rax, -0x80(%rbp)
movq -0x28(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x7c70
movq -0x80(%rbp), %rdi
movq %rax, %rsi
movq -0x10(%rbp), %rdx
callq 0x7bf0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x3b73
jmp 0x3bc2
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x3b31
jmp 0x3bd2
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3b0e
movq -0x70(%rbp), %rdi
addq $0x1a0, %rdi            # imm = 0x1A0
callq 0x7c90
movl $0x0, -0x30(%rbp)
movq -0x70(%rbp), %rdi
movl -0x30(%rbp), %eax
movl %eax, -0x84(%rbp)
callq 0x7530
movl %eax, %ecx
movl -0x84(%rbp), %eax
cmpl %ecx, %eax
jge 0x3cdb
movl $0x0, -0x34(%rbp)
cmpl $0x2, -0x34(%rbp)
jge 0x3ccb
movl -0x30(%rbp), %esi
cmpl $0x0, -0x34(%rbp)
setne %al
movzbl %al, %edx
andl $0x1, %edx
leaq -0x38(%rbp), %rdi
callq 0x7430
movq -0x70(%rbp), %rdi
addq $0x1a0, %rdi            # imm = 0x1A0
leaq -0x38(%rbp), %rsi
callq 0x7d40
movq %rax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x88(%rbp)
movq -0x40(%rbp), %rdi
callq 0x7d70
movl %eax, %ecx
movl -0x88(%rbp), %eax
cmpl %ecx, %eax
jge 0x3cbb
movq -0x70(%rbp), %rax
addq $0xf8, %rax
movq %rax, -0x90(%rbp)
movq -0x40(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x7d90
movq -0x90(%rbp), %rdi
movq %rax, %rsi
movq -0x10(%rbp), %rdx
callq 0x7bf0
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x3c62
jmp 0x3cbd
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x3c20
jmp 0x3ccd
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x3bf7
movl $0x0, -0x48(%rbp)
movq -0x70(%rbp), %rdi
movl -0x48(%rbp), %eax
movl %eax, -0x94(%rbp)
addq $0x28, %rdi
callq 0x7720
movl %eax, %ecx
movl -0x94(%rbp), %eax
cmpl %ecx, %eax
jge 0x3e69
movq -0x70(%rbp), %rdi
addq $0x28, %rdi
movl -0x48(%rbp), %esi
callq 0x77a0
movq %rax, %rdi
callq 0x7db0
movq -0x70(%rbp), %rdi
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %esi
callq 0x7dd0
cmpl $-0x1, %eax
je 0x3e59
movq -0x70(%rbp), %rdi
movq %rdi, %rax
addq $0xf8, %rax
movq %rax, -0xa0(%rbp)
movl -0x4c(%rbp), %esi
callq 0x7dd0
movq -0xa0(%rbp), %rdi
movl %eax, %esi
callq 0x7aa0
movq %rax, %rdi
callq 0x7e00
testb $0x1, %al
jne 0x3dad
movq -0x70(%rbp), %rdi
movq %rdi, %rax
addq $0xf8, %rax
movq %rax, -0xa8(%rbp)
movl -0x4c(%rbp), %esi
callq 0x7dd0
movq -0xa8(%rbp), %rdi
movl %eax, %esi
callq 0x7aa0
movq -0x70(%rbp), %rdi
movq %rax, %rsi
callq 0x7e20
testb $0x1, %al
jne 0x3dad
jmp 0x3e59
movq -0x70(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x7dd0
movq -0x70(%rbp), %rdi
movl %eax, %esi
callq 0x7f00
testb $0x1, %al
jne 0x3dca
jmp 0x3e26
movl $0x10, %edi
callq 0x2090
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xb0(%rbp)
leaq 0xb32d(%rip), %rsi      # 0xf115
callq 0x21a0
jmp 0x3def
movq -0xb0(%rbp), %rdi
movq 0x121db(%rip), %rsi     # 0x15fd8
movq 0x1218c(%rip), %rdx     # 0x15f90
callq 0x2210
movq -0xb0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0x20c0
jmp 0x4034
movq -0x70(%rbp), %rdi
movq %rdi, %rax
addq $0xf8, %rax
movq %rax, -0xb8(%rbp)
addq $0x70, %rdi
movl -0x4c(%rbp), %esi
callq 0x7f40
movq -0xb8(%rbp), %rdi
movq %rax, %rsi
movq -0x10(%rbp), %rdx
callq 0x7bf0
jmp 0x3e5b
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x3ce2
movl $0x0, -0x64(%rbp)
movl $0x0, -0x60(%rbp)
movq -0x70(%rbp), %rdi
movl -0x60(%rbp), %eax
movl %eax, -0xbc(%rbp)
addq $0x18, %rdi
callq 0x7d70
movl %eax, %ecx
movl -0xbc(%rbp), %eax
cmpl %ecx, %eax
jge 0x3f37
movq -0x70(%rbp), %rdi
addq $0x18, %rdi
movl -0x60(%rbp), %esi
callq 0x7d90
movq -0x70(%rbp), %rdi
movl (%rax), %esi
callq 0x7f00
testb $0x1, %al
jne 0x3f27
movq -0x70(%rbp), %rdi
movq %rdi, %rax
addq $0xf8, %rax
movq %rax, -0xc8(%rbp)
addq $0x18, %rdi
movl -0x60(%rbp), %esi
callq 0x7d90
movq -0xc8(%rbp), %rdi
movq %rax, %rsi
movq -0x10(%rbp), %rdx
callq 0x7bf0
movq -0x70(%rbp), %rdi
addq $0x18, %rdi
movl -0x60(%rbp), %esi
callq 0x7d90
movq -0x70(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0xc0(%rbp)
addq $0x18, %rdi
movl -0x64(%rbp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
callq 0x7d90
movl -0xc0(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x3f29
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x3e77
movq -0x70(%rbp), %rdi
addq $0x18, %rdi
movl -0x60(%rbp), %esi
subl -0x64(%rbp), %esi
callq 0x7fe0
movl $0x0, -0x64(%rbp)
movl $0x0, -0x60(%rbp)
movq -0x70(%rbp), %rdi
movl -0x60(%rbp), %eax
movl %eax, -0xcc(%rbp)
addq $0x8, %rdi
callq 0x7d70
movl %eax, %ecx
movl -0xcc(%rbp), %eax
cmpl %ecx, %eax
jge 0x4018
movq -0x70(%rbp), %rdi
addq $0x8, %rdi
movl -0x60(%rbp), %esi
callq 0x7d90
movq -0x70(%rbp), %rdi
movl (%rax), %esi
callq 0x7f00
testb $0x1, %al
jne 0x4008
movq -0x70(%rbp), %rdi
movq %rdi, %rax
addq $0xf8, %rax
movq %rax, -0xd8(%rbp)
addq $0x8, %rdi
movl -0x60(%rbp), %esi
callq 0x7d90
movq -0xd8(%rbp), %rdi
movq %rax, %rsi
movq -0x10(%rbp), %rdx
callq 0x7bf0
movq -0x70(%rbp), %rdi
addq $0x8, %rdi
movl -0x60(%rbp), %esi
callq 0x7d90
movq -0x70(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0xd0(%rbp)
addq $0x8, %rdi
movl -0x64(%rbp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
callq 0x7d90
movl -0xd0(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x400a
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x3f58
movq -0x70(%rbp), %rdi
addq $0x8, %rdi
movl -0x60(%rbp), %esi
subl -0x64(%rbp), %esi
callq 0x7fe0
addq $0xe0, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x2230
nopl (%rax)