Definition map4 {A B} (f:A -> B) a :=
  match a with (a0, a1, a2, a3) => (f a0, f a1, f a2, f a3) end.Definition bytelist2Z (l:list byte) : Z :=
  match l with
      [a; b; c; d] => Byte.unsigned d + Byte.unsigned c * 2^8 + Byte.unsigned b * 2^16 + Byte.unsigned a * 2^24
    | _ => 0 end.Definition hexstring_to_Z s := bytelist2Z (hexstring_to_bytelist s).Goal Zmod (hexstring_to_Z "c0a8787e"%string +
      hexstring_to_Z "9fd1161d"%string) (2^32)  =
     hexstring_to_Z "60798e9b"%string.(*Explicit definition of sum following Bernstein's "Salsa20 specification" paper:*)
Definition sum (a b:int): int :=
  Int.repr (Zmod (Int.unsigned a + Int.unsigned b) (2^32)).

(* Specifications: *)
Lemma sum_add: forall x y, sum x y = Int.add x y.
Lemma sum_zero_r a: sum a Int.zero = a.
Lemma sum_sym a b: sum a b = sum b a.
Lemma sum_zero_l a: sum Int.zero a = a.