static int mpc8_probe(AVProbeData *p)

{

    const uint8_t *bs = p->buf + 4;

    const uint8_t *bs_end = bs + p->buf_size;

    int64_t size;



    if (p->buf_size < 16)

        return 0;

    if (AV_RL32(p->buf) != TAG_MPCK)

        return 0;

    while (bs < bs_end + 3) {

        int header_found = (bs[0] == 'S' && bs[1] == 'H');

        if (bs[0] < 'A' || bs[0] > 'Z' || bs[1] < 'A' || bs[1] > 'Z')

            return 0;

        bs += 2;

        size = bs_get_v(&bs);

        if (size < 2)

            return 0;

        if (bs + size - 2 >= bs_end)

            return AVPROBE_SCORE_EXTENSION - 1; // seems to be valid MPC but no header yet

        if (header_found) {

            if (size < 11 || size > 28)

                return 0;

            if (!AV_RL32(bs)) //zero CRC is invalid

                return 0;

            return AVPROBE_SCORE_MAX;

        } else {

            bs += size - 2;

        }

    }

    return 0;

}

static int mpc8_probe(AVProbeData *p)

{

    const uint8_t *bs = p->buf + 4;

    const uint8_t *bs_end = bs + p->buf_size;

    int64_t size;



    if (p->buf_size < 16)

        return 0;

    if (AV_RL32(p->buf) != TAG_MPCK)

        return 0;

    while (bs < bs_end + 3) {

        int header_found = (bs[0] == 'S' && bs[1] == 'H');

        if (bs[0] < 'A' || bs[0] > 'Z' || bs[1] < 'A' || bs[1] > 'Z')

            return 0;

        bs += 2;

        size = bs_get_v(&bs);

        if (size < 2)

            return 0;

        if (bs + size - 2 >= bs_end)

            return AVPROBE_SCORE_EXTENSION - 1; 

        if (header_found) {

            if (size < 11 || size > 28)

                return 0;

            if (!AV_RL32(bs)) 

                return 0;

            return AVPROBE_SCORE_MAX;

        } else {

            bs += size - 2;

        }

    }

    return 0;

}

        if (bs + size - 2 >= bs_end)
static int FUNC_0(AVProbeData *VAR_0)

{

    const uint8_t *VAR_1 = VAR_0->buf + 4;

    const uint8_t *VAR_2 = VAR_1 + VAR_0->buf_size;

    int64_t size;



    if (VAR_0->buf_size < 16)

        return 0;

    if (AV_RL32(VAR_0->buf) != TAG_MPCK)

        return 0;

    while (VAR_1 < VAR_2 + 3) {

        int VAR_3 = (VAR_1[0] == 'S' && VAR_1[1] == 'H');

        if (VAR_1[0] < 'A' || VAR_1[0] > 'Z' || VAR_1[1] < 'A' || VAR_1[1] > 'Z')

            return 0;

        VAR_1 += 2;

        size = bs_get_v(&VAR_1);

        if (size < 2)

            return 0;

        if (VAR_1 + size - 2 >= VAR_2)

            return AVPROBE_SCORE_EXTENSION - 1; 

        if (VAR_3) {

            if (size < 11 || size > 28)

                return 0;

            if (!AV_RL32(VAR_1)) 

                return 0;

            return AVPROBE_SCORE_MAX;

        } else {

            VAR_1 += size - 2;

        }

    }

    return 0;

}

static int FUNC_0(AVProbeData *VAR_0)
{ const uint8_t *VAR_1 = VAR_0->buf + 4; const uint8_t *VAR_2 = VAR_1 + VAR_0->buf_size; int64_t size; if (VAR_0->buf_size < 16)
return 0; if (AV_RL32(VAR_0->buf) != TAG_MPCK)
return 0; while (VAR_1 < VAR_2 + 3) { int VAR_3 = (VAR_1[0] == 'S' && VAR_1[1] == 'H'); if (VAR_1[0] < 'A' || VAR_1[0] > 'Z' || VAR_1[1] < 'A' || VAR_1[1] > 'Z')
return 0; VAR_1 += 2; size = bs_get_v(&VAR_1); if (size < 2)
return 0; if (VAR_1 + size - 2 >= VAR_2)
return AVPROBE_SCORE_EXTENSION - 1; if (VAR_3) { if (size < 11 || size > 28)
return 0; if (!AV_RL32(VAR_1))
return 0; return AVPROBE_SCORE_MAX; } else { VAR_1 += size - 2; } } return 0; }