val va_quick_Keyhash_init
      (win: bool)
      (alg: algorithm)
      (key: (seq nat32))
      (roundkeys_b hkeys_b: buffer128)
    : (va_quickCode unit (va_code_Keyhash_init win alg))
let va_quick_Keyhash_init (win:bool) (alg:algorithm) (key:(seq nat32)) (roundkeys_b:buffer128)
  (hkeys_b:buffer128) : (va_quickCode unit (va_code_Keyhash_init win alg)) =
  (va_QProc (va_code_Keyhash_init win alg) ([va_Mod_flags; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm
    4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_mem_layout;
    va_Mod_mem_heaplet 1; va_Mod_reg64 rR12; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64
    rRcx; va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_Keyhash_init win alg key roundkeys_b hkeys_b)
    (va_wpProof_Keyhash_init win alg key roundkeys_b hkeys_b))
val va_quick_Keyhash_init
      (win: bool)
      (alg: algorithm)
      (key: (seq nat32))
      (roundkeys_b hkeys_b: buffer128)
    : (va_quickCode unit (va_code_Keyhash_init win alg))
let va_quick_Keyhash_init
      (win: bool)
      (alg: algorithm)
      (key: (seq nat32))
      (roundkeys_b hkeys_b: buffer128)
    : (va_quickCode unit (va_code_Keyhash_init win alg)) =
(va_QProc (va_code_Keyhash_init win alg)
    ([
        va_Mod_flags; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;
        va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_mem_layout; va_Mod_mem_heaplet 1; va_Mod_reg64 rR12;
        va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem
      ])
    (va_wp_Keyhash_init win alg key roundkeys_b hkeys_b)
    (va_wpProof_Keyhash_init win alg key roundkeys_b hkeys_b))
Vale.AES.X64.GF128_Init.fsti.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.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.fst.checked FStar.Pervasives.Native.fst.checked FStar.Pervasives.fsti.checked
Vale.AES.X64.GF128_Init.fsti
Prims.bool Vale.AES.AES_common_s.algorithm FStar.Seq.Base.seq Vale.X64.Memory.nat32 Vale.X64.Memory.buffer128 Vale.X64.QuickCode.va_QProc Prims.unit Vale.AES.X64.GF128_Init.va_code_Keyhash_init Prims.Cons Vale.X64.QuickCode.mod_t Vale.X64.QuickCode.va_Mod_flags Vale.X64.QuickCode.va_Mod_xmm Vale.X64.QuickCode.va_Mod_mem_layout Vale.X64.QuickCode.va_Mod_mem_heaplet Vale.X64.QuickCode.va_Mod_reg64 Vale.X64.Machine_s.rR12 Vale.X64.Machine_s.rR8 Vale.X64.Machine_s.rRdx Vale.X64.Machine_s.rRcx Vale.X64.Machine_s.rRax Vale.X64.QuickCode.va_Mod_mem Prims.Nil Vale.AES.X64.GF128_Init.va_wp_Keyhash_init Vale.AES.X64.GF128_Init.va_wpProof_Keyhash_init 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
//-- Keyhash_init

val va_code_Keyhash_init : win:bool -> alg:algorithm -> Tot va_code

val va_codegen_success_Keyhash_init : win:bool -> alg:algorithm -> Tot va_pbool
let va_req_Keyhash_init (va_b0:va_code) (va_s0:va_state) (win:bool) (alg:algorithm) (key:(seq
  nat32)) (roundkeys_b:buffer128) (hkeys_b:buffer128) : prop =
  (va_require_total va_b0 (va_code_Keyhash_init win alg) va_s0 /\ va_get_ok va_s0 /\ (let
    (round_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else
    va_get_reg64 rRdi va_s0) in let (hkey_ptr:(va_int_range 0 18446744073709551615)) = (if win then
    va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in Vale.X64.Memory.is_initial_heap
    (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (aesni_enabled /\ pclmulqdq_enabled /\
    avx_enabled /\ sse_enabled) /\ (alg = AES_128 \/ alg = AES_256) /\
    Vale.X64.Decls.buffers_disjoint128 roundkeys_b hkeys_b /\ Vale.AES.AES_s.is_aes_key_LE alg key
    /\ Vale.X64.Decls.buffer128_as_seq (va_get_mem va_s0) roundkeys_b ==
    Vale.AES.AES_s.key_to_round_keys_LE alg key /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem
    va_s0) round_ptr roundkeys_b (Vale.AES.AES_common_s.nr alg + 1) (va_get_mem_layout va_s0)
    Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0) hkey_ptr hkeys_b 8
    (va_get_mem_layout va_s0) Secret))
let va_ens_Keyhash_init (va_b0:va_code) (va_s0:va_state) (win:bool) (alg:algorithm) (key:(seq
  nat32)) (roundkeys_b:buffer128) (hkeys_b:buffer128) (va_sM:va_state) (va_fM:va_fuel) : prop =
  (va_req_Keyhash_init va_b0 va_s0 win alg key roundkeys_b hkeys_b /\ va_ensure_total va_b0 va_s0
    va_sM va_fM /\ va_get_ok va_sM /\ (let (round_ptr:(va_int_range 0 18446744073709551615)) = (if
    win then va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) in let (hkey_ptr:(va_int_range 0
    18446744073709551615)) = (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in
    Vale.X64.Decls.modifies_buffer128 hkeys_b (va_get_mem va_s0) (va_get_mem va_sM) /\
    Vale.AES.OptPublic.hkeys_reqs_pub (Vale.X64.Decls.s128 (va_get_mem va_sM) hkeys_b)
    (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
    (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0))) /\ va_get_xmm 6 va_sM == va_get_xmm
    6 va_s0 /\ va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\ va_state_eq va_sM
    (va_update_flags va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM
    (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM
    (va_update_mem_layout va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR12 va_sM
    (va_update_reg64 rR8 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM
    (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))

val va_lemma_Keyhash_init : va_b0:va_code -> va_s0:va_state -> win:bool -> alg:algorithm ->
  key:(seq nat32) -> roundkeys_b:buffer128 -> hkeys_b:buffer128
  -> Ghost (va_state & va_fuel)
  (requires (va_require_total va_b0 (va_code_Keyhash_init win alg) va_s0 /\ va_get_ok va_s0 /\ (let
    (round_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else
    va_get_reg64 rRdi va_s0) in let (hkey_ptr:(va_int_range 0 18446744073709551615)) = (if win then
    va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in Vale.X64.Memory.is_initial_heap
    (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (aesni_enabled /\ pclmulqdq_enabled /\
    avx_enabled /\ sse_enabled) /\ (alg = AES_128 \/ alg = AES_256) /\
    Vale.X64.Decls.buffers_disjoint128 roundkeys_b hkeys_b /\ Vale.AES.AES_s.is_aes_key_LE alg key
    /\ Vale.X64.Decls.buffer128_as_seq (va_get_mem va_s0) roundkeys_b ==
    Vale.AES.AES_s.key_to_round_keys_LE alg key /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem
    va_s0) round_ptr roundkeys_b (Vale.AES.AES_common_s.nr alg + 1) (va_get_mem_layout va_s0)
    Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0) hkey_ptr hkeys_b 8
    (va_get_mem_layout va_s0) Secret)))
  (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
    (let (round_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0
    else va_get_reg64 rRdi va_s0) in let (hkey_ptr:(va_int_range 0 18446744073709551615)) = (if win
    then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in Vale.X64.Decls.modifies_buffer128
    hkeys_b (va_get_mem va_s0) (va_get_mem va_sM) /\ Vale.AES.OptPublic.hkeys_reqs_pub
    (Vale.X64.Decls.s128 (va_get_mem va_sM) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32
    (Vale.AES.AES_s.aes_encrypt_LE alg key (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
    0))) /\ va_get_xmm 6 va_sM == va_get_xmm 6 va_s0 /\ va_get_reg64 rR12 va_sM == va_get_reg64
    rR12 va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
    va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
    va_sM (va_update_xmm 0 va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 1 va_sM
    (va_update_reg64 rR12 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRdx va_sM
    (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem
    va_sM va_s0)))))))))))))))))))
