(* Ltac simplify_typed_comparison := match goal with | |- semax _ (PROPx _ (LOCALx (`(typed_true _) ?A :: _) _)) _ _ => (eapply typed_true_binop_int; [reflexivity | reflexivity | reflexivity | try solve [go_lowerx; apply prop_right; auto ] | try solve [go_lowerx; apply prop_right; auto ] | ]) || (let a := fresh "a" in set (a:=A); simpl in a; unfold a; clear a; eapply local_entail_at_semax_0; [ first [ apply typed_true_Oeq_nullval | apply typed_true_One_nullval ] |  ]) | |- semax _ (PROPx _ (LOCALx (`(typed_false _) ?A :: _) _)) _ _ => (eapply typed_false_binop_int; [reflexivity | reflexivity | reflexivity | try solve [go_lowerx; apply prop_right; auto ] | try solve [go_lowerx; apply prop_right; auto ] | ]) || let a := fresh "a" in set (a:=A); simpl in a; unfold a; clear a; eapply local_entail_at_semax_0; [ first [ apply typed_false_Oeq_nullval | apply typed_false_One_nullval ] |  ] | |- _ => idtac end. *)
Definition compare_pp op p q :=
match p with
| Vptr b z =>
match q with
| Vptr b' z' => if eq_block b b'
then Vint (if Ptrofs.cmpu op z z' then Int.one else Int.zero)
else Vundef
| _ => Vundef
end
| _ => Vundef
end.

(* Specifications: *)
Lemma force_sem_cmp_pp:
forall op p q,
isptr p -> isptr q ->
force_val (sem_cmp_pp op p q) =
match op with
| Ceq => Vint (if eq_dec p q then Int.one else Int.zero)
| Cne => Vint (if eq_dec p q then Int.zero else Int.one)
| _ => compare_pp op p q
end.