anchor.diff:  ;;;; -*- mode: lisp; indent-tabs-mode: nil -*-
  -#+sbcl
  -(defpackage "IRONCLAD-VM"
  +#+(and sbcl (or x86 x86-64))
  +(defpackage :ironclad-vm
     ;; more recent SBCL exports various symbols making this package
     ;; definition more concise. This is the backward-compatible way.
     (:use #:common-lisp
  
positive.code:   (:result-types simple-array-unsigned-byte-32)
    (:temporary (:sc unsigned-reg) a b c d e t1 t2)
    (:generator 1000
      (let ((a (reg-in-size a :dword))
            (b (reg-in-size b :dword))
            (c (reg-in-size c :dword))
            (d (reg-in-size d :dword))
            (e (reg-in-size e :dword))
            (t1 (reg-in-size t1 :dword))
            (t2 (reg-in-size t2 :dword))
            (k1 #x5a827999)
            (k2 #x6ed9eba1)
            (k3 #x-70e44324)
            (k4 #x-359d3e2a))
        (labels ((block/reg-ea (base index)
                   (make-ea :dword
                            :base base
                            :disp (+ (- (* n-word-bytes vector-data-offset)
                                        other-pointer-lowtag)
                                     (* 4 index))))
                 (f1 (a b c d e n)
                   (inst mov t2 a)
                   (inst mov t1 c)
                   (inst rol t2 5)
                   (inst xor t1 d)
                   (inst add t2 (block/reg-ea block n))
                   (inst and t1 b)
                   (inst xor t1 d)
                   (inst lea e (make-ea :dword :base t1 :index e :disp k1))
                   (inst rol b 30)
                   (inst add e t2))
                 (f2/4 (a b c d e n k)
                   (inst mov t2 a)
                   (inst mov t1 d)
                   (inst rol t2 5)
                   (inst xor t1 c)
                   (inst add t2 (block/reg-ea block n))
                   (inst xor t1 b)
                   (inst lea e (make-ea :dword :base t1 :index e :disp k))
                   (inst rol b 30)
                   (inst add e t2))
                 (f2 (a b c d e n)
                   (f2/4 a b c d e n k2))
                 (f4 (a b c d e n)
                   (f2/4 a b c d e n k4))
                 (f3 (a b c d e n)
                   (inst mov t2 c)
                   (inst mov t1 c)
                   (inst and t2 b)
                   (inst or t1 b)
                   (inst and t1 d)
                   (inst or t1 t2)
                   (inst mov t2 a)
                   (inst rol t2 5)
                   (inst add t2 (block/reg-ea block n))
                   (inst rol b 30)
                   (inst lea e (make-ea :dword :base t1 :index e :disp k3))
                   (inst add e t2))
                 (sha1-rounds (start end f)
                   (let ((xvars (ironclad::make-circular-list a b c d e)))
                     (loop for i from start upto end
  
negative.code:               unsigned-num)
    (:temporary (:sc double-reg) x0 x1)
    (:generator 1000
      (flet ((buffer-mem (base offset)
               (let ((disp (- (* n-word-bytes vector-data-offset)
                              other-pointer-lowtag)))
                 (ea disp base offset)))
             (round-key (i)
               (let ((disp (+ (- (* n-word-bytes vector-data-offset)
                                 other-pointer-lowtag)
                              (* 16 i))))
                 (ea disp round-keys))))
        (let ((last-round (gen-label)))
          (inst movdqu x0 (buffer-mem ciphertext ciphertext-start))
          (inst movdqu x1 (round-key 0))
          (inst pxor x0 x1)
          (inst movdqu x1 (round-key 1))
          (inst aesdec x0 x1)
          (inst movdqu x1 (round-key 2))
          (inst aesdec x0 x1)
          (inst movdqu x1 (round-key 3))
          (inst aesdec x0 x1)
          (inst movdqu x1 (round-key 4))
          (inst aesdec x0 x1)
          (inst movdqu x1 (round-key 5))
          (inst aesdec x0 x1)
          (inst movdqu x1 (round-key 6))
          (inst aesdec x0 x1)
          (inst movdqu x1 (round-key 7))
          (inst aesdec x0 x1)
          (inst movdqu x1 (round-key 8))
          (inst aesdec x0 x1)
          (inst movdqu x1 (round-key 9))
          (inst aesdec x0 x1)
          (inst movdqu x1 (round-key 10))
          (inst cmp n-rounds 10)
          (inst jmp :z last-round)
          (inst aesdec x0 x1)
          (inst movdqu x1 (round-key 11))
          (inst aesdec x0 x1)
          (inst movdqu x1 (round-key 12))
          (inst cmp n-rounds 12)
          (inst jmp :z last-round)
          (inst aesdec x0 x1)
          (inst movdqu x1 (round-key 13))
          (inst aesdec x0 x1)
          (inst movdqu x1 (round-key 14))
          (emit-label last-round)
          (inst aesdeclast x0 x1)
          (inst movdqu (buffer-mem plaintext plaintext-start) x0)))))
  
  #+x86-64
  (define-vop (fast-blake2s-mixing)
  