Definition loword (x: aval) :=
match x with
| L i => I(Int64.loword i)
| _   => ntop1 x
end.

(* Specifications: *)
Lemma loword_sound: forall v x, vmatch v x -> vmatch (Val.loword v) (loword x).
Definition hiword (x: aval) :=
match x with
| L i => I(Int64.hiword i)
| _   => ntop1 x
end.
Lemma hiword_sound: forall v x, vmatch v x -> vmatch (Val.hiword v) (hiword x).
Definition cmp_intv (c: comparison) (i: Z * Z) (n: Z) : abool :=
let (lo, hi) := i in
match c with
| Ceq => if zlt n lo || zlt hi n then Maybe false else Btop
| Cne => Btop
| Clt => if zlt hi n then Maybe true else if zle n lo then Maybe false else Btop
| Cle => if zle hi n then Maybe true else if zlt n lo then Maybe false else Btop
| Cgt => if zlt n lo then Maybe true else if zle hi n then Maybe false else Btop
| Cge => if zle n lo then Maybe true else if zlt hi n then Maybe false else Btop
end.