static int xan_huffman_decode(uint8_t *dest, int dest_len,

                              const uint8_t *src, int src_len)

{

    uint8_t byte = *src++;

    uint8_t ival = byte + 0x16;

    const uint8_t * ptr = src + byte*2;

    int ptr_len = src_len - 1 - byte*2;

    uint8_t val = ival;

    uint8_t *dest_end = dest + dest_len;

    uint8_t *dest_start = dest;

    int ret;

    GetBitContext gb;



    if ((ret = init_get_bits8(&gb, ptr, ptr_len)) < 0)

        return ret;



    while (val != 0x16) {

        unsigned idx = val - 0x17 + get_bits1(&gb) * byte;

        if (idx >= 2 * byte)

            return AVERROR_INVALIDDATA;

        val = src[idx];



        if (val < 0x16) {

            if (dest >= dest_end)

                return dest_len;

            *dest++ = val;

            val = ival;

        }

    }



    return dest - dest_start;

}

static int xan_huffman_decode(uint8_t *dest, int dest_len,

                              const uint8_t *src, int src_len)

{

    uint8_t byte = *src++;

    uint8_t ival = byte + 0x16;

    const uint8_t * ptr = src + byte*2;

    int ptr_len = src_len - 1 - byte*2;

    uint8_t val = ival;

    uint8_t *dest_end = dest + dest_len;

    uint8_t *dest_start = dest;

    int ret;

    GetBitContext gb;



    if ((ret = init_get_bits8(&gb, ptr, ptr_len)) < 0)

        return ret;



    while (val != 0x16) {

        unsigned idx = val - 0x17 + get_bits1(&gb) * byte;

        if (idx >= 2 * byte)

            return AVERROR_INVALIDDATA;

        val = src[idx];



        if (val < 0x16) {

            if (dest >= dest_end)

                return dest_len;

            *dest++ = val;

            val = ival;

        }

    }



    return dest - dest_start;

}

        unsigned idx = val - 0x17 + get_bits1(&gb) * byte;
static int FUNC_0(uint8_t *VAR_0, int VAR_1,

                              const uint8_t *VAR_2, int VAR_3)

{

    uint8_t byte = *VAR_2++;

    uint8_t ival = byte + 0x16;

    const uint8_t * VAR_4 = VAR_2 + byte*2;

    int VAR_5 = VAR_3 - 1 - byte*2;

    uint8_t val = ival;

    uint8_t *dest_end = VAR_0 + VAR_1;

    uint8_t *dest_start = VAR_0;

    int VAR_6;

    GetBitContext gb;



    if ((VAR_6 = init_get_bits8(&gb, VAR_4, VAR_5)) < 0)

        return VAR_6;



    while (val != 0x16) {

        unsigned VAR_7 = val - 0x17 + get_bits1(&gb) * byte;

        if (VAR_7 >= 2 * byte)

            return AVERROR_INVALIDDATA;

        val = VAR_2[VAR_7];



        if (val < 0x16) {

            if (VAR_0 >= dest_end)

                return VAR_1;

            *VAR_0++ = val;

            val = ival;

        }

    }



    return VAR_0 - dest_start;

}

static int FUNC_0(uint8_t *VAR_0, int VAR_1,
const uint8_t *VAR_2, int VAR_3)
{ uint8_t byte = *VAR_2++; uint8_t ival = byte + 0x16; const uint8_t * VAR_4 = VAR_2 + byte*2; int VAR_5 = VAR_3 - 1 - byte*2; uint8_t val = ival; uint8_t *dest_end = VAR_0 + VAR_1; uint8_t *dest_start = VAR_0; int VAR_6; GetBitContext gb; if ((VAR_6 = init_get_bits8(&gb, VAR_4, VAR_5)) < 0)
return VAR_6; while (val != 0x16) { unsigned VAR_7 = val - 0x17 + get_bits1(&gb) * byte; if (VAR_7 >= 2 * byte)
return AVERROR_INVALIDDATA; val = VAR_2[VAR_7]; if (val < 0x16) { if (VAR_0 >= dest_end)
return VAR_1; *VAR_0++ = val; val = ival; } } return VAR_0 - dest_start; }