static void subshift(uint8_t s0[2][16], int s, uint8_t *box){
    uint8_t (*s1)[16]= s0[0] - s;
    uint8_t (*s3)[16]= s0[0] + s;
    s0[0][0]=box[s0[1][ 0]]; s0[0][ 4]=box[s0[1][ 4]]; s0[0][ 8]=box[s0[1][ 8]]; s0[0][12]=box[s0[1][12]];
    s1[0][3]=box[s1[1][ 7]]; s1[0][ 7]=box[s1[1][11]]; s1[0][11]=box[s1[1][15]]; s1[0][15]=box[s1[1][ 3]];
    s0[0][2]=box[s0[1][10]]; s0[0][10]=box[s0[1][ 2]]; s0[0][ 6]=box[s0[1][14]]; s0[0][14]=box[s0[1][ 6]];
    s3[0][1]=box[s3[1][13]]; s3[0][13]=box[s3[1][ 9]]; s3[0][ 9]=box[s3[1][ 5]]; s3[0][ 5]=box[s3[1][ 1]];
}
['void av_aes_crypt(AVAES *a, uint8_t *dst, uint8_t *src, int count, uint8_t *iv, int decrypt){\n    while(count--){\n        addkey(a->state[1], src, a->round_key[a->rounds]);\n        if(decrypt) {\n            crypt(a, 0, inv_sbox, dec_multbl);\n            if(iv){\n                addkey(a->state[0], a->state[0], iv);\n                memcpy(iv, src, 16);\n            }\n            addkey(dst, a->state[0], a->round_key[0]);\n        }else{\n            if(iv) addkey(a->state[1], a->state[1], iv);\n            crypt(a, 2,     sbox, enc_multbl);\n            addkey(dst, a->state[0], a->round_key[0]);\n            if(iv) memcpy(iv, dst, 16);\n        }\n        src+=16;\n        dst+=16;\n    }\n}', 'static inline void crypt(AVAES *a, int s, uint8_t *sbox, uint32_t *multbl){\n    int r;\n    for(r=a->rounds-1; r>0; r--){\n        mix(a->state, multbl, 3-s, 1+s);\n        addkey(a->state[1], a->state[0], a->round_key[r]);\n    }\n    subshift(a->state[0][0], s, sbox);\n}', 'static void subshift(uint8_t s0[2][16], int s, uint8_t *box){\n    uint8_t (*s1)[16]= s0[0] - s;\n    uint8_t (*s3)[16]= s0[0] + s;\n    s0[0][0]=box[s0[1][ 0]]; s0[0][ 4]=box[s0[1][ 4]]; s0[0][ 8]=box[s0[1][ 8]]; s0[0][12]=box[s0[1][12]];\n    s1[0][3]=box[s1[1][ 7]]; s1[0][ 7]=box[s1[1][11]]; s1[0][11]=box[s1[1][15]]; s1[0][15]=box[s1[1][ 3]];\n    s0[0][2]=box[s0[1][10]]; s0[0][10]=box[s0[1][ 2]]; s0[0][ 6]=box[s0[1][14]]; s0[0][14]=box[s0[1][ 6]];\n    s3[0][1]=box[s3[1][13]]; s3[0][13]=box[s3[1][ 9]]; s3[0][ 9]=box[s3[1][ 5]]; s3[0][ 5]=box[s3[1][ 1]];\n}']