val va_wp_Poly1305
      (win: bool)
      (ctx_b inp_b: buffer64)
      (len_in finish_in: nat64)
      (va_s0: va_state)
      (va_k: (va_state -> unit -> Type0))
    : Type0
let va_wp_Poly1305 (win:bool) (ctx_b:buffer64) (inp_b:buffer64) (len_in:nat64) (finish_in:nat64)
  (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
  (va_get_ok va_s0 /\ (let (ctx_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->
    va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inp_in:(va_int_range 0
    18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64
    rRsi va_s0) in let (n:(va_int_range 18446744073709551616 18446744073709551616)) =
    18446744073709551616 in let (p:(va_int_range 1361129467683753853853498429727072845819
    1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in va_get_reg64
    rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack va_s0) /\ Vale.X64.Memory.is_initial_heap
    (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ Vale.X64.Decls.buffers_disjoint ctx_b inp_b /\
    Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) ctx_in ctx_b 24 (va_get_mem_layout va_s0)
    Public /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inp_in inp_b
    (Vale.Poly1305.Util.readable_words len_in) (va_get_mem_layout va_s0) Public /\ len_in == va_if
    win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) /\ finish_in == va_if
    win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64 rRcx va_s0) /\ (let h2_in =
    Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_s0) in h2_in < 5 /\ inp_in + len_in <
    pow2_64 /\ finish_in < 2)) /\ (forall (va_x_mem:vale_heap) (va_x_rax:nat64) (va_x_rbx:nat64)
    (va_x_rcx:nat64) (va_x_rdx:nat64) (va_x_rsi:nat64) (va_x_rdi:nat64) (va_x_rbp:nat64)
    (va_x_rsp:nat64) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_r10:nat64) (va_x_r11:nat64)
    (va_x_r12:nat64) (va_x_r13:nat64) (va_x_r14:nat64) (va_x_r15:nat64) (va_x_efl:Vale.X64.Flags.t)
    (va_x_heap1:vale_heap) (va_x_memLayout:vale_heap_layout) (va_x_stack:vale_stack)
    (va_x_stackTaint:memtaint) . let va_sM = va_upd_stackTaint va_x_stackTaint (va_upd_stack
    va_x_stack (va_upd_mem_layout va_x_memLayout (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_flags
    va_x_efl (va_upd_reg64 rR15 va_x_r15 (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR13 va_x_r13
    (va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10
    (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8 (va_upd_reg64 rRsp va_x_rsp (va_upd_reg64
    rRbp va_x_rbp (va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdx
    va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax
    (va_upd_mem va_x_mem va_s0))))))))))))))))))))) in va_get_ok va_sM /\ (let
    (ctx_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s0)
    (fun _ -> va_get_reg64 rRdi va_s0) in let (inp_in:(va_int_range 0 18446744073709551615)) =
    va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let
    (n:(va_int_range 18446744073709551616 18446744073709551616)) = 18446744073709551616 in let
    (p:(va_int_range 1361129467683753853853498429727072845819
    1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in
    Vale.Poly1305.Util.modifies_buffer ctx_b (va_get_mem va_s0) (va_get_mem va_sM) /\ (let h0_in =
    Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem va_s0) in let h1_in =
    Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem va_s0) in let h2_in =
    Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_s0) in let key_r0 =
    Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem va_s0) in let key_r1 =
    Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem va_s0) in let key_s0 =
    Vale.X64.Decls.buffer64_read ctx_b 5 (va_get_mem va_s0) in let key_s1 =
    Vale.X64.Decls.buffer64_read ctx_b 6 (va_get_mem va_s0) in let h_in =
    Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 h0_in h1_in) h2_in in let
    key_r = Vale.Poly1305.Math.lowerUpper128 key_r0 key_r1 in let key_s =
    Vale.Poly1305.Math.lowerUpper128 key_s0 key_s1 in let h0_out = Vale.X64.Decls.buffer64_read
    ctx_b 0 (va_get_mem va_sM) in let h1_out = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem
    va_sM) in let h2_out = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_sM) in let h10 =
    Vale.Poly1305.Math.lowerUpper128 h0_out h1_out in let h210 = Vale.Poly1305.Math.lowerUpper192
    h10 h2_out in let inp_mem = Vale.Poly1305.Util.seqTo128 (Vale.X64.Decls.buffer64_as_seq
    (va_get_mem va_sM) inp_b) in (finish_in == 0 ==> Vale.Poly1305.Spec_s.modp h210 ==
    Vale.Poly1305.Spec_s.poly1305_hash_blocks (Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat n n)
    (Vale.Poly1305.Spec_s.make_r key_r) inp_mem (len_in `op_Division` 16)) /\ (finish_in == 0 ==>
    h2_out < 5) /\ (finish_in == 1 ==> h10 == Vale.Poly1305.Spec_s.poly1305_hash_all
    (Vale.Poly1305.Spec_s.modp h_in) key_r key_s inp_mem len_in) /\ va_get_reg64 rRsp va_sM ==
    va_get_reg64 rRsp va_s0 /\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ (win
    ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ va_get_reg64 rRbx va_sM ==
    va_get_reg64 rRbx va_s0 /\ va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0 /\ va_get_reg64
    rR12 va_sM == va_get_reg64 rR12 va_s0 /\ va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0 /\
    va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0 /\ va_get_reg64 rR15 va_sM == va_get_reg64
    rR15 va_s0)) ==> va_k va_sM (())))
