let frama_c_offset state actuals =
  try begin
      match actuals with
        [_,x,_] ->
          begin
            let value =
              try
                let offsets =
                  Locations.Location_Bytes.fold_i
                    (fun _b o a -> Ival.join a o)
                    x
                    Ival.bottom
                in
                Cvalue_type.V.inject_ival offsets
              with Locations.Location_Bytes.Error_Top ->
                error
                  "Builtin Frama_C_offset is applied to a value not guaranteed to be an address";
                Cvalue_type.V.top_int
            in
            (wrap_int value), state, Locations.Location_Bits.Top_Param.bottom
          end
      | _ -> raise Offset_error
    end
  with Offset_error ->
    Cilmsg.error "Invalid arguments for builtin Frama_C_offset" ;
    Value_util.do_degenerate None;
    raise Db.Value.Aborted