static int16_t g726_decode(G726Context* c, int I)

{

    int dq, re_signal, pk0, fa1, i, tr, ylint, ylfrac, thr2, al, dq0;

    Float11 f;

    int I_sig= I >> (c->code_size - 1);



    dq = inverse_quant(c, I);



    /* Transition detect */

    ylint = (c->yl >> 15);

    ylfrac = (c->yl >> 10) & 0x1f;

    thr2 = (ylint > 9) ? 0x1f << 10 : (0x20 + ylfrac) << ylint;

    tr= (c->td == 1 && dq > ((3*thr2)>>2));



    if (I_sig)  /* get the sign */

        dq = -dq;

    re_signal = (int16_t)(c->se + dq);



    /* Update second order predictor coefficient A2 and A1 */

    pk0 = (c->sez + dq) ? sgn(c->sez + dq) : 0;

    dq0 = dq ? sgn(dq) : 0;

    if (tr) {

        c->a[0] = 0;

        c->a[1] = 0;

        for (i=0; i<6; i++)

            c->b[i] = 0;

    } else {

        /* This is a bit crazy, but it really is +255 not +256 */

        fa1 = av_clip_intp2((-c->a[0]*c->pk[0]*pk0)>>5, 8);



        c->a[1] += 128*pk0*c->pk[1] + fa1 - (c->a[1]>>7);

        c->a[1] = av_clip(c->a[1], -12288, 12288);

        c->a[0] += 64*3*pk0*c->pk[0] - (c->a[0] >> 8);

        c->a[0] = av_clip(c->a[0], -(15360 - c->a[1]), 15360 - c->a[1]);



        for (i=0; i<6; i++)

            c->b[i] += 128*dq0*sgn(-c->dq[i].sign) - (c->b[i]>>8);

    }



    /* Update Dq and Sr and Pk */

    c->pk[1] = c->pk[0];

    c->pk[0] = pk0 ? pk0 : 1;

    c->sr[1] = c->sr[0];

    i2f(re_signal, &c->sr[0]);

    for (i=5; i>0; i--)

        c->dq[i] = c->dq[i-1];

    i2f(dq, &c->dq[0]);

    c->dq[0].sign = I_sig; /* Isn't it crazy ?!?! */



    c->td = c->a[1] < -11776;



    /* Update Ap */

    c->dms += (c->tbls.F[I]<<4) + ((- c->dms) >> 5);

    c->dml += (c->tbls.F[I]<<4) + ((- c->dml) >> 7);

    if (tr)

        c->ap = 256;

    else {

        c->ap += (-c->ap) >> 4;

        if (c->y <= 1535 || c->td || abs((c->dms << 2) - c->dml) >= (c->dml >> 3))

            c->ap += 0x20;

    }



    /* Update Yu and Yl */

    c->yu = av_clip(c->y + c->tbls.W[I] + ((-c->y)>>5), 544, 5120);

    c->yl += c->yu + ((-c->yl)>>6);



    /* Next iteration for Y */

    al = (c->ap >= 256) ? 1<<6 : c->ap >> 2;

    c->y = (c->yl + (c->yu - (c->yl>>6))*al) >> 6;



    /* Next iteration for SE and SEZ */

    c->se = 0;

    for (i=0; i<6; i++)

        c->se += mult(i2f(c->b[i] >> 2, &f), &c->dq[i]);

    c->sez = c->se >> 1;

    for (i=0; i<2; i++)

        c->se += mult(i2f(c->a[i] >> 2, &f), &c->sr[i]);

    c->se >>= 1;



    return av_clip(re_signal << 2, -0xffff, 0xffff);

}

static int16_t g726_decode(G726Context* c, int I)

