Add a preconstraint that ``variable == value`` to the state.

        :param value:       The concrete value. Can be a bitvector or a bytestring or an integer.
        :param variable:    The BVS to preconstrain.

def preconstrain(self, value, variable):
        """
        Add a preconstraint that ``variable == value`` to the state.

        :param value:       The concrete value. Can be a bitvector or a bytestring or an integer.
        :param variable:    The BVS to preconstrain.
        """
        if not isinstance(value, claripy.ast.Base):
            value = self.state.solver.BVV(value, len(variable))
        elif value.op != 'BVV':
            raise ValueError("Passed a value to preconstrain that was not a BVV or a string")

        if variable.op not in claripy.operations.leaf_operations:
            l.warning("The variable %s to preconstrain is not a leaf AST. This may cause replacement failures in the "
                      "claripy replacement backend.", variable)
            l.warning("Please use a leaf AST as the preconstraining variable instead.")

        constraint = variable == value
        l.debug("Preconstraint: %s", constraint)

        # add the constraint for reconstraining later
        self.variable_map[next(iter(variable.variables))] = constraint
        self.preconstraints.append(constraint)
        if o.REPLACEMENT_SOLVER in self.state.options:
            self.state.solver._solver.add_replacement(variable, value, invalidate_cache=False)
        else:
            self.state.add_constraints(*self.preconstraints)
        if not self.state.satisfiable():
            l.warning("State went unsat while adding preconstraints")