let hash = ref (Hashtbl.create 64)
let init () = hash := Hashtbl.create 64

let fresh name =
  match Hashtbl.find_opt !hash name with
  | None ->
      Hashtbl.add !hash name 0;
      name
  | Some count ->
      let new_count = count + 1 in
      Hashtbl.replace !hash name new_count;
      Format.sprintf "%s_%d" name new_count
