let rec process_call_inputs proj =
  let rec process (to_select, unused) todo = match todo with
    | [] -> (to_select, unused)
    | (pdg_caller, call, sel, m) as e :: calls ->
        let kf_caller = PdgTypes.Pdg.get_kf pdg_caller in
        let visible, select = match call with
          | Some call ->
              let fm = match get_marks proj kf_caller with
                | None -> fatal "the caller should have marks@."
                | Some fm -> fm
              in
              let visible = call_visible fm call in
                visible, Some (sel, m)
          | None -> (* let see if the function is visible or not *)
              assert (PdgTypes.Pdg.is_top pdg_caller);
              KfTopVisi.get proj kf_caller, None
        in
        let res = if visible then
            let to_select = add_pdg_selection to_select pdg_caller select
            in (to_select, unused)
          else (to_select, e::unused)
        in process res calls
  in
  let to_select, new_list = process ([], []) !call_in_to_check in
    match to_select with
      | [] -> call_in_to_check := []
             (* nothing more to mark : finished ! we can forget [new_list] *)
      | _ ->
          call_in_to_check := new_list;
          List.iter (fun (pdg, sel) -> select_pdg_elements proj pdg sel)
                    to_select;
          process_call_inputs proj