static int smacker_decode_tree(GetBitContext *gb, HuffContext *hc, uint32_t prefix, int length)

{





    if(!get_bits1(gb)){ //Leaf

        if(hc->current >= 256){

            av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n");



        if(length){

            hc->bits[hc->current] = prefix;

            hc->lengths[hc->current] = length;

        } else {

            hc->bits[hc->current] = 0;

            hc->lengths[hc->current] = 0;


        hc->values[hc->current] = get_bits(gb, 8);

        hc->current++;

        if(hc->maxlength < length)

            hc->maxlength = length;

        return 0;

    } else { //Node

        int r;

        length++;

        r = smacker_decode_tree(gb, hc, prefix, length);

        if(r)

            return r;

        return smacker_decode_tree(gb, hc, prefix | (1 << (length - 1)), length);


static int smacker_decode_tree(GetBitContext *gb, HuffContext *hc, uint32_t prefix, int length)

{





    if(!get_bits1(gb)){ 

        if(hc->current >= 256){

            av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n");



        if(length){

            hc->bits[hc->current] = prefix;

            hc->lengths[hc->current] = length;

        } else {

            hc->bits[hc->current] = 0;

            hc->lengths[hc->current] = 0;


        hc->values[hc->current] = get_bits(gb, 8);

        hc->current++;

        if(hc->maxlength < length)

            hc->maxlength = length;

        return 0;

    } else { 

        int r;

        length++;

        r = smacker_decode_tree(gb, hc, prefix, length);

        if(r)

            return r;

        return smacker_decode_tree(gb, hc, prefix | (1 << (length - 1)), length);


static int FUNC_0(GetBitContext *VAR_0, HuffContext *VAR_1, uint32_t VAR_2, int VAR_3)

{





    if(!get_bits1(VAR_0)){ 

        if(VAR_1->current >= 256){

            av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n");



        if(VAR_3){

            VAR_1->bits[VAR_1->current] = VAR_2;

            VAR_1->lengths[VAR_1->current] = VAR_3;

        } else {

            VAR_1->bits[VAR_1->current] = 0;

            VAR_1->lengths[VAR_1->current] = 0;


        VAR_1->values[VAR_1->current] = get_bits(VAR_0, 8);

        VAR_1->current++;

        if(VAR_1->maxlength < VAR_3)

            VAR_1->maxlength = VAR_3;

        return 0;

    } else { 

        int r;

        VAR_3++;

        r = FUNC_0(VAR_0, VAR_1, VAR_2, VAR_3);

        if(r)

            return r;

        return FUNC_0(VAR_0, VAR_1, VAR_2 | (1 << (VAR_3 - 1)), VAR_3);


static int FUNC_0(GetBitContext *VAR_0, HuffContext *VAR_1, uint32_t VAR_2, int VAR_3)
{ if(!get_bits1(VAR_0)){ if(VAR_1->current >= 256){ av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n"); if(VAR_3){ VAR_1->bits[VAR_1->current] = VAR_2; VAR_1->lengths[VAR_1->current] = VAR_3; } else { VAR_1->bits[VAR_1->current] = 0; VAR_1->lengths[VAR_1->current] = 0; VAR_1->values[VAR_1->current] = get_bits(VAR_0, 8); VAR_1->current++; if(VAR_1->maxlength < VAR_3)
VAR_1->maxlength = VAR_3; return 0; } else { int r; VAR_3++; r = FUNC_0(VAR_0, VAR_1, VAR_2, VAR_3); if(r)
return r; return FUNC_0(VAR_0, VAR_1, VAR_2 | (1 << (VAR_3 - 1)), VAR_3);