let merge_action_bindings kf ki pre post vals =
  let actions =
    try
      let my_vals = Actions.find (kf,ki,pre,post) in
      let merge_range loc base r1 r2 =
        match r1,r2 with
          | NoneNone -> None
          | Some r, None | NoneSome r -> Some r
          | Some r1, Some r2 -> Some (merge_range loc base r1 r2)
      in
      let merge_bindings loc b1 b2 =
        match b1, b2 with
          | NoneNone -> None
          | Some b, None | NoneSome b -> Some b
          | Some b1, Some b2 ->
            let b =
              Cil_datatype.Term.Map.merge (merge_range loc) b1 b2 in
            Some b
      in
      Cil_datatype.Term.Map.merge merge_bindings my_vals vals
    with Not_found -> vals
  in
  Aorai_option.debug ~dkey:"action"
    "Merging actions of %a (statement %a), from state %s to state %s"
    Kernel_function.pretty kf Cil_datatype.Kinstr.pretty ki
    pre.name post.name;
  Cil_datatype.Term.Map.iter
    (fun l _ -> Aorai_option.debug ~dkey:"action"
      "Got binding for %a" Cil_datatype.Term.pretty l)
    actions;
  Actions.replace (kf,ki,pre,post) actions