static inline int ape_decode_value_3900(APEContext *ctx, APERice *rice)

{

    unsigned int x, overflow;

    int tmpk;



    overflow = range_get_symbol(ctx, counts_3970, counts_diff_3970);



    if (overflow == (MODEL_ELEMENTS - 1)) {

        tmpk = range_decode_bits(ctx, 5);

        overflow = 0;

    } else

        tmpk = (rice->k < 1) ? 0 : rice->k - 1;



    if (tmpk <= 16 || ctx->fileversion < 3910) {

        if (tmpk > 23) {

            av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", tmpk);

            return AVERROR_INVALIDDATA;

        }

        x = range_decode_bits(ctx, tmpk);

    } else if (tmpk <= 32) {

        x = range_decode_bits(ctx, 16);

        x |= (range_decode_bits(ctx, tmpk - 16) << 16);

    } else {

        av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", tmpk);

        return AVERROR_INVALIDDATA;

    }

    x += overflow << tmpk;



    update_rice(rice, x);



    /* Convert to signed */

    if (x & 1)

        return (x >> 1) + 1;

    else

        return -(x >> 1);

}

static inline int ape_decode_value_3900(APEContext *ctx, APERice *rice)

{

    unsigned int x, overflow;

    int tmpk;



    overflow = range_get_symbol(ctx, counts_3970, counts_diff_3970);



    if (overflow == (MODEL_ELEMENTS - 1)) {

        tmpk = range_decode_bits(ctx, 5);

        overflow = 0;

    } else

        tmpk = (rice->k < 1) ? 0 : rice->k - 1;



    if (tmpk <= 16 || ctx->fileversion < 3910) {

        if (tmpk > 23) {

            av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", tmpk);

            return AVERROR_INVALIDDATA;

        }

        x = range_decode_bits(ctx, tmpk);

    } else if (tmpk <= 32) {

        x = range_decode_bits(ctx, 16);

        x |= (range_decode_bits(ctx, tmpk - 16) << 16);

    } else {

        av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", tmpk);

        return AVERROR_INVALIDDATA;

    }

    x += overflow << tmpk;



    update_rice(rice, x);



    

    if (x & 1)

        return (x >> 1) + 1;

    else

        return -(x >> 1);

}

    } else if (tmpk <= 32) {
static inline int FUNC_0(APEContext *VAR_0, APERice *VAR_1)

{

    unsigned int VAR_2, VAR_3;

    int VAR_4;



    VAR_3 = range_get_symbol(VAR_0, counts_3970, counts_diff_3970);



    if (VAR_3 == (MODEL_ELEMENTS - 1)) {

        VAR_4 = range_decode_bits(VAR_0, 5);

        VAR_3 = 0;

    } else

        VAR_4 = (VAR_1->k < 1) ? 0 : VAR_1->k - 1;



    if (VAR_4 <= 16 || VAR_0->fileversion < 3910) {

        if (VAR_4 > 23) {

            av_log(VAR_0->avctx, AV_LOG_ERROR, "Too many bits: %d\n", VAR_4);

            return AVERROR_INVALIDDATA;

        }

        VAR_2 = range_decode_bits(VAR_0, VAR_4);

    } else if (VAR_4 <= 32) {

        VAR_2 = range_decode_bits(VAR_0, 16);

        VAR_2 |= (range_decode_bits(VAR_0, VAR_4 - 16) << 16);

    } else {

        av_log(VAR_0->avctx, AV_LOG_ERROR, "Too many bits: %d\n", VAR_4);

        return AVERROR_INVALIDDATA;

    }

    VAR_2 += VAR_3 << VAR_4;



    update_rice(VAR_1, VAR_2);



    

    if (VAR_2 & 1)

        return (VAR_2 >> 1) + 1;

    else

        return -(VAR_2 >> 1);

}

static inline int FUNC_0(APEContext *VAR_0, APERice *VAR_1)
{ unsigned int VAR_2, VAR_3; int VAR_4; VAR_3 = range_get_symbol(VAR_0, counts_3970, counts_diff_3970); if (VAR_3 == (MODEL_ELEMENTS - 1)) { VAR_4 = range_decode_bits(VAR_0, 5); VAR_3 = 0; } else VAR_4 = (VAR_1->k < 1) ? 0 : VAR_1->k - 1; if (VAR_4 <= 16 || VAR_0->fileversion < 3910) { if (VAR_4 > 23) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Too many bits: %d\n", VAR_4); return AVERROR_INVALIDDATA; } VAR_2 = range_decode_bits(VAR_0, VAR_4); } else if (VAR_4 <= 32) { VAR_2 = range_decode_bits(VAR_0, 16); VAR_2 |= (range_decode_bits(VAR_0, VAR_4 - 16) << 16); } else { av_log(VAR_0->avctx, AV_LOG_ERROR, "Too many bits: %d\n", VAR_4); return AVERROR_INVALIDDATA; } VAR_2 += VAR_3 << VAR_4; update_rice(VAR_1, VAR_2); if (VAR_2 & 1)
return (VAR_2 >> 1) + 1; else
return -(VAR_2 >> 1); }