"Fossies" - the Fresh Open Source Software Archive

Member "src/Crypto/Camellia.c" (10 Oct 2018, 124987 Bytes) of package /windows/misc/VeraCrypt_1.23-Hotfix-2_Source.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "Camellia.c" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 1.20_Source_vs_1.21_Source.

    1 #include "Camellia.h"
    2 #include "Common/Endian.h"
    3 #include "Crypto/cpu.h"
    4 #include "Crypto/misc.h"
    5 
    6 #if CRYPTOPP_BOOL_X64
    7 
    8 /* camellia.c ver 1.2.0-x86_64_asm1.1
    9  *
   10  * Copyright (c) 2006,2007
   11  * NTT (Nippon Telegraph and Telephone Corporation) . All rights reserved.
   12  *
   13  * SuperCop integration:
   14  * Copyright  2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
   15  *
   16  * VeraCrypt integration:
   17  * Copyright  2017 Mounir IDRASSI <mounir.idrassi@idrix.fr>
   18  *
   19  * Redistribution and use in source and binary forms, with or without
   20  * modification, are permitted provided that the following conditions
   21  * are met:
   22  * 1. Redistributions of source code must retain the above copyright
   23  *   notice, this list of conditions and the following disclaimer as
   24  *   the first lines of this file unmodified.
   25  * 2. Redistributions in binary form must reproduce the above copyright
   26  *   notice, this list of conditions and the following disclaimer in the
   27  *   documentation and/or other materials provided with the distribution.
   28  *
   29  * THIS SOFTWARE IS PROVIDED BY NTT ``AS IS'' AND ANY EXPRESS OR
   30  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   31  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   32  * IN NO EVENT SHALL NTT BE LIABLE FOR ANY DIRECT, INDIRECT,
   33  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   34  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   35  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   36  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   37  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   38  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   39  */
   40 
   41 /*
   42  * Algorithm Specification
   43  *  http://info.isl.ntt.co.jp/crypt/eng/camellia/specifications.html
   44  */
   45 
   46 /* Adapted for VeraCrypt */
   47 
   48 #include "Common/Crypto.h"
   49 
   50 #ifndef _WIN32
   51 extern int IsAesHwCpuSupported ();
   52 #endif
   53 
   54 void camellia_encrypt_asm(const byte *ctx, void *dst, const void *src);
   55 void camellia_decrypt_asm(const byte *ctx, void *dst, const void *src);
   56 void camellia_enc_blk2(const byte *ctx, byte *dst, const byte *src);
   57 void camellia_dec_blk2(const byte *ctx, byte *dst, const byte *src);
   58 void camellia_ecb_enc_16way(const byte *ctx, byte *dst, const byte *src);
   59 void camellia_ecb_dec_16way(const byte *ctx, byte *dst, const byte *src);
   60 
   61 /* key constants */
   62 
   63 #define CAMELLIA_SIGMA1L (0xA09E667FL)
   64 #define CAMELLIA_SIGMA1R (0x3BCC908BL)
   65 #define CAMELLIA_SIGMA2L (0xB67AE858L)
   66 #define CAMELLIA_SIGMA2R (0x4CAA73B2L)
   67 #define CAMELLIA_SIGMA3L (0xC6EF372FL)
   68 #define CAMELLIA_SIGMA3R (0xE94F82BEL)
   69 #define CAMELLIA_SIGMA4L (0x54FF53A5L)
   70 #define CAMELLIA_SIGMA4R (0xF1D36F1CL)
   71 #define CAMELLIA_SIGMA5L (0x10E527FAL)
   72 #define CAMELLIA_SIGMA5R (0xDE682D1DL)
   73 #define CAMELLIA_SIGMA6L (0xB05688C2L)
   74 #define CAMELLIA_SIGMA6R (0xB3E6C1FDL)
   75 
   76 /*
   77  *  macros
   78  */
   79 
   80 
   81 # define GETU32(p) bswap_32(*((uint32 *)(p)))
   82 # define PUTU32(ct, st) {*((uint32 *)(ct)) = bswap_32((st));}
   83 
   84 #define CamelliaSubkeyL(INDEX) (subkey[(INDEX)*2])
   85 #define CamelliaSubkeyR(INDEX) (subkey[(INDEX)*2 + 1])
   86 
   87 /* rotation right shift 1byte */
   88 #define CAMELLIA_RR8(x) (((x) >> 8) + ((x) << 24))
   89 /* rotation left shift 1bit */
   90 #define CAMELLIA_RL1(x) (((x) << 1) + ((x) >> 31))
   91 /* rotation left shift 1byte */
   92 #define CAMELLIA_RL8(x) (((x) << 8) + ((x) >> 24))
   93 
   94 #define CAMELLIA_ROLDQ(ll, lr, rl, rr, w0, w1, bits)    \
   95     do {                        \
   96     w0 = ll;                    \
   97     ll = (ll << bits) + (lr >> (32 - bits));    \
   98     lr = (lr << bits) + (rl >> (32 - bits));    \
   99     rl = (rl << bits) + (rr >> (32 - bits));    \
  100     rr = (rr << bits) + (w0 >> (32 - bits));    \
  101     } while(0)
  102 
  103 #define CAMELLIA_ROLDQo32(ll, lr, rl, rr, w0, w1, bits) \
  104     do {                        \
  105     w0 = ll;                    \
  106     w1 = lr;                    \
  107     ll = (lr << (bits - 32)) + (rl >> (64 - bits)); \
  108     lr = (rl << (bits - 32)) + (rr >> (64 - bits)); \
  109     rl = (rr << (bits - 32)) + (w0 >> (64 - bits)); \
  110     rr = (w0 << (bits - 32)) + (w1 >> (64 - bits)); \
  111     } while(0)
  112 
  113 #define CAMELLIA_SP11101110(INDEX) (camellia_sp11101110[(INDEX)])
  114 #define CAMELLIA_SP02220222(INDEX) (camellia_sp02220222[(INDEX)])
  115 #define CAMELLIA_SP30333033(INDEX) (camellia_sp30333033[(INDEX)])
  116 #define CAMELLIA_SP44044404(INDEX) (camellia_sp44044404[(INDEX)])
  117 
  118 #define CAMELLIA_SP10011110(INDEX) (camellia_sp10011110[(INDEX)])
  119 #define CAMELLIA_SP22000222(INDEX) (camellia_sp22000222[(INDEX)])
  120 #define CAMELLIA_SP03303033(INDEX) (camellia_sp03303033[(INDEX)])
  121 #define CAMELLIA_SP00444404(INDEX) (camellia_sp00444404[(INDEX)])
  122 
  123 #define CAMELLIA_F(xl, xr, kl, kr, yl, yr, il, ir, t0, t1)  \
  124     do {                            \
  125     uint64 __tmp;                       \
  126     il = xl ^ kl;                       \
  127     ir = xr ^ kr;                       \
  128     t0 = il >> 16;                      \
  129     t1 = ir >> 16;                      \
  130     __tmp = CAMELLIA_SP11101110(ir & 0xff)          \
  131         ^ CAMELLIA_SP02220222((t1 >> 8) & 0xff)     \
  132         ^ CAMELLIA_SP30333033(t1 & 0xff)            \
  133         ^ CAMELLIA_SP44044404((ir >> 8) & 0xff)     \
  134         ^ CAMELLIA_SP10011110((t0 >> 8) & 0xff)     \
  135         ^ CAMELLIA_SP22000222(t0 & 0xff)            \
  136         ^ CAMELLIA_SP03303033((il >> 8) & 0xff)     \
  137         ^ CAMELLIA_SP00444404(il & 0xff);           \
  138     yl = (uint32) __tmp;                        \
  139     yr = (uint32) (__tmp >> 32);                    \
  140     } while(0)
  141 
  142 const uint64 camellia_sp10011110[256] = {
  143     0x7000007070707000ULL, 0x8200008282828200ULL, 0x2c00002c2c2c2c00ULL,
  144     0xec0000ecececec00ULL, 0xb30000b3b3b3b300ULL, 0x2700002727272700ULL,
  145     0xc00000c0c0c0c000ULL, 0xe50000e5e5e5e500ULL, 0xe40000e4e4e4e400ULL,
  146     0x8500008585858500ULL, 0x5700005757575700ULL, 0x3500003535353500ULL,
  147     0xea0000eaeaeaea00ULL, 0x0c00000c0c0c0c00ULL, 0xae0000aeaeaeae00ULL,
  148     0x4100004141414100ULL, 0x2300002323232300ULL, 0xef0000efefefef00ULL,
  149     0x6b00006b6b6b6b00ULL, 0x9300009393939300ULL, 0x4500004545454500ULL,
  150     0x1900001919191900ULL, 0xa50000a5a5a5a500ULL, 0x2100002121212100ULL,
  151     0xed0000edededed00ULL, 0x0e00000e0e0e0e00ULL, 0x4f00004f4f4f4f00ULL,
  152     0x4e00004e4e4e4e00ULL, 0x1d00001d1d1d1d00ULL, 0x6500006565656500ULL,
  153     0x9200009292929200ULL, 0xbd0000bdbdbdbd00ULL, 0x8600008686868600ULL,
  154     0xb80000b8b8b8b800ULL, 0xaf0000afafafaf00ULL, 0x8f00008f8f8f8f00ULL,
  155     0x7c00007c7c7c7c00ULL, 0xeb0000ebebebeb00ULL, 0x1f00001f1f1f1f00ULL,
  156     0xce0000cececece00ULL, 0x3e00003e3e3e3e00ULL, 0x3000003030303000ULL,
  157     0xdc0000dcdcdcdc00ULL, 0x5f00005f5f5f5f00ULL, 0x5e00005e5e5e5e00ULL,
  158     0xc50000c5c5c5c500ULL, 0x0b00000b0b0b0b00ULL, 0x1a00001a1a1a1a00ULL,
  159     0xa60000a6a6a6a600ULL, 0xe10000e1e1e1e100ULL, 0x3900003939393900ULL,
  160     0xca0000cacacaca00ULL, 0xd50000d5d5d5d500ULL, 0x4700004747474700ULL,
  161     0x5d00005d5d5d5d00ULL, 0x3d00003d3d3d3d00ULL, 0xd90000d9d9d9d900ULL,
  162     0x0100000101010100ULL, 0x5a00005a5a5a5a00ULL, 0xd60000d6d6d6d600ULL,
  163     0x5100005151515100ULL, 0x5600005656565600ULL, 0x6c00006c6c6c6c00ULL,
  164     0x4d00004d4d4d4d00ULL, 0x8b00008b8b8b8b00ULL, 0x0d00000d0d0d0d00ULL,
  165     0x9a00009a9a9a9a00ULL, 0x6600006666666600ULL, 0xfb0000fbfbfbfb00ULL,
  166     0xcc0000cccccccc00ULL, 0xb00000b0b0b0b000ULL, 0x2d00002d2d2d2d00ULL,
  167     0x7400007474747400ULL, 0x1200001212121200ULL, 0x2b00002b2b2b2b00ULL,
  168     0x2000002020202000ULL, 0xf00000f0f0f0f000ULL, 0xb10000b1b1b1b100ULL,
  169     0x8400008484848400ULL, 0x9900009999999900ULL, 0xdf0000dfdfdfdf00ULL,
  170     0x4c00004c4c4c4c00ULL, 0xcb0000cbcbcbcb00ULL, 0xc20000c2c2c2c200ULL,
  171     0x3400003434343400ULL, 0x7e00007e7e7e7e00ULL, 0x7600007676767600ULL,
  172     0x0500000505050500ULL, 0x6d00006d6d6d6d00ULL, 0xb70000b7b7b7b700ULL,
  173     0xa90000a9a9a9a900ULL, 0x3100003131313100ULL, 0xd10000d1d1d1d100ULL,
  174     0x1700001717171700ULL, 0x0400000404040400ULL, 0xd70000d7d7d7d700ULL,
  175     0x1400001414141400ULL, 0x5800005858585800ULL, 0x3a00003a3a3a3a00ULL,
  176     0x6100006161616100ULL, 0xde0000dededede00ULL, 0x1b00001b1b1b1b00ULL,
  177     0x1100001111111100ULL, 0x1c00001c1c1c1c00ULL, 0x3200003232323200ULL,
  178     0x0f00000f0f0f0f00ULL, 0x9c00009c9c9c9c00ULL, 0x1600001616161600ULL,
  179     0x5300005353535300ULL, 0x1800001818181800ULL, 0xf20000f2f2f2f200ULL,
  180     0x2200002222222200ULL, 0xfe0000fefefefe00ULL, 0x4400004444444400ULL,
  181     0xcf0000cfcfcfcf00ULL, 0xb20000b2b2b2b200ULL, 0xc30000c3c3c3c300ULL,
  182     0xb50000b5b5b5b500ULL, 0x7a00007a7a7a7a00ULL, 0x9100009191919100ULL,
  183     0x2400002424242400ULL, 0x0800000808080800ULL, 0xe80000e8e8e8e800ULL,
  184     0xa80000a8a8a8a800ULL, 0x6000006060606000ULL, 0xfc0000fcfcfcfc00ULL,
  185     0x6900006969696900ULL, 0x5000005050505000ULL, 0xaa0000aaaaaaaa00ULL,
  186     0xd00000d0d0d0d000ULL, 0xa00000a0a0a0a000ULL, 0x7d00007d7d7d7d00ULL,
  187     0xa10000a1a1a1a100ULL, 0x8900008989898900ULL, 0x6200006262626200ULL,
  188     0x9700009797979700ULL, 0x5400005454545400ULL, 0x5b00005b5b5b5b00ULL,
  189     0x1e00001e1e1e1e00ULL, 0x9500009595959500ULL, 0xe00000e0e0e0e000ULL,
  190     0xff0000ffffffff00ULL, 0x6400006464646400ULL, 0xd20000d2d2d2d200ULL,
  191     0x1000001010101000ULL, 0xc40000c4c4c4c400ULL, 0x0000000000000000ULL,
  192     0x4800004848484800ULL, 0xa30000a3a3a3a300ULL, 0xf70000f7f7f7f700ULL,
  193     0x7500007575757500ULL, 0xdb0000dbdbdbdb00ULL, 0x8a00008a8a8a8a00ULL,
  194     0x0300000303030300ULL, 0xe60000e6e6e6e600ULL, 0xda0000dadadada00ULL,
  195     0x0900000909090900ULL, 0x3f00003f3f3f3f00ULL, 0xdd0000dddddddd00ULL,
  196     0x9400009494949400ULL, 0x8700008787878700ULL, 0x5c00005c5c5c5c00ULL,
  197     0x8300008383838300ULL, 0x0200000202020200ULL, 0xcd0000cdcdcdcd00ULL,
  198     0x4a00004a4a4a4a00ULL, 0x9000009090909000ULL, 0x3300003333333300ULL,
  199     0x7300007373737300ULL, 0x6700006767676700ULL, 0xf60000f6f6f6f600ULL,
  200     0xf30000f3f3f3f300ULL, 0x9d00009d9d9d9d00ULL, 0x7f00007f7f7f7f00ULL,
  201     0xbf0000bfbfbfbf00ULL, 0xe20000e2e2e2e200ULL, 0x5200005252525200ULL,
  202     0x9b00009b9b9b9b00ULL, 0xd80000d8d8d8d800ULL, 0x2600002626262600ULL,
  203     0xc80000c8c8c8c800ULL, 0x3700003737373700ULL, 0xc60000c6c6c6c600ULL,
  204     0x3b00003b3b3b3b00ULL, 0x8100008181818100ULL, 0x9600009696969600ULL,
  205     0x6f00006f6f6f6f00ULL, 0x4b00004b4b4b4b00ULL, 0x1300001313131300ULL,
  206     0xbe0000bebebebe00ULL, 0x6300006363636300ULL, 0x2e00002e2e2e2e00ULL,
  207     0xe90000e9e9e9e900ULL, 0x7900007979797900ULL, 0xa70000a7a7a7a700ULL,
  208     0x8c00008c8c8c8c00ULL, 0x9f00009f9f9f9f00ULL, 0x6e00006e6e6e6e00ULL,
  209     0xbc0000bcbcbcbc00ULL, 0x8e00008e8e8e8e00ULL, 0x2900002929292900ULL,
  210     0xf50000f5f5f5f500ULL, 0xf90000f9f9f9f900ULL, 0xb60000b6b6b6b600ULL,
  211     0x2f00002f2f2f2f00ULL, 0xfd0000fdfdfdfd00ULL, 0xb40000b4b4b4b400ULL,
  212     0x5900005959595900ULL, 0x7800007878787800ULL, 0x9800009898989800ULL,
  213     0x0600000606060600ULL, 0x6a00006a6a6a6a00ULL, 0xe70000e7e7e7e700ULL,
  214     0x4600004646464600ULL, 0x7100007171717100ULL, 0xba0000babababa00ULL,
  215     0xd40000d4d4d4d400ULL, 0x2500002525252500ULL, 0xab0000abababab00ULL,
  216     0x4200004242424200ULL, 0x8800008888888800ULL, 0xa20000a2a2a2a200ULL,
  217     0x8d00008d8d8d8d00ULL, 0xfa0000fafafafa00ULL, 0x7200007272727200ULL,
  218     0x0700000707070700ULL, 0xb90000b9b9b9b900ULL, 0x5500005555555500ULL,
  219     0xf80000f8f8f8f800ULL, 0xee0000eeeeeeee00ULL, 0xac0000acacacac00ULL,
  220     0x0a00000a0a0a0a00ULL, 0x3600003636363600ULL, 0x4900004949494900ULL,
  221     0x2a00002a2a2a2a00ULL, 0x6800006868686800ULL, 0x3c00003c3c3c3c00ULL,
  222     0x3800003838383800ULL, 0xf10000f1f1f1f100ULL, 0xa40000a4a4a4a400ULL,
  223     0x4000004040404000ULL, 0x2800002828282800ULL, 0xd30000d3d3d3d300ULL,
  224     0x7b00007b7b7b7b00ULL, 0xbb0000bbbbbbbb00ULL, 0xc90000c9c9c9c900ULL,
  225     0x4300004343434300ULL, 0xc10000c1c1c1c100ULL, 0x1500001515151500ULL,
  226     0xe30000e3e3e3e300ULL, 0xad0000adadadad00ULL, 0xf40000f4f4f4f400ULL,
  227     0x7700007777777700ULL, 0xc70000c7c7c7c700ULL, 0x8000008080808000ULL,
  228     0x9e00009e9e9e9e00ULL,
  229 };
  230 
  231 const uint64 camellia_sp22000222[256] = {
  232     0xe0e0000000e0e0e0ULL, 0x0505000000050505ULL, 0x5858000000585858ULL,
  233     0xd9d9000000d9d9d9ULL, 0x6767000000676767ULL, 0x4e4e0000004e4e4eULL,
  234     0x8181000000818181ULL, 0xcbcb000000cbcbcbULL, 0xc9c9000000c9c9c9ULL,
  235     0x0b0b0000000b0b0bULL, 0xaeae000000aeaeaeULL, 0x6a6a0000006a6a6aULL,
  236     0xd5d5000000d5d5d5ULL, 0x1818000000181818ULL, 0x5d5d0000005d5d5dULL,
  237     0x8282000000828282ULL, 0x4646000000464646ULL, 0xdfdf000000dfdfdfULL,
  238     0xd6d6000000d6d6d6ULL, 0x2727000000272727ULL, 0x8a8a0000008a8a8aULL,
  239     0x3232000000323232ULL, 0x4b4b0000004b4b4bULL, 0x4242000000424242ULL,
  240     0xdbdb000000dbdbdbULL, 0x1c1c0000001c1c1cULL, 0x9e9e0000009e9e9eULL,
  241     0x9c9c0000009c9c9cULL, 0x3a3a0000003a3a3aULL, 0xcaca000000cacacaULL,
  242     0x2525000000252525ULL, 0x7b7b0000007b7b7bULL, 0x0d0d0000000d0d0dULL,
  243     0x7171000000717171ULL, 0x5f5f0000005f5f5fULL, 0x1f1f0000001f1f1fULL,
  244     0xf8f8000000f8f8f8ULL, 0xd7d7000000d7d7d7ULL, 0x3e3e0000003e3e3eULL,
  245     0x9d9d0000009d9d9dULL, 0x7c7c0000007c7c7cULL, 0x6060000000606060ULL,
  246     0xb9b9000000b9b9b9ULL, 0xbebe000000bebebeULL, 0xbcbc000000bcbcbcULL,
  247     0x8b8b0000008b8b8bULL, 0x1616000000161616ULL, 0x3434000000343434ULL,
  248     0x4d4d0000004d4d4dULL, 0xc3c3000000c3c3c3ULL, 0x7272000000727272ULL,
  249     0x9595000000959595ULL, 0xabab000000abababULL, 0x8e8e0000008e8e8eULL,
  250     0xbaba000000bababaULL, 0x7a7a0000007a7a7aULL, 0xb3b3000000b3b3b3ULL,
  251     0x0202000000020202ULL, 0xb4b4000000b4b4b4ULL, 0xadad000000adadadULL,
  252     0xa2a2000000a2a2a2ULL, 0xacac000000acacacULL, 0xd8d8000000d8d8d8ULL,
  253     0x9a9a0000009a9a9aULL, 0x1717000000171717ULL, 0x1a1a0000001a1a1aULL,
  254     0x3535000000353535ULL, 0xcccc000000ccccccULL, 0xf7f7000000f7f7f7ULL,
  255     0x9999000000999999ULL, 0x6161000000616161ULL, 0x5a5a0000005a5a5aULL,
  256     0xe8e8000000e8e8e8ULL, 0x2424000000242424ULL, 0x5656000000565656ULL,
  257     0x4040000000404040ULL, 0xe1e1000000e1e1e1ULL, 0x6363000000636363ULL,
  258     0x0909000000090909ULL, 0x3333000000333333ULL, 0xbfbf000000bfbfbfULL,
  259     0x9898000000989898ULL, 0x9797000000979797ULL, 0x8585000000858585ULL,
  260     0x6868000000686868ULL, 0xfcfc000000fcfcfcULL, 0xecec000000ecececULL,
  261     0x0a0a0000000a0a0aULL, 0xdada000000dadadaULL, 0x6f6f0000006f6f6fULL,
  262     0x5353000000535353ULL, 0x6262000000626262ULL, 0xa3a3000000a3a3a3ULL,
  263     0x2e2e0000002e2e2eULL, 0x0808000000080808ULL, 0xafaf000000afafafULL,
  264     0x2828000000282828ULL, 0xb0b0000000b0b0b0ULL, 0x7474000000747474ULL,
  265     0xc2c2000000c2c2c2ULL, 0xbdbd000000bdbdbdULL, 0x3636000000363636ULL,
  266     0x2222000000222222ULL, 0x3838000000383838ULL, 0x6464000000646464ULL,
  267     0x1e1e0000001e1e1eULL, 0x3939000000393939ULL, 0x2c2c0000002c2c2cULL,
  268     0xa6a6000000a6a6a6ULL, 0x3030000000303030ULL, 0xe5e5000000e5e5e5ULL,
  269     0x4444000000444444ULL, 0xfdfd000000fdfdfdULL, 0x8888000000888888ULL,
  270     0x9f9f0000009f9f9fULL, 0x6565000000656565ULL, 0x8787000000878787ULL,
  271     0x6b6b0000006b6b6bULL, 0xf4f4000000f4f4f4ULL, 0x2323000000232323ULL,
  272     0x4848000000484848ULL, 0x1010000000101010ULL, 0xd1d1000000d1d1d1ULL,
  273     0x5151000000515151ULL, 0xc0c0000000c0c0c0ULL, 0xf9f9000000f9f9f9ULL,
  274     0xd2d2000000d2d2d2ULL, 0xa0a0000000a0a0a0ULL, 0x5555000000555555ULL,
  275     0xa1a1000000a1a1a1ULL, 0x4141000000414141ULL, 0xfafa000000fafafaULL,
  276     0x4343000000434343ULL, 0x1313000000131313ULL, 0xc4c4000000c4c4c4ULL,
  277     0x2f2f0000002f2f2fULL, 0xa8a8000000a8a8a8ULL, 0xb6b6000000b6b6b6ULL,
  278     0x3c3c0000003c3c3cULL, 0x2b2b0000002b2b2bULL, 0xc1c1000000c1c1c1ULL,
  279     0xffff000000ffffffULL, 0xc8c8000000c8c8c8ULL, 0xa5a5000000a5a5a5ULL,
  280     0x2020000000202020ULL, 0x8989000000898989ULL, 0x0000000000000000ULL,
  281     0x9090000000909090ULL, 0x4747000000474747ULL, 0xefef000000efefefULL,
  282     0xeaea000000eaeaeaULL, 0xb7b7000000b7b7b7ULL, 0x1515000000151515ULL,
  283     0x0606000000060606ULL, 0xcdcd000000cdcdcdULL, 0xb5b5000000b5b5b5ULL,
  284     0x1212000000121212ULL, 0x7e7e0000007e7e7eULL, 0xbbbb000000bbbbbbULL,
  285     0x2929000000292929ULL, 0x0f0f0000000f0f0fULL, 0xb8b8000000b8b8b8ULL,
  286     0x0707000000070707ULL, 0x0404000000040404ULL, 0x9b9b0000009b9b9bULL,
  287     0x9494000000949494ULL, 0x2121000000212121ULL, 0x6666000000666666ULL,
  288     0xe6e6000000e6e6e6ULL, 0xcece000000cececeULL, 0xeded000000edededULL,
  289     0xe7e7000000e7e7e7ULL, 0x3b3b0000003b3b3bULL, 0xfefe000000fefefeULL,
  290     0x7f7f0000007f7f7fULL, 0xc5c5000000c5c5c5ULL, 0xa4a4000000a4a4a4ULL,
  291     0x3737000000373737ULL, 0xb1b1000000b1b1b1ULL, 0x4c4c0000004c4c4cULL,
  292     0x9191000000919191ULL, 0x6e6e0000006e6e6eULL, 0x8d8d0000008d8d8dULL,
  293     0x7676000000767676ULL, 0x0303000000030303ULL, 0x2d2d0000002d2d2dULL,
  294     0xdede000000dededeULL, 0x9696000000969696ULL, 0x2626000000262626ULL,
  295     0x7d7d0000007d7d7dULL, 0xc6c6000000c6c6c6ULL, 0x5c5c0000005c5c5cULL,
  296     0xd3d3000000d3d3d3ULL, 0xf2f2000000f2f2f2ULL, 0x4f4f0000004f4f4fULL,
  297     0x1919000000191919ULL, 0x3f3f0000003f3f3fULL, 0xdcdc000000dcdcdcULL,
  298     0x7979000000797979ULL, 0x1d1d0000001d1d1dULL, 0x5252000000525252ULL,
  299     0xebeb000000ebebebULL, 0xf3f3000000f3f3f3ULL, 0x6d6d0000006d6d6dULL,
  300     0x5e5e0000005e5e5eULL, 0xfbfb000000fbfbfbULL, 0x6969000000696969ULL,
  301     0xb2b2000000b2b2b2ULL, 0xf0f0000000f0f0f0ULL, 0x3131000000313131ULL,
  302     0x0c0c0000000c0c0cULL, 0xd4d4000000d4d4d4ULL, 0xcfcf000000cfcfcfULL,
  303     0x8c8c0000008c8c8cULL, 0xe2e2000000e2e2e2ULL, 0x7575000000757575ULL,
  304     0xa9a9000000a9a9a9ULL, 0x4a4a0000004a4a4aULL, 0x5757000000575757ULL,
  305     0x8484000000848484ULL, 0x1111000000111111ULL, 0x4545000000454545ULL,
  306     0x1b1b0000001b1b1bULL, 0xf5f5000000f5f5f5ULL, 0xe4e4000000e4e4e4ULL,
  307     0x0e0e0000000e0e0eULL, 0x7373000000737373ULL, 0xaaaa000000aaaaaaULL,
  308     0xf1f1000000f1f1f1ULL, 0xdddd000000ddddddULL, 0x5959000000595959ULL,
  309     0x1414000000141414ULL, 0x6c6c0000006c6c6cULL, 0x9292000000929292ULL,
  310     0x5454000000545454ULL, 0xd0d0000000d0d0d0ULL, 0x7878000000787878ULL,
  311     0x7070000000707070ULL, 0xe3e3000000e3e3e3ULL, 0x4949000000494949ULL,
  312     0x8080000000808080ULL, 0x5050000000505050ULL, 0xa7a7000000a7a7a7ULL,
  313     0xf6f6000000f6f6f6ULL, 0x7777000000777777ULL, 0x9393000000939393ULL,
  314     0x8686000000868686ULL, 0x8383000000838383ULL, 0x2a2a0000002a2a2aULL,
  315     0xc7c7000000c7c7c7ULL, 0x5b5b0000005b5b5bULL, 0xe9e9000000e9e9e9ULL,
  316     0xeeee000000eeeeeeULL, 0x8f8f0000008f8f8fULL, 0x0101000000010101ULL,
  317     0x3d3d0000003d3d3dULL,
  318 };
  319 
  320 const uint64 camellia_sp03303033[256] = {
  321     0x0038380038003838ULL, 0x0041410041004141ULL, 0x0016160016001616ULL,
  322     0x0076760076007676ULL, 0x00d9d900d900d9d9ULL, 0x0093930093009393ULL,
  323     0x0060600060006060ULL, 0x00f2f200f200f2f2ULL, 0x0072720072007272ULL,
  324     0x00c2c200c200c2c2ULL, 0x00abab00ab00ababULL, 0x009a9a009a009a9aULL,
  325     0x0075750075007575ULL, 0x0006060006000606ULL, 0x0057570057005757ULL,
  326     0x00a0a000a000a0a0ULL, 0x0091910091009191ULL, 0x00f7f700f700f7f7ULL,
  327     0x00b5b500b500b5b5ULL, 0x00c9c900c900c9c9ULL, 0x00a2a200a200a2a2ULL,
  328     0x008c8c008c008c8cULL, 0x00d2d200d200d2d2ULL, 0x0090900090009090ULL,
  329     0x00f6f600f600f6f6ULL, 0x0007070007000707ULL, 0x00a7a700a700a7a7ULL,
  330     0x0027270027002727ULL, 0x008e8e008e008e8eULL, 0x00b2b200b200b2b2ULL,
  331     0x0049490049004949ULL, 0x00dede00de00dedeULL, 0x0043430043004343ULL,
  332     0x005c5c005c005c5cULL, 0x00d7d700d700d7d7ULL, 0x00c7c700c700c7c7ULL,
  333     0x003e3e003e003e3eULL, 0x00f5f500f500f5f5ULL, 0x008f8f008f008f8fULL,
  334     0x0067670067006767ULL, 0x001f1f001f001f1fULL, 0x0018180018001818ULL,
  335     0x006e6e006e006e6eULL, 0x00afaf00af00afafULL, 0x002f2f002f002f2fULL,
  336     0x00e2e200e200e2e2ULL, 0x0085850085008585ULL, 0x000d0d000d000d0dULL,
  337     0x0053530053005353ULL, 0x00f0f000f000f0f0ULL, 0x009c9c009c009c9cULL,
  338     0x0065650065006565ULL, 0x00eaea00ea00eaeaULL, 0x00a3a300a300a3a3ULL,
  339     0x00aeae00ae00aeaeULL, 0x009e9e009e009e9eULL, 0x00ecec00ec00ececULL,
  340     0x0080800080008080ULL, 0x002d2d002d002d2dULL, 0x006b6b006b006b6bULL,
  341     0x00a8a800a800a8a8ULL, 0x002b2b002b002b2bULL, 0x0036360036003636ULL,
  342     0x00a6a600a600a6a6ULL, 0x00c5c500c500c5c5ULL, 0x0086860086008686ULL,
  343     0x004d4d004d004d4dULL, 0x0033330033003333ULL, 0x00fdfd00fd00fdfdULL,
  344     0x0066660066006666ULL, 0x0058580058005858ULL, 0x0096960096009696ULL,
  345     0x003a3a003a003a3aULL, 0x0009090009000909ULL, 0x0095950095009595ULL,
  346     0x0010100010001010ULL, 0x0078780078007878ULL, 0x00d8d800d800d8d8ULL,
  347     0x0042420042004242ULL, 0x00cccc00cc00ccccULL, 0x00efef00ef00efefULL,
  348     0x0026260026002626ULL, 0x00e5e500e500e5e5ULL, 0x0061610061006161ULL,
  349     0x001a1a001a001a1aULL, 0x003f3f003f003f3fULL, 0x003b3b003b003b3bULL,
  350     0x0082820082008282ULL, 0x00b6b600b600b6b6ULL, 0x00dbdb00db00dbdbULL,
  351     0x00d4d400d400d4d4ULL, 0x0098980098009898ULL, 0x00e8e800e800e8e8ULL,
  352     0x008b8b008b008b8bULL, 0x0002020002000202ULL, 0x00ebeb00eb00ebebULL,
  353     0x000a0a000a000a0aULL, 0x002c2c002c002c2cULL, 0x001d1d001d001d1dULL,
  354     0x00b0b000b000b0b0ULL, 0x006f6f006f006f6fULL, 0x008d8d008d008d8dULL,
  355     0x0088880088008888ULL, 0x000e0e000e000e0eULL, 0x0019190019001919ULL,
  356     0x0087870087008787ULL, 0x004e4e004e004e4eULL, 0x000b0b000b000b0bULL,
  357     0x00a9a900a900a9a9ULL, 0x000c0c000c000c0cULL, 0x0079790079007979ULL,
  358     0x0011110011001111ULL, 0x007f7f007f007f7fULL, 0x0022220022002222ULL,
  359     0x00e7e700e700e7e7ULL, 0x0059590059005959ULL, 0x00e1e100e100e1e1ULL,
  360     0x00dada00da00dadaULL, 0x003d3d003d003d3dULL, 0x00c8c800c800c8c8ULL,
  361     0x0012120012001212ULL, 0x0004040004000404ULL, 0x0074740074007474ULL,
  362     0x0054540054005454ULL, 0x0030300030003030ULL, 0x007e7e007e007e7eULL,
  363     0x00b4b400b400b4b4ULL, 0x0028280028002828ULL, 0x0055550055005555ULL,
  364     0x0068680068006868ULL, 0x0050500050005050ULL, 0x00bebe00be00bebeULL,
  365     0x00d0d000d000d0d0ULL, 0x00c4c400c400c4c4ULL, 0x0031310031003131ULL,
  366     0x00cbcb00cb00cbcbULL, 0x002a2a002a002a2aULL, 0x00adad00ad00adadULL,
  367     0x000f0f000f000f0fULL, 0x00caca00ca00cacaULL, 0x0070700070007070ULL,
  368     0x00ffff00ff00ffffULL, 0x0032320032003232ULL, 0x0069690069006969ULL,
  369     0x0008080008000808ULL, 0x0062620062006262ULL, 0x0000000000000000ULL,
  370     0x0024240024002424ULL, 0x00d1d100d100d1d1ULL, 0x00fbfb00fb00fbfbULL,
  371     0x00baba00ba00babaULL, 0x00eded00ed00ededULL, 0x0045450045004545ULL,
  372     0x0081810081008181ULL, 0x0073730073007373ULL, 0x006d6d006d006d6dULL,
  373     0x0084840084008484ULL, 0x009f9f009f009f9fULL, 0x00eeee00ee00eeeeULL,
  374     0x004a4a004a004a4aULL, 0x00c3c300c300c3c3ULL, 0x002e2e002e002e2eULL,
  375     0x00c1c100c100c1c1ULL, 0x0001010001000101ULL, 0x00e6e600e600e6e6ULL,
  376     0x0025250025002525ULL, 0x0048480048004848ULL, 0x0099990099009999ULL,
  377     0x00b9b900b900b9b9ULL, 0x00b3b300b300b3b3ULL, 0x007b7b007b007b7bULL,
  378     0x00f9f900f900f9f9ULL, 0x00cece00ce00ceceULL, 0x00bfbf00bf00bfbfULL,
  379     0x00dfdf00df00dfdfULL, 0x0071710071007171ULL, 0x0029290029002929ULL,
  380     0x00cdcd00cd00cdcdULL, 0x006c6c006c006c6cULL, 0x0013130013001313ULL,
  381     0x0064640064006464ULL, 0x009b9b009b009b9bULL, 0x0063630063006363ULL,
  382     0x009d9d009d009d9dULL, 0x00c0c000c000c0c0ULL, 0x004b4b004b004b4bULL,
  383     0x00b7b700b700b7b7ULL, 0x00a5a500a500a5a5ULL, 0x0089890089008989ULL,
  384     0x005f5f005f005f5fULL, 0x00b1b100b100b1b1ULL, 0x0017170017001717ULL,
  385     0x00f4f400f400f4f4ULL, 0x00bcbc00bc00bcbcULL, 0x00d3d300d300d3d3ULL,
  386     0x0046460046004646ULL, 0x00cfcf00cf00cfcfULL, 0x0037370037003737ULL,
  387     0x005e5e005e005e5eULL, 0x0047470047004747ULL, 0x0094940094009494ULL,
  388     0x00fafa00fa00fafaULL, 0x00fcfc00fc00fcfcULL, 0x005b5b005b005b5bULL,
  389     0x0097970097009797ULL, 0x00fefe00fe00fefeULL, 0x005a5a005a005a5aULL,
  390     0x00acac00ac00acacULL, 0x003c3c003c003c3cULL, 0x004c4c004c004c4cULL,
  391     0x0003030003000303ULL, 0x0035350035003535ULL, 0x00f3f300f300f3f3ULL,
  392     0x0023230023002323ULL, 0x00b8b800b800b8b8ULL, 0x005d5d005d005d5dULL,
  393     0x006a6a006a006a6aULL, 0x0092920092009292ULL, 0x00d5d500d500d5d5ULL,
  394     0x0021210021002121ULL, 0x0044440044004444ULL, 0x0051510051005151ULL,
  395     0x00c6c600c600c6c6ULL, 0x007d7d007d007d7dULL, 0x0039390039003939ULL,
  396     0x0083830083008383ULL, 0x00dcdc00dc00dcdcULL, 0x00aaaa00aa00aaaaULL,
  397     0x007c7c007c007c7cULL, 0x0077770077007777ULL, 0x0056560056005656ULL,
  398     0x0005050005000505ULL, 0x001b1b001b001b1bULL, 0x00a4a400a400a4a4ULL,
  399     0x0015150015001515ULL, 0x0034340034003434ULL, 0x001e1e001e001e1eULL,
  400     0x001c1c001c001c1cULL, 0x00f8f800f800f8f8ULL, 0x0052520052005252ULL,
  401     0x0020200020002020ULL, 0x0014140014001414ULL, 0x00e9e900e900e9e9ULL,
  402     0x00bdbd00bd00bdbdULL, 0x00dddd00dd00ddddULL, 0x00e4e400e400e4e4ULL,
  403     0x00a1a100a100a1a1ULL, 0x00e0e000e000e0e0ULL, 0x008a8a008a008a8aULL,
  404     0x00f1f100f100f1f1ULL, 0x00d6d600d600d6d6ULL, 0x007a7a007a007a7aULL,
  405     0x00bbbb00bb00bbbbULL, 0x00e3e300e300e3e3ULL, 0x0040400040004040ULL,
  406     0x004f4f004f004f4fULL,
  407 };
  408 
  409 const uint64 camellia_sp00444404[256] = {
  410     0x0000707070700070ULL, 0x00002c2c2c2c002cULL, 0x0000b3b3b3b300b3ULL,
  411     0x0000c0c0c0c000c0ULL, 0x0000e4e4e4e400e4ULL, 0x0000575757570057ULL,
  412     0x0000eaeaeaea00eaULL, 0x0000aeaeaeae00aeULL, 0x0000232323230023ULL,
  413     0x00006b6b6b6b006bULL, 0x0000454545450045ULL, 0x0000a5a5a5a500a5ULL,
  414     0x0000edededed00edULL, 0x00004f4f4f4f004fULL, 0x00001d1d1d1d001dULL,
  415     0x0000929292920092ULL, 0x0000868686860086ULL, 0x0000afafafaf00afULL,
  416     0x00007c7c7c7c007cULL, 0x00001f1f1f1f001fULL, 0x00003e3e3e3e003eULL,
  417     0x0000dcdcdcdc00dcULL, 0x00005e5e5e5e005eULL, 0x00000b0b0b0b000bULL,
  418     0x0000a6a6a6a600a6ULL, 0x0000393939390039ULL, 0x0000d5d5d5d500d5ULL,
  419     0x00005d5d5d5d005dULL, 0x0000d9d9d9d900d9ULL, 0x00005a5a5a5a005aULL,
  420     0x0000515151510051ULL, 0x00006c6c6c6c006cULL, 0x00008b8b8b8b008bULL,
  421     0x00009a9a9a9a009aULL, 0x0000fbfbfbfb00fbULL, 0x0000b0b0b0b000b0ULL,
  422     0x0000747474740074ULL, 0x00002b2b2b2b002bULL, 0x0000f0f0f0f000f0ULL,
  423     0x0000848484840084ULL, 0x0000dfdfdfdf00dfULL, 0x0000cbcbcbcb00cbULL,
  424     0x0000343434340034ULL, 0x0000767676760076ULL, 0x00006d6d6d6d006dULL,
  425     0x0000a9a9a9a900a9ULL, 0x0000d1d1d1d100d1ULL, 0x0000040404040004ULL,
  426     0x0000141414140014ULL, 0x00003a3a3a3a003aULL, 0x0000dededede00deULL,
  427     0x0000111111110011ULL, 0x0000323232320032ULL, 0x00009c9c9c9c009cULL,
  428     0x0000535353530053ULL, 0x0000f2f2f2f200f2ULL, 0x0000fefefefe00feULL,
  429     0x0000cfcfcfcf00cfULL, 0x0000c3c3c3c300c3ULL, 0x00007a7a7a7a007aULL,
  430     0x0000242424240024ULL, 0x0000e8e8e8e800e8ULL, 0x0000606060600060ULL,
  431     0x0000696969690069ULL, 0x0000aaaaaaaa00aaULL, 0x0000a0a0a0a000a0ULL,
  432     0x0000a1a1a1a100a1ULL, 0x0000626262620062ULL, 0x0000545454540054ULL,
  433     0x00001e1e1e1e001eULL, 0x0000e0e0e0e000e0ULL, 0x0000646464640064ULL,
  434     0x0000101010100010ULL, 0x0000000000000000ULL, 0x0000a3a3a3a300a3ULL,
  435     0x0000757575750075ULL, 0x00008a8a8a8a008aULL, 0x0000e6e6e6e600e6ULL,
  436     0x0000090909090009ULL, 0x0000dddddddd00ddULL, 0x0000878787870087ULL,
  437     0x0000838383830083ULL, 0x0000cdcdcdcd00cdULL, 0x0000909090900090ULL,
  438     0x0000737373730073ULL, 0x0000f6f6f6f600f6ULL, 0x00009d9d9d9d009dULL,
  439     0x0000bfbfbfbf00bfULL, 0x0000525252520052ULL, 0x0000d8d8d8d800d8ULL,
  440     0x0000c8c8c8c800c8ULL, 0x0000c6c6c6c600c6ULL, 0x0000818181810081ULL,
  441     0x00006f6f6f6f006fULL, 0x0000131313130013ULL, 0x0000636363630063ULL,
  442     0x0000e9e9e9e900e9ULL, 0x0000a7a7a7a700a7ULL, 0x00009f9f9f9f009fULL,
  443     0x0000bcbcbcbc00bcULL, 0x0000292929290029ULL, 0x0000f9f9f9f900f9ULL,
  444     0x00002f2f2f2f002fULL, 0x0000b4b4b4b400b4ULL, 0x0000787878780078ULL,
  445     0x0000060606060006ULL, 0x0000e7e7e7e700e7ULL, 0x0000717171710071ULL,
  446     0x0000d4d4d4d400d4ULL, 0x0000abababab00abULL, 0x0000888888880088ULL,
  447     0x00008d8d8d8d008dULL, 0x0000727272720072ULL, 0x0000b9b9b9b900b9ULL,
  448     0x0000f8f8f8f800f8ULL, 0x0000acacacac00acULL, 0x0000363636360036ULL,
  449     0x00002a2a2a2a002aULL, 0x00003c3c3c3c003cULL, 0x0000f1f1f1f100f1ULL,
  450     0x0000404040400040ULL, 0x0000d3d3d3d300d3ULL, 0x0000bbbbbbbb00bbULL,
  451     0x0000434343430043ULL, 0x0000151515150015ULL, 0x0000adadadad00adULL,
  452     0x0000777777770077ULL, 0x0000808080800080ULL, 0x0000828282820082ULL,
  453     0x0000ecececec00ecULL, 0x0000272727270027ULL, 0x0000e5e5e5e500e5ULL,
  454     0x0000858585850085ULL, 0x0000353535350035ULL, 0x00000c0c0c0c000cULL,
  455     0x0000414141410041ULL, 0x0000efefefef00efULL, 0x0000939393930093ULL,
  456     0x0000191919190019ULL, 0x0000212121210021ULL, 0x00000e0e0e0e000eULL,
  457     0x00004e4e4e4e004eULL, 0x0000656565650065ULL, 0x0000bdbdbdbd00bdULL,
  458     0x0000b8b8b8b800b8ULL, 0x00008f8f8f8f008fULL, 0x0000ebebebeb00ebULL,
  459     0x0000cececece00ceULL, 0x0000303030300030ULL, 0x00005f5f5f5f005fULL,
  460     0x0000c5c5c5c500c5ULL, 0x00001a1a1a1a001aULL, 0x0000e1e1e1e100e1ULL,
  461     0x0000cacacaca00caULL, 0x0000474747470047ULL, 0x00003d3d3d3d003dULL,
  462     0x0000010101010001ULL, 0x0000d6d6d6d600d6ULL, 0x0000565656560056ULL,
  463     0x00004d4d4d4d004dULL, 0x00000d0d0d0d000dULL, 0x0000666666660066ULL,
  464     0x0000cccccccc00ccULL, 0x00002d2d2d2d002dULL, 0x0000121212120012ULL,
  465     0x0000202020200020ULL, 0x0000b1b1b1b100b1ULL, 0x0000999999990099ULL,
  466     0x00004c4c4c4c004cULL, 0x0000c2c2c2c200c2ULL, 0x00007e7e7e7e007eULL,
  467     0x0000050505050005ULL, 0x0000b7b7b7b700b7ULL, 0x0000313131310031ULL,
  468     0x0000171717170017ULL, 0x0000d7d7d7d700d7ULL, 0x0000585858580058ULL,
  469     0x0000616161610061ULL, 0x00001b1b1b1b001bULL, 0x00001c1c1c1c001cULL,
  470     0x00000f0f0f0f000fULL, 0x0000161616160016ULL, 0x0000181818180018ULL,
  471     0x0000222222220022ULL, 0x0000444444440044ULL, 0x0000b2b2b2b200b2ULL,
  472     0x0000b5b5b5b500b5ULL, 0x0000919191910091ULL, 0x0000080808080008ULL,
  473     0x0000a8a8a8a800a8ULL, 0x0000fcfcfcfc00fcULL, 0x0000505050500050ULL,
  474     0x0000d0d0d0d000d0ULL, 0x00007d7d7d7d007dULL, 0x0000898989890089ULL,
  475     0x0000979797970097ULL, 0x00005b5b5b5b005bULL, 0x0000959595950095ULL,
  476     0x0000ffffffff00ffULL, 0x0000d2d2d2d200d2ULL, 0x0000c4c4c4c400c4ULL,
  477     0x0000484848480048ULL, 0x0000f7f7f7f700f7ULL, 0x0000dbdbdbdb00dbULL,
  478     0x0000030303030003ULL, 0x0000dadadada00daULL, 0x00003f3f3f3f003fULL,
  479     0x0000949494940094ULL, 0x00005c5c5c5c005cULL, 0x0000020202020002ULL,
  480     0x00004a4a4a4a004aULL, 0x0000333333330033ULL, 0x0000676767670067ULL,
  481     0x0000f3f3f3f300f3ULL, 0x00007f7f7f7f007fULL, 0x0000e2e2e2e200e2ULL,
  482     0x00009b9b9b9b009bULL, 0x0000262626260026ULL, 0x0000373737370037ULL,
  483     0x00003b3b3b3b003bULL, 0x0000969696960096ULL, 0x00004b4b4b4b004bULL,
  484     0x0000bebebebe00beULL, 0x00002e2e2e2e002eULL, 0x0000797979790079ULL,
  485     0x00008c8c8c8c008cULL, 0x00006e6e6e6e006eULL, 0x00008e8e8e8e008eULL,
  486     0x0000f5f5f5f500f5ULL, 0x0000b6b6b6b600b6ULL, 0x0000fdfdfdfd00fdULL,
  487     0x0000595959590059ULL, 0x0000989898980098ULL, 0x00006a6a6a6a006aULL,
  488     0x0000464646460046ULL, 0x0000babababa00baULL, 0x0000252525250025ULL,
  489     0x0000424242420042ULL, 0x0000a2a2a2a200a2ULL, 0x0000fafafafa00faULL,
  490     0x0000070707070007ULL, 0x0000555555550055ULL, 0x0000eeeeeeee00eeULL,
  491     0x00000a0a0a0a000aULL, 0x0000494949490049ULL, 0x0000686868680068ULL,
  492     0x0000383838380038ULL, 0x0000a4a4a4a400a4ULL, 0x0000282828280028ULL,
  493     0x00007b7b7b7b007bULL, 0x0000c9c9c9c900c9ULL, 0x0000c1c1c1c100c1ULL,
  494     0x0000e3e3e3e300e3ULL, 0x0000f4f4f4f400f4ULL, 0x0000c7c7c7c700c7ULL,
  495     0x00009e9e9e9e009eULL,
  496 };
  497 
  498 const uint64 camellia_sp02220222[256] = {
  499     0x00e0e0e000e0e0e0ULL, 0x0005050500050505ULL, 0x0058585800585858ULL,
  500     0x00d9d9d900d9d9d9ULL, 0x0067676700676767ULL, 0x004e4e4e004e4e4eULL,
  501     0x0081818100818181ULL, 0x00cbcbcb00cbcbcbULL, 0x00c9c9c900c9c9c9ULL,
  502     0x000b0b0b000b0b0bULL, 0x00aeaeae00aeaeaeULL, 0x006a6a6a006a6a6aULL,
  503     0x00d5d5d500d5d5d5ULL, 0x0018181800181818ULL, 0x005d5d5d005d5d5dULL,
  504     0x0082828200828282ULL, 0x0046464600464646ULL, 0x00dfdfdf00dfdfdfULL,
  505     0x00d6d6d600d6d6d6ULL, 0x0027272700272727ULL, 0x008a8a8a008a8a8aULL,
  506     0x0032323200323232ULL, 0x004b4b4b004b4b4bULL, 0x0042424200424242ULL,
  507     0x00dbdbdb00dbdbdbULL, 0x001c1c1c001c1c1cULL, 0x009e9e9e009e9e9eULL,
  508     0x009c9c9c009c9c9cULL, 0x003a3a3a003a3a3aULL, 0x00cacaca00cacacaULL,
  509     0x0025252500252525ULL, 0x007b7b7b007b7b7bULL, 0x000d0d0d000d0d0dULL,
  510     0x0071717100717171ULL, 0x005f5f5f005f5f5fULL, 0x001f1f1f001f1f1fULL,
  511     0x00f8f8f800f8f8f8ULL, 0x00d7d7d700d7d7d7ULL, 0x003e3e3e003e3e3eULL,
  512     0x009d9d9d009d9d9dULL, 0x007c7c7c007c7c7cULL, 0x0060606000606060ULL,
  513     0x00b9b9b900b9b9b9ULL, 0x00bebebe00bebebeULL, 0x00bcbcbc00bcbcbcULL,
  514     0x008b8b8b008b8b8bULL, 0x0016161600161616ULL, 0x0034343400343434ULL,
  515     0x004d4d4d004d4d4dULL, 0x00c3c3c300c3c3c3ULL, 0x0072727200727272ULL,
  516     0x0095959500959595ULL, 0x00ababab00abababULL, 0x008e8e8e008e8e8eULL,
  517     0x00bababa00bababaULL, 0x007a7a7a007a7a7aULL, 0x00b3b3b300b3b3b3ULL,
  518     0x0002020200020202ULL, 0x00b4b4b400b4b4b4ULL, 0x00adadad00adadadULL,
  519     0x00a2a2a200a2a2a2ULL, 0x00acacac00acacacULL, 0x00d8d8d800d8d8d8ULL,
  520     0x009a9a9a009a9a9aULL, 0x0017171700171717ULL, 0x001a1a1a001a1a1aULL,
  521     0x0035353500353535ULL, 0x00cccccc00ccccccULL, 0x00f7f7f700f7f7f7ULL,
  522     0x0099999900999999ULL, 0x0061616100616161ULL, 0x005a5a5a005a5a5aULL,
  523     0x00e8e8e800e8e8e8ULL, 0x0024242400242424ULL, 0x0056565600565656ULL,
  524     0x0040404000404040ULL, 0x00e1e1e100e1e1e1ULL, 0x0063636300636363ULL,
  525     0x0009090900090909ULL, 0x0033333300333333ULL, 0x00bfbfbf00bfbfbfULL,
  526     0x0098989800989898ULL, 0x0097979700979797ULL, 0x0085858500858585ULL,
  527     0x0068686800686868ULL, 0x00fcfcfc00fcfcfcULL, 0x00ececec00ecececULL,
  528     0x000a0a0a000a0a0aULL, 0x00dadada00dadadaULL, 0x006f6f6f006f6f6fULL,
  529     0x0053535300535353ULL, 0x0062626200626262ULL, 0x00a3a3a300a3a3a3ULL,
  530     0x002e2e2e002e2e2eULL, 0x0008080800080808ULL, 0x00afafaf00afafafULL,
  531     0x0028282800282828ULL, 0x00b0b0b000b0b0b0ULL, 0x0074747400747474ULL,
  532     0x00c2c2c200c2c2c2ULL, 0x00bdbdbd00bdbdbdULL, 0x0036363600363636ULL,
  533     0x0022222200222222ULL, 0x0038383800383838ULL, 0x0064646400646464ULL,
  534     0x001e1e1e001e1e1eULL, 0x0039393900393939ULL, 0x002c2c2c002c2c2cULL,
  535     0x00a6a6a600a6a6a6ULL, 0x0030303000303030ULL, 0x00e5e5e500e5e5e5ULL,
  536     0x0044444400444444ULL, 0x00fdfdfd00fdfdfdULL, 0x0088888800888888ULL,
  537     0x009f9f9f009f9f9fULL, 0x0065656500656565ULL, 0x0087878700878787ULL,
  538     0x006b6b6b006b6b6bULL, 0x00f4f4f400f4f4f4ULL, 0x0023232300232323ULL,
  539     0x0048484800484848ULL, 0x0010101000101010ULL, 0x00d1d1d100d1d1d1ULL,
  540     0x0051515100515151ULL, 0x00c0c0c000c0c0c0ULL, 0x00f9f9f900f9f9f9ULL,
  541     0x00d2d2d200d2d2d2ULL, 0x00a0a0a000a0a0a0ULL, 0x0055555500555555ULL,
  542     0x00a1a1a100a1a1a1ULL, 0x0041414100414141ULL, 0x00fafafa00fafafaULL,
  543     0x0043434300434343ULL, 0x0013131300131313ULL, 0x00c4c4c400c4c4c4ULL,
  544     0x002f2f2f002f2f2fULL, 0x00a8a8a800a8a8a8ULL, 0x00b6b6b600b6b6b6ULL,
  545     0x003c3c3c003c3c3cULL, 0x002b2b2b002b2b2bULL, 0x00c1c1c100c1c1c1ULL,
  546     0x00ffffff00ffffffULL, 0x00c8c8c800c8c8c8ULL, 0x00a5a5a500a5a5a5ULL,
  547     0x0020202000202020ULL, 0x0089898900898989ULL, 0x0000000000000000ULL,
  548     0x0090909000909090ULL, 0x0047474700474747ULL, 0x00efefef00efefefULL,
  549     0x00eaeaea00eaeaeaULL, 0x00b7b7b700b7b7b7ULL, 0x0015151500151515ULL,
  550     0x0006060600060606ULL, 0x00cdcdcd00cdcdcdULL, 0x00b5b5b500b5b5b5ULL,
  551     0x0012121200121212ULL, 0x007e7e7e007e7e7eULL, 0x00bbbbbb00bbbbbbULL,
  552     0x0029292900292929ULL, 0x000f0f0f000f0f0fULL, 0x00b8b8b800b8b8b8ULL,
  553     0x0007070700070707ULL, 0x0004040400040404ULL, 0x009b9b9b009b9b9bULL,
  554     0x0094949400949494ULL, 0x0021212100212121ULL, 0x0066666600666666ULL,
  555     0x00e6e6e600e6e6e6ULL, 0x00cecece00cececeULL, 0x00ededed00edededULL,
  556     0x00e7e7e700e7e7e7ULL, 0x003b3b3b003b3b3bULL, 0x00fefefe00fefefeULL,
  557     0x007f7f7f007f7f7fULL, 0x00c5c5c500c5c5c5ULL, 0x00a4a4a400a4a4a4ULL,
  558     0x0037373700373737ULL, 0x00b1b1b100b1b1b1ULL, 0x004c4c4c004c4c4cULL,
  559     0x0091919100919191ULL, 0x006e6e6e006e6e6eULL, 0x008d8d8d008d8d8dULL,
  560     0x0076767600767676ULL, 0x0003030300030303ULL, 0x002d2d2d002d2d2dULL,
  561     0x00dedede00dededeULL, 0x0096969600969696ULL, 0x0026262600262626ULL,
  562     0x007d7d7d007d7d7dULL, 0x00c6c6c600c6c6c6ULL, 0x005c5c5c005c5c5cULL,
  563     0x00d3d3d300d3d3d3ULL, 0x00f2f2f200f2f2f2ULL, 0x004f4f4f004f4f4fULL,
  564     0x0019191900191919ULL, 0x003f3f3f003f3f3fULL, 0x00dcdcdc00dcdcdcULL,
  565     0x0079797900797979ULL, 0x001d1d1d001d1d1dULL, 0x0052525200525252ULL,
  566     0x00ebebeb00ebebebULL, 0x00f3f3f300f3f3f3ULL, 0x006d6d6d006d6d6dULL,
  567     0x005e5e5e005e5e5eULL, 0x00fbfbfb00fbfbfbULL, 0x0069696900696969ULL,
  568     0x00b2b2b200b2b2b2ULL, 0x00f0f0f000f0f0f0ULL, 0x0031313100313131ULL,
  569     0x000c0c0c000c0c0cULL, 0x00d4d4d400d4d4d4ULL, 0x00cfcfcf00cfcfcfULL,
  570     0x008c8c8c008c8c8cULL, 0x00e2e2e200e2e2e2ULL, 0x0075757500757575ULL,
  571     0x00a9a9a900a9a9a9ULL, 0x004a4a4a004a4a4aULL, 0x0057575700575757ULL,
  572     0x0084848400848484ULL, 0x0011111100111111ULL, 0x0045454500454545ULL,
  573     0x001b1b1b001b1b1bULL, 0x00f5f5f500f5f5f5ULL, 0x00e4e4e400e4e4e4ULL,
  574     0x000e0e0e000e0e0eULL, 0x0073737300737373ULL, 0x00aaaaaa00aaaaaaULL,
  575     0x00f1f1f100f1f1f1ULL, 0x00dddddd00ddddddULL, 0x0059595900595959ULL,
  576     0x0014141400141414ULL, 0x006c6c6c006c6c6cULL, 0x0092929200929292ULL,
  577     0x0054545400545454ULL, 0x00d0d0d000d0d0d0ULL, 0x0078787800787878ULL,
  578     0x0070707000707070ULL, 0x00e3e3e300e3e3e3ULL, 0x0049494900494949ULL,
  579     0x0080808000808080ULL, 0x0050505000505050ULL, 0x00a7a7a700a7a7a7ULL,
  580     0x00f6f6f600f6f6f6ULL, 0x0077777700777777ULL, 0x0093939300939393ULL,
  581     0x0086868600868686ULL, 0x0083838300838383ULL, 0x002a2a2a002a2a2aULL,
  582     0x00c7c7c700c7c7c7ULL, 0x005b5b5b005b5b5bULL, 0x00e9e9e900e9e9e9ULL,
  583     0x00eeeeee00eeeeeeULL, 0x008f8f8f008f8f8fULL, 0x0001010100010101ULL,
  584     0x003d3d3d003d3d3dULL,
  585 };
  586 
  587 const uint64 camellia_sp30333033[256] = {
  588     0x3800383838003838ULL, 0x4100414141004141ULL, 0x1600161616001616ULL,
  589     0x7600767676007676ULL, 0xd900d9d9d900d9d9ULL, 0x9300939393009393ULL,
  590     0x6000606060006060ULL, 0xf200f2f2f200f2f2ULL, 0x7200727272007272ULL,
  591     0xc200c2c2c200c2c2ULL, 0xab00ababab00ababULL, 0x9a009a9a9a009a9aULL,
  592     0x7500757575007575ULL, 0x0600060606000606ULL, 0x5700575757005757ULL,
  593     0xa000a0a0a000a0a0ULL, 0x9100919191009191ULL, 0xf700f7f7f700f7f7ULL,
  594     0xb500b5b5b500b5b5ULL, 0xc900c9c9c900c9c9ULL, 0xa200a2a2a200a2a2ULL,
  595     0x8c008c8c8c008c8cULL, 0xd200d2d2d200d2d2ULL, 0x9000909090009090ULL,
  596     0xf600f6f6f600f6f6ULL, 0x0700070707000707ULL, 0xa700a7a7a700a7a7ULL,
  597     0x2700272727002727ULL, 0x8e008e8e8e008e8eULL, 0xb200b2b2b200b2b2ULL,
  598     0x4900494949004949ULL, 0xde00dedede00dedeULL, 0x4300434343004343ULL,
  599     0x5c005c5c5c005c5cULL, 0xd700d7d7d700d7d7ULL, 0xc700c7c7c700c7c7ULL,
  600     0x3e003e3e3e003e3eULL, 0xf500f5f5f500f5f5ULL, 0x8f008f8f8f008f8fULL,
  601     0x6700676767006767ULL, 0x1f001f1f1f001f1fULL, 0x1800181818001818ULL,
  602     0x6e006e6e6e006e6eULL, 0xaf00afafaf00afafULL, 0x2f002f2f2f002f2fULL,
  603     0xe200e2e2e200e2e2ULL, 0x8500858585008585ULL, 0x0d000d0d0d000d0dULL,
  604     0x5300535353005353ULL, 0xf000f0f0f000f0f0ULL, 0x9c009c9c9c009c9cULL,
  605     0x6500656565006565ULL, 0xea00eaeaea00eaeaULL, 0xa300a3a3a300a3a3ULL,
  606     0xae00aeaeae00aeaeULL, 0x9e009e9e9e009e9eULL, 0xec00ececec00ececULL,
  607     0x8000808080008080ULL, 0x2d002d2d2d002d2dULL, 0x6b006b6b6b006b6bULL,
  608     0xa800a8a8a800a8a8ULL, 0x2b002b2b2b002b2bULL, 0x3600363636003636ULL,
  609     0xa600a6a6a600a6a6ULL, 0xc500c5c5c500c5c5ULL, 0x8600868686008686ULL,
  610     0x4d004d4d4d004d4dULL, 0x3300333333003333ULL, 0xfd00fdfdfd00fdfdULL,
  611     0x6600666666006666ULL, 0x5800585858005858ULL, 0x9600969696009696ULL,
  612     0x3a003a3a3a003a3aULL, 0x0900090909000909ULL, 0x9500959595009595ULL,
  613     0x1000101010001010ULL, 0x7800787878007878ULL, 0xd800d8d8d800d8d8ULL,
  614     0x4200424242004242ULL, 0xcc00cccccc00ccccULL, 0xef00efefef00efefULL,
  615     0x2600262626002626ULL, 0xe500e5e5e500e5e5ULL, 0x6100616161006161ULL,
  616     0x1a001a1a1a001a1aULL, 0x3f003f3f3f003f3fULL, 0x3b003b3b3b003b3bULL,
  617     0x8200828282008282ULL, 0xb600b6b6b600b6b6ULL, 0xdb00dbdbdb00dbdbULL,
  618     0xd400d4d4d400d4d4ULL, 0x9800989898009898ULL, 0xe800e8e8e800e8e8ULL,
  619     0x8b008b8b8b008b8bULL, 0x0200020202000202ULL, 0xeb00ebebeb00ebebULL,
  620     0x0a000a0a0a000a0aULL, 0x2c002c2c2c002c2cULL, 0x1d001d1d1d001d1dULL,
  621     0xb000b0b0b000b0b0ULL, 0x6f006f6f6f006f6fULL, 0x8d008d8d8d008d8dULL,
  622     0x8800888888008888ULL, 0x0e000e0e0e000e0eULL, 0x1900191919001919ULL,
  623     0x8700878787008787ULL, 0x4e004e4e4e004e4eULL, 0x0b000b0b0b000b0bULL,
  624     0xa900a9a9a900a9a9ULL, 0x0c000c0c0c000c0cULL, 0x7900797979007979ULL,
  625     0x1100111111001111ULL, 0x7f007f7f7f007f7fULL, 0x2200222222002222ULL,
  626     0xe700e7e7e700e7e7ULL, 0x5900595959005959ULL, 0xe100e1e1e100e1e1ULL,
  627     0xda00dadada00dadaULL, 0x3d003d3d3d003d3dULL, 0xc800c8c8c800c8c8ULL,
  628     0x1200121212001212ULL, 0x0400040404000404ULL, 0x7400747474007474ULL,
  629     0x5400545454005454ULL, 0x3000303030003030ULL, 0x7e007e7e7e007e7eULL,
  630     0xb400b4b4b400b4b4ULL, 0x2800282828002828ULL, 0x5500555555005555ULL,
  631     0x6800686868006868ULL, 0x5000505050005050ULL, 0xbe00bebebe00bebeULL,
  632     0xd000d0d0d000d0d0ULL, 0xc400c4c4c400c4c4ULL, 0x3100313131003131ULL,
  633     0xcb00cbcbcb00cbcbULL, 0x2a002a2a2a002a2aULL, 0xad00adadad00adadULL,
  634     0x0f000f0f0f000f0fULL, 0xca00cacaca00cacaULL, 0x7000707070007070ULL,
  635     0xff00ffffff00ffffULL, 0x3200323232003232ULL, 0x6900696969006969ULL,
  636     0x0800080808000808ULL, 0x6200626262006262ULL, 0x0000000000000000ULL,
  637     0x2400242424002424ULL, 0xd100d1d1d100d1d1ULL, 0xfb00fbfbfb00fbfbULL,
  638     0xba00bababa00babaULL, 0xed00ededed00ededULL, 0x4500454545004545ULL,
  639     0x8100818181008181ULL, 0x7300737373007373ULL, 0x6d006d6d6d006d6dULL,
  640     0x8400848484008484ULL, 0x9f009f9f9f009f9fULL, 0xee00eeeeee00eeeeULL,
  641     0x4a004a4a4a004a4aULL, 0xc300c3c3c300c3c3ULL, 0x2e002e2e2e002e2eULL,
  642     0xc100c1c1c100c1c1ULL, 0x0100010101000101ULL, 0xe600e6e6e600e6e6ULL,
  643     0x2500252525002525ULL, 0x4800484848004848ULL, 0x9900999999009999ULL,
  644     0xb900b9b9b900b9b9ULL, 0xb300b3b3b300b3b3ULL, 0x7b007b7b7b007b7bULL,
  645     0xf900f9f9f900f9f9ULL, 0xce00cecece00ceceULL, 0xbf00bfbfbf00bfbfULL,
  646     0xdf00dfdfdf00dfdfULL, 0x7100717171007171ULL, 0x2900292929002929ULL,
  647     0xcd00cdcdcd00cdcdULL, 0x6c006c6c6c006c6cULL, 0x1300131313001313ULL,
  648     0x6400646464006464ULL, 0x9b009b9b9b009b9bULL, 0x6300636363006363ULL,
  649     0x9d009d9d9d009d9dULL, 0xc000c0c0c000c0c0ULL, 0x4b004b4b4b004b4bULL,
  650     0xb700b7b7b700b7b7ULL, 0xa500a5a5a500a5a5ULL, 0x8900898989008989ULL,
  651     0x5f005f5f5f005f5fULL, 0xb100b1b1b100b1b1ULL, 0x1700171717001717ULL,
  652     0xf400f4f4f400f4f4ULL, 0xbc00bcbcbc00bcbcULL, 0xd300d3d3d300d3d3ULL,
  653     0x4600464646004646ULL, 0xcf00cfcfcf00cfcfULL, 0x3700373737003737ULL,
  654     0x5e005e5e5e005e5eULL, 0x4700474747004747ULL, 0x9400949494009494ULL,
  655     0xfa00fafafa00fafaULL, 0xfc00fcfcfc00fcfcULL, 0x5b005b5b5b005b5bULL,
  656     0x9700979797009797ULL, 0xfe00fefefe00fefeULL, 0x5a005a5a5a005a5aULL,
  657     0xac00acacac00acacULL, 0x3c003c3c3c003c3cULL, 0x4c004c4c4c004c4cULL,
  658     0x0300030303000303ULL, 0x3500353535003535ULL, 0xf300f3f3f300f3f3ULL,
  659     0x2300232323002323ULL, 0xb800b8b8b800b8b8ULL, 0x5d005d5d5d005d5dULL,
  660     0x6a006a6a6a006a6aULL, 0x9200929292009292ULL, 0xd500d5d5d500d5d5ULL,
  661     0x2100212121002121ULL, 0x4400444444004444ULL, 0x5100515151005151ULL,
  662     0xc600c6c6c600c6c6ULL, 0x7d007d7d7d007d7dULL, 0x3900393939003939ULL,
  663     0x8300838383008383ULL, 0xdc00dcdcdc00dcdcULL, 0xaa00aaaaaa00aaaaULL,
  664     0x7c007c7c7c007c7cULL, 0x7700777777007777ULL, 0x5600565656005656ULL,
  665     0x0500050505000505ULL, 0x1b001b1b1b001b1bULL, 0xa400a4a4a400a4a4ULL,
  666     0x1500151515001515ULL, 0x3400343434003434ULL, 0x1e001e1e1e001e1eULL,
  667     0x1c001c1c1c001c1cULL, 0xf800f8f8f800f8f8ULL, 0x5200525252005252ULL,
  668     0x2000202020002020ULL, 0x1400141414001414ULL, 0xe900e9e9e900e9e9ULL,
  669     0xbd00bdbdbd00bdbdULL, 0xdd00dddddd00ddddULL, 0xe400e4e4e400e4e4ULL,
  670     0xa100a1a1a100a1a1ULL, 0xe000e0e0e000e0e0ULL, 0x8a008a8a8a008a8aULL,
  671     0xf100f1f1f100f1f1ULL, 0xd600d6d6d600d6d6ULL, 0x7a007a7a7a007a7aULL,
  672     0xbb00bbbbbb00bbbbULL, 0xe300e3e3e300e3e3ULL, 0x4000404040004040ULL,
  673     0x4f004f4f4f004f4fULL,
  674 };
  675 
  676 const uint64 camellia_sp44044404[256] = {
  677     0x7070007070700070ULL, 0x2c2c002c2c2c002cULL, 0xb3b300b3b3b300b3ULL,
  678     0xc0c000c0c0c000c0ULL, 0xe4e400e4e4e400e4ULL, 0x5757005757570057ULL,
  679     0xeaea00eaeaea00eaULL, 0xaeae00aeaeae00aeULL, 0x2323002323230023ULL,
  680     0x6b6b006b6b6b006bULL, 0x4545004545450045ULL, 0xa5a500a5a5a500a5ULL,
  681     0xeded00ededed00edULL, 0x4f4f004f4f4f004fULL, 0x1d1d001d1d1d001dULL,
  682     0x9292009292920092ULL, 0x8686008686860086ULL, 0xafaf00afafaf00afULL,
  683     0x7c7c007c7c7c007cULL, 0x1f1f001f1f1f001fULL, 0x3e3e003e3e3e003eULL,
  684     0xdcdc00dcdcdc00dcULL, 0x5e5e005e5e5e005eULL, 0x0b0b000b0b0b000bULL,
  685     0xa6a600a6a6a600a6ULL, 0x3939003939390039ULL, 0xd5d500d5d5d500d5ULL,
  686     0x5d5d005d5d5d005dULL, 0xd9d900d9d9d900d9ULL, 0x5a5a005a5a5a005aULL,
  687     0x5151005151510051ULL, 0x6c6c006c6c6c006cULL, 0x8b8b008b8b8b008bULL,
  688     0x9a9a009a9a9a009aULL, 0xfbfb00fbfbfb00fbULL, 0xb0b000b0b0b000b0ULL,
  689     0x7474007474740074ULL, 0x2b2b002b2b2b002bULL, 0xf0f000f0f0f000f0ULL,
  690     0x8484008484840084ULL, 0xdfdf00dfdfdf00dfULL, 0xcbcb00cbcbcb00cbULL,
  691     0x3434003434340034ULL, 0x7676007676760076ULL, 0x6d6d006d6d6d006dULL,
  692     0xa9a900a9a9a900a9ULL, 0xd1d100d1d1d100d1ULL, 0x0404000404040004ULL,
  693     0x1414001414140014ULL, 0x3a3a003a3a3a003aULL, 0xdede00dedede00deULL,
  694     0x1111001111110011ULL, 0x3232003232320032ULL, 0x9c9c009c9c9c009cULL,
  695     0x5353005353530053ULL, 0xf2f200f2f2f200f2ULL, 0xfefe00fefefe00feULL,
  696     0xcfcf00cfcfcf00cfULL, 0xc3c300c3c3c300c3ULL, 0x7a7a007a7a7a007aULL,
  697     0x2424002424240024ULL, 0xe8e800e8e8e800e8ULL, 0x6060006060600060ULL,
  698     0x6969006969690069ULL, 0xaaaa00aaaaaa00aaULL, 0xa0a000a0a0a000a0ULL,
  699     0xa1a100a1a1a100a1ULL, 0x6262006262620062ULL, 0x5454005454540054ULL,
  700     0x1e1e001e1e1e001eULL, 0xe0e000e0e0e000e0ULL, 0x6464006464640064ULL,
  701     0x1010001010100010ULL, 0x0000000000000000ULL, 0xa3a300a3a3a300a3ULL,
  702     0x7575007575750075ULL, 0x8a8a008a8a8a008aULL, 0xe6e600e6e6e600e6ULL,
  703     0x0909000909090009ULL, 0xdddd00dddddd00ddULL, 0x8787008787870087ULL,
  704     0x8383008383830083ULL, 0xcdcd00cdcdcd00cdULL, 0x9090009090900090ULL,
  705     0x7373007373730073ULL, 0xf6f600f6f6f600f6ULL, 0x9d9d009d9d9d009dULL,
  706     0xbfbf00bfbfbf00bfULL, 0x5252005252520052ULL, 0xd8d800d8d8d800d8ULL,
  707     0xc8c800c8c8c800c8ULL, 0xc6c600c6c6c600c6ULL, 0x8181008181810081ULL,
  708     0x6f6f006f6f6f006fULL, 0x1313001313130013ULL, 0x6363006363630063ULL,
  709     0xe9e900e9e9e900e9ULL, 0xa7a700a7a7a700a7ULL, 0x9f9f009f9f9f009fULL,
  710     0xbcbc00bcbcbc00bcULL, 0x2929002929290029ULL, 0xf9f900f9f9f900f9ULL,
  711     0x2f2f002f2f2f002fULL, 0xb4b400b4b4b400b4ULL, 0x7878007878780078ULL,
  712     0x0606000606060006ULL, 0xe7e700e7e7e700e7ULL, 0x7171007171710071ULL,
  713     0xd4d400d4d4d400d4ULL, 0xabab00ababab00abULL, 0x8888008888880088ULL,
  714     0x8d8d008d8d8d008dULL, 0x7272007272720072ULL, 0xb9b900b9b9b900b9ULL,
  715     0xf8f800f8f8f800f8ULL, 0xacac00acacac00acULL, 0x3636003636360036ULL,
  716     0x2a2a002a2a2a002aULL, 0x3c3c003c3c3c003cULL, 0xf1f100f1f1f100f1ULL,
  717     0x4040004040400040ULL, 0xd3d300d3d3d300d3ULL, 0xbbbb00bbbbbb00bbULL,
  718     0x4343004343430043ULL, 0x1515001515150015ULL, 0xadad00adadad00adULL,
  719     0x7777007777770077ULL, 0x8080008080800080ULL, 0x8282008282820082ULL,
  720     0xecec00ececec00ecULL, 0x2727002727270027ULL, 0xe5e500e5e5e500e5ULL,
  721     0x8585008585850085ULL, 0x3535003535350035ULL, 0x0c0c000c0c0c000cULL,
  722     0x4141004141410041ULL, 0xefef00efefef00efULL, 0x9393009393930093ULL,
  723     0x1919001919190019ULL, 0x2121002121210021ULL, 0x0e0e000e0e0e000eULL,
  724     0x4e4e004e4e4e004eULL, 0x6565006565650065ULL, 0xbdbd00bdbdbd00bdULL,
  725     0xb8b800b8b8b800b8ULL, 0x8f8f008f8f8f008fULL, 0xebeb00ebebeb00ebULL,
  726     0xcece00cecece00ceULL, 0x3030003030300030ULL, 0x5f5f005f5f5f005fULL,
  727     0xc5c500c5c5c500c5ULL, 0x1a1a001a1a1a001aULL, 0xe1e100e1e1e100e1ULL,
  728     0xcaca00cacaca00caULL, 0x4747004747470047ULL, 0x3d3d003d3d3d003dULL,
  729     0x0101000101010001ULL, 0xd6d600d6d6d600d6ULL, 0x5656005656560056ULL,
  730     0x4d4d004d4d4d004dULL, 0x0d0d000d0d0d000dULL, 0x6666006666660066ULL,
  731     0xcccc00cccccc00ccULL, 0x2d2d002d2d2d002dULL, 0x1212001212120012ULL,
  732     0x2020002020200020ULL, 0xb1b100b1b1b100b1ULL, 0x9999009999990099ULL,
  733     0x4c4c004c4c4c004cULL, 0xc2c200c2c2c200c2ULL, 0x7e7e007e7e7e007eULL,
  734     0x0505000505050005ULL, 0xb7b700b7b7b700b7ULL, 0x3131003131310031ULL,
  735     0x1717001717170017ULL, 0xd7d700d7d7d700d7ULL, 0x5858005858580058ULL,
  736     0x6161006161610061ULL, 0x1b1b001b1b1b001bULL, 0x1c1c001c1c1c001cULL,
  737     0x0f0f000f0f0f000fULL, 0x1616001616160016ULL, 0x1818001818180018ULL,
  738     0x2222002222220022ULL, 0x4444004444440044ULL, 0xb2b200b2b2b200b2ULL,
  739     0xb5b500b5b5b500b5ULL, 0x9191009191910091ULL, 0x0808000808080008ULL,
  740     0xa8a800a8a8a800a8ULL, 0xfcfc00fcfcfc00fcULL, 0x5050005050500050ULL,
  741     0xd0d000d0d0d000d0ULL, 0x7d7d007d7d7d007dULL, 0x8989008989890089ULL,
  742     0x9797009797970097ULL, 0x5b5b005b5b5b005bULL, 0x9595009595950095ULL,
  743     0xffff00ffffff00ffULL, 0xd2d200d2d2d200d2ULL, 0xc4c400c4c4c400c4ULL,
  744     0x4848004848480048ULL, 0xf7f700f7f7f700f7ULL, 0xdbdb00dbdbdb00dbULL,
  745     0x0303000303030003ULL, 0xdada00dadada00daULL, 0x3f3f003f3f3f003fULL,
  746     0x9494009494940094ULL, 0x5c5c005c5c5c005cULL, 0x0202000202020002ULL,
  747     0x4a4a004a4a4a004aULL, 0x3333003333330033ULL, 0x6767006767670067ULL,
  748     0xf3f300f3f3f300f3ULL, 0x7f7f007f7f7f007fULL, 0xe2e200e2e2e200e2ULL,
  749     0x9b9b009b9b9b009bULL, 0x2626002626260026ULL, 0x3737003737370037ULL,
  750     0x3b3b003b3b3b003bULL, 0x9696009696960096ULL, 0x4b4b004b4b4b004bULL,
  751     0xbebe00bebebe00beULL, 0x2e2e002e2e2e002eULL, 0x7979007979790079ULL,
  752     0x8c8c008c8c8c008cULL, 0x6e6e006e6e6e006eULL, 0x8e8e008e8e8e008eULL,
  753     0xf5f500f5f5f500f5ULL, 0xb6b600b6b6b600b6ULL, 0xfdfd00fdfdfd00fdULL,
  754     0x5959005959590059ULL, 0x9898009898980098ULL, 0x6a6a006a6a6a006aULL,
  755     0x4646004646460046ULL, 0xbaba00bababa00baULL, 0x2525002525250025ULL,
  756     0x4242004242420042ULL, 0xa2a200a2a2a200a2ULL, 0xfafa00fafafa00faULL,
  757     0x0707000707070007ULL, 0x5555005555550055ULL, 0xeeee00eeeeee00eeULL,
  758     0x0a0a000a0a0a000aULL, 0x4949004949490049ULL, 0x6868006868680068ULL,
  759     0x3838003838380038ULL, 0xa4a400a4a4a400a4ULL, 0x2828002828280028ULL,
  760     0x7b7b007b7b7b007bULL, 0xc9c900c9c9c900c9ULL, 0xc1c100c1c1c100c1ULL,
  761     0xe3e300e3e3e300e3ULL, 0xf4f400f4f4f400f4ULL, 0xc7c700c7c7c700c7ULL,
  762     0x9e9e009e9e9e009eULL,
  763 };
  764 
  765 const uint64 camellia_sp11101110[256] = {
  766     0x7070700070707000ULL, 0x8282820082828200ULL, 0x2c2c2c002c2c2c00ULL,
  767     0xececec00ececec00ULL, 0xb3b3b300b3b3b300ULL, 0x2727270027272700ULL,
  768     0xc0c0c000c0c0c000ULL, 0xe5e5e500e5e5e500ULL, 0xe4e4e400e4e4e400ULL,
  769     0x8585850085858500ULL, 0x5757570057575700ULL, 0x3535350035353500ULL,
  770     0xeaeaea00eaeaea00ULL, 0x0c0c0c000c0c0c00ULL, 0xaeaeae00aeaeae00ULL,
  771     0x4141410041414100ULL, 0x2323230023232300ULL, 0xefefef00efefef00ULL,
  772     0x6b6b6b006b6b6b00ULL, 0x9393930093939300ULL, 0x4545450045454500ULL,
  773     0x1919190019191900ULL, 0xa5a5a500a5a5a500ULL, 0x2121210021212100ULL,
  774     0xededed00ededed00ULL, 0x0e0e0e000e0e0e00ULL, 0x4f4f4f004f4f4f00ULL,
  775     0x4e4e4e004e4e4e00ULL, 0x1d1d1d001d1d1d00ULL, 0x6565650065656500ULL,
  776     0x9292920092929200ULL, 0xbdbdbd00bdbdbd00ULL, 0x8686860086868600ULL,
  777     0xb8b8b800b8b8b800ULL, 0xafafaf00afafaf00ULL, 0x8f8f8f008f8f8f00ULL,
  778     0x7c7c7c007c7c7c00ULL, 0xebebeb00ebebeb00ULL, 0x1f1f1f001f1f1f00ULL,
  779     0xcecece00cecece00ULL, 0x3e3e3e003e3e3e00ULL, 0x3030300030303000ULL,
  780     0xdcdcdc00dcdcdc00ULL, 0x5f5f5f005f5f5f00ULL, 0x5e5e5e005e5e5e00ULL,
  781     0xc5c5c500c5c5c500ULL, 0x0b0b0b000b0b0b00ULL, 0x1a1a1a001a1a1a00ULL,
  782     0xa6a6a600a6a6a600ULL, 0xe1e1e100e1e1e100ULL, 0x3939390039393900ULL,
  783     0xcacaca00cacaca00ULL, 0xd5d5d500d5d5d500ULL, 0x4747470047474700ULL,
  784     0x5d5d5d005d5d5d00ULL, 0x3d3d3d003d3d3d00ULL, 0xd9d9d900d9d9d900ULL,
  785     0x0101010001010100ULL, 0x5a5a5a005a5a5a00ULL, 0xd6d6d600d6d6d600ULL,
  786     0x5151510051515100ULL, 0x5656560056565600ULL, 0x6c6c6c006c6c6c00ULL,
  787     0x4d4d4d004d4d4d00ULL, 0x8b8b8b008b8b8b00ULL, 0x0d0d0d000d0d0d00ULL,
  788     0x9a9a9a009a9a9a00ULL, 0x6666660066666600ULL, 0xfbfbfb00fbfbfb00ULL,
  789     0xcccccc00cccccc00ULL, 0xb0b0b000b0b0b000ULL, 0x2d2d2d002d2d2d00ULL,
  790     0x7474740074747400ULL, 0x1212120012121200ULL, 0x2b2b2b002b2b2b00ULL,
  791     0x2020200020202000ULL, 0xf0f0f000f0f0f000ULL, 0xb1b1b100b1b1b100ULL,
  792     0x8484840084848400ULL, 0x9999990099999900ULL, 0xdfdfdf00dfdfdf00ULL,
  793     0x4c4c4c004c4c4c00ULL, 0xcbcbcb00cbcbcb00ULL, 0xc2c2c200c2c2c200ULL,
  794     0x3434340034343400ULL, 0x7e7e7e007e7e7e00ULL, 0x7676760076767600ULL,
  795     0x0505050005050500ULL, 0x6d6d6d006d6d6d00ULL, 0xb7b7b700b7b7b700ULL,
  796     0xa9a9a900a9a9a900ULL, 0x3131310031313100ULL, 0xd1d1d100d1d1d100ULL,
  797     0x1717170017171700ULL, 0x0404040004040400ULL, 0xd7d7d700d7d7d700ULL,
  798     0x1414140014141400ULL, 0x5858580058585800ULL, 0x3a3a3a003a3a3a00ULL,
  799     0x6161610061616100ULL, 0xdedede00dedede00ULL, 0x1b1b1b001b1b1b00ULL,
  800     0x1111110011111100ULL, 0x1c1c1c001c1c1c00ULL, 0x3232320032323200ULL,
  801     0x0f0f0f000f0f0f00ULL, 0x9c9c9c009c9c9c00ULL, 0x1616160016161600ULL,
  802     0x5353530053535300ULL, 0x1818180018181800ULL, 0xf2f2f200f2f2f200ULL,
  803     0x2222220022222200ULL, 0xfefefe00fefefe00ULL, 0x4444440044444400ULL,
  804     0xcfcfcf00cfcfcf00ULL, 0xb2b2b200b2b2b200ULL, 0xc3c3c300c3c3c300ULL,
  805     0xb5b5b500b5b5b500ULL, 0x7a7a7a007a7a7a00ULL, 0x9191910091919100ULL,
  806     0x2424240024242400ULL, 0x0808080008080800ULL, 0xe8e8e800e8e8e800ULL,
  807     0xa8a8a800a8a8a800ULL, 0x6060600060606000ULL, 0xfcfcfc00fcfcfc00ULL,
  808     0x6969690069696900ULL, 0x5050500050505000ULL, 0xaaaaaa00aaaaaa00ULL,
  809     0xd0d0d000d0d0d000ULL, 0xa0a0a000a0a0a000ULL, 0x7d7d7d007d7d7d00ULL,
  810     0xa1a1a100a1a1a100ULL, 0x8989890089898900ULL, 0x6262620062626200ULL,
  811     0x9797970097979700ULL, 0x5454540054545400ULL, 0x5b5b5b005b5b5b00ULL,
  812     0x1e1e1e001e1e1e00ULL, 0x9595950095959500ULL, 0xe0e0e000e0e0e000ULL,
  813     0xffffff00ffffff00ULL, 0x6464640064646400ULL, 0xd2d2d200d2d2d200ULL,
  814     0x1010100010101000ULL, 0xc4c4c400c4c4c400ULL, 0x0000000000000000ULL,
  815     0x4848480048484800ULL, 0xa3a3a300a3a3a300ULL, 0xf7f7f700f7f7f700ULL,
  816     0x7575750075757500ULL, 0xdbdbdb00dbdbdb00ULL, 0x8a8a8a008a8a8a00ULL,
  817     0x0303030003030300ULL, 0xe6e6e600e6e6e600ULL, 0xdadada00dadada00ULL,
  818     0x0909090009090900ULL, 0x3f3f3f003f3f3f00ULL, 0xdddddd00dddddd00ULL,
  819     0x9494940094949400ULL, 0x8787870087878700ULL, 0x5c5c5c005c5c5c00ULL,
  820     0x8383830083838300ULL, 0x0202020002020200ULL, 0xcdcdcd00cdcdcd00ULL,
  821     0x4a4a4a004a4a4a00ULL, 0x9090900090909000ULL, 0x3333330033333300ULL,
  822     0x7373730073737300ULL, 0x6767670067676700ULL, 0xf6f6f600f6f6f600ULL,
  823     0xf3f3f300f3f3f300ULL, 0x9d9d9d009d9d9d00ULL, 0x7f7f7f007f7f7f00ULL,
  824     0xbfbfbf00bfbfbf00ULL, 0xe2e2e200e2e2e200ULL, 0x5252520052525200ULL,
  825     0x9b9b9b009b9b9b00ULL, 0xd8d8d800d8d8d800ULL, 0x2626260026262600ULL,
  826     0xc8c8c800c8c8c800ULL, 0x3737370037373700ULL, 0xc6c6c600c6c6c600ULL,
  827     0x3b3b3b003b3b3b00ULL, 0x8181810081818100ULL, 0x9696960096969600ULL,
  828     0x6f6f6f006f6f6f00ULL, 0x4b4b4b004b4b4b00ULL, 0x1313130013131300ULL,
  829     0xbebebe00bebebe00ULL, 0x6363630063636300ULL, 0x2e2e2e002e2e2e00ULL,
  830     0xe9e9e900e9e9e900ULL, 0x7979790079797900ULL, 0xa7a7a700a7a7a700ULL,
  831     0x8c8c8c008c8c8c00ULL, 0x9f9f9f009f9f9f00ULL, 0x6e6e6e006e6e6e00ULL,
  832     0xbcbcbc00bcbcbc00ULL, 0x8e8e8e008e8e8e00ULL, 0x2929290029292900ULL,
  833     0xf5f5f500f5f5f500ULL, 0xf9f9f900f9f9f900ULL, 0xb6b6b600b6b6b600ULL,
  834     0x2f2f2f002f2f2f00ULL, 0xfdfdfd00fdfdfd00ULL, 0xb4b4b400b4b4b400ULL,
  835     0x5959590059595900ULL, 0x7878780078787800ULL, 0x9898980098989800ULL,
  836     0x0606060006060600ULL, 0x6a6a6a006a6a6a00ULL, 0xe7e7e700e7e7e700ULL,
  837     0x4646460046464600ULL, 0x7171710071717100ULL, 0xbababa00bababa00ULL,
  838     0xd4d4d400d4d4d400ULL, 0x2525250025252500ULL, 0xababab00ababab00ULL,
  839     0x4242420042424200ULL, 0x8888880088888800ULL, 0xa2a2a200a2a2a200ULL,
  840     0x8d8d8d008d8d8d00ULL, 0xfafafa00fafafa00ULL, 0x7272720072727200ULL,
  841     0x0707070007070700ULL, 0xb9b9b900b9b9b900ULL, 0x5555550055555500ULL,
  842     0xf8f8f800f8f8f800ULL, 0xeeeeee00eeeeee00ULL, 0xacacac00acacac00ULL,
  843     0x0a0a0a000a0a0a00ULL, 0x3636360036363600ULL, 0x4949490049494900ULL,
  844     0x2a2a2a002a2a2a00ULL, 0x6868680068686800ULL, 0x3c3c3c003c3c3c00ULL,
  845     0x3838380038383800ULL, 0xf1f1f100f1f1f100ULL, 0xa4a4a400a4a4a400ULL,
  846     0x4040400040404000ULL, 0x2828280028282800ULL, 0xd3d3d300d3d3d300ULL,
  847     0x7b7b7b007b7b7b00ULL, 0xbbbbbb00bbbbbb00ULL, 0xc9c9c900c9c9c900ULL,
  848     0x4343430043434300ULL, 0xc1c1c100c1c1c100ULL, 0x1515150015151500ULL,
  849     0xe3e3e300e3e3e300ULL, 0xadadad00adadad00ULL, 0xf4f4f400f4f4f400ULL,
  850     0x7777770077777700ULL, 0xc7c7c700c7c7c700ULL, 0x8080800080808000ULL,
  851     0x9e9e9e009e9e9e00ULL,
  852 };
  853 
  854 
  855 /**
  856  * Stuff related to the Camellia key schedule
  857  */
  858 #define subl(x) subL[(x)]
  859 #define subr(x) subR[(x)]
  860 
  861 void camellia_set_key(const unsigned __int8 key[], unsigned __int8 *ks)
  862 {
  863     uint32 kll,klr,krl,krr;           /* left half of key */
  864     uint32 krll,krlr,krrl,krrr;       /* right half of key */
  865     uint32 il, ir, t0, t1, w0, w1;    /* temporary variables */
  866     uint32 kw4l, kw4r, dw, tl, tr;
  867     uint32 subL[34];
  868     uint32 subR[34];
  869      uint32 *subkey = (uint32*) ks;
  870     /**
  871      *  key = (kll || klr || krl || krr || krll || krlr || krrl || krrr)
  872      *  (|| is concatination)
  873      */
  874     kll  = GETU32(key     );
  875     klr  = GETU32(key +  4);
  876     krl  = GETU32(key +  8);
  877     krr  = GETU32(key + 12);
  878     krll = GETU32(key + 16);
  879     krlr = GETU32(key + 20);
  880     krrl = GETU32(key + 24);
  881     krrr = GETU32(key + 28);
  882     /* generate KL dependent subkeys */
  883     subl(0) = kll; subr(0) = klr;
  884     subl(1) = krl; subr(1) = krr;
  885     CAMELLIA_ROLDQo32(kll, klr, krl, krr, w0, w1, 45);
  886     subl(12) = kll; subr(12) = klr;
  887     subl(13) = krl; subr(13) = krr;
  888     CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 15);
  889     subl(16) = kll; subr(16) = klr;
  890     subl(17) = krl; subr(17) = krr;
  891     CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 17);
  892     subl(22) = kll; subr(22) = klr;
  893     subl(23) = krl; subr(23) = krr;
  894     CAMELLIA_ROLDQo32(kll, klr, krl, krr, w0, w1, 34);
  895     subl(30) = kll; subr(30) = klr;
  896     subl(31) = krl; subr(31) = krr;
  897     /* generate KR dependent subkeys */
  898     CAMELLIA_ROLDQ(krll, krlr, krrl, krrr, w0, w1, 15);
  899     subl(4) = krll; subr(4) = krlr;
  900     subl(5) = krrl; subr(5) = krrr;
  901     CAMELLIA_ROLDQ(krll, krlr, krrl, krrr, w0, w1, 15);
  902     subl(8) = krll; subr(8) = krlr;
  903     subl(9) = krrl; subr(9) = krrr;
  904     CAMELLIA_ROLDQ(krll, krlr, krrl, krrr, w0, w1, 30);
  905     subl(18) = krll; subr(18) = krlr;
  906     subl(19) = krrl; subr(19) = krrr;
  907     CAMELLIA_ROLDQo32(krll, krlr, krrl, krrr, w0, w1, 34);
  908     subl(26) = krll; subr(26) = krlr;
  909     subl(27) = krrl; subr(27) = krrr;
  910     CAMELLIA_ROLDQo32(krll, krlr, krrl, krrr, w0, w1, 34);
  911     /* generate KA */
  912     kll = subl(0) ^ krll; klr = subr(0) ^ krlr;
  913     krl = subl(1) ^ krrl; krr = subr(1) ^ krrr;
  914     CAMELLIA_F(kll, klr,
  915            CAMELLIA_SIGMA1L, CAMELLIA_SIGMA1R,
  916            w0, w1, il, ir, t0, t1);
  917     krl ^= w0; krr ^= w1;
  918     CAMELLIA_F(krl, krr,
  919            CAMELLIA_SIGMA2L, CAMELLIA_SIGMA2R,
  920            kll, klr, il, ir, t0, t1);
  921     kll ^= krll; klr ^= krlr;
  922     CAMELLIA_F(kll, klr,
  923            CAMELLIA_SIGMA3L, CAMELLIA_SIGMA3R,
  924            krl, krr, il, ir, t0, t1);
  925     krl ^= w0 ^ krrl; krr ^= w1 ^ krrr;
  926     CAMELLIA_F(krl, krr,
  927            CAMELLIA_SIGMA4L, CAMELLIA_SIGMA4R,
  928            w0, w1, il, ir, t0, t1);
  929     kll ^= w0; klr ^= w1;
  930     /* generate KB */
  931     krll ^= kll; krlr ^= klr;
  932     krrl ^= krl; krrr ^= krr;
  933     CAMELLIA_F(krll, krlr,
  934            CAMELLIA_SIGMA5L, CAMELLIA_SIGMA5R,
  935            w0, w1, il, ir, t0, t1);
  936     krrl ^= w0; krrr ^= w1;
  937     CAMELLIA_F(krrl, krrr,
  938            CAMELLIA_SIGMA6L, CAMELLIA_SIGMA6R,
  939            w0, w1, il, ir, t0, t1);
  940     krll ^= w0; krlr ^= w1;
  941     /* generate KA dependent subkeys */
  942     CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 15);
  943     subl(6) = kll; subr(6) = klr;
  944     subl(7) = krl; subr(7) = krr;
  945     CAMELLIA_ROLDQ(kll, klr, krl, krr, w0, w1, 30);
  946     subl(14) = kll; subr(14) = klr;
  947     subl(15) = krl; subr(15) = krr;
  948     subl(24) = klr; subr(24) = krl;
  949     subl(25) = krr; subr(25) = kll;
  950     CAMELLIA_ROLDQo32(kll, klr, krl, krr, w0, w1, 49);
  951     subl(28) = kll; subr(28) = klr;
  952     subl(29) = krl; subr(29) = krr;
  953     /* generate KB dependent subkeys */
  954     subl(2) = krll; subr(2) = krlr;
  955     subl(3) = krrl; subr(3) = krrr;
  956     CAMELLIA_ROLDQ(krll, krlr, krrl, krrr, w0, w1, 30);
  957     subl(10) = krll; subr(10) = krlr;
  958     subl(11) = krrl; subr(11) = krrr;
  959     CAMELLIA_ROLDQ(krll, krlr, krrl, krrr, w0, w1, 30);
  960     subl(20) = krll; subr(20) = krlr;
  961     subl(21) = krrl; subr(21) = krrr;
  962     CAMELLIA_ROLDQo32(krll, krlr, krrl, krrr, w0, w1, 51);
  963     subl(32) = krll; subr(32) = krlr;
  964     subl(33) = krrl; subr(33) = krrr;
  965     /* absorb kw2 to other subkeys */
  966     subl(3) ^= subl(1); subr(3) ^= subr(1);
  967     subl(5) ^= subl(1); subr(5) ^= subr(1);
  968     subl(7) ^= subl(1); subr(7) ^= subr(1);
  969     subl(1) ^= subr(1) & ~subr(9);
  970     dw = subl(1) & subl(9), subr(1) ^= CAMELLIA_RL1(dw);
  971     subl(11) ^= subl(1); subr(11) ^= subr(1);
  972     subl(13) ^= subl(1); subr(13) ^= subr(1);
  973     subl(15) ^= subl(1); subr(15) ^= subr(1);
  974     subl(1) ^= subr(1) & ~subr(17);
  975     dw = subl(1) & subl(17), subr(1) ^= CAMELLIA_RL1(dw);
  976     subl(19) ^= subl(1); subr(19) ^= subr(1);
  977     subl(21) ^= subl(1); subr(21) ^= subr(1);
  978     subl(23) ^= subl(1); subr(23) ^= subr(1);
  979     subl(1) ^= subr(1) & ~subr(25);
  980     dw = subl(1) & subl(25), subr(1) ^= CAMELLIA_RL1(dw);
  981     subl(27) ^= subl(1); subr(27) ^= subr(1);
  982     subl(29) ^= subl(1); subr(29) ^= subr(1);
  983     subl(31) ^= subl(1); subr(31) ^= subr(1);
  984     subl(32) ^= subl(1); subr(32) ^= subr(1);
  985     /* absorb kw4 to other subkeys */
  986     kw4l = subl(33); kw4r = subr(33);
  987     subl(30) ^= kw4l; subr(30) ^= kw4r;
  988     subl(28) ^= kw4l; subr(28) ^= kw4r;
  989     subl(26) ^= kw4l; subr(26) ^= kw4r;
  990     kw4l ^= kw4r & ~subr(24);
  991     dw = kw4l & subl(24), kw4r ^= CAMELLIA_RL1(dw);
  992     subl(22) ^= kw4l; subr(22) ^= kw4r;
  993     subl(20) ^= kw4l; subr(20) ^= kw4r;
  994     subl(18) ^= kw4l; subr(18) ^= kw4r;
  995     kw4l ^= kw4r & ~subr(16);
  996     dw = kw4l & subl(16), kw4r ^= CAMELLIA_RL1(dw);
  997     subl(14) ^= kw4l; subr(14) ^= kw4r;
  998     subl(12) ^= kw4l; subr(12) ^= kw4r;
  999     subl(10) ^= kw4l; subr(10) ^= kw4r;
 1000     kw4l ^= kw4r & ~subr(8);
 1001     dw = kw4l & subl(8), kw4r ^= CAMELLIA_RL1(dw);
 1002     subl(6) ^= kw4l; subr(6) ^= kw4r;
 1003     subl(4) ^= kw4l; subr(4) ^= kw4r;
 1004     subl(2) ^= kw4l; subr(2) ^= kw4r;
 1005     subl(0) ^= kw4l; subr(0) ^= kw4r;
 1006     /* key XOR is end of F-function */
 1007     CamelliaSubkeyL(0) = subl(0) ^ subl(2);
 1008     CamelliaSubkeyR(0) = subr(0) ^ subr(2);
 1009     CamelliaSubkeyL(2) = subl(3);
 1010     CamelliaSubkeyR(2) = subr(3);
 1011     CamelliaSubkeyL(3) = subl(2) ^ subl(4);
 1012     CamelliaSubkeyR(3) = subr(2) ^ subr(4);
 1013     CamelliaSubkeyL(4) = subl(3) ^ subl(5);
 1014     CamelliaSubkeyR(4) = subr(3) ^ subr(5);
 1015     CamelliaSubkeyL(5) = subl(4) ^ subl(6);
 1016     CamelliaSubkeyR(5) = subr(4) ^ subr(6);
 1017     CamelliaSubkeyL(6) = subl(5) ^ subl(7);
 1018     CamelliaSubkeyR(6) = subr(5) ^ subr(7);
 1019     tl = subl(10) ^ (subr(10) & ~subr(8));
 1020     dw = tl & subl(8), tr = subr(10) ^ CAMELLIA_RL1(dw);
 1021     CamelliaSubkeyL(7) = subl(6) ^ tl;
 1022     CamelliaSubkeyR(7) = subr(6) ^ tr;
 1023     CamelliaSubkeyL(8) = subl(8);
 1024     CamelliaSubkeyR(8) = subr(8);
 1025     CamelliaSubkeyL(9) = subl(9);
 1026     CamelliaSubkeyR(9) = subr(9);
 1027     tl = subl(7) ^ (subr(7) & ~subr(9));
 1028     dw = tl & subl(9), tr = subr(7) ^ CAMELLIA_RL1(dw);
 1029     CamelliaSubkeyL(10) = tl ^ subl(11);
 1030     CamelliaSubkeyR(10) = tr ^ subr(11);
 1031     CamelliaSubkeyL(11) = subl(10) ^ subl(12);
 1032     CamelliaSubkeyR(11) = subr(10) ^ subr(12);
 1033     CamelliaSubkeyL(12) = subl(11) ^ subl(13);
 1034     CamelliaSubkeyR(12) = subr(11) ^ subr(13);
 1035     CamelliaSubkeyL(13) = subl(12) ^ subl(14);
 1036     CamelliaSubkeyR(13) = subr(12) ^ subr(14);
 1037     CamelliaSubkeyL(14) = subl(13) ^ subl(15);
 1038     CamelliaSubkeyR(14) = subr(13) ^ subr(15);
 1039     tl = subl(18) ^ (subr(18) & ~subr(16));
 1040     dw = tl & subl(16), tr = subr(18) ^ CAMELLIA_RL1(dw);
 1041     CamelliaSubkeyL(15) = subl(14) ^ tl;
 1042     CamelliaSubkeyR(15) = subr(14) ^ tr;
 1043     CamelliaSubkeyL(16) = subl(16);
 1044     CamelliaSubkeyR(16) = subr(16);
 1045     CamelliaSubkeyL(17) = subl(17);
 1046     CamelliaSubkeyR(17) = subr(17);
 1047     tl = subl(15) ^ (subr(15) & ~subr(17));
 1048     dw = tl & subl(17), tr = subr(15) ^ CAMELLIA_RL1(dw);
 1049     CamelliaSubkeyL(18) = tl ^ subl(19);
 1050     CamelliaSubkeyR(18) = tr ^ subr(19);
 1051     CamelliaSubkeyL(19) = subl(18) ^ subl(20);
 1052     CamelliaSubkeyR(19) = subr(18) ^ subr(20);
 1053     CamelliaSubkeyL(20) = subl(19) ^ subl(21);
 1054     CamelliaSubkeyR(20) = subr(19) ^ subr(21);
 1055     CamelliaSubkeyL(21) = subl(20) ^ subl(22);
 1056     CamelliaSubkeyR(21) = subr(20) ^ subr(22);
 1057     CamelliaSubkeyL(22) = subl(21) ^ subl(23);
 1058     CamelliaSubkeyR(22) = subr(21) ^ subr(23);
 1059     tl = subl(26) ^ (subr(26) & ~subr(24));
 1060     dw = tl & subl(24), tr = subr(26) ^ CAMELLIA_RL1(dw);
 1061     CamelliaSubkeyL(23) = subl(22) ^ tl;
 1062     CamelliaSubkeyR(23) = subr(22) ^ tr;
 1063     CamelliaSubkeyL(24) = subl(24);
 1064     CamelliaSubkeyR(24) = subr(24);
 1065     CamelliaSubkeyL(25) = subl(25);
 1066     CamelliaSubkeyR(25) = subr(25);
 1067     tl = subl(23) ^ (subr(23) &  ~subr(25));
 1068     dw = tl & subl(25), tr = subr(23) ^ CAMELLIA_RL1(dw);
 1069     CamelliaSubkeyL(26) = tl ^ subl(27);
 1070     CamelliaSubkeyR(26) = tr ^ subr(27);
 1071     CamelliaSubkeyL(27) = subl(26) ^ subl(28);
 1072     CamelliaSubkeyR(27) = subr(26) ^ subr(28);
 1073     CamelliaSubkeyL(28) = subl(27) ^ subl(29);
 1074     CamelliaSubkeyR(28) = subr(27) ^ subr(29);
 1075     CamelliaSubkeyL(29) = subl(28) ^ subl(30);
 1076     CamelliaSubkeyR(29) = subr(28) ^ subr(30);
 1077     CamelliaSubkeyL(30) = subl(29) ^ subl(31);
 1078     CamelliaSubkeyR(30) = subr(29) ^ subr(31);
 1079     CamelliaSubkeyL(31) = subl(30);
 1080     CamelliaSubkeyR(31) = subr(30);
 1081     CamelliaSubkeyL(32) = subl(32) ^ subl(31);
 1082     CamelliaSubkeyR(32) = subr(32) ^ subr(31);
 1083     return;
 1084 }
 1085 
 1086 void camellia_encrypt(const unsigned __int8 *inBlock, unsigned __int8 *outBlock, unsigned __int8 *ks)
 1087 {
 1088     camellia_encrypt_asm (ks, outBlock, inBlock);
 1089 }
 1090 
 1091 void camellia_decrypt(const unsigned __int8 *inBlock,  unsigned __int8 *outBlock, unsigned __int8 *ks)
 1092 {
 1093     camellia_decrypt_asm (ks, outBlock, inBlock);
 1094 }
 1095 
 1096 void camellia_encrypt_blocks(unsigned __int8 *instance, const byte* in_blk, byte* out_blk, uint32 blockCount)
 1097 {
 1098 #if !defined (_UEFI)
 1099     if ((blockCount >= 16) && IsCpuIntel() && IsAesHwCpuSupported () && HasSAVX()) /* on AMD cpu, AVX is too slow */
 1100     {
 1101 #if defined (TC_WINDOWS_DRIVER)
 1102         XSTATE_SAVE SaveState;
 1103         if (NT_SUCCESS (KeSaveExtendedProcessorState(XSTATE_MASK_GSSE, &SaveState)))
 1104         {
 1105 #endif
 1106             while (blockCount >= 16)
 1107             {
 1108                 camellia_ecb_enc_16way (instance, out_blk, in_blk);
 1109                 out_blk += 16 * 16;
 1110                 in_blk += 16 * 16;
 1111                 blockCount -= 16;
 1112             }
 1113 #if defined (TC_WINDOWS_DRIVER)
 1114             KeRestoreExtendedProcessorState(&SaveState);
 1115         }
 1116 #endif
 1117     }
 1118 #endif
 1119 
 1120     while (blockCount >= 2)
 1121     {
 1122         camellia_enc_blk2 (instance, out_blk, in_blk);
 1123         out_blk += 2 * 16;
 1124         in_blk += 2 * 16;
 1125         blockCount -= 2;
 1126     }
 1127     
 1128     if (blockCount)
 1129         camellia_encrypt (in_blk, out_blk, instance);       
 1130 }
 1131 
 1132 void camellia_decrypt_blocks(unsigned __int8 *instance, const byte* in_blk, byte* out_blk, uint32 blockCount)
 1133 {
 1134 #if !defined (_UEFI)
 1135     if ((blockCount >= 16) && IsCpuIntel() && IsAesHwCpuSupported () && HasSAVX()) /* on AMD cpu, AVX is too slow */
 1136     {
 1137 #if defined (TC_WINDOWS_DRIVER)
 1138         XSTATE_SAVE SaveState;
 1139         if (NT_SUCCESS (KeSaveExtendedProcessorState(XSTATE_MASK_GSSE, &SaveState)))
 1140         {
 1141 #endif
 1142         while (blockCount >= 16)
 1143         {
 1144             camellia_ecb_dec_16way (instance, out_blk, in_blk);
 1145             out_blk += 16 * 16;
 1146             in_blk += 16 * 16;
 1147             blockCount -= 16;
 1148         }
 1149 #if defined (TC_WINDOWS_DRIVER)
 1150             KeRestoreExtendedProcessorState(&SaveState);
 1151         }
 1152 #endif
 1153     }
 1154 #endif
 1155 
 1156     while (blockCount >= 2)
 1157     {
 1158         camellia_dec_blk2 (instance, out_blk, in_blk);
 1159         out_blk += 2 * 16;
 1160         in_blk += 2 * 16;
 1161         blockCount -= 2;
 1162     }
 1163     
 1164     if (blockCount)
 1165         camellia_decrypt (in_blk, out_blk, instance);       
 1166 }
 1167 
 1168 #else
 1169 
 1170 /*
 1171 This code is written by kerukuro for cppcrypto library (http://cppcrypto.sourceforge.net/)
 1172 and released into public domain.
 1173 */
 1174 
 1175 /* Adapted for VeraCrypt */
 1176 
 1177 //#define CPPCRYPTO_DEBUG
 1178 
 1179 static const uint64 S[8][256] = {
 1180         {
 1181             LL(0x7070700070000070), LL(0x8282820082000082), LL(0x2c2c2c002c00002c), LL(0xececec00ec0000ec), LL(0xb3b3b300b30000b3), LL(0x2727270027000027), LL(0xc0c0c000c00000c0), LL(0xe5e5e500e50000e5), 
 1182             LL(0xe4e4e400e40000e4), LL(0x8585850085000085), LL(0x5757570057000057), LL(0x3535350035000035), LL(0xeaeaea00ea0000ea), LL(0x0c0c0c000c00000c), LL(0xaeaeae00ae0000ae), LL(0x4141410041000041), 
 1183             LL(0x2323230023000023), LL(0xefefef00ef0000ef), LL(0x6b6b6b006b00006b), LL(0x9393930093000093), LL(0x4545450045000045), LL(0x1919190019000019), LL(0xa5a5a500a50000a5), LL(0x2121210021000021), 
 1184             LL(0xededed00ed0000ed), LL(0x0e0e0e000e00000e), LL(0x4f4f4f004f00004f), LL(0x4e4e4e004e00004e), LL(0x1d1d1d001d00001d), LL(0x6565650065000065), LL(0x9292920092000092), LL(0xbdbdbd00bd0000bd), 
 1185             LL(0x8686860086000086), LL(0xb8b8b800b80000b8), LL(0xafafaf00af0000af), LL(0x8f8f8f008f00008f), LL(0x7c7c7c007c00007c), LL(0xebebeb00eb0000eb), LL(0x1f1f1f001f00001f), LL(0xcecece00ce0000ce), 
 1186             LL(0x3e3e3e003e00003e), LL(0x3030300030000030), LL(0xdcdcdc00dc0000dc), LL(0x5f5f5f005f00005f), LL(0x5e5e5e005e00005e), LL(0xc5c5c500c50000c5), LL(0x0b0b0b000b00000b), LL(0x1a1a1a001a00001a), 
 1187             LL(0xa6a6a600a60000a6), LL(0xe1e1e100e10000e1), LL(0x3939390039000039), LL(0xcacaca00ca0000ca), LL(0xd5d5d500d50000d5), LL(0x4747470047000047), LL(0x5d5d5d005d00005d), LL(0x3d3d3d003d00003d), 
 1188             LL(0xd9d9d900d90000d9), LL(0x0101010001000001), LL(0x5a5a5a005a00005a), LL(0xd6d6d600d60000d6), LL(0x5151510051000051), LL(0x5656560056000056), LL(0x6c6c6c006c00006c), LL(0x4d4d4d004d00004d), 
 1189             LL(0x8b8b8b008b00008b), LL(0x0d0d0d000d00000d), LL(0x9a9a9a009a00009a), LL(0x6666660066000066), LL(0xfbfbfb00fb0000fb), LL(0xcccccc00cc0000cc), LL(0xb0b0b000b00000b0), LL(0x2d2d2d002d00002d), 
 1190             LL(0x7474740074000074), LL(0x1212120012000012), LL(0x2b2b2b002b00002b), LL(0x2020200020000020), LL(0xf0f0f000f00000f0), LL(0xb1b1b100b10000b1), LL(0x8484840084000084), LL(0x9999990099000099), 
 1191             LL(0xdfdfdf00df0000df), LL(0x4c4c4c004c00004c), LL(0xcbcbcb00cb0000cb), LL(0xc2c2c200c20000c2), LL(0x3434340034000034), LL(0x7e7e7e007e00007e), LL(0x7676760076000076), LL(0x0505050005000005), 
 1192             LL(0x6d6d6d006d00006d), LL(0xb7b7b700b70000b7), LL(0xa9a9a900a90000a9), LL(0x3131310031000031), LL(0xd1d1d100d10000d1), LL(0x1717170017000017), LL(0x0404040004000004), LL(0xd7d7d700d70000d7), 
 1193             LL(0x1414140014000014), LL(0x5858580058000058), LL(0x3a3a3a003a00003a), LL(0x6161610061000061), LL(0xdedede00de0000de), LL(0x1b1b1b001b00001b), LL(0x1111110011000011), LL(0x1c1c1c001c00001c), 
 1194             LL(0x3232320032000032), LL(0x0f0f0f000f00000f), LL(0x9c9c9c009c00009c), LL(0x1616160016000016), LL(0x5353530053000053), LL(0x1818180018000018), LL(0xf2f2f200f20000f2), LL(0x2222220022000022), 
 1195             LL(0xfefefe00fe0000fe), LL(0x4444440044000044), LL(0xcfcfcf00cf0000cf), LL(0xb2b2b200b20000b2), LL(0xc3c3c300c30000c3), LL(0xb5b5b500b50000b5), LL(0x7a7a7a007a00007a), LL(0x9191910091000091), 
 1196             LL(0x2424240024000024), LL(0x0808080008000008), LL(0xe8e8e800e80000e8), LL(0xa8a8a800a80000a8), LL(0x6060600060000060), LL(0xfcfcfc00fc0000fc), LL(0x6969690069000069), LL(0x5050500050000050), 
 1197             LL(0xaaaaaa00aa0000aa), LL(0xd0d0d000d00000d0), LL(0xa0a0a000a00000a0), LL(0x7d7d7d007d00007d), LL(0xa1a1a100a10000a1), LL(0x8989890089000089), LL(0x6262620062000062), LL(0x9797970097000097), 
 1198             LL(0x5454540054000054), LL(0x5b5b5b005b00005b), LL(0x1e1e1e001e00001e), LL(0x9595950095000095), LL(0xe0e0e000e00000e0), LL(0xffffff00ff0000ff), LL(0x6464640064000064), LL(0xd2d2d200d20000d2), 
 1199             LL(0x1010100010000010), LL(0xc4c4c400c40000c4), LL(0x0000000000000000), LL(0x4848480048000048), LL(0xa3a3a300a30000a3), LL(0xf7f7f700f70000f7), LL(0x7575750075000075), LL(0xdbdbdb00db0000db), 
 1200             LL(0x8a8a8a008a00008a), LL(0x0303030003000003), LL(0xe6e6e600e60000e6), LL(0xdadada00da0000da), LL(0x0909090009000009), LL(0x3f3f3f003f00003f), LL(0xdddddd00dd0000dd), LL(0x9494940094000094), 
 1201             LL(0x8787870087000087), LL(0x5c5c5c005c00005c), LL(0x8383830083000083), LL(0x0202020002000002), LL(0xcdcdcd00cd0000cd), LL(0x4a4a4a004a00004a), LL(0x9090900090000090), LL(0x3333330033000033), 
 1202             LL(0x7373730073000073), LL(0x6767670067000067), LL(0xf6f6f600f60000f6), LL(0xf3f3f300f30000f3), LL(0x9d9d9d009d00009d), LL(0x7f7f7f007f00007f), LL(0xbfbfbf00bf0000bf), LL(0xe2e2e200e20000e2), 
 1203             LL(0x5252520052000052), LL(0x9b9b9b009b00009b), LL(0xd8d8d800d80000d8), LL(0x2626260026000026), LL(0xc8c8c800c80000c8), LL(0x3737370037000037), LL(0xc6c6c600c60000c6), LL(0x3b3b3b003b00003b), 
 1204             LL(0x8181810081000081), LL(0x9696960096000096), LL(0x6f6f6f006f00006f), LL(0x4b4b4b004b00004b), LL(0x1313130013000013), LL(0xbebebe00be0000be), LL(0x6363630063000063), LL(0x2e2e2e002e00002e), 
 1205             LL(0xe9e9e900e90000e9), LL(0x7979790079000079), LL(0xa7a7a700a70000a7), LL(0x8c8c8c008c00008c), LL(0x9f9f9f009f00009f), LL(0x6e6e6e006e00006e), LL(0xbcbcbc00bc0000bc), LL(0x8e8e8e008e00008e), 
 1206             LL(0x2929290029000029), LL(0xf5f5f500f50000f5), LL(0xf9f9f900f90000f9), LL(0xb6b6b600b60000b6), LL(0x2f2f2f002f00002f), LL(0xfdfdfd00fd0000fd), LL(0xb4b4b400b40000b4), LL(0x5959590059000059), 
 1207             LL(0x7878780078000078), LL(0x9898980098000098), LL(0x0606060006000006), LL(0x6a6a6a006a00006a), LL(0xe7e7e700e70000e7), LL(0x4646460046000046), LL(0x7171710071000071), LL(0xbababa00ba0000ba), 
 1208             LL(0xd4d4d400d40000d4), LL(0x2525250025000025), LL(0xababab00ab0000ab), LL(0x4242420042000042), LL(0x8888880088000088), LL(0xa2a2a200a20000a2), LL(0x8d8d8d008d00008d), LL(0xfafafa00fa0000fa), 
 1209             LL(0x7272720072000072), LL(0x0707070007000007), LL(0xb9b9b900b90000b9), LL(0x5555550055000055), LL(0xf8f8f800f80000f8), LL(0xeeeeee00ee0000ee), LL(0xacacac00ac0000ac), LL(0x0a0a0a000a00000a), 
 1210             LL(0x3636360036000036), LL(0x4949490049000049), LL(0x2a2a2a002a00002a), LL(0x6868680068000068), LL(0x3c3c3c003c00003c), LL(0x3838380038000038), LL(0xf1f1f100f10000f1), LL(0xa4a4a400a40000a4), 
 1211             LL(0x4040400040000040), LL(0x2828280028000028), LL(0xd3d3d300d30000d3), LL(0x7b7b7b007b00007b), LL(0xbbbbbb00bb0000bb), LL(0xc9c9c900c90000c9), LL(0x4343430043000043), LL(0xc1c1c100c10000c1), 
 1212             LL(0x1515150015000015), LL(0xe3e3e300e30000e3), LL(0xadadad00ad0000ad), LL(0xf4f4f400f40000f4), LL(0x7777770077000077), LL(0xc7c7c700c70000c7), LL(0x8080800080000080), LL(0x9e9e9e009e00009e)
 1213         },
 1214         {
 1215             LL(0x00e0e0e0e0e00000), LL(0x0005050505050000), LL(0x0058585858580000), LL(0x00d9d9d9d9d90000), LL(0x0067676767670000), LL(0x004e4e4e4e4e0000), LL(0x0081818181810000), LL(0x00cbcbcbcbcb0000), 
 1216             LL(0x00c9c9c9c9c90000), LL(0x000b0b0b0b0b0000), LL(0x00aeaeaeaeae0000), LL(0x006a6a6a6a6a0000), LL(0x00d5d5d5d5d50000), LL(0x0018181818180000), LL(0x005d5d5d5d5d0000), LL(0x0082828282820000), 
 1217             LL(0x0046464646460000), LL(0x00dfdfdfdfdf0000), LL(0x00d6d6d6d6d60000), LL(0x0027272727270000), LL(0x008a8a8a8a8a0000), LL(0x0032323232320000), LL(0x004b4b4b4b4b0000), LL(0x0042424242420000), 
 1218             LL(0x00dbdbdbdbdb0000), LL(0x001c1c1c1c1c0000), LL(0x009e9e9e9e9e0000), LL(0x009c9c9c9c9c0000), LL(0x003a3a3a3a3a0000), LL(0x00cacacacaca0000), LL(0x0025252525250000), LL(0x007b7b7b7b7b0000), 
 1219             LL(0x000d0d0d0d0d0000), LL(0x0071717171710000), LL(0x005f5f5f5f5f0000), LL(0x001f1f1f1f1f0000), LL(0x00f8f8f8f8f80000), LL(0x00d7d7d7d7d70000), LL(0x003e3e3e3e3e0000), LL(0x009d9d9d9d9d0000), 
 1220             LL(0x007c7c7c7c7c0000), LL(0x0060606060600000), LL(0x00b9b9b9b9b90000), LL(0x00bebebebebe0000), LL(0x00bcbcbcbcbc0000), LL(0x008b8b8b8b8b0000), LL(0x0016161616160000), LL(0x0034343434340000), 
 1221             LL(0x004d4d4d4d4d0000), LL(0x00c3c3c3c3c30000), LL(0x0072727272720000), LL(0x0095959595950000), LL(0x00ababababab0000), LL(0x008e8e8e8e8e0000), LL(0x00bababababa0000), LL(0x007a7a7a7a7a0000), 
 1222             LL(0x00b3b3b3b3b30000), LL(0x0002020202020000), LL(0x00b4b4b4b4b40000), LL(0x00adadadadad0000), LL(0x00a2a2a2a2a20000), LL(0x00acacacacac0000), LL(0x00d8d8d8d8d80000), LL(0x009a9a9a9a9a0000), 
 1223             LL(0x0017171717170000), LL(0x001a1a1a1a1a0000), LL(0x0035353535350000), LL(0x00cccccccccc0000), LL(0x00f7f7f7f7f70000), LL(0x0099999999990000), LL(0x0061616161610000), LL(0x005a5a5a5a5a0000), 
 1224             LL(0x00e8e8e8e8e80000), LL(0x0024242424240000), LL(0x0056565656560000), LL(0x0040404040400000), LL(0x00e1e1e1e1e10000), LL(0x0063636363630000), LL(0x0009090909090000), LL(0x0033333333330000), 
 1225             LL(0x00bfbfbfbfbf0000), LL(0x0098989898980000), LL(0x0097979797970000), LL(0x0085858585850000), LL(0x0068686868680000), LL(0x00fcfcfcfcfc0000), LL(0x00ececececec0000), LL(0x000a0a0a0a0a0000), 
 1226             LL(0x00dadadadada0000), LL(0x006f6f6f6f6f0000), LL(0x0053535353530000), LL(0x0062626262620000), LL(0x00a3a3a3a3a30000), LL(0x002e2e2e2e2e0000), LL(0x0008080808080000), LL(0x00afafafafaf0000), 
 1227             LL(0x0028282828280000), LL(0x00b0b0b0b0b00000), LL(0x0074747474740000), LL(0x00c2c2c2c2c20000), LL(0x00bdbdbdbdbd0000), LL(0x0036363636360000), LL(0x0022222222220000), LL(0x0038383838380000), 
 1228             LL(0x0064646464640000), LL(0x001e1e1e1e1e0000), LL(0x0039393939390000), LL(0x002c2c2c2c2c0000), LL(0x00a6a6a6a6a60000), LL(0x0030303030300000), LL(0x00e5e5e5e5e50000), LL(0x0044444444440000), 
 1229             LL(0x00fdfdfdfdfd0000), LL(0x0088888888880000), LL(0x009f9f9f9f9f0000), LL(0x0065656565650000), LL(0x0087878787870000), LL(0x006b6b6b6b6b0000), LL(0x00f4f4f4f4f40000), LL(0x0023232323230000), 
 1230             LL(0x0048484848480000), LL(0x0010101010100000), LL(0x00d1d1d1d1d10000), LL(0x0051515151510000), LL(0x00c0c0c0c0c00000), LL(0x00f9f9f9f9f90000), LL(0x00d2d2d2d2d20000), LL(0x00a0a0a0a0a00000), 
 1231             LL(0x0055555555550000), LL(0x00a1a1a1a1a10000), LL(0x0041414141410000), LL(0x00fafafafafa0000), LL(0x0043434343430000), LL(0x0013131313130000), LL(0x00c4c4c4c4c40000), LL(0x002f2f2f2f2f0000), 
 1232             LL(0x00a8a8a8a8a80000), LL(0x00b6b6b6b6b60000), LL(0x003c3c3c3c3c0000), LL(0x002b2b2b2b2b0000), LL(0x00c1c1c1c1c10000), LL(0x00ffffffffff0000), LL(0x00c8c8c8c8c80000), LL(0x00a5a5a5a5a50000), 
 1233             LL(0x0020202020200000), LL(0x0089898989890000), LL(0x0000000000000000), LL(0x0090909090900000), LL(0x0047474747470000), LL(0x00efefefefef0000), LL(0x00eaeaeaeaea0000), LL(0x00b7b7b7b7b70000), 
 1234             LL(0x0015151515150000), LL(0x0006060606060000), LL(0x00cdcdcdcdcd0000), LL(0x00b5b5b5b5b50000), LL(0x0012121212120000), LL(0x007e7e7e7e7e0000), LL(0x00bbbbbbbbbb0000), LL(0x0029292929290000), 
 1235             LL(0x000f0f0f0f0f0000), LL(0x00b8b8b8b8b80000), LL(0x0007070707070000), LL(0x0004040404040000), LL(0x009b9b9b9b9b0000), LL(0x0094949494940000), LL(0x0021212121210000), LL(0x0066666666660000), 
 1236             LL(0x00e6e6e6e6e60000), LL(0x00cecececece0000), LL(0x00ededededed0000), LL(0x00e7e7e7e7e70000), LL(0x003b3b3b3b3b0000), LL(0x00fefefefefe0000), LL(0x007f7f7f7f7f0000), LL(0x00c5c5c5c5c50000), 
 1237             LL(0x00a4a4a4a4a40000), LL(0x0037373737370000), LL(0x00b1b1b1b1b10000), LL(0x004c4c4c4c4c0000), LL(0x0091919191910000), LL(0x006e6e6e6e6e0000), LL(0x008d8d8d8d8d0000), LL(0x0076767676760000), 
 1238             LL(0x0003030303030000), LL(0x002d2d2d2d2d0000), LL(0x00dedededede0000), LL(0x0096969696960000), LL(0x0026262626260000), LL(0x007d7d7d7d7d0000), LL(0x00c6c6c6c6c60000), LL(0x005c5c5c5c5c0000), 
 1239             LL(0x00d3d3d3d3d30000), LL(0x00f2f2f2f2f20000), LL(0x004f4f4f4f4f0000), LL(0x0019191919190000), LL(0x003f3f3f3f3f0000), LL(0x00dcdcdcdcdc0000), LL(0x0079797979790000), LL(0x001d1d1d1d1d0000), 
 1240             LL(0x0052525252520000), LL(0x00ebebebebeb0000), LL(0x00f3f3f3f3f30000), LL(0x006d6d6d6d6d0000), LL(0x005e5e5e5e5e0000), LL(0x00fbfbfbfbfb0000), LL(0x0069696969690000), LL(0x00b2b2b2b2b20000), 
 1241             LL(0x00f0f0f0f0f00000), LL(0x0031313131310000), LL(0x000c0c0c0c0c0000), LL(0x00d4d4d4d4d40000), LL(0x00cfcfcfcfcf0000), LL(0x008c8c8c8c8c0000), LL(0x00e2e2e2e2e20000), LL(0x0075757575750000), 
 1242             LL(0x00a9a9a9a9a90000), LL(0x004a4a4a4a4a0000), LL(0x0057575757570000), LL(0x0084848484840000), LL(0x0011111111110000), LL(0x0045454545450000), LL(0x001b1b1b1b1b0000), LL(0x00f5f5f5f5f50000), 
 1243             LL(0x00e4e4e4e4e40000), LL(0x000e0e0e0e0e0000), LL(0x0073737373730000), LL(0x00aaaaaaaaaa0000), LL(0x00f1f1f1f1f10000), LL(0x00dddddddddd0000), LL(0x0059595959590000), LL(0x0014141414140000), 
 1244             LL(0x006c6c6c6c6c0000), LL(0x0092929292920000), LL(0x0054545454540000), LL(0x00d0d0d0d0d00000), LL(0x0078787878780000), LL(0x0070707070700000), LL(0x00e3e3e3e3e30000), LL(0x0049494949490000), 
 1245             LL(0x0080808080800000), LL(0x0050505050500000), LL(0x00a7a7a7a7a70000), LL(0x00f6f6f6f6f60000), LL(0x0077777777770000), LL(0x0093939393930000), LL(0x0086868686860000), LL(0x0083838383830000), 
 1246             LL(0x002a2a2a2a2a0000), LL(0x00c7c7c7c7c70000), LL(0x005b5b5b5b5b0000), LL(0x00e9e9e9e9e90000), LL(0x00eeeeeeeeee0000), LL(0x008f8f8f8f8f0000), LL(0x0001010101010000), LL(0x003d3d3d3d3d0000)
 1247         },
 1248         {
 1249             LL(0x3800383800383800), LL(0x4100414100414100), LL(0x1600161600161600), LL(0x7600767600767600), LL(0xd900d9d900d9d900), LL(0x9300939300939300), LL(0x6000606000606000), LL(0xf200f2f200f2f200), 
 1250             LL(0x7200727200727200), LL(0xc200c2c200c2c200), LL(0xab00abab00abab00), LL(0x9a009a9a009a9a00), LL(0x7500757500757500), LL(0x0600060600060600), LL(0x5700575700575700), LL(0xa000a0a000a0a000), 
 1251             LL(0x9100919100919100), LL(0xf700f7f700f7f700), LL(0xb500b5b500b5b500), LL(0xc900c9c900c9c900), LL(0xa200a2a200a2a200), LL(0x8c008c8c008c8c00), LL(0xd200d2d200d2d200), LL(0x9000909000909000), 
 1252             LL(0xf600f6f600f6f600), LL(0x0700070700070700), LL(0xa700a7a700a7a700), LL(0x2700272700272700), LL(0x8e008e8e008e8e00), LL(0xb200b2b200b2b200), LL(0x4900494900494900), LL(0xde00dede00dede00), 
 1253             LL(0x4300434300434300), LL(0x5c005c5c005c5c00), LL(0xd700d7d700d7d700), LL(0xc700c7c700c7c700), LL(0x3e003e3e003e3e00), LL(0xf500f5f500f5f500), LL(0x8f008f8f008f8f00), LL(0x6700676700676700), 
 1254             LL(0x1f001f1f001f1f00), LL(0x1800181800181800), LL(0x6e006e6e006e6e00), LL(0xaf00afaf00afaf00), LL(0x2f002f2f002f2f00), LL(0xe200e2e200e2e200), LL(0x8500858500858500), LL(0x0d000d0d000d0d00), 
 1255             LL(0x5300535300535300), LL(0xf000f0f000f0f000), LL(0x9c009c9c009c9c00), LL(0x6500656500656500), LL(0xea00eaea00eaea00), LL(0xa300a3a300a3a300), LL(0xae00aeae00aeae00), LL(0x9e009e9e009e9e00), 
 1256             LL(0xec00ecec00ecec00), LL(0x8000808000808000), LL(0x2d002d2d002d2d00), LL(0x6b006b6b006b6b00), LL(0xa800a8a800a8a800), LL(0x2b002b2b002b2b00), LL(0x3600363600363600), LL(0xa600a6a600a6a600), 
 1257             LL(0xc500c5c500c5c500), LL(0x8600868600868600), LL(0x4d004d4d004d4d00), LL(0x3300333300333300), LL(0xfd00fdfd00fdfd00), LL(0x6600666600666600), LL(0x5800585800585800), LL(0x9600969600969600), 
 1258             LL(0x3a003a3a003a3a00), LL(0x0900090900090900), LL(0x9500959500959500), LL(0x1000101000101000), LL(0x7800787800787800), LL(0xd800d8d800d8d800), LL(0x4200424200424200), LL(0xcc00cccc00cccc00), 
 1259             LL(0xef00efef00efef00), LL(0x2600262600262600), LL(0xe500e5e500e5e500), LL(0x6100616100616100), LL(0x1a001a1a001a1a00), LL(0x3f003f3f003f3f00), LL(0x3b003b3b003b3b00), LL(0x8200828200828200), 
 1260             LL(0xb600b6b600b6b600), LL(0xdb00dbdb00dbdb00), LL(0xd400d4d400d4d400), LL(0x9800989800989800), LL(0xe800e8e800e8e800), LL(0x8b008b8b008b8b00), LL(0x0200020200020200), LL(0xeb00ebeb00ebeb00), 
 1261             LL(0x0a000a0a000a0a00), LL(0x2c002c2c002c2c00), LL(0x1d001d1d001d1d00), LL(0xb000b0b000b0b000), LL(0x6f006f6f006f6f00), LL(0x8d008d8d008d8d00), LL(0x8800888800888800), LL(0x0e000e0e000e0e00), 
 1262             LL(0x1900191900191900), LL(0x8700878700878700), LL(0x4e004e4e004e4e00), LL(0x0b000b0b000b0b00), LL(0xa900a9a900a9a900), LL(0x0c000c0c000c0c00), LL(0x7900797900797900), LL(0x1100111100111100), 
 1263             LL(0x7f007f7f007f7f00), LL(0x2200222200222200), LL(0xe700e7e700e7e700), LL(0x5900595900595900), LL(0xe100e1e100e1e100), LL(0xda00dada00dada00), LL(0x3d003d3d003d3d00), LL(0xc800c8c800c8c800), 
 1264             LL(0x1200121200121200), LL(0x0400040400040400), LL(0x7400747400747400), LL(0x5400545400545400), LL(0x3000303000303000), LL(0x7e007e7e007e7e00), LL(0xb400b4b400b4b400), LL(0x2800282800282800), 
 1265             LL(0x5500555500555500), LL(0x6800686800686800), LL(0x5000505000505000), LL(0xbe00bebe00bebe00), LL(0xd000d0d000d0d000), LL(0xc400c4c400c4c400), LL(0x3100313100313100), LL(0xcb00cbcb00cbcb00), 
 1266             LL(0x2a002a2a002a2a00), LL(0xad00adad00adad00), LL(0x0f000f0f000f0f00), LL(0xca00caca00caca00), LL(0x7000707000707000), LL(0xff00ffff00ffff00), LL(0x3200323200323200), LL(0x6900696900696900), 
 1267             LL(0x0800080800080800), LL(0x6200626200626200), LL(0x0000000000000000), LL(0x2400242400242400), LL(0xd100d1d100d1d100), LL(0xfb00fbfb00fbfb00), LL(0xba00baba00baba00), LL(0xed00eded00eded00), 
 1268             LL(0x4500454500454500), LL(0x8100818100818100), LL(0x7300737300737300), LL(0x6d006d6d006d6d00), LL(0x8400848400848400), LL(0x9f009f9f009f9f00), LL(0xee00eeee00eeee00), LL(0x4a004a4a004a4a00), 
 1269             LL(0xc300c3c300c3c300), LL(0x2e002e2e002e2e00), LL(0xc100c1c100c1c100), LL(0x0100010100010100), LL(0xe600e6e600e6e600), LL(0x2500252500252500), LL(0x4800484800484800), LL(0x9900999900999900), 
 1270             LL(0xb900b9b900b9b900), LL(0xb300b3b300b3b300), LL(0x7b007b7b007b7b00), LL(0xf900f9f900f9f900), LL(0xce00cece00cece00), LL(0xbf00bfbf00bfbf00), LL(0xdf00dfdf00dfdf00), LL(0x7100717100717100), 
 1271             LL(0x2900292900292900), LL(0xcd00cdcd00cdcd00), LL(0x6c006c6c006c6c00), LL(0x1300131300131300), LL(0x6400646400646400), LL(0x9b009b9b009b9b00), LL(0x6300636300636300), LL(0x9d009d9d009d9d00), 
 1272             LL(0xc000c0c000c0c000), LL(0x4b004b4b004b4b00), LL(0xb700b7b700b7b700), LL(0xa500a5a500a5a500), LL(0x8900898900898900), LL(0x5f005f5f005f5f00), LL(0xb100b1b100b1b100), LL(0x1700171700171700), 
 1273             LL(0xf400f4f400f4f400), LL(0xbc00bcbc00bcbc00), LL(0xd300d3d300d3d300), LL(0x4600464600464600), LL(0xcf00cfcf00cfcf00), LL(0x3700373700373700), LL(0x5e005e5e005e5e00), LL(0x4700474700474700), 
 1274             LL(0x9400949400949400), LL(0xfa00fafa00fafa00), LL(0xfc00fcfc00fcfc00), LL(0x5b005b5b005b5b00), LL(0x9700979700979700), LL(0xfe00fefe00fefe00), LL(0x5a005a5a005a5a00), LL(0xac00acac00acac00), 
 1275             LL(0x3c003c3c003c3c00), LL(0x4c004c4c004c4c00), LL(0x0300030300030300), LL(0x3500353500353500), LL(0xf300f3f300f3f300), LL(0x2300232300232300), LL(0xb800b8b800b8b800), LL(0x5d005d5d005d5d00), 
 1276             LL(0x6a006a6a006a6a00), LL(0x9200929200929200), LL(0xd500d5d500d5d500), LL(0x2100212100212100), LL(0x4400444400444400), LL(0x5100515100515100), LL(0xc600c6c600c6c600), LL(0x7d007d7d007d7d00), 
 1277             LL(0x3900393900393900), LL(0x8300838300838300), LL(0xdc00dcdc00dcdc00), LL(0xaa00aaaa00aaaa00), LL(0x7c007c7c007c7c00), LL(0x7700777700777700), LL(0x5600565600565600), LL(0x0500050500050500), 
 1278             LL(0x1b001b1b001b1b00), LL(0xa400a4a400a4a400), LL(0x1500151500151500), LL(0x3400343400343400), LL(0x1e001e1e001e1e00), LL(0x1c001c1c001c1c00), LL(0xf800f8f800f8f800), LL(0x5200525200525200), 
 1279             LL(0x2000202000202000), LL(0x1400141400141400), LL(0xe900e9e900e9e900), LL(0xbd00bdbd00bdbd00), LL(0xdd00dddd00dddd00), LL(0xe400e4e400e4e400), LL(0xa100a1a100a1a100), LL(0xe000e0e000e0e000), 
 1280             LL(0x8a008a8a008a8a00), LL(0xf100f1f100f1f100), LL(0xd600d6d600d6d600), LL(0x7a007a7a007a7a00), LL(0xbb00bbbb00bbbb00), LL(0xe300e3e300e3e300), LL(0x4000404000404000), LL(0x4f004f4f004f4f00)
 1281         },
 1282         {
 1283             LL(0x7070007000007070), LL(0x2c2c002c00002c2c), LL(0xb3b300b30000b3b3), LL(0xc0c000c00000c0c0), LL(0xe4e400e40000e4e4), LL(0x5757005700005757), LL(0xeaea00ea0000eaea), LL(0xaeae00ae0000aeae), 
 1284             LL(0x2323002300002323), LL(0x6b6b006b00006b6b), LL(0x4545004500004545), LL(0xa5a500a50000a5a5), LL(0xeded00ed0000eded), LL(0x4f4f004f00004f4f), LL(0x1d1d001d00001d1d), LL(0x9292009200009292), 
 1285             LL(0x8686008600008686), LL(0xafaf00af0000afaf), LL(0x7c7c007c00007c7c), LL(0x1f1f001f00001f1f), LL(0x3e3e003e00003e3e), LL(0xdcdc00dc0000dcdc), LL(0x5e5e005e00005e5e), LL(0x0b0b000b00000b0b), 
 1286             LL(0xa6a600a60000a6a6), LL(0x3939003900003939), LL(0xd5d500d50000d5d5), LL(0x5d5d005d00005d5d), LL(0xd9d900d90000d9d9), LL(0x5a5a005a00005a5a), LL(0x5151005100005151), LL(0x6c6c006c00006c6c), 
 1287             LL(0x8b8b008b00008b8b), LL(0x9a9a009a00009a9a), LL(0xfbfb00fb0000fbfb), LL(0xb0b000b00000b0b0), LL(0x7474007400007474), LL(0x2b2b002b00002b2b), LL(0xf0f000f00000f0f0), LL(0x8484008400008484), 
 1288             LL(0xdfdf00df0000dfdf), LL(0xcbcb00cb0000cbcb), LL(0x3434003400003434), LL(0x7676007600007676), LL(0x6d6d006d00006d6d), LL(0xa9a900a90000a9a9), LL(0xd1d100d10000d1d1), LL(0x0404000400000404), 
 1289             LL(0x1414001400001414), LL(0x3a3a003a00003a3a), LL(0xdede00de0000dede), LL(0x1111001100001111), LL(0x3232003200003232), LL(0x9c9c009c00009c9c), LL(0x5353005300005353), LL(0xf2f200f20000f2f2), 
 1290             LL(0xfefe00fe0000fefe), LL(0xcfcf00cf0000cfcf), LL(0xc3c300c30000c3c3), LL(0x7a7a007a00007a7a), LL(0x2424002400002424), LL(0xe8e800e80000e8e8), LL(0x6060006000006060), LL(0x6969006900006969), 
 1291             LL(0xaaaa00aa0000aaaa), LL(0xa0a000a00000a0a0), LL(0xa1a100a10000a1a1), LL(0x6262006200006262), LL(0x5454005400005454), LL(0x1e1e001e00001e1e), LL(0xe0e000e00000e0e0), LL(0x6464006400006464), 
 1292             LL(0x1010001000001010), LL(0x0000000000000000), LL(0xa3a300a30000a3a3), LL(0x7575007500007575), LL(0x8a8a008a00008a8a), LL(0xe6e600e60000e6e6), LL(0x0909000900000909), LL(0xdddd00dd0000dddd), 
 1293             LL(0x8787008700008787), LL(0x8383008300008383), LL(0xcdcd00cd0000cdcd), LL(0x9090009000009090), LL(0x7373007300007373), LL(0xf6f600f60000f6f6), LL(0x9d9d009d00009d9d), LL(0xbfbf00bf0000bfbf), 
 1294             LL(0x5252005200005252), LL(0xd8d800d80000d8d8), LL(0xc8c800c80000c8c8), LL(0xc6c600c60000c6c6), LL(0x8181008100008181), LL(0x6f6f006f00006f6f), LL(0x1313001300001313), LL(0x6363006300006363), 
 1295             LL(0xe9e900e90000e9e9), LL(0xa7a700a70000a7a7), LL(0x9f9f009f00009f9f), LL(0xbcbc00bc0000bcbc), LL(0x2929002900002929), LL(0xf9f900f90000f9f9), LL(0x2f2f002f00002f2f), LL(0xb4b400b40000b4b4), 
 1296             LL(0x7878007800007878), LL(0x0606000600000606), LL(0xe7e700e70000e7e7), LL(0x7171007100007171), LL(0xd4d400d40000d4d4), LL(0xabab00ab0000abab), LL(0x8888008800008888), LL(0x8d8d008d00008d8d), 
 1297             LL(0x7272007200007272), LL(0xb9b900b90000b9b9), LL(0xf8f800f80000f8f8), LL(0xacac00ac0000acac), LL(0x3636003600003636), LL(0x2a2a002a00002a2a), LL(0x3c3c003c00003c3c), LL(0xf1f100f10000f1f1), 
 1298             LL(0x4040004000004040), LL(0xd3d300d30000d3d3), LL(0xbbbb00bb0000bbbb), LL(0x4343004300004343), LL(0x1515001500001515), LL(0xadad00ad0000adad), LL(0x7777007700007777), LL(0x8080008000008080), 
 1299             LL(0x8282008200008282), LL(0xecec00ec0000ecec), LL(0x2727002700002727), LL(0xe5e500e50000e5e5), LL(0x8585008500008585), LL(0x3535003500003535), LL(0x0c0c000c00000c0c), LL(0x4141004100004141), 
 1300             LL(0xefef00ef0000efef), LL(0x9393009300009393), LL(0x1919001900001919), LL(0x2121002100002121), LL(0x0e0e000e00000e0e), LL(0x4e4e004e00004e4e), LL(0x6565006500006565), LL(0xbdbd00bd0000bdbd), 
 1301             LL(0xb8b800b80000b8b8), LL(0x8f8f008f00008f8f), LL(0xebeb00eb0000ebeb), LL(0xcece00ce0000cece), LL(0x3030003000003030), LL(0x5f5f005f00005f5f), LL(0xc5c500c50000c5c5), LL(0x1a1a001a00001a1a), 
 1302             LL(0xe1e100e10000e1e1), LL(0xcaca00ca0000caca), LL(0x4747004700004747), LL(0x3d3d003d00003d3d), LL(0x0101000100000101), LL(0xd6d600d60000d6d6), LL(0x5656005600005656), LL(0x4d4d004d00004d4d), 
 1303             LL(0x0d0d000d00000d0d), LL(0x6666006600006666), LL(0xcccc00cc0000cccc), LL(0x2d2d002d00002d2d), LL(0x1212001200001212), LL(0x2020002000002020), LL(0xb1b100b10000b1b1), LL(0x9999009900009999), 
 1304             LL(0x4c4c004c00004c4c), LL(0xc2c200c20000c2c2), LL(0x7e7e007e00007e7e), LL(0x0505000500000505), LL(0xb7b700b70000b7b7), LL(0x3131003100003131), LL(0x1717001700001717), LL(0xd7d700d70000d7d7), 
 1305             LL(0x5858005800005858), LL(0x6161006100006161), LL(0x1b1b001b00001b1b), LL(0x1c1c001c00001c1c), LL(0x0f0f000f00000f0f), LL(0x1616001600001616), LL(0x1818001800001818), LL(0x2222002200002222), 
 1306             LL(0x4444004400004444), LL(0xb2b200b20000b2b2), LL(0xb5b500b50000b5b5), LL(0x9191009100009191), LL(0x0808000800000808), LL(0xa8a800a80000a8a8), LL(0xfcfc00fc0000fcfc), LL(0x5050005000005050), 
 1307             LL(0xd0d000d00000d0d0), LL(0x7d7d007d00007d7d), LL(0x8989008900008989), LL(0x9797009700009797), LL(0x5b5b005b00005b5b), LL(0x9595009500009595), LL(0xffff00ff0000ffff), LL(0xd2d200d20000d2d2), 
 1308             LL(0xc4c400c40000c4c4), LL(0x4848004800004848), LL(0xf7f700f70000f7f7), LL(0xdbdb00db0000dbdb), LL(0x0303000300000303), LL(0xdada00da0000dada), LL(0x3f3f003f00003f3f), LL(0x9494009400009494), 
 1309             LL(0x5c5c005c00005c5c), LL(0x0202000200000202), LL(0x4a4a004a00004a4a), LL(0x3333003300003333), LL(0x6767006700006767), LL(0xf3f300f30000f3f3), LL(0x7f7f007f00007f7f), LL(0xe2e200e20000e2e2), 
 1310             LL(0x9b9b009b00009b9b), LL(0x2626002600002626), LL(0x3737003700003737), LL(0x3b3b003b00003b3b), LL(0x9696009600009696), LL(0x4b4b004b00004b4b), LL(0xbebe00be0000bebe), LL(0x2e2e002e00002e2e), 
 1311             LL(0x7979007900007979), LL(0x8c8c008c00008c8c), LL(0x6e6e006e00006e6e), LL(0x8e8e008e00008e8e), LL(0xf5f500f50000f5f5), LL(0xb6b600b60000b6b6), LL(0xfdfd00fd0000fdfd), LL(0x5959005900005959), 
 1312             LL(0x9898009800009898), LL(0x6a6a006a00006a6a), LL(0x4646004600004646), LL(0xbaba00ba0000baba), LL(0x2525002500002525), LL(0x4242004200004242), LL(0xa2a200a20000a2a2), LL(0xfafa00fa0000fafa), 
 1313             LL(0x0707000700000707), LL(0x5555005500005555), LL(0xeeee00ee0000eeee), LL(0x0a0a000a00000a0a), LL(0x4949004900004949), LL(0x6868006800006868), LL(0x3838003800003838), LL(0xa4a400a40000a4a4), 
 1314             LL(0x2828002800002828), LL(0x7b7b007b00007b7b), LL(0xc9c900c90000c9c9), LL(0xc1c100c10000c1c1), LL(0xe3e300e30000e3e3), LL(0xf4f400f40000f4f4), LL(0xc7c700c70000c7c7), LL(0x9e9e009e00009e9e)
 1315         },
 1316         {
 1317             LL(0x00e0e0e000e0e0e0), LL(0x0005050500050505), LL(0x0058585800585858), LL(0x00d9d9d900d9d9d9), LL(0x0067676700676767), LL(0x004e4e4e004e4e4e), LL(0x0081818100818181), LL(0x00cbcbcb00cbcbcb), 
 1318             LL(0x00c9c9c900c9c9c9), LL(0x000b0b0b000b0b0b), LL(0x00aeaeae00aeaeae), LL(0x006a6a6a006a6a6a), LL(0x00d5d5d500d5d5d5), LL(0x0018181800181818), LL(0x005d5d5d005d5d5d), LL(0x0082828200828282), 
 1319             LL(0x0046464600464646), LL(0x00dfdfdf00dfdfdf), LL(0x00d6d6d600d6d6d6), LL(0x0027272700272727), LL(0x008a8a8a008a8a8a), LL(0x0032323200323232), LL(0x004b4b4b004b4b4b), LL(0x0042424200424242), 
 1320             LL(0x00dbdbdb00dbdbdb), LL(0x001c1c1c001c1c1c), LL(0x009e9e9e009e9e9e), LL(0x009c9c9c009c9c9c), LL(0x003a3a3a003a3a3a), LL(0x00cacaca00cacaca), LL(0x0025252500252525), LL(0x007b7b7b007b7b7b), 
 1321             LL(0x000d0d0d000d0d0d), LL(0x0071717100717171), LL(0x005f5f5f005f5f5f), LL(0x001f1f1f001f1f1f), LL(0x00f8f8f800f8f8f8), LL(0x00d7d7d700d7d7d7), LL(0x003e3e3e003e3e3e), LL(0x009d9d9d009d9d9d), 
 1322             LL(0x007c7c7c007c7c7c), LL(0x0060606000606060), LL(0x00b9b9b900b9b9b9), LL(0x00bebebe00bebebe), LL(0x00bcbcbc00bcbcbc), LL(0x008b8b8b008b8b8b), LL(0x0016161600161616), LL(0x0034343400343434), 
 1323             LL(0x004d4d4d004d4d4d), LL(0x00c3c3c300c3c3c3), LL(0x0072727200727272), LL(0x0095959500959595), LL(0x00ababab00ababab), LL(0x008e8e8e008e8e8e), LL(0x00bababa00bababa), LL(0x007a7a7a007a7a7a), 
 1324             LL(0x00b3b3b300b3b3b3), LL(0x0002020200020202), LL(0x00b4b4b400b4b4b4), LL(0x00adadad00adadad), LL(0x00a2a2a200a2a2a2), LL(0x00acacac00acacac), LL(0x00d8d8d800d8d8d8), LL(0x009a9a9a009a9a9a), 
 1325             LL(0x0017171700171717), LL(0x001a1a1a001a1a1a), LL(0x0035353500353535), LL(0x00cccccc00cccccc), LL(0x00f7f7f700f7f7f7), LL(0x0099999900999999), LL(0x0061616100616161), LL(0x005a5a5a005a5a5a), 
 1326             LL(0x00e8e8e800e8e8e8), LL(0x0024242400242424), LL(0x0056565600565656), LL(0x0040404000404040), LL(0x00e1e1e100e1e1e1), LL(0x0063636300636363), LL(0x0009090900090909), LL(0x0033333300333333), 
 1327             LL(0x00bfbfbf00bfbfbf), LL(0x0098989800989898), LL(0x0097979700979797), LL(0x0085858500858585), LL(0x0068686800686868), LL(0x00fcfcfc00fcfcfc), LL(0x00ececec00ececec), LL(0x000a0a0a000a0a0a), 
 1328             LL(0x00dadada00dadada), LL(0x006f6f6f006f6f6f), LL(0x0053535300535353), LL(0x0062626200626262), LL(0x00a3a3a300a3a3a3), LL(0x002e2e2e002e2e2e), LL(0x0008080800080808), LL(0x00afafaf00afafaf), 
 1329             LL(0x0028282800282828), LL(0x00b0b0b000b0b0b0), LL(0x0074747400747474), LL(0x00c2c2c200c2c2c2), LL(0x00bdbdbd00bdbdbd), LL(0x0036363600363636), LL(0x0022222200222222), LL(0x0038383800383838), 
 1330             LL(0x0064646400646464), LL(0x001e1e1e001e1e1e), LL(0x0039393900393939), LL(0x002c2c2c002c2c2c), LL(0x00a6a6a600a6a6a6), LL(0x0030303000303030), LL(0x00e5e5e500e5e5e5), LL(0x0044444400444444), 
 1331             LL(0x00fdfdfd00fdfdfd), LL(0x0088888800888888), LL(0x009f9f9f009f9f9f), LL(0x0065656500656565), LL(0x0087878700878787), LL(0x006b6b6b006b6b6b), LL(0x00f4f4f400f4f4f4), LL(0x0023232300232323), 
 1332             LL(0x0048484800484848), LL(0x0010101000101010), LL(0x00d1d1d100d1d1d1), LL(0x0051515100515151), LL(0x00c0c0c000c0c0c0), LL(0x00f9f9f900f9f9f9), LL(0x00d2d2d200d2d2d2), LL(0x00a0a0a000a0a0a0), 
 1333             LL(0x0055555500555555), LL(0x00a1a1a100a1a1a1), LL(0x0041414100414141), LL(0x00fafafa00fafafa), LL(0x0043434300434343), LL(0x0013131300131313), LL(0x00c4c4c400c4c4c4), LL(0x002f2f2f002f2f2f), 
 1334             LL(0x00a8a8a800a8a8a8), LL(0x00b6b6b600b6b6b6), LL(0x003c3c3c003c3c3c), LL(0x002b2b2b002b2b2b), LL(0x00c1c1c100c1c1c1), LL(0x00ffffff00ffffff), LL(0x00c8c8c800c8c8c8), LL(0x00a5a5a500a5a5a5), 
 1335             LL(0x0020202000202020), LL(0x0089898900898989), LL(0x0000000000000000), LL(0x0090909000909090), LL(0x0047474700474747), LL(0x00efefef00efefef), LL(0x00eaeaea00eaeaea), LL(0x00b7b7b700b7b7b7), 
 1336             LL(0x0015151500151515), LL(0x0006060600060606), LL(0x00cdcdcd00cdcdcd), LL(0x00b5b5b500b5b5b5), LL(0x0012121200121212), LL(0x007e7e7e007e7e7e), LL(0x00bbbbbb00bbbbbb), LL(0x0029292900292929), 
 1337             LL(0x000f0f0f000f0f0f), LL(0x00b8b8b800b8b8b8), LL(0x0007070700070707), LL(0x0004040400040404), LL(0x009b9b9b009b9b9b), LL(0x0094949400949494), LL(0x0021212100212121), LL(0x0066666600666666), 
 1338             LL(0x00e6e6e600e6e6e6), LL(0x00cecece00cecece), LL(0x00ededed00ededed), LL(0x00e7e7e700e7e7e7), LL(0x003b3b3b003b3b3b), LL(0x00fefefe00fefefe), LL(0x007f7f7f007f7f7f), LL(0x00c5c5c500c5c5c5), 
 1339             LL(0x00a4a4a400a4a4a4), LL(0x0037373700373737), LL(0x00b1b1b100b1b1b1), LL(0x004c4c4c004c4c4c), LL(0x0091919100919191), LL(0x006e6e6e006e6e6e), LL(0x008d8d8d008d8d8d), LL(0x0076767600767676), 
 1340             LL(0x0003030300030303), LL(0x002d2d2d002d2d2d), LL(0x00dedede00dedede), LL(0x0096969600969696), LL(0x0026262600262626), LL(0x007d7d7d007d7d7d), LL(0x00c6c6c600c6c6c6), LL(0x005c5c5c005c5c5c), 
 1341             LL(0x00d3d3d300d3d3d3), LL(0x00f2f2f200f2f2f2), LL(0x004f4f4f004f4f4f), LL(0x0019191900191919), LL(0x003f3f3f003f3f3f), LL(0x00dcdcdc00dcdcdc), LL(0x0079797900797979), LL(0x001d1d1d001d1d1d), 
 1342             LL(0x0052525200525252), LL(0x00ebebeb00ebebeb), LL(0x00f3f3f300f3f3f3), LL(0x006d6d6d006d6d6d), LL(0x005e5e5e005e5e5e), LL(0x00fbfbfb00fbfbfb), LL(0x0069696900696969), LL(0x00b2b2b200b2b2b2), 
 1343             LL(0x00f0f0f000f0f0f0), LL(0x0031313100313131), LL(0x000c0c0c000c0c0c), LL(0x00d4d4d400d4d4d4), LL(0x00cfcfcf00cfcfcf), LL(0x008c8c8c008c8c8c), LL(0x00e2e2e200e2e2e2), LL(0x0075757500757575), 
 1344             LL(0x00a9a9a900a9a9a9), LL(0x004a4a4a004a4a4a), LL(0x0057575700575757), LL(0x0084848400848484), LL(0x0011111100111111), LL(0x0045454500454545), LL(0x001b1b1b001b1b1b), LL(0x00f5f5f500f5f5f5), 
 1345             LL(0x00e4e4e400e4e4e4), LL(0x000e0e0e000e0e0e), LL(0x0073737300737373), LL(0x00aaaaaa00aaaaaa), LL(0x00f1f1f100f1f1f1), LL(0x00dddddd00dddddd), LL(0x0059595900595959), LL(0x0014141400141414), 
 1346             LL(0x006c6c6c006c6c6c), LL(0x0092929200929292), LL(0x0054545400545454), LL(0x00d0d0d000d0d0d0), LL(0x0078787800787878), LL(0x0070707000707070), LL(0x00e3e3e300e3e3e3), LL(0x0049494900494949), 
 1347             LL(0x0080808000808080), LL(0x0050505000505050), LL(0x00a7a7a700a7a7a7), LL(0x00f6f6f600f6f6f6), LL(0x0077777700777777), LL(0x0093939300939393), LL(0x0086868600868686), LL(0x0083838300838383), 
 1348             LL(0x002a2a2a002a2a2a), LL(0x00c7c7c700c7c7c7), LL(0x005b5b5b005b5b5b), LL(0x00e9e9e900e9e9e9), LL(0x00eeeeee00eeeeee), LL(0x008f8f8f008f8f8f), LL(0x0001010100010101), LL(0x003d3d3d003d3d3d)
 1349         },
 1350         {
 1351             LL(0x3800383838003838), LL(0x4100414141004141), LL(0x1600161616001616), LL(0x7600767676007676), LL(0xd900d9d9d900d9d9), LL(0x9300939393009393), LL(0x6000606060006060), LL(0xf200f2f2f200f2f2), 
 1352             LL(0x7200727272007272), LL(0xc200c2c2c200c2c2), LL(0xab00ababab00abab), LL(0x9a009a9a9a009a9a), LL(0x7500757575007575), LL(0x0600060606000606), LL(0x5700575757005757), LL(0xa000a0a0a000a0a0), 
 1353             LL(0x9100919191009191), LL(0xf700f7f7f700f7f7), LL(0xb500b5b5b500b5b5), LL(0xc900c9c9c900c9c9), LL(0xa200a2a2a200a2a2), LL(0x8c008c8c8c008c8c), LL(0xd200d2d2d200d2d2), LL(0x9000909090009090), 
 1354             LL(0xf600f6f6f600f6f6), LL(0x0700070707000707), LL(0xa700a7a7a700a7a7), LL(0x2700272727002727), LL(0x8e008e8e8e008e8e), LL(0xb200b2b2b200b2b2), LL(0x4900494949004949), LL(0xde00dedede00dede), 
 1355             LL(0x4300434343004343), LL(0x5c005c5c5c005c5c), LL(0xd700d7d7d700d7d7), LL(0xc700c7c7c700c7c7), LL(0x3e003e3e3e003e3e), LL(0xf500f5f5f500f5f5), LL(0x8f008f8f8f008f8f), LL(0x6700676767006767), 
 1356             LL(0x1f001f1f1f001f1f), LL(0x1800181818001818), LL(0x6e006e6e6e006e6e), LL(0xaf00afafaf00afaf), LL(0x2f002f2f2f002f2f), LL(0xe200e2e2e200e2e2), LL(0x8500858585008585), LL(0x0d000d0d0d000d0d), 
 1357             LL(0x5300535353005353), LL(0xf000f0f0f000f0f0), LL(0x9c009c9c9c009c9c), LL(0x6500656565006565), LL(0xea00eaeaea00eaea), LL(0xa300a3a3a300a3a3), LL(0xae00aeaeae00aeae), LL(0x9e009e9e9e009e9e), 
 1358             LL(0xec00ececec00ecec), LL(0x8000808080008080), LL(0x2d002d2d2d002d2d), LL(0x6b006b6b6b006b6b), LL(0xa800a8a8a800a8a8), LL(0x2b002b2b2b002b2b), LL(0x3600363636003636), LL(0xa600a6a6a600a6a6), 
 1359             LL(0xc500c5c5c500c5c5), LL(0x8600868686008686), LL(0x4d004d4d4d004d4d), LL(0x3300333333003333), LL(0xfd00fdfdfd00fdfd), LL(0x6600666666006666), LL(0x5800585858005858), LL(0x9600969696009696), 
 1360             LL(0x3a003a3a3a003a3a), LL(0x0900090909000909), LL(0x9500959595009595), LL(0x1000101010001010), LL(0x7800787878007878), LL(0xd800d8d8d800d8d8), LL(0x4200424242004242), LL(0xcc00cccccc00cccc), 
 1361             LL(0xef00efefef00efef), LL(0x2600262626002626), LL(0xe500e5e5e500e5e5), LL(0x6100616161006161), LL(0x1a001a1a1a001a1a), LL(0x3f003f3f3f003f3f), LL(0x3b003b3b3b003b3b), LL(0x8200828282008282), 
 1362             LL(0xb600b6b6b600b6b6), LL(0xdb00dbdbdb00dbdb), LL(0xd400d4d4d400d4d4), LL(0x9800989898009898), LL(0xe800e8e8e800e8e8), LL(0x8b008b8b8b008b8b), LL(0x0200020202000202), LL(0xeb00ebebeb00ebeb), 
 1363             LL(0x0a000a0a0a000a0a), LL(0x2c002c2c2c002c2c), LL(0x1d001d1d1d001d1d), LL(0xb000b0b0b000b0b0), LL(0x6f006f6f6f006f6f), LL(0x8d008d8d8d008d8d), LL(0x8800888888008888), LL(0x0e000e0e0e000e0e), 
 1364             LL(0x1900191919001919), LL(0x8700878787008787), LL(0x4e004e4e4e004e4e), LL(0x0b000b0b0b000b0b), LL(0xa900a9a9a900a9a9), LL(0x0c000c0c0c000c0c), LL(0x7900797979007979), LL(0x1100111111001111), 
 1365             LL(0x7f007f7f7f007f7f), LL(0x2200222222002222), LL(0xe700e7e7e700e7e7), LL(0x5900595959005959), LL(0xe100e1e1e100e1e1), LL(0xda00dadada00dada), LL(0x3d003d3d3d003d3d), LL(0xc800c8c8c800c8c8), 
 1366             LL(0x1200121212001212), LL(0x0400040404000404), LL(0x7400747474007474), LL(0x5400545454005454), LL(0x3000303030003030), LL(0x7e007e7e7e007e7e), LL(0xb400b4b4b400b4b4), LL(0x2800282828002828), 
 1367             LL(0x5500555555005555), LL(0x6800686868006868), LL(0x5000505050005050), LL(0xbe00bebebe00bebe), LL(0xd000d0d0d000d0d0), LL(0xc400c4c4c400c4c4), LL(0x3100313131003131), LL(0xcb00cbcbcb00cbcb), 
 1368             LL(0x2a002a2a2a002a2a), LL(0xad00adadad00adad), LL(0x0f000f0f0f000f0f), LL(0xca00cacaca00caca), LL(0x7000707070007070), LL(0xff00ffffff00ffff), LL(0x3200323232003232), LL(0x6900696969006969), 
 1369             LL(0x0800080808000808), LL(0x6200626262006262), LL(0x0000000000000000), LL(0x2400242424002424), LL(0xd100d1d1d100d1d1), LL(0xfb00fbfbfb00fbfb), LL(0xba00bababa00baba), LL(0xed00ededed00eded), 
 1370             LL(0x4500454545004545), LL(0x8100818181008181), LL(0x7300737373007373), LL(0x6d006d6d6d006d6d), LL(0x8400848484008484), LL(0x9f009f9f9f009f9f), LL(0xee00eeeeee00eeee), LL(0x4a004a4a4a004a4a), 
 1371             LL(0xc300c3c3c300c3c3), LL(0x2e002e2e2e002e2e), LL(0xc100c1c1c100c1c1), LL(0x0100010101000101), LL(0xe600e6e6e600e6e6), LL(0x2500252525002525), LL(0x4800484848004848), LL(0x9900999999009999), 
 1372             LL(0xb900b9b9b900b9b9), LL(0xb300b3b3b300b3b3), LL(0x7b007b7b7b007b7b), LL(0xf900f9f9f900f9f9), LL(0xce00cecece00cece), LL(0xbf00bfbfbf00bfbf), LL(0xdf00dfdfdf00dfdf), LL(0x7100717171007171), 
 1373             LL(0x2900292929002929), LL(0xcd00cdcdcd00cdcd), LL(0x6c006c6c6c006c6c), LL(0x1300131313001313), LL(0x6400646464006464), LL(0x9b009b9b9b009b9b), LL(0x6300636363006363), LL(0x9d009d9d9d009d9d), 
 1374             LL(0xc000c0c0c000c0c0), LL(0x4b004b4b4b004b4b), LL(0xb700b7b7b700b7b7), LL(0xa500a5a5a500a5a5), LL(0x8900898989008989), LL(0x5f005f5f5f005f5f), LL(0xb100b1b1b100b1b1), LL(0x1700171717001717), 
 1375             LL(0xf400f4f4f400f4f4), LL(0xbc00bcbcbc00bcbc), LL(0xd300d3d3d300d3d3), LL(0x4600464646004646), LL(0xcf00cfcfcf00cfcf), LL(0x3700373737003737), LL(0x5e005e5e5e005e5e), LL(0x4700474747004747), 
 1376             LL(0x9400949494009494), LL(0xfa00fafafa00fafa), LL(0xfc00fcfcfc00fcfc), LL(0x5b005b5b5b005b5b), LL(0x9700979797009797), LL(0xfe00fefefe00fefe), LL(0x5a005a5a5a005a5a), LL(0xac00acacac00acac), 
 1377             LL(0x3c003c3c3c003c3c), LL(0x4c004c4c4c004c4c), LL(0x0300030303000303), LL(0x3500353535003535), LL(0xf300f3f3f300f3f3), LL(0x2300232323002323), LL(0xb800b8b8b800b8b8), LL(0x5d005d5d5d005d5d), 
 1378             LL(0x6a006a6a6a006a6a), LL(0x9200929292009292), LL(0xd500d5d5d500d5d5), LL(0x2100212121002121), LL(0x4400444444004444), LL(0x5100515151005151), LL(0xc600c6c6c600c6c6), LL(0x7d007d7d7d007d7d), 
 1379             LL(0x3900393939003939), LL(0x8300838383008383), LL(0xdc00dcdcdc00dcdc), LL(0xaa00aaaaaa00aaaa), LL(0x7c007c7c7c007c7c), LL(0x7700777777007777), LL(0x5600565656005656), LL(0x0500050505000505), 
 1380             LL(0x1b001b1b1b001b1b), LL(0xa400a4a4a400a4a4), LL(0x1500151515001515), LL(0x3400343434003434), LL(0x1e001e1e1e001e1e), LL(0x1c001c1c1c001c1c), LL(0xf800f8f8f800f8f8), LL(0x5200525252005252), 
 1381             LL(0x2000202020002020), LL(0x1400141414001414), LL(0xe900e9e9e900e9e9), LL(0xbd00bdbdbd00bdbd), LL(0xdd00dddddd00dddd), LL(0xe400e4e4e400e4e4), LL(0xa100a1a1a100a1a1), LL(0xe000e0e0e000e0e0), 
 1382             LL(0x8a008a8a8a008a8a), LL(0xf100f1f1f100f1f1), LL(0xd600d6d6d600d6d6), LL(0x7a007a7a7a007a7a), LL(0xbb00bbbbbb00bbbb), LL(0xe300e3e3e300e3e3), LL(0x4000404040004040), LL(0x4f004f4f4f004f4f)
 1383         },
 1384         {
 1385             LL(0x7070007070700070), LL(0x2c2c002c2c2c002c), LL(0xb3b300b3b3b300b3), LL(0xc0c000c0c0c000c0), LL(0xe4e400e4e4e400e4), LL(0x5757005757570057), LL(0xeaea00eaeaea00ea), LL(0xaeae00aeaeae00ae), 
 1386             LL(0x2323002323230023), LL(0x6b6b006b6b6b006b), LL(0x4545004545450045), LL(0xa5a500a5a5a500a5), LL(0xeded00ededed00ed), LL(0x4f4f004f4f4f004f), LL(0x1d1d001d1d1d001d), LL(0x9292009292920092), 
 1387             LL(0x8686008686860086), LL(0xafaf00afafaf00af), LL(0x7c7c007c7c7c007c), LL(0x1f1f001f1f1f001f), LL(0x3e3e003e3e3e003e), LL(0xdcdc00dcdcdc00dc), LL(0x5e5e005e5e5e005e), LL(0x0b0b000b0b0b000b), 
 1388             LL(0xa6a600a6a6a600a6), LL(0x3939003939390039), LL(0xd5d500d5d5d500d5), LL(0x5d5d005d5d5d005d), LL(0xd9d900d9d9d900d9), LL(0x5a5a005a5a5a005a), LL(0x5151005151510051), LL(0x6c6c006c6c6c006c), 
 1389             LL(0x8b8b008b8b8b008b), LL(0x9a9a009a9a9a009a), LL(0xfbfb00fbfbfb00fb), LL(0xb0b000b0b0b000b0), LL(0x7474007474740074), LL(0x2b2b002b2b2b002b), LL(0xf0f000f0f0f000f0), LL(0x8484008484840084), 
 1390             LL(0xdfdf00dfdfdf00df), LL(0xcbcb00cbcbcb00cb), LL(0x3434003434340034), LL(0x7676007676760076), LL(0x6d6d006d6d6d006d), LL(0xa9a900a9a9a900a9), LL(0xd1d100d1d1d100d1), LL(0x0404000404040004), 
 1391             LL(0x1414001414140014), LL(0x3a3a003a3a3a003a), LL(0xdede00dedede00de), LL(0x1111001111110011), LL(0x3232003232320032), LL(0x9c9c009c9c9c009c), LL(0x5353005353530053), LL(0xf2f200f2f2f200f2), 
 1392             LL(0xfefe00fefefe00fe), LL(0xcfcf00cfcfcf00cf), LL(0xc3c300c3c3c300c3), LL(0x7a7a007a7a7a007a), LL(0x2424002424240024), LL(0xe8e800e8e8e800e8), LL(0x6060006060600060), LL(0x6969006969690069), 
 1393             LL(0xaaaa00aaaaaa00aa), LL(0xa0a000a0a0a000a0), LL(0xa1a100a1a1a100a1), LL(0x6262006262620062), LL(0x5454005454540054), LL(0x1e1e001e1e1e001e), LL(0xe0e000e0e0e000e0), LL(0x6464006464640064), 
 1394             LL(0x1010001010100010), LL(0x0000000000000000), LL(0xa3a300a3a3a300a3), LL(0x7575007575750075), LL(0x8a8a008a8a8a008a), LL(0xe6e600e6e6e600e6), LL(0x0909000909090009), LL(0xdddd00dddddd00dd), 
 1395             LL(0x8787008787870087), LL(0x8383008383830083), LL(0xcdcd00cdcdcd00cd), LL(0x9090009090900090), LL(0x7373007373730073), LL(0xf6f600f6f6f600f6), LL(0x9d9d009d9d9d009d), LL(0xbfbf00bfbfbf00bf), 
 1396             LL(0x5252005252520052), LL(0xd8d800d8d8d800d8), LL(0xc8c800c8c8c800c8), LL(0xc6c600c6c6c600c6), LL(0x8181008181810081), LL(0x6f6f006f6f6f006f), LL(0x1313001313130013), LL(0x6363006363630063), 
 1397             LL(0xe9e900e9e9e900e9), LL(0xa7a700a7a7a700a7), LL(0x9f9f009f9f9f009f), LL(0xbcbc00bcbcbc00bc), LL(0x2929002929290029), LL(0xf9f900f9f9f900f9), LL(0x2f2f002f2f2f002f), LL(0xb4b400b4b4b400b4), 
 1398             LL(0x7878007878780078), LL(0x0606000606060006), LL(0xe7e700e7e7e700e7), LL(0x7171007171710071), LL(0xd4d400d4d4d400d4), LL(0xabab00ababab00ab), LL(0x8888008888880088), LL(0x8d8d008d8d8d008d), 
 1399             LL(0x7272007272720072), LL(0xb9b900b9b9b900b9), LL(0xf8f800f8f8f800f8), LL(0xacac00acacac00ac), LL(0x3636003636360036), LL(0x2a2a002a2a2a002a), LL(0x3c3c003c3c3c003c), LL(0xf1f100f1f1f100f1), 
 1400             LL(0x4040004040400040), LL(0xd3d300d3d3d300d3), LL(0xbbbb00bbbbbb00bb), LL(0x4343004343430043), LL(0x1515001515150015), LL(0xadad00adadad00ad), LL(0x7777007777770077), LL(0x8080008080800080), 
 1401             LL(0x8282008282820082), LL(0xecec00ececec00ec), LL(0x2727002727270027), LL(0xe5e500e5e5e500e5), LL(0x8585008585850085), LL(0x3535003535350035), LL(0x0c0c000c0c0c000c), LL(0x4141004141410041), 
 1402             LL(0xefef00efefef00ef), LL(0x9393009393930093), LL(0x1919001919190019), LL(0x2121002121210021), LL(0x0e0e000e0e0e000e), LL(0x4e4e004e4e4e004e), LL(0x6565006565650065), LL(0xbdbd00bdbdbd00bd), 
 1403             LL(0xb8b800b8b8b800b8), LL(0x8f8f008f8f8f008f), LL(0xebeb00ebebeb00eb), LL(0xcece00cecece00ce), LL(0x3030003030300030), LL(0x5f5f005f5f5f005f), LL(0xc5c500c5c5c500c5), LL(0x1a1a001a1a1a001a), 
 1404             LL(0xe1e100e1e1e100e1), LL(0xcaca00cacaca00ca), LL(0x4747004747470047), LL(0x3d3d003d3d3d003d), LL(0x0101000101010001), LL(0xd6d600d6d6d600d6), LL(0x5656005656560056), LL(0x4d4d004d4d4d004d), 
 1405             LL(0x0d0d000d0d0d000d), LL(0x6666006666660066), LL(0xcccc00cccccc00cc), LL(0x2d2d002d2d2d002d), LL(0x1212001212120012), LL(0x2020002020200020), LL(0xb1b100b1b1b100b1), LL(0x9999009999990099), 
 1406             LL(0x4c4c004c4c4c004c), LL(0xc2c200c2c2c200c2), LL(0x7e7e007e7e7e007e), LL(0x0505000505050005), LL(0xb7b700b7b7b700b7), LL(0x3131003131310031), LL(0x1717001717170017), LL(0xd7d700d7d7d700d7), 
 1407             LL(0x5858005858580058), LL(0x6161006161610061), LL(0x1b1b001b1b1b001b), LL(0x1c1c001c1c1c001c), LL(0x0f0f000f0f0f000f), LL(0x1616001616160016), LL(0x1818001818180018), LL(0x2222002222220022), 
 1408             LL(0x4444004444440044), LL(0xb2b200b2b2b200b2), LL(0xb5b500b5b5b500b5), LL(0x9191009191910091), LL(0x0808000808080008), LL(0xa8a800a8a8a800a8), LL(0xfcfc00fcfcfc00fc), LL(0x5050005050500050), 
 1409             LL(0xd0d000d0d0d000d0), LL(0x7d7d007d7d7d007d), LL(0x8989008989890089), LL(0x9797009797970097), LL(0x5b5b005b5b5b005b), LL(0x9595009595950095), LL(0xffff00ffffff00ff), LL(0xd2d200d2d2d200d2), 
 1410             LL(0xc4c400c4c4c400c4), LL(0x4848004848480048), LL(0xf7f700f7f7f700f7), LL(0xdbdb00dbdbdb00db), LL(0x0303000303030003), LL(0xdada00dadada00da), LL(0x3f3f003f3f3f003f), LL(0x9494009494940094), 
 1411             LL(0x5c5c005c5c5c005c), LL(0x0202000202020002), LL(0x4a4a004a4a4a004a), LL(0x3333003333330033), LL(0x6767006767670067), LL(0xf3f300f3f3f300f3), LL(0x7f7f007f7f7f007f), LL(0xe2e200e2e2e200e2), 
 1412             LL(0x9b9b009b9b9b009b), LL(0x2626002626260026), LL(0x3737003737370037), LL(0x3b3b003b3b3b003b), LL(0x9696009696960096), LL(0x4b4b004b4b4b004b), LL(0xbebe00bebebe00be), LL(0x2e2e002e2e2e002e), 
 1413             LL(0x7979007979790079), LL(0x8c8c008c8c8c008c), LL(0x6e6e006e6e6e006e), LL(0x8e8e008e8e8e008e), LL(0xf5f500f5f5f500f5), LL(0xb6b600b6b6b600b6), LL(0xfdfd00fdfdfd00fd), LL(0x5959005959590059), 
 1414             LL(0x9898009898980098), LL(0x6a6a006a6a6a006a), LL(0x4646004646460046), LL(0xbaba00bababa00ba), LL(0x2525002525250025), LL(0x4242004242420042), LL(0xa2a200a2a2a200a2), LL(0xfafa00fafafa00fa), 
 1415             LL(0x0707000707070007), LL(0x5555005555550055), LL(0xeeee00eeeeee00ee), LL(0x0a0a000a0a0a000a), LL(0x4949004949490049), LL(0x6868006868680068), LL(0x3838003838380038), LL(0xa4a400a4a4a400a4), 
 1416             LL(0x2828002828280028), LL(0x7b7b007b7b7b007b), LL(0xc9c900c9c9c900c9), LL(0xc1c100c1c1c100c1), LL(0xe3e300e3e3e300e3), LL(0xf4f400f4f4f400f4), LL(0xc7c700c7c7c700c7), LL(0x9e9e009e9e9e009e)
 1417         },
 1418         {
 1419             LL(0x7070700070707000), LL(0x8282820082828200), LL(0x2c2c2c002c2c2c00), LL(0xececec00ececec00), LL(0xb3b3b300b3b3b300), LL(0x2727270027272700), LL(0xc0c0c000c0c0c000), LL(0xe5e5e500e5e5e500), 
 1420             LL(0xe4e4e400e4e4e400), LL(0x8585850085858500), LL(0x5757570057575700), LL(0x3535350035353500), LL(0xeaeaea00eaeaea00), LL(0x0c0c0c000c0c0c00), LL(0xaeaeae00aeaeae00), LL(0x4141410041414100), 
 1421             LL(0x2323230023232300), LL(0xefefef00efefef00), LL(0x6b6b6b006b6b6b00), LL(0x9393930093939300), LL(0x4545450045454500), LL(0x1919190019191900), LL(0xa5a5a500a5a5a500), LL(0x2121210021212100), 
 1422             LL(0xededed00ededed00), LL(0x0e0e0e000e0e0e00), LL(0x4f4f4f004f4f4f00), LL(0x4e4e4e004e4e4e00), LL(0x1d1d1d001d1d1d00), LL(0x6565650065656500), LL(0x9292920092929200), LL(0xbdbdbd00bdbdbd00), 
 1423             LL(0x8686860086868600), LL(0xb8b8b800b8b8b800), LL(0xafafaf00afafaf00), LL(0x8f8f8f008f8f8f00), LL(0x7c7c7c007c7c7c00), LL(0xebebeb00ebebeb00), LL(0x1f1f1f001f1f1f00), LL(0xcecece00cecece00), 
 1424             LL(0x3e3e3e003e3e3e00), LL(0x3030300030303000), LL(0xdcdcdc00dcdcdc00), LL(0x5f5f5f005f5f5f00), LL(0x5e5e5e005e5e5e00), LL(0xc5c5c500c5c5c500), LL(0x0b0b0b000b0b0b00), LL(0x1a1a1a001a1a1a00), 
 1425             LL(0xa6a6a600a6a6a600), LL(0xe1e1e100e1e1e100), LL(0x3939390039393900), LL(0xcacaca00cacaca00), LL(0xd5d5d500d5d5d500), LL(0x4747470047474700), LL(0x5d5d5d005d5d5d00), LL(0x3d3d3d003d3d3d00), 
 1426             LL(0xd9d9d900d9d9d900), LL(0x0101010001010100), LL(0x5a5a5a005a5a5a00), LL(0xd6d6d600d6d6d600), LL(0x5151510051515100), LL(0x5656560056565600), LL(0x6c6c6c006c6c6c00), LL(0x4d4d4d004d4d4d00), 
 1427             LL(0x8b8b8b008b8b8b00), LL(0x0d0d0d000d0d0d00), LL(0x9a9a9a009a9a9a00), LL(0x6666660066666600), LL(0xfbfbfb00fbfbfb00), LL(0xcccccc00cccccc00), LL(0xb0b0b000b0b0b000), LL(0x2d2d2d002d2d2d00), 
 1428             LL(0x7474740074747400), LL(0x1212120012121200), LL(0x2b2b2b002b2b2b00), LL(0x2020200020202000), LL(0xf0f0f000f0f0f000), LL(0xb1b1b100b1b1b100), LL(0x8484840084848400), LL(0x9999990099999900), 
 1429             LL(0xdfdfdf00dfdfdf00), LL(0x4c4c4c004c4c4c00), LL(0xcbcbcb00cbcbcb00), LL(0xc2c2c200c2c2c200), LL(0x3434340034343400), LL(0x7e7e7e007e7e7e00), LL(0x7676760076767600), LL(0x0505050005050500), 
 1430             LL(0x6d6d6d006d6d6d00), LL(0xb7b7b700b7b7b700), LL(0xa9a9a900a9a9a900), LL(0x3131310031313100), LL(0xd1d1d100d1d1d100), LL(0x1717170017171700), LL(0x0404040004040400), LL(0xd7d7d700d7d7d700), 
 1431             LL(0x1414140014141400), LL(0x5858580058585800), LL(0x3a3a3a003a3a3a00), LL(0x6161610061616100), LL(0xdedede00dedede00), LL(0x1b1b1b001b1b1b00), LL(0x1111110011111100), LL(0x1c1c1c001c1c1c00), 
 1432             LL(0x3232320032323200), LL(0x0f0f0f000f0f0f00), LL(0x9c9c9c009c9c9c00), LL(0x1616160016161600), LL(0x5353530053535300), LL(0x1818180018181800), LL(0xf2f2f200f2f2f200), LL(0x2222220022222200), 
 1433             LL(0xfefefe00fefefe00), LL(0x4444440044444400), LL(0xcfcfcf00cfcfcf00), LL(0xb2b2b200b2b2b200), LL(0xc3c3c300c3c3c300), LL(0xb5b5b500b5b5b500), LL(0x7a7a7a007a7a7a00), LL(0x9191910091919100), 
 1434             LL(0x2424240024242400), LL(0x0808080008080800), LL(0xe8e8e800e8e8e800), LL(0xa8a8a800a8a8a800), LL(0x6060600060606000), LL(0xfcfcfc00fcfcfc00), LL(0x6969690069696900), LL(0x5050500050505000), 
 1435             LL(0xaaaaaa00aaaaaa00), LL(0xd0d0d000d0d0d000), LL(0xa0a0a000a0a0a000), LL(0x7d7d7d007d7d7d00), LL(0xa1a1a100a1a1a100), LL(0x8989890089898900), LL(0x6262620062626200), LL(0x9797970097979700), 
 1436             LL(0x5454540054545400), LL(0x5b5b5b005b5b5b00), LL(0x1e1e1e001e1e1e00), LL(0x9595950095959500), LL(0xe0e0e000e0e0e000), LL(0xffffff00ffffff00), LL(0x6464640064646400), LL(0xd2d2d200d2d2d200), 
 1437             LL(0x1010100010101000), LL(0xc4c4c400c4c4c400), LL(0x0000000000000000), LL(0x4848480048484800), LL(0xa3a3a300a3a3a300), LL(0xf7f7f700f7f7f700), LL(0x7575750075757500), LL(0xdbdbdb00dbdbdb00), 
 1438             LL(0x8a8a8a008a8a8a00), LL(0x0303030003030300), LL(0xe6e6e600e6e6e600), LL(0xdadada00dadada00), LL(0x0909090009090900), LL(0x3f3f3f003f3f3f00), LL(0xdddddd00dddddd00), LL(0x9494940094949400), 
 1439             LL(0x8787870087878700), LL(0x5c5c5c005c5c5c00), LL(0x8383830083838300), LL(0x0202020002020200), LL(0xcdcdcd00cdcdcd00), LL(0x4a4a4a004a4a4a00), LL(0x9090900090909000), LL(0x3333330033333300), 
 1440             LL(0x7373730073737300), LL(0x6767670067676700), LL(0xf6f6f600f6f6f600), LL(0xf3f3f300f3f3f300), LL(0x9d9d9d009d9d9d00), LL(0x7f7f7f007f7f7f00), LL(0xbfbfbf00bfbfbf00), LL(0xe2e2e200e2e2e200), 
 1441             LL(0x5252520052525200), LL(0x9b9b9b009b9b9b00), LL(0xd8d8d800d8d8d800), LL(0x2626260026262600), LL(0xc8c8c800c8c8c800), LL(0x3737370037373700), LL(0xc6c6c600c6c6c600), LL(0x3b3b3b003b3b3b00), 
 1442             LL(0x8181810081818100), LL(0x9696960096969600), LL(0x6f6f6f006f6f6f00), LL(0x4b4b4b004b4b4b00), LL(0x1313130013131300), LL(0xbebebe00bebebe00), LL(0x6363630063636300), LL(0x2e2e2e002e2e2e00), 
 1443             LL(0xe9e9e900e9e9e900), LL(0x7979790079797900), LL(0xa7a7a700a7a7a700), LL(0x8c8c8c008c8c8c00), LL(0x9f9f9f009f9f9f00), LL(0x6e6e6e006e6e6e00), LL(0xbcbcbc00bcbcbc00), LL(0x8e8e8e008e8e8e00), 
 1444             LL(0x2929290029292900), LL(0xf5f5f500f5f5f500), LL(0xf9f9f900f9f9f900), LL(0xb6b6b600b6b6b600), LL(0x2f2f2f002f2f2f00), LL(0xfdfdfd00fdfdfd00), LL(0xb4b4b400b4b4b400), LL(0x5959590059595900), 
 1445             LL(0x7878780078787800), LL(0x9898980098989800), LL(0x0606060006060600), LL(0x6a6a6a006a6a6a00), LL(0xe7e7e700e7e7e700), LL(0x4646460046464600), LL(0x7171710071717100), LL(0xbababa00bababa00), 
 1446             LL(0xd4d4d400d4d4d400), LL(0x2525250025252500), LL(0xababab00ababab00), LL(0x4242420042424200), LL(0x8888880088888800), LL(0xa2a2a200a2a2a200), LL(0x8d8d8d008d8d8d00), LL(0xfafafa00fafafa00), 
 1447             LL(0x7272720072727200), LL(0x0707070007070700), LL(0xb9b9b900b9b9b900), LL(0x5555550055555500), LL(0xf8f8f800f8f8f800), LL(0xeeeeee00eeeeee00), LL(0xacacac00acacac00), LL(0x0a0a0a000a0a0a00), 
 1448             LL(0x3636360036363600), LL(0x4949490049494900), LL(0x2a2a2a002a2a2a00), LL(0x6868680068686800), LL(0x3c3c3c003c3c3c00), LL(0x3838380038383800), LL(0xf1f1f100f1f1f100), LL(0xa4a4a400a4a4a400), 
 1449             LL(0x4040400040404000), LL(0x2828280028282800), LL(0xd3d3d300d3d3d300), LL(0x7b7b7b007b7b7b00), LL(0xbbbbbb00bbbbbb00), LL(0xc9c9c900c9c9c900), LL(0x4343430043434300), LL(0xc1c1c100c1c1c100), 
 1450             LL(0x1515150015151500), LL(0xe3e3e300e3e3e300), LL(0xadadad00adadad00), LL(0xf4f4f400f4f4f400), LL(0x7777770077777700), LL(0xc7c7c700c7c7c700), LL(0x8080800080808000), LL(0x9e9e9e009e9e9e00)
 1451         }
 1452     };
 1453 
 1454     const uint64 KS[] = { LL(0xA09E667F3BCC908B), LL(0xB67AE8584CAA73B2), LL(0xC6EF372FE94F82BE), LL(0x54FF53A5F1D36F1C), LL(0x10E527FADE682D1D), LL(0xB05688C2B3E6C1FD) };
 1455 
 1456     VC_INLINE uint64 F(uint64 x, uint64 k)
 1457     {
 1458         uint64 t = x ^ k;
 1459         return S[0][(t >> 56) & 0xFF] ^ S[1][(t >> 48) & 0xFF] ^ S[2][(t >> 40) & 0xFF] ^ S[3][(t >> 32) & 0xFF] ^ S[4][(t >> 24) & 0xFF] ^ S[5][(t >> 16) & 0xFF] ^ S[6][(t >> 8) & 0xFF] ^ S[7][t & 0xFF];
 1460     }
 1461 
 1462     VC_INLINE uint64 FL(uint64 x, uint64 k)
 1463     {
 1464         uint32 xl = (uint32)(x >> 32);
 1465         uint32 xr = (uint32)(x);
 1466         uint32 kl = (uint32)(k >> 32);
 1467         uint32 kr = (uint32)(k);
 1468 
 1469         uint32 yr = rotl32(xl & kl, 1) ^ xr;
 1470         uint32 yl = (yr | kr) ^ xl;
 1471         return (((uint64)(yl)) << 32) | yr;
 1472     }
 1473 
 1474     VC_INLINE uint64 FL1(uint64 y, uint64 k)
 1475     {
 1476         uint32 yl = (uint32)(y >> 32);
 1477         uint32 yr = (uint32)(y);
 1478         uint32 kl = (uint32)(k >> 32);
 1479         uint32 kr = (uint32)(k);
 1480 
 1481         uint32 xl = (yr | kr) ^ yl;
 1482         uint32 xr = rotl32(xl & kl, 1) ^ yr;
 1483         return (((uint64)(xl)) << 32) | xr;
 1484     }
 1485 
 1486     VC_INLINE uint64 rotl128l(uint64 l, uint64 r, int n)
 1487     {
 1488         return (l << n) | (r >> (64 - n));
 1489     }
 1490 
 1491     VC_INLINE uint64 rotl128r(uint64 l, uint64 r, int n)
 1492     {
 1493         return (r << n) | (l >> (64 - n));
 1494     }
 1495 
 1496     
 1497 void camellia_set_key(const unsigned __int8 key[], unsigned __int8 *ksPtr)
 1498 {
 1499     uint64 *ks = (uint64 *) ksPtr;
 1500     uint64 kll = bswap_64(*((uint64*)key));
 1501     uint64 klr = bswap_64(*((uint64*)(key + 8)));
 1502     uint64 krl = bswap_64(*((uint64*)(key + 16)));
 1503     uint64 krr = bswap_64(*((uint64*)(key + 24)));
 1504 
 1505 #ifdef CPPCRYPTO_DEBUG
 1506     printf("kl: %016I64x %016I64x\n", kll, klr);
 1507     printf("kr: %016I64x %016I64x\n", krl, krr);
 1508 #endif
 1509 
 1510     uint64 kal = kll ^ krl;
 1511     uint64 kar = klr ^ krr;
 1512     uint64 lp = kal;
 1513     uint64 kbl, kbr;
 1514 
 1515     kal = kar ^ F(kal, KS[0]);
 1516     kar = kal;
 1517     kal = lp ^ F(kal, KS[1]);
 1518     kal ^= kll;
 1519     kar ^= klr;
 1520 
 1521     lp = kal;
 1522     kal = kar ^ F(kal, KS[2]);
 1523     kar = kal;
 1524     kal = lp ^ F(kal, KS[3]);
 1525 
 1526 #ifdef CPPCRYPTO_DEBUG
 1527     printf("ka: %016I64x %016I64x\n", kal, kar);
 1528 #endif
 1529     kbl = kal ^ krl;
 1530     kbr = kar ^ krr;
 1531     lp = kbl;
 1532     kbl = kbr ^ F(kbl, KS[4]);
 1533     kbr = kbl;
 1534     kbl = lp ^ F(kbl, KS[5]);
 1535 #ifdef CPPCRYPTO_DEBUG
 1536     printf("kb: %016I64x %016I64x\n", kbl, kbr);
 1537 #endif
 1538 
 1539     ks[0] = kll;
 1540     ks[1] = klr;
 1541     ks[2] = kbl;
 1542     ks[3] = kbr;
 1543     ks[4] = rotl128l(krl, krr, 15);
 1544     ks[5] = rotl128r(krl, krr, 15);
 1545     ks[6] = rotl128l(kal, kar, 15);
 1546     ks[7] = rotl128r(kal, kar, 15);
 1547     ks[8] = rotl128l(krl, krr, 30);
 1548     ks[9] = rotl128r(krl, krr, 30);
 1549 
 1550     ks[10] = rotl128l(kbl, kbr, 30);
 1551     ks[11] = rotl128r(kbl, kbr, 30);
 1552     ks[12] = rotl128l(kll, klr, 45);
 1553     ks[13] = rotl128r(kll, klr, 45);
 1554     ks[14] = rotl128l(kal, kar, 45);
 1555     ks[15] = rotl128r(kal, kar, 45);
 1556     ks[16] = rotl128l(kll, klr, 60);
 1557     ks[17] = rotl128r(kll, klr, 60);
 1558 
 1559     ks[18] = rotl128l(krl, krr, 60);
 1560     ks[19] = rotl128r(krl, krr, 60);
 1561     ks[20] = rotl128l(kbl, kbr, 60);
 1562     ks[21] = rotl128r(kbl, kbr, 60);
 1563     ks[22] = rotl128r(kll, klr, 13);
 1564     ks[23] = rotl128l(kll, klr, 13);
 1565     ks[24] = rotl128r(kal, kar, 13);
 1566     ks[25] = rotl128l(kal, kar, 13);
 1567 
 1568     ks[26] = ks[9]; // rotl128r(krl, krr, 30);
 1569     ks[27] = ks[8]; // rotl128l(krl, krr, 30);
 1570     ks[28] = rotl128r(kal, kar, 30);
 1571     ks[29] = rotl128l(kal, kar, 30);
 1572     ks[30] = rotl128r(kll, klr, 47);
 1573     ks[31] = rotl128l(kll, klr, 47);
 1574     ks[32] = rotl128r(kbl, kbr, 47);
 1575     ks[33] = rotl128l(kbl, kbr, 47);
 1576 
 1577 #ifdef CPPCRYPTO_DEBUG
 1578     for (int i = 0; i < 34; i++)
 1579         printf("ks[%d]: %016I64x\n", i, ks[i]);
 1580 #endif
 1581 }
 1582 
 1583 void camellia_encrypt(const unsigned __int8 *in, unsigned __int8 *out, unsigned __int8 *ksPtr)
 1584 {
 1585     uint64 *ks = (uint64 *) ksPtr;
 1586     uint64 l = bswap_64(*((uint64*)in)) ^ ks[0];
 1587     uint64 r = bswap_64(*((uint64*)(in + 8))) ^ ks[1];
 1588 
 1589 #ifdef CPPCRYPTO_DEBUG
 1590     printf("r0: %016I64x %016I64x\n", l, r);
 1591 #endif
 1592     // r = 1
 1593     uint64 lp = l;
 1594     l = r ^ F(l, ks[2]);
 1595     // r = lp;
 1596 #ifdef CPPCRYPTO_DEBUG
 1597     printf("r1: %016I64x %016I64x\n", l, lp);
 1598 #endif
 1599 
 1600     // r = 2
 1601     r = l;
 1602     l = lp ^ F(l, ks[3]);
 1603 #ifdef CPPCRYPTO_DEBUG
 1604     printf("r2: %016I64x %016I64x\n", l, r);
 1605 #endif
 1606 
 1607     // r = 3
 1608     lp = l;
 1609     l = r ^ F(l, ks[4]);
 1610 #ifdef CPPCRYPTO_DEBUG
 1611     printf("r3: %016I64x %016I64x\n", l, lp);
 1612 #endif
 1613 
 1614     // r = 4
 1615     r = l;
 1616     l = lp ^ F(l, ks[5]);
 1617 #ifdef CPPCRYPTO_DEBUG
 1618     printf("r4: %016I64x %016I64x\n", l, r);
 1619 #endif
 1620 
 1621     // r = 5
 1622     lp = l;
 1623     l = r ^ F(l, ks[6]);
 1624 #ifdef CPPCRYPTO_DEBUG
 1625     printf("r5: %016I64x %016I64x\n", l, lp);
 1626 #endif
 1627 
 1628     // r = 6
 1629     r = l;
 1630     l = lp ^ F(l, ks[7]);
 1631     l = FL(l, ks[8]);
 1632     r = FL1(r, ks[9]);
 1633 #ifdef CPPCRYPTO_DEBUG
 1634     printf("r6: %016I64x %016I64x\n", l, r);
 1635 #endif
 1636 
 1637     // r = 7
 1638     lp = l;
 1639     l = r ^ F(l, ks[10]);
 1640 
 1641     // r = 8
 1642     r = l;
 1643     l = lp ^ F(l, ks[11]);
 1644 
 1645     // r = 9
 1646     lp = l;
 1647     l = r ^ F(l, ks[12]);
 1648 
 1649     // r = 10
 1650     r = l;
 1651     l = lp ^ F(l, ks[13]);
 1652 
 1653     // r = 11
 1654     lp = l;
 1655     l = r ^ F(l, ks[14]);
 1656 
 1657     // r = 12
 1658     r = l;
 1659     l = lp ^ F(l, ks[15]);
 1660     l = FL(l, ks[16]);
 1661     r = FL1(r, ks[17]);
 1662 
 1663     // r = 13
 1664     lp = l;
 1665     l = r ^ F(l, ks[18]);
 1666 
 1667     // r = 14
 1668     r = l;
 1669     l = lp ^ F(l, ks[19]);
 1670 
 1671     // r = 15
 1672     lp = l;
 1673     l = r ^ F(l, ks[20]);
 1674 
 1675     // r = 16
 1676     r = l;
 1677     l = lp ^ F(l, ks[21]);
 1678 
 1679     // r = 17
 1680     lp = l;
 1681     l = r ^ F(l, ks[22]);
 1682 
 1683     // r = 18
 1684     r = l;
 1685     l = lp ^ F(l, ks[23]);
 1686     l = FL(l, ks[24]);
 1687     r = FL1(r, ks[25]);
 1688 
 1689     // r = 19
 1690     lp = l;
 1691     l = r ^ F(l, ks[26]);
 1692 
 1693     // r = 20
 1694     r = l;
 1695     l = lp ^ F(l, ks[27]);
 1696 
 1697     // r = 21
 1698     lp = l;
 1699     l = r ^ F(l, ks[28]);
 1700 
 1701     // r = 22
 1702     r = l;
 1703     l = lp ^ F(l, ks[29]);
 1704 
 1705     // r = 23
 1706     lp = l;
 1707     l = r ^ F(l, ks[30]);
 1708 
 1709     // r = 24
 1710     r = l;
 1711     l = lp ^ F(l, ks[31]);
 1712 
 1713     r ^= ks[32];
 1714     l ^= ks[33];
 1715 
 1716     *(uint64*)out = bswap_64(r);
 1717     *(uint64*)(out + 8) = bswap_64(l);
 1718 }
 1719 
 1720 
 1721 void camellia_decrypt(const unsigned __int8 *in,  unsigned __int8 *out, unsigned __int8 *ksPtr)
 1722 {
 1723     uint64 *ks = (uint64 *) ksPtr;
 1724     uint64 r = bswap_64(*((uint64*)in)) ^ ks[32];
 1725     uint64 l = bswap_64(*((uint64*)(in + 8))) ^ ks[33];
 1726 
 1727 #ifdef CPPCRYPTO_DEBUG
 1728     printf("DECRYPT: %016I64x %016I64x\n", l, r);
 1729 #endif
 1730 
 1731     // r = 24
 1732     uint64 rp = r;
 1733     r = l ^ F(r, ks[31]);
 1734 
 1735 #ifdef CPPCRYPTO_DEBUG
 1736     printf("DECRYPT: %016I64x %016I64x\n", rp, r);
 1737 #endif
 1738 
 1739     // r = 23
 1740     l = r;
 1741     r = rp ^ F(r, ks[30]);
 1742 #ifdef CPPCRYPTO_DEBUG
 1743     printf("DECRYPT: %016I64x %016I64x\n", l, r);
 1744 #endif
 1745 
 1746     // r = 22
 1747     rp = r;
 1748     r = l ^ F(r, ks[29]);
 1749 #ifdef CPPCRYPTO_DEBUG
 1750     printf("DECRYPT: %016I64x %016I64x\n", rp, r);
 1751 #endif
 1752 
 1753     // r = 21
 1754     l = r;
 1755     r = rp ^ F(r, ks[28]);
 1756 #ifdef CPPCRYPTO_DEBUG
 1757     printf("DECRYPT: %016I64x %016I64x\n", l, r);
 1758 #endif
 1759 
 1760     // r = 20
 1761     rp = r;
 1762     r = l ^ F(r, ks[27]);
 1763 #ifdef CPPCRYPTO_DEBUG
 1764     printf("DECRYPT: %016I64x %016I64x\n", rp, r);
 1765 #endif
 1766 
 1767     // r = 19
 1768     l = r;
 1769     r = rp ^ F(r, ks[26]);
 1770 #ifdef CPPCRYPTO_DEBUG
 1771     printf("DECRYPT: %016I64x %016I64x\n", l, r);
 1772 #endif
 1773     l = FL1(l, ks[24]);
 1774     r = FL(r, ks[25]);
 1775 
 1776 #ifdef CPPCRYPTO_DEBUG
 1777     printf("DECRYPTFL: %016I64x %016I64x\n", l, r);
 1778 #endif
 1779 
 1780     // r = 18
 1781     rp = r;
 1782     r = l ^ F(r, ks[23]);
 1783 #ifdef CPPCRYPTO_DEBUG
 1784     printf("DECRYPT18: %016I64x %016I64x\n", rp, r);
 1785 #endif
 1786 
 1787     // r = 17
 1788     l = r;
 1789     r = rp ^ F(r, ks[22]);
 1790 
 1791 #ifdef CPPCRYPTO_DEBUG
 1792     printf("DECRYPT: %016I64x %016I64x\n", l, r);
 1793 #endif
 1794 
 1795     // r = 16
 1796     rp = r;
 1797     r = l ^ F(r, ks[21]);
 1798 
 1799 #ifdef CPPCRYPTO_DEBUG
 1800     printf("DECRYPT: %016I64x %016I64x\n", rp, r);
 1801 #endif
 1802 
 1803     // r = 15
 1804     l = r;
 1805     r = rp ^ F(r, ks[20]);
 1806 
 1807 #ifdef CPPCRYPTO_DEBUG
 1808     printf("DECRYPT: %016I64x %016I64x\n", l, r);
 1809 #endif
 1810 
 1811     // r = 14
 1812     rp = r;
 1813     r = l ^ F(r, ks[19]);
 1814 
 1815 #ifdef CPPCRYPTO_DEBUG
 1816     printf("DECRYPT: %016I64x %016I64x\n", rp, r);
 1817 #endif
 1818 
 1819     // r = 13
 1820     l = r;
 1821     r = rp ^ F(r, ks[18]);
 1822     l = FL1(l, ks[16]);
 1823     r = FL(r, ks[17]);
 1824 
 1825 #ifdef CPPCRYPTO_DEBUG
 1826     printf("DECRYPT: %016I64x %016I64x\n", l, r);
 1827 #endif
 1828 
 1829     // r = 12
 1830     rp = r;
 1831     r = l ^ F(r, ks[15]);
 1832 
 1833     // r = 11
 1834     l = r;
 1835     r = rp ^ F(r, ks[14]);
 1836 
 1837     // r = 10
 1838     rp = r;
 1839     r = l ^ F(r, ks[13]);
 1840 
 1841     // r = 9
 1842     l = r;
 1843     r = rp ^ F(r, ks[12]);
 1844 
 1845     // r = 8
 1846     rp = r;
 1847     r = l ^ F(r, ks[11]);
 1848 
 1849     // r = 7
 1850     l = r;
 1851     r = rp ^ F(r, ks[10]);
 1852     l = FL1(l, ks[8]);
 1853     r = FL(r, ks[9]);
 1854 
 1855     // r = 6
 1856     rp = r;
 1857     r = l ^ F(r, ks[7]);
 1858 
 1859     // r = 5
 1860     l = r;
 1861     r = rp ^ F(r, ks[6]);
 1862 
 1863     // r = 4
 1864     rp = r;
 1865     r = l ^ F(r, ks[5]);
 1866 
 1867     // r = 3
 1868     l = r;
 1869     r = rp ^ F(r, ks[4]);
 1870 
 1871     // r = 2
 1872     rp = r;
 1873     r = l ^ F(r, ks[3]);
 1874 
 1875     // r = 1
 1876     l = r;
 1877     r = rp ^ F(r, ks[2]);
 1878 
 1879     // r = 0
 1880     l ^= ks[0];
 1881     r ^= ks[1];
 1882 
 1883     *(uint64*)out = bswap_64(l);
 1884     *(uint64*)(out + 8) = bswap_64(r);
 1885 }
 1886 
 1887 #endif