static int unpack_block_qpis(Vp3DecodeContext *s, GetBitContext *gb)

{

    int qpi, i, j, bit, run_length, blocks_decoded, num_blocks_at_qpi;

    int num_blocks = s->total_num_coded_frags;



    for (qpi = 0; qpi < s->nqps-1 && num_blocks > 0; qpi++) {

        i = blocks_decoded = num_blocks_at_qpi = 0;



        bit = get_bits1(gb);



        do {

            run_length = get_vlc2(gb, s->superblock_run_length_vlc.table, 6, 2) + 1;

            if (run_length == 34)

                run_length += get_bits(gb, 12);

            blocks_decoded += run_length;



            if (!bit)

                num_blocks_at_qpi += run_length;



            for (j = 0; j < run_length; i++) {

                if (i >= s->total_num_coded_frags)

                    return -1;



                if (s->all_fragments[s->coded_fragment_list[0][i]].qpi == qpi) {

                    s->all_fragments[s->coded_fragment_list[0][i]].qpi += bit;

                    j++;

                }

            }



            if (run_length == MAXIMUM_LONG_BIT_RUN)

                bit = get_bits1(gb);

            else

                bit ^= 1;

        } while (blocks_decoded < num_blocks);



        num_blocks -= num_blocks_at_qpi;

    }



    return 0;

}

static int unpack_block_qpis(Vp3DecodeContext *s, GetBitContext *gb)

{

    int qpi, i, j, bit, run_length, blocks_decoded, num_blocks_at_qpi;

    int num_blocks = s->total_num_coded_frags;



    for (qpi = 0; qpi < s->nqps-1 && num_blocks > 0; qpi++) {

        i = blocks_decoded = num_blocks_at_qpi = 0;



        bit = get_bits1(gb);



        do {

            run_length = get_vlc2(gb, s->superblock_run_length_vlc.table, 6, 2) + 1;

            if (run_length == 34)

                run_length += get_bits(gb, 12);

            blocks_decoded += run_length;



            if (!bit)

                num_blocks_at_qpi += run_length;



            for (j = 0; j < run_length; i++) {

                if (i >= s->total_num_coded_frags)

                    return -1;



                if (s->all_fragments[s->coded_fragment_list[0][i]].qpi == qpi) {

                    s->all_fragments[s->coded_fragment_list[0][i]].qpi += bit;

                    j++;

                }

            }



            if (run_length == MAXIMUM_LONG_BIT_RUN)

                bit = get_bits1(gb);

            else

                bit ^= 1;

        } while (blocks_decoded < num_blocks);



        num_blocks -= num_blocks_at_qpi;

    }



    return 0;

}

        } while (blocks_decoded < num_blocks);
static int FUNC_0(Vp3DecodeContext *VAR_0, GetBitContext *VAR_1)

{

    int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;

    int VAR_9 = VAR_0->total_num_coded_frags;



    for (VAR_2 = 0; VAR_2 < VAR_0->nqps-1 && VAR_9 > 0; VAR_2++) {

        VAR_3 = VAR_7 = VAR_8 = 0;



        VAR_5 = get_bits1(VAR_1);



        do {

            VAR_6 = get_vlc2(VAR_1, VAR_0->superblock_run_length_vlc.table, 6, 2) + 1;

            if (VAR_6 == 34)

                VAR_6 += get_bits(VAR_1, 12);

            VAR_7 += VAR_6;



            if (!VAR_5)

                VAR_8 += VAR_6;



            for (VAR_4 = 0; VAR_4 < VAR_6; VAR_3++) {

                if (VAR_3 >= VAR_0->total_num_coded_frags)

                    return -1;



                if (VAR_0->all_fragments[VAR_0->coded_fragment_list[0][VAR_3]].VAR_2 == VAR_2) {

                    VAR_0->all_fragments[VAR_0->coded_fragment_list[0][VAR_3]].VAR_2 += VAR_5;

                    VAR_4++;

                }

            }



            if (VAR_6 == MAXIMUM_LONG_BIT_RUN)

                VAR_5 = get_bits1(VAR_1);

            else

                VAR_5 ^= 1;

        } while (VAR_7 < VAR_9);



        VAR_9 -= VAR_8;

    }



    return 0;

}

static int FUNC_0(Vp3DecodeContext *VAR_0, GetBitContext *VAR_1)
{ int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8; int VAR_9 = VAR_0->total_num_coded_frags; for (VAR_2 = 0; VAR_2 < VAR_0->nqps-1 && VAR_9 > 0; VAR_2++) { VAR_3 = VAR_7 = VAR_8 = 0; VAR_5 = get_bits1(VAR_1); do { VAR_6 = get_vlc2(VAR_1, VAR_0->superblock_run_length_vlc.table, 6, 2) + 1; if (VAR_6 == 34)
VAR_6 += get_bits(VAR_1, 12); VAR_7 += VAR_6; if (!VAR_5)
VAR_8 += VAR_6; for (VAR_4 = 0; VAR_4 < VAR_6; VAR_3++) { if (VAR_3 >= VAR_0->total_num_coded_frags)
return -1; if (VAR_0->all_fragments[VAR_0->coded_fragment_list[0][VAR_3]].VAR_2 == VAR_2) { VAR_0->all_fragments[VAR_0->coded_fragment_list[0][VAR_3]].VAR_2 += VAR_5; VAR_4++; } } if (VAR_6 == MAXIMUM_LONG_BIT_RUN)
VAR_5 = get_bits1(VAR_1); else
VAR_5 ^= 1; } while (VAR_7 < VAR_9); VAR_9 -= VAR_8; } return 0; }