let export ~file ?pp_edge_fun cfg =
  let utf8 = !Cil.print_utf8 in Cil.print_utf8 := false;
  let edge_txt = match pp_edge_fun with
    | None ->
      (fun e -> match  (edge_type e) with
      | Ecase (_::_) -> Pretty_utils.sfprintf "%a" EL.pretty (edge_type e)
      | _ -> ""
      )
    | Some pp -> (fun e -> Pretty_utils.sfprintf "%a" pp e)
  in
  let module P = Printer (struct let edge_txt = edge_txt endin
  let module GPrint = Graph.Graphviz.Dot(Pin
  let oc = open_out file in
  GPrint.output_graph oc (cfg_graph cfg, edge_txt);
  close_out oc;
  Cil.print_utf8 := utf8