static int rac_get_model_sym(RangeCoder *c, Model *m)

{

    int prob, prob2, helper, val;

    int end, end2;



    prob       = 0;

    prob2      = c->range;

    c->range >>= MODEL_SCALE;

    val        = 0;

    end        = m->num_syms >> 1;

    end2       = m->num_syms;

    do {

        helper = m->freqs[end] * c->range;

        if (helper <= c->low) {

            val   = end;

            prob  = helper;

        } else {

            end2  = end;

            prob2 = helper;

        }

        end = (end2 + val) >> 1;

    } while (end != val);

    c->low  -= prob;

    c->range = prob2 - prob;

    if (c->range < RAC_BOTTOM)

        rac_normalise(c);



    model_update(m, val);



    return val;

}

static int rac_get_model_sym(RangeCoder *c, Model *m)

{

    int prob, prob2, helper, val;

    int end, end2;



    prob       = 0;

    prob2      = c->range;

    c->range >>= MODEL_SCALE;

    val        = 0;

    end        = m->num_syms >> 1;

    end2       = m->num_syms;

    do {

        helper = m->freqs[end] * c->range;

        if (helper <= c->low) {

            val   = end;

            prob  = helper;

        } else {

            end2  = end;

            prob2 = helper;

        }

        end = (end2 + val) >> 1;

    } while (end != val);

    c->low  -= prob;

    c->range = prob2 - prob;

    if (c->range < RAC_BOTTOM)

        rac_normalise(c);



    model_update(m, val);



    return val;

}

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

{

    int VAR_2, VAR_3, VAR_4, VAR_5;

    int VAR_6, VAR_7;



    VAR_2       = 0;

    VAR_3      = VAR_0->range;

    VAR_0->range >>= MODEL_SCALE;

    VAR_5        = 0;

    VAR_6        = VAR_1->num_syms >> 1;

    VAR_7       = VAR_1->num_syms;

    do {

        VAR_4 = VAR_1->freqs[VAR_6] * VAR_0->range;

        if (VAR_4 <= VAR_0->low) {

            VAR_5   = VAR_6;

            VAR_2  = VAR_4;

        } else {

            VAR_7  = VAR_6;

            VAR_3 = VAR_4;

        }

        VAR_6 = (VAR_7 + VAR_5) >> 1;

    } while (VAR_6 != VAR_5);

    VAR_0->low  -= VAR_2;

    VAR_0->range = VAR_3 - VAR_2;

    if (VAR_0->range < RAC_BOTTOM)

        rac_normalise(VAR_0);



    model_update(VAR_1, VAR_5);



    return VAR_5;

}

static int FUNC_0(RangeCoder *VAR_0, Model *VAR_1)
{ int VAR_2, VAR_3, VAR_4, VAR_5; int VAR_6, VAR_7; VAR_2       = 0; VAR_3      = VAR_0->range; VAR_0->range >>= MODEL_SCALE; VAR_5        = 0; VAR_6        = VAR_1->num_syms >> 1; VAR_7       = VAR_1->num_syms; do { VAR_4 = VAR_1->freqs[VAR_6] * VAR_0->range; if (VAR_4 <= VAR_0->low) { VAR_5   = VAR_6; VAR_2  = VAR_4; } else { VAR_7  = VAR_6; VAR_3 = VAR_4; } VAR_6 = (VAR_7 + VAR_5) >> 1; } while (VAR_6 != VAR_5); VAR_0->low  -= VAR_2; VAR_0->range = VAR_3 - VAR_2; if (VAR_0->range < RAC_BOTTOM)
rac_normalise(VAR_0); model_update(VAR_1, VAR_5); return VAR_5; }