function cp = BR_ccp2cp(vars,ccp)
%

num_cc = length(ccp);
n = log2(num_cc);
L1 = vars(1);
L2 = vars(2);

switch length(vars)
    case 2
        P_L2 = 0;
        P_L1andL2 = 0;
        for c = 0:num_cc-1
            bits = BR_int2bits(c,n);
            if (bits(abs(L1))==(L1>0))&(bits(abs(L2))==(L2>0))
                P_L1andL2 = P_L1andL2 + ccp(c+1);
            end
            if bits(abs(L2))==(L2>0)
                P_L2 = P_L2 + ccp(c+1);
            end
        end
        cp = P_L1andL2/P_L2;
        return
    case 3
        L3 = vars(3);
        P_AB_or_AC = 0;
        P_BorC = 0;
        for c = 0:num_cc-1
            bits = BR_int2bits(c,n);
            if ((bits(abs(L1))==(L1>0))&(bits(abs(L2))==(L2>0)))...
                    |((bits(abs(L1))==(L1>0))&(bits(abs(L3))==(L3>0)))
                P_AB_or_AC = P_AB_or_AC + ccp(c+1);
            end
            if (bits(abs(L2))==(L2>0))|(bits(abs(L3))==(L3>0))
                P_BorC = P_BorC + ccp(c+1);
            end
        end
        cp = P_AB_or_AC/P_BorC;
        return
end

        