val va_wp_Poly1305
      (win: bool)
      (ctx_b inp_b: buffer64)
      (len_in finish_in: nat64)
      (va_s0: va_state)
      (va_k: (va_state -> unit -> Type0))
    : Type0
let va_wp_Poly1305
      (win: bool)
      (ctx_b inp_b: buffer64)
      (len_in finish_in: nat64)
      (va_s0: va_state)
      (va_k: (va_state -> unit -> Type0))
    : Type0 =
(va_get_ok va_s0 /\
  (let ctx_in:(va_int_range 0 18446744073709551615) =
      va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0)
    in
    let inp_in:(va_int_range 0 18446744073709551615) =
      va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0)
    in
    let n:(va_int_range 18446744073709551616 18446744073709551616) = 18446744073709551616 in
    let p:(va_int_range 1361129467683753853853498429727072845819
        1361129467683753853853498429727072845819) =
      (va_mul_nat n n) `op_Multiply` 4 - 5
    in
    va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack va_s0) /\
    Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\
    Vale.X64.Decls.buffers_disjoint ctx_b inp_b /\
    Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0)
      ctx_in
      ctx_b
      24
      (va_get_mem_layout va_s0)
      Public /\
    Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0)
      inp_in
      inp_b
      (Vale.Poly1305.Util.readable_words len_in)
      (va_get_mem_layout va_s0)
      Public /\
    len_in == va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) /\
    finish_in == va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64 rRcx va_s0) /\
    (let h2_in = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_s0) in
      h2_in < 5 /\ inp_in + len_in < pow2_64 /\ finish_in < 2)) /\
  (forall (va_x_mem: vale_heap) (va_x_rax: nat64) (va_x_rbx: nat64) (va_x_rcx: nat64)
      (va_x_rdx: nat64) (va_x_rsi: nat64) (va_x_rdi: nat64) (va_x_rbp: nat64) (va_x_rsp: nat64)
      (va_x_r8: nat64) (va_x_r9: nat64) (va_x_r10: nat64) (va_x_r11: nat64) (va_x_r12: nat64)
      (va_x_r13: nat64) (va_x_r14: nat64) (va_x_r15: nat64) (va_x_efl: Vale.X64.Flags.t)
      (va_x_heap1: vale_heap) (va_x_memLayout: vale_heap_layout) (va_x_stack: vale_stack)
      (va_x_stackTaint: memtaint).
      let va_sM =
        va_upd_stackTaint va_x_stackTaint
          (va_upd_stack va_x_stack
              (va_upd_mem_layout va_x_memLayout
                  (va_upd_mem_heaplet 1
                      va_x_heap1
                      (va_upd_flags va_x_efl
                          (va_upd_reg64 rR15
                              va_x_r15
                              (va_upd_reg64 rR14
                                  va_x_r14
                                  (va_upd_reg64 rR13
                                      va_x_r13
                                      (va_upd_reg64 rR12
                                          va_x_r12
                                          (va_upd_reg64 rR11
                                              va_x_r11
                                              (va_upd_reg64 rR10
                                                  va_x_r10
                                                  (va_upd_reg64 rR9
                                                      va_x_r9
                                                      (va_upd_reg64 rR8
                                                          va_x_r8
                                                          (va_upd_reg64 rRsp
                                                              va_x_rsp
                                                              (va_upd_reg64 rRbp
                                                                  va_x_rbp
                                                                  (va_upd_reg64 rRdi
                                                                      va_x_rdi
                                                                      (va_upd_reg64 rRsi
                                                                          va_x_rsi
                                                                          (va_upd_reg64 rRdx
                                                                              va_x_rdx
                                                                              (va_upd_reg64 rRcx
                                                                                  va_x_rcx
                                                                                  (va_upd_reg64 rRbx
                                                                                      va_x_rbx
                                                                                      (va_upd_reg64 rRax
                                                                                          va_x_rax
                                                                                          (va_upd_mem
                                                                                              va_x_mem
                                                                                              va_s0)
                                                                                      ))))))))))))))
                              ))))))
      in
      va_get_ok va_sM /\
      (let ctx_in:(va_int_range 0 18446744073709551615) =
          va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0)
        in
        let inp_in:(va_int_range 0 18446744073709551615) =
          va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0)
        in
        let n:(va_int_range 18446744073709551616 18446744073709551616) = 18446744073709551616 in
        let p:(va_int_range 1361129467683753853853498429727072845819
            1361129467683753853853498429727072845819) =
          (va_mul_nat n n) `op_Multiply` 4 - 5
        in
        Vale.Poly1305.Util.modifies_buffer ctx_b (va_get_mem va_s0) (va_get_mem va_sM) /\
        (let h0_in = Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem va_s0) in
          let h1_in = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem va_s0) in
          let h2_in = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_s0) in
          let key_r0 = Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem va_s0) in
          let key_r1 = Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem va_s0) in
          let key_s0 = Vale.X64.Decls.buffer64_read ctx_b 5 (va_get_mem va_s0) in
          let key_s1 = Vale.X64.Decls.buffer64_read ctx_b 6 (va_get_mem va_s0) in
          let h_in =
            Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 h0_in h1_in) h2_in
          in
          let key_r = Vale.Poly1305.Math.lowerUpper128 key_r0 key_r1 in
          let key_s = Vale.Poly1305.Math.lowerUpper128 key_s0 key_s1 in
          let h0_out = Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem va_sM) in
          let h1_out = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem va_sM) in
          let h2_out = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_sM) in
          let h10 = Vale.Poly1305.Math.lowerUpper128 h0_out h1_out in
          let h210 = Vale.Poly1305.Math.lowerUpper192 h10 h2_out in
          let inp_mem =
            Vale.Poly1305.Util.seqTo128 (Vale.X64.Decls.buffer64_as_seq (va_get_mem va_sM) inp_b)
          in
          (finish_in == 0 ==>
            Vale.Poly1305.Spec_s.modp h210 ==
            Vale.Poly1305.Spec_s.poly1305_hash_blocks (Vale.Poly1305.Spec_s.modp h_in)
              (va_mul_nat n n)
              (Vale.Poly1305.Spec_s.make_r key_r)
              inp_mem
              (len_in `op_Division` 16)) /\ (finish_in == 0 ==> h2_out < 5) /\
          (finish_in == 1 ==>
            h10 ==
            Vale.Poly1305.Spec_s.poly1305_hash_all (Vale.Poly1305.Spec_s.modp h_in)
              key_r
              key_s
              inp_mem
              len_in) /\ va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0 /\
          (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\
          (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\
          va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 /\
          va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0 /\
          va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0 /\
          va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0 /\
          va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0 /\
          va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0)) ==>
      va_k va_sM (())))
