let select (candidates: candidates) (replay: Jumping.guiding_step option) : selected option =
(* try right splits first *)
match select_right_split candidates with
| (Some _) as right_split ->
right_split
| None ->
(* the build all unprocessed candidates
and find the best left split *)
build_unprocessed ~force:true candidates;
let left_split =
get_best_candidate candidates
in
match left_split with
| None ->
None
| Some (candidate, split_literal, index) ->
Some (split candidates candidate split_literal index replay)