// File: Myyura[P]MyyuraSat/./source/./solver_search.cpp
// Function: MyyuraSat::Solver::pick_branch_literal()
Literal Solver::pick_branch_literal(void) {
    Variable v = VARIABLE_UNDEF;
    int max_activity = 0;

    for (Variable i = 0; i < n_variables(); i++) {
        if (value(i) != LIFTED_BOOLEAN_UNDEF) { continue; }

        int activity = 0;
        for (int j = 0; j < _clauses.size(); j++) {
            Clause& c = _ca[_clauses[j]];
            if (c.mark()) { continue; }
            
            for (int k = 0; k < c.size(); k++) {
                if (c[k].variable() == i) { 
                    activity++; 
                    break;
                }
            }
        }
        if (activity > max_activity) {
            v = i;
            max_activity = activity;
        }
    }

    if (v != VARIABLE_UNDEF) {
        _polarity[v] = !_polarity[v];
        return _polarity[v] ? Literal(v) : ~Literal(v);
    }

    return LITERAL_UNDEF;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0xfffffffe, -0x14(%rbp) # imm = 0xFFFFFFFE
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x40(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, -0x44(%rbp)
callq 0x7530
movl %eax, %ecx
movl -0x44(%rbp), %eax
cmpl %ecx, %eax
jge 0x51dd
movq -0x40(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x90e0
movb %al, -0x1d(%rbp)
leaq -0x1d(%rbp), %rdi
leaq 0x11077(%rip), %rsi     # 0x16156
callq 0x7840
testb $0x1, %al
jne 0x50ea
jmp 0x50ef
jmp 0x51cf
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movq -0x40(%rbp), %rdi
movl -0x28(%rbp), %eax
movl %eax, -0x48(%rbp)
addq $0x8, %rdi
callq 0x7d70
movl %eax, %ecx
movl -0x48(%rbp), %eax
cmpl %ecx, %eax
jge 0x51b9
movq -0x40(%rbp), %rdi
movq %rdi, %rax
addq $0xf8, %rax
movq %rax, -0x50(%rbp)
addq $0x8, %rdi
movl -0x28(%rbp), %esi
callq 0x7d90
movq -0x50(%rbp), %rdi
movl (%rax), %esi
callq 0x7aa0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x9110
cmpl $0x0, %eax
je 0x5159
jmp 0x51ab
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x54(%rbp)
movq -0x30(%rbp), %rdi
callq 0x8b00
movl %eax, %ecx
movl -0x54(%rbp), %eax
cmpl %ecx, %eax
jge 0x51a9
movq -0x30(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x8ee0
movq %rax, %rdi
callq 0x7db0
cmpl -0x1c(%rbp), %eax
jne 0x519c
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x51a9
jmp 0x519e
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x5160
jmp 0x51ab
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x50fd
movl -0x24(%rbp), %eax
cmpl -0x18(%rbp), %eax
jle 0x51cd
movl -0x1c(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x18(%rbp)
jmp 0x51cf
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x50a9
cmpl $-0x2, -0x14(%rbp)
je 0x525c
movq -0x40(%rbp), %rdi
addq $0x170, %rdi            # imm = 0x170
movl -0x14(%rbp), %esi
callq 0x8cd0
movq -0x40(%rbp), %rdi
movb (%rax), %al
xorb $-0x1, %al
movb %al, -0x55(%rbp)
addq $0x170, %rdi            # imm = 0x170
movl -0x14(%rbp), %esi
callq 0x8cd0
movb -0x55(%rbp), %cl
movq -0x40(%rbp), %rdi
andb $0x1, %cl
movb %cl, (%rax)
addq $0x170, %rdi            # imm = 0x170
movl -0x14(%rbp), %esi
callq 0x8cd0
testb $0x1, (%rax)
je 0x5240
movl -0x14(%rbp), %esi
leaq -0x4(%rbp), %rdi
xorl %edx, %edx
callq 0x7430
jmp 0x525a
movl -0x14(%rbp), %esi
leaq -0x38(%rbp), %rdi
xorl %edx, %edx
callq 0x7430
leaq -0x38(%rbp), %rdi
callq 0x75b0
movl %eax, -0x4(%rbp)
jmp 0x5265
movl 0x10eea(%rip), %eax     # 0x1614c
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nop