static int output_data_internal(MLPDecodeContext *m, unsigned int substr,

                                uint8_t *data, unsigned int *data_size, int is32)

{

    SubStream *s = &m->substream[substr];

    unsigned int i, out_ch = 0;

    int32_t *data_32 = (int32_t*) data;

    int16_t *data_16 = (int16_t*) data;



    if (*data_size < (s->max_channel + 1) * s->blockpos * (is32 ? 4 : 2))

        return -1;



    for (i = 0; i < s->blockpos; i++) {

        for (out_ch = 0; out_ch <= s->max_matrix_channel; out_ch++) {

            int mat_ch = s->ch_assign[out_ch];

            int32_t sample = m->sample_buffer[i][mat_ch]

                          << s->output_shift[mat_ch];

            s->lossless_check_data ^= (sample & 0xffffff) << mat_ch;

            if (is32) *data_32++ = sample << 8;

            else      *data_16++ = sample >> 8;

        }

    }



    *data_size = i * out_ch * (is32 ? 4 : 2);



    return 0;

}

static int output_data_internal(MLPDecodeContext *m, unsigned int substr,

                                uint8_t *data, unsigned int *data_size, int is32)

{

    SubStream *s = &m->substream[substr];

    unsigned int i, out_ch = 0;

    int32_t *data_32 = (int32_t*) data;

    int16_t *data_16 = (int16_t*) data;



    if (*data_size < (s->max_channel + 1) * s->blockpos * (is32 ? 4 : 2))

        return -1;



    for (i = 0; i < s->blockpos; i++) {

        for (out_ch = 0; out_ch <= s->max_matrix_channel; out_ch++) {

            int mat_ch = s->ch_assign[out_ch];

            int32_t sample = m->sample_buffer[i][mat_ch]

                          << s->output_shift[mat_ch];

            s->lossless_check_data ^= (sample & 0xffffff) << mat_ch;

            if (is32) *data_32++ = sample << 8;

            else      *data_16++ = sample >> 8;

        }

    }



    *data_size = i * out_ch * (is32 ? 4 : 2);



    return 0;

}

static int FUNC_0(MLPDecodeContext *VAR_0, unsigned int VAR_1,

                                uint8_t *VAR_2, unsigned int *VAR_3, int VAR_4)

{

    SubStream *s = &VAR_0->substream[VAR_1];

    unsigned int VAR_5, VAR_6 = 0;

    int32_t *data_32 = (int32_t*) VAR_2;

    int16_t *data_16 = (int16_t*) VAR_2;



    if (*VAR_3 < (s->max_channel + 1) * s->blockpos * (VAR_4 ? 4 : 2))

        return -1;



    for (VAR_5 = 0; VAR_5 < s->blockpos; VAR_5++) {

        for (VAR_6 = 0; VAR_6 <= s->max_matrix_channel; VAR_6++) {

            int mat_ch = s->ch_assign[VAR_6];

            int32_t sample = VAR_0->sample_buffer[VAR_5][mat_ch]

                          << s->output_shift[mat_ch];

            s->lossless_check_data ^= (sample & 0xffffff) << mat_ch;

            if (VAR_4) *data_32++ = sample << 8;

            else      *data_16++ = sample >> 8;

        }

    }



    *VAR_3 = VAR_5 * VAR_6 * (VAR_4 ? 4 : 2);



    return 0;

}

static int FUNC_0(MLPDecodeContext *VAR_0, unsigned int VAR_1,
uint8_t *VAR_2, unsigned int *VAR_3, int VAR_4)
{ SubStream *s = &VAR_0->substream[VAR_1]; unsigned int VAR_5, VAR_6 = 0; int32_t *data_32 = (int32_t*) VAR_2; int16_t *data_16 = (int16_t*) VAR_2; if (*VAR_3 < (s->max_channel + 1) * s->blockpos * (VAR_4 ? 4 : 2))
return -1; for (VAR_5 = 0; VAR_5 < s->blockpos; VAR_5++) { for (VAR_6 = 0; VAR_6 <= s->max_matrix_channel; VAR_6++) { int mat_ch = s->ch_assign[VAR_6]; int32_t sample = VAR_0->sample_buffer[VAR_5][mat_ch]
<< s->output_shift[mat_ch]; s->lossless_check_data ^= (sample & 0xffffff) << mat_ch; if (VAR_4) *data_32++ = sample << 8; else      *data_16++ = sample >> 8; } } *VAR_3 = VAR_5 * VAR_6 * (VAR_4 ? 4 : 2); return 0; }