Open Scope Z.
(* Note: x must be non-zero, y is allowed to be zero (because x is a constant in all usages, its non-zero-check seems to be removed by the parser). *)
Definition mul_with_table(x y: Z)(pow: list int)(log: list Z): int :=
if Int.eq (if Int.eq (Int.repr y) Int.zero then Int.zero else Int.one) Int.zero
then Int.zero
else Znth (Int.unsigned
(Int.mods (Int.repr (Znth x log + Znth y log))
(Int.repr 255))) pow.
Definition Z_to_val(x: Z): val := if zeq x (-1) then Vundef else Vint (Int.repr x).

Lemma Z_to_val_to_Vint: forall j,
j <> -1 ->
Z_to_val j = Vint (Int.repr j).