val va_quick_ShiftKey1_128 (f: poly) : (va_quickCode unit (va_code_ShiftKey1_128 ()))
let va_quick_ShiftKey1_128 (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128 ())) =
  (va_QProc (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags])
    (va_wp_ShiftKey1_128 f) (va_wpProof_ShiftKey1_128 f))
val va_quick_ShiftKey1_128 (f: poly) : (va_quickCode unit (va_code_ShiftKey1_128 ()))
let va_quick_ShiftKey1_128 (f: poly) : (va_quickCode unit (va_code_ShiftKey1_128 ())) =
(va_QProc (va_code_ShiftKey1_128 ())
    ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags])
    (va_wp_ShiftKey1_128 f)
    (va_wpProof_ShiftKey1_128 f))
Vale.AES.X64.GF128_Init.fst.checked
Vale.X64.State.fsti.checked Vale.X64.QuickCodes.fsti.checked Vale.X64.QuickCode.fst.checked Vale.X64.Memory.fsti.checked Vale.X64.Machine_s.fst.checked Vale.X64.InsVector.fsti.checked Vale.X64.InsMem.fsti.checked Vale.X64.InsBasic.fsti.checked Vale.X64.InsAes.fsti.checked Vale.X64.Flags.fsti.checked Vale.X64.Decls.fsti.checked Vale.X64.CPU_Features_s.fst.checked Vale.Math.Poly2_s.fsti.checked Vale.Math.Poly2.Words.fsti.checked Vale.Math.Poly2.Lemmas.fsti.checked Vale.Math.Poly2.Bits_s.fsti.checked Vale.Math.Poly2.Bits.fsti.checked Vale.Math.Poly2.fsti.checked Vale.Def.Words_s.fsti.checked Vale.Def.Words.Four_s.fsti.checked Vale.Def.Types_s.fst.checked Vale.Arch.Types.fsti.checked Vale.Arch.HeapImpl.fsti.checked Vale.AES.X64.PolyOps.fsti.checked Vale.AES.X64.GF128_Mul.fsti.checked Vale.AES.X64.AES.fsti.checked Vale.AES.OptPublic.fsti.checked Vale.AES.GHash.fsti.checked Vale.AES.GF128_s.fsti.checked Vale.AES.GF128.fsti.checked Vale.AES.AES_s.fst.checked Vale.AES.AES_common_s.fst.checked Vale.AES.AES256_helpers.fsti.checked prims.fst.checked FStar.Seq.Base.fsti.checked FStar.Seq.fst.checked FStar.Pervasives.Native.fst.checked FStar.Pervasives.fsti.checked
Vale.AES.X64.GF128_Init.fst
Vale.Math.Poly2_s.poly Vale.X64.QuickCode.va_QProc Prims.unit Vale.AES.X64.GF128_Init.va_code_ShiftKey1_128 Prims.Cons Vale.X64.QuickCode.mod_t Vale.X64.QuickCode.va_Mod_xmm Vale.X64.QuickCode.va_Mod_flags Prims.Nil Vale.AES.X64.GF128_Init.va_wp_ShiftKey1_128 Vale.AES.X64.GF128_Init.va_wpProof_ShiftKey1_128 Vale.X64.QuickCode.va_quickCode
module Vale.AES.X64.GF128_Init
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.AES_s
open Vale.AES.AES256_helpers
open Vale.AES.X64.AES
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.AES.X64.GF128_Mul
open Vale.AES.GHash
open Vale.AES.OptPublic
//-- ShiftKey1_128

val va_code_ShiftKey1_128 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_128 () =
  (va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_CCons
    (va_code_ShiftLeft128_1 ()) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5))
    (va_CCons (va_code_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_CCons (va_code_Pshufd
    (va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3)
    (va_op_xmm_xmm 4)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
    (va_op_opr128_xmm 3)) (va_CNil ())))))))))

val va_codegen_success_ShiftKey1_128 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_128 () =
  (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_pbool_and
    (va_codegen_success_ShiftLeft128_1 ()) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm
    3) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pcmpeqd (va_op_xmm_xmm 3)
    (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3)
    255) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
    (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
    (va_op_opr128_xmm 3)) (va_ttrue ()))))))))