Vale.Poly1305.X64.fsti.checked
Vale.X64.State.fsti.checked Vale.X64.Stack_i.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.InsStack.fsti.checked Vale.X64.InsMem.fsti.checked Vale.X64.InsBasic.fsti.checked Vale.X64.Flags.fsti.checked Vale.X64.Decls.fsti.checked Vale.Poly1305.Util.fsti.checked Vale.Poly1305.Spec_s.fst.checked Vale.Poly1305.Math.fsti.checked Vale.Def.Types_s.fst.checked Vale.Def.Opaque_s.fsti.checked Vale.Arch.Types.fsti.checked Vale.Arch.HeapImpl.fsti.checked prims.fst.checked FStar.Pervasives.Native.fst.checked FStar.Pervasives.fsti.checked
Vale.Poly1305.X64.fsti
Prims.bool Vale.X64.Memory.buffer64 Vale.X64.Memory.nat64 Vale.X64.Decls.va_state Prims.unit Prims.l_and Prims.b2t Vale.X64.Decls.va_get_ok Prims.eq2 Vale.Def.Words_s.nat64 Vale.X64.Decls.va_get_reg64 Vale.X64.Machine_s.rRsp Vale.X64.Stack_i.init_rsp Vale.X64.Decls.va_get_stack Vale.X64.Memory.is_initial_heap Vale.X64.Decls.va_get_mem_layout Vale.X64.Decls.va_get_mem Vale.X64.Decls.buffers_disjoint Vale.X64.Decls.validDstAddrs64 Vale.Arch.HeapTypes_s.Public Vale.X64.Decls.validSrcAddrs64 Vale.Poly1305.Util.readable_words Vale.X64.Decls.va_if Vale.Def.Types_s.nat64 Vale.X64.Machine_s.rR8 Prims.l_not Vale.X64.Machine_s.rRdx Vale.X64.Machine_s.rR9 Vale.X64.Machine_s.rRcx Prims.op_LessThan Prims.op_Addition Vale.X64.Machine_s.pow2_64 Vale.X64.Decls.buffer64_read Vale.X64.Decls.va_int_range Prims.op_Subtraction Prims.op_Multiply Vale.X64.Decls.va_mul_nat Vale.X64.Machine_s.rRsi Vale.X64.Machine_s.rRdi Prims.l_Forall Vale.X64.InsBasic.vale_heap Vale.X64.Flags.t Vale.Arch.HeapImpl.vale_heap_layout Vale.X64.InsBasic.vale_stack Vale.X64.Memory.memtaint Prims.l_imp Vale.Poly1305.Util.modifies_buffer Prims.int Vale.Poly1305.Spec_s.modp Vale.Poly1305.Spec_s.poly1305_hash_blocks Vale.Poly1305.Spec_s.make_r Prims.op_Division Vale.Poly1305.Spec_s.poly1305_hash_all Vale.X64.Machine_s.rRbx Vale.X64.Machine_s.rRbp Vale.X64.Machine_s.rR12 Vale.X64.Machine_s.rR13 Vale.X64.Machine_s.rR14 Vale.X64.Machine_s.rR15 Vale.Poly1305.Util.t_seqTo128 Vale.Poly1305.Util.seqTo128 Vale.X64.Decls.buffer64_as_seq Vale.Poly1305.Math.lowerUpper192 Vale.Def.Words_s.nat128 Vale.Poly1305.Math.lowerUpper128 Vale.X64.State.vale_state Vale.X64.Decls.va_upd_stackTaint Vale.X64.Decls.va_upd_stack Vale.X64.Decls.va_upd_mem_layout Vale.X64.Decls.va_upd_mem_heaplet Vale.X64.Decls.va_upd_flags Vale.X64.Decls.va_upd_reg64 Vale.X64.Machine_s.rR11 Vale.X64.Machine_s.rR10 Vale.X64.Machine_s.rRax Vale.X64.Decls.va_upd_mem
module Vale.Poly1305.X64
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsStack
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.Poly1305.Spec_s
open Vale.Poly1305.Math
open Vale.Poly1305.Util
#reset-options "--z3rlimit 40"
//-- Poly1305

