Definition maskzero (x: aval) (mask: int) : abool :=
match x with
| I i => Just (Int.eq (Int.and i mask) Int.zero)
| Uns p n => if Int.eq (Int.zero_ext n mask) Int.zero then Maybe true else Btop
| _ => Btop
end.

Lemma maskzero_sound:
forall mask v x,
vmatch v x ->
cmatch (Val.maskzero_bool v mask) (maskzero x mask).