function v = BR_2lit_val(L1,L2,ccp)
% BR_2lit_val - probability of 2-variable conditional probability: P(L1|L2)
% On input:
%     L1 (int): first literal
%     L2 (int): second literal
%     ccp (1x2^n vector): cc probabilities
% On output:
%     v (float): probability of P(L1|L2) = P(L1^L2)/P(L2)
% Author:
%     T. Henderson
%     UU
%     Fall 2017
%

v = 0;

num_cc = length(ccp);
n = log2(num_cc);
p = 0;
p_L2 = 0;
for b = 0:num_cc-1
    bits = BR_int2bits(b,n);
    if (bits(abs(L1))==(L1>0))&(bits(abs(L2))==(L2>0))
        p = p + ccp(b+1);
    end
    if (bits(abs(L2))==(L2>0))
        p_L2 = p_L2 + ccp(b+1);
    end
end
ap = BR_cc_probs2ap(ccp);
v = p/p_L2;
