static int lag_decode_prob(GetBitContext *gb, uint32_t *value)

{

    static const uint8_t series[] = { 1, 2, 3, 5, 8, 13, 21 };

    int i;

    int bit     = 0;

    int bits    = 0;

    int prevbit = 0;

    unsigned val;



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

        if (prevbit && bit)

            break;

        prevbit = bit;

        bit = get_bits1(gb);

        if (bit && !prevbit)

            bits += series[i];

    }

    bits--;

    if (bits < 0 || bits > 31) {

        *value = 0;

        return -1;

    } else if (bits == 0) {

        *value = 0;

        return 0;

    }



    val  = get_bits_long(gb, bits);

    val |= 1 << bits;



    *value = val - 1;



    return 0;

}

static int lag_decode_prob(GetBitContext *gb, uint32_t *value)

{

    static const uint8_t series[] = { 1, 2, 3, 5, 8, 13, 21 };

    int i;

    int bit     = 0;

    int bits    = 0;

    int prevbit = 0;

    unsigned val;



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

        if (prevbit && bit)

            break;

        prevbit = bit;

        bit = get_bits1(gb);

        if (bit && !prevbit)

            bits += series[i];

    }

    bits--;

    if (bits < 0 || bits > 31) {

        *value = 0;

        return -1;

    } else if (bits == 0) {

        *value = 0;

        return 0;

    }



    val  = get_bits_long(gb, bits);

    val |= 1 << bits;



    *value = val - 1;



    return 0;

}

    val |= 1 << bits;
static int FUNC_0(GetBitContext *VAR_0, uint32_t *VAR_1)

{

    static const uint8_t VAR_2[] = { 1, 2, 3, 5, 8, 13, 21 };

    int VAR_3;

    int VAR_4     = 0;

    int VAR_5    = 0;

    int VAR_6 = 0;

    unsigned VAR_7;



    for (VAR_3 = 0; VAR_3 < 7; VAR_3++) {

        if (VAR_6 && VAR_4)

            break;

        VAR_6 = VAR_4;

        VAR_4 = get_bits1(VAR_0);

        if (VAR_4 && !VAR_6)

            VAR_5 += VAR_2[VAR_3];

    }

    VAR_5--;

    if (VAR_5 < 0 || VAR_5 > 31) {

        *VAR_1 = 0;

        return -1;

    } else if (VAR_5 == 0) {

        *VAR_1 = 0;

        return 0;

    }



    VAR_7  = get_bits_long(VAR_0, VAR_5);

    VAR_7 |= 1 << VAR_5;



    *VAR_1 = VAR_7 - 1;



    return 0;

}

static int FUNC_0(GetBitContext *VAR_0, uint32_t *VAR_1)
{ static const uint8_t VAR_2[] = { 1, 2, 3, 5, 8, 13, 21 }; int VAR_3; int VAR_4     = 0; int VAR_5    = 0; int VAR_6 = 0; unsigned VAR_7; for (VAR_3 = 0; VAR_3 < 7; VAR_3++) { if (VAR_6 && VAR_4)
break; VAR_6 = VAR_4; VAR_4 = get_bits1(VAR_0); if (VAR_4 && !VAR_6)
VAR_5 += VAR_2[VAR_3]; } VAR_5--; if (VAR_5 < 0 || VAR_5 > 31) { *VAR_1 = 0; return -1; } else if (VAR_5 == 0) { *VAR_1 = 0; return 0; } VAR_7  = get_bits_long(VAR_0, VAR_5); VAR_7 |= 1 << VAR_5; *VAR_1 = VAR_7 - 1; return 0; }