// File: /workspace/github_cpp_makefile_star2_O3/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 0x5b22
movq %r14, -0x38(%rbp)
cmpl $0x0, 0xf0(%r14)
jle 0x350f
movq -0x38(%rbp), %rax
leaq 0xf8(%rax), %r12
xorl %ecx, %ecx
movq %rcx, -0x50(%rbp)
leal (%rcx,%rcx), %eax
movl %eax, -0x40(%rbp)
movb $0x1, %al
xorl %esi, %esi
movl %eax, -0x30(%rbp)
orl -0x40(%rbp), %esi
movq -0x48(%rbp), %rdi
callq 0x7298
cmpl $0x0, 0x8(%rax)
jle 0x34ed
movq %rax, %r14
xorl %r13d, %r13d
xorl %r15d, %r15d
movq (%r14), %rsi
addq %r13, %rsi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x5b8c
incq %r15
movslq 0x8(%r14), %rax
addq $0x8, %r13
cmpq %rax, %r15
jl 0x34cc
movl $0x1, %esi
testb $0x1, -0x30(%rbp)
movl $0x0, %eax
jne 0x34ae
movq -0x50(%rbp), %rcx
incl %ecx
movq -0x38(%rbp), %rax
cmpl 0xf0(%rax), %ecx
jl 0x34a0
movq -0x38(%rbp), %r14
leaq 0x1a0(%r14), %rdi
movq %rdi, -0x48(%rbp)
callq 0x5bd4
cmpl $0x0, 0xf0(%r14)
jle 0x35a9
movq -0x38(%rbp), %rax
leaq 0xf8(%rax), %r12
xorl %ecx, %ecx
movq %rcx, -0x50(%rbp)
leal (%rcx,%rcx), %eax
movl %eax, -0x40(%rbp)
movb $0x1, %al
xorl %esi, %esi
movl %eax, -0x30(%rbp)
orl -0x40(%rbp), %esi
movq -0x48(%rbp), %rdi
callq 0x73aa
cmpl $0x0, 0x8(%rax)
jle 0x3587
movq %rax, %r14
xorl %r13d, %r13d
xorl %r15d, %r15d
movq (%r14), %rsi
addq %r13, %rsi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x5b8c
incq %r15
movslq 0x8(%r14), %rax
addq $0x4, %r13
cmpq %rax, %r15
jl 0x3566
movl $0x1, %esi
testb $0x1, -0x30(%rbp)
movl $0x0, %eax
jne 0x3548
movq -0x50(%rbp), %rcx
incl %ecx
movq -0x38(%rbp), %rax
cmpl 0xf0(%rax), %ecx
jl 0x353a
movq -0x38(%rbp), %r12
cmpl $0x0, 0x30(%r12)
jle 0x370a
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 0x6cda
cmpl $-0x1, (%rax)
je 0x36f9
movq %r15, %rdi
movl %r13d, %esi
callq 0x6cda
movl (%rax), %esi
movq -0x30(%rbp), %rdi
callq 0x687e
testb $0x10, (%rax)
jne 0x36af
movq %r15, %rdi
movl %r13d, %esi
callq 0x6cda
movl (%rax), %esi
movq -0x30(%rbp), %rdi
callq 0x687e
movq %rax, -0x40(%rbp)
movl 0x4(%rax), %r12d
movl %r12d, %esi
sarl %esi
movq -0x48(%rbp), %rdi
callq 0x6abc
movb (%rax), %al
andb $0x1, %r12b
xorb %al, %r12b
movb 0x8b24(%rip), %cl       # 0xc174
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 0x36f9
movq -0x40(%rbp), %rax
movl 0x4(%rax), %esi
sarl %esi
movq %r15, %rdi
callq 0x6cda
cmpl $-0x1, (%rax)
je 0x36f9
movq -0x40(%rbp), %rax
movl 0x4(%rax), %esi
sarl %esi
movq %r15, %rdi
callq 0x6cda
movl (%rax), %esi
movq -0x30(%rbp), %rdi
callq 0x6990
cmpq -0x40(%rbp), %rax
jne 0x36f9
movq %r15, %rdi
movl %r13d, %esi
callq 0x6cda
movl (%rax), %esi
movq %r15, %r12
movq -0x30(%rbp), %r15
movq %r15, %rdi
callq 0x69f0
movl (%rax), %eax
andl $0x3, %eax
cmpl $0x1, %eax
je 0x3849
movq %r12, %rdi
movl %r13d, %esi
callq 0x5c3e
movq %r15, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x5b8c
movq %r12, %r15
movq -0x38(%rbp), %r12
incq %r14
movslq 0x30(%r12), %rax
cmpq %rax, %r14
jl 0x35d6
movq %r12, %r14
leaq 0x18(%r12), %rdi
xorl %r15d, %r15d
cmpl $0x0, 0x20(%r12)
movl $0x0, %r13d
jle 0x37a7
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 0x69f0
movl (%rax), %eax
andl $0x3, %eax
cmpl $0x1, %eax
je 0x3781
movq (%r15), %rsi
addq %r14, %rsi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x5b8c
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 0x373f
subl -0x30(%rbp), %r13d
movq -0x38(%rbp), %r14
xorl %r15d, %r15d
movl %r13d, %esi
callq 0x5c9e
leaq 0x8(%r14), %r12
cmpl $0x0, 0x10(%r14)
jle 0x3830
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 0x69f0
movl (%rax), %eax
andl $0x3, %eax
cmpl $0x1, %eax
je 0x3814
movq (%r12), %rsi
addq %r13, %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x5b8c
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 0x37d2
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 0x5c9e
movl $0x10, %edi
callq 0x20a0
movq %rax, %rbx
leaq 0x4856(%rip), %rsi      # 0x80b3
movq %rax, %rdi
callq 0x21d0
movq 0x876c(%rip), %rsi      # 0xbfd8
movq 0x871d(%rip), %rdx      # 0xbf90
movq %rbx, %rdi
callq 0x2250
movq %rax, %r14
movq %rbx, %rdi
callq 0x20f0
movq %r14, %rdi
callq 0x2270