val va_wp_AES256EncryptBlockStdcall
      (win: bool)
      (input: quad32)
      (key: (seq nat32))
      (input_buffer output_buffer keys_buffer: buffer128)
      (va_s0: va_state)
      (va_k: (va_state -> unit -> Type0))
    : Type0
let va_wp_AES256EncryptBlockStdcall (win:bool) (input:quad32) (key:(seq nat32))
  (input_buffer:buffer128) (output_buffer:buffer128) (keys_buffer:buffer128) (va_s0:va_state)
  (va_k:(va_state -> unit -> Type0)) : Type0 =
  (va_get_ok va_s0 /\ (let (output_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 (input_ptr:(va_int_range 0
    18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64
    rRsi va_s0) in let (expanded_key_ptr:(va_int_range 0 18446744073709551615)) = va_if win (fun _
    -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in aesni_enabled /\ sse_enabled
    /\ Vale.AES.AES_s.is_aes_key_LE AES_256 key /\ Vale.X64.Decls.buffer128_read input_buffer 0
    (va_get_mem_heaplet 0 va_s0) == input /\ expanded_key_ptr == Vale.X64.Memory.buffer_addr
    #Vale.X64.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0 va_s0) /\
    Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) input_ptr input_buffer 1
    (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1
    va_s0) output_ptr output_buffer 1 (va_get_mem_layout va_s0) Secret /\
    Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) expanded_key_ptr keys_buffer 15
    (va_get_mem_layout va_s0) Secret /\ (forall (i:nat) . i < 15 ==> Vale.X64.Decls.buffer128_read
    keys_buffer i (va_get_mem_heaplet 0 va_s0) == FStar.Seq.Base.index #Vale.Def.Types_s.quad32
    (Vale.AES.AES_s.key_to_round_keys_LE AES_256 key) i)) /\ (forall (va_x_mem:vale_heap)
    (va_x_r8:nat64) (va_x_heap1:vale_heap) (va_x_xmm0:quad32) (va_x_xmm2:quad32)
    (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 2 va_x_xmm2
    (va_upd_xmm 0 va_x_xmm0 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_reg64 rR8 va_x_r8 (va_upd_mem
    va_x_mem va_s0))))) in va_get_ok va_sM /\ (let (output_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 (input_ptr:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->
    va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let
    (expanded_key_ptr:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8
    va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in Vale.X64.Decls.modifies_mem
    (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 output_buffer) (va_get_mem_heaplet 1
    va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.X64.Decls.buffer128_read output_buffer 0
    (va_get_mem_heaplet 1 va_sM) == Vale.AES.AES_s.aes_encrypt_LE AES_256 key input) ==> va_k va_sM
    (())))
val va_wp_AES256EncryptBlockStdcall
      (win: bool)
      (input: quad32)
      (key: (seq nat32))
      (input_buffer output_buffer keys_buffer: buffer128)
      (va_s0: va_state)
      (va_k: (va_state -> unit -> Type0))
    : Type0
let va_wp_AES256EncryptBlockStdcall
      (win: bool)
      (input: quad32)
      (key: (seq nat32))
      (input_buffer output_buffer keys_buffer: buffer128)
      (va_s0: va_state)
      (va_k: (va_state -> unit -> Type0))
    : Type0 =
(va_get_ok va_s0 /\
  (let output_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 input_ptr:(va_int_range 0 18446744073709551615) =
      va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0)
    in
    let expanded_key_ptr:(va_int_range 0 18446744073709551615) =
      va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0)
    in
    aesni_enabled /\ sse_enabled /\ Vale.AES.AES_s.is_aes_key_LE AES_256 key /\
    Vale.X64.Decls.buffer128_read input_buffer 0 (va_get_mem_heaplet 0 va_s0) == input /\
    expanded_key_ptr ==
    Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0 va_s0) /\
    Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
      input_ptr
      input_buffer
      1
      (va_get_mem_layout va_s0)
      Secret /\
    Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0)
      output_ptr
      output_buffer
      1
      (va_get_mem_layout va_s0)
      Secret /\
    Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
      expanded_key_ptr
      keys_buffer
      15
      (va_get_mem_layout va_s0)
      Secret /\
    (forall (i: nat).
        i < 15 ==>
        Vale.X64.Decls.buffer128_read keys_buffer i (va_get_mem_heaplet 0 va_s0) ==
        FStar.Seq.Base.index #Vale.Def.Types_s.quad32
          (Vale.AES.AES_s.key_to_round_keys_LE AES_256 key)
          i)) /\
  (forall (va_x_mem: vale_heap)
      (va_x_r8: nat64)
      (va_x_heap1: vale_heap)
      (va_x_xmm0: quad32)
      (va_x_xmm2: quad32)
      (va_x_efl: Vale.X64.Flags.t).
      let va_sM =
        va_upd_flags va_x_efl
          (va_upd_xmm 2
              va_x_xmm2
              (va_upd_xmm 0
                  va_x_xmm0
                  (va_upd_mem_heaplet 1
                      va_x_heap1
                      (va_upd_reg64 rR8 va_x_r8 (va_upd_mem va_x_mem va_s0)))))
      in
      va_get_ok va_sM /\
      (let output_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 input_ptr:(va_int_range 0 18446744073709551615) =
          va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0)
        in
        let expanded_key_ptr:(va_int_range 0 18446744073709551615) =
          va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0)
        in
        Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128
              output_buffer)
          (va_get_mem_heaplet 1 va_s0)
          (va_get_mem_heaplet 1 va_sM) /\
        Vale.X64.Decls.buffer128_read output_buffer 0 (va_get_mem_heaplet 1 va_sM) ==
        Vale.AES.AES_s.aes_encrypt_LE AES_256 key input) ==>
      va_k va_sM (())))