[@ va_qattr]
let va_wp_Keyhash_init (win:bool) (alg:algorithm) (key:(seq nat32)) (roundkeys_b:buffer128)
  (hkeys_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
  (va_get_ok va_s0 /\ (let (round_ptr:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->
    va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (hkey_ptr:(va_int_range 0
    18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64
    rRsi va_s0) in Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\
    (aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\ sse_enabled) /\ (alg = AES_128 \/ alg =
    AES_256) /\ Vale.X64.Decls.buffers_disjoint128 roundkeys_b hkeys_b /\
    Vale.AES.AES_s.is_aes_key_LE alg key /\ Vale.X64.Decls.buffer128_as_seq (va_get_mem va_s0)
    roundkeys_b == Vale.AES.AES_s.key_to_round_keys_LE alg key /\ Vale.X64.Decls.validSrcAddrs128
    (va_get_mem va_s0) round_ptr roundkeys_b (Vale.AES.AES_common_s.nr alg + 1) (va_get_mem_layout
    va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0) hkey_ptr hkeys_b 8
    (va_get_mem_layout va_s0) Secret) /\ (forall (va_x_mem:vale_heap) (va_x_rax:nat64)
    (va_x_rcx:nat64) (va_x_rdx:nat64) (va_x_r8:nat64) (va_x_r12:nat64) (va_x_heap1:vale_heap)
    (va_x_memLayout:vale_heap_layout) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32)
    (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
    (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 6 va_x_xmm6
    (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2
    (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_mem_layout va_x_memLayout
    (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR8 va_x_r8
    (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRax va_x_rax (va_upd_mem
    va_x_mem va_s0))))))))))))))) in va_get_ok va_sM /\ (let (round_ptr:(va_int_range 0
    18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64
    rRdi va_s0) in let (hkey_ptr:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->
    va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in
    Vale.X64.Decls.modifies_buffer128 hkeys_b (va_get_mem va_s0) (va_get_mem va_sM) /\
    Vale.AES.OptPublic.hkeys_reqs_pub (Vale.X64.Decls.s128 (va_get_mem va_sM) hkeys_b)
    (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
    (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0))) /\ va_get_xmm 6 va_sM == va_get_xmm
    6 va_s0 /\ va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) ==> va_k va_sM (())))

