let get_exit_edges cfg src =
  debug "[get_exit_edges] of %a@." pp_node src;
  let do_node n acc =
    let add_exit e acc =
      let dst = edge_dst e in
      match node_type dst with
      | Vexit ->
          debug
            "[get_exit_edges] add %a@." pp_edge e;
          (* (succ_e cfg dst) @ acc *)
          e :: acc
      | _ -> acc
    in fold_succ_e add_exit cfg n acc
  in
  let rec do_node_and_preds n acc =
    let acc = do_node n acc in
    if CFG.V.compare src n = 0 then acc
    else do_preds n acc
  and do_preds n acc =
    fold_pred do_node_and_preds cfg n acc
  in
  let edges = try do_preds (node_after cfg src) [] with Not_found -> [] in
    if edges = [] then
      debug "[get_exit_edges] -> empty";
    edges