Vale.AES.X64.AES256.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.Def.Types_s.fst.checked Vale.Def.Opaque_s.fsti.checked Vale.Arch.Types.fsti.checked Vale.AES.AES_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.AES256.fsti
Prims.bool Vale.X64.Decls.quad32 FStar.Seq.Base.seq Vale.X64.Memory.nat32 Vale.X64.Memory.buffer128 Vale.X64.Decls.va_state Prims.unit Prims.l_and Prims.b2t Vale.X64.Decls.va_get_ok Vale.X64.CPU_Features_s.aesni_enabled Vale.X64.CPU_Features_s.sse_enabled Vale.AES.AES_s.is_aes_key_LE Vale.AES.AES_common_s.AES_256 Prims.eq2 Vale.X64.Decls.buffer128_read Vale.X64.Decls.va_get_mem_heaplet Prims.int Vale.X64.Memory.buffer_addr Vale.X64.Memory.vuint128 Vale.X64.Decls.validSrcAddrs128 Vale.X64.Decls.va_get_mem_layout Vale.Arch.HeapTypes_s.Secret Vale.X64.Decls.validDstAddrs128 Prims.l_Forall Prims.nat Prims.l_imp Prims.op_LessThan Vale.Def.Types_s.quad32 FStar.Seq.Base.index Vale.AES.AES_s.key_to_round_keys_LE Vale.X64.Decls.va_int_range Vale.X64.Decls.va_if Vale.Def.Types_s.nat64 Vale.X64.Decls.va_get_reg64 Vale.X64.Machine_s.rR8 Prims.l_not Vale.X64.Machine_s.rRdx Vale.X64.Machine_s.rRsi Vale.X64.Machine_s.rRcx Vale.X64.Machine_s.rRdi Vale.X64.InsBasic.vale_heap Vale.X64.Memory.nat64 Vale.X64.Flags.t Vale.X64.Decls.modifies_mem Vale.X64.Decls.loc_buffer Vale.AES.AES_s.aes_encrypt_LE Vale.X64.State.vale_state Vale.X64.Decls.va_upd_flags Vale.X64.Decls.va_upd_xmm Vale.X64.Decls.va_upd_mem_heaplet Vale.X64.Decls.va_upd_reg64 Vale.X64.Decls.va_upd_mem
module Vale.AES.X64.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_s
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.Arch.Types
open Vale.AES.AES256_helpers
open Vale.X64.CPU_Features_s
#reset-options "--z3rlimit 20"
//-- KeyExpansion256Stdcall

val va_code_KeyExpansion256Stdcall : win:bool -> Tot va_code

val va_codegen_success_KeyExpansion256Stdcall : win:bool -> Tot va_pbool

