let get_bitwise_shift_right_operand_assertion
    ~simplify_constants:simplify_constants
    ~warning:warning
    exp roperand =
  let t = Cil.typeOf exp in
  let size = bitsSizeOf t in
  let size64 = My_bigint.of_int size in
  let right_operand_assertion () =
    let term = translate_C_expr_to_term roperand in
    Logic_const.pand
      (Logic_const.prel (Rge, term, Cil.lzero ()),
       Logic_const.prel (Rlt, term, Cil.lconstant size64))
  in
  let problem_with_operand_assertion () =
    if simplify_constants then (
      match get_expr_val roperand with
      | None -> (false,false)
      | Some c64 ->
              (* right operand is constant:
                 check it is nonnegative and stricly less than size *)

        if (My_bigint.lt c64 size64) && (My_bigint.ge c64 My_bigint.zero)
        then (true,true)  (* constant operator and assertion holds *)
        else (true,false(* constant operator and assertion does not hold *)
    ) else (false,false)
  in
  match problem_with_operand_assertion () with
  | (true,false->
    let assertion = right_operand_assertion () in
    if warning then
      rte_warn
        fmt_warn_shift_assert4
        d_predicate_named assertion;
    [ assertion, Some Property_status.False_if_reachable ], false
  | (true,true-> [ ], true
  | (false,_)  ->  
    [ right_operand_assertion (), None ], true