let rec add_callee_nodes acc nodes =
  let new_nodes, acc = List.fold_left (fun acc2 (node,_) ->
    match !Db.Pdg.node_key node with
    | PdgIndex.Key.SigCallKey (cid,(PdgIndex.Signature.Out out_key)) ->
      let callees =
        Db.Value.call_to_kernel_function (PdgIndex.Key.call_from_id cid)
      in
      Kernel_function.Hptset.fold (fun kf (new_nodes, acc) ->
        let callee_pdg = !Db.Pdg.get kf in
        let outputs = fst (!Db.Pdg.find_output_nodes callee_pdg out_key) in
        outputs @ new_nodes, outputs @ acc)
        callees
        acc2
    | _ -> acc2)
    ([], acc)
    nodes
  in match new_nodes with [] -> acc
    | _ -> add_callee_nodes acc new_nodes