[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_128 (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128
  ())) =
  (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
    (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in let
    (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
    (offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s) in
    va_QSeq va_range1
    "***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
    (va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_QBind va_range1
    "***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
    (va_quick_ShiftLeft128_1 h) (fun (va_s:va_state) _ -> va_qPURE va_range1
    "***** PRECONDITION NOT MET AT line 89 column 28 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
    (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32_mask h1) (va_qPURE va_range1
    "***** PRECONDITION NOT MET AT line 90 column 25 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
    (fun (_:unit) -> Vale.Math.Poly2.lemma_shift_define_i h 1 128) (va_QSeq va_range1
    "***** PRECONDITION NOT MET AT line 92 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
    (va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_QBind va_range1
    "***** PRECONDITION NOT MET AT line 93 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
    (va_quick_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (fun (va_s:va_state) _ -> va_qPURE
    va_range1
    "***** PRECONDITION NOT MET AT line 94 column 24 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
    (fun (_:unit) -> Vale.AES.GF128.lemma_test_high_bit h) (va_QBind va_range1
    "***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
    (va_quick_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (fun (va_s:va_state) _ -> va_qPURE
    va_range1
    "***** PRECONDITION NOT MET AT line 96 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
    (fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_zero ()) (va_qPURE va_range1
    "***** PRECONDITION NOT MET AT line 97 column 22 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
    (fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_ones ()) (va_QBind va_range1
    "***** PRECONDITION NOT MET AT line 100 column 12 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
    (va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (fun (va_s:va_state) _ -> va_qPURE
    va_range1
    "***** PRECONDITION NOT MET AT line 101 column 21 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
    (fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_and_consts ()) (va_QSeq va_range1
    "***** PRECONDITION NOT MET AT line 102 column 13 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
    (va_quick_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_opr128_xmm 3)) (va_QEmpty
    (()))))))))))))))))


val va_lemma_ShiftKey1_128 : va_b0:va_code -> va_s0:va_state -> f:poly
  -> Ghost (va_state & va_fuel)
  (requires (va_require_total va_b0 (va_code_ShiftKey1_128 ()) va_s0 /\ va_get_ok va_s0 /\ (let
    (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let
    (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
    (offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
    avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
    Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
    (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127)))
  (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
    (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let
    (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
    (offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
    Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) /\
    va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
    (va_update_flags va_sM (va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_128 va_b0 va_s0 f =
  let (va_mods:va_mods_t) = [va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok] in
  let va_qc = va_qcode_ShiftKey1_128 va_mods f in
  let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_128 ()) va_qc va_s0 (fun
    va_s0 va_sM va_g -> let () = va_g in label va_range1
    "***** POSTCONDITION NOT MET AT line 68 column 1 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
    (va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
    (va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
    (offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
    label va_range1
    "***** POSTCONDITION NOT MET AT line 85 column 50 of file /home/gebner/everest/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
    (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h)))
    in
  assert_norm (va_qc.mods == va_mods);
  va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok]) va_sM
    va_s0;
  (va_sM, va_fM)

[@ va_qattr]
let va_wp_ShiftKey1_128 (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
  (va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
    (va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
    (offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
    avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
    Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
    (Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127) /\ (forall
    (va_x_efl:Vale.X64.Flags.t) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) . let
    va_sM = va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_flags
    va_x_efl va_s0))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
    Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) =
    Vale.Math.Poly2_s.shift h 1 in let (offset:Vale.Math.Poly2_s.poly) =
    Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in Vale.Math.Poly2.Bits_s.of_quad32
    (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) ==> va_k va_sM (())))


val va_wpProof_ShiftKey1_128 : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
  -> Ghost (va_state & va_fuel & unit)
  (requires (va_t_require va_s0 /\ va_wp_ShiftKey1_128 f va_s0 va_k))
  (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3;
    va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_128 f va_s0 va_k =
  let (va_sM, va_f0) = va_lemma_ShiftKey1_128 (va_code_ShiftKey1_128 ()) va_s0 f in
  va_lemma_upd_update va_sM;
  assert (va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
    (va_update_flags va_sM (va_update_ok va_sM va_s0))))));
  va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_sM va_s0;
  let va_g = () in
  (va_sM, va_f0, va_g)

[@ "opaque_to_smt" va_qattr]
val va_quick_ShiftKey1_128 (f: poly) : (va_quickCode unit (va_code_ShiftKey1_128 ()))
f: Vale.Math.Poly2_s.poly
  -> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.AES.X64.GF128_Init.va_code_ShiftKey1_128 ())