{

    int dq, re_signal, pk0, fa1, i, tr, ylint, ylfrac, thr2, al, dq0;

    Float11 f;

    int I_sig= I >> (c->code_size - 1);



    dq = inverse_quant(c, I);



    

    ylint = (c->yl >> 15);

    ylfrac = (c->yl >> 10) & 0x1f;

    thr2 = (ylint > 9) ? 0x1f << 10 : (0x20 + ylfrac) << ylint;

    tr= (c->td == 1 && dq > ((3*thr2)>>2));



    if (I_sig)  

        dq = -dq;

    re_signal = (int16_t)(c->se + dq);



    

    pk0 = (c->sez + dq) ? sgn(c->sez + dq) : 0;

    dq0 = dq ? sgn(dq) : 0;

    if (tr) {

        c->a[0] = 0;

        c->a[1] = 0;

        for (i=0; i<6; i++)

            c->b[i] = 0;

    } else {

        

        fa1 = av_clip_intp2((-c->a[0]*c->pk[0]*pk0)>>5, 8);



        c->a[1] += 128*pk0*c->pk[1] + fa1 - (c->a[1]>>7);

        c->a[1] = av_clip(c->a[1], -12288, 12288);

        c->a[0] += 64*3*pk0*c->pk[0] - (c->a[0] >> 8);

        c->a[0] = av_clip(c->a[0], -(15360 - c->a[1]), 15360 - c->a[1]);



        for (i=0; i<6; i++)

            c->b[i] += 128*dq0*sgn(-c->dq[i].sign) - (c->b[i]>>8);

    }



    

    c->pk[1] = c->pk[0];

    c->pk[0] = pk0 ? pk0 : 1;

    c->sr[1] = c->sr[0];

    i2f(re_signal, &c->sr[0]);

    for (i=5; i>0; i--)

        c->dq[i] = c->dq[i-1];

    i2f(dq, &c->dq[0]);

    c->dq[0].sign = I_sig; 



    c->td = c->a[1] < -11776;



    

    c->dms += (c->tbls.F[I]<<4) + ((- c->dms) >> 5);

    c->dml += (c->tbls.F[I]<<4) + ((- c->dml) >> 7);

    if (tr)

        c->ap = 256;

    else {

        c->ap += (-c->ap) >> 4;

        if (c->y <= 1535 || c->td || abs((c->dms << 2) - c->dml) >= (c->dml >> 3))

            c->ap += 0x20;

    }



    

    c->yu = av_clip(c->y + c->tbls.W[I] + ((-c->y)>>5), 544, 5120);

    c->yl += c->yu + ((-c->yl)>>6);



    

    al = (c->ap >= 256) ? 1<<6 : c->ap >> 2;

    c->y = (c->yl + (c->yu - (c->yl>>6))*al) >> 6;



    

    c->se = 0;

    for (i=0; i<6; i++)

        c->se += mult(i2f(c->b[i] >> 2, &f), &c->dq[i]);

    c->sez = c->se >> 1;

    for (i=0; i<2; i++)

        c->se += mult(i2f(c->a[i] >> 2, &f), &c->sr[i]);

    c->se >>= 1;



    return av_clip(re_signal << 2, -0xffff, 0xffff);

}

    return av_clip(re_signal << 2, -0xffff, 0xffff);
static int16_t FUNC_0(G726Context* c, int I)

{

    int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;

    Float11 f;

    int VAR_11= I >> (c->code_size - 1);



    VAR_0 = inverse_quant(c, I);



    

    VAR_6 = (c->yl >> 15);

    VAR_7 = (c->yl >> 10) & 0x1f;

    VAR_8 = (VAR_6 > 9) ? 0x1f << 10 : (0x20 + VAR_7) << VAR_6;

    VAR_5= (c->td == 1 && VAR_0 > ((3*VAR_8)>>2));



    if (VAR_11)  

        VAR_0 = -VAR_0;

    VAR_1 = (int16_t)(c->se + VAR_0);



    

    VAR_2 = (c->sez + VAR_0) ? sgn(c->sez + VAR_0) : 0;

    VAR_10 = VAR_0 ? sgn(VAR_0) : 0;

    if (VAR_5) {

        c->a[0] = 0;

        c->a[1] = 0;

        for (VAR_4=0; VAR_4<6; VAR_4++)

            c->b[VAR_4] = 0;

    } else {

        

        VAR_3 = av_clip_intp2((-c->a[0]*c->pk[0]*VAR_2)>>5, 8);



        c->a[1] += 128*VAR_2*c->pk[1] + VAR_3 - (c->a[1]>>7);

        c->a[1] = av_clip(c->a[1], -12288, 12288);

        c->a[0] += 64*3*VAR_2*c->pk[0] - (c->a[0] >> 8);

        c->a[0] = av_clip(c->a[0], -(15360 - c->a[1]), 15360 - c->a[1]);



        for (VAR_4=0; VAR_4<6; VAR_4++)

            c->b[VAR_4] += 128*VAR_10*sgn(-c->VAR_0[VAR_4].sign) - (c->b[VAR_4]>>8);

    }



    

    c->pk[1] = c->pk[0];

    c->pk[0] = VAR_2 ? VAR_2 : 1;

    c->sr[1] = c->sr[0];

    i2f(VAR_1, &c->sr[0]);

    for (VAR_4=5; VAR_4>0; VAR_4--)

        c->VAR_0[VAR_4] = c->VAR_0[VAR_4-1];

    i2f(VAR_0, &c->VAR_0[0]);

    c->VAR_0[0].sign = VAR_11; 



    c->td = c->a[1] < -11776;



    

    c->dms += (c->tbls.F[I]<<4) + ((- c->dms) >> 5);

    c->dml += (c->tbls.F[I]<<4) + ((- c->dml) >> 7);

    if (VAR_5)

        c->ap = 256;

    else {

        c->ap += (-c->ap) >> 4;

        if (c->y <= 1535 || c->td || abs((c->dms << 2) - c->dml) >= (c->dml >> 3))

            c->ap += 0x20;

    }



    

    c->yu = av_clip(c->y + c->tbls.W[I] + ((-c->y)>>5), 544, 5120);

    c->yl += c->yu + ((-c->yl)>>6);



    

    VAR_9 = (c->ap >= 256) ? 1<<6 : c->ap >> 2;

    c->y = (c->yl + (c->yu - (c->yl>>6))*VAR_9) >> 6;



    

    c->se = 0;

    for (VAR_4=0; VAR_4<6; VAR_4++)

        c->se += mult(i2f(c->b[VAR_4] >> 2, &f), &c->VAR_0[VAR_4]);

    c->sez = c->se >> 1;

    for (VAR_4=0; VAR_4<2; VAR_4++)

        c->se += mult(i2f(c->a[VAR_4] >> 2, &f), &c->sr[VAR_4]);

    c->se >>= 1;



    return av_clip(VAR_1 << 2, -0xffff, 0xffff);

}

