[pypy-commit] pypy py3.6: Add sha3 (aka. Keccak) hashes to hashlib.

amauryfa pypy.commits at gmail.com
Wed Jan 3 17:54:49 EST 2018


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3.6
Changeset: r93618:88331f108204
Date: 2017-12-25 18:11 +0100
http://bitbucket.org/pypy/pypy/changeset/88331f108204/

Log:	Add sha3 (aka. Keccak) hashes to hashlib.

diff too long, truncating to 2000 out of 5634 lines

diff --git a/lib-python/3/hashlib.py b/lib-python/3/hashlib.py
--- a/lib-python/3/hashlib.py
+++ b/lib-python/3/hashlib.py
@@ -57,10 +57,8 @@
 # always available algorithm is added.
 __always_supported = ('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512',
                       'blake2b', 'blake2s',
-                      # FIXME the following algorithms were added in
-                      # cpython3.6 but are missing in pypy
-                      # 'sha3_224', 'sha3_256', 'sha3_384', 'sha3_512',
-                      # 'shake_128', 'shake_256'
+                      'sha3_224', 'sha3_256', 'sha3_384', 'sha3_512',
+                      'shake_128', 'shake_256'
 )
 
 
diff --git a/lib_pypy/_sha3/__init__.py b/lib_pypy/_sha3/__init__.py
new file mode 100644
--- /dev/null
+++ b/lib_pypy/_sha3/__init__.py
@@ -0,0 +1,107 @@
+from ._sha3_cffi import ffi as _ffi, lib as _lib
+import codecs
+
+SHA3_MAX_DIGESTSIZE = 64 # 64 Bytes (512 Bits) for 224 to 512
+SHA3_LANESIZE = (20 * 8) # ExtractLane needs max uint64_t[20] extra.
+
+class _sha3:
+    _keccak_init = None  # Overridden in subclasses
+
+    def __new__(cls, string=None):
+        self = super().__new__(cls)
+        self._hash_state = _ffi.new("Keccak_HashInstance*")
+
+        cls._keccak_init(self._hash_state)
+
+        if string:
+            self.update(string)
+        return self
+
+    def update(self, string):
+        buf = _ffi.from_buffer(string)
+        res = _lib.Keccak_HashUpdate(self._hash_state, buf, len(buf) * 8)
+
+    def digest(self):
+        digest = _ffi.new("char[]",
+                          SHA3_MAX_DIGESTSIZE + SHA3_LANESIZE)
+        state_copy = _ffi.new("Keccak_HashInstance*")
+        _ffi.memmove(state_copy, self._hash_state,
+                     _ffi.sizeof("Keccak_HashInstance"))
+        if _lib.Keccak_HashFinal(state_copy, digest) != _lib.SUCCESS:
+            raise RuntimeError("internal error in SHA3 Final()")
+        return _ffi.unpack(digest, self._hash_state.fixedOutputLength // 8)
+
+    def hexdigest(self):
+        return codecs.encode(self.digest(), 'hex').decode()
+
+    def copy(self):
+        copy = super().__new__(type(self))
+        copy._hash_state = _ffi.new("Keccak_HashInstance*")
+        _ffi.memmove(copy._hash_state, self._hash_state,
+                     _ffi.sizeof("Keccak_HashInstance"))
+        return copy
+
+    @property
+    def digest_size(self):
+        return self._hash_state.fixedOutputLength // 8
+
+    @property
+    def block_size(self):
+        return self._hash_state.sponge.rate // 8
+
+    @property
+    def _capacity_bits(self):
+        return 1600 - self._hash_state.sponge.rate
+
+    @property
+    def _rate_bits(self):
+        return self._hash_state.sponge.rate
+
+    @property
+    def _suffix(self):
+        return bytes([self._hash_state.delimitedSuffix])
+
+
+class _shake(_sha3):
+    def digest(self, length):
+        # ExtractLane needs at least SHA3_MAX_DIGESTSIZE + SHA3_LANESIZE and
+        # SHA_LANESIZE extra space.
+        digest = _ffi.new("char[]", length + SHA3_LANESIZE)
+        # Get the raw (binary) digest value
+        state_copy = _ffi.new("Keccak_HashInstance*")
+        _ffi.memmove(state_copy, self._hash_state,
+                     _ffi.sizeof("Keccak_HashInstance"))
+        if _lib.Keccak_HashFinal(state_copy, digest) != _lib.SUCCESS:
+            raise RuntimeError("internal error in SHA3 Final()")
+        if _lib.Keccak_HashSqueeze(state_copy, digest, length * 8) != _lib.SUCCESS:
+            raise RuntimeError("internal error in SHA3 Squeeze()")
+        return _ffi.unpack(digest, length)
+
+    def hexdigest(self, length):
+        return codecs.encode(self.digest(length), 'hex').decode()
+        
+
+class sha3_224(_sha3):
+    name = "sha3_224"
+    _keccak_init = _lib.Keccak_HashInitialize_SHA3_224
+
+class sha3_256(_sha3):
+    name = "sha3_256"
+    _keccak_init = _lib.Keccak_HashInitialize_SHA3_256
+
+class sha3_384(_sha3):
+    name = "sha3_384"
+    _keccak_init = _lib.Keccak_HashInitialize_SHA3_384
+
+class sha3_512(_sha3):
+    name = "sha3_512"
+    _keccak_init = _lib.Keccak_HashInitialize_SHA3_512
+
+class shake_128(_shake):
+    name = "shake_128"
+    _keccak_init = _lib.Keccak_HashInitialize_SHAKE128
+
+class shake_256(_shake):
+    name = "shake_256"
+    _keccak_init = _lib.Keccak_HashInitialize_SHAKE256
+
diff --git a/lib_pypy/_sha3/_sha3_build.py b/lib_pypy/_sha3/_sha3_build.py
new file mode 100644
--- /dev/null
+++ b/lib_pypy/_sha3/_sha3_build.py
@@ -0,0 +1,78 @@
+import os
+import sys
+
+from cffi import FFI
+
+
+ffi = FFI()
+ffi.cdef("""
+typedef struct {
+    unsigned int rate;
+    ...;
+} KeccakWidth1600_SpongeInstance;
+
+typedef struct {
+    KeccakWidth1600_SpongeInstance sponge;
+    unsigned int fixedOutputLength;
+    unsigned char delimitedSuffix;
+    ...;
+} Keccak_HashInstance;
+
+typedef enum { SUCCESS = ..., FAIL = ..., BAD_HASHLEN = ... } HashReturn;
+typedef int... DataLength;
+typedef unsigned char BitSequence;
+
+HashReturn Keccak_HashInitialize_SHA3_224(Keccak_HashInstance*);
+HashReturn Keccak_HashInitialize_SHA3_256(Keccak_HashInstance*);
+HashReturn Keccak_HashInitialize_SHA3_384(Keccak_HashInstance*);
+HashReturn Keccak_HashInitialize_SHA3_512(Keccak_HashInstance*);
+HashReturn Keccak_HashInitialize_SHAKE128(Keccak_HashInstance*);
+HashReturn Keccak_HashInitialize_SHAKE256(Keccak_HashInstance*);
+
+HashReturn Keccak_HashUpdate(Keccak_HashInstance *, const BitSequence *, DataLength);
+HashReturn Keccak_HashFinal(Keccak_HashInstance *, BitSequence *);
+HashReturn Keccak_HashSqueeze(Keccak_HashInstance *hashInstance, BitSequence *data, DataLength databitlen);
+""")
+
+_libdir = os.path.join(os.path.dirname(__file__), 'kcp')
+
+if sys.byteorder == 'big':
+    # opt64 is not yet supported on big endian platforms
+    keccakOpt = 32
+elif sys.maxsize > 2**32:
+    keccakOpt = 64
+else:
+    keccakOpt = 32
+
+ffi.set_source(
+    '_sha3_cffi',
+("#define KeccakOpt %d\n" % keccakOpt) +
+"""
+/* we are only interested in KeccakP1600 */
+#define KeccakP200_excluded 1
+#define KeccakP400_excluded 1
+#define KeccakP800_excluded 1
+
+#if KeccakOpt == 64
+  /* 64bit platforms with unsigned int64 */
+  typedef uint64_t UINT64;
+  typedef unsigned char UINT8;
+#endif
+
+/* inline all Keccak dependencies */
+#include "kcp/KeccakHash.h"
+#include "kcp/KeccakSponge.h"
+#include "kcp/KeccakHash.c"
+#include "kcp/KeccakSponge.c"
+#if KeccakOpt == 64
+  #include "kcp/KeccakP-1600-opt64.c"
+#elif KeccakOpt == 32
+  #include "kcp/KeccakP-1600-inplace32BI.c"
+#endif
+""",
+    include_dirs=[_libdir],
+)
+
+if __name__ == '__main__':
+    os.chdir(os.path.dirname(__file__))
+    ffi.compile()
diff --git a/lib_pypy/_sha3/kcp/KeccakHash.c b/lib_pypy/_sha3/kcp/KeccakHash.c
new file mode 100644
--- /dev/null
+++ b/lib_pypy/_sha3/kcp/KeccakHash.c
@@ -0,0 +1,82 @@
+/*
+Implementation by the Keccak, Keyak and Ketje Teams, namely, Guido Bertoni,
+Joan Daemen, Michaël Peeters, Gilles Van Assche and Ronny Van Keer, hereby
+denoted as "the implementer".
+
+For more information, feedback or questions, please refer to our websites:
+http://keccak.noekeon.org/
+http://keyak.noekeon.org/
+http://ketje.noekeon.org/
+
+To the extent possible under law, the implementer has waived all copyright
+and related or neighboring rights to the source code in this file.
+http://creativecommons.org/publicdomain/zero/1.0/
+*/
+
+#include <string.h>
+#include "KeccakHash.h"
+
+/* ---------------------------------------------------------------- */
+
+HashReturn Keccak_HashInitialize(Keccak_HashInstance *instance, unsigned int rate, unsigned int capacity, unsigned int hashbitlen, unsigned char delimitedSuffix)
+{
+    HashReturn result;
+
+    if (delimitedSuffix == 0)
+        return FAIL;
+    result = (HashReturn)KeccakWidth1600_SpongeInitialize(&instance->sponge, rate, capacity);
+    if (result != SUCCESS)
+        return result;
+    instance->fixedOutputLength = hashbitlen;
+    instance->delimitedSuffix = delimitedSuffix;
+    return SUCCESS;
+}
+
+/* ---------------------------------------------------------------- */
+
+HashReturn Keccak_HashUpdate(Keccak_HashInstance *instance, const BitSequence *data, DataLength databitlen)
+{
+    if ((databitlen % 8) == 0)
+        return (HashReturn)KeccakWidth1600_SpongeAbsorb(&instance->sponge, data, databitlen/8);
+    else {
+        HashReturn ret = (HashReturn)KeccakWidth1600_SpongeAbsorb(&instance->sponge, data, databitlen/8);
+        if (ret == SUCCESS) {
+            /* The last partial byte is assumed to be aligned on the least significant bits */
+
+            unsigned char lastByte = data[databitlen/8];
+            /* Concatenate the last few bits provided here with those of the suffix */
+
+            unsigned short delimitedLastBytes = (unsigned short)((unsigned short)lastByte | ((unsigned short)instance->delimitedSuffix << (databitlen % 8)));
+            if ((delimitedLastBytes & 0xFF00) == 0x0000) {
+                instance->delimitedSuffix = delimitedLastBytes & 0xFF;
+            }
+            else {
+                unsigned char oneByte[1];
+                oneByte[0] = delimitedLastBytes & 0xFF;
+                ret = (HashReturn)KeccakWidth1600_SpongeAbsorb(&instance->sponge, oneByte, 1);
+                instance->delimitedSuffix = (delimitedLastBytes >> 8) & 0xFF;
+            }
+        }
+        return ret;
+    }
+}
+
+/* ---------------------------------------------------------------- */
+
+HashReturn Keccak_HashFinal(Keccak_HashInstance *instance, BitSequence *hashval)
+{
+    HashReturn ret = (HashReturn)KeccakWidth1600_SpongeAbsorbLastFewBits(&instance->sponge, instance->delimitedSuffix);
+    if (ret == SUCCESS)
+        return (HashReturn)KeccakWidth1600_SpongeSqueeze(&instance->sponge, hashval, instance->fixedOutputLength/8);
+    else
+        return ret;
+}
+
+/* ---------------------------------------------------------------- */
+
+HashReturn Keccak_HashSqueeze(Keccak_HashInstance *instance, BitSequence *data, DataLength databitlen)
+{
+    if ((databitlen % 8) != 0)
+        return FAIL;
+    return (HashReturn)KeccakWidth1600_SpongeSqueeze(&instance->sponge, data, databitlen/8);
+}
diff --git a/lib_pypy/_sha3/kcp/KeccakHash.h b/lib_pypy/_sha3/kcp/KeccakHash.h
new file mode 100644
--- /dev/null
+++ b/lib_pypy/_sha3/kcp/KeccakHash.h
@@ -0,0 +1,114 @@
+/*
+Implementation by the Keccak, Keyak and Ketje Teams, namely, Guido Bertoni,
+Joan Daemen, Michaël Peeters, Gilles Van Assche and Ronny Van Keer, hereby
+denoted as "the implementer".
+
+For more information, feedback or questions, please refer to our websites:
+http://keccak.noekeon.org/
+http://keyak.noekeon.org/
+http://ketje.noekeon.org/
+
+To the extent possible under law, the implementer has waived all copyright
+and related or neighboring rights to the source code in this file.
+http://creativecommons.org/publicdomain/zero/1.0/
+*/
+
+#ifndef _KeccakHashInterface_h_
+#define _KeccakHashInterface_h_
+
+#ifndef KeccakP1600_excluded
+
+#include "KeccakSponge.h"
+#include <string.h>
+
+typedef unsigned char BitSequence;
+typedef size_t DataLength;
+typedef enum { SUCCESS = 0, FAIL = 1, BAD_HASHLEN = 2 } HashReturn;
+
+typedef struct {
+    KeccakWidth1600_SpongeInstance sponge;
+    unsigned int fixedOutputLength;
+    unsigned char delimitedSuffix;
+} Keccak_HashInstance;
+
+/**
+  * Function to initialize the Keccak[r, c] sponge function instance used in sequential hashing mode.
+  * @param  hashInstance    Pointer to the hash instance to be initialized.
+  * @param  rate        The value of the rate r.
+  * @param  capacity    The value of the capacity c.
+  * @param  hashbitlen  The desired number of output bits,
+  *                     or 0 for an arbitrarily-long output.
+  * @param  delimitedSuffix Bits that will be automatically appended to the end
+  *                         of the input message, as in domain separation.
+  *                         This is a byte containing from 0 to 7 bits
+  *                         formatted like the @a delimitedData parameter of
+  *                         the Keccak_SpongeAbsorbLastFewBits() function.
+  * @pre    One must have r+c=1600 and the rate a multiple of 8 bits in this implementation.
+  * @return SUCCESS if successful, FAIL otherwise.
+  */
+HashReturn Keccak_HashInitialize(Keccak_HashInstance *hashInstance, unsigned int rate, unsigned int capacity, unsigned int hashbitlen, unsigned char delimitedSuffix);
+
+/** Macro to initialize a SHAKE128 instance as specified in the FIPS 202 standard.
+  */
+#define Keccak_HashInitialize_SHAKE128(hashInstance)        Keccak_HashInitialize(hashInstance, 1344,  256,   0, 0x1F)
+
+/** Macro to initialize a SHAKE256 instance as specified in the FIPS 202 standard.
+  */
+#define Keccak_HashInitialize_SHAKE256(hashInstance)        Keccak_HashInitialize(hashInstance, 1088,  512,   0, 0x1F)
+
+/** Macro to initialize a SHA3-224 instance as specified in the FIPS 202 standard.
+  */
+#define Keccak_HashInitialize_SHA3_224(hashInstance)        Keccak_HashInitialize(hashInstance, 1152,  448, 224, 0x06)
+
+/** Macro to initialize a SHA3-256 instance as specified in the FIPS 202 standard.
+  */
+#define Keccak_HashInitialize_SHA3_256(hashInstance)        Keccak_HashInitialize(hashInstance, 1088,  512, 256, 0x06)
+
+/** Macro to initialize a SHA3-384 instance as specified in the FIPS 202 standard.
+  */
+#define Keccak_HashInitialize_SHA3_384(hashInstance)        Keccak_HashInitialize(hashInstance,  832,  768, 384, 0x06)
+
+/** Macro to initialize a SHA3-512 instance as specified in the FIPS 202 standard.
+  */
+#define Keccak_HashInitialize_SHA3_512(hashInstance)        Keccak_HashInitialize(hashInstance,  576, 1024, 512, 0x06)
+
+/**
+  * Function to give input data to be absorbed.
+  * @param  hashInstance    Pointer to the hash instance initialized by Keccak_HashInitialize().
+  * @param  data        Pointer to the input data.
+  *                     When @a databitLen is not a multiple of 8, the last bits of data must be
+  *                     in the least significant bits of the last byte (little-endian convention).
+  * @param  databitLen  The number of input bits provided in the input data.
+  * @pre    In the previous call to Keccak_HashUpdate(), databitlen was a multiple of 8.
+  * @return SUCCESS if successful, FAIL otherwise.
+  */
+HashReturn Keccak_HashUpdate(Keccak_HashInstance *hashInstance, const BitSequence *data, DataLength databitlen);
+
+/**
+  * Function to call after all input blocks have been input and to get
+  * output bits if the length was specified when calling Keccak_HashInitialize().
+  * @param  hashInstance    Pointer to the hash instance initialized by Keccak_HashInitialize().
+  * If @a hashbitlen was not 0 in the call to Keccak_HashInitialize(), the number of
+  *     output bits is equal to @a hashbitlen.
+  * If @a hashbitlen was 0 in the call to Keccak_HashInitialize(), the output bits
+  *     must be extracted using the Keccak_HashSqueeze() function.
+  * @param  state       Pointer to the state of the sponge function initialized by Init().
+  * @param  hashval     Pointer to the buffer where to store the output data.
+  * @return SUCCESS if successful, FAIL otherwise.
+  */
+HashReturn Keccak_HashFinal(Keccak_HashInstance *hashInstance, BitSequence *hashval);
+
+ /**
+  * Function to squeeze output data.
+  * @param  hashInstance    Pointer to the hash instance initialized by Keccak_HashInitialize().
+  * @param  data        Pointer to the buffer where to store the output data.
+  * @param  databitlen  The number of output bits desired (must be a multiple of 8).
+  * @pre    Keccak_HashFinal() must have been already called.
+  * @pre    @a databitlen is a multiple of 8.
+  * @return SUCCESS if successful, FAIL otherwise.
+  */
+HashReturn Keccak_HashSqueeze(Keccak_HashInstance *hashInstance, BitSequence *data, DataLength databitlen);
+
+#endif
+
+#endif
diff --git a/lib_pypy/_sha3/kcp/KeccakP-1600-64.macros b/lib_pypy/_sha3/kcp/KeccakP-1600-64.macros
new file mode 100644
--- /dev/null
+++ b/lib_pypy/_sha3/kcp/KeccakP-1600-64.macros
@@ -0,0 +1,2208 @@
+/*
+Implementation by the Keccak, Keyak and Ketje Teams, namely, Guido Bertoni,
+Joan Daemen, Michaël Peeters, Gilles Van Assche and Ronny Van Keer, hereby
+denoted as "the implementer".
+
+For more information, feedback or questions, please refer to our websites:
+http://keccak.noekeon.org/
+http://keyak.noekeon.org/
+http://ketje.noekeon.org/
+
+To the extent possible under law, the implementer has waived all copyright
+and related or neighboring rights to the source code in this file.
+http://creativecommons.org/publicdomain/zero/1.0/
+*/
+
+#define declareABCDE \
+    UINT64 Aba, Abe, Abi, Abo, Abu; \
+    UINT64 Aga, Age, Agi, Ago, Agu; \
+    UINT64 Aka, Ake, Aki, Ako, Aku; \
+    UINT64 Ama, Ame, Ami, Amo, Amu; \
+    UINT64 Asa, Ase, Asi, Aso, Asu; \
+    UINT64 Bba, Bbe, Bbi, Bbo, Bbu; \
+    UINT64 Bga, Bge, Bgi, Bgo, Bgu; \
+    UINT64 Bka, Bke, Bki, Bko, Bku; \
+    UINT64 Bma, Bme, Bmi, Bmo, Bmu; \
+    UINT64 Bsa, Bse, Bsi, Bso, Bsu; \
+    UINT64 Ca, Ce, Ci, Co, Cu; \
+    UINT64 Da, De, Di, Do, Du; \
+    UINT64 Eba, Ebe, Ebi, Ebo, Ebu; \
+    UINT64 Ega, Ege, Egi, Ego, Egu; \
+    UINT64 Eka, Eke, Eki, Eko, Eku; \
+    UINT64 Ema, Eme, Emi, Emo, Emu; \
+    UINT64 Esa, Ese, Esi, Eso, Esu; \
+
+#define prepareTheta \
+    Ca = Aba^Aga^Aka^Ama^Asa; \
+    Ce = Abe^Age^Ake^Ame^Ase; \
+    Ci = Abi^Agi^Aki^Ami^Asi; \
+    Co = Abo^Ago^Ako^Amo^Aso; \
+    Cu = Abu^Agu^Aku^Amu^Asu; \
+
+#ifdef UseBebigokimisa
+/* --- Code for round, with prepare-theta (lane complementing pattern 'bebigokimisa') */
+
+/* --- 64-bit lanes mapped to 64-bit words */
+
+#define thetaRhoPiChiIotaPrepareTheta(i, A, E) \
+    Da = Cu^ROL64(Ce, 1); \
+    De = Ca^ROL64(Ci, 1); \
+    Di = Ce^ROL64(Co, 1); \
+    Do = Ci^ROL64(Cu, 1); \
+    Du = Co^ROL64(Ca, 1); \
+\
+    A##ba ^= Da; \
+    Bba = A##ba; \
+    A##ge ^= De; \
+    Bbe = ROL64(A##ge, 44); \
+    A##ki ^= Di; \
+    Bbi = ROL64(A##ki, 43); \
+    A##mo ^= Do; \
+    Bbo = ROL64(A##mo, 21); \
+    A##su ^= Du; \
+    Bbu = ROL64(A##su, 14); \
+    E##ba =   Bba ^(  Bbe |  Bbi ); \
+    E##ba ^= KeccakF1600RoundConstants[i]; \
+    Ca = E##ba; \
+    E##be =   Bbe ^((~Bbi)|  Bbo ); \
+    Ce = E##be; \
+    E##bi =   Bbi ^(  Bbo &  Bbu ); \
+    Ci = E##bi; \
+    E##bo =   Bbo ^(  Bbu |  Bba ); \
+    Co = E##bo; \
+    E##bu =   Bbu ^(  Bba &  Bbe ); \
+    Cu = E##bu; \
+\
+    A##bo ^= Do; \
+    Bga = ROL64(A##bo, 28); \
+    A##gu ^= Du; \
+    Bge = ROL64(A##gu, 20); \
+    A##ka ^= Da; \
+    Bgi = ROL64(A##ka, 3); \
+    A##me ^= De; \
+    Bgo = ROL64(A##me, 45); \
+    A##si ^= Di; \
+    Bgu = ROL64(A##si, 61); \
+    E##ga =   Bga ^(  Bge |  Bgi ); \
+    Ca ^= E##ga; \
+    E##ge =   Bge ^(  Bgi &  Bgo ); \
+    Ce ^= E##ge; \
+    E##gi =   Bgi ^(  Bgo |(~Bgu)); \
+    Ci ^= E##gi; \
+    E##go =   Bgo ^(  Bgu |  Bga ); \
+    Co ^= E##go; \
+    E##gu =   Bgu ^(  Bga &  Bge ); \
+    Cu ^= E##gu; \
+\
+    A##be ^= De; \
+    Bka = ROL64(A##be, 1); \
+    A##gi ^= Di; \
+    Bke = ROL64(A##gi, 6); \
+    A##ko ^= Do; \
+    Bki = ROL64(A##ko, 25); \
+    A##mu ^= Du; \
+    Bko = ROL64(A##mu, 8); \
+    A##sa ^= Da; \
+    Bku = ROL64(A##sa, 18); \
+    E##ka =   Bka ^(  Bke |  Bki ); \
+    Ca ^= E##ka; \
+    E##ke =   Bke ^(  Bki &  Bko ); \
+    Ce ^= E##ke; \
+    E##ki =   Bki ^((~Bko)&  Bku ); \
+    Ci ^= E##ki; \
+    E##ko = (~Bko)^(  Bku |  Bka ); \
+    Co ^= E##ko; \
+    E##ku =   Bku ^(  Bka &  Bke ); \
+    Cu ^= E##ku; \
+\
+    A##bu ^= Du; \
+    Bma = ROL64(A##bu, 27); \
+    A##ga ^= Da; \
+    Bme = ROL64(A##ga, 36); \
+    A##ke ^= De; \
+    Bmi = ROL64(A##ke, 10); \
+    A##mi ^= Di; \
+    Bmo = ROL64(A##mi, 15); \
+    A##so ^= Do; \
+    Bmu = ROL64(A##so, 56); \
+    E##ma =   Bma ^(  Bme &  Bmi ); \
+    Ca ^= E##ma; \
+    E##me =   Bme ^(  Bmi |  Bmo ); \
+    Ce ^= E##me; \
+    E##mi =   Bmi ^((~Bmo)|  Bmu ); \
+    Ci ^= E##mi; \
+    E##mo = (~Bmo)^(  Bmu &  Bma ); \
+    Co ^= E##mo; \
+    E##mu =   Bmu ^(  Bma |  Bme ); \
+    Cu ^= E##mu; \
+\
+    A##bi ^= Di; \
+    Bsa = ROL64(A##bi, 62); \
+    A##go ^= Do; \
+    Bse = ROL64(A##go, 55); \
+    A##ku ^= Du; \
+    Bsi = ROL64(A##ku, 39); \
+    A##ma ^= Da; \
+    Bso = ROL64(A##ma, 41); \
+    A##se ^= De; \
+    Bsu = ROL64(A##se, 2); \
+    E##sa =   Bsa ^((~Bse)&  Bsi ); \
+    Ca ^= E##sa; \
+    E##se = (~Bse)^(  Bsi |  Bso ); \
+    Ce ^= E##se; \
+    E##si =   Bsi ^(  Bso &  Bsu ); \
+    Ci ^= E##si; \
+    E##so =   Bso ^(  Bsu |  Bsa ); \
+    Co ^= E##so; \
+    E##su =   Bsu ^(  Bsa &  Bse ); \
+    Cu ^= E##su; \
+\
+
+/* --- Code for round (lane complementing pattern 'bebigokimisa') */
+
+/* --- 64-bit lanes mapped to 64-bit words */
+
+#define thetaRhoPiChiIota(i, A, E) \
+    Da = Cu^ROL64(Ce, 1); \
+    De = Ca^ROL64(Ci, 1); \
+    Di = Ce^ROL64(Co, 1); \
+    Do = Ci^ROL64(Cu, 1); \
+    Du = Co^ROL64(Ca, 1); \
+\
+    A##ba ^= Da; \
+    Bba = A##ba; \
+    A##ge ^= De; \
+    Bbe = ROL64(A##ge, 44); \
+    A##ki ^= Di; \
+    Bbi = ROL64(A##ki, 43); \
+    A##mo ^= Do; \
+    Bbo = ROL64(A##mo, 21); \
+    A##su ^= Du; \
+    Bbu = ROL64(A##su, 14); \
+    E##ba =   Bba ^(  Bbe |  Bbi ); \
+    E##ba ^= KeccakF1600RoundConstants[i]; \
+    E##be =   Bbe ^((~Bbi)|  Bbo ); \
+    E##bi =   Bbi ^(  Bbo &  Bbu ); \
+    E##bo =   Bbo ^(  Bbu |  Bba ); \
+    E##bu =   Bbu ^(  Bba &  Bbe ); \
+\
+    A##bo ^= Do; \
+    Bga = ROL64(A##bo, 28); \
+    A##gu ^= Du; \
+    Bge = ROL64(A##gu, 20); \
+    A##ka ^= Da; \
+    Bgi = ROL64(A##ka, 3); \
+    A##me ^= De; \
+    Bgo = ROL64(A##me, 45); \
+    A##si ^= Di; \
+    Bgu = ROL64(A##si, 61); \
+    E##ga =   Bga ^(  Bge |  Bgi ); \
+    E##ge =   Bge ^(  Bgi &  Bgo ); \
+    E##gi =   Bgi ^(  Bgo |(~Bgu)); \
+    E##go =   Bgo ^(  Bgu |  Bga ); \
+    E##gu =   Bgu ^(  Bga &  Bge ); \
+\
+    A##be ^= De; \
+    Bka = ROL64(A##be, 1); \
+    A##gi ^= Di; \
+    Bke = ROL64(A##gi, 6); \
+    A##ko ^= Do; \
+    Bki = ROL64(A##ko, 25); \
+    A##mu ^= Du; \
+    Bko = ROL64(A##mu, 8); \
+    A##sa ^= Da; \
+    Bku = ROL64(A##sa, 18); \
+    E##ka =   Bka ^(  Bke |  Bki ); \
+    E##ke =   Bke ^(  Bki &  Bko ); \
+    E##ki =   Bki ^((~Bko)&  Bku ); \
+    E##ko = (~Bko)^(  Bku |  Bka ); \
+    E##ku =   Bku ^(  Bka &  Bke ); \
+\
+    A##bu ^= Du; \
+    Bma = ROL64(A##bu, 27); \
+    A##ga ^= Da; \
+    Bme = ROL64(A##ga, 36); \
+    A##ke ^= De; \
+    Bmi = ROL64(A##ke, 10); \
+    A##mi ^= Di; \
+    Bmo = ROL64(A##mi, 15); \
+    A##so ^= Do; \
+    Bmu = ROL64(A##so, 56); \
+    E##ma =   Bma ^(  Bme &  Bmi ); \
+    E##me =   Bme ^(  Bmi |  Bmo ); \
+    E##mi =   Bmi ^((~Bmo)|  Bmu ); \
+    E##mo = (~Bmo)^(  Bmu &  Bma ); \
+    E##mu =   Bmu ^(  Bma |  Bme ); \
+\
+    A##bi ^= Di; \
+    Bsa = ROL64(A##bi, 62); \
+    A##go ^= Do; \
+    Bse = ROL64(A##go, 55); \
+    A##ku ^= Du; \
+    Bsi = ROL64(A##ku, 39); \
+    A##ma ^= Da; \
+    Bso = ROL64(A##ma, 41); \
+    A##se ^= De; \
+    Bsu = ROL64(A##se, 2); \
+    E##sa =   Bsa ^((~Bse)&  Bsi ); \
+    E##se = (~Bse)^(  Bsi |  Bso ); \
+    E##si =   Bsi ^(  Bso &  Bsu ); \
+    E##so =   Bso ^(  Bsu |  Bsa ); \
+    E##su =   Bsu ^(  Bsa &  Bse ); \
+\
+
+#else /* UseBebigokimisa */
+
+/* --- Code for round, with prepare-theta */
+
+/* --- 64-bit lanes mapped to 64-bit words */
+
+#define thetaRhoPiChiIotaPrepareTheta(i, A, E) \
+    Da = Cu^ROL64(Ce, 1); \
+    De = Ca^ROL64(Ci, 1); \
+    Di = Ce^ROL64(Co, 1); \
+    Do = Ci^ROL64(Cu, 1); \
+    Du = Co^ROL64(Ca, 1); \
+\
+    A##ba ^= Da; \
+    Bba = A##ba; \
+    A##ge ^= De; \
+    Bbe = ROL64(A##ge, 44); \
+    A##ki ^= Di; \
+    Bbi = ROL64(A##ki, 43); \
+    A##mo ^= Do; \
+    Bbo = ROL64(A##mo, 21); \
+    A##su ^= Du; \
+    Bbu = ROL64(A##su, 14); \
+    E##ba =   Bba ^((~Bbe)&  Bbi ); \
+    E##ba ^= KeccakF1600RoundConstants[i]; \
+    Ca = E##ba; \
+    E##be =   Bbe ^((~Bbi)&  Bbo ); \
+    Ce = E##be; \
+    E##bi =   Bbi ^((~Bbo)&  Bbu ); \
+    Ci = E##bi; \
+    E##bo =   Bbo ^((~Bbu)&  Bba ); \
+    Co = E##bo; \
+    E##bu =   Bbu ^((~Bba)&  Bbe ); \
+    Cu = E##bu; \
+\
+    A##bo ^= Do; \
+    Bga = ROL64(A##bo, 28); \
+    A##gu ^= Du; \
+    Bge = ROL64(A##gu, 20); \
+    A##ka ^= Da; \
+    Bgi = ROL64(A##ka, 3); \
+    A##me ^= De; \
+    Bgo = ROL64(A##me, 45); \
+    A##si ^= Di; \
+    Bgu = ROL64(A##si, 61); \
+    E##ga =   Bga ^((~Bge)&  Bgi ); \
+    Ca ^= E##ga; \
+    E##ge =   Bge ^((~Bgi)&  Bgo ); \
+    Ce ^= E##ge; \
+    E##gi =   Bgi ^((~Bgo)&  Bgu ); \
+    Ci ^= E##gi; \
+    E##go =   Bgo ^((~Bgu)&  Bga ); \
+    Co ^= E##go; \
+    E##gu =   Bgu ^((~Bga)&  Bge ); \
+    Cu ^= E##gu; \
+\
+    A##be ^= De; \
+    Bka = ROL64(A##be, 1); \
+    A##gi ^= Di; \
+    Bke = ROL64(A##gi, 6); \
+    A##ko ^= Do; \
+    Bki = ROL64(A##ko, 25); \
+    A##mu ^= Du; \
+    Bko = ROL64(A##mu, 8); \
+    A##sa ^= Da; \
+    Bku = ROL64(A##sa, 18); \
+    E##ka =   Bka ^((~Bke)&  Bki ); \
+    Ca ^= E##ka; \
+    E##ke =   Bke ^((~Bki)&  Bko ); \
+    Ce ^= E##ke; \
+    E##ki =   Bki ^((~Bko)&  Bku ); \
+    Ci ^= E##ki; \
+    E##ko =   Bko ^((~Bku)&  Bka ); \
+    Co ^= E##ko; \
+    E##ku =   Bku ^((~Bka)&  Bke ); \
+    Cu ^= E##ku; \
+\
+    A##bu ^= Du; \
+    Bma = ROL64(A##bu, 27); \
+    A##ga ^= Da; \
+    Bme = ROL64(A##ga, 36); \
+    A##ke ^= De; \
+    Bmi = ROL64(A##ke, 10); \
+    A##mi ^= Di; \
+    Bmo = ROL64(A##mi, 15); \
+    A##so ^= Do; \
+    Bmu = ROL64(A##so, 56); \
+    E##ma =   Bma ^((~Bme)&  Bmi ); \
+    Ca ^= E##ma; \
+    E##me =   Bme ^((~Bmi)&  Bmo ); \
+    Ce ^= E##me; \
+    E##mi =   Bmi ^((~Bmo)&  Bmu ); \
+    Ci ^= E##mi; \
+    E##mo =   Bmo ^((~Bmu)&  Bma ); \
+    Co ^= E##mo; \
+    E##mu =   Bmu ^((~Bma)&  Bme ); \
+    Cu ^= E##mu; \
+\
+    A##bi ^= Di; \
+    Bsa = ROL64(A##bi, 62); \
+    A##go ^= Do; \
+    Bse = ROL64(A##go, 55); \
+    A##ku ^= Du; \
+    Bsi = ROL64(A##ku, 39); \
+    A##ma ^= Da; \
+    Bso = ROL64(A##ma, 41); \
+    A##se ^= De; \
+    Bsu = ROL64(A##se, 2); \
+    E##sa =   Bsa ^((~Bse)&  Bsi ); \
+    Ca ^= E##sa; \
+    E##se =   Bse ^((~Bsi)&  Bso ); \
+    Ce ^= E##se; \
+    E##si =   Bsi ^((~Bso)&  Bsu ); \
+    Ci ^= E##si; \
+    E##so =   Bso ^((~Bsu)&  Bsa ); \
+    Co ^= E##so; \
+    E##su =   Bsu ^((~Bsa)&  Bse ); \
+    Cu ^= E##su; \
+\
+
+/* --- Code for round */
+
+/* --- 64-bit lanes mapped to 64-bit words */
+
+#define thetaRhoPiChiIota(i, A, E) \
+    Da = Cu^ROL64(Ce, 1); \
+    De = Ca^ROL64(Ci, 1); \
+    Di = Ce^ROL64(Co, 1); \
+    Do = Ci^ROL64(Cu, 1); \
+    Du = Co^ROL64(Ca, 1); \
+\
+    A##ba ^= Da; \
+    Bba = A##ba; \
+    A##ge ^= De; \
+    Bbe = ROL64(A##ge, 44); \
+    A##ki ^= Di; \
+    Bbi = ROL64(A##ki, 43); \
+    A##mo ^= Do; \
+    Bbo = ROL64(A##mo, 21); \
+    A##su ^= Du; \
+    Bbu = ROL64(A##su, 14); \
+    E##ba =   Bba ^((~Bbe)&  Bbi ); \
+    E##ba ^= KeccakF1600RoundConstants[i]; \
+    E##be =   Bbe ^((~Bbi)&  Bbo ); \
+    E##bi =   Bbi ^((~Bbo)&  Bbu ); \
+    E##bo =   Bbo ^((~Bbu)&  Bba ); \
+    E##bu =   Bbu ^((~Bba)&  Bbe ); \
+\
+    A##bo ^= Do; \
+    Bga = ROL64(A##bo, 28); \
+    A##gu ^= Du; \
+    Bge = ROL64(A##gu, 20); \
+    A##ka ^= Da; \
+    Bgi = ROL64(A##ka, 3); \
+    A##me ^= De; \
+    Bgo = ROL64(A##me, 45); \
+    A##si ^= Di; \
+    Bgu = ROL64(A##si, 61); \
+    E##ga =   Bga ^((~Bge)&  Bgi ); \
+    E##ge =   Bge ^((~Bgi)&  Bgo ); \
+    E##gi =   Bgi ^((~Bgo)&  Bgu ); \
+    E##go =   Bgo ^((~Bgu)&  Bga ); \
+    E##gu =   Bgu ^((~Bga)&  Bge ); \
+\
+    A##be ^= De; \
+    Bka = ROL64(A##be, 1); \
+    A##gi ^= Di; \
+    Bke = ROL64(A##gi, 6); \
+    A##ko ^= Do; \
+    Bki = ROL64(A##ko, 25); \
+    A##mu ^= Du; \
+    Bko = ROL64(A##mu, 8); \
+    A##sa ^= Da; \
+    Bku = ROL64(A##sa, 18); \
+    E##ka =   Bka ^((~Bke)&  Bki ); \
+    E##ke =   Bke ^((~Bki)&  Bko ); \
+    E##ki =   Bki ^((~Bko)&  Bku ); \
+    E##ko =   Bko ^((~Bku)&  Bka ); \
+    E##ku =   Bku ^((~Bka)&  Bke ); \
+\
+    A##bu ^= Du; \
+    Bma = ROL64(A##bu, 27); \
+    A##ga ^= Da; \
+    Bme = ROL64(A##ga, 36); \
+    A##ke ^= De; \
+    Bmi = ROL64(A##ke, 10); \
+    A##mi ^= Di; \
+    Bmo = ROL64(A##mi, 15); \
+    A##so ^= Do; \
+    Bmu = ROL64(A##so, 56); \
+    E##ma =   Bma ^((~Bme)&  Bmi ); \
+    E##me =   Bme ^((~Bmi)&  Bmo ); \
+    E##mi =   Bmi ^((~Bmo)&  Bmu ); \
+    E##mo =   Bmo ^((~Bmu)&  Bma ); \
+    E##mu =   Bmu ^((~Bma)&  Bme ); \
+\
+    A##bi ^= Di; \
+    Bsa = ROL64(A##bi, 62); \
+    A##go ^= Do; \
+    Bse = ROL64(A##go, 55); \
+    A##ku ^= Du; \
+    Bsi = ROL64(A##ku, 39); \
+    A##ma ^= Da; \
+    Bso = ROL64(A##ma, 41); \
+    A##se ^= De; \
+    Bsu = ROL64(A##se, 2); \
+    E##sa =   Bsa ^((~Bse)&  Bsi ); \
+    E##se =   Bse ^((~Bsi)&  Bso ); \
+    E##si =   Bsi ^((~Bso)&  Bsu ); \
+    E##so =   Bso ^((~Bsu)&  Bsa ); \
+    E##su =   Bsu ^((~Bsa)&  Bse ); \
+\
+
+#endif /* UseBebigokimisa */
+
+
+#define copyFromState(X, state) \
+    X##ba = state[ 0]; \
+    X##be = state[ 1]; \
+    X##bi = state[ 2]; \
+    X##bo = state[ 3]; \
+    X##bu = state[ 4]; \
+    X##ga = state[ 5]; \
+    X##ge = state[ 6]; \
+    X##gi = state[ 7]; \
+    X##go = state[ 8]; \
+    X##gu = state[ 9]; \
+    X##ka = state[10]; \
+    X##ke = state[11]; \
+    X##ki = state[12]; \
+    X##ko = state[13]; \
+    X##ku = state[14]; \
+    X##ma = state[15]; \
+    X##me = state[16]; \
+    X##mi = state[17]; \
+    X##mo = state[18]; \
+    X##mu = state[19]; \
+    X##sa = state[20]; \
+    X##se = state[21]; \
+    X##si = state[22]; \
+    X##so = state[23]; \
+    X##su = state[24]; \
+
+#define copyToState(state, X) \
+    state[ 0] = X##ba; \
+    state[ 1] = X##be; \
+    state[ 2] = X##bi; \
+    state[ 3] = X##bo; \
+    state[ 4] = X##bu; \
+    state[ 5] = X##ga; \
+    state[ 6] = X##ge; \
+    state[ 7] = X##gi; \
+    state[ 8] = X##go; \
+    state[ 9] = X##gu; \
+    state[10] = X##ka; \
+    state[11] = X##ke; \
+    state[12] = X##ki; \
+    state[13] = X##ko; \
+    state[14] = X##ku; \
+    state[15] = X##ma; \
+    state[16] = X##me; \
+    state[17] = X##mi; \
+    state[18] = X##mo; \
+    state[19] = X##mu; \
+    state[20] = X##sa; \
+    state[21] = X##se; \
+    state[22] = X##si; \
+    state[23] = X##so; \
+    state[24] = X##su; \
+
+#define copyStateVariables(X, Y) \
+    X##ba = Y##ba; \
+    X##be = Y##be; \
+    X##bi = Y##bi; \
+    X##bo = Y##bo; \
+    X##bu = Y##bu; \
+    X##ga = Y##ga; \
+    X##ge = Y##ge; \
+    X##gi = Y##gi; \
+    X##go = Y##go; \
+    X##gu = Y##gu; \
+    X##ka = Y##ka; \
+    X##ke = Y##ke; \
+    X##ki = Y##ki; \
+    X##ko = Y##ko; \
+    X##ku = Y##ku; \
+    X##ma = Y##ma; \
+    X##me = Y##me; \
+    X##mi = Y##mi; \
+    X##mo = Y##mo; \
+    X##mu = Y##mu; \
+    X##sa = Y##sa; \
+    X##se = Y##se; \
+    X##si = Y##si; \
+    X##so = Y##so; \
+    X##su = Y##su; \
+
+#define copyFromStateAndAdd(X, state, input, laneCount) \
+    if (laneCount < 16) { \
+        if (laneCount < 8) { \
+            if (laneCount < 4) { \
+                if (laneCount < 2) { \
+                    if (laneCount < 1) { \
+                        X##ba = state[ 0]; \
+                    } \
+                    else { \
+                        X##ba = state[ 0]^input[ 0]; \
+                    } \
+                    X##be = state[ 1]; \
+                    X##bi = state[ 2]; \
+                } \
+                else { \
+                    X##ba = state[ 0]^input[ 0]; \
+                    X##be = state[ 1]^input[ 1]; \
+                    if (laneCount < 3) { \
+                        X##bi = state[ 2]; \
+                    } \
+                    else { \
+                        X##bi = state[ 2]^input[ 2]; \
+                    } \
+                } \
+                X##bo = state[ 3]; \
+                X##bu = state[ 4]; \
+                X##ga = state[ 5]; \
+                X##ge = state[ 6]; \
+            } \
+            else { \
+                X##ba = state[ 0]^input[ 0]; \
+                X##be = state[ 1]^input[ 1]; \
+                X##bi = state[ 2]^input[ 2]; \
+                X##bo = state[ 3]^input[ 3]; \
+                if (laneCount < 6) { \
+                    if (laneCount < 5) { \
+                        X##bu = state[ 4]; \
+                    } \
+                    else { \
+                        X##bu = state[ 4]^input[ 4]; \
+                    } \
+                    X##ga = state[ 5]; \
+                    X##ge = state[ 6]; \
+                } \
+                else { \
+                    X##bu = state[ 4]^input[ 4]; \
+                    X##ga = state[ 5]^input[ 5]; \
+                    if (laneCount < 7) { \
+                        X##ge = state[ 6]; \
+                    } \
+                    else { \
+                        X##ge = state[ 6]^input[ 6]; \
+                    } \
+                } \
+            } \
+            X##gi = state[ 7]; \
+            X##go = state[ 8]; \
+            X##gu = state[ 9]; \
+            X##ka = state[10]; \
+            X##ke = state[11]; \
+            X##ki = state[12]; \
+            X##ko = state[13]; \
+            X##ku = state[14]; \
+        } \
+        else { \
+            X##ba = state[ 0]^input[ 0]; \
+            X##be = state[ 1]^input[ 1]; \
+            X##bi = state[ 2]^input[ 2]; \
+            X##bo = state[ 3]^input[ 3]; \
+            X##bu = state[ 4]^input[ 4]; \
+            X##ga = state[ 5]^input[ 5]; \
+            X##ge = state[ 6]^input[ 6]; \
+            X##gi = state[ 7]^input[ 7]; \
+            if (laneCount < 12) { \
+                if (laneCount < 10) { \
+                    if (laneCount < 9) { \
+                        X##go = state[ 8]; \
+                    } \
+                    else { \
+                        X##go = state[ 8]^input[ 8]; \
+                    } \
+                    X##gu = state[ 9]; \
+                    X##ka = state[10]; \
+                } \
+                else { \
+                    X##go = state[ 8]^input[ 8]; \
+                    X##gu = state[ 9]^input[ 9]; \
+                    if (laneCount < 11) { \
+                        X##ka = state[10]; \
+                    } \
+                    else { \
+                        X##ka = state[10]^input[10]; \
+                    } \
+                } \
+                X##ke = state[11]; \
+                X##ki = state[12]; \
+                X##ko = state[13]; \
+                X##ku = state[14]; \
+            } \
+            else { \
+                X##go = state[ 8]^input[ 8]; \
+                X##gu = state[ 9]^input[ 9]; \
+                X##ka = state[10]^input[10]; \
+                X##ke = state[11]^input[11]; \
+                if (laneCount < 14) { \
+                    if (laneCount < 13) { \
+                        X##ki = state[12]; \
+                    } \
+                    else { \
+                        X##ki = state[12]^input[12]; \
+                    } \
+                    X##ko = state[13]; \
+                    X##ku = state[14]; \
+                } \
+                else { \
+                    X##ki = state[12]^input[12]; \
+                    X##ko = state[13]^input[13]; \
+                    if (laneCount < 15) { \
+                        X##ku = state[14]; \
+                    } \
+                    else { \
+                        X##ku = state[14]^input[14]; \
+                    } \
+                } \
+            } \
+        } \
+        X##ma = state[15]; \
+        X##me = state[16]; \
+        X##mi = state[17]; \
+        X##mo = state[18]; \
+        X##mu = state[19]; \
+        X##sa = state[20]; \
+        X##se = state[21]; \
+        X##si = state[22]; \
+        X##so = state[23]; \
+        X##su = state[24]; \
+    } \
+    else { \
+        X##ba = state[ 0]^input[ 0]; \
+        X##be = state[ 1]^input[ 1]; \
+        X##bi = state[ 2]^input[ 2]; \
+        X##bo = state[ 3]^input[ 3]; \
+        X##bu = state[ 4]^input[ 4]; \
+        X##ga = state[ 5]^input[ 5]; \
+        X##ge = state[ 6]^input[ 6]; \
+        X##gi = state[ 7]^input[ 7]; \
+        X##go = state[ 8]^input[ 8]; \
+        X##gu = state[ 9]^input[ 9]; \
+        X##ka = state[10]^input[10]; \
+        X##ke = state[11]^input[11]; \
+        X##ki = state[12]^input[12]; \
+        X##ko = state[13]^input[13]; \
+        X##ku = state[14]^input[14]; \
+        X##ma = state[15]^input[15]; \
+        if (laneCount < 24) { \
+            if (laneCount < 20) { \
+                if (laneCount < 18) { \
+                    if (laneCount < 17) { \
+                        X##me = state[16]; \
+                    } \
+                    else { \
+                        X##me = state[16]^input[16]; \
+                    } \
+                    X##mi = state[17]; \
+                    X##mo = state[18]; \
+                } \
+                else { \
+                    X##me = state[16]^input[16]; \
+                    X##mi = state[17]^input[17]; \
+                    if (laneCount < 19) { \
+                        X##mo = state[18]; \
+                    } \
+                    else { \
+                        X##mo = state[18]^input[18]; \
+                    } \
+                } \
+                X##mu = state[19]; \
+                X##sa = state[20]; \
+                X##se = state[21]; \
+                X##si = state[22]; \
+            } \
+            else { \
+                X##me = state[16]^input[16]; \
+                X##mi = state[17]^input[17]; \
+                X##mo = state[18]^input[18]; \
+                X##mu = state[19]^input[19]; \
+                if (laneCount < 22) { \
+                    if (laneCount < 21) { \
+                        X##sa = state[20]; \
+                    } \
+                    else { \
+                        X##sa = state[20]^input[20]; \
+                    } \
+                    X##se = state[21]; \
+                    X##si = state[22]; \
+                } \
+                else { \
+                    X##sa = state[20]^input[20]; \
+                    X##se = state[21]^input[21]; \
+                    if (laneCount < 23) { \
+                        X##si = state[22]; \
+                    } \
+                    else { \
+                        X##si = state[22]^input[22]; \
+                    } \
+                } \
+            } \
+            X##so = state[23]; \
+            X##su = state[24]; \
+        } \
+        else { \
+            X##me = state[16]^input[16]; \
+            X##mi = state[17]^input[17]; \
+            X##mo = state[18]^input[18]; \
+            X##mu = state[19]^input[19]; \
+            X##sa = state[20]^input[20]; \
+            X##se = state[21]^input[21]; \
+            X##si = state[22]^input[22]; \
+            X##so = state[23]^input[23]; \
+            if (laneCount < 25) { \
+                X##su = state[24]; \
+            } \
+            else { \
+                X##su = state[24]^input[24]; \
+            } \
+        } \
+    }
+
+#define addInput(X, input, laneCount) \
+    if (laneCount == 21) { \
+        X##ba ^= input[ 0]; \
+        X##be ^= input[ 1]; \
+        X##bi ^= input[ 2]; \
+        X##bo ^= input[ 3]; \
+        X##bu ^= input[ 4]; \
+        X##ga ^= input[ 5]; \
+        X##ge ^= input[ 6]; \
+        X##gi ^= input[ 7]; \
+        X##go ^= input[ 8]; \
+        X##gu ^= input[ 9]; \
+        X##ka ^= input[10]; \
+        X##ke ^= input[11]; \
+        X##ki ^= input[12]; \
+        X##ko ^= input[13]; \
+        X##ku ^= input[14]; \
+        X##ma ^= input[15]; \
+        X##me ^= input[16]; \
+        X##mi ^= input[17]; \
+        X##mo ^= input[18]; \
+        X##mu ^= input[19]; \
+        X##sa ^= input[20]; \
+    } \
+    else if (laneCount < 16) { \
+        if (laneCount < 8) { \
+            if (laneCount < 4) { \
+                if (laneCount < 2) { \
+                    if (laneCount < 1) { \
+                    } \
+                    else { \
+                        X##ba ^= input[ 0]; \
+                    } \
+                } \
+                else { \
+                    X##ba ^= input[ 0]; \
+                    X##be ^= input[ 1]; \
+                    if (laneCount < 3) { \
+                    } \
+                    else { \
+                        X##bi ^= input[ 2]; \
+                    } \
+                } \
+            } \
+            else { \
+                X##ba ^= input[ 0]; \
+                X##be ^= input[ 1]; \
+                X##bi ^= input[ 2]; \
+                X##bo ^= input[ 3]; \
+                if (laneCount < 6) { \
+                    if (laneCount < 5) { \
+                    } \
+                    else { \
+                        X##bu ^= input[ 4]; \
+                    } \
+                } \
+                else { \
+                    X##bu ^= input[ 4]; \
+                    X##ga ^= input[ 5]; \
+                    if (laneCount < 7) { \
+                    } \
+                    else { \
+                        X##ge ^= input[ 6]; \
+                    } \
+                } \
+            } \
+        } \
+        else { \
+            X##ba ^= input[ 0]; \
+            X##be ^= input[ 1]; \
+            X##bi ^= input[ 2]; \
+            X##bo ^= input[ 3]; \
+            X##bu ^= input[ 4]; \
+            X##ga ^= input[ 5]; \
+            X##ge ^= input[ 6]; \
+            X##gi ^= input[ 7]; \
+            if (laneCount < 12) { \
+                if (laneCount < 10) { \
+                    if (laneCount < 9) { \
+                    } \
+                    else { \
+                        X##go ^= input[ 8]; \
+                    } \
+                } \
+                else { \
+                    X##go ^= input[ 8]; \
+                    X##gu ^= input[ 9]; \
+                    if (laneCount < 11) { \
+                    } \
+                    else { \
+                        X##ka ^= input[10]; \
+                    } \
+                } \
+            } \
+            else { \
+                X##go ^= input[ 8]; \
+                X##gu ^= input[ 9]; \
+                X##ka ^= input[10]; \
+                X##ke ^= input[11]; \
+                if (laneCount < 14) { \
+                    if (laneCount < 13) { \
+                    } \
+                    else { \
+                        X##ki ^= input[12]; \
+                    } \
+                } \
+                else { \
+                    X##ki ^= input[12]; \
+                    X##ko ^= input[13]; \
+                    if (laneCount < 15) { \
+                    } \
+                    else { \
+                        X##ku ^= input[14]; \
+                    } \
+                } \
+            } \
+        } \
+    } \
+    else { \
+        X##ba ^= input[ 0]; \
+        X##be ^= input[ 1]; \
+        X##bi ^= input[ 2]; \
+        X##bo ^= input[ 3]; \
+        X##bu ^= input[ 4]; \
+        X##ga ^= input[ 5]; \
+        X##ge ^= input[ 6]; \
+        X##gi ^= input[ 7]; \
+        X##go ^= input[ 8]; \
+        X##gu ^= input[ 9]; \
+        X##ka ^= input[10]; \
+        X##ke ^= input[11]; \
+        X##ki ^= input[12]; \
+        X##ko ^= input[13]; \
+        X##ku ^= input[14]; \
+        X##ma ^= input[15]; \
+        if (laneCount < 24) { \
+            if (laneCount < 20) { \
+                if (laneCount < 18) { \
+                    if (laneCount < 17) { \
+                    } \
+                    else { \
+                        X##me ^= input[16]; \
+                    } \
+                } \
+                else { \
+                    X##me ^= input[16]; \
+                    X##mi ^= input[17]; \
+                    if (laneCount < 19) { \
+                    } \
+                    else { \
+                        X##mo ^= input[18]; \
+                    } \
+                } \
+            } \
+            else { \
+                X##me ^= input[16]; \
+                X##mi ^= input[17]; \
+                X##mo ^= input[18]; \
+                X##mu ^= input[19]; \
+                if (laneCount < 22) { \
+                    if (laneCount < 21) { \
+                    } \
+                    else { \
+                        X##sa ^= input[20]; \
+                    } \
+                } \
+                else { \
+                    X##sa ^= input[20]; \
+                    X##se ^= input[21]; \
+                    if (laneCount < 23) { \
+                    } \
+                    else { \
+                        X##si ^= input[22]; \
+                    } \
+                } \
+            } \
+        } \
+        else { \
+            X##me ^= input[16]; \
+            X##mi ^= input[17]; \
+            X##mo ^= input[18]; \
+            X##mu ^= input[19]; \
+            X##sa ^= input[20]; \
+            X##se ^= input[21]; \
+            X##si ^= input[22]; \
+            X##so ^= input[23]; \
+            if (laneCount < 25) { \
+            } \
+            else { \
+                X##su ^= input[24]; \
+            } \
+        } \
+    }
+
+#ifdef UseBebigokimisa
+
+#define copyToStateAndOutput(X, state, output, laneCount) \
+    if (laneCount < 16) { \
+        if (laneCount < 8) { \
+            if (laneCount < 4) { \
+                if (laneCount < 2) { \
+                    state[ 0] = X##ba; \
+                    if (laneCount >= 1) { \
+                        output[ 0] = X##ba; \
+                    } \
+                    state[ 1] = X##be; \
+                    state[ 2] = X##bi; \
+                } \
+                else { \
+                    state[ 0] = X##ba; \
+                    output[ 0] = X##ba; \
+                    state[ 1] = X##be; \
+                    output[ 1] = ~X##be; \
+                    state[ 2] = X##bi; \
+                    if (laneCount >= 3) { \
+                        output[ 2] = ~X##bi; \
+                    } \
+                } \
+                state[ 3] = X##bo; \
+                state[ 4] = X##bu; \
+                state[ 5] = X##ga; \
+                state[ 6] = X##ge; \
+            } \
+            else { \
+                state[ 0] = X##ba; \
+                output[ 0] = X##ba; \
+                state[ 1] = X##be; \
+                output[ 1] = ~X##be; \
+                state[ 2] = X##bi; \
+                output[ 2] = ~X##bi; \
+                state[ 3] = X##bo; \
+                output[ 3] = X##bo; \
+                if (laneCount < 6) { \
+                    state[ 4] = X##bu; \
+                    if (laneCount >= 5) { \
+                        output[ 4] = X##bu; \
+                    } \
+                    state[ 5] = X##ga; \
+                    state[ 6] = X##ge; \
+                } \
+                else { \
+                    state[ 4] = X##bu; \
+                    output[ 4] = X##bu; \
+                    state[ 5] = X##ga; \
+                    output[ 5] = X##ga; \
+                    state[ 6] = X##ge; \
+                    if (laneCount >= 7) { \
+                        output[ 6] = X##ge; \
+                    } \
+                } \
+            } \
+            state[ 7] = X##gi; \
+            state[ 8] = X##go; \
+            state[ 9] = X##gu; \
+            state[10] = X##ka; \
+            state[11] = X##ke; \
+            state[12] = X##ki; \
+            state[13] = X##ko; \
+            state[14] = X##ku; \
+        } \
+        else { \
+            state[ 0] = X##ba; \
+            output[ 0] = X##ba; \
+            state[ 1] = X##be; \
+            output[ 1] = ~X##be; \
+            state[ 2] = X##bi; \
+            output[ 2] = ~X##bi; \
+            state[ 3] = X##bo; \
+            output[ 3] = X##bo; \
+            state[ 4] = X##bu; \
+            output[ 4] = X##bu; \
+            state[ 5] = X##ga; \
+            output[ 5] = X##ga; \
+            state[ 6] = X##ge; \
+            output[ 6] = X##ge; \
+            state[ 7] = X##gi; \
+            output[ 7] = X##gi; \
+            if (laneCount < 12) { \
+                if (laneCount < 10) { \
+                    state[ 8] = X##go; \
+                    if (laneCount >= 9) { \
+                        output[ 8] = ~X##go; \
+                    } \
+                    state[ 9] = X##gu; \
+                    state[10] = X##ka; \
+                } \
+                else { \
+                    state[ 8] = X##go; \
+                    output[ 8] = ~X##go; \
+                    state[ 9] = X##gu; \
+                    output[ 9] = X##gu; \
+                    state[10] = X##ka; \
+                    if (laneCount >= 11) { \
+                        output[10] = X##ka; \
+                    } \
+                } \
+                state[11] = X##ke; \
+                state[12] = X##ki; \
+                state[13] = X##ko; \
+                state[14] = X##ku; \
+            } \
+            else { \
+                state[ 8] = X##go; \
+                output[ 8] = ~X##go; \
+                state[ 9] = X##gu; \
+                output[ 9] = X##gu; \
+                state[10] = X##ka; \
+                output[10] = X##ka; \
+                state[11] = X##ke; \
+                output[11] = X##ke; \
+                if (laneCount < 14) { \
+                    state[12] = X##ki; \
+                    if (laneCount >= 13) { \
+                        output[12] = ~X##ki; \
+                    } \
+                    state[13] = X##ko; \
+                    state[14] = X##ku; \
+                } \
+                else { \
+                    state[12] = X##ki; \
+                    output[12] = ~X##ki; \
+                    state[13] = X##ko; \
+                    output[13] = X##ko; \
+                    state[14] = X##ku; \
+                    if (laneCount >= 15) { \
+                        output[14] = X##ku; \
+                    } \
+                } \
+            } \
+        } \
+        state[15] = X##ma; \
+        state[16] = X##me; \
+        state[17] = X##mi; \
+        state[18] = X##mo; \
+        state[19] = X##mu; \
+        state[20] = X##sa; \
+        state[21] = X##se; \
+        state[22] = X##si; \
+        state[23] = X##so; \
+        state[24] = X##su; \
+    } \
+    else { \
+        state[ 0] = X##ba; \
+        output[ 0] = X##ba; \
+        state[ 1] = X##be; \
+        output[ 1] = ~X##be; \
+        state[ 2] = X##bi; \
+        output[ 2] = ~X##bi; \
+        state[ 3] = X##bo; \
+        output[ 3] = X##bo; \
+        state[ 4] = X##bu; \
+        output[ 4] = X##bu; \
+        state[ 5] = X##ga; \
+        output[ 5] = X##ga; \
+        state[ 6] = X##ge; \
+        output[ 6] = X##ge; \
+        state[ 7] = X##gi; \
+        output[ 7] = X##gi; \
+        state[ 8] = X##go; \
+        output[ 8] = ~X##go; \
+        state[ 9] = X##gu; \
+        output[ 9] = X##gu; \
+        state[10] = X##ka; \
+        output[10] = X##ka; \
+        state[11] = X##ke; \
+        output[11] = X##ke; \
+        state[12] = X##ki; \
+        output[12] = ~X##ki; \
+        state[13] = X##ko; \
+        output[13] = X##ko; \
+        state[14] = X##ku; \
+        output[14] = X##ku; \
+        state[15] = X##ma; \
+        output[15] = X##ma; \
+        if (laneCount < 24) { \
+            if (laneCount < 20) { \
+                if (laneCount < 18) { \
+                    state[16] = X##me; \
+                    if (laneCount >= 17) { \
+                        output[16] = X##me; \
+                    } \
+                    state[17] = X##mi; \
+                    state[18] = X##mo; \
+                } \
+                else { \
+                    state[16] = X##me; \
+                    output[16] = X##me; \
+                    state[17] = X##mi; \
+                    output[17] = ~X##mi; \
+                    state[18] = X##mo; \
+                    if (laneCount >= 19) { \
+                        output[18] = X##mo; \
+                    } \
+                } \
+                state[19] = X##mu; \
+                state[20] = X##sa; \
+                state[21] = X##se; \
+                state[22] = X##si; \
+            } \
+            else { \
+                state[16] = X##me; \
+                output[16] = X##me; \
+                state[17] = X##mi; \
+                output[17] = ~X##mi; \
+                state[18] = X##mo; \
+                output[18] = X##mo; \
+                state[19] = X##mu; \
+                output[19] = X##mu; \
+                if (laneCount < 22) { \
+                    state[20] = X##sa; \
+                    if (laneCount >= 21) { \
+                        output[20] = ~X##sa; \
+                    } \
+                    state[21] = X##se; \
+                    state[22] = X##si; \
+                } \
+                else { \
+                    state[20] = X##sa; \
+                    output[20] = ~X##sa; \
+                    state[21] = X##se; \
+                    output[21] = X##se; \
+                    state[22] = X##si; \
+                    if (laneCount >= 23) { \
+                        output[22] = X##si; \
+                    } \
+                } \
+            } \
+            state[23] = X##so; \
+            state[24] = X##su; \
+        } \
+        else { \
+            state[16] = X##me; \
+            output[16] = X##me; \
+            state[17] = X##mi; \
+            output[17] = ~X##mi; \
+            state[18] = X##mo; \
+            output[18] = X##mo; \
+            state[19] = X##mu; \
+            output[19] = X##mu; \
+            state[20] = X##sa; \
+            output[20] = ~X##sa; \
+            state[21] = X##se; \
+            output[21] = X##se; \
+            state[22] = X##si; \
+            output[22] = X##si; \
+            state[23] = X##so; \
+            output[23] = X##so; \
+            state[24] = X##su; \
+            if (laneCount >= 25) { \
+                output[24] = X##su; \
+            } \
+        } \
+    }
+
+#define output(X, output, laneCount) \
+    if (laneCount < 16) { \
+        if (laneCount < 8) { \
+            if (laneCount < 4) { \
+                if (laneCount < 2) { \
+                    if (laneCount >= 1) { \
+                        output[ 0] = X##ba; \
+                    } \
+                } \
+                else { \
+                    output[ 0] = X##ba; \
+                    output[ 1] = ~X##be; \
+                    if (laneCount >= 3) { \
+                        output[ 2] = ~X##bi; \
+                    } \
+                } \
+            } \
+            else { \
+                output[ 0] = X##ba; \
+                output[ 1] = ~X##be; \
+                output[ 2] = ~X##bi; \
+                output[ 3] = X##bo; \
+                if (laneCount < 6) { \
+                    if (laneCount >= 5) { \
+                        output[ 4] = X##bu; \
+                    } \
+                } \
+                else { \
+                    output[ 4] = X##bu; \
+                    output[ 5] = X##ga; \
+                    if (laneCount >= 7) { \
+                        output[ 6] = X##ge; \
+                    } \
+                } \
+            } \
+        } \
+        else { \
+            output[ 0] = X##ba; \
+            output[ 1] = ~X##be; \
+            output[ 2] = ~X##bi; \
+            output[ 3] = X##bo; \
+            output[ 4] = X##bu; \
+            output[ 5] = X##ga; \
+            output[ 6] = X##ge; \
+            output[ 7] = X##gi; \
+            if (laneCount < 12) { \
+                if (laneCount < 10) { \
+                    if (laneCount >= 9) { \
+                        output[ 8] = ~X##go; \
+                    } \
+                } \
+                else { \
+                    output[ 8] = ~X##go; \
+                    output[ 9] = X##gu; \
+                    if (laneCount >= 11) { \
+                        output[10] = X##ka; \
+                    } \
+                } \
+            } \
+            else { \
+                output[ 8] = ~X##go; \
+                output[ 9] = X##gu; \
+                output[10] = X##ka; \
+                output[11] = X##ke; \
+                if (laneCount < 14) { \
+                    if (laneCount >= 13) { \
+                        output[12] = ~X##ki; \
+                    } \
+                } \
+                else { \
+                    output[12] = ~X##ki; \
+                    output[13] = X##ko; \
+                    if (laneCount >= 15) { \
+                        output[14] = X##ku; \
+                    } \
+                } \
+            } \
+        } \
+    } \
+    else { \
+        output[ 0] = X##ba; \
+        output[ 1] = ~X##be; \
+        output[ 2] = ~X##bi; \
+        output[ 3] = X##bo; \
+        output[ 4] = X##bu; \
+        output[ 5] = X##ga; \
+        output[ 6] = X##ge; \
+        output[ 7] = X##gi; \
+        output[ 8] = ~X##go; \
+        output[ 9] = X##gu; \
+        output[10] = X##ka; \
+        output[11] = X##ke; \
+        output[12] = ~X##ki; \
+        output[13] = X##ko; \
+        output[14] = X##ku; \
+        output[15] = X##ma; \
+        if (laneCount < 24) { \
+            if (laneCount < 20) { \
+                if (laneCount < 18) { \
+                    if (laneCount >= 17) { \
+                        output[16] = X##me; \
+                    } \
+                } \
+                else { \
+                    output[16] = X##me; \
+                    output[17] = ~X##mi; \
+                    if (laneCount >= 19) { \
+                        output[18] = X##mo; \
+                    } \
+                } \
+            } \
+            else { \
+                output[16] = X##me; \
+                output[17] = ~X##mi; \
+                output[18] = X##mo; \
+                output[19] = X##mu; \
+                if (laneCount < 22) { \
+                    if (laneCount >= 21) { \
+                        output[20] = ~X##sa; \
+                    } \
+                } \
+                else { \
+                    output[20] = ~X##sa; \
+                    output[21] = X##se; \
+                    if (laneCount >= 23) { \
+                        output[22] = X##si; \
+                    } \
+                } \
+            } \
+        } \
+        else { \
+            output[16] = X##me; \
+            output[17] = ~X##mi; \
+            output[18] = X##mo; \
+            output[19] = X##mu; \
+            output[20] = ~X##sa; \
+            output[21] = X##se; \
+            output[22] = X##si; \
+            output[23] = X##so; \
+            if (laneCount >= 25) { \
+                output[24] = X##su; \
+            } \
+        } \
+    }
+
+#define wrapOne(X, input, output, index, name) \
+    X##name ^= input[index]; \
+    output[index] = X##name;
+
+#define wrapOneInvert(X, input, output, index, name) \
+    X##name ^= input[index]; \
+    output[index] = ~X##name;
+
+#define unwrapOne(X, input, output, index, name) \
+    output[index] = input[index] ^ X##name; \
+    X##name ^= output[index];
+
+#define unwrapOneInvert(X, input, output, index, name) \
+    output[index] = ~(input[index] ^ X##name); \
+    X##name ^= output[index]; \
+
+#else /* UseBebigokimisa */
+
+
+#define copyToStateAndOutput(X, state, output, laneCount) \
+    if (laneCount < 16) { \
+        if (laneCount < 8) { \
+            if (laneCount < 4) { \
+                if (laneCount < 2) { \
+                    state[ 0] = X##ba; \
+                    if (laneCount >= 1) { \
+                        output[ 0] = X##ba; \
+                    } \
+                    state[ 1] = X##be; \
+                    state[ 2] = X##bi; \
+                } \
+                else { \
+                    state[ 0] = X##ba; \
+                    output[ 0] = X##ba; \
+                    state[ 1] = X##be; \
+                    output[ 1] = X##be; \
+                    state[ 2] = X##bi; \
+                    if (laneCount >= 3) { \
+                        output[ 2] = X##bi; \
+                    } \
+                } \
+                state[ 3] = X##bo; \
+                state[ 4] = X##bu; \
+                state[ 5] = X##ga; \
+                state[ 6] = X##ge; \
+            } \
+            else { \
+                state[ 0] = X##ba; \
+                output[ 0] = X##ba; \
+                state[ 1] = X##be; \
+                output[ 1] = X##be; \
+                state[ 2] = X##bi; \
+                output[ 2] = X##bi; \
+                state[ 3] = X##bo; \
+                output[ 3] = X##bo; \
+                if (laneCount < 6) { \
+                    state[ 4] = X##bu; \
+                    if (laneCount >= 5) { \
+                        output[ 4] = X##bu; \
+                    } \
+                    state[ 5] = X##ga; \
+                    state[ 6] = X##ge; \
+                } \
+                else { \
+                    state[ 4] = X##bu; \
+                    output[ 4] = X##bu; \
+                    state[ 5] = X##ga; \
+                    output[ 5] = X##ga; \
+                    state[ 6] = X##ge; \
+                    if (laneCount >= 7) { \
+                        output[ 6] = X##ge; \
+                    } \
+                } \
+            } \
+            state[ 7] = X##gi; \
+            state[ 8] = X##go; \
+            state[ 9] = X##gu; \
+            state[10] = X##ka; \
+            state[11] = X##ke; \
+            state[12] = X##ki; \
+            state[13] = X##ko; \
+            state[14] = X##ku; \
+        } \
+        else { \
+            state[ 0] = X##ba; \
+            output[ 0] = X##ba; \
+            state[ 1] = X##be; \
+            output[ 1] = X##be; \
+            state[ 2] = X##bi; \
+            output[ 2] = X##bi; \
+            state[ 3] = X##bo; \
+            output[ 3] = X##bo; \
+            state[ 4] = X##bu; \
+            output[ 4] = X##bu; \
+            state[ 5] = X##ga; \
+            output[ 5] = X##ga; \
+            state[ 6] = X##ge; \
+            output[ 6] = X##ge; \
+            state[ 7] = X##gi; \
+            output[ 7] = X##gi; \
+            if (laneCount < 12) { \
+                if (laneCount < 10) { \
+                    state[ 8] = X##go; \
+                    if (laneCount >= 9) { \
+                        output[ 8] = X##go; \
+                    } \
+                    state[ 9] = X##gu; \
+                    state[10] = X##ka; \
+                } \
+                else { \
+                    state[ 8] = X##go; \
+                    output[ 8] = X##go; \
+                    state[ 9] = X##gu; \
+                    output[ 9] = X##gu; \
+                    state[10] = X##ka; \
+                    if (laneCount >= 11) { \
+                        output[10] = X##ka; \
+                    } \
+                } \
+                state[11] = X##ke; \
+                state[12] = X##ki; \
+                state[13] = X##ko; \
+                state[14] = X##ku; \
+            } \
+            else { \
+                state[ 8] = X##go; \
+                output[ 8] = X##go; \
+                state[ 9] = X##gu; \
+                output[ 9] = X##gu; \
+                state[10] = X##ka; \
+                output[10] = X##ka; \
+                state[11] = X##ke; \
+                output[11] = X##ke; \
+                if (laneCount < 14) { \
+                    state[12] = X##ki; \
+                    if (laneCount >= 13) { \
+                        output[12]= X##ki; \
+                    } \
+                    state[13] = X##ko; \
+                    state[14] = X##ku; \
+                } \
+                else { \
+                    state[12] = X##ki; \
+                    output[12]= X##ki; \
+                    state[13] = X##ko; \
+                    output[13] = X##ko; \
+                    state[14] = X##ku; \
+                    if (laneCount >= 15) { \
+                        output[14] = X##ku; \
+                    } \
+                } \
+            } \
+        } \
+        state[15] = X##ma; \
+        state[16] = X##me; \
+        state[17] = X##mi; \
+        state[18] = X##mo; \
+        state[19] = X##mu; \
+        state[20] = X##sa; \
+        state[21] = X##se; \
+        state[22] = X##si; \
+        state[23] = X##so; \
+        state[24] = X##su; \
+    } \
+    else { \
+        state[ 0] = X##ba; \
+        output[ 0] = X##ba; \
+        state[ 1] = X##be; \
+        output[ 1] = X##be; \
+        state[ 2] = X##bi; \
+        output[ 2] = X##bi; \
+        state[ 3] = X##bo; \
+        output[ 3] = X##bo; \
+        state[ 4] = X##bu; \
+        output[ 4] = X##bu; \
+        state[ 5] = X##ga; \
+        output[ 5] = X##ga; \
+        state[ 6] = X##ge; \
+        output[ 6] = X##ge; \
+        state[ 7] = X##gi; \
+        output[ 7] = X##gi; \
+        state[ 8] = X##go; \
+        output[ 8] = X##go; \
+        state[ 9] = X##gu; \
+        output[ 9] = X##gu; \
+        state[10] = X##ka; \
+        output[10] = X##ka; \
+        state[11] = X##ke; \
+        output[11] = X##ke; \
+        state[12] = X##ki; \
+        output[12]= X##ki; \
+        state[13] = X##ko; \
+        output[13] = X##ko; \
+        state[14] = X##ku; \
+        output[14] = X##ku; \
+        state[15] = X##ma; \
+        output[15] = X##ma; \
+        if (laneCount < 24) { \
+            if (laneCount < 20) { \
+                if (laneCount < 18) { \
+                    state[16] = X##me; \


More information about the pypy-commit mailing list