void av_aes_crypt(AVAES *a, uint8_t *dst_, const uint8_t *src_,

                  int count, uint8_t *iv_, int decrypt)

{

    av_aes_block       *dst = (av_aes_block *) dst_;

    const av_aes_block *src = (const av_aes_block *) src_;

    av_aes_block        *iv = (av_aes_block *) iv_;



    while (count--) {

        addkey(&a->state[1], src, &a->round_key[a->rounds]);

        if (decrypt) {

            crypt(a, 0, inv_sbox, dec_multbl);

            if (iv) {

                addkey(&a->state[0], &a->state[0], iv);

                memcpy(iv, src, 16);

            }

            addkey(dst, &a->state[0], &a->round_key[0]);

        } else {

            if (iv)

                addkey(&a->state[1], &a->state[1], iv);

            crypt(a, 2, sbox, enc_multbl);

            addkey(dst, &a->state[0], &a->round_key[0]);

            if (iv)

                memcpy(iv, dst, 16);

        }

        src++;

        dst++;

    }

}

void av_aes_crypt(AVAES *a, uint8_t *dst_, const uint8_t *src_,

                  int count, uint8_t *iv_, int decrypt)

{

    av_aes_block       *dst = (av_aes_block *) dst_;

    const av_aes_block *src = (const av_aes_block *) src_;

    av_aes_block        *iv = (av_aes_block *) iv_;



    while (count--) {

        addkey(&a->state[1], src, &a->round_key[a->rounds]);

        if (decrypt) {

            crypt(a, 0, inv_sbox, dec_multbl);

            if (iv) {

                addkey(&a->state[0], &a->state[0], iv);

                memcpy(iv, src, 16);

            }

            addkey(dst, &a->state[0], &a->round_key[0]);

        } else {

            if (iv)

                addkey(&a->state[1], &a->state[1], iv);

            crypt(a, 2, sbox, enc_multbl);

            addkey(dst, &a->state[0], &a->round_key[0]);

            if (iv)

                memcpy(iv, dst, 16);

        }

        src++;

        dst++;

    }

}

void FUNC_0(AVAES *VAR_0, uint8_t *VAR_1, const uint8_t *VAR_2,

                  int VAR_3, uint8_t *VAR_4, int VAR_5)

{

    av_aes_block       *dst = (av_aes_block *) VAR_1;

    const av_aes_block *VAR_6 = (const av_aes_block *) VAR_2;

    av_aes_block        *iv = (av_aes_block *) VAR_4;



    while (VAR_3--) {

        addkey(&VAR_0->state[1], VAR_6, &VAR_0->round_key[VAR_0->rounds]);

        if (VAR_5) {

            crypt(VAR_0, 0, inv_sbox, dec_multbl);

            if (iv) {

                addkey(&VAR_0->state[0], &VAR_0->state[0], iv);

                memcpy(iv, VAR_6, 16);

            }

            addkey(dst, &VAR_0->state[0], &VAR_0->round_key[0]);

        } else {

            if (iv)

                addkey(&VAR_0->state[1], &VAR_0->state[1], iv);

            crypt(VAR_0, 2, sbox, enc_multbl);

            addkey(dst, &VAR_0->state[0], &VAR_0->round_key[0]);

            if (iv)

                memcpy(iv, dst, 16);

        }

        VAR_6++;

        dst++;

    }

}

void FUNC_0(AVAES *VAR_0, uint8_t *VAR_1, const uint8_t *VAR_2,
int VAR_3, uint8_t *VAR_4, int VAR_5)
{ av_aes_block       *dst = (av_aes_block *) VAR_1; const av_aes_block *VAR_6 = (const av_aes_block *) VAR_2; av_aes_block        *iv = (av_aes_block *) VAR_4; while (VAR_3--) { addkey(&VAR_0->state[1], VAR_6, &VAR_0->round_key[VAR_0->rounds]); if (VAR_5) { crypt(VAR_0, 0, inv_sbox, dec_multbl); if (iv) { addkey(&VAR_0->state[0], &VAR_0->state[0], iv); memcpy(iv, VAR_6, 16); } addkey(dst, &VAR_0->state[0], &VAR_0->round_key[0]); } else { if (iv)
addkey(&VAR_0->state[1], &VAR_0->state[1], iv); crypt(VAR_0, 2, sbox, enc_multbl); addkey(dst, &VAR_0->state[0], &VAR_0->round_key[0]); if (iv)
memcpy(iv, dst, 16); } VAR_6++; dst++; } }