let register_modified_zones lmap stmt inst =
  let register lmap zone =
    (* [exact] should always be false because we want to store all the stmts *)
    InitSid.add_zone ~exact:false lmap zone stmt.sid
  in
  let process_froms lmap froms =
    let from_table = froms.Function_Froms.deps_table in
      try Lmap_bitwise.From_Model.fold
            (fun out _ lmap -> register lmap out) from_table lmap
      with Lmap_bitwise.From_Model.Cannot_fold ->
        (R.debug ~level:1 "register_modified_zones : top on stmt(%d) : %a@."
          stmt.sid !Ast_printer.d_stmt stmt;
        register lmap Locations.Zone.top)
  in
    match inst with
      | Set (lval, _, _) ->
          let _dpds, _exact, zone = get_lval_zones stmt lval in
            register lmap zone
      | Call (lvaloption,funcexp,_args,_) ->
          begin
            let lmap = match lvaloption with None -> lmap
              | Some lval ->
                  let _dpds, _exact, zone = get_lval_zones stmt lval in
                    register lmap zone
            in
              try
                let froms = !Db.From.Callwise.find (Kstmt stmt) in
                  process_froms lmap froms
              with Not_found -> (* don't have callwise (-calldeps option) *)
                let _funcexp_dpds, called_functions =
                  !Db.Value.expr_to_kernel_function
                    ~with_alarms:CilE.warn_none_mode
                    (Kstmt stmt) ~deps:(Some Locations.Zone.bottom) funcexp
                in
                  Kernel_function.Set.fold
                    (fun kf lmap -> process_froms lmap (!Db.From.get kf))
                    called_functions
                    lmap
          end
      | _ -> lmap