val va_code_Poly1305 : win:bool -> Tot va_code

val va_codegen_success_Poly1305 : win:bool -> Tot va_pbool
let va_req_Poly1305 (va_b0:va_code) (va_s0:va_state) (win:bool) (ctx_b:buffer64) (inp_b:buffer64)
  (len_in:nat64) (finish_in:nat64) : prop =
  (va_require_total va_b0 (va_code_Poly1305 win) va_s0 /\ va_get_ok va_s0 /\ (let
    (ctx_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else
    va_get_reg64 rRdi va_s0) in let (inp_in:(va_int_range 0 18446744073709551615)) = (if win then
    va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (n:(va_int_range
    18446744073709551616 18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
    1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
    va_mul_nat n n `op_Multiply` 4 - 5 in va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp
    (va_get_stack va_s0) /\ Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem
    va_s0) /\ Vale.X64.Decls.buffers_disjoint ctx_b inp_b /\ Vale.X64.Decls.validDstAddrs64
    (va_get_mem va_s0) ctx_in ctx_b 24 (va_get_mem_layout va_s0) Public /\
    Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inp_in inp_b
    (Vale.Poly1305.Util.readable_words len_in) (va_get_mem_layout va_s0) Public /\ len_in == (if
    win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) /\ finish_in == (if win then
    va_get_reg64 rR9 va_s0 else va_get_reg64 rRcx va_s0) /\ (let h2_in =
    Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_s0) in h2_in < 5 /\ inp_in + len_in <
    pow2_64 /\ finish_in < 2)))
let va_ens_Poly1305 (va_b0:va_code) (va_s0:va_state) (win:bool) (ctx_b:buffer64) (inp_b:buffer64)
  (len_in:nat64) (finish_in:nat64) (va_sM:va_state) (va_fM:va_fuel) : prop =
  (va_req_Poly1305 va_b0 va_s0 win ctx_b inp_b len_in finish_in /\ va_ensure_total va_b0 va_s0
    va_sM va_fM /\ va_get_ok va_sM /\ (let (ctx_in:(va_int_range 0 18446744073709551615)) = (if win
    then va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) in let (inp_in:(va_int_range 0
    18446744073709551615)) = (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in
    let (n:(va_int_range 18446744073709551616 18446744073709551616)) = 18446744073709551616 in let
    (p:(va_int_range 1361129467683753853853498429727072845819
    1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in
    Vale.Poly1305.Util.modifies_buffer ctx_b (va_get_mem va_s0) (va_get_mem va_sM) /\ (let h0_in =
    Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem va_s0) in let h1_in =
    Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem va_s0) in let h2_in =
    Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_s0) in let key_r0 =
    Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem va_s0) in let key_r1 =
    Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem va_s0) in let key_s0 =
    Vale.X64.Decls.buffer64_read ctx_b 5 (va_get_mem va_s0) in let key_s1 =
    Vale.X64.Decls.buffer64_read ctx_b 6 (va_get_mem va_s0) in let h_in =
    Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 h0_in h1_in) h2_in in let
    key_r = Vale.Poly1305.Math.lowerUpper128 key_r0 key_r1 in let key_s =
    Vale.Poly1305.Math.lowerUpper128 key_s0 key_s1 in let h0_out = Vale.X64.Decls.buffer64_read
    ctx_b 0 (va_get_mem va_sM) in let h1_out = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem
    va_sM) in let h2_out = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_sM) in let h10 =
    Vale.Poly1305.Math.lowerUpper128 h0_out h1_out in let h210 = Vale.Poly1305.Math.lowerUpper192
    h10 h2_out in let inp_mem = Vale.Poly1305.Util.seqTo128 (Vale.X64.Decls.buffer64_as_seq
    (va_get_mem va_sM) inp_b) in (finish_in == 0 ==> Vale.Poly1305.Spec_s.modp h210 ==
    Vale.Poly1305.Spec_s.poly1305_hash_blocks (Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat n n)
    (Vale.Poly1305.Spec_s.make_r key_r) inp_mem (len_in `op_Division` 16)) /\ (finish_in == 0 ==>
    h2_out < 5) /\ (finish_in == 1 ==> h10 == Vale.Poly1305.Spec_s.poly1305_hash_all
    (Vale.Poly1305.Spec_s.modp h_in) key_r key_s inp_mem len_in) /\ va_get_reg64 rRsp va_sM ==
    va_get_reg64 rRsp va_s0 /\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ (win
    ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ va_get_reg64 rRbx va_sM ==
    va_get_reg64 rRbx va_s0 /\ va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0 /\ va_get_reg64
    rR12 va_sM == va_get_reg64 rR12 va_s0 /\ va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0 /\
    va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0 /\ va_get_reg64 rR15 va_sM == va_get_reg64
    rR15 va_s0)) /\ va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM
    (va_update_mem_layout va_sM (va_update_mem_heaplet 1 va_sM (va_update_flags va_sM
    (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM
    (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM
    (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM
    (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM
    (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
    (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM
    va_s0))))))))))))))))))))))))