static int16_t FUNC_0(G726Context* c, int I)
{ int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; Float11 f; int VAR_11= I >> (c->code_size - 1); VAR_0 = inverse_quant(c, I); VAR_6 = (c->yl >> 15); VAR_7 = (c->yl >> 10) & 0x1f; VAR_8 = (VAR_6 > 9) ? 0x1f << 10 : (0x20 + VAR_7) << VAR_6; VAR_5= (c->td == 1 && VAR_0 > ((3*VAR_8)>>2)); if (VAR_11)
VAR_0 = -VAR_0; VAR_1 = (int16_t)(c->se + VAR_0); VAR_2 = (c->sez + VAR_0) ? sgn(c->sez + VAR_0) : 0; VAR_10 = VAR_0 ? sgn(VAR_0) : 0; if (VAR_5) { c->a[0] = 0; c->a[1] = 0; for (VAR_4=0; VAR_4<6; VAR_4++) c->b[VAR_4] = 0; } else { VAR_3 = av_clip_intp2((-c->a[0]*c->pk[0]*VAR_2)>>5, 8); c->a[1] += 128*VAR_2*c->pk[1] + VAR_3 - (c->a[1]>>7); c->a[1] = av_clip(c->a[1], -12288, 12288); c->a[0] += 64*3*VAR_2*c->pk[0] - (c->a[0] >> 8); c->a[0] = av_clip(c->a[0], -(15360 - c->a[1]), 15360 - c->a[1]); for (VAR_4=0; VAR_4<6; VAR_4++) c->b[VAR_4] += 128*VAR_10*sgn(-c->VAR_0[VAR_4].sign) - (c->b[VAR_4]>>8); } c->pk[1] = c->pk[0]; c->pk[0] = VAR_2 ? VAR_2 : 1; c->sr[1] = c->sr[0]; i2f(VAR_1, &c->sr[0]); for (VAR_4=5; VAR_4>0; VAR_4--) c->VAR_0[VAR_4] = c->VAR_0[VAR_4-1]; i2f(VAR_0, &c->VAR_0[0]); c->VAR_0[0].sign = VAR_11; c->td = c->a[1] < -11776; c->dms += (c->tbls.F[I]<<4) + ((- c->dms) >> 5); c->dml += (c->tbls.F[I]<<4) + ((- c->dml) >> 7); if (VAR_5)
c->ap = 256; else { c->ap += (-c->ap) >> 4; if (c->y <= 1535 || c->td || abs((c->dms << 2) - c->dml) >= (c->dml >> 3))
c->ap += 0x20; } c->yu = av_clip(c->y + c->tbls.W[I] + ((-c->y)>>5), 544, 5120); c->yl += c->yu + ((-c->yl)>>6); VAR_9 = (c->ap >= 256) ? 1<<6 : c->ap >> 2; c->y = (c->yl + (c->yu - (c->yl>>6))*VAR_9) >> 6; c->se = 0; for (VAR_4=0; VAR_4<6; VAR_4++) c->se += mult(i2f(c->b[VAR_4] >> 2, &f), &c->VAR_0[VAR_4]); c->sez = c->se >> 1; for (VAR_4=0; VAR_4<2; VAR_4++) c->se += mult(i2f(c->a[VAR_4] >> 2, &f), &c->sr[VAR_4]); c->se >>= 1; return av_clip(VAR_1 << 2, -0xffff, 0xffff); }