let find_loc_nodes pdg state loc =
  let nodes, undef = State.get_loc_nodes state loc in
  let nodes, undef = match undef with
    | Some undef ->
      let state = get_init_state pdg in
      let init_nodes, init_undef = State.get_loc_nodes state undef in
      let init_nodes = match loc with
        | Locations.Zone.Top(_,_) ->
            begin
              try (find_top_input_node pdg, None)::init_nodes
              with PdgIndex.NotFound -> init_nodes
            end
        | _ -> init_nodes
      in
      let nodes = List.fold_left (fun acc n -> n::acc) nodes init_nodes in
        nodes, init_undef
    | None -> nodes, undef
  in
    nodes, undef