static inline void mix(uint8_t state[2][4][4], uint32_t multbl[4][256], int s1, int s3){
    ((uint32_t *)(state))[0] = mix_core(multbl, state[1][0][0], state[1][s1  ][1], state[1][2][2], state[1][s3  ][3]);
    ((uint32_t *)(state))[1] = mix_core(multbl, state[1][1][0], state[1][s3-1][1], state[1][3][2], state[1][s1-1][3]);
    ((uint32_t *)(state))[2] = mix_core(multbl, state[1][2][0], state[1][s3  ][1], state[1][0][2], state[1][s1  ][3]);
    ((uint32_t *)(state))[3] = mix_core(multbl, state[1][3][0], state[1][s1-1][1], state[1][1][2], state[1][s3-1][3]);
}
['int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt) {\n    int i, j, t, rconpointer = 0;\n    uint8_t tk[8][4];\n    int KC= key_bits>>5;\n    int rounds= KC + 6;\n    uint8_t  log8[256];\n    uint8_t alog8[512];\n    if(!enc_multbl[0][sizeof(enc_multbl)/sizeof(enc_multbl[0][0])-1]){\n        j=1;\n        for(i=0; i<255; i++){\n            alog8[i]=\n            alog8[i+255]= j;\n            log8[j]= i;\n            j^= j+j;\n            if(j>255) j^= 0x11B;\n        }\n        for(i=0; i<256; i++){\n            j= i ? alog8[255-log8[i]] : 0;\n            j ^= (j<<1) ^ (j<<2) ^ (j<<3) ^ (j<<4);\n            j = (j ^ (j>>8) ^ 99) & 255;\n            inv_sbox[j]= i;\n            sbox    [i]= j;\n        }\n        init_multbl2(dec_multbl[0], (int[4]){0xe, 0x9, 0xd, 0xb}, log8, alog8, inv_sbox);\n        init_multbl2(enc_multbl[0], (int[4]){0x2, 0x1, 0x1, 0x3}, log8, alog8, sbox);\n    }\n    if(key_bits!=128 && key_bits!=192 && key_bits!=256)\n        return -1;\n    a->rounds= rounds;\n    memcpy(tk, key, KC*4);\n    for(t= 0; t < (rounds+1)*16;) {\n        memcpy(a->round_key[0][0]+t, tk, KC*4);\n        t+= KC*4;\n        for(i = 0; i < 4; i++)\n            tk[0][i] ^= sbox[tk[KC-1][(i+1)&3]];\n        tk[0][0] ^= rcon[rconpointer++];\n        for(j = 1; j < KC; j++){\n            if(KC != 8 || j != KC>>1)\n                for(i = 0; i < 4; i++) tk[j][i] ^=      tk[j-1][i];\n            else\n                for(i = 0; i < 4; i++) tk[j][i] ^= sbox[tk[j-1][i]];\n        }\n    }\n    if(decrypt){\n        for(i=1; i<rounds; i++){\n            uint8_t tmp[3][16];\n            memcpy(tmp[2], a->round_key[i][0], 16);\n            subshift(tmp[1], 0, sbox);\n            mix(tmp, dec_multbl, 1, 3);\n            memcpy(a->round_key[i][0], tmp[0], 16);\n        }\n    }else{\n        for(i=0; i<(rounds+1)>>1; i++){\n            for(j=0; j<16; j++)\n                FFSWAP(int, a->round_key[i][0][j], a->round_key[rounds-i][0][j]);\n        }\n    }\n    return 0;\n}', 'static inline void mix(uint8_t state[2][4][4], uint32_t multbl[4][256], int s1, int s3){\n    ((uint32_t *)(state))[0] = mix_core(multbl, state[1][0][0], state[1][s1  ][1], state[1][2][2], state[1][s3  ][3]);\n    ((uint32_t *)(state))[1] = mix_core(multbl, state[1][1][0], state[1][s3-1][1], state[1][3][2], state[1][s1-1][3]);\n    ((uint32_t *)(state))[2] = mix_core(multbl, state[1][2][0], state[1][s3  ][1], state[1][0][2], state[1][s1  ][3]);\n    ((uint32_t *)(state))[3] = mix_core(multbl, state[1][3][0], state[1][s1-1][1], state[1][1][2], state[1][s3-1][3]);\n}']