val va_wpProof_Loop_rounds_1_15_shift_body : i:nat -> msg0:va_operand_vec_opr ->
  msg1:va_operand_vec_opr -> block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
  -> Ghost (va_state & va_fuel & unit)
  (requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_15_shift_body i msg0 msg1 block va_s0 va_k))
  (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_15_shift_body i msg0
    msg1) ([va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0, va_g))))
let va_wpProof_Loop_rounds_1_15_shift_body i msg0 msg1 block va_s0 va_k =
  let (va_sM, va_f0) = va_lemma_Loop_rounds_1_15_shift_body (va_code_Loop_rounds_1_15_shift_body i
    msg0 msg1) va_s0 i msg0 msg1 block in
  va_lemma_upd_update va_sM;
  assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0)));
  va_lemma_norm_mods ([va_mod_vec_opr msg0]) va_sM va_s0;
  let va_g = () in
  (va_sM, va_f0, va_g)
val va_wpProof_Loop_rounds_1_15_shift_body : i:nat -> msg0:va_operand_vec_opr ->
  msg1:va_operand_vec_opr -> block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
  -> Ghost (va_state & va_fuel & unit)
  (requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_15_shift_body i msg0 msg1 block va_s0 va_k))
  (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_15_shift_body i msg0
    msg1) ([va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0, va_g))))
let va_wpProof_Loop_rounds_1_15_shift_body i msg0 msg1 block va_s0 va_k =
let va_sM, va_f0 =
  va_lemma_Loop_rounds_1_15_shift_body (va_code_Loop_rounds_1_15_shift_body i msg0 msg1)
    va_s0
    i
    msg0
    msg1
    block
in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0)));
va_lemma_norm_mods ([va_mod_vec_opr msg0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
Vale.SHA.PPC64LE.Rounds.Core.fst.checked
Vale.SHA2.Wrapper.fsti.checked Vale.SHA.PPC64LE.SHA_helpers.fsti.checked Vale.PPC64LE.State.fsti.checked Vale.PPC64LE.Stack_i.fsti.checked Vale.PPC64LE.QuickCodes.fsti.checked Vale.PPC64LE.QuickCode.fst.checked Vale.PPC64LE.Memory.fsti.checked Vale.PPC64LE.Machine_s.fst.checked Vale.PPC64LE.InsVector.fsti.checked Vale.PPC64LE.InsStack.fsti.checked Vale.PPC64LE.InsMem.fsti.checked Vale.PPC64LE.InsBasic.fsti.checked Vale.PPC64LE.Decls.fsti.checked Vale.Def.Words_s.fsti.checked Vale.Def.Words.Seq_s.fsti.checked Vale.Def.Types_s.fst.checked Vale.Def.Opaque_s.fsti.checked Vale.Arch.Types.fsti.checked Vale.Arch.HeapImpl.fsti.checked Spec.SHA2.fsti.checked Spec.Loops.fst.checked Spec.Hash.Definitions.fst.checked Spec.Agile.Hash.fsti.checked prims.fst.checked FStar.Seq.Base.fsti.checked FStar.Seq.fst.checked FStar.Pervasives.Native.fst.checked FStar.Pervasives.fsti.checked
Vale.SHA.PPC64LE.Rounds.Core.fst
Prims.nat Vale.PPC64LE.Decls.va_operand_vec_opr Vale.SHA.PPC64LE.SHA_helpers.block_w Vale.PPC64LE.Decls.va_state Prims.unit Vale.PPC64LE.Decls.va_fuel FStar.Pervasives.Native.Mktuple3 Vale.PPC64LE.QuickCode.va_lemma_norm_mods Prims.Cons Vale.PPC64LE.QuickCode.mod_t Vale.PPC64LE.QuickCode.va_mod_vec_opr Prims.Nil Prims._assert Vale.PPC64LE.Decls.va_state_eq Vale.PPC64LE.Decls.va_update_ok Vale.PPC64LE.Decls.va_update_operand_vec_opr Vale.PPC64LE.Decls.va_lemma_upd_update FStar.Pervasives.Native.tuple3 FStar.Pervasives.Native.tuple2 Vale.PPC64LE.Machine_s.state Vale.SHA.PPC64LE.Rounds.Core.va_lemma_Loop_rounds_1_15_shift_body Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_1_15_shift_body
module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body

[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_3_7_11_body i msg =
  (va_Block (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) msg
    (va_op_reg_opr_reg 4) Secret) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 4)
    (va_op_reg_opr_reg 4) 16) (va_CNil ()))))

[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_3_7_11_body i msg =
  (va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) msg
    (va_op_reg_opr_reg 4) Secret) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 4)
    (va_op_reg_opr_reg 4) 16) (va_ttrue ())))