val va_lemma_KeyExpansion256Stdcall : va_b0:va_code -> va_s0:va_state -> win:bool ->
  input_key_b:buffer128 -> output_key_expansion_b:buffer128
  -> Ghost (va_state & va_fuel)
  (requires (va_require_total va_b0 (va_code_KeyExpansion256Stdcall win) va_s0 /\ va_get_ok va_s0
    /\ (let (key_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0
    else va_get_reg64 rRdi va_s0) in let (key_expansion_ptr:(va_int_range 0 18446744073709551615))
    = (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let
    (key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers.make_AES256_key
    (Vale.X64.Decls.buffer128_read input_key_b 0 (va_get_mem_heaplet 0 va_s0))
    (Vale.X64.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s0)) in aesni_enabled /\
    avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
    key_ptr input_key_b 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128
    (va_get_mem_heaplet 1 va_s0) key_expansion_ptr output_key_expansion_b 15 (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 (key_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0
    else va_get_reg64 rRdi va_s0) in let (key_expansion_ptr:(va_int_range 0 18446744073709551615))
    = (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let
    (key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers.make_AES256_key
    (Vale.X64.Decls.buffer128_read input_key_b 0 (va_get_mem_heaplet 0 va_s0))
    (Vale.X64.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s0)) in aesni_enabled /\
    avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_sM)
    key_ptr input_key_b 2 (va_get_mem_layout va_sM) Secret /\ Vale.X64.Decls.validDstAddrs128
    (va_get_mem_heaplet 1 va_sM) key_expansion_ptr output_key_expansion_b 15 (va_get_mem_layout
    va_sM) Secret) /\ (let (key_ptr:(va_int_range 0 18446744073709551615)) = (if win then
    va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) in let (key_expansion_ptr:(va_int_range 0
    18446744073709551615)) = (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in
    let (key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers.make_AES256_key
    (Vale.X64.Decls.buffer128_read input_key_b 0 (va_get_mem_heaplet 0 va_s0))
    (Vale.X64.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s0)) in
    Vale.X64.Decls.modifies_buffer128 output_key_expansion_b (va_get_mem_heaplet 1 va_s0)
    (va_get_mem_heaplet 1 va_sM) /\ (forall (j:nat) . {:pattern(buffer128_read
    output_key_expansion_b j (va_get_mem_heaplet 1 va_sM))}j <= 14 ==>
    Vale.X64.Decls.buffer128_read output_key_expansion_b j (va_get_mem_heaplet 1 va_sM) ==
    FStar.Seq.Base.index #Vale.Def.Types_s.quad32 (Vale.AES.AES_s.key_to_round_keys_LE AES_256 key)
    j)) /\ va_state_eq va_sM (va_update_flags 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_mem_heaplet 1 va_sM (va_update_reg64
    rRdx va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))
[@ va_qattr]
let va_wp_KeyExpansion256Stdcall (win:bool) (input_key_b:buffer128)
  (output_key_expansion_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
  (va_get_ok va_s0 /\ (let (key_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
    (key_expansion_ptr:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64
    rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let (key:(FStar.Seq.Base.seq
    Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers.make_AES256_key
    (Vale.X64.Decls.buffer128_read input_key_b 0 (va_get_mem_heaplet 0 va_s0))
    (Vale.X64.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s0)) in aesni_enabled /\
    avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
    key_ptr input_key_b 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128
    (va_get_mem_heaplet 1 va_s0) key_expansion_ptr output_key_expansion_b 15 (va_get_mem_layout
    va_s0) Secret) /\ (forall (va_x_mem:vale_heap) (va_x_rdx:nat64) (va_x_heap1:vale_heap)
    (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
    (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (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_mem_heaplet 1
    va_x_heap1 (va_upd_reg64 rRdx va_x_rdx (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
    (let (key_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 (key_expansion_ptr:(va_int_range 0
    18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64
    rRsi va_s0) in let (key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) =
    Vale.AES.AES256_helpers.make_AES256_key (Vale.X64.Decls.buffer128_read input_key_b 0
    (va_get_mem_heaplet 0 va_s0)) (Vale.X64.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet
    0 va_s0)) in aesni_enabled /\ avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validSrcAddrs128
    (va_get_mem_heaplet 0 va_sM) key_ptr input_key_b 2 (va_get_mem_layout va_sM) Secret /\
    Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) key_expansion_ptr
    output_key_expansion_b 15 (va_get_mem_layout va_sM) Secret) /\ (let (key_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 (key_expansion_ptr:(va_int_range 0 18446744073709551615)) = va_if win (fun _
    -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let (key:(FStar.Seq.Base.seq
    Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers.make_AES256_key
    (Vale.X64.Decls.buffer128_read input_key_b 0 (va_get_mem_heaplet 0 va_s0))
    (Vale.X64.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s0)) in
    Vale.X64.Decls.modifies_buffer128 output_key_expansion_b (va_get_mem_heaplet 1 va_s0)
    (va_get_mem_heaplet 1 va_sM) /\ (forall (j:nat) . {:pattern(buffer128_read
    output_key_expansion_b j (va_get_mem_heaplet 1 va_sM))}j <= 14 ==>
    Vale.X64.Decls.buffer128_read output_key_expansion_b j (va_get_mem_heaplet 1 va_sM) ==
    FStar.Seq.Base.index #Vale.Def.Types_s.quad32 (Vale.AES.AES_s.key_to_round_keys_LE AES_256 key)
    j)) ==> va_k va_sM (())))

val va_wpProof_KeyExpansion256Stdcall : win:bool -> input_key_b:buffer128 ->
  output_key_expansion_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_KeyExpansion256Stdcall win input_key_b
    output_key_expansion_b va_s0 va_k))
  (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansion256Stdcall win)
    ([va_Mod_flags; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_mem_heaplet 1;
    va_Mod_reg64 rRdx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansion256Stdcall (win:bool) (input_key_b:buffer128)
  (output_key_expansion_b:buffer128) : (va_quickCode unit (va_code_KeyExpansion256Stdcall win)) =
  (va_QProc (va_code_KeyExpansion256Stdcall win) ([va_Mod_flags; va_Mod_xmm 4; va_Mod_xmm 3;
    va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_mem_heaplet 1; va_Mod_reg64 rRdx; va_Mod_mem])
    (va_wp_KeyExpansion256Stdcall win input_key_b output_key_expansion_b)
    (va_wpProof_KeyExpansion256Stdcall win input_key_b output_key_expansion_b))
//--
//-- AES256EncryptBlock

val va_code_AES256EncryptBlock : va_dummy:unit -> Tot va_code

val va_codegen_success_AES256EncryptBlock : va_dummy:unit -> Tot va_pbool

val va_lemma_AES256EncryptBlock : va_b0:va_code -> va_s0:va_state -> input:quad32 -> key:(seq
  nat32) -> round_keys:(seq quad32) -> keys_buffer:buffer128
  -> Ghost (va_state & va_fuel)
  (requires (va_require_total va_b0 (va_code_AES256EncryptBlock ()) va_s0 /\ va_get_ok va_s0 /\
    (aesni_enabled /\ sse_enabled) /\ Vale.AES.AES_s.is_aes_key_LE AES_256 key /\
    FStar.Seq.Base.length #quad32 round_keys == 15 /\ round_keys ==
    Vale.AES.AES_s.key_to_round_keys_LE AES_256 key /\ va_get_xmm 0 va_s0 == input /\ va_get_reg64
    rR8 va_s0 == Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_buffer
    (va_get_mem_heaplet 0 va_s0) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
    (va_get_reg64 rR8 va_s0) keys_buffer 15 (va_get_mem_layout va_s0) Secret /\ (forall (i:nat) . i
    < 15 ==> Vale.X64.Decls.buffer128_read keys_buffer i (va_get_mem_heaplet 0 va_s0) ==
    FStar.Seq.Base.index #quad32 round_keys i)))
  (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
    va_get_xmm 0 va_sM == Vale.AES.AES_s.aes_encrypt_LE AES_256 key input /\ va_state_eq va_sM
    (va_update_flags va_sM (va_update_xmm 2 va_sM (va_update_xmm 0 va_sM (va_update_ok va_sM
    va_s0))))))
[@ va_qattr]
let va_wp_AES256EncryptBlock (input:quad32) (key:(seq nat32)) (round_keys:(seq quad32))
  (keys_buffer:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
  (va_get_ok va_s0 /\ (aesni_enabled /\ sse_enabled) /\ Vale.AES.AES_s.is_aes_key_LE AES_256 key /\
    FStar.Seq.Base.length #quad32 round_keys == 15 /\ round_keys ==
    Vale.AES.AES_s.key_to_round_keys_LE AES_256 key /\ va_get_xmm 0 va_s0 == input /\ va_get_reg64
    rR8 va_s0 == Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_buffer
    (va_get_mem_heaplet 0 va_s0) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
    (va_get_reg64 rR8 va_s0) keys_buffer 15 (va_get_mem_layout va_s0) Secret /\ (forall (i:nat) . i
    < 15 ==> Vale.X64.Decls.buffer128_read keys_buffer i (va_get_mem_heaplet 0 va_s0) ==
    FStar.Seq.Base.index #quad32 round_keys i) /\ (forall (va_x_xmm0:quad32) (va_x_xmm2:quad32)
    (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 2 va_x_xmm2
    (va_upd_xmm 0 va_x_xmm0 va_s0)) in va_get_ok va_sM /\ va_get_xmm 0 va_sM ==
    Vale.AES.AES_s.aes_encrypt_LE AES_256 key input ==> va_k va_sM (())))

val va_wpProof_AES256EncryptBlock : input:quad32 -> key:(seq nat32) -> round_keys:(seq quad32) ->
  keys_buffer: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_AES256EncryptBlock input key round_keys keys_buffer va_s0
    va_k))
  (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AES256EncryptBlock ()) ([va_Mod_flags;
    va_Mod_xmm 2; va_Mod_xmm 0]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AES256EncryptBlock (input:quad32) (key:(seq nat32)) (round_keys:(seq quad32))
  (keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptBlock ())) =
  (va_QProc (va_code_AES256EncryptBlock ()) ([va_Mod_flags; va_Mod_xmm 2; va_Mod_xmm 0])
    (va_wp_AES256EncryptBlock input key round_keys keys_buffer) (va_wpProof_AES256EncryptBlock
    input key round_keys keys_buffer))
//--
//-- AES256EncryptBlockStdcall

val va_code_AES256EncryptBlockStdcall : win:bool -> Tot va_code

val va_codegen_success_AES256EncryptBlockStdcall : win:bool -> Tot va_pbool

val va_lemma_AES256EncryptBlockStdcall : va_b0:va_code -> va_s0:va_state -> win:bool ->
  input:quad32 -> key:(seq nat32) -> input_buffer:buffer128 -> output_buffer:buffer128 ->
  keys_buffer:buffer128
  -> Ghost (va_state & va_fuel)
  (requires (va_require_total va_b0 (va_code_AES256EncryptBlockStdcall win) va_s0 /\ va_get_ok
    va_s0 /\ (let (output_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64
    rRcx va_s0 else va_get_reg64 rRdi va_s0) in let (input_ptr:(va_int_range 0
    18446744073709551615)) = (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in
    let (expanded_key_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR8
    va_s0 else va_get_reg64 rRdx va_s0) in aesni_enabled /\ sse_enabled /\
    Vale.AES.AES_s.is_aes_key_LE AES_256 key /\ Vale.X64.Decls.buffer128_read input_buffer 0
    (va_get_mem_heaplet 0 va_s0) == input /\ expanded_key_ptr == Vale.X64.Memory.buffer_addr
    #Vale.X64.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0 va_s0) /\
    Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) input_ptr input_buffer 1
    (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1
    va_s0) output_ptr output_buffer 1 (va_get_mem_layout va_s0) Secret /\
    Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) expanded_key_ptr keys_buffer 15
    (va_get_mem_layout va_s0) Secret /\ (forall (i:nat) . i < 15 ==> Vale.X64.Decls.buffer128_read
    keys_buffer i (va_get_mem_heaplet 0 va_s0) == FStar.Seq.Base.index #Vale.Def.Types_s.quad32
    (Vale.AES.AES_s.key_to_round_keys_LE AES_256 key) i))))
  (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
    (let (output_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0
    else va_get_reg64 rRdi va_s0) in let (input_ptr:(va_int_range 0 18446744073709551615)) = (if
    win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let
    (expanded_key_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0
    else va_get_reg64 rRdx va_s0) in Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer
    #Vale.X64.Memory.vuint128 output_buffer) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
    va_sM) /\ Vale.X64.Decls.buffer128_read output_buffer 0 (va_get_mem_heaplet 1 va_sM) ==
    Vale.AES.AES_s.aes_encrypt_LE AES_256 key input) /\ va_state_eq va_sM (va_update_flags va_sM
    (va_update_xmm 2 va_sM (va_update_xmm 0 va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64
    rR8 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))
[@ va_qattr]
let va_wp_AES256EncryptBlockStdcall (win:bool) (input:quad32) (key:(seq nat32))
  (input_buffer:buffer128) (output_buffer:buffer128) (keys_buffer:buffer128) (va_s0:va_state)
val va_wp_AES256EncryptBlockStdcall
      (win: bool)
      (input: quad32)
      (key: (seq nat32))
      (input_buffer output_buffer keys_buffer: buffer128)
      (va_s0: va_state)
      (va_k: (va_state -> unit -> Type0))
    : Type0

    win: Prims.bool ->
    input: Vale.X64.Decls.quad32 ->
    key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
    input_buffer: Vale.X64.Memory.buffer128 ->
    output_buffer: Vale.X64.Memory.buffer128 ->
    keys_buffer: Vale.X64.Memory.buffer128 ->
    va_s0: Vale.X64.Decls.va_state ->
    va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
  -> Type0