let find_code_annot_nodes pdg stmt annot =
  Pdg_parameters.debug "[pdg:annotation] CodeAnnot-%d stmt %d : %a @."
    annot.annot_id stmt.sid
    !Ast_printer.d_code_annotation annot;
  if Db.Value.is_reachable_stmt stmt then
    try
      begin
        let kf =  Pdg.get_kf pdg in
        let (data_info, decl_info), pragmas =
          !Db.Properties.Interp.To_zone.from_stmt_annot annot (stmt, kf)
        in
        let data_dpds = zone_info_nodes pdg data_info in
        let decl_nodes = get_decl_nodes pdg decl_info in
        let stmt_key = Key.stmt_key stmt in
        let stmt_node = match stmt_key with
          | Key.Stmt _ -> !Db.Pdg.find_stmt_node pdg stmt
          | Key.CallStmt _ -> !Db.Pdg.find_call_ctrl_node pdg stmt
          | _ -> assert false
        in
        let ctrl_dpds = !Db.Pdg.direct_ctrl_dpds pdg stmt_node in
        let add_stmt_nodes s acc =
          (!Db.Pdg.find_stmt_and_blocks_nodes pdg s) @ acc in
        (* can safely ignore pragmas.ctrl
         * because we already have the ctrl dpds from the stmt node. *)

        let stmt_pragmas = pragmas.Db.Properties.Interp.To_zone.stmt in
        let ctrl_dpds = Stmt.Set.fold add_stmt_nodes stmt_pragmas ctrl_dpds in
        if Pdg_parameters.debug_atleast 2 then begin
          let p fmt (n,z) = match z with
            | None -> Node.pretty fmt n
            | Some z -> Format.fprintf fmt "%a(%a)"
                Node.pretty n Locations.Zone.pretty z
          in
          let pl fmt l = List.iter (fun n -> Format.fprintf fmt " %a" p n) l in
          Pdg_parameters.debug " ctrl nodes = %a"
            Node.pretty_list ctrl_dpds;
          Pdg_parameters.debug " decl nodes = %a"
            Node.pretty_list decl_nodes;
          match data_dpds with
            | None ->
                Pdg_parameters.debug " data nodes = None (failed to compute)"
            | Some (data_nodes, data_undef) ->
                begin
                Pdg_parameters.debug " data nodes = %a" pl data_nodes;
                match data_undef with
                  | None -> ()
                  | Some data_undef ->
                      Pdg_parameters.debug " data undef = %a"
                        Locations.Zone.pretty data_undef;
                end
        end;
        ctrl_dpds, decl_nodes, data_dpds
      end
    with Extlib.NotYetImplemented msg ->
      raise (Extlib.NotYetImplemented
               ("[pdg:find_code_annot_nodes] to_zone : "^msg))
  else begin
    Pdg_parameters.debug ~level:2
      "[pdg:annotation] CodeAnnot-%d : unreachable stmt ! @."
      annot.annot_id;
    raise Not_found (* unreachable statement *)
  end