let get_divmod_assertion
    ~simplify_constants:simplify_constants
    ~warning:warning
    divisor_expr =
  (* division or modulo: overflow occurs when divisor is equal to zero *)
  let badValDivisor = Int64.zero
  in let assertion () =
      let term = translate_C_expr_to_term divisor_expr
      in Logic_const.prel (Rneq, term, Cil.lconstant badValDivisor)
  in if simplify_constants then (
      match get_expr_val divisor_expr with
        | None -> (* divisor is not a constant (or it's value has not been computed) *)
            [ (assertion (), None) ]
        | Some v64 ->
            if Int64.compare v64 badValDivisor = 0 then
              (* divide by 0 *)
              let assertion = assertion ()
              in
                if warning then
                  rte_warn "divisor assert broken: %a" d_predicate_named assertion
                ;
                [ (assertion, Some (make_check_false ())) ]
            else
              (* divide by constant which is not 0 *)
              (* nothing to assert *)
              []
    ) else [ (assertion (), None) ]