function [vtable_out,index,new_entry] = BR_put_vtable(vtable,L1,L2,L3,c,op)
% BR_put_table - add entry to vtable
% On input:
%     vtable (kx7 array): variable table
%     L1 (int): first literal value
%     L2 (int): second literal value
%     L3 (int): third literal value (or 0 if none)
%     c (int): clause number
%     op (int): operator value (1 is 'AND'; 2 is 'OR')
% On output:
%     vtable_out (px1 array): updated vtable
%     index (int): index of added (or existing) variable
%     new_entry (Boolean): 1 if new entry, esle 0
% Call:
%     [vtable,index23,ne] = BR_put_vtable(vtable,1,2,3,3,1)
% Author:
%     T. Henderson
%     UU
%     Summer 2018
%

vtable_out = vtable;
new_entry = 0;
p = BR_parity(L1,L2,L3);
index = BR_get_vtable(vtable,L1,L2,L3,0,p,op);
if isempty(index)
    len_vtable = length(vtable(:,1));
    vtable_out(len_vtable+1,1:7) = [L1,L2,L3,c,p,len_vtable+1,op];
    index = len_vtable + 1;
    new_entry = 1;
end
