Function: comint-previous-matching-input-from-input

Search backwards through input history for match for current input.
(Previous history elements are earlier commands.)
With prefix argument N, search for Nth previous match.
If N is negative, search forwards for the -Nth following match. (fn N)