[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_3_7_11_body (va_mods:va_mods_t) (i:nat) (msg:vec_opr) (in_b:buffer128)
  (offset:nat) : (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
  (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
    "***** PRECONDITION NOT MET AT line 79 column 26 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
    (va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) msg (va_op_reg_opr_reg 4) Secret
    in_b offset) (va_QSeq va_range1
    "***** PRECONDITION NOT MET AT line 80 column 11 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
    (va_quick_AddImm (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 4) 16) (va_QEmpty (())))))

[@"opaque_to_smt"]
let va_lemma_Loop_rounds_3_7_11_body va_b0 va_s0 i msg in_b offset =
  let (va_mods:va_mods_t) = [va_Mod_reg 4; va_Mod_ok; va_mod_vec_opr msg] in
  let va_qc = va_qcode_Loop_rounds_3_7_11_body va_mods i msg in_b offset in
  let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_3_7_11_body i msg) va_qc
    va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
    "***** POSTCONDITION NOT MET AT line 55 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
    (va_get_ok va_sM) /\ (label va_range1
    "***** POSTCONDITION NOT MET AT line 76 column 73 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
    (va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
    (Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM))) /\ label
    va_range1
    "***** POSTCONDITION NOT MET AT line 77 column 29 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
    (va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 16))) in
  assert_norm (va_qc.mods == va_mods);
  va_lemma_norm_mods ([va_Mod_reg 4; va_Mod_ok; va_mod_vec_opr msg]) va_sM va_s0;
  (va_sM, va_fM)


[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k =
  let (va_sM, va_f0) = va_lemma_Loop_rounds_3_7_11_body (va_code_Loop_rounds_3_7_11_body i msg)
    va_s0 i msg in_b offset in
  va_lemma_upd_update va_sM;
  assert (va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok va_sM (va_update_operand_vec_opr
    msg va_sM va_s0))));
  va_lemma_norm_mods ([va_Mod_reg 4; va_mod_vec_opr msg]) va_sM va_s0;
  let va_g = () in
  (va_sM, va_f0, va_g)

//--
//-- Loop_rounds_1_15_shift_body

val va_code_Loop_rounds_1_15_shift_body : i:nat -> msg0:va_operand_vec_opr ->
  msg1:va_operand_vec_opr -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_1_15_shift_body i msg0 msg1 =
  (va_Block (va_CCons (if (i `op_Modulus` 4 = 1) then va_Block (va_CCons (va_code_Vsldoi msg0 msg1
    msg1 4) (va_CNil ())) else va_Block (va_CCons (if (i `op_Modulus` 4 = 2) then va_Block
    (va_CCons (va_code_Vsldoi msg0 msg1 msg1 8) (va_CNil ())) else va_Block (va_CCons (if (i
    `op_Modulus` 4 = 3) then va_Block (va_CCons (va_code_Vsldoi msg0 msg1 msg1 12) (va_CNil ()))
    else va_Block (va_CNil ())) (va_CNil ()))) (va_CNil ()))) (va_CNil ())))

val va_codegen_success_Loop_rounds_1_15_shift_body : i:nat -> msg0:va_operand_vec_opr ->
  msg1:va_operand_vec_opr -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_1_15_shift_body i msg0 msg1 =
  (va_pbool_and (if (i `op_Modulus` 4 = 1) then va_pbool_and (va_codegen_success_Vsldoi msg0 msg1
    msg1 4) (va_ttrue ()) else va_pbool_and (if (i `op_Modulus` 4 = 2) then va_pbool_and
    (va_codegen_success_Vsldoi msg0 msg1 msg1 8) (va_ttrue ()) else va_pbool_and (if (i
    `op_Modulus` 4 = 3) then va_pbool_and (va_codegen_success_Vsldoi msg0 msg1 msg1 12) (va_ttrue
    ()) else va_ttrue ()) (va_ttrue ())) (va_ttrue ())) (va_ttrue ()))

[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_1_15_shift_body (va_mods:va_mods_t) (i:nat) (msg0:vec_opr) (msg1:vec_opr)
  (block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_15_shift_body i msg0 msg1)) =
  (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1
    "***** PRECONDITION NOT MET AT line 100 column 15 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
    (va_qInlineIf va_mods (i `op_Modulus` 4 = 1) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
    va_range1
    "***** PRECONDITION NOT MET AT line 102 column 15 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
    (va_quick_Vsldoi msg0 msg1 msg1 4) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->
    va_QBind va_range1
    "***** PRECONDITION NOT MET AT line 104 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
    (va_qInlineIf va_mods (i `op_Modulus` 4 = 2) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
    va_range1
    "***** PRECONDITION NOT MET AT line 106 column 15 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
    (va_quick_Vsldoi msg0 msg1 msg1 8) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->
    va_QBind va_range1
    "***** PRECONDITION NOT MET AT line 108 column 13 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
    (va_qInlineIf va_mods (i `op_Modulus` 4 = 3) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
    va_range1
    "***** PRECONDITION NOT MET AT line 110 column 15 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
    (va_quick_Vsldoi msg0 msg1 msg1 12) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->
    va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QEmpty (()))))) (fun (va_s:va_state) va_g ->
    va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QEmpty (()))))