val va_lemma_Poly1305 : va_b0:va_code -> va_s0:va_state -> win:bool -> ctx_b:buffer64 ->
  inp_b:buffer64 -> len_in:nat64 -> finish_in:nat64
  -> Ghost (va_state & va_fuel)
  (requires (va_require_total va_b0 (va_code_Poly1305 win) va_s0 /\ va_get_ok va_s0 /\ (let
    (ctx_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else
    va_get_reg64 rRdi va_s0) in let (inp_in:(va_int_range 0 18446744073709551615)) = (if win then
    va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (n:(va_int_range
    18446744073709551616 18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
    1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
    va_mul_nat n n `op_Multiply` 4 - 5 in va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp
    (va_get_stack va_s0) /\ Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem
    va_s0) /\ Vale.X64.Decls.buffers_disjoint ctx_b inp_b /\ Vale.X64.Decls.validDstAddrs64
    (va_get_mem va_s0) ctx_in ctx_b 24 (va_get_mem_layout va_s0) Public /\
    Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inp_in inp_b
    (Vale.Poly1305.Util.readable_words len_in) (va_get_mem_layout va_s0) Public /\ len_in == (if
    win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) /\ finish_in == (if win then
    va_get_reg64 rR9 va_s0 else va_get_reg64 rRcx va_s0) /\ (let h2_in =
    Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_s0) in h2_in < 5 /\ inp_in + len_in <
    pow2_64 /\ finish_in < 2))))
  (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
    (let (ctx_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else
    va_get_reg64 rRdi va_s0) in let (inp_in:(va_int_range 0 18446744073709551615)) = (if win then
    va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (n:(va_int_range
    18446744073709551616 18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range
    1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =
    va_mul_nat n n `op_Multiply` 4 - 5 in Vale.Poly1305.Util.modifies_buffer ctx_b (va_get_mem
    va_s0) (va_get_mem va_sM) /\ (let h0_in = Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem
    va_s0) in let h1_in = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem va_s0) in let h2_in =
    Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_s0) in let key_r0 =
    Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem va_s0) in let key_r1 =
    Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem va_s0) in let key_s0 =
    Vale.X64.Decls.buffer64_read ctx_b 5 (va_get_mem va_s0) in let key_s1 =
    Vale.X64.Decls.buffer64_read ctx_b 6 (va_get_mem va_s0) in let h_in =
    Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 h0_in h1_in) h2_in in let
    key_r = Vale.Poly1305.Math.lowerUpper128 key_r0 key_r1 in let key_s =
    Vale.Poly1305.Math.lowerUpper128 key_s0 key_s1 in let h0_out = Vale.X64.Decls.buffer64_read
    ctx_b 0 (va_get_mem va_sM) in let h1_out = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem
    va_sM) in let h2_out = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_sM) in let h10 =
    Vale.Poly1305.Math.lowerUpper128 h0_out h1_out in let h210 = Vale.Poly1305.Math.lowerUpper192
    h10 h2_out in let inp_mem = Vale.Poly1305.Util.seqTo128 (Vale.X64.Decls.buffer64_as_seq
    (va_get_mem va_sM) inp_b) in (finish_in == 0 ==> Vale.Poly1305.Spec_s.modp h210 ==
    Vale.Poly1305.Spec_s.poly1305_hash_blocks (Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat n n)
    (Vale.Poly1305.Spec_s.make_r key_r) inp_mem (len_in `op_Division` 16)) /\ (finish_in == 0 ==>
    h2_out < 5) /\ (finish_in == 1 ==> h10 == Vale.Poly1305.Spec_s.poly1305_hash_all
    (Vale.Poly1305.Spec_s.modp h_in) key_r key_s inp_mem len_in) /\ va_get_reg64 rRsp va_sM ==
    va_get_reg64 rRsp va_s0 /\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\ (win
    ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\ va_get_reg64 rRbx va_sM ==
    va_get_reg64 rRbx va_s0 /\ va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0 /\ va_get_reg64
    rR12 va_sM == va_get_reg64 rR12 va_s0 /\ va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0 /\
    va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0 /\ va_get_reg64 rR15 va_sM == va_get_reg64
    rR15 va_s0)) /\ va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM
    (va_update_mem_layout va_sM (va_update_mem_heaplet 1 va_sM (va_update_flags va_sM
    (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM
    (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM
    (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM
    (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM
    (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx 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_Poly1305 (win:bool) (ctx_b:buffer64) (inp_b:buffer64) (len_in:nat64) (finish_in:nat64)
val va_wp_Poly1305
      (win: bool)
      (ctx_b inp_b: buffer64)
      (len_in finish_in: nat64)
      (va_s0: va_state)
      (va_k: (va_state -> unit -> Type0))
    : Type0

    win: Prims.bool ->
    ctx_b: Vale.X64.Memory.buffer64 ->
    inp_b: Vale.X64.Memory.buffer64 ->
    len_in: Vale.X64.Memory.nat64 ->
    finish_in: Vale.X64.Memory.nat64 ->
    va_s0: Vale.X64.Decls.va_state ->
    va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
  -> Type0