// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
addq $0x88, %rdi
movq %rdi, -0x48(%rbp)
callq 0x5cb2
movq %r14, -0x38(%rbp)
cmpl $0x0, 0xf0(%r14)
jle 0x3566
movq -0x38(%rbp), %rax
leaq 0xf8(%rax), %r12
xorl %ecx, %ecx
movq %rcx, -0x50(%rbp)
leal (%rcx,%rcx), %eax
movq %rax, -0x40(%rbp)
xorl %ecx, %ecx
movq -0x40(%rbp), %rax
movq %rcx, -0x30(%rbp)
leal (%rcx,%rax), %esi
movq -0x48(%rbp), %rdi
callq 0x746e
cmpl $0x0, 0x8(%rax)
jle 0x3547
movq %rax, %r14
xorl %r13d, %r13d
xorl %r15d, %r15d
movq (%r14), %rsi
addq %r13, %rsi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x5d1c
incq %r15
movslq 0x8(%r14), %rax
addq $0x8, %r13
cmpq %rax, %r15
jl 0x3526
movq -0x30(%rbp), %rcx
leal 0x1(%rcx), %eax
testl %ecx, %ecx
movl %eax, %ecx
je 0x3503
movq -0x50(%rbp), %rcx
incl %ecx
movq -0x38(%rbp), %rax
cmpl 0xf0(%rax), %ecx
jl 0x34f6
movq -0x38(%rbp), %r14
leaq 0x1a0(%r14), %rdi
movq %rdi, -0x48(%rbp)
callq 0x5d64
cmpl $0x0, 0xf0(%r14)
jle 0x3601
movq -0x38(%rbp), %rax
leaq 0xf8(%rax), %r12
xorl %ecx, %ecx
movq %rcx, -0x50(%rbp)
leal (%rcx,%rcx), %eax
movq %rax, -0x40(%rbp)
xorl %ecx, %ecx
movq -0x40(%rbp), %rax
movq %rcx, -0x30(%rbp)
leal (%rcx,%rax), %esi
movq -0x48(%rbp), %rdi
callq 0x7580
cmpl $0x0, 0x8(%rax)
jle 0x35e2
movq %rax, %r14
xorl %r13d, %r13d
xorl %r15d, %r15d
movq (%r14), %rsi
addq %r13, %rsi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x5d1c
incq %r15
movslq 0x8(%r14), %rax
addq $0x4, %r13
cmpq %rax, %r15
jl 0x35c1
movq -0x30(%rbp), %rcx
leal 0x1(%rcx), %eax
testl %ecx, %ecx
movl %eax, %ecx
je 0x359e
movq -0x50(%rbp), %rcx
incl %ecx
movq -0x38(%rbp), %rax
cmpl 0xf0(%rax), %ecx
jl 0x3591
movq -0x38(%rbp), %r12
cmpl $0x0, 0x30(%r12)
jle 0x3762
leaq 0x70(%r12), %r15
leaq 0xf8(%r12), %rax
movq %rax, -0x30(%rbp)
leaq 0x58(%r12), %rax
movq %rax, -0x48(%rbp)
xorl %r14d, %r14d
movq 0x28(%r12), %rax
movl (%rax,%r14,4), %r13d
sarl %r13d
movq %r15, %rdi
movl %r13d, %esi
callq 0x6e98
cmpl $-0x1, (%rax)
je 0x3751
movq %r15, %rdi
movl %r13d, %esi
callq 0x6e98
movl (%rax), %esi
movq -0x30(%rbp), %rdi
callq 0x6a4e
testb $0x10, (%rax)
jne 0x3707
movq %r15, %rdi
movl %r13d, %esi
callq 0x6e98
movl (%rax), %esi
movq -0x30(%rbp), %rdi
callq 0x6a4e
movq %rax, -0x40(%rbp)
movl 0x4(%rax), %r12d
movl %r12d, %esi
sarl %esi
movq -0x48(%rbp), %rdi
callq 0x6c82
movb (%rax), %al
andb $0x1, %r12b
xorb %al, %r12b
movb 0x9acc(%rip), %cl       # 0xd174
movl %ecx, %edx
andb $0x2, %dl
andb %dl, %al
xorl %esi, %esi
testb %dl, %dl
sete %sil
cmpb %cl, %r12b
movq -0x38(%rbp), %r12
movl $0x0, %ecx
cmovnel %ecx, %esi
orb %al, %sil
je 0x3751
movq -0x40(%rbp), %rax
movl 0x4(%rax), %esi
sarl %esi
movq %r15, %rdi
callq 0x6e98
cmpl $-0x1, (%rax)
je 0x3751
movq -0x40(%rbp), %rax
movl 0x4(%rax), %esi
sarl %esi
movq %r15, %rdi
callq 0x6e98
movl (%rax), %esi
movq -0x30(%rbp), %rdi
callq 0x6b60
cmpq -0x40(%rbp), %rax
jne 0x3751
movq %r15, %rdi
movl %r13d, %esi
callq 0x6e98
movl (%rax), %esi
movq %r15, %r12
movq -0x30(%rbp), %r15
movq %r15, %rdi
callq 0x6bc0
movl (%rax), %eax
andl $0x3, %eax
cmpl $0x1, %eax
je 0x38a1
movq %r12, %rdi
movl %r13d, %esi
callq 0x5dce
movq %r15, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x5d1c
movq %r12, %r15
movq -0x38(%rbp), %r12
incq %r14
movslq 0x30(%r12), %rax
cmpq %rax, %r14
jl 0x362e
movq %r12, %r14
leaq 0x18(%r12), %rdi
xorl %r15d, %r15d
cmpl $0x0, 0x20(%r12)
movl $0x0, %r13d
jle 0x37ff
leaq 0xf8(%r14), %r12
xorl %r14d, %r14d
xorl %r13d, %r13d
movl $0x0, -0x30(%rbp)
movq %r12, -0x40(%rbp)
movq (%rdi), %rax
movl (%rax,%r14), %esi
movq %rdi, %r15
movq %r12, %rdi
callq 0x6bc0
movl (%rax), %eax
andl $0x3, %eax
cmpl $0x1, %eax
je 0x37d9
movq (%r15), %rsi
addq %r14, %rsi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x5d1c
movq (%r15), %rax
movl (%rax,%r14), %ecx
movl -0x30(%rbp), %esi
movslq %esi, %rdx
incl %esi
movl %esi, -0x30(%rbp)
movl %ecx, (%rax,%rdx,4)
movq %r15, %rdi
incq %r13
movq -0x38(%rbp), %rax
movslq 0x20(%rax), %rax
addq $0x4, %r14
cmpq %rax, %r13
movq -0x40(%rbp), %r12
jl 0x3797
subl -0x30(%rbp), %r13d
movq -0x38(%rbp), %r14
xorl %r15d, %r15d
movl %r13d, %esi
callq 0x5e2e
leaq 0x8(%r14), %r12
cmpl $0x0, 0x10(%r14)
jle 0x3888
addq $0xf8, %r14
xorl %r13d, %r13d
xorl %r15d, %r15d
movl $0x0, -0x30(%rbp)
movq %r14, -0x40(%rbp)
movq (%r12), %rax
movl (%rax,%r13), %esi
movq %r14, %rdi
callq 0x6bc0
movl (%rax), %eax
andl $0x3, %eax
cmpl $0x1, %eax
je 0x386c
movq (%r12), %rsi
addq %r13, %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x5d1c
movq (%r12), %rax
movl (%rax,%r13), %ecx
movl -0x30(%rbp), %esi
movslq %esi, %rdx
incl %esi
movl %esi, -0x30(%rbp)
movl %ecx, (%rax,%rdx,4)
incq %r15
movq -0x38(%rbp), %rax
movslq 0x10(%rax), %rax
addq $0x4, %r13
cmpq %rax, %r15
movq -0x40(%rbp), %r14
jl 0x382a
subl -0x30(%rbp), %r15d
movq %r12, %rdi
movl %r15d, %esi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5e2e
movl $0x10, %edi
callq 0x20a0
movq %rax, %rbx
leaq 0x57fe(%rip), %rsi      # 0x90b3
movq %rax, %rdi
callq 0x21d0
movq 0x9714(%rip), %rsi      # 0xcfd8
movq 0x96c5(%rip), %rdx      # 0xcf90
movq %rbx, %rdi
callq 0x2250
movq %rax, %r14
movq %rbx, %rdi
callq 0x20f0
movq %r14, %rdi
callq 0x2270