static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb,
                                 void *dst, const int type)
{
    int i, j, count = 0;
    int last, t;
    int A, S, T;
    int pos                  = s->pos;
    uint32_t crc             = s->sc.crc;
    uint32_t crc_extra_bits  = s->extra_sc.crc;
    int16_t *dst16           = dst;
    int32_t *dst32           = dst;
    float *dstfl             = dst;
    s->one = s->zero = s->zeroes = 0;
    do {
        T = wv_get_value(s, gb, 0, &last);
        S = 0;
        if (last)
            break;
        for (i = 0; i < s->terms; i++) {
            t = s->decorr[i].value;
            if (t > 8) {
                if (t & 1)
                    A =  2 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1];
                else
                    A = (3 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1]) >> 1;
                s->decorr[i].samplesA[1] = s->decorr[i].samplesA[0];
                j                        = 0;
            } else {
                A = s->decorr[i].samplesA[pos];
                j = (pos + t) & 7;
            if (type != AV_SAMPLE_FMT_S16P)
                S = T + ((s->decorr[i].weightA * (int64_t)A + 512) >> 10);
            else
                S = T + ((s->decorr[i].weightA * A + 512) >> 10);
            if (A && T)
                s->decorr[i].weightA -= ((((T ^ A) >> 30) & 2) - 1) * s->decorr[i].delta;
            s->decorr[i].samplesA[j] = T = S;
        pos = (pos + 1) & 7;
        crc = crc * 3 + S;
        if (type == AV_SAMPLE_FMT_FLTP) {
            *dstfl++ = wv_get_value_float(s, &crc_extra_bits, S);
        } else if (type == AV_SAMPLE_FMT_S32P) {
            *dst32++ = wv_get_value_integer(s, &crc_extra_bits, S);
        } else {
            *dst16++ = wv_get_value_integer(s, &crc_extra_bits, S);
        count++;
    } while (!last && count < s->samples);
    wv_reset_saved_context(s);
    if (s->avctx->err_recognition & AV_EF_CRCCHECK) {
        int ret = wv_check_crc(s, crc, crc_extra_bits);
        if (ret < 0 && s->avctx->err_recognition & AV_EF_EXPLODE)
            return ret;
    return 0;
static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb,
                                 void *dst, const int type)
{
    int i, j, count = 0;
    int last, t;
    int A, S, T;
    int pos                  = s->pos;
    uint32_t crc             = s->sc.crc;
    uint32_t crc_extra_bits  = s->extra_sc.crc;
    int16_t *dst16           = dst;
    int32_t *dst32           = dst;
    float *dstfl             = dst;
    s->one = s->zero = s->zeroes = 0;
    do {
        T = wv_get_value(s, gb, 0, &last);
        S = 0;
        if (last)
            break;
        for (i = 0; i < s->terms; i++) {
            t = s->decorr[i].value;
            if (t > 8) {
                if (t & 1)
                    A =  2 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1];
                else
                    A = (3 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1]) >> 1;
                s->decorr[i].samplesA[1] = s->decorr[i].samplesA[0];
                j                        = 0;
            } else {
                A = s->decorr[i].samplesA[pos];
                j = (pos + t) & 7;
            if (type != AV_SAMPLE_FMT_S16P)
                S = T + ((s->decorr[i].weightA * (int64_t)A + 512) >> 10);
            else
                S = T + ((s->decorr[i].weightA * A + 512) >> 10);
            if (A && T)
                s->decorr[i].weightA -= ((((T ^ A) >> 30) & 2) - 1) * s->decorr[i].delta;
            s->decorr[i].samplesA[j] = T = S;
        pos = (pos + 1) & 7;
        crc = crc * 3 + S;
        if (type == AV_SAMPLE_FMT_FLTP) {
            *dstfl++ = wv_get_value_float(s, &crc_extra_bits, S);
        } else if (type == AV_SAMPLE_FMT_S32P) {
            *dst32++ = wv_get_value_integer(s, &crc_extra_bits, S);
        } else {
            *dst16++ = wv_get_value_integer(s, &crc_extra_bits, S);
        count++;
    } while (!last && count < s->samples);
    wv_reset_saved_context(s);
    if (s->avctx->err_recognition & AV_EF_CRCCHECK) {
        int ret = wv_check_crc(s, crc, crc_extra_bits);
        if (ret < 0 && s->avctx->err_recognition & AV_EF_EXPLODE)
            return ret;
    return 0;
static inline int FUNC_0(WavpackFrameContext *VAR_0, GetBitContext *VAR_1,
                                 void *VAR_2, const int VAR_3)
{
    int VAR_4, VAR_5, VAR_6 = 0;
    int VAR_7, VAR_8;
    int VAR_9, VAR_10, VAR_11;
    int VAR_12                  = VAR_0->VAR_12;
    uint32_t crc             = VAR_0->sc.crc;
    uint32_t crc_extra_bits  = VAR_0->extra_sc.crc;
    int16_t *dst16           = VAR_2;
    int32_t *dst32           = VAR_2;
    float *VAR_13             = VAR_2;
    VAR_0->one = VAR_0->zero = VAR_0->zeroes = 0;
    do {
        VAR_11 = wv_get_value(VAR_0, VAR_1, 0, &VAR_7);
        VAR_10 = 0;
        if (VAR_7)
            break;
        for (VAR_4 = 0; VAR_4 < VAR_0->terms; VAR_4++) {
            VAR_8 = VAR_0->decorr[VAR_4].value;
            if (VAR_8 > 8) {
                if (VAR_8 & 1)
                    VAR_9 =  2 * VAR_0->decorr[VAR_4].samplesA[0] - VAR_0->decorr[VAR_4].samplesA[1];
                else
                    VAR_9 = (3 * VAR_0->decorr[VAR_4].samplesA[0] - VAR_0->decorr[VAR_4].samplesA[1]) >> 1;
                VAR_0->decorr[VAR_4].samplesA[1] = VAR_0->decorr[VAR_4].samplesA[0];
                VAR_5                        = 0;
            } else {
                VAR_9 = VAR_0->decorr[VAR_4].samplesA[VAR_12];
                VAR_5 = (VAR_12 + VAR_8) & 7;
            if (VAR_3 != AV_SAMPLE_FMT_S16P)
                VAR_10 = VAR_11 + ((VAR_0->decorr[VAR_4].weightA * (int64_t)VAR_9 + 512) >> 10);
            else
                VAR_10 = VAR_11 + ((VAR_0->decorr[VAR_4].weightA * VAR_9 + 512) >> 10);
            if (VAR_9 && VAR_11)
                VAR_0->decorr[VAR_4].weightA -= ((((VAR_11 ^ VAR_9) >> 30) & 2) - 1) * VAR_0->decorr[VAR_4].delta;
            VAR_0->decorr[VAR_4].samplesA[VAR_5] = VAR_11 = VAR_10;
        VAR_12 = (VAR_12 + 1) & 7;
        crc = crc * 3 + VAR_10;
        if (VAR_3 == AV_SAMPLE_FMT_FLTP) {
            *VAR_13++ = wv_get_value_float(VAR_0, &crc_extra_bits, VAR_10);
        } else if (VAR_3 == AV_SAMPLE_FMT_S32P) {
            *dst32++ = wv_get_value_integer(VAR_0, &crc_extra_bits, VAR_10);
        } else {
            *dst16++ = wv_get_value_integer(VAR_0, &crc_extra_bits, VAR_10);
        VAR_6++;
    } while (!VAR_7 && VAR_6 < VAR_0->samples);
    wv_reset_saved_context(VAR_0);
    if (VAR_0->avctx->err_recognition & AV_EF_CRCCHECK) {
        int ret = wv_check_crc(VAR_0, crc, crc_extra_bits);
        if (ret < 0 && VAR_0->avctx->err_recognition & AV_EF_EXPLODE)
            return ret;
    return 0;
static inline int FUNC_0(WavpackFrameContext *VAR_0, GetBitContext *VAR_1,
void *VAR_2, const int VAR_3)
{ int VAR_4, VAR_5, VAR_6 = 0; int VAR_7, VAR_8; int VAR_9, VAR_10, VAR_11; int VAR_12                  = VAR_0->VAR_12; uint32_t crc             = VAR_0->sc.crc; uint32_t crc_extra_bits  = VAR_0->extra_sc.crc; int16_t *dst16           = VAR_2; int32_t *dst32           = VAR_2; float *VAR_13             = VAR_2; VAR_0->one = VAR_0->zero = VAR_0->zeroes = 0; do { VAR_11 = wv_get_value(VAR_0, VAR_1, 0, &VAR_7); VAR_10 = 0; if (VAR_7)
break; for (VAR_4 = 0; VAR_4 < VAR_0->terms; VAR_4++) { VAR_8 = VAR_0->decorr[VAR_4].value; if (VAR_8 > 8) { if (VAR_8 & 1)
VAR_9 =  2 * VAR_0->decorr[VAR_4].samplesA[0] - VAR_0->decorr[VAR_4].samplesA[1]; else
VAR_9 = (3 * VAR_0->decorr[VAR_4].samplesA[0] - VAR_0->decorr[VAR_4].samplesA[1]) >> 1; VAR_0->decorr[VAR_4].samplesA[1] = VAR_0->decorr[VAR_4].samplesA[0]; VAR_5                        = 0; } else { VAR_9 = VAR_0->decorr[VAR_4].samplesA[VAR_12]; VAR_5 = (VAR_12 + VAR_8) & 7; if (VAR_3 != AV_SAMPLE_FMT_S16P)
VAR_10 = VAR_11 + ((VAR_0->decorr[VAR_4].weightA * (int64_t)VAR_9 + 512) >> 10); else
VAR_10 = VAR_11 + ((VAR_0->decorr[VAR_4].weightA * VAR_9 + 512) >> 10); if (VAR_9 && VAR_11)
VAR_0->decorr[VAR_4].weightA -= ((((VAR_11 ^ VAR_9) >> 30) & 2) - 1) * VAR_0->decorr[VAR_4].delta; VAR_0->decorr[VAR_4].samplesA[VAR_5] = VAR_11 = VAR_10; VAR_12 = (VAR_12 + 1) & 7; crc = crc * 3 + VAR_10; if (VAR_3 == AV_SAMPLE_FMT_FLTP) { *VAR_13++ = wv_get_value_float(VAR_0, &crc_extra_bits, VAR_10); } else if (VAR_3 == AV_SAMPLE_FMT_S32P) { *dst32++ = wv_get_value_integer(VAR_0, &crc_extra_bits, VAR_10); } else { *dst16++ = wv_get_value_integer(VAR_0, &crc_extra_bits, VAR_10); VAR_6++; } while (!VAR_7 && VAR_6 < VAR_0->samples); wv_reset_saved_context(VAR_0); if (VAR_0->avctx->err_recognition & AV_EF_CRCCHECK) { int ret = wv_check_crc(VAR_0, crc, crc_extra_bits); if (ret < 0 && VAR_0->avctx->err_recognition & AV_EF_EXPLODE)
return ret; return 0;