let rec lift_offset ty = function
  | Index(idx1,(Index(_idx2, _off) as suboff)) ->
      let subty = direct_element_type ty in
      let siz = array_size subty in
      begin match lift_offset subty suboff with
        | Index(idx, off) ->
            let mulidx = new_exp (BinOp(Mult,idx1,constant_expr siz,intType)) in
            (* Keep info at top-level for visitors on terms that where
             * translated to expressions. Those expect these info when
             * translating back to term.
             *)

            let addidx =
              map_under_info (fun _e ->
                                new_exp (BinOp(PlusA,mulidx,idx,intType))) idx1
            in
            Index(addidx,off)
        | _ -> assert false
      end
  | Index(idx1,NoOffsetas off ->
      let subty = direct_element_type ty in
      if isArrayType subty then
        let siz = array_size subty in
        (* Keep info at top-level *)
        let mulidx =
          map_under_info
            (fun _e -> new_exp (BinOp(Mult,idx1,constant_expr siz,intType))) idx1
        in
        Index(mulidx,NoOffset)
      else off
  | off -> off