(* This code extends 'word_prelude'. *) let ShiftXor = (fun v7 -> (match v7 with (Pair (v6, v5)) -> (match v5 with (Pair (v4, v3)) -> (match v3 with (Pair (v2, v1)) -> ((word_xor ((word_add ((word_lsl v6) 4)) v2)) ((word_xor ((word_add v6) v4)) ((word_add ((word_asr v6) 5)) v1))))))) ;; let Round = (fun v15 -> (match v15 with (Pair (v14, v13)) -> (match v14 with (Pair (v12, v11)) -> (match v13 with (Pair (v10, v9)) -> (match v10 with (Pair (v8, v7)) -> (match v7 with (Pair (v6, v5)) -> (match v5 with (Pair (v4, v3)) -> (let v2 = ((word_add v9) (let x = 2654435769 in (x mod 4294967296))) in (let v1 = ((word_add v12) (ShiftXor (Pair (v11, (Pair (v2, (Pair (v8, v6)))))))) in (Pair ((Pair (v1, ((word_add v11) (ShiftXor (Pair (v1, (Pair (v2, (Pair (v4, v3)))))))))), (Pair ((Pair (v8, (Pair (v6, (Pair (v4, v3)))))), v2))))))))))))) ;; let InvRound = (fun v13 -> (match v13 with (Pair (v12, v11)) -> (match v12 with (Pair (v10, v9)) -> (match v11 with (Pair (v8, v7)) -> (match v8 with (Pair (v6, v5)) -> (match v5 with (Pair (v4, v3)) -> (match v3 with (Pair (v2, v1)) -> (Pair ((Pair (((word_sub v10) (ShiftXor (Pair (((word_sub v9) (ShiftXor (Pair (v10, (Pair (v7, (Pair (v2, v1)))))))), (Pair (v7, (Pair (v6, v4)))))))), ((word_sub v9) (ShiftXor (Pair (v10, (Pair (v7, (Pair (v2, v1)))))))))), (Pair ((Pair (v6, (Pair (v4, (Pair (v2, v1)))))), ((word_sub v7) (let x = 2654435769 in (x mod 4294967296)))))))))))))) ;; let rec Rounds v3 = (match v3 with (Pair (v2, v1)) -> (if (v2 = (let x = 0 in (x mod 4294967296))) then v1 else (Rounds (Pair (((word_sub v2) (let x = 1 in (x mod 4294967296))), (Round v1)))))) ;; let rec InvRounds v3 = (match v3 with (Pair (v2, v1)) -> (if (v2 = (let x = 0 in (x mod 4294967296))) then v1 else (InvRounds (Pair (((word_sub v2) (let x = 1 in (x mod 4294967296))), (InvRound v1)))))) ;; let teaEncrypt = (fun v8 -> (match v8 with (Pair (v7, v6)) -> (let v5 = (Rounds (Pair ( (let x = 32 in (x mod 4294967296)), (Pair (v6, (Pair (v7, (let x = 0 in (x mod 4294967296))))))))) in (match v5 with (Pair (v4, v3)) -> (match v3 with (Pair (v2, v1)) -> v4))))) ;; let teaDecrypt = (fun v8 -> (match v8 with (Pair (v7, v6)) -> (let v5 = (InvRounds (Pair ( (let x = 32 in (x mod 4294967296)), (Pair (v6, (Pair (v7, ((word_lsl (let x = 2654435769 in (x mod 4294967296))) 5)))))))) in (match v5 with (Pair (v4, v3)) -> (match v3 with (Pair (v2, v1)) -> v4))))) ;;