val va_lemma_Loop_rounds_1_15_shift_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
  msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> block:block_w
  -> Ghost (va_state & va_fuel)
  (requires (va_require_total va_b0 (va_code_Loop_rounds_1_15_shift_body i msg0 msg1) va_s0 /\
    va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_get_ok va_s0 /\ l_and (l_and
    (0 <= i) (i < 16)) (i `op_Modulus` 4 =!= 0) /\ msg0 == i /\ msg1 == i - i `op_Modulus` 4 /\ (i
    `op_Modulus` 4 == 1 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi2 (va_eval_vec_opr va_s0 msg1)
    == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 2 ==>
    Vale.Def.Words_s.__proj__Mkfour__item__lo1 (va_eval_vec_opr va_s0 msg1) ==
    Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 3 ==>
    Vale.Def.Words_s.__proj__Mkfour__item__lo0 (va_eval_vec_opr va_s0 msg1) ==
    Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)))
  (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
    Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM msg0) ==
    Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i /\ va_state_eq va_sM (va_update_ok va_sM
    (va_update_operand_vec_opr msg0 va_sM va_s0))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_1_15_shift_body va_b0 va_s0 i msg0 msg1 block =
  let (va_mods:va_mods_t) = [va_Mod_ok; va_mod_vec_opr msg0] in
  let va_qc = va_qcode_Loop_rounds_1_15_shift_body va_mods i msg0 msg1 block in
  let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_1_15_shift_body i msg0
    msg1) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
    "***** POSTCONDITION NOT MET AT line 83 column 1 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
    (va_get_ok va_sM) /\ label va_range1
    "***** POSTCONDITION NOT MET AT line 98 column 40 of file /home/gebner/everest/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
    (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM msg0) ==
    Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) in
  assert_norm (va_qc.mods == va_mods);
  va_lemma_norm_mods ([va_Mod_ok; va_mod_vec_opr msg0]) va_sM va_s0;
  (va_sM, va_fM)

[@ va_qattr]
let va_wp_Loop_rounds_1_15_shift_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
  (block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
  (va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_get_ok va_s0 /\ l_and (l_and
    (0 <= i) (i < 16)) (i `op_Modulus` 4 =!= 0) /\ msg0 == i /\ msg1 == i - i `op_Modulus` 4 /\ (i
    `op_Modulus` 4 == 1 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi2 (va_eval_vec_opr va_s0 msg1)
    == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 2 ==>
    Vale.Def.Words_s.__proj__Mkfour__item__lo1 (va_eval_vec_opr va_s0 msg1) ==
    Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 3 ==>
    Vale.Def.Words_s.__proj__Mkfour__item__lo0 (va_eval_vec_opr va_s0 msg1) ==
    Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (forall (va_x_msg0:va_value_vec_opr) . let
    va_sM = va_upd_operand_vec_opr msg0 va_x_msg0 va_s0 in va_get_ok va_sM /\
    Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM msg0) ==
    Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i ==> va_k va_sM (())))


val va_wpProof_Loop_rounds_1_15_shift_body : i:nat -> msg0:va_operand_vec_opr ->
  msg1:va_operand_vec_opr -> block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
  -> Ghost (va_state & va_fuel & unit)
  (requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_15_shift_body i msg0 msg1 block va_s0 va_k))
  (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_15_shift_body i msg0
    msg1) ([va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0, va_g))))
val va_wpProof_Loop_rounds_1_15_shift_body : i:nat -> msg0:va_operand_vec_opr ->
  msg1:va_operand_vec_opr -> block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
  -> Ghost (va_state & va_fuel & unit)
  (requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_15_shift_body i msg0 msg1 block va_s0 va_k))
  (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_15_shift_body i msg0
    msg1) ([va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0, va_g))))

    i: Prims.nat ->
    msg0: Vale.PPC64LE.Decls.va_operand_vec_opr ->
    msg1: Vale.PPC64LE.Decls.va_operand_vec_opr ->
    block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
    va_s0: Vale.PPC64LE.Decls.va_state ->
    va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
  -> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit)