static int rac_get_model256_sym(RangeCoder *c, Model256 *m)

{

    int prob, prob2, helper, val;

    int start, end;

    int ssym;



    prob2      = c->range;

    c->range >>= MODEL_SCALE;



    helper     = c->low / c->range;

    ssym       = helper >> MODEL256_SEC_SCALE;

    val        = m->secondary[ssym];



    end = start = m->secondary[ssym + 1] + 1;

    while (end > val + 1) {

        ssym = (end + val) >> 1;

        if (m->freqs[ssym] <= helper) {

            end = start;

            val = ssym;

        } else {

            end   = (end + val) >> 1;

            start = ssym;

        }

    }

    prob = m->freqs[val] * c->range;

    if (val != 255)

        prob2 = m->freqs[val + 1] * c->range;



    c->low  -= prob;

    c->range = prob2 - prob;

    if (c->range < RAC_BOTTOM)

        rac_normalise(c);



    model256_update(m, val);



    return val;

}

static int rac_get_model256_sym(RangeCoder *c, Model256 *m)

{

    int prob, prob2, helper, val;

    int start, end;

    int ssym;



    prob2      = c->range;

    c->range >>= MODEL_SCALE;



    helper     = c->low / c->range;

    ssym       = helper >> MODEL256_SEC_SCALE;

    val        = m->secondary[ssym];



    end = start = m->secondary[ssym + 1] + 1;

    while (end > val + 1) {

        ssym = (end + val) >> 1;

        if (m->freqs[ssym] <= helper) {

            end = start;

            val = ssym;

        } else {

            end   = (end + val) >> 1;

            start = ssym;

        }

    }

    prob = m->freqs[val] * c->range;

    if (val != 255)

        prob2 = m->freqs[val + 1] * c->range;



    c->low  -= prob;

    c->range = prob2 - prob;

    if (c->range < RAC_BOTTOM)

        rac_normalise(c);



    model256_update(m, val);



    return val;

}

    int prob, prob2, helper, val;
static int FUNC_0(RangeCoder *VAR_0, Model256 *VAR_1)

{

    int VAR_2, VAR_3, VAR_4, VAR_5;

    int VAR_6, VAR_7;

    int VAR_8;



    VAR_3      = VAR_0->range;

    VAR_0->range >>= MODEL_SCALE;



    VAR_4     = VAR_0->low / VAR_0->range;

    VAR_8       = VAR_4 >> MODEL256_SEC_SCALE;

    VAR_5        = VAR_1->secondary[VAR_8];



    VAR_7 = VAR_6 = VAR_1->secondary[VAR_8 + 1] + 1;

    while (VAR_7 > VAR_5 + 1) {

        VAR_8 = (VAR_7 + VAR_5) >> 1;

        if (VAR_1->freqs[VAR_8] <= VAR_4) {

            VAR_7 = VAR_6;

            VAR_5 = VAR_8;

        } else {

            VAR_7   = (VAR_7 + VAR_5) >> 1;

            VAR_6 = VAR_8;

        }

    }

    VAR_2 = VAR_1->freqs[VAR_5] * VAR_0->range;

    if (VAR_5 != 255)

        VAR_3 = VAR_1->freqs[VAR_5 + 1] * VAR_0->range;



    VAR_0->low  -= VAR_2;

    VAR_0->range = VAR_3 - VAR_2;

    if (VAR_0->range < RAC_BOTTOM)

        rac_normalise(VAR_0);



    model256_update(VAR_1, VAR_5);



    return VAR_5;

}

static int FUNC_0(RangeCoder *VAR_0, Model256 *VAR_1)
{ int VAR_2, VAR_3, VAR_4, VAR_5; int VAR_6, VAR_7; int VAR_8; VAR_3      = VAR_0->range; VAR_0->range >>= MODEL_SCALE; VAR_4     = VAR_0->low / VAR_0->range; VAR_8       = VAR_4 >> MODEL256_SEC_SCALE; VAR_5        = VAR_1->secondary[VAR_8]; VAR_7 = VAR_6 = VAR_1->secondary[VAR_8 + 1] + 1; while (VAR_7 > VAR_5 + 1) { VAR_8 = (VAR_7 + VAR_5) >> 1; if (VAR_1->freqs[VAR_8] <= VAR_4) { VAR_7 = VAR_6; VAR_5 = VAR_8; } else { VAR_7   = (VAR_7 + VAR_5) >> 1; VAR_6 = VAR_8; } } VAR_2 = VAR_1->freqs[VAR_5] * VAR_0->range; if (VAR_5 != 255)
VAR_3 = VAR_1->freqs[VAR_5 + 1] * VAR_0->range; VAR_0->low  -= VAR_2; VAR_0->range = VAR_3 - VAR_2; if (VAR_0->range < RAC_BOTTOM)
rac_normalise(VAR_0); model256_update(VAR_1, VAR_5); return VAR_5; }