/* Global assumption:
E<e> := GF(2,6);
V6 := VectorSpace(GF(2), 6);
V24 := VectorSpace(GF(2), 24); */

Decode := function(a, W)
  local unlambda, k;

  unlambda := MatrixLambdaRSC(64, 4, 12);
  unlambda := unlambda^(-1);
  a := V24!a;
  for nround in [1..15] do
    k := KeyScheduleStep3(W, 17-nround);
    a := RoundInv(a, unlambda, k);
  end for;
  k := KeyScheduleStep3(W, 1);
  a := a + k;

  return V24!a;
end function;