static void gain_scale(G723_1_Context *p, int16_t * buf, int energy)

{

    int num, denom, gain, bits1, bits2;

    int i;



    num   = energy;

    denom = 0;

    for (i = 0; i < SUBFRAME_LEN; i++) {

        int64_t temp = buf[i] >> 2;

        temp  = av_clipl_int32(MUL64(temp, temp) << 1);

        denom = av_clipl_int32(denom + temp);

    }



    if (num && denom) {

        bits1   = normalize_bits(num,   31);

        bits2   = normalize_bits(denom, 31);

        num     = num << bits1 >> 1;

        denom <<= bits2;



        bits2 = 5 + bits1 - bits2;

        bits2 = FFMAX(0, bits2);



        gain = (num >> 1) / (denom >> 16);

        gain = square_root(gain << 16 >> bits2);

    } else {

        gain = 1 << 12;

    }



    for (i = 0; i < SUBFRAME_LEN; i++) {

        p->pf_gain = (15 * p->pf_gain + gain + (1 << 3)) >> 4;

        buf[i]     = av_clip_int16((buf[i] * (p->pf_gain + (p->pf_gain >> 4)) +

                                   (1 << 10)) >> 11);

    }

}

static void gain_scale(G723_1_Context *p, int16_t * buf, int energy)

{

    int num, denom, gain, bits1, bits2;

    int i;



    num   = energy;

    denom = 0;

    for (i = 0; i < SUBFRAME_LEN; i++) {

        int64_t temp = buf[i] >> 2;

        temp  = av_clipl_int32(MUL64(temp, temp) << 1);

        denom = av_clipl_int32(denom + temp);

    }



    if (num && denom) {

        bits1   = normalize_bits(num,   31);

        bits2   = normalize_bits(denom, 31);

        num     = num << bits1 >> 1;

        denom <<= bits2;



        bits2 = 5 + bits1 - bits2;

        bits2 = FFMAX(0, bits2);



        gain = (num >> 1) / (denom >> 16);

        gain = square_root(gain << 16 >> bits2);

    } else {

        gain = 1 << 12;

    }



    for (i = 0; i < SUBFRAME_LEN; i++) {

        p->pf_gain = (15 * p->pf_gain + gain + (1 << 3)) >> 4;

        buf[i]     = av_clip_int16((buf[i] * (p->pf_gain + (p->pf_gain >> 4)) +

                                   (1 << 10)) >> 11);

    }

}

        int64_t temp = buf[i] >> 2;         temp  = av_clipl_int32(MUL64(temp, temp) << 1);         denom = av_clipl_int32(denom + temp);
static void FUNC_0(G723_1_Context *VAR_0, int16_t * VAR_1, int VAR_2)

{

    int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;

    int VAR_8;



    VAR_3   = VAR_2;

    VAR_4 = 0;

    for (VAR_8 = 0; VAR_8 < SUBFRAME_LEN; VAR_8++) {

        int64_t temp = VAR_1[VAR_8] >> 2;

        temp  = av_clipl_int32(MUL64(temp, temp) << 1);

        VAR_4 = av_clipl_int32(VAR_4 + temp);

    }



    if (VAR_3 && VAR_4) {

        VAR_6   = normalize_bits(VAR_3,   31);

        VAR_7   = normalize_bits(VAR_4, 31);

        VAR_3     = VAR_3 << VAR_6 >> 1;

        VAR_4 <<= VAR_7;



        VAR_7 = 5 + VAR_6 - VAR_7;

        VAR_7 = FFMAX(0, VAR_7);



        VAR_5 = (VAR_3 >> 1) / (VAR_4 >> 16);

        VAR_5 = square_root(VAR_5 << 16 >> VAR_7);

    } else {

        VAR_5 = 1 << 12;

    }



    for (VAR_8 = 0; VAR_8 < SUBFRAME_LEN; VAR_8++) {

        VAR_0->pf_gain = (15 * VAR_0->pf_gain + VAR_5 + (1 << 3)) >> 4;

        VAR_1[VAR_8]     = av_clip_int16((VAR_1[VAR_8] * (VAR_0->pf_gain + (VAR_0->pf_gain >> 4)) +

                                   (1 << 10)) >> 11);

    }

}

static void FUNC_0(G723_1_Context *VAR_0, int16_t * VAR_1, int VAR_2)
{ int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7; int VAR_8; VAR_3   = VAR_2; VAR_4 = 0; for (VAR_8 = 0; VAR_8 < SUBFRAME_LEN; VAR_8++) { int64_t temp = VAR_1[VAR_8] >> 2; temp  = av_clipl_int32(MUL64(temp, temp) << 1); VAR_4 = av_clipl_int32(VAR_4 + temp); } if (VAR_3 && VAR_4) { VAR_6   = normalize_bits(VAR_3,   31); VAR_7   = normalize_bits(VAR_4, 31); VAR_3     = VAR_3 << VAR_6 >> 1; VAR_4 <<= VAR_7; VAR_7 = 5 + VAR_6 - VAR_7; VAR_7 = FFMAX(0, VAR_7); VAR_5 = (VAR_3 >> 1) / (VAR_4 >> 16); VAR_5 = square_root(VAR_5 << 16 >> VAR_7); } else { VAR_5 = 1 << 12; } for (VAR_8 = 0; VAR_8 < SUBFRAME_LEN; VAR_8++) { VAR_0->pf_gain = (15 * VAR_0->pf_gain + VAR_5 + (1 << 3)) >> 4; VAR_1[VAR_8]     = av_clip_int16((VAR_1[VAR_8] * (VAR_0->pf_gain + (VAR_0->pf_gain >> 4)) +
(1 << 10)) >> 11); } }