val va_wpProof_Keyhash_init : win:bool -> alg:algorithm -> key:(seq nat32) -> roundkeys_b:buffer128
  -> hkeys_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
  -> Ghost (va_state & va_fuel & unit)
  (requires (va_t_require va_s0 /\ va_wp_Keyhash_init win alg key roundkeys_b hkeys_b va_s0 va_k))
  (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Keyhash_init win alg) ([va_Mod_flags;
    va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
    0; va_Mod_mem_layout; va_Mod_mem_heaplet 1; va_Mod_reg64 rR12; va_Mod_reg64 rR8; va_Mod_reg64
    rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Keyhash_init (win:bool) (alg:algorithm) (key:(seq nat32)) (roundkeys_b:buffer128)
val va_quick_Keyhash_init
      (win: bool)
      (alg: algorithm)
      (key: (seq nat32))
      (roundkeys_b hkeys_b: buffer128)
    : (va_quickCode unit (va_code_Keyhash_init win alg))

    win: Prims.bool ->
    alg: Vale.AES.AES_common_s.algorithm ->
    key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
    roundkeys_b: Vale.X64.Memory.buffer128 ->
    hkeys_b: Vale.X64.Memory.buffer128
  -> Vale.X64.QuickCode.va_quickCode Prims.unit
      (Vale.AES.X64.GF128_Init.va_code_Keyhash_init win alg)